summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>2005-07-11 04:14:43 +0000
committercvs2svn <cvs2svn@FreeBSD.org>2005-07-11 04:14:43 +0000
commitdd2adf2c10d3ca9d9241f6e88abf7a1d767388bc (patch)
tree01ec195a7173d8fedfd4ad521cb4ec0270d31c62
parent531103fe3ea5b3af1c9526870be6f0c14b574de8 (diff)
downloadFreeBSD-src-dd2adf2c10d3ca9d9241f6e88abf7a1d767388bc.zip
FreeBSD-src-dd2adf2c10d3ca9d9241f6e88abf7a1d767388bc.tar.gz
This commit was manufactured by cvs2svn to create branch 'RELENG_6'.
-rw-r--r--bin/uuidgen/Makefile6
-rw-r--r--bin/uuidgen/uuidgen.179
-rw-r--r--bin/uuidgen/uuidgen.c113
-rw-r--r--contrib/gdb/FREEBSD-diffs929
-rw-r--r--etc/rc.d/encswap55
-rw-r--r--etc/rc.d/lockd39
-rw-r--r--etc/rc.d/ppp48
-rw-r--r--etc/rc.d/statd39
-rw-r--r--lib/libarchive/archive_read_open_filename.c164
-rw-r--r--lib/libarchive/archive_write_open_filename.c166
-rw-r--r--lib/libc/gen/fts-compat.c1226
-rw-r--r--lib/libc/gen/fts-compat.h145
-rw-r--r--lib/libc/posix1e/mac_is_present.387
-rw-r--r--lib/libc/sys/shm_open.2192
-rw-r--r--lib/libkse/Makefile46
-rw-r--r--lib/libkse/arch/amd64/Makefile.inc5
-rw-r--r--lib/libkse/arch/amd64/amd64/context.S218
-rw-r--r--lib/libkse/arch/amd64/amd64/enter_uts.S41
-rw-r--r--lib/libkse/arch/amd64/amd64/pthread_md.c82
-rw-r--r--lib/libkse/arch/amd64/include/atomic_ops.h57
-rw-r--r--lib/libkse/arch/amd64/include/pthread_md.h268
-rw-r--r--lib/libkse/arch/arm/Makefile.inc7
-rw-r--r--lib/libkse/arch/arm/arm/context.S79
-rw-r--r--lib/libkse/arch/arm/arm/pthread_md.c86
-rw-r--r--lib/libkse/arch/arm/include/atomic_ops.h53
-rw-r--r--lib/libkse/arch/arm/include/pthread_md.h257
-rw-r--r--lib/libkse/arch/i386/Makefile.inc5
-rw-r--r--lib/libkse/arch/i386/i386/pthread_md.c101
-rw-r--r--lib/libkse/arch/i386/i386/thr_enter_uts.S44
-rw-r--r--lib/libkse/arch/i386/i386/thr_getcontext.S156
-rw-r--r--lib/libkse/arch/i386/include/atomic_ops.h51
-rw-r--r--lib/libkse/arch/i386/include/pthread_md.h264
-rw-r--r--lib/libkse/arch/ia64/Makefile.inc5
-rw-r--r--lib/libkse/arch/ia64/ia64/context.S351
-rw-r--r--lib/libkse/arch/ia64/ia64/enter_uts.S60
-rw-r--r--lib/libkse/arch/ia64/ia64/pthread_md.c75
-rw-r--r--lib/libkse/arch/ia64/include/atomic_ops.h47
-rw-r--r--lib/libkse/arch/ia64/include/pthread_md.h252
-rw-r--r--lib/libkse/arch/powerpc/Makefile.inc8
-rw-r--r--lib/libkse/arch/powerpc/include/atomic_ops.h62
-rw-r--r--lib/libkse/arch/powerpc/include/pthread_md.h258
-rw-r--r--lib/libkse/arch/powerpc/powerpc/assym.c113
-rw-r--r--lib/libkse/arch/powerpc/powerpc/assym.s113
-rw-r--r--lib/libkse/arch/powerpc/powerpc/context.S151
-rw-r--r--lib/libkse/arch/powerpc/powerpc/enter_uts.S40
-rw-r--r--lib/libkse/arch/powerpc/powerpc/pthread_md.c76
-rw-r--r--lib/libkse/arch/sparc64/Makefile.inc5
-rw-r--r--lib/libkse/arch/sparc64/include/atomic_ops.h75
-rw-r--r--lib/libkse/arch/sparc64/include/pthread_md.h254
-rw-r--r--lib/libkse/arch/sparc64/sparc64/assym.s15
-rw-r--r--lib/libkse/arch/sparc64/sparc64/pthread_md.c91
-rw-r--r--lib/libkse/arch/sparc64/sparc64/thr_getcontext.S87
-rw-r--r--lib/libkse/support/Makefile.inc40
-rw-r--r--lib/libkse/support/thr_support.c62
-rw-r--r--lib/libkse/sys/Makefile.inc5
-rw-r--r--lib/libkse/sys/lock.c344
-rw-r--r--lib/libkse/sys/lock.h95
-rw-r--r--lib/libkse/sys/thr_error.c59
-rw-r--r--lib/libkse/test/Makefile116
-rw-r--r--lib/libkse/test/README28
-rw-r--r--lib/libkse/test/guard_b.c150
-rw-r--r--lib/libkse/test/guard_b.exp3
-rw-r--r--lib/libkse/test/guard_s.pl69
-rw-r--r--lib/libkse/test/hello_b.c13
-rw-r--r--lib/libkse/test/hello_d.c38
-rw-r--r--lib/libkse/test/hello_d.exp1
-rw-r--r--lib/libkse/test/hello_s.c47
-rw-r--r--lib/libkse/test/join_leak_d.c108
-rw-r--r--lib/libkse/test/join_leak_d.exp2
-rw-r--r--lib/libkse/test/mutex_d.c1557
-rw-r--r--lib/libkse/test/mutex_d.exp290
-rw-r--r--lib/libkse/test/propagate_s.pl74
-rw-r--r--lib/libkse/test/sem_d.c133
-rw-r--r--lib/libkse/test/sem_d.exp22
-rw-r--r--lib/libkse/test/sigsuspend_d.c290
-rw-r--r--lib/libkse/test/sigsuspend_d.exp8
-rw-r--r--lib/libkse/test/sigwait_d.c304
-rw-r--r--lib/libkse/test/sigwait_d.exp10
-rw-r--r--lib/libkse/test/verify474
-rw-r--r--lib/libkse/thread/Makefile.inc115
-rw-r--r--lib/libkse/thread/thr_accept.c49
-rw-r--r--lib/libkse/thread/thr_aio_suspend.c51
-rw-r--r--lib/libkse/thread/thr_atfork.c56
-rw-r--r--lib/libkse/thread/thr_attr_destroy.c62
-rw-r--r--lib/libkse/thread/thr_attr_get_np.c54
-rw-r--r--lib/libkse/thread/thr_attr_getdetachstate.c59
-rw-r--r--lib/libkse/thread/thr_attr_getguardsize.c52
-rw-r--r--lib/libkse/thread/thr_attr_getinheritsched.c51
-rw-r--r--lib/libkse/thread/thr_attr_getschedparam.c51
-rw-r--r--lib/libkse/thread/thr_attr_getschedpolicy.c51
-rw-r--r--lib/libkse/thread/thr_attr_getscope.c54
-rw-r--r--lib/libkse/thread/thr_attr_getstack.c59
-rw-r--r--lib/libkse/thread/thr_attr_getstackaddr.c54
-rw-r--r--lib/libkse/thread/thr_attr_getstacksize.c54
-rw-r--r--lib/libkse/thread/thr_attr_init.c64
-rw-r--r--lib/libkse/thread/thr_attr_setcreatesuspend_np.c52
-rw-r--r--lib/libkse/thread/thr_attr_setdetachstate.c61
-rw-r--r--lib/libkse/thread/thr_attr_setguardsize.c53
-rw-r--r--lib/libkse/thread/thr_attr_setinheritsched.c54
-rw-r--r--lib/libkse/thread/thr_attr_setschedparam.c57
-rw-r--r--lib/libkse/thread/thr_attr_setschedpolicy.c53
-rw-r--r--lib/libkse/thread/thr_attr_setscope.c57
-rw-r--r--lib/libkse/thread/thr_attr_setstack.c58
-rw-r--r--lib/libkse/thread/thr_attr_setstackaddr.c54
-rw-r--r--lib/libkse/thread/thr_attr_setstacksize.c54
-rw-r--r--lib/libkse/thread/thr_autoinit.c64
-rw-r--r--lib/libkse/thread/thr_barrier.c122
-rw-r--r--lib/libkse/thread/thr_barrierattr.c93
-rw-r--r--lib/libkse/thread/thr_cancel.c302
-rw-r--r--lib/libkse/thread/thr_clean.c74
-rw-r--r--lib/libkse/thread/thr_close.c55
-rw-r--r--lib/libkse/thread/thr_concurrency.c172
-rw-r--r--lib/libkse/thread/thr_cond.c832
-rw-r--r--lib/libkse/thread/thr_condattr_destroy.c53
-rw-r--r--lib/libkse/thread/thr_condattr_init.c58
-rw-r--r--lib/libkse/thread/thr_connect.c49
-rw-r--r--lib/libkse/thread/thr_creat.c55
-rw-r--r--lib/libkse/thread/thr_create.c345
-rw-r--r--lib/libkse/thread/thr_detach.c117
-rw-r--r--lib/libkse/thread/thr_equal.c44
-rw-r--r--lib/libkse/thread/thr_execve.c63
-rw-r--r--lib/libkse/thread/thr_exit.c159
-rw-r--r--lib/libkse/thread/thr_fcntl.c78
-rw-r--r--lib/libkse/thread/thr_find_thread.c98
-rw-r--r--lib/libkse/thread/thr_fork.c128
-rw-r--r--lib/libkse/thread/thr_fsync.c51
-rw-r--r--lib/libkse/thread/thr_getprio.c56
-rw-r--r--lib/libkse/thread/thr_getschedparam.c75
-rw-r--r--lib/libkse/thread/thr_info.c225
-rw-r--r--lib/libkse/thread/thr_init.c495
-rw-r--r--lib/libkse/thread/thr_join.c162
-rw-r--r--lib/libkse/thread/thr_kern.c2545
-rw-r--r--lib/libkse/thread/thr_kill.c66
-rw-r--r--lib/libkse/thread/thr_main_np.c47
-rw-r--r--lib/libkse/thread/thr_mattr_init.c58
-rw-r--r--lib/libkse/thread/thr_mattr_kind_np.c97
-rw-r--r--lib/libkse/thread/thr_msync.c33
-rw-r--r--lib/libkse/thread/thr_multi_np.c50
-rw-r--r--lib/libkse/thread/thr_mutex.c1817
-rw-r--r--lib/libkse/thread/thr_mutex_prioceiling.c115
-rw-r--r--lib/libkse/thread/thr_mutex_protocol.c70
-rw-r--r--lib/libkse/thread/thr_mutexattr_destroy.c53
-rw-r--r--lib/libkse/thread/thr_nanosleep.c129
-rw-r--r--lib/libkse/thread/thr_once.c98
-rw-r--r--lib/libkse/thread/thr_open.c71
-rw-r--r--lib/libkse/thread/thr_pause.c51
-rw-r--r--lib/libkse/thread/thr_poll.c57
-rw-r--r--lib/libkse/thread/thr_printf.c135
-rw-r--r--lib/libkse/thread/thr_priority_queue.c324
-rw-r--r--lib/libkse/thread/thr_private.h1281
-rw-r--r--lib/libkse/thread/thr_pselect.c57
-rw-r--r--lib/libkse/thread/thr_pspinlock.c160
-rw-r--r--lib/libkse/thread/thr_raise.c53
-rw-r--r--lib/libkse/thread/thr_read.c56
-rw-r--r--lib/libkse/thread/thr_readv.c56
-rw-r--r--lib/libkse/thread/thr_resume_np.c107
-rw-r--r--lib/libkse/thread/thr_rtld.c300
-rw-r--r--lib/libkse/thread/thr_rwlock.c419
-rw-r--r--lib/libkse/thread/thr_rwlockattr.c98
-rw-r--r--lib/libkse/thread/thr_select.c65
-rw-r--r--lib/libkse/thread/thr_self.c47
-rw-r--r--lib/libkse/thread/thr_sem.c262
-rw-r--r--lib/libkse/thread/thr_seterrno.c59
-rw-r--r--lib/libkse/thread/thr_setprio.c52
-rw-r--r--lib/libkse/thread/thr_setschedparam.c136
-rw-r--r--lib/libkse/thread/thr_sig.c1250
-rw-r--r--lib/libkse/thread/thr_sigaction.c117
-rw-r--r--lib/libkse/thread/thr_sigaltstack.c107
-rw-r--r--lib/libkse/thread/thr_sigmask.c113
-rw-r--r--lib/libkse/thread/thr_sigpending.c73
-rw-r--r--lib/libkse/thread/thr_sigprocmask.c55
-rw-r--r--lib/libkse/thread/thr_sigsuspend.c106
-rw-r--r--lib/libkse/thread/thr_sigwait.c202
-rw-r--r--lib/libkse/thread/thr_single_np.c49
-rw-r--r--lib/libkse/thread/thr_sleep.c51
-rw-r--r--lib/libkse/thread/thr_spec.c227
-rw-r--r--lib/libkse/thread/thr_spinlock.c148
-rw-r--r--lib/libkse/thread/thr_stack.c258
-rw-r--r--lib/libkse/thread/thr_suspend_np.c109
-rw-r--r--lib/libkse/thread/thr_switch_np.c53
-rw-r--r--lib/libkse/thread/thr_symbols.c60
-rw-r--r--lib/libkse/thread/thr_system.c51
-rw-r--r--lib/libkse/thread/thr_tcdrain.c51
-rw-r--r--lib/libkse/thread/thr_vfork.c12
-rw-r--r--lib/libkse/thread/thr_wait.c50
-rw-r--r--lib/libkse/thread/thr_wait4.c57
-rw-r--r--lib/libkse/thread/thr_waitpid.c52
-rw-r--r--lib/libkse/thread/thr_write.c56
-rw-r--r--lib/libkse/thread/thr_writev.c58
-rw-r--r--lib/libkse/thread/thr_yield.c73
-rw-r--r--lib/ncurses/form/Makefile97
-rw-r--r--lib/ncurses/menu/Makefile82
-rw-r--r--lib/ncurses/ncurses/Makefile561
-rw-r--r--lib/ncurses/ncurses/ncurses_cfg.h155
-rw-r--r--lib/ncurses/ncurses/pathnames.h38
-rw-r--r--lib/ncurses/ncurses/termcap.c267
-rw-r--r--lib/ncurses/panel/Makefile46
-rw-r--r--release/doc/en_US.ISO8859-1/hardware/article.sgml955
-rw-r--r--release/doc/en_US.ISO8859-1/relnotes/article.sgml1668
-rw-r--r--sbin/recoverdisk/Makefile12
-rw-r--r--sbin/recoverdisk/recoverdisk.c144
-rw-r--r--sbin/setkey/Makefile62
-rw-r--r--sbin/setkey/parse.y1267
-rw-r--r--share/man/man4/spkr.4249
-rw-r--r--share/man/man9/VOP_VPTOFH.961
-rw-r--r--sys/boot/i386/gptboot/Makefile103
-rw-r--r--sys/boot/i386/gptboot/gptboot.c654
-rw-r--r--sys/boot/ia64/common/bootinfo.c345
-rw-r--r--sys/boot/ia64/common/copy.c55
-rw-r--r--sys/boot/ia64/common/devicename.c241
-rw-r--r--sys/boot/ia64/common/exec.c212
-rw-r--r--sys/boot/powerpc/ofw/Makefile103
-rw-r--r--sys/boot/powerpc/ofw/conf.c118
-rw-r--r--sys/boot/powerpc/ofw/help.ofw1
-rw-r--r--sys/boot/powerpc/ofw/ldscript.powerpc139
-rw-r--r--sys/boot/powerpc/ofw/metadata.c314
-rw-r--r--sys/boot/powerpc/ofw/start.c60
-rw-r--r--sys/boot/powerpc/ofw/version6
-rw-r--r--sys/dev/agp/agp.c930
-rw-r--r--sys/dev/agp/agp_ali.c276
-rw-r--r--sys/dev/agp/agp_amd.c420
-rw-r--r--sys/dev/agp/agp_amd64.c314
-rw-r--r--sys/dev/agp/agp_i810.c751
-rw-r--r--sys/dev/agp/agp_if.m134
-rw-r--r--sys/dev/agp/agp_intel.c425
-rw-r--r--sys/dev/agp/agp_nvidia.c456
-rw-r--r--sys/dev/agp/agp_sis.c298
-rw-r--r--sys/dev/agp/agp_via.c368
-rw-r--r--sys/dev/agp/agppriv.h105
-rw-r--r--sys/dev/agp/agpreg.h265
-rw-r--r--sys/dev/agp/agpvar.h126
-rw-r--r--sys/dev/dc/dcphy.c459
-rw-r--r--sys/dev/dc/if_dc.c3824
-rw-r--r--sys/dev/dc/if_dcreg.h1226
-rw-r--r--sys/dev/dc/pnphy.c274
-rw-r--r--sys/dev/de/dc21040reg.h583
-rw-r--r--sys/dev/de/if_de.c5229
-rw-r--r--sys/dev/de/if_devar.h1009
-rw-r--r--sys/dev/fb/creatorreg.h246
-rw-r--r--sys/dev/fb/gallant12x22.c6185
-rw-r--r--sys/dev/sf/if_sf.c1568
-rw-r--r--sys/dev/sf/if_sfreg.h1064
-rw-r--r--sys/dev/sk/if_sk.c3002
-rw-r--r--sys/dev/sk/if_skreg.h1499
-rw-r--r--sys/dev/sk/xmaciireg.h403
-rw-r--r--sys/dev/sk/yukonreg.h171
-rw-r--r--sys/dev/speaker/speaker.h29
-rw-r--r--sys/dev/speaker/spkr.c656
-rw-r--r--sys/dev/ti/if_ti.c3548
-rw-r--r--sys/dev/ti/if_tireg.h1072
-rw-r--r--sys/dev/ti/ti_fw.h4593
-rw-r--r--sys/dev/ti/ti_fw2.h5232
-rw-r--r--sys/dev/vr/if_vr.c1707
-rw-r--r--sys/dev/vr/if_vrreg.h598
-rw-r--r--sys/fs/cd9660/TODO43
-rw-r--r--sys/fs/cd9660/TODO.hibler16
-rw-r--r--sys/fs/cd9660/cd9660_bmap.c104
-rw-r--r--sys/fs/cd9660/cd9660_iconv.c36
-rw-r--r--sys/fs/cd9660/cd9660_lookup.c429
-rw-r--r--sys/fs/cd9660/cd9660_mount.h54
-rw-r--r--sys/fs/cd9660/cd9660_node.c329
-rw-r--r--sys/fs/cd9660/cd9660_node.h116
-rw-r--r--sys/fs/cd9660/cd9660_rrip.c717
-rw-r--r--sys/fs/cd9660/cd9660_rrip.h137
-rw-r--r--sys/fs/cd9660/cd9660_util.c243
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c837
-rw-r--r--sys/fs/cd9660/cd9660_vnops.c832
-rw-r--r--sys/fs/cd9660/iso.h357
-rw-r--r--sys/fs/cd9660/iso_rrip.h82
-rw-r--r--sys/fs/coda/README62
-rw-r--r--sys/fs/coda/TODO17
-rw-r--r--sys/fs/coda/cnode.h210
-rw-r--r--sys/fs/coda/coda.h825
-rw-r--r--sys/fs/coda/coda_fbsd.c139
-rw-r--r--sys/fs/coda/coda_io.h59
-rw-r--r--sys/fs/coda/coda_kernel.h66
-rw-r--r--sys/fs/coda/coda_namecache.c758
-rw-r--r--sys/fs/coda/coda_namecache.h194
-rw-r--r--sys/fs/coda/coda_opstats.h127
-rw-r--r--sys/fs/coda/coda_pioctl.h70
-rw-r--r--sys/fs/coda/coda_psdev.c672
-rw-r--r--sys/fs/coda/coda_psdev.h39
-rw-r--r--sys/fs/coda/coda_subr.c573
-rw-r--r--sys/fs/coda/coda_subr.h45
-rw-r--r--sys/fs/coda/coda_venus.c678
-rw-r--r--sys/fs/coda/coda_venus.h132
-rw-r--r--sys/fs/coda/coda_vfsops.c530
-rw-r--r--sys/fs/coda/coda_vfsops.h63
-rw-r--r--sys/fs/coda/coda_vnops.c1845
-rw-r--r--sys/fs/coda/coda_vnops.h86
-rw-r--r--sys/i4b/include/i4b_cause.h148
-rw-r--r--sys/i4b/include/i4b_debug.h302
-rw-r--r--sys/i4b/include/i4b_ioctl.h743
-rw-r--r--sys/i4b/include/i4b_rbch_ioctl.h54
-rw-r--r--sys/i4b/include/i4b_tel_ioctl.h94
-rw-r--r--sys/i4b/include/i4b_trace.h91
-rw-r--r--sys/isa/atrtc.c970
-rw-r--r--sys/kern/ksched.c305
-rw-r--r--sys/kern/p1003_1b.c356
-rw-r--r--sys/kern/posix4_mib.c150
-rw-r--r--sys/kern/subr_acl_posix1e.c1023
-rw-r--r--sys/kern/subr_clist.c697
-rw-r--r--sys/kern/subr_rtc.c317
-rw-r--r--sys/kern/uipc_sockbuf.c1503
-rw-r--r--sys/kern/vfs_acl.c1023
-rw-r--r--sys/kern/vfs_extattr.c4923
-rw-r--r--sys/netinet/tcp_reass.c3250
-rw-r--r--sys/netinet/tcp_timewait.c2254
-rw-r--r--sys/pc98/cbus/pcrtc.c908
-rw-r--r--sys/powerpc/aim/clock.c342
-rw-r--r--sys/powerpc/aim/copyinout.c350
-rw-r--r--sys/powerpc/aim/interrupt.c117
-rw-r--r--sys/powerpc/aim/locore.S199
-rw-r--r--sys/powerpc/aim/machdep.c989
-rw-r--r--sys/powerpc/aim/mmu_oea.c2476
-rw-r--r--sys/powerpc/aim/nexus.c418
-rw-r--r--sys/powerpc/aim/ofw_machdep.c257
-rw-r--r--sys/powerpc/aim/ofwmagic.S75
-rw-r--r--sys/powerpc/aim/swtch.S154
-rw-r--r--sys/powerpc/aim/trap.c661
-rw-r--r--sys/powerpc/aim/trap_subr.S530
-rw-r--r--sys/powerpc/aim/uio_machdep.c120
-rw-r--r--sys/powerpc/aim/uma_machdep.c91
-rw-r--r--sys/powerpc/aim/vm_machdep.c364
-rw-r--r--sys/powerpc/powerpc/mmu_oea.c2476
-rw-r--r--sys/powerpc/psim/uart_iobus.c108
-rw-r--r--sys/rpc/types.h106
-rw-r--r--sys/security/mac/mac_framework.c1255
-rw-r--r--sys/security/mac/mac_framework.h476
-rw-r--r--sys/security/mac/mac_policy.h625
-rw-r--r--sys/security/mac/mac_syscalls.c1255
-rw-r--r--sys/sparc64/include/ofw_nexus.h72
-rw-r--r--sys/sys/_semaphore.h73
-rw-r--r--sys/sys/ksem.h59
-rw-r--r--sys/sys/posix4.h116
-rw-r--r--sys/sys/semaphore.h67
-rw-r--r--tools/kerneldoc/Doxyfile211
-rw-r--r--tools/kerneldoc/Makefile30
-rw-r--r--tools/regression/usr.bin/sed/hanoi.sed103
-rw-r--r--tools/regression/usr.bin/sed/math.sed439
-rw-r--r--tools/regression/usr.bin/sed/multitest.t556
-rw-r--r--tools/regression/usr.bin/sed/sed.test556
-rw-r--r--usr.bin/ministat/Makefile14
-rw-r--r--usr.bin/ministat/README50
-rw-r--r--usr.bin/ministat/chameleon6
-rw-r--r--usr.bin/ministat/iguana8
-rw-r--r--usr.bin/ministat/ministat.c586
-rw-r--r--usr.bin/truss/amd64-fbsd32.c340
-rw-r--r--usr.bin/truss/amd64-linux32.c335
-rw-r--r--usr.sbin/config/config.5354
-rw-r--r--usr.sbin/sade/Makefile106
-rw-r--r--usr.sbin/sade/command.c184
-rw-r--r--usr.sbin/sade/config.c1115
-rw-r--r--usr.sbin/sade/devices.c591
-rw-r--r--usr.sbin/sade/disks.c1001
-rw-r--r--usr.sbin/sade/dispatch.c440
-rw-r--r--usr.sbin/sade/dmenu.c319
-rw-r--r--usr.sbin/sade/globals.c93
-rw-r--r--usr.sbin/sade/help/partition.hlp169
-rw-r--r--usr.sbin/sade/help/slice.hlp65
-rw-r--r--usr.sbin/sade/install.c1267
-rw-r--r--usr.sbin/sade/keymap.c95
-rw-r--r--usr.sbin/sade/label.c1692
-rw-r--r--usr.sbin/sade/list.h60
-rw-r--r--usr.sbin/sade/main.c187
-rw-r--r--usr.sbin/sade/menus.c2290
-rw-r--r--usr.sbin/sade/misc.c529
-rw-r--r--usr.sbin/sade/msg.c356
-rw-r--r--usr.sbin/sade/rtermcap.c15
-rw-r--r--usr.sbin/sade/sade.8949
-rw-r--r--usr.sbin/sade/sade.h888
-rw-r--r--usr.sbin/sade/system.c542
-rw-r--r--usr.sbin/sade/termcap.c150
-rw-r--r--usr.sbin/sade/usb.c44
-rw-r--r--usr.sbin/sade/variable.c326
-rw-r--r--usr.sbin/sade/wizard.c201
376 files changed, 0 insertions, 148350 deletions
diff --git a/bin/uuidgen/Makefile b/bin/uuidgen/Makefile
deleted file mode 100644
index 370241d..0000000
--- a/bin/uuidgen/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-
-PROG= uuidgen
-WARNS?= 6
-
-.include <bsd.prog.mk>
diff --git a/bin/uuidgen/uuidgen.1 b/bin/uuidgen/uuidgen.1
deleted file mode 100644
index e685369..0000000
--- a/bin/uuidgen/uuidgen.1
+++ /dev/null
@@ -1,79 +0,0 @@
-.\" Copyright (c) 2002 Marcel Moolenaar
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\"
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 23, 2002
-.Dt UUIDGEN 1
-.Os
-.Sh NAME
-.Nm uuidgen
-.Nd generate universally unique identifiers
-.Sh SYNOPSIS
-.Nm
-.Op Fl 1
-.Op Fl n Ar count
-.Op Fl o Ar filename
-.Sh DESCRIPTION
-The
-.Nm
-utility by default generates a single universally unique identifier (UUID),
-also known as a globally unique identifier (GUID).
-The UUID is written to stdout by default.
-The following options can be used to change the behaviour of
-.Nm :
-.Bl -tag -width indent
-.It Fl 1
-This option only has effect if multiple identifiers are to be generated and
-instructs
-.Nm
-to not generate them in batch, but one at a time.
-.It Fl n
-This option controls the number of identifiers generated.
-By default, multiple
-identifiers are generated in batch.
-.It Fl o
-Redirect output to
-.Ar filename
-instead of stdout.
-.El
-.Pp
-Batched generation yields a dense set of identifiers in such a way that there
-is no identifier that is larger than the smallest identifier in the set and
-smaller than the largest identifier in the set and that is not already in the
-set.
-.Pp
-When generating the identifiers one at a time, the identifiers will be close
-to each other, but operating system latency and processing time will be
-reflected in the distance between two successive identifiers.
-.Sh EXIT STATUS
-.Ex -std
-.Sh SEE ALSO
-.Xr uuidgen 2 ,
-.Xr uuid 3
-.Sh HISTORY
-The
-.Nm
-command first appeared in
-.Fx 5.0 .
diff --git a/bin/uuidgen/uuidgen.c b/bin/uuidgen/uuidgen.c
deleted file mode 100644
index d5dac4b..0000000
--- a/bin/uuidgen/uuidgen.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2002 Marcel Moolenaar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <uuid.h>
-
-static void
-usage(void)
-{
- (void)fprintf(stderr, "usage: uuidgen [-1] [-n count] [-o filename]\n");
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- FILE *fp;
- uuid_t *store, *uuid;
- char *p;
- int ch, count, i, iterate;
-
- count = -1; /* no count yet */
- fp = stdout; /* default output file */
- iterate = 0; /* not one at a time */
- while ((ch = getopt(argc, argv, "1n:o:")) != -1)
- switch (ch) {
- case '1':
- iterate = 1;
- break;
- case 'n':
- if (count > 0)
- usage();
- count = strtol(optarg, &p, 10);
- if (*p != 0 || count < 1)
- usage();
- break;
- case 'o':
- if (fp != stdout)
- errx(1, "multiple output files not allowed");
- fp = fopen(optarg, "w");
- if (fp == NULL)
- err(1, "fopen");
- break;
- default:
- usage();
- }
- argv += optind;
- argc -= optind;
-
- if (argc)
- usage();
-
- if (count == -1)
- count = 1;
-
- store = (uuid_t*)malloc(sizeof(uuid_t) * count);
- if (store == NULL)
- err(1, "malloc()");
-
- if (!iterate) {
- /* Get them all in a single batch */
- if (uuidgen(store, count) != 0)
- err(1, "uuidgen()");
- } else {
- uuid = store;
- for (i = 0; i < count; i++) {
- if (uuidgen(uuid++, 1) != 0)
- err(1, "uuidgen()");
- }
- }
-
- uuid = store;
- while (count--) {
- uuid_to_string(uuid++, &p, NULL);
- fprintf(fp, "%s\n", p);
- free(p);
- }
-
- free(store);
- if (fp != stdout)
- fclose(fp);
- return (0);
-}
diff --git a/contrib/gdb/FREEBSD-diffs b/contrib/gdb/FREEBSD-diffs
deleted file mode 100644
index 85eb8d8..0000000
--- a/contrib/gdb/FREEBSD-diffs
+++ /dev/null
@@ -1,929 +0,0 @@
-Index: gdb/ia64-fbsd-nat.c
-===================================================================
-RCS file: gdb/ia64-fbsd-nat.c
-diff -N gdb/ia64-fbsd-nat.c
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ gdb/ia64-fbsd-nat.c 17 Apr 2004 19:39:20 -0000 1.3
-@@ -0,0 +1,145 @@
-+/*
-+ * Copyright (c) 2004 Marcel Moolenaar
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ *
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * 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 "defs.h"
-+#include "inferior.h"
-+#include "regcache.h"
-+
-+#include <sys/types.h>
-+#include <sys/ptrace.h>
-+#include <machine/reg.h>
-+
-+#ifdef HAVE_SYS_PROCFS_H
-+#include <sys/procfs.h>
-+#endif
-+
-+#ifndef HAVE_GREGSET_T
-+typedef struct reg gregset_t;
-+#endif
-+
-+#ifndef HAVE_FPREGSET_T
-+typedef struct fpreg fpregset_t;
-+#endif
-+
-+#include "gregset.h"
-+
-+#define FPREG_SUPPLIES(r) ((r) >= IA64_FR0_REGNUM && (r) <= IA64_FR127_REGNUM)
-+#define GREG_SUPPLIES(r) (!FPREG_SUPPLIES(r))
-+
-+/* XXX need to go away. */
-+void ia64_fbsd_supply_fpregs (void *, int);
-+void ia64_fbsd_supply_gregs (void *, int);
-+
-+void
-+fetch_inferior_registers (int regno)
-+{
-+ union {
-+ fpregset_t fpr;
-+ gregset_t r;
-+ } regs;
-+
-+ if (regno == -1 || GREG_SUPPLIES(regno))
-+ {
-+ if (ptrace (PT_GETREGS, PIDGET(inferior_ptid),
-+ (PTRACE_ARG3_TYPE)&regs.r, 0) == -1)
-+ perror_with_name ("Couldn't get registers");
-+ ia64_fbsd_supply_gregs (&regs.r, regno);
-+ if (regno != -1)
-+ return;
-+ }
-+
-+ if (regno == -1 || FPREG_SUPPLIES(regno))
-+ {
-+ if (ptrace (PT_GETFPREGS, PIDGET(inferior_ptid),
-+ (PTRACE_ARG3_TYPE)&regs.fpr, 0) == -1)
-+ perror_with_name ("Couldn't get FP registers");
-+ ia64_fbsd_supply_fpregs (&regs.fpr, regno);
-+ if (regno != -1)
-+ return;
-+ }
-+}
-+
-+void
-+store_inferior_registers (int regno)
-+{
-+ union {
-+ fpregset_t fpr;
-+ gregset_t r;
-+ } regs;
-+
-+ if (regno == -1 || GREG_SUPPLIES(regno))
-+ {
-+ if (ptrace (PT_GETREGS, PIDGET(inferior_ptid),
-+ (PTRACE_ARG3_TYPE)&regs.r, 0) == -1)
-+ perror_with_name ("Couldn't get registers");
-+ fill_gregset (&regs.r, regno);
-+ if (ptrace (PT_SETREGS, PIDGET(inferior_ptid),
-+ (PTRACE_ARG3_TYPE)&regs.r, 0) == -1)
-+ perror_with_name ("Couldn't get registers");
-+ if (regno != -1)
-+ return;
-+ }
-+
-+ if (regno == -1 || FPREG_SUPPLIES(regno))
-+ {
-+ if (ptrace (PT_GETFPREGS, PIDGET(inferior_ptid),
-+ (PTRACE_ARG3_TYPE)&regs.fpr, 0) == -1)
-+ perror_with_name ("Couldn't get FP registers");
-+ fill_fpregset (&regs.fpr, regno);
-+ if (ptrace (PT_SETFPREGS, PIDGET(inferior_ptid),
-+ (PTRACE_ARG3_TYPE)&regs.fpr, 0) == -1)
-+ perror_with_name ("Couldn't get FP registers");
-+ if (regno != -1)
-+ return;
-+ }
-+}
-+
-+LONGEST ia64_fbsd_xfer_dirty (struct target_ops *ops, enum target_object obj,
-+ const char *annex, void *rbuf, const void *wbuf,
-+ ULONGEST ofs, LONGEST len)
-+{
-+ if (len != 8)
-+ return (-1);
-+ if (rbuf != NULL) {
-+ if (ptrace (PT_GETKSTACK, PIDGET(inferior_ptid), (PTRACE_ARG3_TYPE)rbuf,
-+ ofs >> 3) == -1) {
-+ perror_with_name ("Couldn't read dirty register");
-+ return (-1);
-+ }
-+ } else {
-+ if (ptrace (PT_SETKSTACK, PIDGET(inferior_ptid), (PTRACE_ARG3_TYPE)wbuf,
-+ ofs >> 3) == -1) {
-+ perror_with_name ("Couldn't write dirty register");
-+ return (-1);
-+ }
-+ }
-+ return (len);
-+}
-+
-+void
-+_initialize_ia64_fbsd_nat (void)
-+{
-+}
-Index: gdb/ia64-fbsd-tdep.c
-===================================================================
-RCS file: gdb/ia64-fbsd-tdep.c
-diff -N gdb/ia64-fbsd-tdep.c
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ gdb/ia64-fbsd-tdep.c 17 Apr 2004 19:39:20 -0000 1.6
-@@ -0,0 +1,291 @@
-+/*
-+ * Copyright (c) 2004 Marcel Moolenaar
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ *
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * 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 "defs.h"
-+#include "gdb_string.h"
-+#include "regcache.h"
-+#include "regset.h"
-+#include "solib-svr4.h"
-+#include "value.h"
-+
-+#include "ia64-tdep.h"
-+
-+#define FPREG_SUPPLIES(r) ((r) >= IA64_FR0_REGNUM && (r) <= IA64_FR127_REGNUM)
-+#define GREG_SUPPLIES(r) (!FPREG_SUPPLIES(r))
-+
-+static int reg_offset[462] = {
-+ -1, 96, 248, 256, 152, 160, 168, 176, /* Regs 0-7. */
-+ 264, 272, 280, 288, 0, 64, 296, 304, /* Regs 8-15. */
-+ 312, 320, 328, 336, 344, 352, 360, 368, /* Regs 16-23. */
-+ 376, 384, 392, 400, 408, 416, 424, 432, /* Regs 24-31. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 32-39. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 40-47. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 48-55. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 56-63. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 64-71. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 72-79. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 80-87. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 88-95. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 96-103. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 104-111. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 112-119. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 120-127. */
-+ -1, -1, 0, 16, 32, 48, 320, 336, /* Regs 128-135. */
-+ 352, 368, 384, 400, 416, 432, 448, 464, /* Regs 136-143. */
-+ 64, 80, 96, 112, 128, 144, 160, 176, /* Regs 144-151. */
-+ 192, 208, 224, 240, 256, 272, 288, 304, /* Regs 152-159. */
-+ 480, 496, 512, 528, 544, 560, 576, 592, /* Regs 160-167. */
-+ 608, 624, 640, 656, 672, 688, 704, 720, /* Regs 168-175. */
-+ 736, 752, 768, 784, 800, 816, 832, 848, /* Regs 176-183. */
-+ 864, 880, 896, 912, 928, 944, 960, 976, /* Regs 184-191. */
-+ 992, 1008, 1024, 1040, 1056, 1072, 1088, 1104, /* Regs 192-199. */
-+ 1120, 1136, 1152, 1168, 1184, 1200, 1216, 1232, /* Regs 200-207. */
-+ 1248, 1264, 1280, 1296, 1312, 1328, 1344, 1360, /* Regs 208-215. */
-+ 1376, 1392, 1408, 1424, 1440, 1456, 1472, 1488, /* Regs 216-223. */
-+ 1504, 1520, 1536, 1552, 1568, 1584, 1600, 1616, /* Regs 224-231. */
-+ 1632, 1648, 1664, 1680, 1696, 1712, 1728, 1744, /* Regs 232-239. */
-+ 1760, 1776, 1792, 1808, 1824, 1840, 1856, 1872, /* Regs 240-247. */
-+ 1888, 1904, 1920, 1936, 1952, 1968, 1984, 2000, /* Regs 248-255. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 256-263. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 264-271. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 272-279. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 280-287. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 288-295. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 296-303. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 304-311. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 312-319. */
-+ 16, 184, 192, 200, 208, 216, 440, 448, /* Regs 320-327. */
-+ -1, -1, 24, 120, 88, 112, -1, -1, /* Regs 328-335. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 336-343. */
-+ -1, -1, -1, -1, -1, -1, 72, 104, /* Regs 344-351. */
-+ 40, 48, -1, -1, -1, -1, -1, 464, /* Regs 352-359. */
-+ 472, -1, -1, -1, -1, -1, 456, -1, /* Regs 360-367. */
-+ -1, -1, 8, -1, -1, -1, 80, -1, /* Regs 368-375. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 376-383. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 384-391. */
-+ -1, -1, -1, -1, -1, -1, 32, 224, /* Regs 392-399. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 400-407. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 408-415. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 416-423. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 424-431. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 432-439. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 440-447. */
-+ -1, -1, -1, -1, -1, -1, -1, -1, /* Regs 448-455. */
-+ -1, -1, -1, -1, -1, -1
-+};
-+
-+static void
-+ia64_fbsd_regcache_collect (struct regcache *regcache, int regno,
-+ void *regs)
-+{
-+ int ofs;
-+
-+ if (regno < 0 || regno >= NUM_REGS)
-+ return;
-+
-+ ofs = reg_offset[regno];
-+ if (ofs >= 0)
-+ regcache_raw_collect (regcache, regno, (char*)regs + ofs);
-+}
-+
-+static void
-+ia64_fbsd_regcache_supply (struct regcache *regcache, int regno,
-+ const void *regs)
-+{
-+ int ofs;
-+
-+ if (regno < 0 || regno >= NUM_REGS)
-+ return;
-+
-+ ofs = reg_offset[regno];
-+ if (regno == IA64_BSP_REGNUM)
-+ {
-+ /* BSP is synthesized. It's not actually present in struct reg,
-+ but can be derived from bspstore and ndirty. The offset of
-+ IA64_BSP_REGNUM in the reg_offset array above is that of the
-+ ndirty field in struct reg. */
-+ uint64_t bsp;
-+ bsp = *((uint64_t*)((char *)regs + ofs)); /* ndirty */
-+ bsp += *((uint64_t*)((char *)regs + reg_offset[IA64_BSPSTORE_REGNUM]));
-+ regcache_raw_supply (regcache, regno, &bsp);
-+ }
-+ else
-+ {
-+ if (ofs < 0)
-+ regcache_raw_supply (regcache, regno, NULL);
-+ else
-+ regcache_raw_supply (regcache, regno, (char *)regs + ofs);
-+ }
-+}
-+
-+void
-+fill_fpregset (void *fpregs, int regno)
-+{
-+ if (regno == -1)
-+ {
-+ for (regno = 0; regno < NUM_REGS; regno++)
-+ {
-+ if (FPREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_collect (current_regcache, regno, fpregs);
-+ }
-+ }
-+ else
-+ {
-+ if (FPREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_collect (current_regcache, regno, fpregs);
-+ }
-+}
-+
-+void
-+fill_gregset (void *gregs, int regno)
-+{
-+ if (regno == -1)
-+ {
-+ for (regno = 0; regno < NUM_REGS; regno++)
-+ {
-+ if (GREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_collect (current_regcache, regno, gregs);
-+ }
-+ }
-+ else
-+ {
-+ if (GREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_collect (current_regcache, regno, gregs);
-+ }
-+}
-+
-+void
-+ia64_fbsd_supply_fpregs (const void *fpregs, int regno)
-+{
-+ if (regno == -1)
-+ {
-+ for (regno = 0; regno < NUM_REGS; regno++)
-+ {
-+ if (FPREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_supply (current_regcache, regno, fpregs);
-+ }
-+ }
-+ else
-+ {
-+ if (FPREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_supply (current_regcache, regno, fpregs);
-+ }
-+}
-+
-+void
-+ia64_fbsd_supply_gregs (const void *gregs, int regno)
-+{
-+ if (regno == -1)
-+ {
-+ for (regno = 0; regno < NUM_REGS; regno++)
-+ {
-+ if (GREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_supply (current_regcache, regno, gregs);
-+ }
-+ }
-+ else
-+ {
-+ if (GREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_supply (current_regcache, regno, gregs);
-+ }
-+}
-+
-+static void
-+ia64_fbsd_supply_gregset (const struct regset *regset,
-+ struct regcache *regcache, int regno,
-+ const void *gregs, size_t len)
-+{
-+ if (regno == -1)
-+ {
-+ for (regno = 0; regno < NUM_REGS; regno++)
-+ {
-+ if (GREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_supply (regcache, regno, gregs);
-+ }
-+ }
-+ else
-+ if (GREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_supply (regcache, regno, gregs);
-+}
-+
-+static void
-+ia64_fbsd_supply_fpregset (const struct regset *regset,
-+ struct regcache *regcache, int regno,
-+ const void *fpregs, size_t len)
-+{
-+ if (regno == -1)
-+ {
-+ for (regno = 0; regno < NUM_REGS; regno++)
-+ {
-+ if (FPREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_supply (regcache, regno, fpregs);
-+ }
-+ }
-+ else
-+ if (FPREG_SUPPLIES(regno))
-+ ia64_fbsd_regcache_supply (regcache, regno, fpregs);
-+}
-+
-+static struct regset gregset = { NULL, ia64_fbsd_supply_gregset };
-+static struct regset fpregset = { NULL, ia64_fbsd_supply_fpregset };
-+
-+static const struct regset *
-+ia64_fbsd_regset_from_core_section (struct gdbarch *gdbarch,
-+ const char *sect_name, size_t sect_size)
-+{
-+ if (strcmp (sect_name, ".reg") == 0)
-+ return (&gregset);
-+ if (strcmp (sect_name, ".reg2") == 0)
-+ return (&fpregset);
-+ return (NULL);
-+}
-+
-+static int
-+ia64_fbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
-+{
-+ uint64_t gwpage = 5ULL << 61;
-+ return (pc >= gwpage && pc < (gwpage + 8192)) ? 1 : 0;
-+}
-+
-+static void
-+ia64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-+{
-+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-+
-+ set_gdbarch_pc_in_sigtramp (gdbarch, ia64_fbsd_pc_in_sigtramp);
-+ set_gdbarch_regset_from_core_section (gdbarch,
-+ ia64_fbsd_regset_from_core_section);
-+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
-+ svr4_lp64_fetch_link_map_offsets);
-+ tdep->find_global_pointer = ia64_generic_find_global_pointer;
-+}
-+
-+void
-+_initialize_ia64_fbsd_tdep (void)
-+{
-+ gdbarch_register_osabi (bfd_arch_ia64, 0ul, GDB_OSABI_FREEBSD_ELF,
-+ ia64_fbsd_init_abi);
-+}
-Index: gdb/ia64-tdep.c
-===================================================================
-RCS file: /home/marcel/CVS/gdb6/gdb/ia64-tdep.c,v
-retrieving revision 1.1.1.3
-retrieving revision 1.5
-diff -u -r1.1.1.3 -r1.5
---- gdb/ia64-tdep.c 16 Apr 2004 00:51:25 -0000 1.1.1.3
-+++ gdb/ia64-tdep.c 16 Apr 2004 01:28:33 -0000 1.5
-@@ -45,17 +45,6 @@
- #include "libunwind-ia64.h"
- #endif
-
--/* Hook for determining the global pointer when calling functions in
-- the inferior under AIX. The initialization code in ia64-aix-nat.c
-- sets this hook to the address of a function which will find the
-- global pointer for a given address.
--
-- The generic code which uses the dynamic section in the inferior for
-- finding the global pointer is not of much use on AIX since the
-- values obtained from the inferior have not been relocated. */
--
--CORE_ADDR (*native_find_global_pointer) (CORE_ADDR) = 0;
--
- /* An enumeration of the different IA-64 instruction types. */
-
- typedef enum instruction_type
-@@ -256,20 +245,6 @@
-
- };
-
--struct gdbarch_tdep
-- {
-- CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int);
-- /* OS specific function which, given a frame address
-- and register number, returns the offset to the
-- given register from the start of the frame. */
-- CORE_ADDR (*find_global_pointer) (CORE_ADDR);
-- };
--
--#define SIGCONTEXT_REGISTER_ADDRESS \
-- (gdbarch_tdep (current_gdbarch)->sigcontext_register_address)
--#define FIND_GLOBAL_POINTER \
-- (gdbarch_tdep (current_gdbarch)->find_global_pointer)
--
- int
- ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
- struct reggroup *group)
-@@ -682,9 +657,18 @@
-
- if ((cfm & 0x7f) > regnum - V32_REGNUM)
- {
-+ ULONGEST bspstore;
- ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
-- reg = read_memory_integer ((CORE_ADDR)reg_addr, 8);
-- store_unsigned_integer (buf, register_size (current_gdbarch, regnum), reg);
-+ regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM,
-+ &bspstore);
-+ if (reg_addr < bspstore) {
-+ reg = read_memory_integer ((CORE_ADDR)reg_addr, 8);
-+ store_unsigned_integer (buf, register_size (current_gdbarch,
-+ regnum), reg);
-+ } else
-+ target_read_partial (&current_target, TARGET_OBJECT_DIRTY,
-+ (void*)bspstore, buf, reg_addr - bspstore,
-+ register_size (current_gdbarch, regnum));
- }
- else
- store_unsigned_integer (buf, register_size (current_gdbarch, regnum), 0);
-@@ -725,7 +709,21 @@
- if (nat_addr >= bsp)
- regcache_cooked_read_unsigned (regcache, IA64_RNAT_REGNUM, &nat_collection);
- else
-- nat_collection = read_memory_integer (nat_addr, 8);
-+ {
-+ ULONGEST bspstore;
-+ regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM,
-+ &bspstore);
-+ if (nat_addr < bspstore)
-+ nat_collection = read_memory_integer (nat_addr, 8);
-+ else {
-+ char natbuf[8];
-+ target_read_partial (&current_target, TARGET_OBJECT_DIRTY,
-+ (void*)bspstore, natbuf,
-+ nat_addr - bspstore,
-+ register_size (current_gdbarch, regnum));
-+ nat_collection = *((uint64_t*)natbuf);
-+ }
-+ }
- nat_bit = (gr_addr >> 3) & 0x3f;
- natN_val = (nat_collection >> nat_bit) & 1;
- }
-@@ -789,8 +787,16 @@
-
- if ((cfm & 0x7f) > regnum - V32_REGNUM)
- {
-+ ULONGEST bspstore;
- ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
-- write_memory (reg_addr, (void *)buf, 8);
-+ regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM,
-+ &bspstore);
-+ if (reg_addr < bspstore)
-+ write_memory (reg_addr, (void *)buf, 8);
-+ else
-+ target_write_partial (&current_target, TARGET_OBJECT_DIRTY,
-+ (void*)bspstore, buf, reg_addr - bspstore,
-+ register_size (current_gdbarch, regnum));
- }
- }
- else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
-@@ -845,13 +851,33 @@
- else
- {
- char nat_buf[8];
-- nat_collection = read_memory_integer (nat_addr, 8);
-+ ULONGEST bspstore;
-+ regcache_cooked_read_unsigned (regcache, IA64_BSPSTORE_REGNUM,
-+ &bspstore);
-+ if (nat_addr < bspstore)
-+ nat_collection = read_memory_integer (nat_addr, 8);
-+ else {
-+ char natbuf[8];
-+ target_read_partial (&current_target, TARGET_OBJECT_DIRTY,
-+ (void*)bspstore, natbuf,
-+ nat_addr - bspstore,
-+ register_size (current_gdbarch, regnum));
-+ nat_collection = *((uint64_t*)natbuf);
-+ }
- if (natN_val)
- nat_collection |= natN_mask;
- else
- nat_collection &= ~natN_mask;
-- store_unsigned_integer (nat_buf, register_size (current_gdbarch, regnum), nat_collection);
-- write_memory (nat_addr, nat_buf, 8);
-+ store_unsigned_integer (nat_buf, register_size (current_gdbarch,
-+ regnum),
-+ nat_collection);
-+ if (nat_addr < bspstore)
-+ write_memory (nat_addr, nat_buf, 8);
-+ else
-+ target_write_partial (&current_target, TARGET_OBJECT_DIRTY,
-+ (void*)bspstore, nat_buf,
-+ nat_addr - bspstore,
-+ register_size (current_gdbarch, regnum));
- }
- }
- }
-@@ -1813,6 +1839,7 @@
- prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f));
-
- addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM));
-+ /* XXX marcel */
- *lvalp = lval_memory;
- *addrp = addr;
- read_memory (addr, valuep, register_size (current_gdbarch, regnum));
-@@ -2858,8 +2885,8 @@
- DT_PLTGOT tag. If it finds one of these, the corresponding
- d_un.d_ptr value is the global pointer. */
-
--static CORE_ADDR
--generic_elf_find_global_pointer (CORE_ADDR faddr)
-+CORE_ADDR
-+ia64_generic_find_global_pointer (CORE_ADDR faddr)
- {
- struct obj_section *faddr_sect;
-
-@@ -3255,32 +3282,9 @@
-
- tdep = xmalloc (sizeof (struct gdbarch_tdep));
- gdbarch = gdbarch_alloc (&info, tdep);
--
-- /* Set the method of obtaining the sigcontext addresses at which
-- registers are saved. The method of checking to see if
-- native_find_global_pointer is nonzero to indicate that we're
-- on AIX is kind of hokey, but I can't think of a better way
-- to do it. */
-- if (info.osabi == GDB_OSABI_LINUX)
-- tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address;
-- else if (native_find_global_pointer != 0)
-- tdep->sigcontext_register_address = ia64_aix_sigcontext_register_address;
-- else
-- tdep->sigcontext_register_address = 0;
--
-- /* We know that GNU/Linux won't have to resort to the
-- native_find_global_pointer hackery. But that's the only one we
-- know about so far, so if native_find_global_pointer is set to
-- something non-zero, then use it. Otherwise fall back to using
-- generic_elf_find_global_pointer. This arrangement should (in
-- theory) allow us to cross debug GNU/Linux binaries from an AIX
-- machine. */
-- if (info.osabi == GDB_OSABI_LINUX)
-- tdep->find_global_pointer = generic_elf_find_global_pointer;
-- else if (native_find_global_pointer != 0)
-- tdep->find_global_pointer = native_find_global_pointer;
-- else
-- tdep->find_global_pointer = generic_elf_find_global_pointer;
-+ tdep->osabi = info.osabi;
-+ tdep->sigcontext_register_address = NULL;
-+ tdep->find_global_pointer = ia64_generic_find_global_pointer;
-
- /* Define the ia64 floating-point format to gdb. */
- builtin_type_ia64_ext =
-@@ -3338,10 +3342,7 @@
- set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint);
- set_gdbarch_breakpoint_from_pc (gdbarch, ia64_breakpoint_from_pc);
- set_gdbarch_read_pc (gdbarch, ia64_read_pc);
-- if (info.osabi == GDB_OSABI_LINUX)
-- set_gdbarch_write_pc (gdbarch, ia64_linux_write_pc);
-- else
-- set_gdbarch_write_pc (gdbarch, ia64_write_pc);
-+ set_gdbarch_write_pc (gdbarch, ia64_write_pc);
-
- /* Settings for calling functions in the inferior. */
- set_gdbarch_push_dummy_call (gdbarch, ia64_push_dummy_call);
-@@ -3365,6 +3366,8 @@
-
- set_gdbarch_print_insn (gdbarch, ia64_print_insn);
- set_gdbarch_convert_from_func_ptr_addr (gdbarch, ia64_convert_from_func_ptr_addr);
-+
-+ gdbarch_init_osabi (info, gdbarch);
-
- return gdbarch;
- }
-Index: gdb/ia64-tdep.h
-===================================================================
-RCS file: /home/marcel/CVS/gdb6/gdb/ia64-tdep.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
---- gdb/ia64-tdep.h 26 Mar 2004 02:54:41 -0000 1.1.1.1
-+++ gdb/ia64-tdep.h 28 Mar 2004 03:47:34 -0000 1.2
-@@ -22,10 +22,25 @@
- #ifndef IA64_TDEP_H
- #define IA64_TDEP_H
-
--extern CORE_ADDR ia64_linux_sigcontext_register_address (CORE_ADDR, int);
--extern CORE_ADDR ia64_aix_sigcontext_register_address (CORE_ADDR, int);
--extern unsigned long ia64_linux_getunwind_table (void *, size_t);
--extern void ia64_write_pc (CORE_ADDR, ptid_t);
--extern void ia64_linux_write_pc (CORE_ADDR, ptid_t);
-+#include "osabi.h"
-+
-+/* Target-dependent structure in gdbarch. */
-+struct gdbarch_tdep
-+{
-+ enum gdb_osabi osabi; /* OS/ABI of inferior. */
-+
-+ CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int);
-+ /* OS specific function which, given a frame address
-+ and register number, returns the offset to the
-+ given register from the start of the frame. */
-+ CORE_ADDR (*find_global_pointer) (CORE_ADDR);
-+};
-+
-+#define SIGCONTEXT_REGISTER_ADDRESS \
-+ (gdbarch_tdep (current_gdbarch)->sigcontext_register_address)
-+#define FIND_GLOBAL_POINTER \
-+ (gdbarch_tdep (current_gdbarch)->find_global_pointer)
-+
-+extern CORE_ADDR ia64_generic_find_global_pointer (CORE_ADDR);
-
- #endif /* IA64_TDEP_H */
-Index: gdb/inftarg.c
-===================================================================
-RCS file: /home/marcel/CVS/gdb6/gdb/inftarg.c,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
---- gdb/inftarg.c 26 Mar 2004 02:54:41 -0000 1.1.1.1
-+++ gdb/inftarg.c 28 Mar 2004 03:47:34 -0000 1.2
-@@ -592,6 +592,13 @@
- return NATIVE_XFER_WCOOKIE (ops, object, annex, readbuf, writebuf,
- offset, len);
-
-+ case TARGET_OBJECT_DIRTY:
-+#ifndef TARGET_XFER_DIRTY
-+#define TARGET_XFER_DIRTY(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1)
-+#endif
-+ return TARGET_XFER_DIRTY (ops, object, annex, readbuf, writebuf,
-+ offset, len);
-+
- default:
- return -1;
- }
-Index: gdb/remote.c
-===================================================================
-RCS file: /home/marcel/CVS/gdb6/gdb/remote.c,v
-retrieving revision 1.1.1.3
-retrieving revision 1.5
-diff -u -r1.1.1.3 -r1.5
---- gdb/remote.c 16 Apr 2004 00:51:28 -0000 1.1.1.3
-+++ gdb/remote.c 16 Apr 2004 01:28:33 -0000 1.5
-@@ -998,6 +998,23 @@
- show_packet_config_cmd (&remote_protocol_qPart_auxv);
- }
-
-+/* Should we try the 'qPart:dirty' (target dirty register read) request? */
-+static struct packet_config remote_protocol_qPart_dirty;
-+
-+static void
-+set_remote_protocol_qPart_dirty_packet_cmd (char *args, int from_tty,
-+ struct cmd_list_element *c)
-+{
-+ update_packet_config (&remote_protocol_qPart_dirty);
-+}
-+
-+static void
-+show_remote_protocol_qPart_dirty_packet_cmd (char *args, int from_tty,
-+ struct cmd_list_element *c)
-+{
-+ show_packet_config_cmd (&remote_protocol_qPart_dirty);
-+}
-+
-
- /* Tokens for use by the asynchronous signal handlers for SIGINT */
- static void *sigint_remote_twice_token;
-@@ -2088,6 +2105,7 @@
- downloading. */
- update_packet_config (&remote_protocol_binary_download);
- update_packet_config (&remote_protocol_qPart_auxv);
-+ update_packet_config (&remote_protocol_qPart_dirty);
- }
-
- /* Symbol look-up. */
-@@ -4925,6 +4943,23 @@
- }
- return -1;
-
-+ case TARGET_OBJECT_DIRTY:
-+ if (remote_protocol_qPart_dirty.support != PACKET_DISABLE)
-+ {
-+ snprintf (buf2, rs->remote_packet_size, "qPart:dirty:read::%lx",
-+ (long)(offset >> 3));
-+ i = putpkt (buf2);
-+ if (i < 0)
-+ return i;
-+ buf2[0] = '\0';
-+ getpkt (buf2, rs->remote_packet_size, 0);
-+ if (packet_ok (buf2, &remote_protocol_qPart_dirty) != PACKET_OK)
-+ return -1;
-+ i = hex2bin (buf2, readbuf, len);
-+ return i;
-+ }
-+ return -1;
-+
- default:
- return -1;
- }
-@@ -5423,6 +5458,7 @@
- show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL);
- show_remote_protocol_binary_download_cmd (args, from_tty, NULL);
- show_remote_protocol_qPart_auxv_packet_cmd (args, from_tty, NULL);
-+ show_remote_protocol_qPart_dirty_packet_cmd (args, from_tty, NULL);
- }
-
- static void
-@@ -5670,6 +5706,13 @@
- "qPart_auxv", "read-aux-vector",
- set_remote_protocol_qPart_auxv_packet_cmd,
- show_remote_protocol_qPart_auxv_packet_cmd,
-+ &remote_set_cmdlist, &remote_show_cmdlist,
-+ 0);
-+
-+ add_packet_config_cmd (&remote_protocol_qPart_dirty,
-+ "qPart_dirty", "read-dirty-registers",
-+ set_remote_protocol_qPart_dirty_packet_cmd,
-+ show_remote_protocol_qPart_dirty_packet_cmd,
- &remote_set_cmdlist, &remote_show_cmdlist,
- 0);
-
-Index: gdb/target.h
-===================================================================
-RCS file: /home/marcel/CVS/gdb6/gdb/target.h,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
---- gdb/target.h 26 Mar 2004 02:54:42 -0000 1.1.1.1
-+++ gdb/target.h 28 Mar 2004 03:47:34 -0000 1.2
-@@ -229,7 +229,9 @@
- /* Transfer auxilliary vector. */
- TARGET_OBJECT_AUXV,
- /* StackGhost cookie. See "sparc-tdep.c". */
-- TARGET_OBJECT_WCOOKIE
-+ TARGET_OBJECT_WCOOKIE,
-+ /* Dirty registers. See "ia64-tdep.c". */
-+ TARGET_OBJECT_DIRTY
-
- /* Possible future objects: TARGET_OBJECT_FILE, TARGET_OBJECT_PROC, ... */
- };
-Index: gdb/config/ia64/fbsd.mh
-===================================================================
-RCS file: gdb/config/ia64/fbsd.mh
-diff -N gdb/config/ia64/fbsd.mh
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ gdb/config/ia64/fbsd.mh 25 Jun 2004 03:55:31 -0000
-@@ -0,0 +1,3 @@
-+NATDEPFILES= fbsd-proc.o fbsd-thread.o fork-child.o gcore.o \
-+ ia64-fbsd-nat.o infptrace.o inftarg.o
-+NAT_FILE= nm-fbsd.h
-Index: gdb/config/ia64/fbsd.mt
-===================================================================
-RCS file: gdb/config/ia64/fbsd.mt
-diff -N gdb/config/ia64/fbsd.mt
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ gdb/config/ia64/fbsd.mt 28 Mar 2004 03:47:38 -0000 1.1
-@@ -0,0 +1,2 @@
-+TDEPFILES= corelow.o ia64-fbsd-tdep.o ia64-tdep.o solib.o solib-svr4.o
-+TM_FILE= tm-fbsd.h
-Index: gdb/config/ia64/nm-fbsd.h
-===================================================================
-RCS file: gdb/config/ia64/nm-fbsd.h
-diff -N gdb/config/ia64/nm-fbsd.h
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ gdb/config/ia64/nm-fbsd.h 16 Apr 2004 02:49:16 -0000 1.2
-@@ -0,0 +1,24 @@
-+/* GNU GPL */
-+
-+#ifndef NM_FBSD_H
-+#define NM_FBSD_H
-+
-+/* Type of the third argument to the `ptrace' system call. */
-+#define PTRACE_ARG3_TYPE caddr_t
-+
-+/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
-+#define FETCH_INFERIOR_REGISTERS
-+
-+/* We can attach and detach. */
-+#define ATTACH_DETACH
-+
-+/* Override child_pid_to_exec_file in 'inftarg.c'. */
-+#define CHILD_PID_TO_EXEC_FILE
-+
-+#include "target.h"
-+
-+#define TARGET_XFER_DIRTY ia64_fbsd_xfer_dirty
-+extern LONGEST ia64_fbsd_xfer_dirty(struct target_ops *, enum target_object,
-+ const char *, void *, const void *, ULONGEST, LONGEST);
-+
-+#endif /* NM_FBSD_H */
-Index: gdb/config/ia64/tm-fbsd.h
-===================================================================
-RCS file: gdb/config/ia64/tm-fbsd.h
-diff -N gdb/config/ia64/tm-fbsd.h
---- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ gdb/config/ia64/tm-fbsd.h 17 Apr 2004 01:43:21 -0000 1.2
-@@ -0,0 +1,34 @@
-+/*
-+ * Copyright (c) 2004 Marcel Moolenaar
-+ * All rights reserved.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ *
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * 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 TM_FBSD_H
-+#define TM_FBSD_H
-+
-+#include "solib.h"
-+
-+#include "ia64/tm-ia64.h"
-+
-+#endif /* TM_FBSD_H */
diff --git a/etc/rc.d/encswap b/etc/rc.d/encswap
deleted file mode 100644
index 82ac8da..0000000
--- a/etc/rc.d/encswap
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-# PROVIDE: disks
-# REQUIRE: initrandom
-# KEYWORD: nojail
-
-. /etc/rc.subr
-
-name="gbde_swap"
-start_cmd="gbde_swap_attach"
-stop_cmd="gbde_swap_detach"
-
-gbde_swap_attach()
-{
- while read device mountpoint type options rest ; do
- case ":${device}:${type}:${options}" in
- :#*)
- continue
- ;;
- *.bde:swap:sw)
- ;;
- *)
- continue
- ;;
- esac
- passphrase=`dd if=/dev/random count=1 2>/dev/null | md5 -q`
- device="${device%.bde}"
- gbde init "${device}" -P "${passphrase}" || return 1
- gbde attach "${device}" -p "${passphrase}" || return 1
- done < /etc/fstab
-}
-
-gbde_swap_detach()
-{
- while read device mountpoint type options rest ; do
- case ":${device}:${type}:${options}" in
- :#*)
- continue
- ;;
- *.bde:swap:sw)
- ;;
- *)
- continue
- ;;
- esac
- device="${device%.bde}"
- gbde detach "${device}"
- done < /etc/fstab
-}
-
-load_rc_config $name
-run_rc_command "$1"
diff --git a/etc/rc.d/lockd b/etc/rc.d/lockd
deleted file mode 100644
index f8a77e8..0000000
--- a/etc/rc.d/lockd
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-#
-# $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $
-# $FreeBSD$
-#
-
-# PROVIDE: nfslocking
-# REQUIRE: nfsserver nfsclient nfsd
-# BEFORE: DAEMON
-# KEYWORD: nojail
-
-. /etc/rc.subr
-
-# Save the (one) commandline argument in case it gets clobbered.
-arg=$1
-
-# Either NFS client or server must be enabled or this must be a 'forcestart'
-# for either of the daemons to start.
-#
-start_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable ||
- [ -n "$rc_force" ]'
-stop_precmd=$start_precmd
-status_precmd=$start_precmd
-
-# rpc.statd
-#
-name="statd"
-rcvar=rpc_statd_enable
-command="/usr/sbin/rpc.${name}"
-load_rc_config $name
-run_rc_command "$arg"
-
-# rpc.lockd
-#
-name="lockd"
-rcvar=rpc_lockd_enable
-command="/usr/sbin/rpc.${name}"
-load_rc_config $name
-run_rc_command "$arg"
diff --git a/etc/rc.d/ppp b/etc/rc.d/ppp
deleted file mode 100644
index f13175c..0000000
--- a/etc/rc.d/ppp
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-# PROVIDE: ppp-user
-# REQUIRE: netif isdnd
-# KEYWORD: nojail
-
-. /etc/rc.subr
-
-name="ppp"
-rcvar=`set_rcvar`
-start_precmd="ppp_precmd"
-start_postcmd="ppp_postcmd"
-
-ppp_precmd()
-{
- # Establish ppp mode.
- #
- if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \
- -a "${ppp_mode}" != "dedicated" \
- -a "${ppp_mode}" != "background" ]; then
- ppp_mode="auto"
- fi
-
- rc_flags="$rc_flags -quiet -${ppp_mode}"
-
- # Switch on NAT mode?
- #
- case ${ppp_nat} in
- [Yy][Ee][Ss])
- rc_flags="$rc_flags -nat"
- ;;
- esac
-
- rc_flags="$rc_flags ${ppp_profile}"
-}
-
-ppp_postcmd()
-{
- # Re-Sync ipfilter so it picks up any new network interfaces
- #
- /etc/rc.d/ipfilter resync
-}
-
-load_rc_config $name
-run_rc_command "$1"
diff --git a/etc/rc.d/statd b/etc/rc.d/statd
deleted file mode 100644
index f8a77e8..0000000
--- a/etc/rc.d/statd
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-#
-# $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $
-# $FreeBSD$
-#
-
-# PROVIDE: nfslocking
-# REQUIRE: nfsserver nfsclient nfsd
-# BEFORE: DAEMON
-# KEYWORD: nojail
-
-. /etc/rc.subr
-
-# Save the (one) commandline argument in case it gets clobbered.
-arg=$1
-
-# Either NFS client or server must be enabled or this must be a 'forcestart'
-# for either of the daemons to start.
-#
-start_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable ||
- [ -n "$rc_force" ]'
-stop_precmd=$start_precmd
-status_precmd=$start_precmd
-
-# rpc.statd
-#
-name="statd"
-rcvar=rpc_statd_enable
-command="/usr/sbin/rpc.${name}"
-load_rc_config $name
-run_rc_command "$arg"
-
-# rpc.lockd
-#
-name="lockd"
-rcvar=rpc_lockd_enable
-command="/usr/sbin/rpc.${name}"
-load_rc_config $name
-run_rc_command "$arg"
diff --git a/lib/libarchive/archive_read_open_filename.c b/lib/libarchive/archive_read_open_filename.c
deleted file mode 100644
index ea8ebbd..0000000
--- a/lib/libarchive/archive_read_open_filename.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*-
- * Copyright (c) 2003-2004 Tim Kientzle
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED 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(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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 "archive_platform.h"
-__FBSDID("$FreeBSD$");
-
-#include <sys/stat.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "archive.h"
-#include "archive_private.h"
-
-struct read_file_data {
- int fd;
- size_t block_size;
- void *buffer;
- mode_t st_mode; /* Mode bits for opened file. */
- char filename[1]; /* Must be last! */
-};
-
-static int file_close(struct archive *, void *);
-static int file_open(struct archive *, void *);
-static ssize_t file_read(struct archive *, void *, const void **buff);
-
-int
-archive_read_open_file(struct archive *a, const char *filename,
- size_t block_size)
-{
- struct read_file_data *mine;
-
- if (filename == NULL || filename[0] == '\0') {
- mine = malloc(sizeof(*mine));
- if (mine == NULL) {
- archive_set_error(a, ENOMEM, "No memory");
- return (ARCHIVE_FATAL);
- }
- mine->filename[0] = '\0';
- } else {
- mine = malloc(sizeof(*mine) + strlen(filename));
- if (mine == NULL) {
- archive_set_error(a, ENOMEM, "No memory");
- return (ARCHIVE_FATAL);
- }
- strcpy(mine->filename, filename);
- }
- mine->block_size = block_size;
- mine->buffer = NULL;
- mine->fd = -1;
- return (archive_read_open(a, mine, file_open, file_read, file_close));
-}
-
-static int
-file_open(struct archive *a, void *client_data)
-{
- struct read_file_data *mine = client_data;
- struct stat st;
-
- mine->buffer = malloc(mine->block_size);
- if (mine->filename[0] != '\0')
- mine->fd = open(mine->filename, O_RDONLY);
- else
- mine->fd = 0; /* Fake "open" for stdin. */
- if (mine->fd < 0) {
- archive_set_error(a, errno, "Failed to open '%s'",
- mine->filename);
- return (ARCHIVE_FATAL);
- }
- if (fstat(mine->fd, &st) == 0) {
- /* Set dev/ino of archive file so extract won't overwrite. */
- a->skip_file_dev = st.st_dev;
- a->skip_file_ino = st.st_ino;
- /* Remember mode so close can decide whether to flush. */
- mine->st_mode = st.st_mode;
- } else {
- if (mine->filename[0] == '\0')
- archive_set_error(a, errno, "Can't stat stdin");
- else
- archive_set_error(a, errno, "Can't stat '%s'",
- mine->filename);
- return (ARCHIVE_FATAL);
- }
- return (0);
-}
-
-static ssize_t
-file_read(struct archive *a, void *client_data, const void **buff)
-{
- struct read_file_data *mine = client_data;
- ssize_t bytes_read;
-
- (void)a; /* UNUSED */
- *buff = mine->buffer;
- bytes_read = read(mine->fd, mine->buffer, mine->block_size);
- if (bytes_read < 0) {
- if (mine->filename[0] == '\0')
- archive_set_error(a, errno, "Error reading stdin");
- else
- archive_set_error(a, errno, "Error reading '%s'",
- mine->filename);
- }
- return (bytes_read);
-}
-
-static int
-file_close(struct archive *a, void *client_data)
-{
- struct read_file_data *mine = client_data;
-
- (void)a; /* UNUSED */
-
- /*
- * Sometimes, we should flush the input before closing.
- * Regular files: faster to just close without flush.
- * Devices: must not flush (user might need to
- * read the "next" item on a non-rewind device).
- * Pipes and sockets: must flush (otherwise, the
- * program feeding the pipe or socket may complain).
- * Here, I flush everything except for regular files and
- * device nodes.
- */
- if (!S_ISREG(mine->st_mode)
- && !S_ISCHR(mine->st_mode)
- && !S_ISBLK(mine->st_mode)) {
- ssize_t bytesRead;
- do {
- bytesRead = read(mine->fd, mine->buffer,
- mine->block_size);
- } while (bytesRead > 0);
- }
- /* If a named file was opened, then it needs to be closed. */
- if (mine->filename[0] != '\0')
- close(mine->fd);
- if (mine->buffer != NULL)
- free(mine->buffer);
- free(mine);
- return (ARCHIVE_OK);
-}
diff --git a/lib/libarchive/archive_write_open_filename.c b/lib/libarchive/archive_write_open_filename.c
deleted file mode 100644
index 65cdbb6..0000000
--- a/lib/libarchive/archive_write_open_filename.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*-
- * Copyright (c) 2003-2004 Tim Kientzle
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED 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(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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 "archive_platform.h"
-__FBSDID("$FreeBSD$");
-
-#include <sys/stat.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "archive.h"
-#include "archive_private.h"
-
-struct write_file_data {
- int fd;
- char filename[1];
-};
-
-static int file_close(struct archive *, void *);
-static int file_open(struct archive *, void *);
-static ssize_t file_write(struct archive *, void *, void *buff, size_t);
-
-int
-archive_write_open_file(struct archive *a, const char *filename)
-{
- struct write_file_data *mine;
-
- if (filename == NULL || filename[0] == '\0') {
- mine = malloc(sizeof(*mine));
- if (mine == NULL) {
- archive_set_error(a, ENOMEM, "No memory");
- return (ARCHIVE_FATAL);
- }
- mine->filename[0] = '\0'; /* Record that we're using stdout. */
- } else {
- mine = malloc(sizeof(*mine) + strlen(filename));
- if (mine == NULL) {
- archive_set_error(a, ENOMEM, "No memory");
- return (ARCHIVE_FATAL);
- }
- strcpy(mine->filename, filename);
- }
- mine->fd = -1;
- return (archive_write_open(a, mine,
- file_open, file_write, file_close));
-}
-
-static int
-file_open(struct archive *a, void *client_data)
-{
- int flags;
- struct write_file_data *mine;
- struct stat st, *pst;
-
- pst = NULL;
- mine = client_data;
- flags = O_WRONLY | O_CREAT | O_TRUNC;
-
- if (mine->filename[0] != '\0') {
- mine->fd = open(mine->filename, flags, 0666);
-
- /*
- * If client hasn't explicitly set the last block
- * handling, then set it here: If the output is a
- * block or character device, pad the last block,
- * otherwise leave it unpadded.
- */
- if (mine->fd >= 0 && a->bytes_in_last_block < 0) {
- if (fstat(mine->fd, &st) == 0) {
- pst = &st;
- if (S_ISCHR(st.st_mode) ||
- S_ISBLK(st.st_mode) ||
- S_ISFIFO(st.st_mode))
- /* Pad last block. */
- archive_write_set_bytes_in_last_block(a, 0);
- else
- /* Don't pad last block. */
- archive_write_set_bytes_in_last_block(a, 1);
- }
- }
- } else {
- mine->fd = 1;
- if (a->bytes_in_last_block < 0) /* Still default? */
- /* Last block will be fully padded. */
- archive_write_set_bytes_in_last_block(a, 0);
- }
-
- if (mine->fd < 0) {
- archive_set_error(a, errno, "Failed to open '%s'",
- mine->filename);
- return (ARCHIVE_FATAL);
- }
-
- if (pst == NULL && fstat(mine->fd, &st) == 0)
- pst = &st;
- if (pst == NULL) {
- archive_set_error(a, errno, "Couldn't stat '%s'",
- mine->filename);
- return (ARCHIVE_FATAL);
- }
-
- /*
- * If the output file is a regular file, don't add it to
- * itself. If it's a device file, it's okay to add the device
- * entry to the output archive.
- */
- if (S_ISREG(pst->st_mode)) {
- a->skip_file_dev = pst->st_dev;
- a->skip_file_ino = pst->st_ino;
- }
-
- return (ARCHIVE_OK);
-}
-
-static ssize_t
-file_write(struct archive *a, void *client_data, void *buff, size_t length)
-{
- struct write_file_data *mine;
- ssize_t bytesWritten;
-
- mine = client_data;
- bytesWritten = write(mine->fd, buff, length);
- if (bytesWritten <= 0) {
- archive_set_error(a, errno, "Write error");
- return (-1);
- }
- return (bytesWritten);
-}
-
-static int
-file_close(struct archive *a, void *client_data)
-{
- struct write_file_data *mine = client_data;
-
- (void)a; /* UNUSED */
- if (mine->filename[0] != '\0')
- close(mine->fd);
- free(mine);
- return (ARCHIVE_OK);
-}
diff --git a/lib/libc/gen/fts-compat.c b/lib/libc/gen/fts-compat.c
deleted file mode 100644
index 48f9e0b..0000000
--- a/lib/libc/gen/fts-compat.c
+++ /dev/null
@@ -1,1226 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 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.
- *
- * $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
- */
-
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
-#endif /* LIBC_SCCS and not lint */
-#endif
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <fts.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-static FTSENT *fts_alloc(FTS *, char *, int);
-static FTSENT *fts_build(FTS *, int);
-static void fts_lfree(FTSENT *);
-static void fts_load(FTS *, FTSENT *);
-static size_t fts_maxarglen(char * const *);
-static void fts_padjust(FTS *, FTSENT *);
-static int fts_palloc(FTS *, size_t);
-static FTSENT *fts_sort(FTS *, FTSENT *, int);
-static u_short fts_stat(FTS *, FTSENT *, int);
-static int fts_safe_changedir(FTS *, FTSENT *, int, char *);
-static int fts_ufslinks(FTS *, const FTSENT *);
-
-#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
-
-#define CLR(opt) (sp->fts_options &= ~(opt))
-#define ISSET(opt) (sp->fts_options & (opt))
-#define SET(opt) (sp->fts_options |= (opt))
-
-#define FCHDIR(sp, fd) (!ISSET(FTS_NOCHDIR) && fchdir(fd))
-
-/* fts_build flags */
-#define BCHILD 1 /* fts_children */
-#define BNAMES 2 /* fts_children, names only */
-#define BREAD 3 /* fts_read */
-
-/*
- * Internal representation of an FTS, including extra implementation
- * details. The FTS returned from fts_open points to this structure's
- * ftsp_fts member (and can be cast to an _fts_private as required)
- */
-struct _fts_private {
- FTS ftsp_fts;
- struct statfs ftsp_statfs;
- dev_t ftsp_dev;
- int ftsp_linksreliable;
-};
-
-/*
- * The "FTS_NOSTAT" option can avoid a lot of calls to stat(2) if it
- * knows that a directory could not possibly have subdirectories. This
- * is decided by looking at the link count: a subdirectory would
- * increment its parent's link count by virtue of its own ".." entry.
- * This assumption only holds for UFS-like filesystems that implement
- * links and directories this way, so we must punt for others.
- */
-
-static const char *ufslike_filesystems[] = {
- "ufs",
- "nfs",
- "nfs4",
- "ext2fs",
- 0
-};
-
-FTS *
-fts_open(argv, options, compar)
- char * const *argv;
- int options;
- int (*compar)(const FTSENT * const *, const FTSENT * const *);
-{
- struct _fts_private *priv;
- FTS *sp;
- FTSENT *p, *root;
- int nitems;
- FTSENT *parent, *tmp;
- int len;
-
- /* Options check. */
- if (options & ~FTS_OPTIONMASK) {
- errno = EINVAL;
- return (NULL);
- }
-
- /* Allocate/initialize the stream. */
- if ((priv = malloc(sizeof(*priv))) == NULL)
- return (NULL);
- memset(priv, 0, sizeof(*priv));
- sp = &priv->ftsp_fts;
- sp->fts_compar = compar;
- sp->fts_options = options;
-
- /* Shush, GCC. */
- tmp = NULL;
-
- /* Logical walks turn on NOCHDIR; symbolic links are too hard. */
- if (ISSET(FTS_LOGICAL))
- SET(FTS_NOCHDIR);
-
- /*
- * Start out with 1K of path space, and enough, in any case,
- * to hold the user's paths.
- */
- if (fts_palloc(sp, MAX(fts_maxarglen(argv), MAXPATHLEN)))
- goto mem1;
-
- /* Allocate/initialize root's parent. */
- if ((parent = fts_alloc(sp, "", 0)) == NULL)
- goto mem2;
- parent->fts_level = FTS_ROOTPARENTLEVEL;
-
- /* Allocate/initialize root(s). */
- for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) {
- /* Don't allow zero-length paths. */
- if ((len = strlen(*argv)) == 0) {
- errno = ENOENT;
- goto mem3;
- }
-
- p = fts_alloc(sp, *argv, len);
- p->fts_level = FTS_ROOTLEVEL;
- p->fts_parent = parent;
- p->fts_accpath = p->fts_name;
- p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW));
-
- /* Command-line "." and ".." are real directories. */
- if (p->fts_info == FTS_DOT)
- p->fts_info = FTS_D;
-
- /*
- * If comparison routine supplied, traverse in sorted
- * order; otherwise traverse in the order specified.
- */
- if (compar) {
- p->fts_link = root;
- root = p;
- } else {
- p->fts_link = NULL;
- if (root == NULL)
- tmp = root = p;
- else {
- tmp->fts_link = p;
- tmp = p;
- }
- }
- }
- if (compar && nitems > 1)
- root = fts_sort(sp, root, nitems);
-
- /*
- * Allocate a dummy pointer and make fts_read think that we've just
- * finished the node before the root(s); set p->fts_info to FTS_INIT
- * so that everything about the "current" node is ignored.
- */
- if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
- goto mem3;
- sp->fts_cur->fts_link = root;
- sp->fts_cur->fts_info = FTS_INIT;
-
- /*
- * If using chdir(2), grab a file descriptor pointing to dot to ensure
- * that we can get back here; this could be avoided for some paths,
- * but almost certainly not worth the effort. Slashes, symbolic links,
- * and ".." are all fairly nasty problems. Note, if we can't get the
- * descriptor we run anyway, just more slowly.
- */
- if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = _open(".", O_RDONLY, 0)) < 0)
- SET(FTS_NOCHDIR);
-
- return (sp);
-
-mem3: fts_lfree(root);
- free(parent);
-mem2: free(sp->fts_path);
-mem1: free(sp);
- return (NULL);
-}
-
-static void
-fts_load(sp, p)
- FTS *sp;
- FTSENT *p;
-{
- int len;
- char *cp;
-
- /*
- * Load the stream structure for the next traversal. Since we don't
- * actually enter the directory until after the preorder visit, set
- * the fts_accpath field specially so the chdir gets done to the right
- * place and the user can access the first node. From fts_open it's
- * known that the path will fit.
- */
- len = p->fts_pathlen = p->fts_namelen;
- memmove(sp->fts_path, p->fts_name, len + 1);
- if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) {
- len = strlen(++cp);
- memmove(p->fts_name, cp, len + 1);
- p->fts_namelen = len;
- }
- p->fts_accpath = p->fts_path = sp->fts_path;
- sp->fts_dev = p->fts_dev;
-}
-
-int
-fts_close(sp)
- FTS *sp;
-{
- FTSENT *freep, *p;
- int saved_errno;
-
- /*
- * This still works if we haven't read anything -- the dummy structure
- * points to the root list, so we step through to the end of the root
- * list which has a valid parent pointer.
- */
- if (sp->fts_cur) {
- for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
- freep = p;
- p = p->fts_link != NULL ? p->fts_link : p->fts_parent;
- free(freep);
- }
- free(p);
- }
-
- /* Free up child linked list, sort array, path buffer. */
- if (sp->fts_child)
- fts_lfree(sp->fts_child);
- if (sp->fts_array)
- free(sp->fts_array);
- free(sp->fts_path);
-
- /* Return to original directory, save errno if necessary. */
- if (!ISSET(FTS_NOCHDIR)) {
- saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
- (void)_close(sp->fts_rfd);
-
- /* Set errno and return. */
- if (saved_errno != 0) {
- /* Free up the stream pointer. */
- free(sp);
- errno = saved_errno;
- return (-1);
- }
- }
-
- /* Free up the stream pointer. */
- free(sp);
- return (0);
-}
-
-/*
- * Special case of "/" at the end of the path so that slashes aren't
- * appended which would cause paths to be written as "....//foo".
- */
-#define NAPPEND(p) \
- (p->fts_path[p->fts_pathlen - 1] == '/' \
- ? p->fts_pathlen - 1 : p->fts_pathlen)
-
-FTSENT *
-fts_read(sp)
- FTS *sp;
-{
- FTSENT *p, *tmp;
- int instr;
- char *t;
- int saved_errno;
-
- /* If finished or unrecoverable error, return NULL. */
- if (sp->fts_cur == NULL || ISSET(FTS_STOP))
- return (NULL);
-
- /* Set current node pointer. */
- p = sp->fts_cur;
-
- /* Save and zero out user instructions. */
- instr = p->fts_instr;
- p->fts_instr = FTS_NOINSTR;
-
- /* Any type of file may be re-visited; re-stat and re-turn. */
- if (instr == FTS_AGAIN) {
- p->fts_info = fts_stat(sp, p, 0);
- return (p);
- }
-
- /*
- * Following a symlink -- SLNONE test allows application to see
- * SLNONE and recover. If indirecting through a symlink, have
- * keep a pointer to current location. If unable to get that
- * pointer, follow fails.
- */
- if (instr == FTS_FOLLOW &&
- (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
- p->fts_info = fts_stat(sp, p, 1);
- if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
- if ((p->fts_symfd = _open(".", O_RDONLY, 0)) < 0) {
- p->fts_errno = errno;
- p->fts_info = FTS_ERR;
- } else
- p->fts_flags |= FTS_SYMFOLLOW;
- }
- return (p);
- }
-
- /* Directory in pre-order. */
- if (p->fts_info == FTS_D) {
- /* If skipped or crossed mount point, do post-order visit. */
- if (instr == FTS_SKIP ||
- (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
- if (p->fts_flags & FTS_SYMFOLLOW)
- (void)_close(p->fts_symfd);
- if (sp->fts_child) {
- fts_lfree(sp->fts_child);
- sp->fts_child = NULL;
- }
- p->fts_info = FTS_DP;
- return (p);
- }
-
- /* Rebuild if only read the names and now traversing. */
- if (sp->fts_child != NULL && ISSET(FTS_NAMEONLY)) {
- CLR(FTS_NAMEONLY);
- fts_lfree(sp->fts_child);
- sp->fts_child = NULL;
- }
-
- /*
- * Cd to the subdirectory.
- *
- * If have already read and now fail to chdir, whack the list
- * to make the names come out right, and set the parent errno
- * so the application will eventually get an error condition.
- * Set the FTS_DONTCHDIR flag so that when we logically change
- * directories back to the parent we don't do a chdir.
- *
- * If haven't read do so. If the read fails, fts_build sets
- * FTS_STOP or the fts_info field of the node.
- */
- if (sp->fts_child != NULL) {
- if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) {
- p->fts_errno = errno;
- p->fts_flags |= FTS_DONTCHDIR;
- for (p = sp->fts_child; p != NULL;
- p = p->fts_link)
- p->fts_accpath =
- p->fts_parent->fts_accpath;
- }
- } else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
- if (ISSET(FTS_STOP))
- return (NULL);
- return (p);
- }
- p = sp->fts_child;
- sp->fts_child = NULL;
- goto name;
- }
-
- /* Move to the next node on this level. */
-next: tmp = p;
- if ((p = p->fts_link) != NULL) {
- free(tmp);
-
- /*
- * If reached the top, return to the original directory (or
- * the root of the tree), and load the paths for the next root.
- */
- if (p->fts_level == FTS_ROOTLEVEL) {
- if (FCHDIR(sp, sp->fts_rfd)) {
- SET(FTS_STOP);
- return (NULL);
- }
- fts_load(sp, p);
- return (sp->fts_cur = p);
- }
-
- /*
- * User may have called fts_set on the node. If skipped,
- * ignore. If followed, get a file descriptor so we can
- * get back if necessary.
- */
- if (p->fts_instr == FTS_SKIP)
- goto next;
- if (p->fts_instr == FTS_FOLLOW) {
- p->fts_info = fts_stat(sp, p, 1);
- if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
- if ((p->fts_symfd =
- _open(".", O_RDONLY, 0)) < 0) {
- p->fts_errno = errno;
- p->fts_info = FTS_ERR;
- } else
- p->fts_flags |= FTS_SYMFOLLOW;
- }
- p->fts_instr = FTS_NOINSTR;
- }
-
-name: t = sp->fts_path + NAPPEND(p->fts_parent);
- *t++ = '/';
- memmove(t, p->fts_name, p->fts_namelen + 1);
- return (sp->fts_cur = p);
- }
-
- /* Move up to the parent node. */
- p = tmp->fts_parent;
- free(tmp);
-
- if (p->fts_level == FTS_ROOTPARENTLEVEL) {
- /*
- * Done; free everything up and set errno to 0 so the user
- * can distinguish between error and EOF.
- */
- free(p);
- errno = 0;
- return (sp->fts_cur = NULL);
- }
-
- /* NUL terminate the pathname. */
- sp->fts_path[p->fts_pathlen] = '\0';
-
- /*
- * Return to the parent directory. If at a root node or came through
- * a symlink, go back through the file descriptor. Otherwise, cd up
- * one directory.
- */
- if (p->fts_level == FTS_ROOTLEVEL) {
- if (FCHDIR(sp, sp->fts_rfd)) {
- SET(FTS_STOP);
- return (NULL);
- }
- } else if (p->fts_flags & FTS_SYMFOLLOW) {
- if (FCHDIR(sp, p->fts_symfd)) {
- saved_errno = errno;
- (void)_close(p->fts_symfd);
- errno = saved_errno;
- SET(FTS_STOP);
- return (NULL);
- }
- (void)_close(p->fts_symfd);
- } else if (!(p->fts_flags & FTS_DONTCHDIR) &&
- fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
- SET(FTS_STOP);
- return (NULL);
- }
- p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
- return (sp->fts_cur = p);
-}
-
-/*
- * Fts_set takes the stream as an argument although it's not used in this
- * implementation; it would be necessary if anyone wanted to add global
- * semantics to fts using fts_set. An error return is allowed for similar
- * reasons.
- */
-/* ARGSUSED */
-int
-fts_set(sp, p, instr)
- FTS *sp;
- FTSENT *p;
- int instr;
-{
- if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
- instr != FTS_NOINSTR && instr != FTS_SKIP) {
- errno = EINVAL;
- return (1);
- }
- p->fts_instr = instr;
- return (0);
-}
-
-FTSENT *
-fts_children(sp, instr)
- FTS *sp;
- int instr;
-{
- FTSENT *p;
- int fd;
-
- if (instr != 0 && instr != FTS_NAMEONLY) {
- errno = EINVAL;
- return (NULL);
- }
-
- /* Set current node pointer. */
- p = sp->fts_cur;
-
- /*
- * Errno set to 0 so user can distinguish empty directory from
- * an error.
- */
- errno = 0;
-
- /* Fatal errors stop here. */
- if (ISSET(FTS_STOP))
- return (NULL);
-
- /* Return logical hierarchy of user's arguments. */
- if (p->fts_info == FTS_INIT)
- return (p->fts_link);
-
- /*
- * If not a directory being visited in pre-order, stop here. Could
- * allow FTS_DNR, assuming the user has fixed the problem, but the
- * same effect is available with FTS_AGAIN.
- */
- if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
- return (NULL);
-
- /* Free up any previous child list. */
- if (sp->fts_child != NULL)
- fts_lfree(sp->fts_child);
-
- if (instr == FTS_NAMEONLY) {
- SET(FTS_NAMEONLY);
- instr = BNAMES;
- } else
- instr = BCHILD;
-
- /*
- * If using chdir on a relative path and called BEFORE fts_read does
- * its chdir to the root of a traversal, we can lose -- we need to
- * chdir into the subdirectory, and we don't know where the current
- * directory is, so we can't get back so that the upcoming chdir by
- * fts_read will work.
- */
- if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
- ISSET(FTS_NOCHDIR))
- return (sp->fts_child = fts_build(sp, instr));
-
- if ((fd = _open(".", O_RDONLY, 0)) < 0)
- return (NULL);
- sp->fts_child = fts_build(sp, instr);
- if (fchdir(fd))
- return (NULL);
- (void)_close(fd);
- return (sp->fts_child);
-}
-
-#ifndef fts_get_clientptr
-#error "fts_get_clientptr not defined"
-#endif
-
-void *
-(fts_get_clientptr)(FTS *sp)
-{
-
- return (fts_get_clientptr(sp));
-}
-
-#ifndef fts_get_stream
-#error "fts_get_stream not defined"
-#endif
-
-FTS *
-(fts_get_stream)(FTSENT *p)
-{
- return (fts_get_stream(p));
-}
-
-void
-fts_set_clientptr(FTS *sp, void *clientptr)
-{
-
- sp->fts_clientptr = clientptr;
-}
-
-/*
- * This is the tricky part -- do not casually change *anything* in here. The
- * idea is to build the linked list of entries that are used by fts_children
- * and fts_read. There are lots of special cases.
- *
- * The real slowdown in walking the tree is the stat calls. If FTS_NOSTAT is
- * set and it's a physical walk (so that symbolic links can't be directories),
- * we can do things quickly. First, if it's a 4.4BSD file system, the type
- * of the file is in the directory entry. Otherwise, we assume that the number
- * of subdirectories in a node is equal to the number of links to the parent.
- * The former skips all stat calls. The latter skips stat calls in any leaf
- * directories and for any files after the subdirectories in the directory have
- * been found, cutting the stat calls by about 2/3.
- */
-static FTSENT *
-fts_build(sp, type)
- FTS *sp;
- int type;
-{
- struct dirent *dp;
- FTSENT *p, *head;
- int nitems;
- FTSENT *cur, *tail;
- DIR *dirp;
- void *oldaddr;
- size_t dnamlen;
- int cderrno, descend, len, level, maxlen, nlinks, oflag, saved_errno,
- nostat, doadjust;
- char *cp;
-
- /* Set current node pointer. */
- cur = sp->fts_cur;
-
- /*
- * Open the directory for reading. If this fails, we're done.
- * If being called from fts_read, set the fts_info field.
- */
-#ifdef FTS_WHITEOUT
- if (ISSET(FTS_WHITEOUT))
- oflag = DTF_NODUP | DTF_REWIND;
- else
- oflag = DTF_HIDEW | DTF_NODUP | DTF_REWIND;
-#else
-#define __opendir2(path, flag) opendir(path)
-#endif
- if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) {
- if (type == BREAD) {
- cur->fts_info = FTS_DNR;
- cur->fts_errno = errno;
- }
- return (NULL);
- }
-
- /*
- * Nlinks is the number of possible entries of type directory in the
- * directory if we're cheating on stat calls, 0 if we're not doing
- * any stat calls at all, -1 if we're doing stats on everything.
- */
- if (type == BNAMES) {
- nlinks = 0;
- /* Be quiet about nostat, GCC. */
- nostat = 0;
- } else if (ISSET(FTS_NOSTAT) && ISSET(FTS_PHYSICAL)) {
- if (fts_ufslinks(sp, cur))
- nlinks = cur->fts_nlink - (ISSET(FTS_SEEDOT) ? 0 : 2);
- else
- nlinks = -1;
- nostat = 1;
- } else {
- nlinks = -1;
- nostat = 0;
- }
-
-#ifdef notdef
- (void)printf("nlinks == %d (cur: %d)\n", nlinks, cur->fts_nlink);
- (void)printf("NOSTAT %d PHYSICAL %d SEEDOT %d\n",
- ISSET(FTS_NOSTAT), ISSET(FTS_PHYSICAL), ISSET(FTS_SEEDOT));
-#endif
- /*
- * If we're going to need to stat anything or we want to descend
- * and stay in the directory, chdir. If this fails we keep going,
- * but set a flag so we don't chdir after the post-order visit.
- * We won't be able to stat anything, but we can still return the
- * names themselves. Note, that since fts_read won't be able to
- * chdir into the directory, it will have to return different path
- * names than before, i.e. "a/b" instead of "b". Since the node
- * has already been visited in pre-order, have to wait until the
- * post-order visit to return the error. There is a special case
- * here, if there was nothing to stat then it's not an error to
- * not be able to stat. This is all fairly nasty. If a program
- * needed sorted entries or stat information, they had better be
- * checking FTS_NS on the returned nodes.
- */
- cderrno = 0;
- if (nlinks || type == BREAD) {
- if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
- if (nlinks && type == BREAD)
- cur->fts_errno = errno;
- cur->fts_flags |= FTS_DONTCHDIR;
- descend = 0;
- cderrno = errno;
- } else
- descend = 1;
- } else
- descend = 0;
-
- /*
- * Figure out the max file name length that can be stored in the
- * current path -- the inner loop allocates more path as necessary.
- * We really wouldn't have to do the maxlen calculations here, we
- * could do them in fts_read before returning the path, but it's a
- * lot easier here since the length is part of the dirent structure.
- *
- * If not changing directories set a pointer so that can just append
- * each new name into the path.
- */
- len = NAPPEND(cur);
- if (ISSET(FTS_NOCHDIR)) {
- cp = sp->fts_path + len;
- *cp++ = '/';
- } else {
- /* GCC, you're too verbose. */
- cp = NULL;
- }
- len++;
- maxlen = sp->fts_pathlen - len;
-
- level = cur->fts_level + 1;
-
- /* Read the directory, attaching each entry to the `link' pointer. */
- doadjust = 0;
- for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) {
- dnamlen = dp->d_namlen;
- if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
- continue;
-
- if ((p = fts_alloc(sp, dp->d_name, (int)dnamlen)) == NULL)
- goto mem1;
- if (dnamlen >= maxlen) { /* include space for NUL */
- oldaddr = sp->fts_path;
- if (fts_palloc(sp, dnamlen + len + 1)) {
- /*
- * No more memory for path or structures. Save
- * errno, free up the current structure and the
- * structures already allocated.
- */
-mem1: saved_errno = errno;
- if (p)
- free(p);
- fts_lfree(head);
- (void)closedir(dirp);
- cur->fts_info = FTS_ERR;
- SET(FTS_STOP);
- errno = saved_errno;
- return (NULL);
- }
- /* Did realloc() change the pointer? */
- if (oldaddr != sp->fts_path) {
- doadjust = 1;
- if (ISSET(FTS_NOCHDIR))
- cp = sp->fts_path + len;
- }
- maxlen = sp->fts_pathlen - len;
- }
-
- if (len + dnamlen >= USHRT_MAX) {
- /*
- * In an FTSENT, fts_pathlen is a u_short so it is
- * possible to wraparound here. If we do, free up
- * the current structure and the structures already
- * allocated, then error out with ENAMETOOLONG.
- */
- free(p);
- fts_lfree(head);
- (void)closedir(dirp);
- cur->fts_info = FTS_ERR;
- SET(FTS_STOP);
- errno = ENAMETOOLONG;
- return (NULL);
- }
- p->fts_level = level;
- p->fts_parent = sp->fts_cur;
- p->fts_pathlen = len + dnamlen;
-
-#ifdef FTS_WHITEOUT
- if (dp->d_type == DT_WHT)
- p->fts_flags |= FTS_ISW;
-#endif
-
- if (cderrno) {
- if (nlinks) {
- p->fts_info = FTS_NS;
- p->fts_errno = cderrno;
- } else
- p->fts_info = FTS_NSOK;
- p->fts_accpath = cur->fts_accpath;
- } else if (nlinks == 0
-#ifdef DT_DIR
- || (nostat &&
- dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
-#endif
- ) {
- p->fts_accpath =
- ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name;
- p->fts_info = FTS_NSOK;
- } else {
- /* Build a file name for fts_stat to stat. */
- if (ISSET(FTS_NOCHDIR)) {
- p->fts_accpath = p->fts_path;
- memmove(cp, p->fts_name, p->fts_namelen + 1);
- } else
- p->fts_accpath = p->fts_name;
- /* Stat it. */
- p->fts_info = fts_stat(sp, p, 0);
-
- /* Decrement link count if applicable. */
- if (nlinks > 0 && (p->fts_info == FTS_D ||
- p->fts_info == FTS_DC || p->fts_info == FTS_DOT))
- --nlinks;
- }
-
- /* We walk in directory order so "ls -f" doesn't get upset. */
- p->fts_link = NULL;
- if (head == NULL)
- head = tail = p;
- else {
- tail->fts_link = p;
- tail = p;
- }
- ++nitems;
- }
- if (dirp)
- (void)closedir(dirp);
-
- /*
- * If realloc() changed the address of the path, adjust the
- * addresses for the rest of the tree and the dir list.
- */
- if (doadjust)
- fts_padjust(sp, head);
-
- /*
- * If not changing directories, reset the path back to original
- * state.
- */
- if (ISSET(FTS_NOCHDIR)) {
- if (len == sp->fts_pathlen || nitems == 0)
- --cp;
- *cp = '\0';
- }
-
- /*
- * If descended after called from fts_children or after called from
- * fts_read and nothing found, get back. At the root level we use
- * the saved fd; if one of fts_open()'s arguments is a relative path
- * to an empty directory, we wind up here with no other way back. If
- * can't get back, we're done.
- */
- if (descend && (type == BCHILD || !nitems) &&
- (cur->fts_level == FTS_ROOTLEVEL ?
- FCHDIR(sp, sp->fts_rfd) :
- fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
- cur->fts_info = FTS_ERR;
- SET(FTS_STOP);
- return (NULL);
- }
-
- /* If didn't find anything, return NULL. */
- if (!nitems) {
- if (type == BREAD)
- cur->fts_info = FTS_DP;
- return (NULL);
- }
-
- /* Sort the entries. */
- if (sp->fts_compar && nitems > 1)
- head = fts_sort(sp, head, nitems);
- return (head);
-}
-
-static u_short
-fts_stat(sp, p, follow)
- FTS *sp;
- FTSENT *p;
- int follow;
-{
- FTSENT *t;
- dev_t dev;
- ino_t ino;
- struct stat *sbp, sb;
- int saved_errno;
-
- /* If user needs stat info, stat buffer already allocated. */
- sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
-
-#ifdef FTS_WHITEOUT
- /* Check for whiteout. */
- if (p->fts_flags & FTS_ISW) {
- if (sbp != &sb) {
- memset(sbp, '\0', sizeof(*sbp));
- sbp->st_mode = S_IFWHT;
- }
- return (FTS_W);
- }
-#endif
-
- /*
- * If doing a logical walk, or application requested FTS_FOLLOW, do
- * a stat(2). If that fails, check for a non-existent symlink. If
- * fail, set the errno from the stat call.
- */
- if (ISSET(FTS_LOGICAL) || follow) {
- if (stat(p->fts_accpath, sbp)) {
- saved_errno = errno;
- if (!lstat(p->fts_accpath, sbp)) {
- errno = 0;
- return (FTS_SLNONE);
- }
- p->fts_errno = saved_errno;
- goto err;
- }
- } else if (lstat(p->fts_accpath, sbp)) {
- p->fts_errno = errno;
-err: memset(sbp, 0, sizeof(struct stat));
- return (FTS_NS);
- }
-
- if (S_ISDIR(sbp->st_mode)) {
- /*
- * Set the device/inode. Used to find cycles and check for
- * crossing mount points. Also remember the link count, used
- * in fts_build to limit the number of stat calls. It is
- * understood that these fields are only referenced if fts_info
- * is set to FTS_D.
- */
- dev = p->fts_dev = sbp->st_dev;
- ino = p->fts_ino = sbp->st_ino;
- p->fts_nlink = sbp->st_nlink;
-
- if (ISDOT(p->fts_name))
- return (FTS_DOT);
-
- /*
- * Cycle detection is done by brute force when the directory
- * is first encountered. If the tree gets deep enough or the
- * number of symbolic links to directories is high enough,
- * something faster might be worthwhile.
- */
- for (t = p->fts_parent;
- t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
- if (ino == t->fts_ino && dev == t->fts_dev) {
- p->fts_cycle = t;
- return (FTS_DC);
- }
- return (FTS_D);
- }
- if (S_ISLNK(sbp->st_mode))
- return (FTS_SL);
- if (S_ISREG(sbp->st_mode))
- return (FTS_F);
- return (FTS_DEFAULT);
-}
-
-/*
- * The comparison function takes pointers to pointers to FTSENT structures.
- * Qsort wants a comparison function that takes pointers to void.
- * (Both with appropriate levels of const-poisoning, of course!)
- * Use a trampoline function to deal with the difference.
- */
-static int
-fts_compar(const void *a, const void *b)
-{
- FTS *parent;
-
- parent = (*(const FTSENT * const *)a)->fts_fts;
- return (*parent->fts_compar)(a, b);
-}
-
-static FTSENT *
-fts_sort(sp, head, nitems)
- FTS *sp;
- FTSENT *head;
- int nitems;
-{
- FTSENT **ap, *p;
-
- /*
- * Construct an array of pointers to the structures and call qsort(3).
- * Reassemble the array in the order returned by qsort. If unable to
- * sort for memory reasons, return the directory entries in their
- * current order. Allocate enough space for the current needs plus
- * 40 so don't realloc one entry at a time.
- */
- if (nitems > sp->fts_nitems) {
- sp->fts_nitems = nitems + 40;
- if ((sp->fts_array = reallocf(sp->fts_array,
- sp->fts_nitems * sizeof(FTSENT *))) == NULL) {
- sp->fts_nitems = 0;
- return (head);
- }
- }
- for (ap = sp->fts_array, p = head; p; p = p->fts_link)
- *ap++ = p;
- qsort(sp->fts_array, nitems, sizeof(FTSENT *), fts_compar);
- for (head = *(ap = sp->fts_array); --nitems; ++ap)
- ap[0]->fts_link = ap[1];
- ap[0]->fts_link = NULL;
- return (head);
-}
-
-static FTSENT *
-fts_alloc(sp, name, namelen)
- FTS *sp;
- char *name;
- int namelen;
-{
- FTSENT *p;
- size_t len;
-
- struct ftsent_withstat {
- FTSENT ent;
- struct stat statbuf;
- };
-
- /*
- * The file name is a variable length array and no stat structure is
- * necessary if the user has set the nostat bit. Allocate the FTSENT
- * structure, the file name and the stat structure in one chunk, but
- * be careful that the stat structure is reasonably aligned.
- */
- if (ISSET(FTS_NOSTAT))
- len = sizeof(FTSENT) + namelen + 1;
- else
- len = sizeof(struct ftsent_withstat) + namelen + 1;
-
- if ((p = malloc(len)) == NULL)
- return (NULL);
-
- if (ISSET(FTS_NOSTAT)) {
- p->fts_name = (char *)(p + 1);
- p->fts_statp = NULL;
- } else {
- p->fts_name = (char *)((struct ftsent_withstat *)p + 1);
- p->fts_statp = &((struct ftsent_withstat *)p)->statbuf;
- }
-
- /* Copy the name and guarantee NUL termination. */
- memcpy(p->fts_name, name, namelen);
- p->fts_name[namelen] = '\0';
- p->fts_namelen = namelen;
- p->fts_path = sp->fts_path;
- p->fts_errno = 0;
- p->fts_flags = 0;
- p->fts_instr = FTS_NOINSTR;
- p->fts_number = 0;
- p->fts_pointer = NULL;
- p->fts_fts = sp;
- return (p);
-}
-
-static void
-fts_lfree(head)
- FTSENT *head;
-{
- FTSENT *p;
-
- /* Free a linked list of structures. */
- while ((p = head)) {
- head = head->fts_link;
- free(p);
- }
-}
-
-/*
- * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
- * Most systems will allow creation of paths much longer than MAXPATHLEN, even
- * though the kernel won't resolve them. Add the size (not just what's needed)
- * plus 256 bytes so don't realloc the path 2 bytes at a time.
- */
-static int
-fts_palloc(sp, more)
- FTS *sp;
- size_t more;
-{
-
- sp->fts_pathlen += more + 256;
- /*
- * Check for possible wraparound. In an FTS, fts_pathlen is
- * a signed int but in an FTSENT it is an unsigned short.
- * We limit fts_pathlen to USHRT_MAX to be safe in both cases.
- */
- if (sp->fts_pathlen < 0 || sp->fts_pathlen >= USHRT_MAX) {
- if (sp->fts_path)
- free(sp->fts_path);
- sp->fts_path = NULL;
- errno = ENAMETOOLONG;
- return (1);
- }
- sp->fts_path = reallocf(sp->fts_path, sp->fts_pathlen);
- return (sp->fts_path == NULL);
-}
-
-/*
- * When the path is realloc'd, have to fix all of the pointers in structures
- * already returned.
- */
-static void
-fts_padjust(sp, head)
- FTS *sp;
- FTSENT *head;
-{
- FTSENT *p;
- char *addr = sp->fts_path;
-
-#define ADJUST(p) do { \
- if ((p)->fts_accpath != (p)->fts_name) { \
- (p)->fts_accpath = \
- (char *)addr + ((p)->fts_accpath - (p)->fts_path); \
- } \
- (p)->fts_path = addr; \
-} while (0)
- /* Adjust the current set of children. */
- for (p = sp->fts_child; p; p = p->fts_link)
- ADJUST(p);
-
- /* Adjust the rest of the tree, including the current level. */
- for (p = head; p->fts_level >= FTS_ROOTLEVEL;) {
- ADJUST(p);
- p = p->fts_link ? p->fts_link : p->fts_parent;
- }
-}
-
-static size_t
-fts_maxarglen(argv)
- char * const *argv;
-{
- size_t len, max;
-
- for (max = 0; *argv; ++argv)
- if ((len = strlen(*argv)) > max)
- max = len;
- return (max + 1);
-}
-
-/*
- * Change to dir specified by fd or p->fts_accpath without getting
- * tricked by someone changing the world out from underneath us.
- * Assumes p->fts_dev and p->fts_ino are filled in.
- */
-static int
-fts_safe_changedir(sp, p, fd, path)
- FTS *sp;
- FTSENT *p;
- int fd;
- char *path;
-{
- int ret, oerrno, newfd;
- struct stat sb;
-
- newfd = fd;
- if (ISSET(FTS_NOCHDIR))
- return (0);
- if (fd < 0 && (newfd = _open(path, O_RDONLY, 0)) < 0)
- return (-1);
- if (_fstat(newfd, &sb)) {
- ret = -1;
- goto bail;
- }
- if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
- errno = ENOENT; /* disinformation */
- ret = -1;
- goto bail;
- }
- ret = fchdir(newfd);
-bail:
- oerrno = errno;
- if (fd < 0)
- (void)_close(newfd);
- errno = oerrno;
- return (ret);
-}
-
-/*
- * Check if the filesystem for "ent" has UFS-style links.
- */
-static int
-fts_ufslinks(FTS *sp, const FTSENT *ent)
-{
- struct _fts_private *priv;
- const char **cpp;
-
- priv = (struct _fts_private *)sp;
- /*
- * If this node's device is different from the previous, grab
- * the filesystem information, and decide on the reliability
- * of the link information from this filesystem for stat(2)
- * avoidance.
- */
- if (priv->ftsp_dev != ent->fts_dev) {
- if (statfs(ent->fts_path, &priv->ftsp_statfs) != -1) {
- priv->ftsp_dev = ent->fts_dev;
- priv->ftsp_linksreliable = 0;
- for (cpp = ufslike_filesystems; *cpp; cpp++) {
- if (strcmp(priv->ftsp_statfs.f_fstypename,
- *cpp) == 0) {
- priv->ftsp_linksreliable = 1;
- break;
- }
- }
- } else {
- priv->ftsp_linksreliable = 0;
- }
- }
- return (priv->ftsp_linksreliable);
-}
diff --git a/lib/libc/gen/fts-compat.h b/lib/libc/gen/fts-compat.h
deleted file mode 100644
index 7eb03a6..0000000
--- a/lib/libc/gen/fts-compat.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.
- *
- * @(#)fts.h 8.3 (Berkeley) 8/14/94
- * $FreeBSD$
- */
-
-#ifndef _FTS_H_
-#define _FTS_H_
-
-typedef struct {
- struct _ftsent *fts_cur; /* current node */
- struct _ftsent *fts_child; /* linked list of children */
- struct _ftsent **fts_array; /* sort array */
- dev_t fts_dev; /* starting device # */
- char *fts_path; /* path for this descent */
- int fts_rfd; /* fd for root */
- int fts_pathlen; /* sizeof(path) */
- int fts_nitems; /* elements in the sort array */
- int (*fts_compar) /* compare function */
- (const struct _ftsent * const *, const struct _ftsent * const *);
-
-#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */
-#define FTS_LOGICAL 0x002 /* logical walk */
-#define FTS_NOCHDIR 0x004 /* don't change directories */
-#define FTS_NOSTAT 0x008 /* don't get stat info */
-#define FTS_PHYSICAL 0x010 /* physical walk */
-#define FTS_SEEDOT 0x020 /* return dot and dot-dot */
-#define FTS_XDEV 0x040 /* don't cross devices */
-#define FTS_WHITEOUT 0x080 /* return whiteout information */
-#define FTS_OPTIONMASK 0x0ff /* valid user option mask */
-
-#define FTS_NAMEONLY 0x100 /* (private) child names only */
-#define FTS_STOP 0x200 /* (private) unrecoverable error */
- int fts_options; /* fts_open options, global flags */
- void *fts_clientptr; /* thunk for sort function */
-} FTS;
-
-typedef struct _ftsent {
- struct _ftsent *fts_cycle; /* cycle node */
- struct _ftsent *fts_parent; /* parent directory */
- struct _ftsent *fts_link; /* next file in directory */
- union {
- struct {
- long __fts_number; /* local numeric value */
- void *__fts_pointer; /* local address value */
- } __struct_ftsent;
- int64_t __fts_bignum;
- } __union_ftsent;
-#define fts_number __union_ftsent.__struct_ftsent.__fts_number
-#define fts_pointer __union_ftsent.__struct_ftsent.__fts_pointer
-#define fts_bignum __union_ftsent.__fts_bignum
- char *fts_accpath; /* access path */
- char *fts_path; /* root path */
- int fts_errno; /* errno for this node */
- int fts_symfd; /* fd for symlink */
- u_short fts_pathlen; /* strlen(fts_path) */
- u_short fts_namelen; /* strlen(fts_name) */
-
- ino_t fts_ino; /* inode */
- dev_t fts_dev; /* device */
- nlink_t fts_nlink; /* link count */
-
-#define FTS_ROOTPARENTLEVEL -1
-#define FTS_ROOTLEVEL 0
- short fts_level; /* depth (-1 to N) */
-
-#define FTS_D 1 /* preorder directory */
-#define FTS_DC 2 /* directory that causes cycles */
-#define FTS_DEFAULT 3 /* none of the above */
-#define FTS_DNR 4 /* unreadable directory */
-#define FTS_DOT 5 /* dot or dot-dot */
-#define FTS_DP 6 /* postorder directory */
-#define FTS_ERR 7 /* error; errno is set */
-#define FTS_F 8 /* regular file */
-#define FTS_INIT 9 /* initialized only */
-#define FTS_NS 10 /* stat(2) failed */
-#define FTS_NSOK 11 /* no stat(2) requested */
-#define FTS_SL 12 /* symbolic link */
-#define FTS_SLNONE 13 /* symbolic link without target */
-#define FTS_W 14 /* whiteout object */
- u_short fts_info; /* user flags for FTSENT structure */
-
-#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
-#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
-#define FTS_ISW 0x04 /* this is a whiteout object */
- u_short fts_flags; /* private flags for FTSENT structure */
-
-#define FTS_AGAIN 1 /* read node again */
-#define FTS_FOLLOW 2 /* follow symbolic link */
-#define FTS_NOINSTR 3 /* no instructions */
-#define FTS_SKIP 4 /* discard node */
- u_short fts_instr; /* fts_set() instructions */
-
- struct stat *fts_statp; /* stat(2) information */
- char *fts_name; /* file name */
- FTS *fts_fts; /* back pointer to main FTS */
-} FTSENT;
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-FTSENT *fts_children(FTS *, int);
-int fts_close(FTS *);
-void *fts_get_clientptr(FTS *);
-#define fts_get_clientptr(fts) ((fts)->fts_clientptr)
-FTS *fts_get_stream(FTSENT *);
-#define fts_get_stream(ftsent) ((ftsent)->fts_fts)
-FTS *fts_open(char * const *, int,
- int (*)(const FTSENT * const *, const FTSENT * const *));
-FTSENT *fts_read(FTS *);
-int fts_set(FTS *, FTSENT *, int);
-void fts_set_clientptr(FTS *, void *);
-__END_DECLS
-
-#endif /* !_FTS_H_ */
diff --git a/lib/libc/posix1e/mac_is_present.3 b/lib/libc/posix1e/mac_is_present.3
deleted file mode 100644
index 6466488..0000000
--- a/lib/libc/posix1e/mac_is_present.3
+++ /dev/null
@@ -1,87 +0,0 @@
-.\" Copyright (c) 2002 Networks Associates Technology, Inc.
-.\" All rights reserved.
-.\"
-.\" This software was developed for the FreeBSD Project by Chris
-.\" Costello at Safeport Network Services and NAI Labs, the Security
-.\" Research Division of Network Associates, Inc. under DARPA/SPAWAR
-.\" contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
-.\" research program.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 9, 2002
-.Dt MAC_IS_PRESENT_NP 3
-.Os
-.Sh NAME
-.Nm mac_is_present_np
-.Nd report whether the running system has MAC support
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mac.h
-.Ft int
-.Fn mac_is_present "const char *policyname"
-.Sh DESCRIPTION
-The
-.Fn mac_is_present_np
-function determines whether the currently-running kernel supports MAC for
-a given policy or not.
-If
-.Fa policyname
-is
-.No non- Ns Dv NULL ,
-the presence of the named policy
-(e.g.\&
-.Dq Li biba ,
-.Dq Li mls ,
-.Dq Li te )
-is checked, otherwise the presence of any MAC policies at all is checked.
-.Sh RETURN VALUES
-If the system supports the given MAC policy, the value 1 is returned.
-If the specified MAC policy is not supported, the value 0 is returned.
-If an error occurs, the value \-1 is returned.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The value of
-.Fa policyname
-is not valid.
-.It Bq Er ENOMEM
-Insufficient memory was available to allocate internal storage.
-.El
-.Sh SEE ALSO
-.Xr mac 3 ,
-.Xr mac_free 3 ,
-.Xr mac_get 3 ,
-.Xr mac_prepare 3 ,
-.Xr mac_set 3 ,
-.Xr mac_text 3 ,
-.Xr mac 4 ,
-.Xr mac 9
-.Sh HISTORY
-Support for Mandatory Access Control was introduced in
-.Fx 5.0
-as part of the
-.Tn TrustedBSD
-Project.
diff --git a/lib/libc/sys/shm_open.2 b/lib/libc/sys/shm_open.2
deleted file mode 100644
index b68e85b..0000000
--- a/lib/libc/sys/shm_open.2
+++ /dev/null
@@ -1,192 +0,0 @@
-.\"
-.\" Copyright 2000 Massachusetts Institute of Technology
-.\"
-.\" Permission to use, copy, modify, and distribute this software and
-.\" its documentation for any purpose and without fee is hereby
-.\" granted, provided that both the above copyright notice and this
-.\" permission notice appear in all copies, that both the above
-.\" copyright notice and this permission notice appear in all
-.\" supporting documentation, and that the name of M.I.T. not be used
-.\" in advertising or publicity pertaining to distribution of the
-.\" software without specific, written prior permission. M.I.T. makes
-.\" no representations about the suitability of this software for any
-.\" purpose. It is provided "as is" without express or implied
-.\" warranty.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
-.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
-.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 24, 2000
-.Dt SHM_OPEN 3
-.Os
-.Sh NAME
-.Nm shm_open , shm_unlink
-.Nd "shared memory object operations"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/mman.h
-.Ft int
-.Fn shm_open "const char *path" "int flags" "mode_t mode"
-.Ft int
-.Fn shm_unlink "const char *path"
-.Sh DESCRIPTION
-The
-.Fn shm_open
-function opens (or optionally creates) a
-.Tn POSIX
-shared memory object named
-.Fa path .
-The
-.Fn shm_unlink
-function removes a shared memory object named
-.Fa path .
-.Pp
-In the
-.Fx
-implementation,
-.Tn POSIX
-shared memory objects are implemented as ordinary files.
-The
-.Fn shm_open
-and
-.Fn shm_unlink
-act as wrappers around the
-.Xr open 2
-and
-.Xr unlink 2
-routines, and
-.Fa path ,
-.Fa flags ,
-and
-.Fa mode
-arguments are as specified for those functions.
-The
-.Fa flags
-argument is checked to ensure that the access mode specified is not
-.Dv O_WRONLY
-(which is not defined for shared memory objects).
-.Pp
-In addition, the
-.Fx
-implementation causes
-.Fn mmap
-of a descriptor returned by
-.Fn shm_open
-to behave as if the
-.Dv MAP_NOSYNC
-flag had been specified to
-.Xr mmap 2 .
-(It does so by setting a special file flag using
-.Xr fcntl 2 . )
-.Pp
-The
-.Fn shm_unlink
-function makes no effort to ensure that
-.Fa path
-refers to a shared memory object.
-.Sh RETURN VALUES
-If successful,
-.Fn shm_open
-returns a non-negative integer;
-.Fn shm_unlink
-returns zero.
-Both functions return -1 on failure, and set
-.Va errno
-to indicate the error.
-.Sh COMPATIBILITY
-The
-.Fa path
-argument does not necessarily represent a pathname (although it does in this
-and most other implementations).
-Two processes opening the same
-.Fa path
-are guaranteed to access the same shared memory object if and only if
-.Fa path
-begins with a slash
-.Pq Ql \&/
-character.
-.Pp
-Only the
-.Dv O_RDONLY ,
-.Dv O_RDWR ,
-.Dv O_CREAT ,
-.Dv O_EXCL ,
-and
-.Dv O_TRUNC
-flags may be used in portable programs.
-.Pp
-The result of using
-.Xr open 2 ,
-.Xr read 2 ,
-or
-.Xr write 2
-on a shared memory object, or on the descriptor returned by
-.Fn shm_open ,
-is undefined.
-It is also undefined whether the shared memory object itself, or its
-contents, persist across reboots.
-.Sh ERRORS
-The
-.Fn shm_open
-and
-.Fn shm_unlink
-functions can fail with any error defined for
-.Fn open
-and
-.Fn unlink ,
-respectively.
-In addition, the following errors are defined for
-.Fn shm_open :
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The object named by
-.Fa path
-is not a shared memory object
-(i.e., it is not a regular file).
-.It Bq Er EINVAL
-The
-.Fa flags
-argument to
-.Fn shm_open
-specifies an access mode of
-.Dv O_WRONLY .
-.El
-.Sh SEE ALSO
-.Xr mmap 2 ,
-.Xr munmap 2 ,
-.Xr open 2 ,
-.Xr unlink 2
-.Sh STANDARDS
-The
-.Fn shm_open
-and
-.Fn shm_unlink
-functions are believed to conform to
-.St -p1003.1b-93 .
-.Sh HISTORY
-The
-.Fn shm_open
-and
-.Fn shm_unlink
-functions first appeared in
-.Fx 4.3 .
-.Sh AUTHORS
-.An Garrett A. Wollman Aq wollman@FreeBSD.org
-(C library support and this manual page)
-.Pp
-.An Matthew Dillon Aq dillon@FreeBSD.org
-.Pq Dv MAP_NOSYNC
diff --git a/lib/libkse/Makefile b/lib/libkse/Makefile
deleted file mode 100644
index 65525aa..0000000
--- a/lib/libkse/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-# $FreeBSD$
-#
-# All library objects contain FreeBSD revision strings by default; they may be
-# excluded as a space-saving measure. To produce a library that does
-# not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS
-# below. Note, there are no IDs for syscall stubs whose sources are generated.
-# To included legacy CSRG sccsid strings, add -DLIBC_SCCS and -DSYSLIBC_SCCS
-# (for system call stubs) to CFLAGS below. -DSYSLIBC_SCCS affects just the
-# system call stubs.
-.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
-LIB=kse
-.else
-LIB=pthread
-.endif
-SHLIB_MAJOR= 1
-CFLAGS+=-DPTHREAD_KERNEL
-CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}/thread \
- -I${.CURDIR}/../../include
-CFLAGS+=-I${.CURDIR}/arch/${MACHINE_ARCH}/include
-CFLAGS+=-I${.CURDIR}/sys
-CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf
-CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf/${MACHINE_ARCH}
-CFLAGS+=-fno-builtin
-
-# Uncomment this if you want libpthread to contain debug information for
-# thread locking.
-CFLAGS+=-D_LOCK_DEBUG
-#CFLAGS+= -g
-
-# Uncomment this if you want to build a 1:1 threading mode library
-# however it is no longer strictly conformed to POSIX
-# CFLAGS+=-DSYSTEM_SCOPE_ONLY
-
-LDFLAGS= -Wl,--version-script=${.CURDIR}/pthread.map
-
-# enable extra internal consistancy checks
-CFLAGS+=-D_PTHREADS_INVARIANTS -Wall
-
-PRECIOUSLIB=
-
-.include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc"
-.include "${.CURDIR}/support/Makefile.inc"
-.include "${.CURDIR}/sys/Makefile.inc"
-.include "${.CURDIR}/thread/Makefile.inc"
-
-.include <bsd.lib.mk>
diff --git a/lib/libkse/arch/amd64/Makefile.inc b/lib/libkse/arch/amd64/Makefile.inc
deleted file mode 100644
index c8b0362..0000000
--- a/lib/libkse/arch/amd64/Makefile.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-
-SRCS+= context.S enter_uts.S pthread_md.c
diff --git a/lib/libkse/arch/amd64/amd64/context.S b/lib/libkse/arch/amd64/amd64/context.S
deleted file mode 100644
index 9e6ed74..0000000
--- a/lib/libkse/arch/amd64/amd64/context.S
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * The following notes ("cheat sheet") was provided by Peter Wemm.
- *
- * scratch:
- * rax (1st return)
- * rcx (4th arg)
- * rdx (3rd arg, 2nd return)
- * rsi (2nd arg)
- * rdi (1st arg)
- * r8 (5th arg)
- * r9 (6th arg)
- * r10 (temp, static chain?)
- * r11 (temp)
- *
- * preserved:
- * rbx (base pointer)
- * rsp (stack)
- * rbp (frame)
- * r12-r15 (general)
- *
- * calls:
- * rdi 1
- * rsi 2
- * rdx 3
- * rcx 4
- * r8 5
- * r9 6
- *
- * return:
- * rax 1
- * rdx 2
- *
- * This means:
- * arg1 goes in %rdi, arg2 in %rsi, etc. return value is %rax (and
- * secondary return, eg: pipe(2), in %rdx) %rcx,%rsi,%rdi etc are
- * trashed by making a call to something. %rbx,%rbp,%r12-15 are the
- * only registers preserved across a call. Note that unlike i386,
- * %rsi and %rdi are scratch rather than preserved. FPU is
- * different, args are in SSE registers rather than the x87 stack.
- *
- * Aside from the register calling conventions, amd64 can be treated
- * very much like i386. Things like setjmp/longjmp etc were literal
- * translations from i386 but with the register names updated, etc.
- * The main gotcha is that FPU save/restore is in SSE format, which
- * means a sparse 512 byte FPU context.
- */
-
-
-/*
- * Where do we define these?
- */
-#define MC_SIZE 800 /* sizeof mcontext_t */
-#define MC_LEN_OFFSET (25*8) /* offset to mc_len from mcontext */
-#define MC_FPFMT_OFFSET (26*8) /* offset to mc_fpformat from mcontext */
-#define MC_FPFMT_NODEV 0x10000
-#define MC_OWNEDFP_OFFSET (27*8) /* offset to mc_ownedfp from mcontext */
-#define MC_OWNEDFP_NONE 0x20000
-#define MC_OWNEDFP_FPU 0x20001
-#define MC_OWNEDFP_PCB 0x20002
-#define MC_FPREGS_OFFSET (28*8) /* offset to FP registers */
-#define MC_FP_CW_OFFSET (28*8) /* offset to FP control word */
-
-#define MC_RDI (1 * 8)
-#define MC_RSI (2 * 8)
-#define MC_RDX (3 * 8)
-#define MC_RCX (4 * 8)
-#define MC_R8 (5 * 8)
-#define MC_R9 (6 * 8)
-#define MC_RAX (7 * 8)
-#define MC_RBX (8 * 8)
-#define MC_RBP (9 * 8)
-#define MC_R10 (10 * 8)
-#define MC_R11 (11 * 8)
-#define MC_R12 (12 * 8)
-#define MC_R13 (13 * 8)
-#define MC_R14 (14 * 8)
-#define MC_R15 (15 * 8)
-#define MC_FLAGS (18 * 8)
-#define MC_RIP (20 * 8)
-#define MC_CS (21 * 8)
-#define MC_RFLAGS (22 * 8)
-#define MC_RSP (23 * 8)
-#define MC_SS (24 * 8)
-
-#define REDZONE 128 /* size of the red zone */
-
-/*
- * _amd64_ctx_save(mcontext_t *mcp)
- *
- * No values are saved to mc_trapno, mc_addr, mc_err and mc_cs.
- * For the FPU state, only the floating point control word is stored.
- */
-ENTRY(_amd64_save_context)
- cmpq $0, %rdi /* check for null pointer */
- jne 1f
- movq $-1, %rax
- jmp 2f
-1: movq %rdi, MC_RDI(%rdi)
- movq %rsi, MC_RSI(%rdi)
- movq %rdx, MC_RDX(%rdi)
- movq %rcx, MC_RCX(%rdi)
- movq %r8, MC_R8(%rdi)
- movq %r9, MC_R9(%rdi)
- movq $1, MC_RAX(%rdi) /* return 1 when restored */
- movq %rbx, MC_RBX(%rdi)
- movq %rbp, MC_RBP(%rdi)
- movq %r10, MC_R10(%rdi)
- movq %r11, MC_R11(%rdi)
- movq %r12, MC_R12(%rdi)
- movq %r13, MC_R13(%rdi)
- movq %r14, MC_R14(%rdi)
- movq %r15, MC_R15(%rdi)
- movq (%rsp), %rax /* get return address */
- movq %rax, MC_RIP(%rdi) /* save return address (%rip) */
- pushfq /* get flags */
- popq %rax
- movq %rax, MC_RFLAGS(%rdi) /* save flags */
- movq %rsp, %rax /* setcontext pushes the return */
- addq $8, %rax /* address onto the stack; */
- movq %rax, MC_RSP(%rdi) /* account for this -- ???. */
- movw %ss, MC_SS(%rdi)
- fnstcw MC_FP_CW_OFFSET(%rdi) /* save FPU control word */
- movq $MC_OWNEDFP_NONE, MC_OWNEDFP_OFFSET(%rdi) /* no FP */
- movq $MC_FPFMT_NODEV, MC_FPFMT_OFFSET(%rdi)
- movq $MC_SIZE, MC_LEN_OFFSET(%rdi)
- xorq %rax, %rax /* return 0 */
-2: ret
-
-/*
- * _amd64_ctx_restore(mcontext_t *mcp, intptr_t val, intptr_t *loc);
- */
-ENTRY(_amd64_restore_context)
- cmpq $0, %rdi /* check for null pointer */
- jne 1f
- movq $-1, %rax
- jmp 7f
-1: cmpq $MC_SIZE, MC_LEN_OFFSET(%rdi) /* is context valid? */
- je 2f
- movq $-1, %rax /* bzzzt, invalid context */
- jmp 7f
-2: movq MC_RCX(%rdi), %rcx
- movq MC_R8(%rdi), %r8
- movq MC_R9(%rdi), %r9
- movq MC_RBX(%rdi), %rbx
- movq MC_RBP(%rdi), %rbp
- movq MC_R10(%rdi), %r10
- movq MC_R11(%rdi), %r11
- movq MC_R12(%rdi), %r12
- movq MC_R13(%rdi), %r13
- movq MC_R14(%rdi), %r14
- movq MC_R15(%rdi), %r15
- /*
- * if (mc_fpowned == MC_OWNEDFP_FPU || mc_fpowned == MC_OWNEDFP_PCB)
- * restore XMM/SSE FP register format
- */
- cmpq $MC_OWNEDFP_NONE, MC_OWNEDFP_OFFSET(%rdi)
- je 4f
- cmpq $MC_OWNEDFP_PCB, MC_OWNEDFP_OFFSET(%rdi)
- je 3f
- cmpq $MC_OWNEDFP_FPU, MC_OWNEDFP_OFFSET(%rdi)
- jne 4f
-3: fxrstor MC_FPREGS_OFFSET(%rdi) /* restore XMM FP regs */
- jmp 5f
-4: fninit
- fldcw MC_FP_CW_OFFSET(%rdi)
-5: movq MC_RSP(%rdi), %rsp /* switch to context stack */
- subq $REDZONE, %rsp
- movq MC_RIP(%rdi), %rax /* return address on stack */
- pushq %rax
- movq MC_RDI(%rdi), %rax /* rdi on stack */
- pushq %rax
- movq MC_RDX(%rdi), %rax /* rdx on stack */
- pushq %rax
- movq MC_RSI(%rdi), %rax /* rsi on stack */
- pushq %rax
- movq MC_RFLAGS(%rdi), %rax /* flags on stack*/
- pushq %rax
- movq MC_RAX(%rdi), %rax /* restore rax */
- /* At this point we're done with the context. */
- cmpq $0, %rdx /* set *loc to val */
- je 6f
- movq %rsi, (%rdx)
-6: popfq /* restore flags */
- popq %rsi /* restore rsi, rdx, and rdi */
- popq %rdx
- popq %rdi
- leaq (8 + REDZONE)(%rsp), %rsp
- jmp *-(8 + REDZONE)(%rsp) /* jump to return address */
-7: ret
diff --git a/lib/libkse/arch/amd64/amd64/enter_uts.S b/lib/libkse/arch/amd64/amd64/enter_uts.S
deleted file mode 100644
index fb0df87..0000000
--- a/lib/libkse/arch/amd64/amd64/enter_uts.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-
-/*
- * _amd64_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
- * size_t stacksz);
- */
-ENTRY(_amd64_enter_uts)
- addq %rcx, %rdx /* get stack base */
- andq $~0xf, %rdx /* align to 16 bytes */
- movq %rdx, %rsp /* switch to UTS stack */
- movq %rdx, %rbp /* set frame */
- callq *%rsi
- ret
diff --git a/lib/libkse/arch/amd64/amd64/pthread_md.c b/lib/libkse/arch/amd64/amd64/pthread_md.c
deleted file mode 100644
index 3aceec7..0000000
--- a/lib/libkse/arch/amd64/amd64/pthread_md.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * 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.
- *
- * $FreeBSD$
- */
-
-#include <stdlib.h>
-#include <strings.h>
-#include "rtld_tls.h"
-#include "pthread_md.h"
-
-/*
- * The constructors.
- */
-struct tcb *
-_tcb_ctor(struct pthread *thread, int initial)
-{
- struct tcb *tcb;
- void *oldtls;
-
- if (initial) {
- __asm __volatile("movq %%fs:0, %0" : "=r" (oldtls));
- } else {
- oldtls = NULL;
- }
-
- tcb = _rtld_allocate_tls(oldtls, sizeof(struct tcb), 16);
- if (tcb) {
- tcb->tcb_thread = thread;
- bzero(&tcb->tcb_tmbx, sizeof(tcb->tcb_tmbx));
- }
-
- return (tcb);
-}
-
-void
-_tcb_dtor(struct tcb *tcb)
-{
- _rtld_free_tls(tcb, sizeof(struct tcb), 16);
-}
-
-struct kcb *
-_kcb_ctor(struct kse *kse)
-{
- struct kcb *kcb;
-
- kcb = malloc(sizeof(struct kcb));
- if (kcb != NULL) {
- bzero(kcb, sizeof(struct kcb));
- kcb->kcb_self = kcb;
- kcb->kcb_kse = kse;
- }
- return (kcb);
-}
-
-void
-_kcb_dtor(struct kcb *kcb)
-{
- free(kcb);
-}
diff --git a/lib/libkse/arch/amd64/include/atomic_ops.h b/lib/libkse/arch/amd64/include/atomic_ops.h
deleted file mode 100644
index 980eb8e..0000000
--- a/lib/libkse/arch/amd64/include/atomic_ops.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _ATOMIC_OPS_H_
-#define _ATOMIC_OPS_H_
-
-/*
- * Atomic swap:
- * Atomic (tmp = *dst, *dst = val), then *res = tmp
- *
- * void atomic_swap64(intptr_t *dst, intptr_t val, intptr_t *res);
- */
-static inline void
-atomic_swap64(intptr_t *dst, intptr_t val, intptr_t *res)
-{
- __asm __volatile(
- "xchgq %2, %1; movq %2, %0"
- : "=m" (*res) : "m" (*dst), "r" (val) : "memory");
-}
-
-static inline void
-atomic_swap_int(int *dst, int val, int *res)
-{
- __asm __volatile(
- "xchgl %2, %1; movl %2, %0"
- : "=m" (*res) : "m" (*dst), "r" (val) : "memory");
-}
-
-#define atomic_swap_ptr(d, v, r) \
- atomic_swap64((intptr_t *)(d), (intptr_t)(v), (intptr_t *)(r))
-
-#endif
diff --git a/lib/libkse/arch/amd64/include/pthread_md.h b/lib/libkse/arch/amd64/include/pthread_md.h
deleted file mode 100644
index a7da5df..0000000
--- a/lib/libkse/arch/amd64/include/pthread_md.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/*-
- * Copyright (C) 2003 David Xu <davidxu@freebsd.org>
- * Copyright (c) 2001 Daniel Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-/*
- * Machine-dependent thread prototypes/definitions for the thread kernel.
- */
-#ifndef _PTHREAD_MD_H_
-#define _PTHREAD_MD_H_
-
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/kse.h>
-#include <machine/sysarch.h>
-#include <ucontext.h>
-
-#define KSE_STACKSIZE 16384
-#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
-
-#define THR_GETCONTEXT(ucp) \
- (void)_amd64_save_context(&(ucp)->uc_mcontext)
-#define THR_SETCONTEXT(ucp) \
- (void)_amd64_restore_context(&(ucp)->uc_mcontext, 0, NULL)
-
-#define PER_KSE
-#undef PER_THREAD
-
-struct kse;
-struct pthread;
-struct tdv;
-
-/*
- * %fs points to a struct kcb.
- */
-struct kcb {
- struct tcb *kcb_curtcb;
- struct kcb *kcb_self; /* self reference */
- struct kse *kcb_kse;
- struct kse_mailbox kcb_kmbx;
-};
-
-struct tcb {
- struct tcb *tcb_self; /* required by rtld */
- void *tcb_dtv; /* required by rtld */
- struct pthread *tcb_thread;
- void *tcb_spare[1]; /* align tcb_tmbx to 16 bytes */
- struct kse_thr_mailbox tcb_tmbx;
-};
-
-/*
- * Evaluates to the byte offset of the per-kse variable name.
- */
-#define __kcb_offset(name) __offsetof(struct kcb, name)
-
-/*
- * Evaluates to the type of the per-kse variable name.
- */
-#define __kcb_type(name) __typeof(((struct kcb *)0)->name)
-
-/*
- * Evaluates to the value of the per-kse variable name.
- */
-#define KCB_GET64(name) ({ \
- __kcb_type(name) __result; \
- \
- u_long __i; \
- __asm __volatile("movq %%fs:%1, %0" \
- : "=r" (__i) \
- : "m" (*(u_long *)(__kcb_offset(name)))); \
- __result = (__kcb_type(name))__i; \
- \
- __result; \
-})
-
-/*
- * Sets the value of the per-kse variable name to value val.
- */
-#define KCB_SET64(name, val) ({ \
- __kcb_type(name) __val = (val); \
- \
- u_long __i; \
- __i = (u_long)__val; \
- __asm __volatile("movq %1,%%fs:%0" \
- : "=m" (*(u_long *)(__kcb_offset(name))) \
- : "r" (__i)); \
-})
-
-static __inline u_long
-__kcb_readandclear64(volatile u_long *addr)
-{
- u_long result;
-
- __asm __volatile (
- " xorq %0, %0;"
- " xchgq %%fs:%1, %0;"
- "# __kcb_readandclear64"
- : "=&r" (result)
- : "m" (*addr));
- return (result);
-}
-
-#define KCB_READANDCLEAR64(name) ({ \
- __kcb_type(name) __result; \
- \
- __result = (__kcb_type(name)) \
- __kcb_readandclear64((u_long *)__kcb_offset(name)); \
- __result; \
-})
-
-
-#define _kcb_curkcb() KCB_GET64(kcb_self)
-#define _kcb_curtcb() KCB_GET64(kcb_curtcb)
-#define _kcb_curkse() ((struct kse *)KCB_GET64(kcb_kmbx.km_udata))
-#define _kcb_get_tmbx() KCB_GET64(kcb_kmbx.km_curthread)
-#define _kcb_set_tmbx(value) KCB_SET64(kcb_kmbx.km_curthread, (void *)value)
-#define _kcb_readandclear_tmbx() KCB_READANDCLEAR64(kcb_kmbx.km_curthread)
-
-/*
- * The constructors.
- */
-struct tcb *_tcb_ctor(struct pthread *, int);
-void _tcb_dtor(struct tcb *tcb);
-struct kcb *_kcb_ctor(struct kse *);
-void _kcb_dtor(struct kcb *);
-
-/* Called from the KSE to set its private data. */
-static __inline void
-_kcb_set(struct kcb *kcb)
-{
- amd64_set_fsbase(kcb);
-}
-
-/* Get the current kcb. */
-static __inline struct kcb *
-_kcb_get(void)
-{
- return (_kcb_curkcb());
-}
-
-static __inline struct kse_thr_mailbox *
-_kcb_critical_enter(void)
-{
- struct kse_thr_mailbox *crit;
-
- crit = _kcb_readandclear_tmbx();
- return (crit);
-}
-
-static __inline void
-_kcb_critical_leave(struct kse_thr_mailbox *crit)
-{
- _kcb_set_tmbx(crit);
-}
-
-static __inline int
-_kcb_in_critical(void)
-{
- return (_kcb_get_tmbx() == NULL);
-}
-
-static __inline void
-_tcb_set(struct kcb *kcb, struct tcb *tcb)
-{
- kcb->kcb_curtcb = tcb;
-}
-
-static __inline struct tcb *
-_tcb_get(void)
-{
- return (_kcb_curtcb());
-}
-
-static __inline struct pthread *
-_get_curthread(void)
-{
- struct tcb *tcb;
-
- tcb = _kcb_curtcb();
- if (tcb != NULL)
- return (tcb->tcb_thread);
- else
- return (NULL);
-}
-
-static __inline struct kse *
-_get_curkse(void)
-{
- return ((struct kse *)_kcb_curkse());
-}
-
-void _amd64_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
- size_t stacksz);
-int _amd64_restore_context(mcontext_t *mc, intptr_t val, intptr_t *loc);
-int _amd64_save_context(mcontext_t *mc);
-
-static __inline int
-_thread_enter_uts(struct tcb *tcb, struct kcb *kcb)
-{
- int ret;
-
- ret = _amd64_save_context(&tcb->tcb_tmbx.tm_context.uc_mcontext);
- if (ret == 0) {
- _amd64_enter_uts(&kcb->kcb_kmbx, kcb->kcb_kmbx.km_func,
- kcb->kcb_kmbx.km_stack.ss_sp,
- kcb->kcb_kmbx.km_stack.ss_size);
- /* We should not reach here. */
- return (-1);
- }
- else if (ret < 0)
- return (-1);
- return (0);
-}
-
-static __inline int
-_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
-{
- extern int _libkse_debug;
-
- if ((kcb == NULL) || (tcb == NULL))
- return (-1);
- kcb->kcb_curtcb = tcb;
-
- if (_libkse_debug == 0) {
- tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
- if (setmbox != 0)
- _amd64_restore_context(
- &tcb->tcb_tmbx.tm_context.uc_mcontext,
- (intptr_t)&tcb->tcb_tmbx,
- (intptr_t *)&kcb->kcb_kmbx.km_curthread);
- else
- _amd64_restore_context(
- &tcb->tcb_tmbx.tm_context.uc_mcontext,
- 0, NULL);
- /* We should not reach here. */
- } else {
- if (setmbox)
- kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
- else
- kse_switchin(&tcb->tcb_tmbx, 0);
- }
-
- return (-1);
-}
-#endif
diff --git a/lib/libkse/arch/arm/Makefile.inc b/lib/libkse/arch/arm/Makefile.inc
deleted file mode 100644
index ced7063..0000000
--- a/lib/libkse/arch/arm/Makefile.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-
-CFLAGS+=-DSYSTEM_SCOPE_ONLY
-
-SRCS+= pthread_md.c context.S
diff --git a/lib/libkse/arch/arm/arm/context.S b/lib/libkse/arch/arm/arm/context.S
deleted file mode 100644
index c638804..0000000
--- a/lib/libkse/arch/arm/arm/context.S
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) Olivier Houchard
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * int thr_setcontext(mcontext_t *mcp, intptr_t val, intptr_t *loc)
- *
- * Restores the context in mcp.
- *
- * Returns 0 if there are no errors; -1 otherwise
- */
-
-.weak _C_LABEL(_thr_setcontext)
-.set _C_LABEL(_thr_setcontext), _C_LABEL(__thr_setcontext)
-
-ENTRY(__thr_setcontext)
-/* Check for NULL pointer. */
- cmp r0, #0
- moveq r0, #-1
- moveq pc, lr
- cmp r2, #0
- strne r1, [r2]
- ldr r1, [r0, #(16 * 4)] /* CPSR */
- msr cpsr, r1
- ldmia r0, {r0-r15}
- mov pc, lr
- /* XXX: FP bits ? */
-
-/*
- * int thr_getcontext(mcontext_t *mcp);
- *
- * Returns -1 if there is an error, 0 no errors; 1 upon return
- * from a setcontext().
- */
-.weak _C_LABEL(_thr_getcontext)
-.set _C_LABEL(_thr_getcontext), _C_LABEL(__thr_getcontext)
-
-ENTRY(__thr_getcontext)
-/* Check for NULL pointer. */
- cmp r0, #0
- moveq r0, #-1
- moveq pc, lr
- stmia r0, {r1-r14}
- mov r1, #1
- str r1, [r0] /* Return 1 from setcontext */
- str lr, [r0, #(15 * 4)] /* PC */
- mrs r1, cpsr
- str r1, [r0, #(16 * 4)] /* CPSR */
- mov r0, #0 /* Return 0. */
- mov pc, lr
-
-ENTRY(_arm_enter_uts)
- add sp, r2, r3 /* Stack addr + size. */
- mov pc, r1
diff --git a/lib/libkse/arch/arm/arm/pthread_md.c b/lib/libkse/arch/arm/arm/pthread_md.c
deleted file mode 100644
index 72426d4..0000000
--- a/lib/libkse/arch/arm/arm/pthread_md.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * Copyright (C) 2003 Jake Burkholder <jake@freebsd.org>
- * Copyright (C) 2003 David Xu <davidxu@freebsd.org>
- * Copyright (c) 2001,2003 Daniel Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ucontext.h>
-
-#include <machine/sysarch.h>
-
-#include "pthread_md.h"
-
-struct arm_tp **arm_tp = (struct arm_tp **)ARM_TP_ADDRESS;
-
-struct tcb *
-_tcb_ctor(struct pthread *thread, int initial)
-{
- struct tcb *tcb;
-
- if ((tcb = malloc(sizeof(struct tcb)))) {
- bzero(tcb, sizeof(struct tcb));
- tcb->tcb_thread = thread;
- /* XXX - Allocate tdv/tls */
- }
- return (tcb);
-}
-
-void
-_tcb_dtor(struct tcb *tcb)
-{
-
- free(tcb);
-}
-
-struct kcb *
-_kcb_ctor(struct kse *kse)
-{
- struct kcb *kcb;
-
- kcb = malloc(sizeof(struct kcb));
- if (kcb != NULL) {
- bzero(kcb, sizeof(struct kcb));
- kcb->kcb_faketcb.tcb_isfake = 1;
- kcb->kcb_faketcb.tcb_tmbx.tm_flags = TMF_NOUPCALL;
- kcb->kcb_curtcb = &kcb->kcb_faketcb;
- kcb->kcb_kse = kse;
- }
- return (kcb);
-}
-
-void
-_kcb_dtor(struct kcb *kcb)
-{
- free(kcb);
-}
diff --git a/lib/libkse/arch/arm/include/atomic_ops.h b/lib/libkse/arch/arm/include/atomic_ops.h
deleted file mode 100644
index 3a209b3..0000000
--- a/lib/libkse/arch/arm/include/atomic_ops.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _ATOMIC_OPS_H_
-#define _ATOMIC_OPS_H_
-
-#include <machine/atomic.h>
-#include "thr_private.h"
-
-/*
- * Atomic swap:
- * Atomic (tmp = *dst, *dst = val), then *res = tmp
- *
- * void atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res);
- */
-static inline void
-atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
-{
- *res = __swp(val, dst);
-}
-
-#define atomic_swap_ptr(d, v, r) \
- atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
-
-#define atomic_swap_int(d, v, r) \
- atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
-#endif
-
diff --git a/lib/libkse/arch/arm/include/pthread_md.h b/lib/libkse/arch/arm/include/pthread_md.h
deleted file mode 100644
index 857fa1b..0000000
--- a/lib/libkse/arch/arm/include/pthread_md.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*-
- * Copyright (c) 2003 Jake Burkholder <jake@freebsd.org>.
- * Copyright (c) 2003 Marcel Moolenaar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-/*
- * Machine-dependent thread prototypes/definitions for the thread kernel.
- */
-#ifndef _PTHREAD_MD_H_
-#define _PTHREAD_MD_H_
-
-#include <sys/kse.h>
-#include <stddef.h>
-#include <ucontext.h>
-
-#define KSE_STACKSIZE 16384
-#define DTV_OFFSET offsetof(struct tcb, tcb_tp.tp_tdv)
-
-int _thr_setcontext(mcontext_t *, intptr_t, intptr_t *);
-int _thr_getcontext(mcontext_t *);
-
-#define THR_GETCONTEXT(ucp) _thr_getcontext(&(ucp)->uc_mcontext)
-#define THR_SETCONTEXT(ucp) _thr_setcontext(&(ucp)->uc_mcontext, 0, NULL)
-
-#define PER_THREAD
-
-struct kcb;
-struct kse;
-struct pthread;
-struct tcb;
-struct tdv; /* We don't know what this is yet? */
-
-
-/*
- * %r6 points to one of these. We define the static TLS as an array
- * of long double to enforce 16-byte alignment of the TLS memory.
- *
- * XXX - Both static and dynamic allocation of any of these structures
- * will result in a valid, well-aligned thread pointer???
- */
-struct arm_tp {
- struct tdv *tp_tdv; /* dynamic TLS */
-};
-
-struct tcb {
- struct pthread *tcb_thread;
- struct kcb *tcb_curkcb;
- uint32_t tcb_isfake;
- struct kse_thr_mailbox tcb_tmbx; /* needs 32-byte alignment */
- struct arm_tp tcb_tp;
-};
-
-struct kcb {
- struct kse_mailbox kcb_kmbx;
- struct tcb kcb_faketcb;
- struct tcb *kcb_curtcb;
- struct kse *kcb_kse;
-};
-
-extern struct arm_tp **arm_tp;
-#define _tp (*arm_tp)
-
-#define _tcb ((struct tcb*)((char*)(_tp) - offsetof(struct tcb, tcb_tp)))
-
-/*
- * The kcb and tcb constructors.
- */
-struct tcb *_tcb_ctor(struct pthread *, int);
-void _tcb_dtor(struct tcb *);
-struct kcb *_kcb_ctor(struct kse *kse);
-void _kcb_dtor(struct kcb *);
-
-static __inline uint32_t
-__kcb_swp(uint32_t val, void *ptr)
-{
-
- __asm __volatile("swp %0, %1, [%2]"
- : "=r" (val) : "r" (val) , "r" (ptr) : "memory");
- return (val);
-}
-
-/* Called from the KSE to set its private data. */
-static __inline void
-_kcb_set(struct kcb *kcb)
-{
- /* There is no thread yet; use the fake tcb. */
- __kcb_swp((uint32_t)&kcb->kcb_faketcb.tcb_tp, &_tp);
-}
-
-/*
- * Get the current kcb.
- *
- * This can only be called while in a critical region; don't
- * worry about having the kcb changed out from under us.
- */
-static __inline struct kcb *
-_kcb_get(void)
-{
- return (_tcb->tcb_curkcb);
-}
-
-/*
- * Enter a critical region.
- *
- * Read and clear km_curthread in the kse mailbox.
- */
-static __inline struct kse_thr_mailbox *
-_kcb_critical_enter(void)
-{
- struct kse_thr_mailbox *crit;
-
- if (_tcb->tcb_isfake)
- return (NULL);
- crit = (struct kse_thr_mailbox *)__kcb_swp((uint32_t)NULL,
- &_tcb->tcb_curkcb->kcb_kmbx.km_curthread);
- return (crit);
-}
-
-static __inline void
-_kcb_critical_leave(struct kse_thr_mailbox *crit)
-{
-
- if (_tcb->tcb_isfake == 0)
- __kcb_swp((uint32_t)crit,
- &_tcb->tcb_curkcb->kcb_kmbx.km_curthread);
-}
-
-static __inline int
-_kcb_in_critical(void)
-{
- uint32_t flags;
- int ret;
-
- return (_tcb->tcb_curkcb->kcb_kmbx.km_curthread == NULL);
- if (_tcb->tcb_isfake != 0) {
- /*
- * We are in a critical region since there is no
- * current thread.
- */
- ret = 1;
- } else {
- flags = _tcb->tcb_tmbx.tm_flags;
- _tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
- ret = (_tcb->tcb_curkcb->kcb_kmbx.km_curthread == NULL);
- _tcb->tcb_tmbx.tm_flags = flags;
- }
- return (ret);
-}
-
-static __inline void
-_tcb_set(struct kcb *kcb, struct tcb *tcb)
-{
- if (tcb == NULL)
- tcb = &kcb->kcb_faketcb;
- __kcb_swp((uint32_t)&tcb->tcb_tp, &_tp);
- kcb->kcb_curtcb = tcb;
- tcb->tcb_curkcb = kcb;
-}
-
-static __inline struct tcb *
-_tcb_get(void)
-{
- return (_tcb);
-}
-
-static __inline struct pthread *
-_get_curthread(void)
-{
- return (_tcb->tcb_thread);
-}
-
-/*
- * Get the current kse.
- *
- * Like _kcb_get(), this can only be called while in a critical region.
- */
-static __inline struct kse *
-_get_curkse(void)
-{
- return (_tcb->tcb_curkcb->kcb_kse);
-}
-
-void _arm_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
- size_t stacksz);
-
-static __inline int
-_thread_enter_uts(struct tcb *tcb, struct kcb *kcb)
-{
- int ret;
-
- if ((ret = _thr_getcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext))
- == 0) {
- kcb->kcb_curtcb = &kcb->kcb_faketcb;
- __kcb_swp((int)&kcb->kcb_faketcb.tcb_tp, &_tp);
- _arm_enter_uts(&kcb->kcb_kmbx, kcb->kcb_kmbx.km_func,
- kcb->kcb_kmbx.km_stack.ss_sp,
- kcb->kcb_kmbx.km_stack.ss_size);
- /* We should not reach here. */
- return (-1);
- } else if (ret < 0)
- return (-1);
- return (0);
-}
-
-static __inline int
-_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
-{
- extern int _libkse_debug;
- mcontext_t *mc;
-
- if (!tcb || !kcb)
- return (-1);
- _tcb_set(kcb, tcb);
- mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
- if (_libkse_debug == 0) {
- tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
- if (setmbox)
- _thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
- (intptr_t *)&kcb->kcb_kmbx.km_curthread);
- else
- _thr_setcontext(mc, 0, NULL);
- } else {
- if (setmbox)
- kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
- else
- kse_switchin(&tcb->tcb_tmbx, 0);
- }
-
- /* We should not reach here. */
- return (-1);
-}
-
-#endif /* _PTHREAD_MD_H_ */
diff --git a/lib/libkse/arch/i386/Makefile.inc b/lib/libkse/arch/i386/Makefile.inc
deleted file mode 100644
index 73a9a8a..0000000
--- a/lib/libkse/arch/i386/Makefile.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-
-SRCS+= thr_enter_uts.S thr_getcontext.S pthread_md.c
diff --git a/lib/libkse/arch/i386/i386/pthread_md.c b/lib/libkse/arch/i386/i386/pthread_md.c
deleted file mode 100644
index 5c85fe0..0000000
--- a/lib/libkse/arch/i386/i386/pthread_md.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * Copyright (C) 2003 David Xu <davidxu@freebsd.org>
- * Copyright (c) 2001,2003 Daniel Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <machine/cpufunc.h>
-#include <machine/sysarch.h>
-
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ucontext.h>
-
-#include "rtld_tls.h"
-#include "pthread_md.h"
-
-struct tcb *
-_tcb_ctor(struct pthread *thread, int initial)
-{
- struct tcb *tcb;
- void *oldtls;
-
- if (initial) {
- __asm __volatile("movl %%gs:0, %0" : "=r" (oldtls));
- } else {
- oldtls = NULL;
- }
-
- tcb = _rtld_allocate_tls(oldtls, sizeof(struct tcb), 16);
- if (tcb) {
- tcb->tcb_thread = thread;
- tcb->tcb_spare = 0;
- bzero(&tcb->tcb_tmbx, sizeof(tcb->tcb_tmbx));
- }
-
- return (tcb);
-}
-
-void
-_tcb_dtor(struct tcb *tcb)
-{
- _rtld_free_tls(tcb, sizeof(struct tcb), 16);
-}
-
-/*
- * Initialize KSD. This also includes setting up the LDT.
- */
-struct kcb *
-_kcb_ctor(struct kse *kse)
-{
- void *base;
- struct kcb *kcb;
-
- kcb = malloc(sizeof(struct kcb));
- if (kcb != NULL) {
- bzero(kcb, sizeof(struct kcb));
- kcb->kcb_self = kcb;
- kcb->kcb_kse = kse;
- }
- return (kcb);
-}
-
-void
-_kcb_dtor(struct kcb *kcb)
-{
- free(kcb);
-}
-
-int
-i386_set_gsbase(void *addr)
-{
-
- return (sysarch(I386_SET_GSBASE, &addr));
-}
diff --git a/lib/libkse/arch/i386/i386/thr_enter_uts.S b/lib/libkse/arch/i386/i386/thr_enter_uts.S
deleted file mode 100644
index bf6df8f..0000000
--- a/lib/libkse/arch/i386/i386/thr_enter_uts.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2002 Jonathan Mini <mini@freebsd.org>.
- * Copyright (c) 2001 Daniel Eischen <deischen@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-
-/*
- * _i386_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
- * long stacksz);
- * +4 = km, +8 = uts, +12 = stack, +16 = size
- */
-ENTRY(_i386_enter_uts)
- movl %esp, %edx /* save stack */
- movl 12(%edx), %eax /* get bottom of stack */
- addl 16(%edx), %eax /* add length */
- movl %eax, %esp /* switch to uts stack */
- pushl 4(%edx) /* push the address of the mailbox */
- call *8(%edx)
- ret
diff --git a/lib/libkse/arch/i386/i386/thr_getcontext.S b/lib/libkse/arch/i386/i386/thr_getcontext.S
deleted file mode 100644
index c3d6a78..0000000
--- a/lib/libkse/arch/i386/i386/thr_getcontext.S
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * Copyright (c) 2001 Daniel Eischen <deischen@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Where do we define these?
- */
-#define MC_LEN_OFFSET 80 /* offset to mc_len from mcontext */
-#define MC_LEN 640 /* mc_len <machine/ucontext.h> */
-#define MC_FPFMT_OFFSET 84
-#define MC_FPFMT_NODEV 0x10000
-#define MC_FPFMT_387 0x10001
-#define MC_FPFMT_XMM 0x10002
-#define MC_OWNEDFP_OFFSET 88
-#define MC_OWNEDFP_NONE 0x20000
-#define MC_OWNEDFP_FPU 0x20001
-#define MC_OWNEDFP_PCB 0x20002
-#define MC_FPREGS_OFFSET 96 /* offset to FP regs from mcontext */
-#define MC_FP_CW_OFFSET 96 /* offset to FP control word */
-
-/*
- * int thr_setcontext(mcontext_t *mcp, intptr_t val, intptr_t *loc)
- *
- * Restores the context in mcp.
- *
- * Returns 0 if there are no errors; -1 otherwise
- */
- .weak CNAME(_thr_setcontext)
- .set CNAME(_thr_setcontext),CNAME(__thr_setcontext)
-ENTRY(__thr_setcontext)
- movl 4(%esp), %edx /* get address of mcontext */
- cmpl $0, %edx /* check for null pointer */
- jne 1f
- movl $-1, %eax
- jmp 8f
-1: cmpl $MC_LEN, MC_LEN_OFFSET(%edx) /* is context valid? */
- je 2f
- movl $-1, %eax /* bzzzt, invalid context */
- jmp 8f
-2: /*movl 4(%edx), %gs*/ /* we don't touch %gs */
- movl 8(%edx), %fs
- movl 12(%edx), %es
- movl 16(%edx), %ds
- movl 76(%edx), %ss
- movl 20(%edx), %edi
- movl 24(%edx), %esi
- movl 28(%edx), %ebp
- movl %esp, %ecx /* save current stack in ecx */
- movl 72(%edx), %esp /* switch to context defined stack */
- pushl 60(%edx) /* push return address on stack */
- pushl 44(%edx) /* push ecx on stack */
- pushl 48(%edx) /* push eax on stack */
- /*
- * if (mc_fpowned == MC_OWNEDFP_FPU || mc_fpowned == MC_OWNEDFP_PCB) {
- * if (mc_fpformat == MC_FPFMT_387)
- * restore 387 FP register format
- * else if (mc_fpformat == MC_FPFMT_XMM)
- * restore XMM/SSE FP register format
- * }
- */
- cmpl $MC_OWNEDFP_FPU, MC_OWNEDFP_OFFSET(%edx)
- je 3f
- cmpl $MC_OWNEDFP_PCB, MC_OWNEDFP_OFFSET(%edx)
- jne 5f
-3: cmpl $MC_FPFMT_387, MC_FPFMT_OFFSET(%edx)
- jne 4f
- frstor MC_FPREGS_OFFSET(%edx) /* restore 387 FP regs */
- jmp 6f
-4: cmpl $MC_FPFMT_XMM, MC_FPFMT_OFFSET(%edx)
- jne 5f
- fxrstor MC_FPREGS_OFFSET(%edx) /* restore XMM FP regs */
- jmp 6f
-5: fninit
- fldcw MC_FP_CW_OFFSET(%edx)
-6: pushl 68(%edx) /* push flags register on stack*/
- movl 36(%edx), %ebx /* restore ebx and edx */
- movl 40(%edx), %edx
- movl 12(%ecx), %eax /* get 3rd arg (loc) */
- cmpl $0, %eax /* do nothing if loc == null */
- je 7f
- movl 8(%ecx), %ecx /* get 2nd arg (val) */
- movl %ecx, (%eax) /* set loc = val */
-7: popfl /* restore flags after test */
- popl %eax /* restore eax and ecx last */
- popl %ecx
-8: ret
-
-/*
- * int thr_getcontext(mcontext_t *mcp);
- *
- * Returns -1 if there is an error, 0 no errors; 1 upon return
- * from a setcontext().
- */
- .weak CNAME(_thr_getcontext)
- .set CNAME(_thr_getcontext),CNAME(__thr_getcontext)
-ENTRY(__thr_getcontext)
- pushl %edx /* save edx */
- movl 8(%esp), %edx /* get address of mcontext */
- cmpl $0, %edx /* check for null pointer */
- jne 1f
- popl %edx /* restore edx and stack */
- movl $-1, %eax
- jmp 2f
-1: /*movl %gs, 4(%edx)*/ /* we don't touch %gs */
- movl %fs, 8(%edx)
- movl %es, 12(%edx)
- movl %ds, 16(%edx)
- movl %ss, 76(%edx)
- movl %edi, 20(%edx)
- movl %esi, 24(%edx)
- movl %ebp, 28(%edx)
- movl %ebx, 36(%edx)
- movl $1, 48(%edx) /* store successful return in eax */
- popl %eax /* get saved value of edx */
- movl %eax, 40(%edx) /* save edx */
- movl %ecx, 44(%edx)
- movl (%esp), %eax /* get return address */
- movl %eax, 60(%edx) /* save return address */
- fnstcw MC_FP_CW_OFFSET(%edx)
- movl $MC_LEN, MC_LEN_OFFSET(%edx)
- movl $MC_FPFMT_NODEV, MC_FPFMT_OFFSET(%edx) /* no FP */
- movl $MC_OWNEDFP_NONE, MC_OWNEDFP_OFFSET(%edx) /* no FP */
- pushfl
- popl %eax /* get eflags */
- movl %eax, 68(%edx) /* store eflags */
- movl %esp, %eax /* setcontext pushes the return */
- addl $4, %eax /* address onto the top of the */
- movl %eax, 72(%edx) /* stack; account for this */
- movl 40(%edx), %edx /* restore edx -- is this needed? */
- xorl %eax, %eax /* return 0 */
-2: ret
diff --git a/lib/libkse/arch/i386/include/atomic_ops.h b/lib/libkse/arch/i386/include/atomic_ops.h
deleted file mode 100644
index 7bc3d1b..0000000
--- a/lib/libkse/arch/i386/include/atomic_ops.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _ATOMIC_OPS_H_
-#define _ATOMIC_OPS_H_
-
-/*
- * Atomic swap:
- * Atomic (tmp = *dst, *dst = val), then *res = tmp
- *
- * void atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res);
- */
-static inline void
-atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
-{
- __asm __volatile(
- "xchgl %2, %1; movl %2, %0"
- : "=m" (*res) : "m" (*dst), "r" (val) : "memory");
-}
-
-#define atomic_swap_ptr(d, v, r) \
- atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
-
-#define atomic_swap_int(d, v, r) \
- atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
-#endif
diff --git a/lib/libkse/arch/i386/include/pthread_md.h b/lib/libkse/arch/i386/include/pthread_md.h
deleted file mode 100644
index 52afd6a..0000000
--- a/lib/libkse/arch/i386/include/pthread_md.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/*-
- * Copyright (c) 2002 Daniel Eischen <deischen@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-/*
- * Machine-dependent thread prototypes/definitions for the thread kernel.
- */
-#ifndef _PTHREAD_MD_H_
-#define _PTHREAD_MD_H_
-
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/kse.h>
-#include <machine/sysarch.h>
-#include <ucontext.h>
-
-extern int _thr_setcontext(mcontext_t *, intptr_t, intptr_t *);
-extern int _thr_getcontext(mcontext_t *);
-
-#define KSE_STACKSIZE 16384
-#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
-
-#define THR_GETCONTEXT(ucp) _thr_getcontext(&(ucp)->uc_mcontext)
-#define THR_SETCONTEXT(ucp) _thr_setcontext(&(ucp)->uc_mcontext, 0, NULL)
-
-#define PER_KSE
-#undef PER_THREAD
-
-struct kse;
-struct pthread;
-
-/*
- * %gs points to a struct kcb.
- */
-struct kcb {
- struct tcb *kcb_curtcb;
- struct kcb *kcb_self; /* self reference */
- struct kse *kcb_kse;
- struct kse_mailbox kcb_kmbx;
-};
-
-struct tcb {
- struct tcb *tcb_self; /* required by rtld */
- void *tcb_dtv; /* required by rtld */
- struct pthread *tcb_thread;
- void *tcb_spare; /* align tcb_tmbx to 16 bytes */
- struct kse_thr_mailbox tcb_tmbx;
-};
-
-/*
- * Evaluates to the byte offset of the per-kse variable name.
- */
-#define __kcb_offset(name) __offsetof(struct kcb, name)
-
-/*
- * Evaluates to the type of the per-kse variable name.
- */
-#define __kcb_type(name) __typeof(((struct kcb *)0)->name)
-
-/*
- * Evaluates to the value of the per-kse variable name.
- */
-#define KCB_GET32(name) ({ \
- __kcb_type(name) __result; \
- \
- u_int __i; \
- __asm __volatile("movl %%gs:%1, %0" \
- : "=r" (__i) \
- : "m" (*(u_int *)(__kcb_offset(name)))); \
- __result = (__kcb_type(name))__i; \
- \
- __result; \
-})
-
-/*
- * Sets the value of the per-kse variable name to value val.
- */
-#define KCB_SET32(name, val) ({ \
- __kcb_type(name) __val = (val); \
- \
- u_int __i; \
- __i = (u_int)__val; \
- __asm __volatile("movl %1,%%gs:%0" \
- : "=m" (*(u_int *)(__kcb_offset(name))) \
- : "r" (__i)); \
-})
-
-static __inline u_long
-__kcb_readandclear32(volatile u_long *addr)
-{
- u_long result;
-
- __asm __volatile (
- " xorl %0, %0;"
- " xchgl %%gs:%1, %0;"
- "# __kcb_readandclear32"
- : "=&r" (result)
- : "m" (*addr));
- return (result);
-}
-
-#define KCB_READANDCLEAR32(name) ({ \
- __kcb_type(name) __result; \
- \
- __result = (__kcb_type(name)) \
- __kcb_readandclear32((u_long *)__kcb_offset(name)); \
- __result; \
-})
-
-
-#define _kcb_curkcb() KCB_GET32(kcb_self)
-#define _kcb_curtcb() KCB_GET32(kcb_curtcb)
-#define _kcb_curkse() ((struct kse *)KCB_GET32(kcb_kmbx.km_udata))
-#define _kcb_get_tmbx() KCB_GET32(kcb_kmbx.km_curthread)
-#define _kcb_set_tmbx(value) KCB_SET32(kcb_kmbx.km_curthread, (void *)value)
-#define _kcb_readandclear_tmbx() KCB_READANDCLEAR32(kcb_kmbx.km_curthread)
-
-
-/*
- * The constructors.
- */
-struct tcb *_tcb_ctor(struct pthread *, int);
-void _tcb_dtor(struct tcb *tcb);
-struct kcb *_kcb_ctor(struct kse *);
-void _kcb_dtor(struct kcb *);
-
-/* Called from the KSE to set its private data. */
-static __inline void
-_kcb_set(struct kcb *kcb)
-{
- i386_set_gsbase(kcb);
-}
-
-/* Get the current kcb. */
-static __inline struct kcb *
-_kcb_get(void)
-{
- return (_kcb_curkcb());
-}
-
-static __inline struct kse_thr_mailbox *
-_kcb_critical_enter(void)
-{
- struct kse_thr_mailbox *crit;
-
- crit = _kcb_readandclear_tmbx();
- return (crit);
-}
-
-static __inline void
-_kcb_critical_leave(struct kse_thr_mailbox *crit)
-{
- _kcb_set_tmbx(crit);
-}
-
-static __inline int
-_kcb_in_critical(void)
-{
- return (_kcb_get_tmbx() == NULL);
-}
-
-static __inline void
-_tcb_set(struct kcb *kcb, struct tcb *tcb)
-{
- kcb->kcb_curtcb = tcb;
-}
-
-static __inline struct tcb *
-_tcb_get(void)
-{
- return (_kcb_curtcb());
-}
-
-static __inline struct pthread *
-_get_curthread(void)
-{
- struct tcb *tcb;
-
- tcb = _kcb_curtcb();
- if (tcb != NULL)
- return (tcb->tcb_thread);
- else
- return (NULL);
-}
-
-static __inline struct kse *
-_get_curkse(void)
-{
- return ((struct kse *)_kcb_curkse());
-}
-
-void _i386_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
- size_t stacksz);
-
-static __inline int
-_thread_enter_uts(struct tcb *tcb, struct kcb *kcb)
-{
- int ret;
-
- ret = _thr_getcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext);
- if (ret == 0) {
- _i386_enter_uts(&kcb->kcb_kmbx, kcb->kcb_kmbx.km_func,
- kcb->kcb_kmbx.km_stack.ss_sp,
- kcb->kcb_kmbx.km_stack.ss_size);
- /* We should not reach here. */
- return (-1);
- }
- else if (ret < 0)
- return (-1);
- return (0);
-}
-
-static __inline int
-_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
-{
- extern int _libkse_debug;
-
- if ((kcb == NULL) || (tcb == NULL))
- return (-1);
- kcb->kcb_curtcb = tcb;
- if (_libkse_debug == 0) {
- tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
- if (setmbox != 0)
- _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
- (intptr_t)&tcb->tcb_tmbx,
- (intptr_t *)&kcb->kcb_kmbx.km_curthread);
- else
- _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
- 0, NULL);
- } else {
- if (setmbox)
- kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
- else
- kse_switchin(&tcb->tcb_tmbx, 0);
- }
-
- /* We should not reach here. */
- return (-1);
-}
-
-#endif
diff --git a/lib/libkse/arch/ia64/Makefile.inc b/lib/libkse/arch/ia64/Makefile.inc
deleted file mode 100644
index c8b0362..0000000
--- a/lib/libkse/arch/ia64/Makefile.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-
-SRCS+= context.S enter_uts.S pthread_md.c
diff --git a/lib/libkse/arch/ia64/ia64/context.S b/lib/libkse/arch/ia64/ia64/context.S
deleted file mode 100644
index 9411293..0000000
--- a/lib/libkse/arch/ia64/ia64/context.S
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/syscall.h>
-
-#define SIZEOF_SPECIAL (18*8)
-
-/*
- * int _ia64_restore_context(mcontext_t *mc, intptr_t val, intptr_t *loc);
- */
-ENTRY(_ia64_restore_context, 3)
-{ .mmi
- invala
- mov ar.rsc=0xc
- add r32=16,r32
- ;;
-}
-{ .mmi
- loadrs
- ld8 r12=[r32] // sp
- add r31=8,r32
- ;;
-}
-{ .mii
- ld8 r16=[r31],16 // unat (before)
- add r30=16,r32
- add r14=SIZEOF_SPECIAL,r32
- ;;
-}
-{ .mmi
- ld8 r17=[r30],16 // rp
- ld8 r18=[r31],16 // pr
- mov r2=r33
- ;;
-}
-{ .mmi
- ld8 r19=[r30],16 // pfs
- ld8 r20=[r31],32 // bspstore
- mov rp=r17
- ;;
-}
-{ .mmi
- ld8 r21=[r30],32 // rnat
- ld8 r22=[r31],16 // rsc
- mov pr=r18,0x1fffe
- ;;
-}
-{ .mmi
- ld8 r23=[r30] // fpsr
- ld8 r24=[r31] // psr -- not used
- mov r3=r34
- ;;
-}
-{ .mmi
- ld8 r17=[r14],8 // unat (after)
- mov ar.bspstore=r20
- cmp.ne p15,p0=r0,r3
- ;;
-}
-{ .mmi
- mov ar.rnat=r21
- mov ar.unat=r17
- add r15=8,r14
- ;;
-}
-{ .mmi
- ld8.fill r4=[r14],16 // r4
- ld8.fill r5=[r15],16 // r5
- mov ar.pfs=r19
- ;;
-}
-{ .mmi
- ld8.fill r6=[r14],16 // r6
- ld8.fill r7=[r15],16 // r7
- nop 0
- ;;
-}
-{ .mmi
- mov ar.unat=r16
- mov ar.rsc=r22
- nop 0
-}
-{ .mmi
- ld8 r17=[r14],16 // b1
- ld8 r18=[r15],16 // b2
- nop 0
- ;;
-}
-{ .mmi
- ld8 r19=[r14],16 // b3
- ld8 r20=[r15],16 // b4
- mov b1=r17
- ;;
-}
-{ .mmi
- ld8 r16=[r14],24 // b5
- ld8 r17=[r15],32 // lc
- mov b2=r18
- ;;
-}
-{ .mmi
- ldf.fill f2=[r14],32
- ldf.fill f3=[r15],32
- mov b3=r19
- ;;
-}
-{ .mmi
- ldf.fill f4=[r14],32
- ldf.fill f5=[r15],32
- mov b4=r20
- ;;
-}
-{ .mmi
- ldf.fill f16=[r14],32
- ldf.fill f17=[r15],32
- mov b5=r16
- ;;
-}
-{ .mmi
- ldf.fill f18=[r14],32
- ldf.fill f19=[r15],32
- mov ar.lc=r17
- ;;
-}
- ldf.fill f20=[r14],32
- ldf.fill f21=[r15],32
- ;;
- ldf.fill f22=[r14],32
- ldf.fill f23=[r15],32
- ;;
- ldf.fill f24=[r14],32
- ldf.fill f25=[r15],32
- ;;
- ldf.fill f26=[r14],32
- ldf.fill f27=[r15],32
- ;;
- ldf.fill f28=[r14],32
- ldf.fill f29=[r15],32
- ;;
- ldf.fill f30=[r14],32+24
- ldf.fill f31=[r15],24+24
- ;;
- ld8 r8=[r14],16
- ld8 r9=[r15],16
- ;;
- ld8 r10=[r14]
- ld8 r11=[r15]
- ;;
-{ .mmb
-(p15) st8 [r3]=r2
- mov ar.fpsr=r23
- br.ret.sptk rp
- ;;
-}
-END(_ia64_restore_context)
-
-/*
- * int _ia64_save_context(mcontext_t *mc);
- */
-ENTRY(_ia64_save_context, 1)
-{ .mmi
- mov r14=ar.rsc
- mov r15=ar.fpsr
- add r31=8,r32
- ;;
-}
-{ .mmi
- st8 [r32]=r0,16
- st8 [r31]=r0,16
- nop 0
- ;;
-}
-{ .mmi
- mov ar.rsc=0xc
- mov r16=ar.unat
- nop 0
- ;;
-}
-{ .mmi
- flushrs
- st8 [r32]=sp,16 // sp
- mov r17=rp
- ;;
-}
-{ .mmi
- st8 [r31]=r16,16 // unat (before)
- st8 [r32]=r17,16 // rp
- mov r16=pr
- ;;
-}
-{ .mmi
- st8 [r31]=r16,16 // pr
- mov r17=ar.bsp
- mov r16=ar.pfs
- ;;
-}
-{ .mmi
- st8 [r32]=r16,16 // pfs
- st8 [r31]=r17,16 // bspstore
- nop 0
- ;;
-}
-{ .mmi
- mov r16=ar.rnat
- mov ar.rsc=r14
- add r30=SIZEOF_SPECIAL-(6*8),r32
- ;;
-}
-{ .mmi
- st8 [r32]=r16,16 // rnat
- st8 [r31]=r0,16 // __spare
- nop 0
- ;;
-}
-{ .mmi
- st8 [r32]=r13,16 // tp -- not used
- st8 [r31]=r14,16 // rsc
- mov r16=b1
- ;;
-}
-{ .mmi
- st8 [r32]=r15,10*8 // fpr
- st8 [r31]=r0,8*8 // psr
- nop 0
- ;;
-}
- /* callee_saved */
-{ .mmi
- .mem.offset 8,0
- st8.spill [r31]=r4,16 // r4
- .mem.offset 16,0
- st8.spill [r32]=r5,16 // r5
- mov r17=b2
- ;;
-}
-{ .mmi
- .mem.offset 24,0
- st8.spill [r31]=r6,16 // r6
- .mem.offset 32,0
- st8.spill [r32]=r7,16 // r7
- mov r18=b3
- ;;
-}
-{ .mmi
- st8 [r31]=r16,16 // b1
- mov r16=ar.unat
- mov r19=b4
- ;;
-}
-{ .mmi
- st8 [r30]=r16 // unat (after)
- st8 [r32]=r17,16 // b2
- mov r16=b5
- ;;
-}
-{ .mmi
- st8 [r31]=r18,16 // b3
- st8 [r32]=r19,16 // b4
- mov r17=ar.lc
- ;;
-}
- st8 [r31]=r16,16 // b5
- st8 [r32]=r17,16 // lc
- ;;
- st8 [r31]=r0,24 // __spare
- stf.spill [r32]=f2,32
- ;;
- stf.spill [r31]=f3,32
- stf.spill [r32]=f4,32
- ;;
- stf.spill [r31]=f5,32
- stf.spill [r32]=f16,32
- ;;
- stf.spill [r31]=f17,32
- stf.spill [r32]=f18,32
- ;;
- stf.spill [r31]=f19,32
- stf.spill [r32]=f20,32
- ;;
- stf.spill [r31]=f21,32
- stf.spill [r32]=f22,32
- ;;
- stf.spill [r31]=f23,32
- stf.spill [r32]=f24,32
- ;;
- stf.spill [r31]=f25,32
- stf.spill [r32]=f26,32
- ;;
- stf.spill [r31]=f27,32
- stf.spill [r32]=f28,32
- ;;
-{ .mmi
- stf.spill [r31]=f29,32
- stf.spill [r32]=f30,32+24
- add r14=1,r0
- ;;
-}
-{ .mmi
- stf.spill [r31]=f31,24+24
- st8 [r32]=r14,16 // r8
- add r8=0,r0
- ;;
-}
- st8 [r31]=r0,16 // r9
- st8 [r32]=r0 // r10
- ;;
-{ .mmb
- st8 [r31]=r0 // r11
- mf
- br.ret.sptk rp
- ;;
-}
-END(_ia64_save_context)
-
-/*
- * void _ia64_break_setcontext(mcontext_t *mc);
- */
-ENTRY(_ia64_break_setcontext, 1)
-{ .mmi
- mov r8=r32
- break 0x180000
- nop 0
- ;;
-}
-END(_ia64_break_setcontext)
diff --git a/lib/libkse/arch/ia64/ia64/enter_uts.S b/lib/libkse/arch/ia64/ia64/enter_uts.S
deleted file mode 100644
index 5df4d93..0000000
--- a/lib/libkse/arch/ia64/ia64/enter_uts.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * void _ia64_enter_uts(kse_func_t uts, struct kse_mailbox *km, void *stack,
- * size_t stacksz);
- */
-ENTRY(_ia64_enter_uts, 4)
-{ .mmi
- ld8 r14=[in0],8
- mov ar.rsc=0xc
- add r15=in2,in3
- ;;
-}
-{ .mmi
- flushrs
- ld8 r1=[in0]
- mov b7=r14
- ;;
-}
-{ .mii
- mov ar.bspstore=in2
- add sp=-16,r15
- mov rp=r14
- ;;
-}
-{ .mib
- mov ar.rsc=0xf
- mov in0=in1
- br.cond.sptk b7
- ;;
-}
-1: br.cond.sptk 1b
-END(_ia64_enter_uts)
diff --git a/lib/libkse/arch/ia64/ia64/pthread_md.c b/lib/libkse/arch/ia64/ia64/pthread_md.c
deleted file mode 100644
index 00e9a40..0000000
--- a/lib/libkse/arch/ia64/ia64/pthread_md.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * 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.
- *
- * $FreeBSD$
- */
-
-#include <stdlib.h>
-#include <strings.h>
-#include "pthread_md.h"
-
-/*
- * The constructors.
- */
-struct tcb *
-_tcb_ctor(struct pthread *thread, int initial)
-{
- struct tcb *tcb;
-
- if ((tcb = malloc(sizeof(struct tcb))) != NULL) {
- bzero(tcb, sizeof(struct tcb));
- tcb->tcb_thread = thread;
- /* Allocate TDV */
- }
- return (tcb);
-}
-
-void
-_tcb_dtor(struct tcb *tcb)
-{
- /* Free TDV */
- free(tcb);
-}
-
-struct kcb *
-_kcb_ctor(struct kse *kse)
-{
- struct kcb *kcb;
-
- if ((kcb = malloc(sizeof(struct kcb))) != NULL) {
- bzero(kcb, sizeof(struct kcb));
- kcb->kcb_faketcb.tcb_isfake = 1;
- kcb->kcb_faketcb.tcb_tmbx.tm_flags = TMF_NOUPCALL;
- kcb->kcb_curtcb = &kcb->kcb_faketcb;
- kcb->kcb_kse = kse;
- }
- return (kcb);
-}
-
-void
-_kcb_dtor(struct kcb *kcb)
-{
- free(kcb);
-}
diff --git a/lib/libkse/arch/ia64/include/atomic_ops.h b/lib/libkse/arch/ia64/include/atomic_ops.h
deleted file mode 100644
index 483c905..0000000
--- a/lib/libkse/arch/ia64/include/atomic_ops.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _ATOMIC_OPS_H_
-#define _ATOMIC_OPS_H_
-
-static inline void
-atomic_swap_int(int *dst, int val, int *res)
-{
- __asm("xchg4 %0=[%2],%1" : "=r"(*res) : "r"(val), "r"(dst));
-}
-
-static inline void
-atomic_swap_long(long *dst, long val, long *res)
-{
- __asm("xchg8 %0=[%2],%1" : "=r"(*res) : "r"(val), "r"(dst));
-}
-
-#define atomic_swap_ptr(d,v,r) \
- atomic_swap_long((long*)d, (long)v, (long*)r)
-
-#endif /* _ATOMIC_OPS_H_ */
diff --git a/lib/libkse/arch/ia64/include/pthread_md.h b/lib/libkse/arch/ia64/include/pthread_md.h
deleted file mode 100644
index 1df5046..0000000
--- a/lib/libkse/arch/ia64/include/pthread_md.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (c) 2003 Marcel Moolenaar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _PTHREAD_MD_H_
-#define _PTHREAD_MD_H_
-
-#include <sys/kse.h>
-#include <stddef.h>
-#include <ucontext.h>
-
-#define KSE_STACKSIZE 16384
-#define DTV_OFFSET offsetof(struct tcb, tcb_tp.tp_tdv)
-
-#define THR_GETCONTEXT(ucp) _ia64_save_context(&(ucp)->uc_mcontext)
-#define THR_SETCONTEXT(ucp) PANIC("THR_SETCONTEXT() now in use!\n")
-
-#define PER_THREAD
-
-struct kcb;
-struct kse;
-struct pthread;
-struct tcb;
-struct tdv; /* We don't know what this is yet? */
-
-/*
- * tp points to one of these. We define the static TLS as an array
- * of long double to enforce 16-byte alignment of the TLS memory,
- * struct ia64_tp, struct tcb and also struct kcb. Both static and
- * dynamic allocation of any of these structures will result in a
- * valid, well-aligned thread pointer.
- */
-struct ia64_tp {
- struct tdv *tp_tdv; /* dynamic TLS */
- uint64_t _reserved_;
- long double tp_tls[0]; /* static TLS */
-};
-
-struct tcb {
- struct kse_thr_mailbox tcb_tmbx;
- struct pthread *tcb_thread;
- struct kcb *tcb_curkcb;
- long tcb_isfake;
- struct ia64_tp tcb_tp;
-};
-
-struct kcb {
- struct kse_mailbox kcb_kmbx;
- struct tcb kcb_faketcb;
- struct tcb *kcb_curtcb;
- struct kse *kcb_kse;
-};
-
-register struct ia64_tp *_tp __asm("%r13");
-
-#define _tcb ((struct tcb*)((char*)(_tp) - offsetof(struct tcb, tcb_tp)))
-
-/*
- * The kcb and tcb constructors.
- */
-struct tcb *_tcb_ctor(struct pthread *, int);
-void _tcb_dtor(struct tcb *);
-struct kcb *_kcb_ctor(struct kse *kse);
-void _kcb_dtor(struct kcb *);
-
-/* Called from the KSE to set its private data. */
-static __inline void
-_kcb_set(struct kcb *kcb)
-{
- /* There is no thread yet; use the fake tcb. */
- _tp = &kcb->kcb_faketcb.tcb_tp;
-}
-
-/*
- * Get the current kcb.
- *
- * This can only be called while in a critical region; don't
- * worry about having the kcb changed out from under us.
- */
-static __inline struct kcb *
-_kcb_get(void)
-{
- return (_tcb->tcb_curkcb);
-}
-
-/*
- * Enter a critical region.
- *
- * Read and clear km_curthread in the kse mailbox.
- */
-static __inline struct kse_thr_mailbox *
-_kcb_critical_enter(void)
-{
- struct kse_thr_mailbox *crit;
- uint32_t flags;
-
- if (_tcb->tcb_isfake != 0) {
- /*
- * We already are in a critical region since
- * there is no current thread.
- */
- crit = NULL;
- } else {
- flags = _tcb->tcb_tmbx.tm_flags;
- _tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
- crit = _tcb->tcb_curkcb->kcb_kmbx.km_curthread;
- _tcb->tcb_curkcb->kcb_kmbx.km_curthread = NULL;
- _tcb->tcb_tmbx.tm_flags = flags;
- }
- return (crit);
-}
-
-static __inline void
-_kcb_critical_leave(struct kse_thr_mailbox *crit)
-{
- /* No need to do anything if this is a fake tcb. */
- if (_tcb->tcb_isfake == 0)
- _tcb->tcb_curkcb->kcb_kmbx.km_curthread = crit;
-}
-
-static __inline int
-_kcb_in_critical(void)
-{
- uint32_t flags;
- int ret;
-
- if (_tcb->tcb_isfake != 0) {
- /*
- * We are in a critical region since there is no
- * current thread.
- */
- ret = 1;
- } else {
- flags = _tcb->tcb_tmbx.tm_flags;
- _tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
- ret = (_tcb->tcb_curkcb->kcb_kmbx.km_curthread == NULL);
- _tcb->tcb_tmbx.tm_flags = flags;
- }
- return (ret);
-}
-
-static __inline void
-_tcb_set(struct kcb *kcb, struct tcb *tcb)
-{
- if (tcb == NULL)
- tcb = &kcb->kcb_faketcb;
- kcb->kcb_curtcb = tcb;
- tcb->tcb_curkcb = kcb;
- _tp = &tcb->tcb_tp;
-}
-
-static __inline struct tcb *
-_tcb_get(void)
-{
- return (_tcb);
-}
-
-static __inline struct pthread *
-_get_curthread(void)
-{
- return (_tcb->tcb_thread);
-}
-
-/*
- * Get the current kse.
- *
- * Like _kcb_get(), this can only be called while in a critical region.
- */
-static __inline struct kse *
-_get_curkse(void)
-{
- return (_tcb->tcb_curkcb->kcb_kse);
-}
-
-void _ia64_break_setcontext(mcontext_t *mc);
-void _ia64_enter_uts(kse_func_t uts, struct kse_mailbox *km, void *stack,
- size_t stacksz);
-int _ia64_restore_context(mcontext_t *mc, intptr_t val, intptr_t *loc);
-int _ia64_save_context(mcontext_t *mc);
-
-static __inline int
-_thread_enter_uts(struct tcb *tcb, struct kcb *kcb)
-{
- if (_ia64_save_context(&tcb->tcb_tmbx.tm_context.uc_mcontext) == 0) {
- /* Make the fake tcb the current thread. */
- kcb->kcb_curtcb = &kcb->kcb_faketcb;
- _tp = &kcb->kcb_faketcb.tcb_tp;
- _ia64_enter_uts(kcb->kcb_kmbx.km_func, &kcb->kcb_kmbx,
- kcb->kcb_kmbx.km_stack.ss_sp,
- kcb->kcb_kmbx.km_stack.ss_size);
- /* We should not reach here. */
- return (-1);
- }
- return (0);
-}
-
-static __inline int
-_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
-{
- mcontext_t *mc;
-
- _tcb_set(kcb, tcb);
- mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
- if (mc->mc_flags & _MC_FLAGS_ASYNC_CONTEXT) {
- if (setmbox) {
- mc->mc_flags |= _MC_FLAGS_KSE_SET_MBOX;
- mc->mc_special.ifa =
- (intptr_t)&kcb->kcb_kmbx.km_curthread;
- mc->mc_special.isr = (intptr_t)&tcb->tcb_tmbx;
- }
- _ia64_break_setcontext(mc);
- } else if (mc->mc_flags & _MC_FLAGS_SYSCALL_CONTEXT) {
- if (setmbox)
- kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
- else
- kse_switchin(&tcb->tcb_tmbx, 0);
- } else {
- if (setmbox)
- _ia64_restore_context(mc, (intptr_t)&tcb->tcb_tmbx,
- (intptr_t *)&kcb->kcb_kmbx.km_curthread);
- else
- _ia64_restore_context(mc, 0, NULL);
- }
- /* We should not reach here. */
- return (-1);
-}
-
-#endif /* _PTHREAD_MD_H_ */
diff --git a/lib/libkse/arch/powerpc/Makefile.inc b/lib/libkse/arch/powerpc/Makefile.inc
deleted file mode 100644
index f4417a6..0000000
--- a/lib/libkse/arch/powerpc/Makefile.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-# $FreeBSD$
-
-# XXX temporary
-CFLAGS+=-DSYSTEM_SCOPE_ONLY
-
-.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-
-SRCS+= enter_uts.S context.S pthread_md.c
diff --git a/lib/libkse/arch/powerpc/include/atomic_ops.h b/lib/libkse/arch/powerpc/include/atomic_ops.h
deleted file mode 100644
index 8068e6f..0000000
--- a/lib/libkse/arch/powerpc/include/atomic_ops.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2004 by Peter Grehan. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _ATOMIC_OPS_H_
-#define _ATOMIC_OPS_H_
-
-/*
- * Atomic swap:
- * Atomic (tmp = *dst, *dst = val), then *res = tmp
- *
- * void atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res);
- */
-static inline void
-atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
-{
- int tmp;
-
- tmp = 0; /* should be a better way to quieten cc1... */
-#ifdef __GNUC__
- __asm __volatile(
- "1: lwarx %0, 0, %4\n" /* load with reservation */
- " stwcx. %3, 0, %4\n" /* attempt to store val */
- " bne- 1b\n" /* interrupted? retry */
- " stw %0, %1\n" /* else, *dst -> *res */
- : "=&r" (tmp), "=m" (*res), "+m" (*dst)
- : "r" (val), "r" (dst)
- : "cc", "memory");
-#endif
-}
-
-#define atomic_swap_ptr(d, v, r) \
- atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
-
-#define atomic_swap_int(d, v, r) \
- atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
-#endif
diff --git a/lib/libkse/arch/powerpc/include/pthread_md.h b/lib/libkse/arch/powerpc/include/pthread_md.h
deleted file mode 100644
index 33a58b5..0000000
--- a/lib/libkse/arch/powerpc/include/pthread_md.h
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright 2004 by Peter Grehan. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * $FreeBSD$
- */
-
-/*
- * Machine-dependent thread prototypes/definitions for the thread kernel.
- */
-#ifndef _PTHREAD_MD_H_
-#define _PTHREAD_MD_H_
-
-#include <sys/kse.h>
-#include <stddef.h>
-#include <ucontext.h>
-
-extern void _ppc32_enter_uts(struct kse_mailbox *, kse_func_t, void *, size_t);
-extern int _ppc32_setcontext(mcontext_t *, intptr_t, intptr_t *);
-extern int _ppc32_getcontext(mcontext_t *);
-
-#define KSE_STACKSIZE 16384
-#define DTV_OFFSET offsetof(struct tcb, tcb_tp.tp_tdv)
-
-#define THR_GETCONTEXT(ucp) _ppc32_getcontext(&(ucp)->uc_mcontext)
-#define THR_SETCONTEXT(ucp) _ppc32_setcontext(&(ucp)->uc_mcontext, 0, NULL)
-
-#define PER_THREAD
-
-struct kcb;
-struct kse;
-struct pthread;
-struct tcb;
-struct tdv;
-
-/*
- * %r2 points to a struct kcb.
- */
-struct ppc32_tp {
- struct tdv *tp_tdv; /* dynamic TLS */
- uint32_t _reserved_;
- long double tp_tls[0]; /* static TLS */
-};
-
-struct tcb {
- struct kse_thr_mailbox tcb_tmbx;
- struct pthread *tcb_thread;
- struct kcb *tcb_curkcb;
- long tcb_isfake;
- struct ppc32_tp tcb_tp;
-};
-
-struct kcb {
- struct kse_mailbox kcb_kmbx;
- struct tcb kcb_faketcb;
- struct tcb *kcb_curtcb;
- struct kse *kcb_kse;
-};
-
-/*
- * From the PowerPC32 TLS spec:
- *
- * "r2 is the thread pointer, and points 0x7000 past the end of the
- * thread control block." Or, 0x7008 past the start of the 8-byte tcb
- */
-#define TP_OFFSET 0x7008
-register uint8_t *_tpr __asm("%r2");
-
-#define _tcb ((struct tcb *)(_tpr - TP_OFFSET - offsetof(struct tcb, tcb_tp)))
-
-/*
- * The kcb and tcb constructors.
- */
-struct tcb *_tcb_ctor(struct pthread *, int);
-void _tcb_dtor(struct tcb *);
-struct kcb *_kcb_ctor(struct kse *kse);
-void _kcb_dtor(struct kcb *);
-
-/* Called from the KSE to set its private data. */
-static __inline void
-_kcb_set(struct kcb *kcb)
-{
- /* There is no thread yet; use the fake tcb. */
- _tpr = (uint8_t *)&kcb->kcb_faketcb.tcb_tp + TP_OFFSET;
-}
-
-/*
- * Get the current kcb.
- *
- * This can only be called while in a critical region; don't
- * worry about having the kcb changed out from under us.
- */
-static __inline struct kcb *
-_kcb_get(void)
-{
- return (_tcb->tcb_curkcb);
-}
-
-/*
- * Enter a critical region.
- *
- * Read and clear km_curthread in the kse mailbox.
- */
-static __inline struct kse_thr_mailbox *
-_kcb_critical_enter(void)
-{
- struct kse_thr_mailbox *crit;
- uint32_t flags;
-
- if (_tcb->tcb_isfake != 0) {
- /*
- * We already are in a critical region since
- * there is no current thread.
- */
- crit = NULL;
- } else {
- flags = _tcb->tcb_tmbx.tm_flags;
- _tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
- crit = _tcb->tcb_curkcb->kcb_kmbx.km_curthread;
- _tcb->tcb_curkcb->kcb_kmbx.km_curthread = NULL;
- _tcb->tcb_tmbx.tm_flags = flags;
- }
- return (crit);
-}
-
-static __inline void
-_kcb_critical_leave(struct kse_thr_mailbox *crit)
-{
- /* No need to do anything if this is a fake tcb. */
- if (_tcb->tcb_isfake == 0)
- _tcb->tcb_curkcb->kcb_kmbx.km_curthread = crit;
-}
-
-static __inline int
-_kcb_in_critical(void)
-{
- uint32_t flags;
- int ret;
-
- if (_tcb->tcb_isfake != 0) {
- /*
- * We are in a critical region since there is no
- * current thread.
- */
- ret = 1;
- } else {
- flags = _tcb->tcb_tmbx.tm_flags;
- _tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
- ret = (_tcb->tcb_curkcb->kcb_kmbx.km_curthread == NULL);
- _tcb->tcb_tmbx.tm_flags = flags;
- }
- return (ret);
-}
-
-static __inline void
-_tcb_set(struct kcb *kcb, struct tcb *tcb)
-{
- if (tcb == NULL)
- tcb = &kcb->kcb_faketcb;
- kcb->kcb_curtcb = tcb;
- tcb->tcb_curkcb = kcb;
- _tpr = (uint8_t *)&tcb->tcb_tp + TP_OFFSET;
-}
-
-static __inline struct tcb *
-_tcb_get(void)
-{
- return (_tcb);
-}
-
-static __inline struct pthread *
-_get_curthread(void)
-{
- return (_tcb->tcb_thread);
-}
-
-/*
- * Get the current kse.
- *
- * Like _kcb_get(), this can only be called while in a critical region.
- */
-static __inline struct kse *
-_get_curkse(void)
-{
- return (_tcb->tcb_curkcb->kcb_kse);
-}
-
-static __inline int
-_thread_enter_uts(struct tcb *tcb, struct kcb *kcb)
-{
- if (_ppc32_getcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext) == 0) {
- /* Make the fake tcb the current thread. */
- kcb->kcb_curtcb = &kcb->kcb_faketcb;
- _tpr = (uint8_t *)&kcb->kcb_faketcb.tcb_tp + TP_OFFSET;
- _ppc32_enter_uts(&kcb->kcb_kmbx, kcb->kcb_kmbx.km_func,
- kcb->kcb_kmbx.km_stack.ss_sp,
- kcb->kcb_kmbx.km_stack.ss_size - 32);
- /* We should not reach here. */
- return (-1);
- }
- return (0);
-}
-
-static __inline int
-_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
-{
- mcontext_t *mc;
- extern int _libkse_debug;
-
- _tcb_set(kcb, tcb);
- mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
-
- /*
- * A full context needs a system call to restore, so use
- * kse_switchin. Otherwise, the partial context can be
- * restored with _ppc32_setcontext
- */
- if (mc->mc_vers != _MC_VERSION_KSE && _libkse_debug != 0) {
- if (setmbox)
- kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
- else
- kse_switchin(&tcb->tcb_tmbx, 0);
- } else {
- tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
- if (setmbox)
- _ppc32_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
- (intptr_t *)&kcb->kcb_kmbx.km_curthread);
- else
- _ppc32_setcontext(mc, 0, NULL);
- }
-
- /* We should not reach here. */
- return (-1);
-}
-
-#endif /* _PTHREAD_MD_H_ */
diff --git a/lib/libkse/arch/powerpc/powerpc/assym.c b/lib/libkse/arch/powerpc/powerpc/assym.c
deleted file mode 100644
index a8479e7..0000000
--- a/lib/libkse/arch/powerpc/powerpc/assym.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2004 Peter Grehan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-/* Used to generate mcontext_t offsets */
-
-#include <sys/types.h>
-#include <sys/assym.h>
-#include <sys/ucontext.h>
-
-#include <stddef.h>
-
-ASSYM(_MC_VERSION, _MC_VERSION);
-ASSYM(_MC_VERSION_KSE, _MC_VERSION_KSE);
-ASSYM(_MC_FP_VALID, _MC_FP_VALID);
-
-ASSYM(_MC_VERS, offsetof(mcontext_t, mc_vers));
-ASSYM(_MC_FLAGS, offsetof(mcontext_t, mc_flags));
-
-ASSYM(_MC_R0, offsetof(mcontext_t, mc_frame[0]));
-ASSYM(_MC_R1, offsetof(mcontext_t, mc_frame[1]));
-ASSYM(_MC_R2, offsetof(mcontext_t, mc_frame[2]));
-ASSYM(_MC_R3, offsetof(mcontext_t, mc_frame[3]));
-ASSYM(_MC_R4, offsetof(mcontext_t, mc_frame[4]));
-ASSYM(_MC_R5, offsetof(mcontext_t, mc_frame[5]));
-ASSYM(_MC_R6, offsetof(mcontext_t, mc_frame[6]));
-ASSYM(_MC_R7, offsetof(mcontext_t, mc_frame[7]));
-ASSYM(_MC_R8, offsetof(mcontext_t, mc_frame[8]));
-ASSYM(_MC_R9, offsetof(mcontext_t, mc_frame[9]));
-ASSYM(_MC_R10, offsetof(mcontext_t, mc_frame[10]));
-ASSYM(_MC_R11, offsetof(mcontext_t, mc_frame[11]));
-ASSYM(_MC_R12, offsetof(mcontext_t, mc_frame[12]));
-ASSYM(_MC_R13, offsetof(mcontext_t, mc_frame[13]));
-ASSYM(_MC_R14, offsetof(mcontext_t, mc_frame[14]));
-ASSYM(_MC_R15, offsetof(mcontext_t, mc_frame[15]));
-ASSYM(_MC_R16, offsetof(mcontext_t, mc_frame[16]));
-ASSYM(_MC_R17, offsetof(mcontext_t, mc_frame[17]));
-ASSYM(_MC_R18, offsetof(mcontext_t, mc_frame[18]));
-ASSYM(_MC_R19, offsetof(mcontext_t, mc_frame[19]));
-ASSYM(_MC_R20, offsetof(mcontext_t, mc_frame[20]));
-ASSYM(_MC_R21, offsetof(mcontext_t, mc_frame[21]));
-ASSYM(_MC_R22, offsetof(mcontext_t, mc_frame[22]));
-ASSYM(_MC_R23, offsetof(mcontext_t, mc_frame[23]));
-ASSYM(_MC_R24, offsetof(mcontext_t, mc_frame[24]));
-ASSYM(_MC_R25, offsetof(mcontext_t, mc_frame[25]));
-ASSYM(_MC_R26, offsetof(mcontext_t, mc_frame[26]));
-ASSYM(_MC_R27, offsetof(mcontext_t, mc_frame[27]));
-ASSYM(_MC_R28, offsetof(mcontext_t, mc_frame[28]));
-ASSYM(_MC_R29, offsetof(mcontext_t, mc_frame[29]));
-ASSYM(_MC_R30, offsetof(mcontext_t, mc_frame[30]));
-ASSYM(_MC_R31, offsetof(mcontext_t, mc_frame[31]));
-ASSYM(_MC_LR, offsetof(mcontext_t, mc_frame[32]));
-ASSYM(_MC_CR, offsetof(mcontext_t, mc_frame[33]));
-ASSYM(_MC_XER, offsetof(mcontext_t, mc_frame[34]));
-ASSYM(_MC_CTR, offsetof(mcontext_t, mc_frame[35]));
-
-ASSYM(_MC_FPSCR, offsetof(mcontext_t, mc_fpreg[32]));
-ASSYM(_MC_F0, offsetof(mcontext_t, mc_fpreg[0]));
-ASSYM(_MC_F1, offsetof(mcontext_t, mc_fpreg[1]));
-ASSYM(_MC_F2, offsetof(mcontext_t, mc_fpreg[2]));
-ASSYM(_MC_F3, offsetof(mcontext_t, mc_fpreg[3]));
-ASSYM(_MC_F4, offsetof(mcontext_t, mc_fpreg[4]));
-ASSYM(_MC_F5, offsetof(mcontext_t, mc_fpreg[5]));
-ASSYM(_MC_F6, offsetof(mcontext_t, mc_fpreg[6]));
-ASSYM(_MC_F7, offsetof(mcontext_t, mc_fpreg[7]));
-ASSYM(_MC_F8, offsetof(mcontext_t, mc_fpreg[8]));
-ASSYM(_MC_F9, offsetof(mcontext_t, mc_fpreg[9]));
-ASSYM(_MC_F10, offsetof(mcontext_t, mc_fpreg[10]));
-ASSYM(_MC_F11, offsetof(mcontext_t, mc_fpreg[11]));
-ASSYM(_MC_F12, offsetof(mcontext_t, mc_fpreg[12]));
-ASSYM(_MC_F13, offsetof(mcontext_t, mc_fpreg[13]));
-ASSYM(_MC_F14, offsetof(mcontext_t, mc_fpreg[14]));
-ASSYM(_MC_F15, offsetof(mcontext_t, mc_fpreg[15]));
-ASSYM(_MC_F16, offsetof(mcontext_t, mc_fpreg[16]));
-ASSYM(_MC_F17, offsetof(mcontext_t, mc_fpreg[17]));
-ASSYM(_MC_F18, offsetof(mcontext_t, mc_fpreg[18]));
-ASSYM(_MC_F19, offsetof(mcontext_t, mc_fpreg[19]));
-ASSYM(_MC_F20, offsetof(mcontext_t, mc_fpreg[20]));
-ASSYM(_MC_F21, offsetof(mcontext_t, mc_fpreg[21]));
-ASSYM(_MC_F22, offsetof(mcontext_t, mc_fpreg[22]));
-ASSYM(_MC_F23, offsetof(mcontext_t, mc_fpreg[23]));
-ASSYM(_MC_F24, offsetof(mcontext_t, mc_fpreg[24]));
-ASSYM(_MC_F25, offsetof(mcontext_t, mc_fpreg[25]));
-ASSYM(_MC_F26, offsetof(mcontext_t, mc_fpreg[26]));
-ASSYM(_MC_F27, offsetof(mcontext_t, mc_fpreg[27]));
-ASSYM(_MC_F28, offsetof(mcontext_t, mc_fpreg[28]));
-ASSYM(_MC_F29, offsetof(mcontext_t, mc_fpreg[29]));
-ASSYM(_MC_F30, offsetof(mcontext_t, mc_fpreg[30]));
-ASSYM(_MC_F31, offsetof(mcontext_t, mc_fpreg[31]));
diff --git a/lib/libkse/arch/powerpc/powerpc/assym.s b/lib/libkse/arch/powerpc/powerpc/assym.s
deleted file mode 100644
index 7017c15..0000000
--- a/lib/libkse/arch/powerpc/powerpc/assym.s
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2004 Peter Grehan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-/*
- * Struct offsets for version 0x1 of the mcontext struct.
- * Generated with
- * cc -c assym.c
- * ${SYSSRC}/kern/genassym.sh assym.o > assym_syms.s
- * hand-edit output
- */
-#define _MC_VERSION 0x1
-#define _MC_VERSION_KSE 0xee
-#define _MC_FP_VALID 0x1
-
-#define _MC_VERS 0x0
-#define _MC_FLAGS 0x4
-
-#define _MC_R0 0x298
-#define _MC_R1 0x21c
-#define _MC_R2 0x220
-#define _MC_R3 0x224
-#define _MC_R4 0x228
-#define _MC_R5 0x22c
-#define _MC_R6 0x230
-#define _MC_R7 0x234
-#define _MC_R8 0x238
-#define _MC_R9 0x23c
-#define _MC_R10 0x240
-#define _MC_R11 0x244
-#define _MC_R12 0x248
-#define _MC_R13 0x24c
-#define _MC_R14 0x250
-#define _MC_R15 0x254
-#define _MC_R16 0x258
-#define _MC_R17 0x25c
-#define _MC_R18 0x260
-#define _MC_R19 0x264
-#define _MC_R20 0x268
-#define _MC_R21 0x26c
-#define _MC_R22 0x270
-#define _MC_R23 0x274
-#define _MC_R24 0x278
-#define _MC_R25 0x27c
-#define _MC_R26 0x280
-#define _MC_R27 0x284
-#define _MC_R28 0x288
-#define _MC_R29 0x28c
-#define _MC_R30 0x290
-#define _MC_R31 0x294
-#define _MC_LR 0x298
-#define _MC_CR 0x29c
-#define _MC_XER 0x2a0
-#define _MC_CTR 0x2a4
-
-#define _MC_FPSCR 0x3c0
-#define _MC_F0 0x2c0
-#define _MC_F1 0x2c8
-#define _MC_F2 0x2d0
-#define _MC_F3 0x2d8
-#define _MC_F4 0x2e0
-#define _MC_F5 0x2e8
-#define _MC_F6 0x2f0
-#define _MC_F7 0x2f8
-#define _MC_F8 0x300
-#define _MC_F9 0x308
-#define _MC_F10 0x310
-#define _MC_F11 0x318
-#define _MC_F12 0x320
-#define _MC_F13 0x328
-#define _MC_F14 0x330
-#define _MC_F15 0x338
-#define _MC_F16 0x340
-#define _MC_F17 0x348
-#define _MC_F18 0x350
-#define _MC_F19 0x358
-#define _MC_F20 0x360
-#define _MC_F21 0x368
-#define _MC_F22 0x370
-#define _MC_F23 0x378
-#define _MC_F24 0x380
-#define _MC_F25 0x388
-#define _MC_F26 0x390
-#define _MC_F27 0x398
-#define _MC_F28 0x3a0
-#define _MC_F29 0x3a8
-#define _MC_F30 0x3b0
-#define _MC_F31 0x3b8
-
diff --git a/lib/libkse/arch/powerpc/powerpc/context.S b/lib/libkse/arch/powerpc/powerpc/context.S
deleted file mode 100644
index 34d175a..0000000
--- a/lib/libkse/arch/powerpc/powerpc/context.S
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2004 Peter Grehan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "assym.s"
-
-/*
- * int _ppc32_getcontext(mcontext_t *mcp)
- *
- * Save register state from a voluntary context switch.
- * Only volatile registers, and those needed to complete
- * a setcontext call, need to be saved.
- *
- * r1
- * r14-31
- * f14-31 XXX
- * lr
- *
- * Return 0 for this call, and set up the context so it will return
- * 1 when restored with _ppc32_setcontext().
- *
- * XXX XXX
- * Floating-point is a big issue. Since there's no way to determine
- * if the caller has used FP, all volatile register need to be saved.
- * If FP hasn't been used, this results in a lazy FP exception in
- * the kernel and from that point on FP is always switched in/out
- * for the thread, which may be a big performance drag for the system.
- * An alternative is to use a system call to get the context, which
- * will do the right thing for floating point, but will save all
- * registers rather than the caller-saved subset, and has the overhead
- * of a syscall.
- * Maybe another option would be to give a light-weight way for a
- * thread to determine if FP is in used: perhaps a syscall that
- * returns in the asm traphandler, or an OSX-style read-only page
- * with a flag to indicate FP state.
- *
- * For now, punt the issue ala Alpha 1:1 model and fix in the future.
- */
-ENTRY(_ppc32_getcontext)
- stw %r1, _MC_R1(%r3)
- stw %r13, _MC_R13(%r3)
- stw %r14, _MC_R14(%r3)
- stw %r15, _MC_R15(%r3)
- stw %r16, _MC_R16(%r3)
- stw %r17, _MC_R17(%r3)
- stw %r18, _MC_R18(%r3)
- stw %r19, _MC_R19(%r3)
- stw %r20, _MC_R20(%r3)
- stw %r21, _MC_R21(%r3)
- stw %r22, _MC_R22(%r3)
- stw %r23, _MC_R23(%r3)
- stw %r24, _MC_R24(%r3)
- stw %r25, _MC_R25(%r3)
- stw %r26, _MC_R26(%r3)
- stw %r27, _MC_R27(%r3)
- stw %r28, _MC_R28(%r3)
- stw %r29, _MC_R28(%r3)
- stw %r30, _MC_R30(%r3)
- stw %r31, _MC_R31(%r3)
- mflr %r4
- stw %r4, _MC_LR(%r3)
- mfcr %r4
- stw %r4, _MC_CR(%r3)
-
- /* XXX f14-31 ? */
-
- li %r4, _MC_VERSION_KSE /* partial ucontext version */
- stw %r4, _MC_VERS(%r3)
-
- /* Return 0 */
- li %r3, 0
- blr
-
-/*
- * int _ppc32_setcontext(const mcontext_t *mcp, intptr_t val,
- * intptr_t *loc);
- *
- * Should only be called for partial KSE contexts. The full context
- * case is handled by kse_switchin() in _thread_switch()
- *
- * Returns -1 on error and 1 for return from a saved context
- */
-
-ENTRY(_ppc32_setcontext)
- lwz %r6, _MC_VERS(%r3)
- cmpwi %r6, _MC_VERSION_KSE /* KSE partial context ? */
- beq 1f
- li %r3, -1 /* invalid context type, return -1 */
- blr
-
-1: /* partial format, callee-saved regs assumed */
- lwz %r1, _MC_R1(%r3)
- lwz %r13, _MC_R13(%r3)
- lwz %r14, _MC_R14(%r3)
- lwz %r15, _MC_R15(%r3)
- lwz %r16, _MC_R16(%r3)
- lwz %r17, _MC_R17(%r3)
- lwz %r18, _MC_R18(%r3)
- lwz %r19, _MC_R19(%r3)
- lwz %r20, _MC_R20(%r3)
- lwz %r21, _MC_R21(%r3)
- lwz %r22, _MC_R22(%r3)
- lwz %r23, _MC_R23(%r3)
- lwz %r24, _MC_R24(%r3)
- lwz %r25, _MC_R25(%r3)
- lwz %r26, _MC_R26(%r3)
- lwz %r27, _MC_R27(%r3)
- lwz %r28, _MC_R28(%r3)
- lwz %r29, _MC_R28(%r3)
- lwz %r30, _MC_R30(%r3)
- lwz %r31, _MC_R31(%r3)
- lwz %r6, _MC_LR(%r3)
- mtlr %r6
- lwz %r6, _MC_CR(%r3)
- mtcr %r6
-
- /* XXX f14-31 ? */
-
- /* if (loc != NULL) *loc = val */
- cmpwi %r5, 0
- beq 2f
- stw %r4, 0(%r5)
-
- /* Return 1 */
-2: li %r3, 1
- blr
diff --git a/lib/libkse/arch/powerpc/powerpc/enter_uts.S b/lib/libkse/arch/powerpc/powerpc/enter_uts.S
deleted file mode 100644
index 7cc4d7f..0000000
--- a/lib/libkse/arch/powerpc/powerpc/enter_uts.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2004 Peter Grehan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * _ppc32_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack,
- * long stacksz);
- *
- * Call (*uts)(km) on the requested stack. This function doesn't
- * return. The km parameter stays in %r3.
- */
-ENTRY(_ppc32_enter_uts)
- add %r1,%r5,%r6 /* new stack = stack + stacksz */
- mtlr %r4 /* link register = uts */
- blrl /* (*uts)(km) */
diff --git a/lib/libkse/arch/powerpc/powerpc/pthread_md.c b/lib/libkse/arch/powerpc/powerpc/pthread_md.c
deleted file mode 100644
index c8445b1..0000000
--- a/lib/libkse/arch/powerpc/powerpc/pthread_md.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stdlib.h>
-#include <strings.h>
-#include "pthread_md.h"
-
-/*
- * The constructors.
- */
-struct tcb *
-_tcb_ctor(struct pthread *thread, int initial)
-{
- struct tcb *tcb;
-
- if ((tcb = malloc(sizeof(struct tcb))) != NULL) {
- bzero(tcb, sizeof(struct tcb));
- tcb->tcb_thread = thread;
- /* Allocate TDV */
- }
- return (tcb);
-}
-
-void
-_tcb_dtor(struct tcb *tcb)
-{
- /* Free TDV */
- free(tcb);
-}
-
-struct kcb *
-_kcb_ctor(struct kse *kse)
-{
- struct kcb *kcb;
-
- if ((kcb = malloc(sizeof(struct kcb))) != NULL) {
- bzero(kcb, sizeof(struct kcb));
- kcb->kcb_faketcb.tcb_isfake = 1;
- kcb->kcb_faketcb.tcb_tmbx.tm_flags = TMF_NOUPCALL;
- kcb->kcb_curtcb = &kcb->kcb_faketcb;
- kcb->kcb_kse = kse;
- }
- return (kcb);
-}
-
-void
-_kcb_dtor(struct kcb *kcb)
-{
- free(kcb);
-}
diff --git a/lib/libkse/arch/sparc64/Makefile.inc b/lib/libkse/arch/sparc64/Makefile.inc
deleted file mode 100644
index 07107b4..0000000
--- a/lib/libkse/arch/sparc64/Makefile.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-
-SRCS+= pthread_md.c thr_getcontext.S
diff --git a/lib/libkse/arch/sparc64/include/atomic_ops.h b/lib/libkse/arch/sparc64/include/atomic_ops.h
deleted file mode 100644
index 4f4d8af..0000000
--- a/lib/libkse/arch/sparc64/include/atomic_ops.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * Copyright (c) 2003 Jake Burkholder <jake@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _ATOMIC_OPS_H_
-#define _ATOMIC_OPS_H_
-
-#include <machine/atomic.h>
-
-/*
- * Atomic swap:
- * Atomic (tmp = *dst, *dst = val), then *res = tmp
- *
- * void atomic_swap_long(long *dst, long val, long *res);
- */
-static __inline void
-atomic_swap_long(long *dst, long val, long *res)
-{
- long tmp;
- long r;
-
- tmp = *dst;
- for (;;) {
- r = atomic_cas_64(dst, tmp, val);
- if (r == tmp)
- break;
- tmp = r;
- }
- *res = tmp;
-}
-
-static __inline void
-atomic_swap_int(int *dst, int val, int *res)
-{
- int tmp;
- int r;
-
- tmp = *dst;
- for (;;) {
- r = atomic_cas_32(dst, tmp, val);
- if (r == tmp)
- break;
- tmp = r;
- }
- *res = tmp;
-}
-
-#define atomic_swap_ptr(dst, val, res) \
- atomic_swap_long((long *)dst, (long)val, (long *)res)
-
-#endif
diff --git a/lib/libkse/arch/sparc64/include/pthread_md.h b/lib/libkse/arch/sparc64/include/pthread_md.h
deleted file mode 100644
index fac62c2..0000000
--- a/lib/libkse/arch/sparc64/include/pthread_md.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*-
- * Copyright (c) 2003 Jake Burkholder <jake@freebsd.org>.
- * Copyright (c) 2003 Marcel Moolenaar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-/*
- * Machine-dependent thread prototypes/definitions for the thread kernel.
- */
-#ifndef _PTHREAD_MD_H_
-#define _PTHREAD_MD_H_
-
-#include <sys/kse.h>
-#include <stddef.h>
-#include <ucontext.h>
-
-#define KSE_STACKSIZE 16384
-#define DTV_OFFSET offsetof(struct tcb, tcb_tp.tp_tdv)
-
-int _thr_setcontext(mcontext_t *, intptr_t, intptr_t *);
-int _thr_getcontext(mcontext_t *);
-
-#define THR_GETCONTEXT(ucp) _thr_getcontext(&(ucp)->uc_mcontext)
-#define THR_SETCONTEXT(ucp) _thr_setcontext(&(ucp)->uc_mcontext, 0, NULL)
-
-#define PER_THREAD
-
-struct kcb;
-struct kse;
-struct pthread;
-struct tcb;
-struct tdv; /* We don't know what this is yet? */
-
-
-/*
- * %g6 points to one of these. We define the static TLS as an array
- * of long double to enforce 16-byte alignment of the TLS memory.
- *
- * XXX - Both static and dynamic allocation of any of these structures
- * will result in a valid, well-aligned thread pointer???
- */
-struct sparc64_tp {
- struct tdv *tp_tdv; /* dynamic TLS */
- uint64_t _reserved_;
- long double tp_tls[0]; /* static TLS */
-};
-
-struct tcb {
- struct pthread *tcb_thread;
- void *tcb_addr; /* allocated tcb address */
- struct kcb *tcb_curkcb;
- uint64_t tcb_isfake;
- uint64_t tcb_spare[4];
- struct kse_thr_mailbox tcb_tmbx; /* needs 64-byte alignment */
- struct sparc64_tp tcb_tp;
-} __aligned(64);
-
-struct kcb {
- struct kse_mailbox kcb_kmbx;
- struct tcb kcb_faketcb;
- struct tcb *kcb_curtcb;
- struct kse *kcb_kse;
-};
-
-register struct sparc64_tp *_tp __asm("%g6");
-
-#define _tcb ((struct tcb*)((char*)(_tp) - offsetof(struct tcb, tcb_tp)))
-
-/*
- * The kcb and tcb constructors.
- */
-struct tcb *_tcb_ctor(struct pthread *, int);
-void _tcb_dtor(struct tcb *);
-struct kcb *_kcb_ctor(struct kse *kse);
-void _kcb_dtor(struct kcb *);
-
-/* Called from the KSE to set its private data. */
-static __inline void
-_kcb_set(struct kcb *kcb)
-{
- /* There is no thread yet; use the fake tcb. */
- _tp = &kcb->kcb_faketcb.tcb_tp;
-}
-
-/*
- * Get the current kcb.
- *
- * This can only be called while in a critical region; don't
- * worry about having the kcb changed out from under us.
- */
-static __inline struct kcb *
-_kcb_get(void)
-{
- return (_tcb->tcb_curkcb);
-}
-
-/*
- * Enter a critical region.
- *
- * Read and clear km_curthread in the kse mailbox.
- */
-static __inline struct kse_thr_mailbox *
-_kcb_critical_enter(void)
-{
- struct kse_thr_mailbox *crit;
- uint32_t flags;
-
- if (_tcb->tcb_isfake != 0) {
- /*
- * We already are in a critical region since
- * there is no current thread.
- */
- crit = NULL;
- } else {
- flags = _tcb->tcb_tmbx.tm_flags;
- _tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
- crit = _tcb->tcb_curkcb->kcb_kmbx.km_curthread;
- _tcb->tcb_curkcb->kcb_kmbx.km_curthread = NULL;
- _tcb->tcb_tmbx.tm_flags = flags;
- }
- return (crit);
-}
-
-static __inline void
-_kcb_critical_leave(struct kse_thr_mailbox *crit)
-{
- /* No need to do anything if this is a fake tcb. */
- if (_tcb->tcb_isfake == 0)
- _tcb->tcb_curkcb->kcb_kmbx.km_curthread = crit;
-}
-
-static __inline int
-_kcb_in_critical(void)
-{
- uint32_t flags;
- int ret;
-
- if (_tcb->tcb_isfake != 0) {
- /*
- * We are in a critical region since there is no
- * current thread.
- */
- ret = 1;
- } else {
- flags = _tcb->tcb_tmbx.tm_flags;
- _tcb->tcb_tmbx.tm_flags |= TMF_NOUPCALL;
- ret = (_tcb->tcb_curkcb->kcb_kmbx.km_curthread == NULL);
- _tcb->tcb_tmbx.tm_flags = flags;
- }
- return (ret);
-}
-
-static __inline void
-_tcb_set(struct kcb *kcb, struct tcb *tcb)
-{
- if (tcb == NULL)
- tcb = &kcb->kcb_faketcb;
- kcb->kcb_curtcb = tcb;
- tcb->tcb_curkcb = kcb;
- _tp = &tcb->tcb_tp;
-}
-
-static __inline struct tcb *
-_tcb_get(void)
-{
- return (_tcb);
-}
-
-static __inline struct pthread *
-_get_curthread(void)
-{
- return (_tcb->tcb_thread);
-}
-
-/*
- * Get the current kse.
- *
- * Like _kcb_get(), this can only be called while in a critical region.
- */
-static __inline struct kse *
-_get_curkse(void)
-{
- return (_tcb->tcb_curkcb->kcb_kse);
-}
-
-void _sparc64_enter_uts(kse_func_t uts, struct kse_mailbox *km, void *stack,
- size_t stacksz);
-
-static __inline int
-_thread_enter_uts(struct tcb *tcb, struct kcb *kcb)
-{
- if (_thr_getcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext) == 0) {
- /* Make the fake tcb the current thread. */
- kcb->kcb_curtcb = &kcb->kcb_faketcb;
- _tp = &kcb->kcb_faketcb.tcb_tp;
- _sparc64_enter_uts(kcb->kcb_kmbx.km_func, &kcb->kcb_kmbx,
- kcb->kcb_kmbx.km_stack.ss_sp,
- kcb->kcb_kmbx.km_stack.ss_size);
- /* We should not reach here. */
- return (-1);
- }
- return (0);
-}
-
-static __inline int
-_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
-{
- extern int _libkse_debug;
- mcontext_t *mc;
-
- _tcb_set(kcb, tcb);
- mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
- if (_libkse_debug == 0) {
- tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
- if (setmbox)
- _thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
- (intptr_t *)&kcb->kcb_kmbx.km_curthread);
- else
- _thr_setcontext(mc, 0, NULL);
- } else {
- if (setmbox)
- kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
- else
- kse_switchin(&tcb->tcb_tmbx, 0);
- }
-
- /* We should not reach here. */
- return (-1);
-}
-
-#endif /* _PTHREAD_MD_H_ */
diff --git a/lib/libkse/arch/sparc64/sparc64/assym.s b/lib/libkse/arch/sparc64/sparc64/assym.s
deleted file mode 100644
index 3e22c9f..0000000
--- a/lib/libkse/arch/sparc64/sparc64/assym.s
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Offsets into structures used from asm. Must be kept in sync with
- * appropriate headers.
- *
- * $FreeBSD$
- */
-
-#define UC_MCONTEXT 0x40
-
-#define MC_FLAGS 0x0
-#define MC_VALID_FLAGS 0x1
-#define MC_GLOBAL 0x0
-#define MC_OUT 0x40
-#define MC_TPC 0xc8
-#define MC_TNPC 0xc0
diff --git a/lib/libkse/arch/sparc64/sparc64/pthread_md.c b/lib/libkse/arch/sparc64/sparc64/pthread_md.c
deleted file mode 100644
index d6bf95d..0000000
--- a/lib/libkse/arch/sparc64/sparc64/pthread_md.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * Copyright (C) 2003 Jake Burkholder <jake@freebsd.org>
- * Copyright (C) 2003 David Xu <davidxu@freebsd.org>
- * Copyright (c) 2001,2003 Daniel Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ucontext.h>
-
-#include "pthread_md.h"
-
-struct tcb *
-_tcb_ctor(struct pthread *thread, int initial)
-{
- struct tcb *tcb;
- void *addr;
-
- addr = malloc(sizeof(struct tcb) + 63);
- if (addr == NULL)
- tcb = NULL;
- else {
- tcb = (struct tcb *)(((uintptr_t)(addr) + 63) & ~63);
- bzero(tcb, sizeof(struct tcb));
- tcb->tcb_addr = addr;
- tcb->tcb_thread = thread;
- /* XXX - Allocate tdv/tls */
- }
- return (tcb);
-}
-
-void
-_tcb_dtor(struct tcb *tcb)
-{
- void *addr;
-
- addr = tcb->tcb_addr;
- tcb->tcb_addr = NULL;
- free(addr);
-}
-
-struct kcb *
-_kcb_ctor(struct kse *kse)
-{
- struct kcb *kcb;
-
- kcb = malloc(sizeof(struct kcb));
- if (kcb != NULL) {
- bzero(kcb, sizeof(struct kcb));
- kcb->kcb_faketcb.tcb_isfake = 1;
- kcb->kcb_faketcb.tcb_tmbx.tm_flags = TMF_NOUPCALL;
- kcb->kcb_curtcb = &kcb->kcb_faketcb;
- kcb->kcb_kse = kse;
- }
- return (kcb);
-}
-
-void
-_kcb_dtor(struct kcb *kcb)
-{
- free(kcb);
-}
diff --git a/lib/libkse/arch/sparc64/sparc64/thr_getcontext.S b/lib/libkse/arch/sparc64/sparc64/thr_getcontext.S
deleted file mode 100644
index ca6473a..0000000
--- a/lib/libkse/arch/sparc64/sparc64/thr_getcontext.S
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * Copyright (C) 2003 Jake Burkholder <jake@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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 <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "assym.s"
-
- .weak CNAME(_thr_getcontext)
- .set CNAME(_thr_getcontext),CNAME(__thr_getcontext)
-ENTRY(__thr_getcontext)
- add %o7, 8, %o1
- add %o1, 4, %o2
- stx %sp, [%o0 + MC_OUT + (6 * 8)]
- stx %o1, [%o0 + MC_TPC]
- stx %o2, [%o0 + MC_TNPC]
- mov MC_VALID_FLAGS, %l0 /* Validate the context. */
- stx %l0, [%o0 + MC_FLAGS]
- mov 1, %l0
- stx %l0, [%o0 + MC_OUT + (0 * 8)] /* return 1 when resumed */
- retl
- mov 0, %o0 /* return 0 */
-END(__thr_getcontext)
-
- .weak CNAME(_thr_setcontext)
- .set CNAME(_thr_setcontext),CNAME(__thr_setcontext)
-ENTRY(__thr_setcontext)
- save %sp, -CCFSZ, %sp
- flushw
- mov %i0, %l0
- mov %i1, %l1
- mov %i2, %l2
- ldx [%l0 + MC_GLOBAL + (1 * 8)], %g1
- ldx [%l0 + MC_GLOBAL + (2 * 8)], %g2
- ldx [%l0 + MC_GLOBAL + (3 * 8)], %g3
- ldx [%l0 + MC_GLOBAL + (4 * 8)], %g4
- ldx [%l0 + MC_GLOBAL + (5 * 8)], %g5
- ldx [%l0 + MC_GLOBAL + (6 * 8)], %g6
- ldx [%l0 + MC_GLOBAL + (7 * 8)], %g7
- ldx [%l0 + MC_OUT + (0 * 8)], %i0
- ldx [%l0 + MC_OUT + (1 * 8)], %i1
- ldx [%l0 + MC_OUT + (2 * 8)], %i2
- ldx [%l0 + MC_OUT + (3 * 8)], %i3
- ldx [%l0 + MC_OUT + (4 * 8)], %i4
- ldx [%l0 + MC_OUT + (5 * 8)], %i5
- ldx [%l0 + MC_OUT + (6 * 8)], %i6
- ldx [%l0 + MC_OUT + (7 * 8)], %i7
- ldx [%l0 + MC_TPC], %l4
- ldx [%l0 + MC_TNPC], %l3
- brz %l2, 1f
- nop
- stx %l1, [%l2]
-1: jmpl %l3, %g0
- return %l4
-END(__thr_setcontext)
-
-ENTRY(_sparc64_enter_uts)
- save %sp, -CCFSZ, %sp
- flushw
- add %i2, %i3, %i2
- sub %i2, SPOFF + CCFSZ, %sp
- jmpl %i0, %g0
- mov %i1, %o0
-END(_sparc64_enter_uts)
diff --git a/lib/libkse/support/Makefile.inc b/lib/libkse/support/Makefile.inc
deleted file mode 100644
index 956667f..0000000
--- a/lib/libkse/support/Makefile.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/support ${.CURDIR}/../libc/gen ${.CURDIR}/../libc/string
-.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/sys
-
-CFLAGS+= -I${.CURDIR}/../libc/${MACHINE_ARCH}
-
-SYSCALLS= clock_gettime \
- kse_create \
- kse_exit \
- kse_release \
- kse_switchin \
- kse_thr_interrupt \
- kse_wakeup \
- sigaction \
- sigprocmask \
- sigtimedwait \
- write
-
-SYSCALL_SRC= ${SYSCALLS:S/$/.S/}
-SYSCALL_OBJ= ${SYSCALLS:S/$/.So/}
-
-${SYSCALL_SRC}:
- printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' > ${.TARGET}
-
-LIBC_OBJS= sigsetops.So \
- bcopy.So \
- bzero.So \
- cerror.So \
- memcpy.So \
- memset.So \
- strcpy.So \
- strlen.So
-
-SOBJS+= thr_libc.So
-CLEANFILES+= ${SYSCALL_SRC} ${SYSCALL_OBJ} ${LIBC_OBJS}
-
-thr_libc.So: ${SYSCALL_OBJ} ${LIBC_OBJS}
- ${CC} -fPIC -nostdlib -o ${.TARGET} -r ${.ALLSRC}
-
diff --git a/lib/libkse/support/thr_support.c b/lib/libkse/support/thr_support.c
deleted file mode 100644
index 2956e07..0000000
--- a/lib/libkse/support/thr_support.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright 2003 Alexander Kabaev.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/kse.h>
-#include <signal.h>
-#include <string.h>
-
-#include "thr_private.h"
-
-__strong_reference(clock_gettime, _thr_clock_gettime);
-__strong_reference(kse_exit, _thr_kse_exit);
-__strong_reference(kse_wakeup, _thr_kse_wakeup);
-__strong_reference(kse_create, _thr_kse_create);
-__strong_reference(kse_thr_interrupt, _thr_kse_thr_interrupt);
-__strong_reference(kse_release, _thr_kse_release);
-__strong_reference(kse_switchin, _thr_kse_switchin);
-
-__strong_reference(sigaction, _thr_sigaction);
-__strong_reference(sigprocmask, _thr_sigprocmask);
-__strong_reference(sigemptyset, _thr_sigemptyset);
-__strong_reference(sigaddset, _thr_sigaddset);
-__strong_reference(sigfillset, _thr_sigfillset);
-__strong_reference(sigismember, _thr_sigismember);
-__strong_reference(sigdelset, _thr_sigdelset);
-
-__strong_reference(memset, _thr_memset);
-__strong_reference(memcpy, _thr_memcpy);
-__strong_reference(strcpy, _thr_strcpy);
-__strong_reference(strlen, _thr_strlen);
-__strong_reference(bzero, _thr_bzero);
-__strong_reference(bcopy, _thr_bcopy);
-
-__strong_reference(__sys_write, _thr__sys_write);
-__strong_reference(__sys_sigtimedwait, _thr__sys_sigtimedwait);
-
diff --git a/lib/libkse/sys/Makefile.inc b/lib/libkse/sys/Makefile.inc
deleted file mode 100644
index fb4a108..0000000
--- a/lib/libkse/sys/Makefile.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/sys
-
-SRCS+= lock.c thr_error.c
diff --git a/lib/libkse/sys/lock.c b/lib/libkse/sys/lock.c
deleted file mode 100644
index 0f0f5f9..0000000
--- a/lib/libkse/sys/lock.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*-
- * Copyright (c) 2001, 2003 Daniel Eischen <deischen@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#include <sys/types.h>
-#include <machine/atomic.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include "atomic_ops.h"
-#include "lock.h"
-
-#ifdef _LOCK_DEBUG
-#define LCK_ASSERT(e) assert(e)
-#else
-#define LCK_ASSERT(e)
-#endif
-
-#define MAX_SPINS 500
-
-void
-_lock_destroy(struct lock *lck)
-{
- if ((lck != NULL) && (lck->l_head != NULL)) {
- free(lck->l_head);
- lck->l_head = NULL;
- lck->l_tail = NULL;
- }
-}
-
-int
-_lock_init(struct lock *lck, enum lock_type ltype,
- lock_handler_t *waitfunc, lock_handler_t *wakeupfunc)
-{
- if (lck == NULL)
- return (-1);
- else if ((lck->l_head = malloc(sizeof(struct lockreq))) == NULL)
- return (-1);
- else {
- lck->l_type = ltype;
- lck->l_wait = waitfunc;
- lck->l_wakeup = wakeupfunc;
- lck->l_head->lr_locked = 0;
- lck->l_head->lr_watcher = NULL;
- lck->l_head->lr_owner = NULL;
- lck->l_head->lr_active = 1;
- lck->l_tail = lck->l_head;
- }
- return (0);
-}
-
-int
-_lock_reinit(struct lock *lck, enum lock_type ltype,
- lock_handler_t *waitfunc, lock_handler_t *wakeupfunc)
-{
- if (lck == NULL)
- return (-1);
- else if (lck->l_head == NULL)
- return (_lock_init(lck, ltype, waitfunc, wakeupfunc));
- else {
- lck->l_head->lr_locked = 0;
- lck->l_head->lr_watcher = NULL;
- lck->l_head->lr_owner = NULL;
- lck->l_head->lr_active = 1;
- lck->l_tail = lck->l_head;
- }
- return (0);
-}
-
-int
-_lockuser_init(struct lockuser *lu, void *priv)
-{
- if (lu == NULL)
- return (-1);
- else if ((lu->lu_myreq == NULL) &&
- ((lu->lu_myreq = malloc(sizeof(struct lockreq))) == NULL))
- return (-1);
- else {
- lu->lu_myreq->lr_locked = 1;
- lu->lu_myreq->lr_watcher = NULL;
- lu->lu_myreq->lr_owner = lu;
- lu->lu_myreq->lr_active = 0;
- lu->lu_watchreq = NULL;
- lu->lu_priority = 0;
- lu->lu_private = priv;
- lu->lu_private2 = NULL;
- }
- return (0);
-}
-
-int
-_lockuser_reinit(struct lockuser *lu, void *priv)
-{
- if (lu == NULL)
- return (-1);
- /*
- * All lockusers keep their watch request and drop their
- * own (lu_myreq) request. Their own request is either
- * some other lockuser's watch request or is the head of
- * the lock.
- */
- lu->lu_myreq = lu->lu_watchreq;
- if (lu->lu_myreq == NULL)
- return (_lockuser_init(lu, priv));
- else {
- lu->lu_myreq->lr_locked = 1;
- lu->lu_myreq->lr_watcher = NULL;
- lu->lu_myreq->lr_owner = lu;
- lu->lu_myreq->lr_active = 0;
- lu->lu_watchreq = NULL;
- lu->lu_priority = 0;
- lu->lu_private = priv;
- lu->lu_private2 = NULL;
- }
- return (0);
-}
-
-void
-_lockuser_destroy(struct lockuser *lu)
-{
- if ((lu != NULL) && (lu->lu_myreq != NULL))
- free(lu->lu_myreq);
-}
-
-/*
- * Acquire a lock waiting (spin or sleep) for it to become available.
- */
-void
-_lock_acquire(struct lock *lck, struct lockuser *lu, int prio)
-{
- int i;
- int lval;
-
- /**
- * XXX - We probably want to remove these checks to optimize
- * performance. It is also a bug if any one of the
- * checks fail, so it's probably better to just let it
- * SEGV and fix it.
- */
-#if 0
- if (lck == NULL || lu == NULL || lck->l_head == NULL)
- return;
-#endif
- if ((lck->l_type & LCK_PRIORITY) != 0) {
- LCK_ASSERT(lu->lu_myreq->lr_locked == 1);
- LCK_ASSERT(lu->lu_myreq->lr_watcher == NULL);
- LCK_ASSERT(lu->lu_myreq->lr_owner == lu);
- LCK_ASSERT(lu->lu_watchreq == NULL);
-
- lu->lu_priority = prio;
- }
- /*
- * Atomically swap the head of the lock request with
- * this request.
- */
- atomic_swap_ptr(&lck->l_head, lu->lu_myreq, &lu->lu_watchreq);
-
- if (lu->lu_watchreq->lr_locked != 0) {
- atomic_store_rel_ptr(&lu->lu_watchreq->lr_watcher, lu);
- if ((lck->l_wait == NULL) ||
- ((lck->l_type & LCK_ADAPTIVE) == 0)) {
- while (lu->lu_watchreq->lr_locked != 0)
- ; /* spin, then yield? */
- } else {
- /*
- * Spin for a bit before invoking the wait function.
- *
- * We should be a little smarter here. If we're
- * running on a single processor, then the lock
- * owner got preempted and spinning will accomplish
- * nothing but waste time. If we're running on
- * multiple processors, the owner could be running
- * on another CPU and we might acquire the lock if
- * we spin for a bit.
- *
- * The other thing to keep in mind is that threads
- * acquiring these locks are considered to be in
- * critical regions; they will not be preempted by
- * the _UTS_ until they release the lock. It is
- * therefore safe to assume that if a lock can't
- * be acquired, it is currently held by a thread
- * running in another KSE.
- */
- for (i = 0; i < MAX_SPINS; i++) {
- if (lu->lu_watchreq->lr_locked == 0)
- return;
- if (lu->lu_watchreq->lr_active == 0)
- break;
- }
- atomic_swap_int((int *)&lu->lu_watchreq->lr_locked,
- 2, &lval);
- if (lval == 0)
- lu->lu_watchreq->lr_locked = 0;
- else
- lck->l_wait(lck, lu);
-
- }
- }
- lu->lu_myreq->lr_active = 1;
-}
-
-/*
- * Release a lock.
- */
-void
-_lock_release(struct lock *lck, struct lockuser *lu)
-{
- struct lockuser *lu_tmp, *lu_h;
- struct lockreq *myreq;
- int prio_h;
- int lval;
-
- /**
- * XXX - We probably want to remove these checks to optimize
- * performance. It is also a bug if any one of the
- * checks fail, so it's probably better to just let it
- * SEGV and fix it.
- */
-#if 0
- if ((lck == NULL) || (lu == NULL))
- return;
-#endif
- if ((lck->l_type & LCK_PRIORITY) != 0) {
- prio_h = 0;
- lu_h = NULL;
-
- /* Update tail if our request is last. */
- if (lu->lu_watchreq->lr_owner == NULL) {
- atomic_store_rel_ptr(&lck->l_tail, lu->lu_myreq);
- atomic_store_rel_ptr(&lu->lu_myreq->lr_owner, NULL);
- } else {
- /* Remove ourselves from the list. */
- atomic_store_rel_ptr(&lu->lu_myreq->lr_owner,
- lu->lu_watchreq->lr_owner);
- atomic_store_rel_ptr(
- &lu->lu_watchreq->lr_owner->lu_myreq, lu->lu_myreq);
- }
- /*
- * The watch request now becomes our own because we've
- * traded away our previous request. Save our previous
- * request so that we can grant the lock.
- */
- myreq = lu->lu_myreq;
- lu->lu_myreq = lu->lu_watchreq;
- lu->lu_watchreq = NULL;
- lu->lu_myreq->lr_locked = 1;
- lu->lu_myreq->lr_owner = lu;
- lu->lu_myreq->lr_watcher = NULL;
- /*
- * Traverse the list of lock requests in reverse order
- * looking for the user with the highest priority.
- */
- for (lu_tmp = lck->l_tail->lr_watcher; lu_tmp != NULL;
- lu_tmp = lu_tmp->lu_myreq->lr_watcher) {
- if (lu_tmp->lu_priority > prio_h) {
- lu_h = lu_tmp;
- prio_h = lu_tmp->lu_priority;
- }
- }
- if (lu_h != NULL) {
- /* Give the lock to the highest priority user. */
- if (lck->l_wakeup != NULL) {
- atomic_swap_int(
- (int *)&lu_h->lu_watchreq->lr_locked,
- 0, &lval);
- if (lval == 2)
- /* Notify the sleeper */
- lck->l_wakeup(lck,
- lu_h->lu_myreq->lr_watcher);
- }
- else
- atomic_store_rel_int(
- &lu_h->lu_watchreq->lr_locked, 0);
- } else {
- if (lck->l_wakeup != NULL) {
- atomic_swap_int((int *)&myreq->lr_locked,
- 0, &lval);
- if (lval == 2)
- /* Notify the sleeper */
- lck->l_wakeup(lck, myreq->lr_watcher);
- }
- else
- /* Give the lock to the previous request. */
- atomic_store_rel_int(&myreq->lr_locked, 0);
- }
- } else {
- /*
- * The watch request now becomes our own because we've
- * traded away our previous request. Save our previous
- * request so that we can grant the lock.
- */
- myreq = lu->lu_myreq;
- lu->lu_myreq = lu->lu_watchreq;
- lu->lu_watchreq = NULL;
- lu->lu_myreq->lr_locked = 1;
- if (lck->l_wakeup) {
- atomic_swap_int((int *)&myreq->lr_locked, 0, &lval);
- if (lval == 2)
- /* Notify the sleeper */
- lck->l_wakeup(lck, myreq->lr_watcher);
- }
- else
- /* Give the lock to the previous request. */
- atomic_store_rel_int(&myreq->lr_locked, 0);
- }
- lu->lu_myreq->lr_active = 0;
-}
-
-void
-_lock_grant(struct lock *lck /* unused */, struct lockuser *lu)
-{
- atomic_store_rel_int(&lu->lu_watchreq->lr_locked, 3);
-}
-
-void
-_lockuser_setactive(struct lockuser *lu, int active)
-{
- lu->lu_myreq->lr_active = active;
-}
-
diff --git a/lib/libkse/sys/lock.h b/lib/libkse/sys/lock.h
deleted file mode 100644
index 6102a0b..0000000
--- a/lib/libkse/sys/lock.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2001, 2003 Daniel Eischen <deischen@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _LOCK_H_
-#define _LOCK_H_
-
-struct lockreq;
-struct lockuser;
-struct lock;
-
-enum lock_type {
- LCK_DEFAULT = 0x0000, /* default is FIFO spin locks */
- LCK_PRIORITY = 0x0001,
- LCK_ADAPTIVE = 0x0002 /* call user-supplied handlers */
-};
-
-typedef void lock_handler_t(struct lock *, struct lockuser *);
-
-struct lock {
- struct lockreq *l_head;
- struct lockreq *l_tail; /* only used for priority locks */
- enum lock_type l_type;
- lock_handler_t *l_wait; /* only used for adaptive locks */
- lock_handler_t *l_wakeup; /* only used for adaptive locks */
-};
-
-/* Try to make this >= CACHELINESIZE */
-struct lockreq {
- struct lockuser *lr_watcher; /* only used for priority locks */
- struct lockuser *lr_owner; /* only used for priority locks */
- volatile int lr_locked; /* lock granted = 0, busy otherwise */
- volatile int lr_active; /* non-zero if the lock is last lock for thread */
-};
-
-struct lockuser {
- struct lockreq *lu_myreq; /* request to give up/trade */
- struct lockreq *lu_watchreq; /* watch this request */
- int lu_priority; /* only used for priority locks */
- void *lu_private1; /* private{1,2} are initialized to */
- void *lu_private2; /* NULL and can be used by caller */
-#define lu_private lu_private1
-};
-
-#define _LCK_INITIALIZER(lck_req) { &lck_req, NULL, LCK_DEFAULT, \
- NULL, NULL }
-#define _LCK_REQUEST_INITIALIZER { 0, NULL, NULL, 0 }
-
-#define _LCK_BUSY(lu) ((lu)->lu_watchreq->lr_locked != 0)
-#define _LCK_ACTIVE(lu) ((lu)->lu_watchreq->lr_active != 0)
-#define _LCK_GRANTED(lu) ((lu)->lu_watchreq->lr_locked == 3)
-
-#define _LCK_SET_PRIVATE(lu, p) (lu)->lu_private = (void *)(p)
-#define _LCK_GET_PRIVATE(lu) (lu)->lu_private
-#define _LCK_SET_PRIVATE2(lu, p) (lu)->lu_private2 = (void *)(p)
-#define _LCK_GET_PRIVATE2(lu) (lu)->lu_private2
-
-void _lock_acquire(struct lock *, struct lockuser *, int);
-void _lock_destroy(struct lock *);
-void _lock_grant(struct lock *, struct lockuser *);
-int _lock_init(struct lock *, enum lock_type,
- lock_handler_t *, lock_handler_t *);
-int _lock_reinit(struct lock *, enum lock_type,
- lock_handler_t *, lock_handler_t *);
-void _lock_release(struct lock *, struct lockuser *);
-int _lockuser_init(struct lockuser *lu, void *priv);
-void _lockuser_destroy(struct lockuser *lu);
-int _lockuser_reinit(struct lockuser *lu, void *priv);
-void _lockuser_setactive(struct lockuser *lu, int active);
-
-#endif
diff --git a/lib/libkse/sys/thr_error.c b/lib/libkse/sys/thr_error.c
deleted file mode 100644
index 72e1927..0000000
--- a/lib/libkse/sys/thr_error.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell
- * and Chris Provenzano.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#include <pthread.h>
-#include "libc_private.h"
-#include "thr_private.h"
-
-#undef errno
-extern int errno;
-
-int *
-__error(void)
-{
- struct pthread *curthread;
-
- if (__isthreaded == 0)
- return (&errno);
- else if (_kse_in_critical())
- return &(_get_curkse()->k_error);
- else {
- curthread = _get_curthread();
- if ((curthread == NULL) || (curthread == _thr_initial))
- return (&errno);
- else
- return (&curthread->error);
- }
-}
diff --git a/lib/libkse/test/Makefile b/lib/libkse/test/Makefile
deleted file mode 100644
index 5b5eb3c..0000000
--- a/lib/libkse/test/Makefile
+++ /dev/null
@@ -1,116 +0,0 @@
-#
-# $FreeBSD$
-#
-# Automated test suite for libpthread (pthreads).
-#
-
-# File lists.
-
-# Tests written in C.
-CTESTS := hello_d.c hello_s.c join_leak_d.c mutex_d.c sem_d.c sigsuspend_d.c \
- sigwait_d.c
-
-# C programs that are used internally by the tests. The build system merely
-# compiles these.
-BTESTS := guard_b.c hello_b.c
-
-# Tests written in perl.
-PTESTS := guard_s.pl propagate_s.pl
-
-# Munge the file lists to their final executable names (strip the .c).
-CTESTS := $(CTESTS:R)
-BTESTS := $(BTESTS:R)
-
-CPPFLAGS := -D_LIBC_R_ -D_REENTRANT
-CFLAGS := -Wall -pipe -g3
-LDFLAGS_A := -static
-LDFLAGS_P := -pg
-LDFLAGS_S :=
-LIBS := -lpthread
-
-# Flags passed to verify. "-v" or "-u" may be useful.
-VERIFY = perl verify
-VFLAGS :=
-
-all : default
-
-# Only use the following suffixes, in order to avoid any strange built-in rules.
-.SUFFIXES :
-.SUFFIXES : .c .o .d .pl
-
-# Clear out all paths, then set just one (default path) for the main build
-# directory.
-.PATH :
-.PATH : .
-
-# Build the C programs.
-.for bin in $(CTESTS) $(BTESTS)
-$(bin)_a : $(bin:S/$/&.c/)
- $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
- $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_A) $(LIBS)
- @$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $(bin:S/$/&.c/) | sed \"s/\($(bin:T)\)\.o\([ :]*\)/$(bin:H:S!/!\\/!g)\/\1_a.o \2/g\" > $(@:R:S/$/&.d/)"
-
-$(bin)_p : $(bin:S/$/&.c/)
- $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
- $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_P) $(LIBS)
- @$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $(bin:S/$/&.c/) | sed \"s/\($(bin:T)\)\.o\([ :]*\)/$(bin:H:S!/!\\/!g)\/\1_p.o \2/g\" > $(@:R:S/$/&.d/)"
-
-$(bin)_s : $(bin:S/$/&.c/)
- $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
- $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_S) $(LIBS)
- @$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $(bin:S/$/&.c/) | sed \"s/\($(bin:T)\)\.o\([ :]*\)/$(bin:H:S!/!\\/!g)\/\1_s.o \2/g\" > $(@:R:S/$/&.d/)"
-.endfor
-
-# Dependency file inclusion.
-.for depfile in $(CTESTS:R:S/$/&_a.d/) $(BTESTS:R:S/$/&_a.d/) \
- $(CTESTS:R:S/$/&_p.d/) $(BTESTS:R:S/$/&_p.d/) \
- $(CTESTS:R:S/$/&_s.d/) $(BTESTS:R:S/$/&_s.d/)
-.if exists($(depfile))
-.include "$(depfile)"
-.endif
-.endfor
-
-default : check
-
-tests_a : $(CTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/)
-tests_p : $(CTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/)
-tests_s : $(CTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/)
-
-tests : tests_a tests_p tests_s
-
-check_a : tests_a
-.for bin in $(CTESTS) $(BTESTS)
- @cp $(bin)_a $(bin)
-.endfor
- @echo "Test static library:"
- @$(VERIFY) $(VFLAGS) $(CTESTS) $(PTESTS)
-
-check_p : tests_p
-.for bin in $(CTESTS) $(BTESTS)
- @cp $(bin)_p $(bin)
-.endfor
- @echo "Test profile library:"
- @$(VERIFY) $(VFLAGS) $(CTESTS) $(PTESTS)
-
-check_s : tests_s
-.for bin in $(CTESTS) $(BTESTS)
- @cp $(bin)_s $(bin)
-.endfor
- @echo "Test shared library:"
- @$(VERIFY) $(VFLAGS) $(CTESTS) $(PTESTS)
-
-check : check_a check_p check_s
-
-clean :
- rm -f *~
- rm -f *.core
- rm -f *.out
- rm -f *.perf
- rm -f *.diff
- rm -f *.gmon
- rm -f $(CTESTS) $(BTESTS)
- rm -f $(CTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/)
- rm -f $(CTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/)
- rm -f $(CTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/)
- rm -f *.d
- rm -f *.o
diff --git a/lib/libkse/test/README b/lib/libkse/test/README
deleted file mode 100644
index 8f625a1..0000000
--- a/lib/libkse/test/README
+++ /dev/null
@@ -1,28 +0,0 @@
-$FreeBSD$
-
-This test suite is meant to test general functionality of pthreads, as well as
-provide a simple framework for regression tests. In general, this test suite
-can be used with any pthreads library, but in reality there are a number of
-libpthread-specific aspects to this test suite which would require some
-effort to get around if testing another pthreads library.
-
-This test suite assumes that libpthread is installed.
-
-There are two forms of test that the 'verify' script understands. The simpler
-form is the diff format, where the output of the test program is diff'ed with
-the correspondingly named .exp file. If there is diff output, the test fails.
-The sequence test format is somewhat more complex, and is documented in the
-command line usage output for verify. The advantage of this format is that it
-allows multiple tests to pass/fail within one program.
-
-There is no driving need for test naming consistency, but the existing tests
-generally follow these conventions:
-
-<name>_d.c <name>_d.exp : Diff mode C test and expected output file.
-<name>_s.c : Sequence mode C test.
-<name>_b*.c : Back end C program used by perl tests.
-<name>_d.pl <name>_d.pl.exp : Diff mode perl test and expected output file.
-<name>_s.pl : Sequence mode perl test.
-
-<name> is something descriptive, such as "pr14685" in the case of a PR-related
-regression test, or "mutex" in the case of a test of mutexes.
diff --git a/lib/libkse/test/guard_b.c b/lib/libkse/test/guard_b.c
deleted file mode 100644
index 42bf4ed..0000000
--- a/lib/libkse/test/guard_b.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2001 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer
- * unmodified other than the allowable addition of one or more
- * copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
- * Test thread stack guard functionality.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <limits.h>
-#include <pthread.h>
-
-#define FRAME_SIZE 1024
-#define FRAME_OVERHEAD 40
-
-struct args
-{
- void *top; /* Top of thread's initial stack frame. */
- int cur; /* Recursion depth. */
- int max; /* Maximum recursion depth. */
-};
-
-void *
-recurse(void *args)
-{
- int top;
- struct args *parms = (struct args *)args;
- char filler[FRAME_SIZE - FRAME_OVERHEAD];
-
- /* Touch the memory in this stack frame. */
- top = 0xa5;
- memset(filler, 0xa5, sizeof(filler));
-
- if (parms->top == NULL) {
- /* Initial stack frame. */
- parms->top = (void*)&top;
- }
-
- /*
- * Make sure frame size is what we expect. Getting this right involves
- * hand tweaking, so just print a warning rather than aborting.
- */
- if (parms->top - (void *)&top != FRAME_SIZE * parms->cur) {
- fprintf(stderr, "Stack size (%d) != expected (%d), frame %d\n",
- parms->top - (void *)&top, FRAME_SIZE * parms->cur,
- parms->cur);
- }
-
- parms->cur++;
- if (parms->cur < parms->max)
- recurse(args);
-
- return NULL;
-}
-
-
-int
-main(int argc, char **argv)
-{
- size_t def_stacksize, def_guardsize;
- size_t stacksize, guardsize;
- pthread_t thread;
- pthread_attr_t attr;
- struct args args;
-
- if (argc != 3) {
- fprintf(stderr, "usage: guard_b <stacksize> <guardsize>\n");
- exit(1);
- }
- fprintf(stderr, "Test begin\n");
-
- stacksize = strtoul(argv[1], NULL, 10);
- guardsize = strtoul(argv[2], NULL, 10);
-
- assert(pthread_attr_init(&attr) == 0);
- /*
- * Exercise the attribute APIs more thoroughly than is strictly
- * necessary for the meat of this test program.
- */
- assert(pthread_attr_getstacksize(&attr, &def_stacksize) == 0);
- assert(pthread_attr_getguardsize(&attr, &def_guardsize) == 0);
- if (def_stacksize != stacksize) {
- assert(pthread_attr_setstacksize(&attr, stacksize) == 0);
- assert(pthread_attr_getstacksize(&attr, &def_stacksize) == 0);
- assert(def_stacksize == stacksize);
- }
- if (def_guardsize != guardsize) {
- assert(pthread_attr_setguardsize(&attr, guardsize) == 0);
- assert(pthread_attr_getguardsize(&attr, &def_guardsize) == 0);
- assert(def_guardsize >= guardsize);
- }
-
- /*
- * Create a thread that will come just short of overflowing the thread
- * stack. We need to leave a bit of breathing room in case the thread
- * is context switched, and we also have to take care not to call any
- * functions in the deepest stack frame.
- */
- args.top = NULL;
- args.cur = 0;
- args.max = (stacksize / FRAME_SIZE) - 1;
- fprintf(stderr, "No overflow:\n");
- assert(pthread_create(&thread, &attr, recurse, &args) == 0);
- assert(pthread_join(thread, NULL) == 0);
-
- /*
- * Create a thread that will barely of overflow the thread stack. This
- * should cause a segfault.
- */
- args.top = NULL;
- args.cur = 0;
- args.max = (stacksize / FRAME_SIZE) + 1;
- fprintf(stderr, "Overflow:\n");
- assert(pthread_create(&thread, &attr, recurse, &args) == 0);
- assert(pthread_join(thread, NULL) == 0);
-
- /* Not reached. */
- fprintf(stderr, "Unexpected success\n");
- abort();
-
- return 0;
-}
diff --git a/lib/libkse/test/guard_b.exp b/lib/libkse/test/guard_b.exp
deleted file mode 100644
index 8e5b9e4..0000000
--- a/lib/libkse/test/guard_b.exp
+++ /dev/null
@@ -1,3 +0,0 @@
-Test begin
-No overflow:
-Overflow:
diff --git a/lib/libkse/test/guard_s.pl b/lib/libkse/test/guard_s.pl
deleted file mode 100644
index 7802ff3..0000000
--- a/lib/libkse/test/guard_s.pl
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (C) 2001 Jason Evans <jasone@freebsd.org>.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice(s), this list of conditions and the following disclaimer
-# unmodified other than the allowable addition of one or more
-# copyright notices.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice(s), this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# $FreeBSD$
-#
-# Test thread stack guard functionality. The C test program needs to be driven
-# by this script because it segfaults when the stack guard is hit.
-#
-
-print "1..30\n";
-
-$i = 0;
-# Iterates 10 times.
-for ($stacksize = 65536; $stacksize < 131072; $stacksize += 7168)
-{
- # Iterates 3 times (1024, 4096, 7168).
- for ($guardsize = 1024; $guardsize < 8192; $guardsize += 3072)
- {
- $i++;
-
- print "stacksize: $stacksize, guardsize: $guardsize\n";
-
- `./guard_b $stacksize $guardsize >guard_b.out 2>&1`;
-
- if (! -f "./guard_b.out")
- {
- print "not ok $i\n";
- }
- else
- {
- `diff guard_b.exp guard_b.out >guard_b.diff 2>&1`;
- if ($?)
- {
- # diff returns non-zero if there is a difference.
- print "not ok $i\n";
- }
- else
- {
- print "ok $i\n";
- }
- }
- }
-}
diff --git a/lib/libkse/test/hello_b.c b/lib/libkse/test/hello_b.c
deleted file mode 100644
index 2eefa7f..0000000
--- a/lib/libkse/test/hello_b.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/****************************************************************************
- *
- * Back end C programs can be anything compilable.
- *
- * $FreeBSD$
- *
- ****************************************************************************/
-
-int
-main()
-{
- return 0;
-}
diff --git a/lib/libkse/test/hello_d.c b/lib/libkse/test/hello_d.c
deleted file mode 100644
index 6d77526..0000000
--- a/lib/libkse/test/hello_d.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
- *
- * Simple diff mode test.
- *
- * $FreeBSD$
- *
- ****************************************************************************/
-
-#include <stdio.h>
-#include <string.h>
-#include <pthread.h>
-
-void *
-entry(void * a_arg)
-{
- fprintf(stderr, "Hello world\n");
-
- return NULL;
-}
-
-int
-main()
-{
- pthread_t thread;
- int error;
-
- error = pthread_create(&thread, NULL, entry, NULL);
- if (error)
- fprintf(stderr, "Error in pthread_create(): %s\n",
- strerror(error));
-
- error = pthread_join(thread, NULL);
- if (error)
- fprintf(stderr, "Error in pthread_join(): %s\n",
- strerror(error));
-
- return 0;
-}
diff --git a/lib/libkse/test/hello_d.exp b/lib/libkse/test/hello_d.exp
deleted file mode 100644
index 802992c..0000000
--- a/lib/libkse/test/hello_d.exp
+++ /dev/null
@@ -1 +0,0 @@
-Hello world
diff --git a/lib/libkse/test/hello_s.c b/lib/libkse/test/hello_s.c
deleted file mode 100644
index 942bf2d..0000000
--- a/lib/libkse/test/hello_s.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
- *
- * Simple sequence mode test.
- *
- * $FreeBSD$
- *
- ****************************************************************************/
-
-#include <stdio.h>
-#include <string.h>
-#include <pthread.h>
-
-void *
-entry(void * a_arg)
-{
- fprintf(stderr, "ok 1\n");
- fprintf(stderr, "ok \n");
- fprintf(stderr, "ok 3\n");
-
- return NULL;
-}
-
-int
-main()
-{
- pthread_t thread;
- int error;
-
- fprintf(stderr, "1..3\n");
-
- fprintf(stderr, "Some random text\n");
-
- error = pthread_create(&thread, NULL, entry, NULL);
- fprintf(stderr, "More unimportant text\n");
- if (error)
- fprintf(stderr,"Error in pthread_create(): %s\n",
- strerror(error));
-
- error = pthread_join(thread, NULL);
- if (error)
- fprintf(stderr, "Error in pthread_join(): %s\n",
- strerror(error));
-
- fprintf(stderr, "Hello world\n");
-
- return 0;
-}
diff --git a/lib/libkse/test/join_leak_d.c b/lib/libkse/test/join_leak_d.c
deleted file mode 100644
index 6532ca5..0000000
--- a/lib/libkse/test/join_leak_d.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2001 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
- * Test for leaked joined threads.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <string.h>
-#include <pthread.h>
-
-#define NITERATIONS 16384
-#define MAXGROWTH 16384
-
-void *
-thread_entry(void *a_arg)
-{
- return NULL;
-}
-
-int
-main(void)
-{
- pthread_t thread;
- int i, error;
- char *brk, *nbrk;
- unsigned growth;
-
- fprintf(stderr, "Test begin\n");
-
- /* Get an initial brk value. */
- brk = sbrk(0);
-
- /* Create threads and join them, one at a time. */
- for (i = 0; i < NITERATIONS; i++) {
- if ((error = pthread_create(&thread, NULL, thread_entry, NULL))
- != 0) {
- fprintf(stderr, "Error in pthread_create(): %s\n",
- strerror(error));
- exit(1);
- }
- if ((error = pthread_join(thread, NULL)) != 0) {
- fprintf(stderr, "Error in pthread_join(): %s\n",
- strerror(error));
- exit(1);
- }
- }
-
- /* Get a final brk value. */
- nbrk = sbrk(0);
-
- /*
- * Check that the amount of heap space allocated is below an acceptable
- * threshold. We could just compare brk and nbrk, but the test could
- * conceivably break if the internals of the threads library changes.
- */
- if (nbrk > brk) {
- /* Heap grows up. */
- growth = nbrk - brk;
- } else if (nbrk <= brk) {
- /* Heap grows down, or no growth. */
- growth = brk - nbrk;
- }
-
- if (growth > MAXGROWTH) {
- fprintf(stderr, "Heap growth exceeded maximum (%u > %u)\n",
- growth, MAXGROWTH);
- }
-#if (0)
- else {
- fprintf(stderr, "Heap growth acceptable (%u <= %u)\n",
- growth, MAXGROWTH);
- }
-#endif
-
- fprintf(stderr, "Test end\n");
- return 0;
-}
diff --git a/lib/libkse/test/join_leak_d.exp b/lib/libkse/test/join_leak_d.exp
deleted file mode 100644
index 369a88d..0000000
--- a/lib/libkse/test/join_leak_d.exp
+++ /dev/null
@@ -1,2 +0,0 @@
-Test begin
-Test end
diff --git a/lib/libkse/test/mutex_d.c b/lib/libkse/test/mutex_d.c
deleted file mode 100644
index 801d779..0000000
--- a/lib/libkse/test/mutex_d.c
+++ /dev/null
@@ -1,1557 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel M. Eischen <eischen@vigrid.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 M. Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL M. EISCHEN AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <sys/ioctl.h>
-#include <assert.h>
-#include <errno.h>
-#include "pthread.h"
-#include <sched.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <sysexits.h>
-
-#if defined(_LIBC_R_)
-#include <pthread_np.h>
-#endif
-
-#ifndef NELEMENTS
-#define NELEMENTS(arr) (sizeof (arr) / sizeof (arr[0]))
-#endif
-
-#ifndef NUM_THREADS
-#define NUM_THREADS 10
-#endif
-
-#define MAX_THREAD_CMDS 10
-
-static void log_error(const char *, ...) __printflike(1, 2);
-static void log_trace (const char *, ...) __printflike(1, 2);
-static void log (const char *, ...) __printflike(1, 2);
-
-/*------------------------------------------------------------
- * Types
- *----------------------------------------------------------*/
-
-typedef enum {
- STAT_INITIAL, /* initial state */
- STAT_WAITCONDVAR, /* waiting for condition variable signal */
- STAT_WAITMUTEX /* waiting for mutex lock */
-} thread_status_t;
-
-typedef enum {
- FLAGS_REPORT_WAITCONDMUTEX = 0x01,
- FLAGS_REPORT_WAITCONDVAR = 0x02,
- FLAGS_REPORT_WAITMUTEX = 0x04,
- FLAGS_REPORT_BUSY_LOOP = 0x08,
- FLAGS_IS_BUSY = 0x10,
- FLAGS_WAS_BUSY = 0x20
-} thread_flags_t;
-
-typedef enum {
- CMD_NONE,
- CMD_TAKE_MUTEX,
- CMD_RELEASE_MUTEX,
- CMD_WAIT_FOR_SIGNAL,
- CMD_BUSY_LOOP,
- CMD_PROTECTED_OP,
- CMD_RELEASE_ALL
-} thread_cmd_id_t;
-
-typedef struct {
- thread_cmd_id_t cmd_id;
- pthread_mutex_t *mutex;
- pthread_cond_t *cond;
-} thread_cmd_t;
-
-typedef struct {
- pthread_cond_t cond_var;
- thread_status_t status;
- thread_cmd_t cmd;
- int flags;
- int priority;
- int ret;
- pthread_t tid;
- u_int8_t id;
-} thread_state_t;
-
-typedef enum {
- M_POSIX,
- M_SS2_DEFAULT,
- M_SS2_ERRORCHECK,
- M_SS2_NORMAL,
- M_SS2_RECURSIVE
-} mutex_kind_t;
-
-
-/*------------------------------------------------------------
- * Constants
- *----------------------------------------------------------*/
-
-const char *protocol_strs[] = {
- "PTHREAD_PRIO_NONE",
- "PTHREAD_PRIO_INHERIT",
- "PTHREAD_PRIO_PROTECT"
-};
-
-const int protocols[] = {
- PTHREAD_PRIO_NONE,
- PTHREAD_PRIO_INHERIT,
- PTHREAD_PRIO_PROTECT
-};
-
-const char *mutextype_strs[] = {
- "POSIX (type not specified)",
- "SS2 PTHREAD_MUTEX_DEFAULT",
- "SS2 PTHREAD_MUTEX_ERRORCHECK",
- "SS2 PTHREAD_MUTEX_NORMAL",
- "SS2 PTHREAD_MUTEX_RECURSIVE"
-};
-
-const int mutex_types[] = {
- 0, /* M_POSIX */
- PTHREAD_MUTEX_DEFAULT, /* M_SS2_DEFAULT */
- PTHREAD_MUTEX_ERRORCHECK, /* M_SS2_ERRORCHECK */
- PTHREAD_MUTEX_NORMAL, /* M_SS2_NORMAL */
- PTHREAD_MUTEX_RECURSIVE /* M_SS2_RECURSIVE */
-};
-
-
-/*------------------------------------------------------------
- * Objects
- *----------------------------------------------------------*/
-
-static int done = 0;
-static int trace_enabled = 0;
-static int use_global_condvar = 0;
-static thread_state_t states[NUM_THREADS];
-static int pipefd[2];
-
-static pthread_mutex_t waiter_mutex;
-static pthread_mutex_t cond_mutex;
-static pthread_cond_t cond_var;
-
-static FILE *logfile;
-static int error_count = 0, pass_count = 0, total = 0;
-
-
-/*------------------------------------------------------------
- * Prototypes
- *----------------------------------------------------------*/
-extern char *strtok_r(char *str, const char *sep, char **last);
-
-
-/*------------------------------------------------------------
- * Functions
- *----------------------------------------------------------*/
-
-#ifdef DEBUG
-static void
-kern_switch (pthread_t pthread_out, pthread_t pthread_in)
-{
- if (pthread_out != NULL)
- printf ("Swapping out thread 0x%x, ", (int) pthread_out);
- else
- printf ("Swapping out kernel thread, ");
-
- if (pthread_in != NULL)
- printf ("swapping in thread 0x%x\n", (int) pthread_in);
- else
- printf ("swapping in kernel thread.\n");
-}
-#endif
-
-
-static void
-log_error (const char *fmt, ...)
-{
- va_list ap;
-
- va_start (ap, fmt);
- fprintf (logfile, "FAIL: ");
- vfprintf (logfile, fmt, ap);
- error_count = error_count + 1;
- total = total + 1;
-}
-
-
-static void
-log_pass (void)
-{
- fprintf (logfile, "PASS\n");
- pass_count = pass_count + 1;
- total = total + 1;
-}
-
-
-static void
-log_trace (const char *fmt, ...)
-{
- va_list ap;
-
- if (trace_enabled) {
- va_start (ap, fmt);
- vfprintf (logfile, fmt, ap);
- }
-}
-
-
-static void
-log (const char *fmt, ...)
-{
- va_list ap;
-
- va_start (ap, fmt);
- vfprintf (logfile, fmt, ap);
-}
-
-
-static void
-check_result (int expected, int actual)
-{
- if (expected != actual)
- log_error ("expected %d, returned %d\n", expected, actual);
- else
- log_pass ();
-}
-
-
-/*
- * Check to see that the threads ran in the specified order.
- */
-static void
-check_run_order (char *order)
-{
- const char *sep = ":,";
- char *tok, *last, *idstr, *endptr;
- int expected_id, bytes, count = 0, errors = 0;
- u_int8_t id;
-
- assert ((tok = (char *) malloc (strlen(order) + 1)) != NULL);
- strcpy (tok, order); /* tok has to be larger than order */
- assert (ioctl (pipefd[0], FIONREAD, &bytes) == 0);
- log_trace ("%d bytes read from FIFO.\n", bytes);
-
- for (idstr = strtok_r (tok, sep, &last);
- (idstr != NULL) && (count < bytes);
- idstr = strtok_r (NULL, sep, &last)) {
-
- /* Get the expected id: */
- expected_id = (int) strtol (idstr, &endptr, 10);
- assert ((endptr != NULL) && (*endptr == '\0'));
-
- /* Read the actual id from the pipe: */
- assert (read (pipefd[0], &id, sizeof (id)) == sizeof (id));
- count = count + sizeof (id);
-
- if (id != expected_id) {
- log_trace ("Thread %d ran out of order.\n", id);
- errors = errors + 1;
- }
- else {
- log_trace ("Thread %d at priority %d reporting.\n",
- (int) id, states[id].priority);
- }
- }
-
- if (count < bytes) {
- /* Clear the pipe: */
- while (count < bytes) {
- read (pipefd[0], &id, sizeof (id));
- count = count + 1;
- errors = errors + 1;
- }
- }
- else if (bytes < count)
- errors = errors + count - bytes;
-
- if (errors == 0)
- log_pass ();
- else
- log_error ("%d threads ran out of order", errors);
-}
-
-
-static void *
-waiter (void *arg)
-{
- thread_state_t *statep = (thread_state_t *) arg;
- pthread_mutex_t *held_mutex[MAX_THREAD_CMDS];
- int held_mutex_owned[MAX_THREAD_CMDS];
- sigset_t mask;
- struct timeval tv1, tv2;
- thread_cmd_t cmd;
- int i, mutex_count = 0;
-
- statep->status = STAT_INITIAL;
-
- /* Block all signals except for interrupt.*/
- sigfillset (&mask);
- sigdelset (&mask, SIGINT);
- sigprocmask (SIG_BLOCK, &mask, NULL);
-
- while (done == 0) {
- /* Wait for signal from the main thread to continue. */
- statep->status = STAT_WAITMUTEX;
- log_trace ("Thread %d: locking cond_mutex.\n",
- (int) statep->id);
- pthread_mutex_lock (&cond_mutex);
-
- /* Do we report our status. */
- if (statep->flags & FLAGS_REPORT_WAITCONDMUTEX)
- write (pipefd[1], &statep->id, sizeof (statep->id));
- log_trace ("Thread %d: waiting for cond_var.\n",
- (int) statep->id);
-
- /* Wait for a command. */
- statep->status = STAT_WAITCONDVAR;
-
- /*
- * The threads are allowed commanded to wait either on
- * their own unique condition variable (so they may be
- * separately signaled) or on one global condition variable
- * (so they may be signaled together).
- */
- if (use_global_condvar != 0)
- pthread_cond_wait (&cond_var, &cond_mutex);
- else
- pthread_cond_wait (&statep->cond_var, &cond_mutex);
-
- /* Do we report our status? */
- if (statep->flags & FLAGS_REPORT_WAITCONDVAR) {
- write (pipefd[1], &statep->id, sizeof (statep->id));
- log_trace ("Thread %d: wrote to pipe.\n",
- (int) statep->id);
- }
- log_trace ("Thread %d: received cond_var signal.\n",
- (int) statep->id);
-
- /* Get a copy of the command before releasing the mutex. */
- cmd = statep->cmd;
-
- /* Clear the command after copying it. */
- statep->cmd.cmd_id = CMD_NONE;
-
- /* Unlock the condition variable mutex. */
- assert (pthread_mutex_unlock (&cond_mutex) == 0);
-
- /* Peform the command.*/
- switch (cmd.cmd_id) {
- case CMD_TAKE_MUTEX:
- statep->ret = pthread_mutex_lock (cmd.mutex);
- if (statep->ret == 0) {
- assert (mutex_count < sizeof (held_mutex));
- held_mutex[mutex_count] = cmd.mutex;
- held_mutex_owned[mutex_count] = 1;
- mutex_count++;
- }
- else {
- held_mutex_owned[mutex_count] = 0;
- log_trace ("Thread id %d unable to lock mutex, "
- "error = %d\n", (int) statep->id,
- statep->ret);
- }
- break;
-
- case CMD_RELEASE_MUTEX:
- assert ((mutex_count <= sizeof (held_mutex)) &&
- (mutex_count > 0));
- mutex_count--;
- if (held_mutex_owned[mutex_count] != 0)
- assert (pthread_mutex_unlock
- (held_mutex[mutex_count]) == 0);
- break;
-
- case CMD_WAIT_FOR_SIGNAL:
- assert (pthread_mutex_lock (cmd.mutex) == 0);
- assert (pthread_cond_wait (cmd.cond, cmd.mutex) == 0);
- assert (pthread_mutex_unlock (cmd.mutex) == 0);
- break;
-
- case CMD_BUSY_LOOP:
- log_trace ("Thread %d: Entering busy loop.\n",
- (int) statep->id);
- /* Spin for 15 seconds. */
- assert (gettimeofday (&tv2, NULL) == 0);
- tv1.tv_sec = tv2.tv_sec + 5;
- tv1.tv_usec = tv2.tv_usec;
- statep->flags |= FLAGS_IS_BUSY;
- while (timercmp (&tv2, &tv1,<)) {
- assert (gettimeofday (&tv2, NULL) == 0);
- }
- statep->flags &= ~FLAGS_IS_BUSY;
- statep->flags |= FLAGS_WAS_BUSY;
-
- /* Do we report our status? */
- if (statep->flags & FLAGS_REPORT_BUSY_LOOP)
- write (pipefd[1], &statep->id,
- sizeof (statep->id));
-
- log_trace ("Thread %d: Leaving busy loop.\n",
- (int) statep->id);
- break;
-
- case CMD_PROTECTED_OP:
- assert (pthread_mutex_lock (cmd.mutex) == 0);
- statep->flags |= FLAGS_WAS_BUSY;
- /* Do we report our status? */
- if (statep->flags & FLAGS_REPORT_BUSY_LOOP)
- write (pipefd[1], &statep->id,
- sizeof (statep->id));
-
- assert (pthread_mutex_unlock (cmd.mutex) == 0);
- break;
-
- case CMD_RELEASE_ALL:
- assert ((mutex_count <= sizeof (held_mutex)) &&
- (mutex_count > 0));
- for (i = mutex_count - 1; i >= 0; i--) {
- if (held_mutex_owned[i] != 0)
- assert (pthread_mutex_unlock
- (held_mutex[i]) == 0);
- }
- mutex_count = 0;
- break;
-
- case CMD_NONE:
- default:
- break;
- }
-
- /* Wait for the big giant waiter lock. */
- statep->status = STAT_WAITMUTEX;
- log_trace ("Thread %d: waiting for big giant lock.\n",
- (int) statep->id);
- pthread_mutex_lock (&waiter_mutex);
- if (statep->flags & FLAGS_REPORT_WAITMUTEX)
- write (pipefd[1], &statep->id, sizeof (statep->id));
- log_trace ("Thread %d: got big giant lock.\n",
- (int) statep->id);
- statep->status = STAT_INITIAL;
- pthread_mutex_unlock (&waiter_mutex);
- }
-
- log_trace ("Thread %d: Exiting thread 0x%x\n", (int) statep->id,
- (int) pthread_self());
- pthread_exit (arg);
- return (NULL);
-}
-
-
-static void *
-lock_twice (void *arg)
-{
- thread_state_t *statep = (thread_state_t *) arg;
- sigset_t mask;
-
- statep->status = STAT_INITIAL;
-
- /* Block all signals except for interrupt.*/
- sigfillset (&mask);
- sigdelset (&mask, SIGINT);
- sigprocmask (SIG_BLOCK, &mask, NULL);
-
- /* Wait for a signal to continue. */
- log_trace ("Thread %d: locking cond_mutex.\n", (int) statep->id);
- pthread_mutex_lock (&cond_mutex);
-
- log_trace ("Thread %d: waiting for cond_var.\n", (int) statep->id);
- statep->status = STAT_WAITCONDVAR;
- pthread_cond_wait (&cond_var, &cond_mutex);
-
- log_trace ("Thread %d: received cond_var signal.\n", (int) statep->id);
-
- /* Unlock the condition variable mutex. */
- assert (pthread_mutex_unlock (&cond_mutex) == 0);
-
- statep->status = STAT_WAITMUTEX;
- /* Lock the mutex once. */
- assert (pthread_mutex_lock (statep->cmd.mutex) == 0);
-
- /* Lock it again and capture the error. */
- statep->ret = pthread_mutex_lock (statep->cmd.mutex);
- statep->status = 0;
-
- assert (pthread_mutex_unlock (statep->cmd.mutex) == 0);
-
- /* Unlock it again if it is locked recursively. */
- if (statep->ret == 0)
- pthread_mutex_unlock (statep->cmd.mutex);
-
- log_trace ("Thread %d: Exiting thread 0x%x\n", (int) statep->id,
- (int) pthread_self());
- pthread_exit (arg);
- return (NULL);
-}
-
-
-static void
-sighandler (int signo)
-{
- log ("Signal handler caught signal %d, thread id 0x%x\n",
- signo, (int) pthread_self());
-
- if (signo == SIGINT)
- done = 1;
-}
-
-
-static void
-send_cmd (int id, thread_cmd_id_t cmd)
-{
- assert (pthread_mutex_lock (&cond_mutex) == 0);
- assert (states[id].status == STAT_WAITCONDVAR);
- states[id].cmd.cmd_id = cmd;
- states[id].cmd.mutex = NULL;
- states[id].cmd.cond = NULL;
- /* Clear the busy flags. */
- states[id].flags &= ~(FLAGS_WAS_BUSY | FLAGS_IS_BUSY);
- assert (pthread_cond_signal (&states[id].cond_var) == 0);
- assert (pthread_mutex_unlock (&cond_mutex) == 0);
-}
-
-
-static void
-send_mutex_cmd (int id, thread_cmd_id_t cmd, pthread_mutex_t *m)
-{
- assert (pthread_mutex_lock (&cond_mutex) == 0);
- assert (states[id].status == STAT_WAITCONDVAR);
- states[id].cmd.cmd_id = cmd;
- states[id].cmd.mutex = m;
- states[id].cmd.cond = NULL;
- /* Clear the busy flags. */
- states[id].flags &= ~(FLAGS_WAS_BUSY | FLAGS_IS_BUSY);
- assert (pthread_cond_signal (&states[id].cond_var) == 0);
- assert (pthread_mutex_unlock (&cond_mutex) == 0);
-}
-
-
-static void
-send_mutex_cv_cmd (int id, thread_cmd_id_t cmd, pthread_mutex_t *m,
- pthread_cond_t *cv)
-{
- assert (pthread_mutex_lock (&cond_mutex) == 0);
- assert (states[id].status == STAT_WAITCONDVAR);
- states[id].cmd.cmd_id = cmd;
- states[id].cmd.mutex = m;
- states[id].cmd.cond = cv;
- /* Clear the busy flags. */
- states[id].flags &= ~(FLAGS_WAS_BUSY | FLAGS_IS_BUSY);
- assert (pthread_cond_signal (&states[id].cond_var) == 0);
- assert (pthread_mutex_unlock (&cond_mutex) == 0);
-}
-
-
-static void
-mutex_init_test (void)
-{
- pthread_mutexattr_t mattr;
- pthread_mutex_t mutex;
- mutex_kind_t mkind;
- int mproto, ret;
-
- /*
- * Initialize a mutex attribute.
- *
- * pthread_mutexattr_init not tested for: ENOMEM
- */
- assert (pthread_mutexattr_init (&mattr) == 0);
-
- /*
- * Initialize a mutex.
- *
- * pthread_mutex_init not tested for: EAGAIN ENOMEM EPERM EBUSY
- */
- log ("Testing pthread_mutex_init\n");
- log ("--------------------------\n");
-
- for (mproto = 0; mproto < NELEMENTS(protocols); mproto++) {
- for (mkind = M_POSIX; mkind <= M_SS2_RECURSIVE; mkind++) {
- /* Initialize the mutex attribute. */
- assert (pthread_mutexattr_init (&mattr) == 0);
- assert (pthread_mutexattr_setprotocol (&mattr,
- protocols[mproto]) == 0);
-
- /*
- * Ensure that the first mutex type is a POSIX
- * compliant mutex.
- */
- if (mkind != M_POSIX) {
- assert (pthread_mutexattr_settype (&mattr,
- mutex_types[mkind]) == 0);
- }
-
- log (" Protocol %s, Type %s - ",
- protocol_strs[mproto], mutextype_strs[mkind]);
- ret = pthread_mutex_init (&mutex, &mattr);
- check_result (/* expected */ 0, ret);
- assert (pthread_mutex_destroy (&mutex) == 0);
-
- /*
- * Destroy a mutex attribute.
- *
- * XXX - There should probably be a magic number
- * associated with a mutex attribute so that
- * destroy can be reasonably sure the attribute
- * is valid.
- *
- * pthread_mutexattr_destroy not tested for: EINVAL
- */
- assert (pthread_mutexattr_destroy (&mattr) == 0);
- }
- }
-}
-
-
-static void
-mutex_destroy_test (void)
-{
- pthread_mutexattr_t mattr;
- pthread_mutex_t mutex;
- pthread_condattr_t cattr;
- pthread_cond_t cv;
- pthread_attr_t pattr;
- int mproto, ret;
- mutex_kind_t mkind;
- thread_state_t state;
-
- /*
- * Destroy a mutex.
- *
- * XXX - There should probably be a magic number associated
- * with a mutex so that destroy can be reasonably sure
- * the mutex is valid.
- *
- * pthread_mutex_destroy not tested for:
- */
- log ("Testing pthread_mutex_destroy\n");
- log ("-----------------------------\n");
-
- assert (pthread_attr_init (&pattr) == 0);
- assert (pthread_attr_setdetachstate (&pattr,
- PTHREAD_CREATE_DETACHED) == 0);
- state.flags = 0; /* No flags yet. */
-
- for (mproto = 0; mproto < NELEMENTS(protocols); mproto++) {
- for (mkind = M_POSIX; mkind <= M_SS2_RECURSIVE; mkind++) {
- /* Initialize the mutex attribute. */
- assert (pthread_mutexattr_init (&mattr) == 0);
- assert (pthread_mutexattr_setprotocol (&mattr,
- protocols[mproto]) == 0);
-
- /*
- * Ensure that the first mutex type is a POSIX
- * compliant mutex.
- */
- if (mkind != M_POSIX) {
- assert (pthread_mutexattr_settype (&mattr,
- mutex_types[mkind]) == 0);
- }
-
- /* Create the mutex. */
- assert (pthread_mutex_init (&mutex, &mattr) == 0);
-
- log (" Protocol %s, Type %s\n",
- protocol_strs[mproto], mutextype_strs[mkind]);
-
- log (" Destruction of unused mutex - ");
- assert (pthread_mutex_init (&mutex, &mattr) == 0);
- ret = pthread_mutex_destroy (&mutex);
- check_result (/* expected */ 0, ret);
-
- log (" Destruction of mutex locked by self - ");
- assert (pthread_mutex_init (&mutex, &mattr) == 0);
- assert (pthread_mutex_lock (&mutex) == 0);
- ret = pthread_mutex_destroy (&mutex);
- check_result (/* expected */ EBUSY, ret);
- assert (pthread_mutex_unlock (&mutex) == 0);
- assert (pthread_mutex_destroy (&mutex) == 0);
-
- log (" Destruction of mutex locked by another "
- "thread - ");
- assert (pthread_mutex_init (&mutex, &mattr) == 0);
- send_mutex_cmd (0, CMD_TAKE_MUTEX, &mutex);
- sleep (1);
- ret = pthread_mutex_destroy (&mutex);
- check_result (/* expected */ EBUSY, ret);
- send_cmd (0, CMD_RELEASE_ALL);
- sleep (1);
- assert (pthread_mutex_destroy (&mutex) == 0);
-
- log (" Destruction of mutex while being used in "
- "cond_wait - ");
- assert (pthread_mutex_init (&mutex, &mattr) == 0);
- assert (pthread_condattr_init (&cattr) == 0);
- assert (pthread_cond_init (&cv, &cattr) == 0);
- send_mutex_cv_cmd (0, CMD_WAIT_FOR_SIGNAL, &mutex, &cv);
- sleep (1);
- ret = pthread_mutex_destroy (&mutex);
- check_result (/* expected */ EBUSY, ret);
- pthread_cond_signal (&cv);
- sleep (1);
- assert (pthread_mutex_destroy (&mutex) == 0);
- }
- }
-}
-
-
-static void
-mutex_lock_test (void)
-{
- pthread_mutexattr_t mattr;
- pthread_mutex_t mutex;
- pthread_attr_t pattr;
- int mproto, ret;
- mutex_kind_t mkind;
- thread_state_t state;
-
- /*
- * Lock a mutex.
- *
- * pthread_lock not tested for:
- */
- log ("Testing pthread_mutex_lock\n");
- log ("--------------------------\n");
-
- assert (pthread_attr_init (&pattr) == 0);
- assert (pthread_attr_setdetachstate (&pattr,
- PTHREAD_CREATE_DETACHED) == 0);
- state.flags = 0; /* No flags yet. */
-
- for (mproto = 0; mproto < NELEMENTS(protocols); mproto++) {
- for (mkind = M_POSIX; mkind <= M_SS2_RECURSIVE; mkind++) {
- /* Initialize the mutex attribute. */
- assert (pthread_mutexattr_init (&mattr) == 0);
- assert (pthread_mutexattr_setprotocol (&mattr,
- protocols[mproto]) == 0);
-
- /*
- * Ensure that the first mutex type is a POSIX
- * compliant mutex.
- */
- if (mkind != M_POSIX) {
- assert (pthread_mutexattr_settype (&mattr,
- mutex_types[mkind]) == 0);
- }
-
- /* Create the mutex. */
- assert (pthread_mutex_init (&mutex, &mattr) == 0);
-
- log (" Protocol %s, Type %s\n",
- protocol_strs[mproto], mutextype_strs[mkind]);
-
- log (" Lock on unlocked mutex - ");
- ret = pthread_mutex_lock (&mutex);
- check_result (/* expected */ 0, ret);
- pthread_mutex_unlock (&mutex);
-
- log (" Lock on invalid mutex - ");
- ret = pthread_mutex_lock (NULL);
- check_result (/* expected */ EINVAL, ret);
-
- log (" Lock on mutex held by self - ");
- assert (pthread_create (&state.tid, &pattr, lock_twice,
- (void *) &state) == 0);
- /* Let the thread start. */
- sleep (1);
- state.cmd.mutex = &mutex;
- state.ret = 0xdeadbeef;
- assert (pthread_mutex_lock (&cond_mutex) == 0);
- assert (pthread_cond_signal (&cond_var) == 0);
- assert (pthread_mutex_unlock (&cond_mutex) == 0);
- /* Let the thread receive and process the command. */
- sleep (1);
-
- switch (mkind) {
- case M_POSIX:
- check_result (/* expected */ EDEADLK,
- state.ret);
- break;
- case M_SS2_DEFAULT:
- check_result (/* expected */ EDEADLK,
- state.ret);
- break;
- case M_SS2_ERRORCHECK:
- check_result (/* expected */ EDEADLK,
- state.ret);
- break;
- case M_SS2_NORMAL:
- check_result (/* expected */ 0xdeadbeef,
- state.ret);
- break;
- case M_SS2_RECURSIVE:
- check_result (/* expected */ 0, state.ret);
- break;
- }
- pthread_mutex_destroy (&mutex);
- pthread_mutexattr_destroy (&mattr);
- }
- }
-}
-
-
-static void
-mutex_unlock_test (void)
-{
- const int test_thread_id = 0; /* ID of test thread */
- pthread_mutexattr_t mattr;
- pthread_mutex_t mutex;
- int mproto, ret;
- mutex_kind_t mkind;
-
- /*
- * Unlock a mutex.
- *
- * pthread_unlock not tested for:
- */
- log ("Testing pthread_mutex_unlock\n");
- log ("----------------------------\n");
-
- for (mproto = 0; mproto < NELEMENTS(protocols); mproto++) {
- for (mkind = M_POSIX; mkind <= M_SS2_RECURSIVE; mkind++) {
- /* Initialize the mutex attribute. */
- assert (pthread_mutexattr_init (&mattr) == 0);
- assert (pthread_mutexattr_setprotocol (&mattr,
- protocols[mproto]) == 0);
-
- /*
- * Ensure that the first mutex type is a POSIX
- * compliant mutex.
- */
- if (mkind != M_POSIX) {
- assert (pthread_mutexattr_settype (&mattr,
- mutex_types[mkind]) == 0);
- }
-
- /* Create the mutex. */
- assert (pthread_mutex_init (&mutex, &mattr) == 0);
-
- log (" Protocol %s, Type %s\n",
- protocol_strs[mproto], mutextype_strs[mkind]);
-
- log (" Unlock on mutex held by self - ");
- assert (pthread_mutex_lock (&mutex) == 0);
- ret = pthread_mutex_unlock (&mutex);
- check_result (/* expected */ 0, ret);
-
- log (" Unlock on invalid mutex - ");
- ret = pthread_mutex_unlock (NULL);
- check_result (/* expected */ EINVAL, ret);
-
- log (" Unlock on mutex locked by another thread - ");
- send_mutex_cmd (test_thread_id, CMD_TAKE_MUTEX, &mutex);
- sleep (1);
- ret = pthread_mutex_unlock (&mutex);
- switch (mkind) {
- case M_POSIX:
- check_result (/* expected */ EPERM, ret);
- break;
- case M_SS2_DEFAULT:
- check_result (/* expected */ EPERM, ret);
- break;
- case M_SS2_ERRORCHECK:
- check_result (/* expected */ EPERM, ret);
- break;
- case M_SS2_NORMAL:
- check_result (/* expected */ EPERM, ret);
- break;
- case M_SS2_RECURSIVE:
- check_result (/* expected */ EPERM, ret);
- break;
- }
- if (ret == 0) {
- /*
- * If for some reason we were able to unlock
- * the mutex, relock it so that the test
- * thread has no problems releasing the mutex.
- */
- pthread_mutex_lock (&mutex);
- }
- send_cmd (test_thread_id, CMD_RELEASE_ALL);
- sleep (1);
-
- pthread_mutex_destroy (&mutex);
- pthread_mutexattr_destroy (&mattr);
- }
- }
-}
-
-
-static void
-queueing_order_test (void)
-{
- int i;
-
- log ("Testing queueing order\n");
- log ("----------------------\n");
- assert (pthread_mutex_lock (&waiter_mutex) == 0);
- /*
- * Tell the threads to report when they take the waiters mutex.
- */
- assert (pthread_mutex_lock (&cond_mutex) == 0);
- for (i = 0; i < NUM_THREADS; i++) {
- states[i].flags = FLAGS_REPORT_WAITMUTEX;
- assert (pthread_cond_signal (&states[i].cond_var) == 0);
- }
- assert (pthread_mutex_unlock (&cond_mutex) == 0);
-
- /* Signal the threads to continue. */
- sleep (1);
-
- /* Use the global condition variable next time. */
- use_global_condvar = 1;
-
- /* Release the waiting threads and allow them to run again. */
- assert (pthread_mutex_unlock (&waiter_mutex) == 0);
- sleep (1);
-
- log (" Queueing order on a mutex - ");
- check_run_order ("9,8,7,6,5,4,3,2,1,0");
- for (i = 0; i < NUM_THREADS; i = i + 1) {
- /* Tell the threads to report when they've been signaled. */
- states[i].flags = FLAGS_REPORT_WAITCONDVAR;
- }
-
- /*
- * Prevent the threads from continuing their loop after we
- * signal them.
- */
- assert (pthread_mutex_lock (&waiter_mutex) == 0);
-
-
- log (" Queueing order on a condition variable - ");
- /*
- * Signal one thread to run and see that the highest priority
- * thread executes.
- */
- assert (pthread_mutex_lock (&cond_mutex) == 0);
- assert (pthread_cond_signal (&cond_var) == 0);
- assert (pthread_mutex_unlock (&cond_mutex) == 0);
- sleep (1);
- if (states[NUM_THREADS - 1].status != STAT_WAITMUTEX)
- log_error ("highest priority thread does not run.\n");
-
- /* Signal the remaining threads. */
- assert (pthread_mutex_lock (&cond_mutex) == 0);
- assert (pthread_cond_broadcast (&cond_var) == 0);
- assert (pthread_mutex_unlock (&cond_mutex) == 0);
- sleep (1);
-
- check_run_order ("9,8,7,6,5,4,3,2,1,0");
- for (i = 0; i < NUM_THREADS; i = i + 1) {
- /* Tell the threads not to report anything. */
- states[i].flags = 0;
- }
-
- /* Use the thread unique condition variable next time. */
- use_global_condvar = 0;
-
- /* Allow the threads to continue their loop. */
- assert (pthread_mutex_unlock (&waiter_mutex) == 0);
- sleep (1);
-}
-
-
-static void
-mutex_prioceiling_test (void)
-{
- const int test_thread_id = 0; /* ID of test thread */
- pthread_mutexattr_t mattr;
- struct sched_param param;
- pthread_mutex_t m[3];
- mutex_kind_t mkind;
- int i, ret, policy, my_prio, old_ceiling;
-
- log ("Testing priority ceilings\n");
- log ("-------------------------\n");
- for (mkind = M_POSIX; mkind <= M_SS2_RECURSIVE; mkind++) {
-
- log (" Protype PTHREAD_PRIO_PROTECT, Type %s\n",
- mutextype_strs[mkind]);
-
- /*
- * Initialize and create a mutex.
- */
- assert (pthread_mutexattr_init (&mattr) == 0);
-
- /* Get this threads current priority. */
- assert (pthread_getschedparam (pthread_self(), &policy,
- &param) == 0);
- my_prio = param.sched_priority; /* save for later use */
- log_trace ("Current scheduling policy %d, priority %d\n",
- policy, my_prio);
-
- /*
- * Initialize and create 3 priority protection mutexes with
- * default (max priority) ceilings.
- */
- assert (pthread_mutexattr_setprotocol(&mattr,
- PTHREAD_PRIO_PROTECT) == 0);
-
- /*
- * Ensure that the first mutex type is a POSIX
- * compliant mutex.
- */
- if (mkind != M_POSIX) {
- assert (pthread_mutexattr_settype (&mattr,
- mutex_types[mkind]) == 0);
- }
-
- for (i = 0; i < 3; i++)
- assert (pthread_mutex_init (&m[i], &mattr) == 0);
-
- /*
- * Set the ceiling priorities for the 3 priority protection
- * mutexes to, 5 less than, equal to, and 5 greater than,
- * this threads current priority.
- */
- for (i = 0; i < 3; i++)
- assert (pthread_mutex_setprioceiling (&m[i],
- my_prio - 5 + 5*i, &old_ceiling) == 0);
-
- /*
- * Check that if we attempt to take a mutex whose priority
- * ceiling is lower than our priority, we get an error.
- */
- log (" Lock with ceiling priority < thread priority - ");
- ret = pthread_mutex_lock (&m[0]);
- check_result (/* expected */ EINVAL, ret);
- if (ret == 0)
- pthread_mutex_unlock (&m[0]);
-
- /*
- * Check that we can take a mutex whose priority ceiling
- * is equal to our priority.
- */
- log (" Lock with ceiling priority = thread priority - ");
- ret = pthread_mutex_lock (&m[1]);
- check_result (/* expected */ 0, ret);
- if (ret == 0)
- pthread_mutex_unlock (&m[1]);
-
- /*
- * Check that we can take a mutex whose priority ceiling
- * is higher than our priority.
- */
- log (" Lock with ceiling priority > thread priority - ");
- ret = pthread_mutex_lock (&m[2]);
- check_result (/* expected */ 0, ret);
- if (ret == 0)
- pthread_mutex_unlock (&m[2]);
-
- /*
- * Have the test thread go into a busy loop for 5 seconds
- * and see that it doesn't block this thread (since the
- * priority ceiling of mutex 0 and the priority of the test
- * thread are both less than the priority of this thread).
- */
- log (" Preemption with ceiling priority < thread "
- "priority - ");
- /* Have the test thread take mutex 0. */
- send_mutex_cmd (test_thread_id, CMD_TAKE_MUTEX, &m[0]);
- sleep (1);
-
- log_trace ("Sending busy command.\n");
- send_cmd (test_thread_id, CMD_BUSY_LOOP);
- log_trace ("Busy sent, yielding\n");
- pthread_yield ();
- log_trace ("Returned from yield.\n");
- if (states[test_thread_id].flags &
- (FLAGS_IS_BUSY | FLAGS_WAS_BUSY))
- log_error ("test thread inproperly preempted us.\n");
- else {
- /* Let the thread finish its busy loop. */
- sleep (6);
- if ((states[test_thread_id].flags & FLAGS_WAS_BUSY) == 0)
- log_error ("test thread never finished.\n");
- else
- log_pass ();
- }
- states[test_thread_id].flags &= ~FLAGS_WAS_BUSY;
-
- /* Have the test thread release mutex 0. */
- send_cmd (test_thread_id, CMD_RELEASE_ALL);
- sleep (1);
-
- /*
- * Have the test thread go into a busy loop for 5 seconds
- * and see that it preempts this thread (since the priority
- * ceiling of mutex 1 is the same as the priority of this
- * thread). The test thread should not run to completion
- * as its time quantum should expire before the 5 seconds
- * are up.
- */
- log (" Preemption with ceiling priority = thread "
- "priority - ");
-
- /* Have the test thread take mutex 1. */
- send_mutex_cmd (test_thread_id, CMD_TAKE_MUTEX, &m[1]);
- sleep (1);
-
- log_trace ("Sending busy\n");
- send_cmd (test_thread_id, CMD_BUSY_LOOP);
- log_trace ("Busy sent, yielding\n");
- pthread_yield ();
- log_trace ("Returned from yield.\n");
- if ((states[test_thread_id].flags & FLAGS_IS_BUSY) == 0)
- log_error ("test thread did not switch in on yield.\n");
- else if (states[test_thread_id].flags & FLAGS_WAS_BUSY)
- log_error ("test thread ran to completion.\n");
- else {
- /* Let the thread finish its busy loop. */
- sleep (6);
- if ((states[test_thread_id].flags & FLAGS_WAS_BUSY) == 0)
- log_error ("test thread never finished.\n");
- else
- log_pass ();
- }
- states[test_thread_id].flags &= ~FLAGS_WAS_BUSY;
-
- /* Have the test thread release mutex 1. */
- send_cmd (test_thread_id, CMD_RELEASE_ALL);
- sleep (1);
-
- /*
- * Set the scheduling policy of the test thread to SCHED_FIFO
- * and have it go into a busy loop for 5 seconds. This
- * thread is SCHED_RR, and since the priority ceiling of
- * mutex 1 is the same as the priority of this thread, the
- * test thread should run to completion once it is switched
- * in.
- */
- log (" SCHED_FIFO scheduling and ceiling priority = "
- "thread priority - ");
- param.sched_priority = states[test_thread_id].priority;
- assert (pthread_setschedparam (states[test_thread_id].tid,
- SCHED_FIFO, &param) == 0);
-
- /* Have the test thread take mutex 1. */
- send_mutex_cmd (test_thread_id, CMD_TAKE_MUTEX, &m[1]);
- sleep (1);
-
- log_trace ("Sending busy\n");
- send_cmd (test_thread_id, CMD_BUSY_LOOP);
- log_trace ("Busy sent, yielding\n");
- pthread_yield ();
- log_trace ("Returned from yield.\n");
- if ((states[test_thread_id].flags & FLAGS_WAS_BUSY) == 0) {
- log_error ("test thread did not run to completion.\n");
- /* Let the thread finish it's busy loop. */
- sleep (6);
- }
- else
- log_pass ();
- states[test_thread_id].flags &= ~FLAGS_WAS_BUSY;
-
- /* Restore the test thread scheduling parameters. */
- param.sched_priority = states[test_thread_id].priority;
- assert (pthread_setschedparam (states[test_thread_id].tid,
- SCHED_RR, &param) == 0);
-
- /* Have the test thread release mutex 1. */
- send_cmd (test_thread_id, CMD_RELEASE_ALL);
- sleep (1);
-
- /*
- * Have the test thread go into a busy loop for 5 seconds
- * and see that it preempts this thread (since the priority
- * ceiling of mutex 2 is the greater than the priority of
- * this thread). The test thread should run to completion
- * and block this thread because its active priority is
- * higher.
- */
- log (" SCHED_FIFO scheduling and ceiling priority > "
- "thread priority - ");
- /* Have the test thread take mutex 2. */
- send_mutex_cmd (test_thread_id, CMD_TAKE_MUTEX, &m[2]);
- sleep (1);
-
- log_trace ("Sending busy\n");
- send_cmd (test_thread_id, CMD_BUSY_LOOP);
- log_trace ("Busy sent, yielding\n");
- pthread_yield ();
- log_trace ("Returned from yield.\n");
- if ((states[test_thread_id].flags & FLAGS_IS_BUSY) != 0) {
- log_error ("test thread did not run to completion.\n");
- /* Let the thread finish it's busy loop. */
- sleep (6);
- }
- else if ((states[test_thread_id].flags & FLAGS_WAS_BUSY) == 0)
- log_error ("test thread never finished.\n");
- else
- log_pass ();
- states[test_thread_id].flags &= ~FLAGS_WAS_BUSY;
-
- /* Have the test thread release mutex 2. */
- send_cmd (test_thread_id, CMD_RELEASE_ALL);
- sleep (1);
-
- /* Destroy the mutexes. */
- for (i = 0; i < 3; i++)
- assert (pthread_mutex_destroy (&m[i]) == 0);
- }
-}
-
-
-static void
-mutex_prioinherit_test (void)
-{
- pthread_mutexattr_t mattr;
- struct sched_param param;
- pthread_mutex_t m[3];
- mutex_kind_t mkind;
- int i, policy, my_prio;
-
- /* Get this threads current priority. */
- assert (pthread_getschedparam (pthread_self(), &policy,
- &param) == 0);
- my_prio = param.sched_priority; /* save for later use */
- log_trace ("Current scheduling policy %d, priority %d\n",
- policy, my_prio);
-
- log ("Testing priority inheritence\n");
- log ("----------------------------\n");
- for (mkind = M_POSIX; mkind <= M_SS2_RECURSIVE; mkind++) {
-
- log (" Protype PTHREAD_PRIO_INHERIT, Type %s\n",
- mutextype_strs[mkind]);
-
- /*
- * Initialize and create a mutex.
- */
- assert (pthread_mutexattr_init (&mattr) == 0);
-
- /*
- * Initialize and create 3 priority inheritence mutexes with
- * default (max priority) ceilings.
- */
- assert (pthread_mutexattr_setprotocol(&mattr,
- PTHREAD_PRIO_INHERIT) == 0);
-
- /*
- * Ensure that the first mutex type is a POSIX
- * compliant mutex.
- */
- if (mkind != M_POSIX) {
- assert (pthread_mutexattr_settype (&mattr,
- mutex_types[mkind]) == 0);
- }
-
- for (i = 0; i < 3; i++)
- assert (pthread_mutex_init (&m[i], &mattr) == 0);
-
- /*
- * Test setup:
- * Thread 4 - take mutex 0, 1
- * Thread 2 - enter protected busy loop with mutex 0
- * Thread 3 - enter protected busy loop with mutex 1
- * Thread 4 - enter protected busy loop with mutex 2
- * Thread 5 - enter busy loop
- * Thread 6 - enter protected busy loop with mutex 0
- * Thread 4 - releases mutexes 1 and 0.
- *
- * Expected results:
- * Threads complete in order 4, 6, 5, 3, 2
- */
- log (" Simple inheritence test - ");
-
- /*
- * Command thread 4 to take mutexes 0 and 1.
- */
- send_mutex_cmd (4, CMD_TAKE_MUTEX, &m[0]);
- sleep (1); /* Allow command to be received. */
- send_mutex_cmd (4, CMD_TAKE_MUTEX, &m[1]);
- sleep (1);
-
- /*
- * Tell the threads to report themselves when they are
- * at the bottom of their loop (waiting on wait_mutex).
- */
- for (i = 0; i < NUM_THREADS; i++)
- states[i].flags |= FLAGS_REPORT_WAITMUTEX;
-
- /*
- * Command thread 2 to take mutex 0 and thread 3 to take
- * mutex 1, both via a protected operation command. Since
- * thread 4 owns mutexes 0 and 1, both threads 2 and 3
- * will block until the mutexes are released by thread 4.
- */
- log_trace ("Commanding protected operation to thread 2.\n");
- send_mutex_cmd (2, CMD_PROTECTED_OP, &m[0]);
- log_trace ("Commanding protected operation to thread 3.\n");
- send_mutex_cmd (3, CMD_PROTECTED_OP, &m[1]);
- sleep (1);
-
- /*
- * Command thread 4 to take mutex 2 via a protected operation
- * and thread 5 to enter a busy loop for 5 seconds. Since
- * thread 5 has higher priority than thread 4, thread 5 will
- * enter the busy loop before thread 4 is activated.
- */
- log_trace ("Commanding protected operation to thread 4.\n");
- send_mutex_cmd (4, CMD_PROTECTED_OP, &m[2]);
- log_trace ("Commanding busy loop to thread 5.\n");
- send_cmd (5, CMD_BUSY_LOOP);
- sleep (1);
- if ((states[5].flags & FLAGS_IS_BUSY) == 0)
- log_error ("thread 5 is not running.\n");
- log_trace ("Commanding protected operation thread 6.\n");
- send_mutex_cmd (6, CMD_PROTECTED_OP, &m[0]);
- sleep (1);
- if ((states[4].flags & FLAGS_WAS_BUSY) == 0)
- log_error ("thread 4 failed to inherit priority.\n");
- states[4].flags = 0;
- send_cmd (4, CMD_RELEASE_ALL);
- sleep (5);
- check_run_order ("4,6,5,3,2");
-
- /*
- * Clear the flags.
- */
- for (i = 0; i < NUM_THREADS; i++)
- states[i].flags = 0;
-
- /*
- * Test setup:
- * Thread 2 - enter busy loop (SCHED_FIFO)
- * Thread 4 - take mutex 0
- * Thread 4 - priority change to same priority as thread 2
- * Thread 4 - release mutex 0
- *
- * Expected results:
- * Since thread 4 owns a priority mutex, it should be
- * placed at the front of the run queue (for its new
- * priority slot) when its priority is lowered to the
- * same priority as thread 2. If thread 4 did not own
- * a priority mutex, then it would have been added to
- * the end of the run queue and thread 2 would have
- * executed until it blocked (because it's scheduling
- * policy is SCHED_FIFO).
- *
- */
- log (" Inheritence test with change of priority - ");
-
- /*
- * Change threads 2 and 4 scheduling policies to be
- * SCHED_FIFO.
- */
- param.sched_priority = states[2].priority;
- assert (pthread_setschedparam (states[2].tid, SCHED_FIFO,
- &param) == 0);
- param.sched_priority = states[4].priority;
- assert (pthread_setschedparam (states[4].tid, SCHED_FIFO,
- &param) == 0);
-
- /*
- * Command thread 4 to take mutex 0.
- */
- send_mutex_cmd (4, CMD_TAKE_MUTEX, &m[0]);
- sleep (1);
-
- /*
- * Command thread 2 to enter busy loop.
- */
- send_cmd (2, CMD_BUSY_LOOP);
- sleep (1); /* Allow command to be received. */
-
- /*
- * Command thread 4 to enter busy loop.
- */
- send_cmd (4, CMD_BUSY_LOOP);
- sleep (1); /* Allow command to be received. */
-
- /* Have threads 2 and 4 report themselves. */
- states[2].flags = FLAGS_REPORT_WAITMUTEX;
- states[4].flags = FLAGS_REPORT_WAITMUTEX;
-
- /* Change the priority of thread 4. */
- param.sched_priority = states[2].priority;
- assert (pthread_setschedparam (states[4].tid, SCHED_FIFO,
- &param) == 0);
- sleep (5);
- check_run_order ("4,2");
-
- /* Clear the flags */
- states[2].flags = 0;
- states[4].flags = 0;
-
- /* Reset the policies. */
- param.sched_priority = states[2].priority;
- assert (pthread_setschedparam (states[2].tid, SCHED_RR,
- &param) == 0);
- param.sched_priority = states[4].priority;
- assert (pthread_setschedparam (states[4].tid, SCHED_RR,
- &param) == 0);
-
- send_cmd (4, CMD_RELEASE_MUTEX);
- sleep (1);
-
- /* Destroy the mutexes. */
- for (i = 0; i < 3; i++)
- assert (pthread_mutex_destroy (&m[i]) == 0);
- }
-}
-
-
-int main (int argc, char *argv[])
-{
- pthread_mutexattr_t mattr;
- pthread_condattr_t cattr;
- pthread_attr_t pattr;
- int i, policy, main_prio;
- void * exit_status;
- sigset_t mask;
- struct sigaction act;
- struct sched_param param;
-
- logfile = stdout;
-
- assert (pthread_getschedparam (pthread_self (), &policy, &param) == 0);
- main_prio = param.sched_priority;
-
- /* Setupt our signal mask. */
- sigfillset (&mask);
- sigdelset (&mask, SIGINT);
- sigprocmask (SIG_SETMASK, &mask, NULL);
-
- /* Install a signal handler for SIGINT */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGINT);
- act.sa_handler = sighandler;
- act.sa_flags = SA_RESTART;
- sigaction (SIGINT, &act, NULL);
-
- /* This test relies on the concurrency level being 1. */
- pthread_setconcurrency(1);
-
- /*
- * Initialize the thread attribute.
- */
- assert (pthread_attr_init (&pattr) == 0);
- assert (pthread_attr_setdetachstate (&pattr,
- PTHREAD_CREATE_JOINABLE) == 0);
-
- /*
- * Initialize and create the waiter and condvar mutexes.
- */
- assert (pthread_mutexattr_init (&mattr) == 0);
- assert (pthread_mutex_init (&waiter_mutex, &mattr) == 0);
- assert (pthread_mutex_init (&cond_mutex, &mattr) == 0);
-
- /*
- * Initialize and create a condition variable.
- */
- assert (pthread_condattr_init (&cattr) == 0);
- assert (pthread_cond_init (&cond_var, &cattr) == 0);
-
- /* Create a pipe to catch the results of thread wakeups. */
- assert (pipe (pipefd) == 0);
-
-#ifdef DEBUG
- assert (pthread_switch_add_np (kern_switch) == 0);
-#endif
-
- /*
- * Create the waiting threads.
- */
- for (i = 0; i < NUM_THREADS; i++) {
- assert (pthread_cond_init (&states[i].cond_var, &cattr) == 0);
- states[i].id = (u_int8_t) i; /* NUM_THREADS must be <= 256 */
- states[i].status = 0;
- states[i].cmd.cmd_id = CMD_NONE;
- states[i].flags = 0; /* No flags yet. */
- assert (pthread_create (&states[i].tid, &pattr, waiter,
- (void *) &states[i]) == 0);
- param.sched_priority = main_prio - 10 + i;
- states[i].priority = param.sched_priority;
- assert (pthread_setschedparam (states[i].tid, SCHED_OTHER,
- &param) == 0);
-#if defined(_LIBC_R_)
- {
- char buf[30];
-
- snprintf (buf, sizeof(buf), "waiter_%d", i);
- pthread_set_name_np (states[i].tid, buf);
- }
-#endif
- }
-
- /* Allow the threads to start. */
- sleep (1);
- log_trace ("Done creating threads.\n");
-
- log ("\n");
- mutex_init_test ();
- log ("\n");
- mutex_destroy_test ();
- log ("\n");
- mutex_lock_test ();
- log ("\n");
- mutex_unlock_test ();
- log ("\n");
- queueing_order_test ();
- log ("\n");
- mutex_prioinherit_test ();
- log ("\n");
- mutex_prioceiling_test ();
- log ("\n");
-
- log ("Total tests %d, passed %d, failed %d\n",
- total, pass_count, error_count);
-
- /* Set the done flag and signal the threads to exit. */
- log_trace ("Setting done flag.\n");
- done = 1;
-
- /*
- * Wait for the threads to finish.
- */
- log_trace ("Trying to join threads.\n");
- for (i = 0; i < NUM_THREADS; i++) {
- send_cmd (i, CMD_NONE);
- assert (pthread_join (states[i].tid, &exit_status) == 0);
- }
-
- /* Clean up after ourselves. */
- close (pipefd[0]);
- close (pipefd[1]);
-
- if (error_count != 0)
- exit (EX_OSERR); /* any better ideas??? */
- else
- exit (EX_OK);
-}
diff --git a/lib/libkse/test/mutex_d.exp b/lib/libkse/test/mutex_d.exp
deleted file mode 100644
index de8a4e4..0000000
--- a/lib/libkse/test/mutex_d.exp
+++ /dev/null
@@ -1,290 +0,0 @@
-
-Testing pthread_mutex_init
---------------------------
- Protocol PTHREAD_PRIO_NONE, Type POSIX (type not specified) - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_DEFAULT - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_ERRORCHECK - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_NORMAL - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_RECURSIVE - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type POSIX (type not specified) - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_DEFAULT - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_ERRORCHECK - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_NORMAL - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_RECURSIVE - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type POSIX (type not specified) - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_DEFAULT - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_ERRORCHECK - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_NORMAL - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_RECURSIVE - PASS
-
-Testing pthread_mutex_destroy
------------------------------
- Protocol PTHREAD_PRIO_NONE, Type POSIX (type not specified)
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_DEFAULT
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_NORMAL
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type POSIX (type not specified)
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_DEFAULT
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_NORMAL
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type POSIX (type not specified)
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_DEFAULT
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_NORMAL
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Destruction of unused mutex - PASS
- Destruction of mutex locked by self - PASS
- Destruction of mutex locked by another thread - PASS
- Destruction of mutex while being used in cond_wait - PASS
-
-Testing pthread_mutex_lock
---------------------------
- Protocol PTHREAD_PRIO_NONE, Type POSIX (type not specified)
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_DEFAULT
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_NORMAL
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type POSIX (type not specified)
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_DEFAULT
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_NORMAL
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type POSIX (type not specified)
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_DEFAULT
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_NORMAL
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Lock on unlocked mutex - PASS
- Lock on invalid mutex - PASS
- Lock on mutex held by self - PASS
-
-Testing pthread_mutex_unlock
-----------------------------
- Protocol PTHREAD_PRIO_NONE, Type POSIX (type not specified)
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_DEFAULT
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_NORMAL
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_NONE, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type POSIX (type not specified)
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_DEFAULT
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_NORMAL
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type POSIX (type not specified)
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_DEFAULT
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_NORMAL
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
- Protocol PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Unlock on mutex held by self - PASS
- Unlock on invalid mutex - PASS
- Unlock on mutex locked by another thread - PASS
-
-Testing queueing order
-----------------------
- Queueing order on a mutex - PASS
- Queueing order on a condition variable - PASS
-
-Testing priority inheritence
-----------------------------
- Protype PTHREAD_PRIO_INHERIT, Type POSIX (type not specified)
- Simple inheritence test - PASS
- Inheritence test with change of priority - PASS
- Protype PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_DEFAULT
- Simple inheritence test - PASS
- Inheritence test with change of priority - PASS
- Protype PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Simple inheritence test - PASS
- Inheritence test with change of priority - PASS
- Protype PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_NORMAL
- Simple inheritence test - PASS
- Inheritence test with change of priority - PASS
- Protype PTHREAD_PRIO_INHERIT, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Simple inheritence test - PASS
- Inheritence test with change of priority - PASS
-
-Testing priority ceilings
--------------------------
- Protype PTHREAD_PRIO_PROTECT, Type POSIX (type not specified)
- Lock with ceiling priority < thread priority - PASS
- Lock with ceiling priority = thread priority - PASS
- Lock with ceiling priority > thread priority - PASS
- Preemption with ceiling priority < thread priority - PASS
- Preemption with ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority > thread priority - PASS
- Protype PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_DEFAULT
- Lock with ceiling priority < thread priority - PASS
- Lock with ceiling priority = thread priority - PASS
- Lock with ceiling priority > thread priority - PASS
- Preemption with ceiling priority < thread priority - PASS
- Preemption with ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority > thread priority - PASS
- Protype PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_ERRORCHECK
- Lock with ceiling priority < thread priority - PASS
- Lock with ceiling priority = thread priority - PASS
- Lock with ceiling priority > thread priority - PASS
- Preemption with ceiling priority < thread priority - PASS
- Preemption with ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority > thread priority - PASS
- Protype PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_NORMAL
- Lock with ceiling priority < thread priority - PASS
- Lock with ceiling priority = thread priority - PASS
- Lock with ceiling priority > thread priority - PASS
- Preemption with ceiling priority < thread priority - PASS
- Preemption with ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority > thread priority - PASS
- Protype PTHREAD_PRIO_PROTECT, Type SS2 PTHREAD_MUTEX_RECURSIVE
- Lock with ceiling priority < thread priority - PASS
- Lock with ceiling priority = thread priority - PASS
- Lock with ceiling priority > thread priority - PASS
- Preemption with ceiling priority < thread priority - PASS
- Preemption with ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority = thread priority - PASS
- SCHED_FIFO scheduling and ceiling priority > thread priority - PASS
-
-Total tests 212, passed 212, failed 0
diff --git a/lib/libkse/test/propagate_s.pl b/lib/libkse/test/propagate_s.pl
deleted file mode 100644
index 6b85090..0000000
--- a/lib/libkse/test/propagate_s.pl
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice(s), this list of conditions and the following disclaimer as
-# the first lines of this file unmodified other than the possible
-# addition of one or more copyright notices.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice(s), this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-###########################################################################
-#
-# Verify that no cancellation points are propagated inside of libpthread.
-#
-# $FreeBSD$
-#
-
-@CPOINTS = ("aio_suspend", "close", "creat", "fcntl", "fsync", "mq_receive",
- "mq_send", "msync", "nanosleep", "open", "pause",
- "pthread_cond_timedwait", "pthread_cond_wait", "pthread_join",
- "pthread_testcancel", "read", "sem_wait", "sigsuspend",
- "sigtimedwait", "sigwait", "sigwaitinfo", "sleep", "system",
- "tcdrain", "wait", "waitpid", "write");
-
-print "1..1\n";
-
-$cpoints = join '\|', @CPOINTS;
-$regexp = "\" U \\(" . $cpoints . "\\\)\$\"";
-
-`nm -a /usr/lib/libc.a |grep $regexp >propagate_s.out`;
-if (!open (NMOUT, "<./propagate_s.out"))
-{
- print "not ok 1\n";
-}
-else
-{
- $propagations = 0;
-
- while (<NMOUT>)
- {
- $propagations++;
- print "$_\n";
- }
- if ($propagations != 0)
- {
- print "$propagations propagation(s)\n";
- print "not ok 1\n";
- }
- else
- {
- print "ok 1\n";
- }
- close NMOUT;
- unlink "propagate_s.out";
-}
diff --git a/lib/libkse/test/sem_d.c b/lib/libkse/test/sem_d.c
deleted file mode 100644
index b834591..0000000
--- a/lib/libkse/test/sem_d.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
- *
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************
- *
- * sem test.
- *
- * $FreeBSD$
- *
- ****************************************************************************/
-
-#include <assert.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <semaphore.h>
-#include <pthread.h>
-
-#define NTHREADS 10
-
-void *
-entry(void * a_arg)
-{
- sem_t * sem = (sem_t *) a_arg;
-
- sem_wait(sem);
- fprintf(stderr, "Got semaphore\n");
-
- return NULL;
-}
-
-int
-main()
-{
- sem_t sem_a, sem_b;
- pthread_t threads[NTHREADS];
- unsigned i;
- int val;
-
- fprintf(stderr, "Test begin\n");
-
-#ifdef _LIBC_R_
- assert(-1 == sem_init(&sem_b, 1, 0));
- assert(EPERM == errno);
-#endif
-
- assert(0 == sem_init(&sem_b, 0, 0));
- assert(0 == sem_getvalue(&sem_b, &val));
- assert(0 == val);
-
- assert(0 == sem_post(&sem_b));
- assert(0 == sem_getvalue(&sem_b, &val));
- assert(1 == val);
-
- assert(0 == sem_wait(&sem_b));
- assert(-1 == sem_trywait(&sem_b));
- assert(EAGAIN == errno);
- assert(0 == sem_post(&sem_b));
- assert(0 == sem_trywait(&sem_b));
- assert(0 == sem_post(&sem_b));
- assert(0 == sem_wait(&sem_b));
- assert(0 == sem_post(&sem_b));
-
-#ifdef _LIBC_R_
- assert(SEM_FAILED == sem_open("/foo", O_CREAT | O_EXCL, 0644, 0));
- assert(ENOSYS == errno);
-
- assert(-1 == sem_close(&sem_b));
- assert(ENOSYS == errno);
-
- assert(-1 == sem_unlink("/foo"));
- assert(ENOSYS == errno);
-#endif
-
- assert(0 == sem_destroy(&sem_b));
-
- assert(0 == sem_init(&sem_a, 0, 0));
-
- for (i = 0; i < NTHREADS; i++) {
- pthread_create(&threads[i], NULL, entry, (void *) &sem_a);
- }
-
- for (i = 0; i < NTHREADS; i++) {
- assert(0 == sem_post(&sem_a));
- }
-
- for (i = 0; i < NTHREADS; i++) {
- pthread_join(threads[i], NULL);
- }
-
- for (i = 0; i < NTHREADS; i++) {
- pthread_create(&threads[i], NULL, entry, (void *) &sem_a);
- }
-
- for (i = 0; i < NTHREADS; i++) {
- assert(0 == sem_post(&sem_a));
- }
-
- for (i = 0; i < NTHREADS; i++) {
- pthread_join(threads[i], NULL);
- }
-
- assert(0 == sem_destroy(&sem_a));
-
- fprintf(stderr, "Test end\n");
- return 0;
-}
diff --git a/lib/libkse/test/sem_d.exp b/lib/libkse/test/sem_d.exp
deleted file mode 100644
index b0de3da..0000000
--- a/lib/libkse/test/sem_d.exp
+++ /dev/null
@@ -1,22 +0,0 @@
-Test begin
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Got semaphore
-Test end
diff --git a/lib/libkse/test/sigsuspend_d.c b/lib/libkse/test/sigsuspend_d.c
deleted file mode 100644
index aa80a07..0000000
--- a/lib/libkse/test/sigsuspend_d.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel M. Eischen <eischen@vigrid.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 M. Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL M. EISCHEN AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-
-#if defined(_LIBC_R_)
-#include <pthread_np.h>
-#endif
-
-static int sigcounts[NSIG + 1];
-static int sigfifo[NSIG + 1];
-static int fifo_depth = 0;
-static sigset_t suspender_mask;
-static pthread_t suspender_tid;
-
-
-static void *
-sigsuspender (void *arg)
-{
- int save_count, status, i;
- sigset_t run_mask;
-
- /* Run with all signals blocked. */
- sigfillset (&run_mask);
- sigprocmask (SIG_SETMASK, &run_mask, NULL);
-
- /* Allow these signals to wake us up during a sigsuspend. */
- sigfillset (&suspender_mask); /* Default action */
- sigdelset (&suspender_mask, SIGKILL); /* Cannot catch */
- sigdelset (&suspender_mask, SIGSTOP); /* Cannot catch */
- sigdelset (&suspender_mask, SIGINT); /* terminate */
- sigdelset (&suspender_mask, SIGHUP); /* terminate */
- sigdelset (&suspender_mask, SIGQUIT); /* create core image */
- sigdelset (&suspender_mask, SIGURG); /* ignore */
- sigdelset (&suspender_mask, SIGIO); /* ignore */
- sigdelset (&suspender_mask, SIGUSR2); /* terminate */
-
- while (sigcounts[SIGINT] == 0) {
- save_count = sigcounts[SIGUSR2];
-
- status = sigsuspend (&suspender_mask);
- if ((status == 0) || (errno != EINTR)) {
- fprintf (stderr, "Unable to suspend for signals, "
- "errno %d, return value %d\n",
- errno, status);
- exit (1);
- }
- for (i = 0; i < fifo_depth; i++)
- fprintf (stderr, "Sigsuspend woke up by signal %d\n",
- sigfifo[i]);
- fifo_depth = 0;
- }
-
- pthread_exit (arg);
- return (NULL);
-}
-
-
-static void
-sighandler (int signo)
-{
- sigset_t set, suspend_set;
- pthread_t self;
-
- if ((signo >= 0) && (signo <= NSIG))
- sigcounts[signo]++;
-
- /*
- * If we are running on behalf of the suspender thread,
- * ensure that we have the correct mask set.
- */
- self = pthread_self ();
- if (self == suspender_tid) {
- sigfifo[fifo_depth] = signo;
- fifo_depth++;
- fprintf (stderr,
- " -> Suspender thread signal handler caught signal %d\n",
- signo);
-
- /* Get the current signal mask. */
- sigprocmask (SIG_SETMASK, NULL, &set);
-
- /* The handler should run with the current signal masked. */
- suspend_set = suspender_mask;
- sigaddset(&suspend_set, signo);
-
- if (memcmp(&set, &suspend_set, sizeof(set)))
- fprintf (stderr,
- " >>> FAIL: sigsuspender signal handler running "
- "with incorrect mask.\n");
- }
- else
- fprintf (stderr,
- " -> Main thread signal handler caught signal %d\n",
- signo);
-}
-
-
-static void
-send_thread_signal (pthread_t tid, int signo)
-{
- if (pthread_kill (tid, signo) != 0) {
- fprintf (stderr, "Unable to send thread signal, errno %d.\n",
- errno);
- exit (1);
- }
-}
-
-
-static void
-send_process_signal (int signo)
-{
- if (kill (getpid (), signo) != 0) {
- fprintf (stderr, "Unable to send process signal, errno %d.\n",
- errno);
- exit (1);
- }
-}
-
-
-int main (int argc, char *argv[])
-{
- pthread_attr_t pattr;
- void * exit_status;
- struct sigaction act;
- sigset_t oldset;
- sigset_t newset;
-
- /* Initialize our signal counts. */
- memset ((void *) sigcounts, 0, NSIG * sizeof (int));
-
- /* Ignore signal SIGIO. */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGIO);
- act.sa_handler = SIG_IGN;
- act.sa_flags = 0;
- sigaction (SIGIO, &act, NULL);
-
- /* Install a signal handler for SIGURG. */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGURG);
- act.sa_handler = sighandler;
- act.sa_flags = SA_RESTART;
- sigaction (SIGURG, &act, NULL);
-
- /* Install a signal handler for SIGXCPU */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGXCPU);
- sigaction (SIGXCPU, &act, NULL);
-
- /* Get our current signal mask. */
- sigprocmask (SIG_SETMASK, NULL, &oldset);
-
- /* Mask out SIGUSR1 and SIGUSR2. */
- newset = oldset;
- sigaddset (&newset, SIGUSR1);
- sigaddset (&newset, SIGUSR2);
- sigprocmask (SIG_SETMASK, &newset, NULL);
-
- /* Install a signal handler for SIGUSR1 */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGUSR1);
- sigaction (SIGUSR1, &act, NULL);
-
- /* Install a signal handler for SIGUSR2 */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGUSR2);
- sigaction (SIGUSR2, &act, NULL);
-
- /*
- * Initialize the thread attribute.
- */
- if ((pthread_attr_init (&pattr) != 0) ||
- (pthread_attr_setdetachstate (&pattr,
- PTHREAD_CREATE_JOINABLE) != 0)) {
- fprintf (stderr, "Unable to initialize thread attributes.\n");
- exit (1);
- }
-
- /*
- * Create the sigsuspender thread.
- */
- if (pthread_create (&suspender_tid, &pattr, sigsuspender, NULL) != 0) {
- fprintf (stderr, "Unable to create thread, errno %d.\n", errno);
- exit (1);
- }
-#if defined(_LIBC_R)
- pthread_set_name_np (suspender_tid, "sigsuspender");
-#endif
-
- /*
- * Verify that an ignored signal doesn't cause a wakeup.
- * We don't have a handler installed for SIGIO.
- */
- send_thread_signal (suspender_tid, SIGIO);
- sleep (1);
- send_process_signal (SIGIO);
- sleep (1);
- if (sigcounts[SIGIO] != 0)
- fprintf (stderr, "FAIL: sigsuspend wakes up for ignored signal "
- "SIGIO.\n");
-
- /*
- * Verify that a signal with a default action of ignore, for
- * which we have a signal handler installed, will release a
- * sigsuspend.
- */
- send_thread_signal (suspender_tid, SIGURG);
- sleep (1);
- send_process_signal (SIGURG);
- sleep (1);
- if (sigcounts[SIGURG] != 2)
- fprintf (stderr,
- "FAIL: sigsuspend doesn't wake up for SIGURG.\n");
-
- /*
- * Verify that a SIGUSR2 signal will release a sigsuspended
- * thread.
- */
- send_thread_signal (suspender_tid, SIGUSR2);
- sleep (1);
- send_process_signal (SIGUSR2);
- sleep (1);
- if (sigcounts[SIGUSR2] != 2)
- fprintf (stderr,
- "FAIL: sigsuspend doesn't wake up for SIGUSR2.\n");
-
- /*
- * Verify that a signal, blocked in both the main and
- * sigsuspender threads, does not cause the signal handler
- * to be called.
- */
- send_thread_signal (suspender_tid, SIGUSR1);
- sleep (1);
- send_process_signal (SIGUSR1);
- sleep (1);
- if (sigcounts[SIGUSR1] != 0)
- fprintf (stderr, "FAIL: signal hander called for SIGUSR1.\n");
-
- /*
- * Verify that we can still kill the process for a signal
- * not being waited on by sigwait.
- */
- send_process_signal (SIGPIPE);
- fprintf (stderr, "FAIL: SIGPIPE did not terminate process.\n");
-
- /*
- * Wait for the thread to finish.
- */
- pthread_join (suspender_tid, &exit_status);
-
- return (0);
-}
diff --git a/lib/libkse/test/sigsuspend_d.exp b/lib/libkse/test/sigsuspend_d.exp
deleted file mode 100644
index 901fa50..0000000
--- a/lib/libkse/test/sigsuspend_d.exp
+++ /dev/null
@@ -1,8 +0,0 @@
- -> Suspender thread signal handler caught signal 16
-Sigsuspend woke up by signal 16
- -> Suspender thread signal handler caught signal 16
-Sigsuspend woke up by signal 16
- -> Suspender thread signal handler caught signal 31
-Sigsuspend woke up by signal 31
- -> Suspender thread signal handler caught signal 31
-Sigsuspend woke up by signal 31
diff --git a/lib/libkse/test/sigwait_d.c b/lib/libkse/test/sigwait_d.c
deleted file mode 100644
index f3ccd6b..0000000
--- a/lib/libkse/test/sigwait_d.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel M. Eischen <eischen@vigrid.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 M. Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL M. EISCHEN AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-
-#if defined(_LIBC_R_)
-#include <pthread_np.h>
-#endif
-
-static int sigcounts[NSIG + 1];
-static sigset_t wait_mask;
-static pthread_mutex_t waiter_mutex;
-
-
-static void *
-sigwaiter (void *arg)
-{
- int signo;
- sigset_t mask;
-
- /* Block SIGHUP */
- sigemptyset (&mask);
- sigaddset (&mask, SIGHUP);
- sigprocmask (SIG_BLOCK, &mask, NULL);
-
- while (sigcounts[SIGINT] == 0) {
- if (sigwait (&wait_mask, &signo) != 0) {
- fprintf (stderr,
- "Unable to wait for signal, errno %d\n",
- errno);
- exit (1);
- }
- sigcounts[signo]++;
- fprintf (stderr, "Sigwait caught signal %d\n", signo);
-
- /* Allow the main thread to prevent the sigwait. */
- pthread_mutex_lock (&waiter_mutex);
- pthread_mutex_unlock (&waiter_mutex);
- }
-
- pthread_exit (arg);
- return (NULL);
-}
-
-
-static void
-sighandler (int signo)
-{
- fprintf (stderr, " -> Signal handler caught signal %d\n", signo);
-
- if ((signo >= 0) && (signo <= NSIG))
- sigcounts[signo]++;
-}
-
-static void
-send_thread_signal (pthread_t tid, int signo)
-{
- if (pthread_kill (tid, signo) != 0) {
- fprintf (stderr, "Unable to send thread signal, errno %d.\n",
- errno);
- exit (1);
- }
-}
-
-static void
-send_process_signal (int signo)
-{
- if (kill (getpid (), signo) != 0) {
- fprintf (stderr, "Unable to send process signal, errno %d.\n",
- errno);
- exit (1);
- }
-}
-
-
-int main (int argc, char *argv[])
-{
- pthread_mutexattr_t mattr;
- pthread_attr_t pattr;
- pthread_t tid;
- void * exit_status;
- struct sigaction act;
-
- /* Initialize our signal counts. */
- memset ((void *) sigcounts, 0, NSIG * sizeof (int));
-
- /* Setup our wait mask. */
- sigemptyset (&wait_mask); /* Default action */
- sigaddset (&wait_mask, SIGHUP); /* terminate */
- sigaddset (&wait_mask, SIGINT); /* terminate */
- sigaddset (&wait_mask, SIGQUIT); /* create core image */
- sigaddset (&wait_mask, SIGURG); /* ignore */
- sigaddset (&wait_mask, SIGIO); /* ignore */
- sigaddset (&wait_mask, SIGUSR1); /* terminate */
-
- /* Ignore signals SIGHUP and SIGIO. */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGHUP);
- sigaddset (&act.sa_mask, SIGIO);
- act.sa_handler = SIG_IGN;
- act.sa_flags = 0;
- sigaction (SIGHUP, &act, NULL);
- sigaction (SIGIO, &act, NULL);
-
- /* Install a signal handler for SIGURG */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGURG);
- act.sa_handler = sighandler;
- act.sa_flags = SA_RESTART;
- sigaction (SIGURG, &act, NULL);
-
- /* Install a signal handler for SIGXCPU */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGXCPU);
- sigaction (SIGXCPU, &act, NULL);
-
- /*
- * Initialize the thread attribute.
- */
- if ((pthread_attr_init (&pattr) != 0) ||
- (pthread_attr_setdetachstate (&pattr,
- PTHREAD_CREATE_JOINABLE) != 0)) {
- fprintf (stderr, "Unable to initialize thread attributes.\n");
- exit (1);
- }
-
- /*
- * Initialize and create a mutex.
- */
- if ((pthread_mutexattr_init (&mattr) != 0) ||
- (pthread_mutex_init (&waiter_mutex, &mattr) != 0)) {
- fprintf (stderr, "Unable to create waiter mutex.\n");
- exit (1);
- }
-
- /*
- * Create the sigwaiter thread.
- */
- if (pthread_create (&tid, &pattr, sigwaiter, NULL) != 0) {
- fprintf (stderr, "Unable to create thread.\n");
- exit (1);
- }
-#if defined(_LIBC_R_)
- pthread_set_name_np (tid, "sigwaiter");
-#endif
-
- /*
- * Verify that an ignored signal doesn't cause a wakeup.
- * We don't have a handler installed for SIGIO.
- */
- send_thread_signal (tid, SIGIO);
- sleep (1);
- send_process_signal (SIGIO);
- sleep (1);
- if (sigcounts[SIGIO] != 0)
- fprintf (stderr,
- "FAIL: sigwait wakes up for ignored signal SIGIO.\n");
-
- /*
- * Verify that a signal with a default action of ignore, for
- * which we have a signal handler installed, will release a sigwait.
- */
- send_thread_signal (tid, SIGURG);
- sleep (1);
- send_process_signal (SIGURG);
- sleep (1);
- if (sigcounts[SIGURG] != 2)
- fprintf (stderr, "FAIL: sigwait doesn't wake up for SIGURG.\n");
-
- /*
- * Verify that a signal with a default action that terminates
- * the process will release a sigwait.
- */
- send_thread_signal (tid, SIGUSR1);
- sleep (1);
- send_process_signal (SIGUSR1);
- sleep (1);
- if (sigcounts[SIGUSR1] != 2)
- fprintf (stderr,
- "FAIL: sigwait doesn't wake up for SIGUSR1.\n");
-
- /*
- * Verify that if we install a signal handler for a previously
- * ignored signal, an occurrence of this signal will release
- * the (already waiting) sigwait.
- */
-
- /* Install a signal handler for SIGHUP. */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGHUP);
- act.sa_handler = sighandler;
- act.sa_flags = SA_RESTART;
- sigaction (SIGHUP, &act, NULL);
-
- /* Sending SIGHUP should release the sigwait. */
- send_process_signal (SIGHUP);
- sleep (1);
- send_thread_signal (tid, SIGHUP);
- sleep (1);
- if (sigcounts[SIGHUP] != 2)
- fprintf (stderr, "FAIL: sigwait doesn't wake up for SIGHUP.\n");
-
- /*
- * Verify that a pending signal in the waiters mask will
- * cause sigwait to return the pending signal. We do this
- * by taking the waiters mutex and signaling the waiter to
- * release him from the sigwait. The waiter will block
- * on taking the mutex, and we can then send the waiter a
- * signal which should be added to his pending signals.
- * The next time the waiter does a sigwait, he should
- * return with the pending signal.
- */
- sigcounts[SIGHUP] = 0;
- pthread_mutex_lock (&waiter_mutex);
- /* Release the waiter from sigwait. */
- send_process_signal (SIGHUP);
- sleep (1);
- if (sigcounts[SIGHUP] != 1)
- fprintf (stderr, "FAIL: sigwait doesn't wake up for SIGHUP.\n");
- /*
- * Add SIGHUP to the process pending signals. Since there is
- * a signal handler installed for SIGHUP and this signal is
- * blocked from the waiter thread and unblocked in the main
- * thread, the signal handler should be called once for SIGHUP.
- */
- send_process_signal (SIGHUP);
- /* Release the waiter thread and allow him to run. */
- pthread_mutex_unlock (&waiter_mutex);
- sleep (1);
- if (sigcounts[SIGHUP] != 2)
- fprintf (stderr,
- "FAIL: sigwait doesn't return for pending SIGHUP.\n");
-
- /*
- * Repeat the above test using pthread_kill and SIGUSR1.
- */
- sigcounts[SIGUSR1] = 0;
- pthread_mutex_lock (&waiter_mutex);
- /* Release the waiter from sigwait. */
- send_thread_signal (tid, SIGUSR1);
- sleep (1);
- if (sigcounts[SIGUSR1] != 1)
- fprintf (stderr,
- "FAIL: sigwait doesn't wake up for SIGUSR1.\n");
- /* Add SIGUSR1 to the waiters pending signals. */
- send_thread_signal (tid, SIGUSR1);
- /* Release the waiter thread and allow him to run. */
- pthread_mutex_unlock (&waiter_mutex);
- sleep (1);
- if (sigcounts[SIGUSR1] != 2)
- fprintf (stderr,
- "FAIL: sigwait doesn't return for pending SIGUSR1.\n");
-
- /*
- * Verify that we can still kill the process for a signal
- * not being waited on by sigwait.
- */
- send_process_signal (SIGPIPE);
- fprintf (stderr, "FAIL: SIGPIPE did not terminate process.\n");
-
- /*
- * Wait for the thread to finish.
- */
- pthread_join (tid, &exit_status);
-
- return (0);
-}
diff --git a/lib/libkse/test/sigwait_d.exp b/lib/libkse/test/sigwait_d.exp
deleted file mode 100644
index 2e9b2c4..0000000
--- a/lib/libkse/test/sigwait_d.exp
+++ /dev/null
@@ -1,10 +0,0 @@
-Sigwait caught signal 16
-Sigwait caught signal 16
-Sigwait caught signal 30
-Sigwait caught signal 30
-Sigwait caught signal 1
-Sigwait caught signal 1
-Sigwait caught signal 1
- -> Signal handler caught signal 1
-Sigwait caught signal 30
-Sigwait caught signal 30
diff --git a/lib/libkse/test/verify b/lib/libkse/test/verify
deleted file mode 100644
index 2863e5c..0000000
--- a/lib/libkse/test/verify
+++ /dev/null
@@ -1,474 +0,0 @@
-#!/usr/bin/perl -w
-#-*-mode:perl-*-
-#############################################################################
-#
-# Copyright (C) 1999-2001 Jason Evans <jasone@freebsd.org>.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice(s), this list of conditions and the following disclaimer as
-# the first lines of this file unmodified other than the possible
-# addition of one or more copyright notices.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice(s), this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-#############################################################################
-#
-# Test harness.
-#
-# $FreeBSD$
-#
-#############################################################################
-
-# Shut off buffering.
-select(STDOUT);
-$| = 1;
-
-#
-# Parse command-line arguments.
-#
-use Getopt::Long;
-Getopt::Long::config("bundling"); # Allow -hv rather than forcing -h -v.
-
-# Set option defaults for optional arguments.
-$opt_help = 0;
-$opt_verbose = 0;
-$opt_quiet = 0;
-$opt_srcdir = ".";
-$opt_objdir = ".";
-$opt_ustats = 0;
-$opt_zero = 0;
-
-$opt_retval =
-&GetOptions("h|help" => \$opt_help,
- "v|verbose" => \$opt_verbose,
- "q|quiet" => \$opt_quiet,
- "s|srcdir=s" => \$opt_srcdir,
- "o|objdir=s" => \$opt_objdir,
- "u|ustats" => \$opt_ustats,
- "z|zero" => \$opt_zero
- );
-
-if ($opt_help)
-{
- &usage();
- exit(0);
-}
-
-if ($opt_retval == 0)
-{
- &usage();
- exit 1;
-}
-
-if ($opt_verbose && $opt_quiet)
-{
- print STDERR "-v and -q are incompatible\n";
- &usage();
- exit 1;
-}
-
-if ($#ARGV + 1 == 0)
-{
- print STDERR "No tests specified\n";
- &usage();
- exit 1;
-}
-
-if ($opt_verbose)
-{
- print STDERR "Option values: h:$opt_help, v:$opt_verbose, "
- . "s:\"$opt_srcdir\", o:\"$opt_objdir\" "
- . "q:$opt_quiet, u:$opt_ustats, z:$opt_zero\n";
- printf STDERR "Tests (%d total): @ARGV\n", $#ARGV + 1;
-}
-
-#
-# Create and print header.
-#
-@TSTATS =
-(
- "--------------------------------------------------------------------------\n",
- "Test c_user c_system c_total chng\n",
- " passed/FAILED h_user h_system h_total %% chng\n"
- );
-
-if (!$opt_quiet)
-{
- foreach $line (@TSTATS)
- {
- printf STDOUT "$line";
- }
-}
-
-#
-# Run sequence test(s).
-#
-$total_utime = 0.0; # Total user time.
-$total_stime = 0.0; # Total system time.
-$total_hutime = 0.0; # Total historical user time.
-$total_hstime = 0.0; # Total historical system time.
-$total_ntime = 0.0; # Total time for tests that have historical data.
-
-foreach $test (@ARGV)
-{
- # Strip out any whitespace in $test.
- $test =~ s/^\s*(.*)\s*$/$1/;
-
- $okay = 1;
-
- if (-e "$opt_srcdir/$test.exp")
- {
- # Diff mode.
-
- ($okay, $utime, $stime) = &run_test($test);
-
- if (-e "$opt_objdir/$test.out")
- {
- `diff $opt_srcdir/$test.exp $opt_objdir/$test.out > $opt_objdir/$test.diff 2>&1`;
- if ($?)
- {
- # diff returns non-zero if there is a difference.
- $okay = 0;
- }
- }
- else
- {
- $okay = 0;
- if ($opt_verbose)
- {
- print STDERR
- "Nonexistent output file \"$opt_objdir/$test.out\"\n";
- }
- }
-
- ($hutime, $hstime) = &print_stats($test, $okay, 0, 0, $utime, $stime);
- }
- else
- {
- # Sequence mode.
-
- ($okay, $utime, $stime) = &run_test($test);
-
- if (open (STEST_OUT, "<$opt_objdir/$test.out"))
- {
- $num_subtests = 0;
- $num_failed_subtests = 0;
-
- while (defined($line = <STEST_OUT>))
- {
- if ($line =~ /1\.\.(\d+)/)
- {
- $num_subtests = $1;
- last;
- }
- }
- if ($num_subtests == 0)
- {
- $okay = 0;
- if ($opt_verbose)
- {
- print STDERR "Malformed or missing 1..n line\n";
- }
- }
- else
- {
- for ($subtest = 1; $subtest <= $num_subtests; $subtest++)
- {
- while (defined($line = <STEST_OUT>))
- {
- if ($line =~ /^not\s+ok\s+(\d+)?/)
- {
- $not = 1;
- $test_num = $1;
- last;
- }
- elsif ($line =~ /^ok\s+(\d+)?/)
- {
- $not = 0;
- $test_num = $1;
- last;
- }
- }
- if (defined($line))
- {
- if (defined($test_num) && ($test_num != $subtest))
- {
- # There was no output printed for one or more tests.
- for (; $subtest < $test_num; $subtest++)
- {
- $num_failed_subtests++;
- }
- }
- if ($not)
- {
- $num_failed_subtests++;
- }
- }
- else
- {
- for (; $subtest <= $num_subtests; $subtest++)
- {
- $num_failed_subtests++;
- }
- }
- }
-
- if (0 < $num_failed_subtests)
- {
- $okay = 0;
- }
- }
- }
- else
- {
- if (!$opt_quiet)
- {
- print STDERR "Cannot open output file \"$opt_objdir/$test.out\"\n";
- }
- exit 1;
- }
-
- ($hutime, $hstime) = &print_stats($test, $okay,
- $num_failed_subtests, $num_subtests,
- $utime, $stime);
- }
-
- $total_hutime += $hutime;
- $total_hstime += $hstime;
-
- if ($okay)
- {
- $total_utime += $utime;
- $total_stime += $stime;
- }
- else
- {
- @FAILED_TESTS = (@FAILED_TESTS, $test);
- }
-
- # If there were historical data, add the run time to the total time to
- # compare against the historical run time.
- if (0 < ($hutime + $hstime))
- {
- $total_ntime += $utime + $stime;
- }
-}
-
-# Print summary stats.
-$tt_str = sprintf ("%d / %d passed (%5.2f%%%%)",
- ($#ARGV + 1) - ($#FAILED_TESTS + 1),
- $#ARGV + 1,
- (($#ARGV + 1) - ($#FAILED_TESTS + 1))
- / ($#ARGV + 1) * 100);
-
-$t_str = sprintf ("Totals %7.2f %7.2f %7.2f"
- . " %7.2f\n"
- . " %s %7.2f %7.2f %7.2f %7.2f%%%%\n",
- $total_utime, $total_stime, $total_utime + $total_stime,
- ($total_ntime - ($total_hutime + $total_hstime)),
- $tt_str . ' ' x (40 - length($tt_str)),
- $total_hutime, $total_hstime, $total_hutime + $total_hstime,
- ($total_hutime + $total_hstime == 0.0) ? 0.0 :
- (($total_ntime
- - ($total_hutime + $total_hstime))
- / ($total_hutime + $total_hstime) * 100));
-
-@TSTATS = ("--------------------------------------------------------------------------\n",
- $t_str,
- "--------------------------------------------------------------------------\n"
- );
-if (!$opt_quiet)
-{
- foreach $line (@TSTATS)
- {
- printf STDOUT "$line";
- }
-}
-
-if ($#FAILED_TESTS >= 0)
-{
- # One or more tests failed, so return an error.
- exit 1;
-}
-# End of main execution.
-
-sub run_test
-{
- my ($test) = @_;
- my ($okay) = 1;
- my ($tutime, $tstime);
- my ($utime, $stime, $cutime, $cstime);
- my (@TSTATS, @TPATH);
- my ($t_str);
- my ($srcdir, $objdir);
-
- # Get the path component of $test, if any.
- @TPATH = split(/\//, $test);
- pop(@TPATH);
- $srcdir = join('/', ($opt_srcdir, @TPATH));
- $objdir = join('/', ($opt_objdir, @TPATH));
-
- @TSTATS = ("--------------------------------------------------------------------------\n");
-
- $t_str = sprintf ("%s%s", $test, ' ' x (40 - length($test)));
- @TSTATS = (@TSTATS, $t_str);
- @STATS = (@STATS, @TSTATS);
- if (!$opt_quiet)
- {
- foreach $line (@TSTATS)
- {
- printf STDOUT "$line";
- }
- }
-
- ($utime, $stime, $cutime, $cstime) = times;
- `$opt_objdir/$test $srcdir $objdir > $opt_objdir/$test.out 2>&1`;
- ($utime, $stime, $tutime, $tstime) = times;
-
- # Subtract the before time from the after time.
- $tutime -= $cutime;
- $tstime -= $cstime;
-
- if ($opt_zero)
- {
- if ($?)
- {
- $okay = 0;
- if ($opt_verbose)
- {
- print STDERR
- "\"$opt_objdir/$test > $opt_objdir/$test.out 2>&1\" returned $?\n";
- }
- }
- }
-
- return ($okay, $tutime, $tstime);
-}
-
-sub print_stats
-{
- my ($test, $okay, $failed_subtests, $subtests, $utime, $stime) = @_;
- my ($hutime, $hstime);
-# my (TEST_PERF);
- my (@TSTATS);
- my ($t_str, $pass_str);
-
- $pass_str = $okay ? "passed" : "*** FAILED ***";
- if ((0 != $subtests) && (!$okay))
- {
- $pass_str = $pass_str . " ($failed_subtests/$subtests failed)";
- }
- $pass_str = $pass_str . ' ' x (39 - length($pass_str));
-
- if (-r "$test.perf")
- {
- if (!open (TEST_PERF, "<$opt_objdir/$test.perf"))
- {
- print STDERR "Unable to open \"$opt_objdir/$test.perf\"\n";
- exit 1;
- }
- $_ = <TEST_PERF>;
-
- ($hutime, $hstime) = split;
- close TEST_PERF;
-
- $t_str = sprintf (" %7.2f %7.2f %7.2f %7.2f\n"
- . " %s %7.2f %7.2f %7.2f %7.2f%%%%\n",
- $utime, $stime, $utime + $stime,
- ($utime + $stime) - ($hutime + $hstime),
- $pass_str,
- $hutime, $hstime, $hutime + $hstime,
- (($hutime + $hstime) == 0.0) ? 0.0 :
- ((($utime + $stime) - ($hutime + $hstime))
- / ($hutime + $hstime) * 100));
- }
- else
- {
- $hutime = 0.0;
- $hstime = 0.0;
-
- $t_str = sprintf (" %7.2f %7.2f %7.2f \n"
- . " %s\n",
- $utime, $stime, $utime + $stime,
- $pass_str);
- }
- @TSTATS = ($t_str);
- if (!$opt_quiet)
- {
- foreach $line (@TSTATS)
- {
- printf STDOUT "$line";
- }
- }
-
- if ($okay && $opt_ustats)
- {
- if (!open (TEST_PERF, ">$opt_objdir/$test.perf"))
- {
- if (!$opt_quiet)
- {
- print STDERR "Unable to update \"$opt_objdir/$test.perf\"\n";
- }
- }
- else
- {
- print TEST_PERF "$utime $stime\n";
- close TEST_PERF;
- }
- }
-
- return ($hutime, $hstime);
-}
-
-sub usage
-{
- print <<EOF;
-$0 usage:
- $0 [<options>] <test>+
-
- Option | Description
- --------------+-------------------------------------------------------------
- -h --help | Print usage and exit.
- -v --verbose | Verbose (incompatible with quiet).
- -q --quiet | Quiet (incompatible with verbose).
- -s --srcdir | Path to source tree (default is ".").
- -o --objdir | Path to object tree (default is ".").
- -u --ustats | Update historical statistics (stored in "<test>.perf".
- -z --zero | Consider non-zero exit code to be an error.
- --------------+-------------------------------------------------------------
-
- If <test>.exp exists, <test>'s output is diff'ed with <test>.exp. Any
- difference is considered failure.
-
- If <test>.exp does not exist, output to stdout of the following form is
- expected:
-
- 1..<n>
- {not }ok[ 1]
- {not }ok[ 2]
- ...
- {not }ok[ n]
-
- 1 <= <n> < 2^31
-
- Lines which do not match the patterns shown above are ignored.
-EOF
-}
diff --git a/lib/libkse/thread/Makefile.inc b/lib/libkse/thread/Makefile.inc
deleted file mode 100644
index 3ba361e..0000000
--- a/lib/libkse/thread/Makefile.inc
+++ /dev/null
@@ -1,115 +0,0 @@
-# $FreeBSD$
-
-# thr sources
-.PATH: ${.CURDIR}/thread
-
-SRCS+= \
- thr_accept.c \
- thr_aio_suspend.c \
- thr_atfork.c \
- thr_attr_destroy.c \
- thr_attr_init.c \
- thr_attr_get_np.c \
- thr_attr_getdetachstate.c \
- thr_attr_getguardsize.c \
- thr_attr_getinheritsched.c \
- thr_attr_getschedparam.c \
- thr_attr_getschedpolicy.c \
- thr_attr_getscope.c \
- thr_attr_getstack.c \
- thr_attr_getstackaddr.c \
- thr_attr_getstacksize.c \
- thr_attr_setcreatesuspend_np.c \
- thr_attr_setdetachstate.c \
- thr_attr_setguardsize.c \
- thr_attr_setinheritsched.c \
- thr_attr_setschedparam.c \
- thr_attr_setschedpolicy.c \
- thr_attr_setscope.c \
- thr_attr_setstack.c \
- thr_attr_setstackaddr.c \
- thr_attr_setstacksize.c \
- thr_autoinit.c \
- thr_barrier.c \
- thr_barrierattr.c \
- thr_cancel.c \
- thr_clean.c \
- thr_close.c \
- thr_concurrency.c \
- thr_cond.c \
- thr_condattr_destroy.c \
- thr_condattr_init.c \
- thr_connect.c \
- thr_creat.c \
- thr_create.c \
- thr_detach.c \
- thr_equal.c \
- thr_execve.c \
- thr_exit.c \
- thr_fcntl.c \
- thr_find_thread.c \
- thr_fork.c \
- thr_fsync.c \
- thr_getprio.c \
- thr_getschedparam.c \
- thr_info.c \
- thr_init.c \
- thr_join.c \
- thr_kern.c \
- thr_kill.c \
- thr_main_np.c \
- thr_mattr_init.c \
- thr_mattr_kind_np.c \
- thr_msync.c \
- thr_multi_np.c \
- thr_mutex.c \
- thr_mutex_prioceiling.c \
- thr_mutex_protocol.c \
- thr_mutexattr_destroy.c \
- thr_nanosleep.c \
- thr_once.c \
- thr_open.c \
- thr_pause.c \
- thr_poll.c \
- thr_printf.c \
- thr_priority_queue.c \
- thr_pselect.c \
- thr_pspinlock.c \
- thr_raise.c \
- thr_read.c \
- thr_readv.c \
- thr_resume_np.c \
- thr_rtld.c \
- thr_rwlock.c \
- thr_rwlockattr.c \
- thr_select.c \
- thr_self.c \
- thr_sem.c \
- thr_seterrno.c \
- thr_setprio.c \
- thr_setschedparam.c \
- thr_sig.c \
- thr_sigaction.c \
- thr_sigaltstack.c \
- thr_sigmask.c \
- thr_sigpending.c \
- thr_sigprocmask.c \
- thr_sigsuspend.c \
- thr_sigwait.c \
- thr_single_np.c \
- thr_sleep.c \
- thr_spec.c \
- thr_spinlock.c \
- thr_stack.c \
- thr_suspend_np.c \
- thr_switch_np.c \
- thr_system.c \
- thr_symbols.c \
- thr_tcdrain.c \
- thr_vfork.c \
- thr_wait.c \
- thr_wait4.c \
- thr_waitpid.c \
- thr_write.c \
- thr_writev.c \
- thr_yield.c
diff --git a/lib/libkse/thread/thr_accept.c b/lib/libkse/thread/thr_accept.c
deleted file mode 100644
index 0131bc8..0000000
--- a/lib/libkse/thread/thr_accept.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__accept, accept);
-
-int
-__accept(int s, struct sockaddr *addr, socklen_t *addrlen)
-{
- struct pthread *curthread;
- int ret;
-
- curthread = _get_curthread();
- _thr_cancel_enter(curthread);
- ret = __sys_accept(s, addr, addrlen);
- _thr_cancel_leave(curthread, ret == -1);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_aio_suspend.c b/lib/libkse/thread/thr_aio_suspend.c
deleted file mode 100644
index 5b8a6dc..0000000
--- a/lib/libkse/thread/thr_aio_suspend.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <aio.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_aio_suspend, aio_suspend);
-
-int
-_aio_suspend(const struct aiocb * const iocbs[], int niocb, const struct
- timespec *timeout)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = __sys_aio_suspend(iocbs, niocb, timeout);
- _thr_cancel_leave(curthread, 1);
-
- return (ret);
-}
-
diff --git a/lib/libkse/thread/thr_atfork.c b/lib/libkse/thread/thr_atfork.c
deleted file mode 100644
index 0487a36..0000000
--- a/lib/libkse/thread/thr_atfork.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <sys/queue.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_atfork, pthread_atfork);
-
-int
-_pthread_atfork(void (*prepare)(void), void (*parent)(void),
- void (*child)(void))
-{
- struct pthread_atfork *af;
-
- if (_thr_initial == NULL)
- _libpthread_init(NULL);
-
- if ((af = malloc(sizeof(struct pthread_atfork))) == NULL)
- return (ENOMEM);
-
- af->prepare = prepare;
- af->parent = parent;
- af->child = child;
- _pthread_mutex_lock(&_thr_atfork_mutex);
- TAILQ_INSERT_TAIL(&_thr_atfork_list, af, qe);
- _pthread_mutex_unlock(&_thr_atfork_mutex);
- return (0);
-}
-
diff --git a/lib/libkse/thread/thr_attr_destroy.c b/lib/libkse/thread/thr_attr_destroy.c
deleted file mode 100644
index e239a1d..0000000
--- a/lib/libkse/thread/thr_attr_destroy.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdlib.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_destroy, pthread_attr_destroy);
-
-int
-_pthread_attr_destroy(pthread_attr_t *attr)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL)
- /* Invalid argument: */
- ret = EINVAL;
- else {
- /* Free the memory allocated to the attribute object: */
- free(*attr);
-
- /*
- * Leave the attribute pointer NULL now that the memory
- * has been freed:
- */
- *attr = NULL;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_get_np.c b/lib/libkse/thread/thr_attr_get_np.c
deleted file mode 100644
index e844acb..0000000
--- a/lib/libkse/thread/thr_attr_get_np.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2002,2003 Alexey Zelkin <phantom@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <string.h>
-#include <pthread.h>
-#include <pthread_np.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_get_np, pthread_attr_get_np);
-
-int
-_pthread_attr_get_np(pthread_t pid, pthread_attr_t *dst)
-{
- struct pthread *curthread;
- struct pthread_attr attr;
- int ret;
-
- if (pid == NULL || dst == NULL || *dst == NULL)
- return (EINVAL);
-
- curthread = _get_curthread();
- if ((ret = _thr_ref_add(curthread, pid, /*include dead*/0)) != 0)
- return (ret);
- attr = pid->attr;
- _thr_ref_delete(curthread, pid);
- memcpy(*dst, &attr, sizeof(struct pthread_attr));
-
- return (0);
-}
diff --git a/lib/libkse/thread/thr_attr_getdetachstate.c b/lib/libkse/thread/thr_attr_getdetachstate.c
deleted file mode 100644
index d994548..0000000
--- a/lib/libkse/thread/thr_attr_getdetachstate.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_getdetachstate, pthread_attr_getdetachstate);
-
-int
-_pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || detachstate == NULL)
- ret = EINVAL;
- else {
- /* Check if the detached flag is set: */
- if ((*attr)->flags & PTHREAD_DETACHED)
- /* Return detached: */
- *detachstate = PTHREAD_CREATE_DETACHED;
- else
- /* Return joinable: */
- *detachstate = PTHREAD_CREATE_JOINABLE;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_getguardsize.c b/lib/libkse/thread/thr_attr_getguardsize.c
deleted file mode 100644
index b32015a..0000000
--- a/lib/libkse/thread/thr_attr_getguardsize.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2001 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer
- * unmodified other than the allowable addition of one or more
- * copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_getguardsize, pthread_attr_getguardsize);
-
-int
-_pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || guardsize == NULL)
- ret = EINVAL;
- else {
- /* Return the guard size: */
- *guardsize = (*attr)->guardsize_attr;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_getinheritsched.c b/lib/libkse/thread/thr_attr_getinheritsched.c
deleted file mode 100644
index 26ae9e4..0000000
--- a/lib/libkse/thread/thr_attr_getinheritsched.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_getinheritsched, pthread_attr_getinheritsched);
-
-int
-_pthread_attr_getinheritsched(const pthread_attr_t *attr, int *sched_inherit)
-{
- int ret = 0;
-
- if ((attr == NULL) || (*attr == NULL))
- ret = EINVAL;
- else
- *sched_inherit = (*attr)->sched_inherit;
-
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_getschedparam.c b/lib/libkse/thread/thr_attr_getschedparam.c
deleted file mode 100644
index 79911f4..0000000
--- a/lib/libkse/thread/thr_attr_getschedparam.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_getschedparam, pthread_attr_getschedparam);
-
-int
-_pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
-{
- int ret = 0;
-
- if ((attr == NULL) || (*attr == NULL) || (param == NULL))
- ret = EINVAL;
- else
- param->sched_priority = (*attr)->prio;
-
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_getschedpolicy.c b/lib/libkse/thread/thr_attr_getschedpolicy.c
deleted file mode 100644
index 1234b7d..0000000
--- a/lib/libkse/thread/thr_attr_getschedpolicy.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_getschedpolicy, pthread_attr_getschedpolicy);
-
-int
-_pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
-{
- int ret = 0;
-
- if ((attr == NULL) || (*attr == NULL) || (policy == NULL))
- ret = EINVAL;
- else
- *policy = (*attr)->sched_policy;
-
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_getscope.c b/lib/libkse/thread/thr_attr_getscope.c
deleted file mode 100644
index fefe6cf..0000000
--- a/lib/libkse/thread/thr_attr_getscope.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_getscope, pthread_attr_getscope);
-
-int
-_pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope)
-{
- int ret = 0;
-
- if ((attr == NULL) || (*attr == NULL) || (contentionscope == NULL))
- /* Return an invalid argument: */
- ret = EINVAL;
-
- else
- *contentionscope = (*attr)->flags & PTHREAD_SCOPE_SYSTEM ?
- PTHREAD_SCOPE_SYSTEM : PTHREAD_SCOPE_PROCESS;
-
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_getstack.c b/lib/libkse/thread/thr_attr_getstack.c
deleted file mode 100644
index 8c0f87f..0000000
--- a/lib/libkse/thread/thr_attr_getstack.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2003 Craig Rodrigues <rodrigc@attbi.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Craig Rodrigues.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CRAIG RODRIGUES AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_getstack, pthread_attr_getstack);
-
-int
-_pthread_attr_getstack(const pthread_attr_t * __restrict attr,
- void ** __restrict stackaddr,
- size_t * __restrict stacksize)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || stackaddr == NULL
- || stacksize == NULL )
- ret = EINVAL;
- else {
- /* Return the stack address and size */
- *stackaddr = (*attr)->stackaddr_attr;
- *stacksize = (*attr)->stacksize_attr;
- ret = 0;
- }
- return(ret);
-}
-
diff --git a/lib/libkse/thread/thr_attr_getstackaddr.c b/lib/libkse/thread/thr_attr_getstackaddr.c
deleted file mode 100644
index d082248..0000000
--- a/lib/libkse/thread/thr_attr_getstackaddr.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_getstackaddr, pthread_attr_getstackaddr);
-
-int
-_pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || stackaddr == NULL)
- ret = EINVAL;
- else {
- /* Return the stack address: */
- *stackaddr = (*attr)->stackaddr_attr;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_getstacksize.c b/lib/libkse/thread/thr_attr_getstacksize.c
deleted file mode 100644
index ec1a9be..0000000
--- a/lib/libkse/thread/thr_attr_getstacksize.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_getstacksize, pthread_attr_getstacksize);
-
-int
-_pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || stacksize == NULL)
- ret = EINVAL;
- else {
- /* Return the stack size: */
- *stacksize = (*attr)->stacksize_attr;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_init.c b/lib/libkse/thread/thr_attr_init.c
deleted file mode 100644
index 604a1aa..0000000
--- a/lib/libkse/thread/thr_attr_init.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_init, pthread_attr_init);
-
-int
-_pthread_attr_init(pthread_attr_t *attr)
-{
- int ret;
- pthread_attr_t pattr;
-
- /* Allocate memory for the attribute object: */
- if ((pattr = (pthread_attr_t) malloc(sizeof(struct pthread_attr))) == NULL)
- /* Insufficient memory: */
- ret = ENOMEM;
- else {
- /* Initialise the attribute object with the defaults: */
- memcpy(pattr, &_pthread_attr_default,
- sizeof(struct pthread_attr));
- pattr->guardsize_attr = _thr_guard_default;
- pattr->stacksize_attr = _thr_stack_default;
-
- /* Return a pointer to the attribute object: */
- *attr = pattr;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_setcreatesuspend_np.c b/lib/libkse/thread/thr_attr_setcreatesuspend_np.c
deleted file mode 100644
index d844d62..0000000
--- a/lib/libkse/thread/thr_attr_setcreatesuspend_np.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setcreatesuspend_np, pthread_attr_setcreatesuspend_np);
-
-int
-_pthread_attr_setcreatesuspend_np(pthread_attr_t *attr)
-{
- int ret;
-
- if (attr == NULL || *attr == NULL) {
- ret = EINVAL;
- } else {
- (*attr)->suspend = THR_CREATE_SUSPENDED;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_setdetachstate.c b/lib/libkse/thread/thr_attr_setdetachstate.c
deleted file mode 100644
index 4d517f2..0000000
--- a/lib/libkse/thread/thr_attr_setdetachstate.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setdetachstate, pthread_attr_setdetachstate);
-
-int
-_pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL ||
- (detachstate != PTHREAD_CREATE_DETACHED &&
- detachstate != PTHREAD_CREATE_JOINABLE))
- ret = EINVAL;
- else {
- /* Check if detached state: */
- if (detachstate == PTHREAD_CREATE_DETACHED)
- /* Set the detached flag: */
- (*attr)->flags |= PTHREAD_DETACHED;
- else
- /* Reset the detached flag: */
- (*attr)->flags &= ~PTHREAD_DETACHED;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_setguardsize.c b/lib/libkse/thread/thr_attr_setguardsize.c
deleted file mode 100644
index d56b254..0000000
--- a/lib/libkse/thread/thr_attr_setguardsize.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer
- * unmodified other than the allowable addition of one or more
- * copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <sys/param.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setguardsize, pthread_attr_setguardsize);
-
-int
-_pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
-{
- int ret;
-
- /* Check for invalid arguments. */
- if (attr == NULL || *attr == NULL)
- ret = EINVAL;
- else {
- /* Save the stack size. */
- (*attr)->guardsize_attr = guardsize;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_setinheritsched.c b/lib/libkse/thread/thr_attr_setinheritsched.c
deleted file mode 100644
index e91b214..0000000
--- a/lib/libkse/thread/thr_attr_setinheritsched.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setinheritsched, pthread_attr_setinheritsched);
-
-int
-_pthread_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit)
-{
- int ret = 0;
-
- if ((attr == NULL) || (*attr == NULL))
- ret = EINVAL;
- else if (sched_inherit != PTHREAD_INHERIT_SCHED &&
- sched_inherit != PTHREAD_EXPLICIT_SCHED)
- ret = ENOTSUP;
- else
- (*attr)->sched_inherit = sched_inherit;
-
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_setschedparam.c b/lib/libkse/thread/thr_attr_setschedparam.c
deleted file mode 100644
index bbb4b1e..0000000
--- a/lib/libkse/thread/thr_attr_setschedparam.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setschedparam, pthread_attr_setschedparam);
-
-int
-_pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param)
-{
- int ret = 0;
-
- if ((attr == NULL) || (*attr == NULL))
- ret = EINVAL;
- else if (param == NULL) {
- ret = ENOTSUP;
- } else if ((param->sched_priority < THR_MIN_PRIORITY) ||
- (param->sched_priority > THR_MAX_PRIORITY)) {
- /* Return an unsupported value error. */
- ret = ENOTSUP;
- } else
- (*attr)->prio = param->sched_priority;
-
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_setschedpolicy.c b/lib/libkse/thread/thr_attr_setschedpolicy.c
deleted file mode 100644
index ddb0921..0000000
--- a/lib/libkse/thread/thr_attr_setschedpolicy.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setschedpolicy, pthread_attr_setschedpolicy);
-
-int
-_pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
-{
- int ret = 0;
-
- if ((attr == NULL) || (*attr == NULL))
- ret = EINVAL;
- else if ((policy < SCHED_FIFO) || (policy > SCHED_RR)) {
- ret = ENOTSUP;
- } else
- (*attr)->sched_policy = policy;
-
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_setscope.c b/lib/libkse/thread/thr_attr_setscope.c
deleted file mode 100644
index dcf179e..0000000
--- a/lib/libkse/thread/thr_attr_setscope.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setscope, pthread_attr_setscope);
-
-int
-_pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
-{
- int ret = 0;
-
- if ((attr == NULL) || (*attr == NULL)) {
- /* Return an invalid argument: */
- ret = EINVAL;
- } else if ((contentionscope != PTHREAD_SCOPE_PROCESS) &&
- (contentionscope != PTHREAD_SCOPE_SYSTEM)) {
- ret = EINVAL;
- } else if (contentionscope == PTHREAD_SCOPE_SYSTEM) {
- (*attr)->flags |= contentionscope;
- } else {
- (*attr)->flags &= ~PTHREAD_SCOPE_SYSTEM;
- }
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_attr_setstack.c b/lib/libkse/thread/thr_attr_setstack.c
deleted file mode 100644
index feeb713..0000000
--- a/lib/libkse/thread/thr_attr_setstack.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2003 Craig Rodrigues <rodrigc@attbi.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Craig Rodrigues.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CRAIG RODRIGUES AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setstack, pthread_attr_setstack);
-
-int
-_pthread_attr_setstack(pthread_attr_t *attr, void *stackaddr,
- size_t stacksize)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || stackaddr == NULL
- || stacksize < PTHREAD_STACK_MIN )
- ret = EINVAL;
- else {
- /* Save the stack address and stack size */
- (*attr)->stackaddr_attr = stackaddr;
- (*attr)->stacksize_attr = stacksize;
- ret = 0;
- }
- return(ret);
-}
-
diff --git a/lib/libkse/thread/thr_attr_setstackaddr.c b/lib/libkse/thread/thr_attr_setstackaddr.c
deleted file mode 100644
index 87837f1..0000000
--- a/lib/libkse/thread/thr_attr_setstackaddr.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setstackaddr, pthread_attr_setstackaddr);
-
-int
-_pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || stackaddr == NULL)
- ret = EINVAL;
- else {
- /* Save the stack address: */
- (*attr)->stackaddr_attr = stackaddr;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_attr_setstacksize.c b/lib/libkse/thread/thr_attr_setstacksize.c
deleted file mode 100644
index e26ab7d..0000000
--- a/lib/libkse/thread/thr_attr_setstacksize.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_attr_setstacksize, pthread_attr_setstacksize);
-
-int
-_pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || stacksize < PTHREAD_STACK_MIN)
- ret = EINVAL;
- else {
- /* Save the stack size: */
- (*attr)->stacksize_attr = stacksize;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_autoinit.c b/lib/libkse/thread/thr_autoinit.c
deleted file mode 100644
index 95b2a85..0000000
--- a/lib/libkse/thread/thr_autoinit.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2002 Alfred Perlstein <alfred@freebsd.org>.
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-/*
- * This module uses GCC extentions to initialize the
- * threads package at program start-up time.
- */
-
-#include <pthread.h>
-#include "thr_private.h"
-
-void _thread_init_hack(void) __attribute__ ((constructor));
-
-void
-_thread_init_hack(void)
-{
-
- _libpthread_init(NULL);
-}
-
-/*
- * For the shared version of the threads library, the above is sufficient.
- * But for the archive version of the library, we need a little bit more.
- * Namely, we must arrange for this particular module to be pulled in from
- * the archive library at link time. To accomplish that, we define and
- * initialize a variable, "_thread_autoinit_dummy_decl". This variable is
- * referenced (as an extern) from libc/stdlib/exit.c. This will always
- * create a need for this module, ensuring that it is present in the
- * executable.
- */
-extern int _thread_autoinit_dummy_decl;
-int _thread_autoinit_dummy_decl = 0;
diff --git a/lib/libkse/thread/thr_barrier.c b/lib/libkse/thread/thr_barrier.c
deleted file mode 100644
index 612acb1..0000000
--- a/lib/libkse/thread/thr_barrier.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*-
- * Copyright (c) 2003 David Xu <davidxu@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include "namespace.h"
-#include <pthread.h>
-#include "un-namespace.h"
-#include "thr_private.h"
-
-__weak_reference(_pthread_barrier_init, pthread_barrier_init);
-__weak_reference(_pthread_barrier_wait, pthread_barrier_wait);
-__weak_reference(_pthread_barrier_destroy, pthread_barrier_destroy);
-
-int
-_pthread_barrier_destroy(pthread_barrier_t *barrier)
-{
- pthread_barrier_t bar;
- int ret, ret2;
-
- if (barrier == NULL || *barrier == NULL)
- return (EINVAL);
-
- bar = *barrier;
- if (bar->b_waiters > 0)
- return (EBUSY);
- *barrier = NULL;
- ret = _pthread_mutex_destroy(&bar->b_lock);
- ret2 = _pthread_cond_destroy(&bar->b_cond);
- free(bar);
- return (ret ? ret : ret2);
-}
-
-int
-_pthread_barrier_init(pthread_barrier_t *barrier,
- const pthread_barrierattr_t *attr, int count)
-{
- pthread_barrier_t bar;
- int ret;
-
- if (barrier == NULL || count <= 0)
- return (EINVAL);
-
- bar = malloc(sizeof(struct pthread_barrier));
- if (bar == NULL)
- return (ENOMEM);
-
- if ((ret = _pthread_mutex_init(&bar->b_lock, NULL)) != 0) {
- free(bar);
- return (ret);
- }
-
- if ((ret = _pthread_cond_init(&bar->b_cond, NULL)) != 0) {
- _pthread_mutex_destroy(&bar->b_lock);
- free(bar);
- return (ret);
- }
-
- bar->b_waiters = 0;
- bar->b_count = count;
- bar->b_generation = 0;
- *barrier = bar;
-
- return (0);
-}
-
-int
-_pthread_barrier_wait(pthread_barrier_t *barrier)
-{
- int ret, gen;
- pthread_barrier_t bar;
-
- if (barrier == NULL || *barrier == NULL)
- return (EINVAL);
-
- bar = *barrier;
- if ((ret = _pthread_mutex_lock(&bar->b_lock)) != 0)
- return (ret);
-
- if (++bar->b_waiters == bar->b_count) {
- /* Current thread is lastest thread */
- bar->b_generation++;
- bar->b_waiters = 0;
- ret = _pthread_cond_broadcast(&bar->b_cond);
- if (ret == 0)
- ret = PTHREAD_BARRIER_SERIAL_THREAD;
- } else {
- gen = bar->b_generation;
- do {
- ret = _pthread_cond_wait(
- &bar->b_cond, &bar->b_lock);
- /* test generation to avoid bogus wakeup */
- } while (ret == 0 && gen == bar->b_generation);
- }
- _pthread_mutex_unlock(&bar->b_lock);
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_barrierattr.c b/lib/libkse/thread/thr_barrierattr.c
deleted file mode 100644
index f71c0dd..0000000
--- a/lib/libkse/thread/thr_barrierattr.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2003 David Xu <davidxu@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_barrierattr_destroy, pthread_barrierattr_destroy);
-__weak_reference(_pthread_barrierattr_init, pthread_barrierattr_init);
-__weak_reference(_pthread_barrierattr_setpshared,
- pthread_barrierattr_setpshared);
-__weak_reference(_pthread_barrierattr_getpshared,
- pthread_barrierattr_getpshared);
-
-int
-_pthread_barrierattr_destroy(pthread_barrierattr_t *attr)
-{
-
- if (attr == NULL || *attr == NULL)
- return (EINVAL);
-
- free(*attr);
- return (0);
-}
-
-int
-_pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr,
- int *pshared)
-{
-
- if (attr == NULL || *attr == NULL)
- return (EINVAL);
-
- *pshared = (*attr)->pshared;
- return (0);
-}
-
-int
-_pthread_barrierattr_init(pthread_barrierattr_t *attr)
-{
-
- if (attr == NULL)
- return (EINVAL);
-
- if ((*attr = malloc(sizeof(struct pthread_barrierattr))) == NULL)
- return (ENOMEM);
-
- (*attr)->pshared = PTHREAD_PROCESS_PRIVATE;
- return (0);
-}
-
-int
-_pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared)
-{
-
- if (attr == NULL || *attr == NULL)
- return (EINVAL);
-
- /* Only PTHREAD_PROCESS_PRIVATE is supported. */
- if (pshared != PTHREAD_PROCESS_PRIVATE)
- return (EINVAL);
-
- (*attr)->pshared = pshared;
- return (0);
-}
diff --git a/lib/libkse/thread/thr_cancel.c b/lib/libkse/thread/thr_cancel.c
deleted file mode 100644
index a6a32b8..0000000
--- a/lib/libkse/thread/thr_cancel.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * David Leonard <d@openbsd.org>, 1999. Public domain.
- * $FreeBSD$
- */
-#include <sys/errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_cancel, pthread_cancel);
-__weak_reference(_pthread_setcancelstate, pthread_setcancelstate);
-__weak_reference(_pthread_setcanceltype, pthread_setcanceltype);
-__weak_reference(_pthread_testcancel, pthread_testcancel);
-
-static inline int
-checkcancel(struct pthread *curthread)
-{
- if ((curthread->cancelflags & THR_CANCELLING) != 0) {
- /*
- * It is possible for this thread to be swapped out
- * while performing cancellation; do not allow it
- * to be cancelled again.
- */
- if ((curthread->flags & THR_FLAGS_EXITING) != 0) {
- /*
- * This may happen once, but after this, it
- * shouldn't happen again.
- */
- curthread->cancelflags &= ~THR_CANCELLING;
- return (0);
- }
- if ((curthread->cancelflags & PTHREAD_CANCEL_DISABLE) == 0) {
- curthread->cancelflags &= ~THR_CANCELLING;
- return (1);
- }
- }
- return (0);
-}
-
-static inline void
-testcancel(struct pthread *curthread)
-{
- if (checkcancel(curthread) != 0) {
- /* Unlock before exiting: */
- THR_THREAD_UNLOCK(curthread, curthread);
-
- _thr_exit_cleanup();
- pthread_exit(PTHREAD_CANCELED);
- PANIC("cancel");
- }
-}
-
-int
-_pthread_cancel(pthread_t pthread)
-{
- struct pthread *curthread = _get_curthread();
- struct pthread *joinee = NULL;
- struct kse_mailbox *kmbx = NULL;
- int ret;
-
- if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) == 0) {
- /*
- * Take the thread's lock while we change the cancel flags.
- */
- THR_THREAD_LOCK(curthread, pthread);
- THR_SCHED_LOCK(curthread, pthread);
- if (pthread->flags & THR_FLAGS_EXITING) {
- THR_SCHED_UNLOCK(curthread, pthread);
- THR_THREAD_UNLOCK(curthread, pthread);
- _thr_ref_delete(curthread, pthread);
- return (ESRCH);
- }
- if (((pthread->cancelflags & PTHREAD_CANCEL_DISABLE) != 0) ||
- (((pthread->cancelflags & THR_AT_CANCEL_POINT) == 0) &&
- ((pthread->cancelflags & PTHREAD_CANCEL_ASYNCHRONOUS) == 0)))
- /* Just mark it for cancellation: */
- pthread->cancelflags |= THR_CANCELLING;
- else {
- /*
- * Check if we need to kick it back into the
- * run queue:
- */
- switch (pthread->state) {
- case PS_RUNNING:
- /* No need to resume: */
- pthread->cancelflags |= THR_CANCELLING;
- break;
-
- case PS_LOCKWAIT:
- /*
- * These can't be removed from the queue.
- * Just mark it as cancelling and tell it
- * to yield once it leaves the critical
- * region.
- */
- pthread->cancelflags |= THR_CANCELLING;
- pthread->critical_yield = 1;
- break;
-
- case PS_SLEEP_WAIT:
- case PS_SIGSUSPEND:
- case PS_SIGWAIT:
- /* Interrupt and resume: */
- pthread->interrupted = 1;
- pthread->cancelflags |= THR_CANCELLING;
- kmbx = _thr_setrunnable_unlocked(pthread);
- break;
-
- case PS_JOIN:
- /* Disconnect the thread from the joinee: */
- joinee = pthread->join_status.thread;
- pthread->join_status.thread = NULL;
- pthread->cancelflags |= THR_CANCELLING;
- kmbx = _thr_setrunnable_unlocked(pthread);
- if ((joinee != NULL) &&
- (pthread->kseg == joinee->kseg)) {
- /* Remove the joiner from the joinee. */
- joinee->joiner = NULL;
- joinee = NULL;
- }
- break;
-
- case PS_SUSPENDED:
- case PS_MUTEX_WAIT:
- case PS_COND_WAIT:
- /*
- * Threads in these states may be in queues.
- * In order to preserve queue integrity, the
- * cancelled thread must remove itself from the
- * queue. Mark the thread as interrupted and
- * needing cancellation, and set the state to
- * running. When the thread resumes, it will
- * remove itself from the queue and call the
- * cancellation completion routine.
- */
- pthread->interrupted = 1;
- pthread->cancelflags |= THR_CANCEL_NEEDED;
- kmbx = _thr_setrunnable_unlocked(pthread);
- pthread->continuation =
- _thr_finish_cancellation;
- break;
-
- case PS_DEAD:
- case PS_DEADLOCK:
- case PS_STATE_MAX:
- /* Ignore - only here to silence -Wall: */
- break;
- }
- if ((pthread->cancelflags & THR_AT_CANCEL_POINT) &&
- (pthread->blocked != 0 ||
- pthread->attr.flags & PTHREAD_SCOPE_SYSTEM))
- kse_thr_interrupt(&pthread->tcb->tcb_tmbx,
- KSE_INTR_INTERRUPT, 0);
- }
-
- /*
- * Release the thread's lock and remove the
- * reference:
- */
- THR_SCHED_UNLOCK(curthread, pthread);
- THR_THREAD_UNLOCK(curthread, pthread);
- _thr_ref_delete(curthread, pthread);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
-
- if ((joinee != NULL) &&
- (_thr_ref_add(curthread, joinee, /* include dead */1) == 0)) {
- /* Remove the joiner from the joinee. */
- THR_SCHED_LOCK(curthread, joinee);
- joinee->joiner = NULL;
- THR_SCHED_UNLOCK(curthread, joinee);
- _thr_ref_delete(curthread, joinee);
- }
- }
- return (ret);
-}
-
-int
-_pthread_setcancelstate(int state, int *oldstate)
-{
- struct pthread *curthread = _get_curthread();
- int ostate;
- int ret;
- int need_exit = 0;
-
- /* Take the thread's lock while fiddling with the state: */
- THR_THREAD_LOCK(curthread, curthread);
-
- ostate = curthread->cancelflags & PTHREAD_CANCEL_DISABLE;
-
- switch (state) {
- case PTHREAD_CANCEL_ENABLE:
- curthread->cancelflags &= ~PTHREAD_CANCEL_DISABLE;
- if ((curthread->cancelflags & PTHREAD_CANCEL_ASYNCHRONOUS) != 0)
- need_exit = checkcancel(curthread);
- ret = 0;
- break;
- case PTHREAD_CANCEL_DISABLE:
- curthread->cancelflags |= PTHREAD_CANCEL_DISABLE;
- ret = 0;
- break;
- default:
- ret = EINVAL;
- }
-
- THR_THREAD_UNLOCK(curthread, curthread);
- if (need_exit != 0) {
- _thr_exit_cleanup();
- pthread_exit(PTHREAD_CANCELED);
- PANIC("cancel");
- }
- if (ret == 0 && oldstate != NULL)
- *oldstate = ostate;
-
- return (ret);
-}
-
-int
-_pthread_setcanceltype(int type, int *oldtype)
-{
- struct pthread *curthread = _get_curthread();
- int otype;
- int ret;
- int need_exit = 0;
-
- /* Take the thread's lock while fiddling with the state: */
- THR_THREAD_LOCK(curthread, curthread);
-
- otype = curthread->cancelflags & PTHREAD_CANCEL_ASYNCHRONOUS;
- switch (type) {
- case PTHREAD_CANCEL_ASYNCHRONOUS:
- curthread->cancelflags |= PTHREAD_CANCEL_ASYNCHRONOUS;
- need_exit = checkcancel(curthread);
- ret = 0;
- break;
- case PTHREAD_CANCEL_DEFERRED:
- curthread->cancelflags &= ~PTHREAD_CANCEL_ASYNCHRONOUS;
- ret = 0;
- break;
- default:
- ret = EINVAL;
- }
-
- THR_THREAD_UNLOCK(curthread, curthread);
- if (need_exit != 0) {
- _thr_exit_cleanup();
- pthread_exit(PTHREAD_CANCELED);
- PANIC("cancel");
- }
- if (ret == 0 && oldtype != NULL)
- *oldtype = otype;
-
- return (ret);
-}
-
-void
-_pthread_testcancel(void)
-{
- struct pthread *curthread = _get_curthread();
-
- THR_THREAD_LOCK(curthread, curthread);
- testcancel(curthread);
- THR_THREAD_UNLOCK(curthread, curthread);
-}
-
-void
-_thr_cancel_enter(struct pthread *thread)
-{
- /* Look for a cancellation before we block: */
- THR_THREAD_LOCK(thread, thread);
- testcancel(thread);
- thread->cancelflags |= THR_AT_CANCEL_POINT;
- THR_THREAD_UNLOCK(thread, thread);
-}
-
-void
-_thr_cancel_leave(struct pthread *thread, int check)
-{
- THR_THREAD_LOCK(thread, thread);
- thread->cancelflags &= ~THR_AT_CANCEL_POINT;
- /* Look for a cancellation after we unblock: */
- if (check)
- testcancel(thread);
- THR_THREAD_UNLOCK(thread, thread);
-}
-
-void
-_thr_finish_cancellation(void *arg)
-{
- struct pthread *curthread = _get_curthread();
-
- curthread->continuation = NULL;
- curthread->interrupted = 0;
-
- THR_THREAD_LOCK(curthread, curthread);
- if ((curthread->cancelflags & THR_CANCEL_NEEDED) != 0) {
- curthread->cancelflags &= ~THR_CANCEL_NEEDED;
- THR_THREAD_UNLOCK(curthread, curthread);
- _thr_exit_cleanup();
- pthread_exit(PTHREAD_CANCELED);
- }
- THR_THREAD_UNLOCK(curthread, curthread);
-}
diff --git a/lib/libkse/thread/thr_clean.c b/lib/libkse/thread/thr_clean.c
deleted file mode 100644
index 1da8a6b..0000000
--- a/lib/libkse/thread/thr_clean.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <signal.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_cleanup_push, pthread_cleanup_push);
-__weak_reference(_pthread_cleanup_pop, pthread_cleanup_pop);
-
-void
-_pthread_cleanup_push(void (*routine) (void *), void *routine_arg)
-{
- struct pthread *curthread = _get_curthread();
- struct pthread_cleanup *new;
-
- if ((new = (struct pthread_cleanup *)
- malloc(sizeof(struct pthread_cleanup))) != NULL) {
- new->routine = routine;
- new->routine_arg = routine_arg;
- new->onstack = 0;
- new->next = curthread->cleanup;
-
- curthread->cleanup = new;
- }
-}
-
-void
-_pthread_cleanup_pop(int execute)
-{
- struct pthread *curthread = _get_curthread();
- struct pthread_cleanup *old;
-
- if ((old = curthread->cleanup) != NULL) {
- curthread->cleanup = old->next;
- if (execute) {
- old->routine(old->routine_arg);
- }
- if (old->onstack == 0)
- free(old);
- }
-}
diff --git a/lib/libkse/thread/thr_close.c b/lib/libkse/thread/thr_close.c
deleted file mode 100644
index 263d4a6..0000000
--- a/lib/libkse/thread/thr_close.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__close, close);
-
-int
-__close(int fd)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = __sys_close(fd);
- _thr_cancel_leave(curthread, 1);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_concurrency.c b/lib/libkse/thread/thr_concurrency.c
deleted file mode 100644
index daea56c..0000000
--- a/lib/libkse/thread/thr_concurrency.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel M. Eischen <deischen@freebsd.org>
- * Copyright (c) 2003 Sergey Osokin <osa@freebsd.org.ru>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/sysctl.h>
-
-#include "thr_private.h"
-
-/*#define DEBUG_CONCURRENCY */
-#ifdef DEBUG_CONCURRENCY
-#define DBG_MSG stdout_debug
-#else
-#define DBG_MSG(x...)
-#endif
-
-static int level = 0;
-
-__weak_reference(_pthread_getconcurrency, pthread_getconcurrency);
-__weak_reference(_pthread_setconcurrency, pthread_setconcurrency);
-
-int
-_pthread_getconcurrency(void)
-{
- return (level);
-}
-
-int
-_pthread_setconcurrency(int new_level)
-{
- int ret;
-
- if (new_level < 0)
- ret = EINVAL;
- else if (new_level == level)
- ret = 0;
- else if (new_level == 0) {
- level = 0;
- ret = 0;
- } else if ((_kse_isthreaded() == 0) && (_kse_setthreaded(1) != 0)) {
- DBG_MSG("Can't enable threading.\n");
- ret = EAGAIN;
- } else {
- ret = _thr_setconcurrency(new_level);
- if (ret == 0)
- level = new_level;
- }
- return (ret);
-}
-
-int
-_thr_setconcurrency(int new_level)
-{
- struct pthread *curthread;
- struct kse *newkse, *kse;
- kse_critical_t crit;
- int kse_count;
- int i;
- int ret;
-
- /*
- * Turn on threaded mode, if failed, it is unnecessary to
- * do further work.
- */
- if (_kse_isthreaded() == 0 && _kse_setthreaded(1))
- return (EAGAIN);
-
- ret = 0;
- curthread = _get_curthread();
- /* Race condition, but so what. */
- kse_count = _kse_initial->k_kseg->kg_ksecount;
- if (new_level > kse_count) {
- for (i = kse_count; i < new_level; i++) {
- newkse = _kse_alloc(curthread, 0);
- if (newkse == NULL) {
- DBG_MSG("Can't alloc new KSE.\n");
- ret = EAGAIN;
- break;
- }
- newkse->k_kseg = _kse_initial->k_kseg;
- newkse->k_schedq = _kse_initial->k_schedq;
- newkse->k_curthread = NULL;
- crit = _kse_critical_enter();
- KSE_SCHED_LOCK(curthread->kse, newkse->k_kseg);
- TAILQ_INSERT_TAIL(&newkse->k_kseg->kg_kseq,
- newkse, k_kgqe);
- newkse->k_kseg->kg_ksecount++;
- newkse->k_flags |= KF_STARTED;
- KSE_SCHED_UNLOCK(curthread->kse, newkse->k_kseg);
- if (kse_create(&newkse->k_kcb->kcb_kmbx, 0) != 0) {
- KSE_SCHED_LOCK(curthread->kse, newkse->k_kseg);
- TAILQ_REMOVE(&newkse->k_kseg->kg_kseq,
- newkse, k_kgqe);
- newkse->k_kseg->kg_ksecount--;
- KSE_SCHED_UNLOCK(curthread->kse,
- newkse->k_kseg);
- _kse_critical_leave(crit);
- _kse_free(curthread, newkse);
- DBG_MSG("kse_create syscall failed.\n");
- ret = EAGAIN;
- break;
- } else {
- _kse_critical_leave(crit);
- }
- }
- } else if (new_level < kse_count) {
- kse_count = 0;
- crit = _kse_critical_enter();
- KSE_SCHED_LOCK(curthread->kse, _kse_initial->k_kseg);
- /* Count the number of active KSEs */
- TAILQ_FOREACH(kse, &_kse_initial->k_kseg->kg_kseq, k_kgqe) {
- if ((kse->k_flags & KF_TERMINATED) == 0)
- kse_count++;
- }
- /* Reduce the number of active KSEs appropriately. */
- kse = TAILQ_FIRST(&_kse_initial->k_kseg->kg_kseq);
- while ((kse != NULL) && (kse_count > new_level)) {
- if ((kse != _kse_initial) &&
- ((kse->k_flags & KF_TERMINATED) == 0)) {
- kse->k_flags |= KF_TERMINATED;
- kse_count--;
- /* Wakup the KSE in case it is idle. */
- kse_wakeup(&kse->k_kcb->kcb_kmbx);
- }
- kse = TAILQ_NEXT(kse, k_kgqe);
- }
- KSE_SCHED_UNLOCK(curthread->kse, _kse_initial->k_kseg);
- _kse_critical_leave(crit);
- }
- return (ret);
-}
-
-int
-_thr_setmaxconcurrency(void)
-{
- int vcpu;
- size_t len;
- int ret;
-
- len = sizeof(vcpu);
- ret = sysctlbyname("kern.threads.virtual_cpu", &vcpu, &len, NULL, 0);
- if (ret == 0 && vcpu > 0)
- ret = _thr_setconcurrency(vcpu);
- return (ret);
-}
-
diff --git a/lib/libkse/thread/thr_cond.c b/lib/libkse/thread/thr_cond.c
deleted file mode 100644
index cd719d4..0000000
--- a/lib/libkse/thread/thr_cond.c
+++ /dev/null
@@ -1,832 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-#define THR_IN_CONDQ(thr) (((thr)->sflags & THR_FLAGS_IN_SYNCQ) != 0)
-#define THR_CONDQ_SET(thr) (thr)->sflags |= THR_FLAGS_IN_SYNCQ
-#define THR_CONDQ_CLEAR(thr) (thr)->sflags &= ~THR_FLAGS_IN_SYNCQ
-
-/*
- * Prototypes
- */
-static inline struct pthread *cond_queue_deq(pthread_cond_t);
-static inline void cond_queue_remove(pthread_cond_t, pthread_t);
-static inline void cond_queue_enq(pthread_cond_t, pthread_t);
-static void cond_wait_backout(void *);
-static inline void check_continuation(struct pthread *,
- struct pthread_cond *, pthread_mutex_t *);
-
-/*
- * Double underscore versions are cancellation points. Single underscore
- * versions are not and are provided for libc internal usage (which
- * shouldn't introduce cancellation points).
- */
-__weak_reference(__pthread_cond_wait, pthread_cond_wait);
-__weak_reference(__pthread_cond_timedwait, pthread_cond_timedwait);
-
-__weak_reference(_pthread_cond_init, pthread_cond_init);
-__weak_reference(_pthread_cond_destroy, pthread_cond_destroy);
-__weak_reference(_pthread_cond_signal, pthread_cond_signal);
-__weak_reference(_pthread_cond_broadcast, pthread_cond_broadcast);
-
-
-int
-_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr)
-{
- enum pthread_cond_type type;
- pthread_cond_t pcond;
- int flags;
- int rval = 0;
-
- if (cond == NULL)
- rval = EINVAL;
- else {
- /*
- * Check if a pointer to a condition variable attribute
- * structure was passed by the caller:
- */
- if (cond_attr != NULL && *cond_attr != NULL) {
- /* Default to a fast condition variable: */
- type = (*cond_attr)->c_type;
- flags = (*cond_attr)->c_flags;
- } else {
- /* Default to a fast condition variable: */
- type = COND_TYPE_FAST;
- flags = 0;
- }
-
- /* Process according to condition variable type: */
- switch (type) {
- /* Fast condition variable: */
- case COND_TYPE_FAST:
- /* Nothing to do here. */
- break;
-
- /* Trap invalid condition variable types: */
- default:
- /* Return an invalid argument error: */
- rval = EINVAL;
- break;
- }
-
- /* Check for no errors: */
- if (rval == 0) {
- if ((pcond = (pthread_cond_t)
- malloc(sizeof(struct pthread_cond))) == NULL) {
- rval = ENOMEM;
- } else if (_lock_init(&pcond->c_lock, LCK_ADAPTIVE,
- _thr_lock_wait, _thr_lock_wakeup) != 0) {
- free(pcond);
- rval = ENOMEM;
- } else {
- /*
- * Initialise the condition variable
- * structure:
- */
- TAILQ_INIT(&pcond->c_queue);
- pcond->c_flags = COND_FLAGS_INITED;
- pcond->c_type = type;
- pcond->c_mutex = NULL;
- pcond->c_seqno = 0;
- *cond = pcond;
- }
- }
- }
- /* Return the completion status: */
- return (rval);
-}
-
-int
-_pthread_cond_destroy(pthread_cond_t *cond)
-{
- struct pthread_cond *cv;
- struct pthread *curthread = _get_curthread();
- int rval = 0;
-
- if (cond == NULL || *cond == NULL)
- rval = EINVAL;
- else {
- /* Lock the condition variable structure: */
- THR_LOCK_ACQUIRE(curthread, &(*cond)->c_lock);
-
- /*
- * NULL the caller's pointer now that the condition
- * variable has been destroyed:
- */
- cv = *cond;
- *cond = NULL;
-
- /* Unlock the condition variable structure: */
- THR_LOCK_RELEASE(curthread, &cv->c_lock);
-
- /* Free the cond lock structure: */
- _lock_destroy(&cv->c_lock);
-
- /*
- * Free the memory allocated for the condition
- * variable structure:
- */
- free(cv);
-
- }
- /* Return the completion status: */
- return (rval);
-}
-
-int
-_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- struct pthread *curthread = _get_curthread();
- int rval = 0;
- int done = 0;
- int mutex_locked = 1;
- int seqno;
-
- if (cond == NULL)
- return (EINVAL);
-
- /*
- * If the condition variable is statically initialized,
- * perform the dynamic initialization:
- */
- if (*cond == NULL &&
- (rval = pthread_cond_init(cond, NULL)) != 0)
- return (rval);
-
- if (!_kse_isthreaded())
- _kse_setthreaded(1);
-
- /*
- * Enter a loop waiting for a condition signal or broadcast
- * to wake up this thread. A loop is needed in case the waiting
- * thread is interrupted by a signal to execute a signal handler.
- * It is not (currently) possible to remain in the waiting queue
- * while running a handler. Instead, the thread is interrupted
- * and backed out of the waiting queue prior to executing the
- * signal handler.
- */
-
- /* Lock the condition variable structure: */
- THR_LOCK_ACQUIRE(curthread, &(*cond)->c_lock);
- seqno = (*cond)->c_seqno;
- do {
- /*
- * If the condvar was statically allocated, properly
- * initialize the tail queue.
- */
- if (((*cond)->c_flags & COND_FLAGS_INITED) == 0) {
- TAILQ_INIT(&(*cond)->c_queue);
- (*cond)->c_flags |= COND_FLAGS_INITED;
- }
-
- /* Process according to condition variable type: */
- switch ((*cond)->c_type) {
- /* Fast condition variable: */
- case COND_TYPE_FAST:
- if ((mutex == NULL) || (((*cond)->c_mutex != NULL) &&
- ((*cond)->c_mutex != *mutex))) {
- /* Return invalid argument error: */
- rval = EINVAL;
- } else {
- /* Reset the timeout and interrupted flags: */
- curthread->timeout = 0;
- curthread->interrupted = 0;
-
- /*
- * Queue the running thread for the condition
- * variable:
- */
- cond_queue_enq(*cond, curthread);
-
- /* Wait forever: */
- curthread->wakeup_time.tv_sec = -1;
-
- /* Unlock the mutex: */
- if (mutex_locked &&
- ((rval = _mutex_cv_unlock(mutex)) != 0)) {
- /*
- * Cannot unlock the mutex, so remove
- * the running thread from the condition
- * variable queue:
- */
- cond_queue_remove(*cond, curthread);
- }
- else {
- /* Remember the mutex: */
- (*cond)->c_mutex = *mutex;
-
- /*
- * Don't unlock the mutex the next
- * time through the loop (if the
- * thread has to be requeued after
- * handling a signal).
- */
- mutex_locked = 0;
-
- /*
- * This thread is active and is in a
- * critical region (holding the cv
- * lock); we should be able to safely
- * set the state.
- */
- THR_SCHED_LOCK(curthread, curthread);
- THR_SET_STATE(curthread, PS_COND_WAIT);
-
- /* Remember the CV: */
- curthread->data.cond = *cond;
- curthread->sigbackout = cond_wait_backout;
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Unlock the CV structure: */
- THR_LOCK_RELEASE(curthread,
- &(*cond)->c_lock);
-
- /* Schedule the next thread: */
- _thr_sched_switch(curthread);
-
- /*
- * XXX - This really isn't a good check
- * since there can be more than one
- * thread waiting on the CV. Signals
- * sent to threads waiting on mutexes
- * or CVs should really be deferred
- * until the threads are no longer
- * waiting, but POSIX says that signals
- * should be sent "as soon as possible".
- */
- done = (seqno != (*cond)->c_seqno);
- if (done && !THR_IN_CONDQ(curthread)) {
- /*
- * The thread is dequeued, so
- * it is safe to clear these.
- */
- curthread->data.cond = NULL;
- curthread->sigbackout = NULL;
- check_continuation(curthread,
- NULL, mutex);
- return (_mutex_cv_lock(mutex));
- }
-
- /* Relock the CV structure: */
- THR_LOCK_ACQUIRE(curthread,
- &(*cond)->c_lock);
-
- /*
- * Clear these after taking the lock to
- * prevent a race condition where a
- * signal can arrive before dequeueing
- * the thread.
- */
- curthread->data.cond = NULL;
- curthread->sigbackout = NULL;
- done = (seqno != (*cond)->c_seqno);
-
- if (THR_IN_CONDQ(curthread)) {
- cond_queue_remove(*cond,
- curthread);
-
- /* Check for no more waiters: */
- if (TAILQ_FIRST(&(*cond)->c_queue) == NULL)
- (*cond)->c_mutex = NULL;
- }
- }
- }
- break;
-
- /* Trap invalid condition variable types: */
- default:
- /* Return an invalid argument error: */
- rval = EINVAL;
- break;
- }
-
- check_continuation(curthread, *cond,
- mutex_locked ? NULL : mutex);
- } while ((done == 0) && (rval == 0));
-
- /* Unlock the condition variable structure: */
- THR_LOCK_RELEASE(curthread, &(*cond)->c_lock);
-
- if (mutex_locked == 0)
- _mutex_cv_lock(mutex);
-
- /* Return the completion status: */
- return (rval);
-}
-
-__strong_reference(_pthread_cond_wait, _thr_cond_wait);
-
-int
-__pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = _pthread_cond_wait(cond, mutex);
- _thr_cancel_leave(curthread, 1);
- return (ret);
-}
-
-int
-_pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex,
- const struct timespec * abstime)
-{
- struct pthread *curthread = _get_curthread();
- int rval = 0;
- int done = 0;
- int mutex_locked = 1;
- int seqno;
-
- THR_ASSERT(curthread->locklevel == 0,
- "cv_timedwait: locklevel is not zero!");
-
- if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0 ||
- abstime->tv_nsec >= 1000000000)
- return (EINVAL);
- /*
- * If the condition variable is statically initialized, perform dynamic
- * initialization.
- */
- if (*cond == NULL && (rval = pthread_cond_init(cond, NULL)) != 0)
- return (rval);
-
- if (!_kse_isthreaded())
- _kse_setthreaded(1);
-
- /*
- * Enter a loop waiting for a condition signal or broadcast
- * to wake up this thread. A loop is needed in case the waiting
- * thread is interrupted by a signal to execute a signal handler.
- * It is not (currently) possible to remain in the waiting queue
- * while running a handler. Instead, the thread is interrupted
- * and backed out of the waiting queue prior to executing the
- * signal handler.
- */
-
- /* Lock the condition variable structure: */
- THR_LOCK_ACQUIRE(curthread, &(*cond)->c_lock);
- seqno = (*cond)->c_seqno;
- do {
- /*
- * If the condvar was statically allocated, properly
- * initialize the tail queue.
- */
- if (((*cond)->c_flags & COND_FLAGS_INITED) == 0) {
- TAILQ_INIT(&(*cond)->c_queue);
- (*cond)->c_flags |= COND_FLAGS_INITED;
- }
-
- /* Process according to condition variable type: */
- switch ((*cond)->c_type) {
- /* Fast condition variable: */
- case COND_TYPE_FAST:
- if ((mutex == NULL) || (((*cond)->c_mutex != NULL) &&
- ((*cond)->c_mutex != *mutex))) {
- /* Return invalid argument error: */
- rval = EINVAL;
- } else {
- /* Set the wakeup time: */
- curthread->wakeup_time.tv_sec = abstime->tv_sec;
- curthread->wakeup_time.tv_nsec =
- abstime->tv_nsec;
-
- /* Reset the timeout and interrupted flags: */
- curthread->timeout = 0;
- curthread->interrupted = 0;
-
- /*
- * Queue the running thread for the condition
- * variable:
- */
- cond_queue_enq(*cond, curthread);
-
- /* Unlock the mutex: */
- if (mutex_locked &&
- ((rval = _mutex_cv_unlock(mutex)) != 0)) {
- /*
- * Cannot unlock the mutex; remove the
- * running thread from the condition
- * variable queue:
- */
- cond_queue_remove(*cond, curthread);
- } else {
- /* Remember the mutex: */
- (*cond)->c_mutex = *mutex;
-
- /*
- * Don't unlock the mutex the next
- * time through the loop (if the
- * thread has to be requeued after
- * handling a signal).
- */
- mutex_locked = 0;
-
- /*
- * This thread is active and is in a
- * critical region (holding the cv
- * lock); we should be able to safely
- * set the state.
- */
- THR_SCHED_LOCK(curthread, curthread);
- THR_SET_STATE(curthread, PS_COND_WAIT);
-
- /* Remember the CV: */
- curthread->data.cond = *cond;
- curthread->sigbackout = cond_wait_backout;
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Unlock the CV structure: */
- THR_LOCK_RELEASE(curthread,
- &(*cond)->c_lock);
-
- /* Schedule the next thread: */
- _thr_sched_switch(curthread);
-
- /*
- * XXX - This really isn't a good check
- * since there can be more than one
- * thread waiting on the CV. Signals
- * sent to threads waiting on mutexes
- * or CVs should really be deferred
- * until the threads are no longer
- * waiting, but POSIX says that signals
- * should be sent "as soon as possible".
- */
- done = (seqno != (*cond)->c_seqno);
- if (done && !THR_IN_CONDQ(curthread)) {
- /*
- * The thread is dequeued, so
- * it is safe to clear these.
- */
- curthread->data.cond = NULL;
- curthread->sigbackout = NULL;
- check_continuation(curthread,
- NULL, mutex);
- return (_mutex_cv_lock(mutex));
- }
-
- /* Relock the CV structure: */
- THR_LOCK_ACQUIRE(curthread,
- &(*cond)->c_lock);
-
- /*
- * Clear these after taking the lock to
- * prevent a race condition where a
- * signal can arrive before dequeueing
- * the thread.
- */
- curthread->data.cond = NULL;
- curthread->sigbackout = NULL;
-
- done = (seqno != (*cond)->c_seqno);
-
- if (THR_IN_CONDQ(curthread)) {
- cond_queue_remove(*cond,
- curthread);
-
- /* Check for no more waiters: */
- if (TAILQ_FIRST(&(*cond)->c_queue) == NULL)
- (*cond)->c_mutex = NULL;
- }
-
- if (curthread->timeout != 0) {
- /* The wait timedout. */
- rval = ETIMEDOUT;
- }
- }
- }
- break;
-
- /* Trap invalid condition variable types: */
- default:
- /* Return an invalid argument error: */
- rval = EINVAL;
- break;
- }
-
- check_continuation(curthread, *cond,
- mutex_locked ? NULL : mutex);
- } while ((done == 0) && (rval == 0));
-
- /* Unlock the condition variable structure: */
- THR_LOCK_RELEASE(curthread, &(*cond)->c_lock);
-
- if (mutex_locked == 0)
- _mutex_cv_lock(mutex);
-
- /* Return the completion status: */
- return (rval);
-}
-
-int
-__pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- const struct timespec *abstime)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = _pthread_cond_timedwait(cond, mutex, abstime);
- _thr_cancel_leave(curthread, 1);
- return (ret);
-}
-
-
-int
-_pthread_cond_signal(pthread_cond_t * cond)
-{
- struct pthread *curthread = _get_curthread();
- struct pthread *pthread;
- struct kse_mailbox *kmbx;
- int rval = 0;
-
- THR_ASSERT(curthread->locklevel == 0,
- "cv_timedwait: locklevel is not zero!");
- if (cond == NULL)
- rval = EINVAL;
- /*
- * If the condition variable is statically initialized, perform dynamic
- * initialization.
- */
- else if (*cond != NULL || (rval = pthread_cond_init(cond, NULL)) == 0) {
- /* Lock the condition variable structure: */
- THR_LOCK_ACQUIRE(curthread, &(*cond)->c_lock);
-
- /* Process according to condition variable type: */
- switch ((*cond)->c_type) {
- /* Fast condition variable: */
- case COND_TYPE_FAST:
- /* Increment the sequence number: */
- (*cond)->c_seqno++;
-
- /*
- * Wakeups have to be done with the CV lock held;
- * otherwise there is a race condition where the
- * thread can timeout, run on another KSE, and enter
- * another blocking state (including blocking on a CV).
- */
- if ((pthread = TAILQ_FIRST(&(*cond)->c_queue))
- != NULL) {
- THR_SCHED_LOCK(curthread, pthread);
- cond_queue_remove(*cond, pthread);
- pthread->sigbackout = NULL;
- if ((pthread->kseg == curthread->kseg) &&
- (pthread->active_priority >
- curthread->active_priority))
- curthread->critical_yield = 1;
- kmbx = _thr_setrunnable_unlocked(pthread);
- THR_SCHED_UNLOCK(curthread, pthread);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- }
- /* Check for no more waiters: */
- if (TAILQ_FIRST(&(*cond)->c_queue) == NULL)
- (*cond)->c_mutex = NULL;
- break;
-
- /* Trap invalid condition variable types: */
- default:
- /* Return an invalid argument error: */
- rval = EINVAL;
- break;
- }
-
- /* Unlock the condition variable structure: */
- THR_LOCK_RELEASE(curthread, &(*cond)->c_lock);
- }
-
- /* Return the completion status: */
- return (rval);
-}
-
-__strong_reference(_pthread_cond_signal, _thr_cond_signal);
-
-int
-_pthread_cond_broadcast(pthread_cond_t * cond)
-{
- struct pthread *curthread = _get_curthread();
- struct pthread *pthread;
- struct kse_mailbox *kmbx;
- int rval = 0;
-
- THR_ASSERT(curthread->locklevel == 0,
- "cv_timedwait: locklevel is not zero!");
- if (cond == NULL)
- rval = EINVAL;
- /*
- * If the condition variable is statically initialized, perform dynamic
- * initialization.
- */
- else if (*cond != NULL || (rval = pthread_cond_init(cond, NULL)) == 0) {
- /* Lock the condition variable structure: */
- THR_LOCK_ACQUIRE(curthread, &(*cond)->c_lock);
-
- /* Process according to condition variable type: */
- switch ((*cond)->c_type) {
- /* Fast condition variable: */
- case COND_TYPE_FAST:
- /* Increment the sequence number: */
- (*cond)->c_seqno++;
-
- /*
- * Enter a loop to bring all threads off the
- * condition queue:
- */
- while ((pthread = TAILQ_FIRST(&(*cond)->c_queue))
- != NULL) {
- THR_SCHED_LOCK(curthread, pthread);
- cond_queue_remove(*cond, pthread);
- pthread->sigbackout = NULL;
- if ((pthread->kseg == curthread->kseg) &&
- (pthread->active_priority >
- curthread->active_priority))
- curthread->critical_yield = 1;
- kmbx = _thr_setrunnable_unlocked(pthread);
- THR_SCHED_UNLOCK(curthread, pthread);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- }
-
- /* There are no more waiting threads: */
- (*cond)->c_mutex = NULL;
- break;
-
- /* Trap invalid condition variable types: */
- default:
- /* Return an invalid argument error: */
- rval = EINVAL;
- break;
- }
-
- /* Unlock the condition variable structure: */
- THR_LOCK_RELEASE(curthread, &(*cond)->c_lock);
- }
-
- /* Return the completion status: */
- return (rval);
-}
-
-__strong_reference(_pthread_cond_broadcast, _thr_cond_broadcast);
-
-static inline void
-check_continuation(struct pthread *curthread, struct pthread_cond *cond,
- pthread_mutex_t *mutex)
-{
- if ((curthread->interrupted != 0) &&
- (curthread->continuation != NULL)) {
- if (cond != NULL)
- /* Unlock the condition variable structure: */
- THR_LOCK_RELEASE(curthread, &cond->c_lock);
- /*
- * Note that even though this thread may have been
- * canceled, POSIX requires that the mutex be
- * reaquired prior to cancellation.
- */
- if (mutex != NULL)
- _mutex_cv_lock(mutex);
- curthread->continuation((void *) curthread);
- PANIC("continuation returned in pthread_cond_wait.\n");
- }
-}
-
-static void
-cond_wait_backout(void *arg)
-{
- struct pthread *curthread = (struct pthread *)arg;
- pthread_cond_t cond;
-
- cond = curthread->data.cond;
- if (cond != NULL) {
- /* Lock the condition variable structure: */
- THR_LOCK_ACQUIRE(curthread, &cond->c_lock);
-
- /* Process according to condition variable type: */
- switch (cond->c_type) {
- /* Fast condition variable: */
- case COND_TYPE_FAST:
- cond_queue_remove(cond, curthread);
-
- /* Check for no more waiters: */
- if (TAILQ_FIRST(&cond->c_queue) == NULL)
- cond->c_mutex = NULL;
- break;
-
- default:
- break;
- }
-
- /* Unlock the condition variable structure: */
- THR_LOCK_RELEASE(curthread, &cond->c_lock);
- }
- /* No need to call this again. */
- curthread->sigbackout = NULL;
-}
-
-/*
- * Dequeue a waiting thread from the head of a condition queue in
- * descending priority order.
- */
-static inline struct pthread *
-cond_queue_deq(pthread_cond_t cond)
-{
- struct pthread *pthread;
-
- while ((pthread = TAILQ_FIRST(&cond->c_queue)) != NULL) {
- TAILQ_REMOVE(&cond->c_queue, pthread, sqe);
- THR_CONDQ_CLEAR(pthread);
- if ((pthread->timeout == 0) && (pthread->interrupted == 0))
- /*
- * Only exit the loop when we find a thread
- * that hasn't timed out or been canceled;
- * those threads are already running and don't
- * need their run state changed.
- */
- break;
- }
-
- return (pthread);
-}
-
-/*
- * Remove a waiting thread from a condition queue in descending priority
- * order.
- */
-static inline void
-cond_queue_remove(pthread_cond_t cond, struct pthread *pthread)
-{
- /*
- * Because pthread_cond_timedwait() can timeout as well
- * as be signaled by another thread, it is necessary to
- * guard against removing the thread from the queue if
- * it isn't in the queue.
- */
- if (THR_IN_CONDQ(pthread)) {
- TAILQ_REMOVE(&cond->c_queue, pthread, sqe);
- THR_CONDQ_CLEAR(pthread);
- }
-}
-
-/*
- * Enqueue a waiting thread to a condition queue in descending priority
- * order.
- */
-static inline void
-cond_queue_enq(pthread_cond_t cond, struct pthread *pthread)
-{
- struct pthread *tid = TAILQ_LAST(&cond->c_queue, cond_head);
-
- THR_ASSERT(!THR_IN_SYNCQ(pthread),
- "cond_queue_enq: thread already queued!");
-
- /*
- * For the common case of all threads having equal priority,
- * we perform a quick check against the priority of the thread
- * at the tail of the queue.
- */
- if ((tid == NULL) || (pthread->active_priority <= tid->active_priority))
- TAILQ_INSERT_TAIL(&cond->c_queue, pthread, sqe);
- else {
- tid = TAILQ_FIRST(&cond->c_queue);
- while (pthread->active_priority <= tid->active_priority)
- tid = TAILQ_NEXT(tid, sqe);
- TAILQ_INSERT_BEFORE(tid, pthread, sqe);
- }
- THR_CONDQ_SET(pthread);
- pthread->data.cond = cond;
-}
diff --git a/lib/libkse/thread/thr_condattr_destroy.c b/lib/libkse/thread/thr_condattr_destroy.c
deleted file mode 100644
index e0ade00..0000000
--- a/lib/libkse/thread/thr_condattr_destroy.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdlib.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_condattr_destroy, pthread_condattr_destroy);
-
-int
-_pthread_condattr_destroy(pthread_condattr_t *attr)
-{
- int ret;
- if (attr == NULL || *attr == NULL) {
- ret = EINVAL;
- } else {
- free(*attr);
- *attr = NULL;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_condattr_init.c b/lib/libkse/thread/thr_condattr_init.c
deleted file mode 100644
index 7cf4c9e..0000000
--- a/lib/libkse/thread/thr_condattr_init.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_condattr_init, pthread_condattr_init);
-
-int
-_pthread_condattr_init(pthread_condattr_t *attr)
-{
- int ret;
- pthread_condattr_t pattr;
-
- if ((pattr = (pthread_condattr_t)
- malloc(sizeof(struct pthread_cond_attr))) == NULL) {
- ret = ENOMEM;
- } else {
- memcpy(pattr, &_pthread_condattr_default,
- sizeof(struct pthread_cond_attr));
- *attr = pattr;
- ret = 0;
- }
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_connect.c b/lib/libkse/thread/thr_connect.c
deleted file mode 100644
index 2d5614b..0000000
--- a/lib/libkse/thread/thr_connect.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__connect, connect);
-
-int
-__connect(int fd, const struct sockaddr *name, socklen_t namelen)
-{
- struct pthread *curthread;
- int ret;
-
- curthread = _get_curthread();
- _thr_cancel_enter(curthread);
- ret = __sys_connect(fd, name, namelen);
- _thr_cancel_leave(curthread, ret == -1);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_creat.c b/lib/libkse/thread/thr_creat.c
deleted file mode 100644
index d2a91bf..0000000
--- a/lib/libkse/thread/thr_creat.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <fcntl.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-extern int __creat(const char *, mode_t);
-
-__weak_reference(___creat, creat);
-
-int
-___creat(const char *path, mode_t mode)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = __creat(path, mode);
- /*
- * To avoid possible file handle leak,
- * only check cancellation point if it is failure
- */
- _thr_cancel_leave(curthread, (ret == -1));
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_create.c b/lib/libkse/thread/thr_create.c
deleted file mode 100644
index 08b2c47..0000000
--- a/lib/libkse/thread/thr_create.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel M. Eischen <deischen@gdeb.com>
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stddef.h>
-#include <sys/time.h>
-#include <machine/reg.h>
-#include <pthread.h>
-#include "thr_private.h"
-#include "libc_private.h"
-
-static void free_thread(struct pthread *curthread, struct pthread *thread);
-static int create_stack(struct pthread_attr *pattr);
-static void free_stack(struct pthread_attr *pattr);
-static void thread_start(struct pthread *curthread,
- void *(*start_routine) (void *), void *arg);
-
-__weak_reference(_pthread_create, pthread_create);
-
-/*
- * Some notes on new thread creation and first time initializion
- * to enable multi-threading.
- *
- * There are basically two things that need to be done.
- *
- * 1) The internal library variables must be initialized.
- * 2) Upcalls need to be enabled to allow multiple threads
- * to be run.
- *
- * The first may be done as a result of other pthread functions
- * being called. When _thr_initial is null, _libpthread_init is
- * called to initialize the internal variables; this also creates
- * or sets the initial thread. It'd be nice to automatically
- * have _libpthread_init called on program execution so we don't
- * have to have checks throughout the library.
- *
- * The second part is only triggered by the creation of the first
- * thread (other than the initial/main thread). If the thread
- * being created is a scope system thread, then a new KSE/KSEG
- * pair needs to be allocated. Also, if upcalls haven't been
- * enabled on the initial thread's KSE, they must be now that
- * there is more than one thread; this could be delayed until
- * the initial KSEG has more than one thread.
- */
-int
-_pthread_create(pthread_t * thread, const pthread_attr_t * attr,
- void *(*start_routine) (void *), void *arg)
-{
- struct pthread *curthread, *new_thread;
- struct kse *kse = NULL;
- struct kse_group *kseg = NULL;
- kse_critical_t crit;
- int ret = 0;
-
- if (_thr_initial == NULL)
- _libpthread_init(NULL);
-
- /*
- * Turn on threaded mode, if failed, it is unnecessary to
- * do further work.
- */
- if (_kse_isthreaded() == 0 && _kse_setthreaded(1)) {
- return (EAGAIN);
- }
- curthread = _get_curthread();
-
- /*
- * Allocate memory for the thread structure.
- * Some functions use malloc, so don't put it
- * in a critical region.
- */
- if ((new_thread = _thr_alloc(curthread)) == NULL) {
- /* Insufficient memory to create a thread: */
- ret = EAGAIN;
- } else {
- /* Check if default thread attributes are required: */
- if (attr == NULL || *attr == NULL)
- /* Use the default thread attributes: */
- new_thread->attr = _pthread_attr_default;
- else {
- new_thread->attr = *(*attr);
- if ((*attr)->sched_inherit == PTHREAD_INHERIT_SCHED) {
- /* inherit scheduling contention scop */
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- new_thread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
- else
- new_thread->attr.flags &= ~PTHREAD_SCOPE_SYSTEM;
- /*
- * scheduling policy and scheduling parameters will be
- * inherited in following code.
- */
- }
- }
- if (_thread_scope_system > 0)
- new_thread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
- else if ((_thread_scope_system < 0)
- && (thread != &_thr_sig_daemon))
- new_thread->attr.flags &= ~PTHREAD_SCOPE_SYSTEM;
- if (create_stack(&new_thread->attr) != 0) {
- /* Insufficient memory to create a stack: */
- ret = EAGAIN;
- _thr_free(curthread, new_thread);
- }
- else if (((new_thread->attr.flags & PTHREAD_SCOPE_SYSTEM) != 0) &&
- (((kse = _kse_alloc(curthread, 1)) == NULL)
- || ((kseg = _kseg_alloc(curthread)) == NULL))) {
- /* Insufficient memory to create a new KSE/KSEG: */
- ret = EAGAIN;
- if (kse != NULL) {
- kse->k_kcb->kcb_kmbx.km_flags |= KMF_DONE;
- _kse_free(curthread, kse);
- }
- free_stack(&new_thread->attr);
- _thr_free(curthread, new_thread);
- }
- else {
- if (kseg != NULL) {
- /* Add the KSE to the KSEG's list of KSEs. */
- TAILQ_INSERT_HEAD(&kseg->kg_kseq, kse, k_kgqe);
- kseg->kg_ksecount = 1;
- kse->k_kseg = kseg;
- kse->k_schedq = &kseg->kg_schedq;
- }
- /*
- * Write a magic value to the thread structure
- * to help identify valid ones:
- */
- new_thread->magic = THR_MAGIC;
-
- new_thread->slice_usec = -1;
- new_thread->start_routine = start_routine;
- new_thread->arg = arg;
- new_thread->cancelflags = PTHREAD_CANCEL_ENABLE |
- PTHREAD_CANCEL_DEFERRED;
-
- /* No thread is wanting to join to this one: */
- new_thread->joiner = NULL;
-
- /*
- * Initialize the machine context.
- * Enter a critical region to get consistent context.
- */
- crit = _kse_critical_enter();
- THR_GETCONTEXT(&new_thread->tcb->tcb_tmbx.tm_context);
- /* Initialize the thread for signals: */
- new_thread->sigmask = curthread->sigmask;
- _kse_critical_leave(crit);
-
- new_thread->tcb->tcb_tmbx.tm_udata = new_thread;
- new_thread->tcb->tcb_tmbx.tm_context.uc_sigmask =
- new_thread->sigmask;
- new_thread->tcb->tcb_tmbx.tm_context.uc_stack.ss_size =
- new_thread->attr.stacksize_attr;
- new_thread->tcb->tcb_tmbx.tm_context.uc_stack.ss_sp =
- new_thread->attr.stackaddr_attr;
- makecontext(&new_thread->tcb->tcb_tmbx.tm_context,
- (void (*)(void))thread_start, 3, new_thread,
- start_routine, arg);
- /*
- * Check if this thread is to inherit the scheduling
- * attributes from its parent:
- */
- if (new_thread->attr.sched_inherit == PTHREAD_INHERIT_SCHED) {
- /*
- * Copy the scheduling attributes.
- * Lock the scheduling lock to get consistent
- * scheduling parameters.
- */
- THR_SCHED_LOCK(curthread, curthread);
- new_thread->base_priority =
- curthread->base_priority &
- ~THR_SIGNAL_PRIORITY;
- new_thread->attr.prio =
- curthread->base_priority &
- ~THR_SIGNAL_PRIORITY;
- new_thread->attr.sched_policy =
- curthread->attr.sched_policy;
- THR_SCHED_UNLOCK(curthread, curthread);
- } else {
- /*
- * Use just the thread priority, leaving the
- * other scheduling attributes as their
- * default values:
- */
- new_thread->base_priority =
- new_thread->attr.prio;
- }
- new_thread->active_priority = new_thread->base_priority;
- new_thread->inherited_priority = 0;
-
- /* Initialize the mutex queue: */
- TAILQ_INIT(&new_thread->mutexq);
-
- /* Initialise hooks in the thread structure: */
- new_thread->specific = NULL;
- new_thread->specific_data_count = 0;
- new_thread->cleanup = NULL;
- new_thread->flags = 0;
- new_thread->tlflags = 0;
- new_thread->sigbackout = NULL;
- new_thread->continuation = NULL;
- new_thread->wakeup_time.tv_sec = -1;
- new_thread->lock_switch = 0;
- sigemptyset(&new_thread->sigpend);
- new_thread->check_pending = 0;
- new_thread->locklevel = 0;
- new_thread->rdlock_count = 0;
- new_thread->sigstk.ss_sp = 0;
- new_thread->sigstk.ss_size = 0;
- new_thread->sigstk.ss_flags = SS_DISABLE;
- new_thread->oldsigmask = NULL;
-
- if (new_thread->attr.suspend == THR_CREATE_SUSPENDED) {
- new_thread->state = PS_SUSPENDED;
- new_thread->flags = THR_FLAGS_SUSPENDED;
- }
- else
- new_thread->state = PS_RUNNING;
-
- /*
- * System scope threads have their own kse and
- * kseg. Process scope threads are all hung
- * off the main process kseg.
- */
- if ((new_thread->attr.flags & PTHREAD_SCOPE_SYSTEM) == 0) {
- new_thread->kseg = _kse_initial->k_kseg;
- new_thread->kse = _kse_initial;
- }
- else {
- kse->k_curthread = NULL;
- kse->k_kseg->kg_flags |= KGF_SINGLE_THREAD;
- new_thread->kse = kse;
- new_thread->kseg = kse->k_kseg;
- kse->k_kcb->kcb_kmbx.km_udata = kse;
- kse->k_kcb->kcb_kmbx.km_curthread = NULL;
- }
-
- /*
- * Schedule the new thread starting a new KSEG/KSE
- * pair if necessary.
- */
- ret = _thr_schedule_add(curthread, new_thread);
- if (ret != 0)
- free_thread(curthread, new_thread);
- else {
- /* Return a pointer to the thread structure: */
- (*thread) = new_thread;
- }
- }
- }
-
- /* Return the status: */
- return (ret);
-}
-
-static void
-free_thread(struct pthread *curthread, struct pthread *thread)
-{
- free_stack(&thread->attr);
- if ((thread->attr.flags & PTHREAD_SCOPE_SYSTEM) != 0) {
- /* Free the KSE and KSEG. */
- _kseg_free(thread->kseg);
- _kse_free(curthread, thread->kse);
- }
- _thr_free(curthread, thread);
-}
-
-static int
-create_stack(struct pthread_attr *pattr)
-{
- int ret;
-
- /* Check if a stack was specified in the thread attributes: */
- if ((pattr->stackaddr_attr) != NULL) {
- pattr->guardsize_attr = 0;
- pattr->flags |= THR_STACK_USER;
- ret = 0;
- }
- else
- ret = _thr_stack_alloc(pattr);
- return (ret);
-}
-
-static void
-free_stack(struct pthread_attr *pattr)
-{
- struct kse *curkse;
- kse_critical_t crit;
-
- if ((pattr->flags & THR_STACK_USER) == 0) {
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- /* Stack routines don't use malloc/free. */
- _thr_stack_free(pattr);
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- _kse_critical_leave(crit);
- }
-}
-
-static void
-thread_start(struct pthread *curthread, void *(*start_routine) (void *),
- void *arg)
-{
- /* Run the current thread's start routine with argument: */
- pthread_exit(start_routine(arg));
-
- /* This point should never be reached. */
- PANIC("Thread has resumed after exit");
-}
diff --git a/lib/libkse/thread/thr_detach.c b/lib/libkse/thread/thr_detach.c
deleted file mode 100644
index 0159e53..0000000
--- a/lib/libkse/thread/thr_detach.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <sys/types.h>
-#include <machine/atomic.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_detach, pthread_detach);
-
-int
-_pthread_detach(pthread_t pthread)
-{
- struct pthread *curthread = _get_curthread();
- struct kse_mailbox *kmbx = NULL;
- struct pthread *joiner;
- int rval = 0;
-
- /* Check for invalid calling parameters: */
- if (pthread == NULL || pthread->magic != THR_MAGIC)
- /* Return an invalid argument error: */
- rval = EINVAL;
-
- else if ((rval = _thr_ref_add(curthread, pthread,
- /*include dead*/1)) != 0) {
- /* Return an error: */
- }
-
- /* Check if the thread is already detached: */
- else if ((pthread->attr.flags & PTHREAD_DETACHED) != 0) {
- /* Return an error: */
- _thr_ref_delete(curthread, pthread);
- rval = EINVAL;
- } else {
- /* Lock the detached thread: */
- THR_SCHED_LOCK(curthread, pthread);
-
- /* Flag the thread as detached: */
- pthread->attr.flags |= PTHREAD_DETACHED;
-
- /* Retrieve any joining thread and remove it: */
- joiner = pthread->joiner;
- if ((joiner != NULL) && (joiner->kseg == pthread->kseg)) {
- /*
- * We already own the scheduler lock for the joiner.
- * Take advantage of that and make the joiner runnable.
- */
- if (joiner->join_status.thread == pthread) {
- /*
- * Set the return value for the woken thread:
- */
- joiner->join_status.error = ESRCH;
- joiner->join_status.ret = NULL;
- joiner->join_status.thread = NULL;
-
- kmbx = _thr_setrunnable_unlocked(joiner);
- }
- joiner = NULL;
- }
- THR_SCHED_UNLOCK(curthread, pthread);
- /* See if there is a thread waiting in pthread_join(): */
- if ((joiner != NULL) &&
- (_thr_ref_add(curthread, joiner, 0) == 0)) {
- /* Lock the joiner before fiddling with it. */
- THR_SCHED_LOCK(curthread, joiner);
- if (joiner->join_status.thread == pthread) {
- /*
- * Set the return value for the woken thread:
- */
- joiner->join_status.error = ESRCH;
- joiner->join_status.ret = NULL;
- joiner->join_status.thread = NULL;
-
- kmbx = _thr_setrunnable_unlocked(joiner);
- }
- THR_SCHED_UNLOCK(curthread, joiner);
- _thr_ref_delete(curthread, joiner);
- }
- _thr_ref_delete(curthread, pthread);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- }
-
- /* Return the completion status: */
- return (rval);
-}
diff --git a/lib/libkse/thread/thr_equal.c b/lib/libkse/thread/thr_equal.c
deleted file mode 100644
index f8882f5..0000000
--- a/lib/libkse/thread/thr_equal.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_equal, pthread_equal);
-
-int
-_pthread_equal(pthread_t t1, pthread_t t2)
-{
- /* Compare the two thread pointers: */
- return (t1 == t2);
-}
diff --git a/lib/libkse/thread/thr_execve.c b/lib/libkse/thread/thr_execve.c
deleted file mode 100644
index ab1a9e98..0000000
--- a/lib/libkse/thread/thr_execve.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2004 Daniel Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <errno.h>
-#include <pthread.h>
-#include <unistd.h>
-#include "thr_private.h"
-
-__weak_reference(_execve, execve);
-
-int
-_execve(const char *name, char *const *argv, char *const *envp)
-{
- struct kse_execve_args args;
- struct pthread *curthread = _get_curthread();
- int ret;
-
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- ret = __sys_execve(name, argv, envp);
- else {
- /*
- * When exec'ing, set the kernel signal mask to the thread's
- * signal mask to satisfy POSIX requirements.
- */
- args.sigmask = curthread->sigmask;
- args.sigpend = curthread->sigpend;
- args.path = (char *)name;
- args.argv = (char **)argv;
- args.envp = (char **)envp;
- args.reserved = NULL;
- ret = kse_thr_interrupt(NULL, KSE_INTR_EXECVE, (long)&args);
- }
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_exit.c b/lib/libkse/thread/thr_exit.c
deleted file mode 100644
index 456b81d..0000000
--- a/lib/libkse/thread/thr_exit.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-void _pthread_exit(void *status);
-
-__weak_reference(_pthread_exit, pthread_exit);
-
-void
-_thr_exit(char *fname, int lineno, char *msg)
-{
-
- /* Write an error message to the standard error file descriptor: */
- _thread_printf(2,
- "Fatal error '%s' at line %d in file %s (errno = %d)\n",
- msg, lineno, fname, errno);
-
- abort();
-}
-
-/*
- * Only called when a thread is cancelled. It may be more useful
- * to call it from pthread_exit() if other ways of asynchronous or
- * abnormal thread termination can be found.
- */
-void
-_thr_exit_cleanup(void)
-{
- struct pthread *curthread = _get_curthread();
-
- /*
- * POSIX states that cancellation/termination of a thread should
- * not release any visible resources (such as mutexes) and that
- * it is the applications responsibility. Resources that are
- * internal to the threads library, including file and fd locks,
- * are not visible to the application and need to be released.
- */
- /* Unlock all private mutexes: */
- _mutex_unlock_private(curthread);
-
- /*
- * This still isn't quite correct because we don't account
- * for held spinlocks (see libc/stdlib/malloc.c).
- */
-}
-
-void
-_pthread_exit(void *status)
-{
- struct pthread *curthread = _get_curthread();
- kse_critical_t crit;
- struct kse *curkse;
-
- /* Check if this thread is already in the process of exiting: */
- if ((curthread->flags & THR_FLAGS_EXITING) != 0) {
- char msg[128];
- snprintf(msg, sizeof(msg), "Thread %p has called "
- "pthread_exit() from a destructor. POSIX 1003.1 "
- "1996 s16.2.5.2 does not allow this!", curthread);
- PANIC(msg);
- }
-
- /*
- * Flag this thread as exiting. Threads should now be prevented
- * from joining to this thread.
- */
- THR_SCHED_LOCK(curthread, curthread);
- curthread->flags |= THR_FLAGS_EXITING;
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /*
- * To avoid signal-lost problem, if signals had already been
- * delivered to us, handle it. we have already set EXITING flag
- * so no new signals should be delivered to us.
- * XXX this is not enough if signal was delivered just before
- * thread called sigprocmask and masked it! in this case, we
- * might have to re-post the signal by kill() if the signal
- * is targeting process (not for a specified thread).
- * Kernel has same signal-lost problem, a signal may be delivered
- * to a thread which is on the way to call sigprocmask or thr_exit()!
- */
- if (curthread->check_pending)
- _thr_sig_check_pending(curthread);
- /* Save the return value: */
- curthread->ret = status;
- while (curthread->cleanup != NULL) {
- pthread_cleanup_pop(1);
- }
- if (curthread->attr.cleanup_attr != NULL) {
- curthread->attr.cleanup_attr(curthread->attr.arg_attr);
- }
- /* Check if there is thread specific data: */
- if (curthread->specific != NULL) {
- /* Run the thread-specific data destructors: */
- _thread_cleanupspecific();
- }
- if (!_kse_isthreaded())
- exit(0);
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- /* Use thread_list_lock */
- _thread_active_threads--;
- if ((_thread_scope_system <= 0 && _thread_active_threads == 1) ||
- (_thread_scope_system > 0 && _thread_active_threads == 0)) {
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- _kse_critical_leave(crit);
- exit(0);
- /* Never reach! */
- }
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
-
- /* This thread will never be re-scheduled. */
- KSE_LOCK(curkse);
- THR_SET_STATE(curthread, PS_DEAD);
- _thr_sched_switch_unlocked(curthread);
- /* Never reach! */
-
- /* This point should not be reached. */
- PANIC("Dead thread has resumed");
-}
diff --git a/lib/libkse/thread/thr_fcntl.c b/lib/libkse/thread/thr_fcntl.c
deleted file mode 100644
index 947bc11..0000000
--- a/lib/libkse/thread/thr_fcntl.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdarg.h>
-#include "namespace.h"
-#include <fcntl.h>
-#include "un-namespace.h"
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__fcntl, fcntl);
-
-int
-__fcntl(int fd, int cmd,...)
-{
- struct pthread *curthread = _get_curthread();
- int ret, check = 1;
- va_list ap;
-
- _thr_cancel_enter(curthread);
-
- va_start(ap, cmd);
- switch (cmd) {
- case F_DUPFD:
- ret = __sys_fcntl(fd, cmd, va_arg(ap, int));
- /*
- * To avoid possible file handle leak,
- * only check cancellation point if it is failure
- */
- check = (ret == -1);
- break;
- case F_SETFD:
- case F_SETFL:
- ret = __sys_fcntl(fd, cmd, va_arg(ap, int));
- break;
- case F_GETFD:
- case F_GETFL:
- ret = __sys_fcntl(fd, cmd);
- break;
- default:
- ret = __sys_fcntl(fd, cmd, va_arg(ap, void *));
- }
- va_end(ap);
-
- _thr_cancel_leave(curthread, check);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_find_thread.c b/lib/libkse/thread/thr_find_thread.c
deleted file mode 100644
index 5a64640..0000000
--- a/lib/libkse/thread/thr_find_thread.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>
- * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-/*
- * Find a thread in the linked list of active threads and add a reference
- * to it. Threads with positive reference counts will not be deallocated
- * until all references are released.
- */
-int
-_thr_ref_add(struct pthread *curthread, struct pthread *thread,
- int include_dead)
-{
- kse_critical_t crit;
- struct pthread *pthread;
- struct kse *curkse;
-
- if (thread == NULL)
- /* Invalid thread: */
- return (EINVAL);
-
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- pthread = _thr_hash_find(thread);
- if (pthread) {
- if ((include_dead == 0) &&
- ((pthread->state == PS_DEAD) ||
- ((pthread->state == PS_DEADLOCK) ||
- ((pthread->flags & THR_FLAGS_EXITING) != 0))))
- pthread = NULL;
- else {
- pthread->refcount++;
- if (curthread != NULL)
- curthread->critical_count++;
- }
- }
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- _kse_critical_leave(crit);
-
- /* Return zero if the thread exists: */
- return ((pthread != NULL) ? 0 : ESRCH);
-}
-
-void
-_thr_ref_delete(struct pthread *curthread, struct pthread *thread)
-{
- kse_critical_t crit;
- struct kse *curkse;
-
- if (thread != NULL) {
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- thread->refcount--;
- if (curthread != NULL)
- curthread->critical_count--;
- if ((thread->refcount == 0) &&
- (thread->tlflags & TLFLAGS_GC_SAFE) != 0)
- THR_GCLIST_ADD(thread);
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- _kse_critical_leave(crit);
- }
-}
diff --git a/lib/libkse/thread/thr_fork.c b/lib/libkse/thread/thr_fork.c
deleted file mode 100644
index fdbfd86..0000000
--- a/lib/libkse/thread/thr_fork.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <spinlock.h>
-#include <sys/signalvar.h>
-
-#include "libc_private.h"
-#include "thr_private.h"
-
-__weak_reference(_fork, fork);
-
-pid_t
-_fork(void)
-{
- sigset_t sigset, oldset;
- struct pthread *curthread;
- struct pthread_atfork *af;
- pid_t ret;
- int errsave;
-
- curthread = _get_curthread();
-
- if (!_kse_isthreaded()) {
- SIGFILLSET(sigset);
- __sys_sigprocmask(SIG_SETMASK, &sigset, &oldset);
- ret = __sys_fork();
- if (ret == 0)
- /* Child */
- __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask,
- NULL);
- else
- __sys_sigprocmask(SIG_SETMASK, &oldset, NULL);
- return (ret);
- }
-
- /*
- * Masks all signals until we reach a safe point in
- * _kse_single_thread, and the signal masks will be
- * restored in that function, for M:N thread, all
- * signals were already masked in kernel atomically,
- * we only need to do this for bound thread.
- */
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) {
- SIGFILLSET(sigset);
- __sys_sigprocmask(SIG_SETMASK, &sigset, &oldset);
- }
-
- _pthread_mutex_lock(&_thr_atfork_mutex);
-
- /* Run down atfork prepare handlers. */
- TAILQ_FOREACH_REVERSE(af, &_thr_atfork_list, atfork_head, qe) {
- if (af->prepare != NULL)
- af->prepare();
- }
-
- /* Fork a new process: */
- if (_kse_isthreaded() != 0) {
- _spinlock(__malloc_lock);
- }
- if ((ret = __sys_fork()) == 0) {
- /* Child process */
- errsave = errno;
-
- /* Kernel signal mask is restored in _kse_single_thread */
- _kse_single_thread(curthread);
-
- /* Run down atfork child handlers. */
- TAILQ_FOREACH(af, &_thr_atfork_list, qe) {
- if (af->child != NULL)
- af->child();
- }
- _thr_mutex_reinit(&_thr_atfork_mutex);
- } else {
- if ((_kse_isthreaded() != 0) && (__malloc_lock != NULL)) {
- _spinunlock(__malloc_lock);
- }
- errsave = errno;
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) {
- __sys_sigprocmask(SIG_SETMASK, &oldset, NULL);
- }
- /* Run down atfork parent handlers. */
- TAILQ_FOREACH(af, &_thr_atfork_list, qe) {
- if (af->parent != NULL)
- af->parent();
- }
- _pthread_mutex_unlock(&_thr_atfork_mutex);
- }
- errno = errsave;
-
- /* Return the process ID: */
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_fsync.c b/lib/libkse/thread/thr_fsync.c
deleted file mode 100644
index 15fe31a..0000000
--- a/lib/libkse/thread/thr_fsync.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <unistd.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__fsync, fsync);
-
-int
-__fsync(int fd)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = __sys_fsync(fd);
- _thr_cancel_leave(curthread, 1);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_getprio.c b/lib/libkse/thread/thr_getprio.c
deleted file mode 100644
index fa95ef9..0000000
--- a/lib/libkse/thread/thr_getprio.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_getprio, pthread_getprio);
-
-int
-_pthread_getprio(pthread_t pthread)
-{
- int policy, ret;
- struct sched_param param;
-
- if ((ret = pthread_getschedparam(pthread, &policy, &param)) == 0)
- ret = param.sched_priority;
- else {
- /* Invalid thread: */
- errno = ret;
- ret = -1;
- }
-
- /* Return the thread priority or an error status: */
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_getschedparam.c b/lib/libkse/thread/thr_getschedparam.c
deleted file mode 100644
index ad8486c..0000000
--- a/lib/libkse/thread/thr_getschedparam.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_getschedparam, pthread_getschedparam);
-
-int
-_pthread_getschedparam(pthread_t pthread, int *policy,
- struct sched_param *param)
-{
- struct pthread *curthread = _get_curthread();
- int ret, tmp;
-
- if ((param == NULL) || (policy == NULL))
- /* Return an invalid argument error: */
- ret = EINVAL;
- else if (pthread == curthread) {
- /*
- * Avoid searching the thread list when it is the current
- * thread.
- */
- THR_SCHED_LOCK(curthread, curthread);
- param->sched_priority =
- THR_BASE_PRIORITY(pthread->base_priority);
- tmp = pthread->attr.sched_policy;
- THR_SCHED_UNLOCK(curthread, curthread);
- *policy = tmp;
- ret = 0;
- }
- /* Find the thread in the list of active threads. */
- else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0))
- == 0) {
- THR_SCHED_LOCK(curthread, pthread);
- param->sched_priority =
- THR_BASE_PRIORITY(pthread->base_priority);
- tmp = pthread->attr.sched_policy;
- THR_SCHED_UNLOCK(curthread, pthread);
- _thr_ref_delete(curthread, pthread);
- *policy = tmp;
- }
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_info.c b/lib/libkse/thread/thr_info.c
deleted file mode 100644
index 6081381..0000000
--- a/lib/libkse/thread/thr_info.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <errno.h>
-#include "thr_private.h"
-
-#ifndef NELEMENTS
-#define NELEMENTS(arr) (sizeof(arr) / sizeof(arr[0]))
-#endif
-
-static void dump_thread(int fd, pthread_t pthread, int long_version);
-
-__weak_reference(_pthread_set_name_np, pthread_set_name_np);
-
-struct s_thread_info {
- enum pthread_state state;
- char *name;
-};
-
-/* Static variables: */
-static const struct s_thread_info thread_info[] = {
- {PS_RUNNING , "Running"},
- {PS_LOCKWAIT , "Waiting on an internal lock"},
- {PS_MUTEX_WAIT , "Waiting on a mutex"},
- {PS_COND_WAIT , "Waiting on a condition variable"},
- {PS_SLEEP_WAIT , "Sleeping"},
- {PS_SIGSUSPEND , "Suspended, waiting for a signal"},
- {PS_SIGWAIT , "Waiting for a signal"},
- {PS_JOIN , "Waiting to join"},
- {PS_SUSPENDED , "Suspended"},
- {PS_DEAD , "Dead"},
- {PS_DEADLOCK , "Deadlocked"},
- {PS_STATE_MAX , "Not a real state!"}
-};
-
-void
-_thread_dump_info(void)
-{
- char s[512], tmpfile[128];
- pthread_t pthread;
- int fd, i;
-
- for (i = 0; i < 100000; i++) {
- snprintf(tmpfile, sizeof(tmpfile), "/tmp/pthread.dump.%u.%i",
- getpid(), i);
- /* Open the dump file for append and create it if necessary: */
- if ((fd = __sys_open(tmpfile, O_RDWR | O_CREAT | O_EXCL,
- 0666)) < 0) {
- /* Can't open the dump file. */
- if (errno == EEXIST)
- continue;
- /*
- * We only need to continue in case of
- * EEXIT error. Most other error
- * codes means that we will fail all
- * the times.
- */
- return;
- } else {
- break;
- }
- }
- if (i==100000) {
- /* all 100000 possibilities are in use :( */
- return;
- } else {
- /* Dump the active threads. */
- strcpy(s, "\n\n========\nACTIVE THREADS\n\n");
- __sys_write(fd, s, strlen(s));
-
- /* Enter a loop to report each thread in the global list: */
- TAILQ_FOREACH(pthread, &_thread_list, tle) {
- if (pthread->state != PS_DEAD)
- dump_thread(fd, pthread, /*long_verson*/ 1);
- }
-
- /*
- * Dump the ready threads.
- * XXX - We can't easily do this because the run queues
- * are per-KSEG.
- */
- strcpy(s, "\n\n========\nREADY THREADS - unimplemented\n\n");
- __sys_write(fd, s, strlen(s));
-
-
- /*
- * Dump the waiting threads.
- * XXX - We can't easily do this because the wait queues
- * are per-KSEG.
- */
- strcpy(s, "\n\n========\nWAITING THREADS - unimplemented\n\n");
- __sys_write(fd, s, strlen(s));
-
- /* Close the dump file. */
- __sys_close(fd);
- }
-}
-
-static void
-dump_thread(int fd, pthread_t pthread, int long_version)
-{
- struct pthread *curthread = _get_curthread();
- char s[512];
- int i;
-
- /* Find the state: */
- for (i = 0; i < NELEMENTS(thread_info) - 1; i++)
- if (thread_info[i].state == pthread->state)
- break;
-
- /* Output a record for the thread: */
- snprintf(s, sizeof(s),
- "--------------------\n"
- "Thread %p (%s), scope %s, prio %3d, blocked %s, state %s [%s:%d]\n",
- pthread, (pthread->name == NULL) ? "" : pthread->name,
- pthread->attr.flags & PTHREAD_SCOPE_SYSTEM ? "system" : "process",
- pthread->active_priority, (pthread->blocked != 0) ? "yes" : "no",
- thread_info[i].name, pthread->fname, pthread->lineno);
- __sys_write(fd, s, strlen(s));
-
- if (long_version != 0) {
- /* Check if this is the running thread: */
- if (pthread == curthread) {
- /* Output a record for the running thread: */
- strcpy(s, "This is the running thread\n");
- __sys_write(fd, s, strlen(s));
- }
- /* Check if this is the initial thread: */
- if (pthread == _thr_initial) {
- /* Output a record for the initial thread: */
- strcpy(s, "This is the initial thread\n");
- __sys_write(fd, s, strlen(s));
- }
-
- /* Process according to thread state: */
- switch (pthread->state) {
- case PS_SIGWAIT:
- snprintf(s, sizeof(s), "sigmask (hi) ");
- __sys_write(fd, s, strlen(s));
- for (i = _SIG_WORDS - 1; i >= 0; i--) {
- snprintf(s, sizeof(s), "%08x ",
- pthread->sigmask.__bits[i]);
- __sys_write(fd, s, strlen(s));
- }
- snprintf(s, sizeof(s), "(lo)\n");
- __sys_write(fd, s, strlen(s));
-
- snprintf(s, sizeof(s), "waitset (hi) ");
- __sys_write(fd, s, strlen(s));
- for (i = _SIG_WORDS - 1; i >= 0; i--) {
- snprintf(s, sizeof(s), "%08x ",
- pthread->data.sigwait->waitset->__bits[i]);
- __sys_write(fd, s, strlen(s));
- }
- snprintf(s, sizeof(s), "(lo)\n");
- __sys_write(fd, s, strlen(s));
- break;
- /*
- * Trap other states that are not explicitly
- * coded to dump information:
- */
- default:
- snprintf(s, sizeof(s), "sigmask (hi) ");
- __sys_write(fd, s, strlen(s));
- for (i = _SIG_WORDS - 1; i >= 0; i--) {
- snprintf(s, sizeof(s), "%08x ",
- pthread->sigmask.__bits[i]);
- __sys_write(fd, s, strlen(s));
- }
- snprintf(s, sizeof(s), "(lo)\n");
- __sys_write(fd, s, strlen(s));
- break;
- }
- }
-}
-
-/* Set the thread name for debug: */
-void
-_pthread_set_name_np(pthread_t thread, char *name)
-{
- /* Check if the caller has specified a valid thread: */
- if (thread != NULL && thread->magic == THR_MAGIC) {
- if (thread->name != NULL) {
- /* Free space for previous name. */
- free(thread->name);
- }
- thread->name = strdup(name);
- }
-}
diff --git a/lib/libkse/thread/thr_init.c b/lib/libkse/thread/thr_init.c
deleted file mode 100644
index c143627..0000000
--- a/lib/libkse/thread/thr_init.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/*
- * Copyright (c) 2003 Daniel M. Eischen <deischen@freebsd.org>
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-/* Allocate space for global thread variables here: */
-#define GLOBAL_PTHREAD_PRIVATE
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/signalvar.h>
-#include <machine/reg.h>
-
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/uio.h>
-#include <sys/socket.h>
-#include <sys/event.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <sys/time.h>
-#include <sys/ttycom.h>
-#include <sys/wait.h>
-#include <sys/mman.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <paths.h>
-#include <pthread.h>
-#include <pthread_np.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-#include "libc_private.h"
-#include "thr_private.h"
-
-int __pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
-int __pthread_mutex_lock(pthread_mutex_t *);
-int __pthread_mutex_trylock(pthread_mutex_t *);
-void _thread_init_hack(void);
-extern int _thread_state_running;
-
-static void init_private(void);
-static void init_main_thread(struct pthread *thread);
-
-/*
- * All weak references used within libc should be in this table.
- * This is so that static libraries will work.
- */
-static void *references[] = {
- &_accept,
- &_bind,
- &_close,
- &_connect,
- &_dup,
- &_dup2,
- &_execve,
- &_fcntl,
- &_flock,
- &_flockfile,
- &_fstat,
- &_fstatfs,
- &_fsync,
- &_funlockfile,
- &_getdirentries,
- &_getlogin,
- &_getpeername,
- &_getsockname,
- &_getsockopt,
- &_ioctl,
- &_kevent,
- &_listen,
- &_nanosleep,
- &_open,
- &_pthread_getspecific,
- &_pthread_key_create,
- &_pthread_key_delete,
- &_pthread_mutex_destroy,
- &_pthread_mutex_init,
- &_pthread_mutex_lock,
- &_pthread_mutex_trylock,
- &_pthread_mutex_unlock,
- &_pthread_mutexattr_init,
- &_pthread_mutexattr_destroy,
- &_pthread_mutexattr_settype,
- &_pthread_once,
- &_pthread_setspecific,
- &_read,
- &_readv,
- &_recvfrom,
- &_recvmsg,
- &_select,
- &_sendmsg,
- &_sendto,
- &_setsockopt,
- &_sigaction,
- &_sigprocmask,
- &_sigsuspend,
- &_socket,
- &_socketpair,
- &_thread_init_hack,
- &_wait4,
- &_write,
- &_writev
-};
-
-/*
- * These are needed when linking statically. All references within
- * libgcc (and in the future libc) to these routines are weak, but
- * if they are not (strongly) referenced by the application or other
- * libraries, then the actual functions will not be loaded.
- */
-static void *libgcc_references[] = {
- &_pthread_once,
- &_pthread_key_create,
- &_pthread_key_delete,
- &_pthread_getspecific,
- &_pthread_setspecific,
- &_pthread_mutex_init,
- &_pthread_mutex_destroy,
- &_pthread_mutex_lock,
- &_pthread_mutex_trylock,
- &_pthread_mutex_unlock
-};
-
-#define DUAL_ENTRY(entry) \
- (pthread_func_t)entry, (pthread_func_t)entry
-
-static pthread_func_t jmp_table[][2] = {
- {DUAL_ENTRY(_pthread_cond_broadcast)}, /* PJT_COND_BROADCAST */
- {DUAL_ENTRY(_pthread_cond_destroy)}, /* PJT_COND_DESTROY */
- {DUAL_ENTRY(_pthread_cond_init)}, /* PJT_COND_INIT */
- {DUAL_ENTRY(_pthread_cond_signal)}, /* PJT_COND_SIGNAL */
- {(pthread_func_t)__pthread_cond_wait,
- (pthread_func_t)_pthread_cond_wait}, /* PJT_COND_WAIT */
- {DUAL_ENTRY(_pthread_getspecific)}, /* PJT_GETSPECIFIC */
- {DUAL_ENTRY(_pthread_key_create)}, /* PJT_KEY_CREATE */
- {DUAL_ENTRY(_pthread_key_delete)}, /* PJT_KEY_DELETE*/
- {DUAL_ENTRY(_pthread_main_np)}, /* PJT_MAIN_NP */
- {DUAL_ENTRY(_pthread_mutex_destroy)}, /* PJT_MUTEX_DESTROY */
- {DUAL_ENTRY(_pthread_mutex_init)}, /* PJT_MUTEX_INIT */
- {(pthread_func_t)__pthread_mutex_lock,
- (pthread_func_t)_pthread_mutex_lock}, /* PJT_MUTEX_LOCK */
- {(pthread_func_t)__pthread_mutex_trylock,
- (pthread_func_t)_pthread_mutex_trylock},/* PJT_MUTEX_TRYLOCK */
- {DUAL_ENTRY(_pthread_mutex_unlock)}, /* PJT_MUTEX_UNLOCK */
- {DUAL_ENTRY(_pthread_mutexattr_destroy)}, /* PJT_MUTEXATTR_DESTROY */
- {DUAL_ENTRY(_pthread_mutexattr_init)}, /* PJT_MUTEXATTR_INIT */
- {DUAL_ENTRY(_pthread_mutexattr_settype)}, /* PJT_MUTEXATTR_SETTYPE */
- {DUAL_ENTRY(_pthread_once)}, /* PJT_ONCE */
- {DUAL_ENTRY(_pthread_rwlock_destroy)}, /* PJT_RWLOCK_DESTROY */
- {DUAL_ENTRY(_pthread_rwlock_init)}, /* PJT_RWLOCK_INIT */
- {DUAL_ENTRY(_pthread_rwlock_rdlock)}, /* PJT_RWLOCK_RDLOCK */
- {DUAL_ENTRY(_pthread_rwlock_tryrdlock)},/* PJT_RWLOCK_TRYRDLOCK */
- {DUAL_ENTRY(_pthread_rwlock_trywrlock)},/* PJT_RWLOCK_TRYWRLOCK */
- {DUAL_ENTRY(_pthread_rwlock_unlock)}, /* PJT_RWLOCK_UNLOCK */
- {DUAL_ENTRY(_pthread_rwlock_wrlock)}, /* PJT_RWLOCK_WRLOCK */
- {DUAL_ENTRY(_pthread_self)}, /* PJT_SELF */
- {DUAL_ENTRY(_pthread_setspecific)}, /* PJT_SETSPECIFIC */
- {DUAL_ENTRY(_pthread_sigmask)} /* PJT_SIGMASK */
-};
-
-static int init_once = 0;
-
-/*
- * Threaded process initialization.
- *
- * This is only called under two conditions:
- *
- * 1) Some thread routines have detected that the library hasn't yet
- * been initialized (_thr_initial == NULL && curthread == NULL), or
- *
- * 2) An explicit call to reinitialize after a fork (indicated
- * by curthread != NULL)
- */
-void
-_libpthread_init(struct pthread *curthread)
-{
- int fd;
-
- /* Check if this function has already been called: */
- if ((_thr_initial != NULL) && (curthread == NULL))
- /* Only initialize the threaded application once. */
- return;
-
- /*
- * Make gcc quiescent about {,libgcc_}references not being
- * referenced:
- */
- if ((references[0] == NULL) || (libgcc_references[0] == NULL))
- PANIC("Failed loading mandatory references in _thread_init");
-
- /* Pull debug symbols in for static binary */
- _thread_state_running = PS_RUNNING;
-
- /*
- * Check the size of the jump table to make sure it is preset
- * with the correct number of entries.
- */
- if (sizeof(jmp_table) != (sizeof(pthread_func_t) * PJT_MAX * 2))
- PANIC("Thread jump table not properly initialized");
- memcpy(__thr_jtable, jmp_table, sizeof(jmp_table));
-
- /*
- * Check for the special case of this process running as
- * or in place of init as pid = 1:
- */
- if ((_thr_pid = getpid()) == 1) {
- /*
- * Setup a new session for this process which is
- * assumed to be running as root.
- */
- if (setsid() == -1)
- PANIC("Can't set session ID");
- if (revoke(_PATH_CONSOLE) != 0)
- PANIC("Can't revoke console");
- if ((fd = __sys_open(_PATH_CONSOLE, O_RDWR)) < 0)
- PANIC("Can't open console");
- if (setlogin("root") == -1)
- PANIC("Can't set login to root");
- if (__sys_ioctl(fd, TIOCSCTTY, (char *) NULL) == -1)
- PANIC("Can't set controlling terminal");
- }
-
- /* Initialize pthread private data. */
- init_private();
- _kse_init();
-
- /* Initialize the initial kse and kseg. */
- _kse_initial = _kse_alloc(NULL, _thread_scope_system > 0);
- if (_kse_initial == NULL)
- PANIC("Can't allocate initial kse.");
- _kse_initial->k_kseg = _kseg_alloc(NULL);
- if (_kse_initial->k_kseg == NULL)
- PANIC("Can't allocate initial kseg.");
- _kse_initial->k_kseg->kg_flags |= KGF_SINGLE_THREAD;
- _kse_initial->k_schedq = &_kse_initial->k_kseg->kg_schedq;
-
- TAILQ_INSERT_TAIL(&_kse_initial->k_kseg->kg_kseq, _kse_initial, k_kgqe);
- _kse_initial->k_kseg->kg_ksecount = 1;
-
- /* Set the initial thread. */
- if (curthread == NULL) {
- /* Create and initialize the initial thread. */
- curthread = _thr_alloc(NULL);
- if (curthread == NULL)
- PANIC("Can't allocate initial thread");
- _thr_initial = curthread;
- init_main_thread(curthread);
- } else {
- /*
- * The initial thread is the current thread. It is
- * assumed that the current thread is already initialized
- * because it is left over from a fork().
- */
- _thr_initial = curthread;
- }
- _kse_initial->k_kseg->kg_threadcount = 0;
- _thr_initial->kse = _kse_initial;
- _thr_initial->kseg = _kse_initial->k_kseg;
- _thr_initial->active = 1;
-
- /*
- * Add the thread to the thread list and to the KSEG's thread
- * queue.
- */
- THR_LIST_ADD(_thr_initial);
- KSEG_THRQ_ADD(_kse_initial->k_kseg, _thr_initial);
-
- /* Setup the KSE/thread specific data for the current KSE/thread. */
- _thr_initial->kse->k_curthread = _thr_initial;
- _kcb_set(_thr_initial->kse->k_kcb);
- _tcb_set(_thr_initial->kse->k_kcb, _thr_initial->tcb);
- _thr_initial->kse->k_flags |= KF_INITIALIZED;
-
- _thr_signal_init();
- _kse_critical_leave(&_thr_initial->tcb->tcb_tmbx);
- /*
- * activate threaded mode as soon as possible if we are
- * being debugged
- */
- if (_libkse_debug)
- _kse_setthreaded(1);
-}
-
-/*
- * This function and pthread_create() do a lot of the same things.
- * It'd be nice to consolidate the common stuff in one place.
- */
-static void
-init_main_thread(struct pthread *thread)
-{
- /* Setup the thread attributes. */
- thread->attr = _pthread_attr_default;
- thread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
- /*
- * Set up the thread stack.
- *
- * Create a red zone below the main stack. All other stacks
- * are constrained to a maximum size by the parameters
- * passed to mmap(), but this stack is only limited by
- * resource limits, so this stack needs an explicitly mapped
- * red zone to protect the thread stack that is just beyond.
- */
- if (mmap((void *)_usrstack - _thr_stack_initial -
- _thr_guard_default, _thr_guard_default, 0, MAP_ANON,
- -1, 0) == MAP_FAILED)
- PANIC("Cannot allocate red zone for initial thread");
-
- /*
- * Mark the stack as an application supplied stack so that it
- * isn't deallocated.
- *
- * XXX - I'm not sure it would hurt anything to deallocate
- * the main thread stack because deallocation doesn't
- * actually free() it; it just puts it in the free
- * stack queue for later reuse.
- */
- thread->attr.stackaddr_attr = (void *)_usrstack - _thr_stack_initial;
- thread->attr.stacksize_attr = _thr_stack_initial;
- thread->attr.guardsize_attr = _thr_guard_default;
- thread->attr.flags |= THR_STACK_USER;
-
- /*
- * Write a magic value to the thread structure
- * to help identify valid ones:
- */
- thread->magic = THR_MAGIC;
-
- thread->slice_usec = -1;
- thread->cancelflags = PTHREAD_CANCEL_ENABLE | PTHREAD_CANCEL_DEFERRED;
- thread->name = strdup("initial thread");
-
- /* Initialize the thread for signals: */
- SIGEMPTYSET(thread->sigmask);
-
- /*
- * Set up the thread mailbox. The threads saved context
- * is also in the mailbox.
- */
- thread->tcb->tcb_tmbx.tm_udata = thread;
- thread->tcb->tcb_tmbx.tm_context.uc_stack.ss_size =
- thread->attr.stacksize_attr;
- thread->tcb->tcb_tmbx.tm_context.uc_stack.ss_sp =
- thread->attr.stackaddr_attr;
-
- /* Default the priority of the initial thread: */
- thread->base_priority = THR_DEFAULT_PRIORITY;
- thread->active_priority = THR_DEFAULT_PRIORITY;
- thread->inherited_priority = 0;
-
- /* Initialize the mutex queue: */
- TAILQ_INIT(&thread->mutexq);
-
- /* Initialize hooks in the thread structure: */
- thread->specific = NULL;
- thread->cleanup = NULL;
- thread->flags = 0;
- thread->sigbackout = NULL;
- thread->continuation = NULL;
-
- thread->state = PS_RUNNING;
- thread->uniqueid = 0;
-}
-
-static void
-init_private(void)
-{
- struct clockinfo clockinfo;
- size_t len;
- int mib[2];
-
- /*
- * Avoid reinitializing some things if they don't need to be,
- * e.g. after a fork().
- */
- if (init_once == 0) {
- /* Find the stack top */
- mib[0] = CTL_KERN;
- mib[1] = KERN_USRSTACK;
- len = sizeof (_usrstack);
- if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1)
- PANIC("Cannot get kern.usrstack from sysctl");
- /* Get the kernel clockrate: */
- mib[0] = CTL_KERN;
- mib[1] = KERN_CLOCKRATE;
- len = sizeof (struct clockinfo);
- if (sysctl(mib, 2, &clockinfo, &len, NULL, 0) == 0)
- _clock_res_usec = 1000000 / clockinfo.stathz;
- else
- _clock_res_usec = CLOCK_RES_USEC;
-
- _thr_page_size = getpagesize();
- _thr_guard_default = _thr_page_size;
- if (sizeof(void *) == 8) {
- _thr_stack_default = THR_STACK64_DEFAULT;
- _thr_stack_initial = THR_STACK64_INITIAL;
- }
- else {
- _thr_stack_default = THR_STACK32_DEFAULT;
- _thr_stack_initial = THR_STACK32_INITIAL;
- }
- _pthread_attr_default.guardsize_attr = _thr_guard_default;
- _pthread_attr_default.stacksize_attr = _thr_stack_default;
- init_once = 1; /* Don't do this again. */
- } else {
- /*
- * Destroy the locks before creating them. We don't
- * know what state they are in so it is better to just
- * recreate them.
- */
- _lock_destroy(&_thread_signal_lock);
- _lock_destroy(&_mutex_static_lock);
- _lock_destroy(&_rwlock_static_lock);
- _lock_destroy(&_keytable_lock);
- }
-
- /* Initialize everything else. */
- TAILQ_INIT(&_thread_list);
- TAILQ_INIT(&_thread_gc_list);
- TAILQ_INIT(&_thr_atfork_list);
- _pthread_mutex_init(&_thr_atfork_mutex, NULL);
-
- /*
- * Initialize the lock for temporary installation of signal
- * handlers (to support sigwait() semantics) and for the
- * process signal mask and pending signal sets.
- */
- if (_lock_init(&_thread_signal_lock, LCK_ADAPTIVE,
- _kse_lock_wait, _kse_lock_wakeup) != 0)
- PANIC("Cannot initialize _thread_signal_lock");
- if (_lock_init(&_mutex_static_lock, LCK_ADAPTIVE,
- _thr_lock_wait, _thr_lock_wakeup) != 0)
- PANIC("Cannot initialize mutex static init lock");
- if (_lock_init(&_rwlock_static_lock, LCK_ADAPTIVE,
- _thr_lock_wait, _thr_lock_wakeup) != 0)
- PANIC("Cannot initialize rwlock static init lock");
- if (_lock_init(&_keytable_lock, LCK_ADAPTIVE,
- _thr_lock_wait, _thr_lock_wakeup) != 0)
- PANIC("Cannot initialize thread specific keytable lock");
- _thr_spinlock_init();
-
- /* Clear pending signals and get the process signal mask. */
- SIGEMPTYSET(_thr_proc_sigpending);
-
- /* Are we in M:N mode (default) or 1:1 mode? */
-#ifdef SYSTEM_SCOPE_ONLY
- _thread_scope_system = 1;
-#else
- if (getenv("LIBPTHREAD_SYSTEM_SCOPE") != NULL)
- _thread_scope_system = 1;
- else if (getenv("LIBPTHREAD_PROCESS_SCOPE") != NULL)
- _thread_scope_system = -1;
-#endif
-
- /*
- * _thread_list_lock and _kse_count are initialized
- * by _kse_init()
- */
-}
diff --git a/lib/libkse/thread/thr_join.c b/lib/libkse/thread/thr_join.c
deleted file mode 100644
index 9f940da..0000000
--- a/lib/libkse/thread/thr_join.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_join, pthread_join);
-
-int
-_pthread_join(pthread_t pthread, void **thread_return)
-{
- struct pthread *curthread = _get_curthread();
- void *tmp;
- kse_critical_t crit;
- int ret = 0;
-
- _thr_cancel_enter(curthread);
-
- /* Check if the caller has specified an invalid thread: */
- if (pthread == NULL || pthread->magic != THR_MAGIC) {
- /* Invalid thread: */
- _thr_cancel_leave(curthread, 1);
- return (EINVAL);
- }
-
- /* Check if the caller has specified itself: */
- if (pthread == curthread) {
- /* Avoid a deadlock condition: */
- _thr_cancel_leave(curthread, 1);
- return (EDEADLK);
- }
-
- /*
- * Find the thread in the list of active threads or in the
- * list of dead threads:
- */
- if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/1)) != 0) {
- /* Return an error: */
- _thr_cancel_leave(curthread, 1);
- return (ESRCH);
- }
-
- THR_SCHED_LOCK(curthread, pthread);
- /* Check if this thread has been detached: */
- if ((pthread->attr.flags & PTHREAD_DETACHED) != 0) {
- THR_SCHED_UNLOCK(curthread, pthread);
- /* Remove the reference and return an error: */
- _thr_ref_delete(curthread, pthread);
- ret = ESRCH;
- } else {
- /* Lock the target thread while checking its state. */
- if (pthread->state == PS_DEAD) {
- /* Return the thread's return value: */
- tmp = pthread->ret;
-
- /* Detach the thread. */
- pthread->attr.flags |= PTHREAD_DETACHED;
-
- /* Unlock the thread. */
- THR_SCHED_UNLOCK(curthread, pthread);
-
- /*
- * Remove the thread from the list of active
- * threads and add it to the GC list.
- */
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &_thread_list_lock);
- THR_LIST_REMOVE(pthread);
- THR_GCLIST_ADD(pthread);
- KSE_LOCK_RELEASE(curthread->kse, &_thread_list_lock);
- _kse_critical_leave(crit);
-
- /* Remove the reference. */
- _thr_ref_delete(curthread, pthread);
- if (thread_return != NULL)
- *thread_return = tmp;
- }
- else if (pthread->joiner != NULL) {
- /* Unlock the thread and remove the reference. */
- THR_SCHED_UNLOCK(curthread, pthread);
- _thr_ref_delete(curthread, pthread);
-
- /* Multiple joiners are not supported. */
- ret = ENOTSUP;
- }
- else {
- /* Set the running thread to be the joiner: */
- pthread->joiner = curthread;
-
- /* Keep track of which thread we're joining to: */
- curthread->join_status.thread = pthread;
-
- /* Unlock the thread and remove the reference. */
- THR_SCHED_UNLOCK(curthread, pthread);
- _thr_ref_delete(curthread, pthread);
-
- THR_SCHED_LOCK(curthread, curthread);
- while (curthread->join_status.thread == pthread) {
- THR_SET_STATE(curthread, PS_JOIN);
- THR_SCHED_UNLOCK(curthread, curthread);
- /* Schedule the next thread: */
- _thr_sched_switch(curthread);
- THR_SCHED_LOCK(curthread, curthread);
- }
- THR_SCHED_UNLOCK(curthread, curthread);
-
- if ((curthread->cancelflags & THR_CANCELLING) &&
- !(curthread->cancelflags & PTHREAD_CANCEL_DISABLE)) {
- if (_thr_ref_add(curthread, pthread, 1) == 0) {
- THR_SCHED_LOCK(curthread, pthread);
- pthread->joiner = NULL;
- THR_SCHED_UNLOCK(curthread, pthread);
- _thr_ref_delete(curthread, pthread);
- }
- pthread_exit(PTHREAD_CANCELED);
- }
-
- /*
- * The thread return value and error are set by the
- * thread we're joining to when it exits or detaches:
- */
- ret = curthread->join_status.error;
- if ((ret == 0) && (thread_return != NULL))
- *thread_return = curthread->join_status.ret;
- }
- }
- _thr_cancel_leave(curthread, 1);
-
- /* Return the completion status: */
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c
deleted file mode 100644
index aec2541..0000000
--- a/lib/libkse/thread/thr_kern.c
+++ /dev/null
@@ -1,2545 +0,0 @@
-/*
- * Copyright (C) 2003 Daniel M. Eischen <deischen@freebsd.org>
- * Copyright (C) 2002 Jonathon Mini <mini@freebsd.org>
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/kse.h>
-#include <sys/ptrace.h>
-#include <sys/signalvar.h>
-#include <sys/queue.h>
-#include <machine/atomic.h>
-#include <machine/sigframe.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <ucontext.h>
-#include <unistd.h>
-
-#include "atomic_ops.h"
-#include "thr_private.h"
-#include "libc_private.h"
-
-/* #define DEBUG_THREAD_KERN */
-#ifdef DEBUG_THREAD_KERN
-#define DBG_MSG stdout_debug
-#else
-#define DBG_MSG(x...)
-#endif
-
-/*
- * Define a high water mark for the maximum number of threads that
- * will be cached. Once this level is reached, any extra threads
- * will be free()'d.
- */
-#define MAX_CACHED_THREADS 100
-/*
- * Define high water marks for the maximum number of KSEs and KSE groups
- * that will be cached. Because we support 1:1 threading, there could have
- * same number of KSEs and KSE groups as threads. Once these levels are
- * reached, any extra KSE and KSE groups will be free()'d.
- */
-#define MAX_CACHED_KSES ((_thread_scope_system <= 0) ? 50 : 100)
-#define MAX_CACHED_KSEGS ((_thread_scope_system <= 0) ? 50 : 100)
-
-#define KSE_SET_MBOX(kse, thrd) \
- (kse)->k_kcb->kcb_kmbx.km_curthread = &(thrd)->tcb->tcb_tmbx
-
-#define KSE_SET_EXITED(kse) (kse)->k_flags |= KF_EXITED
-
-/*
- * Macros for manipulating the run queues. The priority queue
- * routines use the thread's pqe link and also handle the setting
- * and clearing of the thread's THR_FLAGS_IN_RUNQ flag.
- */
-#define KSE_RUNQ_INSERT_HEAD(kse, thrd) \
- _pq_insert_head(&(kse)->k_schedq->sq_runq, thrd)
-#define KSE_RUNQ_INSERT_TAIL(kse, thrd) \
- _pq_insert_tail(&(kse)->k_schedq->sq_runq, thrd)
-#define KSE_RUNQ_REMOVE(kse, thrd) \
- _pq_remove(&(kse)->k_schedq->sq_runq, thrd)
-#define KSE_RUNQ_FIRST(kse) \
- ((_libkse_debug == 0) ? \
- _pq_first(&(kse)->k_schedq->sq_runq) : \
- _pq_first_debug(&(kse)->k_schedq->sq_runq))
-
-#define KSE_RUNQ_THREADS(kse) ((kse)->k_schedq->sq_runq.pq_threads)
-
-#define THR_NEED_CANCEL(thrd) \
- (((thrd)->cancelflags & THR_CANCELLING) != 0 && \
- ((thrd)->cancelflags & PTHREAD_CANCEL_DISABLE) == 0 && \
- (((thrd)->cancelflags & THR_AT_CANCEL_POINT) != 0 || \
- ((thrd)->cancelflags & PTHREAD_CANCEL_ASYNCHRONOUS) != 0))
-
-#define THR_NEED_ASYNC_CANCEL(thrd) \
- (((thrd)->cancelflags & THR_CANCELLING) != 0 && \
- ((thrd)->cancelflags & PTHREAD_CANCEL_DISABLE) == 0 && \
- (((thrd)->cancelflags & THR_AT_CANCEL_POINT) == 0 && \
- ((thrd)->cancelflags & PTHREAD_CANCEL_ASYNCHRONOUS) != 0))
-
-/*
- * We've got to keep track of everything that is allocated, not only
- * to have a speedy free list, but also so they can be deallocated
- * after a fork().
- */
-static TAILQ_HEAD(, kse) active_kseq;
-static TAILQ_HEAD(, kse) free_kseq;
-static TAILQ_HEAD(, kse_group) free_kse_groupq;
-static TAILQ_HEAD(, kse_group) active_kse_groupq;
-static TAILQ_HEAD(, kse_group) gc_ksegq;
-static struct lock kse_lock; /* also used for kseg queue */
-static int free_kse_count = 0;
-static int free_kseg_count = 0;
-static TAILQ_HEAD(, pthread) free_threadq;
-static struct lock thread_lock;
-static int free_thread_count = 0;
-static int inited = 0;
-static int active_kse_count = 0;
-static int active_kseg_count = 0;
-static u_int64_t next_uniqueid = 1;
-
-LIST_HEAD(thread_hash_head, pthread);
-#define THREAD_HASH_QUEUES 127
-static struct thread_hash_head thr_hashtable[THREAD_HASH_QUEUES];
-#define THREAD_HASH(thrd) ((unsigned long)thrd % THREAD_HASH_QUEUES)
-
-/* Lock for thread tcb constructor/destructor */
-static pthread_mutex_t _tcb_mutex;
-
-#ifdef DEBUG_THREAD_KERN
-static void dump_queues(struct kse *curkse);
-#endif
-static void kse_check_completed(struct kse *kse);
-static void kse_check_waitq(struct kse *kse);
-static void kse_fini(struct kse *curkse);
-static void kse_reinit(struct kse *kse, int sys_scope);
-static void kse_sched_multi(struct kse_mailbox *kmbx);
-static void kse_sched_single(struct kse_mailbox *kmbx);
-static void kse_switchout_thread(struct kse *kse, struct pthread *thread);
-static void kse_wait(struct kse *kse, struct pthread *td_wait, int sigseq);
-static void kse_free_unlocked(struct kse *kse);
-static void kse_destroy(struct kse *kse);
-static void kseg_free_unlocked(struct kse_group *kseg);
-static void kseg_init(struct kse_group *kseg);
-static void kseg_reinit(struct kse_group *kseg);
-static void kseg_destroy(struct kse_group *kseg);
-static void kse_waitq_insert(struct pthread *thread);
-static void kse_wakeup_multi(struct kse *curkse);
-static struct kse_mailbox *kse_wakeup_one(struct pthread *thread);
-static void thr_cleanup(struct kse *kse, struct pthread *curthread);
-static void thr_link(struct pthread *thread);
-static void thr_resume_wrapper(int sig, siginfo_t *, ucontext_t *);
-static void thr_resume_check(struct pthread *curthread, ucontext_t *ucp);
-static int thr_timedout(struct pthread *thread, struct timespec *curtime);
-static void thr_unlink(struct pthread *thread);
-static void thr_destroy(struct pthread *curthread, struct pthread *thread);
-static void thread_gc(struct pthread *thread);
-static void kse_gc(struct pthread *thread);
-static void kseg_gc(struct pthread *thread);
-
-static void __inline
-thr_accounting(struct pthread *thread)
-{
- if ((thread->slice_usec != -1) &&
- (thread->slice_usec <= TIMESLICE_USEC) &&
- (thread->attr.sched_policy != SCHED_FIFO)) {
- thread->slice_usec += (thread->tcb->tcb_tmbx.tm_uticks
- + thread->tcb->tcb_tmbx.tm_sticks) * _clock_res_usec;
- /* Check for time quantum exceeded: */
- if (thread->slice_usec > TIMESLICE_USEC)
- thread->slice_usec = -1;
- }
- thread->tcb->tcb_tmbx.tm_uticks = 0;
- thread->tcb->tcb_tmbx.tm_sticks = 0;
-}
-
-/*
- * This is called after a fork().
- * No locks need to be taken here since we are guaranteed to be
- * single threaded.
- *
- * XXX
- * POSIX says for threaded process, fork() function is used
- * only to run new programs, and the effects of calling functions
- * that require certain resources between the call to fork() and
- * the call to an exec function are undefined.
- *
- * It is not safe to free memory after fork(), because these data
- * structures may be in inconsistent state.
- */
-void
-_kse_single_thread(struct pthread *curthread)
-{
-#ifdef NOTYET
- struct kse *kse;
- struct kse_group *kseg;
- struct pthread *thread;
- kse_critical_t crit;
- int i;
-
- if (__isthreaded) {
- _thr_rtld_fini();
- _thr_signal_deinit();
- }
- __isthreaded = 0;
- /*
- * Restore signal mask early, so any memory problems could
- * dump core.
- */
- sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
- _thread_active_threads = 1;
-
- /*
- * Enter a loop to remove and free all threads other than
- * the running thread from the active thread list:
- */
- while ((thread = TAILQ_FIRST(&_thread_list)) != NULL) {
- THR_GCLIST_REMOVE(thread);
- /*
- * Remove this thread from the list (the current
- * thread will be removed but re-added by libpthread
- * initialization.
- */
- TAILQ_REMOVE(&_thread_list, thread, tle);
- /* Make sure this isn't the running thread: */
- if (thread != curthread) {
- _thr_stack_free(&thread->attr);
- if (thread->specific != NULL)
- free(thread->specific);
- thr_destroy(curthread, thread);
- }
- }
-
- TAILQ_INIT(&curthread->mutexq); /* initialize mutex queue */
- curthread->joiner = NULL; /* no joining threads yet */
- curthread->refcount = 0;
- SIGEMPTYSET(curthread->sigpend); /* clear pending signals */
- if (curthread->specific != NULL) {
- free(curthread->specific);
- curthread->specific = NULL;
- curthread->specific_data_count = 0;
- }
-
- /* Free the free KSEs: */
- while ((kse = TAILQ_FIRST(&free_kseq)) != NULL) {
- TAILQ_REMOVE(&free_kseq, kse, k_qe);
- kse_destroy(kse);
- }
- free_kse_count = 0;
-
- /* Free the active KSEs: */
- while ((kse = TAILQ_FIRST(&active_kseq)) != NULL) {
- TAILQ_REMOVE(&active_kseq, kse, k_qe);
- kse_destroy(kse);
- }
- active_kse_count = 0;
-
- /* Free the free KSEGs: */
- while ((kseg = TAILQ_FIRST(&free_kse_groupq)) != NULL) {
- TAILQ_REMOVE(&free_kse_groupq, kseg, kg_qe);
- kseg_destroy(kseg);
- }
- free_kseg_count = 0;
-
- /* Free the active KSEGs: */
- while ((kseg = TAILQ_FIRST(&active_kse_groupq)) != NULL) {
- TAILQ_REMOVE(&active_kse_groupq, kseg, kg_qe);
- kseg_destroy(kseg);
- }
- active_kseg_count = 0;
-
- /* Free the free threads. */
- while ((thread = TAILQ_FIRST(&free_threadq)) != NULL) {
- TAILQ_REMOVE(&free_threadq, thread, tle);
- thr_destroy(curthread, thread);
- }
- free_thread_count = 0;
-
- /* Free the to-be-gc'd threads. */
- while ((thread = TAILQ_FIRST(&_thread_gc_list)) != NULL) {
- TAILQ_REMOVE(&_thread_gc_list, thread, gcle);
- thr_destroy(curthread, thread);
- }
- TAILQ_INIT(&gc_ksegq);
- _gc_count = 0;
-
- if (inited != 0) {
- /*
- * Destroy these locks; they'll be recreated to assure they
- * are in the unlocked state.
- */
- _lock_destroy(&kse_lock);
- _lock_destroy(&thread_lock);
- _lock_destroy(&_thread_list_lock);
- inited = 0;
- }
-
- /*
- * After a fork(), the leftover thread goes back to being
- * scope process.
- */
- curthread->attr.flags &= ~PTHREAD_SCOPE_SYSTEM;
- curthread->attr.flags |= PTHREAD_SCOPE_PROCESS;
-
- /*
- * After a fork, we are still operating on the thread's original
- * stack. Don't clear the THR_FLAGS_USER from the thread's
- * attribute flags.
- */
-
- /* Initialize the threads library. */
- curthread->kse = NULL;
- curthread->kseg = NULL;
- _kse_initial = NULL;
- _libpthread_init(curthread);
-#else
- int i;
-
- /* Reset the current thread and KSE lock data. */
- for (i = 0; i < curthread->locklevel; i++) {
- _lockuser_reinit(&curthread->lockusers[i], (void *)curthread);
- }
- curthread->locklevel = 0;
- for (i = 0; i < curthread->kse->k_locklevel; i++) {
- _lockuser_reinit(&curthread->kse->k_lockusers[i],
- (void *)curthread->kse);
- _LCK_SET_PRIVATE2(&curthread->kse->k_lockusers[i], NULL);
- }
- curthread->kse->k_locklevel = 0;
- _thr_spinlock_init();
- if (__isthreaded) {
- _thr_rtld_fini();
- _thr_signal_deinit();
- }
- __isthreaded = 0;
- curthread->kse->k_kcb->kcb_kmbx.km_curthread = NULL;
- curthread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
-
- /* After a fork(), there child should have no pending signals. */
- sigemptyset(&curthread->sigpend);
-
- /*
- * Restore signal mask early, so any memory problems could
- * dump core.
- */
- sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
- _thread_active_threads = 1;
-#endif
-}
-
-/*
- * This is used to initialize housekeeping and to initialize the
- * KSD for the KSE.
- */
-void
-_kse_init(void)
-{
- if (inited == 0) {
- TAILQ_INIT(&active_kseq);
- TAILQ_INIT(&active_kse_groupq);
- TAILQ_INIT(&free_kseq);
- TAILQ_INIT(&free_kse_groupq);
- TAILQ_INIT(&free_threadq);
- TAILQ_INIT(&gc_ksegq);
- if (_lock_init(&kse_lock, LCK_ADAPTIVE,
- _kse_lock_wait, _kse_lock_wakeup) != 0)
- PANIC("Unable to initialize free KSE queue lock");
- if (_lock_init(&thread_lock, LCK_ADAPTIVE,
- _kse_lock_wait, _kse_lock_wakeup) != 0)
- PANIC("Unable to initialize free thread queue lock");
- if (_lock_init(&_thread_list_lock, LCK_ADAPTIVE,
- _kse_lock_wait, _kse_lock_wakeup) != 0)
- PANIC("Unable to initialize thread list lock");
- _pthread_mutex_init(&_tcb_mutex, NULL);
- active_kse_count = 0;
- active_kseg_count = 0;
- _gc_count = 0;
- inited = 1;
- }
-}
-
-/*
- * This is called when the first thread (other than the initial
- * thread) is created.
- */
-int
-_kse_setthreaded(int threaded)
-{
- sigset_t sigset;
-
- if ((threaded != 0) && (__isthreaded == 0)) {
- SIGFILLSET(sigset);
- __sys_sigprocmask(SIG_SETMASK, &sigset, &_thr_initial->sigmask);
-
- /*
- * Tell the kernel to create a KSE for the initial thread
- * and enable upcalls in it.
- */
- _kse_initial->k_flags |= KF_STARTED;
-
- if (_thread_scope_system <= 0) {
- _thr_initial->attr.flags &= ~PTHREAD_SCOPE_SYSTEM;
- _kse_initial->k_kseg->kg_flags &= ~KGF_SINGLE_THREAD;
- _kse_initial->k_kcb->kcb_kmbx.km_curthread = NULL;
- }
- else {
- /*
- * For bound thread, kernel reads mailbox pointer
- * once, we'd set it here before calling kse_create.
- */
- _tcb_set(_kse_initial->k_kcb, _thr_initial->tcb);
- KSE_SET_MBOX(_kse_initial, _thr_initial);
- _kse_initial->k_kcb->kcb_kmbx.km_flags |= KMF_BOUND;
- }
-
- /*
- * Locking functions in libc are required when there are
- * threads other than the initial thread.
- */
- _thr_rtld_init();
-
- __isthreaded = 1;
- if (kse_create(&_kse_initial->k_kcb->kcb_kmbx, 0) != 0) {
- _kse_initial->k_flags &= ~KF_STARTED;
- __isthreaded = 0;
- PANIC("kse_create() failed\n");
- return (-1);
- }
- _thr_initial->tcb->tcb_tmbx.tm_lwp =
- _kse_initial->k_kcb->kcb_kmbx.km_lwp;
- _thread_activated = 1;
-
-#ifndef SYSTEM_SCOPE_ONLY
- if (_thread_scope_system <= 0) {
- /* Set current thread to initial thread */
- _tcb_set(_kse_initial->k_kcb, _thr_initial->tcb);
- KSE_SET_MBOX(_kse_initial, _thr_initial);
- _thr_start_sig_daemon();
- _thr_setmaxconcurrency();
- }
- else
-#endif
- __sys_sigprocmask(SIG_SETMASK, &_thr_initial->sigmask,
- NULL);
- }
- return (0);
-}
-
-/*
- * Lock wait and wakeup handlers for KSE locks. These are only used by
- * KSEs, and should never be used by threads. KSE locks include the
- * KSE group lock (used for locking the scheduling queue) and the
- * kse_lock defined above.
- *
- * When a KSE lock attempt blocks, the entire KSE blocks allowing another
- * KSE to run. For the most part, it doesn't make much sense to try and
- * schedule another thread because you need to lock the scheduling queue
- * in order to do that. And since the KSE lock is used to lock the scheduling
- * queue, you would just end up blocking again.
- */
-void
-_kse_lock_wait(struct lock *lock, struct lockuser *lu)
-{
- struct kse *curkse = (struct kse *)_LCK_GET_PRIVATE(lu);
- struct timespec ts;
- int saved_flags;
-
- if (curkse->k_kcb->kcb_kmbx.km_curthread != NULL)
- PANIC("kse_lock_wait does not disable upcall.\n");
- /*
- * Enter a loop to wait until we get the lock.
- */
- ts.tv_sec = 0;
- ts.tv_nsec = 1000000; /* 1 sec */
- while (!_LCK_GRANTED(lu)) {
- /*
- * Yield the kse and wait to be notified when the lock
- * is granted.
- */
- saved_flags = curkse->k_kcb->kcb_kmbx.km_flags;
- curkse->k_kcb->kcb_kmbx.km_flags |= KMF_NOUPCALL |
- KMF_NOCOMPLETED;
- kse_release(&ts);
- curkse->k_kcb->kcb_kmbx.km_flags = saved_flags;
- }
-}
-
-void
-_kse_lock_wakeup(struct lock *lock, struct lockuser *lu)
-{
- struct kse *curkse;
- struct kse *kse;
- struct kse_mailbox *mbx;
-
- curkse = _get_curkse();
- kse = (struct kse *)_LCK_GET_PRIVATE(lu);
-
- if (kse == curkse)
- PANIC("KSE trying to wake itself up in lock");
- else {
- mbx = &kse->k_kcb->kcb_kmbx;
- _lock_grant(lock, lu);
- /*
- * Notify the owning kse that it has the lock.
- * It is safe to pass invalid address to kse_wakeup
- * even if the mailbox is not in kernel at all,
- * and waking up a wrong kse is also harmless.
- */
- kse_wakeup(mbx);
- }
-}
-
-/*
- * Thread wait and wakeup handlers for thread locks. These are only used
- * by threads, never by KSEs. Thread locks include the per-thread lock
- * (defined in its structure), and condition variable and mutex locks.
- */
-void
-_thr_lock_wait(struct lock *lock, struct lockuser *lu)
-{
- struct pthread *curthread = (struct pthread *)lu->lu_private;
-
- do {
- THR_LOCK_SWITCH(curthread);
- THR_SET_STATE(curthread, PS_LOCKWAIT);
- _thr_sched_switch_unlocked(curthread);
- } while (!_LCK_GRANTED(lu));
-}
-
-void
-_thr_lock_wakeup(struct lock *lock, struct lockuser *lu)
-{
- struct pthread *thread;
- struct pthread *curthread;
- struct kse_mailbox *kmbx;
-
- curthread = _get_curthread();
- thread = (struct pthread *)_LCK_GET_PRIVATE(lu);
-
- THR_SCHED_LOCK(curthread, thread);
- _lock_grant(lock, lu);
- kmbx = _thr_setrunnable_unlocked(thread);
- THR_SCHED_UNLOCK(curthread, thread);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
-}
-
-kse_critical_t
-_kse_critical_enter(void)
-{
- kse_critical_t crit;
-
- crit = (kse_critical_t)_kcb_critical_enter();
- return (crit);
-}
-
-void
-_kse_critical_leave(kse_critical_t crit)
-{
- struct pthread *curthread;
-
- _kcb_critical_leave((struct kse_thr_mailbox *)crit);
- if ((crit != NULL) && ((curthread = _get_curthread()) != NULL))
- THR_YIELD_CHECK(curthread);
-}
-
-int
-_kse_in_critical(void)
-{
- return (_kcb_in_critical());
-}
-
-void
-_thr_critical_enter(struct pthread *thread)
-{
- thread->critical_count++;
-}
-
-void
-_thr_critical_leave(struct pthread *thread)
-{
- thread->critical_count--;
- THR_YIELD_CHECK(thread);
-}
-
-void
-_thr_sched_switch(struct pthread *curthread)
-{
- struct kse *curkse;
-
- (void)_kse_critical_enter();
- curkse = _get_curkse();
- KSE_SCHED_LOCK(curkse, curkse->k_kseg);
- _thr_sched_switch_unlocked(curthread);
-}
-
-/*
- * XXX - We may need to take the scheduling lock before calling
- * this, or perhaps take the lock within here before
- * doing anything else.
- */
-void
-_thr_sched_switch_unlocked(struct pthread *curthread)
-{
- struct kse *curkse;
- volatile int resume_once = 0;
- ucontext_t *uc;
-
- /* We're in the scheduler, 5 by 5: */
- curkse = curthread->kse;
-
- curthread->need_switchout = 1; /* The thread yielded on its own. */
- curthread->critical_yield = 0; /* No need to yield anymore. */
-
- /* Thread can unlock the scheduler lock. */
- curthread->lock_switch = 1;
-
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- kse_sched_single(&curkse->k_kcb->kcb_kmbx);
- else {
- if (__predict_false(_libkse_debug != 0)) {
- /*
- * Because debugger saves single step status in thread
- * mailbox's tm_dflags, we can safely clear single
- * step status here. the single step status will be
- * restored by kse_switchin when the thread is
- * switched in again. This also lets uts run in full
- * speed.
- */
- ptrace(PT_CLEARSTEP, curkse->k_kcb->kcb_kmbx.km_lwp,
- (caddr_t) 1, 0);
- }
-
- KSE_SET_SWITCH(curkse);
- _thread_enter_uts(curthread->tcb, curkse->k_kcb);
- }
-
- /*
- * Unlock the scheduling queue and leave the
- * critical region.
- */
- /* Don't trust this after a switch! */
- curkse = curthread->kse;
-
- curthread->lock_switch = 0;
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- _kse_critical_leave(&curthread->tcb->tcb_tmbx);
-
- /*
- * This thread is being resumed; check for cancellations.
- */
- if (THR_NEED_ASYNC_CANCEL(curthread) && !THR_IN_CRITICAL(curthread)) {
- uc = alloca(sizeof(ucontext_t));
- resume_once = 0;
- THR_GETCONTEXT(uc);
- if (resume_once == 0) {
- resume_once = 1;
- curthread->check_pending = 0;
- thr_resume_check(curthread, uc);
- }
- }
- THR_ACTIVATE_LAST_LOCK(curthread);
-}
-
-/*
- * This is the scheduler for a KSE which runs a scope system thread.
- * The multi-thread KSE scheduler should also work for a single threaded
- * KSE, but we use a separate scheduler so that it can be fine-tuned
- * to be more efficient (and perhaps not need a separate stack for
- * the KSE, allowing it to use the thread's stack).
- */
-
-static void
-kse_sched_single(struct kse_mailbox *kmbx)
-{
- struct kse *curkse;
- struct pthread *curthread;
- struct timespec ts;
- sigset_t sigmask;
- int i, sigseqno, level, first = 0;
-
- curkse = (struct kse *)kmbx->km_udata;
- curthread = curkse->k_curthread;
-
- if (__predict_false((curkse->k_flags & KF_INITIALIZED) == 0)) {
- /* Setup this KSEs specific data. */
- _kcb_set(curkse->k_kcb);
- _tcb_set(curkse->k_kcb, curthread->tcb);
- curkse->k_flags |= KF_INITIALIZED;
- first = 1;
- curthread->active = 1;
-
- /* Setup kernel signal masks for new thread. */
- __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
- /*
- * Enter critical region, this is meanless for bound thread,
- * It is used to let other code work, those code want mailbox
- * to be cleared.
- */
- (void)_kse_critical_enter();
- } else {
- /*
- * Bound thread always has tcb set, this prevent some
- * code from blindly setting bound thread tcb to NULL,
- * buggy code ?
- */
- _tcb_set(curkse->k_kcb, curthread->tcb);
- }
-
- curthread->critical_yield = 0;
- curthread->need_switchout = 0;
-
- /*
- * Lock the scheduling queue.
- *
- * There is no scheduling queue for single threaded KSEs,
- * but we need a lock for protection regardless.
- */
- if (curthread->lock_switch == 0)
- KSE_SCHED_LOCK(curkse, curkse->k_kseg);
-
- /*
- * This has to do the job of kse_switchout_thread(), only
- * for a single threaded KSE/KSEG.
- */
-
- switch (curthread->state) {
- case PS_MUTEX_WAIT:
- case PS_COND_WAIT:
- if (THR_NEED_CANCEL(curthread)) {
- curthread->interrupted = 1;
- curthread->continuation = _thr_finish_cancellation;
- THR_SET_STATE(curthread, PS_RUNNING);
- }
- break;
-
- case PS_LOCKWAIT:
- /*
- * This state doesn't timeout.
- */
- curthread->wakeup_time.tv_sec = -1;
- curthread->wakeup_time.tv_nsec = -1;
- level = curthread->locklevel - 1;
- if (_LCK_GRANTED(&curthread->lockusers[level]))
- THR_SET_STATE(curthread, PS_RUNNING);
- break;
-
- case PS_DEAD:
- curthread->check_pending = 0;
- /* Unlock the scheduling queue and exit the KSE and thread. */
- thr_cleanup(curkse, curthread);
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- PANIC("bound thread shouldn't get here\n");
- break;
-
- case PS_JOIN:
- if (THR_NEED_CANCEL(curthread)) {
- curthread->join_status.thread = NULL;
- THR_SET_STATE(curthread, PS_RUNNING);
- } else {
- /*
- * This state doesn't timeout.
- */
- curthread->wakeup_time.tv_sec = -1;
- curthread->wakeup_time.tv_nsec = -1;
- }
- break;
-
- case PS_SUSPENDED:
- if (THR_NEED_CANCEL(curthread)) {
- curthread->interrupted = 1;
- THR_SET_STATE(curthread, PS_RUNNING);
- } else {
- /*
- * These states don't timeout.
- */
- curthread->wakeup_time.tv_sec = -1;
- curthread->wakeup_time.tv_nsec = -1;
- }
- break;
-
- case PS_RUNNING:
- if ((curthread->flags & THR_FLAGS_SUSPENDED) != 0 &&
- !THR_NEED_CANCEL(curthread)) {
- THR_SET_STATE(curthread, PS_SUSPENDED);
- /*
- * These states don't timeout.
- */
- curthread->wakeup_time.tv_sec = -1;
- curthread->wakeup_time.tv_nsec = -1;
- }
- break;
-
- case PS_SIGWAIT:
- PANIC("bound thread does not have SIGWAIT state\n");
-
- case PS_SLEEP_WAIT:
- PANIC("bound thread does not have SLEEP_WAIT state\n");
-
- case PS_SIGSUSPEND:
- PANIC("bound thread does not have SIGSUSPEND state\n");
-
- case PS_DEADLOCK:
- /*
- * These states don't timeout and don't need
- * to be in the waiting queue.
- */
- curthread->wakeup_time.tv_sec = -1;
- curthread->wakeup_time.tv_nsec = -1;
- break;
-
- default:
- PANIC("Unknown state\n");
- break;
- }
-
- while (curthread->state != PS_RUNNING) {
- sigseqno = curkse->k_sigseqno;
- if (curthread->check_pending != 0) {
- /*
- * Install pending signals into the frame, possible
- * cause mutex or condvar backout.
- */
- curthread->check_pending = 0;
- SIGFILLSET(sigmask);
-
- /*
- * Lock out kernel signal code when we are processing
- * signals, and get a fresh copy of signal mask.
- */
- __sys_sigprocmask(SIG_SETMASK, &sigmask,
- &curthread->sigmask);
- for (i = 1; i <= _SIG_MAXSIG; i++) {
- if (SIGISMEMBER(curthread->sigmask, i))
- continue;
- if (SIGISMEMBER(curthread->sigpend, i))
- (void)_thr_sig_add(curthread, i,
- &curthread->siginfo[i-1]);
- }
- __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask,
- NULL);
- /* The above code might make thread runnable */
- if (curthread->state == PS_RUNNING)
- break;
- }
- THR_DEACTIVATE_LAST_LOCK(curthread);
- kse_wait(curkse, curthread, sigseqno);
- THR_ACTIVATE_LAST_LOCK(curthread);
- if (curthread->wakeup_time.tv_sec >= 0) {
- KSE_GET_TOD(curkse, &ts);
- if (thr_timedout(curthread, &ts)) {
- /* Indicate the thread timedout: */
- curthread->timeout = 1;
- /* Make the thread runnable. */
- THR_SET_STATE(curthread, PS_RUNNING);
- }
- }
- }
-
- if (curthread->lock_switch == 0) {
- /* Unlock the scheduling queue. */
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- }
-
- DBG_MSG("Continuing bound thread %p\n", curthread);
- if (first) {
- _kse_critical_leave(&curthread->tcb->tcb_tmbx);
- pthread_exit(curthread->start_routine(curthread->arg));
- }
-}
-
-#ifdef DEBUG_THREAD_KERN
-static void
-dump_queues(struct kse *curkse)
-{
- struct pthread *thread;
-
- DBG_MSG("Threads in waiting queue:\n");
- TAILQ_FOREACH(thread, &curkse->k_kseg->kg_schedq.sq_waitq, pqe) {
- DBG_MSG(" thread %p, state %d, blocked %d\n",
- thread, thread->state, thread->blocked);
- }
-}
-#endif
-
-/*
- * This is the scheduler for a KSE which runs multiple threads.
- */
-static void
-kse_sched_multi(struct kse_mailbox *kmbx)
-{
- struct kse *curkse;
- struct pthread *curthread, *td_wait;
- int ret;
-
- curkse = (struct kse *)kmbx->km_udata;
- THR_ASSERT(curkse->k_kcb->kcb_kmbx.km_curthread == NULL,
- "Mailbox not null in kse_sched_multi");
-
- /* Check for first time initialization: */
- if (__predict_false((curkse->k_flags & KF_INITIALIZED) == 0)) {
- /* Setup this KSEs specific data. */
- _kcb_set(curkse->k_kcb);
-
- /* Set this before grabbing the context. */
- curkse->k_flags |= KF_INITIALIZED;
- }
-
- /*
- * No current thread anymore, calling _get_curthread in UTS
- * should dump core
- */
- _tcb_set(curkse->k_kcb, NULL);
-
- /* If this is an upcall; take the scheduler lock. */
- if (!KSE_IS_SWITCH(curkse))
- KSE_SCHED_LOCK(curkse, curkse->k_kseg);
- else
- KSE_CLEAR_SWITCH(curkse);
-
- if (KSE_IS_IDLE(curkse)) {
- KSE_CLEAR_IDLE(curkse);
- curkse->k_kseg->kg_idle_kses--;
- }
-
- /*
- * Now that the scheduler lock is held, get the current
- * thread. The KSE's current thread cannot be safely
- * examined without the lock because it could have returned
- * as completed on another KSE. See kse_check_completed().
- */
- curthread = curkse->k_curthread;
-
- /*
- * If the current thread was completed in another KSE, then
- * it will be in the run queue. Don't mark it as being blocked.
- */
- if ((curthread != NULL) &&
- ((curthread->flags & THR_FLAGS_IN_RUNQ) == 0) &&
- (curthread->need_switchout == 0)) {
- /*
- * Assume the current thread is blocked; when the
- * completed threads are checked and if the current
- * thread is among the completed, the blocked flag
- * will be cleared.
- */
- curthread->blocked = 1;
- DBG_MSG("Running thread %p is now blocked in kernel.\n",
- curthread);
- }
-
- /* Check for any unblocked threads in the kernel. */
- kse_check_completed(curkse);
-
- /*
- * Check for threads that have timed-out.
- */
- kse_check_waitq(curkse);
-
- /*
- * Switchout the current thread, if necessary, as the last step
- * so that it is inserted into the run queue (if it's runnable)
- * _after_ any other threads that were added to it above.
- */
- if (curthread == NULL)
- ; /* Nothing to do here. */
- else if ((curthread->need_switchout == 0) && DBG_CAN_RUN(curthread) &&
- (curthread->blocked == 0) && (THR_IN_CRITICAL(curthread))) {
- /*
- * Resume the thread and tell it to yield when
- * it leaves the critical region.
- */
- curthread->critical_yield = 1;
- curthread->active = 1;
- if ((curthread->flags & THR_FLAGS_IN_RUNQ) != 0)
- KSE_RUNQ_REMOVE(curkse, curthread);
- curkse->k_curthread = curthread;
- curthread->kse = curkse;
- DBG_MSG("Continuing thread %p in critical region\n",
- curthread);
- kse_wakeup_multi(curkse);
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- ret = _thread_switch(curkse->k_kcb, curthread->tcb, 1);
- if (ret != 0)
- PANIC("Can't resume thread in critical region\n");
- }
- else if ((curthread->flags & THR_FLAGS_IN_RUNQ) == 0) {
- curthread->tcb->tcb_tmbx.tm_lwp = 0;
- kse_switchout_thread(curkse, curthread);
- }
- curkse->k_curthread = NULL;
-
-#ifdef DEBUG_THREAD_KERN
- dump_queues(curkse);
-#endif
-
- /* Check if there are no threads ready to run: */
- while (((curthread = KSE_RUNQ_FIRST(curkse)) == NULL) &&
- (curkse->k_kseg->kg_threadcount != 0) &&
- ((curkse->k_flags & KF_TERMINATED) == 0)) {
- /*
- * Wait for a thread to become active or until there are
- * no more threads.
- */
- td_wait = KSE_WAITQ_FIRST(curkse);
- kse_wait(curkse, td_wait, 0);
- kse_check_completed(curkse);
- kse_check_waitq(curkse);
- }
-
- /* Check for no more threads: */
- if ((curkse->k_kseg->kg_threadcount == 0) ||
- ((curkse->k_flags & KF_TERMINATED) != 0)) {
- /*
- * Normally this shouldn't return, but it will if there
- * are other KSEs running that create new threads that
- * are assigned to this KSE[G]. For instance, if a scope
- * system thread were to create a scope process thread
- * and this kse[g] is the initial kse[g], then that newly
- * created thread would be assigned to us (the initial
- * kse[g]).
- */
- kse_wakeup_multi(curkse);
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- kse_fini(curkse);
- /* never returns */
- }
-
- THR_ASSERT(curthread != NULL,
- "Return from kse_wait/fini without thread.");
- THR_ASSERT(curthread->state != PS_DEAD,
- "Trying to resume dead thread!");
- KSE_RUNQ_REMOVE(curkse, curthread);
-
- /*
- * Make the selected thread the current thread.
- */
- curkse->k_curthread = curthread;
-
- /*
- * Make sure the current thread's kse points to this kse.
- */
- curthread->kse = curkse;
-
- /*
- * Reset the time slice if this thread is running for the first
- * time or running again after using its full time slice allocation.
- */
- if (curthread->slice_usec == -1)
- curthread->slice_usec = 0;
-
- /* Mark the thread active. */
- curthread->active = 1;
-
- /*
- * The thread's current signal frame will only be NULL if it
- * is being resumed after being blocked in the kernel. In
- * this case, and if the thread needs to run down pending
- * signals or needs a cancellation check, we need to add a
- * signal frame to the thread's context.
- */
- if (curthread->lock_switch == 0 && curthread->state == PS_RUNNING &&
- (curthread->check_pending != 0 ||
- THR_NEED_ASYNC_CANCEL(curthread)) &&
- !THR_IN_CRITICAL(curthread)) {
- curthread->check_pending = 0;
- signalcontext(&curthread->tcb->tcb_tmbx.tm_context, 0,
- (__sighandler_t *)thr_resume_wrapper);
- }
- kse_wakeup_multi(curkse);
- /*
- * Continue the thread at its current frame:
- */
- if (curthread->lock_switch != 0) {
- /*
- * This thread came from a scheduler switch; it will
- * unlock the scheduler lock and set the mailbox.
- */
- ret = _thread_switch(curkse->k_kcb, curthread->tcb, 0);
- } else {
- /* This thread won't unlock the scheduler lock. */
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- ret = _thread_switch(curkse->k_kcb, curthread->tcb, 1);
- }
- if (ret != 0)
- PANIC("Thread has returned from _thread_switch");
-
- /* This point should not be reached. */
- PANIC("Thread has returned from _thread_switch");
-}
-
-static void
-thr_resume_wrapper(int sig, siginfo_t *siginfo, ucontext_t *ucp)
-{
- struct pthread *curthread = _get_curthread();
- struct kse *curkse;
- int ret, err_save = errno;
-
- DBG_MSG(">>> sig wrapper\n");
- if (curthread->lock_switch)
- PANIC("thr_resume_wrapper, lock_switch != 0\n");
- thr_resume_check(curthread, ucp);
- errno = err_save;
- _kse_critical_enter();
- curkse = curthread->kse;
- curthread->tcb->tcb_tmbx.tm_context = *ucp;
- ret = _thread_switch(curkse->k_kcb, curthread->tcb, 1);
- if (ret != 0)
- PANIC("thr_resume_wrapper: thread has returned "
- "from _thread_switch");
- /* THR_SETCONTEXT(ucp); */ /* not work, why ? */
-}
-
-static void
-thr_resume_check(struct pthread *curthread, ucontext_t *ucp)
-{
- _thr_sig_rundown(curthread, ucp);
-
- if (THR_NEED_ASYNC_CANCEL(curthread))
- pthread_testcancel();
-}
-
-/*
- * Clean up a thread. This must be called with the thread's KSE
- * scheduling lock held. The thread must be a thread from the
- * KSE's group.
- */
-static void
-thr_cleanup(struct kse *curkse, struct pthread *thread)
-{
- struct pthread *joiner;
- struct kse_mailbox *kmbx = NULL;
- int sys_scope;
-
- if ((joiner = thread->joiner) != NULL) {
- /* Joinee scheduler lock held; joiner won't leave. */
- if (joiner->kseg == curkse->k_kseg) {
- if (joiner->join_status.thread == thread) {
- joiner->join_status.thread = NULL;
- joiner->join_status.ret = thread->ret;
- (void)_thr_setrunnable_unlocked(joiner);
- }
- } else {
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- /* The joiner may have removed itself and exited. */
- if (_thr_ref_add(thread, joiner, 0) == 0) {
- KSE_SCHED_LOCK(curkse, joiner->kseg);
- if (joiner->join_status.thread == thread) {
- joiner->join_status.thread = NULL;
- joiner->join_status.ret = thread->ret;
- kmbx = _thr_setrunnable_unlocked(joiner);
- }
- KSE_SCHED_UNLOCK(curkse, joiner->kseg);
- _thr_ref_delete(thread, joiner);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- }
- KSE_SCHED_LOCK(curkse, curkse->k_kseg);
- }
- thread->attr.flags |= PTHREAD_DETACHED;
- }
-
- if (!(sys_scope = (thread->attr.flags & PTHREAD_SCOPE_SYSTEM))) {
- /*
- * Remove the thread from the KSEG's list of threads.
- */
- KSEG_THRQ_REMOVE(thread->kseg, thread);
- /*
- * Migrate the thread to the main KSE so that this
- * KSE and KSEG can be cleaned when their last thread
- * exits.
- */
- thread->kseg = _kse_initial->k_kseg;
- thread->kse = _kse_initial;
- }
-
- /*
- * We can't hold the thread list lock while holding the
- * scheduler lock.
- */
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- DBG_MSG("Adding thread %p to GC list\n", thread);
- KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- thread->tlflags |= TLFLAGS_GC_SAFE;
- THR_GCLIST_ADD(thread);
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- if (sys_scope) {
- /*
- * System scope thread is single thread group,
- * when thread is exited, its kse and ksegrp should
- * be recycled as well.
- * kse upcall stack belongs to thread, clear it here.
- */
- curkse->k_stack.ss_sp = 0;
- curkse->k_stack.ss_size = 0;
- kse_exit();
- PANIC("kse_exit() failed for system scope thread");
- }
- KSE_SCHED_LOCK(curkse, curkse->k_kseg);
-}
-
-void
-_thr_gc(struct pthread *curthread)
-{
- thread_gc(curthread);
- kse_gc(curthread);
- kseg_gc(curthread);
-}
-
-static void
-thread_gc(struct pthread *curthread)
-{
- struct pthread *td, *td_next;
- kse_critical_t crit;
- TAILQ_HEAD(, pthread) worklist;
-
- TAILQ_INIT(&worklist);
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &_thread_list_lock);
-
- /* Check the threads waiting for GC. */
- for (td = TAILQ_FIRST(&_thread_gc_list); td != NULL; td = td_next) {
- td_next = TAILQ_NEXT(td, gcle);
- if ((td->tlflags & TLFLAGS_GC_SAFE) == 0)
- continue;
- else if (((td->attr.flags & PTHREAD_SCOPE_SYSTEM) != 0) &&
- ((td->kse->k_kcb->kcb_kmbx.km_flags & KMF_DONE) == 0)) {
- /*
- * The thread and KSE are operating on the same
- * stack. Wait for the KSE to exit before freeing
- * the thread's stack as well as everything else.
- */
- continue;
- }
- /*
- * Remove the thread from the GC list. If the thread
- * isn't yet detached, it will get added back to the
- * GC list at a later time.
- */
- THR_GCLIST_REMOVE(td);
- DBG_MSG("Freeing thread %p stack\n", td);
- /*
- * We can free the thread stack since it's no longer
- * in use.
- */
- _thr_stack_free(&td->attr);
- if (((td->attr.flags & PTHREAD_DETACHED) != 0) &&
- (td->refcount == 0)) {
- /*
- * The thread has detached and is no longer
- * referenced. It is safe to remove all
- * remnants of the thread.
- */
- THR_LIST_REMOVE(td);
- TAILQ_INSERT_HEAD(&worklist, td, gcle);
- }
- }
- KSE_LOCK_RELEASE(curthread->kse, &_thread_list_lock);
- _kse_critical_leave(crit);
-
- while ((td = TAILQ_FIRST(&worklist)) != NULL) {
- TAILQ_REMOVE(&worklist, td, gcle);
- /*
- * XXX we don't free initial thread and its kse
- * (if thread is a bound thread), because there might
- * have some code referencing initial thread and kse.
- */
- if (td == _thr_initial) {
- DBG_MSG("Initial thread won't be freed\n");
- continue;
- }
-
- if ((td->attr.flags & PTHREAD_SCOPE_SYSTEM) != 0) {
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &kse_lock);
- kse_free_unlocked(td->kse);
- kseg_free_unlocked(td->kseg);
- KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
- _kse_critical_leave(crit);
- }
- DBG_MSG("Freeing thread %p\n", td);
- _thr_free(curthread, td);
- }
-}
-
-static void
-kse_gc(struct pthread *curthread)
-{
- kse_critical_t crit;
- TAILQ_HEAD(, kse) worklist;
- struct kse *kse;
-
- if (free_kse_count <= MAX_CACHED_KSES)
- return;
- TAILQ_INIT(&worklist);
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &kse_lock);
- while (free_kse_count > MAX_CACHED_KSES) {
- kse = TAILQ_FIRST(&free_kseq);
- TAILQ_REMOVE(&free_kseq, kse, k_qe);
- TAILQ_INSERT_HEAD(&worklist, kse, k_qe);
- free_kse_count--;
- }
- KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
- _kse_critical_leave(crit);
-
- while ((kse = TAILQ_FIRST(&worklist))) {
- TAILQ_REMOVE(&worklist, kse, k_qe);
- kse_destroy(kse);
- }
-}
-
-static void
-kseg_gc(struct pthread *curthread)
-{
- kse_critical_t crit;
- TAILQ_HEAD(, kse_group) worklist;
- struct kse_group *kseg;
-
- if (free_kseg_count <= MAX_CACHED_KSEGS)
- return;
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &kse_lock);
- while (free_kseg_count > MAX_CACHED_KSEGS) {
- kseg = TAILQ_FIRST(&free_kse_groupq);
- TAILQ_REMOVE(&free_kse_groupq, kseg, kg_qe);
- free_kseg_count--;
- TAILQ_INSERT_HEAD(&worklist, kseg, kg_qe);
- }
- KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
- _kse_critical_leave(crit);
-
- while ((kseg = TAILQ_FIRST(&worklist))) {
- TAILQ_REMOVE(&worklist, kseg, kg_qe);
- kseg_destroy(kseg);
- }
-}
-
-/*
- * Only new threads that are running or suspended may be scheduled.
- */
-int
-_thr_schedule_add(struct pthread *curthread, struct pthread *newthread)
-{
- kse_critical_t crit;
- int ret;
-
- /* Add the new thread. */
- thr_link(newthread);
-
- /*
- * If this is the first time creating a thread, make sure
- * the mailbox is set for the current thread.
- */
- if ((newthread->attr.flags & PTHREAD_SCOPE_SYSTEM) != 0) {
- /* We use the thread's stack as the KSE's stack. */
- newthread->kse->k_kcb->kcb_kmbx.km_stack.ss_sp =
- newthread->attr.stackaddr_attr;
- newthread->kse->k_kcb->kcb_kmbx.km_stack.ss_size =
- newthread->attr.stacksize_attr;
-
- /*
- * No need to lock the scheduling queue since the
- * KSE/KSEG pair have not yet been started.
- */
- KSEG_THRQ_ADD(newthread->kseg, newthread);
- /* this thread never gives up kse */
- newthread->active = 1;
- newthread->kse->k_curthread = newthread;
- newthread->kse->k_kcb->kcb_kmbx.km_flags = KMF_BOUND;
- newthread->kse->k_kcb->kcb_kmbx.km_func =
- (kse_func_t *)kse_sched_single;
- newthread->kse->k_kcb->kcb_kmbx.km_quantum = 0;
- KSE_SET_MBOX(newthread->kse, newthread);
- /*
- * This thread needs a new KSE and KSEG.
- */
- newthread->kse->k_flags &= ~KF_INITIALIZED;
- newthread->kse->k_flags |= KF_STARTED;
- /* Fire up! */
- ret = kse_create(&newthread->kse->k_kcb->kcb_kmbx, 1);
- if (ret != 0)
- ret = errno;
- }
- else {
- /*
- * Lock the KSE and add the new thread to its list of
- * assigned threads. If the new thread is runnable, also
- * add it to the KSE's run queue.
- */
- crit = _kse_critical_enter();
- KSE_SCHED_LOCK(curthread->kse, newthread->kseg);
- KSEG_THRQ_ADD(newthread->kseg, newthread);
- if (newthread->state == PS_RUNNING)
- THR_RUNQ_INSERT_TAIL(newthread);
- if ((newthread->kse->k_flags & KF_STARTED) == 0) {
- /*
- * This KSE hasn't been started yet. Start it
- * outside of holding the lock.
- */
- newthread->kse->k_flags |= KF_STARTED;
- newthread->kse->k_kcb->kcb_kmbx.km_func =
- (kse_func_t *)kse_sched_multi;
- newthread->kse->k_kcb->kcb_kmbx.km_flags = 0;
- kse_create(&newthread->kse->k_kcb->kcb_kmbx, 0);
- } else if ((newthread->state == PS_RUNNING) &&
- KSE_IS_IDLE(newthread->kse)) {
- /*
- * The thread is being scheduled on another KSEG.
- */
- kse_wakeup_one(newthread);
- }
- KSE_SCHED_UNLOCK(curthread->kse, newthread->kseg);
- _kse_critical_leave(crit);
- ret = 0;
- }
- if (ret != 0)
- thr_unlink(newthread);
-
- return (ret);
-}
-
-void
-kse_waitq_insert(struct pthread *thread)
-{
- struct pthread *td;
-
- if (thread->wakeup_time.tv_sec == -1)
- TAILQ_INSERT_TAIL(&thread->kse->k_schedq->sq_waitq, thread,
- pqe);
- else {
- td = TAILQ_FIRST(&thread->kse->k_schedq->sq_waitq);
- while ((td != NULL) && (td->wakeup_time.tv_sec != -1) &&
- ((td->wakeup_time.tv_sec < thread->wakeup_time.tv_sec) ||
- ((td->wakeup_time.tv_sec == thread->wakeup_time.tv_sec) &&
- (td->wakeup_time.tv_nsec <= thread->wakeup_time.tv_nsec))))
- td = TAILQ_NEXT(td, pqe);
- if (td == NULL)
- TAILQ_INSERT_TAIL(&thread->kse->k_schedq->sq_waitq,
- thread, pqe);
- else
- TAILQ_INSERT_BEFORE(td, thread, pqe);
- }
- thread->flags |= THR_FLAGS_IN_WAITQ;
-}
-
-/*
- * This must be called with the scheduling lock held.
- */
-static void
-kse_check_completed(struct kse *kse)
-{
- struct pthread *thread;
- struct kse_thr_mailbox *completed;
- int sig;
-
- if ((completed = kse->k_kcb->kcb_kmbx.km_completed) != NULL) {
- kse->k_kcb->kcb_kmbx.km_completed = NULL;
- while (completed != NULL) {
- thread = completed->tm_udata;
- DBG_MSG("Found completed thread %p, name %s\n",
- thread,
- (thread->name == NULL) ? "none" : thread->name);
- thread->blocked = 0;
- if (thread != kse->k_curthread) {
- thr_accounting(thread);
- if ((thread->flags & THR_FLAGS_SUSPENDED) != 0)
- THR_SET_STATE(thread, PS_SUSPENDED);
- else
- KSE_RUNQ_INSERT_TAIL(kse, thread);
- if ((thread->kse != kse) &&
- (thread->kse->k_curthread == thread)) {
- /*
- * Remove this thread from its
- * previous KSE so that it (the KSE)
- * doesn't think it is still active.
- */
- thread->kse->k_curthread = NULL;
- thread->active = 0;
- }
- }
- if ((sig = thread->tcb->tcb_tmbx.tm_syncsig.si_signo)
- != 0) {
- if (SIGISMEMBER(thread->sigmask, sig))
- SIGADDSET(thread->sigpend, sig);
- else if (THR_IN_CRITICAL(thread))
- kse_thr_interrupt(NULL, KSE_INTR_SIGEXIT, sig);
- else
- (void)_thr_sig_add(thread, sig,
- &thread->tcb->tcb_tmbx.tm_syncsig);
- thread->tcb->tcb_tmbx.tm_syncsig.si_signo = 0;
- }
- completed = completed->tm_next;
- }
- }
-}
-
-/*
- * This must be called with the scheduling lock held.
- */
-static void
-kse_check_waitq(struct kse *kse)
-{
- struct pthread *pthread;
- struct timespec ts;
-
- KSE_GET_TOD(kse, &ts);
-
- /*
- * Wake up threads that have timedout. This has to be
- * done before adding the current thread to the run queue
- * so that a CPU intensive thread doesn't get preference
- * over waiting threads.
- */
- while (((pthread = KSE_WAITQ_FIRST(kse)) != NULL) &&
- thr_timedout(pthread, &ts)) {
- /* Remove the thread from the wait queue: */
- KSE_WAITQ_REMOVE(kse, pthread);
- DBG_MSG("Found timedout thread %p in waitq\n", pthread);
-
- /* Indicate the thread timedout: */
- pthread->timeout = 1;
-
- /* Add the thread to the priority queue: */
- if ((pthread->flags & THR_FLAGS_SUSPENDED) != 0)
- THR_SET_STATE(pthread, PS_SUSPENDED);
- else {
- THR_SET_STATE(pthread, PS_RUNNING);
- KSE_RUNQ_INSERT_TAIL(kse, pthread);
- }
- }
-}
-
-static int
-thr_timedout(struct pthread *thread, struct timespec *curtime)
-{
- if (thread->wakeup_time.tv_sec < 0)
- return (0);
- else if (thread->wakeup_time.tv_sec > curtime->tv_sec)
- return (0);
- else if ((thread->wakeup_time.tv_sec == curtime->tv_sec) &&
- (thread->wakeup_time.tv_nsec > curtime->tv_nsec))
- return (0);
- else
- return (1);
-}
-
-/*
- * This must be called with the scheduling lock held.
- *
- * Each thread has a time slice, a wakeup time (used when it wants
- * to wait for a specified amount of time), a run state, and an
- * active flag.
- *
- * When a thread gets run by the scheduler, the active flag is
- * set to non-zero (1). When a thread performs an explicit yield
- * or schedules a state change, it enters the scheduler and the
- * active flag is cleared. When the active flag is still seen
- * set in the scheduler, that means that the thread is blocked in
- * the kernel (because it is cleared before entering the scheduler
- * in all other instances).
- *
- * The wakeup time is only set for those states that can timeout.
- * It is set to (-1, -1) for all other instances.
- *
- * The thread's run state, aside from being useful when debugging,
- * is used to place the thread in an appropriate queue. There
- * are 2 basic queues:
- *
- * o run queue - queue ordered by priority for all threads
- * that are runnable
- * o waiting queue - queue sorted by wakeup time for all threads
- * that are not otherwise runnable (not blocked
- * in kernel, not waiting for locks)
- *
- * The thread's time slice is used for round-robin scheduling
- * (the default scheduling policy). While a SCHED_RR thread
- * is runnable it's time slice accumulates. When it reaches
- * the time slice interval, it gets reset and added to the end
- * of the queue of threads at its priority. When a thread no
- * longer becomes runnable (blocks in kernel, waits, etc), its
- * time slice is reset.
- *
- * The job of kse_switchout_thread() is to handle all of the above.
- */
-static void
-kse_switchout_thread(struct kse *kse, struct pthread *thread)
-{
- int level;
- int i;
- int restart;
- siginfo_t siginfo;
-
- /*
- * Place the currently running thread into the
- * appropriate queue(s).
- */
- DBG_MSG("Switching out thread %p, state %d\n", thread, thread->state);
-
- THR_DEACTIVATE_LAST_LOCK(thread);
- if (thread->blocked != 0) {
- thread->active = 0;
- thread->need_switchout = 0;
- /* This thread must have blocked in the kernel. */
- /*
- * Check for pending signals and cancellation for
- * this thread to see if we need to interrupt it
- * in the kernel.
- */
- if (THR_NEED_CANCEL(thread)) {
- kse_thr_interrupt(&thread->tcb->tcb_tmbx,
- KSE_INTR_INTERRUPT, 0);
- } else if (thread->check_pending != 0) {
- for (i = 1; i <= _SIG_MAXSIG; ++i) {
- if (SIGISMEMBER(thread->sigpend, i) &&
- !SIGISMEMBER(thread->sigmask, i)) {
- restart = _thread_sigact[i - 1].sa_flags & SA_RESTART;
- kse_thr_interrupt(&thread->tcb->tcb_tmbx,
- restart ? KSE_INTR_RESTART : KSE_INTR_INTERRUPT, 0);
- break;
- }
- }
- }
- }
- else {
- switch (thread->state) {
- case PS_MUTEX_WAIT:
- case PS_COND_WAIT:
- if (THR_NEED_CANCEL(thread)) {
- thread->interrupted = 1;
- thread->continuation = _thr_finish_cancellation;
- THR_SET_STATE(thread, PS_RUNNING);
- } else {
- /* Insert into the waiting queue: */
- KSE_WAITQ_INSERT(kse, thread);
- }
- break;
-
- case PS_LOCKWAIT:
- /*
- * This state doesn't timeout.
- */
- thread->wakeup_time.tv_sec = -1;
- thread->wakeup_time.tv_nsec = -1;
- level = thread->locklevel - 1;
- if (!_LCK_GRANTED(&thread->lockusers[level]))
- KSE_WAITQ_INSERT(kse, thread);
- else
- THR_SET_STATE(thread, PS_RUNNING);
- break;
-
- case PS_SLEEP_WAIT:
- case PS_SIGWAIT:
- if (THR_NEED_CANCEL(thread)) {
- thread->interrupted = 1;
- THR_SET_STATE(thread, PS_RUNNING);
- } else {
- KSE_WAITQ_INSERT(kse, thread);
- }
- break;
-
- case PS_JOIN:
- if (THR_NEED_CANCEL(thread)) {
- thread->join_status.thread = NULL;
- THR_SET_STATE(thread, PS_RUNNING);
- } else {
- /*
- * This state doesn't timeout.
- */
- thread->wakeup_time.tv_sec = -1;
- thread->wakeup_time.tv_nsec = -1;
-
- /* Insert into the waiting queue: */
- KSE_WAITQ_INSERT(kse, thread);
- }
- break;
-
- case PS_SIGSUSPEND:
- case PS_SUSPENDED:
- if (THR_NEED_CANCEL(thread)) {
- thread->interrupted = 1;
- THR_SET_STATE(thread, PS_RUNNING);
- } else {
- /*
- * These states don't timeout.
- */
- thread->wakeup_time.tv_sec = -1;
- thread->wakeup_time.tv_nsec = -1;
-
- /* Insert into the waiting queue: */
- KSE_WAITQ_INSERT(kse, thread);
- }
- break;
-
- case PS_DEAD:
- /*
- * The scheduler is operating on a different
- * stack. It is safe to do garbage collecting
- * here.
- */
- thread->active = 0;
- thread->need_switchout = 0;
- thread->lock_switch = 0;
- thr_cleanup(kse, thread);
- return;
- break;
-
- case PS_RUNNING:
- if ((thread->flags & THR_FLAGS_SUSPENDED) != 0 &&
- !THR_NEED_CANCEL(thread))
- THR_SET_STATE(thread, PS_SUSPENDED);
- break;
-
- case PS_DEADLOCK:
- /*
- * These states don't timeout.
- */
- thread->wakeup_time.tv_sec = -1;
- thread->wakeup_time.tv_nsec = -1;
-
- /* Insert into the waiting queue: */
- KSE_WAITQ_INSERT(kse, thread);
- break;
-
- default:
- PANIC("Unknown state\n");
- break;
- }
-
- thr_accounting(thread);
- if (thread->state == PS_RUNNING) {
- if (thread->slice_usec == -1) {
- /*
- * The thread exceeded its time quantum or
- * it yielded the CPU; place it at the tail
- * of the queue for its priority.
- */
- KSE_RUNQ_INSERT_TAIL(kse, thread);
- } else {
- /*
- * The thread hasn't exceeded its interval
- * Place it at the head of the queue for its
- * priority.
- */
- KSE_RUNQ_INSERT_HEAD(kse, thread);
- }
- }
- }
- thread->active = 0;
- thread->need_switchout = 0;
- if (thread->check_pending != 0) {
- /* Install pending signals into the frame. */
- thread->check_pending = 0;
- KSE_LOCK_ACQUIRE(kse, &_thread_signal_lock);
- for (i = 1; i <= _SIG_MAXSIG; i++) {
- if (SIGISMEMBER(thread->sigmask, i))
- continue;
- if (SIGISMEMBER(thread->sigpend, i))
- (void)_thr_sig_add(thread, i,
- &thread->siginfo[i-1]);
- else if (SIGISMEMBER(_thr_proc_sigpending, i) &&
- _thr_getprocsig_unlocked(i, &siginfo)) {
- (void)_thr_sig_add(thread, i, &siginfo);
- }
- }
- KSE_LOCK_RELEASE(kse, &_thread_signal_lock);
- }
-}
-
-/*
- * This function waits for the smallest timeout value of any waiting
- * thread, or until it receives a message from another KSE.
- *
- * This must be called with the scheduling lock held.
- */
-static void
-kse_wait(struct kse *kse, struct pthread *td_wait, int sigseqno)
-{
- struct timespec ts, ts_sleep;
- int saved_flags;
-
- if ((td_wait == NULL) || (td_wait->wakeup_time.tv_sec < 0)) {
- /* Limit sleep to no more than 1 minute. */
- ts_sleep.tv_sec = 60;
- ts_sleep.tv_nsec = 0;
- } else {
- KSE_GET_TOD(kse, &ts);
- TIMESPEC_SUB(&ts_sleep, &td_wait->wakeup_time, &ts);
- if (ts_sleep.tv_sec > 60) {
- ts_sleep.tv_sec = 60;
- ts_sleep.tv_nsec = 0;
- }
- }
- /* Don't sleep for negative times. */
- if ((ts_sleep.tv_sec >= 0) && (ts_sleep.tv_nsec >= 0)) {
- KSE_SET_IDLE(kse);
- kse->k_kseg->kg_idle_kses++;
- KSE_SCHED_UNLOCK(kse, kse->k_kseg);
- if ((kse->k_kseg->kg_flags & KGF_SINGLE_THREAD) &&
- (kse->k_sigseqno != sigseqno))
- ; /* don't sleep */
- else {
- saved_flags = kse->k_kcb->kcb_kmbx.km_flags;
- kse->k_kcb->kcb_kmbx.km_flags |= KMF_NOUPCALL;
- kse_release(&ts_sleep);
- kse->k_kcb->kcb_kmbx.km_flags = saved_flags;
- }
- KSE_SCHED_LOCK(kse, kse->k_kseg);
- if (KSE_IS_IDLE(kse)) {
- KSE_CLEAR_IDLE(kse);
- kse->k_kseg->kg_idle_kses--;
- }
- }
-}
-
-/*
- * Avoid calling this kse_exit() so as not to confuse it with the
- * system call of the same name.
- */
-static void
-kse_fini(struct kse *kse)
-{
- /* struct kse_group *free_kseg = NULL; */
- struct timespec ts;
- struct pthread *td;
-
- /*
- * Check to see if this is one of the main kses.
- */
- if (kse->k_kseg != _kse_initial->k_kseg) {
- PANIC("shouldn't get here");
- /* This is for supporting thread groups. */
-#ifdef NOT_YET
- /* Remove this KSE from the KSEG's list of KSEs. */
- KSE_SCHED_LOCK(kse, kse->k_kseg);
- TAILQ_REMOVE(&kse->k_kseg->kg_kseq, kse, k_kgqe);
- kse->k_kseg->kg_ksecount--;
- if (TAILQ_EMPTY(&kse->k_kseg->kg_kseq))
- free_kseg = kse->k_kseg;
- KSE_SCHED_UNLOCK(kse, kse->k_kseg);
-
- /*
- * Add this KSE to the list of free KSEs along with
- * the KSEG if is now orphaned.
- */
- KSE_LOCK_ACQUIRE(kse, &kse_lock);
- if (free_kseg != NULL)
- kseg_free_unlocked(free_kseg);
- kse_free_unlocked(kse);
- KSE_LOCK_RELEASE(kse, &kse_lock);
- kse_exit();
- /* Never returns. */
- PANIC("kse_exit()");
-#endif
- } else {
- /*
- * We allow program to kill kse in initial group (by
- * lowering the concurrency).
- */
- if ((kse != _kse_initial) &&
- ((kse->k_flags & KF_TERMINATED) != 0)) {
- KSE_SCHED_LOCK(kse, kse->k_kseg);
- TAILQ_REMOVE(&kse->k_kseg->kg_kseq, kse, k_kgqe);
- kse->k_kseg->kg_ksecount--;
- /*
- * Migrate thread to _kse_initial if its lastest
- * kse it ran on is the kse.
- */
- td = TAILQ_FIRST(&kse->k_kseg->kg_threadq);
- while (td != NULL) {
- if (td->kse == kse)
- td->kse = _kse_initial;
- td = TAILQ_NEXT(td, kle);
- }
- KSE_SCHED_UNLOCK(kse, kse->k_kseg);
- KSE_LOCK_ACQUIRE(kse, &kse_lock);
- kse_free_unlocked(kse);
- KSE_LOCK_RELEASE(kse, &kse_lock);
- /* Make sure there is always at least one is awake */
- KSE_WAKEUP(_kse_initial);
- kse_exit();
- /* Never returns. */
- PANIC("kse_exit() failed for initial kseg");
- }
- KSE_SCHED_LOCK(kse, kse->k_kseg);
- KSE_SET_IDLE(kse);
- kse->k_kseg->kg_idle_kses++;
- KSE_SCHED_UNLOCK(kse, kse->k_kseg);
- ts.tv_sec = 120;
- ts.tv_nsec = 0;
- kse->k_kcb->kcb_kmbx.km_flags = 0;
- kse_release(&ts);
- /* Never reach */
- }
-}
-
-void
-_thr_set_timeout(const struct timespec *timeout)
-{
- struct pthread *curthread = _get_curthread();
- struct timespec ts;
-
- /* Reset the timeout flag for the running thread: */
- curthread->timeout = 0;
-
- /* Check if the thread is to wait forever: */
- if (timeout == NULL) {
- /*
- * Set the wakeup time to something that can be recognised as
- * different to an actual time of day:
- */
- curthread->wakeup_time.tv_sec = -1;
- curthread->wakeup_time.tv_nsec = -1;
- }
- /* Check if no waiting is required: */
- else if ((timeout->tv_sec == 0) && (timeout->tv_nsec == 0)) {
- /* Set the wake up time to 'immediately': */
- curthread->wakeup_time.tv_sec = 0;
- curthread->wakeup_time.tv_nsec = 0;
- } else {
- /* Calculate the time for the current thread to wakeup: */
- KSE_GET_TOD(curthread->kse, &ts);
- TIMESPEC_ADD(&curthread->wakeup_time, &ts, timeout);
- }
-}
-
-void
-_thr_panic_exit(char *file, int line, char *msg)
-{
- char buf[256];
-
- snprintf(buf, sizeof(buf), "(%s:%d) %s\n", file, line, msg);
- __sys_write(2, buf, strlen(buf));
- abort();
-}
-
-void
-_thr_setrunnable(struct pthread *curthread, struct pthread *thread)
-{
- kse_critical_t crit;
- struct kse_mailbox *kmbx;
-
- crit = _kse_critical_enter();
- KSE_SCHED_LOCK(curthread->kse, thread->kseg);
- kmbx = _thr_setrunnable_unlocked(thread);
- KSE_SCHED_UNLOCK(curthread->kse, thread->kseg);
- _kse_critical_leave(crit);
- if ((kmbx != NULL) && (__isthreaded != 0))
- kse_wakeup(kmbx);
-}
-
-struct kse_mailbox *
-_thr_setrunnable_unlocked(struct pthread *thread)
-{
- struct kse_mailbox *kmbx = NULL;
-
- if ((thread->kseg->kg_flags & KGF_SINGLE_THREAD) != 0) {
- /* No silly queues for these threads. */
- if ((thread->flags & THR_FLAGS_SUSPENDED) != 0)
- THR_SET_STATE(thread, PS_SUSPENDED);
- else {
- THR_SET_STATE(thread, PS_RUNNING);
- kmbx = kse_wakeup_one(thread);
- }
-
- } else if (thread->state != PS_RUNNING) {
- if ((thread->flags & THR_FLAGS_IN_WAITQ) != 0)
- KSE_WAITQ_REMOVE(thread->kse, thread);
- if ((thread->flags & THR_FLAGS_SUSPENDED) != 0)
- THR_SET_STATE(thread, PS_SUSPENDED);
- else {
- THR_SET_STATE(thread, PS_RUNNING);
- if ((thread->blocked == 0) && (thread->active == 0) &&
- (thread->flags & THR_FLAGS_IN_RUNQ) == 0)
- THR_RUNQ_INSERT_TAIL(thread);
- /*
- * XXX - Threads are not yet assigned to specific
- * KSEs; they are assigned to the KSEG. So
- * the fact that a thread's KSE is waiting
- * doesn't necessarily mean that it will be
- * the KSE that runs the thread after the
- * lock is granted. But we don't know if the
- * other KSEs within the same KSEG are also
- * in a waiting state or not so we err on the
- * side of caution and wakeup the thread's
- * last known KSE. We ensure that the
- * threads KSE doesn't change while it's
- * scheduling lock is held so it is safe to
- * reference it (the KSE). If the KSE wakes
- * up and doesn't find any more work it will
- * again go back to waiting so no harm is
- * done.
- */
- kmbx = kse_wakeup_one(thread);
- }
- }
- return (kmbx);
-}
-
-static struct kse_mailbox *
-kse_wakeup_one(struct pthread *thread)
-{
- struct kse *ke;
-
- if (KSE_IS_IDLE(thread->kse)) {
- KSE_CLEAR_IDLE(thread->kse);
- thread->kseg->kg_idle_kses--;
- return (&thread->kse->k_kcb->kcb_kmbx);
- } else {
- TAILQ_FOREACH(ke, &thread->kseg->kg_kseq, k_kgqe) {
- if (KSE_IS_IDLE(ke)) {
- KSE_CLEAR_IDLE(ke);
- ke->k_kseg->kg_idle_kses--;
- return (&ke->k_kcb->kcb_kmbx);
- }
- }
- }
- return (NULL);
-}
-
-static void
-kse_wakeup_multi(struct kse *curkse)
-{
- struct kse *ke;
- int tmp;
-
- if ((tmp = KSE_RUNQ_THREADS(curkse)) && curkse->k_kseg->kg_idle_kses) {
- TAILQ_FOREACH(ke, &curkse->k_kseg->kg_kseq, k_kgqe) {
- if (KSE_IS_IDLE(ke)) {
- KSE_CLEAR_IDLE(ke);
- ke->k_kseg->kg_idle_kses--;
- KSE_WAKEUP(ke);
- if (--tmp == 0)
- break;
- }
- }
- }
-}
-
-/*
- * Allocate a new KSEG.
- *
- * We allow the current thread to be NULL in the case that this
- * is the first time a KSEG is being created (library initialization).
- * In this case, we don't need to (and can't) take any locks.
- */
-struct kse_group *
-_kseg_alloc(struct pthread *curthread)
-{
- struct kse_group *kseg = NULL;
- kse_critical_t crit;
-
- if ((curthread != NULL) && (free_kseg_count > 0)) {
- /* Use the kse lock for the kseg queue. */
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &kse_lock);
- if ((kseg = TAILQ_FIRST(&free_kse_groupq)) != NULL) {
- TAILQ_REMOVE(&free_kse_groupq, kseg, kg_qe);
- free_kseg_count--;
- active_kseg_count++;
- TAILQ_INSERT_TAIL(&active_kse_groupq, kseg, kg_qe);
- }
- KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
- _kse_critical_leave(crit);
- if (kseg)
- kseg_reinit(kseg);
- }
-
- /*
- * If requested, attempt to allocate a new KSE group only if the
- * KSE allocation was successful and a KSE group wasn't found in
- * the free list.
- */
- if ((kseg == NULL) &&
- ((kseg = (struct kse_group *)malloc(sizeof(*kseg))) != NULL)) {
- if (_pq_alloc(&kseg->kg_schedq.sq_runq,
- THR_MIN_PRIORITY, THR_LAST_PRIORITY) != 0) {
- free(kseg);
- kseg = NULL;
- } else {
- kseg_init(kseg);
- /* Add the KSEG to the list of active KSEGs. */
- if (curthread != NULL) {
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &kse_lock);
- active_kseg_count++;
- TAILQ_INSERT_TAIL(&active_kse_groupq,
- kseg, kg_qe);
- KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
- _kse_critical_leave(crit);
- } else {
- active_kseg_count++;
- TAILQ_INSERT_TAIL(&active_kse_groupq,
- kseg, kg_qe);
- }
- }
- }
- return (kseg);
-}
-
-static void
-kseg_init(struct kse_group *kseg)
-{
- kseg_reinit(kseg);
- _lock_init(&kseg->kg_lock, LCK_ADAPTIVE, _kse_lock_wait,
- _kse_lock_wakeup);
-}
-
-static void
-kseg_reinit(struct kse_group *kseg)
-{
- TAILQ_INIT(&kseg->kg_kseq);
- TAILQ_INIT(&kseg->kg_threadq);
- TAILQ_INIT(&kseg->kg_schedq.sq_waitq);
- kseg->kg_threadcount = 0;
- kseg->kg_ksecount = 0;
- kseg->kg_idle_kses = 0;
- kseg->kg_flags = 0;
-}
-
-/*
- * This must be called with the kse lock held and when there are
- * no more threads that reference it.
- */
-static void
-kseg_free_unlocked(struct kse_group *kseg)
-{
- TAILQ_REMOVE(&active_kse_groupq, kseg, kg_qe);
- TAILQ_INSERT_HEAD(&free_kse_groupq, kseg, kg_qe);
- free_kseg_count++;
- active_kseg_count--;
-}
-
-void
-_kseg_free(struct kse_group *kseg)
-{
- struct kse *curkse;
- kse_critical_t crit;
-
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- KSE_LOCK_ACQUIRE(curkse, &kse_lock);
- kseg_free_unlocked(kseg);
- KSE_LOCK_RELEASE(curkse, &kse_lock);
- _kse_critical_leave(crit);
-}
-
-static void
-kseg_destroy(struct kse_group *kseg)
-{
- _lock_destroy(&kseg->kg_lock);
- _pq_free(&kseg->kg_schedq.sq_runq);
- free(kseg);
-}
-
-/*
- * Allocate a new KSE.
- *
- * We allow the current thread to be NULL in the case that this
- * is the first time a KSE is being created (library initialization).
- * In this case, we don't need to (and can't) take any locks.
- */
-struct kse *
-_kse_alloc(struct pthread *curthread, int sys_scope)
-{
- struct kse *kse = NULL;
- char *stack;
- kse_critical_t crit;
- int i;
-
- if ((curthread != NULL) && (free_kse_count > 0)) {
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &kse_lock);
- /* Search for a finished KSE. */
- kse = TAILQ_FIRST(&free_kseq);
- while ((kse != NULL) &&
- ((kse->k_kcb->kcb_kmbx.km_flags & KMF_DONE) == 0)) {
- kse = TAILQ_NEXT(kse, k_qe);
- }
- if (kse != NULL) {
- DBG_MSG("found an unused kse.\n");
- TAILQ_REMOVE(&free_kseq, kse, k_qe);
- free_kse_count--;
- TAILQ_INSERT_TAIL(&active_kseq, kse, k_qe);
- active_kse_count++;
- }
- KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
- _kse_critical_leave(crit);
- if (kse != NULL)
- kse_reinit(kse, sys_scope);
- }
- if ((kse == NULL) &&
- ((kse = (struct kse *)malloc(sizeof(*kse))) != NULL)) {
- if (sys_scope != 0)
- stack = NULL;
- else if ((stack = malloc(KSE_STACKSIZE)) == NULL) {
- free(kse);
- return (NULL);
- }
- bzero(kse, sizeof(*kse));
-
- /* Initialize KCB without the lock. */
- if ((kse->k_kcb = _kcb_ctor(kse)) == NULL) {
- if (stack != NULL)
- free(stack);
- free(kse);
- return (NULL);
- }
-
- /* Initialize the lockusers. */
- for (i = 0; i < MAX_KSE_LOCKLEVEL; i++) {
- _lockuser_init(&kse->k_lockusers[i], (void *)kse);
- _LCK_SET_PRIVATE2(&kse->k_lockusers[i], NULL);
- }
- /* _lock_init(kse->k_lock, ...) */
-
- if (curthread != NULL) {
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &kse_lock);
- }
- kse->k_flags = 0;
- TAILQ_INSERT_TAIL(&active_kseq, kse, k_qe);
- active_kse_count++;
- if (curthread != NULL) {
- KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
- _kse_critical_leave(crit);
- }
- /*
- * Create the KSE context.
- * Scope system threads (one thread per KSE) are not required
- * to have a stack for an unneeded kse upcall.
- */
- if (!sys_scope) {
- kse->k_kcb->kcb_kmbx.km_func = (kse_func_t *)kse_sched_multi;
- kse->k_stack.ss_sp = stack;
- kse->k_stack.ss_size = KSE_STACKSIZE;
- } else {
- kse->k_kcb->kcb_kmbx.km_func = (kse_func_t *)kse_sched_single;
- kse->k_stack.ss_sp = NULL;
- kse->k_stack.ss_size = 0;
- }
- kse->k_kcb->kcb_kmbx.km_udata = (void *)kse;
- kse->k_kcb->kcb_kmbx.km_quantum = 20000;
- /*
- * We need to keep a copy of the stack in case it
- * doesn't get used; a KSE running a scope system
- * thread will use that thread's stack.
- */
- kse->k_kcb->kcb_kmbx.km_stack = kse->k_stack;
- }
- return (kse);
-}
-
-static void
-kse_reinit(struct kse *kse, int sys_scope)
-{
- if (!sys_scope) {
- kse->k_kcb->kcb_kmbx.km_func = (kse_func_t *)kse_sched_multi;
- if (kse->k_stack.ss_sp == NULL) {
- /* XXX check allocation failure */
- kse->k_stack.ss_sp = (char *) malloc(KSE_STACKSIZE);
- kse->k_stack.ss_size = KSE_STACKSIZE;
- }
- kse->k_kcb->kcb_kmbx.km_quantum = 20000;
- } else {
- kse->k_kcb->kcb_kmbx.km_func = (kse_func_t *)kse_sched_single;
- if (kse->k_stack.ss_sp)
- free(kse->k_stack.ss_sp);
- kse->k_stack.ss_sp = NULL;
- kse->k_stack.ss_size = 0;
- kse->k_kcb->kcb_kmbx.km_quantum = 0;
- }
- kse->k_kcb->kcb_kmbx.km_stack = kse->k_stack;
- kse->k_kcb->kcb_kmbx.km_udata = (void *)kse;
- kse->k_kcb->kcb_kmbx.km_curthread = NULL;
- kse->k_kcb->kcb_kmbx.km_flags = 0;
- kse->k_curthread = NULL;
- kse->k_kseg = 0;
- kse->k_schedq = 0;
- kse->k_locklevel = 0;
- kse->k_flags = 0;
- kse->k_error = 0;
- kse->k_cpu = 0;
- kse->k_sigseqno = 0;
-}
-
-void
-kse_free_unlocked(struct kse *kse)
-{
- TAILQ_REMOVE(&active_kseq, kse, k_qe);
- active_kse_count--;
- kse->k_kseg = NULL;
- kse->k_kcb->kcb_kmbx.km_quantum = 20000;
- kse->k_flags = 0;
- TAILQ_INSERT_HEAD(&free_kseq, kse, k_qe);
- free_kse_count++;
-}
-
-void
-_kse_free(struct pthread *curthread, struct kse *kse)
-{
- kse_critical_t crit;
-
- if (curthread == NULL)
- kse_free_unlocked(kse);
- else {
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &kse_lock);
- kse_free_unlocked(kse);
- KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
- _kse_critical_leave(crit);
- }
-}
-
-static void
-kse_destroy(struct kse *kse)
-{
- int i;
-
- if (kse->k_stack.ss_sp != NULL)
- free(kse->k_stack.ss_sp);
- _kcb_dtor(kse->k_kcb);
- for (i = 0; i < MAX_KSE_LOCKLEVEL; ++i)
- _lockuser_destroy(&kse->k_lockusers[i]);
- _lock_destroy(&kse->k_lock);
- free(kse);
-}
-
-struct pthread *
-_thr_alloc(struct pthread *curthread)
-{
- kse_critical_t crit;
- struct pthread *thread = NULL;
- int i;
-
- if (curthread != NULL) {
- if (GC_NEEDED())
- _thr_gc(curthread);
- if (free_thread_count > 0) {
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &thread_lock);
- if ((thread = TAILQ_FIRST(&free_threadq)) != NULL) {
- TAILQ_REMOVE(&free_threadq, thread, tle);
- free_thread_count--;
- }
- KSE_LOCK_RELEASE(curthread->kse, &thread_lock);
- _kse_critical_leave(crit);
- }
- }
- if ((thread == NULL) &&
- ((thread = malloc(sizeof(struct pthread))) != NULL)) {
- bzero(thread, sizeof(struct pthread));
- if (curthread) {
- _pthread_mutex_lock(&_tcb_mutex);
- thread->tcb = _tcb_ctor(thread, 0 /* not initial tls */);
- _pthread_mutex_unlock(&_tcb_mutex);
- } else {
- thread->tcb = _tcb_ctor(thread, 1 /* initial tls */);
- }
- if (thread->tcb == NULL) {
- free(thread);
- thread = NULL;
- } else {
- thread->siginfo = calloc(_SIG_MAXSIG,
- sizeof(siginfo_t));
- /*
- * Initialize thread locking.
- * Lock initializing needs malloc, so don't
- * enter critical region before doing this!
- */
- if (_lock_init(&thread->lock, LCK_ADAPTIVE,
- _thr_lock_wait, _thr_lock_wakeup) != 0)
- PANIC("Cannot initialize thread lock");
- for (i = 0; i < MAX_THR_LOCKLEVEL; i++) {
- _lockuser_init(&thread->lockusers[i],
- (void *)thread);
- _LCK_SET_PRIVATE2(&thread->lockusers[i],
- (void *)thread);
- }
- }
- }
- return (thread);
-}
-
-void
-_thr_free(struct pthread *curthread, struct pthread *thread)
-{
- kse_critical_t crit;
-
- DBG_MSG("Freeing thread %p\n", thread);
- if (thread->name) {
- free(thread->name);
- thread->name = NULL;
- }
- if ((curthread == NULL) || (free_thread_count >= MAX_CACHED_THREADS)) {
- thr_destroy(curthread, thread);
- } else {
- /* Add the thread to the free thread list. */
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &thread_lock);
- TAILQ_INSERT_TAIL(&free_threadq, thread, tle);
- free_thread_count++;
- KSE_LOCK_RELEASE(curthread->kse, &thread_lock);
- _kse_critical_leave(crit);
- }
-}
-
-static void
-thr_destroy(struct pthread *curthread, struct pthread *thread)
-{
- int i;
-
- for (i = 0; i < MAX_THR_LOCKLEVEL; i++)
- _lockuser_destroy(&thread->lockusers[i]);
- _lock_destroy(&thread->lock);
- if (curthread) {
- _pthread_mutex_lock(&_tcb_mutex);
- _tcb_dtor(thread->tcb);
- _pthread_mutex_unlock(&_tcb_mutex);
- } else {
- _tcb_dtor(thread->tcb);
- }
- free(thread->siginfo);
- free(thread);
-}
-
-/*
- * Add an active thread:
- *
- * o Assign the thread a unique id (which GDB uses to track
- * threads.
- * o Add the thread to the list of all threads and increment
- * number of active threads.
- */
-static void
-thr_link(struct pthread *thread)
-{
- kse_critical_t crit;
- struct kse *curkse;
-
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- /*
- * Initialize the unique id (which GDB uses to track
- * threads), add the thread to the list of all threads,
- * and
- */
- thread->uniqueid = next_uniqueid++;
- THR_LIST_ADD(thread);
- _thread_active_threads++;
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- _kse_critical_leave(crit);
-}
-
-/*
- * Remove an active thread.
- */
-static void
-thr_unlink(struct pthread *thread)
-{
- kse_critical_t crit;
- struct kse *curkse;
-
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- THR_LIST_REMOVE(thread);
- _thread_active_threads--;
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- _kse_critical_leave(crit);
-}
-
-void
-_thr_hash_add(struct pthread *thread)
-{
- struct thread_hash_head *head;
-
- head = &thr_hashtable[THREAD_HASH(thread)];
- LIST_INSERT_HEAD(head, thread, hle);
-}
-
-void
-_thr_hash_remove(struct pthread *thread)
-{
- LIST_REMOVE(thread, hle);
-}
-
-struct pthread *
-_thr_hash_find(struct pthread *thread)
-{
- struct pthread *td;
- struct thread_hash_head *head;
-
- head = &thr_hashtable[THREAD_HASH(thread)];
- LIST_FOREACH(td, head, hle) {
- if (td == thread)
- return (thread);
- }
- return (NULL);
-}
-
-void
-_thr_debug_check_yield(struct pthread *curthread)
-{
- /*
- * Note that TMDF_SUSPEND is set after process is suspended.
- * When we are being debugged, every suspension in process
- * will cause all KSEs to schedule an upcall in kernel, unless the
- * KSE is in critical region.
- * If the function is being called, it means the KSE is no longer
- * in critical region, if the TMDF_SUSPEND is set by debugger
- * before KSE leaves critical region, we will catch it here, else
- * if the flag is changed during testing, it also not a problem,
- * because the change only occurs after a process suspension event
- * occurs. A suspension event will always cause KSE to schedule an
- * upcall, in the case, because we are not in critical region,
- * upcall will be scheduled sucessfully, the flag will be checked
- * again in kse_sched_multi, we won't back until the flag
- * is cleared by debugger, the flag will be cleared in next
- * suspension event.
- */
- if (!DBG_CAN_RUN(curthread)) {
- if ((curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) == 0)
- _thr_sched_switch(curthread);
- else
- kse_thr_interrupt(&curthread->tcb->tcb_tmbx,
- KSE_INTR_DBSUSPEND, 0);
- }
-}
diff --git a/lib/libkse/thread/thr_kill.c b/lib/libkse/thread/thr_kill.c
deleted file mode 100644
index 226cb86..0000000
--- a/lib/libkse/thread/thr_kill.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <signal.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_kill, pthread_kill);
-
-int
-_pthread_kill(pthread_t pthread, int sig)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- /* Check for invalid signal numbers: */
- if (sig < 0 || sig > _SIG_MAXSIG)
- /* Invalid signal: */
- ret = EINVAL;
- /*
- * Ensure the thread is in the list of active threads, and the
- * signal is valid (signal 0 specifies error checking only) and
- * not being ignored:
- */
- else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0))
- == 0) {
- if ((sig > 0) &&
- (_thread_sigact[sig - 1].sa_handler != SIG_IGN))
- _thr_sig_send(pthread, sig);
- _thr_ref_delete(curthread, pthread);
- }
-
- /* Return the completion status: */
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_main_np.c b/lib/libkse/thread/thr_main_np.c
deleted file mode 100644
index 0dacd48..0000000
--- a/lib/libkse/thread/thr_main_np.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2001 Alfred Perlstein
- * Author: Alfred Perlstein <alfred@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#include <pthread.h>
-#include <pthread_np.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_main_np, pthread_main_np);
-
-/*
- * Provide the equivelant to Solaris thr_main() function
- */
-int
-_pthread_main_np()
-{
-
- if (!_thr_initial)
- return (-1);
- else
- return (pthread_equal(pthread_self(), _thr_initial) ? 1 : 0);
-}
diff --git a/lib/libkse/thread/thr_mattr_init.c b/lib/libkse/thread/thr_mattr_init.c
deleted file mode 100644
index d5a7a18..0000000
--- a/lib/libkse/thread/thr_mattr_init.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1996 Jeffrey Hsu <hsu@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_mutexattr_init, pthread_mutexattr_init);
-
-int
-_pthread_mutexattr_init(pthread_mutexattr_t *attr)
-{
- int ret;
- pthread_mutexattr_t pattr;
-
- if ((pattr = (pthread_mutexattr_t)
- malloc(sizeof(struct pthread_mutex_attr))) == NULL) {
- ret = ENOMEM;
- } else {
- memcpy(pattr, &_pthread_mutexattr_default,
- sizeof(struct pthread_mutex_attr));
- *attr = pattr;
- ret = 0;
- }
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_mattr_kind_np.c b/lib/libkse/thread/thr_mattr_kind_np.c
deleted file mode 100644
index f3d30ff..0000000
--- a/lib/libkse/thread/thr_mattr_kind_np.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 1996 Jeffrey Hsu <hsu@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np);
-__weak_reference(_pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np);
-__weak_reference(_pthread_mutexattr_gettype, pthread_mutexattr_gettype);
-__weak_reference(_pthread_mutexattr_settype, pthread_mutexattr_settype);
-
-int
-_pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
-{
- int ret;
- if (attr == NULL || *attr == NULL) {
- errno = EINVAL;
- ret = -1;
- } else {
- (*attr)->m_type = kind;
- ret = 0;
- }
- return(ret);
-}
-
-int
-_pthread_mutexattr_getkind_np(pthread_mutexattr_t attr)
-{
- int ret;
- if (attr == NULL) {
- errno = EINVAL;
- ret = -1;
- } else {
- ret = attr->m_type;
- }
- return(ret);
-}
-
-int
-_pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
-{
- int ret;
- if (attr == NULL || *attr == NULL || type >= MUTEX_TYPE_MAX) {
- errno = EINVAL;
- ret = -1;
- } else {
- (*attr)->m_type = type;
- ret = 0;
- }
- return(ret);
-}
-
-int
-_pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type)
-{
- int ret;
-
- if (attr == NULL || *attr == NULL || (*attr)->m_type >=
- MUTEX_TYPE_MAX) {
- ret = EINVAL;
- } else {
- *type = (*attr)->m_type;
- ret = 0;
- }
- return ret;
-}
diff --git a/lib/libkse/thread/thr_msync.c b/lib/libkse/thread/thr_msync.c
deleted file mode 100644
index c2e3433..0000000
--- a/lib/libkse/thread/thr_msync.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * David Leonard <d@openbsd.org>, 1999. Public Domain.
- *
- * $OpenBSD: uthread_msync.c,v 1.2 1999/06/09 07:16:17 d Exp $
- *
- * $FreeBSD$
- */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__msync, msync);
-
-int
-__msync(void *addr, size_t len, int flags)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- /*
- * XXX This is quite pointless unless we know how to get the
- * file descriptor associated with the memory, and lock it for
- * write. The only real use of this wrapper is to guarantee
- * a cancellation point, as per the standard. sigh.
- */
- _thr_cancel_enter(curthread);
- ret = __sys_msync(addr, len, flags);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_multi_np.c b/lib/libkse/thread/thr_multi_np.c
deleted file mode 100644
index bd42365..0000000
--- a/lib/libkse/thread/thr_multi_np.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <pthread.h>
-#include <pthread_np.h>
-
-__weak_reference(_pthread_multi_np, pthread_multi_np);
-
-int
-_pthread_multi_np()
-{
-
- /* Return to multi-threaded scheduling mode: */
- /*
- * XXX - Do we want to do this?
- * __is_threaded = 1;
- */
- pthread_resume_all_np();
- return (0);
-}
diff --git a/lib/libkse/thread/thr_mutex.c b/lib/libkse/thread/thr_mutex.c
deleted file mode 100644
index b502c15..0000000
--- a/lib/libkse/thread/thr_mutex.c
+++ /dev/null
@@ -1,1817 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-#if defined(_PTHREADS_INVARIANTS)
-#define MUTEX_INIT_LINK(m) do { \
- (m)->m_qe.tqe_prev = NULL; \
- (m)->m_qe.tqe_next = NULL; \
-} while (0)
-#define MUTEX_ASSERT_IS_OWNED(m) do { \
- if ((m)->m_qe.tqe_prev == NULL) \
- PANIC("mutex is not on list"); \
-} while (0)
-#define MUTEX_ASSERT_NOT_OWNED(m) do { \
- if (((m)->m_qe.tqe_prev != NULL) || \
- ((m)->m_qe.tqe_next != NULL)) \
- PANIC("mutex is on list"); \
-} while (0)
-#define THR_ASSERT_NOT_IN_SYNCQ(thr) do { \
- THR_ASSERT(((thr)->sflags & THR_FLAGS_IN_SYNCQ) == 0, \
- "thread in syncq when it shouldn't be."); \
-} while (0);
-#else
-#define MUTEX_INIT_LINK(m)
-#define MUTEX_ASSERT_IS_OWNED(m)
-#define MUTEX_ASSERT_NOT_OWNED(m)
-#define THR_ASSERT_NOT_IN_SYNCQ(thr)
-#endif
-
-#define THR_IN_MUTEXQ(thr) (((thr)->sflags & THR_FLAGS_IN_SYNCQ) != 0)
-#define MUTEX_DESTROY(m) do { \
- _lock_destroy(&(m)->m_lock); \
- free(m); \
-} while (0)
-
-
-/*
- * Prototypes
- */
-static struct kse_mailbox *mutex_handoff(struct pthread *,
- struct pthread_mutex *);
-static inline int mutex_self_trylock(struct pthread *, pthread_mutex_t);
-static inline int mutex_self_lock(struct pthread *, pthread_mutex_t);
-static int mutex_unlock_common(pthread_mutex_t *, int);
-static void mutex_priority_adjust(struct pthread *, pthread_mutex_t);
-static void mutex_rescan_owned (struct pthread *, struct pthread *,
- struct pthread_mutex *);
-static inline pthread_t mutex_queue_deq(pthread_mutex_t);
-static inline void mutex_queue_remove(pthread_mutex_t, pthread_t);
-static inline void mutex_queue_enq(pthread_mutex_t, pthread_t);
-static void mutex_lock_backout(void *arg);
-
-static struct pthread_mutex_attr static_mutex_attr =
- PTHREAD_MUTEXATTR_STATIC_INITIALIZER;
-static pthread_mutexattr_t static_mattr = &static_mutex_attr;
-
-/* Single underscore versions provided for libc internal usage: */
-__weak_reference(__pthread_mutex_init, pthread_mutex_init);
-__weak_reference(__pthread_mutex_lock, pthread_mutex_lock);
-__weak_reference(__pthread_mutex_timedlock, pthread_mutex_timedlock);
-__weak_reference(__pthread_mutex_trylock, pthread_mutex_trylock);
-
-/* No difference between libc and application usage of these: */
-__weak_reference(_pthread_mutex_destroy, pthread_mutex_destroy);
-__weak_reference(_pthread_mutex_unlock, pthread_mutex_unlock);
-
-
-
-int
-__pthread_mutex_init(pthread_mutex_t *mutex,
- const pthread_mutexattr_t *mutex_attr)
-{
- struct pthread_mutex *pmutex;
- enum pthread_mutextype type;
- int protocol;
- int ceiling;
- int flags;
- int ret = 0;
-
- if (mutex == NULL)
- ret = EINVAL;
-
- /* Check if default mutex attributes: */
- else if (mutex_attr == NULL || *mutex_attr == NULL) {
- /* Default to a (error checking) POSIX mutex: */
- type = PTHREAD_MUTEX_ERRORCHECK;
- protocol = PTHREAD_PRIO_NONE;
- ceiling = THR_MAX_PRIORITY;
- flags = 0;
- }
-
- /* Check mutex type: */
- else if (((*mutex_attr)->m_type < PTHREAD_MUTEX_ERRORCHECK) ||
- ((*mutex_attr)->m_type >= MUTEX_TYPE_MAX))
- /* Return an invalid argument error: */
- ret = EINVAL;
-
- /* Check mutex protocol: */
- else if (((*mutex_attr)->m_protocol < PTHREAD_PRIO_NONE) ||
- ((*mutex_attr)->m_protocol > PTHREAD_MUTEX_RECURSIVE))
- /* Return an invalid argument error: */
- ret = EINVAL;
-
- else {
- /* Use the requested mutex type and protocol: */
- type = (*mutex_attr)->m_type;
- protocol = (*mutex_attr)->m_protocol;
- ceiling = (*mutex_attr)->m_ceiling;
- flags = (*mutex_attr)->m_flags;
- }
-
- /* Check no errors so far: */
- if (ret == 0) {
- if ((pmutex = (pthread_mutex_t)
- malloc(sizeof(struct pthread_mutex))) == NULL)
- ret = ENOMEM;
- else if (_lock_init(&pmutex->m_lock, LCK_ADAPTIVE,
- _thr_lock_wait, _thr_lock_wakeup) != 0) {
- free(pmutex);
- *mutex = NULL;
- ret = ENOMEM;
- } else {
- /* Set the mutex flags: */
- pmutex->m_flags = flags;
-
- /* Process according to mutex type: */
- switch (type) {
- /* case PTHREAD_MUTEX_DEFAULT: */
- case PTHREAD_MUTEX_ERRORCHECK:
- case PTHREAD_MUTEX_NORMAL:
- /* Nothing to do here. */
- break;
-
- /* Single UNIX Spec 2 recursive mutex: */
- case PTHREAD_MUTEX_RECURSIVE:
- /* Reset the mutex count: */
- pmutex->m_count = 0;
- break;
-
- /* Trap invalid mutex types: */
- default:
- /* Return an invalid argument error: */
- ret = EINVAL;
- break;
- }
- if (ret == 0) {
- /* Initialise the rest of the mutex: */
- TAILQ_INIT(&pmutex->m_queue);
- pmutex->m_flags |= MUTEX_FLAGS_INITED;
- pmutex->m_owner = NULL;
- pmutex->m_type = type;
- pmutex->m_protocol = protocol;
- pmutex->m_refcount = 0;
- if (protocol == PTHREAD_PRIO_PROTECT)
- pmutex->m_prio = ceiling;
- else
- pmutex->m_prio = -1;
- pmutex->m_saved_prio = 0;
- MUTEX_INIT_LINK(pmutex);
- *mutex = pmutex;
- } else {
- /* Free the mutex lock structure: */
- MUTEX_DESTROY(pmutex);
- *mutex = NULL;
- }
- }
- }
- /* Return the completion status: */
- return (ret);
-}
-
-int
-_pthread_mutex_init(pthread_mutex_t *mutex,
- const pthread_mutexattr_t *mutex_attr)
-{
- struct pthread_mutex_attr mattr, *mattrp;
-
- if ((mutex_attr == NULL) || (*mutex_attr == NULL))
- return (__pthread_mutex_init(mutex, &static_mattr));
- else {
- mattr = **mutex_attr;
- mattr.m_flags |= MUTEX_FLAGS_PRIVATE;
- mattrp = &mattr;
- return (__pthread_mutex_init(mutex, &mattrp));
- }
-}
-
-void
-_thr_mutex_reinit(pthread_mutex_t *mutex)
-{
- _lock_reinit(&(*mutex)->m_lock, LCK_ADAPTIVE,
- _thr_lock_wait, _thr_lock_wakeup);
- TAILQ_INIT(&(*mutex)->m_queue);
- (*mutex)->m_owner = NULL;
- (*mutex)->m_count = 0;
- (*mutex)->m_refcount = 0;
- (*mutex)->m_prio = 0;
- (*mutex)->m_saved_prio = 0;
-}
-
-int
-_pthread_mutex_destroy(pthread_mutex_t *mutex)
-{
- struct pthread *curthread = _get_curthread();
- pthread_mutex_t m;
- int ret = 0;
-
- if (mutex == NULL || *mutex == NULL)
- ret = EINVAL;
- else {
- /* Lock the mutex structure: */
- THR_LOCK_ACQUIRE(curthread, &(*mutex)->m_lock);
-
- /*
- * Check to see if this mutex is in use:
- */
- if (((*mutex)->m_owner != NULL) ||
- (TAILQ_FIRST(&(*mutex)->m_queue) != NULL) ||
- ((*mutex)->m_refcount != 0)) {
- ret = EBUSY;
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*mutex)->m_lock);
- } else {
- /*
- * Save a pointer to the mutex so it can be free'd
- * and set the caller's pointer to NULL:
- */
- m = *mutex;
- *mutex = NULL;
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &m->m_lock);
-
- /*
- * Free the memory allocated for the mutex
- * structure:
- */
- MUTEX_ASSERT_NOT_OWNED(m);
- MUTEX_DESTROY(m);
- }
- }
-
- /* Return the completion status: */
- return (ret);
-}
-
-static int
-init_static(struct pthread *thread, pthread_mutex_t *mutex)
-{
- int ret;
-
- THR_LOCK_ACQUIRE(thread, &_mutex_static_lock);
-
- if (*mutex == NULL)
- ret = pthread_mutex_init(mutex, NULL);
- else
- ret = 0;
-
- THR_LOCK_RELEASE(thread, &_mutex_static_lock);
-
- return (ret);
-}
-
-static int
-init_static_private(struct pthread *thread, pthread_mutex_t *mutex)
-{
- int ret;
-
- THR_LOCK_ACQUIRE(thread, &_mutex_static_lock);
-
- if (*mutex == NULL)
- ret = pthread_mutex_init(mutex, &static_mattr);
- else
- ret = 0;
-
- THR_LOCK_RELEASE(thread, &_mutex_static_lock);
-
- return (ret);
-}
-
-static int
-mutex_trylock_common(struct pthread *curthread, pthread_mutex_t *mutex)
-{
- int private;
- int ret = 0;
-
- THR_ASSERT((mutex != NULL) && (*mutex != NULL),
- "Uninitialized mutex in pthread_mutex_trylock_basic");
-
- /* Lock the mutex structure: */
- THR_LOCK_ACQUIRE(curthread, &(*mutex)->m_lock);
- private = (*mutex)->m_flags & MUTEX_FLAGS_PRIVATE;
-
- /*
- * If the mutex was statically allocated, properly
- * initialize the tail queue.
- */
- if (((*mutex)->m_flags & MUTEX_FLAGS_INITED) == 0) {
- TAILQ_INIT(&(*mutex)->m_queue);
- MUTEX_INIT_LINK(*mutex);
- (*mutex)->m_flags |= MUTEX_FLAGS_INITED;
- }
-
- /* Process according to mutex type: */
- switch ((*mutex)->m_protocol) {
- /* Default POSIX mutex: */
- case PTHREAD_PRIO_NONE:
- /* Check if this mutex is not locked: */
- if ((*mutex)->m_owner == NULL) {
- /* Lock the mutex for the running thread: */
- (*mutex)->m_owner = curthread;
-
- /* Add to the list of owned mutexes: */
- MUTEX_ASSERT_NOT_OWNED(*mutex);
- TAILQ_INSERT_TAIL(&curthread->mutexq,
- (*mutex), m_qe);
- } else if ((*mutex)->m_owner == curthread)
- ret = mutex_self_trylock(curthread, *mutex);
- else
- /* Return a busy error: */
- ret = EBUSY;
- break;
-
- /* POSIX priority inheritence mutex: */
- case PTHREAD_PRIO_INHERIT:
- /* Check if this mutex is not locked: */
- if ((*mutex)->m_owner == NULL) {
- /* Lock the mutex for the running thread: */
- (*mutex)->m_owner = curthread;
-
- THR_SCHED_LOCK(curthread, curthread);
- /* Track number of priority mutexes owned: */
- curthread->priority_mutex_count++;
-
- /*
- * The mutex takes on the attributes of the
- * running thread when there are no waiters.
- */
- (*mutex)->m_prio = curthread->active_priority;
- (*mutex)->m_saved_prio =
- curthread->inherited_priority;
- curthread->inherited_priority = (*mutex)->m_prio;
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Add to the list of owned mutexes: */
- MUTEX_ASSERT_NOT_OWNED(*mutex);
- TAILQ_INSERT_TAIL(&curthread->mutexq,
- (*mutex), m_qe);
- } else if ((*mutex)->m_owner == curthread)
- ret = mutex_self_trylock(curthread, *mutex);
- else
- /* Return a busy error: */
- ret = EBUSY;
- break;
-
- /* POSIX priority protection mutex: */
- case PTHREAD_PRIO_PROTECT:
- /* Check for a priority ceiling violation: */
- if (curthread->active_priority > (*mutex)->m_prio)
- ret = EINVAL;
-
- /* Check if this mutex is not locked: */
- else if ((*mutex)->m_owner == NULL) {
- /* Lock the mutex for the running thread: */
- (*mutex)->m_owner = curthread;
-
- THR_SCHED_LOCK(curthread, curthread);
- /* Track number of priority mutexes owned: */
- curthread->priority_mutex_count++;
-
- /*
- * The running thread inherits the ceiling
- * priority of the mutex and executes at that
- * priority.
- */
- curthread->active_priority = (*mutex)->m_prio;
- (*mutex)->m_saved_prio =
- curthread->inherited_priority;
- curthread->inherited_priority =
- (*mutex)->m_prio;
- THR_SCHED_UNLOCK(curthread, curthread);
- /* Add to the list of owned mutexes: */
- MUTEX_ASSERT_NOT_OWNED(*mutex);
- TAILQ_INSERT_TAIL(&curthread->mutexq,
- (*mutex), m_qe);
- } else if ((*mutex)->m_owner == curthread)
- ret = mutex_self_trylock(curthread, *mutex);
- else
- /* Return a busy error: */
- ret = EBUSY;
- break;
-
- /* Trap invalid mutex types: */
- default:
- /* Return an invalid argument error: */
- ret = EINVAL;
- break;
- }
-
- if (ret == 0 && private)
- THR_CRITICAL_ENTER(curthread);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*mutex)->m_lock);
-
- /* Return the completion status: */
- return (ret);
-}
-
-int
-__pthread_mutex_trylock(pthread_mutex_t *mutex)
-{
- struct pthread *curthread = _get_curthread();
- int ret = 0;
-
- if (mutex == NULL)
- ret = EINVAL;
-
- /*
- * If the mutex is statically initialized, perform the dynamic
- * initialization:
- */
- else if ((*mutex != NULL) ||
- ((ret = init_static(curthread, mutex)) == 0))
- ret = mutex_trylock_common(curthread, mutex);
-
- return (ret);
-}
-
-int
-_pthread_mutex_trylock(pthread_mutex_t *mutex)
-{
- struct pthread *curthread = _get_curthread();
- int ret = 0;
-
- if (mutex == NULL)
- ret = EINVAL;
-
- /*
- * If the mutex is statically initialized, perform the dynamic
- * initialization marking the mutex private (delete safe):
- */
- else if ((*mutex != NULL) ||
- ((ret = init_static_private(curthread, mutex)) == 0))
- ret = mutex_trylock_common(curthread, mutex);
-
- return (ret);
-}
-
-static int
-mutex_lock_common(struct pthread *curthread, pthread_mutex_t *m,
- const struct timespec * abstime)
-{
- int private;
- int ret = 0;
-
- THR_ASSERT((m != NULL) && (*m != NULL),
- "Uninitialized mutex in pthread_mutex_trylock_basic");
-
- if (abstime != NULL && (abstime->tv_sec < 0 || abstime->tv_nsec < 0 ||
- abstime->tv_nsec >= 1000000000))
- return (EINVAL);
-
- /* Reset the interrupted flag: */
- curthread->interrupted = 0;
- curthread->timeout = 0;
- curthread->wakeup_time.tv_sec = -1;
-
- private = (*m)->m_flags & MUTEX_FLAGS_PRIVATE;
-
- /*
- * Enter a loop waiting to become the mutex owner. We need a
- * loop in case the waiting thread is interrupted by a signal
- * to execute a signal handler. It is not (currently) possible
- * to remain in the waiting queue while running a handler.
- * Instead, the thread is interrupted and backed out of the
- * waiting queue prior to executing the signal handler.
- */
- do {
- /* Lock the mutex structure: */
- THR_LOCK_ACQUIRE(curthread, &(*m)->m_lock);
-
- /*
- * If the mutex was statically allocated, properly
- * initialize the tail queue.
- */
- if (((*m)->m_flags & MUTEX_FLAGS_INITED) == 0) {
- TAILQ_INIT(&(*m)->m_queue);
- (*m)->m_flags |= MUTEX_FLAGS_INITED;
- MUTEX_INIT_LINK(*m);
- }
-
- /* Process according to mutex type: */
- switch ((*m)->m_protocol) {
- /* Default POSIX mutex: */
- case PTHREAD_PRIO_NONE:
- if ((*m)->m_owner == NULL) {
- /* Lock the mutex for this thread: */
- (*m)->m_owner = curthread;
-
- /* Add to the list of owned mutexes: */
- MUTEX_ASSERT_NOT_OWNED(*m);
- TAILQ_INSERT_TAIL(&curthread->mutexq,
- (*m), m_qe);
- if (private)
- THR_CRITICAL_ENTER(curthread);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- } else if ((*m)->m_owner == curthread) {
- ret = mutex_self_lock(curthread, *m);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- } else {
- /* Set the wakeup time: */
- if (abstime) {
- curthread->wakeup_time.tv_sec =
- abstime->tv_sec;
- curthread->wakeup_time.tv_nsec =
- abstime->tv_nsec;
- }
-
- /*
- * Join the queue of threads waiting to lock
- * the mutex and save a pointer to the mutex.
- */
- mutex_queue_enq(*m, curthread);
- curthread->data.mutex = *m;
- curthread->sigbackout = mutex_lock_backout;
- /*
- * This thread is active and is in a critical
- * region (holding the mutex lock); we should
- * be able to safely set the state.
- */
- THR_SCHED_LOCK(curthread, curthread);
- THR_SET_STATE(curthread, PS_MUTEX_WAIT);
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
-
- /* Schedule the next thread: */
- _thr_sched_switch(curthread);
-
- if (THR_IN_MUTEXQ(curthread)) {
- THR_LOCK_ACQUIRE(curthread, &(*m)->m_lock);
- mutex_queue_remove(*m, curthread);
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- }
- /*
- * Only clear these after assuring the
- * thread is dequeued.
- */
- curthread->data.mutex = NULL;
- curthread->sigbackout = NULL;
- }
- break;
-
- /* POSIX priority inheritence mutex: */
- case PTHREAD_PRIO_INHERIT:
- /* Check if this mutex is not locked: */
- if ((*m)->m_owner == NULL) {
- /* Lock the mutex for this thread: */
- (*m)->m_owner = curthread;
-
- THR_SCHED_LOCK(curthread, curthread);
- /* Track number of priority mutexes owned: */
- curthread->priority_mutex_count++;
-
- /*
- * The mutex takes on attributes of the
- * running thread when there are no waiters.
- * Make sure the thread's scheduling lock is
- * held while priorities are adjusted.
- */
- (*m)->m_prio = curthread->active_priority;
- (*m)->m_saved_prio =
- curthread->inherited_priority;
- curthread->inherited_priority = (*m)->m_prio;
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Add to the list of owned mutexes: */
- MUTEX_ASSERT_NOT_OWNED(*m);
- TAILQ_INSERT_TAIL(&curthread->mutexq,
- (*m), m_qe);
- if (private)
- THR_CRITICAL_ENTER(curthread);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- } else if ((*m)->m_owner == curthread) {
- ret = mutex_self_lock(curthread, *m);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- } else {
- /* Set the wakeup time: */
- if (abstime) {
- curthread->wakeup_time.tv_sec =
- abstime->tv_sec;
- curthread->wakeup_time.tv_nsec =
- abstime->tv_nsec;
- }
-
- /*
- * Join the queue of threads waiting to lock
- * the mutex and save a pointer to the mutex.
- */
- mutex_queue_enq(*m, curthread);
- curthread->data.mutex = *m;
- curthread->sigbackout = mutex_lock_backout;
-
- /*
- * This thread is active and is in a critical
- * region (holding the mutex lock); we should
- * be able to safely set the state.
- */
- if (curthread->active_priority > (*m)->m_prio)
- /* Adjust priorities: */
- mutex_priority_adjust(curthread, *m);
-
- THR_SCHED_LOCK(curthread, curthread);
- THR_SET_STATE(curthread, PS_MUTEX_WAIT);
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
-
- /* Schedule the next thread: */
- _thr_sched_switch(curthread);
-
- if (THR_IN_MUTEXQ(curthread)) {
- THR_LOCK_ACQUIRE(curthread, &(*m)->m_lock);
- mutex_queue_remove(*m, curthread);
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- }
- /*
- * Only clear these after assuring the
- * thread is dequeued.
- */
- curthread->data.mutex = NULL;
- curthread->sigbackout = NULL;
- }
- break;
-
- /* POSIX priority protection mutex: */
- case PTHREAD_PRIO_PROTECT:
- /* Check for a priority ceiling violation: */
- if (curthread->active_priority > (*m)->m_prio) {
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- ret = EINVAL;
- }
- /* Check if this mutex is not locked: */
- else if ((*m)->m_owner == NULL) {
- /*
- * Lock the mutex for the running
- * thread:
- */
- (*m)->m_owner = curthread;
-
- THR_SCHED_LOCK(curthread, curthread);
- /* Track number of priority mutexes owned: */
- curthread->priority_mutex_count++;
-
- /*
- * The running thread inherits the ceiling
- * priority of the mutex and executes at that
- * priority. Make sure the thread's
- * scheduling lock is held while priorities
- * are adjusted.
- */
- curthread->active_priority = (*m)->m_prio;
- (*m)->m_saved_prio =
- curthread->inherited_priority;
- curthread->inherited_priority = (*m)->m_prio;
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Add to the list of owned mutexes: */
- MUTEX_ASSERT_NOT_OWNED(*m);
- TAILQ_INSERT_TAIL(&curthread->mutexq,
- (*m), m_qe);
- if (private)
- THR_CRITICAL_ENTER(curthread);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- } else if ((*m)->m_owner == curthread) {
- ret = mutex_self_lock(curthread, *m);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- } else {
- /* Set the wakeup time: */
- if (abstime) {
- curthread->wakeup_time.tv_sec =
- abstime->tv_sec;
- curthread->wakeup_time.tv_nsec =
- abstime->tv_nsec;
- }
-
- /*
- * Join the queue of threads waiting to lock
- * the mutex and save a pointer to the mutex.
- */
- mutex_queue_enq(*m, curthread);
- curthread->data.mutex = *m;
- curthread->sigbackout = mutex_lock_backout;
-
- /* Clear any previous error: */
- curthread->error = 0;
-
- /*
- * This thread is active and is in a critical
- * region (holding the mutex lock); we should
- * be able to safely set the state.
- */
-
- THR_SCHED_LOCK(curthread, curthread);
- THR_SET_STATE(curthread, PS_MUTEX_WAIT);
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
-
- /* Schedule the next thread: */
- _thr_sched_switch(curthread);
-
- if (THR_IN_MUTEXQ(curthread)) {
- THR_LOCK_ACQUIRE(curthread, &(*m)->m_lock);
- mutex_queue_remove(*m, curthread);
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- }
- /*
- * Only clear these after assuring the
- * thread is dequeued.
- */
- curthread->data.mutex = NULL;
- curthread->sigbackout = NULL;
-
- /*
- * The threads priority may have changed while
- * waiting for the mutex causing a ceiling
- * violation.
- */
- ret = curthread->error;
- curthread->error = 0;
- }
- break;
-
- /* Trap invalid mutex types: */
- default:
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
-
- /* Return an invalid argument error: */
- ret = EINVAL;
- break;
- }
-
- } while (((*m)->m_owner != curthread) && (ret == 0) &&
- (curthread->interrupted == 0) && (curthread->timeout == 0));
-
- if (ret == 0 && (*m)->m_owner != curthread && curthread->timeout)
- ret = ETIMEDOUT;
-
- /*
- * Check to see if this thread was interrupted and
- * is still in the mutex queue of waiting threads:
- */
- if (curthread->interrupted != 0) {
- /* Remove this thread from the mutex queue. */
- THR_LOCK_ACQUIRE(curthread, &(*m)->m_lock);
- if (THR_IN_SYNCQ(curthread))
- mutex_queue_remove(*m, curthread);
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
-
- /* Check for asynchronous cancellation. */
- if (curthread->continuation != NULL)
- curthread->continuation((void *) curthread);
- }
-
- /* Return the completion status: */
- return (ret);
-}
-
-int
-__pthread_mutex_lock(pthread_mutex_t *m)
-{
- struct pthread *curthread;
- int ret = 0;
-
- if (_thr_initial == NULL)
- _libpthread_init(NULL);
-
- curthread = _get_curthread();
- if (m == NULL)
- ret = EINVAL;
-
- /*
- * If the mutex is statically initialized, perform the dynamic
- * initialization:
- */
- else if ((*m != NULL) || ((ret = init_static(curthread, m)) == 0))
- ret = mutex_lock_common(curthread, m, NULL);
-
- return (ret);
-}
-
-__strong_reference(__pthread_mutex_lock, _thr_mutex_lock);
-
-int
-_pthread_mutex_lock(pthread_mutex_t *m)
-{
- struct pthread *curthread;
- int ret = 0;
-
- if (_thr_initial == NULL)
- _libpthread_init(NULL);
- curthread = _get_curthread();
-
- if (m == NULL)
- ret = EINVAL;
-
- /*
- * If the mutex is statically initialized, perform the dynamic
- * initialization marking it private (delete safe):
- */
- else if ((*m != NULL) ||
- ((ret = init_static_private(curthread, m)) == 0))
- ret = mutex_lock_common(curthread, m, NULL);
-
- return (ret);
-}
-
-int
-__pthread_mutex_timedlock(pthread_mutex_t *m,
- const struct timespec *abs_timeout)
-{
- struct pthread *curthread;
- int ret = 0;
-
- if (_thr_initial == NULL)
- _libpthread_init(NULL);
-
- curthread = _get_curthread();
- if (m == NULL)
- ret = EINVAL;
-
- /*
- * If the mutex is statically initialized, perform the dynamic
- * initialization:
- */
- else if ((*m != NULL) || ((ret = init_static(curthread, m)) == 0))
- ret = mutex_lock_common(curthread, m, abs_timeout);
-
- return (ret);
-}
-
-int
-_pthread_mutex_timedlock(pthread_mutex_t *m,
- const struct timespec *abs_timeout)
-{
- struct pthread *curthread;
- int ret = 0;
-
- if (_thr_initial == NULL)
- _libpthread_init(NULL);
- curthread = _get_curthread();
-
- if (m == NULL)
- ret = EINVAL;
-
- /*
- * If the mutex is statically initialized, perform the dynamic
- * initialization marking it private (delete safe):
- */
- else if ((*m != NULL) ||
- ((ret = init_static_private(curthread, m)) == 0))
- ret = mutex_lock_common(curthread, m, abs_timeout);
-
- return (ret);
-}
-
-int
-_pthread_mutex_unlock(pthread_mutex_t *m)
-{
- return (mutex_unlock_common(m, /* add reference */ 0));
-}
-
-__strong_reference(_pthread_mutex_unlock, _thr_mutex_unlock);
-
-int
-_mutex_cv_unlock(pthread_mutex_t *m)
-{
- return (mutex_unlock_common(m, /* add reference */ 1));
-}
-
-int
-_mutex_cv_lock(pthread_mutex_t *m)
-{
- struct pthread *curthread;
- int ret;
-
- curthread = _get_curthread();
- if ((ret = _pthread_mutex_lock(m)) == 0) {
- THR_LOCK_ACQUIRE(curthread, &(*m)->m_lock);
- (*m)->m_refcount--;
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
- }
- return (ret);
-}
-
-static inline int
-mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m)
-{
- int ret = 0;
-
- switch (m->m_type) {
- /* case PTHREAD_MUTEX_DEFAULT: */
- case PTHREAD_MUTEX_ERRORCHECK:
- case PTHREAD_MUTEX_NORMAL:
- ret = EBUSY;
- break;
-
- case PTHREAD_MUTEX_RECURSIVE:
- /* Increment the lock count: */
- m->m_count++;
- break;
-
- default:
- /* Trap invalid mutex types; */
- ret = EINVAL;
- }
-
- return (ret);
-}
-
-static inline int
-mutex_self_lock(struct pthread *curthread, pthread_mutex_t m)
-{
- int ret = 0;
-
- /*
- * Don't allow evil recursive mutexes for private use
- * in libc and libpthread.
- */
- if (m->m_flags & MUTEX_FLAGS_PRIVATE)
- PANIC("Recurse on a private mutex.");
-
- switch (m->m_type) {
- /* case PTHREAD_MUTEX_DEFAULT: */
- case PTHREAD_MUTEX_ERRORCHECK:
- /*
- * POSIX specifies that mutexes should return EDEADLK if a
- * recursive lock is detected.
- */
- ret = EDEADLK;
- break;
-
- case PTHREAD_MUTEX_NORMAL:
- /*
- * What SS2 define as a 'normal' mutex. Intentionally
- * deadlock on attempts to get a lock you already own.
- */
-
- THR_SCHED_LOCK(curthread, curthread);
- THR_SET_STATE(curthread, PS_DEADLOCK);
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &m->m_lock);
-
- /* Schedule the next thread: */
- _thr_sched_switch(curthread);
- break;
-
- case PTHREAD_MUTEX_RECURSIVE:
- /* Increment the lock count: */
- m->m_count++;
- break;
-
- default:
- /* Trap invalid mutex types; */
- ret = EINVAL;
- }
-
- return (ret);
-}
-
-static int
-mutex_unlock_common(pthread_mutex_t *m, int add_reference)
-{
- struct pthread *curthread = _get_curthread();
- struct kse_mailbox *kmbx = NULL;
- int ret = 0;
-
- if (m == NULL || *m == NULL)
- ret = EINVAL;
- else {
- /* Lock the mutex structure: */
- THR_LOCK_ACQUIRE(curthread, &(*m)->m_lock);
-
- /* Process according to mutex type: */
- switch ((*m)->m_protocol) {
- /* Default POSIX mutex: */
- case PTHREAD_PRIO_NONE:
- /*
- * Check if the running thread is not the owner of the
- * mutex:
- */
- if ((*m)->m_owner != curthread)
- ret = EPERM;
- else if (((*m)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
- ((*m)->m_count > 0))
- /* Decrement the count: */
- (*m)->m_count--;
- else {
- /*
- * Clear the count in case this is a recursive
- * mutex.
- */
- (*m)->m_count = 0;
-
- /* Remove the mutex from the threads queue. */
- MUTEX_ASSERT_IS_OWNED(*m);
- TAILQ_REMOVE(&(*m)->m_owner->mutexq,
- (*m), m_qe);
- MUTEX_INIT_LINK(*m);
-
- /*
- * Hand off the mutex to the next waiting
- * thread:
- */
- kmbx = mutex_handoff(curthread, *m);
- }
- break;
-
- /* POSIX priority inheritence mutex: */
- case PTHREAD_PRIO_INHERIT:
- /*
- * Check if the running thread is not the owner of the
- * mutex:
- */
- if ((*m)->m_owner != curthread)
- ret = EPERM;
- else if (((*m)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
- ((*m)->m_count > 0))
- /* Decrement the count: */
- (*m)->m_count--;
- else {
- /*
- * Clear the count in case this is recursive
- * mutex.
- */
- (*m)->m_count = 0;
-
- /*
- * Restore the threads inherited priority and
- * recompute the active priority (being careful
- * not to override changes in the threads base
- * priority subsequent to locking the mutex).
- */
- THR_SCHED_LOCK(curthread, curthread);
- curthread->inherited_priority =
- (*m)->m_saved_prio;
- curthread->active_priority =
- MAX(curthread->inherited_priority,
- curthread->base_priority);
-
- /*
- * This thread now owns one less priority mutex.
- */
- curthread->priority_mutex_count--;
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Remove the mutex from the threads queue. */
- MUTEX_ASSERT_IS_OWNED(*m);
- TAILQ_REMOVE(&(*m)->m_owner->mutexq,
- (*m), m_qe);
- MUTEX_INIT_LINK(*m);
-
- /*
- * Hand off the mutex to the next waiting
- * thread:
- */
- kmbx = mutex_handoff(curthread, *m);
- }
- break;
-
- /* POSIX priority ceiling mutex: */
- case PTHREAD_PRIO_PROTECT:
- /*
- * Check if the running thread is not the owner of the
- * mutex:
- */
- if ((*m)->m_owner != curthread)
- ret = EPERM;
- else if (((*m)->m_type == PTHREAD_MUTEX_RECURSIVE) &&
- ((*m)->m_count > 0))
- /* Decrement the count: */
- (*m)->m_count--;
- else {
- /*
- * Clear the count in case this is a recursive
- * mutex.
- */
- (*m)->m_count = 0;
-
- /*
- * Restore the threads inherited priority and
- * recompute the active priority (being careful
- * not to override changes in the threads base
- * priority subsequent to locking the mutex).
- */
- THR_SCHED_LOCK(curthread, curthread);
- curthread->inherited_priority =
- (*m)->m_saved_prio;
- curthread->active_priority =
- MAX(curthread->inherited_priority,
- curthread->base_priority);
-
- /*
- * This thread now owns one less priority mutex.
- */
- curthread->priority_mutex_count--;
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /* Remove the mutex from the threads queue. */
- MUTEX_ASSERT_IS_OWNED(*m);
- TAILQ_REMOVE(&(*m)->m_owner->mutexq,
- (*m), m_qe);
- MUTEX_INIT_LINK(*m);
-
- /*
- * Hand off the mutex to the next waiting
- * thread:
- */
- kmbx = mutex_handoff(curthread, *m);
- }
- break;
-
- /* Trap invalid mutex types: */
- default:
- /* Return an invalid argument error: */
- ret = EINVAL;
- break;
- }
-
- if ((ret == 0) && (add_reference != 0))
- /* Increment the reference count: */
- (*m)->m_refcount++;
-
- /* Leave the critical region if this is a private mutex. */
- if ((ret == 0) && ((*m)->m_flags & MUTEX_FLAGS_PRIVATE))
- THR_CRITICAL_LEAVE(curthread);
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
-
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- }
-
- /* Return the completion status: */
- return (ret);
-}
-
-
-/*
- * This function is called when a change in base priority occurs for
- * a thread that is holding or waiting for a priority protection or
- * inheritence mutex. A change in a threads base priority can effect
- * changes to active priorities of other threads and to the ordering
- * of mutex locking by waiting threads.
- *
- * This must be called without the target thread's scheduling lock held.
- */
-void
-_mutex_notify_priochange(struct pthread *curthread, struct pthread *pthread,
- int propagate_prio)
-{
- struct pthread_mutex *m;
-
- /* Adjust the priorites of any owned priority mutexes: */
- if (pthread->priority_mutex_count > 0) {
- /*
- * Rescan the mutexes owned by this thread and correct
- * their priorities to account for this threads change
- * in priority. This has the side effect of changing
- * the threads active priority.
- *
- * Be sure to lock the first mutex in the list of owned
- * mutexes. This acts as a barrier against another
- * simultaneous call to change the threads priority
- * and from the owning thread releasing the mutex.
- */
- m = TAILQ_FIRST(&pthread->mutexq);
- if (m != NULL) {
- THR_LOCK_ACQUIRE(curthread, &m->m_lock);
- /*
- * Make sure the thread still owns the lock.
- */
- if (m == TAILQ_FIRST(&pthread->mutexq))
- mutex_rescan_owned(curthread, pthread,
- /* rescan all owned */ NULL);
- THR_LOCK_RELEASE(curthread, &m->m_lock);
- }
- }
-
- /*
- * If this thread is waiting on a priority inheritence mutex,
- * check for priority adjustments. A change in priority can
- * also cause a ceiling violation(*) for a thread waiting on
- * a priority protection mutex; we don't perform the check here
- * as it is done in pthread_mutex_unlock.
- *
- * (*) It should be noted that a priority change to a thread
- * _after_ taking and owning a priority ceiling mutex
- * does not affect ownership of that mutex; the ceiling
- * priority is only checked before mutex ownership occurs.
- */
- if (propagate_prio != 0) {
- /*
- * Lock the thread's scheduling queue. This is a bit
- * convoluted; the "in synchronization queue flag" can
- * only be cleared with both the thread's scheduling and
- * mutex locks held. The thread's pointer to the wanted
- * mutex is guaranteed to be valid during this time.
- */
- THR_SCHED_LOCK(curthread, pthread);
-
- if (((pthread->sflags & THR_FLAGS_IN_SYNCQ) == 0) ||
- ((m = pthread->data.mutex) == NULL))
- THR_SCHED_UNLOCK(curthread, pthread);
- else {
- /*
- * This thread is currently waiting on a mutex; unlock
- * the scheduling queue lock and lock the mutex. We
- * can't hold both at the same time because the locking
- * order could cause a deadlock.
- */
- THR_SCHED_UNLOCK(curthread, pthread);
- THR_LOCK_ACQUIRE(curthread, &m->m_lock);
-
- /*
- * Check to make sure this thread is still in the
- * same state (the lock above can yield the CPU to
- * another thread or the thread may be running on
- * another CPU).
- */
- if (((pthread->sflags & THR_FLAGS_IN_SYNCQ) != 0) &&
- (pthread->data.mutex == m)) {
- /*
- * Remove and reinsert this thread into
- * the list of waiting threads to preserve
- * decreasing priority order.
- */
- mutex_queue_remove(m, pthread);
- mutex_queue_enq(m, pthread);
-
- if (m->m_protocol == PTHREAD_PRIO_INHERIT)
- /* Adjust priorities: */
- mutex_priority_adjust(curthread, m);
- }
-
- /* Unlock the mutex structure: */
- THR_LOCK_RELEASE(curthread, &m->m_lock);
- }
- }
-}
-
-/*
- * Called when a new thread is added to the mutex waiting queue or
- * when a threads priority changes that is already in the mutex
- * waiting queue.
- *
- * This must be called with the mutex locked by the current thread.
- */
-static void
-mutex_priority_adjust(struct pthread *curthread, pthread_mutex_t mutex)
-{
- pthread_mutex_t m = mutex;
- struct pthread *pthread_next, *pthread = mutex->m_owner;
- int done, temp_prio;
-
- /*
- * Calculate the mutex priority as the maximum of the highest
- * active priority of any waiting threads and the owning threads
- * active priority(*).
- *
- * (*) Because the owning threads current active priority may
- * reflect priority inherited from this mutex (and the mutex
- * priority may have changed) we must recalculate the active
- * priority based on the threads saved inherited priority
- * and its base priority.
- */
- pthread_next = TAILQ_FIRST(&m->m_queue); /* should never be NULL */
- temp_prio = MAX(pthread_next->active_priority,
- MAX(m->m_saved_prio, pthread->base_priority));
-
- /* See if this mutex really needs adjusting: */
- if (temp_prio == m->m_prio)
- /* No need to propagate the priority: */
- return;
-
- /* Set new priority of the mutex: */
- m->m_prio = temp_prio;
-
- /*
- * Don't unlock the mutex passed in as an argument. It is
- * expected to be locked and unlocked by the caller.
- */
- done = 1;
- do {
- /*
- * Save the threads priority before rescanning the
- * owned mutexes:
- */
- temp_prio = pthread->active_priority;
-
- /*
- * Fix the priorities for all mutexes held by the owning
- * thread since taking this mutex. This also has a
- * potential side-effect of changing the threads priority.
- *
- * At this point the mutex is locked by the current thread.
- * The owning thread can't release the mutex until it is
- * unlocked, so we should be able to safely walk its list
- * of owned mutexes.
- */
- mutex_rescan_owned(curthread, pthread, m);
-
- /*
- * If this isn't the first time through the loop,
- * the current mutex needs to be unlocked.
- */
- if (done == 0)
- THR_LOCK_RELEASE(curthread, &m->m_lock);
-
- /* Assume we're done unless told otherwise: */
- done = 1;
-
- /*
- * If the thread is currently waiting on a mutex, check
- * to see if the threads new priority has affected the
- * priority of the mutex.
- */
- if ((temp_prio != pthread->active_priority) &&
- ((pthread->sflags & THR_FLAGS_IN_SYNCQ) != 0) &&
- ((m = pthread->data.mutex) != NULL) &&
- (m->m_protocol == PTHREAD_PRIO_INHERIT)) {
- /* Lock the mutex structure: */
- THR_LOCK_ACQUIRE(curthread, &m->m_lock);
-
- /*
- * Make sure the thread is still waiting on the
- * mutex:
- */
- if (((pthread->sflags & THR_FLAGS_IN_SYNCQ) != 0) &&
- (m == pthread->data.mutex)) {
- /*
- * The priority for this thread has changed.
- * Remove and reinsert this thread into the
- * list of waiting threads to preserve
- * decreasing priority order.
- */
- mutex_queue_remove(m, pthread);
- mutex_queue_enq(m, pthread);
-
- /*
- * Grab the waiting thread with highest
- * priority:
- */
- pthread_next = TAILQ_FIRST(&m->m_queue);
-
- /*
- * Calculate the mutex priority as the maximum
- * of the highest active priority of any
- * waiting threads and the owning threads
- * active priority.
- */
- temp_prio = MAX(pthread_next->active_priority,
- MAX(m->m_saved_prio,
- m->m_owner->base_priority));
-
- if (temp_prio != m->m_prio) {
- /*
- * The priority needs to be propagated
- * to the mutex this thread is waiting
- * on and up to the owner of that mutex.
- */
- m->m_prio = temp_prio;
- pthread = m->m_owner;
-
- /* We're not done yet: */
- done = 0;
- }
- }
- /* Only release the mutex if we're done: */
- if (done != 0)
- THR_LOCK_RELEASE(curthread, &m->m_lock);
- }
- } while (done == 0);
-}
-
-static void
-mutex_rescan_owned(struct pthread *curthread, struct pthread *pthread,
- struct pthread_mutex *mutex)
-{
- struct pthread_mutex *m;
- struct pthread *pthread_next;
- int active_prio, inherited_prio;
-
- /*
- * Start walking the mutexes the thread has taken since
- * taking this mutex.
- */
- if (mutex == NULL) {
- /*
- * A null mutex means start at the beginning of the owned
- * mutex list.
- */
- m = TAILQ_FIRST(&pthread->mutexq);
-
- /* There is no inherited priority yet. */
- inherited_prio = 0;
- } else {
- /*
- * The caller wants to start after a specific mutex. It
- * is assumed that this mutex is a priority inheritence
- * mutex and that its priority has been correctly
- * calculated.
- */
- m = TAILQ_NEXT(mutex, m_qe);
-
- /* Start inheriting priority from the specified mutex. */
- inherited_prio = mutex->m_prio;
- }
- active_prio = MAX(inherited_prio, pthread->base_priority);
-
- for (; m != NULL; m = TAILQ_NEXT(m, m_qe)) {
- /*
- * We only want to deal with priority inheritence
- * mutexes. This might be optimized by only placing
- * priority inheritence mutexes into the owned mutex
- * list, but it may prove to be useful having all
- * owned mutexes in this list. Consider a thread
- * exiting while holding mutexes...
- */
- if (m->m_protocol == PTHREAD_PRIO_INHERIT) {
- /*
- * Fix the owners saved (inherited) priority to
- * reflect the priority of the previous mutex.
- */
- m->m_saved_prio = inherited_prio;
-
- if ((pthread_next = TAILQ_FIRST(&m->m_queue)) != NULL)
- /* Recalculate the priority of the mutex: */
- m->m_prio = MAX(active_prio,
- pthread_next->active_priority);
- else
- m->m_prio = active_prio;
-
- /* Recalculate new inherited and active priorities: */
- inherited_prio = m->m_prio;
- active_prio = MAX(m->m_prio, pthread->base_priority);
- }
- }
-
- /*
- * Fix the threads inherited priority and recalculate its
- * active priority.
- */
- pthread->inherited_priority = inherited_prio;
- active_prio = MAX(inherited_prio, pthread->base_priority);
-
- if (active_prio != pthread->active_priority) {
- /* Lock the thread's scheduling queue: */
- THR_SCHED_LOCK(curthread, pthread);
-
- if ((pthread->flags & THR_FLAGS_IN_RUNQ) == 0) {
- /*
- * This thread is not in a run queue. Just set
- * its active priority.
- */
- pthread->active_priority = active_prio;
- }
- else {
- /*
- * This thread is in a run queue. Remove it from
- * the queue before changing its priority:
- */
- THR_RUNQ_REMOVE(pthread);
-
- /*
- * POSIX states that if the priority is being
- * lowered, the thread must be inserted at the
- * head of the queue for its priority if it owns
- * any priority protection or inheritence mutexes.
- */
- if ((active_prio < pthread->active_priority) &&
- (pthread->priority_mutex_count > 0)) {
- /* Set the new active priority. */
- pthread->active_priority = active_prio;
-
- THR_RUNQ_INSERT_HEAD(pthread);
- } else {
- /* Set the new active priority. */
- pthread->active_priority = active_prio;
-
- THR_RUNQ_INSERT_TAIL(pthread);
- }
- }
- THR_SCHED_UNLOCK(curthread, pthread);
- }
-}
-
-void
-_mutex_unlock_private(pthread_t pthread)
-{
- struct pthread_mutex *m, *m_next;
-
- for (m = TAILQ_FIRST(&pthread->mutexq); m != NULL; m = m_next) {
- m_next = TAILQ_NEXT(m, m_qe);
- if ((m->m_flags & MUTEX_FLAGS_PRIVATE) != 0)
- pthread_mutex_unlock(&m);
- }
-}
-
-/*
- * This is called by the current thread when it wants to back out of a
- * mutex_lock in order to run a signal handler.
- */
-static void
-mutex_lock_backout(void *arg)
-{
- struct pthread *curthread = (struct pthread *)arg;
- struct pthread_mutex *m;
-
- if ((curthread->sflags & THR_FLAGS_IN_SYNCQ) != 0) {
- /*
- * Any other thread may clear the "in sync queue flag",
- * but only the current thread can clear the pointer
- * to the mutex. So if the flag is set, we can
- * guarantee that the pointer to the mutex is valid.
- * The only problem may be if the mutex is destroyed
- * out from under us, but that should be considered
- * an application bug.
- */
- m = curthread->data.mutex;
-
- /* Lock the mutex structure: */
- THR_LOCK_ACQUIRE(curthread, &m->m_lock);
-
-
- /*
- * Check to make sure this thread doesn't already own
- * the mutex. Since mutexes are unlocked with direct
- * handoffs, it is possible the previous owner gave it
- * to us after we checked the sync queue flag and before
- * we locked the mutex structure.
- */
- if (m->m_owner == curthread) {
- THR_LOCK_RELEASE(curthread, &m->m_lock);
- mutex_unlock_common(&m, /* add_reference */ 0);
- } else {
- /*
- * Remove ourselves from the mutex queue and
- * clear the pointer to the mutex. We may no
- * longer be in the mutex queue, but the removal
- * function will DTRT.
- */
- mutex_queue_remove(m, curthread);
- curthread->data.mutex = NULL;
- THR_LOCK_RELEASE(curthread, &m->m_lock);
- }
- }
- /* No need to call this again. */
- curthread->sigbackout = NULL;
-}
-
-/*
- * Dequeue a waiting thread from the head of a mutex queue in descending
- * priority order.
- *
- * In order to properly dequeue a thread from the mutex queue and
- * make it runnable without the possibility of errant wakeups, it
- * is necessary to lock the thread's scheduling queue while also
- * holding the mutex lock.
- */
-static struct kse_mailbox *
-mutex_handoff(struct pthread *curthread, struct pthread_mutex *mutex)
-{
- struct kse_mailbox *kmbx = NULL;
- struct pthread *pthread;
-
- /* Keep dequeueing until we find a valid thread: */
- mutex->m_owner = NULL;
- pthread = TAILQ_FIRST(&mutex->m_queue);
- while (pthread != NULL) {
- /* Take the thread's scheduling lock: */
- THR_SCHED_LOCK(curthread, pthread);
-
- /* Remove the thread from the mutex queue: */
- TAILQ_REMOVE(&mutex->m_queue, pthread, sqe);
- pthread->sflags &= ~THR_FLAGS_IN_SYNCQ;
-
- /*
- * Only exit the loop if the thread hasn't been
- * cancelled.
- */
- switch (mutex->m_protocol) {
- case PTHREAD_PRIO_NONE:
- /*
- * Assign the new owner and add the mutex to the
- * thread's list of owned mutexes.
- */
- mutex->m_owner = pthread;
- TAILQ_INSERT_TAIL(&pthread->mutexq, mutex, m_qe);
- break;
-
- case PTHREAD_PRIO_INHERIT:
- /*
- * Assign the new owner and add the mutex to the
- * thread's list of owned mutexes.
- */
- mutex->m_owner = pthread;
- TAILQ_INSERT_TAIL(&pthread->mutexq, mutex, m_qe);
-
- /* Track number of priority mutexes owned: */
- pthread->priority_mutex_count++;
-
- /*
- * Set the priority of the mutex. Since our waiting
- * threads are in descending priority order, the
- * priority of the mutex becomes the active priority
- * of the thread we just dequeued.
- */
- mutex->m_prio = pthread->active_priority;
-
- /* Save the owning threads inherited priority: */
- mutex->m_saved_prio = pthread->inherited_priority;
-
- /*
- * The owning threads inherited priority now becomes
- * his active priority (the priority of the mutex).
- */
- pthread->inherited_priority = mutex->m_prio;
- break;
-
- case PTHREAD_PRIO_PROTECT:
- if (pthread->active_priority > mutex->m_prio) {
- /*
- * Either the mutex ceiling priority has
- * been lowered and/or this threads priority
- * has been raised subsequent to the thread
- * being queued on the waiting list.
- */
- pthread->error = EINVAL;
- }
- else {
- /*
- * Assign the new owner and add the mutex
- * to the thread's list of owned mutexes.
- */
- mutex->m_owner = pthread;
- TAILQ_INSERT_TAIL(&pthread->mutexq,
- mutex, m_qe);
-
- /* Track number of priority mutexes owned: */
- pthread->priority_mutex_count++;
-
- /*
- * Save the owning threads inherited
- * priority:
- */
- mutex->m_saved_prio =
- pthread->inherited_priority;
-
- /*
- * The owning thread inherits the ceiling
- * priority of the mutex and executes at
- * that priority:
- */
- pthread->inherited_priority = mutex->m_prio;
- pthread->active_priority = mutex->m_prio;
-
- }
- break;
- }
-
- /* Make the thread runnable and unlock the scheduling queue: */
- kmbx = _thr_setrunnable_unlocked(pthread);
-
- /* Add a preemption point. */
- if ((curthread->kseg == pthread->kseg) &&
- (pthread->active_priority > curthread->active_priority))
- curthread->critical_yield = 1;
-
- if (mutex->m_owner == pthread) {
- /* We're done; a valid owner was found. */
- if (mutex->m_flags & MUTEX_FLAGS_PRIVATE)
- THR_CRITICAL_ENTER(pthread);
- THR_SCHED_UNLOCK(curthread, pthread);
- break;
- }
- THR_SCHED_UNLOCK(curthread, pthread);
- /* Get the next thread from the waiting queue: */
- pthread = TAILQ_NEXT(pthread, sqe);
- }
-
- if ((pthread == NULL) && (mutex->m_protocol == PTHREAD_PRIO_INHERIT))
- /* This mutex has no priority: */
- mutex->m_prio = 0;
- return (kmbx);
-}
-
-/*
- * Dequeue a waiting thread from the head of a mutex queue in descending
- * priority order.
- */
-static inline pthread_t
-mutex_queue_deq(struct pthread_mutex *mutex)
-{
- pthread_t pthread;
-
- while ((pthread = TAILQ_FIRST(&mutex->m_queue)) != NULL) {
- TAILQ_REMOVE(&mutex->m_queue, pthread, sqe);
- pthread->sflags &= ~THR_FLAGS_IN_SYNCQ;
-
- /*
- * Only exit the loop if the thread hasn't been
- * cancelled.
- */
- if (pthread->interrupted == 0)
- break;
- }
-
- return (pthread);
-}
-
-/*
- * Remove a waiting thread from a mutex queue in descending priority order.
- */
-static inline void
-mutex_queue_remove(pthread_mutex_t mutex, pthread_t pthread)
-{
- if ((pthread->sflags & THR_FLAGS_IN_SYNCQ) != 0) {
- TAILQ_REMOVE(&mutex->m_queue, pthread, sqe);
- pthread->sflags &= ~THR_FLAGS_IN_SYNCQ;
- }
-}
-
-/*
- * Enqueue a waiting thread to a queue in descending priority order.
- */
-static inline void
-mutex_queue_enq(pthread_mutex_t mutex, pthread_t pthread)
-{
- pthread_t tid = TAILQ_LAST(&mutex->m_queue, mutex_head);
-
- THR_ASSERT_NOT_IN_SYNCQ(pthread);
- /*
- * For the common case of all threads having equal priority,
- * we perform a quick check against the priority of the thread
- * at the tail of the queue.
- */
- if ((tid == NULL) || (pthread->active_priority <= tid->active_priority))
- TAILQ_INSERT_TAIL(&mutex->m_queue, pthread, sqe);
- else {
- tid = TAILQ_FIRST(&mutex->m_queue);
- while (pthread->active_priority <= tid->active_priority)
- tid = TAILQ_NEXT(tid, sqe);
- TAILQ_INSERT_BEFORE(tid, pthread, sqe);
- }
- pthread->sflags |= THR_FLAGS_IN_SYNCQ;
-}
diff --git a/lib/libkse/thread/thr_mutex_prioceiling.c b/lib/libkse/thread/thr_mutex_prioceiling.c
deleted file mode 100644
index c65270a..0000000
--- a/lib/libkse/thread/thr_mutex_prioceiling.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_mutexattr_getprioceiling, pthread_mutexattr_getprioceiling);
-__weak_reference(_pthread_mutexattr_setprioceiling, pthread_mutexattr_setprioceiling);
-__weak_reference(_pthread_mutex_getprioceiling, pthread_mutex_getprioceiling);
-__weak_reference(_pthread_mutex_setprioceiling, pthread_mutex_setprioceiling);
-
-int
-_pthread_mutexattr_getprioceiling(pthread_mutexattr_t *mattr, int *prioceiling)
-{
- int ret = 0;
-
- if ((mattr == NULL) || (*mattr == NULL))
- ret = EINVAL;
- else if ((*mattr)->m_protocol != PTHREAD_PRIO_PROTECT)
- ret = EINVAL;
- else
- *prioceiling = (*mattr)->m_ceiling;
-
- return(ret);
-}
-
-int
-_pthread_mutexattr_setprioceiling(pthread_mutexattr_t *mattr, int prioceiling)
-{
- int ret = 0;
-
- if ((mattr == NULL) || (*mattr == NULL))
- ret = EINVAL;
- else if ((*mattr)->m_protocol != PTHREAD_PRIO_PROTECT)
- ret = EINVAL;
- else
- (*mattr)->m_ceiling = prioceiling;
-
- return(ret);
-}
-
-int
-_pthread_mutex_getprioceiling(pthread_mutex_t *mutex,
- int *prioceiling)
-{
- int ret;
-
- if ((mutex == NULL) || (*mutex == NULL))
- ret = EINVAL;
- else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
- ret = EINVAL;
- else
- ret = (*mutex)->m_prio;
-
- return(ret);
-}
-
-int
-_pthread_mutex_setprioceiling(pthread_mutex_t *mutex,
- int prioceiling, int *old_ceiling)
-{
- int ret = 0;
- int tmp;
-
- if ((mutex == NULL) || (*mutex == NULL))
- ret = EINVAL;
- else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
- ret = EINVAL;
- /* Lock the mutex: */
- else if ((ret = pthread_mutex_lock(mutex)) == 0) {
- tmp = (*mutex)->m_prio;
- /* Set the new ceiling: */
- (*mutex)->m_prio = prioceiling;
-
- /* Unlock the mutex: */
- ret = pthread_mutex_unlock(mutex);
-
- /* Return the old ceiling: */
- *old_ceiling = tmp;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_mutex_protocol.c b/lib/libkse/thread/thr_mutex_protocol.c
deleted file mode 100644
index 9f0f262..0000000
--- a/lib/libkse/thread/thr_mutex_protocol.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_mutexattr_getprotocol, pthread_mutexattr_getprotocol);
-__weak_reference(_pthread_mutexattr_setprotocol, pthread_mutexattr_setprotocol);
-
-int
-_pthread_mutexattr_getprotocol(pthread_mutexattr_t *mattr, int *protocol)
-{
- int ret = 0;
-
- if ((mattr == NULL) || (*mattr == NULL))
- ret = EINVAL;
- else
- *protocol = (*mattr)->m_protocol;
-
- return(ret);
-}
-
-int
-_pthread_mutexattr_setprotocol(pthread_mutexattr_t *mattr, int protocol)
-{
- int ret = 0;
-
- if ((mattr == NULL) || (*mattr == NULL) ||
- (protocol < PTHREAD_PRIO_NONE) || (protocol > PTHREAD_PRIO_PROTECT))
- ret = EINVAL;
- else {
- (*mattr)->m_protocol = protocol;
- (*mattr)->m_ceiling = THR_MAX_PRIORITY;
- }
- return(ret);
-}
-
diff --git a/lib/libkse/thread/thr_mutexattr_destroy.c b/lib/libkse/thread/thr_mutexattr_destroy.c
deleted file mode 100644
index b9852b5..0000000
--- a/lib/libkse/thread/thr_mutexattr_destroy.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdlib.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_mutexattr_destroy, pthread_mutexattr_destroy);
-
-int
-_pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
-{
- int ret;
- if (attr == NULL || *attr == NULL) {
- ret = EINVAL;
- } else {
- free(*attr);
- *attr = NULL;
- ret = 0;
- }
- return(ret);
-}
diff --git a/lib/libkse/thread/thr_nanosleep.c b/lib/libkse/thread/thr_nanosleep.c
deleted file mode 100644
index e8baa84..0000000
--- a/lib/libkse/thread/thr_nanosleep.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdio.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__nanosleep, nanosleep);
-
-int
-_nanosleep(const struct timespec *time_to_sleep,
- struct timespec *time_remaining)
-{
- struct pthread *curthread = _get_curthread();
- int ret = 0;
- struct timespec ts, ts1;
- struct timespec remaining_time;
-
- /* Check if the time to sleep is legal: */
- if ((time_to_sleep == NULL) || (time_to_sleep->tv_sec < 0) ||
- (time_to_sleep->tv_nsec < 0) ||
- (time_to_sleep->tv_nsec >= 1000000000)) {
- /* Return an EINVAL error : */
- errno = EINVAL;
- ret = -1;
- } else {
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- return (__sys_nanosleep(time_to_sleep, time_remaining));
-
- KSE_GET_TOD(curthread->kse, &ts);
-
- /* Calculate the time for the current thread to wake up: */
- TIMESPEC_ADD(&curthread->wakeup_time, &ts, time_to_sleep);
-
- THR_LOCK_SWITCH(curthread);
- curthread->interrupted = 0;
- THR_SET_STATE(curthread, PS_SLEEP_WAIT);
-
- /* Reschedule the current thread to sleep: */
- _thr_sched_switch_unlocked(curthread);
-
- /* Calculate the remaining time to sleep: */
- KSE_GET_TOD(curthread->kse, &ts1);
- remaining_time.tv_sec = time_to_sleep->tv_sec
- + ts.tv_sec - ts1.tv_sec;
- remaining_time.tv_nsec = time_to_sleep->tv_nsec
- + ts.tv_nsec - ts1.tv_nsec;
-
- /* Check if the nanosecond field has underflowed: */
- if (remaining_time.tv_nsec < 0) {
- /* Handle the underflow: */
- remaining_time.tv_sec -= 1;
- remaining_time.tv_nsec += 1000000000;
- }
- /* Check if the nanosecond field has overflowed: */
- else if (remaining_time.tv_nsec >= 1000000000) {
- /* Handle the overflow: */
- remaining_time.tv_sec += 1;
- remaining_time.tv_nsec -= 1000000000;
- }
-
- /* Check if the sleep was longer than the required time: */
- if (remaining_time.tv_sec < 0) {
- /* Reset the time left: */
- remaining_time.tv_sec = 0;
- remaining_time.tv_nsec = 0;
- }
-
- /* Check if the time remaining is to be returned: */
- if (time_remaining != NULL) {
- /* Return the actual time slept: */
- time_remaining->tv_sec = remaining_time.tv_sec;
- time_remaining->tv_nsec = remaining_time.tv_nsec;
- }
-
- /* Check if the sleep was interrupted: */
- if (curthread->interrupted) {
- /* Return an EINTR error : */
- errno = EINTR;
- ret = -1;
- }
- }
- return (ret);
-}
-
-int
-__nanosleep(const struct timespec *time_to_sleep,
- struct timespec *time_remaining)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = _nanosleep(time_to_sleep, time_remaining);
- _thr_cancel_leave(curthread, 1);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_once.c b/lib/libkse/thread/thr_once.c
deleted file mode 100644
index 40344bd..0000000
--- a/lib/libkse/thread/thr_once.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include "namespace.h"
-#include <pthread.h>
-#include "un-namespace.h"
-#include "thr_private.h"
-
-__weak_reference(_pthread_once, pthread_once);
-
-#define ONCE_NEVER_DONE PTHREAD_NEEDS_INIT
-#define ONCE_DONE PTHREAD_DONE_INIT
-#define ONCE_IN_PROGRESS 0x02
-#define ONCE_MASK 0x03
-
-static pthread_mutex_t once_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t once_cv = PTHREAD_COND_INITIALIZER;
-
-/*
- * POSIX:
- * The pthread_once() function is not a cancellation point. However,
- * if init_routine is a cancellation point and is canceled, the effect
- * on once_control shall be as if pthread_once() was never called.
- */
-
-static void
-once_cancel_handler(void *arg)
-{
- pthread_once_t *once_control = arg;
-
- _pthread_mutex_lock(&once_lock);
- once_control->state = ONCE_NEVER_DONE;
- _pthread_mutex_unlock(&once_lock);
- _pthread_cond_broadcast(&once_cv);
-}
-
-int
-_pthread_once(pthread_once_t *once_control, void (*init_routine) (void))
-{
- struct pthread *curthread;
- int wakeup = 0;
-
- if (once_control->state == ONCE_DONE)
- return (0);
- _pthread_mutex_lock(&once_lock);
- while (*(volatile int *)&(once_control->state) == ONCE_IN_PROGRESS)
- _pthread_cond_wait(&once_cv, &once_lock);
- /*
- * If previous thread was canceled, then the state still
- * could be ONCE_NEVER_DONE, we need to check it again.
- */
- if (*(volatile int *)&(once_control->state) == ONCE_NEVER_DONE) {
- once_control->state = ONCE_IN_PROGRESS;
- _pthread_mutex_unlock(&once_lock);
- curthread = _get_curthread();
- THR_CLEANUP_PUSH(curthread, once_cancel_handler, once_control);
- init_routine();
- THR_CLEANUP_POP(curthread, 0);
- _pthread_mutex_lock(&once_lock);
- once_control->state = ONCE_DONE;
- wakeup = 1;
- }
- _pthread_mutex_unlock(&once_lock);
- if (wakeup)
- _pthread_cond_broadcast(&once_cv);
- return (0);
-}
-
diff --git a/lib/libkse/thread/thr_open.c b/lib/libkse/thread/thr_open.c
deleted file mode 100644
index 8ac625d..0000000
--- a/lib/libkse/thread/thr_open.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- *
- */
-#include <stdarg.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__open, open);
-
-int
-__open(const char *path, int flags,...)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
- int mode = 0;
- va_list ap;
-
- _thr_cancel_enter(curthread);
-
- /* Check if the file is being created: */
- if (flags & O_CREAT) {
- /* Get the creation mode: */
- va_start(ap, flags);
- mode = va_arg(ap, int);
- va_end(ap);
- }
-
- ret = __sys_open(path, flags, mode);
- /*
- * To avoid possible file handle leak,
- * only check cancellation point if it is failure
- */
- _thr_cancel_leave(curthread, (ret == -1));
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_pause.c b/lib/libkse/thread/thr_pause.c
deleted file mode 100644
index 391b5a0..0000000
--- a/lib/libkse/thread/thr_pause.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <unistd.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-extern int __pause(void);
-
-__weak_reference(_pause, pause);
-
-int
-_pause(void)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = __pause();
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_poll.c b/lib/libkse/thread/thr_poll.c
deleted file mode 100644
index 1b16598..0000000
--- a/lib/libkse/thread/thr_poll.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1999 Daniel Eischen <eischen@vigrid.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <poll.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/fcntl.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__poll, poll);
-
-int
-__poll(struct pollfd *fds, unsigned int nfds, int timeout)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = __sys_poll(fds, nfds, timeout);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_printf.c b/lib/libkse/thread/thr_printf.c
deleted file mode 100644
index 2a4b12b..0000000
--- a/lib/libkse/thread/thr_printf.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*-
- * Copyright (c) 2002 Jonathan Mini <mini@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "thr_private.h"
-
-static void pchar(int fd, char c);
-static void pstr(int fd, const char *s);
-
-/*
- * Write formatted output to stdout, in a thread-safe manner.
- *
- * Recognises the following conversions:
- * %c -> char
- * %d -> signed int (base 10)
- * %s -> string
- * %u -> unsigned int (base 10)
- * %x -> unsigned int (base 16)
- * %p -> unsigned int (base 16)
- */
-void
-_thread_printf(int fd, const char *fmt, ...)
-{
- static const char digits[16] = "0123456789abcdef";
- va_list ap;
- char buf[20];
- char *s;
- unsigned long r, u;
- int c;
- long d;
- int islong;
-
- va_start(ap, fmt);
- while ((c = *fmt++)) {
- islong = 0;
- if (c == '%') {
-next: c = *fmt++;
- if (c == '\0')
- goto out;
- switch (c) {
- case 'c':
- pchar(fd, va_arg(ap, int));
- continue;
- case 's':
- pstr(fd, va_arg(ap, char *));
- continue;
- case 'l':
- islong = 1;
- goto next;
- case 'p':
- islong = 1;
- case 'd':
- case 'u':
- case 'x':
- r = ((c == 'u') || (c == 'd')) ? 10 : 16;
- if (c == 'd') {
- if (islong)
- d = va_arg(ap, unsigned long);
- else
- d = va_arg(ap, unsigned);
- if (d < 0) {
- pchar(fd, '-');
- u = (unsigned long)(d * -1);
- } else
- u = (unsigned long)d;
- } else {
- if (islong)
- u = va_arg(ap, unsigned long);
- else
- u = va_arg(ap, unsigned);
- }
- s = buf;
- do {
- *s++ = digits[u % r];
- } while (u /= r);
- while (--s >= buf)
- pchar(fd, *s);
- continue;
- }
- }
- pchar(fd, c);
- }
-out:
- va_end(ap);
-}
-
-/*
- * Write a single character to stdout, in a thread-safe manner.
- */
-static void
-pchar(int fd, char c)
-{
-
- __sys_write(fd, &c, 1);
-}
-
-/*
- * Write a string to stdout, in a thread-safe manner.
- */
-static void
-pstr(int fd, const char *s)
-{
-
- __sys_write(fd, s, strlen(s));
-}
-
diff --git a/lib/libkse/thread/thr_priority_queue.c b/lib/libkse/thread/thr_priority_queue.c
deleted file mode 100644
index f750a01..0000000
--- a/lib/libkse/thread/thr_priority_queue.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <stdlib.h>
-#include <sys/queue.h>
-#include <string.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-/* Prototypes: */
-static void pq_insert_prio_list(pq_queue_t *pq, int prio);
-
-#if defined(_PTHREADS_INVARIANTS)
-
-#define PQ_IN_SCHEDQ (THR_FLAGS_IN_RUNQ | THR_FLAGS_IN_WAITQ)
-
-#define PQ_SET_ACTIVE(pq) (pq)->pq_flags |= PQF_ACTIVE
-#define PQ_CLEAR_ACTIVE(pq) (pq)->pq_flags &= ~PQF_ACTIVE
-#define PQ_ASSERT_ACTIVE(pq, msg) do { \
- if (((pq)->pq_flags & PQF_ACTIVE) == 0) \
- PANIC(msg); \
-} while (0)
-#define PQ_ASSERT_INACTIVE(pq, msg) do { \
- if (((pq)->pq_flags & PQF_ACTIVE) != 0) \
- PANIC(msg); \
-} while (0)
-#define PQ_ASSERT_IN_WAITQ(thrd, msg) do { \
- if (((thrd)->flags & THR_FLAGS_IN_WAITQ) == 0) \
- PANIC(msg); \
-} while (0)
-#define PQ_ASSERT_IN_RUNQ(thrd, msg) do { \
- if (((thrd)->flags & THR_FLAGS_IN_RUNQ) == 0) \
- PANIC(msg); \
-} while (0)
-#define PQ_ASSERT_NOT_QUEUED(thrd, msg) do { \
- if (((thrd)->flags & PQ_IN_SCHEDQ) != 0) \
- PANIC(msg); \
-} while (0)
-
-#else
-
-#define PQ_SET_ACTIVE(pq)
-#define PQ_CLEAR_ACTIVE(pq)
-#define PQ_ASSERT_ACTIVE(pq, msg)
-#define PQ_ASSERT_INACTIVE(pq, msg)
-#define PQ_ASSERT_IN_WAITQ(thrd, msg)
-#define PQ_ASSERT_IN_RUNQ(thrd, msg)
-#define PQ_ASSERT_NOT_QUEUED(thrd, msg)
-
-#endif
-
-int
-_pq_alloc(pq_queue_t *pq, int minprio, int maxprio)
-{
- int ret = 0;
- int prioslots = maxprio - minprio + 1;
-
- if (pq == NULL)
- ret = -1;
-
- /* Create the priority queue with (maxprio - minprio + 1) slots: */
- else if ((pq->pq_lists =
- (pq_list_t *) malloc(sizeof(pq_list_t) * prioslots)) == NULL)
- ret = -1;
-
- else {
- /* Remember the queue size: */
- pq->pq_size = prioslots;
- ret = _pq_init(pq);
- }
- return (ret);
-}
-
-void
-_pq_free(pq_queue_t *pq)
-{
- if ((pq != NULL) && (pq->pq_lists != NULL))
- free(pq->pq_lists);
-}
-
-int
-_pq_init(pq_queue_t *pq)
-{
- int i, ret = 0;
-
- if ((pq == NULL) || (pq->pq_lists == NULL))
- ret = -1;
-
- else {
- /* Initialize the queue for each priority slot: */
- for (i = 0; i < pq->pq_size; i++) {
- TAILQ_INIT(&pq->pq_lists[i].pl_head);
- pq->pq_lists[i].pl_prio = i;
- pq->pq_lists[i].pl_queued = 0;
- }
- /* Initialize the priority queue: */
- TAILQ_INIT(&pq->pq_queue);
- pq->pq_flags = 0;
- pq->pq_threads = 0;
- }
- return (ret);
-}
-
-void
-_pq_remove(pq_queue_t *pq, pthread_t pthread)
-{
- int prio = pthread->active_priority;
-
- /*
- * Make some assertions when debugging is enabled:
- */
- PQ_ASSERT_INACTIVE(pq, "_pq_remove: pq_active");
- PQ_SET_ACTIVE(pq);
- PQ_ASSERT_IN_RUNQ(pthread, "_pq_remove: Not in priority queue");
-
- /*
- * Remove this thread from priority list. Note that if
- * the priority list becomes empty, it is not removed
- * from the priority queue because another thread may be
- * added to the priority list (resulting in a needless
- * removal/insertion). Priority lists are only removed
- * from the priority queue when _pq_first is called.
- */
- TAILQ_REMOVE(&pq->pq_lists[prio].pl_head, pthread, pqe);
- pq->pq_threads--;
- /* This thread is now longer in the priority queue. */
- pthread->flags &= ~THR_FLAGS_IN_RUNQ;
-
- PQ_CLEAR_ACTIVE(pq);
-}
-
-
-void
-_pq_insert_head(pq_queue_t *pq, pthread_t pthread)
-{
- int prio;
-
- /*
- * Make some assertions when debugging is enabled:
- */
- PQ_ASSERT_INACTIVE(pq, "_pq_insert_head: pq_active");
- PQ_SET_ACTIVE(pq);
- PQ_ASSERT_NOT_QUEUED(pthread,
- "_pq_insert_head: Already in priority queue");
-
- prio = pthread->active_priority;
- TAILQ_INSERT_HEAD(&pq->pq_lists[prio].pl_head, pthread, pqe);
- if (pq->pq_lists[prio].pl_queued == 0)
- /* Insert the list into the priority queue: */
- pq_insert_prio_list(pq, prio);
- pq->pq_threads++;
- /* Mark this thread as being in the priority queue. */
- pthread->flags |= THR_FLAGS_IN_RUNQ;
-
- PQ_CLEAR_ACTIVE(pq);
-}
-
-
-void
-_pq_insert_tail(pq_queue_t *pq, pthread_t pthread)
-{
- int prio;
-
- /*
- * Make some assertions when debugging is enabled:
- */
- PQ_ASSERT_INACTIVE(pq, "_pq_insert_tail: pq_active");
- PQ_SET_ACTIVE(pq);
- PQ_ASSERT_NOT_QUEUED(pthread,
- "_pq_insert_tail: Already in priority queue");
-
- prio = pthread->active_priority;
- TAILQ_INSERT_TAIL(&pq->pq_lists[prio].pl_head, pthread, pqe);
- if (pq->pq_lists[prio].pl_queued == 0)
- /* Insert the list into the priority queue: */
- pq_insert_prio_list(pq, prio);
- pq->pq_threads++;
- /* Mark this thread as being in the priority queue. */
- pthread->flags |= THR_FLAGS_IN_RUNQ;
-
- PQ_CLEAR_ACTIVE(pq);
-}
-
-
-pthread_t
-_pq_first(pq_queue_t *pq)
-{
- pq_list_t *pql;
- pthread_t pthread = NULL;
-
- /*
- * Make some assertions when debugging is enabled:
- */
- PQ_ASSERT_INACTIVE(pq, "_pq_first: pq_active");
- PQ_SET_ACTIVE(pq);
-
- while (((pql = TAILQ_FIRST(&pq->pq_queue)) != NULL) &&
- (pthread == NULL)) {
- if ((pthread = TAILQ_FIRST(&pql->pl_head)) == NULL) {
- /*
- * The priority list is empty; remove the list
- * from the queue.
- */
- TAILQ_REMOVE(&pq->pq_queue, pql, pl_link);
-
- /* Mark the list as not being in the queue: */
- pql->pl_queued = 0;
- }
- }
-
- PQ_CLEAR_ACTIVE(pq);
- return (pthread);
-}
-
-/*
- * Select a thread which is allowed to run by debugger, we probably
- * should merge the function into _pq_first if that function is only
- * used by scheduler to select a thread.
- */
-pthread_t
-_pq_first_debug(pq_queue_t *pq)
-{
- pq_list_t *pql, *pqlnext = NULL;
- pthread_t pthread = NULL;
-
- /*
- * Make some assertions when debugging is enabled:
- */
- PQ_ASSERT_INACTIVE(pq, "_pq_first: pq_active");
- PQ_SET_ACTIVE(pq);
-
- for (pql = TAILQ_FIRST(&pq->pq_queue);
- pql != NULL && pthread == NULL; pql = pqlnext) {
- if ((pthread = TAILQ_FIRST(&pql->pl_head)) == NULL) {
- /*
- * The priority list is empty; remove the list
- * from the queue.
- */
- pqlnext = TAILQ_NEXT(pql, pl_link);
- TAILQ_REMOVE(&pq->pq_queue, pql, pl_link);
-
- /* Mark the list as not being in the queue: */
- pql->pl_queued = 0;
- } else {
- /*
- * note there may be a suspension event during this
- * test, If TMDF_SUSPEND is set after we tested it,
- * we will run the thread, this seems be a problem,
- * fortunatly, when we are being debugged, all context
- * switch will be done by kse_switchin, that is a
- * syscall, kse_switchin will check the flag again,
- * the thread will be returned via upcall, so next
- * time, UTS won't run the thread.
- */
- while (pthread != NULL && !DBG_CAN_RUN(pthread)) {
- pthread = TAILQ_NEXT(pthread, pqe);
- }
- if (pthread == NULL)
- pqlnext = TAILQ_NEXT(pql, pl_link);
- }
- }
-
- PQ_CLEAR_ACTIVE(pq);
- return (pthread);
-}
-
-static void
-pq_insert_prio_list(pq_queue_t *pq, int prio)
-{
- pq_list_t *pql;
-
- /*
- * Make some assertions when debugging is enabled:
- */
- PQ_ASSERT_ACTIVE(pq, "pq_insert_prio_list: pq_active");
-
- /*
- * The priority queue is in descending priority order. Start at
- * the beginning of the queue and find the list before which the
- * new list should be inserted.
- */
- pql = TAILQ_FIRST(&pq->pq_queue);
- while ((pql != NULL) && (pql->pl_prio > prio))
- pql = TAILQ_NEXT(pql, pl_link);
-
- /* Insert the list: */
- if (pql == NULL)
- TAILQ_INSERT_TAIL(&pq->pq_queue, &pq->pq_lists[prio], pl_link);
- else
- TAILQ_INSERT_BEFORE(pql, &pq->pq_lists[prio], pl_link);
-
- /* Mark this list as being in the queue: */
- pq->pq_lists[prio].pl_queued = 1;
-}
diff --git a/lib/libkse/thread/thr_private.h b/lib/libkse/thread/thr_private.h
deleted file mode 100644
index e2055bc..0000000
--- a/lib/libkse/thread/thr_private.h
+++ /dev/null
@@ -1,1281 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * Private thread definitions for the uthread kernel.
- *
- * $FreeBSD$
- */
-
-#ifndef _THR_PRIVATE_H
-#define _THR_PRIVATE_H
-
-/*
- * Include files.
- */
-#include <setjmp.h>
-#include <signal.h>
-#include <stdio.h>
-#include <sys/queue.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/cdefs.h>
-#include <sys/kse.h>
-#include <sched.h>
-#include <ucontext.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <pthread_np.h>
-
-#ifndef LIBTHREAD_DB
-#include "lock.h"
-#include "pthread_md.h"
-#endif
-
-/*
- * Evaluate the storage class specifier.
- */
-#ifdef GLOBAL_PTHREAD_PRIVATE
-#define SCLASS
-#define SCLASS_PRESET(x...) = x
-#else
-#define SCLASS extern
-#define SCLASS_PRESET(x...)
-#endif
-
-/*
- * Kernel fatal error handler macro.
- */
-#define PANIC(string) _thr_exit(__FILE__,__LINE__,string)
-
-
-/* Output debug messages like this: */
-#define stdout_debug(args...) _thread_printf(STDOUT_FILENO, ##args)
-#define stderr_debug(args...) _thread_printf(STDOUT_FILENO, ##args)
-
-#define DBG_MUTEX 0x0001
-#define DBG_SIG 0x0002
-
-#ifdef _PTHREADS_INVARIANTS
-#define THR_ASSERT(cond, msg) do { \
- if (!(cond)) \
- PANIC(msg); \
-} while (0)
-#else
-#define THR_ASSERT(cond, msg)
-#endif
-
-/*
- * State change macro without scheduling queue change:
- */
-#define THR_SET_STATE(thrd, newstate) do { \
- (thrd)->state = newstate; \
- (thrd)->fname = __FILE__; \
- (thrd)->lineno = __LINE__; \
-} while (0)
-
-
-#define TIMESPEC_ADD(dst, src, val) \
- do { \
- (dst)->tv_sec = (src)->tv_sec + (val)->tv_sec; \
- (dst)->tv_nsec = (src)->tv_nsec + (val)->tv_nsec; \
- if ((dst)->tv_nsec >= 1000000000) { \
- (dst)->tv_sec++; \
- (dst)->tv_nsec -= 1000000000; \
- } \
- } while (0)
-
-#define TIMESPEC_SUB(dst, src, val) \
- do { \
- (dst)->tv_sec = (src)->tv_sec - (val)->tv_sec; \
- (dst)->tv_nsec = (src)->tv_nsec - (val)->tv_nsec; \
- if ((dst)->tv_nsec < 0) { \
- (dst)->tv_sec--; \
- (dst)->tv_nsec += 1000000000; \
- } \
- } while (0)
-
-/*
- * Priority queues.
- *
- * XXX It'd be nice if these were contained in uthread_priority_queue.[ch].
- */
-typedef struct pq_list {
- TAILQ_HEAD(, pthread) pl_head; /* list of threads at this priority */
- TAILQ_ENTRY(pq_list) pl_link; /* link for queue of priority lists */
- int pl_prio; /* the priority of this list */
- int pl_queued; /* is this in the priority queue */
-} pq_list_t;
-
-typedef struct pq_queue {
- TAILQ_HEAD(, pq_list) pq_queue; /* queue of priority lists */
- pq_list_t *pq_lists; /* array of all priority lists */
- int pq_size; /* number of priority lists */
-#define PQF_ACTIVE 0x0001
- int pq_flags;
- int pq_threads;
-} pq_queue_t;
-
-/*
- * Each KSEG has a scheduling queue. For now, threads that exist in their
- * own KSEG (system scope) will get a full priority queue. In the future
- * this can be optimized for the single thread per KSEG case.
- */
-struct sched_queue {
- pq_queue_t sq_runq;
- TAILQ_HEAD(, pthread) sq_waitq; /* waiting in userland */
-};
-
-typedef struct kse_thr_mailbox *kse_critical_t;
-
-struct kse_group;
-
-#define MAX_KSE_LOCKLEVEL 5
-struct kse {
- /* -- location and order specific items for gdb -- */
- struct kcb *k_kcb;
- struct pthread *k_curthread; /* current thread */
- struct kse_group *k_kseg; /* parent KSEG */
- struct sched_queue *k_schedq; /* scheduling queue */
- /* -- end of location and order specific items -- */
- TAILQ_ENTRY(kse) k_qe; /* KSE list link entry */
- TAILQ_ENTRY(kse) k_kgqe; /* KSEG's KSE list entry */
- /*
- * Items that are only modified by the kse, or that otherwise
- * don't need to be locked when accessed
- */
- struct lock k_lock;
- struct lockuser k_lockusers[MAX_KSE_LOCKLEVEL];
- int k_locklevel;
- stack_t k_stack;
- int k_flags;
-#define KF_STARTED 0x0001 /* kernel kse created */
-#define KF_INITIALIZED 0x0002 /* initialized on 1st upcall */
-#define KF_TERMINATED 0x0004 /* kse is terminated */
-#define KF_IDLE 0x0008 /* kse is idle */
-#define KF_SWITCH 0x0010 /* thread switch in UTS */
- int k_error; /* syscall errno in critical */
- int k_cpu; /* CPU ID when bound */
- int k_sigseqno; /* signal buffered count */
-};
-
-#define KSE_SET_IDLE(kse) ((kse)->k_flags |= KF_IDLE)
-#define KSE_CLEAR_IDLE(kse) ((kse)->k_flags &= ~KF_IDLE)
-#define KSE_IS_IDLE(kse) (((kse)->k_flags & KF_IDLE) != 0)
-#define KSE_SET_SWITCH(kse) ((kse)->k_flags |= KF_SWITCH)
-#define KSE_CLEAR_SWITCH(kse) ((kse)->k_flags &= ~KF_SWITCH)
-#define KSE_IS_SWITCH(kse) (((kse)->k_flags & KF_SWITCH) != 0)
-
-/*
- * Each KSE group contains one or more KSEs in which threads can run.
- * At least for now, there is one scheduling queue per KSE group; KSEs
- * within the same KSE group compete for threads from the same scheduling
- * queue. A scope system thread has one KSE in one KSE group; the group
- * does not use its scheduling queue.
- */
-struct kse_group {
- TAILQ_HEAD(, kse) kg_kseq; /* list of KSEs in group */
- TAILQ_HEAD(, pthread) kg_threadq; /* list of threads in group */
- TAILQ_ENTRY(kse_group) kg_qe; /* link entry */
- struct sched_queue kg_schedq; /* scheduling queue */
- struct lock kg_lock;
- int kg_threadcount; /* # of assigned threads */
- int kg_ksecount; /* # of assigned KSEs */
- int kg_idle_kses;
- int kg_flags;
-#define KGF_SINGLE_THREAD 0x0001 /* scope system kse group */
-#define KGF_SCHEDQ_INITED 0x0002 /* has an initialized schedq */
-};
-
-/*
- * Add/remove threads from a KSE's scheduling queue.
- * For now the scheduling queue is hung off the KSEG.
- */
-#define KSEG_THRQ_ADD(kseg, thr) \
-do { \
- TAILQ_INSERT_TAIL(&(kseg)->kg_threadq, thr, kle);\
- (kseg)->kg_threadcount++; \
-} while (0)
-
-#define KSEG_THRQ_REMOVE(kseg, thr) \
-do { \
- TAILQ_REMOVE(&(kseg)->kg_threadq, thr, kle); \
- (kseg)->kg_threadcount--; \
-} while (0)
-
-
-/*
- * Lock acquire and release for KSEs.
- */
-#define KSE_LOCK_ACQUIRE(kse, lck) \
-do { \
- if ((kse)->k_locklevel < MAX_KSE_LOCKLEVEL) { \
- (kse)->k_locklevel++; \
- _lock_acquire((lck), \
- &(kse)->k_lockusers[(kse)->k_locklevel - 1], 0); \
- } \
- else \
- PANIC("Exceeded maximum lock level"); \
-} while (0)
-
-#define KSE_LOCK_RELEASE(kse, lck) \
-do { \
- if ((kse)->k_locklevel > 0) { \
- _lock_release((lck), \
- &(kse)->k_lockusers[(kse)->k_locklevel - 1]); \
- (kse)->k_locklevel--; \
- } \
-} while (0)
-
-/*
- * Lock our own KSEG.
- */
-#define KSE_LOCK(curkse) \
- KSE_LOCK_ACQUIRE(curkse, &(curkse)->k_kseg->kg_lock)
-#define KSE_UNLOCK(curkse) \
- KSE_LOCK_RELEASE(curkse, &(curkse)->k_kseg->kg_lock)
-
-/*
- * Lock a potentially different KSEG.
- */
-#define KSE_SCHED_LOCK(curkse, kseg) \
- KSE_LOCK_ACQUIRE(curkse, &(kseg)->kg_lock)
-#define KSE_SCHED_UNLOCK(curkse, kseg) \
- KSE_LOCK_RELEASE(curkse, &(kseg)->kg_lock)
-
-/*
- * Waiting queue manipulation macros (using pqe link):
- */
-#define KSE_WAITQ_REMOVE(kse, thrd) \
-do { \
- if (((thrd)->flags & THR_FLAGS_IN_WAITQ) != 0) { \
- TAILQ_REMOVE(&(kse)->k_schedq->sq_waitq, thrd, pqe); \
- (thrd)->flags &= ~THR_FLAGS_IN_WAITQ; \
- } \
-} while (0)
-#define KSE_WAITQ_INSERT(kse, thrd) kse_waitq_insert(thrd)
-#define KSE_WAITQ_FIRST(kse) TAILQ_FIRST(&(kse)->k_schedq->sq_waitq)
-
-#define KSE_WAKEUP(kse) kse_wakeup(&(kse)->k_kcb->kcb_kmbx)
-
-/*
- * TailQ initialization values.
- */
-#define TAILQ_INITIALIZER { NULL, NULL }
-
-/*
- * lock initialization values.
- */
-#define LCK_INITIALIZER { NULL, NULL, LCK_DEFAULT }
-
-struct pthread_mutex {
- /*
- * Lock for accesses to this structure.
- */
- struct lock m_lock;
- enum pthread_mutextype m_type;
- int m_protocol;
- TAILQ_HEAD(mutex_head, pthread) m_queue;
- struct pthread *m_owner;
- long m_flags;
- int m_count;
- int m_refcount;
-
- /*
- * Used for priority inheritence and protection.
- *
- * m_prio - For priority inheritence, the highest active
- * priority (threads locking the mutex inherit
- * this priority). For priority protection, the
- * ceiling priority of this mutex.
- * m_saved_prio - mutex owners inherited priority before
- * taking the mutex, restored when the owner
- * unlocks the mutex.
- */
- int m_prio;
- int m_saved_prio;
-
- /*
- * Link for list of all mutexes a thread currently owns.
- */
- TAILQ_ENTRY(pthread_mutex) m_qe;
-};
-
-/*
- * Flags for mutexes.
- */
-#define MUTEX_FLAGS_PRIVATE 0x01
-#define MUTEX_FLAGS_INITED 0x02
-#define MUTEX_FLAGS_BUSY 0x04
-
-/*
- * Static mutex initialization values.
- */
-#define PTHREAD_MUTEX_STATIC_INITIALIZER \
- { LCK_INITIALIZER, PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, \
- TAILQ_INITIALIZER, NULL, MUTEX_FLAGS_PRIVATE, 0, 0, 0, 0, \
- TAILQ_INITIALIZER }
-
-struct pthread_mutex_attr {
- enum pthread_mutextype m_type;
- int m_protocol;
- int m_ceiling;
- long m_flags;
-};
-
-#define PTHREAD_MUTEXATTR_STATIC_INITIALIZER \
- { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, MUTEX_FLAGS_PRIVATE }
-
-/*
- * Condition variable definitions.
- */
-enum pthread_cond_type {
- COND_TYPE_FAST,
- COND_TYPE_MAX
-};
-
-struct pthread_cond {
- /*
- * Lock for accesses to this structure.
- */
- struct lock c_lock;
- enum pthread_cond_type c_type;
- TAILQ_HEAD(cond_head, pthread) c_queue;
- struct pthread_mutex *c_mutex;
- long c_flags;
- long c_seqno;
-};
-
-struct pthread_cond_attr {
- enum pthread_cond_type c_type;
- long c_flags;
-};
-
-struct pthread_barrier {
- pthread_mutex_t b_lock;
- pthread_cond_t b_cond;
- int b_count;
- int b_waiters;
- int b_generation;
-};
-
-struct pthread_barrierattr {
- int pshared;
-};
-
-struct pthread_spinlock {
- volatile int s_lock;
- pthread_t s_owner;
-};
-
-/*
- * Flags for condition variables.
- */
-#define COND_FLAGS_PRIVATE 0x01
-#define COND_FLAGS_INITED 0x02
-#define COND_FLAGS_BUSY 0x04
-
-/*
- * Static cond initialization values.
- */
-#define PTHREAD_COND_STATIC_INITIALIZER \
- { LCK_INITIALIZER, COND_TYPE_FAST, TAILQ_INITIALIZER, \
- NULL, NULL, 0, 0 }
-
-/*
- * Cleanup definitions.
- */
-struct pthread_cleanup {
- struct pthread_cleanup *next;
- void (*routine) ();
- void *routine_arg;
- int onstack;
-};
-
-#define THR_CLEANUP_PUSH(td, func, arg) { \
- struct pthread_cleanup __cup; \
- \
- __cup.routine = func; \
- __cup.routine_arg = arg; \
- __cup.onstack = 1; \
- __cup.next = (td)->cleanup; \
- (td)->cleanup = &__cup;
-
-#define THR_CLEANUP_POP(td, exec) \
- (td)->cleanup = __cup.next; \
- if ((exec) != 0) \
- __cup.routine(__cup.routine_arg); \
-}
-
-struct pthread_atfork {
- TAILQ_ENTRY(pthread_atfork) qe;
- void (*prepare)(void);
- void (*parent)(void);
- void (*child)(void);
-};
-
-struct pthread_attr {
- int sched_policy;
- int sched_inherit;
- int sched_interval;
- int prio;
- int suspend;
-#define THR_STACK_USER 0x100 /* 0xFF reserved for <pthread.h> */
-#define THR_SIGNAL_THREAD 0x200 /* This is a signal thread */
- int flags;
- void *arg_attr;
- void (*cleanup_attr) ();
- void *stackaddr_attr;
- size_t stacksize_attr;
- size_t guardsize_attr;
-};
-
-/*
- * Thread creation state attributes.
- */
-#define THR_CREATE_RUNNING 0
-#define THR_CREATE_SUSPENDED 1
-
-/*
- * Miscellaneous definitions.
- */
-#define THR_STACK32_DEFAULT (1 * 1024 * 1024)
-#define THR_STACK64_DEFAULT (2 * 1024 * 1024)
-
-/*
- * Maximum size of initial thread's stack. This perhaps deserves to be larger
- * than the stacks of other threads, since many applications are likely to run
- * almost entirely on this stack.
- */
-#define THR_STACK32_INITIAL (2 * 1024 * 1024)
-#define THR_STACK64_INITIAL (4 * 1024 * 1024)
-
-/*
- * Define the different priority ranges. All applications have thread
- * priorities constrained within 0-31. The threads library raises the
- * priority when delivering signals in order to ensure that signal
- * delivery happens (from the POSIX spec) "as soon as possible".
- * In the future, the threads library will also be able to map specific
- * threads into real-time (cooperating) processes or kernel threads.
- * The RT and SIGNAL priorities will be used internally and added to
- * thread base priorities so that the scheduling queue can handle both
- * normal and RT priority threads with and without signal handling.
- *
- * The approach taken is that, within each class, signal delivery
- * always has priority over thread execution.
- */
-#define THR_DEFAULT_PRIORITY 15
-#define THR_MIN_PRIORITY 0
-#define THR_MAX_PRIORITY 31 /* 0x1F */
-#define THR_SIGNAL_PRIORITY 32 /* 0x20 */
-#define THR_RT_PRIORITY 64 /* 0x40 */
-#define THR_FIRST_PRIORITY THR_MIN_PRIORITY
-#define THR_LAST_PRIORITY \
- (THR_MAX_PRIORITY + THR_SIGNAL_PRIORITY + THR_RT_PRIORITY)
-#define THR_BASE_PRIORITY(prio) ((prio) & THR_MAX_PRIORITY)
-
-/*
- * Clock resolution in microseconds.
- */
-#define CLOCK_RES_USEC 10000
-
-/*
- * Time slice period in microseconds.
- */
-#define TIMESLICE_USEC 20000
-
-/*
- * XXX - Define a thread-safe macro to get the current time of day
- * which is updated at regular intervals by something.
- *
- * For now, we just make the system call to get the time.
- */
-#define KSE_GET_TOD(curkse, tsp) \
-do { \
- *tsp = (curkse)->k_kcb->kcb_kmbx.km_timeofday; \
- if ((tsp)->tv_sec == 0) \
- clock_gettime(CLOCK_REALTIME, tsp); \
-} while (0)
-
-struct pthread_rwlockattr {
- int pshared;
-};
-
-struct pthread_rwlock {
- pthread_mutex_t lock; /* monitor lock */
- pthread_cond_t read_signal;
- pthread_cond_t write_signal;
- int state; /* 0 = idle >0 = # of readers -1 = writer */
- int blocked_writers;
-};
-
-/*
- * Thread states.
- */
-enum pthread_state {
- PS_RUNNING,
- PS_LOCKWAIT,
- PS_MUTEX_WAIT,
- PS_COND_WAIT,
- PS_SLEEP_WAIT,
- PS_SIGSUSPEND,
- PS_SIGWAIT,
- PS_JOIN,
- PS_SUSPENDED,
- PS_DEAD,
- PS_DEADLOCK,
- PS_STATE_MAX
-};
-
-struct sigwait_data {
- sigset_t *waitset;
- siginfo_t *siginfo; /* used to save siginfo for sigwaitinfo() */
-};
-
-union pthread_wait_data {
- pthread_mutex_t mutex;
- pthread_cond_t cond;
- struct lock *lock;
- struct sigwait_data *sigwait;
-};
-
-/*
- * Define a continuation routine that can be used to perform a
- * transfer of control:
- */
-typedef void (*thread_continuation_t) (void *);
-
-/*
- * This stores a thread's state prior to running a signal handler.
- * It is used when a signal is delivered to a thread blocked in
- * userland. If the signal handler returns normally, the thread's
- * state is restored from here.
- */
-struct pthread_sigframe {
- int psf_valid;
- int psf_flags;
- int psf_cancelflags;
- int psf_interrupted;
- int psf_timeout;
- int psf_signo;
- enum pthread_state psf_state;
- union pthread_wait_data psf_wait_data;
- struct timespec psf_wakeup_time;
- sigset_t psf_sigset;
- sigset_t psf_sigmask;
- int psf_seqno;
- thread_continuation_t psf_continuation;
-};
-
-struct join_status {
- struct pthread *thread;
- void *ret;
- int error;
-};
-
-struct pthread_specific_elem {
- const void *data;
- int seqno;
-};
-
-struct pthread_key {
- volatile int allocated;
- volatile int count;
- int seqno;
- void (*destructor) (void *);
-};
-
-#define MAX_THR_LOCKLEVEL 5
-/*
- * Thread structure.
- */
-struct pthread {
- /* Thread control block */
- struct tcb *tcb;
-
- /*
- * Magic value to help recognize a valid thread structure
- * from an invalid one:
- */
-#define THR_MAGIC ((u_int32_t) 0xd09ba115)
- u_int32_t magic;
- char *name;
- u_int64_t uniqueid; /* for gdb */
-
- /* Queue entry for list of all threads: */
- TAILQ_ENTRY(pthread) tle; /* link for all threads in process */
- TAILQ_ENTRY(pthread) kle; /* link for all threads in KSE/KSEG */
-
- /* Queue entry for GC lists: */
- TAILQ_ENTRY(pthread) gcle;
-
- /* Hash queue entry */
- LIST_ENTRY(pthread) hle;
-
- /*
- * Lock for accesses to this thread structure.
- */
- struct lock lock;
- struct lockuser lockusers[MAX_THR_LOCKLEVEL];
- int locklevel;
- kse_critical_t critical[MAX_KSE_LOCKLEVEL];
- struct kse *kse;
- struct kse_group *kseg;
-
- /*
- * Thread start routine, argument, stack pointer and thread
- * attributes.
- */
- void *(*start_routine)(void *);
- void *arg;
- struct pthread_attr attr;
-
- int active; /* thread running */
- int blocked; /* thread blocked in kernel */
- int need_switchout;
-
- /*
- * Used for tracking delivery of signal handlers.
- */
- siginfo_t *siginfo;
- thread_continuation_t sigbackout;
-
- /*
- * Cancelability flags - the lower 2 bits are used by cancel
- * definitions in pthread.h
- */
-#define THR_AT_CANCEL_POINT 0x0004
-#define THR_CANCELLING 0x0008
-#define THR_CANCEL_NEEDED 0x0010
- int cancelflags;
-
- thread_continuation_t continuation;
-
- /*
- * The thread's base and pending signal masks. The active
- * signal mask is stored in the thread's context (in mailbox).
- */
- sigset_t sigmask;
- sigset_t sigpend;
- sigset_t *oldsigmask;
- volatile int check_pending;
- int refcount;
-
- /* Thread state: */
- enum pthread_state state;
- volatile int lock_switch;
-
- /*
- * Number of microseconds accumulated by this thread when
- * time slicing is active.
- */
- long slice_usec;
-
- /*
- * Time to wake up thread. This is used for sleeping threads and
- * for any operation which may time out (such as select).
- */
- struct timespec wakeup_time;
-
- /* TRUE if operation has timed out. */
- int timeout;
-
- /*
- * Error variable used instead of errno. The function __error()
- * returns a pointer to this.
- */
- int error;
-
- /*
- * The joiner is the thread that is joining to this thread. The
- * join status keeps track of a join operation to another thread.
- */
- struct pthread *joiner;
- struct join_status join_status;
-
- /*
- * The current thread can belong to only one scheduling queue at
- * a time (ready or waiting queue). It can also belong to:
- *
- * o A queue of threads waiting for a mutex
- * o A queue of threads waiting for a condition variable
- *
- * It is possible for a thread to belong to more than one of the
- * above queues if it is handling a signal. A thread may only
- * enter a mutex or condition variable queue when it is not
- * being called from a signal handler. If a thread is a member
- * of one of these queues when a signal handler is invoked, it
- * must be removed from the queue before invoking the handler
- * and then added back to the queue after return from the handler.
- *
- * Use pqe for the scheduling queue link (both ready and waiting),
- * sqe for synchronization (mutex, condition variable, and join)
- * queue links, and qe for all other links.
- */
- TAILQ_ENTRY(pthread) pqe; /* priority, wait queues link */
- TAILQ_ENTRY(pthread) sqe; /* synchronization queue link */
-
- /* Wait data. */
- union pthread_wait_data data;
-
- /*
- * Set to TRUE if a blocking operation was
- * interrupted by a signal:
- */
- int interrupted;
-
- /*
- * Set to non-zero when this thread has entered a critical
- * region. We allow for recursive entries into critical regions.
- */
- int critical_count;
-
- /*
- * Set to TRUE if this thread should yield after leaving a
- * critical region to check for signals, messages, etc.
- */
- int critical_yield;
-
- int sflags;
-#define THR_FLAGS_IN_SYNCQ 0x0001
-
- /* Miscellaneous flags; only set with scheduling lock held. */
- int flags;
-#define THR_FLAGS_PRIVATE 0x0001
-#define THR_FLAGS_IN_WAITQ 0x0002 /* in waiting queue using pqe link */
-#define THR_FLAGS_IN_RUNQ 0x0004 /* in run queue using pqe link */
-#define THR_FLAGS_EXITING 0x0008 /* thread is exiting */
-#define THR_FLAGS_SUSPENDED 0x0010 /* thread is suspended */
-
- /* Thread list flags; only set with thread list lock held. */
-#define TLFLAGS_GC_SAFE 0x0001 /* thread safe for cleaning */
-#define TLFLAGS_IN_TDLIST 0x0002 /* thread in all thread list */
-#define TLFLAGS_IN_GCLIST 0x0004 /* thread in gc list */
- int tlflags;
-
- /*
- * Base priority is the user setable and retrievable priority
- * of the thread. It is only affected by explicit calls to
- * set thread priority and upon thread creation via a thread
- * attribute or default priority.
- */
- char base_priority;
-
- /*
- * Inherited priority is the priority a thread inherits by
- * taking a priority inheritence or protection mutex. It
- * is not affected by base priority changes. Inherited
- * priority defaults to and remains 0 until a mutex is taken
- * that is being waited on by any other thread whose priority
- * is non-zero.
- */
- char inherited_priority;
-
- /*
- * Active priority is always the maximum of the threads base
- * priority and inherited priority. When there is a change
- * in either the base or inherited priority, the active
- * priority must be recalculated.
- */
- char active_priority;
-
- /* Number of priority ceiling or protection mutexes owned. */
- int priority_mutex_count;
-
- /* Number rwlocks rdlocks held. */
- int rdlock_count;
-
- /*
- * Queue of currently owned mutexes.
- */
- TAILQ_HEAD(, pthread_mutex) mutexq;
-
- void *ret;
- struct pthread_specific_elem *specific;
- int specific_data_count;
-
- /* Alternative stack for sigaltstack() */
- stack_t sigstk;
-
- /*
- * Current locks bitmap for rtld.
- */
- int rtld_bits;
-
- /* Cleanup handlers Link List */
- struct pthread_cleanup *cleanup;
- char *fname; /* Ptr to source file name */
- int lineno; /* Source line number. */
-};
-
-/*
- * Critical regions can also be detected by looking at the threads
- * current lock level. Ensure these macros increment and decrement
- * the lock levels such that locks can not be held with a lock level
- * of 0.
- */
-#define THR_IN_CRITICAL(thrd) \
- (((thrd)->locklevel > 0) || \
- ((thrd)->critical_count > 0))
-
-#define THR_YIELD_CHECK(thrd) \
-do { \
- if (!THR_IN_CRITICAL(thrd)) { \
- if (__predict_false(_libkse_debug)) \
- _thr_debug_check_yield(thrd); \
- if ((thrd)->critical_yield != 0) \
- _thr_sched_switch(thrd); \
- if ((thrd)->check_pending != 0) \
- _thr_sig_check_pending(thrd); \
- } \
-} while (0)
-
-#define THR_LOCK_ACQUIRE(thrd, lck) \
-do { \
- if ((thrd)->locklevel < MAX_THR_LOCKLEVEL) { \
- THR_DEACTIVATE_LAST_LOCK(thrd); \
- (thrd)->locklevel++; \
- _lock_acquire((lck), \
- &(thrd)->lockusers[(thrd)->locklevel - 1], \
- (thrd)->active_priority); \
- } else \
- PANIC("Exceeded maximum lock level"); \
-} while (0)
-
-#define THR_LOCK_RELEASE(thrd, lck) \
-do { \
- if ((thrd)->locklevel > 0) { \
- _lock_release((lck), \
- &(thrd)->lockusers[(thrd)->locklevel - 1]); \
- (thrd)->locklevel--; \
- THR_ACTIVATE_LAST_LOCK(thrd); \
- if ((thrd)->locklevel == 0) \
- THR_YIELD_CHECK(thrd); \
- } \
-} while (0)
-
-#define THR_ACTIVATE_LAST_LOCK(thrd) \
-do { \
- if ((thrd)->locklevel > 0) \
- _lockuser_setactive( \
- &(thrd)->lockusers[(thrd)->locklevel - 1], 1); \
-} while (0)
-
-#define THR_DEACTIVATE_LAST_LOCK(thrd) \
-do { \
- if ((thrd)->locklevel > 0) \
- _lockuser_setactive( \
- &(thrd)->lockusers[(thrd)->locklevel - 1], 0); \
-} while (0)
-
-/*
- * For now, threads will have their own lock separate from their
- * KSE scheduling lock.
- */
-#define THR_LOCK(thr) THR_LOCK_ACQUIRE(thr, &(thr)->lock)
-#define THR_UNLOCK(thr) THR_LOCK_RELEASE(thr, &(thr)->lock)
-#define THR_THREAD_LOCK(curthrd, thr) THR_LOCK_ACQUIRE(curthrd, &(thr)->lock)
-#define THR_THREAD_UNLOCK(curthrd, thr) THR_LOCK_RELEASE(curthrd, &(thr)->lock)
-
-/*
- * Priority queue manipulation macros (using pqe link). We use
- * the thread's kseg link instead of the kse link because a thread
- * does not (currently) have a statically assigned kse.
- */
-#define THR_RUNQ_INSERT_HEAD(thrd) \
- _pq_insert_head(&(thrd)->kseg->kg_schedq.sq_runq, thrd)
-#define THR_RUNQ_INSERT_TAIL(thrd) \
- _pq_insert_tail(&(thrd)->kseg->kg_schedq.sq_runq, thrd)
-#define THR_RUNQ_REMOVE(thrd) \
- _pq_remove(&(thrd)->kseg->kg_schedq.sq_runq, thrd)
-
-/*
- * Macros to insert/remove threads to the all thread list and
- * the gc list.
- */
-#define THR_LIST_ADD(thrd) do { \
- if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) == 0) { \
- TAILQ_INSERT_HEAD(&_thread_list, thrd, tle); \
- _thr_hash_add(thrd); \
- (thrd)->tlflags |= TLFLAGS_IN_TDLIST; \
- } \
-} while (0)
-#define THR_LIST_REMOVE(thrd) do { \
- if (((thrd)->tlflags & TLFLAGS_IN_TDLIST) != 0) { \
- TAILQ_REMOVE(&_thread_list, thrd, tle); \
- _thr_hash_remove(thrd); \
- (thrd)->tlflags &= ~TLFLAGS_IN_TDLIST; \
- } \
-} while (0)
-#define THR_GCLIST_ADD(thrd) do { \
- if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) == 0) { \
- TAILQ_INSERT_HEAD(&_thread_gc_list, thrd, gcle);\
- (thrd)->tlflags |= TLFLAGS_IN_GCLIST; \
- _gc_count++; \
- } \
-} while (0)
-#define THR_GCLIST_REMOVE(thrd) do { \
- if (((thrd)->tlflags & TLFLAGS_IN_GCLIST) != 0) { \
- TAILQ_REMOVE(&_thread_gc_list, thrd, gcle); \
- (thrd)->tlflags &= ~TLFLAGS_IN_GCLIST; \
- _gc_count--; \
- } \
-} while (0)
-
-#define GC_NEEDED() (atomic_load_acq_int(&_gc_count) >= 5)
-
-/*
- * Locking the scheduling queue for another thread uses that thread's
- * KSEG lock.
- */
-#define THR_SCHED_LOCK(curthr, thr) do { \
- (curthr)->critical[(curthr)->locklevel] = _kse_critical_enter(); \
- (curthr)->locklevel++; \
- KSE_SCHED_LOCK((curthr)->kse, (thr)->kseg); \
-} while (0)
-
-#define THR_SCHED_UNLOCK(curthr, thr) do { \
- KSE_SCHED_UNLOCK((curthr)->kse, (thr)->kseg); \
- (curthr)->locklevel--; \
- _kse_critical_leave((curthr)->critical[(curthr)->locklevel]); \
-} while (0)
-
-/* Take the scheduling lock with the intent to call the scheduler. */
-#define THR_LOCK_SWITCH(curthr) do { \
- (void)_kse_critical_enter(); \
- KSE_SCHED_LOCK((curthr)->kse, (curthr)->kseg); \
-} while (0)
-#define THR_UNLOCK_SWITCH(curthr) do { \
- KSE_SCHED_UNLOCK((curthr)->kse, (curthr)->kseg);\
-} while (0)
-
-#define THR_CRITICAL_ENTER(thr) (thr)->critical_count++
-#define THR_CRITICAL_LEAVE(thr) do { \
- (thr)->critical_count--; \
- if (((thr)->critical_yield != 0) && \
- ((thr)->critical_count == 0)) { \
- (thr)->critical_yield = 0; \
- _thr_sched_switch(thr); \
- } \
-} while (0)
-
-#define THR_IS_ACTIVE(thrd) \
- ((thrd)->kse != NULL) && ((thrd)->kse->k_curthread == (thrd))
-
-#define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0)
-
-#define THR_IS_SUSPENDED(thrd) \
- (((thrd)->state == PS_SUSPENDED) || \
- (((thrd)->flags & THR_FLAGS_SUSPENDED) != 0))
-#define THR_IS_EXITING(thrd) (((thrd)->flags & THR_FLAGS_EXITING) != 0)
-#define DBG_CAN_RUN(thrd) (((thrd)->tcb->tcb_tmbx.tm_dflags & \
- TMDF_SUSPEND) == 0)
-
-extern int __isthreaded;
-
-static inline int
-_kse_isthreaded(void)
-{
- return (__isthreaded != 0);
-}
-
-/*
- * Global variables for the pthread kernel.
- */
-
-SCLASS void *_usrstack SCLASS_PRESET(NULL);
-SCLASS struct kse *_kse_initial SCLASS_PRESET(NULL);
-SCLASS struct pthread *_thr_initial SCLASS_PRESET(NULL);
-/* For debugger */
-SCLASS int _libkse_debug SCLASS_PRESET(0);
-SCLASS int _thread_activated SCLASS_PRESET(0);
-SCLASS int _thread_scope_system SCLASS_PRESET(0);
-
-/* List of all threads: */
-SCLASS TAILQ_HEAD(, pthread) _thread_list
- SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_list));
-
-/* List of threads needing GC: */
-SCLASS TAILQ_HEAD(, pthread) _thread_gc_list
- SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_gc_list));
-
-SCLASS int _thread_active_threads SCLASS_PRESET(1);
-
-SCLASS TAILQ_HEAD(atfork_head, pthread_atfork) _thr_atfork_list;
-SCLASS pthread_mutex_t _thr_atfork_mutex;
-
-/* Default thread attributes: */
-SCLASS struct pthread_attr _pthread_attr_default
- SCLASS_PRESET({
- SCHED_RR, 0, TIMESLICE_USEC, THR_DEFAULT_PRIORITY,
- THR_CREATE_RUNNING, PTHREAD_CREATE_JOINABLE, NULL,
- NULL, NULL, /* stacksize */0, /* guardsize */0
- });
-
-/* Default mutex attributes: */
-SCLASS struct pthread_mutex_attr _pthread_mutexattr_default
- SCLASS_PRESET({PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 });
-
-/* Default condition variable attributes: */
-SCLASS struct pthread_cond_attr _pthread_condattr_default
- SCLASS_PRESET({COND_TYPE_FAST, 0});
-
-/* Clock resolution in usec. */
-SCLASS int _clock_res_usec SCLASS_PRESET(CLOCK_RES_USEC);
-
-/* Array of signal actions for this process: */
-SCLASS struct sigaction _thread_sigact[_SIG_MAXSIG];
-
-/*
- * Lock for above count of dummy handlers and for the process signal
- * mask and pending signal sets.
- */
-SCLASS struct lock _thread_signal_lock;
-
-/* Pending signals and mask for this process: */
-SCLASS sigset_t _thr_proc_sigpending;
-SCLASS siginfo_t _thr_proc_siginfo[_SIG_MAXSIG];
-
-SCLASS pid_t _thr_pid SCLASS_PRESET(0);
-
-/* Garbage collector lock. */
-SCLASS struct lock _gc_lock;
-SCLASS int _gc_check SCLASS_PRESET(0);
-SCLASS int _gc_count SCLASS_PRESET(0);
-
-SCLASS struct lock _mutex_static_lock;
-SCLASS struct lock _rwlock_static_lock;
-SCLASS struct lock _keytable_lock;
-SCLASS struct lock _thread_list_lock;
-SCLASS int _thr_guard_default;
-SCLASS int _thr_stack_default;
-SCLASS int _thr_stack_initial;
-SCLASS int _thr_page_size;
-SCLASS pthread_t _thr_sig_daemon;
-SCLASS int _thr_debug_flags SCLASS_PRESET(0);
-
-/* Undefine the storage class and preset specifiers: */
-#undef SCLASS
-#undef SCLASS_PRESET
-
-
-/*
- * Function prototype definitions.
- */
-__BEGIN_DECLS
-int _cond_reinit(pthread_cond_t *);
-struct kse *_kse_alloc(struct pthread *, int sys_scope);
-kse_critical_t _kse_critical_enter(void);
-void _kse_critical_leave(kse_critical_t);
-int _kse_in_critical(void);
-void _kse_free(struct pthread *, struct kse *);
-void _kse_init();
-struct kse_group *_kseg_alloc(struct pthread *);
-void _kse_lock_wait(struct lock *, struct lockuser *lu);
-void _kse_lock_wakeup(struct lock *, struct lockuser *lu);
-void _kse_single_thread(struct pthread *);
-int _kse_setthreaded(int);
-void _kseg_free(struct kse_group *);
-int _mutex_cv_lock(pthread_mutex_t *);
-int _mutex_cv_unlock(pthread_mutex_t *);
-void _mutex_notify_priochange(struct pthread *, struct pthread *, int);
-int _mutex_reinit(struct pthread_mutex *);
-void _mutex_unlock_private(struct pthread *);
-void _libpthread_init(struct pthread *);
-int _pq_alloc(struct pq_queue *, int, int);
-void _pq_free(struct pq_queue *);
-int _pq_init(struct pq_queue *);
-void _pq_remove(struct pq_queue *pq, struct pthread *);
-void _pq_insert_head(struct pq_queue *pq, struct pthread *);
-void _pq_insert_tail(struct pq_queue *pq, struct pthread *);
-struct pthread *_pq_first(struct pq_queue *pq);
-struct pthread *_pq_first_debug(struct pq_queue *pq);
-void *_pthread_getspecific(pthread_key_t);
-int _pthread_key_create(pthread_key_t *, void (*) (void *));
-int _pthread_key_delete(pthread_key_t);
-int _pthread_mutex_destroy(pthread_mutex_t *);
-int _pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
-int _pthread_mutex_lock(pthread_mutex_t *);
-int _pthread_mutex_trylock(pthread_mutex_t *);
-int _pthread_mutex_unlock(pthread_mutex_t *);
-int _pthread_mutexattr_init(pthread_mutexattr_t *);
-int _pthread_mutexattr_destroy(pthread_mutexattr_t *);
-int _pthread_mutexattr_settype(pthread_mutexattr_t *, int);
-int _pthread_once(pthread_once_t *, void (*) (void));
-int _pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *);
-int _pthread_rwlock_destroy (pthread_rwlock_t *);
-struct pthread *_pthread_self(void);
-int _pthread_setspecific(pthread_key_t, const void *);
-void _pthread_yield(void);
-void _pthread_cleanup_push(void (*routine) (void *), void *routine_arg);
-void _pthread_cleanup_pop(int execute);
-struct pthread *_thr_alloc(struct pthread *);
-void _thr_exit(char *, int, char *);
-void _thr_exit_cleanup(void);
-void _thr_lock_wait(struct lock *lock, struct lockuser *lu);
-void _thr_lock_wakeup(struct lock *lock, struct lockuser *lu);
-void _thr_mutex_reinit(pthread_mutex_t *);
-int _thr_ref_add(struct pthread *, struct pthread *, int);
-void _thr_ref_delete(struct pthread *, struct pthread *);
-void _thr_rtld_init(void);
-void _thr_rtld_fini(void);
-int _thr_schedule_add(struct pthread *, struct pthread *);
-void _thr_schedule_remove(struct pthread *, struct pthread *);
-void _thr_setrunnable(struct pthread *curthread, struct pthread *thread);
-struct kse_mailbox *_thr_setrunnable_unlocked(struct pthread *thread);
-struct kse_mailbox *_thr_sig_add(struct pthread *, int, siginfo_t *);
-void _thr_sig_dispatch(struct kse *, int, siginfo_t *);
-int _thr_stack_alloc(struct pthread_attr *);
-void _thr_stack_free(struct pthread_attr *);
-void _thr_exit_cleanup(void);
-void _thr_free(struct pthread *, struct pthread *);
-void _thr_gc(struct pthread *);
-void _thr_panic_exit(char *, int, char *);
-void _thread_cleanupspecific(void);
-void _thread_dump_info(void);
-void _thread_printf(int, const char *, ...);
-void _thr_sched_switch(struct pthread *);
-void _thr_sched_switch_unlocked(struct pthread *);
-void _thr_set_timeout(const struct timespec *);
-void _thr_seterrno(struct pthread *, int);
-void _thr_sig_handler(int, siginfo_t *, ucontext_t *);
-void _thr_sig_check_pending(struct pthread *);
-void _thr_sig_rundown(struct pthread *, ucontext_t *);
-void _thr_sig_send(struct pthread *pthread, int sig);
-void _thr_sigframe_restore(struct pthread *thread, struct pthread_sigframe *psf);
-void _thr_spinlock_init(void);
-void _thr_cancel_enter(struct pthread *);
-void _thr_cancel_leave(struct pthread *, int);
-int _thr_setconcurrency(int new_level);
-int _thr_setmaxconcurrency(void);
-void _thr_critical_enter(struct pthread *);
-void _thr_critical_leave(struct pthread *);
-int _thr_start_sig_daemon(void);
-int _thr_getprocsig(int sig, siginfo_t *siginfo);
-int _thr_getprocsig_unlocked(int sig, siginfo_t *siginfo);
-void _thr_signal_init(void);
-void _thr_signal_deinit(void);
-void _thr_hash_add(struct pthread *);
-void _thr_hash_remove(struct pthread *);
-struct pthread *_thr_hash_find(struct pthread *);
-void _thr_finish_cancellation(void *arg);
-int _thr_sigonstack(void *sp);
-void _thr_debug_check_yield(struct pthread *);
-
-/*
- * Aliases for _pthread functions. Should be called instead of
- * originals if PLT replocation is unwanted at runtme.
- */
-int _thr_cond_broadcast(pthread_cond_t *);
-int _thr_cond_signal(pthread_cond_t *);
-int _thr_cond_wait(pthread_cond_t *, pthread_mutex_t *);
-int _thr_mutex_lock(pthread_mutex_t *);
-int _thr_mutex_unlock(pthread_mutex_t *);
-int _thr_rwlock_rdlock (pthread_rwlock_t *);
-int _thr_rwlock_wrlock (pthread_rwlock_t *);
-int _thr_rwlock_unlock (pthread_rwlock_t *);
-
-/* #include <sys/aio.h> */
-#ifdef _SYS_AIO_H_
-int __sys_aio_suspend(const struct aiocb * const[], int, const struct timespec *);
-#endif
-
-/* #include <fcntl.h> */
-#ifdef _SYS_FCNTL_H_
-int __sys_fcntl(int, int, ...);
-int __sys_open(const char *, int, ...);
-#endif
-
-/* #include <sys/ioctl.h> */
-#ifdef _SYS_IOCTL_H_
-int __sys_ioctl(int, unsigned long, ...);
-#endif
-
-/* #inclde <sched.h> */
-#ifdef _SCHED_H_
-int __sys_sched_yield(void);
-#endif
-
-/* #include <signal.h> */
-#ifdef _SIGNAL_H_
-int __sys_kill(pid_t, int);
-int __sys_sigaction(int, const struct sigaction *, struct sigaction *);
-int __sys_sigpending(sigset_t *);
-int __sys_sigprocmask(int, const sigset_t *, sigset_t *);
-int __sys_sigsuspend(const sigset_t *);
-int __sys_sigreturn(ucontext_t *);
-int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *);
-#endif
-
-/* #include <sys/socket.h> */
-#ifdef _SYS_SOCKET_H_
-int __sys_accept(int, struct sockaddr *, socklen_t *);
-int __sys_connect(int, const struct sockaddr *, socklen_t);
-int __sys_sendfile(int, int, off_t, size_t, struct sf_hdtr *,
- off_t *, int);
-#endif
-
-/* #include <sys/uio.h> */
-#ifdef _SYS_UIO_H_
-ssize_t __sys_readv(int, const struct iovec *, int);
-ssize_t __sys_writev(int, const struct iovec *, int);
-#endif
-
-/* #include <time.h> */
-#ifdef _TIME_H_
-int __sys_nanosleep(const struct timespec *, struct timespec *);
-#endif
-
-/* #include <unistd.h> */
-#ifdef _UNISTD_H_
-int __sys_close(int);
-int __sys_execve(const char *, char * const *, char * const *);
-int __sys_fork(void);
-int __sys_fsync(int);
-pid_t __sys_getpid(void);
-int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
-ssize_t __sys_read(int, void *, size_t);
-ssize_t __sys_write(int, const void *, size_t);
-void __sys_exit(int);
-int __sys_sigwait(const sigset_t *, int *);
-int __sys_sigtimedwait(sigset_t *, siginfo_t *, struct timespec *);
-#endif
-
-/* #include <poll.h> */
-#ifdef _SYS_POLL_H_
-int __sys_poll(struct pollfd *, unsigned, int);
-#endif
-
-/* #include <sys/mman.h> */
-#ifdef _SYS_MMAN_H_
-int __sys_msync(void *, size_t, int);
-#endif
-
-#endif /* !_THR_PRIVATE_H */
diff --git a/lib/libkse/thread/thr_pselect.c b/lib/libkse/thread/thr_pselect.c
deleted file mode 100644
index ce7a530..0000000
--- a/lib/libkse/thread/thr_pselect.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * Copyright (c) 2002 Daniel M. Eischen <deischen@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/select.h>
-#include <sys/time.h>
-
-#include <errno.h>
-#include <signal.h>
-#include <pthread.h>
-
-#include "thr_private.h"
-
-extern int __pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
- const struct timespec *timo, const sigset_t *mask);
-
-__weak_reference(_pselect, pselect);
-
-int
-_pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
- const struct timespec *timo, const sigset_t *mask)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = __pselect(count, rfds, wfds, efds, timo, mask);
- _thr_cancel_leave(curthread, 1);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_pspinlock.c b/lib/libkse/thread/thr_pspinlock.c
deleted file mode 100644
index b58d712..0000000
--- a/lib/libkse/thread/thr_pspinlock.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*-
- * Copyright (c) 2003 David Xu <davidxu@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <atomic_ops.h>
-#include "thr_private.h"
-
-#define SPIN_COUNT 10000
-
-__weak_reference(_pthread_spin_init, pthread_spin_init);
-__weak_reference(_pthread_spin_destroy, pthread_spin_destroy);
-__weak_reference(_pthread_spin_trylock, pthread_spin_trylock);
-__weak_reference(_pthread_spin_lock, pthread_spin_lock);
-__weak_reference(_pthread_spin_unlock, pthread_spin_unlock);
-
-int
-_pthread_spin_init(pthread_spinlock_t *lock, int pshared)
-{
- struct pthread_spinlock *lck;
- int ret;
-
- if (lock == NULL || pshared != PTHREAD_PROCESS_PRIVATE)
- ret = EINVAL;
- else if ((lck = malloc(sizeof(struct pthread_spinlock))) == NULL)
- ret = ENOMEM;
- else {
- lck->s_lock = 0;
- lck->s_owner= NULL;
- *lock = lck;
- ret = 0;
- }
-
- return (ret);
-}
-
-int
-_pthread_spin_destroy(pthread_spinlock_t *lock)
-{
- int ret;
-
- if (lock == NULL || *lock == NULL)
- ret = EINVAL;
- else if ((*lock)->s_owner != NULL)
- ret = EBUSY;
- else {
- free(*lock);
- *lock = NULL;
- ret = 0;
- }
-
- return (ret);
-}
-
-int
-_pthread_spin_trylock(pthread_spinlock_t *lock)
-{
- struct pthread_spinlock *lck;
- struct pthread *self = _pthread_self();
- int oldval, ret;
-
- if (lock == NULL || (lck = *lock) == NULL)
- ret = EINVAL;
- else if (lck->s_owner == self)
- ret = EDEADLK;
- else if (lck->s_lock != 0)
- ret = EBUSY;
- else {
- atomic_swap_int((int *)&(lck)->s_lock, 1, &oldval);
- if (oldval)
- ret = EBUSY;
- else {
- lck->s_owner = _pthread_self();
- ret = 0;
- }
- }
- return (ret);
-}
-
-int
-_pthread_spin_lock(pthread_spinlock_t *lock)
-{
- struct pthread_spinlock *lck;
- struct pthread *self = _pthread_self();
- int count, oldval, ret;
-
- if (lock == NULL || (lck = *lock) == NULL)
- ret = EINVAL;
- else if (lck->s_owner == self)
- ret = EDEADLK;
- else {
- do {
- count = SPIN_COUNT;
- while (lck->s_lock) {
-#ifdef __i386__
- /* tell cpu we are spinning */
- __asm __volatile("pause");
-#endif
- if (--count <= 0) {
- count = SPIN_COUNT;
- _pthread_yield();
- }
- }
- atomic_swap_int((int *)&(lck)->s_lock, 1, &oldval);
- } while (oldval);
-
- lck->s_owner = self;
- ret = 0;
- }
-
- return (ret);
-}
-
-int
-_pthread_spin_unlock(pthread_spinlock_t *lock)
-{
- struct pthread_spinlock *lck;
- int ret;
-
- if (lock == NULL || (lck = *lock) == NULL)
- ret = EINVAL;
- else {
- if (lck->s_owner != _pthread_self())
- ret = EPERM;
- else {
- lck->s_owner = NULL;
- atomic_swap_int((int *)&lck->s_lock, 0, &ret);
- ret = 0;
- }
- }
-
- return (ret);
-}
-
diff --git a/lib/libkse/thread/thr_raise.c b/lib/libkse/thread/thr_raise.c
deleted file mode 100644
index 0554fa4..0000000
--- a/lib/libkse/thread/thr_raise.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2003 David Xu<davidxu@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <pthread.h>
-#include <errno.h>
-#include "thr_private.h"
-
-__weak_reference(_raise, raise);
-
-int
-_raise(int sig)
-{
- int ret;
-
- if (!_kse_isthreaded())
- ret = kill(getpid(), sig);
- else {
- ret = pthread_kill(pthread_self(), sig);
- if (ret != 0) {
- errno = ret;
- ret = -1;
- }
- }
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_read.c b/lib/libkse/thread/thr_read.c
deleted file mode 100644
index c0391c5..0000000
--- a/lib/libkse/thread/thr_read.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- *
- */
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/uio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__read, read);
-
-ssize_t
-__read(int fd, void *buf, size_t nbytes)
-{
- struct pthread *curthread = _get_curthread();
- ssize_t ret;
-
- _thr_cancel_enter(curthread);
- ret = __sys_read(fd, buf, nbytes);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_readv.c b/lib/libkse/thread/thr_readv.c
deleted file mode 100644
index eb0e54a..0000000
--- a/lib/libkse/thread/thr_readv.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- *
- */
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/uio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__readv, readv);
-
-ssize_t
-__readv(int fd, const struct iovec *iov, int iovcnt)
-{
- struct pthread *curthread = _get_curthread();
- ssize_t ret;
-
- _thr_cancel_enter(curthread);
- ret = __sys_readv(fd, iov, iovcnt);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_resume_np.c b/lib/libkse/thread/thr_resume_np.c
deleted file mode 100644
index ba9b911..0000000
--- a/lib/libkse/thread/thr_resume_np.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-static struct kse_mailbox *resume_common(struct pthread *);
-
-__weak_reference(_pthread_resume_np, pthread_resume_np);
-__weak_reference(_pthread_resume_all_np, pthread_resume_all_np);
-
-
-/* Resume a thread: */
-int
-_pthread_resume_np(pthread_t thread)
-{
- struct pthread *curthread = _get_curthread();
- struct kse_mailbox *kmbx;
- int ret;
-
- /* Add a reference to the thread: */
- if ((ret = _thr_ref_add(curthread, thread, /*include dead*/0)) == 0) {
- /* Lock the threads scheduling queue: */
- THR_SCHED_LOCK(curthread, thread);
- kmbx = resume_common(thread);
- THR_SCHED_UNLOCK(curthread, thread);
- _thr_ref_delete(curthread, thread);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- }
- return (ret);
-}
-
-void
-_pthread_resume_all_np(void)
-{
- struct pthread *curthread = _get_curthread();
- struct pthread *thread;
- struct kse_mailbox *kmbx;
- kse_critical_t crit;
-
- /* Take the thread list lock: */
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &_thread_list_lock);
-
- TAILQ_FOREACH(thread, &_thread_list, tle) {
- if (thread != curthread) {
- THR_SCHED_LOCK(curthread, thread);
- kmbx = resume_common(thread);
- THR_SCHED_UNLOCK(curthread, thread);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- }
- }
-
- /* Release the thread list lock: */
- KSE_LOCK_RELEASE(curthread->kse, &_thread_list_lock);
- _kse_critical_leave(crit);
-}
-
-static struct kse_mailbox *
-resume_common(struct pthread *thread)
-{
- /* Clear the suspend flag: */
- thread->flags &= ~THR_FLAGS_SUSPENDED;
-
- /*
- * If the thread's state is suspended, that means it is
- * now runnable but not in any scheduling queue. Set the
- * state to running and insert it into the run queue.
- */
- if (thread->state == PS_SUSPENDED)
- return (_thr_setrunnable_unlocked(thread));
- else
- return (NULL);
-}
diff --git a/lib/libkse/thread/thr_rtld.c b/lib/libkse/thread/thr_rtld.c
deleted file mode 100644
index 9528593..0000000
--- a/lib/libkse/thread/thr_rtld.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright (c) 2001 Alexander Kabaev
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that 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 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.
- *
- * $FreeBSD$
- */
-#include <sys/cdefs.h>
-#include <stdlib.h>
-
-#include "rtld_lock.h"
-#include "thr_private.h"
-
-static int _thr_rtld_clr_flag(int);
-static void *_thr_rtld_lock_create(void);
-static void _thr_rtld_lock_destroy(void *);
-static void _thr_rtld_lock_release(void *);
-static void _thr_rtld_rlock_acquire(void *);
-static int _thr_rtld_set_flag(int);
-static void _thr_rtld_wlock_acquire(void *);
-
-#ifdef NOTYET
-static void *
-_thr_rtld_lock_create(void)
-{
- pthread_rwlock_t prwlock;
- if (_pthread_rwlock_init(&prwlock, NULL))
- return (NULL);
- return (prwlock);
-}
-
-static void
-_thr_rtld_lock_destroy(void *lock)
-{
- pthread_rwlock_t prwlock;
-
- prwlock = (pthread_rwlock_t)lock;
- if (prwlock != NULL)
- _pthread_rwlock_destroy(&prwlock);
-}
-
-static void
-_thr_rtld_rlock_acquire(void *lock)
-{
- pthread_rwlock_t prwlock;
-
- prwlock = (pthread_rwlock_t)lock;
- _thr_rwlock_rdlock(&prwlock);
-}
-
-static void
-_thr_rtld_wlock_acquire(void *lock)
-{
- pthread_rwlock_t prwlock;
-
- prwlock = (pthread_rwlock_t)lock;
- _thr_rwlock_wrlock(&prwlock);
-}
-
-static void
-_thr_rtld_lock_release(void *lock)
-{
- pthread_rwlock_t prwlock;
-
- prwlock = (pthread_rwlock_t)lock;
- _thr_rwlock_unlock(&prwlock);
-}
-
-
-static int
-_thr_rtld_set_flag(int mask)
-{
- struct pthread *curthread;
- int bits;
-
- curthread = _get_curthread();
- if (curthread != NULL) {
- bits = curthread->rtld_bits;
- curthread->rtld_bits |= mask;
- } else {
- bits = 0;
- PANIC("No current thread in rtld call");
- }
-
- return (bits);
-}
-
-static int
-_thr_rtld_clr_flag(int mask)
-{
- struct pthread *curthread;
- int bits;
-
- curthread = _get_curthread();
- if (curthread != NULL) {
- bits = curthread->rtld_bits;
- curthread->rtld_bits &= ~mask;
- } else {
- bits = 0;
- PANIC("No current thread in rtld call");
- }
- return (bits);
-}
-
-void
-_thr_rtld_init(void)
-{
- struct RtldLockInfo li;
-
- li.lock_create = _thr_rtld_lock_create;
- li.lock_destroy = _thr_rtld_lock_destroy;
- li.rlock_acquire = _thr_rtld_rlock_acquire;
- li.wlock_acquire = _thr_rtld_wlock_acquire;
- li.lock_release = _thr_rtld_lock_release;
- li.thread_set_flag = _thr_rtld_set_flag;
- li.thread_clr_flag = _thr_rtld_clr_flag;
- li.at_fork = NULL;
- _rtld_thread_init(&li);
-}
-
-void
-_thr_rtld_fini(void)
-{
- _rtld_thread_init(NULL);
-}
-#endif
-
-struct rtld_kse_lock {
- struct lock lck;
- struct kse *owner;
- kse_critical_t crit;
- int count;
- int write;
-};
-
-static void *
-_thr_rtld_lock_create(void)
-{
- struct rtld_kse_lock *l;
-
- l = malloc(sizeof(struct rtld_kse_lock));
- _lock_init(&l->lck, LCK_ADAPTIVE, _kse_lock_wait, _kse_lock_wakeup);
- l->owner = NULL;
- l->count = 0;
- l->write = 0;
- return (l);
-}
-
-static void
-_thr_rtld_lock_destroy(void *lock)
-{
- /* XXX We really can not free memory after a fork() */
-#if 0
- struct rtld_kse_lock *l;
-
- l = (struct rtld_kse_lock *)lock;
- _lock_destroy(&l->lck);
- free(l);
-#endif
- return;
-}
-
-static void
-_thr_rtld_rlock_acquire(void *lock)
-{
- struct rtld_kse_lock *l;
- kse_critical_t crit;
- struct kse *curkse;
-
- l = (struct rtld_kse_lock *)lock;
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- if (l->owner == curkse) {
- l->count++;
- _kse_critical_leave(crit); /* probably not necessary */
- } else {
- KSE_LOCK_ACQUIRE(curkse, &l->lck);
- l->crit = crit;
- l->owner = curkse;
- l->count = 1;
- l->write = 0;
- }
-}
-
-static void
-_thr_rtld_wlock_acquire(void *lock)
-{
- struct rtld_kse_lock *l;
- kse_critical_t crit;
- struct kse *curkse;
-
- l = (struct rtld_kse_lock *)lock;
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- if (l->owner == curkse) {
- _kse_critical_leave(crit);
- PANIC("Recursive write lock attempt on rtld lock");
- } else {
- KSE_LOCK_ACQUIRE(curkse, &l->lck);
- l->crit = crit;
- l->owner = curkse;
- l->count = 1;
- l->write = 1;
- }
-}
-
-static void
-_thr_rtld_lock_release(void *lock)
-{
- struct rtld_kse_lock *l;
- kse_critical_t crit;
- struct kse *curkse;
-
- l = (struct rtld_kse_lock *)lock;
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- if (l->owner != curkse) {
- /*
- * We might want to forcibly unlock the rtld lock
- * and/or disable threaded mode so there is better
- * chance that the panic will work. Otherwise,
- * we could end up trying to take the rtld lock
- * again.
- */
- _kse_critical_leave(crit);
- PANIC("Attempt to unlock rtld lock when not owner.");
- } else {
- l->count--;
- if (l->count == 0) {
- /*
- * If there ever is a count associated with
- * _kse_critical_leave(), we'll need to add
- * another call to it here with the crit
- * value from above.
- */
- crit = l->crit;
- l->owner = NULL;
- l->write = 0;
- KSE_LOCK_RELEASE(curkse, &l->lck);
- }
- _kse_critical_leave(crit);
- }
-}
-
-
-static int
-_thr_rtld_set_flag(int mask)
-{
- return (0);
-}
-
-static int
-_thr_rtld_clr_flag(int mask)
-{
- return (0);
-}
-
-void
-_thr_rtld_init(void)
-{
- struct RtldLockInfo li;
-
- li.lock_create = _thr_rtld_lock_create;
- li.lock_destroy = _thr_rtld_lock_destroy;
- li.rlock_acquire = _thr_rtld_rlock_acquire;
- li.wlock_acquire = _thr_rtld_wlock_acquire;
- li.lock_release = _thr_rtld_lock_release;
- li.thread_set_flag = _thr_rtld_set_flag;
- li.thread_clr_flag = _thr_rtld_clr_flag;
- li.at_fork = NULL;
- _rtld_thread_init(&li);
-}
-
-void
-_thr_rtld_fini(void)
-{
- _rtld_thread_init(NULL);
-}
diff --git a/lib/libkse/thread/thr_rwlock.c b/lib/libkse/thread/thr_rwlock.c
deleted file mode 100644
index ca8a081..0000000
--- a/lib/libkse/thread/thr_rwlock.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/*-
- * Copyright (c) 1998 Alex Nash
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#include "namespace.h"
-#include <pthread.h>
-#include "un-namespace.h"
-#include "thr_private.h"
-
-/* maximum number of times a read lock may be obtained */
-#define MAX_READ_LOCKS (INT_MAX - 1)
-
-__weak_reference(_pthread_rwlock_destroy, pthread_rwlock_destroy);
-__weak_reference(_pthread_rwlock_init, pthread_rwlock_init);
-__weak_reference(_pthread_rwlock_rdlock, pthread_rwlock_rdlock);
-__weak_reference(_pthread_rwlock_timedrdlock, pthread_rwlock_timedrdlock);
-__weak_reference(_pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock);
-__weak_reference(_pthread_rwlock_trywrlock, pthread_rwlock_trywrlock);
-__weak_reference(_pthread_rwlock_unlock, pthread_rwlock_unlock);
-__weak_reference(_pthread_rwlock_wrlock, pthread_rwlock_wrlock);
-__weak_reference(_pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock);
-
-/*
- * Prototypes
- */
-static int init_static(pthread_rwlock_t *rwlock);
-
-
-static int
-init_static(pthread_rwlock_t *rwlock)
-{
- struct pthread *thread = _get_curthread();
- int ret;
-
- THR_LOCK_ACQUIRE(thread, &_rwlock_static_lock);
-
- if (*rwlock == NULL)
- ret = _pthread_rwlock_init(rwlock, NULL);
- else
- ret = 0;
-
- THR_LOCK_RELEASE(thread, &_rwlock_static_lock);
- return (ret);
-}
-
-int
-_pthread_rwlock_destroy (pthread_rwlock_t *rwlock)
-{
- int ret;
-
- if (rwlock == NULL)
- ret = EINVAL;
- else {
- pthread_rwlock_t prwlock;
-
- prwlock = *rwlock;
-
- _pthread_mutex_destroy(&prwlock->lock);
- _pthread_cond_destroy(&prwlock->read_signal);
- _pthread_cond_destroy(&prwlock->write_signal);
- free(prwlock);
-
- *rwlock = NULL;
-
- ret = 0;
- }
- return (ret);
-}
-
-int
-_pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
-{
- pthread_rwlock_t prwlock;
- int ret;
-
- /* allocate rwlock object */
- prwlock = (pthread_rwlock_t)malloc(sizeof(struct pthread_rwlock));
-
- if (prwlock == NULL)
- return (ENOMEM);
-
- /* initialize the lock */
- if ((ret = _pthread_mutex_init(&prwlock->lock, NULL)) != 0)
- free(prwlock);
- else {
- /* initialize the read condition signal */
- ret = _pthread_cond_init(&prwlock->read_signal, NULL);
-
- if (ret != 0) {
- _pthread_mutex_destroy(&prwlock->lock);
- free(prwlock);
- } else {
- /* initialize the write condition signal */
- ret = _pthread_cond_init(&prwlock->write_signal, NULL);
-
- if (ret != 0) {
- _pthread_cond_destroy(&prwlock->read_signal);
- _pthread_mutex_destroy(&prwlock->lock);
- free(prwlock);
- } else {
- /* success */
- prwlock->state = 0;
- prwlock->blocked_writers = 0;
-
- *rwlock = prwlock;
- }
- }
- }
-
- return (ret);
-}
-
-static int
-rwlock_rdlock_common (pthread_rwlock_t *rwlock, const struct timespec *abstime)
-{
- pthread_rwlock_t prwlock;
- struct pthread *curthread;
- int ret;
-
- if (rwlock == NULL)
- return (EINVAL);
-
- prwlock = *rwlock;
-
- /* check for static initialization */
- if (prwlock == NULL) {
- if ((ret = init_static(rwlock)) != 0)
- return (ret);
-
- prwlock = *rwlock;
- }
-
- /* grab the monitor lock */
- if ((ret = _thr_mutex_lock(&prwlock->lock)) != 0)
- return (ret);
-
- /* check lock count */
- if (prwlock->state == MAX_READ_LOCKS) {
- _thr_mutex_unlock(&prwlock->lock);
- return (EAGAIN);
- }
-
- curthread = _get_curthread();
- if ((curthread->rdlock_count > 0) && (prwlock->state > 0)) {
- /*
- * To avoid having to track all the rdlocks held by
- * a thread or all of the threads that hold a rdlock,
- * we keep a simple count of all the rdlocks held by
- * a thread. If a thread holds any rdlocks it is
- * possible that it is attempting to take a recursive
- * rdlock. If there are blocked writers and precedence
- * is given to them, then that would result in the thread
- * deadlocking. So allowing a thread to take the rdlock
- * when it already has one or more rdlocks avoids the
- * deadlock. I hope the reader can follow that logic ;-)
- */
- ; /* nothing needed */
- } else {
- /* give writers priority over readers */
- while (prwlock->blocked_writers || prwlock->state < 0) {
- if (abstime)
- ret = _pthread_cond_timedwait
- (&prwlock->read_signal,
- &prwlock->lock, abstime);
- else
- ret = _thr_cond_wait(&prwlock->read_signal,
- &prwlock->lock);
- if (ret != 0) {
- /* can't do a whole lot if this fails */
- _thr_mutex_unlock(&prwlock->lock);
- return (ret);
- }
- }
- }
-
- curthread->rdlock_count++;
- prwlock->state++; /* indicate we are locked for reading */
-
- /*
- * Something is really wrong if this call fails. Returning
- * error won't do because we've already obtained the read
- * lock. Decrementing 'state' is no good because we probably
- * don't have the monitor lock.
- */
- _thr_mutex_unlock(&prwlock->lock);
-
- return (ret);
-}
-
-int
-_pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
-{
- return (rwlock_rdlock_common(rwlock, NULL));
-}
-
-__strong_reference(_pthread_rwlock_rdlock, _thr_rwlock_rdlock);
-
-int
-_pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock,
- const struct timespec *abstime)
-{
- return (rwlock_rdlock_common(rwlock, abstime));
-}
-
-int
-_pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
-{
- struct pthread *curthread;
- pthread_rwlock_t prwlock;
- int ret;
-
- if (rwlock == NULL)
- return (EINVAL);
-
- prwlock = *rwlock;
-
- /* check for static initialization */
- if (prwlock == NULL) {
- if ((ret = init_static(rwlock)) != 0)
- return (ret);
-
- prwlock = *rwlock;
- }
-
- /* grab the monitor lock */
- if ((ret = _pthread_mutex_lock(&prwlock->lock)) != 0)
- return (ret);
-
- curthread = _get_curthread();
- if (prwlock->state == MAX_READ_LOCKS)
- ret = EAGAIN;
- else if ((curthread->rdlock_count > 0) && (prwlock->state > 0)) {
- /* see comment for pthread_rwlock_rdlock() */
- curthread->rdlock_count++;
- prwlock->state++;
- }
- /* give writers priority over readers */
- else if (prwlock->blocked_writers || prwlock->state < 0)
- ret = EBUSY;
- else {
- curthread->rdlock_count++;
- prwlock->state++; /* indicate we are locked for reading */
- }
-
- /* see the comment on this in pthread_rwlock_rdlock */
- _pthread_mutex_unlock(&prwlock->lock);
-
- return (ret);
-}
-
-int
-_pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
-{
- pthread_rwlock_t prwlock;
- int ret;
-
- if (rwlock == NULL)
- return (EINVAL);
-
- prwlock = *rwlock;
-
- /* check for static initialization */
- if (prwlock == NULL) {
- if ((ret = init_static(rwlock)) != 0)
- return (ret);
-
- prwlock = *rwlock;
- }
-
- /* grab the monitor lock */
- if ((ret = _pthread_mutex_lock(&prwlock->lock)) != 0)
- return (ret);
-
- if (prwlock->state != 0)
- ret = EBUSY;
- else
- /* indicate we are locked for writing */
- prwlock->state = -1;
-
- /* see the comment on this in pthread_rwlock_rdlock */
- _pthread_mutex_unlock(&prwlock->lock);
-
- return (ret);
-}
-
-int
-_pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
-{
- struct pthread *curthread;
- pthread_rwlock_t prwlock;
- int ret;
-
- if (rwlock == NULL)
- return (EINVAL);
-
- prwlock = *rwlock;
-
- if (prwlock == NULL)
- return (EINVAL);
-
- /* grab the monitor lock */
- if ((ret = _thr_mutex_lock(&prwlock->lock)) != 0)
- return (ret);
-
- curthread = _get_curthread();
- if (prwlock->state > 0) {
- curthread->rdlock_count--;
- prwlock->state--;
- if (prwlock->state == 0 && prwlock->blocked_writers)
- ret = _thr_cond_signal(&prwlock->write_signal);
- } else if (prwlock->state < 0) {
- prwlock->state = 0;
-
- if (prwlock->blocked_writers)
- ret = _thr_cond_signal(&prwlock->write_signal);
- else
- ret = _thr_cond_broadcast(&prwlock->read_signal);
- } else
- ret = EINVAL;
-
- /* see the comment on this in pthread_rwlock_rdlock */
- _thr_mutex_unlock(&prwlock->lock);
-
- return (ret);
-}
-
-__strong_reference(_pthread_rwlock_unlock, _thr_rwlock_unlock);
-
-static int
-rwlock_wrlock_common (pthread_rwlock_t *rwlock, const struct timespec *abstime)
-{
- pthread_rwlock_t prwlock;
- int ret;
-
- if (rwlock == NULL)
- return (EINVAL);
-
- prwlock = *rwlock;
-
- /* check for static initialization */
- if (prwlock == NULL) {
- if ((ret = init_static(rwlock)) != 0)
- return (ret);
-
- prwlock = *rwlock;
- }
-
- /* grab the monitor lock */
- if ((ret = _thr_mutex_lock(&prwlock->lock)) != 0)
- return (ret);
-
- while (prwlock->state != 0) {
- prwlock->blocked_writers++;
-
- if (abstime != NULL)
- ret = _pthread_cond_timedwait(&prwlock->write_signal,
- &prwlock->lock, abstime);
- else
- ret = _thr_cond_wait(&prwlock->write_signal,
- &prwlock->lock);
- if (ret != 0) {
- prwlock->blocked_writers--;
- _thr_mutex_unlock(&prwlock->lock);
- return (ret);
- }
-
- prwlock->blocked_writers--;
- }
-
- /* indicate we are locked for writing */
- prwlock->state = -1;
-
- /* see the comment on this in pthread_rwlock_rdlock */
- _thr_mutex_unlock(&prwlock->lock);
-
- return (ret);
-}
-
-int
-_pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
-{
- return (rwlock_wrlock_common (rwlock, NULL));
-}
-__strong_reference(_pthread_rwlock_wrlock, _thr_rwlock_wrlock);
-
-int
-_pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock,
- const struct timespec *abstime)
-{
- return (rwlock_wrlock_common (rwlock, abstime));
-}
diff --git a/lib/libkse/thread/thr_rwlockattr.c b/lib/libkse/thread/thr_rwlockattr.c
deleted file mode 100644
index 8c0697b..0000000
--- a/lib/libkse/thread/thr_rwlockattr.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * Copyright (c) 1998 Alex Nash
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#include <errno.h>
-#include <stdlib.h>
-
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_rwlockattr_destroy, pthread_rwlockattr_destroy);
-__weak_reference(_pthread_rwlockattr_getpshared, pthread_rwlockattr_getpshared);
-__weak_reference(_pthread_rwlockattr_init, pthread_rwlockattr_init);
-__weak_reference(_pthread_rwlockattr_setpshared, pthread_rwlockattr_setpshared);
-
-int
-_pthread_rwlockattr_destroy(pthread_rwlockattr_t *rwlockattr)
-{
- pthread_rwlockattr_t prwlockattr;
-
- if (rwlockattr == NULL)
- return(EINVAL);
-
- prwlockattr = *rwlockattr;
-
- if (prwlockattr == NULL)
- return(EINVAL);
-
- free(prwlockattr);
-
- return(0);
-}
-
-int
-_pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *rwlockattr,
- int *pshared)
-{
- *pshared = (*rwlockattr)->pshared;
-
- return(0);
-}
-
-int
-_pthread_rwlockattr_init(pthread_rwlockattr_t *rwlockattr)
-{
- pthread_rwlockattr_t prwlockattr;
-
- if (rwlockattr == NULL)
- return(EINVAL);
-
- prwlockattr = (pthread_rwlockattr_t)
- malloc(sizeof(struct pthread_rwlockattr));
-
- if (prwlockattr == NULL)
- return(ENOMEM);
-
- prwlockattr->pshared = PTHREAD_PROCESS_PRIVATE;
- *rwlockattr = prwlockattr;
-
- return(0);
-}
-
-int
-_pthread_rwlockattr_setpshared(pthread_rwlockattr_t *rwlockattr, int pshared)
-{
- /* Only PTHREAD_PROCESS_PRIVATE is supported. */
- if (pshared != PTHREAD_PROCESS_PRIVATE)
- return(EINVAL);
-
- (*rwlockattr)->pshared = pshared;
-
- return(0);
-}
-
diff --git a/lib/libkse/thread/thr_select.c b/lib/libkse/thread/thr_select.c
deleted file mode 100644
index 792ff09..0000000
--- a/lib/libkse/thread/thr_select.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <unistd.h>
-#include <errno.h>
-#include <poll.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/fcntl.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__select, select);
-
-int
-__select(int numfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
- struct timeval *timeout)
-{
- struct pthread *curthread = _get_curthread();
- struct timespec ts;
- int ret;
-
- if (numfds == 0 && timeout != NULL) {
- TIMEVAL_TO_TIMESPEC(timeout, &ts);
- return nanosleep(&ts, NULL);
- } else {
- _thr_cancel_enter(curthread);
- ret = __sys_select(numfds, readfds, writefds, exceptfds, timeout);
- _thr_cancel_leave(curthread, 1);
- }
- return ret;
-}
diff --git a/lib/libkse/thread/thr_self.c b/lib/libkse/thread/thr_self.c
deleted file mode 100644
index 0c702a6..0000000
--- a/lib/libkse/thread/thr_self.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_self, pthread_self);
-
-pthread_t
-_pthread_self(void)
-{
- if (_thr_initial == NULL)
- _libpthread_init(NULL);
-
- /* Return the running thread pointer: */
- return (_get_curthread());
-}
diff --git a/lib/libkse/thread/thr_sem.c b/lib/libkse/thread/thr_sem.c
deleted file mode 100644
index 027960e..0000000
--- a/lib/libkse/thread/thr_sem.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include "namespace.h"
-#include <sys/queue.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <stdlib.h>
-#include <time.h>
-#include <_semaphore.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-#include "thr_private.h"
-
-
-extern int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
-extern int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *,
- struct timespec *);
-
-__weak_reference(_sem_init, sem_init);
-__weak_reference(_sem_wait, sem_wait);
-__weak_reference(_sem_timedwait, sem_timedwait);
-__weak_reference(_sem_post, sem_post);
-
-
-static inline int
-sem_check_validity(sem_t *sem)
-{
-
- if ((sem != NULL) && ((*sem)->magic == SEM_MAGIC))
- return (0);
- else {
- errno = EINVAL;
- return (-1);
- }
-}
-
-static void
-decrease_nwaiters(void *arg)
-{
- sem_t *sem = (sem_t *)arg;
-
- (*sem)->nwaiters--;
- /*
- * this function is called from cancellation point,
- * the mutex should already be hold.
- */
- _pthread_mutex_unlock(&(*sem)->lock);
-}
-
-static sem_t
-sem_alloc(unsigned int value, semid_t semid, int system_sem)
-{
- sem_t sem;
-
- if (value > SEM_VALUE_MAX) {
- errno = EINVAL;
- return (NULL);
- }
-
- sem = (sem_t)malloc(sizeof(struct sem));
- if (sem == NULL) {
- errno = ENOSPC;
- return (NULL);
- }
-
- /*
- * Initialize the semaphore.
- */
- if (_pthread_mutex_init(&sem->lock, NULL) != 0) {
- free(sem);
- errno = ENOSPC;
- return (NULL);
- }
-
- if (_pthread_cond_init(&sem->gtzero, NULL) != 0) {
- _pthread_mutex_destroy(&sem->lock);
- free(sem);
- errno = ENOSPC;
- return (NULL);
- }
-
- sem->count = (u_int32_t)value;
- sem->nwaiters = 0;
- sem->magic = SEM_MAGIC;
- sem->semid = semid;
- sem->syssem = system_sem;
- return (sem);
-}
-
-int
-_sem_init(sem_t *sem, int pshared, unsigned int value)
-{
- semid_t semid;
-
- semid = (semid_t)SEM_USER;
- if ((pshared != 0) && (ksem_init(&semid, value) != 0))
- return (-1);
-
- (*sem) = sem_alloc(value, semid, pshared);
- if ((*sem) == NULL) {
- if (pshared != 0)
- ksem_destroy(semid);
- return (-1);
- }
- return (0);
-}
-
-int
-_sem_wait(sem_t *sem)
-{
- struct pthread *curthread;
- int retval;
-
- if (sem_check_validity(sem) != 0)
- return (-1);
-
- curthread = _get_curthread();
- if ((*sem)->syssem != 0) {
- _thr_cancel_enter(curthread);
- retval = ksem_wait((*sem)->semid);
- _thr_cancel_leave(curthread, retval != 0);
- }
- else {
- pthread_testcancel();
- _pthread_mutex_lock(&(*sem)->lock);
-
- while ((*sem)->count <= 0) {
- (*sem)->nwaiters++;
- THR_CLEANUP_PUSH(curthread, decrease_nwaiters, sem);
- pthread_cond_wait(&(*sem)->gtzero, &(*sem)->lock);
- THR_CLEANUP_POP(curthread, 0);
- (*sem)->nwaiters--;
- }
- (*sem)->count--;
-
- _pthread_mutex_unlock(&(*sem)->lock);
-
- retval = 0;
- }
- return (retval);
-}
-
-int
-_sem_timedwait(sem_t * __restrict sem,
- struct timespec * __restrict abs_timeout)
-{
- struct pthread *curthread;
- int retval;
- int timeout_invalid;
-
- if (sem_check_validity(sem) != 0)
- return (-1);
-
- if ((*sem)->syssem != 0) {
- curthread = _get_curthread();
- _thr_cancel_enter(curthread);
- retval = ksem_timedwait((*sem)->semid, abs_timeout);
- _thr_cancel_leave(curthread, retval != 0);
- }
- else {
- /*
- * The timeout argument is only supposed to
- * be checked if the thread would have blocked.
- * This is checked outside of the lock so a
- * segfault on an invalid address doesn't end
- * up leaving the mutex locked.
- */
- pthread_testcancel();
- timeout_invalid = (abs_timeout->tv_nsec >= 1000000000) ||
- (abs_timeout->tv_nsec < 0);
- _pthread_mutex_lock(&(*sem)->lock);
-
- if ((*sem)->count <= 0) {
- if (timeout_invalid) {
- _pthread_mutex_unlock(&(*sem)->lock);
- errno = EINVAL;
- return (-1);
- }
- (*sem)->nwaiters++;
- pthread_cleanup_push(decrease_nwaiters, sem);
- pthread_cond_timedwait(&(*sem)->gtzero,
- &(*sem)->lock, abs_timeout);
- pthread_cleanup_pop(0);
- (*sem)->nwaiters--;
- }
- if ((*sem)->count == 0) {
- errno = ETIMEDOUT;
- retval = -1;
- }
- else {
- (*sem)->count--;
- retval = 0;
- }
-
- _pthread_mutex_unlock(&(*sem)->lock);
- }
-
- return (retval);
-}
-
-int
-_sem_post(sem_t *sem)
-{
- struct pthread *curthread;
- int retval;
-
- if (sem_check_validity(sem) != 0)
- return (-1);
-
- if ((*sem)->syssem != 0)
- retval = ksem_post((*sem)->semid);
- else {
- /*
- * sem_post() is required to be safe to call from within
- * signal handlers. Thus, we must enter a critical region.
- */
- curthread = _get_curthread();
- _thr_critical_enter(curthread);
- _pthread_mutex_lock(&(*sem)->lock);
-
- (*sem)->count++;
- if ((*sem)->nwaiters > 0)
- _pthread_cond_signal(&(*sem)->gtzero);
-
- _pthread_mutex_unlock(&(*sem)->lock);
- _thr_critical_leave(curthread);
- retval = 0;
- }
-
- return (retval);
-}
diff --git a/lib/libkse/thread/thr_seterrno.c b/lib/libkse/thread/thr_seterrno.c
deleted file mode 100644
index 245d43f..0000000
--- a/lib/libkse/thread/thr_seterrno.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <pthread.h>
-#include "thr_private.h"
-
-/*
- * This function needs to reference the global error variable which is
- * normally hidden from the user.
- */
-#ifdef errno
-#undef errno;
-#endif
-extern int errno;
-
-void
-_thread_seterrno(pthread_t thread, int error)
-{
- /* Check for the initial thread: */
- if (thread == _thr_initial)
- /* The initial thread always uses the global error variable: */
- errno = error;
- else
- /*
- * Threads other than the initial thread always use the error
- * field in the thread structureL
- */
- thread->error = error;
-}
diff --git a/lib/libkse/thread/thr_setprio.c b/lib/libkse/thread/thr_setprio.c
deleted file mode 100644
index c5a9506..0000000
--- a/lib/libkse/thread/thr_setprio.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_setprio, pthread_setprio);
-
-int
-_pthread_setprio(pthread_t pthread, int prio)
-{
- int ret, policy;
- struct sched_param param;
-
- if ((ret = pthread_getschedparam(pthread, &policy, &param)) == 0) {
- param.sched_priority = prio;
- ret = pthread_setschedparam(pthread, policy, &param);
- }
-
- /* Return the error status: */
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_setschedparam.c b/lib/libkse/thread/thr_setschedparam.c
deleted file mode 100644
index 63cd073..0000000
--- a/lib/libkse/thread/thr_setschedparam.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <sys/param.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_setschedparam, pthread_setschedparam);
-
-int
-_pthread_setschedparam(pthread_t pthread, int policy,
- const struct sched_param *param)
-{
- struct pthread *curthread = _get_curthread();
- int in_syncq;
- int in_readyq = 0;
- int old_prio;
- int ret = 0;
-
- if ((param == NULL) || (policy < SCHED_FIFO) || (policy > SCHED_RR)) {
- /* Return an invalid argument error: */
- ret = EINVAL;
- } else if ((param->sched_priority < THR_MIN_PRIORITY) ||
- (param->sched_priority > THR_MAX_PRIORITY)) {
- /* Return an unsupported value error. */
- ret = ENOTSUP;
-
- /* Find the thread in the list of active threads: */
- } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0))
- == 0) {
- /*
- * Lock the threads scheduling queue while we change
- * its priority:
- */
- THR_SCHED_LOCK(curthread, pthread);
- if ((pthread->state == PS_DEAD) ||
- (pthread->state == PS_DEADLOCK) ||
- ((pthread->flags & THR_FLAGS_EXITING) != 0)) {
- THR_SCHED_UNLOCK(curthread, pthread);
- _thr_ref_delete(curthread, pthread);
- return (ESRCH);
- }
- in_syncq = pthread->sflags & THR_FLAGS_IN_SYNCQ;
-
- /* Set the scheduling policy: */
- pthread->attr.sched_policy = policy;
-
- if (param->sched_priority ==
- THR_BASE_PRIORITY(pthread->base_priority))
- /*
- * There is nothing to do; unlock the threads
- * scheduling queue.
- */
- THR_SCHED_UNLOCK(curthread, pthread);
- else {
- /*
- * Remove the thread from its current priority
- * queue before any adjustments are made to its
- * active priority:
- */
- old_prio = pthread->active_priority;
- if ((pthread->flags & THR_FLAGS_IN_RUNQ) != 0) {
- in_readyq = 1;
- THR_RUNQ_REMOVE(pthread);
- }
-
- /* Set the thread base priority: */
- pthread->base_priority &=
- (THR_SIGNAL_PRIORITY | THR_RT_PRIORITY);
- pthread->base_priority = param->sched_priority;
-
- /* Recalculate the active priority: */
- pthread->active_priority = MAX(pthread->base_priority,
- pthread->inherited_priority);
-
- if (in_readyq) {
- if ((pthread->priority_mutex_count > 0) &&
- (old_prio > pthread->active_priority)) {
- /*
- * POSIX states that if the priority is
- * being lowered, the thread must be
- * inserted at the head of the queue for
- * its priority if it owns any priority
- * protection or inheritence mutexes.
- */
- THR_RUNQ_INSERT_HEAD(pthread);
- }
- else
- THR_RUNQ_INSERT_TAIL(pthread);
- }
-
- /* Unlock the threads scheduling queue: */
- THR_SCHED_UNLOCK(curthread, pthread);
-
- /*
- * Check for any mutex priority adjustments. This
- * includes checking for a priority mutex on which
- * this thread is waiting.
- */
- _mutex_notify_priochange(curthread, pthread, in_syncq);
- }
- _thr_ref_delete(curthread, pthread);
- }
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c
deleted file mode 100644
index ec6ebd5..0000000
--- a/lib/libkse/thread/thr_sig.c
+++ /dev/null
@@ -1,1250 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/signalvar.h>
-#include <signal.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-/* Prototypes: */
-static inline void build_siginfo(siginfo_t *info, int signo);
-#ifndef SYSTEM_SCOPE_ONLY
-static struct pthread *thr_sig_find(struct kse *curkse, int sig,
- siginfo_t *info);
-#endif
-static inline void thr_sigframe_restore(struct pthread *thread,
- struct pthread_sigframe *psf);
-static inline void thr_sigframe_save(struct pthread *thread,
- struct pthread_sigframe *psf);
-
-#define SA_KILL 0x01 /* terminates process by default */
-#define SA_STOP 0x02
-#define SA_CONT 0x04
-
-static int sigproptbl[NSIG] = {
- SA_KILL, /* SIGHUP */
- SA_KILL, /* SIGINT */
- SA_KILL, /* SIGQUIT */
- SA_KILL, /* SIGILL */
- SA_KILL, /* SIGTRAP */
- SA_KILL, /* SIGABRT */
- SA_KILL, /* SIGEMT */
- SA_KILL, /* SIGFPE */
- SA_KILL, /* SIGKILL */
- SA_KILL, /* SIGBUS */
- SA_KILL, /* SIGSEGV */
- SA_KILL, /* SIGSYS */
- SA_KILL, /* SIGPIPE */
- SA_KILL, /* SIGALRM */
- SA_KILL, /* SIGTERM */
- 0, /* SIGURG */
- SA_STOP, /* SIGSTOP */
- SA_STOP, /* SIGTSTP */
- SA_CONT, /* SIGCONT */
- 0, /* SIGCHLD */
- SA_STOP, /* SIGTTIN */
- SA_STOP, /* SIGTTOU */
- 0, /* SIGIO */
- SA_KILL, /* SIGXCPU */
- SA_KILL, /* SIGXFSZ */
- SA_KILL, /* SIGVTALRM */
- SA_KILL, /* SIGPROF */
- 0, /* SIGWINCH */
- 0, /* SIGINFO */
- SA_KILL, /* SIGUSR1 */
- SA_KILL /* SIGUSR2 */
-};
-
-/* #define DEBUG_SIGNAL */
-#ifdef DEBUG_SIGNAL
-#define DBG_MSG stdout_debug
-#else
-#define DBG_MSG(x...)
-#endif
-
-/*
- * Signal setup and delivery.
- *
- * 1) Delivering signals to threads in the same KSE.
- * These signals are sent by upcall events and are set in the
- * km_sigscaught field of the KSE mailbox. Since these signals
- * are received while operating on the KSE stack, they can be
- * delivered either by using signalcontext() to add a stack frame
- * to the target thread's stack, or by adding them in the thread's
- * pending set and having the thread run them down after it
- * 2) Delivering signals to threads in other KSEs/KSEGs.
- * 3) Delivering signals to threads in critical regions.
- * 4) Delivering signals to threads after they change their signal masks.
- *
- * Methods of delivering signals.
- *
- * 1) Add a signal frame to the thread's saved context.
- * 2) Add the signal to the thread structure, mark the thread as
- * having signals to handle, and let the thread run them down
- * after it resumes from the KSE scheduler.
- *
- * Problem with 1). You can't do this to a running thread or a
- * thread in a critical region.
- *
- * Problem with 2). You can't do this to a thread that doesn't
- * yield in some way (explicitly enters the scheduler). A thread
- * blocked in the kernel or a CPU hungry thread will not see the
- * signal without entering the scheduler.
- *
- * The solution is to use both 1) and 2) to deliver signals:
- *
- * o Thread in critical region - use 2). When the thread
- * leaves the critical region it will check to see if it
- * has pending signals and run them down.
- *
- * o Thread enters scheduler explicitly - use 2). The thread
- * can check for pending signals after it returns from the
- * the scheduler.
- *
- * o Thread is running and not current thread - use 2). When the
- * thread hits a condition specified by one of the other bullets,
- * the signal will be delivered.
- *
- * o Thread is running and is current thread (e.g., the thread
- * has just changed its signal mask and now sees that it has
- * pending signals) - just run down the pending signals.
- *
- * o Thread is swapped out due to quantum expiration - use 1)
- *
- * o Thread is blocked in kernel - kse_thr_wakeup() and then
- * use 1)
- */
-
-/*
- * Rules for selecting threads for signals received:
- *
- * 1) If the signal is a sychronous signal, it is delivered to
- * the generating (current thread). If the thread has the
- * signal masked, it is added to the threads pending signal
- * set until the thread unmasks it.
- *
- * 2) A thread in sigwait() where the signal is in the thread's
- * waitset.
- *
- * 3) A thread in sigsuspend() where the signal is not in the
- * thread's suspended signal mask.
- *
- * 4) Any thread (first found/easiest to deliver) that has the
- * signal unmasked.
- */
-
-#ifndef SYSTEM_SCOPE_ONLY
-
-static void *
-sig_daemon(void *arg /* Unused */)
-{
- int i;
- kse_critical_t crit;
- struct timespec ts;
- sigset_t set;
- struct kse *curkse;
- struct pthread *curthread = _get_curthread();
-
- DBG_MSG("signal daemon started(%p)\n", curthread);
-
- curthread->name = strdup("signal thread");
- crit = _kse_critical_enter();
- curkse = _get_curkse();
-
- /*
- * Daemon thread is a bound thread and we must be created with
- * all signals masked
- */
-#if 0
- SIGFILLSET(set);
- __sys_sigprocmask(SIG_SETMASK, &set, NULL);
-#endif
- __sys_sigpending(&set);
- ts.tv_sec = 0;
- ts.tv_nsec = 0;
- while (1) {
- KSE_LOCK_ACQUIRE(curkse, &_thread_signal_lock);
- _thr_proc_sigpending = set;
- KSE_LOCK_RELEASE(curkse, &_thread_signal_lock);
- for (i = 1; i <= _SIG_MAXSIG; i++) {
- if (SIGISMEMBER(set, i) != 0)
- _thr_sig_dispatch(curkse, i,
- NULL /* no siginfo */);
- }
- ts.tv_sec = 30;
- ts.tv_nsec = 0;
- curkse->k_kcb->kcb_kmbx.km_flags =
- KMF_NOUPCALL | KMF_NOCOMPLETED | KMF_WAITSIGEVENT;
- kse_release(&ts);
- curkse->k_kcb->kcb_kmbx.km_flags = 0;
- set = curkse->k_kcb->kcb_kmbx.km_sigscaught;
- }
- return (0);
-}
-
-
-/* Utility function to create signal daemon thread */
-int
-_thr_start_sig_daemon(void)
-{
- pthread_attr_t attr;
- sigset_t sigset, oldset;
-
- SIGFILLSET(sigset);
- pthread_sigmask(SIG_SETMASK, &sigset, &oldset);
- pthread_attr_init(&attr);
- pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
- attr->flags |= THR_SIGNAL_THREAD;
- /* sigmask will be inherited */
- if (pthread_create(&_thr_sig_daemon, &attr, sig_daemon, NULL))
- PANIC("can not create signal daemon thread!\n");
- pthread_attr_destroy(&attr);
- pthread_sigmask(SIG_SETMASK, &oldset, NULL);
- return (0);
-}
-
-/*
- * This signal handler only delivers asynchronous signals.
- * This must be called with upcalls disabled and without
- * holding any locks.
- */
-void
-_thr_sig_dispatch(struct kse *curkse, int sig, siginfo_t *info)
-{
- struct kse_mailbox *kmbx;
- struct pthread *thread;
-
- DBG_MSG(">>> _thr_sig_dispatch(%d)\n", sig);
-
- /* Check if the signal requires a dump of thread information: */
- if (sig == SIGINFO) {
- /* Dump thread information to file: */
- _thread_dump_info();
- }
-
- while ((thread = thr_sig_find(curkse, sig, info)) != NULL) {
- /*
- * Setup the target thread to receive the signal:
- */
- DBG_MSG("Got signal %d, selecting thread %p\n", sig, thread);
- KSE_SCHED_LOCK(curkse, thread->kseg);
- if ((thread->state == PS_DEAD) ||
- (thread->state == PS_DEADLOCK) ||
- THR_IS_EXITING(thread) || THR_IS_SUSPENDED(thread)) {
- KSE_SCHED_UNLOCK(curkse, thread->kseg);
- _thr_ref_delete(NULL, thread);
- } else if (SIGISMEMBER(thread->sigmask, sig)) {
- KSE_SCHED_UNLOCK(curkse, thread->kseg);
- _thr_ref_delete(NULL, thread);
- } else {
- kmbx = _thr_sig_add(thread, sig, info);
- KSE_SCHED_UNLOCK(curkse, thread->kseg);
- _thr_ref_delete(NULL, thread);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- break;
- }
- }
- DBG_MSG("<<< _thr_sig_dispatch\n");
-}
-
-#endif /* ! SYSTEM_SCOPE_ONLY */
-
-static __inline int
-sigprop(int sig)
-{
-
- if (sig > 0 && sig < NSIG)
- return (sigproptbl[_SIG_IDX(sig)]);
- return (0);
-}
-
-typedef void (*ohandler)(int sig, int code,
- struct sigcontext *scp, char *addr, __sighandler_t *catcher);
-
-void
-_thr_sig_handler(int sig, siginfo_t *info, ucontext_t *ucp)
-{
- struct pthread_sigframe psf;
- __siginfohandler_t *sigfunc;
- struct pthread *curthread;
- struct kse *curkse;
- struct sigaction act;
- int sa_flags, err_save;
-
- err_save = errno;
-
- DBG_MSG(">>> _thr_sig_handler(%d)\n", sig);
-
- curthread = _get_curthread();
- if (curthread == NULL)
- PANIC("No current thread.\n");
- if (!(curthread->attr.flags & PTHREAD_SCOPE_SYSTEM))
- PANIC("Thread is not system scope.\n");
- if (curthread->flags & THR_FLAGS_EXITING) {
- errno = err_save;
- return;
- }
-
- curkse = _get_curkse();
- /*
- * If thread is in critical region or if thread is on
- * the way of state transition, then latch signal into buffer.
- */
- if (_kse_in_critical() || THR_IN_CRITICAL(curthread) ||
- curthread->state != PS_RUNNING) {
- DBG_MSG(">>> _thr_sig_handler(%d) in critical\n", sig);
- curthread->siginfo[sig-1] = *info;
- curthread->check_pending = 1;
- curkse->k_sigseqno++;
- SIGADDSET(curthread->sigpend, sig);
- /*
- * If the kse is on the way to idle itself, but
- * we have signal ready, we should prevent it
- * to sleep, kernel will latch the wakeup request,
- * so kse_release will return from kernel immediately.
- */
- if (KSE_IS_IDLE(curkse))
- kse_wakeup(&curkse->k_kcb->kcb_kmbx);
- errno = err_save;
- return;
- }
-
- /* Check if the signal requires a dump of thread information: */
- if (sig == SIGINFO) {
- /* Dump thread information to file: */
- _thread_dump_info();
- }
-
- /* Check the threads previous state: */
- curthread->critical_count++;
- if (curthread->sigbackout != NULL)
- curthread->sigbackout((void *)curthread);
- curthread->critical_count--;
- thr_sigframe_save(curthread, &psf);
- THR_ASSERT(!(curthread->sigbackout), "sigbackout was not cleared.");
-
- _kse_critical_enter();
- /* Get a fresh copy of signal mask */
- __sys_sigprocmask(SIG_BLOCK, NULL, &curthread->sigmask);
- KSE_LOCK_ACQUIRE(curkse, &_thread_signal_lock);
- sigfunc = _thread_sigact[sig - 1].sa_sigaction;
- sa_flags = _thread_sigact[sig - 1].sa_flags;
- if (sa_flags & SA_RESETHAND) {
- act.sa_handler = SIG_DFL;
- act.sa_flags = SA_RESTART;
- SIGEMPTYSET(act.sa_mask);
- __sys_sigaction(sig, &act, NULL);
- __sys_sigaction(sig, NULL, &_thread_sigact[sig - 1]);
- }
- KSE_LOCK_RELEASE(curkse, &_thread_signal_lock);
- _kse_critical_leave(&curthread->tcb->tcb_tmbx);
-
- /* Now invoke real handler */
- if (((__sighandler_t *)sigfunc != SIG_DFL) &&
- ((__sighandler_t *)sigfunc != SIG_IGN) &&
- (sigfunc != (__siginfohandler_t *)_thr_sig_handler)) {
- if ((sa_flags & SA_SIGINFO) != 0 || info == NULL)
- (*(sigfunc))(sig, info, ucp);
- else {
- ((ohandler)(*sigfunc))(
- sig, info->si_code, (struct sigcontext *)ucp,
- info->si_addr, (__sighandler_t *)sigfunc);
- }
- } else {
- if ((__sighandler_t *)sigfunc == SIG_DFL) {
- if (sigprop(sig) & SA_KILL) {
- if (_kse_isthreaded())
- kse_thr_interrupt(NULL,
- KSE_INTR_SIGEXIT, sig);
- else
- kill(getpid(), sig);
- }
-#ifdef NOTYET
- else if (sigprop(sig) & SA_STOP)
- kse_thr_interrupt(NULL, KSE_INTR_JOBSTOP, sig);
-#endif
- }
- }
- _kse_critical_enter();
- curthread->sigmask = ucp->uc_sigmask;
- SIG_CANTMASK(curthread->sigmask);
- _kse_critical_leave(&curthread->tcb->tcb_tmbx);
-
- thr_sigframe_restore(curthread, &psf);
-
- DBG_MSG("<<< _thr_sig_handler(%d)\n", sig);
-
- errno = err_save;
-}
-
-struct sighandle_info {
- __siginfohandler_t *sigfunc;
- int sa_flags;
- int sig;
- siginfo_t *info;
- ucontext_t *ucp;
-};
-
-static void handle_signal(struct pthread *curthread,
- struct sighandle_info *shi);
-static void handle_signal_altstack(struct pthread *curthread,
- struct sighandle_info *shi);
-
-/* Must be called with signal lock and schedule lock held in order */
-static void
-thr_sig_invoke_handler(struct pthread *curthread, int sig, siginfo_t *info,
- ucontext_t *ucp)
-{
- __siginfohandler_t *sigfunc;
- sigset_t sigmask;
- int sa_flags;
- int onstack;
- struct sigaction act;
- struct kse *curkse;
- struct sighandle_info shi;
-
- /*
- * Invoke the signal handler without going through the scheduler:
- */
- DBG_MSG("Got signal %d, calling handler for current thread %p\n",
- sig, curthread);
-
- if (!_kse_in_critical())
- PANIC("thr_sig_invoke_handler without in critical\n");
- curkse = curthread->kse;
- /*
- * Check that a custom handler is installed and if
- * the signal is not blocked:
- */
- sigfunc = _thread_sigact[sig - 1].sa_sigaction;
- sa_flags = _thread_sigact[sig - 1].sa_flags;
- sigmask = curthread->sigmask;
- SIGSETOR(curthread->sigmask, _thread_sigact[sig - 1].sa_mask);
- if (!(sa_flags & (SA_NODEFER | SA_RESETHAND)))
- SIGADDSET(curthread->sigmask, sig);
- if ((sig != SIGILL) && (sa_flags & SA_RESETHAND)) {
- act.sa_handler = SIG_DFL;
- act.sa_flags = SA_RESTART;
- SIGEMPTYSET(act.sa_mask);
- __sys_sigaction(sig, &act, NULL);
- __sys_sigaction(sig, NULL, &_thread_sigact[sig - 1]);
- }
- KSE_LOCK_RELEASE(curkse, &_thread_signal_lock);
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- /*
- * We are processing buffered signals, synchronize working
- * signal mask into kernel.
- */
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
- onstack = _thr_sigonstack(&sigfunc);
- ucp->uc_stack = curthread->sigstk;
- ucp->uc_stack.ss_flags = (curthread->sigstk.ss_flags & SS_DISABLE)
- ? SS_DISABLE : ((onstack) ? SS_ONSTACK : 0);
- if (curthread->oldsigmask) {
- ucp->uc_sigmask = *(curthread->oldsigmask);
- curthread->oldsigmask = NULL;
- } else
- ucp->uc_sigmask = sigmask;
- shi.sigfunc = sigfunc;
- shi.sig = sig;
- shi.sa_flags = sa_flags;
- shi.info = info;
- shi.ucp = ucp;
- if ((curthread->sigstk.ss_flags & SS_DISABLE) == 0) {
- /* Deliver signal on alternative stack */
- if (sa_flags & SA_ONSTACK && !onstack)
- handle_signal_altstack(curthread, &shi);
- else
- handle_signal(curthread, &shi);
- } else {
- handle_signal(curthread, &shi);
- }
-
- _kse_critical_enter();
- /* Don't trust after critical leave/enter */
- curkse = curthread->kse;
-
- /*
- * Restore the thread's signal mask.
- */
- curthread->sigmask = ucp->uc_sigmask;
- SIG_CANTMASK(curthread->sigmask);
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- __sys_sigprocmask(SIG_SETMASK, &ucp->uc_sigmask, NULL);
- KSE_SCHED_LOCK(curkse, curkse->k_kseg);
- KSE_LOCK_ACQUIRE(curkse, &_thread_signal_lock);
-
- DBG_MSG("Got signal %d, handler returned %p\n", sig, curthread);
-}
-
-static void
-handle_signal(struct pthread *curthread, struct sighandle_info *shi)
-{
- _kse_critical_leave(&curthread->tcb->tcb_tmbx);
-
- /* Check if the signal requires a dump of thread information: */
- if (shi->sig == SIGINFO) {
- /* Dump thread information to file: */
- _thread_dump_info();
- }
-
- if (((__sighandler_t *)shi->sigfunc != SIG_DFL) &&
- ((__sighandler_t *)shi->sigfunc != SIG_IGN)) {
- if ((shi->sa_flags & SA_SIGINFO) != 0 || shi->info == NULL)
- (*(shi->sigfunc))(shi->sig, shi->info, shi->ucp);
- else {
- ((ohandler)(*shi->sigfunc))(
- shi->sig, shi->info->si_code,
- (struct sigcontext *)shi->ucp,
- shi->info->si_addr,
- (__sighandler_t *)shi->sigfunc);
- }
- } else {
- if ((__sighandler_t *)shi->sigfunc == SIG_DFL) {
- if (sigprop(shi->sig) & SA_KILL) {
- if (_kse_isthreaded())
- kse_thr_interrupt(NULL,
- KSE_INTR_SIGEXIT, shi->sig);
- else
- kill(getpid(), shi->sig);
- }
-#ifdef NOTYET
- else if (sigprop(shi->sig) & SA_STOP)
- kse_thr_interrupt(NULL, KSE_INTR_JOBSTOP,
- shi->sig);
-#endif
- }
- }
-}
-
-static void
-handle_signal_wrapper(struct pthread *curthread, ucontext_t *ret_uc,
- struct sighandle_info *shi)
-{
- shi->ucp->uc_stack.ss_flags = SS_ONSTACK;
- handle_signal(curthread, shi);
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- setcontext(ret_uc);
- else {
- /* Work around for ia64, THR_SETCONTEXT does not work */
- _kse_critical_enter();
- curthread->tcb->tcb_tmbx.tm_context = *ret_uc;
- _thread_switch(curthread->kse->k_kcb, curthread->tcb, 1);
- /* THR_SETCONTEXT */
- }
-}
-
-/*
- * Jump to stack set by sigaltstack before invoking signal handler
- */
-static void
-handle_signal_altstack(struct pthread *curthread, struct sighandle_info *shi)
-{
- volatile int once;
- ucontext_t uc1, *uc2;
-
- THR_ASSERT(_kse_in_critical(), "Not in critical");
-
- once = 0;
- THR_GETCONTEXT(&uc1);
- if (once == 0) {
- once = 1;
- /* XXX
- * We are still in critical region, it is safe to operate thread
- * context
- */
- uc2 = &curthread->tcb->tcb_tmbx.tm_context;
- uc2->uc_stack = curthread->sigstk;
- makecontext(uc2, (void (*)(void))handle_signal_wrapper,
- 3, curthread, &uc1, shi);
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- setcontext(uc2);
- else {
- _thread_switch(curthread->kse->k_kcb, curthread->tcb, 1);
- /* THR_SETCONTEXT(uc2); */
- }
- }
-}
-
-int
-_thr_getprocsig(int sig, siginfo_t *siginfo)
-{
- kse_critical_t crit;
- struct kse *curkse;
- int ret;
-
- DBG_MSG(">>> _thr_getprocsig\n");
-
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- KSE_LOCK_ACQUIRE(curkse, &_thread_signal_lock);
- ret = _thr_getprocsig_unlocked(sig, siginfo);
- KSE_LOCK_RELEASE(curkse, &_thread_signal_lock);
- _kse_critical_leave(crit);
-
- DBG_MSG("<<< _thr_getprocsig\n");
- return (ret);
-}
-
-int
-_thr_getprocsig_unlocked(int sig, siginfo_t *siginfo)
-{
- sigset_t sigset;
- struct timespec ts;
-
- /* try to retrieve signal from kernel */
- SIGEMPTYSET(sigset);
- SIGADDSET(sigset, sig);
- ts.tv_sec = 0;
- ts.tv_nsec = 0;
- SIGDELSET(_thr_proc_sigpending, sig);
- if (__sys_sigtimedwait(&sigset, siginfo, &ts) > 0)
- return (sig);
- return (0);
-}
-
-#ifndef SYSTEM_SCOPE_ONLY
-/*
- * Find a thread that can handle the signal. This must be called
- * with upcalls disabled.
- */
-struct pthread *
-thr_sig_find(struct kse *curkse, int sig, siginfo_t *info)
-{
- struct kse_mailbox *kmbx = NULL;
- struct pthread *pthread;
- struct pthread *suspended_thread, *signaled_thread;
- __siginfohandler_t *sigfunc;
- siginfo_t si;
-
- DBG_MSG("Looking for thread to handle signal %d\n", sig);
-
- /*
- * Enter a loop to look for threads that have the signal
- * unmasked. POSIX specifies that a thread in a sigwait
- * will get the signal over any other threads. Second
- * preference will be threads in in a sigsuspend. Third
- * preference will be the current thread. If none of the
- * above, then the signal is delivered to the first thread
- * that is found. Note that if a custom handler is not
- * installed, the signal only affects threads in sigwait.
- */
- suspended_thread = NULL;
- signaled_thread = NULL;
-
- KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- TAILQ_FOREACH(pthread, &_thread_list, tle) {
- if (pthread == _thr_sig_daemon)
- continue;
- /* Signal delivering to bound thread is done by kernel */
- if (pthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- continue;
- /* Take the scheduling lock. */
- KSE_SCHED_LOCK(curkse, pthread->kseg);
- if ((pthread->state == PS_DEAD) ||
- (pthread->state == PS_DEADLOCK) ||
- THR_IS_EXITING(pthread) ||
- THR_IS_SUSPENDED(pthread)) {
- ; /* Skip this thread. */
- } else if (pthread->state == PS_SIGWAIT &&
- SIGISMEMBER(*(pthread->data.sigwait->waitset), sig)) {
- /*
- * retrieve signal from kernel, if it is job control
- * signal, and sigaction is SIG_DFL, then we will
- * be stopped in kernel, we hold lock here, but that
- * does not matter, because that's job control, and
- * whole process should be stopped.
- */
- if (_thr_getprocsig(sig, &si)) {
- DBG_MSG("Waking thread %p in sigwait"
- " with signal %d\n", pthread, sig);
- /* where to put siginfo ? */
- *(pthread->data.sigwait->siginfo) = si;
- kmbx = _thr_setrunnable_unlocked(pthread);
- }
- KSE_SCHED_UNLOCK(curkse, pthread->kseg);
- /*
- * POSIX doesn't doesn't specify which thread
- * will get the signal if there are multiple
- * waiters, so we give it to the first thread
- * we find.
- *
- * Do not attempt to deliver this signal
- * to other threads and do not add the signal
- * to the process pending set.
- */
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- if (suspended_thread != NULL)
- _thr_ref_delete(NULL, suspended_thread);
- if (signaled_thread != NULL)
- _thr_ref_delete(NULL, signaled_thread);
- return (NULL);
- } else if (!SIGISMEMBER(pthread->sigmask, sig)) {
- /*
- * If debugger is running, we don't quick exit,
- * and give it a chance to check the signal.
- */
- if (_libkse_debug == 0) {
- sigfunc = _thread_sigact[sig - 1].sa_sigaction;
- if ((__sighandler_t *)sigfunc == SIG_DFL) {
- if (sigprop(sig) & SA_KILL) {
- kse_thr_interrupt(NULL,
- KSE_INTR_SIGEXIT, sig);
- /* Never reach */
- }
- }
- }
- if (pthread->state == PS_SIGSUSPEND) {
- if (suspended_thread == NULL) {
- suspended_thread = pthread;
- suspended_thread->refcount++;
- }
- } else if (signaled_thread == NULL) {
- signaled_thread = pthread;
- signaled_thread->refcount++;
- }
- }
- KSE_SCHED_UNLOCK(curkse, pthread->kseg);
- }
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
-
- if (suspended_thread != NULL) {
- pthread = suspended_thread;
- if (signaled_thread)
- _thr_ref_delete(NULL, signaled_thread);
- } else if (signaled_thread) {
- pthread = signaled_thread;
- } else {
- pthread = NULL;
- }
- return (pthread);
-}
-#endif /* ! SYSTEM_SCOPE_ONLY */
-
-static inline void
-build_siginfo(siginfo_t *info, int signo)
-{
- bzero(info, sizeof(*info));
- info->si_signo = signo;
- info->si_pid = _thr_pid;
-}
-
-/*
- * This is called by a thread when it has pending signals to deliver.
- * It should only be called from the context of the thread.
- */
-void
-_thr_sig_rundown(struct pthread *curthread, ucontext_t *ucp)
-{
- struct pthread_sigframe psf;
- siginfo_t siginfo;
- int i, err_save;
- kse_critical_t crit;
- struct kse *curkse;
- sigset_t sigmask;
-
- err_save = errno;
-
- DBG_MSG(">>> thr_sig_rundown (%p)\n", curthread);
-
- /* Check the threads previous state: */
- curthread->critical_count++;
- if (curthread->sigbackout != NULL)
- curthread->sigbackout((void *)curthread);
- curthread->critical_count--;
-
- THR_ASSERT(!(curthread->sigbackout), "sigbackout was not cleared.");
- THR_ASSERT((curthread->state == PS_RUNNING), "state is not PS_RUNNING");
-
- thr_sigframe_save(curthread, &psf);
- /*
- * Lower the priority before calling the handler in case
- * it never returns (longjmps back):
- */
- crit = _kse_critical_enter();
- curkse = curthread->kse;
- KSE_SCHED_LOCK(curkse, curkse->k_kseg);
- KSE_LOCK_ACQUIRE(curkse, &_thread_signal_lock);
- curthread->active_priority &= ~THR_SIGNAL_PRIORITY;
- SIGFILLSET(sigmask);
- while (1) {
- /*
- * For bound thread, we mask all signals and get a fresh
- * copy of signal mask from kernel
- */
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) {
- __sys_sigprocmask(SIG_SETMASK, &sigmask,
- &curthread->sigmask);
- }
- for (i = 1; i <= _SIG_MAXSIG; i++) {
- if (SIGISMEMBER(curthread->sigmask, i))
- continue;
- if (SIGISMEMBER(curthread->sigpend, i)) {
- SIGDELSET(curthread->sigpend, i);
- siginfo = curthread->siginfo[i-1];
- break;
- }
- if (!(curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- && SIGISMEMBER(_thr_proc_sigpending, i)) {
- if (_thr_getprocsig_unlocked(i, &siginfo))
- break;
- }
- }
- if (i <= _SIG_MAXSIG)
- thr_sig_invoke_handler(curthread, i, &siginfo, ucp);
- else {
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) {
- __sys_sigprocmask(SIG_SETMASK,
- &curthread->sigmask, NULL);
- }
- break;
- }
- }
-
- /* Don't trust after signal handling */
- curkse = curthread->kse;
- KSE_LOCK_RELEASE(curkse, &_thread_signal_lock);
- KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
- _kse_critical_leave(&curthread->tcb->tcb_tmbx);
- /* repost masked signal to kernel, it hardly happens in real world */
- if ((curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) &&
- !SIGISEMPTY(curthread->sigpend)) { /* dirty read */
- __sys_sigprocmask(SIG_SETMASK, &sigmask, &curthread->sigmask);
- for (i = 1; i <= _SIG_MAXSIG; ++i) {
- if (SIGISMEMBER(curthread->sigpend, i)) {
- SIGDELSET(curthread->sigpend, i);
- if (!_kse_isthreaded())
- kill(getpid(), i);
- else
- kse_thr_interrupt(
- &curthread->tcb->tcb_tmbx,
- KSE_INTR_SENDSIG,
- i);
- }
- }
- __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
- }
- DBG_MSG("<<< thr_sig_rundown (%p)\n", curthread);
-
- thr_sigframe_restore(curthread, &psf);
- errno = err_save;
-}
-
-/*
- * This checks pending signals for the current thread. It should be
- * called whenever a thread changes its signal mask. Note that this
- * is called from a thread (using its stack).
- *
- * XXX - We might want to just check to see if there are pending
- * signals for the thread here, but enter the UTS scheduler
- * to actually install the signal handler(s).
- */
-void
-_thr_sig_check_pending(struct pthread *curthread)
-{
- ucontext_t uc;
- volatile int once;
- int errsave;
-
- /*
- * If the thread is in critical region, delay processing signals.
- * If the thread state is not PS_RUNNING, it might be switching
- * into UTS and but a THR_LOCK_RELEASE saw check_pending, and it
- * goes here, in the case we delay processing signals, lets UTS
- * process complicated things, normally UTS will call _thr_sig_add
- * to resume the thread, so we needn't repeat doing it here.
- */
- if (THR_IN_CRITICAL(curthread) || curthread->state != PS_RUNNING)
- return;
-
- errsave = errno;
- once = 0;
- THR_GETCONTEXT(&uc);
- if (once == 0) {
- once = 1;
- curthread->check_pending = 0;
- _thr_sig_rundown(curthread, &uc);
- }
- errno = errsave;
-}
-
-/*
- * Perform thread specific actions in response to a signal.
- * This function is only called if there is a handler installed
- * for the signal, and if the target thread has the signal
- * unmasked.
- *
- * This must be called with the thread's scheduling lock held.
- */
-struct kse_mailbox *
-_thr_sig_add(struct pthread *pthread, int sig, siginfo_t *info)
-{
- siginfo_t siginfo;
- struct kse *curkse;
- struct kse_mailbox *kmbx = NULL;
- struct pthread *curthread = _get_curthread();
- int restart;
- int suppress_handler = 0;
- int fromproc = 0;
- __sighandler_t *sigfunc;
-
- DBG_MSG(">>> _thr_sig_add %p (%d)\n", pthread, sig);
-
- curkse = _get_curkse();
- restart = _thread_sigact[sig - 1].sa_flags & SA_RESTART;
- sigfunc = _thread_sigact[sig - 1].sa_handler;
- fromproc = (curthread == _thr_sig_daemon);
-
- if (pthread->state == PS_DEAD || pthread->state == PS_DEADLOCK ||
- pthread->state == PS_STATE_MAX)
- return (NULL); /* return false */
-
- if ((pthread->attr.flags & PTHREAD_SCOPE_SYSTEM) &&
- (curthread != pthread)) {
- PANIC("Please use _thr_send_sig for bound thread");
- return (NULL);
- }
-
- if (pthread->state != PS_SIGWAIT &&
- SIGISMEMBER(pthread->sigmask, sig)) {
- /* signal is masked, just add signal to thread. */
- if (!fromproc) {
- SIGADDSET(pthread->sigpend, sig);
- if (info == NULL)
- build_siginfo(&pthread->siginfo[sig-1], sig);
- else if (info != &pthread->siginfo[sig-1])
- memcpy(&pthread->siginfo[sig-1], info,
- sizeof(*info));
- } else {
- if (!_thr_getprocsig(sig, &pthread->siginfo[sig-1]))
- return (NULL);
- SIGADDSET(pthread->sigpend, sig);
- }
- }
- else {
- /* if process signal not exists, just return */
- if (fromproc) {
- if (!_thr_getprocsig(sig, &siginfo))
- return (NULL);
- info = &siginfo;
- }
-
- if (pthread->state != PS_SIGWAIT && sigfunc == SIG_DFL &&
- (sigprop(sig) & SA_KILL)) {
- kse_thr_interrupt(NULL, KSE_INTR_SIGEXIT, sig);
- /* Never reach */
- }
-
- /*
- * Process according to thread state:
- */
- switch (pthread->state) {
- case PS_DEAD:
- case PS_DEADLOCK:
- case PS_STATE_MAX:
- return (NULL); /* XXX return false */
- case PS_LOCKWAIT:
- case PS_SUSPENDED:
- /*
- * You can't call a signal handler for threads in these
- * states.
- */
- suppress_handler = 1;
- break;
- case PS_RUNNING:
- if ((pthread->flags & THR_FLAGS_IN_RUNQ)) {
- THR_RUNQ_REMOVE(pthread);
- pthread->active_priority |= THR_SIGNAL_PRIORITY;
- THR_RUNQ_INSERT_TAIL(pthread);
- } else {
- /* Possible not in RUNQ and has curframe ? */
- pthread->active_priority |= THR_SIGNAL_PRIORITY;
- }
- break;
- /*
- * States which cannot be interrupted but still require the
- * signal handler to run:
- */
- case PS_COND_WAIT:
- case PS_MUTEX_WAIT:
- break;
-
- case PS_SLEEP_WAIT:
- /*
- * Unmasked signals always cause sleep to terminate
- * early regardless of SA_RESTART:
- */
- pthread->interrupted = 1;
- break;
-
- case PS_JOIN:
- break;
-
- case PS_SIGSUSPEND:
- pthread->interrupted = 1;
- break;
-
- case PS_SIGWAIT:
- if (info == NULL)
- build_siginfo(&pthread->siginfo[sig-1], sig);
- else if (info != &pthread->siginfo[sig-1])
- memcpy(&pthread->siginfo[sig-1], info,
- sizeof(*info));
- /*
- * The signal handler is not called for threads in
- * SIGWAIT.
- */
- suppress_handler = 1;
- /* Wake up the thread if the signal is not blocked. */
- if (SIGISMEMBER(*(pthread->data.sigwait->waitset), sig)) {
- /* Return the signal number: */
- *(pthread->data.sigwait->siginfo) = pthread->siginfo[sig-1];
- /* Make the thread runnable: */
- kmbx = _thr_setrunnable_unlocked(pthread);
- } else {
- /* Increment the pending signal count. */
- SIGADDSET(pthread->sigpend, sig);
- if (!SIGISMEMBER(pthread->sigmask, sig)) {
- if (sigfunc == SIG_DFL &&
- sigprop(sig) & SA_KILL) {
- kse_thr_interrupt(NULL,
- KSE_INTR_SIGEXIT,
- sig);
- /* Never reach */
- }
- pthread->check_pending = 1;
- pthread->interrupted = 1;
- kmbx = _thr_setrunnable_unlocked(pthread);
- }
- }
- return (kmbx);
- }
-
- SIGADDSET(pthread->sigpend, sig);
- if (info == NULL)
- build_siginfo(&pthread->siginfo[sig-1], sig);
- else if (info != &pthread->siginfo[sig-1])
- memcpy(&pthread->siginfo[sig-1], info, sizeof(*info));
- pthread->check_pending = 1;
- if (!(pthread->attr.flags & PTHREAD_SCOPE_SYSTEM) &&
- (pthread->blocked != 0) && !THR_IN_CRITICAL(pthread))
- kse_thr_interrupt(&pthread->tcb->tcb_tmbx,
- restart ? KSE_INTR_RESTART : KSE_INTR_INTERRUPT, 0);
- if (suppress_handler == 0) {
- /*
- * Setup a signal frame and save the current threads
- * state:
- */
- if (pthread->state != PS_RUNNING) {
- if (pthread->flags & THR_FLAGS_IN_RUNQ)
- THR_RUNQ_REMOVE(pthread);
- pthread->active_priority |= THR_SIGNAL_PRIORITY;
- kmbx = _thr_setrunnable_unlocked(pthread);
- }
- }
- }
- return (kmbx);
-}
-
-/*
- * Send a signal to a specific thread (ala pthread_kill):
- */
-void
-_thr_sig_send(struct pthread *pthread, int sig)
-{
- struct pthread *curthread = _get_curthread();
- struct kse_mailbox *kmbx;
-
- if (pthread->attr.flags & PTHREAD_SCOPE_SYSTEM) {
- kse_thr_interrupt(&pthread->tcb->tcb_tmbx, KSE_INTR_SENDSIG, sig);
- return;
- }
-
- /* Lock the scheduling queue of the target thread. */
- THR_SCHED_LOCK(curthread, pthread);
- if (_thread_sigact[sig - 1].sa_handler != SIG_IGN) {
- kmbx = _thr_sig_add(pthread, sig, NULL);
- /* Add a preemption point. */
- if (kmbx == NULL && (curthread->kseg == pthread->kseg) &&
- (pthread->active_priority > curthread->active_priority))
- curthread->critical_yield = 1;
- THR_SCHED_UNLOCK(curthread, pthread);
- if (kmbx != NULL)
- kse_wakeup(kmbx);
- /* XXX
- * If thread sent signal to itself, check signals now.
- * It is not really needed, _kse_critical_leave should
- * have already checked signals.
- */
- if (pthread == curthread && curthread->check_pending)
- _thr_sig_check_pending(curthread);
-
- } else {
- THR_SCHED_UNLOCK(curthread, pthread);
- }
-}
-
-static inline void
-thr_sigframe_restore(struct pthread *curthread, struct pthread_sigframe *psf)
-{
- kse_critical_t crit;
- struct kse *curkse;
-
- THR_THREAD_LOCK(curthread, curthread);
- curthread->cancelflags = psf->psf_cancelflags;
- crit = _kse_critical_enter();
- curkse = curthread->kse;
- KSE_SCHED_LOCK(curkse, curthread->kseg);
- curthread->flags = psf->psf_flags;
- curthread->interrupted = psf->psf_interrupted;
- curthread->timeout = psf->psf_timeout;
- curthread->data = psf->psf_wait_data;
- curthread->wakeup_time = psf->psf_wakeup_time;
- curthread->continuation = psf->psf_continuation;
- KSE_SCHED_UNLOCK(curkse, curthread->kseg);
- _kse_critical_leave(crit);
- THR_THREAD_UNLOCK(curthread, curthread);
-}
-
-static inline void
-thr_sigframe_save(struct pthread *curthread, struct pthread_sigframe *psf)
-{
- kse_critical_t crit;
- struct kse *curkse;
-
- THR_THREAD_LOCK(curthread, curthread);
- psf->psf_cancelflags = curthread->cancelflags;
- crit = _kse_critical_enter();
- curkse = curthread->kse;
- KSE_SCHED_LOCK(curkse, curthread->kseg);
- /* This has to initialize all members of the sigframe. */
- psf->psf_flags = (curthread->flags & (THR_FLAGS_PRIVATE | THR_FLAGS_EXITING));
- psf->psf_interrupted = curthread->interrupted;
- psf->psf_timeout = curthread->timeout;
- psf->psf_wait_data = curthread->data;
- psf->psf_wakeup_time = curthread->wakeup_time;
- psf->psf_continuation = curthread->continuation;
- KSE_SCHED_UNLOCK(curkse, curthread->kseg);
- _kse_critical_leave(crit);
- THR_THREAD_UNLOCK(curthread, curthread);
-}
-
-void
-_thr_signal_init(void)
-{
- struct sigaction act;
- __siginfohandler_t *sigfunc;
- int i;
- sigset_t sigset;
-
- SIGFILLSET(sigset);
- __sys_sigprocmask(SIG_SETMASK, &sigset, &_thr_initial->sigmask);
- /* Enter a loop to get the existing signal status: */
- for (i = 1; i <= _SIG_MAXSIG; i++) {
- /* Get the signal handler details: */
- if (__sys_sigaction(i, NULL, &_thread_sigact[i - 1]) != 0) {
- /*
- * Abort this process if signal
- * initialisation fails:
- */
- PANIC("Cannot read signal handler info");
- }
- /* Intall wrapper if handler was set */
- sigfunc = _thread_sigact[i - 1].sa_sigaction;
- if (((__sighandler_t *)sigfunc) != SIG_DFL &&
- ((__sighandler_t *)sigfunc) != SIG_IGN) {
- act = _thread_sigact[i - 1];
- act.sa_flags |= SA_SIGINFO;
- act.sa_sigaction =
- (__siginfohandler_t *)_thr_sig_handler;
- __sys_sigaction(i, &act, NULL);
- }
- }
- /*
- * Install the signal handler for SIGINFO. It isn't
- * really needed, but it is nice to have for debugging
- * purposes.
- */
- _thread_sigact[SIGINFO - 1].sa_flags = SA_SIGINFO | SA_RESTART;
- SIGEMPTYSET(act.sa_mask);
- act.sa_flags = SA_SIGINFO | SA_RESTART;
- act.sa_sigaction = (__siginfohandler_t *)&_thr_sig_handler;
- if (__sys_sigaction(SIGINFO, &act, NULL) != 0) {
- __sys_sigprocmask(SIG_SETMASK, &_thr_initial->sigmask, NULL);
- /*
- * Abort this process if signal initialisation fails:
- */
- PANIC("Cannot initialize signal handler");
- }
- __sys_sigprocmask(SIG_SETMASK, &_thr_initial->sigmask, NULL);
- __sys_sigaltstack(NULL, &_thr_initial->sigstk);
-}
-
-void
-_thr_signal_deinit(void)
-{
- int i;
- struct pthread *curthread = _get_curthread();
-
- /* Clear process pending signals. */
- sigemptyset(&_thr_proc_sigpending);
-
- /* Enter a loop to get the existing signal status: */
- for (i = 1; i <= _SIG_MAXSIG; i++) {
- /* Check for signals which cannot be trapped: */
- if (i == SIGKILL || i == SIGSTOP) {
- }
-
- /* Set the signal handler details: */
- else if (__sys_sigaction(i, &_thread_sigact[i - 1],
- NULL) != 0) {
- /*
- * Abort this process if signal
- * initialisation fails:
- */
- PANIC("Cannot set signal handler info");
- }
- }
- __sys_sigaltstack(&curthread->sigstk, NULL);
-}
-
diff --git a/lib/libkse/thread/thr_sigaction.c b/lib/libkse/thread/thr_sigaction.c
deleted file mode 100644
index 694f37e..0000000
--- a/lib/libkse/thread/thr_sigaction.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <signal.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_sigaction, sigaction);
-
-int
-_sigaction(int sig, const struct sigaction * act, struct sigaction * oact)
-{
- int ret = 0;
- int err = 0;
- struct sigaction newact, oldact;
- struct pthread *curthread;
- kse_critical_t crit;
-
- /* Check if the signal number is out of range: */
- if (sig < 1 || sig > _SIG_MAXSIG) {
- /* Return an invalid argument: */
- errno = EINVAL;
- ret = -1;
- } else {
- if (act)
- newact = *act;
-
- crit = _kse_critical_enter();
- curthread = _get_curthread();
- KSE_LOCK_ACQUIRE(curthread->kse, &_thread_signal_lock);
-
- oldact = _thread_sigact[sig - 1];
-
- /* Check if a signal action was supplied: */
- if (act != NULL) {
- /* Set the new signal handler: */
- _thread_sigact[sig - 1] = newact;
- }
-
- /*
- * Check if the kernel needs to be advised of a change
- * in signal action:
- */
- if (act != NULL && sig != SIGINFO) {
-
- newact.sa_flags |= SA_SIGINFO;
-
- /*
- * Check if the signal handler is being set to
- * the default or ignore handlers:
- */
- if (newact.sa_handler != SIG_DFL &&
- newact.sa_handler != SIG_IGN) {
- /*
- * Specify the thread kernel signal
- * handler:
- */
- newact.sa_handler = (void (*) ())_thr_sig_handler;
- }
- /* Change the signal action in the kernel: */
- if (__sys_sigaction(sig, &newact, NULL) != 0) {
- _thread_sigact[sig - 1] = oldact;
- /* errno is in kse, will copy it to thread */
- err = errno;
- ret = -1;
- }
- }
- KSE_LOCK_RELEASE(curthread->kse, &_thread_signal_lock);
- _kse_critical_leave(crit);
- /*
- * Check if the existing signal action structure contents are
- * to be returned:
- */
- if (oact != NULL) {
- /* Return the existing signal action contents: */
- *oact = oldact;
- }
- if (ret != 0) {
- /* Return errno to thread */
- errno = err;
- }
- }
-
- /* Return the completion status: */
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_sigaltstack.c b/lib/libkse/thread/thr_sigaltstack.c
deleted file mode 100644
index 3153ebd..0000000
--- a/lib/libkse/thread/thr_sigaltstack.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*-
- * Copyright (c) 2003 David Xu <davidxu@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <errno.h>
-#include <signal.h>
-#include "thr_private.h"
-
-__weak_reference(_sigaltstack, sigaltstack);
-
-int
-_sigaltstack(stack_t *_ss, stack_t *_oss)
-{
- struct pthread *curthread = _get_curthread();
- stack_t ss, oss;
- int oonstack, errsave, ret;
- kse_critical_t crit;
-
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) {
- crit = _kse_critical_enter();
- ret = __sys_sigaltstack(_ss, _oss);
- errsave = errno;
- /* Get a copy */
- if (ret == 0 && _ss != NULL)
- curthread->sigstk = *_ss;
- _kse_critical_leave(crit);
- errno = errsave;
- return (ret);
- }
-
- if (_ss)
- ss = *_ss;
- if (_oss)
- oss = *_oss;
-
- /* Should get and set stack in atomic way */
- crit = _kse_critical_enter();
- oonstack = _thr_sigonstack(&ss);
- if (_oss != NULL) {
- oss = curthread->sigstk;
- oss.ss_flags = (curthread->sigstk.ss_flags & SS_DISABLE)
- ? SS_DISABLE : ((oonstack) ? SS_ONSTACK : 0);
- }
-
- if (_ss != NULL) {
- if (oonstack) {
- _kse_critical_leave(crit);
- errno = EPERM;
- return (-1);
- }
- if ((ss.ss_flags & ~SS_DISABLE) != 0) {
- _kse_critical_leave(crit);
- errno = EINVAL;
- return (-1);
- }
- if (!(ss.ss_flags & SS_DISABLE)) {
- if (ss.ss_size < MINSIGSTKSZ) {
- _kse_critical_leave(crit);
- errno = ENOMEM;
- return (-1);
- }
- curthread->sigstk = ss;
- } else {
- curthread->sigstk.ss_flags |= SS_DISABLE;
- }
- }
- _kse_critical_leave(crit);
- if (_oss != NULL)
- *_oss = oss;
- return (0);
-}
-
-int
-_thr_sigonstack(void *sp)
-{
- struct pthread *curthread = _get_curthread();
-
- return ((curthread->sigstk.ss_flags & SS_DISABLE) == 0 ?
- (((size_t)sp - (size_t)curthread->sigstk.ss_sp) < curthread->sigstk.ss_size)
- : 0);
-}
-
diff --git a/lib/libkse/thread/thr_sigmask.c b/lib/libkse/thread/thr_sigmask.c
deleted file mode 100644
index 70463a5..0000000
--- a/lib/libkse/thread/thr_sigmask.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/signalvar.h>
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_pthread_sigmask, pthread_sigmask);
-
-int
-_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
-{
- struct pthread *curthread = _get_curthread();
- sigset_t oldset, newset;
- int ret;
-
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) {
- ret = __sys_sigprocmask(how, set, oset);
- if (ret != 0)
- ret = errno;
- /* Get a fresh copy */
- __sys_sigprocmask(SIG_SETMASK, NULL, &curthread->sigmask);
- return (ret);
- }
-
- if (set)
- newset = *set;
-
- THR_SCHED_LOCK(curthread, curthread);
-
- ret = 0;
- if (oset != NULL)
- /* Return the current mask: */
- oldset = curthread->sigmask;
-
- /* Check if a new signal set was provided by the caller: */
- if (set != NULL) {
- /* Process according to what to do: */
- switch (how) {
- /* Block signals: */
- case SIG_BLOCK:
- /* Add signals to the existing mask: */
- SIGSETOR(curthread->sigmask, newset);
- break;
-
- /* Unblock signals: */
- case SIG_UNBLOCK:
- /* Clear signals from the existing mask: */
- SIGSETNAND(curthread->sigmask, newset);
- break;
-
- /* Set the signal process mask: */
- case SIG_SETMASK:
- /* Set the new mask: */
- curthread->sigmask = newset;
- break;
-
- /* Trap invalid actions: */
- default:
- /* Return an invalid argument: */
- ret = EINVAL;
- break;
- }
- SIG_CANTMASK(curthread->sigmask);
- THR_SCHED_UNLOCK(curthread, curthread);
-
- /*
- * Run down any pending signals:
- */
- if (ret == 0)
- _thr_sig_check_pending(curthread);
- } else
- THR_SCHED_UNLOCK(curthread, curthread);
-
- if (ret == 0 && oset != NULL)
- *oset = oldset;
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_sigpending.c b/lib/libkse/thread/thr_sigpending.c
deleted file mode 100644
index 7a0a76d..0000000
--- a/lib/libkse/thread/thr_sigpending.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 1999 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/signalvar.h>
-#include <signal.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_sigpending, sigpending);
-
-int
-_sigpending(sigset_t *set)
-{
- struct pthread *curthread = _get_curthread();
- kse_critical_t crit;
- sigset_t sigset;
- int ret = 0;
-
- /* Check for a null signal set pointer: */
- if (set == NULL) {
- /* Return an invalid argument: */
- ret = EINVAL;
- }
- else {
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- return (__sys_sigpending(set));
-
- crit = _kse_critical_enter();
- KSE_SCHED_LOCK(curthread->kse, curthread->kseg);
- sigset = curthread->sigpend;
- KSE_SCHED_UNLOCK(curthread->kse, curthread->kseg);
- KSE_LOCK_ACQUIRE(curthread->kse, &_thread_signal_lock);
- SIGSETOR(sigset, _thr_proc_sigpending);
- KSE_LOCK_RELEASE(curthread->kse, &_thread_signal_lock);
- _kse_critical_leave(crit);
- *set = sigset;
- }
- /* Return the completion status: */
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_sigprocmask.c b/lib/libkse/thread/thr_sigprocmask.c
deleted file mode 100644
index d87df58..0000000
--- a/lib/libkse/thread/thr_sigprocmask.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/signalvar.h>
-#include <signal.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_sigprocmask, sigprocmask);
-
-int
-_sigprocmask(int how, const sigset_t *set, sigset_t *oset)
-{
- int ret;
-
- ret = pthread_sigmask(how, set, oset);
- if (ret) {
- errno = ret;
- ret = -1;
- }
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_sigsuspend.c b/lib/libkse/thread/thr_sigsuspend.c
deleted file mode 100644
index b8e14e3..0000000
--- a/lib/libkse/thread/thr_sigsuspend.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <signal.h>
-#include <errno.h>
-#include <pthread.h>
-#include <string.h>
-#include <sys/signalvar.h>
-#include "thr_private.h"
-
-__weak_reference(__sigsuspend, sigsuspend);
-
-int
-_sigsuspend(const sigset_t *set)
-{
- struct pthread *curthread = _get_curthread();
- sigset_t oldmask, newmask, tempset;
- int ret = -1;
-
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- return (__sys_sigsuspend(set));
-
- /* Check if a new signal set was provided by the caller: */
- if (set != NULL) {
- newmask = *set;
- SIG_CANTMASK(newmask);
- THR_LOCK_SWITCH(curthread);
-
- /* Save current sigmask: */
- oldmask = curthread->sigmask;
- curthread->oldsigmask = &oldmask;
-
- /* Change the caller's mask: */
- curthread->sigmask = newmask;
- tempset = curthread->sigpend;
- SIGSETNAND(tempset, newmask);
- if (SIGISEMPTY(tempset)) {
- THR_SET_STATE(curthread, PS_SIGSUSPEND);
- /* Wait for a signal: */
- _thr_sched_switch_unlocked(curthread);
- } else {
- curthread->check_pending = 1;
- THR_UNLOCK_SWITCH(curthread);
- /* check pending signal I can handle: */
- _thr_sig_check_pending(curthread);
- }
- if ((curthread->cancelflags & THR_CANCELLING) != 0)
- curthread->oldsigmask = NULL;
- else {
- THR_ASSERT(curthread->oldsigmask == NULL,
- "oldsigmask is not cleared");
- }
-
- /* Always return an interrupted error: */
- errno = EINTR;
- } else {
- /* Return an invalid argument error: */
- errno = EINVAL;
- }
-
- /* Return the completion status: */
- return (ret);
-}
-
-int
-__sigsuspend(const sigset_t * set)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = _sigsuspend(set);
- _thr_cancel_leave(curthread, 1);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_sigwait.c b/lib/libkse/thread/thr_sigwait.c
deleted file mode 100644
index 6f60653..0000000
--- a/lib/libkse/thread/thr_sigwait.c
+++ /dev/null
@@ -1,202 +0,0 @@
-//depot/projects/kse/lib/libpthread/thread/thr_sigwait.c#1 - branch change 15154 (text+ko)
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <signal.h>
-#include <sys/param.h>
-#include <sys/signalvar.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__sigwait, sigwait);
-__weak_reference(__sigtimedwait, sigtimedwait);
-__weak_reference(__sigwaitinfo, sigwaitinfo);
-
-static int
-lib_sigtimedwait(const sigset_t *set, siginfo_t *info,
- const struct timespec * timeout)
-{
- struct pthread *curthread = _get_curthread();
- int ret = 0;
- int i;
- struct sigwait_data waitdata;
- sigset_t waitset;
- kse_critical_t crit;
- siginfo_t siginfo;
-
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) {
- if (info == NULL)
- info = &siginfo;
- return (__sys_sigtimedwait((sigset_t *)set, info,
- (struct timespec *)timeout));
- }
-
- /*
- * Initialize the set of signals that will be waited on:
- */
- waitset = *set;
-
- /* These signals can't be waited on. */
- SIGDELSET(waitset, SIGKILL);
- SIGDELSET(waitset, SIGSTOP);
-
- /*
- * POSIX says that the _application_ must explicitly install
- * a dummy handler for signals that are SIG_IGN in order
- * to sigwait on them. Note that SIG_IGN signals are left in
- * the mask because a subsequent sigaction could enable an
- * ignored signal.
- */
-
- crit = _kse_critical_enter();
- KSE_SCHED_LOCK(curthread->kse, curthread->kseg);
- for (i = 1; i <= _SIG_MAXSIG; ++i) {
- if (SIGISMEMBER(waitset, i) &&
- SIGISMEMBER(curthread->sigpend, i)) {
- SIGDELSET(curthread->sigpend, i);
- siginfo = curthread->siginfo[i - 1];
- KSE_SCHED_UNLOCK(curthread->kse,
- curthread->kseg);
- _kse_critical_leave(crit);
- ret = i;
- goto OUT;
- }
- }
- curthread->timeout = 0;
- curthread->interrupted = 0;
- _thr_set_timeout(timeout);
- /* Wait for a signal: */
- siginfo.si_signo = 0;
- waitdata.waitset = &waitset;
- waitdata.siginfo = &siginfo;
- curthread->data.sigwait = &waitdata;
- THR_SET_STATE(curthread, PS_SIGWAIT);
- _thr_sched_switch_unlocked(curthread);
- /*
- * Return the signal number to the caller:
- */
- if (siginfo.si_signo > 0) {
- ret = siginfo.si_signo;
- } else {
- if (curthread->interrupted)
- errno = EINTR;
- else if (curthread->timeout)
- errno = EAGAIN;
- ret = -1;
- }
- curthread->timeout = 0;
- curthread->interrupted = 0;
- /*
- * Probably unnecessary, but since it's in a union struct
- * we don't know how it could be used in the future.
- */
- curthread->data.sigwait = NULL;
-
-OUT:
- if (ret > 0 && info != NULL)
- *info = siginfo;
-
- return (ret);
-}
-
-int
-__sigtimedwait(const sigset_t *set, siginfo_t *info,
- const struct timespec * timeout)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = lib_sigtimedwait(set, info, timeout);
- _thr_cancel_leave(curthread, 1);
- return (ret);
-}
-
-int _sigtimedwait(const sigset_t *set, siginfo_t *info,
- const struct timespec * timeout)
-{
- return lib_sigtimedwait(set, info, timeout);
-}
-
-int
-__sigwaitinfo(const sigset_t *set, siginfo_t *info)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = lib_sigtimedwait(set, info, NULL);
- _thr_cancel_leave(curthread, 1);
- return (ret);
-}
-
-int
-_sigwaitinfo(const sigset_t *set, siginfo_t *info)
-{
- return lib_sigtimedwait(set, info, NULL);
-}
-
-int
-__sigwait(const sigset_t *set, int *sig)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = lib_sigtimedwait(set, NULL, NULL);
- if (ret > 0) {
- *sig = ret;
- ret = 0;
- } else {
- ret = errno;
- }
- _thr_cancel_leave(curthread, 1);
- return (ret);
-}
-
-int
-_sigwait(const sigset_t *set, int *sig)
-{
- int ret;
-
- ret = lib_sigtimedwait(set, NULL, NULL);
- if (ret > 0) {
- *sig = ret;
- ret = 0;
- } else {
- ret = errno;
- }
- return (ret);
-}
-
diff --git a/lib/libkse/thread/thr_single_np.c b/lib/libkse/thread/thr_single_np.c
deleted file mode 100644
index 1ee5e79..0000000
--- a/lib/libkse/thread/thr_single_np.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <pthread.h>
-#include <pthread_np.h>
-
-__weak_reference(_pthread_single_np, pthread_single_np);
-
-int _pthread_single_np()
-{
-
- /* Enter single-threaded (non-POSIX) scheduling mode: */
- pthread_suspend_all_np();
- /*
- * XXX - Do we want to do this?
- * __is_threaded = 0;
- */
- return (0);
-}
diff --git a/lib/libkse/thread/thr_sleep.c b/lib/libkse/thread/thr_sleep.c
deleted file mode 100644
index 7547e60..0000000
--- a/lib/libkse/thread/thr_sleep.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <unistd.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-extern unsigned int __sleep(unsigned int);
-
-__weak_reference(_sleep, sleep);
-
-unsigned int
-_sleep(unsigned int seconds)
-{
- struct pthread *curthread = _get_curthread();
- unsigned int ret;
-
- _thr_cancel_enter(curthread);
- ret = __sleep(seconds);
- _thr_cancel_leave(curthread, 1);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_spec.c b/lib/libkse/thread/thr_spec.c
deleted file mode 100644
index 6c2b636..0000000
--- a/lib/libkse/thread/thr_spec.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-/* Static variables: */
-struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX];
-
-__weak_reference(_pthread_key_create, pthread_key_create);
-__weak_reference(_pthread_key_delete, pthread_key_delete);
-__weak_reference(_pthread_getspecific, pthread_getspecific);
-__weak_reference(_pthread_setspecific, pthread_setspecific);
-
-
-int
-_pthread_key_create(pthread_key_t *key, void (*destructor) (void *))
-{
- struct pthread *curthread = _get_curthread();
- int i;
-
- /* Lock the key table: */
- THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
- for (i = 0; i < PTHREAD_KEYS_MAX; i++) {
-
- if (_thread_keytable[i].allocated == 0) {
- _thread_keytable[i].allocated = 1;
- _thread_keytable[i].destructor = destructor;
- _thread_keytable[i].seqno++;
-
- /* Unlock the key table: */
- THR_LOCK_RELEASE(curthread, &_keytable_lock);
- *key = i;
- return (0);
- }
-
- }
- /* Unlock the key table: */
- THR_LOCK_RELEASE(curthread, &_keytable_lock);
- return (EAGAIN);
-}
-
-int
-_pthread_key_delete(pthread_key_t key)
-{
- struct pthread *curthread = _get_curthread();
- int ret = 0;
-
- if ((unsigned int)key < PTHREAD_KEYS_MAX) {
- /* Lock the key table: */
- THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
-
- if (_thread_keytable[key].allocated)
- _thread_keytable[key].allocated = 0;
- else
- ret = EINVAL;
-
- /* Unlock the key table: */
- THR_LOCK_RELEASE(curthread, &_keytable_lock);
- } else
- ret = EINVAL;
- return (ret);
-}
-
-void
-_thread_cleanupspecific(void)
-{
- struct pthread *curthread = _get_curthread();
- void (*destructor)( void *);
- void *data = NULL;
- int key;
- int i;
-
- if (curthread->specific == NULL)
- return;
-
- /* Lock the key table: */
- THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
- for (i = 0; (i < PTHREAD_DESTRUCTOR_ITERATIONS) &&
- (curthread->specific_data_count > 0); i++) {
- for (key = 0; (key < PTHREAD_KEYS_MAX) &&
- (curthread->specific_data_count > 0); key++) {
- destructor = NULL;
-
- if (_thread_keytable[key].allocated &&
- (curthread->specific[key].data != NULL)) {
- if (curthread->specific[key].seqno ==
- _thread_keytable[key].seqno) {
- data = (void *)
- curthread->specific[key].data;
- destructor = _thread_keytable[key].destructor;
- }
- curthread->specific[key].data = NULL;
- curthread->specific_data_count--;
- }
-
- /*
- * If there is a destructore, call it
- * with the key table entry unlocked:
- */
- if (destructor != NULL) {
- /*
- * Don't hold the lock while calling the
- * destructor:
- */
- THR_LOCK_RELEASE(curthread, &_keytable_lock);
- destructor(data);
- THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
- }
- }
- }
- THR_LOCK_RELEASE(curthread, &_keytable_lock);
- free(curthread->specific);
- curthread->specific = NULL;
- if (curthread->specific_data_count > 0)
- stderr_debug("Thread %p has exited with leftover "
- "thread-specific data after %d destructor iterations\n",
- curthread, PTHREAD_DESTRUCTOR_ITERATIONS);
-}
-
-static inline struct pthread_specific_elem *
-pthread_key_allocate_data(void)
-{
- struct pthread_specific_elem *new_data;
-
- new_data = (struct pthread_specific_elem *)
- malloc(sizeof(struct pthread_specific_elem) * PTHREAD_KEYS_MAX);
- if (new_data != NULL) {
- memset((void *) new_data, 0,
- sizeof(struct pthread_specific_elem) * PTHREAD_KEYS_MAX);
- }
- return (new_data);
-}
-
-int
-_pthread_setspecific(pthread_key_t key, const void *value)
-{
- struct pthread *pthread;
- int ret = 0;
-
- /* Point to the running thread: */
- pthread = _get_curthread();
-
- if ((pthread->specific) ||
- (pthread->specific = pthread_key_allocate_data())) {
- if ((unsigned int)key < PTHREAD_KEYS_MAX) {
- if (_thread_keytable[key].allocated) {
- if (pthread->specific[key].data == NULL) {
- if (value != NULL)
- pthread->specific_data_count++;
- } else if (value == NULL)
- pthread->specific_data_count--;
- pthread->specific[key].data = value;
- pthread->specific[key].seqno =
- _thread_keytable[key].seqno;
- ret = 0;
- } else
- ret = EINVAL;
- } else
- ret = EINVAL;
- } else
- ret = ENOMEM;
- return (ret);
-}
-
-void *
-_pthread_getspecific(pthread_key_t key)
-{
- struct pthread *pthread;
- void *data;
-
- /* Point to the running thread: */
- pthread = _get_curthread();
-
- /* Check if there is specific data: */
- if (pthread->specific != NULL && (unsigned int)key < PTHREAD_KEYS_MAX) {
- /* Check if this key has been used before: */
- if (_thread_keytable[key].allocated &&
- (pthread->specific[key].seqno == _thread_keytable[key].seqno)) {
- /* Return the value: */
- data = (void *) pthread->specific[key].data;
- } else {
- /*
- * This key has not been used before, so return NULL
- * instead:
- */
- data = NULL;
- }
- } else
- /* No specific data has been created, so just return NULL: */
- data = NULL;
- return (data);
-}
diff --git a/lib/libkse/thread/thr_spinlock.c b/lib/libkse/thread/thr_spinlock.c
deleted file mode 100644
index 2b2b251..0000000
--- a/lib/libkse/thread/thr_spinlock.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- *
- */
-
-#include <sys/types.h>
-#include <machine/atomic.h>
-
-#include <libc_private.h>
-#include "spinlock.h"
-#include "thr_private.h"
-
-#define MAX_SPINLOCKS 5
-
-struct spinlock_extra {
- spinlock_t *owner;
- pthread_mutex_t lock;
-};
-
-static void init_spinlock(spinlock_t *lck);
-
-static struct pthread_mutex_attr static_mutex_attr =
- PTHREAD_MUTEXATTR_STATIC_INITIALIZER;
-static pthread_mutexattr_t static_mattr = &static_mutex_attr;
-
-static pthread_mutex_t spinlock_static_lock;
-static struct spinlock_extra extra[MAX_SPINLOCKS];
-static int spinlock_count = 0;
-static int initialized = 0;
-
-/*
- * These are for compatability only. Spinlocks of this type
- * are deprecated.
- */
-
-void
-_spinunlock(spinlock_t *lck)
-{
- struct spinlock_extra *extra;
-
- extra = (struct spinlock_extra *)lck->fname;
- _pthread_mutex_unlock(&extra->lock);
-}
-
-/*
- * Lock a location for the running thread. Yield to allow other
- * threads to run if this thread is blocked because the lock is
- * not available. Note that this function does not sleep. It
- * assumes that the lock will be available very soon.
- */
-void
-_spinlock(spinlock_t *lck)
-{
- struct spinlock_extra *extra;
-
- if (!__isthreaded)
- PANIC("Spinlock called when not threaded.");
- if (!initialized)
- PANIC("Spinlocks not initialized.");
- /*
- * Try to grab the lock and loop if another thread grabs
- * it before we do.
- */
- if (lck->fname == NULL)
- init_spinlock(lck);
- extra = (struct spinlock_extra *)lck->fname;
- _pthread_mutex_lock(&extra->lock);
-}
-
-/*
- * Lock a location for the running thread. Yield to allow other
- * threads to run if this thread is blocked because the lock is
- * not available. Note that this function does not sleep. It
- * assumes that the lock will be available very soon.
- *
- * This function checks if the running thread has already locked the
- * location, warns if this occurs and creates a thread dump before
- * returning.
- */
-void
-_spinlock_debug(spinlock_t *lck, char *fname, int lineno)
-{
- _spinlock(lck);
-}
-
-static void
-init_spinlock(spinlock_t *lck)
-{
- _pthread_mutex_lock(&spinlock_static_lock);
- if ((lck->fname == NULL) && (spinlock_count < MAX_SPINLOCKS)) {
- lck->fname = (char *)&extra[spinlock_count];
- extra[spinlock_count].owner = lck;
- spinlock_count++;
- }
- _pthread_mutex_unlock(&spinlock_static_lock);
- if (lck->fname == NULL)
- PANIC("Exceeded max spinlocks");
-}
-
-void
-_thr_spinlock_init(void)
-{
- int i;
-
- if (initialized != 0) {
- _thr_mutex_reinit(&spinlock_static_lock);
- for (i = 0; i < spinlock_count; i++)
- _thr_mutex_reinit(&extra[i].lock);
- } else {
- if (_pthread_mutex_init(&spinlock_static_lock, &static_mattr))
- PANIC("Cannot initialize spinlock_static_lock");
- for (i = 0; i < MAX_SPINLOCKS; i++) {
- if (_pthread_mutex_init(&extra[i].lock, &static_mattr))
- PANIC("Cannot initialize spinlock extra");
- }
- initialized = 1;
- }
-}
diff --git a/lib/libkse/thread/thr_stack.c b/lib/libkse/thread/thr_stack.c
deleted file mode 100644
index f634055..0000000
--- a/lib/libkse/thread/thr_stack.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2001 Daniel Eischen <deischen@freebsd.org>
- * Copyright (c) 2000-2001 Jason Evans <jasone@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/queue.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-/* Spare thread stack. */
-struct stack {
- LIST_ENTRY(stack) qe; /* Stack queue linkage. */
- size_t stacksize; /* Stack size (rounded up). */
- size_t guardsize; /* Guard size. */
- void *stackaddr; /* Stack address. */
-};
-
-/*
- * Default sized (stack and guard) spare stack queue. Stacks are cached
- * to avoid additional complexity managing mmap()ed stack regions. Spare
- * stacks are used in LIFO order to increase cache locality.
- */
-static LIST_HEAD(, stack) dstackq = LIST_HEAD_INITIALIZER(dstackq);
-
-/*
- * Miscellaneous sized (non-default stack and/or guard) spare stack queue.
- * Stacks are cached to avoid additional complexity managing mmap()ed
- * stack regions. This list is unordered, since ordering on both stack
- * size and guard size would be more trouble than it's worth. Stacks are
- * allocated from this cache on a first size match basis.
- */
-static LIST_HEAD(, stack) mstackq = LIST_HEAD_INITIALIZER(mstackq);
-
-/**
- * Base address of the last stack allocated (including its red zone, if
- * there is one). Stacks are allocated contiguously, starting beyond the
- * top of the main stack. When a new stack is created, a red zone is
- * typically created (actually, the red zone is mapped with PROT_NONE) above
- * the top of the stack, such that the stack will not be able to grow all
- * the way to the bottom of the next stack. This isn't fool-proof. It is
- * possible for a stack to grow by a large amount, such that it grows into
- * the next stack, and as long as the memory within the red zone is never
- * accessed, nothing will prevent one thread stack from trouncing all over
- * the next.
- *
- * low memory
- * . . . . . . . . . . . . . . . . . .
- * | |
- * | stack 3 | start of 3rd thread stack
- * +-----------------------------------+
- * | |
- * | Red Zone (guard page) | red zone for 2nd thread
- * | |
- * +-----------------------------------+
- * | stack 2 - PTHREAD_STACK_DEFAULT | top of 2nd thread stack
- * | |
- * | |
- * | |
- * | |
- * | stack 2 |
- * +-----------------------------------+ <-- start of 2nd thread stack
- * | |
- * | Red Zone | red zone for 1st thread
- * | |
- * +-----------------------------------+
- * | stack 1 - PTHREAD_STACK_DEFAULT | top of 1st thread stack
- * | |
- * | |
- * | |
- * | |
- * | stack 1 |
- * +-----------------------------------+ <-- start of 1st thread stack
- * | | (initial value of last_stack)
- * | Red Zone |
- * | | red zone for main thread
- * +-----------------------------------+
- * | USRSTACK - PTHREAD_STACK_INITIAL | top of main thread stack
- * | | ^
- * | | |
- * | | |
- * | | | stack growth
- * | |
- * +-----------------------------------+ <-- start of main thread stack
- * (USRSTACK)
- * high memory
- *
- */
-static void *last_stack = NULL;
-
-/*
- * Round size up to the nearest multiple of
- * _thr_page_size.
- */
-static inline size_t
-round_up(size_t size)
-{
- if (size % _thr_page_size != 0)
- size = ((size / _thr_page_size) + 1) *
- _thr_page_size;
- return size;
-}
-
-int
-_thr_stack_alloc(struct pthread_attr *attr)
-{
- struct stack *spare_stack;
- struct kse *curkse;
- kse_critical_t crit;
- size_t stacksize;
- size_t guardsize;
- char *stackaddr;
-
- /*
- * Round up stack size to nearest multiple of _thr_page_size so
- * that mmap() * will work. If the stack size is not an even
- * multiple, we end up initializing things such that there is
- * unused space above the beginning of the stack, so the stack
- * sits snugly against its guard.
- */
- stacksize = round_up(attr->stacksize_attr);
- guardsize = round_up(attr->guardsize_attr);
-
- attr->stackaddr_attr = NULL;
- attr->flags &= ~THR_STACK_USER;
-
- /*
- * Use the garbage collector lock for synchronization of the
- * spare stack lists and allocations from usrstack.
- */
- crit = _kse_critical_enter();
- curkse = _get_curkse();
- KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
- /*
- * If the stack and guard sizes are default, try to allocate a stack
- * from the default-size stack cache:
- */
- if ((stacksize == _thr_stack_default) &&
- (guardsize == _thr_guard_default)) {
- if ((spare_stack = LIST_FIRST(&dstackq)) != NULL) {
- /* Use the spare stack. */
- LIST_REMOVE(spare_stack, qe);
- attr->stackaddr_attr = spare_stack->stackaddr;
- }
- }
- /*
- * The user specified a non-default stack and/or guard size, so try to
- * allocate a stack from the non-default size stack cache, using the
- * rounded up stack size (stack_size) in the search:
- */
- else {
- LIST_FOREACH(spare_stack, &mstackq, qe) {
- if (spare_stack->stacksize == stacksize &&
- spare_stack->guardsize == guardsize) {
- LIST_REMOVE(spare_stack, qe);
- attr->stackaddr_attr = spare_stack->stackaddr;
- break;
- }
- }
- }
- if (attr->stackaddr_attr != NULL) {
- /* A cached stack was found. Release the lock. */
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- _kse_critical_leave(crit);
- }
- else {
- /* Allocate a stack from usrstack. */
- if (last_stack == NULL)
- last_stack = _usrstack - _thr_stack_initial -
- _thr_guard_default;
-
- /* Allocate a new stack. */
- stackaddr = last_stack - stacksize - guardsize;
-
- /*
- * Even if stack allocation fails, we don't want to try to
- * use this location again, so unconditionally decrement
- * last_stack. Under normal operating conditions, the most
- * likely reason for an mmap() error is a stack overflow of
- * the adjacent thread stack.
- */
- last_stack -= (stacksize + guardsize);
-
- /* Release the lock before mmap'ing it. */
- KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
- _kse_critical_leave(crit);
-
- /* Map the stack and guard page together, and split guard
- page from allocated space: */
- if ((stackaddr = mmap(stackaddr, stacksize+guardsize,
- PROT_READ | PROT_WRITE, MAP_STACK,
- -1, 0)) != MAP_FAILED &&
- (guardsize == 0 ||
- mprotect(stackaddr, guardsize, PROT_NONE) == 0)) {
- stackaddr += guardsize;
- } else {
- if (stackaddr != MAP_FAILED)
- munmap(stackaddr, stacksize + guardsize);
- stackaddr = NULL;
- }
- attr->stackaddr_attr = stackaddr;
- }
- if (attr->stackaddr_attr != NULL)
- return (0);
- else
- return (-1);
-}
-
-/* This function must be called with _thread_list_lock held. */
-void
-_thr_stack_free(struct pthread_attr *attr)
-{
- struct stack *spare_stack;
-
- if ((attr != NULL) && ((attr->flags & THR_STACK_USER) == 0)
- && (attr->stackaddr_attr != NULL)) {
- spare_stack = (attr->stackaddr_attr + attr->stacksize_attr
- - sizeof(struct stack));
- spare_stack->stacksize = round_up(attr->stacksize_attr);
- spare_stack->guardsize = round_up(attr->guardsize_attr);
- spare_stack->stackaddr = attr->stackaddr_attr;
-
- if (spare_stack->stacksize == _thr_stack_default &&
- spare_stack->guardsize == _thr_guard_default) {
- /* Default stack/guard size. */
- LIST_INSERT_HEAD(&dstackq, spare_stack, qe);
- } else {
- /* Non-default stack/guard size. */
- LIST_INSERT_HEAD(&mstackq, spare_stack, qe);
- }
- attr->stackaddr_attr = NULL;
- }
-}
diff --git a/lib/libkse/thread/thr_suspend_np.c b/lib/libkse/thread/thr_suspend_np.c
deleted file mode 100644
index 4813de1..0000000
--- a/lib/libkse/thread/thr_suspend_np.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-static void suspend_common(struct pthread *thread);
-
-__weak_reference(_pthread_suspend_np, pthread_suspend_np);
-__weak_reference(_pthread_suspend_all_np, pthread_suspend_all_np);
-
-/* Suspend a thread: */
-int
-_pthread_suspend_np(pthread_t thread)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- /* Suspending the current thread doesn't make sense. */
- if (thread == _get_curthread())
- ret = EDEADLK;
-
- /* Add a reference to the thread: */
- else if ((ret = _thr_ref_add(curthread, thread, /*include dead*/0))
- == 0) {
- /* Lock the threads scheduling queue: */
- THR_SCHED_LOCK(curthread, thread);
- suspend_common(thread);
- /* Unlock the threads scheduling queue: */
- THR_SCHED_UNLOCK(curthread, thread);
-
- /* Don't forget to remove the reference: */
- _thr_ref_delete(curthread, thread);
- }
- return (ret);
-}
-
-void
-_pthread_suspend_all_np(void)
-{
- struct pthread *curthread = _get_curthread();
- struct pthread *thread;
- kse_critical_t crit;
-
- /* Take the thread list lock: */
- crit = _kse_critical_enter();
- KSE_LOCK_ACQUIRE(curthread->kse, &_thread_list_lock);
-
- TAILQ_FOREACH(thread, &_thread_list, tle) {
- if (thread != curthread) {
- THR_SCHED_LOCK(curthread, thread);
- suspend_common(thread);
- THR_SCHED_UNLOCK(curthread, thread);
- }
- }
-
- /* Release the thread list lock: */
- KSE_LOCK_RELEASE(curthread->kse, &_thread_list_lock);
- _kse_critical_leave(crit);
-}
-
-void
-suspend_common(struct pthread *thread)
-{
- if ((thread->state != PS_DEAD) &&
- (thread->state != PS_DEADLOCK) &&
- ((thread->flags & THR_FLAGS_EXITING) == 0)) {
- thread->flags |= THR_FLAGS_SUSPENDED;
- if ((thread->flags & THR_FLAGS_IN_RUNQ) != 0) {
- THR_RUNQ_REMOVE(thread);
- THR_SET_STATE(thread, PS_SUSPENDED);
- }
-#ifdef NOT_YET
- if ((thread->attr.flags & PTHREAD_SCOPE_SYSTEM) != 0)
- /* ??? */
-#endif
- }
-}
diff --git a/lib/libkse/thread/thr_switch_np.c b/lib/libkse/thread/thr_switch_np.c
deleted file mode 100644
index b70ce70..0000000
--- a/lib/libkse/thread/thr_switch_np.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1998 Daniel Eischen <eischen@vigrid.com>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with 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 Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL EISCHEN AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <errno.h>
-#include <pthread.h>
-#include <pthread_np.h>
-#include "thr_private.h"
-
-
-__weak_reference(_pthread_switch_add_np, pthread_switch_add_np);
-__weak_reference(_pthread_switch_delete_np, pthread_switch_delete_np);
-
-int
-_pthread_switch_add_np(pthread_switch_routine_t routine)
-{
- return (ENOTSUP);
-}
-
-int
-_pthread_switch_delete_np(pthread_switch_routine_t routine)
-{
- return (ENOTSUP);
-}
diff --git a/lib/libkse/thread/thr_symbols.c b/lib/libkse/thread/thr_symbols.c
deleted file mode 100644
index 5091a95..0000000
--- a/lib/libkse/thread/thr_symbols.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2004 David Xu <davidxu@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#include <stddef.h>
-#include <pthread.h>
-#include <rtld.h>
-
-#include "thr_private.h"
-
-/* A collection of symbols needed by debugger */
-
-/* int _libkse_debug */
-int _thread_off_tcb = offsetof(struct pthread, tcb);
-int _thread_off_tmbx = offsetof(struct tcb, tcb_tmbx);
-int _thread_off_next = offsetof(struct pthread, tle.tqe_next);
-int _thread_off_attr_flags = offsetof(struct pthread, attr.flags);
-int _thread_off_kse = offsetof(struct pthread, kse);
-int _thread_off_kse_locklevel = offsetof(struct kse, k_locklevel);
-int _thread_off_thr_locklevel = offsetof(struct pthread, locklevel);
-int _thread_off_linkmap = offsetof(Obj_Entry, linkmap);
-int _thread_off_tlsindex = offsetof(Obj_Entry, tlsindex);
-int _thread_size_key = sizeof(struct pthread_key);
-int _thread_off_key_allocated = offsetof(struct pthread_key, allocated);
-int _thread_off_key_destructor = offsetof(struct pthread_key, destructor);
-int _thread_max_keys = PTHREAD_KEYS_MAX;
-int _thread_off_dtv = DTV_OFFSET;
-int _thread_off_state = offsetof(struct pthread, state);
-int _thread_state_running = PS_RUNNING;
-int _thread_state_zoombie = PS_DEAD;
diff --git a/lib/libkse/thread/thr_system.c b/lib/libkse/thread/thr_system.c
deleted file mode 100644
index 57c2199..0000000
--- a/lib/libkse/thread/thr_system.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-extern int __system(const char *);
-
-__weak_reference(_system, system);
-
-int
-_system(const char *string)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = __system(string);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_tcdrain.c b/lib/libkse/thread/thr_tcdrain.c
deleted file mode 100644
index d0d701b..0000000
--- a/lib/libkse/thread/thr_tcdrain.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <termios.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-extern int __tcdrain(int);
-
-__weak_reference(_tcdrain, tcdrain);
-
-int
-_tcdrain(int fd)
-{
- struct pthread *curthread = _get_curthread();
- int ret;
-
- _thr_cancel_enter(curthread);
- ret = __tcdrain(fd);
- _thr_cancel_leave(curthread, 1);
-
- return (ret);
-}
diff --git a/lib/libkse/thread/thr_vfork.c b/lib/libkse/thread/thr_vfork.c
deleted file mode 100644
index dbefc65..0000000
--- a/lib/libkse/thread/thr_vfork.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * $FreeBSD$
- */
-#include <unistd.h>
-
-__weak_reference(_vfork, vfork);
-
-int
-_vfork(void)
-{
- return (fork());
-}
diff --git a/lib/libkse/thread/thr_wait.c b/lib/libkse/thread/thr_wait.c
deleted file mode 100644
index 689f683..0000000
--- a/lib/libkse/thread/thr_wait.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <pthread.h>
-#include "thr_private.h"
-
-extern int __wait(int *);
-
-__weak_reference(_wait, wait);
-
-pid_t
-_wait(int *istat)
-{
- struct pthread *curthread = _get_curthread();
- pid_t ret;
-
- _thr_cancel_enter(curthread);
- ret = __wait(istat);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_wait4.c b/lib/libkse/thread/thr_wait4.c
deleted file mode 100644
index 12a1067..0000000
--- a/lib/libkse/thread/thr_wait4.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <sys/types.h>
-
-#include "namespace.h"
-#include <errno.h>
-#include <sys/wait.h>
-#include <pthread.h>
-#include "un-namespace.h"
-
-#include "thr_private.h"
-
-__weak_reference(__wait4, wait4);
-
-pid_t
-__wait4(pid_t pid, int *istat, int options, struct rusage *rusage)
-{
- struct pthread *curthread = _get_curthread();
- pid_t ret;
-
- _thr_cancel_enter(curthread);
- ret = _wait4(pid, istat, options, rusage);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_waitpid.c b/lib/libkse/thread/thr_waitpid.c
deleted file mode 100644
index 4edef3b..0000000
--- a/lib/libkse/thread/thr_waitpid.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-extern int __waitpid(pid_t, int *, int);
-
-__weak_reference(_waitpid, waitpid);
-
-pid_t
-_waitpid(pid_t wpid, int *status, int options)
-{
- struct pthread *curthread = _get_curthread();
- pid_t ret;
-
- _thr_cancel_enter(curthread);
- ret = __waitpid(wpid, status, options);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_write.c b/lib/libkse/thread/thr_write.c
deleted file mode 100644
index 39d221c..0000000
--- a/lib/libkse/thread/thr_write.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- *
- */
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/uio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__write, write);
-
-ssize_t
-__write(int fd, const void *buf, size_t nbytes)
-{
- struct pthread *curthread = _get_curthread();
- ssize_t ret;
-
- _thr_cancel_enter(curthread);
- ret = __sys_write(fd, buf, nbytes);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_writev.c b/lib/libkse/thread/thr_writev.c
deleted file mode 100644
index 81499d7..0000000
--- a/lib/libkse/thread/thr_writev.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- *
- */
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/uio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(__writev, writev);
-
-ssize_t
-__writev(int fd, const struct iovec *iov, int iovcnt)
-{
- struct pthread *curthread = _get_curthread();
- ssize_t ret;
-
- _thr_cancel_enter(curthread);
- ret = __sys_writev(fd, iov, iovcnt);
- _thr_cancel_leave(curthread, 1);
-
- return ret;
-}
diff --git a/lib/libkse/thread/thr_yield.c b/lib/libkse/thread/thr_yield.c
deleted file mode 100644
index 5c24113..0000000
--- a/lib/libkse/thread/thr_yield.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#include <pthread.h>
-#include "thr_private.h"
-
-__weak_reference(_sched_yield, sched_yield);
-__weak_reference(_pthread_yield, pthread_yield);
-
-int
-_sched_yield(void)
-{
- struct pthread *curthread = _get_curthread();
-
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM)
- return (__sys_sched_yield());
-
- /* Reset the accumulated time slice value for the current thread: */
- curthread->slice_usec = -1;
-
- /* Schedule the next thread: */
- _thr_sched_switch(curthread);
- /* Always return no error. */
- return(0);
-}
-
-/* Draft 4 yield */
-void
-_pthread_yield(void)
-{
- struct pthread *curthread = _get_curthread();
-
- if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) {
- __sys_sched_yield();
- return;
- }
-
- /* Reset the accumulated time slice value for the current thread: */
- curthread->slice_usec = -1;
-
- /* Schedule the next thread: */
- _thr_sched_switch(curthread);
-}
diff --git a/lib/ncurses/form/Makefile b/lib/ncurses/form/Makefile
deleted file mode 100644
index 6e69075..0000000
--- a/lib/ncurses/form/Makefile
+++ /dev/null
@@ -1,97 +0,0 @@
-# Makefile for libform
-# $FreeBSD$
-
-NCURSES=${.CURDIR}/../../contrib/ncurses
-
-.PATH: ${NCURSES}/form
-.PATH: ${NCURSES}/include
-.PATH: ${NCURSES}/man
-
-LIB= form
-AWK?= awk
-
-SRCS= ncurses_def.h \
- fld_arg.c fld_attr.c fld_current.c fld_def.c fld_dup.c fld_ftchoice.c \
- fld_ftlink.c fld_info.c fld_just.c fld_link.c fld_max.c fld_move.c \
- fld_newftyp.c fld_opts.c fld_pad.c fld_page.c fld_stat.c fld_type.c \
- fld_user.c frm_cursor.c frm_data.c frm_def.c frm_driver.c frm_hook.c \
- frm_opts.c frm_page.c frm_post.c frm_req_name.c frm_scale.c frm_sub.c \
- frm_user.c frm_win.c fty_alnum.c fty_alpha.c fty_enum.c fty_int.c \
- fty_ipv4.c fty_num.c fty_regex.c
-INCS= ${NCURSES}/form/form.h
-
-CLEANFILES+= ncurses_def.h
-CFLAGS+= -I.
-.if exists(${.OBJDIR}/../libncurses)
-CFLAGS+= -I${.OBJDIR}/../libncurses
-.endif
-CFLAGS+=-I${.CURDIR}/../libncurses -I${NCURSES}/form -I${NCURSES}/menu \
- -I${NCURSES}/include -Wall -DNDEBUG -DHAVE_CONFIG_H
-
-ncurses_def.h: MKncurses_def.sh ncurses_defs
- AWK=${AWK} sh ${NCURSES}/include/MKncurses_def.sh \
- ${NCURSES}/include/ncurses_defs > ncurses_def.h
-
-MANx= form.3x form_cursor.3x form_data.3x form_driver.3x \
- form_field.3x form_field_attributes.3x form_field_buffer.3x \
- form_field_info.3x form_field_just.3x form_field_new.3x \
- form_field_opts.3x form_field_userptr.3x \
- form_field_validation.3x form_fieldtype.3x form_hook.3x \
- form_new.3x form_new_page.3x form_opts.3x form_page.3x \
- form_post.3x form_requestname.3x form_userptr.3x form_win.3x
-
-# Generate the MAN list from MANx
-.for page in ${MANx}
-CLEANFILES+=${page:T:S/x$//g}
-MAN+=${page:T:S/x$//g}
-${page:T:S/x$//g}: ${page}
- cat ${.ALLSRC} > ${.TARGET}
-.endfor
-
-MLINKS+=form_cursor.3 pos_form_cursor.3
-MLINKS+=form_data.3 data_ahead.3 form_data.3 data_behind.3
-MLINKS+=form_field.3 field_count.3 form_field.3 form_fields.3 \
- form_field.3 move_field.3 form_field.3 set_form_fields.3
-MLINKS+=form_field_attributes.3 field_back.3 \
- form_field_attributes.3 field_fore.3 \
- form_field_attributes.3 field_pad.3 \
- form_field_attributes.3 set_field_back.3 \
- form_field_attributes.3 set_field_fore.3 \
- form_field_attributes.3 set_field_pad.3
-MLINKS+=form_field_buffer.3 field_buffer.3 \
- form_field_buffer.3 field_status.3 \
- form_field_buffer.3 set_field_buffer.3 \
- form_field_buffer.3 set_field_status.3 \
- form_field_buffer.3 set_max_field.3
-MLINKS+=form_field_info.3 dynamic_fieldinfo.3 form_field_info.3 field_info.3
-MLINKS+=form_field_just.3 field_just.3 form_field_just.3 set_field_just.3
-MLINKS+=form_field_new.3 dup_field.3 form_field_new.3 free_field.3 \
- form_field_new.3 link_field.3 form_field_new.3 new_field.3
-MLINKS+=form_field_opts.3 field_opts.3 form_field_opts.3 field_opts_off.3 \
- form_field_opts.3 field_opts_on.3 form_field_opts.3 set_field_opts.3 \
- form_field_opts.3 set_form_opts.3
-MLINKS+=form_field_userptr.3 field_userptr.3 \
- form_field_userptr.3 set_field_userptr.3
-MLINKS+=form_field_validation.3 field_arg.3 \
- form_field_validation.3 field_type.3 \
- form_field_validation.3 set_field_type.3
-MLINKS+=form_fieldtype.3 link_fieldtype.3 \
- form_fieldtype.3 set_fieldtype_arg.3 \
- form_fieldtype.3 set_fieldtype_choice.3
-MLINKS+=form_hook.3 field_init.3 form_hook.3 field_term.3 \
- form_hook.3 form_init.3 form_hook.3 form_term.3 \
- form_hook.3 set_field_init.3 form_hook.3 set_field_term.3 \
- form_hook.3 set_form_init.3 form_hook.3 set_form_term.3
-MLINKS+=form_new.3 free_form.3 form_new.3 new_form.3
-MLINKS+=form_new_page.3 new_page.3 form_new_page.3 set_new_page.3
-MLINKS+=form_opts.3 form_opts_off.3 form_opts.3 form_opts_on.3
-MLINKS+=form_page.3 current_field.3 form_page.3 field_index.3 \
- form_page.3 set_current_field.3 form_page.3 set_form_page.3
-MLINKS+=form_post.3 post_form.3 form_post.3 unpost_form.3
-MLINKS+=form_requestname.3 form_request_by_name.3 \
- form_requestname.3 form_request_name.3
-MLINKS+=form_userptr.3 set_form_userptr.3
-MLINKS+=form_win.3 form_sub.3 form_win.3 scale_form.3 \
- form_win.3 set_form_sub.3 form_win.3 set_form_win.3
-
-.include <bsd.lib.mk>
diff --git a/lib/ncurses/menu/Makefile b/lib/ncurses/menu/Makefile
deleted file mode 100644
index fd3ddfe..0000000
--- a/lib/ncurses/menu/Makefile
+++ /dev/null
@@ -1,82 +0,0 @@
-# Makefile for libmenu
-# $FreeBSD$
-
-NCURSES=${.CURDIR}/../../contrib/ncurses
-
-.PATH: ${NCURSES}/menu ${NCURSES}/include
-.PATH: ${NCURSES}/man
-
-LIB= menu
-AWK?= awk
-
-SRCS= ncurses_def.h \
- m_attribs.c m_cursor.c m_driver.c m_format.c m_global.c m_hook.c \
- m_item_cur.c m_item_nam.c m_item_new.c m_item_opt.c m_item_top.c \
- m_item_use.c m_item_val.c m_item_vis.c m_items.c m_new.c m_opts.c \
- m_pad.c m_pattern.c m_post.c m_req_name.c m_scale.c m_spacing.c \
- m_sub.c m_userptr.c m_win.c
-INCS= ${NCURSES}/menu/menu.h ${NCURSES}/menu/eti.h
-
-CLEANFILES+= ncurses_def.h
-CFLAGS+= -I.
-.if exists(${.OBJDIR}/../libncurses)
-CFLAGS+= -I${.OBJDIR}/../libncurses
-.endif
-CFLAGS+=-I${.CURDIR}/../libncurses -I${NCURSES}/menu -I${NCURSES}/include \
- -Wall -DNDEBUG -DHAVE_CONFIG_H
-
-ncurses_def.h: MKncurses_def.sh ncurses_defs
- AWK=${AWK} sh ${NCURSES}/include/MKncurses_def.sh \
- ${NCURSES}/include/ncurses_defs > ncurses_def.h
-
-MANx= menu.3x menu_attributes.3x menu_cursor.3x \
- menu_driver.3x menu_format.3x menu_hook.3x menu_items.3x \
- menu_mark.3x menu_new.3x menu_opts.3x menu_pattern.3x \
- menu_post.3x menu_requestname.3x menu_spacing.3x \
- menu_userptr.3x menu_win.3x mitem_current.3x mitem_name.3x \
- mitem_new.3x mitem_opts.3x mitem_userptr.3x mitem_value.3x \
- mitem_visible.3x
-
-# Generate the MAN list from MANx
-.for page in ${MANx}
-CLEANFILES+=${page:T:S/x$//g}
-MAN+=${page:T:S/x$//g}
-${page:T:S/x$//g}: ${page}
- cat ${.ALLSRC} > ${.TARGET}
-.endfor
-
-MLINKS+=menu_attributes.3 menu_back.3 menu_attributes.3 menu_fore.3 \
- menu_attributes.3 menu_grey.3 menu_attributes.3 menu_pad.3 \
- menu_attributes.3 set_menu_back.3 menu_attributes.3 set_menu_fore.3 \
- menu_attributes.3 set_menu_grey.3 menu_attributes.3 set_menu_pad.3
-MLINKS+=menu_cursor.3 pos_menu_cursor.3
-MLINKS+=menu_format.3 set_menu_format.3
-MLINKS+=menu_hook.3 item_init.3 menu_hook.3 item_term.3 \
- menu_hook.3 menu_init.3 menu_hook.3 menu_term.3 \
- menu_hook.3 set_item_init.3 menu_hook.3 set_item_term.3 \
- menu_hook.3 set_menu_init.3 menu_hook.3 set_menu_term.3
-MLINKS+=menu_items.3 item_count.3 menu_items.3 set_menu_items.3
-MLINKS+=menu_mark.3 set_menu_mark.3
-MLINKS+=menu_new.3 free_menu.3 menu_new.3 new_menu.3
-MLINKS+=menu_opts.3 menu_opts_off.3 menu_opts.3 menu_opts_on.3
-MLINKS+=menu_pattern.3 set_menu_pattern.3
-MLINKS+=menu_post.3 post_menu.3 menu_post.3 unpost_menu.3
-MLINKS+=menu_requestname.3 menu_request_by_name.3 \
- menu_requestname.3 menu_request_name.3
-MLINKS+=menu_spacing.3 set_menu_spacing.3
-MLINKS+=menu_userptr.3 set_menu_userptr.3
-MLINKS+=menu_win.3 menu_sub.3 menu_win.3 scale_menu.3 \
- menu_win.3 set_menu_sub.3 menu_win.3 set_menu_win.3
-MLINKS+=mitem_current.3 current_item.3 mitem_current.3 item_index.3 \
- mitem_current.3 set_top_row.3 mitem_current.3 top_row.3 \
- mitem_current.3 set_current_item.3
-MLINKS+=mitem_name.3 item_description.3 mitem_name.3 item_name.3
-MLINKS+=mitem_new.3 free_item.3 mitem_new.3 new_item.3
-MLINKS+=mitem_opts.3 item_opts.3 mitem_opts.3 item_opts_off.3 \
- mitem_opts.3 item_opts_on.3 mitem_opts.3 set_item_opts.3 \
- mitem_opts.3 set_menu_opts.3
-MLINKS+=mitem_userptr.3 item_userptr.3 mitem_userptr.3 set_item_userptr.3
-MLINKS+=mitem_value.3 item_value.3 mitem_value.3 set_item_value.3
-MLINKS+=mitem_visible.3 item_visible.3
-
-.include <bsd.lib.mk>
diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile
deleted file mode 100644
index 7eaa4de..0000000
--- a/lib/ncurses/ncurses/Makefile
+++ /dev/null
@@ -1,561 +0,0 @@
-# $FreeBSD$
-
-NCURSES=${.CURDIR}/../../contrib/ncurses
-
-LIB= ncurses
-SHLIBDIR?= /lib
-SHLIB_MAJOR=5
-
-# Should be elsewhere
-AWK?= awk
-TERMINFODIR?= ${SHAREDIR}/misc
-
-NCURSES_MAJOR!=egrep 'NCURSES_MAJOR[ ]*=' ${NCURSES}/dist.mk | sed -e 's%^[^0-9]*%%'
-NCURSES_MINOR!=egrep 'NCURSES_MINOR[ ]*=' ${NCURSES}/dist.mk | sed -e 's%^[^0-9]*%%'
-NCURSES_PATCH!=egrep 'NCURSES_PATCH[ ]*=' ${NCURSES}/dist.mk | sed -e 's%^[^0-9]*%%'
-
-# From autoconf (!)
-NCURSES_CONST= const
-NCURSES_XNAMES= 1
-NCURSES_OSPEED= short
-NCURSES_CH_T= chtype
-NCURSES_EXT_FUNCS= 1
-NCURSES_LIBUTF8= 0
-NCURSES_MBSTATE_T= 0
-BROKEN_LINKER= 0
-BUILTIN_BOOL= 1
-BOOL_TYPE= 0
-HAVE_VSSCANF= 1
-HEADER_STDBOOL= 1
-TYPE_OF_BOOL= unsigned char
-TYPEOF_CHTYPE= long
-WIDEC_SHIFT= 8
-SHIFT_LIMIT= 32
-ONEUL= 1UL
-
-.PATH: ${NCURSES}/ncurses
-.PATH: ${NCURSES}/ncurses/base
-.PATH: ${NCURSES}/ncurses/tinfo
-.PATH: ${NCURSES}/ncurses/tty
-.PATH: ${NCURSES}/ncurses/trace
-.PATH: ${NCURSES}/include
-.PATH: ${NCURSES}/man
-
-CFLAGS+=-I. -I${.CURDIR} -I${NCURSES}/ncurses -I${NCURSES}/include
-CFLAGS+=-Wall -DFREEBSD_NATIVE -DNDEBUG -DHAVE_CONFIG_H -DTERMIOS
-
-GENSRC= \
- codes.c \
- expanded.c \
- fallback.c \
- lib_gen.c \
- lib_keyname.c \
- names.c \
- unctrl.c
-
-GENHDR= \
- curses.h \
- hashsize.h \
- init_keytry.h \
- ncurses_def.h \
- nomacros.h \
- parametrized.h \
- term.h \
- termcap.h \
- unctrl.h
-
-# Installed
-HEADERS=curses.h term.h termcap.h unctrl.h
-SRCHDRS=ncurses_dll.h
-INCS= ${HEADERS} ${SRCHDRS}
-INCSLINKS= curses.h ${INCLUDEDIR}/ncurses.h
-
-# Components of names.c and codes.c
-NAMESRC=boolnames boolfnames numnames numfnames strnames strfnames
-CODESRC=boolcodes numcodes strcodes
-
-SRCS= ${GENHDR} ${GENSRC} \
- access.c \
- add_tries.c \
- alloc_entry.c \
- alloc_ttype.c \
- captoinfo.c \
- comp_captab.c \
- comp_error.c \
- comp_expand.c \
- comp_hash.c \
- comp_parse.c \
- comp_scan.c \
- define_key.c \
- doalloc.c \
- free_ttype.c \
- getenv_num.c \
- hardscroll.c \
- hashmap.c \
- home_terminfo.c \
- init_keytry.c \
- keybound.c \
- keyok.c \
- lib_acs.c \
- lib_addch.c \
- lib_addstr.c \
- lib_baudrate.c \
- lib_beep.c \
- lib_bkgd.c \
- lib_box.c \
- lib_chgat.c \
- lib_clear.c \
- lib_clearok.c \
- lib_clrbot.c \
- lib_clreol.c \
- lib_color.c \
- lib_colorset.c \
- lib_cur_term.c \
- lib_data.c \
- lib_delch.c \
- lib_delwin.c \
- lib_dft_fgbg.c \
- lib_echo.c \
- lib_endwin.c \
- lib_erase.c \
- lib_flash.c \
- lib_freeall.c \
- lib_getch.c \
- lib_getstr.c \
- lib_has_cap.c \
- lib_hline.c \
- lib_immedok.c \
- lib_inchstr.c \
- lib_initscr.c \
- lib_insch.c \
- lib_insdel.c \
- lib_insstr.c \
- lib_instr.c \
- lib_isendwin.c \
- lib_kernel.c \
- lib_leaveok.c \
- lib_longname.c \
- lib_mouse.c \
- lib_move.c \
- lib_mvcur.c \
- lib_mvwin.c \
- lib_napms.c \
- lib_newterm.c \
- lib_newwin.c \
- lib_nl.c \
- lib_options.c \
- lib_overlay.c \
- lib_pad.c \
- lib_print.c \
- lib_printw.c \
- lib_raw.c \
- lib_redrawln.c \
- lib_refresh.c \
- lib_restart.c \
- lib_scanw.c \
- lib_screen.c \
- lib_scroll.c \
- lib_scrollok.c \
- lib_scrreg.c \
- lib_set_term.c \
- lib_setup.c \
- lib_slk.c \
- lib_slkatr_set.c \
- lib_slkatrof.c \
- lib_slkatron.c \
- lib_slkatrset.c \
- lib_slkattr.c \
- lib_slkclear.c \
- lib_slkcolor.c \
- lib_slkinit.c \
- lib_slklab.c \
- lib_slkrefr.c \
- lib_slkset.c \
- lib_slktouch.c \
- lib_termcap.c \
- lib_termname.c \
- lib_tgoto.c \
- lib_ti.c \
- lib_touch.c \
- lib_tparm.c \
- lib_tputs.c \
- lib_trace.c \
- lib_tstp.c \
- lib_ttyflags.c \
- lib_twait.c \
- lib_ungetch.c \
- lib_vidattr.c \
- lib_vline.c \
- lib_wattroff.c \
- lib_wattron.c \
- lib_winch.c \
- lib_window.c \
- memmove.c \
- name_match.c \
- nc_panel.c \
- parse_entry.c \
- read_entry.c \
- resizeterm.c \
- safe_sprintf.c \
- setbuf.c \
- sigaction.c \
- strings.c \
- tries.c \
- tty_update.c \
- varargs.c \
- version.c \
- visbuf.c \
- vsscanf.c \
- wresize.c \
- write_entry.c
-
-# Currently unused, for debugging libncurses itself.
-DBGSRCS=lib_traceatr.c \
- lib_tracebits.c \
- lib_tracechr.c \
- lib_tracedmp.c \
- lib_tracemse.c \
- trace_buf.c \
- trace_tries.c \
- trace_xnames.c
-
-# From our old libtermcap.
-# Used instead of the hideous read_termcap.c abomination.
-SRCS+= termcap.c
-
-CLEANFILES+= ${GENSRC} ${GENHDR} keys.list make_hash term.h.new \
- make_keys MKterm.h.awk comp_captab.c curses.head \
- namehdr nameftr codeftr ${NAMESRC} ${CODESRC}
-
-.if !defined(NO_INSTALLLIB)
-SYMLINKS+=libncurses.a ${LIBDIR}/libcurses.a
-SYMLINKS+=libncurses.a ${LIBDIR}/libtermcap.a
-SYMLINKS+=libncurses.a ${LIBDIR}/libtermlib.a
-SYMLINKS+=libncurses.a ${LIBDIR}/libmytinfo.a
-SYMLINKS+=libncurses.a ${LIBDIR}/libtinfo.a
-.endif
-.if !defined(NO_PIC)
-# no need for major at all, it's an ld-time redirection only
-SYMLINKS+=libncurses.so ${LIBDIR}/libcurses.so
-SYMLINKS+=libncurses.so ${LIBDIR}/libtermcap.so
-SYMLINKS+=libncurses.so ${LIBDIR}/libtermlib.so
-SYMLINKS+=libncurses.so ${LIBDIR}/libmytinfo.so
-SYMLINKS+=libncurses.so ${LIBDIR}/libtinfo.so
-.endif
-.if !defined(NO_PROFILE)
-SYMLINKS+=libncurses_p.a ${LIBDIR}/libcurses_p.a
-SYMLINKS+=libncurses_p.a ${LIBDIR}/libtermcap_p.a
-SYMLINKS+=libncurses_p.a ${LIBDIR}/libtermlib_p.a
-SYMLINKS+=libncurses_p.a ${LIBDIR}/libmytinfo_p.a
-SYMLINKS+=libncurses_p.a ${LIBDIR}/libtinfo_p.a
-.endif
-
-DOCSDIR= /usr/share/doc/ncurses
-DOCS= ncurses-intro.html hackguide.html
-
-.if !defined(NO_HTML)
-.PATH: ${NCURSES}/doc/html
-FILESGROUPS= DOCS
-.endif
-
-# Generated source
-namehdr nameftr codeftr ${NAMESRC} ${CODESRC}: MKnames.awk Caps
- ${AWK} -f ${NCURSES}/ncurses/tinfo/MKnames.awk ${NCURSES}/include/Caps
-
-.ORDER: namehdr ${NAMESRC} ${CODESRC} nameftr codeftr names.c codes.c
-
-names.c: namehdr ${NAMESRC} nameftr
- cat namehdr ${NAMESRC} nameftr > $@
-
-codes.c: namehdr ${CODESRC} codeftr
- cat namehdr ${CODESRC} codeftr > $@
-
-lib_gen.c: MKlib_gen.sh curses.h
- LC_ALL=C sh ${NCURSES}/ncurses/base/MKlib_gen.sh "${CC} -E ${CFLAGS}" \
- "${AWK}" generated < curses.h >$@
-
-lib_keyname.c: keys.list MKkeyname.awk
- ${AWK} -f ${NCURSES}/ncurses/base/MKkeyname.awk keys.list > lib_keyname.c
-
-unctrl.c: MKunctrl.awk
- echo | ${AWK} -f ${NCURSES}/ncurses/base/MKunctrl.awk > unctrl.c
-
-comp_captab.c: MKcaptab.awk Caps make_hash
- sh ${NCURSES}/ncurses/tinfo/MKcaptab.awk "${AWK}" \
- ${NCURSES}/include/Caps > comp_captab.c
-
-expanded.c: MKexpanded.sh
- sh ${NCURSES}/ncurses/tty/MKexpanded.sh "${CC} -E" ${CFLAGS} >expanded.c
-
-fallback.c: MKfallback.sh
- sh ${NCURSES}/ncurses/tinfo/MKfallback.sh > fallback.c
-
-# Generated headers
-ncurses_def.h: MKncurses_def.sh ncurses_defs
- AWK=${AWK} sh ${NCURSES}/include/MKncurses_def.sh \
- ${NCURSES}/include/ncurses_defs > ncurses_def.h
-
-nomacros.h: MKlib_gen.sh curses.h
- LC_ALL=C sh ${NCURSES}/ncurses/base/MKlib_gen.sh "${CC} -E ${CFLAGS}" \
- "${AWK}" generated < curses.h | fgrep undef > $@
-
-init_keytry.h: keys.list make_keys
- ./make_keys keys.list > init_keytry.h
-
-hashsize.h: MKhashsize.sh Caps
- sh ${NCURSES}/include/MKhashsize.sh ${NCURSES}/include/Caps > $@
-
-parametrized.h: MKparametrized.sh Caps
- AWK=${AWK} sh ${NCURSES}/include/MKparametrized.sh \
- ${NCURSES}/include/Caps > $@
-
-term.h: MKterm.h.awk edit_cfg.sh Caps
- ${AWK} -f MKterm.h.awk ${NCURSES}/include/Caps > $@.new
- sh ${NCURSES}/include/edit_cfg.sh ${.CURDIR}/ncurses_cfg.h $@.new
- mv -f $@.new $@
-
-curses.h: curses.head MKkey_defs.sh Caps
- cat curses.head > $@.new
- AWK=${AWK} _POSIX2_VERSION=199209 sh ${NCURSES}/include/MKkey_defs.sh \
- ${NCURSES}/include/Caps >> $@.new
- cat ${NCURSES}/include/curses.tail >> $@.new
- mv -f $@.new $@
-
-# Generated intermediate files
-keys.list: MKkeys_list.sh Caps
- AWK=${AWK} sh ${NCURSES}/ncurses/tinfo/MKkeys_list.sh \
- ${NCURSES}/include/Caps | LC_ALL=C sort > keys.list
-
-# Build tools
-build-tools: make_hash make_keys
-
-make_keys: make_keys.c names.c ncurses_def.h ${HEADERS}
- ${CC} -o $@ ${CFLAGS} ${NCURSES}/ncurses/tinfo/make_keys.c
-
-make_hash: comp_hash.c hashsize.h ncurses_def.h ${HEADERS}
- ${CC} -o $@ ${CFLAGS} -DMAIN_PROGRAM \
- ${NCURSES}/ncurses/tinfo/comp_hash.c
-
-# ./configure generated
-MKterm.h.awk: MKterm.h.awk.in
- sed <${NCURSES}/include/MKterm.h.awk.in >$@ \
- -e "/@NCURSES_MAJOR@/s%%${NCURSES_MAJOR}%" \
- -e "/@NCURSES_MINOR@/s%%${NCURSES_MINOR}%" \
- -e "/@NCURSES_CONST@/s%%${NCURSES_CONST}%" \
- -e "/@NCURSES_XNAMES@/s%%${NCURSES_XNAMES}%"
-
-termcap.h: termcap.h.in
- sed <${NCURSES}/include/termcap.h.in >$@ \
- -e "/@NCURSES_MAJOR@/s%%${NCURSES_MAJOR}%" \
- -e "/@NCURSES_MINOR@/s%%${NCURSES_MINOR}%" \
- -e "/@NCURSES_CONST@/s%%${NCURSES_CONST}%" \
- -e "/@NCURSES_OSPEED@/s%%${NCURSES_OSPEED}%"
-
-curses.head: curses.h.in
- sed <${NCURSES}/include/curses.h.in >$@ \
- -e "/@BROKEN_LINKER@/s%%${BROKEN_LINKER}%" \
- -e "/@HAVE_VSSCANF@/s%%${HAVE_VSSCANF}%" \
- -e "/@NCURSES_CONST@/s%%${NCURSES_CONST}%" \
- -e "/@NCURSES_MAJOR@/s%%${NCURSES_MAJOR}%" \
- -e "/@NCURSES_MINOR@/s%%${NCURSES_MINOR}%" \
- -e "/@NCURSES_PATCH@/s%%${NCURSES_PATCH}%" \
- -e "/@NCURSES_CH_T@/s%%${NCURSES_CH_T}%" \
- -e "/@NCURSES_EXT_FUNCS@/s%%${NCURSES_EXT_FUNCS}%" \
- -e "/@NCURSES_LIBUTF8@/s%%${NCURSES_LIBUTF8}%" \
- -e "/@NCURSES_MBSTATE_T@/s%%${NCURSES_MBSTATE_T}%" \
- -e "s%@cf_cv_1UL@%${ONEUL}%g" \
- -e "s%@cf_cv_builtin_bool@%${BUILTIN_BOOL}%g" \
- -e "s%@cf_cv_cc_bool_type@%${BOOL_TYPE}%g" \
- -e "s%@cf_cv_shift_limit@%${SHIFT_LIMIT}%g" \
- -e "s%@cf_cv_header_stdbool_h@%${HEADER_STDBOOL}%g" \
- -e "s%@cf_cv_type_of_bool@%${TYPE_OF_BOOL}%g" \
- -e "s%@cf_cv_typeof_chtype@%${TYPEOF_CHTYPE}%g" \
- -e "s%@cf_cv_widec_shift@%${WIDEC_SHIFT}%g" \
- -e "s/ _WCHAR_T/ __wchar_t/g" \
- -e "s/ _WINT_T/ __wint_t/g" \
-
-unctrl.h: unctrl.h.in
- sed <${NCURSES}/include/$@.in >$@ \
- -e "/@NCURSES_MAJOR@/s%%${NCURSES_MAJOR}%" \
- -e "/@NCURSES_MINOR@/s%%${NCURSES_MINOR}%"
-
-# MAN page gunk
-terminfo.5: MKterminfo.sh terminfo.head Caps
- sh ${NCURSES}/man/MKterminfo.sh ${NCURSES}/man/terminfo.head \
- ${NCURSES}/include/Caps ${NCURSES}/man/terminfo.tail >$@
-
-CLEANFILES+= terminfo.5
-MANFILTER= sed -e 's%@TERMINFO@%${TERMINFODIR}/terminfo%g' \
- -e 's%@NCURSES_OSPEED@%${NCURSES_OSPEED}%g'
-
-MANx= curs_addch.3x curs_addchstr.3x curs_addstr.3x curs_attr.3x \
- curs_beep.3x curs_bkgd.3x curs_border.3x curs_clear.3x curs_color.3x \
- curs_delch.3x curs_deleteln.3x curs_extend.3x curs_getch.3x \
- curs_getstr.3x \
- curs_getyx.3x curs_inch.3x curs_inchstr.3x curs_initscr.3x \
- curs_inopts.3x curs_insch.3x curs_insstr.3x curs_instr.3x \
- curs_kernel.3x curs_mouse.3x curs_move.3x curs_outopts.3x \
- curs_overlay.3x curs_pad.3x curs_print.3x curs_printw.3x \
- curs_refresh.3x curs_scanw.3x curs_scr_dump.3x curs_scroll.3x \
- curs_slk.3x curs_termattrs.3x curs_termcap.3x curs_terminfo.3x \
- curs_touch.3x curs_trace.3x curs_util.3x curs_window.3x \
- default_colors.3x define_key.3x \
- keybound.3x keyok.3x ncurses.3x resizeterm.3x wresize.3x
-MAN= term.5 terminfo.5
-MAN+= term.7
-
-# Generate the MAN list from MANx
-.for page in ${MANx}
-CLEANFILES+=${page:T:S/x$//g}
-MAN+=${page:T:S/x$//g}
-${page:T:S/x$//g}: ${page}
- cat ${.ALLSRC} > ${.TARGET}
-.endfor
-
-MLINKS+=ncurses.3 curses.3
-MLINKS+=curs_addch.3 addch.3 curs_addch.3 echochar.3 curs_addch.3 mvaddch.3 \
- curs_addch.3 mvwaddch.3 curs_addch.3 waddch.3 curs_addch.3 wechochar.3
-MLINKS+=curs_addchstr.3 addchnstr.3 curs_addchstr.3 addchstr.3 \
- curs_addchstr.3 mvaddchnstr.3 curs_addchstr.3 mvaddchstr.3 \
- curs_addchstr.3 mvwaddchnstr.3 curs_addchstr.3 mvwaddchstr.3 \
- curs_addchstr.3 waddchnstr.3 curs_addchstr.3 waddchstr.3
-MLINKS+=curs_addstr.3 addnstr.3 curs_addstr.3 addstr.3 \
- curs_addstr.3 mvaddnstr.3 curs_addstr.3 mvaddstr.3 \
- curs_addstr.3 mvwaddnstr.3 curs_addstr.3 mvwaddstr.3 \
- curs_addstr.3 waddnstr.3 curs_addstr.3 waddstr.3
-MLINKS+=curs_attr.3 PAIR_NUMBER.3 \
- curs_attr.3 attr_get.3 curs_attr.3 attr_off.3 curs_attr.3 attr_on.3 \
- curs_attr.3 attr_set.3 curs_attr.3 attroff.3 curs_attr.3 attron.3 \
- curs_attr.3 attrset.3 curs_attr.3 chgat.3 curs_attr.3 color_set.3 \
- curs_attr.3 mvchgat.3 curs_attr.3 mvwchgat.3 curs_attr.3 standend.3 \
- curs_attr.3 standout.3 curs_attr.3 wattr_get.3 curs_attr.3 wattr_off.3 \
- curs_attr.3 wattr_on.3 curs_attr.3 wattr_set.3 curs_attr.3 wattroff.3 \
- curs_attr.3 wattron.3 curs_attr.3 wattrset.3 curs_attr.3 wchgat.3 \
- curs_attr.3 wcolor_set.3 curs_attr.3 wstandend.3 \
- curs_attr.3 wstandout.3
-MLINKS+=curs_beep.3 beep.3 curs_beep.3 flash.3
-MLINKS+=curs_bkgd.3 bkgd.3 curs_bkgd.3 bkgdset.3 curs_bkgd.3 getbkgd.3 \
- curs_bkgd.3 wbkgd.3 curs_bkgd.3 wbkgdset.3
-MLINKS+=curs_border.3 border.3 curs_border.3 box.3 curs_border.3 hline.3 \
- curs_border.3 mvhline.3 curs_border.3 mvvline.3 \
- curs_border.3 mvwhline.3 \
- curs_border.3 mvwvline.3 curs_border.3 vline.3 curs_border.3 wborder.3 \
- curs_border.3 whline.3 curs_border.3 wvline.3
-MLINKS+=curs_clear.3 clear.3 curs_clear.3 clrtobot.3 curs_clear.3 clrtoeol.3 \
- curs_clear.3 erase.3 curs_clear.3 wclear.3 curs_clear.3 wclrtobot.3 \
- curs_clear.3 wclrtoeol.3 curs_clear.3 werase.3
-MLINKS+=curs_color.3 COLOR_PAIR.3 \
- curs_color.3 can_change_color.3 curs_color.3 color_content.3 \
- curs_color.3 has_colors.3 curs_color.3 init_color.3 \
- curs_color.3 init_pair.3 curs_color.3 pair_content.3 \
- curs_color.3 start_color.3
-MLINKS+=curs_delch.3 delch.3 curs_delch.3 mvdelch.3 curs_delch.3 mvwdelch.3 \
- curs_delch.3 wdelch.3
-MLINKS+=curs_deleteln.3 deleteln.3 curs_deleteln.3 insdelln.3 \
- curs_deleteln.3 insertln.3 curs_deleteln.3 wdeleteln.3 \
- curs_deleteln.3 winsdelln.3 curs_deleteln.3 winsertln.3
-MLINKS+=curs_extend.3 curses_version.3 curs_extend.3 use_extended_names.3
-MLINKS+=curs_getch.3 getch.3 curs_getch.3 has_key.3 curs_getch.3 mvgetch.3 \
- curs_getch.3 mvwgetch.3 curs_getch.3 ungetch.3 curs_getch.3 wgetch.3
-MLINKS+=curs_getstr.3 getnstr.3 curs_getstr.3 getstr.3 \
- curs_getstr.3 mvgetnstr.3 curs_getstr.3 mvgetstr.3 \
- curs_getstr.3 mvwgetnstr.3 curs_getstr.3 mvwgetstr.3 \
- curs_getstr.3 wgetnstr.3 curs_getstr.3 wgetstr.3
-MLINKS+=curs_getyx.3 getbegyx.3 curs_getyx.3 getmaxyx.3 \
- curs_getyx.3 getparyx.3 curs_getyx.3 getyx.3
-MLINKS+=curs_inch.3 inch.3 curs_inch.3 mvinch.3 curs_inch.3 mvwinch.3 \
- curs_inch.3 winch.3
-MLINKS+=curs_inchstr.3 inchnstr.3 curs_inchstr.3 inchstr.3 \
- curs_inchstr.3 mvinchnstr.3 curs_inchstr.3 mvinchstr.3 \
- curs_inchstr.3 mvwinchnstr.3 curs_inchstr.3 mvwinchstr.3 \
- curs_inchstr.3 winchnstr.3 curs_inchstr.3 winchstr.3
-MLINKS+=curs_initscr.3 delscreen.3 curs_initscr.3 endwin.3 \
- curs_initscr.3 initscr.3 curs_initscr.3 isendwin.3 \
- curs_initscr.3 newterm.3 curs_initscr.3 set_term.3
-MLINKS+=curs_inopts.3 cbreak.3 curs_inopts.3 echo.3 curs_inopts.3 halfdelay.3 \
- curs_inopts.3 intrflush.3 curs_inopts.3 keypad.3 curs_inopts.3 meta.3 \
- curs_inopts.3 nocbreak.3 curs_inopts.3 nodelay.3 \
- curs_inopts.3 noecho.3 curs_inopts.3 noqiflush.3 curs_inopts.3 noraw.3 \
- curs_inopts.3 notimeout.3 curs_inopts.3 qiflush.3 curs_inopts.3 raw.3 \
- curs_inopts.3 timeout.3 curs_inopts.3 typeahead.3 \
- curs_inopts.3 wtimeout.3
-MLINKS+=curs_insch.3 insch.3 curs_insch.3 mvinsch.3 curs_insch.3 mvwinsch.3 \
- curs_insch.3 winsch.3
-MLINKS+=curs_insstr.3 insnstr.3 curs_insstr.3 insstr.3 \
- curs_insstr.3 mvinsnstr.3 curs_insstr.3 mvinsstr.3 \
- curs_insstr.3 mvwinsnstr.3 curs_insstr.3 mvwinsstr.3 \
- curs_insstr.3 winsnstr.3 curs_insstr.3 winsstr.3
-MLINKS+=curs_instr.3 innstr.3 curs_instr.3 instr.3 curs_instr.3 mvinnstr.3 \
- curs_instr.3 mvinstr.3 curs_instr.3 mvwinnstr.3 \
- curs_instr.3 mvwinstr.3 curs_instr.3 winnstr.3 curs_instr.3 winstr.3
-MLINKS+=curs_kernel.3 curs_set.3 curs_kernel.3 def_prog_mode.3 \
- curs_kernel.3 def_shell_mode.3 curs_kernel.3 getsyx.3 \
- curs_kernel.3 napms.3 curs_kernel.3 reset_prog_mode.3 \
- curs_kernel.3 reset_shell_mode.3 curs_kernel.3 resetty.3 \
- curs_kernel.3 ripoffline.3 curs_kernel.3 savetty.3 \
- curs_kernel.3 setsyx.3
-MLINKS+=curs_mouse.3 getmouse.3 curs_mouse.3 mouse_trafo.3 \
- curs_mouse.3 mouseinterval.3 \
- curs_mouse.3 mousemask.3 curs_mouse.3 ungetmouse.3 \
- curs_mouse.3 wenclose.3 curs_mouse.3 wmouse_trafo.3
-MLINKS+=curs_move.3 move.3 curs_move.3 wmove.3
-MLINKS+=curs_outopts.3 clearok.3 curs_outopts.3 idcok.3 curs_outopts.3 idlok.3 \
- curs_outopts.3 immedok.3 curs_outopts.3 leaveok.3 curs_outopts.3 nl.3 \
- curs_outopts.3 nonl.3 curs_outopts.3 scrollok.3 \
- curs_outopts.3 setscrreg.3 curs_outopts.3 wsetscrreg.3
-MLINKS+=curs_overlay.3 copywin.3 curs_overlay.3 overlay.3 \
- curs_overlay.3 overwrite.3
-MLINKS+=curs_pad.3 newpad.3 curs_pad.3 pechochar.3 curs_pad.3 pnoutrefresh.3 \
- curs_pad.3 prefresh.3 curs_pad.3 subpad.3
-MLINKS+=curs_print.3 mcprint.3
-MLINKS+=curs_printw.3 mvprintw.3 curs_printw.3 mvwprintw.3 \
- curs_printw.3 printw.3 curs_printw.3 vw_printw.3 \
- curs_printw.3 vwprintw.3 curs_printw.3 wprintw.3
-MLINKS+=curs_refresh.3 doupdate.3 curs_refresh.3 redrawwin.3 \
- curs_refresh.3 refresh.3 curs_refresh.3 wnoutrefresh.3 \
- curs_refresh.3 wredrawln.3 curs_refresh.3 wrefresh.3
-MLINKS+=curs_scanw.3 mvscanw.3 curs_scanw.3 mvwscanw.3 curs_scanw.3 scanw.3 \
- curs_scanw.3 vw_scanw.3 curs_scanw.3 vwscanw.3 curs_scanw.3 wscanw.3
-MLINKS+=curs_scr_dump.3 scr_dump.3 curs_scr_dump.3 scr_init.3 \
- curs_scr_dump.3 scr_restore.3 curs_scr_dump.3 scr_set.3
-MLINKS+=curs_scroll.3 scrl.3 curs_scroll.3 scroll.3 curs_scroll.3 wscrl.3
-MLINKS+=curs_slk.3 slk_attr.3 curs_slk.3 slk_attr_off.3 \
- curs_slk.3 slk_attr_on.3 curs_slk.3 slk_attr_set.3 \
- curs_slk.3 slk_attroff.3 curs_slk.3 slk_attron.3 \
- curs_slk.3 slk_attrset.3 curs_slk.3 slk_clear.3 \
- curs_slk.3 slk_color.3 curs_slk.3 slk_init.3 curs_slk.3 slk_label.3 \
- curs_slk.3 slk_noutrefresh.3 curs_slk.3 slk_refresh.3 \
- curs_slk.3 slk_restore.3 curs_slk.3 slk_set.3 curs_slk.3 slk_touch.3
-MLINKS+=curs_termattrs.3 baudrate.3 curs_termattrs.3 erasechar.3 \
- curs_termattrs.3 has_ic.3 curs_termattrs.3 has_il.3 \
- curs_termattrs.3 killchar.3 curs_termattrs.3 longname.3 \
- curs_termattrs.3 termattrs.3 curs_termattrs.3 termname.3
-MLINKS+=curs_termcap.3 termcap.3 curs_termcap.3 tgetent.3 \
- curs_termcap.3 tgetflag.3 curs_termcap.3 tgetnum.3 \
- curs_termcap.3 tgetstr.3 curs_termcap.3 tgoto.3 \
- curs_termcap.3 tputs.3
-MLINKS+=curs_terminfo.3 del_curterm.3 curs_terminfo.3 mvcur.3 \
- curs_terminfo.3 putp.3 curs_terminfo.3 restartterm.3 \
- curs_terminfo.3 set_curterm.3 curs_terminfo.3 setterm.3 \
- curs_terminfo.3 setupterm.3 curs_terminfo.3 tigetflag.3 \
- curs_terminfo.3 tigetnum.3 curs_terminfo.3 tigetstr.3 \
- curs_terminfo.3 tparm.3 curs_terminfo.3 tputs.3 \
- curs_terminfo.3 vidattr.3 curs_terminfo.3 vidputs.3
-MLINKS+=curs_touch.3 is_linetouched.3 curs_touch.3 is_wintouched.3 \
- curs_touch.3 touchline.3 curs_touch.3 touchwin.3 \
- curs_touch.3 untouchwin.3 curs_touch.3 wtouchln.3
-MLINKS+=curs_util.3 delay_output.3 curs_util.3 filter.3 \
- curs_util.3 flushinp.3 curs_util.3 getwin.3 \
- curs_util.3 keyname.3 curs_util.3 putwin.3 \
- curs_util.3 unctrl.3 curs_util.3 use_env.3
-MLINKS+=curs_window.3 delwin.3 curs_window.3 derwin.3 curs_window.3 dupwin.3 \
- curs_window.3 mvderwin.3 curs_window.3 mvwin.3 curs_window.3 newwin.3 \
- curs_window.3 subwin.3 curs_window.3 syncok.3 \
- curs_window.3 wcursyncup.3 curs_window.3 wsyncdown.3 \
- curs_window.3 wsyncup.3
-MLINKS+=default_colors.3 assume_default_colors.3 \
- default_colors.3 use_default_colors.3
-
-NO_LINT=
-
-.include <bsd.lib.mk>
diff --git a/lib/ncurses/ncurses/ncurses_cfg.h b/lib/ncurses/ncurses/ncurses_cfg.h
deleted file mode 100644
index 3fc4c2b..0000000
--- a/lib/ncurses/ncurses/ncurses_cfg.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* include/ncurses_cfg.h. Generated automatically by configure. */
-/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
- * *
- * Permission is hereby granted, free of charge, to any person obtaining a *
- * copy of this software and associated documentation files (the *
- * "Software"), to deal in the Software without restriction, including *
- * without limitation the rights to use, copy, modify, merge, publish, *
- * distribute, distribute with modifications, sublicense, and/or sell *
- * copies of the Software, and to permit persons to whom the Software is *
- * furnished to do so, subject to the following conditions: *
- * *
- * The above copyright notice and this permission notice shall be included *
- * in all copies or substantial portions of the Software. *
- * *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
- * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
- * *
- * Except as contained in this notice, the name(s) of the above copyright *
- * holders shall not be used in advertising or otherwise to promote the *
- * sale, use or other dealings in this Software without prior written *
- * authorization. *
- ****************************************************************************/
-
-/****************************************************************************
- * Author: Thomas E. Dickey <dickey@clark.net> 1997 *
- ****************************************************************************/
-/*
- * $Id: ncurses_cfg.hin,v 1.3 2000/09/02 17:13:32 tom Exp $
- *
- * This is a template-file used to generate the "ncurses_cfg.h" file.
- *
- * Rather than list every definition, the configuration script substitutes the
- * definitions that it finds using 'sed'. You need a patch (original date
- * 971222) to autoconf 2.12 or 2.13 to do this.
- *
- * See:
- * http://dickey.his.com/autoconf/
- * ftp://dickey.his.com/autoconf/
- */
-
-/* $FreeBSD$ */
-
-#ifndef NC_CONFIG_H
-#define NC_CONFIG_H
-
-#define BSD_TPUTS 1
-#define CC_HAS_INLINE_FUNCS 1
-#define CC_HAS_PROTOS 1
-#define GCC_NORETURN __dead2
-#define GCC_PRINTF 1
-#define GCC_SCANF 1
-#define GCC_UNUSED __unused
-#define HAVE_BIG_CORE 1
-#define HAVE_BSD_CGETENT 1
-#define HAVE_CURSES_VERSION 1
-#define HAVE_DIRENT_H 1
-#define HAVE_ERRNO 1
-#define HAVE_FCNTL_H 1
-#define HAVE_FORM_H 1
-#define HAVE_GETCWD 1
-#define HAVE_GETEGID 1
-#define HAVE_GETEUID 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_GETTTYNAM 1
-#define HAVE_HAS_KEY 1
-#define HAVE_ISASCII 1
-#define HAVE_ISSETUGID 1
-#define HAVE_LIBFORM 1
-#define HAVE_LIBMENU 1
-#define HAVE_LIBPANEL 1
-#define HAVE_LIMITS_H 1
-#define HAVE_LINK 1
-#define HAVE_LOCALE_H 1
-#define HAVE_LONG_FILE_NAMES 1
-#define HAVE_MEMCCPY 1
-#define HAVE_MENU_H 1
-#define HAVE_MKSTEMP 1
-#define HAVE_NANOSLEEP 1
-#define HAVE_NC_ALLOC_H 1
-#define HAVE_PANEL_H 1
-#define HAVE_POLL 1
-#define HAVE_POLL_H 1
-#define HAVE_REGEX_H_FUNCS 1
-#define HAVE_REMOVE 1
-#define HAVE_REMOVE 1
-#define HAVE_RESIZETERM 1
-#define HAVE_SELECT 1
-#define HAVE_SETBUF 1
-#define HAVE_SETBUFFER 1
-#define HAVE_SETVBUF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SIGVEC 1
-#define HAVE_SIZECHANGE 1
-#define HAVE_STRDUP 1
-#define HAVE_STRSTR 1
-#define HAVE_SYMLINK 1
-#define HAVE_SYS_IOCTL_H 1
-#define HAVE_SYS_PARAM_H 1
-#define HAVE_SYS_POLL_H 1
-#define HAVE_SYS_SELECT_H 1
-#define HAVE_SYS_TIMES_H 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_SYS_TIME_SELECT 1
-#define HAVE_TCGETATTR 1
-#define HAVE_TCGETPGRP 1
-#define HAVE_TERMIOS_H 1
-#define HAVE_TIMES 1
-#define HAVE_TTYENT_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_UNLINK 1
-#define HAVE_USE_DEFAULT_COLORS 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_VSSCANF 1
-#define HAVE_WORKING_POLL 1
-#define HAVE_WRESIZE 1
-#define MIXEDCASE_FILENAMES 1
-#define NCURSES_EXT_FUNCS 1
-#define NCURSES_NO_PADDING 1
-#define NCURSES_PATHSEP ':'
-#define NDEBUG 1
-#define RETSIGTYPE void
-#define STDC_HEADERS 1
-#define SYSTEM_NAME "FreeBSD"
-#define TERMINFO "/usr/share/misc/terminfo"
-#define TERMINFO_DIRS "/usr/share/misc/terminfo"
-#define TIME_WITH_SYS_TIME 1
-#define TYPEOF_CHTYPE long
-#define USE_ASSUMED_COLOR 1
-#define USE_COLORFGBG 1
-#define USE_DATABASE 1
-#define USE_GETCAP 1
-#define USE_HASHMAP 1
-#define USE_SIGWINCH 1
-
-#include <ncurses_def.h>
-
- /* The C compiler may not treat these properly but C++ has to */
-#ifdef __cplusplus
-#undef const
-#undef inline
-#else
-#if defined(lint) || defined(TRACE)
-#undef inline
-#define inline /* nothing */
-#endif
-#endif
-
-#endif /* NC_CONFIG_H */
diff --git a/lib/ncurses/ncurses/pathnames.h b/lib/ncurses/ncurses/pathnames.h
deleted file mode 100644
index 5cac36f..0000000
--- a/lib/ncurses/ncurses/pathnames.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 6/4/93
- * $FreeBSD$
- */
-
-#define _PATH_DEF ".termcap /usr/share/misc/termcap"
-#define _PATH_DEF_SEC "/usr/share/misc/termcap"
diff --git a/lib/ncurses/ncurses/termcap.c b/lib/ncurses/ncurses/termcap.c
deleted file mode 100644
index 24e71d3..0000000
--- a/lib/ncurses/ncurses/termcap.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/* A portion of this file is from ncurses: */
-/***************************************************************************
-* COPYRIGHT NOTICE *
-****************************************************************************
-* ncurses is copyright (C) 1992-1995 *
-* Zeyd M. Ben-Halim *
-* zmbenhal@netcom.com *
-* Eric S. Raymond *
-* esr@snark.thyrsus.com *
-* *
-* Permission is hereby granted to reproduce and distribute ncurses *
-* by any means and for any fee, whether alone or as part of a *
-* larger distribution, in source or in binary form, PROVIDED *
-* this notice is included with any such distribution, and is not *
-* removed from any of its header files. Mention of ncurses in any *
-* applications linked with it is highly appreciated. *
-* *
-* ncurses comes AS IS with no warranty, implied or expressed. *
-* *
-***************************************************************************/
-
-#include <curses.priv.h>
-
-#include <string.h>
-#include <term.h>
-#include <tic.h>
-#include <term_entry.h>
-
-/* The rest is from BSD */
-/*
- * Copyright (c) 1980, 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#ifndef lint
-static const char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93";
-#endif /* not lint */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include "pathnames.h"
-
-#define PBUFSIZ MAXPATHLEN /* max length of filename path */
-#define PVECSIZ 32 /* max number of names in path */
-#define TBUFSIZ 1024 /* max length of _nc_tgetent buffer */
-
-char _nc_termcap[TBUFSIZ + 1]; /* Last getcap, provided to tgetent() emul */
-
-/*
- * termcap - routines for dealing with the terminal capability data base
- *
- * BUG: Should use a "last" pointer in tbuf, so that searching
- * for capabilities alphabetically would not be a n**2/2
- * process when large numbers of capabilities are given.
- * Note: If we add a last pointer now we will screw up the
- * tc capability. We really should compile termcap.
- *
- * Essentially all the work here is scanning and decoding escapes
- * in string capabilities. We don't use stdio because the editor
- * doesn't, and because living w/o it is not hard.
- */
-
-/*
- * Get an entry for terminal name in buffer _nc_termcap from the termcap
- * file.
- */
-int
-_nc_read_termcap_entry(const char *const name, TERMTYPE *const tp)
-{
- ENTRY *ep;
- char *p;
- char *cp;
- char *dummy;
- char **fname;
- char *home;
- int i;
- char pathbuf[PBUFSIZ]; /* holds raw path of filenames */
- char *pathvec[PVECSIZ]; /* to point to names in pathbuf */
- char **pvec; /* holds usable tail of path vector */
- char *termpath;
-
- _nc_termcap[0] = '\0'; /* in case */
- dummy = NULL;
- fname = pathvec;
- pvec = pathvec;
- p = pathbuf;
- cp = getenv("TERMCAP");
- /*
- * TERMCAP can have one of two things in it. It can be the
- * name of a file to use instead of /etc/termcap. In this
- * case it better start with a "/". Or it can be an entry to
- * use so we don't have to read the file. In this case it
- * has to already have the newlines crunched out. If TERMCAP
- * does not hold a file name then a path of names is searched
- * instead. The path is found in the TERMPATH variable, or
- * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists.
- */
- if (!cp || *cp != '/') { /* no TERMCAP or it holds an entry */
- if ( (termpath = getenv("TERMPATH")) )
- strncpy(pathbuf, termpath, PBUFSIZ);
- else {
- if ( (home = getenv("HOME")) ) {/* set up default */
- strncpy(pathbuf, home, PBUFSIZ - 1); /* $HOME first */
- pathbuf[PBUFSIZ - 2] = '\0'; /* -2 because we add a slash */
- p += strlen(pathbuf); /* path, looking in */
- *p++ = '/';
- } /* if no $HOME look in current directory */
- strncpy(p, _PATH_DEF, PBUFSIZ - (p - pathbuf));
- }
- }
- else /* user-defined name in TERMCAP */
- strncpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */
-
- /* For safety */
- if (issetugid())
- strcpy(pathbuf, _PATH_DEF_SEC);
-
- pathbuf[PBUFSIZ - 1] = '\0';
-
- *fname++ = pathbuf; /* tokenize path into vector of names */
- while (*++p)
- if (*p == ' ' || *p == ':') {
- *p = '\0';
- while (*++p)
- if (*p != ' ' && *p != ':')
- break;
- if (*p == '\0')
- break;
- *fname++ = p;
- if (fname >= pathvec + PVECSIZ) {
- fname--;
- break;
- }
- }
- *fname = (char *) 0; /* mark end of vector */
- if (cp && *cp && *cp != '/')
- if (cgetset(cp) < 0)
- return(-2);
-
- i = cgetent(&dummy, pathvec, (char *)name);
-
- if (i == 0) {
- char *pd, *ps, *tok, *s, *tcs;
- size_t len;
-
- pd = _nc_termcap;
- ps = dummy;
- if ((tok = strchr(ps, ':')) == NULL) {
- len = strlen(ps);
- if (len >= TBUFSIZ)
- i = -1;
- else
- strcpy(pd, ps);
- goto done;
- }
- len = tok - ps + 1;
- if (pd + len + 1 - _nc_termcap >= TBUFSIZ) {
- i = -1;
- goto done;
- }
- memcpy(pd, ps, len);
- ps += len;
- pd += len;
- *pd = '\0';
- tcs = pd - 1;
- for (;;) {
- while ((tok = strsep(&ps, ":")) != NULL &&
- *(tok - 2) != '\\' &&
- (*tok == '\0' || *tok == '\\' || !isgraph(*tok)))
- ;
- if (tok == NULL)
- break;
- for (s = tcs; s != NULL && s[1] != '\0';
- s = strchr(s, ':')) {
- s++;
- if (s[0] == tok[0] && s[1] == tok[1])
- goto skip_it;
- }
- len = strlen(tok);
- if (pd + len + 1 - _nc_termcap >= TBUFSIZ) {
- i = -1;
- break;
- }
- memcpy(pd, tok, len);
- pd += len;
- *pd++ = ':';
- *pd = '\0';
- skip_it: ;
- }
- }
-done:
- if (dummy)
- free(dummy);
-
-
-/*
- * From here on is ncurses-specific glue code
- */
-
- if (i < 0)
- return(ERR);
-
- _nc_set_source("TERMCAP");
- _nc_read_entry_source((FILE *)NULL, _nc_termcap, FALSE, TRUE, NULLHOOK);
-
- if (_nc_head == (ENTRY *)NULL)
- return(ERR);
-
- /* resolve all use references */
- _nc_resolve_uses(TRUE);
-
- for_entry_list(ep)
- if (_nc_name_match(ep->tterm.term_names, name, "|:"))
- {
- /*
- * Make a local copy of the terminal capabilities. free
- * all entry storage except the string table for the
- * loaded type (which we disconnected from the list by
- * NULLing out ep->tterm.str_table above).
- */
- memcpy(tp, &ep->tterm, sizeof(TERMTYPE));
- ep->tterm.str_table = (char *)NULL;
- _nc_free_entries(_nc_head);
- _nc_head = _nc_tail = NULL; /* do not reuse! */
-
- return 1; /* OK */
- }
-
- _nc_free_entries(_nc_head);
- _nc_head = _nc_tail = NULL; /* do not reuse! */
- return(0); /* not found */
-}
diff --git a/lib/ncurses/panel/Makefile b/lib/ncurses/panel/Makefile
deleted file mode 100644
index e715921..0000000
--- a/lib/ncurses/panel/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-# Makefile for libpanel
-# $FreeBSD$
-
-NCURSES=${.CURDIR}/../../contrib/ncurses
-
-.PATH: ${NCURSES}/panel ${NCURSES}/include
-.PATH: ${NCURSES}/man
-
-LIB= panel
-AWK?= awk
-
-SRCS= ncurses_def.h \
- p_above.c p_below.c p_bottom.c p_delete.c p_hidden.c \
- p_hide.c p_move.c p_new.c p_replace.c p_show.c p_top.c \
- p_update.c p_user.c p_win.c panel.c
-INCS= ${NCURSES}/panel/panel.h
-
-CLEANFILES+= ncurses_def.h
-CFLAGS+= -I.
-.if exists(${.OBJDIR}/../libncurses)
-CFLAGS+= -I${.OBJDIR}/../libncurses
-.endif
-CFLAGS+= -I${.CURDIR}/../libncurses
-CFLAGS+= -I${NCURSES}/panel -I${NCURSES}/include -I${NCURSES}/ncurses \
- -Wall -DNDEBUG -DHAVE_CONFIG_H
-
-ncurses_def.h: MKncurses_def.sh ncurses_defs
- AWK=${AWK} sh ${NCURSES}/include/MKncurses_def.sh \
- ${NCURSES}/include/ncurses_defs > ncurses_def.h
-
-# generate MAN
-CLEANFILES+= panel.3
-MAN= panel.3
-panel.3: panel.3x
- cat ${.ALLSRC} > ${.TARGET}
-
-MLINKS+=panel.3 bottom_panel.3 panel.3 del_panel.3 panel.3 hide_panel.3 \
- panel.3 move_panel.3 panel.3 new_panel.3 panel.3 panel_above.3 \
- panel.3 panel_below.3 panel.3 panel_hidden.3 \
- panel.3 panel_userptr.3 panel.3 panel_window.3 \
- panel.3 replace_panel.3 panel.3 set_panel_userptr.3 \
- panel.3 show_panel.3 panel.3 top_panel.3 panel.3 update_panels.3
-
-.include <bsd.lib.mk>
-
-.SUFFIXES: .3x .3
diff --git a/release/doc/en_US.ISO8859-1/hardware/article.sgml b/release/doc/en_US.ISO8859-1/hardware/article.sgml
deleted file mode 100644
index bce047b..0000000
--- a/release/doc/en_US.ISO8859-1/hardware/article.sgml
+++ /dev/null
@@ -1,955 +0,0 @@
-<!--
-
- The "Supported Devices" section of the release notes.
- Generally processor-independent, with conditional text
- inclusion handling any architecture-dependent text.
-
- Within each subsection describing a class of hardware
- (i.e. Ethernet interfaces), list broad groups of devices
- alphabetically as paragraphs sorted alphabetically (frequently
- these groups will be arranged by manufacturer, i.e. 3Com
- Ethernet interfaces).
-
- Where applicable, a "Miscellaneous" section may follow all
- other named sections.
-
- These guidelines are not hard-and-fast rules, and exceptions
- will occur. Following these guidelines (vague as they may be)
- is highly recommended to try to keep the formatting of
- this section consistent.
-
- We give manpage references using the &man entities where
- possible. If a driver has no manpage (and consequently no
- &man entity, we simply give the name of the driver).
- Please avoid doing &man entity conversions unless you
- know for sure that an entity and manpage exist; sweeps through
- this file to fix "missed" conversions are likely to break the
- build.
--->
-
-<sect1 id="support">
- <sect1info>
- <pubdate>$FreeBSD$</pubdate>
- </sect1info>
-
- <title>Supported Devices</title>
-
- <para>This section describes the devices currently known to be
- supported by with &os; on the &arch.print; platform. Other configurations
- may also work, but simply have not been tested yet. Feedback,
- updates, and corrections to this list are encouraged.</para>
-
- <para>Where possible, the drivers applicable to each device or class
- of devices is listed. If the driver in question has a manual page
- in the &os; base distribution (most should), it is referenced here.
- Information on specific models of supported devices, controllers,
- etc. can be found in the manual pages.</para>
-
- <note>
- <para>The device lists in this document are being generated
- automatically from &os; manual pages. This means that some
- devices, which are supported by multiple drivers, may appear
- multiple times.</para>
- </note>
-
- <sect2 id="disk">
- <title>Disk Controllers</title>
-
- <para arch="i386,alpha,sparc64,ia64,pc98,amd64">IDE/ATA controllers (&man.ata.4; driver)</para>
- <para arch="pc98">IDE/ATA controllers (wdc driver)
- <itemizedlist>
- <listitem>
- <para>On-board IDE controller</para>
- </listitem>
- </itemizedlist>
- </para>
-
- &hwlist.aic;
-
- &hwlist.aha;
-
- &hwlist.ahb;
-
- &hwlist.ahc;
-
- &hwlist.ahd;
-
- &hwlist.aac;
-
- &hwlist.ct;
-
- &hwlist.adv;
-
- &hwlist.adw;
-
- &hwlist.bt;
-
- &hwlist.dpt;
-
- &hwlist.asr;
-
- &hwlist.amr;
- <note>
- <para arch="i386,amd64">Booting from these controllers is supported. EISA
- adapters are not supported.</para>
-
- <para arch="alpha">Booting from these controllers is not
- supported due to SRM limitations.</para>
- </note>
-
- &hwlist.arcmsr;
-
- &hwlist.mlx;
-
- <note>
- <para arch="i386,amd64">Booting from these controllers is supported. EISA adapters
- are not supported.</para>
-
- <para arch="alpha">Booting from these controllers is not
- supported due to SRM limitations.
- DAC960 controllers sold by Digital/Compaq for Alpha systems as part
- of the StorageWorks family, e.g. KZPSC or KZPAC are bootable from SRM.
- Note that these cards used 2.x firmware. SRM bootability of newer
- firmware is unknown.</para>
- </note>
-
- &hwlist.mly;
-
- &hwlist.twe;
-
- &hwlist.twa;
-
- &hwlist.ncr;
-
- &hwlist.sym;
-
- &hwlist.ncv;
-
- &hwlist.stg;
-
- &hwlist.isp;
-
- &hwlist.amd;
-
- &hwlist.nsp;
-
- &hwlist.vpo;
-
- &hwlist.ida;
-
- &hwlist.ciss;
-
- &hwlist.iir;
-
- &hwlist.pst;
-
- &hwlist.hptmv;
-
- &hwlist.ips;
-
- &hwlist.mpt;
-
- &hwlist.trm;
-
- <para arch="i386">The wds(4) driver supports the WD7000 SCSI
- controller.</para>
-
- <para>With all supported SCSI controllers, full support is
- provided for SCSI-I, SCSI-II, and SCSI-III peripherals, including
- hard disks, optical disks, tape drives (including DAT, 8mm
- Exabyte, Mammoth, and DLT), medium changers, processor target
- devices and CD-ROM drives. WORM devices that support CD-ROM
- commands are supported for read-only access by the CD-ROM drivers
- (such as &man.cd.4;). WORM/CD-R/CD-RW writing support is provided
- by &man.cdrecord.1;, which is a part of the
- <filename role="package">sysutils/cdrtools</filename> port in the Ports Collection.</para>
-
- <para>The following CD-ROM type systems are supported at this
- time:
- <itemizedlist>
- <listitem>
- <para>SCSI interface (also includes ProAudio Spectrum and
- SoundBlaster SCSI) (&man.cd.4;)</para>
- </listitem>
-
- <listitem arch="i386">
- <para>Matsushita CR-562, CR-563, and compatibles
- (&man.matcd.4; driver)</para>
- </listitem>
-
- <listitem arch="i386">
- <para>Sony proprietary interface (all models) (&man.scd.4;)</para>
- </listitem>
-
- <listitem>
- <para>ATAPI IDE interface (&man.acd.4;)</para>
- </listitem>
- </itemizedlist>
- </para>
-
- <para arch="i386">The following device is unmaintained:
- <itemizedlist>
- <listitem>
- <para>Mitsumi proprietary CD-ROM interface (all
- models) (&man.mcd.4;)</para>
- </listitem>
- </itemizedlist>
- </para>
-
- </sect2>
- <sect2 id="ethernet">
- <title>Ethernet Interfaces</title>
-
- &hwlist.sf;
-
- &hwlist.ti;
-
- &hwlist.pcn;
-
- &hwlist.lnc;
-
- <para arch="i386,pc98,amd64">SMC 83c17x (EPIC)-based Ethernet NICs (&man.tx.4; driver)
- </para>
-
- &hwlist.ed;
-
- &hwlist.rl;
-
- &hwlist.wb;
-
- &hwlist.vr;
-
- &hwlist.sis;
-
- &hwlist.nge;
-
- &hwlist.ste;
-
- &hwlist.sk;
-
- &hwlist.tl;
-
- &hwlist.dc;
-
- &hwlist.aue;
-
- &hwlist.cue;
-
- &hwlist.kue;
-
- &hwlist.axe;
-
- &hwlist.rue;
-
- &hwlist.udav;
-
- &hwlist.de;
-
- &hwlist.fe;
-
- &hwlist.fxp;
-
- &hwlist.ex;
-
- &hwlist.ie;
-
- &hwlist.ep;
-
- &hwlist.el;
-
- &hwlist.xl;
-
- &hwlist.vx;
-
- <para arch="i386,amd64">Crystal Semiconductor CS89x0-based NICs
- (&man.cs.4; driver)
- </para>
-
- &hwlist.sn;
-
- &hwlist.xe;
-
- &hwlist.snc;
-
- &hwlist.lge;
-
- &hwlist.txp;
-
- &hwlist.bge;
-
- &hwlist.em;
-
- &hwlist.hme;
-
- &hwlist.gem;
-
- &hwlist.my;
-
- <para arch="i386,amd64">Broadcom BCM4401 based Fast Ethernet adapters
- (&man.bfe.4; driver)</para>
-
- &hwlist.re;
-
- &hwlist.ixgb;
-
- &hwlist.vge;
-
- &hwlist.nve;
-
- </sect2>
-
- <sect2 id="tokenring">
- <title>Token Ring Interfaces</title>
-
- &hwlist.oltr;
-
- </sect2>
-
- <sect2 id="fddi">
- <title>FDDI Interfaces</title>
- <para arch="i386,pc98,alpha">DEC DEFPA PCI (&man.fpa.4; driver)</para>
- <para arch="i386">DEC DEFEA EISA (&man.fpa.4; driver)</para>
- </sect2>
-
- <sect2 id="atm">
- <title>ATM Interfaces</title>
-
- <para arch="i386,pc98">Midway-based ATM interfaces (&man.en.4;
- driver)</para>
-
- <para arch="i386,pc98,sparc64">FORE Systems, Inc. PCA-200E ATM PCI
- Adapters (hfa and &man.fatm.4; drivers)</para>
-
- <para arch="i386,pc98">IDT NICStAR 77201/211-based ATM Adapters (&man.idt.4;
- driver)</para>
-
- <para arch="i386,pc98,sparc64">FORE Systems, Inc. HE155 and HE622
- ATM interfaces (&man.hatm.4; driver)</para>
-
- <para arch="i386,pc98">IDT77252-based ATM cards (&man.patm.4;
- driver)</para>
-
- </sect2>
- <sect2 id="wlan">
- <title>Wireless Network Interfaces</title>
-
- <para arch="i386">NCR / AT&amp;T / Lucent Technologies WaveLan T1-speed
- ISA/radio LAN cards (&man.wl.4; driver)</para>
-
- <para arch="i386,pc98,amd64">Lucent Technologies WaveLAN/IEEE 802.11b
- wireless network
- adapters and workalikes using the Lucent Hermes, Intersil
- PRISM-II, Intersil PRISM-2.5, Intersil Prism-3, and Symbol
- Spectrum24 chipsets (&man.wi.4; driver)
- </para>
-
- <para arch="i386,pc98,amd64">Cisco/Aironet 802.11b wireless adapters (&man.an.4; driver)
- </para>
-
- <para arch="i386,pc98">Raytheon Raylink 2.4GHz wireless adapters (&man.ray.4; driver)
- </para>
-
- &hwlist.awi;
-
- &hwlist.cnw;
-
- &hwlist.ath;
- </sect2>
-
- <sect2 id="misc-network">
- <title>Miscellaneous Networks</title>
-
- &hwlist.cx;
-
- &hwlist.cp;
-
- &hwlist.ctau;
-
- <para arch="i386">Granch SBNI12 point-to-point communications
- adapters (&man.sbni.4; driver)
- </para>
-
- <para arch="i386">Granch SBNI16 SHDSL modems (&man.sbsh.4;
- driver)</para>
-
- &hwlist.cm;
-
- </sect2>
-
- <sect2 id="isdn">
- <title>ISDN Interfaces</title>
- <para arch="i386">AcerISDN P10 ISA PnP (experimental)</para>
- <para arch="i386">Asuscom ISDNlink 128K ISA</para>
- <para arch="i386">ASUSCOM P-IN100-ST-D (and other Winbond W6692-based cards)</para>
- <para arch="i386">AVM
- <itemizedlist>
- <listitem>
- <para>A1</para>
- </listitem>
- <listitem>
- <para>B1 ISA (tested with V2.0)</para>
- </listitem>
- <listitem>
- <para>B1 PCI (tested with V4.0)</para>
- </listitem>
- <listitem>
- <para>Fritz!Card classic</para>
- </listitem>
- <listitem>
- <para>Fritz!Card PnP</para>
- </listitem>
- <listitem>
- <para>Fritz!Card PCI</para>
- </listitem>
- <listitem>
- <para>Fritz!Card PCI, Version 2</para>
- </listitem>
- <listitem>
- <para>T1</para>
- </listitem>
- </itemizedlist>
- </para>
- <para arch="i386">Creatix
- <itemizedlist>
- <listitem>
- <para>ISDN-S0</para>
- </listitem>
- <listitem>
- <para>ISDN-S0 P&amp;P</para>
- </listitem>
- </itemizedlist>
- </para>
- <para arch="i386">Compaq Microcom 610 ISDN (Compaq series PSB2222I) ISA PnP</para>
- <para arch="i386">Dr. Neuhaus Niccy Go@ and compatibles</para>
- <para arch="i386">Dynalink IS64PPH and IS64PPH+</para>
- <para arch="i386">Eicon Diehl DIVA 2.0 and 2.02</para>
- <para arch="i386">ELSA
- <itemizedlist>
- <listitem>
- <para>ELSA PCC-16</para>
- </listitem>
- <listitem>
- <para>QuickStep 1000pro ISA</para>
- </listitem>
- <listitem>
- <para>MicroLink ISDN/PCI</para>
- </listitem>
- <listitem>
- <para>QuickStep 1000pro PCI</para>
- </listitem>
- </itemizedlist>
- </para>
- <para arch="i386">ITK ix1 Micro ( &lt; V.3, non-PnP version )</para>
- <para arch="i386">Sedlbauer Win Speed</para>
- <para arch="i386">Siemens I-Surf 2.0</para>
- <para arch="i386">TELEINT ISDN SPEED No.1 (experimental)</para>
- <para arch="i386">Teles
- <itemizedlist>
- <listitem>
- <para>S0/8</para>
- </listitem>
- <listitem>
- <para>S0/16</para>
- </listitem>
- <listitem>
- <para>S0/16.3</para>
- </listitem>
- <listitem>
- <para>S0/16.3 PnP</para>
- </listitem>
- <listitem>
- <para>16.3c ISA PnP (experimental)</para>
- </listitem>
- <listitem>
- <para>Teles PCI-TJ</para>
- </listitem>
- </itemizedlist>
- </para>
- <para arch="i386">Traverse Technologies NETjet-S PCI</para>
- <para arch="i386">USRobotics Sportster ISDN TA intern</para>
- <para arch="i386">Winbond W6692 based PCI cards</para>
- </sect2>
-
- <sect2 id="serial">
- <title>Serial Interfaces</title>
-
- <para arch="i386,alpha,ia64,amd64"><quote>PC standard</quote> 8250, 16450, and 16550-based serial ports (&man.sio.4; driver)</para>
-
- <para arch="sparc64">Serial ports based on the SAB82532 serial
- chip, console only (&man.sab.4; driver)</para>
-
- <para arch="sparc64">Serial ports based on the Zilog 8530 dual uart,
- console only (zs driver)</para>
-
- <para arch="i386,alpha,amd64">AST 4 port serial card using shared IRQ</para>
-
- <para arch="i386">ARNET serial cards (&man.ar.4; driver)
- <itemizedlist>
- <listitem>
- <para>ARNET 8 port serial card using shared IRQ</para>
- </listitem>
- <listitem>
- <para>ARNET (now Digiboard) Sync 570/i high-speed serial</para>
- </listitem>
- </itemizedlist>
- </para>
-
- <para arch="i386">Boca multi-port serial cards
- <itemizedlist>
- <listitem>
- <para>Boca BB1004 4-Port serial card (Modems
- <emphasis>not</emphasis> supported)</para>
- </listitem>
- <listitem>
- <para>Boca IOAT66 6-Port serial card (Modems supported)</para>
- </listitem>
- <listitem>
- <para>Boca BB1008 8-Port serial card (Modems
- <emphasis>not</emphasis> supported)</para>
- </listitem>
- <listitem>
- <para>Boca BB2016 16-Port serial card (Modems supported)</para>
- </listitem>
- </itemizedlist>
- </para>
-
- <para arch="i386,alpha">Comtrol Rocketport card (&man.rp.4; driver)</para>
-
- <para arch="i386">Cyclades Cyclom-Y serial board (&man.cy.4; driver)</para>
-
- <para arch="i386">STB 4 port card using shared IRQ</para>
-
- <para arch="i386">DigiBoard intelligent serial cards (digi driver)
- </para>
-
- <para arch="i386,ia64,amd64">PCI-Based multi-port serial boards (&man.puc.4;
- driver)
- <itemizedlist>
- <listitem arch="i386,amd64">
- <para>Actiontech 56K PCI</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Avlab Technology, PCI IO 2S and PCI IO 4S</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Comtrol RocketPort 550</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Decision Computers PCCOM 4-port serial and dual port RS232/422/485</para>
- </listitem>
- <listitem arch="ia64">
- <para>Diva Serial (GSP) Multiport UART (development branch only)</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Dolphin Peripherals 4025/4035/4036</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>IC Book Labs Dreadnought 16x Lite and Pro</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Lava Computers 2SP-PCI/DSerial-PCI/Quattro-PCI/Octopus-550</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Middle Digital, Weasle serial port</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Moxa Industio CP-114, Smartio C104H-PCI and C168H/PCI</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>NEC PK-UG-X001 and PK-UG-X008</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Netmos NM9835 PCI-2S-550</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Oxford Semiconductor OX16PCI954 PCI UART</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Syba Tech SD-LAB PCI-4S2P-550-ECP</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>SIIG Cyber I/O PCI 16C550/16C650/16C850</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>SIIG Cyber 2P1S PCI 16C550/16C650/16C850</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>SIIG Cyber 2S1P PCI 16C550/16C650/16C850</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>SIIG Cyber 4S PCI 16C550/16C650/16C850</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>SIIG Cyber Serial (Single and Dual) PCI 16C550/16C650/16C850</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Syba Tech Ltd. PCI-4S2P-550-ECP</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>Titan PCI-200H and PCI-800H</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>US Robotics (3Com) 3CP5609 modem</para>
- </listitem>
- <listitem arch="i386,amd64">
- <para>VScom PCI-400 and PCI-800</para>
- </listitem>
- </itemizedlist>
- </para>
-
- &hwlist.rc;
-
- &hwlist.sr;
-
- <para arch="i386,amd64">Specialix SI/XIO/SX multiport serial cards, with both the
- older SIHOST2.x and the new <quote>enhanced</quote> (transputer
- based, aka JET) host cards (ISA, EISA and PCI are supported)
- (&man.si.4; driver)</para>
-
- <para arch="pc98">Internel serial interfaces (&man.sio.4; driver)
- <itemizedlist>
- <listitem>
- <para>PC-9801 on-board</para>
- </listitem>
- <listitem>
- <para>PC-9821 2'nd CCU (flags 0x12000000)</para>
- </listitem>
- </itemizedlist>
- </para>
-
- <para arch="pc98">NEC PC-9861K, PC-9801-101 and Midori-Denshi MDC-926Rs (&man.sio.4; driver)
- <itemizedlist>
- <listitem>
- <para>COM2 (flags 0x01000000)</para>
- </listitem>
- <listitem>
- <para>COM3 (flags 0x02000000)</para>
- </listitem>
- </itemizedlist>
- </para>
-
- <para arch="pc98">NEC PC-9801-120 (&man.sio.4; driver)</para>
- <note arch="pc98">
- <para>"flags 0x11000000" is necessary in kernel configuration.</para>
- </note>
-
- <para arch="pc98">Microcore MC-16550, MC-16550II, MC-RS98 (&man.sio.4; driver)</para>
- <note arch="pc98">
- <para>"flags 0x14000?01" is necessary in kernel configuration.</para>
- </note>
-
- <para arch="pc98">Media Intelligent RSB-2000, RSB-3000 and AIWA B98-02 (&man.sio.4; driver)</para>
- <note arch="pc98">
- <para>"flags 0x15000?01" is necessary in kernel configuration.</para>
- </note>
-
- <para arch="pc98">Media Intelligent RSB-384 (&man.sio.4; driver)</para>
- <note arch="pc98">
- <para>"flags 0x16000001" is necessary in kernel configuration.</para>
- </note>
-
- <para arch="pc98">I-O DATA RSA-98III (&man.sio.4; driver)</para>
- <note arch="pc98">
- <para>"flags 0x18000?01" is necessary in kernel configuration.</para>
- </note>
-
- <para arch="pc98">Hayes ESP98 (&man.sio.4; driver)</para>
- <note arch="pc98">
- <para>"options COM_ESP" and "flags 0x19000000" are necessary in kernel configuration.</para>
- </note>
-
- </sect2>
- <sect2 id="sound">
- <title>Sound Devices</title>
-
- &hwlist.sound;
-
- &hwlist.snd.ad1816;
-
- &hwlist.snd.als4000;
-
- &hwlist.snd.audiocs;
-
- &hwlist.snd.cmi;
-
- &hwlist.snd.cs4281;
-
- &hwlist.snd.csa;
-
- &hwlist.snd.ds1;
-
- &hwlist.snd.emu10k1;
-
- &hwlist.snd.es137x;
-
- &hwlist.snd.ess;
-
- &hwlist.snd.fm801;
-
- &hwlist.snd.gusc;
-
- &hwlist.snd.ich;
-
- &hwlist.snd.maestro;
-
- &hwlist.snd.maestro3;
-
- &hwlist.snd.neomagic;
-
- &hwlist.snd.sbc;
-
- &hwlist.snd.solo;
-
- &hwlist.snd.via8233;
-
- &hwlist.snd.via82c686;
-
- &hwlist.snd.vibes;
-
- <para arch="pc98">NEC PC-9801-73, 86 and compatibles (nss driver)
- <itemizedlist>
- <listitem>
- <para>NEC A-MATE internal sound</para>
- </listitem>
- <listitem>
- <para>Q-Vision WaveStar, WaveMaster</para>
- </listitem>
- </itemizedlist>
- </para>
-
- <para arch="pc98">NEC X-MATE, CanBe, ValueStar internal (mss driver)</para>
-
- <para arch="pc98">Creative Technologies SoundBlaster(98) (&man.sb.4;
- driver)</para>
-
- <para arch="pc98">I-O DATA CD-BOX (&man.sb.4; driver)</para>
-
- <para arch="pc98">MPU-401 and compatible interfaces (mpu driver)
- <itemizedlist>
- <listitem>
- <para>Q-Vision WaveStar</para>
- </listitem>
- </itemizedlist>
- </para>
- </sect2>
-
- <sect2 id="camera">
- <title>Camera and Video Capture Devices</title>
-
- &hwlist.bktr;
-
- <para arch="i386">Connectix QuickCam</para>
- </sect2>
-
- <sect2 id="usb">
- <title>USB Devices</title>
-
- <para arch="alpha,i386,pc98,amd64">A range of USB peripherals are supported; devices known to
- work are listed in this section. Owing to the
- generic nature of most USB devices, with some exceptions any
- device of a given class will be supported, even if not explicitly
- listed here.</para>
-
- <note arch="alpha,i386,pc98,amd64">
- <para>USB Ethernet adapters can be found in the section listing <link
- linkend="ethernet">Ethernet interfaces</link>.</para>
- </note>
-
- <note arch="alpha,i386,pc98,amd64">
- <para>USB Bluetooth adapters can be found in <link
- linkend="bluetooth">Bluetooth</link> section.</para>
- </note>
-
- &hwlist.ohci;
-
- &hwlist.uhci;
-
- <para arch="i386,ia64,pc98,amd64">USB 2.0 controllers using the EHCI
- interface (&man.ehci.4; driver)</para>
-
- <para arch="i386,pc98,alpha,amd64">Hubs
- </para>
- <para arch="i386,pc98,alpha,amd64">Keyboards (&man.ukbd.4; driver)
- </para>
- <para arch="i386,pc98,amd64">Miscellaneous
- <itemizedlist>
- <listitem>
- <para>Assist Computer Systems PC Camera C-M1</para>
- </listitem>
- <listitem>
- <para>ActiveWire I/O Board</para>
- </listitem>
- <listitem>
- <para>Creative Technology Video Blaster WebCam Plus</para>
- </listitem>
- <listitem>
- <para>D-Link DSB-R100 USB Radio (&man.ufm.4; driver)</para>
- </listitem>
- <listitem>
- <para>Mirunet AlphaCam Plus</para>
- </listitem>
- </itemizedlist>
- </para>
-
- &hwlist.urio;
-
- &hwlist.umodem;
-
- <para arch="i386,pc98,alpha,amd64">Mice (&man.ums.4; driver)
- </para>
-
- &hwlist.ulpt;
-
- &hwlist.ubsa;
-
- &hwlist.ubser;
-
- &hwlist.uftdi;
-
- &hwlist.uplcom;
-
- &hwlist.umct;
-
- &hwlist.uscanner;
-
- &hwlist.umass;
-
- <para arch="i386,pc98,amd64">Audio Devices (&man.uaudio.4; driver)
- </para>
-
- &hwlist.uvisor;
-
- </sect2>
-
- <sect2 id="firewire">
- <title>IEEE 1394 (Firewire) Devices</title>
-
- &hwlist.fwohci;
-
- <para arch="i386,sparc64,amd64">Serial Bus Protocol 2 (SBP-2)
- storage devices (&man.sbp.4; driver)</para>
-
- </sect2>
-
- <sect2 id="bluetooth">
- <title>Bluetooth Devices</title>
-
- &hwlist.ng.bt3c;
-
- &hwlist.ng.ubt;
-
- </sect2>
-
- <sect2 id="crypto-accel">
- <title>Cryptographic Accelerators</title>
-
- &hwlist.hifn;
-
- &hwlist.safe;
-
- &hwlist.ubsec;
- </sect2>
-
- <sect2 id="misc">
- <title>Miscellaneous</title>
-
- <para arch="i386,pc98,amd64">FAX-Modem/PCCARD
- <itemizedlist>
- <listitem>
- <para>MELCO IGM-PCM56K/IGM-PCM56KH</para>
- </listitem>
- <listitem>
- <para>Nokia Card Phone 2.0 (gsm900/dcs1800 HSCSD terminal)</para>
- </listitem>
- </itemizedlist>
- </para>
-
- <para arch="i386,pc98,alpha,amd64">Floppy drives (&man.fdc.4; driver)</para>
-
- <para arch="i386,alpha,ia64,amd64">VGA-compatible video cards
- (&man.vga.4; driver)
-
- <note>
- <para>Information regarding specific video cards and
- compatibility with <application>Xorg</application> can be
- found at <ulink
- url="http://www.x.org/"></ulink>.</para>
- </note>
-
- </para>
-
- <para arch="i386,pc98,alpha,ia64,amd64">Keyboards including:
- <itemizedlist>
- <listitem arch="i386,alpha">
- <para>AT-style keyboards (&man.atkbd.4; driver)</para>
- </listitem>
- <listitem arch="i386,alpha,ia64,amd64">
- <para>PS/2 keyboards (&man.atkbd.4; driver)</para>
- </listitem>
- <listitem arch="pc98">
- <para>Standard keyboards</para>
- </listitem>
- <listitem arch="i386,pc98,alpha,amd64">
- <para>USB keyboards (&man.ukbd.4; driver)</para>
- </listitem>
- </itemizedlist>
- </para>
-
- <para arch="i386,pc98,alpha,ia64,amd64">Pointing devices including:
- <itemizedlist>
- <listitem arch="i386,pc98,amd64">
- <para>Bus mice and compatible devices (&man.mse.4; driver)</para>
- </listitem>
- <listitem arch="i386,alpha,ia64,amd64">
- <para>PS/2 mice and compatible devices, including many laptop
- pointing devices (&man.psm.4; driver)</para>
- </listitem>
- <listitem>
- <para>Serial mice and compatible devices</para>
- </listitem>
- <listitem arch="i386,pc98,alpha,amd64">
- <para>USB mice (&man.ums.4; driver)</para>
- </listitem>
- </itemizedlist>
-
- <note>
- <para>&man.moused.8; has more information on using pointing
- devices with &os;. Information on using pointing devices
- with <application>Xorg</application> can be found at
- <ulink url="http://www.x.org/"></ulink>.</para>
- </note>
- </para>
-
- <para arch="i386,alpha,amd64"><quote>PC standard</quote> parallel ports (&man.ppc.4; driver)</para>
- <para arch="pc98"><quote>PC-9821 standard</quote> parallel ports (&man.ppc.4; driver)</para>
-
- <para arch="i386,amd64">PC-compatible joysticks (&man.joy.4; driver)</para>
-
- <para arch="pc98">Joystick port of SoundBlaster(98) (&man.joy.4;
- driver)</para>
-
- <para arch="i386,pc98">PHS Data Communication Card/PCCARD
- <itemizedlist>
- <listitem>
- <para>NTT DoCoMo P-in Comp@ct</para>
- </listitem>
- <listitem>
- <para>Panasonic KX-PH405</para>
- </listitem>
- <listitem>
- <para>SII MC-P200</para>
- </listitem>
- </itemizedlist>
- </para>
-
- <para arch="i386">Xilinx XC6200-based reconfigurable hardware cards compatible
- with the HOT1 from <ulink url="http://www.vcc.com/">Virtual
- Computers</ulink> (xrpu driver).</para>
-
- <para arch="pc98">Power Management Controller of NEC PC-98 Note (pmc
- driver)</para>
-
- <para arch="sparc64">OpenFirmware console (ofwcons driver)</para>
-
- </sect2>
-</sect1>
diff --git a/release/doc/en_US.ISO8859-1/relnotes/article.sgml b/release/doc/en_US.ISO8859-1/relnotes/article.sgml
deleted file mode 100644
index 89b9a18..0000000
--- a/release/doc/en_US.ISO8859-1/relnotes/article.sgml
+++ /dev/null
@@ -1,1668 +0,0 @@
-<articleinfo>
- <title>&os;/&arch; &release.current; Release Notes</title>
-
- <corpauthor>The &os; Project</corpauthor>
-
- <pubdate>$FreeBSD$</pubdate>
-
- <copyright>
- <year>2000</year>
- <year>2001</year>
- <year>2002</year>
- <year>2003</year>
- <year>2004</year>
- <year>2005</year>
- <holder role="mailto:doc@FreeBSD.org">The &os; Documentation Project</holder>
- </copyright>
-
- <legalnotice id="trademarks" role="trademarks">
- &tm-attrib.freebsd;
- &tm-attrib.ibm;
- &tm-attrib.ieee;
- &tm-attrib.intel;
- &tm-attrib.sparc;
- &tm-attrib.general;
- </legalnotice>
-
- <abstract>
- <para>The release notes for &os; &release.current; contain a summary
- of the changes made to the &os; base system on the
- &release.branch; development line.
- This document lists applicable security advisories that were issued since
- the last release, as well as significant changes to the &os;
- kernel and userland.
- Some brief remarks on upgrading are also presented.</para>
- </abstract>
-</articleinfo>
-
-<sect1 id="intro">
- <title>Introduction</title>
-
- <para>This document contains the release notes for &os;
- &release.current; on the &arch.print; hardware platform. It
- describes recently added, changed, or deleted features of &os;.
- It also provides some notes on upgrading
- from previous versions of &os;.</para>
-
-<![ %release.type.current [
-
- <para>The &release.type; distribution to which these release notes
- apply represents the latest point along the &release.branch; development
- branch since &release.branch; was created. Information regarding pre-built, binary
- &release.type; distributions along this branch
- can be found at <ulink url="&release.url;"></ulink>.</para>
-
-]]>
-
-<![ %release.type.snapshot [
-
- <para>The &release.type; distribution to which these release notes
- apply represents a point along the &release.branch; development
- branch between &release.prev; and the future &release.next;.
- Information regarding
- pre-built, binary &release.type; distributions along this branch
- can be found at <ulink url="&release.url;"></ulink>.</para>
-
-]]>
-
-<![ %release.type.release [
-
- <para>This distribution of &os; &release.current; is a
- &release.type; distribution. It can be found at <ulink
- url="&release.url;"></ulink> or any of its mirrors. More
- information on obtaining this (or other) &release.type;
- distributions of &os; can be found in the <ulink
- url="&url.books.handbook;/mirrors.html"><quote>Obtaining
- &os;</quote> appendix</ulink> to the <ulink
- url="&url.books.handbook;/">&os;
- Handbook</ulink>.</para>
-
-]]>
-
- <para>All users are encouraged to consult the release errata before
- installing &os;. The errata document is updated with
- <quote>late-breaking</quote> information discovered late in the
- release cycle or after the release. Typically, it contains
- information on known bugs, security advisories, and corrections to
- documentation. An up-to-date copy of the errata for &os;
- &release.current; can be found on the &os; Web site.</para>
-
-</sect1>
-
-<sect1 id="new">
- <title>What's New</title>
-
- <para>This section describes
- the most user-visible new or changed features in &os;
- since &release.prev;.
- In general, changes described here are unique to the &release.branch;
- branch unless specifically marked as &merged; features.
- </para>
-
- <para>Typical release note items
- document recent security advisories issued after
- &release.prev.historic;,
- new drivers or hardware support, new commands or options,
- major bug fixes, or contributed software upgrades. They may also
- list changes to major ports/packages or release engineering
- practices. Clearly the release notes cannot list every single
- change made to &os; between releases; this document focuses
- primarily on security advisories, user-visible changes, and major
- architectural improvements.</para>
-
- <sect2 id="security">
- <title>Security Advisories</title>
-
- <para>A bug in the &man.fetch.1; utility, which allows
- a malicious HTTP server to cause arbitrary portions of the client's
- memory to be overwritten, has been fixed.
- For more information, see security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-04:16.fetch.asc">FreeBSD-SA-04:16.fetch</ulink>.
- &merged;</para>
-
- <para>A bug in &man.procfs.5; and &man.linprocfs.5;
- which could allow a malicious local user to read parts of kernel
- memory or perform a local
- denial of service attack by causing a system panic,
- has been fixed.
- For more information, see security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-04:17.procfs.asc">FreeBSD-SA-04:17.procfs</ulink>.
- &merged;</para>
-
- <para>Two buffer overflows in the TELNET client program have been
- corrected. They could have allowed a malicious TELNET server or
- an active network attacker to cause &man.telnet.1; to execute
- arbitrary code with the privileges of the user running it.
- More information can be found in security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:01.telnet.asc">FreeBSD-SA-05:01.telnet</ulink>.
- &merged;</para>
-
- <para>An information disclosure vulnerability in the
- &man.sendfile.2; system call, which could permit it to transmit
- random parts of kernel memory, has been fixed. More details are
- in security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:02.sendfile.asc">FreeBSD-SA-05:02.sendfile</ulink>.
- &merged;</para>
-
- <para arch="amd64">A possible privilege escalation vulnerability on &os;/amd64
- has been fixed. This allows unprivileged users to gain direct
- access to some hardware which cannot be accessed
- without the elevated privilege level. More details are in security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:03.amd64.asc">FreeBSD-SA-05:03.amd64</ulink>.
- &merged;</para>
-
- <para>An information leak vulnerability in the
- <literal>SIOCGIFCONF</literal> &man.ioctl.2;, which leaked 12
- bytes of kernel memory, has been fixed. More details are in security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:04.ifconf.asc">FreeBSD-SA-05:04.ifconf</ulink>.
- &merged;</para>
-
- <para>Several programming errors in &man.cvs.1;, which could
- potentially cause arbitrary code to be executed on CVS servers,
- have been corrected. Further information can be found in
- security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:05.cvs.asc">FreeBSD-SA-05:05.cvs</ulink>.
- &merged;</para>
-
- <para>An error in the default permissions on the <filename
- class="devicefile">/dev/iir</filename> device node, which
- allowed unprivileged local users can send commands to the
- hardware supported by the &man.iir.4; driver, has been fixed.
- For more information, see security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:06.iir.asc">FreeBSD-SA-05:06.iir</ulink>.
- &merged;</para>
-
- <para>A bug in the validation of &man.i386.get.ldt.2; system call
- input arguments, which may allow kernel memory to be disclosed
- to a user process, has been fixed. For more information, see
- security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:07.ldt.asc">FreeBSD-SA-05:07.ldt</ulink>.
- &merged;</para>
-
- <para>Several information disclosure vulnerabilities in various
- parts of the kernel have been fixed. For more information, see
- security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:08.kmem.asc">FreeBSD-SA-05:08.kmem</ulink>.
- &merged;</para>
-
- <para arch="i386,amd64">Because of an information disclosure vulnerability on
- processors using Hyper-Threading Technology (HTT), the
- <varname>machdep.hyperthreading_allowed</varname> sysctl
- variable has been added. It defaults to <literal>1</literal>
- (HTT enabled) on &os; CURRENT, and <literal>0</literal> (HTT
- disabled) on the 4-STABLE and 5-STABLE development branches and
- supported security fix branches. More information can be found
- in security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:09.htt.asc">FreeBSD-SA-05:09.htt</ulink>.
- &merged;</para>
-
- <para>A bug in the &man.tcpdump.1; utility which allows
- a malicious remote user to cause a denial-of-service
- by using specially crafted packets, has been fixed.
- For more information, see security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:10.tcpdump.asc">FreeBSD-SA-05:10.tcpdump</ulink>.
- &merged;</para>
-
- <para>Two problems in the &man.gzip.1; utility have been fixed.
- These may allow a local user to modify permissions
- of arbitrary files and overwrite arbitrary local
- files when uncompressing a file.
- For more information, see security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:11.gzip.asc">FreeBSD-SA-05:11.gzip</ulink>.
- &merged;</para>
-
- <para>A bug in <application>BIND 9</application> DNSSEC has been fixed.
- When DNSSEC is enabled, this bug may allow a remote attacker to inject
- a specially crafted packet which will cause &man.named.8; to terminate.
- For more information, see security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:12.bind9.asc">FreeBSD-SA-05:12.bind9</ulink>.
- &merged;</para>
-
- <para>A bug has been fixed in &man.ipfw.4; that could cause
- packets to be matched incorrectly against a lookup table. This
- bug only affects SMP machines or UP machines that have the
- <literal>PREEMPTION</literal> kernel option enabled. More
- information is contained in security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:13.ipfw.asc">FreeBSD-SA-05:13.ipfw</ulink>.
- &merged;</para>
-
- <para>Two security-related problems have been fixed in
- &man.bzip2.1;. These include a potential denial of service and
- unauthorized manipulation of file permissions. For more
- information, see security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:14.bzip2.asc">FreeBSD-SA-05:14.bzip2</ulink>.
- &merged;</para>
-
- <para>Two problems in &os;'s TCP stack have been fixed. They
- could allow attackers to stall existing TCP connections,
- creating a denial-of-service situation. More information is
- contained in security advisory
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:15.tcp.asc">FreeBSD-SA-05:15.tcp</ulink>.
- &merged;</para>
-
- </sect2>
-
- <sect2 id="kernel">
- <title>Kernel Changes</title>
-
- <para arch="i386">Support for 80386 processors (the
- <literal>I386_CPU</literal> kernel configuration option) has
- been removed. Users running this class of CPU should use &os;
- 5.<replaceable>X</replaceable> or earlier.</para>
-
- <para>The kernel debugger &man.ddb.4; now supports a
- <command>show alllocks</command> command, which dumps a list of processes
- and threads currently holding sleep mutexes (and spin mutexes for
- the current thread). &merged;</para>
-
- <para arch="amd64,i386,pc98">The kernel crash dump format has been changed to
- ELF to support large memory (more than 4GB) environment.</para>
-
- <para>The &man.ichsmb.4; driver is now available as a loadable
- kernel module.</para>
-
- <para>The &man.jail.8; feature now supports a new sysctl
- <varname>security.jail.chflags_allowed</varname>, which controls the
- behavior of &man.chflags.1; within a jail.
- If set to <literal>0</literal> (the default), then a jailed <username>root</username> user is
- treated as an unprivileged user; if set to <literal>1</literal>, then
- a jailed root user is treated the same as an unjailed <username>root</username> user. &merged;</para>
-
- <para>A sysctl <varname>security.jail.getfsstatroot_only</varname> has been
- renamed to <varname>security.jail.enforce_statfs</varname> and
- now supports the following policies:</para>
-
- <informaltable frame="none">
- <tgroup cols="2">
- <colspec colwidth="1*">
- <colspec colwidth="3*">
- <thead>
- <row>
- <entry>Value</entry>
- <entry>Policy</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry>0</entry>
- <entry>Show all mount-points without any restrictions.</entry>
- </row>
-
- <row>
- <entry>1</entry>
- <entry>Show only mount-points below jail's chroot and show only part of the
- mount-point's path (for example, if the jail's chroot directory is
- <filename>/jails/foo</filename> and
- mount-point is
- <filename>/jails/foo/usr/home</filename>,
- only <filename>/usr/home</filename> will be shown).</entry>
- </row>
-
- <row>
- <entry>2</entry>
- <entry>Show only mount-point where jail's chroot directory is placed.</entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
-
- <para arch="alpha,amd64,i386,sparc64">The loader tunable <varname>debug.mpsafevm</varname>
- has been enabled by default. &merged;</para>
-
- <para>&man.memguard.9;, a kernel memory allocator designed to help detect
- <quote>tamper-after-free</quote> scenarios, has been added.
- This must be explicitly enabled via <literal>options
- DEBUG_MEMGUARD</literal>, plus small kernel modifications. It
- is generally intended for use by kernel developers.</para>
-
- <para><varname>struct ifnet</varname> and network interface API
- have been changed. Due to ABI incompatibility, all drivers
- not in the &os; base system need to be updated to use
- the new API and recompiled.</para>
-
- <para>A number of bugs have been fixed in the ULE
- scheduler. &merged;</para>
-
- <para>Fine-grained locking to allow much of the VFS stack to run
- without the Giant lock has been added. This is enabled by default
- on the alpha, amd64, and i386 architectures, and can be disabled
- by setting the loader tunable (and sysctl variable)
- <varname>debug.mpsafevfs</varname> to
- <literal>0</literal>.</para>
-
- <para arch="i386">A bug in Inter-Processor Interrupt (IPI)
- handling, which could cause SMP systems to crash under heavy
- load, has been fixed. More details are contained in errata note
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/ERRATA/notices/FreeBSD-EN-05:03.ipi.asc">FreeBSD-EN-05:03.ipi</ulink>.
- &merged;</para>
-
- <para>System V IPC objects (message queues, semaphores, and shared
- memory) now have support for Mandatory Access Control policies,
- notably &man.mac.biba.4;, &man.mac.mls.4;, &man.mac.stub.4;, and
- &man.mac.test.4;.</para>
-
- <para arch="i386">Memory allocation for legacy PCI bridges has
- been limited to the top 32MB of RAM. Many older, legacy bridges
- only allow allocation from this range. This change only applies
- to devices which do not have their memory assigned by the BIOS.
- This change fixes the <quote>bad Vcc</quote> error of CardBus
- bridges (&man.pccbb.4;). &merged;</para>
-
- <para>The &man.sysctl.3; MIBs beginning with <quote>debug</quote>
- now require the kernel option <literal>options SYSCTL_DEBUG</literal>.
- This option is disabled by default.</para>
-
- <para>The generic &man.tty.4; driver interface has been added
- and many device drivers including
- &man.cx.4; (<literal>{tty,cua}x</literal>),
- &man.cy.4; (<literal>{tty,cua}c</literal>),
- &man.digi.4; (<literal>{tty,cua}D</literal>),
- &man.rc.4; (<literal>{tty,cua}m</literal>),
- &man.rp.4; (<literal>{tty,cua}R</literal>),
- &man.sab.4; (<literal>{tty,cua}z</literal>),
- &man.si.4; (<literal>{tty,cua}A</literal>),
- &man.sio.4; (<literal>{tty,cua}d</literal>),
- sx (<literal>{tty,cua}G</literal>),
- &man.uart.4; (<literal>{tty,cua}u</literal>),
- &man.ubser.4; (<literal>{tty,cua}y</literal>),
- &man.ucom.4; (<literal>{tty,cua}U</literal>), and
- &man.ucycom.4; (<literal>{tty,cua}y</literal>)
- have been rewritten to use it. Note that <filename>/etc/remote</filename>
- and <filename>/etc/ttys</filename> have been updated as well.</para>
-
- <para>The &man.vkbd.4; driver has been added. This driver
- provides a software loopback mechanism that can implement
- a virtual AT keyboard similar to what the &man.pty.4; driver
- does for terminals.</para>
-
- <!-- Above this line, sort kernel changes by manpage/keyword-->
-
- <para arch="i386,amd64">&os; always uses the local APIC timer
- even on uni-processor systems now.</para>
-
- <para arch="i386,amd64,ia64">The default <varname>HZ</varname>
- parameter (which controls various kernel timers) has been
- increased from <literal>100</literal> to <literal>1000</literal>
- on the i386 and ia64. It has been reduced from
- <literal>1024</literal> to <literal>1000</literal> on the amd64
- to reduce synchronization effects with other system
- clocks.</para>
-
- <para>The maximum length of shell commands has changed from 128
- bytes to <varname>PAGE_SIZE</varname>. By default, this value
- is either 4KB (i386, pc98, amd64, and powerpc) or 8KB (sparc64
- and ia64). As a result, compatibility modules need to be
- rebuilt to stay synchronized with data structure changes in the
- kernel.</para>
-
- <para>A new tunable <varname>vm.blacklist</varname> has been added.
- This can hold a space or comma separated list of physical addresses.
- The pages containing these physical addresses will
- not be added to the free list and thus will effectively
- be ignored by the &os; VM system. The physical addresses
- of any ignored pages are listed in the message buffer as well.</para>
-
- <sect3 id="boot">
- <title>Boot Loader Changes</title>
-
- <para arch="i386">A serial console-capable version of
- <filename>boot0</filename> has been added. It can be written
- to a disk using &man.boot0cfg.8; and specifying
- <filename>/boot/boot0sio</filename> as the argument to the
- <option>-b</option> option.</para>
-
- <para arch="i386"><filename>cdboot</filename> now works around a
- BIOS problem observed on some systems when booting from USB
- CDROM drives.</para>
-
- <para>The <command>autoboot</command> loader command
- now supports the prompt parameter.</para>
-
- <para>The <command>autoboot</command> loader command will now prevent the user
- from interrupting the boot process at all if the
- <varname>autoboot_delay</varname> variable is set to
- <literal>-1</literal>. &merged;</para>
-
- <para>A loader menu option to set <varname>hint.atkbd.0.flags=0x1</varname>
- has been added. This setting allows USB keyboards to work
- if no PS/2 keyboard is attached.</para>
-
- <para>The beastie boot menu has been disabled by default.</para>
-
- <!-- Above this line, order boot loader changes by keyword-->
-
- </sect3>
-
- <sect3 id="proc">
- <title>Hardware Support</title>
-
- <para arch="i386,amd64">The &man.acpi.4; driver now turns
- the ACPI and PCI devices off or to a lower power state
- when suspending, and back on again when resuming.
- This behavior can be disabled by
- setting the <varname>debug.acpi.do_powerstate</varname> and
- <varname>hw.pci.do_powerstate</varname> sysctls to <literal>0</literal>.</para>
-
- <para arch="i386,amd64">The &man.acpi.ibm.4; driver for IBM laptops
- has been added. It provides support for the various
- hotkeys and reading fan status and thermal
- sensors.</para>
-
- <para arch="i386,amd64">The &man.acpi.fujitsu.4; driver for handling
- &man.acpi.4;-controlled buttons Fujitsu laptops has been added.</para>
-
- <para arch="i386,amd64">The acpi_sony driver,
- which supports the Sony Notebook Controller on various
- Sony laptops has been added.</para>
-
- <para>The &man.atkbdc.4;, &man.atkbd.4;, and &man.psm.4;
- drivers have been rewritten in more bus-independent way,
- and now support the EBus found on the sparc64 platform.</para>
-
- <para arch="sparc64">The following device drivers have been
- added and enabled by default in the
- <filename>GENERIC</filename> kernel:
- &man.atkbdc.4;,
- &man.atkbd.4;,
- creator(4),
- machfb(4),
- &man.syscons.4;,
- &man.ohci.4;,
- &man.psm.4;,
- &man.ukbd.4;,
- &man.ums.4;,
- and &man.usb.4;.</para>
-
- <para arch="sparc64">The &man.auxio.4; driver has been added; it supports
- some auxiliary I/O functions found on various SBus/EBus
- &ultrasparc; models. &merged;</para>
-
- <para arch="sparc64">The clkbrd driver has been added to support
- the <literal>clock-board</literal> device frequently found on
- Sun E<replaceable>xx</replaceable>00 servers.</para>
-
- <para>A framework for flexible processor speed control has been
- added. It provides methods for various drivers to control CPU
- power utilization by adjusting the processor speed. More
- details can be found in the &man.cpufreq.4; manual page. &merged;
- Currently supported drivers include ichss (Intel SpeedStep for ICH),
- acpi_perf (ACPI CPU performance states), and acpi_throttle
- (ACPI CPU throttling). The latter two drivers are contained
- in the &man.acpi.4; driver. These can individually be disabled by setting device
- hints such as <varname>hint.<replaceable>ichss</replaceable>.0.disabled="1"</varname>.</para>
-
- <para>The &man.hwpmc.4; hardware performance
- monitoring counter driver has been added.
- This driver virtualizes the hardware performance monitoring
- facilities in modern CPUs and provides support for using
- these facilities from user level processes. For more details,
- see manual pages of &man.hwpmc.4;, associated libraries,
- and associated userland utilities.</para>
-
- <para arch="i386">Support for the OLDCARD subsystem has
- been removed. The NEWCARD system is now used for all PCCARD
- device support.</para>
-
- <para>The pcii driver has been added to support GPIB-PCIIA IEEE-488
- cards. &merged;</para>
-
- <para>The &man.atkbd.4; driver now supports a <literal>0x8</literal>
- (bit 3) flag to disable testing the keyboard port during
- the device probe as this can cause hangs on some machines,
- specifically Compaq R3000Z series amd64 laptops.</para>
-
- <para arch="i386">The &man.pbio.4; driver,
- which supports direct access to
- the Intel 8255A programmable peripheral interface (PPI)
- chip running in mode 0 (simple I/O) has been added.</para>
-
- <para>The &man.psm.4; driver now has improved support for
- Synaptics Touchpad users. It now has better tracking of
- slow-speed movement and support for various extra
- buttons and dials. These features can be tuned with the
- <varname>hw.psm.synaptics.<replaceable>*</replaceable></varname>
- hierarchy of sysctl variables.</para>
-
- <para arch="sparc64">The rtc driver has been added to support
- the MC146818-compatible clock found on some &ultrasparc; II
- and III models. &merged;</para>
-
- <para arch="i386">The &man.syscons.4; driver now supports VESA
- (15, 16, 24, and 32 bit) modes. To enable this feature, two
- kernel options <literal>SC_PIXEL_MODE</literal> and
- <literal>VESA</literal> (or corresponding kernel module)
- are needed.</para>
-
- <para arch="sparc64">The &man.uart.4; driver is now enabled in
- the <filename>GENERIC</filename> kernel, and is now the
- default driver for serial ports. The &man.ofw.console.4; and
- &man.sab.4; drivers are now disabled in the
- <filename>GENERIC</filename> kernel. &merged;</para>
-
- <para>The &man.uftdi.4; driver now supports the FTDI FT2232C
- chip.</para>
-
- <para>The &man.uplcom.4; driver now supports handling of the
- <literal>CTS</literal> signal.</para>
-
- <para>The &man.ehci.4; driver has been improved.</para>
-
- <para arch="sparc64">The zs driver has been removed
- in favor of the &man.uart.4; driver.</para>
-
- <sect4 id="mm">
- <title>Multimedia Support</title>
-
- <para arch="sparc64">The &man.snd.audiocs.4; driver has been
- added to support the Crystal Semiconductor CS4231 audio
- controller found on &ultrasparc;
- workstations. &merged;</para>
-
- <para>The &man.snd.csa.4; driver now supports
- suspend and resume operation.</para>
-
- <para>The &man.uaudio.4; driver now has some added
- functionality, including volume control on more inputs and
- recording capability on some devices. &merged;</para>
-
- </sect4>
-
- <sect4 id="net-if">
- <title>Network Interface Support</title>
-
- <para>The &man.ath.4; driver has been updated to split the
- transmit rate control algorithm into a separate module.
- One of <literal>device ath_rate_onoe</literal>,
- <literal>device ath_rate_amrr</literal>, or
- <literal>device ath_rate_sample</literal> must be included in
- the kernel configuration when using the &man.ath.4;
- driver.</para>
-
- <para>The &man.bge.4; driver now supports the &man.altq.4;
- framework, as well as the BCM5714, 5721, 5750, 5751, 5751M and 5789
- chips. &merged;</para>
-
- <para>The &man.cdce.4; USB Communication Device Class Ethernet
- driver has been added. &merged;</para>
-
- <para>The &man.cp.4; driver is now MPSAFE. &merged;</para>
-
- <para>The &man.ctau.4; driver is now MPSAFE. &merged;</para>
-
- <para>The &man.cx.4; driver is now MPSAFE. &merged;</para>
-
- <para>The &man.dc.4; driver now supports the &man.altq.4;
- framework. &merged;</para>
-
- <para>The &man.ed.4; driver now supports the &man.altq.4;
- framework. &merged;</para>
-
- <para>In the &man.em.4; driver, hardware support for VLAN
- tagging is now disabled by default due to some interactions
- between this feature and promiscuous mode. &merged;</para>
-
- <para>Ethernet flow control is now disabled by default in the
- &man.fxp.4; driver, to prevent problems on a subnet when a system panics
- or is left in the kernel debugger. &merged;</para>
-
- <para>The gx(4) driver has been removed because
- it is no longer maintained actively and
- the &man.em.4; driver supports all of the supported hardware.</para>
-
- <para>The &man.hme.4; driver is now MPSAFE. &merged;</para>
-
- <para>The &man.ipw.4; (for Intel PRO/Wireless 2100),
- &man.iwi.4; (for Intel PRO/Wireless 2200BG/2225BG/2915ABG),
- &man.ral.4; (for Ralink Technology RT2500),
- and &man.ural.4; (for Ralink Technology RT2500USB)
- drivers have been added.</para>
-
- <para>The &man.ixgb.4; driver is now MPSAFE. &merged;</para>
-
- <para>The musycc driver, for the LanMedia LMC1504 T1/E1
- network interface card, has been removed due to
- disuse.</para>
-
- <para arch="i386,amd64">Drivers using the &man.ndis.4; device
- driver wrapper mechanism are now built and loaded
- differently. The &man.ndis.4; driver can now be pre-built
- as module or statically compiled into a kernel. Individual
- drivers can now be built with the &man.ndisgen.8; utility;
- the result is a kernel module that can be loaded into a
- running kernel using &man.kldload.8;. &merged;</para>
-
- <para arch="amd64">The &man.ndis.4; device driver wrapper now
- supports &windows;/x86-64 binaries on amd64
- systems. &merged;</para>
-
- <para arch="i386,amd64">The &man.nve.4; driver, which supports the
- nVidia nForce MCP Networking Adapter, has been added.</para>
-
- <para>The &man.re.4; driver now supports the &man.altq.4;
- framework. &merged;</para>
-
- <para>The &man.sf.4; driver now has support for device polling
- and &man.altq.4;. &merged;</para>
-
- <para>Several programming errors in the &man.sk.4; driver have
- been corrected. These bugs were particular to SMP systems, and
- could cause panics, page faults, aborted SSH connections, or
- corrupted file transfers. More details can be found in
- errata note
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/ERRATA/notices/FreeBSD-EN-05:02.sk.asc">FreeBSD-EN-05:02.sk</ulink>.
- &merged;</para>
-
- <para>The &man.sk.4; driver now has support for &man.altq.4;.
- This driver also now supports jumbo frames on Yukon-based
- interfaces. &merged;</para>
-
- <para>The &man.ste.4; driver now has support for &man.altq.4;.</para>
-
- <para>The &man.vge.4; driver now has support for device polling
- (&man.polling.4;).</para>
-
- <para>Support for 802.11 devices in the &man.wlan.4; framework has been
- greatly overhauled. In addition to architectural changes,
- it includes completed 802.11g, WPA, 802.11i, 802.1x,
- WME/WMM, AP-side power-saving, and plugin frameworks for
- cryptography modules, authenticators, and access control.
- Note in particular that WEP now requires the
- <filename>wlan_wep</filename> module to be loaded (or
- compiled) into the kernel.</para>
-
- <para>The &man.xl.4; driver now supports
- &man.polling.4;. &merged;</para>
-
- </sect4>
- </sect3>
-
- <sect3 id="net-proto">
- <title>Network Protocols</title>
-
- <para>The MTU feedback in IPv6 has been disabled when the sender writes
- data that must be fragmented. &merged;</para>
-
- <para>The Common Address Redundancy Protocol (CARP) has
- been implemented. CARP comes from OpenBSD and allows
- multiple hosts to share an IP address, providing
- high availability and load balancing.
- For more information, see the &man.carp.4; manual page. &merged;</para>
-
- <para>The &man.if.bridge.4; network bridging implementation,
- originally from NetBSD, has been added. It supports the IEEE
- 802.1D Spanning Tree Protocol, individual interface devices
- for each bridge, and filtering of bridged packets.
- The &man.ifconfig.8; utility now supports to configure
- &man.if.bridge.4;.</para>
-
- <para>The &man.ipfw.4; <literal>IPDIVERT</literal> option is now
- available as a kernel loadable module.
- If this module is not loaded, &man.ipfw.4; will refuse to
- install <literal>divert</literal> rules and &man.natd.8;
- will return the error message <quote>protocol not supported</quote>.</para>
-
- <para>The &man.ipfw.4; system can work with
- <varname>debug.mpsafenet</varname>=<literal>1</literal>
- (this tunable is <literal>1</literal> by default)
- when the <literal>gid</literal>, <literal>jail</literal>,
- and/or <literal>uid</literal> rule options are used. &merged;</para>
-
- <para>The &man.ipfw.4; and &man.dummynet.4; systems now
- support IPv6.</para>
-
- <para>&man.ipfw.8; now supports classification and tagging
- of &man.altq.4; packets via a divert socket. It is also
- possible to specify rules that match TCP packets with specific
- payload sizes.</para>
-
- <para>The &man.ipfw.8; <literal>ipfw fwd</literal> rule now supports
- the full packet destination manipulation when the kernel option
- <literal>options IPFIREWALL_FORWARD_EXTENDED</literal> is specified
- in addition to <literal>options IPFIRWALL_FORWARD</literal>.
- This kernel option disables all restrictions to ensure proper
- behavior for locally generated packets and allows redirection of
- packets destined to locally configured IP addresses.
- Note that &man.ipfw.8; rules have to be carefully crafted to
- make sure that things like PMTU discovery do not break. &merged;</para>
-
- <para>The &man.ipfw.8; system now supports IPv4 only rules.</para>
-
- <para>&man.ipnat.8; now allows redirect rules to
- work for non-TCP/UDP packets. &merged;</para>
-
- <para>Ongoing work is reducing the use of the Giant lock by the
- network protocol stack and improving the locking
- strategies.</para>
-
- <para>The <filename>libalias</filename> library can now be built
- as a kernel module.</para>
-
- <para>The link state change notifications of network interfaces
- are sent to <filename>/dev/devctl</filename> now.</para>
-
- <para>A new &man.ng.ipfw.4; NetGraph node provides
- a simple interface between the &man.ipfw.4; and &man.netgraph.4;
- facilities.</para>
-
- <para>A new &man.ng.nat.4; NetGraph node has been added to
- perform NAT functions.</para>
-
- <para>A new &man.ng.netflow.4; NetGraph node allows a router
- running &os; to do NetFlow version 5 exports. &merged;</para>
-
- <para>A new &man.ng.tcpmss.4; NetGraph node has been added.
- This supports altering MSS options of TCP packets.</para>
-
- <para>The &man.sppp.4; driver now includes Frame Relay
- support. &merged;</para>
-
- <para>The &man.sppp.4; driver is now MPSAFE.</para>
-
- <para>The &os; routing table now requires gateways for routes
- to be of the same address family as the route itself.
- The &man.route.8; utility now rejects a combination of different
- address families. For example:</para>
-
- <screen>&prompt.root; route add 10.1.1.1 -inet6 fe80::1%fxp0</screen>
-
- <para>The new sysctl <varname>net.link.tap.user_open</varname>
- has been implemented. This allows unprivileged access to
- &man.tap.4; device nodes based on file system permissions.</para>
-
- <para>A bug in TCP that sometimes caused RST packets to
- be ignored if the receive window was zero bytes has been
- fixed. &merged;</para>
-
- <para>The <literal>RST</literal>
- handling of the &os; TCP stack has been improved
- to make reset attacks as difficult as possible while
- maintaining compatibility with the widest range of TCP stacks.
- The algorithm is as follows: For connections in the
- <literal>ESTABLISHED</literal>
- state, only resets with sequence numbers exactly matching
- <varname>last_ack_sent</varname> will cause a reset;
- all other segments will
- be silently dropped. For connections in all other states,
- a reset anywhere in the window will cause the connection
- to be reset. All other segments will be silently dropped.
- Note that this behavior technically violates the RFC 793 specification;
- the conventional (but less secure) behavior can be restored
- by setting a new sysctl <varname>net.inet.tcp.insecure_rst</varname>
- to <literal>1</literal>. &merged;</para>
-
- <para>Several bugs in the TCP SACK implementation have been
- fixed. &merged;</para>
-
- <para>RFC 1644 T/TCP support has been removed. This is because
- the design is based on a weak security model that can easily
- permit denial-of-service attacks. This TCP
- extension has been considered a defective one in
- a recent Internet Draft.</para>
-
- <para>The KAME IPv4 IPsec implementation integrated
- in &os; now supports TCP-MD5. &merged;</para>
-
- <para>Random ephemeral port number allocation has led to some
- problems with port reuse at high connection rates. This
- feature is now disabled during periods of high connection
- rates; whenever new connections are created faster than
- <varname>net.inet.ip.portrange.randomcps</varname> per second,
- port number randomization is disabled for the next
- <varname>net.inet.ip.portrange.randomtime</varname>
- seconds. The default values for these two sysctl variables
- are <literal>10</literal> and <literal>45</literal>,
- respectively. &merged;</para>
-
- <para>Fine-grained locking has been applied to many of the data
- structures in the IPX/SPX protocol stack. While not fully
- MPSAFE at this point, it is generally safe to use IPX/SPX
- without the Giant lock (in other words, the
- <varname>debug.mpsafenet</varname> sysctl variable may be set
- to <literal>1</literal>).</para>
-
- <para>Unix domain sockets now support the
- <literal>LOCAL_CREDS</literal> and
- <literal>LOCAL_CONNWAIT</literal> options.
- The <literal>LOCAL_CREDS</literal> option provides
- a mechanism for the receiver to receive the credentials
- of the process as a &man.recvmsg.2; control message.
- The <literal>LOCAL_CONNWAIT</literal>
- option causes the &man.connect.2; function to block
- until &man.accept.2; has been called on the listening socket.
- For more details, see the &man.unix.4; manual page.</para>
- </sect3>
-
- <sect3 id="disks">
- <title>Disks and Storage</title>
-
- <para>The &man.amr.4; driver is now safe for use on systems
- using &man.pae.4;. &merged;</para>
-
- <para arch="i386,ia64">The &man.arcmsr.4; driver has been added.
- It supports the Areca ARC-11<replaceable>xx</replaceable> and
- ARC-12<replaceable>xx</replaceable> series of SATA RAID
- controllers. &merged;</para>
-
- <para>The &man.ata.4; family of drivers has been overhauled and
- updated. It has been split into modules that can be loaded
- and unloaded independently (the <filename>atapci</filename>
- and <filename>ata</filename> modules are prerequesites for the
- device subdrivers, which are <filename>atadisk</filename>,
- <filename>atapicd</filename>, <filename>atapifd</filename>,
- <filename>atapist</filename>, and
- <filename>ataraid</filename>). On supported SATA controllers,
- devices can be hot inserted/removed. ATA RAID support has
- been rewritten and supports a number of new metadata formats.
- The <filename>atapicd</filename> driver no longer supports CD
- changers. This update has been referred to as <quote>ATA
- mkIII</quote>.</para>
-
- <para>The SHSEC GEOM class has been added. It provides for the
- sharing of a secret between multiple GEOM providers. All of
- these providers must be present in order to reveal the
- secret. This feature is controlled by the &man.gshsec.8;
- utility. &merged;</para>
-
- <para>The &man.hptmv.4; driver, which supports the HighPoint
- RocketRAID 182x series, has been added. &merged;</para>
-
- <para>The &man.ips.4; driver now support kernel crash dumps
- on some modern ServeRAID models. &merged;</para>
-
- <para>The &man.matcd.4; driver has been removed. &merged;</para>
-
- <para>The default SCSI boot-time probe delay in the
- <filename>GENERIC</filename> kernel has been reduced from
- fifteen seconds to five seconds.</para>
-
- <para>The old vinum(4) subsystem has been removed
- in favor of the new &man.geom.4;-based version.</para>
-
- <para>The &man.twa.4; driver has been updated to
- the 9.2 release (for &os; 5.2.1) distributed from
- the 3ware website.</para>
-
- <para arch="pc98">The &man.wd.4; driver has been removed. The
- &man.ata.4; driver has been found to work well enough on the
- pc98 platform that there is no need for the older &man.wd.4;
- driver.</para>
-
- <para>Information about newly-mounted cd9660 file systems (such
- as the presence of RockRidge extensions) is now only printed
- if the kernel was booted in verbose mode. This change was
- made to reduce the amount of (generally unnecessary) kernel
- log messages. &merged;</para>
-
- </sect3>
-
- <sect3 id="fs">
- <title>File Systems</title>
-
- <para>Recomputing the summary information for
- <quote>dirty</quote> UFS and UFS2 file systems is no longer
- done at mount time, but is now done by background
- &man.fsck.8;. This change improves the startup speed when
- mounting large file systems after a crash. The prior behavior
- can be restored by setting the
- <varname>vfs.ffs.compute_summary_at_mount</varname> sysctl
- variable to a non-zero value. &merged;</para>
-
- <para>A kernel panic in the NFS server has been fixed. More
- details can be found in errata note
- <ulink url="ftp://ftp.FreeBSD.org/pub/FreeBSD/ERRATA/notices/FreeBSD-EN-05:01.nfs.asc">FreeBSD-EN-05:01.nfs</ulink>.
- &merged;</para>
-
- <para arch="i386,pc98">Read-only support for ReiserFS version 3 has been
- added. See &man.mount.reiserfs.8; for details.</para>
-
- </sect3>
-
- <sect3>
- <title>Contributed Software</title>
-
- <para><application>ACPI-CA</application> has been updated from
- 20040527 to 20041119. &merged;</para>
-
- </sect3>
- </sect2>
-
- <sect2 id="userland">
- <title>Userland Changes</title>
-
- <para>The &man.burncd.8; utility now allows commands (such as
- <command>eject</command>) to take place after fixating a
- disk.</para>
-
- <para arch="amd64">Machine-specific optimized versions of
- &man.bcmp.3;, &man.bcopy.3;, &man.bzero.3;, &man.memcmp.3;,
- &man.memcpy.3;, &man.memmove.3;, &man.memset.3;, &man.strcat.3;
- and &man.strcpy.3; have been implemented. Several mathematics
- functions such as &man.ceill.3; and &man.sqrtf.3; are also
- replaced with the optimized versions.</para>
-
- <para>The &man.chflags.1; utility now supports the
- <option>-h</option> flag, which supports changing flags on
- symbolic links.</para>
-
- <para>The &man.env.1; program now supports a <option>-v</option>
- flag to write the command to standard error before it is executed.</para>
-
- <para>The &man.env.1; program now supports a <option>-S
- <replaceable>string</replaceable></option>
- option to split the <replaceable>string</replaceable> and pass them to
- the command as the command-line arguments.</para>
-
- <para>The &man.env.1; program now supports a <option>-P
- <replaceable>altpath</replaceable></option>
- option to set the command search path used to look for
- the command.</para>
-
- <para>The &man.ftpd.8; program now uses the <literal>212</literal>
- and <literal>213</literal> status codes for directory
- and file status correctly (<literal>211</literal> was used in
- the previous versions). This behavior is described in RFC 959.
- &merged;</para>
-
- <para>The <literal>create</literal> command of the &man.gpt.8;
- utility now supports a <option>-f</option> command-line flag to
- force creation of a GPT even when there is an MBR record on a
- disk. &merged;</para>
-
- <para>The &man.getaddrinfo.3; function now queries <literal>A</literal>
- DNS resource records before <literal>AAAA</literal> records
- when <literal>AF_UNSPEC</literal> is specified.
- Some broken DNS servers return <literal>NXDOMAIN</literal>
- against non-existent <literal>AAAA</literal> queries,
- even when it should return <literal>NOERROR</literal>
- with empty return records. This is a problem for an IPv4/IPv6 dual
- stack node because the <literal>NXDOMAIN</literal> returned
- by the first query of an <literal>AAAA</literal> record makes
- the querying server stop attempting to resolve the <literal>A</literal>
- record if any. Also, this behavior has been recognized as a potential
- denial-of-service attack (see <ulink url="http://www.kb.cert.org/vuls/id/714121"></ulink>
- for more details).
- Note that although the query order has been changed,
- the returned result still includes
- <literal>AF_INET6</literal> records before
- <literal>AF_INET</literal> records. &merged;</para>
-
- <para>The &man.gethostbyname.3;, &man.gethostbyname2.3;, and
- &man.gethostbyaddr.3; functions are now thread-safe. &merged;</para>
-
- <para>The &man.getnetent.3;, &man.getnetbyname.3;, and
- &man.getnetbyaddr.3; functions are now thread-safe. &merged;</para>
-
- <para>The &man.getprotoent.3;, &man.getprotobyname.3;, and
- &man.getprotobynumber.3; functions are now thread-safe. &merged;</para>
-
- <para>The &man.getservent.3;, &man.getservbyname.3;, and
- &man.getservbyport.3; functions are now thread-safe. &merged;</para>
-
- <para>For conformation to IEEE Std 1003.1-2001
- (also known as POSIX 2001), the <varname>n_net</varname> member
- of <varname>struct netent</varname> and the first argument
- of &man.getnetbyaddr.3; has been changed to an <literal>uint32_t</literal>.
- Due to these changes, the ABI on 64-bit platforms is
- incompatible with previous releases of &os; and
- the major version number of the <filename>libpcap</filename>
- shared library has been bumped.
- On 64-bit platforms being upgraded from older &os; versions, all
- userland programs that use &man.getnetbyaddr.3;,
- &man.getnetbyname.3;, &man.getnetent.3;, and/or
- <filename>libpcap</filename> have to be recompiled.</para>
-
- <para>The gvinum(8) utility now supports the
- <command>checkparity</command>,
- <command>rebuildparity</command>, and
- <command>setstate</command>
- subcommands. &merged;</para>
-
- <para>The &man.ifconfig.8; utility has been restructured. It is
- now more modular and flexible with respect to supporting
- interface-specific functionality. The 802.11 support has been
- updated to support recent changes to the 802.11 subsystem and
- drivers.</para>
-
- <para>Support for abbreviated forms of a number of &man.ipfw.8;
- options has been deprecated. Warnings are printed to stderr
- indicating the correct full form when one of these abbreviations
- is detected.</para>
-
- <para>The &man.kldstat.8; utility now supports a
- <option>-m</option> option to return the status of a specific
- kernel module. &merged;</para>
-
- <para>The on-disk format of <literal>LC_CTYPE</literal> files has
- been changed to be machine-independent.</para>
-
- <para>The <application>libkvm</application> now supports
- ELF crash dump on amd64 and i386 platforms,
- large crash dump (more than 4GB) in 32-bit platforms,
- and PAE crash dump on i386 platform.</para>
-
- <para>The &man.mixer.8; utility now supports the <option>-S</option>
- option. This is the same as the <option>-s</option> option
- but does not output mixing field separators.</para>
-
- <para>A bug in the <filename>libalias</filename> library
- which causes a core dump when the <option>-reverse</option>
- option is specified in &man.natd.8; has been fixed.</para>
-
- <para>The <filename>libarchive</filename> library (as well as the
- &man.tar.1; command that uses it) now has support for reading ISO
- images (with optional RockRidge extensions) and ZIP archives
- (with <literal>deflate</literal> and <literal>none</literal>
- compression). &merged;</para>
-
- <para>The <filename>libarchive</filename> library now supports
- handling a ZIP archive entry with more than 4GB compressed size (ZIP64
- extension) and Unix extension.</para>
-
- <para>The <filename>libgpib</filename> library has been added to
- give userland access to GPIB devices (using the the pcii driver)
- via the
- <function>ib<replaceable>foo</replaceable></function>
- API. &merged;</para>
-
- <para>The default stack sizes in <filename>libpthread</filename>,
- <filename>libthr</filename>,
- and <filename>libc_r</filename> have been increased. On 32-bit
- platforms, the main thread receives a 2MB stack size by default,
- with other threads receiving a 1MB stack size by default. On
- 64-bit platforms, the default stack sizes are 4MB and 2MB
- respectively. &merged;</para>
-
- <para>The <filename>libxpg4</filename> library has been removed
- because all of its functionality was long ago merged into
- <filename>libc</filename>.
- All binaries linked with <filename>libxpg4</filename>
- must be recompiled or use &man.libmap.conf.5;.
- Note that the &os; base system has no such binaries.</para>
-
- <para>The &man.lpd.8; program now checks to make sure the data
- file has been completely transfered before starting to
- print it when a data file received from some other host.
- Some implementations of &man.lpr.1; send the control file
- for a print job before sending the matching data files,
- which can cause problems if the receiving host is
- a busy print-server. &merged;</para>
-
- <para>A number of new functions have been implemented in the
- &man.math.3; library. These include &man.ceill.3;,
- &man.floorl.3;, &man.ilogbl.3;, &man.fma.3; and variants,
- &man.lrint.3; and variants, and &man.lround.3; and
- variants. &merged;</para>
-
- <para>The &man.mknod.8; utility is now deprecated.
- Device nodes have been managed by the &man.devfs.5; device file
- system since &os; 5.0.</para>
-
- <para arch="i386">The &man.mkuzip.8; utility, which
- compresses file system images for use with
- <literal>GEOM_UZIP</literal> &man.geom.4; module,
- has been added. &merged;</para>
-
- <para>The &man.moused.8; daemon now supports <quote>virtual
- scrolling</quote>, in which mouse motions made while holding
- down the middle mouse button are interpreted as scrolling. This
- feature is enabled with the <option>-V</option>
- flag. &merged;</para>
-
- <para>A separate directory has been added for &man.named.8;
- dynamic zones which is owned by the <username>bind</username> user
- (for creation of the zone journal file).
- For more detail, see an example dynamic zone in the sample
- &man.named.conf.5;. &merged;</para>
-
- <para>The &man.ncal.1; utility now supports a <option>-m</option>
- flag to generate a calendar for a specified month in the current
- year. &merged;</para>
-
- <para>The &man.newfs.8; utility now supports a <option>-n</option>
- flag to suppress the creation of a <filename>.snap</filename>
- directory on new file systems. This feature is intended for use
- on memory or vnode file systems that will not require snapshot
- support. &merged;</para>
-
- <para>The &man.newfs.8; utility now emits a warning when creating
- a UFS or UFS2 file system that cannot support snapshots. This
- situation can occur in the case of very large file systems with
- small block sizes. &merged;</para>
-
- <para>The &man.newsyslog.8; utility now supports
- a <option>-d</option> option to specify an alternate root for log files
- similar to <varname>DESTDIR</varname> in the BSD make process.
- This only affects log file paths, not configuration file (<option>-f</option>)
- or archive directory (<option>-a</option>) paths.</para>
-
- <para>The &man.newsyslog.8; utility now supports a
- <option>-N</option> that causes it not to rotate any files.</para>
-
- <para>The <literal>NO_NIS</literal> compile-time knob for userland
- has been added. As its name implies, enabling this
- <filename>Makefile</filename> variable will cause NIS support to
- be excluded from various programs and will cause the NIS
- utilities to not be built. &merged;</para>
-
- <para>For years, &os; has used <filename>Makefile</filename>
- variables of the form
- <varname>NO<replaceable>FOO</replaceable></varname> and
- <varname>NO_<replaceable>FOO</replaceable></varname>. For
- consistency, those variables using the former naming convention
- have been converted to the
- <varname>NO_<replaceable>FOO</replaceable></varname> form. The
- file <filename>/usr/share/mk/bsd.compat.mk</filename> has a
- complete list of these variables; it also implements some
- temporary backward compatibility for the old names.</para>
-
- <para>The &man.periodic.8; security output now supports the display of
- information about blocked packet counts from &man.pf.4;. &merged;</para>
-
- <para>The &man.pgrep.1; command now supports a <option>-S</option> option
- which allows matching system processes (kernel threads).</para>
-
- <para>The &man.pgrep.1; and &man.pkill.1; commands now support a
- <option>-F</option> option, which matches a process whose PID is
- stored in a file.</para>
-
- <para>The &man.pgrep.1; and &man.pkill.1; commands now support a
- <option>-i</option> option to ignore case in the process match.</para>
-
- <para>The &man.pgrep.1; and &man.pkill.1; commands now support a
- <option>-j</option> option that matches processes
- based on their &man.jail.2; ID.</para>
-
- <para>The &man.pgrep.1; and &man.pkill.1; commands now support a
- <option>-o</option> option which matches only the oldest
- (least recently started) of the matching processes.</para>
-
- <para>The &man.powerd.8; program for managing power consumption has been
- added.</para>
-
- <para>The &man.ppp.8; program now implements an
- <option>echo</option> parameter, which allows LCP ECHOs to be
- enabled independently of LQR reports. Older versions of
- &man.ppp.8; would revert to LCP ECHO mode on negotiation
- failure. It is now necessary to specify <command>enable
- echo</command> to get this behavior. &merged;</para>
-
- <para>The <option>disable NAS-IP-Address</option> and
- <option>disable NAS-Identifier</option> options,
- which support pre-RFC 2865 RADIUS servers
- have been added to the &man.ppp.8; program.</para>
-
- <para>Two bugs in the &man.pppd.8; program have been fixed.
- They may result in an incorrect CBCP response,
- which violates the Microsoft PPP Callback Control Protocol
- section 3.2. &merged;</para>
-
- <para>The &man.ps.1; utility now supports a <literal>jid</literal>
- keyword in the <option>-o</option> option. It displays the
- &man.jail.2; ID of each process.</para>
-
- <para>The &man.pstat.8; program now supports a <option>-h</option> option
- to print swap sizes with SI prefixes such as K, M, and G,
- which are used to form binary multiples.</para>
-
- <para>The &man.rescue.8; utilities in the <filename>/rescue</filename>
- directory now include &man.bsdtar.1; instead of GNU tar.</para>
-
- <para>The &man.restore.8; utility has regained the ability to read
- &os; version 1 dump tapes. &merged;</para>
-
- <para>A bug of the &man.rexecd.8; utility which results in
- it behaving as if the <option>-i</option> option is always
- specified has been fixed. &merged;</para>
-
- <para>The &man.rexecd.8; utility has been removed.
- There are no rexec clients in the &os; tree, and the client
- function &man.rexec.3; is present only in
- <filename>libcompat</filename>.</para>
-
- <para>The &man.rm.1; utility now supports an <option>-I</option>
- option that asks for confirmation (once) if recursively
- removing directories or if more than 3 files are listed in the
- command line. &merged;</para>
-
- <para>The &man.rm.1; utility now suppresses diagnostic messages
- when it attempts to remove a non-existent directory
- with the <option>-r</option> and <option>-f</option> options
- specified. This behavior is required by
- Version 3 of the Single UNIX Specification (SUSv3).</para>
-
- <para>The following ISO/IEC 9899:1999 standard functions
- have been implemented: <function>roundl()</function>,
- <function>lroundl()</function>, <function>llroundl()</function>,
- <function>truncl()</function>, and <function>floorl()</function>.</para>
-
- <para>An &man.rpmatch.3; library function has been added to check
- a string for being an affirmative or negative response in the
- current locale.</para>
-
- <para>The &man.rtld.1; dynamic linker now supports specifying
- library replacements via the <varname>LD_LIBMAP</varname>
- environment variable. This variable will override the entries
- in &man.libmap.conf.5;. &merged;</para>
-
- <para>The rune(3) non-standard multibyte and wide character support
- interface has been removed.</para>
-
- <para>&man.sed.1; now supports a <option>-l</option> option to
- make its output line-buffered. &merged;</para>
-
- <para>The &man.strftime.3; function now supports some GNU extensions
- such as <literal>-</literal> (no padding),
- <literal>_</literal> (use space as padding),
- and <literal>0</literal> (zero padding). &merged;</para>
-
- <para>The &man.syslog.3; function is now thread-safe. &merged;</para>
-
- <para>The &man.syslogd.8; utility now opens an additional domain
- socket (<filename>/var/run/logpriv</filename> by default),
- with <literal>0600</literal> permissions to be used
- by privileged programs. This prevents privileged
- programs from locking when the domain sockets
- run out of buffer space due to a
- local denial-of-service attack. &merged;</para>
-
- <para>The &man.syslogd.8; now supports the <option>-S</option> option,
- which allows to change the pathname of the privileged
- socket. This is useful for preventing the daemon
- from receiving any messages from the local sockets
- (<filename>/var/run/log</filename> and
- <filename>/var/run/logpriv</filename> are used by default).
- &merged;</para>
-
- <para>The &man.syslogd.8; utility now allows
- <literal>:</literal> and <literal>%</literal>
- characters in the hostname specifications.
- These characters are used in IPv6 addresses and scope IDs. &merged;</para>
-
- <para>The &man.systat.1; <option>-netstat</option> display is now
- IPv6-aware. &merged;</para>
-
- <para>The <option>-f</option> option of &man.tail.1; utility
- now supports more than one file at a time. &merged;</para>
-
- <para>The &man.telnet.1; and &man.telnetd.8; programs now support
- the <option>-S</option> option for specifying a numeric TOS
- byte.</para>
-
- <para>Prepending a <literal>+</literal> character to port numbers
- passed to &man.telnet.1; program will now disable option
- negotiation and allow the transfer of characters with the high
- bit set. This feature is intended to support the fairly common
- use of &man.telnet.1; as a protocol tester.</para>
-
- <para>The &man.tcpdrop.8; command, which closes a selected TCP
- connection, has been added. It was obtained from
- OpenBSD. &merged;</para>
-
- <para>&man.what.1; now supports a <option>-q</option> flag, which
- causes it to print matching text, but not format it.</para>
-
- <para>&man.whois.1; now supports
- a <option>-k</option> flag
- for querying <hostid role="fqdn">whois.krnic.net</hostid>
- (the National Internet Development Agency of Korea),
- which holds details of IP address allocations within
- Korea. &merged;</para>
-
- <para>The <option>-I</option> option of the &man.xargs.1; command
- has been changed to conform to IEEE Std 1003.1-2004.
- The standard requires that the constructed
- arguments cannot grow larger than 255 bytes.</para>
-
- <para>A bug, which caused the last line of configuration files such as &man.hosts.5;,
- &man.services.5;, and so on to be ignored if it did not end in a newline character,
- has been fixed. &merged;</para>
-
- <para>A new system user/group <username>_dhcp</username>
- has been added to support &man.dhclient.8; from OpenBSD.</para>
-
- <sect3 id="rc-scripts">
- <title><filename>/etc/rc.d</filename> Scripts</title>
-
- <para>The <filename>rc.d/bsnmpd</filename> startup script
- for &man.bsnmpd.1; has been added.</para>
-
- <para>The <filename>rc.d/jail</filename> startup script
- now supports <varname>jail_<replaceable>name</replaceable>_flags</varname>
- variable which allows to specify &man.jail.8; flags.
- &merged;</para>
-
- <para>&man.rc.conf.5; now supports changes of network interface names
- at boot time. &merged; For example:</para>
-
- <programlisting>ifconfig_fxp0_name="net0"
-ifconfig_net0="inet 10.0.0.1/16"</programlisting>
-
- <para>The <filename>rc.d/moused</filename> script now
- starts/stops/checks a specific device when
- the device name is given as the second argument to the script:</para>
-
- <screen>&prompt.root; /etc/rc.d/moused start ums0</screen>
-
- <para>To use different &man.rc.conf.5; knobs with different
- mice, use the device name as part of the knob.
- For example, if the mouse device is <filename>/dev/ums0</filename>
- the following lines can be used:</para>
-
- <programlisting>moused_ums0_enable=yes
-moused_ums0_flags="-z 4"
-moused_ums0_port="/dev/ums0"</programlisting>
-
- <para>&man.rc.conf.5; now supports the <varname>tmpmfs_flags</varname>
- and <varname>varmfs_flags</varname> variables.
- These can be used to pass extra options to the &man.mdmfs.8; utility,
- to customize the finer details of the &man.md.4; file system creation,
- such as to turn on/off softupdates, to specify a default owner
- for the file system, and so on. &merged;</para>
-
- <para>The following scripts have been removed because
- they were NetBSD specific and never used in &os;:
- <filename>altqd</filename>,
- <filename>dhcpd</filename>,
- <filename>dhcrelay</filename>,
- <filename>downinterfaces</filename>,
- <filename>gated</filename>,
- <filename>ifwatchd</filename>,
- <filename>kdc</filename>,
- <filename>lkm1</filename>,
- <filename>lkm2</filename>,
- <filename>lkm3</filename>,
- <filename>mixerctl</filename>,
- <filename>mopd</filename>,
- <filename>mountall</filename>,
- <filename>ndbootd</filename>,
- <filename>network</filename>,
- <filename>poffd</filename>,
- <filename>postfix</filename>,
- <filename>ppp</filename>,
- <filename>racoon</filename>,
- <filename>raidframe</filename>,
- <filename>rbootd</filename>,
- <filename>rtsold</filename>,
- <filename>screenblank</filename>,
- <filename>swap2</filename>,
- <filename>sysdb</filename>,
- <filename>wscons</filename>,
- <filename>xdm</filename>, and
- <filename>xfs</filename></para>
- </sect3>
- </sect2>
-
- <sect2 id="contrib">
- <title>Contributed Software</title>
-
- <para><application>awk</application> has been updated from the 7
- February 2004 release to the 24 April 2005 release.</para>
-
- <para><application>BIND</application> has been updated from version
- 9.3.0 to version 9.3.1. &merged;</para>
-
- <para><application>bsnmp</application> has been updated from 1.7
- to 1.10.</para>
-
- <para><application>bzip2</application> has been updated from 1.0.2
- to 1.0.3.</para>
-
- <para><application>OpenBSD dhclient</application> as of OpenBSD 3.7
- has been imported. It replaces the ISC DHCP client used in
- prior versions of &os;.</para>
-
- <para><application>FILE</application> has been updated from 4.10
- to 4.12.</para>
-
- <para><application>GNU GCC</application> has been updated from
- from 3.4.2-prerelease as of 28 July, 2004 to 3.4.4.</para>
-
- <para>A number of bug fixes and performance enhancements have been
- added to <application>GNU grep</application> in the form of
- patches from Fedora's grep-2.5.1-48 source RPM.</para>
-
- <para><application>GNU readline</application> has been updated from
- version 4.3 to version 5.0.</para>
-
- <para><application>IPFilter</application> has been updated from
- 3.4.35 to 4.1.18.</para>
-
- <para><application>Heimdal</application> has been updated from
- 0.6.1 to 0.6.3. &merged;</para>
-
- <para>The <application>hostapd</application>
- v0.3.9 has been imported. This is a user space IEEE
- 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP
- Authenticator and RADIUS authentication server.
- For more details, see &man.hostapd.8;.</para>
-
- <para><application>libpcap</application> has been updated from
- v0.8.3 to v0.9.1 (alpha 096).</para>
-
- <para><application>libregex</application> has been updated from a
- snapshot from <application>GNU grep</application> 2.5.1 to a
- snapshot from the <literal>fedora-glibc-2_3_4-21</literal> tag
- in the <application>glibc</application> CVS repository.</para>
-
- <para><application>libz</application> has been updated from 1.2.1
- to 1.2.2.</para>
-
- <para><application>lukemftp</application> has been updated from a
- 26 April 2004 snapshot from OpenBSD's sources to a snapshot as
- of 16 May 2005.</para>
-
- <para>A snapshot of <application>netcat</application> from OpenBSD
- as of 4 February 2005 has been added. More information can be
- found in the &man.nc.1; manual page. &merged;</para>
-
- <para><application>NgATM</application> has been updated from 1.0
- to 1.2.</para>
-
- <para><application>OpenPAM</application> has been updated from the
- Eelgrass release to the Feterita release.</para>
-
- <para><application>OpenPAM</application> has been updated from the
- Feterita release to the Figwort release.</para>
-
- <para><application>OpenSSH</application> has been updated from 3.8p1
- to 4.1p1.</para>
-
- <para><application>OpenSSL</application> has been updated from
- 0.9.7d to 0.9.7e. &merged;</para>
-
- <para><application>pf</application> has been updated from the
- version included with <application>OpenBSD</application> 3.5 to
- the version included with <application>OpenBSD</application>
- 3.7.</para>
-
- <para><application>sendmail</application> has been updated from
- version 8.13.1 to version 8.13.3. &merged;</para>
-
- <para><application>sendmail</application> has been updated from
- version 8.13.3 to version 8.13.4. It now supports
- <literal>OSTYPE(freebsd6)</literal>.</para>
-
- <para><application>tcpdump</application> has been updated from
- v3.8.3 to v3.9.1 (alpha 096).</para>
-
- <para><application>tcsh</application> has been updated from
- 6.13.00 to 6.14.00.</para>
-
- <para><application>texinfo</application> has been updated from 4.6
- to 4.8.</para>
-
- <para>The timezone database has been updated from the
- <application>tzdata2004e</application> release to the
- <application>tzdata2004g</application> release. &merged;</para>
-
- <para>The <application>WPA Supplicant</application>
- v0.3.9 has been imported. This provides WPA Supplicant
- component of WPA/IEEE 802.11i features.
- For more details, see &man.wpa.supplicant.8;.</para>
-
- </sect2>
-
- <sect2 id="ports">
- <title>Ports/Packages Collection Infrastructure</title>
-
- <para>The &man.pkg.create.1; utility now supports a
- <option>-R</option> flag. When creating a package file
- from the locally installed package, it creates package
- files for all packages on which that locally installed
- package depends if this flag is specified.</para>
-
- <para>The &man.pkg.version.1; utility now supports a
- <option>-q</option> flag to suppress the output of the port
- version comparison characters <literal>&lt;</literal>,
- <literal>=</literal>, and <literal>&gt;</literal>.</para>
-
- <para>The &man.pkg.version.1; utility now supports a
- <option>-I</option> flag, which causes only the
- <filename>INDEX</filename> file to be used for determining if a
- package is out of date. &merged;</para>
-
- <para>The
- <filename>ports/INDEX<replaceable>*</replaceable></filename>
- files, which kept an index of all of the entries in the ports
- collection, have been removed from the CVS repository. &merged;
- These files were generated only infrequently, and therefore were
- usually out-of-date and inaccurate. Users requiring an index
- file (such as for use by programs such as &man.portupgrade.1;)
- have two alternatives for obtaining a copy:</para>
-
- <itemizedlist>
- <listitem>
- <para>Build an index file based on the current ports tree by
- running <command>make index</command> from the top of the
- <filename>ports/</filename> tree.</para>
- </listitem>
-
- <listitem>
- <para>Fetch an index file over the network by running
- <command>make fetchindex</command> from the top of the
- <filename>ports/</filename> tree. This index file will
- (typically) be accurate to within a day.</para>
- </listitem>
- </itemizedlist>
-
- </sect2>
-
- <sect2 id="releng">
- <title>Release Engineering and Integration</title>
-
- <para>In prior &os; releases, the <filename>disc1</filename>
- CD-ROM (or ISO image) was a bootable installation disk
- containing the base system, ports tree, and common packages.
- The <filename>disc2</filename> CD-ROM (or ISO image) was a
- bootable <quote>fix it</quote> disk with a live filesystem, to
- be used for making emergency repairs. This layout has now
- changed. For all architectures except ia64, the
- <filename>disc1</filename> image now contains the base system
- distribution files, ports tree, and the live filesystem, making
- it suitable for both an initial installation and repair
- purposes. (On the ia64, the live filesystem is on a separate
- disk due to its size.) Packages appear on separate
- disks; in particular, the <filename>disc2</filename> image
- contains commonly packages such as desktop environments.
- Documents from the &os; Documentation Project also appear on
- <filename>disc2</filename>. &merged;</para>
-
- <para>The supported version of the
- <application>GNOME</application> desktop environment has been
- updated from 2.6.2 to 2.10.1. More information about
- running <application>GNOME</application> on &os; can be found on
- the <ulink url="&url.base;/gnome/">FreeBSD GNOME Project</ulink>
- Web page. &merged;
-
- <note>
- <para>Users of older versions of the
- <application>GNOME</application> desktop
- (<filename role="package">x11/gnome2</filename>)
- must take particular care in upgrading. Simply upgrading it
- from the &os; Ports Collection with &man.portupgrade.1;
- (<filename role="package">sysutils/portupgrade</filename>)
- will cause serious problems.
- <application>GNOME</application> desktop users should read
- the instructions carefully at
- <ulink url="&url.base;/gnome/docs/faq210.html"></ulink>
- and use the
- <ulink url="&url.base;/gnome/gnome_upgrade.sh"><filename>gnome_upgrade.sh</filename></ulink>
- script to properly upgrade to
- <application>GNOME</application> 2.10.</para>
- </note>
- </para>
-
- <para>The supported version of the <application>KDE</application>
- desktop environment has been updated from 3.3.0 to
- 3.4.0. More information regarding running
- <application>KDE</application> on &os; can be found on the
- <ulink url="http://freebsd.kde.org/">KDE on FreeBSD</ulink> Web
- page. &merged;
-
- <note>
- <para>Users of older versions of
- <application>KDE</application> should follow the upgrading
- procedure documented on the
- <ulink url="http://freebsd.kde.org/">KDE on FreeBSD</ulink> Web
- page or in <filename>ports/UPDATING</filename>.</para>
- </note>
- </para>
-
- <para>The supported version of <application>Xorg</application> has
- been updated from 6.7.0 to 6.8.2. &merged;</para>
-
- </sect2>
-
- <sect2 id="doc">
- <title>Documentation</title>
-
- <para>Documentation of existing functionality has been improved by
- the addition of the following manual pages: &man.ataraid.4;,
- &man.bus.space.9;,
- &man.central.4;, &man.clkbrd.4;, &man.creator.4;,
- &man.devfs.conf.5, &man.devfs.rules.5,
- &man.ebus.4;, &man.eeprom.4;,
- &man.fhc.4;,
- &man.machfb.4;,
- &man.ofw.console.4;, &man.openfirm.4;, &man.openprom.4;,
- &man.pmap.page.init.9;, &man.pthread.atfork.3;,
- &man.rtc.4;,
- &man.sbus.4;, &man.sched.4bsd.4;, &man.sched.ule.4;, &man.snd.fm801.4;,
- &man.snd.neomagic.4;, &man.snd.via8233.4;, &man.snd.via82c686.4;,
- and &man.snd.vibes.4;.</para>
-
- <para>Manual pages in the base system have received a number of
- cleanups, both for content and presentation. Cross-references
- are more correct and consistent, standard section headings are
- now used throughout, and markup has been cleaned up.</para>
-
- <para>The following manual pages, which were derived from RFCs
- and possibly violate the IETF's copyrights, have been replaced:
- &man.gai.strerror.3;,
- &man.getaddrinfo.3;,
- &man.getnameinfo.3;,
- &man.inet6.opt.init.3;,
- &man.inet6.option.space.3;,
- &man.inet6.rth.space.3;,
- &man.inet6.rthdr.space.3;,
- &man.icmp6.4;, and
- &man.ip6.4;. &merged;</para>
-
- </sect2>
-</sect1>
-
-<sect1 id="upgrade">
- <title>Upgrading from previous releases of &os;</title>
-
- <para>Source upgrades to &os; &release.current; are only supported
- from &os; 5.3-RELEASE or later. Users of older systems wanting to
- upgrade &release.current; will need to update to &os; 5.3 or newer
- first, then to &os; &release.current;.</para>
-
- <important>
- <para>Upgrading &os; should, of course, only be attempted after
- backing up <emphasis>all</emphasis> data and configuration
- files.</para>
- </important>
-</sect1>
diff --git a/sbin/recoverdisk/Makefile b/sbin/recoverdisk/Makefile
deleted file mode 100644
index e86fbb2..0000000
--- a/sbin/recoverdisk/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# $FreeBSD$
-
-PROG= recoverdisk
-
-NO_MAN=
-
-WARNS?= 5
-
-.include <bsd.prog.mk>
-
-test: ${PROG}
- ./${PROG} /dev/ad0
diff --git a/sbin/recoverdisk/recoverdisk.c b/sbin/recoverdisk/recoverdisk.c
deleted file mode 100644
index 89c2f49..0000000
--- a/sbin/recoverdisk/recoverdisk.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $FreeBSD$
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/queue.h>
-#include <sys/disk.h>
-
-#define BIGSIZE (1024 * 1024)
-#define MEDIUMSIZE (64 * 1024)
-
-struct lump {
- off_t start;
- off_t len;
- int state;
- TAILQ_ENTRY(lump) list;
-};
-
-static TAILQ_HEAD(, lump) lumps = TAILQ_HEAD_INITIALIZER(lumps);
-
-
-static void
-new_lump(off_t start, off_t len, int state)
-{
- struct lump *lp;
-
- lp = malloc(sizeof *lp);
- if (lp == NULL)
- err(1, "Malloc failed");
- lp->start = start;
- lp->len = len;
- lp->state = state;
- TAILQ_INSERT_TAIL(&lumps, lp, list);
-}
-
-int
-main(int argc, const char **argv)
-{
- int fdr, fdw;
- struct lump *lp;
- off_t t, d;
- size_t i, j;
- int error;
- u_char *buf;
- u_int sectorsize;
- time_t t1, t2;
-
-
- if (argc < 2)
- errx(1, "Usage: %s source-drive [destination]", argv[0]);
-
- buf = malloc(BIGSIZE);
- if (buf == NULL)
- err(1, "Cannot allocate %d bytes buffer", BIGSIZE);
- fdr = open(argv[1], O_RDONLY);
- if (fdr < 0)
- err(1, "Cannot open read descriptor %s", argv[1]);
- if (argc > 2) {
- fdw = open(argv[2], O_WRONLY);
- if (fdw < 0)
- err(1, "Cannot open write descriptor %s", argv[2]);
- } else {
- fdw = -1;
- }
-
- error = ioctl(fdr, DIOCGSECTORSIZE, &sectorsize);
- if (error < 0)
- err(1, "DIOCGSECTORSIZE failed");
-
- error = ioctl(fdr, DIOCGMEDIASIZE, &t);
- if (error < 0)
- err(1, "DIOCGMEDIASIZE failed");
-
- new_lump(0, t, 0);
- d = 0;
-
- t1 = 0;
- for (;;) {
- lp = TAILQ_FIRST(&lumps);
- if (lp == NULL)
- break;
- TAILQ_REMOVE(&lumps, lp, list);
- while (lp->len > 0) {
- i = BIGSIZE;
- if (lp->len < BIGSIZE)
- i = lp->len;
- if (lp->state == 1)
- i = MEDIUMSIZE;
- if (lp->state > 1)
- i = sectorsize;
- time(&t2);
- if (t1 != t2 || lp->len < BIGSIZE) {
- printf("\r%13jd %7zu %13jd %3d %13jd %13jd %.8f",
- (intmax_t)lp->start,
- i,
- (intmax_t)lp->len,
- lp->state,
- (intmax_t)d,
- (intmax_t)(t - d),
- (double)d/(double)t);
- t1 = t2;
- }
- if (i == 0) {
- errx(1, "BOGUS i %10jd", (intmax_t)i);
- }
- fflush(stdout);
- j = pread(fdr, buf, i, lp->start);
- if (j == i) {
- d += i;
- if (fdw >= 0)
- j = pwrite(fdw, buf, i, lp->start);
- else
- j = i;
- if (j != i)
- printf("\nWrite error at %jd/%zu\n",
- lp->start, i);
- lp->start += i;
- lp->len -= i;
- continue;
- }
- printf("\n%jd %zu failed %d\n", lp->start, i, errno);
- new_lump(lp->start, i, lp->state + 1);
- lp->start += i;
- lp->len -= i;
- }
- free(lp);
- }
- printf("\nCompleted\n");
- exit (0);
-}
-
diff --git a/sbin/setkey/Makefile b/sbin/setkey/Makefile
deleted file mode 100644
index 91977e0..0000000
--- a/sbin/setkey/Makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of the project nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# $FreeBSD$
-
-PROG= setkey
-MAN= setkey.8
-SRCS= setkey.c parse.y token.l
-
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libipsec
-YFLAGS= -d
-
-DPADD= ${LIBL} ${LIBY}
-LDADD= -ll -ly
-
-CLEANFILES= y.tab.c y.tab.h key_test.o keytest
-
-# libpfkey
-# ipsec_strerror.c is for avoiding shlib reference to non-exported function.
-.PATH: ${.CURDIR}/../../lib/libipsec ${.CURDIR}/../../sys/netkey
-SRCS+= pfkey.c pfkey_dump.c key_debug.c ipsec_strerror.c
-CFLAGS+= -I${.CURDIR}/../../lib/libipsec -I${.CURDIR}/../../sys/netkey
-
-SRCS+= y.tab.h
-y.tab.h: parse.y
-CFLAGS+= -DIPSEC_DEBUG -DINET6 -DYY_NO_UNPUT -I.
-DPADD+= ${LIBIPSEC}
-LDADD+= -lipsec
-CLEANFILES+= scriptdump y.tab.h
-
-#SCRIPTS= scriptdump
-
-LOCALPREFIX= /usr
-
-scriptdump: scriptdump.pl
- sed -e 's#@LOCALPREFIX@#${LOCALPREFIX}#' < $> > scriptdump
-
-.include <bsd.prog.mk>
diff --git a/sbin/setkey/parse.y b/sbin/setkey/parse.y
deleted file mode 100644
index d6bb8c4..0000000
--- a/sbin/setkey/parse.y
+++ /dev/null
@@ -1,1267 +0,0 @@
-/* $FreeBSD$ */
-/* $KAME: parse.y,v 1.82 2004/04/15 08:03:57 sakane Exp $ */
-
-/*
- * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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/socket.h>
-
-#include <net/route.h>
-#include <netinet/in.h>
-#include <net/pfkeyv2.h>
-#include <netkey/key_var.h>
-#include <netinet6/ipsec.h>
-#include <arpa/inet.h>
-
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <ctype.h>
-#include <errno.h>
-
-#include "libpfkey.h"
-#include "vchar.h"
-
-#define ATOX(c) \
- (isdigit(c) ? (c - '0') : (isupper(c) ? (c - 'A' + 10) : (c - 'a' + 10)))
-
-u_int32_t p_spi;
-u_int p_ext, p_alg_enc, p_alg_auth, p_replay, p_mode;
-u_int32_t p_reqid;
-u_int p_key_enc_len, p_key_auth_len;
-caddr_t p_key_enc, p_key_auth;
-time_t p_lt_hard, p_lt_soft;
-
-static int p_aiflags = 0, p_aifamily = PF_UNSPEC;
-
-static struct addrinfo *parse_addr __P((char *, char *));
-static int fix_portstr __P((vchar_t *, vchar_t *, vchar_t *));
-static int setvarbuf __P((char *, int *, struct sadb_ext *, int, caddr_t, int));
-void parse_init __P((void));
-void free_buffer __P((void));
-
-int setkeymsg0 __P((struct sadb_msg *, unsigned int, unsigned int, size_t));
-static int setkeymsg_spdaddr __P((unsigned int, unsigned int, vchar_t *,
- struct addrinfo *, int, struct addrinfo *, int));
-static int setkeymsg_addr __P((unsigned int, unsigned int,
- struct addrinfo *, struct addrinfo *, int));
-static int setkeymsg_add __P((unsigned int, unsigned int,
- struct addrinfo *, struct addrinfo *));
-extern int setkeymsg __P((char *, size_t *));
-extern int sendkeymsg __P((char *, size_t));
-
-extern int yylex __P((void));
-extern void yyfatal __P((const char *));
-extern void yyerror __P((const char *));
-%}
-
-%union {
- int num;
- unsigned long ulnum;
- vchar_t val;
- struct addrinfo *res;
-}
-
-%token EOT SLASH BLCL ELCL
-%token ADD GET DELETE DELETEALL FLUSH DUMP
-%token PR_ESP PR_AH PR_IPCOMP PR_TCP
-%token F_PROTOCOL F_AUTH F_ENC F_REPLAY F_COMP F_RAWCPI
-%token F_MODE MODE F_REQID
-%token F_EXT EXTENSION NOCYCLICSEQ
-%token ALG_AUTH ALG_AUTH_NOKEY
-%token ALG_ENC ALG_ENC_NOKEY ALG_ENC_DESDERIV ALG_ENC_DES32IV ALG_ENC_OLD
-%token ALG_COMP
-%token F_LIFETIME_HARD F_LIFETIME_SOFT
-%token DECSTRING QUOTEDSTRING HEXSTRING STRING ANY
- /* SPD management */
-%token SPDADD SPDDELETE SPDDUMP SPDFLUSH
-%token F_POLICY PL_REQUESTS
-%token F_AIFLAGS
-%token TAGGED
-
-%type <num> prefix protocol_spec upper_spec
-%type <num> ALG_ENC ALG_ENC_DESDERIV ALG_ENC_DES32IV ALG_ENC_OLD ALG_ENC_NOKEY
-%type <num> ALG_AUTH ALG_AUTH_NOKEY
-%type <num> ALG_COMP
-%type <num> PR_ESP PR_AH PR_IPCOMP PR_TCP
-%type <num> EXTENSION MODE
-%type <ulnum> DECSTRING
-%type <val> PL_REQUESTS portstr key_string
-%type <val> policy_requests
-%type <val> QUOTEDSTRING HEXSTRING STRING
-%type <val> F_AIFLAGS
-%type <val> upper_misc_spec policy_spec
-%type <res> ipaddr
-
-%%
-commands
- : /*NOTHING*/
- | commands command
- {
- free_buffer();
- parse_init();
- }
- ;
-
-command
- : add_command
- | get_command
- | delete_command
- | deleteall_command
- | flush_command
- | dump_command
- | spdadd_command
- | spddelete_command
- | spddump_command
- | spdflush_command
- ;
- /* commands concerned with management, there is in tail of this file. */
-
- /* add command */
-add_command
- : ADD ipaddropts ipaddr ipaddr protocol_spec spi extension_spec algorithm_spec EOT
- {
- int status;
-
- status = setkeymsg_add(SADB_ADD, $5, $3, $4);
- if (status < 0)
- return -1;
- }
- ;
-
- /* delete */
-delete_command
- : DELETE ipaddropts ipaddr ipaddr protocol_spec spi extension_spec EOT
- {
- int status;
-
- if ($3->ai_next || $4->ai_next) {
- yyerror("multiple address specified");
- return -1;
- }
- if (p_mode != IPSEC_MODE_ANY)
- yyerror("WARNING: mode is obsolete");
-
- status = setkeymsg_addr(SADB_DELETE, $5, $3, $4, 0);
- if (status < 0)
- return -1;
- }
- ;
-
- /* deleteall command */
-deleteall_command
- : DELETEALL ipaddropts ipaddr ipaddr protocol_spec EOT
- {
- int status;
-
- status = setkeymsg_addr(SADB_DELETE, $5, $3, $4, 1);
- if (status < 0)
- return -1;
- }
- ;
-
- /* get command */
-get_command
- : GET ipaddropts ipaddr ipaddr protocol_spec spi extension_spec EOT
- {
- int status;
-
- if (p_mode != IPSEC_MODE_ANY)
- yyerror("WARNING: mode is obsolete");
-
- status = setkeymsg_addr(SADB_GET, $5, $3, $4, 0);
- if (status < 0)
- return -1;
- }
- ;
-
- /* flush */
-flush_command
- : FLUSH protocol_spec EOT
- {
- struct sadb_msg msg;
- setkeymsg0(&msg, SADB_FLUSH, $2, sizeof(msg));
- sendkeymsg((char *)&msg, sizeof(msg));
- }
- ;
-
- /* dump */
-dump_command
- : DUMP protocol_spec EOT
- {
- struct sadb_msg msg;
- setkeymsg0(&msg, SADB_DUMP, $2, sizeof(msg));
- sendkeymsg((char *)&msg, sizeof(msg));
- }
- ;
-
-protocol_spec
- : /*NOTHING*/
- {
- $$ = SADB_SATYPE_UNSPEC;
- }
- | PR_ESP
- {
- $$ = SADB_SATYPE_ESP;
- if ($1 == 1)
- p_ext |= SADB_X_EXT_OLD;
- else
- p_ext &= ~SADB_X_EXT_OLD;
- }
- | PR_AH
- {
- $$ = SADB_SATYPE_AH;
- if ($1 == 1)
- p_ext |= SADB_X_EXT_OLD;
- else
- p_ext &= ~SADB_X_EXT_OLD;
- }
- | PR_IPCOMP
- {
- $$ = SADB_X_SATYPE_IPCOMP;
- }
- | PR_TCP
- {
- $$ = SADB_X_SATYPE_TCPSIGNATURE;
- }
- ;
-
-spi
- : DECSTRING { p_spi = $1; }
- | HEXSTRING
- {
- char *ep;
- unsigned long v;
-
- ep = NULL;
- v = strtoul($1.buf, &ep, 16);
- if (!ep || *ep) {
- yyerror("invalid SPI");
- return -1;
- }
- if (v & ~0xffffffff) {
- yyerror("SPI too big.");
- return -1;
- }
-
- p_spi = v;
- }
- ;
-
-algorithm_spec
- : esp_spec
- | ah_spec
- | ipcomp_spec
- ;
-
-esp_spec
- : F_ENC enc_alg F_AUTH auth_alg
- | F_ENC enc_alg
- ;
-
-ah_spec
- : F_AUTH auth_alg
- ;
-
-ipcomp_spec
- : F_COMP ALG_COMP
- {
- if ($2 < 0) {
- yyerror("unsupported algorithm");
- return -1;
- }
- p_alg_enc = $2;
- }
- | F_COMP ALG_COMP F_RAWCPI
- {
- if ($2 < 0) {
- yyerror("unsupported algorithm");
- return -1;
- }
- p_alg_enc = $2;
- p_ext |= SADB_X_EXT_RAWCPI;
- }
- ;
-
-enc_alg
- : ALG_ENC_NOKEY {
- if ($1 < 0) {
- yyerror("unsupported algorithm");
- return -1;
- }
- p_alg_enc = $1;
-
- p_key_enc_len = 0;
- p_key_enc = NULL;
- if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT,
- p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) {
- yyerror(ipsec_strerror());
- return -1;
- }
- }
- | ALG_ENC key_string {
- if ($1 < 0) {
- yyerror("unsupported algorithm");
- return -1;
- }
- p_alg_enc = $1;
-
- p_key_enc_len = $2.len;
- p_key_enc = $2.buf;
- if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT,
- p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) {
- yyerror(ipsec_strerror());
- return -1;
- }
- }
- | ALG_ENC_OLD {
- if ($1 < 0) {
- yyerror("unsupported algorithm");
- return -1;
- }
- yyerror("WARNING: obsolete algorithm");
- p_alg_enc = $1;
-
- p_key_enc_len = 0;
- p_key_enc = NULL;
- if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT,
- p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) {
- yyerror(ipsec_strerror());
- return -1;
- }
- }
- | ALG_ENC_DESDERIV key_string
- {
- if ($1 < 0) {
- yyerror("unsupported algorithm");
- return -1;
- }
- p_alg_enc = $1;
- if (p_ext & SADB_X_EXT_OLD) {
- yyerror("algorithm mismatched");
- return -1;
- }
- p_ext |= SADB_X_EXT_DERIV;
-
- p_key_enc_len = $2.len;
- p_key_enc = $2.buf;
- if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT,
- p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) {
- yyerror(ipsec_strerror());
- return -1;
- }
- }
- | ALG_ENC_DES32IV key_string
- {
- if ($1 < 0) {
- yyerror("unsupported algorithm");
- return -1;
- }
- p_alg_enc = $1;
- if (!(p_ext & SADB_X_EXT_OLD)) {
- yyerror("algorithm mismatched");
- return -1;
- }
- p_ext |= SADB_X_EXT_IV4B;
-
- p_key_enc_len = $2.len;
- p_key_enc = $2.buf;
- if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT,
- p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len)) < 0) {
- yyerror(ipsec_strerror());
- return -1;
- }
- }
- ;
-
-auth_alg
- : ALG_AUTH key_string {
- if ($1 < 0) {
- yyerror("unsupported algorithm");
- return -1;
- }
- p_alg_auth = $1;
-
- p_key_auth_len = $2.len;
- p_key_auth = $2.buf;
-
- if (p_alg_auth == SADB_X_AALG_TCP_MD5) {
- if ((p_key_auth_len < 1) || (p_key_auth_len >
- 80))
- return -1;
- } else if (ipsec_check_keylen(SADB_EXT_SUPPORTED_AUTH,
- p_alg_auth, PFKEY_UNUNIT64(p_key_auth_len)) < 0) {
- yyerror(ipsec_strerror());
- return -1;
- }
- }
- | ALG_AUTH_NOKEY {
- if ($1 < 0) {
- yyerror("unsupported algorithm");
- return -1;
- }
- p_alg_auth = $1;
-
- p_key_auth_len = 0;
- p_key_auth = NULL;
- }
- ;
-
-key_string
- : QUOTEDSTRING
- {
- $$ = $1;
- }
- | HEXSTRING
- {
- caddr_t pp_key;
- caddr_t bp;
- caddr_t yp = $1.buf;
- int l;
-
- l = strlen(yp) % 2 + strlen(yp) / 2;
- if ((pp_key = malloc(l)) == 0) {
- yyerror("not enough core");
- return -1;
- }
- memset(pp_key, 0, l);
-
- bp = pp_key;
- if (strlen(yp) % 2) {
- *bp = ATOX(yp[0]);
- yp++, bp++;
- }
- while (*yp) {
- *bp = (ATOX(yp[0]) << 4) | ATOX(yp[1]);
- yp += 2, bp++;
- }
-
- $$.len = l;
- $$.buf = pp_key;
- }
- ;
-
-extension_spec
- : /*NOTHING*/
- | extension_spec extension
- ;
-
-extension
- : F_EXT EXTENSION { p_ext |= $2; }
- | F_EXT NOCYCLICSEQ { p_ext &= ~SADB_X_EXT_CYCSEQ; }
- | F_MODE MODE { p_mode = $2; }
- | F_MODE ANY { p_mode = IPSEC_MODE_ANY; }
- | F_REQID DECSTRING { p_reqid = $2; }
- | F_REPLAY DECSTRING
- {
- if ((p_ext & SADB_X_EXT_OLD) != 0) {
- yyerror("replay prevention cannot be used with "
- "ah/esp-old");
- return -1;
- }
- p_replay = $2;
- }
- | F_LIFETIME_HARD DECSTRING { p_lt_hard = $2; }
- | F_LIFETIME_SOFT DECSTRING { p_lt_soft = $2; }
- ;
-
- /* definition about command for SPD management */
- /* spdadd */
-spdadd_command
- : SPDADD ipaddropts STRING prefix portstr STRING prefix portstr upper_spec upper_misc_spec policy_spec EOT
- {
- int status;
- struct addrinfo *src, *dst;
-
- /* fixed port fields if ulp is icmpv6 */
- if ($10.buf != NULL) {
- if ($9 != IPPROTO_ICMPV6)
- return -1;
- free($5.buf);
- free($8.buf);
- if (fix_portstr(&$10, &$5, &$8))
- return -1;
- }
-
- src = parse_addr($3.buf, $5.buf);
- dst = parse_addr($6.buf, $8.buf);
- if (!src || !dst) {
- /* yyerror is already called */
- return -1;
- }
- if (src->ai_next || dst->ai_next) {
- yyerror("multiple address specified");
- freeaddrinfo(src);
- freeaddrinfo(dst);
- return -1;
- }
-
- status = setkeymsg_spdaddr(SADB_X_SPDADD, $9, &$11,
- src, $4, dst, $7);
- freeaddrinfo(src);
- freeaddrinfo(dst);
- if (status < 0)
- return -1;
- }
- | SPDADD TAGGED QUOTEDSTRING policy_spec EOT
- {
- return -1;
- }
- ;
-
-spddelete_command
- : SPDDELETE ipaddropts STRING prefix portstr STRING prefix portstr upper_spec upper_misc_spec policy_spec EOT
- {
- int status;
- struct addrinfo *src, *dst;
-
- /* fixed port fields if ulp is icmpv6 */
- if ($10.buf != NULL) {
- if ($9 != IPPROTO_ICMPV6)
- return -1;
- free($5.buf);
- free($8.buf);
- if (fix_portstr(&$10, &$5, &$8))
- return -1;
- }
-
- src = parse_addr($3.buf, $5.buf);
- dst = parse_addr($6.buf, $8.buf);
- if (!src || !dst) {
- /* yyerror is already called */
- return -1;
- }
- if (src->ai_next || dst->ai_next) {
- yyerror("multiple address specified");
- freeaddrinfo(src);
- freeaddrinfo(dst);
- return -1;
- }
-
- status = setkeymsg_spdaddr(SADB_X_SPDDELETE, $9, &$11,
- src, $4, dst, $7);
- freeaddrinfo(src);
- freeaddrinfo(dst);
- if (status < 0)
- return -1;
- }
- ;
-
-spddump_command:
- SPDDUMP EOT
- {
- struct sadb_msg msg;
- setkeymsg0(&msg, SADB_X_SPDDUMP, SADB_SATYPE_UNSPEC,
- sizeof(msg));
- sendkeymsg((char *)&msg, sizeof(msg));
- }
- ;
-
-spdflush_command:
- SPDFLUSH EOT
- {
- struct sadb_msg msg;
- setkeymsg0(&msg, SADB_X_SPDFLUSH, SADB_SATYPE_UNSPEC,
- sizeof(msg));
- sendkeymsg((char *)&msg, sizeof(msg));
- }
- ;
-
-ipaddropts
- : /* nothing */
- | ipaddropts ipaddropt
- ;
-
-ipaddropt
- : F_AIFLAGS
- {
- char *p;
-
- for (p = $1.buf + 1; *p; p++)
- switch (*p) {
- case '4':
- p_aifamily = AF_INET;
- break;
-#ifdef INET6
- case '6':
- p_aifamily = AF_INET6;
- break;
-#endif
- case 'n':
- p_aiflags = AI_NUMERICHOST;
- break;
- default:
- yyerror("invalid flag");
- return -1;
- }
- }
- ;
-
-ipaddr
- : STRING
- {
- $$ = parse_addr($1.buf, NULL);
- if ($$ == NULL) {
- /* yyerror already called by parse_addr */
- return -1;
- }
- }
- ;
-
-prefix
- : /*NOTHING*/ { $$ = -1; }
- | SLASH DECSTRING { $$ = $2; }
- ;
-
-portstr
- : /*NOTHING*/
- {
- $$.buf = strdup("0");
- if (!$$.buf) {
- yyerror("insufficient memory");
- return -1;
- }
- $$.len = strlen($$.buf);
- }
- | BLCL ANY ELCL
- {
- $$.buf = strdup("0");
- if (!$$.buf) {
- yyerror("insufficient memory");
- return -1;
- }
- $$.len = strlen($$.buf);
- }
- | BLCL DECSTRING ELCL
- {
- char buf[20];
- snprintf(buf, sizeof(buf), "%lu", $2);
- $$.buf = strdup(buf);
- if (!$$.buf) {
- yyerror("insufficient memory");
- return -1;
- }
- $$.len = strlen($$.buf);
- }
- | BLCL STRING ELCL
- {
- $$ = $2;
- }
- ;
-
-upper_spec
- : DECSTRING { $$ = $1; }
- | ANY { $$ = IPSEC_ULPROTO_ANY; }
- | PR_TCP { $$ = IPPROTO_TCP; }
- | STRING
- {
- struct protoent *ent;
-
- ent = getprotobyname($1.buf);
- if (ent)
- $$ = ent->p_proto;
- else {
- if (strcmp("icmp6", $1.buf) == 0) {
- $$ = IPPROTO_ICMPV6;
- } else if(strcmp("ip4", $1.buf) == 0) {
- $$ = IPPROTO_IPV4;
- } else {
- yyerror("invalid upper layer protocol");
- return -1;
- }
- }
- endprotoent();
- }
- ;
-
-upper_misc_spec
- : /*NOTHING*/
- {
- $$.buf = NULL;
- $$.len = 0;
- }
- | STRING
- {
- $$.buf = strdup($1.buf);
- if (!$$.buf) {
- yyerror("insufficient memory");
- return -1;
- }
- $$.len = strlen($$.buf);
- }
- ;
-
-policy_spec
- : F_POLICY policy_requests
- {
- char *policy;
-
- policy = ipsec_set_policy($2.buf, $2.len);
- if (policy == NULL) {
- yyerror(ipsec_strerror());
- return -1;
- }
-
- $$.buf = policy;
- $$.len = ipsec_get_policylen(policy);
- }
- ;
-
-policy_requests
- : PL_REQUESTS { $$ = $1; }
- ;
-
-%%
-
-int
-setkeymsg0(msg, type, satype, l)
- struct sadb_msg *msg;
- unsigned int type;
- unsigned int satype;
- size_t l;
-{
-
- msg->sadb_msg_version = PF_KEY_V2;
- msg->sadb_msg_type = type;
- msg->sadb_msg_errno = 0;
- msg->sadb_msg_satype = satype;
- msg->sadb_msg_reserved = 0;
- msg->sadb_msg_seq = 0;
- msg->sadb_msg_pid = getpid();
- msg->sadb_msg_len = PFKEY_UNIT64(l);
- return 0;
-}
-
-/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
-static int
-setkeymsg_spdaddr(type, upper, policy, srcs, splen, dsts, dplen)
- unsigned int type;
- unsigned int upper;
- vchar_t *policy;
- struct addrinfo *srcs;
- int splen;
- struct addrinfo *dsts;
- int dplen;
-{
- struct sadb_msg *msg;
- char buf[BUFSIZ];
- int l, l0;
- struct sadb_address m_addr;
- struct addrinfo *s, *d;
- int n;
- int plen;
- struct sockaddr *sa;
- int salen;
-
- msg = (struct sadb_msg *)buf;
-
- if (!srcs || !dsts)
- return -1;
-
- /* fix up length afterwards */
- setkeymsg0(msg, type, SADB_SATYPE_UNSPEC, 0);
- l = sizeof(struct sadb_msg);
-
- memcpy(buf + l, policy->buf, policy->len);
- l += policy->len;
-
- l0 = l;
- n = 0;
-
- /* do it for all src/dst pairs */
- for (s = srcs; s; s = s->ai_next) {
- for (d = dsts; d; d = d->ai_next) {
- /* rewind pointer */
- l = l0;
-
- if (s->ai_addr->sa_family != d->ai_addr->sa_family)
- continue;
- switch (s->ai_addr->sa_family) {
- case AF_INET:
- plen = sizeof(struct in_addr) << 3;
- break;
-#ifdef INET6
- case AF_INET6:
- plen = sizeof(struct in6_addr) << 3;
- break;
-#endif
- default:
- continue;
- }
-
- /* set src */
- sa = s->ai_addr;
- salen = s->ai_addr->sa_len;
- m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) +
- PFKEY_ALIGN8(salen));
- m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_SRC;
- m_addr.sadb_address_proto = upper;
- m_addr.sadb_address_prefixlen =
- (splen >= 0 ? splen : plen);
- m_addr.sadb_address_reserved = 0;
-
- setvarbuf(buf, &l, (struct sadb_ext *)&m_addr,
- sizeof(m_addr), (caddr_t)sa, salen);
-
- /* set dst */
- sa = d->ai_addr;
- salen = d->ai_addr->sa_len;
- m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) +
- PFKEY_ALIGN8(salen));
- m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_DST;
- m_addr.sadb_address_proto = upper;
- m_addr.sadb_address_prefixlen =
- (dplen >= 0 ? dplen : plen);
- m_addr.sadb_address_reserved = 0;
-
- setvarbuf(buf, &l, (struct sadb_ext *)&m_addr,
- sizeof(m_addr), (caddr_t)sa, salen);
-
- msg->sadb_msg_len = PFKEY_UNIT64(l);
-
- sendkeymsg(buf, l);
-
- n++;
- }
- }
-
- if (n == 0)
- return -1;
- else
- return 0;
-}
-
-/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
-static int
-setkeymsg_addr(type, satype, srcs, dsts, no_spi)
- unsigned int type;
- unsigned int satype;
- struct addrinfo *srcs;
- struct addrinfo *dsts;
- int no_spi;
-{
- struct sadb_msg *msg;
- char buf[BUFSIZ];
- int l, l0, len;
- struct sadb_sa m_sa;
- struct sadb_x_sa2 m_sa2;
- struct sadb_address m_addr;
- struct addrinfo *s, *d;
- int n;
- int plen;
- struct sockaddr *sa;
- int salen;
-
- msg = (struct sadb_msg *)buf;
-
- if (!srcs || !dsts)
- return -1;
-
- /* fix up length afterwards */
- setkeymsg0(msg, type, satype, 0);
- l = sizeof(struct sadb_msg);
-
- if (!no_spi) {
- len = sizeof(struct sadb_sa);
- m_sa.sadb_sa_len = PFKEY_UNIT64(len);
- m_sa.sadb_sa_exttype = SADB_EXT_SA;
- m_sa.sadb_sa_spi = htonl(p_spi);
- m_sa.sadb_sa_replay = p_replay;
- m_sa.sadb_sa_state = 0;
- m_sa.sadb_sa_auth = p_alg_auth;
- m_sa.sadb_sa_encrypt = p_alg_enc;
- m_sa.sadb_sa_flags = p_ext;
-
- memcpy(buf + l, &m_sa, len);
- l += len;
-
- len = sizeof(struct sadb_x_sa2);
- m_sa2.sadb_x_sa2_len = PFKEY_UNIT64(len);
- m_sa2.sadb_x_sa2_exttype = SADB_X_EXT_SA2;
- m_sa2.sadb_x_sa2_mode = p_mode;
- m_sa2.sadb_x_sa2_reqid = p_reqid;
-
- memcpy(buf + l, &m_sa2, len);
- l += len;
- }
-
- l0 = l;
- n = 0;
-
- /* do it for all src/dst pairs */
- for (s = srcs; s; s = s->ai_next) {
- for (d = dsts; d; d = d->ai_next) {
- /* rewind pointer */
- l = l0;
-
- if (s->ai_addr->sa_family != d->ai_addr->sa_family)
- continue;
- switch (s->ai_addr->sa_family) {
- case AF_INET:
- plen = sizeof(struct in_addr) << 3;
- break;
-#ifdef INET6
- case AF_INET6:
- plen = sizeof(struct in6_addr) << 3;
- break;
-#endif
- default:
- continue;
- }
-
- /* set src */
- sa = s->ai_addr;
- salen = s->ai_addr->sa_len;
- m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) +
- PFKEY_ALIGN8(salen));
- m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_SRC;
- m_addr.sadb_address_proto = IPSEC_ULPROTO_ANY;
- m_addr.sadb_address_prefixlen = plen;
- m_addr.sadb_address_reserved = 0;
-
- setvarbuf(buf, &l, (struct sadb_ext *)&m_addr,
- sizeof(m_addr), (caddr_t)sa, salen);
-
- /* set dst */
- sa = d->ai_addr;
- salen = d->ai_addr->sa_len;
- m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) +
- PFKEY_ALIGN8(salen));
- m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_DST;
- m_addr.sadb_address_proto = IPSEC_ULPROTO_ANY;
- m_addr.sadb_address_prefixlen = plen;
- m_addr.sadb_address_reserved = 0;
-
- setvarbuf(buf, &l, (struct sadb_ext *)&m_addr,
- sizeof(m_addr), (caddr_t)sa, salen);
-
- msg->sadb_msg_len = PFKEY_UNIT64(l);
-
- sendkeymsg(buf, l);
-
- n++;
- }
- }
-
- if (n == 0)
- return -1;
- else
- return 0;
-}
-
-/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
-static int
-setkeymsg_add(type, satype, srcs, dsts)
- unsigned int type;
- unsigned int satype;
- struct addrinfo *srcs;
- struct addrinfo *dsts;
-{
- struct sadb_msg *msg;
- char buf[BUFSIZ];
- int l, l0, len;
- struct sadb_sa m_sa;
- struct sadb_x_sa2 m_sa2;
- struct sadb_address m_addr;
- struct addrinfo *s, *d;
- int n;
- int plen;
- struct sockaddr *sa;
- int salen;
-
- msg = (struct sadb_msg *)buf;
-
- if (!srcs || !dsts)
- return -1;
-
- /* fix up length afterwards */
- setkeymsg0(msg, type, satype, 0);
- l = sizeof(struct sadb_msg);
-
- /* set encryption algorithm, if present. */
- if (satype != SADB_X_SATYPE_IPCOMP && p_key_enc) {
- struct sadb_key m_key;
-
- m_key.sadb_key_len =
- PFKEY_UNIT64(sizeof(m_key)
- + PFKEY_ALIGN8(p_key_enc_len));
- m_key.sadb_key_exttype = SADB_EXT_KEY_ENCRYPT;
- m_key.sadb_key_bits = p_key_enc_len * 8;
- m_key.sadb_key_reserved = 0;
-
- setvarbuf(buf, &l,
- (struct sadb_ext *)&m_key, sizeof(m_key),
- (caddr_t)p_key_enc, p_key_enc_len);
- }
-
- /* set authentication algorithm, if present. */
- if (p_key_auth) {
- struct sadb_key m_key;
-
- m_key.sadb_key_len =
- PFKEY_UNIT64(sizeof(m_key)
- + PFKEY_ALIGN8(p_key_auth_len));
- m_key.sadb_key_exttype = SADB_EXT_KEY_AUTH;
- m_key.sadb_key_bits = p_key_auth_len * 8;
- m_key.sadb_key_reserved = 0;
-
- setvarbuf(buf, &l,
- (struct sadb_ext *)&m_key, sizeof(m_key),
- (caddr_t)p_key_auth, p_key_auth_len);
- }
-
- /* set lifetime for HARD */
- if (p_lt_hard != 0) {
- struct sadb_lifetime m_lt;
- u_int slen = sizeof(struct sadb_lifetime);
-
- m_lt.sadb_lifetime_len = PFKEY_UNIT64(slen);
- m_lt.sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD;
- m_lt.sadb_lifetime_allocations = 0;
- m_lt.sadb_lifetime_bytes = 0;
- m_lt.sadb_lifetime_addtime = p_lt_hard;
- m_lt.sadb_lifetime_usetime = 0;
-
- memcpy(buf + l, &m_lt, slen);
- l += len;
- }
-
- /* set lifetime for SOFT */
- if (p_lt_soft != 0) {
- struct sadb_lifetime m_lt;
- u_int slen = sizeof(struct sadb_lifetime);
-
- m_lt.sadb_lifetime_len = PFKEY_UNIT64(slen);
- m_lt.sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT;
- m_lt.sadb_lifetime_allocations = 0;
- m_lt.sadb_lifetime_bytes = 0;
- m_lt.sadb_lifetime_addtime = p_lt_soft;
- m_lt.sadb_lifetime_usetime = 0;
-
- memcpy(buf + l, &m_lt, slen);
- l += len;
- }
-
- len = sizeof(struct sadb_sa);
- m_sa.sadb_sa_len = PFKEY_UNIT64(len);
- m_sa.sadb_sa_exttype = SADB_EXT_SA;
- m_sa.sadb_sa_spi = htonl(p_spi);
- m_sa.sadb_sa_replay = p_replay;
- m_sa.sadb_sa_state = 0;
- m_sa.sadb_sa_auth = p_alg_auth;
- m_sa.sadb_sa_encrypt = p_alg_enc;
- m_sa.sadb_sa_flags = p_ext;
-
- memcpy(buf + l, &m_sa, len);
- l += len;
-
- len = sizeof(struct sadb_x_sa2);
- m_sa2.sadb_x_sa2_len = PFKEY_UNIT64(len);
- m_sa2.sadb_x_sa2_exttype = SADB_X_EXT_SA2;
- m_sa2.sadb_x_sa2_mode = p_mode;
- m_sa2.sadb_x_sa2_reqid = p_reqid;
-
- memcpy(buf + l, &m_sa2, len);
- l += len;
-
- l0 = l;
- n = 0;
-
- /* do it for all src/dst pairs */
- for (s = srcs; s; s = s->ai_next) {
- for (d = dsts; d; d = d->ai_next) {
- /* rewind pointer */
- l = l0;
-
- if (s->ai_addr->sa_family != d->ai_addr->sa_family)
- continue;
- switch (s->ai_addr->sa_family) {
- case AF_INET:
- plen = sizeof(struct in_addr) << 3;
- break;
-#ifdef INET6
- case AF_INET6:
- plen = sizeof(struct in6_addr) << 3;
- break;
-#endif
- default:
- continue;
- }
-
- /* set src */
- sa = s->ai_addr;
- salen = s->ai_addr->sa_len;
- m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) +
- PFKEY_ALIGN8(salen));
- m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_SRC;
- m_addr.sadb_address_proto = IPSEC_ULPROTO_ANY;
- m_addr.sadb_address_prefixlen = plen;
- m_addr.sadb_address_reserved = 0;
-
- setvarbuf(buf, &l, (struct sadb_ext *)&m_addr,
- sizeof(m_addr), (caddr_t)sa, salen);
-
- /* set dst */
- sa = d->ai_addr;
- salen = d->ai_addr->sa_len;
- m_addr.sadb_address_len = PFKEY_UNIT64(sizeof(m_addr) +
- PFKEY_ALIGN8(salen));
- m_addr.sadb_address_exttype = SADB_EXT_ADDRESS_DST;
- m_addr.sadb_address_proto = IPSEC_ULPROTO_ANY;
- m_addr.sadb_address_prefixlen = plen;
- m_addr.sadb_address_reserved = 0;
-
- setvarbuf(buf, &l, (struct sadb_ext *)&m_addr,
- sizeof(m_addr), (caddr_t)sa, salen);
-
- msg->sadb_msg_len = PFKEY_UNIT64(l);
-
- sendkeymsg(buf, l);
-
- n++;
- }
- }
-
- if (n == 0)
- return -1;
- else
- return 0;
-}
-
-static struct addrinfo *
-parse_addr(host, port)
- char *host;
- char *port;
-{
- struct addrinfo hints, *res = NULL;
- int error;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = p_aifamily;
- hints.ai_socktype = SOCK_DGRAM; /*dummy*/
- hints.ai_protocol = IPPROTO_UDP; /*dummy*/
- hints.ai_flags = p_aiflags;
- error = getaddrinfo(host, port, &hints, &res);
- if (error != 0) {
- yyerror(gai_strerror(error));
- return NULL;
- }
- return res;
-}
-
-static int
-fix_portstr(spec, sport, dport)
- vchar_t *spec, *sport, *dport;
-{
- char *p, *p2;
- u_int l;
-
- l = 0;
- for (p = spec->buf; *p != ',' && *p != '\0' && l < spec->len; p++, l++)
- ;
- if (*p == '\0') {
- p2 = "0";
- } else {
- if (*p == ',') {
- *p = '\0';
- p2 = ++p;
- }
- for (p = p2; *p != '\0' && l < spec->len; p++, l++)
- ;
- if (*p != '\0' || *p2 == '\0') {
- yyerror("invalid an upper layer protocol spec");
- return -1;
- }
- }
-
- sport->buf = strdup(spec->buf);
- if (!sport->buf) {
- yyerror("insufficient memory");
- return -1;
- }
- sport->len = strlen(sport->buf);
- dport->buf = strdup(p2);
- if (!dport->buf) {
- yyerror("insufficient memory");
- return -1;
- }
- dport->len = strlen(dport->buf);
-
- return 0;
-}
-
-static int
-setvarbuf(buf, off, ebuf, elen, vbuf, vlen)
- char *buf;
- int *off;
- struct sadb_ext *ebuf;
- int elen;
- caddr_t vbuf;
- int vlen;
-{
- memset(buf + *off, 0, PFKEY_UNUNIT64(ebuf->sadb_ext_len));
- memcpy(buf + *off, (caddr_t)ebuf, elen);
- memcpy(buf + *off + elen, vbuf, vlen);
- (*off) += PFKEY_ALIGN8(elen + vlen);
-
- return 0;
-}
-
-void
-parse_init()
-{
- p_spi = 0;
-
- p_ext = SADB_X_EXT_CYCSEQ;
- p_alg_enc = SADB_EALG_NONE;
- p_alg_auth = SADB_AALG_NONE;
- p_mode = IPSEC_MODE_ANY;
- p_reqid = 0;
- p_replay = 0;
- p_key_enc_len = p_key_auth_len = 0;
- p_key_enc = p_key_auth = 0;
- p_lt_hard = p_lt_soft = 0;
-
- p_aiflags = 0;
- p_aifamily = PF_UNSPEC;
-
- return;
-}
-
-void
-free_buffer()
-{
- /* we got tons of memory leaks in the parser anyways, leave them */
-
- return;
-}
diff --git a/share/man/man4/spkr.4 b/share/man/man4/spkr.4
deleted file mode 100644
index fc0ed99..0000000
--- a/share/man/man4/spkr.4
+++ /dev/null
@@ -1,249 +0,0 @@
-.\"
-.\" $FreeBSD$
-.\"
-.Dd November 7, 1993
-.Dt SPKR 4 i386
-.Os
-.Sh NAME
-.Nm speaker ,
-.Nm spkr
-.Nd console speaker device driver
-.Sh SYNOPSIS
-.Cd device speaker
-.In machine/speaker.h
-.Sh DESCRIPTION
-The speaker device driver allows applications to control the PC console
-speaker on an
-.Tn IBM-PC Ns --compatible
-machine running
-.Fx .
-.Pp
-Only one process may have this device open at any given time;
-.Xr open 2
-and
-.Xr close 2
-are used to lock and relinquish it.
-An attempt to open when
-another process has the device locked will return -1 with an
-.Er EBUSY
-error
-indication.
-Writes to the device are interpreted as `play strings' in a
-simple ASCII melody notation.
-An
-.Xr ioctl 2
-request
-for tone generation at arbitrary
-frequencies is also supported.
-.Pp
-Sound-generation does not monopolize the processor; in fact, the driver
-spends most of its time sleeping while the PC hardware is emitting
-tones.
-Other processes may emit beeps while the driver is running.
-.Pp
-Applications may call
-.Xr ioctl 2
-on a speaker file descriptor to control the
-speaker driver directly; definitions for the
-.Xr ioctl 2
-interface are in
-.In machine/speaker.h .
-The
-.Li tone_t
-structure used in these calls has two fields,
-specifying a frequency (in Hz) and a duration (in 1/100ths of a second).
-A frequency of zero is interpreted as a rest.
-.Pp
-At present there are two such
-.Xr ioctl 2
-calls.
-.Dv SPKRTONE
-accepts a pointer to a
-single tone structure as third argument and plays it.
-.Dv SPKRTUNE
-accepts a
-pointer to the first of an array of tone structures and plays them in
-continuous sequence; this array must be terminated by a final member with
-a zero duration.
-.Pp
-The play-string language is modeled on the PLAY statement conventions of
-.Tn IBM
-Advanced BASIC 2.0.
-The
-.Li MB ,
-.Li MF ,
-and
-.Li X
-primitives of PLAY are not
-useful in a timesharing environment and are omitted.
-The `octave-tracking'
-feature and the slur mark are new.
-.Pp
-There are 84 accessible notes numbered 1-84 in 7 octaves, each running from
-C to B, numbered 0-6; the scale is equal-tempered A440 and octave 3 starts
-with middle C.
-By default, the play function emits half-second notes with the
-last 1/16th second being `rest time'.
-.Pp
-Play strings are interpreted left to right as a series of play command groups;
-letter case is ignored.
-Play command groups are as follows:
-.Bl -tag -width CDEFGABxx
-.It Li CDEFGAB
-Letters A through G cause the corresponding note to be played in the
-current octave.
-A note letter may optionally be followed by an
-.Dq Em "accidental sign" ,
-one of # + or -; the first two of these cause it to be sharped one
-half-tone, the last causes it to be flatted one half-tone.
-It may
-also be followed by a time value number and by sustain dots (see
-below).
-Time values are interpreted as for the L command below.
-.It Ns Li O Sy n
-If
-.Sy n
-is numeric, this sets the current octave.
-.Sy n
-may also be one of
-.Li L
-or
-.Li N
-to enable or disable octave-tracking (it is disabled by default).
-When octave-tracking is on, interpretation of a pair of letter notes
-will change octaves if necessary in order to make the smallest
-possible jump between notes.
-Thus ``olbc'' will be played as
-``olb>c'', and ``olcb'' as ``olc<b''.
-Octave locking is disabled for
-one letter note following >, < and O[0123456].
-(The octave-locking
-feature is not supported in
-.Tn IBM
-BASIC.)
-.It Li >
-Bump the current octave up one.
-.It Li <
-Drop the current octave down one.
-.It Ns Li N Sy n
-Play note
-.Sy n ,
-.Sy n
-being 1 to 84 or 0 for a rest of current time value.
-May be followed by sustain dots.
-.It Ns Li L Sy n
-Sets the current time value for notes.
-The default is
-.Li L4 ,
-quarter or crotchet notes.
-The lowest possible value is 1; values up
-to 64 are accepted.
-.Li L1
-sets whole notes,
-.Li L2
-sets half notes,
-.Li L4
-sets quarter notes, etc.
-.It Ns Li P Sy n
-Pause (rest), with
-.Sy n
-interpreted as for
-.Li L Sy n .
-May be followed by
-sustain dots.
-May also be written
-.Li ~ .
-.It Ns Li T Sy n
-Sets the number of quarter notes per minute; default is 120.
-Musical
-names for common tempi are:
-.Bd -literal -offset indent
- Tempo Beats Per Minute
-very slow Larghissimo
- Largo 40-60
- Larghetto 60-66
- Grave
- Lento
- Adagio 66-76
-slow Adagietto
- Andante 76-108
-medium Andantino
- Moderato 108-120
-fast Allegretto
- Allegro 120-168
- Vivace
- Veloce
- Presto 168-208
-very fast Prestissimo
-.Ed
-.It Li M[LNS]
-Set articulation.
-.Li MN
-.Li ( N
-for normal) is the default; the last 1/8th of
-the note's value is rest time.
-You can set
-.Li ML
-for legato (no rest space) or
-.Li MS
-for staccato (1/4 rest space).
-.El
-.Pp
-Notes (that is,
-.Li CDEFGAB
-or
-.Li N
-command character groups) may be followed by
-sustain dots.
-Each dot causes the note's value to be lengthened by one-half
-for each one.
-Thus, a note dotted once is held for 3/2 of its undotted value;
-dotted twice, it is held 9/4, and three times would give 27/8.
-.Pp
-A note and its sustain dots may also be followed by a slur mark (underscore).
-This causes the normal micro-rest after the note to be filled in, slurring it
-to the next one.
-(The slur feature is not supported in
-.Tn IBM
-BASIC.)
-.Pp
-Whitespace in play strings is simply skipped and may be used to separate
-melody sections.
-.Sh FILES
-.Bl -tag -width /dev/speakerxx
-.It Pa /dev/speaker
-speaker device file
-.El
-.Sh SEE ALSO
-.Xr spkrtest 8
-.Sh HISTORY
-The
-.Nm
-device appeared in
-.Fx 1.0 .
-.Sh AUTHORS
-.An Eric S. Raymond Aq esr@snark.thyrsus.com
-June 1990
-.Sh "PORTED BY"
-.An Andrew A. Chernov Aq ache@astral.msk.su
-.Sh BUGS
-Due to roundoff in the pitch tables and slop in the tone-generation and timer
-hardware (neither of which was designed for precision), neither pitch accuracy
-nor timings will be mathematically exact.
-There is no volume control.
-.Pp
-The action of two or more sustain dots does not reflect standard musical
-notation, in which each dot adds half the value of the previous dot
-modifier, not half the value of the note as modified.
-Thus, a note dotted
-once is held for 3/2 of its undotted value; dotted twice, it is held 7/4,
-and three times would give 15/8.
-The multiply-by-3/2 interpretation,
-however, is specified in the
-.Tn IBM
-BASIC manual and has been retained for
-compatibility.
-.Pp
-In play strings which are very long (longer than your system's physical I/O
-blocks) note suffixes or numbers may occasionally be parsed incorrectly due
-to crossing a block boundary.
diff --git a/share/man/man9/VOP_VPTOFH.9 b/share/man/man9/VOP_VPTOFH.9
deleted file mode 100644
index 4fa8916..0000000
--- a/share/man/man9/VOP_VPTOFH.9
+++ /dev/null
@@ -1,61 +0,0 @@
-.\" -*- nroff -*-
-.\"
-.\" Copyright (c) 1996 Doug Rabson
-.\"
-.\" All rights reserved.
-.\"
-.\" This program is free software.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 24, 1996
-.Os
-.Dt VFS_VPTOFH 9
-.Sh NAME
-.Nm VFS_VPTOFH
-.Nd turn a vnode into an NFS filehandle
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/mount.h
-.In sys/vnode.h
-.Ft int
-.Fn VFS_VPTOFH "struct vnode *vp" "struct fid *fhp"
-.Sh DESCRIPTION
-This is used by the NFS server to create an opaque filehandle which
-uniquely identifies the file and which can be used by an NFS client
-to access the file in the future.
-.Pp
-Its arguments are:
-.Bl -tag -width fhp
-.It Fa vp
-The vnode to make a filehandle for.
-.It Fa fhp
-Return parameter for the filehandle.
-.El
-.Sh SEE ALSO
-.Xr VFS 9 ,
-.Xr VFS_FHTOVP 9 ,
-.Xr vnode 9
-.Sh AUTHORS
-This manual page was written by
-.An Doug Rabson .
diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
deleted file mode 100644
index ed0ae93..0000000
--- a/sys/boot/i386/gptboot/Makefile
+++ /dev/null
@@ -1,103 +0,0 @@
-# $FreeBSD$
-
-FILES= boot boot1 boot2
-
-NM?= nm
-
-# A value of 0x80 enables LBA support.
-BOOT_BOOT1_FLAGS?= 0x80
-
-BOOT_COMCONSOLE_PORT?= 0x3f8
-BOOT_COMCONSOLE_SPEED?= 9600
-B2SIOFMT?= 0x3
-
-REL1= 0x700
-ORG1= 0x7c00
-ORG2= 0x2000
-
-# Decide level of UFS support.
-BOOT2_UFS?= UFS1_AND_UFS2
-#BOOT2_UFS?= UFS2_ONLY
-#BOOT2_UFS?= UFS1_ONLY
-
-CFLAGS= -Os \
- -fno-guess-branch-probability \
- -fomit-frame-pointer \
- -fno-unit-at-a-time \
- -mno-align-long-strings \
- -mrtd \
- -mno-mmx -mno-3dnow -mno-sse -mno-sse2 \
- -D${BOOT2_UFS} \
- -DFLAGS=${BOOT_BOOT1_FLAGS} \
- -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
- -DSIOFMT=${B2SIOFMT} \
- -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
- -I${.CURDIR}/../../common \
- -I${.CURDIR}/../btx/lib -I. \
- -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
- -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
- -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings
-
-LDFLAGS=-static -N --gc-sections
-
-# Pick up ../Makefile.inc early.
-.include <bsd.init.mk>
-
-CLEANFILES= boot
-
-boot: boot1 boot2
- cat boot1 boot2 > boot
-
-CLEANFILES+= boot1 boot1.out boot1.o
-
-boot1: boot1.out
- objcopy -S -O binary boot1.out ${.TARGET}
-
-boot1.out: boot1.o
- ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o
-
-CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \
- boot2.s boot2.s.tmp boot2.h sio.o
-
-boot2: boot2.ld
- @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \
- echo "$$x bytes available"; test $$x -ge 0
- dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync
-
-boot2.ld: boot2.ldr boot2.bin ${BTXKERN}
- btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \
- -o ${.TARGET} -P 1 boot2.bin
-
-boot2.ldr:
- dd if=/dev/zero of=${.TARGET} bs=276 count=1
-
-boot2.bin: boot2.out
- objcopy -S -O binary boot2.out ${.TARGET}
-
-boot2.out: ${BTXCRT} boot2.o sio.o
- ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
-
-boot2.o: boot2.s
-
-SRCS= boot2.c boot2.h
-
-boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c
- ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c
- sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s
- rm -f boot2.s.tmp
-
-boot2.h: boot1.out
- ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T xread/ \
- { x = $$1 - ORG1; \
- printf("#define XREADORG %#x\n", REL1 + x) }' \
- ORG1=`printf "%d" ${ORG1}` \
- REL1=`printf "%d" ${REL1}` > ${.TARGET}
-
-.if ${MACHINE_ARCH} == "amd64"
-beforedepend boot2.s: machine
-CLEANFILES+= machine
-machine:
- ln -sf ${.CURDIR}/../../../i386/include machine
-.endif
-
-.include <bsd.prog.mk>
diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c
deleted file mode 100644
index 6508dd6..0000000
--- a/sys/boot/i386/gptboot/gptboot.c
+++ /dev/null
@@ -1,654 +0,0 @@
-/*-
- * Copyright (c) 1998 Robert Nordier
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are freely
- * permitted provided that the above copyright notice and this
- * paragraph and the following disclaimer are duplicated in all
- * such forms.
- *
- * 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/disklabel.h>
-#include <sys/diskmbr.h>
-#include <sys/dirent.h>
-#include <sys/reboot.h>
-
-#include <machine/bootinfo.h>
-#include <machine/elf.h>
-
-#include <stdarg.h>
-
-#include <a.out.h>
-
-#include <btxv86.h>
-
-#include "boot2.h"
-#include "lib.h"
-
-#define IO_KEYBOARD 1
-#define IO_SERIAL 2
-
-#define SECOND 18 /* Circa that many ticks in a second. */
-
-#define RBX_ASKNAME 0x0 /* -a */
-#define RBX_SINGLE 0x1 /* -s */
-/* 0x2 is reserved for log2(RB_NOSYNC). */
-/* 0x3 is reserved for log2(RB_HALT). */
-/* 0x4 is reserved for log2(RB_INITNAME). */
-#define RBX_DFLTROOT 0x5 /* -r */
-#define RBX_KDB 0x6 /* -d */
-/* 0x7 is reserved for log2(RB_RDONLY). */
-/* 0x8 is reserved for log2(RB_DUMP). */
-/* 0x9 is reserved for log2(RB_MINIROOT). */
-#define RBX_CONFIG 0xa /* -c */
-#define RBX_VERBOSE 0xb /* -v */
-#define RBX_SERIAL 0xc /* -h */
-#define RBX_CDROM 0xd /* -C */
-/* 0xe is reserved for log2(RB_POWEROFF). */
-#define RBX_GDB 0xf /* -g */
-#define RBX_MUTE 0x10 /* -m */
-/* 0x11 is reserved for log2(RB_SELFTEST). */
-/* 0x12 is reserved for boot programs. */
-/* 0x13 is reserved for boot programs. */
-#define RBX_PAUSE 0x14 /* -p */
-#define RBX_NOINTR 0x1c /* -n */
-/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
-#define RBX_DUAL 0x1d /* -D */
-#define RBX_PROBEKBD 0x1e /* -P */
-/* 0x1f is reserved for log2(RB_BOOTINFO). */
-
-/* pass: -a, -s, -r, -d, -c, -v, -h, -C, -g, -m, -p, -D */
-#define RBX_MASK 0x2005ffff
-
-#define PATH_CONFIG "/boot.config"
-#define PATH_BOOT3 "/boot/loader"
-#define PATH_KERNEL "/kernel"
-
-#define ARGS 0x900
-#define NOPT 12
-#define NDEV 3
-#define MEM_BASE 0x12
-#define MEM_EXT 0x15
-#define V86_CY(x) ((x) & 1)
-#define V86_ZR(x) ((x) & 0x40)
-
-#define DRV_HARD 0x80
-#define DRV_MASK 0x7f
-
-#define TYPE_AD 0
-#define TYPE_DA 1
-#define TYPE_MAXHARD TYPE_DA
-#define TYPE_FD 2
-
-extern uint32_t _end;
-
-static const char optstr[NOPT] = "DhaCgmnPprsv";
-static const unsigned char flags[NOPT] = {
- RBX_DUAL,
- RBX_SERIAL,
- RBX_ASKNAME,
- RBX_CDROM,
- RBX_GDB,
- RBX_MUTE,
- RBX_NOINTR,
- RBX_PROBEKBD,
- RBX_PAUSE,
- RBX_DFLTROOT,
- RBX_SINGLE,
- RBX_VERBOSE
-};
-
-static const char *const dev_nm[NDEV] = {"ad", "da", "fd"};
-static const unsigned char dev_maj[NDEV] = {30, 4, 2};
-
-static struct dsk {
- unsigned drive;
- unsigned type;
- unsigned unit;
- unsigned slice;
- unsigned part;
- unsigned start;
- int init;
-} dsk;
-static char cmd[512];
-static char kname[1024];
-static uint32_t opts;
-static struct bootinfo bootinfo;
-static uint8_t ioctrl = IO_KEYBOARD;
-
-void exit(int);
-static void load(void);
-static int parse(void);
-static int xfsread(ino_t, void *, size_t);
-static int dskread(void *, unsigned, unsigned);
-static void printf(const char *,...);
-static void putchar(int);
-static uint32_t memsize(void);
-static int drvread(void *, unsigned, unsigned);
-static int keyhit(unsigned);
-static int xputc(int);
-static int xgetc(int);
-static int getc(int);
-
-static void memcpy(void *, const void *, int);
-static void
-memcpy(void *dst, const void *src, int len)
-{
- const char *s = src;
- char *d = dst;
-
- while (len--)
- *d++ = *s++;
-}
-
-static inline int
-strcmp(const char *s1, const char *s2)
-{
- for (; *s1 == *s2 && *s1; s1++, s2++);
- return (unsigned char)*s1 - (unsigned char)*s2;
-}
-
-#include "ufsread.c"
-
-static int
-xfsread(ino_t inode, void *buf, size_t nbyte)
-{
- if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
- printf("Invalid %s\n", "format");
- return -1;
- }
- return 0;
-}
-
-static inline uint32_t
-memsize(void)
-{
- v86.addr = MEM_EXT;
- v86.eax = 0x8800;
- v86int();
- return v86.eax;
-}
-
-static inline void
-getstr(void)
-{
- char *s;
- int c;
-
- s = cmd;
- for (;;) {
- switch (c = xgetc(0)) {
- case 0:
- break;
- case '\177':
- case '\b':
- if (s > cmd) {
- s--;
- printf("\b \b");
- }
- break;
- case '\n':
- case '\r':
- *s = 0;
- return;
- default:
- if (s - cmd < sizeof(cmd) - 1)
- *s++ = c;
- putchar(c);
- }
- }
-}
-
-static inline void
-putc(int c)
-{
- v86.addr = 0x10;
- v86.eax = 0xe00 | (c & 0xff);
- v86.ebx = 0x7;
- v86int();
-}
-
-int
-main(void)
-{
- int autoboot;
- ino_t ino;
-
- dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
- v86.ctl = V86_FLAGS;
- dsk.drive = *(uint8_t *)PTOV(ARGS);
- dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD;
- dsk.unit = dsk.drive & DRV_MASK;
- dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1;
- bootinfo.bi_version = BOOTINFO_VERSION;
- bootinfo.bi_size = sizeof(bootinfo);
- bootinfo.bi_basemem = 0; /* XXX will be filled by loader or kernel */
- bootinfo.bi_extmem = memsize();
- bootinfo.bi_memsizes_valid++;
-
- /* Process configuration file */
-
- autoboot = 1;
-
- if ((ino = lookup(PATH_CONFIG)))
- fsread(ino, cmd, sizeof(cmd));
-
- if (*cmd) {
- if (parse())
- autoboot = 0;
- printf("%s: %s", PATH_CONFIG, cmd);
- /* Do not process this command twice */
- *cmd = 0;
- }
-
- /*
- * Try to exec stage 3 boot loader. If interrupted by a keypress,
- * or in case of failure, try to load a kernel directly instead.
- */
-
- if (autoboot && !*kname) {
- memcpy(kname, PATH_BOOT3, sizeof(PATH_BOOT3));
- if (!keyhit(3*SECOND)) {
- load();
- memcpy(kname, PATH_KERNEL, sizeof(PATH_KERNEL));
- }
- }
-
- /* Present the user with the boot2 prompt. */
-
- for (;;) {
- printf("\nFreeBSD/i386 boot\n"
- "Default: %u:%s(%u,%c)%s\n"
- "boot: ",
- dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit,
- 'a' + dsk.part, kname);
- if (ioctrl & IO_SERIAL)
- sio_flush();
- if (!autoboot || keyhit(5*SECOND))
- getstr();
- else
- putchar('\n');
- autoboot = 0;
- if (parse())
- putchar('\a');
- else
- load();
- }
-}
-
-/* XXX - Needed for btxld to link the boot2 binary; do not remove. */
-void
-exit(int x)
-{
-}
-
-static void
-load(void)
-{
- union {
- struct exec ex;
- Elf32_Ehdr eh;
- } hdr;
- Elf32_Phdr ep[2];
- Elf32_Shdr es[2];
- caddr_t p;
- ino_t ino;
- uint32_t addr, x;
- int fmt, i, j;
-
- if (!(ino = lookup(kname))) {
- if (!ls)
- printf("No %s\n", kname);
- return;
- }
- if (xfsread(ino, &hdr, sizeof(hdr)))
- return;
- if (N_GETMAGIC(hdr.ex) == ZMAGIC)
- fmt = 0;
- else if (IS_ELF(hdr.eh))
- fmt = 1;
- else {
- printf("Invalid %s\n", "format");
- return;
- }
- if (fmt == 0) {
- addr = hdr.ex.a_entry;
- p = PTOV(addr);
- fs_off = PAGE_SIZE;
- if (xfsread(ino, p, hdr.ex.a_text))
- return;
- p += roundup2(hdr.ex.a_text, PAGE_SIZE);
- if (xfsread(ino, p, hdr.ex.a_data))
- return;
- p += hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE);
- bootinfo.bi_symtab = VTOP(p);
- memcpy(p, &hdr.ex.a_syms, sizeof(hdr.ex.a_syms));
- p += sizeof(hdr.ex.a_syms);
- if (hdr.ex.a_syms) {
- if (xfsread(ino, p, hdr.ex.a_syms))
- return;
- p += hdr.ex.a_syms;
- if (xfsread(ino, p, sizeof(int)))
- return;
- x = *(uint32_t *)p;
- p += sizeof(int);
- x -= sizeof(int);
- if (xfsread(ino, p, x))
- return;
- p += x;
- }
- } else {
- fs_off = hdr.eh.e_phoff;
- for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) {
- if (xfsread(ino, ep + j, sizeof(ep[0])))
- return;
- if (ep[j].p_type == PT_LOAD)
- j++;
- }
- for (i = 0; i < 2; i++) {
- p = PTOV(ep[i].p_paddr);
- fs_off = ep[i].p_offset;
- if (xfsread(ino, p, ep[i].p_filesz))
- return;
- }
- p += roundup2(ep[1].p_memsz, PAGE_SIZE);
- bootinfo.bi_symtab = VTOP(p);
- if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) {
- fs_off = hdr.eh.e_shoff + sizeof(es[0]) *
- (hdr.eh.e_shstrndx + 1);
- if (xfsread(ino, &es, sizeof(es)))
- return;
- for (i = 0; i < 2; i++) {
- memcpy(p, &es[i].sh_size, sizeof(es[i].sh_size));
- p += sizeof(es[i].sh_size);
- fs_off = es[i].sh_offset;
- if (xfsread(ino, p, es[i].sh_size))
- return;
- p += es[i].sh_size;
- }
- }
- addr = hdr.eh.e_entry;
- }
- bootinfo.bi_esymtab = VTOP(p);
- bootinfo.bi_kernelname = VTOP(kname);
- bootinfo.bi_bios_dev = dsk.drive;
- __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK),
- MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part),
- 0, 0, 0, VTOP(&bootinfo));
-}
-
-static int
-parse()
-{
- char *arg = cmd;
- char *p, *q;
- unsigned int drv;
- int c, i;
-
- while ((c = *arg++)) {
- if (c == ' ' || c == '\t' || c == '\n')
- continue;
- for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++);
- if (*p)
- *p++ = 0;
- if (c == '-') {
- while ((c = *arg++)) {
- for (i = 0; c != optstr[i]; i++)
- if (i == NOPT - 1)
- return -1;
- opts ^= 1 << flags[i];
- }
- if (opts & 1 << RBX_PROBEKBD) {
- i = *(uint8_t *)PTOV(0x496) & 0x10;
- printf("Keyboard: %s\n", i ? "yes" : "no");
- if (!i)
- opts |= 1 << RBX_DUAL | 1 << RBX_SERIAL;
- opts &= ~(1 << RBX_PROBEKBD);
- }
- ioctrl = opts & 1 << RBX_DUAL ? (IO_SERIAL|IO_KEYBOARD) :
- opts & 1 << RBX_SERIAL ? IO_SERIAL : IO_KEYBOARD;
- if (ioctrl & IO_SERIAL)
- sio_init();
- } else {
- for (q = arg--; *q && *q != '('; q++);
- if (*q) {
- drv = -1;
- if (arg[1] == ':') {
- drv = *arg - '0';
- if (drv > 9)
- return (-1);
- arg += 2;
- }
- if (q - arg != 2)
- return -1;
- for (i = 0; arg[0] != dev_nm[i][0] ||
- arg[1] != dev_nm[i][1]; i++)
- if (i == NDEV - 1)
- return -1;
- dsk.type = i;
- arg += 3;
- dsk.unit = *arg - '0';
- if (arg[1] != ',' || dsk.unit > 9)
- return -1;
- arg += 2;
- dsk.slice = WHOLE_DISK_SLICE;
- if (arg[1] == ',') {
- dsk.slice = *arg - '0' + 1;
- if (dsk.slice > NDOSPART)
- return -1;
- arg += 2;
- }
- if (arg[1] != ')')
- return -1;
- dsk.part = *arg - 'a';
- if (dsk.part > 7)
- return (-1);
- arg += 2;
- if (drv == -1)
- drv = dsk.unit;
- dsk.drive = (dsk.type <= TYPE_MAXHARD
- ? DRV_HARD : 0) + drv;
- dsk_meta = 0;
- }
- if ((i = p - arg - !*(p - 1))) {
- if ((size_t)i >= sizeof(kname))
- return -1;
- memcpy(kname, arg, i + 1);
- }
- }
- arg = p;
- }
- return 0;
-}
-
-static int
-dskread(void *buf, unsigned lba, unsigned nblk)
-{
- struct dos_partition *dp;
- struct disklabel *d;
- char *sec;
- unsigned sl, i;
-
- if (!dsk_meta) {
- sec = dmadat->secbuf;
- dsk.start = 0;
- if (drvread(sec, DOSBBSECTOR, 1))
- return -1;
- dp = (void *)(sec + DOSPARTOFF);
- sl = dsk.slice;
- if (sl < BASE_SLICE) {
- for (i = 0; i < NDOSPART; i++)
- if (dp[i].dp_typ == DOSPTYP_386BSD &&
- (dp[i].dp_flag & 0x80 || sl < BASE_SLICE)) {
- sl = BASE_SLICE + i;
- if (dp[i].dp_flag & 0x80 ||
- dsk.slice == COMPATIBILITY_SLICE)
- break;
- }
- if (dsk.slice == WHOLE_DISK_SLICE)
- dsk.slice = sl;
- }
- if (sl != WHOLE_DISK_SLICE) {
- if (sl != COMPATIBILITY_SLICE)
- dp += sl - BASE_SLICE;
- if (dp->dp_typ != DOSPTYP_386BSD) {
- printf("Invalid %s\n", "slice");
- return -1;
- }
- dsk.start = dp->dp_start;
- }
- if (drvread(sec, dsk.start + LABELSECTOR, 1))
- return -1;
- d = (void *)(sec + LABELOFFSET);
- if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) {
- if (dsk.part != RAW_PART) {
- printf("Invalid %s\n", "label");
- return -1;
- }
- } else {
- if (!dsk.init) {
- if (d->d_type == DTYPE_SCSI)
- dsk.type = TYPE_DA;
- dsk.init++;
- }
- if (dsk.part >= d->d_npartitions ||
- !d->d_partitions[dsk.part].p_size) {
- printf("Invalid %s\n", "partition");
- return -1;
- }
- dsk.start += d->d_partitions[dsk.part].p_offset;
- dsk.start -= d->d_partitions[RAW_PART].p_offset;
- }
- }
- return drvread(buf, dsk.start + lba, nblk);
-}
-
-static void
-printf(const char *fmt,...)
-{
- va_list ap;
- char buf[10];
- char *s;
- unsigned u;
- int c;
-
- va_start(ap, fmt);
- while ((c = *fmt++)) {
- if (c == '%') {
- c = *fmt++;
- switch (c) {
- case 'c':
- putchar(va_arg(ap, int));
- continue;
- case 's':
- for (s = va_arg(ap, char *); *s; s++)
- putchar(*s);
- continue;
- case 'u':
- u = va_arg(ap, unsigned);
- s = buf;
- do
- *s++ = '0' + u % 10U;
- while (u /= 10U);
- while (--s >= buf)
- putchar(*s);
- continue;
- }
- }
- putchar(c);
- }
- va_end(ap);
- return;
-}
-
-static void
-putchar(int c)
-{
- if (c == '\n')
- xputc('\r');
- xputc(c);
-}
-
-static int
-drvread(void *buf, unsigned lba, unsigned nblk)
-{
- static unsigned c = 0x2d5c7c2f;
-
- printf("%c\b", c = c << 8 | c >> 24);
- v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS;
- v86.addr = XREADORG; /* call to xread in boot1 */
- v86.es = VTOPSEG(buf);
- v86.eax = lba;
- v86.ebx = VTOPOFF(buf);
- v86.ecx = lba >> 16;
- v86.edx = nblk << 8 | dsk.drive;
- v86int();
- v86.ctl = V86_FLAGS;
- if (V86_CY(v86.efl)) {
- printf("error %u lba %u\n", v86.eax >> 8 & 0xff, lba);
- return -1;
- }
- return 0;
-}
-
-static int
-keyhit(unsigned ticks)
-{
- uint32_t t0, t1;
-
- if (opts & 1 << RBX_NOINTR)
- return 0;
- t0 = 0;
- for (;;) {
- if (xgetc(1))
- return 1;
- t1 = *(uint32_t *)PTOV(0x46c);
- if (!t0)
- t0 = t1;
- if (t1 < t0 || t1 >= t0 + ticks)
- return 0;
- }
-}
-
-static int
-xputc(int c)
-{
- if (ioctrl & IO_KEYBOARD)
- putc(c);
- if (ioctrl & IO_SERIAL)
- sio_putc(c);
- return c;
-}
-
-static int
-xgetc(int fn)
-{
- if (opts & 1 << RBX_NOINTR)
- return 0;
- for (;;) {
- if (ioctrl & IO_KEYBOARD && getc(1))
- return fn ? 1 : getc(0);
- if (ioctrl & IO_SERIAL && sio_ischar())
- return fn ? 1 : sio_getc();
- if (fn)
- return 0;
- }
-}
-
-static int
-getc(int fn)
-{
- v86.addr = 0x16;
- v86.eax = fn << 8;
- v86int();
- return fn == 0 ? v86.eax & 0xff : !V86_ZR(v86.efl);
-}
diff --git a/sys/boot/ia64/common/bootinfo.c b/sys/boot/ia64/common/bootinfo.c
deleted file mode 100644
index 44fde46..0000000
--- a/sys/boot/ia64/common/bootinfo.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*-
- * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stand.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/linker.h>
-#include <machine/elf.h>
-#include <machine/bootinfo.h>
-
-#include <efi.h>
-#include <efilib.h>
-
-#include "bootstrap.h"
-
-static EFI_GUID hcdp = HCDP_TABLE_GUID;
-
-/*
- * Return a 'boothowto' value corresponding to the kernel arguments in
- * (kargs) and any relevant environment variables.
- */
-static struct
-{
- const char *ev;
- int mask;
-} howto_names[] = {
- {"boot_askname", RB_ASKNAME},
- {"boot_cdrom", RB_CDROM},
- {"boot_ddb", RB_KDB},
- {"boot_gdb", RB_GDB},
- {"boot_single", RB_SINGLE},
- {"boot_verbose", RB_VERBOSE},
- {"boot_multicons", RB_MULTIPLE},
- {"boot_serial", RB_SERIAL},
- {NULL, 0}
-};
-
-extern char *efi_fmtdev(void *vdev);
-
-int
-bi_getboothowto(char *kargs)
-{
- char *cp;
- int howto;
- int active;
- int i;
-
- /* Parse kargs */
- howto = 0;
- if (kargs != NULL) {
- cp = kargs;
- active = 0;
- while (*cp != 0) {
- if (!active && (*cp == '-')) {
- active = 1;
- } else if (active)
- switch (*cp) {
- case 'a':
- howto |= RB_ASKNAME;
- break;
- case 'C':
- howto |= RB_CDROM;
- break;
- case 'd':
- howto |= RB_KDB;
- break;
- case 'D':
- howto |= RB_MULTIPLE;
- break;
- case 'm':
- howto |= RB_MUTE;
- break;
- case 'g':
- howto |= RB_GDB;
- break;
- case 'h':
- howto |= RB_SERIAL;
- break;
- case 'r':
- howto |= RB_DFLTROOT;
- break;
- case 's':
- howto |= RB_SINGLE;
- break;
- case 'v':
- howto |= RB_VERBOSE;
- break;
- default:
- active = 0;
- break;
- }
- cp++;
- }
- }
- /* get equivalents from the environment */
- for (i = 0; howto_names[i].ev != NULL; i++)
- if (getenv(howto_names[i].ev) != NULL)
- howto |= howto_names[i].mask;
- if (!strcmp(getenv("console"), "comconsole"))
- howto |= RB_SERIAL;
- if (!strcmp(getenv("console"), "nullconsole"))
- howto |= RB_MUTE;
- return(howto);
-}
-
-/*
- * Copy the environment into the load area starting at (addr).
- * Each variable is formatted as <name>=<value>, with a single nul
- * separating each variable, and a double nul terminating the environment.
- */
-vm_offset_t
-bi_copyenv(vm_offset_t addr)
-{
- struct env_var *ep;
-
- /* traverse the environment */
- for (ep = environ; ep != NULL; ep = ep->ev_next) {
- efi_copyin(ep->ev_name, addr, strlen(ep->ev_name));
- addr += strlen(ep->ev_name);
- efi_copyin("=", addr, 1);
- addr++;
- if (ep->ev_value != NULL) {
- efi_copyin(ep->ev_value, addr, strlen(ep->ev_value));
- addr += strlen(ep->ev_value);
- }
- efi_copyin("", addr, 1);
- addr++;
- }
- efi_copyin("", addr, 1);
- addr++;
- return(addr);
-}
-
-/*
- * Copy module-related data into the load area, where it can be
- * used as a directory for loaded modules.
- *
- * Module data is presented in a self-describing format. Each datum
- * is preceded by a 32-bit identifier and a 32-bit size field.
- *
- * Currently, the following data are saved:
- *
- * MOD_NAME (variable) module name (string)
- * MOD_TYPE (variable) module type (string)
- * MOD_ARGS (variable) module parameters (string)
- * MOD_ADDR sizeof(vm_offset_t) module load address
- * MOD_SIZE sizeof(size_t) module size
- * MOD_METADATA (variable) type-specific metadata
- */
-#define COPY32(v, a) { \
- u_int32_t x = (v); \
- efi_copyin(&x, a, sizeof(x)); \
- a += sizeof(x); \
-}
-
-#define MOD_STR(t, a, s) { \
- COPY32(t, a); \
- COPY32(strlen(s) + 1, a); \
- efi_copyin(s, a, strlen(s) + 1); \
- a += roundup(strlen(s) + 1, sizeof(u_int64_t));\
-}
-
-#define MOD_NAME(a, s) MOD_STR(MODINFO_NAME, a, s)
-#define MOD_TYPE(a, s) MOD_STR(MODINFO_TYPE, a, s)
-#define MOD_ARGS(a, s) MOD_STR(MODINFO_ARGS, a, s)
-
-#define MOD_VAR(t, a, s) { \
- COPY32(t, a); \
- COPY32(sizeof(s), a); \
- efi_copyin(&s, a, sizeof(s)); \
- a += roundup(sizeof(s), sizeof(u_int64_t)); \
-}
-
-#define MOD_ADDR(a, s) MOD_VAR(MODINFO_ADDR, a, s)
-#define MOD_SIZE(a, s) MOD_VAR(MODINFO_SIZE, a, s)
-
-#define MOD_METADATA(a, mm) { \
- COPY32(MODINFO_METADATA | mm->md_type, a); \
- COPY32(mm->md_size, a); \
- efi_copyin(mm->md_data, a, mm->md_size); \
- a += roundup(mm->md_size, sizeof(u_int64_t));\
-}
-
-#define MOD_END(a) { \
- COPY32(MODINFO_END, a); \
- COPY32(0, a); \
-}
-
-vm_offset_t
-bi_copymodules(vm_offset_t addr)
-{
- struct preloaded_file *fp;
- struct file_metadata *md;
-
- /* start with the first module on the list, should be the kernel */
- for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) {
-
- MOD_NAME(addr, fp->f_name); /* this field must come first */
- MOD_TYPE(addr, fp->f_type);
- if (fp->f_args)
- MOD_ARGS(addr, fp->f_args);
- MOD_ADDR(addr, fp->f_addr);
- MOD_SIZE(addr, fp->f_size);
- for (md = fp->f_metadata; md != NULL; md = md->md_next)
- if (!(md->md_type & MODINFOMD_NOCOPY))
- MOD_METADATA(addr, md);
- }
- MOD_END(addr);
- return(addr);
-}
-
-/*
- * Load the information expected by an alpha kernel.
- *
- * - The kernel environment is copied into kernel space.
- * - Module metadata are formatted and placed in kernel space.
- */
-int
-bi_load(struct bootinfo *bi, struct preloaded_file *fp, UINTN *mapkey,
- UINTN pages)
-{
- char *rootdevname;
- struct efi_devdesc *rootdev;
- struct preloaded_file *xp;
- vm_offset_t addr, bootinfo_addr;
- vm_offset_t ssym, esym;
- struct file_metadata *md;
- EFI_STATUS status;
- UINTN bisz, key;
-
- /*
- * Version 1 bootinfo.
- */
- bi->bi_magic = BOOTINFO_MAGIC;
- bi->bi_version = 1;
-
- /*
- * Calculate boothowto.
- */
- bi->bi_boothowto = bi_getboothowto(fp->f_args);
-
- /*
- * Stash EFI System Table.
- */
- bi->bi_systab = (u_int64_t) ST;
-
- /*
- * Allow the environment variable 'rootdev' to override the supplied
- * device. This should perhaps go to MI code and/or have $rootdev
- * tested/set by MI code before launching the kernel.
- */
- rootdevname = getenv("rootdev");
- efi_getdev((void **)(&rootdev), rootdevname, NULL);
- if (rootdev == NULL) { /* bad $rootdev/$currdev */
- printf("can't determine root device\n");
- return(EINVAL);
- }
-
- /* Try reading the /etc/fstab file to select the root device */
- getrootmount(efi_fmtdev((void *)rootdev));
- free(rootdev);
-
- ssym = esym = 0;
- if ((md = file_findmetadata(fp, MODINFOMD_SSYM)) != NULL)
- ssym = *((vm_offset_t *)&(md->md_data));
- if ((md = file_findmetadata(fp, MODINFOMD_ESYM)) != NULL)
- esym = *((vm_offset_t *)&(md->md_data));
- if (ssym == 0 || esym == 0)
- ssym = esym = 0; /* sanity */
-
- bi->bi_symtab = ssym;
- bi->bi_esymtab = esym;
-
- bi->bi_hcdp = (uint64_t)efi_get_table(&hcdp); /* DIG64 HCDP table addr. */
- fpswa_init(&bi->bi_fpswa); /* find FPSWA interface */
-
- /* find the last module in the chain */
- addr = 0;
- for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
- if (addr < (xp->f_addr + xp->f_size))
- addr = xp->f_addr + xp->f_size;
- }
-
- /* pad to a page boundary */
- addr = (addr + PAGE_MASK) & ~PAGE_MASK;
-
- /* copy our environment */
- bi->bi_envp = addr;
- addr = bi_copyenv(addr);
-
- /* pad to a page boundary */
- addr = (addr + PAGE_MASK) & ~PAGE_MASK;
-
- /* copy module list and metadata */
- bi->bi_modulep = addr;
- addr = bi_copymodules(addr);
-
- /* all done copying stuff in, save end of loaded object space */
- bi->bi_kernend = addr;
-
- /*
- * Read the memory map and stash it after bootinfo. Align the memory map
- * on a 16-byte boundary (the bootinfo block is page aligned).
- */
- bisz = (sizeof(struct bootinfo) + 0x0f) & ~0x0f;
- bi->bi_memmap = ((u_int64_t)bi) + bisz;
- bi->bi_memmap_size = EFI_PAGE_SIZE * pages - bisz;
- status = BS->GetMemoryMap(&bi->bi_memmap_size,
- (EFI_MEMORY_DESCRIPTOR *)bi->bi_memmap, &key,
- &bi->bi_memdesc_size, &bi->bi_memdesc_version);
- if (EFI_ERROR(status)) {
- printf("bi_load: Can't read memory map\n");
- return EINVAL;
- }
- *mapkey = key;
-
- return(0);
-}
diff --git a/sys/boot/ia64/common/copy.c b/sys/boot/ia64/common/copy.c
deleted file mode 100644
index 4b4b9bd..0000000
--- a/sys/boot/ia64/common/copy.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <efi.h>
-#include <efilib.h>
-#include <stand.h>
-
-int
-efi_copyin(void *src, vm_offset_t va, size_t len)
-{
-
- bcopy(src, (void *)efimd_va2pa(va), len);
- return (len);
-}
-
-int
-efi_copyout(vm_offset_t va, void *dst, size_t len)
-{
-
- bcopy((void *)efimd_va2pa(va), dst, len);
- return (len);
-}
-
-int
-efi_readin(int fd, vm_offset_t va, size_t len)
-{
-
- return (read(fd, (void *)efimd_va2pa(va), len));
-}
diff --git a/sys/boot/ia64/common/devicename.c b/sys/boot/ia64/common/devicename.c
deleted file mode 100644
index d9f5275..0000000
--- a/sys/boot/ia64/common/devicename.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*-
- * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stand.h>
-#include <string.h>
-#include <sys/disklabel.h>
-#include "bootstrap.h"
-
-#include <efi.h>
-#include <efilib.h>
-#include "efiboot.h"
-
-static int efi_parsedev(struct efi_devdesc **dev, const char *devspec, const char **path);
-
-/*
- * Point (dev) at an allocated device specifier for the device matching the
- * path in (devspec). If it contains an explicit device specification,
- * use that. If not, use the default device.
- */
-int
-efi_getdev(void **vdev, const char *devspec, const char **path)
-{
- struct efi_devdesc **dev = (struct efi_devdesc **)vdev;
- int rv;
-
- /*
- * If it looks like this is just a path and no
- * device, go with the current device.
- */
- if ((devspec == NULL) ||
- (devspec[0] == '/') ||
- (strchr(devspec, ':') == NULL)) {
-
- if (((rv = efi_parsedev(dev, getenv("currdev"), NULL)) == 0) &&
- (path != NULL))
- *path = devspec;
- return(rv);
- }
-
- /*
- * Try to parse the device name off the beginning of the devspec
- */
- return(efi_parsedev(dev, devspec, path));
-}
-
-/*
- * Point (dev) at an allocated device specifier matching the string version
- * at the beginning of (devspec). Return a pointer to the remaining
- * text in (path).
- *
- * In all cases, the beginning of (devspec) is compared to the names
- * of known devices in the device switch, and then any following text
- * is parsed according to the rules applied to the device type.
- *
- * For disk-type devices, the syntax is:
- *
- * disk<unit>[s<slice>][<partition>]:
- *
- */
-static int
-efi_parsedev(struct efi_devdesc **dev, const char *devspec, const char **path)
-{
- struct efi_devdesc *idev;
- struct devsw *dv;
- int i, unit, slice, partition, err;
- char *cp;
- const char *np;
-
- /* minimum length check */
- if (strlen(devspec) < 2)
- return(EINVAL);
-
- /* look for a device that matches */
- for (i = 0, dv = NULL; devsw[i] != NULL; i++) {
- if (!strncmp(devspec, devsw[i]->dv_name, strlen(devsw[i]->dv_name))) {
- dv = devsw[i];
- break;
- }
- }
-
- if (dv == NULL)
- return(ENOENT);
- idev = malloc(sizeof(struct efi_devdesc));
- err = 0;
- np = (devspec + strlen(dv->dv_name));
-
- switch(dv->dv_type) {
- case DEVT_NONE: /* XXX what to do here? Do we care? */
- break;
-
- case DEVT_DISK:
- unit = -1;
- slice = -1;
- partition = -1;
- if (*np && (*np != ':')) {
- unit = strtol(np, &cp, 10); /* next comes the unit number */
- if (cp == np) {
- err = EUNIT;
- goto fail;
- }
- if (*cp == 's') { /* got a slice number */
- np = cp + 1;
- slice = strtol(np, &cp, 10);
- if (cp == np) {
- err = ESLICE;
- goto fail;
- }
- }
- if (*cp && (*cp != ':')) {
- partition = *cp - 'a'; /* get a partition number */
- if ((partition < 0) || (partition >= MAXPARTITIONS)) {
- err = EPART;
- goto fail;
- }
- cp++;
- }
- }
- if (*cp && (*cp != ':')) {
- err = EINVAL;
- goto fail;
- }
-
- idev->d_kind.efidisk.unit = unit;
- idev->d_kind.efidisk.slice = slice;
- idev->d_kind.efidisk.partition = partition;
-
- if (path != NULL)
- *path = (*cp == 0) ? cp : cp + 1;
- break;
-
- case DEVT_NET:
- unit = 0;
-
- if (*np && (*np != ':')) {
- unit = strtol(np, &cp, 0); /* get unit number if present */
- if (cp == np) {
- err = EUNIT;
- goto fail;
- }
- }
- if (*cp && (*cp != ':')) {
- err = EINVAL;
- goto fail;
- }
-
- idev->d_kind.netif.unit = unit;
- if (path != NULL)
- *path = (*cp == 0) ? cp : cp + 1;
- break;
-
- default:
- err = EINVAL;
- goto fail;
- }
- idev->d_dev = dv;
- idev->d_type = dv->dv_type;
- if (dev == NULL) {
- free(idev);
- } else {
- *dev = idev;
- }
- return(0);
-
- fail:
- free(idev);
- return(err);
-}
-
-
-char *
-efi_fmtdev(void *vdev)
-{
- struct efi_devdesc *dev = (struct efi_devdesc *)vdev;
- static char buf[128]; /* XXX device length constant? */
- char *cp;
-
- switch(dev->d_type) {
- case DEVT_NONE:
- strcpy(buf, "(no device)");
- break;
-
- case DEVT_DISK:
- cp = buf;
- cp += sprintf(cp, "%s%d", dev->d_dev->dv_name, dev->d_kind.efidisk.unit);
- if (dev->d_kind.efidisk.slice > 0)
- cp += sprintf(cp, "s%d", dev->d_kind.efidisk.slice);
- if (dev->d_kind.efidisk.partition >= 0)
- cp += sprintf(cp, "%c", dev->d_kind.efidisk.partition + 'a');
- strcat(cp, ":");
- break;
-
- case DEVT_NET:
- sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_kind.netif.unit);
- break;
- }
- return(buf);
-}
-
-
-/*
- * Set currdev to suit the value being supplied in (value)
- */
-int
-efi_setcurrdev(struct env_var *ev, int flags, void *value)
-{
- struct efi_devdesc *ncurr;
- int rv;
-
- if ((rv = efi_parsedev(&ncurr, value, NULL)) != 0)
- return(rv);
- free(ncurr);
- env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
- return(0);
-}
-
diff --git a/sys/boot/ia64/common/exec.c b/sys/boot/ia64/common/exec.c
deleted file mode 100644
index 93cfdbd..0000000
--- a/sys/boot/ia64/common/exec.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $NetBSD: loadfile.c,v 1.10 1998/06/25 06:45:46 ross Exp $ */
-
-/*-
- * Copyright (c) 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) 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stand.h>
-#include <string.h>
-
-#include <sys/param.h>
-#include <sys/linker.h>
-#include <machine/elf.h>
-#include <machine/bootinfo.h>
-#include <machine/ia64_cpu.h>
-#include <machine/pte.h>
-#include <machine/vmparam.h>
-
-#include <efi.h>
-#include <efilib.h>
-
-#include "bootstrap.h"
-
-#define _KERNEL
-
-static int elf64_exec(struct preloaded_file *amp);
-
-struct file_format ia64_elf = { elf64_loadfile, elf64_exec };
-
-static __inline u_int64_t
-disable_ic()
-{
- u_int64_t psr;
- __asm __volatile("mov %0=psr;;" : "=r" (psr));
- __asm __volatile("rsm psr.ic|psr.i;; srlz.i;;");
- return psr;
-}
-
-static __inline void
-restore_ic(u_int64_t psr)
-{
- __asm __volatile("mov psr.l=%0;; srlz.i" :: "r" (psr));
-}
-
-/*
- * Entered with psr.ic and psr.i both zero.
- */
-void
-enter_kernel(u_int64_t start, struct bootinfo *bi)
-{
- u_int64_t psr;
-
- __asm __volatile("srlz.i;;");
- __asm __volatile("mov cr.ipsr=%0"
- :: "r"(IA64_PSR_IC
- | IA64_PSR_DT
- | IA64_PSR_RT
- | IA64_PSR_IT
- | IA64_PSR_BN));
- __asm __volatile("mov cr.iip=%0" :: "r"(start));
- __asm __volatile("mov cr.ifs=r0;;");
- __asm __volatile("mov ar.rsc=0;; flushrs;;");
- __asm __volatile("mov r8=%0" :: "r" (bi));
- __asm __volatile("rfi;;");
-}
-
-static int
-elf64_exec(struct preloaded_file *fp)
-{
- struct file_metadata *md;
- Elf_Ehdr *hdr;
- pt_entry_t pte;
- struct bootinfo *bi;
- u_int64_t psr;
- UINTN mapkey, pages, size;
- UINTN descsz;
- UINT32 descver;
- EFI_STATUS status;
-
- if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL)
- return(EFTYPE); /* XXX actually EFUCKUP */
- hdr = (Elf_Ehdr *)&(md->md_data);
-
- /*
- * Allocate enough pages to hold the bootinfo block and the memory
- * map EFI will return to us. The memory map has an unknown size,
- * so we have to determine that first. Note that the AllocatePages
- * call can itself modify the memory map, so we have to take that
- * into account as well. The changes to the memory map are caused
- * by splitting a range of free memory into two (AFAICT), so that
- * one is marked as being loader data.
- */
- size = 0;
- descsz = sizeof(EFI_MEMORY_DESCRIPTOR);
- BS->GetMemoryMap(&size, NULL, &mapkey, &descsz, &descver);
- size += descsz + ((sizeof(struct bootinfo) + 0x0f) & ~0x0f);
- pages = EFI_SIZE_TO_PAGES(size);
- status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, pages,
- (void*)&bi);
- if (EFI_ERROR(status)) {
- printf("unable to create bootinfo block (status=0x%lx)\n",
- (long)status);
- return (ENOMEM);
- }
-
- bzero(bi, sizeof(struct bootinfo));
- bi_load(bi, fp, &mapkey, pages);
-
- printf("Entering %s at 0x%lx...\n", fp->f_name, hdr->e_entry);
-
- status = BS->ExitBootServices(IH, mapkey);
- if (EFI_ERROR(status)) {
- printf("ExitBootServices returned 0x%lx\n", status);
- return (EINVAL);
- }
-
- psr = disable_ic();
-
- /*
- * Region 6 is direct mapped UC and region 7 is direct mapped
- * WC. The details of this is controlled by the Alt {I,D}TLB
- * handlers. Here we just make sure that they have the largest
- * possible page size to minimise TLB usage.
- */
- ia64_set_rr(IA64_RR_BASE(6), (6 << 8) | (28 << 2));
- ia64_set_rr(IA64_RR_BASE(7), (7 << 8) | (28 << 2));
-
- pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY |
- PTE_PL_KERN | PTE_AR_RWX;
-
- __asm __volatile("mov cr.ifa=%0" :: "r"(IA64_RR_BASE(7)));
- __asm __volatile("mov cr.itir=%0" :: "r"(28 << 2));
- __asm __volatile("ptr.i %0,%1" :: "r"(IA64_RR_BASE(7)), "r"(28<<2));
- __asm __volatile("ptr.d %0,%1" :: "r"(IA64_RR_BASE(7)), "r"(28<<2));
- __asm __volatile("srlz.i;;");
- __asm __volatile("itr.i itr[%0]=%1;;" :: "r"(0), "r"(pte));
- __asm __volatile("srlz.i;;");
- __asm __volatile("itr.d dtr[%0]=%1;;" :: "r"(0), "r"(pte));
- __asm __volatile("srlz.i;;");
-
- enter_kernel(hdr->e_entry, bi);
-
- restore_ic(psr);
-}
diff --git a/sys/boot/powerpc/ofw/Makefile b/sys/boot/powerpc/ofw/Makefile
deleted file mode 100644
index c409729..0000000
--- a/sys/boot/powerpc/ofw/Makefile
+++ /dev/null
@@ -1,103 +0,0 @@
-# $FreeBSD$
-
-PROG= loader
-NEWVERSWHAT= "bootstrap loader" "Open Firmware/PowerPC"
-BINDIR?= /boot
-INSTALLFLAGS= -b
-
-# Architecture-specific loader code
-SRCS= conf.c metadata.c vers.c start.c
-
-LOADER_DISK_SUPPORT?= yes
-LOADER_UFS_SUPPORT?= yes
-LOADER_CD9660_SUPPORT?= yes
-LOADER_EXT2FS_SUPPORT?= no
-LOADER_NET_SUPPORT?= yes
-LOADER_NFS_SUPPORT?= yes
-LOADER_TFTP_SUPPORT?= yes
-LOADER_GZIP_SUPPORT?= yes
-LOADER_BZIP2_SUPPORT?= no
-
-.if ${LOADER_DISK_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_DISK_SUPPORT
-.endif
-.if ${LOADER_UFS_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_UFS_SUPPORT
-.endif
-.if ${LOADER_CD9660_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_CD9660_SUPPORT
-.endif
-.if ${LOADER_EXT2FS_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_EXT2FS_SUPPORT
-.endif
-.if ${LOADER_GZIP_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_GZIP_SUPPORT
-.endif
-.if ${LOADER_BZIP2_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_BZIP2_SUPPORT
-.endif
-.if ${LOADER_NET_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_NET_SUPPORT
-.endif
-.if ${LOADER_NFS_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_NFS_SUPPORT
-.endif
-.if ${LOADER_TFTP_SUPPORT} == "yes"
-CFLAGS+= -DLOADER_TFTP_SUPPORT
-.endif
-
-.if !defined(NO_FORTH)
-# Enable BootForth
-BOOT_FORTH= yes
-CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/powerpc
-LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
-.endif
-
-# Always add MI sources
-.PATH: ${.CURDIR}/../../common
-.include "${.CURDIR}/../../common/Makefile.inc"
-CFLAGS+= -I${.CURDIR}/../../common
-CFLAGS+= -I.
-
-CLEANFILES+= vers.c loader.help
-
-CFLAGS+= -ffreestanding
-# load address. set in linker script
-RELOC?= 0x1C00000
-CFLAGS+= -DRELOC=${RELOC}
-
-LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc
-
-# 64-bit bridge extensions
-CFLAGS+= -Wa,-mppc64bridge
-
-# Pull in common loader code
-.PATH: ${.CURDIR}/../../ofw/common
-.include "${.CURDIR}/../../ofw/common/Makefile.inc"
-
-# Open Firmware standalone support library
-LIBOFW= ${.OBJDIR}/../../ofw/libofw/libofw.a
-CFLAGS+= -I${.CURDIR}/../../ofw/libofw
-
-# where to get libstand from
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
-
-DPADD= ${LIBFICL} ${LIBOFW} ${LIBSTAND}
-LDADD= ${LIBFICL} ${LIBOFW} -lstand
-
-vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
- sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
-
-loader.help: help.common help.ofw
- cat ${.ALLSRC} | \
- awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
-
-.PATH: ${.CURDIR}/../../forth
-FILES= loader.help loader.4th support.4th loader.conf
-FILESDIR_loader.conf= /boot/defaults
-
-.if !exists(${DESTDIR}/boot/loader.rc)
-FILES+= loader.rc
-.endif
-
-.include <bsd.prog.mk>
diff --git a/sys/boot/powerpc/ofw/conf.c b/sys/boot/powerpc/ofw/conf.c
deleted file mode 100644
index d214d1e..0000000
--- a/sys/boot/powerpc/ofw/conf.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-
- * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stand.h>
-#include "bootstrap.h"
-#include "libofw.h"
-#include "openfirm.h"
-
-#if defined(LOADER_NET_SUPPORT)
-#include "dev_net.h"
-#endif
-
-/*
- * We could use linker sets for some or all of these, but
- * then we would have to control what ended up linked into
- * the bootstrap. So it's easier to conditionalise things
- * here.
- *
- * XXX rename these arrays to be consistent and less namespace-hostile
- */
-
-/* Exported for libstand */
-struct devsw *devsw[] = {
-#if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT)
- &ofwdisk,
-#endif
-#if defined(LOADER_NET_SUPPORT)
- &netdev,
-#endif
- NULL
-};
-
-struct fs_ops *file_system[] = {
-#if defined(LOADER_UFS_SUPPORT)
- &ufs_fsops,
-#endif
-#if defined(LOADER_CD9660_SUPPORT)
- &cd9660_fsops,
-#endif
-#if defined(LOADER_EXT2FS_SUPPORT)
- &ext2fs_fsops,
-#endif
-#if defined(LOADER_NET_SUPPORT)
- &nfs_fsops,
-#endif
-#if defined(LOADER_TFTP_SUPPORT)
- &tftp_fsops,
-#endif
-#if defined(LOADER_GZIP_SUPPORT)
- &gzipfs_fsops,
-#endif
-#if defined(LOADER_BZIP2_SUPPORT)
- &bzipfs_fsops,
-#endif
- NULL
-};
-
-struct netif_driver *netif_drivers[] = {
-#if defined(LOADER_NET_SUPPORT)
- &ofwnet,
-#endif
- NULL,
-};
-
-/* Exported for PowerPC only */
-/*
- * Sort formats so that those that can detect based on arguments
- * rather than reading the file go first.
- */
-
-struct file_format *file_formats[] = {
- &ofw_elf,
- NULL
-};
-
-/*
- * Consoles
- *
- * We don't prototype these in libalpha.h because they require
- * data structures from bootstrap.h as well.
- */
-extern struct console ofwconsole;
-
-struct console *consoles[] = {
- &ofwconsole,
- NULL
-};
-
-/*
- * reloc - our load address
- */
-vm_offset_t reloc = RELOC;
diff --git a/sys/boot/powerpc/ofw/help.ofw b/sys/boot/powerpc/ofw/help.ofw
deleted file mode 100644
index 5873eb0..0000000
--- a/sys/boot/powerpc/ofw/help.ofw
+++ /dev/null
@@ -1 +0,0 @@
-$FreeBSD$
diff --git a/sys/boot/powerpc/ofw/ldscript.powerpc b/sys/boot/powerpc/ofw/ldscript.powerpc
deleted file mode 100644
index ecf8129..0000000
--- a/sys/boot/powerpc/ofw/ldscript.powerpc
+++ /dev/null
@@ -1,139 +0,0 @@
-/* $FreeBSD$ */
-
-OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
-OUTPUT_ARCH(powerpc)
-ENTRY(_start)
-SEARCH_DIR(/usr/lib);
-/* Do we need any of these for elf?
- __DYNAMIC = 0; */
-PROVIDE (__stack = 0);
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- . = 0x01c00000 + SIZEOF_HEADERS;
- .interp : { *(.interp) }
- .hash : { *(.hash) }
- .dynsym : { *(.dynsym) }
- .dynstr : { *(.dynstr) }
- .gnu.version : { *(.gnu.version) }
- .gnu.version_d : { *(.gnu.version_d) }
- .gnu.version_r : { *(.gnu.version_r) }
- .rela.text :
- { *(.rela.text) *(.rela.gnu.linkonce.t*) }
- .rela.data :
- { *(.rela.data) *(.rela.gnu.linkonce.d*) }
- .rela.rodata :
- { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
- .rela.got : { *(.rela.got) }
- .rela.got1 : { *(.rela.got1) }
- .rela.got2 : { *(.rela.got2) }
- .rela.ctors : { *(.rela.ctors) }
- .rela.dtors : { *(.rela.dtors) }
- .rela.init : { *(.rela.init) }
- .rela.fini : { *(.rela.fini) }
- .rela.bss : { *(.rela.bss) }
- .rela.plt : { *(.rela.plt) }
- .rela.sdata : { *(.rela.sdata) }
- .rela.sbss : { *(.rela.sbss) }
- .rela.sdata2 : { *(.rela.sdata2) }
- .rela.sbss2 : { *(.rela.sbss2) }
- .text :
- {
- *(.text)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- *(.gnu.linkonce.t*)
- } =0
- _etext = .;
- PROVIDE (etext = .);
- .init : { *(.init) } =0
- .fini : { *(.fini) } =0
- .rodata : { *(.rodata) *(.gnu.linkonce.r*) }
- .rodata1 : { *(.rodata1) }
- .sdata2 : { *(.sdata2) }
- .sbss2 : { *(.sbss2) }
- /* Adjust the address for the data segment to the next page up. */
- . = ((. + 0x1000) & ~(0x1000 - 1));
- .data :
- {
- *(.data)
- *(.gnu.linkonce.d*)
- CONSTRUCTORS
- }
- .data1 : { *(.data1) }
- .got1 : { *(.got1) }
- .dynamic : { *(.dynamic) }
- /* Put .ctors and .dtors next to the .got2 section, so that the pointers
- get relocated with -mrelocatable. Also put in the .fixup pointers.
- The current compiler no longer needs this, but keep it around for 2.7.2 */
- PROVIDE (_GOT2_START_ = .);
- .got2 : { *(.got2) }
- PROVIDE (__CTOR_LIST__ = .);
- .ctors : { *(.ctors) }
- PROVIDE (__CTOR_END__ = .);
- PROVIDE (__DTOR_LIST__ = .);
- .dtors : { *(.dtors) }
- PROVIDE (__DTOR_END__ = .);
- PROVIDE (_FIXUP_START_ = .);
- .fixup : { *(.fixup) }
- PROVIDE (_FIXUP_END_ = .);
- PROVIDE (_GOT2_END_ = .);
- PROVIDE (_GOT_START_ = .);
- .got : { *(.got) }
- .got.plt : { *(.got.plt) }
- PROVIDE (_GOT_END_ = .);
- /* 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) }
- _edata = .;
- PROVIDE (edata = .);
- .sbss :
- {
- PROVIDE (__sbss_start = .);
- *(.sbss)
- *(.scommon)
- *(.dynsbss)
- PROVIDE (__sbss_end = .);
- }
- .plt : { *(.plt) }
- .bss :
- {
- PROVIDE (__bss_start = .);
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- _end = . ;
- PROVIDE (end = .);
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- /* DWARF debug sections.
- Symbols in the DWARF debugging sections are relative to the beginning
- of the section so we begin them at 0. */
- /* DWARF 1 */
- .debug 0 : { *(.debug) }
- .line 0 : { *(.line) }
- /* GNU DWARF 1 extensions */
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- /* DWARF 1.1 and DWARF 2 */
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- /* DWARF 2 */
- .debug_info 0 : { *(.debug_info) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_str 0 : { *(.debug_str) }
- .debug_loc 0 : { *(.debug_loc) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- /* SGI/MIPS DWARF 2 extensions */
- .debug_weaknames 0 : { *(.debug_weaknames) }
- .debug_funcnames 0 : { *(.debug_funcnames) }
- .debug_typenames 0 : { *(.debug_typenames) }
- .debug_varnames 0 : { *(.debug_varnames) }
- /* These must appear regardless of . */
-}
-
diff --git a/sys/boot/powerpc/ofw/metadata.c b/sys/boot/powerpc/ofw/metadata.c
deleted file mode 100644
index fdeaa59..0000000
--- a/sys/boot/powerpc/ofw/metadata.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*-
- * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * from: FreeBSD: src/sys/boot/sparc64/loader/metadata.c,v 1.6
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stand.h>
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/linker.h>
-
-#include <machine/metadata.h>
-
-#include "bootstrap.h"
-#include "libofw.h"
-
-/*
- * Return a 'boothowto' value corresponding to the kernel arguments in
- * (kargs) and any relevant environment variables.
- */
-static struct
-{
- const char *ev;
- int mask;
-} howto_names[] = {
- {"boot_askname", RB_ASKNAME},
- {"boot_cdrom", RB_CDROM},
- {"boot_ddb", RB_KDB},
- {"boot_gdb", RB_GDB},
- {"boot_single", RB_SINGLE},
- {"boot_verbose", RB_VERBOSE},
- {"boot_multicons", RB_MULTIPLE},
- {"boot_serial", RB_SERIAL},
- {NULL, 0}
-};
-
-int
-md_getboothowto(char *kargs)
-{
- char *cp;
- int howto;
- int active;
- int i;
-
- /* Parse kargs */
- howto = 0;
- if (kargs != NULL) {
- cp = kargs;
- active = 0;
- while (*cp != 0) {
- if (!active && (*cp == '-')) {
- active = 1;
- } else if (active)
- switch (*cp) {
- case 'a':
- howto |= RB_ASKNAME;
- break;
- case 'C':
- howto |= RB_CDROM;
- break;
- case 'd':
- howto |= RB_KDB;
- break;
- case 'D':
- howto |= RB_MULTIPLE;
- break;
- case 'm':
- howto |= RB_MUTE;
- break;
- case 'g':
- howto |= RB_GDB;
- break;
- case 'h':
- howto |= RB_SERIAL;
- break;
- case 'r':
- howto |= RB_DFLTROOT;
- break;
- case 's':
- howto |= RB_SINGLE;
- break;
- case 'v':
- howto |= RB_VERBOSE;
- break;
- default:
- active = 0;
- break;
- }
- cp++;
- }
- }
- /* get equivalents from the environment */
- for (i = 0; howto_names[i].ev != NULL; i++)
- if (getenv(howto_names[i].ev) != NULL)
- howto |= howto_names[i].mask;
- if (!strcmp(getenv("console"), "comconsole"))
- howto |= RB_SERIAL;
- if (!strcmp(getenv("console"), "nullconsole"))
- howto |= RB_MUTE;
- return(howto);
-}
-
-/*
- * Copy the environment into the load area starting at (addr).
- * Each variable is formatted as <name>=<value>, with a single nul
- * separating each variable, and a double nul terminating the environment.
- */
-vm_offset_t
-md_copyenv(vm_offset_t addr)
-{
- struct env_var *ep;
-
- /* traverse the environment */
- for (ep = environ; ep != NULL; ep = ep->ev_next) {
- archsw.arch_copyin(ep->ev_name, addr, strlen(ep->ev_name));
- addr += strlen(ep->ev_name);
- archsw.arch_copyin("=", addr, 1);
- addr++;
- if (ep->ev_value != NULL) {
- archsw.arch_copyin(ep->ev_value, addr, strlen(ep->ev_value));
- addr += strlen(ep->ev_value);
- }
- archsw.arch_copyin("", addr, 1);
- addr++;
- }
- archsw.arch_copyin("", addr, 1);
- addr++;
- return(addr);
-}
-
-/*
- * Copy module-related data into the load area, where it can be
- * used as a directory for loaded modules.
- *
- * Module data is presented in a self-describing format. Each datum
- * is preceded by a 32-bit identifier and a 32-bit size field.
- *
- * Currently, the following data are saved:
- *
- * MOD_NAME (variable) module name (string)
- * MOD_TYPE (variable) module type (string)
- * MOD_ARGS (variable) module parameters (string)
- * MOD_ADDR sizeof(vm_offset_t) module load address
- * MOD_SIZE sizeof(size_t) module size
- * MOD_METADATA (variable) type-specific metadata
- */
-#define COPY32(v, a, c) { \
- u_int32_t x = (v); \
- if (c) \
- archsw.arch_copyin(&x, a, sizeof(x)); \
- a += sizeof(x); \
-}
-
-#define MOD_STR(t, a, s, c) { \
- COPY32(t, a, c); \
- COPY32(strlen(s) + 1, a, c) \
- if (c) \
- archsw.arch_copyin(s, a, strlen(s) + 1);\
- a += roundup(strlen(s) + 1, sizeof(u_long));\
-}
-
-#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c)
-#define MOD_TYPE(a, s, c) MOD_STR(MODINFO_TYPE, a, s, c)
-#define MOD_ARGS(a, s, c) MOD_STR(MODINFO_ARGS, a, s, c)
-
-#define MOD_VAR(t, a, s, c) { \
- COPY32(t, a, c); \
- COPY32(sizeof(s), a, c); \
- if (c) \
- archsw.arch_copyin(&s, a, sizeof(s)); \
- a += roundup(sizeof(s), sizeof(u_long)); \
-}
-
-#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c)
-#define MOD_SIZE(a, s, c) MOD_VAR(MODINFO_SIZE, a, s, c)
-
-#define MOD_METADATA(a, mm, c) { \
- COPY32(MODINFO_METADATA | mm->md_type, a, c);\
- COPY32(mm->md_size, a, c); \
- if (c) \
- archsw.arch_copyin(mm->md_data, a, mm->md_size);\
- a += roundup(mm->md_size, sizeof(u_long)); \
-}
-
-#define MOD_END(a, c) { \
- COPY32(MODINFO_END, a, c); \
- COPY32(0, a, c); \
-}
-
-vm_offset_t
-md_copymodules(vm_offset_t addr)
-{
- struct preloaded_file *fp;
- struct file_metadata *md;
- int c;
-
- c = addr != 0;
- /* start with the first module on the list, should be the kernel */
- for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) {
-
- MOD_NAME(addr, fp->f_name, c); /* this field must come first */
- MOD_TYPE(addr, fp->f_type, c);
- if (fp->f_args)
- MOD_ARGS(addr, fp->f_args, c);
- MOD_ADDR(addr, fp->f_addr, c);
- MOD_SIZE(addr, fp->f_size, c);
- for (md = fp->f_metadata; md != NULL; md = md->md_next) {
- if (!(md->md_type & MODINFOMD_NOCOPY)) {
- MOD_METADATA(addr, md, c);
- }
- }
- }
- MOD_END(addr, c);
- return(addr);
-}
-
-/*
- * Load the information expected by a powerpc kernel.
- *
- * - The 'boothowto' argument is constructed
- * - The 'bootdev' argument is constructed
- * - The kernel environment is copied into kernel space.
- * - Module metadata are formatted and placed in kernel space.
- */
-int
-md_load(char *args, vm_offset_t *modulep)
-{
- struct preloaded_file *kfp;
- struct preloaded_file *xp;
- struct file_metadata *md;
- vm_offset_t kernend;
- vm_offset_t addr;
- vm_offset_t envp;
- vm_offset_t size;
- char *rootdevname;
- int howto;
- int dtlb_slots;
- int itlb_slots;
-
- howto = md_getboothowto(args);
-
- /*
- * Allow the environment variable 'rootdev' to override the supplied device
- * This should perhaps go to MI code and/or have $rootdev tested/set by
- * MI code before launching the kernel.
- */
- rootdevname = getenv("rootdev");
- if (rootdevname == NULL)
- rootdevname = getenv("currdev");
- /* Try reading the /etc/fstab file to select the root device */
- getrootmount(rootdevname);
-
- /* find the last module in the chain */
- addr = 0;
- for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
- if (addr < (xp->f_addr + xp->f_size))
- addr = xp->f_addr + xp->f_size;
- }
- /* pad to a page boundary */
- addr = roundup(addr, PAGE_SIZE);
-
- /* copy our environment */
- envp = addr;
- addr = md_copyenv(addr);
-
- /* pad to a page boundary */
- addr = roundup(addr, PAGE_SIZE);
-
- kernend = 0;
- kfp = file_findfile(NULL, "elf32 kernel");
- if (kfp == NULL)
- kfp = file_findfile(NULL, "elf kernel");
- if (kfp == NULL)
- panic("can't find kernel file");
- file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto);
- file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp);
- file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend);
-
- *modulep = addr;
- size = md_copymodules(0);
- kernend = roundup(addr + size, PAGE_SIZE);
-
- md = file_findmetadata(kfp, MODINFOMD_KERNEND);
- bcopy(&kernend, md->md_data, sizeof kernend);
-
- (void)md_copymodules(addr);
-
- return(0);
-}
diff --git a/sys/boot/powerpc/ofw/start.c b/sys/boot/powerpc/ofw/start.c
deleted file mode 100644
index ff3fcd8..0000000
--- a/sys/boot/powerpc/ofw/start.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */
-/*-
- * Copyright (C) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stand.h>
-#include "libofw.h"
-
-void startup(void *, int, int (*)(void *), char *, int);
-
-__asm(" \n\
- .data \n\
-stack: \n\
- .space 16388 \n\
- \n\
- .text \n\
- .globl _start \n\
-_start: \n\
- lis %r1,stack@ha \n\
- addi %r1,%r1,stack@l \n\
- addi %r1,%r1,8192 \n\
- \n\
- b startup \n\
-");
-
-void
-startup(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl)
-{
- main(openfirm);
-}
diff --git a/sys/boot/powerpc/ofw/version b/sys/boot/powerpc/ofw/version
deleted file mode 100644
index cb0f693..0000000
--- a/sys/boot/powerpc/ofw/version
+++ /dev/null
@@ -1,6 +0,0 @@
-$FreeBSD$
-
-NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
-file is important. Make sure the current version number is on line 6.
-
-0.1: Initial OFW/PowerPC version.
diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c
deleted file mode 100644
index a31c4d0..0000000
--- a/sys/dev/agp/agp.c
+++ /dev/null
@@ -1,930 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_bus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/conf.h>
-#include <sys/ioccom.h>
-#include <sys/agpio.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/agppriv.h>
-#include <pci/agpvar.h>
-#include <pci/agpreg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/vm_page.h>
-#include <vm/vm_pageout.h>
-#include <vm/pmap.h>
-
-#include <machine/md_var.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-MODULE_VERSION(agp, 1);
-
-MALLOC_DEFINE(M_AGP, "agp", "AGP data structures");
-
- /* agp_drv.c */
-static d_open_t agp_open;
-static d_close_t agp_close;
-static d_ioctl_t agp_ioctl;
-static d_mmap_t agp_mmap;
-
-static struct cdevsw agp_cdevsw = {
- .d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
- .d_open = agp_open,
- .d_close = agp_close,
- .d_ioctl = agp_ioctl,
- .d_mmap = agp_mmap,
- .d_name = "agp",
-};
-
-static devclass_t agp_devclass;
-#define KDEV2DEV(kdev) devclass_get_device(agp_devclass, minor(kdev))
-
-/* Helper functions for implementing chipset mini drivers. */
-
-void
-agp_flush_cache()
-{
-#if defined(__i386__) || defined(__amd64__)
- wbinvd();
-#endif
-#ifdef __alpha__
- /* FIXME: This is most likely not correct as it doesn't flush CPU
- * write caches, but we don't have a facility to do that and
- * this is all linux does, too */
- alpha_mb();
-#endif
-}
-
-u_int8_t
-agp_find_caps(device_t dev)
-{
- u_int32_t status;
- u_int8_t ptr, next;
-
- /*
- * Check the CAP_LIST bit of the PCI status register first.
- */
- status = pci_read_config(dev, PCIR_STATUS, 2);
- if (!(status & 0x10))
- return 0;
-
- /*
- * Traverse the capabilities list.
- */
- for (ptr = pci_read_config(dev, AGP_CAPPTR, 1);
- ptr != 0;
- ptr = next) {
- u_int32_t capid = pci_read_config(dev, ptr, 4);
- next = AGP_CAPID_GET_NEXT_PTR(capid);
-
- /*
- * If this capability entry ID is 2, then we are done.
- */
- if (AGP_CAPID_GET_CAP_ID(capid) == 2)
- return ptr;
- }
-
- return 0;
-}
-
-/*
- * Find an AGP display device (if any).
- */
-static device_t
-agp_find_display(void)
-{
- devclass_t pci = devclass_find("pci");
- device_t bus, dev = 0;
- device_t *kids;
- int busnum, numkids, i;
-
- for (busnum = 0; busnum < devclass_get_maxunit(pci); busnum++) {
- bus = devclass_get_device(pci, busnum);
- if (!bus)
- continue;
- device_get_children(bus, &kids, &numkids);
- for (i = 0; i < numkids; i++) {
- dev = kids[i];
- if (pci_get_class(dev) == PCIC_DISPLAY
- && pci_get_subclass(dev) == PCIS_DISPLAY_VGA)
- if (agp_find_caps(dev)) {
- free(kids, M_TEMP);
- return dev;
- }
-
- }
- free(kids, M_TEMP);
- }
-
- return 0;
-}
-
-struct agp_gatt *
-agp_alloc_gatt(device_t dev)
-{
- u_int32_t apsize = AGP_GET_APERTURE(dev);
- u_int32_t entries = apsize >> AGP_PAGE_SHIFT;
- struct agp_gatt *gatt;
-
- if (bootverbose)
- device_printf(dev,
- "allocating GATT for aperture of size %dM\n",
- apsize / (1024*1024));
-
- if (entries == 0) {
- device_printf(dev, "bad aperture size\n");
- return NULL;
- }
-
- gatt = malloc(sizeof(struct agp_gatt), M_AGP, M_NOWAIT);
- if (!gatt)
- return 0;
-
- gatt->ag_entries = entries;
- gatt->ag_virtual = contigmalloc(entries * sizeof(u_int32_t), M_AGP, 0,
- 0, ~0, PAGE_SIZE, 0);
- if (!gatt->ag_virtual) {
- if (bootverbose)
- device_printf(dev, "contiguous allocation failed\n");
- free(gatt, M_AGP);
- return 0;
- }
- bzero(gatt->ag_virtual, entries * sizeof(u_int32_t));
- gatt->ag_physical = vtophys((vm_offset_t) gatt->ag_virtual);
- agp_flush_cache();
-
- return gatt;
-}
-
-void
-agp_free_gatt(struct agp_gatt *gatt)
-{
- contigfree(gatt->ag_virtual,
- gatt->ag_entries * sizeof(u_int32_t), M_AGP);
- free(gatt, M_AGP);
-}
-
-static int agp_max[][2] = {
- {0, 0},
- {32, 4},
- {64, 28},
- {128, 96},
- {256, 204},
- {512, 440},
- {1024, 942},
- {2048, 1920},
- {4096, 3932}
-};
-#define agp_max_size (sizeof(agp_max) / sizeof(agp_max[0]))
-
-int
-agp_generic_attach(device_t dev)
-{
- struct agp_softc *sc = device_get_softc(dev);
- int rid, memsize, i;
-
- /*
- * Find and map the aperture.
- */
- rid = AGP_APBASE;
- sc->as_aperture = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
- RF_ACTIVE);
- if (!sc->as_aperture)
- return ENOMEM;
-
- /*
- * Work out an upper bound for agp memory allocation. This
- * uses a heurisitc table from the Linux driver.
- */
- memsize = ptoa(Maxmem) >> 20;
- for (i = 0; i < agp_max_size; i++) {
- if (memsize <= agp_max[i][0])
- break;
- }
- if (i == agp_max_size) i = agp_max_size - 1;
- sc->as_maxmem = agp_max[i][1] << 20U;
-
- /*
- * The lock is used to prevent re-entry to
- * agp_generic_bind_memory() since that function can sleep.
- */
- mtx_init(&sc->as_lock, "agp lock", NULL, MTX_DEF);
-
- /*
- * Initialise stuff for the userland device.
- */
- agp_devclass = devclass_find("agp");
- TAILQ_INIT(&sc->as_memory);
- sc->as_nextid = 1;
-
- sc->as_devnode = make_dev(&agp_cdevsw,
- device_get_unit(dev),
- UID_ROOT,
- GID_WHEEL,
- 0600,
- "agpgart");
-
- return 0;
-}
-
-int
-agp_generic_detach(device_t dev)
-{
- struct agp_softc *sc = device_get_softc(dev);
- bus_release_resource(dev, SYS_RES_MEMORY, AGP_APBASE, sc->as_aperture);
- mtx_destroy(&sc->as_lock);
- destroy_dev(sc->as_devnode);
- agp_flush_cache();
- return 0;
-}
-
-/*
- * This does the enable logic for v3, with the same topology
- * restrictions as in place for v2 -- one bus, one device on the bus.
- */
-static int
-agp_v3_enable(device_t dev, device_t mdev, u_int32_t mode)
-{
- u_int32_t tstatus, mstatus;
- u_int32_t command;
- int rq, sba, fw, rate, arqsz, cal;
-
- tstatus = pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4);
- mstatus = pci_read_config(mdev, agp_find_caps(mdev) + AGP_STATUS, 4);
-
- /* Set RQ to the min of mode, tstatus and mstatus */
- rq = AGP_MODE_GET_RQ(mode);
- if (AGP_MODE_GET_RQ(tstatus) < rq)
- rq = AGP_MODE_GET_RQ(tstatus);
- if (AGP_MODE_GET_RQ(mstatus) < rq)
- rq = AGP_MODE_GET_RQ(mstatus);
-
- /*
- * ARQSZ - Set the value to the maximum one.
- * Don't allow the mode register to override values.
- */
- arqsz = AGP_MODE_GET_ARQSZ(mode);
- if (AGP_MODE_GET_ARQSZ(tstatus) > rq)
- rq = AGP_MODE_GET_ARQSZ(tstatus);
- if (AGP_MODE_GET_ARQSZ(mstatus) > rq)
- rq = AGP_MODE_GET_ARQSZ(mstatus);
-
- /* Calibration cycle - don't allow override by mode register */
- cal = AGP_MODE_GET_CAL(tstatus);
- if (AGP_MODE_GET_CAL(mstatus) < cal)
- cal = AGP_MODE_GET_CAL(mstatus);
-
- /* SBA must be supported for AGP v3. */
- sba = 1;
-
- /* Set FW if all three support it. */
- fw = (AGP_MODE_GET_FW(tstatus)
- & AGP_MODE_GET_FW(mstatus)
- & AGP_MODE_GET_FW(mode));
-
- /* Figure out the max rate */
- rate = (AGP_MODE_GET_RATE(tstatus)
- & AGP_MODE_GET_RATE(mstatus)
- & AGP_MODE_GET_RATE(mode));
- if (rate & AGP_MODE_V3_RATE_8x)
- rate = AGP_MODE_V3_RATE_8x;
- else
- rate = AGP_MODE_V3_RATE_4x;
- if (bootverbose)
- device_printf(dev, "Setting AGP v3 mode %d\n", rate * 4);
-
- pci_write_config(dev, agp_find_caps(dev) + AGP_COMMAND, 0, 4);
-
- /* Construct the new mode word and tell the hardware */
- command = AGP_MODE_SET_RQ(0, rq);
- command = AGP_MODE_SET_ARQSZ(command, arqsz);
- command = AGP_MODE_SET_CAL(command, cal);
- command = AGP_MODE_SET_SBA(command, sba);
- command = AGP_MODE_SET_FW(command, fw);
- command = AGP_MODE_SET_RATE(command, rate);
- command = AGP_MODE_SET_AGP(command, 1);
- pci_write_config(dev, agp_find_caps(dev) + AGP_COMMAND, command, 4);
- pci_write_config(mdev, agp_find_caps(mdev) + AGP_COMMAND, command, 4);
-
- return 0;
-}
-
-static int
-agp_v2_enable(device_t dev, device_t mdev, u_int32_t mode)
-{
- u_int32_t tstatus, mstatus;
- u_int32_t command;
- int rq, sba, fw, rate;
-
- tstatus = pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4);
- mstatus = pci_read_config(mdev, agp_find_caps(mdev) + AGP_STATUS, 4);
-
- /* Set RQ to the min of mode, tstatus and mstatus */
- rq = AGP_MODE_GET_RQ(mode);
- if (AGP_MODE_GET_RQ(tstatus) < rq)
- rq = AGP_MODE_GET_RQ(tstatus);
- if (AGP_MODE_GET_RQ(mstatus) < rq)
- rq = AGP_MODE_GET_RQ(mstatus);
-
- /* Set SBA if all three can deal with SBA */
- sba = (AGP_MODE_GET_SBA(tstatus)
- & AGP_MODE_GET_SBA(mstatus)
- & AGP_MODE_GET_SBA(mode));
-
- /* Similar for FW */
- fw = (AGP_MODE_GET_FW(tstatus)
- & AGP_MODE_GET_FW(mstatus)
- & AGP_MODE_GET_FW(mode));
-
- /* Figure out the max rate */
- rate = (AGP_MODE_GET_RATE(tstatus)
- & AGP_MODE_GET_RATE(mstatus)
- & AGP_MODE_GET_RATE(mode));
- if (rate & AGP_MODE_V2_RATE_4x)
- rate = AGP_MODE_V2_RATE_4x;
- else if (rate & AGP_MODE_V2_RATE_2x)
- rate = AGP_MODE_V2_RATE_2x;
- else
- rate = AGP_MODE_V2_RATE_1x;
- if (bootverbose)
- device_printf(dev, "Setting AGP v2 mode %d\n", rate);
-
- /* Construct the new mode word and tell the hardware */
- command = AGP_MODE_SET_RQ(0, rq);
- command = AGP_MODE_SET_SBA(command, sba);
- command = AGP_MODE_SET_FW(command, fw);
- command = AGP_MODE_SET_RATE(command, rate);
- command = AGP_MODE_SET_AGP(command, 1);
- pci_write_config(dev, agp_find_caps(dev) + AGP_COMMAND, command, 4);
- pci_write_config(mdev, agp_find_caps(mdev) + AGP_COMMAND, command, 4);
-
- return 0;
-}
-
-int
-agp_generic_enable(device_t dev, u_int32_t mode)
-{
- device_t mdev = agp_find_display();
- u_int32_t tstatus, mstatus;
-
- if (!mdev) {
- AGP_DPF("can't find display\n");
- return ENXIO;
- }
-
- tstatus = pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4);
- mstatus = pci_read_config(mdev, agp_find_caps(mdev) + AGP_STATUS, 4);
-
- /*
- * Check display and bridge for AGP v3 support. AGP v3 allows
- * more variety in topology than v2, e.g. multiple AGP devices
- * attached to one bridge, or multiple AGP bridges in one
- * system. This doesn't attempt to address those situations,
- * but should work fine for a classic single AGP slot system
- * with AGP v3.
- */
- if (AGP_MODE_GET_MODE_3(tstatus) && AGP_MODE_GET_MODE_3(mstatus))
- return (agp_v3_enable(dev, mdev, mode));
- else
- return (agp_v2_enable(dev, mdev, mode));
-}
-
-struct agp_memory *
-agp_generic_alloc_memory(device_t dev, int type, vm_size_t size)
-{
- struct agp_softc *sc = device_get_softc(dev);
- struct agp_memory *mem;
-
- if ((size & (AGP_PAGE_SIZE - 1)) != 0)
- return 0;
-
- if (sc->as_allocated + size > sc->as_maxmem)
- return 0;
-
- if (type != 0) {
- printf("agp_generic_alloc_memory: unsupported type %d\n",
- type);
- return 0;
- }
-
- mem = malloc(sizeof *mem, M_AGP, M_WAITOK);
- mem->am_id = sc->as_nextid++;
- mem->am_size = size;
- mem->am_type = 0;
- mem->am_obj = vm_object_allocate(OBJT_DEFAULT, atop(round_page(size)));
- mem->am_physical = 0;
- mem->am_offset = 0;
- mem->am_is_bound = 0;
- TAILQ_INSERT_TAIL(&sc->as_memory, mem, am_link);
- sc->as_allocated += size;
-
- return mem;
-}
-
-int
-agp_generic_free_memory(device_t dev, struct agp_memory *mem)
-{
- struct agp_softc *sc = device_get_softc(dev);
-
- if (mem->am_is_bound)
- return EBUSY;
-
- sc->as_allocated -= mem->am_size;
- TAILQ_REMOVE(&sc->as_memory, mem, am_link);
- vm_object_deallocate(mem->am_obj);
- free(mem, M_AGP);
- return 0;
-}
-
-int
-agp_generic_bind_memory(device_t dev, struct agp_memory *mem,
- vm_offset_t offset)
-{
- struct agp_softc *sc = device_get_softc(dev);
- vm_offset_t i, j, k;
- vm_page_t m;
- int error;
-
- /* Do some sanity checks first. */
- if (offset < 0 || (offset & (AGP_PAGE_SIZE - 1)) != 0 ||
- offset + mem->am_size > AGP_GET_APERTURE(dev)) {
- device_printf(dev, "binding memory at bad offset %#x\n",
- (int)offset);
- return EINVAL;
- }
-
- /*
- * Allocate the pages early, before acquiring the lock,
- * because vm_page_grab() used with VM_ALLOC_RETRY may
- * block and we can't hold a mutex while blocking.
- */
- VM_OBJECT_LOCK(mem->am_obj);
- for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
- /*
- * Find a page from the object and wire it
- * down. This page will be mapped using one or more
- * entries in the GATT (assuming that PAGE_SIZE >=
- * AGP_PAGE_SIZE. If this is the first call to bind,
- * the pages will be allocated and zeroed.
- */
- m = vm_page_grab(mem->am_obj, OFF_TO_IDX(i),
- VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
- AGP_DPF("found page pa=%#x\n", VM_PAGE_TO_PHYS(m));
- }
- VM_OBJECT_UNLOCK(mem->am_obj);
-
- mtx_lock(&sc->as_lock);
-
- if (mem->am_is_bound) {
- device_printf(dev, "memory already bound\n");
- error = EINVAL;
- VM_OBJECT_LOCK(mem->am_obj);
- goto bad;
- }
-
- /*
- * Bind the individual pages and flush the chipset's
- * TLB.
- *
- * XXX Presumably, this needs to be the pci address on alpha
- * (i.e. use alpha_XXX_dmamap()). I don't have access to any
- * alpha AGP hardware to check.
- */
- VM_OBJECT_LOCK(mem->am_obj);
- for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
- m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(i));
-
- /*
- * Install entries in the GATT, making sure that if
- * AGP_PAGE_SIZE < PAGE_SIZE and mem->am_size is not
- * aligned to PAGE_SIZE, we don't modify too many GATT
- * entries.
- */
- for (j = 0; j < PAGE_SIZE && i + j < mem->am_size;
- j += AGP_PAGE_SIZE) {
- vm_offset_t pa = VM_PAGE_TO_PHYS(m) + j;
- AGP_DPF("binding offset %#x to pa %#x\n",
- offset + i + j, pa);
- error = AGP_BIND_PAGE(dev, offset + i + j, pa);
- if (error) {
- /*
- * Bail out. Reverse all the mappings
- * and unwire the pages.
- */
- vm_page_lock_queues();
- vm_page_wakeup(m);
- vm_page_unlock_queues();
- for (k = 0; k < i + j; k += AGP_PAGE_SIZE)
- AGP_UNBIND_PAGE(dev, offset + k);
- goto bad;
- }
- }
- vm_page_lock_queues();
- vm_page_wakeup(m);
- vm_page_unlock_queues();
- }
- VM_OBJECT_UNLOCK(mem->am_obj);
-
- /*
- * Flush the cpu cache since we are providing a new mapping
- * for these pages.
- */
- agp_flush_cache();
-
- /*
- * Make sure the chipset gets the new mappings.
- */
- AGP_FLUSH_TLB(dev);
-
- mem->am_offset = offset;
- mem->am_is_bound = 1;
-
- mtx_unlock(&sc->as_lock);
-
- return 0;
-bad:
- mtx_unlock(&sc->as_lock);
- VM_OBJECT_LOCK_ASSERT(mem->am_obj, MA_OWNED);
- for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
- m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(i));
- vm_page_lock_queues();
- vm_page_unwire(m, 0);
- vm_page_unlock_queues();
- }
- VM_OBJECT_UNLOCK(mem->am_obj);
-
- return error;
-}
-
-int
-agp_generic_unbind_memory(device_t dev, struct agp_memory *mem)
-{
- struct agp_softc *sc = device_get_softc(dev);
- vm_page_t m;
- int i;
-
- mtx_lock(&sc->as_lock);
-
- if (!mem->am_is_bound) {
- device_printf(dev, "memory is not bound\n");
- mtx_unlock(&sc->as_lock);
- return EINVAL;
- }
-
-
- /*
- * Unbind the individual pages and flush the chipset's
- * TLB. Unwire the pages so they can be swapped.
- */
- for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE)
- AGP_UNBIND_PAGE(dev, mem->am_offset + i);
- VM_OBJECT_LOCK(mem->am_obj);
- for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
- m = vm_page_lookup(mem->am_obj, atop(i));
- vm_page_lock_queues();
- vm_page_unwire(m, 0);
- vm_page_unlock_queues();
- }
- VM_OBJECT_UNLOCK(mem->am_obj);
-
- agp_flush_cache();
- AGP_FLUSH_TLB(dev);
-
- mem->am_offset = 0;
- mem->am_is_bound = 0;
-
- mtx_unlock(&sc->as_lock);
-
- return 0;
-}
-
-/* Helper functions for implementing user/kernel api */
-
-static int
-agp_acquire_helper(device_t dev, enum agp_acquire_state state)
-{
- struct agp_softc *sc = device_get_softc(dev);
-
- if (sc->as_state != AGP_ACQUIRE_FREE)
- return EBUSY;
- sc->as_state = state;
-
- return 0;
-}
-
-static int
-agp_release_helper(device_t dev, enum agp_acquire_state state)
-{
- struct agp_softc *sc = device_get_softc(dev);
-
- if (sc->as_state == AGP_ACQUIRE_FREE)
- return 0;
-
- if (sc->as_state != state)
- return EBUSY;
-
- sc->as_state = AGP_ACQUIRE_FREE;
- return 0;
-}
-
-static struct agp_memory *
-agp_find_memory(device_t dev, int id)
-{
- struct agp_softc *sc = device_get_softc(dev);
- struct agp_memory *mem;
-
- AGP_DPF("searching for memory block %d\n", id);
- TAILQ_FOREACH(mem, &sc->as_memory, am_link) {
- AGP_DPF("considering memory block %d\n", mem->am_id);
- if (mem->am_id == id)
- return mem;
- }
- return 0;
-}
-
-/* Implementation of the userland ioctl api */
-
-static int
-agp_info_user(device_t dev, agp_info *info)
-{
- struct agp_softc *sc = device_get_softc(dev);
-
- bzero(info, sizeof *info);
- info->bridge_id = pci_get_devid(dev);
- info->agp_mode =
- pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4);
- info->aper_base = rman_get_start(sc->as_aperture);
- info->aper_size = AGP_GET_APERTURE(dev) >> 20;
- info->pg_total = info->pg_system = sc->as_maxmem >> AGP_PAGE_SHIFT;
- info->pg_used = sc->as_allocated >> AGP_PAGE_SHIFT;
-
- return 0;
-}
-
-static int
-agp_setup_user(device_t dev, agp_setup *setup)
-{
- return AGP_ENABLE(dev, setup->agp_mode);
-}
-
-static int
-agp_allocate_user(device_t dev, agp_allocate *alloc)
-{
- struct agp_memory *mem;
-
- mem = AGP_ALLOC_MEMORY(dev,
- alloc->type,
- alloc->pg_count << AGP_PAGE_SHIFT);
- if (mem) {
- alloc->key = mem->am_id;
- alloc->physical = mem->am_physical;
- return 0;
- } else {
- return ENOMEM;
- }
-}
-
-static int
-agp_deallocate_user(device_t dev, int id)
-{
- struct agp_memory *mem = agp_find_memory(dev, id);;
-
- if (mem) {
- AGP_FREE_MEMORY(dev, mem);
- return 0;
- } else {
- return ENOENT;
- }
-}
-
-static int
-agp_bind_user(device_t dev, agp_bind *bind)
-{
- struct agp_memory *mem = agp_find_memory(dev, bind->key);
-
- if (!mem)
- return ENOENT;
-
- return AGP_BIND_MEMORY(dev, mem, bind->pg_start << AGP_PAGE_SHIFT);
-}
-
-static int
-agp_unbind_user(device_t dev, agp_unbind *unbind)
-{
- struct agp_memory *mem = agp_find_memory(dev, unbind->key);
-
- if (!mem)
- return ENOENT;
-
- return AGP_UNBIND_MEMORY(dev, mem);
-}
-
-static int
-agp_open(struct cdev *kdev, int oflags, int devtype, struct thread *td)
-{
- device_t dev = KDEV2DEV(kdev);
- struct agp_softc *sc = device_get_softc(dev);
-
- if (!sc->as_isopen) {
- sc->as_isopen = 1;
- device_busy(dev);
- }
-
- return 0;
-}
-
-static int
-agp_close(struct cdev *kdev, int fflag, int devtype, struct thread *td)
-{
- device_t dev = KDEV2DEV(kdev);
- struct agp_softc *sc = device_get_softc(dev);
- struct agp_memory *mem;
-
- /*
- * Clear the GATT and force release on last close
- */
- while ((mem = TAILQ_FIRST(&sc->as_memory)) != 0) {
- if (mem->am_is_bound)
- AGP_UNBIND_MEMORY(dev, mem);
- AGP_FREE_MEMORY(dev, mem);
- }
- if (sc->as_state == AGP_ACQUIRE_USER)
- agp_release_helper(dev, AGP_ACQUIRE_USER);
- sc->as_isopen = 0;
- device_unbusy(dev);
-
- return 0;
-}
-
-static int
-agp_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int fflag, struct thread *td)
-{
- device_t dev = KDEV2DEV(kdev);
-
- switch (cmd) {
- case AGPIOC_INFO:
- return agp_info_user(dev, (agp_info *) data);
-
- case AGPIOC_ACQUIRE:
- return agp_acquire_helper(dev, AGP_ACQUIRE_USER);
-
- case AGPIOC_RELEASE:
- return agp_release_helper(dev, AGP_ACQUIRE_USER);
-
- case AGPIOC_SETUP:
- return agp_setup_user(dev, (agp_setup *)data);
-
- case AGPIOC_ALLOCATE:
- return agp_allocate_user(dev, (agp_allocate *)data);
-
- case AGPIOC_DEALLOCATE:
- return agp_deallocate_user(dev, *(int *) data);
-
- case AGPIOC_BIND:
- return agp_bind_user(dev, (agp_bind *)data);
-
- case AGPIOC_UNBIND:
- return agp_unbind_user(dev, (agp_unbind *)data);
-
- }
-
- return EINVAL;
-}
-
-static int
-agp_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot)
-{
- device_t dev = KDEV2DEV(kdev);
- struct agp_softc *sc = device_get_softc(dev);
-
- if (offset > AGP_GET_APERTURE(dev))
- return -1;
- *paddr = rman_get_start(sc->as_aperture) + offset;
- return 0;
-}
-
-/* Implementation of the kernel api */
-
-device_t
-agp_find_device()
-{
- if (!agp_devclass)
- return 0;
- return devclass_get_device(agp_devclass, 0);
-}
-
-enum agp_acquire_state
-agp_state(device_t dev)
-{
- struct agp_softc *sc = device_get_softc(dev);
- return sc->as_state;
-}
-
-void
-agp_get_info(device_t dev, struct agp_info *info)
-{
- struct agp_softc *sc = device_get_softc(dev);
-
- info->ai_mode =
- pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4);
- info->ai_aperture_base = rman_get_start(sc->as_aperture);
- info->ai_aperture_size = rman_get_size(sc->as_aperture);
- info->ai_aperture_va = (vm_offset_t) rman_get_virtual(sc->as_aperture);
- info->ai_memory_allowed = sc->as_maxmem;
- info->ai_memory_used = sc->as_allocated;
-}
-
-int
-agp_acquire(device_t dev)
-{
- return agp_acquire_helper(dev, AGP_ACQUIRE_KERNEL);
-}
-
-int
-agp_release(device_t dev)
-{
- return agp_release_helper(dev, AGP_ACQUIRE_KERNEL);
-}
-
-int
-agp_enable(device_t dev, u_int32_t mode)
-{
- return AGP_ENABLE(dev, mode);
-}
-
-void *agp_alloc_memory(device_t dev, int type, vm_size_t bytes)
-{
- return (void *) AGP_ALLOC_MEMORY(dev, type, bytes);
-}
-
-void agp_free_memory(device_t dev, void *handle)
-{
- struct agp_memory *mem = (struct agp_memory *) handle;
- AGP_FREE_MEMORY(dev, mem);
-}
-
-int agp_bind_memory(device_t dev, void *handle, vm_offset_t offset)
-{
- struct agp_memory *mem = (struct agp_memory *) handle;
- return AGP_BIND_MEMORY(dev, mem, offset);
-}
-
-int agp_unbind_memory(device_t dev, void *handle)
-{
- struct agp_memory *mem = (struct agp_memory *) handle;
- return AGP_UNBIND_MEMORY(dev, mem);
-}
-
-void agp_memory_info(device_t dev, void *handle, struct
- agp_memory_info *mi)
-{
- struct agp_memory *mem = (struct agp_memory *) handle;
-
- mi->ami_size = mem->am_size;
- mi->ami_physical = mem->am_physical;
- mi->ami_offset = mem->am_offset;
- mi->ami_is_bound = mem->am_is_bound;
-}
diff --git a/sys/dev/agp/agp_ali.c b/sys/dev/agp/agp_ali.c
deleted file mode 100644
index f39476b..0000000
--- a/sys/dev/agp/agp_ali.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_bus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/agppriv.h>
-#include <pci/agpreg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/pmap.h>
-
-struct agp_ali_softc {
- struct agp_softc agp;
- u_int32_t initial_aperture; /* aperture size at startup */
- struct agp_gatt *gatt;
-};
-
-static const char*
-agp_ali_match(device_t dev)
-{
- if (pci_get_class(dev) != PCIC_BRIDGE
- || pci_get_subclass(dev) != PCIS_BRIDGE_HOST)
- return NULL;
-
- if (agp_find_caps(dev) == 0)
- return NULL;
-
- switch (pci_get_devid(dev)) {
- case 0x167110b9:
- return ("Ali M1671 host to AGP bridge");
- case 0x154110b9:
- return ("Ali M1541 host to AGP bridge");
- case 0x162110b9:
- return ("Ali M1621 host to AGP bridge");
- };
-
- return NULL;
-}
-
-static int
-agp_ali_probe(device_t dev)
-{
- const char *desc;
-
- if (resource_disabled("agp", device_get_unit(dev)))
- return (ENXIO);
- desc = agp_ali_match(dev);
- if (desc) {
- device_verbose(dev);
- device_set_desc(dev, desc);
- return BUS_PROBE_DEFAULT;
- }
-
- return ENXIO;
-}
-
-static int
-agp_ali_attach(device_t dev)
-{
- struct agp_ali_softc *sc = device_get_softc(dev);
- struct agp_gatt *gatt;
- int error;
- u_int32_t attbase;
-
- error = agp_generic_attach(dev);
- if (error)
- return error;
-
- sc->initial_aperture = AGP_GET_APERTURE(dev);
- if (sc->initial_aperture == 0) {
- device_printf(dev, "bad initial aperture size, disabling\n");
- return ENXIO;
- }
-
- for (;;) {
- gatt = agp_alloc_gatt(dev);
- if (gatt)
- break;
-
- /*
- * Probably contigmalloc failure. Try reducing the
- * aperture so that the gatt size reduces.
- */
- if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) {
- agp_generic_detach(dev);
- return ENOMEM;
- }
- }
- sc->gatt = gatt;
-
- /* Install the gatt. */
- attbase = pci_read_config(dev, AGP_ALI_ATTBASE, 4);
- pci_write_config(dev, AGP_ALI_ATTBASE, gatt->ag_physical |
- (attbase & 0xfff), 4);
-
- /* Enable the TLB. */
- pci_write_config(dev, AGP_ALI_TLBCTRL, 0x10, 1);
-
- return 0;
-}
-
-static int
-agp_ali_detach(device_t dev)
-{
- struct agp_ali_softc *sc = device_get_softc(dev);
- int error;
- u_int32_t attbase;
-
- error = agp_generic_detach(dev);
- if (error)
- return error;
-
- /* Disable the TLB.. */
- pci_write_config(dev, AGP_ALI_TLBCTRL, 0x90, 1);
-
- /* Put the aperture back the way it started. */
- AGP_SET_APERTURE(dev, sc->initial_aperture);
- attbase = pci_read_config(dev, AGP_ALI_ATTBASE, 4);
- pci_write_config(dev, AGP_ALI_ATTBASE, attbase & 0xfff, 4);
-
- agp_free_gatt(sc->gatt);
- return 0;
-}
-
-#define M 1024*1024
-
-static u_int32_t agp_ali_table[] = {
- 0, /* 0 - invalid */
- 1, /* 1 - invalid */
- 2, /* 2 - invalid */
- 4*M, /* 3 - invalid */
- 8*M, /* 4 - invalid */
- 0, /* 5 - invalid */
- 16*M, /* 6 - invalid */
- 32*M, /* 7 - invalid */
- 64*M, /* 8 - invalid */
- 128*M, /* 9 - invalid */
- 256*M, /* 10 - invalid */
-};
-#define agp_ali_table_size (sizeof(agp_ali_table) / sizeof(agp_ali_table[0]))
-
-static u_int32_t
-agp_ali_get_aperture(device_t dev)
-{
- /*
- * The aperture size is derived from the low bits of attbase.
- * I'm not sure this is correct..
- */
- int i = pci_read_config(dev, AGP_ALI_ATTBASE, 4) & 0xf;
- if (i >= agp_ali_table_size)
- return 0;
- return agp_ali_table[i];
-}
-
-static int
-agp_ali_set_aperture(device_t dev, u_int32_t aperture)
-{
- int i;
- u_int32_t attbase;
-
- for (i = 0; i < agp_ali_table_size; i++)
- if (agp_ali_table[i] == aperture)
- break;
- if (i == agp_ali_table_size)
- return EINVAL;
-
- attbase = pci_read_config(dev, AGP_ALI_ATTBASE, 4);
- pci_write_config(dev, AGP_ALI_ATTBASE, (attbase & ~0xf) | i, 4);
- return 0;
-}
-
-static int
-agp_ali_bind_page(device_t dev, int offset, vm_offset_t physical)
-{
- struct agp_ali_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical;
- return 0;
-}
-
-static int
-agp_ali_unbind_page(device_t dev, int offset)
-{
- struct agp_ali_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return 0;
-}
-
-static void
-agp_ali_flush_tlb(device_t dev)
-{
- pci_write_config(dev, AGP_ALI_TLBCTRL, 0x90, 1);
- pci_write_config(dev, AGP_ALI_TLBCTRL, 0x10, 1);
-}
-
-static device_method_t agp_ali_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, agp_ali_probe),
- DEVMETHOD(device_attach, agp_ali_attach),
- DEVMETHOD(device_detach, agp_ali_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* AGP interface */
- DEVMETHOD(agp_get_aperture, agp_ali_get_aperture),
- DEVMETHOD(agp_set_aperture, agp_ali_set_aperture),
- DEVMETHOD(agp_bind_page, agp_ali_bind_page),
- DEVMETHOD(agp_unbind_page, agp_ali_unbind_page),
- DEVMETHOD(agp_flush_tlb, agp_ali_flush_tlb),
- DEVMETHOD(agp_enable, agp_generic_enable),
- DEVMETHOD(agp_alloc_memory, agp_generic_alloc_memory),
- DEVMETHOD(agp_free_memory, agp_generic_free_memory),
- DEVMETHOD(agp_bind_memory, agp_generic_bind_memory),
- DEVMETHOD(agp_unbind_memory, agp_generic_unbind_memory),
-
- { 0, 0 }
-};
-
-static driver_t agp_ali_driver = {
- "agp",
- agp_ali_methods,
- sizeof(struct agp_ali_softc),
-};
-
-static devclass_t agp_devclass;
-
-DRIVER_MODULE(agp_ali, pci, agp_ali_driver, agp_devclass, 0, 0);
-MODULE_DEPEND(agp_ali, agp, 1, 1, 1);
-MODULE_DEPEND(agp_ali, pci, 1, 1, 1);
diff --git a/sys/dev/agp/agp_amd.c b/sys/dev/agp/agp_amd.c
deleted file mode 100644
index bb1d20e..0000000
--- a/sys/dev/agp/agp_amd.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_bus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/agppriv.h>
-#include <pci/agpreg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/pmap.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-MALLOC_DECLARE(M_AGP);
-
-#define READ2(off) bus_space_read_2(sc->bst, sc->bsh, off)
-#define READ4(off) bus_space_read_4(sc->bst, sc->bsh, off)
-#define WRITE2(off,v) bus_space_write_2(sc->bst, sc->bsh, off, v)
-#define WRITE4(off,v) bus_space_write_4(sc->bst, sc->bsh, off, v)
-
-struct agp_amd_gatt {
- u_int32_t ag_entries;
- u_int32_t *ag_virtual; /* virtual address of gatt */
- vm_offset_t ag_physical;
- u_int32_t *ag_vdir; /* virtual address of page dir */
- vm_offset_t ag_pdir; /* physical address of page dir */
-};
-
-struct agp_amd_softc {
- struct agp_softc agp;
- struct resource *regs; /* memory mapped control registers */
- bus_space_tag_t bst; /* bus_space tag */
- bus_space_handle_t bsh; /* bus_space handle */
- u_int32_t initial_aperture; /* aperture size at startup */
- struct agp_amd_gatt *gatt;
-};
-
-static struct agp_amd_gatt *
-agp_amd_alloc_gatt(device_t dev)
-{
- u_int32_t apsize = AGP_GET_APERTURE(dev);
- u_int32_t entries = apsize >> AGP_PAGE_SHIFT;
- struct agp_amd_gatt *gatt;
- int i, npages, pdir_offset;
-
- if (bootverbose)
- device_printf(dev,
- "allocating GATT for aperture of size %dM\n",
- apsize / (1024*1024));
-
- gatt = malloc(sizeof(struct agp_amd_gatt), M_AGP, M_NOWAIT);
- if (!gatt)
- return 0;
-
- /*
- * The AMD751 uses a page directory to map a non-contiguous
- * gatt so we don't need to use contigmalloc.
- * Malloc individual gatt pages and map them into the page
- * directory.
- */
- gatt->ag_entries = entries;
- gatt->ag_virtual = malloc(entries * sizeof(u_int32_t),
- M_AGP, M_NOWAIT);
- if (!gatt->ag_virtual) {
- if (bootverbose)
- device_printf(dev, "allocation failed\n");
- free(gatt, M_AGP);
- return 0;
- }
- bzero(gatt->ag_virtual, entries * sizeof(u_int32_t));
-
- /*
- * Allocate the page directory.
- */
- gatt->ag_vdir = malloc(AGP_PAGE_SIZE, M_AGP, M_NOWAIT);
- if (!gatt->ag_vdir) {
- if (bootverbose)
- device_printf(dev,
- "failed to allocate page directory\n");
- free(gatt->ag_virtual, M_AGP);
- free(gatt, M_AGP);
- return 0;
- }
- bzero(gatt->ag_vdir, AGP_PAGE_SIZE);
-
- gatt->ag_pdir = vtophys((vm_offset_t) gatt->ag_vdir);
- if(bootverbose)
- device_printf(dev, "gatt -> ag_pdir %#lx\n",
- (u_long)gatt->ag_pdir);
- /*
- * Allocate the gatt pages
- */
- gatt->ag_entries = entries;
- if(bootverbose)
- device_printf(dev, "allocating GATT for %d AGP page entries\n",
- gatt->ag_entries);
-
- gatt->ag_physical = vtophys((vm_offset_t) gatt->ag_virtual);
-
- /*
- * Map the pages of the GATT into the page directory.
- *
- * The GATT page addresses are mapped into the directory offset by
- * an amount dependent on the base address of the aperture. This
- * is and offset into the page directory, not an offset added to
- * the addresses of the gatt pages.
- */
-
- pdir_offset = pci_read_config(dev, AGP_AMD751_APBASE, 4) >> 22;
-
- npages = ((entries * sizeof(u_int32_t) + AGP_PAGE_SIZE - 1)
- >> AGP_PAGE_SHIFT);
-
- for (i = 0; i < npages; i++) {
- vm_offset_t va;
- vm_offset_t pa;
-
- va = ((vm_offset_t) gatt->ag_virtual) + i * AGP_PAGE_SIZE;
- pa = vtophys(va);
- gatt->ag_vdir[i + pdir_offset] = pa | 1;
- }
-
- /*
- * Make sure the chipset can see everything.
- */
- agp_flush_cache();
-
- return gatt;
-}
-
-static void
-agp_amd_free_gatt(struct agp_amd_gatt *gatt)
-{
- free(gatt->ag_virtual, M_AGP);
- free(gatt->ag_vdir, M_AGP);
- free(gatt, M_AGP);
-}
-
-static const char*
-agp_amd_match(device_t dev)
-{
- if (pci_get_class(dev) != PCIC_BRIDGE
- || pci_get_subclass(dev) != PCIS_BRIDGE_HOST)
- return NULL;
-
- if (agp_find_caps(dev) == 0)
- return NULL;
-
- switch (pci_get_devid(dev)) {
- case 0x70061022:
- return ("AMD 751 host to AGP bridge");
- case 0x700e1022:
- return ("AMD 761 host to AGP bridge");
- case 0x700c1022:
- return ("AMD 762 host to AGP bridge");
- };
-
- return NULL;
-}
-
-static int
-agp_amd_probe(device_t dev)
-{
- const char *desc;
-
- if (resource_disabled("agp", device_get_unit(dev)))
- return (ENXIO);
- desc = agp_amd_match(dev);
- if (desc) {
- device_verbose(dev);
- device_set_desc(dev, desc);
- return BUS_PROBE_DEFAULT;
- }
-
- return ENXIO;
-}
-
-static int
-agp_amd_attach(device_t dev)
-{
- struct agp_amd_softc *sc = device_get_softc(dev);
- struct agp_amd_gatt *gatt;
- int error, rid;
-
- error = agp_generic_attach(dev);
- if (error)
- return error;
-
- rid = AGP_AMD751_REGISTERS;
- sc->regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
- RF_ACTIVE);
- if (!sc->regs) {
- agp_generic_detach(dev);
- return ENOMEM;
- }
-
- sc->bst = rman_get_bustag(sc->regs);
- sc->bsh = rman_get_bushandle(sc->regs);
-
- sc->initial_aperture = AGP_GET_APERTURE(dev);
-
- for (;;) {
- gatt = agp_amd_alloc_gatt(dev);
- if (gatt)
- break;
-
- /*
- * Probably contigmalloc failure. Try reducing the
- * aperture so that the gatt size reduces.
- */
- if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2))
- return ENOMEM;
- }
- sc->gatt = gatt;
-
- /* Install the gatt. */
- WRITE4(AGP_AMD751_ATTBASE, gatt->ag_pdir);
-
- /* Enable synchronisation between host and agp. */
- pci_write_config(dev,
- AGP_AMD751_MODECTRL,
- AGP_AMD751_MODECTRL_SYNEN, 1);
-
- /* Set indexing mode for two-level and enable page dir cache */
- pci_write_config(dev,
- AGP_AMD751_MODECTRL2,
- AGP_AMD751_MODECTRL2_GPDCE, 1);
-
- /* Enable the TLB and flush */
- WRITE2(AGP_AMD751_STATUS,
- READ2(AGP_AMD751_STATUS) | AGP_AMD751_STATUS_GCE);
- AGP_FLUSH_TLB(dev);
-
- return 0;
-}
-
-static int
-agp_amd_detach(device_t dev)
-{
- struct agp_amd_softc *sc = device_get_softc(dev);
- int error;
-
- error = agp_generic_detach(dev);
- if (error)
- return error;
-
- /* Disable the TLB.. */
- WRITE2(AGP_AMD751_STATUS,
- READ2(AGP_AMD751_STATUS) & ~AGP_AMD751_STATUS_GCE);
-
- /* Disable host-agp sync */
- pci_write_config(dev, AGP_AMD751_MODECTRL, 0x00, 1);
-
- /* Clear the GATT base */
- WRITE4(AGP_AMD751_ATTBASE, 0);
-
- /* Put the aperture back the way it started. */
- AGP_SET_APERTURE(dev, sc->initial_aperture);
-
- agp_amd_free_gatt(sc->gatt);
-
- bus_release_resource(dev, SYS_RES_MEMORY,
- AGP_AMD751_REGISTERS, sc->regs);
-
- return 0;
-}
-
-static u_int32_t
-agp_amd_get_aperture(device_t dev)
-{
- int vas;
-
- /*
- * The aperture size is equal to 32M<<vas.
- */
- vas = (pci_read_config(dev, AGP_AMD751_APCTRL, 1) & 0x06) >> 1;
- return (32*1024*1024) << vas;
-}
-
-static int
-agp_amd_set_aperture(device_t dev, u_int32_t aperture)
-{
- int vas;
-
- /*
- * Check for a power of two and make sure its within the
- * programmable range.
- */
- if (aperture & (aperture - 1)
- || aperture < 32*1024*1024
- || aperture > 2U*1024*1024*1024)
- return EINVAL;
-
- vas = ffs(aperture / 32*1024*1024) - 1;
-
- /*
- * While the size register is bits 1-3 of APCTRL, bit 0 must be
- * set for the size value to be 'valid'
- */
- pci_write_config(dev, AGP_AMD751_APCTRL,
- (((pci_read_config(dev, AGP_AMD751_APCTRL, 1) & ~0x06)
- | ((vas << 1) | 1))), 1);
-
- return 0;
-}
-
-static int
-agp_amd_bind_page(device_t dev, int offset, vm_offset_t physical)
-{
- struct agp_amd_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical | 1;
-
- /* invalidate the cache */
- AGP_FLUSH_TLB(dev);
- return 0;
-}
-
-static int
-agp_amd_unbind_page(device_t dev, int offset)
-{
- struct agp_amd_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return 0;
-}
-
-static void
-agp_amd_flush_tlb(device_t dev)
-{
- struct agp_amd_softc *sc = device_get_softc(dev);
-
- /* Set the cache invalidate bit and wait for the chipset to clear */
- WRITE4(AGP_AMD751_TLBCTRL, 1);
- do {
- DELAY(1);
- } while (READ4(AGP_AMD751_TLBCTRL));
-}
-
-static device_method_t agp_amd_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, agp_amd_probe),
- DEVMETHOD(device_attach, agp_amd_attach),
- DEVMETHOD(device_detach, agp_amd_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* AGP interface */
- DEVMETHOD(agp_get_aperture, agp_amd_get_aperture),
- DEVMETHOD(agp_set_aperture, agp_amd_set_aperture),
- DEVMETHOD(agp_bind_page, agp_amd_bind_page),
- DEVMETHOD(agp_unbind_page, agp_amd_unbind_page),
- DEVMETHOD(agp_flush_tlb, agp_amd_flush_tlb),
- DEVMETHOD(agp_enable, agp_generic_enable),
- DEVMETHOD(agp_alloc_memory, agp_generic_alloc_memory),
- DEVMETHOD(agp_free_memory, agp_generic_free_memory),
- DEVMETHOD(agp_bind_memory, agp_generic_bind_memory),
- DEVMETHOD(agp_unbind_memory, agp_generic_unbind_memory),
-
- { 0, 0 }
-};
-
-static driver_t agp_amd_driver = {
- "agp",
- agp_amd_methods,
- sizeof(struct agp_amd_softc),
-};
-
-static devclass_t agp_devclass;
-
-DRIVER_MODULE(agp_amd, pci, agp_amd_driver, agp_devclass, 0, 0);
-MODULE_DEPEND(agp_amd, agp, 1, 1, 1);
-MODULE_DEPEND(agp_amd, pci, 1, 1, 1);
diff --git a/sys/dev/agp/agp_amd64.c b/sys/dev/agp/agp_amd64.c
deleted file mode 100644
index efa71a5..0000000
--- a/sys/dev/agp/agp_amd64.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*-
- * Copyright (c) 2004 Jung-uk Kim
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_bus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/agppriv.h>
-#include <pci/agpreg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/pmap.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-/* XXX */
-extern void pci_cfgregwrite(int, int, int, int, uint32_t, int);
-extern uint32_t pci_cfgregread(int, int, int, int, int);
-
-MALLOC_DECLARE(M_AGP);
-
-#define AMD64_MAX_MCTRL 8
-
-struct agp_amd64_softc {
- struct agp_softc agp;
- uint32_t initial_aperture; /* aperture size at startup */
- struct agp_gatt *gatt;
- int mctrl[AMD64_MAX_MCTRL];
- int n_mctrl;
-};
-
-static const char*
-agp_amd64_match(device_t dev)
-{
- if (pci_get_class(dev) != PCIC_BRIDGE
- || pci_get_subclass(dev) != PCIS_BRIDGE_HOST)
- return NULL;
-
- if (agp_find_caps(dev) == 0)
- return NULL;
-
- switch (pci_get_devid(dev)) {
- case 0x74541022:
- return ("AMD 8151 AGP graphics tunnel");
- case 0x07551039:
- return ("SiS 755 host to AGP bridge");
- case 0x00d110de:
- return ("NVIDIA nForce3 AGP Controller");
- case 0x00e110de:
- return ("NVIDIA nForce3-250 AGP Controller");
- case 0x02041106:
- return ("VIA 8380 host to PCI bridge");
- case 0x02821106:
- return ("VIA K8T800Pro host to PCI bridge");
- case 0x31881106:
- return ("VIA 8385 host to PCI bridge");
- };
-
- return NULL;
-}
-
-static int
-agp_amd64_probe(device_t dev)
-{
- const char *desc;
-
- if (resource_disabled("agp", device_get_unit(dev)))
- return ENXIO;
- if ((desc = agp_amd64_match(dev))) {
- device_verbose(dev);
- device_set_desc(dev, desc);
- return BUS_PROBE_DEFAULT;
- }
-
- return ENXIO;
-}
-
-static int
-agp_amd64_attach(device_t dev)
-{
- struct agp_amd64_softc *sc = device_get_softc(dev);
- struct agp_gatt *gatt;
- int i, n, error;
-
- for (i = 0, n = 0; i < PCI_SLOTMAX && n < AMD64_MAX_MCTRL; i++)
- if (pci_cfgregread(0, i, 3, 0, 4) == 0x11031022) {
- sc->mctrl[n] = i;
- n++;
- }
-
- if (n == 0)
- return ENXIO;
-
- sc->n_mctrl = n;
-
- if (bootverbose)
- printf("AMD64: %d Misc. Control unit(s) found.\n", sc->n_mctrl);
-
- if ((error = agp_generic_attach(dev)))
- return error;
-
- sc->initial_aperture = AGP_GET_APERTURE(dev);
-
- for (;;) {
- gatt = agp_alloc_gatt(dev);
- if (gatt)
- break;
-
- /*
- * Probably contigmalloc failure. Try reducing the
- * aperture so that the gatt size reduces.
- */
- if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) {
- agp_generic_detach(dev);
- return ENOMEM;
- }
- }
- sc->gatt = gatt;
-
- /* Install the gatt and enable aperture. */
- for (i = 0; i < sc->n_mctrl; i++) {
- pci_cfgregwrite(0, sc->mctrl[i], 3, AGP_AMD64_ATTBASE,
- (uint32_t)(gatt->ag_physical >> 8) & AGP_AMD64_ATTBASE_MASK,
- 4);
- pci_cfgregwrite(0, sc->mctrl[i], 3, AGP_AMD64_APCTRL,
- (pci_cfgregread(0, sc->mctrl[i], 3, AGP_AMD64_APCTRL, 4) |
- AGP_AMD64_APCTRL_GARTEN) &
- ~(AGP_AMD64_APCTRL_DISGARTCPU | AGP_AMD64_APCTRL_DISGARTIO),
- 4);
- }
-
- agp_flush_cache();
-
- return 0;
-}
-
-static int
-agp_amd64_detach(device_t dev)
-{
- struct agp_amd64_softc *sc = device_get_softc(dev);
- int i, error;
-
- if ((error = agp_generic_detach(dev)))
- return error;
-
- for (i = 0; i < sc->n_mctrl; i++)
- pci_cfgregwrite(0, sc->mctrl[i], 3, AGP_AMD64_APCTRL,
- pci_cfgregread(0, sc->mctrl[i], 3, AGP_AMD64_APCTRL, 4) &
- ~AGP_AMD64_APCTRL_GARTEN, 4);
-
- AGP_SET_APERTURE(dev, sc->initial_aperture);
- agp_free_gatt(sc->gatt);
-
- return 0;
-}
-
-static uint32_t agp_amd64_table[] = {
- 0x02000000, /* 32 MB */
- 0x04000000, /* 64 MB */
- 0x08000000, /* 128 MB */
- 0x10000000, /* 256 MB */
- 0x20000000, /* 512 MB */
- 0x40000000, /* 1024 MB */
- 0x80000000, /* 2048 MB */
-};
-
-#define AGP_AMD64_TABLE_SIZE \
- (sizeof(agp_amd64_table) / sizeof(agp_amd64_table[0]))
-
-static uint32_t
-agp_amd64_get_aperture(device_t dev)
-{
- struct agp_amd64_softc *sc = device_get_softc(dev);
- uint32_t i;
-
- i = (pci_cfgregread(0, sc->mctrl[0], 3, AGP_AMD64_APCTRL, 4) &
- AGP_AMD64_APCTRL_SIZE_MASK) >> 1;
-
- if (i >= AGP_AMD64_TABLE_SIZE)
- return 0;
-
- return (agp_amd64_table[i]);
-}
-
-static int
-agp_amd64_set_aperture(device_t dev, uint32_t aperture)
-{
- struct agp_amd64_softc *sc = device_get_softc(dev);
- uint32_t i;
- int j;
-
- for (i = 0; i < AGP_AMD64_TABLE_SIZE; i++)
- if (agp_amd64_table[i] == aperture)
- break;
- if (i == AGP_AMD64_TABLE_SIZE)
- return EINVAL;
-
- for (j = 0; j < sc->n_mctrl; j++)
- pci_cfgregwrite(0, sc->mctrl[j], 3, AGP_AMD64_APCTRL,
- (pci_cfgregread(0, sc->mctrl[j], 3, AGP_AMD64_APCTRL, 4) &
- ~(AGP_AMD64_APCTRL_SIZE_MASK)) | (i << 1), 4);
-
- return 0;
-}
-
-static int
-agp_amd64_bind_page(device_t dev, int offset, vm_offset_t physical)
-{
- struct agp_amd64_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical;
- return 0;
-}
-
-static int
-agp_amd64_unbind_page(device_t dev, int offset)
-{
- struct agp_amd64_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return 0;
-}
-
-static void
-agp_amd64_flush_tlb(device_t dev)
-{
- struct agp_amd64_softc *sc = device_get_softc(dev);
- int i;
-
- for (i = 0; i < sc->n_mctrl; i++)
- pci_cfgregwrite(0, sc->mctrl[i], 3, AGP_AMD64_CACHECTRL,
- pci_cfgregread(0, sc->mctrl[i], 3, AGP_AMD64_CACHECTRL, 4) |
- AGP_AMD64_CACHECTRL_INVGART, 4);
-}
-
-static device_method_t agp_amd64_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, agp_amd64_probe),
- DEVMETHOD(device_attach, agp_amd64_attach),
- DEVMETHOD(device_detach, agp_amd64_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* AGP interface */
- DEVMETHOD(agp_get_aperture, agp_amd64_get_aperture),
- DEVMETHOD(agp_set_aperture, agp_amd64_set_aperture),
- DEVMETHOD(agp_bind_page, agp_amd64_bind_page),
- DEVMETHOD(agp_unbind_page, agp_amd64_unbind_page),
- DEVMETHOD(agp_flush_tlb, agp_amd64_flush_tlb),
- DEVMETHOD(agp_enable, agp_generic_enable),
- DEVMETHOD(agp_alloc_memory, agp_generic_alloc_memory),
- DEVMETHOD(agp_free_memory, agp_generic_free_memory),
- DEVMETHOD(agp_bind_memory, agp_generic_bind_memory),
- DEVMETHOD(agp_unbind_memory, agp_generic_unbind_memory),
-
- { 0, 0 }
-};
-
-static driver_t agp_amd64_driver = {
- "agp",
- agp_amd64_methods,
- sizeof(struct agp_amd64_softc),
-};
-
-static devclass_t agp_devclass;
-
-DRIVER_MODULE(agp_amd64, pci, agp_amd64_driver, agp_devclass, 0, 0);
-MODULE_DEPEND(agp_amd64, agp, 1, 1, 1);
-MODULE_DEPEND(agp_amd64, pci, 1, 1, 1);
diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c
deleted file mode 100644
index 3cb8fd4..0000000
--- a/sys/dev/agp/agp_i810.c
+++ /dev/null
@@ -1,751 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * Copyright (c) 2000 Ruslan Ermilov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*
- * Fixes for 830/845G support: David Dawes <dawes@xfree86.org>
- * 852GM/855GM/865G support added by David Dawes <dawes@xfree86.org>
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_bus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/agppriv.h>
-#include <pci/agpreg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/vm_page.h>
-#include <vm/vm_pageout.h>
-#include <vm/pmap.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-MALLOC_DECLARE(M_AGP);
-
-#define READ1(off) bus_space_read_1(sc->bst, sc->bsh, off)
-#define READ4(off) bus_space_read_4(sc->bst, sc->bsh, off)
-#define WRITE4(off,v) bus_space_write_4(sc->bst, sc->bsh, off, v)
-
-#define CHIP_I810 0 /* i810/i815 */
-#define CHIP_I830 1 /* 830M/845G */
-#define CHIP_I855 2 /* 852GM/855GM/865G */
-
-struct agp_i810_softc {
- struct agp_softc agp;
- u_int32_t initial_aperture; /* aperture size at startup */
- struct agp_gatt *gatt;
- int chiptype; /* i810-like or i830 */
- u_int32_t dcache_size; /* i810 only */
- u_int32_t stolen; /* number of i830/845 gtt entries for stolen memory */
- device_t bdev; /* bridge device */
- struct resource *regs; /* memory mapped GC registers */
- bus_space_tag_t bst; /* bus_space tag */
- bus_space_handle_t bsh; /* bus_space handle */
-};
-
-static const char*
-agp_i810_match(device_t dev)
-{
- if (pci_get_class(dev) != PCIC_DISPLAY
- || pci_get_subclass(dev) != PCIS_DISPLAY_VGA)
- return NULL;
-
- switch (pci_get_devid(dev)) {
- case 0x71218086:
- return ("Intel 82810 (i810 GMCH) SVGA controller");
-
- case 0x71238086:
- return ("Intel 82810-DC100 (i810-DC100 GMCH) SVGA controller");
-
- case 0x71258086:
- return ("Intel 82810E (i810E GMCH) SVGA controller");
-
- case 0x11328086:
- return ("Intel 82815 (i815 GMCH) SVGA controller");
-
- case 0x35778086:
- return ("Intel 82830M (830M GMCH) SVGA controller");
-
- case 0x25628086:
- return ("Intel 82845G (845G GMCH) SVGA controller");
-
- case 0x35828086:
- switch (pci_read_config(dev, AGP_I85X_CAPID, 1)) {
- case AGP_I855_GME:
- return ("Intel 82855GME (855GME GMCH) SVGA controller");
-
- case AGP_I855_GM:
- return ("Intel 82855GM (855GM GMCH) SVGA controller");
-
- case AGP_I852_GME:
- return ("Intel 82852GME (852GME GMCH) SVGA controller");
-
- case AGP_I852_GM:
- return ("Intel 82852GM (852GM GMCH) SVGA controller");
-
- default:
- return ("Intel 8285xM (85xGM GMCH) SVGA controller");
- }
-
- case 0x25728086:
- return ("Intel 82865G (865G GMCH) SVGA controller");
- };
-
- return NULL;
-}
-
-/*
- * Find bridge device.
- */
-static device_t
-agp_i810_find_bridge(device_t dev)
-{
- device_t *children, child;
- int nchildren, i;
- u_int32_t devid;
-
- /*
- * Calculate bridge device's ID.
- */
- devid = pci_get_devid(dev);
- switch (devid) {
- case 0x71218086:
- case 0x71238086:
- case 0x71258086:
- devid -= 0x10000;
- break;
-
- case 0x11328086:
- case 0x35778086:
- case 0x25628086:
- case 0x35828086:
- case 0x25728086:
- devid -= 0x20000;
- break;
- };
- if (device_get_children(device_get_parent(dev), &children, &nchildren))
- return 0;
-
- for (i = 0; i < nchildren; i++) {
- child = children[i];
-
- if (pci_get_devid(child) == devid) {
- free(children, M_TEMP);
- return child;
- }
- }
- free(children, M_TEMP);
- return 0;
-}
-
-static int
-agp_i810_probe(device_t dev)
-{
- const char *desc;
-
- if (resource_disabled("agp", device_get_unit(dev)))
- return (ENXIO);
- desc = agp_i810_match(dev);
- if (desc) {
- device_t bdev;
- u_int8_t smram;
- unsigned int gcc1;
- int devid = pci_get_devid(dev);
-
- bdev = agp_i810_find_bridge(dev);
- if (!bdev) {
- if (bootverbose)
- printf("I810: can't find bridge device\n");
- return ENXIO;
- }
-
- /*
- * checking whether internal graphics device has been activated.
- */
- switch (devid) {
- /* i810 */
- case 0x71218086:
- case 0x71238086:
- case 0x71258086:
- case 0x11328086:
- smram = pci_read_config(bdev, AGP_I810_SMRAM, 1);
- if ((smram & AGP_I810_SMRAM_GMS)
- == AGP_I810_SMRAM_GMS_DISABLED) {
- if (bootverbose)
- printf("I810: disabled, not probing\n");
- return ENXIO;
- }
- break;
-
- /* i830 */
- case 0x35778086:
- case 0x35828086:
- case 0x25628086:
- case 0x25728086:
- gcc1 = pci_read_config(bdev, AGP_I830_GCC1, 1);
- if ((gcc1 & AGP_I830_GCC1_DEV2) == AGP_I830_GCC1_DEV2_DISABLED) {
- if (bootverbose)
- printf("I830: disabled, not probing\n");
- return ENXIO;
- }
- break;
-
- default:
- return ENXIO;
- }
-
- device_verbose(dev);
- device_set_desc(dev, desc);
- return BUS_PROBE_DEFAULT;
- }
-
- return ENXIO;
-}
-
-static int
-agp_i810_attach(device_t dev)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
- struct agp_gatt *gatt;
- int error, rid;
-
- sc->bdev = agp_i810_find_bridge(dev);
- if (!sc->bdev)
- return ENOENT;
-
- error = agp_generic_attach(dev);
- if (error)
- return error;
-
- switch (pci_get_devid(dev)) {
- case 0x71218086:
- case 0x71238086:
- case 0x71258086:
- case 0x11328086:
- sc->chiptype = CHIP_I810;
- break;
- case 0x35778086:
- case 0x25628086:
- sc->chiptype = CHIP_I830;
- break;
- case 0x35828086:
- case 0x25728086:
- sc->chiptype = CHIP_I855;
- break;
- };
-
- /* Same for i810 and i830 */
- rid = AGP_I810_MMADR;
- sc->regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
- RF_ACTIVE);
- if (!sc->regs) {
- agp_generic_detach(dev);
- return ENOMEM;
- }
- sc->bst = rman_get_bustag(sc->regs);
- sc->bsh = rman_get_bushandle(sc->regs);
-
- sc->initial_aperture = AGP_GET_APERTURE(dev);
-
- gatt = malloc( sizeof(struct agp_gatt), M_AGP, M_NOWAIT);
- if (!gatt) {
- agp_generic_detach(dev);
- return ENOMEM;
- }
- sc->gatt = gatt;
-
- gatt->ag_entries = AGP_GET_APERTURE(dev) >> AGP_PAGE_SHIFT;
-
- if ( sc->chiptype == CHIP_I810 ) {
- /* Some i810s have on-chip memory called dcache */
- if (READ1(AGP_I810_DRT) & AGP_I810_DRT_POPULATED)
- sc->dcache_size = 4 * 1024 * 1024;
- else
- sc->dcache_size = 0;
-
- /* According to the specs the gatt on the i810 must be 64k */
- gatt->ag_virtual = contigmalloc( 64 * 1024, M_AGP, 0,
- 0, ~0, PAGE_SIZE, 0);
- if (!gatt->ag_virtual) {
- if (bootverbose)
- device_printf(dev, "contiguous allocation failed\n");
- free(gatt, M_AGP);
- agp_generic_detach(dev);
- return ENOMEM;
- }
- bzero(gatt->ag_virtual, gatt->ag_entries * sizeof(u_int32_t));
-
- gatt->ag_physical = vtophys((vm_offset_t) gatt->ag_virtual);
- agp_flush_cache();
- /* Install the GATT. */
- WRITE4(AGP_I810_PGTBL_CTL, gatt->ag_physical | 1);
- } else if ( sc->chiptype == CHIP_I830 ) {
- /* The i830 automatically initializes the 128k gatt on boot. */
- unsigned int gcc1, pgtblctl;
-
- gcc1 = pci_read_config(sc->bdev, AGP_I830_GCC1, 1);
- switch (gcc1 & AGP_I830_GCC1_GMS) {
- case AGP_I830_GCC1_GMS_STOLEN_512:
- sc->stolen = (512 - 132) * 1024 / 4096;
- break;
- case AGP_I830_GCC1_GMS_STOLEN_1024:
- sc->stolen = (1024 - 132) * 1024 / 4096;
- break;
- case AGP_I830_GCC1_GMS_STOLEN_8192:
- sc->stolen = (8192 - 132) * 1024 / 4096;
- break;
- default:
- sc->stolen = 0;
- device_printf(dev, "unknown memory configuration, disabling\n");
- agp_generic_detach(dev);
- return EINVAL;
- }
- if (sc->stolen > 0)
- device_printf(dev, "detected %dk stolen memory\n", sc->stolen * 4);
- device_printf(dev, "aperture size is %dM\n", sc->initial_aperture / 1024 / 1024);
-
- /* GATT address is already in there, make sure it's enabled */
- pgtblctl = READ4(AGP_I810_PGTBL_CTL);
- pgtblctl |= 1;
- WRITE4(AGP_I810_PGTBL_CTL, pgtblctl);
-
- gatt->ag_physical = pgtblctl & ~1;
- } else { /* CHIP_I855 */
- /* The i855 automatically initializes the 128k gatt on boot. */
- unsigned int gcc1, pgtblctl;
-
- gcc1 = pci_read_config(sc->bdev, AGP_I855_GCC1, 1);
- switch (gcc1 & AGP_I855_GCC1_GMS) {
- case AGP_I855_GCC1_GMS_STOLEN_1M:
- sc->stolen = (1024 - 132) * 1024 / 4096;
- break;
- case AGP_I855_GCC1_GMS_STOLEN_4M:
- sc->stolen = (4096 - 132) * 1024 / 4096;
- break;
- case AGP_I855_GCC1_GMS_STOLEN_8M:
- sc->stolen = (8192 - 132) * 1024 / 4096;
- break;
- case AGP_I855_GCC1_GMS_STOLEN_16M:
- sc->stolen = (16384 - 132) * 1024 / 4096;
- break;
- case AGP_I855_GCC1_GMS_STOLEN_32M:
- sc->stolen = (32768 - 132) * 1024 / 4096;
- break;
- default:
- sc->stolen = 0;
- device_printf(dev, "unknown memory configuration, disabling\n");
- agp_generic_detach(dev);
- return EINVAL;
- }
- if (sc->stolen > 0)
- device_printf(dev, "detected %dk stolen memory\n", sc->stolen * 4);
- device_printf(dev, "aperture size is %dM\n", sc->initial_aperture / 1024 / 1024);
-
- /* GATT address is already in there, make sure it's enabled */
- pgtblctl = READ4(AGP_I810_PGTBL_CTL);
- pgtblctl |= 1;
- WRITE4(AGP_I810_PGTBL_CTL, pgtblctl);
-
- gatt->ag_physical = pgtblctl & ~1;
- }
-
- /* Add a device for the drm to attach to */
- if (!device_add_child( dev, "drmsub", -1 ))
- printf("out of memory...\n");
-
- return bus_generic_attach(dev);
-}
-
-static int
-agp_i810_detach(device_t dev)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
- int error;
- device_t child;
-
- error = agp_generic_detach(dev);
- if (error)
- return error;
-
- /* Clear the GATT base. */
- if ( sc->chiptype == CHIP_I810 ) {
- WRITE4(AGP_I810_PGTBL_CTL, 0);
- } else {
- unsigned int pgtblctl;
- pgtblctl = READ4(AGP_I810_PGTBL_CTL);
- pgtblctl &= ~1;
- WRITE4(AGP_I810_PGTBL_CTL, pgtblctl);
- }
-
- /* Put the aperture back the way it started. */
- AGP_SET_APERTURE(dev, sc->initial_aperture);
-
- if ( sc->chiptype == CHIP_I810 ) {
- contigfree(sc->gatt->ag_virtual, 64 * 1024, M_AGP);
- }
- free(sc->gatt, M_AGP);
-
- bus_release_resource(dev, SYS_RES_MEMORY,
- AGP_I810_MMADR, sc->regs);
-
- child = device_find_child( dev, "drmsub", 0 );
- if (child)
- device_delete_child( dev, child );
-
- return 0;
-}
-
-static u_int32_t
-agp_i810_get_aperture(device_t dev)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
-
- if ( sc->chiptype == CHIP_I810 ) {
- u_int16_t miscc;
- miscc = pci_read_config(sc->bdev, AGP_I810_MISCC, 2);
- if ((miscc & AGP_I810_MISCC_WINSIZE) == AGP_I810_MISCC_WINSIZE_32)
- return 32 * 1024 * 1024;
- else
- return 64 * 1024 * 1024;
- } else if ( sc->chiptype == CHIP_I830 ) {
- unsigned int gcc1;
-
- gcc1 = pci_read_config(sc->bdev, AGP_I830_GCC1, 2);
- if ((gcc1 & AGP_I830_GCC1_GMASIZE) == AGP_I830_GCC1_GMASIZE_64)
- return 64 * 1024 * 1024;
- else
- return 128 * 1024 * 1024;
- } else { /* CHIP_I855 */
- return 128 * 1024 * 1024;
- }
-}
-
-static int
-agp_i810_set_aperture(device_t dev, u_int32_t aperture)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
- u_int16_t miscc;
-
- if ( sc->chiptype == CHIP_I810 ) {
- /*
- * Double check for sanity.
- */
- if (aperture != 32 * 1024 * 1024 && aperture != 64 * 1024 * 1024) {
- device_printf(dev, "bad aperture size %d\n", aperture);
- return EINVAL;
- }
-
- miscc = pci_read_config(sc->bdev, AGP_I810_MISCC, 2);
- miscc &= ~AGP_I810_MISCC_WINSIZE;
- if (aperture == 32 * 1024 * 1024)
- miscc |= AGP_I810_MISCC_WINSIZE_32;
- else
- miscc |= AGP_I810_MISCC_WINSIZE_64;
-
- pci_write_config(sc->bdev, AGP_I810_MISCC, miscc, 2);
- } else if ( sc->chiptype == CHIP_I830 ) {
- unsigned int gcc1;
-
- if (aperture != 64 * 1024 * 1024 && aperture != 128 * 1024 * 1024) {
- device_printf(dev, "bad aperture size %d\n", aperture);
- return EINVAL;
- }
- gcc1 = pci_read_config(sc->bdev, AGP_I830_GCC1, 2);
- gcc1 &= ~AGP_I830_GCC1_GMASIZE;
- if (aperture == 64 * 1024 * 1024)
- gcc1 |= AGP_I830_GCC1_GMASIZE_64;
- else
- gcc1 |= AGP_I830_GCC1_GMASIZE_128;
-
- pci_write_config(sc->bdev, AGP_I830_GCC1, gcc1, 2);
- } else { /* CHIP_I855 */
- if (aperture != 128 * 1024 * 1024) {
- device_printf(dev, "bad aperture size %d\n", aperture);
- return EINVAL;
- }
- }
-
- return 0;
-}
-
-static int
-agp_i810_bind_page(device_t dev, int offset, vm_offset_t physical)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT)) {
- device_printf(dev, "failed: offset is 0x%08x, shift is %d, entries is %d\n", offset, AGP_PAGE_SHIFT, sc->gatt->ag_entries);
- return EINVAL;
- }
-
- if ( sc->chiptype != CHIP_I810 ) {
- if ( (offset >> AGP_PAGE_SHIFT) < sc->stolen ) {
- device_printf(dev, "trying to bind into stolen memory");
- return EINVAL;
- }
- }
-
- WRITE4(AGP_I810_GTT + (offset >> AGP_PAGE_SHIFT) * 4, physical | 1);
- return 0;
-}
-
-static int
-agp_i810_unbind_page(device_t dev, int offset)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- if ( sc->chiptype != CHIP_I810 ) {
- if ( (offset >> AGP_PAGE_SHIFT) < sc->stolen ) {
- device_printf(dev, "trying to unbind from stolen memory");
- return EINVAL;
- }
- }
-
- WRITE4(AGP_I810_GTT + (offset >> AGP_PAGE_SHIFT) * 4, 0);
- return 0;
-}
-
-/*
- * Writing via memory mapped registers already flushes all TLBs.
- */
-static void
-agp_i810_flush_tlb(device_t dev)
-{
-}
-
-static int
-agp_i810_enable(device_t dev, u_int32_t mode)
-{
-
- return 0;
-}
-
-static struct agp_memory *
-agp_i810_alloc_memory(device_t dev, int type, vm_size_t size)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
- struct agp_memory *mem;
-
- if ((size & (AGP_PAGE_SIZE - 1)) != 0)
- return 0;
-
- if (sc->agp.as_allocated + size > sc->agp.as_maxmem)
- return 0;
-
- if (type == 1) {
- /*
- * Mapping local DRAM into GATT.
- */
- if ( sc->chiptype != CHIP_I810 )
- return 0;
- if (size != sc->dcache_size)
- return 0;
- } else if (type == 2) {
- /*
- * Bogus mapping of a single page for the hardware cursor.
- */
- if (size != AGP_PAGE_SIZE)
- return 0;
- }
-
- mem = malloc(sizeof *mem, M_AGP, M_WAITOK);
- mem->am_id = sc->agp.as_nextid++;
- mem->am_size = size;
- mem->am_type = type;
- if (type != 1)
- mem->am_obj = vm_object_allocate(OBJT_DEFAULT,
- atop(round_page(size)));
- else
- mem->am_obj = 0;
-
- if (type == 2) {
- /*
- * Allocate and wire down the page now so that we can
- * get its physical address.
- */
- vm_page_t m;
-
- VM_OBJECT_LOCK(mem->am_obj);
- m = vm_page_grab(mem->am_obj, 0, VM_ALLOC_NOBUSY |
- VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
- VM_OBJECT_UNLOCK(mem->am_obj);
- mem->am_physical = VM_PAGE_TO_PHYS(m);
- } else {
- mem->am_physical = 0;
- }
-
- mem->am_offset = 0;
- mem->am_is_bound = 0;
- TAILQ_INSERT_TAIL(&sc->agp.as_memory, mem, am_link);
- sc->agp.as_allocated += size;
-
- return mem;
-}
-
-static int
-agp_i810_free_memory(device_t dev, struct agp_memory *mem)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
-
- if (mem->am_is_bound)
- return EBUSY;
-
- if (mem->am_type == 2) {
- /*
- * Unwire the page which we wired in alloc_memory.
- */
- vm_page_t m;
-
- VM_OBJECT_LOCK(mem->am_obj);
- m = vm_page_lookup(mem->am_obj, 0);
- VM_OBJECT_UNLOCK(mem->am_obj);
- vm_page_lock_queues();
- vm_page_unwire(m, 0);
- vm_page_unlock_queues();
- }
-
- sc->agp.as_allocated -= mem->am_size;
- TAILQ_REMOVE(&sc->agp.as_memory, mem, am_link);
- if (mem->am_obj)
- vm_object_deallocate(mem->am_obj);
- free(mem, M_AGP);
- return 0;
-}
-
-static int
-agp_i810_bind_memory(device_t dev, struct agp_memory *mem,
- vm_offset_t offset)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
- vm_offset_t i;
-
- if (mem->am_type != 1)
- return agp_generic_bind_memory(dev, mem, offset);
-
- if ( sc->chiptype != CHIP_I810 )
- return EINVAL;
-
- for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE) {
- WRITE4(AGP_I810_GTT + (offset >> AGP_PAGE_SHIFT) * 4,
- i | 3);
- }
-
- return 0;
-}
-
-static int
-agp_i810_unbind_memory(device_t dev, struct agp_memory *mem)
-{
- struct agp_i810_softc *sc = device_get_softc(dev);
- vm_offset_t i;
-
- if (mem->am_type != 1)
- return agp_generic_unbind_memory(dev, mem);
-
- if ( sc->chiptype != CHIP_I810 )
- return EINVAL;
-
- for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE)
- WRITE4(AGP_I810_GTT + (i >> AGP_PAGE_SHIFT) * 4, 0);
-
- return 0;
-}
-
-static int
-agp_i810_print_child(device_t dev, device_t child)
-{
- int retval = 0;
-
- retval += bus_print_child_header(dev, child);
- retval += printf(": (child of agp_i810.c)");
- retval += bus_print_child_footer(dev, child);
-
- return retval;
-}
-
-static device_method_t agp_i810_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, agp_i810_probe),
- DEVMETHOD(device_attach, agp_i810_attach),
- DEVMETHOD(device_detach, agp_i810_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* AGP interface */
- DEVMETHOD(agp_get_aperture, agp_i810_get_aperture),
- DEVMETHOD(agp_set_aperture, agp_i810_set_aperture),
- DEVMETHOD(agp_bind_page, agp_i810_bind_page),
- DEVMETHOD(agp_unbind_page, agp_i810_unbind_page),
- DEVMETHOD(agp_flush_tlb, agp_i810_flush_tlb),
- DEVMETHOD(agp_enable, agp_i810_enable),
- DEVMETHOD(agp_alloc_memory, agp_i810_alloc_memory),
- DEVMETHOD(agp_free_memory, agp_i810_free_memory),
- DEVMETHOD(agp_bind_memory, agp_i810_bind_memory),
- DEVMETHOD(agp_unbind_memory, agp_i810_unbind_memory),
-
- /* bus methods */
- DEVMETHOD(bus_print_child, agp_i810_print_child),
- DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
- DEVMETHOD(bus_release_resource, bus_generic_release_resource),
- DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
- DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
- DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
- DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
- { 0, 0 }
-};
-
-static driver_t agp_i810_driver = {
- "agp",
- agp_i810_methods,
- sizeof(struct agp_i810_softc),
-};
-
-static devclass_t agp_devclass;
-
-DRIVER_MODULE(agp_i810, pci, agp_i810_driver, agp_devclass, 0, 0);
-MODULE_DEPEND(agp_i810, agp, 1, 1, 1);
-MODULE_DEPEND(agp_i810, pci, 1, 1, 1);
diff --git a/sys/dev/agp/agp_if.m b/sys/dev/agp/agp_if.m
deleted file mode 100644
index faf7b1a..0000000
--- a/sys/dev/agp/agp_if.m
+++ /dev/null
@@ -1,134 +0,0 @@
-#-
-# Copyright (c) 2000 Doug Rabson
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED 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.
-#
-# $FreeBSD$
-#
-
-#include <sys/bus.h>
-
-#
-# The AGP interface is used internally to the agp driver to isolate the
-# differences between various AGP chipsets into chipset mini drivers. It
-# should not be used outside the AGP driver. The kernel api for accessing
-# AGP functionality is described in <pci/agpvar.h>
-#
-INTERFACE agp;
-
-#
-# Return the current aperture size.
-#
-METHOD u_int32_t get_aperture {
- device_t dev;
-};
-
-#
-# Set the size of the aperture. Return EINVAL on error or 0 on success.
-#
-METHOD int set_aperture {
- device_t dev;
- u_int32_t aperture;
-};
-
-#
-# Bind a single page in the AGP aperture to a given physical address.
-# The offset is a byte offset within the aperture which must be
-# aligned to an AGP page boundary.
-#
-METHOD int bind_page {
- device_t dev;
- vm_offset_t offset;
- vm_offset_t physical;
-};
-
-#
-# Unbind a single page in the AGP aperture.
-#
-METHOD int unbind_page {
- device_t dev;
- vm_offset_t offset;
-};
-
-#
-# Flush the GATT TLB. This is used after a call to bind_page to
-# ensure that any mappings cached in the chipset are discarded.
-#
-METHOD void flush_tlb {
- device_t dev;
-};
-
-#
-# Enable the agp hardware with the relavent mode. The mode bits are
-# defined in <pci/agpreg.h>
-#
-METHOD int enable {
- device_t dev;
- u_int32_t mode;
-};
-
-#
-# Allocate memory of a given type. The type is a chipset-specific
-# code which is used by certain integrated agp graphics chips
-# (basically just the i810 for now) to access special features of
-# the chipset. An opaque handle representing the memory region is
-# returned and can be used as an argument to free_memory, bind_memory
-# and unbind_memory.
-#
-# The size is specified in bytes but must be a multiple of the AGP
-# page size.
-#
-METHOD struct agp_memory * alloc_memory {
- device_t dev;
- int type;
- vm_size_t size;
-};
-
-#
-# Free a memory region previously allocated with alloc_memory. Return
-# EBUSY if the memory is bound.
-#
-METHOD int free_memory {
- device_t dev;
- struct agp_memory *mem;
-};
-
-#
-# Bind a memory region to a specific byte offset within the chipset's
-# AGP aperture. This effectively defines a range of contiguous
-# physical address which alias the (possibly uncontiguous) pages in
-# the memory region.
-#
-METHOD int bind_memory {
- device_t dev;
- struct agp_memory *mem;
- vm_offset_t offset;
-};
-
-#
-# Unbind a memory region bound with bind_memory.
-#
-METHOD int unbind_memory {
- device_t dev;
- struct agp_memory *handle;
-};
diff --git a/sys/dev/agp/agp_intel.c b/sys/dev/agp/agp_intel.c
deleted file mode 100644
index 7e8477b..0000000
--- a/sys/dev/agp/agp_intel.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_bus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/agppriv.h>
-#include <pci/agpreg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/pmap.h>
-
-#define MAX_APSIZE 0x3f /* 256 MB */
-
-struct agp_intel_softc {
- struct agp_softc agp;
- u_int32_t initial_aperture; /* aperture size at startup */
- struct agp_gatt *gatt;
- u_int aperture_mask;
-};
-
-static const char*
-agp_intel_match(device_t dev)
-{
- if (pci_get_class(dev) != PCIC_BRIDGE
- || pci_get_subclass(dev) != PCIS_BRIDGE_HOST)
- return NULL;
-
- if (agp_find_caps(dev) == 0)
- return NULL;
-
- switch (pci_get_devid(dev)) {
- /* Intel -- vendor 0x8086 */
- case 0x71808086:
- return ("Intel 82443LX (440 LX) host to PCI bridge");
-
- case 0x71908086:
- return ("Intel 82443BX (440 BX) host to PCI bridge");
-
- case 0x71a08086:
- return ("Intel 82443GX host to PCI bridge");
-
- case 0x71a18086:
- return ("Intel 82443GX host to AGP bridge");
-
- case 0x11308086:
- return ("Intel 82815 (i815 GMCH) host to PCI bridge");
-
- case 0x25008086:
- case 0x25018086:
- return ("Intel 82820 host to AGP bridge");
-
- case 0x35758086:
- return ("Intel 82830 host to AGP bridge");
-
- case 0x1a218086:
- return ("Intel 82840 host to AGP bridge");
-
- case 0x1a308086:
- return ("Intel 82845 host to AGP bridge");
-
- case 0x25308086:
- return ("Intel 82850 host to AGP bridge");
-
- case 0x33408086:
- return ("Intel 82855 host to AGP bridge");
-
- case 0x25318086:
- return ("Intel 82860 host to AGP bridge");
-
- case 0x25708086:
- return ("Intel 82865 host to AGP bridge");
-
- case 0x255d8086:
- return ("Intel E7205 host to AGP bridge");
-
- case 0x25788086:
- return ("Intel 82875P host to AGP bridge");
-
- case 0x25608086: /* i845G */
- return ("Intel 82845G host to AGP bridge");
- };
-
- return NULL;
-}
-
-static int
-agp_intel_probe(device_t dev)
-{
- const char *desc;
-
- if (resource_disabled("agp", device_get_unit(dev)))
- return (ENXIO);
- desc = agp_intel_match(dev);
- if (desc) {
- device_verbose(dev);
- device_set_desc(dev, desc);
- return BUS_PROBE_DEFAULT;
- }
-
- return ENXIO;
-}
-
-static int
-agp_intel_attach(device_t dev)
-{
- struct agp_intel_softc *sc = device_get_softc(dev);
- struct agp_gatt *gatt;
- u_int32_t type = pci_get_devid(dev);
- u_int32_t value;
- int error;
-
- error = agp_generic_attach(dev);
- if (error)
- return error;
-
- /* Determine maximum supported aperture size. */
- value = pci_read_config(dev, AGP_INTEL_APSIZE, 1);
- pci_write_config(dev, AGP_INTEL_APSIZE, MAX_APSIZE, 1);
- sc->aperture_mask = pci_read_config(dev, AGP_INTEL_APSIZE, 1) &
- MAX_APSIZE;
- pci_write_config(dev, AGP_INTEL_APSIZE, value, 1);
- sc->initial_aperture = AGP_GET_APERTURE(dev);
-
- for (;;) {
- gatt = agp_alloc_gatt(dev);
- if (gatt)
- break;
-
- /*
- * Probably contigmalloc failure. Try reducing the
- * aperture so that the gatt size reduces.
- */
- if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) {
- agp_generic_detach(dev);
- return ENOMEM;
- }
- }
- sc->gatt = gatt;
-
- /* Install the gatt. */
- pci_write_config(dev, AGP_INTEL_ATTBASE, gatt->ag_physical, 4);
-
- /* Enable the GLTB and setup the control register. */
- switch (type) {
- case 0x71908086: /* 440LX/EX */
- pci_write_config(dev, AGP_INTEL_AGPCTRL, 0x2080, 4);
- break;
- case 0x71808086: /* 440BX */
- /*
- * XXX: Should be 0xa080? Bit 9 is undefined, and
- * bit 13 being on and bit 15 being clear is illegal.
- */
- pci_write_config(dev, AGP_INTEL_AGPCTRL, 0x2280, 4);
- break;
- default:
- value = pci_read_config(dev, AGP_INTEL_AGPCTRL, 4);
- pci_write_config(dev, AGP_INTEL_AGPCTRL, value | 0x80, 4);
- }
-
- /* Enable things, clear errors etc. */
- switch (type) {
- case 0x1a218086: /* i840 */
- case 0x25308086: /* i850 */
- case 0x25318086: /* i860 */
- pci_write_config(dev, AGP_INTEL_MCHCFG,
- (pci_read_config(dev, AGP_INTEL_MCHCFG, 2)
- | (1 << 9)), 2);
- break;
-
- case 0x25008086: /* i820 */
- case 0x25018086: /* i820 */
- pci_write_config(dev, AGP_INTEL_I820_RDCR,
- (pci_read_config(dev, AGP_INTEL_I820_RDCR, 1)
- | (1 << 1)), 1);
- break;
-
- case 0x1a308086: /* i845 */
- case 0x33408086: /* i855 */
- case 0x255d8086: /* E7205 */
- case 0x25708086: /* i865 */
- case 0x25788086: /* i875P */
- case 0x25608086: /* i845G */
- pci_write_config(dev, AGP_INTEL_I845_MCHCFG,
- (pci_read_config(dev, AGP_INTEL_I845_MCHCFG, 1)
- | (1 << 1)), 1);
- break;
-
- default: /* Intel Generic (maybe) */
- pci_write_config(dev, AGP_INTEL_NBXCFG,
- (pci_read_config(dev, AGP_INTEL_NBXCFG, 4)
- & ~(1 << 10)) | (1 << 9), 4);
- }
-
- switch (type) {
- case 0x1a218086: /* i840 */
- pci_write_config(dev, AGP_INTEL_I8XX_ERRSTS, 0xc000, 2);
- break;
-
- case 0x25008086: /* i820 */
- case 0x25018086: /* i820 */
- case 0x1a308086: /* i845 */
- case 0x25308086: /* i850 */
- case 0x33408086: /* i855 */
- case 0x255d8086: /* E7205 */
- case 0x25318086: /* i860 */
- case 0x25708086: /* i865 */
- case 0x25788086: /* i875P */
- case 0x25608086: /* i845G */
- pci_write_config(dev, AGP_INTEL_I8XX_ERRSTS, 0x00ff, 2);
- break;
-
- default: /* Intel Generic (maybe) */
- pci_write_config(dev, AGP_INTEL_ERRSTS + 1, 7, 1);
- }
-
- return 0;
-}
-
-static int
-agp_intel_detach(device_t dev)
-{
- struct agp_intel_softc *sc = device_get_softc(dev);
- u_int32_t type = pci_get_devid(dev);
- int error;
-
- error = agp_generic_detach(dev);
- if (error)
- return error;
-
- switch (type) {
- case 0x1a218086: /* i840 */
- case 0x25308086: /* i850 */
- case 0x25318086: /* i860 */
- printf("%s: set MCHCFG to %x\n", __func__, (unsigned)
- (pci_read_config(dev, AGP_INTEL_MCHCFG, 2)
- & ~(1 << 9)));
- pci_write_config(dev, AGP_INTEL_MCHCFG,
- (pci_read_config(dev, AGP_INTEL_MCHCFG, 2)
- & ~(1 << 9)), 2);
-
- case 0x25008086: /* i820 */
- case 0x25018086: /* i820 */
- printf("%s: set RDCR to %x\n", __func__, (unsigned)
- (pci_read_config(dev, AGP_INTEL_I820_RDCR, 1)
- & ~(1 << 1)));
- pci_write_config(dev, AGP_INTEL_I820_RDCR,
- (pci_read_config(dev, AGP_INTEL_I820_RDCR, 1)
- & ~(1 << 1)), 1);
-
- case 0x1a308086: /* i845 */
- case 0x25608086: /* i845G */
- case 0x33408086: /* i855 */
- case 0x255d8086: /* E7205 */
- case 0x25708086: /* i865 */
- case 0x25788086: /* i875P */
- printf("%s: set MCHCFG to %x\n", __func__, (unsigned)
- (pci_read_config(dev, AGP_INTEL_I845_MCHCFG, 1)
- & ~(1 << 1)));
- pci_write_config(dev, AGP_INTEL_MCHCFG,
- (pci_read_config(dev, AGP_INTEL_I845_MCHCFG, 1)
- & ~(1 << 1)), 1);
-
- default: /* Intel Generic (maybe) */
- printf("%s: set NBXCFG to %x\n", __func__,
- (pci_read_config(dev, AGP_INTEL_NBXCFG, 4)
- & ~(1 << 9)));
- pci_write_config(dev, AGP_INTEL_NBXCFG,
- (pci_read_config(dev, AGP_INTEL_NBXCFG, 4)
- & ~(1 << 9)), 4);
- }
- pci_write_config(dev, AGP_INTEL_ATTBASE, 0, 4);
- AGP_SET_APERTURE(dev, sc->initial_aperture);
- agp_free_gatt(sc->gatt);
-
- return 0;
-}
-
-static u_int32_t
-agp_intel_get_aperture(device_t dev)
-{
- struct agp_intel_softc *sc = device_get_softc(dev);
- u_int32_t apsize;
-
- apsize = pci_read_config(dev, AGP_INTEL_APSIZE, 1) & sc->aperture_mask;
-
- /*
- * The size is determined by the number of low bits of
- * register APBASE which are forced to zero. The low 22 bits
- * are always forced to zero and each zero bit in the apsize
- * field just read forces the corresponding bit in the 27:22
- * to be zero. We calculate the aperture size accordingly.
- */
- return (((apsize ^ sc->aperture_mask) << 22) | ((1 << 22) - 1)) + 1;
-}
-
-static int
-agp_intel_set_aperture(device_t dev, u_int32_t aperture)
-{
- struct agp_intel_softc *sc = device_get_softc(dev);
- u_int32_t apsize;
-
- /*
- * Reverse the magic from get_aperture.
- */
- apsize = ((aperture - 1) >> 22) ^ sc->aperture_mask;
-
- /*
- * Double check for sanity.
- */
- if ((((apsize ^ sc->aperture_mask) << 22) | ((1 << 22) - 1)) + 1 != aperture)
- return EINVAL;
-
- pci_write_config(dev, AGP_INTEL_APSIZE, apsize, 1);
-
- return 0;
-}
-
-static int
-agp_intel_bind_page(device_t dev, int offset, vm_offset_t physical)
-{
- struct agp_intel_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical | 0x17;
- return 0;
-}
-
-static int
-agp_intel_unbind_page(device_t dev, int offset)
-{
- struct agp_intel_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return 0;
-}
-
-static void
-agp_intel_flush_tlb(device_t dev)
-{
- u_int32_t val;
-
- val = pci_read_config(dev, AGP_INTEL_AGPCTRL, 4);
- pci_write_config(dev, AGP_INTEL_AGPCTRL, val & ~(1 << 7), 4);
- pci_write_config(dev, AGP_INTEL_AGPCTRL, val, 4);
-}
-
-static device_method_t agp_intel_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, agp_intel_probe),
- DEVMETHOD(device_attach, agp_intel_attach),
- DEVMETHOD(device_detach, agp_intel_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* AGP interface */
- DEVMETHOD(agp_get_aperture, agp_intel_get_aperture),
- DEVMETHOD(agp_set_aperture, agp_intel_set_aperture),
- DEVMETHOD(agp_bind_page, agp_intel_bind_page),
- DEVMETHOD(agp_unbind_page, agp_intel_unbind_page),
- DEVMETHOD(agp_flush_tlb, agp_intel_flush_tlb),
- DEVMETHOD(agp_enable, agp_generic_enable),
- DEVMETHOD(agp_alloc_memory, agp_generic_alloc_memory),
- DEVMETHOD(agp_free_memory, agp_generic_free_memory),
- DEVMETHOD(agp_bind_memory, agp_generic_bind_memory),
- DEVMETHOD(agp_unbind_memory, agp_generic_unbind_memory),
-
- { 0, 0 }
-};
-
-static driver_t agp_intel_driver = {
- "agp",
- agp_intel_methods,
- sizeof(struct agp_intel_softc),
-};
-
-static devclass_t agp_devclass;
-
-DRIVER_MODULE(agp_intel, pci, agp_intel_driver, agp_devclass, 0, 0);
-MODULE_DEPEND(agp_intel, agp, 1, 1, 1);
-MODULE_DEPEND(agp_intel, pci, 1, 1, 1);
diff --git a/sys/dev/agp/agp_nvidia.c b/sys/dev/agp/agp_nvidia.c
deleted file mode 100644
index e49c140..0000000
--- a/sys/dev/agp/agp_nvidia.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*-
- * Copyright (c) 2003 Matthew N. Dodd <winter@jurai.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Written using information gleaned from the
- * NVIDIA nForce/nForce2 AGPGART Linux Kernel Patch.
- */
-
-#include "opt_bus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-
-#if __FreeBSD_version < 500000
-#include "opt_pci.h"
-#endif
-
-#if __FreeBSD_version > 500000
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#endif
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/agppriv.h>
-#include <pci/agpreg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/pmap.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#define NVIDIA_VENDORID 0x10de
-#define NVIDIA_DEVICEID_NFORCE 0x01a4
-#define NVIDIA_DEVICEID_NFORCE2 0x01e0
-
-struct agp_nvidia_softc {
- struct agp_softc agp;
- u_int32_t initial_aperture; /* aperture size at startup */
- struct agp_gatt * gatt;
-
- device_t dev; /* AGP Controller */
- device_t mc1_dev; /* Memory Controller */
- device_t mc2_dev; /* Memory Controller */
- device_t bdev; /* Bridge */
-
- u_int32_t wbc_mask;
- int num_dirs;
- int num_active_entries;
- off_t pg_offset;
-};
-
-static const char *agp_nvidia_match(device_t dev);
-static int agp_nvidia_probe(device_t);
-static int agp_nvidia_attach(device_t);
-static int agp_nvidia_detach(device_t);
-static u_int32_t agp_nvidia_get_aperture(device_t);
-static int agp_nvidia_set_aperture(device_t, u_int32_t);
-static int agp_nvidia_bind_page(device_t, int, vm_offset_t);
-static int agp_nvidia_unbind_page(device_t, int);
-
-static int nvidia_init_iorr(u_int32_t, u_int32_t);
-
-static const char *
-agp_nvidia_match (device_t dev)
-{
- if (pci_get_class(dev) != PCIC_BRIDGE ||
- pci_get_subclass(dev) != PCIS_BRIDGE_HOST ||
- pci_get_vendor(dev) != NVIDIA_VENDORID)
- return (NULL);
-
- switch (pci_get_device(dev)) {
- case NVIDIA_DEVICEID_NFORCE:
- return ("NVIDIA nForce AGP Controller");
- case NVIDIA_DEVICEID_NFORCE2:
- return ("NVIDIA nForce2 AGP Controller");
- }
- return (NULL);
-}
-
-static int
-agp_nvidia_probe (device_t dev)
-{
- const char *desc;
-
- if (resource_disabled("agp", device_get_unit(dev)))
- return (ENXIO);
- desc = agp_nvidia_match(dev);
- if (desc) {
- device_verbose(dev);
- device_set_desc(dev, desc);
- return (BUS_PROBE_DEFAULT);
- }
- return (ENXIO);
-}
-
-static int
-agp_nvidia_attach (device_t dev)
-{
- struct agp_nvidia_softc *sc = device_get_softc(dev);
- struct agp_gatt *gatt;
- u_int32_t apbase;
- u_int32_t aplimit;
- u_int32_t temp;
- int size;
- int i;
- int error;
-
- switch (pci_get_device(dev)) {
- case NVIDIA_DEVICEID_NFORCE:
- sc->wbc_mask = 0x00010000;
- break;
- case NVIDIA_DEVICEID_NFORCE2:
- sc->wbc_mask = 0x80000000;
- break;
- default:
- sc->wbc_mask = 0;
- break;
- }
-
- /* AGP Controller */
- sc->dev = dev;
-
- /* Memory Controller 1 */
- sc->mc1_dev = pci_find_bsf(pci_get_bus(dev), 0, 1);
- if (sc->mc1_dev == NULL) {
- device_printf(dev,
- "Unable to find NVIDIA Memory Controller 1.\n");
- return (ENODEV);
- }
-
- /* Memory Controller 2 */
- sc->mc2_dev = pci_find_bsf(pci_get_bus(dev), 0, 2);
- if (sc->mc2_dev == NULL) {
- device_printf(dev,
- "Unable to find NVIDIA Memory Controller 2.\n");
- return (ENODEV);
- }
-
- /* AGP Host to PCI Bridge */
- sc->bdev = pci_find_bsf(pci_get_bus(dev), 30, 0);
- if (sc->bdev == NULL) {
- device_printf(dev,
- "Unable to find NVIDIA AGP Host to PCI Bridge.\n");
- return (ENODEV);
- }
-
- error = agp_generic_attach(dev);
- if (error)
- return (error);
-
- sc->initial_aperture = AGP_GET_APERTURE(dev);
-
- for (;;) {
- gatt = agp_alloc_gatt(dev);
- if (gatt)
- break;
- /*
- * Probably contigmalloc failure. Try reducing the
- * aperture so that the gatt size reduces.
- */
- if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2))
- goto fail;
- }
- sc->gatt = gatt;
-
- apbase = rman_get_start(sc->agp.as_aperture);
- aplimit = apbase + AGP_GET_APERTURE(dev) - 1;
- pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_APBASE, apbase, 4);
- pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_APLIMIT, aplimit, 4);
- pci_write_config(sc->bdev, AGP_NVIDIA_3_APBASE, apbase, 4);
- pci_write_config(sc->bdev, AGP_NVIDIA_3_APLIMIT, aplimit, 4);
-
- error = nvidia_init_iorr(apbase, AGP_GET_APERTURE(dev));
- if (error) {
- device_printf(dev, "Failed to setup IORRs\n");
- goto fail;
- }
-
- /* directory size is 64k */
- size = AGP_GET_APERTURE(dev) / 1024 / 1024;
- sc->num_dirs = size / 64;
- sc->num_active_entries = (size == 32) ? 16384 : ((size * 1024) / 4);
- sc->pg_offset = 0;
- if (sc->num_dirs == 0) {
- sc->num_dirs = 1;
- sc->num_active_entries /= (64 / size);
- sc->pg_offset = (apbase & (64 * 1024 * 1024 - 1) &
- ~(AGP_GET_APERTURE(dev) - 1)) / PAGE_SIZE;
- }
-
- /* (G)ATT Base Address */
- for (i = 0; i < 8; i++) {
- pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_ATTBASE(i),
- (sc->gatt->ag_physical +
- (i % sc->num_dirs) * 64 * 1024),
- 4);
- }
-
- /* GTLB Control */
- temp = pci_read_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, 4);
- pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, temp | 0x11, 4);
-
- /* GART Control */
- temp = pci_read_config(sc->dev, AGP_NVIDIA_0_APSIZE, 4);
- pci_write_config(sc->dev, AGP_NVIDIA_0_APSIZE, temp | 0x100, 4);
-
- return (0);
-fail:
- agp_generic_detach(dev);
- return (ENOMEM);
-}
-
-static int
-agp_nvidia_detach (device_t dev)
-{
- struct agp_nvidia_softc *sc = device_get_softc(dev);
- int error;
- u_int32_t temp;
-
- error = agp_generic_detach(dev);
- if (error)
- return (error);
-
- /* GART Control */
- temp = pci_read_config(sc->dev, AGP_NVIDIA_0_APSIZE, 4);
- pci_write_config(sc->dev, AGP_NVIDIA_0_APSIZE, temp & ~(0x100), 4);
-
- /* GTLB Control */
- temp = pci_read_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, 4);
- pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, temp & ~(0x11), 4);
-
- /* Put the aperture back the way it started. */
- AGP_SET_APERTURE(dev, sc->initial_aperture);
-
- /* restore iorr for previous aperture size */
- nvidia_init_iorr(rman_get_start(sc->agp.as_aperture),
- sc->initial_aperture);
-
- agp_free_gatt(sc->gatt);
-
- return (0);
-}
-
-static u_int32_t
-agp_nvidia_get_aperture(device_t dev)
-{
- u_int8_t key;
-
- key = ffs(pci_read_config(dev, AGP_NVIDIA_0_APSIZE, 1) & 0x0f);
- return (1 << (24 + (key ? key : 5)));
-}
-
-static int
-agp_nvidia_set_aperture(device_t dev, u_int32_t aperture)
-{
- u_int8_t val;
- u_int8_t key;
-
- switch (aperture) {
- case (512 * 1024 * 1024): key = 0; break;
- case (256 * 1024 * 1024): key = 8; break;
- case (128 * 1024 * 1024): key = 12; break;
- case (64 * 1024 * 1024): key = 14; break;
- case (32 * 1024 * 1024): key = 15; break;
- default:
- device_printf(dev, "Invalid aperture size (%dMb)\n",
- aperture / 1024 / 1024);
- return (EINVAL);
- }
- val = pci_read_config(dev, AGP_NVIDIA_0_APSIZE, 1);
- pci_write_config(dev, AGP_NVIDIA_0_APSIZE, ((val & ~0x0f) | key), 1);
-
- return (0);
-}
-
-static int
-agp_nvidia_bind_page(device_t dev, int offset, vm_offset_t physical)
-{
- struct agp_nvidia_softc *sc = device_get_softc(dev);
- u_int32_t index;
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- index = (sc->pg_offset + offset) >> AGP_PAGE_SHIFT;
- sc->gatt->ag_virtual[index] = physical;
-
- return (0);
-}
-
-static int
-agp_nvidia_unbind_page(device_t dev, int offset)
-{
- struct agp_nvidia_softc *sc = device_get_softc(dev);
- u_int32_t index;
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- index = (sc->pg_offset + offset) >> AGP_PAGE_SHIFT;
- sc->gatt->ag_virtual[index] = 0;
-
- return (0);
-}
-
-static int
-agp_nvidia_flush_tlb (device_t dev, int offset)
-{
- struct agp_nvidia_softc *sc;
- u_int32_t wbc_reg, temp;
- int i;
-
- sc = (struct agp_nvidia_softc *)device_get_softc(dev);
-
- if (sc->wbc_mask) {
- wbc_reg = pci_read_config(sc->mc1_dev, AGP_NVIDIA_1_WBC, 4);
- wbc_reg |= sc->wbc_mask;
- pci_write_config(sc->mc1_dev, AGP_NVIDIA_1_WBC, wbc_reg, 4);
-
- /* Wait no more than 3 seconds. */
- for (i = 0; i < 3000; i++) {
- wbc_reg = pci_read_config(sc->mc1_dev,
- AGP_NVIDIA_1_WBC, 4);
- if ((sc->wbc_mask & wbc_reg) == 0)
- break;
- else
- DELAY(1000);
- }
- if (i == 3000)
- device_printf(dev,
- "TLB flush took more than 3 seconds.\n");
- }
-
- /* Flush TLB entries. */
- for(i = 0; i < 32 + 1; i++)
- temp = sc->gatt->ag_virtual[i * PAGE_SIZE / sizeof(u_int32_t)];
- for(i = 0; i < 32 + 1; i++)
- temp = sc->gatt->ag_virtual[i * PAGE_SIZE / sizeof(u_int32_t)];
-
- return (0);
-}
-
-#define SYSCFG 0xC0010010
-#define IORR_BASE0 0xC0010016
-#define IORR_MASK0 0xC0010017
-#define AMD_K7_NUM_IORR 2
-
-static int
-nvidia_init_iorr(u_int32_t addr, u_int32_t size)
-{
- quad_t base, mask, sys;
- u_int32_t iorr_addr, free_iorr_addr;
-
- /* Find the iorr that is already used for the addr */
- /* If not found, determine the uppermost available iorr */
- free_iorr_addr = AMD_K7_NUM_IORR;
- for(iorr_addr = 0; iorr_addr < AMD_K7_NUM_IORR; iorr_addr++) {
- base = rdmsr(IORR_BASE0 + 2 * iorr_addr);
- mask = rdmsr(IORR_MASK0 + 2 * iorr_addr);
-
- if ((base & 0xfffff000ULL) == (addr & 0xfffff000))
- break;
-
- if ((mask & 0x00000800ULL) == 0)
- free_iorr_addr = iorr_addr;
- }
-
- if (iorr_addr >= AMD_K7_NUM_IORR) {
- iorr_addr = free_iorr_addr;
- if (iorr_addr >= AMD_K7_NUM_IORR)
- return (EINVAL);
- }
-
- base = (addr & ~0xfff) | 0x18;
- mask = (0xfULL << 32) | ((~(size - 1)) & 0xfffff000) | 0x800;
- wrmsr(IORR_BASE0 + 2 * iorr_addr, base);
- wrmsr(IORR_MASK0 + 2 * iorr_addr, mask);
-
- sys = rdmsr(SYSCFG);
- sys |= 0x00100000ULL;
- wrmsr(SYSCFG, sys);
-
- return (0);
-}
-
-static device_method_t agp_nvidia_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, agp_nvidia_probe),
- DEVMETHOD(device_attach, agp_nvidia_attach),
- DEVMETHOD(device_detach, agp_nvidia_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* AGP interface */
- DEVMETHOD(agp_get_aperture, agp_nvidia_get_aperture),
- DEVMETHOD(agp_set_aperture, agp_nvidia_set_aperture),
- DEVMETHOD(agp_bind_page, agp_nvidia_bind_page),
- DEVMETHOD(agp_unbind_page, agp_nvidia_unbind_page),
- DEVMETHOD(agp_flush_tlb, agp_nvidia_flush_tlb),
-
- DEVMETHOD(agp_enable, agp_generic_enable),
- DEVMETHOD(agp_alloc_memory, agp_generic_alloc_memory),
- DEVMETHOD(agp_free_memory, agp_generic_free_memory),
- DEVMETHOD(agp_bind_memory, agp_generic_bind_memory),
- DEVMETHOD(agp_unbind_memory, agp_generic_unbind_memory),
-
- { 0, 0 }
-};
-
-static driver_t agp_nvidia_driver = {
- "agp",
- agp_nvidia_methods,
- sizeof(struct agp_nvidia_softc),
-};
-
-static devclass_t agp_devclass;
-
-DRIVER_MODULE(agp_nvidia, pci, agp_nvidia_driver, agp_devclass, 0, 0);
-MODULE_DEPEND(agp_nvidia, agp, 1, 1, 1);
-MODULE_DEPEND(agp_nvidia, pci, 1, 1, 1);
diff --git a/sys/dev/agp/agp_sis.c b/sys/dev/agp/agp_sis.c
deleted file mode 100644
index 0f3b31a..0000000
--- a/sys/dev/agp/agp_sis.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_bus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/agppriv.h>
-#include <pci/agpreg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/pmap.h>
-
-struct agp_sis_softc {
- struct agp_softc agp;
- u_int32_t initial_aperture; /* aperture size at startup */
- struct agp_gatt *gatt;
-};
-
-static const char*
-agp_sis_match(device_t dev)
-{
- if (pci_get_class(dev) != PCIC_BRIDGE
- || pci_get_subclass(dev) != PCIS_BRIDGE_HOST)
- return NULL;
-
- if (agp_find_caps(dev) == 0)
- return NULL;
-
- switch (pci_get_devid(dev)) {
- case 0x00011039:
- return ("SiS 5591 host to AGP bridge");
- case 0x05301039:
- return ("SiS 530 host to AGP bridge");
- case 0x05401039:
- return ("SiS 540 host to AGP bridge");
- case 0x05501039:
- return ("SiS 550 host to AGP bridge");
- case 0x06201039:
- return ("SiS 620 host to AGP bridge");
- case 0x06301039:
- return ("SiS 630 host to AGP bridge");
- case 0x06451039:
- return ("SiS 645 host to AGP bridge");
- case 0x06461039:
- return ("SiS 645DX host to AGP bridge");
- case 0x06481039:
- return ("SiS 648 host to AGP bridge");
- case 0x06501039:
- return ("SiS 650 host to AGP bridge");
- case 0x06511039:
- return ("SiS 651 host to AGP bridge");
- case 0x06551039:
- return ("SiS 655 host to AGP bridge");
- case 0x06611039:
- return ("SiS 661 host to AGP bridge");
- case 0x07301039:
- return ("SiS 730 host to AGP bridge");
- case 0x07351039:
- return ("SiS 735 host to AGP bridge");
- case 0x07401039:
- return ("SiS 740 host to AGP bridge");
- case 0x07411039:
- return ("SiS 741 host to AGP bridge");
- case 0x07451039:
- return ("SiS 745 host to AGP bridge");
- case 0x07461039:
- return ("SiS 746 host to AGP bridge");
- case 0x07601039:
- return ("SiS 760 host to AGP bridge");
- };
-
- return NULL;
-}
-
-static int
-agp_sis_probe(device_t dev)
-{
- const char *desc;
-
- if (resource_disabled("agp", device_get_unit(dev)))
- return (ENXIO);
- desc = agp_sis_match(dev);
- if (desc) {
- device_verbose(dev);
- device_set_desc(dev, desc);
- return BUS_PROBE_DEFAULT;
- }
-
- return ENXIO;
-}
-
-static int
-agp_sis_attach(device_t dev)
-{
- struct agp_sis_softc *sc = device_get_softc(dev);
- struct agp_gatt *gatt;
- int error;
-
- error = agp_generic_attach(dev);
- if (error)
- return error;
-
- sc->initial_aperture = AGP_GET_APERTURE(dev);
-
- for (;;) {
- gatt = agp_alloc_gatt(dev);
- if (gatt)
- break;
-
- /*
- * Probably contigmalloc failure. Try reducing the
- * aperture so that the gatt size reduces.
- */
- if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) {
- agp_generic_detach(dev);
- return ENOMEM;
- }
- }
- sc->gatt = gatt;
-
- /* Install the gatt. */
- pci_write_config(dev, AGP_SIS_ATTBASE, gatt->ag_physical, 4);
-
- /* Enable the aperture. */
- pci_write_config(dev, AGP_SIS_WINCTRL,
- pci_read_config(dev, AGP_SIS_WINCTRL, 1) | 3, 1);
-
- /*
- * Enable the TLB and make it automatically invalidate entries
- * when the GATT is written.
- */
- pci_write_config(dev, AGP_SIS_TLBCTRL, 0x05, 1);
-
- return 0;
-}
-
-static int
-agp_sis_detach(device_t dev)
-{
- struct agp_sis_softc *sc = device_get_softc(dev);
- int error;
-
- error = agp_generic_detach(dev);
- if (error)
- return error;
-
- /* Disable the aperture.. */
- pci_write_config(dev, AGP_SIS_WINCTRL,
- pci_read_config(dev, AGP_SIS_WINCTRL, 1) & ~3, 1);
-
- /* and the TLB. */
- pci_write_config(dev, AGP_SIS_TLBCTRL, 0, 1);
-
- /* Put the aperture back the way it started. */
- AGP_SET_APERTURE(dev, sc->initial_aperture);
-
- agp_free_gatt(sc->gatt);
- return 0;
-}
-
-static u_int32_t
-agp_sis_get_aperture(device_t dev)
-{
- int gws;
-
- /*
- * The aperture size is equal to 4M<<gws.
- */
- gws = (pci_read_config(dev, AGP_SIS_WINCTRL, 1) & 0x70) >> 4;
- return (4*1024*1024) << gws;
-}
-
-static int
-agp_sis_set_aperture(device_t dev, u_int32_t aperture)
-{
- int gws;
-
- /*
- * Check for a power of two and make sure its within the
- * programmable range.
- */
- if (aperture & (aperture - 1)
- || aperture < 4*1024*1024
- || aperture > 256*1024*1024)
- return EINVAL;
-
- gws = ffs(aperture / 4*1024*1024) - 1;
-
- pci_write_config(dev, AGP_SIS_WINCTRL,
- ((pci_read_config(dev, AGP_SIS_WINCTRL, 1) & ~0x70)
- | gws << 4), 1);
-
- return 0;
-}
-
-static int
-agp_sis_bind_page(device_t dev, int offset, vm_offset_t physical)
-{
- struct agp_sis_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical;
- return 0;
-}
-
-static int
-agp_sis_unbind_page(device_t dev, int offset)
-{
- struct agp_sis_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return 0;
-}
-
-static void
-agp_sis_flush_tlb(device_t dev)
-{
- pci_write_config(dev, AGP_SIS_TLBFLUSH, 0x02, 1);
-}
-
-static device_method_t agp_sis_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, agp_sis_probe),
- DEVMETHOD(device_attach, agp_sis_attach),
- DEVMETHOD(device_detach, agp_sis_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* AGP interface */
- DEVMETHOD(agp_get_aperture, agp_sis_get_aperture),
- DEVMETHOD(agp_set_aperture, agp_sis_set_aperture),
- DEVMETHOD(agp_bind_page, agp_sis_bind_page),
- DEVMETHOD(agp_unbind_page, agp_sis_unbind_page),
- DEVMETHOD(agp_flush_tlb, agp_sis_flush_tlb),
- DEVMETHOD(agp_enable, agp_generic_enable),
- DEVMETHOD(agp_alloc_memory, agp_generic_alloc_memory),
- DEVMETHOD(agp_free_memory, agp_generic_free_memory),
- DEVMETHOD(agp_bind_memory, agp_generic_bind_memory),
- DEVMETHOD(agp_unbind_memory, agp_generic_unbind_memory),
-
- { 0, 0 }
-};
-
-static driver_t agp_sis_driver = {
- "agp",
- agp_sis_methods,
- sizeof(struct agp_sis_softc),
-};
-
-static devclass_t agp_devclass;
-
-DRIVER_MODULE(agp_sis, pci, agp_sis_driver, agp_devclass, 0, 0);
-MODULE_DEPEND(agp_sis, agp, 1, 1, 1);
-MODULE_DEPEND(agp_sis, pci, 1, 1, 1);
diff --git a/sys/dev/agp/agp_via.c b/sys/dev/agp/agp_via.c
deleted file mode 100644
index f2cd381..0000000
--- a/sys/dev/agp/agp_via.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_bus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/agppriv.h>
-#include <pci/agpreg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/pmap.h>
-
-#define REG_GARTCTRL 0
-#define REG_APSIZE 1
-#define REG_ATTBASE 2
-
-struct agp_via_softc {
- struct agp_softc agp;
- u_int32_t initial_aperture; /* aperture size at startup */
- struct agp_gatt *gatt;
- int *regs;
-};
-
-static int via_v2_regs[] = { AGP_VIA_GARTCTRL, AGP_VIA_APSIZE,
- AGP_VIA_ATTBASE };
-static int via_v3_regs[] = { AGP3_VIA_GARTCTRL, AGP3_VIA_APSIZE,
- AGP3_VIA_ATTBASE };
-
-static const char*
-agp_via_match(device_t dev)
-{
- if (pci_get_class(dev) != PCIC_BRIDGE
- || pci_get_subclass(dev) != PCIS_BRIDGE_HOST)
- return NULL;
-
- if (agp_find_caps(dev) == 0)
- return NULL;
-
- switch (pci_get_devid(dev)) {
- case 0x01981106:
- return ("VIA 8763 (P4X600) host to PCI bridge");
- case 0x02591106:
- return ("VIA PM800/PN800/PM880/PN880 host to PCI bridge");
- case 0x02691106:
- return ("VIA KT880 host to PCI bridge");
- case 0x02961106:
- return ("VIA 3296 (P4M800) host to PCI bridge");
- case 0x03051106:
- return ("VIA 82C8363 (Apollo KT133x/KM133) host to PCI bridge");
- case 0x03911106:
- return ("VIA 8371 (Apollo KX133) host to PCI bridge");
- case 0x05011106:
- return ("VIA 8501 (Apollo MVP4) host to PCI bridge");
- case 0x05971106:
- return ("VIA 82C597 (Apollo VP3) host to PCI bridge");
- case 0x05981106:
- return ("VIA 82C598 (Apollo MVP3) host to PCI bridge");
- case 0x06011106:
- return ("VIA 8601 (Apollo ProMedia/PLE133Ta) host to PCI bridge");
- case 0x06051106:
- return ("VIA 82C694X (Apollo Pro 133A) host to PCI bridge");
- case 0x06911106:
- return ("VIA 82C691 (Apollo Pro) host to PCI bridge");
- case 0x30911106:
- return ("VIA 8633 (Pro 266) host to PCI bridge");
- case 0x30991106:
- return ("VIA 8367 (KT266/KY266x/KT333) host to PCI bridge");
- case 0x31011106:
- return ("VIA 8653 (Pro266T) host to PCI bridge");
- case 0x31121106:
- return ("VIA 8361 (KLE133) host to PCI bridge");
- case 0x31161106:
- return ("VIA XM266 (PM266/KM266) host to PCI bridge");
- case 0x31231106:
- return ("VIA 862x (CLE266) host to PCI bridge");
- case 0x31281106:
- return ("VIA 8753 (P4X266) host to PCI bridge");
- case 0x31481106:
- return ("VIA 8703 (P4M266x/P4N266) host to PCI bridge");
- case 0x31561106:
- return ("VIA XN266 (Apollo Pro266) host to PCI bridge");
- case 0x31681106:
- return ("VIA 8754 (PT800) host to PCI bridge");
- case 0x31891106:
- return ("VIA 8377 (Apollo KT400/KT400A/KT600) host to PCI bridge");
- case 0x32051106:
- return ("VIA 8235/8237 (Apollo KM400/KM400A) host to PCI bridge");
- case 0x32081106:
- return ("VIA 8783 (PT890) host to PCI bridge");
- case 0x32581106:
- return ("VIA PT880 host to PCI bridge");
- case 0xb1981106:
- return ("VIA VT83xx/VT87xx/KTxxx/Px8xx host to PCI bridge");
- };
-
- return NULL;
-}
-
-static int
-agp_via_probe(device_t dev)
-{
- const char *desc;
-
- if (resource_disabled("agp", device_get_unit(dev)))
- return (ENXIO);
- desc = agp_via_match(dev);
- if (desc) {
- device_verbose(dev);
- device_set_desc(dev, desc);
- return BUS_PROBE_DEFAULT;
- }
-
- return ENXIO;
-}
-
-static int
-agp_via_attach(device_t dev)
-{
- struct agp_via_softc *sc = device_get_softc(dev);
- struct agp_gatt *gatt;
- int error;
- u_int32_t agpsel;
-
- /* XXX: This should be keying off of whether the bridge is AGP3 capable,
- * rather than a bunch of device ids for chipsets that happen to do 8x.
- */
- switch (pci_get_devid(dev)) {
- case 0x01981106:
- case 0x02591106:
- case 0x02691106:
- case 0x02961106:
- case 0x31231106:
- case 0x31681106:
- case 0x31891106:
- case 0x32051106:
- case 0x32581106:
- case 0xb1981106:
- /* The newer VIA chipsets will select the AGP version based on
- * what AGP versions the card supports. We still have to
- * program it using the v2 registers if it has chosen to use
- * compatibility mode.
- */
- agpsel = pci_read_config(dev, AGP_VIA_AGPSEL, 1);
- if ((agpsel & (1 << 1)) == 0)
- sc->regs = via_v3_regs;
- else
- sc->regs = via_v2_regs;
- break;
- default:
- sc->regs = via_v2_regs;
- break;
- }
-
- error = agp_generic_attach(dev);
- if (error)
- return error;
-
- sc->initial_aperture = AGP_GET_APERTURE(dev);
-
- for (;;) {
- gatt = agp_alloc_gatt(dev);
- if (gatt)
- break;
-
- /*
- * Probably contigmalloc failure. Try reducing the
- * aperture so that the gatt size reduces.
- */
- if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) {
- agp_generic_detach(dev);
- return ENOMEM;
- }
- }
- sc->gatt = gatt;
-
- if (sc->regs == via_v2_regs) {
- /* Install the gatt. */
- pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4);
-
- /* Enable the aperture. */
- pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4);
- } else {
- u_int32_t gartctrl;
-
- /* Install the gatt. */
- pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical, 4);
-
- /* Enable the aperture. */
- gartctrl = pci_read_config(dev, sc->regs[REG_ATTBASE], 4);
- pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl | (3 << 7), 4);
- }
-
- return 0;
-}
-
-static int
-agp_via_detach(device_t dev)
-{
- struct agp_via_softc *sc = device_get_softc(dev);
- int error;
-
- error = agp_generic_detach(dev);
- if (error)
- return error;
-
- pci_write_config(dev, sc->regs[REG_GARTCTRL], 0, 4);
- pci_write_config(dev, sc->regs[REG_ATTBASE], 0, 4);
- AGP_SET_APERTURE(dev, sc->initial_aperture);
- agp_free_gatt(sc->gatt);
-
- return 0;
-}
-
-static u_int32_t
-agp_via_get_aperture(device_t dev)
-{
- struct agp_via_softc *sc = device_get_softc(dev);
- u_int32_t apsize;
-
- apsize = pci_read_config(dev, sc->regs[REG_APSIZE], 1) & 0x1f;
-
- /*
- * The size is determined by the number of low bits of
- * register APBASE which are forced to zero. The low 20 bits
- * are always forced to zero and each zero bit in the apsize
- * field just read forces the corresponding bit in the 27:20
- * to be zero. We calculate the aperture size accordingly.
- */
- return (((apsize ^ 0xff) << 20) | ((1 << 20) - 1)) + 1;
-}
-
-static int
-agp_via_set_aperture(device_t dev, u_int32_t aperture)
-{
- struct agp_via_softc *sc = device_get_softc(dev);
- u_int32_t apsize;
-
- /*
- * Reverse the magic from get_aperture.
- */
- apsize = ((aperture - 1) >> 20) ^ 0xff;
-
- /*
- * Double check for sanity.
- */
- if ((((apsize ^ 0xff) << 20) | ((1 << 20) - 1)) + 1 != aperture)
- return EINVAL;
-
- pci_write_config(dev, sc->regs[REG_APSIZE], apsize, 1);
-
- return 0;
-}
-
-static int
-agp_via_bind_page(device_t dev, int offset, vm_offset_t physical)
-{
- struct agp_via_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical;
- return 0;
-}
-
-static int
-agp_via_unbind_page(device_t dev, int offset)
-{
- struct agp_via_softc *sc = device_get_softc(dev);
-
- if (offset < 0 || offset >= (sc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return EINVAL;
-
- sc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return 0;
-}
-
-static void
-agp_via_flush_tlb(device_t dev)
-{
- struct agp_via_softc *sc = device_get_softc(dev);
- u_int32_t gartctrl;
-
- if (sc->regs == via_v2_regs) {
- pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4);
- pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4);
- } else {
- gartctrl = pci_read_config(dev, sc->regs[REG_GARTCTRL], 4);
- pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl &
- ~(1 << 7), 4);
- pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl, 4);
- }
-
-}
-
-static device_method_t agp_via_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, agp_via_probe),
- DEVMETHOD(device_attach, agp_via_attach),
- DEVMETHOD(device_detach, agp_via_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* AGP interface */
- DEVMETHOD(agp_get_aperture, agp_via_get_aperture),
- DEVMETHOD(agp_set_aperture, agp_via_set_aperture),
- DEVMETHOD(agp_bind_page, agp_via_bind_page),
- DEVMETHOD(agp_unbind_page, agp_via_unbind_page),
- DEVMETHOD(agp_flush_tlb, agp_via_flush_tlb),
- DEVMETHOD(agp_enable, agp_generic_enable),
- DEVMETHOD(agp_alloc_memory, agp_generic_alloc_memory),
- DEVMETHOD(agp_free_memory, agp_generic_free_memory),
- DEVMETHOD(agp_bind_memory, agp_generic_bind_memory),
- DEVMETHOD(agp_unbind_memory, agp_generic_unbind_memory),
-
- { 0, 0 }
-};
-
-static driver_t agp_via_driver = {
- "agp",
- agp_via_methods,
- sizeof(struct agp_via_softc),
-};
-
-static devclass_t agp_devclass;
-
-DRIVER_MODULE(agp_via, pci, agp_via_driver, agp_devclass, 0, 0);
-MODULE_DEPEND(agp_via, agp, 1, 1, 1);
-MODULE_DEPEND(agp_via, pci, 1, 1, 1);
diff --git a/sys/dev/agp/agppriv.h b/sys/dev/agp/agppriv.h
deleted file mode 100644
index 7e846d1..0000000
--- a/sys/dev/agp/agppriv.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _PCI_AGPPRIV_H_
-#define _PCI_AGPPRIV_H_
-
-/*
- * This file *must not* be included by code outside the agp driver itself.
- */
-
-#include <sys/agpio.h>
-#include <pci/agpvar.h>
-
-#define AGP_DEBUGxx
-
-#ifdef AGP_DEBUG
-#define AGP_DPF(x...) do { \
- printf("agp: "); \
- printf(##x); \
-} while (0)
-#else
-#define AGP_DPF(x...) do {} while (0)
-#endif
-
-#include "agp_if.h"
-
-/*
- * Data structure to describe an AGP memory allocation.
- */
-TAILQ_HEAD(agp_memory_list, agp_memory);
-struct agp_memory {
- TAILQ_ENTRY(agp_memory) am_link; /* wiring for the tailq */
- int am_id; /* unique id for block */
- vm_size_t am_size; /* number of bytes allocated */
- int am_type; /* chipset specific type */
- struct vm_object *am_obj; /* VM object owning pages */
- vm_offset_t am_physical; /* bogus hack for i810 */
- vm_offset_t am_offset; /* page offset if bound */
- int am_is_bound; /* non-zero if bound */
-};
-
-/*
- * All chipset drivers must have this at the start of their softc.
- */
-struct agp_softc {
- struct resource *as_aperture; /* location of aperture */
- u_int32_t as_maxmem; /* allocation upper bound */
- u_int32_t as_allocated; /* amount allocated */
- enum agp_acquire_state as_state;
- struct agp_memory_list as_memory; /* list of allocated memory */
- int as_nextid; /* next memory block id */
- int as_isopen; /* user device is open */
- struct cdev *as_devnode; /* from make_dev */
- struct mtx as_lock; /* lock for access to GATT */
-};
-
-struct agp_gatt {
- u_int32_t ag_entries;
- u_int32_t *ag_virtual;
- vm_offset_t ag_physical;
-};
-
-void agp_flush_cache(void);
-u_int8_t agp_find_caps(device_t dev);
-struct agp_gatt *agp_alloc_gatt(device_t dev);
-void agp_free_gatt(struct agp_gatt *gatt);
-int agp_generic_attach(device_t dev);
-int agp_generic_detach(device_t dev);
-int agp_generic_enable(device_t dev, u_int32_t mode);
-struct agp_memory *agp_generic_alloc_memory(device_t dev, int type,
- vm_size_t size);
-int agp_generic_free_memory(device_t dev,
- struct agp_memory *mem);
-int agp_generic_bind_memory(device_t dev,
- struct agp_memory *mem,
- vm_offset_t offset);
-int agp_generic_unbind_memory(device_t dev,
- struct agp_memory *mem);
-
-#endif /* !_PCI_AGPPRIV_H_ */
diff --git a/sys/dev/agp/agpreg.h b/sys/dev/agp/agpreg.h
deleted file mode 100644
index 4b2d5b3..0000000
--- a/sys/dev/agp/agpreg.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _PCI_AGPREG_H_
-#define _PCI_AGPREG_H_
-
-/*
- * Offsets for various AGP configuration registers.
- */
-#define AGP_APBASE 0x10
-#define AGP_CAPPTR 0x34
-
-/*
- * Offsets from the AGP Capability pointer.
- */
-#define AGP_CAPID 0x0
-#define AGP_CAPID_GET_MAJOR(x) (((x) & 0x00f00000U) >> 20)
-#define AGP_CAPID_GET_MINOR(x) (((x) & 0x000f0000U) >> 16)
-#define AGP_CAPID_GET_NEXT_PTR(x) (((x) & 0x0000ff00U) >> 8)
-#define AGP_CAPID_GET_CAP_ID(x) (((x) & 0x000000ffU) >> 0)
-
-#define AGP_STATUS 0x4
-#define AGP_COMMAND 0x8
-#define AGP_STATUS_AGP3 0x0008
-#define AGP_STATUS_RQ_MASK 0xff000000
-#define AGP_COMMAND_RQ_MASK 0xff000000
-#define AGP_STATUS_ARQSZ_MASK 0xe000
-#define AGP_COMMAND_ARQSZ_MASK 0xe000
-#define AGP_STATUS_CAL_MASK 0x1c00
-#define AGP_COMMAND_CAL_MASK 0x1c00
-#define AGP_STATUS_ISOCH 0x10000
-#define AGP_STATUS_SBA 0x0200
-#define AGP_STATUS_ITA_COH 0x0100
-#define AGP_STATUS_GART64 0x0080
-#define AGP_STATUS_HTRANS 0x0040
-#define AGP_STATUS_64BIT 0x0020
-#define AGP_STATUS_FW 0x0010
-#define AGP_COMMAND_RQ_MASK 0xff000000
-#define AGP_COMMAND_ARQSZ_MASK 0xe000
-#define AGP_COMMAND_CAL_MASK 0x1c00
-#define AGP_COMMAND_SBA 0x0200
-#define AGP_COMMAND_AGP 0x0100
-#define AGP_COMMAND_GART64 0x0080
-#define AGP_COMMAND_64BIT 0x0020
-#define AGP_COMMAND_FW 0x0010
-
-/*
- * Config offsets for Intel AGP chipsets.
- */
-#define AGP_INTEL_NBXCFG 0x50
-#define AGP_INTEL_ERRSTS 0x91
-#define AGP_INTEL_AGPCTRL 0xb0
-#define AGP_INTEL_APSIZE 0xb4
-#define AGP_INTEL_ATTBASE 0xb8
-
-/*
- * Config offsets for Intel i820/i840/i845/i850/i860/i865 AGP chipsets.
- */
-#define AGP_INTEL_MCHCFG 0x50
-#define AGP_INTEL_I820_RDCR 0x51
-#define AGP_INTEL_I845_MCHCFG 0x51
-#define AGP_INTEL_I8XX_ERRSTS 0xc8
-
-/*
- * Config offsets for VIA AGP 2.x chipsets.
- */
-#define AGP_VIA_GARTCTRL 0x80
-#define AGP_VIA_APSIZE 0x84
-#define AGP_VIA_ATTBASE 0x88
-
-/*
- * Config offsets for VIA AGP 3.0 chipsets.
- */
-#define AGP3_VIA_GARTCTRL 0x90
-#define AGP3_VIA_APSIZE 0x94
-#define AGP3_VIA_ATTBASE 0x98
-#define AGP_VIA_AGPSEL 0xfd
-
-/*
- * Config offsets for SiS AGP chipsets.
- */
-#define AGP_SIS_ATTBASE 0x90
-#define AGP_SIS_WINCTRL 0x94
-#define AGP_SIS_TLBCTRL 0x97
-#define AGP_SIS_TLBFLUSH 0x98
-
-/*
- * Config offsets for Ali AGP chipsets.
- */
-#define AGP_ALI_AGPCTRL 0xb8
-#define AGP_ALI_ATTBASE 0xbc
-#define AGP_ALI_TLBCTRL 0xc0
-
-/*
- * Config offsets for the AMD 751 chipset.
- */
-#define AGP_AMD751_APBASE 0x10
-#define AGP_AMD751_REGISTERS 0x14
-#define AGP_AMD751_APCTRL 0xac
-#define AGP_AMD751_MODECTRL 0xb0
-#define AGP_AMD751_MODECTRL_SYNEN 0x80
-#define AGP_AMD751_MODECTRL2 0xb2
-#define AGP_AMD751_MODECTRL2_G1LM 0x01
-#define AGP_AMD751_MODECTRL2_GPDCE 0x02
-#define AGP_AMD751_MODECTRL2_NGSE 0x08
-
-/*
- * Memory mapped register offsets for AMD 751 chipset.
- */
-#define AGP_AMD751_CAPS 0x00
-#define AGP_AMD751_CAPS_EHI 0x0800
-#define AGP_AMD751_CAPS_P2P 0x0400
-#define AGP_AMD751_CAPS_MPC 0x0200
-#define AGP_AMD751_CAPS_VBE 0x0100
-#define AGP_AMD751_CAPS_REV 0x00ff
-#define AGP_AMD751_STATUS 0x02
-#define AGP_AMD751_STATUS_P2PS 0x0800
-#define AGP_AMD751_STATUS_GCS 0x0400
-#define AGP_AMD751_STATUS_MPS 0x0200
-#define AGP_AMD751_STATUS_VBES 0x0100
-#define AGP_AMD751_STATUS_P2PE 0x0008
-#define AGP_AMD751_STATUS_GCE 0x0004
-#define AGP_AMD751_STATUS_VBEE 0x0001
-#define AGP_AMD751_ATTBASE 0x04
-#define AGP_AMD751_TLBCTRL 0x0c
-
-/*
- * Config registers for i810 device 0
- */
-#define AGP_I810_SMRAM 0x70
-#define AGP_I810_SMRAM_GMS 0xc0
-#define AGP_I810_SMRAM_GMS_DISABLED 0x00
-#define AGP_I810_SMRAM_GMS_ENABLED_0 0x40
-#define AGP_I810_SMRAM_GMS_ENABLED_512 0x80
-#define AGP_I810_SMRAM_GMS_ENABLED_1024 0xc0
-#define AGP_I810_MISCC 0x72
-#define AGP_I810_MISCC_WINSIZE 0x0001
-#define AGP_I810_MISCC_WINSIZE_64 0x0000
-#define AGP_I810_MISCC_WINSIZE_32 0x0001
-#define AGP_I810_MISCC_PLCK 0x0008
-#define AGP_I810_MISCC_PLCK_UNLOCKED 0x0000
-#define AGP_I810_MISCC_PLCK_LOCKED 0x0008
-#define AGP_I810_MISCC_WPTC 0x0030
-#define AGP_I810_MISCC_WPTC_NOLIMIT 0x0000
-#define AGP_I810_MISCC_WPTC_62 0x0010
-#define AGP_I810_MISCC_WPTC_50 0x0020
-#define AGP_I810_MISCC_WPTC_37 0x0030
-#define AGP_I810_MISCC_RPTC 0x00c0
-#define AGP_I810_MISCC_RPTC_NOLIMIT 0x0000
-#define AGP_I810_MISCC_RPTC_62 0x0040
-#define AGP_I810_MISCC_RPTC_50 0x0080
-#define AGP_I810_MISCC_RPTC_37 0x00c0
-
-/*
- * Config registers for i810 device 1
- */
-#define AGP_I810_GMADR 0x10
-#define AGP_I810_MMADR 0x14
-
-/*
- * Memory mapped register offsets for i810 chipset.
- */
-#define AGP_I810_PGTBL_CTL 0x2020
-#define AGP_I810_DRT 0x3000
-#define AGP_I810_DRT_UNPOPULATED 0x00
-#define AGP_I810_DRT_POPULATED 0x01
-#define AGP_I810_GTT 0x10000
-
-/*
- * Config registers for i830MG device 0
- */
-#define AGP_I830_GCC1 0x52
-#define AGP_I830_GCC1_DEV2 0x08
-#define AGP_I830_GCC1_DEV2_ENABLED 0x00
-#define AGP_I830_GCC1_DEV2_DISABLED 0x08
-#define AGP_I830_GCC1_GMS 0x70
-#define AGP_I830_GCC1_GMS_STOLEN_512 0x20
-#define AGP_I830_GCC1_GMS_STOLEN_1024 0x30
-#define AGP_I830_GCC1_GMS_STOLEN_8192 0x40
-#define AGP_I830_GCC1_GMASIZE 0x01
-#define AGP_I830_GCC1_GMASIZE_64 0x01
-#define AGP_I830_GCC1_GMASIZE_128 0x00
-
-/*
- * Config registers for 852GM/855GM/865G device 0
- */
-#define AGP_I855_GCC1 0x52
-#define AGP_I855_GCC1_DEV2 0x08
-#define AGP_I855_GCC1_DEV2_ENABLED 0x00
-#define AGP_I855_GCC1_DEV2_DISABLED 0x08
-#define AGP_I855_GCC1_GMS 0x70
-#define AGP_I855_GCC1_GMS_STOLEN_0M 0x00
-#define AGP_I855_GCC1_GMS_STOLEN_1M 0x10
-#define AGP_I855_GCC1_GMS_STOLEN_4M 0x20
-#define AGP_I855_GCC1_GMS_STOLEN_8M 0x30
-#define AGP_I855_GCC1_GMS_STOLEN_16M 0x40
-#define AGP_I855_GCC1_GMS_STOLEN_32M 0x50
-
-/*
- * 852GM/855GM variant identification
- */
-#define AGP_I85X_CAPID 0x44
-#define AGP_I85X_VARIANT_MASK 0x7
-#define AGP_I85X_VARIANT_SHIFT 5
-#define AGP_I855_GME 0x0
-#define AGP_I855_GM 0x4
-#define AGP_I852_GME 0x2
-#define AGP_I852_GM 0x5
-
-/*
- * NVIDIA nForce/nForce2 registers
- */
-#define AGP_NVIDIA_0_APBASE 0x10
-#define AGP_NVIDIA_0_APSIZE 0x80
-#define AGP_NVIDIA_1_WBC 0xf0
-#define AGP_NVIDIA_2_GARTCTRL 0xd0
-#define AGP_NVIDIA_2_APBASE 0xd8
-#define AGP_NVIDIA_2_APLIMIT 0xdc
-#define AGP_NVIDIA_2_ATTBASE(i) (0xe0 + (i) * 4)
-#define AGP_NVIDIA_3_APBASE 0x50
-#define AGP_NVIDIA_3_APLIMIT 0x54
-
-/*
- * AMD64 GART registers
- */
-#define AGP_AMD64_APCTRL 0x90
-#define AGP_AMD64_APBASE 0x94
-#define AGP_AMD64_ATTBASE 0x98
-#define AGP_AMD64_CACHECTRL 0x9c
-#define AGP_AMD64_APCTRL_GARTEN 0x00000001
-#define AGP_AMD64_APCTRL_SIZE_MASK 0x0000000e
-#define AGP_AMD64_APCTRL_DISGARTCPU 0x00000010
-#define AGP_AMD64_APCTRL_DISGARTIO 0x00000020
-#define AGP_AMD64_APCTRL_DISWLKPRB 0x00000040
-#define AGP_AMD64_APBASE_MASK 0x00007fff
-#define AGP_AMD64_ATTBASE_MASK 0xfffffff0
-#define AGP_AMD64_CACHECTRL_INVGART 0x00000001
-#define AGP_AMD64_CACHECTRL_PTEERR 0x00000002
-
-#endif /* !_PCI_AGPREG_H_ */
diff --git a/sys/dev/agp/agpvar.h b/sys/dev/agp/agpvar.h
deleted file mode 100644
index 0869c26..0000000
--- a/sys/dev/agp/agpvar.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * Copyright (c) 2000 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _PCI_AGPVAR_H_
-#define _PCI_AGPVAR_H_
-
-/*
- * The AGP chipset can be acquired by user or kernel code. If the
- * chipset has already been acquired, it cannot be acquired by another
- * user until the previous user has released it.
- */
-enum agp_acquire_state {
- AGP_ACQUIRE_FREE,
- AGP_ACQUIRE_USER,
- AGP_ACQUIRE_KERNEL
-};
-
-/*
- * This structure is used to query the state of the AGP system.
- */
-struct agp_info {
- u_int32_t ai_mode;
- vm_offset_t ai_aperture_base;
- vm_size_t ai_aperture_size;
- vm_offset_t ai_aperture_va;
- vm_size_t ai_memory_allowed;
- vm_size_t ai_memory_used;
- u_int32_t ai_devid;
-};
-
-struct agp_memory_info {
- vm_size_t ami_size; /* size in bytes */
- vm_offset_t ami_physical; /* bogus hack for i810 */
- vm_offset_t ami_offset; /* page offset if bound */
- int ami_is_bound; /* non-zero if bound */
-};
-
-/*
- * Find the AGP device and return it.
- */
-device_t agp_find_device(void);
-
-/*
- * Return the current owner of the AGP chipset.
- */
-enum agp_acquire_state agp_state(device_t dev);
-
-/*
- * Query the state of the AGP system.
- */
-void agp_get_info(device_t dev, struct agp_info *info);
-
-/*
- * Acquire the AGP chipset for use by the kernel. Returns EBUSY if the
- * AGP chipset is already acquired by another user.
- */
-int agp_acquire(device_t dev);
-
-/*
- * Release the AGP chipset.
- */
-int agp_release(device_t dev);
-
-/*
- * Enable the agp hardware with the relavent mode. The mode bits are
- * defined in <pci/agpreg.h>
- */
-int agp_enable(device_t dev, u_int32_t mode);
-
-/*
- * Allocate physical memory suitable for mapping into the AGP
- * aperture. The value returned is an opaque handle which can be
- * passed to agp_bind(), agp_unbind() or agp_deallocate().
- */
-void *agp_alloc_memory(device_t dev, int type, vm_size_t bytes);
-
-/*
- * Free memory which was allocated with agp_allocate().
- */
-void agp_free_memory(device_t dev, void *handle);
-
-/*
- * Bind memory allocated with agp_allocate() at a given offset within
- * the AGP aperture. Returns EINVAL if the memory is already bound or
- * the offset is not at an AGP page boundary.
- */
-int agp_bind_memory(device_t dev, void *handle, vm_offset_t offset);
-
-/*
- * Unbind memory from the AGP aperture. Returns EINVAL if the memory
- * is not bound.
- */
-int agp_unbind_memory(device_t dev, void *handle);
-
-/*
- * Retrieve information about a memory block allocated with
- * agp_alloc_memory().
- */
-void agp_memory_info(device_t dev, void *handle, struct agp_memory_info *mi);
-
-#endif /* !_PCI_AGPVAR_H_ */
diff --git a/sys/dev/dc/dcphy.c b/sys/dev/dc/dcphy.c
deleted file mode 100644
index 3a6a5de..0000000
--- a/sys/dev/dc/dcphy.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998, 1999
- * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Pseudo-driver for internal NWAY support on DEC 21143 and workalike
- * controllers. Technically we're abusing the miibus code to handle
- * media selection and NWAY support here since there is no MII
- * interface. However the logical operations are roughly the same,
- * and the alternative is to create a fake MII interface in the driver,
- * which is harder to do.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <sys/lock.h>
-#include <sys/module.h>
-#include <sys/mutex.h>
-#include <sys/bus.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_media.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-#include "miidevs.h"
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-
-#include <dev/pci/pcivar.h>
-
-#include <pci/if_dcreg.h>
-
-#include "miibus_if.h"
-
-#define DC_SETBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, \
- CSR_READ_4(sc, reg) | x)
-
-#define DC_CLRBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, \
- CSR_READ_4(sc, reg) & ~x)
-
-#define MIIF_AUTOTIMEOUT 0x0004
-
-/*
- * This is the subsystem ID for the built-in 21143 ethernet
- * in several Compaq Presario systems. Apparently these are
- * 10Mbps only, so we need to treat them specially.
- */
-#define COMPAQ_PRESARIO_ID 0xb0bb0e11
-
-static int dcphy_probe(device_t);
-static int dcphy_attach(device_t);
-
-static device_method_t dcphy_methods[] = {
- /* device interface */
- DEVMETHOD(device_probe, dcphy_probe),
- DEVMETHOD(device_attach, dcphy_attach),
- DEVMETHOD(device_detach, mii_phy_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- { 0, 0 }
-};
-
-static devclass_t dcphy_devclass;
-
-static driver_t dcphy_driver = {
- "dcphy",
- dcphy_methods,
- sizeof(struct mii_softc)
-};
-
-DRIVER_MODULE(dcphy, miibus, dcphy_driver, dcphy_devclass, 0, 0);
-
-static int dcphy_service(struct mii_softc *, struct mii_data *, int);
-static void dcphy_status(struct mii_softc *);
-static void dcphy_reset(struct mii_softc *);
-static int dcphy_auto(struct mii_softc *);
-
-static int
-dcphy_probe(dev)
- device_t dev;
-{
- struct mii_attach_args *ma;
-
- ma = device_get_ivars(dev);
-
- /*
- * The dc driver will report the 21143 vendor and device
- * ID to let us know that it wants us to attach.
- */
- if (ma->mii_id1 != DC_VENDORID_DEC ||
- ma->mii_id2 != DC_DEVICEID_21143)
- return(ENXIO);
-
- device_set_desc(dev, "Intel 21143 NWAY media interface");
-
- return (0);
-}
-
-static int
-dcphy_attach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_attach_args *ma;
- struct mii_data *mii;
- struct dc_softc *dc_sc;
-
- sc = device_get_softc(dev);
- ma = device_get_ivars(dev);
- sc->mii_dev = device_get_parent(dev);
- mii = device_get_softc(sc->mii_dev);
- LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
-
- sc->mii_inst = mii->mii_instance;
- sc->mii_phy = ma->mii_phyno;
- sc->mii_service = dcphy_service;
- sc->mii_pdata = mii;
-
- sc->mii_flags |= MIIF_NOISOLATE;
- mii->mii_instance++;
-
-#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
-
- ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
- BMCR_ISO);
-
- /*dcphy_reset(sc);*/
- dc_sc = mii->mii_ifp->if_softc;
- CSR_WRITE_4(dc_sc, DC_10BTSTAT, 0);
- CSR_WRITE_4(dc_sc, DC_10BTCTRL, 0);
-
- switch(pci_read_config(device_get_parent(sc->mii_dev),
- DC_PCI_CSID, 4)) {
- case COMPAQ_PRESARIO_ID:
- /* Example of how to only allow 10Mbps modes. */
- sc->mii_capabilities = BMSR_ANEG|BMSR_10TFDX|BMSR_10THDX;
- break;
- default:
- if (dc_sc->dc_pmode == DC_PMODE_SIA) {
- sc->mii_capabilities =
- BMSR_ANEG|BMSR_10TFDX|BMSR_10THDX;
- } else {
- ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP,
- sc->mii_inst), BMCR_LOOP|BMCR_S100);
-
- sc->mii_capabilities =
- BMSR_ANEG|BMSR_100TXFDX|BMSR_100TXHDX|
- BMSR_10TFDX|BMSR_10THDX;
- }
- break;
- }
-
- sc->mii_capabilities &= ma->mii_capmask;
- device_printf(dev, " ");
- mii_add_media(sc);
- printf("\n");
-#undef ADD
-
- MIIBUS_MEDIAINIT(sc->mii_dev);
- return(0);
-}
-
-static int
-dcphy_service(sc, mii, cmd)
- struct mii_softc *sc;
- struct mii_data *mii;
- int cmd;
-{
- struct dc_softc *dc_sc;
- struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
- int reg;
- u_int32_t mode;
-
- dc_sc = mii->mii_ifp->if_softc;
-
- switch (cmd) {
- case MII_POLLSTAT:
- /*
- * If we're not polling our PHY instance, just return.
- */
- if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
- return (0);
- }
- break;
-
- case MII_MEDIACHG:
- /*
- * If the media indicates a different PHY instance,
- * isolate ourselves.
- */
- if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
- return (0);
- }
-
- /*
- * If the interface is not up, don't do anything.
- */
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- break;
-
- sc->mii_flags = 0;
- mii->mii_media_active = IFM_NONE;
- mode = CSR_READ_4(dc_sc, DC_NETCFG);
- mode &= ~(DC_NETCFG_FULLDUPLEX|DC_NETCFG_PORTSEL|
- DC_NETCFG_PCS|DC_NETCFG_SCRAMBLER|DC_NETCFG_SPEEDSEL);
-
- switch (IFM_SUBTYPE(ife->ifm_media)) {
- case IFM_AUTO:
- /*dcphy_reset(sc);*/
- (void) dcphy_auto(sc);
- break;
- case IFM_100_T4:
- /*
- * XXX Not supported as a manual setting right now.
- */
- return (EINVAL);
- case IFM_100_TX:
- dcphy_reset(sc);
- DC_CLRBIT(dc_sc, DC_10BTCTRL, DC_TCTL_AUTONEGENBL);
- mode |= DC_NETCFG_PORTSEL|DC_NETCFG_PCS|
- DC_NETCFG_SCRAMBLER;
- if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
- mode |= DC_NETCFG_FULLDUPLEX;
- else
- mode &= ~DC_NETCFG_FULLDUPLEX;
- CSR_WRITE_4(dc_sc, DC_NETCFG, mode);
- break;
- case IFM_10_T:
- DC_CLRBIT(dc_sc, DC_SIARESET, DC_SIA_RESET);
- DC_CLRBIT(dc_sc, DC_10BTCTRL, 0xFFFF);
- if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
- DC_SETBIT(dc_sc, DC_10BTCTRL, 0x7F3D);
- else
- DC_SETBIT(dc_sc, DC_10BTCTRL, 0x7F3F);
- DC_SETBIT(dc_sc, DC_SIARESET, DC_SIA_RESET);
- DC_CLRBIT(dc_sc, DC_10BTCTRL, DC_TCTL_AUTONEGENBL);
- mode &= ~DC_NETCFG_PORTSEL;
- mode |= DC_NETCFG_SPEEDSEL;
- if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
- mode |= DC_NETCFG_FULLDUPLEX;
- else
- mode &= ~DC_NETCFG_FULLDUPLEX;
- CSR_WRITE_4(dc_sc, DC_NETCFG, mode);
- break;
- default:
- return(EINVAL);
- }
- break;
-
- case MII_TICK:
- /*
- * If we're not currently selected, just return.
- */
- if (IFM_INST(ife->ifm_media) != sc->mii_inst)
- return (0);
-
- /*
- * Is the interface even up?
- */
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- return (0);
-
- /*
- * Only used for autonegotiation.
- */
- if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
- break;
-
- reg = CSR_READ_4(dc_sc, DC_10BTSTAT);
- if (!(reg & DC_TSTAT_LS10) || !(reg & DC_TSTAT_LS100))
- break;
-
- /*
- * Only retry autonegotiation every 5 seconds.
- *
- * Otherwise, fall through to calling dcphy_status()
- * since real Intel 21143 chips don't show valid link
- * status until autonegotiation is switched off, and
- * that only happens in dcphy_status(). Without this,
- * successful autonegotiation is never recognised on
- * these chips.
- */
- if (++sc->mii_ticks <= 50)
- break;
-
- sc->mii_ticks = 0;
- dcphy_auto(sc);
-
- break;
- }
-
- /* Update the media status. */
- dcphy_status(sc);
-
- /* Callback if something changed. */
- mii_phy_update(sc, cmd);
- return (0);
-}
-
-static void
-dcphy_status(sc)
- struct mii_softc *sc;
-{
- struct mii_data *mii = sc->mii_pdata;
- int reg, anlpar, tstat = 0;
- struct dc_softc *dc_sc;
-
- dc_sc = mii->mii_ifp->if_softc;
-
- mii->mii_media_status = IFM_AVALID;
- mii->mii_media_active = IFM_ETHER;
-
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- return;
-
- reg = CSR_READ_4(dc_sc, DC_10BTSTAT);
- if (!(reg & DC_TSTAT_LS10) || !(reg & DC_TSTAT_LS100))
- mii->mii_media_status |= IFM_ACTIVE;
-
- if (CSR_READ_4(dc_sc, DC_10BTCTRL) & DC_TCTL_AUTONEGENBL) {
- /* Erg, still trying, I guess... */
- tstat = CSR_READ_4(dc_sc, DC_10BTSTAT);
- if ((tstat & DC_TSTAT_ANEGSTAT) != DC_ASTAT_AUTONEGCMP) {
- if ((DC_IS_MACRONIX(dc_sc) || DC_IS_PNICII(dc_sc)) &&
- (tstat & DC_TSTAT_ANEGSTAT) == DC_ASTAT_DISABLE)
- goto skip;
- mii->mii_media_active |= IFM_NONE;
- return;
- }
-
- if (tstat & DC_TSTAT_LP_CAN_NWAY) {
- anlpar = tstat >> 16;
- if (anlpar & ANLPAR_T4 &&
- sc->mii_capabilities & BMSR_100TXHDX)
- mii->mii_media_active |= IFM_100_T4;
- else if (anlpar & ANLPAR_TX_FD &&
- sc->mii_capabilities & BMSR_100TXFDX)
- mii->mii_media_active |= IFM_100_TX|IFM_FDX;
- else if (anlpar & ANLPAR_TX &&
- sc->mii_capabilities & BMSR_100TXHDX)
- mii->mii_media_active |= IFM_100_TX;
- else if (anlpar & ANLPAR_10_FD)
- mii->mii_media_active |= IFM_10_T|IFM_FDX;
- else if (anlpar & ANLPAR_10)
- mii->mii_media_active |= IFM_10_T;
- else
- mii->mii_media_active |= IFM_NONE;
- if (DC_IS_INTEL(dc_sc))
- DC_CLRBIT(dc_sc, DC_10BTCTRL,
- DC_TCTL_AUTONEGENBL);
- return;
- }
- /*
- * If the other side doesn't support NWAY, then the
- * best we can do is determine if we have a 10Mbps or
- * 100Mbps link. There's no way to know if the link
- * is full or half duplex, so we default to half duplex
- * and hope that the user is clever enough to manually
- * change the media settings if we're wrong.
- */
- if (!(reg & DC_TSTAT_LS100))
- mii->mii_media_active |= IFM_100_TX;
- else if (!(reg & DC_TSTAT_LS10))
- mii->mii_media_active |= IFM_10_T;
- else
- mii->mii_media_active |= IFM_NONE;
- if (DC_IS_INTEL(dc_sc))
- DC_CLRBIT(dc_sc, DC_10BTCTRL, DC_TCTL_AUTONEGENBL);
- return;
- }
-
-skip:
-
- if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_SPEEDSEL)
- mii->mii_media_active |= IFM_10_T;
- else
- mii->mii_media_active |= IFM_100_TX;
- if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_FULLDUPLEX)
- mii->mii_media_active |= IFM_FDX;
-
- return;
-}
-
-static int
-dcphy_auto(mii)
- struct mii_softc *mii;
-{
- struct dc_softc *sc;
-
- sc = mii->mii_pdata->mii_ifp->if_softc;
-
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_FULLDUPLEX);
- DC_CLRBIT(sc, DC_SIARESET, DC_SIA_RESET);
- if (mii->mii_capabilities & BMSR_100TXHDX)
- CSR_WRITE_4(sc, DC_10BTCTRL, 0x3FFFF);
- else
- CSR_WRITE_4(sc, DC_10BTCTRL, 0xFFFF);
- DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
- DC_SETBIT(sc, DC_10BTCTRL, DC_TCTL_AUTONEGENBL);
- DC_SETBIT(sc, DC_10BTSTAT, DC_ASTAT_TXDISABLE);
-
- return(EJUSTRETURN);
-}
-
-static void
-dcphy_reset(mii)
- struct mii_softc *mii;
-{
- struct dc_softc *sc;
-
- sc = mii->mii_pdata->mii_ifp->if_softc;
-
- DC_CLRBIT(sc, DC_SIARESET, DC_SIA_RESET);
- DELAY(1000);
- DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
-
- return;
-}
-
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
deleted file mode 100644
index f86d4e4..0000000
--- a/sys/dev/dc/if_dc.c
+++ /dev/null
@@ -1,3824 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998, 1999
- * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * DEC "tulip" clone ethernet driver. Supports the DEC/Intel 21143
- * series chips and several workalikes including the following:
- *
- * Macronix 98713/98715/98725/98727/98732 PMAC (www.macronix.com)
- * Macronix/Lite-On 82c115 PNIC II (www.macronix.com)
- * Lite-On 82c168/82c169 PNIC (www.litecom.com)
- * ASIX Electronics AX88140A (www.asix.com.tw)
- * ASIX Electronics AX88141 (www.asix.com.tw)
- * ADMtek AL981 (www.admtek.com.tw)
- * ADMtek AN985 (www.admtek.com.tw)
- * Netgear FA511 (www.netgear.com) Appears to be rebadged ADMTek AN985
- * Davicom DM9100, DM9102, DM9102A (www.davicom8.com)
- * Accton EN1217 (www.accton.com)
- * Xircom X3201 (www.xircom.com)
- * Abocom FE2500
- * Conexant LANfinity (www.conexant.com)
- * 3Com OfficeConnect 10/100B 3CSOHO100B (www.3com.com)
- *
- * Datasheets for the 21143 are available at developer.intel.com.
- * Datasheets for the clone parts can be found at their respective sites.
- * (Except for the PNIC; see www.freebsd.org/~wpaul/PNIC/pnic.ps.gz.)
- * The PNIC II is essentially a Macronix 98715A chip; the only difference
- * worth noting is that its multicast hash table is only 128 bits wide
- * instead of 512.
- *
- * Written by Bill Paul <wpaul@ee.columbia.edu>
- * Electrical Engineering Department
- * Columbia University, New York City
- */
-/*
- * The Intel 21143 is the successor to the DEC 21140. It is basically
- * the same as the 21140 but with a few new features. The 21143 supports
- * three kinds of media attachments:
- *
- * o MII port, for 10Mbps and 100Mbps support and NWAY
- * autonegotiation provided by an external PHY.
- * o SYM port, for symbol mode 100Mbps support.
- * o 10baseT port.
- * o AUI/BNC port.
- *
- * The 100Mbps SYM port and 10baseT port can be used together in
- * combination with the internal NWAY support to create a 10/100
- * autosensing configuration.
- *
- * Note that not all tulip workalikes are handled in this driver: we only
- * deal with those which are relatively well behaved. The Winbond is
- * handled separately due to its different register offsets and the
- * special handling needed for its various bugs. The PNIC is handled
- * here, but I'm not thrilled about it.
- *
- * All of the workalike chips use some form of MII transceiver support
- * with the exception of the Macronix chips, which also have a SYM port.
- * The ASIX AX88140A is also documented to have a SYM port, but all
- * the cards I've seen use an MII transceiver, probably because the
- * AX88140A doesn't support internal NWAY.
- */
-
-#include <sys/param.h>
-#include <sys/endian.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-#include <net/if_vlan_var.h>
-
-#include <net/bpf.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#define DC_USEIOSPACE
-#ifdef __alpha__
-#define SRM_MEDIA
-#endif
-
-#include <pci/if_dcreg.h>
-
-#ifdef __sparc64__
-#include <dev/ofw/openfirm.h>
-#include <machine/ofw_machdep.h>
-#endif
-
-MODULE_DEPEND(dc, pci, 1, 1, 1);
-MODULE_DEPEND(dc, ether, 1, 1, 1);
-MODULE_DEPEND(dc, miibus, 1, 1, 1);
-
-/* "controller miibus0" required. See GENERIC if you get errors here. */
-#include "miibus_if.h"
-
-/*
- * Various supported device vendors/types and their names.
- */
-static struct dc_type dc_devs[] = {
- { DC_VENDORID_DEC, DC_DEVICEID_21143,
- "Intel 21143 10/100BaseTX" },
- { DC_VENDORID_DAVICOM, DC_DEVICEID_DM9009,
- "Davicom DM9009 10/100BaseTX" },
- { DC_VENDORID_DAVICOM, DC_DEVICEID_DM9100,
- "Davicom DM9100 10/100BaseTX" },
- { DC_VENDORID_DAVICOM, DC_DEVICEID_DM9102,
- "Davicom DM9102 10/100BaseTX" },
- { DC_VENDORID_DAVICOM, DC_DEVICEID_DM9102,
- "Davicom DM9102A 10/100BaseTX" },
- { DC_VENDORID_ADMTEK, DC_DEVICEID_AL981,
- "ADMtek AL981 10/100BaseTX" },
- { DC_VENDORID_ADMTEK, DC_DEVICEID_AN985,
- "ADMtek AN985 10/100BaseTX" },
- { DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9511,
- "ADMtek ADM9511 10/100BaseTX" },
- { DC_VENDORID_ADMTEK, DC_DEVICEID_ADM9513,
- "ADMtek ADM9513 10/100BaseTX" },
- { DC_VENDORID_ADMTEK, DC_DEVICEID_FA511,
- "Netgear FA511 10/100BaseTX" },
- { DC_VENDORID_ASIX, DC_DEVICEID_AX88140A,
- "ASIX AX88140A 10/100BaseTX" },
- { DC_VENDORID_ASIX, DC_DEVICEID_AX88140A,
- "ASIX AX88141 10/100BaseTX" },
- { DC_VENDORID_MX, DC_DEVICEID_98713,
- "Macronix 98713 10/100BaseTX" },
- { DC_VENDORID_MX, DC_DEVICEID_98713,
- "Macronix 98713A 10/100BaseTX" },
- { DC_VENDORID_CP, DC_DEVICEID_98713_CP,
- "Compex RL100-TX 10/100BaseTX" },
- { DC_VENDORID_CP, DC_DEVICEID_98713_CP,
- "Compex RL100-TX 10/100BaseTX" },
- { DC_VENDORID_MX, DC_DEVICEID_987x5,
- "Macronix 98715/98715A 10/100BaseTX" },
- { DC_VENDORID_MX, DC_DEVICEID_987x5,
- "Macronix 98715AEC-C 10/100BaseTX" },
- { DC_VENDORID_MX, DC_DEVICEID_987x5,
- "Macronix 98725 10/100BaseTX" },
- { DC_VENDORID_MX, DC_DEVICEID_98727,
- "Macronix 98727/98732 10/100BaseTX" },
- { DC_VENDORID_LO, DC_DEVICEID_82C115,
- "LC82C115 PNIC II 10/100BaseTX" },
- { DC_VENDORID_LO, DC_DEVICEID_82C168,
- "82c168 PNIC 10/100BaseTX" },
- { DC_VENDORID_LO, DC_DEVICEID_82C168,
- "82c169 PNIC 10/100BaseTX" },
- { DC_VENDORID_ACCTON, DC_DEVICEID_EN1217,
- "Accton EN1217 10/100BaseTX" },
- { DC_VENDORID_ACCTON, DC_DEVICEID_EN2242,
- "Accton EN2242 MiniPCI 10/100BaseTX" },
- { DC_VENDORID_XIRCOM, DC_DEVICEID_X3201,
- "Xircom X3201 10/100BaseTX" },
- { DC_VENDORID_ABOCOM, DC_DEVICEID_FE2500,
- "Abocom FE2500 10/100BaseTX" },
- { DC_VENDORID_ABOCOM, DC_DEVICEID_FE2500MX,
- "Abocom FE2500MX 10/100BaseTX" },
- { DC_VENDORID_CONEXANT, DC_DEVICEID_RS7112,
- "Conexant LANfinity MiniPCI 10/100BaseTX" },
- { DC_VENDORID_HAWKING, DC_DEVICEID_HAWKING_PN672TX,
- "Hawking CB102 CardBus 10/100" },
- { DC_VENDORID_PLANEX, DC_DEVICEID_FNW3602T,
- "PlaneX FNW-3602-T CardBus 10/100" },
- { DC_VENDORID_3COM, DC_DEVICEID_3CSOHOB,
- "3Com OfficeConnect 10/100B" },
- { DC_VENDORID_MICROSOFT, DC_DEVICEID_MSMN120,
- "Microsoft MN-120 CardBus 10/100" },
- { DC_VENDORID_MICROSOFT, DC_DEVICEID_MSMN130,
- "Microsoft MN-130 10/100" },
- { DC_VENDORID_MICROSOFT, DC_DEVICEID_MSMN130_FAKE,
- "Microsoft MN-130 10/100" },
- { 0, 0, NULL }
-};
-
-static int dc_probe(device_t);
-static int dc_attach(device_t);
-static int dc_detach(device_t);
-static int dc_suspend(device_t);
-static int dc_resume(device_t);
-static struct dc_type *dc_devtype(device_t);
-static int dc_newbuf(struct dc_softc *, int, int);
-static int dc_encap(struct dc_softc *, struct mbuf **);
-static void dc_pnic_rx_bug_war(struct dc_softc *, int);
-static int dc_rx_resync(struct dc_softc *);
-static void dc_rxeof(struct dc_softc *);
-static void dc_txeof(struct dc_softc *);
-static void dc_tick(void *);
-static void dc_tx_underrun(struct dc_softc *);
-static void dc_intr(void *);
-static void dc_start(struct ifnet *);
-static int dc_ioctl(struct ifnet *, u_long, caddr_t);
-static void dc_init(void *);
-static void dc_stop(struct dc_softc *);
-static void dc_watchdog(struct ifnet *);
-static void dc_shutdown(device_t);
-static int dc_ifmedia_upd(struct ifnet *);
-static void dc_ifmedia_sts(struct ifnet *, struct ifmediareq *);
-
-static void dc_delay(struct dc_softc *);
-static void dc_eeprom_idle(struct dc_softc *);
-static void dc_eeprom_putbyte(struct dc_softc *, int);
-static void dc_eeprom_getword(struct dc_softc *, int, u_int16_t *);
-static void dc_eeprom_getword_pnic(struct dc_softc *, int, u_int16_t *);
-static void dc_eeprom_getword_xircom(struct dc_softc *, int, u_int16_t *);
-static void dc_eeprom_width(struct dc_softc *);
-static void dc_read_eeprom(struct dc_softc *, caddr_t, int, int, int);
-
-static void dc_mii_writebit(struct dc_softc *, int);
-static int dc_mii_readbit(struct dc_softc *);
-static void dc_mii_sync(struct dc_softc *);
-static void dc_mii_send(struct dc_softc *, u_int32_t, int);
-static int dc_mii_readreg(struct dc_softc *, struct dc_mii_frame *);
-static int dc_mii_writereg(struct dc_softc *, struct dc_mii_frame *);
-static int dc_miibus_readreg(device_t, int, int);
-static int dc_miibus_writereg(device_t, int, int, int);
-static void dc_miibus_statchg(device_t);
-static void dc_miibus_mediainit(device_t);
-
-static void dc_setcfg(struct dc_softc *, int);
-static uint32_t dc_mchash_le(struct dc_softc *, const uint8_t *);
-static uint32_t dc_mchash_be(const uint8_t *);
-static void dc_setfilt_21143(struct dc_softc *);
-static void dc_setfilt_asix(struct dc_softc *);
-static void dc_setfilt_admtek(struct dc_softc *);
-static void dc_setfilt_xircom(struct dc_softc *);
-
-static void dc_setfilt(struct dc_softc *);
-
-static void dc_reset(struct dc_softc *);
-static int dc_list_rx_init(struct dc_softc *);
-static int dc_list_tx_init(struct dc_softc *);
-
-static void dc_read_srom(struct dc_softc *, int);
-static void dc_parse_21143_srom(struct dc_softc *);
-static void dc_decode_leaf_sia(struct dc_softc *, struct dc_eblock_sia *);
-static void dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *);
-static void dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *);
-static void dc_apply_fixup(struct dc_softc *, int);
-
-static void dc_dma_map_txbuf(void *, bus_dma_segment_t *, int, bus_size_t, int);
-static void dc_dma_map_rxbuf(void *, bus_dma_segment_t *, int, bus_size_t, int);
-
-#ifdef DC_USEIOSPACE
-#define DC_RES SYS_RES_IOPORT
-#define DC_RID DC_PCI_CFBIO
-#else
-#define DC_RES SYS_RES_MEMORY
-#define DC_RID DC_PCI_CFBMA
-#endif
-
-static device_method_t dc_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, dc_probe),
- DEVMETHOD(device_attach, dc_attach),
- DEVMETHOD(device_detach, dc_detach),
- DEVMETHOD(device_suspend, dc_suspend),
- DEVMETHOD(device_resume, dc_resume),
- DEVMETHOD(device_shutdown, dc_shutdown),
-
- /* bus interface */
- DEVMETHOD(bus_print_child, bus_generic_print_child),
- DEVMETHOD(bus_driver_added, bus_generic_driver_added),
-
- /* MII interface */
- DEVMETHOD(miibus_readreg, dc_miibus_readreg),
- DEVMETHOD(miibus_writereg, dc_miibus_writereg),
- DEVMETHOD(miibus_statchg, dc_miibus_statchg),
- DEVMETHOD(miibus_mediainit, dc_miibus_mediainit),
-
- { 0, 0 }
-};
-
-static driver_t dc_driver = {
- "dc",
- dc_methods,
- sizeof(struct dc_softc)
-};
-
-static devclass_t dc_devclass;
-#ifdef __i386__
-static int dc_quick = 1;
-SYSCTL_INT(_hw, OID_AUTO, dc_quick, CTLFLAG_RW, &dc_quick, 0,
- "do not m_devget() in dc driver");
-#endif
-
-DRIVER_MODULE(dc, cardbus, dc_driver, dc_devclass, 0, 0);
-DRIVER_MODULE(dc, pci, dc_driver, dc_devclass, 0, 0);
-DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, 0, 0);
-
-#define DC_SETBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) | (x))
-
-#define DC_CLRBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) & ~(x))
-
-#define SIO_SET(x) DC_SETBIT(sc, DC_SIO, (x))
-#define SIO_CLR(x) DC_CLRBIT(sc, DC_SIO, (x))
-
-#define IS_MPSAFE 0
-
-static void
-dc_delay(struct dc_softc *sc)
-{
- int idx;
-
- for (idx = (300 / 33) + 1; idx > 0; idx--)
- CSR_READ_4(sc, DC_BUSCTL);
-}
-
-static void
-dc_eeprom_width(struct dc_softc *sc)
-{
- int i;
-
- /* Force EEPROM to idle state. */
- dc_eeprom_idle(sc);
-
- /* Enter EEPROM access mode. */
- CSR_WRITE_4(sc, DC_SIO, DC_SIO_EESEL);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_ROMCTL_READ);
- dc_delay(sc);
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_CS);
- dc_delay(sc);
-
- for (i = 3; i--;) {
- if (6 & (1 << i))
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_DATAIN);
- else
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_DATAIN);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- }
-
- for (i = 1; i <= 12; i++) {
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- if (!(CSR_READ_4(sc, DC_SIO) & DC_SIO_EE_DATAOUT)) {
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- break;
- }
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- }
-
- /* Turn off EEPROM access mode. */
- dc_eeprom_idle(sc);
-
- if (i < 4 || i > 12)
- sc->dc_romwidth = 6;
- else
- sc->dc_romwidth = i;
-
- /* Enter EEPROM access mode. */
- CSR_WRITE_4(sc, DC_SIO, DC_SIO_EESEL);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_ROMCTL_READ);
- dc_delay(sc);
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_CS);
- dc_delay(sc);
-
- /* Turn off EEPROM access mode. */
- dc_eeprom_idle(sc);
-}
-
-static void
-dc_eeprom_idle(struct dc_softc *sc)
-{
- int i;
-
- CSR_WRITE_4(sc, DC_SIO, DC_SIO_EESEL);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_ROMCTL_READ);
- dc_delay(sc);
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_CS);
- dc_delay(sc);
-
- for (i = 0; i < 25; i++) {
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- }
-
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CS);
- dc_delay(sc);
- CSR_WRITE_4(sc, DC_SIO, 0x00000000);
-}
-
-/*
- * Send a read command and address to the EEPROM, check for ACK.
- */
-static void
-dc_eeprom_putbyte(struct dc_softc *sc, int addr)
-{
- int d, i;
-
- d = DC_EECMD_READ >> 6;
- for (i = 3; i--; ) {
- if (d & (1 << i))
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_DATAIN);
- else
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_DATAIN);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- }
-
- /*
- * Feed in each bit and strobe the clock.
- */
- for (i = sc->dc_romwidth; i--;) {
- if (addr & (1 << i)) {
- SIO_SET(DC_SIO_EE_DATAIN);
- } else {
- SIO_CLR(DC_SIO_EE_DATAIN);
- }
- dc_delay(sc);
- SIO_SET(DC_SIO_EE_CLK);
- dc_delay(sc);
- SIO_CLR(DC_SIO_EE_CLK);
- dc_delay(sc);
- }
-}
-
-/*
- * Read a word of data stored in the EEPROM at address 'addr.'
- * The PNIC 82c168/82c169 has its own non-standard way to read
- * the EEPROM.
- */
-static void
-dc_eeprom_getword_pnic(struct dc_softc *sc, int addr, u_int16_t *dest)
-{
- int i;
- u_int32_t r;
-
- CSR_WRITE_4(sc, DC_PN_SIOCTL, DC_PN_EEOPCODE_READ | addr);
-
- for (i = 0; i < DC_TIMEOUT; i++) {
- DELAY(1);
- r = CSR_READ_4(sc, DC_SIO);
- if (!(r & DC_PN_SIOCTL_BUSY)) {
- *dest = (u_int16_t)(r & 0xFFFF);
- return;
- }
- }
-}
-
-/*
- * Read a word of data stored in the EEPROM at address 'addr.'
- * The Xircom X3201 has its own non-standard way to read
- * the EEPROM, too.
- */
-static void
-dc_eeprom_getword_xircom(struct dc_softc *sc, int addr, u_int16_t *dest)
-{
-
- SIO_SET(DC_SIO_ROMSEL | DC_SIO_ROMCTL_READ);
-
- addr *= 2;
- CSR_WRITE_4(sc, DC_ROM, addr | 0x160);
- *dest = (u_int16_t)CSR_READ_4(sc, DC_SIO) & 0xff;
- addr += 1;
- CSR_WRITE_4(sc, DC_ROM, addr | 0x160);
- *dest |= ((u_int16_t)CSR_READ_4(sc, DC_SIO) & 0xff) << 8;
-
- SIO_CLR(DC_SIO_ROMSEL | DC_SIO_ROMCTL_READ);
-}
-
-/*
- * Read a word of data stored in the EEPROM at address 'addr.'
- */
-static void
-dc_eeprom_getword(struct dc_softc *sc, int addr, u_int16_t *dest)
-{
- int i;
- u_int16_t word = 0;
-
- /* Force EEPROM to idle state. */
- dc_eeprom_idle(sc);
-
- /* Enter EEPROM access mode. */
- CSR_WRITE_4(sc, DC_SIO, DC_SIO_EESEL);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_ROMCTL_READ);
- dc_delay(sc);
- DC_CLRBIT(sc, DC_SIO, DC_SIO_EE_CLK);
- dc_delay(sc);
- DC_SETBIT(sc, DC_SIO, DC_SIO_EE_CS);
- dc_delay(sc);
-
- /*
- * Send address of word we want to read.
- */
- dc_eeprom_putbyte(sc, addr);
-
- /*
- * Start reading bits from EEPROM.
- */
- for (i = 0x8000; i; i >>= 1) {
- SIO_SET(DC_SIO_EE_CLK);
- dc_delay(sc);
- if (CSR_READ_4(sc, DC_SIO) & DC_SIO_EE_DATAOUT)
- word |= i;
- dc_delay(sc);
- SIO_CLR(DC_SIO_EE_CLK);
- dc_delay(sc);
- }
-
- /* Turn off EEPROM access mode. */
- dc_eeprom_idle(sc);
-
- *dest = word;
-}
-
-/*
- * Read a sequence of words from the EEPROM.
- */
-static void
-dc_read_eeprom(struct dc_softc *sc, caddr_t dest, int off, int cnt, int be)
-{
- int i;
- u_int16_t word = 0, *ptr;
-
- for (i = 0; i < cnt; i++) {
- if (DC_IS_PNIC(sc))
- dc_eeprom_getword_pnic(sc, off + i, &word);
- else if (DC_IS_XIRCOM(sc))
- dc_eeprom_getword_xircom(sc, off + i, &word);
- else
- dc_eeprom_getword(sc, off + i, &word);
- ptr = (u_int16_t *)(dest + (i * 2));
- if (be)
- *ptr = be16toh(word);
- else
- *ptr = le16toh(word);
- }
-}
-
-/*
- * The following two routines are taken from the Macronix 98713
- * Application Notes pp.19-21.
- */
-/*
- * Write a bit to the MII bus.
- */
-static void
-dc_mii_writebit(struct dc_softc *sc, int bit)
-{
-
- if (bit)
- CSR_WRITE_4(sc, DC_SIO,
- DC_SIO_ROMCTL_WRITE | DC_SIO_MII_DATAOUT);
- else
- CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE);
-
- DC_SETBIT(sc, DC_SIO, DC_SIO_MII_CLK);
- DC_CLRBIT(sc, DC_SIO, DC_SIO_MII_CLK);
-}
-
-/*
- * Read a bit from the MII bus.
- */
-static int
-dc_mii_readbit(struct dc_softc *sc)
-{
-
- CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_READ | DC_SIO_MII_DIR);
- CSR_READ_4(sc, DC_SIO);
- DC_SETBIT(sc, DC_SIO, DC_SIO_MII_CLK);
- DC_CLRBIT(sc, DC_SIO, DC_SIO_MII_CLK);
- if (CSR_READ_4(sc, DC_SIO) & DC_SIO_MII_DATAIN)
- return (1);
-
- return (0);
-}
-
-/*
- * Sync the PHYs by setting data bit and strobing the clock 32 times.
- */
-static void
-dc_mii_sync(struct dc_softc *sc)
-{
- int i;
-
- CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE);
-
- for (i = 0; i < 32; i++)
- dc_mii_writebit(sc, 1);
-}
-
-/*
- * Clock a series of bits through the MII.
- */
-static void
-dc_mii_send(struct dc_softc *sc, u_int32_t bits, int cnt)
-{
- int i;
-
- for (i = (0x1 << (cnt - 1)); i; i >>= 1)
- dc_mii_writebit(sc, bits & i);
-}
-
-/*
- * Read an PHY register through the MII.
- */
-static int
-dc_mii_readreg(struct dc_softc *sc, struct dc_mii_frame *frame)
-{
- int i, ack;
-
- DC_LOCK(sc);
-
- /*
- * Set up frame for RX.
- */
- frame->mii_stdelim = DC_MII_STARTDELIM;
- frame->mii_opcode = DC_MII_READOP;
- frame->mii_turnaround = 0;
- frame->mii_data = 0;
-
- /*
- * Sync the PHYs.
- */
- dc_mii_sync(sc);
-
- /*
- * Send command/address info.
- */
- dc_mii_send(sc, frame->mii_stdelim, 2);
- dc_mii_send(sc, frame->mii_opcode, 2);
- dc_mii_send(sc, frame->mii_phyaddr, 5);
- dc_mii_send(sc, frame->mii_regaddr, 5);
-
-#ifdef notdef
- /* Idle bit */
- dc_mii_writebit(sc, 1);
- dc_mii_writebit(sc, 0);
-#endif
-
- /* Check for ack. */
- ack = dc_mii_readbit(sc);
-
- /*
- * Now try reading data bits. If the ack failed, we still
- * need to clock through 16 cycles to keep the PHY(s) in sync.
- */
- if (ack) {
- for (i = 0; i < 16; i++)
- dc_mii_readbit(sc);
- goto fail;
- }
-
- for (i = 0x8000; i; i >>= 1) {
- if (!ack) {
- if (dc_mii_readbit(sc))
- frame->mii_data |= i;
- }
- }
-
-fail:
-
- dc_mii_writebit(sc, 0);
- dc_mii_writebit(sc, 0);
-
- DC_UNLOCK(sc);
-
- if (ack)
- return (1);
- return (0);
-}
-
-/*
- * Write to a PHY register through the MII.
- */
-static int
-dc_mii_writereg(struct dc_softc *sc, struct dc_mii_frame *frame)
-{
-
- DC_LOCK(sc);
- /*
- * Set up frame for TX.
- */
-
- frame->mii_stdelim = DC_MII_STARTDELIM;
- frame->mii_opcode = DC_MII_WRITEOP;
- frame->mii_turnaround = DC_MII_TURNAROUND;
-
- /*
- * Sync the PHYs.
- */
- dc_mii_sync(sc);
-
- dc_mii_send(sc, frame->mii_stdelim, 2);
- dc_mii_send(sc, frame->mii_opcode, 2);
- dc_mii_send(sc, frame->mii_phyaddr, 5);
- dc_mii_send(sc, frame->mii_regaddr, 5);
- dc_mii_send(sc, frame->mii_turnaround, 2);
- dc_mii_send(sc, frame->mii_data, 16);
-
- /* Idle bit. */
- dc_mii_writebit(sc, 0);
- dc_mii_writebit(sc, 0);
-
- DC_UNLOCK(sc);
-
- return (0);
-}
-
-static int
-dc_miibus_readreg(device_t dev, int phy, int reg)
-{
- struct dc_mii_frame frame;
- struct dc_softc *sc;
- int i, rval, phy_reg = 0;
-
- sc = device_get_softc(dev);
- bzero(&frame, sizeof(frame));
-
- /*
- * Note: both the AL981 and AN985 have internal PHYs,
- * however the AL981 provides direct access to the PHY
- * registers while the AN985 uses a serial MII interface.
- * The AN985's MII interface is also buggy in that you
- * can read from any MII address (0 to 31), but only address 1
- * behaves normally. To deal with both cases, we pretend
- * that the PHY is at MII address 1.
- */
- if (DC_IS_ADMTEK(sc) && phy != DC_ADMTEK_PHYADDR)
- return (0);
-
- /*
- * Note: the ukphy probes of the RS7112 report a PHY at
- * MII address 0 (possibly HomePNA?) and 1 (ethernet)
- * so we only respond to correct one.
- */
- if (DC_IS_CONEXANT(sc) && phy != DC_CONEXANT_PHYADDR)
- return (0);
-
- if (sc->dc_pmode != DC_PMODE_MII) {
- if (phy == (MII_NPHY - 1)) {
- switch (reg) {
- case MII_BMSR:
- /*
- * Fake something to make the probe
- * code think there's a PHY here.
- */
- return (BMSR_MEDIAMASK);
- break;
- case MII_PHYIDR1:
- if (DC_IS_PNIC(sc))
- return (DC_VENDORID_LO);
- return (DC_VENDORID_DEC);
- break;
- case MII_PHYIDR2:
- if (DC_IS_PNIC(sc))
- return (DC_DEVICEID_82C168);
- return (DC_DEVICEID_21143);
- break;
- default:
- return (0);
- break;
- }
- } else
- return (0);
- }
-
- if (DC_IS_PNIC(sc)) {
- CSR_WRITE_4(sc, DC_PN_MII, DC_PN_MIIOPCODE_READ |
- (phy << 23) | (reg << 18));
- for (i = 0; i < DC_TIMEOUT; i++) {
- DELAY(1);
- rval = CSR_READ_4(sc, DC_PN_MII);
- if (!(rval & DC_PN_MII_BUSY)) {
- rval &= 0xFFFF;
- return (rval == 0xFFFF ? 0 : rval);
- }
- }
- return (0);
- }
-
- if (DC_IS_COMET(sc)) {
- switch (reg) {
- case MII_BMCR:
- phy_reg = DC_AL_BMCR;
- break;
- case MII_BMSR:
- phy_reg = DC_AL_BMSR;
- break;
- case MII_PHYIDR1:
- phy_reg = DC_AL_VENID;
- break;
- case MII_PHYIDR2:
- phy_reg = DC_AL_DEVID;
- break;
- case MII_ANAR:
- phy_reg = DC_AL_ANAR;
- break;
- case MII_ANLPAR:
- phy_reg = DC_AL_LPAR;
- break;
- case MII_ANER:
- phy_reg = DC_AL_ANER;
- break;
- default:
- printf("dc%d: phy_read: bad phy register %x\n",
- sc->dc_unit, reg);
- return (0);
- break;
- }
-
- rval = CSR_READ_4(sc, phy_reg) & 0x0000FFFF;
-
- if (rval == 0xFFFF)
- return (0);
- return (rval);
- }
-
- frame.mii_phyaddr = phy;
- frame.mii_regaddr = reg;
- if (sc->dc_type == DC_TYPE_98713) {
- phy_reg = CSR_READ_4(sc, DC_NETCFG);
- CSR_WRITE_4(sc, DC_NETCFG, phy_reg & ~DC_NETCFG_PORTSEL);
- }
- dc_mii_readreg(sc, &frame);
- if (sc->dc_type == DC_TYPE_98713)
- CSR_WRITE_4(sc, DC_NETCFG, phy_reg);
-
- return (frame.mii_data);
-}
-
-static int
-dc_miibus_writereg(device_t dev, int phy, int reg, int data)
-{
- struct dc_softc *sc;
- struct dc_mii_frame frame;
- int i, phy_reg = 0;
-
- sc = device_get_softc(dev);
- bzero(&frame, sizeof(frame));
-
- if (DC_IS_ADMTEK(sc) && phy != DC_ADMTEK_PHYADDR)
- return (0);
-
- if (DC_IS_CONEXANT(sc) && phy != DC_CONEXANT_PHYADDR)
- return (0);
-
- if (DC_IS_PNIC(sc)) {
- CSR_WRITE_4(sc, DC_PN_MII, DC_PN_MIIOPCODE_WRITE |
- (phy << 23) | (reg << 10) | data);
- for (i = 0; i < DC_TIMEOUT; i++) {
- if (!(CSR_READ_4(sc, DC_PN_MII) & DC_PN_MII_BUSY))
- break;
- }
- return (0);
- }
-
- if (DC_IS_COMET(sc)) {
- switch (reg) {
- case MII_BMCR:
- phy_reg = DC_AL_BMCR;
- break;
- case MII_BMSR:
- phy_reg = DC_AL_BMSR;
- break;
- case MII_PHYIDR1:
- phy_reg = DC_AL_VENID;
- break;
- case MII_PHYIDR2:
- phy_reg = DC_AL_DEVID;
- break;
- case MII_ANAR:
- phy_reg = DC_AL_ANAR;
- break;
- case MII_ANLPAR:
- phy_reg = DC_AL_LPAR;
- break;
- case MII_ANER:
- phy_reg = DC_AL_ANER;
- break;
- default:
- printf("dc%d: phy_write: bad phy register %x\n",
- sc->dc_unit, reg);
- return (0);
- break;
- }
-
- CSR_WRITE_4(sc, phy_reg, data);
- return (0);
- }
-
- frame.mii_phyaddr = phy;
- frame.mii_regaddr = reg;
- frame.mii_data = data;
-
- if (sc->dc_type == DC_TYPE_98713) {
- phy_reg = CSR_READ_4(sc, DC_NETCFG);
- CSR_WRITE_4(sc, DC_NETCFG, phy_reg & ~DC_NETCFG_PORTSEL);
- }
- dc_mii_writereg(sc, &frame);
- if (sc->dc_type == DC_TYPE_98713)
- CSR_WRITE_4(sc, DC_NETCFG, phy_reg);
-
- return (0);
-}
-
-static void
-dc_miibus_statchg(device_t dev)
-{
- struct dc_softc *sc;
- struct mii_data *mii;
- struct ifmedia *ifm;
-
- sc = device_get_softc(dev);
- if (DC_IS_ADMTEK(sc))
- return;
-
- mii = device_get_softc(sc->dc_miibus);
- ifm = &mii->mii_media;
- if (DC_IS_DAVICOM(sc) &&
- IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
- dc_setcfg(sc, ifm->ifm_media);
- sc->dc_if_media = ifm->ifm_media;
- } else {
- dc_setcfg(sc, mii->mii_media_active);
- sc->dc_if_media = mii->mii_media_active;
- }
-}
-
-/*
- * Special support for DM9102A cards with HomePNA PHYs. Note:
- * with the Davicom DM9102A/DM9801 eval board that I have, it seems
- * to be impossible to talk to the management interface of the DM9801
- * PHY (its MDIO pin is not connected to anything). Consequently,
- * the driver has to just 'know' about the additional mode and deal
- * with it itself. *sigh*
- */
-static void
-dc_miibus_mediainit(device_t dev)
-{
- struct dc_softc *sc;
- struct mii_data *mii;
- struct ifmedia *ifm;
- int rev;
-
- rev = pci_read_config(dev, DC_PCI_CFRV, 4) & 0xFF;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(sc->dc_miibus);
- ifm = &mii->mii_media;
-
- if (DC_IS_DAVICOM(sc) && rev >= DC_REVISION_DM9102A)
- ifmedia_add(ifm, IFM_ETHER | IFM_HPNA_1, 0, NULL);
-}
-
-#define DC_BITS_512 9
-#define DC_BITS_128 7
-#define DC_BITS_64 6
-
-static uint32_t
-dc_mchash_le(struct dc_softc *sc, const uint8_t *addr)
-{
- uint32_t crc;
-
- /* Compute CRC for the address value. */
- crc = ether_crc32_le(addr, ETHER_ADDR_LEN);
-
- /*
- * The hash table on the PNIC II and the MX98715AEC-C/D/E
- * chips is only 128 bits wide.
- */
- if (sc->dc_flags & DC_128BIT_HASH)
- return (crc & ((1 << DC_BITS_128) - 1));
-
- /* The hash table on the MX98715BEC is only 64 bits wide. */
- if (sc->dc_flags & DC_64BIT_HASH)
- return (crc & ((1 << DC_BITS_64) - 1));
-
- /* Xircom's hash filtering table is different (read: weird) */
- /* Xircom uses the LEAST significant bits */
- if (DC_IS_XIRCOM(sc)) {
- if ((crc & 0x180) == 0x180)
- return ((crc & 0x0F) + (crc & 0x70) * 3 + (14 << 4));
- else
- return ((crc & 0x1F) + ((crc >> 1) & 0xF0) * 3 +
- (12 << 4));
- }
-
- return (crc & ((1 << DC_BITS_512) - 1));
-}
-
-/*
- * Calculate CRC of a multicast group address, return the lower 6 bits.
- */
-static uint32_t
-dc_mchash_be(const uint8_t *addr)
-{
- uint32_t crc;
-
- /* Compute CRC for the address value. */
- crc = ether_crc32_be(addr, ETHER_ADDR_LEN);
-
- /* Return the filter bit position. */
- return ((crc >> 26) & 0x0000003F);
-}
-
-/*
- * 21143-style RX filter setup routine. Filter programming is done by
- * downloading a special setup frame into the TX engine. 21143, Macronix,
- * PNIC, PNIC II and Davicom chips are programmed this way.
- *
- * We always program the chip using 'hash perfect' mode, i.e. one perfect
- * address (our node address) and a 512-bit hash filter for multicast
- * frames. We also sneak the broadcast address into the hash filter since
- * we need that too.
- */
-static void
-dc_setfilt_21143(struct dc_softc *sc)
-{
- struct dc_desc *sframe;
- u_int32_t h, *sp;
- struct ifmultiaddr *ifma;
- struct ifnet *ifp;
- int i;
-
- ifp = sc->dc_ifp;
-
- i = sc->dc_cdata.dc_tx_prod;
- DC_INC(sc->dc_cdata.dc_tx_prod, DC_TX_LIST_CNT);
- sc->dc_cdata.dc_tx_cnt++;
- sframe = &sc->dc_ldata->dc_tx_list[i];
- sp = sc->dc_cdata.dc_sbuf;
- bzero(sp, DC_SFRAME_LEN);
-
- sframe->dc_data = htole32(sc->dc_saddr);
- sframe->dc_ctl = htole32(DC_SFRAME_LEN | DC_TXCTL_SETUP |
- DC_TXCTL_TLINK | DC_FILTER_HASHPERF | DC_TXCTL_FINT);
-
- sc->dc_cdata.dc_tx_chain[i] = (struct mbuf *)sc->dc_cdata.dc_sbuf;
-
- /* If we want promiscuous mode, set the allframes bit. */
- if (ifp->if_flags & IFF_PROMISC)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC);
- else
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC);
-
- if (ifp->if_flags & IFF_ALLMULTI)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
- else
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
-
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- h = dc_mchash_le(sc,
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
- sp[h >> 4] |= htole32(1 << (h & 0xF));
- }
-
- if (ifp->if_flags & IFF_BROADCAST) {
- h = dc_mchash_le(sc, ifp->if_broadcastaddr);
- sp[h >> 4] |= htole32(1 << (h & 0xF));
- }
-
- /* Set our MAC address */
- sp[39] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[0]);
- sp[40] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[1]);
- sp[41] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[2]);
-
- sframe->dc_status = htole32(DC_TXSTAT_OWN);
- CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF);
-
- /*
- * The PNIC takes an exceedingly long time to process its
- * setup frame; wait 10ms after posting the setup frame
- * before proceeding, just so it has time to swallow its
- * medicine.
- */
- DELAY(10000);
-
- ifp->if_timer = 5;
-}
-
-static void
-dc_setfilt_admtek(struct dc_softc *sc)
-{
- struct ifnet *ifp;
- struct ifmultiaddr *ifma;
- int h = 0;
- u_int32_t hashes[2] = { 0, 0 };
-
- ifp = sc->dc_ifp;
-
- /* Init our MAC address. */
- CSR_WRITE_4(sc, DC_AL_PAR0, *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[0]));
- CSR_WRITE_4(sc, DC_AL_PAR1, *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[4]));
-
- /* If we want promiscuous mode, set the allframes bit. */
- if (ifp->if_flags & IFF_PROMISC)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC);
- else
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC);
-
- if (ifp->if_flags & IFF_ALLMULTI)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
- else
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
-
- /* First, zot all the existing hash bits. */
- CSR_WRITE_4(sc, DC_AL_MAR0, 0);
- CSR_WRITE_4(sc, DC_AL_MAR1, 0);
-
- /*
- * If we're already in promisc or allmulti mode, we
- * don't have to bother programming the multicast filter.
- */
- if (ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI))
- return;
-
- /* Now program new ones. */
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- if (DC_IS_CENTAUR(sc))
- h = dc_mchash_le(sc,
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
- else
- h = dc_mchash_be(
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
- if (h < 32)
- hashes[0] |= (1 << h);
- else
- hashes[1] |= (1 << (h - 32));
- }
-
- CSR_WRITE_4(sc, DC_AL_MAR0, hashes[0]);
- CSR_WRITE_4(sc, DC_AL_MAR1, hashes[1]);
-}
-
-static void
-dc_setfilt_asix(struct dc_softc *sc)
-{
- struct ifnet *ifp;
- struct ifmultiaddr *ifma;
- int h = 0;
- u_int32_t hashes[2] = { 0, 0 };
-
- ifp = sc->dc_ifp;
-
- /* Init our MAC address */
- CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_PAR0);
- CSR_WRITE_4(sc, DC_AX_FILTDATA,
- *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[0]));
- CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_PAR1);
- CSR_WRITE_4(sc, DC_AX_FILTDATA,
- *(u_int32_t *)(&IFP2ENADDR(sc->dc_ifp)[4]));
-
- /* If we want promiscuous mode, set the allframes bit. */
- if (ifp->if_flags & IFF_PROMISC)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC);
- else
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC);
-
- if (ifp->if_flags & IFF_ALLMULTI)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
- else
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
-
- /*
- * The ASIX chip has a special bit to enable reception
- * of broadcast frames.
- */
- if (ifp->if_flags & IFF_BROADCAST)
- DC_SETBIT(sc, DC_NETCFG, DC_AX_NETCFG_RX_BROAD);
- else
- DC_CLRBIT(sc, DC_NETCFG, DC_AX_NETCFG_RX_BROAD);
-
- /* first, zot all the existing hash bits */
- CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR0);
- CSR_WRITE_4(sc, DC_AX_FILTDATA, 0);
- CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR1);
- CSR_WRITE_4(sc, DC_AX_FILTDATA, 0);
-
- /*
- * If we're already in promisc or allmulti mode, we
- * don't have to bother programming the multicast filter.
- */
- if (ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI))
- return;
-
- /* now program new ones */
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- h = dc_mchash_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
- if (h < 32)
- hashes[0] |= (1 << h);
- else
- hashes[1] |= (1 << (h - 32));
- }
-
- CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR0);
- CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[0]);
- CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR1);
- CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[1]);
-}
-
-static void
-dc_setfilt_xircom(struct dc_softc *sc)
-{
- struct ifnet *ifp;
- struct ifmultiaddr *ifma;
- struct dc_desc *sframe;
- u_int32_t h, *sp;
- int i;
-
- ifp = sc->dc_ifp;
- DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON));
-
- i = sc->dc_cdata.dc_tx_prod;
- DC_INC(sc->dc_cdata.dc_tx_prod, DC_TX_LIST_CNT);
- sc->dc_cdata.dc_tx_cnt++;
- sframe = &sc->dc_ldata->dc_tx_list[i];
- sp = sc->dc_cdata.dc_sbuf;
- bzero(sp, DC_SFRAME_LEN);
-
- sframe->dc_data = htole32(sc->dc_saddr);
- sframe->dc_ctl = htole32(DC_SFRAME_LEN | DC_TXCTL_SETUP |
- DC_TXCTL_TLINK | DC_FILTER_HASHPERF | DC_TXCTL_FINT);
-
- sc->dc_cdata.dc_tx_chain[i] = (struct mbuf *)sc->dc_cdata.dc_sbuf;
-
- /* If we want promiscuous mode, set the allframes bit. */
- if (ifp->if_flags & IFF_PROMISC)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC);
- else
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC);
-
- if (ifp->if_flags & IFF_ALLMULTI)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
- else
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI);
-
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- h = dc_mchash_le(sc,
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
- sp[h >> 4] |= htole32(1 << (h & 0xF));
- }
-
- if (ifp->if_flags & IFF_BROADCAST) {
- h = dc_mchash_le(sc, ifp->if_broadcastaddr);
- sp[h >> 4] |= htole32(1 << (h & 0xF));
- }
-
- /* Set our MAC address */
- sp[0] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[0]);
- sp[1] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[1]);
- sp[2] = DC_SP_MAC(((u_int16_t *)IFP2ENADDR(sc->dc_ifp))[2]);
-
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON);
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
- ifp->if_flags |= IFF_RUNNING;
- sframe->dc_status = htole32(DC_TXSTAT_OWN);
- CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF);
-
- /*
- * Wait some time...
- */
- DELAY(1000);
-
- ifp->if_timer = 5;
-}
-
-static void
-dc_setfilt(struct dc_softc *sc)
-{
-
- if (DC_IS_INTEL(sc) || DC_IS_MACRONIX(sc) || DC_IS_PNIC(sc) ||
- DC_IS_PNICII(sc) || DC_IS_DAVICOM(sc) || DC_IS_CONEXANT(sc))
- dc_setfilt_21143(sc);
-
- if (DC_IS_ASIX(sc))
- dc_setfilt_asix(sc);
-
- if (DC_IS_ADMTEK(sc))
- dc_setfilt_admtek(sc);
-
- if (DC_IS_XIRCOM(sc))
- dc_setfilt_xircom(sc);
-}
-
-/*
- * In order to fiddle with the 'full-duplex' and '100Mbps' bits in
- * the netconfig register, we first have to put the transmit and/or
- * receive logic in the idle state.
- */
-static void
-dc_setcfg(struct dc_softc *sc, int media)
-{
- int i, restart = 0, watchdogreg;
- u_int32_t isr;
-
- if (IFM_SUBTYPE(media) == IFM_NONE)
- return;
-
- if (CSR_READ_4(sc, DC_NETCFG) & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) {
- restart = 1;
- DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON));
-
- for (i = 0; i < DC_TIMEOUT; i++) {
- isr = CSR_READ_4(sc, DC_ISR);
- if (isr & DC_ISR_TX_IDLE &&
- ((isr & DC_ISR_RX_STATE) == DC_RXSTATE_STOPPED ||
- (isr & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT))
- break;
- DELAY(10);
- }
-
- if (i == DC_TIMEOUT)
- printf("dc%d: failed to force tx and "
- "rx to idle state\n", sc->dc_unit);
- }
-
- if (IFM_SUBTYPE(media) == IFM_100_TX) {
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_SPEEDSEL);
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_HEARTBEAT);
- if (sc->dc_pmode == DC_PMODE_MII) {
- if (DC_IS_INTEL(sc)) {
- /* There's a write enable bit here that reads as 1. */
- watchdogreg = CSR_READ_4(sc, DC_WATCHDOG);
- watchdogreg &= ~DC_WDOG_CTLWREN;
- watchdogreg |= DC_WDOG_JABBERDIS;
- CSR_WRITE_4(sc, DC_WATCHDOG, watchdogreg);
- } else {
- DC_SETBIT(sc, DC_WATCHDOG, DC_WDOG_JABBERDIS);
- }
- DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_PCS |
- DC_NETCFG_PORTSEL | DC_NETCFG_SCRAMBLER));
- if (sc->dc_type == DC_TYPE_98713)
- DC_SETBIT(sc, DC_NETCFG, (DC_NETCFG_PCS |
- DC_NETCFG_SCRAMBLER));
- if (!DC_IS_DAVICOM(sc))
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
- DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
- if (DC_IS_INTEL(sc))
- dc_apply_fixup(sc, IFM_AUTO);
- } else {
- if (DC_IS_PNIC(sc)) {
- DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_SPEEDSEL);
- DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_100TX_LOOP);
- DC_SETBIT(sc, DC_PN_NWAY, DC_PN_NWAY_SPEEDSEL);
- }
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_SCRAMBLER);
- if (DC_IS_INTEL(sc))
- dc_apply_fixup(sc,
- (media & IFM_GMASK) == IFM_FDX ?
- IFM_100_TX | IFM_FDX : IFM_100_TX);
- }
- }
-
- if (IFM_SUBTYPE(media) == IFM_10_T) {
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_SPEEDSEL);
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_HEARTBEAT);
- if (sc->dc_pmode == DC_PMODE_MII) {
- /* There's a write enable bit here that reads as 1. */
- if (DC_IS_INTEL(sc)) {
- watchdogreg = CSR_READ_4(sc, DC_WATCHDOG);
- watchdogreg &= ~DC_WDOG_CTLWREN;
- watchdogreg |= DC_WDOG_JABBERDIS;
- CSR_WRITE_4(sc, DC_WATCHDOG, watchdogreg);
- } else {
- DC_SETBIT(sc, DC_WATCHDOG, DC_WDOG_JABBERDIS);
- }
- DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_PCS |
- DC_NETCFG_PORTSEL | DC_NETCFG_SCRAMBLER));
- if (sc->dc_type == DC_TYPE_98713)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
- if (!DC_IS_DAVICOM(sc))
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
- DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
- if (DC_IS_INTEL(sc))
- dc_apply_fixup(sc, IFM_AUTO);
- } else {
- if (DC_IS_PNIC(sc)) {
- DC_PN_GPIO_CLRBIT(sc, DC_PN_GPIO_SPEEDSEL);
- DC_PN_GPIO_SETBIT(sc, DC_PN_GPIO_100TX_LOOP);
- DC_CLRBIT(sc, DC_PN_NWAY, DC_PN_NWAY_SPEEDSEL);
- }
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_PCS);
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_SCRAMBLER);
- if (DC_IS_INTEL(sc)) {
- DC_CLRBIT(sc, DC_SIARESET, DC_SIA_RESET);
- DC_CLRBIT(sc, DC_10BTCTRL, 0xFFFF);
- if ((media & IFM_GMASK) == IFM_FDX)
- DC_SETBIT(sc, DC_10BTCTRL, 0x7F3D);
- else
- DC_SETBIT(sc, DC_10BTCTRL, 0x7F3F);
- DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
- DC_CLRBIT(sc, DC_10BTCTRL,
- DC_TCTL_AUTONEGENBL);
- dc_apply_fixup(sc,
- (media & IFM_GMASK) == IFM_FDX ?
- IFM_10_T | IFM_FDX : IFM_10_T);
- DELAY(20000);
- }
- }
- }
-
- /*
- * If this is a Davicom DM9102A card with a DM9801 HomePNA
- * PHY and we want HomePNA mode, set the portsel bit to turn
- * on the external MII port.
- */
- if (DC_IS_DAVICOM(sc)) {
- if (IFM_SUBTYPE(media) == IFM_HPNA_1) {
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
- sc->dc_link = 1;
- } else {
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
- }
- }
-
- if ((media & IFM_GMASK) == IFM_FDX) {
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_FULLDUPLEX);
- if (sc->dc_pmode == DC_PMODE_SYM && DC_IS_PNIC(sc))
- DC_SETBIT(sc, DC_PN_NWAY, DC_PN_NWAY_DUPLEX);
- } else {
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_FULLDUPLEX);
- if (sc->dc_pmode == DC_PMODE_SYM && DC_IS_PNIC(sc))
- DC_CLRBIT(sc, DC_PN_NWAY, DC_PN_NWAY_DUPLEX);
- }
-
- if (restart)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON | DC_NETCFG_RX_ON);
-}
-
-static void
-dc_reset(struct dc_softc *sc)
-{
- int i;
-
- DC_SETBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET);
-
- for (i = 0; i < DC_TIMEOUT; i++) {
- DELAY(10);
- if (!(CSR_READ_4(sc, DC_BUSCTL) & DC_BUSCTL_RESET))
- break;
- }
-
- if (DC_IS_ASIX(sc) || DC_IS_ADMTEK(sc) || DC_IS_CONEXANT(sc) ||
- DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc)) {
- DELAY(10000);
- DC_CLRBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET);
- i = 0;
- }
-
- if (i == DC_TIMEOUT)
- printf("dc%d: reset never completed!\n", sc->dc_unit);
-
- /* Wait a little while for the chip to get its brains in order. */
- DELAY(1000);
-
- CSR_WRITE_4(sc, DC_IMR, 0x00000000);
- CSR_WRITE_4(sc, DC_BUSCTL, 0x00000000);
- CSR_WRITE_4(sc, DC_NETCFG, 0x00000000);
-
- /*
- * Bring the SIA out of reset. In some cases, it looks
- * like failing to unreset the SIA soon enough gets it
- * into a state where it will never come out of reset
- * until we reset the whole chip again.
- */
- if (DC_IS_INTEL(sc)) {
- DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
- CSR_WRITE_4(sc, DC_10BTCTRL, 0);
- CSR_WRITE_4(sc, DC_WATCHDOG, 0);
- }
-}
-
-static struct dc_type *
-dc_devtype(device_t dev)
-{
- struct dc_type *t;
- u_int32_t rev;
-
- t = dc_devs;
-
- while (t->dc_name != NULL) {
- if ((pci_get_vendor(dev) == t->dc_vid) &&
- (pci_get_device(dev) == t->dc_did)) {
- /* Check the PCI revision */
- rev = pci_read_config(dev, DC_PCI_CFRV, 4) & 0xFF;
- if (t->dc_did == DC_DEVICEID_98713 &&
- rev >= DC_REVISION_98713A)
- t++;
- if (t->dc_did == DC_DEVICEID_98713_CP &&
- rev >= DC_REVISION_98713A)
- t++;
- if (t->dc_did == DC_DEVICEID_987x5 &&
- rev >= DC_REVISION_98715AEC_C)
- t++;
- if (t->dc_did == DC_DEVICEID_987x5 &&
- rev >= DC_REVISION_98725)
- t++;
- if (t->dc_did == DC_DEVICEID_AX88140A &&
- rev >= DC_REVISION_88141)
- t++;
- if (t->dc_did == DC_DEVICEID_82C168 &&
- rev >= DC_REVISION_82C169)
- t++;
- if (t->dc_did == DC_DEVICEID_DM9102 &&
- rev >= DC_REVISION_DM9102A)
- t++;
- /*
- * The Microsoft MN-130 has a device ID of 0x0002,
- * which happens to be the same as the PNIC 82c168.
- * To keep dc_attach() from getting confused, we
- * pretend its ID is something different.
- * XXX: ideally, dc_attach() should be checking
- * vendorid+deviceid together to avoid such
- * collisions.
- */
- if (t->dc_vid == DC_VENDORID_MICROSOFT &&
- t->dc_did == DC_DEVICEID_MSMN130)
- t++;
- return (t);
- }
- t++;
- }
-
- return (NULL);
-}
-
-/*
- * Probe for a 21143 or clone chip. Check the PCI vendor and device
- * IDs against our list and return a device name if we find a match.
- * We do a little bit of extra work to identify the exact type of
- * chip. The MX98713 and MX98713A have the same PCI vendor/device ID,
- * but different revision IDs. The same is true for 98715/98715A
- * chips and the 98725, as well as the ASIX and ADMtek chips. In some
- * cases, the exact chip revision affects driver behavior.
- */
-static int
-dc_probe(device_t dev)
-{
- struct dc_type *t;
-
- t = dc_devtype(dev);
-
- if (t != NULL) {
- device_set_desc(dev, t->dc_name);
- return (BUS_PROBE_DEFAULT);
- }
-
- return (ENXIO);
-}
-
-static void
-dc_apply_fixup(struct dc_softc *sc, int media)
-{
- struct dc_mediainfo *m;
- u_int8_t *p;
- int i;
- u_int32_t reg;
-
- m = sc->dc_mi;
-
- while (m != NULL) {
- if (m->dc_media == media)
- break;
- m = m->dc_next;
- }
-
- if (m == NULL)
- return;
-
- for (i = 0, p = m->dc_reset_ptr; i < m->dc_reset_len; i++, p += 2) {
- reg = (p[0] | (p[1] << 8)) << 16;
- CSR_WRITE_4(sc, DC_WATCHDOG, reg);
- }
-
- for (i = 0, p = m->dc_gp_ptr; i < m->dc_gp_len; i++, p += 2) {
- reg = (p[0] | (p[1] << 8)) << 16;
- CSR_WRITE_4(sc, DC_WATCHDOG, reg);
- }
-}
-
-static void
-dc_decode_leaf_sia(struct dc_softc *sc, struct dc_eblock_sia *l)
-{
- struct dc_mediainfo *m;
-
- m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_NOWAIT | M_ZERO);
- switch (l->dc_sia_code & ~DC_SIA_CODE_EXT) {
- case DC_SIA_CODE_10BT:
- m->dc_media = IFM_10_T;
- break;
- case DC_SIA_CODE_10BT_FDX:
- m->dc_media = IFM_10_T | IFM_FDX;
- break;
- case DC_SIA_CODE_10B2:
- m->dc_media = IFM_10_2;
- break;
- case DC_SIA_CODE_10B5:
- m->dc_media = IFM_10_5;
- break;
- default:
- break;
- }
-
- /*
- * We need to ignore CSR13, CSR14, CSR15 for SIA mode.
- * Things apparently already work for cards that do
- * supply Media Specific Data.
- */
- if (l->dc_sia_code & DC_SIA_CODE_EXT) {
- m->dc_gp_len = 2;
- m->dc_gp_ptr =
- (u_int8_t *)&l->dc_un.dc_sia_ext.dc_sia_gpio_ctl;
- } else {
- m->dc_gp_len = 2;
- m->dc_gp_ptr =
- (u_int8_t *)&l->dc_un.dc_sia_noext.dc_sia_gpio_ctl;
- }
-
- m->dc_next = sc->dc_mi;
- sc->dc_mi = m;
-
- sc->dc_pmode = DC_PMODE_SIA;
-}
-
-static void
-dc_decode_leaf_sym(struct dc_softc *sc, struct dc_eblock_sym *l)
-{
- struct dc_mediainfo *m;
-
- m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (l->dc_sym_code == DC_SYM_CODE_100BT)
- m->dc_media = IFM_100_TX;
-
- if (l->dc_sym_code == DC_SYM_CODE_100BT_FDX)
- m->dc_media = IFM_100_TX | IFM_FDX;
-
- m->dc_gp_len = 2;
- m->dc_gp_ptr = (u_int8_t *)&l->dc_sym_gpio_ctl;
-
- m->dc_next = sc->dc_mi;
- sc->dc_mi = m;
-
- sc->dc_pmode = DC_PMODE_SYM;
-}
-
-static void
-dc_decode_leaf_mii(struct dc_softc *sc, struct dc_eblock_mii *l)
-{
- struct dc_mediainfo *m;
- u_int8_t *p;
-
- m = malloc(sizeof(struct dc_mediainfo), M_DEVBUF, M_NOWAIT | M_ZERO);
- /* We abuse IFM_AUTO to represent MII. */
- m->dc_media = IFM_AUTO;
- m->dc_gp_len = l->dc_gpr_len;
-
- p = (u_int8_t *)l;
- p += sizeof(struct dc_eblock_mii);
- m->dc_gp_ptr = p;
- p += 2 * l->dc_gpr_len;
- m->dc_reset_len = *p;
- p++;
- m->dc_reset_ptr = p;
-
- m->dc_next = sc->dc_mi;
- sc->dc_mi = m;
-}
-
-static void
-dc_read_srom(struct dc_softc *sc, int bits)
-{
- int size;
-
- size = 2 << bits;
- sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT);
- dc_read_eeprom(sc, (caddr_t)sc->dc_srom, 0, (size / 2), 0);
-}
-
-static void
-dc_parse_21143_srom(struct dc_softc *sc)
-{
- struct dc_leaf_hdr *lhdr;
- struct dc_eblock_hdr *hdr;
- int have_mii, i, loff;
- char *ptr;
-
- have_mii = 0;
- loff = sc->dc_srom[27];
- lhdr = (struct dc_leaf_hdr *)&(sc->dc_srom[loff]);
-
- ptr = (char *)lhdr;
- ptr += sizeof(struct dc_leaf_hdr) - 1;
- /*
- * Look if we got a MII media block.
- */
- for (i = 0; i < lhdr->dc_mcnt; i++) {
- hdr = (struct dc_eblock_hdr *)ptr;
- if (hdr->dc_type == DC_EBLOCK_MII)
- have_mii++;
-
- ptr += (hdr->dc_len & 0x7F);
- ptr++;
- }
-
- /*
- * Do the same thing again. Only use SIA and SYM media
- * blocks if no MII media block is available.
- */
- ptr = (char *)lhdr;
- ptr += sizeof(struct dc_leaf_hdr) - 1;
- for (i = 0; i < lhdr->dc_mcnt; i++) {
- hdr = (struct dc_eblock_hdr *)ptr;
- switch (hdr->dc_type) {
- case DC_EBLOCK_MII:
- dc_decode_leaf_mii(sc, (struct dc_eblock_mii *)hdr);
- break;
- case DC_EBLOCK_SIA:
- if (! have_mii)
- dc_decode_leaf_sia(sc,
- (struct dc_eblock_sia *)hdr);
- break;
- case DC_EBLOCK_SYM:
- if (! have_mii)
- dc_decode_leaf_sym(sc,
- (struct dc_eblock_sym *)hdr);
- break;
- default:
- /* Don't care. Yet. */
- break;
- }
- ptr += (hdr->dc_len & 0x7F);
- ptr++;
- }
-}
-
-static void
-dc_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
-{
- u_int32_t *paddr;
-
- KASSERT(nseg == 1, ("wrong number of segments, should be 1"));
- paddr = arg;
- *paddr = segs->ds_addr;
-}
-
-/*
- * Attach the interface. Allocate softc structures, do ifmedia
- * setup and ethernet/BPF attach.
- */
-static int
-dc_attach(device_t dev)
-{
- int tmp = 0;
- u_char eaddr[ETHER_ADDR_LEN];
- u_int32_t command;
- struct dc_softc *sc;
- struct ifnet *ifp;
- u_int32_t revision;
- int unit, error = 0, rid, mac_offset;
- int i;
- u_int8_t *mac;
-
- sc = device_get_softc(dev);
- unit = device_get_unit(dev);
-
- mtx_init(&sc->dc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
- MTX_DEF | MTX_RECURSE);
-
- /*
- * Map control/status registers.
- */
- pci_enable_busmaster(dev);
-
- rid = DC_RID;
- sc->dc_res = bus_alloc_resource_any(dev, DC_RES, &rid, RF_ACTIVE);
-
- if (sc->dc_res == NULL) {
- printf("dc%d: couldn't map ports/memory\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- sc->dc_btag = rman_get_bustag(sc->dc_res);
- sc->dc_bhandle = rman_get_bushandle(sc->dc_res);
-
- /* Allocate interrupt. */
- rid = 0;
- sc->dc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
- RF_SHAREABLE | RF_ACTIVE);
-
- if (sc->dc_irq == NULL) {
- printf("dc%d: couldn't map interrupt\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- /* Need this info to decide on a chip type. */
- sc->dc_info = dc_devtype(dev);
- revision = pci_read_config(dev, DC_PCI_CFRV, 4) & 0x000000FF;
-
- /* Get the eeprom width, but PNIC and XIRCOM have diff eeprom */
- if (sc->dc_info->dc_did != DC_DEVICEID_82C168 &&
- sc->dc_info->dc_did != DC_DEVICEID_X3201)
- dc_eeprom_width(sc);
-
- switch (sc->dc_info->dc_did) {
- case DC_DEVICEID_21143:
- sc->dc_type = DC_TYPE_21143;
- sc->dc_flags |= DC_TX_POLL | DC_TX_USE_TX_INTR;
- sc->dc_flags |= DC_REDUCED_MII_POLL;
- /* Save EEPROM contents so we can parse them later. */
- dc_read_srom(sc, sc->dc_romwidth);
- break;
- case DC_DEVICEID_DM9009:
- case DC_DEVICEID_DM9100:
- case DC_DEVICEID_DM9102:
- sc->dc_type = DC_TYPE_DM9102;
- sc->dc_flags |= DC_TX_COALESCE | DC_TX_INTR_ALWAYS;
- sc->dc_flags |= DC_REDUCED_MII_POLL | DC_TX_STORENFWD;
- sc->dc_flags |= DC_TX_ALIGN;
- sc->dc_pmode = DC_PMODE_MII;
- /* Increase the latency timer value. */
- command = pci_read_config(dev, DC_PCI_CFLT, 4);
- command &= 0xFFFF00FF;
- command |= 0x00008000;
- pci_write_config(dev, DC_PCI_CFLT, command, 4);
- break;
- case DC_DEVICEID_AL981:
- sc->dc_type = DC_TYPE_AL981;
- sc->dc_flags |= DC_TX_USE_TX_INTR;
- sc->dc_flags |= DC_TX_ADMTEK_WAR;
- sc->dc_pmode = DC_PMODE_MII;
- dc_read_srom(sc, sc->dc_romwidth);
- break;
- case DC_DEVICEID_AN985:
- case DC_DEVICEID_ADM9511:
- case DC_DEVICEID_ADM9513:
- case DC_DEVICEID_FA511:
- case DC_DEVICEID_FE2500:
- case DC_DEVICEID_EN2242:
- case DC_DEVICEID_HAWKING_PN672TX:
- case DC_DEVICEID_3CSOHOB:
- case DC_DEVICEID_MSMN120:
- case DC_DEVICEID_MSMN130_FAKE: /* XXX avoid collision with PNIC*/
- sc->dc_type = DC_TYPE_AN985;
- sc->dc_flags |= DC_64BIT_HASH;
- sc->dc_flags |= DC_TX_USE_TX_INTR;
- sc->dc_flags |= DC_TX_ADMTEK_WAR;
- sc->dc_pmode = DC_PMODE_MII;
- /* Don't read SROM for - auto-loaded on reset */
- break;
- case DC_DEVICEID_98713:
- case DC_DEVICEID_98713_CP:
- if (revision < DC_REVISION_98713A) {
- sc->dc_type = DC_TYPE_98713;
- }
- if (revision >= DC_REVISION_98713A) {
- sc->dc_type = DC_TYPE_98713A;
- sc->dc_flags |= DC_21143_NWAY;
- }
- sc->dc_flags |= DC_REDUCED_MII_POLL;
- sc->dc_flags |= DC_TX_POLL | DC_TX_USE_TX_INTR;
- break;
- case DC_DEVICEID_987x5:
- case DC_DEVICEID_EN1217:
- /*
- * Macronix MX98715AEC-C/D/E parts have only a
- * 128-bit hash table. We need to deal with these
- * in the same manner as the PNIC II so that we
- * get the right number of bits out of the
- * CRC routine.
- */
- if (revision >= DC_REVISION_98715AEC_C &&
- revision < DC_REVISION_98725)
- sc->dc_flags |= DC_128BIT_HASH;
- sc->dc_type = DC_TYPE_987x5;
- sc->dc_flags |= DC_TX_POLL | DC_TX_USE_TX_INTR;
- sc->dc_flags |= DC_REDUCED_MII_POLL | DC_21143_NWAY;
- break;
- case DC_DEVICEID_98727:
- sc->dc_type = DC_TYPE_987x5;
- sc->dc_flags |= DC_TX_POLL | DC_TX_USE_TX_INTR;
- sc->dc_flags |= DC_REDUCED_MII_POLL | DC_21143_NWAY;
- break;
- case DC_DEVICEID_82C115:
- sc->dc_type = DC_TYPE_PNICII;
- sc->dc_flags |= DC_TX_POLL | DC_TX_USE_TX_INTR | DC_128BIT_HASH;
- sc->dc_flags |= DC_REDUCED_MII_POLL | DC_21143_NWAY;
- break;
- case DC_DEVICEID_82C168:
- sc->dc_type = DC_TYPE_PNIC;
- sc->dc_flags |= DC_TX_STORENFWD | DC_TX_INTR_ALWAYS;
- sc->dc_flags |= DC_PNIC_RX_BUG_WAR;
- sc->dc_pnic_rx_buf = malloc(DC_RXLEN * 5, M_DEVBUF, M_NOWAIT);
- if (revision < DC_REVISION_82C169)
- sc->dc_pmode = DC_PMODE_SYM;
- break;
- case DC_DEVICEID_AX88140A:
- sc->dc_type = DC_TYPE_ASIX;
- sc->dc_flags |= DC_TX_USE_TX_INTR | DC_TX_INTR_FIRSTFRAG;
- sc->dc_flags |= DC_REDUCED_MII_POLL;
- sc->dc_pmode = DC_PMODE_MII;
- break;
- case DC_DEVICEID_X3201:
- sc->dc_type = DC_TYPE_XIRCOM;
- sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE |
- DC_TX_ALIGN;
- /*
- * We don't actually need to coalesce, but we're doing
- * it to obtain a double word aligned buffer.
- * The DC_TX_COALESCE flag is required.
- */
- sc->dc_pmode = DC_PMODE_MII;
- break;
- case DC_DEVICEID_RS7112:
- sc->dc_type = DC_TYPE_CONEXANT;
- sc->dc_flags |= DC_TX_INTR_ALWAYS;
- sc->dc_flags |= DC_REDUCED_MII_POLL;
- sc->dc_pmode = DC_PMODE_MII;
- dc_read_srom(sc, sc->dc_romwidth);
- break;
- default:
- printf("dc%d: unknown device: %x\n", sc->dc_unit,
- sc->dc_info->dc_did);
- break;
- }
-
- /* Save the cache line size. */
- if (DC_IS_DAVICOM(sc))
- sc->dc_cachesize = 0;
- else
- sc->dc_cachesize = pci_read_config(dev,
- DC_PCI_CFLT, 4) & 0xFF;
-
- /* Reset the adapter. */
- dc_reset(sc);
-
- /* Take 21143 out of snooze mode */
- if (DC_IS_INTEL(sc) || DC_IS_XIRCOM(sc)) {
- command = pci_read_config(dev, DC_PCI_CFDD, 4);
- command &= ~(DC_CFDD_SNOOZE_MODE | DC_CFDD_SLEEP_MODE);
- pci_write_config(dev, DC_PCI_CFDD, command, 4);
- }
-
- /*
- * Try to learn something about the supported media.
- * We know that ASIX and ADMtek and Davicom devices
- * will *always* be using MII media, so that's a no-brainer.
- * The tricky ones are the Macronix/PNIC II and the
- * Intel 21143.
- */
- if (DC_IS_INTEL(sc))
- dc_parse_21143_srom(sc);
- else if (DC_IS_MACRONIX(sc) || DC_IS_PNICII(sc)) {
- if (sc->dc_type == DC_TYPE_98713)
- sc->dc_pmode = DC_PMODE_MII;
- else
- sc->dc_pmode = DC_PMODE_SYM;
- } else if (!sc->dc_pmode)
- sc->dc_pmode = DC_PMODE_MII;
-
- /*
- * Get station address from the EEPROM.
- */
- switch(sc->dc_type) {
- case DC_TYPE_98713:
- case DC_TYPE_98713A:
- case DC_TYPE_987x5:
- case DC_TYPE_PNICII:
- dc_read_eeprom(sc, (caddr_t)&mac_offset,
- (DC_EE_NODEADDR_OFFSET / 2), 1, 0);
- dc_read_eeprom(sc, (caddr_t)&eaddr, (mac_offset / 2), 3, 0);
- break;
- case DC_TYPE_PNIC:
- dc_read_eeprom(sc, (caddr_t)&eaddr, 0, 3, 1);
- break;
- case DC_TYPE_DM9102:
- dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0);
-#ifdef __sparc64__
- /*
- * If this is an onboard dc(4) the station address read from
- * the EEPROM is all zero and we have to get it from the fcode.
- */
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- if (eaddr[i] != 0x00)
- break;
- if (i >= ETHER_ADDR_LEN)
- OF_getetheraddr(dev, eaddr);
-#endif
- break;
- case DC_TYPE_21143:
- case DC_TYPE_ASIX:
- dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0);
- break;
- case DC_TYPE_AL981:
- case DC_TYPE_AN985:
- *(u_int32_t *)(&eaddr[0]) = CSR_READ_4(sc, DC_AL_PAR0);
- *(u_int16_t *)(&eaddr[4]) = CSR_READ_4(sc, DC_AL_PAR1);
- break;
- case DC_TYPE_CONEXANT:
- bcopy(sc->dc_srom + DC_CONEXANT_EE_NODEADDR, &eaddr,
- ETHER_ADDR_LEN);
- break;
- case DC_TYPE_XIRCOM:
- /* The MAC comes from the CIS. */
- mac = pci_get_ether(dev);
- if (!mac) {
- device_printf(dev, "No station address in CIS!\n");
- error = ENXIO;
- goto fail;
- }
- bcopy(mac, eaddr, ETHER_ADDR_LEN);
- break;
- default:
- dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0);
- break;
- }
-
- sc->dc_unit = unit;
-
- /* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
- error = bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT,
- BUS_SPACE_MAXADDR, NULL, NULL, sizeof(struct dc_list_data), 1,
- sizeof(struct dc_list_data), 0, NULL, NULL, &sc->dc_ltag);
- if (error) {
- printf("dc%d: failed to allocate busdma tag\n", unit);
- error = ENXIO;
- goto fail;
- }
- error = bus_dmamem_alloc(sc->dc_ltag, (void **)&sc->dc_ldata,
- BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->dc_lmap);
- if (error) {
- printf("dc%d: failed to allocate DMA safe memory\n", unit);
- error = ENXIO;
- goto fail;
- }
- error = bus_dmamap_load(sc->dc_ltag, sc->dc_lmap, sc->dc_ldata,
- sizeof(struct dc_list_data), dc_dma_map_addr, &sc->dc_laddr,
- BUS_DMA_NOWAIT);
- if (error) {
- printf("dc%d: cannot get address of the descriptors\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- /*
- * Allocate a busdma tag and DMA safe memory for the multicast
- * setup frame.
- */
- error = bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT,
- BUS_SPACE_MAXADDR, NULL, NULL, DC_SFRAME_LEN + DC_MIN_FRAMELEN, 1,
- DC_SFRAME_LEN + DC_MIN_FRAMELEN, 0, NULL, NULL, &sc->dc_stag);
- if (error) {
- printf("dc%d: failed to allocate busdma tag\n", unit);
- error = ENXIO;
- goto fail;
- }
- error = bus_dmamem_alloc(sc->dc_stag, (void **)&sc->dc_cdata.dc_sbuf,
- BUS_DMA_NOWAIT, &sc->dc_smap);
- if (error) {
- printf("dc%d: failed to allocate DMA safe memory\n", unit);
- error = ENXIO;
- goto fail;
- }
- error = bus_dmamap_load(sc->dc_stag, sc->dc_smap, sc->dc_cdata.dc_sbuf,
- DC_SFRAME_LEN, dc_dma_map_addr, &sc->dc_saddr, BUS_DMA_NOWAIT);
- if (error) {
- printf("dc%d: cannot get address of the descriptors\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- /* Allocate a busdma tag for mbufs. */
- error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
- BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, DC_TX_LIST_CNT, MCLBYTES,
- 0, NULL, NULL, &sc->dc_mtag);
- if (error) {
- printf("dc%d: failed to allocate busdma tag\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- /* Create the TX/RX busdma maps. */
- for (i = 0; i < DC_TX_LIST_CNT; i++) {
- error = bus_dmamap_create(sc->dc_mtag, 0,
- &sc->dc_cdata.dc_tx_map[i]);
- if (error) {
- printf("dc%d: failed to init TX ring\n", unit);
- error = ENXIO;
- goto fail;
- }
- }
- for (i = 0; i < DC_RX_LIST_CNT; i++) {
- error = bus_dmamap_create(sc->dc_mtag, 0,
- &sc->dc_cdata.dc_rx_map[i]);
- if (error) {
- printf("dc%d: failed to init RX ring\n", unit);
- error = ENXIO;
- goto fail;
- }
- }
- error = bus_dmamap_create(sc->dc_mtag, 0, &sc->dc_sparemap);
- if (error) {
- printf("dc%d: failed to init RX ring\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- ifp = sc->dc_ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- printf("dc%d: can not if_alloc()\n", unit);
- error = ENOSPC;
- goto fail;
- }
- ifp->if_softc = sc;
- if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- /* XXX: bleah, MTU gets overwritten in ether_ifattach() */
- ifp->if_mtu = ETHERMTU;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- if (!IS_MPSAFE)
- ifp->if_flags |= IFF_NEEDSGIANT;
- ifp->if_ioctl = dc_ioctl;
- ifp->if_start = dc_start;
- ifp->if_watchdog = dc_watchdog;
- ifp->if_init = dc_init;
- ifp->if_baudrate = 10000000;
- IFQ_SET_MAXLEN(&ifp->if_snd, DC_TX_LIST_CNT - 1);
- ifp->if_snd.ifq_drv_maxlen = DC_TX_LIST_CNT - 1;
- IFQ_SET_READY(&ifp->if_snd);
-
- /*
- * Do MII setup. If this is a 21143, check for a PHY on the
- * MII bus after applying any necessary fixups to twiddle the
- * GPIO bits. If we don't end up finding a PHY, restore the
- * old selection (SIA only or SIA/SYM) and attach the dcphy
- * driver instead.
- */
- if (DC_IS_INTEL(sc)) {
- dc_apply_fixup(sc, IFM_AUTO);
- tmp = sc->dc_pmode;
- sc->dc_pmode = DC_PMODE_MII;
- }
-
- /*
- * Setup General Purpose port mode and data so the tulip can talk
- * to the MII. This needs to be done before mii_phy_probe so that
- * we can actually see them.
- */
- if (DC_IS_XIRCOM(sc)) {
- CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_WRITE_EN | DC_SIAGP_INT1_EN |
- DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
- DELAY(10);
- CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_INT1_EN |
- DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
- DELAY(10);
- }
-
- error = mii_phy_probe(dev, &sc->dc_miibus,
- dc_ifmedia_upd, dc_ifmedia_sts);
-
- if (error && DC_IS_INTEL(sc)) {
- sc->dc_pmode = tmp;
- if (sc->dc_pmode != DC_PMODE_SIA)
- sc->dc_pmode = DC_PMODE_SYM;
- sc->dc_flags |= DC_21143_NWAY;
- mii_phy_probe(dev, &sc->dc_miibus,
- dc_ifmedia_upd, dc_ifmedia_sts);
- /*
- * For non-MII cards, we need to have the 21143
- * drive the LEDs. Except there are some systems
- * like the NEC VersaPro NoteBook PC which have no
- * LEDs, and twiddling these bits has adverse effects
- * on them. (I.e. you suddenly can't get a link.)
- */
- if (pci_read_config(dev, DC_PCI_CSID, 4) != 0x80281033)
- sc->dc_flags |= DC_TULIP_LEDS;
- error = 0;
- }
-
- if (error) {
- printf("dc%d: MII without any PHY!\n", sc->dc_unit);
- goto fail;
- }
-
- if (DC_IS_ADMTEK(sc)) {
- /*
- * Set automatic TX underrun recovery for the ADMtek chips
- */
- DC_SETBIT(sc, DC_AL_CR, DC_AL_CR_ATUR);
- }
-
- /*
- * Tell the upper layer(s) we support long frames.
- */
- ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
- ifp->if_capabilities |= IFCAP_VLAN_MTU;
-#ifdef DEVICE_POLLING
- ifp->if_capabilities |= IFCAP_POLLING;
-#endif
- ifp->if_capenable = ifp->if_capabilities;
-
- callout_init(&sc->dc_stat_ch, IS_MPSAFE ? CALLOUT_MPSAFE : 0);
-
-#ifdef SRM_MEDIA
- sc->dc_srm_media = 0;
-
- /* Remember the SRM console media setting */
- if (DC_IS_INTEL(sc)) {
- command = pci_read_config(dev, DC_PCI_CFDD, 4);
- command &= ~(DC_CFDD_SNOOZE_MODE | DC_CFDD_SLEEP_MODE);
- switch ((command >> 8) & 0xff) {
- case 3:
- sc->dc_srm_media = IFM_10_T;
- break;
- case 4:
- sc->dc_srm_media = IFM_10_T | IFM_FDX;
- break;
- case 5:
- sc->dc_srm_media = IFM_100_TX;
- break;
- case 6:
- sc->dc_srm_media = IFM_100_TX | IFM_FDX;
- break;
- }
- if (sc->dc_srm_media)
- sc->dc_srm_media |= IFM_ACTIVE | IFM_ETHER;
- }
-#endif
-
- /*
- * Call MI attach routine.
- */
- ether_ifattach(ifp, eaddr);
-
- /* Hook interrupt last to avoid having to lock softc */
- error = bus_setup_intr(dev, sc->dc_irq, INTR_TYPE_NET |
- (IS_MPSAFE ? INTR_MPSAFE : 0),
- dc_intr, sc, &sc->dc_intrhand);
-
- if (error) {
- printf("dc%d: couldn't set up irq\n", unit);
- ether_ifdetach(ifp);
- if_free(ifp);
- goto fail;
- }
-
-fail:
- if (error)
- dc_detach(dev);
- return (error);
-}
-
-/*
- * Shutdown hardware and free up resources. This can be called any
- * time after the mutex has been initialized. It is called in both
- * the error case in attach and the normal detach case so it needs
- * to be careful about only freeing resources that have actually been
- * allocated.
- */
-static int
-dc_detach(device_t dev)
-{
- struct dc_softc *sc;
- struct ifnet *ifp;
- struct dc_mediainfo *m;
- int i;
-
- sc = device_get_softc(dev);
- KASSERT(mtx_initialized(&sc->dc_mtx), ("dc mutex not initialized"));
- DC_LOCK(sc);
-
- ifp = sc->dc_ifp;
-
- /* These should only be active if attach succeeded */
- if (device_is_attached(dev)) {
- dc_stop(sc);
- ether_ifdetach(ifp);
- if_free(ifp);
- }
- if (sc->dc_miibus)
- device_delete_child(dev, sc->dc_miibus);
- bus_generic_detach(dev);
-
- if (sc->dc_intrhand)
- bus_teardown_intr(dev, sc->dc_irq, sc->dc_intrhand);
- if (sc->dc_irq)
- bus_release_resource(dev, SYS_RES_IRQ, 0, sc->dc_irq);
- if (sc->dc_res)
- bus_release_resource(dev, DC_RES, DC_RID, sc->dc_res);
-
- if (sc->dc_cdata.dc_sbuf != NULL)
- bus_dmamem_free(sc->dc_stag, sc->dc_cdata.dc_sbuf, sc->dc_smap);
- if (sc->dc_ldata != NULL)
- bus_dmamem_free(sc->dc_ltag, sc->dc_ldata, sc->dc_lmap);
- for (i = 0; i < DC_TX_LIST_CNT; i++)
- bus_dmamap_destroy(sc->dc_mtag, sc->dc_cdata.dc_tx_map[i]);
- for (i = 0; i < DC_RX_LIST_CNT; i++)
- bus_dmamap_destroy(sc->dc_mtag, sc->dc_cdata.dc_rx_map[i]);
- bus_dmamap_destroy(sc->dc_mtag, sc->dc_sparemap);
- if (sc->dc_stag)
- bus_dma_tag_destroy(sc->dc_stag);
- if (sc->dc_mtag)
- bus_dma_tag_destroy(sc->dc_mtag);
- if (sc->dc_ltag)
- bus_dma_tag_destroy(sc->dc_ltag);
-
- free(sc->dc_pnic_rx_buf, M_DEVBUF);
-
- while (sc->dc_mi != NULL) {
- m = sc->dc_mi->dc_next;
- free(sc->dc_mi, M_DEVBUF);
- sc->dc_mi = m;
- }
- free(sc->dc_srom, M_DEVBUF);
-
- DC_UNLOCK(sc);
- mtx_destroy(&sc->dc_mtx);
-
- return (0);
-}
-
-/*
- * Initialize the transmit descriptors.
- */
-static int
-dc_list_tx_init(struct dc_softc *sc)
-{
- struct dc_chain_data *cd;
- struct dc_list_data *ld;
- int i, nexti;
-
- cd = &sc->dc_cdata;
- ld = sc->dc_ldata;
- for (i = 0; i < DC_TX_LIST_CNT; i++) {
- if (i == DC_TX_LIST_CNT - 1)
- nexti = 0;
- else
- nexti = i + 1;
- ld->dc_tx_list[i].dc_next = htole32(DC_TXDESC(sc, nexti));
- cd->dc_tx_chain[i] = NULL;
- ld->dc_tx_list[i].dc_data = 0;
- ld->dc_tx_list[i].dc_ctl = 0;
- }
-
- cd->dc_tx_prod = cd->dc_tx_cons = cd->dc_tx_cnt = 0;
- bus_dmamap_sync(sc->dc_ltag, sc->dc_lmap,
- BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- return (0);
-}
-
-
-/*
- * Initialize the RX descriptors and allocate mbufs for them. Note that
- * we arrange the descriptors in a closed ring, so that the last descriptor
- * points back to the first.
- */
-static int
-dc_list_rx_init(struct dc_softc *sc)
-{
- struct dc_chain_data *cd;
- struct dc_list_data *ld;
- int i, nexti;
-
- cd = &sc->dc_cdata;
- ld = sc->dc_ldata;
-
- for (i = 0; i < DC_RX_LIST_CNT; i++) {
- if (dc_newbuf(sc, i, 1) != 0)
- return (ENOBUFS);
- if (i == DC_RX_LIST_CNT - 1)
- nexti = 0;
- else
- nexti = i + 1;
- ld->dc_rx_list[i].dc_next = htole32(DC_RXDESC(sc, nexti));
- }
-
- cd->dc_rx_prod = 0;
- bus_dmamap_sync(sc->dc_ltag, sc->dc_lmap,
- BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- return (0);
-}
-
-static void
-dc_dma_map_rxbuf(arg, segs, nseg, mapsize, error)
- void *arg;
- bus_dma_segment_t *segs;
- int nseg;
- bus_size_t mapsize;
- int error;
-{
- struct dc_softc *sc;
- struct dc_desc *c;
-
- sc = arg;
- c = &sc->dc_ldata->dc_rx_list[sc->dc_cdata.dc_rx_cur];
- if (error) {
- sc->dc_cdata.dc_rx_err = error;
- return;
- }
-
- KASSERT(nseg == 1, ("wrong number of segments, should be 1"));
- sc->dc_cdata.dc_rx_err = 0;
- c->dc_data = htole32(segs->ds_addr);
-}
-
-/*
- * Initialize an RX descriptor and attach an MBUF cluster.
- */
-static int
-dc_newbuf(struct dc_softc *sc, int i, int alloc)
-{
- struct mbuf *m_new;
- bus_dmamap_t tmp;
- int error;
-
- if (alloc) {
- m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
- if (m_new == NULL)
- return (ENOBUFS);
- } else {
- m_new = sc->dc_cdata.dc_rx_chain[i];
- m_new->m_data = m_new->m_ext.ext_buf;
- }
- m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
- m_adj(m_new, sizeof(u_int64_t));
-
- /*
- * If this is a PNIC chip, zero the buffer. This is part
- * of the workaround for the receive bug in the 82c168 and
- * 82c169 chips.
- */
- if (sc->dc_flags & DC_PNIC_RX_BUG_WAR)
- bzero(mtod(m_new, char *), m_new->m_len);
-
- /* No need to remap the mbuf if we're reusing it. */
- if (alloc) {
- sc->dc_cdata.dc_rx_cur = i;
- error = bus_dmamap_load_mbuf(sc->dc_mtag, sc->dc_sparemap,
- m_new, dc_dma_map_rxbuf, sc, 0);
- if (error) {
- m_freem(m_new);
- return (error);
- }
- if (sc->dc_cdata.dc_rx_err != 0) {
- m_freem(m_new);
- return (sc->dc_cdata.dc_rx_err);
- }
- bus_dmamap_unload(sc->dc_mtag, sc->dc_cdata.dc_rx_map[i]);
- tmp = sc->dc_cdata.dc_rx_map[i];
- sc->dc_cdata.dc_rx_map[i] = sc->dc_sparemap;
- sc->dc_sparemap = tmp;
- sc->dc_cdata.dc_rx_chain[i] = m_new;
- }
-
- sc->dc_ldata->dc_rx_list[i].dc_ctl = htole32(DC_RXCTL_RLINK | DC_RXLEN);
- sc->dc_ldata->dc_rx_list[i].dc_status = htole32(DC_RXSTAT_OWN);
- bus_dmamap_sync(sc->dc_mtag, sc->dc_cdata.dc_rx_map[i],
- BUS_DMASYNC_PREREAD);
- bus_dmamap_sync(sc->dc_ltag, sc->dc_lmap,
- BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- return (0);
-}
-
-/*
- * Grrrrr.
- * The PNIC chip has a terrible bug in it that manifests itself during
- * periods of heavy activity. The exact mode of failure if difficult to
- * pinpoint: sometimes it only happens in promiscuous mode, sometimes it
- * will happen on slow machines. The bug is that sometimes instead of
- * uploading one complete frame during reception, it uploads what looks
- * like the entire contents of its FIFO memory. The frame we want is at
- * the end of the whole mess, but we never know exactly how much data has
- * been uploaded, so salvaging the frame is hard.
- *
- * There is only one way to do it reliably, and it's disgusting.
- * Here's what we know:
- *
- * - We know there will always be somewhere between one and three extra
- * descriptors uploaded.
- *
- * - We know the desired received frame will always be at the end of the
- * total data upload.
- *
- * - We know the size of the desired received frame because it will be
- * provided in the length field of the status word in the last descriptor.
- *
- * Here's what we do:
- *
- * - When we allocate buffers for the receive ring, we bzero() them.
- * This means that we know that the buffer contents should be all
- * zeros, except for data uploaded by the chip.
- *
- * - We also force the PNIC chip to upload frames that include the
- * ethernet CRC at the end.
- *
- * - We gather all of the bogus frame data into a single buffer.
- *
- * - We then position a pointer at the end of this buffer and scan
- * backwards until we encounter the first non-zero byte of data.
- * This is the end of the received frame. We know we will encounter
- * some data at the end of the frame because the CRC will always be
- * there, so even if the sender transmits a packet of all zeros,
- * we won't be fooled.
- *
- * - We know the size of the actual received frame, so we subtract
- * that value from the current pointer location. This brings us
- * to the start of the actual received packet.
- *
- * - We copy this into an mbuf and pass it on, along with the actual
- * frame length.
- *
- * The performance hit is tremendous, but it beats dropping frames all
- * the time.
- */
-
-#define DC_WHOLEFRAME (DC_RXSTAT_FIRSTFRAG | DC_RXSTAT_LASTFRAG)
-static void
-dc_pnic_rx_bug_war(struct dc_softc *sc, int idx)
-{
- struct dc_desc *cur_rx;
- struct dc_desc *c = NULL;
- struct mbuf *m = NULL;
- unsigned char *ptr;
- int i, total_len;
- u_int32_t rxstat = 0;
-
- i = sc->dc_pnic_rx_bug_save;
- cur_rx = &sc->dc_ldata->dc_rx_list[idx];
- ptr = sc->dc_pnic_rx_buf;
- bzero(ptr, DC_RXLEN * 5);
-
- /* Copy all the bytes from the bogus buffers. */
- while (1) {
- c = &sc->dc_ldata->dc_rx_list[i];
- rxstat = le32toh(c->dc_status);
- m = sc->dc_cdata.dc_rx_chain[i];
- bcopy(mtod(m, char *), ptr, DC_RXLEN);
- ptr += DC_RXLEN;
- /* If this is the last buffer, break out. */
- if (i == idx || rxstat & DC_RXSTAT_LASTFRAG)
- break;
- dc_newbuf(sc, i, 0);
- DC_INC(i, DC_RX_LIST_CNT);
- }
-
- /* Find the length of the actual receive frame. */
- total_len = DC_RXBYTES(rxstat);
-
- /* Scan backwards until we hit a non-zero byte. */
- while (*ptr == 0x00)
- ptr--;
-
- /* Round off. */
- if ((uintptr_t)(ptr) & 0x3)
- ptr -= 1;
-
- /* Now find the start of the frame. */
- ptr -= total_len;
- if (ptr < sc->dc_pnic_rx_buf)
- ptr = sc->dc_pnic_rx_buf;
-
- /*
- * Now copy the salvaged frame to the last mbuf and fake up
- * the status word to make it look like a successful
- * frame reception.
- */
- dc_newbuf(sc, i, 0);
- bcopy(ptr, mtod(m, char *), total_len);
- cur_rx->dc_status = htole32(rxstat | DC_RXSTAT_FIRSTFRAG);
-}
-
-/*
- * This routine searches the RX ring for dirty descriptors in the
- * event that the rxeof routine falls out of sync with the chip's
- * current descriptor pointer. This may happen sometimes as a result
- * of a "no RX buffer available" condition that happens when the chip
- * consumes all of the RX buffers before the driver has a chance to
- * process the RX ring. This routine may need to be called more than
- * once to bring the driver back in sync with the chip, however we
- * should still be getting RX DONE interrupts to drive the search
- * for new packets in the RX ring, so we should catch up eventually.
- */
-static int
-dc_rx_resync(struct dc_softc *sc)
-{
- struct dc_desc *cur_rx;
- int i, pos;
-
- pos = sc->dc_cdata.dc_rx_prod;
-
- for (i = 0; i < DC_RX_LIST_CNT; i++) {
- cur_rx = &sc->dc_ldata->dc_rx_list[pos];
- if (!(le32toh(cur_rx->dc_status) & DC_RXSTAT_OWN))
- break;
- DC_INC(pos, DC_RX_LIST_CNT);
- }
-
- /* If the ring really is empty, then just return. */
- if (i == DC_RX_LIST_CNT)
- return (0);
-
- /* We've fallen behing the chip: catch it. */
- sc->dc_cdata.dc_rx_prod = pos;
-
- return (EAGAIN);
-}
-
-/*
- * A frame has been uploaded: pass the resulting mbuf chain up to
- * the higher level protocols.
- */
-static void
-dc_rxeof(struct dc_softc *sc)
-{
- struct mbuf *m;
- struct ifnet *ifp;
- struct dc_desc *cur_rx;
- int i, total_len = 0;
- u_int32_t rxstat;
-
- DC_LOCK_ASSERT(sc);
-
- ifp = sc->dc_ifp;
- i = sc->dc_cdata.dc_rx_prod;
-
- bus_dmamap_sync(sc->dc_ltag, sc->dc_lmap, BUS_DMASYNC_POSTREAD);
- while (!(le32toh(sc->dc_ldata->dc_rx_list[i].dc_status) &
- DC_RXSTAT_OWN)) {
-#ifdef DEVICE_POLLING
- if (ifp->if_flags & IFF_POLLING) {
- if (sc->rxcycles <= 0)
- break;
- sc->rxcycles--;
- }
-#endif
- cur_rx = &sc->dc_ldata->dc_rx_list[i];
- rxstat = le32toh(cur_rx->dc_status);
- m = sc->dc_cdata.dc_rx_chain[i];
- bus_dmamap_sync(sc->dc_mtag, sc->dc_cdata.dc_rx_map[i],
- BUS_DMASYNC_POSTREAD);
- total_len = DC_RXBYTES(rxstat);
-
- if (sc->dc_flags & DC_PNIC_RX_BUG_WAR) {
- if ((rxstat & DC_WHOLEFRAME) != DC_WHOLEFRAME) {
- if (rxstat & DC_RXSTAT_FIRSTFRAG)
- sc->dc_pnic_rx_bug_save = i;
- if ((rxstat & DC_RXSTAT_LASTFRAG) == 0) {
- DC_INC(i, DC_RX_LIST_CNT);
- continue;
- }
- dc_pnic_rx_bug_war(sc, i);
- rxstat = le32toh(cur_rx->dc_status);
- total_len = DC_RXBYTES(rxstat);
- }
- }
-
- /*
- * If an error occurs, update stats, clear the
- * status word and leave the mbuf cluster in place:
- * it should simply get re-used next time this descriptor
- * comes up in the ring. However, don't report long
- * frames as errors since they could be vlans.
- */
- if ((rxstat & DC_RXSTAT_RXERR)) {
- if (!(rxstat & DC_RXSTAT_GIANT) ||
- (rxstat & (DC_RXSTAT_CRCERR | DC_RXSTAT_DRIBBLE |
- DC_RXSTAT_MIIERE | DC_RXSTAT_COLLSEEN |
- DC_RXSTAT_RUNT | DC_RXSTAT_DE))) {
- ifp->if_ierrors++;
- if (rxstat & DC_RXSTAT_COLLSEEN)
- ifp->if_collisions++;
- dc_newbuf(sc, i, 0);
- if (rxstat & DC_RXSTAT_CRCERR) {
- DC_INC(i, DC_RX_LIST_CNT);
- continue;
- } else {
- dc_init(sc);
- return;
- }
- }
- }
-
- /* No errors; receive the packet. */
- total_len -= ETHER_CRC_LEN;
-#ifdef __i386__
- /*
- * On the x86 we do not have alignment problems, so try to
- * allocate a new buffer for the receive ring, and pass up
- * the one where the packet is already, saving the expensive
- * copy done in m_devget().
- * If we are on an architecture with alignment problems, or
- * if the allocation fails, then use m_devget and leave the
- * existing buffer in the receive ring.
- */
- if (dc_quick && dc_newbuf(sc, i, 1) == 0) {
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = m->m_len = total_len;
- DC_INC(i, DC_RX_LIST_CNT);
- } else
-#endif
- {
- struct mbuf *m0;
-
- m0 = m_devget(mtod(m, char *), total_len,
- ETHER_ALIGN, ifp, NULL);
- dc_newbuf(sc, i, 0);
- DC_INC(i, DC_RX_LIST_CNT);
- if (m0 == NULL) {
- ifp->if_ierrors++;
- continue;
- }
- m = m0;
- }
-
- ifp->if_ipackets++;
- DC_UNLOCK(sc);
- (*ifp->if_input)(ifp, m);
- DC_LOCK(sc);
- }
-
- sc->dc_cdata.dc_rx_prod = i;
-}
-
-/*
- * A frame was downloaded to the chip. It's safe for us to clean up
- * the list buffers.
- */
-
-static void
-dc_txeof(struct dc_softc *sc)
-{
- struct dc_desc *cur_tx = NULL;
- struct ifnet *ifp;
- int idx;
- u_int32_t ctl, txstat;
-
- ifp = sc->dc_ifp;
-
- /*
- * Go through our tx list and free mbufs for those
- * frames that have been transmitted.
- */
- bus_dmamap_sync(sc->dc_ltag, sc->dc_lmap, BUS_DMASYNC_POSTREAD);
- idx = sc->dc_cdata.dc_tx_cons;
- while (idx != sc->dc_cdata.dc_tx_prod) {
-
- cur_tx = &sc->dc_ldata->dc_tx_list[idx];
- txstat = le32toh(cur_tx->dc_status);
- ctl = le32toh(cur_tx->dc_ctl);
-
- if (txstat & DC_TXSTAT_OWN)
- break;
-
- if (!(ctl & DC_TXCTL_LASTFRAG) || ctl & DC_TXCTL_SETUP) {
- if (ctl & DC_TXCTL_SETUP) {
- /*
- * Yes, the PNIC is so brain damaged
- * that it will sometimes generate a TX
- * underrun error while DMAing the RX
- * filter setup frame. If we detect this,
- * we have to send the setup frame again,
- * or else the filter won't be programmed
- * correctly.
- */
- if (DC_IS_PNIC(sc)) {
- if (txstat & DC_TXSTAT_ERRSUM)
- dc_setfilt(sc);
- }
- sc->dc_cdata.dc_tx_chain[idx] = NULL;
- }
- sc->dc_cdata.dc_tx_cnt--;
- DC_INC(idx, DC_TX_LIST_CNT);
- continue;
- }
-
- if (DC_IS_XIRCOM(sc) || DC_IS_CONEXANT(sc)) {
- /*
- * XXX: Why does my Xircom taunt me so?
- * For some reason it likes setting the CARRLOST flag
- * even when the carrier is there. wtf?!?
- * Who knows, but Conexant chips have the
- * same problem. Maybe they took lessons
- * from Xircom.
- */
- if (/*sc->dc_type == DC_TYPE_21143 &&*/
- sc->dc_pmode == DC_PMODE_MII &&
- ((txstat & 0xFFFF) & ~(DC_TXSTAT_ERRSUM |
- DC_TXSTAT_NOCARRIER)))
- txstat &= ~DC_TXSTAT_ERRSUM;
- } else {
- if (/*sc->dc_type == DC_TYPE_21143 &&*/
- sc->dc_pmode == DC_PMODE_MII &&
- ((txstat & 0xFFFF) & ~(DC_TXSTAT_ERRSUM |
- DC_TXSTAT_NOCARRIER | DC_TXSTAT_CARRLOST)))
- txstat &= ~DC_TXSTAT_ERRSUM;
- }
-
- if (txstat & DC_TXSTAT_ERRSUM) {
- ifp->if_oerrors++;
- if (txstat & DC_TXSTAT_EXCESSCOLL)
- ifp->if_collisions++;
- if (txstat & DC_TXSTAT_LATECOLL)
- ifp->if_collisions++;
- if (!(txstat & DC_TXSTAT_UNDERRUN)) {
- dc_init(sc);
- return;
- }
- }
-
- ifp->if_collisions += (txstat & DC_TXSTAT_COLLCNT) >> 3;
-
- ifp->if_opackets++;
- if (sc->dc_cdata.dc_tx_chain[idx] != NULL) {
- bus_dmamap_sync(sc->dc_mtag,
- sc->dc_cdata.dc_tx_map[idx],
- BUS_DMASYNC_POSTWRITE);
- bus_dmamap_unload(sc->dc_mtag,
- sc->dc_cdata.dc_tx_map[idx]);
- m_freem(sc->dc_cdata.dc_tx_chain[idx]);
- sc->dc_cdata.dc_tx_chain[idx] = NULL;
- }
-
- sc->dc_cdata.dc_tx_cnt--;
- DC_INC(idx, DC_TX_LIST_CNT);
- }
-
- if (idx != sc->dc_cdata.dc_tx_cons) {
- /* Some buffers have been freed. */
- sc->dc_cdata.dc_tx_cons = idx;
- ifp->if_flags &= ~IFF_OACTIVE;
- }
- ifp->if_timer = (sc->dc_cdata.dc_tx_cnt == 0) ? 0 : 5;
-}
-
-static void
-dc_tick(void *xsc)
-{
- struct dc_softc *sc;
- struct mii_data *mii;
- struct ifnet *ifp;
- u_int32_t r;
-
- sc = xsc;
- DC_LOCK(sc);
- ifp = sc->dc_ifp;
- mii = device_get_softc(sc->dc_miibus);
-
- if (sc->dc_flags & DC_REDUCED_MII_POLL) {
- if (sc->dc_flags & DC_21143_NWAY) {
- r = CSR_READ_4(sc, DC_10BTSTAT);
- if (IFM_SUBTYPE(mii->mii_media_active) ==
- IFM_100_TX && (r & DC_TSTAT_LS100)) {
- sc->dc_link = 0;
- mii_mediachg(mii);
- }
- if (IFM_SUBTYPE(mii->mii_media_active) ==
- IFM_10_T && (r & DC_TSTAT_LS10)) {
- sc->dc_link = 0;
- mii_mediachg(mii);
- }
- if (sc->dc_link == 0)
- mii_tick(mii);
- } else {
- r = CSR_READ_4(sc, DC_ISR);
- if ((r & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT &&
- sc->dc_cdata.dc_tx_cnt == 0) {
- mii_tick(mii);
- if (!(mii->mii_media_status & IFM_ACTIVE))
- sc->dc_link = 0;
- }
- }
- } else
- mii_tick(mii);
-
- /*
- * When the init routine completes, we expect to be able to send
- * packets right away, and in fact the network code will send a
- * gratuitous ARP the moment the init routine marks the interface
- * as running. However, even though the MAC may have been initialized,
- * there may be a delay of a few seconds before the PHY completes
- * autonegotiation and the link is brought up. Any transmissions
- * made during that delay will be lost. Dealing with this is tricky:
- * we can't just pause in the init routine while waiting for the
- * PHY to come ready since that would bring the whole system to
- * a screeching halt for several seconds.
- *
- * What we do here is prevent the TX start routine from sending
- * any packets until a link has been established. After the
- * interface has been initialized, the tick routine will poll
- * the state of the PHY until the IFM_ACTIVE flag is set. Until
- * that time, packets will stay in the send queue, and once the
- * link comes up, they will be flushed out to the wire.
- */
- if (!sc->dc_link && mii->mii_media_status & IFM_ACTIVE &&
- IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
- sc->dc_link++;
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- dc_start(ifp);
- }
-
- if (sc->dc_flags & DC_21143_NWAY && !sc->dc_link)
- callout_reset(&sc->dc_stat_ch, hz/10, dc_tick, sc);
- else
- callout_reset(&sc->dc_stat_ch, hz, dc_tick, sc);
-
- DC_UNLOCK(sc);
-}
-
-/*
- * A transmit underrun has occurred. Back off the transmit threshold,
- * or switch to store and forward mode if we have to.
- */
-static void
-dc_tx_underrun(struct dc_softc *sc)
-{
- u_int32_t isr;
- int i;
-
- if (DC_IS_DAVICOM(sc))
- dc_init(sc);
-
- if (DC_IS_INTEL(sc)) {
- /*
- * The real 21143 requires that the transmitter be idle
- * in order to change the transmit threshold or store
- * and forward state.
- */
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON);
-
- for (i = 0; i < DC_TIMEOUT; i++) {
- isr = CSR_READ_4(sc, DC_ISR);
- if (isr & DC_ISR_TX_IDLE)
- break;
- DELAY(10);
- }
- if (i == DC_TIMEOUT) {
- printf("dc%d: failed to force tx to idle state\n",
- sc->dc_unit);
- dc_init(sc);
- }
- }
-
- printf("dc%d: TX underrun -- ", sc->dc_unit);
- sc->dc_txthresh += DC_TXTHRESH_INC;
- if (sc->dc_txthresh > DC_TXTHRESH_MAX) {
- printf("using store and forward mode\n");
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_STORENFWD);
- } else {
- printf("increasing TX threshold\n");
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_TX_THRESH);
- DC_SETBIT(sc, DC_NETCFG, sc->dc_txthresh);
- }
-
- if (DC_IS_INTEL(sc))
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON);
-}
-
-#ifdef DEVICE_POLLING
-static poll_handler_t dc_poll;
-
-static void
-dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
-{
- struct dc_softc *sc = ifp->if_softc;
-
- if (!(ifp->if_capenable & IFCAP_POLLING)) {
- ether_poll_deregister(ifp);
- cmd = POLL_DEREGISTER;
- }
- if (cmd == POLL_DEREGISTER) { /* final call, enable interrupts */
- /* Re-enable interrupts. */
- CSR_WRITE_4(sc, DC_IMR, DC_INTRS);
- return;
- }
- DC_LOCK(sc);
- sc->rxcycles = count;
- dc_rxeof(sc);
- dc_txeof(sc);
- if (!IFQ_IS_EMPTY(&ifp->if_snd) && !(ifp->if_flags & IFF_OACTIVE))
- dc_start(ifp);
-
- if (cmd == POLL_AND_CHECK_STATUS) { /* also check status register */
- u_int32_t status;
-
- status = CSR_READ_4(sc, DC_ISR);
- status &= (DC_ISR_RX_WATDOGTIMEO | DC_ISR_RX_NOBUF |
- DC_ISR_TX_NOBUF | DC_ISR_TX_IDLE | DC_ISR_TX_UNDERRUN |
- DC_ISR_BUS_ERR);
- if (!status) {
- DC_UNLOCK(sc);
- return;
- }
- /* ack what we have */
- CSR_WRITE_4(sc, DC_ISR, status);
-
- if (status & (DC_ISR_RX_WATDOGTIMEO | DC_ISR_RX_NOBUF)) {
- u_int32_t r = CSR_READ_4(sc, DC_FRAMESDISCARDED);
- ifp->if_ierrors += (r & 0xffff) + ((r >> 17) & 0x7ff);
-
- if (dc_rx_resync(sc))
- dc_rxeof(sc);
- }
- /* restart transmit unit if necessary */
- if (status & DC_ISR_TX_IDLE && sc->dc_cdata.dc_tx_cnt)
- CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF);
-
- if (status & DC_ISR_TX_UNDERRUN)
- dc_tx_underrun(sc);
-
- if (status & DC_ISR_BUS_ERR) {
- printf("dc_poll: dc%d bus error\n", sc->dc_unit);
- dc_reset(sc);
- dc_init(sc);
- }
- }
- DC_UNLOCK(sc);
-}
-#endif /* DEVICE_POLLING */
-
-static void
-dc_intr(void *arg)
-{
- struct dc_softc *sc;
- struct ifnet *ifp;
- u_int32_t status;
-
- sc = arg;
-
- if (sc->suspended)
- return;
-
- if ((CSR_READ_4(sc, DC_ISR) & DC_INTRS) == 0)
- return;
-
- DC_LOCK(sc);
- ifp = sc->dc_ifp;
-#ifdef DEVICE_POLLING
- if (ifp->if_flags & IFF_POLLING)
- goto done;
- if ((ifp->if_capenable & IFCAP_POLLING) &&
- ether_poll_register(dc_poll, ifp)) { /* ok, disable interrupts */
- CSR_WRITE_4(sc, DC_IMR, 0x00000000);
- goto done;
- }
-#endif
-
- /* Suppress unwanted interrupts */
- if (!(ifp->if_flags & IFF_UP)) {
- if (CSR_READ_4(sc, DC_ISR) & DC_INTRS)
- dc_stop(sc);
- DC_UNLOCK(sc);
- return;
- }
-
- /* Disable interrupts. */
- CSR_WRITE_4(sc, DC_IMR, 0x00000000);
-
- while (((status = CSR_READ_4(sc, DC_ISR)) & DC_INTRS)
- && status != 0xFFFFFFFF) {
-
- CSR_WRITE_4(sc, DC_ISR, status);
-
- if (status & DC_ISR_RX_OK) {
- int curpkts;
- curpkts = ifp->if_ipackets;
- dc_rxeof(sc);
- if (curpkts == ifp->if_ipackets) {
- while (dc_rx_resync(sc))
- dc_rxeof(sc);
- }
- }
-
- if (status & (DC_ISR_TX_OK | DC_ISR_TX_NOBUF))
- dc_txeof(sc);
-
- if (status & DC_ISR_TX_IDLE) {
- dc_txeof(sc);
- if (sc->dc_cdata.dc_tx_cnt) {
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON);
- CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF);
- }
- }
-
- if (status & DC_ISR_TX_UNDERRUN)
- dc_tx_underrun(sc);
-
- if ((status & DC_ISR_RX_WATDOGTIMEO)
- || (status & DC_ISR_RX_NOBUF)) {
- int curpkts;
- curpkts = ifp->if_ipackets;
- dc_rxeof(sc);
- if (curpkts == ifp->if_ipackets) {
- while (dc_rx_resync(sc))
- dc_rxeof(sc);
- }
- }
-
- if (status & DC_ISR_BUS_ERR) {
- dc_reset(sc);
- dc_init(sc);
- }
- }
-
- /* Re-enable interrupts. */
- CSR_WRITE_4(sc, DC_IMR, DC_INTRS);
-
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- dc_start(ifp);
-
-#ifdef DEVICE_POLLING
-done:
-#endif
-
- DC_UNLOCK(sc);
-}
-
-static void
-dc_dma_map_txbuf(arg, segs, nseg, mapsize, error)
- void *arg;
- bus_dma_segment_t *segs;
- int nseg;
- bus_size_t mapsize;
- int error;
-{
- struct dc_softc *sc;
- struct dc_desc *f;
- int cur, first, frag, i;
-
- sc = arg;
- if (error) {
- sc->dc_cdata.dc_tx_err = error;
- return;
- }
-
- first = cur = frag = sc->dc_cdata.dc_tx_prod;
- for (i = 0; i < nseg; i++) {
- if ((sc->dc_flags & DC_TX_ADMTEK_WAR) &&
- (frag == (DC_TX_LIST_CNT - 1)) &&
- (first != sc->dc_cdata.dc_tx_first)) {
- bus_dmamap_unload(sc->dc_mtag,
- sc->dc_cdata.dc_tx_map[first]);
- sc->dc_cdata.dc_tx_err = ENOBUFS;
- return;
- }
-
- f = &sc->dc_ldata->dc_tx_list[frag];
- f->dc_ctl = htole32(DC_TXCTL_TLINK | segs[i].ds_len);
- if (i == 0) {
- f->dc_status = 0;
- f->dc_ctl |= htole32(DC_TXCTL_FIRSTFRAG);
- } else
- f->dc_status = htole32(DC_TXSTAT_OWN);
- f->dc_data = htole32(segs[i].ds_addr);
- cur = frag;
- DC_INC(frag, DC_TX_LIST_CNT);
- }
-
- sc->dc_cdata.dc_tx_err = 0;
- sc->dc_cdata.dc_tx_prod = frag;
- sc->dc_cdata.dc_tx_cnt += nseg;
- sc->dc_ldata->dc_tx_list[cur].dc_ctl |= htole32(DC_TXCTL_LASTFRAG);
- sc->dc_cdata.dc_tx_chain[cur] = sc->dc_cdata.dc_tx_mapping;
- if (sc->dc_flags & DC_TX_INTR_FIRSTFRAG)
- sc->dc_ldata->dc_tx_list[first].dc_ctl |=
- htole32(DC_TXCTL_FINT);
- if (sc->dc_flags & DC_TX_INTR_ALWAYS)
- sc->dc_ldata->dc_tx_list[cur].dc_ctl |= htole32(DC_TXCTL_FINT);
- if (sc->dc_flags & DC_TX_USE_TX_INTR && sc->dc_cdata.dc_tx_cnt > 64)
- sc->dc_ldata->dc_tx_list[cur].dc_ctl |= htole32(DC_TXCTL_FINT);
- sc->dc_ldata->dc_tx_list[first].dc_status = htole32(DC_TXSTAT_OWN);
-}
-
-/*
- * Encapsulate an mbuf chain in a descriptor by coupling the mbuf data
- * pointers to the fragment pointers.
- */
-static int
-dc_encap(struct dc_softc *sc, struct mbuf **m_head)
-{
- struct mbuf *m;
- int error, idx, chainlen = 0;
-
- /*
- * If there's no way we can send any packets, return now.
- */
- if (DC_TX_LIST_CNT - sc->dc_cdata.dc_tx_cnt < 6)
- return (ENOBUFS);
-
- /*
- * Count the number of frags in this chain to see if
- * we need to m_defrag. Since the descriptor list is shared
- * by all packets, we'll m_defrag long chains so that they
- * do not use up the entire list, even if they would fit.
- */
- for (m = *m_head; m != NULL; m = m->m_next)
- chainlen++;
-
- if ((chainlen > DC_TX_LIST_CNT / 4) ||
- ((DC_TX_LIST_CNT - (chainlen + sc->dc_cdata.dc_tx_cnt)) < 6)) {
- m = m_defrag(*m_head, M_DONTWAIT);
- if (m == NULL)
- return (ENOBUFS);
- *m_head = m;
- }
-
- /*
- * Start packing the mbufs in this chain into
- * the fragment pointers. Stop when we run out
- * of fragments or hit the end of the mbuf chain.
- */
- idx = sc->dc_cdata.dc_tx_prod;
- sc->dc_cdata.dc_tx_mapping = *m_head;
- error = bus_dmamap_load_mbuf(sc->dc_mtag, sc->dc_cdata.dc_tx_map[idx],
- *m_head, dc_dma_map_txbuf, sc, 0);
- if (error)
- return (error);
- if (sc->dc_cdata.dc_tx_err != 0)
- return (sc->dc_cdata.dc_tx_err);
- bus_dmamap_sync(sc->dc_mtag, sc->dc_cdata.dc_tx_map[idx],
- BUS_DMASYNC_PREWRITE);
- bus_dmamap_sync(sc->dc_ltag, sc->dc_lmap,
- BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- return (0);
-}
-
-/*
- * Main transmit routine. To avoid having to do mbuf copies, we put pointers
- * to the mbuf data regions directly in the transmit lists. We also save a
- * copy of the pointers since the transmit list fragment pointers are
- * physical addresses.
- */
-
-static void
-dc_start(struct ifnet *ifp)
-{
- struct dc_softc *sc;
- struct mbuf *m_head = NULL, *m;
- unsigned int queued = 0;
- int idx;
-
- sc = ifp->if_softc;
-
- DC_LOCK(sc);
-
- if (!sc->dc_link && ifp->if_snd.ifq_len < 10) {
- DC_UNLOCK(sc);
- return;
- }
-
- if (ifp->if_flags & IFF_OACTIVE) {
- DC_UNLOCK(sc);
- return;
- }
-
- idx = sc->dc_cdata.dc_tx_first = sc->dc_cdata.dc_tx_prod;
-
- while (sc->dc_cdata.dc_tx_chain[idx] == NULL) {
- IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
- if (m_head == NULL)
- break;
-
- if (sc->dc_flags & DC_TX_COALESCE &&
- (m_head->m_next != NULL ||
- sc->dc_flags & DC_TX_ALIGN)) {
- m = m_defrag(m_head, M_DONTWAIT);
- if (m == NULL) {
- IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
- break;
- } else {
- m_head = m;
- }
- }
-
- if (dc_encap(sc, &m_head)) {
- IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
- break;
- }
- idx = sc->dc_cdata.dc_tx_prod;
-
- queued++;
- /*
- * If there's a BPF listener, bounce a copy of this frame
- * to him.
- */
- BPF_MTAP(ifp, m_head);
-
- if (sc->dc_flags & DC_TX_ONE) {
- ifp->if_flags |= IFF_OACTIVE;
- break;
- }
- }
-
- if (queued > 0) {
- /* Transmit */
- if (!(sc->dc_flags & DC_TX_POLL))
- CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF);
-
- /*
- * Set a timeout in case the chip goes out to lunch.
- */
- ifp->if_timer = 5;
- }
-
- DC_UNLOCK(sc);
-}
-
-static void
-dc_init(void *xsc)
-{
- struct dc_softc *sc = xsc;
- struct ifnet *ifp = sc->dc_ifp;
- struct mii_data *mii;
-
- DC_LOCK(sc);
-
- mii = device_get_softc(sc->dc_miibus);
-
- /*
- * Cancel pending I/O and free all RX/TX buffers.
- */
- dc_stop(sc);
- dc_reset(sc);
-
- /*
- * Set cache alignment and burst length.
- */
- if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc))
- CSR_WRITE_4(sc, DC_BUSCTL, 0);
- else
- CSR_WRITE_4(sc, DC_BUSCTL, DC_BUSCTL_MRME | DC_BUSCTL_MRLE);
- /*
- * Evenly share the bus between receive and transmit process.
- */
- if (DC_IS_INTEL(sc))
- DC_SETBIT(sc, DC_BUSCTL, DC_BUSCTL_ARBITRATION);
- if (DC_IS_DAVICOM(sc) || DC_IS_INTEL(sc)) {
- DC_SETBIT(sc, DC_BUSCTL, DC_BURSTLEN_USECA);
- } else {
- DC_SETBIT(sc, DC_BUSCTL, DC_BURSTLEN_16LONG);
- }
- if (sc->dc_flags & DC_TX_POLL)
- DC_SETBIT(sc, DC_BUSCTL, DC_TXPOLL_1);
- switch(sc->dc_cachesize) {
- case 32:
- DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_32LONG);
- break;
- case 16:
- DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_16LONG);
- break;
- case 8:
- DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_8LONG);
- break;
- case 0:
- default:
- DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_NONE);
- break;
- }
-
- if (sc->dc_flags & DC_TX_STORENFWD)
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_STORENFWD);
- else {
- if (sc->dc_txthresh > DC_TXTHRESH_MAX) {
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_STORENFWD);
- } else {
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_STORENFWD);
- DC_SETBIT(sc, DC_NETCFG, sc->dc_txthresh);
- }
- }
-
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_NO_RXCRC);
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_TX_BACKOFF);
-
- if (DC_IS_MACRONIX(sc) || DC_IS_PNICII(sc)) {
- /*
- * The app notes for the 98713 and 98715A say that
- * in order to have the chips operate properly, a magic
- * number must be written to CSR16. Macronix does not
- * document the meaning of these bits so there's no way
- * to know exactly what they do. The 98713 has a magic
- * number all its own; the rest all use a different one.
- */
- DC_CLRBIT(sc, DC_MX_MAGICPACKET, 0xFFFF0000);
- if (sc->dc_type == DC_TYPE_98713)
- DC_SETBIT(sc, DC_MX_MAGICPACKET, DC_MX_MAGIC_98713);
- else
- DC_SETBIT(sc, DC_MX_MAGICPACKET, DC_MX_MAGIC_98715);
- }
-
- if (DC_IS_XIRCOM(sc)) {
- /*
- * setup General Purpose Port mode and data so the tulip
- * can talk to the MII.
- */
- CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_WRITE_EN | DC_SIAGP_INT1_EN |
- DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
- DELAY(10);
- CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_INT1_EN |
- DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
- DELAY(10);
- }
-
- DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_TX_THRESH);
- DC_SETBIT(sc, DC_NETCFG, DC_TXTHRESH_MIN);
-
- /* Init circular RX list. */
- if (dc_list_rx_init(sc) == ENOBUFS) {
- printf("dc%d: initialization failed: no "
- "memory for rx buffers\n", sc->dc_unit);
- dc_stop(sc);
- DC_UNLOCK(sc);
- return;
- }
-
- /*
- * Init TX descriptors.
- */
- dc_list_tx_init(sc);
-
- /*
- * Load the address of the RX list.
- */
- CSR_WRITE_4(sc, DC_RXADDR, DC_RXDESC(sc, 0));
- CSR_WRITE_4(sc, DC_TXADDR, DC_TXDESC(sc, 0));
-
- /*
- * Enable interrupts.
- */
-#ifdef DEVICE_POLLING
- /*
- * ... but only if we are not polling, and make sure they are off in
- * the case of polling. Some cards (e.g. fxp) turn interrupts on
- * after a reset.
- */
- if (ifp->if_flags & IFF_POLLING)
- CSR_WRITE_4(sc, DC_IMR, 0x00000000);
- else
-#endif
- CSR_WRITE_4(sc, DC_IMR, DC_INTRS);
- CSR_WRITE_4(sc, DC_ISR, 0xFFFFFFFF);
-
- /* Enable transmitter. */
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON);
-
- /*
- * If this is an Intel 21143 and we're not using the
- * MII port, program the LED control pins so we get
- * link and activity indications.
- */
- if (sc->dc_flags & DC_TULIP_LEDS) {
- CSR_WRITE_4(sc, DC_WATCHDOG,
- DC_WDOG_CTLWREN | DC_WDOG_LINK | DC_WDOG_ACTIVITY);
- CSR_WRITE_4(sc, DC_WATCHDOG, 0);
- }
-
- /*
- * Load the RX/multicast filter. We do this sort of late
- * because the filter programming scheme on the 21143 and
- * some clones requires DMAing a setup frame via the TX
- * engine, and we need the transmitter enabled for that.
- */
- dc_setfilt(sc);
-
- /* Enable receiver. */
- DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
- CSR_WRITE_4(sc, DC_RXSTART, 0xFFFFFFFF);
-
- mii_mediachg(mii);
- dc_setcfg(sc, sc->dc_if_media);
-
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- /* Don't start the ticker if this is a homePNA link. */
- if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
- sc->dc_link = 1;
- else {
- if (sc->dc_flags & DC_21143_NWAY)
- callout_reset(&sc->dc_stat_ch, hz/10, dc_tick, sc);
- else
- callout_reset(&sc->dc_stat_ch, hz, dc_tick, sc);
- }
-
-#ifdef SRM_MEDIA
- if(sc->dc_srm_media) {
- struct ifreq ifr;
-
- ifr.ifr_media = sc->dc_srm_media;
- ifmedia_ioctl(ifp, &ifr, &mii->mii_media, SIOCSIFMEDIA);
- sc->dc_srm_media = 0;
- }
-#endif
- DC_UNLOCK(sc);
-}
-
-/*
- * Set media options.
- */
-static int
-dc_ifmedia_upd(struct ifnet *ifp)
-{
- struct dc_softc *sc;
- struct mii_data *mii;
- struct ifmedia *ifm;
-
- sc = ifp->if_softc;
- mii = device_get_softc(sc->dc_miibus);
- mii_mediachg(mii);
- ifm = &mii->mii_media;
-
- if (DC_IS_DAVICOM(sc) &&
- IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
- dc_setcfg(sc, ifm->ifm_media);
- else
- sc->dc_link = 0;
-
- return (0);
-}
-
-/*
- * Report current media status.
- */
-static void
-dc_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
-{
- struct dc_softc *sc;
- struct mii_data *mii;
- struct ifmedia *ifm;
-
- sc = ifp->if_softc;
- mii = device_get_softc(sc->dc_miibus);
- mii_pollstat(mii);
- ifm = &mii->mii_media;
- if (DC_IS_DAVICOM(sc)) {
- if (IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
- ifmr->ifm_active = ifm->ifm_media;
- ifmr->ifm_status = 0;
- return;
- }
- }
- ifmr->ifm_active = mii->mii_media_active;
- ifmr->ifm_status = mii->mii_media_status;
-}
-
-static int
-dc_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
-{
- struct dc_softc *sc = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *)data;
- struct mii_data *mii;
- int error = 0;
-
- DC_LOCK(sc);
-
- switch (command) {
- case SIOCSIFFLAGS:
- if (ifp->if_flags & IFF_UP) {
- int need_setfilt = (ifp->if_flags ^ sc->dc_if_flags) &
- (IFF_PROMISC | IFF_ALLMULTI);
-
- if (ifp->if_flags & IFF_RUNNING) {
- if (need_setfilt)
- dc_setfilt(sc);
- } else {
- sc->dc_txthresh = 0;
- dc_init(sc);
- }
- } else {
- if (ifp->if_flags & IFF_RUNNING)
- dc_stop(sc);
- }
- sc->dc_if_flags = ifp->if_flags;
- error = 0;
- break;
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- dc_setfilt(sc);
- error = 0;
- break;
- case SIOCGIFMEDIA:
- case SIOCSIFMEDIA:
- mii = device_get_softc(sc->dc_miibus);
- error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
-#ifdef SRM_MEDIA
- if (sc->dc_srm_media)
- sc->dc_srm_media = 0;
-#endif
- break;
- case SIOCSIFCAP:
- ifp->if_capenable &= ~IFCAP_POLLING;
- ifp->if_capenable |= ifr->ifr_reqcap & IFCAP_POLLING;
- break;
- default:
- error = ether_ioctl(ifp, command, data);
- break;
- }
-
- DC_UNLOCK(sc);
-
- return (error);
-}
-
-static void
-dc_watchdog(struct ifnet *ifp)
-{
- struct dc_softc *sc;
-
- sc = ifp->if_softc;
-
- DC_LOCK(sc);
-
- ifp->if_oerrors++;
- printf("dc%d: watchdog timeout\n", sc->dc_unit);
-
- dc_stop(sc);
- dc_reset(sc);
- dc_init(sc);
-
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- dc_start(ifp);
-
- DC_UNLOCK(sc);
-}
-
-/*
- * Stop the adapter and free any mbufs allocated to the
- * RX and TX lists.
- */
-static void
-dc_stop(struct dc_softc *sc)
-{
- struct ifnet *ifp;
- struct dc_list_data *ld;
- struct dc_chain_data *cd;
- int i;
- u_int32_t ctl;
-
- DC_LOCK(sc);
-
- ifp = sc->dc_ifp;
- ifp->if_timer = 0;
- ld = sc->dc_ldata;
- cd = &sc->dc_cdata;
-
- callout_stop(&sc->dc_stat_ch);
-
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
-#ifdef DEVICE_POLLING
- ether_poll_deregister(ifp);
-#endif
-
- DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_RX_ON | DC_NETCFG_TX_ON));
- CSR_WRITE_4(sc, DC_IMR, 0x00000000);
- CSR_WRITE_4(sc, DC_TXADDR, 0x00000000);
- CSR_WRITE_4(sc, DC_RXADDR, 0x00000000);
- sc->dc_link = 0;
-
- /*
- * Free data in the RX lists.
- */
- for (i = 0; i < DC_RX_LIST_CNT; i++) {
- if (cd->dc_rx_chain[i] != NULL) {
- m_freem(cd->dc_rx_chain[i]);
- cd->dc_rx_chain[i] = NULL;
- }
- }
- bzero(&ld->dc_rx_list, sizeof(ld->dc_rx_list));
-
- /*
- * Free the TX list buffers.
- */
- for (i = 0; i < DC_TX_LIST_CNT; i++) {
- if (cd->dc_tx_chain[i] != NULL) {
- ctl = le32toh(ld->dc_tx_list[i].dc_ctl);
- if ((ctl & DC_TXCTL_SETUP) ||
- !(ctl & DC_TXCTL_LASTFRAG)) {
- cd->dc_tx_chain[i] = NULL;
- continue;
- }
- bus_dmamap_unload(sc->dc_mtag, cd->dc_tx_map[i]);
- m_freem(cd->dc_tx_chain[i]);
- cd->dc_tx_chain[i] = NULL;
- }
- }
- bzero(&ld->dc_tx_list, sizeof(ld->dc_tx_list));
-
- DC_UNLOCK(sc);
-}
-
-/*
- * Device suspend routine. Stop the interface and save some PCI
- * settings in case the BIOS doesn't restore them properly on
- * resume.
- */
-static int
-dc_suspend(device_t dev)
-{
- struct dc_softc *sc;
- int s;
-
- s = splimp();
-
- sc = device_get_softc(dev);
- dc_stop(sc);
- sc->suspended = 1;
-
- splx(s);
- return (0);
-}
-
-/*
- * Device resume routine. Restore some PCI settings in case the BIOS
- * doesn't, re-enable busmastering, and restart the interface if
- * appropriate.
- */
-static int
-dc_resume(device_t dev)
-{
- struct dc_softc *sc;
- struct ifnet *ifp;
- int s;
-
- s = splimp();
-
- sc = device_get_softc(dev);
- ifp = sc->dc_ifp;
-
- /* reinitialize interface if necessary */
- if (ifp->if_flags & IFF_UP)
- dc_init(sc);
-
- sc->suspended = 0;
-
- splx(s);
- return (0);
-}
-
-/*
- * Stop all chip I/O so that the kernel's probe routines don't
- * get confused by errant DMAs when rebooting.
- */
-static void
-dc_shutdown(device_t dev)
-{
- struct dc_softc *sc;
-
- sc = device_get_softc(dev);
-
- dc_stop(sc);
-}
diff --git a/sys/dev/dc/if_dcreg.h b/sys/dev/dc/if_dcreg.h
deleted file mode 100644
index a851a72..0000000
--- a/sys/dev/dc/if_dcreg.h
+++ /dev/null
@@ -1,1226 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998, 1999
- * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * 21143 and clone common register definitions.
- */
-
-#define DC_BUSCTL 0x00 /* bus control */
-#define DC_TXSTART 0x08 /* tx start demand */
-#define DC_RXSTART 0x10 /* rx start demand */
-#define DC_RXADDR 0x18 /* rx descriptor list start addr */
-#define DC_TXADDR 0x20 /* tx descriptor list start addr */
-#define DC_ISR 0x28 /* interrupt status register */
-#define DC_NETCFG 0x30 /* network config register */
-#define DC_IMR 0x38 /* interrupt mask */
-#define DC_FRAMESDISCARDED 0x40 /* # of discarded frames */
-#define DC_SIO 0x48 /* MII and ROM/EEPROM access */
-#define DC_ROM 0x50 /* ROM programming address */
-#define DC_TIMER 0x58 /* general timer */
-#define DC_10BTSTAT 0x60 /* SIA status */
-#define DC_SIARESET 0x68 /* SIA connectivity */
-#define DC_10BTCTRL 0x70 /* SIA transmit and receive */
-#define DC_WATCHDOG 0x78 /* SIA and general purpose port */
-#define DC_SIAGP 0x78 /* SIA and general purpose port (X3201) */
-
-/*
- * There are two general 'types' of MX chips that we need to be
- * concerned with. One is the original 98713, which has its internal
- * NWAY support controlled via the MDIO bits in the serial I/O
- * register. The other is everything else (from the 98713A on up),
- * which has its internal NWAY controlled via CSR13, CSR14 and CSR15,
- * just like the 21143. This type setting also governs which of the
- * 'magic' numbers we write to CSR16. The PNIC II falls into the
- * 98713A/98715/98715A/98725 category.
- */
-#define DC_TYPE_98713 0x1
-#define DC_TYPE_98713A 0x2
-#define DC_TYPE_987x5 0x3
-
-/* Other type of supported chips. */
-#define DC_TYPE_21143 0x4 /* Intel 21143 */
-#define DC_TYPE_ASIX 0x5 /* ASIX AX88140A/AX88141 */
-#define DC_TYPE_AL981 0x6 /* ADMtek AL981 Comet */
-#define DC_TYPE_AN985 0x7 /* ADMtek AN985 Centaur */
-#define DC_TYPE_DM9102 0x8 /* Davicom DM9102 */
-#define DC_TYPE_PNICII 0x9 /* 82c115 PNIC II */
-#define DC_TYPE_PNIC 0xA /* 82c168/82c169 PNIC I */
-#define DC_TYPE_XIRCOM 0xB /* Xircom X3201 */
-#define DC_TYPE_CONEXANT 0xC /* Conexant LANfinity RS7112 */
-
-#define DC_IS_MACRONIX(x) \
- (x->dc_type == DC_TYPE_98713 || \
- x->dc_type == DC_TYPE_98713A || \
- x->dc_type == DC_TYPE_987x5)
-
-#define DC_IS_ADMTEK(x) \
- (x->dc_type == DC_TYPE_AL981 || \
- x->dc_type == DC_TYPE_AN985)
-
-#define DC_IS_INTEL(x) (x->dc_type == DC_TYPE_21143)
-#define DC_IS_ASIX(x) (x->dc_type == DC_TYPE_ASIX)
-#define DC_IS_COMET(x) (x->dc_type == DC_TYPE_AL981)
-#define DC_IS_CENTAUR(x) (x->dc_type == DC_TYPE_AN985)
-#define DC_IS_DAVICOM(x) (x->dc_type == DC_TYPE_DM9102)
-#define DC_IS_PNICII(x) (x->dc_type == DC_TYPE_PNICII)
-#define DC_IS_PNIC(x) (x->dc_type == DC_TYPE_PNIC)
-#define DC_IS_XIRCOM(x) (x->dc_type == DC_TYPE_XIRCOM)
-#define DC_IS_CONEXANT(x) (x->dc_type == DC_TYPE_CONEXANT)
-
-/* MII/symbol mode port types */
-#define DC_PMODE_MII 0x1
-#define DC_PMODE_SYM 0x2
-#define DC_PMODE_SIA 0x3
-
-/*
- * Bus control bits.
- */
-#define DC_BUSCTL_RESET 0x00000001
-#define DC_BUSCTL_ARBITRATION 0x00000002
-#define DC_BUSCTL_SKIPLEN 0x0000007C
-#define DC_BUSCTL_BUF_BIGENDIAN 0x00000080
-#define DC_BUSCTL_BURSTLEN 0x00003F00
-#define DC_BUSCTL_CACHEALIGN 0x0000C000
-#define DC_BUSCTL_TXPOLL 0x000E0000
-#define DC_BUSCTL_DBO 0x00100000
-#define DC_BUSCTL_MRME 0x00200000
-#define DC_BUSCTL_MRLE 0x00800000
-#define DC_BUSCTL_MWIE 0x01000000
-#define DC_BUSCTL_ONNOW_ENB 0x04000000
-
-#define DC_SKIPLEN_1LONG 0x00000004
-#define DC_SKIPLEN_2LONG 0x00000008
-#define DC_SKIPLEN_3LONG 0x00000010
-#define DC_SKIPLEN_4LONG 0x00000020
-#define DC_SKIPLEN_5LONG 0x00000040
-
-#define DC_CACHEALIGN_NONE 0x00000000
-#define DC_CACHEALIGN_8LONG 0x00004000
-#define DC_CACHEALIGN_16LONG 0x00008000
-#define DC_CACHEALIGN_32LONG 0x0000C000
-
-#define DC_BURSTLEN_USECA 0x00000000
-#define DC_BURSTLEN_1LONG 0x00000100
-#define DC_BURSTLEN_2LONG 0x00000200
-#define DC_BURSTLEN_4LONG 0x00000400
-#define DC_BURSTLEN_8LONG 0x00000800
-#define DC_BURSTLEN_16LONG 0x00001000
-#define DC_BURSTLEN_32LONG 0x00002000
-
-#define DC_TXPOLL_OFF 0x00000000
-#define DC_TXPOLL_1 0x00020000
-#define DC_TXPOLL_2 0x00040000
-#define DC_TXPOLL_3 0x00060000
-#define DC_TXPOLL_4 0x00080000
-#define DC_TXPOLL_5 0x000A0000
-#define DC_TXPOLL_6 0x000C0000
-#define DC_TXPOLL_7 0x000E0000
-
-/*
- * Interrupt status bits.
- */
-#define DC_ISR_TX_OK 0x00000001
-#define DC_ISR_TX_IDLE 0x00000002
-#define DC_ISR_TX_NOBUF 0x00000004
-#define DC_ISR_TX_JABBERTIMEO 0x00000008
-#define DC_ISR_LINKGOOD 0x00000010
-#define DC_ISR_TX_UNDERRUN 0x00000020
-#define DC_ISR_RX_OK 0x00000040
-#define DC_ISR_RX_NOBUF 0x00000080
-#define DC_ISR_RX_READ 0x00000100
-#define DC_ISR_RX_WATDOGTIMEO 0x00000200
-#define DC_ISR_TX_EARLY 0x00000400
-#define DC_ISR_TIMER_EXPIRED 0x00000800
-#define DC_ISR_LINKFAIL 0x00001000
-#define DC_ISR_BUS_ERR 0x00002000
-#define DC_ISR_RX_EARLY 0x00004000
-#define DC_ISR_ABNORMAL 0x00008000
-#define DC_ISR_NORMAL 0x00010000
-#define DC_ISR_RX_STATE 0x000E0000
-#define DC_ISR_TX_STATE 0x00700000
-#define DC_ISR_BUSERRTYPE 0x03800000
-#define DC_ISR_100MBPSLINK 0x08000000
-#define DC_ISR_MAGICKPACK 0x10000000
-
-#define DC_RXSTATE_STOPPED 0x00000000 /* 000 - Stopped */
-#define DC_RXSTATE_FETCH 0x00020000 /* 001 - Fetching descriptor */
-#define DC_RXSTATE_ENDCHECK 0x00040000 /* 010 - check for rx end */
-#define DC_RXSTATE_WAIT 0x00060000 /* 011 - waiting for packet */
-#define DC_RXSTATE_SUSPEND 0x00080000 /* 100 - suspend rx */
-#define DC_RXSTATE_CLOSE 0x000A0000 /* 101 - close tx desc */
-#define DC_RXSTATE_FLUSH 0x000C0000 /* 110 - flush from FIFO */
-#define DC_RXSTATE_DEQUEUE 0x000E0000 /* 111 - dequeue from FIFO */
-
-#define DC_TXSTATE_RESET 0x00000000 /* 000 - reset */
-#define DC_TXSTATE_FETCH 0x00100000 /* 001 - fetching descriptor */
-#define DC_TXSTATE_WAITEND 0x00200000 /* 010 - wait for tx end */
-#define DC_TXSTATE_READING 0x00300000 /* 011 - read and enqueue */
-#define DC_TXSTATE_RSVD 0x00400000 /* 100 - reserved */
-#define DC_TXSTATE_SETUP 0x00500000 /* 101 - setup packet */
-#define DC_TXSTATE_SUSPEND 0x00600000 /* 110 - suspend tx */
-#define DC_TXSTATE_CLOSE 0x00700000 /* 111 - close tx desc */
-
-/*
- * Network config bits.
- */
-#define DC_NETCFG_RX_HASHPERF 0x00000001
-#define DC_NETCFG_RX_ON 0x00000002
-#define DC_NETCFG_RX_HASHONLY 0x00000004
-#define DC_NETCFG_RX_BADFRAMES 0x00000008
-#define DC_NETCFG_RX_INVFILT 0x00000010
-#define DC_NETCFG_BACKOFFCNT 0x00000020
-#define DC_NETCFG_RX_PROMISC 0x00000040
-#define DC_NETCFG_RX_ALLMULTI 0x00000080
-#define DC_NETCFG_FULLDUPLEX 0x00000200
-#define DC_NETCFG_LOOPBACK 0x00000C00
-#define DC_NETCFG_FORCECOLL 0x00001000
-#define DC_NETCFG_TX_ON 0x00002000
-#define DC_NETCFG_TX_THRESH 0x0000C000
-#define DC_NETCFG_TX_BACKOFF 0x00020000
-#define DC_NETCFG_PORTSEL 0x00040000 /* 0 == 10, 1 == 100 */
-#define DC_NETCFG_HEARTBEAT 0x00080000
-#define DC_NETCFG_STORENFWD 0x00200000
-#define DC_NETCFG_SPEEDSEL 0x00400000 /* 1 == 10, 0 == 100 */
-#define DC_NETCFG_PCS 0x00800000
-#define DC_NETCFG_SCRAMBLER 0x01000000
-#define DC_NETCFG_NO_RXCRC 0x02000000
-#define DC_NETCFG_RX_ALL 0x40000000
-#define DC_NETCFG_CAPEFFECT 0x80000000
-
-#define DC_OPMODE_NORM 0x00000000
-#define DC_OPMODE_INTLOOP 0x00000400
-#define DC_OPMODE_EXTLOOP 0x00000800
-
-#if 0
-#define DC_TXTHRESH_72BYTES 0x00000000
-#define DC_TXTHRESH_96BYTES 0x00004000
-#define DC_TXTHRESH_128BYTES 0x00008000
-#define DC_TXTHRESH_160BYTES 0x0000C000
-#endif
-
-#define DC_TXTHRESH_MIN 0x00000000
-#define DC_TXTHRESH_INC 0x00004000
-#define DC_TXTHRESH_MAX 0x0000C000
-
-
-/*
- * Interrupt mask bits.
- */
-#define DC_IMR_TX_OK 0x00000001
-#define DC_IMR_TX_IDLE 0x00000002
-#define DC_IMR_TX_NOBUF 0x00000004
-#define DC_IMR_TX_JABBERTIMEO 0x00000008
-#define DC_IMR_LINKGOOD 0x00000010
-#define DC_IMR_TX_UNDERRUN 0x00000020
-#define DC_IMR_RX_OK 0x00000040
-#define DC_IMR_RX_NOBUF 0x00000080
-#define DC_IMR_RX_READ 0x00000100
-#define DC_IMR_RX_WATDOGTIMEO 0x00000200
-#define DC_IMR_TX_EARLY 0x00000400
-#define DC_IMR_TIMER_EXPIRED 0x00000800
-#define DC_IMR_LINKFAIL 0x00001000
-#define DC_IMR_BUS_ERR 0x00002000
-#define DC_IMR_RX_EARLY 0x00004000
-#define DC_IMR_ABNORMAL 0x00008000
-#define DC_IMR_NORMAL 0x00010000
-#define DC_IMR_100MBPSLINK 0x08000000
-#define DC_IMR_MAGICKPACK 0x10000000
-
-#define DC_INTRS \
- (DC_IMR_RX_OK|DC_IMR_TX_OK|DC_IMR_RX_NOBUF|DC_IMR_RX_WATDOGTIMEO|\
- DC_IMR_TX_NOBUF|DC_IMR_TX_UNDERRUN|DC_IMR_BUS_ERR| \
- DC_IMR_ABNORMAL|DC_IMR_NORMAL/*|DC_IMR_TX_EARLY*/)
-/*
- * Serial I/O (EEPROM/ROM) bits.
- */
-#define DC_SIO_EE_CS 0x00000001 /* EEPROM chip select */
-#define DC_SIO_EE_CLK 0x00000002 /* EEPROM clock */
-#define DC_SIO_EE_DATAIN 0x00000004 /* EEPROM data output */
-#define DC_SIO_EE_DATAOUT 0x00000008 /* EEPROM data input */
-#define DC_SIO_ROMDATA4 0x00000010
-#define DC_SIO_ROMDATA5 0x00000020
-#define DC_SIO_ROMDATA6 0x00000040
-#define DC_SIO_ROMDATA7 0x00000080
-#define DC_SIO_EESEL 0x00000800
-#define DC_SIO_ROMSEL 0x00001000
-#define DC_SIO_ROMCTL_WRITE 0x00002000
-#define DC_SIO_ROMCTL_READ 0x00004000
-#define DC_SIO_MII_CLK 0x00010000 /* MDIO clock */
-#define DC_SIO_MII_DATAOUT 0x00020000 /* MDIO data out */
-#define DC_SIO_MII_DIR 0x00040000 /* MDIO dir */
-#define DC_SIO_MII_DATAIN 0x00080000 /* MDIO data in */
-
-#define DC_EECMD_WRITE 0x140
-#define DC_EECMD_READ 0x180
-#define DC_EECMD_ERASE 0x1c0
-
-#define DC_EE_NODEADDR_OFFSET 0x70
-#define DC_EE_NODEADDR 10
-
-/*
- * General purpose timer register
- */
-#define DC_TIMER_VALUE 0x0000FFFF
-#define DC_TIMER_CONTINUOUS 0x00010000
-
-/*
- * 10baseT status register
- */
-#define DC_TSTAT_MIIACT 0x00000001 /* MII port activity */
-#define DC_TSTAT_LS100 0x00000002 /* link status of 100baseTX */
-#define DC_TSTAT_LS10 0x00000004 /* link status of 10baseT */
-#define DC_TSTAT_AUTOPOLARITY 0x00000008
-#define DC_TSTAT_AUIACT 0x00000100 /* AUI activity */
-#define DC_TSTAT_10BTACT 0x00000200 /* 10baseT activity */
-#define DC_TSTAT_NSN 0x00000400 /* non-stable FLPs detected */
-#define DC_TSTAT_REMFAULT 0x00000800
-#define DC_TSTAT_ANEGSTAT 0x00007000
-#define DC_TSTAT_LP_CAN_NWAY 0x00008000 /* link partner supports NWAY */
-#define DC_TSTAT_LPCODEWORD 0xFFFF0000 /* link partner's code word */
-
-#define DC_ASTAT_DISABLE 0x00000000
-#define DC_ASTAT_TXDISABLE 0x00001000
-#define DC_ASTAT_ABDETECT 0x00002000
-#define DC_ASTAT_ACKDETECT 0x00003000
-#define DC_ASTAT_CMPACKDETECT 0x00004000
-#define DC_ASTAT_AUTONEGCMP 0x00005000
-#define DC_ASTAT_LINKCHECK 0x00006000
-
-/*
- * PHY reset register
- */
-#define DC_SIA_RESET 0x00000001
-#define DC_SIA_AUI 0x00000008 /* AUI or 10baseT */
-
-/*
- * 10baseT control register
- */
-#define DC_TCTL_ENCODER_ENB 0x00000001
-#define DC_TCTL_LOOPBACK 0x00000002
-#define DC_TCTL_DRIVER_ENB 0x00000004
-#define DC_TCTL_LNKPULSE_ENB 0x00000008
-#define DC_TCTL_HALFDUPLEX 0x00000040
-#define DC_TCTL_AUTONEGENBL 0x00000080
-#define DC_TCTL_RX_SQUELCH 0x00000100
-#define DC_TCTL_COLL_SQUELCH 0x00000200
-#define DC_TCTL_COLL_DETECT 0x00000400
-#define DC_TCTL_SQE_ENB 0x00000800
-#define DC_TCTL_LINKTEST 0x00001000
-#define DC_TCTL_AUTOPOLARITY 0x00002000
-#define DC_TCTL_SET_POL_PLUS 0x00004000
-#define DC_TCTL_AUTOSENSE 0x00008000 /* 10bt/AUI autosense */
-#define DC_TCTL_100BTXHALF 0x00010000
-#define DC_TCTL_100BTXFULL 0x00020000
-#define DC_TCTL_100BT4 0x00040000
-
-/*
- * Watchdog timer register
- */
-#define DC_WDOG_JABBERDIS 0x00000001
-#define DC_WDOG_HOSTUNJAB 0x00000002
-#define DC_WDOG_JABBERCLK 0x00000004
-#define DC_WDOG_RXWDOGDIS 0x00000010
-#define DC_WDOG_RXWDOGCLK 0x00000020
-#define DC_WDOG_MUSTBEZERO 0x00000100
-#define DC_WDOG_AUIBNC 0x00100000
-#define DC_WDOG_ACTIVITY 0x00200000
-#define DC_WDOG_RX_MATCH 0x00400000
-#define DC_WDOG_LINK 0x00800000
-#define DC_WDOG_CTLWREN 0x08000000
-
-/*
- * SIA and General Purpose Port register (X3201)
- */
-#define DC_SIAGP_RXMATCH 0x40000000
-#define DC_SIAGP_INT1 0x20000000
-#define DC_SIAGP_INT0 0x10000000
-#define DC_SIAGP_WRITE_EN 0x08000000
-#define DC_SIAGP_RXMATCH_EN 0x04000000
-#define DC_SIAGP_INT1_EN 0x02000000
-#define DC_SIAGP_INT0_EN 0x01000000
-#define DC_SIAGP_LED3 0x00800000
-#define DC_SIAGP_LED2 0x00400000
-#define DC_SIAGP_LED1 0x00200000
-#define DC_SIAGP_LED0 0x00100000
-#define DC_SIAGP_MD_GP3_OUTPUT 0x00080000
-#define DC_SIAGP_MD_GP2_OUTPUT 0x00040000
-#define DC_SIAGP_MD_GP1_OUTPUT 0x00020000
-#define DC_SIAGP_MD_GP0_OUTPUT 0x00010000
-
-/*
- * Size of a setup frame.
- */
-#define DC_SFRAME_LEN 192
-
-/*
- * 21x4x TX/RX list structure.
- */
-
-struct dc_desc {
- u_int32_t dc_status;
- u_int32_t dc_ctl;
- u_int32_t dc_ptr1;
- u_int32_t dc_ptr2;
-};
-
-#define dc_data dc_ptr1
-#define dc_next dc_ptr2
-
-#define DC_RXSTAT_FIFOOFLOW 0x00000001
-#define DC_RXSTAT_CRCERR 0x00000002
-#define DC_RXSTAT_DRIBBLE 0x00000004
-#define DC_RXSTAT_MIIERE 0x00000008
-#define DC_RXSTAT_WATCHDOG 0x00000010
-#define DC_RXSTAT_FRAMETYPE 0x00000020 /* 0 == IEEE 802.3 */
-#define DC_RXSTAT_COLLSEEN 0x00000040
-#define DC_RXSTAT_GIANT 0x00000080
-#define DC_RXSTAT_LASTFRAG 0x00000100
-#define DC_RXSTAT_FIRSTFRAG 0x00000200
-#define DC_RXSTAT_MULTICAST 0x00000400
-#define DC_RXSTAT_RUNT 0x00000800
-#define DC_RXSTAT_RXTYPE 0x00003000
-#define DC_RXSTAT_DE 0x00004000
-#define DC_RXSTAT_RXERR 0x00008000
-#define DC_RXSTAT_RXLEN 0x3FFF0000
-#define DC_RXSTAT_OWN 0x80000000
-
-#define DC_RXBYTES(x) ((x & DC_RXSTAT_RXLEN) >> 16)
-#define DC_RXSTAT (DC_RXSTAT_FIRSTFRAG|DC_RXSTAT_LASTFRAG|DC_RXSTAT_OWN)
-
-#define DC_RXCTL_BUFLEN1 0x00000FFF
-#define DC_RXCTL_BUFLEN2 0x00FFF000
-#define DC_RXCTL_RLINK 0x01000000
-#define DC_RXCTL_RLAST 0x02000000
-
-#define DC_TXSTAT_DEFER 0x00000001
-#define DC_TXSTAT_UNDERRUN 0x00000002
-#define DC_TXSTAT_LINKFAIL 0x00000003
-#define DC_TXSTAT_COLLCNT 0x00000078
-#define DC_TXSTAT_SQE 0x00000080
-#define DC_TXSTAT_EXCESSCOLL 0x00000100
-#define DC_TXSTAT_LATECOLL 0x00000200
-#define DC_TXSTAT_NOCARRIER 0x00000400
-#define DC_TXSTAT_CARRLOST 0x00000800
-#define DC_TXSTAT_JABTIMEO 0x00004000
-#define DC_TXSTAT_ERRSUM 0x00008000
-#define DC_TXSTAT_OWN 0x80000000
-
-#define DC_TXCTL_BUFLEN1 0x000007FF
-#define DC_TXCTL_BUFLEN2 0x003FF800
-#define DC_TXCTL_FILTTYPE0 0x00400000
-#define DC_TXCTL_PAD 0x00800000
-#define DC_TXCTL_TLINK 0x01000000
-#define DC_TXCTL_TLAST 0x02000000
-#define DC_TXCTL_NOCRC 0x04000000
-#define DC_TXCTL_SETUP 0x08000000
-#define DC_TXCTL_FILTTYPE1 0x10000000
-#define DC_TXCTL_FIRSTFRAG 0x20000000
-#define DC_TXCTL_LASTFRAG 0x40000000
-#define DC_TXCTL_FINT 0x80000000
-
-#define DC_FILTER_PERFECT 0x00000000
-#define DC_FILTER_HASHPERF 0x00400000
-#define DC_FILTER_INVERSE 0x10000000
-#define DC_FILTER_HASHONLY 0x10400000
-
-#define DC_MAXFRAGS 16
-#ifdef DEVICE_POLLING
-#define DC_RX_LIST_CNT 192
-#else
-#define DC_RX_LIST_CNT 64
-#endif
-#define DC_TX_LIST_CNT 256
-#define DC_MIN_FRAMELEN 60
-#define DC_RXLEN 1536
-
-#define DC_INC(x, y) (x) = (x + 1) % y
-
-/* Macros to easily get the DMA address of a descriptor. */
-#define DC_RXDESC(sc, i) (sc->dc_laddr + \
- (uintptr_t)(sc->dc_ldata->dc_rx_list + i) - (uintptr_t)sc->dc_ldata)
-#define DC_TXDESC(sc, i) (sc->dc_laddr + \
- (uintptr_t)(sc->dc_ldata->dc_tx_list + i) - (uintptr_t)sc->dc_ldata)
-
-#if BYTE_ORDER == BIG_ENDIAN
-#define DC_SP_MAC(x) ((x) << 16)
-#else
-#define DC_SP_MAC(x) (x)
-#endif
-
-struct dc_list_data {
- struct dc_desc dc_rx_list[DC_RX_LIST_CNT];
- struct dc_desc dc_tx_list[DC_TX_LIST_CNT];
-};
-
-struct dc_chain_data {
- struct mbuf *dc_rx_chain[DC_RX_LIST_CNT];
- struct mbuf *dc_tx_chain[DC_TX_LIST_CNT];
- struct mbuf *dc_tx_mapping;
- bus_dmamap_t dc_rx_map[DC_RX_LIST_CNT];
- bus_dmamap_t dc_tx_map[DC_TX_LIST_CNT];
- u_int32_t *dc_sbuf;
- u_int8_t dc_pad[DC_MIN_FRAMELEN];
- int dc_tx_err;
- int dc_tx_first;
- int dc_tx_prod;
- int dc_tx_cons;
- int dc_tx_cnt;
- int dc_rx_err;
- int dc_rx_cur;
- int dc_rx_prod;
-};
-
-struct dc_mediainfo {
- int dc_media;
- u_int8_t *dc_gp_ptr;
- u_int8_t dc_gp_len;
- u_int8_t *dc_reset_ptr;
- u_int8_t dc_reset_len;
- struct dc_mediainfo *dc_next;
-};
-
-
-struct dc_type {
- u_int16_t dc_vid;
- u_int16_t dc_did;
- char *dc_name;
-};
-
-struct dc_mii_frame {
- u_int8_t mii_stdelim;
- u_int8_t mii_opcode;
- u_int8_t mii_phyaddr;
- u_int8_t mii_regaddr;
- u_int8_t mii_turnaround;
- u_int16_t mii_data;
-};
-
-/*
- * MII constants
- */
-#define DC_MII_STARTDELIM 0x01
-#define DC_MII_READOP 0x02
-#define DC_MII_WRITEOP 0x01
-#define DC_MII_TURNAROUND 0x02
-
-
-/*
- * Registers specific to clone devices.
- * This mainly relates to RX filter programming: not all 21x4x clones
- * use the standard DEC filter programming mechanism.
- */
-
-/*
- * ADMtek specific registers and constants for the AL981 and AN985.
- * The AN985 doesn't use the magic PHY registers.
- */
-#define DC_AL_CR 0x88 /* command register */
-#define DC_AL_PAR0 0xA4 /* station address */
-#define DC_AL_PAR1 0xA8 /* station address */
-#define DC_AL_MAR0 0xAC /* multicast hash filter */
-#define DC_AL_MAR1 0xB0 /* multicast hash filter */
-#define DC_AL_BMCR 0xB4 /* built in PHY control */
-#define DC_AL_BMSR 0xB8 /* built in PHY status */
-#define DC_AL_VENID 0xBC /* built in PHY ID0 */
-#define DC_AL_DEVID 0xC0 /* built in PHY ID1 */
-#define DC_AL_ANAR 0xC4 /* built in PHY autoneg advert */
-#define DC_AL_LPAR 0xC8 /* bnilt in PHY link part. ability */
-#define DC_AL_ANER 0xCC /* built in PHY autoneg expansion */
-
-#define DC_AL_CR_ATUR 0x00000001 /* automatic TX underrun recovery */
-#define DC_ADMTEK_PHYADDR 0x1
-#define DC_AL_EE_NODEADDR 4
-/* End of ADMtek specific registers */
-
-/*
- * ASIX specific registers.
- */
-#define DC_AX_FILTIDX 0x68 /* RX filter index */
-#define DC_AX_FILTDATA 0x70 /* RX filter data */
-
-/*
- * Special ASIX-specific bits in the ASIX NETCFG register (CSR6).
- */
-#define DC_AX_NETCFG_RX_BROAD 0x00000100
-
-/*
- * RX Filter Index Register values
- */
-#define DC_AX_FILTIDX_PAR0 0x00000000
-#define DC_AX_FILTIDX_PAR1 0x00000001
-#define DC_AX_FILTIDX_MAR0 0x00000002
-#define DC_AX_FILTIDX_MAR1 0x00000003
-/* End of ASIX specific registers */
-
-/*
- * Macronix specific registers. The Macronix chips have a special
- * register for reading the NWAY status, which we don't use, plus
- * a magic packet register, which we need to tweak a bit per the
- * Macronix application notes.
- */
-#define DC_MX_MAGICPACKET 0x80
-#define DC_MX_NWAYSTAT 0xA0
-
-/*
- * Magic packet register
- */
-#define DC_MX_MPACK_DISABLE 0x00400000
-
-/*
- * NWAY status register.
- */
-#define DC_MX_NWAY_10BTHALF 0x08000000
-#define DC_MX_NWAY_10BTFULL 0x10000000
-#define DC_MX_NWAY_100BTHALF 0x20000000
-#define DC_MX_NWAY_100BTFULL 0x40000000
-#define DC_MX_NWAY_100BT4 0x80000000
-
-/*
- * These are magic values that must be written into CSR16
- * (DC_MX_MAGICPACKET) in order to put the chip into proper
- * operating mode. The magic numbers are documented in the
- * Macronix 98715 application notes.
- */
-#define DC_MX_MAGIC_98713 0x0F370000
-#define DC_MX_MAGIC_98713A 0x0B3C0000
-#define DC_MX_MAGIC_98715 0x0B3C0000
-#define DC_MX_MAGIC_98725 0x0B3C0000
-/* End of Macronix specific registers */
-
-/*
- * PNIC 82c168/82c169 specific registers.
- * The PNIC has its own special NWAY support, which doesn't work,
- * and shortcut ways of reading the EEPROM and MII bus.
- */
-#define DC_PN_GPIO 0x60 /* general purpose pins control */
-#define DC_PN_PWRUP_CFG 0x90 /* config register, set by EEPROM */
-#define DC_PN_SIOCTL 0x98 /* serial EEPROM control register */
-#define DC_PN_MII 0xA0 /* MII access register */
-#define DC_PN_NWAY 0xB8 /* Internal NWAY register */
-
-/* Serial I/O EEPROM register */
-#define DC_PN_SIOCTL_DATA 0x0000003F
-#define DC_PN_SIOCTL_OPCODE 0x00000300
-#define DC_PN_SIOCTL_BUSY 0x80000000
-
-#define DC_PN_EEOPCODE_ERASE 0x00000300
-#define DC_PN_EEOPCODE_READ 0x00000600
-#define DC_PN_EEOPCODE_WRITE 0x00000100
-
-/*
- * The first two general purpose pins control speed selection and
- * 100Mbps loopback on the 82c168 chip. The control bits should always
- * be set (to make the data pins outputs) and the speed selction and
- * loopback bits set accordingly when changing media. Physically, this
- * will set the state of a relay mounted on the card.
- */
-#define DC_PN_GPIO_DATA0 0x000000001
-#define DC_PN_GPIO_DATA1 0x000000002
-#define DC_PN_GPIO_DATA2 0x000000004
-#define DC_PN_GPIO_DATA3 0x000000008
-#define DC_PN_GPIO_CTL0 0x000000010
-#define DC_PN_GPIO_CTL1 0x000000020
-#define DC_PN_GPIO_CTL2 0x000000040
-#define DC_PN_GPIO_CTL3 0x000000080
-#define DC_PN_GPIO_SPEEDSEL DC_PN_GPIO_DATA0/* 1 == 100Mbps, 0 == 10Mbps */
-#define DC_PN_GPIO_100TX_LOOP DC_PN_GPIO_DATA1/* 1 == normal, 0 == loop */
-#define DC_PN_GPIO_BNC_ENB DC_PN_GPIO_DATA2
-#define DC_PN_GPIO_100TX_LNK DC_PN_GPIO_DATA3
-#define DC_PN_GPIO_SETBIT(sc, r) \
- DC_SETBIT(sc, DC_PN_GPIO, ((r) | (r << 4)))
-#define DC_PN_GPIO_CLRBIT(sc, r) \
- { \
- DC_SETBIT(sc, DC_PN_GPIO, ((r) << 4)); \
- DC_CLRBIT(sc, DC_PN_GPIO, (r)); \
- }
-
-/* shortcut MII access register */
-#define DC_PN_MII_DATA 0x0000FFFF
-#define DC_PN_MII_RESERVER 0x00020000
-#define DC_PN_MII_REGADDR 0x007C0000
-#define DC_PN_MII_PHYADDR 0x0F800000
-#define DC_PN_MII_OPCODE 0x30000000
-#define DC_PN_MII_BUSY 0x80000000
-
-#define DC_PN_MIIOPCODE_READ 0x60020000
-#define DC_PN_MIIOPCODE_WRITE 0x50020000
-
-/* Internal NWAY bits */
-#define DC_PN_NWAY_RESET 0x00000001 /* reset */
-#define DC_PN_NWAY_PDOWN 0x00000002 /* power down */
-#define DC_PN_NWAY_BYPASS 0x00000004 /* bypass */
-#define DC_PN_NWAY_AUILOWCUR 0x00000008 /* AUI low current */
-#define DC_PN_NWAY_TPEXTEND 0x00000010 /* low squelch voltage */
-#define DC_PN_NWAY_POLARITY 0x00000020 /* 0 == on, 1 == off */
-#define DC_PN_NWAY_TP 0x00000040 /* 1 == tp, 0 == AUI */
-#define DC_PN_NWAY_AUIVOLT 0x00000080 /* 1 == full, 0 == half */
-#define DC_PN_NWAY_DUPLEX 0x00000100 /* LED, 1 == full, 0 == half */
-#define DC_PN_NWAY_LINKTEST 0x00000200 /* 0 == on, 1 == off */
-#define DC_PN_NWAY_AUTODETECT 0x00000400 /* 1 == off, 0 == on */
-#define DC_PN_NWAY_SPEEDSEL 0x00000800 /* LED, 0 = 10, 1 == 100 */
-#define DC_PN_NWAY_NWAY_ENB 0x00001000 /* 0 == off, 1 == on */
-#define DC_PN_NWAY_CAP10HDX 0x00002000
-#define DC_PN_NWAY_CAP10FDX 0x00004000
-#define DC_PN_NWAY_CAP100FDX 0x00008000
-#define DC_PN_NWAY_CAP100HDX 0x00010000
-#define DC_PN_NWAY_CAP100T4 0x00020000
-#define DC_PN_NWAY_ANEGRESTART 0x02000000 /* resets when aneg done */
-#define DC_PN_NWAY_REMFAULT 0x04000000
-#define DC_PN_NWAY_LPAR10HDX 0x08000000
-#define DC_PN_NWAY_LPAR10FDX 0x10000000
-#define DC_PN_NWAY_LPAR100FDX 0x20000000
-#define DC_PN_NWAY_LPAR100HDX 0x40000000
-#define DC_PN_NWAY_LPAR100T4 0x80000000
-
-/* End of PNIC specific registers */
-
-/*
- * CONEXANT specific registers.
- */
-
-#define DC_CONEXANT_PHYADDR 0x1
-#define DC_CONEXANT_EE_NODEADDR 0x19A
-
-/* End of CONEXANT specific registers */
-
-
-struct dc_softc {
- struct ifnet *dc_ifp; /* interface info */
- bus_space_handle_t dc_bhandle; /* bus space handle */
- bus_space_tag_t dc_btag; /* bus space tag */
- bus_dma_tag_t dc_ltag; /* tag for descriptor ring */
- bus_dmamap_t dc_lmap; /* map for descriptor ring */
- u_int32_t dc_laddr; /* DMA address of dc_ldata */
- bus_dma_tag_t dc_mtag; /* tag for mbufs */
- bus_dmamap_t dc_sparemap;
- bus_dma_tag_t dc_stag; /* tag for the setup frame */
- bus_dmamap_t dc_smap; /* map for the setup frame */
- u_int32_t dc_saddr; /* DMA address of setup frame */
- void *dc_intrhand;
- struct resource *dc_irq;
- struct resource *dc_res;
- struct dc_type *dc_info; /* adapter info */
- device_t dc_miibus;
- u_int8_t dc_unit; /* interface number */
- u_int8_t dc_type;
- u_int8_t dc_pmode;
- u_int8_t dc_link;
- u_int8_t dc_cachesize;
- int dc_romwidth;
- int dc_pnic_rx_bug_save;
- unsigned char *dc_pnic_rx_buf;
- int dc_if_flags;
- int dc_if_media;
- u_int32_t dc_flags;
- u_int32_t dc_txthresh;
- u_int8_t *dc_srom;
- struct dc_mediainfo *dc_mi;
- struct dc_list_data *dc_ldata;
- struct dc_chain_data dc_cdata;
- struct callout dc_stat_ch;
-#ifdef SRM_MEDIA
- int dc_srm_media;
-#endif
- struct mtx dc_mtx;
-#ifdef DEVICE_POLLING
- int rxcycles; /* ... when polling */
-#endif
- int suspended; /* 0 = normal 1 = suspended */
-};
-
-
-#define DC_LOCK(_sc) mtx_lock(&(_sc)->dc_mtx)
-#define DC_UNLOCK(_sc) mtx_unlock(&(_sc)->dc_mtx)
-#define DC_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->dc_mtx, MA_OWNED)
-
-#define DC_TX_POLL 0x00000001
-#define DC_TX_COALESCE 0x00000002
-#define DC_TX_ADMTEK_WAR 0x00000004
-#define DC_TX_USE_TX_INTR 0x00000008
-#define DC_RX_FILTER_TULIP 0x00000010
-#define DC_TX_INTR_FIRSTFRAG 0x00000020
-#define DC_PNIC_RX_BUG_WAR 0x00000040
-#define DC_TX_FIXED_RING 0x00000080
-#define DC_TX_STORENFWD 0x00000100
-#define DC_REDUCED_MII_POLL 0x00000200
-#define DC_TX_INTR_ALWAYS 0x00000400
-#define DC_21143_NWAY 0x00000800
-#define DC_128BIT_HASH 0x00001000
-#define DC_64BIT_HASH 0x00002000
-#define DC_TULIP_LEDS 0x00004000
-#define DC_TX_ONE 0x00008000
-#define DC_TX_ALIGN 0x00010000 /* align mbuf on tx */
-
-/*
- * register space access macros
- */
-#define CSR_WRITE_4(sc, reg, val) \
- bus_space_write_4(sc->dc_btag, sc->dc_bhandle, reg, val)
-
-#define CSR_READ_4(sc, reg) \
- bus_space_read_4(sc->dc_btag, sc->dc_bhandle, reg)
-
-#define DC_TIMEOUT 1000
-#define ETHER_ALIGN 2
-
-/*
- * General constants that are fun to know.
- */
-
-/*
- * DEC PCI vendor ID
- */
-#define DC_VENDORID_DEC 0x1011
-
-/*
- * DEC/Intel 21143 PCI device ID
- */
-#define DC_DEVICEID_21143 0x0019
-
-/*
- * Macronix PCI vendor ID
- */
-#define DC_VENDORID_MX 0x10D9
-
-/*
- * Macronix PMAC device IDs.
- */
-#define DC_DEVICEID_98713 0x0512
-#define DC_DEVICEID_987x5 0x0531
-#define DC_DEVICEID_98727 0x0532
-#define DC_DEVICEID_98732 0x0532
-
-/* Macronix PCI revision codes. */
-#define DC_REVISION_98713 0x00
-#define DC_REVISION_98713A 0x10
-#define DC_REVISION_98715 0x20
-#define DC_REVISION_98715AEC_C 0x25
-#define DC_REVISION_98725 0x30
-
-/*
- * Compex PCI vendor ID.
- */
-#define DC_VENDORID_CP 0x11F6
-
-/*
- * Compex PMAC PCI device IDs.
- */
-#define DC_DEVICEID_98713_CP 0x9881
-
-/*
- * Lite-On PNIC PCI vendor ID
- */
-#define DC_VENDORID_LO 0x11AD
-
-/*
- * 82c168/82c169 PNIC device IDs. Both chips have the same device
- * ID but different revisions. Revision 0x10 is the 82c168, and
- * 0x20 is the 82c169.
- */
-#define DC_DEVICEID_82C168 0x0002
-
-#define DC_REVISION_82C168 0x10
-#define DC_REVISION_82C169 0x20
-
-/*
- * Lite-On PNIC II device ID. Note: this is actually a Macronix 98715A
- * with wake on lan/magic packet support.
- */
-#define DC_DEVICEID_82C115 0xc115
-
-/*
- * Davicom vendor ID.
- */
-#define DC_VENDORID_DAVICOM 0x1282
-
-/*
- * Davicom device IDs.
- */
-#define DC_DEVICEID_DM9009 0x9009
-#define DC_DEVICEID_DM9100 0x9100
-#define DC_DEVICEID_DM9102 0x9102
-
-/*
- * The DM9102A has the same PCI device ID as the DM9102,
- * but a higher revision code.
- */
-#define DC_REVISION_DM9102 0x10
-#define DC_REVISION_DM9102A 0x30
-
-/*
- * ADMtek vendor ID.
- */
-#define DC_VENDORID_ADMTEK 0x1317
-
-/*
- * ADMtek device IDs.
- */
-#define DC_DEVICEID_AL981 0x0981
-#define DC_DEVICEID_AN985 0x0985
-#define DC_DEVICEID_FA511 0x1985
-#define DC_DEVICEID_ADM9511 0x9511
-#define DC_DEVICEID_ADM9513 0x9513
-
-/*
- * 3COM PCI vendor ID
- */
-#define DC_VENDORID_3COM 0x10b7
-
-/*
- * 3COM OfficeConnect 10/100B (3CSOHO100B-TX)
- */
-#define DC_DEVICEID_3CSOHOB 0x9300
-
-/*
- * ASIX vendor ID.
- */
-#define DC_VENDORID_ASIX 0x125B
-
-/*
- * ASIX device IDs.
- */
-#define DC_DEVICEID_AX88140A 0x1400
-
-/*
- * The ASIX AX88140 and ASIX AX88141 have the same vendor and
- * device IDs but different revision values.
- */
-#define DC_REVISION_88140 0x00
-#define DC_REVISION_88141 0x10
-
-/*
- * Accton vendor ID.
- */
-#define DC_VENDORID_ACCTON 0x1113
-
-/*
- * Accton device IDs.
- */
-#define DC_DEVICEID_EN1217 0x1217
-#define DC_DEVICEID_EN2242 0x1216
-
-/*
- * Xircom vendor ID
- */
-#define DC_VENDORID_XIRCOM 0x115d
-
-/*
- * Xircom device IDs.
- */
-#define DC_DEVICEID_X3201 0x0003
-
-/*
- * Abocom vendor ID
- */
-#define DC_VENDORID_ABOCOM 0x13d1
-
-/*
- * Abocom device IDs.
- */
-#define DC_DEVICEID_FE2500 0xAB02
-#define DC_DEVICEID_FE2500MX 0xab08
-
-/*
- * Conexant vendor ID.
- */
-#define DC_VENDORID_CONEXANT 0x14f1
-
-/*
- * Conexant device IDs.
- */
-#define DC_DEVICEID_RS7112 0x1803
-
-/*
- * Planex vendor ID
- */
-#define DC_VENDORID_PLANEX 0x14ea
-
-/*
- * Planex device IDs.
- */
-#define DC_DEVICEID_FNW3602T 0xab08
-
-/*
- * Not sure who this vendor should be, so we'll go with HAWKING until
- * I can locate the right one.
- */
-#define DC_VENDORID_HAWKING 0x17b3
-
-/*
- * Sure looks like an abocom device ID, but it found on my hawking PN672TX
- * card. Use that for now, and upgrade later.
- */
-#define DC_DEVICEID_HAWKING_PN672TX 0xab08
-
-/*
- * Microsoft device ID.
- */
-#define DC_VENDORID_MICROSOFT 0x1414
-
-/*
- * Supported Microsoft PCI and cardbus NICs. These are really
- * ADMtek parts in disguise.
- */
-
-#define DC_DEVICEID_MSMN120 0x0001
-#define DC_DEVICEID_MSMN130 0x0002
-#define DC_DEVICEID_MSMN130_FAKE 0xFFF2
-
-/*
- * PCI low memory base and low I/O base register, and
- * other PCI registers.
- */
-
-#define DC_PCI_CFID 0x00 /* Id */
-#define DC_PCI_CFCS 0x04 /* Command and status */
-#define DC_PCI_CFRV 0x08 /* Revision */
-#define DC_PCI_CFLT 0x0C /* Latency timer */
-#define DC_PCI_CFBIO 0x10 /* Base I/O address */
-#define DC_PCI_CFBMA 0x14 /* Base memory address */
-#define DC_PCI_CCIS 0x28 /* Card info struct */
-#define DC_PCI_CSID 0x2C /* Subsystem ID */
-#define DC_PCI_CBER 0x30 /* Expansion ROM base address */
-#define DC_PCI_CCAP 0x34 /* Caps pointer - PD/TD chip only */
-#define DC_PCI_CFIT 0x3C /* Interrupt */
-#define DC_PCI_CFDD 0x40 /* Device and driver area */
-#define DC_PCI_CWUA0 0x44 /* Wake-Up LAN addr 0 */
-#define DC_PCI_CWUA1 0x48 /* Wake-Up LAN addr 1 */
-#define DC_PCI_SOP0 0x4C /* SecureON passwd 0 */
-#define DC_PCI_SOP1 0x50 /* SecureON passwd 1 */
-#define DC_PCI_CWUC 0x54 /* Configuration Wake-Up cmd */
-#define DC_PCI_CCID 0xDC /* Capability ID - PD/TD only */
-#define DC_PCI_CPMC 0xE0 /* Pwrmgmt ctl & sts - PD/TD only */
-
-/* PCI ID register */
-#define DC_CFID_VENDOR 0x0000FFFF
-#define DC_CFID_DEVICE 0xFFFF0000
-
-/* PCI command/status register */
-#define DC_CFCS_IOSPACE 0x00000001 /* I/O space enable */
-#define DC_CFCS_MEMSPACE 0x00000002 /* memory space enable */
-#define DC_CFCS_BUSMASTER 0x00000004 /* bus master enable */
-#define DC_CFCS_MWI_ENB 0x00000010 /* mem write and inval enable */
-#define DC_CFCS_PARITYERR_ENB 0x00000040 /* parity error enable */
-#define DC_CFCS_SYSERR_ENB 0x00000100 /* system error enable */
-#define DC_CFCS_NEWCAPS 0x00100000 /* new capabilities */
-#define DC_CFCS_FAST_B2B 0x00800000 /* fast back-to-back capable */
-#define DC_CFCS_DATAPARITY 0x01000000 /* Parity error report */
-#define DC_CFCS_DEVSELTIM 0x06000000 /* devsel timing */
-#define DC_CFCS_TGTABRT 0x10000000 /* received target abort */
-#define DC_CFCS_MASTERABRT 0x20000000 /* received master abort */
-#define DC_CFCS_SYSERR 0x40000000 /* asserted system error */
-#define DC_CFCS_PARITYERR 0x80000000 /* asserted parity error */
-
-/* PCI revision register */
-#define DC_CFRV_STEPPING 0x0000000F
-#define DC_CFRV_REVISION 0x000000F0
-#define DC_CFRV_SUBCLASS 0x00FF0000
-#define DC_CFRV_BASECLASS 0xFF000000
-
-#define DC_21143_PB_REV 0x00000030
-#define DC_21143_TB_REV 0x00000030
-#define DC_21143_PC_REV 0x00000030
-#define DC_21143_TC_REV 0x00000030
-#define DC_21143_PD_REV 0x00000041
-#define DC_21143_TD_REV 0x00000041
-
-/* PCI latency timer register */
-#define DC_CFLT_CACHELINESIZE 0x000000FF
-#define DC_CFLT_LATENCYTIMER 0x0000FF00
-
-/* PCI subsystem ID register */
-#define DC_CSID_VENDOR 0x0000FFFF
-#define DC_CSID_DEVICE 0xFFFF0000
-
-/* PCI cababilities pointer */
-#define DC_CCAP_OFFSET 0x000000FF
-
-/* PCI interrupt config register */
-#define DC_CFIT_INTLINE 0x000000FF
-#define DC_CFIT_INTPIN 0x0000FF00
-#define DC_CFIT_MIN_GNT 0x00FF0000
-#define DC_CFIT_MAX_LAT 0xFF000000
-
-/* PCI capability register */
-#define DC_CCID_CAPID 0x000000FF
-#define DC_CCID_NEXTPTR 0x0000FF00
-#define DC_CCID_PM_VERS 0x00070000
-#define DC_CCID_PME_CLK 0x00080000
-#define DC_CCID_DVSPEC_INT 0x00200000
-#define DC_CCID_STATE_D1 0x02000000
-#define DC_CCID_STATE_D2 0x04000000
-#define DC_CCID_PME_D0 0x08000000
-#define DC_CCID_PME_D1 0x10000000
-#define DC_CCID_PME_D2 0x20000000
-#define DC_CCID_PME_D3HOT 0x40000000
-#define DC_CCID_PME_D3COLD 0x80000000
-
-/* PCI power management control/status register */
-#define DC_CPMC_STATE 0x00000003
-#define DC_CPMC_PME_ENB 0x00000100
-#define DC_CPMC_PME_STS 0x00008000
-
-#define DC_PSTATE_D0 0x0
-#define DC_PSTATE_D1 0x1
-#define DC_PSTATE_D2 0x2
-#define DC_PSTATE_D3 0x3
-
-/* Device specific region */
-/* Configuration and driver area */
-#define DC_CFDD_DRVUSE 0x0000FFFF
-#define DC_CFDD_SNOOZE_MODE 0x40000000
-#define DC_CFDD_SLEEP_MODE 0x80000000
-
-/* Configuration wake-up command register */
-#define DC_CWUC_MUST_BE_ZERO 0x00000001
-#define DC_CWUC_SECUREON_ENB 0x00000002
-#define DC_CWUC_FORCE_WUL 0x00000004
-#define DC_CWUC_BNC_ABILITY 0x00000008
-#define DC_CWUC_AUI_ABILITY 0x00000010
-#define DC_CWUC_TP10_ABILITY 0x00000020
-#define DC_CWUC_MII_ABILITY 0x00000040
-#define DC_CWUC_SYM_ABILITY 0x00000080
-#define DC_CWUC_LOCK 0x00000100
-
-/*
- * SROM nonsense.
- */
-
-#define DC_IB_CTLRCNT 0x13
-#define DC_IB_LEAF0_CNUM 0x1A
-#define DC_IB_LEAF0_OFFSET 0x1B
-
-struct dc_info_leaf {
- u_int16_t dc_conntype;
- u_int8_t dc_blkcnt;
- u_int8_t dc_rsvd;
- u_int16_t dc_infoblk;
-};
-
-#define DC_CTYPE_10BT 0x0000
-#define DC_CTYPE_10BT_NWAY 0x0100
-#define DC_CTYPE_10BT_FDX 0x0204
-#define DC_CTYPE_10B2 0x0001
-#define DC_CTYPE_10B5 0x0002
-#define DC_CTYPE_100BT 0x0003
-#define DC_CTYPE_100BT_FDX 0x0205
-#define DC_CTYPE_100T4 0x0006
-#define DC_CTYPE_100FX 0x0007
-#define DC_CTYPE_100FX_FDX 0x0208
-#define DC_CTYPE_MII_10BT 0x0009
-#define DC_CTYPE_MII_10BT_FDX 0x020A
-#define DC_CTYPE_MII_100BT 0x000D
-#define DC_CTYPE_MII_100BT_FDX 0x020E
-#define DC_CTYPE_MII_100T4 0x000F
-#define DC_CTYPE_MII_100FX 0x0010
-#define DC_CTYPE_MII_100FX_FDX 0x0211
-#define DC_CTYPE_DYN_PUP_AUTOSENSE 0x0800
-#define DC_CTYPE_PUP_AUTOSENSE 0x8800
-#define DC_CTYPE_NOMEDIA 0xFFFF
-
-#define DC_EBLOCK_SIA 0x0002
-#define DC_EBLOCK_MII 0x0003
-#define DC_EBLOCK_SYM 0x0004
-#define DC_EBLOCK_RESET 0x0005
-#define DC_EBLOCK_PHY_SHUTDOWN 0x0006
-
-struct dc_leaf_hdr {
- u_int16_t dc_mtype;
- u_int8_t dc_mcnt;
- u_int8_t dc_rsvd;
-};
-
-struct dc_eblock_hdr {
- u_int8_t dc_len;
- u_int8_t dc_type;
-};
-
-struct dc_eblock_sia {
- struct dc_eblock_hdr dc_sia_hdr;
- u_int8_t dc_sia_code;
- union {
- struct dc_sia_ext { /* if (dc_sia_code & DC_SIA_CODE_EXT) */
- u_int8_t dc_sia_mediaspec[6]; /* CSR13, CSR14, CSR15 */
- u_int8_t dc_sia_gpio_ctl[2];
- u_int8_t dc_sia_gpio_dat[2];
- } dc_sia_ext;
- struct dc_sia_noext {
- u_int8_t dc_sia_gpio_ctl[2];
- u_int8_t dc_sia_gpio_dat[2];
- } dc_sia_noext;
- } dc_un;
-};
-
-#define DC_SIA_CODE_10BT 0x00
-#define DC_SIA_CODE_10B2 0x01
-#define DC_SIA_CODE_10B5 0x02
-#define DC_SIA_CODE_10BT_FDX 0x04
-#define DC_SIA_CODE_EXT 0x40
-
-/*
- * Note that the first word in the gpr and reset
- * sequences is always a control word.
- */
-struct dc_eblock_mii {
- struct dc_eblock_hdr dc_mii_hdr;
- u_int8_t dc_mii_phynum;
- u_int8_t dc_gpr_len;
-/* u_int16_t dc_gpr_dat[n]; */
-/* u_int8_t dc_reset_len; */
-/* u_int16_t dc_reset_dat[n]; */
-/* There are other fields after these, but we don't
- * care about them since they can be determined by looking
- * at the PHY.
- */
-};
-
-struct dc_eblock_sym {
- struct dc_eblock_hdr dc_sym_hdr;
- u_int8_t dc_sym_code;
- u_int8_t dc_sym_gpio_ctl[2];
- u_int8_t dc_sym_gpio_dat[2];
- u_int8_t dc_sym_cmd[2];
-};
-
-#define DC_SYM_CODE_100BT 0x03
-#define DC_SYM_CODE_100BT_FDX 0x05
-#define DC_SYM_CODE_100T4 0x06
-#define DC_SYM_CODE_100FX 0x07
-#define DC_SYM_CODE_100FX_FDX 0x08
-
-struct dc_eblock_reset {
- struct dc_eblock_hdr dc_reset_hdr;
- u_int8_t dc_reset_len;
-/* u_int16_t dc_reset_dat[n]; */
-};
diff --git a/sys/dev/dc/pnphy.c b/sys/dev/dc/pnphy.c
deleted file mode 100644
index 98d269a..0000000
--- a/sys/dev/dc/pnphy.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright (c) 1997, 1998, 1999
- * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Pseudo-driver for media selection on the Lite-On PNIC 82c168
- * chip. The NWAY support on this chip is horribly broken, so we
- * only support manual mode selection. This is lame, but getting
- * NWAY to work right is amazingly difficult.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <sys/lock.h>
-#include <sys/module.h>
-#include <sys/mutex.h>
-#include <sys/bus.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_media.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-#include "miidevs.h"
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-
-#include <pci/if_dcreg.h>
-
-#include "miibus_if.h"
-
-#define DC_SETBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, \
- CSR_READ_4(sc, reg) | x)
-
-#define DC_CLRBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, \
- CSR_READ_4(sc, reg) & ~x)
-
-static int pnphy_probe(device_t);
-static int pnphy_attach(device_t);
-
-static device_method_t pnphy_methods[] = {
- /* device interface */
- DEVMETHOD(device_probe, pnphy_probe),
- DEVMETHOD(device_attach, pnphy_attach),
- DEVMETHOD(device_detach, mii_phy_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- { 0, 0 }
-};
-
-static devclass_t pnphy_devclass;
-
-static driver_t pnphy_driver = {
- "pnphy",
- pnphy_methods,
- sizeof(struct mii_softc)
-};
-
-DRIVER_MODULE(pnphy, miibus, pnphy_driver, pnphy_devclass, 0, 0);
-
-static int pnphy_service(struct mii_softc *, struct mii_data *, int);
-static void pnphy_status(struct mii_softc *);
-
-static int
-pnphy_probe(dev)
- device_t dev;
-{
- struct mii_attach_args *ma;
-
- ma = device_get_ivars(dev);
-
- /*
- * The dc driver will report the 82c168 vendor and device
- * ID to let us know that it wants us to attach.
- */
- if (ma->mii_id1 != DC_VENDORID_LO ||
- ma->mii_id2 != DC_DEVICEID_82C168)
- return(ENXIO);
-
- device_set_desc(dev, "PNIC 82c168 media interface");
-
- return (0);
-}
-
-static int
-pnphy_attach(dev)
- device_t dev;
-{
- struct mii_softc *sc;
- struct mii_attach_args *ma;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- ma = device_get_ivars(dev);
- sc->mii_dev = device_get_parent(dev);
- mii = device_get_softc(sc->mii_dev);
- LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
-
- sc->mii_inst = mii->mii_instance;
- sc->mii_phy = ma->mii_phyno;
- sc->mii_service = pnphy_service;
- sc->mii_pdata = mii;
-
- sc->mii_flags |= MIIF_NOISOLATE;
- mii->mii_instance++;
-
-#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
-
- sc->mii_capabilities =
- BMSR_100TXFDX|BMSR_100TXHDX|BMSR_10TFDX|BMSR_10THDX;
- sc->mii_capabilities &= ma->mii_capmask;
- device_printf(dev, " ");
- mii_add_media(sc);
- printf("\n");
- ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
- BMCR_ISO);
-
- ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
- BMCR_LOOP|BMCR_S100);
-
-#undef ADD
-
- MIIBUS_MEDIAINIT(sc->mii_dev);
- return(0);
-}
-
-static int
-pnphy_service(sc, mii, cmd)
- struct mii_softc *sc;
- struct mii_data *mii;
- int cmd;
-{
- struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-
- switch (cmd) {
- case MII_POLLSTAT:
- /*
- * If we're not polling our PHY instance, just return.
- */
- if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
- return (0);
- }
- break;
-
- case MII_MEDIACHG:
- /*
- * If the media indicates a different PHY instance,
- * isolate ourselves.
- */
- if (IFM_INST(ife->ifm_media) != sc->mii_inst)
- return (0);
-
- /*
- * If the interface is not up, don't do anything.
- */
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- break;
-
- sc->mii_flags = 0;
-
- switch (IFM_SUBTYPE(ife->ifm_media)) {
- case IFM_AUTO:
- /* NWAY is busted on this chip */
- case IFM_100_T4:
- /*
- * XXX Not supported as a manual setting right now.
- */
- return (EINVAL);
- case IFM_100_TX:
- mii->mii_media_active = IFM_ETHER|IFM_100_TX;
- if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
- mii->mii_media_active |= IFM_FDX;
- MIIBUS_STATCHG(sc->mii_dev);
- return(0);
- case IFM_10_T:
- mii->mii_media_active = IFM_ETHER|IFM_10_T;
- if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
- mii->mii_media_active |= IFM_FDX;
- MIIBUS_STATCHG(sc->mii_dev);
- return(0);
- default:
- return(EINVAL);
- }
- break;
-
- case MII_TICK:
- /*
- * If we're not currently selected, just return.
- */
- if (IFM_INST(ife->ifm_media) != sc->mii_inst)
- return (0);
-
- /*
- * Is the interface even up?
- */
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- return (0);
-
- break;
- }
-
- /* Update the media status. */
- pnphy_status(sc);
-
- /* Callback if something changed. */
- mii_phy_update(sc, cmd);
- return (0);
-}
-
-static void
-pnphy_status(sc)
- struct mii_softc *sc;
-{
- struct mii_data *mii = sc->mii_pdata;
- int reg;
- struct dc_softc *dc_sc;
-
- dc_sc = mii->mii_ifp->if_softc;
-
- mii->mii_media_status = IFM_AVALID;
- mii->mii_media_active = IFM_ETHER;
-
- reg = CSR_READ_4(dc_sc, DC_ISR);
-
- if (!(reg & DC_ISR_LINKFAIL))
- mii->mii_media_status |= IFM_ACTIVE;
-
- if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_SPEEDSEL)
- mii->mii_media_active |= IFM_10_T;
- else
- mii->mii_media_active |= IFM_100_TX;
- if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_FULLDUPLEX)
- mii->mii_media_active |= IFM_FDX;
-
- return;
-}
diff --git a/sys/dev/de/dc21040reg.h b/sys/dev/de/dc21040reg.h
deleted file mode 100644
index c0ff191..0000000
--- a/sys/dev/de/dc21040reg.h
+++ /dev/null
@@ -1,583 +0,0 @@
-/* $NetBSD: dc21040reg.h,v 1.15 1998/05/22 18:50:59 matt Exp $ */
-
-/* $FreeBSD$ */
-
-/*-
- * Copyright (c) 1994, 1995, 1996 Matt Thomas <matt@3am-software.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- *
- * Id: dc21040reg.h,v 1.24 1997/05/16 19:47:09 thomas Exp
- */
-
-#if !defined(_DC21040_H)
-#define _DC21040_H
-
-#if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
-#define TULIP_BITFIELD2(a, b) b, a
-#define TULIP_BITFIELD3(a, b, c) c, b, a
-#define TULIP_BITFIELD4(a, b, c, d) d, c, b, a
-#else
-#define TULIP_BITFIELD2(a, b) a, b
-#define TULIP_BITFIELD3(a, b, c) a, b, c
-#define TULIP_BITFIELD4(a, b, c, d) a, b, c, d
-#endif
-
-typedef struct {
- u_int32_t d_status;
- u_int32_t TULIP_BITFIELD3(d_length1 : 11,
- d_length2 : 11,
- d_flag : 10);
- u_int32_t d_addr1;
- u_int32_t d_addr2;
-} tulip_desc_t;
-
-#define TULIP_DSTS_OWNER 0x80000000 /* Owner (1 = 21040) */
-#define TULIP_DSTS_ERRSUM 0x00008000 /* Error Summary */
-/*
- * Transmit Status
- */
-#define TULIP_DSTS_TxBABBLE 0x00004000 /* Transmitter Babbled */
-#define TULIP_DSTS_TxCARRLOSS 0x00000800 /* Carrier Loss */
-#define TULIP_DSTS_TxNOCARR 0x00000400 /* No Carrier */
-#define TULIP_DSTS_TxLATECOLL 0x00000200 /* Late Collision */
-#define TULIP_DSTS_TxEXCCOLL 0x00000100 /* Excessive Collisions */
-#define TULIP_DSTS_TxNOHRTBT 0x00000080 /* No Heartbeat */
-#define TULIP_DSTS_TxCOLLMASK 0x00000078 /* Collision Count (mask) */
-#define TULIP_DSTS_V_TxCOLLCNT 0x00000003 /* Collision Count (bit) */
-#define TULIP_DSTS_TxLINKFAIL 0x00000004 /* Link Failure */
-#define TULIP_DSTS_TxUNDERFLOW 0x00000002 /* Underflow Error */
-#define TULIP_DSTS_TxDEFERRED 0x00000001 /* Initially Deferred */
-/*
- * Receive Status
- */
-#define TULIP_DSTS_RxBADLENGTH 0x00004000 /* Length Error */
-#define TULIP_DSTS_RxDATATYPE 0x00003000 /* Data Type */
-#define TULIP_DSTS_RxRUNT 0x00000800 /* Runt Frame */
-#define TULIP_DSTS_RxMULTICAST 0x00000400 /* Multicast Frame */
-#define TULIP_DSTS_RxFIRSTDESC 0x00000200 /* First Descriptor */
-#define TULIP_DSTS_RxLASTDESC 0x00000100 /* Last Descriptor */
-#define TULIP_DSTS_RxTOOLONG 0x00000080 /* Frame Too Long */
-#define TULIP_DSTS_RxCOLLSEEN 0x00000040 /* Collision Seen */
-#define TULIP_DSTS_RxFRAMETYPE 0x00000020 /* Frame Type */
-#define TULIP_DSTS_RxWATCHDOG 0x00000010 /* Receive Watchdog */
-#define TULIP_DSTS_RxDRBBLBIT 0x00000004 /* Dribble Bit */
-#define TULIP_DSTS_RxBADCRC 0x00000002 /* CRC Error */
-#define TULIP_DSTS_RxOVERFLOW 0x00000001 /* Overflow */
-
-
-#define TULIP_DFLAG_ENDRING 0x0008 /* End of Transmit Ring */
-#define TULIP_DFLAG_CHAIN 0x0004 /* Chain using d_addr2 */
-
-#define TULIP_DFLAG_TxWANTINTR 0x0200 /* Signal Interrupt on Completion */
-#define TULIP_DFLAG_TxLASTSEG 0x0100 /* Last Segment */
-#define TULIP_DFLAG_TxFIRSTSEG 0x0080 /* First Segment */
-#define TULIP_DFLAG_TxINVRSFILT 0x0040 /* Inverse Filtering */
-#define TULIP_DFLAG_TxSETUPPKT 0x0020 /* Setup Packet */
-#define TULIP_DFLAG_TxHASCRC 0x0010 /* Don't Append the CRC */
-#define TULIP_DFLAG_TxNOPADDING 0x0002 /* Don't AutoPad */
-#define TULIP_DFLAG_TxHASHFILT 0x0001 /* Hash/Perfect Filtering */
-
-/*
- * The 21040 Registers (IO Space Addresses)
- */
-#define TULIP_REG_BUSMODE 0x00 /* CSR0 -- Bus Mode */
-#define TULIP_REG_TXPOLL 0x08 /* CSR1 -- Transmit Poll Demand */
-#define TULIP_REG_RXPOLL 0x10 /* CSR2 -- Receive Poll Demand */
-#define TULIP_REG_RXLIST 0x18 /* CSR3 -- Receive List Base Addr */
-#define TULIP_REG_TXLIST 0x20 /* CSR4 -- Transmit List Base Addr */
-#define TULIP_REG_STATUS 0x28 /* CSR5 -- Status */
-#define TULIP_REG_CMD 0x30 /* CSR6 -- Command */
-#define TULIP_REG_INTR 0x38 /* CSR7 -- Interrupt Control */
-#define TULIP_REG_MISSES 0x40 /* CSR8 -- Missed Frame Counter */
-#define TULIP_REG_ADDRROM 0x48 /* CSR9 -- ENET ROM Register */
-#define TULIP_REG_RSRVD 0x50 /* CSR10 -- Reserved */
-#define TULIP_REG_FULL_DUPLEX 0x58 /* CSR11 -- Full Duplex */
-#define TULIP_REG_SIA_STATUS 0x60 /* CSR12 -- SIA Status */
-#define TULIP_REG_SIA_CONN 0x68 /* CSR13 -- SIA Connectivity */
-#define TULIP_REG_SIA_TXRX 0x70 /* CSR14 -- SIA Tx Rx */
-#define TULIP_REG_SIA_GEN 0x78 /* CSR15 -- SIA General */
-
-/*
- * CSR5 -- Status Register
- * CSR7 -- Interrupt Control
- */
-#define TULIP_STS_ERRORMASK 0x03800000L /* ( R) Error Bits (Valid when SYSERROR is set) */
-#define TULIP_STS_ERR_PARITY 0x00000000L /* 000 - Parity Error (Perform Reset) */
-#define TULIP_STS_ERR_MASTER 0x00800000L /* 001 - Master Abort */
-#define TULIP_STS_ERR_TARGET 0x01000000L /* 010 - Target Abort */
-#define TULIP_STS_ERR_SHIFT 23
-#define TULIP_STS_TXSTATEMASK 0x00700000L /* ( R) Transmission Process State */
-#define TULIP_STS_TXS_RESET 0x00000000L /* 000 - Rset or transmit jabber expired */
-#define TULIP_STS_TXS_FETCH 0x00100000L /* 001 - Fetching transmit descriptor */
-#define TULIP_STS_TXS_WAITEND 0x00200000L /* 010 - Wait for end of transmission */
-#define TULIP_STS_TXS_READING 0x00300000L /* 011 - Read buffer and enqueue data */
-#define TULIP_STS_TXS_RSRVD 0x00400000L /* 100 - Reserved */
-#define TULIP_STS_TXS_SETUP 0x00500000L /* 101 - Setup Packet */
-#define TULIP_STS_TXS_SUSPEND 0x00600000L /* 110 - Transmit FIFO underflow or an
- unavailable transmit descriptor */
-#define TULIP_STS_TXS_CLOSE 0x00700000L /* 111 - Close transmit descriptor */
-#define TULIP_STS_RXSTATEMASK 0x000E0000L /* ( R) Receive Process State*/
-#define TULIP_STS_RXS_STOPPED 0x00000000L /* 000 - Stopped */
-#define TULIP_STS_RXS_FETCH 0x00020000L /* 001 - Running -- Fetch receive descriptor */
-#define TULIP_STS_RXS_ENDCHECK 0x00040000L /* 010 - Running -- Check for end of receive
- packet before prefetch of next descriptor */
-#define TULIP_STS_RXS_WAIT 0x00060000L /* 011 - Running -- Wait for receive packet */
-#define TULIP_STS_RXS_SUSPEND 0x00080000L /* 100 - Suspended -- As a result of
- unavailable receive buffers */
-#define TULIP_STS_RXS_CLOSE 0x000A0000L /* 101 - Running -- Close receive descriptor */
-#define TULIP_STS_RXS_FLUSH 0x000C0000L /* 110 - Running -- Flush the current frame
- from the receive FIFO as a result of
- an unavailable receive buffer */
-#define TULIP_STS_RXS_DEQUEUE 0x000E0000L /* 111 - Running -- Dequeue the receive frame
- from the receive FIFO into the receive
- buffer. */
-#define TULIP_STS_NORMALINTR 0x00010000L /* (RW) Normal Interrupt */
-#define TULIP_STS_ABNRMLINTR 0x00008000L /* (RW) Abnormal Interrupt */
-#define TULIP_STS_SYSERROR 0x00002000L /* (RW) System Error */
-#define TULIP_STS_LINKFAIL 0x00001000L /* (RW) Link Failure (21040) */
-#define TULIP_STS_FULDPLXSHRT 0x00000800L /* (RW) Full Duplex Short Fram Rcvd (21040) */
-#define TULIP_STS_GPTIMEOUT 0x00000800L /* (RW) General Purpose Timeout (21140) */
-#define TULIP_STS_AUI 0x00000400L /* (RW) AUI/TP Switch (21040) */
-#define TULIP_STS_RXTIMEOUT 0x00000200L /* (RW) Receive Watchbog Timeout */
-#define TULIP_STS_RXSTOPPED 0x00000100L /* (RW) Receive Process Stopped */
-#define TULIP_STS_RXNOBUF 0x00000080L /* (RW) Receive Buffer Unavailable */
-#define TULIP_STS_RXINTR 0x00000040L /* (RW) Receive Interrupt */
-#define TULIP_STS_TXUNDERFLOW 0x00000020L /* (RW) Transmit Underflow */
-#define TULIP_STS_LINKPASS 0x00000010L /* (RW) LinkPass (21041) */
-#define TULIP_STS_TXBABBLE 0x00000008L /* (RW) Transmit Jabber Timeout */
-#define TULIP_STS_TXNOBUF 0x00000004L /* (RW) Transmit Buffer Unavailable */
-#define TULIP_STS_TXSTOPPED 0x00000002L /* (RW) Transmit Process Stopped */
-#define TULIP_STS_TXINTR 0x00000001L /* (RW) Transmit Interrupt */
-
-/*
- * CSR6 -- Command (Operation Mode) Register
- */
-#define TULIP_CMD_MUSTBEONE 0x02000000L /* (RW) Must Be One (21140) */
-#define TULIP_CMD_SCRAMBLER 0x01000000L /* (RW) Scrambler Mode (21140) */
-#define TULIP_CMD_PCSFUNCTION 0x00800000L /* (RW) PCS Function (21140) */
-#define TULIP_CMD_TXTHRSHLDCTL 0x00400000L /* (RW) Transmit Threshold Mode (21140) */
-#define TULIP_CMD_STOREFWD 0x00200000L /* (RW) Store and Foward (21140) */
-#define TULIP_CMD_NOHEARTBEAT 0x00080000L /* (RW) No Heartbeat (21140) */
-#define TULIP_CMD_PORTSELECT 0x00040000L /* (RW) Post Select (100Mb) (21140) */
-#define TULIP_CMD_ENHCAPTEFFCT 0x00040000L /* (RW) Enhanced Capture Effecty (21041) */
-#define TULIP_CMD_CAPTREFFCT 0x00020000L /* (RW) Capture Effect (!802.3) */
-#define TULIP_CMD_BACKPRESSURE 0x00010000L /* (RW) Back Pressure (!802.3) (21040) */
-#define TULIP_CMD_THRESHOLDCTL 0x0000C000L /* (RW) Threshold Control */
-#define TULIP_CMD_THRSHLD72 0x00000000L /* 00 - 72 Bytes */
-#define TULIP_CMD_THRSHLD96 0x00004000L /* 01 - 96 Bytes */
-#define TULIP_CMD_THRSHLD128 0x00008000L /* 10 - 128 bytes */
-#define TULIP_CMD_THRSHLD160 0x0000C000L /* 11 - 160 Bytes */
-#define TULIP_CMD_TXRUN 0x00002000L /* (RW) Start/Stop Transmitter */
-#define TULIP_CMD_FORCECOLL 0x00001000L /* (RW) Force Collisions */
-#define TULIP_CMD_OPERMODE 0x00000C00L /* (RW) Operating Mode */
-#define TULIP_CMD_FULLDUPLEX 0x00000200L /* (RW) Full Duplex Mode */
-#define TULIP_CMD_FLAKYOSCDIS 0x00000100L /* (RW) Flakey Oscillator Disable */
-#define TULIP_CMD_ALLMULTI 0x00000080L /* (RW) Pass All Multicasts */
-#define TULIP_CMD_PROMISCUOUS 0x00000040L /* (RW) Promiscuous Mode */
-#define TULIP_CMD_BACKOFFCTR 0x00000020L /* (RW) Start/Stop Backoff Counter (!802.3) */
-#define TULIP_CMD_INVFILTER 0x00000010L /* (R ) Inverse Filtering */
-#define TULIP_CMD_PASSBADPKT 0x00000008L /* (RW) Pass Bad Frames */
-#define TULIP_CMD_HASHONLYFLTR 0x00000004L /* (R ) Hash Only Filtering */
-#define TULIP_CMD_RXRUN 0x00000002L /* (RW) Start/Stop Receive Filtering */
-#define TULIP_CMD_HASHPRFCTFLTR 0x00000001L /* (R ) Hash/Perfect Receive Filtering */
-
-#define TULIP_SIASTS_OTHERRXACTIVITY 0x00000200L
-#define TULIP_SIASTS_RXACTIVITY 0x00000100L
-#define TULIP_SIASTS_LINKFAIL 0x00000004L
-#define TULIP_SIASTS_LINK100FAIL 0x00000002L
-#define TULIP_SIACONN_RESET 0x00000000L
-
-/*
- * 21040 SIA definitions
- */
-#define TULIP_21040_PROBE_10BASET_TIMEOUT 2500
-#define TULIP_21040_PROBE_AUIBNC_TIMEOUT 300
-#define TULIP_21040_PROBE_EXTSIA_TIMEOUT 300
-
-#define TULIP_21040_SIACONN_10BASET 0x0000EF01L
-#define TULIP_21040_SIATXRX_10BASET 0x0000FFFFL
-#define TULIP_21040_SIAGEN_10BASET 0x00000000L
-
-#define TULIP_21040_SIACONN_10BASET_FD 0x0000EF01L
-#define TULIP_21040_SIATXRX_10BASET_FD 0x0000FFFDL
-#define TULIP_21040_SIAGEN_10BASET_FD 0x00000000L
-
-#define TULIP_21040_SIACONN_AUIBNC 0x0000EF09L
-#define TULIP_21040_SIATXRX_AUIBNC 0x00000705L
-#define TULIP_21040_SIAGEN_AUIBNC 0x00000006L
-
-#define TULIP_21040_SIACONN_EXTSIA 0x00003041L
-#define TULIP_21040_SIATXRX_EXTSIA 0x00000000L
-#define TULIP_21040_SIAGEN_EXTSIA 0x00000006L
-
-/*
- * 21041 SIA definitions
- */
-
-#define TULIP_21041_PROBE_10BASET_TIMEOUT 2500
-#define TULIP_21041_PROBE_AUIBNC_TIMEOUT 300
-
-#define TULIP_21041_SIACONN_10BASET 0x0000EF01L
-#define TULIP_21041_SIATXRX_10BASET 0x0000FF3FL
-#define TULIP_21041_SIAGEN_10BASET 0x00000000L
-
-#define TULIP_21041P2_SIACONN_10BASET 0x0000EF01L
-#define TULIP_21041P2_SIATXRX_10BASET 0x0000FFFFL
-#define TULIP_21041P2_SIAGEN_10BASET 0x00000000L
-
-#define TULIP_21041_SIACONN_10BASET_FD 0x0000EF01L
-#define TULIP_21041_SIATXRX_10BASET_FD 0x0000FF3DL
-#define TULIP_21041_SIAGEN_10BASET_FD 0x00000000L
-
-#define TULIP_21041P2_SIACONN_10BASET_FD 0x0000EF01L
-#define TULIP_21041P2_SIATXRX_10BASET_FD 0x0000FFFFL
-#define TULIP_21041P2_SIAGEN_10BASET_FD 0x00000000L
-
-#define TULIP_21041_SIACONN_AUI 0x0000EF09L
-#define TULIP_21041_SIATXRX_AUI 0x0000F73DL
-#define TULIP_21041_SIAGEN_AUI 0x0000000EL
-
-#define TULIP_21041P2_SIACONN_AUI 0x0000EF09L
-#define TULIP_21041P2_SIATXRX_AUI 0x0000F7FDL
-#define TULIP_21041P2_SIAGEN_AUI 0x0000000EL
-
-#define TULIP_21041_SIACONN_BNC 0x0000EF09L
-#define TULIP_21041_SIATXRX_BNC 0x0000F73DL
-#define TULIP_21041_SIAGEN_BNC 0x00000006L
-
-#define TULIP_21041P2_SIACONN_BNC 0x0000EF09L
-#define TULIP_21041P2_SIATXRX_BNC 0x0000F7FDL
-#define TULIP_21041P2_SIAGEN_BNC 0x00000006L
-
-/*
- * 21142 SIA definitions
- */
-
-#define TULIP_21142_PROBE_10BASET_TIMEOUT 2500
-#define TULIP_21142_PROBE_AUIBNC_TIMEOUT 300
-
-#define TULIP_21142_SIACONN_10BASET 0x00000001L
-#define TULIP_21142_SIATXRX_10BASET 0x00007F3FL
-#define TULIP_21142_SIAGEN_10BASET 0x00000008L
-
-#define TULIP_21142_SIACONN_10BASET_FD 0x00000001L
-#define TULIP_21142_SIATXRX_10BASET_FD 0x00007F3DL
-#define TULIP_21142_SIAGEN_10BASET_FD 0x00000008L
-
-#define TULIP_21142_SIACONN_AUI 0x00000009L
-#define TULIP_21142_SIATXRX_AUI 0x00000705L
-#define TULIP_21142_SIAGEN_AUI 0x0000000EL
-
-#define TULIP_21142_SIACONN_BNC 0x00000009L
-#define TULIP_21142_SIATXRX_BNC 0x00000705L
-#define TULIP_21142_SIAGEN_BNC 0x00000006L
-
-
-
-
-#define TULIP_WATCHDOG_TXDISABLE 0x00000001L
-#define TULIP_WATCHDOG_RXDISABLE 0x00000010L
-
-#define TULIP_BUSMODE_SWRESET 0x00000001L
-#define TULIP_BUSMODE_DESCSKIPLEN_MASK 0x0000007CL
-#define TULIP_BUSMODE_BIGENDIAN 0x00000080L
-#define TULIP_BUSMODE_BURSTLEN_MASK 0x00003F00L
-#define TULIP_BUSMODE_BURSTLEN_DEFAULT 0x00000000L
-#define TULIP_BUSMODE_BURSTLEN_1LW 0x00000100L
-#define TULIP_BUSMODE_BURSTLEN_2LW 0x00000200L
-#define TULIP_BUSMODE_BURSTLEN_4LW 0x00000400L
-#define TULIP_BUSMODE_BURSTLEN_8LW 0x00000800L
-#define TULIP_BUSMODE_BURSTLEN_16LW 0x00001000L
-#define TULIP_BUSMODE_BURSTLEN_32LW 0x00002000L
-#define TULIP_BUSMODE_CACHE_NOALIGN 0x00000000L
-#define TULIP_BUSMODE_CACHE_ALIGN8 0x00004000L
-#define TULIP_BUSMODE_CACHE_ALIGN16 0x00008000L
-#define TULIP_BUSMODE_CACHE_ALIGN32 0x0000C000L
-#define TULIP_BUSMODE_TXPOLL_NEVER 0x00000000L
-#define TULIP_BUSMODE_TXPOLL_200000ns 0x00020000L
-#define TULIP_BUSMODE_TXPOLL_800000ns 0x00040000L
-#define TULIP_BUSMODE_TXPOLL_1600000ns 0x00060000L
-#define TULIP_BUSMODE_TXPOLL_12800ns 0x00080000L /* 21041 only */
-#define TULIP_BUSMODE_TXPOLL_25600ns 0x000A0000L /* 21041 only */
-#define TULIP_BUSMODE_TXPOLL_51200ns 0x000C0000L /* 21041 only */
-#define TULIP_BUSMODE_TXPOLL_102400ns 0x000E0000L /* 21041 only */
-#define TULIP_BUSMODE_DESC_BIGENDIAN 0x00100000L /* 21041 only */
-#define TULIP_BUSMODE_READMULTIPLE 0x00200000L /* */
-
-#define TULIP_REG_CFDA 0x40
-#define TULIP_CFDA_SLEEP 0x80000000L
-#define TULIP_CFDA_SNOOZE 0x40000000L
-
-#define TULIP_GP_PINSET 0x00000100L
-/*
- * These are the defintitions used for the DEC 21140
- * evaluation board.
- */
-#define TULIP_GP_EB_PINS 0x0000001F /* General Purpose Pin directions */
-#define TULIP_GP_EB_OK10 0x00000080 /* 10 Mb/sec Signal Detect gep<7> */
-#define TULIP_GP_EB_OK100 0x00000040 /* 100 Mb/sec Signal Detect gep<6> */
-#define TULIP_GP_EB_INIT 0x0000000B /* No loopback --- point-to-point */
-
-/*
- * These are the defintitions used for the SMC9332 (21140) board.
- */
-#define TULIP_GP_SMC_9332_PINS 0x0000003F /* General Purpose Pin directions */
-#define TULIP_GP_SMC_9332_OK10 0x00000080 /* 10 Mb/sec Signal Detect gep<7> */
-#define TULIP_GP_SMC_9332_OK100 0x00000040 /* 100 Mb/sec Signal Detect gep<6> */
-#define TULIP_GP_SMC_9332_INIT 0x00000009 /* No loopback --- point-to-point */
-
-/*
- * There are the definitions used for the DEC DE500
- * 10/100 family of boards
- */
-#define TULIP_GP_DE500_PINS 0x0000001FL
-#define TULIP_GP_DE500_LINK_PASS 0x00000080L
-#define TULIP_GP_DE500_SYM_LINK 0x00000040L
-#define TULIP_GP_DE500_SIGNAL_DETECT 0x00000020L
-#define TULIP_GP_DE500_PHY_RESET 0x00000010L
-#define TULIP_GP_DE500_HALFDUPLEX 0x00000008L
-#define TULIP_GP_DE500_PHY_LOOPBACK 0x00000004L
-#define TULIP_GP_DE500_FORCE_LED 0x00000002L
-#define TULIP_GP_DE500_FORCE_100 0x00000001L
-
-/*
- * These are the defintitions used for the Cogent EM100
- * 21140 board.
- */
-#define TULIP_GP_EM100_PINS 0x0000003F /* General Purpose Pin directions */
-#define TULIP_GP_EM100_INIT 0x00000009 /* No loopback --- point-to-point */
-#define TULIP_COGENT_EM100TX_ID 0x12
-#define TULIP_COGENT_EM100FX_ID 0x15
-
-
-/*
- * These are the defintitions used for the Znyx ZX342
- * 10/100 board
- */
-#define TULIP_ZNYX_ID_ZX312 0x0602
-#define TULIP_ZNYX_ID_ZX312T 0x0622
-#define TULIP_ZNYX_ID_ZX314_INTA 0x0701
-#define TULIP_ZNYX_ID_ZX314 0x0711
-#define TULIP_ZNYX_ID_ZX315_INTA 0x0801
-#define TULIP_ZNYX_ID_ZX315 0x0811
-#define TULIP_ZNYX_ID_ZX342 0x0901
-#define TULIP_ZNYX_ID_ZX342B 0x0921
-#define TULIP_ZNYX_ID_ZX342_X3 0x0902
-#define TULIP_ZNYX_ID_ZX342_X4 0x0903
-#define TULIP_ZNYX_ID_ZX344 0x0A01
-#define TULIP_ZNYX_ID_ZX351 0x0B01
-#define TULIP_ZNYX_ID_ZX345 0x0C01
-#define TULIP_ZNYX_ID_ZX311 0x0D01
-#define TULIP_ZNYX_ID_ZX346 0x0E01
-
-#define TULIP_GP_ZX34X_PINS 0x0000001F /* General Purpose Pin directions */
-#define TULIP_GP_ZX344_PINS 0x0000000B /* General Purpose Pin directions */
-#define TULIP_GP_ZX345_PINS 0x00000003 /* General Purpose Pin directions */
-#define TULIP_GP_ZX346_PINS 0x00000043 /* General Purpose Pin directions */
-#define TULIP_GP_ZX34X_LNKFAIL 0x00000080 /* 10Mb/s Link Failure */
-#define TULIP_GP_ZX34X_SYMDET 0x00000040 /* 100Mb/s Symbol Detect */
-#define TULIP_GP_ZX345_PHYACT 0x00000040 /* PHY Activity */
-#define TULIP_GP_ZX34X_SIGDET 0x00000020 /* 100Mb/s Signal Detect */
-#define TULIP_GP_ZX346_AUTONEG_ENABLED 0x00000020 /* 802.3u autoneg enabled */
-#define TULIP_GP_ZX342_COLENA 0x00000008 /* 10t Ext LB */
-#define TULIP_GP_ZX344_ROTINT 0x00000008 /* PPB IRQ rotation */
-#define TULIP_GP_ZX345_SPEED10 0x00000008 /* 10Mb speed detect */
-#define TULIP_GP_ZX346_SPEED100 0x00000008 /* 100Mb speed detect */
-#define TULIP_GP_ZX34X_NCOLENA 0x00000004 /* 10t Int LB */
-#define TULIP_GP_ZX34X_RXMATCH 0x00000004 /* RX Match */
-#define TULIP_GP_ZX346_FULLDUPLEX 0x00000004 /* Full Duplex Sensed */
-#define TULIP_GP_ZX34X_LB102 0x00000002 /* 100tx twister LB */
-#define TULIP_GP_ZX34X_NLB101 0x00000001 /* PDT/PDR LB */
-#define TULIP_GP_ZX34X_INIT 0x00000009
-
-/*
- * Asante's stuff...
- */
-#define TULIP_GP_ASANTE_PINS 0x000000bf /* GP pin config */
-#define TULIP_GP_ASANTE_PHYRESET 0x00000008 /* Reset PHY */
-
-/*
- * ACCTON EN1207 specialties
- */
-
-#define TULIP_CSR8_EN1207 0x08
-#define TULIP_CSR9_EN1207 0x00
-#define TULIP_CSR10_EN1207 0x03
-#define TULIP_CSR11_EN1207 0x1F
-
-#define TULIP_GP_EN1207_BNC_INIT 0x0000011B
-#define TULIP_GP_EN1207_UTP_INIT 0x9E00000B
-#define TULIP_GP_EN1207_100_INIT 0x6D00031B
-
-/*
- * SROM definitions for the 21140 and 21041.
- */
-#define SROMXREG 0x0400
-#define SROMSEL 0x0800
-#define SROMRD 0x4000
-#define SROMWR 0x2000
-#define SROMDIN 0x0008
-#define SROMDOUT 0x0004
-#define SROMDOUTON 0x0004
-#define SROMDOUTOFF 0x0004
-#define SROMCLKON 0x0002
-#define SROMCLKOFF 0x0002
-#define SROMCSON 0x0001
-#define SROMCSOFF 0x0001
-#define SROMCS 0x0001
-
-#define SROMCMD_MODE 4
-#define SROMCMD_WR 5
-#define SROMCMD_RD 6
-
-#define SROM_BITWIDTH 6
-
-/*
- * MII Definitions for the 21041 and 21140/21140A/21142
- */
-#define MII_PREAMBLE (~0)
-#define MII_TEST 0xAAAAAAAA
-#define MII_RDCMD 0xF6 /* 1111.0110 */
-#define MII_WRCMD 0xF5 /* 1111.0101 */
-#define MII_DIN 0x00080000
-#define MII_RD 0x00040000
-#define MII_WR 0x00000000
-#define MII_DOUT 0x00020000
-#define MII_CLK 0x00010000
-#define MII_CLKON MII_CLK
-#define MII_CLKOFF MII_CLK
-
-#define PHYREG_CONTROL 0
-#define PHYREG_STATUS 1
-#define PHYREG_IDLOW 2
-#define PHYREG_IDHIGH 3
-#define PHYREG_AUTONEG_ADVERTISEMENT 4
-#define PHYREG_AUTONEG_ABILITIES 5
-#define PHYREG_AUTONEG_EXPANSION 6
-#define PHYREG_AUTONEG_NEXTPAGE 7
-
-#define PHYSTS_100BASET4 0x8000
-#define PHYSTS_100BASETX_FD 0x4000
-#define PHYSTS_100BASETX 0x2000
-#define PHYSTS_10BASET_FD 0x1000
-#define PHYSTS_10BASET 0x0800
-#define PHYSTS_AUTONEG_DONE 0x0020
-#define PHYSTS_REMOTE_FAULT 0x0010
-#define PHYSTS_CAN_AUTONEG 0x0008
-#define PHYSTS_LINK_UP 0x0004
-#define PHYSTS_JABBER_DETECT 0x0002
-#define PHYSTS_EXTENDED_REGS 0x0001
-
-#define PHYCTL_RESET 0x8000
-#define PHYCTL_SELECT_100MB 0x2000
-#define PHYCTL_AUTONEG_ENABLE 0x1000
-#define PHYCTL_ISOLATE 0x0400
-#define PHYCTL_AUTONEG_RESTART 0x0200
-#define PHYCTL_FULL_DUPLEX 0x0100
-
-/*
- * Definitions for the DE425.
- */
-#define DE425_CFID 0x08 /* Configuration Id */
-#define DE425_CFCS 0x0C /* Configuration Command-Status */
-#define DE425_CFRV 0x18 /* Configuration Revision */
-#define DE425_CFLT 0x1C /* Configuration Latency Timer */
-#define DE425_CBIO 0x28 /* Configuration Base IO Address */
-#define DE425_CFDA 0x2C /* Configuration Driver Area */
-#define DE425_ENETROM_OFFSET 0xC90 /* Offset in I/O space for ENETROM */
-#define DE425_CFG0 0xC88 /* IRQ register */
-#define DE425_EISAID 0x10a34250 /* EISA device id */
-#define DE425_EISA_IOSIZE 0x100
-
-#define DEC_VENDORID 0x1011
-#define CHIPID_21040 0x0002
-#define CHIPID_21140 0x0009
-#define CHIPID_21041 0x0014
-#define CHIPID_21142 0x0019
-#define PCI_VENDORID(x) ((x) & 0xFFFF)
-#define PCI_CHIPID(x) (((x) >> 16) & 0xFFFF)
-
-/*
- * Generic SROM Format
- *
- *
- */
-
-typedef struct {
- u_int8_t sh_idbuf[18];
- u_int8_t sh_version;
- u_int8_t sh_adapter_count;
- u_int8_t sh_ieee802_address[6];
-} tulip_srom_header_t;
-
-typedef struct {
- u_int8_t sai_device;
- u_int8_t sai_leaf_offset_lowbyte;
- u_int8_t sai_leaf_offset_highbyte;
-} tulip_srom_adapter_info_t;
-
-typedef enum {
- TULIP_SROM_CONNTYPE_10BASET =0x0000,
- TULIP_SROM_CONNTYPE_BNC =0x0001,
- TULIP_SROM_CONNTYPE_AUI =0x0002,
- TULIP_SROM_CONNTYPE_100BASETX =0x0003,
- TULIP_SROM_CONNTYPE_100BASET4 =0x0006,
- TULIP_SROM_CONNTYPE_100BASEFX =0x0007,
- TULIP_SROM_CONNTYPE_MII_10BASET =0x0009,
- TULIP_SROM_CONNTYPE_MII_100BASETX =0x000D,
- TULIP_SROM_CONNTYPE_MII_100BASET4 =0x000F,
- TULIP_SROM_CONNTYPE_MII_100BASEFX =0x0010,
- TULIP_SROM_CONNTYPE_10BASET_NWAY =0x0100,
- TULIP_SROM_CONNTYPE_10BASET_FD =0x0204,
- TULIP_SROM_CONNTYPE_MII_10BASET_FD =0x020A,
- TULIP_SROM_CONNTYPE_100BASETX_FD =0x020E,
- TULIP_SROM_CONNTYPE_MII_100BASETX_FD =0x0211,
- TULIP_SROM_CONNTYPE_10BASET_NOLINKPASS =0x0400,
- TULIP_SROM_CONNTYPE_AUTOSENSE =0x0800,
- TULIP_SROM_CONNTYPE_AUTOSENSE_POWERUP =0x8800,
- TULIP_SROM_CONNTYPE_AUTOSENSE_NWAY =0x9000,
- TULIP_SROM_CONNTYPE_NOT_USED =0xFFFF
-} tulip_srom_connection_t;
-
-typedef enum {
- TULIP_SROM_MEDIA_10BASET =0x0000,
- TULIP_SROM_MEDIA_BNC =0x0001,
- TULIP_SROM_MEDIA_AUI =0x0002,
- TULIP_SROM_MEDIA_100BASETX =0x0003,
- TULIP_SROM_MEDIA_10BASET_FD =0x0004,
- TULIP_SROM_MEDIA_100BASETX_FD =0x0005,
- TULIP_SROM_MEDIA_100BASET4 =0x0006,
- TULIP_SROM_MEDIA_100BASEFX =0x0007,
- TULIP_SROM_MEDIA_100BASEFX_FD =0x0008
-} tulip_srom_media_t;
-
-#define TULIP_SROM_21041_EXTENDED 0x40
-
-#define TULIP_SROM_2114X_NOINDICATOR 0x8000
-#define TULIP_SROM_2114X_DEFAULT 0x4000
-#define TULIP_SROM_2114X_POLARITY 0x0080
-#define TULIP_SROM_2114X_CMDBITS(n) (((n) & 0x0071) << 18)
-#define TULIP_SROM_2114X_BITPOS(b) (1 << (((b) & 0x0E) >> 1))
-
-
-
-#endif /* !defined(_DC21040_H) */
diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c
deleted file mode 100644
index c8bf575..0000000
--- a/sys/dev/de/if_de.c
+++ /dev/null
@@ -1,5229 +0,0 @@
-/* $NetBSD: if_de.c,v 1.86 1999/06/01 19:17:59 thorpej Exp $ */
-/*-
- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- *
- * Id: if_de.c,v 1.94 1997/07/03 16:55:07 thomas Exp
- */
-
-/*
- * DEC 21040 PCI Ethernet Controller
- *
- * Written by Matt Thomas
- * BPF support code stolen directly from if_ec.c
- *
- * This driver supports the DEC DE435 or any other PCI
- * board which support 21040, 21041, or 21140 (mostly).
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#define TULIP_HDR_DATA
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/endian.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/eventhandler.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-#include <net/if_dl.h>
-#ifdef TULIP_USE_SOFTINTR
-#include <net/netisr.h>
-#endif
-
-#include <net/bpf.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <vm/vm.h>
-
-#include <net/if_var.h>
-#include <vm/pmap.h>
-#include <dev/pci/pcivar.h>
-#include <dev/pci/pcireg.h>
-#include <pci/dc21040reg.h>
-
-/*
- * Intel CPUs should use I/O mapped access.
- */
-#if defined(__i386__)
-#define TULIP_IOMAPPED
-#endif
-
-#if 0
-/*
- * This turns on all sort of debugging stuff and make the
- * driver much larger.
- */
-#define TULIP_DEBUG
-#endif
-
-#if 0
-#define TULIP_PERFSTATS
-#endif
-
-#if 0
-#define TULIP_USE_SOFTINTR
-#endif
-
-#define TULIP_HZ 10
-
-#include <pci/if_devar.h>
-
-/*
- * This module supports
- * the DEC 21040 PCI Ethernet Controller.
- * the DEC 21041 PCI Ethernet Controller.
- * the DEC 21140 PCI Fast Ethernet Controller.
- */
-static void tulip_addr_filter(tulip_softc_t * const sc);
-static void tulip_ifinit(void *);
-static int tulip_ifmedia_change(struct ifnet * const ifp);
-static void tulip_ifmedia_status(struct ifnet * const ifp,
- struct ifmediareq *req);
-static void tulip_ifstart(struct ifnet *ifp);
-static void tulip_init(tulip_softc_t * const sc);
-static void tulip_intr_shared(void *arg);
-static void tulip_intr_normal(void *arg);
-static void tulip_mii_autonegotiate(tulip_softc_t * const sc,
- const unsigned phyaddr);
-static int tulip_mii_map_abilities(tulip_softc_t * const sc,
- unsigned abilities);
-static tulip_media_t
- tulip_mii_phy_readspecific(tulip_softc_t * const sc);
-static unsigned tulip_mii_readreg(tulip_softc_t * const sc, unsigned devaddr,
- unsigned regno);
-static void tulip_mii_writereg(tulip_softc_t * const sc, unsigned devaddr,
- unsigned regno, unsigned data);
-static void tulip_reset(tulip_softc_t * const sc);
-static void tulip_rx_intr(tulip_softc_t * const sc);
-static int tulip_srom_decode(tulip_softc_t * const sc);
-static struct mbuf *
- tulip_txput(tulip_softc_t * const sc, struct mbuf *m);
-static void tulip_txput_setup(tulip_softc_t * const sc);
-
-static void
-tulip_timeout_callback(
- void *arg)
-{
- tulip_softc_t * const sc = arg;
- int s = splimp();
-
- TULIP_PERFSTART(timeout)
-
- sc->tulip_flags &= ~TULIP_TIMEOUTPENDING;
- sc->tulip_probe_timeout -= 1000 / TULIP_HZ;
- (sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_TIMER);
-
- TULIP_PERFEND(timeout);
- splx(s);
-}
-
-static void
-tulip_timeout(
- tulip_softc_t * const sc)
-{
- if (sc->tulip_flags & TULIP_TIMEOUTPENDING)
- return;
- sc->tulip_flags |= TULIP_TIMEOUTPENDING;
- timeout(tulip_timeout_callback, sc, (hz + TULIP_HZ / 2) / TULIP_HZ);
-}
-
-#if defined(TULIP_NEED_FASTTIMEOUT)
-static void
-tulip_fasttimeout_callback(
- void *arg)
-{
- tulip_softc_t * const sc = arg;
- int s = splimp();
-
- sc->tulip_flags &= ~TULIP_FASTTIMEOUTPENDING;
- (sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_FASTTIMER);
- splx(s);
-}
-
-static void
-tulip_fasttimeout(
- tulip_softc_t * const sc)
-{
- if (sc->tulip_flags & TULIP_FASTTIMEOUTPENDING)
- return;
- sc->tulip_flags |= TULIP_FASTTIMEOUTPENDING;
- timeout(tulip_fasttimeout_callback, sc, 1);
-}
-#endif
-
-static int
-tulip_txprobe(
- tulip_softc_t * const sc)
-{
- struct mbuf *m;
- /*
- * Before we are sure this is the right media we need
- * to send a small packet to make sure there's carrier.
- * Strangely, BNC and AUI will "see" receive data if
- * either is connected so the transmit is the only way
- * to verify the connectivity.
- */
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == NULL)
- return 0;
- /*
- * Construct a LLC TEST message which will point to ourselves.
- */
- bcopy(IFP2ENADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_dhost, 6);
- bcopy(IFP2ENADDR(sc->tulip_ifp), mtod(m, struct ether_header *)->ether_shost, 6);
- mtod(m, struct ether_header *)->ether_type = htons(3);
- mtod(m, unsigned char *)[14] = 0;
- mtod(m, unsigned char *)[15] = 0;
- mtod(m, unsigned char *)[16] = 0xE3; /* LLC Class1 TEST (no poll) */
- m->m_len = m->m_pkthdr.len = sizeof(struct ether_header) + 3;
- /*
- * send it!
- */
- sc->tulip_cmdmode |= TULIP_CMD_TXRUN;
- sc->tulip_intrmask |= TULIP_STS_TXINTR;
- sc->tulip_flags |= TULIP_TXPROBE_ACTIVE;
- TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
- TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
- if ((m = tulip_txput(sc, m)) != NULL)
- m_freem(m);
- sc->tulip_probe.probe_txprobes++;
- return 1;
-}
-
-#ifdef BIG_PACKET
-#define TULIP_SIAGEN_WATCHDOG (sc->tulip_ifp->if_mtu > ETHERMTU ? TULIP_WATCHDOG_RXDISABLE|TULIP_WATCHDOG_TXDISABLE : 0)
-#else
-#define TULIP_SIAGEN_WATCHDOG 0
-#endif
-
-static void
-tulip_media_set(
- tulip_softc_t * const sc,
- tulip_media_t media)
-{
- const tulip_media_info_t *mi = sc->tulip_mediums[media];
-
- if (mi == NULL)
- return;
-
- /*
- * If we are switching media, make sure we don't think there's
- * any stale RX activity
- */
- sc->tulip_flags &= ~TULIP_RXACT;
- if (mi->mi_type == TULIP_MEDIAINFO_SIA) {
- TULIP_CSR_WRITE(sc, csr_sia_connectivity, TULIP_SIACONN_RESET);
- TULIP_CSR_WRITE(sc, csr_sia_tx_rx, mi->mi_sia_tx_rx);
- if (sc->tulip_features & TULIP_HAVE_SIAGP) {
- TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_sia_gp_control|mi->mi_sia_general|TULIP_SIAGEN_WATCHDOG);
- DELAY(50);
- TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_sia_gp_data|mi->mi_sia_general|TULIP_SIAGEN_WATCHDOG);
- } else {
- TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_sia_general|TULIP_SIAGEN_WATCHDOG);
- }
- TULIP_CSR_WRITE(sc, csr_sia_connectivity, mi->mi_sia_connectivity);
- } else if (mi->mi_type == TULIP_MEDIAINFO_GPR) {
-#define TULIP_GPR_CMDBITS (TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION|TULIP_CMD_SCRAMBLER|TULIP_CMD_TXTHRSHLDCTL)
- /*
- * If the cmdmode bits don't match the currently operating mode,
- * set the cmdmode appropriately and reset the chip.
- */
- if (((mi->mi_cmdmode ^ TULIP_CSR_READ(sc, csr_command)) & TULIP_GPR_CMDBITS) != 0) {
- sc->tulip_cmdmode &= ~TULIP_GPR_CMDBITS;
- sc->tulip_cmdmode |= mi->mi_cmdmode;
- tulip_reset(sc);
- }
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_PINSET|sc->tulip_gpinit);
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_gp, (u_int8_t) mi->mi_gpdata);
- } else if (mi->mi_type == TULIP_MEDIAINFO_SYM) {
- /*
- * If the cmdmode bits don't match the currently operating mode,
- * set the cmdmode appropriately and reset the chip.
- */
- if (((mi->mi_cmdmode ^ TULIP_CSR_READ(sc, csr_command)) & TULIP_GPR_CMDBITS) != 0) {
- sc->tulip_cmdmode &= ~TULIP_GPR_CMDBITS;
- sc->tulip_cmdmode |= mi->mi_cmdmode;
- tulip_reset(sc);
- }
- TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_gpcontrol);
- TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_gpdata);
- } else if (mi->mi_type == TULIP_MEDIAINFO_MII
- && sc->tulip_probe_state != TULIP_PROBE_INACTIVE) {
- int idx;
- if (sc->tulip_features & TULIP_HAVE_SIAGP) {
- const u_int8_t *dp;
- dp = &sc->tulip_rombuf[mi->mi_reset_offset];
- for (idx = 0; idx < mi->mi_reset_length; idx++, dp += 2) {
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_sia_general, (dp[0] + 256 * dp[1]) << 16);
- }
- sc->tulip_phyaddr = mi->mi_phyaddr;
- dp = &sc->tulip_rombuf[mi->mi_gpr_offset];
- for (idx = 0; idx < mi->mi_gpr_length; idx++, dp += 2) {
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_sia_general, (dp[0] + 256 * dp[1]) << 16);
- }
- } else {
- for (idx = 0; idx < mi->mi_reset_length; idx++) {
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_reset_offset + idx]);
- }
- sc->tulip_phyaddr = mi->mi_phyaddr;
- for (idx = 0; idx < mi->mi_gpr_length; idx++) {
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_gpr_offset + idx]);
- }
- }
- if (sc->tulip_flags & TULIP_TRYNWAY) {
- tulip_mii_autonegotiate(sc, sc->tulip_phyaddr);
- } else if ((sc->tulip_flags & TULIP_DIDNWAY) == 0) {
- u_int32_t data = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_CONTROL);
- data &= ~(PHYCTL_SELECT_100MB|PHYCTL_FULL_DUPLEX|PHYCTL_AUTONEG_ENABLE);
- sc->tulip_flags &= ~TULIP_DIDNWAY;
- if (TULIP_IS_MEDIA_FD(media))
- data |= PHYCTL_FULL_DUPLEX;
- if (TULIP_IS_MEDIA_100MB(media))
- data |= PHYCTL_SELECT_100MB;
- tulip_mii_writereg(sc, sc->tulip_phyaddr, PHYREG_CONTROL, data);
- }
- }
-}
-
-static void
-tulip_linkup(
- tulip_softc_t * const sc,
- tulip_media_t media)
-{
- if ((sc->tulip_flags & TULIP_LINKUP) == 0)
- sc->tulip_flags |= TULIP_PRINTLINKUP;
- sc->tulip_flags |= TULIP_LINKUP;
- sc->tulip_ifp->if_flags &= ~IFF_OACTIVE;
-#if 0 /* XXX how does with work with ifmedia? */
- if ((sc->tulip_flags & TULIP_DIDNWAY) == 0) {
- if (sc->tulip_ifp->if_flags & IFF_FULLDUPLEX) {
- if (TULIP_CAN_MEDIA_FD(media)
- && sc->tulip_mediums[TULIP_FD_MEDIA_OF(media)] != NULL)
- media = TULIP_FD_MEDIA_OF(media);
- } else {
- if (TULIP_IS_MEDIA_FD(media)
- && sc->tulip_mediums[TULIP_HD_MEDIA_OF(media)] != NULL)
- media = TULIP_HD_MEDIA_OF(media);
- }
- }
-#endif
- if (sc->tulip_media != media) {
-#ifdef TULIP_DEBUG
- sc->tulip_dbg.dbg_last_media = sc->tulip_media;
-#endif
- sc->tulip_media = media;
- sc->tulip_flags |= TULIP_PRINTMEDIA;
- if (TULIP_IS_MEDIA_FD(sc->tulip_media)) {
- sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX;
- } else if (sc->tulip_chipid != TULIP_21041 || (sc->tulip_flags & TULIP_DIDNWAY) == 0) {
- sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX;
- }
- }
- /*
- * We could set probe_timeout to 0 but setting to 3000 puts this
- * in one central place and the only matters is tulip_link is
- * followed by a tulip_timeout. Therefore setting it should not
- * result in aberrant behavour.
- */
- sc->tulip_probe_timeout = 3000;
- sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
- sc->tulip_flags &= ~(TULIP_TXPROBE_ACTIVE|TULIP_TRYNWAY);
- if (sc->tulip_flags & TULIP_INRESET) {
- tulip_media_set(sc, sc->tulip_media);
- } else if (sc->tulip_probe_media != sc->tulip_media) {
- /*
- * No reason to change media if we have the right media.
- */
- tulip_reset(sc);
- }
- tulip_init(sc);
-}
-
-static void
-tulip_media_print(
- tulip_softc_t * const sc)
-{
- struct ifnet *ifp = sc->tulip_ifp;
-
- if ((sc->tulip_flags & TULIP_LINKUP) == 0)
- return;
- if (sc->tulip_flags & TULIP_PRINTMEDIA) {
- if_printf(ifp, "enabling %s port\n",
- tulip_mediums[sc->tulip_media]);
- sc->tulip_flags &= ~(TULIP_PRINTMEDIA|TULIP_PRINTLINKUP);
- } else if (sc->tulip_flags & TULIP_PRINTLINKUP) {
- if_printf(ifp, "link up\n");
- sc->tulip_flags &= ~TULIP_PRINTLINKUP;
- }
-}
-
-#if defined(TULIP_DO_GPR_SENSE)
-static tulip_media_t
-tulip_21140_gpr_media_sense(
- tulip_softc_t * const sc)
-{
- struct ifnet *ifp sc->tulip_ifp;
- tulip_media_t maybe_media = TULIP_MEDIA_UNKNOWN;
- tulip_media_t last_media = TULIP_MEDIA_UNKNOWN;
- tulip_media_t media;
-
- /*
- * If one of the media blocks contained a default media flag,
- * use that.
- */
- for (media = TULIP_MEDIA_UNKNOWN; media < TULIP_MEDIA_MAX; media++) {
- const tulip_media_info_t *mi;
- /*
- * Media is not supported (or is full-duplex).
- */
- if ((mi = sc->tulip_mediums[media]) == NULL || TULIP_IS_MEDIA_FD(media))
- continue;
- if (mi->mi_type != TULIP_MEDIAINFO_GPR)
- continue;
-
- /*
- * Remember the media is this is the "default" media.
- */
- if (mi->mi_default && maybe_media == TULIP_MEDIA_UNKNOWN)
- maybe_media = media;
-
- /*
- * No activity mask? Can't see if it is active if there's no mask.
- */
- if (mi->mi_actmask == 0)
- continue;
-
- /*
- * Does the activity data match?
- */
- if ((TULIP_CSR_READ(sc, csr_gp) & mi->mi_actmask) != mi->mi_actdata)
- continue;
-
-#if defined(TULIP_DEBUG)
- if_printf(ifp, "gpr_media_sense: %s: 0x%02x & 0x%02x == 0x%02x\n",
- tulip_mediums[media],
- TULIP_CSR_READ(sc, csr_gp) & 0xFF,
- mi->mi_actmask, mi->mi_actdata);
-#endif
- /*
- * It does! If this is the first media we detected, then
- * remember this media. If isn't the first, then there were
- * multiple matches which we equate to no match (since we don't
- * which to select (if any).
- */
- if (last_media == TULIP_MEDIA_UNKNOWN) {
- last_media = media;
- } else if (last_media != media) {
- last_media = TULIP_MEDIA_UNKNOWN;
- }
- }
- return (last_media != TULIP_MEDIA_UNKNOWN) ? last_media : maybe_media;
-}
-#endif /* TULIP_DO_GPR_SENSE */
-
-static tulip_link_status_t
-tulip_media_link_monitor(
- tulip_softc_t * const sc)
-{
- struct ifnet *ifp = sc->tulip_ifp;
- const tulip_media_info_t * const mi = sc->tulip_mediums[sc->tulip_media];
- tulip_link_status_t linkup = TULIP_LINK_DOWN;
-
- if (mi == NULL) {
-#if defined(DIAGNOSTIC) || defined(TULIP_DEBUG)
- panic("tulip_media_link_monitor: %s: botch at line %d\n",
- tulip_mediums[sc->tulip_media],__LINE__);
-#else
- return TULIP_LINK_UNKNOWN;
-#endif
- }
-
-
- /*
- * Have we seen some packets? If so, the link must be good.
- */
- if ((sc->tulip_flags & (TULIP_RXACT|TULIP_LINKUP)) == (TULIP_RXACT|TULIP_LINKUP)) {
- sc->tulip_flags &= ~TULIP_RXACT;
- sc->tulip_probe_timeout = 3000;
- return TULIP_LINK_UP;
- }
-
- sc->tulip_flags &= ~TULIP_RXACT;
- if (mi->mi_type == TULIP_MEDIAINFO_MII) {
- u_int32_t status;
- /*
- * Read the PHY status register.
- */
- status = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_STATUS);
- if (status & PHYSTS_AUTONEG_DONE) {
- /*
- * If the PHY has completed autonegotiation, see the if the
- * remote systems abilities have changed. If so, upgrade or
- * downgrade as appropriate.
- */
- u_int32_t abilities = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_AUTONEG_ABILITIES);
- abilities = (abilities << 6) & status;
- if (abilities != sc->tulip_abilities) {
-#if defined(TULIP_DEBUG)
- loudprintf("%s(phy%d): autonegotiation changed: 0x%04x -> 0x%04x\n",
- ifp->if_xname, sc->tulip_phyaddr,
- sc->tulip_abilities, abilities);
-#endif
- if (tulip_mii_map_abilities(sc, abilities)) {
- tulip_linkup(sc, sc->tulip_probe_media);
- return TULIP_LINK_UP;
- }
- /*
- * if we had selected media because of autonegotiation,
- * we need to probe for the new media.
- */
- sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
- if (sc->tulip_flags & TULIP_DIDNWAY)
- return TULIP_LINK_DOWN;
- }
- }
- /*
- * The link is now up. If was down, say its back up.
- */
- if ((status & (PHYSTS_LINK_UP|PHYSTS_REMOTE_FAULT)) == PHYSTS_LINK_UP)
- linkup = TULIP_LINK_UP;
- } else if (mi->mi_type == TULIP_MEDIAINFO_GPR) {
- /*
- * No activity sensor? Assume all's well.
- */
- if (mi->mi_actmask == 0)
- return TULIP_LINK_UNKNOWN;
- /*
- * Does the activity data match?
- */
- if ((TULIP_CSR_READ(sc, csr_gp) & mi->mi_actmask) == mi->mi_actdata)
- linkup = TULIP_LINK_UP;
- } else if (mi->mi_type == TULIP_MEDIAINFO_SIA) {
- /*
- * Assume non TP ok for now.
- */
- if (!TULIP_IS_MEDIA_TP(sc->tulip_media))
- return TULIP_LINK_UNKNOWN;
- if ((TULIP_CSR_READ(sc, csr_sia_status) & TULIP_SIASTS_LINKFAIL) == 0)
- linkup = TULIP_LINK_UP;
-#if defined(TULIP_DEBUG)
- if (sc->tulip_probe_timeout <= 0)
- if_printf(ifp, "sia status = 0x%08x\n",
- TULIP_CSR_READ(sc, csr_sia_status));
-#endif
- } else if (mi->mi_type == TULIP_MEDIAINFO_SYM) {
- return TULIP_LINK_UNKNOWN;
- }
- /*
- * We will wait for 3 seconds until the link goes into suspect mode.
- */
- if (sc->tulip_flags & TULIP_LINKUP) {
- if (linkup == TULIP_LINK_UP)
- sc->tulip_probe_timeout = 3000;
- if (sc->tulip_probe_timeout > 0)
- return TULIP_LINK_UP;
-
- sc->tulip_flags &= ~TULIP_LINKUP;
- if_printf(ifp, "link down: cable problem?\n");
- }
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_link_downed++;
-#endif
- return TULIP_LINK_DOWN;
-}
-
-static void
-tulip_media_poll(
- tulip_softc_t * const sc,
- tulip_mediapoll_event_t event)
-{
- struct ifnet *ifp = sc->tulip_ifp;
-
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_events[event]++;
-#endif
- if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE
- && event == TULIP_MEDIAPOLL_TIMER) {
- switch (tulip_media_link_monitor(sc)) {
- case TULIP_LINK_DOWN: {
- /*
- * Link Monitor failed. Probe for new media.
- */
- event = TULIP_MEDIAPOLL_LINKFAIL;
- break;
- }
- case TULIP_LINK_UP: {
- /*
- * Check again soon.
- */
- tulip_timeout(sc);
- return;
- }
- case TULIP_LINK_UNKNOWN: {
- /*
- * We can't tell so don't bother.
- */
- return;
- }
- }
- }
-
- if (event == TULIP_MEDIAPOLL_LINKFAIL) {
- if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE) {
- if (TULIP_DO_AUTOSENSE(sc)) {
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_link_failures++;
-#endif
- sc->tulip_media = TULIP_MEDIA_UNKNOWN;
- if (sc->tulip_ifp->if_flags & IFF_UP)
- tulip_reset(sc); /* restart probe */
- }
- return;
- }
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_link_pollintrs++;
-#endif
- }
-
- if (event == TULIP_MEDIAPOLL_START) {
- sc->tulip_ifp->if_flags |= IFF_OACTIVE;
- if (sc->tulip_probe_state != TULIP_PROBE_INACTIVE)
- return;
- sc->tulip_probe_mediamask = 0;
- sc->tulip_probe_passes = 0;
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_media_probes++;
-#endif
- /*
- * If the SROM contained an explicit media to use, use it.
- */
- sc->tulip_cmdmode &= ~(TULIP_CMD_RXRUN|TULIP_CMD_FULLDUPLEX);
- sc->tulip_flags |= TULIP_TRYNWAY|TULIP_PROBE1STPASS;
- sc->tulip_flags &= ~(TULIP_DIDNWAY|TULIP_PRINTMEDIA|TULIP_PRINTLINKUP);
- /*
- * connidx is defaulted to a media_unknown type.
- */
- sc->tulip_probe_media = tulip_srom_conninfo[sc->tulip_connidx].sc_media;
- if (sc->tulip_probe_media != TULIP_MEDIA_UNKNOWN) {
- tulip_linkup(sc, sc->tulip_probe_media);
- tulip_timeout(sc);
- return;
- }
-
- if (sc->tulip_features & TULIP_HAVE_GPR) {
- sc->tulip_probe_state = TULIP_PROBE_GPRTEST;
- sc->tulip_probe_timeout = 2000;
- } else {
- sc->tulip_probe_media = TULIP_MEDIA_MAX;
- sc->tulip_probe_timeout = 0;
- sc->tulip_probe_state = TULIP_PROBE_MEDIATEST;
- }
- }
-
- /*
- * Ignore txprobe failures or spurious callbacks.
- */
- if (event == TULIP_MEDIAPOLL_TXPROBE_FAILED
- && sc->tulip_probe_state != TULIP_PROBE_MEDIATEST) {
- sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE;
- return;
- }
-
- /*
- * If we really transmitted a packet, then that's the media we'll use.
- */
- if (event == TULIP_MEDIAPOLL_TXPROBE_OK || event == TULIP_MEDIAPOLL_LINKPASS) {
- if (event == TULIP_MEDIAPOLL_LINKPASS) {
- /* XXX Check media status just to be sure */
- sc->tulip_probe_media = TULIP_MEDIA_10BASET;
-#if defined(TULIP_DEBUG)
- } else {
- sc->tulip_dbg.dbg_txprobes_ok[sc->tulip_probe_media]++;
-#endif
- }
- tulip_linkup(sc, sc->tulip_probe_media);
- tulip_timeout(sc);
- return;
- }
-
- if (sc->tulip_probe_state == TULIP_PROBE_GPRTEST) {
-#if defined(TULIP_DO_GPR_SENSE)
- /*
- * Check for media via the general purpose register.
- *
- * Try to sense the media via the GPR. If the same value
- * occurs 3 times in a row then just use that.
- */
- if (sc->tulip_probe_timeout > 0) {
- tulip_media_t new_probe_media = tulip_21140_gpr_media_sense(sc);
-#if defined(TULIP_DEBUG)
- if_printf(ifp, "media_poll: gpr sensing = %s\n",
- tulip_mediums[new_probe_media]);
-#endif
- if (new_probe_media != TULIP_MEDIA_UNKNOWN) {
- if (new_probe_media == sc->tulip_probe_media) {
- if (--sc->tulip_probe_count == 0)
- tulip_linkup(sc, sc->tulip_probe_media);
- } else {
- sc->tulip_probe_count = 10;
- }
- }
- sc->tulip_probe_media = new_probe_media;
- tulip_timeout(sc);
- return;
- }
-#endif /* TULIP_DO_GPR_SENSE */
- /*
- * Brute force. We cycle through each of the media types
- * and try to transmit a packet.
- */
- sc->tulip_probe_state = TULIP_PROBE_MEDIATEST;
- sc->tulip_probe_media = TULIP_MEDIA_MAX;
- sc->tulip_probe_timeout = 0;
- tulip_timeout(sc);
- return;
- }
-
- if (sc->tulip_probe_state != TULIP_PROBE_MEDIATEST
- && (sc->tulip_features & TULIP_HAVE_MII)) {
- tulip_media_t old_media = sc->tulip_probe_media;
- tulip_mii_autonegotiate(sc, sc->tulip_phyaddr);
- switch (sc->tulip_probe_state) {
- case TULIP_PROBE_FAILED:
- case TULIP_PROBE_MEDIATEST: {
- /*
- * Try the next media.
- */
- sc->tulip_probe_mediamask |= sc->tulip_mediums[sc->tulip_probe_media]->mi_mediamask;
- sc->tulip_probe_timeout = 0;
-#ifdef notyet
- if (sc->tulip_probe_state == TULIP_PROBE_FAILED)
- break;
- if (sc->tulip_probe_media != tulip_mii_phy_readspecific(sc))
- break;
- sc->tulip_probe_timeout = TULIP_IS_MEDIA_TP(sc->tulip_probe_media) ? 2500 : 300;
-#endif
- break;
- }
- case TULIP_PROBE_PHYAUTONEG: {
- return;
- }
- case TULIP_PROBE_INACTIVE: {
- /*
- * Only probe if we autonegotiated a media that hasn't failed.
- */
- sc->tulip_probe_timeout = 0;
- if (sc->tulip_probe_mediamask & TULIP_BIT(sc->tulip_probe_media)) {
- sc->tulip_probe_media = old_media;
- break;
- }
- tulip_linkup(sc, sc->tulip_probe_media);
- tulip_timeout(sc);
- return;
- }
- default: {
-#if defined(DIAGNOSTIC) || defined(TULIP_DEBUG)
- panic("tulip_media_poll: botch at line %d\n", __LINE__);
-#endif
- break;
- }
- }
- }
-
- if (event == TULIP_MEDIAPOLL_TXPROBE_FAILED) {
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_txprobes_failed[sc->tulip_probe_media]++;
-#endif
- sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE;
- return;
- }
-
- /*
- * switch to another media if we tried this one enough.
- */
- if (/* event == TULIP_MEDIAPOLL_TXPROBE_FAILED || */ sc->tulip_probe_timeout <= 0) {
-#if defined(TULIP_DEBUG)
- if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) {
- if_printf(ifp, "poll media unknown!\n");
- sc->tulip_probe_media = TULIP_MEDIA_MAX;
- }
-#endif
- /*
- * Find the next media type to check for. Full Duplex
- * types are not allowed.
- */
- do {
- sc->tulip_probe_media -= 1;
- if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) {
- if (++sc->tulip_probe_passes == 3) {
- if_printf(ifp, "autosense failed: cable problem?\n");
- if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) {
- sc->tulip_ifp->if_flags &= ~IFF_RUNNING;
- sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
- return;
- }
- }
- sc->tulip_flags ^= TULIP_TRYNWAY; /* XXX */
- sc->tulip_probe_mediamask = 0;
- sc->tulip_probe_media = TULIP_MEDIA_MAX - 1;
- }
- } while (sc->tulip_mediums[sc->tulip_probe_media] == NULL
- || (sc->tulip_probe_mediamask & TULIP_BIT(sc->tulip_probe_media))
- || TULIP_IS_MEDIA_FD(sc->tulip_probe_media));
-
-#if defined(TULIP_DEBUG)
- if_printf(ifp, "%s: probing %s\n",
- event == TULIP_MEDIAPOLL_TXPROBE_FAILED ? "txprobe failed" : "timeout",
- tulip_mediums[sc->tulip_probe_media]);
-#endif
- sc->tulip_probe_timeout = TULIP_IS_MEDIA_TP(sc->tulip_probe_media) ? 2500 : 1000;
- sc->tulip_probe_state = TULIP_PROBE_MEDIATEST;
- sc->tulip_probe.probe_txprobes = 0;
- tulip_reset(sc);
- tulip_media_set(sc, sc->tulip_probe_media);
- sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE;
- }
- tulip_timeout(sc);
-
- /*
- * If this is hanging off a phy, we know are doing NWAY and we have
- * forced the phy to a specific speed. Wait for link up before
- * before sending a packet.
- */
- switch (sc->tulip_mediums[sc->tulip_probe_media]->mi_type) {
- case TULIP_MEDIAINFO_MII: {
- if (sc->tulip_probe_media != tulip_mii_phy_readspecific(sc))
- return;
- break;
- }
- case TULIP_MEDIAINFO_SIA: {
- if (TULIP_IS_MEDIA_TP(sc->tulip_probe_media)) {
- if (TULIP_CSR_READ(sc, csr_sia_status) & TULIP_SIASTS_LINKFAIL)
- return;
- tulip_linkup(sc, sc->tulip_probe_media);
-#ifdef notyet
- if (sc->tulip_features & TULIP_HAVE_MII)
- tulip_timeout(sc);
-#endif
- return;
- }
- break;
- }
- case TULIP_MEDIAINFO_RESET:
- case TULIP_MEDIAINFO_SYM:
- case TULIP_MEDIAINFO_NONE:
- case TULIP_MEDIAINFO_GPR: {
- break;
- }
- }
- /*
- * Try to send a packet.
- */
- tulip_txprobe(sc);
-}
-
-static void
-tulip_media_select(
- tulip_softc_t * const sc)
-{
- if (sc->tulip_features & TULIP_HAVE_GPR) {
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_PINSET|sc->tulip_gpinit);
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_gpdata);
- }
- /*
- * If this board has no media, just return
- */
- if (sc->tulip_features & TULIP_HAVE_NOMEDIA)
- return;
-
- if (sc->tulip_media == TULIP_MEDIA_UNKNOWN) {
- TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
- (*sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_START);
- } else {
- tulip_media_set(sc, sc->tulip_media);
- }
-}
-
-static void
-tulip_21040_mediainfo_init(
- tulip_softc_t * const sc,
- tulip_media_t media)
-{
- sc->tulip_cmdmode |= TULIP_CMD_CAPTREFFCT|TULIP_CMD_THRSHLD160
- |TULIP_CMD_BACKOFFCTR;
- sc->tulip_ifp->if_baudrate = 10000000;
-
- if (media == TULIP_MEDIA_10BASET || media == TULIP_MEDIA_UNKNOWN) {
- TULIP_MEDIAINFO_SIA_INIT(sc, &sc->tulip_mediainfo[0], 21040, 10BASET);
- TULIP_MEDIAINFO_SIA_INIT(sc, &sc->tulip_mediainfo[1], 21040, 10BASET_FD);
- sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL;
- }
-
- if (media == TULIP_MEDIA_AUIBNC || media == TULIP_MEDIA_UNKNOWN) {
- TULIP_MEDIAINFO_SIA_INIT(sc, &sc->tulip_mediainfo[2], 21040, AUIBNC);
- }
-
- if (media == TULIP_MEDIA_UNKNOWN) {
- TULIP_MEDIAINFO_SIA_INIT(sc, &sc->tulip_mediainfo[3], 21040, EXTSIA);
- }
-}
-
-static void
-tulip_21040_media_probe(
- tulip_softc_t * const sc)
-{
- tulip_21040_mediainfo_init(sc, TULIP_MEDIA_UNKNOWN);
- return;
-}
-
-static void
-tulip_21040_10baset_only_media_probe(
- tulip_softc_t * const sc)
-{
- tulip_21040_mediainfo_init(sc, TULIP_MEDIA_10BASET);
- tulip_media_set(sc, TULIP_MEDIA_10BASET);
- sc->tulip_media = TULIP_MEDIA_10BASET;
-}
-
-static void
-tulip_21040_10baset_only_media_select(
- tulip_softc_t * const sc)
-{
- sc->tulip_flags |= TULIP_LINKUP;
- if (sc->tulip_media == TULIP_MEDIA_10BASET_FD) {
- sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX;
- sc->tulip_flags &= ~TULIP_SQETEST;
- } else {
- sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX;
- sc->tulip_flags |= TULIP_SQETEST;
- }
- tulip_media_set(sc, sc->tulip_media);
-}
-
-static void
-tulip_21040_auibnc_only_media_probe(
- tulip_softc_t * const sc)
-{
- tulip_21040_mediainfo_init(sc, TULIP_MEDIA_AUIBNC);
- sc->tulip_flags |= TULIP_SQETEST|TULIP_LINKUP;
- tulip_media_set(sc, TULIP_MEDIA_AUIBNC);
- sc->tulip_media = TULIP_MEDIA_AUIBNC;
-}
-
-static void
-tulip_21040_auibnc_only_media_select(
- tulip_softc_t * const sc)
-{
- tulip_media_set(sc, TULIP_MEDIA_AUIBNC);
- sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX;
-}
-
-static const tulip_boardsw_t tulip_21040_boardsw = {
- TULIP_21040_GENERIC,
- tulip_21040_media_probe,
- tulip_media_select,
- tulip_media_poll,
-};
-
-static const tulip_boardsw_t tulip_21040_10baset_only_boardsw = {
- TULIP_21040_GENERIC,
- tulip_21040_10baset_only_media_probe,
- tulip_21040_10baset_only_media_select,
- NULL,
-};
-
-static const tulip_boardsw_t tulip_21040_auibnc_only_boardsw = {
- TULIP_21040_GENERIC,
- tulip_21040_auibnc_only_media_probe,
- tulip_21040_auibnc_only_media_select,
- NULL,
-};
-
-static void
-tulip_21041_mediainfo_init(
- tulip_softc_t * const sc)
-{
- tulip_media_info_t * const mi = sc->tulip_mediainfo;
-
-#ifdef notyet
- if (sc->tulip_revinfo >= 0x20) {
- TULIP_MEDIAINFO_SIA_INIT(sc, &mi[0], 21041P2, 10BASET);
- TULIP_MEDIAINFO_SIA_INIT(sc, &mi[1], 21041P2, 10BASET_FD);
- TULIP_MEDIAINFO_SIA_INIT(sc, &mi[0], 21041P2, AUI);
- TULIP_MEDIAINFO_SIA_INIT(sc, &mi[1], 21041P2, BNC);
- return;
- }
-#endif
- TULIP_MEDIAINFO_SIA_INIT(sc, &mi[0], 21041, 10BASET);
- TULIP_MEDIAINFO_SIA_INIT(sc, &mi[1], 21041, 10BASET_FD);
- TULIP_MEDIAINFO_SIA_INIT(sc, &mi[2], 21041, AUI);
- TULIP_MEDIAINFO_SIA_INIT(sc, &mi[3], 21041, BNC);
-}
-
-static void
-tulip_21041_media_probe(
- tulip_softc_t * const sc)
-{
- sc->tulip_ifp->if_baudrate = 10000000;
- sc->tulip_cmdmode |= TULIP_CMD_CAPTREFFCT|TULIP_CMD_ENHCAPTEFFCT
- |TULIP_CMD_THRSHLD160|TULIP_CMD_BACKOFFCTR;
- sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL;
- tulip_21041_mediainfo_init(sc);
-}
-
-static void
-tulip_21041_media_poll(
- tulip_softc_t * const sc,
- const tulip_mediapoll_event_t event)
-{
- u_int32_t sia_status;
-
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_events[event]++;
-#endif
-
- if (event == TULIP_MEDIAPOLL_LINKFAIL) {
- if (sc->tulip_probe_state != TULIP_PROBE_INACTIVE
- || !TULIP_DO_AUTOSENSE(sc))
- return;
- sc->tulip_media = TULIP_MEDIA_UNKNOWN;
- tulip_reset(sc); /* start probe */
- return;
- }
-
- /*
- * If we've been been asked to start a poll or link change interrupt
- * restart the probe (and reset the tulip to a known state).
- */
- if (event == TULIP_MEDIAPOLL_START) {
- sc->tulip_ifp->if_flags |= IFF_OACTIVE;
- sc->tulip_cmdmode &= ~(TULIP_CMD_FULLDUPLEX|TULIP_CMD_RXRUN);
-#ifdef notyet
- if (sc->tulip_revinfo >= 0x20) {
- sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX;
- sc->tulip_flags |= TULIP_DIDNWAY;
- }
-#endif
- TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
- sc->tulip_probe_state = TULIP_PROBE_MEDIATEST;
- sc->tulip_probe_media = TULIP_MEDIA_10BASET;
- sc->tulip_probe_timeout = TULIP_21041_PROBE_10BASET_TIMEOUT;
- tulip_media_set(sc, TULIP_MEDIA_10BASET);
- tulip_timeout(sc);
- return;
- }
-
- if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE)
- return;
-
- if (event == TULIP_MEDIAPOLL_TXPROBE_OK) {
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_txprobes_ok[sc->tulip_probe_media]++;
-#endif
- tulip_linkup(sc, sc->tulip_probe_media);
- return;
- }
-
- sia_status = TULIP_CSR_READ(sc, csr_sia_status);
- TULIP_CSR_WRITE(sc, csr_sia_status, sia_status);
- if ((sia_status & TULIP_SIASTS_LINKFAIL) == 0) {
- if (sc->tulip_revinfo >= 0x20) {
- if (sia_status & (PHYSTS_10BASET_FD << (16 - 6)))
- sc->tulip_probe_media = TULIP_MEDIA_10BASET_FD;
- }
- /*
- * If the link has passed LinkPass, 10baseT is the
- * proper media to use.
- */
- tulip_linkup(sc, sc->tulip_probe_media);
- return;
- }
-
- /*
- * wait for up to 2.4 seconds for the link to reach pass state.
- * Only then start scanning the other media for activity.
- * choose media with receive activity over those without.
- */
- if (sc->tulip_probe_media == TULIP_MEDIA_10BASET) {
- if (event != TULIP_MEDIAPOLL_TIMER)
- return;
- if (sc->tulip_probe_timeout > 0
- && (sia_status & TULIP_SIASTS_OTHERRXACTIVITY) == 0) {
- tulip_timeout(sc);
- return;
- }
- sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT;
- sc->tulip_flags |= TULIP_WANTRXACT;
- if (sia_status & TULIP_SIASTS_OTHERRXACTIVITY) {
- sc->tulip_probe_media = TULIP_MEDIA_BNC;
- } else {
- sc->tulip_probe_media = TULIP_MEDIA_AUI;
- }
- tulip_media_set(sc, sc->tulip_probe_media);
- tulip_timeout(sc);
- return;
- }
-
- /*
- * If we failed, clear the txprobe active flag.
- */
- if (event == TULIP_MEDIAPOLL_TXPROBE_FAILED)
- sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE;
-
-
- if (event == TULIP_MEDIAPOLL_TIMER) {
- /*
- * If we've received something, then that's our link!
- */
- if (sc->tulip_flags & TULIP_RXACT) {
- tulip_linkup(sc, sc->tulip_probe_media);
- return;
- }
- /*
- * if no txprobe active
- */
- if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0
- && ((sc->tulip_flags & TULIP_WANTRXACT) == 0
- || (sia_status & TULIP_SIASTS_RXACTIVITY))) {
- sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT;
- tulip_txprobe(sc);
- tulip_timeout(sc);
- return;
- }
- /*
- * Take 2 passes through before deciding to not
- * wait for receive activity. Then take another
- * two passes before spitting out a warning.
- */
- if (sc->tulip_probe_timeout <= 0) {
- if (sc->tulip_flags & TULIP_WANTRXACT) {
- sc->tulip_flags &= ~TULIP_WANTRXACT;
- sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT;
- } else {
- if_printf(sc->tulip_ifp,
- "autosense failed: cable problem?\n");
- if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) {
- sc->tulip_ifp->if_flags &= ~IFF_RUNNING;
- sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
- return;
- }
- }
- }
- }
-
- /*
- * Since this media failed to probe, try the other one.
- */
- sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT;
- if (sc->tulip_probe_media == TULIP_MEDIA_AUI) {
- sc->tulip_probe_media = TULIP_MEDIA_BNC;
- } else {
- sc->tulip_probe_media = TULIP_MEDIA_AUI;
- }
- tulip_media_set(sc, sc->tulip_probe_media);
- sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE;
- tulip_timeout(sc);
-}
-
-static const tulip_boardsw_t tulip_21041_boardsw = {
- TULIP_21041_GENERIC,
- tulip_21041_media_probe,
- tulip_media_select,
- tulip_21041_media_poll
-};
-
-static const tulip_phy_attr_t tulip_mii_phy_attrlist[] = {
- { 0x20005c00, 0, /* 08-00-17 */
- {
- { 0x19, 0x0040, 0x0040 }, /* 10TX */
- { 0x19, 0x0040, 0x0000 }, /* 100TX */
- },
-#if defined(TULIP_DEBUG)
- "NS DP83840",
-#endif
- },
- { 0x0281F400, 0, /* 00-A0-7D */
- {
- { 0x12, 0x0010, 0x0000 }, /* 10T */
- { }, /* 100TX */
- { 0x12, 0x0010, 0x0010 }, /* 100T4 */
- { 0x12, 0x0008, 0x0008 }, /* FULL_DUPLEX */
- },
-#if defined(TULIP_DEBUG)
- "Seeq 80C240"
-#endif
- },
-#if 0
- { 0x0015F420, 0, /* 00-A0-7D */
- {
- { 0x12, 0x0010, 0x0000 }, /* 10T */
- { }, /* 100TX */
- { 0x12, 0x0010, 0x0010 }, /* 100T4 */
- { 0x12, 0x0008, 0x0008 }, /* FULL_DUPLEX */
- },
-#if defined(TULIP_DEBUG)
- "Broadcom BCM5000"
-#endif
- },
-#endif
- { 0x0281F400, 0, /* 00-A0-BE */
- {
- { 0x11, 0x8000, 0x0000 }, /* 10T */
- { 0x11, 0x8000, 0x8000 }, /* 100TX */
- { }, /* 100T4 */
- { 0x11, 0x4000, 0x4000 }, /* FULL_DUPLEX */
- },
-#if defined(TULIP_DEBUG)
- "ICS 1890"
-#endif
- },
- { 0 }
-};
-
-static tulip_media_t
-tulip_mii_phy_readspecific(
- tulip_softc_t * const sc)
-{
- const tulip_phy_attr_t *attr;
- u_int16_t data;
- u_int32_t id;
- unsigned idx = 0;
- static const tulip_media_t table[] = {
- TULIP_MEDIA_UNKNOWN,
- TULIP_MEDIA_10BASET,
- TULIP_MEDIA_100BASETX,
- TULIP_MEDIA_100BASET4,
- TULIP_MEDIA_UNKNOWN,
- TULIP_MEDIA_10BASET_FD,
- TULIP_MEDIA_100BASETX_FD,
- TULIP_MEDIA_UNKNOWN
- };
-
- /*
- * Don't read phy specific registers if link is not up.
- */
- data = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_STATUS);
- if ((data & (PHYSTS_LINK_UP|PHYSTS_EXTENDED_REGS)) != (PHYSTS_LINK_UP|PHYSTS_EXTENDED_REGS))
- return TULIP_MEDIA_UNKNOWN;
-
- id = (tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_IDLOW) << 16) |
- tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_IDHIGH);
- for (attr = tulip_mii_phy_attrlist;; attr++) {
- if (attr->attr_id == 0)
- return TULIP_MEDIA_UNKNOWN;
- if ((id & ~0x0F) == attr->attr_id)
- break;
- }
-
- if (attr->attr_modes[PHY_MODE_100TX].pm_regno) {
- const tulip_phy_modedata_t * const pm = &attr->attr_modes[PHY_MODE_100TX];
- data = tulip_mii_readreg(sc, sc->tulip_phyaddr, pm->pm_regno);
- if ((data & pm->pm_mask) == pm->pm_value)
- idx = 2;
- }
- if (idx == 0 && attr->attr_modes[PHY_MODE_100T4].pm_regno) {
- const tulip_phy_modedata_t * const pm = &attr->attr_modes[PHY_MODE_100T4];
- data = tulip_mii_readreg(sc, sc->tulip_phyaddr, pm->pm_regno);
- if ((data & pm->pm_mask) == pm->pm_value)
- idx = 3;
- }
- if (idx == 0 && attr->attr_modes[PHY_MODE_10T].pm_regno) {
- const tulip_phy_modedata_t * const pm = &attr->attr_modes[PHY_MODE_10T];
- data = tulip_mii_readreg(sc, sc->tulip_phyaddr, pm->pm_regno);
- if ((data & pm->pm_mask) == pm->pm_value)
- idx = 1;
- }
- if (idx != 0 && attr->attr_modes[PHY_MODE_FULLDUPLEX].pm_regno) {
- const tulip_phy_modedata_t * const pm = &attr->attr_modes[PHY_MODE_FULLDUPLEX];
- data = tulip_mii_readreg(sc, sc->tulip_phyaddr, pm->pm_regno);
- idx += ((data & pm->pm_mask) == pm->pm_value ? 4 : 0);
- }
- return table[idx];
-}
-
-static unsigned
-tulip_mii_get_phyaddr(
- tulip_softc_t * const sc,
- unsigned offset)
-{
- unsigned phyaddr;
-
- for (phyaddr = 1; phyaddr < 32; phyaddr++) {
- unsigned status = tulip_mii_readreg(sc, phyaddr, PHYREG_STATUS);
- if (status == 0 || status == 0xFFFF || status < PHYSTS_10BASET)
- continue;
- if (offset == 0)
- return phyaddr;
- offset--;
- }
- if (offset == 0) {
- unsigned status = tulip_mii_readreg(sc, 0, PHYREG_STATUS);
- if (status == 0 || status == 0xFFFF || status < PHYSTS_10BASET)
- return TULIP_MII_NOPHY;
- return 0;
- }
- return TULIP_MII_NOPHY;
-}
-
-static int
-tulip_mii_map_abilities(
- tulip_softc_t * const sc,
- unsigned abilities)
-{
- sc->tulip_abilities = abilities;
- if (abilities & PHYSTS_100BASETX_FD) {
- sc->tulip_probe_media = TULIP_MEDIA_100BASETX_FD;
- } else if (abilities & PHYSTS_100BASET4) {
- sc->tulip_probe_media = TULIP_MEDIA_100BASET4;
- } else if (abilities & PHYSTS_100BASETX) {
- sc->tulip_probe_media = TULIP_MEDIA_100BASETX;
- } else if (abilities & PHYSTS_10BASET_FD) {
- sc->tulip_probe_media = TULIP_MEDIA_10BASET_FD;
- } else if (abilities & PHYSTS_10BASET) {
- sc->tulip_probe_media = TULIP_MEDIA_10BASET;
- } else {
- sc->tulip_probe_state = TULIP_PROBE_MEDIATEST;
- return 0;
- }
- sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
- return 1;
-}
-
-static void
-tulip_mii_autonegotiate(
- tulip_softc_t * const sc,
- const unsigned phyaddr)
-{
- struct ifnet *ifp = sc->tulip_ifp;
-
- switch (sc->tulip_probe_state) {
- case TULIP_PROBE_MEDIATEST:
- case TULIP_PROBE_INACTIVE: {
- sc->tulip_flags |= TULIP_DIDNWAY;
- tulip_mii_writereg(sc, phyaddr, PHYREG_CONTROL, PHYCTL_RESET);
- sc->tulip_probe_timeout = 3000;
- sc->tulip_intrmask |= TULIP_STS_ABNRMLINTR|TULIP_STS_NORMALINTR;
- sc->tulip_probe_state = TULIP_PROBE_PHYRESET;
- }
- /* FALLTHROUGH */
- case TULIP_PROBE_PHYRESET: {
- u_int32_t status;
- u_int32_t data = tulip_mii_readreg(sc, phyaddr, PHYREG_CONTROL);
- if (data & PHYCTL_RESET) {
- if (sc->tulip_probe_timeout > 0) {
- tulip_timeout(sc);
- return;
- }
- printf("%s(phy%d): error: reset of PHY never completed!\n",
- ifp->if_xname, phyaddr);
- sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE;
- sc->tulip_probe_state = TULIP_PROBE_FAILED;
- sc->tulip_ifp->if_flags &= ~(IFF_UP|IFF_RUNNING);
- return;
- }
- status = tulip_mii_readreg(sc, phyaddr, PHYREG_STATUS);
- if ((status & PHYSTS_CAN_AUTONEG) == 0) {
-#if defined(TULIP_DEBUG)
- loudprintf("%s(phy%d): autonegotiation disabled\n",
- ifp->if_xname, phyaddr);
-#endif
- sc->tulip_flags &= ~TULIP_DIDNWAY;
- sc->tulip_probe_state = TULIP_PROBE_MEDIATEST;
- return;
- }
- if (tulip_mii_readreg(sc, phyaddr, PHYREG_AUTONEG_ADVERTISEMENT) != ((status >> 6) | 0x01))
- tulip_mii_writereg(sc, phyaddr, PHYREG_AUTONEG_ADVERTISEMENT, (status >> 6) | 0x01);
- tulip_mii_writereg(sc, phyaddr, PHYREG_CONTROL, data|PHYCTL_AUTONEG_RESTART|PHYCTL_AUTONEG_ENABLE);
- data = tulip_mii_readreg(sc, phyaddr, PHYREG_CONTROL);
-#if defined(TULIP_DEBUG)
- if ((data & PHYCTL_AUTONEG_ENABLE) == 0)
- loudprintf("%s(phy%d): oops: enable autonegotiation failed: 0x%04x\n",
- ifp->if_xname, phyaddr, data);
- else
- loudprintf("%s(phy%d): autonegotiation restarted: 0x%04x\n",
- ifp->if_xname, phyaddr, data);
- sc->tulip_dbg.dbg_nway_starts++;
-#endif
- sc->tulip_probe_state = TULIP_PROBE_PHYAUTONEG;
- sc->tulip_probe_timeout = 3000;
- }
- /* FALLTHROUGH */
- case TULIP_PROBE_PHYAUTONEG: {
- u_int32_t status = tulip_mii_readreg(sc, phyaddr, PHYREG_STATUS);
- u_int32_t data;
- if ((status & PHYSTS_AUTONEG_DONE) == 0) {
- if (sc->tulip_probe_timeout > 0) {
- tulip_timeout(sc);
- return;
- }
-#if defined(TULIP_DEBUG)
- loudprintf("%s(phy%d): autonegotiation timeout: sts=0x%04x, ctl=0x%04x\n",
- ifp->if_xname, phyaddr, status,
- tulip_mii_readreg(sc, phyaddr, PHYREG_CONTROL));
-#endif
- sc->tulip_flags &= ~TULIP_DIDNWAY;
- sc->tulip_probe_state = TULIP_PROBE_MEDIATEST;
- return;
- }
- data = tulip_mii_readreg(sc, phyaddr, PHYREG_AUTONEG_ABILITIES);
-#if defined(TULIP_DEBUG)
- loudprintf("%s(phy%d): autonegotiation complete: 0x%04x\n",
- ifp->if_xname, phyaddr, data);
-#endif
- data = (data << 6) & status;
- if (!tulip_mii_map_abilities(sc, data))
- sc->tulip_flags &= ~TULIP_DIDNWAY;
- return;
- }
- default: {
-#if defined(DIAGNOSTIC)
- panic("tulip_media_poll: botch at line %d\n", __LINE__);
-#endif
- break;
- }
- }
-#if defined(TULIP_DEBUG)
- loudprintf("%s(phy%d): autonegotiation failure: state = %d\n",
- ifp->if_xname, phyaddr, sc->tulip_probe_state);
- sc->tulip_dbg.dbg_nway_failures++;
-#endif
-}
-
-static void
-tulip_2114x_media_preset(
- tulip_softc_t * const sc)
-{
- const tulip_media_info_t *mi = NULL;
- tulip_media_t media = sc->tulip_media;
-
- if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE)
- media = sc->tulip_media;
- else
- media = sc->tulip_probe_media;
-
- sc->tulip_cmdmode &= ~TULIP_CMD_PORTSELECT;
- sc->tulip_flags &= ~TULIP_SQETEST;
- if (media != TULIP_MEDIA_UNKNOWN && media != TULIP_MEDIA_MAX) {
-#if defined(TULIP_DEBUG)
- if (media < TULIP_MEDIA_MAX && sc->tulip_mediums[media] != NULL) {
-#endif
- mi = sc->tulip_mediums[media];
- if (mi->mi_type == TULIP_MEDIAINFO_MII) {
- sc->tulip_cmdmode |= TULIP_CMD_PORTSELECT;
- } else if (mi->mi_type == TULIP_MEDIAINFO_GPR
- || mi->mi_type == TULIP_MEDIAINFO_SYM) {
- sc->tulip_cmdmode &= ~TULIP_GPR_CMDBITS;
- sc->tulip_cmdmode |= mi->mi_cmdmode;
- } else if (mi->mi_type == TULIP_MEDIAINFO_SIA) {
- TULIP_CSR_WRITE(sc, csr_sia_connectivity, TULIP_SIACONN_RESET);
- }
-#if defined(TULIP_DEBUG)
- } else {
- if_printf(sc->tulip_ifp, "preset: bad media %d!\n", media);
- }
-#endif
- }
- switch (media) {
- case TULIP_MEDIA_BNC:
- case TULIP_MEDIA_AUI:
- case TULIP_MEDIA_10BASET: {
- sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX;
- sc->tulip_cmdmode |= TULIP_CMD_TXTHRSHLDCTL;
- sc->tulip_ifp->if_baudrate = 10000000;
- sc->tulip_flags |= TULIP_SQETEST;
- break;
- }
- case TULIP_MEDIA_10BASET_FD: {
- sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX|TULIP_CMD_TXTHRSHLDCTL;
- sc->tulip_ifp->if_baudrate = 10000000;
- break;
- }
- case TULIP_MEDIA_100BASEFX:
- case TULIP_MEDIA_100BASET4:
- case TULIP_MEDIA_100BASETX: {
- sc->tulip_cmdmode &= ~(TULIP_CMD_FULLDUPLEX|TULIP_CMD_TXTHRSHLDCTL);
- sc->tulip_cmdmode |= TULIP_CMD_PORTSELECT;
- sc->tulip_ifp->if_baudrate = 100000000;
- break;
- }
- case TULIP_MEDIA_100BASEFX_FD:
- case TULIP_MEDIA_100BASETX_FD: {
- sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX|TULIP_CMD_PORTSELECT;
- sc->tulip_cmdmode &= ~TULIP_CMD_TXTHRSHLDCTL;
- sc->tulip_ifp->if_baudrate = 100000000;
- break;
- }
- default: {
- break;
- }
- }
- TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
-}
-
-/*
- ********************************************************************
- * Start of 21140/21140A support which does not use the MII interface
- */
-
-static void
-tulip_null_media_poll(
- tulip_softc_t * const sc,
- tulip_mediapoll_event_t event)
-{
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_events[event]++;
-#endif
-#if defined(DIAGNOSTIC)
- if_printf(sc->tulip_ifp, "botch(media_poll) at line %d\n", __LINE__);
-#endif
-}
-
-__inline static void
-tulip_21140_mediainit(
- tulip_softc_t * const sc,
- tulip_media_info_t * const mip,
- tulip_media_t const media,
- unsigned gpdata,
- unsigned cmdmode)
-{
- sc->tulip_mediums[media] = mip;
- mip->mi_type = TULIP_MEDIAINFO_GPR;
- mip->mi_cmdmode = cmdmode;
- mip->mi_gpdata = gpdata;
-}
-
-static void
-tulip_21140_evalboard_media_probe(
- tulip_softc_t * const sc)
-{
- tulip_media_info_t *mip = sc->tulip_mediainfo;
-
- sc->tulip_gpinit = TULIP_GP_EB_PINS;
- sc->tulip_gpdata = TULIP_GP_EB_INIT;
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_PINS);
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_INIT);
- TULIP_CSR_WRITE(sc, csr_command,
- TULIP_CSR_READ(sc, csr_command) | TULIP_CMD_PORTSELECT |
- TULIP_CMD_PCSFUNCTION | TULIP_CMD_SCRAMBLER | TULIP_CMD_MUSTBEONE);
- TULIP_CSR_WRITE(sc, csr_command,
- TULIP_CSR_READ(sc, csr_command) & ~TULIP_CMD_TXTHRSHLDCTL);
- DELAY(1000000);
- if ((TULIP_CSR_READ(sc, csr_gp) & TULIP_GP_EB_OK100) != 0) {
- sc->tulip_media = TULIP_MEDIA_10BASET;
- } else {
- sc->tulip_media = TULIP_MEDIA_100BASETX;
- }
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET,
- TULIP_GP_EB_INIT,
- TULIP_CMD_TXTHRSHLDCTL);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET_FD,
- TULIP_GP_EB_INIT,
- TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_FULLDUPLEX);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX,
- TULIP_GP_EB_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD,
- TULIP_GP_EB_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX);
-}
-
-static const tulip_boardsw_t tulip_21140_eb_boardsw = {
- TULIP_21140_DEC_EB,
- tulip_21140_evalboard_media_probe,
- tulip_media_select,
- tulip_null_media_poll,
- tulip_2114x_media_preset,
-};
-
-static void
-tulip_21140_accton_media_probe(
- tulip_softc_t * const sc)
-{
- tulip_media_info_t *mip = sc->tulip_mediainfo;
- unsigned gpdata;
-
- sc->tulip_gpinit = TULIP_GP_EB_PINS;
- sc->tulip_gpdata = TULIP_GP_EB_INIT;
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_PINS);
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_INIT);
- TULIP_CSR_WRITE(sc, csr_command,
- TULIP_CSR_READ(sc, csr_command) | TULIP_CMD_PORTSELECT |
- TULIP_CMD_PCSFUNCTION | TULIP_CMD_SCRAMBLER | TULIP_CMD_MUSTBEONE);
- TULIP_CSR_WRITE(sc, csr_command,
- TULIP_CSR_READ(sc, csr_command) & ~TULIP_CMD_TXTHRSHLDCTL);
- DELAY(1000000);
- gpdata = TULIP_CSR_READ(sc, csr_gp);
- if ((gpdata & TULIP_GP_EN1207_UTP_INIT) == 0) {
- sc->tulip_media = TULIP_MEDIA_10BASET;
- } else {
- if ((gpdata & TULIP_GP_EN1207_BNC_INIT) == 0) {
- sc->tulip_media = TULIP_MEDIA_BNC;
- } else {
- sc->tulip_media = TULIP_MEDIA_100BASETX;
- }
- }
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_BNC,
- TULIP_GP_EN1207_BNC_INIT,
- TULIP_CMD_TXTHRSHLDCTL);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET,
- TULIP_GP_EN1207_UTP_INIT,
- TULIP_CMD_TXTHRSHLDCTL);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET_FD,
- TULIP_GP_EN1207_UTP_INIT,
- TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_FULLDUPLEX);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX,
- TULIP_GP_EN1207_100_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD,
- TULIP_GP_EN1207_100_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX);
-}
-
-static const tulip_boardsw_t tulip_21140_accton_boardsw = {
- TULIP_21140_EN1207,
- tulip_21140_accton_media_probe,
- tulip_media_select,
- tulip_null_media_poll,
- tulip_2114x_media_preset,
-};
-
-static void
-tulip_21140_smc9332_media_probe(
- tulip_softc_t * const sc)
-{
- tulip_media_info_t *mip = sc->tulip_mediainfo;
- int idx, cnt = 0;
-
- TULIP_CSR_WRITE(sc, csr_command, TULIP_CMD_PORTSELECT|TULIP_CMD_MUSTBEONE);
- TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET);
- DELAY(10); /* Wait 10 microseconds (actually 50 PCI cycles but at
- 33MHz that comes to two microseconds but wait a
- bit longer anyways) */
- TULIP_CSR_WRITE(sc, csr_command, TULIP_CMD_PORTSELECT |
- TULIP_CMD_PCSFUNCTION | TULIP_CMD_SCRAMBLER | TULIP_CMD_MUSTBEONE);
- sc->tulip_gpinit = TULIP_GP_SMC_9332_PINS;
- sc->tulip_gpdata = TULIP_GP_SMC_9332_INIT;
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_SMC_9332_PINS|TULIP_GP_PINSET);
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_SMC_9332_INIT);
- DELAY(200000);
- for (idx = 1000; idx > 0; idx--) {
- u_int32_t csr = TULIP_CSR_READ(sc, csr_gp);
- if ((csr & (TULIP_GP_SMC_9332_OK10|TULIP_GP_SMC_9332_OK100)) == (TULIP_GP_SMC_9332_OK10|TULIP_GP_SMC_9332_OK100)) {
- if (++cnt > 100)
- break;
- } else if ((csr & TULIP_GP_SMC_9332_OK10) == 0) {
- break;
- } else {
- cnt = 0;
- }
- DELAY(1000);
- }
- sc->tulip_media = cnt > 100 ? TULIP_MEDIA_100BASETX : TULIP_MEDIA_10BASET;
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX,
- TULIP_GP_SMC_9332_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD,
- TULIP_GP_SMC_9332_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET,
- TULIP_GP_SMC_9332_INIT,
- TULIP_CMD_TXTHRSHLDCTL);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET_FD,
- TULIP_GP_SMC_9332_INIT,
- TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_FULLDUPLEX);
-}
-
-static const tulip_boardsw_t tulip_21140_smc9332_boardsw = {
- TULIP_21140_SMC_9332,
- tulip_21140_smc9332_media_probe,
- tulip_media_select,
- tulip_null_media_poll,
- tulip_2114x_media_preset,
-};
-
-static void
-tulip_21140_cogent_em100_media_probe(
- tulip_softc_t * const sc)
-{
- tulip_media_info_t *mip = sc->tulip_mediainfo;
- u_int32_t cmdmode = TULIP_CSR_READ(sc, csr_command);
-
- sc->tulip_gpinit = TULIP_GP_EM100_PINS;
- sc->tulip_gpdata = TULIP_GP_EM100_INIT;
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EM100_PINS);
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EM100_INIT);
-
- cmdmode = TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION|TULIP_CMD_MUSTBEONE;
- cmdmode &= ~(TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_SCRAMBLER);
- if (sc->tulip_rombuf[32] == TULIP_COGENT_EM100FX_ID) {
- TULIP_CSR_WRITE(sc, csr_command, cmdmode);
- sc->tulip_media = TULIP_MEDIA_100BASEFX;
-
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASEFX,
- TULIP_GP_EM100_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASEFX_FD,
- TULIP_GP_EM100_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_FULLDUPLEX);
- } else {
- TULIP_CSR_WRITE(sc, csr_command, cmdmode|TULIP_CMD_SCRAMBLER);
- sc->tulip_media = TULIP_MEDIA_100BASETX;
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX,
- TULIP_GP_EM100_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD,
- TULIP_GP_EM100_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX);
- }
-}
-
-static const tulip_boardsw_t tulip_21140_cogent_em100_boardsw = {
- TULIP_21140_COGENT_EM100,
- tulip_21140_cogent_em100_media_probe,
- tulip_media_select,
- tulip_null_media_poll,
- tulip_2114x_media_preset
-};
-
-static void
-tulip_21140_znyx_zx34x_media_probe(
- tulip_softc_t * const sc)
-{
- tulip_media_info_t *mip = sc->tulip_mediainfo;
- int cnt10 = 0, cnt100 = 0, idx;
-
- sc->tulip_gpinit = TULIP_GP_ZX34X_PINS;
- sc->tulip_gpdata = TULIP_GP_ZX34X_INIT;
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_ZX34X_PINS);
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_ZX34X_INIT);
- TULIP_CSR_WRITE(sc, csr_command,
- TULIP_CSR_READ(sc, csr_command) | TULIP_CMD_PORTSELECT |
- TULIP_CMD_PCSFUNCTION | TULIP_CMD_SCRAMBLER | TULIP_CMD_MUSTBEONE);
- TULIP_CSR_WRITE(sc, csr_command,
- TULIP_CSR_READ(sc, csr_command) & ~TULIP_CMD_TXTHRSHLDCTL);
-
- DELAY(200000);
- for (idx = 1000; idx > 0; idx--) {
- u_int32_t csr = TULIP_CSR_READ(sc, csr_gp);
- if ((csr & (TULIP_GP_ZX34X_LNKFAIL|TULIP_GP_ZX34X_SYMDET|TULIP_GP_ZX34X_SIGDET)) == (TULIP_GP_ZX34X_LNKFAIL|TULIP_GP_ZX34X_SYMDET|TULIP_GP_ZX34X_SIGDET)) {
- if (++cnt100 > 100)
- break;
- } else if ((csr & TULIP_GP_ZX34X_LNKFAIL) == 0) {
- if (++cnt10 > 100)
- break;
- } else {
- cnt10 = 0;
- cnt100 = 0;
- }
- DELAY(1000);
- }
- sc->tulip_media = cnt100 > 100 ? TULIP_MEDIA_100BASETX : TULIP_MEDIA_10BASET;
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET,
- TULIP_GP_ZX34X_INIT,
- TULIP_CMD_TXTHRSHLDCTL);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET_FD,
- TULIP_GP_ZX34X_INIT,
- TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_FULLDUPLEX);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX,
- TULIP_GP_ZX34X_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER);
- tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD,
- TULIP_GP_ZX34X_INIT,
- TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX);
-}
-
-static const tulip_boardsw_t tulip_21140_znyx_zx34x_boardsw = {
- TULIP_21140_ZNYX_ZX34X,
- tulip_21140_znyx_zx34x_media_probe,
- tulip_media_select,
- tulip_null_media_poll,
- tulip_2114x_media_preset,
-};
-
-static void
-tulip_2114x_media_probe(
- tulip_softc_t * const sc)
-{
- sc->tulip_cmdmode |= TULIP_CMD_MUSTBEONE
- |TULIP_CMD_BACKOFFCTR|TULIP_CMD_THRSHLD72;
-}
-
-static const tulip_boardsw_t tulip_2114x_isv_boardsw = {
- TULIP_21140_ISV,
- tulip_2114x_media_probe,
- tulip_media_select,
- tulip_media_poll,
- tulip_2114x_media_preset,
-};
-
-/*
- * ******** END of chip-specific handlers. ***********
- */
-
-/*
- * Code the read the SROM and MII bit streams (I2C)
- */
-#define EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); DELAY(1); } while (0)
-
-static void
-tulip_srom_idle(
- tulip_softc_t * const sc)
-{
- unsigned bit, csr;
-
- csr = SROMSEL ; EMIT;
- csr = SROMSEL | SROMRD; EMIT;
- csr ^= SROMCS; EMIT;
- csr ^= SROMCLKON; EMIT;
-
- /*
- * Write 25 cycles of 0 which will force the SROM to be idle.
- */
- for (bit = 3 + SROM_BITWIDTH + 16; bit > 0; bit--) {
- csr ^= SROMCLKOFF; EMIT; /* clock low; data not valid */
- csr ^= SROMCLKON; EMIT; /* clock high; data valid */
- }
- csr ^= SROMCLKOFF; EMIT;
- csr ^= SROMCS; EMIT;
- csr = 0; EMIT;
-}
-
-
-static void
-tulip_srom_read(
- tulip_softc_t * const sc)
-{
- unsigned idx;
- const unsigned bitwidth = SROM_BITWIDTH;
- const unsigned cmdmask = (SROMCMD_RD << bitwidth);
- const unsigned msb = 1 << (bitwidth + 3 - 1);
- unsigned lastidx = (1 << bitwidth) - 1;
-
- tulip_srom_idle(sc);
-
- for (idx = 0; idx <= lastidx; idx++) {
- unsigned lastbit, data, bits, bit, csr;
- csr = SROMSEL ; EMIT;
- csr = SROMSEL | SROMRD; EMIT;
- csr ^= SROMCSON; EMIT;
- csr ^= SROMCLKON; EMIT;
-
- lastbit = 0;
- for (bits = idx|cmdmask, bit = bitwidth + 3; bit > 0; bit--, bits <<= 1) {
- const unsigned thisbit = bits & msb;
- csr ^= SROMCLKOFF; EMIT; /* clock low; data not valid */
- if (thisbit != lastbit) {
- csr ^= SROMDOUT; EMIT; /* clock low; invert data */
- } else {
- EMIT;
- }
- csr ^= SROMCLKON; EMIT; /* clock high; data valid */
- lastbit = thisbit;
- }
- csr ^= SROMCLKOFF; EMIT;
-
- for (data = 0, bits = 0; bits < 16; bits++) {
- data <<= 1;
- csr ^= SROMCLKON; EMIT; /* clock high; data valid */
- data |= TULIP_CSR_READ(sc, csr_srom_mii) & SROMDIN ? 1 : 0;
- csr ^= SROMCLKOFF; EMIT; /* clock low; data not valid */
- }
- sc->tulip_rombuf[idx*2] = data & 0xFF;
- sc->tulip_rombuf[idx*2+1] = data >> 8;
- csr = SROMSEL | SROMRD; EMIT;
- csr = 0; EMIT;
- }
- tulip_srom_idle(sc);
-}
-
-#define MII_EMIT do { TULIP_CSR_WRITE(sc, csr_srom_mii, csr); DELAY(1); } while (0)
-
-static void
-tulip_mii_writebits(
- tulip_softc_t * const sc,
- unsigned data,
- unsigned bits)
-{
- unsigned msb = 1 << (bits - 1);
- unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
- unsigned lastbit = (csr & MII_DOUT) ? msb : 0;
-
- csr |= MII_WR; MII_EMIT; /* clock low; assert write */
-
- for (; bits > 0; bits--, data <<= 1) {
- const unsigned thisbit = data & msb;
- if (thisbit != lastbit) {
- csr ^= MII_DOUT; MII_EMIT; /* clock low; invert data */
- }
- csr ^= MII_CLKON; MII_EMIT; /* clock high; data valid */
- lastbit = thisbit;
- csr ^= MII_CLKOFF; MII_EMIT; /* clock low; data not valid */
- }
-}
-
-static void
-tulip_mii_turnaround(
- tulip_softc_t * const sc,
- unsigned cmd)
-{
- unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
-
- if (cmd == MII_WRCMD) {
- csr |= MII_DOUT; MII_EMIT; /* clock low; change data */
- csr ^= MII_CLKON; MII_EMIT; /* clock high; data valid */
- csr ^= MII_CLKOFF; MII_EMIT; /* clock low; data not valid */
- csr ^= MII_DOUT; MII_EMIT; /* clock low; change data */
- } else {
- csr |= MII_RD; MII_EMIT; /* clock low; switch to read */
- }
- csr ^= MII_CLKON; MII_EMIT; /* clock high; data valid */
- csr ^= MII_CLKOFF; MII_EMIT; /* clock low; data not valid */
-}
-
-static unsigned
-tulip_mii_readbits(
- tulip_softc_t * const sc)
-{
- unsigned data;
- unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
- int idx;
-
- for (idx = 0, data = 0; idx < 16; idx++) {
- data <<= 1; /* this is NOOP on the first pass through */
- csr ^= MII_CLKON; MII_EMIT; /* clock high; data valid */
- if (TULIP_CSR_READ(sc, csr_srom_mii) & MII_DIN)
- data |= 1;
- csr ^= MII_CLKOFF; MII_EMIT; /* clock low; data not valid */
- }
- csr ^= MII_RD; MII_EMIT; /* clock low; turn off read */
-
- return data;
-}
-
-static unsigned
-tulip_mii_readreg(
- tulip_softc_t * const sc,
- unsigned devaddr,
- unsigned regno)
-{
- unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
- unsigned data;
-
- csr &= ~(MII_RD|MII_CLK); MII_EMIT;
- tulip_mii_writebits(sc, MII_PREAMBLE, 32);
- tulip_mii_writebits(sc, MII_RDCMD, 8);
- tulip_mii_writebits(sc, devaddr, 5);
- tulip_mii_writebits(sc, regno, 5);
- tulip_mii_turnaround(sc, MII_RDCMD);
-
- data = tulip_mii_readbits(sc);
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_phyregs[regno][0] = data;
- sc->tulip_dbg.dbg_phyregs[regno][1]++;
-#endif
- return data;
-}
-
-static void
-tulip_mii_writereg(
- tulip_softc_t * const sc,
- unsigned devaddr,
- unsigned regno,
- unsigned data)
-{
- unsigned csr = TULIP_CSR_READ(sc, csr_srom_mii) & (MII_RD|MII_DOUT|MII_CLK);
- csr &= ~(MII_RD|MII_CLK); MII_EMIT;
- tulip_mii_writebits(sc, MII_PREAMBLE, 32);
- tulip_mii_writebits(sc, MII_WRCMD, 8);
- tulip_mii_writebits(sc, devaddr, 5);
- tulip_mii_writebits(sc, regno, 5);
- tulip_mii_turnaround(sc, MII_WRCMD);
- tulip_mii_writebits(sc, data, 16);
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_phyregs[regno][2] = data;
- sc->tulip_dbg.dbg_phyregs[regno][3]++;
-#endif
-}
-
-#define tulip_mchash(mca) (ether_crc32_le(mca, 6) & 0x1FF)
-#define tulip_srom_crcok(databuf) ( \
- ((ether_crc32_le(databuf, 126) & 0xFFFFU) ^ 0xFFFFU) == \
- ((databuf)[126] | ((databuf)[127] << 8)))
-
-static void
-tulip_identify_dec_nic(
- tulip_softc_t * const sc)
-{
- strcpy(sc->tulip_boardid, "DEC ");
-#define D0 4
- if (sc->tulip_chipid <= TULIP_21040)
- return;
- if (bcmp(sc->tulip_rombuf + 29, "DE500", 5) == 0
- || bcmp(sc->tulip_rombuf + 29, "DE450", 5) == 0) {
- bcopy(sc->tulip_rombuf + 29, &sc->tulip_boardid[D0], 8);
- sc->tulip_boardid[D0+8] = ' ';
- }
-#undef D0
-}
-
-static void
-tulip_identify_znyx_nic(
- tulip_softc_t * const sc)
-{
- unsigned id = 0;
- strcpy(sc->tulip_boardid, "ZNYX ZX3XX ");
- if (sc->tulip_chipid == TULIP_21140 || sc->tulip_chipid == TULIP_21140A) {
- unsigned znyx_ptr;
- sc->tulip_boardid[8] = '4';
- znyx_ptr = sc->tulip_rombuf[124] + 256 * sc->tulip_rombuf[125];
- if (znyx_ptr < 26 || znyx_ptr > 116) {
- sc->tulip_boardsw = &tulip_21140_znyx_zx34x_boardsw;
- return;
- }
- /* ZX344 = 0010 .. 0013FF
- */
- if (sc->tulip_rombuf[znyx_ptr] == 0x4A
- && sc->tulip_rombuf[znyx_ptr + 1] == 0x52
- && sc->tulip_rombuf[znyx_ptr + 2] == 0x01) {
- id = sc->tulip_rombuf[znyx_ptr + 5] + 256 * sc->tulip_rombuf[znyx_ptr + 4];
- if ((id >> 8) == (TULIP_ZNYX_ID_ZX342 >> 8)) {
- sc->tulip_boardid[9] = '2';
- if (id == TULIP_ZNYX_ID_ZX342B) {
- sc->tulip_boardid[10] = 'B';
- sc->tulip_boardid[11] = ' ';
- }
- sc->tulip_boardsw = &tulip_21140_znyx_zx34x_boardsw;
- } else if (id == TULIP_ZNYX_ID_ZX344) {
- sc->tulip_boardid[10] = '4';
- sc->tulip_boardsw = &tulip_21140_znyx_zx34x_boardsw;
- } else if (id == TULIP_ZNYX_ID_ZX345) {
- sc->tulip_boardid[9] = (sc->tulip_rombuf[19] > 1) ? '8' : '5';
- } else if (id == TULIP_ZNYX_ID_ZX346) {
- sc->tulip_boardid[9] = '6';
- } else if (id == TULIP_ZNYX_ID_ZX351) {
- sc->tulip_boardid[8] = '5';
- sc->tulip_boardid[9] = '1';
- }
- }
- if (id == 0) {
- /*
- * Assume it's a ZX342...
- */
- sc->tulip_boardsw = &tulip_21140_znyx_zx34x_boardsw;
- }
- return;
- }
- sc->tulip_boardid[8] = '1';
- if (sc->tulip_chipid == TULIP_21041) {
- sc->tulip_boardid[10] = '1';
- return;
- }
- if (sc->tulip_rombuf[32] == 0x4A && sc->tulip_rombuf[33] == 0x52) {
- id = sc->tulip_rombuf[37] + 256 * sc->tulip_rombuf[36];
- if (id == TULIP_ZNYX_ID_ZX312T) {
- sc->tulip_boardid[9] = '2';
- sc->tulip_boardid[10] = 'T';
- sc->tulip_boardid[11] = ' ';
- sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw;
- } else if (id == TULIP_ZNYX_ID_ZX314_INTA) {
- sc->tulip_boardid[9] = '4';
- sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw;
- sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM;
- } else if (id == TULIP_ZNYX_ID_ZX314) {
- sc->tulip_boardid[9] = '4';
- sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw;
- sc->tulip_features |= TULIP_HAVE_BASEROM;
- } else if (id == TULIP_ZNYX_ID_ZX315_INTA) {
- sc->tulip_boardid[9] = '5';
- sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM;
- } else if (id == TULIP_ZNYX_ID_ZX315) {
- sc->tulip_boardid[9] = '5';
- sc->tulip_features |= TULIP_HAVE_BASEROM;
- } else {
- id = 0;
- }
- }
- if (id == 0) {
- if ((sc->tulip_enaddr[3] & ~3) == 0xF0 && (sc->tulip_enaddr[5] & 2) == 0) {
- sc->tulip_boardid[9] = '4';
- sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw;
- sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM;
- } else if ((sc->tulip_enaddr[3] & ~3) == 0xF4 && (sc->tulip_enaddr[5] & 1) == 0) {
- sc->tulip_boardid[9] = '5';
- sc->tulip_boardsw = &tulip_21040_boardsw;
- sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM;
- } else if ((sc->tulip_enaddr[3] & ~3) == 0xEC) {
- sc->tulip_boardid[9] = '2';
- sc->tulip_boardsw = &tulip_21040_boardsw;
- }
- }
-}
-
-static void
-tulip_identify_smc_nic(
- tulip_softc_t * const sc)
-{
- u_int32_t id1, id2, ei;
- int auibnc = 0, utp = 0;
- char *cp;
-
- strcpy(sc->tulip_boardid, "SMC ");
- if (sc->tulip_chipid == TULIP_21041)
- return;
- if (sc->tulip_chipid != TULIP_21040) {
- if (sc->tulip_boardsw != &tulip_2114x_isv_boardsw) {
- strcpy(&sc->tulip_boardid[4], "9332DST ");
- sc->tulip_boardsw = &tulip_21140_smc9332_boardsw;
- } else if (sc->tulip_features & (TULIP_HAVE_BASEROM|TULIP_HAVE_SLAVEDROM)) {
- strcpy(&sc->tulip_boardid[4], "9334BDT ");
- } else {
- strcpy(&sc->tulip_boardid[4], "9332BDT ");
- }
- return;
- }
- id1 = sc->tulip_rombuf[0x60] | (sc->tulip_rombuf[0x61] << 8);
- id2 = sc->tulip_rombuf[0x62] | (sc->tulip_rombuf[0x63] << 8);
- ei = sc->tulip_rombuf[0x66] | (sc->tulip_rombuf[0x67] << 8);
-
- strcpy(&sc->tulip_boardid[4], "8432");
- cp = &sc->tulip_boardid[8];
- if ((id1 & 1) == 0)
- *cp++ = 'B', auibnc = 1;
- if ((id1 & 0xFF) > 0x32)
- *cp++ = 'T', utp = 1;
- if ((id1 & 0x4000) == 0)
- *cp++ = 'A', auibnc = 1;
- if (id2 == 0x15) {
- sc->tulip_boardid[7] = '4';
- *cp++ = '-';
- *cp++ = 'C';
- *cp++ = 'H';
- *cp++ = (ei ? '2' : '1');
- }
- *cp++ = ' ';
- *cp = '\0';
- if (utp && !auibnc)
- sc->tulip_boardsw = &tulip_21040_10baset_only_boardsw;
- else if (!utp && auibnc)
- sc->tulip_boardsw = &tulip_21040_auibnc_only_boardsw;
-}
-
-static void
-tulip_identify_cogent_nic(
- tulip_softc_t * const sc)
-{
- strcpy(sc->tulip_boardid, "Cogent ");
- if (sc->tulip_chipid == TULIP_21140 || sc->tulip_chipid == TULIP_21140A) {
- if (sc->tulip_rombuf[32] == TULIP_COGENT_EM100TX_ID) {
- strcat(sc->tulip_boardid, "EM100TX ");
- sc->tulip_boardsw = &tulip_21140_cogent_em100_boardsw;
-#if defined(TULIP_COGENT_EM110TX_ID)
- } else if (sc->tulip_rombuf[32] == TULIP_COGENT_EM110TX_ID) {
- strcat(sc->tulip_boardid, "EM110TX ");
- sc->tulip_boardsw = &tulip_21140_cogent_em100_boardsw;
-#endif
- } else if (sc->tulip_rombuf[32] == TULIP_COGENT_EM100FX_ID) {
- strcat(sc->tulip_boardid, "EM100FX ");
- sc->tulip_boardsw = &tulip_21140_cogent_em100_boardsw;
- }
- /*
- * Magic number (0x24001109U) is the SubVendor (0x2400) and
- * SubDevId (0x1109) for the ANA6944TX (EM440TX).
- */
- if (*(u_int32_t *) sc->tulip_rombuf == 0x24001109U
- && (sc->tulip_features & TULIP_HAVE_BASEROM)) {
- /*
- * Cogent (Adaptec) is still mapping all INTs to INTA of
- * first 21140. Dumb! Dumb!
- */
- strcat(sc->tulip_boardid, "EM440TX ");
- sc->tulip_features |= TULIP_HAVE_SHAREDINTR;
- }
- } else if (sc->tulip_chipid == TULIP_21040) {
- sc->tulip_features |= TULIP_HAVE_SHAREDINTR|TULIP_HAVE_BASEROM;
- }
-}
-
-static void
-tulip_identify_accton_nic(
- tulip_softc_t * const sc)
-{
- strcpy(sc->tulip_boardid, "ACCTON ");
- switch (sc->tulip_chipid) {
- case TULIP_21140A:
- strcat(sc->tulip_boardid, "EN1207 ");
- if (sc->tulip_boardsw != &tulip_2114x_isv_boardsw)
- sc->tulip_boardsw = &tulip_21140_accton_boardsw;
- break;
- case TULIP_21140:
- strcat(sc->tulip_boardid, "EN1207TX ");
- if (sc->tulip_boardsw != &tulip_2114x_isv_boardsw)
- sc->tulip_boardsw = &tulip_21140_eb_boardsw;
- break;
- case TULIP_21040:
- strcat(sc->tulip_boardid, "EN1203 ");
- sc->tulip_boardsw = &tulip_21040_boardsw;
- break;
- case TULIP_21041:
- strcat(sc->tulip_boardid, "EN1203 ");
- sc->tulip_boardsw = &tulip_21041_boardsw;
- break;
- default:
- sc->tulip_boardsw = &tulip_2114x_isv_boardsw;
- break;
- }
-}
-
-static void
-tulip_identify_asante_nic(
- tulip_softc_t * const sc)
-{
- strcpy(sc->tulip_boardid, "Asante ");
- if ((sc->tulip_chipid == TULIP_21140 || sc->tulip_chipid == TULIP_21140A)
- && sc->tulip_boardsw != &tulip_2114x_isv_boardsw) {
- tulip_media_info_t *mi = sc->tulip_mediainfo;
- int idx;
- /*
- * The Asante Fast Ethernet doesn't always ship with a valid
- * new format SROM. So if isn't in the new format, we cheat
- * set it up as if we had.
- */
-
- sc->tulip_gpinit = TULIP_GP_ASANTE_PINS;
- sc->tulip_gpdata = 0;
-
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_ASANTE_PINS|TULIP_GP_PINSET);
- TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_ASANTE_PHYRESET);
- DELAY(100);
- TULIP_CSR_WRITE(sc, csr_gp, 0);
-
- mi->mi_type = TULIP_MEDIAINFO_MII;
- mi->mi_gpr_length = 0;
- mi->mi_gpr_offset = 0;
- mi->mi_reset_length = 0;
- mi->mi_reset_offset = 0;;
-
- mi->mi_phyaddr = TULIP_MII_NOPHY;
- for (idx = 20; idx > 0 && mi->mi_phyaddr == TULIP_MII_NOPHY; idx--) {
- DELAY(10000);
- mi->mi_phyaddr = tulip_mii_get_phyaddr(sc, 0);
- }
- if (mi->mi_phyaddr == TULIP_MII_NOPHY) {
- if_printf(sc->tulip_ifp, "can't find phy 0\n");
- return;
- }
-
- sc->tulip_features |= TULIP_HAVE_MII;
- mi->mi_capabilities = PHYSTS_10BASET|PHYSTS_10BASET_FD|PHYSTS_100BASETX|PHYSTS_100BASETX_FD;
- mi->mi_advertisement = PHYSTS_10BASET|PHYSTS_10BASET_FD|PHYSTS_100BASETX|PHYSTS_100BASETX_FD;
- mi->mi_full_duplex = PHYSTS_10BASET_FD|PHYSTS_100BASETX_FD;
- mi->mi_tx_threshold = PHYSTS_10BASET|PHYSTS_10BASET_FD;
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX_FD);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASET4);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET_FD);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET);
- mi->mi_phyid = (tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDLOW) << 16) |
- tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDHIGH);
-
- sc->tulip_boardsw = &tulip_2114x_isv_boardsw;
- }
-}
-
-static void
-tulip_identify_compex_nic(
- tulip_softc_t * const sc)
-{
- strcpy(sc->tulip_boardid, "COMPEX ");
- if (sc->tulip_chipid == TULIP_21140A) {
- int root_unit;
- tulip_softc_t *root_sc = NULL;
-
- strcat(sc->tulip_boardid, "400TX/PCI ");
- /*
- * All 4 chips on these boards share an interrupt. This code
- * copied from tulip_read_macaddr.
- */
- sc->tulip_features |= TULIP_HAVE_SHAREDINTR;
- for (root_unit = sc->tulip_unit - 1; root_unit >= 0; root_unit--) {
- root_sc = tulips[root_unit];
- if (root_sc == NULL
- || !(root_sc->tulip_features & TULIP_HAVE_SLAVEDINTR))
- break;
- root_sc = NULL;
- }
- if (root_sc != NULL
- && root_sc->tulip_chipid == sc->tulip_chipid
- && root_sc->tulip_pci_busno == sc->tulip_pci_busno) {
- sc->tulip_features |= TULIP_HAVE_SLAVEDINTR;
- sc->tulip_slaves = root_sc->tulip_slaves;
- root_sc->tulip_slaves = sc;
- } else if(sc->tulip_features & TULIP_HAVE_SLAVEDINTR) {
- printf("\nCannot find master device for %s interrupts",
- sc->tulip_ifp->if_xname);
- }
- } else {
- strcat(sc->tulip_boardid, "unknown ");
- }
- /* sc->tulip_boardsw = &tulip_21140_eb_boardsw; */
- return;
-}
-
-static int
-tulip_srom_decode(
- tulip_softc_t * const sc)
-{
- unsigned idx1, idx2, idx3;
-
- const tulip_srom_header_t *shp = (const tulip_srom_header_t *) &sc->tulip_rombuf[0];
- const tulip_srom_adapter_info_t *saip = (const tulip_srom_adapter_info_t *) (shp + 1);
- tulip_srom_media_t srom_media;
- tulip_media_info_t *mi = sc->tulip_mediainfo;
- const u_int8_t *dp;
- u_int32_t leaf_offset, blocks, data;
-
- for (idx1 = 0; idx1 < shp->sh_adapter_count; idx1++, saip++) {
- if (shp->sh_adapter_count == 1)
- break;
- if (saip->sai_device == sc->tulip_pci_devno)
- break;
- }
- /*
- * Didn't find the right media block for this card.
- */
- if (idx1 == shp->sh_adapter_count)
- return 0;
-
- /*
- * Save the hardware address.
- */
- bcopy(shp->sh_ieee802_address, sc->tulip_enaddr, 6);
- /*
- * If this is a multiple port card, add the adapter index to the last
- * byte of the hardware address. (if it isn't multiport, adding 0
- * won't hurt.
- */
- sc->tulip_enaddr[5] += idx1;
-
- leaf_offset = saip->sai_leaf_offset_lowbyte
- + saip->sai_leaf_offset_highbyte * 256;
- dp = sc->tulip_rombuf + leaf_offset;
-
- sc->tulip_conntype = (tulip_srom_connection_t) (dp[0] + dp[1] * 256); dp += 2;
-
- for (idx2 = 0;; idx2++) {
- if (tulip_srom_conninfo[idx2].sc_type == sc->tulip_conntype
- || tulip_srom_conninfo[idx2].sc_type == TULIP_SROM_CONNTYPE_NOT_USED)
- break;
- }
- sc->tulip_connidx = idx2;
-
- if (sc->tulip_chipid == TULIP_21041) {
- blocks = *dp++;
- for (idx2 = 0; idx2 < blocks; idx2++) {
- tulip_media_t media;
- data = *dp++;
- srom_media = (tulip_srom_media_t) (data & 0x3F);
- for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) {
- if (tulip_srom_mediums[idx3].sm_srom_type == srom_media)
- break;
- }
- media = tulip_srom_mediums[idx3].sm_type;
- if (media != TULIP_MEDIA_UNKNOWN) {
- if (data & TULIP_SROM_21041_EXTENDED) {
- mi->mi_type = TULIP_MEDIAINFO_SIA;
- sc->tulip_mediums[media] = mi;
- mi->mi_sia_connectivity = dp[0] + dp[1] * 256;
- mi->mi_sia_tx_rx = dp[2] + dp[3] * 256;
- mi->mi_sia_general = dp[4] + dp[5] * 256;
- mi++;
- } else {
- switch (media) {
- case TULIP_MEDIA_BNC: {
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, BNC);
- mi++;
- break;
- }
- case TULIP_MEDIA_AUI: {
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, AUI);
- mi++;
- break;
- }
- case TULIP_MEDIA_10BASET: {
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, 10BASET);
- mi++;
- break;
- }
- case TULIP_MEDIA_10BASET_FD: {
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, 10BASET_FD);
- mi++;
- break;
- }
- default: {
- break;
- }
- }
- }
- }
- if (data & TULIP_SROM_21041_EXTENDED)
- dp += 6;
- }
-#ifdef notdef
- if (blocks == 0) {
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, BNC); mi++;
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, AUI); mi++;
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, 10BASET); mi++;
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21041, 10BASET_FD); mi++;
- }
-#endif
- } else {
- unsigned length, type;
- tulip_media_t gp_media = TULIP_MEDIA_UNKNOWN;
- if (sc->tulip_features & TULIP_HAVE_GPR)
- sc->tulip_gpinit = *dp++;
- blocks = *dp++;
- for (idx2 = 0; idx2 < blocks; idx2++) {
- const u_int8_t *ep;
- if ((*dp & 0x80) == 0) {
- length = 4;
- type = 0;
- } else {
- length = (*dp++ & 0x7f) - 1;
- type = *dp++ & 0x3f;
- }
- ep = dp + length;
- switch (type & 0x3f) {
- case 0: { /* 21140[A] GPR block */
- tulip_media_t media;
- srom_media = (tulip_srom_media_t)(dp[0] & 0x3f);
- for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) {
- if (tulip_srom_mediums[idx3].sm_srom_type == srom_media)
- break;
- }
- media = tulip_srom_mediums[idx3].sm_type;
- if (media == TULIP_MEDIA_UNKNOWN)
- break;
- mi->mi_type = TULIP_MEDIAINFO_GPR;
- sc->tulip_mediums[media] = mi;
- mi->mi_gpdata = dp[1];
- if (media > gp_media && !TULIP_IS_MEDIA_FD(media)) {
- sc->tulip_gpdata = mi->mi_gpdata;
- gp_media = media;
- }
- data = dp[2] + dp[3] * 256;
- mi->mi_cmdmode = TULIP_SROM_2114X_CMDBITS(data);
- if (data & TULIP_SROM_2114X_NOINDICATOR) {
- mi->mi_actmask = 0;
- } else {
-#if 0
- mi->mi_default = (data & TULIP_SROM_2114X_DEFAULT) != 0;
-#endif
- mi->mi_actmask = TULIP_SROM_2114X_BITPOS(data);
- mi->mi_actdata = (data & TULIP_SROM_2114X_POLARITY) ? 0 : mi->mi_actmask;
- }
- mi++;
- break;
- }
- case 1: { /* 21140[A] MII block */
- const unsigned phyno = *dp++;
- mi->mi_type = TULIP_MEDIAINFO_MII;
- mi->mi_gpr_length = *dp++;
- mi->mi_gpr_offset = dp - sc->tulip_rombuf;
- dp += mi->mi_gpr_length;
- mi->mi_reset_length = *dp++;
- mi->mi_reset_offset = dp - sc->tulip_rombuf;
- dp += mi->mi_reset_length;
-
- /*
- * Before we probe for a PHY, use the GPR information
- * to select it. If we don't, it may be inaccessible.
- */
- TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_gpinit|TULIP_GP_PINSET);
- for (idx3 = 0; idx3 < mi->mi_reset_length; idx3++) {
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_reset_offset + idx3]);
- }
- sc->tulip_phyaddr = mi->mi_phyaddr;
- for (idx3 = 0; idx3 < mi->mi_gpr_length; idx3++) {
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_gpr_offset + idx3]);
- }
-
- /*
- * At least write something!
- */
- if (mi->mi_reset_length == 0 && mi->mi_gpr_length == 0)
- TULIP_CSR_WRITE(sc, csr_gp, 0);
-
- mi->mi_phyaddr = TULIP_MII_NOPHY;
- for (idx3 = 20; idx3 > 0 && mi->mi_phyaddr == TULIP_MII_NOPHY; idx3--) {
- DELAY(10000);
- mi->mi_phyaddr = tulip_mii_get_phyaddr(sc, phyno);
- }
- if (mi->mi_phyaddr == TULIP_MII_NOPHY) {
-#if defined(TULIP_DEBUG)
- if_printf(sc->tulip_ifp, "can't find phy %d\n",
- phyno);
-#endif
- break;
- }
- sc->tulip_features |= TULIP_HAVE_MII;
- mi->mi_capabilities = dp[0] + dp[1] * 256; dp += 2;
- mi->mi_advertisement = dp[0] + dp[1] * 256; dp += 2;
- mi->mi_full_duplex = dp[0] + dp[1] * 256; dp += 2;
- mi->mi_tx_threshold = dp[0] + dp[1] * 256; dp += 2;
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX_FD);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASET4);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET_FD);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET);
- mi->mi_phyid = (tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDLOW) << 16) |
- tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDHIGH);
- mi++;
- break;
- }
- case 2: { /* 2114[23] SIA block */
- tulip_media_t media;
- srom_media = (tulip_srom_media_t)(dp[0] & 0x3f);
- for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) {
- if (tulip_srom_mediums[idx3].sm_srom_type == srom_media)
- break;
- }
- media = tulip_srom_mediums[idx3].sm_type;
- if (media == TULIP_MEDIA_UNKNOWN)
- break;
- mi->mi_type = TULIP_MEDIAINFO_SIA;
- sc->tulip_mediums[media] = mi;
- if (dp[0] & 0x40) {
- mi->mi_sia_connectivity = dp[1] + dp[2] * 256;
- mi->mi_sia_tx_rx = dp[3] + dp[4] * 256;
- mi->mi_sia_general = dp[5] + dp[6] * 256;
- dp += 6;
- } else {
- switch (media) {
- case TULIP_MEDIA_BNC: {
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21142, BNC);
- break;
- }
- case TULIP_MEDIA_AUI: {
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21142, AUI);
- break;
- }
- case TULIP_MEDIA_10BASET: {
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21142, 10BASET);
- sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL;
- break;
- }
- case TULIP_MEDIA_10BASET_FD: {
- TULIP_MEDIAINFO_SIA_INIT(sc, mi, 21142, 10BASET_FD);
- sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL;
- break;
- }
- default: {
- goto bad_media;
- }
- }
- }
- mi->mi_sia_gp_control = (dp[1] + dp[2] * 256) << 16;
- mi->mi_sia_gp_data = (dp[3] + dp[4] * 256) << 16;
- mi++;
- bad_media:
- break;
- }
- case 3: { /* 2114[23] MII PHY block */
- const unsigned phyno = *dp++;
- const u_int8_t *dp0;
- mi->mi_type = TULIP_MEDIAINFO_MII;
- mi->mi_gpr_length = *dp++;
- mi->mi_gpr_offset = dp - sc->tulip_rombuf;
- dp += 2 * mi->mi_gpr_length;
- mi->mi_reset_length = *dp++;
- mi->mi_reset_offset = dp - sc->tulip_rombuf;
- dp += 2 * mi->mi_reset_length;
-
- dp0 = &sc->tulip_rombuf[mi->mi_reset_offset];
- for (idx3 = 0; idx3 < mi->mi_reset_length; idx3++, dp0 += 2) {
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_sia_general, (dp0[0] + 256 * dp0[1]) << 16);
- }
- sc->tulip_phyaddr = mi->mi_phyaddr;
- dp0 = &sc->tulip_rombuf[mi->mi_gpr_offset];
- for (idx3 = 0; idx3 < mi->mi_gpr_length; idx3++, dp0 += 2) {
- DELAY(10);
- TULIP_CSR_WRITE(sc, csr_sia_general, (dp0[0] + 256 * dp0[1]) << 16);
- }
-
- if (mi->mi_reset_length == 0 && mi->mi_gpr_length == 0)
- TULIP_CSR_WRITE(sc, csr_sia_general, 0);
-
- mi->mi_phyaddr = TULIP_MII_NOPHY;
- for (idx3 = 20; idx3 > 0 && mi->mi_phyaddr == TULIP_MII_NOPHY; idx3--) {
- DELAY(10000);
- mi->mi_phyaddr = tulip_mii_get_phyaddr(sc, phyno);
- }
- if (mi->mi_phyaddr == TULIP_MII_NOPHY) {
-#if defined(TULIP_DEBUG)
- if_printf(sc->tulip_ifp, "can't find phy %d\n",
- phyno);
-#endif
- break;
- }
- sc->tulip_features |= TULIP_HAVE_MII;
- mi->mi_capabilities = dp[0] + dp[1] * 256; dp += 2;
- mi->mi_advertisement = dp[0] + dp[1] * 256; dp += 2;
- mi->mi_full_duplex = dp[0] + dp[1] * 256; dp += 2;
- mi->mi_tx_threshold = dp[0] + dp[1] * 256; dp += 2;
- mi->mi_mii_interrupt = dp[0] + dp[1] * 256; dp += 2;
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX_FD);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASETX);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 100BASET4);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET_FD);
- TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, 10BASET);
- mi->mi_phyid = (tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDLOW) << 16) |
- tulip_mii_readreg(sc, mi->mi_phyaddr, PHYREG_IDHIGH);
- mi++;
- break;
- }
- case 4: { /* 21143 SYM block */
- tulip_media_t media;
- srom_media = (tulip_srom_media_t) dp[0];
- for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) {
- if (tulip_srom_mediums[idx3].sm_srom_type == srom_media)
- break;
- }
- media = tulip_srom_mediums[idx3].sm_type;
- if (media == TULIP_MEDIA_UNKNOWN)
- break;
- mi->mi_type = TULIP_MEDIAINFO_SYM;
- sc->tulip_mediums[media] = mi;
- mi->mi_gpcontrol = (dp[1] + dp[2] * 256) << 16;
- mi->mi_gpdata = (dp[3] + dp[4] * 256) << 16;
- data = dp[5] + dp[6] * 256;
- mi->mi_cmdmode = TULIP_SROM_2114X_CMDBITS(data);
- if (data & TULIP_SROM_2114X_NOINDICATOR) {
- mi->mi_actmask = 0;
- } else {
- mi->mi_default = (data & TULIP_SROM_2114X_DEFAULT) != 0;
- mi->mi_actmask = TULIP_SROM_2114X_BITPOS(data);
- mi->mi_actdata = (data & TULIP_SROM_2114X_POLARITY) ? 0 : mi->mi_actmask;
- }
- if (TULIP_IS_MEDIA_TP(media))
- sc->tulip_intrmask |= TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL;
- mi++;
- break;
- }
-#if 0
- case 5: { /* 21143 Reset block */
- mi->mi_type = TULIP_MEDIAINFO_RESET;
- mi->mi_reset_length = *dp++;
- mi->mi_reset_offset = dp - sc->tulip_rombuf;
- dp += 2 * mi->mi_reset_length;
- mi++;
- break;
- }
-#endif
- default: {
- }
- }
- dp = ep;
- }
- }
- return mi - sc->tulip_mediainfo;
-}
-
-static const struct {
- void (*vendor_identify_nic)(tulip_softc_t * const sc);
- unsigned char vendor_oui[3];
-} tulip_vendors[] = {
- { tulip_identify_dec_nic, { 0x08, 0x00, 0x2B } },
- { tulip_identify_dec_nic, { 0x00, 0x00, 0xF8 } },
- { tulip_identify_smc_nic, { 0x00, 0x00, 0xC0 } },
- { tulip_identify_smc_nic, { 0x00, 0xE0, 0x29 } },
- { tulip_identify_znyx_nic, { 0x00, 0xC0, 0x95 } },
- { tulip_identify_cogent_nic, { 0x00, 0x00, 0x92 } },
- { tulip_identify_asante_nic, { 0x00, 0x00, 0x94 } },
- { tulip_identify_cogent_nic, { 0x00, 0x00, 0xD1 } },
- { tulip_identify_accton_nic, { 0x00, 0x00, 0xE8 } },
- { tulip_identify_compex_nic, { 0x00, 0x80, 0x48 } },
- { NULL }
-};
-
-/*
- * This deals with the vagaries of the address roms and the
- * brain-deadness that various vendors commit in using them.
- */
-static int
-tulip_read_macaddr(
- tulip_softc_t * const sc)
-{
- unsigned cksum, rom_cksum, idx;
- u_int32_t csr;
- unsigned char tmpbuf[8];
- static const u_char testpat[] = { 0xFF, 0, 0x55, 0xAA, 0xFF, 0, 0x55, 0xAA };
-
- sc->tulip_connidx = TULIP_SROM_LASTCONNIDX;
-
- if (sc->tulip_chipid == TULIP_21040) {
- TULIP_CSR_WRITE(sc, csr_enetrom, 1);
- for (idx = 0; idx < sizeof(sc->tulip_rombuf); idx++) {
- int cnt = 0;
- while (((csr = TULIP_CSR_READ(sc, csr_enetrom)) & 0x80000000L) && cnt < 10000)
- cnt++;
- sc->tulip_rombuf[idx] = csr & 0xFF;
- }
- sc->tulip_boardsw = &tulip_21040_boardsw;
- } else {
- if (sc->tulip_chipid == TULIP_21041) {
- /*
- * Thankfully all 21041's act the same.
- */
- sc->tulip_boardsw = &tulip_21041_boardsw;
- } else {
- /*
- * Assume all 21140 board are compatible with the
- * DEC 10/100 evaluation board. Not really valid but
- * it's the best we can do until every one switches to
- * the new SROM format.
- */
-
- sc->tulip_boardsw = &tulip_21140_eb_boardsw;
- }
- tulip_srom_read(sc);
- if (tulip_srom_crcok(sc->tulip_rombuf)) {
- /*
- * SROM CRC is valid therefore it must be in the
- * new format.
- */
- sc->tulip_features |= TULIP_HAVE_ISVSROM|TULIP_HAVE_OKSROM;
- } else if (sc->tulip_rombuf[126] == 0xff && sc->tulip_rombuf[127] == 0xFF) {
- /*
- * No checksum is present. See if the SROM id checks out;
- * the first 18 bytes should be 0 followed by a 1 followed
- * by the number of adapters (which we don't deal with yet).
- */
- for (idx = 0; idx < 18; idx++) {
- if (sc->tulip_rombuf[idx] != 0)
- break;
- }
- if (idx == 18 && sc->tulip_rombuf[18] == 1 && sc->tulip_rombuf[19] != 0)
- sc->tulip_features |= TULIP_HAVE_ISVSROM;
- } else if (sc->tulip_chipid >= TULIP_21142) {
- sc->tulip_features |= TULIP_HAVE_ISVSROM;
- sc->tulip_boardsw = &tulip_2114x_isv_boardsw;
- }
- if ((sc->tulip_features & TULIP_HAVE_ISVSROM) && tulip_srom_decode(sc)) {
- if (sc->tulip_chipid != TULIP_21041)
- sc->tulip_boardsw = &tulip_2114x_isv_boardsw;
-
- /*
- * If the SROM specifies more than one adapter, tag this as a
- * BASE rom.
- */
- if (sc->tulip_rombuf[19] > 1)
- sc->tulip_features |= TULIP_HAVE_BASEROM;
- if (sc->tulip_boardsw == NULL)
- return -6;
- goto check_oui;
- }
- }
-
-
- if (bcmp(&sc->tulip_rombuf[0], &sc->tulip_rombuf[16], 8) != 0) {
- /*
- * Some folks don't use the standard ethernet rom format
- * but instead just put the address in the first 6 bytes
- * of the rom and let the rest be all 0xffs. (Can we say
- * ZNYX?) (well sometimes they put in a checksum so we'll
- * start at 8).
- */
- for (idx = 8; idx < 32; idx++) {
- if (sc->tulip_rombuf[idx] != 0xFF)
- return -4;
- }
- /*
- * Make sure the address is not multicast or locally assigned
- * that the OUI is not 00-00-00.
- */
- if ((sc->tulip_rombuf[0] & 3) != 0)
- return -4;
- if (sc->tulip_rombuf[0] == 0 && sc->tulip_rombuf[1] == 0
- && sc->tulip_rombuf[2] == 0)
- return -4;
- bcopy(sc->tulip_rombuf, sc->tulip_enaddr, 6);
- sc->tulip_features |= TULIP_HAVE_OKROM;
- goto check_oui;
- } else {
- /*
- * A number of makers of multiport boards (ZNYX and Cogent)
- * only put on one address ROM on their 21040 boards. So
- * if the ROM is all zeros (or all 0xFFs), look at the
- * previous configured boards (as long as they are on the same
- * PCI bus and the bus number is non-zero) until we find the
- * master board with address ROM. We then use its address ROM
- * as the base for this board. (we add our relative board
- * to the last byte of its address).
- */
- for (idx = 0; idx < sizeof(sc->tulip_rombuf); idx++) {
- if (sc->tulip_rombuf[idx] != 0 && sc->tulip_rombuf[idx] != 0xFF)
- break;
- }
- if (idx == sizeof(sc->tulip_rombuf)) {
- int root_unit;
- tulip_softc_t *root_sc = NULL;
- for (root_unit = sc->tulip_unit - 1; root_unit >= 0; root_unit--) {
- root_sc = tulips[root_unit];
- if (root_sc == NULL || (root_sc->tulip_features & (TULIP_HAVE_OKROM|TULIP_HAVE_SLAVEDROM)) == TULIP_HAVE_OKROM)
- break;
- root_sc = NULL;
- }
- if (root_sc != NULL && (root_sc->tulip_features & TULIP_HAVE_BASEROM)
- && root_sc->tulip_chipid == sc->tulip_chipid
- && root_sc->tulip_pci_busno == sc->tulip_pci_busno) {
- sc->tulip_features |= TULIP_HAVE_SLAVEDROM;
- sc->tulip_boardsw = root_sc->tulip_boardsw;
- strcpy(sc->tulip_boardid, root_sc->tulip_boardid);
- if (sc->tulip_boardsw->bd_type == TULIP_21140_ISV) {
- bcopy(root_sc->tulip_rombuf, sc->tulip_rombuf,
- sizeof(sc->tulip_rombuf));
- if (!tulip_srom_decode(sc))
- return -5;
- } else {
- bcopy(root_sc->tulip_enaddr, sc->tulip_enaddr, 6);
- sc->tulip_enaddr[5] += sc->tulip_unit - root_sc->tulip_unit;
- }
- /*
- * Now for a truly disgusting kludge: all 4 21040s on
- * the ZX314 share the same INTA line so the mapping
- * setup by the BIOS on the PCI bridge is worthless.
- * Rather than reprogramming the value in the config
- * register, we will handle this internally.
- */
- if (root_sc->tulip_features & TULIP_HAVE_SHAREDINTR) {
- sc->tulip_slaves = root_sc->tulip_slaves;
- root_sc->tulip_slaves = sc;
- sc->tulip_features |= TULIP_HAVE_SLAVEDINTR;
- }
- return 0;
- }
- }
- }
-
- /*
- * This is the standard DEC address ROM test.
- */
-
- if (bcmp(&sc->tulip_rombuf[24], testpat, 8) != 0)
- return -3;
-
- tmpbuf[0] = sc->tulip_rombuf[15]; tmpbuf[1] = sc->tulip_rombuf[14];
- tmpbuf[2] = sc->tulip_rombuf[13]; tmpbuf[3] = sc->tulip_rombuf[12];
- tmpbuf[4] = sc->tulip_rombuf[11]; tmpbuf[5] = sc->tulip_rombuf[10];
- tmpbuf[6] = sc->tulip_rombuf[9]; tmpbuf[7] = sc->tulip_rombuf[8];
- if (bcmp(&sc->tulip_rombuf[0], tmpbuf, 8) != 0)
- return -2;
-
- bcopy(sc->tulip_rombuf, sc->tulip_enaddr, 6);
-
- cksum = *(u_int16_t *) &sc->tulip_enaddr[0];
- cksum *= 2;
- if (cksum > 65535) cksum -= 65535;
- cksum += *(u_int16_t *) &sc->tulip_enaddr[2];
- if (cksum > 65535) cksum -= 65535;
- cksum *= 2;
- if (cksum > 65535) cksum -= 65535;
- cksum += *(u_int16_t *) &sc->tulip_enaddr[4];
- if (cksum >= 65535) cksum -= 65535;
-
- rom_cksum = *(u_int16_t *) &sc->tulip_rombuf[6];
-
- if (cksum != rom_cksum)
- return -1;
-
- check_oui:
- /*
- * Check for various boards based on OUI. Did I say braindead?
- */
- for (idx = 0; tulip_vendors[idx].vendor_identify_nic != NULL; idx++) {
- if (bcmp(sc->tulip_enaddr, tulip_vendors[idx].vendor_oui, 3) == 0) {
- (*tulip_vendors[idx].vendor_identify_nic)(sc);
- break;
- }
- }
-
- sc->tulip_features |= TULIP_HAVE_OKROM;
- return 0;
-}
-
-static void
-tulip_ifmedia_add(
- tulip_softc_t * const sc)
-{
- tulip_media_t media;
- int medias = 0;
-
- for (media = TULIP_MEDIA_UNKNOWN; media < TULIP_MEDIA_MAX; media++) {
- if (sc->tulip_mediums[media] != NULL) {
- ifmedia_add(&sc->tulip_ifmedia, tulip_media_to_ifmedia[media],
- 0, 0);
- medias++;
- }
- }
- if (medias == 0) {
- sc->tulip_features |= TULIP_HAVE_NOMEDIA;
- ifmedia_add(&sc->tulip_ifmedia, IFM_ETHER | IFM_NONE, 0, 0);
- ifmedia_set(&sc->tulip_ifmedia, IFM_ETHER | IFM_NONE);
- } else if (sc->tulip_media == TULIP_MEDIA_UNKNOWN) {
- ifmedia_add(&sc->tulip_ifmedia, IFM_ETHER | IFM_AUTO, 0, 0);
- ifmedia_set(&sc->tulip_ifmedia, IFM_ETHER | IFM_AUTO);
- } else {
- ifmedia_set(&sc->tulip_ifmedia, tulip_media_to_ifmedia[sc->tulip_media]);
- sc->tulip_flags |= TULIP_PRINTMEDIA;
- tulip_linkup(sc, sc->tulip_media);
- }
-}
-
-static int
-tulip_ifmedia_change(
- struct ifnet * const ifp)
-{
- tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc;
-
- sc->tulip_flags |= TULIP_NEEDRESET;
- sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
- sc->tulip_media = TULIP_MEDIA_UNKNOWN;
- if (IFM_SUBTYPE(sc->tulip_ifmedia.ifm_media) != IFM_AUTO) {
- tulip_media_t media;
- for (media = TULIP_MEDIA_UNKNOWN; media < TULIP_MEDIA_MAX; media++) {
- if (sc->tulip_mediums[media] != NULL
- && sc->tulip_ifmedia.ifm_media == tulip_media_to_ifmedia[media]) {
- sc->tulip_flags |= TULIP_PRINTMEDIA;
- sc->tulip_flags &= ~TULIP_DIDNWAY;
- tulip_linkup(sc, media);
- return 0;
- }
- }
- }
- sc->tulip_flags &= ~(TULIP_TXPROBE_ACTIVE|TULIP_WANTRXACT);
- tulip_reset(sc);
- tulip_init(sc);
- return 0;
-}
-
-/*
- * Media status callback
- */
-static void
-tulip_ifmedia_status(
- struct ifnet * const ifp,
- struct ifmediareq *req)
-{
- tulip_softc_t *sc = (tulip_softc_t *)ifp->if_softc;
-
- if (sc->tulip_media == TULIP_MEDIA_UNKNOWN)
- return;
-
- req->ifm_status = IFM_AVALID;
- if (sc->tulip_flags & TULIP_LINKUP)
- req->ifm_status |= IFM_ACTIVE;
-
- req->ifm_active = tulip_media_to_ifmedia[sc->tulip_media];
-}
-
-static void
-tulip_addr_filter(
- tulip_softc_t * const sc)
-{
- struct ifmultiaddr *ifma;
- u_char *addrp;
- int multicnt;
-
- sc->tulip_flags &= ~(TULIP_WANTHASHPERFECT|TULIP_WANTHASHONLY|TULIP_ALLMULTI);
- sc->tulip_flags |= TULIP_WANTSETUP|TULIP_WANTTXSTART;
- sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN;
- sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED;
-#if defined(IFF_ALLMULTI)
- if (sc->tulip_ifp->if_flags & IFF_ALLMULTI)
- sc->tulip_flags |= TULIP_ALLMULTI ;
-#endif
-
- multicnt = 0;
- TAILQ_FOREACH(ifma, &sc->tulip_ifp->if_multiaddrs, ifma_link) {
-
- if (ifma->ifma_addr->sa_family == AF_LINK)
- multicnt++;
- }
-
- sc->tulip_ifp->if_start = tulip_ifstart; /* so the setup packet gets queued */
- if (multicnt > 14) {
- u_int32_t *sp = sc->tulip_setupdata;
- unsigned hash;
- /*
- * Some early passes of the 21140 have broken implementations of
- * hash-perfect mode. When we get too many multicasts for perfect
- * filtering with these chips, we need to switch into hash-only
- * mode (this is better than all-multicast on network with lots
- * of multicast traffic).
- */
- if (sc->tulip_features & TULIP_HAVE_BROKEN_HASH)
- sc->tulip_flags |= TULIP_WANTHASHONLY;
- else
- sc->tulip_flags |= TULIP_WANTHASHPERFECT;
- /*
- * If we have more than 14 multicasts, we have
- * go into hash perfect mode (512 bit multicast
- * hash and one perfect hardware).
- */
- bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata));
-
- TAILQ_FOREACH(ifma, &sc->tulip_ifp->if_multiaddrs, ifma_link) {
-
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
-
- hash = tulip_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
-#if BYTE_ORDER == BIG_ENDIAN
- sp[hash >> 4] |= bswap32(1 << (hash & 0xF));
-#else
- sp[hash >> 4] |= 1 << (hash & 0xF);
-#endif
- }
- /*
- * No reason to use a hash if we are going to be
- * receiving every multicast.
- */
- if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) {
- hash = tulip_mchash(sc->tulip_ifp->if_broadcastaddr);
-#if BYTE_ORDER == BIG_ENDIAN
- sp[hash >> 4] |= bswap32(1 << (hash & 0xF));
-#else
- sp[hash >> 4] |= 1 << (hash & 0xF);
-#endif
- if (sc->tulip_flags & TULIP_WANTHASHONLY) {
- hash = tulip_mchash(IFP2ENADDR(sc->tulip_ifp));
-#if BYTE_ORDER == BIG_ENDIAN
- sp[hash >> 4] |= bswap32(1 << (hash & 0xF));
-#else
- sp[hash >> 4] |= 1 << (hash & 0xF);
-#endif
- } else {
-#if BYTE_ORDER == BIG_ENDIAN
- sp[39] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[0] << 16;
- sp[40] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[1] << 16;
- sp[41] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[2] << 16;
-#else
- sp[39] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[0];
- sp[40] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[1];
- sp[41] = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[2];
-#endif
- }
- }
- }
- if ((sc->tulip_flags & (TULIP_WANTHASHPERFECT|TULIP_WANTHASHONLY)) == 0) {
- u_int32_t *sp = sc->tulip_setupdata;
- int idx = 0;
- if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) {
- /*
- * Else can get perfect filtering for 16 addresses.
- */
- TAILQ_FOREACH(ifma, &sc->tulip_ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- addrp = LLADDR((struct sockaddr_dl *)ifma->ifma_addr);
-#if BYTE_ORDER == BIG_ENDIAN
- *sp++ = ((u_int16_t *) addrp)[0] << 16;
- *sp++ = ((u_int16_t *) addrp)[1] << 16;
- *sp++ = ((u_int16_t *) addrp)[2] << 16;
-#else
- *sp++ = ((u_int16_t *) addrp)[0];
- *sp++ = ((u_int16_t *) addrp)[1];
- *sp++ = ((u_int16_t *) addrp)[2];
-#endif
- idx++;
- }
- /*
- * Add the broadcast address.
- */
- idx++;
-#if BYTE_ORDER == BIG_ENDIAN
- *sp++ = 0xFFFF << 16;
- *sp++ = 0xFFFF << 16;
- *sp++ = 0xFFFF << 16;
-#else
- *sp++ = 0xFFFF;
- *sp++ = 0xFFFF;
- *sp++ = 0xFFFF;
-#endif
- }
- /*
- * Pad the rest with our hardware address
- */
- for (; idx < 16; idx++) {
-#if BYTE_ORDER == BIG_ENDIAN
- *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[0] << 16;
- *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[1] << 16;
- *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[2] << 16;
-#else
- *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[0];
- *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[1];
- *sp++ = ((u_int16_t *) IFP2ENADDR(sc->tulip_ifp))[2];
-#endif
- }
- }
-#if defined(IFF_ALLMULTI)
- if (sc->tulip_flags & TULIP_ALLMULTI)
- sc->tulip_ifp->if_flags |= IFF_ALLMULTI;
-#endif
-}
-
-static void
-tulip_reset(
- tulip_softc_t * const sc)
-{
- tulip_ringinfo_t *ri;
- tulip_desc_t *di;
- u_int32_t inreset = (sc->tulip_flags & TULIP_INRESET);
-
- /*
- * Brilliant. Simply brilliant. When switching modes/speeds
- * on a 2114*, you need to set the appriopriate MII/PCS/SCL/PS
- * bits in CSR6 and then do a software reset to get the 21140
- * to properly reset its internal pathways to the right places.
- * Grrrr.
- */
- if ((sc->tulip_flags & TULIP_DEVICEPROBE) == 0
- && sc->tulip_boardsw->bd_media_preset != NULL)
- (*sc->tulip_boardsw->bd_media_preset)(sc);
-
- TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET);
- DELAY(10); /* Wait 10 microseconds (actually 50 PCI cycles but at
- 33MHz that comes to two microseconds but wait a
- bit longer anyways) */
-
- if (!inreset) {
- sc->tulip_flags |= TULIP_INRESET;
- sc->tulip_flags &= ~(TULIP_NEEDRESET|TULIP_RXBUFSLOW);
- sc->tulip_ifp->if_flags &= ~IFF_OACTIVE;
- sc->tulip_ifp->if_start = tulip_ifstart;
- }
-
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX)
- TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txdescmap->dm_segs[0].ds_addr);
-#else
- TULIP_CSR_WRITE(sc, csr_txlist, TULIP_KVATOPHYS(sc, &sc->tulip_txinfo.ri_first[0]));
-#endif
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
- TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxdescmap->dm_segs[0].ds_addr);
-#else
- TULIP_CSR_WRITE(sc, csr_rxlist, TULIP_KVATOPHYS(sc, &sc->tulip_rxinfo.ri_first[0]));
-#endif
- TULIP_CSR_WRITE(sc, csr_busmode,
- (1 << (3 /*pci_max_burst_len*/ + 8))
- |TULIP_BUSMODE_CACHE_ALIGN8
- |TULIP_BUSMODE_READMULTIPLE
- |(BYTE_ORDER != LITTLE_ENDIAN ?
- TULIP_BUSMODE_DESC_BIGENDIAN : 0));
-
- sc->tulip_txtimer = 0;
- sc->tulip_txq.ifq_maxlen = TULIP_TXDESCS;
- /*
- * Free all the mbufs that were on the transmit ring.
- */
- for (;;) {
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX)
- bus_dmamap_t map;
-#endif
- struct mbuf *m;
- _IF_DEQUEUE(&sc->tulip_txq, m);
- if (m == NULL)
- break;
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX)
- map = M_GETCTX(m, bus_dmamap_t);
- bus_dmamap_unload(sc->tulip_dmatag, map);
- sc->tulip_txmaps[sc->tulip_txmaps_free++] = map;
-#endif
- m_freem(m);
- }
-
- ri = &sc->tulip_txinfo;
- ri->ri_nextin = ri->ri_nextout = ri->ri_first;
- ri->ri_free = ri->ri_max;
- for (di = ri->ri_first; di < ri->ri_last; di++)
- di->d_status = 0;
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX)
- bus_dmamap_sync(sc->tulip_dmatag, sc->tulip_txdescmap,
- 0, sc->tulip_txdescmap->dm_mapsize,
- BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
-#endif
-
- /*
- * We need to collect all the mbufs were on the
- * receive ring before we reinit it either to put
- * them back on or to know if we have to allocate
- * more.
- */
- ri = &sc->tulip_rxinfo;
- ri->ri_nextin = ri->ri_nextout = ri->ri_first;
- ri->ri_free = ri->ri_max;
- for (di = ri->ri_first; di < ri->ri_last; di++) {
- di->d_status = 0;
- di->d_length1 = 0; di->d_addr1 = 0;
- di->d_length2 = 0; di->d_addr2 = 0;
- }
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
- bus_dmamap_sync(sc->tulip_dmatag, sc->tulip_rxdescmap,
- 0, sc->tulip_rxdescmap->dm_mapsize,
- BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
-#endif
- for (;;) {
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
- bus_dmamap_t map;
-#endif
- struct mbuf *m;
- _IF_DEQUEUE(&sc->tulip_rxq, m);
- if (m == NULL)
- break;
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
- map = M_GETCTX(m, bus_dmamap_t);
- bus_dmamap_unload(sc->tulip_dmatag, map);
- sc->tulip_rxmaps[sc->tulip_rxmaps_free++] = map;
-#endif
- m_freem(m);
- }
-
- /*
- * If tulip_reset is being called recurisvely, exit quickly knowing
- * that when the outer tulip_reset returns all the right stuff will
- * have happened.
- */
- if (inreset)
- return;
-
- sc->tulip_intrmask |= TULIP_STS_NORMALINTR|TULIP_STS_RXINTR|TULIP_STS_TXINTR
- |TULIP_STS_ABNRMLINTR|TULIP_STS_SYSERROR|TULIP_STS_TXSTOPPED
- |TULIP_STS_TXUNDERFLOW|TULIP_STS_TXBABBLE
- |TULIP_STS_RXSTOPPED;
-
- if ((sc->tulip_flags & TULIP_DEVICEPROBE) == 0)
- (*sc->tulip_boardsw->bd_media_select)(sc);
-#if defined(TULIP_DEBUG)
- if ((sc->tulip_flags & TULIP_NEEDRESET) == TULIP_NEEDRESET)
- if_printf(sc->tulip_ifp,
- "tulip_reset: additional reset needed?!?\n");
-#endif
- if (bootverbose)
- tulip_media_print(sc);
- if (sc->tulip_features & TULIP_HAVE_DUALSENSE)
- TULIP_CSR_WRITE(sc, csr_sia_status, TULIP_CSR_READ(sc, csr_sia_status));
-
- sc->tulip_flags &= ~(TULIP_DOINGSETUP|TULIP_WANTSETUP|TULIP_INRESET
- |TULIP_RXACT);
- tulip_addr_filter(sc);
-}
-
-
-static void
-tulip_ifinit(
- void * sc)
-{
- tulip_init((tulip_softc_t *)sc);
-}
-
-static void
-tulip_init(
- tulip_softc_t * const sc)
-{
- if (sc->tulip_ifp->if_flags & IFF_UP) {
- if ((sc->tulip_ifp->if_flags & IFF_RUNNING) == 0) {
- /* initialize the media */
- tulip_reset(sc);
- }
- sc->tulip_ifp->if_flags |= IFF_RUNNING;
- if (sc->tulip_ifp->if_flags & IFF_PROMISC) {
- sc->tulip_flags |= TULIP_PROMISC;
- sc->tulip_cmdmode |= TULIP_CMD_PROMISCUOUS;
- sc->tulip_intrmask |= TULIP_STS_TXINTR;
- } else {
- sc->tulip_flags &= ~TULIP_PROMISC;
- sc->tulip_cmdmode &= ~TULIP_CMD_PROMISCUOUS;
- if (sc->tulip_flags & TULIP_ALLMULTI) {
- sc->tulip_cmdmode |= TULIP_CMD_ALLMULTI;
- } else {
- sc->tulip_cmdmode &= ~TULIP_CMD_ALLMULTI;
- }
- }
- sc->tulip_cmdmode |= TULIP_CMD_TXRUN;
- if ((sc->tulip_flags & (TULIP_TXPROBE_ACTIVE|TULIP_WANTSETUP)) == 0) {
- tulip_rx_intr(sc);
- sc->tulip_cmdmode |= TULIP_CMD_RXRUN;
- sc->tulip_intrmask |= TULIP_STS_RXSTOPPED;
- } else {
- sc->tulip_ifp->if_flags |= IFF_OACTIVE;
- sc->tulip_cmdmode &= ~TULIP_CMD_RXRUN;
- sc->tulip_intrmask &= ~TULIP_STS_RXSTOPPED;
- }
- TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
- TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
- if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP)
- tulip_txput_setup(sc);
- } else {
- sc->tulip_ifp->if_flags &= ~IFF_RUNNING;
- tulip_reset(sc);
- }
-}
-
-static void
-tulip_rx_intr(
- tulip_softc_t * const sc)
-{
- TULIP_PERFSTART(rxintr)
- tulip_ringinfo_t * const ri = &sc->tulip_rxinfo;
- struct ifnet * const ifp = sc->tulip_ifp;
- int fillok = 1;
-#if defined(TULIP_DEBUG)
- int cnt = 0;
-#endif
-
- for (;;) {
- TULIP_PERFSTART(rxget)
- tulip_desc_t *eop = ri->ri_nextin;
- int total_len = 0, last_offset = 0;
- struct mbuf *ms = NULL, *me = NULL;
- int accept = 0;
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
- bus_dmamap_t map;
- int error;
-#endif
-
- if (fillok && sc->tulip_rxq.ifq_len < TULIP_RXQ_TARGET)
- goto queue_mbuf;
-
-#if defined(TULIP_DEBUG)
- if (cnt == ri->ri_max)
- break;
-#endif
- /*
- * If the TULIP has no descriptors, there can't be any receive
- * descriptors to process.
- */
- if (eop == ri->ri_nextout)
- break;
-
- /*
- * 90% of the packets will fit in one descriptor. So we optimize
- * for that case.
- */
- TULIP_RXDESC_POSTSYNC(sc, eop, sizeof(*eop));
- if ((((volatile tulip_desc_t *) eop)->d_status & (TULIP_DSTS_OWNER|TULIP_DSTS_RxFIRSTDESC|TULIP_DSTS_RxLASTDESC)) == (TULIP_DSTS_RxFIRSTDESC|TULIP_DSTS_RxLASTDESC)) {
- _IF_DEQUEUE(&sc->tulip_rxq, ms);
- me = ms;
- } else {
- /*
- * If still owned by the TULIP, don't touch it.
- */
- if (((volatile tulip_desc_t *) eop)->d_status & TULIP_DSTS_OWNER)
- break;
-
- /*
- * It is possible (though improbable unless the BIG_PACKET support
- * is enabled or MCLBYTES < 1518) for a received packet to cross
- * more than one receive descriptor.
- */
- while ((((volatile tulip_desc_t *) eop)->d_status & TULIP_DSTS_RxLASTDESC) == 0) {
- if (++eop == ri->ri_last)
- eop = ri->ri_first;
- TULIP_RXDESC_POSTSYNC(sc, eop, sizeof(*eop));
- if (eop == ri->ri_nextout || ((((volatile tulip_desc_t *) eop)->d_status & TULIP_DSTS_OWNER))) {
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_rxintrs++;
- sc->tulip_dbg.dbg_rxpktsperintr[cnt]++;
-#endif
- TULIP_PERFEND(rxget);
- TULIP_PERFEND(rxintr);
- return;
- }
- total_len++;
- }
-
- /*
- * Dequeue the first buffer for the start of the packet. Hopefully
- * this will be the only one we need to dequeue. However, if the
- * packet consumed multiple descriptors, then we need to dequeue
- * those buffers and chain to the starting mbuf. All buffers but
- * the last buffer have the same length so we can set that now.
- * (we add to last_offset instead of multiplying since we normally
- * won't go into the loop and thereby saving ourselves from
- * doing a multiplication by 0 in the normal case).
- */
- _IF_DEQUEUE(&sc->tulip_rxq, ms);
- for (me = ms; total_len > 0; total_len--) {
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
- map = M_GETCTX(me, bus_dmamap_t);
- TULIP_RXMAP_POSTSYNC(sc, map);
- bus_dmamap_unload(sc->tulip_dmatag, map);
- sc->tulip_rxmaps[sc->tulip_rxmaps_free++] = map;
-#if defined(DIAGNOSTIC)
- M_SETCTX(me, NULL);
-#endif
-#endif /* TULIP_BUS_DMA */
- me->m_len = TULIP_RX_BUFLEN;
- last_offset += TULIP_RX_BUFLEN;
- _IF_DEQUEUE(&sc->tulip_rxq, me->m_next);
- me = me->m_next;
- }
- }
-
- /*
- * Now get the size of received packet (minus the CRC).
- */
- total_len = ((eop->d_status >> 16) & 0x7FFF) - 4;
- if ((sc->tulip_flags & TULIP_RXIGNORE) == 0
- && ((eop->d_status & TULIP_DSTS_ERRSUM) == 0
-#ifdef BIG_PACKET
- || (total_len <= sc->tulip_ifp->if_mtu + sizeof(struct ether_header) &&
- (eop->d_status & (TULIP_DSTS_RxBADLENGTH|TULIP_DSTS_RxRUNT|
- TULIP_DSTS_RxCOLLSEEN|TULIP_DSTS_RxBADCRC|
- TULIP_DSTS_RxOVERFLOW)) == 0)
-#endif
- )) {
- me->m_len = total_len - last_offset;
-
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
- map = M_GETCTX(me, bus_dmamap_t);
- bus_dmamap_sync(sc->tulip_dmatag, map, 0, me->m_len,
- BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
- bus_dmamap_unload(sc->tulip_dmatag, map);
- sc->tulip_rxmaps[sc->tulip_rxmaps_free++] = map;
-#if defined(DIAGNOSTIC)
- M_SETCTX(me, NULL);
-#endif
-#endif /* TULIP_BUS_DMA */
-
-#ifndef __FreeBSD__
- if (sc->tulip_ifp->if_bpf != NULL) {
- if (me == ms)
- bpf_tap(&sc->tulip_if, mtod(ms, caddr_t), total_len);
- else
- bpf_mtap(&sc->tulip_if, ms);
- }
-#endif
- sc->tulip_flags |= TULIP_RXACT;
- accept = 1;
- } else {
- ifp->if_ierrors++;
- if (eop->d_status & (TULIP_DSTS_RxBADLENGTH|TULIP_DSTS_RxOVERFLOW|TULIP_DSTS_RxWATCHDOG)) {
- sc->tulip_dot3stats.dot3StatsInternalMacReceiveErrors++;
- } else {
-#if defined(TULIP_VERBOSE)
- const char *error = NULL;
-#endif
- if (eop->d_status & TULIP_DSTS_RxTOOLONG) {
- sc->tulip_dot3stats.dot3StatsFrameTooLongs++;
-#if defined(TULIP_VERBOSE)
- error = "frame too long";
-#endif
- }
- if (eop->d_status & TULIP_DSTS_RxBADCRC) {
- if (eop->d_status & TULIP_DSTS_RxDRBBLBIT) {
- sc->tulip_dot3stats.dot3StatsAlignmentErrors++;
-#if defined(TULIP_VERBOSE)
- error = "alignment error";
-#endif
- } else {
- sc->tulip_dot3stats.dot3StatsFCSErrors++;
-#if defined(TULIP_VERBOSE)
- error = "bad crc";
-#endif
- }
- }
-#if defined(TULIP_VERBOSE)
- if (error != NULL && (sc->tulip_flags & TULIP_NOMESSAGES) == 0) {
- if_printf(sc->tulip_ifp, "receive: %6D: %s\n",
- mtod(ms, u_char *) + 6, ":",
- error);
- sc->tulip_flags |= TULIP_NOMESSAGES;
- }
-#endif
- }
-
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
- map = M_GETCTX(me, bus_dmamap_t);
- bus_dmamap_unload(sc->tulip_dmatag, map);
- sc->tulip_rxmaps[sc->tulip_rxmaps_free++] = map;
-#if defined(DIAGNOSTIC)
- M_SETCTX(me, NULL);
-#endif
-#endif /* TULIP_BUS_DMA */
- }
-#if defined(TULIP_DEBUG)
- cnt++;
-#endif
- ifp->if_ipackets++;
- if (++eop == ri->ri_last)
- eop = ri->ri_first;
- ri->ri_nextin = eop;
- queue_mbuf:
- /*
- * Either we are priming the TULIP with mbufs (m == NULL)
- * or we are about to accept an mbuf for the upper layers
- * so we need to allocate an mbuf to replace it. If we
- * can't replace it, send up it anyways. This may cause
- * us to drop packets in the future but that's better than
- * being caught in livelock.
- *
- * Note that if this packet crossed multiple descriptors
- * we don't even try to reallocate all the mbufs here.
- * Instead we rely on the test of the beginning of
- * the loop to refill for the extra consumed mbufs.
- */
- if (accept || ms == NULL) {
- struct mbuf *m0;
- MGETHDR(m0, M_DONTWAIT, MT_DATA);
- if (m0 != NULL) {
-#if defined(TULIP_COPY_RXDATA)
- if (!accept || total_len >= (MHLEN - 2)) {
-#endif
- MCLGET(m0, M_DONTWAIT);
- if ((m0->m_flags & M_EXT) == 0) {
- m_freem(m0);
- m0 = NULL;
- }
-#if defined(TULIP_COPY_RXDATA)
- }
-#endif
- }
- if (accept
-#if defined(TULIP_COPY_RXDATA)
- && m0 != NULL
-#endif
- ) {
-#if !defined(TULIP_COPY_RXDATA)
- ms->m_pkthdr.len = total_len;
- ms->m_pkthdr.rcvif = ifp;
- (*ifp->if_input)(ifp, ms);
-#else
-#ifdef BIG_PACKET
-#error BIG_PACKET is incompatible with TULIP_COPY_RXDATA
-#endif
- m0->m_data += 2; /* align data after header */
- m_copydata(ms, 0, total_len, mtod(m0, caddr_t));
- m0->m_len = m0->m_pkthdr.len = total_len;
- m0->m_pkthdr.rcvif = ifp;
- (*ifp->if_input)(ifp, m0);
- m0 = ms;
-#endif /* ! TULIP_COPY_RXDATA */
- }
- ms = m0;
- }
- if (ms == NULL) {
- /*
- * Couldn't allocate a new buffer. Don't bother
- * trying to replenish the receive queue.
- */
- fillok = 0;
- sc->tulip_flags |= TULIP_RXBUFSLOW;
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_rxlowbufs++;
-#endif
- TULIP_PERFEND(rxget);
- continue;
- }
- /*
- * Now give the buffer(s) to the TULIP and save in our
- * receive queue.
- */
- do {
- tulip_desc_t * const nextout = ri->ri_nextout;
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
- if (sc->tulip_rxmaps_free > 0) {
- map = sc->tulip_rxmaps[--sc->tulip_rxmaps_free];
- } else {
- m_freem(ms);
- sc->tulip_flags |= TULIP_RXBUFSLOW;
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_rxlowbufs++;
-#endif
- break;
- }
- M_SETCTX(ms, map);
- error = bus_dmamap_load(sc->tulip_dmatag, map, mtod(ms, void *),
- TULIP_RX_BUFLEN, NULL, BUS_DMA_NOWAIT);
- if (error) {
- if_printf(sc->tulip_ifp,
- "unable to load rx map, error = %d\n", error);
- panic("tulip_rx_intr"); /* XXX */
- }
- nextout->d_addr1 = map->dm_segs[0].ds_addr;
- nextout->d_length1 = map->dm_segs[0].ds_len;
- if (map->dm_nsegs == 2) {
- nextout->d_addr2 = map->dm_segs[1].ds_addr;
- nextout->d_length2 = map->dm_segs[1].ds_len;
- } else {
- nextout->d_addr2 = 0;
- nextout->d_length2 = 0;
- }
- TULIP_RXDESC_POSTSYNC(sc, nextout, sizeof(*nextout));
-#else /* TULIP_BUS_DMA */
- nextout->d_addr1 = TULIP_KVATOPHYS(sc, mtod(ms, caddr_t));
- nextout->d_length1 = TULIP_RX_BUFLEN;
-#endif /* TULIP_BUS_DMA */
- nextout->d_status = TULIP_DSTS_OWNER;
- TULIP_RXDESC_POSTSYNC(sc, nextout, sizeof(u_int32_t));
- if (++ri->ri_nextout == ri->ri_last)
- ri->ri_nextout = ri->ri_first;
- me = ms->m_next;
- ms->m_next = NULL;
- _IF_ENQUEUE(&sc->tulip_rxq, ms);
- } while ((ms = me) != NULL);
-
- if (sc->tulip_rxq.ifq_len >= TULIP_RXQ_TARGET)
- sc->tulip_flags &= ~TULIP_RXBUFSLOW;
- TULIP_PERFEND(rxget);
- }
-
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_rxintrs++;
- sc->tulip_dbg.dbg_rxpktsperintr[cnt]++;
-#endif
- TULIP_PERFEND(rxintr);
-}
-
-static int
-tulip_tx_intr(
- tulip_softc_t * const sc)
-{
- TULIP_PERFSTART(txintr)
- tulip_ringinfo_t * const ri = &sc->tulip_txinfo;
- struct mbuf *m;
- int xmits = 0;
- int descs = 0;
-
- while (ri->ri_free < ri->ri_max) {
- u_int32_t d_flag;
-
- TULIP_TXDESC_POSTSYNC(sc, ri->ri_nextin, sizeof(*ri->ri_nextin));
- if (((volatile tulip_desc_t *) ri->ri_nextin)->d_status & TULIP_DSTS_OWNER)
- break;
-
- ri->ri_free++;
- descs++;
- d_flag = ri->ri_nextin->d_flag;
- if (d_flag & TULIP_DFLAG_TxLASTSEG) {
- if (d_flag & TULIP_DFLAG_TxSETUPPKT) {
- /*
- * We've just finished processing a setup packet.
- * Mark that we finished it. If there's not
- * another pending, startup the TULIP receiver.
- * Make sure we ack the RXSTOPPED so we won't get
- * an abormal interrupt indication.
- */
- TULIP_TXMAP_POSTSYNC(sc, sc->tulip_setupmap);
- sc->tulip_flags &= ~(TULIP_DOINGSETUP|TULIP_HASHONLY);
- if (ri->ri_nextin->d_flag & TULIP_DFLAG_TxINVRSFILT)
- sc->tulip_flags |= TULIP_HASHONLY;
- if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == 0) {
- tulip_rx_intr(sc);
- sc->tulip_cmdmode |= TULIP_CMD_RXRUN;
- sc->tulip_intrmask |= TULIP_STS_RXSTOPPED;
- TULIP_CSR_WRITE(sc, csr_status, TULIP_STS_RXSTOPPED);
- TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
- TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
- }
- } else {
- const u_int32_t d_status = ri->ri_nextin->d_status;
- _IF_DEQUEUE(&sc->tulip_txq, m);
- if (m != NULL) {
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX)
- bus_dmamap_t map = M_GETCTX(m, bus_dmamap_t);
- TULIP_TXMAP_POSTSYNC(sc, map);
- sc->tulip_txmaps[sc->tulip_txmaps_free++] = map;
-#endif /* TULIP_BUS_DMA */
- m_freem(m);
-#if defined(TULIP_DEBUG)
- } else {
- if_printf(sc->tulip_ifp,
- "tx_intr: failed to dequeue mbuf?!?\n");
-#endif
- }
- if (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) {
- tulip_mediapoll_event_t event = TULIP_MEDIAPOLL_TXPROBE_OK;
- if (d_status & (TULIP_DSTS_TxNOCARR|TULIP_DSTS_TxEXCCOLL)) {
-#if defined(TULIP_DEBUG)
- if (d_status & TULIP_DSTS_TxNOCARR)
- sc->tulip_dbg.dbg_txprobe_nocarr++;
- if (d_status & TULIP_DSTS_TxEXCCOLL)
- sc->tulip_dbg.dbg_txprobe_exccoll++;
-#endif
- event = TULIP_MEDIAPOLL_TXPROBE_FAILED;
- }
- (*sc->tulip_boardsw->bd_media_poll)(sc, event);
- /*
- * Escape from the loop before media poll has reset the TULIP!
- */
- break;
- } else {
- xmits++;
- if (d_status & TULIP_DSTS_ERRSUM) {
- sc->tulip_ifp->if_oerrors++;
- if (d_status & TULIP_DSTS_TxEXCCOLL)
- sc->tulip_dot3stats.dot3StatsExcessiveCollisions++;
- if (d_status & TULIP_DSTS_TxLATECOLL)
- sc->tulip_dot3stats.dot3StatsLateCollisions++;
- if (d_status & (TULIP_DSTS_TxNOCARR|TULIP_DSTS_TxCARRLOSS))
- sc->tulip_dot3stats.dot3StatsCarrierSenseErrors++;
- if (d_status & (TULIP_DSTS_TxUNDERFLOW|TULIP_DSTS_TxBABBLE))
- sc->tulip_dot3stats.dot3StatsInternalMacTransmitErrors++;
- if (d_status & TULIP_DSTS_TxUNDERFLOW)
- sc->tulip_dot3stats.dot3StatsInternalTransmitUnderflows++;
- if (d_status & TULIP_DSTS_TxBABBLE)
- sc->tulip_dot3stats.dot3StatsInternalTransmitBabbles++;
- } else {
- u_int32_t collisions =
- (d_status & TULIP_DSTS_TxCOLLMASK)
- >> TULIP_DSTS_V_TxCOLLCNT;
- sc->tulip_ifp->if_collisions += collisions;
- if (collisions == 1)
- sc->tulip_dot3stats.dot3StatsSingleCollisionFrames++;
- else if (collisions > 1)
- sc->tulip_dot3stats.dot3StatsMultipleCollisionFrames++;
- else if (d_status & TULIP_DSTS_TxDEFERRED)
- sc->tulip_dot3stats.dot3StatsDeferredTransmissions++;
- /*
- * SQE is only valid for 10baseT/BNC/AUI when not
- * running in full-duplex. In order to speed up the
- * test, the corresponding bit in tulip_flags needs to
- * set as well to get us to count SQE Test Errors.
- */
- if (d_status & TULIP_DSTS_TxNOHRTBT & sc->tulip_flags)
- sc->tulip_dot3stats.dot3StatsSQETestErrors++;
- }
- }
- }
- }
-
- if (++ri->ri_nextin == ri->ri_last)
- ri->ri_nextin = ri->ri_first;
-
- if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0)
- sc->tulip_ifp->if_flags &= ~IFF_OACTIVE;
- }
- /*
- * If nothing left to transmit, disable the timer.
- * Else if progress, reset the timer back to 2 ticks.
- */
- if (ri->ri_free == ri->ri_max || (sc->tulip_flags & TULIP_TXPROBE_ACTIVE))
- sc->tulip_txtimer = 0;
- else if (xmits > 0)
- sc->tulip_txtimer = TULIP_TXTIMER;
- sc->tulip_ifp->if_opackets += xmits;
- TULIP_PERFEND(txintr);
- return descs;
-}
-
-static void
-tulip_print_abnormal_interrupt(
- tulip_softc_t * const sc,
- u_int32_t csr)
-{
- const char * const *msgp = tulip_status_bits;
- const char *sep;
- u_int32_t mask;
- const char thrsh[] = "72|128\0\0\0" "96|256\0\0\0" "128|512\0\0" "160|1024";
-
- csr &= (1 << (sizeof(tulip_status_bits)/sizeof(tulip_status_bits[0]))) - 1;
- if_printf(sc->tulip_ifp, "abnormal interrupt:");
- for (sep = " ", mask = 1; mask <= csr; mask <<= 1, msgp++) {
- if ((csr & mask) && *msgp != NULL) {
- printf("%s%s", sep, *msgp);
- if (mask == TULIP_STS_TXUNDERFLOW && (sc->tulip_flags & TULIP_NEWTXTHRESH)) {
- sc->tulip_flags &= ~TULIP_NEWTXTHRESH;
- if (sc->tulip_cmdmode & TULIP_CMD_STOREFWD) {
- printf(" (switching to store-and-forward mode)");
- } else {
- printf(" (raising TX threshold to %s)",
- &thrsh[9 * ((sc->tulip_cmdmode & TULIP_CMD_THRESHOLDCTL) >> 14)]);
- }
- }
- sep = ", ";
- }
- }
- printf("\n");
-}
-
-static void
-tulip_intr_handler(
- tulip_softc_t * const sc,
- int *progress_p)
-{
- TULIP_PERFSTART(intr)
- u_int32_t csr;
-
- while ((csr = TULIP_CSR_READ(sc, csr_status)) & sc->tulip_intrmask) {
- *progress_p = 1;
- TULIP_CSR_WRITE(sc, csr_status, csr);
-
- if (csr & TULIP_STS_SYSERROR) {
- sc->tulip_last_system_error = (csr & TULIP_STS_ERRORMASK) >> TULIP_STS_ERR_SHIFT;
- if (sc->tulip_flags & TULIP_NOMESSAGES) {
- sc->tulip_flags |= TULIP_SYSTEMERROR;
- } else {
- if_printf(sc->tulip_ifp, "system error: %s\n",
- tulip_system_errors[sc->tulip_last_system_error]);
- }
- sc->tulip_flags |= TULIP_NEEDRESET;
- sc->tulip_system_errors++;
- break;
- }
- if (csr & (TULIP_STS_LINKPASS|TULIP_STS_LINKFAIL) & sc->tulip_intrmask) {
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_link_intrs++;
-#endif
- if (sc->tulip_boardsw->bd_media_poll != NULL) {
- (*sc->tulip_boardsw->bd_media_poll)(sc, csr & TULIP_STS_LINKFAIL
- ? TULIP_MEDIAPOLL_LINKFAIL
- : TULIP_MEDIAPOLL_LINKPASS);
- csr &= ~TULIP_STS_ABNRMLINTR;
- }
- tulip_media_print(sc);
- }
- if (csr & (TULIP_STS_RXINTR|TULIP_STS_RXNOBUF)) {
- u_int32_t misses = TULIP_CSR_READ(sc, csr_missed_frames);
- if (csr & TULIP_STS_RXNOBUF)
- sc->tulip_dot3stats.dot3StatsMissedFrames += misses & 0xFFFF;
- /*
- * Pass 2.[012] of the 21140A-A[CDE] may hang and/or corrupt data
- * on receive overflows.
- */
- if ((misses & 0x0FFE0000) && (sc->tulip_features & TULIP_HAVE_RXBADOVRFLW)) {
- sc->tulip_dot3stats.dot3StatsInternalMacReceiveErrors++;
- /*
- * Stop the receiver process and spin until it's stopped.
- * Tell rx_intr to drop the packets it dequeues.
- */
- TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode & ~TULIP_CMD_RXRUN);
- while ((TULIP_CSR_READ(sc, csr_status) & TULIP_STS_RXSTOPPED) == 0)
- ;
- TULIP_CSR_WRITE(sc, csr_status, TULIP_STS_RXSTOPPED);
- sc->tulip_flags |= TULIP_RXIGNORE;
- }
- tulip_rx_intr(sc);
- if (sc->tulip_flags & TULIP_RXIGNORE) {
- /*
- * Restart the receiver.
- */
- sc->tulip_flags &= ~TULIP_RXIGNORE;
- TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
- }
- }
- if (csr & TULIP_STS_ABNRMLINTR) {
- u_int32_t tmp = csr & sc->tulip_intrmask
- & ~(TULIP_STS_NORMALINTR|TULIP_STS_ABNRMLINTR);
- if (csr & TULIP_STS_TXUNDERFLOW) {
- if ((sc->tulip_cmdmode & TULIP_CMD_THRESHOLDCTL) != TULIP_CMD_THRSHLD160) {
- sc->tulip_cmdmode += TULIP_CMD_THRSHLD96;
- sc->tulip_flags |= TULIP_NEWTXTHRESH;
- } else if (sc->tulip_features & TULIP_HAVE_STOREFWD) {
- sc->tulip_cmdmode |= TULIP_CMD_STOREFWD;
- sc->tulip_flags |= TULIP_NEWTXTHRESH;
- }
- }
- if (sc->tulip_flags & TULIP_NOMESSAGES) {
- sc->tulip_statusbits |= tmp;
- } else {
- tulip_print_abnormal_interrupt(sc, tmp);
- sc->tulip_flags |= TULIP_NOMESSAGES;
- }
- TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode);
- }
- if (sc->tulip_flags & (TULIP_WANTTXSTART|TULIP_TXPROBE_ACTIVE|TULIP_DOINGSETUP|TULIP_PROMISC)) {
- tulip_tx_intr(sc);
- if ((sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0)
- tulip_ifstart(sc->tulip_ifp);
- }
- }
- if (sc->tulip_flags & TULIP_NEEDRESET) {
- tulip_reset(sc);
- tulip_init(sc);
- }
- TULIP_PERFEND(intr);
-}
-
-#if defined(TULIP_USE_SOFTINTR)
-/*
- * This is an experimental idea to alleviate problems due to interrupt
- * livelock. What is interrupt livelock? It's when you spend all your
- * time servicing device interrupts and never drop below device ipl
- * to do "useful" work.
- *
- * So what we do here is see if the device needs service and if so,
- * disable interrupts (dismiss the interrupt), place it in a list of devices
- * needing service, and issue a network software interrupt.
- *
- * When our network software interrupt routine gets called, we simply
- * walk done the list of devices that we have created and deal with them
- * at splnet/splsoftnet.
- *
- */
-static void
-tulip_hardintr_handler(
- tulip_softc_t * const sc,
- int *progress_p)
-{
- if (TULIP_CSR_READ(sc, csr_status) & (TULIP_STS_NORMALINTR|TULIP_STS_ABNRMLINTR) == 0)
- return;
- *progress_p = 1;
- /*
- * disable interrupts
- */
- TULIP_CSR_WRITE(sc, csr_intr, 0);
- /*
- * mark it as needing a software interrupt
- */
- tulip_softintr_mask |= (1U << sc->tulip_unit);
-}
-
-static void
-tulip_softintr(
- void)
-{
- u_int32_t softintr_mask, mask;
- int progress = 0;
- int unit;
- int s;
-
- /*
- * Copy mask to local copy and reset global one to 0.
- */
- s = splimp();
- softintr_mask = tulip_softintr_mask;
- tulip_softintr_mask = 0;
- splx(s);
-
- /*
- * Optimize for the single unit case.
- */
- if (tulip_softintr_max_unit == 0) {
- if (softintr_mask & 1) {
- tulip_softc_t * const sc = tulips[0];
- /*
- * Handle the "interrupt" and then reenable interrupts
- */
- softintr_mask = 0;
- tulip_intr_handler(sc, &progress);
- TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
- }
- return;
- }
-
- /*
- * Handle all "queued" interrupts in a round robin fashion.
- * This is done so as not to favor a particular interface.
- */
- unit = tulip_softintr_last_unit;
- mask = (1U << unit);
- while (softintr_mask != 0) {
- if (tulip_softintr_max_unit == unit) {
- unit = 0; mask = 1;
- } else {
- unit += 1; mask <<= 1;
- }
- if (softintr_mask & mask) {
- tulip_softc_t * const sc = tulips[unit];
- /*
- * Handle the "interrupt" and then reenable interrupts
- */
- softintr_mask ^= mask;
- tulip_intr_handler(sc, &progress);
- TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
- }
- }
-
- /*
- * Save where we ending up.
- */
- tulip_softintr_last_unit = unit;
-}
-#endif /* TULIP_USE_SOFTINTR */
-
-static void
-tulip_intr_shared(
- void *arg)
-{
- tulip_softc_t * sc = arg;
- int progress = 0;
-
- for (; sc != NULL; sc = sc->tulip_slaves) {
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_intrs++;
-#endif
-#if defined(TULIP_USE_SOFTINTR)
- tulip_hardintr_handler(sc, &progress);
-#else
- tulip_intr_handler(sc, &progress);
-#endif
- }
-#if defined(TULIP_USE_SOFTINTR)
- if (progress)
- schednetisr(NETISR_DE);
-#endif
-}
-
-static void
-tulip_intr_normal(
- void *arg)
-{
- tulip_softc_t * sc = (tulip_softc_t *) arg;
- int progress = 0;
-
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_intrs++;
-#endif
-#if defined(TULIP_USE_SOFTINTR)
- tulip_hardintr_handler(sc, &progress);
- if (progress)
- schednetisr(NETISR_DE);
-#else
- tulip_intr_handler(sc, &progress);
-#endif
-}
-
-static struct mbuf *
-tulip_mbuf_compress(
- struct mbuf *m)
-{
- struct mbuf *m0;
-#if MCLBYTES >= ETHERMTU + 18 && !defined(BIG_PACKET)
- MGETHDR(m0, M_DONTWAIT, MT_DATA);
- if (m0 != NULL) {
- if (m->m_pkthdr.len > MHLEN) {
- MCLGET(m0, M_DONTWAIT);
- if ((m0->m_flags & M_EXT) == 0) {
- m_freem(m);
- m_freem(m0);
- return NULL;
- }
- }
- m_copydata(m, 0, m->m_pkthdr.len, mtod(m0, caddr_t));
- m0->m_pkthdr.len = m0->m_len = m->m_pkthdr.len;
- }
-#else
- int mlen = MHLEN;
- int len = m->m_pkthdr.len;
- struct mbuf **mp = &m0;
-
- while (len > 0) {
- if (mlen == MHLEN) {
- MGETHDR(*mp, M_DONTWAIT, MT_DATA);
- } else {
- MGET(*mp, M_DONTWAIT, MT_DATA);
- }
- if (*mp == NULL) {
- m_freem(m0);
- m0 = NULL;
- break;
- }
- if (len > MLEN) {
- MCLGET(*mp, M_DONTWAIT);
- if (((*mp)->m_flags & M_EXT) == 0) {
- m_freem(m0);
- m0 = NULL;
- break;
- }
- (*mp)->m_len = len <= MCLBYTES ? len : MCLBYTES;
- } else {
- (*mp)->m_len = len <= mlen ? len : mlen;
- }
- m_copydata(m, m->m_pkthdr.len - len,
- (*mp)->m_len, mtod((*mp), caddr_t));
- len -= (*mp)->m_len;
- mp = &(*mp)->m_next;
- mlen = MLEN;
- }
-#endif
- m_freem(m);
- return m0;
-}
-
-static struct mbuf *
-tulip_txput(
- tulip_softc_t * const sc,
- struct mbuf *m)
-{
- TULIP_PERFSTART(txput)
- tulip_ringinfo_t * const ri = &sc->tulip_txinfo;
- tulip_desc_t *eop, *nextout;
- int segcnt, free;
- u_int32_t d_status;
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX)
- bus_dmamap_t map;
- int error;
-#else
- struct mbuf *m0;
-#endif
-
-#if defined(TULIP_DEBUG)
- if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) {
- if_printf(sc->tulip_ifp, "txput%s: tx not running\n",
- (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) ? "(probe)" : "");
- sc->tulip_flags |= TULIP_WANTTXSTART;
- sc->tulip_dbg.dbg_txput_finishes[0]++;
- goto finish;
- }
-#endif
-
- /*
- * Now we try to fill in our transmit descriptors. This is
- * a bit reminiscent of going on the Ark two by two
- * since each descriptor for the TULIP can describe
- * two buffers. So we advance through packet filling
- * each of the two entries at a time to to fill each
- * descriptor. Clear the first and last segment bits
- * in each descriptor (actually just clear everything
- * but the end-of-ring or chain bits) to make sure
- * we don't get messed up by previously sent packets.
- *
- * We may fail to put the entire packet on the ring if
- * there is either not enough ring entries free or if the
- * packet has more than MAX_TXSEG segments. In the former
- * case we will just wait for the ring to empty. In the
- * latter case we have to recopy.
- */
-#if !defined(TULIP_BUS_DMA) || defined(TULIP_BUS_DMA_NOTX)
- again:
- m0 = m;
-#endif
- d_status = 0;
- eop = nextout = ri->ri_nextout;
- segcnt = 0;
- free = ri->ri_free;
-
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX)
- /*
- * Reclaim some dma maps from if we are out.
- */
- if (sc->tulip_txmaps_free == 0) {
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_no_txmaps++;
-#endif
- free += tulip_tx_intr(sc);
- }
- if (sc->tulip_txmaps_free > 0) {
- map = sc->tulip_txmaps[sc->tulip_txmaps_free-1];
- } else {
- sc->tulip_flags |= TULIP_WANTTXSTART;
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_txput_finishes[1]++;
-#endif
- goto finish;
- }
- error = bus_dmamap_load_mbuf(sc->tulip_dmatag, map, m, BUS_DMA_NOWAIT);
- if (error != 0) {
- if (error == EFBIG) {
- /*
- * The packet exceeds the number of transmit buffer
- * entries that we can use for one packet, so we have
- * to recopy it into one mbuf and then try again.
- */
- m = tulip_mbuf_compress(m);
- if (m == NULL) {
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_txput_finishes[2]++;
-#endif
- goto finish;
- }
- error = bus_dmamap_load_mbuf(sc->tulip_dmatag, map, m, BUS_DMA_NOWAIT);
- }
- if (error != 0) {
- if_printf(sc->tulip_ifp,
- "unable to load tx map, error = %d\n", error);
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_txput_finishes[3]++;
-#endif
- goto finish;
- }
- }
- if ((free -= (map->dm_nsegs + 1) / 2) <= 0
- /*
- * See if there's any unclaimed space in the transmit ring.
- */
- && (free += tulip_tx_intr(sc)) <= 0) {
- /*
- * There's no more room but since nothing
- * has been committed at this point, just
- * show output is active, put back the
- * mbuf and return.
- */
- sc->tulip_flags |= TULIP_WANTTXSTART;
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_txput_finishes[4]++;
-#endif
- bus_dmamap_unload(sc->tulip_dmatag, map);
- goto finish;
- }
- for (; map->dm_nsegs - segcnt > 1; segcnt += 2) {
- eop = nextout;
- eop->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
- eop->d_status = d_status;
- eop->d_addr1 = map->dm_segs[segcnt].ds_addr;
- eop->d_length1 = map->dm_segs[segcnt].ds_len;
- eop->d_addr2 = map->dm_segs[segcnt+1].ds_addr;
- eop->d_length2 = map->dm_segs[segcnt+1].ds_len;
- d_status = TULIP_DSTS_OWNER;
- if (++nextout == ri->ri_last)
- nextout = ri->ri_first;
- }
- if (segcnt < map->dm_nsegs) {
- eop = nextout;
- eop->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
- eop->d_status = d_status;
- eop->d_addr1 = map->dm_segs[segcnt].ds_addr;
- eop->d_length1 = map->dm_segs[segcnt].ds_len;
- eop->d_addr2 = 0;
- eop->d_length2 = 0;
- if (++nextout == ri->ri_last)
- nextout = ri->ri_first;
- }
- TULIP_TXMAP_PRESYNC(sc, map);
- M_SETCTX(m, map);
- map = NULL;
- --sc->tulip_txmaps_free; /* commit to using the dmamap */
-
-#else /* !TULIP_BUS_DMA */
-
- do {
- int len = m0->m_len;
- caddr_t addr = mtod(m0, caddr_t);
- unsigned clsize = PAGE_SIZE - (((uintptr_t) addr) & (PAGE_SIZE-1));
-
- while (len > 0) {
- unsigned slen = min(len, clsize);
-#ifdef BIG_PACKET
- int partial = 0;
- if (slen >= 2048)
- slen = 2040, partial = 1;
-#endif
- segcnt++;
- if (segcnt > TULIP_MAX_TXSEG) {
- /*
- * The packet exceeds the number of transmit buffer
- * entries that we can use for one packet, so we have
- * recopy it into one mbuf and then try again.
- */
- m = tulip_mbuf_compress(m);
- if (m == NULL)
- goto finish;
- goto again;
- }
- if (segcnt & 1) {
- if (--free == 0) {
- /*
- * See if there's any unclaimed space in the
- * transmit ring.
- */
- if ((free += tulip_tx_intr(sc)) == 0) {
- /*
- * There's no more room but since nothing
- * has been committed at this point, just
- * show output is active, put back the
- * mbuf and return.
- */
- sc->tulip_flags |= TULIP_WANTTXSTART;
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_txput_finishes[1]++;
-#endif
- goto finish;
- }
- }
- eop = nextout;
- if (++nextout == ri->ri_last)
- nextout = ri->ri_first;
- eop->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
- eop->d_status = d_status;
- eop->d_addr1 = TULIP_KVATOPHYS(sc, addr);
- eop->d_length1 = slen;
- } else {
- /*
- * Fill in second half of descriptor
- */
- eop->d_addr2 = TULIP_KVATOPHYS(sc, addr);
- eop->d_length2 = slen;
- }
- d_status = TULIP_DSTS_OWNER;
- len -= slen;
- addr += slen;
-#ifdef BIG_PACKET
- if (partial)
- continue;
-#endif
- clsize = PAGE_SIZE;
- }
- } while ((m0 = m0->m_next) != NULL);
-#endif /* TULIP_BUS_DMA */
-
- /*
- * bounce a copy to the bpf listener, if any.
- */
- BPF_MTAP(sc->tulip_ifp, m);
-
- /*
- * The descriptors have been filled in. Now get ready
- * to transmit.
- */
- _IF_ENQUEUE(&sc->tulip_txq, m);
- m = NULL;
-
- /*
- * Make sure the next descriptor after this packet is owned
- * by us since it may have been set up above if we ran out
- * of room in the ring.
- */
- nextout->d_status = 0;
- TULIP_TXDESC_PRESYNC(sc, nextout, sizeof(u_int32_t));
-
-#if !defined(TULIP_BUS_DMA) || defined(TULIP_BUS_DMA_NOTX)
- /*
- * If we only used the first segment of the last descriptor,
- * make sure the second segment will not be used.
- */
- if (segcnt & 1) {
- eop->d_addr2 = 0;
- eop->d_length2 = 0;
- }
-#endif /* TULIP_BUS_DMA */
-
- /*
- * Mark the last and first segments, indicate we want a transmit
- * complete interrupt, and tell it to transmit!
- */
- eop->d_flag |= TULIP_DFLAG_TxLASTSEG|TULIP_DFLAG_TxWANTINTR;
-
- /*
- * Note that ri->ri_nextout is still the start of the packet
- * and until we set the OWNER bit, we can still back out of
- * everything we have done.
- */
- ri->ri_nextout->d_flag |= TULIP_DFLAG_TxFIRSTSEG;
-#if defined(TULIP_BUS_MAP) && !defined(TULIP_BUS_DMA_NOTX)
- if (eop < ri->ri_nextout) {
- TULIP_TXDESC_PRESYNC(sc, ri->ri_nextout,
- (caddr_t) ri->ri_last - (caddr_t) ri->ri_nextout);
- TULIP_TXDESC_PRESYNC(sc, ri->ri_first,
- (caddr_t) (eop + 1) - (caddr_t) ri->ri_first);
- } else {
- TULIP_TXDESC_PRESYNC(sc, ri->ri_nextout,
- (caddr_t) (eop + 1) - (caddr_t) ri->ri_nextout);
- }
-#endif
- ri->ri_nextout->d_status = TULIP_DSTS_OWNER;
- TULIP_TXDESC_PRESYNC(sc, ri->ri_nextout, sizeof(u_int32_t));
-
- /*
- * This advances the ring for us.
- */
- ri->ri_nextout = nextout;
- ri->ri_free = free;
-
- TULIP_PERFEND(txput);
-
- if (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) {
- TULIP_CSR_WRITE(sc, csr_txpoll, 1);
- sc->tulip_ifp->if_flags |= IFF_OACTIVE;
- sc->tulip_ifp->if_start = tulip_ifstart;
- TULIP_PERFEND(txput);
- return NULL;
- }
-
- /*
- * switch back to the single queueing ifstart.
- */
- sc->tulip_flags &= ~TULIP_WANTTXSTART;
- if (sc->tulip_txtimer == 0)
- sc->tulip_txtimer = TULIP_TXTIMER;
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_txput_finishes[5]++;
-#endif
-
- /*
- * If we want a txstart, there must be not enough space in the
- * transmit ring. So we want to enable transmit done interrupts
- * so we can immediately reclaim some space. When the transmit
- * interrupt is posted, the interrupt handler will call tx_intr
- * to reclaim space and then txstart (since WANTTXSTART is set).
- * txstart will move the packet into the transmit ring and clear
- * WANTTXSTART thereby causing TXINTR to be cleared.
- */
- finish:
-#if defined(TULIP_DEBUG)
- sc->tulip_dbg.dbg_txput_finishes[6]++;
-#endif
- if (sc->tulip_flags & (TULIP_WANTTXSTART|TULIP_DOINGSETUP)) {
- sc->tulip_ifp->if_flags |= IFF_OACTIVE;
- sc->tulip_ifp->if_start = tulip_ifstart;
- if ((sc->tulip_intrmask & TULIP_STS_TXINTR) == 0) {
- sc->tulip_intrmask |= TULIP_STS_TXINTR;
- TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
- }
- } else if ((sc->tulip_flags & TULIP_PROMISC) == 0) {
- if (sc->tulip_intrmask & TULIP_STS_TXINTR) {
- sc->tulip_intrmask &= ~TULIP_STS_TXINTR;
- TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
- }
- }
- TULIP_CSR_WRITE(sc, csr_txpoll, 1);
- TULIP_PERFEND(txput);
- return m;
-}
-
-static void
-tulip_txput_setup(
- tulip_softc_t * const sc)
-{
- tulip_ringinfo_t * const ri = &sc->tulip_txinfo;
- tulip_desc_t *nextout;
-
- /*
- * We will transmit, at most, one setup packet per call to ifstart.
- */
-
-#if defined(TULIP_DEBUG)
- if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) {
- if_printf(sc->tulip_ifp, "txput_setup: tx not running\n");
- sc->tulip_flags |= TULIP_WANTTXSTART;
- sc->tulip_ifp->if_start = tulip_ifstart;
- return;
- }
-#endif
- /*
- * Try to reclaim some free descriptors..
- */
- if (ri->ri_free < 2)
- tulip_tx_intr(sc);
- if ((sc->tulip_flags & TULIP_DOINGSETUP) || ri->ri_free == 1) {
- sc->tulip_flags |= TULIP_WANTTXSTART;
- sc->tulip_ifp->if_start = tulip_ifstart;
- return;
- }
- bcopy(sc->tulip_setupdata, sc->tulip_setupbuf,
- sizeof(sc->tulip_setupbuf));
- /*
- * Clear WANTSETUP and set DOINGSETUP. Set know that WANTSETUP is
- * set and DOINGSETUP is clear doing an XOR of the two will DTRT.
- */
- sc->tulip_flags ^= TULIP_WANTSETUP|TULIP_DOINGSETUP;
- ri->ri_free--;
- nextout = ri->ri_nextout;
- nextout->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
- nextout->d_flag |= TULIP_DFLAG_TxFIRSTSEG|TULIP_DFLAG_TxLASTSEG
- |TULIP_DFLAG_TxSETUPPKT|TULIP_DFLAG_TxWANTINTR;
- if (sc->tulip_flags & TULIP_WANTHASHPERFECT)
- nextout->d_flag |= TULIP_DFLAG_TxHASHFILT;
- else if (sc->tulip_flags & TULIP_WANTHASHONLY)
- nextout->d_flag |= TULIP_DFLAG_TxHASHFILT|TULIP_DFLAG_TxINVRSFILT;
-
- nextout->d_length2 = 0;
- nextout->d_addr2 = 0;
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX)
- nextout->d_length1 = sc->tulip_setupmap->dm_segs[0].ds_len;
- nextout->d_addr1 = sc->tulip_setupmap->dm_segs[0].ds_addr;
- if (sc->tulip_setupmap->dm_nsegs == 2) {
- nextout->d_length2 = sc->tulip_setupmap->dm_segs[1].ds_len;
- nextout->d_addr2 = sc->tulip_setupmap->dm_segs[1].ds_addr;
- }
- TULIP_TXMAP_PRESYNC(sc, sc->tulip_setupmap);
- TULIP_TXDESC_PRESYNC(sc, nextout, sizeof(*nextout));
-#else
- nextout->d_length1 = sizeof(sc->tulip_setupbuf);
- nextout->d_addr1 = TULIP_KVATOPHYS(sc, sc->tulip_setupbuf);
-#endif
-
- /*
- * Advance the ring for the next transmit packet.
- */
- if (++ri->ri_nextout == ri->ri_last)
- ri->ri_nextout = ri->ri_first;
-
- /*
- * Make sure the next descriptor is owned by us since it
- * may have been set up above if we ran out of room in the
- * ring.
- */
- ri->ri_nextout->d_status = 0;
- TULIP_TXDESC_PRESYNC(sc, ri->ri_nextout, sizeof(u_int32_t));
- nextout->d_status = TULIP_DSTS_OWNER;
- /*
- * Flush the ownwership of the current descriptor
- */
- TULIP_TXDESC_PRESYNC(sc, nextout, sizeof(u_int32_t));
- TULIP_CSR_WRITE(sc, csr_txpoll, 1);
- if ((sc->tulip_intrmask & TULIP_STS_TXINTR) == 0) {
- sc->tulip_intrmask |= TULIP_STS_TXINTR;
- TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask);
- }
-}
-
-
-/*
- * This routine is entered at splnet() (splsoftnet() on NetBSD)
- * and thereby imposes no problems when TULIP_USE_SOFTINTR is
- * defined or not.
- */
-static int
-tulip_ifioctl(
- struct ifnet * ifp,
- u_long cmd,
- caddr_t data)
-{
- TULIP_PERFSTART(ifioctl)
- tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *) data;
- int s;
- int error = 0;
-
-#if defined(TULIP_USE_SOFTINTR)
- s = splnet();
-#else
- s = splimp();
-#endif
- switch (cmd) {
- case SIOCSIFFLAGS: {
- tulip_addr_filter(sc); /* reinit multicast filter */
- tulip_init(sc);
- break;
- }
-
- case SIOCSIFMEDIA:
- case SIOCGIFMEDIA: {
- error = ifmedia_ioctl(ifp, ifr, &sc->tulip_ifmedia, cmd);
- break;
- }
-
- case SIOCADDMULTI:
- case SIOCDELMULTI: {
- /*
- * Update multicast listeners
- */
- tulip_addr_filter(sc); /* reset multicast filtering */
- tulip_init(sc);
- error = 0;
- break;
- }
-
- case SIOCSIFMTU:
- /*
- * Set the interface MTU.
- */
- if (ifr->ifr_mtu > ETHERMTU
-#ifdef BIG_PACKET
- && sc->tulip_chipid != TULIP_21140
- && sc->tulip_chipid != TULIP_21140A
- && sc->tulip_chipid != TULIP_21041
-#endif
- ) {
- error = EINVAL;
- break;
- }
- ifp->if_mtu = ifr->ifr_mtu;
-#ifdef BIG_PACKET
- tulip_reset(sc);
- tulip_init(sc);
-#endif
- break;
-
-#ifdef SIOCGADDRROM
- case SIOCGADDRROM: {
- error = copyout(sc->tulip_rombuf, ifr->ifr_data, sizeof(sc->tulip_rombuf));
- break;
- }
-#endif
-#ifdef SIOCGCHIPID
- case SIOCGCHIPID: {
- ifr->ifr_metric = (int) sc->tulip_chipid;
- break;
- }
-#endif
- default: {
- error = ether_ioctl(ifp, cmd, data);
- break;
- }
- }
-
- splx(s);
- TULIP_PERFEND(ifioctl);
- return error;
-}
-
-/*
- * These routines gets called at device spl (from ether_output). This might
- * pose a problem for TULIP_USE_SOFTINTR if ether_output is called at
- * device spl from another driver.
- */
-
-static void
-tulip_ifstart(
- struct ifnet * const ifp)
-{
- TULIP_PERFSTART(ifstart)
- tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc;
-
- if (sc->tulip_ifp->if_flags & IFF_RUNNING) {
-
- if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP)
- tulip_txput_setup(sc);
-
- while (!IFQ_DRV_IS_EMPTY(&sc->tulip_ifp->if_snd)) {
- struct mbuf *m;
- IFQ_DRV_DEQUEUE(&sc->tulip_ifp->if_snd, m);
- if(m == NULL)
- break;
- if ((m = tulip_txput(sc, m)) != NULL) {
- IFQ_DRV_PREPEND(&sc->tulip_ifp->if_snd, m);
- break;
- }
- }
- }
-
- TULIP_PERFEND(ifstart);
-}
-
-/*
- * Even though this routine runs at device spl, it does not break
- * our use of splnet (splsoftnet under NetBSD) for the majority
- * of this driver (if TULIP_USE_SOFTINTR defined) since
- * if_watcbog is called from if_watchdog which is called from
- * splsoftclock which is below spl[soft]net.
- */
-static void
-tulip_ifwatchdog(
- struct ifnet *ifp)
-{
- TULIP_PERFSTART(ifwatchdog)
- tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc;
-
-#if defined(TULIP_DEBUG)
- u_int32_t rxintrs = sc->tulip_dbg.dbg_rxintrs - sc->tulip_dbg.dbg_last_rxintrs;
- if (rxintrs > sc->tulip_dbg.dbg_high_rxintrs_hz)
- sc->tulip_dbg.dbg_high_rxintrs_hz = rxintrs;
- sc->tulip_dbg.dbg_last_rxintrs = sc->tulip_dbg.dbg_rxintrs;
-#endif /* TULIP_DEBUG */
-
- sc->tulip_ifp->if_timer = 1;
- /*
- * These should be rare so do a bulk test up front so we can just skip
- * them if needed.
- */
- if (sc->tulip_flags & (TULIP_SYSTEMERROR|TULIP_RXBUFSLOW|TULIP_NOMESSAGES)) {
- /*
- * If the number of receive buffer is low, try to refill
- */
- if (sc->tulip_flags & TULIP_RXBUFSLOW)
- tulip_rx_intr(sc);
-
- if (sc->tulip_flags & TULIP_SYSTEMERROR) {
- if_printf(sc->tulip_ifp, "%d system errors: last was %s\n",
- sc->tulip_system_errors,
- tulip_system_errors[sc->tulip_last_system_error]);
- }
- if (sc->tulip_statusbits) {
- tulip_print_abnormal_interrupt(sc, sc->tulip_statusbits);
- sc->tulip_statusbits = 0;
- }
-
- sc->tulip_flags &= ~(TULIP_NOMESSAGES|TULIP_SYSTEMERROR);
- }
-
- if (sc->tulip_txtimer)
- tulip_tx_intr(sc);
- if (sc->tulip_txtimer && --sc->tulip_txtimer == 0) {
- if_printf(sc->tulip_ifp, "transmission timeout\n");
- if (TULIP_DO_AUTOSENSE(sc)) {
- sc->tulip_media = TULIP_MEDIA_UNKNOWN;
- sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
- sc->tulip_flags &= ~(TULIP_WANTRXACT|TULIP_LINKUP);
- }
- tulip_reset(sc);
- tulip_init(sc);
- }
-
- TULIP_PERFEND(ifwatchdog);
- TULIP_PERFMERGE(sc, perf_intr_cycles);
- TULIP_PERFMERGE(sc, perf_ifstart_cycles);
- TULIP_PERFMERGE(sc, perf_ifioctl_cycles);
- TULIP_PERFMERGE(sc, perf_ifwatchdog_cycles);
- TULIP_PERFMERGE(sc, perf_timeout_cycles);
- TULIP_PERFMERGE(sc, perf_ifstart_one_cycles);
- TULIP_PERFMERGE(sc, perf_txput_cycles);
- TULIP_PERFMERGE(sc, perf_txintr_cycles);
- TULIP_PERFMERGE(sc, perf_rxintr_cycles);
- TULIP_PERFMERGE(sc, perf_rxget_cycles);
- TULIP_PERFMERGE(sc, perf_intr);
- TULIP_PERFMERGE(sc, perf_ifstart);
- TULIP_PERFMERGE(sc, perf_ifioctl);
- TULIP_PERFMERGE(sc, perf_ifwatchdog);
- TULIP_PERFMERGE(sc, perf_timeout);
- TULIP_PERFMERGE(sc, perf_ifstart_one);
- TULIP_PERFMERGE(sc, perf_txput);
- TULIP_PERFMERGE(sc, perf_txintr);
- TULIP_PERFMERGE(sc, perf_rxintr);
- TULIP_PERFMERGE(sc, perf_rxget);
-}
-
-/*
- * All printf's are real as of now!
- */
-#ifdef printf
-#undef printf
-#endif
-
-static void
-tulip_attach(
- tulip_softc_t * const sc)
-{
- struct ifnet *ifp;
-
- ifp = sc->tulip_ifp = if_alloc(IFT_ETHER);
-
- /* XXX: driver name/unit should be set some other way */
- if_initname(ifp, "de", sc->tulip_unit);
- ifp->if_softc = sc;
- ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST|IFF_NEEDSGIANT;
- ifp->if_ioctl = tulip_ifioctl;
- ifp->if_start = tulip_ifstart;
- ifp->if_watchdog = tulip_ifwatchdog;
- ifp->if_timer = 1;
- ifp->if_init = tulip_ifinit;
-
- if_printf(ifp, "%s%s pass %d.%d%s\n",
- sc->tulip_boardid,
- tulip_chipdescs[sc->tulip_chipid],
- (sc->tulip_revinfo & 0xF0) >> 4,
- sc->tulip_revinfo & 0x0F,
- (sc->tulip_features & (TULIP_HAVE_ISVSROM|TULIP_HAVE_OKSROM))
- == TULIP_HAVE_ISVSROM ? " (invalid EESPROM checksum)" : "");
-#ifndef __FreeBSD__
- if_printf(ifp, "address %6D\n", sc->tulip_enaddr, ":");
-#endif
-
-#if defined(__alpha__)
- /*
- * In case the SRM console told us about a bogus media,
- * we need to check to be safe.
- */
- if (sc->tulip_mediums[sc->tulip_media] == NULL)
- sc->tulip_media = TULIP_MEDIA_UNKNOWN;
-#endif
-
- (*sc->tulip_boardsw->bd_media_probe)(sc);
- ifmedia_init(&sc->tulip_ifmedia, 0,
- tulip_ifmedia_change,
- tulip_ifmedia_status);
- sc->tulip_flags &= ~TULIP_DEVICEPROBE;
- tulip_ifmedia_add(sc);
-
- tulip_reset(sc);
-
- ether_ifattach(sc->tulip_ifp, sc->tulip_enaddr);
- IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
- ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
- IFQ_SET_READY(&ifp->if_snd);
-}
-
-#if defined(TULIP_BUS_DMA)
-#if !defined(TULIP_BUS_DMA_NOTX) || !defined(TULIP_BUS_DMA_NORX)
-static int
-tulip_busdma_allocmem(
- tulip_softc_t * const sc,
- size_t size,
- bus_dmamap_t *map_p,
- tulip_desc_t **desc_p)
-{
- bus_dma_segment_t segs[1];
- int nsegs, error;
- error = bus_dmamem_alloc(sc->tulip_dmatag, size, 1, PAGE_SIZE,
- segs, sizeof(segs)/sizeof(segs[0]),
- &nsegs, BUS_DMA_NOWAIT);
- if (error == 0) {
- void *desc;
- error = bus_dmamem_map(sc->tulip_dmatag, segs, nsegs, size,
- (void *) &desc, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
- if (error == 0) {
- bus_dmamap_t map;
- error = bus_dmamap_create(sc->tulip_dmatag, size, 1, size, 0,
- BUS_DMA_NOWAIT, &map);
- if (error == 0) {
- error = bus_dmamap_load(sc->tulip_dmatag, map, desc,
- size, NULL, BUS_DMA_NOWAIT);
- if (error)
- bus_dmamap_destroy(sc->tulip_dmatag, map);
- else
- *map_p = map;
- }
- if (error)
- bus_dmamem_unmap(sc->tulip_dmatag, desc, size);
- }
- if (error)
- bus_dmamem_free(sc->tulip_dmatag, segs, nsegs);
- else
- *desc_p = desc;
- }
- return error;
-}
-#endif
-
-static int
-tulip_busdma_init(
- tulip_softc_t * const sc)
-{
- int error = 0;
-
-#if !defined(TULIP_BUS_DMA_NOTX)
- /*
- * Allocate dmamap for setup descriptor
- */
- error = bus_dmamap_create(sc->tulip_dmatag, sizeof(sc->tulip_setupbuf), 2,
- sizeof(sc->tulip_setupbuf), 0, BUS_DMA_NOWAIT,
- &sc->tulip_setupmap);
- if (error == 0) {
- error = bus_dmamap_load(sc->tulip_dmatag, sc->tulip_setupmap,
- sc->tulip_setupbuf, sizeof(sc->tulip_setupbuf),
- NULL, BUS_DMA_NOWAIT);
- if (error)
- bus_dmamap_destroy(sc->tulip_dmatag, sc->tulip_setupmap);
- }
- /*
- * Allocate space and dmamap for transmit ring
- */
- if (error == 0) {
- error = tulip_busdma_allocmem(sc, sizeof(tulip_desc_t) * TULIP_TXDESCS,
- &sc->tulip_txdescmap,
- &sc->tulip_txdescs);
- }
-
- /*
- * Allocate dmamaps for each transmit descriptors
- */
- if (error == 0) {
- while (error == 0 && sc->tulip_txmaps_free < TULIP_TXDESCS) {
- bus_dmamap_t map;
- if ((error = TULIP_TXMAP_CREATE(sc, &map)) == 0)
- sc->tulip_txmaps[sc->tulip_txmaps_free++] = map;
- }
- if (error) {
- while (sc->tulip_txmaps_free > 0)
- bus_dmamap_destroy(sc->tulip_dmatag,
- sc->tulip_txmaps[--sc->tulip_txmaps_free]);
- }
- }
-#else
- if (error == 0) {
- sc->tulip_txdescs = (tulip_desc_t *) malloc(TULIP_TXDESCS * sizeof(tulip_desc_t), M_DEVBUF, M_NOWAIT);
- if (sc->tulip_txdescs == NULL)
- error = ENOMEM;
- }
-#endif
-#if !defined(TULIP_BUS_DMA_NORX)
- /*
- * Allocate space and dmamap for receive ring
- */
- if (error == 0) {
- error = tulip_busdma_allocmem(sc, sizeof(tulip_desc_t) * TULIP_RXDESCS,
- &sc->tulip_rxdescmap,
- &sc->tulip_rxdescs);
- }
-
- /*
- * Allocate dmamaps for each receive descriptors
- */
- if (error == 0) {
- while (error == 0 && sc->tulip_rxmaps_free < TULIP_RXDESCS) {
- bus_dmamap_t map;
- if ((error = TULIP_RXMAP_CREATE(sc, &map)) == 0)
- sc->tulip_rxmaps[sc->tulip_rxmaps_free++] = map;
- }
- if (error) {
- while (sc->tulip_rxmaps_free > 0)
- bus_dmamap_destroy(sc->tulip_dmatag,
- sc->tulip_rxmaps[--sc->tulip_rxmaps_free]);
- }
- }
-#else
- if (error == 0) {
- sc->tulip_rxdescs = (tulip_desc_t *) malloc(TULIP_RXDESCS * sizeof(tulip_desc_t), M_DEVBUF, M_NOWAIT);
- if (sc->tulip_rxdescs == NULL)
- error = ENOMEM;
- }
-#endif
- return error;
-}
-#endif /* TULIP_BUS_DMA */
-
-static void
-tulip_initcsrs(
- tulip_softc_t * const sc,
- tulip_csrptr_t csr_base,
- size_t csr_size)
-{
- sc->tulip_csrs.csr_busmode = csr_base + 0 * csr_size;
- sc->tulip_csrs.csr_txpoll = csr_base + 1 * csr_size;
- sc->tulip_csrs.csr_rxpoll = csr_base + 2 * csr_size;
- sc->tulip_csrs.csr_rxlist = csr_base + 3 * csr_size;
- sc->tulip_csrs.csr_txlist = csr_base + 4 * csr_size;
- sc->tulip_csrs.csr_status = csr_base + 5 * csr_size;
- sc->tulip_csrs.csr_command = csr_base + 6 * csr_size;
- sc->tulip_csrs.csr_intr = csr_base + 7 * csr_size;
- sc->tulip_csrs.csr_missed_frames = csr_base + 8 * csr_size;
- sc->tulip_csrs.csr_9 = csr_base + 9 * csr_size;
- sc->tulip_csrs.csr_10 = csr_base + 10 * csr_size;
- sc->tulip_csrs.csr_11 = csr_base + 11 * csr_size;
- sc->tulip_csrs.csr_12 = csr_base + 12 * csr_size;
- sc->tulip_csrs.csr_13 = csr_base + 13 * csr_size;
- sc->tulip_csrs.csr_14 = csr_base + 14 * csr_size;
- sc->tulip_csrs.csr_15 = csr_base + 15 * csr_size;
-}
-
-static void
-tulip_initring(
- tulip_softc_t * const sc,
- tulip_ringinfo_t * const ri,
- tulip_desc_t *descs,
- int ndescs)
-{
- ri->ri_max = ndescs;
- ri->ri_first = descs;
- ri->ri_last = ri->ri_first + ri->ri_max;
- bzero((caddr_t) ri->ri_first, sizeof(ri->ri_first[0]) * ri->ri_max);
- ri->ri_last[-1].d_flag = TULIP_DFLAG_ENDRING;
-}
-
-/*
- * This is the PCI configuration support.
- */
-
-#define PCI_CBIO 0x10 /* Configuration Base IO Address */
-#define PCI_CBMA 0x14 /* Configuration Base Memory Address */
-#define PCI_CFDA 0x40 /* Configuration Driver Area */
-
-static int
-tulip_pci_probe(device_t dev)
-{
- const char *name = NULL;
-
- if (pci_get_vendor(dev) != DEC_VENDORID)
- return ENXIO;
-
- /*
- * Some LanMedia WAN cards use the Tulip chip, but they have
- * their own driver, and we should not recognize them
- */
- if (pci_get_subvendor(dev) == 0x1376)
- return ENXIO;
-
- switch (pci_get_device(dev)) {
- case CHIPID_21040:
- name = "Digital 21040 Ethernet";
- break;
- case CHIPID_21041:
- name = "Digital 21041 Ethernet";
- break;
- case CHIPID_21140:
- if (pci_get_revid(dev) >= 0x20)
- name = "Digital 21140A Fast Ethernet";
- else
- name = "Digital 21140 Fast Ethernet";
- break;
- case CHIPID_21142:
- if (pci_get_revid(dev) >= 0x20)
- name = "Digital 21143 Fast Ethernet";
- else
- name = "Digital 21142 Fast Ethernet";
- break;
- }
- if (name) {
- device_set_desc(dev, name);
- return BUS_PROBE_LOW_PRIORITY;
- }
- return ENXIO;
-}
-
-static int
-tulip_shutdown(device_t dev)
-{
- tulip_softc_t * const sc = device_get_softc(dev);
- TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET);
- DELAY(10); /* Wait 10 microseconds (actually 50 PCI cycles but at
- 33MHz that comes to two microseconds but wait a
- bit longer anyways) */
- return 0;
-}
-
-static int
-tulip_pci_attach(device_t dev)
-{
- tulip_softc_t *sc;
-#if defined(__alpha__)
- tulip_media_t media = TULIP_MEDIA_UNKNOWN;
-#endif
- int retval, idx;
- u_int32_t revinfo, cfdainfo, cfcsinfo;
- unsigned csroffset = TULIP_PCI_CSROFFSET;
- unsigned csrsize = TULIP_PCI_CSRSIZE;
- tulip_csrptr_t csr_base;
- tulip_chipid_t chipid = TULIP_CHIPID_UNKNOWN;
- struct resource *res;
- int rid, unit;
-
- unit = device_get_unit(dev);
-
- if (unit >= TULIP_MAX_DEVICES) {
- device_printf(dev, "not configured; limit of %d reached or exceeded\n",
- TULIP_MAX_DEVICES);
- return ENXIO;
- }
-
- revinfo = pci_get_revid(dev);
- cfdainfo = pci_read_config(dev, PCI_CFDA, 4);
- cfcsinfo = pci_read_config(dev, PCIR_COMMAND, 4);
-
- /* turn busmaster on in case BIOS doesn't set it */
- if(!(cfcsinfo & PCIM_CMD_BUSMASTEREN)) {
- cfcsinfo |= PCIM_CMD_BUSMASTEREN;
- pci_write_config(dev, PCIR_COMMAND, cfcsinfo, 4);
- }
-
- if (pci_get_vendor(dev) == DEC_VENDORID) {
- if (pci_get_device(dev) == CHIPID_21040)
- chipid = TULIP_21040;
- else if (pci_get_device(dev) == CHIPID_21041)
- chipid = TULIP_21041;
- else if (pci_get_device(dev) == CHIPID_21140)
- chipid = (revinfo >= 0x20) ? TULIP_21140A : TULIP_21140;
- else if (pci_get_device(dev) == CHIPID_21142)
- chipid = (revinfo >= 0x20) ? TULIP_21143 : TULIP_21142;
- }
- if (chipid == TULIP_CHIPID_UNKNOWN)
- return ENXIO;
-
- if (chipid == TULIP_21040 && revinfo < 0x20) {
- device_printf(dev,
- "not configured; 21040 pass 2.0 required (%d.%d found)\n",
- revinfo >> 4, revinfo & 0x0f);
- return ENXIO;
- } else if (chipid == TULIP_21140 && revinfo < 0x11) {
- device_printf(dev,
- "not configured; 21140 pass 1.1 required (%d.%d found)\n",
- revinfo >> 4, revinfo & 0x0f);
- return ENXIO;
- }
-
- sc = device_get_softc(dev);
- sc->tulip_pci_busno = pci_get_bus(dev);
- sc->tulip_pci_devno = pci_get_slot(dev);
- sc->tulip_chipid = chipid;
- sc->tulip_flags |= TULIP_DEVICEPROBE;
- if (chipid == TULIP_21140 || chipid == TULIP_21140A)
- sc->tulip_features |= TULIP_HAVE_GPR|TULIP_HAVE_STOREFWD;
- if (chipid == TULIP_21140A && revinfo <= 0x22)
- sc->tulip_features |= TULIP_HAVE_RXBADOVRFLW;
- if (chipid == TULIP_21140)
- sc->tulip_features |= TULIP_HAVE_BROKEN_HASH;
- if (chipid != TULIP_21040 && chipid != TULIP_21140)
- sc->tulip_features |= TULIP_HAVE_POWERMGMT;
- if (chipid == TULIP_21041 || chipid == TULIP_21142 || chipid == TULIP_21143) {
- sc->tulip_features |= TULIP_HAVE_DUALSENSE;
- if (chipid != TULIP_21041 || revinfo >= 0x20)
- sc->tulip_features |= TULIP_HAVE_SIANWAY;
- if (chipid != TULIP_21041)
- sc->tulip_features |= TULIP_HAVE_SIAGP|TULIP_HAVE_RXBADOVRFLW|TULIP_HAVE_STOREFWD;
- if (chipid != TULIP_21041 && revinfo >= 0x20)
- sc->tulip_features |= TULIP_HAVE_SIA100;
- }
-
- if (sc->tulip_features & TULIP_HAVE_POWERMGMT
- && (cfdainfo & (TULIP_CFDA_SLEEP|TULIP_CFDA_SNOOZE))) {
- cfdainfo &= ~(TULIP_CFDA_SLEEP|TULIP_CFDA_SNOOZE);
- pci_write_config(dev, PCI_CFDA, cfdainfo, 4);
- DELAY(11*1000);
- }
-#if defined(__alpha__)
- /*
- * The Alpha SRM console encodes a console set media in the driver
- * part of the CFDA register. Note that the Multia presents a
- * problem in that its BNC mode is really EXTSIA. So in that case
- * force a probe.
- */
- switch ((cfdainfo >> 8) & 0xff) {
- case 1: media = chipid > TULIP_21040 ? TULIP_MEDIA_AUI : TULIP_MEDIA_AUIBNC; break;
- case 2: media = chipid > TULIP_21040 ? TULIP_MEDIA_BNC : TULIP_MEDIA_UNKNOWN; break;
- case 3: media = TULIP_MEDIA_10BASET; break;
- case 4: media = TULIP_MEDIA_10BASET_FD; break;
- case 5: media = TULIP_MEDIA_100BASETX; break;
- case 6: media = TULIP_MEDIA_100BASETX_FD; break;
- default: media = TULIP_MEDIA_UNKNOWN; break;
- }
-#endif
-
- sc->tulip_unit = unit;
- sc->tulip_revinfo = revinfo;
-#if defined(TULIP_IOMAPPED)
- rid = PCI_CBIO;
- res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
-#else
- rid = PCI_CBMA;
- res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
-#endif
- if (!res)
- return ENXIO;
- sc->tulip_csrs_bst = rman_get_bustag(res);
- sc->tulip_csrs_bsh = rman_get_bushandle(res);
- csr_base = 0;
-
- tulips[unit] = sc;
-
- tulip_initcsrs(sc, csr_base + csroffset, csrsize);
-
-#if defined(TULIP_BUS_DMA)
- if ((retval = tulip_busdma_init(sc)) != 0) {
- printf("error initing bus_dma: %d\n", retval);
- return ENXIO;
- }
-#else
- sc->tulip_rxdescs = (tulip_desc_t *) malloc(sizeof(tulip_desc_t) * TULIP_RXDESCS, M_DEVBUF, M_NOWAIT);
- sc->tulip_txdescs = (tulip_desc_t *) malloc(sizeof(tulip_desc_t) * TULIP_TXDESCS, M_DEVBUF, M_NOWAIT);
- if (sc->tulip_rxdescs == NULL || sc->tulip_txdescs == NULL) {
- device_printf(dev, "malloc failed\n");
- if (sc->tulip_rxdescs)
- free((caddr_t) sc->tulip_rxdescs, M_DEVBUF);
- if (sc->tulip_txdescs)
- free((caddr_t) sc->tulip_txdescs, M_DEVBUF);
- return ENXIO;
- }
-#endif
-
- tulip_initring(sc, &sc->tulip_rxinfo, sc->tulip_rxdescs, TULIP_RXDESCS);
- tulip_initring(sc, &sc->tulip_txinfo, sc->tulip_txdescs, TULIP_TXDESCS);
-
- /*
- * Make sure there won't be any interrupts or such...
- */
- TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET);
- DELAY(100); /* Wait 10 microseconds (actually 50 PCI cycles but at
- 33MHz that comes to two microseconds but wait a
- bit longer anyways) */
-
- if ((retval = tulip_read_macaddr(sc)) < 0) {
- device_printf(dev, "can't read ENET ROM (why=%d) (", retval);
- for (idx = 0; idx < 32; idx++)
- printf("%02x", sc->tulip_rombuf[idx]);
- printf("\n");
- device_printf(dev, "%s%s pass %d.%d\n",
- sc->tulip_boardid, tulip_chipdescs[sc->tulip_chipid],
- (sc->tulip_revinfo & 0xF0) >> 4, sc->tulip_revinfo & 0x0F);
- device_printf(dev, "address unknown\n");
- } else {
- int s;
- void (*intr_rtn)(void *) = tulip_intr_normal;
-
- if (sc->tulip_features & TULIP_HAVE_SHAREDINTR)
- intr_rtn = tulip_intr_shared;
-
- if ((sc->tulip_features & TULIP_HAVE_SLAVEDINTR) == 0) {
- void *ih;
-
- rid = 0;
- res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
- RF_SHAREABLE | RF_ACTIVE);
- if (res == 0 || bus_setup_intr(dev, res, INTR_TYPE_NET,
- intr_rtn, sc, &ih)) {
- device_printf(dev, "couldn't map interrupt\n");
- free((caddr_t) sc->tulip_rxdescs, M_DEVBUF);
- free((caddr_t) sc->tulip_txdescs, M_DEVBUF);
- return ENXIO;
- }
- }
-#if defined(TULIP_USE_SOFTINTR)
- if (sc->tulip_unit > tulip_softintr_max_unit)
- tulip_softintr_max_unit = sc->tulip_unit;
-#endif
-
- s = splimp();
-#if defined(__alpha__)
- sc->tulip_media = media;
-#endif
- tulip_attach(sc);
-#if defined(__alpha__)
- if (sc->tulip_media != TULIP_MEDIA_UNKNOWN)
- tulip_linkup(sc, media);
-#endif
- splx(s);
- }
- return 0;
-}
-
-static device_method_t tulip_pci_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, tulip_pci_probe),
- DEVMETHOD(device_attach, tulip_pci_attach),
- DEVMETHOD(device_shutdown, tulip_shutdown),
- { 0, 0 }
-};
-static driver_t tulip_pci_driver = {
- "de",
- tulip_pci_methods,
- sizeof(tulip_softc_t),
-};
-static devclass_t tulip_devclass;
-DRIVER_MODULE(de, pci, tulip_pci_driver, tulip_devclass, 0, 0);
diff --git a/sys/dev/de/if_devar.h b/sys/dev/de/if_devar.h
deleted file mode 100644
index 54ed8d6..0000000
--- a/sys/dev/de/if_devar.h
+++ /dev/null
@@ -1,1009 +0,0 @@
-/* $NetBSD: if_devar.h,v 1.32 1999/04/01 14:55:25 tsubai Exp $ */
-
-/* $FreeBSD$ */
-
-/*-
- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- *
- * Id: if_devar.h,v 1.28 1997/07/03 16:55:07 thomas Exp
- */
-
-#ifndef _DEVAR_H
-#define _DEVAR_H
-
-typedef bus_addr_t tulip_csrptr_t;
-
-#define TULIP_PCI_CSRSIZE 8
-#define TULIP_PCI_CSROFFSET 0
-
-#define TULIP_CSR_READ(sc, csr) \
- bus_space_read_4((sc)->tulip_csrs_bst, \
- (sc)->tulip_csrs_bsh, \
- (sc)->tulip_csrs.csr)
-#define TULIP_CSR_WRITE(sc, csr, val) \
- bus_space_write_4((sc)->tulip_csrs_bst, \
- (sc)->tulip_csrs_bsh, \
- (sc)->tulip_csrs.csr, val)
-
-#define TULIP_CSR_READBYTE(sc, csr) \
- bus_space_read_1((sc)->tulip_csrs_bst, \
- (sc)->tulip_csrs_bsh, \
- (sc)->tulip_csrs.csr)
-#define TULIP_CSR_WRITEBYTE(sc, csr, val) \
- bus_space_write_1((sc)->tulip_csrs_bst, \
- (sc)->tulip_csrs_bsh, \
- (sc)->tulip_csrs.csr, val)
-
-/*
- * This structure contains "pointers" for the registers on
- * the various 21x4x chips. CSR0 through CSR8 are common
- * to all chips. After that, it gets messy...
- */
-typedef struct {
- tulip_csrptr_t csr_busmode; /* CSR0 */
- tulip_csrptr_t csr_txpoll; /* CSR1 */
- tulip_csrptr_t csr_rxpoll; /* CSR2 */
- tulip_csrptr_t csr_rxlist; /* CSR3 */
- tulip_csrptr_t csr_txlist; /* CSR4 */
- tulip_csrptr_t csr_status; /* CSR5 */
- tulip_csrptr_t csr_command; /* CSR6 */
- tulip_csrptr_t csr_intr; /* CSR7 */
- tulip_csrptr_t csr_missed_frames; /* CSR8 */
- tulip_csrptr_t csr_9; /* CSR9 */
- tulip_csrptr_t csr_10; /* CSR10 */
- tulip_csrptr_t csr_11; /* CSR11 */
- tulip_csrptr_t csr_12; /* CSR12 */
- tulip_csrptr_t csr_13; /* CSR13 */
- tulip_csrptr_t csr_14; /* CSR14 */
- tulip_csrptr_t csr_15; /* CSR15 */
-} tulip_regfile_t;
-
-#define csr_enetrom csr_9 /* 21040 */
-#define csr_reserved csr_10 /* 21040 */
-#define csr_full_duplex csr_11 /* 21040 */
-#define csr_bootrom csr_10 /* 21041/21140A/?? */
-#define csr_gp csr_12 /* 21140* */
-#define csr_watchdog csr_15 /* 21140* */
-#define csr_gp_timer csr_11 /* 21041/21140* */
-#define csr_srom_mii csr_9 /* 21041/21140* */
-#define csr_sia_status csr_12 /* 2104x */
-#define csr_sia_connectivity csr_13 /* 2104x */
-#define csr_sia_tx_rx csr_14 /* 2104x */
-#define csr_sia_general csr_15 /* 2104x */
-
-/*
- * While 21x4x allows chaining of its descriptors, this driver
- * doesn't take advantage of it. We keep the descriptors in a
- * traditional FIFO ring.
- */
-typedef struct {
- tulip_desc_t *ri_first; /* first entry in ring */
- tulip_desc_t *ri_last; /* one after last entry */
- tulip_desc_t *ri_nextin; /* next to processed by host */
- tulip_desc_t *ri_nextout; /* next to processed by adapter */
- int ri_max;
- int ri_free;
-} tulip_ringinfo_t;
-
-/*
- * The 21040 has a stupid restriction in that the receive
- * buffers must be longword aligned. But since Ethernet
- * headers are not a multiple of longwords in size this forces
- * the data to non-longword aligned. Since IP requires the
- * data to be longword aligned, we need to copy it after it has
- * been DMA'ed in our memory.
- *
- * Since we have to copy it anyways, we might as well as allocate
- * dedicated receive space for the input. This allows to use a
- * small receive buffer size and more ring entries to be able to
- * better keep with a flood of tiny Ethernet packets.
- *
- * The receive space MUST ALWAYS be a multiple of the page size.
- * And the number of receive descriptors multiplied by the size
- * of the receive buffers must equal the recevive space. This
- * is so that we can manipulate the page tables so that even if a
- * packet wraps around the end of the receive space, we can
- * treat it as virtually contiguous.
- *
- * The above used to be true (the stupid restriction is still true)
- * but we gone to directly DMA'ing into MBUFs (unless it's on an
- * architecture which can't handle unaligned accesses) because with
- * 100Mb/s cards the copying is just too much of a hit.
- */
-#if !defined(__i386__)
-#define TULIP_COPY_RXDATA 1
-#endif
-
-#define TULIP_DATA_PER_DESC 2032
-#define TULIP_TXTIMER 4
-#define TULIP_RXDESCS 48
-#define TULIP_TXDESCS 128
-#define TULIP_RXQ_TARGET 32
-#if TULIP_RXQ_TARGET >= TULIP_RXDESCS
-#error TULIP_RXQ_TARGET must be less than TULIP_RXDESCS
-#endif
-#define TULIP_RX_BUFLEN ((MCLBYTES < 2048 ? MCLBYTES : 2048) - 16)
-
-/*
- * Forward reference to make C happy.
- */
-typedef struct tulip_softc tulip_softc_t;
-
-/*
- * Enumeration of the various controllers supported.
- */
-typedef enum {
- TULIP_21040,
- TULIP_21041,
- TULIP_21140,
- TULIP_21140A,
- TULIP_21142,
- TULIP_21143,
- TULIP_CHIPID_UNKNOWN
-} tulip_chipid_t;
-
-/*
- * Various physical media types supported.
- * BNCAUI is BNC or AUI since on the 21040 you can't really tell
- * which is in use.
- */
-typedef enum {
- TULIP_MEDIA_UNKNOWN,
- TULIP_MEDIA_10BASET,
- TULIP_MEDIA_10BASET_FD,
- TULIP_MEDIA_BNC,
- TULIP_MEDIA_AUI,
- TULIP_MEDIA_EXTSIA,
- TULIP_MEDIA_AUIBNC,
- TULIP_MEDIA_100BASETX,
- TULIP_MEDIA_100BASETX_FD,
- TULIP_MEDIA_100BASET4,
- TULIP_MEDIA_100BASEFX,
- TULIP_MEDIA_100BASEFX_FD,
- TULIP_MEDIA_MAX
-} tulip_media_t;
-
-#define TULIP_BIT(b) (1L << ((int)(b)))
-#define TULIP_FDBIT(m) (1L << ((int)TULIP_MEDIA_ ## m ## _FD))
-#define TULIP_MBIT(m) (1L << ((int)TULIP_MEDIA_ ## m ))
-#define TULIP_IS_MEDIA_FD(m) (TULIP_BIT(m) & \
- (TULIP_FDBIT(10BASET) | \
- TULIP_FDBIT(100BASETX) | \
- TULIP_FDBIT(100BASEFX)))
-#define TULIP_CAN_MEDIA_FD(m) (TULIP_BIT(m) & \
- (TULIP_MBIT(10BASET) | \
- TULIP_MBIT(100BASETX) | \
- TULIP_MBIT(100BASEFX)))
-#define TULIP_FD_MEDIA_OF(m) ((tulip_media_t)((m) + 1))
-#define TULIP_HD_MEDIA_OF(m) ((tulip_media_t)((m) - 1))
-#define TULIP_IS_MEDIA_100MB(m) ((m) >= TULIP_MEDIA_100BASETX)
-#define TULIP_IS_MEDIA_TP(m) ((TULIP_BIT(m) & \
- (TULIP_MBIT(BNC) | \
- TULIP_MBIT(AUI) | \
- TULIP_MBIT(AUIBNC) | \
- TULIP_MBIT(EXTSIA))) == 0)
-
-#define TULIP_SROM_ATTR_MII 0x0100
-#define TULIP_SROM_ATTR_NWAY 0x0200
-#define TULIP_SROM_ATTR_AUTOSENSE 0x0400
-#define TULIP_SROM_ATTR_POWERUP 0x0800
-#define TULIP_SROM_ATTR_NOLINKPASS 0x1000
-
-typedef struct {
- enum {
- TULIP_MEDIAINFO_NONE,
- TULIP_MEDIAINFO_SIA,
- TULIP_MEDIAINFO_GPR,
- TULIP_MEDIAINFO_MII,
- TULIP_MEDIAINFO_RESET,
- TULIP_MEDIAINFO_SYM
- } mi_type;
- union {
- struct {
- u_int16_t sia_connectivity;
- u_int16_t sia_tx_rx;
- u_int16_t sia_general;
- u_int32_t sia_gp_control; /* 21142/21143 */
- u_int32_t sia_gp_data; /* 21142/21143 */
- } un_sia;
- struct {
- u_int32_t gpr_cmdmode;
- u_int32_t gpr_gpcontrol; /* 21142/21143 */
- u_int32_t gpr_gpdata;
- u_int8_t gpr_actmask;
- u_int8_t gpr_actdata;
- u_int gpr_default:1;
- } un_gpr;
- struct {
- u_int32_t mii_mediamask;
- u_int16_t mii_capabilities;
- u_int16_t mii_advertisement;
- u_int16_t mii_full_duplex;
- u_int16_t mii_tx_threshold;
- u_int16_t mii_interrupt; /* 21142/21143 */
- u_int8_t mii_phyaddr;
- u_int8_t mii_gpr_length;
- u_int8_t mii_gpr_offset;
- u_int8_t mii_reset_length;
- u_int8_t mii_reset_offset;
- u_int32_t mii_phyid;
- } un_mii;
- } mi_un;
-} tulip_media_info_t;
-
-#define mi_sia_connectivity mi_un.un_sia.sia_connectivity
-#define mi_sia_tx_rx mi_un.un_sia.sia_tx_rx
-#define mi_sia_general mi_un.un_sia.sia_general
-#define mi_sia_gp_control mi_un.un_sia.sia_gp_control
-#define mi_sia_gp_data mi_un.un_sia.sia_gp_data
-
-#define mi_gpcontrol mi_un.un_gpr.gpr_gpcontrol
-#define mi_gpdata mi_un.un_gpr.gpr_gpdata
-#define mi_actmask mi_un.un_gpr.gpr_actmask
-#define mi_actdata mi_un.un_gpr.gpr_actdata
-#define mi_default mi_un.un_gpr.gpr_default
-#define mi_cmdmode mi_un.un_gpr.gpr_cmdmode
-
-#define mi_phyaddr mi_un.un_mii.mii_phyaddr
-#define mi_gpr_length mi_un.un_mii.mii_gpr_length
-#define mi_gpr_offset mi_un.un_mii.mii_gpr_offset
-#define mi_reset_length mi_un.un_mii.mii_reset_length
-#define mi_reset_offset mi_un.un_mii.mii_reset_offset
-#define mi_capabilities mi_un.un_mii.mii_capabilities
-#define mi_advertisement mi_un.un_mii.mii_advertisement
-#define mi_full_duplex mi_un.un_mii.mii_full_duplex
-#define mi_tx_threshold mi_un.un_mii.mii_tx_threshold
-#define mi_mediamask mi_un.un_mii.mii_mediamask
-#define mi_mii_interrupt mi_un.un_mii.mii_interrupt
-#define mi_phyid mi_un.un_mii.mii_phyid
-
-#define TULIP_MEDIAINFO_SIA_INIT(sc, mi, chipid, media) \
-do { \
- (mi)->mi_type = TULIP_MEDIAINFO_SIA; \
- sc->tulip_mediums[TULIP_MEDIA_ ## media] = (mi); \
- (mi)->mi_sia_connectivity = TULIP_ ## chipid ## _SIACONN_ ## media; \
- (mi)->mi_sia_tx_rx = TULIP_ ## chipid ## _SIATXRX_ ## media; \
- (mi)->mi_sia_general = TULIP_ ## chipid ## _SIAGEN_ ## media; \
-} while (0)
-
-#define TULIP_MEDIAINFO_ADD_CAPABILITY(sc, mi, media) \
-do { \
- if ((sc)->tulip_mediums[TULIP_MEDIA_ ## media] == NULL \
- && ((mi)->mi_capabilities & PHYSTS_ ## media)) { \
- (sc)->tulip_mediums[TULIP_MEDIA_ ## media] = (mi); \
- (mi)->mi_mediamask |= TULIP_BIT(TULIP_MEDIA_ ## media); \
- } \
-} while (0)
-
-#define TULIP_MII_NOPHY 32
-/*
- * Some boards need to treated specially. The following enumeration
- * identifies the cards with quirks (or those we just want to single
- * out for special merit or scorn).
- */
-typedef enum {
- TULIP_21040_GENERIC, /* Generic 21040 (works with most any board) */
- TULIP_21140_ISV, /* Digital Semicondutor 21140 ISV SROM Format */
- TULIP_21142_ISV, /* Digital Semicondutor 21142 ISV SROM Format */
- TULIP_21143_ISV, /* Digital Semicondutor 21143 ISV SROM Format */
- TULIP_21140_DEC_EB, /* Digital Semicondutor 21140 Eval. Board */
- TULIP_21140_MII, /* 21140[A] with MII */
- TULIP_21140_DEC_DE500, /* Digital DE500-?? 10/100 */
- TULIP_21140_SMC_9332, /* SMC 9332 */
- TULIP_21140_COGENT_EM100, /* Cogent EM100 100 only */
- TULIP_21140_ZNYX_ZX34X, /* ZNYX ZX342 10/100 */
- TULIP_21140_ASANTE, /* AsanteFast 10/100 */
- TULIP_21140_EN1207, /* Accton EN2107 10/100 BNC */
- TULIP_21041_GENERIC /* Generic 21041 card */
-} tulip_board_t;
-
-typedef enum {
- TULIP_MEDIAPOLL_TIMER, /* 100ms timer fired */
- TULIP_MEDIAPOLL_FASTTIMER, /* <100ms timer fired */
- TULIP_MEDIAPOLL_LINKFAIL, /* called from interrupt routine */
- TULIP_MEDIAPOLL_LINKPASS, /* called from interrupt routine */
- TULIP_MEDIAPOLL_START, /* start a media probe (from reset) */
- TULIP_MEDIAPOLL_TXPROBE_OK, /* txprobe succeeded */
- TULIP_MEDIAPOLL_TXPROBE_FAILED, /* txprobe failed */
- TULIP_MEDIAPOLL_MAX
-} tulip_mediapoll_event_t;
-
-typedef enum {
- TULIP_LINK_DOWN, /* Link is down */
- TULIP_LINK_UP, /* link is ok */
- TULIP_LINK_UNKNOWN /* we can't tell either way */
-} tulip_link_status_t;
-
-/*
- * This data structure is used to abstract out the quirks.
- * media_probe = tries to determine the media type.
- * media_select = enables the current media (or autosenses)
- * media_poll = autosenses media
- * media_preset = 21140, etal requires bit to set before the
- * the software reset; hence pre-set. Should be
- * pre-reset but that's ugly.
- */
-typedef struct {
- tulip_board_t bd_type;
- void (*bd_media_probe)(tulip_softc_t * const sc);
- void (*bd_media_select)(tulip_softc_t * const sc);
- void (*bd_media_poll)(tulip_softc_t * const sc,
- tulip_mediapoll_event_t event);
- void (*bd_media_preset) (tulip_softc_t * const sc);
-} tulip_boardsw_t;
-
-/*
- * The next few declarations are for MII/PHY based boards.
- *
- * The first enumeration identifies a superset of various datums
- * that can be obtained from various PHY chips. Not all PHYs will
- * support all datums.
- * The modedata structure indicates what register contains
- * a datum, what mask is applied the register contents, and what the
- * result should be.
- * The attr structure records information about a supported PHY.
- * The phy structure records information about a PHY instance.
- */
-typedef enum {
- PHY_MODE_10T,
- PHY_MODE_100TX,
- PHY_MODE_100T4,
- PHY_MODE_FULLDUPLEX,
- PHY_MODE_MAX
-} tulip_phy_mode_t;
-
-typedef struct {
- u_int16_t pm_regno;
- u_int16_t pm_mask;
- u_int16_t pm_value;
-} tulip_phy_modedata_t;
-
-typedef struct {
- u_int32_t attr_id;
- u_int16_t attr_flags;
- tulip_phy_modedata_t attr_modes[PHY_MODE_MAX];
-#ifdef TULIP_DEBUG
- const char *attr_name;
-#endif
-} tulip_phy_attr_t;
-
-/* Definitions for tulip_phy_attr_t.attr_flags */
-#define PHY_NEED_HARD_RESET 0x0001
-#define PHY_DUAL_CYCLE_TA 0x0002
-
-/*
- * Various probe states used when trying to autosense the media.
- */
-typedef enum {
- TULIP_PROBE_INACTIVE,
- TULIP_PROBE_PHYRESET,
- TULIP_PROBE_PHYAUTONEG,
- TULIP_PROBE_GPRTEST,
- TULIP_PROBE_MEDIATEST,
- TULIP_PROBE_FAILED
-} tulip_probe_state_t;
-
-typedef struct {
- /*
- * Transmit Statistics
- */
- u_int32_t dot3StatsSingleCollisionFrames;
- u_int32_t dot3StatsMultipleCollisionFrames;
- u_int32_t dot3StatsSQETestErrors;
- u_int32_t dot3StatsDeferredTransmissions;
- u_int32_t dot3StatsLateCollisions;
- u_int32_t dot3StatsExcessiveCollisions;
- u_int32_t dot3StatsCarrierSenseErrors;
- u_int32_t dot3StatsInternalMacTransmitErrors;
- /* not in rfc1650! */
- u_int32_t dot3StatsInternalTransmitUnderflows;
- /* not in rfc1650! */
- u_int32_t dot3StatsInternalTransmitBabbles;
- /*
- * Receive Statistics
- */
- u_int32_t dot3StatsMissedFrames; /* not in rfc1650! */
- u_int32_t dot3StatsAlignmentErrors;
- u_int32_t dot3StatsFCSErrors;
- u_int32_t dot3StatsFrameTooLongs;
- u_int32_t dot3StatsInternalMacReceiveErrors;
-} tulip_dot3_stats_t;
-
-/*
- * Probe information.
- */
-struct tulip_probe_info {
- u_int8_t probe_count; /* count of probe operations */
- int32_t probe_timeout; /* time (ms) of probe timeout */
- tulip_probe_state_t probe_state; /* current media probe state */
- tulip_media_t probe_media; /* current media being probed */
- u_int32_t probe_mediamask; /* medias checked */
- u_int32_t probe_passes; /* times autosense failed */
- u_int32_t probe_txprobes; /* txprobes attempted */
-};
-
-/*
- * Debugging/Statistical information.
- */
-struct tulip_dbg_info {
- tulip_media_t dbg_last_media;
- u_int32_t dbg_intrs;
- u_int32_t dbg_media_probes;
- u_int32_t dbg_txprobe_nocarr;
- u_int32_t dbg_txprobe_exccoll;
- u_int32_t dbg_link_downed;
- u_int32_t dbg_link_suspected;
- u_int32_t dbg_link_intrs;
- u_int32_t dbg_link_pollintrs;
- u_int32_t dbg_link_failures;
- u_int32_t dbg_nway_starts;
- u_int32_t dbg_nway_failures;
- u_int16_t dbg_phyregs[32][4];
- u_int32_t dbg_rxlowbufs;
- u_int32_t dbg_rxintrs;
- u_int32_t dbg_last_rxintrs;
- u_int32_t dbg_high_rxintrs_hz;
- u_int32_t dbg_no_txmaps;
- u_int32_t dbg_txput_finishes[8];
- u_int32_t dbg_txprobes_ok[TULIP_MEDIA_MAX];
- u_int32_t dbg_txprobes_failed[TULIP_MEDIA_MAX];
- u_int32_t dbg_events[TULIP_MEDIAPOLL_MAX];
- u_int32_t dbg_rxpktsperintr[TULIP_RXDESCS];
-};
-
-/*
- * Performance statistics.
- */
-struct tulip_perfstat {
- u_quad_t perf_intr_cycles;
- u_quad_t perf_ifstart_cycles;
- u_quad_t perf_ifstart_one_cycles;
- u_quad_t perf_ifioctl_cycles;
- u_quad_t perf_ifwatchdog_cycles;
- u_quad_t perf_timeout_cycles;
- u_quad_t perf_txput_cycles;
- u_quad_t perf_txintr_cycles;
- u_quad_t perf_rxintr_cycles;
- u_quad_t perf_rxget_cycles;
- unsigned int perf_intr;
- unsigned int perf_ifstart;
- unsigned int perf_ifstart_one;
- unsigned int perf_ifioctl;
- unsigned int perf_ifwatchdog;
- unsigned int perf_timeout;
- unsigned int perf_txput;
- unsigned int perf_txintr;
- unsigned int perf_rxintr;
- unsigned int perf_rxget;
-};
-#define TULIP_PERF_CURRENT 0
-#define TULIP_PERF_PREVIOUS 1
-#define TULIP_PERF_TOTAL 2
-#define TULIP_PERF_MAX 3
-
-/*
- * Per-driver-instance state.
- */
-struct tulip_softc {
- struct ifmedia tulip_ifmedia;
- int tulip_unit;
-#if defined(TULIP_BUS_DMA)
- bus_dma_tag_t tulip_dmatag;
-#if !defined(TULIP_BUS_DMA_NOTX)
- bus_dmamap_t tulip_setupmap;
- bus_dmamap_t tulip_txdescmap;
- bus_dmamap_t tulip_txmaps[TULIP_TXDESCS];
- unsigned int tulip_txmaps_free;
-#endif
-#if !defined(TULIP_BUS_DMA_NORX)
- bus_dmamap_t tulip_rxdescmap;
- bus_dmamap_t tulip_rxmaps[TULIP_RXDESCS];
- unsigned int tulip_rxmaps_free;
-#endif
-#endif
- struct ifnet *tulip_ifp;
- u_char tulip_enaddr[6];
- bus_space_tag_t tulip_csrs_bst;
- bus_space_handle_t tulip_csrs_bsh;
- tulip_regfile_t tulip_csrs;
-
- u_int32_t tulip_flags;
- u_int32_t tulip_features;
- u_int32_t tulip_intrmask;
- u_int32_t tulip_cmdmode;
- u_int32_t tulip_last_system_error:3;
- u_int32_t tulip_txtimer:2; /* transmission timer */
- u_int32_t tulip_system_errors;
- u_int32_t tulip_statusbits; /* status bits from
- * CSR5 that may need
- * to be printed
- */
- tulip_media_info_t *tulip_mediums[TULIP_MEDIA_MAX];
- tulip_media_t tulip_media; /* current media type */
- u_int32_t tulip_abilities; /* remote system's
- * abilities (as
- * defined in IEEE
- * 802.3u)
- */
- u_int8_t tulip_revinfo; /* chip revision */
- u_int8_t tulip_phyaddr; /* current phy */
- u_int8_t tulip_gpinit; /* active pins on
- * 21140
- */
- u_int8_t tulip_gpdata; /* default gpdata for 21140 */
- struct tulip_probe_info tulip_probe;
- tulip_chipid_t tulip_chipid; /* type of chip we are using */
- const tulip_boardsw_t *tulip_boardsw; /* board/chip characteristics */
- tulip_softc_t *tulip_slaves; /* slaved devices (ZX3xx) */
-#if defined(TULIP_DEBUG)
- struct tulip_dbg_info tulip_dbg;
-#endif
-#if defined(TULIP_PERFSTATS)
- struct tulip_perfstat tulip_perfstats[TULIP_PERF_MAX];
-#endif
- struct ifqueue tulip_txq;
- struct ifqueue tulip_rxq;
- tulip_dot3_stats_t tulip_dot3stats;
- tulip_ringinfo_t tulip_rxinfo;
- tulip_ringinfo_t tulip_txinfo;
- tulip_media_info_t tulip_mediainfo[10];
- /*
- * The setup buffers for sending the setup frame to the chip. one is
- * the one being sent while the other is the one being filled.
- */
- u_int32_t tulip_setupbuf[192 / sizeof(u_int32_t)];
- u_int32_t tulip_setupdata[192 / sizeof(u_int32_t)];
- char tulip_boardid[24];
- u_int8_t tulip_rombuf[128]; /* must be aligned */
-
- /* needed for multiport boards */
- u_int8_t tulip_pci_busno;
- u_int8_t tulip_pci_devno;
-
- u_int8_t tulip_connidx;
- tulip_srom_connection_t tulip_conntype;
- tulip_desc_t *tulip_rxdescs;
- tulip_desc_t *tulip_txdescs;
-};
-
-#define tulip_curperfstats tulip_perfstats[TULIP_PERF_CURRENT]
-#define tulip_probe_count tulip_probe.probe_count
-#define tulip_probe_timeout tulip_probe.probe_timeout
-#define tulip_probe_state tulip_probe.probe_state
-#define tulip_probe_media tulip_probe.probe_media
-#define tulip_probe_mediamask tulip_probe.probe_mediamask
-#define tulip_probe_passes tulip_probe.probe_passes
-
-/* Definitions for tulip_flags. */
-#define TULIP_WANTSETUP 0x00000001
-#define TULIP_WANTHASHPERFECT 0x00000002
-#define TULIP_WANTHASHONLY 0x00000004
-#define TULIP_DOINGSETUP 0x00000008
-#define TULIP_PRINTMEDIA 0x00000010
-#define TULIP_TXPROBE_ACTIVE 0x00000020
-#define TULIP_ALLMULTI 0x00000040
-#define TULIP_WANTRXACT 0x00000080
-#define TULIP_RXACT 0x00000100
-#define TULIP_INRESET 0x00000200
-#define TULIP_NEEDRESET 0x00000400
-#define TULIP_SQETEST 0x00000800
-#define TULIP_xxxxxx0 0x00001000
-#define TULIP_xxxxxx1 0x00002000
-#define TULIP_WANTTXSTART 0x00004000
-#define TULIP_NEWTXTHRESH 0x00008000
-#define TULIP_NOAUTOSENSE 0x00010000
-#define TULIP_PRINTLINKUP 0x00020000
-#define TULIP_LINKUP 0x00040000
-#define TULIP_RXBUFSLOW 0x00080000
-#define TULIP_NOMESSAGES 0x00100000
-#define TULIP_SYSTEMERROR 0x00200000
-#define TULIP_TIMEOUTPENDING 0x00400000
-#define TULIP_xxxxxx2 0x00800000
-#define TULIP_TRYNWAY 0x01000000
-#define TULIP_DIDNWAY 0x02000000
-#define TULIP_RXIGNORE 0x04000000
-#define TULIP_PROBE1STPASS 0x08000000
-#define TULIP_DEVICEPROBE 0x10000000
-#define TULIP_PROMISC 0x20000000
-#define TULIP_HASHONLY 0x40000000
-#define TULIP_xxxxxx3 0x80000000
-
-/* Definitions for tulip_features. */
-#define TULIP_HAVE_GPR 0x00000001 /* have gp register (140[A]) */
-#define TULIP_HAVE_RXBADOVRFLW 0x00000002 /* RX corrupts on overflow */
-#define TULIP_HAVE_POWERMGMT 0x00000004 /* Snooze/sleep modes */
-#define TULIP_HAVE_MII 0x00000008 /* Some medium on MII */
-#define TULIP_HAVE_SIANWAY 0x00000010 /* SIA does NWAY */
-#define TULIP_HAVE_DUALSENSE 0x00000020 /* SIA senses both AUI & TP */
-#define TULIP_HAVE_SIAGP 0x00000040 /* SIA has a GP port */
-#define TULIP_HAVE_BROKEN_HASH 0x00000080 /* Broken Multicast Hash */
-#define TULIP_HAVE_ISVSROM 0x00000100 /* uses ISV SROM Format */
-#define TULIP_HAVE_BASEROM 0x00000200 /* Board ROM can be cloned */
-#define TULIP_HAVE_SLAVEDROM 0x00000400 /* Board ROM cloned */
-#define TULIP_HAVE_SLAVEDINTR 0x00000800 /* Board slaved interrupt */
-#define TULIP_HAVE_SHAREDINTR 0x00001000 /* Board shares interrupts */
-#define TULIP_HAVE_OKROM 0x00002000 /* ROM was recognized */
-#define TULIP_HAVE_NOMEDIA 0x00004000 /* did not detect any media */
-#define TULIP_HAVE_STOREFWD 0x00008000 /* have CMD_STOREFWD */
-#define TULIP_HAVE_SIA100 0x00010000 /* has LS100 in SIA status */
-#define TULIP_HAVE_OKSROM 0x00020000 /* SROM CRC is OK */
-
-#define TULIP_DO_AUTOSENSE(sc) \
- (IFM_SUBTYPE((sc)->tulip_ifmedia.ifm_media) == IFM_AUTO)
-
-#if defined(TULIP_HDR_DATA)
-static const char *const tulip_chipdescs[] = {
- "21040 [10Mb/s]",
- "21041 [10Mb/s]",
- "21140 [10-100Mb/s]",
- "21140A [10-100Mb/s]",
- "21142 [10-100Mb/s]",
- "21143 [10-100Mb/s]",
-};
-
-static const char *const tulip_mediums[] = {
- "unknown", /* TULIP_MEDIA_UNKNOWN */
- "10baseT", /* TULIP_MEDIA_10BASET */
- "Full Duplex 10baseT", /* TULIP_MEDIA_10BASET_FD */
- "BNC", /* TULIP_MEDIA_BNC */
- "AUI", /* TULIP_MEDIA_AUI */
- "External SIA", /* TULIP_MEDIA_EXTSIA */
- "AUI/BNC", /* TULIP_MEDIA_AUIBNC */
- "100baseTX", /* TULIP_MEDIA_100BASET */
- "Full Duplex 100baseTX",/* TULIP_MEDIA_100BASET_FD */
- "100baseT4", /* TULIP_MEDIA_100BASET4 */
- "100baseFX", /* TULIP_MEDIA_100BASEFX */
- "Full Duplex 100baseFX",/* TULIP_MEDIA_100BASEFX_FD */
-};
-
-static const int tulip_media_to_ifmedia[] = {
- IFM_ETHER | IFM_NONE, /* TULIP_MEDIA_UNKNOWN */
- IFM_ETHER | IFM_10_T, /* TULIP_MEDIA_10BASET */
- IFM_ETHER | IFM_10_T | IFM_FDX, /* TULIP_MEDIA_10BASET_FD */
- IFM_ETHER | IFM_10_2, /* TULIP_MEDIA_BNC */
- IFM_ETHER | IFM_10_5, /* TULIP_MEDIA_AUI */
- IFM_ETHER | IFM_MANUAL, /* TULIP_MEDIA_EXTSIA */
- IFM_ETHER | IFM_10_5, /* TULIP_MEDIA_AUIBNC */
- IFM_ETHER | IFM_100_TX, /* TULIP_MEDIA_100BASET */
- IFM_ETHER | IFM_100_TX | IFM_FDX, /* TULIP_MEDIA_100BASET_FD */
- IFM_ETHER | IFM_100_T4, /* TULIP_MEDIA_100BASET4 */
- IFM_ETHER | IFM_100_FX, /* TULIP_MEDIA_100BASEFX */
- IFM_ETHER | IFM_100_FX | IFM_FDX, /* TULIP_MEDIA_100BASEFX_FD */
-};
-
-static const char *const tulip_system_errors[] = {
- "parity error",
- "master abort",
- "target abort",
- "reserved #3",
- "reserved #4",
- "reserved #5",
- "reserved #6",
- "reserved #7",
-};
-
-static const char *const tulip_status_bits[] = {
- NULL,
- "transmit process stopped",
- NULL,
- "transmit jabber timeout",
-
- NULL,
- "transmit underflow",
- NULL,
- "receive underflow",
-
- "receive process stopped",
- "receive watchdog timeout",
- NULL,
- NULL,
-
- "link failure",
- NULL,
- NULL,
-};
-
-static const struct {
- tulip_srom_connection_t sc_type;
- tulip_media_t sc_media;
- u_int32_t sc_attrs;
-} tulip_srom_conninfo[] = {
- {
- TULIP_SROM_CONNTYPE_10BASET, TULIP_MEDIA_10BASET
- },
- {
- TULIP_SROM_CONNTYPE_BNC, TULIP_MEDIA_BNC
- },
- {
- TULIP_SROM_CONNTYPE_AUI, TULIP_MEDIA_AUI
- },
- {
- TULIP_SROM_CONNTYPE_100BASETX, TULIP_MEDIA_100BASETX
- },
- {
- TULIP_SROM_CONNTYPE_100BASET4, TULIP_MEDIA_100BASET4
- },
- {
- TULIP_SROM_CONNTYPE_100BASEFX, TULIP_MEDIA_100BASEFX
- },
- {
- TULIP_SROM_CONNTYPE_MII_10BASET, TULIP_MEDIA_10BASET,
- TULIP_SROM_ATTR_MII
- },
- {
- TULIP_SROM_CONNTYPE_MII_100BASETX, TULIP_MEDIA_100BASETX,
- TULIP_SROM_ATTR_MII
- },
- {
- TULIP_SROM_CONNTYPE_MII_100BASET4, TULIP_MEDIA_100BASET4,
- TULIP_SROM_ATTR_MII
- },
- {
- TULIP_SROM_CONNTYPE_MII_100BASEFX, TULIP_MEDIA_100BASEFX,
- TULIP_SROM_ATTR_MII
- },
- {
- TULIP_SROM_CONNTYPE_10BASET_NWAY, TULIP_MEDIA_10BASET,
- TULIP_SROM_ATTR_NWAY
- },
- {
- TULIP_SROM_CONNTYPE_10BASET_FD, TULIP_MEDIA_10BASET_FD
- },
- {
- TULIP_SROM_CONNTYPE_MII_10BASET_FD, TULIP_MEDIA_10BASET_FD,
- TULIP_SROM_ATTR_MII
- },
- {
- TULIP_SROM_CONNTYPE_100BASETX_FD, TULIP_MEDIA_100BASETX_FD
- },
- {
- TULIP_SROM_CONNTYPE_MII_100BASETX_FD, TULIP_MEDIA_100BASETX_FD,
- TULIP_SROM_ATTR_MII
- },
- {
- TULIP_SROM_CONNTYPE_10BASET_NOLINKPASS, TULIP_MEDIA_10BASET,
- TULIP_SROM_ATTR_NOLINKPASS
- },
- {
- TULIP_SROM_CONNTYPE_AUTOSENSE, TULIP_MEDIA_UNKNOWN,
- TULIP_SROM_ATTR_AUTOSENSE
- },
- {
- TULIP_SROM_CONNTYPE_AUTOSENSE_POWERUP, TULIP_MEDIA_UNKNOWN,
- TULIP_SROM_ATTR_AUTOSENSE | TULIP_SROM_ATTR_POWERUP
- },
- {
- TULIP_SROM_CONNTYPE_AUTOSENSE_NWAY, TULIP_MEDIA_UNKNOWN,
- TULIP_SROM_ATTR_AUTOSENSE | TULIP_SROM_ATTR_NWAY
- },
- {
- TULIP_SROM_CONNTYPE_NOT_USED, TULIP_MEDIA_UNKNOWN
- }
-};
-#define TULIP_SROM_LASTCONNIDX \
- (sizeof(tulip_srom_conninfo)/sizeof(tulip_srom_conninfo[0]) - 1)
-
-static const struct {
- tulip_media_t sm_type;
- tulip_srom_media_t sm_srom_type;
-} tulip_srom_mediums[] = {
- {
- TULIP_MEDIA_100BASEFX_FD, TULIP_SROM_MEDIA_100BASEFX_FD
- },
- {
- TULIP_MEDIA_100BASEFX, TULIP_SROM_MEDIA_100BASEFX
- },
- {
- TULIP_MEDIA_100BASET4, TULIP_SROM_MEDIA_100BASET4
- },
- {
- TULIP_MEDIA_100BASETX_FD, TULIP_SROM_MEDIA_100BASETX_FD
- },
- {
- TULIP_MEDIA_100BASETX, TULIP_SROM_MEDIA_100BASETX
- },
- {
- TULIP_MEDIA_10BASET_FD, TULIP_SROM_MEDIA_10BASET_FD
- },
- {
- TULIP_MEDIA_AUI, TULIP_SROM_MEDIA_AUI
- },
- {
- TULIP_MEDIA_BNC, TULIP_SROM_MEDIA_BNC
- },
- {
- TULIP_MEDIA_10BASET, TULIP_SROM_MEDIA_10BASET
- },
- {
- TULIP_MEDIA_UNKNOWN
- }
-};
-
-#endif /* TULIP_HDR_DATA */
-
-/*
- * This driver supports a maximum of 32 tulip boards.
- * This should be enough for the forseeable future.
- */
-#define TULIP_MAX_DEVICES 32
-
-#if defined(TULIP_USE_SOFTINTR) && defined(TULIP_HDR_DATA)
-static u_int32_t tulip_softintr_mask;
-static int tulip_softintr_last_unit;
-static int tulip_softintr_max_unit;
-static void tulip_softintr(void);
-#endif
-
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NORX)
-#define TULIP_RXDESC_PRESYNC(sc, di, s) \
- bus_dmamap_sync((sc)->tulip_dmatag, (sc)->tulip_rxdescmap, \
- (caddr_t) di - (caddr_t) (sc)->tulip_rxdescs, \
- (s), BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)
-#define TULIP_RXDESC_POSTSYNC(sc, di, s) \
- bus_dmamap_sync((sc)->tulip_dmatag, (sc)->tulip_rxdescmap, \
- (caddr_t) di - (caddr_t) (sc)->tulip_rxdescs, \
- (s), BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)
-#define TULIP_RXMAP_PRESYNC(sc, map) \
- bus_dmamap_sync((sc)->tulip_dmatag, (map), 0, (map)->dm_mapsize, \
- BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)
-#define TULIP_RXMAP_POSTSYNC(sc, map) \
- bus_dmamap_sync((sc)->tulip_dmatag, (map), 0, (map)->dm_mapsize, \
- BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)
-#define TULIP_RXMAP_CREATE(sc, mapp) \
- bus_dmamap_create((sc)->tulip_dmatag, TULIP_RX_BUFLEN, 2, \
- TULIP_DATA_PER_DESC, 0, \
- BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW, (mapp))
-#else
-#ifdef __alpha__
-#define TULIP_RXDESC_PRESYNC(sc, di, s) alpha_mb()
-#define TULIP_RXDESC_POSTSYNC(sc, di, s) alpha_mb()
-#define TULIP_RXMAP_PRESYNC(sc, map) alpha_mb()
-#define TULIP_RXMAP_POSTSYNC(sc, map) alpha_mb()
-#else
-#define TULIP_RXDESC_PRESYNC(sc, di, s) do { } while (0)
-#define TULIP_RXDESC_POSTSYNC(sc, di, s) do { } while (0)
-#define TULIP_RXMAP_PRESYNC(sc, map) do { } while (0)
-#define TULIP_RXMAP_POSTSYNC(sc, map) do { } while (0)
-#endif
-#define TULIP_RXMAP_CREATE(sc, mapp) do { } while (0)
-#endif
-
-#if defined(TULIP_BUS_DMA) && !defined(TULIP_BUS_DMA_NOTX)
-#define TULIP_TXDESC_PRESYNC(sc, di, s) \
- bus_dmamap_sync((sc)->tulip_dmatag, (sc)->tulip_txdescmap, \
- (caddr_t) di - (caddr_t) (sc)->tulip_txdescs, \
- (s), BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)
-#define TULIP_TXDESC_POSTSYNC(sc, di, s) \
- bus_dmamap_sync((sc)->tulip_dmatag, (sc)->tulip_txdescmap, \
- (caddr_t) di - (caddr_t) (sc)->tulip_txdescs, \
- (s), BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)
-#define TULIP_TXMAP_PRESYNC(sc, map) \
- bus_dmamap_sync((sc)->tulip_dmatag, (map), 0, (map)->dm_mapsize, \
- BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)
-#define TULIP_TXMAP_POSTSYNC(sc, map) \
- bus_dmamap_sync((sc)->tulip_dmatag, (map), 0, (map)->dm_mapsize, \
- BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)
-#define TULIP_TXMAP_CREATE(sc, mapp) \
- bus_dmamap_create((sc)->tulip_dmatag, TULIP_DATA_PER_DESC, \
- TULIP_MAX_TXSEG, TULIP_DATA_PER_DESC, \
- 0, BUS_DMA_NOWAIT, (mapp))
-#else
-#ifdef __alpha__
-#define TULIP_TXDESC_PRESYNC(sc, di, s) alpha_mb()
-#define TULIP_TXDESC_POSTSYNC(sc, di, s) alpha_mb()
-#define TULIP_TXMAP_PRESYNC(sc, map) alpha_mb()
-#define TULIP_TXMAP_POSTSYNC(sc, map) alpha_mb()
-#else
-#define TULIP_TXDESC_PRESYNC(sc, di, s) do { } while (0)
-#define TULIP_TXDESC_POSTSYNC(sc, di, s) do { } while (0)
-#define TULIP_TXMAP_PRESYNC(sc, map) do { } while (0)
-#define TULIP_TXMAP_POSTSYNC(sc, map) do { } while (0)
-#endif
-#define TULIP_TXMAP_CREATE(sc, mapp) do { } while (0)
-#endif
-
-#ifdef notyet
-#define SIOCGADDRROM _IOW('i', 240, struct ifreq) /* get 128 bytes of ROM */
-#define SIOCGCHIPID _IOWR('i', 241, struct ifreq) /* get chipid */
-#endif
-
-#if defined(TULIP_HDR_DATA)
-static tulip_softc_t *tulips[TULIP_MAX_DEVICES];
-#endif
-
-#if defined(TULIP_USE_SOFTINTR)
-NETISR_SET(NETISR_DE, tulip_softintr);
-#endif
-
-#define loudprintf if (bootverbose) printf
-
-#if !defined(TULIP_KVATOPHYS) && (!defined(TULIP_BUS_DMA) || defined(TULIP_BUS_DMA_NORX) || defined(TULIP_BUS_DMA_NOTX))
-#if defined(__alpha__)
-/* XXX XXX NEED REAL DMA MAPPING SUPPORT XXX XXX */
-#define vtobus(va) alpha_XXX_dmamap((vm_offset_t)va)
-#else
-#define vtobus(va) vtophys(va)
-#endif
-#define TULIP_KVATOPHYS(sc, va) vtobus(va)
-#endif
-
-#if defined(TULIP_PERFSTATS)
-#define TULIP_PERFMERGE(sc, member) \
- do { (sc)->tulip_perfstats[TULIP_PERF_TOTAL].member \
- += (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member; \
- (sc)->tulip_perfstats[TULIP_PERF_PREVIOUS].member \
- = (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member; \
- (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member = 0; } while (0)
-#define TULIP_PERFSTART(name) const tulip_cycle_t perfstart_ ## name = TULIP_PERFREAD();
-#define TULIP_PERFEND(name) do { \
- (sc)->tulip_curperfstats.perf_ ## name ## _cycles += TULIP_PERFDIFF(perfstart_ ## name, TULIP_PERFREAD()); \
- (sc)->tulip_curperfstats.perf_ ## name ++; \
- } while (0)
-
-#if defined(__i386__)
-typedef u_quad_t tulip_cycle_t;
-
-static __inline tulip_cycle_t
-TULIP_PERFREAD(void)
-{
- tulip_cycle_t x;
- __asm__ volatile (".byte 0x0f, 0x31":"=A" (x));
-
- return (x);
-}
-
-#define TULIP_PERFDIFF(s, f) ((f) - (s))
-#elif defined(__alpha__)
-typedef unsigned long tulip_cycle_t;
-
-static __inline tulip_cycle_t
-TULIP_PERFREAD(void)
-{
- tulip_cycle_t x;
- __asm__ volatile ("rpcc %0":"=r" (x));
-
- return (x);
-}
-
-#define TULIP_PERFDIFF(s, f) ((unsigned int) ((f) - (s)))
-#endif
-#else
-#define TULIP_PERFSTART(name)
-#define TULIP_PERFEND(name) do { } while (0)
-#define TULIP_PERFMERGE(s,n) do { } while (0)
-#endif /* TULIP_PERFSTATS */
-
-#define TULIP_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- Little
- * Endian */
-#define TULIP_MAX_TXSEG 30
-
-#define TULIP_ADDREQUAL(a1, a2) \
- (((u_int16_t *)a1)[0] == ((u_int16_t *)a2)[0] \
- && ((u_int16_t *)a1)[1] == ((u_int16_t *)a2)[1] \
- && ((u_int16_t *)a1)[2] == ((u_int16_t *)a2)[2])
-#define TULIP_ADDRBRDCST(a1) \
- (((u_int16_t *)a1)[0] == 0xFFFFU \
- && ((u_int16_t *)a1)[1] == 0xFFFFU \
- && ((u_int16_t *)a1)[2] == 0xFFFFU)
-
-#endif /* _DEVAR_H */
diff --git a/sys/dev/fb/creatorreg.h b/sys/dev/fb/creatorreg.h
deleted file mode 100644
index 87fe980..0000000
--- a/sys/dev/fb/creatorreg.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*-
- * Copyright (C) 2000 David S. Miller (davem@redhat.com)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * from: XFree86: ffb_dac.h,v 1.1 2000/05/23 04:47:44 dawes Exp
- */
-/*-
- * Copyright (c) 2003 Jake Burkholder.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _DEV_FB_CREATOR_H_
-#define _DEV_FB_CREATOR_H_
-
-#define FFB_NREG 24
-
-#define FFB_DAC 1
-#define FFB_DAC_TYPE 0x0
-#define FFB_DAC_VALUE 0x4
-#define FFB_DAC_TYPE2 0x8
-#define FFB_DAC_VALUE2 0xc
-
-/* FFB_DAC_TYPE configuration and palette register addresses */
-#define FFB_DAC_CFG_UCTRL 0x1001 /* User Control */
-#define FFB_DAC_CFG_TGEN 0x6000 /* Timing Generator Control */
-#define FFB_DAC_CFG_DID 0x8000 /* Device Identification */
-
-/* FFB_DAC_CFG_UCTRL register */
-#define FFB_DAC_UCTRL_IPDISAB 0x0001 /* Input Pullup Resistor Dis. */
-#define FFB_DAC_UCTRL_ABLANK 0x0002 /* Asynchronous Blank */
-#define FFB_DAC_UCTRL_DBENAB 0x0004 /* Double-Buffer Enable */
-#define FFB_DAC_UCTRL_OVENAB 0x0008 /* Overlay Enable */
-#define FFB_DAC_UCTRL_WMODE 0x0030 /* Window Mode */
-#define FFB_DAC_UCTRL_WM_COMB 0x0000 /* Window Mode Combined */
-#define FFB_DAC_UCTRL_WM_S4 0x0010 /* Window Mode Separate 4 */
-#define FFB_DAC_UCTRL_WM_S8 0x0020 /* Window Mode Separate 8 */
-#define FFB_DAC_UCTRL_WM_RESV 0x0030 /* Window Mode Reserved */
-#define FFB_DAC_UCTRL_MANREV 0x0f00 /* Manufacturing Revision */
-
-/* FFB_DAC_CFG_TGEN register */
-#define FFB_DAC_CFG_TGEN_VIDE 0x01 /* Video Enable */
-#define FFB_DAC_CFG_TGEN_TGE 0x02 /* Timing Generator Enable */
-#define FFB_DAC_CFG_TGEN_HSD 0x04 /* HSYNC* Disable */
-#define FFB_DAC_CFG_TGEN_VSD 0x08 /* VSYNC* Disable */
-#define FFB_DAC_CFG_TGEN_EQD 0x10 /* Equalization Disable */
-#define FFB_DAC_CFG_TGEN_MM 0x20 /* 0 = Slave, 1 = Master */
-#define FFB_DAC_CFG_TGEN_IM 0x40 /* 1 = Interlaced Mode */
-
-/* FFB_DAC_CFG_DID register */
-#define FFB_DAC_CFG_DID_ONE 0x00000001 /* Always Set */
-#define FFB_DAC_CFG_DID_MANUF 0x00000ffe /* DAC Manufacturer ID */
-#define FFB_DAC_CFG_DID_PNUM 0x0ffff000 /* DAC Part Number */
-#define FFB_DAC_CFG_DID_REV 0xf0000000 /* DAC Revision */
-
-/* FFB_DAC_TYPE2 cursor register addresses */
-#define FFB_DAC_CUR_BITMAP_P0 0x0 /* Plane 0 Cursor Bitmap */
-#define FFB_DAC_CUR_BITMAP_P1 0x80 /* Plane 1 Cursor Bitmap */
-#define FFB_DAC_CUR_CTRL 0x100 /* Cursor Control */
-#define FFB_DAC_CUR_COLOR0 0x101 /* Cursor Color 0 */
-#define FFB_DAC_CUR_COLOR1 0x102 /* Cursor Color 1 (bg) */
-#define FFB_DAC_CUR_COLOR2 0x103 /* Cursor Color 2 (fg) */
-#define FFB_DAC_CUR_POS 0x104 /* Active Cursor Position */
-
-/* FFB_DAC_CUR_CTRL register (might be inverted on PAC1 DACs) */
-#define FFB_DAC_CUR_CTRL_P0 0x1 /* Plane0 Display Disable */
-#define FFB_DAC_CUR_CTRL_P1 0x2 /* Plane1 Display Disable */
-
-#define FFB_FBC 2
-#define FFB_FBC_BY 0x60
-#define FFB_FBC_BX 0x64
-#define FFB_FBC_DY 0x68
-#define FFB_FBC_DX 0x6c
-#define FFB_FBC_BH 0x70
-#define FFB_FBC_BW 0x74
-#define FFB_FBC_PPC 0x200 /* Pixel Processor Control */
-#define FFB_FBC_FG 0x208 /* Foreground */
-#define FFB_FBC_BG 0x20c /* Background */
-#define FFB_FBC_FBC 0x254 /* Frame Buffer Control */
-#define FFB_FBC_ROP 0x258 /* Raster Operation */
-#define FFB_FBC_PMASK 0x290 /* Pixel Mask */
-#define FFB_FBC_DRAWOP 0x300 /* Draw Operation */
-#define FFB_FBC_FONTXY 0x314 /* Font X/Y */
-#define FFB_FBC_FONTW 0x318 /* Font Width */
-#define FFB_FBC_FONTINC 0x31c /* Font Increment */
-#define FFB_FBC_FONT 0x320 /* Font Data */
-#define FFB_FBC_UCSR 0x900 /* User Control & Status */
-
-#define FBC_PPC_VCE_DIS 0x00001000
-#define FBC_PPC_APE_DIS 0x00000800
-#define FBC_PPC_TBE_OPAQUE 0x00000200
-#define FBC_PPC_CS_CONST 0x00000003
-
-#define FFB_FBC_WB_A 0x20000000
-#define FFB_FBC_RB_A 0x00004000
-#define FFB_FBC_SB_BOTH 0x00003000
-#define FFB_FBC_XE_OFF 0x00000040
-#define FFB_FBC_RGBE_MASK 0x0000003f
-
-#define FBC_ROP_NEW 0x83
-
-#define FBC_DRAWOP_RECTANGLE 0x08
-
-#define FBC_UCSR_FIFO_OVFL 0x80000000
-#define FBC_UCSR_READ_ERR 0x40000000
-#define FBC_UCSR_RP_BUSY 0x02000000
-#define FBC_UCSR_FB_BUSY 0x01000000
-#define FBC_UCSR_FIFO_MASK 0x00000fff
-
-#define FFB_VIRT_SFB8R 0x00000000
-#define FFB_VIRT_SFB8G 0x00400000
-#define FFB_VIRT_SFB8B 0x00800000
-#define FFB_VIRT_SFB8X 0x00c00000
-#define FFB_VIRT_SFB32 0x01000000
-#define FFB_VIRT_SFB64 0x02000000
-#define FFB_VIRT_FBC 0x04000000
-#define FFB_VIRT_FBC_BM 0x04002000
-#define FFB_VIRT_DFB8R 0x04004000
-#define FFB_VIRT_DFB8G 0x04404000
-#define FFB_VIRT_DFB8B 0x04804000
-#define FFB_VIRT_DFB8X 0x04c04000
-#define FFB_VIRT_DFB24 0x05004000
-#define FFB_VIRT_DFB32 0x06004000
-#define FFB_VIRT_DFB422A 0x07004000
-#define FFB_VIRT_DFB422AD 0x07804000
-#define FFB_VIRT_DFB24B 0x08004000
-#define FFB_VIRT_DFB422B 0x09004000
-#define FFB_VIRT_DFB422BD 0x09804000
-#define FFB_VIRT_SFB16Z 0x0a004000
-#define FFB_VIRT_SFB8Z 0x0a404000
-#define FFB_VIRT_SFB422 0x0ac04000
-#define FFB_VIRT_SFB422D 0x0b404000
-#define FFB_VIRT_FBC_KREG 0x0bc04000
-#define FFB_VIRT_DAC 0x0bc06000
-#define FFB_VIRT_PROM 0x0bc08000
-#define FFB_VIRT_EXP 0x0bc18000
-
-#define FFB_PHYS_SFB8R 0x04000000
-#define FFB_PHYS_SFB8G 0x04400000
-#define FFB_PHYS_SFB8B 0x04800000
-#define FFB_PHYS_SFB8X 0x04c00000
-#define FFB_PHYS_SFB32 0x05000000
-#define FFB_PHYS_SFB64 0x06000000
-#define FFB_PHYS_FBC 0x00600000
-#define FFB_PHYS_FBC_BM 0x00600000
-#define FFB_PHYS_DFB8R 0x01000000
-#define FFB_PHYS_DFB8G 0x01400000
-#define FFB_PHYS_DFB8B 0x01800000
-#define FFB_PHYS_DFB8X 0x01c00000
-#define FFB_PHYS_DFB24 0x02000000
-#define FFB_PHYS_DFB32 0x03000000
-#define FFB_PHYS_DFB422A 0x09000000
-#define FFB_PHYS_DFB422AD 0x09800000
-#define FFB_PHYS_DFB24B 0x0a000000
-#define FFB_PHYS_DFB422B 0x0b000000
-#define FFB_PHYS_DFB422BD 0x0b800000
-#define FFB_PHYS_SFB16Z 0x0c800000
-#define FFB_PHYS_SFB8Z 0x0c000000
-#define FFB_PHYS_SFB422 0x0d000000
-#define FFB_PHYS_SFB422D 0x0d800000
-#define FFB_PHYS_FBC_KREG 0x00610000
-#define FFB_PHYS_DAC 0x00400000
-#define FFB_PHYS_PROM 0x00000000
-#define FFB_PHYS_EXP 0x00200000
-
-#define FFB_READ(sc, reg, off) \
- bus_space_read_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off))
-#define FFB_WRITE(sc, reg, off, val) \
- bus_space_write_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val))
-
-#define CREATOR_DRIVER_NAME "creator"
-
-struct creator_softc {
- video_adapter_t sc_va; /* XXX must be first */
-
- phandle_t sc_node;
-
- struct cdev *sc_si;
-
- int sc_rid[FFB_NREG];
- struct resource *sc_reg[FFB_NREG];
- bus_space_tag_t sc_bt[FFB_NREG];
- bus_space_handle_t sc_bh[FFB_NREG];
-
- int sc_height;
- int sc_width;
-
- int sc_xmargin;
- int sc_ymargin;
-
- u_char *sc_font;
-
- int sc_bg_cache;
- int sc_fg_cache;
- int sc_fifo_cache;
- int sc_fontinc_cache;
- int sc_fontw_cache;
- int sc_pmask_cache;
-
- int sc_flags;
-#define CREATOR_AFB (1 << 0)
-#define CREATOR_CONSOLE (1 << 1)
-#define CREATOR_CUREN (1 << 2)
-#define CREATOR_CURINV (1 << 3)
-#define CREATOR_PAC1 (1 << 4)
-};
-
-#endif /* !_DEV_FB_CREATOR_H_ */
diff --git a/sys/dev/fb/gallant12x22.c b/sys/dev/fb/gallant12x22.c
deleted file mode 100644
index a089f6a..0000000
--- a/sys/dev/fb/gallant12x22.c
+++ /dev/null
@@ -1,6185 +0,0 @@
-/* $OpenBSD: gallant12x22.h,v 1.2 2002/05/09 08:59:03 maja Exp $ */
-/* $NetBSD: gallant12x22.h,v 1.2 1999/05/18 21:51:58 ad Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to the Computer Systems
- * Engineering Group at Lawrence Berkeley Laboratory and to the University
- * of California at Berkeley by Jef Poskanzer.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Derived from: @(#)gallant19.h 8.1 (Berkeley) 6/11/93
- *
- * $FreeBSD$
- */
-
-static u_char gallant12x22_data[] = {
- /* 0 0x00 '^@' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 1 0x01 '^A' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 2 0x02 '^B' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 3 0x03 '^C' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 4 0x04 '^D' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 5 0x05 '^E' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 6 0x06 '^F' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 7 0x07 '^G' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 8 0x08 '^H' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 9 0x09 '^I' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 10 0x0a '^J' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 11 0x0b '^K' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 12 0x0c '^L' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 13 0x0d '^M' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 14 0x0e '^N' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 15 0x0f '^O' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 16 0x10 '^P' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 17 0x11 '^Q' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 18 0x12 '^R' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 19 0x13 '^S' */
- 0x00, 0x00, /* ............ */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 20 0x14 '^T' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0xf0, /* ...********* */
- 0x3c, 0xc0, /* ..****..**.. */
- 0x7c, 0xc0, /* .*****..**.. */
- 0x7c, 0xc0, /* .*****..**.. */
- 0x7c, 0xc0, /* .*****..**.. */
- 0x3c, 0xc0, /* ..****..**.. */
- 0x1c, 0xc0, /* ...***..**.. */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x1c, 0xe0, /* ...***..***. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 21 0x15 '^U' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0x00, /* ...*****.... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x1f, 0x00, /* ...*****.... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x1f, 0x00, /* ...*****.... */
- 0x01, 0x80, /* .......**... */
- 0x01, 0x80, /* .......**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x1f, 0x00, /* ...*****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 22 0x16 '^V' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 23 0x17 '^W' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 24 0x18 '^X' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 25 0x19 '^Y' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 26 0x1a '^Z' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 27 0x1b '^[' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 28 0x1c '^\' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 29 0x1d '^]' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 30 0x1e '^^' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 31 0x1f '^_' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 32 0x20 ' ' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 33 0x21 '!' */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 34 0x22 '"' */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 35 0x23 '#' */
- 0x00, 0x00, /* ............ */
- 0x03, 0x30, /* ......**..** */
- 0x03, 0x30, /* ......**..** */
- 0x03, 0x30, /* ......**..** */
- 0x06, 0x60, /* .....**..**. */
- 0x1f, 0xf0, /* ...********* */
- 0x1f, 0xf0, /* ...********* */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x7f, 0xc0, /* .*********.. */
- 0x7f, 0xc0, /* .*********.. */
- 0x33, 0x00, /* ..**..**.... */
- 0x66, 0x00, /* .**..**..... */
- 0x66, 0x00, /* .**..**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 36 0x24 '$' */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x3f, 0xc0, /* ..********.. */
- 0x66, 0xe0, /* .**..**.***. */
- 0x66, 0x60, /* .**..**..**. */
- 0x66, 0x00, /* .**..**..... */
- 0x3e, 0x00, /* ..*****..... */
- 0x1f, 0x80, /* ...******... */
- 0x07, 0xc0, /* .....*****.. */
- 0x06, 0x60, /* .....**..**. */
- 0x06, 0x60, /* .....**..**. */
- 0x66, 0x60, /* .**..**..**. */
- 0x7f, 0xc0, /* .*********.. */
- 0x3f, 0x80, /* ..*******... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 37 0x25 '%' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x38, 0xc0, /* ..***...**.. */
- 0x4c, 0xc0, /* .*..**..**.. */
- 0x45, 0x80, /* .*...*.**... */
- 0x65, 0x80, /* .**..*.**... */
- 0x3b, 0x00, /* ..***.**.... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x0d, 0xc0, /* ....**.***.. */
- 0x1a, 0x60, /* ...**.*..**. */
- 0x1a, 0x20, /* ...**.*...*. */
- 0x33, 0x20, /* ..**..**..*. */
- 0x31, 0xc0, /* ..**...***.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 38 0x26 '&' */
- 0x00, 0x00, /* ............ */
- 0x07, 0x00, /* .....***.... */
- 0x0f, 0x80, /* ....*****... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x18, 0xc0, /* ...**...**.. */
- 0x18, 0xc0, /* ...**...**.. */
- 0x0f, 0x80, /* ....*****... */
- 0x1e, 0x00, /* ...****..... */
- 0x3e, 0x00, /* ..*****..... */
- 0x77, 0x00, /* .***.***.... */
- 0x63, 0x60, /* .**...**.**. */
- 0x61, 0xe0, /* .**....****. */
- 0x61, 0xc0, /* .**....***.. */
- 0x61, 0x80, /* .**....**... */
- 0x3f, 0xe0, /* ..*********. */
- 0x1e, 0x60, /* ...****..**. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 39 0x27 ''' */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x1e, 0x00, /* ...****..... */
- 0x1e, 0x00, /* ...****..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x00, /* ...**....... */
- 0x10, 0x00, /* ...*........ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 40 0x28 '(' */
- 0x00, 0x00, /* ............ */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x00, /* ......**.... */
- 0x01, 0x80, /* .......**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 41 0x29 ')' */
- 0x00, 0x00, /* ............ */
- 0x18, 0x00, /* ...**....... */
- 0x0c, 0x00, /* ....**...... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x00, /* ...**....... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 42 0x2a '*' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x06, 0x00, /* .....**..... */
- 0x66, 0x60, /* .**..**..**. */
- 0x76, 0xe0, /* .***.**.***. */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x76, 0xe0, /* .***.**.***. */
- 0x66, 0x60, /* .**..**..**. */
- 0x06, 0x00, /* .....**..... */
- 0x0f, 0x00, /* ....****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 43 0x2b '+' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x7f, 0xe0, /* .**********. */
- 0x7f, 0xe0, /* .**********. */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 44 0x2c ',' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x1e, 0x00, /* ...****..... */
- 0x1e, 0x00, /* ...****..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x00, /* ...**....... */
- 0x10, 0x00, /* ...*........ */
- 0x00, 0x00, /* ............ */
-
- /* 45 0x2d '-' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x7f, 0xe0, /* .**********. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 46 0x2e '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x1e, 0x00, /* ...****..... */
- 0x1e, 0x00, /* ...****..... */
- 0x0c, 0x00, /* ....**...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 47 0x2f '/' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x60, /* .........**. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x01, 0x80, /* .......**... */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x00, /* ...**....... */
- 0x18, 0x00, /* ...**....... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x60, 0x00, /* .**......... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 48 0x30 '0' */
- 0x00, 0x00, /* ............ */
- 0x07, 0x00, /* .....***.... */
- 0x0f, 0x80, /* ....*****... */
- 0x11, 0x80, /* ...*...**... */
- 0x10, 0xc0, /* ...*....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0x80, /* ..**....*... */
- 0x18, 0x80, /* ...**...*... */
- 0x1f, 0x00, /* ...*****.... */
- 0x0e, 0x00, /* ....***..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 49 0x31 '1' */
- 0x00, 0x00, /* ............ */
- 0x02, 0x00, /* ......*..... */
- 0x06, 0x00, /* .....**..... */
- 0x0e, 0x00, /* ....***..... */
- 0x1e, 0x00, /* ...****..... */
- 0x36, 0x00, /* ..**.**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 50 0x32 '2' */
- 0x00, 0x00, /* ............ */
- 0x1f, 0x00, /* ...*****.... */
- 0x3f, 0x80, /* ..*******... */
- 0x61, 0xc0, /* .**....***.. */
- 0x40, 0xc0, /* .*......**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x00, /* ...**....... */
- 0x30, 0x20, /* ..**......*. */
- 0x7f, 0xe0, /* .**********. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 51 0x33 '3' */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x1f, 0xc0, /* ...*******.. */
- 0x20, 0xe0, /* ..*.....***. */
- 0x40, 0x60, /* .*.......**. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0xe0, /* ........***. */
- 0x07, 0xc0, /* .....*****.. */
- 0x0f, 0xc0, /* ....******.. */
- 0x00, 0xe0, /* ........***. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x60, /* .........**. */
- 0x40, 0x60, /* .*.......**. */
- 0x60, 0x40, /* .**......*.. */
- 0x3f, 0x80, /* ..*******... */
- 0x1f, 0x00, /* ...*****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 52 0x34 '4' */
- 0x00, 0x00, /* ............ */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x80, /* ......***... */
- 0x03, 0x80, /* ......***... */
- 0x05, 0x80, /* .....*.**... */
- 0x05, 0x80, /* .....*.**... */
- 0x09, 0x80, /* ....*..**... */
- 0x09, 0x80, /* ....*..**... */
- 0x11, 0x80, /* ...*...**... */
- 0x11, 0x80, /* ...*...**... */
- 0x21, 0x80, /* ..*....**... */
- 0x3f, 0xe0, /* ..*********. */
- 0x7f, 0xe0, /* .**********. */
- 0x01, 0x80, /* .......**... */
- 0x01, 0x80, /* .......**... */
- 0x01, 0x80, /* .......**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 53 0x35 '5' */
- 0x00, 0x00, /* ............ */
- 0x0f, 0xc0, /* ....******.. */
- 0x0f, 0xc0, /* ....******.. */
- 0x10, 0x00, /* ...*........ */
- 0x10, 0x00, /* ...*........ */
- 0x20, 0x00, /* ..*......... */
- 0x3f, 0x80, /* ..*******... */
- 0x31, 0xc0, /* ..**...***.. */
- 0x00, 0xe0, /* ........***. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x60, /* .........**. */
- 0x40, 0x60, /* .*.......**. */
- 0x60, 0x60, /* .**......**. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 54 0x36 '6' */
- 0x00, 0x00, /* ............ */
- 0x07, 0x00, /* .....***.... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x00, /* ...**....... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x60, 0x00, /* .**......... */
- 0x67, 0x80, /* .**..****... */
- 0x6f, 0xc0, /* .**.******.. */
- 0x70, 0xe0, /* .***....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0x40, /* .***.....*.. */
- 0x3f, 0x80, /* ..*******... */
- 0x1f, 0x00, /* ...*****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 55 0x37 '7' */
- 0x00, 0x00, /* ............ */
- 0x1f, 0xe0, /* ...********. */
- 0x3f, 0xe0, /* ..*********. */
- 0x60, 0x40, /* .**......*.. */
- 0x00, 0x40, /* .........*.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0x80, /* ........*... */
- 0x00, 0x80, /* ........*... */
- 0x01, 0x80, /* .......**... */
- 0x01, 0x00, /* .......*.... */
- 0x01, 0x00, /* .......*.... */
- 0x03, 0x00, /* ......**.... */
- 0x02, 0x00, /* ......*..... */
- 0x02, 0x00, /* ......*..... */
- 0x06, 0x00, /* .....**..... */
- 0x04, 0x00, /* .....*...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 56 0x38 '8' */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x11, 0x80, /* ...*...**... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x18, 0x80, /* ...**...*... */
- 0x0d, 0x00, /* ....**.*.... */
- 0x06, 0x00, /* .....**..... */
- 0x0b, 0x00, /* ....*.**.... */
- 0x11, 0x80, /* ...*...**... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x18, 0x80, /* ...**...*... */
- 0x0f, 0x00, /* ....****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 57 0x39 '9' */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xe0, /* ..*.....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0xe0, /* .***....***. */
- 0x3f, 0x60, /* ..******.**. */
- 0x1e, 0x60, /* ...****..**. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x01, 0x80, /* .......**... */
- 0x07, 0x00, /* .....***.... */
- 0x3c, 0x00, /* ..****...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 58 0x3a ':' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x1e, 0x00, /* ...****..... */
- 0x1e, 0x00, /* ...****..... */
- 0x0c, 0x00, /* ....**...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x1e, 0x00, /* ...****..... */
- 0x1e, 0x00, /* ...****..... */
- 0x0c, 0x00, /* ....**...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 59 0x3b ';' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x1e, 0x00, /* ...****..... */
- 0x1e, 0x00, /* ...****..... */
- 0x0c, 0x00, /* ....**...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x1e, 0x00, /* ...****..... */
- 0x1e, 0x00, /* ...****..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x00, /* ...**....... */
- 0x10, 0x00, /* ...*........ */
- 0x00, 0x00, /* ............ */
-
- /* 60 0x3c '<' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x60, /* .........**. */
- 0x01, 0xc0, /* .......***.. */
- 0x07, 0x00, /* .....***.... */
- 0x1c, 0x00, /* ...***...... */
- 0x70, 0x00, /* .***........ */
- 0x70, 0x00, /* .***........ */
- 0x1c, 0x00, /* ...***...... */
- 0x07, 0x00, /* .....***.... */
- 0x01, 0xc0, /* .......***.. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 61 0x3d '=' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x7f, 0xe0, /* .**********. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x7f, 0xe0, /* .**********. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 62 0x3e '>' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x60, 0x00, /* .**......... */
- 0x38, 0x00, /* ..***....... */
- 0x0e, 0x00, /* ....***..... */
- 0x03, 0x80, /* ......***... */
- 0x00, 0xe0, /* ........***. */
- 0x00, 0xe0, /* ........***. */
- 0x03, 0x80, /* ......***... */
- 0x0e, 0x00, /* ....***..... */
- 0x38, 0x00, /* ..***....... */
- 0x60, 0x00, /* .**......... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 63 0x3f '?' */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x1f, 0x80, /* ...******... */
- 0x39, 0xc0, /* ..***..***.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 64 0x40 '@' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x3f, 0xc0, /* ..********.. */
- 0x30, 0x60, /* ..**.....**. */
- 0x60, 0x60, /* .**......**. */
- 0x67, 0x20, /* .**..***..*. */
- 0x6f, 0xa0, /* .**.*****.*. */
- 0x6c, 0xa0, /* .**.**..*.*. */
- 0x6c, 0xa0, /* .**.**..*.*. */
- 0x67, 0xe0, /* .**..******. */
- 0x60, 0x00, /* .**......... */
- 0x30, 0x00, /* ..**........ */
- 0x3f, 0xe0, /* ..*********. */
- 0x0f, 0xe0, /* ....*******. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 65 0x41 'A' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0b, 0x00, /* ....*.**.... */
- 0x0b, 0x00, /* ....*.**.... */
- 0x09, 0x00, /* ....*..*.... */
- 0x11, 0x80, /* ...*...**... */
- 0x11, 0x80, /* ...*...**... */
- 0x10, 0x80, /* ...*....*... */
- 0x3f, 0xc0, /* ..********.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x20, 0x40, /* ..*......*.. */
- 0x40, 0x60, /* .*.......**. */
- 0x40, 0x60, /* .*.......**. */
- 0xe0, 0xf0, /* ***.....**** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 66 0x42 'B' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0x00, /* ********.... */
- 0x60, 0x80, /* .**.....*... */
- 0x60, 0xc0, /* .**.....**.. */
- 0x60, 0xc0, /* .**.....**.. */
- 0x60, 0xc0, /* .**.....**.. */
- 0x61, 0x80, /* .**....**... */
- 0x7f, 0x80, /* .********... */
- 0x60, 0xc0, /* .**.....**.. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0xc0, /* .**.....**.. */
- 0xff, 0x80, /* *********... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 67 0x43 'C' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0xc0, /* ....******.. */
- 0x10, 0x60, /* ...*.....**. */
- 0x20, 0x20, /* ..*.......*. */
- 0x20, 0x00, /* ..*......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x20, 0x00, /* ..*......... */
- 0x30, 0x20, /* ..**......*. */
- 0x18, 0x40, /* ...**....*.. */
- 0x0f, 0x80, /* ....*****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 68 0x44 'D' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0x00, /* ********.... */
- 0x61, 0xc0, /* .**....***.. */
- 0x60, 0xc0, /* .**.....**.. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x40, /* .**......*.. */
- 0x61, 0x80, /* .**....**... */
- 0xfe, 0x00, /* *******..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 69 0x45 'E' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x7f, 0xc0, /* .*********.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x80, /* ..**....*... */
- 0x3f, 0x80, /* ..*******... */
- 0x30, 0x80, /* ..**....*... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x20, /* ..**......*. */
- 0x30, 0x20, /* ..**......*. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 70 0x46 'F' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x7f, 0xc0, /* .*********.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x80, /* ..**....*... */
- 0x3f, 0x80, /* ..*******... */
- 0x30, 0x80, /* ..**....*... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x78, 0x00, /* .****....... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 71 0x47 'G' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0xc0, /* ....******.. */
- 0x10, 0x60, /* ...*.....**. */
- 0x20, 0x20, /* ..*.......*. */
- 0x20, 0x00, /* ..*......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x61, 0xf0, /* .**....***** */
- 0x60, 0x60, /* .**......**. */
- 0x20, 0x60, /* ..*......**. */
- 0x30, 0x60, /* ..**.....**. */
- 0x18, 0x60, /* ...**....**. */
- 0x0f, 0x80, /* ....*****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 72 0x48 'H' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xf0, 0xf0, /* ****....**** */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x7f, 0xe0, /* .**********. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0xf0, 0xf0, /* ****....**** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 73 0x49 'I' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0x80, /* ...******... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 74 0x4a 'J' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0x80, /* ...******... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x04, 0x00, /* .....*...... */
- 0x38, 0x00, /* ..***....... */
- 0x30, 0x00, /* ..**........ */
- 0x00, 0x00, /* ............ */
-
- /* 75 0x4b 'K' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xf0, 0xe0, /* ****....***. */
- 0x61, 0x80, /* .**....**... */
- 0x63, 0x00, /* .**...**.... */
- 0x66, 0x00, /* .**..**..... */
- 0x6c, 0x00, /* .**.**...... */
- 0x78, 0x00, /* .****....... */
- 0x78, 0x00, /* .****....... */
- 0x7c, 0x00, /* .*****...... */
- 0x6e, 0x00, /* .**.***..... */
- 0x67, 0x00, /* .**..***.... */
- 0x63, 0x80, /* .**...***... */
- 0x61, 0xc0, /* .**....***.. */
- 0x60, 0xe0, /* .**.....***. */
- 0xf0, 0x70, /* ****.....*** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 76 0x4c 'L' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x78, 0x00, /* .****....... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x20, /* ..**......*. */
- 0x30, 0x20, /* ..**......*. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 77 0x4d 'M' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xe0, 0x70, /* ***......*** */
- 0x60, 0xe0, /* .**.....***. */
- 0x70, 0xe0, /* .***....***. */
- 0x70, 0xe0, /* .***....***. */
- 0x70, 0xe0, /* .***....***. */
- 0x59, 0x60, /* .*.**..*.**. */
- 0x59, 0x60, /* .*.**..*.**. */
- 0x59, 0x60, /* .*.**..*.**. */
- 0x4d, 0x60, /* .*..**.*.**. */
- 0x4e, 0x60, /* .*..***..**. */
- 0x4e, 0x60, /* .*..***..**. */
- 0x44, 0x60, /* .*...*...**. */
- 0x44, 0x60, /* .*...*...**. */
- 0xe4, 0xf0, /* ***..*..**** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 78 0x4e 'N' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xc0, 0x70, /* **.......*** */
- 0x60, 0x20, /* .**.......*. */
- 0x70, 0x20, /* .***......*. */
- 0x78, 0x20, /* .****.....*. */
- 0x58, 0x20, /* .*.**.....*. */
- 0x4c, 0x20, /* .*..**....*. */
- 0x46, 0x20, /* .*...**...*. */
- 0x47, 0x20, /* .*...***..*. */
- 0x43, 0x20, /* .*....**..*. */
- 0x41, 0xa0, /* .*.....**.*. */
- 0x40, 0xe0, /* .*......***. */
- 0x40, 0xe0, /* .*......***. */
- 0x40, 0x60, /* .*.......**. */
- 0xe0, 0x30, /* ***.......** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 79 0x4f 'O' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x20, 0x60, /* ..*......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x20, 0x40, /* ..*......*.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x18, 0x80, /* ...**...*... */
- 0x0f, 0x00, /* ....****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 80 0x50 'P' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x7f, 0x80, /* .********... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0x60, /* ..**.....**. */
- 0x30, 0x60, /* ..**.....**. */
- 0x30, 0x60, /* ..**.....**. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x37, 0x80, /* ..**.****... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x78, 0x00, /* .****....... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 81 0x51 'Q' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x20, 0x60, /* ..*......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x38, 0x40, /* ..***....*.. */
- 0x1f, 0x80, /* ...******... */
- 0x0e, 0x00, /* ....***..... */
- 0x1f, 0x00, /* ...*****.... */
- 0x23, 0x90, /* ..*...***..* */
- 0x01, 0xe0, /* .......****. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 82 0x52 'R' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0x00, /* ********.... */
- 0x61, 0x80, /* .**....**... */
- 0x60, 0xc0, /* .**.....**.. */
- 0x60, 0xc0, /* .**.....**.. */
- 0x60, 0xc0, /* .**.....**.. */
- 0x60, 0x80, /* .**.....*... */
- 0x7f, 0x00, /* .*******.... */
- 0x7c, 0x00, /* .*****...... */
- 0x6e, 0x00, /* .**.***..... */
- 0x67, 0x00, /* .**..***.... */
- 0x63, 0x80, /* .**...***... */
- 0x61, 0xc0, /* .**....***.. */
- 0x60, 0xe0, /* .**.....***. */
- 0xf0, 0x70, /* ****.....*** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 83 0x53 'S' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0xe0, /* ...********. */
- 0x30, 0x60, /* ..**.....**. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x70, 0x00, /* .***........ */
- 0x3c, 0x00, /* ..****...... */
- 0x1e, 0x00, /* ...****..... */
- 0x07, 0x80, /* .....****... */
- 0x01, 0xc0, /* .......***.. */
- 0x00, 0xe0, /* ........***. */
- 0x40, 0x60, /* .*.......**. */
- 0x40, 0x60, /* .*.......**. */
- 0x60, 0xc0, /* .**.....**.. */
- 0x7f, 0x80, /* .********... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 84 0x54 'T' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x7f, 0xe0, /* .**********. */
- 0x46, 0x20, /* .*...**...*. */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 85 0x55 'U' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xf0, 0x70, /* ****.....*** */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x70, 0x40, /* .***.....*.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 86 0x56 'V' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xe0, 0xe0, /* ***.....***. */
- 0x60, 0x40, /* .**......*.. */
- 0x30, 0x80, /* ..**....*... */
- 0x30, 0x80, /* ..**....*... */
- 0x30, 0x80, /* ..**....*... */
- 0x19, 0x00, /* ...**..*.... */
- 0x19, 0x00, /* ...**..*.... */
- 0x19, 0x00, /* ...**..*.... */
- 0x0a, 0x00, /* ....*.*..... */
- 0x0e, 0x00, /* ....***..... */
- 0x0e, 0x00, /* ....***..... */
- 0x04, 0x00, /* .....*...... */
- 0x04, 0x00, /* .....*...... */
- 0x04, 0x00, /* .....*...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 87 0x57 'W' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xfe, 0xf0, /* *******.**** */
- 0x66, 0x20, /* .**..**...*. */
- 0x66, 0x20, /* .**..**...*. */
- 0x66, 0x20, /* .**..**...*. */
- 0x76, 0x20, /* .***.**...*. */
- 0x77, 0x40, /* .***.***.*.. */
- 0x33, 0x40, /* ..**..**.*.. */
- 0x37, 0x40, /* ..**.***.*.. */
- 0x3b, 0xc0, /* ..***.****.. */
- 0x3b, 0x80, /* ..***.***... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 88 0x58 'X' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xf0, 0x70, /* ****.....*** */
- 0x60, 0x20, /* .**.......*. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x38, 0x80, /* ..***...*... */
- 0x18, 0x80, /* ...**...*... */
- 0x0d, 0x00, /* ....**.*.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0b, 0x00, /* ....*.**.... */
- 0x11, 0x80, /* ...*...**... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x40, 0x60, /* .*.......**. */
- 0xe0, 0xf0, /* ***.....**** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 89 0x59 'Y' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xf0, 0x70, /* ****.....*** */
- 0x60, 0x20, /* .**.......*. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x18, 0x80, /* ...**...*... */
- 0x18, 0x80, /* ...**...*... */
- 0x0d, 0x00, /* ....**.*.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0f, 0x00, /* ....****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 90 0x5a 'Z' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xe0, /* ..*********. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x01, 0x80, /* .......**... */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x00, /* ...**....... */
- 0x18, 0x20, /* ...**.....*. */
- 0x3f, 0xe0, /* ..*********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 91 0x5b '[' */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x0f, 0x80, /* ....*****... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0f, 0x80, /* ....*****... */
- 0x0f, 0x80, /* ....*****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 92 0x5c '\' */
- 0x00, 0x00, /* ............ */
- 0x60, 0x00, /* .**......... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x18, 0x00, /* ...**....... */
- 0x18, 0x00, /* ...**....... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x01, 0x80, /* .......**... */
- 0x01, 0x80, /* .......**... */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 93 0x5d ']' */
- 0x00, 0x00, /* ............ */
- 0x1f, 0x00, /* ...*****.... */
- 0x1f, 0x00, /* ...*****.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x1f, 0x00, /* ...*****.... */
- 0x1f, 0x00, /* ...*****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 94 0x5e '^' */
- 0x00, 0x00, /* ............ */
- 0x04, 0x00, /* .....*...... */
- 0x0e, 0x00, /* ....***..... */
- 0x1b, 0x00, /* ...**.**.... */
- 0x31, 0x80, /* ..**...**... */
- 0x60, 0xc0, /* .**.....**.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 95 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, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 96 0x60 '`' */
- 0x00, 0x00, /* ............ */
- 0x01, 0x00, /* .......*.... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x07, 0x80, /* .....****... */
- 0x07, 0x80, /* .....****... */
- 0x03, 0x00, /* ......**.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 97 0x61 'a' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x10, 0xc0, /* ...*....**.. */
- 0x03, 0xc0, /* ......****.. */
- 0x1c, 0xc0, /* ...***..**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0xe0, /* ...****.***. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 98 0x62 'b' */
- 0x00, 0x00, /* ............ */
- 0x20, 0x00, /* ..*......... */
- 0x60, 0x00, /* .**......... */
- 0xe0, 0x00, /* ***......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x67, 0x80, /* .**..****... */
- 0x6f, 0xc0, /* .**.******.. */
- 0x70, 0xe0, /* .***....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0x60, /* .***.....**. */
- 0x78, 0xc0, /* .****...**.. */
- 0x4f, 0x80, /* .*..*****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 99 0x63 'c' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0x80, /* ...******... */
- 0x31, 0xc0, /* ..**...***.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x70, 0x40, /* .***.....*.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 100 0x64 'd' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x60, /* .........**. */
- 0x00, 0xe0, /* ........***. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x60, /* .........**. */
- 0x0f, 0x60, /* ....****.**. */
- 0x31, 0xe0, /* ..**...****. */
- 0x20, 0xe0, /* ..*.....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0xe0, /* .***....***. */
- 0x39, 0x60, /* ..***..*.**. */
- 0x1e, 0x70, /* ...****..*** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 101 0x65 'e' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x7f, 0xe0, /* .**********. */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x30, 0x00, /* ..**........ */
- 0x18, 0x60, /* ...**....**. */
- 0x0f, 0x80, /* ....*****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 102 0x66 'f' */
- 0x00, 0x00, /* ............ */
- 0x03, 0x80, /* ......***... */
- 0x04, 0xc0, /* .....*..**.. */
- 0x04, 0xc0, /* .....*..**.. */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x3f, 0x80, /* ..*******... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x1e, 0x00, /* ...****..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 103 0x67 'g' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0x20, /* ...*****..*. */
- 0x31, 0xe0, /* ..**...****. */
- 0x60, 0xc0, /* .**.....**.. */
- 0x60, 0xc0, /* .**.....**.. */
- 0x60, 0xc0, /* .**.....**.. */
- 0x31, 0x80, /* ..**...**... */
- 0x3f, 0x00, /* ..******.... */
- 0x60, 0x00, /* .**......... */
- 0x7f, 0xc0, /* .*********.. */
- 0x3f, 0xe0, /* ..*********. */
- 0x20, 0x60, /* ..*......**. */
- 0x40, 0x20, /* .*........*. */
- 0x40, 0x20, /* .*........*. */
- 0x7f, 0xc0, /* .*********.. */
- 0x3f, 0x80, /* ..*******... */
- 0x00, 0x00, /* ............ */
-
- /* 104 0x68 'h' */
- 0x00, 0x00, /* ............ */
- 0x10, 0x00, /* ...*........ */
- 0x30, 0x00, /* ..**........ */
- 0x70, 0x00, /* .***........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x37, 0x80, /* ..**.****... */
- 0x39, 0xc0, /* ..***..***.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x79, 0xe0, /* .****..****. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 105 0x69 'i' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1e, 0x00, /* ...****..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 106 0x6a 'j' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x03, 0xc0, /* ......****.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x38, 0x80, /* ..***...*... */
- 0x1f, 0x00, /* ...*****.... */
- 0x0e, 0x00, /* ....***..... */
- 0x00, 0x00, /* ............ */
-
- /* 107 0x6b 'k' */
- 0x00, 0x00, /* ............ */
- 0x60, 0x00, /* .**......... */
- 0xe0, 0x00, /* ***......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x61, 0xc0, /* .**....***.. */
- 0x63, 0x00, /* .**...**.... */
- 0x66, 0x00, /* .**..**..... */
- 0x7c, 0x00, /* .*****...... */
- 0x78, 0x00, /* .****....... */
- 0x7c, 0x00, /* .*****...... */
- 0x6e, 0x00, /* .**.***..... */
- 0x67, 0x00, /* .**..***.... */
- 0x63, 0x80, /* .**...***... */
- 0xf1, 0xe0, /* ****...****. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 108 0x6c 'l' */
- 0x00, 0x00, /* ............ */
- 0x1e, 0x00, /* ...****..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 109 0x6d 'm' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xdd, 0xc0, /* **.***.***.. */
- 0x6e, 0xe0, /* .**.***.***. */
- 0x66, 0x60, /* .**..**..**. */
- 0x66, 0x60, /* .**..**..**. */
- 0x66, 0x60, /* .**..**..**. */
- 0x66, 0x60, /* .**..**..**. */
- 0x66, 0x60, /* .**..**..**. */
- 0x66, 0x60, /* .**..**..**. */
- 0x66, 0x60, /* .**..**..**. */
- 0xef, 0x70, /* ***.****.*** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 110 0x6e 'n' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x27, 0x80, /* ..*..****... */
- 0x79, 0xc0, /* .****..***.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x79, 0xe0, /* .****..****. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 111 0x6f 'o' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xe0, /* ..*.....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0x40, /* .***.....*.. */
- 0x38, 0x80, /* ..***...*... */
- 0x1f, 0x00, /* ...*****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 112 0x70 'p' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xef, 0x80, /* ***.*****... */
- 0x71, 0xc0, /* .***...***.. */
- 0x60, 0xe0, /* .**.....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x40, /* .**......*.. */
- 0x70, 0x80, /* .***....*... */
- 0x7f, 0x00, /* .*******.... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0xf0, 0x00, /* ****........ */
- 0x00, 0x00, /* ............ */
-
- /* 113 0x71 'q' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x20, /* ....****..*. */
- 0x11, 0xe0, /* ...*...****. */
- 0x20, 0xe0, /* ..*.....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0x60, /* .***.....**. */
- 0x38, 0xe0, /* ..***...***. */
- 0x1f, 0xe0, /* ...********. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0x60, /* .........**. */
- 0x00, 0xf0, /* ........**** */
- 0x00, 0x00, /* ............ */
-
- /* 114 0x72 'r' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x73, 0x80, /* .***..***... */
- 0x34, 0xc0, /* ..**.*..**.. */
- 0x38, 0xc0, /* ..***...**.. */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x78, 0x00, /* .****....... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 115 0x73 's' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0xc0, /* ...*******.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x38, 0x00, /* ..***....... */
- 0x1e, 0x00, /* ...****..... */
- 0x07, 0x80, /* .....****... */
- 0x01, 0xc0, /* .......***.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x3f, 0x80, /* ..*******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 116 0x74 't' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x04, 0x00, /* .....*...... */
- 0x04, 0x00, /* .....*...... */
- 0x0c, 0x00, /* ....**...... */
- 0x7f, 0xc0, /* .*********.. */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x00, /* ....**...... */
- 0x0c, 0x20, /* ....**....*. */
- 0x0e, 0x40, /* ....***..*.. */
- 0x07, 0x80, /* .....****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 117 0x75 'u' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x79, 0xe0, /* .****..****. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0x60, /* ...****..**. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 118 0x76 'v' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xf0, 0x70, /* ****.....*** */
- 0x60, 0x20, /* .**.......*. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x18, 0x80, /* ...**...*... */
- 0x18, 0x80, /* ...**...*... */
- 0x0d, 0x00, /* ....**.*.... */
- 0x0d, 0x00, /* ....**.*.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 119 0x77 'w' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0x70, /* ********.*** */
- 0x66, 0x20, /* .**..**...*. */
- 0x66, 0x20, /* .**..**...*. */
- 0x66, 0x20, /* .**..**...*. */
- 0x37, 0x40, /* ..**.***.*.. */
- 0x3b, 0x40, /* ..***.**.*.. */
- 0x3b, 0x40, /* ..***.**.*.. */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 120 0x78 'x' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xf8, 0xf0, /* *****...**** */
- 0x70, 0x40, /* .***.....*.. */
- 0x38, 0x80, /* ..***...*... */
- 0x1d, 0x00, /* ...***.*.... */
- 0x0e, 0x00, /* ....***..... */
- 0x07, 0x00, /* .....***.... */
- 0x0b, 0x80, /* ....*.***... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xe0, /* ..*.....***. */
- 0xf1, 0xf0, /* ****...***** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 121 0x79 'y' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xf0, 0xf0, /* ****....**** */
- 0x60, 0x20, /* .**.......*. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x18, 0x80, /* ...**...*... */
- 0x18, 0x80, /* ...**...*... */
- 0x0d, 0x00, /* ....**.*.... */
- 0x0d, 0x00, /* ....**.*.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x04, 0x00, /* .....*...... */
- 0x0c, 0x00, /* ....**...... */
- 0x08, 0x00, /* ....*....... */
- 0x78, 0x00, /* .****....... */
- 0x70, 0x00, /* .***........ */
- 0x00, 0x00, /* ............ */
-
- /* 122 0x7a 'z' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x7f, 0xe0, /* .**********. */
- 0x60, 0xe0, /* .**.....***. */
- 0x41, 0xc0, /* .*.....***.. */
- 0x03, 0x80, /* ......***... */
- 0x07, 0x00, /* .....***.... */
- 0x0e, 0x00, /* ....***..... */
- 0x1c, 0x00, /* ...***...... */
- 0x38, 0x20, /* ..***.....*. */
- 0x70, 0x60, /* .***.....**. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 123 0x7b '{' */
- 0x00, 0x00, /* ............ */
- 0x03, 0x80, /* ......***... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x38, 0x00, /* ..***....... */
- 0x0c, 0x00, /* ....**...... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x80, /* ......***... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 124 0x7c '|' */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
-
- /* 125 0x7d '}' */
- 0x00, 0x00, /* ............ */
- 0x1c, 0x00, /* ...***...... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x00, /* ......**.... */
- 0x01, 0xc0, /* .......***.. */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1c, 0x00, /* ...***...... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 126 0x7e '~' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1c, 0x20, /* ...***....*. */
- 0x3e, 0x60, /* ..*****..**. */
- 0x67, 0xc0, /* .**..*****.. */
- 0x43, 0x80, /* .*....***... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 127 0x7f '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 128 0x80 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0xc0, /* ....******.. */
- 0x10, 0x60, /* ...*.....**. */
- 0x20, 0x20, /* ..*.......*. */
- 0x20, 0x00, /* ..*......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x20, 0x00, /* ..*......... */
- 0x30, 0x20, /* ..**......*. */
- 0x18, 0x40, /* ...**....*.. */
- 0x0f, 0x80, /* ....*****... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x00, /* ......**.... */
- 0x01, 0x80, /* .......**... */
- 0x0f, 0x00, /* ....****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 129 0x81 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x79, 0xe0, /* .****..****. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0x60, /* ...****..**. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 130 0x82 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x7f, 0xe0, /* .**********. */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x30, 0x00, /* ..**........ */
- 0x18, 0x60, /* ...**....**. */
- 0x0f, 0x80, /* ....*****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 131 0x83 '.' */
- 0x00, 0x00, /* ............ */
- 0x02, 0x00, /* ......*..... */
- 0x07, 0x00, /* .....***.... */
- 0x0d, 0x80, /* ....**.**... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x10, 0xc0, /* ...*....**.. */
- 0x03, 0xc0, /* ......****.. */
- 0x1c, 0xc0, /* ...***..**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0xe0, /* ...****.***. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 132 0x84 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x10, 0xc0, /* ...*....**.. */
- 0x03, 0xc0, /* ......****.. */
- 0x1c, 0xc0, /* ...***..**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0xe0, /* ...****.***. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 133 0x85 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x00, /* ......**.... */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x10, 0xc0, /* ...*....**.. */
- 0x03, 0xc0, /* ......****.. */
- 0x1c, 0xc0, /* ...***..**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0xe0, /* ...****.***. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 134 0x86 '.' */
- 0x00, 0x00, /* ............ */
- 0x07, 0x00, /* .....***.... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x07, 0x00, /* .....***.... */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x10, 0xc0, /* ...*....**.. */
- 0x03, 0xc0, /* ......****.. */
- 0x1c, 0xc0, /* ...***..**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0xe0, /* ...****.***. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 135 0x87 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0x80, /* ...******... */
- 0x31, 0xc0, /* ..**...***.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x70, 0x40, /* .***.....*.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x1f, 0x80, /* ...******... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x00, /* ......**.... */
- 0x01, 0x80, /* .......**... */
- 0x0f, 0x00, /* ....****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 136 0x88 '.' */
- 0x00, 0x00, /* ............ */
- 0x02, 0x00, /* ......*..... */
- 0x07, 0x00, /* .....***.... */
- 0x0d, 0x80, /* ....**.**... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x7f, 0xe0, /* .**********. */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x30, 0x00, /* ..**........ */
- 0x18, 0x60, /* ...**....**. */
- 0x0f, 0x80, /* ....*****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 137 0x89 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x7f, 0xe0, /* .**********. */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x30, 0x00, /* ..**........ */
- 0x18, 0x60, /* ...**....**. */
- 0x0f, 0x80, /* ....*****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 138 0x8a '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x00, /* ......**.... */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x7f, 0xe0, /* .**********. */
- 0x60, 0x00, /* .**......... */
- 0x60, 0x00, /* .**......... */
- 0x30, 0x00, /* ..**........ */
- 0x18, 0x60, /* ...**....**. */
- 0x0f, 0x80, /* ....*****... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 139 0x8b '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1e, 0x00, /* ...****..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 140 0x8c '.' */
- 0x00, 0x00, /* ............ */
- 0x04, 0x00, /* .....*...... */
- 0x0e, 0x00, /* ....***..... */
- 0x1b, 0x00, /* ...**.**.... */
- 0x31, 0x80, /* ..**...**... */
- 0x00, 0x00, /* ............ */
- 0x1e, 0x00, /* ...****..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 141 0x8d '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x18, 0x00, /* ...**....... */
- 0x0c, 0x00, /* ....**...... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x1e, 0x00, /* ...****..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 142 0x8e '.' */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x04, 0x00, /* .....*...... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0b, 0x00, /* ....*.**.... */
- 0x0b, 0x00, /* ....*.**.... */
- 0x19, 0x80, /* ...**..**... */
- 0x11, 0x80, /* ...*...**... */
- 0x3f, 0xc0, /* ..********.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x60, 0x60, /* .**......**. */
- 0x40, 0x60, /* .*.......**. */
- 0xe0, 0xf0, /* ***.....**** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 143 0x8f '.' */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x19, 0x80, /* ...**..**... */
- 0x0f, 0x00, /* ....****.... */
- 0x04, 0x00, /* .....*...... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x0b, 0x00, /* ....*.**.... */
- 0x0b, 0x00, /* ....*.**.... */
- 0x19, 0x80, /* ...**..**... */
- 0x11, 0x80, /* ...*...**... */
- 0x3f, 0xc0, /* ..********.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x60, 0x60, /* .**......**. */
- 0x40, 0x60, /* .*.......**. */
- 0xe0, 0xf0, /* ***.....**** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 144 0x90 '.' */
- 0x00, 0x00, /* ............ */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x08, 0x00, /* ....*....... */
- 0x7f, 0xe0, /* .**********. */
- 0x30, 0x20, /* ..**......*. */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x80, /* ..**....*... */
- 0x3f, 0x80, /* ..*******... */
- 0x30, 0x80, /* ..**....*... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x20, /* ..**......*. */
- 0x30, 0x20, /* ..**......*. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 145 0x91 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3d, 0xe0, /* ..****.****. */
- 0x66, 0x30, /* .**..**...** */
- 0x46, 0x30, /* .*...**...** */
- 0x06, 0x30, /* .....**...** */
- 0x3f, 0xf0, /* ..********** */
- 0x66, 0x00, /* .**..**..... */
- 0xc6, 0x00, /* **...**..... */
- 0xc6, 0x00, /* **...**..... */
- 0xe7, 0x30, /* ***..***..** */
- 0x7d, 0xe0, /* .*****.****. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 146 0x92 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x03, 0xf0, /* ......****** */
- 0x07, 0x10, /* .....***...* */
- 0x07, 0x10, /* .....***...* */
- 0x0b, 0x00, /* ....*.**.... */
- 0x0b, 0x00, /* ....*.**.... */
- 0x0b, 0x20, /* ....*.**..*. */
- 0x13, 0xe0, /* ...*..*****. */
- 0x13, 0x20, /* ...*..**..*. */
- 0x3f, 0x00, /* ..******.... */
- 0x23, 0x00, /* ..*...**.... */
- 0x23, 0x00, /* ..*...**.... */
- 0x43, 0x10, /* .*....**...* */
- 0x43, 0x10, /* .*....**...* */
- 0xe7, 0xf0, /* ***..******* */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 147 0x93 '.' */
- 0x00, 0x00, /* ............ */
- 0x02, 0x00, /* ......*..... */
- 0x07, 0x00, /* .....***.... */
- 0x0d, 0x80, /* ....**.**... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xe0, /* ..*.....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0x40, /* .***.....*.. */
- 0x38, 0x80, /* ..***...*... */
- 0x1f, 0x00, /* ...*****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 148 0x94 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xe0, /* ..*.....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0x40, /* .***.....*.. */
- 0x38, 0x80, /* ..***...*... */
- 0x1f, 0x00, /* ...*****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 149 0x95 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0c, 0x00, /* ....**...... */
- 0x06, 0x00, /* .....**..... */
- 0x03, 0x00, /* ......**.... */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xe0, /* ..*.....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0x40, /* .***.....*.. */
- 0x38, 0x80, /* ..***...*... */
- 0x1f, 0x00, /* ...*****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 150 0x96 '.' */
- 0x00, 0x00, /* ............ */
- 0x02, 0x00, /* ......*..... */
- 0x07, 0x00, /* .....***.... */
- 0x0d, 0x80, /* ....**.**... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x00, 0x00, /* ............ */
- 0x79, 0xe0, /* .****..****. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0x60, /* ...****..**. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 151 0x97 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x18, 0x00, /* ...**....... */
- 0x0c, 0x00, /* ....**...... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x79, 0xe0, /* .****..****. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0x60, /* ...****..**. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 152 0x98 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xf0, 0xf0, /* ****....**** */
- 0x60, 0x20, /* .**.......*. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x18, 0x80, /* ...**...*... */
- 0x18, 0x80, /* ...**...*... */
- 0x0d, 0x00, /* ....**.*.... */
- 0x0d, 0x00, /* ....**.*.... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x04, 0x00, /* .....*...... */
- 0x0c, 0x00, /* ....**...... */
- 0x08, 0x00, /* ....*....... */
- 0x78, 0x00, /* .****....... */
- 0x70, 0x00, /* .***........ */
- 0x00, 0x00, /* ............ */
-
- /* 153 0x99 '.' */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x20, 0x60, /* ..*......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x20, 0x40, /* ..*......*.. */
- 0x30, 0x40, /* ..**.....*.. */
- 0x18, 0x80, /* ...**...*... */
- 0x0f, 0x00, /* ....****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 154 0x9a '.' */
- 0x00, 0x00, /* ............ */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0xe0, 0x30, /* ***.......** */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x60, 0x20, /* .**.......*. */
- 0x70, 0x40, /* .***.....*.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 155 0x9b '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x36, 0xc0, /* ..**.**.**.. */
- 0x26, 0xc0, /* ..*..**.**.. */
- 0x66, 0x00, /* .**..**..... */
- 0x66, 0x00, /* .**..**..... */
- 0x66, 0x00, /* .**..**..... */
- 0x66, 0x00, /* .**..**..... */
- 0x76, 0x40, /* .***.**..*.. */
- 0x36, 0xc0, /* ..**.**.**.. */
- 0x1f, 0x80, /* ...******... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 156 0x9c '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x1c, 0xc0, /* ...***..**.. */
- 0x18, 0xc0, /* ...**...**.. */
- 0x18, 0x00, /* ...**....... */
- 0x18, 0x00, /* ...**....... */
- 0x18, 0x00, /* ...**....... */
- 0x7e, 0x00, /* .******..... */
- 0x7e, 0x00, /* .******..... */
- 0x18, 0x00, /* ...**....... */
- 0x18, 0x00, /* ...**....... */
- 0x18, 0x00, /* ...**....... */
- 0x18, 0x00, /* ...**....... */
- 0x3e, 0x20, /* ..*****...*. */
- 0x7f, 0xe0, /* .**********. */
- 0x61, 0xc0, /* .**....***.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 157 0x9d '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x0f, 0x00, /* ....****.... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 158 0x9e '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 159 0x9f '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 160 0xa0 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x18, 0xc0, /* ...**...**.. */
- 0x10, 0xc0, /* ...*....**.. */
- 0x03, 0xc0, /* ......****.. */
- 0x1c, 0xc0, /* ...***..**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0xe0, /* ...****.***. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 161 0xa1 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x1e, 0x00, /* ...****..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x1f, 0x80, /* ...******... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 162 0xa2 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x80, /* ....*****... */
- 0x11, 0xc0, /* ...*...***.. */
- 0x20, 0xe0, /* ..*.....***. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x60, 0x60, /* .**......**. */
- 0x70, 0x40, /* .***.....*.. */
- 0x38, 0x80, /* ..***...*... */
- 0x1f, 0x00, /* ...*****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 163 0xa3 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x01, 0x80, /* .......**... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x79, 0xe0, /* .****..****. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1e, 0x60, /* ...****..**. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 164 0xa4 '.' */
- 0x00, 0x00, /* ............ */
- 0x1c, 0x40, /* ...***...*.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x23, 0x80, /* ..*...***... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x27, 0x80, /* ..*..****... */
- 0x79, 0xc0, /* .****..***.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x79, 0xe0, /* .****..****. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 165 0xa5 '.' */
- 0x00, 0x00, /* ............ */
- 0x1c, 0x40, /* ...***...*.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x23, 0x80, /* ..*...***... */
- 0xc0, 0x70, /* **.......*** */
- 0x60, 0x20, /* .**.......*. */
- 0x70, 0x20, /* .***......*. */
- 0x78, 0x20, /* .****.....*. */
- 0x5c, 0x20, /* .*.***....*. */
- 0x4e, 0x20, /* .*..***...*. */
- 0x47, 0x20, /* .*...***..*. */
- 0x43, 0xa0, /* .*....***.*. */
- 0x41, 0xe0, /* .*.....****. */
- 0x40, 0xe0, /* .*......***. */
- 0x40, 0x60, /* .*.......**. */
- 0xe0, 0x30, /* ***.......** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 166 0xa6 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x1f, 0x00, /* ...*****.... */
- 0x31, 0x80, /* ..**...**... */
- 0x01, 0x80, /* .......**... */
- 0x07, 0x80, /* .....****... */
- 0x19, 0x80, /* ...**..**... */
- 0x31, 0x80, /* ..**...**... */
- 0x31, 0x80, /* ..**...**... */
- 0x33, 0x80, /* ..**..***... */
- 0x1d, 0xc0, /* ...***.***.. */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 167 0xa7 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x07, 0x00, /* .....***.... */
- 0x19, 0x80, /* ...**..**... */
- 0x10, 0xc0, /* ...*....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0x80, /* ..**....*... */
- 0x19, 0x80, /* ...**..**... */
- 0x0e, 0x00, /* ....***..... */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 168 0xa8 '.' */
- 0x00, 0x00, /* ............ */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x03, 0x00, /* ......**.... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x00, /* ...**....... */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x40, /* ..**.....*.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x1f, 0x80, /* ...******... */
- 0x0f, 0x00, /* ....****.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 169 0xa9 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 170 0xaa '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0xc0, /* ........**.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 171 0xab '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x10, 0x00, /* ...*........ */
- 0x30, 0x00, /* ..**........ */
- 0x10, 0x00, /* ...*........ */
- 0x10, 0x40, /* ...*.....*.. */
- 0x10, 0x80, /* ...*....*... */
- 0x11, 0x00, /* ...*...*.... */
- 0x3a, 0x00, /* ..***.*..... */
- 0x05, 0xc0, /* .....*.***.. */
- 0x0a, 0x20, /* ....*.*...*. */
- 0x10, 0x20, /* ...*......*. */
- 0x20, 0xc0, /* ..*.....**.. */
- 0x41, 0x00, /* .*.....*.... */
- 0x02, 0x00, /* ......*..... */
- 0x03, 0xe0, /* ......*****. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 172 0xac '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x10, 0x00, /* ...*........ */
- 0x30, 0x00, /* ..**........ */
- 0x10, 0x00, /* ...*........ */
- 0x10, 0x40, /* ...*.....*.. */
- 0x10, 0x80, /* ...*....*... */
- 0x11, 0x00, /* ...*...*.... */
- 0x3a, 0x40, /* ..***.*..*.. */
- 0x04, 0xc0, /* .....*..**.. */
- 0x09, 0x40, /* ....*..*.*.. */
- 0x12, 0x40, /* ...*..*..*.. */
- 0x24, 0x40, /* ..*..*...*.. */
- 0x47, 0xe0, /* .*...******. */
- 0x00, 0x40, /* .........*.. */
- 0x00, 0x40, /* .........*.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 173 0xad '.' */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 174 0xae '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x60, /* .....**..**. */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x19, 0x80, /* ...**..**... */
- 0x33, 0x00, /* ..**..**.... */
- 0x66, 0x00, /* .**..**..... */
- 0x33, 0x00, /* ..**..**.... */
- 0x19, 0x80, /* ...**..**... */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x06, 0x60, /* .....**..**. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 175 0xaf '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x66, 0x00, /* .**..**..... */
- 0x33, 0x00, /* ..**..**.... */
- 0x19, 0x80, /* ...**..**... */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x06, 0x60, /* .....**..**. */
- 0x0c, 0xc0, /* ....**..**.. */
- 0x19, 0x80, /* ...**..**... */
- 0x33, 0x00, /* ..**..**.... */
- 0x66, 0x00, /* .**..**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 176 0xb0 '.' */
- 0x0c, 0x30, /* ....**....** */
- 0x08, 0x20, /* ....*.....*. */
- 0x61, 0x80, /* .**....**... */
- 0x20, 0x80, /* ..*.....*... */
- 0x0c, 0x30, /* ....**....** */
- 0x08, 0x20, /* ....*.....*. */
- 0x61, 0x80, /* .**....**... */
- 0x20, 0x80, /* ..*.....*... */
- 0x0c, 0x30, /* ....**....** */
- 0x08, 0x20, /* ....*.....*. */
- 0x61, 0x80, /* .**....**... */
- 0x20, 0x80, /* ..*.....*... */
- 0x0c, 0x30, /* ....**....** */
- 0x08, 0x20, /* ....*.....*. */
- 0x61, 0x80, /* .**....**... */
- 0x20, 0x80, /* ..*.....*... */
- 0x0c, 0x30, /* ....**....** */
- 0x08, 0x20, /* ....*.....*. */
- 0x61, 0x80, /* .**....**... */
- 0x20, 0x80, /* ..*.....*... */
- 0x0c, 0x30, /* ....**....** */
- 0x08, 0x20, /* ....*.....*. */
-
- /* 177 0xb1 '.' */
- 0x77, 0x70, /* .***.***.*** */
- 0x22, 0x20, /* ..*...*...*. */
- 0x88, 0x80, /* *...*...*... */
- 0xdd, 0xd0, /* **.***.***.* */
- 0x88, 0x80, /* *...*...*... */
- 0x22, 0x20, /* ..*...*...*. */
- 0x77, 0x70, /* .***.***.*** */
- 0x22, 0x20, /* ..*...*...*. */
- 0x88, 0x80, /* *...*...*... */
- 0xdd, 0xd0, /* **.***.***.* */
- 0x88, 0x80, /* *...*...*... */
- 0x22, 0x20, /* ..*...*...*. */
- 0x77, 0x70, /* .***.***.*** */
- 0x22, 0x20, /* ..*...*...*. */
- 0x88, 0x80, /* *...*...*... */
- 0xdd, 0xd0, /* **.***.***.* */
- 0x88, 0x80, /* *...*...*... */
- 0x22, 0x20, /* ..*...*...*. */
- 0x77, 0x70, /* .***.***.*** */
- 0x22, 0x20, /* ..*...*...*. */
- 0x88, 0x80, /* *...*...*... */
- 0xdd, 0xd0, /* **.***.***.* */
-
- /* 178 0xb2 '.' */
- 0xf3, 0xc0, /* ****..****.. */
- 0xf7, 0xd0, /* ****.*****.* */
- 0x9e, 0x70, /* *..****..*** */
- 0xdf, 0x70, /* **.*****.*** */
- 0xf3, 0xc0, /* ****..****.. */
- 0xf7, 0xd0, /* ****.*****.* */
- 0x9e, 0x70, /* *..****..*** */
- 0xdf, 0x70, /* **.*****.*** */
- 0xf3, 0xc0, /* ****..****.. */
- 0xf7, 0xd0, /* ****.*****.* */
- 0x9e, 0x70, /* *..****..*** */
- 0xdf, 0x70, /* **.*****.*** */
- 0xf3, 0xc0, /* ****..****.. */
- 0xf7, 0xd0, /* ****.*****.* */
- 0x9e, 0x70, /* *..****..*** */
- 0xdf, 0x70, /* **.*****.*** */
- 0xf3, 0xc0, /* ****..****.. */
- 0xf7, 0xd0, /* ****.*****.* */
- 0x9e, 0x70, /* *..****..*** */
- 0xdf, 0x70, /* **.*****.*** */
- 0xf3, 0xc0, /* ****..****.. */
- 0xf7, 0xd0, /* ****.*****.* */
-
- /* 179 0xb3 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 180 0xb4 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0xfe, 0x00, /* *******..... */
- 0xfe, 0x00, /* *******..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 181 0xb5 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0xfe, 0x00, /* *******..... */
- 0xfe, 0x00, /* *******..... */
- 0x06, 0x00, /* .....**..... */
- 0xfe, 0x00, /* *******..... */
- 0xfe, 0x00, /* *******..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 182 0xb6 '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0xfd, 0x80, /* ******.**... */
- 0xfd, 0x80, /* ******.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 183 0xb7 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0x80, /* *********... */
- 0xff, 0x80, /* *********... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 184 0xb8 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xfe, 0x00, /* *******..... */
- 0xfe, 0x00, /* *******..... */
- 0x06, 0x00, /* .....**..... */
- 0xfe, 0x00, /* *******..... */
- 0xfe, 0x00, /* *******..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 185 0xb9 '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0xfd, 0x80, /* ******.**... */
- 0xfd, 0x80, /* ******.**... */
- 0x01, 0x80, /* .......**... */
- 0xfd, 0x80, /* ******.**... */
- 0xfd, 0x80, /* ******.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 186 0xba '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 187 0xbb '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0x80, /* *********... */
- 0xff, 0x80, /* *********... */
- 0x01, 0x80, /* .......**... */
- 0xfd, 0x80, /* ******.**... */
- 0xfd, 0x80, /* ******.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 188 0xbc '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0xfd, 0x80, /* ******.**... */
- 0xfd, 0x80, /* ******.**... */
- 0x01, 0x80, /* .......**... */
- 0xff, 0x80, /* *********... */
- 0xff, 0x80, /* *********... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 189 0xbd '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0xff, 0x80, /* *********... */
- 0xff, 0x80, /* *********... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 190 0xbe '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0xfe, 0x00, /* *******..... */
- 0xfe, 0x00, /* *******..... */
- 0x06, 0x00, /* .....**..... */
- 0xfe, 0x00, /* *******..... */
- 0xfe, 0x00, /* *******..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 191 0xbf '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xfe, 0x00, /* *******..... */
- 0xfe, 0x00, /* *******..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 192 0xc0 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x07, 0xf0, /* .....******* */
- 0x07, 0xf0, /* .....******* */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 193 0xc1 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 194 0xc2 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 195 0xc3 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x07, 0xf0, /* .....******* */
- 0x07, 0xf0, /* .....******* */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 196 0xc4 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 197 0xc5 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 198 0xc6 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x07, 0xf0, /* .....******* */
- 0x07, 0xf0, /* .....******* */
- 0x06, 0x00, /* .....**..... */
- 0x07, 0xf0, /* .....******* */
- 0x07, 0xf0, /* .....******* */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 199 0xc7 '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 200 0xc8 '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0c, 0x00, /* ....**...... */
- 0x0f, 0xf0, /* ....******** */
- 0x0f, 0xf0, /* ....******** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 201 0xc9 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0xf0, /* ....******** */
- 0x0f, 0xf0, /* ....******** */
- 0x0c, 0x00, /* ....**...... */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 202 0xca '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0xfd, 0xf0, /* ******.***** */
- 0xfd, 0xf0, /* ******.***** */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 203 0xcb '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0xfd, 0xf0, /* ******.***** */
- 0xfd, 0xf0, /* ******.***** */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 204 0xcc '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0c, 0x00, /* ....**...... */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0d, 0xf0, /* ....**.***** */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 205 0xcd '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 206 0xce '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0xfd, 0xf0, /* ******.***** */
- 0xfd, 0xf0, /* ******.***** */
- 0x00, 0x00, /* ............ */
- 0xfd, 0xf0, /* ******.***** */
- 0xfd, 0xf0, /* ******.***** */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 207 0xcf '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 208 0xd0 '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 209 0xd1 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 210 0xd2 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 211 0xd3 '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0f, 0xf0, /* ....******** */
- 0x0f, 0xf0, /* ....******** */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 212 0xd4 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x07, 0xf0, /* .....******* */
- 0x07, 0xf0, /* .....******* */
- 0x06, 0x00, /* .....**..... */
- 0x07, 0xf0, /* .....******* */
- 0x07, 0xf0, /* .....******* */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 213 0xd5 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x07, 0xf0, /* .....******* */
- 0x07, 0xf0, /* .....******* */
- 0x06, 0x00, /* .....**..... */
- 0x07, 0xf0, /* .....******* */
- 0x07, 0xf0, /* .....******* */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 214 0xd6 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0xf0, /* ....******** */
- 0x0f, 0xf0, /* ....******** */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 215 0xd7 '.' */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
- 0x0d, 0x80, /* ....**.**... */
-
- /* 216 0xd8 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x06, 0x00, /* .....**..... */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 217 0xd9 '.' */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0xfe, 0x00, /* *******..... */
- 0xfe, 0x00, /* *******..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 218 0xda '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x07, 0xf0, /* .....******* */
- 0x07, 0xf0, /* .....******* */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
-
- /* 219 0xdb '.' */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
-
- /* 220 0xdc '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
-
- /* 221 0xdd '.' */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
- 0xfc, 0x00, /* ******...... */
-
- /* 222 0xde '.' */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
- 0x03, 0xf0, /* ......****** */
-
- /* 223 0xdf '.' */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0xff, 0xf0, /* ************ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 224 0xe0 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 225 0xe1 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x19, 0x80, /* ...**..**... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x31, 0x80, /* ..**...**... */
- 0x37, 0x80, /* ..**.****... */
- 0x31, 0x80, /* ..**...**... */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x31, 0x80, /* ..**...**... */
- 0x77, 0x00, /* .***.***.... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 226 0xe2 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 227 0xe3 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 228 0xe4 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 229 0xe5 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 230 0xe6 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x30, 0xc0, /* ..**....**.. */
- 0x39, 0xc0, /* ..***..***.. */
- 0x36, 0xe0, /* ..**.**.***. */
- 0x30, 0x00, /* ..**........ */
- 0x30, 0x00, /* ..**........ */
- 0x60, 0x00, /* .**......... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 231 0xe7 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 232 0xe8 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 233 0xe9 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 234 0xea '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 235 0xeb '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 236 0xec '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 237 0xed '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 238 0xee '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 239 0xef '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 240 0xf0 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 241 0xf1 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x7f, 0xe0, /* .**********. */
- 0x7f, 0xe0, /* .**********. */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x7f, 0xe0, /* .**********. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 242 0xf2 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 243 0xf3 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 244 0xf4 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 245 0xf5 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 246 0xf6 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x7f, 0xe0, /* .**********. */
- 0x7f, 0xe0, /* .**********. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 247 0xf7 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 248 0xf8 '.' */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 0x19, 0x80, /* ...**..**... */
- 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, /* ............ */
-
- /* 249 0xf9 '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 250 0xfa '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x06, 0x00, /* .....**..... */
- 0x0f, 0x00, /* ....****.... */
- 0x0f, 0x00, /* ....****.... */
- 0x06, 0x00, /* .....**..... */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 251 0xfb '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 252 0xfc '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 253 0xfd '.' */
- 0x00, 0x00, /* ............ */
- 0x0f, 0x00, /* ....****.... */
- 0x1f, 0x80, /* ...******... */
- 0x31, 0x80, /* ..**...**... */
- 0x21, 0x80, /* ..*....**... */
- 0x03, 0x00, /* ......**.... */
- 0x06, 0x00, /* .....**..... */
- 0x0c, 0x00, /* ....**...... */
- 0x18, 0x40, /* ...**....*.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 254 0xfe '.' */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x3f, 0xc0, /* ..********.. */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
- 0x00, 0x00, /* ............ */
-
- /* 255 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, /* ............ */
-};
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c
deleted file mode 100644
index a64379f..0000000
--- a/sys/dev/sf/if_sf.c
+++ /dev/null
@@ -1,1568 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998, 1999
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Adaptec AIC-6915 "Starfire" PCI fast ethernet driver for FreeBSD.
- * Programming manual is available from:
- * http://download.adaptec.com/pdfs/user_guides/aic6915_pg.pdf.
- *
- * Written by Bill Paul <wpaul@ctr.columbia.edu>
- * Department of Electical Engineering
- * Columbia University, New York City
- */
-/*
- * The Adaptec AIC-6915 "Starfire" is a 64-bit 10/100 PCI ethernet
- * controller designed with flexibility and reducing CPU load in mind.
- * The Starfire offers high and low priority buffer queues, a
- * producer/consumer index mechanism and several different buffer
- * queue and completion queue descriptor types. Any one of a number
- * of different driver designs can be used, depending on system and
- * OS requirements. This driver makes use of type0 transmit frame
- * descriptors (since BSD fragments packets across an mbuf chain)
- * and two RX buffer queues prioritized on size (one queue for small
- * frames that will fit into a single mbuf, another with full size
- * mbuf clusters for everything else). The producer/consumer indexes
- * and completion queues are also used.
- *
- * One downside to the Starfire has to do with alignment: buffer
- * queues must be aligned on 256-byte boundaries, and receive buffers
- * must be aligned on longword boundaries. The receive buffer alignment
- * causes problems on the Alpha platform, where the packet payload
- * should be longword aligned. There is no simple way around this.
- *
- * For receive filtering, the Starfire offers 16 perfect filter slots
- * and a 512-bit hash table.
- *
- * The Starfire has no internal transceiver, relying instead on an
- * external MII-based transceiver. Accessing registers on external
- * PHYs is done through a special register map rather than with the
- * usual bitbang MDIO method.
- *
- * Acesssing the registers on the Starfire is a little tricky. The
- * Starfire has a 512K internal register space. When programmed for
- * PCI memory mapped mode, the entire register space can be accessed
- * directly. However in I/O space mode, only 256 bytes are directly
- * mapped into PCI I/O space. The other registers can be accessed
- * indirectly using the SF_INDIRECTIO_ADDR and SF_INDIRECTIO_DATA
- * registers inside the 256-byte I/O window.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/socket.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-
-#include <net/bpf.h>
-
-#include <vm/vm.h> /* for vtophys */
-#include <vm/pmap.h> /* for vtophys */
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-
-/* "controller miibus0" required. See GENERIC if you get errors here. */
-#include "miibus_if.h"
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#define SF_USEIOSPACE
-
-#include <pci/if_sfreg.h>
-
-MODULE_DEPEND(sf, pci, 1, 1, 1);
-MODULE_DEPEND(sf, ether, 1, 1, 1);
-MODULE_DEPEND(sf, miibus, 1, 1, 1);
-
-static struct sf_type sf_devs[] = {
- { AD_VENDORID, AD_DEVICEID_STARFIRE,
- "Adaptec AIC-6915 10/100BaseTX" },
- { 0, 0, NULL }
-};
-
-static int sf_probe(device_t);
-static int sf_attach(device_t);
-static int sf_detach(device_t);
-static void sf_intr(void *);
-static void sf_stats_update(void *);
-static void sf_rxeof(struct sf_softc *);
-static void sf_txeof(struct sf_softc *);
-static int sf_encap(struct sf_softc *, struct sf_tx_bufdesc_type0 *,
- struct mbuf *);
-static void sf_start(struct ifnet *);
-static int sf_ioctl(struct ifnet *, u_long, caddr_t);
-static void sf_init(void *);
-static void sf_stop(struct sf_softc *);
-static void sf_watchdog(struct ifnet *);
-static void sf_shutdown(device_t);
-static int sf_ifmedia_upd(struct ifnet *);
-static void sf_ifmedia_sts(struct ifnet *, struct ifmediareq *);
-static void sf_reset(struct sf_softc *);
-static int sf_init_rx_ring(struct sf_softc *);
-static void sf_init_tx_ring(struct sf_softc *);
-static int sf_newbuf(struct sf_softc *, struct sf_rx_bufdesc_type0 *,
- struct mbuf *);
-static void sf_setmulti(struct sf_softc *);
-static int sf_setperf(struct sf_softc *, int, caddr_t);
-static int sf_sethash(struct sf_softc *, caddr_t, int);
-#ifdef notdef
-static int sf_setvlan(struct sf_softc *, int, u_int32_t);
-#endif
-
-static u_int8_t sf_read_eeprom(struct sf_softc *, int);
-
-static int sf_miibus_readreg(device_t, int, int);
-static int sf_miibus_writereg(device_t, int, int, int);
-static void sf_miibus_statchg(device_t);
-#ifdef DEVICE_POLLING
-static void sf_poll(struct ifnet *ifp, enum poll_cmd cmd,
- int count);
-static void sf_poll_locked(struct ifnet *ifp, enum poll_cmd cmd,
- int count);
-#endif /* DEVICE_POLLING */
-
-static u_int32_t csr_read_4(struct sf_softc *, int);
-static void csr_write_4(struct sf_softc *, int, u_int32_t);
-static void sf_txthresh_adjust(struct sf_softc *);
-
-#ifdef SF_USEIOSPACE
-#define SF_RES SYS_RES_IOPORT
-#define SF_RID SF_PCI_LOIO
-#else
-#define SF_RES SYS_RES_MEMORY
-#define SF_RID SF_PCI_LOMEM
-#endif
-
-static device_method_t sf_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, sf_probe),
- DEVMETHOD(device_attach, sf_attach),
- DEVMETHOD(device_detach, sf_detach),
- DEVMETHOD(device_shutdown, sf_shutdown),
-
- /* bus interface */
- DEVMETHOD(bus_print_child, bus_generic_print_child),
- DEVMETHOD(bus_driver_added, bus_generic_driver_added),
-
- /* MII interface */
- DEVMETHOD(miibus_readreg, sf_miibus_readreg),
- DEVMETHOD(miibus_writereg, sf_miibus_writereg),
- DEVMETHOD(miibus_statchg, sf_miibus_statchg),
-
- { 0, 0 }
-};
-
-static driver_t sf_driver = {
- "sf",
- sf_methods,
- sizeof(struct sf_softc),
-};
-
-static devclass_t sf_devclass;
-
-DRIVER_MODULE(sf, pci, sf_driver, sf_devclass, 0, 0);
-DRIVER_MODULE(miibus, sf, miibus_driver, miibus_devclass, 0, 0);
-
-#define SF_SETBIT(sc, reg, x) \
- csr_write_4(sc, reg, csr_read_4(sc, reg) | (x))
-
-#define SF_CLRBIT(sc, reg, x) \
- csr_write_4(sc, reg, csr_read_4(sc, reg) & ~(x))
-
-static u_int32_t
-csr_read_4(sc, reg)
- struct sf_softc *sc;
- int reg;
-{
- u_int32_t val;
-
-#ifdef SF_USEIOSPACE
- CSR_WRITE_4(sc, SF_INDIRECTIO_ADDR, reg + SF_RMAP_INTREG_BASE);
- val = CSR_READ_4(sc, SF_INDIRECTIO_DATA);
-#else
- val = CSR_READ_4(sc, (reg + SF_RMAP_INTREG_BASE));
-#endif
-
- return(val);
-}
-
-static u_int8_t
-sf_read_eeprom(sc, reg)
- struct sf_softc *sc;
- int reg;
-{
- u_int8_t val;
-
- val = (csr_read_4(sc, SF_EEADDR_BASE +
- (reg & 0xFFFFFFFC)) >> (8 * (reg & 3))) & 0xFF;
-
- return(val);
-}
-
-static void
-csr_write_4(sc, reg, val)
- struct sf_softc *sc;
- int reg;
- u_int32_t val;
-{
-#ifdef SF_USEIOSPACE
- CSR_WRITE_4(sc, SF_INDIRECTIO_ADDR, reg + SF_RMAP_INTREG_BASE);
- CSR_WRITE_4(sc, SF_INDIRECTIO_DATA, val);
-#else
- CSR_WRITE_4(sc, (reg + SF_RMAP_INTREG_BASE), val);
-#endif
-}
-
-/*
- * Copy the address 'mac' into the perfect RX filter entry at
- * offset 'idx.' The perfect filter only has 16 entries so do
- * some sanity tests.
- */
-static int
-sf_setperf(sc, idx, mac)
- struct sf_softc *sc;
- int idx;
- caddr_t mac;
-{
- u_int16_t *p;
-
- if (idx < 0 || idx > SF_RXFILT_PERFECT_CNT)
- return(EINVAL);
-
- if (mac == NULL)
- return(EINVAL);
-
- p = (u_int16_t *)mac;
-
- csr_write_4(sc, SF_RXFILT_PERFECT_BASE +
- (idx * SF_RXFILT_PERFECT_SKIP), htons(p[2]));
- csr_write_4(sc, SF_RXFILT_PERFECT_BASE +
- (idx * SF_RXFILT_PERFECT_SKIP) + 4, htons(p[1]));
- csr_write_4(sc, SF_RXFILT_PERFECT_BASE +
- (idx * SF_RXFILT_PERFECT_SKIP) + 8, htons(p[0]));
-
- return(0);
-}
-
-/*
- * Set the bit in the 512-bit hash table that corresponds to the
- * specified mac address 'mac.' If 'prio' is nonzero, update the
- * priority hash table instead of the filter hash table.
- */
-static int
-sf_sethash(sc, mac, prio)
- struct sf_softc *sc;
- caddr_t mac;
- int prio;
-{
- u_int32_t h;
-
- if (mac == NULL)
- return(EINVAL);
-
- h = ether_crc32_be(mac, ETHER_ADDR_LEN) >> 23;
-
- if (prio) {
- SF_SETBIT(sc, SF_RXFILT_HASH_BASE + SF_RXFILT_HASH_PRIOOFF +
- (SF_RXFILT_HASH_SKIP * (h >> 4)), (1 << (h & 0xF)));
- } else {
- SF_SETBIT(sc, SF_RXFILT_HASH_BASE + SF_RXFILT_HASH_ADDROFF +
- (SF_RXFILT_HASH_SKIP * (h >> 4)), (1 << (h & 0xF)));
- }
-
- return(0);
-}
-
-#ifdef notdef
-/*
- * Set a VLAN tag in the receive filter.
- */
-static int
-sf_setvlan(sc, idx, vlan)
- struct sf_softc *sc;
- int idx;
- u_int32_t vlan;
-{
- if (idx < 0 || idx >> SF_RXFILT_HASH_CNT)
- return(EINVAL);
-
- csr_write_4(sc, SF_RXFILT_HASH_BASE +
- (idx * SF_RXFILT_HASH_SKIP) + SF_RXFILT_HASH_VLANOFF, vlan);
-
- return(0);
-}
-#endif
-
-static int
-sf_miibus_readreg(dev, phy, reg)
- device_t dev;
- int phy, reg;
-{
- struct sf_softc *sc;
- int i;
- u_int32_t val = 0;
-
- sc = device_get_softc(dev);
-
- for (i = 0; i < SF_TIMEOUT; i++) {
- val = csr_read_4(sc, SF_PHY_REG(phy, reg));
- if (val & SF_MII_DATAVALID)
- break;
- }
-
- if (i == SF_TIMEOUT)
- return(0);
-
- if ((val & 0x0000FFFF) == 0xFFFF)
- return(0);
-
- return(val & 0x0000FFFF);
-}
-
-static int
-sf_miibus_writereg(dev, phy, reg, val)
- device_t dev;
- int phy, reg, val;
-{
- struct sf_softc *sc;
- int i;
- int busy;
-
- sc = device_get_softc(dev);
-
- csr_write_4(sc, SF_PHY_REG(phy, reg), val);
-
- for (i = 0; i < SF_TIMEOUT; i++) {
- busy = csr_read_4(sc, SF_PHY_REG(phy, reg));
- if (!(busy & SF_MII_BUSY))
- break;
- }
-
- return(0);
-}
-
-static void
-sf_miibus_statchg(dev)
- device_t dev;
-{
- struct sf_softc *sc;
- struct mii_data *mii;
-
- sc = device_get_softc(dev);
- mii = device_get_softc(sc->sf_miibus);
-
- if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) {
- SF_SETBIT(sc, SF_MACCFG_1, SF_MACCFG1_FULLDUPLEX);
- csr_write_4(sc, SF_BKTOBKIPG, SF_IPGT_FDX);
- } else {
- SF_CLRBIT(sc, SF_MACCFG_1, SF_MACCFG1_FULLDUPLEX);
- csr_write_4(sc, SF_BKTOBKIPG, SF_IPGT_HDX);
- }
-}
-
-static void
-sf_setmulti(sc)
- struct sf_softc *sc;
-{
- struct ifnet *ifp;
- int i;
- struct ifmultiaddr *ifma;
- u_int8_t dummy[] = { 0, 0, 0, 0, 0, 0 };
-
- ifp = sc->sf_ifp;
-
- /* First zot all the existing filters. */
- for (i = 1; i < SF_RXFILT_PERFECT_CNT; i++)
- sf_setperf(sc, i, (char *)&dummy);
- for (i = SF_RXFILT_HASH_BASE;
- i < (SF_RXFILT_HASH_MAX + 1); i += 4)
- csr_write_4(sc, i, 0);
- SF_CLRBIT(sc, SF_RXFILT, SF_RXFILT_ALLMULTI);
-
- /* Now program new ones. */
- if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
- SF_SETBIT(sc, SF_RXFILT, SF_RXFILT_ALLMULTI);
- } else {
- i = 1;
- TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- /*
- * Program the first 15 multicast groups
- * into the perfect filter. For all others,
- * use the hash table.
- */
- if (i < SF_RXFILT_PERFECT_CNT) {
- sf_setperf(sc, i,
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
- i++;
- continue;
- }
-
- sf_sethash(sc,
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 0);
- }
- }
-}
-
-/*
- * Set media options.
- */
-static int
-sf_ifmedia_upd(ifp)
- struct ifnet *ifp;
-{
- struct sf_softc *sc;
- struct mii_data *mii;
-
- sc = ifp->if_softc;
- mii = device_get_softc(sc->sf_miibus);
- sc->sf_link = 0;
- if (mii->mii_instance) {
- struct mii_softc *miisc;
- LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
- mii_phy_reset(miisc);
- }
- mii_mediachg(mii);
-
- return(0);
-}
-
-/*
- * Report current media status.
- */
-static void
-sf_ifmedia_sts(ifp, ifmr)
- struct ifnet *ifp;
- struct ifmediareq *ifmr;
-{
- struct sf_softc *sc;
- struct mii_data *mii;
-
- sc = ifp->if_softc;
- mii = device_get_softc(sc->sf_miibus);
-
- mii_pollstat(mii);
- ifmr->ifm_active = mii->mii_media_active;
- ifmr->ifm_status = mii->mii_media_status;
-}
-
-static int
-sf_ioctl(ifp, command, data)
- struct ifnet *ifp;
- u_long command;
- caddr_t data;
-{
- struct sf_softc *sc = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *) data;
- struct mii_data *mii;
- int error = 0;
-
- SF_LOCK(sc);
-
- switch(command) {
- case SIOCSIFFLAGS:
- if (ifp->if_flags & IFF_UP) {
- if (ifp->if_flags & IFF_RUNNING &&
- ifp->if_flags & IFF_PROMISC &&
- !(sc->sf_if_flags & IFF_PROMISC)) {
- SF_SETBIT(sc, SF_RXFILT, SF_RXFILT_PROMISC);
- } else if (ifp->if_flags & IFF_RUNNING &&
- !(ifp->if_flags & IFF_PROMISC) &&
- sc->sf_if_flags & IFF_PROMISC) {
- SF_CLRBIT(sc, SF_RXFILT, SF_RXFILT_PROMISC);
- } else if (!(ifp->if_flags & IFF_RUNNING))
- sf_init(sc);
- } else {
- if (ifp->if_flags & IFF_RUNNING)
- sf_stop(sc);
- }
- sc->sf_if_flags = ifp->if_flags;
- error = 0;
- break;
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- sf_setmulti(sc);
- error = 0;
- break;
- case SIOCGIFMEDIA:
- case SIOCSIFMEDIA:
- mii = device_get_softc(sc->sf_miibus);
- error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
- break;
- case SIOCSIFCAP:
- ifp->if_capenable &= ~IFCAP_POLLING;
- ifp->if_capenable |= ifr->ifr_reqcap & IFCAP_POLLING;
- break;
- default:
- error = ether_ioctl(ifp, command, data);
- break;
- }
-
- SF_UNLOCK(sc);
-
- return(error);
-}
-
-static void
-sf_reset(sc)
- struct sf_softc *sc;
-{
- register int i;
-
- csr_write_4(sc, SF_GEN_ETH_CTL, 0);
- SF_SETBIT(sc, SF_MACCFG_1, SF_MACCFG1_SOFTRESET);
- DELAY(1000);
- SF_CLRBIT(sc, SF_MACCFG_1, SF_MACCFG1_SOFTRESET);
-
- SF_SETBIT(sc, SF_PCI_DEVCFG, SF_PCIDEVCFG_RESET);
-
- for (i = 0; i < SF_TIMEOUT; i++) {
- DELAY(10);
- if (!(csr_read_4(sc, SF_PCI_DEVCFG) & SF_PCIDEVCFG_RESET))
- break;
- }
-
- if (i == SF_TIMEOUT)
- printf("sf%d: reset never completed!\n", sc->sf_unit);
-
- /* Wait a little while for the chip to get its brains in order. */
- DELAY(1000);
-}
-
-/*
- * Probe for an Adaptec AIC-6915 chip. Check the PCI vendor and device
- * IDs against our list and return a device name if we find a match.
- * We also check the subsystem ID so that we can identify exactly which
- * NIC has been found, if possible.
- */
-static int
-sf_probe(dev)
- device_t dev;
-{
- struct sf_type *t;
-
- t = sf_devs;
-
- while(t->sf_name != NULL) {
- if ((pci_get_vendor(dev) == t->sf_vid) &&
- (pci_get_device(dev) == t->sf_did)) {
- switch((pci_read_config(dev,
- SF_PCI_SUBVEN_ID, 4) >> 16) & 0xFFFF) {
- case AD_SUBSYSID_62011_REV0:
- case AD_SUBSYSID_62011_REV1:
- device_set_desc(dev,
- "Adaptec ANA-62011 10/100BaseTX");
- return (BUS_PROBE_DEFAULT);
- case AD_SUBSYSID_62022:
- device_set_desc(dev,
- "Adaptec ANA-62022 10/100BaseTX");
- return (BUS_PROBE_DEFAULT);
- case AD_SUBSYSID_62044_REV0:
- case AD_SUBSYSID_62044_REV1:
- device_set_desc(dev,
- "Adaptec ANA-62044 10/100BaseTX");
- return (BUS_PROBE_DEFAULT);
- case AD_SUBSYSID_62020:
- device_set_desc(dev,
- "Adaptec ANA-62020 10/100BaseFX");
- return (BUS_PROBE_DEFAULT);
- case AD_SUBSYSID_69011:
- device_set_desc(dev,
- "Adaptec ANA-69011 10/100BaseTX");
- return (BUS_PROBE_DEFAULT);
- default:
- device_set_desc(dev, t->sf_name);
- return (BUS_PROBE_DEFAULT);
- break;
- }
- }
- t++;
- }
-
- return(ENXIO);
-}
-
-/*
- * Attach the interface. Allocate softc structures, do ifmedia
- * setup and ethernet/BPF attach.
- */
-static int
-sf_attach(dev)
- device_t dev;
-{
- int i;
- struct sf_softc *sc;
- struct ifnet *ifp;
- int unit, rid, error = 0;
- u_char eaddr[6];
-
- sc = device_get_softc(dev);
- unit = device_get_unit(dev);
-
- mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
- MTX_DEF | MTX_RECURSE);
- /*
- * Map control/status registers.
- */
- pci_enable_busmaster(dev);
-
- rid = SF_RID;
- sc->sf_res = bus_alloc_resource_any(dev, SF_RES, &rid, RF_ACTIVE);
-
- if (sc->sf_res == NULL) {
- printf ("sf%d: couldn't map ports\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- sc->sf_btag = rman_get_bustag(sc->sf_res);
- sc->sf_bhandle = rman_get_bushandle(sc->sf_res);
-
- /* Allocate interrupt */
- rid = 0;
- sc->sf_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
- RF_SHAREABLE | RF_ACTIVE);
-
- if (sc->sf_irq == NULL) {
- printf("sf%d: couldn't map interrupt\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- callout_handle_init(&sc->sf_stat_ch);
- /* Reset the adapter. */
- sf_reset(sc);
-
- /*
- * Get station address from the EEPROM.
- */
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- eaddr[i] =
- sf_read_eeprom(sc, SF_EE_NODEADDR + ETHER_ADDR_LEN - i);
-
- sc->sf_unit = unit;
-
- /* Allocate the descriptor queues. */
- sc->sf_ldata = contigmalloc(sizeof(struct sf_list_data), M_DEVBUF,
- M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0);
-
- if (sc->sf_ldata == NULL) {
- printf("sf%d: no memory for list buffers!\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- bzero(sc->sf_ldata, sizeof(struct sf_list_data));
-
- ifp = sc->sf_ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- printf("sf%d: can not if_alloc()\n", sc->sf_unit);
- error = ENOSPC;
- goto fail;
- }
-
- /* Do MII setup. */
- if (mii_phy_probe(dev, &sc->sf_miibus,
- sf_ifmedia_upd, sf_ifmedia_sts)) {
- printf("sf%d: MII without any phy!\n", sc->sf_unit);
- error = ENXIO;
- goto fail;
- }
-
- ifp->if_softc = sc;
- if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_mtu = ETHERMTU;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
- IFF_NEEDSGIANT;
- ifp->if_ioctl = sf_ioctl;
- ifp->if_start = sf_start;
- ifp->if_watchdog = sf_watchdog;
- ifp->if_init = sf_init;
- ifp->if_baudrate = 10000000;
- IFQ_SET_MAXLEN(&ifp->if_snd, SF_TX_DLIST_CNT - 1);
- ifp->if_snd.ifq_drv_maxlen = SF_TX_DLIST_CNT - 1;
- IFQ_SET_READY(&ifp->if_snd);
-#ifdef DEVICE_POLLING
- ifp->if_capabilities |= IFCAP_POLLING;
-#endif /* DEVICE_POLLING */
- ifp->if_capenable = ifp->if_capabilities;
-
- /*
- * Call MI attach routine.
- */
- ether_ifattach(ifp, eaddr);
-
- /* Hook interrupt last to avoid having to lock softc */
- error = bus_setup_intr(dev, sc->sf_irq, INTR_TYPE_NET,
- sf_intr, sc, &sc->sf_intrhand);
-
- if (error) {
- printf("sf%d: couldn't set up irq\n", unit);
- ether_ifdetach(ifp);
- if_free(ifp);
- goto fail;
- }
-
-fail:
- if (error)
- sf_detach(dev);
-
- return(error);
-}
-
-/*
- * Shutdown hardware and free up resources. This can be called any
- * time after the mutex has been initialized. It is called in both
- * the error case in attach and the normal detach case so it needs
- * to be careful about only freeing resources that have actually been
- * allocated.
- */
-static int
-sf_detach(dev)
- device_t dev;
-{
- struct sf_softc *sc;
- struct ifnet *ifp;
-
- sc = device_get_softc(dev);
- KASSERT(mtx_initialized(&sc->sf_mtx), ("sf mutex not initialized"));
- SF_LOCK(sc);
- ifp = sc->sf_ifp;
-
- /* These should only be active if attach succeeded */
- if (device_is_attached(dev)) {
- sf_stop(sc);
- ether_ifdetach(ifp);
- if_free(ifp);
- }
- if (sc->sf_miibus)
- device_delete_child(dev, sc->sf_miibus);
- bus_generic_detach(dev);
-
- if (sc->sf_intrhand)
- bus_teardown_intr(dev, sc->sf_irq, sc->sf_intrhand);
- if (sc->sf_irq)
- bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sf_irq);
- if (sc->sf_res)
- bus_release_resource(dev, SF_RES, SF_RID, sc->sf_res);
-
- if (sc->sf_ldata)
- contigfree(sc->sf_ldata, sizeof(struct sf_list_data), M_DEVBUF);
-
- SF_UNLOCK(sc);
- mtx_destroy(&sc->sf_mtx);
-
- return(0);
-}
-
-static int
-sf_init_rx_ring(sc)
- struct sf_softc *sc;
-{
- struct sf_list_data *ld;
- int i;
-
- ld = sc->sf_ldata;
-
- bzero((char *)ld->sf_rx_dlist_big,
- sizeof(struct sf_rx_bufdesc_type0) * SF_RX_DLIST_CNT);
- bzero((char *)ld->sf_rx_clist,
- sizeof(struct sf_rx_cmpdesc_type3) * SF_RX_CLIST_CNT);
-
- for (i = 0; i < SF_RX_DLIST_CNT; i++) {
- if (sf_newbuf(sc, &ld->sf_rx_dlist_big[i], NULL) == ENOBUFS)
- return(ENOBUFS);
- }
-
- return(0);
-}
-
-static void
-sf_init_tx_ring(sc)
- struct sf_softc *sc;
-{
- struct sf_list_data *ld;
- int i;
-
- ld = sc->sf_ldata;
-
- bzero((char *)ld->sf_tx_dlist,
- sizeof(struct sf_tx_bufdesc_type0) * SF_TX_DLIST_CNT);
- bzero((char *)ld->sf_tx_clist,
- sizeof(struct sf_tx_cmpdesc_type0) * SF_TX_CLIST_CNT);
-
- for (i = 0; i < SF_TX_DLIST_CNT; i++)
- ld->sf_tx_dlist[i].sf_id = SF_TX_BUFDESC_ID;
- for (i = 0; i < SF_TX_CLIST_CNT; i++)
- ld->sf_tx_clist[i].sf_type = SF_TXCMPTYPE_TX;
-
- ld->sf_tx_dlist[SF_TX_DLIST_CNT - 1].sf_end = 1;
- sc->sf_tx_cnt = 0;
-}
-
-static int
-sf_newbuf(sc, c, m)
- struct sf_softc *sc;
- struct sf_rx_bufdesc_type0 *c;
- struct mbuf *m;
-{
- struct mbuf *m_new = NULL;
-
- if (m == NULL) {
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL)
- return(ENOBUFS);
-
- MCLGET(m_new, M_DONTWAIT);
- if (!(m_new->m_flags & M_EXT)) {
- m_freem(m_new);
- return(ENOBUFS);
- }
- m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
- } else {
- m_new = m;
- m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
- m_new->m_data = m_new->m_ext.ext_buf;
- }
-
- m_adj(m_new, sizeof(u_int64_t));
-
- c->sf_mbuf = m_new;
- c->sf_addrlo = SF_RX_HOSTADDR(vtophys(mtod(m_new, caddr_t)));
- c->sf_valid = 1;
-
- return(0);
-}
-
-/*
- * The starfire is programmed to use 'normal' mode for packet reception,
- * which means we use the consumer/producer model for both the buffer
- * descriptor queue and the completion descriptor queue. The only problem
- * with this is that it involves a lot of register accesses: we have to
- * read the RX completion consumer and producer indexes and the RX buffer
- * producer index, plus the RX completion consumer and RX buffer producer
- * indexes have to be updated. It would have been easier if Adaptec had
- * put each index in a separate register, especially given that the damn
- * NIC has a 512K register space.
- *
- * In spite of all the lovely features that Adaptec crammed into the 6915,
- * it is marred by one truly stupid design flaw, which is that receive
- * buffer addresses must be aligned on a longword boundary. This forces
- * the packet payload to be unaligned, which is suboptimal on the x86 and
- * completely unuseable on the Alpha. Our only recourse is to copy received
- * packets into properly aligned buffers before handing them off.
- */
-
-static void
-sf_rxeof(sc)
- struct sf_softc *sc;
-{
- struct mbuf *m;
- struct ifnet *ifp;
- struct sf_rx_bufdesc_type0 *desc;
- struct sf_rx_cmpdesc_type3 *cur_rx;
- u_int32_t rxcons, rxprod;
- int cmpprodidx, cmpconsidx, bufprodidx;
-
- SF_LOCK_ASSERT(sc);
-
- ifp = sc->sf_ifp;
-
- rxcons = csr_read_4(sc, SF_CQ_CONSIDX);
- rxprod = csr_read_4(sc, SF_RXDQ_PTR_Q1);
- cmpprodidx = SF_IDX_LO(csr_read_4(sc, SF_CQ_PRODIDX));
- cmpconsidx = SF_IDX_LO(rxcons);
- bufprodidx = SF_IDX_LO(rxprod);
-
- while (cmpconsidx != cmpprodidx) {
- struct mbuf *m0;
-
-#ifdef DEVICE_POLLING
- if (ifp->if_flags & IFF_POLLING) {
- if (sc->rxcycles <= 0)
- break;
- sc->rxcycles--;
- }
-#endif /* DEVICE_POLLING */
-
- cur_rx = &sc->sf_ldata->sf_rx_clist[cmpconsidx];
- desc = &sc->sf_ldata->sf_rx_dlist_big[cur_rx->sf_endidx];
- m = desc->sf_mbuf;
- SF_INC(cmpconsidx, SF_RX_CLIST_CNT);
- SF_INC(bufprodidx, SF_RX_DLIST_CNT);
-
- if (!(cur_rx->sf_status1 & SF_RXSTAT1_OK)) {
- ifp->if_ierrors++;
- sf_newbuf(sc, desc, m);
- continue;
- }
-
- m0 = m_devget(mtod(m, char *), cur_rx->sf_len, ETHER_ALIGN,
- ifp, NULL);
- sf_newbuf(sc, desc, m);
- if (m0 == NULL) {
- ifp->if_ierrors++;
- continue;
- }
- m = m0;
-
- ifp->if_ipackets++;
- SF_UNLOCK(sc);
- (*ifp->if_input)(ifp, m);
- SF_LOCK(sc);
- }
-
- csr_write_4(sc, SF_CQ_CONSIDX,
- (rxcons & ~SF_CQ_CONSIDX_RXQ1) | cmpconsidx);
- csr_write_4(sc, SF_RXDQ_PTR_Q1,
- (rxprod & ~SF_RXDQ_PRODIDX) | bufprodidx);
-}
-
-/*
- * Read the transmit status from the completion queue and release
- * mbufs. Note that the buffer descriptor index in the completion
- * descriptor is an offset from the start of the transmit buffer
- * descriptor list in bytes. This is important because the manual
- * gives the impression that it should match the producer/consumer
- * index, which is the offset in 8 byte blocks.
- */
-static void
-sf_txeof(sc)
- struct sf_softc *sc;
-{
- int txcons, cmpprodidx, cmpconsidx;
- struct sf_tx_cmpdesc_type1 *cur_cmp;
- struct sf_tx_bufdesc_type0 *cur_tx;
- struct ifnet *ifp;
-
- ifp = sc->sf_ifp;
-
- txcons = csr_read_4(sc, SF_CQ_CONSIDX);
- cmpprodidx = SF_IDX_HI(csr_read_4(sc, SF_CQ_PRODIDX));
- cmpconsidx = SF_IDX_HI(txcons);
-
- while (cmpconsidx != cmpprodidx) {
- cur_cmp = &sc->sf_ldata->sf_tx_clist[cmpconsidx];
- cur_tx = &sc->sf_ldata->sf_tx_dlist[cur_cmp->sf_index >> 7];
-
- if (cur_cmp->sf_txstat & SF_TXSTAT_TX_OK)
- ifp->if_opackets++;
- else {
- if (cur_cmp->sf_txstat & SF_TXSTAT_TX_UNDERRUN)
- sf_txthresh_adjust(sc);
- ifp->if_oerrors++;
- }
-
- sc->sf_tx_cnt--;
- if (cur_tx->sf_mbuf != NULL) {
- m_freem(cur_tx->sf_mbuf);
- cur_tx->sf_mbuf = NULL;
- } else
- break;
- SF_INC(cmpconsidx, SF_TX_CLIST_CNT);
- }
-
- ifp->if_timer = 0;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- csr_write_4(sc, SF_CQ_CONSIDX,
- (txcons & ~SF_CQ_CONSIDX_TXQ) |
- ((cmpconsidx << 16) & 0xFFFF0000));
-}
-
-static void
-sf_txthresh_adjust(sc)
- struct sf_softc *sc;
-{
- u_int32_t txfctl;
- u_int8_t txthresh;
-
- txfctl = csr_read_4(sc, SF_TX_FRAMCTL);
- txthresh = txfctl & SF_TXFRMCTL_TXTHRESH;
- if (txthresh < 0xFF) {
- txthresh++;
- txfctl &= ~SF_TXFRMCTL_TXTHRESH;
- txfctl |= txthresh;
-#ifdef DIAGNOSTIC
- printf("sf%d: tx underrun, increasing "
- "tx threshold to %d bytes\n",
- sc->sf_unit, txthresh * 4);
-#endif
- csr_write_4(sc, SF_TX_FRAMCTL, txfctl);
- }
-}
-
-#ifdef DEVICE_POLLING
-static void
-sf_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
-{
- struct sf_softc *sc = ifp->if_softc;
-
- SF_LOCK(sc);
- sf_poll_locked(ifp, cmd, count);
- SF_UNLOCK(sc);
-}
-
-static void
-sf_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count)
-{
- struct sf_softc *sc = ifp->if_softc;
-
- SF_LOCK_ASSERT(sc);
-
- if (!(ifp->if_capenable & IFCAP_POLLING)) {
- ether_poll_deregister(ifp);
- cmd = POLL_DEREGISTER;
- }
-
- if (cmd == POLL_DEREGISTER) {
- /* Final call, enable interrupts. */
- csr_write_4(sc, SF_IMR, SF_INTRS);
- return;
- }
-
- sc->rxcycles = count;
- sf_rxeof(sc);
- sf_txeof(sc);
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- sf_start(ifp);
-
- if (cmd == POLL_AND_CHECK_STATUS) {
- u_int32_t status;
-
- status = csr_read_4(sc, SF_ISR);
- if (status)
- csr_write_4(sc, SF_ISR, status);
-
- if (status & SF_ISR_TX_LOFIFO)
- sf_txthresh_adjust(sc);
-
- if (status & SF_ISR_ABNORMALINTR) {
- if (status & SF_ISR_STATSOFLOW) {
- untimeout(sf_stats_update, sc,
- sc->sf_stat_ch);
- sf_stats_update(sc);
- } else
- sf_init(sc);
- }
- }
-}
-#endif /* DEVICE_POLLING */
-
-static void
-sf_intr(arg)
- void *arg;
-{
- struct sf_softc *sc;
- struct ifnet *ifp;
- u_int32_t status;
-
- sc = arg;
- SF_LOCK(sc);
-
- ifp = sc->sf_ifp;
-
-#ifdef DEVICE_POLLING
- if (ifp->if_flags & IFF_POLLING)
- goto done_locked;
-
- if ((ifp->if_capenable & IFCAP_POLLING) &&
- ether_poll_register(sf_poll, ifp)) {
- /* OK, disable interrupts. */
- csr_write_4(sc, SF_IMR, 0x00000000);
- sf_poll_locked(ifp, 0, 1);
- goto done_locked;
- }
-#endif /* DEVICE_POLLING */
-
- if (!(csr_read_4(sc, SF_ISR_SHADOW) & SF_ISR_PCIINT_ASSERTED)) {
- SF_UNLOCK(sc);
- return;
- }
-
- /* Disable interrupts. */
- csr_write_4(sc, SF_IMR, 0x00000000);
-
- for (;;) {
- status = csr_read_4(sc, SF_ISR);
- if (status)
- csr_write_4(sc, SF_ISR, status);
-
- if (!(status & SF_INTRS))
- break;
-
- if (status & SF_ISR_RXDQ1_DMADONE)
- sf_rxeof(sc);
-
- if (status & SF_ISR_TX_TXDONE ||
- status & SF_ISR_TX_DMADONE ||
- status & SF_ISR_TX_QUEUEDONE)
- sf_txeof(sc);
-
- if (status & SF_ISR_TX_LOFIFO)
- sf_txthresh_adjust(sc);
-
- if (status & SF_ISR_ABNORMALINTR) {
- if (status & SF_ISR_STATSOFLOW) {
- untimeout(sf_stats_update, sc,
- sc->sf_stat_ch);
- sf_stats_update(sc);
- } else
- sf_init(sc);
- }
- }
-
- /* Re-enable interrupts. */
- csr_write_4(sc, SF_IMR, SF_INTRS);
-
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- sf_start(ifp);
-
-#ifdef DEVICE_POLLING
-done_locked:
-#endif /* DEVICE_POLLING */
- SF_UNLOCK(sc);
-}
-
-static void
-sf_init(xsc)
- void *xsc;
-{
- struct sf_softc *sc;
- struct ifnet *ifp;
- struct mii_data *mii;
- int i;
-
- sc = xsc;
- SF_LOCK(sc);
- ifp = sc->sf_ifp;
- mii = device_get_softc(sc->sf_miibus);
-
- sf_stop(sc);
- sf_reset(sc);
-
- /* Init all the receive filter registers */
- for (i = SF_RXFILT_PERFECT_BASE;
- i < (SF_RXFILT_HASH_MAX + 1); i += 4)
- csr_write_4(sc, i, 0);
-
- /* Empty stats counter registers. */
- for (i = 0; i < sizeof(struct sf_stats)/sizeof(u_int32_t); i++)
- csr_write_4(sc, SF_STATS_BASE +
- (i + sizeof(u_int32_t)), 0);
-
- /* Init our MAC address */
- csr_write_4(sc, SF_PAR0, *(u_int32_t *)(&IFP2ENADDR(sc->sf_ifp)[0]));
- csr_write_4(sc, SF_PAR1, *(u_int32_t *)(&IFP2ENADDR(sc->sf_ifp)[4]));
- sf_setperf(sc, 0, (caddr_t)&IFP2ENADDR(sc->sf_ifp));
-
- if (sf_init_rx_ring(sc) == ENOBUFS) {
- printf("sf%d: initialization failed: no "
- "memory for rx buffers\n", sc->sf_unit);
- SF_UNLOCK(sc);
- return;
- }
-
- sf_init_tx_ring(sc);
-
- csr_write_4(sc, SF_RXFILT, SF_PERFMODE_NORMAL|SF_HASHMODE_WITHVLAN);
-
- /* If we want promiscuous mode, set the allframes bit. */
- if (ifp->if_flags & IFF_PROMISC) {
- SF_SETBIT(sc, SF_RXFILT, SF_RXFILT_PROMISC);
- } else {
- SF_CLRBIT(sc, SF_RXFILT, SF_RXFILT_PROMISC);
- }
-
- if (ifp->if_flags & IFF_BROADCAST) {
- SF_SETBIT(sc, SF_RXFILT, SF_RXFILT_BROAD);
- } else {
- SF_CLRBIT(sc, SF_RXFILT, SF_RXFILT_BROAD);
- }
-
- /*
- * Load the multicast filter.
- */
- sf_setmulti(sc);
-
- /* Init the completion queue indexes */
- csr_write_4(sc, SF_CQ_CONSIDX, 0);
- csr_write_4(sc, SF_CQ_PRODIDX, 0);
-
- /* Init the RX completion queue */
- csr_write_4(sc, SF_RXCQ_CTL_1,
- vtophys(sc->sf_ldata->sf_rx_clist) & SF_RXCQ_ADDR);
- SF_SETBIT(sc, SF_RXCQ_CTL_1, SF_RXCQTYPE_3);
-
- /* Init RX DMA control. */
- SF_SETBIT(sc, SF_RXDMA_CTL, SF_RXDMA_REPORTBADPKTS);
-
- /* Init the RX buffer descriptor queue. */
- csr_write_4(sc, SF_RXDQ_ADDR_Q1,
- vtophys(sc->sf_ldata->sf_rx_dlist_big));
- csr_write_4(sc, SF_RXDQ_CTL_1, (MCLBYTES << 16) | SF_DESCSPACE_16BYTES);
- csr_write_4(sc, SF_RXDQ_PTR_Q1, SF_RX_DLIST_CNT - 1);
-
- /* Init the TX completion queue */
- csr_write_4(sc, SF_TXCQ_CTL,
- vtophys(sc->sf_ldata->sf_tx_clist) & SF_RXCQ_ADDR);
-
- /* Init the TX buffer descriptor queue. */
- csr_write_4(sc, SF_TXDQ_ADDR_HIPRIO,
- vtophys(sc->sf_ldata->sf_tx_dlist));
- SF_SETBIT(sc, SF_TX_FRAMCTL, SF_TXFRMCTL_CPLAFTERTX);
- csr_write_4(sc, SF_TXDQ_CTL,
- SF_TXBUFDESC_TYPE0|SF_TXMINSPACE_128BYTES|SF_TXSKIPLEN_8BYTES);
- SF_SETBIT(sc, SF_TXDQ_CTL, SF_TXDQCTL_NODMACMP);
-
- /* Enable autopadding of short TX frames. */
- SF_SETBIT(sc, SF_MACCFG_1, SF_MACCFG1_AUTOPAD);
-
-#ifdef DEVICE_POLLING
- /* Disable interrupts if we are polling. */
- if (ifp->if_flags & IFF_POLLING)
- csr_write_4(sc, SF_IMR, 0x00000000);
- else
-#endif /* DEVICE_POLLING */
-
- /* Enable interrupts. */
- csr_write_4(sc, SF_IMR, SF_INTRS);
- SF_SETBIT(sc, SF_PCI_DEVCFG, SF_PCIDEVCFG_INTR_ENB);
-
- /* Enable the RX and TX engines. */
- SF_SETBIT(sc, SF_GEN_ETH_CTL, SF_ETHCTL_RX_ENB|SF_ETHCTL_RXDMA_ENB);
- SF_SETBIT(sc, SF_GEN_ETH_CTL, SF_ETHCTL_TX_ENB|SF_ETHCTL_TXDMA_ENB);
-
- /*mii_mediachg(mii);*/
- sf_ifmedia_upd(ifp);
-
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- sc->sf_stat_ch = timeout(sf_stats_update, sc, hz);
-
- SF_UNLOCK(sc);
-}
-
-static int
-sf_encap(sc, c, m_head)
- struct sf_softc *sc;
- struct sf_tx_bufdesc_type0 *c;
- struct mbuf *m_head;
-{
- int frag = 0;
- struct sf_frag *f = NULL;
- struct mbuf *m;
-
- m = m_head;
-
- for (m = m_head, frag = 0; m != NULL; m = m->m_next) {
- if (m->m_len != 0) {
- if (frag == SF_MAXFRAGS)
- break;
- f = &c->sf_frags[frag];
- if (frag == 0)
- f->sf_pktlen = m_head->m_pkthdr.len;
- f->sf_fraglen = m->m_len;
- f->sf_addr = vtophys(mtod(m, vm_offset_t));
- frag++;
- }
- }
-
- if (m != NULL) {
- struct mbuf *m_new = NULL;
-
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL) {
- printf("sf%d: no memory for tx list\n", sc->sf_unit);
- return(1);
- }
-
- if (m_head->m_pkthdr.len > MHLEN) {
- MCLGET(m_new, M_DONTWAIT);
- if (!(m_new->m_flags & M_EXT)) {
- m_freem(m_new);
- printf("sf%d: no memory for tx list\n",
- sc->sf_unit);
- return(1);
- }
- }
- m_copydata(m_head, 0, m_head->m_pkthdr.len,
- mtod(m_new, caddr_t));
- m_new->m_pkthdr.len = m_new->m_len = m_head->m_pkthdr.len;
- m_freem(m_head);
- m_head = m_new;
- f = &c->sf_frags[0];
- f->sf_fraglen = f->sf_pktlen = m_head->m_pkthdr.len;
- f->sf_addr = vtophys(mtod(m_head, caddr_t));
- frag = 1;
- }
-
- c->sf_mbuf = m_head;
- c->sf_id = SF_TX_BUFDESC_ID;
- c->sf_fragcnt = frag;
- c->sf_intr = 1;
- c->sf_caltcp = 0;
- c->sf_crcen = 1;
-
- return(0);
-}
-
-static void
-sf_start(ifp)
- struct ifnet *ifp;
-{
- struct sf_softc *sc;
- struct sf_tx_bufdesc_type0 *cur_tx = NULL;
- struct mbuf *m_head = NULL;
- int i, txprod;
-
- sc = ifp->if_softc;
- SF_LOCK(sc);
-
- if (!sc->sf_link && ifp->if_snd.ifq_len < 10) {
- SF_UNLOCK(sc);
- return;
- }
-
- if (ifp->if_flags & IFF_OACTIVE) {
- SF_UNLOCK(sc);
- return;
- }
-
- txprod = csr_read_4(sc, SF_TXDQ_PRODIDX);
- i = SF_IDX_HI(txprod) >> 4;
-
- if (sc->sf_ldata->sf_tx_dlist[i].sf_mbuf != NULL) {
- printf("sf%d: TX ring full, resetting\n", sc->sf_unit);
- sf_init(sc);
- txprod = csr_read_4(sc, SF_TXDQ_PRODIDX);
- i = SF_IDX_HI(txprod) >> 4;
- }
-
- while(sc->sf_ldata->sf_tx_dlist[i].sf_mbuf == NULL) {
- if (sc->sf_tx_cnt >= (SF_TX_DLIST_CNT - 5)) {
- ifp->if_flags |= IFF_OACTIVE;
- cur_tx = NULL;
- break;
- }
- IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
- if (m_head == NULL)
- break;
-
- cur_tx = &sc->sf_ldata->sf_tx_dlist[i];
- if (sf_encap(sc, cur_tx, m_head)) {
- IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
- cur_tx = NULL;
- break;
- }
-
- /*
- * If there's a BPF listener, bounce a copy of this frame
- * to him.
- */
- BPF_MTAP(ifp, m_head);
-
- SF_INC(i, SF_TX_DLIST_CNT);
- sc->sf_tx_cnt++;
- /*
- * Don't get the TX DMA queue get too full.
- */
- if (sc->sf_tx_cnt > 64)
- break;
- }
-
- if (cur_tx == NULL) {
- SF_UNLOCK(sc);
- return;
- }
-
- /* Transmit */
- csr_write_4(sc, SF_TXDQ_PRODIDX,
- (txprod & ~SF_TXDQ_PRODIDX_HIPRIO) |
- ((i << 20) & 0xFFFF0000));
-
- ifp->if_timer = 5;
-
- SF_UNLOCK(sc);
-}
-
-static void
-sf_stop(sc)
- struct sf_softc *sc;
-{
- int i;
- struct ifnet *ifp;
-
- SF_LOCK(sc);
-
- ifp = sc->sf_ifp;
-
- untimeout(sf_stats_update, sc, sc->sf_stat_ch);
-
-#ifdef DEVICE_POLLING
- ether_poll_deregister(ifp);
-#endif /* DEVICE_POLLING */
-
- csr_write_4(sc, SF_GEN_ETH_CTL, 0);
- csr_write_4(sc, SF_CQ_CONSIDX, 0);
- csr_write_4(sc, SF_CQ_PRODIDX, 0);
- csr_write_4(sc, SF_RXDQ_ADDR_Q1, 0);
- csr_write_4(sc, SF_RXDQ_CTL_1, 0);
- csr_write_4(sc, SF_RXDQ_PTR_Q1, 0);
- csr_write_4(sc, SF_TXCQ_CTL, 0);
- csr_write_4(sc, SF_TXDQ_ADDR_HIPRIO, 0);
- csr_write_4(sc, SF_TXDQ_CTL, 0);
- sf_reset(sc);
-
- sc->sf_link = 0;
-
- for (i = 0; i < SF_RX_DLIST_CNT; i++) {
- if (sc->sf_ldata->sf_rx_dlist_big[i].sf_mbuf != NULL) {
- m_freem(sc->sf_ldata->sf_rx_dlist_big[i].sf_mbuf);
- sc->sf_ldata->sf_rx_dlist_big[i].sf_mbuf = NULL;
- }
- }
-
- for (i = 0; i < SF_TX_DLIST_CNT; i++) {
- if (sc->sf_ldata->sf_tx_dlist[i].sf_mbuf != NULL) {
- m_freem(sc->sf_ldata->sf_tx_dlist[i].sf_mbuf);
- sc->sf_ldata->sf_tx_dlist[i].sf_mbuf = NULL;
- }
- }
-
- ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
- SF_UNLOCK(sc);
-}
-
-/*
- * Note: it is important that this function not be interrupted. We
- * use a two-stage register access scheme: if we are interrupted in
- * between setting the indirect address register and reading from the
- * indirect data register, the contents of the address register could
- * be changed out from under us.
- */
-static void
-sf_stats_update(xsc)
- void *xsc;
-{
- struct sf_softc *sc;
- struct ifnet *ifp;
- struct mii_data *mii;
- struct sf_stats stats;
- u_int32_t *ptr;
- int i;
-
- sc = xsc;
- SF_LOCK(sc);
- ifp = sc->sf_ifp;
- mii = device_get_softc(sc->sf_miibus);
-
- ptr = (u_int32_t *)&stats;
- for (i = 0; i < sizeof(stats)/sizeof(u_int32_t); i++)
- ptr[i] = csr_read_4(sc, SF_STATS_BASE +
- (i + sizeof(u_int32_t)));
-
- for (i = 0; i < sizeof(stats)/sizeof(u_int32_t); i++)
- csr_write_4(sc, SF_STATS_BASE +
- (i + sizeof(u_int32_t)), 0);
-
- ifp->if_collisions += stats.sf_tx_single_colls +
- stats.sf_tx_multi_colls + stats.sf_tx_excess_colls;
-
- mii_tick(mii);
-
- if (!sc->sf_link && mii->mii_media_status & IFM_ACTIVE &&
- IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
- sc->sf_link++;
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- sf_start(ifp);
- }
-
- sc->sf_stat_ch = timeout(sf_stats_update, sc, hz);
-
- SF_UNLOCK(sc);
-}
-
-static void
-sf_watchdog(ifp)
- struct ifnet *ifp;
-{
- struct sf_softc *sc;
-
- sc = ifp->if_softc;
-
- SF_LOCK(sc);
-
- ifp->if_oerrors++;
- printf("sf%d: watchdog timeout\n", sc->sf_unit);
-
- sf_stop(sc);
- sf_reset(sc);
- sf_init(sc);
-
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- sf_start(ifp);
-
- SF_UNLOCK(sc);
-}
-
-static void
-sf_shutdown(dev)
- device_t dev;
-{
- struct sf_softc *sc;
-
- sc = device_get_softc(dev);
-
- sf_stop(sc);
-}
diff --git a/sys/dev/sf/if_sfreg.h b/sys/dev/sf/if_sfreg.h
deleted file mode 100644
index bbd704c..0000000
--- a/sys/dev/sf/if_sfreg.h
+++ /dev/null
@@ -1,1064 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998, 1999
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * Registers for the Adaptec AIC-6915 Starfire. The Starfire has a 512K
- * register space. These registers can be accessed in the following way:
- * - PCI config registers are always accessible through PCI config space
- * - Full 512K space mapped into memory using PCI memory mapped access
- * - 256-byte I/O space mapped through PCI I/O access
- * - Full 512K space mapped through indirect I/O using PCI I/O access
- * It's possible to use either memory mapped mode or I/O mode to access
- * the registers, but memory mapped is usually the easiest. All registers
- * are 32 bits wide and must be accessed using 32-bit operations.
- */
-
-/*
- * Adaptec PCI vendor ID.
- */
-#define AD_VENDORID 0x9004
-
-/*
- * AIC-6915 PCI device ID.
- */
-#define AD_DEVICEID_STARFIRE 0x6915
-
-/*
- * AIC-6915 subsystem IDs. Adaptec uses the subsystem ID to identify
- * the exact kind of NIC on which the ASIC is mounted. Currently there
- * are six different variations. Note: the Adaptec manual lists code 0x28
- * for two different NICs: the 62044 and the 69011/TX. This is a typo:
- * the code for the 62044 is really 0x18.
- *
- * Note that there also appears to be an 0x19 code for a newer rev
- * 62044 card.
- */
-#define AD_SUBSYSID_62011_REV0 0x0008 /* single port 10/100baseTX 64-bit */
-#define AD_SUBSYSID_62011_REV1 0x0009 /* single port 10/100baseTX 64-bit */
-#define AD_SUBSYSID_62022 0x0010 /* dual port 10/100baseTX 64-bit */
-#define AD_SUBSYSID_62044_REV0 0x0018 /* quad port 10/100baseTX 64-bit */
-#define AD_SUBSYSID_62044_REV1 0x0019 /* quad port 10/100baseTX 64-bit */
-#define AD_SUBSYSID_62020 0x0020 /* single port 10/100baseFX 64-bit */
-#define AD_SUBSYSID_69011 0x0028 /* single port 10/100baseTX 32-bit */
-
-/*
- * Starfire internal register space map. The entire register space
- * is available using PCI memory mapped mode. The SF_RMAP_INTREG
- * space is available using PCI I/O mode. The entire space can be
- * accessed using indirect I/O using the indirect I/O addr and
- * indirect I/O data registers located within the SF_RMAP_INTREG space.
- */
-#define SF_RMAP_ROMADDR_BASE 0x00000 /* Expansion ROM space */
-#define SF_RMAP_ROMADDR_MAX 0x3FFFF
-
-#define SF_RMAP_EXGPIO_BASE 0x40000 /* External general purpose regs */
-#define SF_RMAP_EXGPIO_MAX 0x3FFFF
-
-#define SF_RMAP_INTREG_BASE 0x50000 /* Internal functional registers */
-#define SF_RMAP_INTREG_MAX 0x500FF
-#define SF_RMAP_GENREG_BASE 0x50100 /* General purpose registers */
-#define SF_RMAP_GENREG_MAX 0x5FFFF
-
-#define SF_RMAP_FIFO_BASE 0x60000
-#define SF_RMAP_FIFO_MAX 0x6FFFF
-
-#define SF_RMAP_STS_BASE 0x70000
-#define SF_RMAP_STS_MAX 0x70083
-
-#define SF_RMAP_RSVD_BASE 0x70084
-#define SF_RMAP_RSVD_MAX 0x7FFFF
-
-/*
- * PCI config header registers, 0x0000 to 0x003F
- */
-#define SF_PCI_VENDOR_ID 0x0000
-#define SF_PCI_DEVICE_ID 0x0002
-#define SF_PCI_COMMAND 0x0004
-#define SF_PCI_STATUS 0x0006
-#define SF_PCI_REVID 0x0008
-#define SF_PCI_CLASSCODE 0x0009
-#define SF_PCI_CACHELEN 0x000C
-#define SF_PCI_LATENCY_TIMER 0x000D
-#define SF_PCI_HEADER_TYPE 0x000E
-#define SF_PCI_LOMEM 0x0010
-#define SF_PCI_LOIO 0x0014
-#define SF_PCI_SUBVEN_ID 0x002C
-#define SF_PCI_SYBSYS_ID 0x002E
-#define SF_PCI_BIOSROM 0x0030
-#define SF_PCI_INTLINE 0x003C
-#define SF_PCI_INTPIN 0x003D
-#define SF_PCI_MINGNT 0x003E
-#define SF_PCI_MINLAT 0x003F
-
-/*
- * PCI registers, 0x0040 to 0x006F
- */
-#define SF_PCI_DEVCFG 0x0040
-#define SF_BACCTL 0x0044
-#define SF_PCI_MON1 0x0048
-#define SF_PCI_MON2 0x004C
-#define SF_PCI_CAPID 0x0050 /* 8 bits */
-#define SF_PCI_NEXTPTR 0x0051 /* 8 bits */
-#define SF_PCI_PWRMGMTCAP 0x0052 /* 16 bits */
-#define SF_PCI_PWRMGMTCTRL 0x0054 /* 16 bits */
-#define SF_PCI_PME_EVENT 0x0058
-#define SF_PCI_EECTL 0x0060
-#define SF_PCI_COMPLIANCE 0x0064
-#define SF_INDIRECTIO_ADDR 0x0068
-#define SF_INDIRECTIO_DATA 0x006C
-
-#define SF_PCIDEVCFG_RESET 0x00000001
-#define SF_PCIDEVCFG_FORCE64 0x00000002
-#define SF_PCIDEVCFG_SYSTEM64 0x00000004
-#define SF_PCIDEVCFG_RSVD0 0x00000008
-#define SF_PCIDEVCFG_INCR_INB 0x00000010
-#define SF_PCIDEVCFG_ABTONPERR 0x00000020
-#define SF_PCIDEVCFG_STPONPERR 0x00000040
-#define SF_PCIDEVCFG_MR_ENB 0x00000080
-#define SF_PCIDEVCFG_FIFOTHR 0x00000F00
-#define SF_PCIDEVCFG_STPONCA 0x00001000
-#define SF_PCIDEVCFG_PCIMEN 0x00002000 /* enable PCI bus master */
-#define SF_PCIDEVCFG_LATSTP 0x00004000
-#define SF_PCIDEVCFG_BYTE_ENB 0x00008000
-#define SF_PCIDEVCFG_EECSWIDTH 0x00070000
-#define SF_PCIDEVCFG_STPMWCA 0x00080000
-#define SF_PCIDEVCFG_REGCSWIDTH 0x00700000
-#define SF_PCIDEVCFG_INTR_ENB 0x00800000
-#define SF_PCIDEVCFG_DPR_ENB 0x01000000
-#define SF_PCIDEVCFG_RSVD1 0x02000000
-#define SF_PCIDEVCFG_RSVD2 0x04000000
-#define SF_PCIDEVCFG_STA_ENB 0x08000000
-#define SF_PCIDEVCFG_RTA_ENB 0x10000000
-#define SF_PCIDEVCFG_RMA_ENB 0x20000000
-#define SF_PCIDEVCFG_SSE_ENB 0x40000000
-#define SF_PCIDEVCFG_DPE_ENB 0x80000000
-
-#define SF_BACCTL_BACDMA_ENB 0x00000001
-#define SF_BACCTL_PREFER_RXDMA 0x00000002
-#define SF_BACCTL_PREFER_TXDMA 0x00000004
-#define SF_BACCTL_SINGLE_DMA 0x00000008
-#define SF_BACCTL_SWAPMODE_DATA 0x00000030
-#define SF_BACCTL_SWAPMODE_DESC 0x000000C0
-
-#define SF_SWAPMODE_LE 0x00000000
-#define SF_SWAPMODE_BE 0x00000010
-
-#define SF_PSTATE_MASK 0x0003
-#define SF_PSTATE_D0 0x0000
-#define SF_PSTATE_D1 0x0001
-#define SF_PSTATE_D2 0x0002
-#define SF_PSTATE_D3 0x0003
-#define SF_PME_EN 0x0010
-#define SF_PME_STATUS 0x8000
-
-
-/*
- * Ethernet registers 0x0070 to 0x00FF
- */
-#define SF_GEN_ETH_CTL 0x0070
-#define SF_TIMER_CTL 0x0074
-#define SF_CURTIME 0x0078
-#define SF_ISR 0x0080
-#define SF_ISR_SHADOW 0x0084
-#define SF_IMR 0x0088
-#define SF_GPIO 0x008C
-#define SF_TXDQ_CTL 0x0090
-#define SF_TXDQ_ADDR_HIPRIO 0x0094
-#define SF_TXDQ_ADDR_LOPRIO 0x0098
-#define SF_TXDQ_ADDR_HIADDR 0x009C
-#define SF_TXDQ_PRODIDX 0x00A0
-#define SF_TXDQ_CONSIDX 0x00A4
-#define SF_TXDMA_STS1 0x00A8
-#define SF_TXDMA_STS2 0x00AC
-#define SF_TX_FRAMCTL 0x00B0
-#define SF_TXCQ_ADDR_HI 0x00B4
-#define SF_TXCQ_CTL 0x00B8
-#define SF_RXCQ_CTL_1 0x00BC
-#define SF_RXCQ_CTL_2 0x00C0
-#define SF_CQ_CONSIDX 0x00C4
-#define SF_CQ_PRODIDX 0x00C8
-#define SF_CQ_RXQ2 0x00CC
-#define SF_RXDMA_CTL 0x00D0
-#define SF_RXDQ_CTL_1 0x00D4
-#define SF_RXDQ_CTL_2 0x00D8
-#define SF_RXDQ_ADDR_HIADDR 0x00DC
-#define SF_RXDQ_ADDR_Q1 0x00E0
-#define SF_RXDQ_ADDR_Q2 0x00E4
-#define SF_RXDQ_PTR_Q1 0x00E8
-#define SF_RXDQ_PTR_Q2 0x00EC
-#define SF_RXDMA_STS 0x00F0
-#define SF_RXFILT 0x00F4
-#define SF_RX_FRAMETEST_OUT 0x00F8
-
-/* Ethernet control register */
-#define SF_ETHCTL_RX_ENB 0x00000001
-#define SF_ETHCTL_TX_ENB 0x00000002
-#define SF_ETHCTL_RXDMA_ENB 0x00000004
-#define SF_ETHCTL_TXDMA_ENB 0x00000008
-#define SF_ETHCTL_RXGFP_ENB 0x00000010
-#define SF_ETHCTL_TXGFP_ENB 0x00000020
-#define SF_ETHCTL_SOFTINTR 0x00000800
-
-/* Timer control register */
-#define SF_TIMER_IMASK_INTERVAL 0x0000001F
-#define SF_TIMER_IMASK_MODE 0x00000060
-#define SF_TIMER_SMALLFRAME_BYP 0x00000100
-#define SF_TIMER_SMALLRX_FRAME 0x00000600
-#define SF_TIMER_TIMES_TEN 0x00000800
-#define SF_TIMER_RXHIPRIO_BYP 0x00001000
-#define SF_TIMER_TX_DMADONE_DLY 0x00002000
-#define SF_TIMER_TX_QDONE_DLY 0x00004000
-#define SF_TIMER_TX_FRDONE_DLY 0x00008000
-#define SF_TIMER_GENTIMER 0x00FF0000
-#define SF_TIMER_ONESHOT 0x01000000
-#define SF_TIMER_GENTIMER_RES 0x02000000
-#define SF_TIMER_TIMEST_RES 0x04000000
-#define SF_TIMER_RXQ2DONE_DLY 0x10000000
-#define SF_TIMER_EARLYRX2_DLY 0x20000000
-#define SF_TIMER_RXQ1DONE_DLY 0x40000000
-#define SF_TIMER_EARLYRX1_DLY 0x80000000
-
-/* Interrupt status register */
-#define SF_ISR_PCIINT_ASSERTED 0x00000001
-#define SF_ISR_GFP_TX 0x00000002
-#define SF_ISR_GFP_RX 0x00000004
-#define SF_ISR_TX_BADID_HIPRIO 0x00000008
-#define SF_ISR_TX_BADID_LOPRIO 0x00000010
-#define SF_ISR_NO_TX_CSUM 0x00000020
-#define SF_ISR_RXDQ2_NOBUFS 0x00000040
-#define SF_ISR_RXGFP_NORESP 0x00000080
-#define SF_ISR_RXDQ1_DMADONE 0x00000100
-#define SF_ISR_RXDQ2_DMADONE 0x00000200
-#define SF_ISR_RXDQ1_EARLY 0x00000400
-#define SF_ISR_RXDQ2_EARLY 0x00000800
-#define SF_ISR_TX_QUEUEDONE 0x00001000
-#define SF_ISR_TX_DMADONE 0x00002000
-#define SF_ISR_TX_TXDONE 0x00004000
-#define SF_ISR_NORMALINTR 0x00008000
-#define SF_ISR_RXDQ1_NOBUFS 0x00010000
-#define SF_ISR_RXCQ2_NOBUFS 0x00020000
-#define SF_ISR_TX_LOFIFO 0x00040000
-#define SF_ISR_DMAERR 0x00080000
-#define SF_ISR_PCIINT 0x00100000
-#define SF_ISR_TXCQ_NOBUFS 0x00200000
-#define SF_ISR_RXCQ1_NOBUFS 0x00400000
-#define SF_ISR_SOFTINTR 0x00800000
-#define SF_ISR_GENTIMER 0x01000000
-#define SF_ISR_ABNORMALINTR 0x02000000
-#define SF_ISR_RSVD0 0x04000000
-#define SF_ISR_STATSOFLOW 0x08000000
-#define SF_ISR_GPIO 0xF0000000
-
-/*
- * Shadow interrupt status register. Unlike the normal IRQ register,
- * reading bits here does not automatically cause them to reset.
- */
-#define SF_SISR_PCIINT_ASSERTED 0x00000001
-#define SF_SISR_GFP_TX 0x00000002
-#define SF_SISR_GFP_RX 0x00000004
-#define SF_SISR_TX_BADID_HIPRIO 0x00000008
-#define SF_SISR_TX_BADID_LOPRIO 0x00000010
-#define SF_SISR_NO_TX_CSUM 0x00000020
-#define SF_SISR_RXDQ2_NOBUFS 0x00000040
-#define SF_SISR_RXGFP_NORESP 0x00000080
-#define SF_SISR_RXDQ1_DMADONE 0x00000100
-#define SF_SISR_RXDQ2_DMADONE 0x00000200
-#define SF_SISR_RXDQ1_EARLY 0x00000400
-#define SF_SISR_RXDQ2_EARLY 0x00000800
-#define SF_SISR_TX_QUEUEDONE 0x00001000
-#define SF_SISR_TX_DMADONE 0x00002000
-#define SF_SISR_TX_TXDONE 0x00004000
-#define SF_SISR_NORMALINTR 0x00008000
-#define SF_SISR_RXDQ1_NOBUFS 0x00010000
-#define SF_SISR_RXCQ2_NOBUFS 0x00020000
-#define SF_SISR_TX_LOFIFO 0x00040000
-#define SF_SISR_DMAERR 0x00080000
-#define SF_SISR_PCIINT 0x00100000
-#define SF_SISR_TXCQ_NOBUFS 0x00200000
-#define SF_SISR_RXCQ1_NOBUFS 0x00400000
-#define SF_SISR_SOFTINTR 0x00800000
-#define SF_SISR_GENTIMER 0x01000000
-#define SF_SISR_ABNORMALINTR 0x02000000
-#define SF_SISR_RSVD0 0x04000000
-#define SF_SISR_STATSOFLOW 0x08000000
-#define SF_SISR_GPIO 0xF0000000
-
-/* Interrupt mask register */
-#define SF_IMR_PCIINT_ASSERTED 0x00000001
-#define SF_IMR_GFP_TX 0x00000002
-#define SF_IMR_GFP_RX 0x00000004
-#define SF_IMR_TX_BADID_HIPRIO 0x00000008
-#define SF_IMR_TX_BADID_LOPRIO 0x00000010
-#define SF_IMR_NO_TX_CSUM 0x00000020
-#define SF_IMR_RXDQ2_NOBUFS 0x00000040
-#define SF_IMR_RXGFP_NORESP 0x00000080
-#define SF_IMR_RXDQ1_DMADONE 0x00000100
-#define SF_IMR_RXDQ2_DMADONE 0x00000200
-#define SF_IMR_RXDQ1_EARLY 0x00000400
-#define SF_IMR_RXDQ2_EARLY 0x00000800
-#define SF_IMR_TX_QUEUEDONE 0x00001000
-#define SF_IMR_TX_DMADONE 0x00002000
-#define SF_IMR_TX_TXDONE 0x00004000
-#define SF_IMR_NORMALINTR 0x00008000
-#define SF_IMR_RXDQ1_NOBUFS 0x00010000
-#define SF_IMR_RXCQ2_NOBUFS 0x00020000
-#define SF_IMR_TX_LOFIFO 0x00040000
-#define SF_IMR_DMAERR 0x00080000
-#define SF_IMR_PCIINT 0x00100000
-#define SF_IMR_TXCQ_NOBUFS 0x00200000
-#define SF_IMR_RXCQ1_NOBUFS 0x00400000
-#define SF_IMR_SOFTINTR 0x00800000
-#define SF_IMR_GENTIMER 0x01000000
-#define SF_IMR_ABNORMALINTR 0x02000000
-#define SF_IMR_RSVD0 0x04000000
-#define SF_IMR_STATSOFLOW 0x08000000
-#define SF_IMR_GPIO 0xF0000000
-
-#define SF_INTRS \
- (SF_IMR_RXDQ2_NOBUFS|SF_IMR_RXDQ1_DMADONE|SF_IMR_RXDQ2_DMADONE| \
- SF_IMR_TX_TXDONE|SF_IMR_RXDQ1_NOBUFS|SF_IMR_RXDQ2_DMADONE| \
- SF_IMR_NORMALINTR|SF_IMR_ABNORMALINTR|SF_IMR_TXCQ_NOBUFS| \
- SF_IMR_RXCQ1_NOBUFS|SF_IMR_RXCQ2_NOBUFS|SF_IMR_STATSOFLOW| \
- SF_IMR_TX_LOFIFO)
-
-/* TX descriptor queue control registers */
-#define SF_TXDQCTL_DESCTYPE 0x00000007
-#define SF_TXDQCTL_NODMACMP 0x00000008
-#define SF_TXDQCTL_MINSPACE 0x00000070
-#define SF_TXDQCTL_64BITADDR 0x00000080
-#define SF_TXDQCTL_BURSTLEN 0x00003F00
-#define SF_TXDQCTL_SKIPLEN 0x001F0000
-#define SF_TXDQCTL_HIPRIOTHRESH 0xFF000000
-
-#define SF_TXBUFDESC_TYPE0 0x00000000
-#define SF_TXBUFDESC_TYPE1 0x00000001
-#define SF_TXBUFDESC_TYPE2 0x00000002
-#define SF_TXBUFDESC_TYPE3 0x00000003
-#define SF_TXBUFDESC_TYPE4 0x00000004
-
-#define SF_TXMINSPACE_UNLIMIT 0x00000000
-#define SF_TXMINSPACE_32BYTES 0x00000010
-#define SF_TXMINSPACE_64BYTES 0x00000020
-#define SF_TXMINSPACE_128BYTES 0x00000030
-#define SF_TXMINSPACE_256BYTES 0x00000040
-
-#define SF_TXSKIPLEN_0BYTES 0x00000000
-#define SF_TXSKIPLEN_8BYTES 0x00010000
-#define SF_TXSKIPLEN_16BYTES 0x00020000
-#define SF_TXSKIPLEN_24BYTES 0x00030000
-#define SF_TXSKIPLEN_32BYTES 0x00040000
-
-/* TX frame control register */
-#define SF_TXFRMCTL_TXTHRESH 0x000000FF
-#define SF_TXFRMCTL_CPLAFTERTX 0x00000100
-#define SF_TXFRMCRL_DEBUG 0x0000FE00
-#define SF_TXFRMCTL_STATUS 0x01FF0000
-#define SF_TXFRMCTL_MAC_TXIF 0xFE000000
-
-/* TX completion queue control register */
-#define SF_TXCQ_THRESH 0x0000000F
-#define SF_TXCQ_COMMON 0x00000010
-#define SF_TXCQ_SIZE 0x00000020
-#define SF_TXCQ_WRITEENB 0x00000040
-#define SF_TXCQ_USE_64BIT 0x00000080
-#define SF_TXCQ_ADDR 0xFFFFFF00
-
-/* RX completion queue control register */
-#define SF_RXCQ_THRESH 0x0000000F
-#define SF_RXCQ_TYPE 0x00000030
-#define SF_RXCQ_WRITEENB 0x00000040
-#define SF_RXCQ_USE_64BIT 0x00000080
-#define SF_RXCQ_ADDR 0xFFFFFF00
-
-#define SF_RXCQTYPE_0 0x00000000
-#define SF_RXCQTYPE_1 0x00000010
-#define SF_RXCQTYPE_2 0x00000020
-#define SF_RXCQTYPE_3 0x00000030
-
-/* TX descriptor queue producer index register */
-#define SF_TXDQ_PRODIDX_LOPRIO 0x000007FF
-#define SF_TXDQ_PRODIDX_HIPRIO 0x07FF0000
-
-/* TX descriptor queue consumer index register */
-#define SF_TXDQ_CONSIDX_LOPRIO 0x000007FF
-#define SF_TXDQ_CONSIDX_HIPRIO 0x07FF0000
-
-/* Completion queue consumer index register */
-#define SF_CQ_CONSIDX_RXQ1 0x000003FF
-#define SF_CQ_CONSIDX_RXTHRMODE 0x00008000
-#define SF_CQ_CONSIDX_TXQ 0x03FF0000
-#define SF_CQ_CONSIDX_TXTHRMODE 0x80000000
-
-/* Completion queue producer index register */
-#define SF_CQ_PRODIDX_RXQ1 0x000003FF
-#define SF_CQ_PRODIDX_TXQ 0x03FF0000
-
-/* RX completion queue 2 consumer/producer index register */
-#define SF_CQ_RXQ2_CONSIDX 0x000003FF
-#define SF_CQ_RXQ2_RXTHRMODE 0x00008000
-#define SF_CQ_RXQ2_PRODIDX 0x03FF0000
-
-#define SF_CQ_RXTHRMODE_INT_ON 0x00008000
-#define SF_CQ_RXTHRMODE_INT_OFF 0x00000000
-#define SF_CQ_TXTHRMODE_INT_ON 0x80000000
-#define SF_CQ_TXTHRMODE_INT_OFF 0x00000000
-
-#define SF_IDX_LO(x) ((x) & 0x000007FF)
-#define SF_IDX_HI(x) (((x) >> 16) & 0x000007FF)
-
-/* RX DMA control register */
-#define SF_RXDMA_BURSTSIZE 0x0000007F
-#define SF_RXDMA_FPTESTMODE 0x00000080
-#define SF_RXDMA_HIPRIOTHRESH 0x00000F00
-#define SF_RXDMA_RXEARLYTHRESH 0x0001F000
-#define SF_RXDMA_DMACRC 0x00040000
-#define SF_RXDMA_USEBKUPQUEUE 0x00080000
-#define SF_RXDMA_QUEUEMODE 0x00700000
-#define SF_RXDMA_RXCQ2_ON 0x00800000
-#define SF_RXDMA_CSUMMODE 0x03000000
-#define SF_RXDMA_DMAPAUSEPKTS 0x04000000
-#define SF_RXDMA_DMACTLPKTS 0x08000000
-#define SF_RXDMA_DMACRXERRPKTS 0x10000000
-#define SF_RXDMA_DMABADPKTS 0x20000000
-#define SF_RXDMA_DMARUNTS 0x40000000
-#define SF_RXDMA_REPORTBADPKTS 0x80000000
-
-#define SF_RXDQMODE_Q1ONLY 0x00100000
-#define SF_RXDQMODE_Q2_ON_FP 0x00200000
-#define SF_RXDQMODE_Q2_ON_SHORT 0x00300000
-#define SF_RXDQMODE_Q2_ON_PRIO 0x00400000
-#define SF_RXDQMODE_SPLITHDR 0x00500000
-
-#define SF_RXCSUMMODE_IGNORE 0x00000000
-#define SF_RXCSUMMODE_REJECT_BAD_TCP 0x01000000
-#define SF_RXCSUMMODE_REJECT_BAD_TCPUDP 0x02000000
-#define SF_RXCSUMMODE_RSVD 0x03000000
-
-/* RX descriptor queue control registers */
-#define SF_RXDQCTL_MINDESCTHR 0x0000007F
-#define SF_RXDQCTL_Q1_WE 0x00000080
-#define SF_RXDQCTL_DESCSPACE 0x00000700
-#define SF_RXDQCTL_64BITDADDR 0x00000800
-#define SF_RXDQCTL_64BITBADDR 0x00001000
-#define SF_RXDQCTL_VARIABLE 0x00002000
-#define SF_RXDQCTL_ENTRIES 0x00004000
-#define SF_RXDQCTL_PREFETCH 0x00008000
-#define SF_RXDQCTL_BUFLEN 0xFFFF0000
-
-#define SF_DESCSPACE_4BYTES 0x00000000
-#define SF_DESCSPACE_8BYTES 0x00000100
-#define SF_DESCSPACE_16BYTES 0x00000200
-#define SF_DESCSPACE_32BYTES 0x00000300
-#define SF_DESCSPACE_64BYTES 0x00000400
-#define SF_DESCSPACE_128_BYTES 0x00000500
-
-/* RX buffer consumer/producer index registers */
-#define SF_RXDQ_PRODIDX 0x000007FF
-#define SF_RXDQ_CONSIDX 0x07FF0000
-
-/* RX filter control register */
-#define SF_RXFILT_PROMISC 0x00000001
-#define SF_RXFILT_ALLMULTI 0x00000002
-#define SF_RXFILT_BROAD 0x00000004
-#define SF_RXFILT_HASHPRIO 0x00000008
-#define SF_RXFILT_HASHMODE 0x00000030
-#define SF_RXFILT_PERFMODE 0x000000C0
-#define SF_RXFILT_VLANMODE 0x00000300
-#define SF_RXFILT_WAKEMODE 0x00000C00
-#define SF_RXFILT_MULTI_NOBROAD 0x00001000
-#define SF_RXFILT_MIN_VLANPRIO 0x0000E000
-#define SF_RXFILT_PEFECTPRIO 0xFFFF0000
-
-/* Hash filtering mode */
-#define SF_HASHMODE_OFF 0x00000000
-#define SF_HASHMODE_WITHVLAN 0x00000010
-#define SF_HASHMODE_ANYVLAN 0x00000020
-#define SF_HASHMODE_ANY 0x00000030
-
-/* Perfect filtering mode */
-#define SF_PERFMODE_OFF 0x00000000
-#define SF_PERFMODE_NORMAL 0x00000040
-#define SF_PERFMODE_INVERSE 0x00000080
-#define SF_PERFMODE_VLAN 0x000000C0
-
-/* VLAN mode */
-#define SF_VLANMODE_OFF 0x00000000
-#define SF_VLANMODE_NOSTRIP 0x00000100
-#define SF_VLANMODE_STRIP 0x00000200
-#define SF_VLANMODE_RSVD 0x00000300
-
-/* Wakeup mode */
-#define SF_WAKEMODE_OFF 0x00000000
-#define SF_WAKEMODE_FILTER 0x00000400
-#define SF_WAKEMODE_FP 0x00000800
-#define SF_WAKEMODE_HIPRIO 0x00000C00
-
-/*
- * Extra PCI registers 0x0100 to 0x0FFF
- */
-#define SF_PCI_TARGSTAT 0x0100
-#define SF_PCI_MASTSTAT1 0x0104
-#define SF_PCI_MASTSTAT2 0x0108
-#define SF_PCI_DMAHOSTADDR_LO 0x010C
-#define SF_BAC_DMADIAG0 0x0110
-#define SF_BAC_DMADIAG1 0x0114
-#define SF_BAC_DMADIAG2 0x0118
-#define SF_BAC_DMADIAG3 0x011C
-#define SF_PAR0 0x0120
-#define SF_PAR1 0x0124
-#define SF_PCICB_FUNCEVENT 0x0130
-#define SF_PCICB_FUNCEVENT_MASK 0x0134
-#define SF_PCICB_FUNCSTATE 0x0138
-#define SF_PCICB_FUNCFORCE 0x013C
-
-/*
- * Serial EEPROM registers 0x1000 to 0x1FFF
- * Presumeably the EEPROM is mapped into this 8K window.
- */
-#define SF_EEADDR_BASE 0x1000
-#define SF_EEADDR_MAX 0x1FFF
-
-#define SF_EE_NODEADDR 14
-
-/*
- * MII registers registers 0x2000 to 0x3FFF
- * There are 32 sets of 32 registers, one set for each possible
- * PHY address. Each 32 bit register is split into a 16-bit data
- * port and a couple of status bits.
- */
-
-#define SF_MIIADDR_BASE 0x2000
-#define SF_MIIADDR_MAX 0x3FFF
-#define SF_MII_BLOCKS 32
-
-#define SF_MII_DATAVALID 0x80000000
-#define SF_MII_BUSY 0x40000000
-#define SF_MII_DATAPORT 0x0000FFFF
-
-#define SF_PHY_REG(phy, reg) \
- (SF_MIIADDR_BASE + (phy * SF_MII_BLOCKS * sizeof(u_int32_t)) + \
- (reg * sizeof(u_int32_t)))
-
-/*
- * Ethernet extra registers 0x4000 to 0x4FFF
- */
-#define SF_TESTMODE 0x4000
-#define SF_RX_FRAMEPROC_CTL 0x4004
-#define SF_TX_FRAMEPROC_CTL 0x4008
-
-/*
- * MAC registers 0x5000 to 0x5FFF
- */
-#define SF_MACCFG_1 0x5000
-#define SF_MACCFG_2 0x5004
-#define SF_BKTOBKIPG 0x5008
-#define SF_NONBKTOBKIPG 0x500C
-#define SF_COLRETRY 0x5010
-#define SF_MAXLEN 0x5014
-#define SF_TXNIBBLECNT 0x5018
-#define SF_TXBYTECNT 0x501C
-#define SF_RETXCNT 0x5020
-#define SF_RANDNUM 0x5024
-#define SF_RANDNUM_MASK 0x5028
-#define SF_TOTALTXCNT 0x5034
-#define SF_RXBYTECNT 0x5040
-#define SF_TXPAUSETIMER 0x5060
-#define SF_VLANTYPE 0x5064
-#define SF_MIISTATUS 0x5070
-
-#define SF_MACCFG1_HUGEFRAMES 0x00000001
-#define SF_MACCFG1_FULLDUPLEX 0x00000002
-#define SF_MACCFG1_AUTOPAD 0x00000004
-#define SF_MACCFG1_HDJAM 0x00000008
-#define SF_MACCFG1_DELAYCRC 0x00000010
-#define SF_MACCFG1_NOBACKOFF 0x00000020
-#define SF_MACCFG1_LENGTHCHECK 0x00000040
-#define SF_MACCFG1_PUREPREAMBLE 0x00000080
-#define SF_MACCFG1_PASSALLRX 0x00000100
-#define SF_MACCFG1_PREAM_DETCNT 0x00000200
-#define SF_MACCFG1_RX_FLOWENB 0x00000400
-#define SF_MACCFG1_TX_FLOWENB 0x00000800
-#define SF_MACCFG1_TESTMODE 0x00003000
-#define SF_MACCFG1_MIILOOPBK 0x00004000
-#define SF_MACCFG1_SOFTRESET 0x00008000
-
-/*
- * There are the recommended IPG nibble counter settings
- * specified in the Adaptec manual for full duplex and
- * half duplex operation.
- */
-#define SF_IPGT_FDX 0x15
-#define SF_IPGT_HDX 0x11
-
-/*
- * RX filter registers 0x6000 to 0x6FFF
- */
-#define SF_RXFILT_PERFECT_BASE 0x6000
-#define SF_RXFILT_PERFECT_MAX 0x60FF
-#define SF_RXFILT_PERFECT_SKIP 0x0010
-#define SF_RXFILT_PERFECT_CNT 0x0010
-
-#define SF_RXFILT_HASH_BASE 0x6100
-#define SF_RXFILT_HASH_MAX 0x62FF
-#define SF_RXFILT_HASH_SKIP 0x0010
-#define SF_RXFILT_HASH_CNT 0x001F
-#define SF_RXFILT_HASH_ADDROFF 0x0000
-#define SF_RXFILT_HASH_PRIOOFF 0x0004
-#define SF_RXFILT_HASH_VLANOFF 0x0008
-
-/*
- * Statistics registers 0x7000 to 0x7FFF
- */
-#define SF_STATS_BASE 0x7000
-#define SF_STATS_END 0x7FFF
-
-/*
- * TX frame processor instruction space 0x8000 to 0x9FFF
- */
-
-/*
- * RX frame processor instruction space 0xA000 to 0xBFFF
- */
-
-/*
- * Ethernet FIFO access space 0xC000 to 0xDFFF
- */
-
-/*
- * Reserved 0xE000 to 0xFFFF
- */
-
-/*
- * Descriptor data structures.
- */
-
-
-/* Receive descriptor formats. */
-#define SF_RX_MINSPACING 8
-#define SF_RX_DLIST_CNT 256
-#define SF_RX_CLIST_CNT 1024
-#define SF_RX_HOSTADDR(x) (((x) >> 2) & 0x3FFFFFFF)
-
-/*
- * RX buffer descriptor type 0, 32-bit addressing. Note that we
- * program the RX buffer queue control register(s) to allow a
- * descriptor spacing of 16 bytes, which leaves room after each
- * descriptor to store a pointer to the mbuf for each buffer.
- */
-struct sf_rx_bufdesc_type0 {
- u_int32_t sf_valid:1,
- sf_end:1,
- sf_addrlo:30;
- u_int32_t sf_pad0;
-#ifdef __i386__
- u_int32_t sf_pad1;
-#endif
- struct mbuf *sf_mbuf;
-};
-
-/*
- * RX buffer descriptor type 0, 64-bit addressing.
- */
-struct sf_rx_bufdesc_type1 {
- u_int32_t sf_valid:1,
- sf_end:1,
- sf_addrlo:30;
- u_int32_t sf_addrhi;
-#ifdef __i386__
- u_int32_t sf_pad;
-#endif
- struct mbuf *sf_mbuf;
-};
-
-/*
- * RX completion descriptor, type 0 (short).
- */
-struct sf_rx_cmpdesc_type0 {
- u_int32_t sf_len:16,
- sf_endidx:11,
- sf_status1:3,
- sf_id:2;
-};
-
-/*
- * RX completion descriptor, type 1 (basic). Includes vlan ID
- * if this is a vlan-addressed packet, plus extended status.
- */
-struct sf_rx_cmpdesc_type1 {
- u_int32_t sf_len:16,
- sf_endidx:11,
- sf_status1:3,
- sf_id:2;
- u_int16_t sf_status2;
- u_int16_t sf_vlanid;
-};
-
-/*
- * RX completion descriptor, type 2 (checksum). Includes partial TCP/IP
- * checksum instead of vlan tag, plus extended status.
- */
-struct sf_rx_cmpdesc_type2 {
- u_int32_t sf_len:16,
- sf_endidx:11,
- sf_status1:3,
- sf_id:2;
- u_int16_t sf_status2;
- u_int16_t sf_cksum;
-};
-
-/*
- * RX completion descriptor type 3 (full). Includes timestamp, partial
- * TCP/IP checksum, vlan tag plus priority, two extended status fields.
- */
-struct sf_rx_cmpdesc_type3 {
- u_int32_t sf_len:16,
- sf_endidx:11,
- sf_status1:3,
- sf_id:2;
- u_int32_t sf_startidx:10,
- sf_status3:6,
- sf_status2:16;
- u_int16_t sf_cksum;
- u_int16_t sf_vlanid_prio;
- u_int32_t sf_timestamp;
-};
-
-#define SF_RXSTAT1_QUEUE 0x1
-#define SF_RXSTAT1_FIFOFULL 0x2
-#define SF_RXSTAT1_OK 0x4
-
- /* 0=unknown,5=unsupported */
-#define SF_RXSTAT2_FRAMETYPE 0x0007 /* 1=IPv4,2=IPv2,3=IPX,4=ICMP */
-#define SF_RXSTAT2_UDP 0x0008
-#define SF_RXSTAT2_TCP 0x0010
-#define SF_RXSTAT2_FRAG 0x0020
-#define SF_RXSTAT2_PCSUM_OK 0x0040 /* partial checksum ok */
-#define SF_RXSTAT2_CSUM_BAD 0x0080 /* TCP/IP checksum bad */
-#define SF_RXSTAT2_CSUM_OK 0x0100 /* TCP/IP checksum ok */
-#define SF_RXSTAT2_VLAN 0x0200
-#define SF_RXSTAT2_BADRXCODE 0x0400
-#define SF_RXSTAT2_DRIBBLE 0x0800
-#define SF_RXSTAT2_ISL_CRCERR 0x1000
-#define SF_RXSTAT2_CRCERR 0x2000
-#define SF_RXSTAT2_HASH 0x4000
-#define SF_RXSTAT2_PERFECT 0x8000
-
-#define SF_RXSTAT3_TRAILER 0x01
-#define SF_RXSTAT3_HEADER 0x02
-#define SF_RXSTAT3_CONTROL 0x04
-#define SF_RXSTAT3_PAUSE 0x08
-#define SF_RXSTAT3_ISL 0x10
-
-/*
- * Transmit descriptor formats.
- * Each transmit descriptor type allows for a skip field at the
- * start of each structure. The size of the skip field can vary,
- * however we always set it for 8 bytes, which is enough to hold
- * a pointer (32 bits on x86, 64-bits on alpha) that we can use
- * to hold the address of the head of the mbuf chain for the
- * frame or fragment associated with the descriptor. This saves
- * us from having to create a separate pointer array to hold
- * the mbuf addresses.
- */
-#define SF_TX_BUFDESC_ID 0xB
-#define SF_MAXFRAGS 14
-#define SF_TX_MINSPACING 128
-#define SF_TX_DLIST_CNT 128
-#define SF_TX_DLIST_SIZE 16384
-#define SF_TX_SKIPLEN 1
-#define SF_TX_CLIST_CNT 1024
-
-struct sf_frag {
- u_int32_t sf_addr;
- u_int16_t sf_fraglen;
- u_int16_t sf_pktlen;
-};
-
-struct sf_frag_msdos {
- u_int16_t sf_pktlen;
- u_int16_t sf_fraglen;
- u_int32_t sf_addr;
-};
-
-/*
- * TX frame descriptor type 0, 32-bit addressing. One descriptor can
- * be used to map multiple packet fragments. We use this format since
- * BSD networking fragments packet data across mbuf chains. Note that
- * the number of fragments can be variable depending on how the descriptor
- * spacing is specified in the TX descriptor queue control register.
- * We always use a spacing of 128 bytes, and a skipfield length of 8
- * bytes: this means 16 bytes for the descriptor, including the skipfield,
- * with 121 bytes left for fragment maps. Each fragment requires 8 bytes,
- * which allows for 14 fragments per descriptor. The total size of the
- * transmit buffer queue is limited to 16384 bytes, so with a spacing of
- * 128 bytes per descriptor, we have room for 128 descriptors in the queue.
- */
-struct sf_tx_bufdesc_type0 {
-#ifdef __i386__
- u_int32_t sf_pad;
-#endif
- struct mbuf *sf_mbuf;
- u_int32_t sf_rsvd0:24,
- sf_crcen:1,
- sf_caltcp:1,
- sf_end:1,
- sf_intr:1,
- sf_id:4;
- u_int8_t sf_fragcnt;
- u_int8_t sf_rsvd2;
- u_int16_t sf_rsvd1;
- struct sf_frag sf_frags[14];
-};
-
-/*
- * TX buffer descriptor type 1, 32-bit addressing. Each descriptor
- * maps a single fragment.
- */
-struct sf_tx_bufdesc_type1 {
-#ifdef __i386__
- u_int32_t sf_pad;
-#endif
- struct mbuf *sf_mbuf;
- u_int32_t sf_fraglen:16,
- sf_fragcnt:8,
- sf_crcen:1,
- sf_caltcp:1,
- sf_end:1,
- sf_intr:1,
- sf_id:4;
- u_int32_t sf_addr;
-};
-
-/*
- * TX buffer descriptor type 2, 64-bit addressing. Each descriptor
- * maps a single fragment.
- */
-struct sf_tx_bufdesc_type2 {
-#ifdef __i386__
- u_int32_t sf_pad;
-#endif
- struct mbuf *sf_mbuf;
- u_int32_t sf_fraglen:16,
- sf_fragcnt:8,
- sf_crcen:1,
- sf_caltcp:1,
- sf_end:1,
- sf_intr:1,
- sf_id:4;
- u_int32_t sf_addrlo;
- u_int32_t sf_addrhi;
-};
-
-/* TX buffer descriptor type 3 is not defined. */
-
-/*
- * TX frame descriptor type 4, 32-bit addressing. This is a special
- * case of the type 0 descriptor, identical except that the fragment
- * address and length fields are ordered differently. This is done
- * to optimize copies in MS-DOS and OS/2 drivers.
- */
-struct sf_tx_bufdesc_type4 {
-#ifdef __i386__
- u_int32_t sf_pad;
-#endif
- struct mbuf *sf_mbuf;
- u_int32_t sf_rsvd0:24,
- sf_crcen:1,
- sf_caltcp:1,
- sf_end:1,
- sf_intr:1,
- sf_id:4;
- u_int8_t sf_fragcnt;
- u_int8_t sf_rsvd2;
- u_int16_t sf_rsvd1;
- struct sf_frag_msdos sf_frags[14];
-};
-
-/*
- * Transmit completion queue descriptor formats.
- */
-
-/*
- * Transmit DMA completion descriptor, type 0.
- */
-#define SF_TXCMPTYPE_DMA 0x4
-struct sf_tx_cmpdesc_type0 {
- u_int32_t sf_index:15,
- sf_priority:1,
- sf_timestamp:13,
- sf_type:3;
-};
-
-/*
- * Transmit completion descriptor, type 1.
- */
-#define SF_TXCMPTYPE_TX 0x5
-struct sf_tx_cmpdesc_type1 {
- u_int32_t sf_index:15,
- sf_priority:1,
- sf_txstat:13,
- sf_type:3;
-};
-
-#define SF_TXSTAT_CRCERR 0x0001
-#define SF_TXSTAT_LENCHECKERR 0x0002
-#define SF_TXSTAT_LENRANGEERR 0x0004
-#define SF_TXSTAT_TX_OK 0x0008
-#define SF_TXSTAT_TX_DEFERED 0x0010
-#define SF_TXSTAT_EXCESS_DEFER 0x0020
-#define SF_TXSTAT_EXCESS_COLL 0x0040
-#define SF_TXSTAT_LATE_COLL 0x0080
-#define SF_TXSTAT_TOOBIG 0x0100
-#define SF_TXSTAT_TX_UNDERRUN 0x0200
-#define SF_TXSTAT_CTLFRAME_OK 0x0400
-#define SF_TXSTAT_PAUSEFRAME_OK 0x0800
-#define SF_TXSTAT_PAUSED 0x1000
-
-/* Statistics counters. */
-struct sf_stats {
- u_int32_t sf_tx_frames;
- u_int32_t sf_tx_single_colls;
- u_int32_t sf_tx_multi_colls;
- u_int32_t sf_tx_crcerrs;
- u_int32_t sf_tx_bytes;
- u_int32_t sf_tx_defered;
- u_int32_t sf_tx_late_colls;
- u_int32_t sf_tx_pause_frames;
- u_int32_t sf_tx_control_frames;
- u_int32_t sf_tx_excess_colls;
- u_int32_t sf_tx_excess_defer;
- u_int32_t sf_tx_mcast_frames;
- u_int32_t sf_tx_bcast_frames;
- u_int32_t sf_tx_frames_lost;
- u_int32_t sf_rx_rx_frames;
- u_int32_t sf_rx_crcerrs;
- u_int32_t sf_rx_alignerrs;
- u_int32_t sf_rx_bytes;
- u_int32_t sf_rx_control_frames;
- u_int32_t sf_rx_unsup_control_frames;
- u_int32_t sf_rx_giants;
- u_int32_t sf_rx_runts;
- u_int32_t sf_rx_jabbererrs;
- u_int32_t sf_rx_pkts_64;
- u_int32_t sf_rx_pkts_65_127;
- u_int32_t sf_rx_pkts_128_255;
- u_int32_t sf_rx_pkts_256_511;
- u_int32_t sf_rx_pkts_512_1023;
- u_int32_t sf_rx_pkts_1024_1518;
- u_int32_t sf_rx_frames_lost;
- u_int16_t sf_tx_underruns;
- u_int16_t sf_pad;
-};
-
-/*
- * register space access macros
- */
-#define CSR_WRITE_4(sc, reg, val) \
- bus_space_write_4(sc->sf_btag, sc->sf_bhandle, reg, val)
-
-#define CSR_READ_4(sc, reg) \
- bus_space_read_4(sc->sf_btag, sc->sf_bhandle, reg)
-
-#define CSR_READ_1(sc, reg) \
- bus_space_read_1(sc->sf_btag, sc->sf_bhandle, reg)
-
-
-struct sf_type {
- u_int16_t sf_vid;
- u_int16_t sf_did;
- char *sf_name;
-};
-
-#define SF_INC(x, y) (x) = (x + 1) % y
-
-#define ETHER_ALIGN 2
-
-/*
- * Note: alignment is important here: each list must be aligned to
- * a 256-byte boundary. It turns out that each ring is some multiple
- * of 4K in length, so we can stack them all on top of each other
- * and just worry about aligning the whole mess. There's one transmit
- * buffer ring and two receive buffer rings: one RX ring is for small
- * packets and the other is for large packets. Each buffer ring also
- * has a companion completion queue.
- */
-struct sf_list_data {
- struct sf_tx_bufdesc_type0 sf_tx_dlist[SF_TX_DLIST_CNT];
- struct sf_tx_cmpdesc_type1 sf_tx_clist[SF_TX_CLIST_CNT];
- struct sf_rx_bufdesc_type0 sf_rx_dlist_big[SF_RX_DLIST_CNT];
-#ifdef notdef
- /*
- * Unfortunately, because the Starfire doesn't allow arbitrary
- * byte alignment, we have to copy packets in the RX handler in
- * order to align the payload correctly. This means that we
- * don't gain anything by having separate large and small descriptor
- * lists, so for now we don't bother with the small one.
- */
- struct sf_rx_bufdesc_type0 sf_rx_dlist_small[SF_RX_DLIST_CNT];
-#endif
- struct sf_rx_cmpdesc_type3 sf_rx_clist[SF_RX_CLIST_CNT];
-};
-
-struct sf_softc {
- struct ifnet *sf_ifp; /* interface info */
- bus_space_handle_t sf_bhandle; /* bus space handle */
- bus_space_tag_t sf_btag; /* bus space tag */
- void *sf_intrhand; /* interrupt handler cookie */
- struct resource *sf_irq; /* irq resource descriptor */
- struct resource *sf_res; /* mem/ioport resource */
- struct sf_type *sf_info; /* Starfire adapter info */
- device_t sf_miibus;
- u_int8_t sf_unit; /* interface number */
- struct sf_list_data *sf_ldata;
- int sf_tx_cnt;
- u_int8_t sf_link;
- int sf_if_flags;
- struct callout_handle sf_stat_ch;
- struct mtx sf_mtx;
-#ifdef DEVICE_POLLING
- int rxcycles;
-#endif /* DEVICE_POLLING */
-};
-
-
-#define SF_LOCK(_sc) mtx_lock(&(_sc)->sf_mtx)
-#define SF_UNLOCK(_sc) mtx_unlock(&(_sc)->sf_mtx)
-#define SF_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sf_mtx, MA_OWNED)
-
-#define SF_TIMEOUT 1000
-
-#ifdef __alpha__
-#undef vtophys
-#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va)
-#endif
diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c
deleted file mode 100644
index bcc4b03..0000000
--- a/sys/dev/sk/if_sk.c
+++ /dev/null
@@ -1,3002 +0,0 @@
-/* $OpenBSD: if_sk.c,v 2.33 2003/08/12 05:23:06 nate Exp $ */
-
-/*-
- * Copyright (c) 1997, 1998, 1999, 2000
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (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) 2003 Nathan L. Binkert <binkertn@umich.edu>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports
- * the SK-984x series adapters, both single port and dual port.
- * References:
- * The XaQti XMAC II datasheet,
- * http://www.freebsd.org/~wpaul/SysKonnect/xmacii_datasheet_rev_c_9-29.pdf
- * The SysKonnect GEnesis manual, http://www.syskonnect.com
- *
- * Note: XaQti has been aquired by Vitesse, and Vitesse does not have the
- * XMAC II datasheet online. I have put my copy at people.freebsd.org as a
- * convenience to others until Vitesse corrects this problem:
- *
- * http://people.freebsd.org/~wpaul/SysKonnect/xmacii_datasheet_rev_c_9-29.pdf
- *
- * Written by Bill Paul <wpaul@ee.columbia.edu>
- * Department of Electrical Engineering
- * Columbia University, New York City
- */
-/*
- * The SysKonnect gigabit ethernet adapters consist of two main
- * components: the SysKonnect GEnesis controller chip and the XaQti Corp.
- * XMAC II gigabit ethernet MAC. The XMAC provides all of the MAC
- * components and a PHY while the GEnesis controller provides a PCI
- * interface with DMA support. Each card may have between 512K and
- * 2MB of SRAM on board depending on the configuration.
- *
- * The SysKonnect GEnesis controller can have either one or two XMAC
- * chips connected to it, allowing single or dual port NIC configurations.
- * SysKonnect has the distinction of being the only vendor on the market
- * with a dual port gigabit ethernet NIC. The GEnesis provides dual FIFOs,
- * dual DMA queues, packet/MAC/transmit arbiters and direct access to the
- * XMAC registers. This driver takes advantage of these features to allow
- * both XMACs to operate as independent interfaces.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/socket.h>
-#include <sys/queue.h>
-#include <sys/sysctl.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-
-#include <net/bpf.h>
-
-#include <vm/vm.h> /* for vtophys */
-#include <vm/pmap.h> /* for vtophys */
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-#include <dev/mii/brgphyreg.h>
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#if 0
-#define SK_USEIOSPACE
-#endif
-
-#include <pci/if_skreg.h>
-#include <pci/xmaciireg.h>
-#include <pci/yukonreg.h>
-
-MODULE_DEPEND(sk, pci, 1, 1, 1);
-MODULE_DEPEND(sk, ether, 1, 1, 1);
-MODULE_DEPEND(sk, miibus, 1, 1, 1);
-
-/* "controller miibus0" required. See GENERIC if you get errors here. */
-#include "miibus_if.h"
-
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif
-
-static struct sk_type sk_devs[] = {
- {
- VENDORID_SK,
- DEVICEID_SK_V1,
- "SysKonnect Gigabit Ethernet (V1.0)"
- },
- {
- VENDORID_SK,
- DEVICEID_SK_V2,
- "SysKonnect Gigabit Ethernet (V2.0)"
- },
- {
- VENDORID_MARVELL,
- DEVICEID_SK_V2,
- "Marvell Gigabit Ethernet"
- },
- {
- VENDORID_MARVELL,
- DEVICEID_BELKIN_5005,
- "Belkin F5D5005 Gigabit Ethernet"
- },
- {
- VENDORID_3COM,
- DEVICEID_3COM_3C940,
- "3Com 3C940 Gigabit Ethernet"
- },
- {
- VENDORID_LINKSYS,
- DEVICEID_LINKSYS_EG1032,
- "Linksys EG1032 Gigabit Ethernet"
- },
- {
- VENDORID_DLINK,
- DEVICEID_DLINK_DGE530T,
- "D-Link DGE-530T Gigabit Ethernet"
- },
- { 0, 0, NULL }
-};
-
-static int skc_probe(device_t);
-static int skc_attach(device_t);
-static int skc_detach(device_t);
-static void skc_shutdown(device_t);
-static int sk_detach(device_t);
-static int sk_probe(device_t);
-static int sk_attach(device_t);
-static void sk_tick(void *);
-static void sk_intr(void *);
-static void sk_intr_xmac(struct sk_if_softc *);
-static void sk_intr_bcom(struct sk_if_softc *);
-static void sk_intr_yukon(struct sk_if_softc *);
-static void sk_rxeof(struct sk_if_softc *);
-static void sk_txeof(struct sk_if_softc *);
-static int sk_encap(struct sk_if_softc *, struct mbuf *,
- u_int32_t *);
-static void sk_start(struct ifnet *);
-static int sk_ioctl(struct ifnet *, u_long, caddr_t);
-static void sk_init(void *);
-static void sk_init_xmac(struct sk_if_softc *);
-static void sk_init_yukon(struct sk_if_softc *);
-static void sk_stop(struct sk_if_softc *);
-static void sk_watchdog(struct ifnet *);
-static int sk_ifmedia_upd(struct ifnet *);
-static void sk_ifmedia_sts(struct ifnet *, struct ifmediareq *);
-static void sk_reset(struct sk_softc *);
-static int sk_newbuf(struct sk_if_softc *,
- struct sk_chain *, struct mbuf *);
-static int sk_alloc_jumbo_mem(struct sk_if_softc *);
-static void sk_free_jumbo_mem(struct sk_if_softc *);
-static void *sk_jalloc(struct sk_if_softc *);
-static void sk_jfree(void *, void *);
-static int sk_init_rx_ring(struct sk_if_softc *);
-static void sk_init_tx_ring(struct sk_if_softc *);
-static u_int32_t sk_win_read_4(struct sk_softc *, int);
-static u_int16_t sk_win_read_2(struct sk_softc *, int);
-static u_int8_t sk_win_read_1(struct sk_softc *, int);
-static void sk_win_write_4(struct sk_softc *, int, u_int32_t);
-static void sk_win_write_2(struct sk_softc *, int, u_int32_t);
-static void sk_win_write_1(struct sk_softc *, int, u_int32_t);
-static u_int8_t sk_vpd_readbyte(struct sk_softc *, int);
-static void sk_vpd_read_res(struct sk_softc *, struct vpd_res *, int);
-static void sk_vpd_read(struct sk_softc *);
-
-static int sk_miibus_readreg(device_t, int, int);
-static int sk_miibus_writereg(device_t, int, int, int);
-static void sk_miibus_statchg(device_t);
-
-static int sk_xmac_miibus_readreg(struct sk_if_softc *, int, int);
-static int sk_xmac_miibus_writereg(struct sk_if_softc *, int, int,
- int);
-static void sk_xmac_miibus_statchg(struct sk_if_softc *);
-
-static int sk_marv_miibus_readreg(struct sk_if_softc *, int, int);
-static int sk_marv_miibus_writereg(struct sk_if_softc *, int, int,
- int);
-static void sk_marv_miibus_statchg(struct sk_if_softc *);
-
-static uint32_t sk_xmchash(const uint8_t *);
-static uint32_t sk_gmchash(const uint8_t *);
-static void sk_setfilt(struct sk_if_softc *, caddr_t, int);
-static void sk_setmulti(struct sk_if_softc *);
-static void sk_setpromisc(struct sk_if_softc *);
-
-static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int low, int high);
-static int sysctl_hw_sk_int_mod(SYSCTL_HANDLER_ARGS);
-
-#ifdef SK_USEIOSPACE
-#define SK_RES SYS_RES_IOPORT
-#define SK_RID SK_PCI_LOIO
-#else
-#define SK_RES SYS_RES_MEMORY
-#define SK_RID SK_PCI_LOMEM
-#endif
-
-/*
- * Note that we have newbus methods for both the GEnesis controller
- * itself and the XMAC(s). The XMACs are children of the GEnesis, and
- * the miibus code is a child of the XMACs. We need to do it this way
- * so that the miibus drivers can access the PHY registers on the
- * right PHY. It's not quite what I had in mind, but it's the only
- * design that achieves the desired effect.
- */
-static device_method_t skc_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, skc_probe),
- DEVMETHOD(device_attach, skc_attach),
- DEVMETHOD(device_detach, skc_detach),
- DEVMETHOD(device_shutdown, skc_shutdown),
-
- /* bus interface */
- DEVMETHOD(bus_print_child, bus_generic_print_child),
- DEVMETHOD(bus_driver_added, bus_generic_driver_added),
-
- { 0, 0 }
-};
-
-static driver_t skc_driver = {
- "skc",
- skc_methods,
- sizeof(struct sk_softc)
-};
-
-static devclass_t skc_devclass;
-
-static device_method_t sk_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, sk_probe),
- DEVMETHOD(device_attach, sk_attach),
- DEVMETHOD(device_detach, sk_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
-
- /* bus interface */
- DEVMETHOD(bus_print_child, bus_generic_print_child),
- DEVMETHOD(bus_driver_added, bus_generic_driver_added),
-
- /* MII interface */
- DEVMETHOD(miibus_readreg, sk_miibus_readreg),
- DEVMETHOD(miibus_writereg, sk_miibus_writereg),
- DEVMETHOD(miibus_statchg, sk_miibus_statchg),
-
- { 0, 0 }
-};
-
-static driver_t sk_driver = {
- "sk",
- sk_methods,
- sizeof(struct sk_if_softc)
-};
-
-static devclass_t sk_devclass;
-
-DRIVER_MODULE(sk, pci, skc_driver, skc_devclass, 0, 0);
-DRIVER_MODULE(sk, skc, sk_driver, sk_devclass, 0, 0);
-DRIVER_MODULE(miibus, sk, miibus_driver, miibus_devclass, 0, 0);
-
-#define SK_SETBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) | x)
-
-#define SK_CLRBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) & ~x)
-
-#define SK_WIN_SETBIT_4(sc, reg, x) \
- sk_win_write_4(sc, reg, sk_win_read_4(sc, reg) | x)
-
-#define SK_WIN_CLRBIT_4(sc, reg, x) \
- sk_win_write_4(sc, reg, sk_win_read_4(sc, reg) & ~x)
-
-#define SK_WIN_SETBIT_2(sc, reg, x) \
- sk_win_write_2(sc, reg, sk_win_read_2(sc, reg) | x)
-
-#define SK_WIN_CLRBIT_2(sc, reg, x) \
- sk_win_write_2(sc, reg, sk_win_read_2(sc, reg) & ~x)
-
-static u_int32_t
-sk_win_read_4(sc, reg)
- struct sk_softc *sc;
- int reg;
-{
-#ifdef SK_USEIOSPACE
- CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
- return(CSR_READ_4(sc, SK_WIN_BASE + SK_REG(reg)));
-#else
- return(CSR_READ_4(sc, reg));
-#endif
-}
-
-static u_int16_t
-sk_win_read_2(sc, reg)
- struct sk_softc *sc;
- int reg;
-{
-#ifdef SK_USEIOSPACE
- CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
- return(CSR_READ_2(sc, SK_WIN_BASE + SK_REG(reg)));
-#else
- return(CSR_READ_2(sc, reg));
-#endif
-}
-
-static u_int8_t
-sk_win_read_1(sc, reg)
- struct sk_softc *sc;
- int reg;
-{
-#ifdef SK_USEIOSPACE
- CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
- return(CSR_READ_1(sc, SK_WIN_BASE + SK_REG(reg)));
-#else
- return(CSR_READ_1(sc, reg));
-#endif
-}
-
-static void
-sk_win_write_4(sc, reg, val)
- struct sk_softc *sc;
- int reg;
- u_int32_t val;
-{
-#ifdef SK_USEIOSPACE
- CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
- CSR_WRITE_4(sc, SK_WIN_BASE + SK_REG(reg), val);
-#else
- CSR_WRITE_4(sc, reg, val);
-#endif
- return;
-}
-
-static void
-sk_win_write_2(sc, reg, val)
- struct sk_softc *sc;
- int reg;
- u_int32_t val;
-{
-#ifdef SK_USEIOSPACE
- CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
- CSR_WRITE_2(sc, SK_WIN_BASE + SK_REG(reg), val);
-#else
- CSR_WRITE_2(sc, reg, val);
-#endif
- return;
-}
-
-static void
-sk_win_write_1(sc, reg, val)
- struct sk_softc *sc;
- int reg;
- u_int32_t val;
-{
-#ifdef SK_USEIOSPACE
- CSR_WRITE_4(sc, SK_RAP, SK_WIN(reg));
- CSR_WRITE_1(sc, SK_WIN_BASE + SK_REG(reg), val);
-#else
- CSR_WRITE_1(sc, reg, val);
-#endif
- return;
-}
-
-/*
- * The VPD EEPROM contains Vital Product Data, as suggested in
- * the PCI 2.1 specification. The VPD data is separared into areas
- * denoted by resource IDs. The SysKonnect VPD contains an ID string
- * resource (the name of the adapter), a read-only area resource
- * containing various key/data fields and a read/write area which
- * can be used to store asset management information or log messages.
- * We read the ID string and read-only into buffers attached to
- * the controller softc structure for later use. At the moment,
- * we only use the ID string during skc_attach().
- */
-static u_int8_t
-sk_vpd_readbyte(sc, addr)
- struct sk_softc *sc;
- int addr;
-{
- int i;
-
- sk_win_write_2(sc, SK_PCI_REG(SK_PCI_VPD_ADDR), addr);
- for (i = 0; i < SK_TIMEOUT; i++) {
- DELAY(1);
- if (sk_win_read_2(sc,
- SK_PCI_REG(SK_PCI_VPD_ADDR)) & SK_VPD_FLAG)
- break;
- }
-
- if (i == SK_TIMEOUT)
- return(0);
-
- return(sk_win_read_1(sc, SK_PCI_REG(SK_PCI_VPD_DATA)));
-}
-
-static void
-sk_vpd_read_res(sc, res, addr)
- struct sk_softc *sc;
- struct vpd_res *res;
- int addr;
-{
- int i;
- u_int8_t *ptr;
-
- ptr = (u_int8_t *)res;
- for (i = 0; i < sizeof(struct vpd_res); i++)
- ptr[i] = sk_vpd_readbyte(sc, i + addr);
-
- return;
-}
-
-static void
-sk_vpd_read(sc)
- struct sk_softc *sc;
-{
- int pos = 0, i;
- struct vpd_res res;
-
- if (sc->sk_vpd_prodname != NULL)
- free(sc->sk_vpd_prodname, M_DEVBUF);
- if (sc->sk_vpd_readonly != NULL)
- free(sc->sk_vpd_readonly, M_DEVBUF);
- sc->sk_vpd_prodname = NULL;
- sc->sk_vpd_readonly = NULL;
- sc->sk_vpd_readonly_len = 0;
-
- sk_vpd_read_res(sc, &res, pos);
-
- /*
- * Bail out quietly if the eeprom appears to be missing or empty.
- */
- if (res.vr_id == 0xff && res.vr_len == 0xff && res.vr_pad == 0xff)
- return;
-
- if (res.vr_id != VPD_RES_ID) {
- printf("skc%d: bad VPD resource id: expected %x got %x\n",
- sc->sk_unit, VPD_RES_ID, res.vr_id);
- return;
- }
-
- pos += sizeof(res);
- sc->sk_vpd_prodname = malloc(res.vr_len + 1, M_DEVBUF, M_NOWAIT);
- if (sc->sk_vpd_prodname != NULL) {
- for (i = 0; i < res.vr_len; i++)
- sc->sk_vpd_prodname[i] = sk_vpd_readbyte(sc, i + pos);
- sc->sk_vpd_prodname[i] = '\0';
- }
- pos += res.vr_len;
-
- sk_vpd_read_res(sc, &res, pos);
-
- if (res.vr_id != VPD_RES_READ) {
- printf("skc%d: bad VPD resource id: expected %x got %x\n",
- sc->sk_unit, VPD_RES_READ, res.vr_id);
- return;
- }
-
- pos += sizeof(res);
- sc->sk_vpd_readonly = malloc(res.vr_len, M_DEVBUF, M_NOWAIT);
- for (i = 0; i < res.vr_len; i++)
- sc->sk_vpd_readonly[i] = sk_vpd_readbyte(sc, i + pos);
- sc->sk_vpd_readonly_len = res.vr_len;
-
- return;
-}
-
-static int
-sk_miibus_readreg(dev, phy, reg)
- device_t dev;
- int phy, reg;
-{
- struct sk_if_softc *sc_if;
-
- sc_if = device_get_softc(dev);
-
- switch(sc_if->sk_softc->sk_type) {
- case SK_GENESIS:
- return(sk_xmac_miibus_readreg(sc_if, phy, reg));
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- return(sk_marv_miibus_readreg(sc_if, phy, reg));
- }
-
- return(0);
-}
-
-static int
-sk_miibus_writereg(dev, phy, reg, val)
- device_t dev;
- int phy, reg, val;
-{
- struct sk_if_softc *sc_if;
-
- sc_if = device_get_softc(dev);
-
- switch(sc_if->sk_softc->sk_type) {
- case SK_GENESIS:
- return(sk_xmac_miibus_writereg(sc_if, phy, reg, val));
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- return(sk_marv_miibus_writereg(sc_if, phy, reg, val));
- }
-
- return(0);
-}
-
-static void
-sk_miibus_statchg(dev)
- device_t dev;
-{
- struct sk_if_softc *sc_if;
-
- sc_if = device_get_softc(dev);
-
- switch(sc_if->sk_softc->sk_type) {
- case SK_GENESIS:
- sk_xmac_miibus_statchg(sc_if);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- sk_marv_miibus_statchg(sc_if);
- break;
- }
-
- return;
-}
-
-static int
-sk_xmac_miibus_readreg(sc_if, phy, reg)
- struct sk_if_softc *sc_if;
- int phy, reg;
-{
- int i;
-
- if (sc_if->sk_phytype == SK_PHYTYPE_XMAC && phy != 0)
- return(0);
-
- SK_IF_LOCK(sc_if);
- SK_XM_WRITE_2(sc_if, XM_PHY_ADDR, reg|(phy << 8));
- SK_XM_READ_2(sc_if, XM_PHY_DATA);
- if (sc_if->sk_phytype != SK_PHYTYPE_XMAC) {
- for (i = 0; i < SK_TIMEOUT; i++) {
- DELAY(1);
- if (SK_XM_READ_2(sc_if, XM_MMUCMD) &
- XM_MMUCMD_PHYDATARDY)
- break;
- }
-
- if (i == SK_TIMEOUT) {
- printf("sk%d: phy failed to come ready\n",
- sc_if->sk_unit);
- SK_IF_UNLOCK(sc_if);
- return(0);
- }
- }
- DELAY(1);
- i = SK_XM_READ_2(sc_if, XM_PHY_DATA);
- SK_IF_UNLOCK(sc_if);
- return(i);
-}
-
-static int
-sk_xmac_miibus_writereg(sc_if, phy, reg, val)
- struct sk_if_softc *sc_if;
- int phy, reg, val;
-{
- int i;
-
- SK_IF_LOCK(sc_if);
- SK_XM_WRITE_2(sc_if, XM_PHY_ADDR, reg|(phy << 8));
- for (i = 0; i < SK_TIMEOUT; i++) {
- if (!(SK_XM_READ_2(sc_if, XM_MMUCMD) & XM_MMUCMD_PHYBUSY))
- break;
- }
-
- if (i == SK_TIMEOUT) {
- printf("sk%d: phy failed to come ready\n", sc_if->sk_unit);
- SK_IF_UNLOCK(sc_if);
- return(ETIMEDOUT);
- }
-
- SK_XM_WRITE_2(sc_if, XM_PHY_DATA, val);
- for (i = 0; i < SK_TIMEOUT; i++) {
- DELAY(1);
- if (!(SK_XM_READ_2(sc_if, XM_MMUCMD) & XM_MMUCMD_PHYBUSY))
- break;
- }
- SK_IF_UNLOCK(sc_if);
- if (i == SK_TIMEOUT)
- printf("sk%d: phy write timed out\n", sc_if->sk_unit);
-
- return(0);
-}
-
-static void
-sk_xmac_miibus_statchg(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct mii_data *mii;
-
- mii = device_get_softc(sc_if->sk_miibus);
-
- SK_IF_LOCK(sc_if);
- /*
- * If this is a GMII PHY, manually set the XMAC's
- * duplex mode accordingly.
- */
- if (sc_if->sk_phytype != SK_PHYTYPE_XMAC) {
- if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) {
- SK_XM_SETBIT_2(sc_if, XM_MMUCMD, XM_MMUCMD_GMIIFDX);
- } else {
- SK_XM_CLRBIT_2(sc_if, XM_MMUCMD, XM_MMUCMD_GMIIFDX);
- }
- }
- SK_IF_UNLOCK(sc_if);
-
- return;
-}
-
-static int
-sk_marv_miibus_readreg(sc_if, phy, reg)
- struct sk_if_softc *sc_if;
- int phy, reg;
-{
- u_int16_t val;
- int i;
-
- if (phy != 0 ||
- (sc_if->sk_phytype != SK_PHYTYPE_MARV_COPPER &&
- sc_if->sk_phytype != SK_PHYTYPE_MARV_FIBER)) {
- return(0);
- }
-
- SK_IF_LOCK(sc_if);
- SK_YU_WRITE_2(sc_if, YUKON_SMICR, YU_SMICR_PHYAD(phy) |
- YU_SMICR_REGAD(reg) | YU_SMICR_OP_READ);
-
- for (i = 0; i < SK_TIMEOUT; i++) {
- DELAY(1);
- val = SK_YU_READ_2(sc_if, YUKON_SMICR);
- if (val & YU_SMICR_READ_VALID)
- break;
- }
-
- if (i == SK_TIMEOUT) {
- printf("sk%d: phy failed to come ready\n",
- sc_if->sk_unit);
- SK_IF_UNLOCK(sc_if);
- return(0);
- }
-
- val = SK_YU_READ_2(sc_if, YUKON_SMIDR);
- SK_IF_UNLOCK(sc_if);
-
- return(val);
-}
-
-static int
-sk_marv_miibus_writereg(sc_if, phy, reg, val)
- struct sk_if_softc *sc_if;
- int phy, reg, val;
-{
- int i;
-
- SK_IF_LOCK(sc_if);
- SK_YU_WRITE_2(sc_if, YUKON_SMIDR, val);
- SK_YU_WRITE_2(sc_if, YUKON_SMICR, YU_SMICR_PHYAD(phy) |
- YU_SMICR_REGAD(reg) | YU_SMICR_OP_WRITE);
-
- for (i = 0; i < SK_TIMEOUT; i++) {
- DELAY(1);
- if (SK_YU_READ_2(sc_if, YUKON_SMICR) & YU_SMICR_BUSY)
- break;
- }
- SK_IF_UNLOCK(sc_if);
-
- return(0);
-}
-
-static void
-sk_marv_miibus_statchg(sc_if)
- struct sk_if_softc *sc_if;
-{
- return;
-}
-
-#define HASH_BITS 6
-
-static u_int32_t
-sk_xmchash(addr)
- const uint8_t *addr;
-{
- uint32_t crc;
-
- /* Compute CRC for the address value. */
- crc = ether_crc32_le(addr, ETHER_ADDR_LEN);
-
- return (~crc & ((1 << HASH_BITS) - 1));
-}
-
-/* gmchash is just a big endian crc */
-static u_int32_t
-sk_gmchash(addr)
- const uint8_t *addr;
-{
- uint32_t crc;
-
- /* Compute CRC for the address value. */
- crc = ether_crc32_be(addr, ETHER_ADDR_LEN);
-
- return (crc & ((1 << HASH_BITS) - 1));
-}
-
-static void
-sk_setfilt(sc_if, addr, slot)
- struct sk_if_softc *sc_if;
- caddr_t addr;
- int slot;
-{
- int base;
-
- base = XM_RXFILT_ENTRY(slot);
-
- SK_XM_WRITE_2(sc_if, base, *(u_int16_t *)(&addr[0]));
- SK_XM_WRITE_2(sc_if, base + 2, *(u_int16_t *)(&addr[2]));
- SK_XM_WRITE_2(sc_if, base + 4, *(u_int16_t *)(&addr[4]));
-
- return;
-}
-
-static void
-sk_setmulti(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_softc *sc = sc_if->sk_softc;
- struct ifnet *ifp = sc_if->sk_ifp;
- u_int32_t hashes[2] = { 0, 0 };
- int h = 0, i;
- struct ifmultiaddr *ifma;
- u_int8_t dummy[] = { 0, 0, 0, 0, 0 ,0 };
-
-
- /* First, zot all the existing filters. */
- switch(sc->sk_type) {
- case SK_GENESIS:
- for (i = 1; i < XM_RXFILT_MAX; i++)
- sk_setfilt(sc_if, (caddr_t)&dummy, i);
-
- SK_XM_WRITE_4(sc_if, XM_MAR0, 0);
- SK_XM_WRITE_4(sc_if, XM_MAR2, 0);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- SK_YU_WRITE_2(sc_if, YUKON_MCAH1, 0);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH2, 0);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH3, 0);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH4, 0);
- break;
- }
-
- /* Now program new ones. */
- if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
- hashes[0] = 0xFFFFFFFF;
- hashes[1] = 0xFFFFFFFF;
- } else {
- i = 1;
- TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- /*
- * Program the first XM_RXFILT_MAX multicast groups
- * into the perfect filter. For all others,
- * use the hash table.
- */
- if (sc->sk_type == SK_GENESIS && i < XM_RXFILT_MAX) {
- sk_setfilt(sc_if,
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i);
- i++;
- continue;
- }
-
- switch(sc->sk_type) {
- case SK_GENESIS:
- h = sk_xmchash(
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- h = sk_gmchash(
- LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
- break;
- }
- if (h < 32)
- hashes[0] |= (1 << h);
- else
- hashes[1] |= (1 << (h - 32));
- }
- }
-
- switch(sc->sk_type) {
- case SK_GENESIS:
- SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_USE_HASH|
- XM_MODE_RX_USE_PERFECT);
- SK_XM_WRITE_4(sc_if, XM_MAR0, hashes[0]);
- SK_XM_WRITE_4(sc_if, XM_MAR2, hashes[1]);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- SK_YU_WRITE_2(sc_if, YUKON_MCAH1, hashes[0] & 0xffff);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH2, (hashes[0] >> 16) & 0xffff);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH3, hashes[1] & 0xffff);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH4, (hashes[1] >> 16) & 0xffff);
- break;
- }
-
- return;
-}
-
-static void
-sk_setpromisc(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_softc *sc = sc_if->sk_softc;
- struct ifnet *ifp = sc_if->sk_ifp;
-
- switch(sc->sk_type) {
- case SK_GENESIS:
- if (ifp->if_flags & IFF_PROMISC) {
- SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_PROMISC);
- } else {
- SK_XM_CLRBIT_4(sc_if, XM_MODE, XM_MODE_RX_PROMISC);
- }
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- if (ifp->if_flags & IFF_PROMISC) {
- SK_YU_CLRBIT_2(sc_if, YUKON_RCR,
- YU_RCR_UFLEN | YU_RCR_MUFLEN);
- } else {
- SK_YU_SETBIT_2(sc_if, YUKON_RCR,
- YU_RCR_UFLEN | YU_RCR_MUFLEN);
- }
- break;
- }
-
- return;
-}
-
-static int
-sk_init_rx_ring(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_chain_data *cd = &sc_if->sk_cdata;
- struct sk_ring_data *rd = sc_if->sk_rdata;
- int i;
-
- bzero((char *)rd->sk_rx_ring,
- sizeof(struct sk_rx_desc) * SK_RX_RING_CNT);
-
- for (i = 0; i < SK_RX_RING_CNT; i++) {
- cd->sk_rx_chain[i].sk_desc = &rd->sk_rx_ring[i];
- if (sk_newbuf(sc_if, &cd->sk_rx_chain[i], NULL) == ENOBUFS)
- return(ENOBUFS);
- if (i == (SK_RX_RING_CNT - 1)) {
- cd->sk_rx_chain[i].sk_next =
- &cd->sk_rx_chain[0];
- rd->sk_rx_ring[i].sk_next =
- vtophys(&rd->sk_rx_ring[0]);
- } else {
- cd->sk_rx_chain[i].sk_next =
- &cd->sk_rx_chain[i + 1];
- rd->sk_rx_ring[i].sk_next =
- vtophys(&rd->sk_rx_ring[i + 1]);
- }
- }
-
- sc_if->sk_cdata.sk_rx_prod = 0;
- sc_if->sk_cdata.sk_rx_cons = 0;
-
- return(0);
-}
-
-static void
-sk_init_tx_ring(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_chain_data *cd = &sc_if->sk_cdata;
- struct sk_ring_data *rd = sc_if->sk_rdata;
- int i;
-
- bzero((char *)sc_if->sk_rdata->sk_tx_ring,
- sizeof(struct sk_tx_desc) * SK_TX_RING_CNT);
-
- for (i = 0; i < SK_TX_RING_CNT; i++) {
- cd->sk_tx_chain[i].sk_desc = &rd->sk_tx_ring[i];
- if (i == (SK_TX_RING_CNT - 1)) {
- cd->sk_tx_chain[i].sk_next =
- &cd->sk_tx_chain[0];
- rd->sk_tx_ring[i].sk_next =
- vtophys(&rd->sk_tx_ring[0]);
- } else {
- cd->sk_tx_chain[i].sk_next =
- &cd->sk_tx_chain[i + 1];
- rd->sk_tx_ring[i].sk_next =
- vtophys(&rd->sk_tx_ring[i + 1]);
- }
- }
-
- sc_if->sk_cdata.sk_tx_prod = 0;
- sc_if->sk_cdata.sk_tx_cons = 0;
- sc_if->sk_cdata.sk_tx_cnt = 0;
-
- return;
-}
-
-static int
-sk_newbuf(sc_if, c, m)
- struct sk_if_softc *sc_if;
- struct sk_chain *c;
- struct mbuf *m;
-{
- struct mbuf *m_new = NULL;
- struct sk_rx_desc *r;
-
- if (m == NULL) {
- caddr_t *buf = NULL;
-
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL)
- return(ENOBUFS);
-
- /* Allocate the jumbo buffer */
- buf = sk_jalloc(sc_if);
- if (buf == NULL) {
- m_freem(m_new);
-#ifdef SK_VERBOSE
- printf("sk%d: jumbo allocation failed "
- "-- packet dropped!\n", sc_if->sk_unit);
-#endif
- return(ENOBUFS);
- }
-
- /* Attach the buffer to the mbuf */
- MEXTADD(m_new, buf, SK_JLEN, sk_jfree,
- (struct sk_if_softc *)sc_if, 0, EXT_NET_DRV);
- m_new->m_data = (void *)buf;
- m_new->m_pkthdr.len = m_new->m_len = SK_JLEN;
- } else {
- /*
- * We're re-using a previously allocated mbuf;
- * be sure to re-init pointers and lengths to
- * default values.
- */
- m_new = m;
- m_new->m_len = m_new->m_pkthdr.len = SK_JLEN;
- m_new->m_data = m_new->m_ext.ext_buf;
- }
-
- /*
- * Adjust alignment so packet payload begins on a
- * longword boundary. Mandatory for Alpha, useful on
- * x86 too.
- */
- m_adj(m_new, ETHER_ALIGN);
-
- r = c->sk_desc;
- c->sk_mbuf = m_new;
- r->sk_data_lo = vtophys(mtod(m_new, caddr_t));
- r->sk_ctl = m_new->m_len | SK_RXSTAT;
-
- return(0);
-}
-
-/*
- * Allocate jumbo buffer storage. The SysKonnect adapters support
- * "jumbograms" (9K frames), although SysKonnect doesn't currently
- * use them in their drivers. In order for us to use them, we need
- * large 9K receive buffers, however standard mbuf clusters are only
- * 2048 bytes in size. Consequently, we need to allocate and manage
- * our own jumbo buffer pool. Fortunately, this does not require an
- * excessive amount of additional code.
- */
-static int
-sk_alloc_jumbo_mem(sc_if)
- struct sk_if_softc *sc_if;
-{
- caddr_t ptr;
- register int i;
- struct sk_jpool_entry *entry;
-
- /* Grab a big chunk o' storage. */
- sc_if->sk_cdata.sk_jumbo_buf = contigmalloc(SK_JMEM, M_DEVBUF,
- M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0);
-
- if (sc_if->sk_cdata.sk_jumbo_buf == NULL) {
- printf("sk%d: no memory for jumbo buffers!\n", sc_if->sk_unit);
- return(ENOBUFS);
- }
-
- mtx_init(&sc_if->sk_jlist_mtx, "sk_jlist_mtx", NULL, MTX_DEF);
-
- SLIST_INIT(&sc_if->sk_jfree_listhead);
- SLIST_INIT(&sc_if->sk_jinuse_listhead);
-
- /*
- * Now divide it up into 9K pieces and save the addresses
- * in an array.
- */
- ptr = sc_if->sk_cdata.sk_jumbo_buf;
- for (i = 0; i < SK_JSLOTS; i++) {
- sc_if->sk_cdata.sk_jslots[i] = ptr;
- ptr += SK_JLEN;
- entry = malloc(sizeof(struct sk_jpool_entry),
- M_DEVBUF, M_NOWAIT);
- if (entry == NULL) {
- sk_free_jumbo_mem(sc_if);
- sc_if->sk_cdata.sk_jumbo_buf = NULL;
- printf("sk%d: no memory for jumbo "
- "buffer queue!\n", sc_if->sk_unit);
- return(ENOBUFS);
- }
- entry->slot = i;
- SLIST_INSERT_HEAD(&sc_if->sk_jfree_listhead,
- entry, jpool_entries);
- }
-
- return(0);
-}
-
-static void
-sk_free_jumbo_mem(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_jpool_entry *entry;
-
- SK_JLIST_LOCK(sc_if);
-
- /* We cannot release external mbuf storage while in use. */
- if (!SLIST_EMPTY(&sc_if->sk_jinuse_listhead)) {
- printf("sk%d: will leak jumbo buffer memory!\n", sc_if->sk_unit);
- SK_JLIST_UNLOCK(sc_if);
- return;
- }
-
- while (!SLIST_EMPTY(&sc_if->sk_jfree_listhead)) {
- entry = SLIST_FIRST(&sc_if->sk_jfree_listhead);
- SLIST_REMOVE_HEAD(&sc_if->sk_jfree_listhead, jpool_entries);
- free(entry, M_DEVBUF);
- }
-
- SK_JLIST_UNLOCK(sc_if);
-
- mtx_destroy(&sc_if->sk_jlist_mtx);
-
- contigfree(sc_if->sk_cdata.sk_jumbo_buf, SK_JMEM, M_DEVBUF);
-
- return;
-}
-
-/*
- * Allocate a jumbo buffer.
- */
-static void *
-sk_jalloc(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_jpool_entry *entry;
-
- SK_JLIST_LOCK(sc_if);
-
- entry = SLIST_FIRST(&sc_if->sk_jfree_listhead);
-
- if (entry == NULL) {
-#ifdef SK_VERBOSE
- printf("sk%d: no free jumbo buffers\n", sc_if->sk_unit);
-#endif
- SK_JLIST_UNLOCK(sc_if);
- return(NULL);
- }
-
- SLIST_REMOVE_HEAD(&sc_if->sk_jfree_listhead, jpool_entries);
- SLIST_INSERT_HEAD(&sc_if->sk_jinuse_listhead, entry, jpool_entries);
-
- SK_JLIST_UNLOCK(sc_if);
-
- return(sc_if->sk_cdata.sk_jslots[entry->slot]);
-}
-
-/*
- * Release a jumbo buffer.
- */
-static void
-sk_jfree(buf, args)
- void *buf;
- void *args;
-{
- struct sk_if_softc *sc_if;
- int i;
- struct sk_jpool_entry *entry;
-
- /* Extract the softc struct pointer. */
- sc_if = (struct sk_if_softc *)args;
- if (sc_if == NULL)
- panic("sk_jfree: didn't get softc pointer!");
-
- SK_JLIST_LOCK(sc_if);
-
- /* calculate the slot this buffer belongs to */
- i = ((vm_offset_t)buf
- - (vm_offset_t)sc_if->sk_cdata.sk_jumbo_buf) / SK_JLEN;
-
- if ((i < 0) || (i >= SK_JSLOTS))
- panic("sk_jfree: asked to free buffer that we don't manage!");
-
- entry = SLIST_FIRST(&sc_if->sk_jinuse_listhead);
- if (entry == NULL)
- panic("sk_jfree: buffer not in use!");
- entry->slot = i;
- SLIST_REMOVE_HEAD(&sc_if->sk_jinuse_listhead, jpool_entries);
- SLIST_INSERT_HEAD(&sc_if->sk_jfree_listhead, entry, jpool_entries);
- if (SLIST_EMPTY(&sc_if->sk_jinuse_listhead))
- wakeup(sc_if);
-
- SK_JLIST_UNLOCK(sc_if);
- return;
-}
-
-/*
- * Set media options.
- */
-static int
-sk_ifmedia_upd(ifp)
- struct ifnet *ifp;
-{
- struct sk_if_softc *sc_if = ifp->if_softc;
- struct mii_data *mii;
-
- mii = device_get_softc(sc_if->sk_miibus);
- sk_init(sc_if);
- mii_mediachg(mii);
-
- return(0);
-}
-
-/*
- * Report current media status.
- */
-static void
-sk_ifmedia_sts(ifp, ifmr)
- struct ifnet *ifp;
- struct ifmediareq *ifmr;
-{
- struct sk_if_softc *sc_if;
- struct mii_data *mii;
-
- sc_if = ifp->if_softc;
- mii = device_get_softc(sc_if->sk_miibus);
-
- mii_pollstat(mii);
- ifmr->ifm_active = mii->mii_media_active;
- ifmr->ifm_status = mii->mii_media_status;
-
- return;
-}
-
-static int
-sk_ioctl(ifp, command, data)
- struct ifnet *ifp;
- u_long command;
- caddr_t data;
-{
- struct sk_if_softc *sc_if = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *) data;
- int error = 0;
- struct mii_data *mii;
-
- switch(command) {
- case SIOCSIFMTU:
- if (ifr->ifr_mtu > SK_JUMBO_MTU)
- error = EINVAL;
- else {
- ifp->if_mtu = ifr->ifr_mtu;
- ifp->if_flags &= ~IFF_RUNNING;
- sk_init(sc_if);
- }
- break;
- case SIOCSIFFLAGS:
- SK_IF_LOCK(sc_if);
- if (ifp->if_flags & IFF_UP) {
- if (ifp->if_flags & IFF_RUNNING) {
- if ((ifp->if_flags ^ sc_if->sk_if_flags)
- & IFF_PROMISC) {
- sk_setpromisc(sc_if);
- sk_setmulti(sc_if);
- }
- } else
- sk_init(sc_if);
- } else {
- if (ifp->if_flags & IFF_RUNNING)
- sk_stop(sc_if);
- }
- sc_if->sk_if_flags = ifp->if_flags;
- SK_IF_UNLOCK(sc_if);
- error = 0;
- break;
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- if (ifp->if_flags & IFF_RUNNING) {
- SK_IF_LOCK(sc_if);
- sk_setmulti(sc_if);
- SK_IF_UNLOCK(sc_if);
- error = 0;
- }
- break;
- case SIOCGIFMEDIA:
- case SIOCSIFMEDIA:
- mii = device_get_softc(sc_if->sk_miibus);
- error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
- break;
- default:
- error = ether_ioctl(ifp, command, data);
- break;
- }
-
- return(error);
-}
-
-/*
- * Probe for a SysKonnect GEnesis chip. Check the PCI vendor and device
- * IDs against our list and return a device name if we find a match.
- */
-static int
-skc_probe(dev)
- device_t dev;
-{
- struct sk_softc *sc;
- struct sk_type *t = sk_devs;
-
- sc = device_get_softc(dev);
-
- while(t->sk_name != NULL) {
- if ((pci_get_vendor(dev) == t->sk_vid) &&
- (pci_get_device(dev) == t->sk_did)) {
- device_set_desc(dev, t->sk_name);
- return (BUS_PROBE_DEFAULT);
- }
- t++;
- }
-
- return(ENXIO);
-}
-
-/*
- * Force the GEnesis into reset, then bring it out of reset.
- */
-static void
-sk_reset(sc)
- struct sk_softc *sc;
-{
- CSR_WRITE_2(sc, SK_CSR, SK_CSR_SW_RESET);
- CSR_WRITE_2(sc, SK_CSR, SK_CSR_MASTER_RESET);
- if (SK_YUKON_FAMILY(sc->sk_type))
- CSR_WRITE_2(sc, SK_LINK_CTRL, SK_LINK_RESET_SET);
-
- DELAY(1000);
- CSR_WRITE_2(sc, SK_CSR, SK_CSR_SW_UNRESET);
- DELAY(2);
- CSR_WRITE_2(sc, SK_CSR, SK_CSR_MASTER_UNRESET);
- if (SK_YUKON_FAMILY(sc->sk_type))
- CSR_WRITE_2(sc, SK_LINK_CTRL, SK_LINK_RESET_CLEAR);
-
- if (sc->sk_type == SK_GENESIS) {
- /* Configure packet arbiter */
- sk_win_write_2(sc, SK_PKTARB_CTL, SK_PKTARBCTL_UNRESET);
- sk_win_write_2(sc, SK_RXPA1_TINIT, SK_PKTARB_TIMEOUT);
- sk_win_write_2(sc, SK_TXPA1_TINIT, SK_PKTARB_TIMEOUT);
- sk_win_write_2(sc, SK_RXPA2_TINIT, SK_PKTARB_TIMEOUT);
- sk_win_write_2(sc, SK_TXPA2_TINIT, SK_PKTARB_TIMEOUT);
- }
-
- /* Enable RAM interface */
- sk_win_write_4(sc, SK_RAMCTL, SK_RAMCTL_UNRESET);
-
- /*
- * Configure interrupt moderation. The moderation timer
- * defers interrupts specified in the interrupt moderation
- * timer mask based on the timeout specified in the interrupt
- * moderation timer init register. Each bit in the timer
- * register represents 18.825ns, so to specify a timeout in
- * microseconds, we have to multiply by 54.
- */
- printf("skc%d: interrupt moderation is %d us\n",
- sc->sk_unit, sc->sk_int_mod);
- sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod));
- sk_win_write_4(sc, SK_IMMR, SK_ISR_TX1_S_EOF|SK_ISR_TX2_S_EOF|
- SK_ISR_RX1_EOF|SK_ISR_RX2_EOF);
- sk_win_write_1(sc, SK_IMTIMERCTL, SK_IMCTL_START);
-
- return;
-}
-
-static int
-sk_probe(dev)
- device_t dev;
-{
- struct sk_softc *sc;
-
- sc = device_get_softc(device_get_parent(dev));
-
- /*
- * Not much to do here. We always know there will be
- * at least one XMAC present, and if there are two,
- * skc_attach() will create a second device instance
- * for us.
- */
- switch (sc->sk_type) {
- case SK_GENESIS:
- device_set_desc(dev, "XaQti Corp. XMAC II");
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- device_set_desc(dev, "Marvell Semiconductor, Inc. Yukon");
- break;
- }
-
- return (BUS_PROBE_DEFAULT);
-}
-
-/*
- * Each XMAC chip is attached as a separate logical IP interface.
- * Single port cards will have only one logical interface of course.
- */
-static int
-sk_attach(dev)
- device_t dev;
-{
- struct sk_softc *sc;
- struct sk_if_softc *sc_if;
- struct ifnet *ifp;
- int i, port, error;
- u_char eaddr[6];
-
- if (dev == NULL)
- return(EINVAL);
-
- error = 0;
- sc_if = device_get_softc(dev);
- sc = device_get_softc(device_get_parent(dev));
- port = *(int *)device_get_ivars(dev);
-
- sc_if->sk_dev = dev;
- sc_if->sk_unit = device_get_unit(dev);
- sc_if->sk_port = port;
- sc_if->sk_softc = sc;
- sc->sk_if[port] = sc_if;
- if (port == SK_PORT_A)
- sc_if->sk_tx_bmu = SK_BMU_TXS_CSR0;
- if (port == SK_PORT_B)
- sc_if->sk_tx_bmu = SK_BMU_TXS_CSR1;
-
- /* Allocate the descriptor queues. */
- sc_if->sk_rdata = contigmalloc(sizeof(struct sk_ring_data), M_DEVBUF,
- M_NOWAIT, M_ZERO, 0xffffffff, PAGE_SIZE, 0);
-
- if (sc_if->sk_rdata == NULL) {
- printf("sk%d: no memory for list buffers!\n", sc_if->sk_unit);
- error = ENOMEM;
- goto fail;
- }
-
- /* Try to allocate memory for jumbo buffers. */
- if (sk_alloc_jumbo_mem(sc_if)) {
- printf("sk%d: jumbo buffer allocation failed\n",
- sc_if->sk_unit);
- error = ENOMEM;
- goto fail;
- }
-
- ifp = sc_if->sk_ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- printf("sk%d: can not if_alloc()\n", sc_if->sk_unit);
- error = ENOSPC;
- goto fail;
- }
- ifp->if_softc = sc_if;
- if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_mtu = ETHERMTU;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_ioctl = sk_ioctl;
- ifp->if_start = sk_start;
- ifp->if_watchdog = sk_watchdog;
- ifp->if_init = sk_init;
- ifp->if_baudrate = 1000000000;
- IFQ_SET_MAXLEN(&ifp->if_snd, SK_TX_RING_CNT - 1);
- ifp->if_snd.ifq_drv_maxlen = SK_TX_RING_CNT - 1;
- IFQ_SET_READY(&ifp->if_snd);
-
- callout_handle_init(&sc_if->sk_tick_ch);
-
- /*
- * Get station address for this interface. Note that
- * dual port cards actually come with three station
- * addresses: one for each port, plus an extra. The
- * extra one is used by the SysKonnect driver software
- * as a 'virtual' station address for when both ports
- * are operating in failover mode. Currently we don't
- * use this extra address.
- */
- SK_LOCK(sc);
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- eaddr[i] =
- sk_win_read_1(sc, SK_MAC0_0 + (port * 8) + i);
-
- /*
- * Set up RAM buffer addresses. The NIC will have a certain
- * amount of SRAM on it, somewhere between 512K and 2MB. We
- * need to divide this up a) between the transmitter and
- * receiver and b) between the two XMACs, if this is a
- * dual port NIC. Our algotithm is to divide up the memory
- * evenly so that everyone gets a fair share.
- */
- if (sk_win_read_1(sc, SK_CONFIG) & SK_CONFIG_SINGLEMAC) {
- u_int32_t chunk, val;
-
- chunk = sc->sk_ramsize / 2;
- val = sc->sk_rboff / sizeof(u_int64_t);
- sc_if->sk_rx_ramstart = val;
- val += (chunk / sizeof(u_int64_t));
- sc_if->sk_rx_ramend = val - 1;
- sc_if->sk_tx_ramstart = val;
- val += (chunk / sizeof(u_int64_t));
- sc_if->sk_tx_ramend = val - 1;
- } else {
- u_int32_t chunk, val;
-
- chunk = sc->sk_ramsize / 4;
- val = (sc->sk_rboff + (chunk * 2 * sc_if->sk_port)) /
- sizeof(u_int64_t);
- sc_if->sk_rx_ramstart = val;
- val += (chunk / sizeof(u_int64_t));
- sc_if->sk_rx_ramend = val - 1;
- sc_if->sk_tx_ramstart = val;
- val += (chunk / sizeof(u_int64_t));
- sc_if->sk_tx_ramend = val - 1;
- }
-
- /* Read and save PHY type and set PHY address */
- sc_if->sk_phytype = sk_win_read_1(sc, SK_EPROM1) & 0xF;
- switch(sc_if->sk_phytype) {
- case SK_PHYTYPE_XMAC:
- sc_if->sk_phyaddr = SK_PHYADDR_XMAC;
- break;
- case SK_PHYTYPE_BCOM:
- sc_if->sk_phyaddr = SK_PHYADDR_BCOM;
- break;
- case SK_PHYTYPE_MARV_COPPER:
- sc_if->sk_phyaddr = SK_PHYADDR_MARV;
- break;
- default:
- printf("skc%d: unsupported PHY type: %d\n",
- sc->sk_unit, sc_if->sk_phytype);
- error = ENODEV;
- SK_UNLOCK(sc);
- if_free(ifp);
- goto fail;
- }
-
-
- /*
- * Call MI attach routine. Can't hold locks when calling into ether_*.
- */
- SK_UNLOCK(sc);
- ether_ifattach(ifp, eaddr);
- SK_LOCK(sc);
-
- /*
- * Do miibus setup.
- */
- switch (sc->sk_type) {
- case SK_GENESIS:
- sk_init_xmac(sc_if);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- sk_init_yukon(sc_if);
- break;
- }
-
- SK_UNLOCK(sc);
- if (mii_phy_probe(dev, &sc_if->sk_miibus,
- sk_ifmedia_upd, sk_ifmedia_sts)) {
- printf("skc%d: no PHY found!\n", sc_if->sk_unit);
- ether_ifdetach(ifp);
- if_free(ifp);
- error = ENXIO;
- goto fail;
- }
-
-fail:
- if (error) {
- /* Access should be ok even though lock has been dropped */
- sc->sk_if[port] = NULL;
- sk_detach(dev);
- }
-
- return(error);
-}
-
-/*
- * Attach the interface. Allocate softc structures, do ifmedia
- * setup and ethernet/BPF attach.
- */
-static int
-skc_attach(dev)
- device_t dev;
-{
- struct sk_softc *sc;
- int unit, error = 0, rid, *port;
- uint8_t skrs;
- char *pname, *revstr;
-
- sc = device_get_softc(dev);
- unit = device_get_unit(dev);
-
- mtx_init(&sc->sk_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
- MTX_DEF | MTX_RECURSE);
- /*
- * Map control/status registers.
- */
- pci_enable_busmaster(dev);
-
- rid = SK_RID;
- sc->sk_res = bus_alloc_resource_any(dev, SK_RES, &rid, RF_ACTIVE);
-
- if (sc->sk_res == NULL) {
- printf("sk%d: couldn't map ports/memory\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- sc->sk_btag = rman_get_bustag(sc->sk_res);
- sc->sk_bhandle = rman_get_bushandle(sc->sk_res);
-
- sc->sk_type = sk_win_read_1(sc, SK_CHIPVER);
- sc->sk_rev = (sk_win_read_1(sc, SK_CONFIG) >> 4) & 0xf;
-
- /* Bail out if chip is not recognized. */
- if (sc->sk_type != SK_GENESIS && !SK_YUKON_FAMILY(sc->sk_type)) {
- printf("skc%d: unknown device: chipver=%02x, rev=%x\n",
- unit, sc->sk_type, sc->sk_rev);
- error = ENXIO;
- goto fail;
- }
-
- /* Allocate interrupt */
- rid = 0;
- sc->sk_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
- RF_SHAREABLE | RF_ACTIVE);
-
- if (sc->sk_irq == NULL) {
- printf("skc%d: couldn't map interrupt\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
- SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
- OID_AUTO, "int_mod", CTLTYPE_INT|CTLFLAG_RW,
- &sc->sk_int_mod, 0, sysctl_hw_sk_int_mod, "I",
- "SK interrupt moderation");
-
- /* Pull in device tunables. */
- sc->sk_int_mod = SK_IM_DEFAULT;
- error = resource_int_value(device_get_name(dev), unit,
- "int_mod", &sc->sk_int_mod);
- if (error == 0) {
- if (sc->sk_int_mod < SK_IM_MIN ||
- sc->sk_int_mod > SK_IM_MAX) {
- printf("skc%d: int_mod value out of range; "
- "using default: %d\n", unit, SK_IM_DEFAULT);
- sc->sk_int_mod = SK_IM_DEFAULT;
- }
- }
-
- /* Reset the adapter. */
- sk_reset(sc);
-
- sc->sk_unit = unit;
-
- /* Read and save vital product data from EEPROM. */
- sk_vpd_read(sc);
-
- skrs = sk_win_read_1(sc, SK_EPROM0);
- if (sc->sk_type == SK_GENESIS) {
- /* Read and save RAM size and RAMbuffer offset */
- switch(skrs) {
- case SK_RAMSIZE_512K_64:
- sc->sk_ramsize = 0x80000;
- sc->sk_rboff = SK_RBOFF_0;
- break;
- case SK_RAMSIZE_1024K_64:
- sc->sk_ramsize = 0x100000;
- sc->sk_rboff = SK_RBOFF_80000;
- break;
- case SK_RAMSIZE_1024K_128:
- sc->sk_ramsize = 0x100000;
- sc->sk_rboff = SK_RBOFF_0;
- break;
- case SK_RAMSIZE_2048K_128:
- sc->sk_ramsize = 0x200000;
- sc->sk_rboff = SK_RBOFF_0;
- break;
- default:
- printf("skc%d: unknown ram size: %d\n",
- sc->sk_unit, sk_win_read_1(sc, SK_EPROM0));
- error = ENXIO;
- goto fail;
- }
- } else { /* SK_YUKON_FAMILY */
- if (skrs == 0x00)
- sc->sk_ramsize = 0x20000;
- else
- sc->sk_ramsize = skrs * (1<<12);
- sc->sk_rboff = SK_RBOFF_0;
- }
-
- /* Read and save physical media type */
- switch(sk_win_read_1(sc, SK_PMDTYPE)) {
- case SK_PMD_1000BASESX:
- sc->sk_pmd = IFM_1000_SX;
- break;
- case SK_PMD_1000BASELX:
- sc->sk_pmd = IFM_1000_LX;
- break;
- case SK_PMD_1000BASECX:
- sc->sk_pmd = IFM_1000_CX;
- break;
- case SK_PMD_1000BASETX:
- sc->sk_pmd = IFM_1000_T;
- break;
- default:
- printf("skc%d: unknown media type: 0x%x\n",
- sc->sk_unit, sk_win_read_1(sc, SK_PMDTYPE));
- error = ENXIO;
- goto fail;
- }
-
- /* Determine whether to name it with VPD PN or just make it up.
- * Marvell Yukon VPD PN seems to freqently be bogus. */
- switch (pci_get_device(dev)) {
- case DEVICEID_SK_V1:
- case DEVICEID_BELKIN_5005:
- case DEVICEID_3COM_3C940:
- case DEVICEID_LINKSYS_EG1032:
- case DEVICEID_DLINK_DGE530T:
- /* Stay with VPD PN. */
- pname = sc->sk_vpd_prodname;
- break;
- case DEVICEID_SK_V2:
- /* YUKON VPD PN might bear no resemblance to reality. */
- switch (sc->sk_type) {
- case SK_GENESIS:
- /* Stay with VPD PN. */
- pname = sc->sk_vpd_prodname;
- break;
- case SK_YUKON:
- pname = "Marvell Yukon Gigabit Ethernet";
- break;
- case SK_YUKON_LITE:
- pname = "Marvell Yukon Lite Gigabit Ethernet";
- break;
- case SK_YUKON_LP:
- pname = "Marvell Yukon LP Gigabit Ethernet";
- break;
- default:
- pname = "Marvell Yukon (Unknown) Gigabit Ethernet";
- break;
- }
-
- /* Yukon Lite Rev. A0 needs special test. */
- if (sc->sk_type == SK_YUKON || sc->sk_type == SK_YUKON_LP) {
- u_int32_t far;
- u_int8_t testbyte;
-
- /* Save flash address register before testing. */
- far = sk_win_read_4(sc, SK_EP_ADDR);
-
- sk_win_write_1(sc, SK_EP_ADDR+0x03, 0xff);
- testbyte = sk_win_read_1(sc, SK_EP_ADDR+0x03);
-
- if (testbyte != 0x00) {
- /* Yukon Lite Rev. A0 detected. */
- sc->sk_type = SK_YUKON_LITE;
- sc->sk_rev = SK_YUKON_LITE_REV_A0;
- /* Restore flash address register. */
- sk_win_write_4(sc, SK_EP_ADDR, far);
- }
- }
- break;
- default:
- device_printf(dev, "unknown device: vendor=%04x, device=%04x, "
- "chipver=%02x, rev=%x\n",
- pci_get_vendor(dev), pci_get_device(dev),
- sc->sk_type, sc->sk_rev);
- error = ENXIO;
- goto fail;
- }
-
- if (sc->sk_type == SK_YUKON_LITE) {
- switch (sc->sk_rev) {
- case SK_YUKON_LITE_REV_A0:
- revstr = "A0";
- break;
- case SK_YUKON_LITE_REV_A1:
- revstr = "A1";
- break;
- case SK_YUKON_LITE_REV_A3:
- revstr = "A3";
- break;
- default:
- revstr = "";
- break;
- }
- } else {
- revstr = "";
- }
-
- /* Announce the product name and more VPD data if there. */
- device_printf(dev, "%s rev. %s(0x%x)\n",
- pname != NULL ? pname : "<unknown>", revstr, sc->sk_rev);
-
- if (bootverbose) {
- if (sc->sk_vpd_readonly != NULL &&
- sc->sk_vpd_readonly_len != 0) {
- char buf[256];
- char *dp = sc->sk_vpd_readonly;
- uint16_t l, len = sc->sk_vpd_readonly_len;
-
- while (len >= 3) {
- if ((*dp == 'P' && *(dp+1) == 'N') ||
- (*dp == 'E' && *(dp+1) == 'C') ||
- (*dp == 'M' && *(dp+1) == 'N') ||
- (*dp == 'S' && *(dp+1) == 'N')) {
- l = 0;
- while (l < *(dp+2)) {
- buf[l] = *(dp+3+l);
- ++l;
- }
- buf[l] = '\0';
- device_printf(dev, "%c%c: %s\n",
- *dp, *(dp+1), buf);
- len -= (3 + l);
- dp += (3 + l);
- } else {
- len -= (3 + *(dp+2));
- dp += (3 + *(dp+2));
- }
- }
- }
- device_printf(dev, "chip ver = 0x%02x\n", sc->sk_type);
- device_printf(dev, "chip rev = 0x%02x\n", sc->sk_rev);
- device_printf(dev, "SK_EPROM0 = 0x%02x\n", skrs);
- device_printf(dev, "SRAM size = 0x%06x\n", sc->sk_ramsize);
- }
-
- sc->sk_devs[SK_PORT_A] = device_add_child(dev, "sk", -1);
- if (sc->sk_devs[SK_PORT_A] == NULL) {
- device_printf(dev, "failed to add child for PORT_A\n");
- error = ENXIO;
- goto fail;
- }
- port = malloc(sizeof(int), M_DEVBUF, M_NOWAIT);
- if (port == NULL) {
- device_printf(dev, "failed to allocate memory for "
- "ivars of PORT_A\n");
- error = ENXIO;
- goto fail;
- }
- *port = SK_PORT_A;
- device_set_ivars(sc->sk_devs[SK_PORT_A], port);
-
- if (!(sk_win_read_1(sc, SK_CONFIG) & SK_CONFIG_SINGLEMAC)) {
- sc->sk_devs[SK_PORT_B] = device_add_child(dev, "sk", -1);
- if (sc->sk_devs[SK_PORT_B] == NULL) {
- device_printf(dev, "failed to add child for PORT_B\n");
- error = ENXIO;
- goto fail;
- }
- port = malloc(sizeof(int), M_DEVBUF, M_NOWAIT);
- if (port == NULL) {
- device_printf(dev, "failed to allocate memory for "
- "ivars of PORT_B\n");
- error = ENXIO;
- goto fail;
- }
- *port = SK_PORT_B;
- device_set_ivars(sc->sk_devs[SK_PORT_B], port);
- }
-
- /* Turn on the 'driver is loaded' LED. */
- CSR_WRITE_2(sc, SK_LED, SK_LED_GREEN_ON);
-
- bus_generic_attach(dev);
-
- /* Hook interrupt last to avoid having to lock softc */
- error = bus_setup_intr(dev, sc->sk_irq, INTR_TYPE_NET|INTR_MPSAFE,
- sk_intr, sc, &sc->sk_intrhand);
-
- if (error) {
- printf("skc%d: couldn't set up irq\n", unit);
- goto fail;
- }
-
-fail:
- if (error)
- skc_detach(dev);
-
- return(error);
-}
-
-/*
- * Shutdown hardware and free up resources. This can be called any
- * time after the mutex has been initialized. It is called in both
- * the error case in attach and the normal detach case so it needs
- * to be careful about only freeing resources that have actually been
- * allocated.
- */
-static int
-sk_detach(dev)
- device_t dev;
-{
- struct sk_if_softc *sc_if;
- struct ifnet *ifp;
-
- sc_if = device_get_softc(dev);
- KASSERT(mtx_initialized(&sc_if->sk_softc->sk_mtx),
- ("sk mutex not initialized in sk_detach"));
- SK_IF_LOCK(sc_if);
-
- ifp = sc_if->sk_ifp;
- /* These should only be active if attach_xmac succeeded */
- if (device_is_attached(dev)) {
- sk_stop(sc_if);
- /* Can't hold locks while calling detach */
- SK_IF_UNLOCK(sc_if);
- ether_ifdetach(ifp);
- if_free(ifp);
- SK_IF_LOCK(sc_if);
- }
- /*
- * We're generally called from skc_detach() which is using
- * device_delete_child() to get to here. It's already trashed
- * miibus for us, so don't do it here or we'll panic.
- */
- /*
- if (sc_if->sk_miibus != NULL)
- device_delete_child(dev, sc_if->sk_miibus);
- */
- bus_generic_detach(dev);
- if (sc_if->sk_cdata.sk_jumbo_buf != NULL)
- sk_free_jumbo_mem(sc_if);
- if (sc_if->sk_rdata != NULL) {
- contigfree(sc_if->sk_rdata, sizeof(struct sk_ring_data),
- M_DEVBUF);
- }
- SK_IF_UNLOCK(sc_if);
-
- return(0);
-}
-
-static int
-skc_detach(dev)
- device_t dev;
-{
- struct sk_softc *sc;
-
- sc = device_get_softc(dev);
- KASSERT(mtx_initialized(&sc->sk_mtx), ("sk mutex not initialized"));
-
- if (device_is_alive(dev)) {
- if (sc->sk_devs[SK_PORT_A] != NULL) {
- free(device_get_ivars(sc->sk_devs[SK_PORT_A]), M_DEVBUF);
- device_delete_child(dev, sc->sk_devs[SK_PORT_A]);
- }
- if (sc->sk_devs[SK_PORT_B] != NULL) {
- free(device_get_ivars(sc->sk_devs[SK_PORT_B]), M_DEVBUF);
- device_delete_child(dev, sc->sk_devs[SK_PORT_B]);
- }
- bus_generic_detach(dev);
- }
-
- if (sc->sk_vpd_prodname != NULL)
- free(sc->sk_vpd_prodname, M_DEVBUF);
- if (sc->sk_vpd_readonly != NULL)
- free(sc->sk_vpd_readonly, M_DEVBUF);
-
- if (sc->sk_intrhand)
- bus_teardown_intr(dev, sc->sk_irq, sc->sk_intrhand);
- if (sc->sk_irq)
- bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sk_irq);
- if (sc->sk_res)
- bus_release_resource(dev, SK_RES, SK_RID, sc->sk_res);
-
- mtx_destroy(&sc->sk_mtx);
-
- return(0);
-}
-
-static int
-sk_encap(sc_if, m_head, txidx)
- struct sk_if_softc *sc_if;
- struct mbuf *m_head;
- u_int32_t *txidx;
-{
- struct sk_tx_desc *f = NULL;
- struct mbuf *m;
- u_int32_t frag, cur, cnt = 0;
-
- SK_IF_LOCK_ASSERT(sc_if);
-
- m = m_head;
- cur = frag = *txidx;
-
- /*
- * Start packing the mbufs in this chain into
- * the fragment pointers. Stop when we run out
- * of fragments or hit the end of the mbuf chain.
- */
- for (m = m_head; m != NULL; m = m->m_next) {
- if (m->m_len != 0) {
- if ((SK_TX_RING_CNT -
- (sc_if->sk_cdata.sk_tx_cnt + cnt)) < 2)
- return(ENOBUFS);
- f = &sc_if->sk_rdata->sk_tx_ring[frag];
- f->sk_data_lo = vtophys(mtod(m, vm_offset_t));
- f->sk_ctl = m->m_len | SK_OPCODE_DEFAULT;
- if (cnt == 0)
- f->sk_ctl |= SK_TXCTL_FIRSTFRAG;
- else
- f->sk_ctl |= SK_TXCTL_OWN;
- cur = frag;
- SK_INC(frag, SK_TX_RING_CNT);
- cnt++;
- }
- }
-
- if (m != NULL)
- return(ENOBUFS);
-
- sc_if->sk_rdata->sk_tx_ring[cur].sk_ctl |=
- SK_TXCTL_LASTFRAG|SK_TXCTL_EOF_INTR;
- sc_if->sk_cdata.sk_tx_chain[cur].sk_mbuf = m_head;
- sc_if->sk_rdata->sk_tx_ring[*txidx].sk_ctl |= SK_TXCTL_OWN;
- sc_if->sk_cdata.sk_tx_cnt += cnt;
-
- *txidx = frag;
-
- return(0);
-}
-
-static void
-sk_start(ifp)
- struct ifnet *ifp;
-{
- struct sk_softc *sc;
- struct sk_if_softc *sc_if;
- struct mbuf *m_head = NULL;
- u_int32_t idx;
-
- sc_if = ifp->if_softc;
- sc = sc_if->sk_softc;
-
- SK_IF_LOCK(sc_if);
-
- idx = sc_if->sk_cdata.sk_tx_prod;
-
- while(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf == NULL) {
- IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
- if (m_head == NULL)
- break;
-
- /*
- * Pack the data into the transmit ring. If we
- * don't have room, set the OACTIVE flag and wait
- * for the NIC to drain the ring.
- */
- if (sk_encap(sc_if, m_head, &idx)) {
- IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
- break;
- }
-
- /*
- * If there's a BPF listener, bounce a copy of this frame
- * to him.
- */
- BPF_MTAP(ifp, m_head);
- }
-
- /* Transmit */
- if (idx != sc_if->sk_cdata.sk_tx_prod) {
- sc_if->sk_cdata.sk_tx_prod = idx;
- CSR_WRITE_4(sc, sc_if->sk_tx_bmu, SK_TXBMU_TX_START);
-
- /* Set a timeout in case the chip goes out to lunch. */
- ifp->if_timer = 5;
- }
- SK_IF_UNLOCK(sc_if);
-
- return;
-}
-
-
-static void
-sk_watchdog(ifp)
- struct ifnet *ifp;
-{
- struct sk_if_softc *sc_if;
-
- sc_if = ifp->if_softc;
-
- printf("sk%d: watchdog timeout\n", sc_if->sk_unit);
- ifp->if_flags &= ~IFF_RUNNING;
- sk_init(sc_if);
-
- return;
-}
-
-static void
-skc_shutdown(dev)
- device_t dev;
-{
- struct sk_softc *sc;
-
- sc = device_get_softc(dev);
- SK_LOCK(sc);
-
- /* Turn off the 'driver is loaded' LED. */
- CSR_WRITE_2(sc, SK_LED, SK_LED_GREEN_OFF);
-
- /*
- * Reset the GEnesis controller. Doing this should also
- * assert the resets on the attached XMAC(s).
- */
- sk_reset(sc);
- SK_UNLOCK(sc);
-
- return;
-}
-
-static void
-sk_rxeof(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_softc *sc;
- struct mbuf *m;
- struct ifnet *ifp;
- struct sk_chain *cur_rx;
- int total_len = 0;
- int i;
- u_int32_t rxstat;
-
- sc = sc_if->sk_softc;
- ifp = sc_if->sk_ifp;
- i = sc_if->sk_cdata.sk_rx_prod;
- cur_rx = &sc_if->sk_cdata.sk_rx_chain[i];
-
- SK_LOCK_ASSERT(sc);
-
- while(!(sc_if->sk_rdata->sk_rx_ring[i].sk_ctl & SK_RXCTL_OWN)) {
-
- cur_rx = &sc_if->sk_cdata.sk_rx_chain[i];
- rxstat = sc_if->sk_rdata->sk_rx_ring[i].sk_xmac_rxstat;
- m = cur_rx->sk_mbuf;
- cur_rx->sk_mbuf = NULL;
- total_len = SK_RXBYTES(sc_if->sk_rdata->sk_rx_ring[i].sk_ctl);
- SK_INC(i, SK_RX_RING_CNT);
-
- if (rxstat & XM_RXSTAT_ERRFRAME) {
- ifp->if_ierrors++;
- sk_newbuf(sc_if, cur_rx, m);
- continue;
- }
-
- /*
- * Try to allocate a new jumbo buffer. If that
- * fails, copy the packet to mbufs and put the
- * jumbo buffer back in the ring so it can be
- * re-used. If allocating mbufs fails, then we
- * have to drop the packet.
- */
- if (sk_newbuf(sc_if, cur_rx, NULL) == ENOBUFS) {
- struct mbuf *m0;
- m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN,
- ifp, NULL);
- sk_newbuf(sc_if, cur_rx, m);
- if (m0 == NULL) {
- printf("sk%d: no receive buffers "
- "available -- packet dropped!\n",
- sc_if->sk_unit);
- ifp->if_ierrors++;
- continue;
- }
- m = m0;
- } else {
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = m->m_len = total_len;
- }
-
- ifp->if_ipackets++;
- SK_UNLOCK(sc);
- (*ifp->if_input)(ifp, m);
- SK_LOCK(sc);
- }
-
- sc_if->sk_cdata.sk_rx_prod = i;
-
- return;
-}
-
-static void
-sk_txeof(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_softc *sc;
- struct sk_tx_desc *cur_tx;
- struct ifnet *ifp;
- u_int32_t idx;
-
- sc = sc_if->sk_softc;
- ifp = sc_if->sk_ifp;
-
- /*
- * Go through our tx ring and free mbufs for those
- * frames that have been sent.
- */
- idx = sc_if->sk_cdata.sk_tx_cons;
- while(idx != sc_if->sk_cdata.sk_tx_prod) {
- cur_tx = &sc_if->sk_rdata->sk_tx_ring[idx];
- if (cur_tx->sk_ctl & SK_TXCTL_OWN)
- break;
- if (cur_tx->sk_ctl & SK_TXCTL_LASTFRAG)
- ifp->if_opackets++;
- if (sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf != NULL) {
- m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf);
- sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL;
- }
- sc_if->sk_cdata.sk_tx_cnt--;
- SK_INC(idx, SK_TX_RING_CNT);
- }
-
- if (sc_if->sk_cdata.sk_tx_cnt == 0) {
- ifp->if_timer = 0;
- } else /* nudge chip to keep tx ring moving */
- CSR_WRITE_4(sc, sc_if->sk_tx_bmu, SK_TXBMU_TX_START);
-
- if (sc_if->sk_cdata.sk_tx_cnt < SK_TX_RING_CNT - 2)
- ifp->if_flags &= ~IFF_OACTIVE;
-
- sc_if->sk_cdata.sk_tx_cons = idx;
-}
-
-static void
-sk_tick(xsc_if)
- void *xsc_if;
-{
- struct sk_if_softc *sc_if;
- struct mii_data *mii;
- struct ifnet *ifp;
- int i;
-
- sc_if = xsc_if;
- SK_IF_LOCK(sc_if);
- ifp = sc_if->sk_ifp;
- mii = device_get_softc(sc_if->sk_miibus);
-
- if (!(ifp->if_flags & IFF_UP)) {
- SK_IF_UNLOCK(sc_if);
- return;
- }
-
- if (sc_if->sk_phytype == SK_PHYTYPE_BCOM) {
- sk_intr_bcom(sc_if);
- SK_IF_UNLOCK(sc_if);
- return;
- }
-
- /*
- * According to SysKonnect, the correct way to verify that
- * the link has come back up is to poll bit 0 of the GPIO
- * register three times. This pin has the signal from the
- * link_sync pin connected to it; if we read the same link
- * state 3 times in a row, we know the link is up.
- */
- for (i = 0; i < 3; i++) {
- if (SK_XM_READ_2(sc_if, XM_GPIO) & XM_GPIO_GP0_SET)
- break;
- }
-
- if (i != 3) {
- sc_if->sk_tick_ch = timeout(sk_tick, sc_if, hz);
- SK_IF_UNLOCK(sc_if);
- return;
- }
-
- /* Turn the GP0 interrupt back on. */
- SK_XM_CLRBIT_2(sc_if, XM_IMR, XM_IMR_GP0_SET);
- SK_XM_READ_2(sc_if, XM_ISR);
- mii_tick(mii);
- untimeout(sk_tick, sc_if, sc_if->sk_tick_ch);
-
- SK_IF_UNLOCK(sc_if);
- return;
-}
-
-static void
-sk_intr_bcom(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct mii_data *mii;
- struct ifnet *ifp;
- int status;
- mii = device_get_softc(sc_if->sk_miibus);
- ifp = sc_if->sk_ifp;
-
- SK_XM_CLRBIT_2(sc_if, XM_MMUCMD, XM_MMUCMD_TX_ENB|XM_MMUCMD_RX_ENB);
-
- /*
- * Read the PHY interrupt register to make sure
- * we clear any pending interrupts.
- */
- status = sk_xmac_miibus_readreg(sc_if, SK_PHYADDR_BCOM, BRGPHY_MII_ISR);
-
- if (!(ifp->if_flags & IFF_RUNNING)) {
- sk_init_xmac(sc_if);
- return;
- }
-
- if (status & (BRGPHY_ISR_LNK_CHG|BRGPHY_ISR_AN_PR)) {
- int lstat;
- lstat = sk_xmac_miibus_readreg(sc_if, SK_PHYADDR_BCOM,
- BRGPHY_MII_AUXSTS);
-
- if (!(lstat & BRGPHY_AUXSTS_LINK) && sc_if->sk_link) {
- mii_mediachg(mii);
- /* Turn off the link LED. */
- SK_IF_WRITE_1(sc_if, 0,
- SK_LINKLED1_CTL, SK_LINKLED_OFF);
- sc_if->sk_link = 0;
- } else if (status & BRGPHY_ISR_LNK_CHG) {
- sk_xmac_miibus_writereg(sc_if, SK_PHYADDR_BCOM,
- BRGPHY_MII_IMR, 0xFF00);
- mii_tick(mii);
- sc_if->sk_link = 1;
- /* Turn on the link LED. */
- SK_IF_WRITE_1(sc_if, 0, SK_LINKLED1_CTL,
- SK_LINKLED_ON|SK_LINKLED_LINKSYNC_OFF|
- SK_LINKLED_BLINK_OFF);
- } else {
- mii_tick(mii);
- sc_if->sk_tick_ch = timeout(sk_tick, sc_if, hz);
- }
- }
-
- SK_XM_SETBIT_2(sc_if, XM_MMUCMD, XM_MMUCMD_TX_ENB|XM_MMUCMD_RX_ENB);
-
- return;
-}
-
-static void
-sk_intr_xmac(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_softc *sc;
- u_int16_t status;
-
- sc = sc_if->sk_softc;
- status = SK_XM_READ_2(sc_if, XM_ISR);
-
- /*
- * Link has gone down. Start MII tick timeout to
- * watch for link resync.
- */
- if (sc_if->sk_phytype == SK_PHYTYPE_XMAC) {
- if (status & XM_ISR_GP0_SET) {
- SK_XM_SETBIT_2(sc_if, XM_IMR, XM_IMR_GP0_SET);
- sc_if->sk_tick_ch = timeout(sk_tick, sc_if, hz);
- }
-
- if (status & XM_ISR_AUTONEG_DONE) {
- sc_if->sk_tick_ch = timeout(sk_tick, sc_if, hz);
- }
- }
-
- if (status & XM_IMR_TX_UNDERRUN)
- SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_FLUSH_TXFIFO);
-
- if (status & XM_IMR_RX_OVERRUN)
- SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_FLUSH_RXFIFO);
-
- status = SK_XM_READ_2(sc_if, XM_ISR);
-
- return;
-}
-
-static void
-sk_intr_yukon(sc_if)
- struct sk_if_softc *sc_if;
-{
- int status;
-
- status = SK_IF_READ_2(sc_if, 0, SK_GMAC_ISR);
-
- return;
-}
-
-static void
-sk_intr(xsc)
- void *xsc;
-{
- struct sk_softc *sc = xsc;
- struct sk_if_softc *sc_if0 = NULL, *sc_if1 = NULL;
- struct ifnet *ifp0 = NULL, *ifp1 = NULL;
- u_int32_t status;
-
- SK_LOCK(sc);
-
- sc_if0 = sc->sk_if[SK_PORT_A];
- sc_if1 = sc->sk_if[SK_PORT_B];
-
- if (sc_if0 != NULL)
- ifp0 = sc_if0->sk_ifp;
- if (sc_if1 != NULL)
- ifp1 = sc_if1->sk_ifp;
-
- for (;;) {
- status = CSR_READ_4(sc, SK_ISSR);
- if (!(status & sc->sk_intrmask))
- break;
-
- /* Handle receive interrupts first. */
- if (status & SK_ISR_RX1_EOF) {
- sk_rxeof(sc_if0);
- CSR_WRITE_4(sc, SK_BMU_RX_CSR0,
- SK_RXBMU_CLR_IRQ_EOF|SK_RXBMU_RX_START);
- }
- if (status & SK_ISR_RX2_EOF) {
- sk_rxeof(sc_if1);
- CSR_WRITE_4(sc, SK_BMU_RX_CSR1,
- SK_RXBMU_CLR_IRQ_EOF|SK_RXBMU_RX_START);
- }
-
- /* Then transmit interrupts. */
- if (status & SK_ISR_TX1_S_EOF) {
- sk_txeof(sc_if0);
- CSR_WRITE_4(sc, SK_BMU_TXS_CSR0,
- SK_TXBMU_CLR_IRQ_EOF);
- }
- if (status & SK_ISR_TX2_S_EOF) {
- sk_txeof(sc_if1);
- CSR_WRITE_4(sc, SK_BMU_TXS_CSR1,
- SK_TXBMU_CLR_IRQ_EOF);
- }
-
- /* Then MAC interrupts. */
- if (status & SK_ISR_MAC1 && ifp0->if_flags & IFF_RUNNING) {
- if (sc->sk_type == SK_GENESIS)
- sk_intr_xmac(sc_if0);
- else
- sk_intr_yukon(sc_if0);
- }
-
- if (status & SK_ISR_MAC2 && ifp1->if_flags & IFF_RUNNING) {
- if (sc->sk_type == SK_GENESIS)
- sk_intr_xmac(sc_if1);
- else
- sk_intr_yukon(sc_if1);
- }
-
- if (status & SK_ISR_EXTERNAL_REG) {
- if (ifp0 != NULL &&
- sc_if0->sk_phytype == SK_PHYTYPE_BCOM)
- sk_intr_bcom(sc_if0);
- if (ifp1 != NULL &&
- sc_if1->sk_phytype == SK_PHYTYPE_BCOM)
- sk_intr_bcom(sc_if1);
- }
- }
-
- CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask);
-
- if (ifp0 != NULL && !IFQ_DRV_IS_EMPTY(&ifp0->if_snd))
- sk_start(ifp0);
- if (ifp1 != NULL && !IFQ_DRV_IS_EMPTY(&ifp1->if_snd))
- sk_start(ifp1);
-
- SK_UNLOCK(sc);
-
- return;
-}
-
-static void
-sk_init_xmac(sc_if)
- struct sk_if_softc *sc_if;
-{
- struct sk_softc *sc;
- struct ifnet *ifp;
- struct sk_bcom_hack bhack[] = {
- { 0x18, 0x0c20 }, { 0x17, 0x0012 }, { 0x15, 0x1104 }, { 0x17, 0x0013 },
- { 0x15, 0x0404 }, { 0x17, 0x8006 }, { 0x15, 0x0132 }, { 0x17, 0x8006 },
- { 0x15, 0x0232 }, { 0x17, 0x800D }, { 0x15, 0x000F }, { 0x18, 0x0420 },
- { 0, 0 } };
-
- sc = sc_if->sk_softc;
- ifp = sc_if->sk_ifp;
-
- /* Unreset the XMAC. */
- SK_IF_WRITE_2(sc_if, 0, SK_TXF1_MACCTL, SK_TXMACCTL_XMAC_UNRESET);
- DELAY(1000);
-
- /* Reset the XMAC's internal state. */
- SK_XM_SETBIT_2(sc_if, XM_GPIO, XM_GPIO_RESETMAC);
-
- /* Save the XMAC II revision */
- sc_if->sk_xmac_rev = XM_XMAC_REV(SK_XM_READ_4(sc_if, XM_DEVID));
-
- /*
- * Perform additional initialization for external PHYs,
- * namely for the 1000baseTX cards that use the XMAC's
- * GMII mode.
- */
- if (sc_if->sk_phytype == SK_PHYTYPE_BCOM) {
- int i = 0;
- u_int32_t val;
-
- /* Take PHY out of reset. */
- val = sk_win_read_4(sc, SK_GPIO);
- if (sc_if->sk_port == SK_PORT_A)
- val |= SK_GPIO_DIR0|SK_GPIO_DAT0;
- else
- val |= SK_GPIO_DIR2|SK_GPIO_DAT2;
- sk_win_write_4(sc, SK_GPIO, val);
-
- /* Enable GMII mode on the XMAC. */
- SK_XM_SETBIT_2(sc_if, XM_HWCFG, XM_HWCFG_GMIIMODE);
-
- sk_xmac_miibus_writereg(sc_if, SK_PHYADDR_BCOM,
- BRGPHY_MII_BMCR, BRGPHY_BMCR_RESET);
- DELAY(10000);
- sk_xmac_miibus_writereg(sc_if, SK_PHYADDR_BCOM,
- BRGPHY_MII_IMR, 0xFFF0);
-
- /*
- * Early versions of the BCM5400 apparently have
- * a bug that requires them to have their reserved
- * registers initialized to some magic values. I don't
- * know what the numbers do, I'm just the messenger.
- */
- if (sk_xmac_miibus_readreg(sc_if, SK_PHYADDR_BCOM, 0x03)
- == 0x6041) {
- while(bhack[i].reg) {
- sk_xmac_miibus_writereg(sc_if, SK_PHYADDR_BCOM,
- bhack[i].reg, bhack[i].val);
- i++;
- }
- }
- }
-
- /* Set station address */
- SK_XM_WRITE_2(sc_if, XM_PAR0,
- *(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[0]));
- SK_XM_WRITE_2(sc_if, XM_PAR1,
- *(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[2]));
- SK_XM_WRITE_2(sc_if, XM_PAR2,
- *(u_int16_t *)(&IFP2ENADDR(sc_if->sk_ifp)[4]));
- SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_USE_STATION);
-
- if (ifp->if_flags & IFF_BROADCAST) {
- SK_XM_CLRBIT_4(sc_if, XM_MODE, XM_MODE_RX_NOBROAD);
- } else {
- SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_NOBROAD);
- }
-
- /* We don't need the FCS appended to the packet. */
- SK_XM_SETBIT_2(sc_if, XM_RXCMD, XM_RXCMD_STRIPFCS);
-
- /* We want short frames padded to 60 bytes. */
- SK_XM_SETBIT_2(sc_if, XM_TXCMD, XM_TXCMD_AUTOPAD);
-
- /*
- * Enable the reception of all error frames. This is is
- * a necessary evil due to the design of the XMAC. The
- * XMAC's receive FIFO is only 8K in size, however jumbo
- * frames can be up to 9000 bytes in length. When bad
- * frame filtering is enabled, the XMAC's RX FIFO operates
- * in 'store and forward' mode. For this to work, the
- * entire frame has to fit into the FIFO, but that means
- * that jumbo frames larger than 8192 bytes will be
- * truncated. Disabling all bad frame filtering causes
- * the RX FIFO to operate in streaming mode, in which
- * case the XMAC will start transfering frames out of the
- * RX FIFO as soon as the FIFO threshold is reached.
- */
- SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_BADFRAMES|
- XM_MODE_RX_GIANTS|XM_MODE_RX_RUNTS|XM_MODE_RX_CRCERRS|
- XM_MODE_RX_INRANGELEN);
-
- if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN))
- SK_XM_SETBIT_2(sc_if, XM_RXCMD, XM_RXCMD_BIGPKTOK);
- else
- SK_XM_CLRBIT_2(sc_if, XM_RXCMD, XM_RXCMD_BIGPKTOK);
-
- /*
- * Bump up the transmit threshold. This helps hold off transmit
- * underruns when we're blasting traffic from both ports at once.
- */
- SK_XM_WRITE_2(sc_if, XM_TX_REQTHRESH, SK_XM_TX_FIFOTHRESH);
-
- /* Set promiscuous mode */
- sk_setpromisc(sc_if);
-
- /* Set multicast filter */
- sk_setmulti(sc_if);
-
- /* Clear and enable interrupts */
- SK_XM_READ_2(sc_if, XM_ISR);
- if (sc_if->sk_phytype == SK_PHYTYPE_XMAC)
- SK_XM_WRITE_2(sc_if, XM_IMR, XM_INTRS);
- else
- SK_XM_WRITE_2(sc_if, XM_IMR, 0xFFFF);
-
- /* Configure MAC arbiter */
- switch(sc_if->sk_xmac_rev) {
- case XM_XMAC_REV_B2:
- sk_win_write_1(sc, SK_RCINIT_RX1, SK_RCINIT_XMAC_B2);
- sk_win_write_1(sc, SK_RCINIT_TX1, SK_RCINIT_XMAC_B2);
- sk_win_write_1(sc, SK_RCINIT_RX2, SK_RCINIT_XMAC_B2);
- sk_win_write_1(sc, SK_RCINIT_TX2, SK_RCINIT_XMAC_B2);
- sk_win_write_1(sc, SK_MINIT_RX1, SK_MINIT_XMAC_B2);
- sk_win_write_1(sc, SK_MINIT_TX1, SK_MINIT_XMAC_B2);
- sk_win_write_1(sc, SK_MINIT_RX2, SK_MINIT_XMAC_B2);
- sk_win_write_1(sc, SK_MINIT_TX2, SK_MINIT_XMAC_B2);
- sk_win_write_1(sc, SK_RECOVERY_CTL, SK_RECOVERY_XMAC_B2);
- break;
- case XM_XMAC_REV_C1:
- sk_win_write_1(sc, SK_RCINIT_RX1, SK_RCINIT_XMAC_C1);
- sk_win_write_1(sc, SK_RCINIT_TX1, SK_RCINIT_XMAC_C1);
- sk_win_write_1(sc, SK_RCINIT_RX2, SK_RCINIT_XMAC_C1);
- sk_win_write_1(sc, SK_RCINIT_TX2, SK_RCINIT_XMAC_C1);
- sk_win_write_1(sc, SK_MINIT_RX1, SK_MINIT_XMAC_C1);
- sk_win_write_1(sc, SK_MINIT_TX1, SK_MINIT_XMAC_C1);
- sk_win_write_1(sc, SK_MINIT_RX2, SK_MINIT_XMAC_C1);
- sk_win_write_1(sc, SK_MINIT_TX2, SK_MINIT_XMAC_C1);
- sk_win_write_1(sc, SK_RECOVERY_CTL, SK_RECOVERY_XMAC_B2);
- break;
- default:
- break;
- }
- sk_win_write_2(sc, SK_MACARB_CTL,
- SK_MACARBCTL_UNRESET|SK_MACARBCTL_FASTOE_OFF);
-
- sc_if->sk_link = 1;
-
- return;
-}
-
-static void
-sk_init_yukon(sc_if)
- struct sk_if_softc *sc_if;
-{
- u_int32_t phy;
- u_int16_t reg;
- struct sk_softc *sc;
- struct ifnet *ifp;
- int i;
-
- sc = sc_if->sk_softc;
- ifp = sc_if->sk_ifp;
-
- if (sc->sk_type == SK_YUKON_LITE &&
- sc->sk_rev == SK_YUKON_LITE_REV_A3) {
- /* Take PHY out of reset. */
- sk_win_write_4(sc, SK_GPIO,
- (sk_win_read_4(sc, SK_GPIO) | SK_GPIO_DIR9) & ~SK_GPIO_DAT9);
- }
-
- /* GMAC and GPHY Reset */
- SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_SET);
- SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_RESET_SET);
- DELAY(1000);
- SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_RESET_CLEAR);
- SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_RESET_SET);
- DELAY(1000);
-
- phy = SK_GPHY_INT_POL_HI | SK_GPHY_DIS_FC | SK_GPHY_DIS_SLEEP |
- SK_GPHY_ENA_XC | SK_GPHY_ANEG_ALL | SK_GPHY_ENA_PAUSE;
-
- switch(sc_if->sk_softc->sk_pmd) {
- case IFM_1000_SX:
- case IFM_1000_LX:
- phy |= SK_GPHY_FIBER;
- break;
-
- case IFM_1000_CX:
- case IFM_1000_T:
- phy |= SK_GPHY_COPPER;
- break;
- }
-
- SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, phy | SK_GPHY_RESET_SET);
- DELAY(1000);
- SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, phy | SK_GPHY_RESET_CLEAR);
- SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_LOOP_OFF |
- SK_GMAC_PAUSE_ON | SK_GMAC_RESET_CLEAR);
-
- /* unused read of the interrupt source register */
- SK_IF_READ_2(sc_if, 0, SK_GMAC_ISR);
-
- reg = SK_YU_READ_2(sc_if, YUKON_PAR);
-
- /* MIB Counter Clear Mode set */
- reg |= YU_PAR_MIB_CLR;
- SK_YU_WRITE_2(sc_if, YUKON_PAR, reg);
-
- /* MIB Counter Clear Mode clear */
- reg &= ~YU_PAR_MIB_CLR;
- SK_YU_WRITE_2(sc_if, YUKON_PAR, reg);
-
- /* receive control reg */
- SK_YU_WRITE_2(sc_if, YUKON_RCR, YU_RCR_CRCR);
-
- /* transmit parameter register */
- SK_YU_WRITE_2(sc_if, YUKON_TPR, YU_TPR_JAM_LEN(0x3) |
- YU_TPR_JAM_IPG(0xb) | YU_TPR_JAM2DATA_IPG(0x1a) );
-
- /* serial mode register */
- reg = YU_SMR_DATA_BLIND(0x1c) | YU_SMR_MFL_VLAN | YU_SMR_IPG_DATA(0x1e);
- if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN))
- reg |= YU_SMR_MFL_JUMBO;
- SK_YU_WRITE_2(sc_if, YUKON_SMR, reg);
-
- /* Setup Yukon's address */
- for (i = 0; i < 3; i++) {
- /* Write Source Address 1 (unicast filter) */
- SK_YU_WRITE_2(sc_if, YUKON_SAL1 + i * 4,
- IFP2ENADDR(sc_if->sk_ifp)[i * 2] |
- IFP2ENADDR(sc_if->sk_ifp)[i * 2 + 1] << 8);
- }
-
- for (i = 0; i < 3; i++) {
- reg = sk_win_read_2(sc_if->sk_softc,
- SK_MAC1_0 + i * 2 + sc_if->sk_port * 8);
- SK_YU_WRITE_2(sc_if, YUKON_SAL2 + i * 4, reg);
- }
-
- /* Set promiscuous mode */
- sk_setpromisc(sc_if);
-
- /* Set multicast filter */
- sk_setmulti(sc_if);
-
- /* enable interrupt mask for counter overflows */
- SK_YU_WRITE_2(sc_if, YUKON_TIMR, 0);
- SK_YU_WRITE_2(sc_if, YUKON_RIMR, 0);
- SK_YU_WRITE_2(sc_if, YUKON_TRIMR, 0);
-
- /* Configure RX MAC FIFO */
- SK_IF_WRITE_1(sc_if, 0, SK_RXMF1_CTRL_TEST, SK_RFCTL_RESET_CLEAR);
- SK_IF_WRITE_4(sc_if, 0, SK_RXMF1_CTRL_TEST, SK_RFCTL_OPERATION_ON);
-
- /* Configure TX MAC FIFO */
- SK_IF_WRITE_1(sc_if, 0, SK_TXMF1_CTRL_TEST, SK_TFCTL_RESET_CLEAR);
- SK_IF_WRITE_4(sc_if, 0, SK_TXMF1_CTRL_TEST, SK_TFCTL_OPERATION_ON);
-}
-
-/*
- * Note that to properly initialize any part of the GEnesis chip,
- * you first have to take it out of reset mode.
- */
-static void
-sk_init(xsc)
- void *xsc;
-{
- struct sk_if_softc *sc_if = xsc;
- struct sk_softc *sc;
- struct ifnet *ifp;
- struct mii_data *mii;
- u_int16_t reg;
- u_int32_t imr;
-
- SK_IF_LOCK(sc_if);
-
- ifp = sc_if->sk_ifp;
- sc = sc_if->sk_softc;
- mii = device_get_softc(sc_if->sk_miibus);
-
- if (ifp->if_flags & IFF_RUNNING) {
- SK_IF_UNLOCK(sc_if);
- return;
- }
-
- /* Cancel pending I/O and free all RX/TX buffers. */
- sk_stop(sc_if);
-
- if (sc->sk_type == SK_GENESIS) {
- /* Configure LINK_SYNC LED */
- SK_IF_WRITE_1(sc_if, 0, SK_LINKLED1_CTL, SK_LINKLED_ON);
- SK_IF_WRITE_1(sc_if, 0, SK_LINKLED1_CTL,
- SK_LINKLED_LINKSYNC_ON);
-
- /* Configure RX LED */
- SK_IF_WRITE_1(sc_if, 0, SK_RXLED1_CTL,
- SK_RXLEDCTL_COUNTER_START);
-
- /* Configure TX LED */
- SK_IF_WRITE_1(sc_if, 0, SK_TXLED1_CTL,
- SK_TXLEDCTL_COUNTER_START);
- }
-
- /* Configure I2C registers */
-
- /* Configure XMAC(s) */
- switch (sc->sk_type) {
- case SK_GENESIS:
- sk_init_xmac(sc_if);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- sk_init_yukon(sc_if);
- break;
- }
- mii_mediachg(mii);
-
- if (sc->sk_type == SK_GENESIS) {
- /* Configure MAC FIFOs */
- SK_IF_WRITE_4(sc_if, 0, SK_RXF1_CTL, SK_FIFO_UNRESET);
- SK_IF_WRITE_4(sc_if, 0, SK_RXF1_END, SK_FIFO_END);
- SK_IF_WRITE_4(sc_if, 0, SK_RXF1_CTL, SK_FIFO_ON);
-
- SK_IF_WRITE_4(sc_if, 0, SK_TXF1_CTL, SK_FIFO_UNRESET);
- SK_IF_WRITE_4(sc_if, 0, SK_TXF1_END, SK_FIFO_END);
- SK_IF_WRITE_4(sc_if, 0, SK_TXF1_CTL, SK_FIFO_ON);
- }
-
- /* Configure transmit arbiter(s) */
- SK_IF_WRITE_1(sc_if, 0, SK_TXAR1_COUNTERCTL,
- SK_TXARCTL_ON|SK_TXARCTL_FSYNC_ON);
-
- /* Configure RAMbuffers */
- SK_IF_WRITE_4(sc_if, 0, SK_RXRB1_CTLTST, SK_RBCTL_UNRESET);
- SK_IF_WRITE_4(sc_if, 0, SK_RXRB1_START, sc_if->sk_rx_ramstart);
- SK_IF_WRITE_4(sc_if, 0, SK_RXRB1_WR_PTR, sc_if->sk_rx_ramstart);
- SK_IF_WRITE_4(sc_if, 0, SK_RXRB1_RD_PTR, sc_if->sk_rx_ramstart);
- SK_IF_WRITE_4(sc_if, 0, SK_RXRB1_END, sc_if->sk_rx_ramend);
- SK_IF_WRITE_4(sc_if, 0, SK_RXRB1_CTLTST, SK_RBCTL_ON);
-
- SK_IF_WRITE_4(sc_if, 1, SK_TXRBS1_CTLTST, SK_RBCTL_UNRESET);
- SK_IF_WRITE_4(sc_if, 1, SK_TXRBS1_CTLTST, SK_RBCTL_STORENFWD_ON);
- SK_IF_WRITE_4(sc_if, 1, SK_TXRBS1_START, sc_if->sk_tx_ramstart);
- SK_IF_WRITE_4(sc_if, 1, SK_TXRBS1_WR_PTR, sc_if->sk_tx_ramstart);
- SK_IF_WRITE_4(sc_if, 1, SK_TXRBS1_RD_PTR, sc_if->sk_tx_ramstart);
- SK_IF_WRITE_4(sc_if, 1, SK_TXRBS1_END, sc_if->sk_tx_ramend);
- SK_IF_WRITE_4(sc_if, 1, SK_TXRBS1_CTLTST, SK_RBCTL_ON);
-
- /* Configure BMUs */
- SK_IF_WRITE_4(sc_if, 0, SK_RXQ1_BMU_CSR, SK_RXBMU_ONLINE);
- SK_IF_WRITE_4(sc_if, 0, SK_RXQ1_CURADDR_LO,
- vtophys(&sc_if->sk_rdata->sk_rx_ring[0]));
- SK_IF_WRITE_4(sc_if, 0, SK_RXQ1_CURADDR_HI, 0);
-
- SK_IF_WRITE_4(sc_if, 1, SK_TXQS1_BMU_CSR, SK_TXBMU_ONLINE);
- SK_IF_WRITE_4(sc_if, 1, SK_TXQS1_CURADDR_LO,
- vtophys(&sc_if->sk_rdata->sk_tx_ring[0]));
- SK_IF_WRITE_4(sc_if, 1, SK_TXQS1_CURADDR_HI, 0);
-
- /* Init descriptors */
- if (sk_init_rx_ring(sc_if) == ENOBUFS) {
- printf("sk%d: initialization failed: no "
- "memory for rx buffers\n", sc_if->sk_unit);
- sk_stop(sc_if);
- SK_IF_UNLOCK(sc_if);
- return;
- }
- sk_init_tx_ring(sc_if);
-
- /* Set interrupt moderation if changed via sysctl. */
- /* SK_LOCK(sc); */
- imr = sk_win_read_4(sc, SK_IMTIMERINIT);
- if (imr != SK_IM_USECS(sc->sk_int_mod)) {
- sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod));
- printf("skc%d: interrupt moderation is %d us\n",
- sc->sk_unit, sc->sk_int_mod);
- }
- /* SK_UNLOCK(sc); */
-
- /* Configure interrupt handling */
- CSR_READ_4(sc, SK_ISSR);
- if (sc_if->sk_port == SK_PORT_A)
- sc->sk_intrmask |= SK_INTRS1;
- else
- sc->sk_intrmask |= SK_INTRS2;
-
- sc->sk_intrmask |= SK_ISR_EXTERNAL_REG;
-
- CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask);
-
- /* Start BMUs. */
- SK_IF_WRITE_4(sc_if, 0, SK_RXQ1_BMU_CSR, SK_RXBMU_RX_START);
-
- switch(sc->sk_type) {
- case SK_GENESIS:
- /* Enable XMACs TX and RX state machines */
- SK_XM_CLRBIT_2(sc_if, XM_MMUCMD, XM_MMUCMD_IGNPAUSE);
- SK_XM_SETBIT_2(sc_if, XM_MMUCMD, XM_MMUCMD_TX_ENB|XM_MMUCMD_RX_ENB);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- reg = SK_YU_READ_2(sc_if, YUKON_GPCR);
- reg |= YU_GPCR_TXEN | YU_GPCR_RXEN;
- reg &= ~(YU_GPCR_SPEED_EN | YU_GPCR_DPLX_EN);
- SK_YU_WRITE_2(sc_if, YUKON_GPCR, reg);
- }
-
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- SK_IF_UNLOCK(sc_if);
-
- return;
-}
-
-static void
-sk_stop(sc_if)
- struct sk_if_softc *sc_if;
-{
- int i;
- struct sk_softc *sc;
- struct ifnet *ifp;
-
- SK_IF_LOCK(sc_if);
- sc = sc_if->sk_softc;
- ifp = sc_if->sk_ifp;
-
- untimeout(sk_tick, sc_if, sc_if->sk_tick_ch);
-
- if (sc_if->sk_phytype == SK_PHYTYPE_BCOM) {
- u_int32_t val;
-
- /* Put PHY back into reset. */
- val = sk_win_read_4(sc, SK_GPIO);
- if (sc_if->sk_port == SK_PORT_A) {
- val |= SK_GPIO_DIR0;
- val &= ~SK_GPIO_DAT0;
- } else {
- val |= SK_GPIO_DIR2;
- val &= ~SK_GPIO_DAT2;
- }
- sk_win_write_4(sc, SK_GPIO, val);
- }
-
- /* Turn off various components of this interface. */
- SK_XM_SETBIT_2(sc_if, XM_GPIO, XM_GPIO_RESETMAC);
- switch (sc->sk_type) {
- case SK_GENESIS:
- SK_IF_WRITE_2(sc_if, 0, SK_TXF1_MACCTL, SK_TXMACCTL_XMAC_RESET);
- SK_IF_WRITE_4(sc_if, 0, SK_RXF1_CTL, SK_FIFO_RESET);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- SK_IF_WRITE_1(sc_if,0, SK_RXMF1_CTRL_TEST, SK_RFCTL_RESET_SET);
- SK_IF_WRITE_1(sc_if,0, SK_TXMF1_CTRL_TEST, SK_TFCTL_RESET_SET);
- break;
- }
- SK_IF_WRITE_4(sc_if, 0, SK_RXQ1_BMU_CSR, SK_RXBMU_OFFLINE);
- SK_IF_WRITE_4(sc_if, 0, SK_RXRB1_CTLTST, SK_RBCTL_RESET|SK_RBCTL_OFF);
- SK_IF_WRITE_4(sc_if, 1, SK_TXQS1_BMU_CSR, SK_TXBMU_OFFLINE);
- SK_IF_WRITE_4(sc_if, 1, SK_TXRBS1_CTLTST, SK_RBCTL_RESET|SK_RBCTL_OFF);
- SK_IF_WRITE_1(sc_if, 0, SK_TXAR1_COUNTERCTL, SK_TXARCTL_OFF);
- SK_IF_WRITE_1(sc_if, 0, SK_RXLED1_CTL, SK_RXLEDCTL_COUNTER_STOP);
- SK_IF_WRITE_1(sc_if, 0, SK_TXLED1_CTL, SK_RXLEDCTL_COUNTER_STOP);
- SK_IF_WRITE_1(sc_if, 0, SK_LINKLED1_CTL, SK_LINKLED_OFF);
- SK_IF_WRITE_1(sc_if, 0, SK_LINKLED1_CTL, SK_LINKLED_LINKSYNC_OFF);
-
- /* Disable interrupts */
- if (sc_if->sk_port == SK_PORT_A)
- sc->sk_intrmask &= ~SK_INTRS1;
- else
- sc->sk_intrmask &= ~SK_INTRS2;
- CSR_WRITE_4(sc, SK_IMR, sc->sk_intrmask);
-
- SK_XM_READ_2(sc_if, XM_ISR);
- SK_XM_WRITE_2(sc_if, XM_IMR, 0xFFFF);
-
- /* Free RX and TX mbufs still in the queues. */
- for (i = 0; i < SK_RX_RING_CNT; i++) {
- if (sc_if->sk_cdata.sk_rx_chain[i].sk_mbuf != NULL) {
- m_freem(sc_if->sk_cdata.sk_rx_chain[i].sk_mbuf);
- sc_if->sk_cdata.sk_rx_chain[i].sk_mbuf = NULL;
- }
- }
-
- for (i = 0; i < SK_TX_RING_CNT; i++) {
- if (sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf != NULL) {
- m_freem(sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf);
- sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf = NULL;
- }
- }
-
- ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
- SK_IF_UNLOCK(sc_if);
- return;
-}
-
-static int
-sysctl_int_range(SYSCTL_HANDLER_ARGS, int low, int high)
-{
- int error, value;
-
- if (!arg1)
- return (EINVAL);
- value = *(int *)arg1;
- error = sysctl_handle_int(oidp, &value, 0, req);
- if (error || !req->newptr)
- return (error);
- if (value < low || value > high)
- return (EINVAL);
- *(int *)arg1 = value;
- return (0);
-}
-
-static int
-sysctl_hw_sk_int_mod(SYSCTL_HANDLER_ARGS)
-{
- return (sysctl_int_range(oidp, arg1, arg2, req, SK_IM_MIN, SK_IM_MAX));
-}
diff --git a/sys/dev/sk/if_skreg.h b/sys/dev/sk/if_skreg.h
deleted file mode 100644
index e8b6b8a..0000000
--- a/sys/dev/sk/if_skreg.h
+++ /dev/null
@@ -1,1499 +0,0 @@
-/* $OpenBSD: if_skreg.h,v 1.10 2003/08/12 05:23:06 nate Exp $ */
-
-/*-
- * Copyright (c) 1997, 1998, 1999, 2000
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*-
- * Copyright (c) 2003 Nathan L. Binkert <binkertn@umich.edu>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* Values to keep the different chip revisions apart (SK_CHIPVER). */
-#define SK_GENESIS 0x0A
-#define SK_YUKON 0xB0
-#define SK_YUKON_LITE 0xB1
-#define SK_YUKON_LP 0xB2
-#define SK_YUKON_FAMILY(x) ((x) & 0xB0)
-
-/* Known revisions in SK_CONFIG. */
-#define SK_YUKON_LITE_REV_A0 0x0 /* invented, see test in skc_attach. */
-#define SK_YUKON_LITE_REV_A1 0x3
-#define SK_YUKON_LITE_REV_A3 0x7
-
-/*
- * SysKonnect PCI vendor ID
- */
-#define VENDORID_SK 0x1148
-
-/*
- * Marvell PCI vendor ID
- */
-#define VENDORID_MARVELL 0x11AB
-
-/*
- * SK-NET gigabit ethernet device IDs
- */
-#define DEVICEID_SK_V1 0x4300
-#define DEVICEID_SK_V2 0x4320
-
-/*
- * Belkin F5D5005
- */
-#define DEVICEID_BELKIN_5005 0x5005
-
-/*
- * 3Com PCI vendor ID
- */
-#define VENDORID_3COM 0x10b7
-
-/*
- * 3Com gigabit ethernet device ID
- */
-#define DEVICEID_3COM_3C940 0x1700
-
-/*
- * Linksys PCI vendor ID
- */
-#define VENDORID_LINKSYS 0x1737
-
-/*
- * Linksys gigabit ethernet device ID
- */
-#define DEVICEID_LINKSYS_EG1032 0x1032
-
-/*
- * D-Link PCI vendor ID
- */
-#define VENDORID_DLINK 0x1186
-
-/*
- * D-Link gigabit ethernet device ID
- */
-#define DEVICEID_DLINK_DGE530T 0x4c00
-
-/*
- * GEnesis registers. The GEnesis chip has a 256-byte I/O window
- * but internally it has a 16K register space. This 16K space is
- * divided into 128-byte blocks. The first 128 bytes of the I/O
- * window represent the first block, which is permanently mapped
- * at the start of the window. The other 127 blocks can be mapped
- * to the second 128 bytes of the I/O window by setting the desired
- * block value in the RAP register in block 0. Not all of the 127
- * blocks are actually used. Most registers are 32 bits wide, but
- * there are a few 16-bit and 8-bit ones as well.
- */
-
-
-/* Start of remappable register window. */
-#define SK_WIN_BASE 0x0080
-
-/* Size of a window */
-#define SK_WIN_LEN 0x80
-
-#define SK_WIN_MASK 0x3F80
-#define SK_REG_MASK 0x7F
-
-/* Compute the window of a given register (for the RAP register) */
-#define SK_WIN(reg) (((reg) & SK_WIN_MASK) / SK_WIN_LEN)
-
-/* Compute the relative offset of a register within the window */
-#define SK_REG(reg) ((reg) & SK_REG_MASK)
-
-#define SK_PORT_A 0
-#define SK_PORT_B 1
-
-/*
- * Compute offset of port-specific register. Since there are two
- * ports, there are two of some GEnesis modules (e.g. two sets of
- * DMA queues, two sets of FIFO control registers, etc...). Normally,
- * the block for port 0 is at offset 0x0 and the block for port 1 is
- * at offset 0x80 (i.e. the next page over). However for the transmit
- * BMUs and RAMbuffers, there are two blocks for each port: one for
- * the sync transmit queue and one for the async queue (which we don't
- * use). However instead of ordering them like this:
- * TX sync 1 / TX sync 2 / TX async 1 / TX async 2
- * SysKonnect has instead ordered them like this:
- * TX sync 1 / TX async 1 / TX sync 2 / TX async 2
- * This means that when referencing the TX BMU and RAMbuffer registers,
- * we have to double the block offset (0x80 * 2) in order to reach the
- * second queue. This prevents us from using the same formula
- * (sk_port * 0x80) to compute the offsets for all of the port-specific
- * blocks: we need an extra offset for the BMU and RAMbuffer registers.
- * The simplest thing is to provide an extra argument to these macros:
- * the 'skip' parameter. The 'skip' value is the number of extra pages
- * for skip when computing the port0/port1 offsets. For most registers,
- * the skip value is 0; for the BMU and RAMbuffer registers, it's 1.
- */
-#define SK_IF_READ_4(sc_if, skip, reg) \
- sk_win_read_4(sc_if->sk_softc, reg + \
- ((sc_if->sk_port * (skip + 1)) * SK_WIN_LEN))
-#define SK_IF_READ_2(sc_if, skip, reg) \
- sk_win_read_2(sc_if->sk_softc, reg + \
- ((sc_if->sk_port * (skip + 1)) * SK_WIN_LEN))
-#define SK_IF_READ_1(sc_if, skip, reg) \
- sk_win_read_1(sc_if->sk_softc, reg + \
- ((sc_if->sk_port * (skip + 1)) * SK_WIN_LEN))
-
-#define SK_IF_WRITE_4(sc_if, skip, reg, val) \
- sk_win_write_4(sc_if->sk_softc, \
- reg + ((sc_if->sk_port * (skip + 1)) * SK_WIN_LEN), val)
-#define SK_IF_WRITE_2(sc_if, skip, reg, val) \
- sk_win_write_2(sc_if->sk_softc, \
- reg + ((sc_if->sk_port * (skip + 1)) * SK_WIN_LEN), val)
-#define SK_IF_WRITE_1(sc_if, skip, reg, val) \
- sk_win_write_1(sc_if->sk_softc, \
- reg + ((sc_if->sk_port * (skip + 1)) * SK_WIN_LEN), val)
-
-/* Block 0 registers, permanently mapped at iobase. */
-#define SK_RAP 0x0000
-#define SK_CSR 0x0004
-#define SK_LED 0x0006
-#define SK_ISR 0x0008 /* interrupt source */
-#define SK_IMR 0x000C /* interrupt mask */
-#define SK_IESR 0x0010 /* interrupt hardware error source */
-#define SK_IEMR 0x0014 /* interrupt hardware error mask */
-#define SK_ISSR 0x0018 /* special interrupt source */
-#define SK_XM_IMR0 0x0020
-#define SK_XM_ISR0 0x0028
-#define SK_XM_PHYADDR0 0x0030
-#define SK_XM_PHYDATA0 0x0034
-#define SK_XM_IMR1 0x0040
-#define SK_XM_ISR1 0x0048
-#define SK_XM_PHYADDR1 0x0050
-#define SK_XM_PHYDATA1 0x0054
-#define SK_BMU_RX_CSR0 0x0060
-#define SK_BMU_RX_CSR1 0x0064
-#define SK_BMU_TXS_CSR0 0x0068
-#define SK_BMU_TXA_CSR0 0x006C
-#define SK_BMU_TXS_CSR1 0x0070
-#define SK_BMU_TXA_CSR1 0x0074
-
-/* SK_CSR register */
-#define SK_CSR_SW_RESET 0x0001
-#define SK_CSR_SW_UNRESET 0x0002
-#define SK_CSR_MASTER_RESET 0x0004
-#define SK_CSR_MASTER_UNRESET 0x0008
-#define SK_CSR_MASTER_STOP 0x0010
-#define SK_CSR_MASTER_DONE 0x0020
-#define SK_CSR_SW_IRQ_CLEAR 0x0040
-#define SK_CSR_SW_IRQ_SET 0x0080
-#define SK_CSR_SLOTSIZE 0x0100 /* 1 == 64 bits, 0 == 32 */
-#define SK_CSR_BUSCLOCK 0x0200 /* 1 == 33/66 Mhz, = 33 */
-
-/* SK_LED register */
-#define SK_LED_GREEN_OFF 0x01
-#define SK_LED_GREEN_ON 0x02
-
-/* SK_ISR register */
-#define SK_ISR_TX2_AS_CHECK 0x00000001
-#define SK_ISR_TX2_AS_EOF 0x00000002
-#define SK_ISR_TX2_AS_EOB 0x00000004
-#define SK_ISR_TX2_S_CHECK 0x00000008
-#define SK_ISR_TX2_S_EOF 0x00000010
-#define SK_ISR_TX2_S_EOB 0x00000020
-#define SK_ISR_TX1_AS_CHECK 0x00000040
-#define SK_ISR_TX1_AS_EOF 0x00000080
-#define SK_ISR_TX1_AS_EOB 0x00000100
-#define SK_ISR_TX1_S_CHECK 0x00000200
-#define SK_ISR_TX1_S_EOF 0x00000400
-#define SK_ISR_TX1_S_EOB 0x00000800
-#define SK_ISR_RX2_CHECK 0x00001000
-#define SK_ISR_RX2_EOF 0x00002000
-#define SK_ISR_RX2_EOB 0x00004000
-#define SK_ISR_RX1_CHECK 0x00008000
-#define SK_ISR_RX1_EOF 0x00010000
-#define SK_ISR_RX1_EOB 0x00020000
-#define SK_ISR_LINK2_OFLOW 0x00040000
-#define SK_ISR_MAC2 0x00080000
-#define SK_ISR_LINK1_OFLOW 0x00100000
-#define SK_ISR_MAC1 0x00200000
-#define SK_ISR_TIMER 0x00400000
-#define SK_ISR_EXTERNAL_REG 0x00800000
-#define SK_ISR_SW 0x01000000
-#define SK_ISR_I2C_RDY 0x02000000
-#define SK_ISR_TX2_TIMEO 0x04000000
-#define SK_ISR_TX1_TIMEO 0x08000000
-#define SK_ISR_RX2_TIMEO 0x10000000
-#define SK_ISR_RX1_TIMEO 0x20000000
-#define SK_ISR_RSVD 0x40000000
-#define SK_ISR_HWERR 0x80000000
-
-/* SK_IMR register */
-#define SK_IMR_TX2_AS_CHECK 0x00000001
-#define SK_IMR_TX2_AS_EOF 0x00000002
-#define SK_IMR_TX2_AS_EOB 0x00000004
-#define SK_IMR_TX2_S_CHECK 0x00000008
-#define SK_IMR_TX2_S_EOF 0x00000010
-#define SK_IMR_TX2_S_EOB 0x00000020
-#define SK_IMR_TX1_AS_CHECK 0x00000040
-#define SK_IMR_TX1_AS_EOF 0x00000080
-#define SK_IMR_TX1_AS_EOB 0x00000100
-#define SK_IMR_TX1_S_CHECK 0x00000200
-#define SK_IMR_TX1_S_EOF 0x00000400
-#define SK_IMR_TX1_S_EOB 0x00000800
-#define SK_IMR_RX2_CHECK 0x00001000
-#define SK_IMR_RX2_EOF 0x00002000
-#define SK_IMR_RX2_EOB 0x00004000
-#define SK_IMR_RX1_CHECK 0x00008000
-#define SK_IMR_RX1_EOF 0x00010000
-#define SK_IMR_RX1_EOB 0x00020000
-#define SK_IMR_LINK2_OFLOW 0x00040000
-#define SK_IMR_MAC2 0x00080000
-#define SK_IMR_LINK1_OFLOW 0x00100000
-#define SK_IMR_MAC1 0x00200000
-#define SK_IMR_TIMER 0x00400000
-#define SK_IMR_EXTERNAL_REG 0x00800000
-#define SK_IMR_SW 0x01000000
-#define SK_IMR_I2C_RDY 0x02000000
-#define SK_IMR_TX2_TIMEO 0x04000000
-#define SK_IMR_TX1_TIMEO 0x08000000
-#define SK_IMR_RX2_TIMEO 0x10000000
-#define SK_IMR_RX1_TIMEO 0x20000000
-#define SK_IMR_RSVD 0x40000000
-#define SK_IMR_HWERR 0x80000000
-
-#define SK_INTRS1 \
- (SK_IMR_RX1_EOF|SK_IMR_TX1_S_EOF|SK_IMR_MAC1)
-
-#define SK_INTRS2 \
- (SK_IMR_RX2_EOF|SK_IMR_TX2_S_EOF|SK_IMR_MAC2)
-
-/* SK_IESR register */
-#define SK_IESR_PAR_RX2 0x00000001
-#define SK_IESR_PAR_RX1 0x00000002
-#define SK_IESR_PAR_MAC2 0x00000004
-#define SK_IESR_PAR_MAC1 0x00000008
-#define SK_IESR_PAR_WR_RAM 0x00000010
-#define SK_IESR_PAR_RD_RAM 0x00000020
-#define SK_IESR_NO_TSTAMP_MAC2 0x00000040
-#define SK_IESR_NO_TSTAMO_MAC1 0x00000080
-#define SK_IESR_NO_STS_MAC2 0x00000100
-#define SK_IESR_NO_STS_MAC1 0x00000200
-#define SK_IESR_IRQ_STS 0x00000400
-#define SK_IESR_MASTERERR 0x00000800
-
-/* SK_IEMR register */
-#define SK_IEMR_PAR_RX2 0x00000001
-#define SK_IEMR_PAR_RX1 0x00000002
-#define SK_IEMR_PAR_MAC2 0x00000004
-#define SK_IEMR_PAR_MAC1 0x00000008
-#define SK_IEMR_PAR_WR_RAM 0x00000010
-#define SK_IEMR_PAR_RD_RAM 0x00000020
-#define SK_IEMR_NO_TSTAMP_MAC2 0x00000040
-#define SK_IEMR_NO_TSTAMO_MAC1 0x00000080
-#define SK_IEMR_NO_STS_MAC2 0x00000100
-#define SK_IEMR_NO_STS_MAC1 0x00000200
-#define SK_IEMR_IRQ_STS 0x00000400
-#define SK_IEMR_MASTERERR 0x00000800
-
-/* Block 2 */
-#define SK_MAC0_0 0x0100
-#define SK_MAC0_1 0x0104
-#define SK_MAC1_0 0x0108
-#define SK_MAC1_1 0x010C
-#define SK_MAC2_0 0x0110
-#define SK_MAC2_1 0x0114
-#define SK_CONNTYPE 0x0118
-#define SK_PMDTYPE 0x0119
-#define SK_CONFIG 0x011A
-#define SK_CHIPVER 0x011B
-#define SK_EPROM0 0x011C
-#define SK_EPROM1 0x011D
-#define SK_EPROM2 0x011E
-#define SK_EPROM3 0x011F
-#define SK_EP_ADDR 0x0120
-#define SK_EP_DATA 0x0124
-#define SK_EP_LOADCTL 0x0128
-#define SK_EP_LOADTST 0x0129
-#define SK_TIMERINIT 0x0130
-#define SK_TIMER 0x0134
-#define SK_TIMERCTL 0x0138
-#define SK_TIMERTST 0x0139
-#define SK_IMTIMERINIT 0x0140
-#define SK_IMTIMER 0x0144
-#define SK_IMTIMERCTL 0x0148
-#define SK_IMTIMERTST 0x0149
-#define SK_IMMR 0x014C
-#define SK_IHWEMR 0x0150
-#define SK_TESTCTL1 0x0158
-#define SK_TESTCTL2 0x0159
-#define SK_GPIO 0x015C
-#define SK_I2CHWCTL 0x0160
-#define SK_I2CHWDATA 0x0164
-#define SK_I2CHWIRQ 0x0168
-#define SK_I2CSW 0x016C
-#define SK_BLNKINIT 0x0170
-#define SK_BLNKCOUNT 0x0174
-#define SK_BLNKCTL 0x0178
-#define SK_BLNKSTS 0x0179
-#define SK_BLNKTST 0x017A
-
-#define SK_IMCTL_STOP 0x02
-#define SK_IMCTL_START 0x04
-
-#define SK_IMTIMER_TICKS 54
-#define SK_IM_USECS(x) ((x) * SK_IMTIMER_TICKS)
-
-#define SK_IM_MIN 10
-#define SK_IM_DEFAULT 100
-#define SK_IM_MAX 10000
-
-/*
- * The SK_EPROM0 register contains a byte that describes the
- * amount of SRAM mounted on the NIC. The value also tells if
- * the chips are 64K or 128K. This affects the RAMbuffer address
- * offset that we need to use.
- */
-#define SK_RAMSIZE_512K_64 0x1
-#define SK_RAMSIZE_1024K_128 0x2
-#define SK_RAMSIZE_1024K_64 0x3
-#define SK_RAMSIZE_2048K_128 0x4
-
-#define SK_RBOFF_0 0x0
-#define SK_RBOFF_80000 0x80000
-
-/*
- * SK_EEPROM1 contains the PHY type, which may be XMAC for
- * fiber-based cards or BCOM for 1000baseT cards with a Broadcom
- * PHY.
- */
-#define SK_PHYTYPE_XMAC 0 /* integeated XMAC II PHY */
-#define SK_PHYTYPE_BCOM 1 /* Broadcom BCM5400 */
-#define SK_PHYTYPE_LONE 2 /* Level One LXT1000 */
-#define SK_PHYTYPE_NAT 3 /* National DP83891 */
-#define SK_PHYTYPE_MARV_COPPER 4 /* Marvell 88E1011S */
-#define SK_PHYTYPE_MARV_FIBER 5 /* Marvell 88E1011S (fiber) */
-
-/*
- * PHY addresses.
- */
-#define SK_PHYADDR_XMAC 0x0
-#define SK_PHYADDR_BCOM 0x1
-#define SK_PHYADDR_LONE 0x3
-#define SK_PHYADDR_NAT 0x0
-#define SK_PHYADDR_MARV 0x0
-
-#define SK_CONFIG_SINGLEMAC 0x01
-#define SK_CONFIG_DIS_DSL_CLK 0x02
-
-#define SK_PMD_1000BASELX 0x4C
-#define SK_PMD_1000BASESX 0x53
-#define SK_PMD_1000BASECX 0x43
-#define SK_PMD_1000BASETX 0x54
-
-/* GPIO bits */
-#define SK_GPIO_DAT0 0x00000001
-#define SK_GPIO_DAT1 0x00000002
-#define SK_GPIO_DAT2 0x00000004
-#define SK_GPIO_DAT3 0x00000008
-#define SK_GPIO_DAT4 0x00000010
-#define SK_GPIO_DAT5 0x00000020
-#define SK_GPIO_DAT6 0x00000040
-#define SK_GPIO_DAT7 0x00000080
-#define SK_GPIO_DAT8 0x00000100
-#define SK_GPIO_DAT9 0x00000200
-#define SK_GPIO_DIR0 0x00010000
-#define SK_GPIO_DIR1 0x00020000
-#define SK_GPIO_DIR2 0x00040000
-#define SK_GPIO_DIR3 0x00080000
-#define SK_GPIO_DIR4 0x00100000
-#define SK_GPIO_DIR5 0x00200000
-#define SK_GPIO_DIR6 0x00400000
-#define SK_GPIO_DIR7 0x00800000
-#define SK_GPIO_DIR8 0x01000000
-#define SK_GPIO_DIR9 0x02000000
-
-/* Block 3 Ram interface and MAC arbiter registers */
-#define SK_RAMADDR 0x0180
-#define SK_RAMDATA0 0x0184
-#define SK_RAMDATA1 0x0188
-#define SK_TO0 0x0190
-#define SK_TO1 0x0191
-#define SK_TO2 0x0192
-#define SK_TO3 0x0193
-#define SK_TO4 0x0194
-#define SK_TO5 0x0195
-#define SK_TO6 0x0196
-#define SK_TO7 0x0197
-#define SK_TO8 0x0198
-#define SK_TO9 0x0199
-#define SK_TO10 0x019A
-#define SK_TO11 0x019B
-#define SK_RITIMEO_TMR 0x019C
-#define SK_RAMCTL 0x01A0
-#define SK_RITIMER_TST 0x01A2
-
-#define SK_RAMCTL_RESET 0x0001
-#define SK_RAMCTL_UNRESET 0x0002
-#define SK_RAMCTL_CLR_IRQ_WPAR 0x0100
-#define SK_RAMCTL_CLR_IRQ_RPAR 0x0200
-
-/* Mac arbiter registers */
-#define SK_MINIT_RX1 0x01B0
-#define SK_MINIT_RX2 0x01B1
-#define SK_MINIT_TX1 0x01B2
-#define SK_MINIT_TX2 0x01B3
-#define SK_MTIMEO_RX1 0x01B4
-#define SK_MTIMEO_RX2 0x01B5
-#define SK_MTIMEO_TX1 0x01B6
-#define SK_MTIEMO_TX2 0x01B7
-#define SK_MACARB_CTL 0x01B8
-#define SK_MTIMER_TST 0x01BA
-#define SK_RCINIT_RX1 0x01C0
-#define SK_RCINIT_RX2 0x01C1
-#define SK_RCINIT_TX1 0x01C2
-#define SK_RCINIT_TX2 0x01C3
-#define SK_RCTIMEO_RX1 0x01C4
-#define SK_RCTIMEO_RX2 0x01C5
-#define SK_RCTIMEO_TX1 0x01C6
-#define SK_RCTIMEO_TX2 0x01C7
-#define SK_RECOVERY_CTL 0x01C8
-#define SK_RCTIMER_TST 0x01CA
-
-/* Packet arbiter registers */
-#define SK_RXPA1_TINIT 0x01D0
-#define SK_RXPA2_TINIT 0x01D4
-#define SK_TXPA1_TINIT 0x01D8
-#define SK_TXPA2_TINIT 0x01DC
-#define SK_RXPA1_TIMEO 0x01E0
-#define SK_RXPA2_TIMEO 0x01E4
-#define SK_TXPA1_TIMEO 0x01E8
-#define SK_TXPA2_TIMEO 0x01EC
-#define SK_PKTARB_CTL 0x01F0
-#define SK_PKTATB_TST 0x01F2
-
-#define SK_PKTARB_TIMEOUT 0x2000
-
-#define SK_PKTARBCTL_RESET 0x0001
-#define SK_PKTARBCTL_UNRESET 0x0002
-#define SK_PKTARBCTL_RXTO1_OFF 0x0004
-#define SK_PKTARBCTL_RXTO1_ON 0x0008
-#define SK_PKTARBCTL_RXTO2_OFF 0x0010
-#define SK_PKTARBCTL_RXTO2_ON 0x0020
-#define SK_PKTARBCTL_TXTO1_OFF 0x0040
-#define SK_PKTARBCTL_TXTO1_ON 0x0080
-#define SK_PKTARBCTL_TXTO2_OFF 0x0100
-#define SK_PKTARBCTL_TXTO2_ON 0x0200
-#define SK_PKTARBCTL_CLR_IRQ_RXTO1 0x0400
-#define SK_PKTARBCTL_CLR_IRQ_RXTO2 0x0800
-#define SK_PKTARBCTL_CLR_IRQ_TXTO1 0x1000
-#define SK_PKTARBCTL_CLR_IRQ_TXTO2 0x2000
-
-#define SK_MINIT_XMAC_B2 54
-#define SK_MINIT_XMAC_C1 63
-
-#define SK_MACARBCTL_RESET 0x0001
-#define SK_MACARBCTL_UNRESET 0x0002
-#define SK_MACARBCTL_FASTOE_OFF 0x0004
-#define SK_MACARBCRL_FASTOE_ON 0x0008
-
-#define SK_RCINIT_XMAC_B2 54
-#define SK_RCINIT_XMAC_C1 0
-
-#define SK_RECOVERYCTL_RX1_OFF 0x0001
-#define SK_RECOVERYCTL_RX1_ON 0x0002
-#define SK_RECOVERYCTL_RX2_OFF 0x0004
-#define SK_RECOVERYCTL_RX2_ON 0x0008
-#define SK_RECOVERYCTL_TX1_OFF 0x0010
-#define SK_RECOVERYCTL_TX1_ON 0x0020
-#define SK_RECOVERYCTL_TX2_OFF 0x0040
-#define SK_RECOVERYCTL_TX2_ON 0x0080
-
-#define SK_RECOVERY_XMAC_B2 \
- (SK_RECOVERYCTL_RX1_ON|SK_RECOVERYCTL_RX2_ON| \
- SK_RECOVERYCTL_TX1_ON|SK_RECOVERYCTL_TX2_ON)
-
-#define SK_RECOVERY_XMAC_C1 \
- (SK_RECOVERYCTL_RX1_OFF|SK_RECOVERYCTL_RX2_OFF| \
- SK_RECOVERYCTL_TX1_OFF|SK_RECOVERYCTL_TX2_OFF)
-
-/* Block 4 -- TX Arbiter MAC 1 */
-#define SK_TXAR1_TIMERINIT 0x0200
-#define SK_TXAR1_TIMERVAL 0x0204
-#define SK_TXAR1_LIMITINIT 0x0208
-#define SK_TXAR1_LIMITCNT 0x020C
-#define SK_TXAR1_COUNTERCTL 0x0210
-#define SK_TXAR1_COUNTERTST 0x0212
-#define SK_TXAR1_COUNTERSTS 0x0212
-
-/* Block 5 -- TX Arbiter MAC 2 */
-#define SK_TXAR2_TIMERINIT 0x0280
-#define SK_TXAR2_TIMERVAL 0x0284
-#define SK_TXAR2_LIMITINIT 0x0288
-#define SK_TXAR2_LIMITCNT 0x028C
-#define SK_TXAR2_COUNTERCTL 0x0290
-#define SK_TXAR2_COUNTERTST 0x0291
-#define SK_TXAR2_COUNTERSTS 0x0292
-
-#define SK_TXARCTL_OFF 0x01
-#define SK_TXARCTL_ON 0x02
-#define SK_TXARCTL_RATECTL_OFF 0x04
-#define SK_TXARCTL_RATECTL_ON 0x08
-#define SK_TXARCTL_ALLOC_OFF 0x10
-#define SK_TXARCTL_ALLOC_ON 0x20
-#define SK_TXARCTL_FSYNC_OFF 0x40
-#define SK_TXARCTL_FSYNC_ON 0x80
-
-/* Block 6 -- External registers */
-#define SK_EXTREG_BASE 0x300
-#define SK_EXTREG_END 0x37C
-
-/* Block 7 -- PCI config registers */
-#define SK_PCI_BASE 0x0380
-#define SK_PCI_END 0x03FC
-
-/* Compute offset of mirrored PCI register */
-#define SK_PCI_REG(reg) ((reg) + SK_PCI_BASE)
-
-/* Block 8 -- RX queue 1 */
-#define SK_RXQ1_BUFCNT 0x0400
-#define SK_RXQ1_BUFCTL 0x0402
-#define SK_RXQ1_NEXTDESC 0x0404
-#define SK_RXQ1_RXBUF_LO 0x0408
-#define SK_RXQ1_RXBUF_HI 0x040C
-#define SK_RXQ1_RXSTAT 0x0410
-#define SK_RXQ1_TIMESTAMP 0x0414
-#define SK_RXQ1_CSUM1 0x0418
-#define SK_RXQ1_CSUM2 0x041A
-#define SK_RXQ1_CSUM1_START 0x041C
-#define SK_RXQ1_CSUM2_START 0x041E
-#define SK_RXQ1_CURADDR_LO 0x0420
-#define SK_RXQ1_CURADDR_HI 0x0424
-#define SK_RXQ1_CURCNT_LO 0x0428
-#define SK_RXQ1_CURCNT_HI 0x042C
-#define SK_RXQ1_CURBYTES 0x0430
-#define SK_RXQ1_BMU_CSR 0x0434
-#define SK_RXQ1_WATERMARK 0x0438
-#define SK_RXQ1_FLAG 0x043A
-#define SK_RXQ1_TEST1 0x043C
-#define SK_RXQ1_TEST2 0x0440
-#define SK_RXQ1_TEST3 0x0444
-
-/* Block 9 -- RX queue 2 */
-#define SK_RXQ2_BUFCNT 0x0480
-#define SK_RXQ2_BUFCTL 0x0482
-#define SK_RXQ2_NEXTDESC 0x0484
-#define SK_RXQ2_RXBUF_LO 0x0488
-#define SK_RXQ2_RXBUF_HI 0x048C
-#define SK_RXQ2_RXSTAT 0x0490
-#define SK_RXQ2_TIMESTAMP 0x0494
-#define SK_RXQ2_CSUM1 0x0498
-#define SK_RXQ2_CSUM2 0x049A
-#define SK_RXQ2_CSUM1_START 0x049C
-#define SK_RXQ2_CSUM2_START 0x049E
-#define SK_RXQ2_CURADDR_LO 0x04A0
-#define SK_RXQ2_CURADDR_HI 0x04A4
-#define SK_RXQ2_CURCNT_LO 0x04A8
-#define SK_RXQ2_CURCNT_HI 0x04AC
-#define SK_RXQ2_CURBYTES 0x04B0
-#define SK_RXQ2_BMU_CSR 0x04B4
-#define SK_RXQ2_WATERMARK 0x04B8
-#define SK_RXQ2_FLAG 0x04BA
-#define SK_RXQ2_TEST1 0x04BC
-#define SK_RXQ2_TEST2 0x04C0
-#define SK_RXQ2_TEST3 0x04C4
-
-#define SK_RXBMU_CLR_IRQ_ERR 0x00000001
-#define SK_RXBMU_CLR_IRQ_EOF 0x00000002
-#define SK_RXBMU_CLR_IRQ_EOB 0x00000004
-#define SK_RXBMU_CLR_IRQ_PAR 0x00000008
-#define SK_RXBMU_RX_START 0x00000010
-#define SK_RXBMU_RX_STOP 0x00000020
-#define SK_RXBMU_POLL_OFF 0x00000040
-#define SK_RXBMU_POLL_ON 0x00000080
-#define SK_RXBMU_TRANSFER_SM_RESET 0x00000100
-#define SK_RXBMU_TRANSFER_SM_UNRESET 0x00000200
-#define SK_RXBMU_DESCWR_SM_RESET 0x00000400
-#define SK_RXBMU_DESCWR_SM_UNRESET 0x00000800
-#define SK_RXBMU_DESCRD_SM_RESET 0x00001000
-#define SK_RXBMU_DESCRD_SM_UNRESET 0x00002000
-#define SK_RXBMU_SUPERVISOR_SM_RESET 0x00004000
-#define SK_RXBMU_SUPERVISOR_SM_UNRESET 0x00008000
-#define SK_RXBMU_PFI_SM_RESET 0x00010000
-#define SK_RXBMU_PFI_SM_UNRESET 0x00020000
-#define SK_RXBMU_FIFO_RESET 0x00040000
-#define SK_RXBMU_FIFO_UNRESET 0x00080000
-#define SK_RXBMU_DESC_RESET 0x00100000
-#define SK_RXBMU_DESC_UNRESET 0x00200000
-#define SK_RXBMU_SUPERVISOR_IDLE 0x01000000
-
-#define SK_RXBMU_ONLINE \
- (SK_RXBMU_TRANSFER_SM_UNRESET|SK_RXBMU_DESCWR_SM_UNRESET| \
- SK_RXBMU_DESCRD_SM_UNRESET|SK_RXBMU_SUPERVISOR_SM_UNRESET| \
- SK_RXBMU_PFI_SM_UNRESET|SK_RXBMU_FIFO_UNRESET| \
- SK_RXBMU_DESC_UNRESET)
-
-#define SK_RXBMU_OFFLINE \
- (SK_RXBMU_TRANSFER_SM_RESET|SK_RXBMU_DESCWR_SM_RESET| \
- SK_RXBMU_DESCRD_SM_RESET|SK_RXBMU_SUPERVISOR_SM_RESET| \
- SK_RXBMU_PFI_SM_RESET|SK_RXBMU_FIFO_RESET| \
- SK_RXBMU_DESC_RESET)
-
-/* Block 12 -- TX sync queue 1 */
-#define SK_TXQS1_BUFCNT 0x0600
-#define SK_TXQS1_BUFCTL 0x0602
-#define SK_TXQS1_NEXTDESC 0x0604
-#define SK_TXQS1_RXBUF_LO 0x0608
-#define SK_TXQS1_RXBUF_HI 0x060C
-#define SK_TXQS1_RXSTAT 0x0610
-#define SK_TXQS1_CSUM_STARTVAL 0x0614
-#define SK_TXQS1_CSUM_STARTPOS 0x0618
-#define SK_TXQS1_CSUM_WRITEPOS 0x061A
-#define SK_TXQS1_CURADDR_LO 0x0620
-#define SK_TXQS1_CURADDR_HI 0x0624
-#define SK_TXQS1_CURCNT_LO 0x0628
-#define SK_TXQS1_CURCNT_HI 0x062C
-#define SK_TXQS1_CURBYTES 0x0630
-#define SK_TXQS1_BMU_CSR 0x0634
-#define SK_TXQS1_WATERMARK 0x0638
-#define SK_TXQS1_FLAG 0x063A
-#define SK_TXQS1_TEST1 0x063C
-#define SK_TXQS1_TEST2 0x0640
-#define SK_TXQS1_TEST3 0x0644
-
-/* Block 13 -- TX async queue 1 */
-#define SK_TXQA1_BUFCNT 0x0680
-#define SK_TXQA1_BUFCTL 0x0682
-#define SK_TXQA1_NEXTDESC 0x0684
-#define SK_TXQA1_RXBUF_LO 0x0688
-#define SK_TXQA1_RXBUF_HI 0x068C
-#define SK_TXQA1_RXSTAT 0x0690
-#define SK_TXQA1_CSUM_STARTVAL 0x0694
-#define SK_TXQA1_CSUM_STARTPOS 0x0698
-#define SK_TXQA1_CSUM_WRITEPOS 0x069A
-#define SK_TXQA1_CURADDR_LO 0x06A0
-#define SK_TXQA1_CURADDR_HI 0x06A4
-#define SK_TXQA1_CURCNT_LO 0x06A8
-#define SK_TXQA1_CURCNT_HI 0x06AC
-#define SK_TXQA1_CURBYTES 0x06B0
-#define SK_TXQA1_BMU_CSR 0x06B4
-#define SK_TXQA1_WATERMARK 0x06B8
-#define SK_TXQA1_FLAG 0x06BA
-#define SK_TXQA1_TEST1 0x06BC
-#define SK_TXQA1_TEST2 0x06C0
-#define SK_TXQA1_TEST3 0x06C4
-
-/* Block 14 -- TX sync queue 2 */
-#define SK_TXQS2_BUFCNT 0x0700
-#define SK_TXQS2_BUFCTL 0x0702
-#define SK_TXQS2_NEXTDESC 0x0704
-#define SK_TXQS2_RXBUF_LO 0x0708
-#define SK_TXQS2_RXBUF_HI 0x070C
-#define SK_TXQS2_RXSTAT 0x0710
-#define SK_TXQS2_CSUM_STARTVAL 0x0714
-#define SK_TXQS2_CSUM_STARTPOS 0x0718
-#define SK_TXQS2_CSUM_WRITEPOS 0x071A
-#define SK_TXQS2_CURADDR_LO 0x0720
-#define SK_TXQS2_CURADDR_HI 0x0724
-#define SK_TXQS2_CURCNT_LO 0x0728
-#define SK_TXQS2_CURCNT_HI 0x072C
-#define SK_TXQS2_CURBYTES 0x0730
-#define SK_TXQS2_BMU_CSR 0x0734
-#define SK_TXQS2_WATERMARK 0x0738
-#define SK_TXQS2_FLAG 0x073A
-#define SK_TXQS2_TEST1 0x073C
-#define SK_TXQS2_TEST2 0x0740
-#define SK_TXQS2_TEST3 0x0744
-
-/* Block 15 -- TX async queue 2 */
-#define SK_TXQA2_BUFCNT 0x0780
-#define SK_TXQA2_BUFCTL 0x0782
-#define SK_TXQA2_NEXTDESC 0x0784
-#define SK_TXQA2_RXBUF_LO 0x0788
-#define SK_TXQA2_RXBUF_HI 0x078C
-#define SK_TXQA2_RXSTAT 0x0790
-#define SK_TXQA2_CSUM_STARTVAL 0x0794
-#define SK_TXQA2_CSUM_STARTPOS 0x0798
-#define SK_TXQA2_CSUM_WRITEPOS 0x079A
-#define SK_TXQA2_CURADDR_LO 0x07A0
-#define SK_TXQA2_CURADDR_HI 0x07A4
-#define SK_TXQA2_CURCNT_LO 0x07A8
-#define SK_TXQA2_CURCNT_HI 0x07AC
-#define SK_TXQA2_CURBYTES 0x07B0
-#define SK_TXQA2_BMU_CSR 0x07B4
-#define SK_TXQA2_WATERMARK 0x07B8
-#define SK_TXQA2_FLAG 0x07BA
-#define SK_TXQA2_TEST1 0x07BC
-#define SK_TXQA2_TEST2 0x07C0
-#define SK_TXQA2_TEST3 0x07C4
-
-#define SK_TXBMU_CLR_IRQ_ERR 0x00000001
-#define SK_TXBMU_CLR_IRQ_EOF 0x00000002
-#define SK_TXBMU_CLR_IRQ_EOB 0x00000004
-#define SK_TXBMU_TX_START 0x00000010
-#define SK_TXBMU_TX_STOP 0x00000020
-#define SK_TXBMU_POLL_OFF 0x00000040
-#define SK_TXBMU_POLL_ON 0x00000080
-#define SK_TXBMU_TRANSFER_SM_RESET 0x00000100
-#define SK_TXBMU_TRANSFER_SM_UNRESET 0x00000200
-#define SK_TXBMU_DESCWR_SM_RESET 0x00000400
-#define SK_TXBMU_DESCWR_SM_UNRESET 0x00000800
-#define SK_TXBMU_DESCRD_SM_RESET 0x00001000
-#define SK_TXBMU_DESCRD_SM_UNRESET 0x00002000
-#define SK_TXBMU_SUPERVISOR_SM_RESET 0x00004000
-#define SK_TXBMU_SUPERVISOR_SM_UNRESET 0x00008000
-#define SK_TXBMU_PFI_SM_RESET 0x00010000
-#define SK_TXBMU_PFI_SM_UNRESET 0x00020000
-#define SK_TXBMU_FIFO_RESET 0x00040000
-#define SK_TXBMU_FIFO_UNRESET 0x00080000
-#define SK_TXBMU_DESC_RESET 0x00100000
-#define SK_TXBMU_DESC_UNRESET 0x00200000
-#define SK_TXBMU_SUPERVISOR_IDLE 0x01000000
-
-#define SK_TXBMU_ONLINE \
- (SK_TXBMU_TRANSFER_SM_UNRESET|SK_TXBMU_DESCWR_SM_UNRESET| \
- SK_TXBMU_DESCRD_SM_UNRESET|SK_TXBMU_SUPERVISOR_SM_UNRESET| \
- SK_TXBMU_PFI_SM_UNRESET|SK_TXBMU_FIFO_UNRESET| \
- SK_TXBMU_DESC_UNRESET)
-
-#define SK_TXBMU_OFFLINE \
- (SK_TXBMU_TRANSFER_SM_RESET|SK_TXBMU_DESCWR_SM_RESET| \
- SK_TXBMU_DESCRD_SM_RESET|SK_TXBMU_SUPERVISOR_SM_RESET| \
- SK_TXBMU_PFI_SM_RESET|SK_TXBMU_FIFO_RESET| \
- SK_TXBMU_DESC_RESET)
-
-/* Block 16 -- Receive RAMbuffer 1 */
-#define SK_RXRB1_START 0x0800
-#define SK_RXRB1_END 0x0804
-#define SK_RXRB1_WR_PTR 0x0808
-#define SK_RXRB1_RD_PTR 0x080C
-#define SK_RXRB1_UTHR_PAUSE 0x0810
-#define SK_RXRB1_LTHR_PAUSE 0x0814
-#define SK_RXRB1_UTHR_HIPRIO 0x0818
-#define SK_RXRB1_UTHR_LOPRIO 0x081C
-#define SK_RXRB1_PKTCNT 0x0820
-#define SK_RXRB1_LVL 0x0824
-#define SK_RXRB1_CTLTST 0x0828
-
-/* Block 17 -- Receive RAMbuffer 2 */
-#define SK_RXRB2_START 0x0880
-#define SK_RXRB2_END 0x0884
-#define SK_RXRB2_WR_PTR 0x0888
-#define SK_RXRB2_RD_PTR 0x088C
-#define SK_RXRB2_UTHR_PAUSE 0x0890
-#define SK_RXRB2_LTHR_PAUSE 0x0894
-#define SK_RXRB2_UTHR_HIPRIO 0x0898
-#define SK_RXRB2_UTHR_LOPRIO 0x089C
-#define SK_RXRB2_PKTCNT 0x08A0
-#define SK_RXRB2_LVL 0x08A4
-#define SK_RXRB2_CTLTST 0x08A8
-
-/* Block 20 -- Sync. Transmit RAMbuffer 1 */
-#define SK_TXRBS1_START 0x0A00
-#define SK_TXRBS1_END 0x0A04
-#define SK_TXRBS1_WR_PTR 0x0A08
-#define SK_TXRBS1_RD_PTR 0x0A0C
-#define SK_TXRBS1_PKTCNT 0x0A20
-#define SK_TXRBS1_LVL 0x0A24
-#define SK_TXRBS1_CTLTST 0x0A28
-
-/* Block 21 -- Async. Transmit RAMbuffer 1 */
-#define SK_TXRBA1_START 0x0A80
-#define SK_TXRBA1_END 0x0A84
-#define SK_TXRBA1_WR_PTR 0x0A88
-#define SK_TXRBA1_RD_PTR 0x0A8C
-#define SK_TXRBA1_PKTCNT 0x0AA0
-#define SK_TXRBA1_LVL 0x0AA4
-#define SK_TXRBA1_CTLTST 0x0AA8
-
-/* Block 22 -- Sync. Transmit RAMbuffer 2 */
-#define SK_TXRBS2_START 0x0B00
-#define SK_TXRBS2_END 0x0B04
-#define SK_TXRBS2_WR_PTR 0x0B08
-#define SK_TXRBS2_RD_PTR 0x0B0C
-#define SK_TXRBS2_PKTCNT 0x0B20
-#define SK_TXRBS2_LVL 0x0B24
-#define SK_TXRBS2_CTLTST 0x0B28
-
-/* Block 23 -- Async. Transmit RAMbuffer 2 */
-#define SK_TXRBA2_START 0x0B80
-#define SK_TXRBA2_END 0x0B84
-#define SK_TXRBA2_WR_PTR 0x0B88
-#define SK_TXRBA2_RD_PTR 0x0B8C
-#define SK_TXRBA2_PKTCNT 0x0BA0
-#define SK_TXRBA2_LVL 0x0BA4
-#define SK_TXRBA2_CTLTST 0x0BA8
-
-#define SK_RBCTL_RESET 0x00000001
-#define SK_RBCTL_UNRESET 0x00000002
-#define SK_RBCTL_OFF 0x00000004
-#define SK_RBCTL_ON 0x00000008
-#define SK_RBCTL_STORENFWD_OFF 0x00000010
-#define SK_RBCTL_STORENFWD_ON 0x00000020
-
-/* Block 24 -- RX MAC FIFO 1 regisrers and LINK_SYNC counter */
-#define SK_RXF1_END 0x0C00
-#define SK_RXF1_WPTR 0x0C04
-#define SK_RXF1_RPTR 0x0C0C
-#define SK_RXF1_PKTCNT 0x0C10
-#define SK_RXF1_LVL 0x0C14
-#define SK_RXF1_MACCTL 0x0C18
-#define SK_RXF1_CTL 0x0C1C
-#define SK_RXLED1_CNTINIT 0x0C20
-#define SK_RXLED1_COUNTER 0x0C24
-#define SK_RXLED1_CTL 0x0C28
-#define SK_RXLED1_TST 0x0C29
-#define SK_LINK_SYNC1_CINIT 0x0C30
-#define SK_LINK_SYNC1_COUNTER 0x0C34
-#define SK_LINK_SYNC1_CTL 0x0C38
-#define SK_LINK_SYNC1_TST 0x0C39
-#define SK_LINKLED1_CTL 0x0C3C
-
-#define SK_FIFO_END 0x3F
-
-/* Receive MAC FIFO 1 (Yukon Only) */
-#define SK_RXMF1_END 0x0C40
-#define SK_RXMF1_THRESHOLD 0x0C44
-#define SK_RXMF1_CTRL_TEST 0x0C48
-#define SK_RXMF1_WRITE_PTR 0x0C60
-#define SK_RXMF1_WRITE_LEVEL 0x0C68
-#define SK_RXMF1_READ_PTR 0x0C70
-#define SK_RXMF1_READ_LEVEL 0x0C78
-
-#define SK_RFCTL_WR_PTR_TST_ON 0x00004000 /* Write pointer test on*/
-#define SK_RFCTL_WR_PTR_TST_OFF 0x00002000 /* Write pointer test off */
-#define SK_RFCTL_WR_PTR_STEP 0x00001000 /* Write pointer increment */
-#define SK_RFCTL_RD_PTR_TST_ON 0x00000400 /* Read pointer test on */
-#define SK_RFCTL_RD_PTR_TST_OFF 0x00000200 /* Read pointer test off */
-#define SK_RFCTL_RD_PTR_STEP 0x00000100 /* Read pointer increment */
-#define SK_RFCTL_RX_FIFO_OVER 0x00000040 /* Clear IRQ RX FIFO Overrun */
-#define SK_RFCTL_FRAME_RX_DONE 0x00000010 /* Clear IRQ Frame RX Done */
-#define SK_RFCTL_OPERATION_ON 0x00000008 /* Operational mode on */
-#define SK_RFCTL_OPERATION_OFF 0x00000004 /* Operational mode off */
-#define SK_RFCTL_RESET_CLEAR 0x00000002 /* MAC FIFO Reset Clear */
-#define SK_RFCTL_RESET_SET 0x00000001 /* MAC FIFO Reset Set */
-
-/* Block 25 -- RX MAC FIFO 2 regisrers and LINK_SYNC counter */
-#define SK_RXF2_END 0x0C80
-#define SK_RXF2_WPTR 0x0C84
-#define SK_RXF2_RPTR 0x0C8C
-#define SK_RXF2_PKTCNT 0x0C90
-#define SK_RXF2_LVL 0x0C94
-#define SK_RXF2_MACCTL 0x0C98
-#define SK_RXF2_CTL 0x0C9C
-#define SK_RXLED2_CNTINIT 0x0CA0
-#define SK_RXLED2_COUNTER 0x0CA4
-#define SK_RXLED2_CTL 0x0CA8
-#define SK_RXLED2_TST 0x0CA9
-#define SK_LINK_SYNC2_CINIT 0x0CB0
-#define SK_LINK_SYNC2_COUNTER 0x0CB4
-#define SK_LINK_SYNC2_CTL 0x0CB8
-#define SK_LINK_SYNC2_TST 0x0CB9
-#define SK_LINKLED2_CTL 0x0CBC
-
-#define SK_RXMACCTL_CLR_IRQ_NOSTS 0x00000001
-#define SK_RXMACCTL_CLR_IRQ_NOTSTAMP 0x00000002
-#define SK_RXMACCTL_TSTAMP_OFF 0x00000004
-#define SK_RXMACCTL_RSTAMP_ON 0x00000008
-#define SK_RXMACCTL_FLUSH_OFF 0x00000010
-#define SK_RXMACCTL_FLUSH_ON 0x00000020
-#define SK_RXMACCTL_PAUSE_OFF 0x00000040
-#define SK_RXMACCTL_PAUSE_ON 0x00000080
-#define SK_RXMACCTL_AFULL_OFF 0x00000100
-#define SK_RXMACCTL_AFULL_ON 0x00000200
-#define SK_RXMACCTL_VALIDTIME_PATCH_OFF 0x00000400
-#define SK_RXMACCTL_VALIDTIME_PATCH_ON 0x00000800
-#define SK_RXMACCTL_RXRDY_PATCH_OFF 0x00001000
-#define SK_RXMACCTL_RXRDY_PATCH_ON 0x00002000
-#define SK_RXMACCTL_STS_TIMEO 0x00FF0000
-#define SK_RXMACCTL_TSTAMP_TIMEO 0xFF000000
-
-#define SK_RXLEDCTL_ENABLE 0x0001
-#define SK_RXLEDCTL_COUNTER_STOP 0x0002
-#define SK_RXLEDCTL_COUNTER_START 0x0004
-
-#define SK_LINKLED_OFF 0x0001
-#define SK_LINKLED_ON 0x0002
-#define SK_LINKLED_LINKSYNC_OFF 0x0004
-#define SK_LINKLED_LINKSYNC_ON 0x0008
-#define SK_LINKLED_BLINK_OFF 0x0010
-#define SK_LINKLED_BLINK_ON 0x0020
-
-/* Block 26 -- TX MAC FIFO 1 regisrers */
-#define SK_TXF1_END 0x0D00
-#define SK_TXF1_WPTR 0x0D04
-#define SK_TXF1_RPTR 0x0D0C
-#define SK_TXF1_PKTCNT 0x0D10
-#define SK_TXF1_LVL 0x0D14
-#define SK_TXF1_MACCTL 0x0D18
-#define SK_TXF1_CTL 0x0D1C
-#define SK_TXLED1_CNTINIT 0x0D20
-#define SK_TXLED1_COUNTER 0x0D24
-#define SK_TXLED1_CTL 0x0D28
-#define SK_TXLED1_TST 0x0D29
-
-/* Receive MAC FIFO 1 (Yukon Only) */
-#define SK_TXMF1_END 0x0D40
-#define SK_TXMF1_THRESHOLD 0x0D44
-#define SK_TXMF1_CTRL_TEST 0x0D48
-#define SK_TXMF1_WRITE_PTR 0x0D60
-#define SK_TXMF1_WRITE_SHADOW 0x0D64
-#define SK_TXMF1_WRITE_LEVEL 0x0D68
-#define SK_TXMF1_READ_PTR 0x0D70
-#define SK_TXMF1_RESTART_PTR 0x0D74
-#define SK_TXMF1_READ_LEVEL 0x0D78
-
-#define SK_TFCTL_WR_PTR_TST_ON 0x00004000 /* Write pointer test on*/
-#define SK_TFCTL_WR_PTR_TST_OFF 0x00002000 /* Write pointer test off */
-#define SK_TFCTL_WR_PTR_STEP 0x00001000 /* Write pointer increment */
-#define SK_TFCTL_RD_PTR_TST_ON 0x00000400 /* Read pointer test on */
-#define SK_TFCTL_RD_PTR_TST_OFF 0x00000200 /* Read pointer test off */
-#define SK_TFCTL_RD_PTR_STEP 0x00000100 /* Read pointer increment */
-#define SK_TFCTL_TX_FIFO_UNDER 0x00000040 /* Clear IRQ TX FIFO Under */
-#define SK_TFCTL_FRAME_TX_DONE 0x00000020 /* Clear IRQ Frame TX Done */
-#define SK_TFCTL_IRQ_PARITY_ER 0x00000010 /* Clear IRQ Parity Error */
-#define SK_TFCTL_OPERATION_ON 0x00000008 /* Operational mode on */
-#define SK_TFCTL_OPERATION_OFF 0x00000004 /* Operational mode off */
-#define SK_TFCTL_RESET_CLEAR 0x00000002 /* MAC FIFO Reset Clear */
-#define SK_TFCTL_RESET_SET 0x00000001 /* MAC FIFO Reset Set */
-
-/* Block 27 -- TX MAC FIFO 2 regisrers */
-#define SK_TXF2_END 0x0D80
-#define SK_TXF2_WPTR 0x0D84
-#define SK_TXF2_RPTR 0x0D8C
-#define SK_TXF2_PKTCNT 0x0D90
-#define SK_TXF2_LVL 0x0D94
-#define SK_TXF2_MACCTL 0x0D98
-#define SK_TXF2_CTL 0x0D9C
-#define SK_TXLED2_CNTINIT 0x0DA0
-#define SK_TXLED2_COUNTER 0x0DA4
-#define SK_TXLED2_CTL 0x0DA8
-#define SK_TXLED2_TST 0x0DA9
-
-#define SK_TXMACCTL_XMAC_RESET 0x00000001
-#define SK_TXMACCTL_XMAC_UNRESET 0x00000002
-#define SK_TXMACCTL_LOOP_OFF 0x00000004
-#define SK_TXMACCTL_LOOP_ON 0x00000008
-#define SK_TXMACCTL_FLUSH_OFF 0x00000010
-#define SK_TXMACCTL_FLUSH_ON 0x00000020
-#define SK_TXMACCTL_WAITEMPTY_OFF 0x00000040
-#define SK_TXMACCTL_WAITEMPTY_ON 0x00000080
-#define SK_TXMACCTL_AFULL_OFF 0x00000100
-#define SK_TXMACCTL_AFULL_ON 0x00000200
-#define SK_TXMACCTL_TXRDY_PATCH_OFF 0x00000400
-#define SK_TXMACCTL_RXRDY_PATCH_ON 0x00000800
-#define SK_TXMACCTL_PKT_RECOVERY_OFF 0x00001000
-#define SK_TXMACCTL_PKT_RECOVERY_ON 0x00002000
-#define SK_TXMACCTL_CLR_IRQ_PERR 0x00008000
-#define SK_TXMACCTL_WAITAFTERFLUSH 0x00010000
-
-#define SK_TXLEDCTL_ENABLE 0x0001
-#define SK_TXLEDCTL_COUNTER_STOP 0x0002
-#define SK_TXLEDCTL_COUNTER_START 0x0004
-
-#define SK_FIFO_RESET 0x00000001
-#define SK_FIFO_UNRESET 0x00000002
-#define SK_FIFO_OFF 0x00000004
-#define SK_FIFO_ON 0x00000008
-
-/* Block 28 -- Descriptor Poll Timer */
-#define SK_DPT_INIT 0x0e00 /* Initial value 24 bits */
-#define SK_DPT_TIMER 0x0e04 /* Mul of 78.12MHz clk (24b) */
-
-#define SK_DPT_TIMER_CTRL 0x0e08 /* Timer Control 16 bits */
-#define SK_DPT_TCTL_STOP 0x0001 /* Stop Timer */
-#define SK_DPT_TCTL_START 0x0002 /* Start Timer */
-
-#define SK_DPT_TIMER_TEST 0x0e0a /* Timer Test 16 bits */
-#define SK_DPT_TTEST_STEP 0x0001 /* Timer Decrement */
-#define SK_DPT_TTEST_OFF 0x0002 /* Test Mode Off */
-#define SK_DPT_TTEST_ON 0x0004 /* Test Mode On */
-
-/* Block 29 -- reserved */
-
-/* Block 30 -- GMAC/GPHY Control Registers (Yukon Only)*/
-#define SK_GMAC_CTRL 0x0f00 /* GMAC Control Register */
-#define SK_GPHY_CTRL 0x0f04 /* GPHY Control Register */
-#define SK_GMAC_ISR 0x0f08 /* GMAC Interrupt Source Register */
-#define SK_GMAC_IMR 0x0f08 /* GMAC Interrupt Mask Register */
-#define SK_LINK_CTRL 0x0f10 /* Link Control Register (LCR) */
-#define SK_WOL_CTRL 0x0f20 /* Wake on LAN Control Register */
-#define SK_MAC_ADDR_LOW 0x0f24 /* Mack Address Registers LOW */
-#define SK_MAC_ADDR_HIGH 0x0f28 /* Mack Address Registers HIGH */
-#define SK_PAT_READ_PTR 0x0f2c /* Pattern Read Pointer Register */
-#define SK_PAT_LEN_REG0 0x0f30 /* Pattern Length Register 0 */
-#define SK_PAT_LEN0 0x0f30 /* Pattern Length 0 */
-#define SK_PAT_LEN1 0x0f31 /* Pattern Length 1 */
-#define SK_PAT_LEN2 0x0f32 /* Pattern Length 2 */
-#define SK_PAT_LEN3 0x0f33 /* Pattern Length 3 */
-#define SK_PAT_LEN_REG1 0x0f34 /* Pattern Length Register 1 */
-#define SK_PAT_LEN4 0x0f34 /* Pattern Length 4 */
-#define SK_PAT_LEN5 0x0f35 /* Pattern Length 5 */
-#define SK_PAT_LEN6 0x0f36 /* Pattern Length 6 */
-#define SK_PAT_LEN7 0x0f37 /* Pattern Length 7 */
-#define SK_PAT_CTR_REG0 0x0f38 /* Pattern Counter Register 0 */
-#define SK_PAT_CTR0 0x0f38 /* Pattern Counter 0 */
-#define SK_PAT_CTR1 0x0f39 /* Pattern Counter 1 */
-#define SK_PAT_CTR2 0x0f3a /* Pattern Counter 2 */
-#define SK_PAT_CTR3 0x0f3b /* Pattern Counter 3 */
-#define SK_PAT_CTR_REG1 0x0f3c /* Pattern Counter Register 1 */
-#define SK_PAT_CTR4 0x0f3c /* Pattern Counter 4 */
-#define SK_PAT_CTR5 0x0f3d /* Pattern Counter 5 */
-#define SK_PAT_CTR6 0x0f3e /* Pattern Counter 6 */
-#define SK_PAT_CTR7 0x0f3f /* Pattern Counter 7 */
-
-#define SK_GMAC_LOOP_ON 0x00000020 /* Loopback mode for testing */
-#define SK_GMAC_LOOP_OFF 0x00000010 /* purposes */
-#define SK_GMAC_PAUSE_ON 0x00000008 /* enable forward of pause */
-#define SK_GMAC_PAUSE_OFF 0x00000004 /* signal to GMAC */
-#define SK_GMAC_RESET_CLEAR 0x00000002 /* Clear GMAC Reset */
-#define SK_GMAC_RESET_SET 0x00000001 /* Set GMAC Reset */
-
-#define SK_GPHY_SEL_BDT 0x10000000 /* Select Bidirectional xfer */
-#define SK_GPHY_INT_POL_HI 0x08000000 /* IRQ Polarity Active */
-#define SK_GPHY_75_OHM 0x04000000 /* Use 75 Ohm Termination */
-#define SK_GPHY_DIS_FC 0x02000000 /* Disable Auto Fiber/Copper */
-#define SK_GPHY_DIS_SLEEP 0x01000000 /* Disable Energy Detect */
-#define SK_GPHY_HWCFG_M_3 0x00800000 /* HWCFG_MODE[3] */
-#define SK_GPHY_HWCFG_M_2 0x00400000 /* HWCFG_MODE[2] */
-#define SK_GPHY_HWCFG_M_1 0x00200000 /* HWCFG_MODE[1] */
-#define SK_GPHY_HWCFG_M_0 0x00100000 /* HWCFG_MODE[0] */
-#define SK_GPHY_ANEG_0 0x00080000 /* ANEG[0] */
-#define SK_GPHY_ENA_XC 0x00040000 /* Enable MDI Crossover */
-#define SK_GPHY_DIS_125 0x00020000 /* Disable 125MHz Clock */
-#define SK_GPHY_ANEG_3 0x00010000 /* ANEG[3] */
-#define SK_GPHY_ANEG_2 0x00008000 /* ANEG[2] */
-#define SK_GPHY_ANEG_1 0x00004000 /* ANEG[1] */
-#define SK_GPHY_ENA_PAUSE 0x00002000 /* Enable Pause */
-#define SK_GPHY_PHYADDR_4 0x00001000 /* Bit 4 of Phy Addr */
-#define SK_GPHY_PHYADDR_3 0x00000800 /* Bit 3 of Phy Addr */
-#define SK_GPHY_PHYADDR_2 0x00000400 /* Bit 2 of Phy Addr */
-#define SK_GPHY_PHYADDR_1 0x00000200 /* Bit 1 of Phy Addr */
-#define SK_GPHY_PHYADDR_0 0x00000100 /* Bit 0 of Phy Addr */
-#define SK_GPHY_RESET_CLEAR 0x00000002 /* Clear GPHY Reset */
-#define SK_GPHY_RESET_SET 0x00000001 /* Set GPHY Reset */
-
-#define SK_GPHY_COPPER (SK_GPHY_HWCFG_M_0 | SK_GPHY_HWCFG_M_1 | \
- SK_GPHY_HWCFG_M_2 | SK_GPHY_HWCFG_M_3 )
-#define SK_GPHY_FIBER (SK_GPHY_HWCFG_M_0 | SK_GPHY_HWCFG_M_1 | \
- SK_GPHY_HWCFG_M_2 )
-#define SK_GPHY_ANEG_ALL (SK_GPHY_ANEG_0 | SK_GPHY_ANEG_1 | \
- SK_GPHY_ANEG_2 | SK_GPHY_ANEG_3 )
-
-#define SK_GMAC_INT_TX_OFLOW 0x20 /* Transmit Counter Overflow */
-#define SK_GMAC_INT_RX_OFLOW 0x10 /* Receiver Overflow */
-#define SK_GMAC_INT_TX_UNDER 0x08 /* Transmit FIFO Underrun */
-#define SK_GMAC_INT_TX_DONE 0x04 /* Transmit Complete */
-#define SK_GMAC_INT_RX_OVER 0x02 /* Receive FIFO Overrun */
-#define SK_GMAC_INT_RX_DONE 0x01 /* Receive Complete */
-
-#define SK_LINK_RESET_CLEAR 0x0002 /* Link Reset Clear */
-#define SK_LINK_RESET_SET 0x0001 /* Link Reset Set */
-
-/* Block 31 -- reserved */
-
-/* Block 32-33 -- Pattern Ram */
-#define SK_WOL_PRAM 0x1000
-
-/* Block 0x22 - 0x3f -- reserved */
-
-/* Block 0x40 to 0x4F -- XMAC 1 registers */
-#define SK_XMAC1_BASE 0x2000
-
-/* Block 0x50 to 0x5F -- MARV 1 registers */
-#define SK_MARV1_BASE 0x2800
-
-/* Block 0x60 to 0x6F -- XMAC 2 registers */
-#define SK_XMAC2_BASE 0x3000
-
-/* Block 0x70 to 0x7F -- MARV 2 registers */
-#define SK_MARV2_BASE 0x3800
-
-/* Compute relative offset of an XMAC register in the XMAC window(s). */
-#define SK_XMAC_REG(sc, reg) (((reg) * 2) + SK_XMAC1_BASE + \
- (((sc)->sk_port) * (SK_XMAC2_BASE - SK_XMAC1_BASE)))
-
-#if 0
-#define SK_XM_READ_4(sc, reg) \
- ((sk_win_read_2(sc->sk_softc, \
- SK_XMAC_REG(sc, reg)) & 0xFFFF) | \
- ((sk_win_read_2(sc->sk_softc, \
- SK_XMAC_REG(sc, reg + 2)) & 0xFFFF) << 16))
-
-#define SK_XM_WRITE_4(sc, reg, val) \
- sk_win_write_2(sc->sk_softc, SK_XMAC_REG(sc, reg), \
- ((val) & 0xFFFF)); \
- sk_win_write_2(sc->sk_softc, SK_XMAC_REG(sc, reg + 2), \
- ((val) >> 16) & 0xFFFF)
-#else
-#define SK_XM_READ_4(sc, reg) \
- sk_win_read_4(sc->sk_softc, SK_XMAC_REG(sc, reg))
-
-#define SK_XM_WRITE_4(sc, reg, val) \
- sk_win_write_4(sc->sk_softc, SK_XMAC_REG(sc, reg), (val))
-#endif
-
-#define SK_XM_READ_2(sc, reg) \
- sk_win_read_2(sc->sk_softc, SK_XMAC_REG(sc, reg))
-
-#define SK_XM_WRITE_2(sc, reg, val) \
- sk_win_write_2(sc->sk_softc, SK_XMAC_REG(sc, reg), val)
-
-#define SK_XM_SETBIT_4(sc, reg, x) \
- SK_XM_WRITE_4(sc, reg, (SK_XM_READ_4(sc, reg)) | (x))
-
-#define SK_XM_CLRBIT_4(sc, reg, x) \
- SK_XM_WRITE_4(sc, reg, (SK_XM_READ_4(sc, reg)) & ~(x))
-
-#define SK_XM_SETBIT_2(sc, reg, x) \
- SK_XM_WRITE_2(sc, reg, (SK_XM_READ_2(sc, reg)) | (x))
-
-#define SK_XM_CLRBIT_2(sc, reg, x) \
- SK_XM_WRITE_2(sc, reg, (SK_XM_READ_2(sc, reg)) & ~(x))
-
-/* Compute relative offset of an MARV register in the MARV window(s). */
-#define SK_YU_REG(sc, reg) \
- ((reg) + SK_MARV1_BASE + \
- (((sc)->sk_port) * (SK_MARV2_BASE - SK_MARV1_BASE)))
-
-#define SK_YU_READ_4(sc, reg) \
- sk_win_read_4((sc)->sk_softc, SK_YU_REG((sc), (reg)))
-
-#define SK_YU_READ_2(sc, reg) \
- sk_win_read_2((sc)->sk_softc, SK_YU_REG((sc), (reg)))
-
-#define SK_YU_WRITE_4(sc, reg, val) \
- sk_win_write_4((sc)->sk_softc, SK_YU_REG((sc), (reg)), (val))
-
-#define SK_YU_WRITE_2(sc, reg, val) \
- sk_win_write_2((sc)->sk_softc, SK_YU_REG((sc), (reg)), (val))
-
-#define SK_YU_SETBIT_4(sc, reg, x) \
- SK_YU_WRITE_4(sc, reg, (SK_YU_READ_4(sc, reg)) | (x))
-
-#define SK_YU_CLRBIT_4(sc, reg, x) \
- SK_YU_WRITE_4(sc, reg, (SK_YU_READ_4(sc, reg)) & ~(x))
-
-#define SK_YU_SETBIT_2(sc, reg, x) \
- SK_YU_WRITE_2(sc, reg, (SK_YU_READ_2(sc, reg)) | (x))
-
-#define SK_YU_CLRBIT_2(sc, reg, x) \
- SK_YU_WRITE_2(sc, reg, (SK_YU_READ_2(sc, reg)) & ~(x))
-
-/*
- * The default FIFO threshold on the XMAC II is 4 bytes. On
- * dual port NICs, this often leads to transmit underruns, so we
- * bump the threshold a little.
- */
-#define SK_XM_TX_FIFOTHRESH 512
-
-#define SK_PCI_VENDOR_ID 0x0000
-#define SK_PCI_DEVICE_ID 0x0002
-#define SK_PCI_COMMAND 0x0004
-#define SK_PCI_STATUS 0x0006
-#define SK_PCI_REVID 0x0008
-#define SK_PCI_CLASSCODE 0x0009
-#define SK_PCI_CACHELEN 0x000C
-#define SK_PCI_LATENCY_TIMER 0x000D
-#define SK_PCI_HEADER_TYPE 0x000E
-#define SK_PCI_LOMEM 0x0010
-#define SK_PCI_LOIO 0x0014
-#define SK_PCI_SUBVEN_ID 0x002C
-#define SK_PCI_SYBSYS_ID 0x002E
-#define SK_PCI_BIOSROM 0x0030
-#define SK_PCI_INTLINE 0x003C
-#define SK_PCI_INTPIN 0x003D
-#define SK_PCI_MINGNT 0x003E
-#define SK_PCI_MINLAT 0x003F
-
-/* device specific PCI registers */
-#define SK_PCI_OURREG1 0x0040
-#define SK_PCI_OURREG2 0x0044
-#define SK_PCI_CAPID 0x0048 /* 8 bits */
-#define SK_PCI_NEXTPTR 0x0049 /* 8 bits */
-#define SK_PCI_PWRMGMTCAP 0x004A /* 16 bits */
-#define SK_PCI_PWRMGMTCTRL 0x004C /* 16 bits */
-#define SK_PCI_PME_EVENT 0x004F
-#define SK_PCI_VPD_CAPID 0x0050
-#define SK_PCI_VPD_NEXTPTR 0x0051
-#define SK_PCI_VPD_ADDR 0x0052
-#define SK_PCI_VPD_DATA 0x0054
-
-#define SK_PSTATE_MASK 0x0003
-#define SK_PSTATE_D0 0x0000
-#define SK_PSTATE_D1 0x0001
-#define SK_PSTATE_D2 0x0002
-#define SK_PSTATE_D3 0x0003
-#define SK_PME_EN 0x0010
-#define SK_PME_STATUS 0x8000
-
-/*
- * VPD flag bit. Set to 0 to initiate a read, will become 1 when
- * read is complete. Set to 1 to initiate a write, will become 0
- * when write is finished.
- */
-#define SK_VPD_FLAG 0x8000
-
-/* VPD structures */
-struct vpd_res {
- u_int8_t vr_id;
- u_int8_t vr_len;
- u_int8_t vr_pad;
-};
-
-struct vpd_key {
- char vk_key[2];
- u_int8_t vk_len;
-};
-
-#define VPD_RES_ID 0x82 /* ID string */
-#define VPD_RES_READ 0x90 /* start of read only area */
-#define VPD_RES_WRITE 0x81 /* start of read/write area */
-#define VPD_RES_END 0x78 /* end tag */
-
-#define CSR_WRITE_4(sc, reg, val) \
- bus_space_write_4((sc)->sk_btag, (sc)->sk_bhandle, (reg), (val))
-#define CSR_WRITE_2(sc, reg, val) \
- bus_space_write_2((sc)->sk_btag, (sc)->sk_bhandle, (reg), (val))
-#define CSR_WRITE_1(sc, reg, val) \
- bus_space_write_1((sc)->sk_btag, (sc)->sk_bhandle, (reg), (val))
-
-#define CSR_READ_4(sc, reg) \
- bus_space_read_4((sc)->sk_btag, (sc)->sk_bhandle, (reg))
-#define CSR_READ_2(sc, reg) \
- bus_space_read_2((sc)->sk_btag, (sc)->sk_bhandle, (reg))
-#define CSR_READ_1(sc, reg) \
- bus_space_read_1((sc)->sk_btag, (sc)->sk_bhandle, (reg))
-
-struct sk_type {
- u_int16_t sk_vid;
- u_int16_t sk_did;
- char *sk_name;
-};
-
-/* RX queue descriptor data structure */
-struct sk_rx_desc {
- u_int32_t sk_ctl;
- u_int32_t sk_next;
- u_int32_t sk_data_lo;
- u_int32_t sk_data_hi;
- u_int32_t sk_xmac_rxstat;
- u_int32_t sk_timestamp;
- u_int16_t sk_csum2;
- u_int16_t sk_csum1;
- u_int16_t sk_csum2_start;
- u_int16_t sk_csum1_start;
-};
-
-#define SK_OPCODE_DEFAULT 0x00550000
-#define SK_OPCODE_CSUM 0x00560000
-
-#define SK_RXCTL_LEN 0x0000FFFF
-#define SK_RXCTL_OPCODE 0x00FF0000
-#define SK_RXCTL_TSTAMP_VALID 0x01000000
-#define SK_RXCTL_STATUS_VALID 0x02000000
-#define SK_RXCTL_DEV0 0x04000000
-#define SK_RXCTL_EOF_INTR 0x08000000
-#define SK_RXCTL_EOB_INTR 0x10000000
-#define SK_RXCTL_LASTFRAG 0x20000000
-#define SK_RXCTL_FIRSTFRAG 0x40000000
-#define SK_RXCTL_OWN 0x80000000
-
-#define SK_RXSTAT \
- (SK_OPCODE_DEFAULT|SK_RXCTL_EOF_INTR|SK_RXCTL_LASTFRAG| \
- SK_RXCTL_FIRSTFRAG|SK_RXCTL_OWN)
-
-struct sk_tx_desc {
- u_int32_t sk_ctl;
- u_int32_t sk_next;
- u_int32_t sk_data_lo;
- u_int32_t sk_data_hi;
- u_int32_t sk_xmac_txstat;
- u_int16_t sk_rsvd0;
- u_int16_t sk_csum_startval;
- u_int16_t sk_csum_startpos;
- u_int16_t sk_csum_writepos;
- u_int32_t sk_rsvd1;
-};
-
-#define SK_TXCTL_LEN 0x0000FFFF
-#define SK_TXCTL_OPCODE 0x00FF0000
-#define SK_TXCTL_SW 0x01000000
-#define SK_TXCTL_NOCRC 0x02000000
-#define SK_TXCTL_STORENFWD 0x04000000
-#define SK_TXCTL_EOF_INTR 0x08000000
-#define SK_TXCTL_EOB_INTR 0x10000000
-#define SK_TXCTL_LASTFRAG 0x20000000
-#define SK_TXCTL_FIRSTFRAG 0x40000000
-#define SK_TXCTL_OWN 0x80000000
-
-#define SK_TXSTAT \
- (SK_OPCODE_DEFAULT|SK_TXCTL_EOF_INTR|SK_TXCTL_LASTFRAG|SK_TXCTL_OWN)
-
-#define SK_RXBYTES(x) (x) & 0x0000FFFF;
-#define SK_TXBYTES SK_RXBYTES
-
-#define SK_TX_RING_CNT 512
-#define SK_RX_RING_CNT 256
-
-/*
- * Jumbo buffer stuff. Note that we must allocate more jumbo
- * buffers than there are descriptors in the receive ring. This
- * is because we don't know how long it will take for a packet
- * to be released after we hand it off to the upper protocol
- * layers. To be safe, we allocate 1.5 times the number of
- * receive descriptors.
- */
-#define SK_JUMBO_FRAMELEN 9018
-#define SK_JUMBO_MTU (SK_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
-#define SK_JSLOTS ((SK_RX_RING_CNT * 3) / 2)
-
-#define SK_JRAWLEN (SK_JUMBO_FRAMELEN + ETHER_ALIGN)
-#define SK_JLEN (SK_JRAWLEN + (sizeof(u_int64_t) - \
- (SK_JRAWLEN % sizeof(u_int64_t))))
-#define SK_JPAGESZ PAGE_SIZE
-#define SK_RESID (SK_JPAGESZ - (SK_JLEN * SK_JSLOTS) % SK_JPAGESZ)
-#define SK_JMEM ((SK_JLEN * SK_JSLOTS) + SK_RESID)
-
-struct sk_jpool_entry {
- int slot;
- SLIST_ENTRY(sk_jpool_entry) jpool_entries;
-};
-
-struct sk_chain {
- void *sk_desc;
- struct mbuf *sk_mbuf;
- struct sk_chain *sk_next;
-};
-
-struct sk_chain_data {
- struct sk_chain sk_tx_chain[SK_TX_RING_CNT];
- struct sk_chain sk_rx_chain[SK_RX_RING_CNT];
- int sk_tx_prod;
- int sk_tx_cons;
- int sk_tx_cnt;
- int sk_rx_prod;
- int sk_rx_cons;
- int sk_rx_cnt;
- /* Stick the jumbo mem management stuff here too. */
- caddr_t sk_jslots[SK_JSLOTS];
- void *sk_jumbo_buf;
-
-};
-
-struct sk_ring_data {
- struct sk_tx_desc sk_tx_ring[SK_TX_RING_CNT];
- struct sk_rx_desc sk_rx_ring[SK_RX_RING_CNT];
-};
-
-struct sk_bcom_hack {
- int reg;
- int val;
-};
-
-#define SK_INC(x, y) (x) = (x + 1) % y
-
-/* Forward decl. */
-struct sk_if_softc;
-
-/* Softc for the GEnesis controller. */
-struct sk_softc {
- bus_space_handle_t sk_bhandle; /* bus space handle */
- bus_space_tag_t sk_btag; /* bus space tag */
- void *sk_intrhand; /* irq handler handle */
- struct resource *sk_irq; /* IRQ resource handle */
- struct resource *sk_res; /* I/O or shared mem handle */
- u_int8_t sk_unit; /* controller number */
- u_int8_t sk_type;
- u_int8_t sk_rev;
- u_int8_t spare;
- char *sk_vpd_prodname;
- char *sk_vpd_readonly;
- uint16_t sk_vpd_readonly_len;
- u_int32_t sk_rboff; /* RAMbuffer offset */
- u_int32_t sk_ramsize; /* amount of RAM on NIC */
- u_int32_t sk_pmd; /* physical media type */
- u_int32_t sk_intrmask;
- int sk_int_mod;
- struct sk_if_softc *sk_if[2];
- device_t sk_devs[2];
- struct mtx sk_mtx;
-};
-
-#define SK_LOCK(_sc) mtx_lock(&(_sc)->sk_mtx)
-#define SK_UNLOCK(_sc) mtx_unlock(&(_sc)->sk_mtx)
-#define SK_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sk_mtx, MA_OWNED)
-#define SK_IF_LOCK(_sc) SK_LOCK((_sc)->sk_softc)
-#define SK_IF_UNLOCK(_sc) SK_UNLOCK((_sc)->sk_softc)
-#define SK_IF_LOCK_ASSERT(_sc) SK_LOCK_ASSERT((_sc)->sk_softc)
-
-/* Softc for each logical interface */
-struct sk_if_softc {
- struct ifnet *sk_ifp; /* interface info */
- device_t sk_miibus;
- u_int8_t sk_unit; /* interface number */
- u_int8_t sk_port; /* port # on controller */
- u_int8_t sk_xmac_rev; /* XMAC chip rev (B2 or C1) */
- u_int32_t sk_rx_ramstart;
- u_int32_t sk_rx_ramend;
- u_int32_t sk_tx_ramstart;
- u_int32_t sk_tx_ramend;
- int sk_phytype;
- int sk_phyaddr;
- device_t sk_dev;
- int sk_cnt;
- int sk_link;
- struct callout_handle sk_tick_ch;
- struct sk_chain_data sk_cdata;
- struct sk_ring_data *sk_rdata;
- struct sk_softc *sk_softc; /* parent controller */
- int sk_tx_bmu; /* TX BMU register */
- int sk_if_flags;
- SLIST_HEAD(__sk_jfreehead, sk_jpool_entry) sk_jfree_listhead;
- SLIST_HEAD(__sk_jinusehead, sk_jpool_entry) sk_jinuse_listhead;
- struct mtx sk_jlist_mtx;
-};
-
-#define SK_JLIST_LOCK(_sc) mtx_lock(&(_sc)->sk_jlist_mtx)
-#define SK_JLIST_UNLOCK(_sc) mtx_unlock(&(_sc)->sk_jlist_mtx)
-
-#define SK_MAXUNIT 256
-#define SK_TIMEOUT 1000
-#define ETHER_ALIGN 2
-
-#ifdef __alpha__
-#undef vtophys
-#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va)
-#endif
diff --git a/sys/dev/sk/xmaciireg.h b/sys/dev/sk/xmaciireg.h
deleted file mode 100644
index 38cd8cb..0000000
--- a/sys/dev/sk/xmaciireg.h
+++ /dev/null
@@ -1,403 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998, 1999, 2000
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * Registers and data structures for the XaQti Corporation XMAC II
- * Gigabit Ethernet MAC. Datasheet is available from http://www.xaqti.com.
- * The XMAC can be programmed for 16-bit or 32-bit register access modes.
- * The SysKonnect gigabit ethernet adapters use 16-bit mode, so that's
- * how the registers are laid out here.
- */
-
-#define XM_DEVICEID 0x00E0AE20
-#define XM_XAQTI_OUI 0x00E0AE
-
-#define XM_XMAC_REV(x) (((x) & 0x000000E0) >> 5)
-
-#define XM_XMAC_REV_B2 0x0
-#define XM_XMAC_REV_C1 0x1
-
-#define XM_MMUCMD 0x0000
-#define XM_POFF 0x0008
-#define XM_BURST 0x000C
-#define XM_VLAN_TAGLEV1 0x0010
-#define XM_VLAN_TAGLEV2 0x0014
-#define XM_TXCMD 0x0020
-#define XM_TX_RETRYLIMIT 0x0024
-#define XM_TX_SLOTTIME 0x0028
-#define XM_TX_IPG 0x003C
-#define XM_RXCMD 0x0030
-#define XM_PHY_ADDR 0x0034
-#define XM_PHY_DATA 0x0038
-#define XM_GPIO 0x0040
-#define XM_IMR 0x0044
-#define XM_ISR 0x0048
-#define XM_HWCFG 0x004C
-#define XM_TX_LOWAT 0x0060
-#define XM_TX_HIWAT 0x0062
-#define XM_TX_REQTHRESH_LO 0x0064
-#define XM_TX_REQTHRESH_HI 0x0066
-#define XM_TX_REQTHRESH XM_TX_REQTHRESH_LO
-#define XM_PAUSEDST0 0x0068
-#define XM_PAUSEDST1 0x006A
-#define XM_PAUSEDST2 0x006C
-#define XM_CTLPARM_LO 0x0070
-#define XM_CTLPARM_HI 0x0072
-#define XM_CTLPARM XM_CTLPARM_LO
-#define XM_OPCODE_PAUSE_TIMER 0x0074
-#define XM_TXSTAT_LIFO 0x0078
-
-/*
- * Perfect filter registers. The XMAC has a table of 16 perfect
- * filter entries, spaced 8 bytes apart. This is in addition to
- * the station address registers, which appear below.
- */
-#define XM_RXFILT_BASE 0x0080
-#define XM_RXFILT_END 0x0107
-#define XM_RXFILT_MAX 16
-#define XM_RXFILT_ENTRY(ent) (XM_RXFILT_BASE + ((ent * 8)))
-
-/* Primary station address. */
-#define XM_PAR0 0x0108
-#define XM_PAR1 0x010A
-#define XM_PAR2 0x010C
-
-/* 64-bit multicast hash table registers */
-#define XM_MAR0 0x0110
-#define XM_MAR1 0x0112
-#define XM_MAR2 0x0114
-#define XM_MAR3 0x0116
-#define XM_RX_LOWAT 0x0118
-#define XM_RX_HIWAT 0x011A
-#define XM_RX_REQTHRESH_LO 0x011C
-#define XM_RX_REQTHRESH_HI 0x011E
-#define XM_RX_REQTHRESH XM_RX_REQTHRESH_LO
-#define XM_DEVID_LO 0x0120
-#define XM_DEVID_HI 0x0122
-#define XM_DEVID XM_DEVID_LO
-#define XM_MODE_LO 0x0124
-#define XM_MODE_HI 0x0126
-#define XM_MODE XM_MODE_LO
-#define XM_LASTSRC0 0x0128
-#define XM_LASTSRC1 0x012A
-#define XM_LASTSRC2 0x012C
-#define XM_TSTAMP_READ 0x0130
-#define XM_TSTAMP_LOAD 0x0134
-#define XM_STATS_CMD 0x0200
-#define XM_RXCNT_EVENT_LO 0x0204
-#define XM_RXCNT_EVENT_HI 0x0206
-#define XM_RXCNT_EVENT XM_RXCNT_EVENT_LO
-#define XM_TXCNT_EVENT_LO 0x0208
-#define XM_TXCNT_EVENT_HI 0x020A
-#define XM_TXCNT_EVENT XM_TXCNT_EVENT_LO
-#define XM_RXCNT_EVMASK_LO 0x020C
-#define XM_RXCNT_EVMASK_HI 0x020E
-#define XM_RXCNT_EVMASK XM_RXCNT_EVMASK_LO
-#define XM_TXCNT_EVMASK_LO 0x0210
-#define XM_TXCNT_EVMASK_HI 0x0212
-#define XM_TXCNT_EVMASK XM_TXCNT_EVMASK_LO
-
-/* Statistics command register */
-#define XM_STATCMD_CLR_TX 0x0001
-#define XM_STATCMD_CLR_RX 0x0002
-#define XM_STATCMD_COPY_TX 0x0004
-#define XM_STATCMD_COPY_RX 0x0008
-#define XM_STATCMD_SNAP_TX 0x0010
-#define XM_STATCMD_SNAP_RX 0x0020
-
-/* TX statistics registers */
-#define XM_TXSTATS_PKTSOK 0x280
-#define XM_TXSTATS_BYTESOK_HI 0x284
-#define XM_TXSTATS_BYTESOK_LO 0x288
-#define XM_TXSTATS_BCASTSOK 0x28C
-#define XM_TXSTATS_MCASTSOK 0x290
-#define XM_TXSTATS_UCASTSOK 0x294
-#define XM_TXSTATS_GIANTS 0x298
-#define XM_TXSTATS_BURSTCNT 0x29C
-#define XM_TXSTATS_PAUSEPKTS 0x2A0
-#define XM_TXSTATS_MACCTLPKTS 0x2A4
-#define XM_TXSTATS_SINGLECOLS 0x2A8
-#define XM_TXSTATS_MULTICOLS 0x2AC
-#define XM_TXSTATS_EXCESSCOLS 0x2B0
-#define XM_TXSTATS_LATECOLS 0x2B4
-#define XM_TXSTATS_DEFER 0x2B8
-#define XM_TXSTATS_EXCESSDEFER 0x2BC
-#define XM_TXSTATS_UNDERRUN 0x2C0
-#define XM_TXSTATS_CARRIERSENSE 0x2C4
-#define XM_TXSTATS_UTILIZATION 0x2C8
-#define XM_TXSTATS_64 0x2D0
-#define XM_TXSTATS_65_127 0x2D4
-#define XM_TXSTATS_128_255 0x2D8
-#define XM_TXSTATS_256_511 0x2DC
-#define XM_TXSTATS_512_1023 0x2E0
-#define XM_TXSTATS_1024_MAX 0x2E4
-
-/* RX statistics registers */
-#define XM_RXSTATS_PKTSOK 0x300
-#define XM_RXSTATS_BYTESOK_HI 0x304
-#define XM_RXSTATS_BYTESOK_LO 0x308
-#define XM_RXSTATS_BCASTSOK 0x30C
-#define XM_RXSTATS_MCASTSOK 0x310
-#define XM_RXSTATS_UCASTSOK 0x314
-#define XM_RXSTATS_PAUSEPKTS 0x318
-#define XM_RXSTATS_MACCTLPKTS 0x31C
-#define XM_RXSTATS_BADPAUSEPKTS 0x320
-#define XM_RXSTATS_BADMACCTLPKTS 0x324
-#define XM_RXSTATS_BURSTCNT 0x328
-#define XM_RXSTATS_MISSEDPKTS 0x32C
-#define XM_RXSTATS_FRAMEERRS 0x330
-#define XM_RXSTATS_OVERRUN 0x334
-#define XM_RXSTATS_JABBER 0x338
-#define XM_RXSTATS_CARRLOSS 0x33C
-#define XM_RXSTATS_INRNGLENERR 0x340
-#define XM_RXSTATS_SYMERR 0x344
-#define XM_RXSTATS_SHORTEVENT 0x348
-#define XM_RXSTATS_RUNTS 0x34C
-#define XM_RXSTATS_GIANTS 0x350
-#define XM_RXSTATS_CRCERRS 0x354
-#define XM_RXSTATS_CEXTERRS 0x35C
-#define XM_RXSTATS_UTILIZATION 0x360
-#define XM_RXSTATS_64 0x368
-#define XM_RXSTATS_65_127 0x36C
-#define XM_RXSTATS_128_255 0x370
-#define XM_RXSTATS_256_511 0x374
-#define XM_RXSTATS_512_1023 0x378
-#define XM_RXSTATS_1024_MAX 0x37C
-
-#define XM_MMUCMD_TX_ENB 0x0001
-#define XM_MMUCMD_RX_ENB 0x0002
-#define XM_MMUCMD_GMIILOOP 0x0004
-#define XM_MMUCMD_RATECTL 0x0008
-#define XM_MMUCMD_GMIIFDX 0x0010
-#define XM_MMUCMD_NO_MGMT_PRMB 0x0020
-#define XM_MMUCMD_SIMCOL 0x0040
-#define XM_MMUCMD_FORCETX 0x0080
-#define XM_MMUCMD_LOOPENB 0x0200
-#define XM_MMUCMD_IGNPAUSE 0x0400
-#define XM_MMUCMD_PHYBUSY 0x0800
-#define XM_MMUCMD_PHYDATARDY 0x1000
-
-#define XM_TXCMD_AUTOPAD 0x0001
-#define XM_TXCMD_NOCRC 0x0002
-#define XM_TXCMD_NOPREAMBLE 0x0004
-#define XM_TXCMD_NOGIGAMODE 0x0008
-#define XM_TXCMD_SAMPLELINE 0x0010
-#define XM_TXCMD_ENCBYPASS 0x0020
-#define XM_TXCMD_XMITBK2BK 0x0040
-#define XM_TXCMD_FAIRSHARE 0x0080
-
-#define XM_RXCMD_DISABLE_CEXT 0x0001
-#define XM_RXCMD_STRIPPAD 0x0002
-#define XM_RXCMD_SAMPLELINE 0x0004
-#define XM_RXCMD_SELFRX 0x0008
-#define XM_RXCMD_STRIPFCS 0x0010
-#define XM_RXCMD_TRANSPARENT 0x0020
-#define XM_RXCMD_IPGCAPTURE 0x0040
-#define XM_RXCMD_BIGPKTOK 0x0080
-#define XM_RXCMD_LENERROK 0x0100
-
-#define XM_GPIO_GP0_SET 0x0001
-#define XM_GPIO_RESETSTATS 0x0004
-#define XM_GPIO_RESETMAC 0x0008
-#define XM_GPIO_FORCEINT 0x0020
-#define XM_GPIO_ANEGINPROG 0x0040
-
-#define XM_IMR_RX_EOF 0x0001
-#define XM_IMR_TX_EOF 0x0002
-#define XM_IMR_TX_UNDERRUN 0x0004
-#define XM_IMR_RX_OVERRUN 0x0008
-#define XM_IMR_TX_STATS_OFLOW 0x0010
-#define XM_IMR_RX_STATS_OFLOW 0x0020
-#define XM_IMR_TSTAMP_OFLOW 0x0040
-#define XM_IMR_AUTONEG_DONE 0x0080
-#define XM_IMR_NEXTPAGE_RDY 0x0100
-#define XM_IMR_PAGE_RECEIVED 0x0200
-#define XM_IMR_LP_REQCFG 0x0400
-#define XM_IMR_GP0_SET 0x0800
-#define XM_IMR_FORCEINTR 0x1000
-#define XM_IMR_TX_ABORT 0x2000
-#define XM_IMR_LINKEVENT 0x4000
-
-#define XM_INTRS \
- (~(XM_IMR_GP0_SET|XM_IMR_AUTONEG_DONE|XM_IMR_TX_UNDERRUN))
-
-#define XM_ISR_RX_EOF 0x0001
-#define XM_ISR_TX_EOF 0x0002
-#define XM_ISR_TX_UNDERRUN 0x0004
-#define XM_ISR_RX_OVERRUN 0x0008
-#define XM_ISR_TX_STATS_OFLOW 0x0010
-#define XM_ISR_RX_STATS_OFLOW 0x0020
-#define XM_ISR_TSTAMP_OFLOW 0x0040
-#define XM_ISR_AUTONEG_DONE 0x0080
-#define XM_ISR_NEXTPAGE_RDY 0x0100
-#define XM_ISR_PAGE_RECEIVED 0x0200
-#define XM_ISR_LP_REQCFG 0x0400
-#define XM_ISR_GP0_SET 0x0800
-#define XM_ISR_FORCEINTR 0x1000
-#define XM_ISR_TX_ABORT 0x2000
-#define XM_ISR_LINKEVENT 0x4000
-
-#define XM_HWCFG_GENEOP 0x0008
-#define XM_HWCFG_SIGSTATCKH 0x0004
-#define XM_HWCFG_GMIIMODE 0x0001
-
-#define XM_MODE_FLUSH_RXFIFO 0x00000001
-#define XM_MODE_FLUSH_TXFIFO 0x00000002
-#define XM_MODE_BIGENDIAN 0x00000004
-#define XM_MODE_RX_PROMISC 0x00000008
-#define XM_MODE_RX_NOBROAD 0x00000010
-#define XM_MODE_RX_NOMULTI 0x00000020
-#define XM_MODE_RX_NOUNI 0x00000040
-#define XM_MODE_RX_BADFRAMES 0x00000080
-#define XM_MODE_RX_CRCERRS 0x00000100
-#define XM_MODE_RX_GIANTS 0x00000200
-#define XM_MODE_RX_INRANGELEN 0x00000400
-#define XM_MODE_RX_RUNTS 0x00000800
-#define XM_MODE_RX_MACCTL 0x00001000
-#define XM_MODE_RX_USE_PERFECT 0x00002000
-#define XM_MODE_RX_USE_STATION 0x00004000
-#define XM_MODE_RX_USE_HASH 0x00008000
-#define XM_MODE_RX_ADDRPAIR 0x00010000
-#define XM_MODE_PAUSEONHI 0x00020000
-#define XM_MODE_PAUSEONLO 0x00040000
-#define XM_MODE_TIMESTAMP 0x00080000
-#define XM_MODE_SENDPAUSE 0x00100000
-#define XM_MODE_SENDCONTINUOUS 0x00200000
-#define XM_MODE_LE_STATUSWORD 0x00400000
-#define XM_MODE_AUTOFIFOPAUSE 0x00800000
-#define XM_MODE_EXPAUSEGEN 0x02000000
-#define XM_MODE_RX_INVERSE 0x04000000
-
-#define XM_RXSTAT_MACCTL 0x00000001
-#define XM_RXSTAT_ERRFRAME 0x00000002
-#define XM_RXSTAT_CRCERR 0x00000004
-#define XM_RXSTAT_GIANT 0x00000008
-#define XM_RXSTAT_RUNT 0x00000010
-#define XM_RXSTAT_FRAMEERR 0x00000020
-#define XM_RXSTAT_INRANGEERR 0x00000040
-#define XM_RXSTAT_CARRIERERR 0x00000080
-#define XM_RXSTAT_COLLERR 0x00000100
-#define XM_RXSTAT_802_3 0x00000200
-#define XM_RXSTAT_CARREXTERR 0x00000400
-#define XM_RXSTAT_BURSTMODE 0x00000800
-#define XM_RXSTAT_UNICAST 0x00002000
-#define XM_RXSTAT_MULTICAST 0x00004000
-#define XM_RXSTAT_BROADCAST 0x00008000
-#define XM_RXSTAT_VLAN_LEV1 0x00010000
-#define XM_RXSTAT_VLAN_LEV2 0x00020000
-#define XM_RXSTAT_LEN 0xFFFC0000
-
-/*
- * XMAC PHY registers, indirectly accessed through
- * XM_PHY_ADDR and XM_PHY_REG.
- */
-
-#define XM_PHY_BMCR 0x0000 /* control */
-#define XM_PHY_BMSR 0x0001 /* status */
-#define XM_PHY_VENID 0x0002 /* vendor id */
-#define XM_PHY_DEVID 0x0003 /* device id */
-#define XM_PHY_ANAR 0x0004 /* autoneg advertisenemt */
-#define XM_PHY_LPAR 0x0005 /* link partner ability */
-#define XM_PHY_ANEXP 0x0006 /* autoneg expansion */
-#define XM_PHY_NEXTP 0x0007 /* nextpage */
-#define XM_PHY_LPNEXTP 0x0008 /* link partner's nextpage */
-#define XM_PHY_EXTSTS 0x000F /* extented status */
-#define XM_PHY_RESAB 0x0010 /* resolved ability */
-
-#define XM_BMCR_DUPLEX 0x0100
-#define XM_BMCR_RENEGOTIATE 0x0200
-#define XM_BMCR_AUTONEGENBL 0x1000
-#define XM_BMCR_LOOPBACK 0x4000
-#define XM_BMCR_RESET 0x8000
-
-#define XM_BMSR_EXTCAP 0x0001
-#define XM_BMSR_LINKSTAT 0x0004
-#define XM_BMSR_AUTONEGABLE 0x0008
-#define XM_BMSR_REMFAULT 0x0010
-#define XM_BMSR_AUTONEGDONE 0x0020
-#define XM_BMSR_EXTSTAT 0x0100
-
-#define XM_VENID_XAQTI 0xD14C
-#define XM_DEVID_XMAC 0x0002
-
-#define XM_ANAR_FULLDUPLEX 0x0020
-#define XM_ANAR_HALFDUPLEX 0x0040
-#define XM_ANAR_PAUSEBITS 0x0180
-#define XM_ANAR_REMFAULTBITS 0x1800
-#define XM_ANAR_ACK 0x4000
-#define XM_ANAR_NEXTPAGE 0x8000
-
-#define XM_LPAR_FULLDUPLEX 0x0020
-#define XM_LPAR_HALFDUPLEX 0x0040
-#define XM_LPAR_PAUSEBITS 0x0180
-#define XM_LPAR_REMFAULTBITS 0x1800
-#define XM_LPAR_ACK 0x4000
-#define XM_LPAR_NEXTPAGE 0x8000
-
-#define XM_PAUSE_NOPAUSE 0x0000
-#define XM_PAUSE_SYMPAUSE 0x0080
-#define XM_PAUSE_ASYMPAUSE 0x0100
-#define XM_PAUSE_BOTH 0x0180
-
-#define XM_REMFAULT_LINKOK 0x0000
-#define XM_REMFAULT_LINKFAIL 0x0800
-#define XM_REMFAULT_OFFLINE 0x1000
-#define XM_REMFAULT_ANEGERR 0x1800
-
-#define XM_ANEXP_GOTPAGE 0x0002
-#define XM_ANEXP_NEXTPAGE_SELF 0x0004
-#define XM_ANEXP_NEXTPAGE_LP 0x0008
-
-#define XM_NEXTP_MESSAGE 0x07FF
-#define XM_NEXTP_TOGGLE 0x0800
-#define XM_NEXTP_ACK2 0x1000
-#define XM_NEXTP_MPAGE 0x2000
-#define XM_NEXTP_ACK1 0x4000
-#define XM_NEXTP_NPAGE 0x8000
-
-#define XM_LPNEXTP_MESSAGE 0x07FF
-#define XM_LPNEXTP_TOGGLE 0x0800
-#define XM_LPNEXTP_ACK2 0x1000
-#define XM_LPNEXTP_MPAGE 0x2000
-#define XM_LPNEXTP_ACK1 0x4000
-#define XM_LPNEXTP_NPAGE 0x8000
-
-#define XM_EXTSTS_HALFDUPLEX 0x4000
-#define XM_EXTSTS_FULLDUPLEX 0x8000
-
-#define XM_RESAB_PAUSEMISMATCH 0x0008
-#define XM_RESAB_ABLMISMATCH 0x0010
-#define XM_RESAB_FDMODESEL 0x0020
-#define XM_RESAB_HDMODESEL 0x0040
-#define XM_RESAB_PAUSEBITS 0x0180
diff --git a/sys/dev/sk/yukonreg.h b/sys/dev/sk/yukonreg.h
deleted file mode 100644
index 51d9f3a..0000000
--- a/sys/dev/sk/yukonreg.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* $OpenBSD: yukonreg.h,v 1.2 2003/08/12 05:23:06 nate Exp $ */
-/*-
- * Copyright (c) 2003 Nathan L. Binkert <binkertn@umich.edu>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * $FreeBSD$
- */
-
-/* General Purpose Status Register (GPSR) */
-#define YUKON_GPSR 0x0000
-
-#define YU_GPSR_SPEED 0x8000 /* speed 0 - 10Mbps, 1 - 100Mbps */
-#define YU_GPSR_DUPLEX 0x4000 /* 0 - half duplex, 1 - full duplex */
-#define YU_GPSR_FCTL_TX 0x2000 /* flow control */
-#define YU_GPSR_LINK 0x1000 /* link status (down/up) */
-#define YU_GPSR_PAUSE 0x0800 /* flow control enable/disable */
-#define YU_GPSR_TX_IN_PROG 0x0400 /* transmit in progress */
-#define YU_GPSR_EXCESS_COL 0x0200 /* excessive collisions occurred */
-#define YU_GPSR_LATE_COL 0x0100 /* late collision occurred */
-#define YU_GPSR_MII_PHY_STC 0x0020 /* MII PHY status change */
-#define YU_GPSR_GIG_SPEED 0x0010 /* Gigabit Speed (0 - use speed bit) */
-#define YU_GPSR_PARTITION 0x0008 /* partition mode */
-#define YU_GPSR_FCTL_RX 0x0004 /* flow control enable/disable */
-#define YU_GPSR_PROMS_EN 0x0002 /* promiscuous mode enable/disable */
-
-/* General Purpose Control Register (GPCR) */
-#define YUKON_GPCR 0x0004
-
-#define YU_GPCR_FCTL_TX 0x2000 /* Transmit flow control 802.3x */
-#define YU_GPCR_TXEN 0x1000 /* Transmit Enable */
-#define YU_GPCR_RXEN 0x0800 /* Receive Enable */
-#define YU_GPCR_LPBK 0x0200 /* Loopback Enable */
-#define YU_GPCR_PAR 0x0100 /* Partition Enable */
-#define YU_GPCR_GIG 0x0080 /* Gigabit Speed */
-#define YU_GPCR_FLP 0x0040 /* Force Link Pass */
-#define YU_GPCR_DUPLEX 0x0020 /* Duplex Enable */
-#define YU_GPCR_FCTL_RX 0x0010 /* Receive flow control 802.3x */
-#define YU_GPCR_SPEED 0x0008 /* Port Speed */
-#define YU_GPCR_DPLX_EN 0x0004 /* Enable Auto-Update for duplex */
-#define YU_GPCR_FCTL_EN 0x0002 /* Enabel Auto-Update for 802.3x */
-#define YU_GPCR_SPEED_EN 0x0001 /* Enable Auto-Update for speed */
-
-/* Transmit Control Register (TCR) */
-#define YUKON_TCR 0x0008
-
-#define YU_TCR_FJ 0x8000 /* force jam / flow control */
-#define YU_TCR_CRCD 0x4000 /* insert CRC (0 - enable) */
-#define YU_TCR_PADD 0x2000 /* pad packets to 64b (0 - enable) */
-#define YU_TCR_COLTH 0x1c00 /* collision threshold */
-
-/* Receive Control Register (RCR) */
-#define YUKON_RCR 0x000c
-
-#define YU_RCR_UFLEN 0x8000 /* unicast filter enable */
-#define YU_RCR_MUFLEN 0x4000 /* multicast filter enable */
-#define YU_RCR_CRCR 0x2000 /* remove CRC */
-#define YU_RCR_PASSFC 0x1000 /* pass flow control packets */
-
-/* Transmit Flow Control Register (TFCR) */
-#define YUKON_TFCR 0x0010 /* Pause Time */
-
-/* Transmit Parameter Register (TPR) */
-#define YUKON_TPR 0x0014
-
-#define YU_TPR_JAM_LEN(x) (((x) & 0x3) << 14)
-#define YU_TPR_JAM_IPG(x) (((x) & 0x1f) << 9)
-#define YU_TPR_JAM2DATA_IPG(x) (((x) & 0x1f) << 4)
-
-/* Serial Mode Register (SMR) */
-#define YUKON_SMR 0x0018
-
-#define YU_SMR_DATA_BLIND(x) (((x) & 0x1f) << 11)
-#define YU_SMR_LIMIT4 0x0400 /* reset after 16 / 4 collisions */
-#define YU_SMR_MFL_JUMBO 0x0100 /* max frame length for jumbo frames */
-#define YU_SMR_MFL_VLAN 0x0200 /* max frame length + vlan tag */
-#define YU_SMR_IPG_DATA(x) ((x) & 0x1f)
-
-/* Source Address Low #1 (SAL1) */
-#define YUKON_SAL1 0x001c /* SA1[15:0] */
-
-/* Source Address Middle #1 (SAM1) */
-#define YUKON_SAM1 0x0020 /* SA1[31:16] */
-
-/* Source Address High #1 (SAH1) */
-#define YUKON_SAH1 0x0024 /* SA1[47:32] */
-
-/* Source Address Low #2 (SAL2) */
-#define YUKON_SAL2 0x0028 /* SA2[15:0] */
-
-/* Source Address Middle #2 (SAM2) */
-#define YUKON_SAM2 0x002c /* SA2[31:16] */
-
-/* Source Address High #2 (SAH2) */
-#define YUKON_SAH2 0x0030 /* SA2[47:32] */
-
-/* Multicatst Address Hash Register 1 (MCAH1) */
-#define YUKON_MCAH1 0x0034
-
-/* Multicatst Address Hash Register 2 (MCAH2) */
-#define YUKON_MCAH2 0x0038
-
-/* Multicatst Address Hash Register 3 (MCAH3) */
-#define YUKON_MCAH3 0x003c
-
-/* Multicatst Address Hash Register 4 (MCAH4) */
-#define YUKON_MCAH4 0x0040
-
-/* Transmit Interrupt Register (TIR) */
-#define YUKON_TIR 0x0044
-
-#define YU_TIR_OUT_UNICAST 0x0001 /* Num Unicast Packets Transmitted */
-#define YU_TIR_OUT_BROADCAST 0x0002 /* Num Broadcast Packets Transmitted */
-#define YU_TIR_OUT_PAUSE 0x0004 /* Num Pause Packets Transmitted */
-#define YU_TIR_OUT_MULTICAST 0x0008 /* Num Multicast Packets Transmitted */
-#define YU_TIR_OUT_OCTETS 0x0030 /* Num Bytes Transmitted */
-#define YU_TIR_OUT_64_OCTETS 0x0000 /* Num Packets Transmitted */
-#define YU_TIR_OUT_127_OCTETS 0x0000 /* Num Packets Transmitted */
-#define YU_TIR_OUT_255_OCTETS 0x0000 /* Num Packets Transmitted */
-#define YU_TIR_OUT_511_OCTETS 0x0000 /* Num Packets Transmitted */
-#define YU_TIR_OUT_1023_OCTETS 0x0000 /* Num Packets Transmitted */
-#define YU_TIR_OUT_1518_OCTETS 0x0000 /* Num Packets Transmitted */
-#define YU_TIR_OUT_MAX_OCTETS 0x0000 /* Num Packets Transmitted */
-#define YU_TIR_OUT_SPARE 0x0000 /* Num Packets Transmitted */
-#define YU_TIR_OUT_COLLISIONS 0x0000 /* Num Packets Transmitted */
-#define YU_TIR_OUT_LATE 0x0000 /* Num Packets Transmitted */
-
-/* Receive Interrupt Register (RIR) */
-#define YUKON_RIR 0x0048
-
-/* Transmit and Receive Interrupt Register (TRIR) */
-#define YUKON_TRIR 0x004c
-
-/* Transmit Interrupt Mask Register (TIMR) */
-#define YUKON_TIMR 0x0050
-
-/* Receive Interrupt Mask Register (RIMR) */
-#define YUKON_RIMR 0x0054
-
-/* Transmit and Receive Interrupt Mask Register (TRIMR) */
-#define YUKON_TRIMR 0x0058
-
-/* SMI Control Register (SMICR) */
-#define YUKON_SMICR 0x0080
-
-#define YU_SMICR_PHYAD(x) (((x) & 0x1f) << 11)
-#define YU_SMICR_REGAD(x) (((x) & 0x1f) << 6)
-#define YU_SMICR_OPCODE 0x0020 /* opcode (0 - write, 1 - read) */
-#define YU_SMICR_OP_READ 0x0020 /* opcode read */
-#define YU_SMICR_OP_WRITE 0x0000 /* opcode write */
-#define YU_SMICR_READ_VALID 0x0010 /* read valid */
-#define YU_SMICR_BUSY 0x0008 /* busy (writing) */
-
-/* SMI Data Register (SMIDR) */
-#define YUKON_SMIDR 0x0084
-
-/* PHY Addres Register (PAR) */
-#define YUKON_PAR 0x0088
-
-#define YU_PAR_MIB_CLR 0x0020 /* MIB Counters Clear Mode */
-#define YU_PAR_LOAD_TSTCNT 0x0010 /* Load count 0xfffffff0 into cntr */
diff --git a/sys/dev/speaker/speaker.h b/sys/dev/speaker/speaker.h
deleted file mode 100644
index 6b1f021..0000000
--- a/sys/dev/speaker/speaker.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * speaker.h -- interface definitions for speaker ioctl()
- *
- * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
- * modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
- *
- * $FreeBSD$
- */
-
-#ifndef _MACHINE_SPEAKER_H_
-#define _MACHINE_SPEAKER_H_
-
-#include <sys/ioccom.h>
-
-#define SPKRTONE _IOW('S', 1, tone_t) /* emit tone */
-#define SPKRTUNE _IO('S', 2) /* emit tone sequence*/
-
-typedef struct
-{
- int frequency; /* in hertz */
- int duration; /* in 1/100ths of a second */
-} tone_t;
-
-/*
- * Strings written to the speaker device are interpreted as tunes and played;
- * see the spkr(4) man page for details.
- */
-
-#endif /* !_MACHINE_SPEAKER_H_ */
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
deleted file mode 100644
index d265e7c..0000000
--- a/sys/dev/speaker/spkr.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*-
- * spkr.c -- device driver for console speaker
- *
- * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
- * modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
- * modified for PC98 by Kakefuda
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/uio.h>
-#include <sys/conf.h>
-#include <sys/ctype.h>
-#include <sys/malloc.h>
-#include <isa/isavar.h>
-#include <machine/clock.h>
-#include <machine/speaker.h>
-#include <machine/ppireg.h>
-#include <machine/timerreg.h>
-
-static d_open_t spkropen;
-static d_close_t spkrclose;
-static d_write_t spkrwrite;
-static d_ioctl_t spkrioctl;
-
-static struct cdevsw spkr_cdevsw = {
- .d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
- .d_open = spkropen,
- .d_close = spkrclose,
- .d_write = spkrwrite,
- .d_ioctl = spkrioctl,
- .d_name = "spkr",
-};
-
-static MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer");
-
-/**************** MACHINE DEPENDENT PART STARTS HERE *************************
- *
- * This section defines a function tone() which causes a tone of given
- * frequency and duration from the ISA console speaker.
- * Another function endtone() is defined to force sound off, and there is
- * also a rest() entry point to do pauses.
- *
- * Audible sound is generated using the Programmable Interval Timer (PIT) and
- * Programmable Peripheral Interface (PPI) attached to the ISA speaker. The
- * PPI controls whether sound is passed through at all; the PIT's channel 2 is
- * used to generate clicks (a square wave) of whatever frequency is desired.
- */
-
-#ifdef PC98
-#define SPKR_DESC "PC98 speaker"
-#else
-#define SPKR_DESC "PC speaker"
-#endif
-
-#define SPKRPRI PSOCK
-static char endtone, endrest;
-
-static void tone(unsigned int thz, unsigned int ticks);
-static void rest(int ticks);
-static void playinit(void);
-static void playtone(int pitch, int value, int sustain);
-static void playstring(char *cp, size_t slen);
-
-/* emit tone of frequency thz for given number of ticks */
-static void
-tone(thz, ticks)
- unsigned int thz, ticks;
-{
- unsigned int divisor;
- int sps;
-
- if (thz <= 0)
- return;
-
- divisor = timer_freq / thz;
-
-#ifdef DEBUG
- (void) printf("tone: thz=%d ticks=%d\n", thz, ticks);
-#endif /* DEBUG */
-
- /* set timer to generate clicks at given frequency in Hertz */
- sps = splclock();
-
- if (timer_spkr_acquire()) {
- /* enter list of waiting procs ??? */
- splx(sps);
- return;
- }
- splx(sps);
- disable_intr();
- spkr_set_pitch(divisor);
- enable_intr();
-
- /* turn the speaker on */
- ppi_spkr_on();
-
- /*
- * Set timeout to endtone function, then give up the timeslice.
- * This is so other processes can execute while the tone is being
- * emitted.
- */
- if (ticks > 0)
- tsleep(&endtone, SPKRPRI | PCATCH, "spkrtn", ticks);
- ppi_spkr_off();
- sps = splclock();
- timer_spkr_release();
- splx(sps);
-}
-
-/* rest for given number of ticks */
-static void
-rest(ticks)
- int ticks;
-{
- /*
- * Set timeout to endrest function, then give up the timeslice.
- * This is so other processes can execute while the rest is being
- * waited out.
- */
-#ifdef DEBUG
- (void) printf("rest: %d\n", ticks);
-#endif /* DEBUG */
- if (ticks > 0)
- tsleep(&endrest, SPKRPRI | PCATCH, "spkrrs", ticks);
-}
-
-/**************** PLAY STRING INTERPRETER BEGINS HERE **********************
- *
- * Play string interpretation is modelled on IBM BASIC 2.0's PLAY statement;
- * M[LNS] are missing; the ~ synonym and the _ slur mark and the octave-
- * tracking facility are added.
- * Requires tone(), rest(), and endtone(). String play is not interruptible
- * except possibly at physical block boundaries.
- */
-
-typedef int bool;
-#define TRUE 1
-#define FALSE 0
-
-#define dtoi(c) ((c) - '0')
-
-static int octave; /* currently selected octave */
-static int whole; /* whole-note time at current tempo, in ticks */
-static int value; /* whole divisor for note time, quarter note = 1 */
-static int fill; /* controls spacing of notes */
-static bool octtrack; /* octave-tracking on? */
-static bool octprefix; /* override current octave-tracking state? */
-
-/*
- * Magic number avoidance...
- */
-#define SECS_PER_MIN 60 /* seconds per minute */
-#define WHOLE_NOTE 4 /* quarter notes per whole note */
-#define MIN_VALUE 64 /* the most we can divide a note by */
-#define DFLT_VALUE 4 /* default value (quarter-note) */
-#define FILLTIME 8 /* for articulation, break note in parts */
-#define STACCATO 6 /* 6/8 = 3/4 of note is filled */
-#define NORMAL 7 /* 7/8ths of note interval is filled */
-#define LEGATO 8 /* all of note interval is filled */
-#define DFLT_OCTAVE 4 /* default octave */
-#define MIN_TEMPO 32 /* minimum tempo */
-#define DFLT_TEMPO 120 /* default tempo */
-#define MAX_TEMPO 255 /* max tempo */
-#define NUM_MULT 3 /* numerator of dot multiplier */
-#define DENOM_MULT 2 /* denominator of dot multiplier */
-
-/* letter to half-tone: A B C D E F G */
-static int notetab[8] = {9, 11, 0, 2, 4, 5, 7};
-
-/*
- * This is the American Standard A440 Equal-Tempered scale with frequencies
- * rounded to nearest integer. Thank Goddess for the good ol' CRC Handbook...
- * our octave 0 is standard octave 2.
- */
-#define OCTAVE_NOTES 12 /* semitones per octave */
-static int pitchtab[] =
-{
-/* C C# D D# E F F# G G# A A# B*/
-/* 0 */ 65, 69, 73, 78, 82, 87, 93, 98, 103, 110, 117, 123,
-/* 1 */ 131, 139, 147, 156, 165, 175, 185, 196, 208, 220, 233, 247,
-/* 2 */ 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494,
-/* 3 */ 523, 554, 587, 622, 659, 698, 740, 784, 831, 880, 932, 988,
-/* 4 */ 1047, 1109, 1175, 1245, 1319, 1397, 1480, 1568, 1661, 1760, 1865, 1975,
-/* 5 */ 2093, 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520, 3729, 3951,
-/* 6 */ 4186, 4435, 4698, 4978, 5274, 5588, 5920, 6272, 6644, 7040, 7459, 7902,
-};
-
-static void
-playinit()
-{
- octave = DFLT_OCTAVE;
- whole = (hz * SECS_PER_MIN * WHOLE_NOTE) / DFLT_TEMPO;
- fill = NORMAL;
- value = DFLT_VALUE;
- octtrack = FALSE;
- octprefix = TRUE; /* act as though there was an initial O(n) */
-}
-
-/* play tone of proper duration for current rhythm signature */
-static void
-playtone(pitch, value, sustain)
- int pitch, value, sustain;
-{
- register int sound, silence, snum = 1, sdenom = 1;
-
- /* this weirdness avoids floating-point arithmetic */
- for (; sustain; sustain--)
- {
- /* See the BUGS section in the man page for discussion */
- snum *= NUM_MULT;
- sdenom *= DENOM_MULT;
- }
-
- if (value == 0 || sdenom == 0)
- return;
-
- if (pitch == -1)
- rest(whole * snum / (value * sdenom));
- else
- {
- sound = (whole * snum) / (value * sdenom)
- - (whole * (FILLTIME - fill)) / (value * FILLTIME);
- silence = whole * (FILLTIME-fill) * snum / (FILLTIME * value * sdenom);
-
-#ifdef DEBUG
- (void) printf("playtone: pitch %d for %d ticks, rest for %d ticks\n",
- pitch, sound, silence);
-#endif /* DEBUG */
-
- tone(pitchtab[pitch], sound);
- if (fill != LEGATO)
- rest(silence);
- }
-}
-
-/* interpret and play an item from a notation string */
-static void
-playstring(cp, slen)
- char *cp;
- size_t slen;
-{
- int pitch, oldfill, lastpitch = OCTAVE_NOTES * DFLT_OCTAVE;
-
-#define GETNUM(cp, v) for(v=0; isdigit(cp[1]) && slen > 0; ) \
- {v = v * 10 + (*++cp - '0'); slen--;}
- for (; slen--; cp++)
- {
- int sustain, timeval, tempo;
- register char c = toupper(*cp);
-
-#ifdef DEBUG
- (void) printf("playstring: %c (%x)\n", c, c);
-#endif /* DEBUG */
-
- switch (c)
- {
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G':
-
- /* compute pitch */
- pitch = notetab[c - 'A'] + octave * OCTAVE_NOTES;
-
- /* this may be followed by an accidental sign */
- if (cp[1] == '#' || cp[1] == '+')
- {
- ++pitch;
- ++cp;
- slen--;
- }
- else if (cp[1] == '-')
- {
- --pitch;
- ++cp;
- slen--;
- }
-
- /*
- * If octave-tracking mode is on, and there has been no octave-
- * setting prefix, find the version of the current letter note
- * closest to the last regardless of octave.
- */
- if (octtrack && !octprefix)
- {
- if (abs(pitch-lastpitch) > abs(pitch+OCTAVE_NOTES-lastpitch))
- {
- ++octave;
- pitch += OCTAVE_NOTES;
- }
-
- if (abs(pitch-lastpitch) > abs((pitch-OCTAVE_NOTES)-lastpitch))
- {
- --octave;
- pitch -= OCTAVE_NOTES;
- }
- }
- octprefix = FALSE;
- lastpitch = pitch;
-
- /* ...which may in turn be followed by an override time value */
- GETNUM(cp, timeval);
- if (timeval <= 0 || timeval > MIN_VALUE)
- timeval = value;
-
- /* ...and/or sustain dots */
- for (sustain = 0; cp[1] == '.'; cp++)
- {
- slen--;
- sustain++;
- }
-
- /* ...and/or a slur mark */
- oldfill = fill;
- if (cp[1] == '_')
- {
- fill = LEGATO;
- ++cp;
- slen--;
- }
-
- /* time to emit the actual tone */
- playtone(pitch, timeval, sustain);
-
- fill = oldfill;
- break;
-
- case 'O':
- if (cp[1] == 'N' || cp[1] == 'n')
- {
- octprefix = octtrack = FALSE;
- ++cp;
- slen--;
- }
- else if (cp[1] == 'L' || cp[1] == 'l')
- {
- octtrack = TRUE;
- ++cp;
- slen--;
- }
- else
- {
- GETNUM(cp, octave);
- if (octave >= sizeof(pitchtab) / sizeof(pitchtab[0]) / OCTAVE_NOTES)
- octave = DFLT_OCTAVE;
- octprefix = TRUE;
- }
- break;
-
- case '>':
- if (octave < sizeof(pitchtab) / sizeof(pitchtab[0]) / OCTAVE_NOTES - 1)
- octave++;
- octprefix = TRUE;
- break;
-
- case '<':
- if (octave > 0)
- octave--;
- octprefix = TRUE;
- break;
-
- case 'N':
- GETNUM(cp, pitch);
- for (sustain = 0; cp[1] == '.'; cp++)
- {
- slen--;
- sustain++;
- }
- oldfill = fill;
- if (cp[1] == '_')
- {
- fill = LEGATO;
- ++cp;
- slen--;
- }
- playtone(pitch - 1, value, sustain);
- fill = oldfill;
- break;
-
- case 'L':
- GETNUM(cp, value);
- if (value <= 0 || value > MIN_VALUE)
- value = DFLT_VALUE;
- break;
-
- case 'P':
- case '~':
- /* this may be followed by an override time value */
- GETNUM(cp, timeval);
- if (timeval <= 0 || timeval > MIN_VALUE)
- timeval = value;
- for (sustain = 0; cp[1] == '.'; cp++)
- {
- slen--;
- sustain++;
- }
- playtone(-1, timeval, sustain);
- break;
-
- case 'T':
- GETNUM(cp, tempo);
- if (tempo < MIN_TEMPO || tempo > MAX_TEMPO)
- tempo = DFLT_TEMPO;
- whole = (hz * SECS_PER_MIN * WHOLE_NOTE) / tempo;
- break;
-
- case 'M':
- if (cp[1] == 'N' || cp[1] == 'n')
- {
- fill = NORMAL;
- ++cp;
- slen--;
- }
- else if (cp[1] == 'L' || cp[1] == 'l')
- {
- fill = LEGATO;
- ++cp;
- slen--;
- }
- else if (cp[1] == 'S' || cp[1] == 's')
- {
- fill = STACCATO;
- ++cp;
- slen--;
- }
- break;
- }
- }
-}
-
-/******************* UNIX DRIVER HOOKS BEGIN HERE **************************
- *
- * This section implements driver hooks to run playstring() and the tone(),
- * endtone(), and rest() functions defined above.
- */
-
-static int spkr_active = FALSE; /* exclusion flag */
-static char *spkr_inbuf; /* incoming buf */
-
-static int
-spkropen(dev, flags, fmt, td)
- struct cdev *dev;
- int flags;
- int fmt;
- struct thread *td;
-{
-#ifdef DEBUG
- (void) printf("spkropen: entering with dev = %s\n", devtoname(dev));
-#endif /* DEBUG */
-
- if (minor(dev) != 0)
- return(ENXIO);
- else if (spkr_active)
- return(EBUSY);
- else
- {
-#ifdef DEBUG
- (void) printf("spkropen: about to perform play initialization\n");
-#endif /* DEBUG */
- playinit();
- spkr_inbuf = malloc(DEV_BSIZE, M_SPKR, M_WAITOK);
- spkr_active = TRUE;
- return(0);
- }
-}
-
-static int
-spkrwrite(dev, uio, ioflag)
- struct cdev *dev;
- struct uio *uio;
- int ioflag;
-{
-#ifdef DEBUG
- printf("spkrwrite: entering with dev = %s, count = %d\n",
- devtoname(dev), uio->uio_resid);
-#endif /* DEBUG */
-
- if (minor(dev) != 0)
- return(ENXIO);
- else if (uio->uio_resid > (DEV_BSIZE - 1)) /* prevent system crashes */
- return(E2BIG);
- else
- {
- unsigned n;
- char *cp;
- int error;
-
- n = uio->uio_resid;
- cp = spkr_inbuf;
- error = uiomove(cp, n, uio);
- if (!error) {
- cp[n] = '\0';
- playstring(cp, n);
- }
- return(error);
- }
-}
-
-static int
-spkrclose(dev, flags, fmt, td)
- struct cdev *dev;
- int flags;
- int fmt;
- struct thread *td;
-{
-#ifdef DEBUG
- (void) printf("spkrclose: entering with dev = %s\n", devtoname(dev));
-#endif /* DEBUG */
-
- if (minor(dev) != 0)
- return(ENXIO);
- else
- {
- wakeup(&endtone);
- wakeup(&endrest);
- free(spkr_inbuf, M_SPKR);
- spkr_active = FALSE;
- return(0);
- }
-}
-
-static int
-spkrioctl(dev, cmd, cmdarg, flags, td)
- struct cdev *dev;
- unsigned long cmd;
- caddr_t cmdarg;
- int flags;
- struct thread *td;
-{
-#ifdef DEBUG
- (void) printf("spkrioctl: entering with dev = %s, cmd = %lx\n",
- devtoname(dev), cmd);
-#endif /* DEBUG */
-
- if (minor(dev) != 0)
- return(ENXIO);
- else if (cmd == SPKRTONE)
- {
- tone_t *tp = (tone_t *)cmdarg;
-
- if (tp->frequency == 0)
- rest(tp->duration);
- else
- tone(tp->frequency, tp->duration);
- return 0;
- }
- else if (cmd == SPKRTUNE)
- {
- tone_t *tp = (tone_t *)(*(caddr_t *)cmdarg);
- tone_t ttp;
- int error;
-
- for (; ; tp++) {
- error = copyin(tp, &ttp, sizeof(tone_t));
- if (error)
- return(error);
- if (ttp.duration == 0)
- break;
- if (ttp.frequency == 0)
- rest(ttp.duration);
- else
- tone(ttp.frequency, ttp.duration);
- }
- return(0);
- }
- return(EINVAL);
-}
-
-/*
- * Install placeholder to claim the resources owned by the
- * AT tone generator.
- */
-static struct isa_pnp_id speaker_ids[] = {
-#ifndef PC98
- { 0x0008d041 /* PNP0800 */, SPKR_DESC },
-#endif
- { 0 }
-};
-
-static struct cdev *speaker_dev;
-
-static int
-speaker_probe(device_t dev)
-{
- int error;
-
- error = ISA_PNP_PROBE(device_get_parent(dev), dev, speaker_ids);
-
- /* PnP match */
- if (error == 0)
- return (0);
-
- /* No match */
- if (error == ENXIO)
- return (ENXIO);
-
- /* Not configured by hints. */
- if (strncmp(device_get_name(dev), "speaker", 9))
- return (ENXIO);
-
- device_set_desc(dev, SPKR_DESC);
-
- return (0);
-}
-
-static int
-speaker_attach(device_t dev)
-{
-
- if (speaker_dev) {
- device_printf(dev, "Already attached!\n");
- return (ENXIO);
- }
-
- speaker_dev = make_dev(&spkr_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
- "speaker");
- return (0);
-}
-
-static int
-speaker_detach(device_t dev)
-{
- destroy_dev(speaker_dev);
- return (0);
-}
-
-static device_method_t speaker_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, speaker_probe),
- DEVMETHOD(device_attach, speaker_attach),
- DEVMETHOD(device_detach, speaker_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
- { 0, 0 }
-};
-
-static driver_t speaker_driver = {
- "speaker",
- speaker_methods,
- 1, /* no softc */
-};
-
-static devclass_t speaker_devclass;
-
-DRIVER_MODULE(speaker, isa, speaker_driver, speaker_devclass, 0, 0);
-#ifndef PC98
-DRIVER_MODULE(speaker, acpi, speaker_driver, speaker_devclass, 0, 0);
-#endif
-
-/* spkr.c ends here */
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
deleted file mode 100644
index 1bbfe38..0000000
--- a/sys/dev/ti/if_ti.c
+++ /dev/null
@@ -1,3548 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998, 1999
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Alteon Networks Tigon PCI gigabit ethernet driver for FreeBSD.
- * Manuals, sample driver and firmware source kits are available
- * from http://www.alteon.com/support/openkits.
- *
- * Written by Bill Paul <wpaul@ctr.columbia.edu>
- * Electrical Engineering Department
- * Columbia University, New York City
- */
-
-/*
- * The Alteon Networks Tigon chip contains an embedded R4000 CPU,
- * gigabit MAC, dual DMA channels and a PCI interface unit. NICs
- * using the Tigon may have anywhere from 512K to 2MB of SRAM. The
- * Tigon supports hardware IP, TCP and UCP checksumming, multicast
- * filtering and jumbo (9014 byte) frames. The hardware is largely
- * controlled by firmware, which must be loaded into the NIC during
- * initialization.
- *
- * The Tigon 2 contains 2 R4000 CPUs and requires a newer firmware
- * revision, which supports new features such as extended commands,
- * extended jumbo receive ring desciptors and a mini receive ring.
- *
- * Alteon Networks is to be commended for releasing such a vast amount
- * of development material for the Tigon NIC without requiring an NDA
- * (although they really should have done it a long time ago). With
- * any luck, the other vendors will finally wise up and follow Alteon's
- * stellar example.
- *
- * The firmware for the Tigon 1 and 2 NICs is compiled directly into
- * this driver by #including it as a C header file. This bloats the
- * driver somewhat, but it's the easiest method considering that the
- * driver code and firmware code need to be kept in sync. The source
- * for the firmware is not provided with the FreeBSD distribution since
- * compiling it requires a GNU toolchain targeted for mips-sgi-irix5.3.
- *
- * The following people deserve special thanks:
- * - Terry Murphy of 3Com, for providing a 3c985 Tigon 1 board
- * for testing
- * - Raymond Lee of Netgear, for providing a pair of Netgear
- * GA620 Tigon 2 boards for testing
- * - Ulf Zimmermann, for bringing the GA260 to my attention and
- * convincing me to write this driver.
- * - Andrew Gallatin for providing FreeBSD/Alpha support.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_ti.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/socket.h>
-#include <sys/queue.h>
-#include <sys/conf.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-#include <net/if_vlan_var.h>
-
-#include <net/bpf.h>
-
-#include <netinet/in_systm.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-
-#include <vm/vm.h> /* for vtophys */
-#include <vm/pmap.h> /* for vtophys */
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-/* #define TI_PRIVATE_JUMBOS */
-
-#if !defined(TI_PRIVATE_JUMBOS)
-#include <sys/sockio.h>
-#include <sys/uio.h>
-#include <sys/lock.h>
-#include <sys/sf_buf.h>
-#include <vm/vm_extern.h>
-#include <vm/pmap.h>
-#include <vm/vm_map.h>
-#include <vm/vm_map.h>
-#include <vm/vm_param.h>
-#include <vm/vm_pageout.h>
-#include <sys/vmmeter.h>
-#include <vm/vm_page.h>
-#include <vm/vm_object.h>
-#include <vm/vm_kern.h>
-#include <sys/proc.h>
-#endif /* !TI_PRIVATE_JUMBOS */
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#include <sys/tiio.h>
-#include <pci/if_tireg.h>
-#include <pci/ti_fw.h>
-#include <pci/ti_fw2.h>
-
-#define TI_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_IP_FRAGS)
-/*
- * We can only turn on header splitting if we're using extended receive
- * BDs.
- */
-#if defined(TI_JUMBO_HDRSPLIT) && defined(TI_PRIVATE_JUMBOS)
-#error "options TI_JUMBO_HDRSPLIT and TI_PRIVATE_JUMBOS are mutually exclusive"
-#endif /* TI_JUMBO_HDRSPLIT && TI_JUMBO_HDRSPLIT */
-
-struct ti_softc *tis[8];
-
-typedef enum {
- TI_SWAP_HTON,
- TI_SWAP_NTOH
-} ti_swap_type;
-
-
-/*
- * Various supported device vendors/types and their names.
- */
-
-static struct ti_type ti_devs[] = {
- { ALT_VENDORID, ALT_DEVICEID_ACENIC,
- "Alteon AceNIC 1000baseSX Gigabit Ethernet" },
- { ALT_VENDORID, ALT_DEVICEID_ACENIC_COPPER,
- "Alteon AceNIC 1000baseT Gigabit Ethernet" },
- { TC_VENDORID, TC_DEVICEID_3C985,
- "3Com 3c985-SX Gigabit Ethernet" },
- { NG_VENDORID, NG_DEVICEID_GA620,
- "Netgear GA620 1000baseSX Gigabit Ethernet" },
- { NG_VENDORID, NG_DEVICEID_GA620T,
- "Netgear GA620 1000baseT Gigabit Ethernet" },
- { SGI_VENDORID, SGI_DEVICEID_TIGON,
- "Silicon Graphics Gigabit Ethernet" },
- { DEC_VENDORID, DEC_DEVICEID_FARALLON_PN9000SX,
- "Farallon PN9000SX Gigabit Ethernet" },
- { 0, 0, NULL }
-};
-
-
-static d_open_t ti_open;
-static d_close_t ti_close;
-static d_ioctl_t ti_ioctl2;
-
-static struct cdevsw ti_cdevsw = {
- .d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
- .d_open = ti_open,
- .d_close = ti_close,
- .d_ioctl = ti_ioctl2,
- .d_name = "ti",
-};
-
-static int ti_probe(device_t);
-static int ti_attach(device_t);
-static int ti_detach(device_t);
-static void ti_txeof(struct ti_softc *);
-static void ti_rxeof(struct ti_softc *);
-
-static void ti_stats_update(struct ti_softc *);
-static int ti_encap(struct ti_softc *, struct mbuf *, u_int32_t *);
-
-static void ti_intr(void *);
-static void ti_start(struct ifnet *);
-static int ti_ioctl(struct ifnet *, u_long, caddr_t);
-static void ti_init(void *);
-static void ti_init2(struct ti_softc *);
-static void ti_stop(struct ti_softc *);
-static void ti_watchdog(struct ifnet *);
-static void ti_shutdown(device_t);
-static int ti_ifmedia_upd(struct ifnet *);
-static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *);
-
-static u_int32_t ti_eeprom_putbyte(struct ti_softc *, int);
-static u_int8_t ti_eeprom_getbyte(struct ti_softc *, int, u_int8_t *);
-static int ti_read_eeprom(struct ti_softc *, caddr_t, int, int);
-
-static void ti_add_mcast(struct ti_softc *, struct ether_addr *);
-static void ti_del_mcast(struct ti_softc *, struct ether_addr *);
-static void ti_setmulti(struct ti_softc *);
-
-static void ti_mem(struct ti_softc *, u_int32_t, u_int32_t, caddr_t);
-static int ti_copy_mem(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, int, int);
-static int ti_copy_scratch(struct ti_softc *, u_int32_t, u_int32_t, caddr_t,
- int, int, int);
-static int ti_bcopy_swap(const void *, void *, size_t, ti_swap_type);
-static void ti_loadfw(struct ti_softc *);
-static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *);
-static void ti_cmd_ext(struct ti_softc *, struct ti_cmd_desc *, caddr_t, int);
-static void ti_handle_events(struct ti_softc *);
-#ifdef TI_PRIVATE_JUMBOS
-static int ti_alloc_jumbo_mem(struct ti_softc *);
-static void *ti_jalloc(struct ti_softc *);
-static void ti_jfree(void *, void *);
-#endif /* TI_PRIVATE_JUMBOS */
-static int ti_newbuf_std(struct ti_softc *, int, struct mbuf *);
-static int ti_newbuf_mini(struct ti_softc *, int, struct mbuf *);
-static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *);
-static int ti_init_rx_ring_std(struct ti_softc *);
-static void ti_free_rx_ring_std(struct ti_softc *);
-static int ti_init_rx_ring_jumbo(struct ti_softc *);
-static void ti_free_rx_ring_jumbo(struct ti_softc *);
-static int ti_init_rx_ring_mini(struct ti_softc *);
-static void ti_free_rx_ring_mini(struct ti_softc *);
-static void ti_free_tx_ring(struct ti_softc *);
-static int ti_init_tx_ring(struct ti_softc *);
-
-static int ti_64bitslot_war(struct ti_softc *);
-static int ti_chipinit(struct ti_softc *);
-static int ti_gibinit(struct ti_softc *);
-
-#ifdef TI_JUMBO_HDRSPLIT
-static __inline void ti_hdr_split (struct mbuf *top, int hdr_len,
- int pkt_len, int idx);
-#endif /* TI_JUMBO_HDRSPLIT */
-
-static device_method_t ti_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, ti_probe),
- DEVMETHOD(device_attach, ti_attach),
- DEVMETHOD(device_detach, ti_detach),
- DEVMETHOD(device_shutdown, ti_shutdown),
- { 0, 0 }
-};
-
-static driver_t ti_driver = {
- "ti",
- ti_methods,
- sizeof(struct ti_softc)
-};
-
-static devclass_t ti_devclass;
-
-DRIVER_MODULE(ti, pci, ti_driver, ti_devclass, 0, 0);
-MODULE_DEPEND(ti, pci, 1, 1, 1);
-MODULE_DEPEND(ti, ether, 1, 1, 1);
-
-/*
- * Send an instruction or address to the EEPROM, check for ACK.
- */
-static u_int32_t ti_eeprom_putbyte(sc, byte)
- struct ti_softc *sc;
- int byte;
-{
- register int i, ack = 0;
-
- /*
- * Make sure we're in TX mode.
- */
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN);
-
- /*
- * Feed in each bit and stobe the clock.
- */
- for (i = 0x80; i; i >>= 1) {
- if (byte & i) {
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT);
- } else {
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT);
- }
- DELAY(1);
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK);
- DELAY(1);
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK);
- }
-
- /*
- * Turn off TX mode.
- */
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN);
-
- /*
- * Check for ack.
- */
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK);
- ack = CSR_READ_4(sc, TI_MISC_LOCAL_CTL) & TI_MLC_EE_DIN;
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK);
-
- return (ack);
-}
-
-/*
- * Read a byte of data stored in the EEPROM at address 'addr.'
- * We have to send two address bytes since the EEPROM can hold
- * more than 256 bytes of data.
- */
-static u_int8_t ti_eeprom_getbyte(sc, addr, dest)
- struct ti_softc *sc;
- int addr;
- u_int8_t *dest;
-{
- register int i;
- u_int8_t byte = 0;
-
- EEPROM_START;
-
- /*
- * Send write control code to EEPROM.
- */
- if (ti_eeprom_putbyte(sc, EEPROM_CTL_WRITE)) {
- printf("ti%d: failed to send write command, status: %x\n",
- sc->ti_unit, CSR_READ_4(sc, TI_MISC_LOCAL_CTL));
- return (1);
- }
-
- /*
- * Send first byte of address of byte we want to read.
- */
- if (ti_eeprom_putbyte(sc, (addr >> 8) & 0xFF)) {
- printf("ti%d: failed to send address, status: %x\n",
- sc->ti_unit, CSR_READ_4(sc, TI_MISC_LOCAL_CTL));
- return (1);
- }
- /*
- * Send second byte address of byte we want to read.
- */
- if (ti_eeprom_putbyte(sc, addr & 0xFF)) {
- printf("ti%d: failed to send address, status: %x\n",
- sc->ti_unit, CSR_READ_4(sc, TI_MISC_LOCAL_CTL));
- return (1);
- }
-
- EEPROM_STOP;
- EEPROM_START;
- /*
- * Send read control code to EEPROM.
- */
- if (ti_eeprom_putbyte(sc, EEPROM_CTL_READ)) {
- printf("ti%d: failed to send read command, status: %x\n",
- sc->ti_unit, CSR_READ_4(sc, TI_MISC_LOCAL_CTL));
- return (1);
- }
-
- /*
- * Start reading bits from EEPROM.
- */
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN);
- for (i = 0x80; i; i >>= 1) {
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK);
- DELAY(1);
- if (CSR_READ_4(sc, TI_MISC_LOCAL_CTL) & TI_MLC_EE_DIN)
- byte |= i;
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK);
- DELAY(1);
- }
-
- EEPROM_STOP;
-
- /*
- * No ACK generated for read, so just return byte.
- */
-
- *dest = byte;
-
- return (0);
-}
-
-/*
- * Read a sequence of bytes from the EEPROM.
- */
-static int
-ti_read_eeprom(sc, dest, off, cnt)
- struct ti_softc *sc;
- caddr_t dest;
- int off;
- int cnt;
-{
- int err = 0, i;
- u_int8_t byte = 0;
-
- for (i = 0; i < cnt; i++) {
- err = ti_eeprom_getbyte(sc, off + i, &byte);
- if (err)
- break;
- *(dest + i) = byte;
- }
-
- return (err ? 1 : 0);
-}
-
-/*
- * NIC memory access function. Can be used to either clear a section
- * of NIC local memory or (if buf is non-NULL) copy data into it.
- */
-static void
-ti_mem(sc, addr, len, buf)
- struct ti_softc *sc;
- u_int32_t addr, len;
- caddr_t buf;
-{
- int segptr, segsize, cnt;
- caddr_t ti_winbase, ptr;
-
- segptr = addr;
- cnt = len;
- ti_winbase = (caddr_t)(sc->ti_vhandle + TI_WINDOW);
- ptr = buf;
-
- while (cnt) {
- if (cnt < TI_WINLEN)
- segsize = cnt;
- else
- segsize = TI_WINLEN - (segptr % TI_WINLEN);
- CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
- if (buf == NULL)
- bzero((char *)ti_winbase + (segptr &
- (TI_WINLEN - 1)), segsize);
- else {
- bcopy((char *)ptr, (char *)ti_winbase +
- (segptr & (TI_WINLEN - 1)), segsize);
- ptr += segsize;
- }
- segptr += segsize;
- cnt -= segsize;
- }
-}
-
-static int
-ti_copy_mem(sc, tigon_addr, len, buf, useraddr, readdata)
- struct ti_softc *sc;
- u_int32_t tigon_addr, len;
- caddr_t buf;
- int useraddr, readdata;
-{
- int segptr, segsize, cnt;
- caddr_t ptr;
- u_int32_t origwin;
- u_int8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN];
- int resid, segresid;
- int first_pass;
-
- /*
- * At the moment, we don't handle non-aligned cases, we just bail.
- * If this proves to be a problem, it will be fixed.
- */
- if ((readdata == 0)
- && (tigon_addr & 0x3)) {
- printf("ti%d: ti_copy_mem: tigon address %#x isn't "
- "word-aligned\n", sc->ti_unit, tigon_addr);
- printf("ti%d: ti_copy_mem: unaligned writes aren't yet "
- "supported\n", sc->ti_unit);
- return (EINVAL);
- }
-
- segptr = tigon_addr & ~0x3;
- segresid = tigon_addr - segptr;
-
- /*
- * This is the non-aligned amount left over that we'll need to
- * copy.
- */
- resid = len & 0x3;
-
- /* Add in the left over amount at the front of the buffer */
- resid += segresid;
-
- cnt = len & ~0x3;
- /*
- * If resid + segresid is >= 4, add multiples of 4 to the count and
- * decrease the residual by that much.
- */
- cnt += resid & ~0x3;
- resid -= resid & ~0x3;
-
- ptr = buf;
-
- first_pass = 1;
-
- /*
- * Make sure we aren't interrupted while we're changing the window
- * pointer.
- */
- TI_LOCK(sc);
-
- /*
- * Save the old window base value.
- */
- origwin = CSR_READ_4(sc, TI_WINBASE);
-
- while (cnt) {
- bus_size_t ti_offset;
-
- if (cnt < TI_WINLEN)
- segsize = cnt;
- else
- segsize = TI_WINLEN - (segptr % TI_WINLEN);
- CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
-
- ti_offset = TI_WINDOW + (segptr & (TI_WINLEN -1));
-
- if (readdata) {
-
- bus_space_read_region_4(sc->ti_btag,
- sc->ti_bhandle, ti_offset,
- (u_int32_t *)tmparray,
- segsize >> 2);
- if (useraddr) {
- /*
- * Yeah, this is a little on the kludgy
- * side, but at least this code is only
- * used for debugging.
- */
- ti_bcopy_swap(tmparray, tmparray2, segsize,
- TI_SWAP_NTOH);
-
- if (first_pass) {
- copyout(&tmparray2[segresid], ptr,
- segsize - segresid);
- first_pass = 0;
- } else
- copyout(tmparray2, ptr, segsize);
- } else {
- if (first_pass) {
-
- ti_bcopy_swap(tmparray, tmparray2,
- segsize, TI_SWAP_NTOH);
- bcopy(&tmparray2[segresid], ptr,
- segsize - segresid);
- first_pass = 0;
- } else
- ti_bcopy_swap(tmparray, ptr, segsize,
- TI_SWAP_NTOH);
- }
-
- } else {
- if (useraddr) {
- copyin(ptr, tmparray2, segsize);
- ti_bcopy_swap(tmparray2, tmparray, segsize,
- TI_SWAP_HTON);
- } else
- ti_bcopy_swap(ptr, tmparray, segsize,
- TI_SWAP_HTON);
-
- bus_space_write_region_4(sc->ti_btag,
- sc->ti_bhandle, ti_offset,
- (u_int32_t *)tmparray,
- segsize >> 2);
- }
- segptr += segsize;
- ptr += segsize;
- cnt -= segsize;
- }
-
- /*
- * Handle leftover, non-word-aligned bytes.
- */
- if (resid != 0) {
- u_int32_t tmpval, tmpval2;
- bus_size_t ti_offset;
-
- /*
- * Set the segment pointer.
- */
- CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
-
- ti_offset = TI_WINDOW + (segptr & (TI_WINLEN - 1));
-
- /*
- * First, grab whatever is in our source/destination.
- * We'll obviously need this for reads, but also for
- * writes, since we'll be doing read/modify/write.
- */
- bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle,
- ti_offset, &tmpval, 1);
-
- /*
- * Next, translate this from little-endian to big-endian
- * (at least on i386 boxes).
- */
- tmpval2 = ntohl(tmpval);
-
- if (readdata) {
- /*
- * If we're reading, just copy the leftover number
- * of bytes from the host byte order buffer to
- * the user's buffer.
- */
- if (useraddr)
- copyout(&tmpval2, ptr, resid);
- else
- bcopy(&tmpval2, ptr, resid);
- } else {
- /*
- * If we're writing, first copy the bytes to be
- * written into the network byte order buffer,
- * leaving the rest of the buffer with whatever was
- * originally in there. Then, swap the bytes
- * around into host order and write them out.
- *
- * XXX KDM the read side of this has been verified
- * to work, but the write side of it has not been
- * verified. So user beware.
- */
- if (useraddr)
- copyin(ptr, &tmpval2, resid);
- else
- bcopy(ptr, &tmpval2, resid);
-
- tmpval = htonl(tmpval2);
-
- bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle,
- ti_offset, &tmpval, 1);
- }
- }
-
- CSR_WRITE_4(sc, TI_WINBASE, origwin);
-
- TI_UNLOCK(sc);
-
- return (0);
-}
-
-static int
-ti_copy_scratch(sc, tigon_addr, len, buf, useraddr, readdata, cpu)
- struct ti_softc *sc;
- u_int32_t tigon_addr, len;
- caddr_t buf;
- int useraddr, readdata;
- int cpu;
-{
- u_int32_t segptr;
- int cnt;
- u_int32_t tmpval, tmpval2;
- caddr_t ptr;
-
- /*
- * At the moment, we don't handle non-aligned cases, we just bail.
- * If this proves to be a problem, it will be fixed.
- */
- if (tigon_addr & 0x3) {
- printf("ti%d: ti_copy_scratch: tigon address %#x isn't "
- "word-aligned\n", sc->ti_unit, tigon_addr);
- return (EINVAL);
- }
-
- if (len & 0x3) {
- printf("ti%d: ti_copy_scratch: transfer length %d isn't "
- "word-aligned\n", sc->ti_unit, len);
- return (EINVAL);
- }
-
- segptr = tigon_addr;
- cnt = len;
- ptr = buf;
-
- TI_LOCK(sc);
-
- while (cnt) {
- CSR_WRITE_4(sc, CPU_REG(TI_SRAM_ADDR, cpu), segptr);
-
- if (readdata) {
- tmpval2 = CSR_READ_4(sc, CPU_REG(TI_SRAM_DATA, cpu));
-
- tmpval = ntohl(tmpval2);
-
- /*
- * Note: I've used this debugging interface
- * extensively with Alteon's 12.3.15 firmware,
- * compiled with GCC 2.7.2.1 and binutils 2.9.1.
- *
- * When you compile the firmware without
- * optimization, which is necessary sometimes in
- * order to properly step through it, you sometimes
- * read out a bogus value of 0xc0017c instead of
- * whatever was supposed to be in that scratchpad
- * location. That value is on the stack somewhere,
- * but I've never been able to figure out what was
- * causing the problem.
- *
- * The address seems to pop up in random places,
- * often not in the same place on two subsequent
- * reads.
- *
- * In any case, the underlying data doesn't seem
- * to be affected, just the value read out.
- *
- * KDM, 3/7/2000
- */
-
- if (tmpval2 == 0xc0017c)
- printf("ti%d: found 0xc0017c at %#x "
- "(tmpval2)\n", sc->ti_unit, segptr);
-
- if (tmpval == 0xc0017c)
- printf("ti%d: found 0xc0017c at %#x "
- "(tmpval)\n", sc->ti_unit, segptr);
-
- if (useraddr)
- copyout(&tmpval, ptr, 4);
- else
- bcopy(&tmpval, ptr, 4);
- } else {
- if (useraddr)
- copyin(ptr, &tmpval2, 4);
- else
- bcopy(ptr, &tmpval2, 4);
-
- tmpval = htonl(tmpval2);
-
- CSR_WRITE_4(sc, CPU_REG(TI_SRAM_DATA, cpu), tmpval);
- }
-
- cnt -= 4;
- segptr += 4;
- ptr += 4;
- }
-
- TI_UNLOCK(sc);
-
- return (0);
-}
-
-static int
-ti_bcopy_swap(src, dst, len, swap_type)
- const void *src;
- void *dst;
- size_t len;
- ti_swap_type swap_type;
-{
- const u_int8_t *tmpsrc;
- u_int8_t *tmpdst;
- size_t tmplen;
-
- if (len & 0x3) {
- printf("ti_bcopy_swap: length %zd isn't 32-bit aligned\n",
- len);
- return (-1);
- }
-
- tmpsrc = src;
- tmpdst = dst;
- tmplen = len;
-
- while (tmplen) {
- if (swap_type == TI_SWAP_NTOH)
- *(u_int32_t *)tmpdst =
- ntohl(*(const u_int32_t *)tmpsrc);
- else
- *(u_int32_t *)tmpdst =
- htonl(*(const u_int32_t *)tmpsrc);
-
- tmpsrc += 4;
- tmpdst += 4;
- tmplen -= 4;
- }
-
- return (0);
-}
-
-/*
- * Load firmware image into the NIC. Check that the firmware revision
- * is acceptable and see if we want the firmware for the Tigon 1 or
- * Tigon 2.
- */
-static void
-ti_loadfw(sc)
- struct ti_softc *sc;
-{
- switch (sc->ti_hwrev) {
- case TI_HWREV_TIGON:
- if (tigonFwReleaseMajor != TI_FIRMWARE_MAJOR ||
- tigonFwReleaseMinor != TI_FIRMWARE_MINOR ||
- tigonFwReleaseFix != TI_FIRMWARE_FIX) {
- printf("ti%d: firmware revision mismatch; want "
- "%d.%d.%d, got %d.%d.%d\n", sc->ti_unit,
- TI_FIRMWARE_MAJOR, TI_FIRMWARE_MINOR,
- TI_FIRMWARE_FIX, tigonFwReleaseMajor,
- tigonFwReleaseMinor, tigonFwReleaseFix);
- return;
- }
- ti_mem(sc, tigonFwTextAddr, tigonFwTextLen,
- (caddr_t)tigonFwText);
- ti_mem(sc, tigonFwDataAddr, tigonFwDataLen,
- (caddr_t)tigonFwData);
- ti_mem(sc, tigonFwRodataAddr, tigonFwRodataLen,
- (caddr_t)tigonFwRodata);
- ti_mem(sc, tigonFwBssAddr, tigonFwBssLen, NULL);
- ti_mem(sc, tigonFwSbssAddr, tigonFwSbssLen, NULL);
- CSR_WRITE_4(sc, TI_CPU_PROGRAM_COUNTER, tigonFwStartAddr);
- break;
- case TI_HWREV_TIGON_II:
- if (tigon2FwReleaseMajor != TI_FIRMWARE_MAJOR ||
- tigon2FwReleaseMinor != TI_FIRMWARE_MINOR ||
- tigon2FwReleaseFix != TI_FIRMWARE_FIX) {
- printf("ti%d: firmware revision mismatch; want "
- "%d.%d.%d, got %d.%d.%d\n", sc->ti_unit,
- TI_FIRMWARE_MAJOR, TI_FIRMWARE_MINOR,
- TI_FIRMWARE_FIX, tigon2FwReleaseMajor,
- tigon2FwReleaseMinor, tigon2FwReleaseFix);
- return;
- }
- ti_mem(sc, tigon2FwTextAddr, tigon2FwTextLen,
- (caddr_t)tigon2FwText);
- ti_mem(sc, tigon2FwDataAddr, tigon2FwDataLen,
- (caddr_t)tigon2FwData);
- ti_mem(sc, tigon2FwRodataAddr, tigon2FwRodataLen,
- (caddr_t)tigon2FwRodata);
- ti_mem(sc, tigon2FwBssAddr, tigon2FwBssLen, NULL);
- ti_mem(sc, tigon2FwSbssAddr, tigon2FwSbssLen, NULL);
- CSR_WRITE_4(sc, TI_CPU_PROGRAM_COUNTER, tigon2FwStartAddr);
- break;
- default:
- printf("ti%d: can't load firmware: unknown hardware rev\n",
- sc->ti_unit);
- break;
- }
-}
-
-/*
- * Send the NIC a command via the command ring.
- */
-static void
-ti_cmd(sc, cmd)
- struct ti_softc *sc;
- struct ti_cmd_desc *cmd;
-{
- u_int32_t index;
-
- if (sc->ti_rdata->ti_cmd_ring == NULL)
- return;
-
- index = sc->ti_cmd_saved_prodidx;
- CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd));
- TI_INC(index, TI_CMD_RING_CNT);
- CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index);
- sc->ti_cmd_saved_prodidx = index;
-}
-
-/*
- * Send the NIC an extended command. The 'len' parameter specifies the
- * number of command slots to include after the initial command.
- */
-static void
-ti_cmd_ext(sc, cmd, arg, len)
- struct ti_softc *sc;
- struct ti_cmd_desc *cmd;
- caddr_t arg;
- int len;
-{
- u_int32_t index;
- register int i;
-
- if (sc->ti_rdata->ti_cmd_ring == NULL)
- return;
-
- index = sc->ti_cmd_saved_prodidx;
- CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd));
- TI_INC(index, TI_CMD_RING_CNT);
- for (i = 0; i < len; i++) {
- CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4),
- *(u_int32_t *)(&arg[i * 4]));
- TI_INC(index, TI_CMD_RING_CNT);
- }
- CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index);
- sc->ti_cmd_saved_prodidx = index;
-}
-
-/*
- * Handle events that have triggered interrupts.
- */
-static void
-ti_handle_events(sc)
- struct ti_softc *sc;
-{
- struct ti_event_desc *e;
-
- if (sc->ti_rdata->ti_event_ring == NULL)
- return;
-
- while (sc->ti_ev_saved_considx != sc->ti_ev_prodidx.ti_idx) {
- e = &sc->ti_rdata->ti_event_ring[sc->ti_ev_saved_considx];
- switch (e->ti_event) {
- case TI_EV_LINKSTAT_CHANGED:
- sc->ti_linkstat = e->ti_code;
- if (e->ti_code == TI_EV_CODE_LINK_UP)
- printf("ti%d: 10/100 link up\n", sc->ti_unit);
- else if (e->ti_code == TI_EV_CODE_GIG_LINK_UP)
- printf("ti%d: gigabit link up\n", sc->ti_unit);
- else if (e->ti_code == TI_EV_CODE_LINK_DOWN)
- printf("ti%d: link down\n", sc->ti_unit);
- break;
- case TI_EV_ERROR:
- if (e->ti_code == TI_EV_CODE_ERR_INVAL_CMD)
- printf("ti%d: invalid command\n", sc->ti_unit);
- else if (e->ti_code == TI_EV_CODE_ERR_UNIMP_CMD)
- printf("ti%d: unknown command\n", sc->ti_unit);
- else if (e->ti_code == TI_EV_CODE_ERR_BADCFG)
- printf("ti%d: bad config data\n", sc->ti_unit);
- break;
- case TI_EV_FIRMWARE_UP:
- ti_init2(sc);
- break;
- case TI_EV_STATS_UPDATED:
- ti_stats_update(sc);
- break;
- case TI_EV_RESET_JUMBO_RING:
- case TI_EV_MCAST_UPDATED:
- /* Who cares. */
- break;
- default:
- printf("ti%d: unknown event: %d\n",
- sc->ti_unit, e->ti_event);
- break;
- }
- /* Advance the consumer index. */
- TI_INC(sc->ti_ev_saved_considx, TI_EVENT_RING_CNT);
- CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, sc->ti_ev_saved_considx);
- }
-}
-
-#ifdef TI_PRIVATE_JUMBOS
-
-/*
- * Memory management for the jumbo receive ring is a pain in the
- * butt. We need to allocate at least 9018 bytes of space per frame,
- * _and_ it has to be contiguous (unless you use the extended
- * jumbo descriptor format). Using malloc() all the time won't
- * work: malloc() allocates memory in powers of two, which means we
- * would end up wasting a considerable amount of space by allocating
- * 9K chunks. We don't have a jumbo mbuf cluster pool. Thus, we have
- * to do our own memory management.
- *
- * The driver needs to allocate a contiguous chunk of memory at boot
- * time. We then chop this up ourselves into 9K pieces and use them
- * as external mbuf storage.
- *
- * One issue here is how much memory to allocate. The jumbo ring has
- * 256 slots in it, but at 9K per slot than can consume over 2MB of
- * RAM. This is a bit much, especially considering we also need
- * RAM for the standard ring and mini ring (on the Tigon 2). To
- * save space, we only actually allocate enough memory for 64 slots
- * by default, which works out to between 500 and 600K. This can
- * be tuned by changing a #define in if_tireg.h.
- */
-
-static int
-ti_alloc_jumbo_mem(sc)
- struct ti_softc *sc;
-{
- caddr_t ptr;
- register int i;
- struct ti_jpool_entry *entry;
-
- /* Grab a big chunk o' storage. */
- sc->ti_cdata.ti_jumbo_buf = contigmalloc(TI_JMEM, M_DEVBUF,
- M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0);
-
- if (sc->ti_cdata.ti_jumbo_buf == NULL) {
- printf("ti%d: no memory for jumbo buffers!\n", sc->ti_unit);
- return (ENOBUFS);
- }
-
- SLIST_INIT(&sc->ti_jfree_listhead);
- SLIST_INIT(&sc->ti_jinuse_listhead);
-
- /*
- * Now divide it up into 9K pieces and save the addresses
- * in an array.
- */
- ptr = sc->ti_cdata.ti_jumbo_buf;
- for (i = 0; i < TI_JSLOTS; i++) {
- sc->ti_cdata.ti_jslots[i] = ptr;
- ptr += TI_JLEN;
- entry = malloc(sizeof(struct ti_jpool_entry),
- M_DEVBUF, M_NOWAIT);
- if (entry == NULL) {
- contigfree(sc->ti_cdata.ti_jumbo_buf, TI_JMEM,
- M_DEVBUF);
- sc->ti_cdata.ti_jumbo_buf = NULL;
- printf("ti%d: no memory for jumbo "
- "buffer queue!\n", sc->ti_unit);
- return (ENOBUFS);
- }
- entry->slot = i;
- SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries);
- }
-
- return (0);
-}
-
-/*
- * Allocate a jumbo buffer.
- */
-static void *ti_jalloc(sc)
- struct ti_softc *sc;
-{
- struct ti_jpool_entry *entry;
-
- entry = SLIST_FIRST(&sc->ti_jfree_listhead);
-
- if (entry == NULL) {
- printf("ti%d: no free jumbo buffers\n", sc->ti_unit);
- return (NULL);
- }
-
- SLIST_REMOVE_HEAD(&sc->ti_jfree_listhead, jpool_entries);
- SLIST_INSERT_HEAD(&sc->ti_jinuse_listhead, entry, jpool_entries);
- return (sc->ti_cdata.ti_jslots[entry->slot]);
-}
-
-/*
- * Release a jumbo buffer.
- */
-static void
-ti_jfree(buf, args)
- void *buf;
- void *args;
-{
- struct ti_softc *sc;
- int i;
- struct ti_jpool_entry *entry;
-
- /* Extract the softc struct pointer. */
- sc = (struct ti_softc *)args;
-
- if (sc == NULL)
- panic("ti_jfree: didn't get softc pointer!");
-
- /* calculate the slot this buffer belongs to */
- i = ((vm_offset_t)buf
- - (vm_offset_t)sc->ti_cdata.ti_jumbo_buf) / TI_JLEN;
-
- if ((i < 0) || (i >= TI_JSLOTS))
- panic("ti_jfree: asked to free buffer that we don't manage!");
-
- entry = SLIST_FIRST(&sc->ti_jinuse_listhead);
- if (entry == NULL)
- panic("ti_jfree: buffer not in use!");
- entry->slot = i;
- SLIST_REMOVE_HEAD(&sc->ti_jinuse_listhead, jpool_entries);
- SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries);
-}
-
-#endif /* TI_PRIVATE_JUMBOS */
-
-/*
- * Intialize a standard receive ring descriptor.
- */
-static int
-ti_newbuf_std(sc, i, m)
- struct ti_softc *sc;
- int i;
- struct mbuf *m;
-{
- struct mbuf *m_new = NULL;
- struct ti_rx_desc *r;
-
- if (m == NULL) {
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL)
- return (ENOBUFS);
-
- MCLGET(m_new, M_DONTWAIT);
- if (!(m_new->m_flags & M_EXT)) {
- m_freem(m_new);
- return (ENOBUFS);
- }
- m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
- } else {
- m_new = m;
- m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
- m_new->m_data = m_new->m_ext.ext_buf;
- }
-
- m_adj(m_new, ETHER_ALIGN);
- sc->ti_cdata.ti_rx_std_chain[i] = m_new;
- r = &sc->ti_rdata->ti_rx_std_ring[i];
- TI_HOSTADDR(r->ti_addr) = vtophys(mtod(m_new, caddr_t));
- r->ti_type = TI_BDTYPE_RECV_BD;
- r->ti_flags = 0;
- if (sc->ti_ifp->if_hwassist)
- r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM;
- r->ti_len = m_new->m_len;
- r->ti_idx = i;
-
- return (0);
-}
-
-/*
- * Intialize a mini receive ring descriptor. This only applies to
- * the Tigon 2.
- */
-static int
-ti_newbuf_mini(sc, i, m)
- struct ti_softc *sc;
- int i;
- struct mbuf *m;
-{
- struct mbuf *m_new = NULL;
- struct ti_rx_desc *r;
-
- if (m == NULL) {
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL) {
- return (ENOBUFS);
- }
- m_new->m_len = m_new->m_pkthdr.len = MHLEN;
- } else {
- m_new = m;
- m_new->m_data = m_new->m_pktdat;
- m_new->m_len = m_new->m_pkthdr.len = MHLEN;
- }
-
- m_adj(m_new, ETHER_ALIGN);
- r = &sc->ti_rdata->ti_rx_mini_ring[i];
- sc->ti_cdata.ti_rx_mini_chain[i] = m_new;
- TI_HOSTADDR(r->ti_addr) = vtophys(mtod(m_new, caddr_t));
- r->ti_type = TI_BDTYPE_RECV_BD;
- r->ti_flags = TI_BDFLAG_MINI_RING;
- if (sc->ti_ifp->if_hwassist)
- r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM;
- r->ti_len = m_new->m_len;
- r->ti_idx = i;
-
- return (0);
-}
-
-#ifdef TI_PRIVATE_JUMBOS
-
-/*
- * Initialize a jumbo receive ring descriptor. This allocates
- * a jumbo buffer from the pool managed internally by the driver.
- */
-static int
-ti_newbuf_jumbo(sc, i, m)
- struct ti_softc *sc;
- int i;
- struct mbuf *m;
-{
- struct mbuf *m_new = NULL;
- struct ti_rx_desc *r;
-
- if (m == NULL) {
- caddr_t *buf = NULL;
-
- /* Allocate the mbuf. */
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL) {
- return (ENOBUFS);
- }
-
- /* Allocate the jumbo buffer */
- buf = ti_jalloc(sc);
- if (buf == NULL) {
- m_freem(m_new);
- printf("ti%d: jumbo allocation failed "
- "-- packet dropped!\n", sc->ti_unit);
- return (ENOBUFS);
- }
-
- /* Attach the buffer to the mbuf. */
- m_new->m_data = (void *) buf;
- m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN;
- MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree,
- (struct ti_softc *)sc, 0, EXT_NET_DRV);
- } else {
- m_new = m;
- m_new->m_data = m_new->m_ext.ext_buf;
- m_new->m_ext.ext_size = TI_JUMBO_FRAMELEN;
- }
-
- m_adj(m_new, ETHER_ALIGN);
- /* Set up the descriptor. */
- r = &sc->ti_rdata->ti_rx_jumbo_ring[i];
- sc->ti_cdata.ti_rx_jumbo_chain[i] = m_new;
- TI_HOSTADDR(r->ti_addr) = vtophys(mtod(m_new, caddr_t));
- r->ti_type = TI_BDTYPE_RECV_JUMBO_BD;
- r->ti_flags = TI_BDFLAG_JUMBO_RING;
- if (sc->ti_ifp->if_hwassist)
- r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM;
- r->ti_len = m_new->m_len;
- r->ti_idx = i;
-
- return (0);
-}
-
-#else
-#include <vm/vm_page.h>
-
-#if (PAGE_SIZE == 4096)
-#define NPAYLOAD 2
-#else
-#define NPAYLOAD 1
-#endif
-
-#define TCP_HDR_LEN (52 + sizeof(struct ether_header))
-#define UDP_HDR_LEN (28 + sizeof(struct ether_header))
-#define NFS_HDR_LEN (UDP_HDR_LEN)
-static int HDR_LEN = TCP_HDR_LEN;
-
-
-/*
- * Initialize a jumbo receive ring descriptor. This allocates
- * a jumbo buffer from the pool managed internally by the driver.
- */
-static int
-ti_newbuf_jumbo(sc, idx, m_old)
- struct ti_softc *sc;
- int idx;
- struct mbuf *m_old;
-{
- struct mbuf *cur, *m_new = NULL;
- struct mbuf *m[3] = {NULL, NULL, NULL};
- struct ti_rx_desc_ext *r;
- vm_page_t frame;
- static int color;
- /* 1 extra buf to make nobufs easy*/
- struct sf_buf *sf[3] = {NULL, NULL, NULL};
- int i;
-
- if (m_old != NULL) {
- m_new = m_old;
- cur = m_old->m_next;
- for (i = 0; i <= NPAYLOAD; i++){
- m[i] = cur;
- cur = cur->m_next;
- }
- } else {
- /* Allocate the mbufs. */
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL) {
- printf("ti%d: mbuf allocation failed "
- "-- packet dropped!\n", sc->ti_unit);
- goto nobufs;
- }
- MGET(m[NPAYLOAD], M_DONTWAIT, MT_DATA);
- if (m[NPAYLOAD] == NULL) {
- printf("ti%d: cluster mbuf allocation failed "
- "-- packet dropped!\n", sc->ti_unit);
- goto nobufs;
- }
- MCLGET(m[NPAYLOAD], M_DONTWAIT);
- if ((m[NPAYLOAD]->m_flags & M_EXT) == 0) {
- printf("ti%d: mbuf allocation failed "
- "-- packet dropped!\n", sc->ti_unit);
- goto nobufs;
- }
- m[NPAYLOAD]->m_len = MCLBYTES;
-
- for (i = 0; i < NPAYLOAD; i++){
- MGET(m[i], M_DONTWAIT, MT_DATA);
- if (m[i] == NULL) {
- printf("ti%d: mbuf allocation failed "
- "-- packet dropped!\n", sc->ti_unit);
- goto nobufs;
- }
- frame = vm_page_alloc(NULL, color++,
- VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ |
- VM_ALLOC_WIRED);
- if (frame == NULL) {
- printf("ti%d: buffer allocation failed "
- "-- packet dropped!\n", sc->ti_unit);
- printf(" index %d page %d\n", idx, i);
- goto nobufs;
- }
- sf[i] = sf_buf_alloc(frame, SFB_NOWAIT);
- if (sf[i] == NULL) {
- vm_page_lock_queues();
- vm_page_unwire(frame, 0);
- vm_page_free(frame);
- vm_page_unlock_queues();
- printf("ti%d: buffer allocation failed "
- "-- packet dropped!\n", sc->ti_unit);
- printf(" index %d page %d\n", idx, i);
- goto nobufs;
- }
- }
- for (i = 0; i < NPAYLOAD; i++){
- /* Attach the buffer to the mbuf. */
- m[i]->m_data = (void *)sf_buf_kva(sf[i]);
- m[i]->m_len = PAGE_SIZE;
- MEXTADD(m[i], sf_buf_kva(sf[i]), PAGE_SIZE,
- sf_buf_mext, sf[i], 0, EXT_DISPOSABLE);
- m[i]->m_next = m[i+1];
- }
- /* link the buffers to the header */
- m_new->m_next = m[0];
- m_new->m_data += ETHER_ALIGN;
- if (sc->ti_hdrsplit)
- m_new->m_len = MHLEN - ETHER_ALIGN;
- else
- m_new->m_len = HDR_LEN;
- m_new->m_pkthdr.len = NPAYLOAD * PAGE_SIZE + m_new->m_len;
- }
-
- /* Set up the descriptor. */
- r = &sc->ti_rdata->ti_rx_jumbo_ring[idx];
- sc->ti_cdata.ti_rx_jumbo_chain[idx] = m_new;
- TI_HOSTADDR(r->ti_addr0) = vtophys(mtod(m_new, caddr_t));
- r->ti_len0 = m_new->m_len;
-
- TI_HOSTADDR(r->ti_addr1) = vtophys(mtod(m[0], caddr_t));
- r->ti_len1 = PAGE_SIZE;
-
- TI_HOSTADDR(r->ti_addr2) = vtophys(mtod(m[1], caddr_t));
- r->ti_len2 = m[1]->m_ext.ext_size; /* could be PAGE_SIZE or MCLBYTES */
-
- if (PAGE_SIZE == 4096) {
- TI_HOSTADDR(r->ti_addr3) = vtophys(mtod(m[2], caddr_t));
- r->ti_len3 = MCLBYTES;
- } else {
- r->ti_len3 = 0;
- }
- r->ti_type = TI_BDTYPE_RECV_JUMBO_BD;
-
- r->ti_flags = TI_BDFLAG_JUMBO_RING|TI_RCB_FLAG_USE_EXT_RX_BD;
-
- if (sc->ti_ifp->if_hwassist)
- r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM|TI_BDFLAG_IP_CKSUM;
-
- r->ti_idx = idx;
-
- return (0);
-
-nobufs:
-
- /*
- * Warning! :
- * This can only be called before the mbufs are strung together.
- * If the mbufs are strung together, m_freem() will free the chain,
- * so that the later mbufs will be freed multiple times.
- */
- if (m_new)
- m_freem(m_new);
-
- for (i = 0; i < 3; i++) {
- if (m[i])
- m_freem(m[i]);
- if (sf[i])
- sf_buf_mext((void *)sf_buf_kva(sf[i]), sf[i]);
- }
- return (ENOBUFS);
-}
-#endif
-
-
-
-/*
- * The standard receive ring has 512 entries in it. At 2K per mbuf cluster,
- * that's 1MB or memory, which is a lot. For now, we fill only the first
- * 256 ring entries and hope that our CPU is fast enough to keep up with
- * the NIC.
- */
-static int
-ti_init_rx_ring_std(sc)
- struct ti_softc *sc;
-{
- register int i;
- struct ti_cmd_desc cmd;
-
- for (i = 0; i < TI_SSLOTS; i++) {
- if (ti_newbuf_std(sc, i, NULL) == ENOBUFS)
- return (ENOBUFS);
- };
-
- TI_UPDATE_STDPROD(sc, i - 1);
- sc->ti_std = i - 1;
-
- return (0);
-}
-
-static void
-ti_free_rx_ring_std(sc)
- struct ti_softc *sc;
-{
- register int i;
-
- for (i = 0; i < TI_STD_RX_RING_CNT; i++) {
- if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) {
- m_freem(sc->ti_cdata.ti_rx_std_chain[i]);
- sc->ti_cdata.ti_rx_std_chain[i] = NULL;
- }
- bzero((char *)&sc->ti_rdata->ti_rx_std_ring[i],
- sizeof(struct ti_rx_desc));
- }
-}
-
-static int
-ti_init_rx_ring_jumbo(sc)
- struct ti_softc *sc;
-{
- register int i;
- struct ti_cmd_desc cmd;
-
- for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) {
- if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS)
- return (ENOBUFS);
- };
-
- TI_UPDATE_JUMBOPROD(sc, i - 1);
- sc->ti_jumbo = i - 1;
-
- return (0);
-}
-
-static void
-ti_free_rx_ring_jumbo(sc)
- struct ti_softc *sc;
-{
- register int i;
-
- for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) {
- if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) {
- m_freem(sc->ti_cdata.ti_rx_jumbo_chain[i]);
- sc->ti_cdata.ti_rx_jumbo_chain[i] = NULL;
- }
- bzero((char *)&sc->ti_rdata->ti_rx_jumbo_ring[i],
- sizeof(struct ti_rx_desc));
- }
-}
-
-static int
-ti_init_rx_ring_mini(sc)
- struct ti_softc *sc;
-{
- register int i;
-
- for (i = 0; i < TI_MSLOTS; i++) {
- if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS)
- return (ENOBUFS);
- };
-
- TI_UPDATE_MINIPROD(sc, i - 1);
- sc->ti_mini = i - 1;
-
- return (0);
-}
-
-static void
-ti_free_rx_ring_mini(sc)
- struct ti_softc *sc;
-{
- register int i;
-
- for (i = 0; i < TI_MINI_RX_RING_CNT; i++) {
- if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) {
- m_freem(sc->ti_cdata.ti_rx_mini_chain[i]);
- sc->ti_cdata.ti_rx_mini_chain[i] = NULL;
- }
- bzero((char *)&sc->ti_rdata->ti_rx_mini_ring[i],
- sizeof(struct ti_rx_desc));
- }
-}
-
-static void
-ti_free_tx_ring(sc)
- struct ti_softc *sc;
-{
- register int i;
-
- if (sc->ti_rdata->ti_tx_ring == NULL)
- return;
-
- for (i = 0; i < TI_TX_RING_CNT; i++) {
- if (sc->ti_cdata.ti_tx_chain[i] != NULL) {
- m_freem(sc->ti_cdata.ti_tx_chain[i]);
- sc->ti_cdata.ti_tx_chain[i] = NULL;
- }
- bzero((char *)&sc->ti_rdata->ti_tx_ring[i],
- sizeof(struct ti_tx_desc));
- }
-}
-
-static int
-ti_init_tx_ring(sc)
- struct ti_softc *sc;
-{
- sc->ti_txcnt = 0;
- sc->ti_tx_saved_considx = 0;
- CSR_WRITE_4(sc, TI_MB_SENDPROD_IDX, 0);
- return (0);
-}
-
-/*
- * The Tigon 2 firmware has a new way to add/delete multicast addresses,
- * but we have to support the old way too so that Tigon 1 cards will
- * work.
- */
-static void
-ti_add_mcast(sc, addr)
- struct ti_softc *sc;
- struct ether_addr *addr;
-{
- struct ti_cmd_desc cmd;
- u_int16_t *m;
- u_int32_t ext[2] = {0, 0};
-
- m = (u_int16_t *)&addr->octet[0];
-
- switch (sc->ti_hwrev) {
- case TI_HWREV_TIGON:
- CSR_WRITE_4(sc, TI_GCR_MAR0, htons(m[0]));
- CSR_WRITE_4(sc, TI_GCR_MAR1, (htons(m[1]) << 16) | htons(m[2]));
- TI_DO_CMD(TI_CMD_ADD_MCAST_ADDR, 0, 0);
- break;
- case TI_HWREV_TIGON_II:
- ext[0] = htons(m[0]);
- ext[1] = (htons(m[1]) << 16) | htons(m[2]);
- TI_DO_CMD_EXT(TI_CMD_EXT_ADD_MCAST, 0, 0, (caddr_t)&ext, 2);
- break;
- default:
- printf("ti%d: unknown hwrev\n", sc->ti_unit);
- break;
- }
-}
-
-static void
-ti_del_mcast(sc, addr)
- struct ti_softc *sc;
- struct ether_addr *addr;
-{
- struct ti_cmd_desc cmd;
- u_int16_t *m;
- u_int32_t ext[2] = {0, 0};
-
- m = (u_int16_t *)&addr->octet[0];
-
- switch (sc->ti_hwrev) {
- case TI_HWREV_TIGON:
- CSR_WRITE_4(sc, TI_GCR_MAR0, htons(m[0]));
- CSR_WRITE_4(sc, TI_GCR_MAR1, (htons(m[1]) << 16) | htons(m[2]));
- TI_DO_CMD(TI_CMD_DEL_MCAST_ADDR, 0, 0);
- break;
- case TI_HWREV_TIGON_II:
- ext[0] = htons(m[0]);
- ext[1] = (htons(m[1]) << 16) | htons(m[2]);
- TI_DO_CMD_EXT(TI_CMD_EXT_DEL_MCAST, 0, 0, (caddr_t)&ext, 2);
- break;
- default:
- printf("ti%d: unknown hwrev\n", sc->ti_unit);
- break;
- }
-}
-
-/*
- * Configure the Tigon's multicast address filter.
- *
- * The actual multicast table management is a bit of a pain, thanks to
- * slight brain damage on the part of both Alteon and us. With our
- * multicast code, we are only alerted when the multicast address table
- * changes and at that point we only have the current list of addresses:
- * we only know the current state, not the previous state, so we don't
- * actually know what addresses were removed or added. The firmware has
- * state, but we can't get our grubby mits on it, and there is no 'delete
- * all multicast addresses' command. Hence, we have to maintain our own
- * state so we know what addresses have been programmed into the NIC at
- * any given time.
- */
-static void
-ti_setmulti(sc)
- struct ti_softc *sc;
-{
- struct ifnet *ifp;
- struct ifmultiaddr *ifma;
- struct ti_cmd_desc cmd;
- struct ti_mc_entry *mc;
- u_int32_t intrs;
-
- ifp = sc->ti_ifp;
-
- if (ifp->if_flags & IFF_ALLMULTI) {
- TI_DO_CMD(TI_CMD_SET_ALLMULTI, TI_CMD_CODE_ALLMULTI_ENB, 0);
- return;
- } else {
- TI_DO_CMD(TI_CMD_SET_ALLMULTI, TI_CMD_CODE_ALLMULTI_DIS, 0);
- }
-
- /* Disable interrupts. */
- intrs = CSR_READ_4(sc, TI_MB_HOSTINTR);
- CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1);
-
- /* First, zot all the existing filters. */
- while (SLIST_FIRST(&sc->ti_mc_listhead) != NULL) {
- mc = SLIST_FIRST(&sc->ti_mc_listhead);
- ti_del_mcast(sc, &mc->mc_addr);
- SLIST_REMOVE_HEAD(&sc->ti_mc_listhead, mc_entries);
- free(mc, M_DEVBUF);
- }
-
- /* Now program new ones. */
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT);
- if (mc == NULL) {
- if_printf(ifp, "no memory for mcast filter entry\n");
- continue;
- }
- bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
- (char *)&mc->mc_addr, ETHER_ADDR_LEN);
- SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries);
- ti_add_mcast(sc, &mc->mc_addr);
- }
-
- /* Re-enable interrupts. */
- CSR_WRITE_4(sc, TI_MB_HOSTINTR, intrs);
-}
-
-/*
- * Check to see if the BIOS has configured us for a 64 bit slot when
- * we aren't actually in one. If we detect this condition, we can work
- * around it on the Tigon 2 by setting a bit in the PCI state register,
- * but for the Tigon 1 we must give up and abort the interface attach.
- */
-static int ti_64bitslot_war(sc)
- struct ti_softc *sc;
-{
- if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) {
- CSR_WRITE_4(sc, 0x600, 0);
- CSR_WRITE_4(sc, 0x604, 0);
- CSR_WRITE_4(sc, 0x600, 0x5555AAAA);
- if (CSR_READ_4(sc, 0x604) == 0x5555AAAA) {
- if (sc->ti_hwrev == TI_HWREV_TIGON)
- return (EINVAL);
- else {
- TI_SETBIT(sc, TI_PCI_STATE,
- TI_PCISTATE_32BIT_BUS);
- return (0);
- }
- }
- }
-
- return (0);
-}
-
-/*
- * Do endian, PCI and DMA initialization. Also check the on-board ROM
- * self-test results.
- */
-static int
-ti_chipinit(sc)
- struct ti_softc *sc;
-{
- u_int32_t cacheline;
- u_int32_t pci_writemax = 0;
- u_int32_t hdrsplit;
-
- /* Initialize link to down state. */
- sc->ti_linkstat = TI_EV_CODE_LINK_DOWN;
-
- if (sc->ti_ifp->if_capenable & IFCAP_HWCSUM)
- sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES;
- else
- sc->ti_ifp->if_hwassist = 0;
-
- /* Set endianness before we access any non-PCI registers. */
-#if BYTE_ORDER == BIG_ENDIAN
- CSR_WRITE_4(sc, TI_MISC_HOST_CTL,
- TI_MHC_BIGENDIAN_INIT | (TI_MHC_BIGENDIAN_INIT << 24));
-#else
- CSR_WRITE_4(sc, TI_MISC_HOST_CTL,
- TI_MHC_LITTLEENDIAN_INIT | (TI_MHC_LITTLEENDIAN_INIT << 24));
-#endif
-
- /* Check the ROM failed bit to see if self-tests passed. */
- if (CSR_READ_4(sc, TI_CPU_STATE) & TI_CPUSTATE_ROMFAIL) {
- printf("ti%d: board self-diagnostics failed!\n", sc->ti_unit);
- return (ENODEV);
- }
-
- /* Halt the CPU. */
- TI_SETBIT(sc, TI_CPU_STATE, TI_CPUSTATE_HALT);
-
- /* Figure out the hardware revision. */
- switch (CSR_READ_4(sc, TI_MISC_HOST_CTL) & TI_MHC_CHIP_REV_MASK) {
- case TI_REV_TIGON_I:
- sc->ti_hwrev = TI_HWREV_TIGON;
- break;
- case TI_REV_TIGON_II:
- sc->ti_hwrev = TI_HWREV_TIGON_II;
- break;
- default:
- printf("ti%d: unsupported chip revision\n", sc->ti_unit);
- return (ENODEV);
- }
-
- /* Do special setup for Tigon 2. */
- if (sc->ti_hwrev == TI_HWREV_TIGON_II) {
- TI_SETBIT(sc, TI_CPU_CTL_B, TI_CPUSTATE_HALT);
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_SRAM_BANK_512K);
- TI_SETBIT(sc, TI_MISC_CONF, TI_MCR_SRAM_SYNCHRONOUS);
- }
-
- /*
- * We don't have firmware source for the Tigon 1, so Tigon 1 boards
- * can't do header splitting.
- */
-#ifdef TI_JUMBO_HDRSPLIT
- if (sc->ti_hwrev != TI_HWREV_TIGON)
- sc->ti_hdrsplit = 1;
- else
- printf("ti%d: can't do header splitting on a Tigon I board\n",
- sc->ti_unit);
-#endif /* TI_JUMBO_HDRSPLIT */
-
- /* Set up the PCI state register. */
- CSR_WRITE_4(sc, TI_PCI_STATE, TI_PCI_READ_CMD|TI_PCI_WRITE_CMD);
- if (sc->ti_hwrev == TI_HWREV_TIGON_II) {
- TI_SETBIT(sc, TI_PCI_STATE, TI_PCISTATE_USE_MEM_RD_MULT);
- }
-
- /* Clear the read/write max DMA parameters. */
- TI_CLRBIT(sc, TI_PCI_STATE, (TI_PCISTATE_WRITE_MAXDMA|
- TI_PCISTATE_READ_MAXDMA));
-
- /* Get cache line size. */
- cacheline = CSR_READ_4(sc, TI_PCI_BIST) & 0xFF;
-
- /*
- * If the system has set enabled the PCI memory write
- * and invalidate command in the command register, set
- * the write max parameter accordingly. This is necessary
- * to use MWI with the Tigon 2.
- */
- if (CSR_READ_4(sc, TI_PCI_CMDSTAT) & PCIM_CMD_MWIEN) {
- switch (cacheline) {
- case 1:
- case 4:
- case 8:
- case 16:
- case 32:
- case 64:
- break;
- default:
- /* Disable PCI memory write and invalidate. */
- if (bootverbose)
- printf("ti%d: cache line size %d not "
- "supported; disabling PCI MWI\n",
- sc->ti_unit, cacheline);
- CSR_WRITE_4(sc, TI_PCI_CMDSTAT, CSR_READ_4(sc,
- TI_PCI_CMDSTAT) & ~PCIM_CMD_MWIEN);
- break;
- }
- }
-
-#ifdef __brokenalpha__
- /*
- * From the Alteon sample driver:
- * Must insure that we do not cross an 8K (bytes) boundary
- * for DMA reads. Our highest limit is 1K bytes. This is a
- * restriction on some ALPHA platforms with early revision
- * 21174 PCI chipsets, such as the AlphaPC 164lx
- */
- TI_SETBIT(sc, TI_PCI_STATE, pci_writemax|TI_PCI_READMAX_1024);
-#else
- TI_SETBIT(sc, TI_PCI_STATE, pci_writemax);
-#endif
-
- /* This sets the min dma param all the way up (0xff). */
- TI_SETBIT(sc, TI_PCI_STATE, TI_PCISTATE_MINDMA);
-
- if (sc->ti_hdrsplit)
- hdrsplit = TI_OPMODE_JUMBO_HDRSPLIT;
- else
- hdrsplit = 0;
-
- /* Configure DMA variables. */
-#if BYTE_ORDER == BIG_ENDIAN
- CSR_WRITE_4(sc, TI_GCR_OPMODE, TI_OPMODE_BYTESWAP_BD |
- TI_OPMODE_BYTESWAP_DATA | TI_OPMODE_WORDSWAP_BD |
- TI_OPMODE_WARN_ENB | TI_OPMODE_FATAL_ENB |
- TI_OPMODE_DONT_FRAG_JUMBO | hdrsplit);
-#else /* BYTE_ORDER */
- CSR_WRITE_4(sc, TI_GCR_OPMODE, TI_OPMODE_BYTESWAP_DATA|
- TI_OPMODE_WORDSWAP_BD|TI_OPMODE_DONT_FRAG_JUMBO|
- TI_OPMODE_WARN_ENB|TI_OPMODE_FATAL_ENB | hdrsplit);
-#endif /* BYTE_ORDER */
-
- /*
- * Only allow 1 DMA channel to be active at a time.
- * I don't think this is a good idea, but without it
- * the firmware racks up lots of nicDmaReadRingFull
- * errors. This is not compatible with hardware checksums.
- */
- if (sc->ti_ifp->if_hwassist == 0)
- TI_SETBIT(sc, TI_GCR_OPMODE, TI_OPMODE_1_DMA_ACTIVE);
-
- /* Recommended settings from Tigon manual. */
- CSR_WRITE_4(sc, TI_GCR_DMA_WRITECFG, TI_DMA_STATE_THRESH_8W);
- CSR_WRITE_4(sc, TI_GCR_DMA_READCFG, TI_DMA_STATE_THRESH_8W);
-
- if (ti_64bitslot_war(sc)) {
- printf("ti%d: bios thinks we're in a 64 bit slot, "
- "but we aren't", sc->ti_unit);
- return (EINVAL);
- }
-
- return (0);
-}
-
-#define TI_RD_OFF(x) offsetof(struct ti_ring_data, x)
-
-/*
- * Initialize the general information block and firmware, and
- * start the CPU(s) running.
- */
-static int
-ti_gibinit(sc)
- struct ti_softc *sc;
-{
- struct ti_rcb *rcb;
- int i;
- struct ifnet *ifp;
- uint32_t rdphys;
-
- ifp = sc->ti_ifp;
- rdphys = sc->ti_rdata_phys;
-
- /* Disable interrupts for now. */
- CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1);
-
- /*
- * Tell the chip where to find the general information block.
- * While this struct could go into >4GB memory, we allocate it in a
- * single slab with the other descriptors, and those don't seem to
- * support being located in a 64-bit region.
- */
- CSR_WRITE_4(sc, TI_GCR_GENINFO_HI, 0);
- CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, rdphys + TI_RD_OFF(ti_info));
-
- /* Load the firmware into SRAM. */
- ti_loadfw(sc);
-
- /* Set up the contents of the general info and ring control blocks. */
-
- /* Set up the event ring and producer pointer. */
- rcb = &sc->ti_rdata->ti_info.ti_ev_rcb;
-
- TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_event_ring);
- rcb->ti_flags = 0;
- TI_HOSTADDR(sc->ti_rdata->ti_info.ti_ev_prodidx_ptr) =
- rdphys + TI_RD_OFF(ti_ev_prodidx_r);
- sc->ti_ev_prodidx.ti_idx = 0;
- CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, 0);
- sc->ti_ev_saved_considx = 0;
-
- /* Set up the command ring and producer mailbox. */
- rcb = &sc->ti_rdata->ti_info.ti_cmd_rcb;
-
- sc->ti_rdata->ti_cmd_ring =
- (struct ti_cmd_desc *)(sc->ti_vhandle + TI_GCR_CMDRING);
- TI_HOSTADDR(rcb->ti_hostaddr) = TI_GCR_NIC_ADDR(TI_GCR_CMDRING);
- rcb->ti_flags = 0;
- rcb->ti_max_len = 0;
- for (i = 0; i < TI_CMD_RING_CNT; i++) {
- CSR_WRITE_4(sc, TI_GCR_CMDRING + (i * 4), 0);
- }
- CSR_WRITE_4(sc, TI_GCR_CMDCONS_IDX, 0);
- CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, 0);
- sc->ti_cmd_saved_prodidx = 0;
-
- /*
- * Assign the address of the stats refresh buffer.
- * We re-use the current stats buffer for this to
- * conserve memory.
- */
- TI_HOSTADDR(sc->ti_rdata->ti_info.ti_refresh_stats_ptr) =
- rdphys + TI_RD_OFF(ti_info.ti_stats);
-
- /* Set up the standard receive ring. */
- rcb = &sc->ti_rdata->ti_info.ti_std_rx_rcb;
- TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring);
- rcb->ti_max_len = TI_FRAMELEN;
- rcb->ti_flags = 0;
- if (sc->ti_ifp->if_hwassist)
- rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM |
- TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
- rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
-
- /* Set up the jumbo receive ring. */
- rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb;
- TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring);
-
-#ifdef TI_PRIVATE_JUMBOS
- rcb->ti_max_len = TI_JUMBO_FRAMELEN;
- rcb->ti_flags = 0;
-#else
- rcb->ti_max_len = PAGE_SIZE;
- rcb->ti_flags = TI_RCB_FLAG_USE_EXT_RX_BD;
-#endif
- if (sc->ti_ifp->if_hwassist)
- rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM |
- TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
- rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
-
- /*
- * Set up the mini ring. Only activated on the
- * Tigon 2 but the slot in the config block is
- * still there on the Tigon 1.
- */
- rcb = &sc->ti_rdata->ti_info.ti_mini_rx_rcb;
- TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_mini_ring);
- rcb->ti_max_len = MHLEN - ETHER_ALIGN;
- if (sc->ti_hwrev == TI_HWREV_TIGON)
- rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED;
- else
- rcb->ti_flags = 0;
- if (sc->ti_ifp->if_hwassist)
- rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM |
- TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
- rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
-
- /*
- * Set up the receive return ring.
- */
- rcb = &sc->ti_rdata->ti_info.ti_return_rcb;
- TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_return_ring);
- rcb->ti_flags = 0;
- rcb->ti_max_len = TI_RETURN_RING_CNT;
- TI_HOSTADDR(sc->ti_rdata->ti_info.ti_return_prodidx_ptr) =
- rdphys + TI_RD_OFF(ti_return_prodidx_r);
-
- /*
- * Set up the tx ring. Note: for the Tigon 2, we have the option
- * of putting the transmit ring in the host's address space and
- * letting the chip DMA it instead of leaving the ring in the NIC's
- * memory and accessing it through the shared memory region. We
- * do this for the Tigon 2, but it doesn't work on the Tigon 1,
- * so we have to revert to the shared memory scheme if we detect
- * a Tigon 1 chip.
- */
- CSR_WRITE_4(sc, TI_WINBASE, TI_TX_RING_BASE);
- if (sc->ti_hwrev == TI_HWREV_TIGON) {
- sc->ti_rdata->ti_tx_ring_nic =
- (struct ti_tx_desc *)(sc->ti_vhandle + TI_WINDOW);
- }
- bzero((char *)sc->ti_rdata->ti_tx_ring,
- TI_TX_RING_CNT * sizeof(struct ti_tx_desc));
- rcb = &sc->ti_rdata->ti_info.ti_tx_rcb;
- if (sc->ti_hwrev == TI_HWREV_TIGON)
- rcb->ti_flags = 0;
- else
- rcb->ti_flags = TI_RCB_FLAG_HOST_RING;
- rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
- if (sc->ti_ifp->if_hwassist)
- rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM |
- TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
- rcb->ti_max_len = TI_TX_RING_CNT;
- if (sc->ti_hwrev == TI_HWREV_TIGON)
- TI_HOSTADDR(rcb->ti_hostaddr) = TI_TX_RING_BASE;
- else
- TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_tx_ring);
- TI_HOSTADDR(sc->ti_rdata->ti_info.ti_tx_considx_ptr) =
- rdphys + TI_RD_OFF(ti_tx_considx_r);
-
- /* Set up tuneables */
-#if 0
- if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN))
- CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS,
- (sc->ti_rx_coal_ticks / 10));
- else
-#endif
- CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS, sc->ti_rx_coal_ticks);
- CSR_WRITE_4(sc, TI_GCR_TX_COAL_TICKS, sc->ti_tx_coal_ticks);
- CSR_WRITE_4(sc, TI_GCR_STAT_TICKS, sc->ti_stat_ticks);
- CSR_WRITE_4(sc, TI_GCR_RX_MAX_COAL_BD, sc->ti_rx_max_coal_bds);
- CSR_WRITE_4(sc, TI_GCR_TX_MAX_COAL_BD, sc->ti_tx_max_coal_bds);
- CSR_WRITE_4(sc, TI_GCR_TX_BUFFER_RATIO, sc->ti_tx_buf_ratio);
-
- /* Turn interrupts on. */
- CSR_WRITE_4(sc, TI_GCR_MASK_INTRS, 0);
- CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0);
-
- /* Start CPU. */
- TI_CLRBIT(sc, TI_CPU_STATE, (TI_CPUSTATE_HALT|TI_CPUSTATE_STEP));
-
- return (0);
-}
-
-static void
-ti_rdata_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
-{
- struct ti_softc *sc;
-
- sc = arg;
- if (error || nseg != 1)
- return;
-
- /*
- * All of the Tigon data structures need to live at <4GB. This
- * cast is fine since busdma was told about this constraint.
- */
- sc->ti_rdata_phys = (uint32_t)segs[0].ds_addr;
- return;
-}
-
-/*
- * Probe for a Tigon chip. Check the PCI vendor and device IDs
- * against our list and return its name if we find a match.
- */
-static int
-ti_probe(dev)
- device_t dev;
-{
- struct ti_type *t;
-
- t = ti_devs;
-
- while (t->ti_name != NULL) {
- if ((pci_get_vendor(dev) == t->ti_vid) &&
- (pci_get_device(dev) == t->ti_did)) {
- device_set_desc(dev, t->ti_name);
- return (BUS_PROBE_DEFAULT);
- }
- t++;
- }
-
- return (ENXIO);
-}
-
-static int
-ti_attach(dev)
- device_t dev;
-{
- struct ifnet *ifp;
- struct ti_softc *sc;
- int unit, error = 0, rid;
- u_char eaddr[6];
-
- sc = device_get_softc(dev);
- unit = device_get_unit(dev);
- sc->ti_unit = unit;
-
- mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
- MTX_DEF | MTX_RECURSE);
- ifmedia_init(&sc->ifmedia, IFM_IMASK, ti_ifmedia_upd, ti_ifmedia_sts);
- ifp = sc->ti_ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- printf("ti%d: can not if_alloc()\n", sc->ti_unit);
- error = ENOSPC;
- goto fail;
- }
- sc->ti_ifp->if_capabilities = IFCAP_HWCSUM |
- IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU;
- sc->ti_ifp->if_capenable = sc->ti_ifp->if_capabilities;
-
- /*
- * Map control/status registers.
- */
- pci_enable_busmaster(dev);
-
- rid = TI_PCI_LOMEM;
- sc->ti_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
- RF_ACTIVE|PCI_RF_DENSE);
-
- if (sc->ti_res == NULL) {
- printf ("ti%d: couldn't map memory\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- sc->ti_btag = rman_get_bustag(sc->ti_res);
- sc->ti_bhandle = rman_get_bushandle(sc->ti_res);
- sc->ti_vhandle = (vm_offset_t)rman_get_virtual(sc->ti_res);
-
- /* Allocate interrupt */
- rid = 0;
-
- sc->ti_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
- RF_SHAREABLE | RF_ACTIVE);
-
- if (sc->ti_irq == NULL) {
- printf("ti%d: couldn't map interrupt\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- if (ti_chipinit(sc)) {
- printf("ti%d: chip initialization failed\n", sc->ti_unit);
- error = ENXIO;
- goto fail;
- }
-
- /* Zero out the NIC's on-board SRAM. */
- ti_mem(sc, 0x2000, 0x100000 - 0x2000, NULL);
-
- /* Init again -- zeroing memory may have clobbered some registers. */
- if (ti_chipinit(sc)) {
- printf("ti%d: chip initialization failed\n", sc->ti_unit);
- error = ENXIO;
- goto fail;
- }
-
- /*
- * Get station address from the EEPROM. Note: the manual states
- * that the MAC address is at offset 0x8c, however the data is
- * stored as two longwords (since that's how it's loaded into
- * the NIC). This means the MAC address is actually preceded
- * by two zero bytes. We need to skip over those.
- */
- if (ti_read_eeprom(sc, eaddr,
- TI_EE_MAC_OFFSET + 2, ETHER_ADDR_LEN)) {
- printf("ti%d: failed to read station address\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- /* Allocate the general information block and ring buffers. */
- if (bus_dma_tag_create(NULL, /* parent */
- 1, 0, /* algnmnt, boundary */
- BUS_SPACE_MAXADDR, /* lowaddr */
- BUS_SPACE_MAXADDR, /* highaddr */
- NULL, NULL, /* filter, filterarg */
- BUS_SPACE_MAXSIZE_32BIT,/* maxsize */
- 0, /* nsegments */
- BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */
- 0, /* flags */
- NULL, NULL, /* lockfunc, lockarg */
- &sc->ti_parent_dmat) != 0) {
- printf("ti%d: Failed to allocate parent dmat\n", sc->ti_unit);
- error = ENOMEM;
- goto fail;
- }
-
- if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */
- PAGE_SIZE, 0, /* algnmnt, boundary */
- BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
- BUS_SPACE_MAXADDR, /* highaddr */
- NULL, NULL, /* filter, filterarg */
- sizeof(struct ti_ring_data), /* maxsize */
- 1, /* nsegments */
- sizeof(struct ti_ring_data), /* maxsegsize */
- 0, /* flags */
- NULL, NULL, /* lockfunc, lockarg */
- &sc->ti_rdata_dmat) != 0) {
- printf("ti%d: Failed to allocate rdata dmat\n", sc->ti_unit);
- error = ENOMEM;
- goto fail;
- }
-
- if (bus_dmamem_alloc(sc->ti_rdata_dmat, (void**)&sc->ti_rdata,
- BUS_DMA_NOWAIT, &sc->ti_rdata_dmamap) != 0) {
- printf("ti%d: Failed to allocate rdata memory\n", sc->ti_unit);
- error = ENOMEM;
- goto fail;
- }
-
- if (bus_dmamap_load(sc->ti_rdata_dmat, sc->ti_rdata_dmamap,
- sc->ti_rdata, sizeof(struct ti_ring_data),
- ti_rdata_cb, sc, BUS_DMA_NOWAIT) != 0) {
- printf("ti%d: Failed to load rdata segments\n", sc->ti_unit);
- error = ENOMEM;
- goto fail;
- }
-
- bzero(sc->ti_rdata, sizeof(struct ti_ring_data));
-
- /* Try to allocate memory for jumbo buffers. */
-#ifdef TI_PRIVATE_JUMBOS
- if (ti_alloc_jumbo_mem(sc)) {
- printf("ti%d: jumbo buffer allocation failed\n", sc->ti_unit);
- error = ENXIO;
- goto fail;
- }
-#endif
-
- /*
- * We really need a better way to tell a 1000baseTX card
- * from a 1000baseSX one, since in theory there could be
- * OEMed 1000baseTX cards from lame vendors who aren't
- * clever enough to change the PCI ID. For the moment
- * though, the AceNIC is the only copper card available.
- */
- if (pci_get_vendor(dev) == ALT_VENDORID &&
- pci_get_device(dev) == ALT_DEVICEID_ACENIC_COPPER)
- sc->ti_copper = 1;
- /* Ok, it's not the only copper card available. */
- if (pci_get_vendor(dev) == NG_VENDORID &&
- pci_get_device(dev) == NG_DEVICEID_GA620T)
- sc->ti_copper = 1;
-
- /* Set default tuneable values. */
- sc->ti_stat_ticks = 2 * TI_TICKS_PER_SEC;
-#if 0
- sc->ti_rx_coal_ticks = TI_TICKS_PER_SEC / 5000;
-#endif
- sc->ti_rx_coal_ticks = 170;
- sc->ti_tx_coal_ticks = TI_TICKS_PER_SEC / 500;
- sc->ti_rx_max_coal_bds = 64;
-#if 0
- sc->ti_tx_max_coal_bds = 128;
-#endif
- sc->ti_tx_max_coal_bds = 32;
- sc->ti_tx_buf_ratio = 21;
-
- /* Set up ifnet structure */
- ifp->if_softc = sc;
- if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
- IFF_NEEDSGIANT;
- tis[unit] = sc;
- ifp->if_ioctl = ti_ioctl;
- ifp->if_start = ti_start;
- ifp->if_watchdog = ti_watchdog;
- ifp->if_init = ti_init;
- ifp->if_mtu = ETHERMTU;
- ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1;
-
- /* Set up ifmedia support. */
- if (sc->ti_copper) {
- /*
- * Copper cards allow manual 10/100 mode selection,
- * but not manual 1000baseTX mode selection. Why?
- * Becuase currently there's no way to specify the
- * master/slave setting through the firmware interface,
- * so Alteon decided to just bag it and handle it
- * via autonegotiation.
- */
- ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T, 0, NULL);
- ifmedia_add(&sc->ifmedia,
- IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL);
- ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_TX, 0, NULL);
- ifmedia_add(&sc->ifmedia,
- IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL);
- ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_1000_T, 0, NULL);
- ifmedia_add(&sc->ifmedia,
- IFM_ETHER|IFM_1000_T|IFM_FDX, 0, NULL);
- } else {
- /* Fiber cards don't support 10/100 modes. */
- ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_1000_SX, 0, NULL);
- ifmedia_add(&sc->ifmedia,
- IFM_ETHER|IFM_1000_SX|IFM_FDX, 0, NULL);
- }
- ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
- ifmedia_set(&sc->ifmedia, IFM_ETHER|IFM_AUTO);
-
- /*
- * We're assuming here that card initialization is a sequential
- * thing. If it isn't, multiple cards probing at the same time
- * could stomp on the list of softcs here.
- */
-
- /* Register the device */
- sc->dev = make_dev(&ti_cdevsw, sc->ti_unit, UID_ROOT, GID_OPERATOR,
- 0600, "ti%d", sc->ti_unit);
- sc->dev->si_drv1 = sc;
-
- /*
- * Call MI attach routine.
- */
- ether_ifattach(ifp, eaddr);
-
- /* Hook interrupt last to avoid having to lock softc */
- error = bus_setup_intr(dev, sc->ti_irq, INTR_TYPE_NET,
- ti_intr, sc, &sc->ti_intrhand);
-
- if (error) {
- printf("ti%d: couldn't set up irq\n", unit);
- ether_ifdetach(ifp);
- if_free(ifp);
- goto fail;
- }
-
-fail:
- if (sc && error)
- ti_detach(dev);
-
- return (error);
-}
-
-/*
- * Shutdown hardware and free up resources. This can be called any
- * time after the mutex has been initialized. It is called in both
- * the error case in attach and the normal detach case so it needs
- * to be careful about only freeing resources that have actually been
- * allocated.
- */
-static int
-ti_detach(dev)
- device_t dev;
-{
- struct ti_softc *sc;
- struct ifnet *ifp;
-
- sc = device_get_softc(dev);
- if (sc->dev)
- destroy_dev(sc->dev);
- KASSERT(mtx_initialized(&sc->ti_mtx), ("ti mutex not initialized"));
- TI_LOCK(sc);
- ifp = sc->ti_ifp;
-
- /* These should only be active if attach succeeded */
- if (device_is_attached(dev)) {
- ti_stop(sc);
- ether_ifdetach(ifp);
- if_free(ifp);
- bus_generic_detach(dev);
- }
- ifmedia_removeall(&sc->ifmedia);
-
- if (sc->ti_rdata)
- bus_dmamem_free(sc->ti_rdata_dmat, sc->ti_rdata,
- sc->ti_rdata_dmamap);
- if (sc->ti_rdata_dmat)
- bus_dma_tag_destroy(sc->ti_rdata_dmat);
- if (sc->ti_parent_dmat)
- bus_dma_tag_destroy(sc->ti_parent_dmat);
- if (sc->ti_intrhand)
- bus_teardown_intr(dev, sc->ti_irq, sc->ti_intrhand);
- if (sc->ti_irq)
- bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ti_irq);
- if (sc->ti_res) {
- bus_release_resource(dev, SYS_RES_MEMORY, TI_PCI_LOMEM,
- sc->ti_res);
- }
-
-#ifdef TI_PRIVATE_JUMBOS
- if (sc->ti_cdata.ti_jumbo_buf)
- contigfree(sc->ti_cdata.ti_jumbo_buf, TI_JMEM, M_DEVBUF);
-#endif
- if (sc->ti_rdata)
- contigfree(sc->ti_rdata, sizeof(struct ti_ring_data), M_DEVBUF);
-
- TI_UNLOCK(sc);
- mtx_destroy(&sc->ti_mtx);
-
- return (0);
-}
-
-#ifdef TI_JUMBO_HDRSPLIT
-/*
- * If hdr_len is 0, that means that header splitting wasn't done on
- * this packet for some reason. The two most likely reasons are that
- * the protocol isn't a supported protocol for splitting, or this
- * packet had a fragment offset that wasn't 0.
- *
- * The header length, if it is non-zero, will always be the length of
- * the headers on the packet, but that length could be longer than the
- * first mbuf. So we take the minimum of the two as the actual
- * length.
- */
-static __inline void
-ti_hdr_split(struct mbuf *top, int hdr_len, int pkt_len, int idx)
-{
- int i = 0;
- int lengths[4] = {0, 0, 0, 0};
- struct mbuf *m, *mp;
-
- if (hdr_len != 0)
- top->m_len = min(hdr_len, top->m_len);
- pkt_len -= top->m_len;
- lengths[i++] = top->m_len;
-
- mp = top;
- for (m = top->m_next; m && pkt_len; m = m->m_next) {
- m->m_len = m->m_ext.ext_size = min(m->m_len, pkt_len);
- pkt_len -= m->m_len;
- lengths[i++] = m->m_len;
- mp = m;
- }
-
-#if 0
- if (hdr_len != 0)
- printf("got split packet: ");
- else
- printf("got non-split packet: ");
-
- printf("%d,%d,%d,%d = %d\n", lengths[0],
- lengths[1], lengths[2], lengths[3],
- lengths[0] + lengths[1] + lengths[2] +
- lengths[3]);
-#endif
-
- if (pkt_len)
- panic("header splitting didn't");
-
- if (m) {
- m_freem(m);
- mp->m_next = NULL;
-
- }
- if (mp->m_next != NULL)
- panic("ti_hdr_split: last mbuf in chain should be null");
-}
-#endif /* TI_JUMBO_HDRSPLIT */
-
-/*
- * Frame reception handling. This is called if there's a frame
- * on the receive return list.
- *
- * Note: we have to be able to handle three possibilities here:
- * 1) the frame is from the mini receive ring (can only happen)
- * on Tigon 2 boards)
- * 2) the frame is from the jumbo recieve ring
- * 3) the frame is from the standard receive ring
- */
-
-static void
-ti_rxeof(sc)
- struct ti_softc *sc;
-{
- struct ifnet *ifp;
- struct ti_cmd_desc cmd;
-
- TI_LOCK_ASSERT(sc);
-
- ifp = sc->ti_ifp;
-
- while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) {
- struct ti_rx_desc *cur_rx;
- u_int32_t rxidx;
- struct mbuf *m = NULL;
- u_int16_t vlan_tag = 0;
- int have_tag = 0;
-
- cur_rx =
- &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx];
- rxidx = cur_rx->ti_idx;
- TI_INC(sc->ti_rx_saved_considx, TI_RETURN_RING_CNT);
-
- if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) {
- have_tag = 1;
- vlan_tag = cur_rx->ti_vlan_tag & 0xfff;
- }
-
- if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) {
-
- TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT);
- m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx];
- sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL;
- if (cur_rx->ti_flags & TI_BDFLAG_ERROR) {
- ifp->if_ierrors++;
- ti_newbuf_jumbo(sc, sc->ti_jumbo, m);
- continue;
- }
- if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL) == ENOBUFS) {
- ifp->if_ierrors++;
- ti_newbuf_jumbo(sc, sc->ti_jumbo, m);
- continue;
- }
-#ifdef TI_PRIVATE_JUMBOS
- m->m_len = cur_rx->ti_len;
-#else /* TI_PRIVATE_JUMBOS */
-#ifdef TI_JUMBO_HDRSPLIT
- if (sc->ti_hdrsplit)
- ti_hdr_split(m, TI_HOSTADDR(cur_rx->ti_addr),
- cur_rx->ti_len, rxidx);
- else
-#endif /* TI_JUMBO_HDRSPLIT */
- m_adj(m, cur_rx->ti_len - m->m_pkthdr.len);
-#endif /* TI_PRIVATE_JUMBOS */
- } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) {
- TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT);
- m = sc->ti_cdata.ti_rx_mini_chain[rxidx];
- sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL;
- if (cur_rx->ti_flags & TI_BDFLAG_ERROR) {
- ifp->if_ierrors++;
- ti_newbuf_mini(sc, sc->ti_mini, m);
- continue;
- }
- if (ti_newbuf_mini(sc, sc->ti_mini, NULL) == ENOBUFS) {
- ifp->if_ierrors++;
- ti_newbuf_mini(sc, sc->ti_mini, m);
- continue;
- }
- m->m_len = cur_rx->ti_len;
- } else {
- TI_INC(sc->ti_std, TI_STD_RX_RING_CNT);
- m = sc->ti_cdata.ti_rx_std_chain[rxidx];
- sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL;
- if (cur_rx->ti_flags & TI_BDFLAG_ERROR) {
- ifp->if_ierrors++;
- ti_newbuf_std(sc, sc->ti_std, m);
- continue;
- }
- if (ti_newbuf_std(sc, sc->ti_std, NULL) == ENOBUFS) {
- ifp->if_ierrors++;
- ti_newbuf_std(sc, sc->ti_std, m);
- continue;
- }
- m->m_len = cur_rx->ti_len;
- }
-
- m->m_pkthdr.len = cur_rx->ti_len;
- ifp->if_ipackets++;
- m->m_pkthdr.rcvif = ifp;
-
- if (ifp->if_hwassist) {
- m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED |
- CSUM_DATA_VALID;
- if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0)
- m->m_pkthdr.csum_flags |= CSUM_IP_VALID;
- m->m_pkthdr.csum_data = cur_rx->ti_tcp_udp_cksum;
- }
-
- /*
- * If we received a packet with a vlan tag,
- * tag it before passing the packet upward.
- */
- if (have_tag)
- VLAN_INPUT_TAG(ifp, m, vlan_tag, continue);
- TI_UNLOCK(sc);
- (*ifp->if_input)(ifp, m);
- TI_LOCK(sc);
- }
-
- /* Only necessary on the Tigon 1. */
- if (sc->ti_hwrev == TI_HWREV_TIGON)
- CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX,
- sc->ti_rx_saved_considx);
-
- TI_UPDATE_STDPROD(sc, sc->ti_std);
- TI_UPDATE_MINIPROD(sc, sc->ti_mini);
- TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo);
-}
-
-static void
-ti_txeof(sc)
- struct ti_softc *sc;
-{
- struct ti_tx_desc *cur_tx = NULL;
- struct ifnet *ifp;
-
- ifp = sc->ti_ifp;
-
- /*
- * Go through our tx ring and free mbufs for those
- * frames that have been sent.
- */
- while (sc->ti_tx_saved_considx != sc->ti_tx_considx.ti_idx) {
- u_int32_t idx = 0;
-
- idx = sc->ti_tx_saved_considx;
- if (sc->ti_hwrev == TI_HWREV_TIGON) {
- if (idx > 383)
- CSR_WRITE_4(sc, TI_WINBASE,
- TI_TX_RING_BASE + 6144);
- else if (idx > 255)
- CSR_WRITE_4(sc, TI_WINBASE,
- TI_TX_RING_BASE + 4096);
- else if (idx > 127)
- CSR_WRITE_4(sc, TI_WINBASE,
- TI_TX_RING_BASE + 2048);
- else
- CSR_WRITE_4(sc, TI_WINBASE,
- TI_TX_RING_BASE);
- cur_tx = &sc->ti_rdata->ti_tx_ring_nic[idx % 128];
- } else
- cur_tx = &sc->ti_rdata->ti_tx_ring[idx];
- if (cur_tx->ti_flags & TI_BDFLAG_END)
- ifp->if_opackets++;
- if (sc->ti_cdata.ti_tx_chain[idx] != NULL) {
- m_freem(sc->ti_cdata.ti_tx_chain[idx]);
- sc->ti_cdata.ti_tx_chain[idx] = NULL;
- }
- sc->ti_txcnt--;
- TI_INC(sc->ti_tx_saved_considx, TI_TX_RING_CNT);
- ifp->if_timer = 0;
- }
-
- if (cur_tx != NULL)
- ifp->if_flags &= ~IFF_OACTIVE;
-}
-
-static void
-ti_intr(xsc)
- void *xsc;
-{
- struct ti_softc *sc;
- struct ifnet *ifp;
-
- sc = xsc;
- TI_LOCK(sc);
- ifp = sc->ti_ifp;
-
-/*#ifdef notdef*/
- /* Avoid this for now -- checking this register is expensive. */
- /* Make sure this is really our interrupt. */
- if (!(CSR_READ_4(sc, TI_MISC_HOST_CTL) & TI_MHC_INTSTATE)) {
- TI_UNLOCK(sc);
- return;
- }
-/*#endif*/
-
- /* Ack interrupt and stop others from occuring. */
- CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1);
-
- if (ifp->if_flags & IFF_RUNNING) {
- /* Check RX return ring producer/consumer */
- ti_rxeof(sc);
-
- /* Check TX ring producer/consumer */
- ti_txeof(sc);
- }
-
- ti_handle_events(sc);
-
- /* Re-enable interrupts. */
- CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0);
-
- if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL)
- ti_start(ifp);
-
- TI_UNLOCK(sc);
-}
-
-static void
-ti_stats_update(sc)
- struct ti_softc *sc;
-{
- struct ifnet *ifp;
-
- ifp = sc->ti_ifp;
-
- ifp->if_collisions +=
- (sc->ti_rdata->ti_info.ti_stats.dot3StatsSingleCollisionFrames +
- sc->ti_rdata->ti_info.ti_stats.dot3StatsMultipleCollisionFrames +
- sc->ti_rdata->ti_info.ti_stats.dot3StatsExcessiveCollisions +
- sc->ti_rdata->ti_info.ti_stats.dot3StatsLateCollisions) -
- ifp->if_collisions;
-}
-
-/*
- * Encapsulate an mbuf chain in the tx ring by coupling the mbuf data
- * pointers to descriptors.
- */
-static int
-ti_encap(sc, m_head, txidx)
- struct ti_softc *sc;
- struct mbuf *m_head;
- u_int32_t *txidx;
-{
- struct ti_tx_desc *f = NULL;
- struct mbuf *m;
- u_int32_t frag, cur, cnt = 0;
- u_int16_t csum_flags = 0;
- struct m_tag *mtag;
-
- m = m_head;
- cur = frag = *txidx;
-
- if (m_head->m_pkthdr.csum_flags) {
- if (m_head->m_pkthdr.csum_flags & CSUM_IP)
- csum_flags |= TI_BDFLAG_IP_CKSUM;
- if (m_head->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP))
- csum_flags |= TI_BDFLAG_TCP_UDP_CKSUM;
- if (m_head->m_flags & M_LASTFRAG)
- csum_flags |= TI_BDFLAG_IP_FRAG_END;
- else if (m_head->m_flags & M_FRAG)
- csum_flags |= TI_BDFLAG_IP_FRAG;
- }
-
- mtag = VLAN_OUTPUT_TAG(sc->ti_ifp, m);
-
- /*
- * Start packing the mbufs in this chain into
- * the fragment pointers. Stop when we run out
- * of fragments or hit the end of the mbuf chain.
- */
- for (m = m_head; m != NULL; m = m->m_next) {
- if (m->m_len != 0) {
- if (sc->ti_hwrev == TI_HWREV_TIGON) {
- if (frag > 383)
- CSR_WRITE_4(sc, TI_WINBASE,
- TI_TX_RING_BASE + 6144);
- else if (frag > 255)
- CSR_WRITE_4(sc, TI_WINBASE,
- TI_TX_RING_BASE + 4096);
- else if (frag > 127)
- CSR_WRITE_4(sc, TI_WINBASE,
- TI_TX_RING_BASE + 2048);
- else
- CSR_WRITE_4(sc, TI_WINBASE,
- TI_TX_RING_BASE);
- f = &sc->ti_rdata->ti_tx_ring_nic[frag % 128];
- } else
- f = &sc->ti_rdata->ti_tx_ring[frag];
- if (sc->ti_cdata.ti_tx_chain[frag] != NULL)
- break;
- TI_HOSTADDR(f->ti_addr) = vtophys(mtod(m, vm_offset_t));
- f->ti_len = m->m_len;
- f->ti_flags = csum_flags;
-
- if (mtag != NULL) {
- f->ti_flags |= TI_BDFLAG_VLAN_TAG;
- f->ti_vlan_tag = VLAN_TAG_VALUE(mtag) & 0xfff;
- } else {
- f->ti_vlan_tag = 0;
- }
-
- /*
- * Sanity check: avoid coming within 16 descriptors
- * of the end of the ring.
- */
- if ((TI_TX_RING_CNT - (sc->ti_txcnt + cnt)) < 16)
- return (ENOBUFS);
- cur = frag;
- TI_INC(frag, TI_TX_RING_CNT);
- cnt++;
- }
- }
-
- if (m != NULL)
- return (ENOBUFS);
-
- if (frag == sc->ti_tx_saved_considx)
- return (ENOBUFS);
-
- if (sc->ti_hwrev == TI_HWREV_TIGON)
- sc->ti_rdata->ti_tx_ring_nic[cur % 128].ti_flags |=
- TI_BDFLAG_END;
- else
- sc->ti_rdata->ti_tx_ring[cur].ti_flags |= TI_BDFLAG_END;
- sc->ti_cdata.ti_tx_chain[cur] = m_head;
- sc->ti_txcnt += cnt;
-
- *txidx = frag;
-
- return (0);
-}
-
-/*
- * Main transmit routine. To avoid having to do mbuf copies, we put pointers
- * to the mbuf data regions directly in the transmit descriptors.
- */
-static void
-ti_start(ifp)
- struct ifnet *ifp;
-{
- struct ti_softc *sc;
- struct mbuf *m_head = NULL;
- u_int32_t prodidx = 0;
-
- sc = ifp->if_softc;
- TI_LOCK(sc);
-
- prodidx = CSR_READ_4(sc, TI_MB_SENDPROD_IDX);
-
- while (sc->ti_cdata.ti_tx_chain[prodidx] == NULL) {
- IF_DEQUEUE(&ifp->if_snd, m_head);
- if (m_head == NULL)
- break;
-
- /*
- * XXX
- * safety overkill. If this is a fragmented packet chain
- * with delayed TCP/UDP checksums, then only encapsulate
- * it if we have enough descriptors to handle the entire
- * chain at once.
- * (paranoia -- may not actually be needed)
- */
- if (m_head->m_flags & M_FIRSTFRAG &&
- m_head->m_pkthdr.csum_flags & (CSUM_DELAY_DATA)) {
- if ((TI_TX_RING_CNT - sc->ti_txcnt) <
- m_head->m_pkthdr.csum_data + 16) {
- IF_PREPEND(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
- break;
- }
- }
-
- /*
- * Pack the data into the transmit ring. If we
- * don't have room, set the OACTIVE flag and wait
- * for the NIC to drain the ring.
- */
- if (ti_encap(sc, m_head, &prodidx)) {
- IF_PREPEND(&ifp->if_snd, m_head);
- ifp->if_flags |= IFF_OACTIVE;
- break;
- }
-
- /*
- * If there's a BPF listener, bounce a copy of this frame
- * to him.
- */
- BPF_MTAP(ifp, m_head);
- }
-
- /* Transmit */
- CSR_WRITE_4(sc, TI_MB_SENDPROD_IDX, prodidx);
-
- /*
- * Set a timeout in case the chip goes out to lunch.
- */
- ifp->if_timer = 5;
- TI_UNLOCK(sc);
-}
-
-static void
-ti_init(xsc)
- void *xsc;
-{
- struct ti_softc *sc = xsc;
-
- /* Cancel pending I/O and flush buffers. */
- ti_stop(sc);
-
- TI_LOCK(sc);
- /* Init the gen info block, ring control blocks and firmware. */
- if (ti_gibinit(sc)) {
- printf("ti%d: initialization failure\n", sc->ti_unit);
- TI_UNLOCK(sc);
- return;
- }
-
- TI_UNLOCK(sc);
-}
-
-static void ti_init2(sc)
- struct ti_softc *sc;
-{
- struct ti_cmd_desc cmd;
- struct ifnet *ifp;
- u_int16_t *m;
- struct ifmedia *ifm;
- int tmp;
-
- ifp = sc->ti_ifp;
-
- /* Specify MTU and interface index. */
- CSR_WRITE_4(sc, TI_GCR_IFINDEX, sc->ti_unit);
- CSR_WRITE_4(sc, TI_GCR_IFMTU, ifp->if_mtu +
- ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN);
- TI_DO_CMD(TI_CMD_UPDATE_GENCOM, 0, 0);
-
- /* Load our MAC address. */
- m = (u_int16_t *)&IFP2ENADDR(sc->ti_ifp)[0];
- CSR_WRITE_4(sc, TI_GCR_PAR0, htons(m[0]));
- CSR_WRITE_4(sc, TI_GCR_PAR1, (htons(m[1]) << 16) | htons(m[2]));
- TI_DO_CMD(TI_CMD_SET_MAC_ADDR, 0, 0);
-
- /* Enable or disable promiscuous mode as needed. */
- if (ifp->if_flags & IFF_PROMISC) {
- TI_DO_CMD(TI_CMD_SET_PROMISC_MODE, TI_CMD_CODE_PROMISC_ENB, 0);
- } else {
- TI_DO_CMD(TI_CMD_SET_PROMISC_MODE, TI_CMD_CODE_PROMISC_DIS, 0);
- }
-
- /* Program multicast filter. */
- ti_setmulti(sc);
-
- /*
- * If this is a Tigon 1, we should tell the
- * firmware to use software packet filtering.
- */
- if (sc->ti_hwrev == TI_HWREV_TIGON) {
- TI_DO_CMD(TI_CMD_FDR_FILTERING, TI_CMD_CODE_FILT_ENB, 0);
- }
-
- /* Init RX ring. */
- ti_init_rx_ring_std(sc);
-
- /* Init jumbo RX ring. */
- if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN))
- ti_init_rx_ring_jumbo(sc);
-
- /*
- * If this is a Tigon 2, we can also configure the
- * mini ring.
- */
- if (sc->ti_hwrev == TI_HWREV_TIGON_II)
- ti_init_rx_ring_mini(sc);
-
- CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, 0);
- sc->ti_rx_saved_considx = 0;
-
- /* Init TX ring. */
- ti_init_tx_ring(sc);
-
- /* Tell firmware we're alive. */
- TI_DO_CMD(TI_CMD_HOST_STATE, TI_CMD_CODE_STACK_UP, 0);
-
- /* Enable host interrupts. */
- CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0);
-
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- /*
- * Make sure to set media properly. We have to do this
- * here since we have to issue commands in order to set
- * the link negotiation and we can't issue commands until
- * the firmware is running.
- */
- ifm = &sc->ifmedia;
- tmp = ifm->ifm_media;
- ifm->ifm_media = ifm->ifm_cur->ifm_media;
- ti_ifmedia_upd(ifp);
- ifm->ifm_media = tmp;
-}
-
-/*
- * Set media options.
- */
-static int
-ti_ifmedia_upd(ifp)
- struct ifnet *ifp;
-{
- struct ti_softc *sc;
- struct ifmedia *ifm;
- struct ti_cmd_desc cmd;
- u_int32_t flowctl;
-
- sc = ifp->if_softc;
- ifm = &sc->ifmedia;
-
- if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
- return (EINVAL);
-
- flowctl = 0;
-
- switch (IFM_SUBTYPE(ifm->ifm_media)) {
- case IFM_AUTO:
- /*
- * Transmit flow control doesn't work on the Tigon 1.
- */
- flowctl = TI_GLNK_RX_FLOWCTL_Y;
-
- /*
- * Transmit flow control can also cause problems on the
- * Tigon 2, apparantly with both the copper and fiber
- * boards. The symptom is that the interface will just
- * hang. This was reproduced with Alteon 180 switches.
- */
-#if 0
- if (sc->ti_hwrev != TI_HWREV_TIGON)
- flowctl |= TI_GLNK_TX_FLOWCTL_Y;
-#endif
-
- CSR_WRITE_4(sc, TI_GCR_GLINK, TI_GLNK_PREF|TI_GLNK_1000MB|
- TI_GLNK_FULL_DUPLEX| flowctl |
- TI_GLNK_AUTONEGENB|TI_GLNK_ENB);
-
- flowctl = TI_LNK_RX_FLOWCTL_Y;
-#if 0
- if (sc->ti_hwrev != TI_HWREV_TIGON)
- flowctl |= TI_LNK_TX_FLOWCTL_Y;
-#endif
-
- CSR_WRITE_4(sc, TI_GCR_LINK, TI_LNK_100MB|TI_LNK_10MB|
- TI_LNK_FULL_DUPLEX|TI_LNK_HALF_DUPLEX| flowctl |
- TI_LNK_AUTONEGENB|TI_LNK_ENB);
- TI_DO_CMD(TI_CMD_LINK_NEGOTIATION,
- TI_CMD_CODE_NEGOTIATE_BOTH, 0);
- break;
- case IFM_1000_SX:
- case IFM_1000_T:
- flowctl = TI_GLNK_RX_FLOWCTL_Y;
-#if 0
- if (sc->ti_hwrev != TI_HWREV_TIGON)
- flowctl |= TI_GLNK_TX_FLOWCTL_Y;
-#endif
-
- CSR_WRITE_4(sc, TI_GCR_GLINK, TI_GLNK_PREF|TI_GLNK_1000MB|
- flowctl |TI_GLNK_ENB);
- CSR_WRITE_4(sc, TI_GCR_LINK, 0);
- if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) {
- TI_SETBIT(sc, TI_GCR_GLINK, TI_GLNK_FULL_DUPLEX);
- }
- TI_DO_CMD(TI_CMD_LINK_NEGOTIATION,
- TI_CMD_CODE_NEGOTIATE_GIGABIT, 0);
- break;
- case IFM_100_FX:
- case IFM_10_FL:
- case IFM_100_TX:
- case IFM_10_T:
- flowctl = TI_LNK_RX_FLOWCTL_Y;
-#if 0
- if (sc->ti_hwrev != TI_HWREV_TIGON)
- flowctl |= TI_LNK_TX_FLOWCTL_Y;
-#endif
-
- CSR_WRITE_4(sc, TI_GCR_GLINK, 0);
- CSR_WRITE_4(sc, TI_GCR_LINK, TI_LNK_ENB|TI_LNK_PREF|flowctl);
- if (IFM_SUBTYPE(ifm->ifm_media) == IFM_100_FX ||
- IFM_SUBTYPE(ifm->ifm_media) == IFM_100_TX) {
- TI_SETBIT(sc, TI_GCR_LINK, TI_LNK_100MB);
- } else {
- TI_SETBIT(sc, TI_GCR_LINK, TI_LNK_10MB);
- }
- if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) {
- TI_SETBIT(sc, TI_GCR_LINK, TI_LNK_FULL_DUPLEX);
- } else {
- TI_SETBIT(sc, TI_GCR_LINK, TI_LNK_HALF_DUPLEX);
- }
- TI_DO_CMD(TI_CMD_LINK_NEGOTIATION,
- TI_CMD_CODE_NEGOTIATE_10_100, 0);
- break;
- }
-
- return (0);
-}
-
-/*
- * Report current media status.
- */
-static void
-ti_ifmedia_sts(ifp, ifmr)
- struct ifnet *ifp;
- struct ifmediareq *ifmr;
-{
- struct ti_softc *sc;
- u_int32_t media = 0;
-
- sc = ifp->if_softc;
-
- ifmr->ifm_status = IFM_AVALID;
- ifmr->ifm_active = IFM_ETHER;
-
- if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN)
- return;
-
- ifmr->ifm_status |= IFM_ACTIVE;
-
- if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) {
- media = CSR_READ_4(sc, TI_GCR_GLINK_STAT);
- if (sc->ti_copper)
- ifmr->ifm_active |= IFM_1000_T;
- else
- ifmr->ifm_active |= IFM_1000_SX;
- if (media & TI_GLNK_FULL_DUPLEX)
- ifmr->ifm_active |= IFM_FDX;
- else
- ifmr->ifm_active |= IFM_HDX;
- } else if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) {
- media = CSR_READ_4(sc, TI_GCR_LINK_STAT);
- if (sc->ti_copper) {
- if (media & TI_LNK_100MB)
- ifmr->ifm_active |= IFM_100_TX;
- if (media & TI_LNK_10MB)
- ifmr->ifm_active |= IFM_10_T;
- } else {
- if (media & TI_LNK_100MB)
- ifmr->ifm_active |= IFM_100_FX;
- if (media & TI_LNK_10MB)
- ifmr->ifm_active |= IFM_10_FL;
- }
- if (media & TI_LNK_FULL_DUPLEX)
- ifmr->ifm_active |= IFM_FDX;
- if (media & TI_LNK_HALF_DUPLEX)
- ifmr->ifm_active |= IFM_HDX;
- }
-}
-
-static int
-ti_ioctl(ifp, command, data)
- struct ifnet *ifp;
- u_long command;
- caddr_t data;
-{
- struct ti_softc *sc = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *) data;
- int mask, error = 0;
- struct ti_cmd_desc cmd;
-
- TI_LOCK(sc);
-
- switch (command) {
- case SIOCSIFMTU:
- if (ifr->ifr_mtu > TI_JUMBO_MTU)
- error = EINVAL;
- else {
- ifp->if_mtu = ifr->ifr_mtu;
- ti_init(sc);
- }
- break;
- case SIOCSIFFLAGS:
- if (ifp->if_flags & IFF_UP) {
- /*
- * If only the state of the PROMISC flag changed,
- * then just use the 'set promisc mode' command
- * instead of reinitializing the entire NIC. Doing
- * a full re-init means reloading the firmware and
- * waiting for it to start up, which may take a
- * second or two.
- */
- if (ifp->if_flags & IFF_RUNNING &&
- ifp->if_flags & IFF_PROMISC &&
- !(sc->ti_if_flags & IFF_PROMISC)) {
- TI_DO_CMD(TI_CMD_SET_PROMISC_MODE,
- TI_CMD_CODE_PROMISC_ENB, 0);
- } else if (ifp->if_flags & IFF_RUNNING &&
- !(ifp->if_flags & IFF_PROMISC) &&
- sc->ti_if_flags & IFF_PROMISC) {
- TI_DO_CMD(TI_CMD_SET_PROMISC_MODE,
- TI_CMD_CODE_PROMISC_DIS, 0);
- } else
- ti_init(sc);
- } else {
- if (ifp->if_flags & IFF_RUNNING) {
- ti_stop(sc);
- }
- }
- sc->ti_if_flags = ifp->if_flags;
- error = 0;
- break;
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- if (ifp->if_flags & IFF_RUNNING) {
- ti_setmulti(sc);
- error = 0;
- }
- break;
- case SIOCSIFMEDIA:
- case SIOCGIFMEDIA:
- error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, command);
- break;
- case SIOCSIFCAP:
- mask = ifr->ifr_reqcap ^ ifp->if_capenable;
- if (mask & IFCAP_HWCSUM) {
- if (IFCAP_HWCSUM & ifp->if_capenable)
- ifp->if_capenable &= ~IFCAP_HWCSUM;
- else
- ifp->if_capenable |= IFCAP_HWCSUM;
- if (ifp->if_flags & IFF_RUNNING)
- ti_init(sc);
- }
- error = 0;
- break;
- default:
- error = ether_ioctl(ifp, command, data);
- break;
- }
-
- TI_UNLOCK(sc);
-
- return (error);
-}
-
-static int
-ti_open(struct cdev *dev, int flags, int fmt, struct thread *td)
-{
- struct ti_softc *sc;
-
- sc = dev->si_drv1;
- if (sc == NULL)
- return (ENODEV);
-
- TI_LOCK(sc);
- sc->ti_flags |= TI_FLAG_DEBUGING;
- TI_UNLOCK(sc);
-
- return (0);
-}
-
-static int
-ti_close(struct cdev *dev, int flag, int fmt, struct thread *td)
-{
- struct ti_softc *sc;
-
- sc = dev->si_drv1;
- if (sc == NULL)
- return (ENODEV);
-
- TI_LOCK(sc);
- sc->ti_flags &= ~TI_FLAG_DEBUGING;
- TI_UNLOCK(sc);
-
- return (0);
-}
-
-/*
- * This ioctl routine goes along with the Tigon character device.
- */
-static int
-ti_ioctl2(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
-{
- int error;
- struct ti_softc *sc;
-
- sc = dev->si_drv1;
- if (sc == NULL)
- return (ENODEV);
-
- error = 0;
-
- switch (cmd) {
- case TIIOCGETSTATS:
- {
- struct ti_stats *outstats;
-
- outstats = (struct ti_stats *)addr;
-
- bcopy(&sc->ti_rdata->ti_info.ti_stats, outstats,
- sizeof(struct ti_stats));
- break;
- }
- case TIIOCGETPARAMS:
- {
- struct ti_params *params;
-
- params = (struct ti_params *)addr;
-
- params->ti_stat_ticks = sc->ti_stat_ticks;
- params->ti_rx_coal_ticks = sc->ti_rx_coal_ticks;
- params->ti_tx_coal_ticks = sc->ti_tx_coal_ticks;
- params->ti_rx_max_coal_bds = sc->ti_rx_max_coal_bds;
- params->ti_tx_max_coal_bds = sc->ti_tx_max_coal_bds;
- params->ti_tx_buf_ratio = sc->ti_tx_buf_ratio;
- params->param_mask = TI_PARAM_ALL;
-
- error = 0;
-
- break;
- }
- case TIIOCSETPARAMS:
- {
- struct ti_params *params;
-
- params = (struct ti_params *)addr;
-
- if (params->param_mask & TI_PARAM_STAT_TICKS) {
- sc->ti_stat_ticks = params->ti_stat_ticks;
- CSR_WRITE_4(sc, TI_GCR_STAT_TICKS, sc->ti_stat_ticks);
- }
-
- if (params->param_mask & TI_PARAM_RX_COAL_TICKS) {
- sc->ti_rx_coal_ticks = params->ti_rx_coal_ticks;
- CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS,
- sc->ti_rx_coal_ticks);
- }
-
- if (params->param_mask & TI_PARAM_TX_COAL_TICKS) {
- sc->ti_tx_coal_ticks = params->ti_tx_coal_ticks;
- CSR_WRITE_4(sc, TI_GCR_TX_COAL_TICKS,
- sc->ti_tx_coal_ticks);
- }
-
- if (params->param_mask & TI_PARAM_RX_COAL_BDS) {
- sc->ti_rx_max_coal_bds = params->ti_rx_max_coal_bds;
- CSR_WRITE_4(sc, TI_GCR_RX_MAX_COAL_BD,
- sc->ti_rx_max_coal_bds);
- }
-
- if (params->param_mask & TI_PARAM_TX_COAL_BDS) {
- sc->ti_tx_max_coal_bds = params->ti_tx_max_coal_bds;
- CSR_WRITE_4(sc, TI_GCR_TX_MAX_COAL_BD,
- sc->ti_tx_max_coal_bds);
- }
-
- if (params->param_mask & TI_PARAM_TX_BUF_RATIO) {
- sc->ti_tx_buf_ratio = params->ti_tx_buf_ratio;
- CSR_WRITE_4(sc, TI_GCR_TX_BUFFER_RATIO,
- sc->ti_tx_buf_ratio);
- }
-
- error = 0;
-
- break;
- }
- case TIIOCSETTRACE: {
- ti_trace_type trace_type;
-
- trace_type = *(ti_trace_type *)addr;
-
- /*
- * Set tracing to whatever the user asked for. Setting
- * this register to 0 should have the effect of disabling
- * tracing.
- */
- CSR_WRITE_4(sc, TI_GCR_NIC_TRACING, trace_type);
-
- error = 0;
-
- break;
- }
- case TIIOCGETTRACE: {
- struct ti_trace_buf *trace_buf;
- u_int32_t trace_start, cur_trace_ptr, trace_len;
-
- trace_buf = (struct ti_trace_buf *)addr;
-
- trace_start = CSR_READ_4(sc, TI_GCR_NICTRACE_START);
- cur_trace_ptr = CSR_READ_4(sc, TI_GCR_NICTRACE_PTR);
- trace_len = CSR_READ_4(sc, TI_GCR_NICTRACE_LEN);
-
-#if 0
- printf("ti%d: trace_start = %#x, cur_trace_ptr = %#x, "
- "trace_len = %d\n", sc->ti_unit, trace_start,
- cur_trace_ptr, trace_len);
- printf("ti%d: trace_buf->buf_len = %d\n", sc->ti_unit,
- trace_buf->buf_len);
-#endif
-
- error = ti_copy_mem(sc, trace_start, min(trace_len,
- trace_buf->buf_len),
- (caddr_t)trace_buf->buf, 1, 1);
-
- if (error == 0) {
- trace_buf->fill_len = min(trace_len,
- trace_buf->buf_len);
- if (cur_trace_ptr < trace_start)
- trace_buf->cur_trace_ptr =
- trace_start - cur_trace_ptr;
- else
- trace_buf->cur_trace_ptr =
- cur_trace_ptr - trace_start;
- } else
- trace_buf->fill_len = 0;
-
- break;
- }
-
- /*
- * For debugging, five ioctls are needed:
- * ALT_ATTACH
- * ALT_READ_TG_REG
- * ALT_WRITE_TG_REG
- * ALT_READ_TG_MEM
- * ALT_WRITE_TG_MEM
- */
- case ALT_ATTACH:
- /*
- * From what I can tell, Alteon's Solaris Tigon driver
- * only has one character device, so you have to attach
- * to the Tigon board you're interested in. This seems
- * like a not-so-good way to do things, since unless you
- * subsequently specify the unit number of the device
- * you're interested in in every ioctl, you'll only be
- * able to debug one board at a time.
- */
- error = 0;
- break;
- case ALT_READ_TG_MEM:
- case ALT_WRITE_TG_MEM:
- {
- struct tg_mem *mem_param;
- u_int32_t sram_end, scratch_end;
-
- mem_param = (struct tg_mem *)addr;
-
- if (sc->ti_hwrev == TI_HWREV_TIGON) {
- sram_end = TI_END_SRAM_I;
- scratch_end = TI_END_SCRATCH_I;
- } else {
- sram_end = TI_END_SRAM_II;
- scratch_end = TI_END_SCRATCH_II;
- }
-
- /*
- * For now, we'll only handle accessing regular SRAM,
- * nothing else.
- */
- if ((mem_param->tgAddr >= TI_BEG_SRAM)
- && ((mem_param->tgAddr + mem_param->len) <= sram_end)) {
- /*
- * In this instance, we always copy to/from user
- * space, so the user space argument is set to 1.
- */
- error = ti_copy_mem(sc, mem_param->tgAddr,
- mem_param->len,
- mem_param->userAddr, 1,
- (cmd == ALT_READ_TG_MEM) ? 1 : 0);
- } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH)
- && (mem_param->tgAddr <= scratch_end)) {
- error = ti_copy_scratch(sc, mem_param->tgAddr,
- mem_param->len,
- mem_param->userAddr, 1,
- (cmd == ALT_READ_TG_MEM) ?
- 1 : 0, TI_PROCESSOR_A);
- } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH_B_DEBUG)
- && (mem_param->tgAddr <= TI_BEG_SCRATCH_B_DEBUG)) {
- if (sc->ti_hwrev == TI_HWREV_TIGON) {
- printf("ti%d: invalid memory range for "
- "Tigon I\n", sc->ti_unit);
- error = EINVAL;
- break;
- }
- error = ti_copy_scratch(sc, mem_param->tgAddr -
- TI_SCRATCH_DEBUG_OFF,
- mem_param->len,
- mem_param->userAddr, 1,
- (cmd == ALT_READ_TG_MEM) ?
- 1 : 0, TI_PROCESSOR_B);
- } else {
- printf("ti%d: memory address %#x len %d is out of "
- "supported range\n", sc->ti_unit,
- mem_param->tgAddr, mem_param->len);
- error = EINVAL;
- }
-
- break;
- }
- case ALT_READ_TG_REG:
- case ALT_WRITE_TG_REG:
- {
- struct tg_reg *regs;
- u_int32_t tmpval;
-
- regs = (struct tg_reg *)addr;
-
- /*
- * Make sure the address in question isn't out of range.
- */
- if (regs->addr > TI_REG_MAX) {
- error = EINVAL;
- break;
- }
- if (cmd == ALT_READ_TG_REG) {
- bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle,
- regs->addr, &tmpval, 1);
- regs->data = ntohl(tmpval);
-#if 0
- if ((regs->addr == TI_CPU_STATE)
- || (regs->addr == TI_CPU_CTL_B)) {
- printf("ti%d: register %#x = %#x\n",
- sc->ti_unit, regs->addr, tmpval);
- }
-#endif
- } else {
- tmpval = htonl(regs->data);
- bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle,
- regs->addr, &tmpval, 1);
- }
-
- break;
- }
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-static void
-ti_watchdog(ifp)
- struct ifnet *ifp;
-{
- struct ti_softc *sc;
-
- sc = ifp->if_softc;
- TI_LOCK(sc);
-
- /*
- * When we're debugging, the chip is often stopped for long periods
- * of time, and that would normally cause the watchdog timer to fire.
- * Since that impedes debugging, we don't want to do that.
- */
- if (sc->ti_flags & TI_FLAG_DEBUGING) {
- TI_UNLOCK(sc);
- return;
- }
-
- printf("ti%d: watchdog timeout -- resetting\n", sc->ti_unit);
- ti_stop(sc);
- ti_init(sc);
-
- ifp->if_oerrors++;
- TI_UNLOCK(sc);
-}
-
-/*
- * Stop the adapter and free any mbufs allocated to the
- * RX and TX lists.
- */
-static void
-ti_stop(sc)
- struct ti_softc *sc;
-{
- struct ifnet *ifp;
- struct ti_cmd_desc cmd;
-
- TI_LOCK(sc);
-
- ifp = sc->ti_ifp;
-
- /* Disable host interrupts. */
- CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1);
- /*
- * Tell firmware we're shutting down.
- */
- TI_DO_CMD(TI_CMD_HOST_STATE, TI_CMD_CODE_STACK_DOWN, 0);
-
- /* Halt and reinitialize. */
- ti_chipinit(sc);
- ti_mem(sc, 0x2000, 0x100000 - 0x2000, NULL);
- ti_chipinit(sc);
-
- /* Free the RX lists. */
- ti_free_rx_ring_std(sc);
-
- /* Free jumbo RX list. */
- ti_free_rx_ring_jumbo(sc);
-
- /* Free mini RX list. */
- ti_free_rx_ring_mini(sc);
-
- /* Free TX buffers. */
- ti_free_tx_ring(sc);
-
- sc->ti_ev_prodidx.ti_idx = 0;
- sc->ti_return_prodidx.ti_idx = 0;
- sc->ti_tx_considx.ti_idx = 0;
- sc->ti_tx_saved_considx = TI_TXCONS_UNSET;
-
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
- TI_UNLOCK(sc);
-}
-
-/*
- * Stop all chip I/O so that the kernel's probe routines don't
- * get confused by errant DMAs when rebooting.
- */
-static void
-ti_shutdown(dev)
- device_t dev;
-{
- struct ti_softc *sc;
-
- sc = device_get_softc(dev);
- TI_LOCK(sc);
- ti_chipinit(sc);
- TI_UNLOCK(sc);
-}
diff --git a/sys/dev/ti/if_tireg.h b/sys/dev/ti/if_tireg.h
deleted file mode 100644
index 1bcdfbc..0000000
--- a/sys/dev/ti/if_tireg.h
+++ /dev/null
@@ -1,1072 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998, 1999
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * Tigon register offsets. These are memory mapped registers
- * which can be accessed with the CSR_READ_4()/CSR_WRITE_4() macros.
- * Each register must be accessed using 32 bit operations.
- *
- * All reegisters are accessed through a 16K shared memory block.
- * The first group of registers are actually copies of the PCI
- * configuration space registers.
- */
-
-#define TI_PCI_ID 0x000 /* PCI device/vendor ID */
-#define TI_PCI_CMDSTAT 0x004
-#define TI_PCI_CLASSCODE 0x008
-#define TI_PCI_BIST 0x00C
-#define TI_PCI_LOMEM 0x010 /* Shared memory base address */
-#define TI_PCI_SUBSYS 0x02C
-#define TI_PCI_ROMBASE 0x030
-#define TI_PCI_INT 0x03C
-
-#ifndef PCIM_CMD_MWIEN
-#define PCIM_CMD_MWIEN 0x0010
-#endif
-
-/*
- * Alteon AceNIC PCI vendor/device ID.
- */
-#define ALT_VENDORID 0x12AE
-#define ALT_DEVICEID_ACENIC 0x0001
-#define ALT_DEVICEID_ACENIC_COPPER 0x0002
-
-/*
- * 3Com 3c985 PCI vendor/device ID.
- */
-#define TC_VENDORID 0x10B7
-#define TC_DEVICEID_3C985 0x0001
-
-/*
- * Netgear GA620 PCI vendor/device ID.
- */
-#define NG_VENDORID 0x1385
-#define NG_DEVICEID_GA620 0x620A
-#define NG_DEVICEID_GA620T 0x630A
-
-/*
- * SGI device/vendor ID.
- */
-#define SGI_VENDORID 0x10A9
-#define SGI_DEVICEID_TIGON 0x0009
-
-/*
- * DEC vendor ID, Farallon device ID. Apparently, Farallon used
- * the DEC vendor ID in their cards by mistake.
- */
-#define DEC_VENDORID 0x1011
-#define DEC_DEVICEID_FARALLON_PN9000SX 0x001a
-
-/*
- * Tigon configuration and control registers.
- */
-#define TI_MISC_HOST_CTL 0x040
-#define TI_MISC_LOCAL_CTL 0x044
-#define TI_SEM_AB 0x048 /* Tigon 2 only */
-#define TI_MISC_CONF 0x050 /* Tigon 2 only */
-#define TI_TIMER_BITS 0x054
-#define TI_TIMERREF 0x058
-#define TI_PCI_STATE 0x05C
-#define TI_MAIN_EVENT_A 0x060
-#define TI_MAILBOX_EVENT_A 0x064
-#define TI_WINBASE 0x068
-#define TI_WINDATA 0x06C
-#define TI_MAIN_EVENT_B 0x070 /* Tigon 2 only */
-#define TI_MAILBOX_EVENT_B 0x074 /* Tigon 2 only */
-#define TI_TIMERREF_B 0x078 /* Tigon 2 only */
-#define TI_SERIAL 0x07C
-
-/*
- * Misc host control bits.
- */
-#define TI_MHC_INTSTATE 0x00000001
-#define TI_MHC_CLEARINT 0x00000002
-#define TI_MHC_RESET 0x00000008
-#define TI_MHC_BYTE_SWAP_ENB 0x00000010
-#define TI_MHC_WORD_SWAP_ENB 0x00000020
-#define TI_MHC_MASK_INTS 0x00000040
-#define TI_MHC_CHIP_REV_MASK 0xF0000000
-
-#define TI_MHC_BIGENDIAN_INIT \
- (TI_MHC_BYTE_SWAP_ENB|TI_MHC_WORD_SWAP_ENB|TI_MHC_CLEARINT)
-
-#define TI_MHC_LITTLEENDIAN_INIT \
- (TI_MHC_WORD_SWAP_ENB|TI_MHC_CLEARINT)
-
-/*
- * Tigon chip rev values. Rev 4 is the Tigon 1. Rev 6 is the Tigon 2.
- * Rev 5 is also the Tigon 2, but is a broken version which was never
- * used in any actual hardware, so we ignore it.
- */
-#define TI_REV_TIGON_I 0x40000000
-#define TI_REV_TIGON_II 0x60000000
-
-/*
- * Firmware revision that we want.
- */
-#define TI_FIRMWARE_MAJOR 0xc
-#define TI_FIRMWARE_MINOR 0x4
-#define TI_FIRMWARE_FIX 0xb
-
-/*
- * Miscelaneous Local Control register.
- */
-#define TI_MLC_EE_WRITE_ENB 0x00000010
-#define TI_MLC_SRAM_BANK_SIZE 0x00000300 /* Tigon 2 only */
-#define TI_MLC_LOCALADDR_21 0x00004000
-#define TI_MLC_LOCALADDR_22 0x00008000
-#define TI_MLC_SBUS_WRITEERR 0x00080000
-#define TI_MLC_EE_CLK 0x00100000
-#define TI_MLC_EE_TXEN 0x00200000
-#define TI_MLC_EE_DOUT 0x00400000
-#define TI_MLC_EE_DIN 0x00800000
-
-/* Possible memory sizes. */
-#define TI_MLC_SRAM_BANK_DISA 0x00000000
-#define TI_MLC_SRAM_BANK_1024K 0x00000100
-#define TI_MLC_SRAM_BANK_512K 0x00000200
-#define TI_MLC_SRAM_BANK_256K 0x00000300
-
-/*
- * Offset of MAC address inside EEPROM.
- */
-#define TI_EE_MAC_OFFSET 0x8c
-
-#define TI_DMA_ASSIST 0x11C
-#define TI_CPU_STATE 0x140
-#define TI_CPU_PROGRAM_COUNTER 0x144
-#define TI_SRAM_ADDR 0x154
-#define TI_SRAM_DATA 0x158
-#define TI_GEN_0 0x180
-#define TI_GEN_X 0x1FC
-#define TI_MAC_TX_STATE 0x200
-#define TI_MAC_RX_STATE 0x220
-#define TI_CPU_CTL_B 0x240 /* Tigon 2 only */
-#define TI_CPU_PROGRAM_COUNTER_B 0x244 /* Tigon 2 only */
-#define TI_SRAM_ADDR_B 0x254 /* Tigon 2 only */
-#define TI_SRAM_DATA_B 0x258 /* Tigon 2 only */
-#define TI_GEN_B_0 0x280 /* Tigon 2 only */
-#define TI_GEN_B_X 0x2FC /* Tigon 2 only */
-
-/*
- * Misc config register.
- */
-#define TI_MCR_SRAM_SYNCHRONOUS 0x00100000 /* Tigon 2 only */
-
-/*
- * PCI state register.
- */
-#define TI_PCISTATE_FORCE_RESET 0x00000001
-#define TI_PCISTATE_PROVIDE_LEN 0x00000002
-#define TI_PCISTATE_READ_MAXDMA 0x0000001C
-#define TI_PCISTATE_WRITE_MAXDMA 0x000000E0
-#define TI_PCISTATE_MINDMA 0x0000FF00
-#define TI_PCISTATE_FIFO_RETRY_ENB 0x00010000
-#define TI_PCISTATE_USE_MEM_RD_MULT 0x00020000
-#define TI_PCISTATE_NO_SWAP_READ_DMA 0x00040000
-#define TI_PCISTATE_NO_SWAP_WRITE_DMA 0x00080000
-#define TI_PCISTATE_66MHZ_BUS 0x00080000 /* Tigon 2 only */
-#define TI_PCISTATE_32BIT_BUS 0x00100000 /* Tigon 2 only */
-#define TI_PCISTATE_ENB_BYTE_ENABLES 0x00800000 /* Tigon 2 only */
-#define TI_PCISTATE_READ_CMD 0x0F000000
-#define TI_PCISTATE_WRITE_CMD 0xF0000000
-
-#define TI_PCI_READMAX_4 0x04
-#define TI_PCI_READMAX_16 0x08
-#define TI_PCI_READMAX_32 0x0C
-#define TI_PCI_READMAX_64 0x10
-#define TI_PCI_READMAX_128 0x14
-#define TI_PCI_READMAX_256 0x18
-#define TI_PCI_READMAX_1024 0x1C
-
-#define TI_PCI_WRITEMAX_4 0x20
-#define TI_PCI_WRITEMAX_16 0x40
-#define TI_PCI_WRITEMAX_32 0x60
-#define TI_PCI_WRITEMAX_64 0x80
-#define TI_PCI_WRITEMAX_128 0xA0
-#define TI_PCI_WRITEMAX_256 0xC0
-#define TI_PCI_WRITEMAX_1024 0xE0
-
-#define TI_PCI_READ_CMD 0x06000000
-#define TI_PCI_WRITE_CMD 0x70000000
-
-/*
- * DMA state register.
- */
-#define TI_DMASTATE_ENABLE 0x00000001
-#define TI_DMASTATE_PAUSE 0x00000002
-
-/*
- * CPU state register.
- */
-#define TI_CPUSTATE_RESET 0x00000001
-#define TI_CPUSTATE_STEP 0x00000002
-#define TI_CPUSTATE_ROMFAIL 0x00000010
-#define TI_CPUSTATE_HALT 0x00010000
-/*
- * MAC TX state register
- */
-#define TI_TXSTATE_RESET 0x00000001
-#define TI_TXSTATE_ENB 0x00000002
-#define TI_TXSTATE_STOP 0x00000004
-
-/*
- * MAC RX state register
- */
-#define TI_RXSTATE_RESET 0x00000001
-#define TI_RXSTATE_ENB 0x00000002
-#define TI_RXSTATE_STOP 0x00000004
-
-/*
- * Tigon 2 mailbox registers. The mailbox area consists of 256 bytes
- * split into 64 bit registers. Only the lower 32 bits of each mailbox
- * are used.
- */
-#define TI_MB_HOSTINTR_HI 0x500
-#define TI_MB_HOSTINTR_LO 0x504
-#define TI_MB_HOSTINTR TI_MB_HOSTINTR_LO
-#define TI_MB_CMDPROD_IDX_HI 0x508
-#define TI_MB_CMDPROD_IDX_LO 0x50C
-#define TI_MB_CMDPROD_IDX TI_MB_CMDPROD_IDX_LO
-#define TI_MB_SENDPROD_IDX_HI 0x510
-#define TI_MB_SENDPROD_IDX_LO 0x514
-#define TI_MB_SENDPROD_IDX TI_MB_SENDPROD_IDX_LO
-#define TI_MB_STDRXPROD_IDX_HI 0x518 /* Tigon 2 only */
-#define TI_MB_STDRXPROD_IDX_LO 0x51C /* Tigon 2 only */
-#define TI_MB_STDRXPROD_IDX TI_MB_STDRXPROD_IDX_LO
-#define TI_MB_JUMBORXPROD_IDX_HI 0x520 /* Tigon 2 only */
-#define TI_MB_JUMBORXPROD_IDX_LO 0x524 /* Tigon 2 only */
-#define TI_MB_JUMBORXPROD_IDX TI_MB_JUMBORXPROD_IDX_LO
-#define TI_MB_MINIRXPROD_IDX_HI 0x528 /* Tigon 2 only */
-#define TI_MB_MINIRXPROD_IDX_LO 0x52C /* Tigon 2 only */
-#define TI_MB_MINIRXPROD_IDX TI_MB_MINIRXPROD_IDX_LO
-#define TI_MB_RSVD 0x530
-
-/*
- * Tigon 2 general communication registers. These are 64 and 32 bit
- * registers which are only valid after the firmware has been
- * loaded and started. They actually exist in NIC memory but are
- * mapped into the host memory via the shared memory region.
- *
- * The NIC internally maps these registers starting at address 0,
- * so to determine the NIC address of any of these registers, we
- * subtract 0x600 (the address of the first register).
- */
-
-#define TI_GCR_BASE 0x600
-#define TI_GCR_MACADDR 0x600
-#define TI_GCR_PAR0 0x600
-#define TI_GCR_PAR1 0x604
-#define TI_GCR_GENINFO_HI 0x608
-#define TI_GCR_GENINFO_LO 0x60C
-#define TI_GCR_MCASTADDR 0x610 /* obsolete */
-#define TI_GCR_MAR0 0x610 /* obsolete */
-#define TI_GCR_MAR1 0x614 /* obsolete */
-#define TI_GCR_OPMODE 0x618
-#define TI_GCR_DMA_READCFG 0x61C
-#define TI_GCR_DMA_WRITECFG 0x620
-#define TI_GCR_TX_BUFFER_RATIO 0x624
-#define TI_GCR_EVENTCONS_IDX 0x628
-#define TI_GCR_CMDCONS_IDX 0x62C
-#define TI_GCR_TUNEPARMS 0x630
-#define TI_GCR_RX_COAL_TICKS 0x630
-#define TI_GCR_TX_COAL_TICKS 0x634
-#define TI_GCR_STAT_TICKS 0x638
-#define TI_GCR_TX_MAX_COAL_BD 0x63C
-#define TI_GCR_RX_MAX_COAL_BD 0x640
-#define TI_GCR_NIC_TRACING 0x644
-#define TI_GCR_GLINK 0x648
-#define TI_GCR_LINK 0x64C
-#define TI_GCR_NICTRACE_PTR 0x650
-#define TI_GCR_NICTRACE_START 0x654
-#define TI_GCR_NICTRACE_LEN 0x658
-#define TI_GCR_IFINDEX 0x65C
-#define TI_GCR_IFMTU 0x660
-#define TI_GCR_MASK_INTRS 0x664
-#define TI_GCR_GLINK_STAT 0x668
-#define TI_GCR_LINK_STAT 0x66C
-#define TI_GCR_RXRETURNCONS_IDX 0x680
-#define TI_GCR_CMDRING 0x700
-
-#define TI_GCR_NIC_ADDR(x) (x - TI_GCR_BASE);
-
-/*
- * Local memory window. The local memory window is a 2K shared
- * memory region which can be used to access the NIC's internal
- * SRAM. The window can be mapped to a given 2K region using
- * the TI_WINDOW_BASE register.
- */
-#define TI_WINDOW 0x800
-#define TI_WINLEN 0x800
-
-#define TI_TICKS_PER_SEC 1000000
-
-/*
- * Operation mode register.
- */
-#define TI_OPMODE_BYTESWAP_BD 0x00000002
-#define TI_OPMODE_WORDSWAP_BD 0x00000004
-#define TI_OPMODE_WARN_ENB 0x00000008 /* not yet implimented */
-#define TI_OPMODE_BYTESWAP_DATA 0x00000010
-#define TI_OPMODE_1_DMA_ACTIVE 0x00000040
-#define TI_OPMODE_SBUS 0x00000100
-#define TI_OPMODE_DONT_FRAG_JUMBO 0x00000200
-#define TI_OPMODE_INCLUDE_CRC 0x00000400
-#define TI_OPMODE_RX_BADFRAMES 0x00000800
-#define TI_OPMODE_NO_EVENT_INTRS 0x00001000
-#define TI_OPMODE_NO_TX_INTRS 0x00002000
-#define TI_OPMODE_NO_RX_INTRS 0x00004000
-#define TI_OPMODE_FATAL_ENB 0x40000000 /* not yet implimented */
-#define TI_OPMODE_JUMBO_HDRSPLIT 0x00008000
-
-/*
- * DMA configuration thresholds.
- */
-#define TI_DMA_STATE_THRESH_16W 0x00000100
-#define TI_DMA_STATE_THRESH_8W 0x00000080
-#define TI_DMA_STATE_THRESH_4W 0x00000040
-#define TI_DMA_STATE_THRESH_2W 0x00000020
-#define TI_DMA_STATE_THRESH_1W 0x00000010
-
-#define TI_DMA_STATE_FORCE_32_BIT 0x00000008
-
-/*
- * Gigabit link status bits.
- */
-#define TI_GLNK_SENSE_NO_BEG 0x00002000
-#define TI_GLNK_LOOPBACK 0x00004000
-#define TI_GLNK_PREF 0x00008000
-#define TI_GLNK_1000MB 0x00040000
-#define TI_GLNK_FULL_DUPLEX 0x00080000
-#define TI_GLNK_TX_FLOWCTL_Y 0x00200000 /* Tigon 2 only */
-#define TI_GLNK_RX_FLOWCTL_Y 0x00800000
-#define TI_GLNK_AUTONEGENB 0x20000000
-#define TI_GLNK_ENB 0x40000000
-
-/*
- * Link status bits.
- */
-#define TI_LNK_LOOPBACK 0x00004000
-#define TI_LNK_PREF 0x00008000
-#define TI_LNK_10MB 0x00010000
-#define TI_LNK_100MB 0x00020000
-#define TI_LNK_1000MB 0x00040000
-#define TI_LNK_FULL_DUPLEX 0x00080000
-#define TI_LNK_HALF_DUPLEX 0x00100000
-#define TI_LNK_TX_FLOWCTL_Y 0x00200000 /* Tigon 2 only */
-#define TI_LNK_RX_FLOWCTL_Y 0x00800000
-#define TI_LNK_AUTONEGENB 0x20000000
-#define TI_LNK_ENB 0x40000000
-
-/*
- * Ring size constants.
- */
-#define TI_EVENT_RING_CNT 256
-#define TI_CMD_RING_CNT 64
-#define TI_STD_RX_RING_CNT 512
-#define TI_JUMBO_RX_RING_CNT 256
-#define TI_MINI_RX_RING_CNT 1024
-#define TI_RETURN_RING_CNT 2048
-
-/*
- * Possible TX ring sizes.
- */
-#define TI_TX_RING_CNT_128 128
-#define TI_TX_RING_BASE_128 0x3800
-
-#define TI_TX_RING_CNT_256 256
-#define TI_TX_RING_BASE_256 0x3000
-
-#define TI_TX_RING_CNT_512 512
-#define TI_TX_RING_BASE_512 0x2000
-
-#define TI_TX_RING_CNT TI_TX_RING_CNT_512
-#define TI_TX_RING_BASE TI_TX_RING_BASE_512
-
-/*
- * The Tigon can have up to 8MB of external SRAM, however the Tigon 1
- * is limited to 2MB total, and in general I think most adapters have
- * around 1MB. We use this value for zeroing the NIC's SRAM, so to
- * be safe we use the largest possible value (zeroing memory that
- * isn't there doesn't hurt anything).
- */
-#define TI_MEM_MAX 0x7FFFFF
-
-/*
- * Maximum register address on the Tigon.
- */
-#define TI_REG_MAX 0x3fff
-
-/*
- * These values were taken from Alteon's tg.h.
- */
-#define TI_BEG_SRAM 0x0 /* host thinks it's here */
-#define TI_BEG_SCRATCH 0xc00000 /* beg of scratch pad area */
-#define TI_END_SRAM_II 0x800000 /* end of SRAM, for 2 MB stuffed */
-#define TI_END_SCRATCH_II 0xc04000 /* end of scratch pad CPU A (16KB) */
-#define TI_END_SCRATCH_B 0xc02000 /* end of scratch pad CPU B (8KB) */
-#define TI_BEG_SCRATCH_B_DEBUG 0xd00000 /* beg of scratch pad for ioctl */
-#define TI_END_SCRATCH_B_DEBUG 0xd02000 /* end of scratch pad for ioctl */
-#define TI_SCRATCH_DEBUG_OFF 0x100000 /* offset for ioctl usage */
-#define TI_END_SRAM_I 0x200000 /* end of SRAM, for 2 MB stuffed */
-#define TI_END_SCRATCH_I 0xc00800 /* end of scratch pad area (2KB) */
-#define TI_BEG_PROM 0x40000000 /* beg of PROM, special access */
-#define TI_BEG_FLASH 0x80000000 /* beg of EEPROM, special access */
-#define TI_END_FLASH 0x80100000 /* end of EEPROM for 1 MB stuff */
-#define TI_BEG_SER_EEPROM 0xa0000000 /* beg of Serial EEPROM (fake out) */
-#define TI_END_SER_EEPROM 0xa0002000 /* end of Serial EEPROM (fake out) */
-#define TI_BEG_REGS 0xc0000000 /* beg of register area */
-#define TI_END_REGS 0xc0000400 /* end of register area */
-#define TI_END_WRITE_REGS 0xc0000180 /* can't write GPRs currently */
-#define TI_BEG_REGS2 0xc0000200 /* beg of second writeable reg area */
-/* the EEPROM is byte addressable in a pretty odd way */
-#define EEPROM_BYTE_LOC 0xff000000
-
-/*
- * From Alteon's tg.h.
- */
-#define TI_PROCESSOR_A 0
-#define TI_PROCESSOR_B 1
-#define TI_CPU_A TG_PROCESSOR_A
-#define TI_CPU_B TG_PROCESSOR_B
-
-/*
- * Following macro can be used to access to any of the CPU registers
- * It will adjust the address appropriately.
- * Parameters:
- * reg - The register to access, e.g TI_CPU_CONTROL
- * cpu - cpu, i.e PROCESSOR_A or PROCESSOR_B (or TI_CPU_A or TI_CPU_B)
- */
-#define CPU_REG(reg, cpu) ((reg) + (cpu) * 0x100)
-
-/*
- * Even on the alpha, pci addresses are 32-bit quantities
- */
-
-#ifdef __64_bit_pci_addressing__
-typedef struct {
- u_int64_t ti_addr;
-} ti_hostaddr;
-#define TI_HOSTADDR(x) x.ti_addr
-#else
-typedef struct {
- u_int32_t ti_addr_hi;
- u_int32_t ti_addr_lo;
-} ti_hostaddr;
-#define TI_HOSTADDR(x) x.ti_addr_lo
-#endif
-
-/*
- * Ring control block structure. The rules for the max_len field
- * are as follows:
- *
- * For the send ring, max_len indicates the number of entries in the
- * ring (128, 256 or 512).
- *
- * For the standard receive ring, max_len indicates the threshold
- * used to decide when a frame should be put in the jumbo receive ring
- * instead of the standard one.
- *
- * For the mini ring, max_len indicates the size of the buffers in the
- * ring. This is the value used to decide when a frame is small enough
- * to be placed in the mini ring.
- *
- * For the return receive ring, max_len indicates the number of entries
- * in the ring. It can be one of 2048, 1024 or 0 (which is the same as
- * 2048 for backwards compatibility). The value 1024 can only be used
- * if the mini ring is disabled.
- */
-struct ti_rcb {
- ti_hostaddr ti_hostaddr;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_max_len;
- u_int16_t ti_flags;
-#else
- u_int16_t ti_flags;
- u_int16_t ti_max_len;
-#endif
- u_int32_t ti_unused;
-};
-
-#define TI_RCB_FLAG_TCP_UDP_CKSUM 0x00000001
-#define TI_RCB_FLAG_IP_CKSUM 0x00000002
-#define TI_RCB_FLAG_NO_PHDR_CKSUM 0x00000008
-#define TI_RCB_FLAG_VLAN_ASSIST 0x00000010
-#define TI_RCB_FLAG_COAL_UPD_ONLY 0x00000020
-#define TI_RCB_FLAG_HOST_RING 0x00000040
-#define TI_RCB_FLAG_IEEE_SNAP_CKSUM 0x00000080
-#define TI_RCB_FLAG_USE_EXT_RX_BD 0x00000100
-#define TI_RCB_FLAG_RING_DISABLED 0x00000200
-
-struct ti_producer {
- u_int32_t ti_idx;
- u_int32_t ti_unused;
-};
-
-/*
- * Tigon general information block. This resides in host memory
- * and contains the status counters, ring control blocks and
- * producer pointers.
- */
-
-struct ti_gib {
- struct ti_stats ti_stats;
- struct ti_rcb ti_ev_rcb;
- struct ti_rcb ti_cmd_rcb;
- struct ti_rcb ti_tx_rcb;
- struct ti_rcb ti_std_rx_rcb;
- struct ti_rcb ti_jumbo_rx_rcb;
- struct ti_rcb ti_mini_rx_rcb;
- struct ti_rcb ti_return_rcb;
- ti_hostaddr ti_ev_prodidx_ptr;
- ti_hostaddr ti_return_prodidx_ptr;
- ti_hostaddr ti_tx_considx_ptr;
- ti_hostaddr ti_refresh_stats_ptr;
-};
-
-/*
- * Buffer descriptor structures. There are basically three types
- * of structures: normal receive descriptors, extended receive
- * descriptors and transmit descriptors. The extended receive
- * descriptors are optionally used only for the jumbo receive ring.
- */
-
-struct ti_rx_desc {
- ti_hostaddr ti_addr;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_idx;
- u_int16_t ti_len;
-#else
- u_int16_t ti_len;
- u_int16_t ti_idx;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_type;
- u_int16_t ti_flags;
-#else
- u_int16_t ti_flags;
- u_int16_t ti_type;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_ip_cksum;
- u_int16_t ti_tcp_udp_cksum;
-#else
- u_int16_t ti_tcp_udp_cksum;
- u_int16_t ti_ip_cksum;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_error_flags;
- u_int16_t ti_vlan_tag;
-#else
- u_int16_t ti_vlan_tag;
- u_int16_t ti_error_flags;
-#endif
- u_int32_t ti_rsvd;
- u_int32_t ti_opaque;
-};
-
-struct ti_rx_desc_ext {
- ti_hostaddr ti_addr1;
- ti_hostaddr ti_addr2;
- ti_hostaddr ti_addr3;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_len1;
- u_int16_t ti_len2;
-#else
- u_int16_t ti_len2;
- u_int16_t ti_len1;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_len3;
- u_int16_t ti_rsvd0;
-#else
- u_int16_t ti_rsvd0;
- u_int16_t ti_len3;
-#endif
- ti_hostaddr ti_addr0;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_idx;
- u_int16_t ti_len0;
-#else
- u_int16_t ti_len0;
- u_int16_t ti_idx;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_type;
- u_int16_t ti_flags;
-#else
- u_int16_t ti_flags;
- u_int16_t ti_type;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_ip_cksum;
- u_int16_t ti_tcp_udp_cksum;
-#else
- u_int16_t ti_tcp_udp_cksum;
- u_int16_t ti_ip_cksum;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_error_flags;
- u_int16_t ti_vlan_tag;
-#else
- u_int16_t ti_vlan_tag;
- u_int16_t ti_error_flags;
-#endif
- u_int32_t ti_rsvd1;
- u_int32_t ti_opaque;
-};
-
-/*
- * Transmit descriptors are, mercifully, very small.
- */
-struct ti_tx_desc {
- ti_hostaddr ti_addr;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_len;
- u_int16_t ti_flags;
-#else
- u_int16_t ti_flags;
- u_int16_t ti_len;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int16_t ti_rsvd;
- u_int16_t ti_vlan_tag;
-#else
- u_int16_t ti_vlan_tag;
- u_int16_t ti_rsvd;
-#endif
-};
-
-/*
- * NOTE! On the Alpha, we have an alignment constraint.
- * The first thing in the packet is a 14-byte Ethernet header.
- * This means that the packet is misaligned. To compensate,
- * we actually offset the data 2 bytes into the cluster. This
- * alignes the packet after the Ethernet header at a 32-bit
- * boundary.
- */
-
-#define ETHER_ALIGN 2
-
-#define TI_FRAMELEN 1518
-#define TI_JUMBO_FRAMELEN 9018
-#define TI_JUMBO_MTU (TI_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
-#define TI_PAGE_SIZE PAGE_SIZE
-#define TI_MIN_FRAMELEN 60
-
-/*
- * Buffer descriptor error flags.
- */
-#define TI_BDERR_CRC 0x0001
-#define TI_BDERR_COLLDETECT 0x0002
-#define TI_BDERR_LINKLOST 0x0004
-#define TI_BDERR_DECODE 0x0008
-#define TI_BDERR_ODD_NIBBLES 0x0010
-#define TI_BDERR_MAC_ABRT 0x0020
-#define TI_BDERR_RUNT 0x0040
-#define TI_BDERR_TRUNC 0x0080
-#define TI_BDERR_GIANT 0x0100
-
-/*
- * Buffer descriptor flags.
- */
-#define TI_BDFLAG_TCP_UDP_CKSUM 0x0001
-#define TI_BDFLAG_IP_CKSUM 0x0002
-#define TI_BDFLAG_END 0x0004
-#define TI_BDFLAG_MORE 0x0008
-#define TI_BDFLAG_JUMBO_RING 0x0010
-#define TI_BDFLAG_UCAST_PKT 0x0020
-#define TI_BDFLAG_MCAST_PKT 0x0040
-#define TI_BDFLAG_BCAST_PKT 0x0060
-#define TI_BDFLAG_IP_FRAG 0x0080
-#define TI_BDFLAG_IP_FRAG_END 0x0100
-#define TI_BDFLAG_VLAN_TAG 0x0200
-#define TI_BDFLAG_ERROR 0x0400
-#define TI_BDFLAG_COAL_NOW 0x0800
-#define TI_BDFLAG_MINI_RING 0x1000
-
-/*
- * Descriptor type flags. I think these only have meaning for
- * the Tigon 1. I had to extract them from the sample driver source
- * since they aren't in the manual.
- */
-#define TI_BDTYPE_TYPE_NULL 0x0000
-#define TI_BDTYPE_SEND_BD 0x0001
-#define TI_BDTYPE_RECV_BD 0x0002
-#define TI_BDTYPE_RECV_JUMBO_BD 0x0003
-#define TI_BDTYPE_RECV_BD_LAST 0x0004
-#define TI_BDTYPE_SEND_DATA 0x0005
-#define TI_BDTYPE_SEND_DATA_LAST 0x0006
-#define TI_BDTYPE_RECV_DATA 0x0007
-#define TI_BDTYPE_RECV_DATA_LAST 0x000b
-#define TI_BDTYPE_EVENT_RUPT 0x000c
-#define TI_BDTYPE_EVENT_NO_RUPT 0x000d
-#define TI_BDTYPE_ODD_START 0x000e
-#define TI_BDTYPE_UPDATE_STATS 0x000f
-#define TI_BDTYPE_SEND_DUMMY_DMA 0x0010
-#define TI_BDTYPE_EVENT_PROD 0x0011
-#define TI_BDTYPE_TX_CONS 0x0012
-#define TI_BDTYPE_RX_PROD 0x0013
-#define TI_BDTYPE_REFRESH_STATS 0x0014
-#define TI_BDTYPE_SEND_DATA_LAST_VLAN 0x0015
-#define TI_BDTYPE_SEND_DATA_COAL 0x0016
-#define TI_BDTYPE_SEND_DATA_LAST_COAL 0x0017
-#define TI_BDTYPE_SEND_DATA_LAST_VLAN_COAL 0x0018
-#define TI_BDTYPE_TX_CONS_NO_INTR 0x0019
-
-/*
- * Tigon command structure.
- */
-struct ti_cmd_desc {
-#if BYTE_ORDER == BIG_ENDIAN
- u_int32_t ti_cmd:8;
- u_int32_t ti_code:12;
- u_int32_t ti_idx:12;
-#else
- u_int32_t ti_idx:12;
- u_int32_t ti_code:12;
- u_int32_t ti_cmd:8;
-#endif
-};
-
-#define TI_CMD_HOST_STATE 0x01
-#define TI_CMD_CODE_STACK_UP 0x01
-#define TI_CMD_CODE_STACK_DOWN 0x02
-
-/*
- * This command enables software address filtering. It's a workaround
- * for a bug in the Tigon 1 and not implemented for the Tigon 2.
- */
-#define TI_CMD_FDR_FILTERING 0x02
-#define TI_CMD_CODE_FILT_ENB 0x01
-#define TI_CMD_CODE_FILT_DIS 0x02
-
-#define TI_CMD_SET_RX_PROD_IDX 0x03 /* obsolete */
-#define TI_CMD_UPDATE_GENCOM 0x04
-#define TI_CMD_RESET_JUMBO_RING 0x05
-#define TI_CMD_SET_PARTIAL_RX_CNT 0x06
-#define TI_CMD_ADD_MCAST_ADDR 0x08 /* obsolete */
-#define TI_CMD_DEL_MCAST_ADDR 0x09 /* obsolete */
-
-#define TI_CMD_SET_PROMISC_MODE 0x0A
-#define TI_CMD_CODE_PROMISC_ENB 0x01
-#define TI_CMD_CODE_PROMISC_DIS 0x02
-
-#define TI_CMD_LINK_NEGOTIATION 0x0B
-#define TI_CMD_CODE_NEGOTIATE_BOTH 0x00
-#define TI_CMD_CODE_NEGOTIATE_GIGABIT 0x01
-#define TI_CMD_CODE_NEGOTIATE_10_100 0x02
-
-#define TI_CMD_SET_MAC_ADDR 0x0C
-#define TI_CMD_CLR_PROFILE 0x0D
-
-#define TI_CMD_SET_ALLMULTI 0x0E
-#define TI_CMD_CODE_ALLMULTI_ENB 0x01
-#define TI_CMD_CODE_ALLMULTI_DIS 0x02
-
-#define TI_CMD_CLR_STATS 0x0F
-#define TI_CMD_SET_RX_JUMBO_PROD_IDX 0x10 /* obsolete */
-#define TI_CMD_RFRSH_STATS 0x11
-
-#define TI_CMD_EXT_ADD_MCAST 0x12
-#define TI_CMD_EXT_DEL_MCAST 0x13
-
-/*
- * Utility macros to make issuing commands a little simpler. Assumes
- * that 'sc' and 'cmd' are in local scope.
- */
-#define TI_DO_CMD(x, y, z) \
- cmd.ti_cmd = (x); \
- cmd.ti_code = (y); \
- cmd.ti_idx = (z); \
- ti_cmd(sc, &cmd);
-
-#define TI_DO_CMD_EXT(x, y, z, v, w) \
- cmd.ti_cmd = (x); \
- cmd.ti_code = (y); \
- cmd.ti_idx = (z); \
- ti_cmd_ext(sc, &cmd, (v), (w));
-
-/*
- * Other utility macros.
- */
-#define TI_INC(x, y) (x) = (x + 1) % y
-
-#define TI_UPDATE_JUMBOPROD(x, y) \
- if (x->ti_hwrev == TI_HWREV_TIGON) { \
- TI_DO_CMD(TI_CMD_SET_RX_JUMBO_PROD_IDX, 0, y); \
- } else { \
- CSR_WRITE_4(x, TI_MB_JUMBORXPROD_IDX, y); \
- }
-
-#define TI_UPDATE_MINIPROD(x, y) \
- CSR_WRITE_4(x, TI_MB_MINIRXPROD_IDX, y);
-
-#define TI_UPDATE_STDPROD(x, y) \
- if (x->ti_hwrev == TI_HWREV_TIGON) { \
- TI_DO_CMD(TI_CMD_SET_RX_PROD_IDX, 0, y); \
- } else { \
- CSR_WRITE_4(x, TI_MB_STDRXPROD_IDX, y); \
- }
-
-
-/*
- * Tigon event structure.
- */
-struct ti_event_desc {
-#if BYTE_ORDER == BIG_ENDIAN
- u_int32_t ti_event:8;
- u_int32_t ti_code:12;
- u_int32_t ti_idx:12;
-#else
- u_int32_t ti_idx:12;
- u_int32_t ti_code:12;
- u_int32_t ti_event:8;
-#endif
- u_int32_t ti_rsvd;
-};
-
-/*
- * Tigon events.
- */
-#define TI_EV_FIRMWARE_UP 0x01
-#define TI_EV_STATS_UPDATED 0x04
-
-#define TI_EV_LINKSTAT_CHANGED 0x06
-#define TI_EV_CODE_GIG_LINK_UP 0x01
-#define TI_EV_CODE_LINK_DOWN 0x02
-#define TI_EV_CODE_LINK_UP 0x03
-
-#define TI_EV_ERROR 0x07
-#define TI_EV_CODE_ERR_INVAL_CMD 0x01
-#define TI_EV_CODE_ERR_UNIMP_CMD 0x02
-#define TI_EV_CODE_ERR_BADCFG 0x03
-
-#define TI_EV_MCAST_UPDATED 0x08
-#define TI_EV_CODE_MCAST_ADD 0x01
-#define TI_EV_CODE_MCAST_DEL 0x02
-
-#define TI_EV_RESET_JUMBO_RING 0x09
-/*
- * Register access macros. The Tigon always uses memory mapped register
- * accesses and all registers must be accessed with 32 bit operations.
- */
-
-#define CSR_WRITE_4(sc, reg, val) \
- bus_space_write_4(sc->ti_btag, sc->ti_bhandle, reg, val)
-
-#define CSR_READ_4(sc, reg) \
- bus_space_read_4(sc->ti_btag, sc->ti_bhandle, reg)
-
-#define TI_SETBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, (CSR_READ_4(sc, reg) | x))
-#define TI_CLRBIT(sc, reg, x) \
- CSR_WRITE_4(sc, reg, (CSR_READ_4(sc, reg) & ~x))
-
-/*
- * Memory management stuff. Note: the SSLOTS, MSLOTS and JSLOTS
- * values are tuneable. They control the actual amount of buffers
- * allocated for the standard, mini and jumbo receive rings.
- */
-
-#define TI_SSLOTS 256
-#define TI_MSLOTS 256
-#define TI_JSLOTS 384
-
-#define TI_JRAWLEN (TI_JUMBO_FRAMELEN + ETHER_ALIGN)
-#define TI_JLEN (TI_JRAWLEN + (sizeof(u_int64_t) - \
- (TI_JRAWLEN % sizeof(u_int64_t))))
-#define TI_JPAGESZ PAGE_SIZE
-#define TI_RESID (TI_JPAGESZ - (TI_JLEN * TI_JSLOTS) % TI_JPAGESZ)
-#define TI_JMEM ((TI_JLEN * TI_JSLOTS) + TI_RESID)
-
-/*
- * Ring structures. Most of these reside in host memory and we tell
- * the NIC where they are via the ring control blocks. The exceptions
- * are the tx and command rings, which live in NIC memory and which
- * we access via the shared memory window.
- */
-struct ti_ring_data {
- struct ti_rx_desc ti_rx_std_ring[TI_STD_RX_RING_CNT];
-#ifdef PRIVATE_JUMBOS
- struct ti_rx_desc ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT];
-#else
- struct ti_rx_desc_ext ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT];
-#endif
- struct ti_rx_desc ti_rx_mini_ring[TI_MINI_RX_RING_CNT];
- struct ti_rx_desc ti_rx_return_ring[TI_RETURN_RING_CNT];
- struct ti_event_desc ti_event_ring[TI_EVENT_RING_CNT];
- struct ti_tx_desc ti_tx_ring[TI_TX_RING_CNT];
- /*
- * Make sure producer structures are aligned on 32-byte cache
- * line boundaries.
- */
- struct ti_producer ti_ev_prodidx_r;
- u_int32_t ti_pad0[6];
- struct ti_producer ti_return_prodidx_r;
- u_int32_t ti_pad1[6];
- struct ti_producer ti_tx_considx_r;
- u_int32_t ti_pad2[6];
- struct ti_tx_desc *ti_tx_ring_nic;/* pointer to shared mem */
- struct ti_cmd_desc *ti_cmd_ring; /* pointer to shared mem */
- struct ti_gib ti_info;
-};
-
-/*
- * Mbuf pointers. We need these to keep track of the virtual addresses
- * of our mbuf chains since we can only convert from physical to virtual,
- * not the other way around.
- */
-struct ti_chain_data {
- struct mbuf *ti_tx_chain[TI_TX_RING_CNT];
- struct mbuf *ti_rx_std_chain[TI_STD_RX_RING_CNT];
- struct mbuf *ti_rx_jumbo_chain[TI_JUMBO_RX_RING_CNT];
- struct mbuf *ti_rx_mini_chain[TI_MINI_RX_RING_CNT];
- /* Stick the jumbo mem management stuff here too. */
- caddr_t ti_jslots[TI_JSLOTS];
- void *ti_jumbo_buf;
-};
-
-struct ti_type {
- u_int16_t ti_vid;
- u_int16_t ti_did;
- char *ti_name;
-};
-
-#define TI_HWREV_TIGON 0x01
-#define TI_HWREV_TIGON_II 0x02
-#define TI_TIMEOUT 1000
-#define TI_TXCONS_UNSET 0xFFFF /* impossible value */
-
-struct ti_mc_entry {
- struct ether_addr mc_addr;
- SLIST_ENTRY(ti_mc_entry) mc_entries;
-};
-
-struct ti_jpool_entry {
- int slot;
- SLIST_ENTRY(ti_jpool_entry) jpool_entries;
-};
-
-typedef enum {
- TI_FLAG_NONE = 0x00,
- TI_FLAG_DEBUGING = 0x01,
- TI_FLAG_WAIT_FOR_LINK = 0x02
-} ti_flag_vals;
-
-struct ti_softc {
- STAILQ_ENTRY(ti_softc) ti_links;
- struct ifnet *ti_ifp;
- bus_space_handle_t ti_bhandle;
- vm_offset_t ti_vhandle;
- bus_space_tag_t ti_btag;
- void *ti_intrhand;
- struct resource *ti_irq;
- struct resource *ti_res;
- struct ifmedia ifmedia; /* media info */
- u_int8_t ti_unit; /* interface number */
- u_int8_t ti_hwrev; /* Tigon rev (1 or 2) */
- u_int8_t ti_copper; /* 1000baseTX card */
- u_int8_t ti_linkstat; /* Link state */
- int ti_hdrsplit; /* enable header splitting */
- bus_dma_tag_t ti_parent_dmat;
- bus_dma_tag_t ti_rdata_dmat;
- bus_dmamap_t ti_rdata_dmamap;
- uint32_t ti_rdata_phys;
- struct ti_ring_data *ti_rdata; /* rings */
- struct ti_chain_data ti_cdata; /* mbufs */
-#define ti_ev_prodidx ti_rdata->ti_ev_prodidx_r
-#define ti_return_prodidx ti_rdata->ti_return_prodidx_r
-#define ti_tx_considx ti_rdata->ti_tx_considx_r
- u_int16_t ti_tx_saved_considx;
- u_int16_t ti_rx_saved_considx;
- u_int16_t ti_ev_saved_considx;
- u_int16_t ti_cmd_saved_prodidx;
- u_int16_t ti_std; /* current std ring head */
- u_int16_t ti_mini; /* current mini ring head */
- u_int16_t ti_jumbo; /* current jumo ring head */
- SLIST_HEAD(__ti_mchead, ti_mc_entry) ti_mc_listhead;
- SLIST_HEAD(__ti_jfreehead, ti_jpool_entry) ti_jfree_listhead;
- SLIST_HEAD(__ti_jinusehead, ti_jpool_entry) ti_jinuse_listhead;
- u_int32_t ti_stat_ticks;
- u_int32_t ti_rx_coal_ticks;
- u_int32_t ti_tx_coal_ticks;
- u_int32_t ti_rx_max_coal_bds;
- u_int32_t ti_tx_max_coal_bds;
- u_int32_t ti_tx_buf_ratio;
- int ti_if_flags;
- int ti_txcnt;
- struct mtx ti_mtx;
- ti_flag_vals ti_flags;
- struct cdev *dev;
-};
-
-#define TI_LOCK(_sc) mtx_lock(&(_sc)->ti_mtx)
-#define TI_UNLOCK(_sc) mtx_unlock(&(_sc)->ti_mtx)
-#define TI_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->ti_mtx, MA_OWNED)
-
-/*
- * Microchip Technology 24Cxx EEPROM control bytes
- */
-#define EEPROM_CTL_READ 0xA1 /* 0101 0001 */
-#define EEPROM_CTL_WRITE 0xA0 /* 0101 0000 */
-
-/*
- * Note that EEPROM_START leaves transmission enabled.
- */
-#define EEPROM_START \
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); /* Pull clock pin high */\
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); /* Set DATA bit to 1 */ \
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN); /* Enable xmit to write bit */\
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); /* Pull DATA bit to 0 again */\
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); /* Pull clock low again */
-
-/*
- * EEPROM_STOP ends access to the EEPROM and clears the ETXEN bit so
- * that no further data can be written to the EEPROM I/O pin.
- */
-#define EEPROM_STOP \
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN); /* Disable xmit */ \
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); /* Pull DATA to 0 */ \
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); /* Pull clock high */ \
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN); /* Enable xmit */ \
- TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); /* Toggle DATA to 1 */ \
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN); /* Disable xmit. */ \
- TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); /* Pull clock low again */
-
-
-#ifdef __alpha__
-#undef vtophys
-#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va)
-#endif
diff --git a/sys/dev/ti/ti_fw.h b/sys/dev/ti/ti_fw.h
deleted file mode 100644
index 89f5c9f..0000000
--- a/sys/dev/ti/ti_fw.h
+++ /dev/null
@@ -1,4593 +0,0 @@
-/*
- * Firmware for Alteon Tigon 1 chip.
- * Generated by genfw.c
- *
- * $FreeBSD$
- */
-static int tigonFwReleaseMajor = 0xc;
-static int tigonFwReleaseMinor = 0x4;
-static int tigonFwReleaseFix = 0xb;
-static u_int32_t tigonFwStartAddr = 0x00004000;
-static u_int32_t tigonFwTextAddr = 0x00004000;
-static int tigonFwTextLen = 0x11140;
-static u_int32_t tigonFwRodataAddr = 0x00015140;
-static int tigonFwRodataLen = 0xac0;
-static u_int32_t tigonFwDataAddr = 0x00015c20;
-static int tigonFwDataLen = 0x170;
-static u_int32_t tigonFwSbssAddr = 0x00015d90;
-static int tigonFwSbssLen = 0x38;
-static u_int32_t tigonFwBssAddr = 0x00015dd0;
-static int tigonFwBssLen = 0x2080;
-static u_int32_t tigonFwText[] = {
-0x10000003,
-0x0, 0xd, 0xd, 0x3c1d0001,
-0x8fbd5c54, 0x3a0f021, 0x3c100000, 0x26104000,
-0xc00100c, 0x0, 0xd, 0x27bdffd8,
-0x3c1cc000, 0x3c1b0013, 0x377bd800, 0xd021,
-0x3c170013, 0x36f75418, 0x2e02021, 0x340583e8,
-0xafbf0024, 0xc002488, 0xafb00020, 0xc0023e8,
-0x0, 0x3c040001, 0x248451a4, 0x24050001,
-0x2e03021, 0x3821, 0x3c100001, 0x26107e50,
-0xafb00010, 0xc002403, 0xafbb0014, 0x3c02000f,
-0x3442ffff, 0x2021024, 0x362102b, 0x10400009,
-0x24050003, 0x3c040001, 0x248451b0, 0x2003021,
-0x3603821, 0x3c020010, 0xafa20010, 0xc002403,
-0xafa00014, 0x2021, 0x3405c000, 0x3c010001,
-0x370821, 0xa02083b0, 0x3c010001, 0x370821,
-0xa02083b2, 0x3c010001, 0x370821, 0xa02083b3,
-0x3c010001, 0x370821, 0xac2083b4, 0xa2e004d8,
-0x418c0, 0x24840001, 0x771021, 0xac40727c,
-0x771021, 0xac407280, 0x2e31021, 0xa445727c,
-0x2c820020, 0x1440fff7, 0x418c0, 0x2021,
-0x3405c000, 0x418c0, 0x24840001, 0x771021,
-0xac40737c, 0x771021, 0xac407380, 0x2e31021,
-0xa445737c, 0x2c820080, 0x5440fff7, 0x418c0,
-0xaf800054, 0xaf80011c, 0x8f820044, 0x34420040,
-0xaf820044, 0x8f820044, 0x34420020, 0xaf820044,
-0x8f420218, 0x30420002, 0x10400009, 0x0,
-0x8f420220, 0x3c030002, 0x34630004, 0x431025,
-0xaee204c4, 0x8f42021c, 0x8001074, 0x34420004,
-0x8f420220, 0x3c030002, 0x34630006, 0x431025,
-0xaee204c4, 0x8f42021c, 0x34420006, 0xaee204cc,
-0x8f420218, 0x30420010, 0x1040000a, 0x0,
-0x8f42021c, 0x34420004, 0xaee204c8, 0x8f420220,
-0x3c03000a, 0x34630004, 0x431025, 0x800108a,
-0xaee204c0, 0x8f420220, 0x3c03000a, 0x34630006,
-0x431025, 0xaee204c0, 0x8f42021c, 0x34420006,
-0xaee204c8, 0x8f420218, 0x30420200, 0x10400003,
-0x24020001, 0x8001091, 0xa2e27248, 0xa2e07248,
-0x24020001, 0xaf8200a0, 0xaf8200b0, 0x8f830054,
-0x8f820054, 0x8001099, 0x24630064, 0x8f820054,
-0x621023, 0x2c420065, 0x1440fffc, 0x0,
-0xaf800044, 0x8f420208, 0x8f43020c, 0xaee20010,
-0xaee30014, 0x8ee40010, 0x8ee50014, 0x26e20030,
-0xaee20028, 0x24020490, 0xaee20018, 0xaf840090,
-0xaf850094, 0x8ee20028, 0xaf8200b4, 0x96e2001a,
-0xaf82009c, 0x8f8200b0, 0x8ee304cc, 0x431025,
-0xaf8200b0, 0x8f8200b0, 0x30420004, 0x1440fffd,
-0x0, 0x8ee20450, 0x8ee30454, 0xaee304fc,
-0x8ee204fc, 0x2442e000, 0x2c422001, 0x1440000d,
-0x26e40030, 0x8ee20450, 0x8ee30454, 0x3c040001,
-0x248451bc, 0x3c050001, 0xafa00010, 0xafa00014,
-0x8ee704fc, 0x34a5f000, 0xc002403, 0x603021,
-0x26e40030, 0xc002488, 0x24050400, 0x27440080,
-0xc002488, 0x24050080, 0x26e4777c, 0xc002488,
-0x24050400, 0x8f42025c, 0x26e40094, 0xaee20060,
-0x8f420260, 0x27450200, 0x24060008, 0xaee20068,
-0x24020006, 0xc00249a, 0xaee20064, 0x3c023b9a,
-0x3442ca00, 0x2021, 0x24030002, 0xaee30074,
-0xaee30070, 0xaee2006c, 0x240203e8, 0xaee20104,
-0x24020001, 0xaee30100, 0xaee2010c, 0x3c030001,
-0x641821, 0x90635c20, 0x2e41021, 0x24840001,
-0xa043009c, 0x2c82000f, 0x1440fff8, 0x0,
-0x8f820040, 0x2e41821, 0x24840001, 0x21702,
-0x24420030, 0xa062009c, 0x2e41021, 0xa040009c,
-0x96e2046a, 0x30420003, 0x14400009, 0x0,
-0x96e2047a, 0x30420003, 0x50400131, 0x3c030800,
-0x96e2046a, 0x30420003, 0x1040002a, 0x3c020700,
-0x96e2047a, 0x30420003, 0x10400026, 0x3c020700,
-0x96e3047a, 0x96e2046a, 0x14620022, 0x3c020700,
-0x8ee204c0, 0x24030001, 0xa2e34e20, 0x34420e00,
-0xaee204c0, 0x8f420218, 0x30420100, 0x10400005,
-0x0, 0x3c020001, 0x2442e168, 0x800111d,
-0x21100, 0x3c020001, 0x2442d35c, 0x21100,
-0x21182, 0x3c030800, 0x431025, 0x3c010001,
-0xac221238, 0x3c020001, 0x2442f680, 0x21100,
-0x21182, 0x3c030800, 0x431025, 0x3c010001,
-0xac221278, 0x8ee20000, 0x34424000, 0x8001238,
-0xaee20000, 0x34423000, 0xafa20018, 0x8ee20608,
-0x8f430228, 0x24420001, 0x304900ff, 0x512300e2,
-0xafa00010, 0x8ee20608, 0x210c0, 0x571021,
-0x8fa30018, 0x8fa4001c, 0xac43060c, 0xac440610,
-0x8f870120, 0x27623800, 0x24e80020, 0x102102b,
-0x50400001, 0x27683000, 0x8f820128, 0x11020004,
-0x0, 0x8f820124, 0x15020007, 0x1021,
-0x8ee201a4, 0x3021, 0x24420001, 0xaee201a4,
-0x80011a0, 0x8ee201a4, 0x8ee40608, 0x420c0,
-0x801821, 0x8ee40430, 0x8ee50434, 0xa32821,
-0xa3302b, 0x822021, 0x862021, 0xace40000,
-0xace50004, 0x8ee30608, 0x24020008, 0xa4e2000e,
-0x2402000d, 0xace20018, 0xace9001c, 0x318c0,
-0x2463060c, 0x2e31021, 0xace20008, 0x8ee204c4,
-0xace20010, 0xaf880120, 0x92e24e20, 0x14400037,
-0x24060001, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8c830000, 0x24020007, 0x1462001f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062001b,
-0x24030040, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee54e30, 0x24420001, 0x10430007,
-0x0, 0x8ee24e34, 0x24420001, 0x10a20005,
-0x0, 0x800118a, 0x0, 0x14a00005,
-0x0, 0x8f820128, 0x24420020, 0xaf820128,
-0x8f820128, 0x8c820004, 0x2c420011, 0x50400013,
-0xac800000, 0x80011a0, 0x0, 0x8ee24e30,
-0x24030040, 0x24420001, 0x50430003, 0x1021,
-0x8ee24e30, 0x24420001, 0xaee24e30, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x24020007,
-0xac820000, 0x24020001, 0xac820004, 0x54c0000c,
-0xaee90608, 0x3c040001, 0x248451c8, 0xafa00010,
-0xafa00014, 0x8ee60608, 0x8f470228, 0x3c050009,
-0xc002403, 0x34a5f000, 0x8001223, 0x0,
-0x8f830120, 0x27623800, 0x24660020, 0xc2102b,
-0x50400001, 0x27663000, 0x8f820128, 0x10c20004,
-0x0, 0x8f820124, 0x14c20007, 0x0,
-0x8ee201a4, 0x3021, 0x24420001, 0xaee201a4,
-0x8001207, 0x8ee201a4, 0x8ee20608, 0xac62001c,
-0x8ee404a0, 0x8ee504a4, 0x2462001c, 0xac620008,
-0x24020008, 0xa462000e, 0x24020011, 0xac620018,
-0xac640000, 0xac650004, 0x8ee204c4, 0xac620010,
-0xaf860120, 0x92e24e20, 0x14400037, 0x24060001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c830000, 0x24020012, 0x1462001f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062001b, 0x24030040,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee54e30, 0x24420001, 0x10430007, 0x0,
-0x8ee24e34, 0x24420001, 0x10a20005, 0x0,
-0x80011f1, 0x0, 0x14a00005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400013, 0xac800000,
-0x8001207, 0x0, 0x8ee24e30, 0x24030040,
-0x24420001, 0x50430003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x24020012, 0xac820000,
-0x24020001, 0xac820004, 0x14c0001b, 0x0,
-0x3c040001, 0x248451d0, 0xafa00010, 0xafa00014,
-0x8ee60608, 0x8f470228, 0x3c050009, 0xc002403,
-0x34a5f001, 0x8ee201b0, 0x24420001, 0xaee201b0,
-0x8001223, 0x8ee201b0, 0x3c040001, 0x248451dc,
-0xafa00014, 0x8ee60608, 0x8f470228, 0x3c050009,
-0xc002403, 0x34a5f005, 0x8ee201ac, 0x24420001,
-0xaee201ac, 0x8ee201ac, 0x8ee20160, 0x3c040001,
-0x248451e8, 0x3405f001, 0x24420001, 0xaee20160,
-0x8ee20160, 0x3021, 0x3821, 0xafa00010,
-0xc002403, 0xafa00014, 0x8001238, 0x0,
-0x3c020001, 0x2442f5a8, 0x21100, 0x21182,
-0x431025, 0x3c010001, 0xac221278, 0x96e2045a,
-0x30420003, 0x10400025, 0x3c050fff, 0x8ee204c8,
-0x34a5ffff, 0x34420a00, 0xaee204c8, 0x8ee304c8,
-0x3c040001, 0x248451f4, 0x24020001, 0xa2e204ec,
-0xa2e204ed, 0x3c020002, 0x621825, 0x3c020001,
-0x2442a390, 0x451024, 0x21082, 0xaee304c8,
-0x3c030800, 0x431025, 0x3c010001, 0xac221220,
-0x3c020001, 0x2442add4, 0x451024, 0x21082,
-0x431025, 0x3c010001, 0xac221280, 0x96e6045a,
-0x3821, 0x24050011, 0xafa00010, 0xc002403,
-0xafa00014, 0x8001268, 0x0, 0x3c020001,
-0x2442a9d4, 0x21100, 0x21182, 0x3c030800,
-0x431025, 0x3c010001, 0xac221280, 0x96e2046a,
-0x30420010, 0x14400009, 0x0, 0x96e2047a,
-0x30420010, 0x10400112, 0x0, 0x96e2046a,
-0x30420010, 0x10400005, 0x3c020700, 0x96e2047a,
-0x30420010, 0x14400102, 0x3c020700, 0x34423000,
-0xafa20018, 0x8ee20608, 0x8f430228, 0x24420001,
-0x304900ff, 0x512300e2, 0xafa00010, 0x8ee20608,
-0x210c0, 0x571021, 0x8fa30018, 0x8fa4001c,
-0xac43060c, 0xac440610, 0x8f870120, 0x27623800,
-0x24e80020, 0x102102b, 0x50400001, 0x27683000,
-0x8f820128, 0x11020004, 0x0, 0x8f820124,
-0x15020007, 0x1021, 0x8ee201a4, 0x3021,
-0x24420001, 0xaee201a4, 0x80012ea, 0x8ee201a4,
-0x8ee40608, 0x420c0, 0x801821, 0x8ee40430,
-0x8ee50434, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xace40000, 0xace50004, 0x8ee30608,
-0x24020008, 0xa4e2000e, 0x2402000d, 0xace20018,
-0xace9001c, 0x318c0, 0x2463060c, 0x2e31021,
-0xace20008, 0x8ee204c4, 0xace20010, 0xaf880120,
-0x92e24e20, 0x14400037, 0x24060001, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x8c830000,
-0x24020007, 0x1462001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x24030040, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee54e30,
-0x24420001, 0x10430007, 0x0, 0x8ee24e34,
-0x24420001, 0x10a20005, 0x0, 0x80012d4,
-0x0, 0x14a00005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400013, 0xac800000, 0x80012ea,
-0x0, 0x8ee24e30, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x24020007, 0xac820000, 0x24020001,
-0xac820004, 0x54c0000c, 0xaee90608, 0x3c040001,
-0x248451c8, 0xafa00010, 0xafa00014, 0x8ee60608,
-0x8f470228, 0x3c050009, 0xc002403, 0x34a5f000,
-0x800136d, 0x0, 0x8f830120, 0x27623800,
-0x24660020, 0xc2102b, 0x50400001, 0x27663000,
-0x8f820128, 0x10c20004, 0x0, 0x8f820124,
-0x14c20007, 0x0, 0x8ee201a4, 0x3021,
-0x24420001, 0xaee201a4, 0x8001351, 0x8ee201a4,
-0x8ee20608, 0xac62001c, 0x8ee404a0, 0x8ee504a4,
-0x2462001c, 0xac620008, 0x24020008, 0xa462000e,
-0x24020011, 0xac620018, 0xac640000, 0xac650004,
-0x8ee204c4, 0xac620010, 0xaf860120, 0x92e24e20,
-0x14400037, 0x24060001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c830000, 0x24020012,
-0x1462001f, 0x0, 0x8ee34e30, 0x8ee24e34,
-0x1062001b, 0x24030040, 0x8c820004, 0x24420001,
-0xac820004, 0x8ee24e34, 0x8ee54e30, 0x24420001,
-0x10430007, 0x0, 0x8ee24e34, 0x24420001,
-0x10a20005, 0x0, 0x800133b, 0x0,
-0x14a00005, 0x0, 0x8f820128, 0x24420020,
-0xaf820128, 0x8f820128, 0x8c820004, 0x2c420011,
-0x50400013, 0xac800000, 0x8001351, 0x0,
-0x8ee24e30, 0x24030040, 0x24420001, 0x50430003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x24020012, 0xac820000, 0x24020001, 0xac820004,
-0x14c0001b, 0x0, 0x3c040001, 0x248451d0,
-0xafa00010, 0xafa00014, 0x8ee60608, 0x8f470228,
-0x3c050009, 0xc002403, 0x34a5f001, 0x8ee201b0,
-0x24420001, 0xaee201b0, 0x800136d, 0x8ee201b0,
-0x3c040001, 0x248451dc, 0xafa00014, 0x8ee60608,
-0x8f470228, 0x3c050009, 0xc002403, 0x34a5f005,
-0x8ee201ac, 0x24420001, 0xaee201ac, 0x8ee201ac,
-0x8ee20160, 0x3c040001, 0x248451e8, 0x3405f002,
-0x24420001, 0xaee20160, 0x8ee20160, 0x3021,
-0x3821, 0xafa00010, 0xc002403, 0xafa00014,
-0x96e6047a, 0x96e7046a, 0x3c040001, 0x24845200,
-0x24050012, 0xafa00010, 0xc002403, 0xafa00014,
-0xc004500, 0x0, 0xc002318, 0x0,
-0x3c060001, 0x34c63800, 0xaee00608, 0xaf400228,
-0xaf40022c, 0x96e30458, 0x8ee40000, 0x3c0512d8,
-0x34a5c358, 0x27623800, 0xaee27258, 0x27623800,
-0xaee27260, 0x27623800, 0xaee27264, 0x3661021,
-0xaee27270, 0x2402ffff, 0xaee004d4, 0xaee004e0,
-0xaee004e4, 0xaee004f0, 0xa2e004f4, 0xaee00e0c,
-0xaee00e18, 0xaee00e10, 0xaee00e14, 0xaee00e1c,
-0xaee0724c, 0xaee05244, 0xaee05240, 0xaee0523c,
-0xaee07250, 0xaee07254, 0xaee0725c, 0xaee07268,
-0xaee004d0, 0x2463ffff, 0x852025, 0xaee304f8,
-0xaee40000, 0xaf800060, 0xaf820064, 0x3c020100,
-0xafa20018, 0x8ee20608, 0x8f430228, 0x24420001,
-0x304900ff, 0x512300e2, 0xafa00010, 0x8ee20608,
-0x210c0, 0x571021, 0x8fa30018, 0x8fa4001c,
-0xac43060c, 0xac440610, 0x8f870120, 0x27623800,
-0x24e80020, 0x102102b, 0x50400001, 0x27683000,
-0x8f820128, 0x11020004, 0x0, 0x8f820124,
-0x15020007, 0x1021, 0x8ee201a4, 0x3021,
-0x24420001, 0xaee201a4, 0x8001422, 0x8ee201a4,
-0x8ee40608, 0x420c0, 0x801821, 0x8ee40430,
-0x8ee50434, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xace40000, 0xace50004, 0x8ee30608,
-0x24020008, 0xa4e2000e, 0x2402000d, 0xace20018,
-0xace9001c, 0x318c0, 0x2463060c, 0x2e31021,
-0xace20008, 0x8ee204c4, 0xace20010, 0xaf880120,
-0x92e24e20, 0x14400037, 0x24060001, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x8c830000,
-0x24020007, 0x1462001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x24030040, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee54e30,
-0x24420001, 0x10430007, 0x0, 0x8ee24e34,
-0x24420001, 0x10a20005, 0x0, 0x800140c,
-0x0, 0x14a00005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400013, 0xac800000, 0x8001422,
-0x0, 0x8ee24e30, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x24020007, 0xac820000, 0x24020001,
-0xac820004, 0x54c0000c, 0xaee90608, 0x3c040001,
-0x248451c8, 0xafa00010, 0xafa00014, 0x8ee60608,
-0x8f470228, 0x3c050009, 0xc002403, 0x34a5f000,
-0x80014a5, 0x0, 0x8f830120, 0x27623800,
-0x24660020, 0xc2102b, 0x50400001, 0x27663000,
-0x8f820128, 0x10c20004, 0x0, 0x8f820124,
-0x14c20007, 0x0, 0x8ee201a4, 0x3021,
-0x24420001, 0xaee201a4, 0x8001489, 0x8ee201a4,
-0x8ee20608, 0xac62001c, 0x8ee404a0, 0x8ee504a4,
-0x2462001c, 0xac620008, 0x24020008, 0xa462000e,
-0x24020011, 0xac620018, 0xac640000, 0xac650004,
-0x8ee204c4, 0xac620010, 0xaf860120, 0x92e24e20,
-0x14400037, 0x24060001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c830000, 0x24020012,
-0x1462001f, 0x0, 0x8ee34e30, 0x8ee24e34,
-0x1062001b, 0x24030040, 0x8c820004, 0x24420001,
-0xac820004, 0x8ee24e34, 0x8ee54e30, 0x24420001,
-0x10430007, 0x0, 0x8ee24e34, 0x24420001,
-0x10a20005, 0x0, 0x8001473, 0x0,
-0x14a00005, 0x0, 0x8f820128, 0x24420020,
-0xaf820128, 0x8f820128, 0x8c820004, 0x2c420011,
-0x50400013, 0xac800000, 0x8001489, 0x0,
-0x8ee24e30, 0x24030040, 0x24420001, 0x50430003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x24020012, 0xac820000, 0x24020001, 0xac820004,
-0x14c0001b, 0x0, 0x3c040001, 0x248451d0,
-0xafa00010, 0xafa00014, 0x8ee60608, 0x8f470228,
-0x3c050009, 0xc002403, 0x34a5f001, 0x8ee201b0,
-0x24420001, 0xaee201b0, 0x80014a5, 0x8ee201b0,
-0x3c040001, 0x248451dc, 0xafa00014, 0x8ee60608,
-0x8f470228, 0x3c050009, 0xc002403, 0x34a5f005,
-0x8ee201ac, 0x24420001, 0xaee201ac, 0x8ee201ac,
-0x8ee20154, 0x24420001, 0xaee20154, 0xc0014dc,
-0x8ee20154, 0x8f8200a0, 0x30420004, 0x1440fffd,
-0x0, 0x8f820040, 0x30420001, 0x14400008,
-0x0, 0x8f430104, 0x24020001, 0x10620004,
-0x0, 0x8f420264, 0x10400006, 0x0,
-0x8ee2017c, 0x24420001, 0xaee2017c, 0x80014c5,
-0x8ee2017c, 0x8f820044, 0x34420004, 0xaf820044,
-0x8ee20178, 0x24420001, 0xaee20178, 0x8ee20178,
-0x8f8200d8, 0x8f8300d4, 0x431023, 0xaee2726c,
-0x8ee2726c, 0x1c400003, 0x3c030001, 0x431021,
-0xaee2726c, 0xc004064, 0x0, 0xc004440,
-0xaf800228, 0x8fbf0024, 0x8fb00020, 0x3e00008,
-0x27bd0028, 0x3e00008, 0x0, 0x3e00008,
-0x0, 0x0, 0x0, 0x2402002c,
-0xaf820050, 0xaee07274, 0x8f420238, 0xaee27278,
-0x8f820054, 0x24420067, 0xaf820058, 0xaee07b88,
-0xaee07b8c, 0xaee07b84, 0x3c010001, 0x370821,
-0xac2083bc, 0x3c010001, 0x370821, 0x3e00008,
-0xa02083b9, 0x27bdffd8, 0xafbf0024, 0xafb00020,
-0x8f820054, 0x3c030001, 0x8c635cd8, 0x24420067,
-0x1060000d, 0xaf820058, 0x3c020001, 0x571021,
-0x904283b8, 0x10400005, 0x3c030200, 0x3c010001,
-0x370821, 0x8001503, 0xa02083b8, 0x8ee20000,
-0x431025, 0xaee20000, 0x8f420218, 0x30420100,
-0x104000c6, 0x0, 0x8f8200b0, 0x30420004,
-0x104000c2, 0x0, 0x3c030001, 0x771821,
-0x8c6383d0, 0x8f820104, 0x146200b4, 0x0,
-0x3c030001, 0x771821, 0x8c6383d4, 0x8f8200b4,
-0x146200ae, 0x0, 0x8f8200b0, 0x3c030080,
-0x431024, 0x1040000d, 0x0, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f8200b0, 0x2403fffb,
-0x431024, 0xaf8200b0, 0x8f82011c, 0x2403fffd,
-0x431024, 0x80015cc, 0xaf82011c, 0x3c030001,
-0x771821, 0x8c6383d0, 0x8f820104, 0x14620082,
-0x0, 0x3c030001, 0x771821, 0x8c6383d4,
-0x8f8200b4, 0x1462007c, 0x0, 0x3c070001,
-0xf73821, 0x8ce783d0, 0x8f8200b0, 0x3c040001,
-0x24845270, 0xafa00014, 0xafa20010, 0x8f8600b0,
-0x3c050005, 0xc002403, 0x34a50900, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f830104, 0x8f8200b0,
-0x34420001, 0xaf8200b0, 0xaf830104, 0x8f830120,
-0x27623800, 0x24660020, 0xc2102b, 0x50400001,
-0x27663000, 0x8f820128, 0x10c20004, 0x0,
-0x8f820124, 0x14c20006, 0x0, 0x8ee201a4,
-0x24420001, 0xaee201a4, 0x80015a0, 0x8ee201a4,
-0x8f440208, 0x8f45020c, 0x26e20030, 0xac620008,
-0x24020400, 0xa462000e, 0x2402000f, 0xac620018,
-0xac60001c, 0xac640000, 0xac650004, 0x8ee204c4,
-0xac620010, 0xaf860120, 0x92e24e20, 0x14400037,
-0x0, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8c830000, 0x24020007, 0x1462001f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062001b,
-0x24030040, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee54e30, 0x24420001, 0x10430007,
-0x0, 0x8ee24e34, 0x24420001, 0x10a20005,
-0x0, 0x800158a, 0x0, 0x14a00005,
-0x0, 0x8f820128, 0x24420020, 0xaf820128,
-0x8f820128, 0x8c820004, 0x2c420011, 0x50400013,
-0xac800000, 0x80015a0, 0x0, 0x8ee24e30,
-0x24030040, 0x24420001, 0x50430003, 0x1021,
-0x8ee24e30, 0x24420001, 0xaee24e30, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x24020007,
-0xac820000, 0x24020001, 0xac820004, 0x8f82011c,
-0x2403fffd, 0x431024, 0xaf82011c, 0x8ee201e4,
-0x3c070001, 0xf73821, 0x8ce783d0, 0x24420001,
-0xaee201e4, 0x8ee201e4, 0x3c040001, 0x2484527c,
-0x80015bd, 0xafa00010, 0x8f820104, 0x3c010001,
-0x370821, 0xac2283d0, 0x8f8200b4, 0x3c070001,
-0xf73821, 0x8ce783d0, 0x3c040001, 0x24845284,
-0x3c010001, 0x370821, 0xac2283d4, 0xafa00010,
-0xafa00014, 0x8f8600b0, 0x3c050005, 0xc002403,
-0x34a50900, 0x80015cc, 0x0, 0x8f820104,
-0x3c010001, 0x370821, 0xac2283d0, 0x8f8200b4,
-0x3c010001, 0x370821, 0xac2283d4, 0x8ee27274,
-0x92e304f4, 0x24420067, 0x14600006, 0xaee27274,
-0x8ee27274, 0x8f430234, 0x43102b, 0x1440007b,
-0x0, 0x8ee304e4, 0x8ee204f8, 0x14620004,
-0x0, 0x92e204f4, 0x50400074, 0xa2e004f4,
-0x8f830120, 0x27623800, 0x24660020, 0xc2102b,
-0x50400001, 0x27663000, 0x8f820128, 0x10c20004,
-0x0, 0x8f820124, 0x14c20007, 0x0,
-0x8ee201a4, 0x8021, 0x24420001, 0xaee201a4,
-0x8001637, 0x8ee201a4, 0x8ee204e4, 0xac62001c,
-0x8ee404b0, 0x8ee504b4, 0x2462001c, 0xac620008,
-0x24020008, 0xa462000e, 0x24020011, 0xac620018,
-0xac640000, 0xac650004, 0x8ee204c4, 0xac620010,
-0xaf860120, 0x92e24e20, 0x14400037, 0x24100001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c830000, 0x24020012, 0x1462001f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062001b, 0x24030040,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee54e30, 0x24420001, 0x10430007, 0x0,
-0x8ee24e34, 0x24420001, 0x10a20005, 0x0,
-0x8001621, 0x0, 0x14a00005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400013, 0xac800000,
-0x8001637, 0x0, 0x8ee24e30, 0x24030040,
-0x24420001, 0x50430003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x24020012, 0xac820000,
-0x24020001, 0xac820004, 0x5600000b, 0x24100001,
-0x8ee204e4, 0x3c040001, 0x2484528c, 0xafa00014,
-0xafa20010, 0x8ee60608, 0x8f470228, 0x3c050009,
-0xc002403, 0x34a5f006, 0x16000003, 0x24020001,
-0x8001650, 0xa2e204f4, 0x8ee20170, 0x24420001,
-0xaee20170, 0x8ee20170, 0x8ee204e4, 0xa2e004f4,
-0xaee004f0, 0xaee07274, 0xaee204f8, 0x8ee20e1c,
-0x1040006d, 0x0, 0x8f830120, 0x27623800,
-0x24660020, 0xc2102b, 0x50400001, 0x27663000,
-0x8f820128, 0x10c20004, 0x0, 0x8f820124,
-0x14c20007, 0x0, 0x8ee201a4, 0x8021,
-0x24420001, 0xaee201a4, 0x80016ad, 0x8ee201a4,
-0x8ee2724c, 0xac62001c, 0x8ee404a8, 0x8ee504ac,
-0x2462001c, 0xac620008, 0x24020008, 0xa462000e,
-0x24020011, 0xac620018, 0xac640000, 0xac650004,
-0x8ee204c4, 0xac620010, 0xaf860120, 0x92e24e20,
-0x14400037, 0x24100001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c830000, 0x24020012,
-0x1462001f, 0x0, 0x8ee34e30, 0x8ee24e34,
-0x1062001b, 0x24030040, 0x8c820004, 0x24420001,
-0xac820004, 0x8ee24e34, 0x8ee54e30, 0x24420001,
-0x10430007, 0x0, 0x8ee24e34, 0x24420001,
-0x10a20005, 0x0, 0x8001697, 0x0,
-0x14a00005, 0x0, 0x8f820128, 0x24420020,
-0xaf820128, 0x8f820128, 0x8c820004, 0x2c420011,
-0x50400013, 0xac800000, 0x80016ad, 0x0,
-0x8ee24e30, 0x24030040, 0x24420001, 0x50430003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x24020012, 0xac820000, 0x24020001, 0xac820004,
-0x5600000b, 0x24100001, 0x8ee2724c, 0x3c040001,
-0x24845298, 0xafa00014, 0xafa20010, 0x8ee6724c,
-0x8f470280, 0x3c050009, 0xc002403, 0x34a5f008,
-0x56000001, 0xaee00e1c, 0x8ee20174, 0x24420001,
-0xaee20174, 0x8ee20174, 0x8ee24e24, 0x10400019,
-0x0, 0xaee04e24, 0x8f820040, 0x30420001,
-0x14400008, 0x0, 0x8f430104, 0x24020001,
-0x10620004, 0x0, 0x8f420264, 0x10400006,
-0x0, 0x8ee2017c, 0x24420001, 0xaee2017c,
-0x80016da, 0x8ee2017c, 0x8f820044, 0x34420004,
-0xaf820044, 0x8ee20178, 0x24420001, 0xaee20178,
-0x8ee20178, 0x8ee27278, 0x2442ff99, 0xaee27278,
-0x8ee27278, 0x1c4002ad, 0x0, 0x8f420238,
-0x104002aa, 0x0, 0x3c020001, 0x571021,
-0x904283e0, 0x144002a5, 0x0, 0x8f420080,
-0xaee2004c, 0x8f4200c0, 0xaee20048, 0x8f420084,
-0xaee20038, 0x8f420084, 0xaee20244, 0x8f420088,
-0xaee20248, 0x8f42008c, 0xaee2024c, 0x8f420090,
-0xaee20250, 0x8f420094, 0xaee20254, 0x8f420098,
-0xaee20258, 0x8f42009c, 0xaee2025c, 0x8f4200a0,
-0xaee20260, 0x8f4200a4, 0xaee20264, 0x8f4200a8,
-0xaee20268, 0x8f4200ac, 0xaee2026c, 0x8f4200b0,
-0xaee20270, 0x8f4200b4, 0xaee20274, 0x8f4200b8,
-0xaee20278, 0x8f4200bc, 0x24040001, 0xaee2027c,
-0xaee0003c, 0x41080, 0x571021, 0x8ee3003c,
-0x8c420244, 0x24840001, 0x621821, 0x2c82000f,
-0xaee3003c, 0x1440fff8, 0x41080, 0x8f4200cc,
-0xaee20050, 0x8f4200d0, 0xaee20054, 0x8f830120,
-0x27623800, 0x24660020, 0xc2102b, 0x50400001,
-0x27663000, 0x8f820128, 0x10c20004, 0x0,
-0x8f820124, 0x14c20007, 0x0, 0x8ee201a4,
-0x8021, 0x24420001, 0xaee201a4, 0x8001775,
-0x8ee201a4, 0x8f440208, 0x8f45020c, 0x26e20030,
-0xac620008, 0x24020400, 0xa462000e, 0x2402000f,
-0xac620018, 0xac60001c, 0xac640000, 0xac650004,
-0x8ee204c4, 0xac620010, 0xaf860120, 0x92e24e20,
-0x14400037, 0x24100001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c830000, 0x24020007,
-0x1462001f, 0x0, 0x8ee34e30, 0x8ee24e34,
-0x1062001b, 0x24030040, 0x8c820004, 0x24420001,
-0xac820004, 0x8ee24e34, 0x8ee54e30, 0x24420001,
-0x10430007, 0x0, 0x8ee24e34, 0x24420001,
-0x10a20005, 0x0, 0x800175f, 0x0,
-0x14a00005, 0x0, 0x8f820128, 0x24420020,
-0xaf820128, 0x8f820128, 0x8c820004, 0x2c420011,
-0x50400013, 0xac800000, 0x8001775, 0x0,
-0x8ee24e30, 0x24030040, 0x24420001, 0x50430003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x24020007, 0xac820000, 0x24020001, 0xac820004,
-0x12000212, 0x3c020400, 0xafa20018, 0x3c020001,
-0x571021, 0x904283b0, 0x1040010b, 0x0,
-0x8ee20608, 0x8f430228, 0x24420001, 0x304a00ff,
-0x514300fd, 0xafa00010, 0x8ee20608, 0x210c0,
-0x571021, 0x8fa30018, 0x8fa4001c, 0xac43060c,
-0xac440610, 0x8f830054, 0x8f820054, 0x24690032,
-0x1221023, 0x2c420033, 0x1040006a, 0x5821,
-0x24180008, 0x240f000d, 0x240d0007, 0x240c0040,
-0x240e0001, 0x8f870120, 0x27623800, 0x24e80020,
-0x102102b, 0x50400001, 0x27683000, 0x8f820128,
-0x11020004, 0x0, 0x8f820124, 0x15020007,
-0x1021, 0x8ee201a4, 0x8021, 0x24420001,
-0xaee201a4, 0x80017f3, 0x8ee201a4, 0x8ee40608,
-0x420c0, 0x801821, 0x8ee40430, 0x8ee50434,
-0xa32821, 0xa3302b, 0x822021, 0x862021,
-0xace40000, 0xace50004, 0x8ee20608, 0xa4f8000e,
-0xacef0018, 0xacea001c, 0x210c0, 0x2442060c,
-0x2e21021, 0xace20008, 0x8ee204c4, 0xace20010,
-0xaf880120, 0x92e24e20, 0x14400033, 0x24100001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c820000, 0x144d001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x0, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee34e30,
-0x24420001, 0x104c0007, 0x0, 0x8ee24e34,
-0x24420001, 0x10620005, 0x0, 0x80017e0,
-0x0, 0x14600005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400010, 0xac800000, 0x80017f3,
-0x0, 0x8ee24e30, 0x24420001, 0x504c0003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0xac8d0000, 0xac8e0004, 0x56000006, 0x240b0001,
-0x8f820054, 0x1221023, 0x2c420033, 0x1440ff9d,
-0x0, 0x316300ff, 0x24020001, 0x14620077,
-0x3c050009, 0xaeea0608, 0x8f830054, 0x8f820054,
-0x24690032, 0x1221023, 0x2c420033, 0x10400061,
-0x5821, 0x240d0008, 0x240c0011, 0x24080012,
-0x24070040, 0x240a0001, 0x8f830120, 0x27623800,
-0x24660020, 0xc2102b, 0x50400001, 0x27663000,
-0x8f820128, 0x10c20004, 0x0, 0x8f820124,
-0x14c20007, 0x0, 0x8ee201a4, 0x8021,
-0x24420001, 0xaee201a4, 0x800185f, 0x8ee201a4,
-0x8ee20608, 0xac62001c, 0x8ee404a0, 0x8ee504a4,
-0x2462001c, 0xac620008, 0xa46d000e, 0xac6c0018,
-0xac640000, 0xac650004, 0x8ee204c4, 0xac620010,
-0xaf860120, 0x92e24e20, 0x14400033, 0x24100001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c820000, 0x1448001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x0, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee34e30,
-0x24420001, 0x10470007, 0x0, 0x8ee24e34,
-0x24420001, 0x10620005, 0x0, 0x800184c,
-0x0, 0x14600005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400010, 0xac800000, 0x800185f,
-0x0, 0x8ee24e30, 0x24420001, 0x50470003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0xac880000, 0xac8a0004, 0x56000006, 0x240b0001,
-0x8f820054, 0x1221023, 0x2c420033, 0x1440ffa6,
-0x0, 0x316300ff, 0x24020001, 0x14620003,
-0x3c050009, 0x800197c, 0x24100001, 0x3c040001,
-0x248452a4, 0xafa00010, 0xafa00014, 0x8f860120,
-0x8f870124, 0x800187b, 0x34a5f011, 0x3c040001,
-0x248452b0, 0xafa00010, 0xafa00014, 0x8f860120,
-0x8f870124, 0x34a5f010, 0xc002403, 0x8021,
-0x800197c, 0x0, 0x3c040001, 0x248452bc,
-0xafa00014, 0x8ee60608, 0x8f470228, 0x3c050009,
-0x8001975, 0x34a5f00f, 0x8ee20608, 0x8f430228,
-0x24420001, 0x304900ff, 0x512300e2, 0xafa00010,
-0x8ee20608, 0x210c0, 0x571021, 0x8fa30018,
-0x8fa4001c, 0xac43060c, 0xac440610, 0x8f870120,
-0x27623800, 0x24e80020, 0x102102b, 0x50400001,
-0x27683000, 0x8f820128, 0x11020004, 0x0,
-0x8f820124, 0x15020007, 0x1021, 0x8ee201a4,
-0x8021, 0x24420001, 0xaee201a4, 0x80018f7,
-0x8ee201a4, 0x8ee40608, 0x420c0, 0x801821,
-0x8ee40430, 0x8ee50434, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0xace40000, 0xace50004,
-0x8ee30608, 0x24020008, 0xa4e2000e, 0x2402000d,
-0xace20018, 0xace9001c, 0x318c0, 0x2463060c,
-0x2e31021, 0xace20008, 0x8ee204c4, 0xace20010,
-0xaf880120, 0x92e24e20, 0x14400037, 0x24100001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c830000, 0x24020007, 0x1462001f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062001b, 0x24030040,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee54e30, 0x24420001, 0x10430007, 0x0,
-0x8ee24e34, 0x24420001, 0x10a20005, 0x0,
-0x80018e1, 0x0, 0x14a00005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400013, 0xac800000,
-0x80018f7, 0x0, 0x8ee24e30, 0x24030040,
-0x24420001, 0x50430003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x24020007, 0xac820000,
-0x24020001, 0xac820004, 0x5600000c, 0xaee90608,
-0x3c040001, 0x248452c8, 0xafa00010, 0xafa00014,
-0x8ee60608, 0x8f470228, 0x3c050009, 0xc002403,
-0x34a5f000, 0x800197c, 0x0, 0x8f830120,
-0x27623800, 0x24660020, 0xc2102b, 0x50400001,
-0x27663000, 0x8f820128, 0x10c20004, 0x0,
-0x8f820124, 0x14c20007, 0x0, 0x8ee201a4,
-0x8021, 0x24420001, 0xaee201a4, 0x800195e,
-0x8ee201a4, 0x8ee20608, 0xac62001c, 0x8ee404a0,
-0x8ee504a4, 0x2462001c, 0xac620008, 0x24020008,
-0xa462000e, 0x24020011, 0xac620018, 0xac640000,
-0xac650004, 0x8ee204c4, 0xac620010, 0xaf860120,
-0x92e24e20, 0x14400037, 0x24100001, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x8c830000,
-0x24020012, 0x1462001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x24030040, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee54e30,
-0x24420001, 0x10430007, 0x0, 0x8ee24e34,
-0x24420001, 0x10a20005, 0x0, 0x8001948,
-0x0, 0x14a00005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400013, 0xac800000, 0x800195e,
-0x0, 0x8ee24e30, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x24020012, 0xac820000, 0x24020001,
-0xac820004, 0x5600001d, 0x24100001, 0x3c040001,
-0x248452d0, 0xafa00010, 0xafa00014, 0x8ee60608,
-0x8f470228, 0x3c050009, 0xc002403, 0x34a5f001,
-0x8ee201b0, 0x24420001, 0xaee201b0, 0x800197c,
-0x8ee201b0, 0x3c040001, 0x248452dc, 0xafa00014,
-0x8ee60608, 0x8f470228, 0x3c050009, 0x34a5f005,
-0xc002403, 0x0, 0x8ee201ac, 0x8021,
-0x24420001, 0xaee201ac, 0x8ee201ac, 0x1200000c,
-0x24020001, 0x3c010001, 0x370821, 0xa02083b0,
-0x8f420238, 0x8ee30158, 0x24630001, 0xaee30158,
-0x8ee30158, 0x800198c, 0xaee27278, 0x24020001,
-0x3c010001, 0x370821, 0xa02283b0, 0x3c020001,
-0x8c425cd8, 0x10400187, 0x0, 0x8ee27b84,
-0x24430001, 0x284200c9, 0x144001a4, 0xaee37b84,
-0x8ee204d4, 0x30420002, 0x14400119, 0xaee07b84,
-0x8ee204d4, 0x3c030600, 0x34631000, 0x34420002,
-0xaee204d4, 0xafa30018, 0x8ee20608, 0x8f430228,
-0x24420001, 0x304a00ff, 0x514300fd, 0xafa00010,
-0x8ee20608, 0x210c0, 0x571021, 0x8fa30018,
-0x8fa4001c, 0xac43060c, 0xac440610, 0x8f830054,
-0x8f820054, 0x24690032, 0x1221023, 0x2c420033,
-0x1040006a, 0x5821, 0x24180008, 0x240f000d,
-0x240d0007, 0x240c0040, 0x240e0001, 0x8f870120,
-0x27623800, 0x24e80020, 0x102102b, 0x50400001,
-0x27683000, 0x8f820128, 0x11020004, 0x0,
-0x8f820124, 0x15020007, 0x1021, 0x8ee201a4,
-0x8021, 0x24420001, 0xaee201a4, 0x8001a15,
-0x8ee201a4, 0x8ee40608, 0x420c0, 0x801821,
-0x8ee40430, 0x8ee50434, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0xace40000, 0xace50004,
-0x8ee20608, 0xa4f8000e, 0xacef0018, 0xacea001c,
-0x210c0, 0x2442060c, 0x2e21021, 0xace20008,
-0x8ee204c4, 0xace20010, 0xaf880120, 0x92e24e20,
-0x14400033, 0x24100001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c820000, 0x144d001f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062001b,
-0x0, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee34e30, 0x24420001, 0x104c0007,
-0x0, 0x8ee24e34, 0x24420001, 0x10620005,
-0x0, 0x8001a02, 0x0, 0x14600005,
-0x0, 0x8f820128, 0x24420020, 0xaf820128,
-0x8f820128, 0x8c820004, 0x2c420011, 0x50400010,
-0xac800000, 0x8001a15, 0x0, 0x8ee24e30,
-0x24420001, 0x504c0003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0xac8d0000, 0xac8e0004,
-0x56000006, 0x240b0001, 0x8f820054, 0x1221023,
-0x2c420033, 0x1440ff9d, 0x0, 0x316300ff,
-0x24020001, 0x54620078, 0xafa00010, 0xaeea0608,
-0x8f830054, 0x8f820054, 0x24690032, 0x1221023,
-0x2c420033, 0x10400061, 0x5821, 0x240d0008,
-0x240c0011, 0x24080012, 0x24070040, 0x240a0001,
-0x8f830120, 0x27623800, 0x24660020, 0xc2102b,
-0x50400001, 0x27663000, 0x8f820128, 0x10c20004,
-0x0, 0x8f820124, 0x14c20007, 0x0,
-0x8ee201a4, 0x8021, 0x24420001, 0xaee201a4,
-0x8001a81, 0x8ee201a4, 0x8ee20608, 0xac62001c,
-0x8ee404a0, 0x8ee504a4, 0x2462001c, 0xac620008,
-0xa46d000e, 0xac6c0018, 0xac640000, 0xac650004,
-0x8ee204c4, 0xac620010, 0xaf860120, 0x92e24e20,
-0x14400033, 0x24100001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c820000, 0x1448001f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062001b,
-0x0, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee34e30, 0x24420001, 0x10470007,
-0x0, 0x8ee24e34, 0x24420001, 0x10620005,
-0x0, 0x8001a6e, 0x0, 0x14600005,
-0x0, 0x8f820128, 0x24420020, 0xaf820128,
-0x8f820128, 0x8c820004, 0x2c420011, 0x50400010,
-0xac800000, 0x8001a81, 0x0, 0x8ee24e30,
-0x24420001, 0x50470003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0xac880000, 0xac8a0004,
-0x56000006, 0x240b0001, 0x8f820054, 0x1221023,
-0x2c420033, 0x1440ffa6, 0x0, 0x316300ff,
-0x24020001, 0x10620022, 0x0, 0x3c040001,
-0x248452a4, 0xafa00010, 0xafa00014, 0x8f860120,
-0x8f870124, 0x3c050009, 0xc002403, 0x34a5f011,
-0x8001aad, 0x0, 0x3c040001, 0x248452b0,
-0xafa00014, 0x8f860120, 0x8f870124, 0x3c050009,
-0xc002403, 0x34a5f010, 0x8001aad, 0x0,
-0x3c040001, 0x248452bc, 0xafa00014, 0x8ee60608,
-0x8f470228, 0x3c050009, 0xc002403, 0x34a5f00f,
-0x8ee201ac, 0x24420001, 0xaee201ac, 0x8ee201ac,
-0x8ee2015c, 0x24420001, 0xaee2015c, 0x8ee2015c,
-0x8ee204d4, 0x30420001, 0x10400055, 0x0,
-0x8f420218, 0x30420080, 0x10400029, 0x0,
-0x8f820044, 0x34420040, 0xaf820044, 0x8ee27b7c,
-0x402821, 0x8ee200c0, 0x8ee300c4, 0x24060000,
-0x2407ffff, 0x2021, 0x461024, 0x1444000d,
-0x671824, 0x1465000b, 0x0, 0x8ee27b80,
-0x402821, 0x8ee200e0, 0x8ee300e4, 0x2021,
-0x461024, 0x14440003, 0x671824, 0x1065000b,
-0x0, 0x8ee200c0, 0x8ee300c4, 0x8ee400e0,
-0x8ee500e4, 0xaee37b7c, 0xaee57b80, 0x8f820044,
-0x38420020, 0x8001b38, 0xaf820044, 0x8f820044,
-0x2403ffdf, 0x431024, 0x8001b38, 0xaf820044,
-0x8f820044, 0x2403ffdf, 0x431024, 0xaf820044,
-0x8ee27b7c, 0x402821, 0x8ee200c0, 0x8ee300c4,
-0x24060000, 0x2407ffff, 0x2021, 0x461024,
-0x1444000d, 0x671824, 0x1465000b, 0x0,
-0x8ee27b80, 0x402821, 0x8ee200e0, 0x8ee300e4,
-0x2021, 0x461024, 0x14440003, 0x671824,
-0x1065000b, 0x0, 0x8ee200c0, 0x8ee300c4,
-0x8ee400e0, 0x8ee500e4, 0xaee37b7c, 0xaee57b80,
-0x8f820044, 0x38420040, 0x8001b38, 0xaf820044,
-0x8f820044, 0x34420040, 0x8001b38, 0xaf820044,
-0x8f820044, 0x34420040, 0xaf820044, 0x8ee27b8c,
-0x24430001, 0x28420015, 0x14400028, 0xaee37b8c,
-0x8f820044, 0x38420020, 0xaf820044, 0x8001b38,
-0xaee07b8c, 0x8ee204d4, 0x30420001, 0x10400011,
-0x0, 0x8f420218, 0x30420080, 0x10400009,
-0x0, 0x8f820044, 0x34420020, 0xaf820044,
-0x8f820044, 0x2403ffbf, 0x431024, 0x8001b36,
-0xaf820044, 0x8f820044, 0x34420060, 0x8001b36,
-0xaf820044, 0x8f820044, 0x34420040, 0xaf820044,
-0x8ee27b88, 0x24430001, 0x28421389, 0x14400005,
-0xaee37b88, 0x8f820044, 0x38420020, 0xaf820044,
-0xaee07b88, 0xc004603, 0x0, 0x8fbf0024,
-0x8fb00020, 0x3e00008, 0x27bd0028, 0x27bdffb8,
-0xafbf0044, 0xafb60040, 0xafb5003c, 0xafb40038,
-0xafb30034, 0xafb20030, 0xafb1002c, 0xafb00028,
-0x8f960064, 0x32c20004, 0x1040000c, 0x24020004,
-0xaf820064, 0x8f420114, 0xaee204e0, 0x8f820060,
-0x34420008, 0xaf820060, 0x8ee2016c, 0x24420001,
-0xaee2016c, 0x80022f4, 0x8ee2016c, 0x32c20001,
-0x10400004, 0x24020001, 0xaf820064, 0x80022f4,
-0x0, 0x32c20002, 0x1440000c, 0x3c050003,
-0x3c040001, 0x24845354, 0x34a50001, 0x2c03021,
-0x3821, 0xafa00010, 0xc002403, 0xafa00014,
-0x2402fff8, 0x80022f4, 0xaf820064, 0x8f43022c,
-0x8f42010c, 0x5062000c, 0xafa00010, 0x8f42022c,
-0x21080, 0x5a1021, 0x8c420300, 0xafa20020,
-0x8f42022c, 0x24070001, 0x24420001, 0x3042003f,
-0x8001b80, 0xaf42022c, 0x3c040001, 0x24845360,
-0xafa00014, 0x8f46022c, 0x8f47010c, 0x3c050003,
-0xc002403, 0x34a5f01f, 0x3821, 0x14e00003,
-0x0, 0x80022ed, 0xaf960064, 0x93a20020,
-0x2443ffff, 0x2c620011, 0x10400658, 0x31080,
-0x3c010001, 0x220821, 0x8c225418, 0x400008,
-0x0, 0x8fa20020, 0x30420fff, 0xaee20e0c,
-0x8f820060, 0x34420200, 0xaf820060, 0x8ee20118,
-0x24420001, 0xaee20118, 0x80022e8, 0x8ee20118,
-0x8fa20020, 0x24030001, 0x3c010001, 0x370821,
-0xa02383b1, 0x30420fff, 0xaee25238, 0x8f820060,
-0x34420100, 0xaf820060, 0x8ee20144, 0x24420001,
-0xaee20144, 0x80022e8, 0x8ee20144, 0x8fa20020,
-0x21200, 0x22502, 0x24020001, 0x10820005,
-0x24020002, 0x10820009, 0x2402fffe, 0x8001bc9,
-0xafa00010, 0x8ee204d4, 0xaee40070, 0xaee40074,
-0x34420001, 0x8001bbd, 0xaee204d4, 0x8ee304d4,
-0xaee40070, 0xaee40074, 0x621824, 0xaee304d4,
-0x8f840054, 0x41442, 0x41c82, 0x431021,
-0x41cc2, 0x431023, 0x41d02, 0x431021,
-0x41d42, 0x431023, 0x8001bd0, 0xaee20078,
-0x3c040001, 0x2484536c, 0xafa00014, 0x8fa60020,
-0x3c050003, 0xc002403, 0x34a50004, 0x8ee20110,
-0x24420001, 0xaee20110, 0x80022e8, 0x8ee20110,
-0x27440212, 0xc0022fe, 0x24050006, 0x3049001f,
-0x920c0, 0x2e41021, 0x9442727c, 0x30424000,
-0x1040000a, 0x971021, 0x97430212, 0xa443727e,
-0x8f430214, 0x971021, 0xac437280, 0x2e41821,
-0x34028000, 0x8001c79, 0xa462727c, 0x9443727e,
-0x97420212, 0x14620006, 0x2e41021, 0x971021,
-0x8c437280, 0x8f420214, 0x1062009f, 0x2e41021,
-0x9442727c, 0x30428000, 0x1040002a, 0x2406ffff,
-0x2021, 0x410c0, 0x2e21021, 0x9442737c,
-0x30424000, 0x54400005, 0x803021, 0x24840001,
-0x2c820080, 0x1440fff8, 0x410c0, 0x4c10010,
-0x618c0, 0x610c0, 0x571821, 0x8c63737c,
-0x571021, 0xafa30010, 0x8c427380, 0x3c040001,
-0x24845378, 0xafa20014, 0x8f470214, 0x3c050003,
-0xc002403, 0x34a50013, 0x8001c90, 0x3c020800,
-0x97440212, 0x771021, 0xa444737e, 0x8f440214,
-0x771021, 0x2e31821, 0xac447380, 0x34028000,
-0xa462737c, 0x910c0, 0x2e21021, 0x8001c79,
-0xa446727c, 0x2e41021, 0x9445727c, 0x8001c2e,
-0x510c0, 0x9443737e, 0x97420212, 0x14620006,
-0x510c0, 0x971021, 0x8c437380, 0x8f420214,
-0x10620065, 0x510c0, 0x2e21021, 0x9445737c,
-0x510c0, 0x2e21021, 0x9442737c, 0x30428000,
-0x1040fff0, 0x971021, 0x520c0, 0x971021,
-0x9443737e, 0x97420212, 0x14620006, 0x2406ffff,
-0x971021, 0x8c437380, 0x8f420214, 0x10620053,
-0x3c020800, 0x2021, 0x410c0, 0x2e21021,
-0x9442737c, 0x30424000, 0x54400005, 0x803021,
-0x24840001, 0x2c820080, 0x1440fff8, 0x410c0,
-0x4c10023, 0x618c0, 0x910c0, 0x571821,
-0x8c63727c, 0x571021, 0xafa30010, 0x8c427280,
-0x3c040001, 0x24845384, 0xafa20014, 0x8f470214,
-0x3c050003, 0xc002403, 0x34a5f017, 0x8001c90,
-0x3c020800, 0x8f430210, 0xb71021, 0xac43777c,
-0x8f430214, 0xb71021, 0xac437780, 0x3c020001,
-0x571021, 0x8c4283b4, 0x24420001, 0x3c010001,
-0x370821, 0xac2283b4, 0x3c030001, 0x771821,
-0x8c6383b4, 0x2e51021, 0x8001c82, 0xa443777c,
-0x97440212, 0x771021, 0xa444737e, 0x8f440214,
-0x771021, 0x2e31821, 0xac447380, 0x34028000,
-0xa462737c, 0x510c0, 0x2e21021, 0xa446737c,
-0x2021, 0x428c0, 0x2e51021, 0x9442777c,
-0x1040ffdc, 0x24840001, 0x2c820080, 0x5440fffa,
-0x428c0, 0x92e204d8, 0x10400006, 0x24020001,
-0x8ee304dc, 0x1221004, 0x621825, 0x8001c8f,
-0xaee304dc, 0x8f830228, 0x24020001, 0x1221004,
-0x621825, 0xaf830228, 0x3c020800, 0x34421000,
-0xafa20018, 0x8ee20608, 0x8f430228, 0x24420001,
-0x304a00ff, 0x514300fd, 0xafa00010, 0x8ee20608,
-0x210c0, 0x571021, 0x8fa30018, 0x8fa4001c,
-0xac43060c, 0xac440610, 0x8f830054, 0x8f820054,
-0x24690032, 0x1221023, 0x2c420033, 0x1040006a,
-0x5821, 0x24100008, 0x240f000d, 0x240d0007,
-0x240c0040, 0x240e0001, 0x8f870120, 0x27623800,
-0x24e80020, 0x102102b, 0x50400001, 0x27683000,
-0x8f820128, 0x11020004, 0x0, 0x8f820124,
-0x15020007, 0x1021, 0x8ee201a4, 0x3821,
-0x24420001, 0xaee201a4, 0x8001d08, 0x8ee201a4,
-0x8ee40608, 0x420c0, 0x801821, 0x8ee40430,
-0x8ee50434, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xace40000, 0xace50004, 0x8ee20608,
-0xa4f0000e, 0xacef0018, 0xacea001c, 0x210c0,
-0x2442060c, 0x2e21021, 0xace20008, 0x8ee204c4,
-0xace20010, 0xaf880120, 0x92e24e20, 0x14400033,
-0x24070001, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8c820000, 0x144d001f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062001b, 0x0,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee34e30, 0x24420001, 0x104c0007, 0x0,
-0x8ee24e34, 0x24420001, 0x10620005, 0x0,
-0x8001cf5, 0x0, 0x14600005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400010, 0xac800000,
-0x8001d08, 0x0, 0x8ee24e30, 0x24420001,
-0x504c0003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0xac8d0000, 0xac8e0004, 0x54e00006,
-0x240b0001, 0x8f820054, 0x1221023, 0x2c420033,
-0x1440ff9d, 0x0, 0x316300ff, 0x24020001,
-0x54620078, 0xafa00010, 0xaeea0608, 0x8f830054,
-0x8f820054, 0x24690032, 0x1221023, 0x2c420033,
-0x10400061, 0x5821, 0x240e0008, 0x240d0011,
-0x240a0012, 0x24080040, 0x240c0001, 0x8f830120,
-0x27623800, 0x24660020, 0xc2102b, 0x50400001,
-0x27663000, 0x8f820128, 0x10c20004, 0x0,
-0x8f820124, 0x14c20007, 0x0, 0x8ee201a4,
-0x3821, 0x24420001, 0xaee201a4, 0x8001d74,
-0x8ee201a4, 0x8ee20608, 0xac62001c, 0x8ee404a0,
-0x8ee504a4, 0x2462001c, 0xac620008, 0xa46e000e,
-0xac6d0018, 0xac640000, 0xac650004, 0x8ee204c4,
-0xac620010, 0xaf860120, 0x92e24e20, 0x14400033,
-0x24070001, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8c820000, 0x144a001f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062001b, 0x0,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee34e30, 0x24420001, 0x10480007, 0x0,
-0x8ee24e34, 0x24420001, 0x10620005, 0x0,
-0x8001d61, 0x0, 0x14600005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400010, 0xac800000,
-0x8001d74, 0x0, 0x8ee24e30, 0x24420001,
-0x50480003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0xac8a0000, 0xac8c0004, 0x54e00006,
-0x240b0001, 0x8f820054, 0x1221023, 0x2c420033,
-0x1440ffa6, 0x0, 0x316300ff, 0x24020001,
-0x10620022, 0x0, 0x3c040001, 0x24845390,
-0xafa00010, 0xafa00014, 0x8f860120, 0x8f870124,
-0x3c050009, 0xc002403, 0x34a5f011, 0x8001da0,
-0x0, 0x3c040001, 0x2484539c, 0xafa00014,
-0x8f860120, 0x8f870124, 0x3c050009, 0xc002403,
-0x34a5f010, 0x8001da0, 0x0, 0x3c040001,
-0x248453a8, 0xafa00014, 0x8ee60608, 0x8f470228,
-0x3c050009, 0xc002403, 0x34a5f00f, 0x8ee201ac,
-0x24420001, 0xaee201ac, 0x8ee201ac, 0x8ee20124,
-0x24420001, 0xaee20124, 0x8001f97, 0x8ee20124,
-0x27440212, 0xc0022fe, 0x24050006, 0x3049001f,
-0x928c0, 0x2e51021, 0x9442727c, 0x30428000,
-0x1040002f, 0x2e51021, 0x9442727c, 0x30424000,
-0x1440001c, 0xb71021, 0x9443727e, 0x97420212,
-0x14620018, 0xb71021, 0x8c437280, 0x8f420214,
-0x54620016, 0xafa20010, 0x92e204d8, 0x10400007,
-0x24020001, 0x8ee304dc, 0x1221004, 0x21027,
-0x621824, 0x8001dc9, 0xaee304dc, 0x8f830228,
-0x1221004, 0x21027, 0x621824, 0xaf830228,
-0x910c0, 0x2e21821, 0x3402c000, 0x8001e4e,
-0xa462727c, 0x8f420214, 0xafa20010, 0x910c0,
-0x571021, 0x8c42727c, 0x3c040001, 0x248453b4,
-0x3c050003, 0xafa20014, 0x8f470210, 0x34a5f01c,
-0xc002403, 0x1203021, 0x8001e83, 0x3c020800,
-0xb71021, 0x9443727e, 0x97420212, 0x14620019,
-0x918c0, 0xb71021, 0x8c437280, 0x8f420214,
-0x14620014, 0x918c0, 0x2e51021, 0x9447727c,
-0x720c0, 0x971021, 0x9443737e, 0xb71021,
-0xa443727e, 0x971021, 0x8c437380, 0xb71021,
-0xac437280, 0x2e41021, 0x9443737c, 0x2e51021,
-0xa443727c, 0x2e41821, 0x3402c000, 0x8001e4e,
-0xa462737c, 0x2e31021, 0x9447727c, 0x3021,
-0x720c0, 0x2e41021, 0x9442737c, 0x4021,
-0x30428000, 0x14400025, 0xe02821, 0x605021,
-0x340bc000, 0x971021, 0x9443737e, 0x97420212,
-0x54620015, 0xe02821, 0x971021, 0x8c437380,
-0x8f420214, 0x54620010, 0xe02821, 0x11000006,
-0x2e41021, 0x9443737c, 0x510c0, 0x2e21021,
-0x8001e1a, 0xa443737c, 0x9443737c, 0x2ea1021,
-0xa443727c, 0x710c0, 0x2e21021, 0xa44b737c,
-0x8001e28, 0x24060001, 0x510c0, 0x2e21021,
-0x9447737c, 0x720c0, 0x2e41021, 0x9442737c,
-0x30428000, 0x1040ffdf, 0x25080001, 0x30c200ff,
-0x14400025, 0x2021, 0x720c0, 0x971021,
-0x9443737e, 0x97420212, 0x1462000f, 0x910c0,
-0x971021, 0x8c437380, 0x8f420214, 0x1462000a,
-0x910c0, 0x2e41821, 0x3402c000, 0x15000015,
-0xa462737c, 0x910c0, 0x2e21821, 0x34028000,
-0x8001e4e, 0xa462727c, 0x571021, 0x8c42727c,
-0x3c040001, 0x248453c0, 0x3c050003, 0xafa20010,
-0x710c0, 0x571021, 0x8c42737c, 0x34a5001e,
-0x1203021, 0xc002403, 0xafa20014, 0x8001e83,
-0x3c020800, 0x2021, 0x428c0, 0xb71021,
-0x9443777e, 0x97420212, 0x5462002b, 0x24840001,
-0xb71021, 0x8c437780, 0x8f420214, 0x54620026,
-0x24840001, 0x3c020001, 0x571021, 0x8c4283b4,
-0x2442ffff, 0x3c010001, 0x370821, 0xac2283b4,
-0x3c020001, 0x571021, 0x8c4283b4, 0x809021,
-0x242102b, 0x1040000e, 0x24b1777c, 0x24b07784,
-0x2f02021, 0x2f12821, 0xc002490, 0x24060008,
-0x26310008, 0x3c020001, 0x571021, 0x8c4283b4,
-0x26520001, 0x242102b, 0x1440fff5, 0x26100008,
-0x3c040001, 0x972021, 0x8c8483b4, 0x24050008,
-0x420c0, 0x2484777c, 0xc002488, 0x2e42021,
-0x8001e83, 0x3c020800, 0x2c820080, 0x1440ffcf,
-0x428c0, 0x3c020800, 0x34422000, 0xafa20018,
-0x8ee20608, 0x8f430228, 0x24420001, 0x304a00ff,
-0x514300fd, 0xafa00010, 0x8ee20608, 0x210c0,
-0x571021, 0x8fa30018, 0x8fa4001c, 0xac43060c,
-0xac440610, 0x8f830054, 0x8f820054, 0x24690032,
-0x1221023, 0x2c420033, 0x1040006a, 0x5821,
-0x24100008, 0x240f000d, 0x240d0007, 0x240c0040,
-0x240e0001, 0x8f870120, 0x27623800, 0x24e80020,
-0x102102b, 0x50400001, 0x27683000, 0x8f820128,
-0x11020004, 0x0, 0x8f820124, 0x15020007,
-0x1021, 0x8ee201a4, 0x3821, 0x24420001,
-0xaee201a4, 0x8001efb, 0x8ee201a4, 0x8ee40608,
-0x420c0, 0x801821, 0x8ee40430, 0x8ee50434,
-0xa32821, 0xa3302b, 0x822021, 0x862021,
-0xace40000, 0xace50004, 0x8ee20608, 0xa4f0000e,
-0xacef0018, 0xacea001c, 0x210c0, 0x2442060c,
-0x2e21021, 0xace20008, 0x8ee204c4, 0xace20010,
-0xaf880120, 0x92e24e20, 0x14400033, 0x24070001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c820000, 0x144d001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x0, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee34e30,
-0x24420001, 0x104c0007, 0x0, 0x8ee24e34,
-0x24420001, 0x10620005, 0x0, 0x8001ee8,
-0x0, 0x14600005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400010, 0xac800000, 0x8001efb,
-0x0, 0x8ee24e30, 0x24420001, 0x504c0003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0xac8d0000, 0xac8e0004, 0x54e00006, 0x240b0001,
-0x8f820054, 0x1221023, 0x2c420033, 0x1440ff9d,
-0x0, 0x316300ff, 0x24020001, 0x54620078,
-0xafa00010, 0xaeea0608, 0x8f830054, 0x8f820054,
-0x24690032, 0x1221023, 0x2c420033, 0x10400061,
-0x5821, 0x240e0008, 0x240d0011, 0x240a0012,
-0x24080040, 0x240c0001, 0x8f830120, 0x27623800,
-0x24660020, 0xc2102b, 0x50400001, 0x27663000,
-0x8f820128, 0x10c20004, 0x0, 0x8f820124,
-0x14c20007, 0x0, 0x8ee201a4, 0x3821,
-0x24420001, 0xaee201a4, 0x8001f67, 0x8ee201a4,
-0x8ee20608, 0xac62001c, 0x8ee404a0, 0x8ee504a4,
-0x2462001c, 0xac620008, 0xa46e000e, 0xac6d0018,
-0xac640000, 0xac650004, 0x8ee204c4, 0xac620010,
-0xaf860120, 0x92e24e20, 0x14400033, 0x24070001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c820000, 0x144a001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x0, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee34e30,
-0x24420001, 0x10480007, 0x0, 0x8ee24e34,
-0x24420001, 0x10620005, 0x0, 0x8001f54,
-0x0, 0x14600005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400010, 0xac800000, 0x8001f67,
-0x0, 0x8ee24e30, 0x24420001, 0x50480003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0xac8a0000, 0xac8c0004, 0x54e00006, 0x240b0001,
-0x8f820054, 0x1221023, 0x2c420033, 0x1440ffa6,
-0x0, 0x316300ff, 0x24020001, 0x10620022,
-0x0, 0x3c040001, 0x24845390, 0xafa00010,
-0xafa00014, 0x8f860120, 0x8f870124, 0x3c050009,
-0xc002403, 0x34a5f011, 0x8001f93, 0x0,
-0x3c040001, 0x2484539c, 0xafa00014, 0x8f860120,
-0x8f870124, 0x3c050009, 0xc002403, 0x34a5f010,
-0x8001f93, 0x0, 0x3c040001, 0x248453a8,
-0xafa00014, 0x8ee60608, 0x8f470228, 0x3c050009,
-0xc002403, 0x34a5f00f, 0x8ee201ac, 0x24420001,
-0xaee201ac, 0x8ee201ac, 0x8ee20128, 0x24420001,
-0xaee20128, 0x8ee20128, 0x8ee20164, 0x24420001,
-0xaee20164, 0x80022e8, 0x8ee20164, 0x8fa20020,
-0x21200, 0x21d02, 0x24020001, 0x10620005,
-0x24020002, 0x1062000d, 0x0, 0x8001fb7,
-0xafa00010, 0x92e204d8, 0x14400006, 0x24020001,
-0x8f820228, 0xaee204dc, 0x2402ffff, 0xaf820228,
-0x24020001, 0x8001fbe, 0xa2e204d8, 0x92e204d8,
-0x5040000c, 0xa2e004d8, 0x8ee204dc, 0xaf820228,
-0x8001fbe, 0xa2e004d8, 0x3c040001, 0x248453c8,
-0xafa00014, 0x8fa60020, 0x3c050003, 0xc002403,
-0x34a5f009, 0x8ee2013c, 0x24420001, 0xaee2013c,
-0x80022e8, 0x8ee2013c, 0x8fa20020, 0x21200,
-0x22502, 0x24020001, 0x10820005, 0x24020002,
-0x1082000f, 0x0, 0x8001fe3, 0xafa00010,
-0x8f820220, 0x3c0308ff, 0x3463ffff, 0x431024,
-0x34420008, 0xaf820220, 0x24020001, 0x3c010001,
-0x370821, 0xa02283b2, 0x8001fea, 0xaee40108,
-0x8f820220, 0x3c0308ff, 0x3463fff7, 0x431024,
-0xaf820220, 0x3c010001, 0x370821, 0xa02083b2,
-0x8001fea, 0xaee40108, 0x3c040001, 0x248453d4,
-0xafa00014, 0x8fa60020, 0x3c050003, 0xc002403,
-0x34a5f00a, 0x8ee2012c, 0x24420001, 0xaee2012c,
-0x80022e8, 0x8ee2012c, 0x8fa20020, 0x21200,
-0x21d02, 0x24020001, 0x10620005, 0x24020002,
-0x1062000e, 0x0, 0x8002011, 0xafa00010,
-0x8f820220, 0x3c0308ff, 0x3463ffff, 0x431024,
-0x34420008, 0xaf820220, 0x24020001, 0x3c010001,
-0x370821, 0x8002018, 0xa02283b3, 0x3c020001,
-0x571021, 0x904283b2, 0x3c010001, 0x370821,
-0x1440000e, 0xa02083b3, 0x8f820220, 0x3c0308ff,
-0x3463fff7, 0x431024, 0x8002018, 0xaf820220,
-0x3c040001, 0x248453e0, 0xafa00014, 0x8fa60020,
-0x3c050003, 0xc002403, 0x34a5f00b, 0x8ee20114,
-0x24420001, 0xaee20114, 0x80022e8, 0x8ee20114,
-0x27840208, 0x27450200, 0xc00249a, 0x24060008,
-0x26e40094, 0x27450200, 0xc00249a, 0x24060008,
-0x8ee20134, 0x24420001, 0xaee20134, 0x80022e8,
-0x8ee20134, 0x8f460248, 0x2021, 0xc005108,
-0x24050004, 0x8ee20130, 0x24420001, 0xaee20130,
-0x80022e8, 0x8ee20130, 0x8ef301cc, 0x8ef401d0,
-0x8ef501d8, 0x8ee20140, 0x26e40030, 0x24420001,
-0xaee20140, 0x8ef00140, 0x8ef10074, 0x8ef20070,
-0xc002488, 0x24050400, 0xaef301cc, 0xaef401d0,
-0xaef501d8, 0xaef00140, 0xaef10074, 0xaef20070,
-0x8f42025c, 0x26e40094, 0xaee20060, 0x8f420260,
-0x27450200, 0x24060008, 0xaee20068, 0x24020006,
-0xc00249a, 0xaee20064, 0x3c023b9a, 0x3442ca00,
-0xaee2006c, 0x240203e8, 0x24040002, 0x24030001,
-0xaee20104, 0xaee40100, 0xaee3010c, 0x8f820220,
-0x30420008, 0x10400004, 0x0, 0xaee30108,
-0x8002061, 0x2021, 0xaee40108, 0x2021,
-0x3c030001, 0x641821, 0x90635c30, 0x2e41021,
-0x24840001, 0xa043009c, 0x2c82000f, 0x1440fff8,
-0x0, 0x8f820040, 0x2e41821, 0x24840001,
-0x21702, 0x24420030, 0xa062009c, 0x2e41021,
-0x80022e8, 0xa040009c, 0x24020001, 0x3c010001,
-0x370821, 0xa02283e0, 0x240b0400, 0x24080014,
-0x240a0040, 0x24090001, 0x8f830100, 0x27623000,
-0x24660020, 0xc2102b, 0x50400001, 0x27662800,
-0x8f820108, 0x10c20004, 0x0, 0x8f820104,
-0x14c20007, 0x26e20030, 0x8ee201a8, 0x3821,
-0x24420001, 0xaee201a8, 0x80020a8, 0x8ee201a8,
-0x8ee404b8, 0x8ee504bc, 0xac620008, 0xa46b000e,
-0xac680018, 0xac60001c, 0xac640000, 0xac650004,
-0x8ee204cc, 0xac620010, 0xaf860100, 0x92e204ec,
-0x1440000e, 0x24070001, 0x8ee24e28, 0x24420001,
-0x504a0003, 0x1021, 0x8ee24e28, 0x24420001,
-0xaee24e28, 0x8ee24e28, 0x210c0, 0x24424e38,
-0x2e21021, 0xac480000, 0xac490004, 0x10e0ffd2,
-0x0, 0x80022e8, 0x0, 0x3c020900,
-0xaee05238, 0xaee0523c, 0xaee05240, 0xaee05244,
-0xaee001d0, 0x3c010001, 0x370821, 0xa02083b1,
-0xafa20018, 0x8ee20608, 0x8f430228, 0x24420001,
-0x304a00ff, 0x514300fd, 0xafa00010, 0x8ee20608,
-0x210c0, 0x571021, 0x8fa30018, 0x8fa4001c,
-0xac43060c, 0xac440610, 0x8f830054, 0x8f820054,
-0x24690032, 0x1221023, 0x2c420033, 0x1040006a,
-0x5821, 0x24100008, 0x240f000d, 0x240d0007,
-0x240c0040, 0x240e0001, 0x8f870120, 0x27623800,
-0x24e80020, 0x102102b, 0x50400001, 0x27683000,
-0x8f820128, 0x11020004, 0x0, 0x8f820124,
-0x15020007, 0x1021, 0x8ee201a4, 0x3821,
-0x24420001, 0xaee201a4, 0x800212c, 0x8ee201a4,
-0x8ee40608, 0x420c0, 0x801821, 0x8ee40430,
-0x8ee50434, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xace40000, 0xace50004, 0x8ee20608,
-0xa4f0000e, 0xacef0018, 0xacea001c, 0x210c0,
-0x2442060c, 0x2e21021, 0xace20008, 0x8ee204c4,
-0xace20010, 0xaf880120, 0x92e24e20, 0x14400033,
-0x24070001, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8c820000, 0x144d001f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062001b, 0x0,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee34e30, 0x24420001, 0x104c0007, 0x0,
-0x8ee24e34, 0x24420001, 0x10620005, 0x0,
-0x8002119, 0x0, 0x14600005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400010, 0xac800000,
-0x800212c, 0x0, 0x8ee24e30, 0x24420001,
-0x504c0003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0xac8d0000, 0xac8e0004, 0x54e00006,
-0x240b0001, 0x8f820054, 0x1221023, 0x2c420033,
-0x1440ff9d, 0x0, 0x316300ff, 0x24020001,
-0x54620078, 0xafa00010, 0xaeea0608, 0x8f830054,
-0x8f820054, 0x24690032, 0x1221023, 0x2c420033,
-0x10400061, 0x5821, 0x240e0008, 0x240d0011,
-0x240a0012, 0x24080040, 0x240c0001, 0x8f830120,
-0x27623800, 0x24660020, 0xc2102b, 0x50400001,
-0x27663000, 0x8f820128, 0x10c20004, 0x0,
-0x8f820124, 0x14c20007, 0x0, 0x8ee201a4,
-0x3821, 0x24420001, 0xaee201a4, 0x8002198,
-0x8ee201a4, 0x8ee20608, 0xac62001c, 0x8ee404a0,
-0x8ee504a4, 0x2462001c, 0xac620008, 0xa46e000e,
-0xac6d0018, 0xac640000, 0xac650004, 0x8ee204c4,
-0xac620010, 0xaf860120, 0x92e24e20, 0x14400033,
-0x24070001, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8c820000, 0x144a001f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062001b, 0x0,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee34e30, 0x24420001, 0x10480007, 0x0,
-0x8ee24e34, 0x24420001, 0x10620005, 0x0,
-0x8002185, 0x0, 0x14600005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400010, 0xac800000,
-0x8002198, 0x0, 0x8ee24e30, 0x24420001,
-0x50480003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0xac8a0000, 0xac8c0004, 0x54e00006,
-0x240b0001, 0x8f820054, 0x1221023, 0x2c420033,
-0x1440ffa6, 0x0, 0x316300ff, 0x24020001,
-0x10620022, 0x0, 0x3c040001, 0x24845390,
-0xafa00010, 0xafa00014, 0x8f860120, 0x8f870124,
-0x3c050009, 0xc002403, 0x34a5f011, 0x80021c4,
-0x0, 0x3c040001, 0x2484539c, 0xafa00014,
-0x8f860120, 0x8f870124, 0x3c050009, 0xc002403,
-0x34a5f010, 0x80021c4, 0x0, 0x3c040001,
-0x248453a8, 0xafa00014, 0x8ee60608, 0x8f470228,
-0x3c050009, 0xc002403, 0x34a5f00f, 0x8ee201ac,
-0x24420001, 0xaee201ac, 0x8ee201ac, 0x8ee20120,
-0x24420001, 0xaee20120, 0x8ee20120, 0x8ee20168,
-0x24420001, 0xaee20168, 0x80022e8, 0x8ee20168,
-0x8f42025c, 0x26e40094, 0xaee20060, 0x8f420260,
-0x27450200, 0x24060008, 0xc00249a, 0xaee20068,
-0x8f820220, 0x30420008, 0x14400002, 0x24020001,
-0x24020002, 0xaee20108, 0x8ee2011c, 0x24420001,
-0xaee2011c, 0x80022e8, 0x8ee2011c, 0x3c040001,
-0x248453ec, 0xafa00010, 0xafa00014, 0x8fa60020,
-0x3c050003, 0xc002403, 0x34a5f00f, 0x93a20020,
-0x3c030700, 0x34631000, 0x431025, 0xafa20018,
-0x8ee20608, 0x8f430228, 0x24420001, 0x304900ff,
-0x512300e2, 0xafa00010, 0x8ee20608, 0x210c0,
-0x571021, 0x8fa30018, 0x8fa4001c, 0xac43060c,
-0xac440610, 0x8f870120, 0x27623800, 0x24e80020,
-0x102102b, 0x50400001, 0x27683000, 0x8f820128,
-0x11020004, 0x0, 0x8f820124, 0x15020007,
-0x1021, 0x8ee201a4, 0x3821, 0x24420001,
-0xaee201a4, 0x800225d, 0x8ee201a4, 0x8ee40608,
-0x420c0, 0x801821, 0x8ee40430, 0x8ee50434,
-0xa32821, 0xa3302b, 0x822021, 0x862021,
-0xace40000, 0xace50004, 0x8ee30608, 0x24020008,
-0xa4e2000e, 0x2402000d, 0xace20018, 0xace9001c,
-0x318c0, 0x2463060c, 0x2e31021, 0xace20008,
-0x8ee204c4, 0xace20010, 0xaf880120, 0x92e24e20,
-0x14400037, 0x24070001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c830000, 0x24020007,
-0x1462001f, 0x0, 0x8ee34e30, 0x8ee24e34,
-0x1062001b, 0x24030040, 0x8c820004, 0x24420001,
-0xac820004, 0x8ee24e34, 0x8ee54e30, 0x24420001,
-0x10430007, 0x0, 0x8ee24e34, 0x24420001,
-0x10a20005, 0x0, 0x8002247, 0x0,
-0x14a00005, 0x0, 0x8f820128, 0x24420020,
-0xaf820128, 0x8f820128, 0x8c820004, 0x2c420011,
-0x50400013, 0xac800000, 0x800225d, 0x0,
-0x8ee24e30, 0x24030040, 0x24420001, 0x50430003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x24020007, 0xac820000, 0x24020001, 0xac820004,
-0x54e0000c, 0xaee90608, 0x3c040001, 0x248453f4,
-0xafa00010, 0xafa00014, 0x8ee60608, 0x8f470228,
-0x3c050009, 0xc002403, 0x34a5f000, 0x80022e0,
-0x0, 0x8f830120, 0x27623800, 0x24660020,
-0xc2102b, 0x50400001, 0x27663000, 0x8f820128,
-0x10c20004, 0x0, 0x8f820124, 0x14c20007,
-0x0, 0x8ee201a4, 0x3821, 0x24420001,
-0xaee201a4, 0x80022c4, 0x8ee201a4, 0x8ee20608,
-0xac62001c, 0x8ee404a0, 0x8ee504a4, 0x2462001c,
-0xac620008, 0x24020008, 0xa462000e, 0x24020011,
-0xac620018, 0xac640000, 0xac650004, 0x8ee204c4,
-0xac620010, 0xaf860120, 0x92e24e20, 0x14400037,
-0x24070001, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8c830000, 0x24020012, 0x1462001f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062001b,
-0x24030040, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee54e30, 0x24420001, 0x10430007,
-0x0, 0x8ee24e34, 0x24420001, 0x10a20005,
-0x0, 0x80022ae, 0x0, 0x14a00005,
-0x0, 0x8f820128, 0x24420020, 0xaf820128,
-0x8f820128, 0x8c820004, 0x2c420011, 0x50400013,
-0xac800000, 0x80022c4, 0x0, 0x8ee24e30,
-0x24030040, 0x24420001, 0x50430003, 0x1021,
-0x8ee24e30, 0x24420001, 0xaee24e30, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x24020012,
-0xac820000, 0x24020001, 0xac820004, 0x14e0001b,
-0x0, 0x3c040001, 0x248453fc, 0xafa00010,
-0xafa00014, 0x8ee60608, 0x8f470228, 0x3c050009,
-0xc002403, 0x34a5f001, 0x8ee201b0, 0x24420001,
-0xaee201b0, 0x80022e0, 0x8ee201b0, 0x3c040001,
-0x24845408, 0xafa00014, 0x8ee60608, 0x8f470228,
-0x3c050009, 0xc002403, 0x34a5f005, 0x8ee201ac,
-0x24420001, 0xaee201ac, 0x8ee201ac, 0x8ee20150,
-0x24420001, 0xaee20150, 0x8ee20150, 0x8ee20160,
-0x24420001, 0xaee20160, 0x8ee20160, 0x8f43022c,
-0x8f42010c, 0x14620009, 0x24020002, 0xaf820064,
-0x8f820064, 0x14400005, 0x0, 0x8f43022c,
-0x8f42010c, 0x1462f875, 0x0, 0x8fbf0044,
-0x8fb60040, 0x8fb5003c, 0x8fb40038, 0x8fb30034,
-0x8fb20030, 0x8fb1002c, 0x8fb00028, 0x3e00008,
-0x27bd0048, 0x27bdfff8, 0x2408ffff, 0x10a00014,
-0x4821, 0x3c0aedb8, 0x354a8320, 0x90870000,
-0x24840001, 0x3021, 0x1071026, 0x30420001,
-0x10400002, 0x81842, 0x6a1826, 0x604021,
-0x24c60001, 0x2cc20008, 0x1440fff7, 0x73842,
-0x25290001, 0x125102b, 0x1440fff0, 0x0,
-0x1001021, 0x3e00008, 0x27bd0008, 0x27bdffe8,
-0x27642800, 0xafbf0010, 0xc002488, 0x24051000,
-0x24020021, 0xaf800100, 0xaf800104, 0xaf800108,
-0xaf800110, 0xaf800114, 0xaf800118, 0xaf800120,
-0xaf800124, 0xaf800128, 0xaf800130, 0xaf800134,
-0xaf800138, 0xaee04e28, 0xaee04e2c, 0xaee04e30,
-0xaee04e34, 0xaf82011c, 0x8f420218, 0x30420040,
-0x10400004, 0x0, 0x8f82011c, 0x34420004,
-0xaf82011c, 0x8fbf0010, 0x3e00008, 0x27bd0018,
-0x27bdffe0, 0xafbf0018, 0x8f820104, 0xafa20010,
-0x8f820100, 0x3c050002, 0xafa20014, 0x8f8600b0,
-0x8f87011c, 0x3c040001, 0x248454c0, 0xc002403,
-0x34a5f000, 0x8f8300b0, 0x3c027f00, 0x621824,
-0x3c020400, 0x10620029, 0x43102b, 0x14400008,
-0x3c022000, 0x3c020100, 0x10620024, 0x3c020200,
-0x10620011, 0x0, 0x8002374, 0x0,
-0x10620008, 0x3c024000, 0x1462001c, 0x0,
-0x8ee20190, 0x24420001, 0xaee20190, 0x8002374,
-0x8ee20190, 0x8ee2018c, 0x24420001, 0xaee2018c,
-0x8002374, 0x8ee2018c, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f830104, 0x8f8200b0, 0x34420001,
-0xaf8200b0, 0xaf830104, 0x8f82011c, 0x2403fffd,
-0x431024, 0xaf82011c, 0x8ee201a0, 0x24420001,
-0xaee201a0, 0x8002377, 0x8ee201a0, 0x8f8200b0,
-0x34420001, 0xaf8200b0, 0x8fbf0018, 0x3e00008,
-0x27bd0020, 0x27bdffe0, 0xafbf001c, 0xafb00018,
-0x8f820120, 0xafa20010, 0x8f820124, 0x3c050001,
-0xafa20014, 0x8f8600a0, 0x8f87011c, 0x3c040001,
-0x248454cc, 0xc002403, 0x34a5f000, 0x8f8300a0,
-0x3c027f00, 0x621824, 0x3c020400, 0x10620053,
-0x8021, 0x43102b, 0x14400008, 0x3c042000,
-0x3c020100, 0x1062004d, 0x3c020200, 0x1062003a,
-0x0, 0x80023e0, 0x0, 0x10640003,
-0x3c024000, 0x14620045, 0x0, 0x8f8200a0,
-0x441024, 0x10400006, 0x0, 0x8ee20194,
-0x24420001, 0xaee20194, 0x80023a9, 0x8ee20194,
-0x8ee20198, 0x24420001, 0xaee20198, 0x8ee20198,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f82011c,
-0x30420200, 0x1040001b, 0x0, 0x8f8300a0,
-0x8f840124, 0x8f8200ac, 0x14400007, 0x24020001,
-0x3c020001, 0x3442f000, 0x621024, 0x50400001,
-0x24100001, 0x24020001, 0x1200000d, 0xaf8200a0,
-0x8f820124, 0x2442ffe0, 0xaf820124, 0x8f820124,
-0x8f820124, 0x27633000, 0x43102b, 0x10400005,
-0x276237e0, 0xaf820124, 0x80023ca, 0x0,
-0xaf840124, 0x8f82011c, 0x2403fffd, 0x431024,
-0x80023e3, 0xaf82011c, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f830124, 0x8f8200a0, 0x34420001,
-0xaf8200a0, 0xaf830124, 0x8f82011c, 0x2403fffd,
-0x431024, 0xaf82011c, 0x8ee2019c, 0x24420001,
-0xaee2019c, 0x80023e3, 0x8ee2019c, 0x8f8200a0,
-0x34420001, 0xaf8200a0, 0x8fbf001c, 0x8fb00018,
-0x3e00008, 0x27bd0020, 0x0, 0x3c020001,
-0x8c425c58, 0x27bdffe8, 0xafbf0014, 0x14400012,
-0xafb00010, 0x3c100001, 0x26105dd0, 0x2002021,
-0xc002488, 0x24052000, 0x26021fe0, 0x3c010001,
-0xac225d94, 0x3c010001, 0xac225d90, 0xaf420250,
-0x24022000, 0xaf500254, 0xaf420258, 0x24020001,
-0x3c010001, 0xac225c58, 0x8fbf0014, 0x8fb00010,
-0x3e00008, 0x27bd0018, 0x3c030001, 0x8c635d94,
-0x8c820000, 0x8fa80010, 0x8fa90014, 0xac620000,
-0x3c020001, 0x8c425d94, 0x8c830004, 0xac430004,
-0xac450008, 0x8f840054, 0x2443ffe0, 0xac460010,
-0xac470014, 0xac480018, 0xac49001c, 0x3c010001,
-0xac235d94, 0xac44000c, 0x3c020001, 0x24425dd0,
-0x62182b, 0x10600005, 0x0, 0x3c020001,
-0x8c425d90, 0x3c010001, 0xac225d94, 0x3c030001,
-0x8c635d94, 0x3c020001, 0x8c425c40, 0xac620000,
-0x3c030001, 0x8c635d94, 0x3c020001, 0x8c425c40,
-0xac620004, 0x3e00008, 0xaf430250, 0x3c030001,
-0x8c635d94, 0x3c020001, 0x8c425c40, 0x27bdffd0,
-0xafb40020, 0x8fb40040, 0xafb00010, 0x808021,
-0xafb50024, 0x8fb50044, 0x8fa40048, 0xafb10014,
-0xa08821, 0xafbf0028, 0xafb3001c, 0xafb20018,
-0xac620000, 0x3c050001, 0x8ca55d94, 0x3c020001,
-0x8c425c40, 0xc09021, 0xe09821, 0x10800006,
-0xaca20004, 0x24a50008, 0xc002490, 0x24060018,
-0x800244e, 0x0, 0x24a40008, 0xc002488,
-0x24050018, 0x3c020001, 0x8c425d94, 0x3c050001,
-0x24a55dd0, 0x2442ffe0, 0x3c010001, 0xac225d94,
-0x45102b, 0x10400005, 0x0, 0x3c020001,
-0x8c425d90, 0x3c010001, 0xac225d94, 0x3c030001,
-0x8c635d94, 0x8e020000, 0xac620000, 0x3c030001,
-0x8c635d94, 0x8e020004, 0xac620004, 0xac710008,
-0x8f840054, 0x2462ffe0, 0x3c010001, 0xac225d94,
-0x45102b, 0xac720010, 0xac730014, 0xac740018,
-0xac75001c, 0x10400005, 0xac64000c, 0x3c020001,
-0x8c425d90, 0x3c010001, 0xac225d94, 0x3c030001,
-0x8c635d94, 0x3c020001, 0x8c425c40, 0xac620000,
-0x3c030001, 0x8c635d94, 0x3c020001, 0x8c425c40,
-0xac620004, 0xaf430250, 0x8fbf0028, 0x8fb50024,
-0x8fb40020, 0x8fb3001c, 0x8fb20018, 0x8fb10014,
-0x8fb00010, 0x3e00008, 0x27bd0030, 0x10a00005,
-0x0, 0xac800000, 0x24a5fffc, 0x14a0fffd,
-0x24840004, 0x3e00008, 0x0, 0x10c00007,
-0x0, 0x8c820000, 0x24840004, 0x24c6fffc,
-0xaca20000, 0x14c0fffb, 0x24a50004, 0x3e00008,
-0x0, 0x10c00007, 0x0, 0x8ca20000,
-0x24a50004, 0x24c6fffc, 0xac820000, 0x14c0fffb,
-0x24840004, 0x3e00008, 0x0, 0x3e00008,
-0x0, 0x27bdffd8, 0xafbf0020, 0x8ee304e4,
-0x8ee204e0, 0x10620436, 0x0, 0x8ee204e4,
-0x8ee304fc, 0x21100, 0x626021, 0x95870008,
-0x8d8a0000, 0x8d8b0004, 0x958d000a, 0x8ee2725c,
-0x8ee3726c, 0x30e4ffff, 0x441021, 0x62182b,
-0x10600015, 0x31a20004, 0x8f8200d8, 0x8ee37258,
-0x431023, 0xaee2726c, 0x8ee2726c, 0x1c400003,
-0x3c030001, 0x431021, 0xaee2726c, 0x8ee2725c,
-0x8ee3726c, 0x441021, 0x62182b, 0x10600006,
-0x31a20004, 0x8ee201b8, 0x24420001, 0xaee201b8,
-0x80028e1, 0x8ee201b8, 0x10400240, 0x31a20200,
-0x1040014d, 0x4821, 0x96e2045a, 0x30420010,
-0x10400149, 0x0, 0x8f840100, 0x27623000,
-0x24850020, 0xa2102b, 0x50400001, 0x27652800,
-0x8f820108, 0x10a20004, 0x0, 0x8f820104,
-0x14a20006, 0x2402000c, 0x8ee201a8, 0x24420001,
-0xaee201a8, 0x800252c, 0x8ee201a8, 0xac8a0000,
-0xac8b0004, 0x8ee37264, 0x24060005, 0xa482000e,
-0xac860018, 0xac830008, 0x8ee204e4, 0xac82001c,
-0x8ee204c8, 0xac820010, 0xaf850100, 0x92e204ec,
-0x14400036, 0x24090001, 0x8ee24e28, 0x210c0,
-0x24424e38, 0x2e22021, 0x8c820000, 0x1446001f,
-0x0, 0x8ee34e28, 0x8ee24e2c, 0x1062001b,
-0x24030040, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e2c, 0x8ee54e28, 0x24420001, 0x10430007,
-0x0, 0x8ee24e2c, 0x24420001, 0x10a20005,
-0x0, 0x8002516, 0x0, 0x14a00005,
-0x0, 0x8f820108, 0x24420020, 0xaf820108,
-0x8f820108, 0x8c820004, 0x2c420011, 0x50400013,
-0xac800000, 0x800252c, 0x0, 0x8ee24e28,
-0x24030040, 0x24420001, 0x50430003, 0x1021,
-0x8ee24e28, 0x24420001, 0xaee24e28, 0x8ee24e28,
-0x210c0, 0x24424e38, 0x2e22021, 0x24020005,
-0xac820000, 0x24020001, 0xac820004, 0x1520000a,
-0x3c040001, 0xafab0010, 0x8ee27264, 0x3c040001,
-0x24845730, 0x3c050004, 0xafa20014, 0x8ee604e4,
-0x80028be, 0x34a5f114, 0x8ee27264, 0x34843800,
-0x3641821, 0x24420010, 0x43102b, 0x14400073,
-0x0, 0x8ee27264, 0x24480010, 0x3641021,
-0x102102b, 0x14400002, 0x3c02ffff, 0x1024021,
-0x8f850100, 0x27623000, 0x24a60020, 0xc2102b,
-0x50400001, 0x27662800, 0x8f820108, 0x10c20004,
-0x0, 0x8f820104, 0x14c20007, 0x2563000c,
-0x8ee201a8, 0x4821, 0x24420001, 0xaee201a8,
-0x80025a0, 0x8ee201a8, 0x2c64000c, 0x1441021,
-0xaca20000, 0xaca30004, 0x24e2fff4, 0xa4a2000e,
-0x24020006, 0xaca80008, 0xaca20018, 0x8ee204e4,
-0xaca2001c, 0x8ee204c8, 0x3c030002, 0x431025,
-0xaca20010, 0xaf860100, 0x92e204ec, 0x14400037,
-0x24090001, 0x8ee24e28, 0x210c0, 0x24424e38,
-0x2e22021, 0x8c830000, 0x24020005, 0x1462001f,
-0x0, 0x8ee34e28, 0x8ee24e2c, 0x1062001b,
-0x24030040, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e2c, 0x8ee54e28, 0x24420001, 0x10430007,
-0x0, 0x8ee24e2c, 0x24420001, 0x10a20005,
-0x0, 0x800258a, 0x0, 0x14a00005,
-0x0, 0x8f820108, 0x24420020, 0xaf820108,
-0x8f820108, 0x8c820004, 0x2c420011, 0x50400013,
-0xac800000, 0x80025a0, 0x0, 0x8ee24e28,
-0x24030040, 0x24420001, 0x50430003, 0x1021,
-0x8ee24e28, 0x24420001, 0xaee24e28, 0x8ee24e28,
-0x210c0, 0x24424e38, 0x2e22021, 0x24020005,
-0xac820000, 0x24020001, 0xac820004, 0x1520000a,
-0x2508fffc, 0xafab0010, 0x8ee27264, 0x3c040001,
-0x24845730, 0x3c050004, 0xafa20014, 0x8ee604e4,
-0x80028be, 0x34a5f125, 0x34028100, 0xa5020000,
-0x9582000e, 0x800261d, 0xa5020002, 0x8f850100,
-0x27623000, 0x24a60020, 0xc2102b, 0x50400001,
-0x27662800, 0x8f820108, 0x10c20004, 0x0,
-0x8f820104, 0x14c20007, 0x2563000c, 0x8ee201a8,
-0x4821, 0x24420001, 0xaee201a8, 0x800260d,
-0x8ee201a8, 0x2c64000c, 0x1441021, 0xaca20000,
-0xaca30004, 0x8ee37264, 0x24e2fff4, 0xa4a2000e,
-0x24020006, 0xaca20018, 0x24630010, 0xaca30008,
-0x8ee204e4, 0xaca2001c, 0x8ee204c8, 0x3c030002,
-0x431025, 0xaca20010, 0xaf860100, 0x92e204ec,
-0x14400037, 0x24090001, 0x8ee24e28, 0x210c0,
-0x24424e38, 0x2e22021, 0x8c830000, 0x24020005,
-0x1462001f, 0x0, 0x8ee34e28, 0x8ee24e2c,
-0x1062001b, 0x24030040, 0x8c820004, 0x24420001,
-0xac820004, 0x8ee24e2c, 0x8ee54e28, 0x24420001,
-0x10430007, 0x0, 0x8ee24e2c, 0x24420001,
-0x10a20005, 0x0, 0x80025f7, 0x0,
-0x14a00005, 0x0, 0x8f820108, 0x24420020,
-0xaf820108, 0x8f820108, 0x8c820004, 0x2c420011,
-0x50400013, 0xac800000, 0x800260d, 0x0,
-0x8ee24e28, 0x24030040, 0x24420001, 0x50430003,
-0x1021, 0x8ee24e28, 0x24420001, 0xaee24e28,
-0x8ee24e28, 0x210c0, 0x24424e38, 0x2e22021,
-0x24020005, 0xac820000, 0x24020001, 0xac820004,
-0x1520000a, 0x34028100, 0xafab0010, 0x8ee27264,
-0x3c040001, 0x24845730, 0x3c050004, 0xafa20014,
-0x8ee604e4, 0x80028be, 0x34a5f015, 0x8ee37264,
-0xa462000c, 0x8ee37264, 0x9582000e, 0xa462000e,
-0x8002681, 0x24e70004, 0x8f840100, 0x27623000,
-0x24850020, 0xa2102b, 0x50400001, 0x27652800,
-0x8f820108, 0x10a20004, 0x0, 0x8f820104,
-0x14a20007, 0x24020006, 0x8ee201a8, 0x4821,
-0x24420001, 0xaee201a8, 0x8002677, 0x8ee201a8,
-0xac8a0000, 0xac8b0004, 0x8ee37264, 0xa487000e,
-0xac820018, 0xac830008, 0x8ee204e4, 0xac82001c,
-0x8ee204c8, 0x3c030002, 0x431025, 0xac820010,
-0xaf850100, 0x92e204ec, 0x14400037, 0x24090001,
-0x8ee24e28, 0x210c0, 0x24424e38, 0x2e22021,
-0x8c830000, 0x24020005, 0x1462001f, 0x0,
-0x8ee34e28, 0x8ee24e2c, 0x1062001b, 0x24030040,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e2c,
-0x8ee54e28, 0x24420001, 0x10430007, 0x0,
-0x8ee24e2c, 0x24420001, 0x10a20005, 0x0,
-0x8002661, 0x0, 0x14a00005, 0x0,
-0x8f820108, 0x24420020, 0xaf820108, 0x8f820108,
-0x8c820004, 0x2c420011, 0x50400013, 0xac800000,
-0x8002677, 0x0, 0x8ee24e28, 0x24030040,
-0x24420001, 0x50430003, 0x1021, 0x8ee24e28,
-0x24420001, 0xaee24e28, 0x8ee24e28, 0x210c0,
-0x24424e38, 0x2e22021, 0x24020005, 0xac820000,
-0x24020001, 0xac820004, 0x15200009, 0x3c050004,
-0xafab0010, 0x8ee27264, 0x3c040001, 0x24845730,
-0xafa20014, 0x8ee604e4, 0x80028be, 0x34a5f004,
-0x8ee2725c, 0x30e7ffff, 0x471021, 0xaee2725c,
-0x8ee204e4, 0x8ee304fc, 0x8ee47258, 0x21100,
-0x431021, 0xac44000c, 0x8ee27258, 0xafa20018,
-0x8ee3725c, 0xafa3001c, 0x8ee2725c, 0x2c42003c,
-0x10400004, 0x24620001, 0x2403fffe, 0x431024,
-0xafa2001c, 0x8ee27264, 0x3c060001, 0x34c63800,
-0x8ee3725c, 0x2405fff8, 0x471021, 0x24420007,
-0x451024, 0x24630007, 0xaee27258, 0x8ee2726c,
-0x8ee47258, 0x651824, 0x431023, 0xaee2726c,
-0x3661021, 0x82202b, 0x14800004, 0x3c03ffff,
-0x8ee27258, 0x431021, 0xaee27258, 0x8ee27258,
-0xaee27264, 0x8f8200f0, 0x24470008, 0x27621800,
-0xe2102b, 0x50400001, 0x27671000, 0x8f8200f4,
-0x14e20007, 0x0, 0x8ee201b4, 0x4821,
-0x24420001, 0xaee201b4, 0x80026c4, 0x8ee201b4,
-0x8f8200f0, 0x24090001, 0x8fa30018, 0x8fa4001c,
-0xac430000, 0xac440004, 0xaf8700f0, 0x15200012,
-0xd1142, 0x8f8200f0, 0xafa20010, 0x8f8200f4,
-0x3c040001, 0x2484573c, 0xafa20014, 0x8fa60018,
-0x8fa7001c, 0x3c050004, 0xc002403, 0x34a5f005,
-0x8ee20088, 0x24420001, 0xaee20088, 0x8ee20088,
-0x80028d3, 0xaee0725c, 0x30430003, 0x24020002,
-0x10620016, 0x28620003, 0x10400005, 0x24020001,
-0x10620008, 0x0, 0x8002703, 0x0,
-0x24020003, 0x10620017, 0x0, 0x8002703,
-0x0, 0x8ee200e8, 0x8ee300ec, 0x24630001,
-0x2c640001, 0x441021, 0xaee200e8, 0xaee300ec,
-0x8ee200e8, 0x8002703, 0x8ee300ec, 0x8ee200f0,
-0x8ee300f4, 0x24630001, 0x2c640001, 0x441021,
-0xaee200f0, 0xaee300f4, 0x8ee200f0, 0x8002703,
-0x8ee300f4, 0x8ee200f8, 0x8ee300fc, 0x24630001,
-0x2c640001, 0x441021, 0xaee200f8, 0xaee300fc,
-0x8ee200f8, 0x8ee300fc, 0x8ee2725c, 0x8ee400e0,
-0x8ee500e4, 0x401821, 0x1021, 0xa32821,
-0xa3302b, 0x822021, 0x862021, 0xaee400e0,
-0xaee500e4, 0x80028d3, 0xaee0725c, 0x30e2ffff,
-0x104001c1, 0x31a20200, 0x1040014d, 0x4821,
-0x96e2045a, 0x30420010, 0x10400149, 0x0,
-0x8f840100, 0x27623000, 0x24850020, 0xa2102b,
-0x50400001, 0x27652800, 0x8f820108, 0x10a20004,
-0x0, 0x8f820104, 0x14a20006, 0x2402000c,
-0x8ee201a8, 0x24420001, 0xaee201a8, 0x800276e,
-0x8ee201a8, 0xac8a0000, 0xac8b0004, 0x8ee37264,
-0x24060005, 0xa482000e, 0xac860018, 0xac830008,
-0x8ee204e4, 0xac82001c, 0x8ee204c8, 0xac820010,
-0xaf850100, 0x92e204ec, 0x14400036, 0x24090001,
-0x8ee24e28, 0x210c0, 0x24424e38, 0x2e22021,
-0x8c820000, 0x1446001f, 0x0, 0x8ee34e28,
-0x8ee24e2c, 0x1062001b, 0x24030040, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e2c, 0x8ee54e28,
-0x24420001, 0x10430007, 0x0, 0x8ee24e2c,
-0x24420001, 0x10a20005, 0x0, 0x8002758,
-0x0, 0x14a00005, 0x0, 0x8f820108,
-0x24420020, 0xaf820108, 0x8f820108, 0x8c820004,
-0x2c420011, 0x50400013, 0xac800000, 0x800276e,
-0x0, 0x8ee24e28, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e28, 0x24420001,
-0xaee24e28, 0x8ee24e28, 0x210c0, 0x24424e38,
-0x2e22021, 0x24020005, 0xac820000, 0x24020001,
-0xac820004, 0x1520000a, 0x3c040001, 0xafab0010,
-0x8ee27264, 0x3c040001, 0x24845730, 0x3c050004,
-0xafa20014, 0x8ee604e4, 0x80028be, 0x34a5f014,
-0x8ee27264, 0x34843800, 0x3641821, 0x24420010,
-0x43102b, 0x14400073, 0x0, 0x8ee27264,
-0x24480010, 0x3641021, 0x102102b, 0x14400002,
-0x3c02ffff, 0x1024021, 0x8f850100, 0x27623000,
-0x24a60020, 0xc2102b, 0x50400001, 0x27662800,
-0x8f820108, 0x10c20004, 0x0, 0x8f820104,
-0x14c20007, 0x2563000c, 0x8ee201a8, 0x4821,
-0x24420001, 0xaee201a8, 0x80027e2, 0x8ee201a8,
-0x2c64000c, 0x1441021, 0xaca20000, 0xaca30004,
-0x24e2fff4, 0xa4a2000e, 0x24020006, 0xaca80008,
-0xaca20018, 0x8ee204e4, 0xaca2001c, 0x8ee204c8,
-0x3c030002, 0x431025, 0xaca20010, 0xaf860100,
-0x92e204ec, 0x14400037, 0x24090001, 0x8ee24e28,
-0x210c0, 0x24424e38, 0x2e22021, 0x8c830000,
-0x24020005, 0x1462001f, 0x0, 0x8ee34e28,
-0x8ee24e2c, 0x1062001b, 0x24030040, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e2c, 0x8ee54e28,
-0x24420001, 0x10430007, 0x0, 0x8ee24e2c,
-0x24420001, 0x10a20005, 0x0, 0x80027cc,
-0x0, 0x14a00005, 0x0, 0x8f820108,
-0x24420020, 0xaf820108, 0x8f820108, 0x8c820004,
-0x2c420011, 0x50400013, 0xac800000, 0x80027e2,
-0x0, 0x8ee24e28, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e28, 0x24420001,
-0xaee24e28, 0x8ee24e28, 0x210c0, 0x24424e38,
-0x2e22021, 0x24020005, 0xac820000, 0x24020001,
-0xac820004, 0x1520000a, 0x2508fffc, 0xafab0010,
-0x8ee27264, 0x3c040001, 0x24845730, 0x3c050004,
-0xafa20014, 0x8ee604e4, 0x80028be, 0x34a5f015,
-0x34028100, 0xa5020000, 0x9582000e, 0x800285f,
-0xa5020002, 0x8f850100, 0x27623000, 0x24a60020,
-0xc2102b, 0x50400001, 0x27662800, 0x8f820108,
-0x10c20004, 0x0, 0x8f820104, 0x14c20007,
-0x2563000c, 0x8ee201a8, 0x4821, 0x24420001,
-0xaee201a8, 0x800284f, 0x8ee201a8, 0x2c64000c,
-0x1441021, 0xaca20000, 0xaca30004, 0x8ee37264,
-0x24e2fff4, 0xa4a2000e, 0x24020006, 0xaca20018,
-0x24630010, 0xaca30008, 0x8ee204e4, 0xaca2001c,
-0x8ee204c8, 0x3c030002, 0x431025, 0xaca20010,
-0xaf860100, 0x92e204ec, 0x14400037, 0x24090001,
-0x8ee24e28, 0x210c0, 0x24424e38, 0x2e22021,
-0x8c830000, 0x24020005, 0x1462001f, 0x0,
-0x8ee34e28, 0x8ee24e2c, 0x1062001b, 0x24030040,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e2c,
-0x8ee54e28, 0x24420001, 0x10430007, 0x0,
-0x8ee24e2c, 0x24420001, 0x10a20005, 0x0,
-0x8002839, 0x0, 0x14a00005, 0x0,
-0x8f820108, 0x24420020, 0xaf820108, 0x8f820108,
-0x8c820004, 0x2c420011, 0x50400013, 0xac800000,
-0x800284f, 0x0, 0x8ee24e28, 0x24030040,
-0x24420001, 0x50430003, 0x1021, 0x8ee24e28,
-0x24420001, 0xaee24e28, 0x8ee24e28, 0x210c0,
-0x24424e38, 0x2e22021, 0x24020005, 0xac820000,
-0x24020001, 0xac820004, 0x1520000a, 0x34028100,
-0xafab0010, 0x8ee27264, 0x3c040001, 0x24845730,
-0x3c050004, 0xafa20014, 0x8ee604e4, 0x80028be,
-0x34a5f016, 0x8ee37264, 0xa462000c, 0x8ee37264,
-0x9582000e, 0xa462000e, 0x80028c2, 0x24e70004,
-0x8f830100, 0x27623000, 0x24640020, 0x82102b,
-0x50400001, 0x27642800, 0x8f820108, 0x10820004,
-0x0, 0x8f820104, 0x14820007, 0x24050005,
-0x8ee201a8, 0x4821, 0x24420001, 0xaee201a8,
-0x80028b6, 0x8ee201a8, 0xac6a0000, 0xac6b0004,
-0x8ee27264, 0xa467000e, 0xac650018, 0xac620008,
-0x8ee204e4, 0xac62001c, 0x8ee204c8, 0xac620010,
-0xaf840100, 0x92e204ec, 0x14400036, 0x24090001,
-0x8ee24e28, 0x210c0, 0x24424e38, 0x2e22021,
-0x8c820000, 0x1445001f, 0x0, 0x8ee34e28,
-0x8ee24e2c, 0x1062001b, 0x24030040, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e2c, 0x8ee54e28,
-0x24420001, 0x10430007, 0x0, 0x8ee24e2c,
-0x24420001, 0x10a20005, 0x0, 0x80028a0,
-0x0, 0x14a00005, 0x0, 0x8f820108,
-0x24420020, 0xaf820108, 0x8f820108, 0x8c820004,
-0x2c420011, 0x50400013, 0xac800000, 0x80028b6,
-0x0, 0x8ee24e28, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e28, 0x24420001,
-0xaee24e28, 0x8ee24e28, 0x210c0, 0x24424e38,
-0x2e22021, 0x24020005, 0xac820000, 0x24020001,
-0xac820004, 0x1520000b, 0x3c050004, 0x3c040001,
-0x24845748, 0xafab0010, 0xafa00014, 0x8ee604e4,
-0x34a5f017, 0xc002403, 0x30e7ffff, 0x80028e1,
-0x0, 0x8ee27264, 0x3c050001, 0x30e4ffff,
-0x441021, 0xaee27264, 0x8ee2725c, 0x8ee37264,
-0x34a53800, 0x441021, 0xaee2725c, 0x3651021,
-0x62182b, 0x14600004, 0x3c03ffff, 0x8ee27264,
-0x431021, 0xaee27264, 0x8ee304e4, 0x96e20458,
-0x24630001, 0x2442ffff, 0x621824, 0xaee304e4,
-0x8ee304e4, 0x8ee204e0, 0x14620005, 0x0,
-0x8f820060, 0x2403fff7, 0x431024, 0xaf820060,
-0x8fbf0020, 0x3e00008, 0x27bd0028, 0x27bdffe0,
-0xafbf0018, 0x8ee304e8, 0x8ee204e0, 0x10620189,
-0x0, 0x8ee204e8, 0x8ee304fc, 0x21100,
-0x621821, 0x94670008, 0x92e204ed, 0x8c680000,
-0x8c690004, 0x10400023, 0x946a000a, 0x8ee204c8,
-0x34460400, 0x31420200, 0x1040001f, 0x0,
-0x96e2045a, 0x30420010, 0x1040001b, 0x3c028000,
-0x3c010001, 0x370821, 0xac2283d8, 0x8ee27264,
-0x9464000e, 0x3c050001, 0x34a53800, 0x24420004,
-0xaee27264, 0x8ee37264, 0x42400, 0x3651021,
-0x3c010001, 0x370821, 0xac2483dc, 0x62182b,
-0x14600005, 0x24e70004, 0x8ee27264, 0x3c03ffff,
-0x431021, 0xaee27264, 0x8ee27264, 0x8002917,
-0xaee27258, 0x8ee604c8, 0x8ee2726c, 0x30e4ffff,
-0x44102a, 0x10400015, 0x0, 0x8f8200d8,
-0x8ee37258, 0x431023, 0xaee2726c, 0x8ee2726c,
-0x1c400007, 0x44102a, 0x8ee2726c, 0x3c030001,
-0x431021, 0xaee2726c, 0x8ee2726c, 0x44102a,
-0x10400006, 0x0, 0x8ee201b8, 0x24420001,
-0xaee201b8, 0x8002a72, 0x8ee201b8, 0x3c020001,
-0x571021, 0x8c4283d8, 0x54400001, 0x24e7fffc,
-0x31420004, 0x104000b9, 0x30e2ffff, 0x3c020001,
-0x571021, 0x8c4283d8, 0x1040002f, 0x5021,
-0x8f840100, 0x27623000, 0x24850020, 0xa2102b,
-0x50400001, 0x27652800, 0x8f820108, 0x10a20032,
-0x0, 0x8f820104, 0x10a2002f, 0x24020015,
-0xac880000, 0xac890004, 0x8ee37264, 0xa487000e,
-0xac820018, 0xac830008, 0x8ee204e8, 0x3c030001,
-0x771821, 0x8c6383dc, 0xac860010, 0x431025,
-0xac82001c, 0xaf850100, 0x92e204ec, 0x14400066,
-0x240a0001, 0x8ee24e28, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e28, 0x24420001,
-0xaee24e28, 0x8ee24e28, 0x210c0, 0x24424e38,
-0x2e21821, 0x24020015, 0xac620000, 0x24020001,
-0x80029bf, 0xac620004, 0x8f840100, 0x27623000,
-0x24850020, 0xa2102b, 0x50400001, 0x27652800,
-0x8f820108, 0x10a20004, 0x0, 0x8f820104,
-0x14a20006, 0x24020006, 0x8ee201a8, 0x24420001,
-0xaee201a8, 0x80029bf, 0x8ee201a8, 0xac880000,
-0xac890004, 0x8ee37264, 0xa487000e, 0xac820018,
-0xac830008, 0x8ee204e8, 0xac860010, 0xac82001c,
-0xaf850100, 0x92e204ec, 0x14400037, 0x240a0001,
-0x8ee24e28, 0x210c0, 0x24424e38, 0x2e22021,
-0x8c830000, 0x24020005, 0x1462001f, 0x0,
-0x8ee34e28, 0x8ee24e2c, 0x1062001b, 0x24030040,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e2c,
-0x8ee54e28, 0x24420001, 0x10430007, 0x0,
-0x8ee24e2c, 0x24420001, 0x10a20005, 0x0,
-0x80029a9, 0x0, 0x14a00005, 0x0,
-0x8f820108, 0x24420020, 0xaf820108, 0x8f820108,
-0x8c820004, 0x2c420011, 0x50400013, 0xac800000,
-0x80029bf, 0x0, 0x8ee24e28, 0x24030040,
-0x24420001, 0x50430003, 0x1021, 0x8ee24e28,
-0x24420001, 0xaee24e28, 0x8ee24e28, 0x210c0,
-0x24424e38, 0x2e22021, 0x24020005, 0xac820000,
-0x24020001, 0xac820004, 0x1540000a, 0x24020001,
-0xafa90010, 0x8ee27264, 0x3c040001, 0x24845730,
-0x3c050004, 0xafa20014, 0x8ee604e4, 0x8002a4f,
-0x34a5f204, 0xa2e204ed, 0x8ee204e8, 0x8ee304fc,
-0x8ee47258, 0x3c060001, 0x34c63800, 0x3c010001,
-0x370821, 0xac2083d8, 0x3c010001, 0x370821,
-0xac2083dc, 0x21100, 0x431021, 0xac44000c,
-0x8ee27264, 0x2405fff8, 0x30e3ffff, 0x431021,
-0x24420007, 0x451024, 0x24630007, 0xaee27258,
-0x8ee2726c, 0x8ee47258, 0x651824, 0x431023,
-0xaee2726c, 0x3661021, 0x82202b, 0x14800004,
-0x3c03ffff, 0x8ee27258, 0x431021, 0xaee27258,
-0x8ee27258, 0x8002a64, 0xaee27264, 0x10400073,
-0x0, 0x8f830100, 0x27623000, 0x24640020,
-0x82102b, 0x14400002, 0x5021, 0x27642800,
-0x8f820108, 0x10820004, 0x0, 0x8f820104,
-0x14820006, 0x24050005, 0x8ee201a8, 0x24420001,
-0xaee201a8, 0x8002a46, 0x8ee201a8, 0xac680000,
-0xac690004, 0x8ee27264, 0xa467000e, 0xac650018,
-0xac620008, 0x8ee204e8, 0xac660010, 0xac62001c,
-0xaf840100, 0x92e204ec, 0x14400036, 0x240a0001,
-0x8ee24e28, 0x210c0, 0x24424e38, 0x2e22021,
-0x8c820000, 0x1445001f, 0x0, 0x8ee34e28,
-0x8ee24e2c, 0x1062001b, 0x24030040, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e2c, 0x8ee54e28,
-0x24420001, 0x10430007, 0x0, 0x8ee24e2c,
-0x24420001, 0x10a20005, 0x0, 0x8002a30,
-0x0, 0x14a00005, 0x0, 0x8f820108,
-0x24420020, 0xaf820108, 0x8f820108, 0x8c820004,
-0x2c420011, 0x50400013, 0xac800000, 0x8002a46,
-0x0, 0x8ee24e28, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e28, 0x24420001,
-0xaee24e28, 0x8ee24e28, 0x210c0, 0x24424e38,
-0x2e22021, 0x24020005, 0xac820000, 0x24020001,
-0xac820004, 0x1540000c, 0x30e5ffff, 0x3c040001,
-0x24845748, 0x3c050004, 0xafa90010, 0xafa00014,
-0x8ee604e4, 0x34a5f237, 0xc002403, 0x30e7ffff,
-0x8002a72, 0x0, 0x8ee27264, 0x451021,
-0xaee27264, 0x8ee2726c, 0x8ee37264, 0x3c040001,
-0x34843800, 0xa2e004ed, 0x451023, 0xaee2726c,
-0x3641021, 0x62182b, 0x14600004, 0x3c03ffff,
-0x8ee27264, 0x431021, 0xaee27264, 0x8ee304e8,
-0x96e20458, 0x24630001, 0x2442ffff, 0x621824,
-0xaee304e8, 0x8ee304e8, 0x8ee204e0, 0x14620005,
-0x0, 0x8f820060, 0x2403fff7, 0x431024,
-0xaf820060, 0x8fbf0018, 0x3e00008, 0x27bd0020,
-0x27bdffe0, 0xafbf001c, 0xafb00018, 0x8f820100,
-0x8ee34e2c, 0x8f820104, 0x8f850108, 0x24020040,
-0x24630001, 0x50620003, 0x1021, 0x8ee24e2c,
-0x24420001, 0xaee24e2c, 0x8ee24e2c, 0x8ee34e2c,
-0x210c0, 0x24424e38, 0x2e22021, 0x8ee24e28,
-0x8c870004, 0x14620007, 0xa03021, 0x8f820108,
-0x24420020, 0xaf820108, 0x8f820108, 0x8002aa2,
-0xac800000, 0x8ee24e2c, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e2c, 0x24420001,
-0x210c0, 0x24424e38, 0x2e22021, 0x8c820004,
-0x8f830108, 0x21140, 0x621821, 0xaf830108,
-0xac800000, 0x8cc20018, 0x2443fffe, 0x2c620013,
-0x104000c1, 0x31080, 0x3c010001, 0x220821,
-0x8c225770, 0x400008, 0x0, 0x8ee204f0,
-0x471021, 0xaee204f0, 0x8ee204f0, 0x8f43023c,
-0x43102b, 0x144000be, 0x0, 0x8ee304e4,
-0x8ee204f8, 0x506200ba, 0xa2e004f4, 0x8f830120,
-0x27623800, 0x24660020, 0xc2102b, 0x50400001,
-0x27663000, 0x8f820128, 0x10c20004, 0x0,
-0x8f820124, 0x14c20007, 0x0, 0x8ee201a4,
-0x8021, 0x24420001, 0xaee201a4, 0x8002b12,
-0x8ee201a4, 0x8ee204e4, 0xac62001c, 0x8ee404b0,
-0x8ee504b4, 0x2462001c, 0xac620008, 0x24020008,
-0xa462000e, 0x24020011, 0xac620018, 0xac640000,
-0xac650004, 0x8ee204c4, 0xac620010, 0xaf860120,
-0x92e24e20, 0x14400037, 0x24100001, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x8c830000,
-0x24020012, 0x1462001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x24030040, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee54e30,
-0x24420001, 0x10430007, 0x0, 0x8ee24e34,
-0x24420001, 0x10a20005, 0x0, 0x8002afc,
-0x0, 0x14a00005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400013, 0xac800000, 0x8002b12,
-0x0, 0x8ee24e30, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x24020012, 0xac820000, 0x24020001,
-0xac820004, 0x5600000b, 0x24100001, 0x8ee204e4,
-0x3c040001, 0x24845754, 0xafa00014, 0xafa20010,
-0x8ee60608, 0x8f470228, 0x3c050009, 0xc002403,
-0x34a5f006, 0x16000003, 0x24020001, 0x8002b71,
-0xa2e204f4, 0x8ee20170, 0x24420001, 0xaee20170,
-0x8ee20170, 0x8ee204e4, 0xa2e004f4, 0xaee004f0,
-0xaee204f8, 0x8f42023c, 0x50400045, 0xaee07274,
-0x8ee20184, 0x24420001, 0xaee20184, 0x8ee20184,
-0x8002b71, 0xaee07274, 0x8ee20504, 0x24030040,
-0x24420001, 0x50430003, 0x1021, 0x8ee20504,
-0x24420001, 0xaee20504, 0x8ee20504, 0x8cc30018,
-0x21080, 0x571021, 0x8c440508, 0x24020003,
-0x1462000f, 0x0, 0x3c020001, 0x571021,
-0x904283b1, 0x10400014, 0x0, 0x8ee201d0,
-0x8ee35240, 0x441021, 0xaee201d0, 0x8ee201d8,
-0x641821, 0x306300ff, 0x8002b59, 0xaee35240,
-0x8ee201cc, 0x8ee30e10, 0x441021, 0xaee201cc,
-0x8ee201d8, 0x641821, 0x306301ff, 0xaee30e10,
-0x441021, 0xaee201d8, 0x8ee20000, 0x34420040,
-0x8002b71, 0xaee20000, 0x8ee2014c, 0x3c010001,
-0x370821, 0xa02083e0, 0x24420001, 0xaee2014c,
-0x8002b71, 0x8ee2014c, 0x94c7000e, 0x8cc2001c,
-0x3c040001, 0x24845760, 0xafa60014, 0xafa20010,
-0x8cc60018, 0x3c050008, 0xc002403, 0x34a50910,
-0x8fbf001c, 0x8fb00018, 0x3e00008, 0x27bd0020,
-0x27bdff98, 0xafbf0060, 0xafbe005c, 0xafb60058,
-0xafb50054, 0xafb40050, 0xafb3004c, 0xafb20048,
-0xafb10044, 0xafb00040, 0x8f830108, 0x8f820104,
-0xafa00024, 0x106203e7, 0xafa0002c, 0x3c1e0001,
-0x37de3800, 0x3c0bffff, 0x8f930108, 0x8e620018,
-0x8f830104, 0x2443fffe, 0x2c620014, 0x104003cf,
-0x31080, 0x3c010001, 0x220821, 0x8c2257c0,
-0x400008, 0x0, 0x9663000e, 0x8ee2725c,
-0x8ee404f0, 0x431021, 0xaee2725c, 0x8e63001c,
-0x96e20458, 0x24840001, 0xaee404f0, 0x24630001,
-0x2442ffff, 0x621824, 0xaee304e4, 0x8f42023c,
-0x82202b, 0x148003b9, 0x0, 0x8f830120,
-0x27623800, 0x24660020, 0xc2102b, 0x50400001,
-0x27663000, 0x8f820128, 0x10c20004, 0x0,
-0x8f820124, 0x14c20007, 0x0, 0x8ee201a4,
-0x8021, 0x24420001, 0xaee201a4, 0x8002bfe,
-0x8ee201a4, 0x8ee204e4, 0xac62001c, 0x8ee404b0,
-0x8ee504b4, 0x2462001c, 0xac620008, 0x24020008,
-0xa462000e, 0x24020011, 0xac620018, 0xac640000,
-0xac650004, 0x8ee204c4, 0xac620010, 0xaf860120,
-0x92e24e20, 0x14400037, 0x24100001, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x8c830000,
-0x24020012, 0x1462001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x240c0040, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee34e30,
-0x24420001, 0x104c0007, 0x0, 0x8ee24e34,
-0x24420001, 0x10620005, 0x0, 0x8002be8,
-0x0, 0x14600005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400013, 0xac800000, 0x8002bfe,
-0x0, 0x8ee24e30, 0x240c0040, 0x24420001,
-0x504c0003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x24020012, 0x240c0001, 0xac820000,
-0xac8c0004, 0x5600000d, 0x24100001, 0x8ee204e4,
-0x3c040001, 0x24845754, 0xafa00014, 0xafa20010,
-0x8ee60608, 0x8f470228, 0x3c050009, 0x34a5f006,
-0xc002403, 0xafab0038, 0x8fab0038, 0x1200030a,
-0x240c0001, 0x8002f19, 0x0, 0x966c001c,
-0xafac002c, 0x9662001e, 0x3c0c8000, 0xafac0024,
-0xae62001c, 0x8e75001c, 0x8ee204fc, 0x8ee404fc,
-0x151900, 0x621021, 0x8c52000c, 0x92e27b98,
-0x641821, 0x9476000a, 0x14400003, 0x32c20002,
-0xaef27ba4, 0xaef57b9c, 0x1040004b, 0x8021,
-0x96e2045a, 0x30420002, 0x10400047, 0x0,
-0x8e63001c, 0x8ee204fc, 0x32100, 0x821021,
-0x8c42000c, 0x37e1821, 0x24420022, 0x43102b,
-0x1440000a, 0x24050014, 0x8ee204fc, 0x821021,
-0x8c44000c, 0xafab0038, 0xc002f75, 0x2484000e,
-0x8fab0038, 0x8002c52, 0x3050ffff, 0x8ee204fc,
-0x821021, 0x8c42000c, 0x9450000e, 0x94430010,
-0x94440012, 0x94450014, 0x2038021, 0x2048021,
-0x2058021, 0x94430016, 0x94440018, 0x9445001a,
-0x2038021, 0x2048021, 0x2058021, 0x9443001c,
-0x9444001e, 0x94420020, 0x2038021, 0x2048021,
-0x2028021, 0x101c02, 0x3202ffff, 0x628021,
-0x8e63001c, 0x8ee204fc, 0x102402, 0x32900,
-0xa21021, 0x8c43000c, 0x3202ffff, 0x828021,
-0x37e1021, 0x24630018, 0x62182b, 0x14600009,
-0x0, 0x8ee204fc, 0xa21021, 0x8c43000c,
-0x101027, 0x3c01ffff, 0x230821, 0x8002c6f,
-0xa4220018, 0x8ee204fc, 0xa21021, 0x8c43000c,
-0x101027, 0xa4620018, 0x96e2045a, 0x8821,
-0x30420008, 0x14400063, 0xa021, 0x8e63001c,
-0x8ee204fc, 0x33100, 0xc21021, 0x8c42000c,
-0x37e1821, 0x24420022, 0x43102b, 0x14400035,
-0x0, 0x8ee204fc, 0xc21021, 0x8c42000c,
-0x24470010, 0x37e1021, 0xe2102b, 0x50400001,
-0xeb3821, 0x8ee204fc, 0x94f10000, 0xc21021,
-0x8c42000c, 0x24470016, 0x37e1021, 0xe2102b,
-0x14400002, 0x2634ffec, 0xeb3821, 0x8ee204fc,
-0x90e30001, 0xc21021, 0x8c42000c, 0x2447001a,
-0x37e1021, 0xe2102b, 0x14400002, 0x2838821,
-0xeb3821, 0x94e20000, 0x24e70002, 0x2228821,
-0x37e1021, 0xe2102b, 0x50400001, 0xeb3821,
-0x94e20000, 0x24e70002, 0x2228821, 0x37e1021,
-0xe2102b, 0x50400001, 0xeb3821, 0x94e20000,
-0x24e70002, 0x2228821, 0x37e1021, 0xe2102b,
-0x50400001, 0xeb3821, 0x94e20000, 0x8002cd0,
-0x2228821, 0x8ee204fc, 0xc21021, 0x8c43000c,
-0x8ee204fc, 0x94710010, 0x8ee304fc, 0xc21021,
-0x8c44000c, 0xc31821, 0x8c62000c, 0x2634ffec,
-0x90840017, 0x8ee304fc, 0x9442001a, 0x2848821,
-0xc31821, 0x8c65000c, 0x8ee304fc, 0x2228821,
-0x8ee204fc, 0xc31821, 0xc21021, 0x8c44000c,
-0x8c62000c, 0x94a3001c, 0x9484001e, 0x94420020,
-0x2238821, 0x2248821, 0x2228821, 0x111c02,
-0x3222ffff, 0x628821, 0x111c02, 0x3222ffff,
-0x628821, 0x32c20001, 0x104000b2, 0x0,
-0x96e2045a, 0x30420001, 0x104000ae, 0x32c20080,
-0x10400008, 0x0, 0x92e27b98, 0x14400005,
-0x0, 0x240c0001, 0xa2ec7b98, 0xaef57b9c,
-0xaef27ba4, 0x8ee304fc, 0x151100, 0x431021,
-0x8c47000c, 0x37e1821, 0x24e2000e, 0x43102b,
-0x14400008, 0xe02021, 0x2405000e, 0xc002f75,
-0xafab0038, 0x3042ffff, 0x8fab0038, 0x8002d09,
-0x2028021, 0x94e60000, 0x24e70002, 0x94e50000,
-0x24e70002, 0x94e30000, 0x24e70002, 0x94e20000,
-0x24e70002, 0x94e40000, 0x24e70002, 0x2068021,
-0x2058021, 0x2038021, 0x2028021, 0x94e20000,
-0x94e30002, 0x2048021, 0x2028021, 0x2038021,
-0x101c02, 0x3202ffff, 0x628021, 0x101c02,
-0x3202ffff, 0x8ee47b9c, 0x628021, 0x14950004,
-0x3205ffff, 0x96620016, 0x8002d17, 0x512021,
-0x96620016, 0x542021, 0x41402, 0x3083ffff,
-0x432021, 0x852023, 0x41402, 0x822021,
-0x3084ffff, 0x50800001, 0x3404ffff, 0x8ee27ba4,
-0x24430017, 0x37e1021, 0x62102b, 0x50400001,
-0x6b1821, 0x90630000, 0x24020011, 0x14620031,
-0x24020006, 0x8ee27ba4, 0x37e1821, 0x24420028,
-0x43102b, 0x14400018, 0x0, 0x8ee27b9c,
-0x12a2000a, 0x32c20100, 0x8ee27ba4, 0x3c01ffff,
-0x220821, 0x94220028, 0x822021, 0x41c02,
-0x3082ffff, 0x622021, 0x32c20100, 0x14400004,
-0x41027, 0x92e27b98, 0x14400002, 0x41027,
-0x3044ffff, 0x8ee27ba4, 0x3c01ffff, 0x220821,
-0x8002d8a, 0xa4240028, 0x8ee27b9c, 0x12a20008,
-0x32c20100, 0x8ee27ba4, 0x94420028, 0x822021,
-0x41c02, 0x3082ffff, 0x622021, 0x32c20100,
-0x14400004, 0x41027, 0x92e27b98, 0x14400002,
-0x41027, 0x3044ffff, 0x8ee27ba4, 0x8002d8a,
-0xa4440028, 0x1462002f, 0x37e1821, 0x8ee27ba4,
-0x24420032, 0x43102b, 0x14400018, 0x0,
-0x8ee27b9c, 0x12a2000a, 0x32c20100, 0x8ee27ba4,
-0x3c01ffff, 0x220821, 0x94220032, 0x822021,
-0x41c02, 0x3082ffff, 0x622021, 0x32c20100,
-0x14400004, 0x41027, 0x92e27b98, 0x14400002,
-0x41027, 0x3044ffff, 0x8ee27ba4, 0x3c01ffff,
-0x220821, 0x8002d8a, 0xa4240032, 0x8ee27b9c,
-0x12a20008, 0x32c20100, 0x8ee27ba4, 0x94420032,
-0x822021, 0x41c02, 0x3082ffff, 0x622021,
-0x32c20100, 0x14400004, 0x41027, 0x92e27b98,
-0x14400002, 0x41027, 0x3044ffff, 0x8ee27ba4,
-0xa4440032, 0x8fac0024, 0x1180002c, 0x37e1821,
-0x8e420000, 0xae42fffc, 0x2642000a, 0x43102b,
-0x1440001b, 0x34038100, 0x26430004, 0x37e1021,
-0x62102b, 0x14400003, 0x602021, 0x6b1821,
-0x602021, 0x8c620000, 0x24630004, 0xae420000,
-0x37e1021, 0x62102b, 0x50400001, 0x6b1821,
-0x8c620000, 0xac820000, 0x34028100, 0xa4620000,
-0x24630002, 0x37e1021, 0x62102b, 0x50400001,
-0x6b1821, 0x97ac002e, 0x8002db4, 0xa46c0000,
-0x8e420004, 0x8e440008, 0xa6430008, 0x97ac002e,
-0xa64c000a, 0xae420000, 0xae440004, 0x9662000e,
-0x2652fffc, 0x24420004, 0xa662000e, 0x9662000e,
-0x8ee3725c, 0x621821, 0xaee3725c, 0xafb20018,
-0x8ee3725c, 0xafa3001c, 0x8ee2725c, 0x2c42003c,
-0x10400004, 0x24620001, 0x2403fffe, 0x431024,
-0xafa2001c, 0x32c20080, 0x1040000c, 0x32c20100,
-0x8ee27ba8, 0x24430001, 0x210c0, 0x571021,
-0xaee37ba8, 0x8fa30018, 0x8fa4001c, 0xac437bac,
-0xac447bb0, 0x8002ea0, 0xaee0725c, 0x10400072,
-0x0, 0x8ee27ba8, 0x24430001, 0x210c0,
-0x571021, 0xaee37ba8, 0x8fa30018, 0x8fa4001c,
-0xac437bac, 0xac447bb0, 0x8ee27ba8, 0x10400063,
-0x4821, 0x5021, 0x8f8200f0, 0x24480008,
-0x27621800, 0x102102b, 0x50400001, 0x27681000,
-0x8f8200f4, 0x15020007, 0x0, 0x8ee201b4,
-0x8021, 0x24420001, 0xaee201b4, 0x8002dfa,
-0x8ee201b4, 0x8f8300f0, 0x24100001, 0x1571021,
-0x8c447bac, 0x8c457bb0, 0xac640000, 0xac650004,
-0xaf8800f0, 0x16000006, 0x2ea1021, 0x8ee20088,
-0x24420001, 0xaee20088, 0x8002e3f, 0x8ee20088,
-0x8c427bb0, 0x8ee400e0, 0x8ee500e4, 0x8ee67b9c,
-0x401821, 0x1021, 0xa32821, 0xa3382b,
-0x822021, 0x872021, 0x8ee204fc, 0xc93021,
-0x63100, 0xaee400e0, 0xaee500e4, 0xc23021,
-0x94c2000a, 0x240c0002, 0x21142, 0x30430003,
-0x106c0016, 0x28620003, 0x10400005, 0x240c0001,
-0x106c0008, 0x0, 0x8002e3f, 0x0,
-0x240c0003, 0x106c0017, 0x0, 0x8002e3f,
-0x0, 0x8ee200e8, 0x8ee300ec, 0x24630001,
-0x2c640001, 0x441021, 0xaee200e8, 0xaee300ec,
-0x8ee200e8, 0x8002e3f, 0x8ee300ec, 0x8ee200f0,
-0x8ee300f4, 0x24630001, 0x2c640001, 0x441021,
-0xaee200f0, 0xaee300f4, 0x8ee200f0, 0x8002e3f,
-0x8ee300f4, 0x8ee200f8, 0x8ee300fc, 0x24630001,
-0x2c640001, 0x441021, 0xaee200f8, 0xaee300fc,
-0x8ee200f8, 0x8ee300fc, 0x8ee27ba8, 0x25290001,
-0x122102b, 0x1440ffa0, 0x254a0008, 0xa2e07b98,
-0x8002e9f, 0xaee07ba8, 0x8f8200f0, 0x24470008,
-0x27621800, 0xe2102b, 0x50400001, 0x27671000,
-0x8f8200f4, 0x14e20007, 0x0, 0x8ee201b4,
-0x8021, 0x24420001, 0xaee201b4, 0x8002e5d,
-0x8ee201b4, 0x8f8200f0, 0x24100001, 0x8fa30018,
-0x8fa4001c, 0xac430000, 0xac440004, 0xaf8700f0,
-0x16000007, 0x0, 0x8ee20088, 0x24420001,
-0xaee20088, 0x8ee20088, 0x8002ea0, 0xaee0725c,
-0x8ee2725c, 0x8ee400e0, 0x8ee500e4, 0x240c0002,
-0x401821, 0x1021, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0x161142, 0x30430003,
-0xaee400e0, 0xaee500e4, 0x106c0017, 0x2c620003,
-0x10400005, 0x240c0001, 0x106c0008, 0x0,
-0x8002ea0, 0xaee0725c, 0x240c0003, 0x106c0019,
-0x0, 0x8002ea0, 0xaee0725c, 0x8ee200e8,
-0x8ee300ec, 0x24630001, 0x2c640001, 0x441021,
-0xaee200e8, 0xaee300ec, 0x8ee200e8, 0x8ee300ec,
-0x8002ea0, 0xaee0725c, 0x8ee200f0, 0x8ee300f4,
-0x24630001, 0x2c640001, 0x441021, 0xaee200f0,
-0xaee300f4, 0x8ee200f0, 0x8ee300f4, 0x8002ea0,
-0xaee0725c, 0x8ee200f8, 0x8ee300fc, 0x24630001,
-0x2c640001, 0x441021, 0xaee200f8, 0xaee300fc,
-0x8ee200f8, 0x8ee300fc, 0xaee0725c, 0x8e62001c,
-0x96e30458, 0x8ee404f0, 0x24420001, 0x2463ffff,
-0x431024, 0x24840001, 0xaee204e4, 0xaee404f0,
-0x8f42023c, 0x82202b, 0x148000b0, 0x0,
-0x8f830120, 0x27623800, 0x24660020, 0xc2102b,
-0x50400001, 0x27663000, 0x8f820128, 0x10c20004,
-0x0, 0x8f820124, 0x14c20007, 0x0,
-0x8ee201a4, 0x8021, 0x24420001, 0xaee201a4,
-0x8002f07, 0x8ee201a4, 0x8ee204e4, 0xac62001c,
-0x8ee404b0, 0x8ee504b4, 0x2462001c, 0xac620008,
-0x24020008, 0xa462000e, 0x24020011, 0xac620018,
-0xac640000, 0xac650004, 0x8ee204c4, 0xac620010,
-0xaf860120, 0x92e24e20, 0x14400037, 0x24100001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c830000, 0x24020012, 0x1462001f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062001b, 0x240c0040,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee34e30, 0x24420001, 0x104c0007, 0x0,
-0x8ee24e34, 0x24420001, 0x10620005, 0x0,
-0x8002ef1, 0x0, 0x14600005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400013, 0xac800000,
-0x8002f07, 0x0, 0x8ee24e30, 0x240c0040,
-0x24420001, 0x504c0003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x24020012, 0x240c0001,
-0xac820000, 0xac8c0004, 0x5600000d, 0x24100001,
-0x8ee204e4, 0x3c040001, 0x24845754, 0xafa00014,
-0xafa20010, 0x8ee60608, 0x8f470228, 0x3c050009,
-0x34a5f006, 0xc002403, 0xafab0038, 0x8fab0038,
-0x16000003, 0x240c0001, 0x8002f5c, 0xa2ec04f4,
-0x8ee20170, 0x24420001, 0xaee20170, 0x8ee20170,
-0x8ee204e4, 0xa2e004f4, 0xaee004f0, 0xaee07274,
-0xaee204f8, 0x8f42023c, 0x10400038, 0x0,
-0x8ee20184, 0x24420001, 0xaee20184, 0x8002f5c,
-0x8ee20184, 0x8ee20504, 0x240c0040, 0x24420001,
-0x504c0003, 0x1021, 0x8ee20504, 0x24420001,
-0xaee20504, 0x8ee20504, 0x8e630018, 0x240c0003,
-0x21080, 0x571021, 0x146c000f, 0x8c440508,
-0x3c020001, 0x571021, 0x904283b1, 0x10400014,
-0x0, 0x8ee201d0, 0x8ee35240, 0x441021,
-0xaee201d0, 0x8ee201d8, 0x641821, 0x306300ff,
-0x8002f4f, 0xaee35240, 0x8ee201cc, 0x8ee30e10,
-0x441021, 0xaee201cc, 0x8ee201d8, 0x641821,
-0x306301ff, 0xaee30e10, 0x441021, 0xaee201d8,
-0x8ee20000, 0x34420040, 0x8002f5c, 0xaee20000,
-0x8ee2014c, 0x3c010001, 0x370821, 0xa02083e0,
-0x24420001, 0xaee2014c, 0x8ee2014c, 0x8f820108,
-0x24420020, 0xaf820108, 0x8f820108, 0x8f820108,
-0x27633000, 0x43102b, 0x14400002, 0x27622800,
-0xaf820108, 0x8f830108, 0x8f820104, 0x1462fc1e,
-0x0, 0x8fbf0060, 0x8fbe005c, 0x8fb60058,
-0x8fb50054, 0x8fb40050, 0x8fb3004c, 0x8fb20048,
-0x8fb10044, 0x8fb00040, 0x3e00008, 0x27bd0068,
-0x52843, 0x10a0000d, 0x3021, 0x3c030001,
-0x34633800, 0x3c07ffff, 0x3631021, 0x82102b,
-0x50400001, 0x872021, 0x94820000, 0x24840002,
-0x24a5ffff, 0x14a0fff8, 0xc23021, 0x61c02,
-0x30c2ffff, 0x623021, 0x61c02, 0x30c2ffff,
-0x623021, 0x3e00008, 0x30c2ffff, 0x27bdff88,
-0x240f0001, 0xafbf0070, 0xafbe006c, 0xafb60068,
-0xafb50064, 0xafb40060, 0xafb3005c, 0xafb20058,
-0xafb10054, 0xafb00050, 0xa3a00027, 0xafaf002c,
-0x8ee204d4, 0x8021, 0x30420001, 0x1440002a,
-0xa3a00037, 0x8f8700e0, 0x8f8800c4, 0x8f8200e8,
-0xe22023, 0x2c821000, 0x50400001, 0x24841000,
-0x420c2, 0x801821, 0x8ee400c8, 0x8ee500cc,
-0x1021, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xaee400c8, 0xaee500cc, 0x8f8300c8,
-0x3c02000a, 0x3442efff, 0x1032023, 0x44102b,
-0x10400003, 0x3c02000a, 0x3442f000, 0x822021,
-0x801821, 0x8ee400c0, 0x8ee500c4, 0x1021,
-0xa32821, 0xa3302b, 0x822021, 0x862021,
-0xaee400c0, 0xaee500c4, 0xaf8800c8, 0xaf8700e4,
-0x80034cc, 0xaf8700e8, 0x3c020001, 0x571021,
-0x904283c0, 0x1040000b, 0x0, 0x3c140001,
-0x297a021, 0x8e9483c4, 0x3c130001, 0x2779821,
-0x8e7383c8, 0x3c120001, 0x2579021, 0x8003193,
-0x8e5283cc, 0x8f8300e0, 0x8f8200e4, 0x10430007,
-0x8821, 0x8f8200e4, 0x24110001, 0x8c430000,
-0x8c440004, 0xafa30018, 0xafa4001c, 0x1620000e,
-0x3c02ffff, 0x8f8200c4, 0xafa20010, 0x8f8200c8,
-0x3c040001, 0x24845870, 0xafa20014, 0x8f8600e0,
-0x8f8700e4, 0x3c050006, 0xc002403, 0x34a5f000,
-0x80034cc, 0x0, 0x8fa3001c, 0x8fb20018,
-0x3074ffff, 0x2694fffc, 0x621024, 0x10400058,
-0x2409821, 0x3c020080, 0x621024, 0x1040000a,
-0x3c040040, 0x8ee2007c, 0x24420001, 0xaee2007c,
-0x8ee2007c, 0x8ee201fc, 0x24420001, 0xaee201fc,
-0x80034c6, 0x8ee201fc, 0x3c060004, 0x3c0b0001,
-0x3c0a0002, 0x3c050010, 0x3c090008, 0x8ee20080,
-0x3c080020, 0x34078000, 0x24420001, 0xaee20080,
-0x8ee20080, 0x8fa2001c, 0x441824, 0x10660021,
-0xc3102b, 0x14400007, 0x0, 0x106b0011,
-0x0, 0x106a0015, 0x0, 0x8003049,
-0x42042, 0x10650023, 0xa3102b, 0x14400005,
-0x0, 0x10690019, 0x0, 0x8003049,
-0x42042, 0x10680021, 0x0, 0x8003049,
-0x42042, 0x8ee20034, 0x24420001, 0xaee20034,
-0x8ee20034, 0x8003049, 0x42042, 0x8ee201ec,
-0x24420001, 0xaee201ec, 0x8ee201ec, 0x8003049,
-0x42042, 0x8ee201f0, 0x24420001, 0xaee201f0,
-0x8ee201f0, 0x8003049, 0x42042, 0x8ee201f4,
-0x24420001, 0xaee201f4, 0x8ee201f4, 0x8003049,
-0x42042, 0x8ee20030, 0x24420001, 0xaee20030,
-0x8ee20030, 0x8003049, 0x42042, 0x8ee201f8,
-0x24420001, 0xaee201f8, 0x8ee201f8, 0x42042,
-0x1087047c, 0x0, 0x800300e, 0x0,
-0x3c020001, 0x571021, 0x904283b2, 0x14400084,
-0x24020001, 0x3c030001, 0x771821, 0x906383b3,
-0x1462007f, 0x3c020100, 0x8e430000, 0x621024,
-0x1040006f, 0x2402ffff, 0x14620005, 0x24100001,
-0x96430004, 0x3402ffff, 0x10620075, 0x0,
-0x92e204d8, 0x14400072, 0x0, 0x3c020001,
-0x571021, 0x8c4283b4, 0x28420005, 0x10400020,
-0x3821, 0x3c020001, 0x571021, 0x8c4283b4,
-0x18400016, 0x2821, 0x96660000, 0x520c0,
-0x971021, 0x9442777e, 0x14460009, 0x971021,
-0x94437780, 0x96620002, 0x14620005, 0x971021,
-0x94437782, 0x96620004, 0x50620008, 0x24070001,
-0x3c020001, 0x571021, 0x8c4283b4, 0x24a50001,
-0xa2102a, 0x5440ffee, 0x520c0, 0x30e200ff,
-0x10400440, 0x0, 0x80030d5, 0x0,
-0x2402021, 0xc0022fe, 0x24050006, 0x3044001f,
-0x428c0, 0x2e51021, 0x9442727c, 0x30424000,
-0x14400434, 0xb71021, 0x9443727e, 0x96620000,
-0x1462000b, 0x418c0, 0xb71021, 0x94437280,
-0x96620002, 0x14620006, 0x418c0, 0xb71021,
-0x94437282, 0x96620004, 0x10620035, 0x418c0,
-0x2e31021, 0x9442727c, 0x30428000, 0x14400421,
-0x2e31021, 0x944b727c, 0x96670000, 0xb28c0,
-0xb71021, 0x9442737e, 0x80030b7, 0x3021,
-0x420c0, 0x2e41021, 0x9443737c, 0x2e41021,
-0x944b737c, 0x30638000, 0x14600010, 0xb28c0,
-0xb71021, 0x9442737e, 0x1447fff5, 0x1602021,
-0xb71021, 0x94437380, 0x96620002, 0x5462fff1,
-0x420c0, 0xb71021, 0x94437382, 0x96620004,
-0x5462ffec, 0x420c0, 0x24060001, 0x30c200ff,
-0x10400400, 0x0, 0x80030d5, 0x0,
-0x97430202, 0x96420000, 0x146203fa, 0x0,
-0x97430204, 0x96420002, 0x146203f6, 0x0,
-0x97430206, 0x96420004, 0x146203f2, 0x0,
-0x92420000, 0x3a030001, 0x30420001, 0x431024,
-0x10400074, 0x2402ffff, 0x8e630000, 0x14620004,
-0x3402ffff, 0x96630004, 0x1062006f, 0x240f0002,
-0x3c020001, 0x571021, 0x904283b2, 0x1440006a,
-0x240f0003, 0x92e204d8, 0x54400068, 0xafaf002c,
-0x3c020001, 0x571021, 0x8c4283b4, 0x28420005,
-0x10400020, 0x3821, 0x3c020001, 0x571021,
-0x8c4283b4, 0x18400016, 0x2821, 0x96660000,
-0x520c0, 0x971021, 0x9442777e, 0x14460009,
-0x971021, 0x94437780, 0x96620002, 0x14620005,
-0x971021, 0x94437782, 0x96620004, 0x50620008,
-0x24070001, 0x3c020001, 0x571021, 0x8c4283b4,
-0x24a50001, 0xa2102a, 0x5440ffee, 0x520c0,
-0x30e200ff, 0x14400044, 0x240f0003, 0x80034c6,
-0x0, 0x2402021, 0xc0022fe, 0x24050006,
-0x3044001f, 0x428c0, 0x2e51021, 0x9442727c,
-0x30424000, 0x144003af, 0xb71021, 0x9443727e,
-0x96620000, 0x1462000b, 0x418c0, 0xb71021,
-0x94437280, 0x96620002, 0x14620006, 0x418c0,
-0xb71021, 0x94437282, 0x96620004, 0x10620027,
-0x418c0, 0x2e31021, 0x9442727c, 0x30428000,
-0x1440039c, 0x2e31021, 0x944b727c, 0x96670000,
-0xb28c0, 0xb71021, 0x9442737e, 0x800313c,
-0x3021, 0x420c0, 0x2e41021, 0x9443737c,
-0x2e41021, 0x944b737c, 0x30638000, 0x14600010,
-0xb28c0, 0xb71021, 0x9442737e, 0x1447fff5,
-0x1602021, 0xb71021, 0x94437380, 0x96620002,
-0x5462fff1, 0x420c0, 0xb71021, 0x94437382,
-0x96620004, 0x5462ffec, 0x420c0, 0x24060001,
-0x30c200ff, 0x1040037b, 0x0, 0x800314f,
-0x240f0003, 0x240f0001, 0xafaf002c, 0x8f420260,
-0x54102b, 0x1040003a, 0x0, 0x8f8300e4,
-0x8f8200e0, 0x10620003, 0x24630008, 0xaf8300e4,
-0xaf8300e8, 0x8ee400c0, 0x8ee500c4, 0x2801821,
-0x1021, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xaee400c0, 0xaee500c4, 0x8ee20058,
-0x24420001, 0xaee20058, 0x8ee20058, 0x8ee2007c,
-0x24420001, 0xaee2007c, 0x8ee2007c, 0x8f8200e0,
-0xafa20010, 0x8f8200e4, 0x3c040001, 0x24845878,
-0xafa20014, 0x8fa60018, 0x8fa7001c, 0x3c050006,
-0xc002403, 0x34a5f003, 0x80034cc, 0x0,
-0x8ee25240, 0xafa20010, 0x8ee25244, 0x3c040001,
-0x24845884, 0xafa20014, 0x8ee60e10, 0x8ee70e18,
-0x3c050006, 0xc002403, 0x34a5f002, 0x8ee201c0,
-0x24420001, 0xaee201c0, 0x8ee20000, 0x8ee301c0,
-0x2403ffbf, 0x431024, 0x8003470, 0xaee20000,
-0x96e20468, 0x54102b, 0x10400003, 0x0,
-0x240f0001, 0xa3af0027, 0x12800301, 0x24160007,
-0x24150040, 0x241e0001, 0x240e0012, 0x8ee2724c,
-0x8f430280, 0x24420001, 0x304207ff, 0x106202d3,
-0x0, 0x93a20027, 0x10400014, 0x0,
-0x8ee35240, 0x8ee25244, 0x10620009, 0x26ed5244,
-0x8ee65244, 0x8ee35244, 0x21140, 0x24425248,
-0x2e28021, 0x24630001, 0x80031bf, 0x306b00ff,
-0x92e27248, 0x1440ffca, 0x0, 0x8ee201e0,
-0x24420001, 0xaee201e0, 0x8ee201e0, 0x8ee30e10,
-0x8ee20e18, 0x1062ffc2, 0x26ed0e18, 0x8ee60e18,
-0x8ee30e18, 0x21140, 0x24420e20, 0x2e28021,
-0x24630001, 0x306b01ff, 0x96e2046a, 0x30420010,
-0x10400019, 0x0, 0x9642000c, 0x340f8100,
-0x144f0015, 0x0, 0x3c020001, 0x571021,
-0x904283c0, 0x14400010, 0x0, 0x9642000e,
-0xa6020016, 0x8e420008, 0x8e430004, 0x8e440000,
-0x2694fffc, 0xae42000c, 0xae430008, 0xae440004,
-0x9602000e, 0x26730004, 0x240f0001, 0xa3af0037,
-0x34420200, 0xa602000e, 0x8e020000, 0x8e030004,
-0x3c040001, 0x34843800, 0x306a0007, 0x26a9823,
-0x3641021, 0x262102b, 0x10400005, 0x28aa021,
-0x2641023, 0x3621823, 0x3c020020, 0x439823,
-0x26820007, 0x2404fff8, 0x9603000a, 0x446024,
-0x6a1821, 0x6c102b, 0x10400002, 0x1803821,
-0x603821, 0xae130018, 0x8f880120, 0x24e20007,
-0x443824, 0x27623800, 0x25090020, 0x122102b,
-0x50400001, 0x27693000, 0x8f820128, 0x11220004,
-0x0, 0x8f820124, 0x15220007, 0x1401821,
-0x8ee201a4, 0x8821, 0x24420001, 0xaee201a4,
-0x800324c, 0x8ee201a4, 0x8e040000, 0x8e050004,
-0x1021, 0xad130008, 0xa507000e, 0xad160018,
-0xad06001c, 0xa3302b, 0xa32823, 0x822023,
-0x862023, 0xad040000, 0xad050004, 0x8ee204c0,
-0xad020010, 0xaf890120, 0x92e24e20, 0x14400033,
-0x24110001, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8c820000, 0x1456001f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062001b, 0x0,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee34e30, 0x24420001, 0x10550007, 0x0,
-0x8ee24e34, 0x24420001, 0x10620005, 0x0,
-0x8003239, 0x0, 0x14600005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400010, 0xac800000,
-0x800324c, 0x0, 0x8ee24e30, 0x24420001,
-0x50550003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0xac960000, 0xac9e0004, 0x16200018,
-0x3c050006, 0x8e020018, 0x3c040001, 0x24845890,
-0xafa20010, 0x8e020000, 0x8e030004, 0x34a5f009,
-0x2003021, 0xc002403, 0xafa30014, 0x93a20037,
-0x10400216, 0x340f8100, 0x8e420004, 0x8e430008,
-0x8e44000c, 0xa64f000c, 0xae420000, 0xae430004,
-0xae440008, 0x96020016, 0x8003470, 0xa642000e,
-0x14ec0168, 0x28a1823, 0x960c000a, 0x9603000e,
-0x28a1023, 0xa602000a, 0x34620004, 0xa602000e,
-0x8f880120, 0x27623800, 0x25090020, 0x122102b,
-0x14400002, 0x306affff, 0x27693000, 0x8f820128,
-0x11220004, 0x0, 0x8f820124, 0x15220007,
-0x24040020, 0x8ee201a4, 0x8821, 0x24420001,
-0xaee201a4, 0x80032ca, 0x8ee201a4, 0x8ee5724c,
-0x8ee60490, 0x8ee70494, 0xa504000e, 0x24040004,
-0xad100008, 0xad040018, 0x52940, 0xa01821,
-0x1021, 0xe33821, 0xe3202b, 0xc23021,
-0xc43021, 0xad060000, 0xad070004, 0x8ee2724c,
-0xad02001c, 0x8ee204c4, 0xad020010, 0xaf890120,
-0x92e24e20, 0x14400033, 0x24110001, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x8c820000,
-0x1456001f, 0x0, 0x8ee34e30, 0x8ee24e34,
-0x1062001b, 0x0, 0x8c820004, 0x24420001,
-0xac820004, 0x8ee24e34, 0x8ee34e30, 0x24420001,
-0x10550007, 0x0, 0x8ee24e34, 0x24420001,
-0x10620005, 0x0, 0x80032b7, 0x0,
-0x14600005, 0x0, 0x8f820128, 0x24420020,
-0xaf820128, 0x8f820128, 0x8c820004, 0x2c420011,
-0x50400010, 0xac800000, 0x80032ca, 0x0,
-0x8ee24e30, 0x24420001, 0x50550003, 0x1021,
-0x8ee24e30, 0x24420001, 0xaee24e30, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0xac960000,
-0xac9e0004, 0x1620000d, 0x0, 0xa60c000a,
-0xa60a000e, 0x8f820100, 0xafa20010, 0x8f820104,
-0x3c040001, 0x2484589c, 0x3c050006, 0xafa20014,
-0x8ee6724c, 0x800343b, 0x34a5f00b, 0x3c010001,
-0x370821, 0xa02083c0, 0xadab0000, 0x8ee201d8,
-0x8ee3724c, 0x2442ffff, 0xaee201d8, 0x8ee201d8,
-0x24630001, 0x306307ff, 0x26e25244, 0x15a20006,
-0xaee3724c, 0x8ee201d0, 0x2442ffff, 0xaee201d0,
-0x80032ef, 0x8ee201d0, 0x8ee201cc, 0x2442ffff,
-0xaee201cc, 0x8ee201cc, 0x8f420240, 0x10400073,
-0x0, 0x8ee20e1c, 0x24420001, 0xaee20e1c,
-0x8f430240, 0x43102b, 0x14400176, 0xa021,
-0x8f830120, 0x27623800, 0x24660020, 0xc2102b,
-0x50400001, 0x27663000, 0x8f820128, 0x10c20004,
-0x0, 0x8f820124, 0x14c20007, 0x0,
-0x8ee201a4, 0x8821, 0x24420001, 0xaee201a4,
-0x800334f, 0x8ee201a4, 0x8ee2724c, 0xac62001c,
-0x8ee404a8, 0x8ee504ac, 0x2462001c, 0xac620008,
-0x24020008, 0xa462000e, 0x24020011, 0xac620018,
-0xac640000, 0xac650004, 0x8ee204c4, 0xac620010,
-0xaf860120, 0x92e24e20, 0x14400033, 0x24110001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c820000, 0x144e001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x0, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee34e30,
-0x24420001, 0x10550007, 0x0, 0x8ee24e34,
-0x24420001, 0x10620005, 0x0, 0x800333c,
-0x0, 0x14600005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400010, 0xac800000, 0x800334f,
-0x0, 0x8ee24e30, 0x24420001, 0x50550003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0xac8e0000, 0xac9e0004, 0x5620000d, 0x24110001,
-0x8ee2724c, 0x3c040001, 0x248458a8, 0xafa00014,
-0xafa20010, 0x8ee6724c, 0x8f470280, 0x3c050009,
-0x34a5f008, 0xc002403, 0xafae0048, 0x8fae0048,
-0x56200001, 0xaee00e1c, 0x8ee20188, 0x24420001,
-0xaee20188, 0x80033c8, 0x8ee20188, 0x8f830120,
-0x27623800, 0x24660020, 0xc2102b, 0x50400001,
-0x27663000, 0x8f820128, 0x10c20004, 0x0,
-0x8f820124, 0x14c20007, 0x0, 0x8ee201a4,
-0x8821, 0x24420001, 0xaee201a4, 0x80033ba,
-0x8ee201a4, 0x8ee2724c, 0xac62001c, 0x8ee404a8,
-0x8ee504ac, 0x2462001c, 0xac620008, 0x24020008,
-0xa462000e, 0x24020011, 0xac620018, 0xac640000,
-0xac650004, 0x8ee204c4, 0xac620010, 0xaf860120,
-0x92e24e20, 0x14400033, 0x24110001, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x8c820000,
-0x144e001f, 0x0, 0x8ee34e30, 0x8ee24e34,
-0x1062001b, 0x0, 0x8c820004, 0x24420001,
-0xac820004, 0x8ee24e34, 0x8ee34e30, 0x24420001,
-0x10550007, 0x0, 0x8ee24e34, 0x24420001,
-0x10620005, 0x0, 0x80033a7, 0x0,
-0x14600005, 0x0, 0x8f820128, 0x24420020,
-0xaf820128, 0x8f820128, 0x8c820004, 0x2c420011,
-0x50400010, 0xac800000, 0x80033ba, 0x0,
-0x8ee24e30, 0x24420001, 0x50550003, 0x1021,
-0x8ee24e30, 0x24420001, 0xaee24e30, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0xac8e0000,
-0xac9e0004, 0x1620000d, 0x0, 0x8ee2724c,
-0x3c040001, 0x248458a8, 0xafa00014, 0xafa20010,
-0x8ee6724c, 0x8f470280, 0x3c050009, 0x34a5f008,
-0xc002403, 0xafae0048, 0x8fae0048, 0x8ee20174,
-0x24420001, 0xaee20174, 0x8ee20174, 0x800346e,
-0xa021, 0x960c000a, 0x183102b, 0x54400001,
-0x1801821, 0xa603000a, 0x8f880120, 0x27623800,
-0x25090020, 0x122102b, 0x50400001, 0x27693000,
-0x8f820128, 0x11220004, 0x0, 0x8f820124,
-0x15220007, 0x24040020, 0x8ee201a4, 0x8821,
-0x24420001, 0xaee201a4, 0x800342f, 0x8ee201a4,
-0x8ee5724c, 0x8ee60490, 0x8ee70494, 0xa504000e,
-0x24040004, 0xad100008, 0xad040018, 0x52940,
-0xa01821, 0x1021, 0xe33821, 0xe3202b,
-0xc23021, 0xc43021, 0xad060000, 0xad070004,
-0x8ee2724c, 0xad02001c, 0x8ee204c4, 0xad020010,
-0xaf890120, 0x92e24e20, 0x14400033, 0x24110001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c820000, 0x1456001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x0, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee34e30,
-0x24420001, 0x10550007, 0x0, 0x8ee24e34,
-0x24420001, 0x10620005, 0x0, 0x800341c,
-0x0, 0x14600005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400010, 0xac800000, 0x800342f,
-0x0, 0x8ee24e30, 0x24420001, 0x50550003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0xac960000, 0xac9e0004, 0x1620001d, 0x0,
-0xa60c000a, 0x8f820100, 0xafa20010, 0x8f820104,
-0x3c040001, 0x2484589c, 0x3c050006, 0xafa20014,
-0x8ee6724c, 0x34a5f00d, 0xc002403, 0x2003821,
-0x93a20037, 0x10400031, 0x340f8100, 0x8e420004,
-0x8e430008, 0x8e44000c, 0xa64f000c, 0xae420000,
-0xae430004, 0xae440008, 0x96020016, 0xa642000e,
-0x9602000e, 0x3042fdff, 0x8003470, 0xa602000e,
-0x8ee201d8, 0x2442ffff, 0xaee201d8, 0x8ee201d8,
-0x8ee201cc, 0x3c04001f, 0x3c010001, 0x370821,
-0xa03e83c0, 0x2442ffff, 0xaee201cc, 0x9603000a,
-0x3484ffff, 0x8ee201cc, 0x6a1821, 0x2639821,
-0x93202b, 0x10800003, 0x3c02fff5, 0x34421000,
-0x2629821, 0xadab0000, 0x8ee2724c, 0x24420001,
-0x304207ff, 0xaee2724c, 0x8f420240, 0x10400004,
-0x283a023, 0x8ee20e1c, 0x24420001, 0xaee20e1c,
-0xa3a00027, 0x1680fd29, 0x0, 0x12800024,
-0x0, 0x3c010001, 0x370821, 0xac3483c4,
-0x3c010001, 0x370821, 0xac3383c8, 0x3c010001,
-0x370821, 0xac3283cc, 0x93a20037, 0x10400008,
-0x0, 0x3c020001, 0x571021, 0x8c4283cc,
-0x24420004, 0x3c010001, 0x370821, 0xac2283cc,
-0x8ee2724c, 0x8f430280, 0x24420001, 0x304207ff,
-0x14620006, 0x0, 0x8ee201c4, 0x24420001,
-0xaee201c4, 0x80034cc, 0x8ee201c4, 0x8ee201bc,
-0x24420001, 0xaee201bc, 0x80034cc, 0x8ee201bc,
-0x97a4001e, 0x2484fffc, 0x801821, 0x8ee400c0,
-0x8ee500c4, 0x1021, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0xaee400c0, 0xaee500c4,
-0x8faf002c, 0x24020002, 0x11e2000f, 0x29e20003,
-0x14400017, 0x24020003, 0x15e20015, 0x0,
-0x8ee200d0, 0x8ee300d4, 0x24630001, 0x2c640001,
-0x441021, 0xaee200d0, 0xaee300d4, 0x8ee200d0,
-0x80034c6, 0x8ee300d4, 0x8ee200d8, 0x8ee300dc,
-0x24630001, 0x2c640001, 0x441021, 0xaee200d8,
-0xaee300dc, 0x8ee200d8, 0x80034c6, 0x8ee300dc,
-0x8ee200c8, 0x8ee300cc, 0x24630001, 0x2c640001,
-0x441021, 0xaee200c8, 0xaee300cc, 0x8ee200c8,
-0x8ee300cc, 0x8f8300e4, 0x8f8200e0, 0x10620003,
-0x24630008, 0xaf8300e4, 0xaf8300e8, 0x8fbf0070,
-0x8fbe006c, 0x8fb60068, 0x8fb50064, 0x8fb40060,
-0x8fb3005c, 0x8fb20058, 0x8fb10054, 0x8fb00050,
-0x3e00008, 0x27bd0078, 0x27bdffb0, 0xafb50044,
-0xa821, 0xafb00030, 0x8021, 0xafbf004c,
-0xafb60048, 0xafb40040, 0xafb3003c, 0xafb20038,
-0xafb10034, 0x8ee204d4, 0x24140001, 0x30420001,
-0x1440002a, 0xb021, 0x8f8700e0, 0x8f8800c4,
-0x8f8200e8, 0xe22023, 0x2c821000, 0x50400001,
-0x24841000, 0x420c2, 0x801821, 0x8ee400c8,
-0x8ee500cc, 0x1021, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0xaee400c8, 0xaee500cc,
-0x8f8300c8, 0x3c02000a, 0x3442efff, 0x1032023,
-0x44102b, 0x10400003, 0x3c02000a, 0x3442f000,
-0x822021, 0x801821, 0x8ee400c0, 0x8ee500c4,
-0x1021, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xaee400c0, 0xaee500c4, 0xaf8800c8,
-0xaf8700e4, 0x8003850, 0xaf8700e8, 0x3c020001,
-0x571021, 0x904283c0, 0x1040000b, 0x0,
-0x3c130001, 0x2779821, 0x8e7383c4, 0x3c110001,
-0x2378821, 0x8e3183c8, 0x3c120001, 0x2579021,
-0x80036e8, 0x8e5283cc, 0x8f8300e0, 0x8f8200e4,
-0x10430007, 0x4821, 0x8f8200e4, 0x24090001,
-0x8c430000, 0x8c440004, 0xafa30018, 0xafa4001c,
-0x1520000e, 0x3c02ffff, 0x8f8200c4, 0xafa20010,
-0x8f8200c8, 0x3c040001, 0x24845870, 0xafa20014,
-0x8f8600e0, 0x8f8700e4, 0x3c050006, 0xc002403,
-0x34a5f000, 0x8003850, 0x0, 0x8fa3001c,
-0x8fb20018, 0x3073ffff, 0x2673fffc, 0x621024,
-0x10400058, 0x2408821, 0x3c020080, 0x621024,
-0x1040000a, 0x3c040040, 0x8ee2007c, 0x24420001,
-0xaee2007c, 0x8ee2007c, 0x8ee201fc, 0x24420001,
-0xaee201fc, 0x800384a, 0x8ee201fc, 0x3c060004,
-0x3c0b0001, 0x3c0a0002, 0x3c050010, 0x3c090008,
-0x8ee20080, 0x3c080020, 0x34078000, 0x24420001,
-0xaee20080, 0x8ee20080, 0x8fa2001c, 0x441824,
-0x10660021, 0xc3102b, 0x14400007, 0x0,
-0x106b0011, 0x0, 0x106a0015, 0x0,
-0x8003592, 0x42042, 0x10650023, 0xa3102b,
-0x14400005, 0x0, 0x10690019, 0x0,
-0x8003592, 0x42042, 0x10680021, 0x0,
-0x8003592, 0x42042, 0x8ee20034, 0x24420001,
-0xaee20034, 0x8ee20034, 0x8003592, 0x42042,
-0x8ee201ec, 0x24420001, 0xaee201ec, 0x8ee201ec,
-0x8003592, 0x42042, 0x8ee201f0, 0x24420001,
-0xaee201f0, 0x8ee201f0, 0x8003592, 0x42042,
-0x8ee201f4, 0x24420001, 0xaee201f4, 0x8ee201f4,
-0x8003592, 0x42042, 0x8ee20030, 0x24420001,
-0xaee20030, 0x8ee20030, 0x8003592, 0x42042,
-0x8ee201f8, 0x24420001, 0xaee201f8, 0x8ee201f8,
-0x42042, 0x108702b7, 0x0, 0x8003557,
-0x0, 0x3c020001, 0x571021, 0x904283b2,
-0x14400084, 0x24020001, 0x3c030001, 0x771821,
-0x906383b3, 0x1462007f, 0x3c020100, 0x8e430000,
-0x621024, 0x1040006f, 0x2402ffff, 0x14620005,
-0x24100001, 0x96430004, 0x3402ffff, 0x10620075,
-0x0, 0x92e204d8, 0x14400072, 0x0,
-0x3c020001, 0x571021, 0x8c4283b4, 0x28420005,
-0x10400020, 0x3821, 0x3c020001, 0x571021,
-0x8c4283b4, 0x18400016, 0x2821, 0x96260000,
-0x520c0, 0x971021, 0x9442777e, 0x14460009,
-0x971021, 0x94437780, 0x96220002, 0x14620005,
-0x971021, 0x94437782, 0x96220004, 0x50620008,
-0x24070001, 0x3c020001, 0x571021, 0x8c4283b4,
-0x24a50001, 0xa2102a, 0x5440ffee, 0x520c0,
-0x30e200ff, 0x1040027b, 0x0, 0x800361e,
-0x0, 0x2402021, 0xc0022fe, 0x24050006,
-0x3044001f, 0x428c0, 0x2e51021, 0x9442727c,
-0x30424000, 0x1440026f, 0xb71021, 0x9443727e,
-0x96220000, 0x1462000b, 0x418c0, 0xb71021,
-0x94437280, 0x96220002, 0x14620006, 0x418c0,
-0xb71021, 0x94437282, 0x96220004, 0x10620035,
-0x418c0, 0x2e31021, 0x9442727c, 0x30428000,
-0x1440025c, 0x2e31021, 0x9448727c, 0x96270000,
-0x828c0, 0xb71021, 0x9442737e, 0x8003600,
-0x3021, 0x420c0, 0x2e41021, 0x9443737c,
-0x2e41021, 0x9448737c, 0x30638000, 0x14600010,
-0x828c0, 0xb71021, 0x9442737e, 0x1447fff5,
-0x1002021, 0xb71021, 0x94437380, 0x96220002,
-0x5462fff1, 0x420c0, 0xb71021, 0x94437382,
-0x96220004, 0x5462ffec, 0x420c0, 0x24060001,
-0x30c200ff, 0x1040023b, 0x0, 0x800361e,
-0x0, 0x97430202, 0x96420000, 0x14620235,
-0x0, 0x97430204, 0x96420002, 0x14620231,
-0x0, 0x97430206, 0x96420004, 0x1462022d,
-0x0, 0x92420000, 0x3a030001, 0x30420001,
-0x431024, 0x10400074, 0x2402ffff, 0x8e230000,
-0x14620004, 0x3402ffff, 0x96230004, 0x1062006f,
-0x24140002, 0x3c020001, 0x571021, 0x904283b2,
-0x1440006a, 0x24140003, 0x92e204d8, 0x14400067,
-0x0, 0x3c020001, 0x571021, 0x8c4283b4,
-0x28420005, 0x10400020, 0x3821, 0x3c020001,
-0x571021, 0x8c4283b4, 0x18400016, 0x2821,
-0x96260000, 0x520c0, 0x971021, 0x9442777e,
-0x14460009, 0x971021, 0x94437780, 0x96220002,
-0x14620005, 0x971021, 0x94437782, 0x96220004,
-0x50620008, 0x24070001, 0x3c020001, 0x571021,
-0x8c4283b4, 0x24a50001, 0xa2102a, 0x5440ffee,
-0x520c0, 0x30e200ff, 0x14400044, 0x24140003,
-0x800384a, 0x0, 0x2402021, 0xc0022fe,
-0x24050006, 0x3044001f, 0x428c0, 0x2e51021,
-0x9442727c, 0x30424000, 0x144001ea, 0xb71021,
-0x9443727e, 0x96220000, 0x1462000b, 0x418c0,
-0xb71021, 0x94437280, 0x96220002, 0x14620006,
-0x418c0, 0xb71021, 0x94437282, 0x96220004,
-0x10620027, 0x418c0, 0x2e31021, 0x9442727c,
-0x30428000, 0x144001d7, 0x2e31021, 0x9448727c,
-0x96270000, 0x828c0, 0xb71021, 0x9442737e,
-0x8003685, 0x3021, 0x420c0, 0x2e41021,
-0x9443737c, 0x2e41021, 0x9448737c, 0x30638000,
-0x14600010, 0x828c0, 0xb71021, 0x9442737e,
-0x1447fff5, 0x1002021, 0xb71021, 0x94437380,
-0x96220002, 0x5462fff1, 0x420c0, 0xb71021,
-0x94437382, 0x96220004, 0x5462ffec, 0x420c0,
-0x24060001, 0x30c200ff, 0x104001b6, 0x0,
-0x8003698, 0x24140003, 0x24140001, 0x8f420260,
-0x53102b, 0x10400049, 0x0, 0x8f8300e4,
-0x8f8200e0, 0x10620003, 0x24630008, 0xaf8300e4,
-0xaf8300e8, 0x8ee400c0, 0x8ee500c4, 0x2601821,
-0x1021, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xaee400c0, 0xaee500c4, 0x8ee20058,
-0x24420001, 0xaee20058, 0x8ee20058, 0x8ee2007c,
-0x24420001, 0xaee2007c, 0x8ee2007c, 0x8f8200e0,
-0xafa20010, 0x8f8200e4, 0x3c040001, 0x24845878,
-0xafa20014, 0x8fa60018, 0x8fa7001c, 0x3c050006,
-0xc002403, 0x34a5f003, 0x8003850, 0x0,
-0x8ee25240, 0xafa20010, 0x8ee25244, 0x3c040001,
-0x24845884, 0xafa20014, 0x8ee60e10, 0x8ee70e18,
-0xc002403, 0x34a5f002, 0x8ee201c0, 0x24420001,
-0xaee201c0, 0x8ee20000, 0x8ee301c0, 0x2403ffbf,
-0x431024, 0x80037f8, 0xaee20000, 0x8ee25240,
-0xafa20010, 0x8ee25244, 0x3c040001, 0x24845884,
-0xafa20014, 0x8ee60e10, 0x8ee70e18, 0x3c050006,
-0xc002403, 0x34a5f002, 0x8ee201c0, 0x24420001,
-0xaee201c0, 0x80037f8, 0x8ee201c0, 0x96e20468,
-0x53102b, 0x54400001, 0x3c158000, 0x12600131,
-0x3c0c001f, 0x358cffff, 0x8ee2724c, 0x8f430280,
-0x24420001, 0x304207ff, 0x10620108, 0x0,
-0x12a00014, 0x0, 0x8ee35240, 0x8ee25244,
-0x10620009, 0x26ee5244, 0x8eeb5244, 0x8ee35244,
-0x21140, 0x24425248, 0x2e28021, 0x24630001,
-0x8003712, 0x306800ff, 0x92e27248, 0x1440ffc0,
-0x3c050006, 0x8ee201e0, 0x24420001, 0xaee201e0,
-0x8ee201e0, 0x8ee30e10, 0x8ee20e18, 0x1062ffcb,
-0x26ee0e18, 0x8eeb0e18, 0xa821, 0x8ee30e18,
-0x21140, 0x24420e20, 0x2e28021, 0x24630001,
-0x306801ff, 0x96e2046a, 0x30420010, 0x10400017,
-0x34028100, 0x9643000c, 0x14620014, 0x0,
-0x3c020001, 0x571021, 0x904283c0, 0x1440000f,
-0x0, 0x9642000e, 0xa6020016, 0x8e420008,
-0x8e430004, 0x8e440000, 0x2673fffc, 0xae42000c,
-0xae430008, 0xae440004, 0x9602000e, 0x26310004,
-0x24160001, 0x34420200, 0xa602000e, 0x9603000a,
-0x2605021, 0x73102b, 0x10400002, 0x2606821,
-0x605021, 0x2d42003d, 0x1040002a, 0x3821,
-0x9623000c, 0x24020800, 0x54620027, 0xae110018,
-0x3c020001, 0x571021, 0x904283c0, 0x54400022,
-0xae110018, 0x26220017, 0x182102b, 0x10400013,
-0x0, 0x3c02fff5, 0x511021, 0x90421017,
-0x38430006, 0x2c630001, 0x38420011, 0x2c420001,
-0x621825, 0x10600013, 0x26220010, 0x182102b,
-0x1040000e, 0x0, 0x3c07fff5, 0xf13821,
-0x94e71010, 0x800375e, 0x24e7000e, 0x92220017,
-0x38430006, 0x2c630001, 0x38420011, 0x2c420001,
-0x621825, 0x50600004, 0xae110018, 0x96270010,
-0x24e7000e, 0xae110018, 0x3c020001, 0x571021,
-0x904283c0, 0x2102b, 0x14e00002, 0x24ec0,
-0x1403821, 0x8f830120, 0x27623800, 0x24660020,
-0xc2102b, 0x50400001, 0x27663000, 0x8f820128,
-0x10c20004, 0x0, 0x8f820124, 0x14c20007,
-0x2402000b, 0x8ee201a4, 0x4821, 0x24420001,
-0xaee201a4, 0x80037bf, 0x8ee201a4, 0x8e040000,
-0x8e050004, 0xac620018, 0x1751025, 0x491025,
-0xac710008, 0xa467000e, 0xac62001c, 0xac640000,
-0xac650004, 0x8ee204c0, 0xac620010, 0xaf860120,
-0x92e24e20, 0x14400038, 0x24090001, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x8c830000,
-0x24020007, 0x14620020, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001c, 0x0, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee34e34, 0x8ee54e30,
-0x24020040, 0x24630001, 0x10620007, 0x0,
-0x8ee24e34, 0x24420001, 0x10a20005, 0x0,
-0x80037a9, 0x0, 0x14a00005, 0x0,
-0x8f820128, 0x24420020, 0xaf820128, 0x8f820128,
-0x8c820004, 0x2c420011, 0x50400013, 0xac800000,
-0x80037bf, 0x0, 0x8ee24e30, 0x24030040,
-0x24420001, 0x50430003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x24020007, 0xac820000,
-0x24020001, 0xac820004, 0x15200018, 0x3c050006,
-0x8e020018, 0x3c040001, 0x24845890, 0xafa20010,
-0x8e020000, 0x8e030004, 0x34a5f009, 0x2003021,
-0xc002403, 0xafa30014, 0x32c200ff, 0x1040002b,
-0x34028100, 0x8e430004, 0x8e440008, 0x8e45000c,
-0xa642000c, 0xae430000, 0xae440004, 0xae450008,
-0x96020016, 0x80037f8, 0xa642000e, 0x154d000a,
-0x0, 0x9602000e, 0xa613000a, 0x34420004,
-0xa602000e, 0x3c010001, 0x370821, 0xa02083c0,
-0x80037f6, 0x9821, 0x9604000a, 0x93102b,
-0x10400002, 0x2601821, 0x801821, 0x24020001,
-0xa603000a, 0x3c010001, 0x370821, 0xa02283c0,
-0x9604000a, 0x2248821, 0x191102b, 0x10400003,
-0x3c02fff5, 0x34421000, 0x2228821, 0x2649823,
-0xa821, 0x1660fef4, 0xadc80000, 0x12600021,
-0x32c200ff, 0x3c010001, 0x370821, 0xac3383c4,
-0x3c010001, 0x370821, 0xac3183c8, 0x3c010001,
-0x370821, 0x10400008, 0xac3283cc, 0x3c020001,
-0x571021, 0x8c4283cc, 0x24420004, 0x3c010001,
-0x370821, 0xac2283cc, 0x8ee2724c, 0x8f430280,
-0x24420001, 0x14620006, 0x0, 0x8ee201c4,
-0x24420001, 0xaee201c4, 0x8003850, 0x8ee201c4,
-0x8ee201bc, 0x24420001, 0xaee201bc, 0x8003850,
-0x8ee201bc, 0x97a4001e, 0x2484fffc, 0x801821,
-0x8ee400c0, 0x8ee500c4, 0x1021, 0xa32821,
-0xa3302b, 0x822021, 0x862021, 0x24020002,
-0xaee400c0, 0xaee500c4, 0x1282000f, 0x2a820003,
-0x14400017, 0x24020003, 0x16820015, 0x0,
-0x8ee200d0, 0x8ee300d4, 0x24630001, 0x2c640001,
-0x441021, 0xaee200d0, 0xaee300d4, 0x8ee200d0,
-0x800384a, 0x8ee300d4, 0x8ee200d8, 0x8ee300dc,
-0x24630001, 0x2c640001, 0x441021, 0xaee200d8,
-0xaee300dc, 0x8ee200d8, 0x800384a, 0x8ee300dc,
-0x8ee200c8, 0x8ee300cc, 0x24630001, 0x2c640001,
-0x441021, 0xaee200c8, 0xaee300cc, 0x8ee200c8,
-0x8ee300cc, 0x8f8300e4, 0x8f8200e0, 0x10620003,
-0x24630008, 0xaf8300e4, 0xaf8300e8, 0x8fbf004c,
-0x8fb60048, 0x8fb50044, 0x8fb40040, 0x8fb3003c,
-0x8fb20038, 0x8fb10034, 0x8fb00030, 0x3e00008,
-0x27bd0050, 0x27bdff90, 0xafb60060, 0xb021,
-0xafbf0068, 0xafbe0064, 0xafb5005c, 0xafb40058,
-0xafb30054, 0xafb20050, 0xafb1004c, 0xafb00048,
-0x8ee204d4, 0x8821, 0x24150001, 0x30420001,
-0x1440002a, 0xa3a0002f, 0x8f8700e0, 0x8f8800c4,
-0x8f8200e8, 0xe22023, 0x2c821000, 0x50400001,
-0x24841000, 0x420c2, 0x801821, 0x8ee400c8,
-0x8ee500cc, 0x1021, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0xaee400c8, 0xaee500cc,
-0x8f8300c8, 0x3c02000a, 0x3442efff, 0x1032023,
-0x44102b, 0x10400003, 0x3c02000a, 0x3442f000,
-0x822021, 0x801821, 0x8ee400c0, 0x8ee500c4,
-0x1021, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xaee400c0, 0xaee500c4, 0xaf8800c8,
-0xaf8700e4, 0x8003c5b, 0xaf8700e8, 0x3c020001,
-0x571021, 0x904283c0, 0x1040000b, 0x0,
-0x3c130001, 0x2779821, 0x8e7383c4, 0x3c100001,
-0x2178021, 0x8e1083c8, 0x3c120001, 0x2579021,
-0x8003a59, 0x8e5283cc, 0x8f8300e0, 0x8f8200e4,
-0x10430007, 0x3821, 0x8f8200e4, 0x24070001,
-0x8c430000, 0x8c440004, 0xafa30018, 0xafa4001c,
-0x14e0000e, 0x3c02ffff, 0x8f8200c4, 0xafa20010,
-0x8f8200c8, 0x3c040001, 0x248458b4, 0xafa20014,
-0x8f8600e0, 0x8f8700e4, 0x3c050006, 0xc002403,
-0x34a5f200, 0x8003c5b, 0x0, 0x8fa3001c,
-0x8fb20018, 0x3073ffff, 0x2673fffc, 0x621024,
-0x10400058, 0x2408021, 0x3c020080, 0x621024,
-0x1040000a, 0x3c040040, 0x8ee2007c, 0x24420001,
-0xaee2007c, 0x8ee2007c, 0x8ee201fc, 0x24420001,
-0xaee201fc, 0x8003c55, 0x8ee201fc, 0x3c060004,
-0x3c0b0001, 0x3c0a0002, 0x3c050010, 0x3c090008,
-0x8ee20080, 0x3c080020, 0x34078000, 0x24420001,
-0xaee20080, 0x8ee20080, 0x8fa2001c, 0x441824,
-0x10660021, 0xc3102b, 0x14400007, 0x0,
-0x106b0011, 0x0, 0x106a0015, 0x0,
-0x8003916, 0x42042, 0x10650023, 0xa3102b,
-0x14400005, 0x0, 0x10690019, 0x0,
-0x8003916, 0x42042, 0x10680021, 0x0,
-0x8003916, 0x42042, 0x8ee20034, 0x24420001,
-0xaee20034, 0x8ee20034, 0x8003916, 0x42042,
-0x8ee201ec, 0x24420001, 0xaee201ec, 0x8ee201ec,
-0x8003916, 0x42042, 0x8ee201f0, 0x24420001,
-0xaee201f0, 0x8ee201f0, 0x8003916, 0x42042,
-0x8ee201f4, 0x24420001, 0xaee201f4, 0x8ee201f4,
-0x8003916, 0x42042, 0x8ee20030, 0x24420001,
-0xaee20030, 0x8ee20030, 0x8003916, 0x42042,
-0x8ee201f8, 0x24420001, 0xaee201f8, 0x8ee201f8,
-0x42042, 0x1087033e, 0x0, 0x80038db,
-0x0, 0x3c020001, 0x571021, 0x904283b2,
-0x14400084, 0x24020001, 0x3c030001, 0x771821,
-0x906383b3, 0x1462007f, 0x3c020100, 0x8e430000,
-0x621024, 0x1040006f, 0x2402ffff, 0x14620005,
-0x24110001, 0x96430004, 0x3402ffff, 0x10620075,
-0x0, 0x92e204d8, 0x14400072, 0x0,
-0x3c020001, 0x571021, 0x8c4283b4, 0x28420005,
-0x10400020, 0x3821, 0x3c020001, 0x571021,
-0x8c4283b4, 0x18400016, 0x2821, 0x96060000,
-0x520c0, 0x971021, 0x9442777e, 0x14460009,
-0x971021, 0x94437780, 0x96020002, 0x14620005,
-0x971021, 0x94437782, 0x96020004, 0x50620008,
-0x24070001, 0x3c020001, 0x571021, 0x8c4283b4,
-0x24a50001, 0xa2102a, 0x5440ffee, 0x520c0,
-0x30e200ff, 0x10400302, 0x0, 0x80039a2,
-0x0, 0x2402021, 0xc0022fe, 0x24050006,
-0x3044001f, 0x428c0, 0x2e51021, 0x9442727c,
-0x30424000, 0x144002f6, 0xb71021, 0x9443727e,
-0x96020000, 0x1462000b, 0x418c0, 0xb71021,
-0x94437280, 0x96020002, 0x14620006, 0x418c0,
-0xb71021, 0x94437282, 0x96020004, 0x10620035,
-0x418c0, 0x2e31021, 0x9442727c, 0x30428000,
-0x144002e3, 0x2e31021, 0x944d727c, 0x96070000,
-0xd28c0, 0xb71021, 0x9442737e, 0x8003984,
-0x3021, 0x420c0, 0x2e41021, 0x9443737c,
-0x2e41021, 0x944d737c, 0x30638000, 0x14600010,
-0xd28c0, 0xb71021, 0x9442737e, 0x1447fff5,
-0x1a02021, 0xb71021, 0x94437380, 0x96020002,
-0x5462fff1, 0x420c0, 0xb71021, 0x94437382,
-0x96020004, 0x5462ffec, 0x420c0, 0x24060001,
-0x30c200ff, 0x104002c2, 0x0, 0x80039a2,
-0x0, 0x97430202, 0x96420000, 0x146202bc,
-0x0, 0x97430204, 0x96420002, 0x146202b8,
-0x0, 0x97430206, 0x96420004, 0x146202b4,
-0x0, 0x92420000, 0x3a230001, 0x30420001,
-0x431024, 0x10400074, 0x2402ffff, 0x8e030000,
-0x14620004, 0x3402ffff, 0x96030004, 0x1062006f,
-0x24150002, 0x3c020001, 0x571021, 0x904283b2,
-0x1440006a, 0x24150003, 0x92e204d8, 0x14400067,
-0x0, 0x3c020001, 0x571021, 0x8c4283b4,
-0x28420005, 0x10400020, 0x3821, 0x3c020001,
-0x571021, 0x8c4283b4, 0x18400016, 0x2821,
-0x96060000, 0x520c0, 0x971021, 0x9442777e,
-0x14460009, 0x971021, 0x94437780, 0x96020002,
-0x14620005, 0x971021, 0x94437782, 0x96020004,
-0x50620008, 0x24070001, 0x3c020001, 0x571021,
-0x8c4283b4, 0x24a50001, 0xa2102a, 0x5440ffee,
-0x520c0, 0x30e200ff, 0x14400044, 0x24150003,
-0x8003c55, 0x0, 0x2402021, 0xc0022fe,
-0x24050006, 0x3044001f, 0x428c0, 0x2e51021,
-0x9442727c, 0x30424000, 0x14400271, 0xb71021,
-0x9443727e, 0x96020000, 0x1462000b, 0x418c0,
-0xb71021, 0x94437280, 0x96020002, 0x14620006,
-0x418c0, 0xb71021, 0x94437282, 0x96020004,
-0x10620027, 0x418c0, 0x2e31021, 0x9442727c,
-0x30428000, 0x1440025e, 0x2e31021, 0x944d727c,
-0x96070000, 0xd28c0, 0xb71021, 0x9442737e,
-0x8003a09, 0x3021, 0x420c0, 0x2e41021,
-0x9443737c, 0x2e41021, 0x944d737c, 0x30638000,
-0x14600010, 0xd28c0, 0xb71021, 0x9442737e,
-0x1447fff5, 0x1a02021, 0xb71021, 0x94437380,
-0x96020002, 0x5462fff1, 0x420c0, 0xb71021,
-0x94437382, 0x96020004, 0x5462ffec, 0x420c0,
-0x24060001, 0x30c200ff, 0x1040023d, 0x0,
-0x8003a1c, 0x24150003, 0x24150001, 0x8f420260,
-0x53102b, 0x10400036, 0x0, 0x8f8300e4,
-0x8f8200e0, 0x10620003, 0x24630008, 0xaf8300e4,
-0xaf8300e8, 0x8ee400c0, 0x8ee500c4, 0x2601821,
-0x1021, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xaee400c0, 0xaee500c4, 0x8ee20058,
-0x24420001, 0xaee20058, 0x8ee20058, 0x8ee2007c,
-0x24420001, 0xaee2007c, 0x8ee2007c, 0x8f8200e0,
-0xafa20010, 0x8f8200e4, 0x3c040001, 0x248458c0,
-0xafa20014, 0x8fa60018, 0x8fa7001c, 0x3c050006,
-0xc002403, 0x34a5f203, 0x8003c5b, 0x0,
-0x8ee25240, 0xafa20010, 0x8ee25244, 0x3c040001,
-0x248458cc, 0xafa20014, 0x8ee60e10, 0x8ee70e18,
-0x3c050006, 0xc002403, 0x34a5f202, 0x8ee201c0,
-0x24420001, 0xaee201c0, 0x8003c02, 0x8ee201c0,
-0x96e20468, 0x53102b, 0x54400001, 0x3c168000,
-0x126001cb, 0x3c0e001f, 0x35ceffff, 0x3c0ffff5,
-0x35ef1000, 0x241e0040, 0x8ee2724c, 0x8f430280,
-0x24420001, 0x304207ff, 0x1062019e, 0x0,
-0x12c00012, 0x0, 0x8ee35240, 0x8ee25244,
-0x1062000a, 0x26f85244, 0x8ef45244, 0xafb80024,
-0x8ee35244, 0x21140, 0x24425248, 0x2e28821,
-0x24630001, 0x8003a85, 0x306d00ff, 0x8ee201e0,
-0x24420001, 0xaee201e0, 0x8ee201e0, 0x8ee30e10,
-0x8ee20e18, 0x1062ffca, 0x26f80e18, 0x8ef40e18,
-0xb021, 0xafb80024, 0x8ee30e18, 0x21140,
-0x24420e20, 0x2e28821, 0x24630001, 0x306d01ff,
-0x96e2046a, 0x30420010, 0x10400018, 0x34028100,
-0x9643000c, 0x14620015, 0x0, 0x3c020001,
-0x571021, 0x904283c0, 0x14400010, 0x0,
-0x9642000e, 0xa6220016, 0x8e420008, 0x8e430004,
-0x8e440000, 0x2673fffc, 0xae42000c, 0xae430008,
-0xae440004, 0x9622000e, 0x26100004, 0x24180001,
-0xa3b8002f, 0x34420200, 0xa622000e, 0x8e220000,
-0x8e230004, 0x3c040001, 0x34843800, 0x2003021,
-0x306a0007, 0x20a8023, 0x3641021, 0x202102b,
-0x10400005, 0x26a9821, 0x2041023, 0x3621823,
-0x3c020020, 0x438023, 0x26620007, 0x9623000a,
-0x2418fff8, 0x58c824, 0x6a1821, 0x79102b,
-0x10400002, 0x3206021, 0x606021, 0x1801821,
-0x24620007, 0x2418fff8, 0x586024, 0x26c102b,
-0x14400004, 0x1932823, 0x1832823, 0x8003ac3,
-0xc31021, 0xd31021, 0x4a2023, 0x1c4102b,
-0x54400001, 0x8f2021, 0x25420040, 0x4c102b,
-0x14400035, 0x5821, 0x94c3000c, 0x24020800,
-0x54620032, 0xae260018, 0x3c020001, 0x571021,
-0x904283c0, 0x5440002d, 0xae260018, 0x24c20017,
-0x1c2102b, 0x10400013, 0x0, 0x3c02fff5,
-0x461021, 0x90421017, 0x38430006, 0x2c630001,
-0x38420011, 0x2c420001, 0x621825, 0x10600014,
-0x24c20010, 0x1c2102b, 0x1040000e, 0x0,
-0x3c0bfff5, 0x1665821, 0x956b1010, 0x8003af4,
-0x2562000e, 0x90c20017, 0x38430006, 0x2c630001,
-0x38420011, 0x2c420001, 0x621825, 0x10600005,
-0x1601821, 0x94cb0010, 0x2562000e, 0x4a5821,
-0x1601821, 0x24620007, 0x2418fff8, 0x585824,
-0xc31021, 0x4a2023, 0x1c4102b, 0x10400002,
-0x1632823, 0x8f2021, 0xae260018, 0x3c020001,
-0x571021, 0x904283c0, 0x2102b, 0x216c0,
-0x15600002, 0xafa20044, 0x1805821, 0x30820001,
-0x10400007, 0x4021, 0x90880000, 0x24840001,
-0x1c4102b, 0x10400002, 0x24a5ffff, 0x8f2021,
-0x50a00012, 0x81c02, 0x2ca20002, 0x54400009,
-0x24a5ffff, 0x94820000, 0x24840002, 0x1024021,
-0x1c4102b, 0x10400006, 0x24a5fffe, 0x8003b21,
-0x8f2021, 0x90820000, 0x21200, 0x1024021,
-0x14a0fff2, 0x2ca20002, 0x81c02, 0x3102ffff,
-0x624021, 0x3108ffff, 0x1402821, 0x11400011,
-0x2002021, 0x2ca20002, 0x54400009, 0x24a5ffff,
-0x94820000, 0x24840002, 0x1024021, 0x1c4102b,
-0x10400006, 0x24a5fffe, 0x8003b38, 0x8f2021,
-0x90820000, 0x21200, 0x1024021, 0x14a0fff2,
-0x2ca20002, 0x81c02, 0x3102ffff, 0x624021,
-0x81c02, 0x3102ffff, 0x8f890120, 0x624021,
-0x27623800, 0x25230020, 0x62102b, 0x14400002,
-0x3108ffff, 0x27633000, 0x8f820128, 0x10620004,
-0x0, 0x8f820124, 0x14620007, 0x1402821,
-0x8ee201a4, 0x3821, 0x24420001, 0xaee201a4,
-0x8003bc9, 0x8ee201a4, 0x8e260000, 0x8e270004,
-0x81400, 0x3448000b, 0xad300008, 0xa52b000e,
-0xad280018, 0x8fb80044, 0x2021, 0x2961025,
-0x581025, 0xad22001c, 0xe5102b, 0xe53823,
-0xc43023, 0xc23023, 0xad260000, 0xad270004,
-0x8ee204c0, 0xad220010, 0xaf830120, 0x92e24e20,
-0x1440005f, 0x24070001, 0x2502ffee, 0x2c420002,
-0x14400003, 0x24020011, 0x15020024, 0x0,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c830000, 0x24020012, 0x1462000f, 0x0,
-0x8ee34e30, 0x8ee24e34, 0x1062000b, 0x0,
-0x8c820004, 0x24420001, 0xac820004, 0x8ee24e34,
-0x8ee34e30, 0x24420001, 0x105e002a, 0x0,
-0x8003ba8, 0x0, 0x8ee24e30, 0x24420001,
-0x505e0003, 0x1021, 0x8ee24e30, 0x24420001,
-0xaee24e30, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8003bc6, 0x24020012, 0x8ee24e30,
-0x210c0, 0x24425038, 0x2e22021, 0x8c830000,
-0x24020007, 0x1462001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x0, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee34e30,
-0x24420001, 0x105e0007, 0x0, 0x8ee24e34,
-0x24420001, 0x10620005, 0x0, 0x8003bb4,
-0x0, 0x14600005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400012, 0xac800000, 0x8003bc9,
-0x0, 0x8ee24e30, 0x24420001, 0x505e0003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x24020007, 0xac820000, 0x24020001, 0xac820004,
-0x14e00019, 0x3c050006, 0x3c040001, 0x24845890,
-0x8e220018, 0x34a5f209, 0xafa20010, 0x8e220000,
-0x8e230004, 0x2203021, 0x1603821, 0xc002403,
-0xafa30014, 0x93a2002f, 0x1040002a, 0x34028100,
-0x8e430004, 0x8e440008, 0x8e45000c, 0xa642000c,
-0xae430000, 0xae440004, 0xae450008, 0x96220016,
-0x8003c02, 0xa642000e, 0x1599000a, 0x26a1823,
-0x9622000e, 0xa623000a, 0x34420004, 0xa622000e,
-0x3c010001, 0x370821, 0xa02083c0, 0x8003bff,
-0x9821, 0x9624000a, 0x83102b, 0x54400001,
-0x801821, 0x24020001, 0xa623000a, 0x3c010001,
-0x370821, 0xa02283c0, 0x9622000a, 0x4a1821,
-0x2038021, 0x1d0102b, 0x54400001, 0x20f8021,
-0x2639823, 0xb021, 0x8fb80024, 0x1660fe5e,
-0xaf0d0000, 0x12600022, 0x0, 0x3c010001,
-0x370821, 0xac3383c4, 0x3c010001, 0x370821,
-0xac3083c8, 0x3c010001, 0x370821, 0xac3283cc,
-0x93a2002f, 0x10400008, 0x0, 0x3c020001,
-0x571021, 0x8c4283cc, 0x24420004, 0x3c010001,
-0x370821, 0xac2283cc, 0x8f430280, 0x8ee2724c,
-0x14620006, 0x0, 0x8ee201c4, 0x24420001,
-0xaee201c4, 0x8003c5b, 0x8ee201c4, 0x8ee201bc,
-0x24420001, 0xaee201bc, 0x8003c5b, 0x8ee201bc,
-0x97a4001e, 0x2484fffc, 0x801821, 0x8ee400c0,
-0x8ee500c4, 0x1021, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0x24020002, 0xaee400c0,
-0xaee500c4, 0x12a2000f, 0x2aa20003, 0x14400017,
-0x24020003, 0x16a20015, 0x0, 0x8ee200d0,
-0x8ee300d4, 0x24630001, 0x2c640001, 0x441021,
-0xaee200d0, 0xaee300d4, 0x8ee200d0, 0x8003c55,
-0x8ee300d4, 0x8ee200d8, 0x8ee300dc, 0x24630001,
-0x2c640001, 0x441021, 0xaee200d8, 0xaee300dc,
-0x8ee200d8, 0x8003c55, 0x8ee300dc, 0x8ee200c8,
-0x8ee300cc, 0x24630001, 0x2c640001, 0x441021,
-0xaee200c8, 0xaee300cc, 0x8ee200c8, 0x8ee300cc,
-0x8f8300e4, 0x8f8200e0, 0x10620003, 0x24630008,
-0xaf8300e4, 0xaf8300e8, 0x8fbf0068, 0x8fbe0064,
-0x8fb60060, 0x8fb5005c, 0x8fb40058, 0x8fb30054,
-0x8fb20050, 0x8fb1004c, 0x8fb00048, 0x3e00008,
-0x27bd0070, 0x27bdffe0, 0xafbf0018, 0x8ee30e14,
-0x8ee20e0c, 0x10620074, 0x0, 0x8ee30e0c,
-0x8ee20e14, 0x622023, 0x4820001, 0x24840200,
-0x8ee30e18, 0x8ee20e14, 0x43102b, 0x14400004,
-0x24020200, 0x8ee30e14, 0x8003c7d, 0x431823,
-0x8ee20e18, 0x8ee30e14, 0x431023, 0x2443ffff,
-0x804821, 0x69102a, 0x54400001, 0x604821,
-0x8f870100, 0x27623000, 0x24e80020, 0x102102b,
-0x50400001, 0x27682800, 0x8f820108, 0x11020004,
-0x0, 0x8f820104, 0x15020007, 0x1021,
-0x8ee201a8, 0x2021, 0x24420001, 0xaee201a8,
-0x8003cbf, 0x8ee201a8, 0x8ee40e14, 0x42140,
-0x801821, 0x8ee40460, 0x8ee50464, 0xa32821,
-0xa3302b, 0x822021, 0x862021, 0xace40000,
-0xace50004, 0x8ee30e14, 0x91140, 0xa4e2000e,
-0x24020002, 0xace20018, 0x31940, 0x24630e20,
-0x2e31021, 0xace20008, 0x8ee20e14, 0xace2001c,
-0x8ee204cc, 0xace20010, 0xaf880100, 0x92e204ec,
-0x14400011, 0x24040001, 0x8ee24e28, 0x24030040,
-0x24420001, 0x50430003, 0x1021, 0x8ee24e28,
-0x24420001, 0xaee24e28, 0x8ee24e28, 0x210c0,
-0x24424e38, 0x2e21821, 0x24020002, 0xac620000,
-0x24020001, 0xac620004, 0x1480000e, 0x24030040,
-0x8ee20e14, 0xafa20010, 0x8ee20e18, 0x3c050007,
-0xafa20014, 0x8ee60e0c, 0x8ee70e10, 0x3c040001,
-0x248458d4, 0xc002403, 0x34a5f001, 0x8003cdd,
-0x0, 0x8ee20500, 0x24420001, 0x50430003,
-0x1021, 0x8ee20500, 0x24420001, 0xaee20500,
-0x8ee20500, 0x21080, 0x571021, 0xac490508,
-0x8ee20e14, 0x491021, 0x304201ff, 0xaee20e14,
-0x8ee30e14, 0x8ee20e0c, 0x14620005, 0x0,
-0x8f820060, 0x2403fdff, 0x431024, 0xaf820060,
-0x8fbf0018, 0x3e00008, 0x27bd0020, 0x27bdffe0,
-0xafbf0018, 0x8ee3523c, 0x8ee25238, 0x10620074,
-0x0, 0x8ee35238, 0x8ee2523c, 0x622023,
-0x4820001, 0x24840100, 0x8ee35244, 0x8ee2523c,
-0x43102b, 0x14400004, 0x24020100, 0x8ee3523c,
-0x8003cff, 0x431823, 0x8ee25244, 0x8ee3523c,
-0x431023, 0x2443ffff, 0x804821, 0x69102a,
-0x54400001, 0x604821, 0x8f870100, 0x27623000,
-0x24e80020, 0x102102b, 0x50400001, 0x27682800,
-0x8f820108, 0x11020004, 0x0, 0x8f820104,
-0x15020007, 0x1021, 0x8ee201a8, 0x2021,
-0x24420001, 0xaee201a8, 0x8003d41, 0x8ee201a8,
-0x8ee4523c, 0x42140, 0x801821, 0x8ee40470,
-0x8ee50474, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xace40000, 0xace50004, 0x8ee3523c,
-0x91140, 0xa4e2000e, 0x24020003, 0xace20018,
-0x31940, 0x24635248, 0x2e31021, 0xace20008,
-0x8ee2523c, 0xace2001c, 0x8ee204cc, 0xace20010,
-0xaf880100, 0x92e204ec, 0x14400011, 0x24040001,
-0x8ee24e28, 0x24030040, 0x24420001, 0x50430003,
-0x1021, 0x8ee24e28, 0x24420001, 0xaee24e28,
-0x8ee24e28, 0x210c0, 0x24424e38, 0x2e21821,
-0x24020003, 0xac620000, 0x24020001, 0xac620004,
-0x1480000e, 0x24030040, 0x8ee2523c, 0xafa20010,
-0x8ee25244, 0x3c050007, 0xafa20014, 0x8ee65238,
-0x8ee75240, 0x3c040001, 0x248458e0, 0xc002403,
-0x34a5f010, 0x8003d5f, 0x0, 0x8ee20500,
-0x24420001, 0x50430003, 0x1021, 0x8ee20500,
-0x24420001, 0xaee20500, 0x8ee20500, 0x21080,
-0x571021, 0xac490508, 0x8ee2523c, 0x491021,
-0x304200ff, 0xaee2523c, 0x8ee3523c, 0x8ee25238,
-0x14620005, 0x0, 0x8f820060, 0x2403feff,
-0x431024, 0xaf820060, 0x8fbf0018, 0x3e00008,
-0x27bd0020, 0x8f820120, 0x8ee34e34, 0x8f820124,
-0x8f860128, 0x24020040, 0x24630001, 0x50620003,
-0x1021, 0x8ee24e34, 0x24420001, 0xaee24e34,
-0x8ee24e34, 0x8ee44e34, 0x8ee34e30, 0x210c0,
-0x24425038, 0x14830007, 0x2e22821, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8003d92,
-0xaca00000, 0x8ee24e34, 0x24030040, 0x24420001,
-0x50430003, 0x1021, 0x8ee24e34, 0x24420001,
-0x210c0, 0x24425038, 0x2e22821, 0x8ca20004,
-0x8f830128, 0x21140, 0x621821, 0xaf830128,
-0xaca00000, 0x8cc20018, 0x2443fffe, 0x2c620012,
-0x10400008, 0x31080, 0x3c010001, 0x220821,
-0x8c2258f0, 0x400008, 0x0, 0x24020001,
-0xaee24e24, 0x3e00008, 0x0, 0x27bdffc8,
-0xafbf0030, 0xafb5002c, 0xafb40028, 0xafb30024,
-0xafb20020, 0xafb1001c, 0xafb00018, 0x8f830128,
-0x8f820124, 0x106202b0, 0x9821, 0x3c11001f,
-0x3631ffff, 0x3c12fff5, 0x36521000, 0x24150012,
-0x24140040, 0x8f8c0128, 0x8f820128, 0x24420020,
-0xaf820128, 0x9182001b, 0x8f830128, 0x2443fffe,
-0x2c620012, 0x1040029c, 0x31080, 0x3c010001,
-0x220821, 0x8c225948, 0x400008, 0x0,
-0x8f420218, 0x30420100, 0x10400007, 0x0,
-0x95830016, 0x95820018, 0x621823, 0x31402,
-0x431021, 0xa5820016, 0x8d82001c, 0x3c038000,
-0x3044ffff, 0x436824, 0x3c030800, 0x431824,
-0x11a00004, 0xad84001c, 0x41140, 0x8003dd8,
-0x24425248, 0x41140, 0x24420e20, 0x2e25821,
-0x9562000e, 0x3042fffc, 0x10600004, 0xa562000e,
-0x95840016, 0x8003ec0, 0x0, 0x8d690018,
-0x4021, 0x952a0000, 0x25290002, 0x95270000,
-0x25290002, 0x95260000, 0x25290002, 0x95250000,
-0x25290002, 0x95240000, 0x25290002, 0x95230000,
-0x25290002, 0x95220000, 0x25290002, 0x1475021,
-0x1465021, 0x1455021, 0x1445021, 0x1435021,
-0x1425021, 0xa1c02, 0x3142ffff, 0x625021,
-0xa1c02, 0x3142ffff, 0x625021, 0x96e2046a,
-0x314effff, 0x30420002, 0x10400044, 0x5021,
-0x25220014, 0x222102b, 0x10400014, 0x1201821,
-0x2405000a, 0x2021, 0x223102b, 0x54400001,
-0x721821, 0x94620000, 0x24630002, 0x24a5ffff,
-0x14a0fff9, 0x822021, 0x41c02, 0x3082ffff,
-0x622021, 0x41402, 0x3083ffff, 0x431021,
-0x3042ffff, 0x8003e33, 0x1425021, 0x952a0000,
-0x25290002, 0x95280000, 0x25290002, 0x95270000,
-0x25290002, 0x95260000, 0x25290002, 0x95250000,
-0x25290002, 0x95230000, 0x25290002, 0x95220000,
-0x25290002, 0x95240000, 0x25290002, 0x1485021,
-0x1475021, 0x1465021, 0x1455021, 0x1435021,
-0x1425021, 0x95220000, 0x95230002, 0x1445021,
-0x1425021, 0x1435021, 0xa1c02, 0x3142ffff,
-0x625021, 0xa1c02, 0x3142ffff, 0x625021,
-0x3148ffff, 0x51000001, 0x3408ffff, 0x8d620018,
-0x9443000c, 0x24020800, 0x54620005, 0xa5680010,
-0x9562000e, 0x34420002, 0xa562000e, 0xa5680010,
-0x96e2046a, 0x2821, 0x30420008, 0x14400056,
-0x3021, 0x8d630018, 0x24620024, 0x222102b,
-0x10400034, 0x24690010, 0x229102b, 0x54400001,
-0x1324821, 0x95250000, 0x24690014, 0x229102b,
-0x10400002, 0x24a5ffec, 0x1324821, 0x95220000,
-0x30420fff, 0x14400003, 0x25290002, 0x8003e60,
-0x24130001, 0x9821, 0xa03021, 0x229102b,
-0x54400001, 0x1324821, 0x91220001, 0x25290002,
-0xa22821, 0x229102b, 0x54400001, 0x1324821,
-0x25290002, 0x229102b, 0x54400001, 0x1324821,
-0x95220000, 0x25290002, 0xa22821, 0x229102b,
-0x54400001, 0x1324821, 0x95220000, 0x25290002,
-0xa22821, 0x229102b, 0x54400001, 0x1324821,
-0x95220000, 0x25290002, 0xa22821, 0x229102b,
-0x54400001, 0x1324821, 0x95220000, 0x8003e99,
-0xa22821, 0x94650010, 0x94620014, 0x24690016,
-0x30420fff, 0x14400003, 0x24a5ffec, 0x8003e8c,
-0x24130001, 0x9821, 0xa03021, 0x91230001,
-0x25290004, 0x95220000, 0x25290002, 0x95240000,
-0x25290002, 0xa32821, 0xa22821, 0x95220000,
-0x95230002, 0xa42821, 0xa22821, 0xa32821,
-0x51c02, 0x30a2ffff, 0x622821, 0x51c02,
-0x30a2ffff, 0x622821, 0x96e2046a, 0x30420001,
-0x1040001e, 0x2021, 0x95820016, 0x4e2023,
-0x41402, 0x822021, 0x326200ff, 0x50400002,
-0x862021, 0x852021, 0x41402, 0x822021,
-0x3084ffff, 0x50800001, 0x3404ffff, 0x8d620018,
-0x24430017, 0x223102b, 0x54400001, 0x721821,
-0x90620000, 0x38430011, 0x2c630001, 0x38420006,
-0x2c420001, 0x621825, 0x10600004, 0x0,
-0x9562000e, 0x34420001, 0xa562000e, 0x9562000e,
-0x240a0002, 0x30420004, 0x10400002, 0xa5640012,
-0x240a0004, 0x8f880120, 0x27623800, 0x25090020,
-0x122102b, 0x50400001, 0x27693000, 0x8f820128,
-0x11220004, 0x0, 0x8f820124, 0x15220007,
-0x24040020, 0x8ee201a4, 0x8021, 0x24420001,
-0xaee201a4, 0x8003f4f, 0x8ee201a4, 0x8ee5724c,
-0x8ee60490, 0x8ee70494, 0xad0b0008, 0xa504000e,
-0xad0a0018, 0x52940, 0xa01821, 0x1021,
-0xe33821, 0xe3202b, 0xc23021, 0xc43021,
-0xad060000, 0xad070004, 0x8ee2724c, 0x4d1025,
-0xad02001c, 0x8ee204c4, 0xad020010, 0xaf890120,
-0x92e24e20, 0x14400060, 0x24100001, 0x2543ffee,
-0x2c630002, 0x39420011, 0x2c420001, 0x621825,
-0x10600024, 0x0, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c820000, 0x1455000f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062000b,
-0x0, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee34e30, 0x24420001, 0x1054002b,
-0x0, 0x8003f2e, 0x0, 0x8ee24e30,
-0x24420001, 0x50540003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x24020001, 0x8003f4e,
-0xac950000, 0x8ee24e30, 0x210c0, 0x24425038,
-0x2e22021, 0x8c830000, 0x24020007, 0x1462001f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062001b,
-0x0, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee34e30, 0x24420001, 0x10540007,
-0x0, 0x8ee24e34, 0x24420001, 0x10620005,
-0x0, 0x8003f3a, 0x0, 0x14600005,
-0x0, 0x8f820128, 0x24420020, 0xaf820128,
-0x8f820128, 0x8c820004, 0x2c420011, 0x50400012,
-0xac800000, 0x8003f4f, 0x0, 0x8ee24e30,
-0x24420001, 0x50540003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x24020007, 0xac820000,
-0x24020001, 0xac820004, 0x1600000d, 0x0,
-0x8f820120, 0x3c040001, 0x24845938, 0xafa00014,
-0xafa20010, 0x8d86001c, 0x8f870124, 0x3c050008,
-0xc002403, 0x34a50001, 0x8004057, 0x0,
-0x8ee2724c, 0x24420001, 0x304207ff, 0x11a00006,
-0xaee2724c, 0x8ee201d0, 0x2442ffff, 0xaee201d0,
-0x8003f6b, 0x8ee201d0, 0x8ee201cc, 0x2442ffff,
-0xaee201cc, 0x8ee201cc, 0x8ee201d8, 0x2442ffff,
-0xaee201d8, 0x8004057, 0x8ee201d8, 0x8f420240,
-0x104000e5, 0x0, 0x8ee20e1c, 0x24420001,
-0x8004057, 0xaee20e1c, 0x9582001e, 0xad82001c,
-0x8f420240, 0x10400072, 0x0, 0x8ee20e1c,
-0x24420001, 0xaee20e1c, 0x8f430240, 0x43102b,
-0x144000d5, 0x0, 0x8f830120, 0x27623800,
-0x24660020, 0xc2102b, 0x50400001, 0x27663000,
-0x8f820128, 0x10c20004, 0x0, 0x8f820124,
-0x14c20007, 0x0, 0x8ee201a4, 0x8021,
-0x24420001, 0xaee201a4, 0x8003fda, 0x8ee201a4,
-0x8ee2724c, 0xac62001c, 0x8ee404a8, 0x8ee504ac,
-0x2462001c, 0xac620008, 0x24020008, 0xa462000e,
-0x24020011, 0xac620018, 0xac640000, 0xac650004,
-0x8ee204c4, 0xac620010, 0xaf860120, 0x92e24e20,
-0x14400034, 0x24100001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c820000, 0x1455001f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062001b,
-0x0, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee34e30, 0x24420001, 0x10540007,
-0x0, 0x8ee24e34, 0x24420001, 0x10620005,
-0x0, 0x8003fc6, 0x0, 0x14600005,
-0x0, 0x8f820128, 0x24420020, 0xaf820128,
-0x8f820128, 0x8c820004, 0x2c420011, 0x50400011,
-0xac800000, 0x8003fda, 0x0, 0x8ee24e30,
-0x24420001, 0x50540003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x24020001, 0xac950000,
-0xac820004, 0x5600000b, 0x24100001, 0x8ee2724c,
-0x3c040001, 0x248458a8, 0xafa00014, 0xafa20010,
-0x8ee6724c, 0x8f470280, 0x3c050009, 0xc002403,
-0x34a5f008, 0x56000001, 0xaee00e1c, 0x8ee20188,
-0x24420001, 0xaee20188, 0x8004050, 0x8ee20188,
-0x8f830120, 0x27623800, 0x24660020, 0xc2102b,
-0x50400001, 0x27663000, 0x8f820128, 0x10c20004,
-0x0, 0x8f820124, 0x14c20007, 0x0,
-0x8ee201a4, 0x8021, 0x24420001, 0xaee201a4,
-0x8004044, 0x8ee201a4, 0x8ee2724c, 0xac62001c,
-0x8ee404a8, 0x8ee504ac, 0x2462001c, 0xac620008,
-0x24020008, 0xa462000e, 0x24020011, 0xac620018,
-0xac640000, 0xac650004, 0x8ee204c4, 0xac620010,
-0xaf860120, 0x92e24e20, 0x14400034, 0x24100001,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x8c820000, 0x1455001f, 0x0, 0x8ee34e30,
-0x8ee24e34, 0x1062001b, 0x0, 0x8c820004,
-0x24420001, 0xac820004, 0x8ee24e34, 0x8ee34e30,
-0x24420001, 0x10540007, 0x0, 0x8ee24e34,
-0x24420001, 0x10620005, 0x0, 0x8004030,
-0x0, 0x14600005, 0x0, 0x8f820128,
-0x24420020, 0xaf820128, 0x8f820128, 0x8c820004,
-0x2c420011, 0x50400011, 0xac800000, 0x8004044,
-0x0, 0x8ee24e30, 0x24420001, 0x50540003,
-0x1021, 0x8ee24e30, 0x24420001, 0xaee24e30,
-0x8ee24e30, 0x210c0, 0x24425038, 0x2e22021,
-0x24020001, 0xac950000, 0xac820004, 0x1600000b,
-0x0, 0x8ee2724c, 0x3c040001, 0x248458a8,
-0xafa00014, 0xafa20010, 0x8ee6724c, 0x8f470280,
-0x3c050009, 0xc002403, 0x34a5f008, 0x8ee20174,
-0x24420001, 0xaee20174, 0x8004057, 0x8ee20174,
-0x24020001, 0xaee24e24, 0x8f830128, 0x8f820124,
-0x1462fd58, 0x0, 0x8fbf0030, 0x8fb5002c,
-0x8fb40028, 0x8fb30024, 0x8fb20020, 0x8fb1001c,
-0x8fb00018, 0x3e00008, 0x27bd0038, 0x27bdffe8,
-0x27840208, 0x27450200, 0x24060008, 0xafbf0014,
-0xc00249a, 0xafb00010, 0x2021, 0x24100001,
-0x2402241f, 0xaf900210, 0xaf900200, 0xaf800204,
-0xaf820214, 0x8f460248, 0x24030004, 0x3c020040,
-0x3c010001, 0xac235cc4, 0x3c010001, 0xac235cc8,
-0x3c010001, 0xac205d9c, 0x3c010001, 0xac225cc0,
-0x3c010001, 0xac235cc8, 0xc005108, 0x24050004,
-0xc004822, 0x0, 0x8ee20000, 0x3c03feff,
-0x3463fffd, 0x431024, 0xaee20000, 0x3c023c00,
-0xaf82021c, 0x3c010001, 0x370821, 0xac3083ac,
-0x8fbf0014, 0x8fb00010, 0x3e00008, 0x27bd0018,
-0x27bdffe0, 0x3c050008, 0x34a50400, 0xafbf0018,
-0xafa00010, 0xafa00014, 0x8f860200, 0x3c040001,
-0x248459f0, 0xc002403, 0x3821, 0x8ee20280,
-0x24420001, 0xaee20280, 0x8ee20280, 0x8f830200,
-0x3c023f00, 0x621824, 0x8fbf0018, 0x3c020400,
-0x3e00008, 0x27bd0020, 0x27bdffd8, 0xafbf0020,
-0xafb1001c, 0xafb00018, 0x8f900220, 0x8ee20214,
-0x3821, 0x24420001, 0xaee20214, 0x8ee20214,
-0x3c020300, 0x2021024, 0x10400027, 0x3c110400,
-0xc00429b, 0x0, 0x3c020100, 0x2021024,
-0x10400007, 0x0, 0x8ee20218, 0x24420001,
-0xaee20218, 0x8ee20218, 0x80040c6, 0x3c03fdff,
-0x8ee2021c, 0x24420001, 0xaee2021c, 0x8ee2021c,
-0x3c03fdff, 0x3463ffff, 0x3c0808ff, 0x3508ffff,
-0x8ee20000, 0x3c040001, 0x248459fc, 0x3c050008,
-0x2003021, 0x431024, 0xaee20000, 0x8f820220,
-0x3821, 0x3c030300, 0x481024, 0x431025,
-0xaf820220, 0xafa00010, 0xc002403, 0xafa00014,
-0x8004296, 0x0, 0x2111024, 0x1040001f,
-0x3c024000, 0x8f830224, 0x24021402, 0x1462000b,
-0x3c03fdff, 0x3c040001, 0x24845a08, 0x3c050008,
-0xafa00010, 0xafa00014, 0x8f860224, 0x34a5ffff,
-0xc002403, 0x3821, 0x3c03fdff, 0x8ee20000,
-0x3463ffff, 0x2002021, 0x431024, 0xc004e54,
-0xaee20000, 0x8ee20220, 0x24420001, 0xaee20220,
-0x8ee20220, 0x8f820220, 0x3c0308ff, 0x3463ffff,
-0x431024, 0x8004295, 0x511025, 0x2021024,
-0x10400142, 0x0, 0x8ee2022c, 0x24420001,
-0xaee2022c, 0x8ee2022c, 0x8f820220, 0x3c0308ff,
-0x3463ffff, 0x431024, 0x34420004, 0xaf820220,
-0x8f830054, 0x8f820054, 0x800410e, 0x24630002,
-0x8f820054, 0x621023, 0x2c420003, 0x1440fffc,
-0x0, 0x8f8600e0, 0x8f8400e4, 0x30c20007,
-0x10400012, 0x0, 0x8f8300e4, 0x2402fff8,
-0xc21024, 0x1043000d, 0x0, 0x8f820054,
-0x8f8300e0, 0x14c30009, 0x24440050, 0x8f820054,
-0x821023, 0x2c420051, 0x10400004, 0x0,
-0x8f8200e0, 0x10c2fff9, 0x0, 0x8f820220,
-0x3c0308ff, 0x3463fffd, 0x431024, 0xaf820220,
-0x8f8600e0, 0x30c20007, 0x10400003, 0x2402fff8,
-0xc23024, 0xaf8600e0, 0x8f8300c4, 0x3c02001f,
-0x3442ffff, 0x24680008, 0x48102b, 0x10400003,
-0x3c02fff5, 0x34421000, 0x1024021, 0x8f8b00c8,
-0x8f850120, 0x8f840124, 0x8004145, 0x6021,
-0x27623800, 0x82102b, 0x50400001, 0x27643000,
-0x10a40010, 0x318200ff, 0x8c820018, 0x38430007,
-0x2c630001, 0x3842000b, 0x2c420001, 0x621825,
-0x5060fff3, 0x24840020, 0x8ee20240, 0x240c0001,
-0x24420001, 0xaee20240, 0x8ee20240, 0x8c8b0008,
-0x318200ff, 0x14400065, 0x0, 0x3c020001,
-0x571021, 0x904283c0, 0x14400060, 0x0,
-0x8f8400e4, 0xc41023, 0x218c3, 0x4620001,
-0x24630200, 0x8f8900c4, 0x10600005, 0x24020001,
-0x10620009, 0x0, 0x8004187, 0x0,
-0x8ee20230, 0x1205821, 0x24420001, 0xaee20230,
-0x80041bc, 0x8ee20230, 0x8ee20234, 0x3c05000a,
-0x24420001, 0xaee20234, 0x8c8b0000, 0x34a5f000,
-0x8ee20234, 0x12b1823, 0xa3102b, 0x54400001,
-0x651821, 0x2c62233f, 0x14400040, 0x0,
-0x8f8200e8, 0x24420008, 0xaf8200e8, 0x8f8200e8,
-0x8f8200e4, 0x1205821, 0x24420008, 0xaf8200e4,
-0x80041bc, 0x8f8200e4, 0x8ee20238, 0x3c03000a,
-0x24420001, 0xaee20238, 0x8c840000, 0x3463f000,
-0x8ee20238, 0x883823, 0x67102b, 0x54400001,
-0xe33821, 0x3c020003, 0x34420d40, 0x47102b,
-0x10400003, 0x0, 0x80041bc, 0x805821,
-0x8f8200e4, 0x24440008, 0xaf8400e4, 0x8f8400e4,
-0x10860018, 0x3c05000a, 0x34a5f000, 0x3c0a0003,
-0x354a0d40, 0x8ee2007c, 0x24420001, 0xaee2007c,
-0x8c830000, 0x8ee2007c, 0x683823, 0xa7102b,
-0x54400001, 0xe53821, 0x147102b, 0x54400007,
-0x605821, 0x8f8200e4, 0x24440008, 0xaf8400e4,
-0x8f8400e4, 0x1486ffef, 0x0, 0x14860005,
-0x0, 0x1205821, 0xaf8600e4, 0x80041bc,
-0xaf8600e8, 0xaf8400e4, 0xaf8400e8, 0x8f8200c8,
-0x3c03000a, 0x3463f000, 0x483823, 0x67102b,
-0x54400001, 0xe33821, 0x3c020003, 0x34420d3f,
-0x47102b, 0x54400007, 0x6021, 0x1683823,
-0x67102b, 0x54400003, 0xe33821, 0x80041cf,
-0x3c020003, 0x3c020003, 0x34420d3f, 0x47102b,
-0x14400016, 0x318200ff, 0x14400006, 0x0,
-0x3c020001, 0x571021, 0x904283c0, 0x1040000f,
-0x0, 0x8ee2023c, 0x3c04fdff, 0x8ee30000,
-0x3484ffff, 0x24420001, 0xaee2023c, 0x8ee2023c,
-0x24020001, 0x641824, 0x3c010001, 0x370821,
-0xa02283b8, 0x800422c, 0xaee30000, 0xaf8b00c8,
-0x8f8300c8, 0x8f8200c4, 0x3c04000a, 0x3484f000,
-0x623823, 0x87102b, 0x54400001, 0xe43821,
-0x3c020003, 0x34420d40, 0x47102b, 0x2ce30001,
-0x431025, 0x10400008, 0x0, 0x8f820220,
-0x3c0308ff, 0x3463ffff, 0x431024, 0x3c034000,
-0x431025, 0xaf820220, 0x8f8600e0, 0x8f8400e4,
-0x10c4002a, 0x0, 0x8ee2007c, 0x24420001,
-0xaee2007c, 0x8ee2007c, 0x24c2fff8, 0xaf8200e0,
-0x3c020001, 0x8c427e30, 0x3c030008, 0x8f8600e0,
-0x431024, 0x1040001d, 0x0, 0x10c4001b,
-0x240dfff8, 0x3c0a000a, 0x354af000, 0x3c0c0080,
-0x24850008, 0x27622800, 0x50a20001, 0x27651800,
-0x8c880004, 0x8c820000, 0x8ca90000, 0x3103ffff,
-0x431021, 0x4d1024, 0x24430010, 0x6b102b,
-0x54400001, 0x6a1821, 0x12b102b, 0x54400001,
-0x12a4821, 0x10690002, 0x10c1025, 0xac820004,
-0xa02021, 0x14c4ffeb, 0x24850008, 0x8f820220,
-0x3c0308ff, 0x3463ffff, 0x431024, 0x34420002,
-0xaf820220, 0x8f830054, 0x8f820054, 0x8004237,
-0x24630001, 0x8f820054, 0x621023, 0x2c420002,
-0x1440fffc, 0x0, 0x8f820220, 0x3c0308ff,
-0x3463fffb, 0x431024, 0xaf820220, 0x6010055,
-0x0, 0x8ee20228, 0x24420001, 0xaee20228,
-0x8ee20228, 0x8f820220, 0x3c0308ff, 0x3463ffff,
-0x431024, 0x34420004, 0xaf820220, 0x8f830054,
-0x8f820054, 0x8004251, 0x24630002, 0x8f820054,
-0x621023, 0x2c420003, 0x1440fffc, 0x0,
-0x8f8600e0, 0x30c20007, 0x10400012, 0x0,
-0x8f8300e4, 0x2402fff8, 0xc21024, 0x1043000d,
-0x0, 0x8f820054, 0x8f8300e0, 0x14c30009,
-0x24440032, 0x8f820054, 0x821023, 0x2c420033,
-0x10400004, 0x0, 0x8f8200e0, 0x10c2fff9,
-0x0, 0x8f820220, 0x3c0308ff, 0x3463fffd,
-0x431024, 0xaf820220, 0x8f8600e0, 0x30c20007,
-0x10400003, 0x2402fff8, 0xc23024, 0xaf8600e0,
-0x240301f5, 0x8f8200e8, 0x673823, 0x718c0,
-0x431021, 0xaf8200e8, 0x8f8200e8, 0xaf8200e4,
-0x8ee2007c, 0x3c0408ff, 0x3484ffff, 0x471021,
-0xaee2007c, 0x8f820220, 0x3c038000, 0x34630002,
-0x441024, 0x431025, 0xaf820220, 0x8f830054,
-0x8f820054, 0x800428d, 0x24630001, 0x8f820054,
-0x621023, 0x2c420002, 0x1440fffc, 0x0,
-0x8f820220, 0x3c0308ff, 0x3463fffb, 0x431024,
-0xaf820220, 0x8fbf0020, 0x8fb1001c, 0x8fb00018,
-0x3e00008, 0x27bd0028, 0x3c020001, 0x8c425cd8,
-0x27bdffd8, 0x10400012, 0xafbf0020, 0x3c040001,
-0x24845a14, 0x3c050008, 0x24020001, 0x3c010001,
-0x370821, 0xac2283ac, 0xafa00010, 0xafa00014,
-0x8f860220, 0x34a50498, 0x3c010001, 0xac205cd8,
-0x3c010001, 0xac225ccc, 0xc002403, 0x3821,
-0x8f420268, 0x3c037fff, 0x3463ffff, 0x431024,
-0xaf420268, 0x8ee204d0, 0x8ee404d4, 0x2403fffe,
-0x431024, 0x30840002, 0x1080011e, 0xaee204d0,
-0x8ee204d4, 0x2403fffd, 0x431024, 0xaee204d4,
-0x8f820044, 0x3c030600, 0x34632000, 0x34420020,
-0xaf820044, 0xafa30018, 0x8ee20608, 0x8f430228,
-0x24420001, 0x304a00ff, 0x514300fe, 0xafa00010,
-0x8ee20608, 0x210c0, 0x571021, 0x8fa30018,
-0x8fa4001c, 0xac43060c, 0xac440610, 0x8f830054,
-0x8f820054, 0x24690032, 0x1221023, 0x2c420033,
-0x1040006a, 0x5821, 0x24180008, 0x240f000d,
-0x240d0007, 0x240c0040, 0x240e0001, 0x8f870120,
-0x27623800, 0x24e80020, 0x102102b, 0x50400001,
-0x27683000, 0x8f820128, 0x11020004, 0x0,
-0x8f820124, 0x15020007, 0x1021, 0x8ee201a4,
-0x2821, 0x24420001, 0xaee201a4, 0x800433d,
-0x8ee201a4, 0x8ee40608, 0x420c0, 0x801821,
-0x8ee40430, 0x8ee50434, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0xace40000, 0xace50004,
-0x8ee20608, 0xa4f8000e, 0xacef0018, 0xacea001c,
-0x210c0, 0x2442060c, 0x2e21021, 0xace20008,
-0x8ee204c4, 0xace20010, 0xaf880120, 0x92e24e20,
-0x14400033, 0x24050001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c820000, 0x144d001f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062001b,
-0x0, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee34e30, 0x24420001, 0x104c0007,
-0x0, 0x8ee24e34, 0x24420001, 0x10620005,
-0x0, 0x800432a, 0x0, 0x14600005,
-0x0, 0x8f820128, 0x24420020, 0xaf820128,
-0x8f820128, 0x8c820004, 0x2c420011, 0x50400010,
-0xac800000, 0x800433d, 0x0, 0x8ee24e30,
-0x24420001, 0x504c0003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0xac8d0000, 0xac8e0004,
-0x54a00006, 0x240b0001, 0x8f820054, 0x1221023,
-0x2c420033, 0x1440ff9d, 0x0, 0x316300ff,
-0x24020001, 0x54620079, 0xafa00010, 0xaeea0608,
-0x8f830054, 0x8f820054, 0x24690032, 0x1221023,
-0x2c420033, 0x10400061, 0x5821, 0x240d0008,
-0x240c0011, 0x24080012, 0x24070040, 0x240a0001,
-0x8f830120, 0x27623800, 0x24660020, 0xc2102b,
-0x50400001, 0x27663000, 0x8f820128, 0x10c20004,
-0x0, 0x8f820124, 0x14c20007, 0x0,
-0x8ee201a4, 0x2821, 0x24420001, 0xaee201a4,
-0x80043a9, 0x8ee201a4, 0x8ee20608, 0xac62001c,
-0x8ee404a0, 0x8ee504a4, 0x2462001c, 0xac620008,
-0xa46d000e, 0xac6c0018, 0xac640000, 0xac650004,
-0x8ee204c4, 0xac620010, 0xaf860120, 0x92e24e20,
-0x14400033, 0x24050001, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0x8c820000, 0x1448001f,
-0x0, 0x8ee34e30, 0x8ee24e34, 0x1062001b,
-0x0, 0x8c820004, 0x24420001, 0xac820004,
-0x8ee24e34, 0x8ee34e30, 0x24420001, 0x10470007,
-0x0, 0x8ee24e34, 0x24420001, 0x10620005,
-0x0, 0x8004396, 0x0, 0x14600005,
-0x0, 0x8f820128, 0x24420020, 0xaf820128,
-0x8f820128, 0x8c820004, 0x2c420011, 0x50400010,
-0xac800000, 0x80043a9, 0x0, 0x8ee24e30,
-0x24420001, 0x50470003, 0x1021, 0x8ee24e30,
-0x24420001, 0xaee24e30, 0x8ee24e30, 0x210c0,
-0x24425038, 0x2e22021, 0xac880000, 0xac8a0004,
-0x54a00006, 0x240b0001, 0x8f820054, 0x1221023,
-0x2c420033, 0x1440ffa6, 0x0, 0x316300ff,
-0x24020001, 0x54620003, 0xafa00010, 0x80043d6,
-0x0, 0x3c040001, 0x24845a20, 0xafa00014,
-0x8f860120, 0x8f870124, 0x3c050009, 0xc002403,
-0x34a5f011, 0x80043d6, 0x0, 0x3c040001,
-0x24845a2c, 0xafa00014, 0x8f860120, 0x8f870124,
-0x3c050009, 0xc002403, 0x34a5f010, 0x80043d6,
-0x0, 0x3c040001, 0x24845a38, 0xafa00014,
-0x8ee60608, 0x8f470228, 0x3c050009, 0xc002403,
-0x34a5f00f, 0x8ee201ac, 0x24420001, 0xaee201ac,
-0x8ee201ac, 0x8ee2015c, 0x24420001, 0xaee2015c,
-0x8ee2015c, 0x8fbf0020, 0x3e00008, 0x27bd0028,
-0x3c020001, 0x8c425cd8, 0x27bdffe0, 0x1440000d,
-0xafbf0018, 0x3c040001, 0x24845a44, 0x3c050008,
-0xafa00010, 0xafa00014, 0x8f860220, 0x34a50499,
-0x24020001, 0x3c010001, 0xac225cd8, 0xc002403,
-0x3821, 0x8ee204d0, 0x3c030001, 0x771821,
-0x946383b2, 0x34420001, 0x10600007, 0xaee204d0,
-0x8f820220, 0x3c0308ff, 0x3463ffff, 0x431024,
-0x34420008, 0xaf820220, 0x2021, 0xc0052a2,
-0x24050004, 0xaf420268, 0x8fbf0018, 0x3e00008,
-0x27bd0020, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x3c120001,
-0x26521200, 0x3c140001, 0x8e945c50, 0x3c100001,
-0x26101120, 0x3c15c000, 0x36b50060, 0x8e8a0000,
-0x8eb30000, 0x26a400b, 0x248000a, 0x200f821,
-0x0, 0xd, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x80014d6,
-0x0, 0x80014d8, 0x3c0a0001, 0x80014d8,
-0x3c0a0002, 0x80014d8, 0x0, 0x80024a6,
-0x0, 0x80014d8, 0x3c0a0003, 0x80014d8,
-0x3c0a0004, 0x8002f8c, 0x0, 0x80014d8,
-0x3c0a0005, 0x8003ce8, 0x0, 0x8003c66,
-0x0, 0x80014d8, 0x3c0a0006, 0x80014d8,
-0x3c0a0007, 0x80014d8, 0x0, 0x80014d8,
-0x0, 0x80014d8, 0x0, 0x8002a75,
-0x0, 0x80014d8, 0x3c0a000b, 0x80014d8,
-0x3c0a000c, 0x80014d8, 0x3c0a000d, 0x800237a,
-0x0, 0x8002339, 0x0, 0x80014d8,
-0x3c0a000e, 0x8001b3c, 0x0, 0x80024a4,
-0x0, 0x80014d8, 0x3c0a000f, 0x80040a7,
-0x0, 0x8004091, 0x0, 0x80014d8,
-0x3c0a0010, 0x80014ee, 0x0, 0x80014d8,
-0x3c0a0011, 0x80014d8, 0x3c0a0012, 0x80014d8,
-0x3c0a0013, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x3c030001,
-0x34633800, 0x24050080, 0x2404001f, 0x2406ffff,
-0x24020001, 0xaf80021c, 0xaf820200, 0xaf820220,
-0x3631021, 0xaf8200c0, 0x3631021, 0xaf8200c4,
-0x3631021, 0xaf8200c8, 0x27623800, 0xaf8200d0,
-0x27623800, 0xaf8200d4, 0x27623800, 0xaf8200d8,
-0x27621800, 0xaf8200e0, 0x27621800, 0xaf8200e4,
-0x27621800, 0xaf8200e8, 0x27621000, 0xaf8200f0,
-0x27621000, 0xaf8200f4, 0x27621000, 0xaf8200f8,
-0xaca00000, 0x2484ffff, 0x1486fffd, 0x24a50004,
-0x8f830040, 0x3c02f000, 0x621824, 0x3c025000,
-0x1062000c, 0x43102b, 0x14400006, 0x3c026000,
-0x3c024000, 0x10620008, 0x24020800, 0x8004539,
-0x0, 0x10620004, 0x24020800, 0x8004539,
-0x0, 0x24020700, 0x3c010001, 0xac225cdc,
-0x3e00008, 0x0, 0x27bdffd8, 0xafbf0024,
-0xafb00020, 0x8f830054, 0x8f820054, 0x3c010001,
-0xac205cc4, 0x8004545, 0x24630064, 0x8f820054,
-0x621023, 0x2c420065, 0x1440fffc, 0x0,
-0xc004d71, 0x0, 0x24040001, 0x2821,
-0x27a60018, 0x34028000, 0xc00498e, 0xa7a20018,
-0x8f830054, 0x8f820054, 0x8004556, 0x24630064,
-0x8f820054, 0x621023, 0x2c420065, 0x1440fffc,
-0x24040001, 0x24050001, 0xc00494c, 0x27a60018,
-0x8f830054, 0x8f820054, 0x8004562, 0x24630064,
-0x8f820054, 0x621023, 0x2c420065, 0x1440fffc,
-0x24040001, 0x24050001, 0xc00494c, 0x27a60018,
-0x8f830054, 0x8f820054, 0x800456e, 0x24630064,
-0x8f820054, 0x621023, 0x2c420065, 0x1440fffc,
-0x24040001, 0x3c060001, 0x24c65da0, 0xc00494c,
-0x24050002, 0x8f830054, 0x8f820054, 0x800457b,
-0x24630064, 0x8f820054, 0x621023, 0x2c420065,
-0x1440fffc, 0x24040001, 0x24050003, 0x3c100001,
-0x26105da2, 0xc00494c, 0x2003021, 0x97a60018,
-0x3c070001, 0x94e75da0, 0x3c040001, 0x24845ab0,
-0xafa00014, 0x96020000, 0x3c05000d, 0x34a50100,
-0xc002403, 0xafa20010, 0x97a20018, 0x1040004c,
-0x24036040, 0x96020000, 0x3042fff0, 0x1443000a,
-0x24020020, 0x3c030001, 0x94635da0, 0x54620009,
-0x24027830, 0x24020003, 0x3c010001, 0xac225cc4,
-0x80045ac, 0x24020005, 0x3c030001, 0x94635da0,
-0x24027830, 0x1462000f, 0x24030010, 0x3c020001,
-0x94425da2, 0x3042fff0, 0x1443000a, 0x24020003,
-0x3c010001, 0xac225cc4, 0x24020006, 0x3c010001,
-0xac225db0, 0x3c010001, 0xac225dbc, 0x80045e6,
-0x3c09fff0, 0x3c020001, 0x8c425cc4, 0x3c030001,
-0x94635da0, 0x34420001, 0x3c010001, 0xac225cc4,
-0x24020015, 0x1462000f, 0x0, 0x3c020001,
-0x94425da2, 0x3042fff0, 0x3843f420, 0x2c630001,
-0x3842f430, 0x2c420001, 0x621825, 0x10600005,
-0x24020003, 0x3c010001, 0xac225dbc, 0x80045e6,
-0x3c09fff0, 0x3c030001, 0x94635da0, 0x24027810,
-0x1462000b, 0x24020002, 0x3c020001, 0x94425da2,
-0x3042fff0, 0x14400006, 0x24020002, 0x24020004,
-0x3c010001, 0xac225dbc, 0x80045e6, 0x3c09fff0,
-0x3c010001, 0xac225dbc, 0x80045e6, 0x3c09fff0,
-0x3c020001, 0x8c425cc4, 0x24030001, 0x3c010001,
-0xac235dbc, 0x34420004, 0x3c010001, 0xac225cc4,
-0x3c09fff0, 0x3529bdc0, 0x3c060001, 0x8cc65cc4,
-0x3c040001, 0x24845ab0, 0x24020001, 0x3c010001,
-0xac225ccc, 0x8f820054, 0x3c070001, 0x8ce75dbc,
-0x3c030001, 0x94635da0, 0x3c080001, 0x95085da2,
-0x3c05000d, 0x34a50100, 0x3c010001, 0xac205cc8,
-0x491021, 0x3c010001, 0xac225dac, 0xafa30010,
-0xc002403, 0xafa80014, 0x8fbf0024, 0x8fb00020,
-0x3e00008, 0x27bd0028, 0x27bdffe8, 0x3c050001,
-0x8ca55cc8, 0x24060004, 0x24020001, 0x14a20014,
-0xafbf0010, 0x3c020001, 0x8c427e3c, 0x30428000,
-0x10400005, 0x3c04000f, 0x3c030001, 0x8c635dbc,
-0x8004617, 0x34844240, 0x3c040004, 0x3c030001,
-0x8c635dbc, 0x348493e0, 0x24020005, 0x14620016,
-0x0, 0x3c04003d, 0x800462f, 0x34840900,
-0x3c020001, 0x8c427e38, 0x30428000, 0x10400005,
-0x3c04001e, 0x3c030001, 0x8c635dbc, 0x800462a,
-0x34848480, 0x3c04000f, 0x3c030001, 0x8c635dbc,
-0x34844240, 0x24020005, 0x14620003, 0x0,
-0x3c04007a, 0x34841200, 0x3c020001, 0x8c425dac,
-0x8f830054, 0x441021, 0x431023, 0x44102b,
-0x14400037, 0x0, 0x3c020001, 0x8c425cd0,
-0x14400033, 0x0, 0x3c010001, 0x10c00025,
-0xac205ce0, 0x3c090001, 0x8d295cc4, 0x24070001,
-0x3c044000, 0x3c080001, 0x25087e3c, 0x250afffc,
-0x52842, 0x14a00002, 0x24c6ffff, 0x24050008,
-0xa91024, 0x10400010, 0x0, 0x14a70008,
-0x0, 0x8d020000, 0x441024, 0x1040000a,
-0x0, 0x3c010001, 0x800465b, 0xac255ce0,
-0x8d420000, 0x441024, 0x10400003, 0x0,
-0x3c010001, 0xac275ce0, 0x3c020001, 0x8c425ce0,
-0x6182b, 0x2c420001, 0x431024, 0x5440ffe5,
-0x52842, 0x8f820054, 0x3c030001, 0x8c635ce0,
-0x3c010001, 0xac225dac, 0x1060002a, 0x24020001,
-0x3c010001, 0xac255cc8, 0x3c010001, 0xac225ccc,
-0x3c020001, 0x8c425ce0, 0x10400022, 0x0,
-0x3c020001, 0x8c425ccc, 0x1040000a, 0x24020001,
-0x3c010001, 0xac205ccc, 0x3c010001, 0x370821,
-0xac2283ac, 0x3c010001, 0xac205d4c, 0x3c010001,
-0xac225d04, 0x3c030001, 0x771821, 0x8c6383ac,
-0x24020008, 0x10620005, 0x24020001, 0xc004695,
-0x0, 0x8004692, 0x0, 0x3c030001,
-0x8c635cc8, 0x10620007, 0x2402000e, 0x3c030001,
-0x8c637dd0, 0x10620003, 0x0, 0xc004e54,
-0x8f840220, 0x8fbf0010, 0x3e00008, 0x27bd0018,
-0x27bdffe0, 0x3c02fdff, 0xafbf0018, 0x8ee30000,
-0x3c050001, 0x8ca55cc8, 0x3c040001, 0x8c845cf0,
-0x3442ffff, 0x621824, 0x14a40008, 0xaee30000,
-0x3c030001, 0x771821, 0x8c6383ac, 0x3c020001,
-0x8c425cf4, 0x10620008, 0x0, 0x3c020001,
-0x571021, 0x8c4283ac, 0x3c010001, 0xac255cf0,
-0x3c010001, 0xac225cf4, 0x3c030001, 0x8c635cc8,
-0x24020002, 0x10620169, 0x2c620003, 0x10400005,
-0x24020001, 0x10620008, 0x0, 0x800481c,
-0x0, 0x24020004, 0x106200b1, 0x24020001,
-0x800481d, 0x0, 0x3c020001, 0x571021,
-0x8c4283ac, 0x2443ffff, 0x2c620008, 0x1040015a,
-0x31080, 0x3c010001, 0x220821, 0x8c225ac8,
-0x400008, 0x0, 0x3c030001, 0x8c635dbc,
-0x24020005, 0x14620014, 0x0, 0x3c020001,
-0x8c425cd4, 0x1040000a, 0x24020003, 0xc004822,
-0x0, 0x24020002, 0x3c010001, 0x370821,
-0xac2283ac, 0x3c010001, 0x80046e0, 0xac205cd4,
-0x3c010001, 0x370821, 0xac2283ac, 0x3c010001,
-0x800481f, 0xac205c60, 0xc004822, 0x0,
-0x3c020001, 0x8c425cd4, 0x3c010001, 0xac205c60,
-0x104000dd, 0x24020002, 0x3c010001, 0x370821,
-0xac2283ac, 0x3c010001, 0x800481f, 0xac205cd4,
-0x3c030001, 0x8c635dbc, 0x24020005, 0x14620003,
-0x24020001, 0x3c010001, 0xac225d00, 0xc0049cf,
-0x0, 0x3c030001, 0x8c635d00, 0x800478e,
-0x24020011, 0x3c050001, 0x8ca55cc8, 0x3c060001,
-0x8cc67e3c, 0xc005108, 0x2021, 0x24020005,
-0x3c010001, 0xac205cd4, 0x3c010001, 0x370821,
-0x800481f, 0xac2283ac, 0x3c040001, 0x24845abc,
-0x3c05000f, 0x34a50100, 0x3021, 0x3821,
-0xafa00010, 0xc002403, 0xafa00014, 0x800481f,
-0x0, 0x8f820220, 0x3c03f700, 0x431025,
-0x80047b7, 0xaf820220, 0x8f820220, 0x3c030004,
-0x431024, 0x144000a9, 0x24020007, 0x8f830054,
-0x3c020001, 0x8c425da4, 0x2463d8f0, 0x431023,
-0x2c422710, 0x144000f8, 0x24020001, 0x800481d,
-0x0, 0x3c050001, 0x8ca55cc8, 0xc0052a2,
-0x2021, 0xc005386, 0x2021, 0x3c030001,
-0x8c637e34, 0x46100ea, 0x24020001, 0x3c020008,
-0x621024, 0x10400006, 0x0, 0x8f820214,
-0x3c03ffff, 0x431024, 0x8004741, 0x3442251f,
-0x8f820214, 0x3c03ffff, 0x431024, 0x3442241f,
-0xaf820214, 0x8ee20000, 0x3c030200, 0x431025,
-0xaee20000, 0x8f820220, 0x2403fffb, 0x431024,
-0xaf820220, 0x8f820220, 0x34420002, 0xaf820220,
-0x24020008, 0x3c010001, 0x370821, 0xac2283ac,
-0x8f820220, 0x3c030004, 0x431024, 0x14400005,
-0x0, 0x8f820220, 0x3c03f700, 0x431025,
-0xaf820220, 0x3c030001, 0x8c635dbc, 0x24020005,
-0x1462000a, 0x0, 0x3c020001, 0x94425da2,
-0x24429fbc, 0x2c420004, 0x10400004, 0x24040018,
-0x24050002, 0xc004d93, 0x24060020, 0xc0043dd,
-0x0, 0x3c010001, 0x800481f, 0xac205d50,
-0x3c020001, 0x571021, 0x8c4283ac, 0x2443ffff,
-0x2c620008, 0x104000ac, 0x31080, 0x3c010001,
-0x220821, 0x8c225ae8, 0x400008, 0x0,
-0xc00429b, 0x0, 0x3c010001, 0xac205ccc,
-0xaf800204, 0x3c010001, 0xc004822, 0xac207e20,
-0x24020001, 0x3c010001, 0xac225ce4, 0x24020002,
-0x3c010001, 0x370821, 0x800481f, 0xac2283ac,
-0xc00489f, 0x0, 0x3c030001, 0x8c635ce4,
-0x24020009, 0x14620090, 0x24020003, 0x3c010001,
-0x370821, 0x800481f, 0xac2283ac, 0x3c020001,
-0x8c427e38, 0x30424000, 0x10400005, 0x0,
-0x8f820044, 0x3c03ffff, 0x800479f, 0x34637fff,
-0x8f820044, 0x2403ff7f, 0x431024, 0xaf820044,
-0x8f830054, 0x80047b9, 0x24020004, 0x8f830054,
-0x3c020001, 0x8c425da4, 0x2463d8f0, 0x431023,
-0x2c422710, 0x14400074, 0x24020005, 0x3c010001,
-0x370821, 0x800481f, 0xac2283ac, 0x8f820220,
-0x3c03f700, 0x431025, 0xaf820220, 0xaf800204,
-0x3c010001, 0xac207e20, 0x8f830054, 0x24020006,
-0x3c010001, 0x370821, 0xac2283ac, 0x3c010001,
-0x800481f, 0xac235da4, 0x8f830054, 0x3c020001,
-0x8c425da4, 0x2463fff6, 0x431023, 0x2c42000a,
-0x14400059, 0x0, 0x24020007, 0x3c010001,
-0x370821, 0x800481f, 0xac2283ac, 0x8f820220,
-0x3c04f700, 0x441025, 0xaf820220, 0x8f820220,
-0x3c030300, 0x431024, 0x14400005, 0x1821,
-0x8f820220, 0x24030001, 0x441025, 0xaf820220,
-0x10600043, 0x24020001, 0x8f820214, 0x3c03ffff,
-0x3c040001, 0x8c845d98, 0x431024, 0x3442251f,
-0xaf820214, 0x24020008, 0x3c010001, 0x370821,
-0x1080000b, 0xac2283ac, 0x3c020001, 0x8c425d74,
-0x14400007, 0x24020001, 0x3c010001, 0xac227dd0,
-0xc004e54, 0x8f840220, 0x800480c, 0x0,
-0x8f820220, 0x3c030008, 0x431024, 0x14400017,
-0x2402000e, 0x3c010001, 0xac227dd0, 0x8ee20000,
-0x2021, 0x3c030200, 0x431025, 0xc005386,
-0xaee20000, 0x8f820220, 0x2403fffb, 0x431024,
-0xaf820220, 0x8f820220, 0x34420002, 0xc0043dd,
-0xaf820220, 0x3c050001, 0x8ca55cc8, 0xc0052a2,
-0x2021, 0x800481f, 0x0, 0x3c020001,
-0x8c425d74, 0x10400010, 0x0, 0x3c020001,
-0x8c425d70, 0x2442ffff, 0x3c010001, 0xac225d70,
-0x14400009, 0x24020002, 0x3c010001, 0xac205d74,
-0x3c010001, 0x800481f, 0xac225d70, 0x24020001,
-0x3c010001, 0xac225ccc, 0x8fbf0018, 0x3e00008,
-0x27bd0020, 0x8f820200, 0x8f820220, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820200, 0x3c060001,
-0x8cc65cc8, 0x34420004, 0xaf820200, 0x24020002,
-0x10c2003a, 0x2cc20003, 0x10400005, 0x24020001,
-0x10c20008, 0x0, 0x8004868, 0x0,
-0x24020004, 0x10c20013, 0x24020001, 0x8004868,
-0x0, 0x3c030001, 0x8c635cb8, 0x3c020001,
-0x8c425cc0, 0x3c040001, 0x8c845cdc, 0x3c050001,
-0x8ca55cbc, 0xaf860200, 0xaf860220, 0x34630022,
-0x441025, 0x451025, 0x34420002, 0x8004867,
-0xaf830200, 0x3c030001, 0x8c635d98, 0xaf820200,
-0x10600009, 0xaf820220, 0x3c020001, 0x8c425d74,
-0x14400005, 0x3c033f00, 0x3c020001, 0x8c425cb0,
-0x800485b, 0x346300e0, 0x3c020001, 0x8c425cb0,
-0x3c033f00, 0x346300e2, 0x431025, 0xaf820200,
-0x3c030001, 0x8c635cb4, 0x3c04f700, 0x3c020001,
-0x8c425cc0, 0x3c050001, 0x8ca55cdc, 0x641825,
-0x431025, 0x451025, 0xaf820220, 0x3e00008,
-0x0, 0x8f820220, 0x3c030001, 0x8c635cc8,
-0x34420004, 0xaf820220, 0x24020001, 0x1062000f,
-0x0, 0x8f830054, 0x8f820054, 0x24630002,
-0x621023, 0x2c420003, 0x10400011, 0x0,
-0x8f820054, 0x621023, 0x2c420003, 0x1040000c,
-0x0, 0x8004879, 0x0, 0x8f830054,
-0x8f820054, 0x8004885, 0x24630007, 0x8f820054,
-0x621023, 0x2c420008, 0x1440fffc, 0x0,
-0x8f8400e0, 0x30820007, 0x1040000d, 0x0,
-0x8f820054, 0x8f8300e0, 0x14830009, 0x24450032,
-0x8f820054, 0xa21023, 0x2c420033, 0x10400004,
-0x0, 0x8f8200e0, 0x1082fff9, 0x0,
-0x8f820220, 0x2403fffd, 0x431024, 0xaf820220,
-0x3e00008, 0x0, 0x3c030001, 0x8c635ce4,
-0x3c020001, 0x8c425ce8, 0x50620004, 0x2463ffff,
-0x3c010001, 0xac235ce8, 0x2463ffff, 0x2c620009,
-0x1040009d, 0x31080, 0x3c010001, 0x220821,
-0x8c225b08, 0x400008, 0x0, 0x8f820044,
-0x34428080, 0xaf820044, 0x8f830054, 0x8004938,
-0x24020002, 0x8f830054, 0x3c020001, 0x8c425da8,
-0x2463d8f0, 0x431023, 0x2c422710, 0x1440008a,
-0x24020003, 0x8004945, 0x0, 0x8f820044,
-0x3c03ffff, 0x34637fff, 0x431024, 0xaf820044,
-0x8f830054, 0x8004938, 0x24020004, 0x8f830054,
-0x3c020001, 0x8c425da8, 0x2463fff6, 0x431023,
-0x2c42000a, 0x14400078, 0x24020005, 0x8004945,
-0x0, 0x8f820220, 0x3c03f700, 0x431025,
-0xaf820220, 0x8f820220, 0x2403fffb, 0x431024,
-0xaf820220, 0x8f820220, 0x34420002, 0xaf820220,
-0x3c023f00, 0x344200e0, 0xaf820200, 0x8f820200,
-0x2403fffd, 0x431024, 0xaf820200, 0x24040001,
-0x3405ffff, 0xaf840204, 0x8f830054, 0x8f820054,
-0x80048ec, 0x24630001, 0x8f820054, 0x621023,
-0x2c420002, 0x1440fffc, 0x0, 0x8f820224,
-0x42040, 0xa4102b, 0x1040fff2, 0x0,
-0x8f820220, 0x3c03f700, 0x431025, 0xaf820220,
-0x8f820214, 0x3c03ffff, 0x431024, 0x3442251f,
-0xaf820214, 0x8f820220, 0x2403fffb, 0x431024,
-0xaf820220, 0x8f820220, 0x3c04f700, 0x34840008,
-0x34420002, 0xaf820220, 0x8f820220, 0x3c033f00,
-0x346300e2, 0x441025, 0xaf820220, 0xaf830200,
-0x8f8400f0, 0x276217f8, 0x14820002, 0x24850008,
-0x27651000, 0x8f8200f4, 0x10a20007, 0x3c038000,
-0x34630040, 0x3c020001, 0x24425c70, 0xac820000,
-0xac830004, 0xaf8500f0, 0x8f830054, 0x8004938,
-0x24020006, 0x8f830054, 0x3c020001, 0x8c425da8,
-0x2463fff6, 0x431023, 0x2c42000a, 0x14400022,
-0x24020007, 0x8004945, 0x0, 0x8f8200e0,
-0xaf8200e4, 0x8f8200e0, 0xaf8200e8, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820220, 0x2403fff7,
-0x431024, 0xaf820220, 0x8f820044, 0x34428080,
-0xaf820044, 0x8f830054, 0x24020008, 0x3c010001,
-0xac225ce4, 0x3c010001, 0x8004947, 0xac235da8,
-0x8f830054, 0x3c020001, 0x8c425da8, 0x2463d8f0,
-0x431023, 0x2c422710, 0x14400003, 0x24020009,
-0x3c010001, 0xac225ce4, 0x3e00008, 0x0,
-0x0, 0x0, 0x0, 0x27bdffd8,
-0xafb20018, 0x809021, 0xafb3001c, 0xa09821,
-0xafb10014, 0xc08821, 0xafb00010, 0x8021,
-0xafbf0020, 0xa6200000, 0xc004d4b, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc004d4b, 0x2021, 0xc004d4b, 0x24040001,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0x24100010, 0x2501024, 0x10400002, 0x2021,
-0x24040001, 0xc004d4b, 0x108042, 0x1600fffa,
-0x2501024, 0x24100010, 0x2701024, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fffa, 0x2701024, 0xc004d71, 0x34108000,
-0xc004d71, 0x0, 0xc004d2b, 0x0,
-0x50400005, 0x108042, 0x96220000, 0x501025,
-0xa6220000, 0x108042, 0x1600fff7, 0x0,
-0xc004d71, 0x0, 0x8fbf0020, 0x8fb3001c,
-0x8fb20018, 0x8fb10014, 0x8fb00010, 0x3e00008,
-0x27bd0028, 0x27bdffd8, 0xafb10014, 0x808821,
-0xafb20018, 0xa09021, 0xafb3001c, 0xc09821,
-0xafb00010, 0x8021, 0xafbf0020, 0xc004d4b,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0x24100010, 0x2301024, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fffa, 0x2301024, 0x24100010, 0x2501024,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x2501024, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0x34108000,
-0x96620000, 0x501024, 0x10400002, 0x2021,
-0x24040001, 0xc004d4b, 0x108042, 0x1600fff8,
-0x0, 0xc004d71, 0x0, 0x8fbf0020,
-0x8fb3001c, 0x8fb20018, 0x8fb10014, 0x8fb00010,
-0x3e00008, 0x27bd0028, 0x3c030001, 0x8c635d00,
-0x3c020001, 0x8c425d48, 0x27bdffd8, 0xafbf0020,
-0xafb1001c, 0x10620003, 0xafb00018, 0x3c010001,
-0xac235d48, 0x2463ffff, 0x2c620013, 0x10400349,
-0x31080, 0x3c010001, 0x220821, 0x8c225b30,
-0x400008, 0x0, 0xc004d71, 0x8021,
-0x34028000, 0xa7a20010, 0x27b10010, 0xc004d4b,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0x24100010, 0x32020001, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fffa, 0x32020001, 0x24100010, 0xc004d4b,
-0x2021, 0x108042, 0x1600fffc, 0x0,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0x34108000, 0x96220000, 0x501024, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fff8, 0x0, 0xc004d71, 0x0,
-0x8004d24, 0x24020002, 0x27b10010, 0xa7a00010,
-0x8021, 0xc004d4b, 0x24040001, 0x26100001,
-0x2e020020, 0x1440fffb, 0x0, 0xc004d4b,
-0x2021, 0xc004d4b, 0x24040001, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0x24100010,
-0x32020001, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020001,
-0x24100010, 0xc004d4b, 0x2021, 0x108042,
-0x1600fffc, 0x0, 0xc004d71, 0x34108000,
-0xc004d71, 0x0, 0xc004d2b, 0x0,
-0x50400005, 0x108042, 0x96220000, 0x501025,
-0xa6220000, 0x108042, 0x1600fff7, 0x0,
-0xc004d71, 0x0, 0x97a20010, 0x30428000,
-0x144002dc, 0x24020003, 0x8004d24, 0x0,
-0x24021200, 0xa7a20010, 0x27b10010, 0x8021,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0xc004d4b, 0x2021, 0x108042, 0x1600fffc,
-0x0, 0xc004d4b, 0x24040001, 0xc004d4b,
-0x2021, 0x34108000, 0x96220000, 0x501024,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fff8, 0x0, 0xc004d71,
-0x0, 0x8f830054, 0x8004d16, 0x24020004,
-0x8f830054, 0x3c020001, 0x8c425db8, 0x2463ff9c,
-0x431023, 0x2c420064, 0x1440029e, 0x24020002,
-0x3c030001, 0x8c635dbc, 0x10620297, 0x2c620003,
-0x14400296, 0x24020011, 0x24020003, 0x10620005,
-0x24020004, 0x10620291, 0x2402000f, 0x8004d24,
-0x24020011, 0x8004d24, 0x24020005, 0x24020014,
-0xa7a20010, 0x27b10010, 0x8021, 0xc004d4b,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0x24100010, 0x32020001, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fffa, 0x32020001, 0x24100010, 0x32020012,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020012, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0x34108000,
-0x96220000, 0x501024, 0x10400002, 0x2021,
-0x24040001, 0xc004d4b, 0x108042, 0x1600fff8,
-0x0, 0xc004d71, 0x0, 0x8f830054,
-0x8004d16, 0x24020006, 0x8f830054, 0x3c020001,
-0x8c425db8, 0x2463ff9c, 0x431023, 0x2c420064,
-0x14400250, 0x24020007, 0x8004d24, 0x0,
-0x24020006, 0xa7a20010, 0x27b10010, 0x8021,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020013, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020013,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0x34108000, 0x96220000, 0x501024, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fff8, 0x0, 0xc004d71, 0x0,
-0x8f830054, 0x8004d16, 0x24020008, 0x8f830054,
-0x3c020001, 0x8c425db8, 0x2463ff9c, 0x431023,
-0x2c420064, 0x1440020f, 0x24020009, 0x8004d24,
-0x0, 0x27b10010, 0xa7a00010, 0x8021,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x24040001,
-0xc004d4b, 0x2021, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020018, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020018,
-0xc004d71, 0x34108000, 0xc004d71, 0x0,
-0xc004d2b, 0x0, 0x50400005, 0x108042,
-0x96220000, 0x501025, 0xa6220000, 0x108042,
-0x1600fff7, 0x0, 0xc004d71, 0x8021,
-0x97a20010, 0x27b10010, 0x34420001, 0xa7a20010,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020018, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020018,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0x34108000, 0x96220000, 0x501024, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fff8, 0x0, 0xc004d71, 0x0,
-0x8f830054, 0x8004d16, 0x2402000a, 0x8f830054,
-0x3c020001, 0x8c425db8, 0x2463ff9c, 0x431023,
-0x2c420064, 0x1440019b, 0x2402000b, 0x8004d24,
-0x0, 0x27b10010, 0xa7a00010, 0x8021,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x24040001,
-0xc004d4b, 0x2021, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020017, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020017,
-0xc004d71, 0x34108000, 0xc004d71, 0x0,
-0xc004d2b, 0x0, 0x50400005, 0x108042,
-0x96220000, 0x501025, 0xa6220000, 0x108042,
-0x1600fff7, 0x0, 0xc004d71, 0x8021,
-0x97a20010, 0x27b10010, 0x34420700, 0xa7a20010,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020017, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020017,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0x34108000, 0x96220000, 0x501024, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fff8, 0x0, 0xc004d71, 0x0,
-0x8f830054, 0x8004d16, 0x2402000c, 0x8f830054,
-0x3c020001, 0x8c425db8, 0x2463ff9c, 0x431023,
-0x2c420064, 0x14400127, 0x24020012, 0x8004d24,
-0x0, 0x27b10010, 0xa7a00010, 0x8021,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x24040001,
-0xc004d4b, 0x2021, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020014, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020014,
-0xc004d71, 0x34108000, 0xc004d71, 0x0,
-0xc004d2b, 0x0, 0x50400005, 0x108042,
-0x96220000, 0x501025, 0xa6220000, 0x108042,
-0x1600fff7, 0x0, 0xc004d71, 0x8021,
-0x97a20010, 0x27b10010, 0x34420010, 0xa7a20010,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020014, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020014,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0x34108000, 0x96220000, 0x501024, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fff8, 0x0, 0xc004d71, 0x0,
-0x8f830054, 0x8004d16, 0x24020013, 0x8f830054,
-0x3c020001, 0x8c425db8, 0x2463ff9c, 0x431023,
-0x2c420064, 0x144000b3, 0x2402000d, 0x8004d24,
-0x0, 0x27b10010, 0xa7a00010, 0x8021,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x24040001,
-0xc004d4b, 0x2021, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020018, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020018,
-0xc004d71, 0x34108000, 0xc004d71, 0x0,
-0xc004d2b, 0x0, 0x50400005, 0x108042,
-0x96220000, 0x501025, 0xa6220000, 0x108042,
-0x1600fff7, 0x0, 0xc004d71, 0x8021,
-0x97a20010, 0x27b10010, 0x3042fffe, 0xa7a20010,
-0xc004d4b, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0xc004d4b, 0x24040001, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020018, 0x10400002, 0x2021, 0x24040001,
-0xc004d4b, 0x108042, 0x1600fffa, 0x32020018,
-0xc004d4b, 0x24040001, 0xc004d4b, 0x2021,
-0x34108000, 0x96220000, 0x501024, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fff8, 0x0, 0xc004d71, 0x0,
-0x8f830054, 0x8004d16, 0x2402000e, 0x24020840,
-0xa7a20010, 0x27b10010, 0x8021, 0xc004d4b,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0x24100010, 0x32020001, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fffa, 0x32020001, 0x24100010, 0x32020013,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x32020013, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0x34108000,
-0x96220000, 0x501024, 0x10400002, 0x2021,
-0x24040001, 0xc004d4b, 0x108042, 0x1600fff8,
-0x0, 0xc004d71, 0x0, 0x8f830054,
-0x24020010, 0x3c010001, 0xac225d00, 0x3c010001,
-0x8004d26, 0xac235db8, 0x8f830054, 0x3c020001,
-0x8c425db8, 0x2463ff9c, 0x431023, 0x2c420064,
-0x14400004, 0x0, 0x24020011, 0x3c010001,
-0xac225d00, 0x8fbf0020, 0x8fb1001c, 0x8fb00018,
-0x3e00008, 0x27bd0028, 0x8f850044, 0x8f820044,
-0x3c030001, 0x431025, 0x3c030008, 0xaf820044,
-0x8f840054, 0x8f820054, 0xa32824, 0x8004d37,
-0x24840001, 0x8f820054, 0x821023, 0x2c420002,
-0x1440fffc, 0x0, 0x8f820044, 0x3c03fffe,
-0x3463ffff, 0x431024, 0xaf820044, 0x8f830054,
-0x8f820054, 0x8004d45, 0x24630001, 0x8f820054,
-0x621023, 0x2c420002, 0x1440fffc, 0x0,
-0x3e00008, 0xa01021, 0x8f830044, 0x3c02fff0,
-0x3442ffff, 0x42480, 0x621824, 0x3c020002,
-0x822025, 0x641825, 0xaf830044, 0x8f820044,
-0x3c03fffe, 0x3463ffff, 0x431024, 0xaf820044,
-0x8f830054, 0x8f820054, 0x8004d5e, 0x24630001,
-0x8f820054, 0x621023, 0x2c420002, 0x1440fffc,
-0x0, 0x8f820044, 0x3c030001, 0x431025,
-0xaf820044, 0x8f830054, 0x8f820054, 0x8004d6b,
-0x24630001, 0x8f820054, 0x621023, 0x2c420002,
-0x1440fffc, 0x0, 0x3e00008, 0x0,
-0x8f820044, 0x3c03fff0, 0x3463ffff, 0x431024,
-0xaf820044, 0x8f820044, 0x3c030001, 0x431025,
-0xaf820044, 0x8f830054, 0x8f820054, 0x8004d7f,
-0x24630001, 0x8f820054, 0x621023, 0x2c420002,
-0x1440fffc, 0x0, 0x8f820044, 0x3c03fffe,
-0x3463ffff, 0x431024, 0xaf820044, 0x8f830054,
-0x8f820054, 0x8004d8d, 0x24630001, 0x8f820054,
-0x621023, 0x2c420002, 0x1440fffc, 0x0,
-0x3e00008, 0x0, 0x27bdffc8, 0xafb30024,
-0x809821, 0xafb5002c, 0xa0a821, 0xafb20020,
-0xc09021, 0x32a2ffff, 0xafbf0030, 0xafb40028,
-0xafb1001c, 0xafb00018, 0x14400034, 0xa7b20010,
-0x3271ffff, 0x27b20010, 0x8021, 0xc004d4b,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0x24100010, 0x32020001, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fffa, 0x32020001, 0x24100010, 0x2301024,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x2301024, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0x34108000,
-0x96420000, 0x501024, 0x10400002, 0x2021,
-0x24040001, 0xc004d4b, 0x108042, 0x12000075,
-0x0, 0x8004dc9, 0x0, 0x3274ffff,
-0x27b10010, 0xa7a00010, 0x8021, 0xc004d4b,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x24040001, 0xc004d4b,
-0x2021, 0x24100010, 0x32020001, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fffa, 0x32020001, 0x24100010, 0x2901024,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x2901024, 0xc004d71,
-0x34108000, 0xc004d71, 0x0, 0xc004d2b,
-0x0, 0x50400005, 0x108042, 0x96220000,
-0x501025, 0xa6220000, 0x108042, 0x1600fff7,
-0x0, 0xc004d71, 0x0, 0x32a5ffff,
-0x24020001, 0x54a20004, 0x24020002, 0x97a20010,
-0x8004e14, 0x521025, 0x14a20006, 0x3271ffff,
-0x97a20010, 0x121827, 0x431024, 0xa7a20010,
-0x3271ffff, 0x27b20010, 0x8021, 0xc004d4b,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0xc004d4b,
-0x24040001, 0x24100010, 0x32020001, 0x10400002,
-0x2021, 0x24040001, 0xc004d4b, 0x108042,
-0x1600fffa, 0x32020001, 0x24100010, 0x2301024,
-0x10400002, 0x2021, 0x24040001, 0xc004d4b,
-0x108042, 0x1600fffa, 0x2301024, 0xc004d4b,
-0x24040001, 0xc004d4b, 0x2021, 0x34108000,
-0x96420000, 0x501024, 0x10400002, 0x2021,
-0x24040001, 0xc004d4b, 0x108042, 0x1600fff8,
-0x0, 0xc004d71, 0x0, 0x8fbf0030,
-0x8fb5002c, 0x8fb40028, 0x8fb30024, 0x8fb20020,
-0x8fb1001c, 0x8fb00018, 0x3e00008, 0x27bd0038,
-0x0, 0x0, 0x0, 0x27bdffe8,
-0xafbf0010, 0x3c030001, 0x771821, 0x8c6383ac,
-0x24020008, 0x1462022c, 0x803021, 0x3c020001,
-0x8c425d98, 0x14400033, 0x0, 0x8f850224,
-0x38a30020, 0x2c630001, 0x38a20010, 0x2c420001,
-0x621825, 0x1460000d, 0x38a30030, 0x2c630001,
-0x38a20400, 0x2c420001, 0x621825, 0x14600007,
-0x38a30402, 0x2c630001, 0x38a20404, 0x2c420001,
-0x621825, 0x10600005, 0x0, 0xc00429b,
-0x0, 0x8004e8d, 0x2402000e, 0xc0043dd,
-0x0, 0x3c050001, 0x8ca55cc8, 0xc0052a2,
-0x2021, 0x3c030001, 0x8c635cc8, 0x24020004,
-0x14620005, 0x2403fffb, 0x3c020001, 0x8c425cc4,
-0x8004e89, 0x2403fff7, 0x3c020001, 0x8c425cc4,
-0x431024, 0x3c010001, 0xac225cc4, 0x2402000e,
-0x3c010001, 0xc00429b, 0xac227dd0, 0x8005087,
-0x0, 0x8f820220, 0x3c030400, 0x431024,
-0x10400027, 0x2403ffbf, 0x8f850224, 0x3c020001,
-0x8c427ddc, 0xa32024, 0x431024, 0x1482000c,
-0x0, 0x3c020001, 0x8c427de0, 0x24420001,
-0x3c010001, 0xac227de0, 0x2c420002, 0x14400008,
-0x24020001, 0x3c010001, 0x8004ead, 0xac227e00,
-0x3c010001, 0xac207de0, 0x3c010001, 0xac207e00,
-0x3c020001, 0x8c427e00, 0x10400006, 0x30a20040,
-0x10400004, 0x24020001, 0x3c010001, 0x8004eb8,
-0xac227e04, 0x3c010001, 0xac207e04, 0x3c010001,
-0xac257ddc, 0x3c010001, 0x8004ec8, 0xac207e10,
-0x24020001, 0x3c010001, 0xac227e10, 0x3c010001,
-0xac207e00, 0x3c010001, 0xac207de0, 0x3c010001,
-0xac207e04, 0x3c010001, 0xac207ddc, 0x3c030001,
-0x8c637dd0, 0x3c020001, 0x8c427dd4, 0x10620003,
-0x3c020200, 0x3c010001, 0xac237dd4, 0xc21024,
-0x10400007, 0x2463ffff, 0x8f820220, 0x24030001,
-0x3c010001, 0xac235ccc, 0x8005085, 0x3c03f700,
-0x2c62000e, 0x104001a8, 0x31080, 0x3c010001,
-0x220821, 0x8c225b80, 0x400008, 0x0,
-0x3c010001, 0xac207e00, 0x3c010001, 0xac207de0,
-0x3c010001, 0xac207ddc, 0x3c010001, 0xac207e04,
-0x3c010001, 0xac207df8, 0x3c010001, 0xac207df0,
-0xc00486a, 0xaf800224, 0x24020002, 0x3c010001,
-0xac227dd0, 0x3c020001, 0x8c427e10, 0x14400056,
-0x3c03fdff, 0x8ee20000, 0x3463ffff, 0x431024,
-0xc00429b, 0xaee20000, 0xaf800204, 0x8f820200,
-0x2403fffd, 0x431024, 0xaf820200, 0x3c010001,
-0xac207e20, 0x8f830054, 0x3c020001, 0x8c427df8,
-0x24040001, 0x3c010001, 0xac247e0c, 0x24420001,
-0x3c010001, 0xac227df8, 0x2c420004, 0x3c010001,
-0xac237df4, 0x14400006, 0x24020003, 0x3c010001,
-0xac245ccc, 0x3c010001, 0x8005083, 0xac207df8,
-0x3c010001, 0x8005083, 0xac227dd0, 0x8f830054,
-0x3c020001, 0x8c427df4, 0x2463d8f0, 0x431023,
-0x2c422710, 0x14400003, 0x24020004, 0x3c010001,
-0xac227dd0, 0x3c020001, 0x8c427e10, 0x14400026,
-0x3c03fdff, 0x8ee20000, 0x3463ffff, 0x431024,
-0x8005083, 0xaee20000, 0x3c040001, 0x8c845d9c,
-0x3c010001, 0xc00508a, 0xac207de8, 0x3c020001,
-0x8c427e1c, 0xaf820204, 0x3c020001, 0x8c427e10,
-0x14400015, 0x3c03fdff, 0x8ee20000, 0x3463ffff,
-0x431024, 0xaee20000, 0x8f820204, 0x30420030,
-0x1440013c, 0x24020002, 0x3c030001, 0x8c637e1c,
-0x24020005, 0x3c010001, 0xac227dd0, 0x3c010001,
-0x8005083, 0xac237e20, 0x3c020001, 0x8c427e10,
-0x10400010, 0x3c03fdff, 0x3c020001, 0x8c425d6c,
-0x24420001, 0x3c010001, 0xac225d6c, 0x2c420002,
-0x14400131, 0x24020001, 0x3c010001, 0xac225d74,
-0x3c010001, 0xac205d6c, 0x3c010001, 0x8005083,
-0xac225ccc, 0x8ee20000, 0x3463ffff, 0x431024,
-0xaee20000, 0x3c020001, 0x8c427e00, 0x10400122,
-0x0, 0x3c020001, 0x8c427ddc, 0x1040011e,
-0x0, 0x3c010001, 0xac227e08, 0x24020003,
-0x3c010001, 0xac227de0, 0x8005024, 0x24020006,
-0x3c010001, 0xac207de8, 0x8f820204, 0x34420040,
-0xaf820204, 0x3c020001, 0x8c427e20, 0x24030007,
-0x3c010001, 0xac237dd0, 0x34420040, 0x3c010001,
-0xac227e20, 0x3c020001, 0x8c427e00, 0x10400005,
-0x0, 0x3c020001, 0x8c427ddc, 0x104000f9,
-0x24020002, 0x3c050001, 0x24a57de0, 0x8ca20000,
-0x2c424e21, 0x104000f3, 0x24020002, 0x3c020001,
-0x8c427e04, 0x104000f8, 0x2404ffbf, 0x3c020001,
-0x8c427ddc, 0x3c030001, 0x8c637e08, 0x441024,
-0x641824, 0x10430004, 0x24020001, 0x3c010001,
-0x8005083, 0xac227dd0, 0x24020003, 0xaca20000,
-0x24020008, 0x3c010001, 0xac227dd0, 0x3c020001,
-0x8c427e0c, 0x1040000c, 0x24020001, 0x3c040001,
-0xc005097, 0x8c847ddc, 0x3c020001, 0x8c427e28,
-0x14400005, 0x24020001, 0x3c020001, 0x8c427e24,
-0x10400006, 0x24020001, 0x3c010001, 0xac225ccc,
-0x3c010001, 0x8005083, 0xac207df8, 0x3c020001,
-0x8c427df0, 0x3c030001, 0x8c637ddc, 0x2c420001,
-0x210c0, 0x30630008, 0x3c010001, 0xac227df0,
-0x3c010001, 0xac237dec, 0x8f830054, 0x24020009,
-0x3c010001, 0xac227dd0, 0x3c010001, 0x8005083,
-0xac237df4, 0x8f830054, 0x3c020001, 0x8c427df4,
-0x2463d8f0, 0x431023, 0x2c422710, 0x144000a8,
-0x0, 0x3c020001, 0x8c427e00, 0x10400005,
-0x0, 0x3c020001, 0x8c427ddc, 0x104000a9,
-0x24020002, 0x3c030001, 0x24637de0, 0x8c620000,
-0x2c424e21, 0x104000a3, 0x24020002, 0x3c020001,
-0x8c427e0c, 0x1040000e, 0x0, 0x3c020001,
-0x8c427ddc, 0x3c010001, 0xac207e0c, 0x30420080,
-0x1040002f, 0x2402000c, 0x8f820204, 0x30420080,
-0x1440000c, 0x24020003, 0x8005011, 0x2402000c,
-0x3c020001, 0x8c427ddc, 0x30420080, 0x14400005,
-0x24020003, 0x8f820204, 0x30420080, 0x1040001f,
-0x24020003, 0xac620000, 0x2402000a, 0x3c010001,
-0xac227dd0, 0x3c040001, 0x24847e18, 0x8c820000,
-0x3c030001, 0x8c637df0, 0x431025, 0xaf820204,
-0x8c830000, 0x3c040001, 0x8c847df0, 0x2402000b,
-0x3c010001, 0xac227dd0, 0x641825, 0x3c010001,
-0xac237e20, 0x3c050001, 0x24a57de0, 0x8ca20000,
-0x2c424e21, 0x1040006f, 0x24020002, 0x3c020001,
-0x8c427e10, 0x10400005, 0x0, 0x2402000c,
-0x3c010001, 0x8005083, 0xac227dd0, 0x3c020001,
-0x8c427e00, 0x1040006c, 0x0, 0x3c040001,
-0x8c847ddc, 0x1080005e, 0x30820008, 0x3c030001,
-0x8c637dec, 0x10620064, 0x24020003, 0x3c010001,
-0xac247e08, 0xaca20000, 0x24020006, 0x3c010001,
-0x8005083, 0xac227dd0, 0x8f820200, 0x34420002,
-0xaf820200, 0x8f830054, 0x2402000d, 0x3c010001,
-0xac227dd0, 0x3c010001, 0xac237df4, 0x8f830054,
-0x3c020001, 0x8c427df4, 0x2463d8f0, 0x431023,
-0x2c422710, 0x1440003a, 0x0, 0x3c020001,
-0x8c427e10, 0x10400029, 0x2402000e, 0x3c030001,
-0x8c637e24, 0x3c010001, 0x14600015, 0xac227dd0,
-0xc0043dd, 0x0, 0x3c050001, 0x8ca55cc8,
-0xc0052a2, 0x2021, 0x3c030001, 0x8c635cc8,
-0x24020004, 0x14620005, 0x2403fffb, 0x3c020001,
-0x8c425cc4, 0x8005052, 0x2403fff7, 0x3c020001,
-0x8c425cc4, 0x431024, 0x3c010001, 0xac225cc4,
-0x8ee20000, 0x3c030200, 0x431025, 0xaee20000,
-0x8f820224, 0x3c010001, 0xac227e2c, 0x8f820220,
-0x2403fffb, 0x431024, 0xaf820220, 0x8f820220,
-0x34420002, 0x8005083, 0xaf820220, 0x3c020001,
-0x8c427e00, 0x10400005, 0x0, 0x3c020001,
-0x8c427ddc, 0x1040000f, 0x24020002, 0x3c020001,
-0x8c427de0, 0x2c424e21, 0x1040000a, 0x24020002,
-0x3c020001, 0x8c427e00, 0x1040000f, 0x0,
-0x3c020001, 0x8c427ddc, 0x1440000b, 0x0,
-0x24020002, 0x3c010001, 0x8005083, 0xac227dd0,
-0x3c020001, 0x8c427e00, 0x10400003, 0x0,
-0xc00429b, 0x0, 0x8f820220, 0x3c03f700,
-0x431025, 0xaf820220, 0x8fbf0010, 0x3e00008,
-0x27bd0018, 0x3c030001, 0x24637e28, 0x8c620000,
-0x10400005, 0x34422000, 0x3c010001, 0xac227e1c,
-0x8005095, 0xac600000, 0x3c010001, 0xac247e1c,
-0x3e00008, 0x0, 0x27bdffe0, 0x30820030,
-0xafbf0018, 0x3c010001, 0xac227e24, 0x14400067,
-0x3c02ffff, 0x34421f0e, 0x821024, 0x14400061,
-0x24020030, 0x30822000, 0x1040005d, 0x30838000,
-0x31a02, 0x30820001, 0x21200, 0x3c040001,
-0x8c845d9c, 0x621825, 0x331c2, 0x3c030001,
-0x24635d78, 0x30828000, 0x21202, 0x30840001,
-0x42200, 0x441025, 0x239c2, 0x61080,
-0x431021, 0x471021, 0x90430000, 0x24020001,
-0x10620025, 0x0, 0x10600007, 0x24020002,
-0x10620013, 0x24020003, 0x1062002c, 0x3c05000f,
-0x80050f9, 0x0, 0x8f820200, 0x2403feff,
-0x431024, 0xaf820200, 0x8f820220, 0x3c03fffe,
-0x3463ffff, 0x431024, 0xaf820220, 0x3c010001,
-0xac207e44, 0x3c010001, 0x8005104, 0xac207e4c,
-0x8f820200, 0x34420100, 0xaf820200, 0x8f820220,
-0x3c03fffe, 0x3463ffff, 0x431024, 0xaf820220,
-0x24020100, 0x3c010001, 0xac227e44, 0x3c010001,
-0x8005104, 0xac207e4c, 0x8f820200, 0x2403feff,
-0x431024, 0xaf820200, 0x8f820220, 0x3c030001,
-0x431025, 0xaf820220, 0x3c010001, 0xac207e44,
-0x3c010001, 0x8005104, 0xac237e4c, 0x8f820200,
-0x34420100, 0xaf820200, 0x8f820220, 0x3c030001,
-0x431025, 0xaf820220, 0x24020100, 0x3c010001,
-0xac227e44, 0x3c010001, 0x8005104, 0xac237e4c,
-0x34a5ffff, 0x3c040001, 0x24845bb8, 0xafa30010,
-0xc002403, 0xafa00014, 0x8005104, 0x0,
-0x24020030, 0x3c010001, 0xac227e28, 0x8fbf0018,
-0x3e00008, 0x27bd0020, 0x0, 0x27bdffc8,
-0xafb20028, 0x809021, 0xafb3002c, 0xa09821,
-0xafb00020, 0xc08021, 0x3c040001, 0x24845bd0,
-0x3c050009, 0x3c020001, 0x8c425cc8, 0x34a59001,
-0x2403021, 0x2603821, 0xafbf0030, 0xafb10024,
-0xa7a0001a, 0xafb00014, 0xc002403, 0xafa20010,
-0x24020002, 0x12620083, 0x2e620003, 0x10400005,
-0x24020001, 0x1262000a, 0x0, 0x800529b,
-0x0, 0x24020004, 0x126200fa, 0x24020008,
-0x126200f9, 0x3c02ffec, 0x800529b, 0x0,
-0x3c020001, 0x8c425cc4, 0x30420002, 0x14400004,
-0x128940, 0x3c02fffb, 0x3442ffff, 0x2028024,
-0x3c010001, 0x310821, 0xac307e3c, 0x3c024000,
-0x2021024, 0x1040004e, 0x1023c2, 0x30840030,
-0x101382, 0x3042001c, 0x3c030001, 0x24635d08,
-0x431021, 0x823821, 0x3c020020, 0x2021024,
-0x10400006, 0x24020100, 0x3c010001, 0x310821,
-0xac227e40, 0x8005150, 0x3c020080, 0x3c010001,
-0x310821, 0xac207e40, 0x3c020080, 0x2021024,
-0x10400006, 0x121940, 0x3c020001, 0x3c010001,
-0x230821, 0x800515c, 0xac227e48, 0x121140,
-0x3c010001, 0x220821, 0xac207e48, 0x94e40000,
-0x3c030001, 0x8c635dbc, 0x24020005, 0x10620010,
-0xa7a40018, 0x32024000, 0x10400002, 0x34824000,
-0xa7a20018, 0x24040001, 0x94e20002, 0x24050004,
-0x24e60002, 0x34420001, 0xc00498e, 0xa4e20002,
-0x24040001, 0x2821, 0xc00498e, 0x27a60018,
-0x3c020001, 0x8c425cc8, 0x24110001, 0x3c010001,
-0xac315cd4, 0x14530004, 0x32028000, 0xc00429b,
-0x0, 0x32028000, 0x1040011f, 0x0,
-0xc00429b, 0x0, 0x3c030001, 0x8c635dbc,
-0x24020005, 0x10620118, 0x24020002, 0x3c010001,
-0xac315ccc, 0x3c010001, 0x800529b, 0xac225cc8,
-0x24040001, 0x24050004, 0x27b0001a, 0xc00498e,
-0x2003021, 0x24040001, 0x2821, 0xc00498e,
-0x2003021, 0x3c020001, 0x511021, 0x8c427e34,
-0x3c040001, 0x8c845cc8, 0x3c03bfff, 0x3463ffff,
-0x3c010001, 0xac335cd4, 0x431024, 0x3c010001,
-0x310821, 0x109300fa, 0xac227e34, 0x800529b,
-0x0, 0x3c022000, 0x2021024, 0x10400005,
-0x24020001, 0x3c010001, 0xac225d98, 0x80051ad,
-0x128940, 0x3c010001, 0xac205d98, 0x128940,
-0x3c010001, 0x310821, 0xac307e38, 0x3c024000,
-0x2021024, 0x14400016, 0x0, 0x3c020001,
-0x8c425d98, 0x10400008, 0x24040004, 0x24050001,
-0xc004d93, 0x24062000, 0x24020001, 0x3c010001,
-0x370821, 0xac2283ac, 0x3c020001, 0x511021,
-0x8c427e30, 0x3c03bfff, 0x3463ffff, 0x431024,
-0x3c010001, 0x310821, 0x8005299, 0xac227e30,
-0x3c020001, 0x8c425d98, 0x10400028, 0x3c0300a0,
-0x2031024, 0x5443000d, 0x3c020020, 0x3c020001,
-0x8c425d9c, 0x24030100, 0x3c010001, 0x310821,
-0xac237e44, 0x3c030001, 0x3c010001, 0x310821,
-0xac237e4c, 0x80051f0, 0x34420400, 0x2021024,
-0x10400008, 0x24030100, 0x3c020001, 0x8c425d9c,
-0x3c010001, 0x310821, 0xac237e44, 0x80051f0,
-0x34420800, 0x3c020080, 0x2021024, 0x1040002e,
-0x3c030001, 0x3c020001, 0x8c425d9c, 0x3c010001,
-0x310821, 0xac237e4c, 0x34420c00, 0x3c010001,
-0xac225d9c, 0x8005218, 0x24040001, 0x3c020020,
-0x2021024, 0x10400006, 0x24020100, 0x3c010001,
-0x310821, 0xac227e44, 0x8005201, 0x3c020080,
-0x3c010001, 0x310821, 0xac207e44, 0x3c020080,
-0x2021024, 0x10400007, 0x121940, 0x3c020001,
-0x3c010001, 0x230821, 0xac227e4c, 0x800520f,
-0x24040001, 0x121140, 0x3c010001, 0x220821,
-0xac207e4c, 0x24040001, 0x2821, 0x27b0001e,
-0xc00494c, 0x2003021, 0x24040001, 0x2821,
-0xc00494c, 0x2003021, 0x24040001, 0x24050001,
-0x27b0001c, 0xc00494c, 0x2003021, 0x24040001,
-0x24050001, 0xc00494c, 0x2003021, 0x8005299,
-0x0, 0x3c02ffec, 0x3442ffff, 0x2028024,
-0x3c020008, 0x2028025, 0x121140, 0x3c010001,
-0x220821, 0xac307e38, 0x3c022000, 0x2021024,
-0x10400009, 0x0, 0x3c020001, 0x8c425d74,
-0x14400005, 0x24020001, 0x3c010001, 0xac225d98,
-0x800523a, 0x3c024000, 0x3c010001, 0xac205d98,
-0x3c024000, 0x2021024, 0x1440001e, 0x0,
-0x3c020001, 0x8c425d98, 0x3c010001, 0xac205ce0,
-0x10400007, 0x24022020, 0x3c010001, 0xac225d9c,
-0x24020001, 0x3c010001, 0x370821, 0xac2283ac,
-0x3c04bfff, 0x121940, 0x3c020001, 0x431021,
-0x8c427e30, 0x3c050001, 0x8ca55cc8, 0x3484ffff,
-0x441024, 0x3c010001, 0x230821, 0xac227e30,
-0x24020001, 0x10a20044, 0x0, 0x8005299,
-0x0, 0x3c020001, 0x8c425d98, 0x1040001c,
-0x24022000, 0x3c010001, 0xac225d9c, 0x3c0300a0,
-0x2031024, 0x14430005, 0x121140, 0x3402a000,
-0x3c010001, 0x8005294, 0xac225d9c, 0x3c030001,
-0x621821, 0x8c637e38, 0x3c020020, 0x621024,
-0x10400004, 0x24022001, 0x3c010001, 0x8005294,
-0xac225d9c, 0x3c020080, 0x621024, 0x1040001f,
-0x3402a001, 0x3c010001, 0x8005294, 0xac225d9c,
-0x3c020020, 0x2021024, 0x10400007, 0x121940,
-0x24020100, 0x3c010001, 0x230821, 0xac227e44,
-0x8005288, 0x3c020080, 0x121140, 0x3c010001,
-0x220821, 0xac207e44, 0x3c020080, 0x2021024,
-0x10400006, 0x121940, 0x3c020001, 0x3c010001,
-0x230821, 0x8005294, 0xac227e4c, 0x121140,
-0x3c010001, 0x220821, 0xac207e4c, 0x3c030001,
-0x8c635cc8, 0x24020001, 0x10620003, 0x0,
-0xc00429b, 0x0, 0x8fbf0030, 0x8fb3002c,
-0x8fb20028, 0x8fb10024, 0x8fb00020, 0x3e00008,
-0x27bd0038, 0x27bdffd8, 0xafb20020, 0x809021,
-0xafb1001c, 0x8821, 0x24020002, 0xafbf0024,
-0xafb00018, 0xa7a00012, 0x10a200d3, 0xa7a00010,
-0x2ca20003, 0x10400005, 0x24020001, 0x10a2000a,
-0x128140, 0x8005380, 0x2201021, 0x24020004,
-0x10a2007d, 0x24020008, 0x10a2007c, 0x122940,
-0x8005380, 0x2201021, 0x3c030001, 0x701821,
-0x8c637e3c, 0x3c024000, 0x621024, 0x14400009,
-0x24040001, 0x3c027fff, 0x3442ffff, 0x628824,
-0x3c010001, 0x300821, 0xac317e34, 0x8005380,
-0x2201021, 0x24050001, 0xc00494c, 0x27a60010,
-0x24040001, 0x24050001, 0xc00494c, 0x27a60010,
-0x97a20010, 0x30420004, 0x10400034, 0x3c114000,
-0x3c020001, 0x8c425dbc, 0x2443ffff, 0x2c620006,
-0x10400034, 0x31080, 0x3c010001, 0x220821,
-0x8c225be0, 0x400008, 0x0, 0x24040001,
-0x24050011, 0x27b00012, 0xc00494c, 0x2003021,
-0x24040001, 0x24050011, 0xc00494c, 0x2003021,
-0x97a50012, 0x30a24000, 0x10400002, 0x3c040010,
-0x3c040008, 0x3c030001, 0x8005301, 0x30a28000,
-0x24040001, 0x24050014, 0x27b00012, 0xc00494c,
-0x2003021, 0x24040001, 0x24050014, 0xc00494c,
-0x2003021, 0x97a50012, 0x30a21000, 0x10400002,
-0x3c040010, 0x3c040008, 0x3c030001, 0x30a20800,
-0x54400001, 0x3c030002, 0x3c028000, 0x2221025,
-0x641825, 0x800530e, 0x438825, 0x3c110001,
-0x2308821, 0x8e317e3c, 0x3c027fff, 0x3442ffff,
-0x2228824, 0x3c020001, 0x8c425cd8, 0x1040001d,
-0x121140, 0x3c020001, 0x8c425d98, 0x10400002,
-0x3c022000, 0x2228825, 0x121140, 0x3c010001,
-0x220821, 0x8c227e40, 0x10400003, 0x3c020020,
-0x8005322, 0x2228825, 0x3c02ffdf, 0x3442ffff,
-0x2228824, 0x121140, 0x3c010001, 0x220821,
-0x8c227e48, 0x10400003, 0x3c020080, 0x800532d,
-0x2228825, 0x3c02ff7f, 0x3442ffff, 0x2228824,
-0x121140, 0x3c010001, 0x220821, 0xac317e34,
-0x8005380, 0x2201021, 0x122940, 0x3c030001,
-0x651821, 0x8c637e38, 0x3c024000, 0x621024,
-0x14400008, 0x3c027fff, 0x3442ffff, 0x628824,
-0x3c010001, 0x250821, 0xac317e30, 0x8005380,
-0x2201021, 0x3c020001, 0x8c425cd8, 0x10400033,
-0x3c11c00c, 0x3c020001, 0x8c425d74, 0x3c04c00c,
-0x34842000, 0x3c030001, 0x8c635d98, 0x2102b,
-0x21023, 0x441024, 0x10600003, 0x518825,
-0x3c022000, 0x2228825, 0x3c020001, 0x451021,
-0x8c427e44, 0x10400003, 0x3c020020, 0x800535d,
-0x2228825, 0x3c02ffdf, 0x3442ffff, 0x2228824,
-0x121140, 0x3c010001, 0x220821, 0x8c227e4c,
-0x10400003, 0x3c020080, 0x8005368, 0x2228825,
-0x3c02ff7f, 0x3442ffff, 0x2228824, 0x3c020001,
-0x8c425d60, 0x10400002, 0x3c020800, 0x2228825,
-0x3c020001, 0x8c425d64, 0x10400002, 0x3c020400,
-0x2228825, 0x3c020001, 0x8c425d68, 0x10400006,
-0x3c020100, 0x800537b, 0x2228825, 0x3c027fff,
-0x3442ffff, 0x628824, 0x121140, 0x3c010001,
-0x220821, 0xac317e30, 0x2201021, 0x8fbf0024,
-0x8fb20020, 0x8fb1001c, 0x8fb00018, 0x3e00008,
-0x27bd0028, 0x27bdffd8, 0xafb40020, 0x80a021,
-0xafbf0024, 0xafb3001c, 0xafb20018, 0xafb10014,
-0xafb00010, 0x8f900200, 0x3c030001, 0x8c635cc8,
-0x8f930220, 0x24020002, 0x10620063, 0x2c620003,
-0x10400005, 0x24020001, 0x1062000a, 0x141940,
-0x8005448, 0x0, 0x24020004, 0x1062005a,
-0x24020008, 0x10620059, 0x149140, 0x8005448,
-0x0, 0x3c040001, 0x832021, 0x8c847e3c,
-0x3c110001, 0x2238821, 0x8e317e34, 0x3c024000,
-0x821024, 0x1040003e, 0x3c020008, 0x2221024,
-0x10400020, 0x36100002, 0x3c020001, 0x431021,
-0x8c427e40, 0x10400005, 0x36100020, 0x36100100,
-0x3c020020, 0x80053bd, 0x2228825, 0x2402feff,
-0x2028024, 0x3c02ffdf, 0x3442ffff, 0x2228824,
-0x141140, 0x3c010001, 0x220821, 0x8c227e48,
-0x10400005, 0x3c020001, 0x2629825, 0x3c020080,
-0x80053dc, 0x2228825, 0x3c02fffe, 0x3442ffff,
-0x2629824, 0x3c02ff7f, 0x3442ffff, 0x80053dc,
-0x2228824, 0x2402fedf, 0x2028024, 0x3c02fffe,
-0x3442ffff, 0x2629824, 0x3c02ff5f, 0x3442ffff,
-0x2228824, 0x3c010001, 0x230821, 0xac207e40,
-0x3c010001, 0x230821, 0xac207e48, 0xc00486a,
-0x0, 0xaf900200, 0xaf930220, 0x8f820220,
-0x2403fffb, 0x431024, 0xaf820220, 0x8f820220,
-0x34420002, 0xaf820220, 0x80053f3, 0x141140,
-0x8f820200, 0x2403fffd, 0x431024, 0xc00486a,
-0xaf820200, 0x3c02bfff, 0x3442ffff, 0xc00429b,
-0x2228824, 0x141140, 0x3c010001, 0x220821,
-0x8005448, 0xac317e34, 0x149140, 0x3c040001,
-0x922021, 0x8c847e38, 0x3c110001, 0x2328821,
-0x8e317e30, 0x3c024000, 0x821024, 0x14400011,
-0x0, 0x3c020001, 0x8c425d98, 0x14400006,
-0x3c02bfff, 0x8f820200, 0x34420002, 0xc00486a,
-0xaf820200, 0x3c02bfff, 0x3442ffff, 0xc00429b,
-0x2228824, 0x3c010001, 0x320821, 0x8005448,
-0xac317e30, 0x3c020001, 0x8c425d98, 0x10400005,
-0x3c020020, 0x3c020001, 0x8c425d74, 0x1040002b,
-0x3c020020, 0x821024, 0x10400007, 0x36100020,
-0x24020100, 0x3c010001, 0x320821, 0xac227e44,
-0x8005428, 0x36100100, 0x3c010001, 0x320821,
-0xac207e44, 0x2402feff, 0x2028024, 0x3c020080,
-0x821024, 0x10400007, 0x141940, 0x3c020001,
-0x3c010001, 0x230821, 0xac227e4c, 0x8005439,
-0x2629825, 0x141140, 0x3c010001, 0x220821,
-0xac207e4c, 0x3c02fffe, 0x3442ffff, 0x2629824,
-0xc00486a, 0x0, 0xaf900200, 0xaf930220,
-0x8f820220, 0x2403fffb, 0x431024, 0xaf820220,
-0x8f820220, 0x34420002, 0xaf820220, 0x141140,
-0x3c010001, 0x220821, 0xac317e30, 0x8fbf0024,
-0x8fb40020, 0x8fb3001c, 0x8fb20018, 0x8fb10014,
-0x8fb00010, 0x3e00008, 0x27bd0028, 0x0 };
-static u_int32_t tigonFwRodata[] = {
-0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f66776d, 0x61696e2e, 0x632c7620, 0x312e312e,
-0x322e3131, 0x20313939, 0x382f3034, 0x2f323720,
-0x32323a31, 0x333a3432, 0x20736875, 0x616e6720,
-0x45787020, 0x24000000, 0x7468655f, 0x4441574e,
-0x0, 0x53544143, 0x4b5f3120, 0x0,
-0x42616453, 0x6e64526e, 0x67000000, 0x3f456e71,
-0x45767400, 0x3f6e6f51, 0x64457650, 0x0,
-0x6576526e, 0x6746756c, 0x6c000000, 0x496c6c43,
-0x6f6e6652, 0x78000000, 0x53656e64, 0x436b5375,
-0x6d000000, 0x52656376, 0x566c616e, 0x0,
-0x0, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f74696d, 0x65722e63, 0x2c762031, 0x2e312e32,
-0x2e382031, 0x3939382f, 0x30372f33, 0x31203137,
-0x3a35383a, 0x34352073, 0x6875616e, 0x67204578,
-0x70202400, 0x542d446d, 0x61526431, 0x0,
-0x542d446d, 0x61424200, 0x542d446d, 0x61320000,
-0x3f6e6f51, 0x64547845, 0x0, 0x3f6e6f51,
-0x64527845, 0x0, 0x656e714d, 0x45765046,
-0x61696c00, 0x656e714d, 0x45764661, 0x696c0000,
-0x6661696c, 0x456e454d, 0x0, 0x3f456e71,
-0x45767400, 0x3f6e6f51, 0x64457650, 0x0,
-0x6576526e, 0x6746756c, 0x6c000000, 0x0,
-0x0, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f636f6d, 0x6d616e64, 0x2e632c76, 0x20312e31,
-0x2e322e31, 0x30203139, 0x39382f31, 0x312f3138,
-0x2031373a, 0x31313a31, 0x38207368, 0x75616e67,
-0x20457870, 0x20240000, 0x3f4d626f, 0x78457674,
-0x0, 0x4e4f636f, 0x6d616e64, 0x0,
-0x68737465, 0x5f455252, 0x0, 0x412d4572,
-0x72427563, 0x0, 0x4552524f, 0x522d4164,
-0x64000000, 0x656e714d, 0x45765046, 0x61696c00,
-0x656e714d, 0x45764661, 0x696c0000, 0x6661696c,
-0x456e454d, 0x0, 0x442d4572, 0x724c6173,
-0x74000000, 0x442d4572, 0x72320000, 0x6d437374,
-0x4d644552, 0x52000000, 0x70726f6d, 0x4d644552,
-0x52000000, 0x46696c74, 0x4d644552, 0x52000000,
-0x636d645f, 0x45525200, 0x3f456e71, 0x45767400,
-0x3f6e6f51, 0x64457650, 0x0, 0x6576526e,
-0x6746756c, 0x6c000000, 0x0, 0x6ea0,
-0x7fbc, 0x6e38, 0x8734, 0x82b0,
-0x8780, 0x8780, 0x6f54, 0x7694,
-0x7f0c, 0x80a8, 0x8074, 0x8780,
-0x7e70, 0x80cc, 0x6e64, 0x81cc,
-0x0, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f646d61, 0x2e632c76, 0x20312e31, 0x2e322e33,
-0x20313939, 0x382f3034, 0x2f323720, 0x32323a31,
-0x333a3431, 0x20736875, 0x616e6720, 0x45787020,
-0x24000000, 0x646d6172, 0x6441544e, 0x0,
-0x646d6177, 0x7241544e, 0x0, 0x0,
-0x0, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f747261, 0x63652e63, 0x2c762031, 0x2e312e32,
-0x2e322031, 0x3939382f, 0x30342f32, 0x37203232,
-0x3a31333a, 0x35302073, 0x6875616e, 0x67204578,
-0x70202400, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f646174, 0x612e632c, 0x7620312e, 0x312e322e,
-0x32203139, 0x39382f30, 0x342f3237, 0x2032323a,
-0x31333a34, 0x30207368, 0x75616e67, 0x20457870,
-0x20240000, 0x46575f56, 0x45525349, 0x4f4e3a20,
-0x23312046, 0x72692041, 0x70722037, 0x2031373a,
-0x35353a34, 0x38205044, 0x54203230, 0x30300000,
-0x46575f43, 0x4f4d5049, 0x4c455f54, 0x494d453a,
-0x2031373a, 0x35353a34, 0x38000000, 0x46575f43,
-0x4f4d5049, 0x4c455f42, 0x593a2064, 0x65767263,
-0x73000000, 0x46575f43, 0x4f4d5049, 0x4c455f48,
-0x4f53543a, 0x20636f6d, 0x70757465, 0x0,
-0x46575f43, 0x4f4d5049, 0x4c455f44, 0x4f4d4149,
-0x4e3a2065, 0x6e672e61, 0x6374656f, 0x6e2e636f,
-0x6d000000, 0x46575f43, 0x4f4d5049, 0x4c45523a,
-0x20676363, 0x20766572, 0x73696f6e, 0x20322e37,
-0x2e320000, 0x0, 0x0, 0x0,
-0x0, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f6d656d, 0x2e632c76, 0x20312e31, 0x2e322e32,
-0x20313939, 0x382f3034, 0x2f323720, 0x32323a31,
-0x333a3434, 0x20736875, 0x616e6720, 0x45787020,
-0x24000000, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f73656e, 0x642e632c, 0x7620312e, 0x312e322e,
-0x31312031, 0x3939382f, 0x31322f32, 0x32203137,
-0x3a31373a, 0x35352073, 0x6875616e, 0x67204578,
-0x70202400, 0x736e6464, 0x654e6f51, 0x20000000,
-0x6e6f454e, 0x515f5458, 0x0, 0x736e6464,
-0x744e6f51, 0x20000000, 0x3f6e6f51, 0x64547845,
-0x0, 0x756e6b72, 0x64747970, 0x65000000,
-0x0, 0xaccc, 0xaccc, 0xad9c,
-0xaab0, 0xaab0, 0xad9c, 0xad9c,
-0xad9c, 0xad9c, 0xad9c, 0xad9c,
-0xad9c, 0xad9c, 0xad9c, 0xad9c,
-0xad9c, 0xad9c, 0xad9c, 0xad7c,
-0x0, 0xbca8, 0xbca8, 0xbd70,
-0xae4c, 0xb058, 0xbd70, 0xbd70,
-0xbd70, 0xbd70, 0xbd70, 0xbd70,
-0xbd70, 0xbd70, 0xbd70, 0xbd70,
-0xbd70, 0xbd70, 0xbd70, 0xbd54,
-0xb040, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f726563, 0x762e632c, 0x7620312e, 0x312e322e,
-0x31392031, 0x3939382f, 0x30372f32, 0x34203231,
-0x3a33303a, 0x30352073, 0x6875616e, 0x67204578,
-0x70202400, 0x706b5278, 0x45525200, 0x66726d32,
-0x4c617267, 0x65000000, 0x72784e6f, 0x52784264,
-0x0, 0x72785144, 0x6d614446, 0x0,
-0x72785144, 0x6d614246, 0x0, 0x3f6e6f51,
-0x64527845, 0x0, 0x706b5278, 0x45525273,
-0x0, 0x66726d32, 0x4c726753, 0x0,
-0x72784e6f, 0x42645300, 0x3f724264, 0x446d6146,
-0x0, 0x3f724a42, 0x64446d46, 0x0,
-0x0, 0xf678, 0xf678, 0xf678,
-0xf678, 0xf678, 0xf678, 0xf678,
-0xf678, 0xf678, 0xf678, 0xf678,
-0xf678, 0xf678, 0xf678, 0xf678,
-0xf670, 0xf670, 0xf670, 0x572d444d,
-0x41456e46, 0x0, 0x0, 0xfdc0,
-0x1015c, 0xfddc, 0x1015c, 0x1015c,
-0x1015c, 0x1015c, 0x1015c, 0x1015c,
-0xf704, 0x1015c, 0x1015c, 0x1015c,
-0x1015c, 0x1015c, 0x10154, 0x10154,
-0x10154, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f6d6163, 0x2e632c76, 0x20312e31, 0x2e322e31,
-0x32203139, 0x39382f30, 0x342f3237, 0x2032323a,
-0x31333a34, 0x32207368, 0x75616e67, 0x20457870,
-0x20240000, 0x6d616374, 0x7841544e, 0x0,
-0x4e745379, 0x6e264c6b, 0x0, 0x72656d61,
-0x73737274, 0x0, 0x6c696e6b, 0x444f574e,
-0x0, 0x656e714d, 0x45765046, 0x61696c00,
-0x656e714d, 0x45764661, 0x696c0000, 0x6661696c,
-0x456e454d, 0x0, 0x6c696e6b, 0x55500000,
-0x0, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x772f636f, 0x6d6d6f6e,
-0x2f636b73, 0x756d2e63, 0x2c762031, 0x2e312e32,
-0x2e322031, 0x3939382f, 0x30342f32, 0x37203232,
-0x3a31333a, 0x33392073, 0x6875616e, 0x67204578,
-0x70202400, 0x50726f62, 0x65506879, 0x0,
-0x6c6e6b41, 0x53535254, 0x0, 0x11b2c,
-0x11bc4, 0x11bf8, 0x11c2c, 0x11c58,
-0x11c6c, 0x11ca8, 0x1207c, 0x11de4,
-0x11e24, 0x11e50, 0x11e90, 0x11ec0,
-0x11efc, 0x11f30, 0x1207c, 0x122c0,
-0x122d8, 0x12300, 0x12320, 0x12348,
-0x12478, 0x124a0, 0x124f4, 0x1251c,
-0x0, 0x1278c, 0x1285c, 0x12934,
-0x12a04, 0x12a60, 0x12b3c, 0x12b64,
-0x12c40, 0x12c68, 0x12e10, 0x12e38,
-0x12fe0, 0x131d8, 0x1346c, 0x13380,
-0x1346c, 0x13498, 0x13008, 0x131b0,
-0x0, 0x13b84, 0x13bc8, 0x13c60,
-0x13cac, 0x13d1c, 0x13db4, 0x13de8,
-0x13e70, 0x13f08, 0x13fd8, 0x14018,
-0x1409c, 0x140c0, 0x141f4, 0x646f4261,
-0x73655067, 0x0, 0x0, 0x0,
-0x0, 0x73746d61, 0x634c4e4b, 0x0,
-0x0, 0x14c38, 0x14c38, 0x14b80,
-0x14bc4, 0x14c38, 0x14c38, 0x0,
-0x0, 0x0 };
-static u_int32_t tigonFwData[] = {
-0x416c7465,
-0x6f6e2041, 0x63654e49, 0x43205600, 0x416c7465,
-0x6f6e2041, 0x63654e49, 0x43205600, 0x42424242,
-0x0, 0x0, 0x0, 0x135418,
-0x13e7fc, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x60cf00,
-0x60, 0xcf000000, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x3, 0x0,
-0x1, 0x0, 0x0, 0x0,
-0x1, 0x0, 0x1, 0x0,
-0x0, 0x0, 0x0, 0x1,
-0x1, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x1000000, 0x21000000,
-0x12000140, 0x0, 0x0, 0x20000000,
-0x120000a0, 0x0, 0x12000060, 0x12000180,
-0x120001e0, 0x0, 0x0, 0x0,
-0x1, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x2,
-0x0, 0x0, 0x30001, 0x1,
-0x30201, 0x0, 0x0, 0x0 };
diff --git a/sys/dev/ti/ti_fw2.h b/sys/dev/ti/ti_fw2.h
deleted file mode 100644
index e54c920..0000000
--- a/sys/dev/ti/ti_fw2.h
+++ /dev/null
@@ -1,5232 +0,0 @@
-/*
- * Generated by Ken's special genfw.c
- * Built on Wed Aug 2 17:21:09 MDT 2000 by ken@roadwarrior.plutotech.com
- * OS: FreeBSD 5.0-CURRENT
- * $FreeBSD$
- */
-static int tigon2FwReleaseMajor = 0xc;
-static int tigon2FwReleaseMinor = 0x4;
-static int tigon2FwReleaseFix = 0xb;
-static u_int32_t tigon2FwStartAddr = 0x00004000;
-static u_int32_t tigon2FwTextAddr = 0x00004000;
-int tigon2FwTextLen = 0x132f8;
-static u_int32_t tigon2FwRodataAddr = 0x000172f8;
-int tigon2FwRodataLen = 0x10da;
-static u_int32_t tigon2FwDataAddr = 0x000185c0;
-int tigon2FwDataLen = 0x17c;
-static u_int32_t tigon2FwSbssAddr = 0x0001873c;
-int tigon2FwSbssLen = 0xcc;
-static u_int32_t tigon2FwBssAddr = 0x00018810;
-int tigon2FwBssLen = 0x20c0;
-static u_int32_t tigon2FwText[] = {
-0x0,
-0x10000003, 0x0, 0xd, 0xd,
-0x3c1d0002, 0x8fbd8600, 0x3a0f021, 0x3c100000,
-0x26104000, 0xc001082, 0x0, 0xd,
-0x3c1d0002, 0x8fbd8604, 0x3a0f021, 0x3c100000,
-0x26104000, 0xc0018cc, 0x0, 0xd,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x2000008,
-0x0, 0x80017d9, 0x3c0a0001, 0x80017d9,
-0x3c0a0002, 0x80017d9, 0x0, 0x8002ec4,
-0x0, 0x8002e4e, 0x0, 0x80017d9,
-0x3c0a0004, 0x80035a3, 0x0, 0x8001b5a,
-0x0, 0x8003df3, 0x0, 0x8003d81,
-0x0, 0x80017d9, 0x3c0a0006, 0x8003e7a,
-0x3c0a0007, 0x80017d9, 0x3c0a0008, 0x80017d9,
-0x3c0a0009, 0x8003eeb, 0x0, 0x80030d9,
-0x0, 0x80017d9, 0x3c0a000b, 0x80017d9,
-0x3c0a000c, 0x80017d9, 0x3c0a000d, 0x8002af6,
-0x0, 0x8002a8a, 0x0, 0x80017d9,
-0x3c0a000e, 0x800219b, 0x0, 0x8001a69,
-0x0, 0x8001b0b, 0x0, 0x80041cb,
-0x0, 0x80041b9, 0x0, 0x80017d9,
-0x0, 0x8001a1f, 0x0, 0x80017d9,
-0x0, 0x80017d9, 0x3c0a0013, 0x80017d9,
-0x3c0a0014, 0x27bdffe0, 0x3c1cc000, 0xafbf001c,
-0xafb00018, 0x8f820140, 0x24030003, 0xaf8300ec,
-0x34420004, 0xaf820140, 0xc002d20, 0x0,
-0x3c0100c0, 0xac203ffc, 0xc00184f, 0x0,
-0x401821, 0x3c020010, 0x3c010002, 0xac238758,
-0x10620025, 0x43102b, 0x14400002, 0x3c020020,
-0x3c020008, 0x10620020, 0x24050100, 0x3c040001,
-0x248473ac, 0x3c060002, 0x8cc68758, 0x3821,
-0xafa00010, 0xc002d3b, 0xafa00014, 0x3c040001,
-0x248473b8, 0x24020256, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e773c0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f830140,
-0x3c020020, 0x3c010002, 0xac228758, 0x3c020001,
-0x621825, 0xaf830140, 0x24020008, 0x3c010002,
-0xac228770, 0x2402001f, 0x3c010002, 0xac228780,
-0x24020016, 0x3c010002, 0xac228754, 0x3c05fffe,
-0x34a56f08, 0x3c020002, 0x8c428758, 0x3c030002,
-0x2463a8d0, 0x3c040002, 0x8c8485c4, 0x431023,
-0x14800002, 0x458021, 0x2610fa38, 0x2402f000,
-0x2028024, 0xc001871, 0x2002021, 0x2022823,
-0x3c040020, 0x821823, 0x651823, 0x247bb000,
-0x3c03fffe, 0x3463bf08, 0x363b821, 0x3c0600bf,
-0x34c6f000, 0x3c070002, 0x8ce785c0, 0x3c0300bf,
-0x3463e000, 0x852023, 0x3c010002, 0xac248764,
-0x822023, 0x3c010002, 0xac25874c, 0x52842,
-0x3c010002, 0xac228740, 0x27620ffc, 0x3c010002,
-0xac228600, 0x27621ffc, 0xdb3023, 0x7b1823,
-0x3c010002, 0xac248744, 0x3c010002, 0xac258768,
-0x3c010002, 0xac228604, 0xaf860150, 0xaf830250,
-0x10e00027, 0x33620fff, 0x10400014, 0x2402028b,
-0x3c040001, 0x248473b8, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e773c0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x3c1d0002,
-0x8fbd85cc, 0x3a0f021, 0xc001807, 0x0,
-0x3c020002, 0x8c4285d0, 0x3c030002, 0x8c6385d4,
-0x2442fe00, 0x24630200, 0x3c010002, 0xac2285d0,
-0x3c010002, 0xac2385d4, 0x10000004, 0x0,
-0x3c1d0002, 0x8fbd8600, 0x3a0f021, 0x3c020002,
-0x8c4285c4, 0x1040000d, 0x26fafa38, 0x3c020002,
-0x8c4285d0, 0x3c030002, 0x8c6385d4, 0x3c1a0002,
-0x8f5a85d4, 0x2442fa38, 0x246305c8, 0x3c010002,
-0xac2285d0, 0x3c010002, 0xac2385d4, 0x3c020002,
-0x8c4285c8, 0x14400003, 0x0, 0x3c010002,
-0xac2085d0, 0xc001140, 0x0, 0x8fbf001c,
-0x8fb00018, 0x3e00008, 0x27bd0020, 0x3c020002,
-0x8c4285d0, 0x3c030002, 0x8c6385d4, 0x27bdff98,
-0xafb00048, 0x3c100001, 0x8e107d5c, 0xafb20050,
-0x3c120000, 0x26524100, 0xafbf0060, 0xafbe005c,
-0xafb50058, 0xafb30054, 0xafb1004c, 0xafa20034,
-0xafa30030, 0xafa00010, 0xafa00014, 0x8f860040,
-0x3c040001, 0x248473cc, 0x24050200, 0x3c010002,
-0xac32873c, 0xc002d3b, 0x2003821, 0x8f830040,
-0x3c02f000, 0x621824, 0x3c026000, 0x1062001f,
-0xa3a0003f, 0x3c040001, 0x248473d4, 0xafa00010,
-0xafa00014, 0x8f860040, 0x24050300, 0xc002d3b,
-0x2003821, 0x3c040001, 0x248473b8, 0x240202e1,
-0xafa20010, 0xafa00014, 0x8f860144, 0x3c070001,
-0x24e773c0, 0xc002d3b, 0x3405dead, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f820220, 0x34420004,
-0xaf820220, 0x8f820140, 0x240e0001, 0x3c030001,
-0xa3ae003f, 0x431025, 0xaf820140, 0x8f820240,
-0x3c030001, 0x431025, 0xaf820240, 0xaf800048,
-0x8f820048, 0x14400005, 0x0, 0xaf800048,
-0x8f820048, 0x10400004, 0x0, 0xaf800048,
-0x10000003, 0x2e02021, 0xaf80004c, 0x2e02021,
-0x3c050001, 0xc002da8, 0x34a540f8, 0x3402021,
-0xc002da8, 0x240505c8, 0x3c020002, 0x8c428764,
-0x3c0d0002, 0x8dad8744, 0x3c030002, 0x8c638740,
-0x3c080002, 0x8d08874c, 0x3c090002, 0x8d298768,
-0x3c0a0002, 0x8d4a8770, 0x3c0b0002, 0x8d6b8780,
-0x3c0c0002, 0x8d8c8754, 0x3c040001, 0x248473e0,
-0x24050400, 0xaf42013c, 0x8f42013c, 0x24060001,
-0x24070001, 0xaf400000, 0xaf4d0138, 0xaf430144,
-0xaf480148, 0xaf49014c, 0xaf4a0150, 0xaf4b0154,
-0xaf4c0158, 0x2442ff80, 0xaf420140, 0x24020001,
-0xafa20010, 0xc002d3b, 0xafa00014, 0x8f420138,
-0xafa20010, 0x8f42013c, 0xafa20014, 0x8f460144,
-0x8f470148, 0x3c040001, 0x248473ec, 0xc002d3b,
-0x24050500, 0xafb70010, 0xafba0014, 0x8f46014c,
-0x8f470150, 0x3c040001, 0x248473f8, 0xc002d3b,
-0x24050600, 0x3c020002, 0x8c428758, 0x3603821,
-0x3c060002, 0x24c6a8d0, 0x2448ffff, 0x1061824,
-0xe81024, 0x43102b, 0x1040001a, 0x24050900,
-0x3c040001, 0x24847404, 0xafa80010, 0xc002d3b,
-0xafa00014, 0x3c040001, 0x248473b8, 0x2402033a,
-0xafa20010, 0xafa00014, 0x8f860144, 0x3c070001,
-0x24e773c0, 0xc002d3b, 0x3405dead, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f820220, 0x34420004,
-0xaf820220, 0x8f820140, 0x3c030001, 0x431025,
-0xaf820140, 0x8f82000c, 0xafa20010, 0x8f82003c,
-0xafa20014, 0x8f860000, 0x8f870004, 0x3c040001,
-0x24847410, 0xc002d3b, 0x24051000, 0x8c020220,
-0x8c030224, 0x8c060218, 0x8c07021c, 0x3c040001,
-0x24847418, 0x24051100, 0xafa20010, 0xc002d3b,
-0xafa30014, 0xaf800054, 0xaf80011c, 0x8c020218,
-0x30420002, 0x10400009, 0x0, 0x8c020220,
-0x3c030002, 0x34630004, 0x431025, 0xaf42000c,
-0x8c02021c, 0x10000008, 0x34420004, 0x8c020220,
-0x3c030002, 0x34630006, 0x431025, 0xaf42000c,
-0x8c02021c, 0x34420006, 0xaf420014, 0x8c020218,
-0x30420010, 0x1040000a, 0x0, 0x8c02021c,
-0x34420004, 0xaf420010, 0x8c020220, 0x3c03000a,
-0x34630004, 0x431025, 0x10000009, 0xaf420008,
-0x8c020220, 0x3c03000a, 0x34630006, 0x431025,
-0xaf420008, 0x8c02021c, 0x34420006, 0xaf420010,
-0x24020001, 0xaf8200a0, 0xaf8200b0, 0x8f830054,
-0x8f820054, 0xaf8000d0, 0xaf8000c0, 0x10000002,
-0x24630064, 0x8f820054, 0x621023, 0x2c420065,
-0x1440fffc, 0x0, 0x8c040208, 0x8c05020c,
-0x26e20028, 0xaee20020, 0x24020490, 0xaee20010,
-0xaee40008, 0xaee5000c, 0x26e40008, 0x8c820000,
-0x8c830004, 0xaf820090, 0xaf830094, 0x8c820018,
-0xaf8200b4, 0x9482000a, 0xaf82009c, 0x8f420014,
-0xaf8200b0, 0x8f8200b0, 0x30420004, 0x1440fffd,
-0x0, 0x8f8200b0, 0x3c03ef00, 0x431024,
-0x10400021, 0x0, 0x8f8200b4, 0xafa20010,
-0x8f820090, 0x8f830094, 0x3c040001, 0x24847420,
-0xafa30014, 0x8f8600b0, 0x8f87009c, 0x3c050001,
-0xc002d3b, 0x34a5200d, 0x3c040001, 0x248473b8,
-0x240203c4, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070001, 0x24e773c0, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x3c030001,
-0x431025, 0xaf820140, 0x96e20472, 0x96e60452,
-0x96e70462, 0xafa20010, 0x96e20482, 0x3c040001,
-0x2484742c, 0x24051200, 0xc002d3b, 0xafa20014,
-0x96f00452, 0x32020001, 0x10400002, 0xb021,
-0x24160001, 0x32020002, 0x54400001, 0x36d60002,
-0x32020008, 0x54400001, 0x36d60004, 0x32020010,
-0x54400001, 0x36d60008, 0x32020020, 0x54400001,
-0x36d60010, 0x32020040, 0x54400001, 0x36d60020,
-0x32020080, 0x54400001, 0x36d60040, 0x96e60482,
-0x30c20200, 0x54400001, 0x36d64000, 0x96e30472,
-0x30620200, 0x10400003, 0x30620100, 0x10000003,
-0x36d62000, 0x54400001, 0x36d61000, 0x96f00462,
-0x32c24000, 0x14400004, 0x3207009b, 0x30c2009b,
-0x14e20007, 0x0, 0x32c22000, 0x14400022,
-0x32020001, 0x3062009b, 0x10e2001f, 0x32020001,
-0x3c040001, 0x24847438, 0x24051300, 0x2003821,
-0xafa30010, 0xc002d3b, 0xafa00014, 0x3c040001,
-0x248473b8, 0x24020400, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e773c0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x240e0001, 0x3c030001, 0xa3ae003f, 0x431025,
-0xaf820140, 0x32020001, 0x54400001, 0x36d60080,
-0x32020002, 0x54400001, 0x36d60100, 0x32020008,
-0x54400001, 0x36d60200, 0x32020010, 0x54400001,
-0x36d60400, 0x32020080, 0x54400001, 0x36d60800,
-0x8c020218, 0x30420200, 0x10400002, 0x3c020008,
-0x2c2b025, 0x8c020218, 0x30428000, 0x10400002,
-0x3c021000, 0x2c2b025, 0x8c020218, 0x30420800,
-0x10400002, 0x3c020080, 0x2c2b025, 0x8c020218,
-0x30420400, 0x10400002, 0x3c020100, 0x2c2b025,
-0x8c020218, 0x30420100, 0x10400002, 0x3c020200,
-0x2c2b025, 0x8c020218, 0x30420080, 0x10400002,
-0x3c020400, 0x2c2b025, 0x8c020218, 0x30422000,
-0x10400002, 0x3c020010, 0x2c2b025, 0x8c020218,
-0x30424000, 0x10400002, 0x3c020020, 0x2c2b025,
-0x8c020218, 0x30421000, 0x10400002, 0x3c020040,
-0x2c2b025, 0x8ee20498, 0x8ee3049c, 0xaf420160,
-0xaf430164, 0x8ee204a0, 0x8ee304a4, 0xaf420168,
-0xaf43016c, 0x8ee204a8, 0x8ee304ac, 0xaf420170,
-0xaf430174, 0x8ee20428, 0x8ee3042c, 0xaf420178,
-0xaf43017c, 0x8ee20448, 0x8ee3044c, 0xaf420180,
-0xaf430184, 0x8ee20458, 0x8ee3045c, 0xaf420188,
-0xaf43018c, 0x8ee20468, 0x8ee3046c, 0xaf420190,
-0xaf430194, 0x8ee20478, 0x8ee3047c, 0xaf420198,
-0xaf43019c, 0x8ee20488, 0x8ee3048c, 0xaf4201a0,
-0xaf4301a4, 0x8ee204b0, 0x8ee304b4, 0x24040080,
-0xaf4201a8, 0xaf4301ac, 0xc002da8, 0x24050080,
-0x8c02025c, 0x27440224, 0xaf4201f0, 0x8c020260,
-0x24050200, 0x24060008, 0xaf4201f8, 0xc002dbf,
-0x0, 0x3c043b9a, 0x3484ca00, 0x3821,
-0x24020006, 0x24030002, 0xaf4201f4, 0x240203e8,
-0xaf430204, 0xaf430200, 0xaf4401fc, 0xaf420294,
-0x24020001, 0xaf430290, 0xaf42029c, 0x3c030002,
-0x671821, 0x906385d8, 0x3471021, 0x24e70001,
-0xa043022c, 0x2ce2000f, 0x1440fff8, 0x3471821,
-0x24e70001, 0x3c080001, 0x350840f8, 0x8f820040,
-0x3c040001, 0x24847444, 0x24051400, 0x21702,
-0x24420030, 0xa062022c, 0x3471021, 0xa040022c,
-0x8c070218, 0x2c03021, 0x240205c8, 0xafa20010,
-0xc002d3b, 0xafa80014, 0x3c040001, 0x24847450,
-0x3c050000, 0x24a55f28, 0x24060010, 0x27b10030,
-0x2203821, 0x27b30034, 0xc00188f, 0xafb30010,
-0x3c030002, 0x8c6385c8, 0x1060000a, 0x408021,
-0x8fa30030, 0x2405ff00, 0x8fa20034, 0x246400ff,
-0x852024, 0x831823, 0x431023, 0xafa20034,
-0xafa40030, 0x3c040001, 0x2484745c, 0x3c050000,
-0x24a54100, 0x24060108, 0x2203821, 0xc00188f,
-0xafb30010, 0x409021, 0x32c20003, 0x3c010002,
-0xac32873c, 0x10400059, 0x2203821, 0x8f820050,
-0x3c030010, 0x431024, 0x1040002a, 0x0,
-0x8c020218, 0x30420040, 0x10400023, 0x24020001,
-0x8f820050, 0x8c030218, 0x3c040001, 0x24847468,
-0xafa20010, 0xafa30014, 0x8f870040, 0x24051500,
-0xc002d3b, 0x2c03021, 0x3c040001, 0x248473b8,
-0x24020474, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070001, 0x24e773c0, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x240e0001,
-0x3c030001, 0xa3ae003f, 0x431025, 0xaf820140,
-0x10000004, 0x0, 0x3c010001, 0x370821,
-0xa02240f4, 0x3c040001, 0x24847474, 0x3c050001,
-0x24a5a8fc, 0x3c060001, 0x24c6aa20, 0xc53023,
-0x8f420010, 0x27b30030, 0x2603821, 0x27b10034,
-0x34420a00, 0xaf420010, 0xc00188f, 0xafb10010,
-0x3c040001, 0x24847488, 0x3c050001, 0x24a5bfd4,
-0x3c060001, 0x24c6c35c, 0xc53023, 0x2603821,
-0xaf420108, 0xc00188f, 0xafb10010, 0x3c040001,
-0x248474a4, 0x3c050001, 0x24a5c7fc, 0x3c060001,
-0x24c6d53c, 0xc53023, 0x2603821, 0x3c010002,
-0xac2287b0, 0xc00188f, 0xafb10010, 0x3c040001,
-0x248474bc, 0x10000024, 0x24051600, 0x3c040001,
-0x248474c4, 0x3c050001, 0x24a5a744, 0x3c060001,
-0x24c6a8f4, 0xc53023, 0xc00188f, 0xafb30010,
-0x3c040001, 0x248474d4, 0x3c050001, 0x24a5bb10,
-0x3c060001, 0x24c6bfcc, 0xc53023, 0x2203821,
-0xaf420108, 0xc00188f, 0xafb30010, 0x3c040001,
-0x248474e8, 0x3c050001, 0x24a5c364, 0x3c060001,
-0x24c6c7f4, 0xc53023, 0x2203821, 0x3c010002,
-0xac2287b0, 0xc00188f, 0xafb30010, 0x3c040001,
-0x248474fc, 0x24051650, 0x2c03021, 0x3821,
-0x3c010002, 0xac2287b4, 0xafa00010, 0xc002d3b,
-0xafa00014, 0x32c20020, 0x10400021, 0x27a70030,
-0x3c040001, 0x24847508, 0x3c050001, 0x24a5b938,
-0x3c060001, 0x24c6bb08, 0xc53023, 0x24022000,
-0xaf42001c, 0x27a20034, 0xc00188f, 0xafa20010,
-0x21900, 0x31982, 0x3c040800, 0x641825,
-0xae430028, 0x24030010, 0xaf43003c, 0x96e30450,
-0xaf430040, 0x8f430040, 0x3c040001, 0x2484751c,
-0xafa00014, 0xafa30010, 0x8f47001c, 0x24051660,
-0x3c010002, 0xac2287ac, 0x10000039, 0x32c60020,
-0x8ee20448, 0x8ee3044c, 0xaf43001c, 0x8f42001c,
-0x2442e000, 0x2c422001, 0x1440001e, 0x24051700,
-0x3c040001, 0x24847528, 0xafa00010, 0xafa00014,
-0x8f46001c, 0xc002d3b, 0x3821, 0x3c040001,
-0x248473b8, 0x240204dd, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e773c0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x240e0001, 0x3c030001, 0xa3ae003f, 0x431025,
-0xaf820140, 0x3c020000, 0x24425f64, 0x21100,
-0x21182, 0x3c030800, 0x431025, 0xae420028,
-0x24020008, 0xaf42003c, 0x96e20450, 0xaf420040,
-0x8f420040, 0x3c040001, 0x24847534, 0xafa00014,
-0xafa20010, 0x8f47001c, 0x24051800, 0x32c60020,
-0xc002d3b, 0x0, 0x3c050fff, 0x3c030002,
-0x8c6387b0, 0x34a5ffff, 0x2403021, 0x3c020002,
-0x8c4287b4, 0x3c040800, 0x651824, 0x31882,
-0x641825, 0x451024, 0x21082, 0x441025,
-0xacc20080, 0x32c20180, 0x1040007e, 0xacc30020,
-0x8f82005c, 0x3c030080, 0x431024, 0x10400021,
-0x0, 0x8f820050, 0xafa20010, 0x8f82005c,
-0x3c040001, 0x24847540, 0xafa20014, 0x8f870040,
-0x24051900, 0xc002d3b, 0x2c03021, 0x3c040001,
-0x248473b8, 0x240204fe, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e773c0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x240e0001, 0x3c030001, 0xa3ae003f, 0x431025,
-0xaf820140, 0x8f820050, 0x3c030010, 0x431024,
-0x1040002a, 0x0, 0x8c020218, 0x30420040,
-0x10400023, 0x24020001, 0x8f820050, 0x8c030218,
-0x3c040001, 0x24847468, 0xafa20010, 0xafa30014,
-0x8f870040, 0x24052000, 0xc002d3b, 0x2c03021,
-0x3c040001, 0x248473b8, 0x2402050c, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e773c0,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x240e0001, 0x3c030001, 0xa3ae003f,
-0x431025, 0xaf820140, 0x10000004, 0x0,
-0x3c010001, 0x370821, 0xa02240f4, 0x3c040001,
-0x2484754c, 0x3c050001, 0x24a5a60c, 0x3c060001,
-0x24c6a73c, 0xc53023, 0x8f420008, 0x27b30030,
-0x2603821, 0x27b10034, 0x34420e00, 0xaf420008,
-0xc00188f, 0xafb10010, 0x3c040001, 0x24847564,
-0x3c050001, 0x24a5e844, 0x3c060001, 0x24c6f5fc,
-0xc53023, 0x2603821, 0xaf42010c, 0xc00188f,
-0xafb10010, 0x3c040001, 0x2484757c, 0x3c050001,
-0x24a5fde8, 0x3c060001, 0x24c60588, 0xc53023,
-0x2603821, 0x3c010002, 0xac2287c0, 0xc00188f,
-0xafb10010, 0x3c040001, 0x24847594, 0x10000027,
-0x24052100, 0x3c040001, 0x2484759c, 0x3c050001,
-0x24a5a444, 0x3c060001, 0x24c6a604, 0xc53023,
-0x27b10030, 0x2203821, 0x27b30034, 0xc00188f,
-0xafb30010, 0x3c040001, 0x248475ac, 0x3c050001,
-0x24a5d738, 0x3c060001, 0x24c6e83c, 0xc53023,
-0x2203821, 0xaf42010c, 0xc00188f, 0xafb30010,
-0x3c040001, 0x248475bc, 0x3c050001, 0x24a5fbac,
-0x3c060001, 0x24c6fde0, 0xc53023, 0x2203821,
-0x3c010002, 0xac2287c0, 0xc00188f, 0xafb30010,
-0x3c040001, 0x248475d0, 0x24052150, 0x2c03021,
-0x3821, 0x3c010002, 0xac2287cc, 0xafa00010,
-0xc002d3b, 0xafa00014, 0x3c110fff, 0x3c030002,
-0x8c6387c0, 0x3631ffff, 0x2409821, 0x3c020002,
-0x8c4287cc, 0x3c0e0800, 0x711824, 0x31882,
-0x6e1825, 0x511024, 0x21082, 0x4e1025,
-0xae630038, 0xae620078, 0x8c020218, 0x30420040,
-0x14400004, 0x24020001, 0x3c010001, 0x370821,
-0xa02240f4, 0x3c040001, 0x248475dc, 0x3c050001,
-0x24a5f604, 0x3c060001, 0x24c6f7c4, 0xc53023,
-0x27be0030, 0x3c03821, 0x27b50034, 0xc00188f,
-0xafb50010, 0x3c010002, 0xac2287b8, 0x511024,
-0x21082, 0x3c0e0800, 0x4e1025, 0xae620050,
-0x32c22000, 0x10400006, 0x3c03821, 0x3c020000,
-0x24425f64, 0x2221024, 0x1000000f, 0x21082,
-0x3c040001, 0x248475f0, 0x3c050001, 0x24a5f7cc,
-0x3c060001, 0x24c6f9e0, 0xc53023, 0xc00188f,
-0xafb50010, 0x3c010002, 0xac2287d0, 0x511024,
-0x21082, 0x3c0e0800, 0x4e1025, 0xae620048,
-0x32c24000, 0x10400005, 0x27a70030, 0x3c020000,
-0x24425f64, 0x1000000e, 0x21100, 0x3c040001,
-0x24847608, 0x3c050001, 0x24a5f9e8, 0x3c060001,
-0x24c6fba4, 0xc53023, 0x27a20034, 0xc00188f,
-0xafa20010, 0x3c010002, 0xac2287c4, 0x21100,
-0x21182, 0x3c030800, 0x431025, 0xae420060,
-0x3c040001, 0x24847620, 0x3c050001, 0x24a5866c,
-0x3c060001, 0x24c68aac, 0xc53023, 0x27b10030,
-0x2203821, 0x27b30034, 0xc00188f, 0xafb30010,
-0x3c0e0fff, 0x35ceffff, 0x3c040001, 0x2484762c,
-0x3c050000, 0x24a5687c, 0x3c060000, 0x24c6699c,
-0xc53023, 0x2203821, 0x240f021, 0x3c010002,
-0xac228798, 0x4e1024, 0x21082, 0x3c150800,
-0x551025, 0xafae0044, 0xafc200b8, 0xc00188f,
-0xafb30010, 0x3c040001, 0x24847638, 0x3c050000,
-0x24a569a4, 0x3c060000, 0x24c66c24, 0x8fae0044,
-0xc53023, 0x2203821, 0x3c010002, 0xac22878c,
-0x4e1024, 0x21082, 0x551025, 0xafc200e8,
-0xc00188f, 0xafb30010, 0x3c040001, 0x24847650,
-0x3c050000, 0x24a56c2c, 0x3c060000, 0x24c66d60,
-0x8fae0044, 0xc53023, 0x2203821, 0x3c010002,
-0xac228784, 0x4e1024, 0x21082, 0x551025,
-0xafc200c0, 0xc00188f, 0xafb30010, 0x3c040001,
-0x24847668, 0x3c050001, 0x24a51034, 0x3c060001,
-0x24c6110c, 0x8fae0044, 0xc53023, 0x2203821,
-0x3c010002, 0xac228790, 0x4e1024, 0x21082,
-0x551025, 0xafc200c8, 0xc00188f, 0xafb30010,
-0x3c040001, 0x24847674, 0x3c050001, 0x24a5d570,
-0x3c060001, 0x24c6d654, 0xc53023, 0x2203821,
-0xaf420110, 0xc00188f, 0xafb30010, 0x3c040001,
-0x24847684, 0x3c050001, 0x24a5d544, 0x3c060001,
-0x24c6d568, 0xc53023, 0x2203821, 0xaf420124,
-0xc00188f, 0xafb30010, 0x3c040001, 0x24847694,
-0x3c050001, 0x24a5d65c, 0x3c060001, 0x24c6d684,
-0xc53023, 0x2203821, 0xaf420120, 0xaf420114,
-0xc00188f, 0xafb30010, 0x3c040001, 0x248476a0,
-0x3c050001, 0x24a5072c, 0x3c060001, 0x24c60c24,
-0xc53023, 0x2203821, 0xaf420118, 0xc00188f,
-0xafb30010, 0x8fae0044, 0x3c010002, 0xac2287d4,
-0x4e1024, 0x21082, 0x551025, 0xc00451b,
-0xafc200d0, 0xc004164, 0x0, 0xc0028c7,
-0x0, 0xac000228, 0xac00022c, 0x96e20450,
-0x2442ffff, 0xaf420038, 0x96e20460, 0xaf420080,
-0x32c24000, 0x14400003, 0x0, 0x96e20480,
-0xaf420084, 0x96e70490, 0x50e00001, 0x24070800,
-0x24e2ffff, 0xaf420088, 0xaf42007c, 0x24020800,
-0x10e20023, 0x32c24000, 0x10400003, 0x24020400,
-0x10e2001f, 0x0, 0x3c040001, 0x248476b0,
-0x96e60490, 0x24052170, 0x2c03821, 0xafa00010,
-0xc002d3b, 0xafa00014, 0x3c040001, 0x248473b8,
-0x240205f1, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070001, 0x24e773c0, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x240e0001,
-0x3c030001, 0xa3ae003f, 0x431025, 0xaf820140,
-0x8f430138, 0x8f440138, 0x24020001, 0xa34205c2,
-0xaf430094, 0xaf440098, 0xafa00010, 0xafa00014,
-0x8f460080, 0x8f470084, 0x3c040001, 0x248476bc,
-0xc002d3b, 0x24052200, 0xc0025c6, 0x3c110800,
-0x3c1433d8, 0x3694cb58, 0x3c020800, 0x34420080,
-0x3c040001, 0x248476c8, 0x3c050000, 0x24a55ff8,
-0x3c060000, 0x24c66014, 0xc53023, 0x27a70030,
-0xaf820060, 0x2402ffff, 0xaf820064, 0x27a20034,
-0xc00188f, 0xafa20010, 0x3c010002, 0xac228774,
-0x21100, 0x21182, 0x511025, 0xc0019e8,
-0xae420000, 0x8f820240, 0x3c030001, 0x431025,
-0xaf820240, 0x3c020000, 0x24424034, 0xaf820244,
-0xaf800240, 0x8f820060, 0x511024, 0x14400005,
-0x3c030800, 0x8f820060, 0x431024, 0x1040fffd,
-0x0, 0xc004171, 0x8821, 0x3c020100,
-0xafa20020, 0x8f530018, 0x240200ff, 0x56620001,
-0x26710001, 0x8c020228, 0x1622000e, 0x1330c0,
-0x8f42033c, 0x24420001, 0xaf42033c, 0x8f42033c,
-0x8c020228, 0x3c040001, 0x2484735c, 0x3c050009,
-0xafa00014, 0xafa20010, 0x8fa60020, 0x1000003f,
-0x34a50100, 0xd71021, 0x8fa30020, 0x8fa40024,
-0xac4304c0, 0xac4404c4, 0xc01821, 0x8f440178,
-0x8f45017c, 0x1021, 0x24070004, 0xafa70010,
-0xafb10014, 0x8f48000c, 0x24c604c0, 0x2e63021,
-0xafa80018, 0x8f48010c, 0x24070008, 0xa32821,
-0xa3482b, 0x822021, 0x100f809, 0x892021,
-0x1440000b, 0x24070008, 0x8f820120, 0xafa20010,
-0x8f820124, 0x3c040001, 0x24847364, 0x3c050009,
-0xafa20014, 0x8fa60020, 0x1000001c, 0x34a50200,
-0x8f440160, 0x8f450164, 0x8f43000c, 0xaf510018,
-0x8f860120, 0x24020010, 0xafa20010, 0xafb10014,
-0xafa30018, 0x8f42010c, 0x40f809, 0x24c6001c,
-0x14400010, 0x0, 0x8f420340, 0x24420001,
-0xaf420340, 0x8f420340, 0x8f820120, 0xafa20010,
-0x8f820124, 0x3c040001, 0x2484736c, 0x3c050009,
-0xafa20014, 0x8fa60020, 0x34a50300, 0xc002d3b,
-0x2603821, 0x8f4202e4, 0x24420001, 0xaf4202e4,
-0x8f4202e4, 0x93a2003f, 0x1040007d, 0x3c020700,
-0x34423000, 0xafa20028, 0x8f530018, 0x240200ff,
-0x12620002, 0x8821, 0x26710001, 0x8c020228,
-0x1622000e, 0x1330c0, 0x8f42033c, 0x24420001,
-0xaf42033c, 0x8f42033c, 0x8c020228, 0x3c040001,
-0x2484735c, 0x3c050009, 0xafa00014, 0xafa20010,
-0x8fa60028, 0x1000003f, 0x34a50100, 0xd71021,
-0x8fa30028, 0x8fa4002c, 0xac4304c0, 0xac4404c4,
-0xc01821, 0x8f440178, 0x8f45017c, 0x1021,
-0x24070004, 0xafa70010, 0xafb10014, 0x8f48000c,
-0x24c604c0, 0x2e63021, 0xafa80018, 0x8f48010c,
-0x24070008, 0xa32821, 0xa3482b, 0x822021,
-0x100f809, 0x892021, 0x1440000b, 0x24070008,
-0x8f820120, 0xafa20010, 0x8f820124, 0x3c040001,
-0x24847364, 0x3c050009, 0xafa20014, 0x8fa60028,
-0x1000001c, 0x34a50200, 0x8f440160, 0x8f450164,
-0x8f43000c, 0xaf510018, 0x8f860120, 0x24020010,
-0xafa20010, 0xafb10014, 0xafa30018, 0x8f42010c,
-0x40f809, 0x24c6001c, 0x14400010, 0x0,
-0x8f420340, 0x24420001, 0xaf420340, 0x8f420340,
-0x8f820120, 0xafa20010, 0x8f820124, 0x3c040001,
-0x2484736c, 0x3c050009, 0xafa20014, 0x8fa60028,
-0x34a50300, 0xc002d3b, 0x2603821, 0x8f4202f0,
-0x24420001, 0xaf4202f0, 0x8f4202f0, 0x3c040001,
-0x248476d8, 0xafa00010, 0xafa00014, 0x8fa60028,
-0x24052300, 0xc002d3b, 0x3821, 0x3c040001,
-0x248473b8, 0x24020656, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e773c0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x10000004,
-0x0, 0x8c020264, 0x10400005, 0x0,
-0x8f8200a0, 0x30420004, 0x1440fffa, 0x0,
-0x8f820044, 0x34420004, 0xaf820044, 0x8f420308,
-0x24420001, 0xaf420308, 0x8f420308, 0x8f8200d8,
-0x8f8300d4, 0x431023, 0x2442ff80, 0xaf420090,
-0x8f420090, 0x2842ff81, 0x10400006, 0x24020001,
-0x8f420090, 0x8f430144, 0x431021, 0xaf420090,
-0x24020001, 0xaf42008c, 0x32c20008, 0x10400006,
-0x0, 0x8f820214, 0x3c038100, 0x3042ffff,
-0x431025, 0xaf820214, 0x3c030002, 0x8c638668,
-0x30620002, 0x10400009, 0x30620001, 0x3c040001,
-0x248476e4, 0x3c050000, 0x24a57174, 0x3c060000,
-0x24c675f8, 0x10000012, 0xc53023, 0x10400009,
-0x0, 0x3c040001, 0x248476f4, 0x3c050000,
-0x24a57600, 0x3c060000, 0x24c67aa8, 0x10000008,
-0xc53023, 0x3c040001, 0x24847704, 0x3c050000,
-0x24a56d68, 0x3c060000, 0x24c6716c, 0xc53023,
-0x27a70030, 0x27a20034, 0xc00188f, 0xafa20010,
-0x3c010002, 0xac228788, 0x3c020002, 0x8c428788,
-0x3c030800, 0x21100, 0x21182, 0x431025,
-0xae420040, 0x8f8200a0, 0xafa20010, 0x8f8200b0,
-0xafa20014, 0x8f86005c, 0x8f87011c, 0x3c040001,
-0x24847714, 0x3c010002, 0xac368760, 0x3c010002,
-0xac208750, 0x3c010002, 0xac3c8748, 0x3c010002,
-0xac3b8778, 0x3c010002, 0xac37877c, 0x3c010002,
-0xac3a875c, 0xc002d3b, 0x24052400, 0x8f820200,
-0xafa20010, 0x8f820220, 0xafa20014, 0x8f860044,
-0x8f870050, 0x3c040001, 0x24847720, 0xc002d3b,
-0x24052500, 0x8f830060, 0x74100b, 0x242000a,
-0x200f821, 0x0, 0xd, 0x8fbf0060,
-0x8fbe005c, 0x8fb50058, 0x8fb30054, 0x8fb20050,
-0x8fb1004c, 0x8fb00048, 0x3e00008, 0x27bd0068,
-0x27bdffe0, 0x3c040001, 0x2484772c, 0x24052600,
-0x3021, 0x3821, 0xafbf0018, 0xafa00010,
-0xc002d3b, 0xafa00014, 0x3c040001, 0x248473b8,
-0x240206bb, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070001, 0x24e773c0, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x3c030001,
-0x431025, 0xaf820140, 0x8fbf0018, 0x3e00008,
-0x27bd0020, 0x3e00008, 0x0, 0x3e00008,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x3e00008, 0x0,
-0x3e00008, 0x0, 0x27bdfde0, 0xafb00218,
-0x27b00018, 0x3c0200bf, 0x3442ffff, 0x50102b,
-0x10400015, 0xafbf021c, 0x3c040001, 0x248473b8,
-0x240206df, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070001, 0x24e773c0, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x3c030001,
-0x431025, 0xaf820140, 0x3c04dead, 0x3484beef,
-0x8f820150, 0x3c03001f, 0x3463ffff, 0xafa40018,
-0x2028023, 0x2038024, 0x8e020000, 0x1044001e,
-0x0, 0xafb00010, 0x8e020000, 0xafa20014,
-0x8f860150, 0x8f870250, 0x3c040001, 0x24847734,
-0xc002d3b, 0x24052700, 0x3c040001, 0x248473b8,
-0x240206ed, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070001, 0x24e773c0, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x3c030001,
-0x431025, 0xaf820140, 0x8fbf021c, 0x8fb00218,
-0x3e00008, 0x27bd0220, 0x27bdffe0, 0x3c06abba,
-0x34c6babe, 0xafb00018, 0x3c100004, 0x3c07007f,
-0x34e7ffff, 0xafbf001c, 0x102840, 0x8e040000,
-0x8ca30000, 0xaca00000, 0xae060000, 0x8ca20000,
-0xaca30000, 0x10460005, 0xae040000, 0xa08021,
-0xf0102b, 0x1040fff5, 0x102840, 0x3c040001,
-0x24847740, 0x24052800, 0x2003021, 0x3821,
-0xafa00010, 0xc002d3b, 0xafa00014, 0x2001021,
-0x8fbf001c, 0x8fb00018, 0x3e00008, 0x27bd0020,
-0x8c020224, 0x3047003f, 0x10e00010, 0x803021,
-0x2821, 0x24030020, 0xe31024, 0x10400002,
-0x63042, 0xa62821, 0x31842, 0x1460fffb,
-0xe31024, 0x2402f000, 0xa22824, 0x3402ffff,
-0x45102b, 0x14400003, 0x3c020001, 0x10000008,
-0x3c020001, 0x3442ffff, 0x851823, 0x43102b,
-0x14400003, 0xa01021, 0x3c02fffe, 0x821021,
-0x3e00008, 0x0, 0x27bdffd0, 0xafb50028,
-0x8fb50040, 0xafb20020, 0xa09021, 0xafb1001c,
-0x24c60003, 0xafbf002c, 0xafb30024, 0xafb00018,
-0x8ea20000, 0x2403fffc, 0xc38024, 0x50102b,
-0x1440001b, 0xe08821, 0x8e330000, 0xafb00010,
-0x8ea20000, 0xafa20014, 0x8e270000, 0x24053000,
-0xc002d3b, 0x2403021, 0x8e230000, 0x702021,
-0x64102b, 0x10400007, 0x2402821, 0x8ca20000,
-0xac620000, 0x24630004, 0x64102b, 0x1440fffb,
-0x24a50004, 0x8ea20000, 0x501023, 0xaea20000,
-0x8e220000, 0x501021, 0x1000000b, 0xae220000,
-0x2402002d, 0xa0820000, 0xafb00010, 0x8ea20000,
-0x2409821, 0xafa20014, 0x8e270000, 0x24053100,
-0xc002d3b, 0x2603021, 0x2601021, 0x8fbf002c,
-0x8fb50028, 0x8fb30024, 0x8fb20020, 0x8fb1001c,
-0x8fb00018, 0x3e00008, 0x27bd0030, 0x27bdffe8,
-0x3c1cc000, 0x3c05fffe, 0x3c030002, 0x8c638740,
-0x3c040002, 0x8c84874c, 0x34a5bf08, 0x24021ffc,
-0x3c010002, 0xac2285d0, 0x3c0200c0, 0x3c010002,
-0xac2285d4, 0x3c020020, 0xafbf0010, 0x3c0100c0,
-0xac201ffc, 0x431023, 0x441023, 0x245bb000,
-0x365b821, 0x3c1d0002, 0x8fbd85cc, 0x3a0f021,
-0x3c0400c0, 0x34840200, 0x3c1a00c0, 0x3c0300c0,
-0x346307c8, 0x24021dfc, 0x3c010002, 0xac2285d0,
-0x24021834, 0x3c010002, 0xac2485d4, 0x3c010002,
-0xac2285d0, 0x3c010002, 0xac2385d4, 0xc0018f9,
-0x375a0200, 0x8fbf0010, 0x3e00008, 0x27bd0018,
-0x27bdffc8, 0x3c040001, 0x2484774c, 0x24053200,
-0x3c020002, 0x8c4285d0, 0x3c030002, 0x8c6385d4,
-0x3021, 0x3603821, 0xafbf0030, 0xafb3002c,
-0xafb20028, 0xafb10024, 0xafb00020, 0xafa2001c,
-0xafa30018, 0xafb70010, 0xc002d3b, 0xafba0014,
-0xc001a1b, 0x0, 0x8f820240, 0x34420004,
-0xaf820240, 0x24020001, 0xaf420000, 0x3c020001,
-0x571021, 0x904240f4, 0x10400093, 0x2403fffc,
-0x3c100001, 0x2610b47b, 0x3c120001, 0x2652b044,
-0x2121023, 0x438024, 0x8fa3001c, 0x3c040001,
-0x24847758, 0x70102b, 0x1440001a, 0x27b30018,
-0x8fb10018, 0x24053000, 0x2403021, 0xafb00010,
-0xafa30014, 0xc002d3b, 0x2203821, 0x8fa30018,
-0x702021, 0x64102b, 0x10400007, 0x2403021,
-0x8cc20000, 0xac620000, 0x24630004, 0x64102b,
-0x1440fffb, 0x24c60004, 0x8fa2001c, 0x501023,
-0xafa2001c, 0x8e620000, 0x501021, 0x1000000a,
-0xae620000, 0x2408821, 0x24053100, 0xafb00010,
-0xafa30014, 0x8fa70018, 0x2203021, 0x2402002d,
-0xc002d3b, 0xa0820000, 0x24070020, 0x8fa3001c,
-0x3c040001, 0x24847774, 0x24120020, 0x3c010002,
-0xac31876c, 0x2c620020, 0x1440001d, 0x27b10018,
-0x8fb00018, 0x24053000, 0x3c060002, 0x24c68810,
-0xafa70010, 0xafa30014, 0xc002d3b, 0x2003821,
-0x8fa30018, 0x3c040002, 0x24848810, 0x24650020,
-0x65102b, 0x10400007, 0x0, 0x8c820000,
-0xac620000, 0x24630004, 0x65102b, 0x1440fffb,
-0x24840004, 0x8fa2001c, 0x521023, 0xafa2001c,
-0x8e220000, 0x521021, 0x1000000b, 0xae220000,
-0x3c100002, 0x26108810, 0x24053100, 0xafa70010,
-0xafa30014, 0x8fa70018, 0x2003021, 0x2402002d,
-0xc002d3b, 0xa0820000, 0x24070020, 0x3c040001,
-0x24847788, 0x8fa3001c, 0x24120020, 0x3c010002,
-0xac3087a0, 0x2c620020, 0x1440001d, 0x27b10018,
-0x8fb00018, 0x24053000, 0x3c060002, 0x24c68830,
-0xafa70010, 0xafa30014, 0xc002d3b, 0x2003821,
-0x8fa30018, 0x3c040002, 0x24848830, 0x24650020,
-0x65102b, 0x10400007, 0x0, 0x8c820000,
-0xac620000, 0x24630004, 0x65102b, 0x1440fffb,
-0x24840004, 0x8fa2001c, 0x521023, 0xafa2001c,
-0x8e220000, 0x521021, 0x1000000b, 0xae220000,
-0x3c100002, 0x26108830, 0x24053100, 0xafa70010,
-0xafa30014, 0x8fa70018, 0x2003021, 0x2402002d,
-0xc002d3b, 0xa0820000, 0x3c010002, 0xac30879c,
-0x10000031, 0x0, 0x3c100001, 0x26108667,
-0x3c120001, 0x265284d8, 0x2121023, 0x438024,
-0x8fa3001c, 0x3c040001, 0x2484779c, 0x70102b,
-0x1440001a, 0x27b30018, 0x8fb10018, 0x24053000,
-0x2403021, 0xafb00010, 0xafa30014, 0xc002d3b,
-0x2203821, 0x8fa30018, 0x702021, 0x64102b,
-0x10400007, 0x2403021, 0x8cc20000, 0xac620000,
-0x24630004, 0x64102b, 0x1440fffb, 0x24c60004,
-0x8fa2001c, 0x501023, 0xafa2001c, 0x8e620000,
-0x501021, 0x1000000a, 0xae620000, 0x2408821,
-0x24053100, 0xafb00010, 0xafa30014, 0x8fa70018,
-0x2203021, 0x2402002d, 0xc002d3b, 0xa0820000,
-0x3c010002, 0xac31876c, 0x3c030002, 0x8c63876c,
-0x24020400, 0xaf820070, 0x60f809, 0x0,
-0x8fbf0030, 0x8fb3002c, 0x8fb20028, 0x8fb10024,
-0x8fb00020, 0x3e00008, 0x27bd0038, 0x27bdffe0,
-0xafbf0018, 0x8f820040, 0x3c03f000, 0x431024,
-0x3c036000, 0x14430008, 0x240201f9, 0x8f820050,
-0x2403ff80, 0x431024, 0x34420055, 0xaf820050,
-0x10000014, 0x0, 0x3c040001, 0x2484785c,
-0xafa20010, 0xafa00014, 0x8f860144, 0x3c070001,
-0x24e7786c, 0xc002d3b, 0x3405dead, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f820220, 0x34420004,
-0xaf820220, 0x8f820140, 0x3c030001, 0x431025,
-0xaf820140, 0x8f820054, 0x244203e8, 0xaf820058,
-0x240201f4, 0xaf4200e0, 0x24020004, 0xaf4200e8,
-0x24020002, 0xaf4001b0, 0xaf4000e4, 0xaf4200dc,
-0xaf4000d8, 0xaf4000d4, 0x8fbf0018, 0xaf4000d0,
-0x3e00008, 0x27bd0020, 0x8f820054, 0x24420005,
-0x3e00008, 0xaf820078, 0x27bdffe8, 0xafbf0010,
-0x8f820054, 0x244203e8, 0xaf820058, 0x3c020800,
-0x2c21024, 0x10400004, 0x3c02f7ff, 0x3442ffff,
-0x2c2b024, 0x36940040, 0x3c020002, 0x8c42867c,
-0x10400017, 0x3c020200, 0x3c030002, 0x8c6387d8,
-0x10600016, 0x282a025, 0x3c020002, 0x8c428708,
-0x14400012, 0x3c020200, 0x3c020002, 0x8c428668,
-0x30420003, 0x1440000d, 0x3c020200, 0x8f830224,
-0x3c020002, 0x8c42a8ac, 0x10620008, 0x3c020200,
-0xc00430b, 0x0, 0x10000004, 0x3c020200,
-0xc00470e, 0x0, 0x3c020200, 0x2c21024,
-0x10400003, 0x0, 0xc002058, 0x0,
-0x8f4200d8, 0x8f4300dc, 0x24420001, 0xaf4200d8,
-0x43102b, 0x14400003, 0x0, 0xaf4000d8,
-0x36940080, 0x8c030238, 0x1060000c, 0x0,
-0x8f4201b0, 0x244203e8, 0xaf4201b0, 0x43102b,
-0x14400006, 0x0, 0x934205c5, 0x14400003,
-0x0, 0xc001eac, 0x0, 0x8fbf0010,
-0x3e00008, 0x27bd0018, 0x3e00008, 0x0,
-0x27bdffd8, 0xafbf0020, 0x8f43002c, 0x8f420038,
-0x10620059, 0x0, 0x3c020001, 0x571021,
-0x904240f0, 0x10400026, 0x24070008, 0x8f440170,
-0x8f450174, 0x8f48000c, 0x8f860120, 0x24020020,
-0xafa20010, 0xafa30014, 0xafa80018, 0x8f42010c,
-0x40f809, 0x24c6001c, 0x14400011, 0x24020001,
-0x3c010001, 0x370821, 0xa02240f0, 0x8f820124,
-0xafa20010, 0x8f820128, 0x3c040001, 0x24847840,
-0xafa20014, 0x8f46002c, 0x8f870120, 0x3c050009,
-0xc002d3b, 0x34a50900, 0x1000005d, 0x0,
-0x8f420300, 0x24420001, 0xaf420300, 0x8f420300,
-0x8f42002c, 0xa34005c1, 0x10000027, 0xaf420038,
-0x8f440170, 0x8f450174, 0x8f43002c, 0x8f48000c,
-0x8f860120, 0x24020080, 0xafa20010, 0xafa30014,
-0xafa80018, 0x8f42010c, 0x40f809, 0x24c6001c,
-0x14400011, 0x24020001, 0x3c010001, 0x370821,
-0xa02240f1, 0x8f820124, 0xafa20010, 0x8f820128,
-0x3c040001, 0x2484784c, 0xafa20014, 0x8f46002c,
-0x8f870120, 0x3c050009, 0xc002d3b, 0x34a51100,
-0x10000037, 0x0, 0x8f420300, 0x8f43002c,
-0x24420001, 0xaf420300, 0x8f420300, 0x24020001,
-0xa34205c1, 0xaf430038, 0x3c010001, 0x370821,
-0xa02040f1, 0x3c010001, 0x370821, 0xa02040f0,
-0x10000027, 0xaf400034, 0x934205c1, 0x1040001e,
-0x0, 0xa34005c1, 0x8f820040, 0x30420001,
-0x14400008, 0x2021, 0x8c030104, 0x24020001,
-0x50620005, 0x24040001, 0x8c020264, 0x10400003,
-0x801021, 0x24040001, 0x801021, 0x10400007,
-0x0, 0x8f42030c, 0x24420001, 0xaf42030c,
-0x8f42030c, 0x10000008, 0x0, 0x8f820044,
-0x34420004, 0xaf820044, 0x8f420308, 0x24420001,
-0xaf420308, 0x8f420308, 0x3c010001, 0x370821,
-0xa02040f0, 0x3c010001, 0x370821, 0xa02040f1,
-0x8f420000, 0x10400007, 0x0, 0xaf80004c,
-0x8f82004c, 0x1040fffd, 0x0, 0x10000005,
-0x0, 0xaf800048, 0x8f820048, 0x1040fffd,
-0x0, 0x8f820060, 0x3c03ff7f, 0x3463ffff,
-0x431024, 0xaf820060, 0x8f420000, 0x10400004,
-0x0, 0xaf80004c, 0x10000002, 0x0,
-0xaf800048, 0x8fbf0020, 0x3e00008, 0x27bd0028,
-0x3e00008, 0x0, 0x27bdffd8, 0xafbf0020,
-0x8f430044, 0x8f42007c, 0x10620029, 0x24070008,
-0x8f440168, 0x8f45016c, 0x8f48000c, 0x8f860120,
-0x24020040, 0xafa20010, 0xafa30014, 0xafa80018,
-0x8f42010c, 0x40f809, 0x24c6001c, 0x14400011,
-0x24020001, 0x3c010001, 0x370821, 0xa02240f2,
-0x8f820124, 0xafa20010, 0x8f820128, 0x3c040001,
-0x24847854, 0xafa20014, 0x8f460044, 0x8f870120,
-0x3c050009, 0xc002d3b, 0x34a51300, 0x1000000f,
-0x0, 0x8f420304, 0x24420001, 0xaf420304,
-0x8f420304, 0x8f420044, 0xaf42007c, 0x3c010001,
-0x370821, 0xa02040f2, 0x10000004, 0xaf400078,
-0x3c010001, 0x370821, 0xa02040f2, 0x8f420000,
-0x10400007, 0x0, 0xaf80004c, 0x8f82004c,
-0x1040fffd, 0x0, 0x10000005, 0x0,
-0xaf800048, 0x8f820048, 0x1040fffd, 0x0,
-0x8f820060, 0x3c03feff, 0x3463ffff, 0x431024,
-0xaf820060, 0x8f420000, 0x10400004, 0x0,
-0xaf80004c, 0x10000002, 0x0, 0xaf800048,
-0x8fbf0020, 0x3e00008, 0x27bd0028, 0x3e00008,
-0x0, 0x3c020002, 0x8c42867c, 0x27bdffa8,
-0xafbf0050, 0xafbe004c, 0xafb50048, 0xafb30044,
-0xafb20040, 0xafb1003c, 0xafb00038, 0x8f900044,
-0x104000d5, 0x0, 0x8f4200d0, 0x24430001,
-0x2842000b, 0x144000e4, 0xaf4300d0, 0x8f420004,
-0x30420002, 0x1440009c, 0xaf4000d0, 0x8f420004,
-0x3c030002, 0x8c63866c, 0x34420002, 0xaf420004,
-0x24020001, 0x14620003, 0x3c020600, 0x10000002,
-0x34423000, 0x34421000, 0xafa20020, 0x8f4a0018,
-0xafaa0034, 0x27aa0020, 0xafaa002c, 0x8faa0034,
-0x240200ff, 0x11420002, 0x1821, 0x25430001,
-0x8c020228, 0x609821, 0x1662000e, 0x3c050009,
-0x8f42033c, 0x24420001, 0xaf42033c, 0x8f42033c,
-0x8c020228, 0x8fa70034, 0x3c040001, 0x24847824,
-0xafa00014, 0xafa20010, 0x8fa60020, 0x10000070,
-0x34a50500, 0x8faa0034, 0xa38c0, 0xf71021,
-0x8fa30020, 0x8fa40024, 0xac4304c0, 0xac4404c4,
-0x8f830054, 0x8f820054, 0x247103e8, 0x2221023,
-0x2c4203e9, 0x1040001b, 0xa821, 0xe09021,
-0x265e04c0, 0x8f440178, 0x8f45017c, 0x2401821,
-0x240a0004, 0xafaa0010, 0xafb30014, 0x8f48000c,
-0x1021, 0x2fe3021, 0xafa80018, 0x8f48010c,
-0x24070008, 0xa32821, 0xa3482b, 0x822021,
-0x100f809, 0x892021, 0x54400006, 0x24150001,
-0x8f820054, 0x2221023, 0x2c4203e9, 0x1440ffe9,
-0x0, 0x32a200ff, 0x54400018, 0xaf530018,
-0x8f420378, 0x24420001, 0xaf420378, 0x8f420378,
-0x8f820120, 0x8faa002c, 0x8fa70034, 0xafa20010,
-0x8f820124, 0x3c040001, 0x24847830, 0xafa20014,
-0x8d460000, 0x3c050009, 0x10000035, 0x34a50600,
-0x8f420308, 0x24150001, 0x24420001, 0xaf420308,
-0x8f420308, 0x1000001e, 0x32a200ff, 0x8f830054,
-0x8f820054, 0x247103e8, 0x2221023, 0x2c4203e9,
-0x10400016, 0xa821, 0x3c1e0020, 0x24120010,
-0x8f42000c, 0x8f440160, 0x8f450164, 0x8f860120,
-0xafb20010, 0xafb30014, 0x5e1025, 0xafa20018,
-0x8f42010c, 0x24070008, 0x40f809, 0x24c6001c,
-0x1440ffe3, 0x0, 0x8f820054, 0x2221023,
-0x2c4203e9, 0x1440ffee, 0x0, 0x32a200ff,
-0x14400011, 0x3c050009, 0x8f420378, 0x24420001,
-0xaf420378, 0x8f420378, 0x8f820120, 0x8faa002c,
-0x8fa70034, 0xafa20010, 0x8f820124, 0x3c040001,
-0x24847838, 0xafa20014, 0x8d460000, 0x34a50700,
-0xc002d3b, 0x0, 0x8f4202ec, 0x24420001,
-0xaf4202ec, 0x8f4202ec, 0x8f420004, 0x30420001,
-0x50400029, 0x36100040, 0x3c020400, 0x2c21024,
-0x10400013, 0x2404ffdf, 0x8f420250, 0x8f430254,
-0x8f4401b4, 0x14640006, 0x36100040, 0x8f420270,
-0x8f430274, 0x8f4401b8, 0x10640007, 0x2402ffdf,
-0x8f420250, 0x8f430254, 0x8f440270, 0x8f450274,
-0x10000012, 0x3a100020, 0x1000002b, 0x2028024,
-0x8f420250, 0x8f430254, 0x8f4501b4, 0x14650006,
-0x2048024, 0x8f420270, 0x8f430274, 0x8f4401b8,
-0x50640021, 0x36100040, 0x8f420250, 0x8f430254,
-0x8f440270, 0x8f450274, 0x3a100040, 0xaf4301b4,
-0x10000019, 0xaf4501b8, 0x8f4200d4, 0x24430001,
-0x10000011, 0x28420033, 0x8f420004, 0x30420001,
-0x10400009, 0x3c020400, 0x2c21024, 0x10400004,
-0x2402ffdf, 0x2028024, 0x1000000b, 0x36100040,
-0x10000009, 0x36100060, 0x8f4200d4, 0x36100040,
-0x24430001, 0x284201f5, 0x14400003, 0xaf4300d4,
-0xaf4000d4, 0x3a100020, 0xaf900044, 0x2402ff7f,
-0x282a024, 0x8fbf0050, 0x8fbe004c, 0x8fb50048,
-0x8fb30044, 0x8fb20040, 0x8fb1003c, 0x8fb00038,
-0x3e00008, 0x27bd0058, 0x3e00008, 0x0,
-0x3c020002, 0x8c42867c, 0x27bdffb0, 0xafbf0048,
-0xafbe0044, 0xafb50040, 0xafb3003c, 0xafb20038,
-0xafb10034, 0x104000c9, 0xafb00030, 0x8f4200d0,
-0x24430001, 0x2842000b, 0x144000dd, 0xaf4300d0,
-0x8f420004, 0x30420002, 0x14400097, 0xaf4000d0,
-0x8f420004, 0x3c030002, 0x8c63866c, 0x34420002,
-0xaf420004, 0x24020001, 0x14620003, 0x3c020600,
-0x10000002, 0x34423000, 0x34421000, 0xafa20020,
-0x1821, 0x8f5e0018, 0x27aa0020, 0x240200ff,
-0x13c20002, 0xafaa002c, 0x27c30001, 0x8c020228,
-0x609021, 0x1642000e, 0x1e38c0, 0x8f42033c,
-0x24420001, 0xaf42033c, 0x8f42033c, 0x8c020228,
-0x3c040001, 0x24847824, 0x3c050009, 0xafa00014,
-0xafa20010, 0x8fa60020, 0x1000006d, 0x34a50500,
-0xf71021, 0x8fa30020, 0x8fa40024, 0xac4304c0,
-0xac4404c4, 0x8f830054, 0x8f820054, 0x247003e8,
-0x2021023, 0x2c4203e9, 0x1040001b, 0x9821,
-0xe08821, 0x263504c0, 0x8f440178, 0x8f45017c,
-0x2201821, 0x240a0004, 0xafaa0010, 0xafb20014,
-0x8f48000c, 0x1021, 0x2f53021, 0xafa80018,
-0x8f48010c, 0x24070008, 0xa32821, 0xa3482b,
-0x822021, 0x100f809, 0x892021, 0x54400006,
-0x24130001, 0x8f820054, 0x2021023, 0x2c4203e9,
-0x1440ffe9, 0x0, 0x326200ff, 0x54400017,
-0xaf520018, 0x8f420378, 0x24420001, 0xaf420378,
-0x8f420378, 0x8f820120, 0x8faa002c, 0xafa20010,
-0x8f820124, 0x3c040001, 0x24847830, 0x3c050009,
-0xafa20014, 0x8d460000, 0x10000035, 0x34a50600,
-0x8f420308, 0x24130001, 0x24420001, 0xaf420308,
-0x8f420308, 0x1000001e, 0x326200ff, 0x8f830054,
-0x8f820054, 0x247003e8, 0x2021023, 0x2c4203e9,
-0x10400016, 0x9821, 0x3c150020, 0x24110010,
-0x8f42000c, 0x8f440160, 0x8f450164, 0x8f860120,
-0xafb10010, 0xafb20014, 0x551025, 0xafa20018,
-0x8f42010c, 0x24070008, 0x40f809, 0x24c6001c,
-0x1440ffe3, 0x0, 0x8f820054, 0x2021023,
-0x2c4203e9, 0x1440ffee, 0x0, 0x326200ff,
-0x14400011, 0x0, 0x8f420378, 0x24420001,
-0xaf420378, 0x8f420378, 0x8f820120, 0x8faa002c,
-0xafa20010, 0x8f820124, 0x3c040001, 0x24847838,
-0x3c050009, 0xafa20014, 0x8d460000, 0x34a50700,
-0xc002d3b, 0x3c03821, 0x8f4202ec, 0x24420001,
-0xaf4202ec, 0x8f4202ec, 0x8f420004, 0x30420001,
-0x1040001a, 0x24040001, 0x8f420250, 0x8f430254,
-0x8f4501b4, 0x3c010002, 0xa02485e9, 0x14650006,
-0x0, 0x8f420270, 0x8f430274, 0x8f4401b8,
-0x10640022, 0x0, 0x8f420250, 0x8f430254,
-0x3c040002, 0x908485e8, 0x8f460270, 0x8f470274,
-0x38840001, 0xaf4301b4, 0xaf4701b8, 0x3c010002,
-0xa02485e8, 0x10000026, 0x0, 0x8f4200d4,
-0x3c010002, 0xa02085e8, 0x24430001, 0x28420033,
-0x1440001f, 0xaf4300d4, 0x3c020002, 0x904285e9,
-0xaf4000d4, 0x10000018, 0x38420001, 0x8f420004,
-0x30420001, 0x10400009, 0x0, 0xc005c9f,
-0x2021, 0x3c010002, 0xa02085e9, 0x3c010002,
-0xa02085e8, 0x1000000e, 0x0, 0x8f4200d4,
-0x3c010002, 0xa02085e8, 0x24430001, 0x284201f5,
-0x14400007, 0xaf4300d4, 0x3c020002, 0x904285e9,
-0xaf4000d4, 0x421026, 0x3c010002, 0xa02285e9,
-0x3c030002, 0x8c63866c, 0x24020002, 0x1462000c,
-0x3c030002, 0x3c030002, 0x906385e9, 0x24020001,
-0x5462001f, 0x2021, 0x3c020002, 0x904285e8,
-0x1443001b, 0x24040005, 0x10000019, 0x24040006,
-0x3c020002, 0x8c42a8b4, 0x431024, 0x1040000b,
-0x24020001, 0x3c030002, 0x906385e9, 0x54620010,
-0x2021, 0x3c020002, 0x904285e8, 0x1443000c,
-0x24040003, 0x1000000a, 0x24040004, 0x3c030002,
-0x906385e9, 0x14620006, 0x2021, 0x3c020002,
-0x904285e8, 0x24040001, 0x50440001, 0x24040002,
-0xc005c9f, 0x0, 0x2402ff7f, 0x282a024,
-0x8fbf0048, 0x8fbe0044, 0x8fb50040, 0x8fb3003c,
-0x8fb20038, 0x8fb10034, 0x8fb00030, 0x3e00008,
-0x27bd0050, 0x3e00008, 0x0, 0x3c020002,
-0x8c42867c, 0x27bdffb0, 0xafbf0048, 0xafbe0044,
-0xafb50040, 0xafb3003c, 0xafb20038, 0xafb10034,
-0x104000de, 0xafb00030, 0x8f4200d0, 0x3c040002,
-0x8c84866c, 0x24430001, 0x2842000b, 0xaf4400e8,
-0x144000fe, 0xaf4300d0, 0x8f420004, 0x30420002,
-0x14400095, 0xaf4000d0, 0x8f420004, 0x34420002,
-0xaf420004, 0x24020001, 0x14820003, 0x3c020600,
-0x10000002, 0x34423000, 0x34421000, 0xafa20020,
-0x1821, 0x8f5e0018, 0x27aa0020, 0x240200ff,
-0x13c20002, 0xafaa002c, 0x27c30001, 0x8c020228,
-0x609021, 0x1642000e, 0x1e38c0, 0x8f42033c,
-0x24420001, 0xaf42033c, 0x8f42033c, 0x8c020228,
-0x3c040001, 0x24847824, 0x3c050009, 0xafa00014,
-0xafa20010, 0x8fa60020, 0x1000006d, 0x34a50500,
-0xf71021, 0x8fa30020, 0x8fa40024, 0xac4304c0,
-0xac4404c4, 0x8f830054, 0x8f820054, 0x247003e8,
-0x2021023, 0x2c4203e9, 0x1040001b, 0x9821,
-0xe08821, 0x263504c0, 0x8f440178, 0x8f45017c,
-0x2201821, 0x240a0004, 0xafaa0010, 0xafb20014,
-0x8f48000c, 0x1021, 0x2f53021, 0xafa80018,
-0x8f48010c, 0x24070008, 0xa32821, 0xa3482b,
-0x822021, 0x100f809, 0x892021, 0x54400006,
-0x24130001, 0x8f820054, 0x2021023, 0x2c4203e9,
-0x1440ffe9, 0x0, 0x326200ff, 0x54400017,
-0xaf520018, 0x8f420378, 0x24420001, 0xaf420378,
-0x8f420378, 0x8f820120, 0x8faa002c, 0xafa20010,
-0x8f820124, 0x3c040001, 0x24847830, 0x3c050009,
-0xafa20014, 0x8d460000, 0x10000035, 0x34a50600,
-0x8f420308, 0x24130001, 0x24420001, 0xaf420308,
-0x8f420308, 0x1000001e, 0x326200ff, 0x8f830054,
-0x8f820054, 0x247003e8, 0x2021023, 0x2c4203e9,
-0x10400016, 0x9821, 0x3c150020, 0x24110010,
-0x8f42000c, 0x8f440160, 0x8f450164, 0x8f860120,
-0xafb10010, 0xafb20014, 0x551025, 0xafa20018,
-0x8f42010c, 0x24070008, 0x40f809, 0x24c6001c,
-0x1440ffe3, 0x0, 0x8f820054, 0x2021023,
-0x2c4203e9, 0x1440ffee, 0x0, 0x326200ff,
-0x14400011, 0x0, 0x8f420378, 0x24420001,
-0xaf420378, 0x8f420378, 0x8f820120, 0x8faa002c,
-0xafa20010, 0x8f820124, 0x3c040001, 0x24847838,
-0x3c050009, 0xafa20014, 0x8d460000, 0x34a50700,
-0xc002d3b, 0x3c03821, 0x8f4202ec, 0x24420001,
-0xaf4202ec, 0x8f4202ec, 0x8f420004, 0x30420001,
-0x10400033, 0x3c020400, 0x2c21024, 0x10400017,
-0x0, 0x934205c0, 0x8f440250, 0x8f450254,
-0x8f4301b4, 0x34420020, 0x14a30006, 0xa34205c0,
-0x8f420270, 0x8f430274, 0x8f4401b8, 0x10640008,
-0x0, 0x8f420250, 0x8f430254, 0x934405c0,
-0x8f460270, 0x8f470274, 0x10000016, 0x38840040,
-0x934205c0, 0x10000048, 0x304200bf, 0x934205c0,
-0x8f440250, 0x8f450254, 0x8f4301b4, 0x304200bf,
-0x14a30006, 0xa34205c0, 0x8f420270, 0x8f430274,
-0x8f4401b8, 0x1064000b, 0x0, 0x8f420250,
-0x8f430254, 0x934405c0, 0x8f460270, 0x8f470274,
-0x38840020, 0xaf4301b4, 0xaf4701b8, 0x10000033,
-0xa34405c0, 0x934205c0, 0x1000002f, 0x34420020,
-0x934205c0, 0x8f4300d4, 0x34420020, 0xa34205c0,
-0x24620001, 0x10000023, 0x28630033, 0x8f4200e4,
-0x8f4300e0, 0x24420001, 0xaf4200e4, 0x43102a,
-0x14400006, 0x24030001, 0x8f4200e8, 0x14430002,
-0xaf4000e4, 0x24030004, 0xaf4300e8, 0x8f420004,
-0x30420001, 0x1040000d, 0x3c020400, 0x2c21024,
-0x10400007, 0x0, 0x934205c0, 0x34420040,
-0xa34205c0, 0x934205c0, 0x1000000f, 0x304200df,
-0x934205c0, 0x1000000c, 0x34420060, 0x934205c0,
-0x8f4300d4, 0x34420020, 0xa34205c0, 0x24620001,
-0x286300fb, 0x14600005, 0xaf4200d4, 0x934205c0,
-0xaf4000d4, 0x38420040, 0xa34205c0, 0x934205c0,
-0x8f4300e8, 0x3042007f, 0xa34205c0, 0x24020001,
-0x14620005, 0x0, 0x934405c0, 0x42102,
-0x10000003, 0x348400f0, 0x934405c0, 0x3484000f,
-0xc005c85, 0x0, 0x2402ff7f, 0x282a024,
-0x8fbf0048, 0x8fbe0044, 0x8fb50040, 0x8fb3003c,
-0x8fb20038, 0x8fb10034, 0x8fb00030, 0x3e00008,
-0x27bd0050, 0x3e00008, 0x0, 0x27bdffb0,
-0x274401c0, 0x26e30028, 0x24650400, 0x65102b,
-0xafbf0048, 0xafbe0044, 0xafb50040, 0xafb3003c,
-0xafb20038, 0xafb10034, 0x10400007, 0xafb00030,
-0x8c820000, 0xac620000, 0x24630004, 0x65102b,
-0x1440fffb, 0x24840004, 0x8c020080, 0xaee20044,
-0x8c0200c0, 0xaee20040, 0x8c020084, 0xaee20030,
-0x8c020084, 0xaee2023c, 0x8c020088, 0xaee20240,
-0x8c02008c, 0xaee20244, 0x8c020090, 0xaee20248,
-0x8c020094, 0xaee2024c, 0x8c020098, 0xaee20250,
-0x8c02009c, 0xaee20254, 0x8c0200a0, 0xaee20258,
-0x8c0200a4, 0xaee2025c, 0x8c0200a8, 0xaee20260,
-0x8c0200ac, 0xaee20264, 0x8c0200b0, 0xaee20268,
-0x8c0200b4, 0xaee2026c, 0x8c0200b8, 0xaee20270,
-0x8c0200bc, 0x24040001, 0xaee20274, 0xaee00034,
-0x41080, 0x571021, 0x8ee30034, 0x8c42023c,
-0x24840001, 0x621821, 0x2c82000f, 0xaee30034,
-0x1440fff8, 0x41080, 0x8c0200cc, 0xaee20048,
-0x8c0200d0, 0xaee2004c, 0x8c0200e0, 0xaee201f8,
-0x8c0200e4, 0xaee201fc, 0x8c0200e8, 0xaee20200,
-0x8c0200ec, 0xaee20204, 0x8c0200f0, 0xaee20208,
-0x8ee400c0, 0x8ee500c4, 0x8c0200fc, 0x45102b,
-0x1040000b, 0x0, 0x8ee200c0, 0x8ee300c4,
-0x24040001, 0x24050000, 0x651821, 0x65302b,
-0x441021, 0x461021, 0xaee200c0, 0xaee300c4,
-0x8c0200fc, 0x8ee400c0, 0x8ee500c4, 0x2408ffff,
-0x24090000, 0x401821, 0x1021, 0x882024,
-0xa92824, 0x822025, 0xa32825, 0xaee400c0,
-0xaee500c4, 0x8ee400d0, 0x8ee500d4, 0x8c0200f4,
-0x45102b, 0x1040000b, 0x0, 0x8ee200d0,
-0x8ee300d4, 0x24040001, 0x24050000, 0x651821,
-0x65302b, 0x441021, 0x461021, 0xaee200d0,
-0xaee300d4, 0x8c0200f4, 0x8ee400d0, 0x8ee500d4,
-0x401821, 0x1021, 0x882024, 0xa92824,
-0x822025, 0xa32825, 0xaee400d0, 0xaee500d4,
-0x8ee400c8, 0x8ee500cc, 0x8c0200f8, 0x45102b,
-0x1040000b, 0x0, 0x8ee200c8, 0x8ee300cc,
-0x24040001, 0x24050000, 0x651821, 0x65302b,
-0x441021, 0x461021, 0xaee200c8, 0xaee300cc,
-0x8c0200f8, 0x8ee400c8, 0x8ee500cc, 0x401821,
-0x1021, 0x882024, 0xa92824, 0x822025,
-0xa32825, 0x24020008, 0xaee400c8, 0xaee500cc,
-0xafa20010, 0xafa00014, 0x8f42000c, 0x8c040208,
-0x8c05020c, 0xafa20018, 0x8f42010c, 0x26e60028,
-0x40f809, 0x24070400, 0x104000f1, 0x3c020400,
-0xafa20020, 0x934205c6, 0x10400089, 0x1821,
-0x8f5e0018, 0x27aa0020, 0x240200ff, 0x13c20002,
-0xafaa002c, 0x27c30001, 0x8c020228, 0x609021,
-0x1642000e, 0x1e38c0, 0x8f42033c, 0x24420001,
-0xaf42033c, 0x8f42033c, 0x8c020228, 0x3c040001,
-0x24847824, 0x3c050009, 0xafa00014, 0xafa20010,
-0x8fa60020, 0x1000006b, 0x34a50500, 0xf71021,
-0x8fa30020, 0x8fa40024, 0xac4304c0, 0xac4404c4,
-0x8f830054, 0x8f820054, 0x247003e8, 0x2021023,
-0x2c4203e9, 0x1040001b, 0x9821, 0xe08821,
-0x263504c0, 0x8f440178, 0x8f45017c, 0x2201821,
-0x240a0004, 0xafaa0010, 0xafb20014, 0x8f48000c,
-0x1021, 0x2f53021, 0xafa80018, 0x8f48010c,
-0x24070008, 0xa32821, 0xa3482b, 0x822021,
-0x100f809, 0x892021, 0x54400006, 0x24130001,
-0x8f820054, 0x2021023, 0x2c4203e9, 0x1440ffe9,
-0x0, 0x326200ff, 0x54400017, 0xaf520018,
-0x8f420378, 0x24420001, 0xaf420378, 0x8f420378,
-0x8f820120, 0x8faa002c, 0xafa20010, 0x8f820124,
-0x3c040001, 0x24847830, 0x3c050009, 0xafa20014,
-0x8d460000, 0x10000033, 0x34a50600, 0x8f420308,
-0x24130001, 0x24420001, 0xaf420308, 0x8f420308,
-0x1000001c, 0x326200ff, 0x8f830054, 0x8f820054,
-0x247003e8, 0x2021023, 0x2c4203e9, 0x10400014,
-0x9821, 0x24110010, 0x8f42000c, 0x8f440160,
-0x8f450164, 0x8f860120, 0xafb10010, 0xafb20014,
-0xafa20018, 0x8f42010c, 0x24070008, 0x40f809,
-0x24c6001c, 0x1440ffe5, 0x0, 0x8f820054,
-0x2021023, 0x2c4203e9, 0x1440ffef, 0x0,
-0x326200ff, 0x54400012, 0x24020001, 0x8f420378,
-0x24420001, 0xaf420378, 0x8f420378, 0x8f820120,
-0x8faa002c, 0xafa20010, 0x8f820124, 0x3c040001,
-0x24847838, 0x3c050009, 0xafa20014, 0x8d460000,
-0x34a50700, 0xc002d3b, 0x3c03821, 0x1021,
-0x1440005b, 0x24020001, 0x10000066, 0x0,
-0x8f510018, 0x240200ff, 0x12220002, 0x8021,
-0x26300001, 0x8c020228, 0x1602000e, 0x1130c0,
-0x8f42033c, 0x24420001, 0xaf42033c, 0x8f42033c,
-0x8c020228, 0x3c040001, 0x2484780c, 0x3c050009,
-0xafa00014, 0xafa20010, 0x8fa60020, 0x1000003f,
-0x34a50100, 0xd71021, 0x8fa30020, 0x8fa40024,
-0xac4304c0, 0xac4404c4, 0xc01821, 0x8f440178,
-0x8f45017c, 0x1021, 0x24070004, 0xafa70010,
-0xafb00014, 0x8f48000c, 0x24c604c0, 0x2e63021,
-0xafa80018, 0x8f48010c, 0x24070008, 0xa32821,
-0xa3482b, 0x822021, 0x100f809, 0x892021,
-0x1440000b, 0x24070008, 0x8f820120, 0xafa20010,
-0x8f820124, 0x3c040001, 0x24847814, 0x3c050009,
-0xafa20014, 0x8fa60020, 0x1000001c, 0x34a50200,
-0x8f440160, 0x8f450164, 0x8f43000c, 0xaf500018,
-0x8f860120, 0x24020010, 0xafa20010, 0xafb00014,
-0xafa30018, 0x8f42010c, 0x40f809, 0x24c6001c,
-0x54400011, 0x24020001, 0x8f420340, 0x24420001,
-0xaf420340, 0x8f420340, 0x8f820120, 0xafa20010,
-0x8f820124, 0x3c040001, 0x2484781c, 0x3c050009,
-0xafa20014, 0x8fa60020, 0x34a50300, 0xc002d3b,
-0x2203821, 0x1021, 0x1040000e, 0x24020001,
-0x8f4202e8, 0xa34005c6, 0xaf4001b0, 0x24420001,
-0xaf4202e8, 0x8f4202e8, 0x8ee20150, 0x24420001,
-0xaee20150, 0x8ee20150, 0x10000003, 0x0,
-0x24020001, 0xa34205c6, 0x8fbf0048, 0x8fbe0044,
-0x8fb50040, 0x8fb3003c, 0x8fb20038, 0x8fb10034,
-0x8fb00030, 0x3e00008, 0x27bd0050, 0x27bdffd8,
-0xafbf0020, 0x8f8200b0, 0x30420004, 0x10400069,
-0x0, 0x8f430128, 0x8f820104, 0x14620005,
-0x0, 0x8f430130, 0x8f8200b4, 0x10620006,
-0x0, 0x8f820104, 0xaf420128, 0x8f8200b4,
-0x1000005c, 0xaf420130, 0x8f8200b0, 0x3c030080,
-0x431024, 0x1040000e, 0x0, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f8200b0, 0x2403fffb,
-0x431024, 0xaf8200b0, 0x8f82011c, 0x2403fffd,
-0x431024, 0xaf82011c, 0x1000004a, 0x0,
-0x8f430128, 0x8f820104, 0x14620005, 0x0,
-0x8f430130, 0x8f8200b4, 0x10620010, 0x0,
-0x8f820104, 0xaf420128, 0x8f8200b4, 0x8f430128,
-0xaf420130, 0xafa30010, 0x8f420130, 0x3c040001,
-0x24847874, 0xafa20014, 0x8f86011c, 0x8f8700b0,
-0x3c050005, 0x10000031, 0x34a50900, 0x8f420128,
-0xafa20010, 0x8f420130, 0x3c040001, 0x24847880,
-0xafa20014, 0x8f86011c, 0x8f8700b0, 0x3c050005,
-0xc002d3b, 0x34a51000, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f830104, 0x8f8200b0, 0x34420001,
-0xaf8200b0, 0x24020008, 0xaf830104, 0xafa20010,
-0xafa00014, 0x8f42000c, 0x8c040208, 0x8c05020c,
-0xafa20018, 0x8f42010c, 0x26e60028, 0x40f809,
-0x24070400, 0x8f82011c, 0x2403fffd, 0x431024,
-0xaf82011c, 0x8ee201dc, 0x24420001, 0xaee201dc,
-0x8ee201dc, 0x8f420128, 0xafa20010, 0x8f420130,
-0x3c040001, 0x2484788c, 0xafa20014, 0x8f86011c,
-0x8f8700b0, 0x3c050005, 0x34a51100, 0xc002d3b,
-0x0, 0x8f8200a0, 0x30420004, 0x1040006a,
-0x0, 0x8f43012c, 0x8f820124, 0x14620005,
-0x0, 0x8f430134, 0x8f8200a4, 0x10620006,
-0x0, 0x8f820124, 0xaf42012c, 0x8f8200a4,
-0x1000005d, 0xaf420134, 0x8f8200a0, 0x3c030080,
-0x431024, 0x1040000e, 0x0, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f8200a0, 0x2403fffb,
-0x431024, 0xaf8200a0, 0x8f82011c, 0x2403fffd,
-0x431024, 0xaf82011c, 0x1000004b, 0x0,
-0x8f43012c, 0x8f820124, 0x14620005, 0x0,
-0x8f430134, 0x8f8200a4, 0x10620010, 0x0,
-0x8f820124, 0xaf42012c, 0x8f8200a4, 0x8f43012c,
-0xaf420134, 0xafa30010, 0x8f420134, 0x3c040001,
-0x24847898, 0xafa20014, 0x8f86011c, 0x8f8700a0,
-0x3c050005, 0x10000032, 0x34a51200, 0x8f42012c,
-0xafa20010, 0x8f420134, 0x3c040001, 0x248478a4,
-0xafa20014, 0x8f86011c, 0x8f8700a0, 0x3c050005,
-0xc002d3b, 0x34a51300, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f830124, 0x8f8200a0, 0x34420001,
-0xaf8200a0, 0x24020080, 0xaf830124, 0xafa20010,
-0xafa00014, 0x8f420014, 0x8c040208, 0x8c05020c,
-0xafa20018, 0x8f420108, 0x3c060002, 0x24c68794,
-0x40f809, 0x24070004, 0x8f82011c, 0x2403fffd,
-0x431024, 0xaf82011c, 0x8ee201dc, 0x24420001,
-0xaee201dc, 0x8ee201dc, 0x8f42012c, 0xafa20010,
-0x8f420134, 0x3c040001, 0x248478b0, 0xafa20014,
-0x8f86011c, 0x8f8700a0, 0x3c050005, 0x34a51400,
-0xc002d3b, 0x0, 0x8fbf0020, 0x3e00008,
-0x27bd0028, 0x3c081000, 0x24070001, 0x3c060080,
-0x3c050100, 0x8f820070, 0x481024, 0x1040fffd,
-0x0, 0x8f820054, 0x24420005, 0xaf820078,
-0x8c040234, 0x10800017, 0x1821, 0x3c020001,
-0x571021, 0x8c4240e8, 0x24420005, 0x3c010001,
-0x370821, 0xac2240e8, 0x3c020001, 0x571021,
-0x8c4240e8, 0x44102b, 0x1440000a, 0x0,
-0x3c030080, 0x3c010001, 0x370821, 0xac2040e8,
-0x3c010001, 0x370821, 0xa02740f0, 0x1000000b,
-0x0, 0x3c020001, 0x571021, 0x904240f0,
-0x54400006, 0x661825, 0x3c020001, 0x571021,
-0x904240f1, 0x54400001, 0x661825, 0x8c040230,
-0x10800013, 0x0, 0x3c020001, 0x571021,
-0x8c4240ec, 0x24420005, 0x3c010001, 0x370821,
-0xac2240ec, 0x3c020001, 0x571021, 0x8c4240ec,
-0x44102b, 0x14400006, 0x0, 0x3c010001,
-0x370821, 0xac2040ec, 0x10000006, 0x651825,
-0x3c020001, 0x571021, 0x904240f2, 0x54400001,
-0x651825, 0x1060ffbb, 0x0, 0x8f420000,
-0x10400007, 0x0, 0xaf80004c, 0x8f82004c,
-0x1040fffd, 0x0, 0x10000005, 0x0,
-0xaf800048, 0x8f820048, 0x1040fffd, 0x0,
-0x8f820060, 0x431025, 0xaf820060, 0x8f420000,
-0x10400004, 0x0, 0xaf80004c, 0x1000ffa5,
-0x0, 0xaf800048, 0x1000ffa2, 0x0,
-0x3e00008, 0x0, 0x27bdffe0, 0xafbf0018,
-0x8f860064, 0x30c20004, 0x10400026, 0x24040004,
-0x8c020114, 0xaf420020, 0xaf840064, 0x8f4202fc,
-0x24420001, 0xaf4202fc, 0x8f4202fc, 0x8f820064,
-0x30420004, 0x14400005, 0x0, 0x8c030114,
-0x8f420020, 0x1462fff2, 0x0, 0x8f420000,
-0x8f43003c, 0x10400007, 0x0, 0xaf80004c,
-0x8f82004c, 0x1040fffd, 0x0, 0x10000005,
-0x0, 0xaf800048, 0x8f820048, 0x1040fffd,
-0x0, 0x8f820060, 0x431025, 0xaf820060,
-0x8f420000, 0x10400074, 0x0, 0x1000006f,
-0x0, 0x30c20008, 0x10400020, 0x24040008,
-0x8c02011c, 0xaf420048, 0xaf840064, 0x8f4202a8,
-0x24420001, 0xaf4202a8, 0x8f4202a8, 0x8f820064,
-0x30420008, 0x14400005, 0x0, 0x8c03011c,
-0x8f420048, 0x1462fff2, 0x0, 0x8f420000,
-0x10400007, 0x0, 0xaf80004c, 0x8f82004c,
-0x1040fffd, 0x0, 0x10000005, 0x0,
-0xaf800048, 0x8f820048, 0x1040fffd, 0x0,
-0x8f820060, 0x1000ffd9, 0x34420200, 0x30c20020,
-0x10400023, 0x24040020, 0x8c02012c, 0xaf420068,
-0xaf840064, 0x8f4202d8, 0x24420001, 0xaf4202d8,
-0x8f4202d8, 0x8f820064, 0x30420020, 0x14400005,
-0x32c24000, 0x8c03012c, 0x8f420068, 0x1462fff2,
-0x32c24000, 0x14400002, 0x3c020001, 0x2c2b025,
-0x8f420000, 0x10400007, 0x0, 0xaf80004c,
-0x8f82004c, 0x1040fffd, 0x0, 0x10000005,
-0x0, 0xaf800048, 0x8f820048, 0x1040fffd,
-0x0, 0x8f820060, 0x1000ffb4, 0x34420800,
-0x30c20010, 0x1040002b, 0x24040010, 0x8c020124,
-0xaf420058, 0xaf840064, 0x8f4202d4, 0x24420001,
-0xaf4202d4, 0x8f4202d4, 0x8f820064, 0x30420010,
-0x14400005, 0x32c22000, 0x8c030124, 0x8f420058,
-0x1462fff2, 0x32c22000, 0x50400001, 0x36d68000,
-0x8f420000, 0x10400007, 0x0, 0xaf80004c,
-0x8f82004c, 0x1040fffd, 0x0, 0x10000005,
-0x0, 0xaf800048, 0x8f820048, 0x1040fffd,
-0x0, 0x8f820060, 0x34420100, 0xaf820060,
-0x8f420000, 0x10400004, 0x0, 0xaf80004c,
-0x10000072, 0x0, 0xaf800048, 0x1000006f,
-0x0, 0x30c20001, 0x10400004, 0x24020001,
-0xaf820064, 0x10000069, 0x0, 0x30c20002,
-0x1440000c, 0x3c050003, 0x3c040001, 0x24847974,
-0x34a50500, 0x3821, 0xafa00010, 0xc002d3b,
-0xafa00014, 0x2402ffc0, 0xaf820064, 0x1000005b,
-0x0, 0x8c05022c, 0x8c02010c, 0x10a2004c,
-0x51080, 0x8c460300, 0x24a20001, 0x3045003f,
-0x24020003, 0xac05022c, 0x61e02, 0x10620005,
-0x24020010, 0x1062001e, 0x30c20fff, 0x1000003d,
-0x0, 0x8f4302a8, 0x8f440000, 0x30c20fff,
-0xaf420048, 0x24630001, 0xaf4302a8, 0x8f4202a8,
-0x10800007, 0x0, 0xaf80004c, 0x8f82004c,
-0x1040fffd, 0x0, 0x10000005, 0x0,
-0xaf800048, 0x8f820048, 0x1040fffd, 0x0,
-0x8f820060, 0x34420200, 0xaf820060, 0x8f420000,
-0x10400021, 0x0, 0x1000001c, 0x0,
-0xaf420058, 0x32c22000, 0x50400001, 0x36d68000,
-0x8f4202d4, 0x8f430000, 0x24420001, 0xaf4202d4,
-0x8f4202d4, 0x10600007, 0x0, 0xaf80004c,
-0x8f82004c, 0x1040fffd, 0x0, 0x10000005,
-0x0, 0xaf800048, 0x8f820048, 0x1040fffd,
-0x0, 0x8f820060, 0x34420100, 0xaf820060,
-0x8f420000, 0x10400004, 0x0, 0xaf80004c,
-0x10000007, 0x0, 0xaf800048, 0x10000004,
-0x0, 0xc0022ad, 0xc02021, 0x402821,
-0x8c02010c, 0x14a20002, 0x24020002, 0xaf820064,
-0x8f820064, 0x30420002, 0x14400004, 0x0,
-0x8c02010c, 0x14a2ffa8, 0x0, 0x8fbf0018,
-0x3e00008, 0x27bd0020, 0x3e00008, 0x0,
-0x27bdffa0, 0xafb00040, 0x808021, 0x101602,
-0x2442ffff, 0x304300ff, 0x2c620013, 0xafbf0058,
-0xafbe0054, 0xafb50050, 0xafb3004c, 0xafb20048,
-0xafb10044, 0x104001fe, 0xafa50034, 0x31080,
-0x3c010001, 0x220821, 0x8c2279b8, 0x400008,
-0x0, 0x101302, 0x30440fff, 0x24020001,
-0x10820005, 0x24020002, 0x1082000c, 0x2402fffe,
-0x10000025, 0x3c050003, 0x8f430004, 0x3c020002,
-0x8c4287c0, 0xaf440200, 0xaf440204, 0x3c040002,
-0x8c84873c, 0x10000009, 0x34630001, 0x8f430004,
-0xaf440200, 0xaf440204, 0x3c040002, 0x8c84873c,
-0x621824, 0x3c020001, 0x2442d68c, 0x21100,
-0x21182, 0xaf430004, 0x3c030800, 0x431025,
-0xac820038, 0x8f840054, 0x41442, 0x41c82,
-0x431021, 0x41cc2, 0x431023, 0x41d02,
-0x431021, 0x41d42, 0x431023, 0xaf420208,
-0x10000009, 0x0, 0x3c040001, 0x24847980,
-0x34a51000, 0x2003021, 0x3821, 0xafa00010,
-0xc002d3b, 0xafa00014, 0x8f4202a0, 0x24420001,
-0xaf4202a0, 0x8f4202a0, 0x10000228, 0x0,
-0x27b00028, 0x2002021, 0x24050210, 0xc002dbf,
-0x24060008, 0xc00263a, 0x2002021, 0x1000021f,
-0x0, 0x8faa0034, 0x27a40028, 0xa1880,
-0x25420001, 0x3042003f, 0xafa20034, 0x8c650300,
-0x8faa0034, 0x21080, 0x8c430300, 0x25420001,
-0x3042003f, 0xafa20034, 0xac02022c, 0xafa50028,
-0xc00263a, 0xafa3002c, 0x1000020c, 0x0,
-0x27b00028, 0x2002021, 0x24050210, 0xc002dbf,
-0x24060008, 0xc002779, 0x2002021, 0x10000203,
-0x0, 0x8faa0034, 0x27a40028, 0xa1880,
-0x25420001, 0x3042003f, 0xafa20034, 0x8c650300,
-0x8faa0034, 0x21080, 0x8c430300, 0x25420001,
-0x3042003f, 0xafa20034, 0xac02022c, 0xafa50028,
-0xc002779, 0xafa3002c, 0x100001f0, 0x0,
-0x101302, 0x30430fff, 0x24020001, 0x10620005,
-0x24020002, 0x1062001e, 0x3c020002, 0x10000033,
-0x3c050003, 0x3c030002, 0x2c31024, 0x54400037,
-0x2c3b025, 0x8f820228, 0x3c010001, 0x370821,
-0xac2238d8, 0x8f82022c, 0x3c010001, 0x370821,
-0xac2238dc, 0x8f820230, 0x3c010001, 0x370821,
-0xac2238e0, 0x8f820234, 0x3c010001, 0x370821,
-0xac2238e4, 0x2402ffff, 0xaf820228, 0xaf82022c,
-0xaf820230, 0xaf820234, 0x10000020, 0x2c3b025,
-0x2c21024, 0x10400012, 0x3c02fffd, 0x3c020001,
-0x571021, 0x8c4238d8, 0xaf820228, 0x3c020001,
-0x571021, 0x8c4238dc, 0xaf82022c, 0x3c020001,
-0x571021, 0x8c4238e0, 0xaf820230, 0x3c020001,
-0x571021, 0x8c4238e4, 0xaf820234, 0x3c02fffd,
-0x3442ffff, 0x10000009, 0x2c2b024, 0x3c040001,
-0x2484798c, 0x34a51100, 0x2003021, 0x3821,
-0xafa00010, 0xc002d3b, 0xafa00014, 0x8f4202cc,
-0x24420001, 0xaf4202cc, 0x8f4202cc, 0x100001a7,
-0x0, 0x101302, 0x30450fff, 0x24020001,
-0x10a20005, 0x24020002, 0x10a2000e, 0x3c0408ff,
-0x10000016, 0x3c050003, 0x3c0208ff, 0x3442ffff,
-0x8f830220, 0x3c040004, 0x2c4b025, 0x621824,
-0x34630008, 0xaf830220, 0xaf450298, 0x10000013,
-0x0, 0x3484fff7, 0x3c03fffb, 0x8f820220,
-0x3463ffff, 0x2c3b024, 0x441024, 0xaf820220,
-0xaf450298, 0x10000009, 0x0, 0x3c040001,
-0x24847998, 0x34a51200, 0x2003021, 0x3821,
-0xafa00010, 0xc002d3b, 0xafa00014, 0x8f4202bc,
-0x24420001, 0xaf4202bc, 0x8f4202bc, 0x1000017b,
-0x0, 0x27840208, 0x24050200, 0xc002dbf,
-0x24060008, 0x27440224, 0x24050200, 0xc002dbf,
-0x24060008, 0x8f4202c4, 0x24420001, 0xaf4202c4,
-0x8f4202c4, 0x1000016d, 0x0, 0x101302,
-0x30430fff, 0x24020001, 0x10620011, 0x28620002,
-0x50400005, 0x24020002, 0x10600007, 0x0,
-0x10000017, 0x0, 0x1062000f, 0x0,
-0x10000013, 0x0, 0x8c060248, 0x2021,
-0xc005738, 0x24050004, 0x10000007, 0x0,
-0x8c060248, 0x2021, 0xc005738, 0x24050004,
-0x10000010, 0x0, 0x8c06024c, 0x2021,
-0xc005738, 0x24050001, 0x1000000a, 0x0,
-0x3c040001, 0x248479a4, 0x3c050003, 0x34a51300,
-0x2003021, 0x3821, 0xafa00010, 0xc002d3b,
-0xafa00014, 0x8f4202c0, 0x24420001, 0xaf4202c0,
-0x8f4202c0, 0x1000013d, 0x0, 0xc002548,
-0x0, 0x10000139, 0x0, 0x24020001,
-0xa34205c5, 0x24100100, 0x8f4401a8, 0x8f4501ac,
-0xafb00010, 0xafa00014, 0x8f420014, 0xafa20018,
-0x8f420108, 0x26e60028, 0x40f809, 0x24070400,
-0x1040fff5, 0x0, 0x10000128, 0x0,
-0x3c03ffff, 0x34637fff, 0x8f420368, 0x8f440360,
-0x2c3b024, 0x1821, 0xaf400058, 0xaf40005c,
-0xaf400060, 0xaf400064, 0x441023, 0xaf420368,
-0x3c020900, 0xaf400360, 0xafa20020, 0x8f5e0018,
-0x27aa0020, 0x240200ff, 0x13c20002, 0xafaa003c,
-0x27c30001, 0x8c020228, 0x609021, 0x1642000e,
-0x1e38c0, 0x8f42033c, 0x24420001, 0xaf42033c,
-0x8f42033c, 0x8c020228, 0x3c040001, 0x2484793c,
-0x3c050009, 0xafa00014, 0xafa20010, 0x8fa60020,
-0x1000006b, 0x34a50500, 0xf71021, 0x8fa30020,
-0x8fa40024, 0xac4304c0, 0xac4404c4, 0x8f830054,
-0x8f820054, 0x247003e8, 0x2021023, 0x2c4203e9,
-0x1040001b, 0x9821, 0xe08821, 0x263504c0,
-0x8f440178, 0x8f45017c, 0x2201821, 0x240a0004,
-0xafaa0010, 0xafb20014, 0x8f48000c, 0x1021,
-0x2f53021, 0xafa80018, 0x8f48010c, 0x24070008,
-0xa32821, 0xa3482b, 0x822021, 0x100f809,
-0x892021, 0x54400006, 0x24130001, 0x8f820054,
-0x2021023, 0x2c4203e9, 0x1440ffe9, 0x0,
-0x326200ff, 0x54400017, 0xaf520018, 0x8f420378,
-0x24420001, 0xaf420378, 0x8f420378, 0x8f820120,
-0x8faa003c, 0xafa20010, 0x8f820124, 0x3c040001,
-0x24847948, 0x3c050009, 0xafa20014, 0x8d460000,
-0x10000033, 0x34a50600, 0x8f420308, 0x24130001,
-0x24420001, 0xaf420308, 0x8f420308, 0x1000001c,
-0x326200ff, 0x8f830054, 0x8f820054, 0x247003e8,
-0x2021023, 0x2c4203e9, 0x10400014, 0x9821,
-0x24110010, 0x8f42000c, 0x8f440160, 0x8f450164,
-0x8f860120, 0xafb10010, 0xafb20014, 0xafa20018,
-0x8f42010c, 0x24070008, 0x40f809, 0x24c6001c,
-0x1440ffe5, 0x0, 0x8f820054, 0x2021023,
-0x2c4203e9, 0x1440ffef, 0x0, 0x326200ff,
-0x14400011, 0x0, 0x8f420378, 0x24420001,
-0xaf420378, 0x8f420378, 0x8f820120, 0x8faa003c,
-0xafa20010, 0x8f820124, 0x3c040001, 0x24847950,
-0x3c050009, 0xafa20014, 0x8d460000, 0x34a50700,
-0xc002d3b, 0x3c03821, 0x8f4202b0, 0x24420001,
-0xaf4202b0, 0x8f4202b0, 0x8f4202f8, 0x24420001,
-0xaf4202f8, 0x8f4202f8, 0x1000008c, 0x0,
-0x8c02025c, 0x27440224, 0xaf4201f0, 0x8c020260,
-0x24050200, 0x24060008, 0xaf4201f8, 0xc002dbf,
-0x0, 0x8f820220, 0x30420008, 0x14400002,
-0x24020001, 0x24020002, 0xaf420298, 0x8f4202ac,
-0x24420001, 0xaf4202ac, 0x8f4202ac, 0x10000077,
-0x0, 0x3c0200ff, 0x3442ffff, 0x2021824,
-0x32c20180, 0x14400006, 0x3402fffb, 0x43102b,
-0x14400003, 0x0, 0x1000006c, 0xaf4300bc,
-0x3c040001, 0x248479b0, 0x3c050003, 0x34a51500,
-0x2003021, 0x3821, 0xafa00010, 0xc002d3b,
-0xafa00014, 0x3c020700, 0x34421000, 0x101e02,
-0x621825, 0xafa30020, 0x8f510018, 0x240200ff,
-0x12220002, 0x8021, 0x26300001, 0x8c020228,
-0x1602000e, 0x1130c0, 0x8f42033c, 0x24420001,
-0xaf42033c, 0x8f42033c, 0x8c020228, 0x3c040001,
-0x24847924, 0x3c050009, 0xafa00014, 0xafa20010,
-0x8fa60020, 0x1000003f, 0x34a50100, 0xd71021,
-0x8fa30020, 0x8fa40024, 0xac4304c0, 0xac4404c4,
-0xc01821, 0x8f440178, 0x8f45017c, 0x1021,
-0x24070004, 0xafa70010, 0xafb00014, 0x8f48000c,
-0x24c604c0, 0x2e63021, 0xafa80018, 0x8f48010c,
-0x24070008, 0xa32821, 0xa3482b, 0x822021,
-0x100f809, 0x892021, 0x1440000b, 0x24070008,
-0x8f820120, 0xafa20010, 0x8f820124, 0x3c040001,
-0x2484792c, 0x3c050009, 0xafa20014, 0x8fa60020,
-0x1000001c, 0x34a50200, 0x8f440160, 0x8f450164,
-0x8f43000c, 0xaf500018, 0x8f860120, 0x24020010,
-0xafa20010, 0xafb00014, 0xafa30018, 0x8f42010c,
-0x40f809, 0x24c6001c, 0x14400010, 0x0,
-0x8f420340, 0x24420001, 0xaf420340, 0x8f420340,
-0x8f820120, 0xafa20010, 0x8f820124, 0x3c040001,
-0x24847934, 0x3c050009, 0xafa20014, 0x8fa60020,
-0x34a50300, 0xc002d3b, 0x2203821, 0x8f4202e0,
-0x24420001, 0xaf4202e0, 0x8f4202e0, 0x8f4202f0,
-0x24420001, 0xaf4202f0, 0x8f4202f0, 0x8fa20034,
-0x8fbf0058, 0x8fbe0054, 0x8fb50050, 0x8fb3004c,
-0x8fb20048, 0x8fb10044, 0x8fb00040, 0x3e00008,
-0x27bd0060, 0x27bdfff8, 0x2408ffff, 0x10a00014,
-0x4821, 0x3c0aedb8, 0x354a8320, 0x90870000,
-0x24840001, 0x3021, 0x1071026, 0x30420001,
-0x10400002, 0x81842, 0x6a1826, 0x604021,
-0x24c60001, 0x2cc20008, 0x1440fff7, 0x73842,
-0x25290001, 0x125102b, 0x1440fff0, 0x0,
-0x1001021, 0x3e00008, 0x27bd0008, 0x27bdffb0,
-0xafbf0048, 0xafbe0044, 0xafb50040, 0xafb3003c,
-0xafb20038, 0xafb10034, 0xafb00030, 0x8f870220,
-0xafa70024, 0x8f870200, 0xafa7002c, 0x8f820220,
-0x3c0308ff, 0x3463ffff, 0x431024, 0x34420004,
-0xaf820220, 0x8f820200, 0x3c03c0ff, 0x3463ffff,
-0x431024, 0x34420004, 0xaf820200, 0x8f530358,
-0x8f55035c, 0x8f5e0360, 0x8f470364, 0xafa70014,
-0x8f470368, 0xafa7001c, 0x8f4202d0, 0x274401c0,
-0x24420001, 0xaf4202d0, 0x8f5002d0, 0x8f510204,
-0x8f520200, 0xc002da8, 0x24050400, 0xaf530358,
-0xaf55035c, 0xaf5e0360, 0x8fa70014, 0xaf470364,
-0x8fa7001c, 0xaf470368, 0xaf5002d0, 0xaf510204,
-0xaf520200, 0x8c02025c, 0x27440224, 0xaf4201f0,
-0x8c020260, 0x24050200, 0x24060008, 0xaf4201f8,
-0x24020006, 0xaf4201f4, 0xc002dbf, 0x0,
-0x3c023b9a, 0x3442ca00, 0xaf4201fc, 0x240203e8,
-0x24040002, 0x24030001, 0xaf420294, 0xaf440290,
-0xaf43029c, 0x8f820220, 0x30420008, 0x10400004,
-0x0, 0xaf430298, 0x10000003, 0x3021,
-0xaf440298, 0x3021, 0x3c030002, 0x661821,
-0x906385ec, 0x3461021, 0x24c60001, 0xa043022c,
-0x2cc2000f, 0x1440fff8, 0x3461821, 0x24c60001,
-0x8f820040, 0x24040080, 0x24050080, 0x21702,
-0x24420030, 0xa062022c, 0x3461021, 0xa040022c,
-0xc002da8, 0x0, 0x8fa70024, 0x30e20004,
-0x14400006, 0x0, 0x8f820220, 0x3c0308ff,
-0x3463fffb, 0x431024, 0xaf820220, 0x8fa7002c,
-0x30e20004, 0x14400006, 0x0, 0x8f820200,
-0x3c03c0ff, 0x3463fffb, 0x431024, 0xaf820200,
-0x8fbf0048, 0x8fbe0044, 0x8fb50040, 0x8fb3003c,
-0x8fb20038, 0x8fb10034, 0x8fb00030, 0x3e00008,
-0x27bd0050, 0xaf400104, 0x24040001, 0x410c0,
-0x2e21821, 0x24820001, 0x3c010001, 0x230821,
-0xa42234d0, 0x402021, 0x2c820080, 0x1440fff8,
-0x410c0, 0x24020001, 0x3c010001, 0x370821,
-0xa42038d0, 0xaf420100, 0xaf800228, 0xaf80022c,
-0xaf800230, 0xaf800234, 0x3e00008, 0x0,
-0x27bdffe8, 0xafbf0014, 0xafb00010, 0x8f420104,
-0x28420005, 0x10400026, 0x808021, 0x3c020001,
-0x8f430104, 0x344230d0, 0x2e23021, 0x318c0,
-0x621821, 0x2e33821, 0xc7102b, 0x10400015,
-0x1021, 0x96080000, 0x24c40006, 0x9482fffc,
-0x14480009, 0x2821, 0x9483fffe, 0x96020002,
-0x14620006, 0xa01021, 0x94820000, 0x96030004,
-0x431026, 0x2c450001, 0xa01021, 0x1440000a,
-0x24c60008, 0xc7102b, 0x1440fff0, 0x24840008,
-0x1021, 0x304200ff, 0x14400030, 0x24020001,
-0x1000002e, 0x1021, 0x1000fffa, 0x24020001,
-0x2002021, 0xc00252e, 0x24050006, 0x3042007f,
-0x218c0, 0x2e31021, 0x3c010001, 0x220821,
-0x942230d0, 0x1040fff2, 0x2e31021, 0x3c060001,
-0xc23021, 0x94c630d0, 0x10c0ffed, 0x3c080001,
-0x350834d2, 0x96070000, 0x610c0, 0x572021,
-0x882021, 0x94820000, 0x14470009, 0x2821,
-0x94830002, 0x96020002, 0x14620006, 0xa01021,
-0x94820004, 0x96030004, 0x431026, 0x2c450001,
-0xa01021, 0x14400007, 0x610c0, 0x2e21021,
-0x3c060001, 0xc23021, 0x94c634d0, 0x14c0ffeb,
-0x610c0, 0x10c0ffd2, 0x24020001, 0x8fbf0014,
-0x8fb00010, 0x3e00008, 0x27bd0018, 0x3e00008,
-0x0, 0x27bdffb0, 0x801021, 0xafb00030,
-0x24500002, 0x2002021, 0x24050006, 0xafb10034,
-0x408821, 0xafbf0048, 0xafbe0044, 0xafb50040,
-0xafb3003c, 0xc00252e, 0xafb20038, 0x3047007f,
-0x710c0, 0x2e21021, 0x3c050001, 0xa22821,
-0x94a530d0, 0x50a0001c, 0xa03021, 0x3c090001,
-0x352934d2, 0x96280002, 0x510c0, 0x572021,
-0x892021, 0x94820000, 0x14480009, 0x3021,
-0x94830002, 0x96020002, 0x14620006, 0xc01021,
-0x94820004, 0x96030004, 0x431026, 0x2c460001,
-0xc01021, 0x14400007, 0x510c0, 0x2e21021,
-0x3c050001, 0xa22821, 0x94a534d0, 0x14a0ffeb,
-0x510c0, 0xa03021, 0x10c00014, 0x610c0,
-0x571821, 0x3c010001, 0x230821, 0x8c2334d0,
-0x571021, 0xafa30010, 0x3c010001, 0x220821,
-0x8c2234d4, 0x3c040001, 0x24847ab8, 0xafa20014,
-0x8e260000, 0x8e270004, 0x3c050004, 0xc002d3b,
-0x34a50400, 0x10000063, 0x3c020800, 0x8f450100,
-0x10a00006, 0x510c0, 0x2e21021, 0x3c010001,
-0x220821, 0x942234d0, 0xaf420100, 0xa03021,
-0x14c00011, 0x628c0, 0x710c0, 0x2e21021,
-0xafa70010, 0x3c010001, 0x220821, 0x942230d0,
-0x3c040001, 0x24847ac4, 0xafa20014, 0x8e260000,
-0x8e270004, 0x3c050004, 0xc002d3b, 0x34a50500,
-0x10000048, 0x3c020800, 0xb71821, 0x3c020001,
-0x96040000, 0x344234d2, 0x621821, 0xa4640000,
-0x8e020002, 0x720c0, 0xac620002, 0x2e41021,
-0x3c030001, 0x621821, 0x946330d0, 0x2e51021,
-0x3c010001, 0x220821, 0xa42334d0, 0x2e41021,
-0x3c010001, 0x220821, 0xa42630d0, 0x8f420104,
-0x24420001, 0x28420080, 0x1040000f, 0x3c020002,
-0x8f420104, 0x3c040001, 0x348430d2, 0x96030000,
-0x210c0, 0x571021, 0x441021, 0xa4430000,
-0x8e030002, 0xac430002, 0x8f420104, 0x24420001,
-0xaf420104, 0x3c020002, 0x2c21024, 0x10400011,
-0x72142, 0x3c030001, 0x346338d8, 0x24020003,
-0x441023, 0x21080, 0x572021, 0x832021,
-0x571021, 0x431021, 0x30e5001f, 0x8c430000,
-0x24020001, 0xa21004, 0x621825, 0x1000000c,
-0xac830000, 0x24020003, 0x441023, 0x21080,
-0x5c2821, 0x5c1021, 0x30e4001f, 0x8c430228,
-0x24020001, 0x821004, 0x621825, 0xaca30228,
-0x3c020800, 0x34421000, 0x1821, 0xafa20020,
-0x8f5e0018, 0x27aa0020, 0x240200ff, 0x13c20002,
-0xafaa002c, 0x27c30001, 0x8c020228, 0x609021,
-0x1642000e, 0x1e38c0, 0x8f42033c, 0x24420001,
-0xaf42033c, 0x8f42033c, 0x8c020228, 0x3c040001,
-0x24847a80, 0x3c050009, 0xafa00014, 0xafa20010,
-0x8fa60020, 0x1000006b, 0x34a50500, 0xf71021,
-0x8fa30020, 0x8fa40024, 0xac4304c0, 0xac4404c4,
-0x8f830054, 0x8f820054, 0x247003e8, 0x2021023,
-0x2c4203e9, 0x1040001b, 0x9821, 0xe08821,
-0x263504c0, 0x8f440178, 0x8f45017c, 0x2201821,
-0x240a0004, 0xafaa0010, 0xafb20014, 0x8f48000c,
-0x1021, 0x2f53021, 0xafa80018, 0x8f48010c,
-0x24070008, 0xa32821, 0xa3482b, 0x822021,
-0x100f809, 0x892021, 0x54400006, 0x24130001,
-0x8f820054, 0x2021023, 0x2c4203e9, 0x1440ffe9,
-0x0, 0x326200ff, 0x54400017, 0xaf520018,
-0x8f420378, 0x24420001, 0xaf420378, 0x8f420378,
-0x8f820120, 0x8faa002c, 0xafa20010, 0x8f820124,
-0x3c040001, 0x24847a8c, 0x3c050009, 0xafa20014,
-0x8d460000, 0x10000033, 0x34a50600, 0x8f420308,
-0x24130001, 0x24420001, 0xaf420308, 0x8f420308,
-0x1000001c, 0x326200ff, 0x8f830054, 0x8f820054,
-0x247003e8, 0x2021023, 0x2c4203e9, 0x10400014,
-0x9821, 0x24110010, 0x8f42000c, 0x8f440160,
-0x8f450164, 0x8f860120, 0xafb10010, 0xafb20014,
-0xafa20018, 0x8f42010c, 0x24070008, 0x40f809,
-0x24c6001c, 0x1440ffe5, 0x0, 0x8f820054,
-0x2021023, 0x2c4203e9, 0x1440ffef, 0x0,
-0x326200ff, 0x14400011, 0x0, 0x8f420378,
-0x24420001, 0xaf420378, 0x8f420378, 0x8f820120,
-0x8faa002c, 0xafa20010, 0x8f820124, 0x3c040001,
-0x24847a94, 0x3c050009, 0xafa20014, 0x8d460000,
-0x34a50700, 0xc002d3b, 0x3c03821, 0x8f4202b4,
-0x24420001, 0xaf4202b4, 0x8f4202b4, 0x8f4202f4,
-0x24420001, 0xaf4202f4, 0x8f4202f4, 0x8fbf0048,
-0x8fbe0044, 0x8fb50040, 0x8fb3003c, 0x8fb20038,
-0x8fb10034, 0x8fb00030, 0x3e00008, 0x27bd0050,
-0x27bdffa0, 0x801021, 0xafb00040, 0x24500002,
-0x2002021, 0x24050006, 0xafb10044, 0x408821,
-0xafbf0058, 0xafbe0054, 0xafb50050, 0xafb3004c,
-0xc00252e, 0xafb20048, 0x3048007f, 0x810c0,
-0x2e21021, 0x3c060001, 0xc23021, 0x94c630d0,
-0x10c0001c, 0x3821, 0x3c0a0001, 0x354a34d2,
-0x96290002, 0x610c0, 0x572021, 0x8a2021,
-0x94820000, 0x14490009, 0x2821, 0x94830002,
-0x96020002, 0x14620006, 0xa01021, 0x94820004,
-0x96030004, 0x431026, 0x2c450001, 0xa01021,
-0x14400008, 0x610c0, 0xc03821, 0x2e21021,
-0x3c060001, 0xc23021, 0x94c634d0, 0x14c0ffea,
-0x610c0, 0x14c00011, 0xafa70028, 0x810c0,
-0x2e21021, 0xafa80010, 0x3c010001, 0x220821,
-0x942230d0, 0x3c040001, 0x24847ad0, 0xafa20014,
-0x8e260000, 0x8e270004, 0x3c050004, 0xc002d3b,
-0x34a50900, 0x10000075, 0x3c020800, 0x10e0000c,
-0x610c0, 0x2e21021, 0x3c030001, 0x621821,
-0x946334d0, 0x710c0, 0x2e21021, 0x3c010001,
-0x220821, 0xa42334d0, 0x1000000b, 0x3c040001,
-0x2e21021, 0x3c030001, 0x621821, 0x946334d0,
-0x810c0, 0x2e21021, 0x3c010001, 0x220821,
-0xa42330d0, 0x3c040001, 0x348430d0, 0x8f430100,
-0x610c0, 0x2e21021, 0x3c010001, 0x220821,
-0xa42334d0, 0x8f420104, 0x2e43821, 0x2821,
-0x18400029, 0xaf460100, 0x24e60006, 0x94c3fffc,
-0x96020000, 0x14620009, 0x2021, 0x94c3fffe,
-0x96020002, 0x14620006, 0x801021, 0x94c20000,
-0x96030004, 0x431026, 0x2c440001, 0x801021,
-0x50400014, 0x24a50001, 0x8f420104, 0x2442ffff,
-0xa2102a, 0x1040000b, 0x24e40004, 0x94820006,
-0x8c830008, 0xa482fffe, 0xac830000, 0x8f420104,
-0x24a50001, 0x2442ffff, 0xa2102a, 0x1440fff7,
-0x24840008, 0x8f420104, 0x2442ffff, 0x10000006,
-0xaf420104, 0x8f420104, 0x24c60008, 0xa2102a,
-0x1440ffda, 0x24e70008, 0x810c0, 0x2e21021,
-0x3c010001, 0x220821, 0x942230d0, 0x14400023,
-0x3c020800, 0x3c020002, 0x2c21024, 0x10400012,
-0x82142, 0x3c030001, 0x346338d8, 0x24020003,
-0x441023, 0x21080, 0x572021, 0x832021,
-0x571021, 0x431021, 0x3105001f, 0x24030001,
-0x8c420000, 0xa31804, 0x31827, 0x431024,
-0x1000000d, 0xac820000, 0x24020003, 0x441023,
-0x21080, 0x5c2821, 0x5c1021, 0x3104001f,
-0x24030001, 0x8c420228, 0x831804, 0x31827,
-0x431024, 0xaca20228, 0x3c020800, 0x34422000,
-0x1821, 0xafa20020, 0x8f5e0018, 0x27ab0020,
-0x240200ff, 0x13c20002, 0xafab0034, 0x27c30001,
-0x8c020228, 0x609021, 0x1642000e, 0x1e38c0,
-0x8f42033c, 0x24420001, 0xaf42033c, 0x8f42033c,
-0x8c020228, 0x3c040001, 0x24847a80, 0x3c050009,
-0xafa00014, 0xafa20010, 0x8fa60020, 0x1000006b,
-0x34a50500, 0xf71021, 0x8fa30020, 0x8fa40024,
-0xac4304c0, 0xac4404c4, 0x8f830054, 0x8f820054,
-0x247003e8, 0x2021023, 0x2c4203e9, 0x1040001b,
-0x9821, 0xe08821, 0x263504c0, 0x8f440178,
-0x8f45017c, 0x2201821, 0x240b0004, 0xafab0010,
-0xafb20014, 0x8f48000c, 0x1021, 0x2f53021,
-0xafa80018, 0x8f48010c, 0x24070008, 0xa32821,
-0xa3482b, 0x822021, 0x100f809, 0x892021,
-0x54400006, 0x24130001, 0x8f820054, 0x2021023,
-0x2c4203e9, 0x1440ffe9, 0x0, 0x326200ff,
-0x54400017, 0xaf520018, 0x8f420378, 0x24420001,
-0xaf420378, 0x8f420378, 0x8f820120, 0x8fab0034,
-0xafa20010, 0x8f820124, 0x3c040001, 0x24847a8c,
-0x3c050009, 0xafa20014, 0x8d660000, 0x10000033,
-0x34a50600, 0x8f420308, 0x24130001, 0x24420001,
-0xaf420308, 0x8f420308, 0x1000001c, 0x326200ff,
-0x8f830054, 0x8f820054, 0x247003e8, 0x2021023,
-0x2c4203e9, 0x10400014, 0x9821, 0x24110010,
-0x8f42000c, 0x8f440160, 0x8f450164, 0x8f860120,
-0xafb10010, 0xafb20014, 0xafa20018, 0x8f42010c,
-0x24070008, 0x40f809, 0x24c6001c, 0x1440ffe5,
-0x0, 0x8f820054, 0x2021023, 0x2c4203e9,
-0x1440ffef, 0x0, 0x326200ff, 0x14400011,
-0x0, 0x8f420378, 0x24420001, 0xaf420378,
-0x8f420378, 0x8f820120, 0x8fab0034, 0xafa20010,
-0x8f820124, 0x3c040001, 0x24847a94, 0x3c050009,
-0xafa20014, 0x8d660000, 0x34a50700, 0xc002d3b,
-0x3c03821, 0x8f4202b8, 0x24420001, 0xaf4202b8,
-0x8f4202b8, 0x8f4202f4, 0x24420001, 0xaf4202f4,
-0x8f4202f4, 0x8fbf0058, 0x8fbe0054, 0x8fb50050,
-0x8fb3004c, 0x8fb20048, 0x8fb10044, 0x8fb00040,
-0x3e00008, 0x27bd0060, 0x27bdffe0, 0x27644000,
-0xafbf0018, 0xc002da8, 0x24051000, 0x3c030001,
-0x34632cc0, 0x3c040001, 0x34842ec8, 0x24020020,
-0xaf82011c, 0x2e31021, 0xaf800100, 0xaf800104,
-0xaf800108, 0xaf800110, 0xaf800114, 0xaf800118,
-0xaf800120, 0xaf800124, 0xaf800128, 0xaf800130,
-0xaf800134, 0xaf800138, 0xaf4200ec, 0x2e31021,
-0xaf4200f0, 0x2e41021, 0xaf4200f4, 0x2e41021,
-0xaf4200f8, 0x3c020001, 0x571021, 0x904240f4,
-0x1440001c, 0x3c050001, 0x8f82011c, 0x3c040001,
-0x24847b8c, 0x3c050001, 0x34420001, 0xaf82011c,
-0xafa00010, 0xafa00014, 0x8f86011c, 0x34a50100,
-0xc002d3b, 0x3821, 0x8c020218, 0x30420040,
-0x10400014, 0x0, 0x8f82011c, 0x3c040001,
-0x24847b98, 0x3c050001, 0x34420004, 0xaf82011c,
-0xafa00010, 0xafa00014, 0x8f86011c, 0x10000007,
-0x34a50200, 0x3c040001, 0x24847ba0, 0xafa00010,
-0xafa00014, 0x8f86011c, 0x34a50300, 0xc002d3b,
-0x3821, 0x8fbf0018, 0x3e00008, 0x27bd0020,
-0x27bdffd8, 0xafb1001c, 0x8fb10038, 0xafbf0020,
-0xafb00018, 0x8f83012c, 0x8fa9003c, 0x8faa0040,
-0x1060000a, 0x27624fe0, 0x14620002, 0x24680020,
-0x27684800, 0x8f820128, 0x11020004, 0x0,
-0x8f820124, 0x15020008, 0x0, 0x8f430334,
-0x1021, 0x24630001, 0xaf430334, 0x8f430334,
-0x10000052, 0x0, 0xac640000, 0xac650004,
-0xac660008, 0xa467000e, 0xac710018, 0xac69001c,
-0xac6a0010, 0xac620014, 0xaf880120, 0x8f4200fc,
-0x8f5000f4, 0x2442ffff, 0xaf4200fc, 0x8e020000,
-0x10510005, 0x3042ff8f, 0x10400019, 0x3222ff8f,
-0x10400018, 0x3c020001, 0x8e030004, 0x2c620010,
-0x10400013, 0x3c020001, 0x24630001, 0xae030004,
-0x8f4300f8, 0x344230c8, 0x2e21021, 0x54620004,
-0x24620008, 0x3c020001, 0x34422ec8, 0x2e21021,
-0x1450002e, 0x24020001, 0x8f820128, 0x24420020,
-0xaf820128, 0x8f820128, 0x10000028, 0x24020001,
-0x3c020001, 0x344230c8, 0x2e21021, 0x16020004,
-0x26030008, 0x3c020001, 0x34422ec8, 0x2e21821,
-0x8f4200f8, 0x608021, 0x12020004, 0xaf5000f4,
-0x8e020000, 0x10400016, 0x24020001, 0x24020170,
-0x3c040001, 0x24847ba8, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77bb0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x24020001,
-0xae110000, 0xae020004, 0x24020001, 0x8fbf0020,
-0x8fb1001c, 0x8fb00018, 0x3e00008, 0x27bd0028,
-0x3e00008, 0x0, 0x27bdffc8, 0xafb30024,
-0xafb20020, 0x809021, 0xa09821, 0xafb50028,
-0xc0a821, 0xafbf0030, 0xafbe002c, 0xafb1001c,
-0xafb00018, 0x8f900120, 0x27624fe0, 0x16020003,
-0xe0f021, 0x10000002, 0x27714800, 0x26110020,
-0x8f820128, 0x16220008, 0x0, 0x8f430334,
-0x1021, 0x24630001, 0xaf430334, 0x8f430334,
-0x10000028, 0x0, 0x8f820124, 0x16220014,
-0x240201ab, 0x3c040001, 0x24847ba8, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77bb0,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0xae120000, 0xae130004, 0xae150008, 0xa61e000e,
-0x8fa80048, 0xae080018, 0x8fa8004c, 0x26020016,
-0xae08001c, 0xae020014, 0x8fa80050, 0xae080010,
-0xaf910120, 0x8f4300fc, 0x24020001, 0x2463ffff,
-0xaf4300fc, 0x8fbf0030, 0x8fbe002c, 0x8fb50028,
-0x8fb30024, 0x8fb20020, 0x8fb1001c, 0x8fb00018,
-0x3e00008, 0x27bd0038, 0x3e00008, 0x0,
-0x27bdffd8, 0xafb1001c, 0x8fb10038, 0xafbf0020,
-0xafb00018, 0x8f83010c, 0x8fa9003c, 0x8faa0040,
-0x1060000a, 0x276247e0, 0x14620002, 0x24680020,
-0x27684000, 0x8f820108, 0x11020004, 0x0,
-0x8f820104, 0x15020008, 0x0, 0x8f430338,
-0x1021, 0x24630001, 0xaf430338, 0x8f430338,
-0x1000004e, 0x0, 0xac640000, 0xac650004,
-0xac660008, 0xa467000e, 0xac710018, 0xac69001c,
-0xac6a0010, 0xac620014, 0xaf880100, 0x8f5000ec,
-0x8e020000, 0x30420006, 0x10400019, 0x32220006,
-0x10400018, 0x3c020001, 0x8e030004, 0x2c620010,
-0x10400013, 0x3c020001, 0x24630001, 0xae030004,
-0x8f4300f0, 0x34422ec0, 0x2e21021, 0x54620004,
-0x24620008, 0x3c020001, 0x34422cc0, 0x2e21021,
-0x1450002e, 0x24020001, 0x8f820108, 0x24420020,
-0xaf820108, 0x8f820108, 0x10000028, 0x24020001,
-0x3c020001, 0x34422ec0, 0x2e21021, 0x16020004,
-0x26030008, 0x3c020001, 0x34422cc0, 0x2e21821,
-0x8f4200f0, 0x608021, 0x12020004, 0xaf5000ec,
-0x8e020000, 0x10400016, 0x24020001, 0x24020212,
-0x3c040001, 0x24847ba8, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77bb0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x24020001,
-0xae110000, 0xae020004, 0x24020001, 0x8fbf0020,
-0x8fb1001c, 0x8fb00018, 0x3e00008, 0x27bd0028,
-0x3e00008, 0x0, 0x27bdffc8, 0xafb30024,
-0xafb20020, 0x809021, 0xa09821, 0xafb50028,
-0xc0a821, 0xafbf0030, 0xafbe002c, 0xafb1001c,
-0xafb00018, 0x8f900100, 0x276247e0, 0x16020003,
-0xe0f021, 0x10000002, 0x27714000, 0x26110020,
-0x8f820108, 0x16220008, 0x0, 0x8f430338,
-0x1021, 0x24630001, 0xaf430338, 0x8f430338,
-0x10000025, 0x0, 0x8f820104, 0x16220014,
-0x2402024d, 0x3c040001, 0x24847ba8, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77bb0,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0xae120000, 0xae130004, 0xae150008, 0xa61e000e,
-0x8fa80048, 0xae080018, 0x8fa8004c, 0x26030016,
-0xae08001c, 0xae030014, 0x8fa80050, 0x24020001,
-0xae080010, 0xaf910100, 0x8fbf0030, 0x8fbe002c,
-0x8fb50028, 0x8fb30024, 0x8fb20020, 0x8fb1001c,
-0x8fb00018, 0x3e00008, 0x27bd0038, 0x3e00008,
-0x0, 0x27bdffd8, 0x3c040001, 0x24847bb8,
-0x3c050001, 0xafbf0024, 0xafb20020, 0xafb1001c,
-0xafb00018, 0x8f900104, 0x8f9100b0, 0x8f92011c,
-0x34a52500, 0x8f820100, 0x2403021, 0x2203821,
-0xafa20010, 0xc002d3b, 0xafb00014, 0x8e020008,
-0xafa20010, 0x8e02000c, 0x3c040001, 0x24847bc4,
-0xafa20014, 0x8e060000, 0x8e070004, 0x3c050001,
-0xc002d3b, 0x34a52510, 0x8e020018, 0xafa20010,
-0x8e02001c, 0x3c040001, 0x24847bd0, 0xafa20014,
-0x8e060010, 0x8e070014, 0x3c050001, 0xc002d3b,
-0x34a52520, 0x3c027f00, 0x2221024, 0x3c030800,
-0x54430016, 0x3c030200, 0x8f82009c, 0x3042ffff,
-0x14400012, 0x3c030200, 0x3c040001, 0x24847bdc,
-0x3c050002, 0x34a5f030, 0x3021, 0x3821,
-0x36420002, 0xaf82011c, 0x36220001, 0xaf8200b0,
-0xaf900104, 0xaf92011c, 0xafa00010, 0xc002d3b,
-0xafa00014, 0x10000025, 0x0, 0x2c31024,
-0x1040000e, 0x2231024, 0x1040000c, 0x36420002,
-0xaf82011c, 0x36220001, 0xaf8200b0, 0xaf900104,
-0xaf92011c, 0x8f420330, 0x24420001, 0xaf420330,
-0x8f420330, 0x10000015, 0x0, 0x3c040001,
-0x24847ba8, 0x240202a9, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77bb0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x8fbf0024,
-0x8fb20020, 0x8fb1001c, 0x8fb00018, 0x3e00008,
-0x27bd0028, 0x27bdffd8, 0x3c040001, 0x24847be4,
-0x3c050001, 0xafbf0024, 0xafb20020, 0xafb1001c,
-0xafb00018, 0x8f900124, 0x8f9100a0, 0x8f92011c,
-0x34a52600, 0x8f820120, 0x2403021, 0x2203821,
-0xafa20010, 0xc002d3b, 0xafb00014, 0x8e020008,
-0xafa20010, 0x8e02000c, 0x3c040001, 0x24847bf0,
-0xafa20014, 0x8e060000, 0x8e070004, 0x3c050001,
-0xc002d3b, 0x34a52610, 0x8e020018, 0xafa20010,
-0x8e02001c, 0x3c040001, 0x24847bfc, 0xafa20014,
-0x8e060010, 0x8e070014, 0x3c050001, 0xc002d3b,
-0x34a52620, 0x3c027f00, 0x2221024, 0x3c030800,
-0x54430016, 0x3c030200, 0x8f8200ac, 0x3042ffff,
-0x14400012, 0x3c030200, 0x3c040001, 0x24847c08,
-0x3c050001, 0x34a5f030, 0x3021, 0x3821,
-0x36420002, 0xaf82011c, 0x36220001, 0xaf8200a0,
-0xaf900124, 0xaf92011c, 0xafa00010, 0xc002d3b,
-0xafa00014, 0x10000025, 0x0, 0x2c31024,
-0x1040000e, 0x2231024, 0x1040000c, 0x36420002,
-0xaf82011c, 0x36220001, 0xaf8200a0, 0xaf900124,
-0xaf92011c, 0x8f42032c, 0x24420001, 0xaf42032c,
-0x8f42032c, 0x10000015, 0x0, 0x3c040001,
-0x24847ba8, 0x240202e2, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77bb0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x8fbf0024,
-0x8fb20020, 0x8fb1001c, 0x8fb00018, 0x3e00008,
-0x27bd0028, 0x6021, 0x5021, 0x3021,
-0x2821, 0x6821, 0x4821, 0x7821,
-0x7021, 0x8f880124, 0x8f870104, 0x8f8b011c,
-0x1580002e, 0x0, 0x11a00014, 0x31620800,
-0x8f820120, 0x10460029, 0x0, 0x3c040002,
-0x8c8487a0, 0x8cc20000, 0x8cc30004, 0xac820000,
-0xac830004, 0x8cc20008, 0xac820008, 0x94c2000e,
-0xa482000e, 0x8cc20010, 0x240c0001, 0xac820010,
-0x8cc20014, 0x10000012, 0x24c60020, 0x10400017,
-0x0, 0x3c040002, 0x8c8487a0, 0x8d020000,
-0x8d030004, 0xac820000, 0xac830004, 0x8d020008,
-0xac820008, 0x9502000e, 0xa482000e, 0x8d020010,
-0x25060020, 0xac820010, 0x8d020014, 0x240c0001,
-0xc01821, 0xac820014, 0x27624fe0, 0x43102b,
-0x54400001, 0x27634800, 0x603021, 0x1540002f,
-0x31620100, 0x11200014, 0x31628000, 0x8f820100,
-0x1045002a, 0x31620100, 0x3c040002, 0x8c84879c,
-0x8ca20000, 0x8ca30004, 0xac820000, 0xac830004,
-0x8ca20008, 0xac820008, 0x94a2000e, 0xa482000e,
-0x8ca20010, 0x240a0001, 0xac820010, 0x8ca20014,
-0x10000012, 0x24a50020, 0x10400018, 0x31620100,
-0x3c040002, 0x8c84879c, 0x8ce20000, 0x8ce30004,
-0xac820000, 0xac830004, 0x8ce20008, 0xac820008,
-0x94e2000e, 0xa482000e, 0x8ce20010, 0x24e50020,
-0xac820010, 0x8ce20014, 0x240a0001, 0xa01821,
-0xac820014, 0x276247e0, 0x43102b, 0x54400001,
-0x27634000, 0x602821, 0x31620100, 0x5440001d,
-0x31621000, 0x11a00009, 0x31a20800, 0x10400004,
-0x25020020, 0x8f8200a8, 0xa5e20000, 0x25020020,
-0xaf820124, 0x8f880124, 0x6821, 0x11800011,
-0x31621000, 0x3c040002, 0x8c8487a0, 0x8c820000,
-0x8c830004, 0xaf820080, 0xaf830084, 0x8c820008,
-0xaf8200a4, 0x9482000e, 0xaf8200ac, 0x8c820010,
-0x6021, 0xaf8200a0, 0x8c8d0010, 0x8c8f0014,
-0x31621000, 0x1440ff81, 0x0, 0x1120000f,
-0x31220800, 0x10400004, 0x3c020002, 0x8f8200b8,
-0xa5c20000, 0x3c020002, 0x1221024, 0x10400004,
-0x24e20020, 0x8f8200b4, 0xaf8200d4, 0x24e20020,
-0xaf820104, 0x8f870104, 0x4821, 0x1140ff6f,
-0x0, 0x3c040002, 0x8c84879c, 0x8c820000,
-0x8c830004, 0xaf820090, 0xaf830094, 0x8c820008,
-0xaf8200b4, 0x9482000e, 0xaf82009c, 0x8c820010,
-0x5021, 0xaf8200b0, 0x8c890010, 0x8c8e0014,
-0x1000ff5e, 0x0, 0x3e00008, 0x0,
-0x6021, 0x5821, 0x3021, 0x2821,
-0x6821, 0x5021, 0x7821, 0x7021,
-0x8f880124, 0x8f870104, 0x3c180100, 0x8f89011c,
-0x1580002e, 0x0, 0x11a00014, 0x31220800,
-0x8f820120, 0x10460029, 0x0, 0x3c040002,
-0x8c8487a0, 0x8cc20000, 0x8cc30004, 0xac820000,
-0xac830004, 0x8cc20008, 0xac820008, 0x94c2000e,
-0xa482000e, 0x8cc20010, 0x240c0001, 0xac820010,
-0x8cc20014, 0x10000012, 0x24c60020, 0x10400017,
-0x0, 0x3c040002, 0x8c8487a0, 0x8d020000,
-0x8d030004, 0xac820000, 0xac830004, 0x8d020008,
-0xac820008, 0x9502000e, 0xa482000e, 0x8d020010,
-0x25060020, 0xac820010, 0x8d020014, 0x240c0001,
-0xc01821, 0xac820014, 0x27624fe0, 0x43102b,
-0x54400001, 0x27634800, 0x603021, 0x1560002f,
-0x31220100, 0x11400014, 0x31228000, 0x8f820100,
-0x1045002a, 0x31220100, 0x3c040002, 0x8c84879c,
-0x8ca20000, 0x8ca30004, 0xac820000, 0xac830004,
-0x8ca20008, 0xac820008, 0x94a2000e, 0xa482000e,
-0x8ca20010, 0x240b0001, 0xac820010, 0x8ca20014,
-0x10000012, 0x24a50020, 0x10400018, 0x31220100,
-0x3c040002, 0x8c84879c, 0x8ce20000, 0x8ce30004,
-0xac820000, 0xac830004, 0x8ce20008, 0xac820008,
-0x94e2000e, 0xa482000e, 0x8ce20010, 0x24e50020,
-0xac820010, 0x8ce20014, 0x240b0001, 0xa01821,
-0xac820014, 0x276247e0, 0x43102b, 0x54400001,
-0x27634000, 0x602821, 0x31220100, 0x5440001d,
-0x31221000, 0x11a00009, 0x31a20800, 0x10400004,
-0x25020020, 0x8f8200a8, 0xa5e20000, 0x25020020,
-0xaf820124, 0x8f880124, 0x6821, 0x11800011,
-0x31221000, 0x3c040002, 0x8c8487a0, 0x8c820000,
-0x8c830004, 0xaf820080, 0xaf830084, 0x8c820008,
-0xaf8200a4, 0x9482000e, 0xaf8200ac, 0x8c820010,
-0x6021, 0xaf8200a0, 0x8c8d0010, 0x8c8f0014,
-0x31221000, 0x14400022, 0x0, 0x1140000f,
-0x31420800, 0x10400004, 0x3c020002, 0x8f8200b8,
-0xa5c20000, 0x3c020002, 0x1421024, 0x10400004,
-0x24e20020, 0x8f8200b4, 0xaf8200d4, 0x24e20020,
-0xaf820104, 0x8f870104, 0x5021, 0x11600010,
-0x0, 0x3c040002, 0x8c84879c, 0x8c820000,
-0x8c830004, 0xaf820090, 0xaf830094, 0x8c820008,
-0xaf8200b4, 0x9482000e, 0xaf82009c, 0x8c820010,
-0x5821, 0xaf8200b0, 0x8c8a0010, 0x8c8e0014,
-0x8f820070, 0x3c031000, 0x431024, 0x1040ff5b,
-0x0, 0x8f820054, 0x24420005, 0xaf820078,
-0x8c040234, 0x10800017, 0x1821, 0x3c020001,
-0x571021, 0x8c4240e8, 0x24420005, 0x3c010001,
-0x370821, 0xac2240e8, 0x3c020001, 0x571021,
-0x8c4240e8, 0x44102b, 0x1440000a, 0x24020001,
-0x3c030080, 0x3c010001, 0x370821, 0xac2040e8,
-0x3c010001, 0x370821, 0xa02240f0, 0x1000000c,
-0x0, 0x3c020001, 0x571021, 0x904240f0,
-0x14400006, 0x3c020080, 0x3c020001, 0x571021,
-0x904240f1, 0x10400002, 0x3c020080, 0x621825,
-0x8c040230, 0x10800013, 0x0, 0x3c020001,
-0x571021, 0x8c4240ec, 0x24420005, 0x3c010001,
-0x370821, 0xac2240ec, 0x3c020001, 0x571021,
-0x8c4240ec, 0x44102b, 0x14400006, 0x0,
-0x3c010001, 0x370821, 0xac2040ec, 0x10000006,
-0x781825, 0x3c020001, 0x571021, 0x904240f2,
-0x54400001, 0x781825, 0x1060ff18, 0x0,
-0x8f420000, 0x10400007, 0x0, 0xaf80004c,
-0x8f82004c, 0x1040fffd, 0x0, 0x10000005,
-0x0, 0xaf800048, 0x8f820048, 0x1040fffd,
-0x0, 0x8f820060, 0x431025, 0xaf820060,
-0x8f420000, 0x10400004, 0x0, 0xaf80004c,
-0x1000ff02, 0x0, 0xaf800048, 0x1000feff,
-0x0, 0x3e00008, 0x0, 0x3c020002,
-0x8c428608, 0x27bdffe8, 0xafbf0014, 0x14400012,
-0xafb00010, 0x3c100002, 0x26108850, 0x2002021,
-0xc002da8, 0x24052000, 0x26021fe0, 0x3c010002,
-0xac2287a8, 0x3c010002, 0xac2287a4, 0xac020250,
-0x24022000, 0xac100254, 0xac020258, 0x24020001,
-0x3c010002, 0xac228608, 0x8fbf0014, 0x8fb00010,
-0x3e00008, 0x27bd0018, 0x3c090002, 0x8d2987a8,
-0x8c820000, 0x8fa30010, 0x8fa80014, 0xad220000,
-0x8c820004, 0xad250008, 0xad220004, 0x8f820054,
-0xad260010, 0xad270014, 0xad230018, 0xad28001c,
-0xad22000c, 0x2529ffe0, 0x3c020002, 0x24428850,
-0x122102b, 0x10400003, 0x0, 0x3c090002,
-0x8d2987a4, 0x3c020002, 0x8c4285fc, 0xad220000,
-0x3c020002, 0x8c4285fc, 0x3c010002, 0xac2987a8,
-0xad220004, 0xac090250, 0x3e00008, 0x0,
-0x27bdffd0, 0xafb00010, 0x3c100002, 0x8e1087a8,
-0x3c020002, 0x8c4285fc, 0xafb10014, 0x808821,
-0xafbe0024, 0x8fbe0040, 0x8fa40048, 0xafb20018,
-0xa09021, 0xafbf0028, 0xafb50020, 0xafb3001c,
-0xae020000, 0x3c020002, 0x8c4285fc, 0xc09821,
-0xe0a821, 0x10800006, 0xae020004, 0x26050008,
-0xc002db3, 0x24060018, 0x10000005, 0x2610ffe0,
-0x26040008, 0xc002da8, 0x24050018, 0x2610ffe0,
-0x3c030002, 0x24638850, 0x203102b, 0x10400003,
-0x0, 0x3c100002, 0x8e1087a4, 0x8e220000,
-0xae020000, 0x8e220004, 0xae120008, 0xae020004,
-0x8f820054, 0xae130010, 0xae150014, 0xae1e0018,
-0x8fa80044, 0xae08001c, 0xae02000c, 0x2610ffe0,
-0x203102b, 0x10400003, 0x0, 0x3c100002,
-0x8e1087a4, 0x3c020002, 0x8c4285fc, 0xae020000,
-0x3c020002, 0x8c4285fc, 0x3c010002, 0xac3087a8,
-0xae020004, 0xac100250, 0x8fbf0028, 0x8fbe0024,
-0x8fb50020, 0x8fb3001c, 0x8fb20018, 0x8fb10014,
-0x8fb00010, 0x3e00008, 0x27bd0030, 0x851821,
-0x83102b, 0x10400006, 0x0, 0xac800000,
-0x24840004, 0x83102b, 0x5440fffd, 0xac800000,
-0x3e00008, 0x0, 0xa61821, 0xa3102b,
-0x10400007, 0x0, 0x8c820000, 0xaca20000,
-0x24a50004, 0xa3102b, 0x1440fffb, 0x24840004,
-0x3e00008, 0x0, 0x861821, 0x83102b,
-0x10400007, 0x0, 0x8ca20000, 0xac820000,
-0x24840004, 0x83102b, 0x1440fffb, 0x24a50004,
-0x3e00008, 0x0, 0x63080, 0x861821,
-0x83102b, 0x10400006, 0x0, 0xac850000,
-0x24840004, 0x83102b, 0x5440fffd, 0xac850000,
-0x3e00008, 0x0, 0x26e50028, 0xa03021,
-0x274301c0, 0x8f4d0358, 0x8f47035c, 0x8f480360,
-0x8f490364, 0x8f4a0368, 0x8f4b0204, 0x8f4c0200,
-0x24640400, 0x64102b, 0x10400008, 0x3c0208ff,
-0x8cc20000, 0xac620000, 0x24630004, 0x64102b,
-0x1440fffb, 0x24c60004, 0x3c0208ff, 0x3442ffff,
-0x3c03c0ff, 0xaf4d0358, 0xaf47035c, 0xaf480360,
-0xaf490364, 0xaf4a0368, 0xaf4b0204, 0xaf4c0200,
-0x8f840220, 0x3463ffff, 0x8f860200, 0x821024,
-0x34420004, 0xc31824, 0x34630004, 0xaf820220,
-0xaf830200, 0x8ca20214, 0xac020084, 0x8ca20218,
-0xac020088, 0x8ca2021c, 0xac02008c, 0x8ca20220,
-0xac020090, 0x8ca20224, 0xac020094, 0x8ca20228,
-0xac020098, 0x8ca2022c, 0xac02009c, 0x8ca20230,
-0xac0200a0, 0x8ca20234, 0xac0200a4, 0x8ca20238,
-0xac0200a8, 0x8ca2023c, 0xac0200ac, 0x8ca20240,
-0xac0200b0, 0x8ca20244, 0xac0200b4, 0x8ca20248,
-0xac0200b8, 0x8ca2024c, 0xac0200bc, 0x8ca2001c,
-0xac020080, 0x8ca20018, 0xac0200c0, 0x8ca20020,
-0xac0200cc, 0x8ca20024, 0xac0200d0, 0x8ca201d0,
-0xac0200e0, 0x8ca201d4, 0xac0200e4, 0x8ca201d8,
-0xac0200e8, 0x8ca201dc, 0xac0200ec, 0x8ca201e0,
-0xac0200f0, 0x8ca20098, 0x8ca3009c, 0xac0300fc,
-0x8ca200a8, 0x8ca300ac, 0xac0300f4, 0x8ca200a0,
-0x8ca300a4, 0x30840004, 0xac0300f8, 0x14800007,
-0x30c20004, 0x8f820220, 0x3c0308ff, 0x3463fffb,
-0x431024, 0xaf820220, 0x30c20004, 0x14400006,
-0x0, 0x8f820200, 0x3c03c0ff, 0x3463fffb,
-0x431024, 0xaf820200, 0x8f4202dc, 0xa34005c5,
-0x24420001, 0xaf4202dc, 0x8f4202dc, 0x3e00008,
-0x0, 0x27bdffd0, 0xafbf0028, 0xafb10024,
-0xafb00020, 0x8f430024, 0x8f420020, 0x1062004e,
-0x0, 0x8f430020, 0x8f420024, 0x628823,
-0x6210003, 0x0, 0x8f420040, 0x2228821,
-0x8f430030, 0x8f420024, 0x43102b, 0x14400005,
-0x0, 0x8f430040, 0x8f420024, 0x10000005,
-0x628023, 0x8f420030, 0x8f430024, 0x431023,
-0x2450ffff, 0x16000016, 0x2006821, 0x3c040001,
-0x24847e74, 0x240202aa, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77e84, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x2006821,
-0x22d102a, 0x54400001, 0x2206821, 0x8f4b0024,
-0x8f4a0040, 0x8f490024, 0x8f440180, 0x8f450184,
-0x8f460024, 0x8f4c001c, 0xd3900, 0x24080001,
-0xafa80010, 0x94900, 0x1201821, 0x16d5821,
-0x254affff, 0x16a8024, 0xafb00014, 0x8f480014,
-0x1021, 0xa32821, 0xa3482b, 0x822021,
-0x892021, 0xafa80018, 0x8f420108, 0x63100,
-0x40f809, 0x1863021, 0x54400001, 0xaf500024,
-0x8f430024, 0x8f420020, 0x14620019, 0x0,
-0x8f420000, 0x10400007, 0x0, 0xaf80004c,
-0x8f82004c, 0x1040fffd, 0x0, 0x10000005,
-0x0, 0xaf800048, 0x8f820048, 0x1040fffd,
-0x0, 0x8f820060, 0x2403ffef, 0x431024,
-0xaf820060, 0x8f420000, 0x10400004, 0x0,
-0xaf80004c, 0x10000002, 0x0, 0xaf800048,
-0x8fbf0028, 0x8fb10024, 0x8fb00020, 0x3e00008,
-0x27bd0030, 0x3e00008, 0x0, 0x27bdffc0,
-0x32c20020, 0xafbf0038, 0xafb30034, 0xafb20030,
-0xafb1002c, 0x10400004, 0xafb00028, 0x8f530028,
-0x10000002, 0x0, 0x8f530020, 0x8f420030,
-0x10530102, 0x21100, 0x8f43001c, 0x628021,
-0x8e040000, 0x8e050004, 0x96120008, 0x8f420090,
-0x9611000a, 0x3246ffff, 0x46102a, 0x10400018,
-0x0, 0x8f8200d8, 0x8f430098, 0x431023,
-0x2442dcbe, 0xaf420090, 0x8f420090, 0x2842dcbf,
-0x10400005, 0x0, 0x8f420090, 0x8f430144,
-0x431021, 0xaf420090, 0x8f420090, 0x46102a,
-0x10400007, 0x0, 0x8f420348, 0x24420001,
-0xaf420348, 0x8f420348, 0x100000f8, 0x0,
-0x8f8200fc, 0x14400007, 0x0, 0x8f420344,
-0x24420001, 0xaf420344, 0x8f420344, 0x100000ef,
-0x0, 0x934205c2, 0x1040000b, 0x32c20008,
-0x10400008, 0x32220200, 0x10400006, 0x3c034000,
-0x9602000e, 0xaf4300ac, 0x21400, 0x10000002,
-0xaf4200b0, 0xaf4000ac, 0x32220004, 0x10400094,
-0x32220800, 0x10400003, 0x3247ffff, 0x10000002,
-0x24020020, 0x24020004, 0xafa20010, 0x8f420030,
-0xafa20014, 0x8f420010, 0x3c030002, 0x431025,
-0xafa20018, 0x8f460098, 0x8f420108, 0x40f809,
-0x0, 0x104000cd, 0x0, 0x8f42009c,
-0x8f430094, 0x2421021, 0xaf42009c, 0xae03000c,
-0x8f4200ac, 0x10400008, 0x3c034000, 0x8f420094,
-0x431025, 0xafa20020, 0x8f42009c, 0x8f4300b0,
-0x10000004, 0x431025, 0x8f420094, 0xafa20020,
-0x8f42009c, 0xafa20024, 0x8f9000fc, 0x16000014,
-0x240200e1, 0x3c040001, 0x24847e74, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77e7c,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0x8fa20020, 0x8fa30024, 0xae020000, 0xae030004,
-0x26020008, 0xaf8200f0, 0x8f42009c, 0x8f440270,
-0x8f450274, 0x401821, 0x1021, 0xa32821,
-0xa3302b, 0x822021, 0x862021, 0x32230060,
-0x24020040, 0xaf440270, 0xaf450274, 0x10620017,
-0x2c620041, 0x10400005, 0x24020020, 0x10620008,
-0x24020001, 0x10000026, 0x0, 0x24020060,
-0x10620019, 0x24020001, 0x10000021, 0x0,
-0x8f420278, 0x8f43027c, 0x24630001, 0x2c640001,
-0x441021, 0xaf420278, 0xaf43027c, 0x8f420278,
-0x8f43027c, 0x10000016, 0x24020001, 0x8f420280,
-0x8f430284, 0x24630001, 0x2c640001, 0x441021,
-0xaf420280, 0xaf430284, 0x8f420280, 0x8f430284,
-0x1000000b, 0x24020001, 0x8f420288, 0x8f43028c,
-0x24630001, 0x2c640001, 0x441021, 0xaf420288,
-0xaf43028c, 0x8f420288, 0x8f43028c, 0x24020001,
-0xa34205c2, 0x8f420098, 0x3244ffff, 0x2406fff8,
-0x8f45013c, 0x441021, 0x24420007, 0x461024,
-0x24840007, 0xaf420094, 0x8f420090, 0x8f430094,
-0x862024, 0x441023, 0x65182b, 0x14600005,
-0xaf420090, 0x8f420094, 0x8f430144, 0x431023,
-0xaf420094, 0x8f420094, 0x10000023, 0xaf40009c,
-0x3247ffff, 0x50e00022, 0x32c20020, 0x14400002,
-0x24020010, 0x24020002, 0xafa20010, 0x8f420030,
-0xafa20014, 0x8f420010, 0xafa20018, 0x8f460098,
-0x8f420108, 0x40f809, 0x0, 0x1040003b,
-0x3245ffff, 0x8f420098, 0x8f430090, 0x8f46013c,
-0x451021, 0xaf420098, 0x8f42009c, 0x8f440098,
-0xa34005c2, 0x651823, 0xaf430090, 0x451021,
-0x86202b, 0x14800005, 0xaf42009c, 0x8f420098,
-0x8f430144, 0x431023, 0xaf420098, 0x32c20020,
-0x10400005, 0x0, 0x8f420358, 0x2442ffff,
-0xaf420358, 0x8f420358, 0x8f420030, 0x8f430040,
-0x24420001, 0x2463ffff, 0x431024, 0xaf420030,
-0x8f420030, 0x14530019, 0x0, 0x8f420000,
-0x10400007, 0x0, 0xaf80004c, 0x8f82004c,
-0x1040fffd, 0x0, 0x10000005, 0x0,
-0xaf800048, 0x8f820048, 0x1040fffd, 0x0,
-0x8f820060, 0x2403fff7, 0x431024, 0xaf820060,
-0x8f420000, 0x10400004, 0x0, 0xaf80004c,
-0x10000002, 0x0, 0xaf800048, 0x8fbf0038,
-0x8fb30034, 0x8fb20030, 0x8fb1002c, 0x8fb00028,
-0x3e00008, 0x27bd0040, 0x3e00008, 0x0,
-0x27bdffd0, 0x32c20020, 0xafbf002c, 0xafb20028,
-0xafb10024, 0x10400004, 0xafb00020, 0x8f520028,
-0x10000002, 0x0, 0x8f520020, 0x8f420030,
-0x105200b7, 0x21100, 0x8f43001c, 0x628021,
-0x8e040000, 0x8e050004, 0x96110008, 0x8f420090,
-0x9607000a, 0x3226ffff, 0x46102a, 0x10400018,
-0x0, 0x8f8200d8, 0x8f430098, 0x431023,
-0x2442dc46, 0xaf420090, 0x8f420090, 0x2842dc47,
-0x10400005, 0x0, 0x8f420090, 0x8f430144,
-0x431021, 0xaf420090, 0x8f420090, 0x46102a,
-0x10400007, 0x0, 0x8f420348, 0x24420001,
-0xaf420348, 0x8f420348, 0x100000ad, 0x0,
-0x8f8600fc, 0x10c0000c, 0x0, 0x8f8200f4,
-0x2403fff8, 0x431024, 0x461023, 0x218c3,
-0x58600001, 0x24630100, 0x8f42008c, 0x43102b,
-0x14400007, 0x712c2, 0x8f420344, 0x24420001,
-0xaf420344, 0x8f420344, 0x10000099, 0x0,
-0x934305c2, 0x1060000f, 0x30460001, 0x8f420010,
-0x34480400, 0x32c20008, 0x10400008, 0x30e20200,
-0x10400006, 0x3c034000, 0x9602000e, 0xaf4300ac,
-0x21400, 0x10000004, 0xaf4200b0, 0x10000002,
-0xaf4000ac, 0x8f480010, 0x30e20004, 0x10400045,
-0x3227ffff, 0x8f4900ac, 0x11200005, 0x30c200ff,
-0x14400006, 0x24020040, 0x10000004, 0x24020008,
-0x14400002, 0x24020020, 0x24020004, 0xafa20010,
-0x8f430030, 0x11200004, 0xafa30014, 0x8f4200b0,
-0x621025, 0xafa20014, 0x3c020002, 0x1021025,
-0xafa20018, 0x8f460098, 0x8f420108, 0x40f809,
-0x0, 0x1040006a, 0x3224ffff, 0x8f42008c,
-0x8f430094, 0x24420001, 0xaf42008c, 0x24020001,
-0xae03000c, 0xa34205c2, 0x8f420098, 0x2406fff8,
-0x8f45013c, 0x441021, 0x24420007, 0x461024,
-0x24840007, 0xaf420094, 0x8f420090, 0x8f430094,
-0x862024, 0x441023, 0x65182b, 0x14600005,
-0xaf420090, 0x8f420094, 0x8f430144, 0x431023,
-0xaf420094, 0x8f430094, 0x8f420140, 0x43102b,
-0x10400009, 0x0, 0x8f43013c, 0x8f440094,
-0x8f420090, 0x8f450138, 0x641823, 0x431023,
-0xaf420090, 0xaf450094, 0x8f420094, 0x1000001f,
-0xaf420098, 0x10e0001d, 0x30c200ff, 0x14400002,
-0x24020010, 0x24020002, 0xafa20010, 0x8f420030,
-0xafa80018, 0xafa20014, 0x8f460098, 0x8f420108,
-0x40f809, 0x0, 0x10400031, 0x3225ffff,
-0x8f420098, 0x8f44013c, 0x451021, 0xaf420098,
-0x8f420090, 0x8f430098, 0xa34005c2, 0x451023,
-0x64182b, 0x14600005, 0xaf420090, 0x8f420098,
-0x8f430144, 0x431023, 0xaf420098, 0x8f420030,
-0x8f430040, 0x24420001, 0x2463ffff, 0x431024,
-0xaf420030, 0x8f420030, 0x14520019, 0x0,
-0x8f420000, 0x10400007, 0x0, 0xaf80004c,
-0x8f82004c, 0x1040fffd, 0x0, 0x10000005,
-0x0, 0xaf800048, 0x8f820048, 0x1040fffd,
-0x0, 0x8f820060, 0x2403fff7, 0x431024,
-0xaf820060, 0x8f420000, 0x10400004, 0x0,
-0xaf80004c, 0x10000002, 0x0, 0xaf800048,
-0x8fbf002c, 0x8fb20028, 0x8fb10024, 0x8fb00020,
-0x3e00008, 0x27bd0030, 0x3e00008, 0x0,
-0x27bdffd8, 0xafbf0024, 0xafb00020, 0x8f4300f0,
-0x8f4200ec, 0x8f900108, 0x14620017, 0x3c020001,
-0x3c040001, 0x24847e74, 0x240204ea, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77e84,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0x3c020001, 0x8f4300f0, 0x34422ec0, 0x2e21021,
-0x54620004, 0x24620008, 0x3c020001, 0x34422cc0,
-0x2e21021, 0x401821, 0xaf4300f0, 0xac600000,
-0x8f4200ec, 0x8c660004, 0x14620005, 0x3c020001,
-0x26020020, 0xaf820108, 0x1000000f, 0x0,
-0x8f4300f0, 0x34422ec0, 0x2e21021, 0x54620004,
-0x24620008, 0x3c020001, 0x34422cc0, 0x2e21021,
-0x401821, 0x8c620004, 0x21140, 0x2021021,
-0xaf820108, 0xac600000, 0x8e050018, 0x30a20036,
-0x1040006d, 0x30a20001, 0x8e02001c, 0x8f430040,
-0x8f440034, 0x24420001, 0x2463ffff, 0x431024,
-0x862021, 0xaf42002c, 0x30a20030, 0x14400006,
-0xaf440034, 0x8f420034, 0x8c03023c, 0x43102b,
-0x144000cf, 0x0, 0x32c20010, 0x10400028,
-0x24070008, 0x8f440170, 0x8f450174, 0x8f43002c,
-0x8f48000c, 0x8f860120, 0x24020080, 0xafa20010,
-0xafa30014, 0xafa80018, 0x8f42010c, 0x40f809,
-0x24c6001c, 0x14400011, 0x24020001, 0x3c010001,
-0x370821, 0xa02240f1, 0x8f820124, 0xafa20010,
-0x8f820128, 0x3c040001, 0x24847e64, 0xafa20014,
-0x8f46002c, 0x8f870120, 0x3c050009, 0xc002d3b,
-0x34a51100, 0x10000036, 0x0, 0x8f420300,
-0x8f43002c, 0x24420001, 0xaf420300, 0x8f420300,
-0x24020001, 0xa34205c1, 0x10000026, 0xaf430038,
-0x8f440170, 0x8f450174, 0x8f43002c, 0x8f48000c,
-0x8f860120, 0x24020020, 0xafa20010, 0xafa30014,
-0xafa80018, 0x8f42010c, 0x40f809, 0x24c6001c,
-0x14400011, 0x24020001, 0x3c010001, 0x370821,
-0xa02240f0, 0x8f820124, 0xafa20010, 0x8f820128,
-0x3c040001, 0x24847e58, 0xafa20014, 0x8f46002c,
-0x8f870120, 0x3c050009, 0xc002d3b, 0x34a50900,
-0x1000000f, 0x0, 0x8f420300, 0x24420001,
-0xaf420300, 0x8f420300, 0x8f42002c, 0xa34005c1,
-0xaf420038, 0x3c010001, 0x370821, 0xa02040f1,
-0x3c010001, 0x370821, 0xa02040f0, 0xaf400034,
-0x8f420314, 0x24420001, 0xaf420314, 0x8f420314,
-0x10000073, 0x0, 0x10400025, 0x30a27000,
-0x8e05001c, 0x8f420028, 0xa22023, 0x4810003,
-0x0, 0x8f420040, 0x822021, 0x8f420358,
-0x8f430000, 0xaf450028, 0x441021, 0xaf420358,
-0x10600007, 0x0, 0xaf80004c, 0x8f82004c,
-0x1040fffd, 0x0, 0x10000005, 0x0,
-0xaf800048, 0x8f820048, 0x1040fffd, 0x0,
-0x8f820060, 0x34420008, 0xaf820060, 0x8f420000,
-0x10400004, 0x0, 0xaf80004c, 0x10000050,
-0x0, 0xaf800048, 0x1000004d, 0x0,
-0x1040002f, 0x30a21000, 0x1040000c, 0x30a24000,
-0x8e03001c, 0x8f420050, 0x622023, 0x4820001,
-0x24840200, 0x8f42035c, 0x441021, 0xaf42035c,
-0x8f420368, 0x1000001a, 0xaf430050, 0x1040000c,
-0x32c28000, 0x8e03001c, 0x8f420070, 0x622023,
-0x4820001, 0x24840400, 0x8f420364, 0x441021,
-0xaf420364, 0x8f420368, 0x1000000d, 0xaf430070,
-0x1040000e, 0x3c020800, 0x8e03001c, 0x8f420060,
-0x622023, 0x4820001, 0x24840100, 0x8f420360,
-0x441021, 0xaf420360, 0x8f420368, 0xaf430060,
-0x441021, 0xaf420368, 0x3c020800, 0x2c21024,
-0x5040001f, 0x36940040, 0x1000001d, 0x0,
-0x30a20100, 0x10400005, 0x30a20080, 0xc002dd7,
-0x0, 0x10000016, 0x0, 0x14400014,
-0x240205dd, 0x3c040001, 0x24847e74, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77e84,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0x8fbf0024, 0x8fb00020, 0x3e00008, 0x27bd0028,
-0x3e00008, 0x0, 0x27bdff98, 0xafbf0060,
-0xafbe005c, 0xafb50058, 0xafb30054, 0xafb20050,
-0xafb1004c, 0xafb00048, 0x8f920108, 0x8f820104,
-0x16420016, 0x26420020, 0x3c040001, 0x24847e74,
-0x240205f8, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070001, 0x24e77e84, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x3c030001,
-0x431025, 0xaf820140, 0x26420020, 0xaf820108,
-0x8e530018, 0xa3a0003f, 0x32620024, 0x1040022c,
-0xafa00034, 0x8e50001c, 0x8f42001c, 0x101900,
-0x431021, 0x8c51000c, 0x8f430140, 0x965e0016,
-0x9455000a, 0x71182b, 0x10600014, 0x24020634,
-0x3c040001, 0x24847e74, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77e84, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x9624000c,
-0x2c8305dd, 0x38828870, 0x2c420001, 0x621825,
-0x10600015, 0x2821, 0x32c20040, 0x10400015,
-0x24020800, 0x96230014, 0x14620012, 0x3402aaaa,
-0x9623000e, 0x14620007, 0x2021, 0x96230010,
-0x24020300, 0x14620004, 0x801021, 0x96220012,
-0x2c440001, 0x801021, 0x54400006, 0x24050016,
-0x10000004, 0x0, 0x24020800, 0x50820001,
-0x2405000e, 0x934205c3, 0x14400008, 0x5021,
-0x240a0001, 0x32a20180, 0xaf4500a8, 0xaf5100a0,
-0x10400002, 0xaf5000a4, 0xa34a05c3, 0x10a00086,
-0x2253821, 0x90e20000, 0x3021, 0x3042000f,
-0x24880, 0x32c20002, 0x10400012, 0xe91821,
-0x32a20002, 0x10400010, 0x32c20001, 0xe02021,
-0x94820000, 0x24840002, 0xc23021, 0x83102b,
-0x1440fffb, 0x30c2ffff, 0x61c02, 0x623021,
-0x61c02, 0x30c2ffff, 0x623021, 0x61027,
-0xa4e2000a, 0x32c20001, 0x1040006b, 0x32a20001,
-0x10400069, 0x0, 0x8f4200a8, 0x10400066,
-0x0, 0x8f4200a0, 0x8f4300a8, 0x431021,
-0x904b0009, 0x316800ff, 0x39030006, 0x3182b,
-0x39020011, 0x2102b, 0x621824, 0x1060000d,
-0x3c050006, 0x3c040001, 0x24847e8c, 0x8f4200a4,
-0x34a54600, 0xafa20010, 0x8f4200a0, 0x2003021,
-0x1003821, 0xc002d3b, 0xafa20014, 0x1000004e,
-0x0, 0x32c20004, 0x14400013, 0x2821,
-0x314200ff, 0x14400004, 0x0, 0x94e20002,
-0x1000000d, 0x492823, 0x94e5000c, 0x94e2000e,
-0x94e30010, 0xa22821, 0xa32821, 0x94e30012,
-0x90e40009, 0x94e20002, 0xa32821, 0xa42821,
-0x491023, 0xa22821, 0x2202021, 0x94820000,
-0x24840002, 0xc23021, 0x87102b, 0x1440fffb,
-0x61c02, 0x30c2ffff, 0x623021, 0x61c02,
-0x30c2ffff, 0x623021, 0x3c52821, 0x51c02,
-0x30a2ffff, 0x622821, 0x51c02, 0x30a2ffff,
-0x622821, 0xa62823, 0x51402, 0xa22821,
-0x30a5ffff, 0x50a00001, 0x3405ffff, 0x314200ff,
-0x14400008, 0x316300ff, 0x8f4300a0, 0x8f4200a8,
-0x623821, 0x90e20000, 0x3042000f, 0x24880,
-0x316300ff, 0x24020006, 0x14620003, 0xe91021,
-0x10000002, 0x24440010, 0x24440006, 0x314200ff,
-0x14400006, 0x0, 0x94820000, 0xa22821,
-0x51c02, 0x30a2ffff, 0x622821, 0x934205c3,
-0x10400003, 0x32a20100, 0x50400003, 0xa4850000,
-0x52827, 0xa4850000, 0x9642000e, 0x8f43009c,
-0x621821, 0xaf43009c, 0x93a2003f, 0x10400007,
-0x3c024000, 0x2221025, 0xafa20020, 0x8f42009c,
-0x8fac0034, 0x10000003, 0x4c1025, 0xafb10020,
-0x8f42009c, 0xafa20024, 0x32a20080, 0x10400027,
-0x32a20100, 0x8f4200b4, 0x2c420100, 0x14400014,
-0x2402076a, 0x3c040001, 0x24847e74, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77e84,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0x8f4200b4, 0x24430001, 0x210c0, 0x571021,
-0xaf4300b4, 0x8fa30020, 0x8fa40024, 0x3c010001,
-0x220821, 0xac2338e8, 0x3c010001, 0x220821,
-0xac2438ec, 0x100000e7, 0x32c20020, 0x10400091,
-0x0, 0x8f4200b4, 0x2c420100, 0x14400014,
-0x24020778, 0x3c040001, 0x24847e74, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77e84,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0x8f4200b4, 0x24430001, 0x210c0, 0x571021,
-0xaf4300b4, 0x8fa30020, 0x8fa40024, 0x3c010001,
-0x220821, 0xac2338e8, 0x3c010001, 0x220821,
-0xac2438ec, 0x8f4200b4, 0x10400067, 0x8821,
-0x1110c0, 0x571021, 0x3c030001, 0x621821,
-0x8c6338e8, 0x3c040001, 0x822021, 0x8c8438ec,
-0xafa30028, 0xafa4002c, 0x8f9000fc, 0x16000014,
-0x240200f4, 0x3c040001, 0x24847e74, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77e7c,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0x8fa20028, 0x8fa3002c, 0xae020000, 0xae030004,
-0x26020008, 0xaf8200f0, 0x8f42008c, 0x2442ffff,
-0xaf42008c, 0x97a2002e, 0x8f440270, 0x8f450274,
-0x401821, 0x1021, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0xaf440270, 0xaf450274,
-0x8fa30028, 0x3c02001f, 0x3442ffff, 0x622024,
-0x90820000, 0x30420001, 0x1440000c, 0x2402ffff,
-0x8f420278, 0x8f43027c, 0x24630001, 0x2c640001,
-0x441021, 0xaf420278, 0xaf43027c, 0x8f420278,
-0x8f43027c, 0x1000001b, 0x0, 0x8c830000,
-0x1462000f, 0x3402ffff, 0x94830004, 0x1462000c,
-0x0, 0x8f420288, 0x8f43028c, 0x24630001,
-0x2c640001, 0x441021, 0xaf420288, 0xaf43028c,
-0x8f420288, 0x8f43028c, 0x1000000a, 0x0,
-0x8f420280, 0x8f430284, 0x24630001, 0x2c640001,
-0x441021, 0xaf420280, 0xaf430284, 0x8f420280,
-0x8f430284, 0x8f4200b4, 0x26310001, 0x222102b,
-0x1440ff9c, 0x1110c0, 0xa34005c3, 0x10000054,
-0xaf4000b4, 0x8f9000fc, 0x16000014, 0x240200f4,
-0x3c040001, 0x24847e74, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77e7c, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x8fa20020,
-0x8fa30024, 0xae020000, 0xae030004, 0x26020008,
-0xaf8200f0, 0x8f42009c, 0x8f46008c, 0x8f440270,
-0x8f450274, 0x401821, 0x1021, 0x24c6ffff,
-0xaf46008c, 0xa32821, 0xa3302b, 0x822021,
-0x862021, 0xaf440270, 0xaf450274, 0x92220000,
-0x30420001, 0x1440000c, 0x2402ffff, 0x8f420278,
-0x8f43027c, 0x24630001, 0x2c640001, 0x441021,
-0xaf420278, 0xaf43027c, 0x8f420278, 0x8f43027c,
-0x1000001c, 0x32c20020, 0x8e230000, 0x1462000f,
-0x3402ffff, 0x96230004, 0x1462000c, 0x0,
-0x8f420288, 0x8f43028c, 0x24630001, 0x2c640001,
-0x441021, 0xaf420288, 0xaf43028c, 0x8f420288,
-0x8f43028c, 0x1000000b, 0x32c20020, 0x8f420280,
-0x8f430284, 0x24630001, 0x2c640001, 0x441021,
-0xaf420280, 0xaf430284, 0x8f420280, 0x8f430284,
-0x32c20020, 0x10400005, 0xaf40009c, 0x8f420358,
-0x2442ffff, 0xaf420358, 0x8f420358, 0x8e42001c,
-0x8f430040, 0x24420001, 0x2463ffff, 0x431024,
-0xaf42002c, 0x32620060, 0x14400008, 0x32c20010,
-0x8f420034, 0x24420001, 0xaf420034, 0x8c03023c,
-0x43102b, 0x1440011f, 0x32c20010, 0x10400018,
-0x24070008, 0x8f440170, 0x8f450174, 0x8f43002c,
-0x8f48000c, 0x8f860120, 0x24020080, 0xafa20010,
-0xafa30014, 0xafa80018, 0x8f42010c, 0x40f809,
-0x24c6001c, 0x10400047, 0x24020001, 0x8f420300,
-0x8f43002c, 0x24420001, 0xaf420300, 0x8f420300,
-0x24020001, 0xa34205c1, 0x1000007c, 0xaf430038,
-0x8f440170, 0x8f450174, 0x8f43002c, 0x8f48000c,
-0x8f860120, 0x24020020, 0xafa20010, 0xafa30014,
-0xafa80018, 0x8f42010c, 0x40f809, 0x24c6001c,
-0x10400057, 0x24020001, 0x10000065, 0x0,
-0x32620012, 0x10400076, 0x32620001, 0x9642000e,
-0x8f43009c, 0x621821, 0x32c20020, 0x10400005,
-0xaf43009c, 0x8f420358, 0x2442ffff, 0xaf420358,
-0x8f420358, 0x8e42001c, 0x8f430040, 0x24420001,
-0x2463ffff, 0x431024, 0xaf42002c, 0x32620010,
-0x14400008, 0x32c20010, 0x8f420034, 0x24420001,
-0xaf420034, 0x8c03023c, 0x43102b, 0x144000d9,
-0x32c20010, 0x10400028, 0x24070008, 0x8f440170,
-0x8f450174, 0x8f43002c, 0x8f48000c, 0x8f860120,
-0x24020080, 0xafa20010, 0xafa30014, 0xafa80018,
-0x8f42010c, 0x40f809, 0x24c6001c, 0x14400011,
-0x24020001, 0x3c010001, 0x370821, 0xa02240f1,
-0x8f820124, 0xafa20010, 0x8f820128, 0x3c040001,
-0x24847e64, 0xafa20014, 0x8f46002c, 0x8f870120,
-0x3c050009, 0xc002d3b, 0x34a51100, 0x10000036,
-0x0, 0x8f420300, 0x8f43002c, 0x24420001,
-0xaf420300, 0x8f420300, 0x24020001, 0xa34205c1,
-0x10000026, 0xaf430038, 0x8f440170, 0x8f450174,
-0x8f43002c, 0x8f48000c, 0x8f860120, 0x24020020,
-0xafa20010, 0xafa30014, 0xafa80018, 0x8f42010c,
-0x40f809, 0x24c6001c, 0x14400011, 0x24020001,
-0x3c010001, 0x370821, 0xa02240f0, 0x8f820124,
-0xafa20010, 0x8f820128, 0x3c040001, 0x24847e58,
-0xafa20014, 0x8f46002c, 0x8f870120, 0x3c050009,
-0xc002d3b, 0x34a50900, 0x1000000f, 0x0,
-0x8f420300, 0x24420001, 0xaf420300, 0x8f420300,
-0x8f42002c, 0xa34005c1, 0xaf420038, 0x3c010001,
-0x370821, 0xa02040f1, 0x3c010001, 0x370821,
-0xa02040f0, 0xaf400034, 0x8f420314, 0x24420001,
-0xaf420314, 0x8f420314, 0x1000007e, 0x0,
-0x10400025, 0x32627000, 0x8e45001c, 0x8f420028,
-0xa22023, 0x4810003, 0x0, 0x8f420040,
-0x822021, 0x8f420358, 0x8f430000, 0xaf450028,
-0x441021, 0xaf420358, 0x10600007, 0x0,
-0xaf80004c, 0x8f82004c, 0x1040fffd, 0x0,
-0x10000005, 0x0, 0xaf800048, 0x8f820048,
-0x1040fffd, 0x0, 0x8f820060, 0x34420008,
-0xaf820060, 0x8f420000, 0x10400004, 0x0,
-0xaf80004c, 0x1000005b, 0x0, 0xaf800048,
-0x10000058, 0x0, 0x1040002f, 0x32621000,
-0x1040000c, 0x32624000, 0x8e43001c, 0x8f420050,
-0x622023, 0x4820001, 0x24840200, 0x8f42035c,
-0x441021, 0xaf42035c, 0x8f420368, 0x1000001a,
-0xaf430050, 0x1040000c, 0x32c28000, 0x8e43001c,
-0x8f420070, 0x622023, 0x4820001, 0x24840400,
-0x8f420364, 0x441021, 0xaf420364, 0x8f420368,
-0x1000000d, 0xaf430070, 0x1040000e, 0x3c020800,
-0x8e43001c, 0x8f420060, 0x622023, 0x4820001,
-0x24840100, 0x8f420360, 0x441021, 0xaf420360,
-0x8f420368, 0xaf430060, 0x441021, 0xaf420368,
-0x3c020800, 0x2c21024, 0x5040002a, 0x36940040,
-0x10000028, 0x0, 0x32620048, 0x10400009,
-0x240c0001, 0x8e42001c, 0x3c03ffff, 0xa3ac003f,
-0x431824, 0x3042ffff, 0xafa30034, 0x1000fcfd,
-0xae42001c, 0x32620100, 0x10400005, 0x32620080,
-0xc002dd7, 0x0, 0x10000016, 0x0,
-0x14400014, 0x24020896, 0x3c040001, 0x24847e74,
-0xafa20010, 0xafa00014, 0x8f860144, 0x3c070001,
-0x24e77e84, 0xc002d3b, 0x3405dead, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f820220, 0x34420004,
-0xaf820220, 0x8f820140, 0x3c030001, 0x431025,
-0xaf820140, 0x8fbf0060, 0x8fbe005c, 0x8fb50058,
-0x8fb30054, 0x8fb20050, 0x8fb1004c, 0x8fb00048,
-0x3e00008, 0x27bd0068, 0x3e00008, 0x0,
-0x8f8300e4, 0x8f8200e0, 0x2404fff8, 0x441024,
-0x621026, 0x2102b, 0x21023, 0x3e00008,
-0x621024, 0x3e00008, 0x0, 0x27bdffe0,
-0xafbf001c, 0xafb00018, 0x8f8600c4, 0x8f8400e0,
-0x8f8500e4, 0x2402fff8, 0x821824, 0x10a30009,
-0x27623ff8, 0x14a20002, 0x24a20008, 0x27623000,
-0x408021, 0x16030005, 0x30820004, 0x10400004,
-0xc02021, 0x10000022, 0x1021, 0x8e040000,
-0x8f42011c, 0x14a20003, 0x0, 0x8f420120,
-0xaf420114, 0x8ca30000, 0x8f420148, 0x831823,
-0x43102b, 0x10400003, 0x0, 0x8f420148,
-0x621821, 0x94a20006, 0x24420050, 0x62102b,
-0x1440000f, 0xa01021, 0xafa40010, 0xafa30014,
-0x8ca60000, 0x8ca70004, 0x3c040001, 0xc002d3b,
-0x24847f5c, 0x8f42020c, 0x24420001, 0xaf42020c,
-0x8f42020c, 0x1021, 0xaf9000e8, 0xaf9000e4,
-0x8fbf001c, 0x8fb00018, 0x3e00008, 0x27bd0020,
-0x3e00008, 0x0, 0x8f8300e4, 0x27623ff8,
-0x14620002, 0x24620008, 0x27623000, 0x401821,
-0xaf8300e8, 0xaf8300e4, 0x3e00008, 0x0,
-0x3e00008, 0x0, 0x8f8400e0, 0x8f8800c4,
-0x8f8300e8, 0x2402fff8, 0x823824, 0xe32023,
-0x2c821000, 0x50400001, 0x24841000, 0x420c2,
-0x801821, 0x8f440258, 0x8f45025c, 0x1021,
-0xa32821, 0xa3302b, 0x822021, 0x862021,
-0xaf440258, 0xaf45025c, 0x8f8300c8, 0x8f420148,
-0x1032023, 0x82102b, 0x14400004, 0x801821,
-0x8f420148, 0x822021, 0x801821, 0x8f440250,
-0x8f450254, 0x1021, 0xa32821, 0xa3302b,
-0x822021, 0x862021, 0xaf440250, 0xaf450254,
-0xaf8800c8, 0xaf8700e4, 0xaf8700e8, 0x3e00008,
-0x0, 0x27bdff28, 0x240a0001, 0xafbf00d0,
-0xafbe00cc, 0xafb500c8, 0xafb300c4, 0xafb200c0,
-0xafb100bc, 0xafb000b8, 0xa3a0009f, 0xafa0004c,
-0xafaa0064, 0xa7a00096, 0xafa00040, 0x934205c4,
-0x8821, 0x1040000a, 0xa7a0008e, 0x8f4b00c4,
-0xafab006c, 0x8f4a00c0, 0xafaa0074, 0x8f4b00cc,
-0xafab007c, 0x8f4a00c8, 0x1000019f, 0xafaa0084,
-0x8f420114, 0x40f809, 0x0, 0x403021,
-0x10c00418, 0x0, 0x8cc20000, 0x8cc30004,
-0xafa20020, 0xafa30024, 0x8fab0024, 0x8faa0020,
-0x3162ffff, 0x2442fffc, 0xafa20074, 0x3c020006,
-0x2c21024, 0xafab0084, 0x14400015, 0xafaa006c,
-0x91420000, 0x30420001, 0x10400011, 0x2402ffff,
-0x8d430000, 0x14620004, 0x3402ffff, 0x95430004,
-0x1062000b, 0x0, 0xc0025dd, 0x8fa4006c,
-0x304200ff, 0x14400006, 0x0, 0x8f420118,
-0x40f809, 0x0, 0x100003f6, 0x0,
-0x8fa20024, 0x3c03ffbf, 0x3463ffff, 0x431024,
-0x3c03ffff, 0x431824, 0x14600003, 0xafa20024,
-0x10000040, 0x1821, 0x3c020080, 0x621024,
-0x10400007, 0x0, 0x8f42038c, 0x24420001,
-0xaf42038c, 0x8f42038c, 0x10000036, 0x24030001,
-0x8f420210, 0x24420001, 0xaf420210, 0x8f420210,
-0x3c020001, 0x621024, 0x10400006, 0x3c020002,
-0x8f4201c4, 0x24420001, 0xaf4201c4, 0x8f4201c4,
-0x3c020002, 0x621024, 0x10400006, 0x3c020004,
-0x8f42037c, 0x24420001, 0xaf42037c, 0x8f42037c,
-0x3c020004, 0x621024, 0x10400006, 0x3c020008,
-0x8f420380, 0x24420001, 0xaf420380, 0x8f420380,
-0x3c020008, 0x621024, 0x10400006, 0x3c020010,
-0x8f420384, 0x24420001, 0xaf420384, 0x8f420384,
-0x3c020010, 0x621024, 0x10400006, 0x3c020020,
-0x8f4201c0, 0x24420001, 0xaf4201c0, 0x8f4201c0,
-0x3c020020, 0x621024, 0x10400006, 0x24030001,
-0x8f420388, 0x24420001, 0xaf420388, 0x8f420388,
-0x24030001, 0x8c020260, 0x8fab0074, 0x4b102b,
-0x10400014, 0x307000ff, 0x8f4201e8, 0x24420001,
-0xaf4201e8, 0x8f4201e8, 0x8faa0084, 0x8f8200e0,
-0x354a0100, 0xafaa0084, 0xafa20010, 0x8f8200e4,
-0x24100001, 0x3c040001, 0x24847f68, 0xafa20014,
-0x8fa60020, 0x8fa70024, 0x3c050007, 0xc002d3b,
-0x34a50800, 0x12000011, 0x3c020080, 0x2c21024,
-0x1440000f, 0x32c20400, 0x8fab0084, 0x3c020080,
-0x34420100, 0x1621024, 0x10400005, 0x0,
-0x8f42020c, 0x24420001, 0xaf42020c, 0x8f42020c,
-0x8fa30074, 0x10000377, 0x0, 0x32c20400,
-0x10400015, 0x34028100, 0x8faa006c, 0x9543000c,
-0x14620012, 0x3c020100, 0x240b0200, 0xa7ab0096,
-0x9542000e, 0x8d430008, 0x8d440004, 0x8d450000,
-0x8faa0074, 0x8fab006c, 0x254afffc, 0xafaa0074,
-0xa7a2008e, 0xad63000c, 0xad640008, 0xad650004,
-0x256b0004, 0xafab006c, 0x3c020100, 0x2c21024,
-0x10400004, 0x0, 0x8faa0074, 0x254a0004,
-0xafaa0074, 0x16000005, 0x24020800, 0x8fab006c,
-0x9563000c, 0x50620001, 0x2411000e, 0x8f4200bc,
-0x5040000a, 0xafa0007c, 0x8faa0074, 0x4a102b,
-0x50400006, 0xafa0007c, 0x8f4200bc, 0x1421023,
-0xafa2007c, 0x8f4b00bc, 0xafab0074, 0x8f420080,
-0x8faa0074, 0x4a102b, 0x104000c5, 0x32c28000,
-0x104000cd, 0x32c21000, 0x10400058, 0x240b0004,
-0x3c021000, 0x2c21024, 0x104000c7, 0xafab0064,
-0x122000c5, 0x0, 0x8faa006c, 0x8fab0074,
-0x1711023, 0x2c420014, 0x144000c0, 0x1512021,
-0x24830006, 0x90820000, 0x3c05001f, 0x34a5ffff,
-0x3042000f, 0x23080, 0xa3102b, 0x10400003,
-0x0, 0x8f420148, 0x621823, 0x94620000,
-0x30421fff, 0x10400003, 0x2261021, 0x100000ae,
-0xafa20040, 0x24830009, 0xa3102b, 0x10400003,
-0x0, 0x8f420148, 0x621823, 0x90630000,
-0x24020006, 0x14620017, 0x24020011, 0x94820002,
-0x2c420028, 0x144000a0, 0x861821, 0xa3102b,
-0x50400004, 0x2463000c, 0x8f420148, 0x621823,
-0x2463000c, 0xa3102b, 0x10400003, 0x0,
-0x8f420148, 0x621823, 0x90630000, 0x306200f0,
-0x21882, 0x2261021, 0x431021, 0x1000008e,
-0xafa20040, 0x1462008c, 0x0, 0x94820002,
-0x2c42001c, 0x14400088, 0x2263821, 0x94830002,
-0x24e20008, 0x2c63009c, 0x14600083, 0xafa20040,
-0x861821, 0xa3102b, 0x10400003, 0x0,
-0x8f420148, 0x621823, 0x94620000, 0x24040801,
-0x10440004, 0x24e20088, 0x94620002, 0x14440076,
-0x24e20088, 0x10000074, 0xafa20040, 0x10000071,
-0x240a0003, 0x8f420350, 0x2403ffbf, 0x283a024,
-0x24420001, 0xaf420350, 0x8f420350, 0x100002b8,
-0x0, 0x2c2b025, 0x2402ffbf, 0x282a024,
-0x8f830128, 0x3c040001, 0x24847fa0, 0x26620001,
-0xafa20014, 0xafa30010, 0x8f860120, 0x8f870124,
-0x3c050007, 0xc002d3b, 0x34a52250, 0x100002a8,
-0x0, 0x2c2b025, 0x2402ffbf, 0x282a024,
-0x8f830128, 0x3c040001, 0x24847fa0, 0x24020002,
-0xafa20014, 0xafa30010, 0x8f860120, 0x8f870124,
-0x3c050007, 0xc002d3b, 0x34a52450, 0x10000298,
-0x0, 0x8ea20000, 0x8ea30004, 0x3c040001,
-0x24847fb8, 0xafb00010, 0xafbe0014, 0x8ea70018,
-0x34a52800, 0xc002d3b, 0x603021, 0x3c040001,
-0x24847f4c, 0x1000001f, 0x2402058d, 0xa6b1000a,
-0x8f820124, 0x3c040001, 0x24847fc0, 0xafbe0014,
-0xafa20010, 0x8f460044, 0x8f870120, 0x3c050007,
-0xc002d3b, 0x34a53000, 0x3c040001, 0x24847f4c,
-0x10000010, 0x240205c9, 0xa6b1000a, 0xa6b2000e,
-0x8f820124, 0x3c040001, 0x24847fcc, 0xafbe0014,
-0xafa20010, 0x8f460044, 0x8f870120, 0x3c050007,
-0xc002d3b, 0x34a53200, 0x3c040001, 0x24847f4c,
-0x240205fe, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070001, 0x24e77f98, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x3c030001,
-0x431025, 0xaf820140, 0x10000259, 0x0,
-0x8f420084, 0x8fab0074, 0x4b102b, 0x14400007,
-0x3c020001, 0x2c21024, 0x10400004, 0x0,
-0x240a0002, 0xafaa0064, 0x8fab0074, 0x1160026d,
-0x27aa0020, 0xafaa00ac, 0x3c0b001f, 0x356bffff,
-0xafab00a4, 0x8faa0064, 0x240b0001, 0x154b0022,
-0x24020002, 0x8f430054, 0x8f420050, 0x1062000b,
-0x274a0054, 0x8f5e0054, 0x3403ecc0, 0xafaa0054,
-0x27c20001, 0x304201ff, 0xafa2005c, 0x1e1140,
-0x431021, 0x10000077, 0x2e2a821, 0x8f420044,
-0x8fab0074, 0x3c040001, 0x24847f74, 0xafab0014,
-0xafa20010, 0x8f460054, 0x8f470050, 0x3c050007,
-0xc002d3b, 0x34a51300, 0x8f430350, 0x2402ffbf,
-0x282a024, 0x24630001, 0xaf430350, 0x8f420350,
-0x10000223, 0x0, 0x1542001d, 0x0,
-0x8f430074, 0x8f420070, 0x1062000a, 0x274b0074,
-0x8f5e0074, 0xafab0054, 0x27c20001, 0x304203ff,
-0xafa2005c, 0x1e1140, 0x24426cc0, 0x10000055,
-0x2e2a821, 0x8f420044, 0x8faa0074, 0x3c040001,
-0x24847f80, 0x3c050007, 0xafaa0014, 0xafa20010,
-0x8f460074, 0x8f470070, 0x34a51500, 0x240b0001,
-0xc002d3b, 0xafab0064, 0x1000ffc2, 0x0,
-0x8f430064, 0x8f420060, 0x1062002b, 0x274a0064,
-0x8f5e0064, 0x8fab0064, 0xafaa0054, 0x27c20001,
-0x304200ff, 0xafa2005c, 0x24020004, 0x1562001f,
-0x1e1140, 0x1e1180, 0x24420cc0, 0x2e21021,
-0xafa2004c, 0x24550020, 0x3c021000, 0x2c21024,
-0x1040000e, 0x0, 0x8faa004c, 0x8fab0074,
-0x9542002a, 0x4b102b, 0x54400006, 0x240a0001,
-0x8fa20040, 0x10400027, 0x0, 0x104b0025,
-0x240a0001, 0x10000023, 0xa3aa009f, 0x8fab004c,
-0x8faa0074, 0x9562002a, 0x4a102b, 0x1040001d,
-0x240b0001, 0x1000001b, 0xa3ab009f, 0x24424cc0,
-0x10000018, 0x2e2a821, 0x8f420044, 0x8faa0074,
-0x3c040001, 0x24847f8c, 0xafaa0014, 0xafa20010,
-0x8f460064, 0x8f470060, 0x3c050007, 0xc002d3b,
-0x34a51800, 0x3c020008, 0x2c21024, 0x1440ff09,
-0x0, 0x8f420370, 0x240b0001, 0xafab0064,
-0x24420001, 0xaf420370, 0x8f420370, 0x1000ff7d,
-0x0, 0x8faa006c, 0xaeaa0018, 0x93a2009f,
-0x104000ae, 0x24050002, 0x8fab004c, 0x8fa40040,
-0x25620020, 0xafa20028, 0x25620008, 0xafa20030,
-0x25620010, 0xafab002c, 0x1080000e, 0xafa20034,
-0x9563002a, 0x83102b, 0x54400001, 0x801821,
-0x1000000b, 0xa7a30038, 0x27a30036, 0x131040,
-0x621821, 0x94620000, 0x441021, 0x10000016,
-0xa4620000, 0x8faa004c, 0x9542002a, 0xa7a20038,
-0x8fab004c, 0x8fa40074, 0x8fa300ac, 0x95620018,
-0xa7a2003a, 0x9562001a, 0xa7a2003c, 0x9562001c,
-0x9821, 0xa7a2003e, 0x94620018, 0x24630002,
-0x822023, 0x1880ffe8, 0x26730001, 0x2e620004,
-0x1440fff9, 0x0, 0x18800014, 0x2402052b,
-0x3c040001, 0x24847f4c, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77f98, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x8f4200fc,
-0x26650001, 0xa2102a, 0x1440003f, 0x24030001,
-0x8f83012c, 0x10600037, 0x0, 0x8f820124,
-0x431023, 0x22143, 0x58800001, 0x24840040,
-0x8f820128, 0x431023, 0x21943, 0x58600001,
-0x24630040, 0x64102a, 0x54400001, 0x602021,
-0xaf4400fc, 0x8f4200fc, 0xa2102a, 0x10400025,
-0x24030001, 0x10000029, 0x306200ff, 0x8faa006c,
-0x96070018, 0xafaa0010, 0x8e220008, 0x3c040001,
-0x24847fac, 0x8c430004, 0x8c420000, 0x34a52400,
-0x2403021, 0xc002d3b, 0xafa30014, 0x3c040001,
-0x24847f4c, 0x2402054f, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77f98, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x1000002b,
-0x0, 0x8f420334, 0x1821, 0x24420001,
-0xaf420334, 0x8f420334, 0x306200ff, 0x5040fe7d,
-0x3c020800, 0x12600021, 0x9021, 0x8fb100ac,
-0x2208021, 0x8e220008, 0x96070018, 0x8fa6006c,
-0x8c440000, 0x8c450004, 0x240b0001, 0xafab0010,
-0xafbe0014, 0x8f420008, 0xafa20018, 0x8f42010c,
-0x40f809, 0x0, 0x1040ffc4, 0x3c050007,
-0x96020018, 0x8faa006c, 0x8fab00a4, 0x1425021,
-0x16a102b, 0x10400004, 0xafaa006c, 0x8f420148,
-0x1425023, 0xafaa006c, 0x26100002, 0x26520001,
-0x253102b, 0x1440ffe3, 0x26310004, 0x8fb00074,
-0x97b10038, 0x10000035, 0x0, 0x8f4200fc,
-0xa2102a, 0x1440001b, 0x24030001, 0x8f83012c,
-0x10600013, 0x0, 0x8f820124, 0x431023,
-0x22143, 0x58800001, 0x24840040, 0x8f820128,
-0x431023, 0x21943, 0x58600001, 0x24630040,
-0x64102a, 0x54400001, 0x602021, 0xaf4400fc,
-0x8f4200fc, 0xa2102a, 0x14400006, 0x24030001,
-0x8f420334, 0x1821, 0x24420001, 0xaf420334,
-0x8f420334, 0x306200ff, 0x1040fe46, 0x3c020800,
-0x96b1000a, 0x8fb00074, 0x3223ffff, 0x70102b,
-0x54400001, 0x608021, 0x8ea40000, 0x8ea50004,
-0x240a0001, 0xafaa0010, 0xafbe0014, 0x8f420008,
-0x8fa6006c, 0xafa20018, 0x8f42010c, 0x40f809,
-0x2003821, 0x1040fe43, 0x3c050007, 0x96a4000e,
-0x97ab0096, 0x11600007, 0x809021, 0x934205c4,
-0x14400004, 0x0, 0x97aa008e, 0x8b2025,
-0xa6aa0016, 0x8fab0084, 0x3c02ffff, 0x1621024,
-0x10400003, 0xb1402, 0x34840400, 0xa6a20014,
-0x3c021000, 0x2c21024, 0x10400006, 0x0,
-0x8fa20040, 0x401821, 0x1021, 0xaea20000,
-0xaea30004, 0x8faa0074, 0x560a0073, 0xa6a4000e,
-0x34820004, 0xa6a2000e, 0x8fab007c, 0x14b1021,
-0xa6a2000a, 0x8f430044, 0x8f4401a0, 0x8f4501a4,
-0x34028000, 0xafa20010, 0x8f420044, 0x2a03021,
-0x24070020, 0xafa20014, 0x8f42000c, 0x31940,
-0x604821, 0xafa20018, 0x8f42010c, 0x4021,
-0xa92821, 0xa9182b, 0x882021, 0x40f809,
-0x832021, 0x5040fe19, 0xa6b2000e, 0x8f420368,
-0xafa00074, 0xa34005c4, 0x2442ffff, 0xaf420368,
-0x8faa0064, 0x240b0001, 0x8f420368, 0x154b0006,
-0x24020002, 0x8f42035c, 0x2442ffff, 0xaf42035c,
-0x1000000c, 0x8f42035c, 0x15420006, 0x0,
-0x8f420364, 0x2442ffff, 0xaf420364, 0x10000005,
-0x8f420364, 0x8f420360, 0x2442ffff, 0xaf420360,
-0x8f420360, 0x8faa005c, 0x8fab0054, 0xad6a0000,
-0x8f420044, 0x8f440088, 0x8f430078, 0x24420001,
-0x441024, 0x24630001, 0xaf420044, 0xaf430078,
-0x8c020240, 0x62182b, 0x14600076, 0x24070008,
-0x8f440168, 0x8f45016c, 0x8f430044, 0x8f48000c,
-0x8f860120, 0x24020040, 0xafa20010, 0xafa30014,
-0xafa80018, 0x8f42010c, 0x40f809, 0x24c6001c,
-0x14400011, 0x240b0001, 0x3c010001, 0x370821,
-0xa02b40f2, 0x8f820124, 0xafa20010, 0x8f820128,
-0x3c040001, 0x24847f44, 0xafa20014, 0x8f460044,
-0x8f870120, 0x3c050009, 0xc002d3b, 0x34a51300,
-0x1000000b, 0x0, 0x8f420304, 0x24420001,
-0xaf420304, 0x8f420304, 0x8f420044, 0xaf42007c,
-0x3c010001, 0x370821, 0xa02040f2, 0xaf400078,
-0x8f420318, 0x24420001, 0xaf420318, 0x8f420318,
-0x10000048, 0x0, 0xa6b0000a, 0x8f430044,
-0x8f4401a0, 0x8f4501a4, 0x34028000, 0xafa20010,
-0x8f420044, 0x2a03021, 0x24070020, 0xafa20014,
-0x8f42000c, 0x31940, 0x604821, 0xafa20018,
-0x8f42010c, 0x4021, 0xa92821, 0xa9182b,
-0x882021, 0x40f809, 0x832021, 0x1040fdba,
-0x240a0001, 0xa34a05c4, 0x8fab0074, 0x8faa006c,
-0x1705823, 0xafab0074, 0x8fab00a4, 0x1505021,
-0x16a102b, 0x10400004, 0xafaa006c, 0x8f420148,
-0x1425023, 0xafaa006c, 0x8f420368, 0x2442ffff,
-0xaf420368, 0x8faa0064, 0x240b0001, 0x8f420368,
-0x154b0006, 0x24020002, 0x8f42035c, 0x2442ffff,
-0xaf42035c, 0x1000000c, 0x8f42035c, 0x11420006,
-0x0, 0x8f420360, 0x2442ffff, 0xaf420360,
-0x10000005, 0x8f420360, 0x8f420364, 0x2442ffff,
-0xaf420364, 0x8f420364, 0x8faa005c, 0x8fab0054,
-0xad6a0000, 0x8f420044, 0x8f440088, 0x8f430078,
-0x24420001, 0x441024, 0x24630001, 0xaf420044,
-0xaf430078, 0x8fab0074, 0x1560fdba, 0x0,
-0x8faa0074, 0x1140001f, 0x0, 0x934205c4,
-0x10400009, 0x0, 0x8fab006c, 0xaf4b00c4,
-0xaf4a00c0, 0x8faa0084, 0xaf4a00c8, 0x8fab007c,
-0x1000000e, 0xaf4b00cc, 0x97aa0096, 0x1140000b,
-0x34038100, 0x8fa20020, 0x8c46000c, 0xa443000c,
-0x97ab008e, 0x8c440004, 0x8c450008, 0xa44b000e,
-0xac440000, 0xac450004, 0xac460008, 0x8f42034c,
-0x24420001, 0xaf42034c, 0x8f42034c, 0x10000011,
-0x0, 0x8faa0084, 0x3144ffff, 0x2484fffc,
-0x801821, 0x8f440250, 0x8f450254, 0x8f460118,
-0x1021, 0xa32821, 0xa3382b, 0x822021,
-0x872021, 0xaf440250, 0xaf450254, 0xc0f809,
-0x0, 0x8fbf00d0, 0x8fbe00cc, 0x8fb500c8,
-0x8fb300c4, 0x8fb200c0, 0x8fb100bc, 0x8fb000b8,
-0x3e00008, 0x27bd00d8, 0x3e00008, 0x0,
-0x27bdff30, 0x240b0001, 0xafbf00c8, 0xafbe00c4,
-0xafb500c0, 0xafb300bc, 0xafb200b8, 0xafb100b4,
-0xafb000b0, 0xa3a0008f, 0xafa0004c, 0xafab0064,
-0xa7a0007e, 0xafa00040, 0x934205c4, 0x8821,
-0x10400007, 0xa7a00086, 0x8f4c00c0, 0xafac006c,
-0x8f4b00c8, 0x8f5e00c4, 0x10000184, 0xafab0074,
-0x8f420114, 0x40f809, 0x0, 0x403021,
-0x10c00348, 0x0, 0x8cc20000, 0x8cc30004,
-0xafa20020, 0xafa30024, 0x8fac0024, 0x8fbe0020,
-0x3182ffff, 0x2442fffc, 0xafa2006c, 0x3c020006,
-0x2c21024, 0x14400015, 0xafac0074, 0x93c20000,
-0x30420001, 0x10400011, 0x2402ffff, 0x8fc30000,
-0x14620004, 0x3402ffff, 0x97c30004, 0x1062000b,
-0x0, 0xc0025dd, 0x3c02021, 0x304200ff,
-0x14400006, 0x0, 0x8f420118, 0x40f809,
-0x0, 0x10000327, 0x0, 0x8fa20024,
-0x3c03ffbf, 0x3463ffff, 0x431024, 0x3c03ffff,
-0x431824, 0x14600003, 0xafa20024, 0x10000040,
-0x8021, 0x3c020080, 0x621024, 0x10400007,
-0x0, 0x8f42038c, 0x24420001, 0xaf42038c,
-0x8f42038c, 0x10000036, 0x24100001, 0x8f420210,
-0x24420001, 0xaf420210, 0x8f420210, 0x3c020001,
-0x621024, 0x10400006, 0x3c020002, 0x8f4201c4,
-0x24420001, 0xaf4201c4, 0x8f4201c4, 0x3c020002,
-0x621024, 0x10400006, 0x3c020004, 0x8f42037c,
-0x24420001, 0xaf42037c, 0x8f42037c, 0x3c020004,
-0x621024, 0x10400006, 0x3c020008, 0x8f420380,
-0x24420001, 0xaf420380, 0x8f420380, 0x3c020008,
-0x621024, 0x10400006, 0x3c020010, 0x8f420384,
-0x24420001, 0xaf420384, 0x8f420384, 0x3c020010,
-0x621024, 0x10400006, 0x3c020020, 0x8f4201c0,
-0x24420001, 0xaf4201c0, 0x8f4201c0, 0x3c020020,
-0x621024, 0x10400006, 0x24100001, 0x8f420388,
-0x24420001, 0xaf420388, 0x8f420388, 0x24100001,
-0x8c020260, 0x8fab006c, 0x4b102b, 0x10400015,
-0x320200ff, 0x8f4201e8, 0x24420001, 0xaf4201e8,
-0x8f4201e8, 0x8fac0074, 0x8f8200e0, 0x358c0100,
-0xafac0074, 0xafa20010, 0x8f8200e4, 0x24100001,
-0x3c040001, 0x24847f68, 0xafa20014, 0x8fa60020,
-0x8fa70024, 0x3c050007, 0xc002d3b, 0x34a53600,
-0x320200ff, 0x10400011, 0x3c020080, 0x2c21024,
-0x1440000f, 0x32c20400, 0x8fab0074, 0x3c020080,
-0x34420100, 0x1621024, 0x10400005, 0x0,
-0x8f42020c, 0x24420001, 0xaf42020c, 0x8f42020c,
-0x8fa3006c, 0x100002a7, 0x0, 0x32c20400,
-0x10400012, 0x34028100, 0x97c3000c, 0x1462000f,
-0x0, 0x240c0200, 0xa7ac007e, 0x97c2000e,
-0x8fc30008, 0x8fc40004, 0x8fab006c, 0x8fc50000,
-0x256bfffc, 0xafab006c, 0xa7a20086, 0xafc3000c,
-0xafc40008, 0xafc50004, 0x27de0004, 0x8fa7006c,
-0x320200ff, 0x14400033, 0x3c020100, 0x97c4000c,
-0x2c8305dd, 0x38828870, 0x2c420001, 0x621825,
-0x10600014, 0x32c20800, 0x10400015, 0x24020800,
-0x97c30014, 0x14620012, 0x3402aaaa, 0x97c3000e,
-0x14620007, 0x2021, 0x97c30010, 0x24020300,
-0x14620004, 0x801021, 0x97c20012, 0x2c440001,
-0x801021, 0x54400006, 0x24110016, 0x10000004,
-0x0, 0x24020800, 0x50820001, 0x2411000e,
-0x12200013, 0x3d12021, 0x24830009, 0x3c02001f,
-0x3442ffff, 0x43102b, 0x10400003, 0x0,
-0x8f420148, 0x621823, 0x90620000, 0x38430006,
-0x2c630001, 0x38420011, 0x2c420001, 0x621825,
-0x10600004, 0x3c020100, 0x94820002, 0x513821,
-0x3c020100, 0x2c21024, 0x5040000e, 0xafa7006c,
-0x8fac006c, 0x10ec0008, 0x3c050007, 0x3c040001,
-0x24847fd8, 0x8fa6006c, 0x34a54000, 0xafa00010,
-0xc002d3b, 0xafa00014, 0x8fab006c, 0x256b0004,
-0xafab006c, 0x8f420080, 0x8fac006c, 0x4c102b,
-0x10400080, 0x32c28000, 0x10400088, 0x32c21000,
-0x10400055, 0x240b0004, 0x3c021000, 0x2c21024,
-0x10400082, 0xafab0064, 0x12200080, 0x1911023,
-0x2c420014, 0x1440007d, 0x3d12021, 0x24830006,
-0x90820000, 0x3c05001f, 0x34a5ffff, 0x3042000f,
-0x23080, 0xa3102b, 0x10400003, 0x0,
-0x8f420148, 0x621823, 0x94620000, 0x30421fff,
-0x10400003, 0x2261021, 0x1000006c, 0xafa20040,
-0x24830009, 0xa3102b, 0x10400003, 0x0,
-0x8f420148, 0x621823, 0x90630000, 0x24020006,
-0x14620017, 0x24020011, 0x94820002, 0x2c420028,
-0x1440005e, 0x861821, 0xa3102b, 0x50400004,
-0x2463000c, 0x8f420148, 0x621823, 0x2463000c,
-0xa3102b, 0x10400003, 0x0, 0x8f420148,
-0x621823, 0x90630000, 0x306200f0, 0x21882,
-0x2261021, 0x431021, 0x1000004c, 0xafa20040,
-0x1462004a, 0x0, 0x94820002, 0x2c42001c,
-0x14400046, 0x2263821, 0x94830002, 0x24e20008,
-0x2c63009c, 0x14600041, 0xafa20040, 0x861821,
-0xa3102b, 0x10400003, 0x0, 0x8f420148,
-0x621823, 0x94620000, 0x24040801, 0x10440004,
-0x24e20088, 0x94620002, 0x14440034, 0x24e20088,
-0x10000032, 0xafa20040, 0x1000002f, 0x240c0003,
-0x8f420350, 0x2403ffbf, 0x283a024, 0x24420001,
-0xaf420350, 0x8f420350, 0x100001c4, 0x0,
-0x3c020800, 0x2c2b025, 0x2402ffbf, 0x282a024,
-0x8f830128, 0x3c040001, 0x24847fa0, 0x26620001,
-0xafa20014, 0xafa30010, 0x8f860120, 0x8f870124,
-0x3c050007, 0xc002d3b, 0x34a55300, 0x100001b3,
-0x0, 0x8ea20000, 0x8ea30004, 0x3c040001,
-0x24847fb8, 0xafb00010, 0xafb10014, 0x8ea70018,
-0x34a55900, 0xc002d3b, 0x603021, 0x100001a7,
-0x0, 0x8f420084, 0x8fab006c, 0x4b102b,
-0x14400007, 0x3c020001, 0x2c21024, 0x10400004,
-0x0, 0x240c0002, 0xafac0064, 0x8fab006c,
-0x116001b8, 0x27ac0020, 0xafac0094, 0x8fab0064,
-0x240c0001, 0x556c0022, 0x240c0002, 0x8f430054,
-0x8f420050, 0x1062000b, 0x274b0054, 0x8f510054,
-0x3403ecc0, 0xafab0054, 0x26220001, 0x304201ff,
-0xafa2005c, 0x111140, 0x431021, 0x10000077,
-0x2e2a821, 0x8f420044, 0x8fac006c, 0x3c040001,
-0x24847f74, 0xafac0014, 0xafa20010, 0x8f460054,
-0x8f470050, 0x3c050007, 0xc002d3b, 0x34a54300,
-0x8f430350, 0x2402ffbf, 0x282a024, 0x24630001,
-0xaf430350, 0x8f420350, 0x10000174, 0x0,
-0x156c001d, 0x0, 0x8f430074, 0x8f420070,
-0x1062000a, 0x274b0074, 0x8f510074, 0xafab0054,
-0x26220001, 0x304203ff, 0xafa2005c, 0x111140,
-0x24426cc0, 0x10000055, 0x2e2a821, 0x8f420044,
-0x8fac006c, 0x3c040001, 0x24847f80, 0x3c050007,
-0xafac0014, 0xafa20010, 0x8f460074, 0x8f470070,
-0x34a54500, 0x240b0001, 0xc002d3b, 0xafab0064,
-0x1000ffc2, 0x0, 0x8f430064, 0x8f420060,
-0x1062002b, 0x274c0064, 0x8f510064, 0x8fab0064,
-0xafac0054, 0x26220001, 0x304200ff, 0xafa2005c,
-0x24020004, 0x1562001f, 0x111140, 0x111180,
-0x24420cc0, 0x2e21021, 0xafa2004c, 0x24550020,
-0x3c021000, 0x2c21024, 0x1040000e, 0x0,
-0x8fac004c, 0x8fab006c, 0x9582002a, 0x4b102b,
-0x54400006, 0x240c0001, 0x8fa20040, 0x50400028,
-0xaebe0018, 0x104b0025, 0x240c0001, 0x10000023,
-0xa3ac008f, 0x8fab004c, 0x8fac006c, 0x9562002a,
-0x4c102b, 0x1040001d, 0x240b0001, 0x1000001b,
-0xa3ab008f, 0x24424cc0, 0x10000018, 0x2e2a821,
-0x8f420044, 0x8fac006c, 0x3c040001, 0x24847f8c,
-0xafac0014, 0xafa20010, 0x8f460064, 0x8f470060,
-0x3c050007, 0xc002d3b, 0x34a54800, 0x3c020008,
-0x2c21024, 0x1440ff4e, 0x0, 0x8f420370,
-0x240b0001, 0xafab0064, 0x24420001, 0xaf420370,
-0x8f420370, 0x1000ff7d, 0x0, 0xaebe0018,
-0x93a2008f, 0x104000bf, 0x0, 0x8fac004c,
-0x8fa40040, 0x25820020, 0xafa20028, 0x25820008,
-0xafa20030, 0x25820010, 0xafac002c, 0x1080000e,
-0xafa20034, 0x9583002a, 0x83102b, 0x54400001,
-0x801821, 0x1000000b, 0xa7a30038, 0x27a30036,
-0x131040, 0x621821, 0x94620000, 0x441021,
-0x10000016, 0xa4620000, 0x8fab004c, 0x9562002a,
-0xa7a20038, 0x8fac004c, 0x8fa4006c, 0x8fa30094,
-0x95820018, 0xa7a2003a, 0x9582001a, 0xa7a2003c,
-0x9582001c, 0x9821, 0xa7a2003e, 0x94620018,
-0x24630002, 0x822023, 0x1880ffe8, 0x26730001,
-0x2e620004, 0x1440fff9, 0x0, 0x18800014,
-0x240207c2, 0x3c040001, 0x24847f4c, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77f98,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0x8f4200fc, 0x262102a, 0x14400044, 0x24030001,
-0x8f83012c, 0x1060003c, 0x0, 0x8f820124,
-0x431023, 0x22143, 0x58800001, 0x24840040,
-0x8f820128, 0x431023, 0x21943, 0x58600001,
-0x24630040, 0x64102a, 0x54400001, 0x602021,
-0xaf4400fc, 0x8f4200fc, 0x262102a, 0x1040002a,
-0x24030001, 0x1000002e, 0x306200ff, 0x8fab0094,
-0x101040, 0x4b1021, 0x94470018, 0x101080,
-0x4b1021, 0xafbe0010, 0x8c420008, 0x3c040001,
-0x24847fac, 0x3c050007, 0x8c430004, 0x8c420000,
-0x34a55500, 0x2003021, 0xc002d3b, 0xafa30014,
-0x3c040001, 0x24847f4c, 0x240207f4, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77f98,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0x10000039, 0x0, 0x8f420334, 0x1821,
-0x24420001, 0xaf420334, 0x8f420334, 0x306200ff,
-0x1040febf, 0x8021, 0x8f430008, 0x2402fbff,
-0x1260002d, 0x625024, 0x3c0c4000, 0x22c4025,
-0x8fb10094, 0x2669ffff, 0x2209021, 0x8e420008,
-0x96270018, 0x8c440000, 0x8c450004, 0x56090004,
-0x240c0001, 0x240b0002, 0x10000002, 0xafab0010,
-0xafac0010, 0x16000004, 0xafa80014, 0x8f420008,
-0x10000002, 0xafa20018, 0xafaa0018, 0x8f42010c,
-0x3c03021, 0xafa800a0, 0xafa900a4, 0x40f809,
-0xafaa00a8, 0x8fa800a0, 0x8fa900a4, 0x8faa00a8,
-0x1040ffae, 0x3c02001f, 0x96230018, 0x3442ffff,
-0x3c3f021, 0x5e102b, 0x10400003, 0x26310002,
-0x8f420148, 0x3c2f023, 0x26100001, 0x213102b,
-0x1440ffda, 0x26520004, 0x8fb0006c, 0x1000001a,
-0x0, 0x96a3000a, 0x8fb0006c, 0x70102b,
-0x54400001, 0x608021, 0x8ea40000, 0x8ea50004,
-0x8fac0064, 0x240b0002, 0xafab0010, 0x934305c4,
-0xc1700, 0x10600003, 0x2223025, 0x3c020800,
-0xc23025, 0xafa60014, 0x8f420008, 0xafa20018,
-0x8f42010c, 0x3c03021, 0x40f809, 0x2003821,
-0x1040fe84, 0x3c050007, 0x97ab007e, 0x96a3000e,
-0x11600007, 0x0, 0x934205c4, 0x14400004,
-0x0, 0x97ac0086, 0x6b1825, 0xa6ac0016,
-0x8fab0074, 0x3c02ffff, 0x1621024, 0x10400003,
-0xb1402, 0x34630400, 0xa6a20014, 0xa6b0000a,
-0x8fac006c, 0x560c0006, 0x3d0f021, 0x34620004,
-0xafa0006c, 0xa6a2000e, 0x1000000d, 0xa34005c4,
-0x8fab006c, 0x3c02001f, 0x3442ffff, 0x5e102b,
-0x1705823, 0xafab006c, 0xa6a3000e, 0x240c0001,
-0x10400003, 0xa34c05c4, 0x8f420148, 0x3c2f023,
-0x3c021000, 0x2c21024, 0x10400006, 0x0,
-0x8fa20040, 0x401821, 0x1021, 0xaea20000,
-0xaea30004, 0x8fac005c, 0x8fab0054, 0xad6c0000,
-0x8fab006c, 0x1560fe69, 0x0, 0x8fac006c,
-0x1180001c, 0x0, 0x934205c4, 0x10400006,
-0x0, 0xaf5e00c4, 0xaf4c00c0, 0x8fab0074,
-0x1000000e, 0xaf4b00c8, 0x97ac007e, 0x1180000b,
-0x34038100, 0x8fa20020, 0x8c46000c, 0xa443000c,
-0x97ab0086, 0x8c440004, 0x8c450008, 0xa44b000e,
-0xac440000, 0xac450004, 0xac460008, 0x8f42034c,
-0x24420001, 0xaf42034c, 0x8f42034c, 0x10000011,
-0x0, 0x8fac0074, 0x3184ffff, 0x2484fffc,
-0x801821, 0x8f440250, 0x8f450254, 0x8f460118,
-0x1021, 0xa32821, 0xa3382b, 0x822021,
-0x872021, 0xaf440250, 0xaf450254, 0xc0f809,
-0x0, 0x8fbf00c8, 0x8fbe00c4, 0x8fb500c0,
-0x8fb300bc, 0x8fb200b8, 0x8fb100b4, 0x8fb000b0,
-0x3e00008, 0x27bd00d0, 0x3e00008, 0x0,
-0x27bdffd0, 0xafbf0028, 0xafb10024, 0xafb00020,
-0x8f43004c, 0x8f420048, 0x1062004a, 0x0,
-0x8f430048, 0x8f42004c, 0x628823, 0x6220001,
-0x26310200, 0x8f430054, 0x8f42004c, 0x43102b,
-0x14400004, 0x24020200, 0x8f43004c, 0x10000005,
-0x438023, 0x8f420054, 0x8f43004c, 0x431023,
-0x2450ffff, 0x16000016, 0x2005821, 0x3c040001,
-0x24847f4c, 0x24020888, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77f98, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x2005821,
-0x22b102a, 0x54400001, 0x2205821, 0x8f4a004c,
-0x8f49004c, 0x8f440188, 0x8f45018c, 0x8f46004c,
-0xb3940, 0x24081000, 0xafa80010, 0x94940,
-0x1201821, 0x1021, 0x14b5021, 0x315001ff,
-0xafb00014, 0x8f480014, 0xa32821, 0xa3482b,
-0x822021, 0x892021, 0x63140, 0x3402ecc0,
-0xafa80018, 0x8f430108, 0xc23021, 0x60f809,
-0x2e63021, 0x54400001, 0xaf50004c, 0x8f43004c,
-0x8f420048, 0x14620019, 0x0, 0x8f420000,
-0x10400007, 0x0, 0xaf80004c, 0x8f82004c,
-0x1040fffd, 0x0, 0x10000005, 0x0,
-0xaf800048, 0x8f820048, 0x1040fffd, 0x0,
-0x8f820060, 0x2403fdff, 0x431024, 0xaf820060,
-0x8f420000, 0x10400004, 0x0, 0xaf80004c,
-0x10000002, 0x0, 0xaf800048, 0x8fbf0028,
-0x8fb10024, 0x8fb00020, 0x3e00008, 0x27bd0030,
-0x3e00008, 0x0, 0x27bdffd0, 0xafbf0028,
-0xafb10024, 0xafb00020, 0x8f43005c, 0x8f420058,
-0x1062005f, 0x0, 0x8f430058, 0x8f42005c,
-0x628823, 0x6220001, 0x26310100, 0x8f430064,
-0x8f42005c, 0x43102b, 0x14400004, 0x24020100,
-0x8f43005c, 0x10000005, 0x438023, 0x8f420064,
-0x8f43005c, 0x431023, 0x2450ffff, 0x16000016,
-0x2003821, 0x3c040001, 0x24847f4c, 0x240208e2,
-0xafa20010, 0xafa00014, 0x8f860144, 0x3c070001,
-0x24e77f98, 0xc002d3b, 0x3405dead, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f820220, 0x34420004,
-0xaf820220, 0x8f820140, 0x3c030001, 0x431025,
-0xaf820140, 0x2003821, 0x227102a, 0x54400001,
-0x2203821, 0x8f42005c, 0x471021, 0x305000ff,
-0x32c21000, 0x10400015, 0x24082000, 0x8f49005c,
-0x8f440190, 0x8f450194, 0x8f46005c, 0x73980,
-0xafa80010, 0xafb00014, 0x8f480014, 0x94980,
-0x1201821, 0x1021, 0xa32821, 0xa3482b,
-0x822021, 0x892021, 0x63180, 0xafa80018,
-0x8f420108, 0x10000014, 0x24c60cc0, 0x8f49005c,
-0x8f440190, 0x8f450194, 0x8f46005c, 0x73940,
-0xafa80010, 0xafb00014, 0x8f480014, 0x94940,
-0x1201821, 0x1021, 0xa32821, 0xa3482b,
-0x822021, 0x892021, 0x63140, 0xafa80018,
-0x8f420108, 0x24c64cc0, 0x40f809, 0x2e63021,
-0x54400001, 0xaf50005c, 0x8f43005c, 0x8f420058,
-0x14620019, 0x0, 0x8f420000, 0x10400007,
-0x0, 0xaf80004c, 0x8f82004c, 0x1040fffd,
-0x0, 0x10000005, 0x0, 0xaf800048,
-0x8f820048, 0x1040fffd, 0x0, 0x8f820060,
-0x2403feff, 0x431024, 0xaf820060, 0x8f420000,
-0x10400004, 0x0, 0xaf80004c, 0x10000002,
-0x0, 0xaf800048, 0x8fbf0028, 0x8fb10024,
-0x8fb00020, 0x3e00008, 0x27bd0030, 0x3e00008,
-0x0, 0x27bdffd0, 0xafbf0028, 0xafb10024,
-0xafb00020, 0x8f43006c, 0x8f420068, 0x10620049,
-0x0, 0x8f430068, 0x8f42006c, 0x628823,
-0x6220001, 0x26310400, 0x8f430074, 0x8f42006c,
-0x43102b, 0x14400004, 0x24020400, 0x8f43006c,
-0x10000005, 0x438023, 0x8f420074, 0x8f43006c,
-0x431023, 0x2450ffff, 0x16000016, 0x2005821,
-0x3c040001, 0x24847f4c, 0x2402094b, 0xafa20010,
-0xafa00014, 0x8f860144, 0x3c070001, 0x24e77f98,
-0xc002d3b, 0x3405dead, 0x8f82011c, 0x34420002,
-0xaf82011c, 0x8f820220, 0x34420004, 0xaf820220,
-0x8f820140, 0x3c030001, 0x431025, 0xaf820140,
-0x2005821, 0x22b102a, 0x54400001, 0x2205821,
-0x8f4a006c, 0x8f49006c, 0x8f440198, 0x8f45019c,
-0x8f46006c, 0xb3940, 0x24084000, 0xafa80010,
-0x94940, 0x1201821, 0x1021, 0x14b5021,
-0x315003ff, 0xafb00014, 0x8f480014, 0xa32821,
-0xa3482b, 0x822021, 0x892021, 0x63140,
-0xafa80018, 0x8f420108, 0x24c66cc0, 0x40f809,
-0x2e63021, 0x54400001, 0xaf50006c, 0x8f43006c,
-0x8f420068, 0x14620019, 0x0, 0x8f420000,
-0x10400007, 0x0, 0xaf80004c, 0x8f82004c,
-0x1040fffd, 0x0, 0x10000005, 0x0,
-0xaf800048, 0x8f820048, 0x1040fffd, 0x0,
-0x8f820060, 0x2403f7ff, 0x431024, 0xaf820060,
-0x8f420000, 0x10400004, 0x0, 0xaf80004c,
-0x10000002, 0x0, 0xaf800048, 0x8fbf0028,
-0x8fb10024, 0x8fb00020, 0x3e00008, 0x27bd0030,
-0x3e00008, 0x0, 0x27bdffe0, 0xafbf001c,
-0xafb00018, 0x8f4200fc, 0x8f4400f8, 0x8f4300f4,
-0x24420001, 0xaf4200fc, 0x8f900128, 0x14830016,
-0x3c020001, 0x3c040001, 0x24847f4c, 0x240209b3,
-0xafa20010, 0xafa00014, 0x8f860144, 0x3c070001,
-0x24e77f98, 0xc002d3b, 0x3405dead, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f820220, 0x34420004,
-0xaf820220, 0x8f820140, 0x3c030001, 0x431025,
-0xaf820140, 0x3c020001, 0x8f4300f8, 0x344230c8,
-0x2e21021, 0x54620004, 0x24620008, 0x3c020001,
-0x34422ec8, 0x2e21021, 0x401821, 0xaf4300f8,
-0xac600000, 0x8f4200f4, 0x14620005, 0x3c020001,
-0x26020020, 0xaf820128, 0x1000000f, 0x0,
-0x8f4300f8, 0x344230c8, 0x2e21021, 0x54620004,
-0x24620008, 0x3c020001, 0x34422ec8, 0x2e21021,
-0x401821, 0x8c620004, 0x21140, 0x2021021,
-0xaf820128, 0xac600000, 0x8e030018, 0x30620070,
-0x10400030, 0x30620020, 0x10400004, 0x3c020010,
-0x2c21024, 0x1040000d, 0x0, 0x30620040,
-0x10400004, 0x3c020020, 0x2c21024, 0x10400007,
-0x0, 0x30620010, 0x10400038, 0x3c020040,
-0x2c21024, 0x14400035, 0x0, 0x8f820040,
-0x30420001, 0x14400008, 0x2021, 0x8c030104,
-0x24020001, 0x50620005, 0x24040001, 0x8c020264,
-0x10400003, 0x801021, 0x24040001, 0x801021,
-0x10400007, 0x0, 0x8f42030c, 0x24420001,
-0xaf42030c, 0x8f42030c, 0x10000020, 0x0,
-0x8f820044, 0x34420004, 0xaf820044, 0x8f420308,
-0x24420001, 0xaf420308, 0x8f420308, 0x10000017,
-0x0, 0x3062b08f, 0x14400014, 0x240209e4,
-0x3c040001, 0x24847f4c, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070001, 0x24e77f98, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x8fbf001c,
-0x8fb00018, 0x3e00008, 0x27bd0020, 0x3e00008,
-0x0, 0x27bdff98, 0xafbf0060, 0xafbe005c,
-0xafb50058, 0xafb30054, 0xafb20050, 0xafb1004c,
-0xafb00048, 0x8f4200fc, 0x24420001, 0xaf4200fc,
-0x8f880128, 0x25020020, 0xaf820128, 0x8d030018,
-0x30620070, 0x10400030, 0x30620020, 0x10400004,
-0x3c020010, 0x2c21024, 0x1040000d, 0x0,
-0x30620040, 0x10400004, 0x3c020020, 0x2c21024,
-0x10400007, 0x0, 0x30620010, 0x104001c0,
-0x3c020040, 0x2c21024, 0x144001bd, 0x0,
-0x8f820040, 0x30420001, 0x14400008, 0x2021,
-0x8c030104, 0x24020001, 0x50620005, 0x24040001,
-0x8c020264, 0x10400003, 0x801021, 0x24040001,
-0x801021, 0x10400007, 0x0, 0x8f42030c,
-0x24420001, 0xaf42030c, 0x8f42030c, 0x100001a8,
-0x0, 0x8f820044, 0x34420004, 0xaf820044,
-0x8f420308, 0x24420001, 0xaf420308, 0x8f420308,
-0x1000019f, 0x0, 0x30620002, 0x10400160,
-0x3c020800, 0x8d1e001c, 0x1e5702, 0xafaa0034,
-0x950a0016, 0x3c22024, 0xafaa0024, 0x8faa0034,
-0x24020001, 0x15420006, 0x33deffff, 0x1e1140,
-0x3403ecc0, 0x431021, 0x10000010, 0x2e2a821,
-0x24020002, 0x15420005, 0x24020003, 0x1e1140,
-0x24426cc0, 0x10000009, 0x2e2a821, 0x15420005,
-0x1e1180, 0x1e1140, 0x24424cc0, 0x10000003,
-0x2e2a821, 0x571021, 0x24550ce0, 0x96a2000e,
-0x304afffc, 0x30420400, 0x10400003, 0xafaa002c,
-0x100000e1, 0x8821, 0x10800004, 0x8821,
-0x97b10026, 0x100000dd, 0xa6b10012, 0x8eb30018,
-0x966a000c, 0xa7aa003e, 0x97a5003e, 0x2ca305dd,
-0x38a28870, 0x2c420001, 0x621825, 0x10600015,
-0x2021, 0x32c20800, 0x10400015, 0x24020800,
-0x96630014, 0x14620012, 0x3402aaaa, 0x9663000e,
-0x14620007, 0x2821, 0x96630010, 0x24020300,
-0x14620004, 0xa01021, 0x96620012, 0x2c450001,
-0xa01021, 0x54400006, 0x24040016, 0x10000004,
-0x0, 0x24020800, 0x50a20001, 0x2404000e,
-0x108000b9, 0x2649021, 0x92420000, 0x3042000f,
-0x28080, 0x32c20100, 0x10400020, 0x2501821,
-0x3c020020, 0x43102b, 0x1440000e, 0x2402021,
-0x2821, 0x94820000, 0x24840002, 0xa22821,
-0x83102b, 0x1440fffb, 0x30a2ffff, 0x51c02,
-0x622821, 0x51c02, 0x30a2ffff, 0x10000009,
-0x622821, 0x8f470148, 0x8f420110, 0x102842,
-0x3c060020, 0x40f809, 0xafa80040, 0x3045ffff,
-0x8fa80040, 0x50a00001, 0x3405ffff, 0x8faa002c,
-0x354a0002, 0x10000002, 0xafaa002c, 0x2821,
-0x32c20080, 0x10400090, 0xa6a50010, 0x26430009,
-0x3c02001f, 0x3442ffff, 0x43102b, 0x10400003,
-0x0, 0x8f420148, 0x621823, 0x90660000,
-0x30c200ff, 0x38430006, 0x2c630001, 0x38420011,
-0x2c420001, 0x621825, 0x1060007f, 0x24020800,
-0x8821, 0x97a3003e, 0x1462000f, 0x2602021,
-0x96710000, 0x96620002, 0x96630004, 0x96640006,
-0x2228821, 0x2238821, 0x2248821, 0x96620008,
-0x9663000a, 0x9664000c, 0x2228821, 0x2238821,
-0x10000007, 0x2248821, 0x94820000, 0x24840002,
-0x2228821, 0x92102b, 0x1440fffb, 0x0,
-0x111c02, 0x3222ffff, 0x628821, 0x111c02,
-0x3222ffff, 0x628821, 0x32c20200, 0x10400003,
-0x26440006, 0x1000003e, 0x8021, 0x3c05001f,
-0x34a5ffff, 0xa4102b, 0x10400003, 0x0,
-0x8f420148, 0x822023, 0x94820000, 0x30421fff,
-0x10400004, 0x2644000c, 0x96420002, 0x10000030,
-0x508023, 0x96420002, 0x26430014, 0x508023,
-0x3c020020, 0x43102b, 0x1440000a, 0xd08021,
-0x9642000c, 0x2028021, 0x9642000e, 0x96430010,
-0x96440012, 0x2028021, 0x2038021, 0x10000020,
-0x2048021, 0xa4102b, 0x10400003, 0x0,
-0x8f420148, 0x822023, 0x94820000, 0x24840002,
-0x2028021, 0xa4102b, 0x10400003, 0x0,
-0x8f420148, 0x822023, 0x94820000, 0x24840002,
-0x2028021, 0xa4102b, 0x10400003, 0x0,
-0x8f420148, 0x822023, 0x94820000, 0x24840002,
-0x2028021, 0xa4102b, 0x10400003, 0x0,
-0x8f420148, 0x822023, 0x94820000, 0x2028021,
-0x3c020100, 0x2c21024, 0x1040000e, 0x0,
-0x8faa002c, 0x31420004, 0x1040000a, 0x0,
-0x9504000e, 0x2642021, 0xc004445, 0x2484fffc,
-0x3042ffff, 0x2228821, 0x111c02, 0x3222ffff,
-0x628821, 0x8faa0024, 0x1518823, 0x111402,
-0x2228821, 0x2308821, 0x111402, 0x2228821,
-0x3231ffff, 0x52200001, 0x3411ffff, 0x8faa002c,
-0x354a0001, 0xafaa002c, 0xa6b10012, 0x97aa002e,
-0xa6aa000e, 0x8faa002c, 0x31420004, 0x10400002,
-0x24091000, 0x34098000, 0x8f480044, 0x8f4401a0,
-0x8f4501a4, 0xafa90010, 0x8f490044, 0x84140,
-0x1001821, 0xafa90014, 0x8f48000c, 0x2a03021,
-0x24070020, 0xafa80018, 0x8f48010c, 0x1021,
-0xa32821, 0xa3482b, 0x822021, 0x100f809,
-0x892021, 0x1440001f, 0x0, 0x8f820128,
-0x3c040001, 0x24847fe4, 0xafbe0014, 0xafa20010,
-0x8f860124, 0x8f870120, 0x3c050007, 0xc002d3b,
-0x34a59920, 0x3c040001, 0x24847f4c, 0x24020bfa,
-0xafa20010, 0xafa00014, 0x8f860144, 0x3c070001,
-0x24e77f98, 0xc002d3b, 0x3405dead, 0x8f82011c,
-0x34420002, 0xaf82011c, 0x8f820220, 0x34420004,
-0xaf820220, 0x8f820140, 0x3c030001, 0x431025,
-0xaf820140, 0x8f420368, 0x2442ffff, 0xaf420368,
-0x8f420044, 0x8f430088, 0x24420001, 0x431024,
-0xaf420044, 0x8faa0034, 0x8f440368, 0x24020001,
-0x15420006, 0x24020002, 0x8f42035c, 0x2442ffff,
-0xaf42035c, 0x1000004a, 0x8f42035c, 0x15420006,
-0x0, 0x8f420364, 0x2442ffff, 0xaf420364,
-0x10000043, 0x8f420364, 0x8f420360, 0x2442ffff,
-0xaf420360, 0x8f420360, 0x1000003d, 0x0,
-0x30621000, 0x10400005, 0x30628000, 0x8f420078,
-0x24420001, 0x10000036, 0xaf420078, 0x10400034,
-0x0, 0x8f420078, 0x24420001, 0xaf420078,
-0x8c030240, 0x43102b, 0x1440002d, 0x24070008,
-0x8f440168, 0x8f45016c, 0x8f430044, 0x8f48000c,
-0x8f860120, 0x24020040, 0xafa20010, 0xafa30014,
-0xafa80018, 0x8f42010c, 0x40f809, 0x24c6001c,
-0x14400011, 0x24020001, 0x3c010001, 0x370821,
-0xa02240f2, 0x8f820124, 0xafa20010, 0x8f820128,
-0x3c040001, 0x24847f44, 0xafa20014, 0x8f460044,
-0x8f870120, 0x3c050009, 0xc002d3b, 0x34a51300,
-0x1000000b, 0x0, 0x8f420304, 0x24420001,
-0xaf420304, 0x8f420304, 0x8f420044, 0xaf42007c,
-0x3c010001, 0x370821, 0xa02040f2, 0xaf400078,
-0x8f420318, 0x24420001, 0xaf420318, 0x8f420318,
-0x8fbf0060, 0x8fbe005c, 0x8fb50058, 0x8fb30054,
-0x8fb20050, 0x8fb1004c, 0x8fb00048, 0x3e00008,
-0x27bd0068, 0x3e00008, 0x0, 0x8f42013c,
-0xaf8200c0, 0x8f42013c, 0xaf8200c4, 0x8f42013c,
-0xaf8200c8, 0x8f420138, 0xaf8200d0, 0x8f420138,
-0xaf8200d4, 0x8f420138, 0x3e00008, 0xaf8200d8,
-0x27bdffe0, 0x27840208, 0x24050200, 0xafbf0018,
-0xc002dbf, 0x24060008, 0x8c020204, 0xaf820210,
-0xc004586, 0x0, 0x3c020002, 0x8c428668,
-0x30420002, 0x1040000e, 0x2021, 0x8c060248,
-0x24020002, 0x3c010002, 0xac22866c, 0xc005738,
-0x24050002, 0x2021, 0x8c060248, 0x24020001,
-0x3c010002, 0xac22866c, 0x10000011, 0x24050001,
-0x8c060248, 0x24020004, 0x3c010002, 0xac22866c,
-0xc005738, 0x24050004, 0x3c020002, 0x8c428668,
-0x30420001, 0x10400008, 0x24020001, 0x3c010002,
-0xac22866c, 0x2021, 0x24050001, 0x3c06601b,
-0xc005738, 0x0, 0x3c040002, 0x248480b0,
-0x8f420150, 0x8f430154, 0x3c050008, 0x8f460158,
-0x21640, 0x31940, 0x34630403, 0x431025,
-0x633c0, 0x461025, 0xaf82021c, 0xafa00010,
-0xafa00014, 0x8f86021c, 0x34a50200, 0xc002d3b,
-0x3821, 0x3c010002, 0xac208664, 0x3c010002,
-0xac20867c, 0x8fbf0018, 0x3e00008, 0x27bd0020,
-0x27bdffe0, 0x3c050008, 0x34a50300, 0xafbf0018,
-0xafa00010, 0xafa00014, 0x8f860200, 0x3c040002,
-0x248480bc, 0xc002d3b, 0x3821, 0x8f420410,
-0x24420001, 0xaf420410, 0x8f420410, 0x8fbf0018,
-0x3e00008, 0x27bd0020, 0x27bdffd8, 0xafbf0020,
-0xafb1001c, 0xafb00018, 0x8f4203a4, 0x24420001,
-0xaf4203a4, 0x8f4203a4, 0x8f900220, 0x8f8200e0,
-0xafa20010, 0x8f8200e4, 0xafa20014, 0x8f8600c4,
-0x8f8700c8, 0x3c040002, 0x248480c8, 0xc002d3b,
-0x2002821, 0x3c044000, 0x2041024, 0x504000bc,
-0x3c040100, 0x8f4203bc, 0x24420001, 0xaf4203bc,
-0x8f4203bc, 0x8f8700c4, 0x8f8300c8, 0x8f420148,
-0x671823, 0x43102b, 0x10400003, 0x0,
-0x8f420148, 0x621821, 0x10600005, 0x0,
-0x8f42014c, 0x43102b, 0x1040000d, 0x0,
-0x8f8200e0, 0x8f430124, 0xaf42011c, 0xaf430114,
-0x8f820220, 0x3c0308ff, 0x3463fffb, 0x431024,
-0x441025, 0xaf820220, 0x10000104, 0x0,
-0x8f820220, 0x3c0308ff, 0x3463ffff, 0x431024,
-0x34420004, 0xaf820220, 0x8f8200e0, 0x8f430124,
-0xaf42011c, 0xaf430114, 0x8f8600c8, 0x8f840120,
-0x8f830124, 0x10000005, 0x2821, 0x14620002,
-0x24620020, 0x27624800, 0x401821, 0x1064000c,
-0x30a200ff, 0x8c620018, 0x30420003, 0x1040fff7,
-0x27624fe0, 0x8f4203d0, 0x24050001, 0x24420001,
-0xaf4203d0, 0x8f4203d0, 0x8c660008, 0x30a200ff,
-0x1440005b, 0x0, 0x934205c4, 0x14400058,
-0x0, 0x8f8700c4, 0x8f8800e0, 0x8f8400e4,
-0x2402fff8, 0x1024024, 0x1041023, 0x218c3,
-0x4620001, 0x24630200, 0x10600005, 0x24020001,
-0x1062000a, 0x0, 0x10000021, 0x0,
-0x8f4203c0, 0xe03021, 0x24420001, 0xaf4203c0,
-0x8f4203c0, 0x10000042, 0x0, 0x8f4203c4,
-0x24420001, 0xaf4203c4, 0x8c860000, 0x8f420148,
-0x8f4303c4, 0xe61823, 0x43102b, 0x10400004,
-0x2c62233f, 0x8f420148, 0x621821, 0x2c62233f,
-0x14400033, 0x0, 0x8f42020c, 0x24420001,
-0xaf42020c, 0x8f42020c, 0xe03021, 0x24820008,
-0xaf8200e4, 0xaf8200e8, 0x10000029, 0x0,
-0x8f4203c8, 0x24420001, 0xaf4203c8, 0x8f4203c8,
-0x8c850000, 0x8f420148, 0xa71823, 0x43102b,
-0x10400003, 0x0, 0x8f420148, 0x621821,
-0x8f42014c, 0x43102b, 0x5440000b, 0xa03021,
-0x8f42020c, 0x24420001, 0xaf42020c, 0x8f42020c,
-0x24820008, 0xaf8200e4, 0x8f8400e4, 0xaf8400e8,
-0x1488ffeb, 0x0, 0x1488000d, 0x27623000,
-0x14820002, 0x2482fff8, 0x27623ff8, 0x94430006,
-0x3c02001f, 0x3442ffff, 0xc33021, 0x46102b,
-0x10400003, 0x0, 0x8f420148, 0xc23023,
-0xaf8600c8, 0x8f8300c4, 0x8f420148, 0xc31823,
-0x43102b, 0x10400003, 0x0, 0x8f420148,
-0x621821, 0x10600005, 0x0, 0x8f42014c,
-0x43102b, 0x1040000a, 0x3c02fdff, 0x8f820220,
-0x3c0308ff, 0x3463fffb, 0x431024, 0x3c034000,
-0x431025, 0xaf820220, 0x10000070, 0x0,
-0x8f4303cc, 0x3442ffff, 0x282a024, 0x24630001,
-0xaf4303cc, 0x8f4203cc, 0x10000068, 0x0,
-0x2041024, 0x1040000f, 0x3c110200, 0x8f4203a8,
-0x24420001, 0xaf4203a8, 0x8f4203a8, 0x8f820220,
-0x3c0308ff, 0x3463ffff, 0x431024, 0x441025,
-0xaf820220, 0xc00430b, 0x0, 0x10000057,
-0x0, 0x2111024, 0x50400009, 0x3c110400,
-0x8f4203ac, 0x24420001, 0xaf4203ac, 0x8f4203ac,
-0xc00430b, 0x0, 0x1000002e, 0x0,
-0x2111024, 0x10400033, 0x3c02b800, 0x8f830224,
-0x24021402, 0x1462001d, 0x3c050008, 0x3c040002,
-0x248480d4, 0xafa00010, 0xafa00014, 0x8f860224,
-0x34a50500, 0xc002d3b, 0x3821, 0x3c040002,
-0x248480a0, 0x240203b3, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070002, 0x24e780e0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x8f4203b0,
-0x24420001, 0xaf4203b0, 0x8f4203b0, 0x8f820220,
-0x2002021, 0x34420002, 0xaf820220, 0xc0054be,
-0x0, 0x8f820220, 0x3c0308ff, 0x3463ffff,
-0x431024, 0x511025, 0xaf820220, 0x10000017,
-0x0, 0x2021024, 0x10400014, 0x240203c7,
-0x3c040002, 0x248480a0, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070002, 0x24e780e0, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x8fbf0020,
-0x8fb1001c, 0x8fb00018, 0x3e00008, 0x27bd0028,
-0x3e00008, 0x0, 0x3c020002, 0x8c42867c,
-0x27bdffb0, 0xafbf0048, 0xafbe0044, 0xafb50040,
-0xafb3003c, 0xafb20038, 0xafb10034, 0x1040000f,
-0xafb00030, 0x3c040002, 0x248480e8, 0x3c050008,
-0xafa00010, 0xafa00014, 0x8f860220, 0x34a50600,
-0x24020001, 0x3c010002, 0xac20867c, 0x3c010002,
-0xac228670, 0xc002d3b, 0x3821, 0x3c037fff,
-0x8c020268, 0x3463ffff, 0x3c04fdff, 0x431024,
-0xac020268, 0x8f420004, 0x3484ffff, 0x30420002,
-0x10400092, 0x284a024, 0x3c040600, 0x34842000,
-0x8f420004, 0x2821, 0x2403fffd, 0x431024,
-0xaf420004, 0xafa40020, 0x8f5e0018, 0x27aa0020,
-0x240200ff, 0x13c20002, 0xafaa002c, 0x27c50001,
-0x8c020228, 0xa09021, 0x1642000e, 0x1e38c0,
-0x8f42033c, 0x24420001, 0xaf42033c, 0x8f42033c,
-0x8c020228, 0x3c040002, 0x24848068, 0x3c050009,
-0xafa00014, 0xafa20010, 0x8fa60020, 0x1000006d,
-0x34a50500, 0xf71021, 0x8fa30020, 0x8fa40024,
-0xac4304c0, 0xac4404c4, 0x8f830054, 0x8f820054,
-0x247003e8, 0x2021023, 0x2c4203e9, 0x1040001b,
-0x9821, 0xe08821, 0x263504c0, 0x8f440178,
-0x8f45017c, 0x2201821, 0x240a0004, 0xafaa0010,
-0xafb20014, 0x8f48000c, 0x1021, 0x2f53021,
-0xafa80018, 0x8f48010c, 0x24070008, 0xa32821,
-0xa3482b, 0x822021, 0x100f809, 0x892021,
-0x54400006, 0x24130001, 0x8f820054, 0x2021023,
-0x2c4203e9, 0x1440ffe9, 0x0, 0x326200ff,
-0x54400017, 0xaf520018, 0x8f420378, 0x24420001,
-0xaf420378, 0x8f420378, 0x8f820120, 0x8faa002c,
-0xafa20010, 0x8f820124, 0x3c040002, 0x24848074,
-0x3c050009, 0xafa20014, 0x8d460000, 0x10000035,
-0x34a50600, 0x8f420308, 0x24130001, 0x24420001,
-0xaf420308, 0x8f420308, 0x1000001e, 0x326200ff,
-0x8f830054, 0x8f820054, 0x247003e8, 0x2021023,
-0x2c4203e9, 0x10400016, 0x9821, 0x3c150020,
-0x24110010, 0x8f42000c, 0x8f440160, 0x8f450164,
-0x8f860120, 0xafb10010, 0xafb20014, 0x551025,
-0xafa20018, 0x8f42010c, 0x24070008, 0x40f809,
-0x24c6001c, 0x1440ffe3, 0x0, 0x8f820054,
-0x2021023, 0x2c4203e9, 0x1440ffee, 0x0,
-0x326200ff, 0x14400011, 0x0, 0x8f420378,
-0x24420001, 0xaf420378, 0x8f420378, 0x8f820120,
-0x8faa002c, 0xafa20010, 0x8f820124, 0x3c040002,
-0x2484807c, 0x3c050009, 0xafa20014, 0x8d460000,
-0x34a50700, 0xc002d3b, 0x3c03821, 0x8f4202ec,
-0x24420001, 0xaf4202ec, 0x8f4202ec, 0x8fbf0048,
-0x8fbe0044, 0x8fb50040, 0x8fb3003c, 0x8fb20038,
-0x8fb10034, 0x8fb00030, 0x3e00008, 0x27bd0050,
-0x3c020002, 0x8c42867c, 0x27bdffe0, 0x1440000d,
-0xafbf0018, 0x3c040002, 0x248480f4, 0x3c050008,
-0xafa00010, 0xafa00014, 0x8f860220, 0x34a50700,
-0x24020001, 0x3c010002, 0xac22867c, 0xc002d3b,
-0x3821, 0x3c020004, 0x2c21024, 0x10400007,
-0x0, 0x8f820220, 0x3c0308ff, 0x3463ffff,
-0x431024, 0x34420008, 0xaf820220, 0x3c050002,
-0x8ca5866c, 0x24020001, 0x14a20007, 0x2021,
-0xc0058d7, 0x24050001, 0xac02026c, 0x8c03026c,
-0x10000006, 0x3c020007, 0xc0058d7, 0x2021,
-0xac020268, 0x8c030268, 0x3c020007, 0x621824,
-0x3c020002, 0x5062000d, 0x3c0205f5, 0x43102b,
-0x14400006, 0x3c020004, 0x3c020001, 0x10620009,
-0x3c020098, 0x1000000b, 0x0, 0x14620009,
-0x3c023b9a, 0x10000004, 0x3442ca00, 0x10000002,
-0x3442e100, 0x34429680, 0xaf4201fc, 0x8f4201fc,
-0xaee20064, 0x8fbf0018, 0x3e00008, 0x27bd0020,
-0x86102b, 0x50400001, 0x872023, 0xc41023,
-0x24843, 0x125102b, 0x1040001b, 0x91040,
-0x824021, 0x88102b, 0x10400007, 0x1821,
-0x94820000, 0x24840002, 0x621821, 0x88102b,
-0x1440fffb, 0x0, 0x602021, 0xc73023,
-0xa91023, 0x21040, 0xc22821, 0xc5102b,
-0x10400007, 0x1821, 0x94c20000, 0x24c60002,
-0x621821, 0xc5102b, 0x1440fffb, 0x0,
-0x1000000d, 0x832021, 0x51040, 0x822821,
-0x85102b, 0x10400007, 0x1821, 0x94820000,
-0x24840002, 0x621821, 0x85102b, 0x1440fffb,
-0x0, 0x602021, 0x41c02, 0x3082ffff,
-0x622021, 0x41c02, 0x3082ffff, 0x622021,
-0x3e00008, 0x3082ffff, 0x3e00008, 0x0,
-0x802821, 0x30a20001, 0x1040002b, 0x3c03001f,
-0x3463ffff, 0x24a20004, 0x62102b, 0x54400007,
-0x65102b, 0x90a20001, 0x90a40003, 0x90a30000,
-0x90a50002, 0x1000002a, 0x441021, 0x10400003,
-0x0, 0x8f420148, 0xa22823, 0x90a40000,
-0x24a50001, 0x65102b, 0x10400003, 0x0,
-0x8f420148, 0xa22823, 0x90a20000, 0x24a50001,
-0x21200, 0x822021, 0x65102b, 0x10400003,
-0x0, 0x8f420148, 0xa22823, 0x90a20000,
-0x24a50001, 0x822021, 0x65102b, 0x10400003,
-0x0, 0x8f420148, 0xa22823, 0x90a20000,
-0x1000002d, 0x21200, 0x3463ffff, 0x24a20004,
-0x62102b, 0x5440000a, 0x65102b, 0x90a20000,
-0x90a40002, 0x90a30001, 0x90a50003, 0x441021,
-0x21200, 0x651821, 0x10000020, 0x432021,
-0x10400003, 0x0, 0x8f420148, 0xa22823,
-0x90a20000, 0x24a50001, 0x22200, 0x65102b,
-0x10400003, 0x0, 0x8f420148, 0xa22823,
-0x90a20000, 0x24a50001, 0x822021, 0x65102b,
-0x10400003, 0x0, 0x8f420148, 0xa22823,
-0x90a20000, 0x24a50001, 0x21200, 0x822021,
-0x65102b, 0x10400003, 0x0, 0x8f420148,
-0xa22823, 0x90a20000, 0x822021, 0x41c02,
-0x3082ffff, 0x622021, 0x41c02, 0x3082ffff,
-0x622021, 0x3e00008, 0x3082ffff, 0x8f820220,
-0x34420002, 0xaf820220, 0x3c020002, 0x8c42a8b8,
-0x30424000, 0x10400054, 0x24040001, 0x8f820200,
-0x24067fff, 0x8f830200, 0x30450002, 0x2402fffd,
-0x621824, 0xaf830200, 0xaf840204, 0x8f830054,
-0x8f820054, 0x10000002, 0x24630001, 0x8f820054,
-0x621023, 0x2c420002, 0x1440fffc, 0x0,
-0x8f820224, 0x1444004d, 0x42040, 0xc4102b,
-0x1040fff1, 0x0, 0x8f820200, 0x451025,
-0xaf820200, 0x8f820220, 0x34428000, 0xaf820220,
-0x8f830054, 0x8f820054, 0x10000002, 0x24630001,
-0x8f820054, 0x621023, 0x2c420002, 0x1440fffc,
-0x0, 0x8f820220, 0x3c030004, 0x431024,
-0x1440000f, 0x0, 0x8f820220, 0x3c03ffff,
-0x34637fff, 0x431024, 0xaf820220, 0x8f830054,
-0x8f820054, 0x10000002, 0x24630001, 0x8f820054,
-0x621023, 0x2c420002, 0x1440fffc, 0x0,
-0x8f820220, 0x3c030004, 0x431024, 0x1440000d,
-0x0, 0x8f820220, 0x34428000, 0xaf820220,
-0x8f830054, 0x8f820054, 0x10000002, 0x24630001,
-0x8f820054, 0x621023, 0x2c420002, 0x1440fffc,
-0x0, 0x8f820220, 0x3c030004, 0x431024,
-0x1040001b, 0x1021, 0x8f830220, 0x24020001,
-0x10000015, 0x3c04f700, 0x8f820220, 0x3c04f700,
-0x441025, 0xaf820220, 0x8f820220, 0x2403fffd,
-0x431024, 0xaf820220, 0x8f820220, 0x3c030300,
-0x431024, 0x14400003, 0x0, 0x10000008,
-0x1021, 0x8f820220, 0x34420002, 0xaf820220,
-0x8f830220, 0x24020001, 0x641825, 0xaf830220,
-0x3e00008, 0x0, 0x27bdffe0, 0x2021,
-0x3c050100, 0x24020001, 0xafbf0018, 0xaf80021c,
-0xaf820200, 0xaf820220, 0x27625000, 0xaf8200c0,
-0x27625000, 0xaf8200c4, 0x27625000, 0xaf8200c8,
-0x27625000, 0xaf8200d0, 0x27625000, 0xaf8200d4,
-0x27625000, 0xaf8200d8, 0x27623000, 0xaf8200e0,
-0x27623000, 0xaf8200e4, 0x27623000, 0xaf8200e8,
-0x27622800, 0xaf8200f0, 0x27622800, 0xaf8200f4,
-0x27622800, 0xaf8200f8, 0x418c0, 0x24840001,
-0x3631021, 0xac453004, 0x3631021, 0xac403000,
-0x28820200, 0x1440fff9, 0x418c0, 0x2021,
-0x418c0, 0x24840001, 0x3631021, 0xac402804,
-0x3631021, 0xac402800, 0x28820100, 0x1440fff9,
-0x418c0, 0xaf80023c, 0x24030080, 0x24040100,
-0xac600000, 0x24630004, 0x64102b, 0x5440fffd,
-0xac600000, 0x8f830040, 0x3c02f000, 0x621824,
-0x3c025000, 0x1062000c, 0x43102b, 0x14400006,
-0x3c026000, 0x3c024000, 0x1062000c, 0x24020800,
-0x1000000e, 0x240202a9, 0x10620008, 0x24020800,
-0x1000000a, 0x240202a9, 0x24020700, 0x3c010002,
-0xac228680, 0x10000018, 0x0, 0x3c010002,
-0xac228680, 0x10000014, 0x0, 0x3c040002,
-0x248481c0, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070002, 0x24e781d8, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x3c030001,
-0x431025, 0xaf820140, 0x8fbf0018, 0x3e00008,
-0x27bd0020, 0x3c020002, 0x8c428690, 0x27bdffd0,
-0xafbf002c, 0xafb20028, 0xafb10024, 0xafb00020,
-0x3c010002, 0xac208668, 0x10400005, 0x0,
-0xc0053c3, 0x0, 0x3c010002, 0xac208690,
-0x8f830054, 0x8f820054, 0x10000002, 0x24630064,
-0x8f820054, 0x621023, 0x2c420065, 0x1440fffc,
-0x0, 0xc0053de, 0x0, 0x24040001,
-0x2821, 0x27a60018, 0x34028000, 0xc004bdc,
-0xa7a20018, 0x8f830054, 0x8f820054, 0x10000002,
-0x24630064, 0x8f820054, 0x621023, 0x2c420065,
-0x1440fffc, 0x24040001, 0x24050001, 0xc004b9a,
-0x27a60018, 0x8f830054, 0x8f820054, 0x10000002,
-0x24630064, 0x8f820054, 0x621023, 0x2c420065,
-0x1440fffc, 0x24040001, 0x24050001, 0xc004b9a,
-0x27a60018, 0x8f830054, 0x8f820054, 0x10000002,
-0x24630064, 0x8f820054, 0x621023, 0x2c420065,
-0x1440fffc, 0x24040001, 0x3c060002, 0x24c687e0,
-0xc004b9a, 0x24050002, 0x8f830054, 0x8f820054,
-0x10000002, 0x24630064, 0x8f820054, 0x621023,
-0x2c420065, 0x1440fffc, 0x24040001, 0x24050003,
-0x3c100002, 0x261087e2, 0xc004b9a, 0x2003021,
-0x97a60018, 0x3c070002, 0x94e787e0, 0x3c040002,
-0x248481f0, 0xafa00014, 0x96020000, 0x3c05000d,
-0x34a50100, 0xc002d3b, 0xafa20010, 0x97a20018,
-0x10400050, 0x24036040, 0x96020000, 0x3042fff0,
-0x1443000d, 0x24020020, 0x3c030002, 0x946387e0,
-0x1462000c, 0x24027830, 0x24020003, 0x3c010002,
-0xac228668, 0x24020005, 0x3c010002, 0xac2287f0,
-0x10000041, 0x0, 0x3c030002, 0x946387e0,
-0x24027830, 0x1462000d, 0x24030010, 0x3c020002,
-0x944287e2, 0x3042fff0, 0x14430008, 0x24020003,
-0x3c010002, 0xac228668, 0x24020006, 0x3c010002,
-0xac2287f0, 0x10000030, 0x0, 0x3c020002,
-0x8c428668, 0x3c030002, 0x946387e0, 0x34420001,
-0x3c010002, 0xac228668, 0x24020015, 0x1462000b,
-0x0, 0x3c020002, 0x944287e2, 0x3042fff0,
-0x3843f420, 0x2c630001, 0x3842f430, 0x2c420001,
-0x621825, 0x1460001c, 0x24020003, 0x3c030002,
-0x946387e0, 0x24027810, 0x14620017, 0x24020002,
-0x3c020002, 0x944287e2, 0x3042fff0, 0x14400012,
-0x24020002, 0x10000010, 0x24020004, 0x3c020002,
-0x8c428668, 0x34420008, 0x3c010002, 0xac228668,
-0x1000005f, 0x24020004, 0x3c020002, 0x8c428668,
-0x34420004, 0x3c010002, 0xac228668, 0x100000af,
-0x0, 0x24020001, 0x3c010002, 0xac2287fc,
-0x3c020002, 0x8c428668, 0x30420002, 0x144000b2,
-0x3c09fff0, 0x24020e00, 0xaf820238, 0x8f840054,
-0x8f820054, 0x24030008, 0x3c010002, 0xac23866c,
-0x10000002, 0x248401f4, 0x8f820054, 0x821023,
-0x2c4201f5, 0x1440fffc, 0x3c0200c8, 0x344201fb,
-0xaf820238, 0x8f830054, 0x8f820054, 0x10000002,
-0x246301f4, 0x8f820054, 0x621023, 0x2c4201f5,
-0x1440fffc, 0x8021, 0x24120001, 0x24110009,
-0xc004a53, 0x0, 0x3c010002, 0xac328688,
-0xc004b1d, 0x0, 0x3c020002, 0x8c428688,
-0x1451fffb, 0x3c0200c8, 0x344201f6, 0xaf820238,
-0x8f830054, 0x8f820054, 0x10000002, 0x2463000a,
-0x8f820054, 0x621023, 0x2c42000b, 0x1440fffc,
-0x0, 0x8f820220, 0x24040001, 0x34420002,
-0xaf820220, 0x8f830200, 0x24057fff, 0x2402fffd,
-0x621824, 0xaf830200, 0xaf840204, 0x8f830054,
-0x8f820054, 0x10000002, 0x24630001, 0x8f820054,
-0x621023, 0x2c420002, 0x1440fffc, 0x0,
-0x8f820224, 0x14440005, 0x34028000, 0x42040,
-0xa4102b, 0x1040fff0, 0x34028000, 0x1082ff9f,
-0x26100001, 0x2e020014, 0x1440ffcd, 0x24020004,
-0x3c010002, 0xac22866c, 0x8021, 0x24120009,
-0x3c11ffff, 0x36313f7f, 0xc004a53, 0x0,
-0x24020001, 0x3c010002, 0xac228688, 0xc004b1d,
-0x0, 0x3c020002, 0x8c428688, 0x1452fffb,
-0x0, 0x8f820044, 0x511024, 0x34425080,
-0xaf820044, 0x8f830054, 0x8f820054, 0x10000002,
-0x2463000a, 0x8f820054, 0x621023, 0x2c42000b,
-0x1440fffc, 0x0, 0x8f820044, 0x511024,
-0x3442f080, 0xaf820044, 0x8f830054, 0x8f820054,
-0x10000002, 0x2463000a, 0x8f820054, 0x621023,
-0x2c42000b, 0x1440fffc, 0x0, 0x8f820220,
-0x3c03f700, 0x431025, 0xaf820220, 0x8f830054,
-0x8f820054, 0x10000002, 0x24630064, 0x8f820054,
-0x621023, 0x2c420065, 0x1440fffc, 0x0,
-0x8f820220, 0x24040001, 0x34420002, 0xaf820220,
-0x8f830200, 0x24057fff, 0x2402fffd, 0x621824,
-0xaf830200, 0xaf840204, 0x8f830054, 0x8f820054,
-0x10000002, 0x24630001, 0x8f820054, 0x621023,
-0x2c420002, 0x1440fffc, 0x0, 0x8f820224,
-0x14440005, 0x34028000, 0x42040, 0xa4102b,
-0x1040fff0, 0x34028000, 0x1082ff4f, 0x26100001,
-0x2e020064, 0x1440ffb0, 0x0, 0x3c020002,
-0x8c428668, 0x30420004, 0x14400007, 0x3c09fff0,
-0x8f820044, 0x3c03ffff, 0x34633f7f, 0x431024,
-0xaf820044, 0x3c09fff0, 0x3529bdc0, 0x3c060002,
-0x8cc68668, 0x3c040002, 0x248481f0, 0x24020001,
-0x3c010002, 0xac228670, 0x8f820054, 0x3c070002,
-0x8ce787fc, 0x3c030002, 0x946387e0, 0x3c080002,
-0x950887e2, 0x3c05000d, 0x34a50100, 0x3c010002,
-0xac20866c, 0x491021, 0x3c010002, 0xac2287ec,
-0xafa30010, 0xc002d3b, 0xafa80014, 0x8fbf002c,
-0x8fb20028, 0x8fb10024, 0x8fb00020, 0x3e00008,
-0x27bd0030, 0x27bdffe8, 0x3c050002, 0x8ca5866c,
-0x24060004, 0x24020001, 0x14a20014, 0xafbf0010,
-0x3c020002, 0x8c42a8bc, 0x30428000, 0x10400005,
-0x3c04000f, 0x3c030002, 0x8c6387fc, 0x10000005,
-0x34844240, 0x3c040004, 0x3c030002, 0x8c6387fc,
-0x348493e0, 0x24020005, 0x14620016, 0x0,
-0x3c04003d, 0x10000013, 0x34840900, 0x3c020002,
-0x8c42a8b8, 0x30428000, 0x10400005, 0x3c04001e,
-0x3c030002, 0x8c6387fc, 0x10000005, 0x34848480,
-0x3c04000f, 0x3c030002, 0x8c6387fc, 0x34844240,
-0x24020005, 0x14620003, 0x0, 0x3c04007a,
-0x34841200, 0x3c020002, 0x8c4287ec, 0x8f830054,
-0x441021, 0x431023, 0x44102b, 0x1440004e,
-0x0, 0x3c020002, 0x8c428674, 0x1440004a,
-0x0, 0x3c010002, 0xac208684, 0x10c00026,
-0x0, 0x3c090002, 0x8d298668, 0x24070001,
-0x3c044000, 0x3c080002, 0x2508a8bc, 0x250afffc,
-0x52842, 0x14a00002, 0x24c6ffff, 0x24050008,
-0xa91024, 0x10400011, 0x0, 0x14a70009,
-0x0, 0x8d020000, 0x441024, 0x1040000b,
-0x0, 0x3c010002, 0xac258684, 0x10000007,
-0x0, 0x8d420000, 0x441024, 0x10400003,
-0x0, 0x3c010002, 0xac278684, 0x3c020002,
-0x8c428684, 0x6182b, 0x2c420001, 0x431024,
-0x5440ffe4, 0x52842, 0x8f820054, 0x3c030002,
-0x8c638684, 0x3c010002, 0xac2287ec, 0x1060003b,
-0x24020005, 0x3c030002, 0x8c6387fc, 0x3c010002,
-0xac25866c, 0x14620012, 0x24020001, 0x3c020002,
-0x8c42a8b8, 0x3c032000, 0x34635000, 0x431024,
-0x14400006, 0x24020001, 0x3c010002, 0xac2087d8,
-0x3c010002, 0xac22866c, 0x24020001, 0x3c010002,
-0xac2286f0, 0x3c010002, 0xac228678, 0x24020001,
-0x3c010002, 0xac228670, 0x3c020002, 0x8c428684,
-0x1040001e, 0x0, 0x3c020002, 0x8c428670,
-0x10400008, 0x24020001, 0x3c010002, 0xac208670,
-0xaee204b8, 0x3c010002, 0xac2086e8, 0x3c010002,
-0xac2286a0, 0x8ee304b8, 0x24020008, 0x10620005,
-0x24020001, 0xc0047b3, 0x0, 0x1000000b,
-0x0, 0x3c030002, 0x8c63866c, 0x10620007,
-0x2402000e, 0x3c030002, 0x8c63a850, 0x10620003,
-0x0, 0xc0054be, 0x8f840220, 0x8fbf0010,
-0x3e00008, 0x27bd0018, 0x27bdffd8, 0x3c03fdff,
-0x3c040002, 0x8c84866c, 0x3c020002, 0x8c428694,
-0x3463ffff, 0x283a024, 0x14820006, 0xafbf0020,
-0x8ee304b8, 0x3c020002, 0x8c428698, 0x10620006,
-0x0, 0x8ee204b8, 0x3c010002, 0xac248694,
-0x3c010002, 0xac228698, 0x3c030002, 0x8c63866c,
-0x24020002, 0x106201cc, 0x2c620003, 0x10400005,
-0x24020001, 0x1062000a, 0x0, 0x1000027d,
-0x0, 0x24020004, 0x106200eb, 0x24020008,
-0x1062014e, 0x24020001, 0x10000276, 0x0,
-0x8ee204b8, 0x2443ffff, 0x2c620008, 0x10400273,
-0x31080, 0x3c010002, 0x220821, 0x8c228210,
-0x400008, 0x0, 0x3c030002, 0x8c6387fc,
-0x24020005, 0x14620012, 0x0, 0x3c020002,
-0x8c428678, 0x10400009, 0x24020003, 0xc004a53,
-0x0, 0x24020002, 0xaee204b8, 0x3c010002,
-0xac208678, 0x10000002, 0x0, 0xaee204b8,
-0x3c010002, 0xac20860c, 0x10000258, 0x0,
-0xc004a53, 0x0, 0x3c020002, 0x8c428678,
-0x3c010002, 0xac20860c, 0x144001a8, 0x24020002,
-0x100001f1, 0x24020007, 0x3c030002, 0x8c6387fc,
-0x24020005, 0x14620003, 0x24020001, 0x3c010002,
-0xac22869c, 0xc004c1d, 0x0, 0x3c030002,
-0x8c63869c, 0x100001a3, 0x24020011, 0x3c050002,
-0x8ca5866c, 0x3c060002, 0x8cc6a8bc, 0xc005738,
-0x2021, 0x24020005, 0x3c010002, 0xac208678,
-0x10000236, 0xaee204b8, 0x3c040002, 0x248481fc,
-0x3c05000f, 0x34a50100, 0x3021, 0x3821,
-0xafa00010, 0xc002d3b, 0xafa00014, 0x3c040002,
-0x248481c0, 0x240204b0, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070002, 0x24e781d8, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x10000217,
-0x0, 0x24040001, 0x2405001a, 0x8f820220,
-0x27a60018, 0x3c03f700, 0x431025, 0xaf820220,
-0xc004b9a, 0x0, 0x97a60018, 0x30c20200,
-0x104001a1, 0x3c05000c, 0x3c040002, 0x24848208,
-0x34a50111, 0x3c020002, 0x8c42866c, 0x3c030002,
-0x8c6387d8, 0x3821, 0xafa20010, 0xc002d3b,
-0xafa30014, 0x2021, 0x2821, 0xc005400,
-0x24064040, 0x1000018e, 0x24020002, 0x8f820220,
-0x3c030004, 0x431024, 0x14400197, 0x24020007,
-0x8f830054, 0x3c020002, 0x8c4287e4, 0x2463d8f0,
-0x431023, 0x2c422710, 0x14400003, 0x24020001,
-0x3c010002, 0xac228670, 0x3c020002, 0x8c42a8bc,
-0x30425000, 0x104001e5, 0x0, 0x8f820220,
-0x30428000, 0x1040019f, 0x0, 0x10000197,
-0x0, 0x3c050002, 0x8ca5866c, 0xc0058d7,
-0x2021, 0xc005b59, 0x2021, 0x3c030002,
-0x8c63a8b4, 0x46101d3, 0x24020001, 0x3c020008,
-0x621024, 0x10400006, 0x0, 0x8f820214,
-0x3c03ffff, 0x431024, 0x10000005, 0x3442251f,
-0x8f820214, 0x3c03ffff, 0x431024, 0x3442241f,
-0xaf820214, 0x8f820220, 0x3c030200, 0x34420002,
-0xaf820220, 0x24020008, 0xaee204b8, 0x8f820220,
-0x283a025, 0x3c030004, 0x431024, 0x14400016,
-0x0, 0x3c020002, 0x8c42a8bc, 0x30425000,
-0x1040000d, 0x0, 0x8f820220, 0x30428000,
-0x10400006, 0x0, 0x8f820220, 0x3c03ffff,
-0x34637fff, 0x10000003, 0x431024, 0x8f820220,
-0x34428000, 0xaf820220, 0x8f820220, 0x3c03f700,
-0x431025, 0xaf820220, 0x3c030002, 0x8c6387fc,
-0x24020005, 0x1462000a, 0x0, 0x3c020002,
-0x944287e2, 0x24429fbc, 0x2c420004, 0x10400004,
-0x24040018, 0x24050002, 0xc005400, 0x24060020,
-0xc0043c9, 0x0, 0x3c010002, 0xac2086ec,
-0x10000192, 0x0, 0x8ee204b8, 0x2443ffff,
-0x2c620008, 0x1040018d, 0x31080, 0x3c010002,
-0x220821, 0x8c228230, 0x400008, 0x0,
-0xc00430b, 0x0, 0x3c010002, 0xac208670,
-0xaf800204, 0x3c010002, 0xac20a8a0, 0xc004a53,
-0x0, 0x24020001, 0x3c010002, 0xac228688,
-0x1000010f, 0x24020002, 0xc004b1d, 0x0,
-0x3c030002, 0x8c638688, 0x100000d6, 0x24020009,
-0x3c020002, 0x8c42a8b8, 0x30424000, 0x10400004,
-0x0, 0x8f820044, 0x10000006, 0x3442f080,
-0x8f820044, 0x3c03ffff, 0x34633f7f, 0x431024,
-0x3442a080, 0xaf820044, 0x8f830054, 0x100000fc,
-0x24020004, 0x8f830054, 0x3c020002, 0x8c4287e4,
-0x2463d8f0, 0x431023, 0x2c422710, 0x1440015b,
-0x24020005, 0x100000c6, 0x0, 0x8f820220,
-0x3c03f700, 0x431025, 0xaf820220, 0xaf800204,
-0x3c010002, 0xac20a8a0, 0x100000e7, 0x0,
-0x8f830054, 0x3c020002, 0x8c4287e4, 0x2463fff6,
-0x431023, 0x2c42000a, 0x14400148, 0x24020007,
-0x100000e9, 0x0, 0xc0044a8, 0x0,
-0x10400140, 0x24020001, 0x8f820214, 0x3c03ffff,
-0x3c040002, 0x8c8487d8, 0x431024, 0x3442241f,
-0xaf820214, 0x24020008, 0x10800005, 0xaee204b8,
-0x3c020002, 0x8c428708, 0x1040004e, 0x24020001,
-0x8f820220, 0x3c030008, 0x431024, 0x10400054,
-0x3c020200, 0x10000063, 0x0, 0x8ee204b8,
-0x2443ffff, 0x2c620007, 0x10400128, 0x31080,
-0x3c010002, 0x220821, 0x8c228250, 0x400008,
-0x0, 0xc004b1d, 0x0, 0x3c030002,
-0x8c638688, 0x1000007f, 0x24020009, 0x3c020002,
-0x8c42a8b8, 0x30424000, 0x10400003, 0x3c0200c8,
-0x10000002, 0x344201f6, 0x344201fe, 0xaf820238,
-0x8f830054, 0x100000aa, 0x24020004, 0x8f830054,
-0x3c020002, 0x8c4287e4, 0x2463d8f0, 0x431023,
-0x2c422710, 0x14400109, 0x24020005, 0x10000074,
-0x0, 0x8f830054, 0x3c020002, 0x8c4287e4,
-0x2463fff6, 0x431023, 0x2c42000a, 0x144000ff,
-0x24020007, 0x100000a0, 0x0, 0xc0044a8,
-0x0, 0x104000f7, 0x24020001, 0x8f820214,
-0x3c03ffff, 0x3c040002, 0x8c8487d8, 0x431024,
-0x3442241f, 0xaf820214, 0x24020008, 0x1080000f,
-0xaee204b8, 0x3c020002, 0x8c428708, 0x1440000b,
-0x0, 0x8f820220, 0x34420002, 0xaf820220,
-0x24020001, 0x3c010002, 0xac22a850, 0xc0054be,
-0x8f840220, 0x10000017, 0x0, 0x8f820220,
-0x3c030008, 0x431024, 0x14400012, 0x3c020200,
-0x282a025, 0x2402000e, 0x3c010002, 0xac22a850,
-0xc005b59, 0x2021, 0x8f820220, 0x34420002,
-0xaf820220, 0xc0043c9, 0x0, 0x3c050002,
-0x8ca5866c, 0xc0058d7, 0x2021, 0x100000cb,
-0x0, 0x3c020002, 0x8c428708, 0x104000c7,
-0x0, 0x3c020002, 0x8c428704, 0x2442ffff,
-0x3c010002, 0xac228704, 0x144000c0, 0x24020002,
-0x3c010002, 0xac208708, 0x3c010002, 0xac228704,
-0x100000ba, 0x0, 0x8ee204b8, 0x2443ffff,
-0x2c620007, 0x104000b5, 0x31080, 0x3c010002,
-0x220821, 0x8c228270, 0x400008, 0x0,
-0x3c020002, 0x8c428678, 0x10400019, 0x24020005,
-0xc004a53, 0x0, 0x24020002, 0xaee204b8,
-0x3c010002, 0xac208678, 0x100000a4, 0x0,
-0xc004f82, 0x0, 0x3c030002, 0x8c6386a0,
-0x24020006, 0x1462009d, 0x24020003, 0x1000009b,
-0xaee204b8, 0x3c050002, 0x8ca5866c, 0x3c060002,
-0x8cc6a8b8, 0xc005738, 0x2021, 0x24020005,
-0x10000092, 0xaee204b8, 0x24040001, 0x2405001a,
-0x8f820220, 0x27a60018, 0x3c03f700, 0x431025,
-0xaf820220, 0xc004b9a, 0x0, 0x97a60018,
-0x30c20200, 0x1040001c, 0x3c05000c, 0x3c040002,
-0x24848208, 0x34a50112, 0x3c020002, 0x8c42866c,
-0x3c030002, 0x8c6387d8, 0x3821, 0xafa20010,
-0xc002d3b, 0xafa30014, 0x2021, 0x2821,
-0xc005400, 0x24064040, 0x3c020002, 0x8c4287d8,
-0x10400006, 0x2021, 0x2821, 0xc005400,
-0x24061000, 0x1000006d, 0x0, 0x24020002,
-0x1000006a, 0xaee204b8, 0x8f830054, 0x24020006,
-0xaee204b8, 0x3c010002, 0xac2387e4, 0x10000063,
-0x0, 0x8f820220, 0x3c030004, 0x431024,
-0x10400003, 0x24020007, 0x1000005c, 0xaee204b8,
-0x8f830054, 0x3c020002, 0x8c4287e4, 0x2463d8f0,
-0x431023, 0x2c422710, 0x14400003, 0x24020001,
-0x3c010002, 0xac228670, 0x3c020002, 0x8c42a8b8,
-0x30425000, 0x1040004d, 0x0, 0x8f820220,
-0x30428000, 0x10400007, 0x0, 0x8f820220,
-0x3c03ffff, 0x34637fff, 0x431024, 0x10000043,
-0xaf820220, 0x8f820220, 0x34428000, 0xaf820220,
-0x1000003e, 0x0, 0x3c050002, 0x8ca5866c,
-0xc0058d7, 0x2021, 0xc005b59, 0x2021,
-0x3c020002, 0x8c42a8b0, 0x4410032, 0x24020001,
-0x8f820214, 0x3c03ffff, 0x431024, 0x3442241f,
-0xaf820214, 0x24020008, 0xaee204b8, 0x8f820220,
-0x34420002, 0xaf820220, 0x8f820220, 0x3c030004,
-0x431024, 0x14400016, 0x0, 0x3c020002,
-0x8c42a8b8, 0x30425000, 0x1040000d, 0x0,
-0x8f820220, 0x30428000, 0x10400006, 0x0,
-0x8f820220, 0x3c03ffff, 0x34637fff, 0x10000003,
-0x431024, 0x8f820220, 0x34428000, 0xaf820220,
-0x8f820220, 0x3c03f700, 0x431025, 0xaf820220,
-0x3c020002, 0x944287e2, 0x24429fbc, 0x2c420004,
-0x10400004, 0x24040018, 0x24050002, 0xc005400,
-0x24060020, 0xc0043c9, 0x0, 0x10000003,
-0x0, 0x3c010002, 0xac228670, 0x8fbf0020,
-0x3e00008, 0x27bd0028, 0x8f820200, 0x8f820220,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820200,
-0x3c050002, 0x8ca5866c, 0x34420004, 0xaf820200,
-0x24020002, 0x10a2004d, 0x2ca20003, 0x10400005,
-0x24020001, 0x10a2000a, 0x0, 0x100000b6,
-0x0, 0x24020004, 0x10a20075, 0x24020008,
-0x10a20089, 0x3c02f0ff, 0x100000af, 0x0,
-0x8f830050, 0x3c02f0ff, 0x3442ffff, 0x3c040002,
-0x8c8487fc, 0x621824, 0x3c020700, 0x621825,
-0x24020e00, 0x2484fffb, 0x2c840002, 0xaf830050,
-0xaf850200, 0xaf850220, 0xaf820238, 0x14800006,
-0x0, 0x8f820044, 0x3c03ffff, 0x34633f7f,
-0x431024, 0xaf820044, 0x3c030002, 0x8c6387fc,
-0x24020005, 0x14620004, 0x0, 0x8f820044,
-0x34425000, 0xaf820044, 0x3c020002, 0x8c42865c,
-0x3c030002, 0x8c6387fc, 0x34420022, 0x2463fffc,
-0x2c630002, 0xaf820200, 0x1460000c, 0x0,
-0x3c020002, 0x8c428680, 0x3c030002, 0x8c638664,
-0x3c040002, 0x8c848660, 0x34428000, 0x621825,
-0x641825, 0x1000000a, 0x34620002, 0x3c020002,
-0x8c428664, 0x3c030002, 0x8c638680, 0x3c040002,
-0x8c848660, 0x431025, 0x441025, 0x34420002,
-0xaf820220, 0x1000002f, 0x24020001, 0x24020e01,
-0xaf820238, 0x8f830050, 0x3c02f0ff, 0x3442ffff,
-0x3c040002, 0x8c8487d8, 0x621824, 0x3c020d00,
-0x621825, 0x24020001, 0xaf830050, 0xaf820200,
-0xaf820220, 0x10800005, 0x3c033f00, 0x3c020002,
-0x8c428654, 0x10000004, 0x34630070, 0x3c020002,
-0x8c428654, 0x34630072, 0x431025, 0xaf820200,
-0x3c030002, 0x8c638658, 0x3c02f700, 0x621825,
-0x3c020002, 0x8c428664, 0x3c040002, 0x8c848680,
-0x3c050002, 0x8ca587fc, 0x431025, 0x441025,
-0xaf820220, 0x24020005, 0x14a20006, 0x24020001,
-0x8f820044, 0x2403afff, 0x431024, 0xaf820044,
-0x24020001, 0xaf820238, 0x1000003f, 0x0,
-0x8f830050, 0x3c02f0ff, 0x3442ffff, 0x3c040002,
-0x8c8487d8, 0x621824, 0x3c020a00, 0x621825,
-0x24020001, 0xaf830050, 0xaf820200, 0xaf820220,
-0x1080001f, 0x0, 0x3c020002, 0x8c428708,
-0x1440001b, 0x3c033f00, 0x3c020002, 0x8c428654,
-0x1000001b, 0x346300e0, 0x8f830050, 0x3c040002,
-0x8c8487d8, 0x3442ffff, 0x621824, 0xaf830050,
-0x1080000f, 0x0, 0x3c020002, 0x8c428708,
-0x1440000b, 0x3c043f00, 0x3c030002, 0x8c638654,
-0x348400e0, 0x24020001, 0xaf820200, 0xaf820220,
-0x641825, 0xaf830200, 0x10000008, 0x3c05f700,
-0x3c020002, 0x8c428654, 0x3c033f00, 0x346300e2,
-0x431025, 0xaf820200, 0x3c05f700, 0x34a58000,
-0x3c030002, 0x8c638658, 0x3c020002, 0x8c428664,
-0x3c040002, 0x8c848680, 0x651825, 0x431025,
-0x441025, 0xaf820220, 0x3e00008, 0x0,
-0x3c030002, 0x8c638688, 0x3c020002, 0x8c42868c,
-0x27bdffe0, 0x10620003, 0xafbf0018, 0x3c010002,
-0xac23868c, 0x24020002, 0x1062003c, 0x2c620003,
-0x10400005, 0x24020001, 0x10620008, 0x24020004,
-0x10000055, 0x0, 0x24020009, 0x1062003f,
-0x240209e3, 0x10000050, 0x0, 0x3c030002,
-0x8c63866c, 0x10620008, 0x24020008, 0x14620010,
-0x240209ca, 0x3c0200c8, 0x344201fb, 0xaf820238,
-0x1000001e, 0x0, 0x24020e01, 0xaf820238,
-0x8f820044, 0x3c03ffff, 0x34633f7f, 0x431024,
-0x34420080, 0xaf820044, 0x10000014, 0x0,
-0x3c040002, 0x248481c0, 0xafa20010, 0xafa00014,
-0x8f860144, 0x3c070002, 0x24e781d8, 0xc002d3b,
-0x3405dead, 0x8f82011c, 0x34420002, 0xaf82011c,
-0x8f820220, 0x34420004, 0xaf820220, 0x8f820140,
-0x3c030001, 0x431025, 0xaf820140, 0x8f830054,
-0x24020002, 0x3c010002, 0xac228688, 0x3c010002,
-0xac2387e8, 0x10000034, 0x0, 0x8f830054,
-0x3c020002, 0x8c4287e8, 0x2463d8f0, 0x431023,
-0x2c422710, 0x1440002c, 0x24020009, 0x3c010002,
-0xac228688, 0x10000028, 0x0, 0x3c040002,
-0x248481c0, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070002, 0x24e781d8, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x3c030001,
-0x431025, 0xaf820140, 0x3c040002, 0x248481c0,
-0x240209e9, 0xafa20010, 0xafa00014, 0x8f860144,
-0x3c070002, 0x24e781d8, 0xc002d3b, 0x3405dead,
-0x8f82011c, 0x34420002, 0xaf82011c, 0x8f820220,
-0x34420004, 0xaf820220, 0x8f820140, 0x3c030001,
-0x431025, 0xaf820140, 0x8fbf0018, 0x3e00008,
-0x27bd0020, 0x27bdffd8, 0xafb20018, 0x809021,
-0xafb3001c, 0xa09821, 0xafb10014, 0xc08821,
-0xafb00010, 0x8021, 0xafbf0020, 0xa6200000,
-0xc00539d, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x24100010, 0x2501024,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x2501024, 0x24100010,
-0x2701024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x2701024,
-0xc0053de, 0x34108000, 0xc0053de, 0x0,
-0xc00537d, 0x0, 0x50400005, 0x108042,
-0x96220000, 0x501025, 0xa6220000, 0x108042,
-0x1600fff7, 0x0, 0xc0053de, 0x0,
-0x8fbf0020, 0x8fb3001c, 0x8fb20018, 0x8fb10014,
-0x8fb00010, 0x3e00008, 0x27bd0028, 0x27bdffd8,
-0xafb10014, 0x808821, 0xafb20018, 0xa09021,
-0xafb3001c, 0xc09821, 0xafb00010, 0x8021,
-0xafbf0020, 0xc00539d, 0x24040001, 0x26100001,
-0x2e020020, 0x1440fffb, 0x0, 0xc00539d,
-0x2021, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0xc00539d, 0x24040001, 0x24100010,
-0x2301024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x2301024,
-0x24100010, 0x2501024, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x2501024, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0x34108000, 0x96620000, 0x501024,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fff8, 0x0, 0xc0053de,
-0x0, 0x8fbf0020, 0x8fb3001c, 0x8fb20018,
-0x8fb10014, 0x8fb00010, 0x3e00008, 0x27bd0028,
-0x3c040002, 0x8c84869c, 0x3c020002, 0x8c4286e4,
-0x27bdffd8, 0xafbf0020, 0xafb1001c, 0x10820003,
-0xafb00018, 0x3c010002, 0xac2486e4, 0x3c030002,
-0x8c6387fc, 0x24020005, 0x14620005, 0x2483ffff,
-0xc004f82, 0x0, 0x1000034d, 0x0,
-0x2c620013, 0x1040034a, 0x31080, 0x3c010002,
-0x220821, 0x8c2282a8, 0x400008, 0x0,
-0xc0053de, 0x8021, 0x34028000, 0xa7a20010,
-0x27b10010, 0xc00539d, 0x24040001, 0x26100001,
-0x2e020020, 0x1440fffb, 0x0, 0xc00539d,
-0x2021, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0xc00539d, 0x24040001, 0x24100010,
-0x32020001, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x32020001,
-0x24100010, 0xc00539d, 0x2021, 0x108042,
-0x1600fffc, 0x0, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x34108000, 0x96220000,
-0x501024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fff8, 0x0,
-0xc0053de, 0x0, 0x1000030f, 0x24020002,
-0x27b10010, 0xa7a00010, 0x8021, 0xc00539d,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc00539d, 0x2021, 0xc00539d,
-0x24040001, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0x24100010, 0x32020001, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020001, 0x24100010, 0xc00539d,
-0x2021, 0x108042, 0x1600fffc, 0x0,
-0xc0053de, 0x34108000, 0xc0053de, 0x0,
-0xc00537d, 0x0, 0x50400005, 0x108042,
-0x96220000, 0x501025, 0xa6220000, 0x108042,
-0x1600fff7, 0x0, 0xc0053de, 0x0,
-0x97a20010, 0x30428000, 0x144002dd, 0x24020003,
-0x100002d9, 0x0, 0x24021200, 0xa7a20010,
-0x27b10010, 0x8021, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0xc00539d, 0x2021,
-0x108042, 0x1600fffc, 0x0, 0xc00539d,
-0x24040001, 0xc00539d, 0x2021, 0x34108000,
-0x96220000, 0x501024, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fff8,
-0x0, 0xc0053de, 0x0, 0x8f830054,
-0x10000296, 0x24020004, 0x8f830054, 0x3c020002,
-0x8c4287f8, 0x2463ff9c, 0x431023, 0x2c420064,
-0x1440029f, 0x24020002, 0x3c030002, 0x8c6387fc,
-0x10620298, 0x2c620003, 0x14400297, 0x24020011,
-0x24020003, 0x10620005, 0x24020004, 0x10620292,
-0x2402000f, 0x10000290, 0x24020011, 0x1000028e,
-0x24020005, 0x24020014, 0xa7a20010, 0x27b10010,
-0x8021, 0xc00539d, 0x24040001, 0x26100001,
-0x2e020020, 0x1440fffb, 0x0, 0xc00539d,
-0x2021, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0xc00539d, 0x24040001, 0x24100010,
-0x32020001, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x32020001,
-0x24100010, 0x32020012, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020012, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0x34108000, 0x96220000, 0x501024,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fff8, 0x0, 0xc0053de,
-0x0, 0x8f830054, 0x10000248, 0x24020006,
-0x8f830054, 0x3c020002, 0x8c4287f8, 0x2463ff9c,
-0x431023, 0x2c420064, 0x14400251, 0x24020007,
-0x1000024d, 0x0, 0x24020006, 0xa7a20010,
-0x27b10010, 0x8021, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020013, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020013, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x34108000, 0x96220000,
-0x501024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fff8, 0x0,
-0xc0053de, 0x0, 0x8f830054, 0x10000207,
-0x24020008, 0x8f830054, 0x3c020002, 0x8c4287f8,
-0x2463ff9c, 0x431023, 0x2c420064, 0x14400210,
-0x24020009, 0x1000020c, 0x0, 0x27b10010,
-0xa7a00010, 0x8021, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020018, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020018, 0xc0053de, 0x34108000,
-0xc0053de, 0x0, 0xc00537d, 0x0,
-0x50400005, 0x108042, 0x96220000, 0x501025,
-0xa6220000, 0x108042, 0x1600fff7, 0x0,
-0xc0053de, 0x8021, 0x97a20010, 0x27b10010,
-0x34420001, 0xa7a20010, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020018, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020018, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x34108000, 0x96220000,
-0x501024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fff8, 0x0,
-0xc0053de, 0x0, 0x8f830054, 0x10000193,
-0x2402000a, 0x8f830054, 0x3c020002, 0x8c4287f8,
-0x2463ff9c, 0x431023, 0x2c420064, 0x1440019c,
-0x2402000b, 0x10000198, 0x0, 0x27b10010,
-0xa7a00010, 0x8021, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020017, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020017, 0xc0053de, 0x34108000,
-0xc0053de, 0x0, 0xc00537d, 0x0,
-0x50400005, 0x108042, 0x96220000, 0x501025,
-0xa6220000, 0x108042, 0x1600fff7, 0x0,
-0xc0053de, 0x8021, 0x97a20010, 0x27b10010,
-0x34420700, 0xa7a20010, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020017, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020017, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x34108000, 0x96220000,
-0x501024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fff8, 0x0,
-0xc0053de, 0x0, 0x8f830054, 0x1000011f,
-0x2402000c, 0x8f830054, 0x3c020002, 0x8c4287f8,
-0x2463ff9c, 0x431023, 0x2c420064, 0x14400128,
-0x24020012, 0x10000124, 0x0, 0x27b10010,
-0xa7a00010, 0x8021, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020014, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020014, 0xc0053de, 0x34108000,
-0xc0053de, 0x0, 0xc00537d, 0x0,
-0x50400005, 0x108042, 0x96220000, 0x501025,
-0xa6220000, 0x108042, 0x1600fff7, 0x0,
-0xc0053de, 0x8021, 0x97a20010, 0x27b10010,
-0x34420010, 0xa7a20010, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020014, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020014, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x34108000, 0x96220000,
-0x501024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fff8, 0x0,
-0xc0053de, 0x0, 0x8f830054, 0x100000ab,
-0x24020013, 0x8f830054, 0x3c020002, 0x8c4287f8,
-0x2463ff9c, 0x431023, 0x2c420064, 0x144000b4,
-0x2402000d, 0x100000b0, 0x0, 0x27b10010,
-0xa7a00010, 0x8021, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020018, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020018, 0xc0053de, 0x34108000,
-0xc0053de, 0x0, 0xc00537d, 0x0,
-0x50400005, 0x108042, 0x96220000, 0x501025,
-0xa6220000, 0x108042, 0x1600fff7, 0x0,
-0xc0053de, 0x8021, 0x97a20010, 0x27b10010,
-0x3042fffe, 0xa7a20010, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020018, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020018, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x34108000, 0x96220000,
-0x501024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fff8, 0x0,
-0xc0053de, 0x0, 0x8f830054, 0x10000037,
-0x2402000e, 0x24020840, 0xa7a20010, 0x27b10010,
-0x8021, 0xc00539d, 0x24040001, 0x26100001,
-0x2e020020, 0x1440fffb, 0x0, 0xc00539d,
-0x2021, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0xc00539d, 0x24040001, 0x24100010,
-0x32020001, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x32020001,
-0x24100010, 0x32020013, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020013, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0x34108000, 0x96220000, 0x501024,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fff8, 0x0, 0xc0053de,
-0x0, 0x8f830054, 0x24020010, 0x3c010002,
-0xac22869c, 0x3c010002, 0xac2387f8, 0x1000000c,
-0x0, 0x8f830054, 0x3c020002, 0x8c4287f8,
-0x2463ff9c, 0x431023, 0x2c420064, 0x14400004,
-0x0, 0x24020011, 0x3c010002, 0xac22869c,
-0x8fbf0020, 0x8fb1001c, 0x8fb00018, 0x3e00008,
-0x27bd0028, 0x3c030002, 0x8c63866c, 0x27bdffc8,
-0x24020002, 0xafbf0034, 0xafb20030, 0xafb1002c,
-0x14620005, 0xafb00028, 0x3c120002, 0x8e52a8b8,
-0x10000003, 0x0, 0x3c120002, 0x8e52a8bc,
-0x3c030002, 0x8c6386a0, 0x3c020002, 0x8c4286e8,
-0x50620004, 0x2463ffff, 0x3c010002, 0xac2386e8,
-0x2463ffff, 0x2c620006, 0x1040037c, 0x31080,
-0x3c010002, 0x220821, 0x8c228300, 0x400008,
-0x0, 0x2021, 0x2821, 0xc005400,
-0x34068000, 0x24040010, 0x24050002, 0x24060002,
-0x24020002, 0xc005400, 0xa7a20018, 0x24020002,
-0x3c010002, 0xac2286a0, 0x10000368, 0x0,
-0x27b10018, 0xa7a00018, 0x8021, 0xc00539d,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc00539d, 0x2021, 0xc00539d,
-0x24040001, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0x24100010, 0x32020001, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020001, 0x24100010, 0xc00539d,
-0x2021, 0x108042, 0x1600fffc, 0x0,
-0xc0053de, 0x34108000, 0xc0053de, 0x0,
-0xc00537d, 0x0, 0x50400005, 0x108042,
-0x96220000, 0x501025, 0xa6220000, 0x108042,
-0x1600fff7, 0x0, 0xc0053de, 0x0,
-0x97a20018, 0x30428000, 0x14400004, 0x24020003,
-0x3c010002, 0xac2286a0, 0x24020003, 0x3c010002,
-0xac2286a0, 0x1000032d, 0x0, 0x24040010,
-0x24050002, 0x24060002, 0x24020002, 0xc005400,
-0xa7a20018, 0x3c030002, 0x8c6386ec, 0x24020001,
-0x146201e1, 0x8021, 0x27b10018, 0xa7a00018,
-0xc00539d, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020018, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x32020018,
-0xc0053de, 0x34108000, 0xc0053de, 0x0,
-0xc00537d, 0x0, 0x50400005, 0x108042,
-0x96220000, 0x501025, 0xa6220000, 0x108042,
-0x1600fff7, 0x0, 0xc0053de, 0x8021,
-0x27b10018, 0xa7a00018, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0x32020018, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020018, 0xc0053de, 0x34108000,
-0xc0053de, 0x0, 0xc00537d, 0x0,
-0x50400005, 0x108042, 0x96220000, 0x501025,
-0xa6220000, 0x108042, 0x1600fff7, 0x0,
-0xc0053de, 0x8021, 0x24040018, 0x2821,
-0xc005400, 0x24060404, 0xa7a0001a, 0xc00539d,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc00539d, 0x2021, 0xc00539d,
-0x24040001, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0x24100010, 0x32020001, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x32020001, 0x24100010, 0x32020018,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x32020018, 0xc0053de,
-0x34108000, 0xc0053de, 0x0, 0xc00537d,
-0x0, 0x50400005, 0x108042, 0x97a2001a,
-0x501025, 0xa7a2001a, 0x108042, 0x1600fff7,
-0x0, 0xc0053de, 0x8021, 0xa7a0001a,
-0xc00539d, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x32020018, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x32020018,
-0xc0053de, 0x34108000, 0xc0053de, 0x0,
-0xc00537d, 0x0, 0x50400005, 0x108042,
-0x97a2001a, 0x501025, 0xa7a2001a, 0x108042,
-0x1600fff7, 0x0, 0xc0053de, 0x8021,
-0xa7a0001c, 0xc00539d, 0x24040001, 0x26100001,
-0x2e020020, 0x1440fffb, 0x0, 0xc00539d,
-0x2021, 0xc00539d, 0x24040001, 0xc00539d,
-0x24040001, 0xc00539d, 0x2021, 0x24100010,
-0xc00539d, 0x2021, 0x108042, 0x1600fffc,
-0x0, 0x24100010, 0x3202001e, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fffa, 0x3202001e, 0xc0053de, 0x34108000,
-0xc0053de, 0x0, 0xc00537d, 0x0,
-0x50400005, 0x108042, 0x97a2001c, 0x501025,
-0xa7a2001c, 0x108042, 0x1600fff7, 0x0,
-0xc0053de, 0x8021, 0xa7a0001c, 0xc00539d,
-0x24040001, 0x26100001, 0x2e020020, 0x1440fffb,
-0x0, 0xc00539d, 0x2021, 0xc00539d,
-0x24040001, 0xc00539d, 0x24040001, 0xc00539d,
-0x2021, 0x24100010, 0xc00539d, 0x2021,
-0x108042, 0x1600fffc, 0x0, 0x24100010,
-0x3202001e, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x3202001e,
-0xc0053de, 0x34108000, 0xc0053de, 0x0,
-0xc00537d, 0x0, 0x50400005, 0x108042,
-0x97a2001c, 0x501025, 0xa7a2001c, 0x108042,
-0x1600fff7, 0x0, 0xc0053de, 0x8021,
-0x24020002, 0xa7a2001e, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0x24100010, 0xc00539d, 0x2021, 0x108042,
-0x1600fffc, 0x0, 0x24100010, 0x3202001e,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x3202001e, 0xc00539d,
-0x24040001, 0xc00539d, 0x2021, 0x34108000,
-0x97a2001e, 0x501024, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fff8,
-0x0, 0xc0053de, 0x8021, 0xa7a00020,
-0xc00539d, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x24100010, 0xc00539d,
-0x2021, 0x108042, 0x1600fffc, 0x0,
-0x24100010, 0x3202001e, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x3202001e, 0xc0053de, 0x34108000, 0xc0053de,
-0x0, 0xc00537d, 0x0, 0x50400005,
-0x108042, 0x97a20020, 0x501025, 0xa7a20020,
-0x108042, 0x1600fff7, 0x0, 0xc0053de,
-0x8021, 0xa7a00020, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0x24100010, 0xc00539d, 0x2021, 0x108042,
-0x1600fffc, 0x0, 0x24100010, 0x3202001e,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x3202001e, 0xc0053de,
-0x34108000, 0xc0053de, 0x0, 0xc00537d,
-0x0, 0x50400005, 0x108042, 0x97a20020,
-0x501025, 0xa7a20020, 0x108042, 0x1600fff7,
-0x0, 0xc0053de, 0x8021, 0xa7a00022,
-0xc00539d, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0x24100010, 0xc00539d,
-0x2021, 0x108042, 0x1600fffc, 0x0,
-0x24100010, 0xc00539d, 0x2021, 0x108042,
-0x1600fffc, 0x0, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x34108000, 0x97a20022,
-0x501024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fff8, 0x0,
-0xc0053de, 0x0, 0x24040018, 0x24050002,
-0xc005400, 0x24060004, 0x3c100002, 0x8e1086f0,
-0x24020001, 0x1602011e, 0x0, 0x3c020002,
-0x944287e2, 0x3c010002, 0xac2086f0, 0x24429fbc,
-0x2c420004, 0x1040000c, 0x24040009, 0x24050001,
-0xc005400, 0x24060400, 0x24040018, 0x24050001,
-0xc005400, 0x24060020, 0x24040018, 0x24050001,
-0xc005400, 0x24062000, 0x3c024000, 0x2421024,
-0x10400126, 0x3c022000, 0x2421024, 0x10400005,
-0x0, 0x3c010002, 0xac3087d8, 0x10000003,
-0x0, 0x3c010002, 0xac2087d8, 0x3c030002,
-0x8c6387f0, 0x24020005, 0x146200f9, 0x0,
-0x3c020002, 0x8c4287d8, 0x10400067, 0x3c020004,
-0x2421024, 0x10400011, 0xa7a00018, 0x3c020008,
-0x2421024, 0x10400002, 0x24020200, 0xa7a20018,
-0x3c020010, 0x2421024, 0x10400004, 0x0,
-0x97a20018, 0x34420100, 0xa7a20018, 0x97a60018,
-0x24040009, 0x10000004, 0x2821, 0x24040009,
-0x2821, 0x3021, 0xc005400, 0x0,
-0x24020001, 0xa7a2001a, 0x3c020008, 0x2421024,
-0x1040000c, 0x3c020002, 0x2421024, 0x10400002,
-0x24020101, 0xa7a2001a, 0x3c020001, 0x2421024,
-0x10400005, 0x3c020010, 0x97a2001a, 0x34420040,
-0xa7a2001a, 0x3c020010, 0x2421024, 0x1040000e,
-0x3c020002, 0x2421024, 0x10400005, 0x3c020001,
-0x97a2001a, 0x34420080, 0xa7a2001a, 0x3c020001,
-0x2421024, 0x10400005, 0x3c0300a0, 0x97a2001a,
-0x34420020, 0xa7a2001a, 0x3c0300a0, 0x2431024,
-0x54430004, 0x3c020020, 0x97a2001a, 0x1000000c,
-0x34420400, 0x2421024, 0x50400004, 0x3c020080,
-0x97a2001a, 0x10000006, 0x34420800, 0x2421024,
-0x10400004, 0x0, 0x97a2001a, 0x34420c00,
-0xa7a2001a, 0x97a6001a, 0x24040004, 0xc005400,
-0x2821, 0x3c020004, 0x2421024, 0x10400004,
-0xa7a0001c, 0x32425000, 0x14400004, 0x0,
-0x32424000, 0x10400005, 0x2021, 0xc00531e,
-0x2402021, 0x10000096, 0x0, 0x97a6001c,
-0x2821, 0x34c61200, 0xc005400, 0xa7a6001c,
-0x1000008f, 0x0, 0x2421024, 0x10400004,
-0xa7a00018, 0x32425000, 0x14400004, 0x0,
-0x32424000, 0x10400005, 0x3c020010, 0xc00531e,
-0x2402021, 0x10000019, 0xa7a0001a, 0x2421024,
-0x10400004, 0x0, 0x97a20018, 0x10000004,
-0xa7a20018, 0x97a20018, 0x34420100, 0xa7a20018,
-0x3c020001, 0x2421024, 0x10400004, 0x0,
-0x97a20018, 0x10000004, 0xa7a20018, 0x97a20018,
-0x34422000, 0xa7a20018, 0x97a60018, 0x2021,
-0xc005400, 0x2821, 0xa7a0001a, 0x8021,
-0xc00539d, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0xc00539d, 0x2021, 0x108042, 0x1600fffc,
-0x0, 0xc0053de, 0x34108000, 0xc0053de,
-0x0, 0xc00537d, 0x0, 0x50400005,
-0x108042, 0x97a2001a, 0x501025, 0xa7a2001a,
-0x108042, 0x1600fff7, 0x0, 0xc0053de,
-0x8021, 0xa7a0001a, 0xc00539d, 0x24040001,
-0x26100001, 0x2e020020, 0x1440fffb, 0x0,
-0xc00539d, 0x2021, 0xc00539d, 0x24040001,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0x24100010, 0x32020001, 0x10400002, 0x2021,
-0x24040001, 0xc00539d, 0x108042, 0x1600fffa,
-0x32020001, 0x24100010, 0xc00539d, 0x2021,
-0x108042, 0x1600fffc, 0x0, 0xc0053de,
-0x34108000, 0xc0053de, 0x0, 0xc00537d,
-0x0, 0x50400005, 0x108042, 0x97a2001a,
-0x501025, 0xa7a2001a, 0x108042, 0x1600fff7,
-0x0, 0xc0053de, 0x0, 0x3c040002,
-0x248482f4, 0x97a60018, 0x97a7001a, 0x3c020002,
-0x8c42866c, 0x3c030002, 0x8c6387d8, 0x3c05000d,
-0x34a50205, 0xafa20010, 0xc002d3b, 0xafa30014,
-0x8f830054, 0x24020004, 0x3c010002, 0xac2286a0,
-0x3c010002, 0xac2387f4, 0x10000018, 0x0,
-0x8f830054, 0x3c020002, 0x8c4287f4, 0x2463ff9c,
-0x431023, 0x2c420064, 0x14400010, 0x0,
-0x8f820220, 0x24030005, 0x3c010002, 0xac2386a0,
-0x3c03f700, 0x431025, 0xaf820220, 0x10000007,
-0x0, 0x24020006, 0x3c010002, 0xac2286a0,
-0x24020011, 0x3c010002, 0xac22869c, 0x8fbf0034,
-0x8fb20030, 0x8fb1002c, 0x8fb00028, 0x3e00008,
-0x27bd0038, 0x27bdffd8, 0xafb00018, 0x808021,
-0xafb1001c, 0x8821, 0x32024000, 0x10400013,
-0xafbf0020, 0x3c020010, 0x2021024, 0x2c420001,
-0x21023, 0x30434100, 0x3c020001, 0x2021024,
-0x14400006, 0x34714000, 0x3c020002, 0x2021024,
-0x14400002, 0x34716000, 0x34714040, 0x2021,
-0x2821, 0x10000036, 0x2203021, 0x32021000,
-0x10400035, 0x2021, 0x2821, 0xc005400,
-0x24060040, 0x24040018, 0x2821, 0xc005400,
-0x24060c00, 0x24040017, 0x2821, 0xc005400,
-0x24060400, 0x24040016, 0x2821, 0xc005400,
-0x24060006, 0x24040017, 0x2821, 0xc005400,
-0x24062500, 0x24040016, 0x2821, 0xc005400,
-0x24060006, 0x24040017, 0x2821, 0xc005400,
-0x24064600, 0x24040016, 0x2821, 0xc005400,
-0x24060006, 0x24040017, 0x2821, 0xc005400,
-0x24066700, 0x24040016, 0x2821, 0xc005400,
-0x24060006, 0x2404001f, 0x2821, 0xc005400,
-0x24060010, 0x24040009, 0x2821, 0xc005400,
-0x24061500, 0x24040009, 0x2821, 0x24061d00,
-0xc005400, 0x0, 0x3c040002, 0x24848318,
-0x3c05000e, 0x34a50100, 0x2003021, 0x2203821,
-0xafa00010, 0xc002d3b, 0xafa00014, 0x8fbf0020,
-0x8fb1001c, 0x8fb00018, 0x3e00008, 0x27bd0028,
-0x8f850044, 0x8f820044, 0x3c030001, 0x431025,
-0x3c030008, 0xaf820044, 0x8f840054, 0x8f820054,
-0xa32824, 0x10000002, 0x24840001, 0x8f820054,
-0x821023, 0x2c420002, 0x1440fffc, 0x0,
-0x8f820044, 0x3c03fffe, 0x3463ffff, 0x431024,
-0xaf820044, 0x8f830054, 0x8f820054, 0x10000002,
-0x24630001, 0x8f820054, 0x621023, 0x2c420002,
-0x1440fffc, 0x0, 0x3e00008, 0xa01021,
-0x8f830044, 0x3c02fff0, 0x3442ffff, 0x42480,
-0x621824, 0x3c020002, 0x822025, 0x641825,
-0xaf830044, 0x8f820044, 0x3c03fffe, 0x3463ffff,
-0x431024, 0xaf820044, 0x8f830054, 0x8f820054,
-0x10000002, 0x24630001, 0x8f820054, 0x621023,
-0x2c420002, 0x1440fffc, 0x0, 0x8f820044,
-0x3c030001, 0x431025, 0xaf820044, 0x8f830054,
-0x8f820054, 0x10000002, 0x24630001, 0x8f820054,
-0x621023, 0x2c420002, 0x1440fffc, 0x0,
-0x3e00008, 0x0, 0x8f820044, 0x2403ff7f,
-0x431024, 0xaf820044, 0x8f830054, 0x8f820054,
-0x10000002, 0x24630001, 0x8f820054, 0x621023,
-0x2c420002, 0x1440fffc, 0x0, 0x8f820044,
-0x34420080, 0xaf820044, 0x8f830054, 0x8f820054,
-0x10000002, 0x24630001, 0x8f820054, 0x621023,
-0x2c420002, 0x1440fffc, 0x0, 0x3e00008,
-0x0, 0x8f820044, 0x3c03fff0, 0x3463ffff,
-0x431024, 0xaf820044, 0x8f820044, 0x3c030001,
-0x431025, 0xaf820044, 0x8f830054, 0x8f820054,
-0x10000002, 0x24630001, 0x8f820054, 0x621023,
-0x2c420002, 0x1440fffc, 0x0, 0x8f820044,
-0x3c03fffe, 0x3463ffff, 0x431024, 0xaf820044,
-0x8f830054, 0x8f820054, 0x10000002, 0x24630001,
-0x8f820054, 0x621023, 0x2c420002, 0x1440fffc,
-0x0, 0x3e00008, 0x0, 0x27bdffc8,
-0xafb30024, 0x809821, 0xafbe002c, 0xa0f021,
-0xafb20020, 0xc09021, 0x33c2ffff, 0xafbf0030,
-0xafb50028, 0xafb1001c, 0xafb00018, 0x14400034,
-0xa7b20010, 0x3271ffff, 0x27b20010, 0x8021,
-0xc00539d, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x2301024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x2301024,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0x34108000, 0x96420000, 0x501024, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x12000075, 0x0, 0x1000fff6, 0x0,
-0x3275ffff, 0x27b10010, 0xa7a00010, 0x8021,
-0xc00539d, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0xc00539d, 0x24040001,
-0xc00539d, 0x2021, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x2b01024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x2b01024,
-0xc0053de, 0x34108000, 0xc0053de, 0x0,
-0xc00537d, 0x0, 0x50400005, 0x108042,
-0x96220000, 0x501025, 0xa6220000, 0x108042,
-0x1600fff7, 0x0, 0xc0053de, 0x0,
-0x33c5ffff, 0x24020001, 0x54a20004, 0x24020002,
-0x97a20010, 0x10000006, 0x521025, 0x14a20006,
-0x3271ffff, 0x97a20010, 0x121827, 0x431024,
-0xa7a20010, 0x3271ffff, 0x27b20010, 0x8021,
-0xc00539d, 0x24040001, 0x26100001, 0x2e020020,
-0x1440fffb, 0x0, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0xc00539d, 0x24040001, 0x24100010, 0x32020001,
-0x10400002, 0x2021, 0x24040001, 0xc00539d,
-0x108042, 0x1600fffa, 0x32020001, 0x24100010,
-0x2301024, 0x10400002, 0x2021, 0x24040001,
-0xc00539d, 0x108042, 0x1600fffa, 0x2301024,
-0xc00539d, 0x24040001, 0xc00539d, 0x2021,
-0x34108000, 0x96420000, 0x501024, 0x10400002,
-0x2021, 0x24040001, 0xc00539d, 0x108042,
-0x1600fff8, 0x0, 0xc0053de, 0x0,
-0x8fbf0030, 0x8fbe002c, 0x8fb50028, 0x8fb30024,
-0x8fb20020, 0x8fb1001c, 0x8fb00018, 0x3e00008,
-0x27bd0038, 0x27bdffe8, 0xafbf0010, 0x8ee304b8,
-0x24020008, 0x146201f1, 0x0, 0x3c020002,
-0x8c4287d8, 0x14400006, 0x0, 0x8f840224,
-0xc00430b, 0x0, 0x100001e8, 0x0,
-0x8f820220, 0x3c030008, 0x431024, 0x10400029,
-0x24020001, 0x8f840224, 0x8f820220, 0x3c030400,
-0x431024, 0x10400007, 0x0, 0x3c010002,
-0xac20a860, 0x3c010002, 0xac20a880, 0x1000000b,
-0x0, 0x3c030002, 0x2463a860, 0x8c620000,
-0x24420001, 0xac620000, 0x2c420002, 0x14400003,
-0x24020001, 0x3c010002, 0xac22a880, 0x3c020002,
-0x8c42a880, 0x10400007, 0x30820040, 0x10400005,
-0x24020001, 0x3c010002, 0xac22a884, 0x10000003,
-0x0, 0x3c010002, 0xac20a884, 0x3c010002,
-0xac24a85c, 0x3c010002, 0xac20a890, 0x1000000b,
-0x0, 0x3c010002, 0xac22a890, 0x3c010002,
-0xac20a880, 0x3c010002, 0xac20a860, 0x3c010002,
-0xac20a884, 0x3c010002, 0xac20a85c, 0x3c030002,
-0x8c63a850, 0x3c020002, 0x8c42a854, 0x50620004,
-0x2463ffff, 0x3c010002, 0xac23a854, 0x2463ffff,
-0x2c62000e, 0x104001a1, 0x31080, 0x3c010002,
-0x220821, 0x8c228338, 0x400008, 0x0,
-0x24020002, 0x3c010002, 0xac20a880, 0x3c010002,
-0xac20a860, 0x3c010002, 0xac20a85c, 0x3c010002,
-0xac20a884, 0x3c010002, 0xac20a878, 0x3c010002,
-0xac20a870, 0xaf800224, 0x3c010002, 0xac22a850,
-0x3c020002, 0x8c42a890, 0x14400053, 0x3c02fdff,
-0x3442ffff, 0xc00430b, 0x282a024, 0xaf800204,
-0x8f820200, 0x2403fffd, 0x431024, 0xaf820200,
-0x3c010002, 0xac20a8a0, 0x8f830054, 0x3c020002,
-0x8c42a878, 0x24040001, 0x3c010002, 0xac24a88c,
-0x24420001, 0x3c010002, 0xac22a878, 0x2c420004,
-0x3c010002, 0xac23a874, 0x14400007, 0x24020003,
-0x3c010002, 0xac248670, 0x3c010002, 0xac20a878,
-0x1000016a, 0x0, 0x3c010002, 0xac22a850,
-0x10000166, 0x0, 0x8f830054, 0x3c020002,
-0x8c42a874, 0x2463d8f0, 0x431023, 0x2c422710,
-0x14400003, 0x24020004, 0x3c010002, 0xac22a850,
-0x3c020002, 0x8c42a890, 0x14400023, 0x3c02fdff,
-0x3442ffff, 0x10000155, 0x282a024, 0x3c040002,
-0x8c8487dc, 0x3c010002, 0xac20a868, 0xc0056b7,
-0x0, 0x3c020002, 0x8c42a89c, 0xaf820204,
-0x3c020002, 0x8c42a890, 0x14400013, 0x3c03fdff,
-0x8f820204, 0x3463ffff, 0x30420030, 0x14400138,
-0x283a024, 0x3c030002, 0x8c63a89c, 0x24020005,
-0x3c010002, 0xac22a850, 0x3c010002, 0xac23a8a0,
-0x1000013a, 0x0, 0x3c020002, 0x8c42a890,
-0x10400011, 0x3c02fdff, 0x3c020002, 0x8c428700,
-0x24420001, 0x3c010002, 0xac228700, 0x2c420002,
-0x1440012e, 0x24020001, 0x3c010002, 0xac228708,
-0x3c010002, 0xac208700, 0x3c010002, 0xac228670,
-0x10000126, 0x0, 0x3c030002, 0x8c63a880,
-0x3442ffff, 0x10600121, 0x282a024, 0x3c020002,
-0x8c42a85c, 0x1040011d, 0x0, 0x3c010002,
-0xac22a888, 0x24020003, 0x3c010002, 0xac22a860,
-0x100000bd, 0x24020006, 0x3c010002, 0xac20a868,
-0x8f820204, 0x34420040, 0xaf820204, 0x3c020002,
-0x8c42a8a0, 0x24030007, 0x3c010002, 0xac23a850,
-0x34420040, 0x3c010002, 0xac22a8a0, 0x3c020002,
-0x8c42a880, 0x10400005, 0x0, 0x3c020002,
-0x8c42a85c, 0x104000f7, 0x24020002, 0x3c050002,
-0x24a5a860, 0x8ca20000, 0x2c424e21, 0x104000f1,
-0x24020002, 0x3c020002, 0x8c42a884, 0x104000f7,
-0x2404ffbf, 0x3c020002, 0x8c42a85c, 0x3c030002,
-0x8c63a888, 0x441024, 0x641824, 0x10430005,
-0x24020001, 0x3c010002, 0xac22a850, 0x100000eb,
-0x0, 0x24020003, 0xaca20000, 0x24020008,
-0x3c010002, 0xac22a850, 0x3c020002, 0x8c42a88c,
-0x1040000d, 0x24020001, 0x3c040002, 0x8c84a85c,
-0xc0056c4, 0x0, 0x3c020002, 0x8c42a8a8,
-0x14400005, 0x24020001, 0x3c020002, 0x8c42a8a4,
-0x10400007, 0x24020001, 0x3c010002, 0xac228670,
-0x3c010002, 0xac20a878, 0x100000d0, 0x0,
-0x3c020002, 0x8c42a870, 0x3c030002, 0x8c63a85c,
-0x2c420001, 0x210c0, 0x30630008, 0x3c010002,
-0xac22a870, 0x3c010002, 0xac23a86c, 0x8f830054,
-0x24020009, 0x3c010002, 0xac22a850, 0x3c010002,
-0xac23a874, 0x100000bd, 0x0, 0x8f830054,
-0x3c020002, 0x8c42a874, 0x2463d8f0, 0x431023,
-0x2c422710, 0x144000a2, 0x0, 0x3c020002,
-0x8c42a880, 0x10400005, 0x0, 0x3c020002,
-0x8c42a85c, 0x104000a3, 0x24020002, 0x3c030002,
-0x2463a860, 0x8c620000, 0x2c424e21, 0x1040009d,
-0x24020002, 0x3c020002, 0x8c42a88c, 0x1040000e,
-0x0, 0x3c020002, 0x8c42a85c, 0x3c010002,
-0xac20a88c, 0x30420080, 0x1040002f, 0x2402000c,
-0x8f820204, 0x30420080, 0x1440000c, 0x24020003,
-0x10000029, 0x2402000c, 0x3c020002, 0x8c42a85c,
-0x30420080, 0x14400005, 0x24020003, 0x8f820204,
-0x30420080, 0x1040001f, 0x24020003, 0xac620000,
-0x2402000a, 0x3c010002, 0xac22a850, 0x3c040002,
-0x2484a898, 0x8c820000, 0x3c030002, 0x8c63a870,
-0x431025, 0xaf820204, 0x8c830000, 0x3c040002,
-0x8c84a870, 0x2402000b, 0x3c010002, 0xac22a850,
-0x641825, 0x3c010002, 0xac23a8a0, 0x3c050002,
-0x24a5a860, 0x8ca20000, 0x2c424e21, 0x10400069,
-0x24020002, 0x3c020002, 0x8c42a890, 0x10400006,
-0x0, 0x2402000c, 0x3c010002, 0xac22a850,
-0x1000006a, 0x0, 0x3c020002, 0x8c42a880,
-0x10400066, 0x0, 0x3c040002, 0x8c84a85c,
-0x10800057, 0x30820008, 0x3c030002, 0x8c63a86c,
-0x1062005e, 0x24020003, 0x3c010002, 0xac24a888,
-0xaca20000, 0x24020006, 0x3c010002, 0xac22a850,
-0x10000056, 0x0, 0x8f820200, 0x34420002,
-0xaf820200, 0x8f830054, 0x2402000d, 0x3c010002,
-0xac22a850, 0x3c010002, 0xac23a874, 0x8f830054,
-0x3c020002, 0x8c42a874, 0x2463d8f0, 0x431023,
-0x2c422710, 0x14400032, 0x0, 0x3c020002,
-0x8c42a890, 0x10400021, 0x2402000e, 0x3c030002,
-0x8c63a8a4, 0x3c010002, 0xac22a850, 0x14600015,
-0x0, 0xc0043c9, 0x0, 0x3c050002,
-0x8ca5866c, 0xc0058d7, 0x2021, 0x3c030002,
-0x8c63866c, 0x24020004, 0x14620005, 0x2403fffb,
-0x3c020002, 0x8c428668, 0x10000003, 0x2403fff7,
-0x3c020002, 0x8c428668, 0x431024, 0x3c010002,
-0xac228668, 0x8f830224, 0x3c020200, 0x3c010002,
-0xac23a8ac, 0x10000021, 0x282a025, 0x3c020002,
-0x8c42a880, 0x10400005, 0x0, 0x3c020002,
-0x8c42a85c, 0x1040000f, 0x24020002, 0x3c020002,
-0x8c42a860, 0x2c424e21, 0x1040000a, 0x24020002,
-0x3c020002, 0x8c42a880, 0x10400010, 0x0,
-0x3c020002, 0x8c42a85c, 0x1440000c, 0x0,
-0x24020002, 0x3c010002, 0xac22a850, 0x10000007,
-0x0, 0x3c020002, 0x8c42a880, 0x10400003,
-0x0, 0xc00430b, 0x0, 0x8f820220,
-0x3c03f700, 0x431025, 0xaf820220, 0x8fbf0010,
-0x3e00008, 0x27bd0018, 0x3c030002, 0x2463a8a8,
-0x8c620000, 0x10400005, 0x34422000, 0x3c010002,
-0xac22a89c, 0x10000003, 0xac600000, 0x3c010002,
-0xac24a89c, 0x3e00008, 0x0, 0x27bdffe0,
-0x30820030, 0xafbf0018, 0x3c010002, 0xac22a8a4,
-0x1440006b, 0x3c02ffff, 0x34421f0e, 0x821024,
-0x14400065, 0x24020030, 0x30822000, 0x10400061,
-0x30838000, 0x31a02, 0x30820001, 0x21200,
-0x3c040002, 0x8c8487dc, 0x621825, 0x331c2,
-0x3c030002, 0x2463870c, 0x30828000, 0x21202,
-0x30840001, 0x42200, 0x441025, 0x239c2,
-0x61080, 0x431021, 0x471021, 0x90430000,
-0x24020001, 0x10620027, 0x0, 0x10600007,
-0x24020002, 0x10620014, 0x24020003, 0x1062002f,
-0x3c05000f, 0x1000003b, 0x0, 0x8f820200,
-0x2403feff, 0x431024, 0xaf820200, 0x8f820220,
-0x3c03fffe, 0x3463ffff, 0x431024, 0xaf820220,
-0x3c010002, 0xac20a8c4, 0x3c010002, 0xac20a8cc,
-0x10000037, 0x0, 0x8f820200, 0x34420100,
-0xaf820200, 0x8f820220, 0x3c03fffe, 0x3463ffff,
-0x431024, 0xaf820220, 0x24020100, 0x3c010002,
-0xac22a8c4, 0x3c010002, 0xac20a8cc, 0x10000028,
-0x0, 0x8f820200, 0x2403feff, 0x431024,
-0xaf820200, 0x8f820220, 0x3c030001, 0x431025,
-0xaf820220, 0x3c010002, 0xac20a8c4, 0x3c010002,
-0xac23a8cc, 0x1000001a, 0x0, 0x8f820200,
-0x34420100, 0xaf820200, 0x8f820220, 0x3c030001,
-0x431025, 0xaf820220, 0x24020100, 0x3c010002,
-0xac22a8c4, 0x3c010002, 0xac23a8cc, 0x1000000c,
-0x0, 0x34a5ffff, 0x3c040002, 0x24848370,
-0xafa30010, 0xc002d3b, 0xafa00014, 0x10000004,
-0x0, 0x24020030, 0x3c010002, 0xac22a8a8,
-0x8fbf0018, 0x3e00008, 0x27bd0020, 0x27bdffc8,
-0xafb20028, 0x809021, 0xafb3002c, 0xa09821,
-0xafb00020, 0xc08021, 0x3c040002, 0x24848398,
-0x3c050009, 0x3c020002, 0x8c42866c, 0x34a59001,
-0x2403021, 0x2603821, 0xafbf0030, 0xafb10024,
-0xa7a0001a, 0xafb00014, 0xc002d3b, 0xafa20010,
-0x24020002, 0x12620086, 0x2e620003, 0x10400005,
-0x24020001, 0x1262000a, 0x0, 0x1000017b,
-0x0, 0x24020004, 0x126200fc, 0x24020008,
-0x126200fb, 0x3c02ffec, 0x10000174, 0x0,
-0x3c020002, 0x8c428668, 0x30420002, 0x14400004,
-0x128940, 0x3c02fffb, 0x3442ffff, 0x2028024,
-0x3c010002, 0x310821, 0xac30a8bc, 0x3c024000,
-0x2021024, 0x10400050, 0x1023c2, 0x30840030,
-0x101382, 0x3042001c, 0x3c030002, 0x246386a4,
-0x431021, 0x823821, 0x3c020020, 0x2021024,
-0x10400006, 0x24020100, 0x3c010002, 0x310821,
-0xac22a8c0, 0x10000005, 0x3c020080, 0x3c010002,
-0x310821, 0xac20a8c0, 0x3c020080, 0x2021024,
-0x10400007, 0x121940, 0x3c020001, 0x3c010002,
-0x230821, 0xac22a8c8, 0x10000005, 0x0,
-0x121140, 0x3c010002, 0x220821, 0xac20a8c8,
-0x94e40000, 0x3c030002, 0x8c6387fc, 0x24020005,
-0x10620010, 0xa7a40018, 0x32024000, 0x10400002,
-0x34824000, 0xa7a20018, 0x24040001, 0x94e20002,
-0x24050004, 0x24e60002, 0x34420001, 0xc004bdc,
-0xa4e20002, 0x24040001, 0x2821, 0xc004bdc,
-0x27a60018, 0x3c020002, 0x8c42866c, 0x24110001,
-0x3c010002, 0xac318678, 0x14530004, 0x32028000,
-0xc00430b, 0x0, 0x32028000, 0x10400123,
-0x0, 0xc00430b, 0x0, 0x3c030002,
-0x8c6387fc, 0x24020005, 0x1062011c, 0x24020002,
-0x3c010002, 0xac318670, 0x3c010002, 0xac22866c,
-0x10000116, 0x0, 0x24040001, 0x24050004,
-0x27b0001a, 0xc004bdc, 0x2003021, 0x24040001,
-0x2821, 0xc004bdc, 0x2003021, 0x3c020002,
-0x511021, 0x8c42a8b4, 0x3c040002, 0x8c84866c,
-0x3c03bfff, 0x3463ffff, 0x3c010002, 0xac338678,
-0x431024, 0x3c010002, 0x310821, 0xac22a8b4,
-0x109300fc, 0x0, 0x100000fc, 0x0,
-0x3c022000, 0x2021024, 0x10400005, 0x24020001,
-0x3c010002, 0xac2287d8, 0x10000004, 0x128940,
-0x3c010002, 0xac2087d8, 0x128940, 0x3c010002,
-0x310821, 0xac30a8b8, 0x3c024000, 0x2021024,
-0x14400015, 0x0, 0x3c020002, 0x8c4287d8,
-0x10400006, 0x24040004, 0x24050001, 0xc005400,
-0x24062000, 0x24020001, 0xaee204b8, 0x3c020002,
-0x511021, 0x8c42a8b0, 0x3c03bfff, 0x3463ffff,
-0x431024, 0x3c010002, 0x310821, 0xac22a8b0,
-0x100000d4, 0x0, 0x3c020002, 0x8c4287d8,
-0x10400028, 0x3c0300a0, 0x2031024, 0x5443000d,
-0x3c020020, 0x3c020002, 0x8c4287dc, 0x24030100,
-0x3c010002, 0x310821, 0xac23a8c4, 0x3c030001,
-0x3c010002, 0x310821, 0xac23a8cc, 0x10000015,
-0x34420400, 0x2021024, 0x10400008, 0x24030100,
-0x3c020002, 0x8c4287dc, 0x3c010002, 0x310821,
-0xac23a8c4, 0x1000000b, 0x34420800, 0x3c020080,
-0x2021024, 0x1040002e, 0x3c030001, 0x3c020002,
-0x8c4287dc, 0x3c010002, 0x310821, 0xac23a8cc,
-0x34420c00, 0x3c010002, 0xac2287dc, 0x10000025,
-0x24040001, 0x3c020020, 0x2021024, 0x10400006,
-0x24020100, 0x3c010002, 0x310821, 0xac22a8c4,
-0x10000005, 0x3c020080, 0x3c010002, 0x310821,
-0xac20a8c4, 0x3c020080, 0x2021024, 0x10400007,
-0x121940, 0x3c020001, 0x3c010002, 0x230821,
-0xac22a8cc, 0x10000006, 0x24040001, 0x121140,
-0x3c010002, 0x220821, 0xac20a8cc, 0x24040001,
-0x2821, 0x27b0001e, 0xc004b9a, 0x2003021,
-0x24040001, 0x2821, 0xc004b9a, 0x2003021,
-0x24040001, 0x24050001, 0x27b0001c, 0xc004b9a,
-0x2003021, 0x24040001, 0x24050001, 0xc004b9a,
-0x2003021, 0x1000007b, 0x0, 0x3c02ffec,
-0x3442ffff, 0x2028024, 0x3c020008, 0x2028025,
-0x121140, 0x3c010002, 0x220821, 0xac30a8b8,
-0x3c022000, 0x2021024, 0x10400009, 0x0,
-0x3c020002, 0x8c428708, 0x14400005, 0x24020001,
-0x3c010002, 0xac2287d8, 0x10000004, 0x3c024000,
-0x3c010002, 0xac2087d8, 0x3c024000, 0x2021024,
-0x1440001d, 0x24020e01, 0x3c030002, 0x8c6387d8,
-0xaf820238, 0x3c010002, 0xac208684, 0x10600005,
-0x24022020, 0x3c010002, 0xac2287dc, 0x24020001,
-0xaee204b8, 0x3c04bfff, 0x121940, 0x3c020002,
-0x431021, 0x8c42a8b0, 0x3c050002, 0x8ca5866c,
-0x3484ffff, 0x441024, 0x3c010002, 0x230821,
-0xac22a8b0, 0x24020001, 0x10a20048, 0x0,
-0x10000044, 0x0, 0x3c020002, 0x8c4287d8,
-0x1040001f, 0x24022000, 0x3c010002, 0xac2287dc,
-0x3c0300a0, 0x2031024, 0x14430006, 0x121140,
-0x3402a000, 0x3c010002, 0xac2287dc, 0x10000030,
-0x0, 0x3c030002, 0x621821, 0x8c63a8b8,
-0x3c020020, 0x621024, 0x10400005, 0x24022001,
-0x3c010002, 0xac2287dc, 0x10000025, 0x0,
-0x3c020080, 0x621024, 0x10400021, 0x3402a001,
-0x3c010002, 0xac2287dc, 0x1000001d, 0x0,
-0x3c020020, 0x2021024, 0x10400007, 0x121940,
-0x24020100, 0x3c010002, 0x230821, 0xac22a8c4,
-0x10000006, 0x3c020080, 0x121140, 0x3c010002,
-0x220821, 0xac20a8c4, 0x3c020080, 0x2021024,
-0x10400007, 0x121940, 0x3c020001, 0x3c010002,
-0x230821, 0xac22a8cc, 0x10000005, 0x0,
-0x121140, 0x3c010002, 0x220821, 0xac20a8cc,
-0x3c030002, 0x8c63866c, 0x24020001, 0x10620003,
-0x0, 0xc00430b, 0x0, 0x8fbf0030,
-0x8fb3002c, 0x8fb20028, 0x8fb10024, 0x8fb00020,
-0x3e00008, 0x27bd0038, 0x27bdffb0, 0xafb3003c,
-0x9821, 0xafb50040, 0xa821, 0xafb10034,
-0x8821, 0x24020002, 0xafbf0048, 0xafbe0044,
-0xafb20038, 0xafb00030, 0xafa4002c, 0xa7a0001a,
-0xa7a00018, 0xa7a00020, 0xa7a0001e, 0xa7a00022,
-0x10a20131, 0xa7a0001c, 0x2ca20003, 0x10400005,
-0x24020001, 0x10a2000a, 0x3c024000, 0x1000025f,
-0x2201021, 0x24020004, 0x10a2020c, 0x24020008,
-0x10a2020a, 0x2201021, 0x10000258, 0x0,
-0x8fa8002c, 0x88140, 0x3c030002, 0x701821,
-0x8c63a8bc, 0x621024, 0x14400009, 0x24040001,
-0x3c027fff, 0x3442ffff, 0x628824, 0x3c010002,
-0x300821, 0xac31a8b4, 0x10000248, 0x2201021,
-0x24050001, 0xc004b9a, 0x27a60018, 0x24040001,
-0x24050001, 0xc004b9a, 0x27a60018, 0x97a20018,
-0x30420004, 0x104000da, 0x3c114000, 0x3c020002,
-0x8c4287fc, 0x2443ffff, 0x2c620006, 0x104000da,
-0x31080, 0x3c010002, 0x220821, 0x8c2283b0,
-0x400008, 0x0, 0x24040001, 0x24050011,
-0x27b0001a, 0xc004b9a, 0x2003021, 0x24040001,
-0x24050011, 0xc004b9a, 0x2003021, 0x97a3001a,
-0x30624000, 0x10400002, 0x3c150010, 0x3c150008,
-0x30628000, 0x104000ab, 0x3c130001, 0x100000a9,
-0x3c130002, 0x24040001, 0x24050014, 0x27b0001a,
-0xc004b9a, 0x2003021, 0x24040001, 0x24050014,
-0xc004b9a, 0x2003021, 0x97a3001a, 0x30621000,
-0x10400002, 0x3c150010, 0x3c150008, 0x30620800,
-0x10400098, 0x3c130001, 0x10000096, 0x3c130002,
-0x24040001, 0x24050019, 0x27b0001c, 0xc004b9a,
-0x2003021, 0x24040001, 0x24050019, 0xc004b9a,
-0x2003021, 0x97a2001c, 0x30430700, 0x24020400,
-0x10620027, 0x28620401, 0x1040000e, 0x24020200,
-0x1062001f, 0x28620201, 0x10400005, 0x24020100,
-0x5062001e, 0x3c130001, 0x1000001e, 0x24040001,
-0x24020300, 0x50620019, 0x3c130002, 0x10000019,
-0x24040001, 0x24020600, 0x1062000d, 0x28620601,
-0x10400005, 0x24020500, 0x5062000b, 0x3c130002,
-0x10000010, 0x24040001, 0x24020700, 0x1462000d,
-0x24040001, 0x3c130004, 0x1000000a, 0x3c150008,
-0x10000006, 0x3c130004, 0x10000005, 0x3c150008,
-0x3c130001, 0x10000002, 0x3c150008, 0x3c150010,
-0x24040001, 0x24050018, 0x27b0001e, 0xc004b9a,
-0x2003021, 0x24040001, 0x24050018, 0xc004b9a,
-0x2003021, 0x8fa8002c, 0x97a7001e, 0x81140,
-0x3c060002, 0xc23021, 0x8cc6a8b4, 0x97a20022,
-0x3c100002, 0x261083a4, 0x2002021, 0xafa20010,
-0x97a2001c, 0x3c05000c, 0x34a50303, 0xc002d3b,
-0xafa20014, 0x3c020004, 0x16620010, 0x3c020001,
-0x8f840054, 0x24030001, 0x24020002, 0x3c010002,
-0xac238670, 0x3c010002, 0xac22866c, 0x3c010002,
-0xac238678, 0x3c010002, 0xac2386f0, 0x3c010002,
-0xac2487ec, 0x10000050, 0x2b38825, 0x1662003a,
-0x3c028000, 0x3c020002, 0x8c4286ec, 0x1440001f,
-0x24040018, 0x2021, 0x2821, 0xc005400,
-0x34068000, 0x8f830054, 0x8f820054, 0x2b38825,
-0x10000002, 0x24630032, 0x8f820054, 0x621023,
-0x2c420033, 0x1440fffc, 0x0, 0x8f830054,
-0x24020001, 0x3c010002, 0xac2286ec, 0x3c010002,
-0xac228670, 0x3c010002, 0xac22866c, 0x3c010002,
-0xac228678, 0x3c010002, 0xac2286f0, 0x3c010002,
-0xac2387ec, 0x1000002c, 0x0, 0x2821,
-0xc005400, 0x24060404, 0x2021, 0x2405001e,
-0x27a60018, 0x24020002, 0xc004bdc, 0xa7a20018,
-0x2021, 0x2821, 0x27a60018, 0xc004bdc,
-0xa7a00018, 0x24040018, 0x24050002, 0xc005400,
-0x24060004, 0x3c028000, 0x2221025, 0x2b31825,
-0x10000015, 0x438825, 0x2221025, 0x2751825,
-0x438825, 0x2002021, 0x97a6001c, 0x3c070002,
-0x8ce7866c, 0x3c05000c, 0x34a50326, 0xafb30010,
-0xc002d3b, 0xafb10014, 0x10000007, 0x0,
-0x3c110002, 0x2308821, 0x8e31a8bc, 0x3c027fff,
-0x3442ffff, 0x2228824, 0x3c020002, 0x8c42867c,
-0x1040001e, 0x0, 0x3c020002, 0x8c4287d8,
-0x10400002, 0x3c022000, 0x2228825, 0x8fa8002c,
-0x81140, 0x3c010002, 0x220821, 0x8c22a8c0,
-0x10400003, 0x3c020020, 0x10000005, 0x2228825,
-0x3c02ffdf, 0x3442ffff, 0x2228824, 0x8fa8002c,
-0x81140, 0x3c010002, 0x220821, 0x8c22a8c8,
-0x10400003, 0x3c020080, 0x10000004, 0x2228825,
-0x3c02ff7f, 0x3442ffff, 0x2228824, 0x8fa8002c,
-0x81140, 0x3c010002, 0x220821, 0xac31a8b4,
-0x10000136, 0x2201021, 0x8fa8002c, 0x8f140,
-0x3c030002, 0x7e1821, 0x8c63a8b8, 0x3c024000,
-0x621024, 0x14400009, 0x24040001, 0x3c027fff,
-0x3442ffff, 0x628824, 0x3c010002, 0x3e0821,
-0xac31a8b0, 0x10000125, 0x2201021, 0x2821,
-0xc004b9a, 0x27a60018, 0x24040001, 0x2821,
-0xc004b9a, 0x27a60018, 0x24040001, 0x24050001,
-0x27b20020, 0xc004b9a, 0x2403021, 0x24040001,
-0x24050001, 0xc004b9a, 0x2403021, 0x24040001,
-0x24050004, 0x27b1001e, 0xc004b9a, 0x2203021,
-0x24040001, 0x24050004, 0xc004b9a, 0x2203021,
-0x24040001, 0x24050005, 0x27b00022, 0xc004b9a,
-0x2003021, 0x24040001, 0x24050005, 0xc004b9a,
-0x2003021, 0x24040001, 0x24050010, 0xc004b9a,
-0x27a60018, 0x24040001, 0x24050010, 0xc004b9a,
-0x27a60018, 0x24040001, 0x2405000a, 0xc004b9a,
-0x2403021, 0x24040001, 0x2405000a, 0xc004b9a,
-0x2403021, 0x24040001, 0x24050018, 0xc004b9a,
-0x2203021, 0x24040001, 0x24050018, 0xc004b9a,
-0x2203021, 0x24040001, 0x24050001, 0xc004b9a,
-0x27a60018, 0x24040001, 0x24050001, 0xc004b9a,
-0x27a60018, 0x97a20018, 0x30420004, 0x10400067,
-0x3c114000, 0x3c030002, 0x8c6387f0, 0x24020005,
-0x14620068, 0x24040001, 0x24050019, 0x27b0001c,
-0xc004b9a, 0x2003021, 0x24040001, 0x24050019,
-0xc004b9a, 0x2003021, 0x97a2001c, 0x30430700,
-0x24020400, 0x10620027, 0x28620401, 0x1040000e,
-0x24020200, 0x1062001f, 0x28620201, 0x10400005,
-0x24020100, 0x5062001e, 0x3c130001, 0x1000001e,
-0x3c020004, 0x24020300, 0x50620019, 0x3c130002,
-0x10000019, 0x3c020004, 0x24020600, 0x1062000d,
-0x28620601, 0x10400005, 0x24020500, 0x5062000b,
-0x3c130002, 0x10000010, 0x3c020004, 0x24020700,
-0x1462000d, 0x3c020004, 0x3c130004, 0x1000000a,
-0x3c150008, 0x10000006, 0x3c130004, 0x10000005,
-0x3c150008, 0x3c130001, 0x10000002, 0x3c150008,
-0x3c150010, 0x3c020004, 0x12620018, 0x3c028000,
-0x8f820054, 0x24100001, 0x3c010002, 0xac308670,
-0x3c010002, 0xac30866c, 0x3c010002, 0xac308678,
-0x3c010002, 0xac3086f0, 0x3c010002, 0xac2287ec,
-0x3c020001, 0x16620023, 0x2758825, 0x2021,
-0x2821, 0xc005400, 0x34068000, 0x3c010002,
-0xac3086ec, 0x1000001b, 0x0, 0x2221025,
-0x2b31825, 0x438825, 0x97a6001c, 0x3c020002,
-0x8c4287d8, 0x3c070002, 0x8ce7866c, 0x3c040002,
-0x248483a4, 0xafa20010, 0x97a2001e, 0x3c05000c,
-0x34a50323, 0x3c010002, 0xac2086ec, 0xc002d3b,
-0xafa20014, 0x10000007, 0x0, 0x3c110002,
-0x23e8821, 0x8e31a8b0, 0x3c027fff, 0x3442ffff,
-0x2228824, 0x3c020002, 0x8c42867c, 0x10400069,
-0x0, 0x3c020002, 0x8c4287d8, 0x10400002,
-0x3c022000, 0x2228825, 0x8fa8002c, 0x81140,
-0x3c010002, 0x220821, 0x8c22a8c4, 0x10400003,
-0x3c020020, 0x10000005, 0x2228825, 0x3c02ffdf,
-0x3442ffff, 0x2228824, 0x8fa8002c, 0x81140,
-0x3c010002, 0x220821, 0x8c22a8cc, 0x10400003,
-0x3c020080, 0x1000004f, 0x2228825, 0x3c02ff7f,
-0x3442ffff, 0x1000004b, 0x2228824, 0x8fa8002c,
-0x82940, 0x3c030002, 0x651821, 0x8c63a8b8,
-0x3c024000, 0x621024, 0x14400008, 0x3c027fff,
-0x3442ffff, 0x628824, 0x3c010002, 0x250821,
-0xac31a8b0, 0x10000041, 0x2201021, 0x3c020002,
-0x8c42867c, 0x10400034, 0x3c11c00c, 0x3c020002,
-0x8c428708, 0x3c04c00c, 0x34842000, 0x3c030002,
-0x8c6387d8, 0x2102b, 0x21023, 0x441024,
-0x10600003, 0x518825, 0x3c022000, 0x2228825,
-0x3c020002, 0x451021, 0x8c42a8c4, 0x10400003,
-0x3c020020, 0x10000004, 0x2228825, 0x3c02ffdf,
-0x3442ffff, 0x2228824, 0x8fa8002c, 0x81140,
-0x3c010002, 0x220821, 0x8c22a8cc, 0x10400003,
-0x3c020080, 0x10000004, 0x2228825, 0x3c02ff7f,
-0x3442ffff, 0x2228824, 0x3c020002, 0x8c4286f4,
-0x10400002, 0x3c020800, 0x2228825, 0x3c020002,
-0x8c4286f8, 0x10400002, 0x3c020400, 0x2228825,
-0x3c020002, 0x8c4286fc, 0x10400006, 0x3c020100,
-0x10000004, 0x2228825, 0x3c027fff, 0x3442ffff,
-0x628824, 0x8fa8002c, 0x81140, 0x3c010002,
-0x220821, 0xac31a8b0, 0x2201021, 0x8fbf0048,
-0x8fbe0044, 0x8fb50040, 0x8fb3003c, 0x8fb20038,
-0x8fb10034, 0x8fb00030, 0x3e00008, 0x27bd0050,
-0x27bdffd0, 0xafb20028, 0x809021, 0xafbf002c,
-0xafb10024, 0xafb00020, 0x8f840200, 0x3c100002,
-0x8e10866c, 0x8f860220, 0x24020002, 0x1202005e,
-0x2e020003, 0x10400005, 0x24020001, 0x1202000a,
-0x121940, 0x10000114, 0x0, 0x24020004,
-0x120200c6, 0x24020008, 0x120200c5, 0x128940,
-0x1000010d, 0x0, 0x3c050002, 0xa32821,
-0x8ca5a8bc, 0x3c100002, 0x2038021, 0x8e10a8b4,
-0x3c024000, 0xa21024, 0x10400038, 0x3c020008,
-0x2021024, 0x10400020, 0x34840002, 0x3c020002,
-0x431021, 0x8c42a8c0, 0x10400005, 0x34840020,
-0x34840100, 0x3c020020, 0x10000006, 0x2028025,
-0x2402feff, 0x822024, 0x3c02ffdf, 0x3442ffff,
-0x2028024, 0x121140, 0x3c010002, 0x220821,
-0x8c22a8c8, 0x10400005, 0x3c020001, 0xc23025,
-0x3c020080, 0x10000016, 0x2028025, 0x3c02fffe,
-0x3442ffff, 0xc23024, 0x3c02ff7f, 0x3442ffff,
-0x1000000f, 0x2028024, 0x2402fedf, 0x822024,
-0x3c02fffe, 0x3442ffff, 0xc23024, 0x3c02ff5f,
-0x3442ffff, 0x2028024, 0x3c010002, 0x230821,
-0xac20a8c0, 0x3c010002, 0x230821, 0xac20a8c8,
-0xaf840200, 0xaf860220, 0x8f820220, 0x34420002,
-0xaf820220, 0x1000000b, 0x121140, 0x3c02bfff,
-0x3442ffff, 0x8f830200, 0x2028024, 0x2402fffd,
-0x621824, 0xaf830200, 0xc00430b, 0x0,
-0x121140, 0x3c010002, 0x220821, 0xac30a8b4,
-0x100000bd, 0x0, 0x3c020002, 0x8c4287d8,
-0x1040006e, 0x24050004, 0x24040001, 0xc004b9a,
-0x27a60018, 0x24040001, 0x24050005, 0xc004b9a,
-0x27a6001a, 0x97a30018, 0x97a2001a, 0x3c040002,
-0x2484870c, 0x30630c00, 0x31a82, 0x30420c00,
-0x21282, 0xa7a2001a, 0x21080, 0x441021,
-0x431021, 0xa7a30018, 0x90480000, 0x24020001,
-0x3103ffff, 0x1062002b, 0x28620002, 0x10400005,
-0x0, 0x10600009, 0x0, 0x10000041,
-0x0, 0x10700014, 0x24020003, 0x1062002f,
-0x0, 0x1000003b, 0x0, 0x8f820200,
-0x2403feff, 0x431024, 0xaf820200, 0x8f820220,
-0x3c03fffe, 0x3463ffff, 0x431024, 0xaf820220,
-0x3c010002, 0xac20a8c4, 0x3c010002, 0xac20a8cc,
-0x10000035, 0x0, 0x8f820200, 0x34420100,
-0xaf820200, 0x8f820220, 0x3c03fffe, 0x3463ffff,
-0x431024, 0xaf820220, 0x24020100, 0x3c010002,
-0xac22a8c4, 0x3c010002, 0xac20a8cc, 0x10000026,
-0x0, 0x8f820200, 0x2403feff, 0x431024,
-0xaf820200, 0x8f820220, 0x3c030001, 0x431025,
-0xaf820220, 0x3c010002, 0xac20a8c4, 0x3c010002,
-0xac23a8cc, 0x10000018, 0x0, 0x8f820200,
-0x34420100, 0xaf820200, 0x8f820220, 0x3c030001,
-0x431025, 0xaf820220, 0x24020100, 0x3c010002,
-0xac22a8c4, 0x3c010002, 0xac23a8cc, 0x1000000a,
-0x0, 0x3c040002, 0x248483c8, 0x97a6001a,
-0x97a70018, 0x3c050001, 0x34a5ffff, 0xafa80010,
-0xc002d3b, 0xafa00014, 0x8f820200, 0x34420002,
-0xaf820200, 0x1000004c, 0x0, 0x128940,
-0x3c050002, 0xb12821, 0x8ca5a8b8, 0x3c100002,
-0x2118021, 0x8e10a8b0, 0x3c024000, 0xa21024,
-0x14400011, 0x0, 0x3c020002, 0x8c4287d8,
-0x14400005, 0x3c02bfff, 0x8f820200, 0x34420002,
-0xaf820200, 0x3c02bfff, 0x3442ffff, 0xc00430b,
-0x2028024, 0x3c010002, 0x310821, 0xac30a8b0,
-0x10000031, 0x0, 0x3c020002, 0x8c4287d8,
-0x10400005, 0x3c020020, 0x3c020002, 0x8c428708,
-0x10400025, 0x3c020020, 0xa21024, 0x10400007,
-0x34840020, 0x24020100, 0x3c010002, 0x310821,
-0xac22a8c4, 0x10000006, 0x34840100, 0x3c010002,
-0x310821, 0xac20a8c4, 0x2402feff, 0x822024,
-0x3c020080, 0xa21024, 0x10400007, 0x121940,
-0x3c020001, 0x3c010002, 0x230821, 0xac22a8cc,
-0x10000008, 0xc23025, 0x121140, 0x3c010002,
-0x220821, 0xac20a8cc, 0x3c02fffe, 0x3442ffff,
-0xc23024, 0xaf840200, 0xaf860220, 0x8f820220,
-0x34420002, 0xaf820220, 0x121140, 0x3c010002,
-0x220821, 0xac30a8b0, 0x8fbf002c, 0x8fb20028,
-0x8fb10024, 0x8fb00020, 0x3e00008, 0x27bd0030,
-0x1821, 0x308400ff, 0x2405ffdf, 0x2406ffbf,
-0x641007, 0x30420001, 0x10400004, 0x0,
-0x8f820044, 0x10000003, 0x34420040, 0x8f820044,
-0x461024, 0xaf820044, 0x8f820044, 0x34420020,
-0xaf820044, 0x8f820044, 0x451024, 0xaf820044,
-0x24630001, 0x28620008, 0x5440ffee, 0x641007,
-0x3e00008, 0x0, 0x2c820008, 0x1040001b,
-0x0, 0x2405ffdf, 0x2406ffbf, 0x41880,
-0x3c020002, 0x2442871c, 0x621821, 0x24640004,
-0x90620000, 0x10400004, 0x0, 0x8f820044,
-0x10000003, 0x34420040, 0x8f820044, 0x461024,
-0xaf820044, 0x8f820044, 0x34420020, 0xaf820044,
-0x8f820044, 0x451024, 0xaf820044, 0x24630001,
-0x64102b, 0x1440ffee, 0x0, 0x3e00008,
-0x0, 0x0 };
-static u_int32_t tigon2FwRodata[] = {
-0x24486561,
-0x6465723a, 0x202f7072, 0x6f6a6563, 0x74732f72,
-0x63732f73, 0x772f6765, 0x2f2e2f6e, 0x69632f66,
-0x77322f63, 0x6f6d6d6f, 0x6e2f6677, 0x6d61696e,
-0x2e632c76, 0x20312e31, 0x2e322e34, 0x35203139,
-0x39392f30, 0x312f3234, 0x2030303a, 0x31303a35,
-0x35207368, 0x75616e67, 0x20457870, 0x20240000,
-0x65767452, 0x6e674600, 0x51657674, 0x46000000,
-0x51657674, 0x505f4600, 0x4d657674, 0x526e6746,
-0x0, 0x4d516576, 0x74460000, 0x4d516576,
-0x505f4600, 0x5173436f, 0x6e495f46, 0x0,
-0x5173436f, 0x6e734600, 0x51725072, 0x6f644600,
-0x6261644d, 0x656d537a, 0x0, 0x2a50414e,
-0x49432a00, 0x66776d61, 0x696e2e63, 0x0,
-0x68775665, 0x72000000, 0x62616448, 0x77566572,
-0x0, 0x2a2a4441, 0x574e5f41, 0x0,
-0x74785278, 0x4266537a, 0x0, 0x62664174,
-0x6e4d726b, 0x0, 0x7265645a, 0x6f6e6531,
-0x0, 0x70636943, 0x6f6e6600, 0x67656e43,
-0x6f6e6600, 0x2a646d61, 0x5244666c, 0x0,
-0x72636246, 0x6c616773, 0x0, 0x62616452,
-0x78526362, 0x0, 0x676c6f62, 0x466c6773,
-0x0, 0x2b5f6469, 0x73705f6c, 0x6f6f7000,
-0x2b65765f, 0x68616e64, 0x6c657200, 0x63616e74,
-0x31446d61, 0x0, 0x2b715f64, 0x6d615f74,
-0x6f5f6e69, 0x635f636b, 0x73756d00, 0x2b685f73,
-0x656e645f, 0x64617461, 0x5f726561, 0x64795f63,
-0x6b73756d, 0x0, 0x2b685f64, 0x6d615f72,
-0x645f6173, 0x73697374, 0x5f636b73, 0x756d0000,
-0x74436b73, 0x6d4f6e00, 0x2b715f64, 0x6d615f74,
-0x6f5f6e69, 0x63000000, 0x2b685f73, 0x656e645f,
-0x64617461, 0x5f726561, 0x64790000, 0x2b685f64,
-0x6d615f72, 0x645f6173, 0x73697374, 0x0,
-0x74436b73, 0x6d4f6666, 0x0, 0x2b685f73,
-0x656e645f, 0x62645f72, 0x65616479, 0x0,
-0x68737453, 0x52696e67, 0x0, 0x62616453,
-0x52696e67, 0x0, 0x6e696353, 0x52696e67,
-0x0, 0x77446d61, 0x416c6c41, 0x0,
-0x2b715f64, 0x6d615f74, 0x6f5f686f, 0x73745f63,
-0x6b73756d, 0x0, 0x2b685f6d, 0x61635f72,
-0x785f636f, 0x6d705f63, 0x6b73756d, 0x0,
-0x2b685f64, 0x6d615f77, 0x725f6173, 0x73697374,
-0x5f636b73, 0x756d0000, 0x72436b73, 0x6d4f6e00,
-0x2b715f64, 0x6d615f74, 0x6f5f686f, 0x73740000,
-0x2b685f6d, 0x61635f72, 0x785f636f, 0x6d700000,
-0x2b685f64, 0x6d615f77, 0x725f6173, 0x73697374,
-0x0, 0x72436b73, 0x6d4f6666, 0x0,
-0x2b685f72, 0x6563765f, 0x62645f72, 0x65616479,
-0x0, 0x2b685f72, 0x6563765f, 0x6a756d62,
-0x6f5f6264, 0x5f726561, 0x64790000, 0x2b685f72,
-0x6563765f, 0x6d696e69, 0x5f62645f, 0x72656164,
-0x79000000, 0x2b6d685f, 0x636f6d6d, 0x616e6400,
-0x2b685f74, 0x696d6572, 0x0, 0x2b685f64,
-0x6f5f7570, 0x64617465, 0x5f74785f, 0x636f6e73,
-0x0, 0x2b685f64, 0x6f5f7570, 0x64617465,
-0x5f72785f, 0x70726f64, 0x0, 0x2b636b73,
-0x756d3136, 0x0, 0x2b706565, 0x6b5f6d61,
-0x635f7278, 0x5f776100, 0x2b706565, 0x6b5f6d61,
-0x635f7278, 0x0, 0x2b646571, 0x5f6d6163,
-0x5f727800, 0x2b685f6d, 0x61635f72, 0x785f6174,
-0x746e0000, 0x62616452, 0x6574537a, 0x0,
-0x72784264, 0x4266537a, 0x0, 0x2b6e756c,
-0x6c5f6861, 0x6e646c65, 0x72000000, 0x66774f70,
-0x4661696c, 0x0, 0x2b685f75, 0x70646174,
-0x655f6c65, 0x64340000, 0x2b685f75, 0x70646174,
-0x655f6c65, 0x64360000, 0x2b685f75, 0x70646174,
-0x655f6c65, 0x64320000, 0x696e7453, 0x74617465,
-0x0, 0x2a2a696e, 0x69744370, 0x0,
-0x23736372, 0x65616d00, 0x69537461, 0x636b4572,
-0x0, 0x70726f62, 0x654d656d, 0x0,
-0x2a2a4441, 0x574e5f42, 0x0, 0x2b73775f,
-0x646d615f, 0x61737369, 0x73745f70, 0x6c75735f,
-0x74696d65, 0x72000000, 0x2b267072, 0x656c6f61,
-0x645f7772, 0x5f646573, 0x63720000, 0x2b267072,
-0x656c6f61, 0x645f7264, 0x5f646573, 0x63720000,
-0x2b685f68, 0x665f7469, 0x6d657200, 0x24486561,
-0x6465723a, 0x202f7072, 0x6f6a6563, 0x74732f72,
-0x63732f73, 0x772f6765, 0x2f2e2f6e, 0x69632f66,
-0x77322f63, 0x6f6d6d6f, 0x6e2f7469, 0x6d65722e,
-0x632c7620, 0x312e312e, 0x322e3335, 0x20313939,
-0x392f3031, 0x2f323720, 0x31393a30, 0x393a3530,
-0x20686179, 0x65732045, 0x78702024, 0x0,
-0x65767452, 0x6e674600, 0x51657674, 0x46000000,
-0x51657674, 0x505f4600, 0x4d657674, 0x526e6746,
-0x0, 0x4d516576, 0x74460000, 0x4d516576,
-0x505f4600, 0x5173436f, 0x6e495f46, 0x0,
-0x5173436f, 0x6e734600, 0x51725072, 0x6f644600,
-0x2a50414e, 0x49432a00, 0x6d61632e, 0x68000000,
-0x74696d65, 0x722e6300, 0x542d446d, 0x61526432,
-0x0, 0x542d446d, 0x61526431, 0x0,
-0x542d446d, 0x61526442, 0x0, 0x542d446d,
-0x61577232, 0x0, 0x542d446d, 0x61577231,
-0x0, 0x542d446d, 0x61577242, 0x0,
-0x0, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x77322f63, 0x6f6d6d6f,
-0x6e2f636f, 0x6d6d616e, 0x642e632c, 0x7620312e,
-0x312e322e, 0x32382031, 0x3939392f, 0x30312f32,
-0x30203139, 0x3a34393a, 0x34392073, 0x6875616e,
-0x67204578, 0x70202400, 0x65767452, 0x6e674600,
-0x51657674, 0x46000000, 0x51657674, 0x505f4600,
-0x4d657674, 0x526e6746, 0x0, 0x4d516576,
-0x74460000, 0x4d516576, 0x505f4600, 0x5173436f,
-0x6e495f46, 0x0, 0x5173436f, 0x6e734600,
-0x51725072, 0x6f644600, 0x3f48636d, 0x644d6278,
-0x0, 0x3f636d64, 0x48737453, 0x0,
-0x3f636d64, 0x4d634d64, 0x0, 0x3f636d64,
-0x50726f6d, 0x0, 0x3f636d64, 0x4c696e6b,
-0x0, 0x3f636d64, 0x45727200, 0x8b08,
-0x92e4, 0x92e4, 0x9264, 0x8ff4,
-0x92b8, 0x92e4, 0x8bf4, 0x8c64,
-0x8df8, 0x8ee0, 0x8ea8, 0x92e4,
-0x8cd4, 0x8fa0, 0x92e4, 0x8fb0,
-0x8c18, 0x8c88, 0x24486561, 0x6465723a,
-0x202f7072, 0x6f6a6563, 0x74732f72, 0x63732f73,
-0x772f6765, 0x2f2e2f6e, 0x69632f66, 0x77322f63,
-0x6f6d6d6f, 0x6e2f6d63, 0x6173742e, 0x632c7620,
-0x312e312e, 0x322e3820, 0x31393938, 0x2f31322f,
-0x30382030, 0x323a3336, 0x3a333620, 0x73687561,
-0x6e672045, 0x78702024, 0x0, 0x65767452,
-0x6e674600, 0x51657674, 0x46000000, 0x51657674,
-0x505f4600, 0x4d657674, 0x526e6746, 0x0,
-0x4d516576, 0x74460000, 0x4d516576, 0x505f4600,
-0x5173436f, 0x6e495f46, 0x0, 0x5173436f,
-0x6e734600, 0x51725072, 0x6f644600, 0x6164644d,
-0x63447570, 0x0, 0x6164644d, 0x6346756c,
-0x0, 0x64656c4d, 0x634e6f45, 0x0,
-0x24486561, 0x6465723a, 0x202f7072, 0x6f6a6563,
-0x74732f72, 0x63732f73, 0x772f6765, 0x2f2e2f6e,
-0x69632f66, 0x77322f63, 0x6f6d6d6f, 0x6e2f646d,
-0x612e632c, 0x7620312e, 0x312e322e, 0x32342031,
-0x3939382f, 0x31322f32, 0x31203030, 0x3a33333a,
-0x30392073, 0x6875616e, 0x67204578, 0x70202400,
-0x65767452, 0x6e674600, 0x51657674, 0x46000000,
-0x51657674, 0x505f4600, 0x4d657674, 0x526e6746,
-0x0, 0x4d516576, 0x74460000, 0x4d516576,
-0x505f4600, 0x5173436f, 0x6e495f46, 0x0,
-0x5173436f, 0x6e734600, 0x51725072, 0x6f644600,
-0x7377446d, 0x614f6666, 0x0, 0x31446d61,
-0x4f6e0000, 0x7377446d, 0x614f6e00, 0x2a50414e,
-0x49432a00, 0x646d612e, 0x63000000, 0x2372446d,
-0x6141544e, 0x0, 0x72446d61, 0x41544e30,
-0x0, 0x72446d61, 0x41544e31, 0x0,
-0x72446d61, 0x34476200, 0x2377446d, 0x6141544e,
-0x0, 0x77446d61, 0x41544e30, 0x0,
-0x77446d61, 0x41544e31, 0x0, 0x77446d61,
-0x34476200, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x77322f63, 0x6f6d6d6f,
-0x6e2f7472, 0x6163652e, 0x632c7620, 0x312e312e,
-0x322e3520, 0x31393938, 0x2f30392f, 0x33302031,
-0x383a3530, 0x3a323820, 0x73687561, 0x6e672045,
-0x78702024, 0x0, 0x24486561, 0x6465723a,
-0x202f7072, 0x6f6a6563, 0x74732f72, 0x63732f73,
-0x772f6765, 0x2f2e2f6e, 0x69632f66, 0x77322f63,
-0x6f6d6d6f, 0x6e2f6461, 0x74612e63, 0x2c762031,
-0x2e312e32, 0x2e313220, 0x31393939, 0x2f30312f,
-0x32302031, 0x393a3439, 0x3a353120, 0x73687561,
-0x6e672045, 0x78702024, 0x0, 0x46575f56,
-0x45525349, 0x4f4e3a20, 0x58585800, 0x46575f43,
-0x4f4d5049, 0x4c455f54, 0x494d453a, 0x20585858,
-0x0, 0x46575f43, 0x4f4d5049, 0x4c455f42,
-0x593a2058, 0x58580000, 0x46575f43, 0x4f4d5049,
-0x4c455f48, 0x4f53543a, 0x20585858, 0x0,
-0x46575f43, 0x4f4d5049, 0x4c455f44, 0x4f4d4149,
-0x4e3a2058, 0x58580000, 0x46575f43, 0x4f4d5049,
-0x4c45523a, 0x20585858, 0x0, 0x0,
-0x12041100, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x77322f63, 0x6f6d6d6f,
-0x6e2f6d65, 0x6d2e632c, 0x7620312e, 0x312e322e,
-0x35203139, 0x39382f30, 0x392f3330, 0x2031383a,
-0x35303a30, 0x38207368, 0x75616e67, 0x20457870,
-0x20240000, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x77322f63, 0x6f6d6d6f,
-0x6e2f7365, 0x6e642e63, 0x2c762031, 0x2e312e32,
-0x2e343420, 0x31393938, 0x2f31322f, 0x32312030,
-0x303a3333, 0x3a313820, 0x73687561, 0x6e672045,
-0x78702024, 0x0, 0x65767452, 0x6e674600,
-0x51657674, 0x46000000, 0x51657674, 0x505f4600,
-0x4d657674, 0x526e6746, 0x0, 0x4d516576,
-0x74460000, 0x4d516576, 0x505f4600, 0x5173436f,
-0x6e495f46, 0x0, 0x5173436f, 0x6e734600,
-0x51725072, 0x6f644600, 0x2a50414e, 0x49432a00,
-0x6d61632e, 0x68000000, 0x73656e64, 0x2e630000,
-0x69736e74, 0x54637055, 0x0, 0x24486561,
-0x6465723a, 0x202f7072, 0x6f6a6563, 0x74732f72,
-0x63732f73, 0x772f6765, 0x2f2e2f6e, 0x69632f66,
-0x77322f63, 0x6f6d6d6f, 0x6e2f7265, 0x63762e63,
-0x2c762031, 0x2e312e32, 0x2e353320, 0x31393939,
-0x2f30312f, 0x31362030, 0x323a3535, 0x3a343320,
-0x73687561, 0x6e672045, 0x78702024, 0x0,
-0x65767452, 0x6e674600, 0x51657674, 0x46000000,
-0x51657674, 0x505f4600, 0x4d657674, 0x526e6746,
-0x0, 0x4d516576, 0x74460000, 0x4d516576,
-0x505f4600, 0x5173436f, 0x6e495f46, 0x0,
-0x5173436f, 0x6e734600, 0x51725072, 0x6f644600,
-0x2a50414e, 0x49432a00, 0x6d61632e, 0x68000000,
-0x724d6163, 0x43686b30, 0x0, 0x72784672,
-0x6d324c67, 0x0, 0x72784e6f, 0x53744264,
-0x0, 0x72784e6f, 0x4d694264, 0x0,
-0x72784e6f, 0x4a6d4264, 0x0, 0x72656376,
-0x2e630000, 0x7278436b, 0x446d6146, 0x0,
-0x72785144, 0x6d457846, 0x0, 0x72785144,
-0x6d614600, 0x72785144, 0x4c426446, 0x0,
-0x72785144, 0x6d426446, 0x0, 0x72784372,
-0x63506164, 0x0, 0x72536d51, 0x446d6146,
-0x0, 0x24486561, 0x6465723a, 0x202f7072,
-0x6f6a6563, 0x74732f72, 0x63732f73, 0x772f6765,
-0x2f2e2f6e, 0x69632f66, 0x77322f63, 0x6f6d6d6f,
-0x6e2f6d61, 0x632e632c, 0x7620312e, 0x312e322e,
-0x32322031, 0x3939382f, 0x31322f30, 0x38203032,
-0x3a33363a, 0x33302073, 0x6875616e, 0x67204578,
-0x70202400, 0x65767452, 0x6e674600, 0x51657674,
-0x46000000, 0x51657674, 0x505f4600, 0x4d657674,
-0x526e6746, 0x0, 0x4d516576, 0x74460000,
-0x4d516576, 0x505f4600, 0x5173436f, 0x6e495f46,
-0x0, 0x5173436f, 0x6e734600, 0x51725072,
-0x6f644600, 0x2a50414e, 0x49432a00, 0x6d61632e,
-0x68000000, 0x6d616354, 0x68726573, 0x0,
-0x23744d61, 0x6341544e, 0x0, 0x23724d61,
-0x6341544e, 0x0, 0x72656d41, 0x73737274,
-0x0, 0x6d61632e, 0x63000000, 0x6c696e6b,
-0x444f574e, 0x0, 0x6c696e6b, 0x55500000,
-0x24486561, 0x6465723a, 0x202f7072, 0x6f6a6563,
-0x74732f72, 0x63732f73, 0x772f6765, 0x2f2e2f6e,
-0x69632f66, 0x77322f63, 0x6f6d6d6f, 0x6e2f636b,
-0x73756d2e, 0x632c7620, 0x312e312e, 0x322e3920,
-0x31393939, 0x2f30312f, 0x31342030, 0x303a3033,
-0x3a343820, 0x73687561, 0x6e672045, 0x78702024,
-0x0, 0x65767452, 0x6e674600, 0x51657674,
-0x46000000, 0x51657674, 0x505f4600, 0x4d657674,
-0x526e6746, 0x0, 0x4d516576, 0x74460000,
-0x4d516576, 0x505f4600, 0x5173436f, 0x6e495f46,
-0x0, 0x5173436f, 0x6e734600, 0x51725072,
-0x6f644600, 0x2a50414e, 0x49432a00, 0x6d61632e,
-0x68000000, 0x2a50414e, 0x49432a00, 0x2e2e2f63,
-0x6f6d6d6f, 0x6e2f6d61, 0x632e6800, 0x2e2e2f2e,
-0x2e2f2e2e, 0x2f636f6d, 0x6d6f6e2f, 0x6c696e6b,
-0x2e630000, 0x50726f62, 0x65506879, 0x0,
-0x6c6e6b41, 0x53535254, 0x0, 0x6e6f4863,
-0x644c6b00, 0x11f8c, 0x1200c, 0x12040,
-0x1206c, 0x120e8, 0x12160, 0x121c8,
-0x12940, 0x12324, 0x1235c, 0x12374,
-0x123b8, 0x123e0, 0x12404, 0x1242c,
-0x12940, 0x12324, 0x124b8, 0x124d0,
-0x12500, 0x123e0, 0x12528, 0x12550,
-0x0, 0x12684, 0x126b4, 0x126d8,
-0x12940, 0x126fc, 0x127b8, 0x1284c,
-0x0, 0x2a50414e, 0x49432a00, 0x2e2e2f63,
-0x6f6d6d6f, 0x6e2f6d61, 0x632e6800, 0x130e4,
-0x131b4, 0x1328c, 0x1335c, 0x133b8,
-0x13494, 0x134bc, 0x13598, 0x135c0,
-0x13768, 0x13790, 0x13938, 0x13b30,
-0x13dc8, 0x13cd8, 0x13dc8, 0x13df4,
-0x13960, 0x13b08, 0x7273745f, 0x676d6969,
-0x0, 0x13e88, 0x13ec4, 0x13fb0,
-0x14c04, 0x14c48, 0x14c60, 0x7365746c,
-0x6f6f7000, 0x2a50414e, 0x49432a00, 0x2e2e2f63,
-0x6f6d6d6f, 0x6e2f6d61, 0x632e6800, 0x15454,
-0x15494, 0x1552c, 0x15570, 0x155dc,
-0x1566c, 0x156a0, 0x1572c, 0x157d0,
-0x158a0, 0x158e0, 0x1596c, 0x15990,
-0x15aa8, 0x646f4261, 0x73655067, 0x0,
-0x0, 0x2a50414e, 0x49432a00, 0x2e2e2f63,
-0x6f6d6d6f, 0x6e2f6d61, 0x632e6800, 0x73746d61,
-0x634c4e4b, 0x0, 0x6765746d, 0x636c6e6b,
-0x0, 0x167cc, 0x167cc, 0x1647c,
-0x164c8, 0x16514, 0x167cc, 0x7365746d,
-0x61636163, 0x74000000, 0x0 };
-static u_int32_t tigon2FwData[] = {
-0x1,
-0x1, 0x1, 0xc001fc, 0x3ffc,
-0xc00000, 0x416c7465, 0x6f6e2041, 0x63654e49,
-0x43205600, 0x0, 0x416c7465, 0x6f6e2041,
-0x63654e49, 0x43205600, 0x42424242, 0x1ffffc,
-0x1fff7c, 0x0, 0x0, 0x0,
-0x60cf00, 0x60, 0xcf000000, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x3,
-0x0, 0x1, 0x0, 0x0,
-0x0, 0x1, 0x0, 0x1,
-0x0, 0x0, 0x1, 0x1,
-0x0, 0x0, 0x0, 0x0,
-0x0, 0x1000000, 0x21000000, 0x12000140,
-0x0, 0x0, 0x20000000, 0x120000a0,
-0x0, 0x12000060, 0x12000180, 0x120001e0,
-0x0, 0x0, 0x0, 0x1,
-0x0, 0x0, 0x0, 0x0,
-0x2, 0x0, 0x0, 0x30001,
-0x1, 0x30201, 0x1010101, 0x1010100,
-0x10100, 0x1010001, 0x10001, 0x1000101,
-0x101, 0x0, 0x0 };
diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c
deleted file mode 100644
index 23194f7..0000000
--- a/sys/dev/vr/if_vr.c
+++ /dev/null
@@ -1,1707 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * VIA Rhine fast ethernet PCI NIC driver
- *
- * Supports various network adapters based on the VIA Rhine
- * and Rhine II PCI controllers, including the D-Link DFE530TX.
- * Datasheets are available at http://www.via.com.tw.
- *
- * Written by Bill Paul <wpaul@ctr.columbia.edu>
- * Electrical Engineering Department
- * Columbia University, New York City
- */
-
-/*
- * The VIA Rhine controllers are similar in some respects to the
- * the DEC tulip chips, except less complicated. The controller
- * uses an MII bus and an external physical layer interface. The
- * receiver has a one entry perfect filter and a 64-bit hash table
- * multicast filter. Transmit and receive descriptors are similar
- * to the tulip.
- *
- * The Rhine has a serious flaw in its transmit DMA mechanism:
- * transmit buffers must be longword aligned. Unfortunately,
- * FreeBSD doesn't guarantee that mbufs will be filled in starting
- * at longword boundaries, so we have to do a buffer copy before
- * transmission.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/socket.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-
-#include <net/bpf.h>
-
-#include <vm/vm.h> /* for vtophys */
-#include <vm/pmap.h> /* for vtophys */
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#define VR_USEIOSPACE
-
-#include <pci/if_vrreg.h>
-
-MODULE_DEPEND(vr, pci, 1, 1, 1);
-MODULE_DEPEND(vr, ether, 1, 1, 1);
-MODULE_DEPEND(vr, miibus, 1, 1, 1);
-
-/* "controller miibus0" required. See GENERIC if you get errors here. */
-#include "miibus_if.h"
-
-#undef VR_USESWSHIFT
-
-/*
- * Various supported device vendors/types and their names.
- */
-static struct vr_type vr_devs[] = {
- { VIA_VENDORID, VIA_DEVICEID_RHINE,
- "VIA VT3043 Rhine I 10/100BaseTX" },
- { VIA_VENDORID, VIA_DEVICEID_RHINE_II,
- "VIA VT86C100A Rhine II 10/100BaseTX" },
- { VIA_VENDORID, VIA_DEVICEID_RHINE_II_2,
- "VIA VT6102 Rhine II 10/100BaseTX" },
- { VIA_VENDORID, VIA_DEVICEID_RHINE_III,
- "VIA VT6105 Rhine III 10/100BaseTX" },
- { VIA_VENDORID, VIA_DEVICEID_RHINE_III_M,
- "VIA VT6105M Rhine III 10/100BaseTX" },
- { DELTA_VENDORID, DELTA_DEVICEID_RHINE_II,
- "Delta Electronics Rhine II 10/100BaseTX" },
- { ADDTRON_VENDORID, ADDTRON_DEVICEID_RHINE_II,
- "Addtron Technology Rhine II 10/100BaseTX" },
- { 0, 0, NULL }
-};
-
-static int vr_probe(device_t);
-static int vr_attach(device_t);
-static int vr_detach(device_t);
-
-static int vr_newbuf(struct vr_softc *, struct vr_chain_onefrag *,
- struct mbuf *);
-static int vr_encap(struct vr_softc *, struct vr_chain *, struct mbuf * );
-
-static void vr_rxeof(struct vr_softc *);
-static void vr_rxeoc(struct vr_softc *);
-static void vr_txeof(struct vr_softc *);
-static void vr_tick(void *);
-static void vr_intr(void *);
-static void vr_start(struct ifnet *);
-static void vr_start_locked(struct ifnet *);
-static int vr_ioctl(struct ifnet *, u_long, caddr_t);
-static void vr_init(void *);
-static void vr_init_locked(struct vr_softc *);
-static void vr_stop(struct vr_softc *);
-static void vr_watchdog(struct ifnet *);
-static void vr_shutdown(device_t);
-static int vr_ifmedia_upd(struct ifnet *);
-static void vr_ifmedia_sts(struct ifnet *, struct ifmediareq *);
-
-#ifdef VR_USESWSHIFT
-static void vr_mii_sync(struct vr_softc *);
-static void vr_mii_send(struct vr_softc *, uint32_t, int);
-#endif
-static int vr_mii_readreg(struct vr_softc *, struct vr_mii_frame *);
-static int vr_mii_writereg(struct vr_softc *, struct vr_mii_frame *);
-static int vr_miibus_readreg(device_t, uint16_t, uint16_t);
-static int vr_miibus_writereg(device_t, uint16_t, uint16_t, uint16_t);
-static void vr_miibus_statchg(device_t);
-
-static void vr_setcfg(struct vr_softc *, int);
-static void vr_setmulti(struct vr_softc *);
-static void vr_reset(struct vr_softc *);
-static int vr_list_rx_init(struct vr_softc *);
-static int vr_list_tx_init(struct vr_softc *);
-
-#ifdef VR_USEIOSPACE
-#define VR_RES SYS_RES_IOPORT
-#define VR_RID VR_PCI_LOIO
-#else
-#define VR_RES SYS_RES_MEMORY
-#define VR_RID VR_PCI_LOMEM
-#endif
-
-static device_method_t vr_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, vr_probe),
- DEVMETHOD(device_attach, vr_attach),
- DEVMETHOD(device_detach, vr_detach),
- DEVMETHOD(device_shutdown, vr_shutdown),
-
- /* bus interface */
- DEVMETHOD(bus_print_child, bus_generic_print_child),
- DEVMETHOD(bus_driver_added, bus_generic_driver_added),
-
- /* MII interface */
- DEVMETHOD(miibus_readreg, vr_miibus_readreg),
- DEVMETHOD(miibus_writereg, vr_miibus_writereg),
- DEVMETHOD(miibus_statchg, vr_miibus_statchg),
-
- { 0, 0 }
-};
-
-static driver_t vr_driver = {
- "vr",
- vr_methods,
- sizeof(struct vr_softc)
-};
-
-static devclass_t vr_devclass;
-
-DRIVER_MODULE(vr, pci, vr_driver, vr_devclass, 0, 0);
-DRIVER_MODULE(miibus, vr, miibus_driver, miibus_devclass, 0, 0);
-
-#define VR_SETBIT(sc, reg, x) \
- CSR_WRITE_1(sc, reg, \
- CSR_READ_1(sc, reg) | (x))
-
-#define VR_CLRBIT(sc, reg, x) \
- CSR_WRITE_1(sc, reg, \
- CSR_READ_1(sc, reg) & ~(x))
-
-#define VR_SETBIT16(sc, reg, x) \
- CSR_WRITE_2(sc, reg, \
- CSR_READ_2(sc, reg) | (x))
-
-#define VR_CLRBIT16(sc, reg, x) \
- CSR_WRITE_2(sc, reg, \
- CSR_READ_2(sc, reg) & ~(x))
-
-#define VR_SETBIT32(sc, reg, x) \
- CSR_WRITE_4(sc, reg, \
- CSR_READ_4(sc, reg) | (x))
-
-#define VR_CLRBIT32(sc, reg, x) \
- CSR_WRITE_4(sc, reg, \
- CSR_READ_4(sc, reg) & ~(x))
-
-#define SIO_SET(x) \
- CSR_WRITE_1(sc, VR_MIICMD, \
- CSR_READ_1(sc, VR_MIICMD) | (x))
-
-#define SIO_CLR(x) \
- CSR_WRITE_1(sc, VR_MIICMD, \
- CSR_READ_1(sc, VR_MIICMD) & ~(x))
-
-#ifdef VR_USESWSHIFT
-/*
- * Sync the PHYs by setting data bit and strobing the clock 32 times.
- */
-static void
-vr_mii_sync(struct vr_softc *sc)
-{
- register int i;
-
- SIO_SET(VR_MIICMD_DIR|VR_MIICMD_DATAIN);
-
- for (i = 0; i < 32; i++) {
- SIO_SET(VR_MIICMD_CLK);
- DELAY(1);
- SIO_CLR(VR_MIICMD_CLK);
- DELAY(1);
- }
-}
-
-/*
- * Clock a series of bits through the MII.
- */
-static void
-vr_mii_send(struct vr_softc *sc, uint32_t bits, int cnt)
-{
- int i;
-
- SIO_CLR(VR_MIICMD_CLK);
-
- for (i = (0x1 << (cnt - 1)); i; i >>= 1) {
- if (bits & i) {
- SIO_SET(VR_MIICMD_DATAIN);
- } else {
- SIO_CLR(VR_MIICMD_DATAIN);
- }
- DELAY(1);
- SIO_CLR(VR_MIICMD_CLK);
- DELAY(1);
- SIO_SET(VR_MIICMD_CLK);
- }
-}
-#endif
-
-/*
- * Read an PHY register through the MII.
- */
-static int
-vr_mii_readreg(struct vr_softc *sc, struct vr_mii_frame *frame)
-#ifdef VR_USESWSHIFT
-{
- int i, ack;
-
- /* Set up frame for RX. */
- frame->mii_stdelim = VR_MII_STARTDELIM;
- frame->mii_opcode = VR_MII_READOP;
- frame->mii_turnaround = 0;
- frame->mii_data = 0;
-
- CSR_WRITE_1(sc, VR_MIICMD, 0);
- VR_SETBIT(sc, VR_MIICMD, VR_MIICMD_DIRECTPGM);
-
- /* Turn on data xmit. */
- SIO_SET(VR_MIICMD_DIR);
-
- vr_mii_sync(sc);
-
- /* Send command/address info. */
- vr_mii_send(sc, frame->mii_stdelim, 2);
- vr_mii_send(sc, frame->mii_opcode, 2);
- vr_mii_send(sc, frame->mii_phyaddr, 5);
- vr_mii_send(sc, frame->mii_regaddr, 5);
-
- /* Idle bit. */
- SIO_CLR((VR_MIICMD_CLK|VR_MIICMD_DATAIN));
- DELAY(1);
- SIO_SET(VR_MIICMD_CLK);
- DELAY(1);
-
- /* Turn off xmit. */
- SIO_CLR(VR_MIICMD_DIR);
-
- /* Check for ack */
- SIO_CLR(VR_MIICMD_CLK);
- DELAY(1);
- ack = CSR_READ_4(sc, VR_MIICMD) & VR_MIICMD_DATAOUT;
- SIO_SET(VR_MIICMD_CLK);
- DELAY(1);
-
- /*
- * Now try reading data bits. If the ack failed, we still
- * need to clock through 16 cycles to keep the PHY(s) in sync.
- */
- if (ack) {
- for(i = 0; i < 16; i++) {
- SIO_CLR(VR_MIICMD_CLK);
- DELAY(1);
- SIO_SET(VR_MIICMD_CLK);
- DELAY(1);
- }
- goto fail;
- }
-
- for (i = 0x8000; i; i >>= 1) {
- SIO_CLR(VR_MIICMD_CLK);
- DELAY(1);
- if (!ack) {
- if (CSR_READ_4(sc, VR_MIICMD) & VR_MIICMD_DATAOUT)
- frame->mii_data |= i;
- DELAY(1);
- }
- SIO_SET(VR_MIICMD_CLK);
- DELAY(1);
- }
-
-fail:
- SIO_CLR(VR_MIICMD_CLK);
- DELAY(1);
- SIO_SET(VR_MIICMD_CLK);
- DELAY(1);
-
- if (ack)
- return (1);
- return (0);
-}
-#else
-{
- int i;
-
- /* Set the PHY address. */
- CSR_WRITE_1(sc, VR_PHYADDR, (CSR_READ_1(sc, VR_PHYADDR)& 0xe0)|
- frame->mii_phyaddr);
-
- /* Set the register address. */
- CSR_WRITE_1(sc, VR_MIIADDR, frame->mii_regaddr);
- VR_SETBIT(sc, VR_MIICMD, VR_MIICMD_READ_ENB);
-
- for (i = 0; i < 10000; i++) {
- if ((CSR_READ_1(sc, VR_MIICMD) & VR_MIICMD_READ_ENB) == 0)
- break;
- DELAY(1);
- }
- frame->mii_data = CSR_READ_2(sc, VR_MIIDATA);
-
- return (0);
-}
-#endif
-
-
-/*
- * Write to a PHY register through the MII.
- */
-static int
-vr_mii_writereg(struct vr_softc *sc, struct vr_mii_frame *frame)
-#ifdef VR_USESWSHIFT
-{
- CSR_WRITE_1(sc, VR_MIICMD, 0);
- VR_SETBIT(sc, VR_MIICMD, VR_MIICMD_DIRECTPGM);
-
- /* Set up frame for TX. */
- frame->mii_stdelim = VR_MII_STARTDELIM;
- frame->mii_opcode = VR_MII_WRITEOP;
- frame->mii_turnaround = VR_MII_TURNAROUND;
-
- /* Turn on data output. */
- SIO_SET(VR_MIICMD_DIR);
-
- vr_mii_sync(sc);
-
- vr_mii_send(sc, frame->mii_stdelim, 2);
- vr_mii_send(sc, frame->mii_opcode, 2);
- vr_mii_send(sc, frame->mii_phyaddr, 5);
- vr_mii_send(sc, frame->mii_regaddr, 5);
- vr_mii_send(sc, frame->mii_turnaround, 2);
- vr_mii_send(sc, frame->mii_data, 16);
-
- /* Idle bit. */
- SIO_SET(VR_MIICMD_CLK);
- DELAY(1);
- SIO_CLR(VR_MIICMD_CLK);
- DELAY(1);
-
- /* Turn off xmit. */
- SIO_CLR(VR_MIICMD_DIR);
-
- return (0);
-}
-#else
-{
- int i;
-
- /* Set the PHY address. */
- CSR_WRITE_1(sc, VR_PHYADDR, (CSR_READ_1(sc, VR_PHYADDR)& 0xe0)|
- frame->mii_phyaddr);
-
- /* Set the register address and data to write. */
- CSR_WRITE_1(sc, VR_MIIADDR, frame->mii_regaddr);
- CSR_WRITE_2(sc, VR_MIIDATA, frame->mii_data);
-
- VR_SETBIT(sc, VR_MIICMD, VR_MIICMD_WRITE_ENB);
-
- for (i = 0; i < 10000; i++) {
- if ((CSR_READ_1(sc, VR_MIICMD) & VR_MIICMD_WRITE_ENB) == 0)
- break;
- DELAY(1);
- }
-
- return (0);
-}
-#endif
-
-static int
-vr_miibus_readreg(device_t dev, uint16_t phy, uint16_t reg)
-{
- struct vr_mii_frame frame;
- struct vr_softc *sc = device_get_softc(dev);
-
- switch (sc->vr_revid) {
- case REV_ID_VT6102_APOLLO:
- if (phy != 1) {
- frame.mii_data = 0;
- goto out;
- }
- default:
- break;
- }
-
- bzero((char *)&frame, sizeof(frame));
- frame.mii_phyaddr = phy;
- frame.mii_regaddr = reg;
- vr_mii_readreg(sc, &frame);
-
-out:
- return (frame.mii_data);
-}
-
-static int
-vr_miibus_writereg(device_t dev, uint16_t phy, uint16_t reg, uint16_t data)
-{
- struct vr_mii_frame frame;
- struct vr_softc *sc = device_get_softc(dev);
-
- switch (sc->vr_revid) {
- case REV_ID_VT6102_APOLLO:
- if (phy != 1)
- return (0);
- default:
- break;
- }
-
- bzero((char *)&frame, sizeof(frame));
- frame.mii_phyaddr = phy;
- frame.mii_regaddr = reg;
- frame.mii_data = data;
- vr_mii_writereg(sc, &frame);
-
- return (0);
-}
-
-static void
-vr_miibus_statchg(device_t dev)
-{
- struct mii_data *mii;
- struct vr_softc *sc = device_get_softc(dev);
-
- mii = device_get_softc(sc->vr_miibus);
- vr_setcfg(sc, mii->mii_media_active);
-}
-
-/*
- * Program the 64-bit multicast hash filter.
- */
-static void
-vr_setmulti(struct vr_softc *sc)
-{
- struct ifnet *ifp = sc->vr_ifp;
- int h = 0;
- uint32_t hashes[2] = { 0, 0 };
- struct ifmultiaddr *ifma;
- uint8_t rxfilt;
- int mcnt = 0;
-
- VR_LOCK_ASSERT(sc);
-
- rxfilt = CSR_READ_1(sc, VR_RXCFG);
-
- if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
- rxfilt |= VR_RXCFG_RX_MULTI;
- CSR_WRITE_1(sc, VR_RXCFG, rxfilt);
- CSR_WRITE_4(sc, VR_MAR0, 0xFFFFFFFF);
- CSR_WRITE_4(sc, VR_MAR1, 0xFFFFFFFF);
- return;
- }
-
- /* First, zero out all the existing hash bits. */
- CSR_WRITE_4(sc, VR_MAR0, 0);
- CSR_WRITE_4(sc, VR_MAR1, 0);
-
- /* Now program new ones. */
- TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
- if (ifma->ifma_addr->sa_family != AF_LINK)
- continue;
- h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
- ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
- if (h < 32)
- hashes[0] |= (1 << h);
- else
- hashes[1] |= (1 << (h - 32));
- mcnt++;
- }
-
- if (mcnt)
- rxfilt |= VR_RXCFG_RX_MULTI;
- else
- rxfilt &= ~VR_RXCFG_RX_MULTI;
-
- CSR_WRITE_4(sc, VR_MAR0, hashes[0]);
- CSR_WRITE_4(sc, VR_MAR1, hashes[1]);
- CSR_WRITE_1(sc, VR_RXCFG, rxfilt);
-}
-
-/*
- * In order to fiddle with the
- * 'full-duplex' and '100Mbps' bits in the netconfig register, we
- * first have to put the transmit and/or receive logic in the idle state.
- */
-static void
-vr_setcfg(struct vr_softc *sc, int media)
-{
- int restart = 0;
-
- VR_LOCK_ASSERT(sc);
-
- if (CSR_READ_2(sc, VR_COMMAND) & (VR_CMD_TX_ON|VR_CMD_RX_ON)) {
- restart = 1;
- VR_CLRBIT16(sc, VR_COMMAND, (VR_CMD_TX_ON|VR_CMD_RX_ON));
- }
-
- if ((media & IFM_GMASK) == IFM_FDX)
- VR_SETBIT16(sc, VR_COMMAND, VR_CMD_FULLDUPLEX);
- else
- VR_CLRBIT16(sc, VR_COMMAND, VR_CMD_FULLDUPLEX);
-
- if (restart)
- VR_SETBIT16(sc, VR_COMMAND, VR_CMD_TX_ON|VR_CMD_RX_ON);
-}
-
-static void
-vr_reset(struct vr_softc *sc)
-{
- register int i;
-
- /*VR_LOCK_ASSERT(sc);*/ /* XXX: Called during detach w/o lock. */
-
- VR_SETBIT16(sc, VR_COMMAND, VR_CMD_RESET);
-
- for (i = 0; i < VR_TIMEOUT; i++) {
- DELAY(10);
- if (!(CSR_READ_2(sc, VR_COMMAND) & VR_CMD_RESET))
- break;
- }
- if (i == VR_TIMEOUT) {
- if (sc->vr_revid < REV_ID_VT3065_A)
- printf("vr%d: reset never completed!\n", sc->vr_unit);
- else {
- /* Use newer force reset command */
- printf("vr%d: Using force reset command.\n",
- sc->vr_unit);
- VR_SETBIT(sc, VR_MISC_CR1, VR_MISCCR1_FORSRST);
- }
- }
-
- /* Wait a little while for the chip to get its brains in order. */
- DELAY(1000);
-}
-
-/*
- * Probe for a VIA Rhine chip. Check the PCI vendor and device
- * IDs against our list and return a device name if we find a match.
- */
-static int
-vr_probe(device_t dev)
-{
- struct vr_type *t = vr_devs;
-
- while (t->vr_name != NULL) {
- if ((pci_get_vendor(dev) == t->vr_vid) &&
- (pci_get_device(dev) == t->vr_did)) {
- device_set_desc(dev, t->vr_name);
- return (BUS_PROBE_DEFAULT);
- }
- t++;
- }
-
- return (ENXIO);
-}
-
-/*
- * Attach the interface. Allocate softc structures, do ifmedia
- * setup and ethernet/BPF attach.
- */
-static int
-vr_attach(dev)
- device_t dev;
-{
- int i;
- u_char eaddr[ETHER_ADDR_LEN];
- struct vr_softc *sc;
- struct ifnet *ifp;
- int unit, error = 0, rid;
-
- sc = device_get_softc(dev);
- unit = device_get_unit(dev);
-
- mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
- MTX_DEF);
- /*
- * Map control/status registers.
- */
- pci_enable_busmaster(dev);
- sc->vr_revid = pci_read_config(dev, VR_PCI_REVID, 4) & 0x000000FF;
-
- rid = VR_RID;
- sc->vr_res = bus_alloc_resource_any(dev, VR_RES, &rid, RF_ACTIVE);
-
- if (sc->vr_res == NULL) {
- printf("vr%d: couldn't map ports/memory\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- sc->vr_btag = rman_get_bustag(sc->vr_res);
- sc->vr_bhandle = rman_get_bushandle(sc->vr_res);
-
- /* Allocate interrupt */
- rid = 0;
- sc->vr_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
- RF_SHAREABLE | RF_ACTIVE);
-
- if (sc->vr_irq == NULL) {
- printf("vr%d: couldn't map interrupt\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- /*
- * Windows may put the chip in suspend mode when it
- * shuts down. Be sure to kick it in the head to wake it
- * up again.
- */
- VR_CLRBIT(sc, VR_STICKHW, (VR_STICKHW_DS0|VR_STICKHW_DS1));
-
- /* Reset the adapter. */
- vr_reset(sc);
-
- /*
- * Turn on bit2 (MIION) in PCI configuration register 0x53 during
- * initialization and disable AUTOPOLL.
- */
- pci_write_config(dev, VR_PCI_MODE,
- pci_read_config(dev, VR_PCI_MODE, 4) | (VR_MODE3_MIION << 24), 4);
- VR_CLRBIT(sc, VR_MIICMD, VR_MIICMD_AUTOPOLL);
-
- /*
- * Get station address. The way the Rhine chips work,
- * you're not allowed to directly access the EEPROM once
- * they've been programmed a special way. Consequently,
- * we need to read the node address from the PAR0 and PAR1
- * registers.
- */
- VR_SETBIT(sc, VR_EECSR, VR_EECSR_LOAD);
- DELAY(200);
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- eaddr[i] = CSR_READ_1(sc, VR_PAR0 + i);
-
- sc->vr_unit = unit;
-
- sc->vr_ldata = contigmalloc(sizeof(struct vr_list_data), M_DEVBUF,
- M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0);
-
- if (sc->vr_ldata == NULL) {
- printf("vr%d: no memory for list buffers!\n", unit);
- error = ENXIO;
- goto fail;
- }
-
- bzero(sc->vr_ldata, sizeof(struct vr_list_data));
-
- ifp = sc->vr_ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- printf("vr%d: can not if_alloc()\n", unit);
- error = ENOSPC;
- goto fail;
- }
- ifp->if_softc = sc;
- if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_mtu = ETHERMTU;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_ioctl = vr_ioctl;
- ifp->if_start = vr_start;
- ifp->if_watchdog = vr_watchdog;
- ifp->if_init = vr_init;
- ifp->if_baudrate = 10000000;
- IFQ_SET_MAXLEN(&ifp->if_snd, VR_TX_LIST_CNT - 1);
- ifp->if_snd.ifq_maxlen = VR_TX_LIST_CNT - 1;
- IFQ_SET_READY(&ifp->if_snd);
-#ifdef DEVICE_POLLING
- ifp->if_capabilities |= IFCAP_POLLING;
-#endif
- ifp->if_capenable = ifp->if_capabilities;
-
- /* Do MII setup. */
- if (mii_phy_probe(dev, &sc->vr_miibus,
- vr_ifmedia_upd, vr_ifmedia_sts)) {
- printf("vr%d: MII without any phy!\n", sc->vr_unit);
- error = ENXIO;
- goto fail;
- }
-
- callout_handle_init(&sc->vr_stat_ch);
-
- /* Call MI attach routine. */
- ether_ifattach(ifp, eaddr);
-
- sc->suspended = 0;
-
- /* Hook interrupt last to avoid having to lock softc */
- error = bus_setup_intr(dev, sc->vr_irq, INTR_TYPE_NET | INTR_MPSAFE,
- vr_intr, sc, &sc->vr_intrhand);
-
- if (error) {
- printf("vr%d: couldn't set up irq\n", unit);
- ether_ifdetach(ifp);
- if_free(ifp);
- goto fail;
- }
-
-fail:
- if (error)
- vr_detach(dev);
-
- return (error);
-}
-
-/*
- * Shutdown hardware and free up resources. This can be called any
- * time after the mutex has been initialized. It is called in both
- * the error case in attach and the normal detach case so it needs
- * to be careful about only freeing resources that have actually been
- * allocated.
- */
-static int
-vr_detach(device_t dev)
-{
- struct vr_softc *sc = device_get_softc(dev);
- struct ifnet *ifp = sc->vr_ifp;
-
- KASSERT(mtx_initialized(&sc->vr_mtx), ("vr mutex not initialized"));
-
- VR_LOCK(sc);
-
- sc->suspended = 1;
-
- /* These should only be active if attach succeeded */
- if (device_is_attached(dev)) {
- vr_stop(sc);
- VR_UNLOCK(sc); /* XXX: Avoid recursive acquire. */
- ether_ifdetach(ifp);
- if_free(ifp);
- VR_LOCK(sc);
- }
- if (sc->vr_miibus)
- device_delete_child(dev, sc->vr_miibus);
- bus_generic_detach(dev);
-
- if (sc->vr_intrhand)
- bus_teardown_intr(dev, sc->vr_irq, sc->vr_intrhand);
- if (sc->vr_irq)
- bus_release_resource(dev, SYS_RES_IRQ, 0, sc->vr_irq);
- if (sc->vr_res)
- bus_release_resource(dev, VR_RES, VR_RID, sc->vr_res);
-
- if (sc->vr_ldata)
- contigfree(sc->vr_ldata, sizeof(struct vr_list_data), M_DEVBUF);
-
- VR_UNLOCK(sc);
- mtx_destroy(&sc->vr_mtx);
-
- return (0);
-}
-
-/*
- * Initialize the transmit descriptors.
- */
-static int
-vr_list_tx_init(struct vr_softc *sc)
-{
- struct vr_chain_data *cd;
- struct vr_list_data *ld;
- int i;
-
- cd = &sc->vr_cdata;
- ld = sc->vr_ldata;
- for (i = 0; i < VR_TX_LIST_CNT; i++) {
- cd->vr_tx_chain[i].vr_ptr = &ld->vr_tx_list[i];
- if (i == (VR_TX_LIST_CNT - 1))
- cd->vr_tx_chain[i].vr_nextdesc =
- &cd->vr_tx_chain[0];
- else
- cd->vr_tx_chain[i].vr_nextdesc =
- &cd->vr_tx_chain[i + 1];
- }
- cd->vr_tx_cons = cd->vr_tx_prod = &cd->vr_tx_chain[0];
-
- return (0);
-}
-
-
-/*
- * Initialize the RX descriptors and allocate mbufs for them. Note that
- * we arrange the descriptors in a closed ring, so that the last descriptor
- * points back to the first.
- */
-static int
-vr_list_rx_init(struct vr_softc *sc)
-{
- struct vr_chain_data *cd;
- struct vr_list_data *ld;
- int i;
-
- VR_LOCK_ASSERT(sc);
-
- cd = &sc->vr_cdata;
- ld = sc->vr_ldata;
-
- for (i = 0; i < VR_RX_LIST_CNT; i++) {
- cd->vr_rx_chain[i].vr_ptr =
- (struct vr_desc *)&ld->vr_rx_list[i];
- if (vr_newbuf(sc, &cd->vr_rx_chain[i], NULL) == ENOBUFS)
- return (ENOBUFS);
- if (i == (VR_RX_LIST_CNT - 1)) {
- cd->vr_rx_chain[i].vr_nextdesc =
- &cd->vr_rx_chain[0];
- ld->vr_rx_list[i].vr_next =
- vtophys(&ld->vr_rx_list[0]);
- } else {
- cd->vr_rx_chain[i].vr_nextdesc =
- &cd->vr_rx_chain[i + 1];
- ld->vr_rx_list[i].vr_next =
- vtophys(&ld->vr_rx_list[i + 1]);
- }
- }
-
- cd->vr_rx_head = &cd->vr_rx_chain[0];
-
- return (0);
-}
-
-/*
- * Initialize an RX descriptor and attach an MBUF cluster.
- * Note: the length fields are only 11 bits wide, which means the
- * largest size we can specify is 2047. This is important because
- * MCLBYTES is 2048, so we have to subtract one otherwise we'll
- * overflow the field and make a mess.
- */
-static int
-vr_newbuf(struct vr_softc *sc, struct vr_chain_onefrag *c, struct mbuf *m)
-{
- struct mbuf *m_new = NULL;
-
- if (m == NULL) {
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL)
- return (ENOBUFS);
-
- MCLGET(m_new, M_DONTWAIT);
- if (!(m_new->m_flags & M_EXT)) {
- m_freem(m_new);
- return (ENOBUFS);
- }
- m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
- } else {
- m_new = m;
- m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
- m_new->m_data = m_new->m_ext.ext_buf;
- }
-
- m_adj(m_new, sizeof(uint64_t));
-
- c->vr_mbuf = m_new;
- c->vr_ptr->vr_status = VR_RXSTAT;
- c->vr_ptr->vr_data = vtophys(mtod(m_new, caddr_t));
- c->vr_ptr->vr_ctl = VR_RXCTL | VR_RXLEN;
-
- return (0);
-}
-
-/*
- * A frame has been uploaded: pass the resulting mbuf chain up to
- * the higher level protocols.
- */
-static void
-vr_rxeof(struct vr_softc *sc)
-{
- struct mbuf *m, *m0;
- struct ifnet *ifp;
- struct vr_chain_onefrag *cur_rx;
- int total_len = 0;
- uint32_t rxstat;
-
- VR_LOCK_ASSERT(sc);
- ifp = sc->vr_ifp;
-
- while (!((rxstat = sc->vr_cdata.vr_rx_head->vr_ptr->vr_status) &
- VR_RXSTAT_OWN)) {
-#ifdef DEVICE_POLLING
- if (ifp->if_flags & IFF_POLLING) {
- if (sc->rxcycles <= 0)
- break;
- sc->rxcycles--;
- }
-#endif /* DEVICE_POLLING */
- m0 = NULL;
- cur_rx = sc->vr_cdata.vr_rx_head;
- sc->vr_cdata.vr_rx_head = cur_rx->vr_nextdesc;
- m = cur_rx->vr_mbuf;
-
- /*
- * If an error occurs, update stats, clear the
- * status word and leave the mbuf cluster in place:
- * it should simply get re-used next time this descriptor
- * comes up in the ring.
- */
- if (rxstat & VR_RXSTAT_RXERR) {
- ifp->if_ierrors++;
- printf("vr%d: rx error (%02x):", sc->vr_unit,
- rxstat & 0x000000ff);
- if (rxstat & VR_RXSTAT_CRCERR)
- printf(" crc error");
- if (rxstat & VR_RXSTAT_FRAMEALIGNERR)
- printf(" frame alignment error\n");
- if (rxstat & VR_RXSTAT_FIFOOFLOW)
- printf(" FIFO overflow");
- if (rxstat & VR_RXSTAT_GIANT)
- printf(" received giant packet");
- if (rxstat & VR_RXSTAT_RUNT)
- printf(" received runt packet");
- if (rxstat & VR_RXSTAT_BUSERR)
- printf(" system bus error");
- if (rxstat & VR_RXSTAT_BUFFERR)
- printf("rx buffer error");
- printf("\n");
- vr_newbuf(sc, cur_rx, m);
- continue;
- }
-
- /* No errors; receive the packet. */
- total_len = VR_RXBYTES(cur_rx->vr_ptr->vr_status);
-
- /*
- * XXX The VIA Rhine chip includes the CRC with every
- * received frame, and there's no way to turn this
- * behavior off (at least, I can't find anything in
- * the manual that explains how to do it) so we have
- * to trim off the CRC manually.
- */
- total_len -= ETHER_CRC_LEN;
-
- m0 = m_devget(mtod(m, char *), total_len, ETHER_ALIGN, ifp,
- NULL);
- vr_newbuf(sc, cur_rx, m);
- if (m0 == NULL) {
- ifp->if_ierrors++;
- continue;
- }
- m = m0;
-
- ifp->if_ipackets++;
- VR_UNLOCK(sc);
- (*ifp->if_input)(ifp, m);
- VR_LOCK(sc);
- }
-}
-
-static void
-vr_rxeoc(struct vr_softc *sc)
-{
- struct ifnet *ifp = sc->vr_ifp;
- int i;
-
- VR_LOCK_ASSERT(sc);
-
- ifp->if_ierrors++;
-
- VR_CLRBIT16(sc, VR_COMMAND, VR_CMD_RX_ON);
- DELAY(10000);
-
- /* Wait for receiver to stop */
- for (i = 0x400;
- i && (CSR_READ_2(sc, VR_COMMAND) & VR_CMD_RX_ON);
- i--) {
- ;
- }
-
- if (!i) {
- printf("vr%d: rx shutdown error!\n", sc->vr_unit);
- sc->vr_flags |= VR_F_RESTART;
- return;
- }
-
- vr_rxeof(sc);
-
- CSR_WRITE_4(sc, VR_RXADDR, vtophys(sc->vr_cdata.vr_rx_head->vr_ptr));
- VR_SETBIT16(sc, VR_COMMAND, VR_CMD_RX_ON);
- VR_SETBIT16(sc, VR_COMMAND, VR_CMD_RX_GO);
-}
-
-/*
- * A frame was downloaded to the chip. It's safe for us to clean up
- * the list buffers.
- */
-static void
-vr_txeof(struct vr_softc *sc)
-{
- struct vr_chain *cur_tx;
- struct ifnet *ifp = sc->vr_ifp;
-
- VR_LOCK_ASSERT(sc);
-
- /*
- * Go through our tx list and free mbufs for those
- * frames that have been transmitted.
- */
- cur_tx = sc->vr_cdata.vr_tx_cons;
- while (cur_tx->vr_mbuf != NULL) {
- uint32_t txstat;
- int i;
-
- txstat = cur_tx->vr_ptr->vr_status;
-
- if ((txstat & VR_TXSTAT_ABRT) ||
- (txstat & VR_TXSTAT_UDF)) {
- for (i = 0x400;
- i && (CSR_READ_2(sc, VR_COMMAND) & VR_CMD_TX_ON);
- i--)
- ; /* Wait for chip to shutdown */
- if (!i) {
- printf("vr%d: tx shutdown timeout\n",
- sc->vr_unit);
- sc->vr_flags |= VR_F_RESTART;
- break;
- }
- VR_TXOWN(cur_tx) = VR_TXSTAT_OWN;
- CSR_WRITE_4(sc, VR_TXADDR, vtophys(cur_tx->vr_ptr));
- break;
- }
-
- if (txstat & VR_TXSTAT_OWN)
- break;
-
- if (txstat & VR_TXSTAT_ERRSUM) {
- ifp->if_oerrors++;
- if (txstat & VR_TXSTAT_DEFER)
- ifp->if_collisions++;
- if (txstat & VR_TXSTAT_LATECOLL)
- ifp->if_collisions++;
- }
-
- ifp->if_collisions +=(txstat & VR_TXSTAT_COLLCNT) >> 3;
-
- ifp->if_opackets++;
- m_freem(cur_tx->vr_mbuf);
- cur_tx->vr_mbuf = NULL;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- cur_tx = cur_tx->vr_nextdesc;
- }
- sc->vr_cdata.vr_tx_cons = cur_tx;
- if (cur_tx->vr_mbuf == NULL)
- ifp->if_timer = 0;
-}
-
-static void
-vr_tick(void *xsc)
-{
- struct vr_softc *sc = xsc;
- struct mii_data *mii;
-
- VR_LOCK(sc);
-
- if (sc->vr_flags & VR_F_RESTART) {
- printf("vr%d: restarting\n", sc->vr_unit);
- vr_stop(sc);
- vr_reset(sc);
- vr_init_locked(sc);
- sc->vr_flags &= ~VR_F_RESTART;
- }
-
- mii = device_get_softc(sc->vr_miibus);
- mii_tick(mii);
- sc->vr_stat_ch = timeout(vr_tick, sc, hz);
-
- VR_UNLOCK(sc);
-}
-
-#ifdef DEVICE_POLLING
-static poll_handler_t vr_poll;
-static poll_handler_t vr_poll_locked;
-
-static void
-vr_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
-{
- struct vr_softc *sc = ifp->if_softc;
-
- VR_LOCK(sc);
- vr_poll_locked(ifp, cmd, count);
- VR_UNLOCK(sc);
-}
-
-static void
-vr_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count)
-{
- struct vr_softc *sc = ifp->if_softc;
-
- VR_LOCK_ASSERT(sc);
-
- if (!(ifp->if_capenable & IFCAP_POLLING)) {
- ether_poll_deregister(ifp);
- cmd = POLL_DEREGISTER;
- }
-
- if (cmd == POLL_DEREGISTER) {
- /* Final call, enable interrupts. */
- CSR_WRITE_2(sc, VR_IMR, VR_INTRS);
- return;
- }
-
- sc->rxcycles = count;
- vr_rxeof(sc);
- vr_txeof(sc);
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- vr_start_locked(ifp);
-
- if (cmd == POLL_AND_CHECK_STATUS) {
- uint16_t status;
-
- /* Also check status register. */
- status = CSR_READ_2(sc, VR_ISR);
- if (status)
- CSR_WRITE_2(sc, VR_ISR, status);
-
- if ((status & VR_INTRS) == 0)
- return;
-
- if (status & VR_ISR_RX_DROPPED) {
- printf("vr%d: rx packet lost\n", sc->vr_unit);
- ifp->if_ierrors++;
- }
-
- if ((status & VR_ISR_RX_ERR) || (status & VR_ISR_RX_NOBUF) ||
- (status & VR_ISR_RX_NOBUF) || (status & VR_ISR_RX_OFLOW)) {
- printf("vr%d: receive error (%04x)",
- sc->vr_unit, status);
- if (status & VR_ISR_RX_NOBUF)
- printf(" no buffers");
- if (status & VR_ISR_RX_OFLOW)
- printf(" overflow");
- if (status & VR_ISR_RX_DROPPED)
- printf(" packet lost");
- printf("\n");
- vr_rxeoc(sc);
- }
-
- if ((status & VR_ISR_BUSERR) ||
- (status & VR_ISR_TX_UNDERRUN)) {
- vr_reset(sc);
- vr_init_locked(sc);
- return;
- }
-
- if ((status & VR_ISR_UDFI) ||
- (status & VR_ISR_TX_ABRT2) ||
- (status & VR_ISR_TX_ABRT)) {
- ifp->if_oerrors++;
- if (sc->vr_cdata.vr_tx_cons->vr_mbuf != NULL) {
- VR_SETBIT16(sc, VR_COMMAND, VR_CMD_TX_ON);
- VR_SETBIT16(sc, VR_COMMAND, VR_CMD_TX_GO);
- }
- }
- }
-}
-#endif /* DEVICE_POLLING */
-
-static void
-vr_intr(void *arg)
-{
- struct vr_softc *sc = arg;
- struct ifnet *ifp = sc->vr_ifp;
- uint16_t status;
-
- VR_LOCK(sc);
-
- if (sc->suspended) {
- /*
- * Forcibly disable interrupts.
- * XXX: Mobile VIA based platforms may need
- * interrupt re-enable on resume.
- */
- CSR_WRITE_2(sc, VR_IMR, 0x0000);
- goto done_locked;
- }
-
-#ifdef DEVICE_POLLING
- if (ifp->if_flags & IFF_POLLING)
- goto done_locked;
-
- if ((ifp->if_capenable & IFCAP_POLLING) &&
- ether_poll_register(vr_poll, ifp)) {
- /* OK, disable interrupts. */
- CSR_WRITE_2(sc, VR_IMR, 0x0000);
- vr_poll_locked(ifp, 0, 1);
- goto done_locked;
- }
-#endif /* DEVICE_POLLING */
-
- /* Suppress unwanted interrupts. */
- if (!(ifp->if_flags & IFF_UP)) {
- vr_stop(sc);
- goto done_locked;
- }
-
- /* Disable interrupts. */
- CSR_WRITE_2(sc, VR_IMR, 0x0000);
-
- for (;;) {
- status = CSR_READ_2(sc, VR_ISR);
- if (status)
- CSR_WRITE_2(sc, VR_ISR, status);
-
- if ((status & VR_INTRS) == 0)
- break;
-
- if (status & VR_ISR_RX_OK)
- vr_rxeof(sc);
-
- if (status & VR_ISR_RX_DROPPED) {
- printf("vr%d: rx packet lost\n", sc->vr_unit);
- ifp->if_ierrors++;
- }
-
- if ((status & VR_ISR_RX_ERR) || (status & VR_ISR_RX_NOBUF) ||
- (status & VR_ISR_RX_NOBUF) || (status & VR_ISR_RX_OFLOW)) {
- printf("vr%d: receive error (%04x)",
- sc->vr_unit, status);
- if (status & VR_ISR_RX_NOBUF)
- printf(" no buffers");
- if (status & VR_ISR_RX_OFLOW)
- printf(" overflow");
- if (status & VR_ISR_RX_DROPPED)
- printf(" packet lost");
- printf("\n");
- vr_rxeoc(sc);
- }
-
- if ((status & VR_ISR_BUSERR) || (status & VR_ISR_TX_UNDERRUN)) {
- vr_reset(sc);
- vr_init_locked(sc);
- break;
- }
-
- if ((status & VR_ISR_TX_OK) || (status & VR_ISR_TX_ABRT) ||
- (status & VR_ISR_TX_ABRT2) || (status & VR_ISR_UDFI)) {
- vr_txeof(sc);
- if ((status & VR_ISR_UDFI) ||
- (status & VR_ISR_TX_ABRT2) ||
- (status & VR_ISR_TX_ABRT)) {
- ifp->if_oerrors++;
- if (sc->vr_cdata.vr_tx_cons->vr_mbuf != NULL) {
- VR_SETBIT16(sc, VR_COMMAND,
- VR_CMD_TX_ON);
- VR_SETBIT16(sc, VR_COMMAND,
- VR_CMD_TX_GO);
- }
- }
- }
- }
-
- /* Re-enable interrupts. */
- CSR_WRITE_2(sc, VR_IMR, VR_INTRS);
-
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- vr_start_locked(ifp);
-
-done_locked:
- VR_UNLOCK(sc);
-}
-
-/*
- * Encapsulate an mbuf chain in a descriptor by coupling the mbuf data
- * pointers to the fragment pointers.
- */
-static int
-vr_encap(struct vr_softc *sc, struct vr_chain *c, struct mbuf *m_head)
-{
- struct vr_desc *f = NULL;
- struct mbuf *m;
-
- VR_LOCK_ASSERT(sc);
- /*
- * The VIA Rhine wants packet buffers to be longword
- * aligned, but very often our mbufs aren't. Rather than
- * waste time trying to decide when to copy and when not
- * to copy, just do it all the time.
- */
- m = m_defrag(m_head, M_DONTWAIT);
- if (m == NULL)
- return (1);
-
- /*
- * The Rhine chip doesn't auto-pad, so we have to make
- * sure to pad short frames out to the minimum frame length
- * ourselves.
- */
- if (m->m_len < VR_MIN_FRAMELEN) {
- m->m_pkthdr.len += VR_MIN_FRAMELEN - m->m_len;
- m->m_len = m->m_pkthdr.len;
- }
-
- c->vr_mbuf = m;
- f = c->vr_ptr;
- f->vr_data = vtophys(mtod(m, caddr_t));
- f->vr_ctl = m->m_len;
- f->vr_ctl |= VR_TXCTL_TLINK|VR_TXCTL_FIRSTFRAG;
- f->vr_status = 0;
- f->vr_ctl |= VR_TXCTL_LASTFRAG|VR_TXCTL_FINT;
- f->vr_next = vtophys(c->vr_nextdesc->vr_ptr);
-
- return (0);
-}
-
-/*
- * Main transmit routine. To avoid having to do mbuf copies, we put pointers
- * to the mbuf data regions directly in the transmit lists. We also save a
- * copy of the pointers since the transmit list fragment pointers are
- * physical addresses.
- */
-
-static void
-vr_start(struct ifnet *ifp)
-{
- struct vr_softc *sc = ifp->if_softc;
-
- VR_LOCK(sc);
- vr_start_locked(ifp);
- VR_UNLOCK(sc);
-}
-
-static void
-vr_start_locked(struct ifnet *ifp)
-{
- struct vr_softc *sc = ifp->if_softc;
- struct mbuf *m_head;
- struct vr_chain *cur_tx;
-
- if (ifp->if_flags & IFF_OACTIVE)
- return;
-
- cur_tx = sc->vr_cdata.vr_tx_prod;
- while (cur_tx->vr_mbuf == NULL) {
- IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
- if (m_head == NULL)
- break;
-
- /* Pack the data into the descriptor. */
- if (vr_encap(sc, cur_tx, m_head)) {
- /* Rollback, send what we were able to encap. */
- IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
- break;
- }
-
- VR_TXOWN(cur_tx) = VR_TXSTAT_OWN;
-
- /*
- * If there's a BPF listener, bounce a copy of this frame
- * to him.
- */
- BPF_MTAP(ifp, cur_tx->vr_mbuf);
-
- cur_tx = cur_tx->vr_nextdesc;
- }
- if (cur_tx != sc->vr_cdata.vr_tx_prod || cur_tx->vr_mbuf != NULL) {
- sc->vr_cdata.vr_tx_prod = cur_tx;
-
- /* Tell the chip to start transmitting. */
- VR_SETBIT16(sc, VR_COMMAND, /*VR_CMD_TX_ON|*/ VR_CMD_TX_GO);
-
- /* Set a timeout in case the chip goes out to lunch. */
- ifp->if_timer = 5;
-
- if (cur_tx->vr_mbuf != NULL)
- ifp->if_flags |= IFF_OACTIVE;
- }
-}
-
-static void
-vr_init(void *xsc)
-{
- struct vr_softc *sc = xsc;
-
- VR_LOCK(sc);
- vr_init_locked(sc);
- VR_UNLOCK(sc);
-}
-
-static void
-vr_init_locked(struct vr_softc *sc)
-{
- struct ifnet *ifp = sc->vr_ifp;
- struct mii_data *mii;
- int i;
-
- VR_LOCK_ASSERT(sc);
-
- mii = device_get_softc(sc->vr_miibus);
-
- /* Cancel pending I/O and free all RX/TX buffers. */
- vr_stop(sc);
- vr_reset(sc);
-
- /* Set our station address. */
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- CSR_WRITE_1(sc, VR_PAR0 + i, IFP2ENADDR(sc->vr_ifp)[i]);
-
- /* Set DMA size. */
- VR_CLRBIT(sc, VR_BCR0, VR_BCR0_DMA_LENGTH);
- VR_SETBIT(sc, VR_BCR0, VR_BCR0_DMA_STORENFWD);
-
- /*
- * BCR0 and BCR1 can override the RXCFG and TXCFG registers,
- * so we must set both.
- */
- VR_CLRBIT(sc, VR_BCR0, VR_BCR0_RX_THRESH);
- VR_SETBIT(sc, VR_BCR0, VR_BCR0_RXTHRESH128BYTES);
-
- VR_CLRBIT(sc, VR_BCR1, VR_BCR1_TX_THRESH);
- VR_SETBIT(sc, VR_BCR1, VR_BCR1_TXTHRESHSTORENFWD);
-
- VR_CLRBIT(sc, VR_RXCFG, VR_RXCFG_RX_THRESH);
- VR_SETBIT(sc, VR_RXCFG, VR_RXTHRESH_128BYTES);
-
- VR_CLRBIT(sc, VR_TXCFG, VR_TXCFG_TX_THRESH);
- VR_SETBIT(sc, VR_TXCFG, VR_TXTHRESH_STORENFWD);
-
- /* Init circular RX list. */
- if (vr_list_rx_init(sc) == ENOBUFS) {
- printf(
-"vr%d: initialization failed: no memory for rx buffers\n", sc->vr_unit);
- vr_stop(sc);
- return;
- }
-
- /* Init tx descriptors. */
- vr_list_tx_init(sc);
-
- /* If we want promiscuous mode, set the allframes bit. */
- if (ifp->if_flags & IFF_PROMISC)
- VR_SETBIT(sc, VR_RXCFG, VR_RXCFG_RX_PROMISC);
- else
- VR_CLRBIT(sc, VR_RXCFG, VR_RXCFG_RX_PROMISC);
-
- /* Set capture broadcast bit to capture broadcast frames. */
- if (ifp->if_flags & IFF_BROADCAST)
- VR_SETBIT(sc, VR_RXCFG, VR_RXCFG_RX_BROAD);
- else
- VR_CLRBIT(sc, VR_RXCFG, VR_RXCFG_RX_BROAD);
-
- /*
- * Program the multicast filter, if necessary.
- */
- vr_setmulti(sc);
-
- /*
- * Load the address of the RX list.
- */
- CSR_WRITE_4(sc, VR_RXADDR, vtophys(sc->vr_cdata.vr_rx_head->vr_ptr));
-
- /* Enable receiver and transmitter. */
- CSR_WRITE_2(sc, VR_COMMAND, VR_CMD_TX_NOPOLL|VR_CMD_START|
- VR_CMD_TX_ON|VR_CMD_RX_ON|
- VR_CMD_RX_GO);
-
- CSR_WRITE_4(sc, VR_TXADDR, vtophys(&sc->vr_ldata->vr_tx_list[0]));
-
- CSR_WRITE_2(sc, VR_ISR, 0xFFFF);
-#ifdef DEVICE_POLLING
- /*
- * Disable interrupts if we are polling.
- */
- if (ifp->if_flags & IFF_POLLING)
- CSR_WRITE_2(sc, VR_IMR, 0);
- else
-#endif /* DEVICE_POLLING */
- /*
- * Enable interrupts.
- */
- CSR_WRITE_2(sc, VR_IMR, VR_INTRS);
-
- mii_mediachg(mii);
-
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- sc->vr_stat_ch = timeout(vr_tick, sc, hz);
-}
-
-/*
- * Set media options.
- */
-static int
-vr_ifmedia_upd(struct ifnet *ifp)
-{
- struct vr_softc *sc = ifp->if_softc;
-
- if (ifp->if_flags & IFF_UP)
- vr_init(sc);
-
- return (0);
-}
-
-/*
- * Report current media status.
- */
-static void
-vr_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
-{
- struct vr_softc *sc = ifp->if_softc;
- struct mii_data *mii;
-
- mii = device_get_softc(sc->vr_miibus);
- VR_LOCK(sc);
- mii_pollstat(mii);
- VR_UNLOCK(sc);
- ifmr->ifm_active = mii->mii_media_active;
- ifmr->ifm_status = mii->mii_media_status;
-}
-
-static int
-vr_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
-{
- struct vr_softc *sc = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *) data;
- struct mii_data *mii;
- int error = 0;
-
- switch (command) {
- case SIOCSIFFLAGS:
- VR_LOCK(sc);
- if (ifp->if_flags & IFF_UP) {
- vr_init_locked(sc);
- } else {
- if (ifp->if_flags & IFF_RUNNING)
- vr_stop(sc);
- }
- VR_UNLOCK(sc);
- error = 0;
- break;
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- VR_LOCK(sc);
- vr_setmulti(sc);
- VR_UNLOCK(sc);
- error = 0;
- break;
- case SIOCGIFMEDIA:
- case SIOCSIFMEDIA:
- mii = device_get_softc(sc->vr_miibus);
- error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
- break;
- case SIOCSIFCAP:
- ifp->if_capenable = ifr->ifr_reqcap;
- break;
- default:
- error = ether_ioctl(ifp, command, data);
- break;
- }
-
- return (error);
-}
-
-static void
-vr_watchdog(struct ifnet *ifp)
-{
- struct vr_softc *sc = ifp->if_softc;
-
- VR_LOCK(sc);
-
- ifp->if_oerrors++;
- printf("vr%d: watchdog timeout\n", sc->vr_unit);
-
- vr_stop(sc);
- vr_reset(sc);
- vr_init_locked(sc);
-
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- vr_start_locked(ifp);
-
- VR_UNLOCK(sc);
-}
-
-/*
- * Stop the adapter and free any mbufs allocated to the
- * RX and TX lists.
- */
-static void
-vr_stop(struct vr_softc *sc)
-{
- register int i;
- struct ifnet *ifp;
-
- VR_LOCK_ASSERT(sc);
-
- ifp = sc->vr_ifp;
- ifp->if_timer = 0;
-
- untimeout(vr_tick, sc, sc->vr_stat_ch);
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
-#ifdef DEVICE_POLLING
- ether_poll_deregister(ifp);
-#endif /* DEVICE_POLLING */
-
- VR_SETBIT16(sc, VR_COMMAND, VR_CMD_STOP);
- VR_CLRBIT16(sc, VR_COMMAND, (VR_CMD_RX_ON|VR_CMD_TX_ON));
- CSR_WRITE_2(sc, VR_IMR, 0x0000);
- CSR_WRITE_4(sc, VR_TXADDR, 0x00000000);
- CSR_WRITE_4(sc, VR_RXADDR, 0x00000000);
-
- /*
- * Free data in the RX lists.
- */
- for (i = 0; i < VR_RX_LIST_CNT; i++) {
- if (sc->vr_cdata.vr_rx_chain[i].vr_mbuf != NULL) {
- m_freem(sc->vr_cdata.vr_rx_chain[i].vr_mbuf);
- sc->vr_cdata.vr_rx_chain[i].vr_mbuf = NULL;
- }
- }
- bzero((char *)&sc->vr_ldata->vr_rx_list,
- sizeof(sc->vr_ldata->vr_rx_list));
-
- /*
- * Free the TX list buffers.
- */
- for (i = 0; i < VR_TX_LIST_CNT; i++) {
- if (sc->vr_cdata.vr_tx_chain[i].vr_mbuf != NULL) {
- m_freem(sc->vr_cdata.vr_tx_chain[i].vr_mbuf);
- sc->vr_cdata.vr_tx_chain[i].vr_mbuf = NULL;
- }
- }
- bzero((char *)&sc->vr_ldata->vr_tx_list,
- sizeof(sc->vr_ldata->vr_tx_list));
-}
-
-/*
- * Stop all chip I/O so that the kernel's probe routines don't
- * get confused by errant DMAs when rebooting.
- */
-static void
-vr_shutdown(device_t dev)
-{
-
- vr_detach(dev);
-}
diff --git a/sys/dev/vr/if_vrreg.h b/sys/dev/vr/if_vrreg.h
deleted file mode 100644
index 7d42656..0000000
--- a/sys/dev/vr/if_vrreg.h
+++ /dev/null
@@ -1,598 +0,0 @@
-/*-
- * Copyright (c) 1997, 1998
- * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Bill Paul.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * Rhine register definitions.
- */
-
-#define VR_PAR0 0x00 /* node address 0 to 4 */
-#define VR_PAR1 0x04 /* node address 2 to 6 */
-#define VR_RXCFG 0x06 /* receiver config register */
-#define VR_TXCFG 0x07 /* transmit config register */
-#define VR_COMMAND 0x08 /* command register */
-#define VR_ISR 0x0C /* interrupt/status register */
-#define VR_IMR 0x0E /* interrupt mask register */
-#define VR_MAR0 0x10 /* multicast hash 0 */
-#define VR_MAR1 0x14 /* multicast hash 1 */
-#define VR_RXADDR 0x18 /* rx descriptor list start addr */
-#define VR_TXADDR 0x1C /* tx descriptor list start addr */
-#define VR_CURRXDESC0 0x20
-#define VR_CURRXDESC1 0x24
-#define VR_CURRXDESC2 0x28
-#define VR_CURRXDESC3 0x2C
-#define VR_NEXTRXDESC0 0x30
-#define VR_NEXTRXDESC1 0x34
-#define VR_NEXTRXDESC2 0x38
-#define VR_NEXTRXDESC3 0x3C
-#define VR_CURTXDESC0 0x40
-#define VR_CURTXDESC1 0x44
-#define VR_CURTXDESC2 0x48
-#define VR_CURTXDESC3 0x4C
-#define VR_NEXTTXDESC0 0x50
-#define VR_NEXTTXDESC1 0x54
-#define VR_NEXTTXDESC2 0x58
-#define VR_NEXTTXDESC3 0x5C
-#define VR_CURRXDMA 0x60 /* current RX DMA address */
-#define VR_CURTXDMA 0x64 /* current TX DMA address */
-#define VR_TALLYCNT 0x68 /* tally counter test register */
-#define VR_PHYADDR 0x6C
-#define VR_MIISTAT 0x6D
-#define VR_BCR0 0x6E
-#define VR_BCR1 0x6F
-#define VR_MIICMD 0x70
-#define VR_MIIADDR 0x71
-#define VR_MIIDATA 0x72
-#define VR_EECSR 0x74
-#define VR_TEST 0x75
-#define VR_GPIO 0x76
-#define VR_CONFIG 0x78
-#define VR_MPA_CNT 0x7C
-#define VR_CRC_CNT 0x7E
-#define VR_STICKHW 0x83
-
-/* Misc Registers */
-#define VR_MISC_CR1 0x81
-#define VR_MISCCR1_FORSRST 0x40
-
-/*
- * RX config bits.
- */
-#define VR_RXCFG_RX_ERRPKTS 0x01
-#define VR_RXCFG_RX_RUNT 0x02
-#define VR_RXCFG_RX_MULTI 0x04
-#define VR_RXCFG_RX_BROAD 0x08
-#define VR_RXCFG_RX_PROMISC 0x10
-#define VR_RXCFG_RX_THRESH 0xE0
-
-#define VR_RXTHRESH_32BYTES 0x00
-#define VR_RXTHRESH_64BYTES 0x20
-#define VR_RXTHRESH_128BYTES 0x40
-#define VR_RXTHRESH_256BYTES 0x60
-#define VR_RXTHRESH_512BYTES 0x80
-#define VR_RXTHRESH_768BYTES 0xA0
-#define VR_RXTHRESH_1024BYTES 0xC0
-#define VR_RXTHRESH_STORENFWD 0xE0
-
-/*
- * TX config bits.
- */
-#define VR_TXCFG_RSVD0 0x01
-#define VR_TXCFG_LOOPBKMODE 0x06
-#define VR_TXCFG_BACKOFF 0x08
-#define VR_TXCFG_RSVD1 0x10
-#define VR_TXCFG_TX_THRESH 0xE0
-
-#define VR_TXTHRESH_32BYTES 0x00
-#define VR_TXTHRESH_64BYTES 0x20
-#define VR_TXTHRESH_128BYTES 0x40
-#define VR_TXTHRESH_256BYTES 0x60
-#define VR_TXTHRESH_512BYTES 0x80
-#define VR_TXTHRESH_768BYTES 0xA0
-#define VR_TXTHRESH_1024BYTES 0xC0
-#define VR_TXTHRESH_STORENFWD 0xE0
-
-/*
- * Command register bits.
- */
-#define VR_CMD_INIT 0x0001
-#define VR_CMD_START 0x0002
-#define VR_CMD_STOP 0x0004
-#define VR_CMD_RX_ON 0x0008
-#define VR_CMD_TX_ON 0x0010
-#define VR_CMD_TX_GO 0x0020
-#define VR_CMD_RX_GO 0x0040
-#define VR_CMD_RSVD 0x0080
-#define VR_CMD_RX_EARLY 0x0100
-#define VR_CMD_TX_EARLY 0x0200
-#define VR_CMD_FULLDUPLEX 0x0400
-#define VR_CMD_TX_NOPOLL 0x0800
-
-#define VR_CMD_RESET 0x8000
-
-/*
- * Interrupt status bits.
- */
-#define VR_ISR_RX_OK 0x0001 /* packet rx ok */
-#define VR_ISR_TX_OK 0x0002 /* packet tx ok */
-#define VR_ISR_RX_ERR 0x0004 /* packet rx with err */
-#define VR_ISR_TX_ABRT 0x0008 /* tx aborted due to excess colls */
-#define VR_ISR_TX_UNDERRUN 0x0010 /* tx buffer underflow */
-#define VR_ISR_RX_NOBUF 0x0020 /* no rx buffer available */
-#define VR_ISR_BUSERR 0x0040 /* PCI bus error */
-#define VR_ISR_STATSOFLOW 0x0080 /* stats counter oflow */
-#define VR_ISR_RX_EARLY 0x0100 /* rx early */
-#define VR_ISR_LINKSTAT 0x0200 /* MII status change */
-#define VR_ISR_ETI 0x0200 /* Tx early (3043/3071) */
-#define VR_ISR_UDFI 0x0200 /* Tx FIFO underflow (3065) */
-#define VR_ISR_RX_OFLOW 0x0400 /* rx FIFO overflow */
-#define VR_ISR_RX_DROPPED 0x0800
-#define VR_ISR_RX_NOBUF2 0x1000
-#define VR_ISR_TX_ABRT2 0x2000
-#define VR_ISR_LINKSTAT2 0x4000
-#define VR_ISR_MAGICPACKET 0x8000
-
-/*
- * Interrupt mask bits.
- */
-#define VR_IMR_RX_OK 0x0001 /* packet rx ok */
-#define VR_IMR_TX_OK 0x0002 /* packet tx ok */
-#define VR_IMR_RX_ERR 0x0004 /* packet rx with err */
-#define VR_IMR_TX_ABRT 0x0008 /* tx aborted due to excess colls */
-#define VR_IMR_TX_UNDERRUN 0x0010 /* tx buffer underflow */
-#define VR_IMR_RX_NOBUF 0x0020 /* no rx buffer available */
-#define VR_IMR_BUSERR 0x0040 /* PCI bus error */
-#define VR_IMR_STATSOFLOW 0x0080 /* stats counter oflow */
-#define VR_IMR_RX_EARLY 0x0100 /* rx early */
-#define VR_IMR_LINKSTAT 0x0200 /* MII status change */
-#define VR_IMR_RX_OFLOW 0x0400 /* rx FIFO overflow */
-#define VR_IMR_RX_DROPPED 0x0800
-#define VR_IMR_RX_NOBUF2 0x1000
-#define VR_IMR_TX_ABRT2 0x2000
-#define VR_IMR_LINKSTAT2 0x4000
-#define VR_IMR_MAGICPACKET 0x8000
-
-#define VR_INTRS \
- (VR_IMR_RX_OK|VR_IMR_TX_OK|VR_IMR_RX_NOBUF| \
- VR_IMR_TX_ABRT|VR_IMR_TX_UNDERRUN|VR_IMR_BUSERR| \
- VR_IMR_RX_ERR|VR_ISR_RX_DROPPED)
-
-/*
- * MII status register.
- */
-
-#define VR_MIISTAT_SPEED 0x01
-#define VR_MIISTAT_LINKFAULT 0x02
-#define VR_MIISTAT_MGTREADERR 0x04
-#define VR_MIISTAT_MIIERR 0x08
-#define VR_MIISTAT_PHYOPT 0x10
-#define VR_MIISTAT_MDC_SPEED 0x20
-#define VR_MIISTAT_RSVD 0x40
-#define VR_MIISTAT_GPIO1POLL 0x80
-
-/*
- * MII command register bits.
- */
-#define VR_MIICMD_CLK 0x01
-#define VR_MIICMD_DATAOUT 0x02
-#define VR_MIICMD_DATAIN 0x04
-#define VR_MIICMD_DIR 0x08
-#define VR_MIICMD_DIRECTPGM 0x10
-#define VR_MIICMD_WRITE_ENB 0x20
-#define VR_MIICMD_READ_ENB 0x40
-#define VR_MIICMD_AUTOPOLL 0x80
-
-/*
- * EEPROM control bits.
- */
-#define VR_EECSR_DATAIN 0x01 /* data out */
-#define VR_EECSR_DATAOUT 0x02 /* data in */
-#define VR_EECSR_CLK 0x04 /* clock */
-#define VR_EECSR_CS 0x08 /* chip select */
-#define VR_EECSR_DPM 0x10
-#define VR_EECSR_LOAD 0x20
-#define VR_EECSR_EMBP 0x40
-#define VR_EECSR_EEPR 0x80
-
-#define VR_EECMD_WRITE 0x140
-#define VR_EECMD_READ 0x180
-#define VR_EECMD_ERASE 0x1c0
-
-/*
- * Test register bits.
- */
-#define VR_TEST_TEST0 0x01
-#define VR_TEST_TEST1 0x02
-#define VR_TEST_TEST2 0x04
-#define VR_TEST_TSTUD 0x08
-#define VR_TEST_TSTOV 0x10
-#define VR_TEST_BKOFF 0x20
-#define VR_TEST_FCOL 0x40
-#define VR_TEST_HBDES 0x80
-
-/*
- * Config register bits.
- */
-#define VR_CFG_GPIO2OUTENB 0x00000001
-#define VR_CFG_GPIO2OUT 0x00000002 /* gen. purp. pin */
-#define VR_CFG_GPIO2IN 0x00000004 /* gen. purp. pin */
-#define VR_CFG_AUTOOPT 0x00000008 /* enable rx/tx autopoll */
-#define VR_CFG_MIIOPT 0x00000010
-#define VR_CFG_MMIENB 0x00000020 /* memory mapped mode enb */
-#define VR_CFG_JUMPER 0x00000040 /* PHY and oper. mode select */
-#define VR_CFG_EELOAD 0x00000080 /* enable EEPROM programming */
-#define VR_CFG_LATMENB 0x00000100 /* larency timer effect enb. */
-#define VR_CFG_MRREADWAIT 0x00000200
-#define VR_CFG_MRWRITEWAIT 0x00000400
-#define VR_CFG_RX_ARB 0x00000800
-#define VR_CFG_TX_ARB 0x00001000
-#define VR_CFG_READMULTI 0x00002000
-#define VR_CFG_TX_PACE 0x00004000
-#define VR_CFG_TX_QDIS 0x00008000
-#define VR_CFG_ROMSEL0 0x00010000
-#define VR_CFG_ROMSEL1 0x00020000
-#define VR_CFG_ROMSEL2 0x00040000
-#define VR_CFG_ROMTIMESEL 0x00080000
-#define VR_CFG_RSVD0 0x00100000
-#define VR_CFG_ROMDLY 0x00200000
-#define VR_CFG_ROMOPT 0x00400000
-#define VR_CFG_RSVD1 0x00800000
-#define VR_CFG_BACKOFFOPT 0x01000000
-#define VR_CFG_BACKOFFMOD 0x02000000
-#define VR_CFG_CAPEFFECT 0x04000000
-#define VR_CFG_BACKOFFRAND 0x08000000
-#define VR_CFG_MAGICKPACKET 0x10000000
-#define VR_CFG_PCIREADLINE 0x20000000
-#define VR_CFG_DIAG 0x40000000
-#define VR_CFG_GPIOEN 0x80000000
-
-/* Sticky HW bits */
-#define VR_STICKHW_DS0 0x01
-#define VR_STICKHW_DS1 0x02
-#define VR_STICKHW_WOL_ENB 0x04
-#define VR_STICKHW_WOL_STS 0x08
-#define VR_STICKHW_LEGWOL_ENB 0x80
-
-/*
- * BCR0 register bits. (At least for the VT6102 chip.)
- */
-#define VR_BCR0_DMA_LENGTH 0x07
-
-#define VR_BCR0_DMA_32BYTES 0x00
-#define VR_BCR0_DMA_64BYTES 0x01
-#define VR_BCR0_DMA_128BYTES 0x02
-#define VR_BCR0_DMA_256BYTES 0x03
-#define VR_BCR0_DMA_512BYTES 0x04
-#define VR_BCR0_DMA_1024BYTES 0x05
-#define VR_BCR0_DMA_STORENFWD 0x07
-
-#define VR_BCR0_RX_THRESH 0x38
-
-#define VR_BCR0_RXTHRESHCFG 0x00
-#define VR_BCR0_RXTHRESH64BYTES 0x08
-#define VR_BCR0_RXTHRESH128BYTES 0x10
-#define VR_BCR0_RXTHRESH256BYTES 0x18
-#define VR_BCR0_RXTHRESH512BYTES 0x20
-#define VR_BCR0_RXTHRESH1024BYTES 0x28
-#define VR_BCR0_RXTHRESHSTORENFWD 0x38
-#define VR_BCR0_EXTLED 0x40
-#define VR_BCR0_MED2 0x80
-
-/*
- * BCR1 register bits. (At least for the VT6102 chip.)
- */
-#define VR_BCR1_POT0 0x01
-#define VR_BCR1_POT1 0x02
-#define VR_BCR1_POT2 0x04
-#define VR_BCR1_TX_THRESH 0x38
-#define VR_BCR1_TXTHRESHCFG 0x00
-#define VR_BCR1_TXTHRESH64BYTES 0x08
-#define VR_BCR1_TXTHRESH128BYTES 0x10
-#define VR_BCR1_TXTHRESH256BYTES 0x18
-#define VR_BCR1_TXTHRESH512BYTES 0x20
-#define VR_BCR1_TXTHRESH1024BYTES 0x28
-#define VR_BCR1_TXTHRESHSTORENFWD 0x38
-
-/*
- * Rhine TX/RX list structure.
- */
-
-struct vr_desc {
- u_int32_t vr_status;
- u_int32_t vr_ctl;
- u_int32_t vr_ptr1;
- u_int32_t vr_ptr2;
-};
-
-#define vr_data vr_ptr1
-#define vr_next vr_ptr2
-
-
-#define VR_RXSTAT_RXERR 0x00000001
-#define VR_RXSTAT_CRCERR 0x00000002
-#define VR_RXSTAT_FRAMEALIGNERR 0x00000004
-#define VR_RXSTAT_FIFOOFLOW 0x00000008
-#define VR_RXSTAT_GIANT 0x00000010
-#define VR_RXSTAT_RUNT 0x00000020
-#define VR_RXSTAT_BUSERR 0x00000040
-#define VR_RXSTAT_BUFFERR 0x00000080
-#define VR_RXSTAT_LASTFRAG 0x00000100
-#define VR_RXSTAT_FIRSTFRAG 0x00000200
-#define VR_RXSTAT_RLINK 0x00000400
-#define VR_RXSTAT_RX_PHYS 0x00000800
-#define VR_RXSTAT_RX_BROAD 0x00001000
-#define VR_RXSTAT_RX_MULTI 0x00002000
-#define VR_RXSTAT_RX_OK 0x00004000
-#define VR_RXSTAT_RXLEN 0x07FF0000
-#define VR_RXSTAT_RXLEN_EXT 0x78000000
-#define VR_RXSTAT_OWN 0x80000000
-
-#define VR_RXBYTES(x) ((x & VR_RXSTAT_RXLEN) >> 16)
-#define VR_RXSTAT (VR_RXSTAT_FIRSTFRAG|VR_RXSTAT_LASTFRAG|VR_RXSTAT_OWN)
-
-#define VR_RXCTL_BUFLEN 0x000007FF
-#define VR_RXCTL_BUFLEN_EXT 0x00007800
-#define VR_RXCTL_CHAIN 0x00008000
-#define VR_RXCTL_RX_INTR 0x00800000
-
-#define VR_RXCTL (VR_RXCTL_CHAIN|VR_RXCTL_RX_INTR)
-
-#define VR_TXSTAT_DEFER 0x00000001
-#define VR_TXSTAT_UNDERRUN 0x00000002
-#define VR_TXSTAT_COLLCNT 0x00000078
-#define VR_TXSTAT_SQE 0x00000080
-#define VR_TXSTAT_ABRT 0x00000100
-#define VR_TXSTAT_LATECOLL 0x00000200
-#define VR_TXSTAT_CARRLOST 0x00000400
-#define VR_TXSTAT_UDF 0x00000800
-#define VR_TXSTAT_BUSERR 0x00002000
-#define VR_TXSTAT_JABTIMEO 0x00004000
-#define VR_TXSTAT_ERRSUM 0x00008000
-#define VR_TXSTAT_OWN 0x80000000
-
-#define VR_TXCTL_BUFLEN 0x000007FF
-#define VR_TXCTL_BUFLEN_EXT 0x00007800
-#define VR_TXCTL_TLINK 0x00008000
-#define VR_TXCTL_FIRSTFRAG 0x00200000
-#define VR_TXCTL_LASTFRAG 0x00400000
-#define VR_TXCTL_FINT 0x00800000
-
-
-#define VR_MAXFRAGS 16
-#define VR_RX_LIST_CNT 64
-#define VR_TX_LIST_CNT 128
-#define VR_MIN_FRAMELEN 60
-#define VR_FRAMELEN 1536
-#define VR_RXLEN 1520
-
-#define VR_TXOWN(x) x->vr_ptr->vr_status
-
-struct vr_list_data {
- struct vr_desc vr_rx_list[VR_RX_LIST_CNT];
- struct vr_desc vr_tx_list[VR_TX_LIST_CNT];
-};
-
-struct vr_chain {
- struct vr_desc *vr_ptr;
- struct mbuf *vr_mbuf;
- struct vr_chain *vr_nextdesc;
-};
-
-struct vr_chain_onefrag {
- struct vr_desc *vr_ptr;
- struct mbuf *vr_mbuf;
- struct vr_chain_onefrag *vr_nextdesc;
-};
-
-struct vr_chain_data {
- struct vr_chain_onefrag vr_rx_chain[VR_RX_LIST_CNT];
- struct vr_chain vr_tx_chain[VR_TX_LIST_CNT];
-
- struct vr_chain_onefrag *vr_rx_head;
-
- struct vr_chain *vr_tx_cons;
- struct vr_chain *vr_tx_prod;
-};
-
-struct vr_type {
- u_int16_t vr_vid;
- u_int16_t vr_did;
- char *vr_name;
-};
-
-struct vr_mii_frame {
- u_int8_t mii_stdelim;
- u_int8_t mii_opcode;
- u_int8_t mii_phyaddr;
- u_int8_t mii_regaddr;
- u_int8_t mii_turnaround;
- u_int16_t mii_data;
-};
-
-/*
- * MII constants
- */
-#define VR_MII_STARTDELIM 0x01
-#define VR_MII_READOP 0x02
-#define VR_MII_WRITEOP 0x01
-#define VR_MII_TURNAROUND 0x02
-
-#define VR_FLAG_FORCEDELAY 1
-#define VR_FLAG_SCHEDDELAY 2
-#define VR_FLAG_DELAYTIMEO 3
-
-struct vr_softc {
- struct ifnet *vr_ifp; /* interface info */
- bus_space_handle_t vr_bhandle; /* bus space handle */
- bus_space_tag_t vr_btag; /* bus space tag */
- struct resource *vr_res;
- struct resource *vr_irq;
- void *vr_intrhand;
- device_t vr_miibus;
- struct vr_type *vr_info; /* Rhine adapter info */
- u_int8_t vr_unit; /* interface number */
- u_int8_t vr_type;
- u_int8_t vr_revid; /* Rhine chip revision */
- u_int8_t vr_flags; /* See VR_F_* below */
- struct vr_list_data *vr_ldata;
- struct vr_chain_data vr_cdata;
- struct callout_handle vr_stat_ch;
- struct mtx vr_mtx;
- int suspended; /* if 1, sleeping/detaching */
-#ifdef DEVICE_POLLING
- int rxcycles;
-#endif
-};
-
-#define VR_F_RESTART 0x01 /* Restart unit on next tick */
-
-#define VR_LOCK(_sc) mtx_lock(&(_sc)->vr_mtx)
-#define VR_UNLOCK(_sc) mtx_unlock(&(_sc)->vr_mtx)
-#define VR_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->vr_mtx, MA_OWNED)
-
-/*
- * register space access macros
- */
-#define CSR_WRITE_4(sc, reg, val) \
- bus_space_write_4(sc->vr_btag, sc->vr_bhandle, reg, val)
-#define CSR_WRITE_2(sc, reg, val) \
- bus_space_write_2(sc->vr_btag, sc->vr_bhandle, reg, val)
-#define CSR_WRITE_1(sc, reg, val) \
- bus_space_write_1(sc->vr_btag, sc->vr_bhandle, reg, val)
-
-#define CSR_READ_4(sc, reg) \
- bus_space_read_4(sc->vr_btag, sc->vr_bhandle, reg)
-#define CSR_READ_2(sc, reg) \
- bus_space_read_2(sc->vr_btag, sc->vr_bhandle, reg)
-#define CSR_READ_1(sc, reg) \
- bus_space_read_1(sc->vr_btag, sc->vr_bhandle, reg)
-
-#define VR_TIMEOUT 1000
-#define ETHER_ALIGN 2
-
-/*
- * General constants that are fun to know.
- *
- * VIA vendor ID
- */
-#define VIA_VENDORID 0x1106
-
-/*
- * VIA Rhine device IDs.
- */
-#define VIA_DEVICEID_RHINE 0x3043
-#define VIA_DEVICEID_RHINE_II 0x6100
-#define VIA_DEVICEID_RHINE_II_2 0x3065
-#define VIA_DEVICEID_RHINE_III 0x3106
-#define VIA_DEVICEID_RHINE_III_M 0x3053
-
-/*
- * Delta Electronics device ID.
- */
-#define DELTA_VENDORID 0x1500
-
-/*
- * Delta device IDs.
- */
-#define DELTA_DEVICEID_RHINE_II 0x1320
-
-/*
- * Addtron vendor ID.
- */
-#define ADDTRON_VENDORID 0x4033
-
-/*
- * Addtron device IDs.
- */
-#define ADDTRON_DEVICEID_RHINE_II 0x1320
-
-/*
- * VIA Rhine revision IDs
- */
-
-#define REV_ID_VT3043_E 0x04
-#define REV_ID_VT3071_A 0x20
-#define REV_ID_VT3071_B 0x21
-#define REV_ID_VT3065_A 0x40
-#define REV_ID_VT3065_B 0x41
-#define REV_ID_VT3065_C 0x42
-#define REV_ID_VT6102_APOLLO 0x74
-#define REV_ID_VT3106 0x80
-#define REV_ID_VT3106_J 0x80 /* 0x80-0x8F */
-#define REV_ID_VT3106_S 0x90 /* 0x90-0xA0 */
-
-/*
- * PCI low memory base and low I/O base register, and
- * other PCI registers.
- */
-
-#define VR_PCI_VENDOR_ID 0x00
-#define VR_PCI_DEVICE_ID 0x02
-#define VR_PCI_COMMAND 0x04
-#define VR_PCI_STATUS 0x06
-#define VR_PCI_REVID 0x08
-#define VR_PCI_CLASSCODE 0x09
-#define VR_PCI_LATENCY_TIMER 0x0D
-#define VR_PCI_HEADER_TYPE 0x0E
-#define VR_PCI_LOIO 0x10
-#define VR_PCI_LOMEM 0x14
-#define VR_PCI_BIOSROM 0x30
-#define VR_PCI_INTLINE 0x3C
-#define VR_PCI_INTPIN 0x3D
-#define VR_PCI_MINGNT 0x3E
-#define VR_PCI_MINLAT 0x0F
-#define VR_PCI_RESETOPT 0x48
-#define VR_PCI_EEPROM_DATA 0x4C
-#define VR_PCI_MODE 0x50
-
-#define VR_MODE3_MIION 0x04
-
-/* power management registers */
-#define VR_PCI_CAPID 0xDC /* 8 bits */
-#define VR_PCI_NEXTPTR 0xDD /* 8 bits */
-#define VR_PCI_PWRMGMTCAP 0xDE /* 16 bits */
-#define VR_PCI_PWRMGMTCTRL 0xE0 /* 16 bits */
-
-#define VR_PSTATE_MASK 0x0003
-#define VR_PSTATE_D0 0x0000
-#define VR_PSTATE_D1 0x0002
-#define VR_PSTATE_D2 0x0002
-#define VR_PSTATE_D3 0x0003
-#define VR_PME_EN 0x0010
-#define VR_PME_STATUS 0x8000
-
-
-#ifdef __alpha__
-#undef vtophys
-#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va)
-#endif
diff --git a/sys/fs/cd9660/TODO b/sys/fs/cd9660/TODO
deleted file mode 100644
index b8d7f3e..0000000
--- a/sys/fs/cd9660/TODO
+++ /dev/null
@@ -1,43 +0,0 @@
-# $FreeBSD$
-
- 2) should understand Rock Ridge
-
- Yes, we have follows function.
-
- o Symbolic Link
- o Real Name(long name)
- o File Attribute
- o Time stamp
- o uid, gid
- o Devices
- o Relocated directories
-
- Except follows:
-
- o POSIX device number mapping
-
- There is some preliminary stuff in there that (ab-)uses the mknod
- system call, but this needs a writable filesystem
-
- 5) should have name translation enabled by mount flag
-
- Yes. we can disable the Rock Ridge Extension by follows option;
-
- "mount -t isofs -o -norrip /dev/cd0d /cdrom"
-
- 6) should run as a user process, and not take up kernel space (cdroms
- are slow)
-
- Not yet.
-
- 7) ECMA support.
-
- Not yet. we need not only a technical spec but also ECMA format
- cd-rom itself!
-
- 8) Character set change by SVD ( multi SVD support )
-
- Not yet. We should also hack the other part of system as 8 bit
- clean. As far as I know, if you export the cdrom by NFS, the client
- can access the 8 bit clean (ie. Solaris Japanese with EUC code )
-
diff --git a/sys/fs/cd9660/TODO.hibler b/sys/fs/cd9660/TODO.hibler
deleted file mode 100644
index e0842da..0000000
--- a/sys/fs/cd9660/TODO.hibler
+++ /dev/null
@@ -1,16 +0,0 @@
-$FreeBSD$
-
-1. Investiate making ISOFS another UFS shared filesystem (ala FFS/MFS/LFS).
- Since it was modelled after the inode code, we might be able to merge
- them back. It looks like a separate (but very similar) lookup routine
- will be needed due to the associated file stuff.
-
-2. It would be nice to be able to use the vfs_cluster code.
- Unfortunately, if the logical block size is smaller than the page size,
- it won't work. Also, if throughtput is relatively constant for any
- block size (as it is for the HP drive--150kbs) then clustering may not
- buy much (or may even hurt when vfs_cluster comes up with a large sync
- cluster).
-
-3. Seems like there should be a "notrans" or some such mount option to show
- filenames as they really are without lower-casing. Does this make sense?
diff --git a/sys/fs/cd9660/cd9660_bmap.c b/sys/fs/cd9660/cd9660_bmap.c
deleted file mode 100644
index 147f445..0000000
--- a/sys/fs/cd9660/cd9660_bmap.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cd9660_bmap.c 8.3 (Berkeley) 1/23/94
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-
-#include <isofs/cd9660/iso.h>
-#include <isofs/cd9660/cd9660_node.h>
-
-/*
- * Bmap converts a the logical block number of a file to its physical block
- * number on the disk. The conversion is done by using the logical block
- * number to index into the data block (extent) for the file.
- */
-int
-cd9660_bmap(ap)
- struct vop_bmap_args /* {
- struct vnode *a_vp;
- daddr_t a_bn;
- struct bufobj **a_bop;
- daddr_t *a_bnp;
- int *a_runp;
- int *a_runb;
- } */ *ap;
-{
- struct iso_node *ip = VTOI(ap->a_vp);
- daddr_t lblkno = ap->a_bn;
- int bshift;
-
- /*
- * Check for underlying vnode requests and ensure that logical
- * to physical mapping is requested.
- */
- if (ap->a_bop != NULL)
- *ap->a_bop = &ip->i_mnt->im_devvp->v_bufobj;
- if (ap->a_bnp == NULL)
- return (0);
-
- /*
- * Compute the requested block number
- */
- bshift = ip->i_mnt->im_bshift;
- *ap->a_bnp = (ip->iso_start + lblkno) << (bshift - DEV_BSHIFT);
-
- /*
- * Determine maximum number of readahead blocks following the
- * requested block.
- */
- if (ap->a_runp) {
- int nblk;
-
- nblk = (ip->i_size >> bshift) - (lblkno + 1);
- if (nblk <= 0)
- *ap->a_runp = 0;
- else if (nblk >= (MAXBSIZE >> bshift))
- *ap->a_runp = (MAXBSIZE >> bshift) - 1;
- else
- *ap->a_runp = nblk;
- }
-
- if (ap->a_runb) {
- *ap->a_runb = 0;
- }
-
- return 0;
-}
diff --git a/sys/fs/cd9660/cd9660_iconv.c b/sys/fs/cd9660/cd9660_iconv.c
deleted file mode 100644
index 43a5a0d..0000000
--- a/sys/fs/cd9660/cd9660_iconv.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * Copyright (c) 2003 Ryuichiro Imura
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/mount.h>
-#include <sys/iconv.h>
-
-VFS_DECLARE_ICONV(cd9660);
diff --git a/sys/fs/cd9660/cd9660_lookup.c b/sys/fs/cd9660/cd9660_lookup.c
deleted file mode 100644
index b89e670..0000000
--- a/sys/fs/cd9660/cd9660_lookup.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/*-
- * Copyright (c) 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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_lookup.c 7.33 (Berkeley) 5/19/91
- * @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-
-#include <isofs/cd9660/iso.h>
-#include <isofs/cd9660/cd9660_node.h>
-#include <isofs/cd9660/iso_rrip.h>
-
-/*
- * Convert a component of a pathname into a pointer to a locked inode.
- * This is a very central and rather complicated routine.
- * If the filesystem is not maintained in a strict tree hierarchy,
- * this can result in a deadlock situation (see comments in code below).
- *
- * The flag argument is LOOKUP, CREATE, RENAME, or DELETE depending on
- * whether the name is to be looked up, created, renamed, or deleted.
- * When CREATE, RENAME, or DELETE is specified, information usable in
- * creating, renaming, or deleting a directory entry may be calculated.
- * If flag has LOCKPARENT or'ed into it and the target of the pathname
- * exists, lookup returns both the target and its parent directory locked.
- * When creating or renaming and LOCKPARENT is specified, the target may
- * not be ".". When deleting and LOCKPARENT is specified, the target may
- * be "."., but the caller must check to ensure it does an vrele and iput
- * instead of two iputs.
- *
- * Overall outline of ufs_lookup:
- *
- * search for name in directory, to found or notfound
- * notfound:
- * if creating, return locked directory, leaving info on available slots
- * else return error
- * found:
- * if at end of path and deleting, return information to allow delete
- * if at end of path and rewriting (RENAME and LOCKPARENT), lock target
- * inode and return info to allow rewrite
- * if not at end, add name to cache; if at end and neither creating
- * nor deleting, add name to cache
- *
- * NOTE: (LOOKUP | LOCKPARENT) currently returns the parent inode unlocked.
- */
-int
-cd9660_lookup(ap)
- struct vop_cachedlookup_args /* {
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- struct vnode *vdp; /* vnode for directory being searched */
- struct iso_node *dp; /* inode for directory being searched */
- struct iso_mnt *imp; /* filesystem that directory is in */
- struct buf *bp; /* a buffer of directory entries */
- struct iso_directory_record *ep = 0;/* the current directory entry */
- int entryoffsetinblock; /* offset of ep in bp's buffer */
- int saveoffset = 0; /* offset of last directory entry in dir */
- int numdirpasses; /* strategy for directory search */
- doff_t endsearch; /* offset to end directory search */
- struct vnode *pdp; /* saved dp during symlink work */
- struct vnode *tdp; /* returned by cd9660_vget_internal */
- u_long bmask; /* block offset mask */
- int error;
- ino_t ino = 0;
- int reclen;
- u_short namelen;
- int isoflags;
- char altname[NAME_MAX];
- int res;
- int assoc, len;
- char *name;
- struct vnode **vpp = ap->a_vpp;
- struct componentname *cnp = ap->a_cnp;
- int flags = cnp->cn_flags;
- int nameiop = cnp->cn_nameiop;
- struct thread *td = cnp->cn_thread;
-
- bp = NULL;
- *vpp = NULL;
- vdp = ap->a_dvp;
- dp = VTOI(vdp);
- imp = dp->i_mnt;
-
- /*
- * We now have a segment name to search for, and a directory to search.
- */
-
- len = cnp->cn_namelen;
- name = cnp->cn_nameptr;
- /*
- * A leading `=' means, we are looking for an associated file
- */
- if ((assoc = (imp->iso_ftype != ISO_FTYPE_RRIP && *name == ASSOCCHAR)))
- {
- len--;
- name++;
- }
-
- /*
- * If there is cached information on a previous search of
- * this directory, pick up where we last left off.
- * We cache only lookups as these are the most common
- * and have the greatest payoff. Caching CREATE has little
- * benefit as it usually must search the entire directory
- * to determine that the entry does not exist. Caching the
- * location of the last DELETE or RENAME has not reduced
- * profiling time and hence has been removed in the interest
- * of simplicity.
- */
- bmask = imp->im_bmask;
- if (nameiop != LOOKUP || dp->i_diroff == 0 ||
- dp->i_diroff > dp->i_size) {
- entryoffsetinblock = 0;
- dp->i_offset = 0;
- numdirpasses = 1;
- } else {
- dp->i_offset = dp->i_diroff;
- if ((entryoffsetinblock = dp->i_offset & bmask) &&
- (error = cd9660_blkatoff(vdp, (off_t)dp->i_offset, NULL, &bp)))
- return (error);
- numdirpasses = 2;
- nchstats.ncs_2passes++;
- }
- endsearch = dp->i_size;
-
-searchloop:
- while (dp->i_offset < endsearch) {
- /*
- * If offset is on a block boundary,
- * read the next directory block.
- * Release previous if it exists.
- */
- if ((dp->i_offset & bmask) == 0) {
- if (bp != NULL)
- brelse(bp);
- if ((error =
- cd9660_blkatoff(vdp, (off_t)dp->i_offset, NULL, &bp)) != 0)
- return (error);
- entryoffsetinblock = 0;
- }
- /*
- * Get pointer to next entry.
- */
- ep = (struct iso_directory_record *)
- ((char *)bp->b_data + entryoffsetinblock);
-
- reclen = isonum_711(ep->length);
- if (reclen == 0) {
- /* skip to next block, if any */
- dp->i_offset =
- (dp->i_offset & ~bmask) + imp->logical_block_size;
- continue;
- }
-
- if (reclen < ISO_DIRECTORY_RECORD_SIZE)
- /* illegal entry, stop */
- break;
-
- if (entryoffsetinblock + reclen > imp->logical_block_size)
- /* entries are not allowed to cross boundaries */
- break;
-
- namelen = isonum_711(ep->name_len);
- isoflags = isonum_711(imp->iso_ftype == ISO_FTYPE_HIGH_SIERRA?
- &ep->date[6]: ep->flags);
-
- if (reclen < ISO_DIRECTORY_RECORD_SIZE + namelen)
- /* illegal entry, stop */
- break;
-
- /*
- * Check for a name match.
- */
- switch (imp->iso_ftype) {
- default:
- if (!(isoflags & 4) == !assoc) {
- if ((len == 1
- && *name == '.')
- || (flags & ISDOTDOT)) {
- if (namelen == 1
- && ep->name[0] == ((flags & ISDOTDOT) ? 1 : 0)) {
- /*
- * Save directory entry's inode number and
- * release directory buffer.
- */
- dp->i_ino = isodirino(ep, imp);
- goto found;
- }
- if (namelen != 1
- || ep->name[0] != 0)
- goto notfound;
- } else if (!(res = isofncmp(name, len,
- ep->name, namelen,
- imp->joliet_level,
- imp->im_flags,
- imp->im_d2l,
- imp->im_l2d))) {
- if (isoflags & 2)
- ino = isodirino(ep, imp);
- else
- ino = dbtob(bp->b_blkno)
- + entryoffsetinblock;
- saveoffset = dp->i_offset;
- } else if (ino)
- goto foundino;
-#ifdef NOSORTBUG /* On some CDs directory entries are not sorted correctly */
- else if (res < 0)
- goto notfound;
- else if (res > 0 && numdirpasses == 2)
- numdirpasses++;
-#endif
- }
- break;
- case ISO_FTYPE_RRIP:
- if (isonum_711(ep->flags)&2)
- ino = isodirino(ep, imp);
- else
- ino = dbtob(bp->b_blkno) + entryoffsetinblock;
- dp->i_ino = ino;
- cd9660_rrip_getname(ep,altname,&namelen,&dp->i_ino,imp);
- if (namelen == cnp->cn_namelen
- && !bcmp(name,altname,namelen))
- goto found;
- ino = 0;
- break;
- }
- dp->i_offset += reclen;
- entryoffsetinblock += reclen;
- }
- if (ino) {
-foundino:
- dp->i_ino = ino;
- if (saveoffset != dp->i_offset) {
- if (lblkno(imp, dp->i_offset) !=
- lblkno(imp, saveoffset)) {
- if (bp != NULL)
- brelse(bp);
- if ((error = cd9660_blkatoff(vdp,
- (off_t)saveoffset, NULL, &bp)) != 0)
- return (error);
- }
- entryoffsetinblock = saveoffset & bmask;
- ep = (struct iso_directory_record *)
- ((char *)bp->b_data + entryoffsetinblock);
- dp->i_offset = saveoffset;
- }
- goto found;
- }
-notfound:
- /*
- * If we started in the middle of the directory and failed
- * to find our target, we must check the beginning as well.
- */
- if (numdirpasses == 2) {
- numdirpasses--;
- dp->i_offset = 0;
- endsearch = dp->i_diroff;
- goto searchloop;
- }
- if (bp != NULL)
- brelse(bp);
-
- /*
- * Insert name into cache (as non-existent) if appropriate.
- */
- if (cnp->cn_flags & MAKEENTRY)
- cache_enter(vdp, *vpp, cnp);
- if (nameiop == CREATE || nameiop == RENAME)
- return (EROFS);
- return (ENOENT);
-
-found:
- if (numdirpasses == 2)
- nchstats.ncs_pass2++;
-
- /*
- * Found component in pathname.
- * If the final component of path name, save information
- * in the cache as to where the entry was found.
- */
- if ((flags & ISLASTCN) && nameiop == LOOKUP)
- dp->i_diroff = dp->i_offset;
-
- /*
- * Step through the translation in the name. We do not `iput' the
- * directory because we may need it again if a symbolic link
- * is relative to the current directory. Instead we save it
- * unlocked as "pdp". We must get the target inode before unlocking
- * the directory to insure that the inode will not be removed
- * before we get it. We prevent deadlock by always fetching
- * inodes from the root, moving down the directory tree. Thus
- * when following backward pointers ".." we must unlock the
- * parent directory before getting the requested directory.
- * There is a potential race condition here if both the current
- * and parent directories are removed before the `iget' for the
- * inode associated with ".." returns. We hope that this occurs
- * infrequently since we cannot avoid this race condition without
- * implementing a sophisticated deadlock detection algorithm.
- * Note also that this simple deadlock detection scheme will not
- * work if the filesystem has any hard links other than ".."
- * that point backwards in the directory structure.
- */
- pdp = vdp;
- /*
- * If ino is different from dp->i_ino,
- * it's a relocated directory.
- */
- if (flags & ISDOTDOT) {
- VOP_UNLOCK(pdp, 0, td); /* race to get the inode */
- error = cd9660_vget_internal(vdp->v_mount, dp->i_ino,
- LK_EXCLUSIVE, &tdp,
- dp->i_ino != ino, ep);
- brelse(bp);
- vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY, td);
- if (error)
- return (error);
- *vpp = tdp;
- } else if (dp->i_number == dp->i_ino) {
- brelse(bp);
- VREF(vdp); /* we want ourself, ie "." */
- *vpp = vdp;
- } else {
- error = cd9660_vget_internal(vdp->v_mount, dp->i_ino,
- LK_EXCLUSIVE, &tdp,
- dp->i_ino != ino, ep);
- brelse(bp);
- if (error)
- return (error);
- *vpp = tdp;
- }
-
- /*
- * Insert name into cache if appropriate.
- */
- if (cnp->cn_flags & MAKEENTRY)
- cache_enter(vdp, *vpp, cnp);
- return (0);
-}
-
-/*
- * Return buffer with the contents of block "offset" from the beginning of
- * directory "ip". If "res" is non-zero, fill it in with a pointer to the
- * remaining space in the directory.
- */
-int
-cd9660_blkatoff(vp, offset, res, bpp)
- struct vnode *vp;
- off_t offset;
- char **res;
- struct buf **bpp;
-{
- struct iso_node *ip;
- struct iso_mnt *imp;
- struct buf *bp;
- daddr_t lbn;
- int bsize, bshift, error;
-
- ip = VTOI(vp);
- imp = ip->i_mnt;
- lbn = lblkno(imp, offset);
- bsize = blksize(imp, ip, lbn);
- bshift = imp->im_bshift;
-
- if ((error = bread(vp, lbn, bsize, NOCRED, &bp)) != 0) {
- brelse(bp);
- *bpp = NULL;
- return (error);
- }
-
- /*
- * We must BMAP the buffer because the directory code may use b_blkno
- * to calculate the inode for certain types of directory entries.
- * We could get away with not doing it before we VMIO-backed the
- * directories because the buffers would get freed atomically with
- * the invalidation of their data. But with VMIO-backed buffers
- * the buffers may be freed and then later reconstituted - and the
- * reconstituted buffer will have no knowledge of b_blkno.
- */
- if (bp->b_blkno == bp->b_lblkno) {
- bp->b_blkno = (ip->iso_start + bp->b_lblkno) << (bshift - DEV_BSHIFT);
- }
-
- if (res)
- *res = (char *)bp->b_data + blkoff(imp, offset);
- *bpp = bp;
- return (0);
-}
diff --git a/sys/fs/cd9660/cd9660_mount.h b/sys/fs/cd9660/cd9660_mount.h
deleted file mode 100644
index 518677d..0000000
--- a/sys/fs/cd9660/cd9660_mount.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c) 1995
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cd9660_mount.h 8.1 (Berkeley) 5/24/95
- * $FreeBSD$
- */
-
-/*
- * Arguments to mount ISO 9660 filesystems.
- */
-struct iso_args {
- char *fspec; /* block special device to mount */
- struct export_args export; /* network export info */
- int flags; /* mounting flags, see below */
- int ssector; /* starting sector, 0 for 1st session */
- char *cs_disk; /* disk charset for Joliet cs conversion */
- char *cs_local; /* local charset for Joliet cs conversion */
-};
-#define ISOFSMNT_NORRIP 0x00000001 /* disable Rock Ridge Ext.*/
-#define ISOFSMNT_GENS 0x00000002 /* enable generation numbers */
-#define ISOFSMNT_EXTATT 0x00000004 /* enable extended attributes */
-#define ISOFSMNT_NOJOLIET 0x00000008 /* disable Joliet Ext.*/
-#define ISOFSMNT_BROKENJOLIET 0x00000010/* allow broken Joliet disks */
-#define ISOFSMNT_KICONV 0x00000020 /* Use libiconv to convert chars */
diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c
deleted file mode 100644
index 8d281de..0000000
--- a/sys/fs/cd9660/cd9660_node.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1989, 1994, 1995
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mount.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/vnode.h>
-#include <sys/malloc.h>
-#include <sys/stat.h>
-#include <sys/mutex.h>
-
-#include <isofs/cd9660/iso.h>
-#include <isofs/cd9660/cd9660_node.h>
-#include <isofs/cd9660/cd9660_mount.h>
-
-static unsigned cd9660_chars2ui(unsigned char *begin, int len);
-
-/*
- * Last reference to an inode, write the inode out and if necessary,
- * truncate and deallocate the file.
- */
-int
-cd9660_inactive(ap)
- struct vop_inactive_args /* {
- struct vnode *a_vp;
- struct thread *a_td;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct thread *td = ap->a_td;
- struct iso_node *ip = VTOI(vp);
- int error = 0;
-
- if (prtactive && vrefcnt(vp) != 0)
- vprint("cd9660_inactive: pushing active", vp);
-
- ip->i_flag = 0;
- /*
- * If we are done with the inode, reclaim it
- * so that it can be reused immediately.
- */
- if (ip->inode.iso_mode == 0)
- vrecycle(vp, td);
- return error;
-}
-
-/*
- * Reclaim an inode so that it can be used for other purposes.
- */
-int
-cd9660_reclaim(ap)
- struct vop_reclaim_args /* {
- struct vnode *a_vp;
- struct thread *a_td;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct iso_node *ip = VTOI(vp);
-
- if (prtactive && vrefcnt(vp) != 0)
- vprint("cd9660_reclaim: pushing active", vp);
- /*
- * Remove the inode from its hash chain.
- */
- vfs_hash_remove(vp);
-
- /*
- * Purge old data structures associated with the inode.
- */
- if (ip->i_mnt->im_devvp)
- vrele(ip->i_mnt->im_devvp);
- FREE(vp->v_data, M_ISOFSNODE);
- vp->v_data = NULL;
- vnode_destroy_vobject(vp);
- return (0);
-}
-
-/*
- * File attributes
- */
-void
-cd9660_defattr(isodir, inop, bp, ftype)
- struct iso_directory_record *isodir;
- struct iso_node *inop;
- struct buf *bp;
- enum ISO_FTYPE ftype;
-{
- struct buf *bp2 = NULL;
- struct iso_mnt *imp;
- struct iso_extended_attributes *ap = NULL;
- int off;
-
- /* high sierra does not have timezone data, flag is one byte ahead */
- if (isonum_711(ftype == ISO_FTYPE_HIGH_SIERRA?
- &isodir->date[6]: isodir->flags)&2) {
- inop->inode.iso_mode = S_IFDIR;
- /*
- * If we return 2, fts() will assume there are no subdirectories
- * (just links for the path and .), so instead we return 1.
- */
- inop->inode.iso_links = 1;
- } else {
- inop->inode.iso_mode = S_IFREG;
- inop->inode.iso_links = 1;
- }
- if (!bp
- && ((imp = inop->i_mnt)->im_flags & ISOFSMNT_EXTATT)
- && (off = isonum_711(isodir->ext_attr_length))) {
- cd9660_blkatoff(ITOV(inop), (off_t)-(off << imp->im_bshift), NULL,
- &bp2);
- bp = bp2;
- }
- if (bp) {
- ap = (struct iso_extended_attributes *)bp->b_data;
-
- if (isonum_711(ap->version) == 1) {
- if (!(ap->perm[0]&0x40))
- inop->inode.iso_mode |= VEXEC >> 6;
- if (!(ap->perm[0]&0x10))
- inop->inode.iso_mode |= VREAD >> 6;
- if (!(ap->perm[0]&4))
- inop->inode.iso_mode |= VEXEC >> 3;
- if (!(ap->perm[0]&1))
- inop->inode.iso_mode |= VREAD >> 3;
- if (!(ap->perm[1]&0x40))
- inop->inode.iso_mode |= VEXEC;
- if (!(ap->perm[1]&0x10))
- inop->inode.iso_mode |= VREAD;
- inop->inode.iso_uid = isonum_723(ap->owner); /* what about 0? */
- inop->inode.iso_gid = isonum_723(ap->group); /* what about 0? */
- } else
- ap = NULL;
- }
- if (!ap) {
- inop->inode.iso_mode |= VREAD|VEXEC|(VREAD|VEXEC)>>3|(VREAD|VEXEC)>>6;
- inop->inode.iso_uid = (uid_t)0;
- inop->inode.iso_gid = (gid_t)0;
- }
- if (bp2)
- brelse(bp2);
-}
-
-/*
- * Time stamps
- */
-void
-cd9660_deftstamp(isodir,inop,bp,ftype)
- struct iso_directory_record *isodir;
- struct iso_node *inop;
- struct buf *bp;
- enum ISO_FTYPE ftype;
-{
- struct buf *bp2 = NULL;
- struct iso_mnt *imp;
- struct iso_extended_attributes *ap = NULL;
- int off;
-
- if (!bp
- && ((imp = inop->i_mnt)->im_flags & ISOFSMNT_EXTATT)
- && (off = isonum_711(isodir->ext_attr_length))) {
- cd9660_blkatoff(ITOV(inop), (off_t)-(off << imp->im_bshift), NULL,
- &bp2);
- bp = bp2;
- }
- if (bp) {
- ap = (struct iso_extended_attributes *)bp->b_data;
-
- if (ftype != ISO_FTYPE_HIGH_SIERRA
- && isonum_711(ap->version) == 1) {
- if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime))
- cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_atime);
- if (!cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_ctime))
- inop->inode.iso_ctime = inop->inode.iso_atime;
- if (!cd9660_tstamp_conv17(ap->mtime,&inop->inode.iso_mtime))
- inop->inode.iso_mtime = inop->inode.iso_ctime;
- } else
- ap = NULL;
- }
- if (!ap) {
- cd9660_tstamp_conv7(isodir->date,&inop->inode.iso_ctime,ftype);
- inop->inode.iso_atime = inop->inode.iso_ctime;
- inop->inode.iso_mtime = inop->inode.iso_ctime;
- }
- if (bp2)
- brelse(bp2);
-}
-
-int
-cd9660_tstamp_conv7(pi,pu,ftype)
- u_char *pi;
- struct timespec *pu;
- enum ISO_FTYPE ftype;
-{
- int crtime, days;
- int y, m, d, hour, minute, second, tz;
-
- y = pi[0] + 1900;
- m = pi[1];
- d = pi[2];
- hour = pi[3];
- minute = pi[4];
- second = pi[5];
- if(ftype != ISO_FTYPE_HIGH_SIERRA)
- tz = pi[6];
- else
- /* original high sierra misses timezone data */
- tz = 0;
-
- if (y < 1970) {
- pu->tv_sec = 0;
- pu->tv_nsec = 0;
- return 0;
- } else {
-#ifdef ORIGINAL
- /* computes day number relative to Sept. 19th,1989 */
- /* don't even *THINK* about changing formula. It works! */
- days = 367*(y-1980)-7*(y+(m+9)/12)/4-3*((y+(m-9)/7)/100+1)/4+275*m/9+d-100;
-#else
- /*
- * Changed :-) to make it relative to Jan. 1st, 1970
- * and to disambiguate negative division
- */
- days = 367*(y-1960)-7*(y+(m+9)/12)/4-3*((y+(m+9)/12-1)/100+1)/4+275*m/9+d-239;
-#endif
- crtime = ((((days * 24) + hour) * 60 + minute) * 60) + second;
-
- /* timezone offset is unreliable on some disks */
- if (-48 <= tz && tz <= 52)
- crtime -= tz * 15 * 60;
- }
- pu->tv_sec = crtime;
- pu->tv_nsec = 0;
- return 1;
-}
-
-static u_int
-cd9660_chars2ui(begin,len)
- u_char *begin;
- int len;
-{
- u_int rc;
-
- for (rc = 0; --len >= 0;) {
- rc *= 10;
- rc += *begin++ - '0';
- }
- return rc;
-}
-
-int
-cd9660_tstamp_conv17(pi,pu)
- u_char *pi;
- struct timespec *pu;
-{
- u_char buf[7];
-
- /* year:"0001"-"9999" -> -1900 */
- buf[0] = cd9660_chars2ui(pi,4) - 1900;
-
- /* month: " 1"-"12" -> 1 - 12 */
- buf[1] = cd9660_chars2ui(pi + 4,2);
-
- /* day: " 1"-"31" -> 1 - 31 */
- buf[2] = cd9660_chars2ui(pi + 6,2);
-
- /* hour: " 0"-"23" -> 0 - 23 */
- buf[3] = cd9660_chars2ui(pi + 8,2);
-
- /* minute:" 0"-"59" -> 0 - 59 */
- buf[4] = cd9660_chars2ui(pi + 10,2);
-
- /* second:" 0"-"59" -> 0 - 59 */
- buf[5] = cd9660_chars2ui(pi + 12,2);
-
- /* difference of GMT */
- buf[6] = pi[16];
-
- return cd9660_tstamp_conv7(buf, pu, ISO_FTYPE_DEFAULT);
-}
-
-ino_t
-isodirino(isodir, imp)
- struct iso_directory_record *isodir;
- struct iso_mnt *imp;
-{
- ino_t ino;
-
- ino = (isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length))
- << imp->im_bshift;
- return (ino);
-}
diff --git a/sys/fs/cd9660/cd9660_node.h b/sys/fs/cd9660/cd9660_node.h
deleted file mode 100644
index a362dc1..0000000
--- a/sys/fs/cd9660/cd9660_node.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cd9660_node.h 8.6 (Berkeley) 5/14/95
- * $FreeBSD$
- */
-
-/*
- * Theoretically, directories can be more than 2Gb in length,
- * however, in practice this seems unlikely. So, we define
- * the type doff_t as a long to keep down the cost of doing
- * lookup on a 32-bit machine. If you are porting to a 64-bit
- * architecture, you should make doff_t the same as off_t.
- */
-#define doff_t long
-
-typedef struct {
- struct timespec iso_atime; /* time of last access */
- struct timespec iso_mtime; /* time of last modification */
- struct timespec iso_ctime; /* time file changed */
- u_short iso_mode; /* files access mode and type */
- uid_t iso_uid; /* owner user id */
- gid_t iso_gid; /* owner group id */
- short iso_links; /* links of file */
- dev_t iso_rdev; /* Major/Minor number for special */
-} ISO_RRIP_INODE;
-
-
-struct iso_node {
- struct vnode *i_vnode; /* vnode associated with this inode */
- u_long i_flag; /* see below */
- ino_t i_number; /* the identity of the inode */
- /* we use the actual starting block of the file */
- struct iso_mnt *i_mnt; /* filesystem associated with this inode */
- struct lockf *i_lockf; /* head of byte-level lock list */
- doff_t i_endoff; /* end of useful stuff in directory */
- doff_t i_diroff; /* offset in dir, where we found last entry */
- doff_t i_offset; /* offset of free space in directory */
- ino_t i_ino; /* inode number of found directory */
-
- long iso_extent; /* extent of file */
- long i_size;
- long iso_start; /* actual start of data of file (may be different */
- /* from iso_extent, if file has extended attributes) */
- ISO_RRIP_INODE inode;
-};
-
-#define i_forw i_chain[0]
-#define i_back i_chain[1]
-
-/* flags */
-#define IN_ACCESS 0x0020 /* inode access time to be updated */
-
-#define VTOI(vp) ((struct iso_node *)(vp)->v_data)
-#define ITOV(ip) ((ip)->i_vnode)
-
-#ifdef _KERNEL
-
-#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_ISOFSMNT);
-MALLOC_DECLARE(M_ISOFSNODE);
-#endif
-
-struct buf;
-struct vop_bmap_args;
-struct vop_cachedlookup_args;
-struct vop_inactive_args;
-struct vop_reclaim_args;
-
-/*
- * Prototypes for ISOFS vnode operations
- */
-int cd9660_lookup(struct vop_cachedlookup_args *);
-int cd9660_inactive(struct vop_inactive_args *);
-int cd9660_reclaim(struct vop_reclaim_args *);
-int cd9660_bmap(struct vop_bmap_args *);
-int cd9660_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp);
-
-void cd9660_defattr(struct iso_directory_record *,
- struct iso_node *, struct buf *, enum ISO_FTYPE);
-void cd9660_deftstamp(struct iso_directory_record *,
- struct iso_node *, struct buf *, enum ISO_FTYPE);
-int cd9660_tstamp_conv7(u_char *, struct timespec *, enum ISO_FTYPE);
-int cd9660_tstamp_conv17(u_char *, struct timespec *);
-
-#endif /* _KERNEL */
diff --git a/sys/fs/cd9660/cd9660_rrip.c b/sys/fs/cd9660/cd9660_rrip.c
deleted file mode 100644
index aae7394..0000000
--- a/sys/fs/cd9660/cd9660_rrip.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/*-
- * Copyright (c) 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cd9660_rrip.c 8.6 (Berkeley) 12/5/94
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <sys/kernel.h>
-
-#include <isofs/cd9660/iso.h>
-#include <isofs/cd9660/cd9660_node.h>
-#include <isofs/cd9660/cd9660_rrip.h>
-#include <isofs/cd9660/iso_rrip.h>
-
-typedef int rrt_func_t(void *, ISO_RRIP_ANALYZE *ana);
-
-typedef struct {
- char type[2];
- rrt_func_t *func;
- void (*func2)(struct iso_directory_record *isodir, ISO_RRIP_ANALYZE *ana);
- int result;
-} RRIP_TABLE;
-
-static int cd9660_rrip_altname(ISO_RRIP_ALTNAME *p, ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_attr(ISO_RRIP_ATTR *p, ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_cont(ISO_RRIP_CONT *p, ISO_RRIP_ANALYZE *ana);
-static void cd9660_rrip_defattr(struct iso_directory_record *isodir,
- ISO_RRIP_ANALYZE *ana);
-static void cd9660_rrip_defname(struct iso_directory_record *isodir,
- ISO_RRIP_ANALYZE *ana);
-static void cd9660_rrip_deftstamp(struct iso_directory_record *isodir,
- ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_device(ISO_RRIP_DEVICE *p, ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_extref(ISO_RRIP_EXTREF *p, ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_idflag(ISO_RRIP_IDFLAG *p, ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_loop(struct iso_directory_record *isodir,
- ISO_RRIP_ANALYZE *ana, RRIP_TABLE *table);
-static int cd9660_rrip_pclink(ISO_RRIP_CLINK *p, ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_reldir(ISO_RRIP_RELDIR *p, ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_slink(ISO_RRIP_SLINK *p, ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_stop(ISO_SUSP_HEADER *p, ISO_RRIP_ANALYZE *ana);
-static int cd9660_rrip_tstamp(ISO_RRIP_TSTAMP *p, ISO_RRIP_ANALYZE *ana);
-
-/*
- * POSIX file attribute
- */
-static int
-cd9660_rrip_attr(p,ana)
- ISO_RRIP_ATTR *p;
- ISO_RRIP_ANALYZE *ana;
-{
- ana->inop->inode.iso_mode = isonum_733(p->mode);
- ana->inop->inode.iso_uid = isonum_733(p->uid);
- ana->inop->inode.iso_gid = isonum_733(p->gid);
- ana->inop->inode.iso_links = isonum_733(p->links);
- ana->fields &= ~ISO_SUSP_ATTR;
- return ISO_SUSP_ATTR;
-}
-
-static void
-cd9660_rrip_defattr(isodir,ana)
- struct iso_directory_record *isodir;
- ISO_RRIP_ANALYZE *ana;
-{
- /* But this is a required field! */
- printf("RRIP without PX field?\n");
- cd9660_defattr(isodir,ana->inop,NULL,ISO_FTYPE_RRIP);
-}
-
-/*
- * Symbolic Links
- */
-static int
-cd9660_rrip_slink(p,ana)
- ISO_RRIP_SLINK *p;
- ISO_RRIP_ANALYZE *ana;
-{
- ISO_RRIP_SLINK_COMPONENT *pcomp;
- ISO_RRIP_SLINK_COMPONENT *pcompe;
- int len, wlen, cont;
- char *outbuf, *inbuf;
-
- pcomp = (ISO_RRIP_SLINK_COMPONENT *)p->component;
- pcompe = (ISO_RRIP_SLINK_COMPONENT *)((char *)p + isonum_711(p->h.length));
- len = *ana->outlen;
- outbuf = ana->outbuf;
- cont = ana->cont;
-
- /*
- * Gathering a Symbolic name from each component with path
- */
- for (;
- pcomp < pcompe;
- pcomp = (ISO_RRIP_SLINK_COMPONENT *)((char *)pcomp + ISO_RRIP_SLSIZ
- + isonum_711(pcomp->clen))) {
-
- if (!cont) {
- if (len < ana->maxlen) {
- len++;
- *outbuf++ = '/';
- }
- }
- cont = 0;
-
- inbuf = "..";
- wlen = 0;
-
- switch (*pcomp->cflag) {
-
- case ISO_SUSP_CFLAG_CURRENT:
- /* Inserting Current */
- wlen = 1;
- break;
-
- case ISO_SUSP_CFLAG_PARENT:
- /* Inserting Parent */
- wlen = 2;
- break;
-
- case ISO_SUSP_CFLAG_ROOT:
- /* Inserting slash for ROOT */
- /* start over from beginning(?) */
- outbuf -= len;
- len = 0;
- break;
-
- case ISO_SUSP_CFLAG_VOLROOT:
- /* Inserting a mount point i.e. "/cdrom" */
- /* same as above */
- outbuf -= len;
- len = 0;
- inbuf = ana->imp->im_mountp->mnt_stat.f_mntonname;
- wlen = strlen(inbuf);
- break;
-
- case ISO_SUSP_CFLAG_HOST:
- /* Inserting hostname i.e. "kurt.tools.de" */
- inbuf = hostname;
- wlen = strlen(hostname);
- break;
-
- case ISO_SUSP_CFLAG_CONTINUE:
- cont = 1;
- /* FALLTHROUGH */
- case 0:
- /* Inserting component */
- wlen = isonum_711(pcomp->clen);
- inbuf = pcomp->name;
- break;
- default:
- printf("RRIP with incorrect flags?");
- wlen = ana->maxlen + 1;
- break;
- }
-
- if (len + wlen > ana->maxlen) {
- /* indicate error to caller */
- ana->cont = 1;
- ana->fields = 0;
- ana->outbuf -= *ana->outlen;
- *ana->outlen = 0;
- return 0;
- }
-
- bcopy(inbuf,outbuf,wlen);
- outbuf += wlen;
- len += wlen;
-
- }
- ana->outbuf = outbuf;
- *ana->outlen = len;
- ana->cont = cont;
-
- if (!isonum_711(p->flags)) {
- ana->fields &= ~ISO_SUSP_SLINK;
- return ISO_SUSP_SLINK;
- }
- return 0;
-}
-
-/*
- * Alternate name
- */
-static int
-cd9660_rrip_altname(p,ana)
- ISO_RRIP_ALTNAME *p;
- ISO_RRIP_ANALYZE *ana;
-{
- char *inbuf;
- int wlen;
- int cont;
-
- inbuf = "..";
- wlen = 0;
- cont = 0;
-
- switch (*p->flags) {
- case ISO_SUSP_CFLAG_CURRENT:
- /* Inserting Current */
- wlen = 1;
- break;
-
- case ISO_SUSP_CFLAG_PARENT:
- /* Inserting Parent */
- wlen = 2;
- break;
-
- case ISO_SUSP_CFLAG_HOST:
- /* Inserting hostname i.e. "kurt.tools.de" */
- inbuf = hostname;
- wlen = strlen(hostname);
- break;
-
- case ISO_SUSP_CFLAG_CONTINUE:
- cont = 1;
- /* FALLTHROUGH */
- case 0:
- /* Inserting component */
- wlen = isonum_711(p->h.length) - 5;
- inbuf = (char *)p + 5;
- break;
-
- default:
- printf("RRIP with incorrect NM flags?\n");
- wlen = ana->maxlen + 1;
- break;
- }
-
- if ((*ana->outlen += wlen) > ana->maxlen) {
- /* treat as no name field */
- ana->fields &= ~ISO_SUSP_ALTNAME;
- ana->outbuf -= *ana->outlen - wlen;
- *ana->outlen = 0;
- return 0;
- }
-
- bcopy(inbuf,ana->outbuf,wlen);
- ana->outbuf += wlen;
-
- if (!cont) {
- ana->fields &= ~ISO_SUSP_ALTNAME;
- return ISO_SUSP_ALTNAME;
- }
- return 0;
-}
-
-static void
-cd9660_rrip_defname(isodir,ana)
- struct iso_directory_record *isodir;
- ISO_RRIP_ANALYZE *ana;
-{
- isofntrans(isodir->name,isonum_711(isodir->name_len),
- ana->outbuf,ana->outlen,
- 1,isonum_711(isodir->flags)&4, ana->imp->joliet_level,
- ana->imp->im_flags, ana->imp->im_d2l);
- switch (*ana->outbuf) {
- default:
- break;
- case 1:
- *ana->outlen = 2;
- /* FALLTHROUGH */
- case 0:
- /* outlen is 1 already */
- strcpy(ana->outbuf,"..");
- break;
- }
-}
-
-/*
- * Parent or Child Link
- */
-static int
-cd9660_rrip_pclink(p,ana)
- ISO_RRIP_CLINK *p;
- ISO_RRIP_ANALYZE *ana;
-{
- *ana->inump = isonum_733(p->dir_loc) << ana->imp->im_bshift;
- ana->fields &= ~(ISO_SUSP_CLINK|ISO_SUSP_PLINK);
- return *p->h.type == 'C' ? ISO_SUSP_CLINK : ISO_SUSP_PLINK;
-}
-
-/*
- * Relocated directory
- */
-static int
-cd9660_rrip_reldir(p,ana)
- ISO_RRIP_RELDIR *p;
- ISO_RRIP_ANALYZE *ana;
-{
- /* special hack to make caller aware of RE field */
- *ana->outlen = 0;
- ana->fields = 0;
- return ISO_SUSP_RELDIR|ISO_SUSP_ALTNAME|ISO_SUSP_CLINK|ISO_SUSP_PLINK;
-}
-
-static int
-cd9660_rrip_tstamp(p,ana)
- ISO_RRIP_TSTAMP *p;
- ISO_RRIP_ANALYZE *ana;
-{
- u_char *ptime;
-
- ptime = p->time;
-
- /* Check a format of time stamp (7bytes/17bytes) */
- if (!(*p->flags&ISO_SUSP_TSTAMP_FORM17)) {
- if (*p->flags&ISO_SUSP_TSTAMP_CREAT)
- ptime += 7;
-
- if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) {
- cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_mtime,
- ISO_FTYPE_RRIP);
- ptime += 7;
- } else
- bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec));
-
- if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) {
- cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_atime,
- ISO_FTYPE_RRIP);
- ptime += 7;
- } else
- ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime;
-
- if (*p->flags&ISO_SUSP_TSTAMP_ATTR)
- cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_ctime,
- ISO_FTYPE_RRIP);
- else
- ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime;
-
- } else {
- if (*p->flags&ISO_SUSP_TSTAMP_CREAT)
- ptime += 17;
-
- if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) {
- cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_mtime);
- ptime += 17;
- } else
- bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec));
-
- if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) {
- cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_atime);
- ptime += 17;
- } else
- ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime;
-
- if (*p->flags&ISO_SUSP_TSTAMP_ATTR)
- cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_ctime);
- else
- ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime;
-
- }
- ana->fields &= ~ISO_SUSP_TSTAMP;
- return ISO_SUSP_TSTAMP;
-}
-
-static void
-cd9660_rrip_deftstamp(isodir,ana)
- struct iso_directory_record *isodir;
- ISO_RRIP_ANALYZE *ana;
-{
- cd9660_deftstamp(isodir,ana->inop,NULL,ISO_FTYPE_RRIP);
-}
-
-/*
- * POSIX device modes
- */
-static int
-cd9660_rrip_device(p,ana)
- ISO_RRIP_DEVICE *p;
- ISO_RRIP_ANALYZE *ana;
-{
- u_int high, low;
-
- high = isonum_733(p->dev_t_high);
- low = isonum_733(p->dev_t_low);
-
- if (high == 0)
- ana->inop->inode.iso_rdev = makedev(umajor(low), uminor(low));
- else
- ana->inop->inode.iso_rdev = makedev(high, uminor(low));
- ana->fields &= ~ISO_SUSP_DEVICE;
- return ISO_SUSP_DEVICE;
-}
-
-/*
- * Flag indicating
- */
-static int
-cd9660_rrip_idflag(p,ana)
- ISO_RRIP_IDFLAG *p;
- ISO_RRIP_ANALYZE *ana;
-{
- ana->fields &= isonum_711(p->flags)|~0xff; /* don't touch high bits */
- /* special handling of RE field */
- if (ana->fields&ISO_SUSP_RELDIR)
- return cd9660_rrip_reldir(/* XXX */ (ISO_RRIP_RELDIR *)p,ana);
-
- return ISO_SUSP_IDFLAG;
-}
-
-/*
- * Continuation pointer
- */
-static int
-cd9660_rrip_cont(p,ana)
- ISO_RRIP_CONT *p;
- ISO_RRIP_ANALYZE *ana;
-{
- ana->iso_ce_blk = isonum_733(p->location);
- ana->iso_ce_off = isonum_733(p->offset);
- ana->iso_ce_len = isonum_733(p->length);
- return ISO_SUSP_CONT;
-}
-
-/*
- * System Use end
- */
-static int
-cd9660_rrip_stop(p,ana)
- ISO_SUSP_HEADER *p;
- ISO_RRIP_ANALYZE *ana;
-{
- return ISO_SUSP_STOP;
-}
-
-/*
- * Extension reference
- */
-static int
-cd9660_rrip_extref(p,ana)
- ISO_RRIP_EXTREF *p;
- ISO_RRIP_ANALYZE *ana;
-{
- if (isonum_711(p->len_id) != 10
- || bcmp((char *)p + 8,"RRIP_1991A",10)
- || isonum_711(p->version) != 1)
- return 0;
- ana->fields &= ~ISO_SUSP_EXTREF;
- return ISO_SUSP_EXTREF;
-}
-
-static int
-cd9660_rrip_loop(isodir,ana,table)
- struct iso_directory_record *isodir;
- ISO_RRIP_ANALYZE *ana;
- RRIP_TABLE *table;
-{
- RRIP_TABLE *ptable;
- ISO_SUSP_HEADER *phead;
- ISO_SUSP_HEADER *pend;
- struct buf *bp = NULL;
- char *pwhead;
- u_short c;
- int result;
-
- /*
- * Note: If name length is odd,
- * it will be padding 1 byte after the name
- */
- pwhead = isodir->name + isonum_711(isodir->name_len);
- if (!(isonum_711(isodir->name_len)&1))
- pwhead++;
- isochar(isodir->name, pwhead, ana->imp->joliet_level, &c, NULL,
- ana->imp->im_flags, ana->imp->im_d2l);
-
- /* If it's not the '.' entry of the root dir obey SP field */
- if (c != 0 || isonum_733(isodir->extent) != ana->imp->root_extent)
- pwhead += ana->imp->rr_skip;
- else
- pwhead += ana->imp->rr_skip0;
-
- phead = (ISO_SUSP_HEADER *)pwhead;
- pend = (ISO_SUSP_HEADER *)((char *)isodir + isonum_711(isodir->length));
-
- result = 0;
- while (1) {
- ana->iso_ce_len = 0;
- /*
- * Note: "pend" should be more than one SUSP header
- */
- while (pend >= phead + 1) {
- if (isonum_711(phead->version) == 1) {
- for (ptable = table; ptable->func; ptable++) {
- if (*phead->type == *ptable->type
- && phead->type[1] == ptable->type[1]) {
- result |= ptable->func(phead,ana);
- break;
- }
- }
- if (!ana->fields)
- break;
- }
- if (result&ISO_SUSP_STOP) {
- result &= ~ISO_SUSP_STOP;
- break;
- }
- /* plausibility check */
- if (isonum_711(phead->length) < sizeof(*phead))
- break;
- /*
- * move to next SUSP
- * Hopefully this works with newer versions, too
- */
- phead = (ISO_SUSP_HEADER *)((char *)phead + isonum_711(phead->length));
- }
-
- if (ana->fields && ana->iso_ce_len) {
- if (ana->iso_ce_blk >= ana->imp->volume_space_size
- || ana->iso_ce_off + ana->iso_ce_len > ana->imp->logical_block_size
- || bread(ana->imp->im_devvp,
- ana->iso_ce_blk <<
- (ana->imp->im_bshift - DEV_BSHIFT),
- ana->imp->logical_block_size, NOCRED, &bp))
- /* what to do now? */
- break;
- phead = (ISO_SUSP_HEADER *)(bp->b_data + ana->iso_ce_off);
- pend = (ISO_SUSP_HEADER *) ((char *)phead + ana->iso_ce_len);
- } else
- break;
- }
- if (bp)
- brelse(bp);
- /*
- * If we don't find the Basic SUSP stuffs, just set default value
- * (attribute/time stamp)
- */
- for (ptable = table; ptable->func2; ptable++)
- if (!(ptable->result&result))
- ptable->func2(isodir,ana);
-
- return result;
-}
-
-/*
- * Get Attributes.
- */
-/*
- * XXX the casts are bogus but will do for now.
- */
-#define BC (rrt_func_t *)
-static RRIP_TABLE rrip_table_analyze[] = {
- { "PX", BC cd9660_rrip_attr, cd9660_rrip_defattr, ISO_SUSP_ATTR },
- { "TF", BC cd9660_rrip_tstamp, cd9660_rrip_deftstamp, ISO_SUSP_TSTAMP },
- { "PN", BC cd9660_rrip_device, 0, ISO_SUSP_DEVICE },
- { "RR", BC cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG },
- { "CE", BC cd9660_rrip_cont, 0, ISO_SUSP_CONT },
- { "ST", BC cd9660_rrip_stop, 0, ISO_SUSP_STOP },
- { "", 0, 0, 0 }
-};
-
-int
-cd9660_rrip_analyze(isodir,inop,imp)
- struct iso_directory_record *isodir;
- struct iso_node *inop;
- struct iso_mnt *imp;
-{
- ISO_RRIP_ANALYZE analyze;
-
- analyze.inop = inop;
- analyze.imp = imp;
- analyze.fields = ISO_SUSP_ATTR|ISO_SUSP_TSTAMP|ISO_SUSP_DEVICE;
-
- return cd9660_rrip_loop(isodir,&analyze,rrip_table_analyze);
-}
-
-/*
- * Get Alternate Name.
- */
-static RRIP_TABLE rrip_table_getname[] = {
- { "NM", BC cd9660_rrip_altname, cd9660_rrip_defname, ISO_SUSP_ALTNAME },
- { "CL", BC cd9660_rrip_pclink, 0, ISO_SUSP_CLINK|ISO_SUSP_PLINK },
- { "PL", BC cd9660_rrip_pclink, 0, ISO_SUSP_CLINK|ISO_SUSP_PLINK },
- { "RE", BC cd9660_rrip_reldir, 0, ISO_SUSP_RELDIR },
- { "RR", BC cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG },
- { "CE", BC cd9660_rrip_cont, 0, ISO_SUSP_CONT },
- { "ST", BC cd9660_rrip_stop, 0, ISO_SUSP_STOP },
- { "", 0, 0, 0 }
-};
-
-int
-cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp)
- struct iso_directory_record *isodir;
- char *outbuf;
- u_short *outlen;
- ino_t *inump;
- struct iso_mnt *imp;
-{
- ISO_RRIP_ANALYZE analyze;
- RRIP_TABLE *tab;
- u_short c;
-
- analyze.outbuf = outbuf;
- analyze.outlen = outlen;
- analyze.maxlen = NAME_MAX;
- analyze.inump = inump;
- analyze.imp = imp;
- analyze.fields = ISO_SUSP_ALTNAME|ISO_SUSP_RELDIR|ISO_SUSP_CLINK|ISO_SUSP_PLINK;
- *outlen = 0;
-
- isochar(isodir->name, isodir->name + isonum_711(isodir->name_len),
- imp->joliet_level, &c, NULL, imp->im_flags, imp->im_d2l);
- tab = rrip_table_getname;
- if (c == 0 || c == 1) {
- cd9660_rrip_defname(isodir,&analyze);
-
- analyze.fields &= ~ISO_SUSP_ALTNAME;
- tab++;
- }
-
- return cd9660_rrip_loop(isodir,&analyze,tab);
-}
-
-/*
- * Get Symbolic Link.
- */
-static RRIP_TABLE rrip_table_getsymname[] = {
- { "SL", BC cd9660_rrip_slink, 0, ISO_SUSP_SLINK },
- { "RR", BC cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG },
- { "CE", BC cd9660_rrip_cont, 0, ISO_SUSP_CONT },
- { "ST", BC cd9660_rrip_stop, 0, ISO_SUSP_STOP },
- { "", 0, 0, 0 }
-};
-
-int
-cd9660_rrip_getsymname(isodir,outbuf,outlen,imp)
- struct iso_directory_record *isodir;
- char *outbuf;
- u_short *outlen;
- struct iso_mnt *imp;
-{
- ISO_RRIP_ANALYZE analyze;
-
- analyze.outbuf = outbuf;
- analyze.outlen = outlen;
- *outlen = 0;
- analyze.maxlen = MAXPATHLEN;
- analyze.cont = 1; /* don't start with a slash */
- analyze.imp = imp;
- analyze.fields = ISO_SUSP_SLINK;
-
- return (cd9660_rrip_loop(isodir,&analyze,rrip_table_getsymname)&ISO_SUSP_SLINK);
-}
-
-static RRIP_TABLE rrip_table_extref[] = {
- { "ER", BC cd9660_rrip_extref, 0, ISO_SUSP_EXTREF },
- { "CE", BC cd9660_rrip_cont, 0, ISO_SUSP_CONT },
- { "ST", BC cd9660_rrip_stop, 0, ISO_SUSP_STOP },
- { "", 0, 0, 0 }
-};
-
-/*
- * Check for Rock Ridge Extension and return offset of its fields.
- * Note: We insist on the ER field.
- */
-int
-cd9660_rrip_offset(isodir,imp)
- struct iso_directory_record *isodir;
- struct iso_mnt *imp;
-{
- ISO_RRIP_OFFSET *p;
- ISO_RRIP_ANALYZE analyze;
-
- imp->rr_skip0 = 0;
- p = (ISO_RRIP_OFFSET *)(isodir->name + 1);
- if (bcmp(p,"SP\7\1\276\357",6)) {
- /* Maybe, it's a CDROM XA disc? */
- imp->rr_skip0 = 15;
- p = (ISO_RRIP_OFFSET *)((char *)p + 15);
- if (bcmp(p,"SP\7\1\276\357",6))
- return -1;
- }
-
- analyze.imp = imp;
- analyze.fields = ISO_SUSP_EXTREF;
- if (!(cd9660_rrip_loop(isodir,&analyze,rrip_table_extref)&ISO_SUSP_EXTREF))
- return -1;
-
- return isonum_711(p->skip);
-}
diff --git a/sys/fs/cd9660/cd9660_rrip.h b/sys/fs/cd9660/cd9660_rrip.h
deleted file mode 100644
index f6fa050..0000000
--- a/sys/fs/cd9660/cd9660_rrip.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*-
- * Copyright (c) 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cd9660_rrip.h 8.2 (Berkeley) 12/5/94
- * $FreeBSD$
- */
-
-typedef struct {
- char type [ISODCL ( 0, 1)];
- u_char length [ISODCL ( 2, 2)]; /* 711 */
- u_char version [ISODCL ( 3, 3)];
-} ISO_SUSP_HEADER;
-
-typedef struct {
- ISO_SUSP_HEADER h;
- char mode [ISODCL ( 4, 11)]; /* 733 */
- char links [ISODCL ( 12, 19)]; /* 733 */
- char uid [ISODCL ( 20, 27)]; /* 733 */
- char gid [ISODCL ( 28, 35)]; /* 733 */
-} ISO_RRIP_ATTR;
-
-typedef struct {
- ISO_SUSP_HEADER h;
- char dev_t_high [ISODCL ( 4, 11)]; /* 733 */
- char dev_t_low [ISODCL ( 12, 19)]; /* 733 */
-} ISO_RRIP_DEVICE;
-
-#define ISO_SUSP_CFLAG_CONTINUE 0x01
-#define ISO_SUSP_CFLAG_CURRENT 0x02
-#define ISO_SUSP_CFLAG_PARENT 0x04
-#define ISO_SUSP_CFLAG_ROOT 0x08
-#define ISO_SUSP_CFLAG_VOLROOT 0x10
-#define ISO_SUSP_CFLAG_HOST 0x20
-
-typedef struct {
- u_char cflag [ISODCL ( 1, 1)];
- u_char clen [ISODCL ( 2, 2)];
- u_char name [1]; /* XXX */
-} ISO_RRIP_SLINK_COMPONENT;
-#define ISO_RRIP_SLSIZ 2
-
-typedef struct {
- ISO_SUSP_HEADER h;
- u_char flags [ISODCL ( 4, 4)];
- u_char component [ISODCL ( 5, 5)];
-} ISO_RRIP_SLINK;
-
-typedef struct {
- ISO_SUSP_HEADER h;
- char flags [ISODCL ( 4, 4)];
-} ISO_RRIP_ALTNAME;
-
-typedef struct {
- ISO_SUSP_HEADER h;
- char dir_loc [ISODCL ( 4, 11)]; /* 733 */
-} ISO_RRIP_CLINK;
-
-typedef struct {
- ISO_SUSP_HEADER h;
- char dir_loc [ISODCL ( 4, 11)]; /* 733 */
-} ISO_RRIP_PLINK;
-
-typedef struct {
- ISO_SUSP_HEADER h;
-} ISO_RRIP_RELDIR;
-
-#define ISO_SUSP_TSTAMP_FORM17 0x80
-#define ISO_SUSP_TSTAMP_FORM7 0x00
-#define ISO_SUSP_TSTAMP_CREAT 0x01
-#define ISO_SUSP_TSTAMP_MODIFY 0x02
-#define ISO_SUSP_TSTAMP_ACCESS 0x04
-#define ISO_SUSP_TSTAMP_ATTR 0x08
-#define ISO_SUSP_TSTAMP_BACKUP 0x10
-#define ISO_SUSP_TSTAMP_EXPIRE 0x20
-#define ISO_SUSP_TSTAMP_EFFECT 0x40
-
-typedef struct {
- ISO_SUSP_HEADER h;
- u_char flags [ISODCL ( 4, 4)];
- u_char time [ISODCL ( 5, 5)];
-} ISO_RRIP_TSTAMP;
-
-typedef struct {
- ISO_SUSP_HEADER h;
- u_char flags [ISODCL ( 4, 4)];
-} ISO_RRIP_IDFLAG;
-
-typedef struct {
- ISO_SUSP_HEADER h;
- char len_id [ISODCL ( 4, 4)];
- char len_des [ISODCL ( 5, 5)];
- char len_src [ISODCL ( 6, 6)];
- char version [ISODCL ( 7, 7)];
-} ISO_RRIP_EXTREF;
-
-typedef struct {
- ISO_SUSP_HEADER h;
- char check [ISODCL ( 4, 5)];
- char skip [ISODCL ( 6, 6)];
-} ISO_RRIP_OFFSET;
-
-typedef struct {
- ISO_SUSP_HEADER h;
- char location [ISODCL ( 4, 11)];
- char offset [ISODCL ( 12, 19)];
- char length [ISODCL ( 20, 27)];
-} ISO_RRIP_CONT;
diff --git a/sys/fs/cd9660/cd9660_util.c b/sys/fs/cd9660/cd9660_util.c
deleted file mode 100644
index 1922627..0000000
--- a/sys/fs/cd9660/cd9660_util.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp). Joliet support was added by
- * Joachim Kuebart (joki@kuebart.stuttgart.netsurf.de).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cd9660_util.c 8.3 (Berkeley) 12/5/94
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
-#include <sys/iconv.h>
-
-#include <isofs/cd9660/iso.h>
-#include <isofs/cd9660/cd9660_mount.h>
-
-extern struct iconv_functions *cd9660_iconv;
-
-/*
- * Get one character out of an iso filename
- * Obey joliet_level
- * Return number of bytes consumed
- */
-int
-isochar(isofn, isoend, joliet_level, c, clen, flags, handle)
- u_char *isofn;
- u_char *isoend;
- int joliet_level;
- u_short *c;
- int *clen;
- int flags;
- void *handle;
-{
- size_t i, j, len;
- char inbuf[3], outbuf[3], *inp, *outp;
-
- *c = *isofn++;
- if (clen) *clen = 1;
- if (joliet_level == 0 || isofn == isoend)
- /* (00) and (01) are one byte in Joliet, too */
- return 1;
-
- if (flags & ISOFSMNT_KICONV && cd9660_iconv) {
- i = j = len = 2;
- inbuf[0]=(char)*(isofn - 1);
- inbuf[1]=(char)*isofn;
- inbuf[2]='\0';
- inp = inbuf;
- outp = outbuf;
- cd9660_iconv->convchr(handle, (const char **)&inp, &i, &outp, &j);
- len -= j;
- if (clen) *clen = len;
- *c = '\0';
- while(len--)
- *c |= (*(outp - len - 1) & 0xff) << (len << 3);
- } else {
- switch (*c) {
- default:
- *c = '?';
- break;
- case '\0':
- *c = *isofn;
- break;
- }
- }
-
- return 2;
-}
-
-/*
- * translate and compare a filename
- * returns (fn - isofn)
- * Note: Version number plus ';' may be omitted.
- */
-int
-isofncmp(fn, fnlen, isofn, isolen, joliet_level, flags, handle, lhandle)
- u_char *fn;
- int fnlen;
- u_char *isofn;
- int isolen;
- int joliet_level;
- int flags;
- void *handle;
- void *lhandle;
-{
- int i, j;
- u_short c, d;
- u_char *fnend = fn + fnlen, *isoend = isofn + isolen;
-
- for (; fn < fnend; ) {
- d = sgetrune(fn, fnend - fn, (char const **)&fn, flags, lhandle);
- if (isofn == isoend)
- return d;
- isofn += isochar(isofn, isoend, joliet_level, &c, NULL, flags, handle);
- if (c == ';') {
- if (d != ';')
- return d;
- for (i = 0; fn < fnend; i = i * 10 + *fn++ - '0') {
- if (*fn < '0' || *fn > '9') {
- return -1;
- }
- }
- for (j = 0; isofn != isoend; j = j * 10 + c - '0')
- isofn += isochar(isofn, isoend,
- joliet_level, &c,
- NULL, flags, handle);
- return i - j;
- }
- if (c != d) {
- if (c >= 'A' && c <= 'Z') {
- if (c + ('a' - 'A') != d) {
- if (d >= 'a' && d <= 'z')
- return d - ('a' - 'A') - c;
- else
- return d - c;
- }
- } else
- return d - c;
- }
- }
- if (isofn != isoend) {
- isofn += isochar(isofn, isoend, joliet_level, &c, NULL, flags, handle);
- switch (c) {
- default:
- return -c;
- case '.':
- if (isofn != isoend) {
- isochar(isofn, isoend, joliet_level, &c,
- NULL, flags, handle);
- if (c == ';')
- return 0;
- }
- return -1;
- case ';':
- return 0;
- }
- }
- return 0;
-}
-
-/*
- * translate a filename of length > 0
- */
-void
-isofntrans(infn, infnlen, outfn, outfnlen, original, assoc, joliet_level, flags, handle)
- u_char *infn;
- int infnlen;
- u_char *outfn;
- u_short *outfnlen;
- int original;
- int assoc;
- int joliet_level;
- int flags;
- void *handle;
-{
- u_short c, d = '\0';
- u_char *outp = outfn, *infnend = infn + infnlen;
- int clen;
-
- if (assoc) {
- *outp++ = ASSOCCHAR;
- }
- for (; infn != infnend; ) {
- infn += isochar(infn, infnend, joliet_level, &c, &clen, flags, handle);
-
- if (!original && !joliet_level && c >= 'A' && c <= 'Z')
- c += ('a' - 'A');
- else if (!original && c == ';') {
- outp -= (d == '.');
- break;
- }
- d = c;
- while(clen--)
- *outp++ = c >> (clen << 3);
- }
- *outfnlen = outp - outfn;
-}
-
-/*
- * same as sgetrune(3)
- */
-u_short
-sgetrune(string, n, result, flags, handle)
- const char *string;
- size_t n;
- char const **result;
- int flags;
- void *handle;
-{
- size_t i, j, len;
- char outbuf[3], *outp;
- u_short c = '\0';
-
- len = i = (n < 2) ? n : 2;
- j = 2;
- outp = outbuf;
-
- if (flags & ISOFSMNT_KICONV && cd9660_iconv) {
- cd9660_iconv->convchr(handle, (const char **)&string,
- &i, &outp, &j);
- len -= i;
- } else {
- len = 1;
- string++;
- }
-
- if (result) *result = string;
- while(len--) c |= (*(string - len - 1) & 0xff) << (len << 3);
- return (c);
-}
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
deleted file mode 100644
index db5ecc6..0000000
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ /dev/null
@@ -1,837 +0,0 @@
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/cdio.h>
-#include <sys/conf.h>
-#include <sys/fcntl.h>
-#include <sys/malloc.h>
-#include <sys/stat.h>
-#include <sys/syslog.h>
-#include <sys/iconv.h>
-
-#include <isofs/cd9660/iso.h>
-#include <isofs/cd9660/iso_rrip.h>
-#include <isofs/cd9660/cd9660_node.h>
-#include <isofs/cd9660/cd9660_mount.h>
-
-#include <geom/geom.h>
-#include <geom/geom_vfs.h>
-
-MALLOC_DEFINE(M_ISOFSMNT, "ISOFS mount", "ISOFS mount structure");
-MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part");
-
-struct iconv_functions *cd9660_iconv = NULL;
-
-static vfs_mount_t cd9660_mount;
-static vfs_cmount_t cd9660_cmount;
-static vfs_unmount_t cd9660_unmount;
-static vfs_root_t cd9660_root;
-static vfs_statfs_t cd9660_statfs;
-static vfs_vget_t cd9660_vget;
-static vfs_fhtovp_t cd9660_fhtovp;
-static vfs_vptofh_t cd9660_vptofh;
-
-static struct vfsops cd9660_vfsops = {
- .vfs_fhtovp = cd9660_fhtovp,
- .vfs_mount = cd9660_mount,
- .vfs_cmount = cd9660_cmount,
- .vfs_root = cd9660_root,
- .vfs_statfs = cd9660_statfs,
- .vfs_unmount = cd9660_unmount,
- .vfs_vget = cd9660_vget,
- .vfs_vptofh = cd9660_vptofh,
-};
-VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY);
-MODULE_VERSION(cd9660, 1);
-
-static int iso_mountfs(struct vnode *devvp, struct mount *mp,
- struct thread *td);
-
-/*
- * VFS Operations.
- */
-
-static int
-cd9660_cmount(struct mntarg *ma, void *data, int flags, struct thread *td)
-{
- struct iso_args args;
- int error;
-
- error = copyin(data, &args, sizeof args);
- if (error)
- return (error);
-
- ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN);
- ma = mount_arg(ma, "export", &args.export, sizeof args.export);
- ma = mount_argsu(ma, "cs_disk", args.cs_disk, 64);
- ma = mount_argsu(ma, "cs_local", args.cs_local, 64);
- ma = mount_argf(ma, "ssector", "%u", args.ssector);
- ma = mount_argb(ma, !(args.flags & ISOFSMNT_NORRIP), "norrip");
- ma = mount_argb(ma, args.flags & ISOFSMNT_GENS, "nogens");
- ma = mount_argb(ma, args.flags & ISOFSMNT_EXTATT, "noextatt");
- ma = mount_argb(ma, !(args.flags & ISOFSMNT_NOJOLIET), "nojoliet");
- ma = mount_argb(ma,
- args.flags & ISOFSMNT_BROKENJOLIET, "nobrokenjoliet");
- ma = mount_argb(ma, args.flags & ISOFSMNT_KICONV, "nokiconv");
- ma = mount_argb(ma, args.flags & ISOFSMNT_EXTATT, "nogens");
-
- error = kernel_mount(ma, flags);
-
- return (error);
-}
-
-static int
-cd9660_mount(struct mount *mp, struct thread *td)
-{
- struct vnode *devvp;
- struct export_args *export;
- char *fspec;
- int error, len;
- mode_t accessmode;
- struct nameidata ndp;
- struct iso_mnt *imp = 0;
-
- if ((mp->mnt_flag & MNT_RDONLY) == 0)
- return (EROFS);
-
- fspec = vfs_getopts(mp->mnt_optnew, "from", &error);
- if (error)
- return (error);
-
- imp = VFSTOISOFS(mp);
- /*
- * If updating, check whether changing from read-only to
- * read/write; if there is no device name, that's all we do.
- */
- if (mp->mnt_flag & MNT_UPDATE) {
- error = vfs_getopt(mp->mnt_optnew,
- "export", (void **)&export, &len);
- if (error == 0 && len == sizeof *export && export->ex_flags)
- return (vfs_export(mp, export));
- }
- /*
- * Not an update, or updating the name: look up the name
- * and verify that it refers to a sensible block device.
- */
- NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td);
- if ((error = namei(&ndp)))
- return (error);
- NDFREE(&ndp, NDF_ONLY_PNBUF);
- devvp = ndp.ni_vp;
-
- if (!vn_isdisk(devvp, &error)) {
- vrele(devvp);
- return (error);
- }
-
- /*
- * Verify that user has necessary permissions on the device,
- * or has superuser abilities
- */
- accessmode = VREAD;
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td);
- if (error)
- error = suser(td);
- if (error) {
- vput(devvp);
- return (error);
- }
- VOP_UNLOCK(devvp, 0, td);
-
- if ((mp->mnt_flag & MNT_UPDATE) == 0) {
- error = iso_mountfs(devvp, mp, td);
- } else {
- if (devvp != imp->im_devvp)
- error = EINVAL; /* needs translation */
- else
- vrele(devvp);
- }
- if (error) {
- vrele(devvp);
- return error;
- }
- vfs_mountedfrom(mp, fspec);
- return 0;
-}
-
-/*
- * Common code for mount and mountroot
- */
-static int
-iso_mountfs(devvp, mp, td)
- struct vnode *devvp;
- struct mount *mp;
- struct thread *td;
-{
- struct iso_mnt *isomp = (struct iso_mnt *)0;
- struct buf *bp = NULL;
- struct buf *pribp = NULL, *supbp = NULL;
- struct cdev *dev = devvp->v_rdev;
- int error = EINVAL;
- int high_sierra = 0;
- int iso_bsize;
- int iso_blknum;
- int joliet_level;
- struct iso_volume_descriptor *vdp = 0;
- struct iso_primary_descriptor *pri = NULL;
- struct iso_sierra_primary_descriptor *pri_sierra = NULL;
- struct iso_supplementary_descriptor *sup = NULL;
- struct iso_directory_record *rootp;
- int logical_block_size, ssector;
- struct g_consumer *cp;
- struct bufobj *bo;
- char *cs_local, *cs_disk;
-
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- DROP_GIANT();
- g_topology_lock();
- error = g_vfs_open(devvp, &cp, "cd9660", 0);
- g_topology_unlock();
- PICKUP_GIANT();
- VOP_UNLOCK(devvp, 0, td);
- if (error)
- return error;
- if (devvp->v_rdev->si_iosize_max != 0)
- mp->mnt_iosize_max = devvp->v_rdev->si_iosize_max;
- if (mp->mnt_iosize_max > MAXPHYS)
- mp->mnt_iosize_max = MAXPHYS;
-
- bo = &devvp->v_bufobj;
- bo->bo_private = cp;
- bo->bo_ops = g_vfs_bufops;
-
- /* This is the "logical sector size". The standard says this
- * should be 2048 or the physical sector size on the device,
- * whichever is greater. For now, we'll just use a constant.
- */
- iso_bsize = ISO_DEFAULT_BLOCK_SIZE;
-
- joliet_level = 0;
- if (1 != vfs_scanopt(mp->mnt_optnew, "ssector", "%d", &ssector))
- ssector = 0;
- for (iso_blknum = 16 + ssector;
- iso_blknum < 100 + ssector;
- iso_blknum++) {
- if ((error = bread(devvp, iso_blknum * btodb(iso_bsize),
- iso_bsize, NOCRED, &bp)) != 0)
- goto out;
-
- vdp = (struct iso_volume_descriptor *)bp->b_data;
- if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) {
- if (bcmp (vdp->id_sierra, ISO_SIERRA_ID,
- sizeof vdp->id) != 0) {
- error = EINVAL;
- goto out;
- } else
- high_sierra = 1;
- }
- switch (isonum_711 (high_sierra? vdp->type_sierra: vdp->type)){
- case ISO_VD_PRIMARY:
- if (pribp == NULL) {
- pribp = bp;
- bp = NULL;
- pri = (struct iso_primary_descriptor *)vdp;
- pri_sierra =
- (struct iso_sierra_primary_descriptor *)vdp;
- }
- break;
-
- case ISO_VD_SUPPLEMENTARY:
- if (supbp == NULL) {
- supbp = bp;
- bp = NULL;
- sup = (struct iso_supplementary_descriptor *)vdp;
-
- if (vfs_flagopt(mp->mnt_optnew, "joliet", NULL, 0)) {
- if (bcmp(sup->escape, "%/@", 3) == 0)
- joliet_level = 1;
- if (bcmp(sup->escape, "%/C", 3) == 0)
- joliet_level = 2;
- if (bcmp(sup->escape, "%/E", 3) == 0)
- joliet_level = 3;
-
- if ((isonum_711 (sup->flags) & 1) &&
- !vfs_flagopt(mp->mnt_optnew, "brokenjoliet", NULL, 0))
- joliet_level = 0;
- }
- }
- break;
-
- case ISO_VD_END:
- goto vd_end;
-
- default:
- break;
- }
- if (bp) {
- brelse(bp);
- bp = NULL;
- }
- }
- vd_end:
- if (bp) {
- brelse(bp);
- bp = NULL;
- }
-
- if (pri == NULL) {
- error = EINVAL;
- goto out;
- }
-
- logical_block_size =
- isonum_723 (high_sierra?
- pri_sierra->logical_block_size:
- pri->logical_block_size);
-
- if (logical_block_size < DEV_BSIZE || logical_block_size > MAXBSIZE
- || (logical_block_size & (logical_block_size - 1)) != 0) {
- error = EINVAL;
- goto out;
- }
-
- rootp = (struct iso_directory_record *)
- (high_sierra?
- pri_sierra->root_directory_record:
- pri->root_directory_record);
-
- isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK | M_ZERO);
- isomp->im_cp = cp;
- isomp->im_bo = bo;
- isomp->logical_block_size = logical_block_size;
- isomp->volume_space_size =
- isonum_733 (high_sierra?
- pri_sierra->volume_space_size:
- pri->volume_space_size);
- isomp->joliet_level = 0;
- /*
- * Since an ISO9660 multi-session CD can also access previous
- * sessions, we have to include them into the space consider-
- * ations. This doesn't yield a very accurate number since
- * parts of the old sessions might be inaccessible now, but we
- * can't do much better. This is also important for the NFS
- * filehandle validation.
- */
- isomp->volume_space_size += ssector;
- bcopy (rootp, isomp->root, sizeof isomp->root);
- isomp->root_extent = isonum_733 (rootp->extent);
- isomp->root_size = isonum_733 (rootp->size);
-
- isomp->im_bmask = logical_block_size - 1;
- isomp->im_bshift = ffs(logical_block_size) - 1;
-
- pribp->b_flags |= B_AGE;
- brelse(pribp);
- pribp = NULL;
-
- mp->mnt_data = (qaddr_t)isomp;
- mp->mnt_stat.f_fsid.val[0] = dev2udev(dev);
- mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
- mp->mnt_maxsymlinklen = 0;
- mp->mnt_flag |= MNT_LOCAL;
- isomp->im_mountp = mp;
- isomp->im_dev = dev;
- isomp->im_devvp = devvp;
-
- vfs_flagopt(mp->mnt_optnew, "rrip", &isomp->im_flags, ISOFSMNT_NORRIP);
- vfs_flagopt(mp->mnt_optnew, "gens", &isomp->im_flags, ISOFSMNT_GENS);
- vfs_flagopt(mp->mnt_optnew, "extatt", &isomp->im_flags, ISOFSMNT_EXTATT);
- vfs_flagopt(mp->mnt_optnew, "joliet", &isomp->im_flags, ISOFSMNT_NOJOLIET);
- vfs_flagopt(mp->mnt_optnew, "kiconv", &isomp->im_flags, ISOFSMNT_KICONV);
- isomp->im_flags ^= (ISOFSMNT_NORRIP | ISOFSMNT_NOJOLIET);
- /* Check the Rock Ridge Extention support */
- if (vfs_flagopt(mp->mnt_optnew, "rrip", NULL, 0)) {
- if ((error = bread(isomp->im_devvp,
- (isomp->root_extent + isonum_711(rootp->ext_attr_length)) <<
- (isomp->im_bshift - DEV_BSHIFT),
- isomp->logical_block_size, NOCRED, &bp)) != 0)
- goto out;
-
- rootp = (struct iso_directory_record *)bp->b_data;
-
- if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) {
- isomp->im_flags |= ISOFSMNT_NORRIP;
- } else {
- isomp->im_flags &= ~ISOFSMNT_GENS;
- }
-
- /*
- * The contents are valid,
- * but they will get reread as part of another vnode, so...
- */
- bp->b_flags |= B_AGE;
- brelse(bp);
- bp = NULL;
- }
-
- if (isomp->im_flags & ISOFSMNT_KICONV && cd9660_iconv) {
- cs_local = vfs_getopts(mp->mnt_optnew, "cs_local", &error);
- if (error)
- goto out;
- cs_disk = vfs_getopts(mp->mnt_optnew, "cs_disk", &error);
- if (error)
- goto out;
- cd9660_iconv->open(cs_local, cs_disk, &isomp->im_d2l);
- cd9660_iconv->open(cs_disk, cs_local, &isomp->im_l2d);
- } else {
- isomp->im_d2l = NULL;
- isomp->im_l2d = NULL;
- }
-
- if (high_sierra) {
- /* this effectively ignores all the mount flags */
- if (bootverbose)
- log(LOG_INFO, "cd9660: High Sierra Format\n");
- isomp->iso_ftype = ISO_FTYPE_HIGH_SIERRA;
- } else
- switch (isomp->im_flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS)) {
- default:
- isomp->iso_ftype = ISO_FTYPE_DEFAULT;
- break;
- case ISOFSMNT_GENS|ISOFSMNT_NORRIP:
- isomp->iso_ftype = ISO_FTYPE_9660;
- break;
- case 0:
- if (bootverbose)
- log(LOG_INFO, "cd9660: RockRidge Extension\n");
- isomp->iso_ftype = ISO_FTYPE_RRIP;
- break;
- }
-
- /* Decide whether to use the Joliet descriptor */
-
- if (isomp->iso_ftype != ISO_FTYPE_RRIP && joliet_level) {
- if (bootverbose)
- log(LOG_INFO, "cd9660: Joliet Extension (Level %d)\n",
- joliet_level);
- rootp = (struct iso_directory_record *)
- sup->root_directory_record;
- bcopy (rootp, isomp->root, sizeof isomp->root);
- isomp->root_extent = isonum_733 (rootp->extent);
- isomp->root_size = isonum_733 (rootp->size);
- isomp->joliet_level = joliet_level;
- supbp->b_flags |= B_AGE;
- }
-
- if (supbp) {
- brelse(supbp);
- supbp = NULL;
- }
-
- return 0;
-out:
- if (bp)
- brelse(bp);
- if (pribp)
- brelse(pribp);
- if (supbp)
- brelse(supbp);
- if (cp != NULL) {
- DROP_GIANT();
- g_topology_lock();
- g_vfs_close(cp, td);
- g_topology_unlock();
- PICKUP_GIANT();
- }
- if (isomp) {
- free((caddr_t)isomp, M_ISOFSMNT);
- mp->mnt_data = (qaddr_t)0;
- }
- return error;
-}
-
-/*
- * unmount system call
- */
-static int
-cd9660_unmount(mp, mntflags, td)
- struct mount *mp;
- int mntflags;
- struct thread *td;
-{
- struct iso_mnt *isomp;
- int error, flags = 0;
-
- if (mntflags & MNT_FORCE)
- flags |= FORCECLOSE;
-#if 0
- mntflushbuf(mp, 0);
- if (mntinvalbuf(mp))
- return EBUSY;
-#endif
- if ((error = vflush(mp, 0, flags, td)))
- return (error);
-
- isomp = VFSTOISOFS(mp);
-
- if (isomp->im_flags & ISOFSMNT_KICONV && cd9660_iconv) {
- if (isomp->im_d2l)
- cd9660_iconv->close(isomp->im_d2l);
- if (isomp->im_l2d)
- cd9660_iconv->close(isomp->im_l2d);
- }
- DROP_GIANT();
- g_topology_lock();
- g_vfs_close(isomp->im_cp, td);
- g_topology_unlock();
- PICKUP_GIANT();
- vrele(isomp->im_devvp);
- free((caddr_t)isomp, M_ISOFSMNT);
- mp->mnt_data = (qaddr_t)0;
- mp->mnt_flag &= ~MNT_LOCAL;
- return (error);
-}
-
-/*
- * Return root of a filesystem
- */
-static int
-cd9660_root(mp, flags, vpp, td)
- struct mount *mp;
- int flags;
- struct vnode **vpp;
- struct thread *td;
-{
- struct iso_mnt *imp = VFSTOISOFS(mp);
- struct iso_directory_record *dp =
- (struct iso_directory_record *)imp->root;
- ino_t ino = isodirino(dp, imp);
-
- /*
- * With RRIP we must use the `.' entry of the root directory.
- * Simply tell vget, that it's a relocated directory.
- */
- return (cd9660_vget_internal(mp, ino, LK_EXCLUSIVE, vpp,
- imp->iso_ftype == ISO_FTYPE_RRIP, dp));
-}
-
-/*
- * Get filesystem statistics.
- */
-static int
-cd9660_statfs(mp, sbp, td)
- struct mount *mp;
- struct statfs *sbp;
- struct thread *td;
-{
- struct iso_mnt *isomp;
-
- isomp = VFSTOISOFS(mp);
-
- sbp->f_bsize = isomp->logical_block_size;
- sbp->f_iosize = sbp->f_bsize; /* XXX */
- sbp->f_blocks = isomp->volume_space_size;
- sbp->f_bfree = 0; /* total free blocks */
- sbp->f_bavail = 0; /* blocks free for non superuser */
- sbp->f_files = 0; /* total files */
- sbp->f_ffree = 0; /* free file nodes */
- return 0;
-}
-
-/*
- * File handle to vnode
- *
- * Have to be really careful about stale file handles:
- * - check that the inode number is in range
- * - call iget() to get the locked inode
- * - check for an unallocated inode (i_mode == 0)
- * - check that the generation number matches
- */
-
-struct ifid {
- u_short ifid_len;
- u_short ifid_pad;
- int ifid_ino;
- long ifid_start;
-};
-
-/* ARGSUSED */
-static int
-cd9660_fhtovp(mp, fhp, vpp)
- struct mount *mp;
- struct fid *fhp;
- struct vnode **vpp;
-{
- struct ifid *ifhp = (struct ifid *)fhp;
- struct iso_node *ip;
- struct vnode *nvp;
- int error;
-
-#ifdef ISOFS_DBG
- printf("fhtovp: ino %d, start %ld\n",
- ifhp->ifid_ino, ifhp->ifid_start);
-#endif
-
- if ((error = VFS_VGET(mp, ifhp->ifid_ino, LK_EXCLUSIVE, &nvp)) != 0) {
- *vpp = NULLVP;
- return (error);
- }
- ip = VTOI(nvp);
- if (ip->inode.iso_mode == 0) {
- vput(nvp);
- *vpp = NULLVP;
- return (ESTALE);
- }
- *vpp = nvp;
- vnode_create_vobject(*vpp, ip->i_size, curthread);
- return (0);
-}
-
-static int
-cd9660_vget(mp, ino, flags, vpp)
- struct mount *mp;
- ino_t ino;
- int flags;
- struct vnode **vpp;
-{
-
- /*
- * XXXX
- * It would be nice if we didn't always set the `relocated' flag
- * and force the extra read, but I don't want to think about fixing
- * that right now.
- */
- return (cd9660_vget_internal(mp, ino, flags, vpp,
-#if 0
- VFSTOISOFS(mp)->iso_ftype == ISO_FTYPE_RRIP,
-#else
- 0,
-#endif
- (struct iso_directory_record *)0));
-}
-
-int
-cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir)
- struct mount *mp;
- ino_t ino;
- int flags;
- struct vnode **vpp;
- int relocated;
- struct iso_directory_record *isodir;
-{
- struct iso_mnt *imp;
- struct iso_node *ip;
- struct buf *bp;
- struct vnode *vp;
- struct cdev *dev;
- int error;
-
- error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
- if (error || *vpp != NULL)
- return (error);
-
- imp = VFSTOISOFS(mp);
- dev = imp->im_dev;
-
- /* Allocate a new vnode/iso_node. */
- if ((error = getnewvnode("isofs", mp, &cd9660_vnodeops, &vp)) != 0) {
- *vpp = NULLVP;
- return (error);
- }
- MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE,
- M_WAITOK | M_ZERO);
- vp->v_data = ip;
- ip->i_vnode = vp;
- ip->i_number = ino;
-
- error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL);
- if (error || *vpp != NULL)
- return (error);
-
- if (isodir == 0) {
- int lbn, off;
-
- lbn = lblkno(imp, ino);
- if (lbn >= imp->volume_space_size) {
- vput(vp);
- printf("fhtovp: lbn exceed volume space %d\n", lbn);
- return (ESTALE);
- }
-
- off = blkoff(imp, ino);
- if (off + ISO_DIRECTORY_RECORD_SIZE > imp->logical_block_size) {
- vput(vp);
- printf("fhtovp: crosses block boundary %d\n",
- off + ISO_DIRECTORY_RECORD_SIZE);
- return (ESTALE);
- }
-
- error = bread(imp->im_devvp,
- lbn << (imp->im_bshift - DEV_BSHIFT),
- imp->logical_block_size, NOCRED, &bp);
- if (error) {
- vput(vp);
- brelse(bp);
- printf("fhtovp: bread error %d\n",error);
- return (error);
- }
- isodir = (struct iso_directory_record *)(bp->b_data + off);
-
- if (off + isonum_711(isodir->length) >
- imp->logical_block_size) {
- vput(vp);
- if (bp != 0)
- brelse(bp);
- printf("fhtovp: directory crosses block boundary %d[off=%d/len=%d]\n",
- off +isonum_711(isodir->length), off,
- isonum_711(isodir->length));
- return (ESTALE);
- }
-
-#if 0
- if (isonum_733(isodir->extent) +
- isonum_711(isodir->ext_attr_length) != ifhp->ifid_start) {
- if (bp != 0)
- brelse(bp);
- printf("fhtovp: file start miss %d vs %d\n",
- isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length),
- ifhp->ifid_start);
- return (ESTALE);
- }
-#endif
- } else
- bp = 0;
-
- ip->i_mnt = imp;
- VREF(imp->im_devvp);
-
- if (relocated) {
- /*
- * On relocated directories we must
- * read the `.' entry out of a dir.
- */
- ip->iso_start = ino >> imp->im_bshift;
- if (bp != 0)
- brelse(bp);
- if ((error = cd9660_blkatoff(vp, (off_t)0, NULL, &bp)) != 0) {
- vput(vp);
- return (error);
- }
- isodir = (struct iso_directory_record *)bp->b_data;
- }
-
- ip->iso_extent = isonum_733(isodir->extent);
- ip->i_size = isonum_733(isodir->size);
- ip->iso_start = isonum_711(isodir->ext_attr_length) + ip->iso_extent;
-
- /*
- * Setup time stamp, attribute
- */
- vp->v_type = VNON;
- switch (imp->iso_ftype) {
- default: /* ISO_FTYPE_9660 */
- {
- struct buf *bp2;
- int off;
- if ((imp->im_flags & ISOFSMNT_EXTATT)
- && (off = isonum_711(isodir->ext_attr_length)))
- cd9660_blkatoff(vp, (off_t)-(off << imp->im_bshift), NULL,
- &bp2);
- else
- bp2 = NULL;
- cd9660_defattr(isodir, ip, bp2, ISO_FTYPE_9660);
- cd9660_deftstamp(isodir, ip, bp2, ISO_FTYPE_9660);
- if (bp2)
- brelse(bp2);
- break;
- }
- case ISO_FTYPE_RRIP:
- cd9660_rrip_analyze(isodir, ip, imp);
- break;
- }
-
- if (bp != 0)
- brelse(bp);
-
- /*
- * Initialize the associated vnode
- */
- switch (vp->v_type = IFTOVT(ip->inode.iso_mode)) {
- case VFIFO:
- vp->v_op = &cd9660_fifoops;
- break;
- default:
- break;
- }
-
- if (ip->iso_extent == imp->root_extent)
- vp->v_vflag |= VV_ROOT;
-
- /*
- * XXX need generation number?
- */
-
- *vpp = vp;
- return (0);
-}
-
-/*
- * Vnode pointer to File handle
- */
-/* ARGSUSED */
-static int
-cd9660_vptofh(vp, fhp)
- struct vnode *vp;
- struct fid *fhp;
-{
- struct iso_node *ip = VTOI(vp);
- struct ifid *ifhp;
-
- ifhp = (struct ifid *)fhp;
- ifhp->ifid_len = sizeof(struct ifid);
-
- ifhp->ifid_ino = ip->i_number;
- ifhp->ifid_start = ip->iso_start;
-
-#ifdef ISOFS_DBG
- printf("vptofh: ino %d, start %ld\n",
- ifhp->ifid_ino,ifhp->ifid_start);
-#endif
- return 0;
-}
diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c
deleted file mode 100644
index e4f6336..0000000
--- a/sys/fs/cd9660/cd9660_vnops.c
+++ /dev/null
@@ -1,832 +0,0 @@
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/namei.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/stat.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
-#include <fs/fifofs/fifo.h>
-#include <sys/malloc.h>
-#include <sys/dirent.h>
-#include <sys/unistd.h>
-#include <sys/filio.h>
-
-#include <vm/vm.h>
-#include <vm/vnode_pager.h>
-#include <vm/uma.h>
-
-#include <isofs/cd9660/iso.h>
-#include <isofs/cd9660/cd9660_node.h>
-#include <isofs/cd9660/iso_rrip.h>
-
-static vop_setattr_t cd9660_setattr;
-static vop_open_t cd9660_open;
-static vop_access_t cd9660_access;
-static vop_getattr_t cd9660_getattr;
-static vop_ioctl_t cd9660_ioctl;
-static vop_pathconf_t cd9660_pathconf;
-static vop_read_t cd9660_read;
-struct isoreaddir;
-static int iso_uiodir(struct isoreaddir *idp, struct dirent *dp, off_t off);
-static int iso_shipdir(struct isoreaddir *idp);
-static vop_readdir_t cd9660_readdir;
-static vop_readlink_t cd9660_readlink;
-static vop_strategy_t cd9660_strategy;
-
-/*
- * Setattr call. Only allowed for block and character special devices.
- */
-static int
-cd9660_setattr(ap)
- struct vop_setattr_args /* {
- struct vnodeop_desc *a_desc;
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- struct thread *a_td;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct vattr *vap = ap->a_vap;
-
- if (vap->va_flags != (u_long)VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
- vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
- vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL)
- return (EROFS);
- if (vap->va_size != (u_quad_t)VNOVAL) {
- switch (vp->v_type) {
- case VDIR:
- return (EISDIR);
- case VLNK:
- case VREG:
- return (EROFS);
- case VCHR:
- case VBLK:
- case VSOCK:
- case VFIFO:
- case VNON:
- case VBAD:
- return (0);
- }
- }
- return (0);
-}
-
-/*
- * Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
- * The mode is shifted to select the owner/group/other fields. The
- * super user is granted all permissions.
- */
-/* ARGSUSED */
-static int
-cd9660_access(ap)
- struct vop_access_args /* {
- struct vnode *a_vp;
- int a_mode;
- struct ucred *a_cred;
- struct thread *a_td;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct iso_node *ip = VTOI(vp);
- mode_t mode = ap->a_mode;
-
- if (vp->v_type == VCHR || vp->v_type == VBLK)
- return (EOPNOTSUPP);
-
- /*
- * Disallow write attempts unless the file is a socket,
- * fifo, or a block or character device resident on the
- * filesystem.
- */
- if (mode & VWRITE) {
- switch (vp->v_type) {
- case VDIR:
- case VLNK:
- case VREG:
- return (EROFS);
- /* NOT REACHED */
- default:
- break;
- }
- }
-
- return (vaccess(vp->v_type, ip->inode.iso_mode, ip->inode.iso_uid,
- ip->inode.iso_gid, ap->a_mode, ap->a_cred, NULL));
-}
-
-static int
-cd9660_open(ap)
- struct vop_open_args /* {
- struct vnode *a_vp;
- int a_mode;
- struct ucred *a_cred;
- struct thread *a_td;
- int a_fdidx;
- } */ *ap;
-{
- struct iso_node *ip = VTOI(ap->a_vp);
-
- vnode_create_vobject(ap->a_vp, ip->i_size, ap->a_td);
- return 0;
-}
-
-
-static int
-cd9660_getattr(ap)
- struct vop_getattr_args /* {
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- struct thread *a_td;
- } */ *ap;
-
-{
- struct vnode *vp = ap->a_vp;
- struct vattr *vap = ap->a_vap;
- struct iso_node *ip = VTOI(vp);
-
- vap->va_fsid = dev2udev(ip->i_mnt->im_dev);
- vap->va_fileid = ip->i_number;
-
- vap->va_mode = ip->inode.iso_mode;
- vap->va_nlink = ip->inode.iso_links;
- vap->va_uid = ip->inode.iso_uid;
- vap->va_gid = ip->inode.iso_gid;
- vap->va_atime = ip->inode.iso_atime;
- vap->va_mtime = ip->inode.iso_mtime;
- vap->va_ctime = ip->inode.iso_ctime;
- vap->va_rdev = ip->inode.iso_rdev;
-
- vap->va_size = (u_quad_t) ip->i_size;
- if (ip->i_size == 0 && (vap->va_mode & S_IFMT) == S_IFLNK) {
- struct vop_readlink_args rdlnk;
- struct iovec aiov;
- struct uio auio;
- char *cp;
-
- MALLOC(cp, char *, MAXPATHLEN, M_TEMP, M_WAITOK);
- aiov.iov_base = cp;
- aiov.iov_len = MAXPATHLEN;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_offset = 0;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_td = ap->a_td;
- auio.uio_resid = MAXPATHLEN;
- rdlnk.a_uio = &auio;
- rdlnk.a_vp = ap->a_vp;
- rdlnk.a_cred = ap->a_cred;
- if (cd9660_readlink(&rdlnk) == 0)
- vap->va_size = MAXPATHLEN - auio.uio_resid;
- FREE(cp, M_TEMP);
- }
- vap->va_flags = 0;
- vap->va_gen = 1;
- vap->va_blocksize = ip->i_mnt->logical_block_size;
- vap->va_bytes = (u_quad_t) ip->i_size;
- vap->va_type = vp->v_type;
- vap->va_filerev = 0;
- return (0);
-}
-
-/*
- * Vnode op for ioctl.
- */
-static int
-cd9660_ioctl(ap)
- struct vop_ioctl_args /* {
- struct vnode *a_vp;
- u_long a_command;
- caddr_t a_data;
- int a_fflag;
- struct ucred *a_cred;
- struct thread *a_td;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct iso_node *ip = VTOI(vp);
-
- if (vp->v_type == VCHR || vp->v_type == VBLK)
- return (EOPNOTSUPP);
-
- switch (ap->a_command) {
-
- case FIOGETLBA:
- *(int *)(ap->a_data) = ip->iso_start;
- return 0;
- default:
- return (ENOTTY);
- }
-}
-
-/*
- * Vnode op for reading.
- */
-static int
-cd9660_read(ap)
- struct vop_read_args /* {
- struct vnode *a_vp;
- struct uio *a_uio;
- int a_ioflag;
- struct ucred *a_cred;
- } */ *ap;
-{
- struct vnode *vp = ap->a_vp;
- struct uio *uio = ap->a_uio;
- struct iso_node *ip = VTOI(vp);
- struct iso_mnt *imp;
- struct buf *bp;
- daddr_t lbn, rablock;
- off_t diff;
- int rasize, error = 0;
- int seqcount;
- long size, n, on;
-
- if (vp->v_type == VCHR || vp->v_type == VBLK)
- return (EOPNOTSUPP);
-
- seqcount = ap->a_ioflag >> IO_SEQSHIFT;
-
- if (uio->uio_resid == 0)
- return (0);
- if (uio->uio_offset < 0)
- return (EINVAL);
- ip->i_flag |= IN_ACCESS;
- imp = ip->i_mnt;
- do {
- lbn = lblkno(imp, uio->uio_offset);
- on = blkoff(imp, uio->uio_offset);
- n = min((u_int)(imp->logical_block_size - on),
- uio->uio_resid);
- diff = (off_t)ip->i_size - uio->uio_offset;
- if (diff <= 0)
- return (0);
- if (diff < n)
- n = diff;
- size = blksize(imp, ip, lbn);
- rablock = lbn + 1;
- if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
- if (lblktosize(imp, rablock) < ip->i_size)
- error = cluster_read(vp, (off_t)ip->i_size,
- lbn, size, NOCRED, uio->uio_resid,
- (ap->a_ioflag >> 16), &bp);
- else
- error = bread(vp, lbn, size, NOCRED, &bp);
- } else {
- if (seqcount > 1 &&
- lblktosize(imp, rablock) < ip->i_size) {
- rasize = blksize(imp, ip, rablock);
- error = breadn(vp, lbn, size, &rablock,
- &rasize, 1, NOCRED, &bp);
- } else
- error = bread(vp, lbn, size, NOCRED, &bp);
- }
- n = min(n, size - bp->b_resid);
- if (error) {
- brelse(bp);
- return (error);
- }
-
- error = uiomove(bp->b_data + on, (int)n, uio);
- brelse(bp);
- } while (error == 0 && uio->uio_resid > 0 && n != 0);
- return (error);
-}
-
-/*
- * Structure for reading directories
- */
-struct isoreaddir {
- struct dirent saveent;
- struct dirent assocent;
- struct dirent current;
- off_t saveoff;
- off_t assocoff;
- off_t curroff;
- struct uio *uio;
- off_t uio_off;
- int eofflag;
- u_long *cookies;
- int ncookies;
-};
-
-static int
-iso_uiodir(idp,dp,off)
- struct isoreaddir *idp;
- struct dirent *dp;
- off_t off;
-{
- int error;
-
- dp->d_name[dp->d_namlen] = 0;
- dp->d_reclen = GENERIC_DIRSIZ(dp);
-
- if (idp->uio->uio_resid < dp->d_reclen) {
- idp->eofflag = 0;
- return (-1);
- }
-
- if (idp->cookies) {
- if (idp->ncookies <= 0) {
- idp->eofflag = 0;
- return (-1);
- }
-
- *idp->cookies++ = off;
- --idp->ncookies;
- }
-
- if ((error = uiomove(dp, dp->d_reclen, idp->uio)) != 0)
- return (error);
- idp->uio_off = off;
- return (0);
-}
-
-static int
-iso_shipdir(idp)
- struct isoreaddir *idp;
-{
- struct dirent *dp;
- int cl, sl, assoc;
- int error;
- char *cname, *sname;
-
- cl = idp->current.d_namlen;
- cname = idp->current.d_name;
-assoc = (cl > 1) && (*cname == ASSOCCHAR);
- if (assoc) {
- cl--;
- cname++;
- }
-
- dp = &idp->saveent;
- sname = dp->d_name;
- if (!(sl = dp->d_namlen)) {
- dp = &idp->assocent;
- sname = dp->d_name + 1;
- sl = dp->d_namlen - 1;
- }
- if (sl > 0) {
- if (sl != cl
- || bcmp(sname,cname,sl)) {
- if (idp->assocent.d_namlen) {
- if ((error = iso_uiodir(idp,&idp->assocent,idp->assocoff)) != 0)
- return (error);
- idp->assocent.d_namlen = 0;
- }
- if (idp->saveent.d_namlen) {
- if ((error = iso_uiodir(idp,&idp->saveent,idp->saveoff)) != 0)
- return (error);
- idp->saveent.d_namlen = 0;
- }
- }
- }
- idp->current.d_reclen = GENERIC_DIRSIZ(&idp->current);
- if (assoc) {
- idp->assocoff = idp->curroff;
- bcopy(&idp->current,&idp->assocent,idp->current.d_reclen);
- } else {
- idp->saveoff = idp->curroff;
- bcopy(&idp->current,&idp->saveent,idp->current.d_reclen);
- }
- return (0);
-}
-
-/*
- * Vnode op for readdir
- */
-static int
-cd9660_readdir(ap)
- struct vop_readdir_args /* {
- struct vnode *a_vp;
- struct uio *a_uio;
- struct ucred *a_cred;
- int *a_eofflag;
- int *a_ncookies;
- u_long **a_cookies;
- } */ *ap;
-{
- struct uio *uio = ap->a_uio;
- struct isoreaddir *idp;
- struct vnode *vdp = ap->a_vp;
- struct iso_node *dp;
- struct iso_mnt *imp;
- struct buf *bp = NULL;
- struct iso_directory_record *ep;
- int entryoffsetinblock;
- doff_t endsearch;
- u_long bmask;
- int error = 0;
- int reclen;
- u_short namelen;
- int ncookies = 0;
- u_long *cookies = NULL;
-
- dp = VTOI(vdp);
- imp = dp->i_mnt;
- bmask = imp->im_bmask;
-
- MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, M_WAITOK);
- idp->saveent.d_namlen = idp->assocent.d_namlen = 0;
- /*
- * XXX
- * Is it worth trying to figure out the type?
- */
- idp->saveent.d_type = idp->assocent.d_type = idp->current.d_type =
- DT_UNKNOWN;
- idp->uio = uio;
- if (ap->a_ncookies == NULL) {
- idp->cookies = NULL;
- } else {
- /*
- * Guess the number of cookies needed.
- */
- ncookies = uio->uio_resid / 16;
- MALLOC(cookies, u_long *, ncookies * sizeof(u_long),
- M_TEMP, M_WAITOK);
- idp->cookies = cookies;
- idp->ncookies = ncookies;
- }
- idp->eofflag = 1;
- idp->curroff = uio->uio_offset;
-
- if ((entryoffsetinblock = idp->curroff & bmask) &&
- (error = cd9660_blkatoff(vdp, (off_t)idp->curroff, NULL, &bp))) {
- FREE(idp, M_TEMP);
- return (error);
- }
- endsearch = dp->i_size;
-
- while (idp->curroff < endsearch) {
- /*
- * If offset is on a block boundary,
- * read the next directory block.
- * Release previous if it exists.
- */
- if ((idp->curroff & bmask) == 0) {
- if (bp != NULL)
- brelse(bp);
- if ((error =
- cd9660_blkatoff(vdp, (off_t)idp->curroff, NULL, &bp)) != 0)
- break;
- entryoffsetinblock = 0;
- }
- /*
- * Get pointer to next entry.
- */
- ep = (struct iso_directory_record *)
- ((char *)bp->b_data + entryoffsetinblock);
-
- reclen = isonum_711(ep->length);
- if (reclen == 0) {
- /* skip to next block, if any */
- idp->curroff =
- (idp->curroff & ~bmask) + imp->logical_block_size;
- continue;
- }
-
- if (reclen < ISO_DIRECTORY_RECORD_SIZE) {
- error = EINVAL;
- /* illegal entry, stop */
- break;
- }
-
- if (entryoffsetinblock + reclen > imp->logical_block_size) {
- error = EINVAL;
- /* illegal directory, so stop looking */
- break;
- }
-
- idp->current.d_namlen = isonum_711(ep->name_len);
-
- if (reclen < ISO_DIRECTORY_RECORD_SIZE + idp->current.d_namlen) {
- error = EINVAL;
- /* illegal entry, stop */
- break;
- }
-
- if (isonum_711(ep->flags)&2)
- idp->current.d_fileno = isodirino(ep, imp);
- else
- idp->current.d_fileno = dbtob(bp->b_blkno) +
- entryoffsetinblock;
-
- idp->curroff += reclen;
-
- switch (imp->iso_ftype) {
- case ISO_FTYPE_RRIP:
- cd9660_rrip_getname(ep,idp->current.d_name, &namelen,
- &idp->current.d_fileno,imp);
- idp->current.d_namlen = (u_char)namelen;
- if (idp->current.d_namlen)
- error = iso_uiodir(idp,&idp->current,idp->curroff);
- break;
- default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 || ISO_FTYPE_HIGH_SIERRA*/
- strcpy(idp->current.d_name,"..");
- if (idp->current.d_namlen == 1 && ep->name[0] == 0) {
- idp->current.d_namlen = 1;
- error = iso_uiodir(idp,&idp->current,idp->curroff);
- } else if (idp->current.d_namlen == 1 && ep->name[0] == 1) {
- idp->current.d_namlen = 2;
- error = iso_uiodir(idp,&idp->current,idp->curroff);
- } else {
- isofntrans(ep->name,idp->current.d_namlen,
- idp->current.d_name, &namelen,
- imp->iso_ftype == ISO_FTYPE_9660,
- isonum_711(ep->flags)&4,
- imp->joliet_level,
- imp->im_flags,
- imp->im_d2l);
- idp->current.d_namlen = (u_char)namelen;
- if (imp->iso_ftype == ISO_FTYPE_DEFAULT)
- error = iso_shipdir(idp);
- else
- error = iso_uiodir(idp,&idp->current,idp->curroff);
- }
- }
- if (error)
- break;
-
- entryoffsetinblock += reclen;
- }
-
- if (!error && imp->iso_ftype == ISO_FTYPE_DEFAULT) {
- idp->current.d_namlen = 0;
- error = iso_shipdir(idp);
- }
- if (error < 0)
- error = 0;
-
- if (ap->a_ncookies != NULL) {
- if (error)
- free(cookies, M_TEMP);
- else {
- /*
- * Work out the number of cookies actually used.
- */
- *ap->a_ncookies = ncookies - idp->ncookies;
- *ap->a_cookies = cookies;
- }
- }
-
- if (bp)
- brelse (bp);
-
- uio->uio_offset = idp->uio_off;
- *ap->a_eofflag = idp->eofflag;
-
- FREE(idp, M_TEMP);
-
- return (error);
-}
-
-/*
- * Return target name of a symbolic link
- * Shouldn't we get the parent vnode and read the data from there?
- * This could eventually result in deadlocks in cd9660_lookup.
- * But otherwise the block read here is in the block buffer two times.
- */
-typedef struct iso_directory_record ISODIR;
-typedef struct iso_node ISONODE;
-typedef struct iso_mnt ISOMNT;
-static int
-cd9660_readlink(ap)
- struct vop_readlink_args /* {
- struct vnode *a_vp;
- struct uio *a_uio;
- struct ucred *a_cred;
- } */ *ap;
-{
- ISONODE *ip;
- ISODIR *dirp;
- ISOMNT *imp;
- struct buf *bp;
- struct uio *uio;
- u_short symlen;
- int error;
- char *symname;
-
- ip = VTOI(ap->a_vp);
- imp = ip->i_mnt;
- uio = ap->a_uio;
-
- if (imp->iso_ftype != ISO_FTYPE_RRIP)
- return (EINVAL);
-
- /*
- * Get parents directory record block that this inode included.
- */
- error = bread(imp->im_devvp,
- (ip->i_number >> imp->im_bshift) <<
- (imp->im_bshift - DEV_BSHIFT),
- imp->logical_block_size, NOCRED, &bp);
- if (error) {
- brelse(bp);
- return (EINVAL);
- }
-
- /*
- * Setup the directory pointer for this inode
- */
- dirp = (ISODIR *)(bp->b_data + (ip->i_number & imp->im_bmask));
-
- /*
- * Just make sure, we have a right one....
- * 1: Check not cross boundary on block
- */
- if ((ip->i_number & imp->im_bmask) + isonum_711(dirp->length)
- > (unsigned)imp->logical_block_size) {
- brelse(bp);
- return (EINVAL);
- }
-
- /*
- * Now get a buffer
- * Abuse a namei buffer for now.
- */
- if (uio->uio_segflg == UIO_SYSSPACE)
- symname = uio->uio_iov->iov_base;
- else
- symname = uma_zalloc(namei_zone, M_WAITOK);
-
- /*
- * Ok, we just gathering a symbolic name in SL record.
- */
- if (cd9660_rrip_getsymname(dirp, symname, &symlen, imp) == 0) {
- if (uio->uio_segflg != UIO_SYSSPACE)
- uma_zfree(namei_zone, symname);
- brelse(bp);
- return (EINVAL);
- }
- /*
- * Don't forget before you leave from home ;-)
- */
- brelse(bp);
-
- /*
- * return with the symbolic name to caller's.
- */
- if (uio->uio_segflg != UIO_SYSSPACE) {
- error = uiomove(symname, symlen, uio);
- uma_zfree(namei_zone, symname);
- return (error);
- }
- uio->uio_resid -= symlen;
- uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + symlen;
- uio->uio_iov->iov_len -= symlen;
- return (0);
-}
-
-/*
- * Calculate the logical to physical mapping if not done already,
- * then call the device strategy routine.
- */
-static int
-cd9660_strategy(ap)
- struct vop_strategy_args /* {
- struct buf *a_vp;
- struct buf *a_bp;
- } */ *ap;
-{
- struct buf *bp = ap->a_bp;
- struct vnode *vp = ap->a_vp;
- struct iso_node *ip;
- struct bufobj *bo;
-
- ip = VTOI(vp);
- if (vp->v_type == VBLK || vp->v_type == VCHR)
- panic("cd9660_strategy: spec");
- if (bp->b_blkno == bp->b_lblkno) {
- bp->b_blkno = (ip->iso_start + bp->b_lblkno) <<
- (ip->i_mnt->im_bshift - DEV_BSHIFT);
- if ((long)bp->b_blkno == -1) /* XXX: cut&paste junk ? */
- clrbuf(bp);
- }
- if ((long)bp->b_blkno == -1) { /* XXX: cut&paste junk ? */
- bufdone(bp);
- return (0);
- }
- bp->b_iooffset = dbtob(bp->b_blkno);
- bo = ip->i_mnt->im_bo;
- BO_STRATEGY(bo, bp);
- return (0);
-}
-
-/*
- * Return POSIX pathconf information applicable to cd9660 filesystems.
- */
-static int
-cd9660_pathconf(ap)
- struct vop_pathconf_args /* {
- struct vnode *a_vp;
- int a_name;
- register_t *a_retval;
- } */ *ap;
-{
-
- switch (ap->a_name) {
- case _PC_LINK_MAX:
- *ap->a_retval = 1;
- return (0);
- case _PC_NAME_MAX:
- if (VTOI(ap->a_vp)->i_mnt->iso_ftype == ISO_FTYPE_RRIP)
- *ap->a_retval = NAME_MAX;
- else
- *ap->a_retval = 37;
- return (0);
- case _PC_PATH_MAX:
- *ap->a_retval = PATH_MAX;
- return (0);
- case _PC_PIPE_BUF:
- *ap->a_retval = PIPE_BUF;
- return (0);
- case _PC_CHOWN_RESTRICTED:
- *ap->a_retval = 1;
- return (0);
- case _PC_NO_TRUNC:
- *ap->a_retval = 1;
- return (0);
- default:
- return (EINVAL);
- }
- /* NOTREACHED */
-}
-
-/*
- * Global vfs data structures for cd9660
- */
-struct vop_vector cd9660_vnodeops = {
- .vop_default = &default_vnodeops,
- .vop_open = cd9660_open,
- .vop_access = cd9660_access,
- .vop_bmap = cd9660_bmap,
- .vop_cachedlookup = cd9660_lookup,
- .vop_getattr = cd9660_getattr,
- .vop_inactive = cd9660_inactive,
- .vop_ioctl = cd9660_ioctl,
- .vop_lookup = vfs_cache_lookup,
- .vop_pathconf = cd9660_pathconf,
- .vop_read = cd9660_read,
- .vop_readdir = cd9660_readdir,
- .vop_readlink = cd9660_readlink,
- .vop_reclaim = cd9660_reclaim,
- .vop_setattr = cd9660_setattr,
- .vop_strategy = cd9660_strategy,
-};
-
-/*
- * Special device vnode ops
- */
-
-struct vop_vector cd9660_fifoops = {
- .vop_default = &fifo_specops,
- .vop_access = cd9660_access,
- .vop_getattr = cd9660_getattr,
- .vop_inactive = cd9660_inactive,
- .vop_reclaim = cd9660_reclaim,
- .vop_setattr = cd9660_setattr,
-};
diff --git a/sys/fs/cd9660/iso.h b/sys/fs/cd9660/iso.h
deleted file mode 100644
index 8645f58..0000000
--- a/sys/fs/cd9660/iso.h
+++ /dev/null
@@ -1,357 +0,0 @@
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)iso.h 8.6 (Berkeley) 5/10/95
- * $FreeBSD$
- */
-
-#define ISODCL(from, to) (to - from + 1)
-
-struct iso_volume_descriptor {
- char type[ISODCL(1,1)]; /* 711 */
- char id[ISODCL(2,6)];
- char version[ISODCL(7,7)];
- char unused[ISODCL(8,8)];
- char type_sierra[ISODCL(9,9)]; /* 711 */
- char id_sierra[ISODCL(10,14)];
- char version_sierra[ISODCL(15,15)];
- char data[ISODCL(16,2048)];
-};
-
-/* volume descriptor types */
-#define ISO_VD_PRIMARY 1
-#define ISO_VD_SUPPLEMENTARY 2
-#define ISO_VD_END 255
-
-#define ISO_STANDARD_ID "CD001"
-#define ISO_ECMA_ID "CDW01"
-
-#define ISO_SIERRA_ID "CDROM"
-
-struct iso_primary_descriptor {
- char type [ISODCL ( 1, 1)]; /* 711 */
- char id [ISODCL ( 2, 6)];
- char version [ISODCL ( 7, 7)]; /* 711 */
- char unused1 [ISODCL ( 8, 8)];
- char system_id [ISODCL ( 9, 40)]; /* achars */
- char volume_id [ISODCL ( 41, 72)]; /* dchars */
- char unused2 [ISODCL ( 73, 80)];
- char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
- char unused3 [ISODCL ( 89, 120)];
- char volume_set_size [ISODCL (121, 124)]; /* 723 */
- char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
- char logical_block_size [ISODCL (129, 132)]; /* 723 */
- char path_table_size [ISODCL (133, 140)]; /* 733 */
- char type_l_path_table [ISODCL (141, 144)]; /* 731 */
- char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
- char type_m_path_table [ISODCL (149, 152)]; /* 732 */
- char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
- char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
- char volume_set_id [ISODCL (191, 318)]; /* dchars */
- char publisher_id [ISODCL (319, 446)]; /* achars */
- char preparer_id [ISODCL (447, 574)]; /* achars */
- char application_id [ISODCL (575, 702)]; /* achars */
- char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
- char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
- char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
- char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
- char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
- char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
- char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
- char file_structure_version [ISODCL (882, 882)]; /* 711 */
- char unused4 [ISODCL (883, 883)];
- char application_data [ISODCL (884, 1395)];
- char unused5 [ISODCL (1396, 2048)];
-};
-#define ISO_DEFAULT_BLOCK_SIZE 2048
-
-/*
- * Used by Microsoft Joliet extension to ISO9660. Almost the same
- * as PVD, but byte position 8 is a flag, and 89-120 is for escape.
- */
-
-struct iso_supplementary_descriptor {
- char type [ISODCL ( 1, 1)]; /* 711 */
- char id [ISODCL ( 2, 6)];
- char version [ISODCL ( 7, 7)]; /* 711 */
- char flags [ISODCL ( 8, 8)]; /* 711? */
- char system_id [ISODCL ( 9, 40)]; /* achars */
- char volume_id [ISODCL ( 41, 72)]; /* dchars */
- char unused2 [ISODCL ( 73, 80)];
- char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
- char escape [ISODCL ( 89, 120)];
- char volume_set_size [ISODCL (121, 124)]; /* 723 */
- char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
- char logical_block_size [ISODCL (129, 132)]; /* 723 */
- char path_table_size [ISODCL (133, 140)]; /* 733 */
- char type_l_path_table [ISODCL (141, 144)]; /* 731 */
- char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
- char type_m_path_table [ISODCL (149, 152)]; /* 732 */
- char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
- char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
- char volume_set_id [ISODCL (191, 318)]; /* dchars */
- char publisher_id [ISODCL (319, 446)]; /* achars */
- char preparer_id [ISODCL (447, 574)]; /* achars */
- char application_id [ISODCL (575, 702)]; /* achars */
- char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
- char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
- char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
- char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
- char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
- char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
- char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
- char file_structure_version [ISODCL (882, 882)]; /* 711 */
- char unused4 [ISODCL (883, 883)];
- char application_data [ISODCL (884, 1395)];
- char unused5 [ISODCL (1396, 2048)];
-};
-
-struct iso_sierra_primary_descriptor {
- char unknown1 [ISODCL ( 1, 8)]; /* 733 */
- char type [ISODCL ( 9, 9)]; /* 711 */
- char id [ISODCL ( 10, 14)];
- char version [ISODCL ( 15, 15)]; /* 711 */
- char unused1 [ISODCL ( 16, 16)];
- char system_id [ISODCL ( 17, 48)]; /* achars */
- char volume_id [ISODCL ( 49, 80)]; /* dchars */
- char unused2 [ISODCL ( 81, 88)];
- char volume_space_size [ISODCL ( 89, 96)]; /* 733 */
- char unused3 [ISODCL ( 97, 128)];
- char volume_set_size [ISODCL (129, 132)]; /* 723 */
- char volume_sequence_number [ISODCL (133, 136)]; /* 723 */
- char logical_block_size [ISODCL (137, 140)]; /* 723 */
- char path_table_size [ISODCL (141, 148)]; /* 733 */
- char type_l_path_table [ISODCL (149, 152)]; /* 731 */
- char opt_type_l_path_table [ISODCL (153, 156)]; /* 731 */
- char unknown2 [ISODCL (157, 160)]; /* 731 */
- char unknown3 [ISODCL (161, 164)]; /* 731 */
- char type_m_path_table [ISODCL (165, 168)]; /* 732 */
- char opt_type_m_path_table [ISODCL (169, 172)]; /* 732 */
- char unknown4 [ISODCL (173, 176)]; /* 732 */
- char unknown5 [ISODCL (177, 180)]; /* 732 */
- char root_directory_record [ISODCL (181, 214)]; /* 9.1 */
- char volume_set_id [ISODCL (215, 342)]; /* dchars */
- char publisher_id [ISODCL (343, 470)]; /* achars */
- char preparer_id [ISODCL (471, 598)]; /* achars */
- char application_id [ISODCL (599, 726)]; /* achars */
- char copyright_id [ISODCL (727, 790)]; /* achars */
- char creation_date [ISODCL (791, 806)]; /* ? */
- char modification_date [ISODCL (807, 822)]; /* ? */
- char expiration_date [ISODCL (823, 838)]; /* ? */
- char effective_date [ISODCL (839, 854)]; /* ? */
- char file_structure_version [ISODCL (855, 855)]; /* 711 */
- char unused4 [ISODCL (856, 2048)];
-};
-
-struct iso_directory_record {
- char length [ISODCL (1, 1)]; /* 711 */
- char ext_attr_length [ISODCL (2, 2)]; /* 711 */
- u_char extent [ISODCL (3, 10)]; /* 733 */
- u_char size [ISODCL (11, 18)]; /* 733 */
- char date [ISODCL (19, 25)]; /* 7 by 711 */
- char flags [ISODCL (26, 26)];
- char file_unit_size [ISODCL (27, 27)]; /* 711 */
- char interleave [ISODCL (28, 28)]; /* 711 */
- char volume_sequence_number [ISODCL (29, 32)]; /* 723 */
- char name_len [ISODCL (33, 33)]; /* 711 */
- char name [1]; /* XXX */
-};
-/* can't take sizeof(iso_directory_record), because of possible alignment
- of the last entry (34 instead of 33) */
-#define ISO_DIRECTORY_RECORD_SIZE 33
-
-struct iso_extended_attributes {
- u_char owner [ISODCL (1, 4)]; /* 723 */
- u_char group [ISODCL (5, 8)]; /* 723 */
- u_char perm [ISODCL (9, 10)]; /* 9.5.3 */
- char ctime [ISODCL (11, 27)]; /* 8.4.26.1 */
- char mtime [ISODCL (28, 44)]; /* 8.4.26.1 */
- char xtime [ISODCL (45, 61)]; /* 8.4.26.1 */
- char ftime [ISODCL (62, 78)]; /* 8.4.26.1 */
- char recfmt [ISODCL (79, 79)]; /* 711 */
- char recattr [ISODCL (80, 80)]; /* 711 */
- u_char reclen [ISODCL (81, 84)]; /* 723 */
- char system_id [ISODCL (85, 116)]; /* achars */
- char system_use [ISODCL (117, 180)];
- char version [ISODCL (181, 181)]; /* 711 */
- char len_esc [ISODCL (182, 182)]; /* 711 */
- char reserved [ISODCL (183, 246)];
- u_char len_au [ISODCL (247, 250)]; /* 723 */
-};
-
-#ifdef _KERNEL
-
-/* CD-ROM Format type */
-enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP,
- ISO_FTYPE_JOLIET, ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA };
-
-#ifndef ISOFSMNT_ROOT
-#define ISOFSMNT_ROOT 0
-#endif
-
-struct iso_mnt {
- int im_flags;
-
- struct mount *im_mountp;
- struct cdev *im_dev;
- struct vnode *im_devvp;
-
- struct g_consumer *im_cp;
- struct bufobj *im_bo;
-
- int logical_block_size;
- int im_bshift;
- int im_bmask;
-
- int volume_space_size;
-
- char root[ISODCL (157, 190)];
- int root_extent;
- int root_size;
- enum ISO_FTYPE iso_ftype;
-
- int rr_skip;
- int rr_skip0;
-
- int joliet_level;
-
- void *im_d2l;
- void *im_l2d;
-};
-
-#define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data))
-
-#define blkoff(imp, loc) ((loc) & (imp)->im_bmask)
-#define lblktosize(imp, blk) ((blk) << (imp)->im_bshift)
-#define lblkno(imp, loc) ((loc) >> (imp)->im_bshift)
-#define blksize(imp, ip, lbn) ((imp)->logical_block_size)
-
-int cd9660_vget_internal(struct mount *, ino_t, int, struct vnode **, int,
- struct iso_directory_record *);
-#define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \
- size_t, struct proc *))eopnotsupp)
-
-extern struct vop_vector cd9660_vnodeops;
-extern struct vop_vector cd9660_fifoops;
-
-int isochar(u_char *, u_char *, int, u_short *, int *, int, void *);
-int isofncmp(u_char *, int, u_char *, int, int, int, void *, void *);
-void isofntrans(u_char *, int, u_char *, u_short *, int, int, int, int, void *);
-ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
-u_short sgetrune(const char *, size_t, char const **, int, void *);
-
-#endif /* _KERNEL */
-
-/*
- * The isonum_xxx functions are inlined anyway, and could come handy even
- * outside the kernel. Thus we don't hide them here.
- */
-
-static __inline int isonum_711(u_char *);
-static __inline int
-isonum_711(p)
- u_char *p;
-{
- return *p;
-}
-
-static __inline int isonum_712(char *);
-static __inline int
-isonum_712(p)
- char *p;
-{
- return *p;
-}
-
-#ifndef UNALIGNED_ACCESS
-
-static __inline int isonum_723(u_char *);
-static __inline int
-isonum_723(p)
- u_char *p;
-{
- return *p|(p[1] << 8);
-}
-
-static __inline int isonum_733(u_char *);
-static __inline int
-isonum_733(p)
- u_char *p;
-{
- return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24);
-}
-
-#else /* UNALIGNED_ACCESS */
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-
-static __inline int
-isonum_723(p)
- u_char *p
-{
- return *(u_int16t *)p;
-}
-
-static __inline int
-isonum_733(p)
- u_char *p;
-{
- return *(u_int32t *)p;
-}
-
-#endif
-
-#if BYTE_ORDER == BIG_ENDIAN
-
-static __inline int
-isonum_723(p)
- u_char *p
-{
- return *(u_int16t *)(p + 2);
-}
-
-static __inline int
-isonum_733(p)
- u_char *p;
-{
- return *(u_int32t *)(p + 4);
-}
-
-#endif
-
-#endif /* UNALIGNED_ACCESS */
-
-/*
- * Associated files have a leading '='.
- */
-#define ASSOCCHAR '='
diff --git a/sys/fs/cd9660/iso_rrip.h b/sys/fs/cd9660/iso_rrip.h
deleted file mode 100644
index 75c004c..0000000
--- a/sys/fs/cd9660/iso_rrip.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * Copyright (c) 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
- * Support code is derived from software contributed to Berkeley
- * by Atsushi Murai (amurai@spec.co.jp).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)iso_rrip.h 8.2 (Berkeley) 1/23/94
- * $FreeBSD$
- */
-
-
-/*
- * Analyze function flag (similar to RR field bits)
- */
-#define ISO_SUSP_ATTR 0x0001
-#define ISO_SUSP_DEVICE 0x0002
-#define ISO_SUSP_SLINK 0x0004
-#define ISO_SUSP_ALTNAME 0x0008
-#define ISO_SUSP_CLINK 0x0010
-#define ISO_SUSP_PLINK 0x0020
-#define ISO_SUSP_RELDIR 0x0040
-#define ISO_SUSP_TSTAMP 0x0080
-#define ISO_SUSP_IDFLAG 0x0100
-#define ISO_SUSP_EXTREF 0x0200
-#define ISO_SUSP_CONT 0x0400
-#define ISO_SUSP_OFFSET 0x0800
-#define ISO_SUSP_STOP 0x1000
-#define ISO_SUSP_UNKNOWN 0x8000
-
-typedef struct {
- struct iso_node *inop;
- int fields; /* interesting fields in this analysis */
- daddr_t iso_ce_blk; /* block of continuation area */
- off_t iso_ce_off; /* offset of continuation area */
- int iso_ce_len; /* length of continuation area */
- struct iso_mnt *imp; /* mount structure */
- ino_t *inump; /* inode number pointer */
- char *outbuf; /* name/symbolic link output area */
- u_short *outlen; /* length of above */
- u_short maxlen; /* maximum length of above */
- int cont; /* continuation of above */
-} ISO_RRIP_ANALYZE;
-
-struct iso_directory_record;
-
-int cd9660_rrip_analyze(struct iso_directory_record *isodir,
- struct iso_node *inop, struct iso_mnt *imp);
-int cd9660_rrip_getname(struct iso_directory_record *isodir,
- char *outbuf, u_short *outlen,
- ino_t *inump, struct iso_mnt *imp);
-int cd9660_rrip_getsymname(struct iso_directory_record *isodir,
- char *outbuf, u_short *outlen,
- struct iso_mnt *imp);
-int cd9660_rrip_offset(struct iso_directory_record *isodir,
- struct iso_mnt *imp);
diff --git a/sys/fs/coda/README b/sys/fs/coda/README
deleted file mode 100644
index 19de799..0000000
--- a/sys/fs/coda/README
+++ /dev/null
@@ -1,62 +0,0 @@
-$FreeBSD$
-
- Announcing the Availability of the
- Coda Distributed
- Filesystem
- for
- BSD Unix Systems
-
- Coda is a distributed filesystem like NFS and AFS. It is
-freely available, like NFS. But it functions much like AFS in being a
-"stateful" filesystem. Coda and AFS cache files on your local
-machine to improve performance. But Coda goes a step further than AFS
-by letting you access the cached files when there is no available
-network, viz. disconnected laptops and network outages. In Coda, both
-the client and server are outside the kernel which makes them easier
-to experiment with.
-
-To get more information on Coda, I would like to refer people to
- http://www.coda.cs.cmu.edu
-There is a wealth of documents, papers, and theses there. There is
-also a good introduction to the Coda File System in
- http://www.coda.cs.cmu.edu/ljpaper/lj.html
-
-Coda was originally developed as an academic prototype/testbed. It is
-being polished and rewritten where necessary. Coda is a work in
-progress and does have bugs. It is, though, very usable. Our
-interest is in making Coda available to as many people as possible and
-to have Coda evolve and flourish.
-
-The bulk of the Coda filesystem code supports the Coda client
-program, the Coda server program and the utilities needed by both.
-All these programs are unix programs and can run equally well on any
-Unix platform. Our main development thrust is improving these
-programs. There is a small part of Coda that deals with the kernel to
-filesystem interface. This code is OS specific (but should not be
-platform specific).
-
-Coda is currently available for several OS's and platforms:
- Freebsd-2.2.5: i386
- Freebsd-2.2.6: i386
- Freebsd -current: i386
- linux 2.0: i386 & sparc
- linux 2.1: i386 & sparc
- NetBSD 1.3: i386
- NetBSD -current: i386
-The relevant sources, binaries, and docs can be found in
- ftp://ftp.coda.cs.cmu.edu/pub/coda/
-
-We intend to come out with new Coda releases often, not daily. We
-don't want to slight any OS/platform not mentioned above. We are just
-limited in our resources as to what we can support internally. We
-will be happy to integrate OpenBSD support as well as other OS
-support. Also, adding platform support should be relatively easy and
-we can discuss this. The only difficulty is that Coda has a light weight
-process package. It does some manipulations in assembler which would
-have to be redone for a different platform.
-
-There are several mailing lists @coda.cs.cmu.edu that discuss coda:
-coda-announce and linux-coda. We are going to revise linux-coda to be
-OS neutral, since it is mainly Coda we want to discuss. We appreciate
-comments, feedback, bug reports, bug fixes, enhancements, etc.
-
diff --git a/sys/fs/coda/TODO b/sys/fs/coda/TODO
deleted file mode 100644
index eac5143..0000000
--- a/sys/fs/coda/TODO
+++ /dev/null
@@ -1,17 +0,0 @@
-OOPS:
- FreeBSD does not fsync!!!
-
-Near term:
- Fix bug in executing/mapping new files.
- cfs_mount bug: interaction with cfs_inactive no cfs_unsave.
- vref/vn_lock == vget except no VXWANT which may be on.
- Review locks: vn_lock/VOP_UNLOCK/lockmgr ...
-
-Medium term:
- Add missing VFS methods.
- Do performance profile.
- Tune hash algorithm used in cfs_namecache.
- Tune hash algorithm used in cfs_subr.
-
-Eventually:
- Use standard queue macros.
diff --git a/sys/fs/coda/cnode.h b/sys/fs/coda/cnode.h
deleted file mode 100644
index 8bbdeb5..0000000
--- a/sys/fs/coda/cnode.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/cnode.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-/*-
- * Mach Operating System
- * Copyright (c) 1990 Carnegie-Mellon University
- * Copyright (c) 1989 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * This code was written for the Coda filesystem at Carnegie Mellon University.
- * Contributers include David Steere, James Kistler, and M. Satyanarayanan.
- */
-
-#ifndef _CNODE_H_
-#define _CNODE_H_
-
-#include <sys/vnode.h>
-#include <sys/lock.h>
-#include <machine/clock.h>
-
-MALLOC_DECLARE(M_CODA);
-
-/*
- * tmp below since we need struct queue
- */
-#include <coda/coda_kernel.h>
-
-/*
- * Cnode lookup stuff.
- * NOTE: CODA_CACHESIZE must be a power of 2 for cfshash to work!
- */
-#define CODA_CACHESIZE 512
-
-#define CODA_ALLOC(ptr, cast, size) \
-do { \
- ptr = (cast)malloc((unsigned long) size, M_CODA, M_WAITOK); \
- if (ptr == 0) { \
- panic("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
- } \
-} while (0)
-
-#define CODA_FREE(ptr, size) free((ptr), M_CODA)
-
-/*
- * global cache state control
- */
-extern int coda_nc_use;
-
-/*
- * Used to select debugging statements throughout the cfs code.
- */
-extern int codadebug;
-extern int coda_nc_debug;
-extern int coda_printf_delay;
-extern int coda_vnop_print_entry;
-extern int coda_psdev_print_entry;
-extern int coda_vfsop_print_entry;
-
-#define CODADBGMSK(N) (1 << N)
-#define CODADEBUG(N, STMT) { if (codadebug & CODADBGMSK(N)) { STMT } }
-#define myprintf(args) \
-do { \
- if (coda_printf_delay) \
- DELAY(coda_printf_delay);\
- printf args ; \
-} while (0)
-
-struct cnode {
- struct vnode *c_vnode;
- u_short c_flags; /* flags (see below) */
- CodaFid c_fid; /* file handle */
- struct vnode *c_ovp; /* open vnode pointer */
- u_short c_ocount; /* count of openers */
- u_short c_owrite; /* count of open for write */
- struct vattr c_vattr; /* attributes */
- char *c_symlink; /* pointer to symbolic link */
- u_short c_symlen; /* length of symbolic link */
- struct cdev *c_device; /* associated vnode device */
- ino_t c_inode; /* associated vnode inode */
- struct cnode *c_next; /* links if on NetBSD machine */
-};
-#define VTOC(vp) ((struct cnode *)(vp)->v_data)
-#define CTOV(cp) ((struct vnode *)((cp)->c_vnode))
-
-/* flags */
-#define C_VATTR 0x01 /* Validity of vattr in the cnode */
-#define C_SYMLINK 0x02 /* Validity of symlink pointer in the Code */
-#define C_WANTED 0x08 /* Set if lock wanted */
-#define C_LOCKED 0x10 /* Set if lock held */
-#define C_UNMOUNTING 0X20 /* Set if unmounting */
-#define C_PURGING 0x40 /* Set if purging a fid */
-
-#define VALID_VATTR(cp) ((cp->c_flags) & C_VATTR)
-#define VALID_SYMLINK(cp) ((cp->c_flags) & C_SYMLINK)
-#define IS_UNMOUNTING(cp) ((cp)->c_flags & C_UNMOUNTING)
-
-struct vcomm {
- u_long vc_seq;
- struct selinfo vc_selproc;
- struct queue vc_requests;
- struct queue vc_replys;
-};
-
-#define VC_OPEN(vcp) ((vcp)->vc_requests.forw != NULL)
-#define MARK_VC_CLOSED(vcp) (vcp)->vc_requests.forw = NULL;
-#define MARK_VC_OPEN(vcp) /* MT */
-
-struct coda_clstat {
- int ncalls; /* client requests */
- int nbadcalls; /* upcall failures */
- int reqs[CODA_NCALLS]; /* count of each request */
-};
-extern struct coda_clstat coda_clstat;
-
-/*
- * CODA structure to hold mount/filesystem information
- */
-struct coda_mntinfo {
- struct vnode *mi_rootvp;
- struct mount *mi_vfsp;
- struct vcomm mi_vcomm;
- struct cdev *dev;
- int mi_started;
- LIST_ENTRY(coda_mntinfo) mi_list;
-};
-struct coda_mntinfo *dev2coda_mntinfo(struct cdev *dev);
-
-/*
- * vfs pointer to mount info
- */
-#define vftomi(vfsp) ((struct coda_mntinfo *)(vfsp->mnt_data))
-#define CODA_MOUNTED(vfsp) (vftomi((vfsp)) != (struct coda_mntinfo *)0)
-
-/*
- * vnode pointer to mount info
- */
-#define vtomi(vp) ((struct coda_mntinfo *)(vp->v_mount->mnt_data))
-
-/*
- * Used for identifying usage of "Control" object
- */
-extern struct vnode *coda_ctlvp;
-#define IS_CTL_VP(vp) ((vp) == coda_ctlvp)
-#define IS_CTL_NAME(vp, name, l)((l == CODA_CONTROLLEN) \
- && ((vp) == vtomi((vp))->mi_rootvp) \
- && strncmp(name, CODA_CONTROL, l) == 0)
-
-/*
- * An enum to tell us whether something that will remove a reference
- * to a cnode was a downcall or not
- */
-enum dc_status {
- IS_DOWNCALL = 6,
- NOT_DOWNCALL = 7
-};
-
-/* cfs_psdev.h */
-int coda_call(struct coda_mntinfo *mntinfo, int inSize, int *outSize, caddr_t buffer);
-extern int coda_kernel_version;
-
-/* cfs_subr.h */
-int handleDownCall(int opcode, union outputArgs *out);
-void coda_unmounting(struct mount *whoIam);
-int coda_vmflush(struct cnode *cp);
-
-/* cfs_vnodeops.h */
-struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type);
-int coda_vnodeopstats_init(void);
-
-/* coda_vfsops.h */
-struct mount *devtomp(struct cdev *dev);
-
-/* sigh */
-#define CODA_RDWR ((u_long) 31)
-
-#endif /* _CNODE_H_ */
-
diff --git a/sys/fs/coda/coda.h b/sys/fs/coda/coda.h
deleted file mode 100644
index bd87a9e..0000000
--- a/sys/fs/coda/coda.h
+++ /dev/null
@@ -1,825 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-
-/*
- *
- * Based on cfs.h from Mach, but revamped for increased simplicity.
- * Linux modifications by Peter Braam, Aug 1996
- */
-
-#ifndef _CODA_HEADER_
-#define _CODA_HEADER_
-
-#include "opt_coda.h" /* for COMPAT_CODA_5 option */
-
-/* Catch new _KERNEL defn for NetBSD */
-#ifdef __NetBSD__
-#include <sys/types.h>
-#endif
-
-#ifndef CODA_MAXSYMLINKS
-#define CODA_MAXSYMLINKS 10
-#endif
-
-#if defined(DJGPP) || defined(__CYGWIN32__)
-#ifdef _KERNEL
-typedef unsigned long u_long;
-typedef unsigned int u_int;
-typedef unsigned short u_short;
-typedef u_long ino_t;
-typedef u_long struct cdev *;
-typedef void * caddr_t;
-#ifdef DOS
-typedef unsigned __int64 u_quad_t;
-#else
-typedef unsigned long long u_quad_t;
-#endif
-
-#define inline
-
-struct timespec {
- long ts_sec;
- long ts_nsec;
-};
-#else /* DJGPP but not _KERNEL */
-#include <sys/types.h>
-#include <sys/time.h>
-typedef unsigned long long u_quad_t;
-#endif /* !_KERNEL */
-#endif /* !DJGPP */
-
-
-#if defined(__linux__)
-#define cdev_t u_quad_t
-#if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
-#define _UQUAD_T_ 1
-typedef unsigned long long u_quad_t;
-#endif
-#else
-#define cdev_t dev_t
-#endif
-
-#ifdef __CYGWIN32__
-typedef unsigned char u_int8_t;
-struct timespec {
- time_t tv_sec; /* seconds */
- long tv_nsec; /* nanoseconds */
-};
-#endif
-
-
-/*
- * Cfs constants
- */
-#define CODA_MAXNAMLEN 255
-#define CODA_MAXPATHLEN 1024
-#define CODA_MAXSYMLINK 10
-
-/* these are Coda's version of O_RDONLY etc combinations
- * to deal with VFS open modes
- */
-#define C_O_READ 0x001
-#define C_O_WRITE 0x002
-#define C_O_TRUNC 0x010
-#define C_O_EXCL 0x100
-#define C_O_CREAT 0x200
-
-/* these are to find mode bits in Venus */
-#define C_M_READ 00400
-#define C_M_WRITE 00200
-
-/* for access Venus will use */
-#define C_A_C_OK 8 /* Test for writing upon create. */
-#define C_A_R_OK 4 /* Test for read permission. */
-#define C_A_W_OK 2 /* Test for write permission. */
-#define C_A_X_OK 1 /* Test for execute permission. */
-#define C_A_F_OK 0 /* Test for existence. */
-
-
-
-#ifndef _VENUS_DIRENT_T_
-#define _VENUS_DIRENT_T_ 1
-struct venus_dirent {
- unsigned long d_fileno; /* file number of entry */
- unsigned short d_reclen; /* length of this record */
- char d_type; /* file type, see below */
- char d_namlen; /* length of string in d_name */
- char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
-};
-#undef DIRSIZ
-#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
- (((dp)->d_namlen+1 + 3) &~ 3))
-
-/*
- * File types
- */
-#define CDT_UNKNOWN 0
-#define CDT_FIFO 1
-#define CDT_CHR 2
-#define CDT_DIR 4
-#define CDT_BLK 6
-#define CDT_REG 8
-#define CDT_LNK 10
-#define CDT_SOCK 12
-#define CDT_WHT 14
-
-/*
- * Convert between stat structure types and directory types.
- */
-#define IFTOCDT(mode) (((mode) & 0170000) >> 12)
-#define CDTTOIF(dirtype) ((dirtype) << 12)
-
-#endif
-
-#ifdef CODA_COMPAT_5
-
-typedef struct {
- u_long Volume;
- u_long Vnode;
- u_long Unique;
-} CodaFid;
-
-static __inline__ ino_t coda_f2i(CodaFid *fid)
-{
- if (!fid) return 0;
- return (fid->Unique + (fid->Vnode<<10) + (fid->Volume<<20));
-}
-
-static __inline__ char * coda_f2s(CodaFid *fid)
-{
- static char fid_str [35];
- snprintf (fid_str, 35, "[%lx.%lx.%lx]", fid->Volume,
- fid->Vnode, fid->Unique);
- return fid_str;
-}
-
-static __inline__ int coda_fid_eq (CodaFid *fid1, CodaFid *fid2)
-{
- return (fid1->Volume == fid2->Volume &&
- fid1->Vnode == fid2->Vnode &&
- fid1->Unique == fid2->Unique);
-}
-
-struct coda_cred {
- u_int32_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
- u_int32_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
-};
-
-#else /* CODA_COMPAT_5 */
-
-typedef struct {
- u_int32_t opaque[4];
-} CodaFid;
-
-static __inline__ ino_t coda_f2i(CodaFid *fid)
-{
- if ( ! fid )
- return 0;
- return (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]);
-}
-
-static __inline__ char * coda_f2s(CodaFid *fid)
- {
- static char fid_str [35];
- snprintf (fid_str, 35, "[%x.%x.%x.%x]", fid->opaque[0],
- fid->opaque[1], fid->opaque[2], fid->opaque[3]);
- return fid_str;
- }
-
-static __inline__ int coda_fid_eq (CodaFid *fid1, CodaFid *fid2)
-{
- return (fid1->opaque[0] == fid2->opaque[0] &&
- fid1->opaque[1] == fid2->opaque[1] &&
- fid1->opaque[2] == fid2->opaque[2] &&
- fid1->opaque[3] == fid2->opaque[3]);
-}
-
-#endif /* CODA_COMPAT_5 */
-
-#ifndef _VENUS_VATTR_T_
-#define _VENUS_VATTR_T_
-/*
- * Vnode types. VNON means no type.
- */
-enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
-
-struct coda_vattr {
- int va_type; /* vnode type (for create) */
- u_short va_mode; /* files access mode and type */
- short va_nlink; /* number of references to file */
- uid_t va_uid; /* owner user id */
- gid_t va_gid; /* owner group id */
- long va_fileid; /* file id */
- u_quad_t va_size; /* file size in bytes */
- long va_blocksize; /* blocksize preferred for i/o */
- struct timespec va_atime; /* time of last access */
- struct timespec va_mtime; /* time of last modification */
- struct timespec va_ctime; /* time file changed */
- u_long va_gen; /* generation number of file */
- u_long va_flags; /* flags defined for file */
- cdev_t va_rdev; /* device special file represents */
- u_quad_t va_bytes; /* bytes of disk space held by file */
- u_quad_t va_filerev; /* file modification number */
-};
-
-#endif
-
-/* structure used by CODA_STATFS for getting cache information from venus */
-struct coda_statfs {
- int32_t f_blocks;
- int32_t f_bfree;
- int32_t f_bavail;
- int32_t f_files;
- int32_t f_ffree;
-};
-
-/*
- * Kernel <--> Venus communications.
- */
-
-#define CODA_ROOT 2
-#define CODA_OPEN_BY_FD 3
-#define CODA_OPEN 4
-#define CODA_CLOSE 5
-#define CODA_IOCTL 6
-#define CODA_GETATTR 7
-#define CODA_SETATTR 8
-#define CODA_ACCESS 9
-#define CODA_LOOKUP 10
-#define CODA_CREATE 11
-#define CODA_REMOVE 12
-#define CODA_LINK 13
-#define CODA_RENAME 14
-#define CODA_MKDIR 15
-#define CODA_RMDIR 16
-#define CODA_READDIR 17
-#define CODA_SYMLINK 18
-#define CODA_READLINK 19
-#define CODA_FSYNC 20
-#define CODA_INACTIVE 21
-#define CODA_VGET 22
-#define CODA_SIGNAL 23
-#define CODA_REPLACE 24
-#define CODA_FLUSH 25
-#define CODA_PURGEUSER 26
-#define CODA_ZAPFILE 27
-#define CODA_ZAPDIR 28
-#define CODA_PURGEFID 30
-#define CODA_OPEN_BY_PATH 31
-#define CODA_RESOLVE 32
-#define CODA_REINTEGRATE 33
-#define CODA_STATFS 34
-#define CODA_NCALLS 35
-
-#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
-
-#define VC_MAXDATASIZE 8192
-#define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
- VC_MAXDATASIZE
-
-#define CIOC_KERNEL_VERSION _IOWR('c', 10, sizeof (int))
-#if 0
- /* don't care about kernel version number */
-#define CODA_KERNEL_VERSION 0
- /* The old venus 4.6 compatible interface */
-#define CODA_KERNEL_VERSION 1
-#endif /* realms/cells */
-#ifdef CODA_COMPAT_5
- /* venus_lookup gets an extra parameter to aid windows.*/
-#define CODA_KERNEL_VERSION 2
-#else
- /* 128-bit fids for realms */
-#define CODA_KERNEL_VERSION 3
-#endif
-
-/*
- * Venus <-> Coda RPC arguments
- */
-#ifdef CODA_COMPAT_5
-struct coda_in_hdr {
- unsigned long opcode;
- unsigned long unique; /* Keep multiple outstanding msgs distinct */
- u_short pid; /* Common to all */
- u_short pgid; /* Common to all */
- u_short sid; /* Common to all */
- struct coda_cred cred; /* Common to all */
-};
-#else
-struct coda_in_hdr {
- u_int32_t opcode;
- u_int32_t unique; /* Keep multiple outstanding msgs distinct */
- pid_t pid; /* Common to all */
- pid_t pgid; /* Common to all */
- uid_t uid; /* Common to all */
-};
-#endif
-
-/* Really important that opcode and unique are 1st two fields! */
-struct coda_out_hdr {
- unsigned long opcode;
- unsigned long unique;
- unsigned long result;
-};
-
-/* coda_root: NO_IN */
-struct coda_root_out {
- struct coda_out_hdr oh;
- CodaFid Fid;
-};
-
-struct coda_root_in {
- struct coda_in_hdr in;
-};
-
-/* coda_sync: */
-/* Nothing needed for coda_sync */
-
-/* coda_open: */
-struct coda_open_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int flags;
-};
-
-struct coda_open_out {
- struct coda_out_hdr oh;
- cdev_t dev;
- ino_t inode;
-};
-
-
-/* coda_close: */
-struct coda_close_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int flags;
-};
-
-struct coda_close_out {
- struct coda_out_hdr out;
-};
-
-/* coda_ioctl: */
-struct coda_ioctl_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int cmd;
- int len;
- int rwflag;
- char *data; /* Place holder for data. */
-};
-
-struct coda_ioctl_out {
- struct coda_out_hdr oh;
- int len;
- caddr_t data; /* Place holder for data. */
-};
-
-
-/* coda_getattr: */
-struct coda_getattr_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
-};
-
-struct coda_getattr_out {
- struct coda_out_hdr oh;
- struct coda_vattr attr;
-};
-
-
-/* coda_setattr: NO_OUT */
-struct coda_setattr_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- struct coda_vattr attr;
-};
-
-struct coda_setattr_out {
- struct coda_out_hdr out;
-};
-
-/* coda_access: NO_OUT */
-struct coda_access_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int flags;
-};
-
-struct coda_access_out {
- struct coda_out_hdr out;
-};
-
-
-/* lookup flags */
-#define CLU_CASE_SENSITIVE 0x01
-#define CLU_CASE_INSENSITIVE 0x02
-
-/* coda_lookup: */
-struct coda_lookup_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int name; /* Place holder for data. */
- int flags;
-};
-
-struct coda_lookup_out {
- struct coda_out_hdr oh;
- CodaFid Fid;
- int vtype;
-};
-
-
-/* coda_create: */
-struct coda_create_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- struct coda_vattr attr;
- int excl;
- int mode;
- int name; /* Place holder for data. */
-};
-
-struct coda_create_out {
- struct coda_out_hdr oh;
- CodaFid Fid;
- struct coda_vattr attr;
-};
-
-
-/* coda_remove: NO_OUT */
-struct coda_remove_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int name; /* Place holder for data. */
-};
-
-struct coda_remove_out {
- struct coda_out_hdr out;
-};
-
-/* coda_link: NO_OUT */
-struct coda_link_in {
- struct coda_in_hdr ih;
- CodaFid sourceFid; /* cnode to link *to* */
- CodaFid destFid; /* Directory in which to place link */
- int tname; /* Place holder for data. */
-};
-
-struct coda_link_out {
- struct coda_out_hdr out;
-};
-
-
-/* coda_rename: NO_OUT */
-struct coda_rename_in {
- struct coda_in_hdr ih;
- CodaFid sourceFid;
- int srcname;
- CodaFid destFid;
- int destname;
-};
-
-struct coda_rename_out {
- struct coda_out_hdr out;
-};
-
-/* coda_mkdir: */
-struct coda_mkdir_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- struct coda_vattr attr;
- int name; /* Place holder for data. */
-};
-
-struct coda_mkdir_out {
- struct coda_out_hdr oh;
- CodaFid Fid;
- struct coda_vattr attr;
-};
-
-
-/* coda_rmdir: NO_OUT */
-struct coda_rmdir_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int name; /* Place holder for data. */
-};
-
-struct coda_rmdir_out {
- struct coda_out_hdr out;
-};
-
-/* coda_readdir: */
-struct coda_readdir_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int count;
- int offset;
-};
-
-struct coda_readdir_out {
- struct coda_out_hdr oh;
- int size;
- caddr_t data; /* Place holder for data. */
-};
-
-/* coda_symlink: NO_OUT */
-struct coda_symlink_in {
- struct coda_in_hdr ih;
- CodaFid Fid; /* Directory to put symlink in */
- int srcname;
- struct coda_vattr attr;
- int tname;
-};
-
-struct coda_symlink_out {
- struct coda_out_hdr out;
-};
-
-/* coda_readlink: */
-struct coda_readlink_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
-};
-
-struct coda_readlink_out {
- struct coda_out_hdr oh;
- int count;
- caddr_t data; /* Place holder for data. */
-};
-
-
-/* coda_fsync: NO_OUT */
-struct coda_fsync_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
-};
-
-struct coda_fsync_out {
- struct coda_out_hdr out;
-};
-
-/* coda_inactive: NO_OUT */
-struct coda_inactive_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
-};
-
-/* coda_vget: */
-struct coda_vget_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
-};
-
-struct coda_vget_out {
- struct coda_out_hdr oh;
- CodaFid Fid;
- int vtype;
-};
-
-
-/* CODA_SIGNAL is out-of-band, doesn't need data. */
-/* CODA_INVALIDATE is a venus->kernel call */
-/* CODA_FLUSH is a venus->kernel call */
-
-/* coda_purgeuser: */
-/* CODA_PURGEUSER is a venus->kernel call */
-struct coda_purgeuser_out {
- struct coda_out_hdr oh;
-#ifdef CODA_COMPAT_5
- struct coda_cred cred;
-#else
- uid_t uid;
-#endif
-};
-
-/* coda_zapfile: */
-/* CODA_ZAPFILE is a venus->kernel call */
-struct coda_zapfile_out {
- struct coda_out_hdr oh;
- CodaFid Fid;
-};
-
-/* coda_zapdir: */
-/* CODA_ZAPDIR is a venus->kernel call */
-struct coda_zapdir_out {
- struct coda_out_hdr oh;
- CodaFid Fid;
-};
-
-/* coda_zapnode: */
-/* CODA_ZAPVNODE is a venus->kernel call */
-struct coda_zapvnode_out {
- struct coda_out_hdr oh;
-#ifdef CODA_COMPAT_5
- struct coda_cred cred;
-#endif
- CodaFid Fid;
-};
-
-/* coda_purgefid: */
-/* CODA_PURGEFID is a venus->kernel call */
-struct coda_purgefid_out {
- struct coda_out_hdr oh;
- CodaFid Fid;
-};
-
-/* coda_replace: */
-/* CODA_REPLACE is a venus->kernel call */
-struct coda_replace_out { /* coda_replace is a venus->kernel call */
- struct coda_out_hdr oh;
- CodaFid NewFid;
- CodaFid OldFid;
-};
-
-/* coda_open_by_fd: */
-struct coda_open_by_fd_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int flags;
-};
-
-struct coda_open_by_fd_out {
- struct coda_out_hdr oh;
- int fd;
- struct file *fh;
-};
-
-/* coda_open_by_path: */
-struct coda_open_by_path_in {
- struct coda_in_hdr ih;
- CodaFid Fid;
- int flags;
-};
-
-struct coda_open_by_path_out {
- struct coda_out_hdr oh;
- int path;
-};
-
-/* coda_statfs: NO_IN */
-struct coda_statfs_in {
- struct coda_in_hdr ih;
-};
-
-struct coda_statfs_out {
- struct coda_out_hdr oh;
- struct coda_statfs stat;
-};
-
-/*
- * Occasionally, we don't cache the fid returned by CODA_LOOKUP.
- * For instance, if the fid is inconsistent.
- * This case is handled by setting the top bit of the type result parameter.
- */
-#define CODA_NOCACHE 0x80000000
-
-union inputArgs {
- struct coda_in_hdr ih; /* NB: every struct below begins with an ih */
- struct coda_open_in coda_open;
- struct coda_close_in coda_close;
- struct coda_ioctl_in coda_ioctl;
- struct coda_getattr_in coda_getattr;
- struct coda_setattr_in coda_setattr;
- struct coda_access_in coda_access;
- struct coda_lookup_in coda_lookup;
- struct coda_create_in coda_create;
- struct coda_remove_in coda_remove;
- struct coda_link_in coda_link;
- struct coda_rename_in coda_rename;
- struct coda_mkdir_in coda_mkdir;
- struct coda_rmdir_in coda_rmdir;
- struct coda_readdir_in coda_readdir;
- struct coda_symlink_in coda_symlink;
- struct coda_readlink_in coda_readlink;
- struct coda_fsync_in coda_fsync;
- struct coda_vget_in coda_vget;
- struct coda_open_by_fd_in coda_open_by_fd;
- struct coda_open_by_path_in coda_open_by_path;
- struct coda_statfs_in coda_statfs;
-};
-
-union outputArgs {
- struct coda_out_hdr oh; /* NB: every struct below begins with an oh */
- struct coda_root_out coda_root;
- struct coda_open_out coda_open;
- struct coda_ioctl_out coda_ioctl;
- struct coda_getattr_out coda_getattr;
- struct coda_lookup_out coda_lookup;
- struct coda_create_out coda_create;
- struct coda_mkdir_out coda_mkdir;
- struct coda_readdir_out coda_readdir;
- struct coda_readlink_out coda_readlink;
- struct coda_vget_out coda_vget;
- struct coda_purgeuser_out coda_purgeuser;
- struct coda_zapfile_out coda_zapfile;
- struct coda_zapdir_out coda_zapdir;
- struct coda_zapvnode_out coda_zapvnode;
- struct coda_purgefid_out coda_purgefid;
- struct coda_replace_out coda_replace;
- struct coda_open_by_fd_out coda_open_by_fd;
- struct coda_open_by_path_out coda_open_by_path;
- struct coda_statfs_out coda_statfs;
-};
-
-union coda_downcalls {
- /* CODA_INVALIDATE is a venus->kernel call */
- /* CODA_FLUSH is a venus->kernel call */
- struct coda_purgeuser_out purgeuser;
- struct coda_zapfile_out zapfile;
- struct coda_zapdir_out zapdir;
- struct coda_zapvnode_out zapvnode;
- struct coda_purgefid_out purgefid;
- struct coda_replace_out replace;
-};
-
-
-/*
- * Used for identifying usage of "Control" and pioctls
- */
-
-#define PIOCPARM_MASK 0x0000ffff
-struct ViceIoctl {
- caddr_t in, out; /* Data to be transferred in, or out */
- short in_size; /* Size of input buffer <= 2K */
- short out_size; /* Maximum size of output buffer, <= 2K */
-};
-
-#if defined(__CYGWIN32__) || defined(DJGPP)
-struct PioctlData {
- unsigned long cmd;
- const char *path;
- int follow;
- struct ViceIoctl vi;
-};
-#else
-struct PioctlData {
- const char *path;
- int follow;
- struct ViceIoctl vi;
-};
-#endif
-
-#define CODA_CONTROL ".CONTROL"
-#define CODA_CONTROLLEN 8
-#define CTL_INO -1
-#define CTL_FILE "/coda/.CONTROL"
-
-#ifdef CODA_COMPAT_5
-#define CTL_FID { -1, -1, -1 }
-#define IS_CTL_FID(fidp) ((fidp)->Volume == -1 &&\
- (fidp)->Vnode == -1 &&\
- (fidp)->Unique == -1)
-#define INVAL_FID { 0, 0, 0 }
-#else
-#define CTL_FID { { -1, -1, -1, -1 } }
-#define IS_CTL_FID(fidp) ((fidp)->opaque[0] == -1 &&\
- (fidp)->opaque[1] == -1 &&\
- (fidp)->opaque[2] == -1 &&\
- (fidp)->opaque[3] == -1)
-#define INVAL_FID { { 0, 0, 0, 0 } }
-#endif
-
-/* Data passed to mount */
-
-#define CODA_MOUNT_VERSION 1
-
-struct coda_mount_data {
- int version;
- int fd; /* Opened device */
-};
-
-#endif
-
diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c
deleted file mode 100644
index ac6ad48..0000000
--- a/sys/fs/coda/coda_fbsd.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*-
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/fcntl.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-#include <sys/ucred.h>
-#include <sys/vnode.h>
-
-#include <vm/vm.h>
-#include <vm/vnode_pager.h>
-
-#include <coda/coda.h>
-#include <coda/cnode.h>
-#include <coda/coda_vnops.h>
-#include <coda/coda_psdev.h>
-
-static struct cdevsw codadevsw = {
- .d_version = D_VERSION,
- .d_flags = D_NEEDGIANT,
- .d_open = vc_nb_open,
- .d_close = vc_nb_close,
- .d_read = vc_nb_read,
- .d_write = vc_nb_write,
- .d_ioctl = vc_nb_ioctl,
- .d_poll = vc_nb_poll,
- .d_name = "Coda",
-};
-
-static eventhandler_tag clonetag;
-
-static LIST_HEAD(, coda_mntinfo) coda_mnttbl;
-
-int vcdebug = 1;
-#define VCDEBUG if (vcdebug) printf
-
-/* for DEVFS, using bpf & tun drivers as examples*/
-static void coda_fbsd_clone(void *arg, char *name, int namelen,
- struct cdev **dev);
-
-static int
-codadev_modevent(module_t mod, int type, void *data)
-{
- struct coda_mntinfo *mnt;
-
- switch (type) {
- case MOD_LOAD:
- LIST_INIT(&coda_mnttbl);
- clonetag = EVENTHANDLER_REGISTER(dev_clone, coda_fbsd_clone,
- 0, 1000);
- break;
- case MOD_UNLOAD:
- EVENTHANDLER_DEREGISTER(dev_clone, clonetag);
- while ((mnt = LIST_FIRST(&coda_mnttbl)) != NULL) {
- LIST_REMOVE(mnt, mi_list);
- destroy_dev(mnt->dev);
- free(mnt, M_CODA);
- }
- break;
-
- default:
- return (EOPNOTSUPP);
- }
- return 0;
-}
-static moduledata_t codadev_mod = {
- "codadev",
- codadev_modevent,
- NULL
-};
-DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
-
-static void coda_fbsd_clone(arg, name, namelen, dev)
- void *arg;
- char *name;
- int namelen;
- struct cdev **dev;
-{
- int u;
- struct coda_mntinfo *mnt;
-
- if (*dev != NULL)
- return;
- if (dev_stdclone(name,NULL,"cfs",&u) != 1)
- return;
-
- *dev = make_dev(&codadevsw,unit2minor(u),UID_ROOT,GID_WHEEL,0600,"cfs%d",u);
- dev_ref(*dev);
- mnt = malloc(sizeof(struct coda_mntinfo), M_CODA, M_WAITOK|M_ZERO);
- LIST_INSERT_HEAD(&coda_mnttbl, mnt, mi_list);
-}
-
-struct coda_mntinfo *
-dev2coda_mntinfo(struct cdev *dev)
-{
- struct coda_mntinfo *mnt;
-
- LIST_FOREACH(mnt, &coda_mnttbl, mi_list) {
- if (mnt->dev == dev)
- break;
- }
-
- return mnt;
-}
diff --git a/sys/fs/coda/coda_io.h b/sys/fs/coda/coda_io.h
deleted file mode 100644
index 1985b01..0000000
--- a/sys/fs/coda/coda_io.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_io.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-/*-
- * Mach Operating System
- * Copyright (c) 1990 Carnegie-Mellon University
- * Copyright (c) 1989 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * This code was written for the Coda filesystem at Carnegie Mellon University.
- * Contributers include David Steere, James Kistler, and M. Satyanarayanan.
- */
-
-#ifndef _CODAIO_H_
-#define _CODAIO_H_
-
-/* Define ioctl commands for vcioctl, /dev/cfs */
-
-#define CODARESIZE _IOW('c', 1, struct coda_resize ) /* Resize CODA NameCache */
-#define CODASTATS _IO('c', 2) /* Collect stats */
-#define CODAPRINT _IO('c', 3) /* Print Cache */
-#define CODATEST _IO('c', 4) /* Print Cache */
-
-struct coda_resize { int hashsize, heapsize; };
-
-#endif
diff --git a/sys/fs/coda/coda_kernel.h b/sys/fs/coda/coda_kernel.h
deleted file mode 100644
index fd365b8..0000000
--- a/sys/fs/coda/coda_kernel.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_kernel.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-/* Macros to manipulate the queue */
-#ifndef INIT_QUEUE
-struct queue {
- struct queue *forw, *back;
-};
-
-#define INIT_QUEUE(head) \
-do { \
- (head).forw = (struct queue *)&(head); \
- (head).back = (struct queue *)&(head); \
-} while (0)
-
-#define GETNEXT(head) (head).forw
-
-#define EMPTY(head) ((head).forw == &(head))
-
-#define EOQ(el, head) ((struct queue *)(el) == (struct queue *)&(head))
-
-#define INSQUE(el, head) \
-do { \
- (el).forw = ((head).back)->forw; \
- (el).back = (head).back; \
- ((head).back)->forw = (struct queue *)&(el); \
- (head).back = (struct queue *)&(el); \
-} while (0)
-
-#define REMQUE(el) \
-do { \
- ((el).forw)->back = (el).back; \
- (el).back->forw = (el).forw; \
-} while (0)
-
-#endif
diff --git a/sys/fs/coda/coda_namecache.c b/sys/fs/coda/coda_namecache.c
deleted file mode 100644
index f8a79f5..0000000
--- a/sys/fs/coda/coda_namecache.c
+++ /dev/null
@@ -1,758 +0,0 @@
-/*-
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_namecache.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- */
-/*-
- * Mach Operating System
- * Copyright (c) 1990 Carnegie-Mellon University
- * Copyright (c) 1989 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * This code was written for the Coda filesystem at Carnegie Mellon University.
- * Contributers include David Steere, James Kistler, and M. Satyanarayanan.
- */
-
-/*
- * This module contains the routines to implement the CODA name cache. The
- * purpose of this cache is to reduce the cost of translating pathnames
- * into Vice FIDs. Each entry in the cache contains the name of the file,
- * the vnode (FID) of the parent directory, and the cred structure of the
- * user accessing the file.
- *
- * The first time a file is accessed, it is looked up by the local Venus
- * which first insures that the user has access to the file. In addition
- * we are guaranteed that Venus will invalidate any name cache entries in
- * case the user no longer should be able to access the file. For these
- * reasons we do not need to keep access list information as well as a
- * cred structure for each entry.
- *
- * The table can be accessed through the routines cnc_init(), cnc_enter(),
- * cnc_lookup(), cnc_rmfidcred(), cnc_rmfid(), cnc_rmcred(), and cnc_purge().
- * There are several other routines which aid in the implementation of the
- * hash table.
- */
-
-/*
- * NOTES: rvb@cs
- * 1. The name cache holds a reference to every vnode in it. Hence files can not be
- * closed or made inactive until they are released.
- * 2. coda_nc_name(cp) was added to get a name for a cnode pointer for debugging.
- * 3. coda_nc_find() has debug code to detect when entries are stored with different
- * credentials. We don't understand yet, if/how entries are NOT EQ but still
- * EQUAL
- * 4. I wonder if this name cache could be replace by the vnode name cache.
- * The latter has no zapping functions, so probably not.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/ucred.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-
-#include <coda/coda.h>
-#include <coda/cnode.h>
-#include <coda/coda_namecache.h>
-
-#ifdef DEBUG
-#include <coda/coda_vnops.h>
-#endif
-
-/*
- * Declaration of the name cache data structure.
- */
-
-int coda_nc_use = 1; /* Indicate use of CODA Name Cache */
-int coda_nc_size = CODA_NC_CACHESIZE; /* size of the cache */
-int coda_nc_hashsize = CODA_NC_HASHSIZE; /* size of the primary hash */
-
-struct coda_cache *coda_nc_heap; /* pointer to the cache entries */
-struct coda_hash *coda_nc_hash; /* hash table of coda_cache pointers */
-struct coda_lru coda_nc_lru; /* head of lru chain */
-
-struct coda_nc_statistics coda_nc_stat; /* Keep various stats */
-
-/*
- * for testing purposes
- */
-int coda_nc_debug = 0;
-
-/*
- * Entry points for the CODA Name Cache
- */
-static struct coda_cache *coda_nc_find(struct cnode *dcp, const char *name, int namelen,
- struct ucred *cred, int hash);
-static void coda_nc_remove(struct coda_cache *cncp, enum dc_status dcstat);
-
-/*
- * Initialize the cache, the LRU structure and the Hash structure(s)
- */
-
-#define TOTAL_CACHE_SIZE (sizeof(struct coda_cache) * coda_nc_size)
-#define TOTAL_HASH_SIZE (sizeof(struct coda_hash) * coda_nc_hashsize)
-
-int coda_nc_initialized = 0; /* Initially the cache has not been initialized */
-
-void
-coda_nc_init(void)
-{
- int i;
-
- /* zero the statistics structure */
-
- bzero(&coda_nc_stat, (sizeof(struct coda_nc_statistics)));
-
-#ifdef CODA_VERBOSE
- printf("CODA NAME CACHE: CACHE %d, HASH TBL %d\n", CODA_NC_CACHESIZE, CODA_NC_HASHSIZE);
-#endif
- CODA_ALLOC(coda_nc_heap, struct coda_cache *, TOTAL_CACHE_SIZE);
- CODA_ALLOC(coda_nc_hash, struct coda_hash *, TOTAL_HASH_SIZE);
-
- coda_nc_lru.lru_next =
- coda_nc_lru.lru_prev = (struct coda_cache *)LRU_PART(&coda_nc_lru);
-
-
- for (i=0; i < coda_nc_size; i++) { /* initialize the heap */
- CODA_NC_LRUINS(&coda_nc_heap[i], &coda_nc_lru);
- CODA_NC_HSHNUL(&coda_nc_heap[i]);
- coda_nc_heap[i].cp = coda_nc_heap[i].dcp = (struct cnode *)0;
- }
-
- for (i=0; i < coda_nc_hashsize; i++) { /* initialize the hashtable */
- CODA_NC_HSHNUL((struct coda_cache *)&coda_nc_hash[i]);
- }
-
- coda_nc_initialized++;
-}
-
-/*
- * Auxillary routines -- shouldn't be entry points
- */
-
-static struct coda_cache *
-coda_nc_find(dcp, name, namelen, cred, hash)
- struct cnode *dcp;
- const char *name;
- int namelen;
- struct ucred *cred;
- int hash;
-{
- /*
- * hash to find the appropriate bucket, look through the chain
- * for the right entry (especially right cred, unless cred == 0)
- */
- struct coda_cache *cncp;
- int count = 1;
-
- CODA_NC_DEBUG(CODA_NC_FIND,
- myprintf(("coda_nc_find(dcp %p, name %s, len %d, cred %p, hash %d\n",
- dcp, name, namelen, cred, hash));)
-
- for (cncp = coda_nc_hash[hash].hash_next;
- cncp != (struct coda_cache *)&coda_nc_hash[hash];
- cncp = cncp->hash_next, count++)
- {
-
- if ((CODA_NAMEMATCH(cncp, name, namelen, dcp)) &&
- ((cred == 0) || (cncp->cred == cred)))
- {
- /* compare cr_uid instead */
- coda_nc_stat.Search_len += count;
- return(cncp);
- }
-#ifdef DEBUG
- else if (CODA_NAMEMATCH(cncp, name, namelen, dcp)) {
- printf("coda_nc_find: name %s, new cred = %p, cred = %p\n",
- name, cred, cncp->cred);
- printf("nref %d, nuid %d, ngid %d // oref %d, ocred %d, ogid %d\n",
- cred->cr_ref, cred->cr_uid, cred->cr_gid,
- cncp->cred->cr_ref, cncp->cred->cr_uid, cncp->cred->cr_gid);
- print_cred(cred);
- print_cred(cncp->cred);
- }
-#endif
- }
-
- return((struct coda_cache *)0);
-}
-
-/*
- * Enter a new (dir cnode, name) pair into the cache, updating the
- * LRU and Hash as needed.
- */
-void
-coda_nc_enter(dcp, name, namelen, cred, cp)
- struct cnode *dcp;
- const char *name;
- int namelen;
- struct ucred *cred;
- struct cnode *cp;
-{
- struct coda_cache *cncp;
- int hash;
-
- if (coda_nc_use == 0) /* Cache is off */
- return;
-
- CODA_NC_DEBUG(CODA_NC_ENTER,
- myprintf(("Enter: dcp %p cp %p name %s cred %p \n",
- dcp, cp, name, cred)); )
-
- if (namelen > CODA_NC_NAMELEN) {
- CODA_NC_DEBUG(CODA_NC_ENTER,
- myprintf(("long name enter %s\n",name));)
- coda_nc_stat.long_name_enters++; /* record stats */
- return;
- }
-
- hash = CODA_NC_HASH(name, namelen, dcp);
- cncp = coda_nc_find(dcp, name, namelen, cred, hash);
- if (cncp != (struct coda_cache *) 0) {
- coda_nc_stat.dbl_enters++; /* duplicate entry */
- return;
- }
-
- coda_nc_stat.enters++; /* record the enters statistic */
-
- /* Grab the next element in the lru chain */
- cncp = CODA_NC_LRUGET(coda_nc_lru);
-
- CODA_NC_LRUREM(cncp); /* remove it from the lists */
-
- if (CODA_NC_VALID(cncp)) {
- /* Seems really ugly, but we have to decrement the appropriate
- hash bucket length here, so we have to find the hash bucket
- */
- coda_nc_hash[CODA_NC_HASH(cncp->name, cncp->namelen, cncp->dcp)].length--;
-
- coda_nc_stat.lru_rm++; /* zapped a valid entry */
- CODA_NC_HSHREM(cncp);
- vrele(CTOV(cncp->dcp));
- vrele(CTOV(cncp->cp));
- crfree(cncp->cred);
- }
-
- /*
- * Put a hold on the current vnodes and fill in the cache entry.
- */
- vref(CTOV(cp));
- vref(CTOV(dcp));
- cncp->dcp = dcp;
- cncp->cp = cp;
- cncp->namelen = namelen;
- cncp->cred = crhold(cred);
-
- bcopy(name, cncp->name, (unsigned)namelen);
-
- /* Insert into the lru and hash chains. */
-
- CODA_NC_LRUINS(cncp, &coda_nc_lru);
- CODA_NC_HSHINS(cncp, &coda_nc_hash[hash]);
- coda_nc_hash[hash].length++; /* Used for tuning */
-
- CODA_NC_DEBUG(CODA_NC_PRINTCODA_NC, print_coda_nc(); )
-}
-
-/*
- * Find the (dir cnode, name) pair in the cache, if it's cred
- * matches the input, return it, otherwise return 0
- */
-struct cnode *
-coda_nc_lookup(dcp, name, namelen, cred)
- struct cnode *dcp;
- const char *name;
- int namelen;
- struct ucred *cred;
-{
- int hash;
- struct coda_cache *cncp;
-
- if (coda_nc_use == 0) /* Cache is off */
- return((struct cnode *) 0);
-
- if (namelen > CODA_NC_NAMELEN) {
- CODA_NC_DEBUG(CODA_NC_LOOKUP,
- myprintf(("long name lookup %s\n",name));)
- coda_nc_stat.long_name_lookups++; /* record stats */
- return((struct cnode *) 0);
- }
-
- /* Use the hash function to locate the starting point,
- then the search routine to go down the list looking for
- the correct cred.
- */
-
- hash = CODA_NC_HASH(name, namelen, dcp);
- cncp = coda_nc_find(dcp, name, namelen, cred, hash);
- if (cncp == (struct coda_cache *) 0) {
- coda_nc_stat.misses++; /* record miss */
- return((struct cnode *) 0);
- }
-
- coda_nc_stat.hits++;
-
- /* put this entry at the end of the LRU */
- CODA_NC_LRUREM(cncp);
- CODA_NC_LRUINS(cncp, &coda_nc_lru);
-
- /* move it to the front of the hash chain */
- /* don't need to change the hash bucket length */
- CODA_NC_HSHREM(cncp);
- CODA_NC_HSHINS(cncp, &coda_nc_hash[hash]);
-
- CODA_NC_DEBUG(CODA_NC_LOOKUP,
- printf("lookup: dcp %p, name %s, cred %p = cp %p\n",
- dcp, name, cred, cncp->cp); )
-
- return(cncp->cp);
-}
-
-static void
-coda_nc_remove(cncp, dcstat)
- struct coda_cache *cncp;
- enum dc_status dcstat;
-{
- /*
- * remove an entry -- vrele(cncp->dcp, cp), crfree(cred),
- * remove it from it's hash chain, and
- * place it at the head of the lru list.
- */
- CODA_NC_DEBUG(CODA_NC_REMOVE,
- myprintf(("coda_nc_remove %s from parent %s\n",
- cncp->name, coda_f2s(&cncp->dcp->c_fid))); )
- CODA_NC_HSHREM(cncp);
-
- CODA_NC_HSHNUL(cncp); /* have it be a null chain */
- if ((dcstat == IS_DOWNCALL) && (vrefcnt(CTOV(cncp->dcp)) == 1)) {
- cncp->dcp->c_flags |= C_PURGING;
- }
- vrele(CTOV(cncp->dcp));
-
- if ((dcstat == IS_DOWNCALL) && (vrefcnt(CTOV(cncp->cp)) == 1)) {
- cncp->cp->c_flags |= C_PURGING;
- }
- vrele(CTOV(cncp->cp));
-
- crfree(cncp->cred);
- bzero(DATA_PART(cncp),DATA_SIZE);
-
- /* Put the null entry just after the least-recently-used entry */
- /* LRU_TOP adjusts the pointer to point to the top of the structure. */
- CODA_NC_LRUREM(cncp);
- CODA_NC_LRUINS(cncp, LRU_TOP(coda_nc_lru.lru_prev));
-}
-
-/*
- * Remove all entries with a parent which has the input fid.
- */
-void
-coda_nc_zapParentfid(fid, dcstat)
- CodaFid *fid;
- enum dc_status dcstat;
-{
- /* To get to a specific fid, we might either have another hashing
- function or do a sequential search through the cache for the
- appropriate entries. The later may be acceptable since I don't
- think callbacks or whatever Case 1 covers are frequent occurences.
- */
- struct coda_cache *cncp, *ncncp;
- int i;
-
- if (coda_nc_use == 0) /* Cache is off */
- return;
-
- CODA_NC_DEBUG(CODA_NC_ZAPPFID,
- myprintf(("ZapParent: fid %s\n", coda_f2s(fid))); )
-
- coda_nc_stat.zapPfids++;
-
- for (i = 0; i < coda_nc_hashsize; i++) {
-
- /*
- * Need to save the hash_next pointer in case we remove the
- * entry. remove causes hash_next to point to itself.
- */
-
- for (cncp = coda_nc_hash[i].hash_next;
- cncp != (struct coda_cache *)&coda_nc_hash[i];
- cncp = ncncp) {
- ncncp = cncp->hash_next;
- if (coda_fid_eq(&(cncp->dcp->c_fid), fid)) {
- coda_nc_hash[i].length--; /* Used for tuning */
- coda_nc_remove(cncp, dcstat);
- }
- }
- }
-}
-
-
-/*
- * Remove all entries which have the same fid as the input
- */
-void
-coda_nc_zapfid(fid, dcstat)
- CodaFid *fid;
- enum dc_status dcstat;
-{
- /* See comment for zapParentfid. This routine will be used
- if attributes are being cached.
- */
- struct coda_cache *cncp, *ncncp;
- int i;
-
- if (coda_nc_use == 0) /* Cache is off */
- return;
-
- CODA_NC_DEBUG(CODA_NC_ZAPFID,
- myprintf(("Zapfid: fid %s\n", coda_f2s(fid))); )
-
- coda_nc_stat.zapFids++;
-
- for (i = 0; i < coda_nc_hashsize; i++) {
- for (cncp = coda_nc_hash[i].hash_next;
- cncp != (struct coda_cache *)&coda_nc_hash[i];
- cncp = ncncp) {
- ncncp = cncp->hash_next;
- if (coda_fid_eq(&cncp->cp->c_fid, fid)) {
- coda_nc_hash[i].length--; /* Used for tuning */
- coda_nc_remove(cncp, dcstat);
- }
- }
- }
-}
-
-/*
- * Remove all entries which match the fid and the cred
- */
-void
-coda_nc_zapvnode(fid, cred, dcstat)
- CodaFid *fid;
- struct ucred *cred;
- enum dc_status dcstat;
-{
- /* See comment for zapfid. I don't think that one would ever
- want to zap a file with a specific cred from the kernel.
- We'll leave this one unimplemented.
- */
-
- if (coda_nc_use == 0) /* Cache is off */
- return;
-
- CODA_NC_DEBUG(CODA_NC_ZAPVNODE,
- myprintf(("Zapvnode: fid %s cred %p\n",
- coda_f2s(fid), cred)); )
-
-
-
-}
-
-/*
- * Remove all entries which have the (dir vnode, name) pair
- */
-void
-coda_nc_zapfile(dcp, name, namelen)
- struct cnode *dcp;
- const char *name;
- int namelen;
-{
- /* use the hash function to locate the file, then zap all
- entries of it regardless of the cred.
- */
- struct coda_cache *cncp;
- int hash;
-
- if (coda_nc_use == 0) /* Cache is off */
- return;
-
- CODA_NC_DEBUG(CODA_NC_ZAPFILE,
- myprintf(("Zapfile: dcp %p name %s \n",
- dcp, name)); )
-
- if (namelen > CODA_NC_NAMELEN) {
- coda_nc_stat.long_remove++; /* record stats */
- return;
- }
-
- coda_nc_stat.zapFile++;
-
- hash = CODA_NC_HASH(name, namelen, dcp);
- cncp = coda_nc_find(dcp, name, namelen, 0, hash);
-
- while (cncp) {
- coda_nc_hash[hash].length--; /* Used for tuning */
-
- coda_nc_remove(cncp, NOT_DOWNCALL);
- cncp = coda_nc_find(dcp, name, namelen, 0, hash);
- }
-}
-
-/*
- * Remove all the entries for a particular user. Used when tokens expire.
- * A user is determined by his/her effective user id (id_uid).
- */
-void
-coda_nc_purge_user(uid, dcstat)
- uid_t uid;
- enum dc_status dcstat;
-{
- /*
- * I think the best approach is to go through the entire cache
- * via HASH or whatever and zap all entries which match the
- * input cred. Or just flush the whole cache. It might be
- * best to go through on basis of LRU since cache will almost
- * always be full and LRU is more straightforward.
- */
-
- struct coda_cache *cncp, *ncncp;
- int hash;
-
- if (coda_nc_use == 0) /* Cache is off */
- return;
-
- CODA_NC_DEBUG(CODA_NC_PURGEUSER,
- myprintf(("ZapDude: uid %x\n", uid)); )
- coda_nc_stat.zapUsers++;
-
- for (cncp = CODA_NC_LRUGET(coda_nc_lru);
- cncp != (struct coda_cache *)(&coda_nc_lru);
- cncp = ncncp) {
- ncncp = CODA_NC_LRUGET(*cncp);
-
- if ((CODA_NC_VALID(cncp)) &&
- ((cncp->cred)->cr_uid == uid)) {
- /* Seems really ugly, but we have to decrement the appropriate
- hash bucket length here, so we have to find the hash bucket
- */
- hash = CODA_NC_HASH(cncp->name, cncp->namelen, cncp->dcp);
- coda_nc_hash[hash].length--; /* For performance tuning */
-
- coda_nc_remove(cncp, dcstat);
- }
- }
-}
-
-/*
- * Flush the entire name cache. In response to a flush of the Venus cache.
- */
-void
-coda_nc_flush(dcstat)
- enum dc_status dcstat;
-{
- /* One option is to deallocate the current name cache and
- call init to start again. Or just deallocate, then rebuild.
- Or again, we could just go through the array and zero the
- appropriate fields.
- */
-
- /*
- * Go through the whole lru chain and kill everything as we go.
- * I don't use remove since that would rebuild the lru chain
- * as it went and that seemed unneccesary.
- */
- struct coda_cache *cncp;
- int i;
-
- if (coda_nc_use == 0) /* Cache is off */
- return;
-
- coda_nc_stat.Flushes++;
-
- for (cncp = CODA_NC_LRUGET(coda_nc_lru);
- cncp != (struct coda_cache *)&coda_nc_lru;
- cncp = CODA_NC_LRUGET(*cncp)) {
- if (CODA_NC_VALID(cncp)) {
-
- CODA_NC_HSHREM(cncp); /* only zero valid nodes */
- CODA_NC_HSHNUL(cncp);
- if ((dcstat == IS_DOWNCALL)
- && (vrefcnt(CTOV(cncp->dcp)) == 1))
- {
- cncp->dcp->c_flags |= C_PURGING;
- }
- vrele(CTOV(cncp->dcp));
-
- ASSERT_VOP_LOCKED(CTOV(cncp->cp), "coda_nc_flush");
- if (CTOV(cncp->cp)->v_vflag & VV_TEXT) {
- if (coda_vmflush(cncp->cp))
- CODADEBUG(CODA_FLUSH,
- myprintf(("coda_nc_flush: %s busy\n",
- coda_f2s(&cncp->cp->c_fid))); )
- }
-
- if ((dcstat == IS_DOWNCALL)
- && (vrefcnt(CTOV(cncp->cp)) == 1))
- {
- cncp->cp->c_flags |= C_PURGING;
- }
- vrele(CTOV(cncp->cp));
-
- crfree(cncp->cred);
- bzero(DATA_PART(cncp),DATA_SIZE);
- }
- }
-
- for (i = 0; i < coda_nc_hashsize; i++)
- coda_nc_hash[i].length = 0;
-}
-
-/*
- * Debugging routines
- */
-
-/*
- * This routine should print out all the hash chains to the console.
- */
-void
-print_coda_nc(void)
-{
- int hash;
- struct coda_cache *cncp;
-
- for (hash = 0; hash < coda_nc_hashsize; hash++) {
- myprintf(("\nhash %d\n",hash));
-
- for (cncp = coda_nc_hash[hash].hash_next;
- cncp != (struct coda_cache *)&coda_nc_hash[hash];
- cncp = cncp->hash_next) {
- myprintf(("cp %p dcp %p cred %p name %s\n",
- cncp->cp, cncp->dcp,
- cncp->cred, cncp->name));
- }
- }
-}
-
-void
-coda_nc_gather_stats(void)
-{
- int i, max = 0, sum = 0, temp, zeros = 0, ave, n;
-
- for (i = 0; i < coda_nc_hashsize; i++) {
- if (coda_nc_hash[i].length) {
- sum += coda_nc_hash[i].length;
- } else {
- zeros++;
- }
-
- if (coda_nc_hash[i].length > max)
- max = coda_nc_hash[i].length;
- }
-
- /*
- * When computing the Arithmetic mean, only count slots which
- * are not empty in the distribution.
- */
- coda_nc_stat.Sum_bucket_len = sum;
- coda_nc_stat.Num_zero_len = zeros;
- coda_nc_stat.Max_bucket_len = max;
-
- if ((n = coda_nc_hashsize - zeros) > 0)
- ave = sum / n;
- else
- ave = 0;
-
- sum = 0;
- for (i = 0; i < coda_nc_hashsize; i++) {
- if (coda_nc_hash[i].length) {
- temp = coda_nc_hash[i].length - ave;
- sum += temp * temp;
- }
- }
- coda_nc_stat.Sum2_bucket_len = sum;
-}
-
-/*
- * The purpose of this routine is to allow the hash and cache sizes to be
- * changed dynamically. This should only be used in controlled environments,
- * it makes no effort to lock other users from accessing the cache while it
- * is in an improper state (except by turning the cache off).
- */
-int
-coda_nc_resize(hashsize, heapsize, dcstat)
- int hashsize, heapsize;
- enum dc_status dcstat;
-{
- if ((hashsize % 2) || (heapsize % 2)) { /* Illegal hash or cache sizes */
- return(EINVAL);
- }
-
- coda_nc_use = 0; /* Turn the cache off */
-
- coda_nc_flush(dcstat); /* free any cnodes in the cache */
-
- /* WARNING: free must happen *before* size is reset */
- CODA_FREE(coda_nc_heap,TOTAL_CACHE_SIZE);
- CODA_FREE(coda_nc_hash,TOTAL_HASH_SIZE);
-
- coda_nc_hashsize = hashsize;
- coda_nc_size = heapsize;
-
- coda_nc_init(); /* Set up a cache with the new size */
-
- coda_nc_use = 1; /* Turn the cache back on */
- return(0);
-}
-
-#ifdef DEBUG
-char coda_nc_name_buf[CODA_MAXNAMLEN+1];
-
-void
-coda_nc_name(struct cnode *cp)
-{
- struct coda_cache *cncp, *ncncp;
- int i;
-
- if (coda_nc_use == 0) /* Cache is off */
- return;
-
- for (i = 0; i < coda_nc_hashsize; i++) {
- for (cncp = coda_nc_hash[i].hash_next;
- cncp != (struct coda_cache *)&coda_nc_hash[i];
- cncp = ncncp) {
- ncncp = cncp->hash_next;
- if (cncp->cp == cp) {
- bcopy(cncp->name, coda_nc_name_buf, cncp->namelen);
- coda_nc_name_buf[cncp->namelen] = 0;
- printf(" is %s (%p,%p)@%p",
- coda_nc_name_buf, cncp->cp, cncp->dcp, cncp);
- }
-
- }
- }
-}
-#endif
diff --git a/sys/fs/coda/coda_namecache.h b/sys/fs/coda/coda_namecache.h
deleted file mode 100644
index 77f2cb1..0000000
--- a/sys/fs/coda/coda_namecache.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_namecache.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-/*-
- * Mach Operating System
- * Copyright (c) 1990 Carnegie-Mellon University
- * Copyright (c) 1989 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * This code was written for the Coda filesystem at Carnegie Mellon University.
- * Contributers include David Steere, James Kistler, and M. Satyanarayanan.
- */
-
-#ifndef _CODA_NC_HEADER_
-#define _CODA_NC_HEADER_
-
-/*
- * Coda constants
- */
-#define CODA_NC_NAMELEN 15 /* longest name stored in cache */
-#define CODA_NC_CACHESIZE 256 /* Default cache size */
-#define CODA_NC_HASHSIZE 64 /* Must be multiple of 2 */
-
-/*
- * Hash function for the primary hash.
- */
-
-/*
- * First try -- (first + last letters + length + (int)cp) mod size
- * 2nd try -- same, except dir fid.vnode instead of cp
- */
-
-#ifdef oldhash
-#define CODA_NC_HASH(name, namelen, cp) \
- ((name[0] + name[namelen-1] + namelen + (int)(intptr_t)(cp)) & (coda_nc_hashsize-1))
-#else
-#define CODA_NC_HASH(name, namelen, cp) \
- ((name[0] + (name[namelen-1]<<4) + namelen + (((int)(intptr_t)cp)>>8)) & (coda_nc_hashsize-1))
-#endif
-
-#define CODA_NAMEMATCH(cp, name, namelen, dcp) \
- ((namelen == cp->namelen) && (dcp == cp->dcp) && \
- (bcmp(cp->name,name,namelen) == 0))
-
-/*
- * Functions to modify the hash and lru chains.
- * insque and remque assume that the pointers are the first thing
- * in the list node, thus the trickery for lru.
- */
-
-#define CODA_NC_HSHINS(elem, pred) insque(elem,pred)
-#define CODA_NC_HSHREM(elem) remque(elem)
-#define CODA_NC_HSHNUL(elem) (elem)->hash_next = \
- (elem)->hash_prev = (elem)
-
-#define CODA_NC_LRUINS(elem, pred) insque(LRU_PART(elem), LRU_PART(pred))
-#define CODA_NC_LRUREM(elem) remque(LRU_PART(elem));
-#define CODA_NC_LRUGET(lruhead) LRU_TOP((lruhead).lru_prev)
-
-#define CODA_NC_VALID(cncp) (cncp->dcp != (struct cnode *)0)
-
-#define LRU_PART(cncp) (struct coda_cache *) \
- ((char *)cncp + (2*sizeof(struct coda_cache *)))
-#define LRU_TOP(cncp) (struct coda_cache *) \
- ((char *)cncp - (2*sizeof(struct coda_cache *)))
-#define DATA_PART(cncp) (struct coda_cache *) \
- ((char *)cncp + (4*sizeof(struct coda_cache *)))
-#define DATA_SIZE (sizeof(struct coda_cache)-(4*sizeof(struct coda_cache *)))
-
-/*
- * Structure for an element in the CODA Name Cache.
- * NOTE: I use the position of arguments and their size in the
- * implementation of the functions CODA_NC_LRUINS, CODA_NC_LRUREM, and
- * DATA_PART.
- */
-
-struct coda_cache {
- struct coda_cache *hash_next,*hash_prev; /* Hash list */
- struct coda_cache *lru_next, *lru_prev; /* LRU list */
- struct cnode *cp; /* vnode of the file */
- struct cnode *dcp; /* parent's cnode */
- struct ucred *cred; /* user credentials */
- char name[CODA_NC_NAMELEN]; /* segment name */
- int namelen; /* length of name */
-};
-
-struct coda_lru { /* Start of LRU chain */
- char *dummy1, *dummy2; /* place holders */
- struct coda_cache *lru_next, *lru_prev; /* position of pointers is important */
-};
-
-
-struct coda_hash { /* Start of Hash chain */
- struct coda_cache *hash_next, *hash_prev; /* NOTE: chain pointers must be first */
- int length; /* used for tuning purposes */
-};
-
-
-/*
- * Symbols to aid in debugging the namecache code. Assumes the existence
- * of the variable coda_nc_debug, which is defined in cfs_namecache.c
- */
-#define CODA_NC_DEBUG(N, STMT) { if (coda_nc_debug & (1 <<N)) { STMT } }
-
-/* Prototypes of functions exported within cfs */
-extern void coda_nc_init(void);
-extern void coda_nc_enter(struct cnode *, const char *, int, struct ucred *, struct cnode *);
-extern struct cnode *coda_nc_lookup(struct cnode *, const char *, int, struct ucred *);
-
-extern void coda_nc_zapParentfid(CodaFid *, enum dc_status);
-extern void coda_nc_zapfid(CodaFid *, enum dc_status);
-extern void coda_nc_zapvnode(CodaFid *, struct ucred *, enum dc_status);
-extern void coda_nc_zapfile(struct cnode *, const char *, int);
-extern void coda_nc_purge_user(uid_t, enum dc_status);
-extern void coda_nc_flush(enum dc_status);
-
-extern void print_coda_nc(void);
-extern void coda_nc_gather_stats(void);
-extern int coda_nc_resize(int, int, enum dc_status);
-extern void coda_nc_name(struct cnode *cp);
-
-/*
- * Structure to contain statistics on the cache usage
- */
-
-struct coda_nc_statistics {
- unsigned hits;
- unsigned misses;
- unsigned enters;
- unsigned dbl_enters;
- unsigned long_name_enters;
- unsigned long_name_lookups;
- unsigned long_remove;
- unsigned lru_rm;
- unsigned zapPfids;
- unsigned zapFids;
- unsigned zapFile;
- unsigned zapUsers;
- unsigned Flushes;
- unsigned Sum_bucket_len;
- unsigned Sum2_bucket_len;
- unsigned Max_bucket_len;
- unsigned Num_zero_len;
- unsigned Search_len;
-};
-
-#define CODA_NC_FIND ((u_long) 1)
-#define CODA_NC_REMOVE ((u_long) 2)
-#define CODA_NC_INIT ((u_long) 3)
-#define CODA_NC_ENTER ((u_long) 4)
-#define CODA_NC_LOOKUP ((u_long) 5)
-#define CODA_NC_ZAPPFID ((u_long) 6)
-#define CODA_NC_ZAPFID ((u_long) 7)
-#define CODA_NC_ZAPVNODE ((u_long) 8)
-#define CODA_NC_ZAPFILE ((u_long) 9)
-#define CODA_NC_PURGEUSER ((u_long) 10)
-#define CODA_NC_FLUSH ((u_long) 11)
-#define CODA_NC_PRINTCODA_NC ((u_long) 12)
-#define CODA_NC_PRINTSTATS ((u_long) 13)
-
-#endif
diff --git a/sys/fs/coda/coda_opstats.h b/sys/fs/coda/coda_opstats.h
deleted file mode 100644
index a8d52b3..0000000
--- a/sys/fs/coda/coda_opstats.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_opstats.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-/*
- * operation stats: what the minicache can intercept that
- * *isn't* seen by venus. These stats are kept to augment
- * the stats maintained by the Volume-Session mechanism.
- */
-
-/* vfsops:
- * mount: not currently bounced to Venus
- * umount: nope
- * root: only first call, rest is cached.
- * statfs: none (bogus)
- * sync: none (bogus)
- * vget: all
- */
-
-#define CODA_MOUNT_STATS 0
-#define CODA_UMOUNT_STATS 1
-#define CODA_ROOT_STATS 2
-#define CODA_STATFS_STATS 3
-#define CODA_SYNC_STATS 4
-#define CODA_VGET_STATS 5
-#define CODA_VFSOPS_SIZE 6
-
-/* vnodeops:
- * open: all to venus
- * close: all to venus
- * rdrw: bogus. Maybe redirected to UFS.
- * May call open/close for internal opens/closes
- * (Does exec not call open?)
- * ioctl: causes a lookupname
- * passes through
- * select: can't get there from here.
- * getattr: can be satsified by cache
- * setattr: all go through
- * access: can be satisfied by cache
- * readlink: can be satisfied by cache
- * fsync: passes through
- * inactive: passes through
- * lookup: can be satisfied by cache
- * create: passes through
- * remove: passes through
- * link: passes through
- * rename: passes through
- * mkdir: passes through
- * rmdir: passes through
- * symlink: passes through
- * readdir: may be redirected to UFS
- * may cause an "internal" open/close
- */
-
-#define CODA_OPEN_STATS 0
-#define CODA_CLOSE_STATS 1
-#define CODA_RDWR_STATS 2
-#define CODA_IOCTL_STATS 3
-#define CODA_SELECT_STATS 4
-#define CODA_GETATTR_STATS 5
-#define CODA_SETATTR_STATS 6
-#define CODA_ACCESS_STATS 7
-#define CODA_READLINK_STATS 8
-#define CODA_FSYNC_STATS 9
-#define CODA_INACTIVE_STATS 10
-#define CODA_LOOKUP_STATS 11
-#define CODA_CREATE_STATS 12
-#define CODA_REMOVE_STATS 13
-#define CODA_LINK_STATS 14
-#define CODA_RENAME_STATS 15
-#define CODA_MKDIR_STATS 16
-#define CODA_RMDIR_STATS 17
-#define CODA_SYMLINK_STATS 18
-#define CODA_READDIR_STATS 19
-#define CODA_VNODEOPS_SIZE 20
-
-/*
- * I propose the following structres:
- */
-
-struct coda_op_stats {
- int opcode; /* vfs opcode */
- long entries; /* number of times call attempted */
- long sat_intrn; /* number of times call satisfied by cache */
- long unsat_intrn; /* number of times call failed in cache, but
- was not bounced to venus proper. */
- long gen_intrn; /* number of times call generated internally */
- /* (do we need that?) */
-};
-
-/*
- * With each call to the minicache, we'll bump the counters whenver
- * a call is satisfied internally (through the cache or through a
- * redirect), and whenever an operation is caused internally.
- * Then, we can add the total operations caught by the minicache
- * to the world-wide totals, and leave a caveat for the specific
- * graphs later.
- */
diff --git a/sys/fs/coda/coda_pioctl.h b/sys/fs/coda/coda_pioctl.h
deleted file mode 100644
index ea61b64..0000000
--- a/sys/fs/coda/coda_pioctl.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_pioctl.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-/*-
- * Mach Operating System
- * Copyright (c) 1989 Carnegie-Mellon University
- * Copyright (c) 1988 Carnegie-Mellon University
- * Copyright (c) 1987 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * ITC Remote filesystem - vice ioctl interface module
- */
-
-/*
- * TODO: Find /usr/local/include/viceioctl.h.
- */
-
-#ifndef _SYS_PIOCTL_H_
-#define _SYS_PIOCTL_H_
-
-/* The 2K limits above are a consequence of the size of the kernel buffer
- used to buffer requests from the user to venus--2*MAXPATHLEN.
- The buffer pointers may be null, or the counts may be 0 if there
- are no input or output parameters
- */
-
-#define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl))
-
-/* Use this macro to define up to 256 vice ioctl's. These ioctl's
- all potentially have in/out parameters--this depends upon the
- values in the ViceIoctl structure. This structure is itself passed
- into the kernel by the normal ioctl parameter passing mechanism.
- */
-
-#define _VALIDVICEIOCTL(com) (com >= _VICEIOCTL(0) && com <= _VICEIOCTL(255))
-
-#endif
diff --git a/sys/fs/coda/coda_psdev.c b/sys/fs/coda/coda_psdev.c
deleted file mode 100644
index 7e71f1c..0000000
--- a/sys/fs/coda/coda_psdev.c
+++ /dev/null
@@ -1,672 +0,0 @@
-/*-
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- */
-/*-
- * Mach Operating System
- * Copyright (c) 1989 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * This code was written for the Coda filesystem at Carnegie Mellon
- * University. Contributers include David Steere, James Kistler, and
- * M. Satyanarayanan. */
-
-/*
- * These routines define the psuedo device for communication between
- * Coda's Venus and Minicache in Mach 2.6. They used to be in cfs_subr.c,
- * but I moved them to make it easier to port the Minicache without
- * porting coda. -- DCS 10/12/94
- */
-
-/* These routines are the device entry points for Venus. */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-
-extern int coda_nc_initialized; /* Set if cache has been initialized */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioccom.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/file.h> /* must come after sys/malloc.h */
-#include <sys/mount.h>
-#include <sys/mutex.h>
-#include <sys/poll.h>
-#include <sys/proc.h>
-
-#include <coda/coda.h>
-#include <coda/cnode.h>
-#include <coda/coda_namecache.h>
-#include <coda/coda_io.h>
-#include <coda/coda_psdev.h>
-
-#define CTL_C
-
-#ifdef CTL_C
-#include <sys/signalvar.h>
-#endif
-
-int coda_psdev_print_entry = 0;
-static
-int outstanding_upcalls = 0;
-int coda_call_sleep = PZERO - 1;
-#ifdef CTL_C
-int coda_pcatch = PCATCH;
-#else
-#endif
-
-#define ENTRY if(coda_psdev_print_entry) myprintf(("Entered %s\n",__func__))
-
-void vcodaattach(int n);
-
-struct vmsg {
- struct queue vm_chain;
- caddr_t vm_data;
- u_short vm_flags;
- u_short vm_inSize; /* Size is at most 5000 bytes */
- u_short vm_outSize;
- u_short vm_opcode; /* copied from data to save ptr lookup */
- int vm_unique;
- caddr_t vm_sleep; /* Not used by Mach. */
-};
-
-#define VM_READ 1
-#define VM_WRITE 2
-#define VM_INTR 4
-
-/* vcodaattach: do nothing */
-void
-vcodaattach(n)
- int n;
-{
-}
-
-int
-vc_nb_open(dev, flag, mode, td)
- struct cdev *dev;
- int flag;
- int mode;
- struct thread *td; /* NetBSD only */
-{
- struct vcomm *vcp;
- struct coda_mntinfo *mnt;
-
- ENTRY;
-
- if (!coda_nc_initialized)
- coda_nc_init();
-
- mnt = dev2coda_mntinfo(dev);
- vcp = &mnt->mi_vcomm;
- if (VC_OPEN(vcp))
- return(EBUSY);
-
- bzero(&(vcp->vc_selproc), sizeof (struct selinfo));
- INIT_QUEUE(vcp->vc_requests);
- INIT_QUEUE(vcp->vc_replys);
- MARK_VC_OPEN(vcp);
-
- mnt->mi_vfsp = NULL;
- mnt->mi_rootvp = NULL;
-
- return(0);
-}
-
-int
-vc_nb_close (dev, flag, mode, td)
- struct cdev *dev;
- int flag;
- int mode;
- struct thread *td;
-{
- register struct vcomm *vcp;
- register struct vmsg *vmp, *nvmp = NULL;
- struct coda_mntinfo *mi;
- int err;
-
- ENTRY;
-
- mi = dev2coda_mntinfo(dev);
- vcp = &(mi->mi_vcomm);
-
- if (!VC_OPEN(vcp))
- panic("vcclose: not open");
-
- /* prevent future operations on this vfs from succeeding by auto-
- * unmounting any vfs mounted via this device. This frees user or
- * sysadm from having to remember where all mount points are located.
- * Put this before WAKEUPs to avoid queuing new messages between
- * the WAKEUP and the unmount (which can happen if we're unlucky)
- */
- if (!mi->mi_rootvp) {
- /* just a simple open/close w no mount */
- MARK_VC_CLOSED(vcp);
- return 0;
- }
-
- /* Let unmount know this is for real */
- VTOC(mi->mi_rootvp)->c_flags |= C_UNMOUNTING;
- coda_unmounting(mi->mi_vfsp);
-
- outstanding_upcalls = 0;
- /* Wakeup clients so they can return. */
- for (vmp = (struct vmsg *)GETNEXT(vcp->vc_requests);
- !EOQ(vmp, vcp->vc_requests);
- vmp = nvmp)
- {
- nvmp = (struct vmsg *)GETNEXT(vmp->vm_chain);
- /* Free signal request messages and don't wakeup cause
- no one is waiting. */
- if (vmp->vm_opcode == CODA_SIGNAL) {
- CODA_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA);
- CODA_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg));
- continue;
- }
- outstanding_upcalls++;
- wakeup(&vmp->vm_sleep);
- }
-
- for (vmp = (struct vmsg *)GETNEXT(vcp->vc_replys);
- !EOQ(vmp, vcp->vc_replys);
- vmp = (struct vmsg *)GETNEXT(vmp->vm_chain))
- {
- outstanding_upcalls++;
- wakeup(&vmp->vm_sleep);
- }
-
- MARK_VC_CLOSED(vcp);
-
- if (outstanding_upcalls) {
-#ifdef CODA_VERBOSE
- printf("presleep: outstanding_upcalls = %d\n", outstanding_upcalls);
- (void) tsleep(&outstanding_upcalls, coda_call_sleep, "coda_umount", 0);
- printf("postsleep: outstanding_upcalls = %d\n", outstanding_upcalls);
-#else
- (void) tsleep(&outstanding_upcalls, coda_call_sleep, "coda_umount", 0);
-#endif
- }
-
- err = dounmount(mi->mi_vfsp, flag, td);
- if (err)
- myprintf(("Error %d unmounting vfs in vcclose(%s)\n",
- err, devtoname(dev)));
- return 0;
-}
-
-int
-vc_nb_read(dev, uiop, flag)
- struct cdev *dev;
- struct uio *uiop;
- int flag;
-{
- register struct vcomm * vcp;
- register struct vmsg *vmp;
- int error = 0;
-
- ENTRY;
-
- vcp = &dev2coda_mntinfo(dev)->mi_vcomm;
- /* Get message at head of request queue. */
- if (EMPTY(vcp->vc_requests))
- return(0); /* Nothing to read */
-
- vmp = (struct vmsg *)GETNEXT(vcp->vc_requests);
-
- /* Move the input args into userspace */
- uiop->uio_rw = UIO_READ;
- error = uiomove(vmp->vm_data, vmp->vm_inSize, uiop);
- if (error) {
- myprintf(("vcread: error (%d) on uiomove\n", error));
- error = EINVAL;
- }
-
-#ifdef OLD_DIAGNOSTIC
- if (vmp->vm_chain.forw == 0 || vmp->vm_chain.back == 0)
- panic("vc_nb_read: bad chain");
-#endif
-
- REMQUE(vmp->vm_chain);
-
- /* If request was a signal, free up the message and don't
- enqueue it in the reply queue. */
- if (vmp->vm_opcode == CODA_SIGNAL) {
- if (codadebug)
- myprintf(("vcread: signal msg (%d, %d)\n",
- vmp->vm_opcode, vmp->vm_unique));
- CODA_FREE((caddr_t)vmp->vm_data, (u_int)VC_IN_NO_DATA);
- CODA_FREE((caddr_t)vmp, (u_int)sizeof(struct vmsg));
- return(error);
- }
-
- vmp->vm_flags |= VM_READ;
- INSQUE(vmp->vm_chain, vcp->vc_replys);
-
- return(error);
-}
-
-int
-vc_nb_write(dev, uiop, flag)
- struct cdev *dev;
- struct uio *uiop;
- int flag;
-{
- register struct vcomm * vcp;
- register struct vmsg *vmp;
- struct coda_out_hdr *out;
- u_long seq;
- u_long opcode;
- int buf[2];
- int error = 0;
-
- ENTRY;
-
- vcp = &dev2coda_mntinfo(dev)->mi_vcomm;
-
- /* Peek at the opcode, unique without transfering the data. */
- uiop->uio_rw = UIO_WRITE;
- error = uiomove((caddr_t)buf, sizeof(int) * 2, uiop);
- if (error) {
- myprintf(("vcwrite: error (%d) on uiomove\n", error));
- return(EINVAL);
- }
-
- opcode = buf[0];
- seq = buf[1];
-
- if (codadebug)
- myprintf(("vcwrite got a call for %ld.%ld\n", opcode, seq));
-
- if (DOWNCALL(opcode)) {
- union outputArgs pbuf;
-
- /* get the rest of the data. */
- uiop->uio_rw = UIO_WRITE;
- error = uiomove((caddr_t)&pbuf.coda_purgeuser.oh.result, sizeof(pbuf) - (sizeof(int)*2), uiop);
- if (error) {
- myprintf(("vcwrite: error (%d) on uiomove (Op %ld seq %ld)\n",
- error, opcode, seq));
- return(EINVAL);
- }
-
- return handleDownCall(opcode, &pbuf);
- }
-
- /* Look for the message on the (waiting for) reply queue. */
- for (vmp = (struct vmsg *)GETNEXT(vcp->vc_replys);
- !EOQ(vmp, vcp->vc_replys);
- vmp = (struct vmsg *)GETNEXT(vmp->vm_chain))
- {
- if (vmp->vm_unique == seq) break;
- }
-
- if (EOQ(vmp, vcp->vc_replys)) {
- if (codadebug)
- myprintf(("vcwrite: msg (%ld, %ld) not found\n", opcode, seq));
-
- return(ESRCH);
- }
-
- /* Remove the message from the reply queue */
- REMQUE(vmp->vm_chain);
-
- /* move data into response buffer. */
- out = (struct coda_out_hdr *)vmp->vm_data;
- /* Don't need to copy opcode and uniquifier. */
-
- /* get the rest of the data. */
- if (vmp->vm_outSize < uiop->uio_resid) {
- myprintf(("vcwrite: more data than asked for (%d < %d)\n",
- vmp->vm_outSize, uiop->uio_resid));
- wakeup(&vmp->vm_sleep); /* Notify caller of the error. */
- return(EINVAL);
- }
-
- buf[0] = uiop->uio_resid; /* Save this value. */
- uiop->uio_rw = UIO_WRITE;
- error = uiomove((caddr_t) &out->result, vmp->vm_outSize - (sizeof(int) * 2), uiop);
- if (error) {
- myprintf(("vcwrite: error (%d) on uiomove (op %ld seq %ld)\n",
- error, opcode, seq));
- return(EINVAL);
- }
-
- /* I don't think these are used, but just in case. */
- /* XXX - aren't these two already correct? -bnoble */
- out->opcode = opcode;
- out->unique = seq;
- vmp->vm_outSize = buf[0]; /* Amount of data transferred? */
- vmp->vm_flags |= VM_WRITE;
- wakeup(&vmp->vm_sleep);
-
- return(0);
-}
-
-int
-vc_nb_ioctl(dev, cmd, addr, flag, td)
- struct cdev *dev;
- u_long cmd;
- caddr_t addr;
- int flag;
- struct thread *td;
-{
- ENTRY;
-
- switch(cmd) {
- case CODARESIZE: {
- struct coda_resize *data = (struct coda_resize *)addr;
- return(coda_nc_resize(data->hashsize, data->heapsize, IS_DOWNCALL));
- break;
- }
- case CODASTATS:
- if (coda_nc_use) {
- coda_nc_gather_stats();
- return(0);
- } else {
- return(ENODEV);
- }
- break;
- case CODAPRINT:
- if (coda_nc_use) {
- print_coda_nc();
- return(0);
- } else {
- return(ENODEV);
- }
- break;
- case CIOC_KERNEL_VERSION:
- switch (*(u_int *)addr) {
- case 0:
- *(u_int *)addr = coda_kernel_version;
- return 0;
- break;
- case 1:
- case 2:
- if (coda_kernel_version != *(u_int *)addr)
- return ENOENT;
- else
- return 0;
- default:
- return ENOENT;
- }
- break;
- default :
- return(EINVAL);
- break;
- }
-}
-
-int
-vc_nb_poll(dev, events, td)
- struct cdev *dev;
- int events;
- struct thread *td;
-{
- register struct vcomm *vcp;
- int event_msk = 0;
-
- ENTRY;
-
- vcp = &dev2coda_mntinfo(dev)->mi_vcomm;
-
- event_msk = events & (POLLIN|POLLRDNORM);
- if (!event_msk)
- return(0);
-
- if (!EMPTY(vcp->vc_requests))
- return(events & (POLLIN|POLLRDNORM));
-
- selrecord(td, &(vcp->vc_selproc));
-
- return(0);
-}
-
-/*
- * Statistics
- */
-struct coda_clstat coda_clstat;
-
-/*
- * Key question: whether to sleep interuptably or uninteruptably when
- * waiting for Venus. The former seems better (cause you can ^C a
- * job), but then GNU-EMACS completion breaks. Use tsleep with no
- * timeout, and no longjmp happens. But, when sleeping
- * "uninterruptibly", we don't get told if it returns abnormally
- * (e.g. kill -9).
- */
-
-int
-coda_call(mntinfo, inSize, outSize, buffer)
- struct coda_mntinfo *mntinfo; int inSize; int *outSize; caddr_t buffer;
-{
- struct vcomm *vcp;
- struct vmsg *vmp;
- int error;
-#ifdef CTL_C
- struct thread *td = curthread;
- struct proc *p = td->td_proc;
- sigset_t psig_omask;
- sigset_t tempset;
- int i;
-#endif
- if (mntinfo == NULL) {
- /* Unlikely, but could be a race condition with a dying warden */
- return ENODEV;
- }
-
- vcp = &(mntinfo->mi_vcomm);
-
- coda_clstat.ncalls++;
- coda_clstat.reqs[((struct coda_in_hdr *)buffer)->opcode]++;
-
- if (!VC_OPEN(vcp))
- return(ENODEV);
-
- CODA_ALLOC(vmp,struct vmsg *,sizeof(struct vmsg));
- /* Format the request message. */
- vmp->vm_data = buffer;
- vmp->vm_flags = 0;
- vmp->vm_inSize = inSize;
- vmp->vm_outSize
- = *outSize ? *outSize : inSize; /* |buffer| >= inSize */
- vmp->vm_opcode = ((struct coda_in_hdr *)buffer)->opcode;
- vmp->vm_unique = ++vcp->vc_seq;
- if (codadebug)
- myprintf(("Doing a call for %d.%d\n",
- vmp->vm_opcode, vmp->vm_unique));
-
- /* Fill in the common input args. */
- ((struct coda_in_hdr *)buffer)->unique = vmp->vm_unique;
-
- /* Append msg to request queue and poke Venus. */
- INSQUE(vmp->vm_chain, vcp->vc_requests);
- selwakeuppri(&(vcp->vc_selproc), coda_call_sleep);
-
- /* We can be interrupted while we wait for Venus to process
- * our request. If the interrupt occurs before Venus has read
- * the request, we dequeue and return. If it occurs after the
- * read but before the reply, we dequeue, send a signal
- * message, and return. If it occurs after the reply we ignore
- * it. In no case do we want to restart the syscall. If it
- * was interrupted by a venus shutdown (vcclose), return
- * ENODEV. */
-
- /* Ignore return, We have to check anyway */
-#ifdef CTL_C
- /* This is work in progress. Setting coda_pcatch lets tsleep reawaken
- on a ^c or ^z. The problem is that emacs sets certain interrupts
- as SA_RESTART. This means that we should exit sleep handle the
- "signal" and then go to sleep again. Mostly this is done by letting
- the syscall complete and be restarted. We are not idempotent and
- can not do this. A better solution is necessary.
- */
- i = 0;
- PROC_LOCK(p);
- psig_omask = td->td_sigmask;
- do {
- error = msleep(&vmp->vm_sleep, &p->p_mtx,
- (coda_call_sleep|coda_pcatch), "coda_call",
- hz*2);
- if (error == 0)
- break;
- else if (error == EWOULDBLOCK) {
-#ifdef CODA_VERBOSE
- printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i);
-#endif
- }
- else {
- SIGEMPTYSET(tempset);
- SIGADDSET(tempset, SIGIO);
- if (SIGSETEQ(td->td_siglist, tempset)) {
- SIGADDSET(td->td_sigmask, SIGIO);
-#ifdef CODA_VERBOSE
- printf("coda_call: tsleep returns %d SIGIO, cnt %d\n",
- error, i);
-#endif
- } else {
- SIGDELSET(tempset, SIGIO);
- SIGADDSET(tempset, SIGALRM);
- if (SIGSETEQ(td->td_siglist, tempset)) {
- SIGADDSET(td->td_sigmask, SIGALRM);
-#ifdef CODA_VERBOSE
- printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n",
- error, i);
-#endif
- }
- else {
-#ifdef CODA_VERBOSE
- printf("coda_call: tsleep returns %d, cnt %d\n",
- error, i);
-#endif
-
-#if notyet
- tempset = td->td_siglist;
- SIGSETNAND(tempset, td->td_sigmask);
- printf("coda_call: siglist = %p, sigmask = %p, mask %p\n",
- td->td_siglist, td->td_sigmask,
- tempset);
- break;
- SIGSETOR(td->td_sigmask, td->td_siglist);
- tempset = td->td_siglist;
- SIGSETNAND(tempset, td->td_sigmask);
- printf("coda_call: new mask, siglist = %p, sigmask = %p, mask %p\n",
- td->td_siglist, td->td_sigmask,
- tempset);
-#endif
- }
- }
- }
- } while (error && i++ < 128 && VC_OPEN(vcp));
- td->td_sigmask = psig_omask;
- signotify(td);
- PROC_UNLOCK(p);
-#else
- (void) tsleep(&vmp->vm_sleep, coda_call_sleep, "coda_call", 0);
-#endif
- if (VC_OPEN(vcp)) { /* Venus is still alive */
- /* Op went through, interrupt or not... */
- if (vmp->vm_flags & VM_WRITE) {
- error = 0;
- *outSize = vmp->vm_outSize;
- }
-
- else if (!(vmp->vm_flags & VM_READ)) {
- /* Interrupted before venus read it. */
-#ifdef CODA_VERBOSE
- if (1)
-#else
- if (codadebug)
-#endif
- myprintf(("interrupted before read: op = %d.%d, flags = %x\n",
- vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));
- REMQUE(vmp->vm_chain);
- error = EINTR;
- }
-
- else {
- /* (!(vmp->vm_flags & VM_WRITE)) means interrupted after
- upcall started */
- /* Interrupted after start of upcall, send venus a signal */
- struct coda_in_hdr *dog;
- struct vmsg *svmp;
-
-#ifdef CODA_VERBOSE
- if (1)
-#else
- if (codadebug)
-#endif
- myprintf(("Sending Venus a signal: op = %d.%d, flags = %x\n",
- vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));
-
- REMQUE(vmp->vm_chain);
- error = EINTR;
-
- CODA_ALLOC(svmp, struct vmsg *, sizeof (struct vmsg));
-
- CODA_ALLOC((svmp->vm_data), char *, sizeof (struct coda_in_hdr));
- dog = (struct coda_in_hdr *)svmp->vm_data;
-
- svmp->vm_flags = 0;
- dog->opcode = svmp->vm_opcode = CODA_SIGNAL;
- dog->unique = svmp->vm_unique = vmp->vm_unique;
- svmp->vm_inSize = sizeof (struct coda_in_hdr);
-/*??? rvb */ svmp->vm_outSize = sizeof (struct coda_in_hdr);
-
- if (codadebug)
- myprintf(("coda_call: enqueing signal msg (%d, %d)\n",
- svmp->vm_opcode, svmp->vm_unique));
-
- /* insert at head of queue! */
- INSQUE(svmp->vm_chain, vcp->vc_requests);
- selwakeuppri(&(vcp->vc_selproc), coda_call_sleep);
- }
- }
-
- else { /* If venus died (!VC_OPEN(vcp)) */
- if (codadebug)
- myprintf(("vcclose woke op %d.%d flags %d\n",
- vmp->vm_opcode, vmp->vm_unique, vmp->vm_flags));
-
- error = ENODEV;
- }
-
- CODA_FREE(vmp, sizeof(struct vmsg));
-
- if (outstanding_upcalls > 0 && (--outstanding_upcalls == 0))
- wakeup(&outstanding_upcalls);
-
- if (!error)
- error = ((struct coda_out_hdr *)buffer)->result;
- return(error);
-}
diff --git a/sys/fs/coda/coda_psdev.h b/sys/fs/coda/coda_psdev.h
deleted file mode 100644
index 5d1193ba..0000000
--- a/sys/fs/coda/coda_psdev.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-int vc_nb_open(struct cdev *dev, int flag, int mode, struct thread *p);
-int vc_nb_close (struct cdev *dev, int flag, int mode, struct thread *p);
-int vc_nb_read(struct cdev *dev, struct uio *uiop, int flag);
-int vc_nb_write(struct cdev *dev, struct uio *uiop, int flag);
-int vc_nb_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *p);
-int vc_nb_poll(struct cdev *dev, int events, struct thread *p);
diff --git a/sys/fs/coda/coda_subr.c b/sys/fs/coda/coda_subr.c
deleted file mode 100644
index 878bd68..0000000
--- a/sys/fs/coda/coda_subr.c
+++ /dev/null
@@ -1,573 +0,0 @@
-/*-
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_subr.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- */
-/*-
- * Mach Operating System
- * Copyright (c) 1989 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * This code was written for the Coda filesystem at Carnegie Mellon
- * University. Contributers include David Steere, James Kistler, and
- * M. Satyanarayanan.
- */
-
-/* NOTES: rvb
- * 1. Added coda_unmounting to mark all cnodes as being UNMOUNTING. This has to
- * be done before dounmount is called. Because some of the routines that
- * dounmount calls before coda_unmounted might try to force flushes to venus.
- * The vnode pager does this.
- * 2. coda_unmounting marks all cnodes scanning coda_cache.
- * 3. cfs_checkunmounting (under DEBUG) checks all cnodes by chasing the vnodes
- * under the /coda mount point.
- * 4. coda_cacheprint (under DEBUG) prints names with vnode/cnode address
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/mount.h>
-
-#include <coda/coda.h>
-#include <coda/cnode.h>
-#include <coda/coda_subr.h>
-#include <coda/coda_namecache.h>
-
-int coda_active = 0;
-int coda_reuse = 0;
-int coda_new = 0;
-
-struct cnode *coda_freelist = NULL;
-struct cnode *coda_cache[CODA_CACHESIZE];
-
-#define CNODE_NEXT(cp) ((cp)->c_next)
-
-#ifdef CODA_COMPAT_5
-#define coda_hash(fid) \
- (((fid)->Volume + (fid)->Vnode) & (CODA_CACHESIZE-1))
-#define IS_DIR(cnode) (cnode.Vnode & 0x1)
-#else
-#define coda_hash(fid) (coda_f2i(fid) & (CODA_CACHESIZE-1))
-#define IS_DIR(cnode) (cnode.opaque[2] & 0x1)
-#endif
-
-/*
- * Allocate a cnode.
- */
-struct cnode *
-coda_alloc(void)
-{
- struct cnode *cp;
-
- if (coda_freelist) {
- cp = coda_freelist;
- coda_freelist = CNODE_NEXT(cp);
- coda_reuse++;
- }
- else {
- CODA_ALLOC(cp, struct cnode *, sizeof(struct cnode));
- /* NetBSD vnodes don't have any Pager info in them ('cause there are
- no external pagers, duh!) */
-#define VNODE_VM_INFO_INIT(vp) /* MT */
- VNODE_VM_INFO_INIT(CTOV(cp));
- coda_new++;
- }
- bzero(cp, sizeof (struct cnode));
-
- return(cp);
-}
-
-/*
- * Deallocate a cnode.
- */
-void
-coda_free(cp)
- register struct cnode *cp;
-{
-
- CNODE_NEXT(cp) = coda_freelist;
- coda_freelist = cp;
-}
-
-/*
- * Put a cnode in the hash table
- */
-void
-coda_save(cp)
- struct cnode *cp;
-{
- CNODE_NEXT(cp) = coda_cache[coda_hash(&cp->c_fid)];
- coda_cache[coda_hash(&cp->c_fid)] = cp;
-}
-
-/*
- * Remove a cnode from the hash table
- */
-void
-coda_unsave(cp)
- struct cnode *cp;
-{
- struct cnode *ptr;
- struct cnode *ptrprev = NULL;
-
- ptr = coda_cache[coda_hash(&cp->c_fid)];
- while (ptr != NULL) {
- if (ptr == cp) {
- if (ptrprev == NULL) {
- coda_cache[coda_hash(&cp->c_fid)]
- = CNODE_NEXT(ptr);
- } else {
- CNODE_NEXT(ptrprev) = CNODE_NEXT(ptr);
- }
- CNODE_NEXT(cp) = (struct cnode *)NULL;
-
- return;
- }
- ptrprev = ptr;
- ptr = CNODE_NEXT(ptr);
- }
-}
-
-/*
- * Lookup a cnode by fid. If the cnode is dying, it is bogus so skip it.
- * NOTE: this allows multiple cnodes with same fid -- dcs 1/25/95
- */
-struct cnode *
-coda_find(fid)
- CodaFid *fid;
-{
- struct cnode *cp;
-
- cp = coda_cache[coda_hash(fid)];
- while (cp) {
- if (coda_fid_eq(&(cp->c_fid), fid) &&
- (!IS_UNMOUNTING(cp)))
- {
- coda_active++;
- return(cp);
- }
- cp = CNODE_NEXT(cp);
- }
- return(NULL);
-}
-
-/*
- * coda_kill is called as a side effect to vcopen. To prevent any
- * cnodes left around from an earlier run of a venus or warden from
- * causing problems with the new instance, mark any outstanding cnodes
- * as dying. Future operations on these cnodes should fail (excepting
- * coda_inactive of course!). Since multiple venii/wardens can be
- * running, only kill the cnodes for a particular entry in the
- * coda_mnttbl. -- DCS 12/1/94 */
-
-int
-coda_kill(whoIam, dcstat)
- struct mount *whoIam;
- enum dc_status dcstat;
-{
- int hash, count = 0;
- struct cnode *cp;
-
- /*
- * Algorithm is as follows:
- * Second, flush whatever vnodes we can from the name cache.
- *
- * Finally, step through whatever is left and mark them dying.
- * This prevents any operation at all.
- */
-
- /* This is slightly overkill, but should work. Eventually it'd be
- * nice to only flush those entries from the namecache that
- * reference a vnode in this vfs. */
- coda_nc_flush(dcstat);
-
- for (hash = 0; hash < CODA_CACHESIZE; hash++) {
- for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) {
- if (CTOV(cp)->v_mount == whoIam) {
-#ifdef DEBUG
- printf("coda_kill: vp %p, cp %p\n", CTOV(cp), cp);
-#endif
- count++;
- CODADEBUG(CODA_FLUSH,
- myprintf(("Live cnode fid %s flags %d count %d\n",
- coda_f2s(&cp->c_fid),
- cp->c_flags,
- vrefcnt(CTOV(cp)))); );
- }
- }
- }
- return count;
-}
-
-/*
- * There are two reasons why a cnode may be in use, it may be in the
- * name cache or it may be executing.
- */
-void
-coda_flush(dcstat)
- enum dc_status dcstat;
-{
- int hash;
- struct cnode *cp;
-
- coda_clstat.ncalls++;
- coda_clstat.reqs[CODA_FLUSH]++;
-
- coda_nc_flush(dcstat); /* flush files from the name cache */
-
- for (hash = 0; hash < CODA_CACHESIZE; hash++) {
- for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) {
- if (!IS_DIR(cp->c_fid)) /* only files can be executed */
- coda_vmflush(cp);
- }
- }
-}
-
-/*
- * As a debugging measure, print out any cnodes that lived through a
- * name cache flush.
- */
-void
-coda_testflush(void)
-{
- int hash;
- struct cnode *cp;
-
- for (hash = 0; hash < CODA_CACHESIZE; hash++) {
- for (cp = coda_cache[hash];
- cp != NULL;
- cp = CNODE_NEXT(cp)) {
- myprintf(("Live cnode fid %s count %d\n",
- coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount));
- }
- }
-}
-
-/*
- * First, step through all cnodes and mark them unmounting.
- * NetBSD kernels may try to fsync them now that venus
- * is dead, which would be a bad thing.
- *
- */
-void
-coda_unmounting(whoIam)
- struct mount *whoIam;
-{
- int hash;
- struct cnode *cp;
-
- for (hash = 0; hash < CODA_CACHESIZE; hash++) {
- for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) {
- if (CTOV(cp)->v_mount == whoIam) {
- if (cp->c_flags & (C_LOCKED|C_WANTED)) {
- printf("coda_unmounting: Unlocking %p\n", cp);
- cp->c_flags &= ~(C_LOCKED|C_WANTED);
- wakeup((caddr_t) cp);
- }
- cp->c_flags |= C_UNMOUNTING;
- }
- }
- }
-}
-
-#ifdef DEBUG
-void
-coda_checkunmounting(mp)
- struct mount *mp;
-{
- struct vnode *vp, *nvp;
- struct cnode *cp;
- int count = 0, bad = 0;
-
- MNT_ILOCK(mp);
- MNT_VNODE_FOREACH(vp, mp, nvp) {
- VI_LOCK(vp);
- if (vp->v_iflag & VI_DOOMED) {
- VI_UNLOCK(vp);
- continue;
- }
- cp = VTOC(vp);
- count++;
- if (!(cp->c_flags & C_UNMOUNTING)) {
- bad++;
- printf("vp %p, cp %p missed\n", vp, cp);
- cp->c_flags |= C_UNMOUNTING;
- }
- VI_UNLOCK(vp);
- }
- MNT_IUNLOCK(mp);
-}
-
-void
-coda_cacheprint(whoIam)
- struct mount *whoIam;
-{
- int hash;
- struct cnode *cp;
- int count = 0;
-
- printf("coda_cacheprint: coda_ctlvp %p, cp %p", coda_ctlvp, VTOC(coda_ctlvp));
- coda_nc_name(VTOC(coda_ctlvp));
- printf("\n");
-
- for (hash = 0; hash < CODA_CACHESIZE; hash++) {
- for (cp = coda_cache[hash]; cp != NULL; cp = CNODE_NEXT(cp)) {
- if (CTOV(cp)->v_mount == whoIam) {
- printf("coda_cacheprint: vp %p, cp %p", CTOV(cp), cp);
- coda_nc_name(cp);
- printf("\n");
- count++;
- }
- }
- }
- printf("coda_cacheprint: count %d\n", count);
-}
-#endif
-
-/*
- * There are 6 cases where invalidations occur. The semantics of each
- * is listed here.
- *
- * CODA_FLUSH -- flush all entries from the name cache and the cnode cache.
- * CODA_PURGEUSER -- flush all entries from the name cache for a specific user
- * This call is a result of token expiration.
- *
- * The next two are the result of callbacks on a file or directory.
- * CODA_ZAPDIR -- flush the attributes for the dir from its cnode.
- * Zap all children of this directory from the namecache.
- * CODA_ZAPFILE -- flush the attributes for a file.
- *
- * The fifth is a result of Venus detecting an inconsistent file.
- * CODA_PURGEFID -- flush the attribute for the file
- * If it is a dir (odd vnode), purge its
- * children from the namecache
- * remove the file from the namecache.
- *
- * The sixth allows Venus to replace local fids with global ones
- * during reintegration.
- *
- * CODA_REPLACE -- replace one CodaFid with another throughout the name cache
- */
-
-int handleDownCall(opcode, out)
- int opcode; union outputArgs *out;
-{
- int error;
-
- /* Handle invalidate requests. */
- switch (opcode) {
- case CODA_FLUSH : {
-
- coda_flush(IS_DOWNCALL);
-
- CODADEBUG(CODA_FLUSH,coda_testflush();) /* print remaining cnodes */
- return(0);
- }
-
- case CODA_PURGEUSER : {
- coda_clstat.ncalls++;
- coda_clstat.reqs[CODA_PURGEUSER]++;
-
- /* XXX - need to prevent fsync's */
-#ifdef CODA_COMPAT_5
- coda_nc_purge_user(out->coda_purgeuser.cred.cr_uid, IS_DOWNCALL);
-#else
- coda_nc_purge_user(out->coda_purgeuser.uid, IS_DOWNCALL);
-#endif
- return(0);
- }
-
- case CODA_ZAPFILE : {
- struct cnode *cp;
-
- error = 0;
- coda_clstat.ncalls++;
- coda_clstat.reqs[CODA_ZAPFILE]++;
-
- cp = coda_find(&out->coda_zapfile.Fid);
- if (cp != NULL) {
- vref(CTOV(cp));
-
- cp->c_flags &= ~C_VATTR;
- ASSERT_VOP_LOCKED(CTOV(cp), "coda HandleDownCall");
- if (CTOV(cp)->v_vflag & VV_TEXT)
- error = coda_vmflush(cp);
- CODADEBUG(CODA_ZAPFILE,
- myprintf(("zapfile: fid = %s, refcnt = %d, error = %d\n",
- coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount - 1, error)););
- if (vrefcnt(CTOV(cp)) == 1) {
- cp->c_flags |= C_PURGING;
- }
- vrele(CTOV(cp));
- }
-
- return(error);
- }
-
- case CODA_ZAPDIR : {
- struct cnode *cp;
-
- coda_clstat.ncalls++;
- coda_clstat.reqs[CODA_ZAPDIR]++;
-
- cp = coda_find(&out->coda_zapdir.Fid);
- if (cp != NULL) {
- vref(CTOV(cp));
-
- cp->c_flags &= ~C_VATTR;
- coda_nc_zapParentfid(&out->coda_zapdir.Fid, IS_DOWNCALL);
-
- CODADEBUG(CODA_ZAPDIR, myprintf((
- "zapdir: fid = %s, refcnt = %d\n",
- coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount - 1)););
- if (vrefcnt(CTOV(cp)) == 1) {
- cp->c_flags |= C_PURGING;
- }
- vrele(CTOV(cp));
- }
-
- return(0);
- }
-
- case CODA_PURGEFID : {
- struct cnode *cp;
-
- error = 0;
- coda_clstat.ncalls++;
- coda_clstat.reqs[CODA_PURGEFID]++;
-
- cp = coda_find(&out->coda_purgefid.Fid);
- if (cp != NULL) {
- vref(CTOV(cp));
- if (IS_DIR(out->coda_purgefid.Fid)) { /* Vnode is a directory */
- coda_nc_zapParentfid(&out->coda_purgefid.Fid,IS_DOWNCALL);
- }
- cp->c_flags &= ~C_VATTR;
- coda_nc_zapfid(&out->coda_purgefid.Fid, IS_DOWNCALL);
- ASSERT_VOP_LOCKED(CTOV(cp), "coda HandleDownCall");
- if (!(IS_DIR(out->coda_purgefid.Fid))
- && (CTOV(cp)->v_vflag & VV_TEXT)) {
-
- error = coda_vmflush(cp);
- }
- CODADEBUG(CODA_PURGEFID, myprintf((
- "purgefid: fid = %s, refcnt = %d, error = %d\n",
- coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount - 1, error)););
- if (vrefcnt(CTOV(cp)) == 1) {
- cp->c_flags |= C_PURGING;
- }
- vrele(CTOV(cp));
- }
- return(error);
- }
-
- case CODA_REPLACE : {
- struct cnode *cp = NULL;
-
- coda_clstat.ncalls++;
- coda_clstat.reqs[CODA_REPLACE]++;
-
- cp = coda_find(&out->coda_replace.OldFid);
- if (cp != NULL) {
- /* remove the cnode from the hash table, replace the fid, and reinsert */
- vref(CTOV(cp));
- coda_unsave(cp);
- cp->c_fid = out->coda_replace.NewFid;
- coda_save(cp);
-
- CODADEBUG(CODA_REPLACE, myprintf((
- "replace: oldfid = %s, newfid = %s, cp = %p\n",
- coda_f2s(&out->coda_replace.OldFid),
- coda_f2s(&cp->c_fid), cp));) vrele(CTOV(cp));
- }
- return (0);
- }
- default:
- myprintf(("handleDownCall: unknown opcode %d\n", opcode));
- return (EINVAL);
- }
-}
-
-/* coda_grab_vnode: lives in either cfs_mach.c or cfs_nbsd.c */
-
-int
-coda_vmflush(cp)
- struct cnode *cp;
-{
- return 0;
-}
-
-
-/*
- * kernel-internal debugging switches
- */
-void coda_debugon(void)
-{
- codadebug = -1;
- coda_nc_debug = -1;
- coda_vnop_print_entry = 1;
- coda_psdev_print_entry = 1;
- coda_vfsop_print_entry = 1;
-}
-
-void coda_debugoff(void)
-{
- codadebug = 0;
- coda_nc_debug = 0;
- coda_vnop_print_entry = 0;
- coda_psdev_print_entry = 0;
- coda_vfsop_print_entry = 0;
-}
-
-/*
- * Utilities used by both client and server
- * Standard levels:
- * 0) no debugging
- * 1) hard failures
- * 2) soft failures
- * 3) current test software
- * 4) main procedure entry points
- * 5) main procedure exit points
- * 6) utility procedure entry points
- * 7) utility procedure exit points
- * 8) obscure procedure entry points
- * 9) obscure procedure exit points
- * 10) random stuff
- * 11) all <= 1
- * 12) all <= 2
- * 13) all <= 3
- * ...
- */
diff --git a/sys/fs/coda/coda_subr.h b/sys/fs/coda/coda_subr.h
deleted file mode 100644
index 91bf122..0000000
--- a/sys/fs/coda/coda_subr.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_subr.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-struct cnode *coda_alloc(void);
-void coda_free(struct cnode *cp);
-struct cnode *coda_find(CodaFid *fid);
-void coda_flush(enum dc_status dcstat);
-void coda_testflush(void);
-void coda_checkunmounting(struct mount *mp);
-void coda_cacheprint(struct mount *whoIam);
-void coda_debugon(void);
-void coda_debugoff(void);
-int coda_kill(struct mount *whoIam, enum dc_status dcstat);
-void coda_save(struct cnode *cp);
-void coda_unsave(struct cnode *cp);
diff --git a/sys/fs/coda/coda_venus.c b/sys/fs/coda/coda_venus.c
deleted file mode 100644
index 56d627b..0000000
--- a/sys/fs/coda/coda_venus.c
+++ /dev/null
@@ -1,678 +0,0 @@
-/*-
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/cfs/coda_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/fcntl.h>
-#include <sys/ioccom.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/sx.h>
-
-#include <coda/coda.h>
-#include <coda/cnode.h>
-#include <coda/coda_venus.h>
-#include <coda/coda_pioctl.h>
-
-#define DECL_NO_IN(name) \
- struct coda_in_hdr *inp; \
- struct name ## _out *outp; \
- int name ## _size = sizeof (struct coda_in_hdr); \
- int Isize = sizeof (struct coda_in_hdr); \
- int Osize = sizeof (struct name ## _out); \
- int error
-
-#define DECL(name) \
- struct name ## _in *inp; \
- struct name ## _out *outp; \
- int name ## _size = sizeof (struct name ## _in); \
- int Isize = sizeof (struct name ## _in); \
- int Osize = sizeof (struct name ## _out); \
- int error
-
-#define DECL_NO_OUT(name) \
- struct name ## _in *inp; \
- struct coda_out_hdr *outp; \
- int name ## _size = sizeof (struct name ## _in); \
- int Isize = sizeof (struct name ## _in); \
- int Osize = sizeof (struct coda_out_hdr); \
- int error
-
-#define ALLOC_NO_IN(name) \
- if (Osize > name ## _size) \
- name ## _size = Osize; \
- CODA_ALLOC(inp, struct coda_in_hdr *, name ## _size);\
- outp = (struct name ## _out *) inp
-
-#define ALLOC(name) \
- if (Osize > name ## _size) \
- name ## _size = Osize; \
- CODA_ALLOC(inp, struct name ## _in *, name ## _size);\
- outp = (struct name ## _out *) inp
-
-#define ALLOC_NO_OUT(name) \
- if (Osize > name ## _size) \
- name ## _size = Osize; \
- CODA_ALLOC(inp, struct name ## _in *, name ## _size);\
- outp = (struct coda_out_hdr *) inp
-
-#define STRCPY(struc, name, len) \
- bcopy(name, (char *)inp + (int)inp->struc, len); \
- ((char*)inp + (int)inp->struc)[len++] = 0; \
- Isize += len
-
-#ifdef CODA_COMPAT_5
-#define INIT_IN(in, op, ident, p) \
- (in)->opcode = (op); \
- sx_slock(&proctree_lock); \
- (in)->pid = p ? p->p_pid : -1; \
- (in)->pgid = p ? p->p_pgid : -1; \
- (in)->sid = (p && p->p_session && p->p_session->s_leader) ? (p->p_session->s_leader->p_pid) : -1; \
- sx_sunlock(&proctree_lock); \
- if (ident != NOCRED) { \
- (in)->cred.cr_uid = ident->cr_uid; \
- (in)->cred.cr_groupid = ident->cr_gid; \
- } else { \
- bzero(&((in)->cred),sizeof(struct coda_cred)); \
- (in)->cred.cr_uid = -1; \
- (in)->cred.cr_groupid = -1; \
- }
-#else
-#define INIT_IN(in, op, ident, p) \
- (in)->opcode = (op); \
- (in)->pid = p ? p->p_pid : -1; \
- (in)->pgid = p ? p->p_pgid : -1; \
- if (ident != NOCRED) { \
- (in)->uid = ident->cr_uid; \
- } else { \
- (in)->uid = -1; \
- }
-#endif
-#define CNV_OFLAG(to, from) \
- do { \
- to = 0; \
- if (from & FREAD) to |= C_O_READ; \
- if (from & FWRITE) to |= C_O_WRITE; \
- if (from & O_TRUNC) to |= C_O_TRUNC; \
- if (from & O_EXCL) to |= C_O_EXCL; \
- if (from & O_CREAT) to |= C_O_CREAT; \
- } while (0)
-
-#define CNV_VV2V_ATTR(top, fromp) \
- do { \
- (top)->va_type = (fromp)->va_type; \
- (top)->va_mode = (fromp)->va_mode; \
- (top)->va_nlink = (fromp)->va_nlink; \
- (top)->va_uid = (fromp)->va_uid; \
- (top)->va_gid = (fromp)->va_gid; \
- (top)->va_fsid = VNOVAL; \
- (top)->va_fileid = (fromp)->va_fileid; \
- (top)->va_size = (fromp)->va_size; \
- (top)->va_blocksize = (fromp)->va_blocksize; \
- (top)->va_atime = (fromp)->va_atime; \
- (top)->va_mtime = (fromp)->va_mtime; \
- (top)->va_ctime = (fromp)->va_ctime; \
- (top)->va_gen = (fromp)->va_gen; \
- (top)->va_flags = (fromp)->va_flags; \
- (top)->va_rdev = (fromp)->va_rdev; \
- (top)->va_bytes = (fromp)->va_bytes; \
- (top)->va_filerev = (fromp)->va_filerev; \
- (top)->va_vaflags = VNOVAL; \
- (top)->va_spare = VNOVAL; \
- } while (0)
-
-#define CNV_V2VV_ATTR(top, fromp) \
- do { \
- (top)->va_type = (fromp)->va_type; \
- (top)->va_mode = (fromp)->va_mode; \
- (top)->va_nlink = (fromp)->va_nlink; \
- (top)->va_uid = (fromp)->va_uid; \
- (top)->va_gid = (fromp)->va_gid; \
- (top)->va_fileid = (fromp)->va_fileid; \
- (top)->va_size = (fromp)->va_size; \
- (top)->va_blocksize = (fromp)->va_blocksize; \
- (top)->va_atime = (fromp)->va_atime; \
- (top)->va_mtime = (fromp)->va_mtime; \
- (top)->va_ctime = (fromp)->va_ctime; \
- (top)->va_gen = (fromp)->va_gen; \
- (top)->va_flags = (fromp)->va_flags; \
- (top)->va_rdev = (fromp)->va_rdev; \
- (top)->va_bytes = (fromp)->va_bytes; \
- (top)->va_filerev = (fromp)->va_filerev; \
- } while (0)
-
-
-int coda_kernel_version = CODA_KERNEL_VERSION;
-
-int
-venus_root(void *mdp,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid)
-{
- DECL_NO_IN(coda_root); /* sets Isize & Osize */
- ALLOC_NO_IN(coda_root); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(inp, CODA_ROOT, cred, p);
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
- if (!error)
- *VFid = outp->Fid;
-
- CODA_FREE(inp, coda_root_size);
- return error;
-}
-
-int
-venus_open(void *mdp, CodaFid *fid, int flag,
- struct ucred *cred, struct proc *p,
-/*out*/ struct cdev **dev, ino_t *inode)
-{
-#if 0
- int cflag;
- DECL(coda_open); /* sets Isize & Osize */
- ALLOC(coda_open); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_OPEN, cred, p);
- inp->Fid = *fid;
- CNV_OFLAG(cflag, flag);
- inp->flags = cflag;
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
- if (!error) {
- *dev = findcdev(outp->dev);
- *inode = outp->inode;
- }
-
- CODA_FREE(inp, coda_open_size);
- return error;
-#else
- return (EOPNOTSUPP);
-#endif
-}
-
-int
-venus_close(void *mdp, CodaFid *fid, int flag,
- struct ucred *cred, struct proc *p)
-{
- int cflag;
- DECL_NO_OUT(coda_close); /* sets Isize & Osize */
- ALLOC_NO_OUT(coda_close); /* sets inp & outp */
-
- INIT_IN(&inp->ih, CODA_CLOSE, cred, p);
- inp->Fid = *fid;
- CNV_OFLAG(cflag, flag);
- inp->flags = cflag;
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
-
- CODA_FREE(inp, coda_close_size);
- return error;
-}
-
-/*
- * these two calls will not exist!!! the container file is read/written
- * directly.
- */
-void
-venus_read(void)
-{
-}
-
-void
-venus_write(void)
-{
-}
-
-/*
- * this is a bit sad too. the ioctl's are for the control file, not for
- * normal files.
- */
-int
-venus_ioctl(void *mdp, CodaFid *fid,
- int com, int flag, caddr_t data,
- struct ucred *cred, struct proc *p)
-{
- DECL(coda_ioctl); /* sets Isize & Osize */
- struct PioctlData *iap = (struct PioctlData *)data;
- int tmp;
-
- coda_ioctl_size = VC_MAXMSGSIZE;
- ALLOC(coda_ioctl); /* sets inp & outp */
-
- INIT_IN(&inp->ih, CODA_IOCTL, cred, p);
- inp->Fid = *fid;
-
- /* command was mutated by increasing its size field to reflect the
- * path and follow args. we need to subtract that out before sending
- * the command to venus.
- */
- inp->cmd = (com & ~(IOCPARM_MASK << 16));
- tmp = ((com >> 16) & IOCPARM_MASK) - sizeof (char *) - sizeof (int);
- inp->cmd |= (tmp & IOCPARM_MASK) << 16;
-
- inp->rwflag = flag;
- inp->len = iap->vi.in_size;
- inp->data = (char *)(sizeof (struct coda_ioctl_in));
-
- error = copyin(iap->vi.in, (char*)inp + (long)inp->data,
- iap->vi.in_size);
- if (error) {
- CODA_FREE(inp, coda_ioctl_size);
- return(error);
- }
-
- Osize = VC_MAXMSGSIZE;
- error = coda_call(mdp, Isize + iap->vi.in_size, &Osize, (char *)inp);
-
- /* copy out the out buffer. */
- if (!error) {
- if (outp->len > iap->vi.out_size) {
- error = EINVAL;
- } else {
- error = copyout((char *)outp + (long)outp->data,
- iap->vi.out, iap->vi.out_size);
- }
- }
-
- CODA_FREE(inp, coda_ioctl_size);
- return error;
-}
-
-int
-venus_getattr(void *mdp, CodaFid *fid,
- struct ucred *cred, struct proc *p,
-/*out*/ struct vattr *vap)
-{
- DECL(coda_getattr); /* sets Isize & Osize */
- ALLOC(coda_getattr); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_GETATTR, cred, p);
- inp->Fid = *fid;
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
- if (!error) {
- CNV_VV2V_ATTR(vap, &outp->attr);
- }
-
- CODA_FREE(inp, coda_getattr_size);
- return error;
-}
-
-int
-venus_setattr(void *mdp, CodaFid *fid, struct vattr *vap,
- struct ucred *cred, struct proc *p)
-{
- DECL_NO_OUT(coda_setattr); /* sets Isize & Osize */
- ALLOC_NO_OUT(coda_setattr); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_SETATTR, cred, p);
- inp->Fid = *fid;
- CNV_V2VV_ATTR(&inp->attr, vap);
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
-
- CODA_FREE(inp, coda_setattr_size);
- return error;
-}
-
-int
-venus_access(void *mdp, CodaFid *fid, int mode,
- struct ucred *cred, struct proc *p)
-{
- DECL_NO_OUT(coda_access); /* sets Isize & Osize */
- ALLOC_NO_OUT(coda_access); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_ACCESS, cred, p);
- inp->Fid = *fid;
- /* NOTE:
- * NetBSD and Venus internals use the "data" in the low 3 bits.
- * Hence, the conversion.
- */
- inp->flags = mode>>6;
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
-
- CODA_FREE(inp, coda_access_size);
- return error;
-}
-
-int
-venus_readlink(void *mdp, CodaFid *fid,
- struct ucred *cred, struct proc *p,
-/*out*/ char **str, int *len)
-{
- DECL(coda_readlink); /* sets Isize & Osize */
- coda_readlink_size += CODA_MAXPATHLEN;
- ALLOC(coda_readlink); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_READLINK, cred, p);
- inp->Fid = *fid;
-
- Osize += CODA_MAXPATHLEN;
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
- if (!error) {
- CODA_ALLOC(*str, char *, outp->count);
- *len = outp->count;
- bcopy((char *)outp + (long)outp->data, *str, *len);
- }
-
- CODA_FREE(inp, coda_readlink_size);
- return error;
-}
-
-int
-venus_fsync(void *mdp, CodaFid *fid, struct proc *p)
-{
- DECL_NO_OUT(coda_fsync); /* sets Isize & Osize */
- ALLOC_NO_OUT(coda_fsync); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_FSYNC, NOCRED, p); /* XXX: should be cached mount cred */
- inp->Fid = *fid;
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
-
- CODA_FREE(inp, coda_fsync_size);
- return error;
-}
-
-int
-venus_lookup(void *mdp, CodaFid *fid,
- const char *nm, int len,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid, int *vtype)
-{
- DECL(coda_lookup); /* sets Isize & Osize */
- coda_lookup_size += len + 1;
- ALLOC(coda_lookup); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_LOOKUP, cred, p);
- inp->Fid = *fid;
-
- /* NOTE:
- * Between version 1 and version 2 we have added an extra flag field
- * to this structure. But because the string was at the end and because
- * of the wierd way we represent strings by having the slot point to
- * where the string characters are in the "heap", we can just slip the
- * flag parameter in after the string slot pointer and veni that don't
- * know better won't see this new flag field ...
- * Otherwise we'd need two different venus_lookup functions.
- */
- inp->name = Isize;
- inp->flags = CLU_CASE_SENSITIVE; /* doesn't really matter for BSD */
- STRCPY(name, nm, len); /* increments Isize */
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
- if (!error) {
- *VFid = outp->Fid;
- *vtype = outp->vtype;
- }
-
- CODA_FREE(inp, coda_lookup_size);
- return error;
-}
-
-int
-venus_create(void *mdp, CodaFid *fid,
- const char *nm, int len, int exclusive, int mode, struct vattr *va,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid, struct vattr *attr)
-{
- DECL(coda_create); /* sets Isize & Osize */
- coda_create_size += len + 1;
- ALLOC(coda_create); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_CREATE, cred, p);
- inp->Fid = *fid;
- inp->excl = exclusive ? C_O_EXCL : 0;
- inp->mode = mode;
- CNV_V2VV_ATTR(&inp->attr, va);
-
- inp->name = Isize;
- STRCPY(name, nm, len); /* increments Isize */
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
- if (!error) {
- *VFid = outp->Fid;
- CNV_VV2V_ATTR(attr, &outp->attr);
- }
-
- CODA_FREE(inp, coda_create_size);
- return error;
-}
-
-int
-venus_remove(void *mdp, CodaFid *fid,
- const char *nm, int len,
- struct ucred *cred, struct proc *p)
-{
- DECL_NO_OUT(coda_remove); /* sets Isize & Osize */
- coda_remove_size += len + 1;
- ALLOC_NO_OUT(coda_remove); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_REMOVE, cred, p);
- inp->Fid = *fid;
-
- inp->name = Isize;
- STRCPY(name, nm, len); /* increments Isize */
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
-
- CODA_FREE(inp, coda_remove_size);
- return error;
-}
-
-int
-venus_link(void *mdp, CodaFid *fid, CodaFid *tfid,
- const char *nm, int len,
- struct ucred *cred, struct proc *p)
-{
- DECL_NO_OUT(coda_link); /* sets Isize & Osize */
- coda_link_size += len + 1;
- ALLOC_NO_OUT(coda_link); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_LINK, cred, p);
- inp->sourceFid = *fid;
- inp->destFid = *tfid;
-
- inp->tname = Isize;
- STRCPY(tname, nm, len); /* increments Isize */
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
-
- CODA_FREE(inp, coda_link_size);
- return error;
-}
-
-int
-venus_rename(void *mdp, CodaFid *fid, CodaFid *tfid,
- const char *nm, int len, const char *tnm, int tlen,
- struct ucred *cred, struct proc *p)
-{
- DECL_NO_OUT(coda_rename); /* sets Isize & Osize */
- coda_rename_size += len + 1 + tlen + 1;
- ALLOC_NO_OUT(coda_rename); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_RENAME, cred, p);
- inp->sourceFid = *fid;
- inp->destFid = *tfid;
-
- inp->srcname = Isize;
- STRCPY(srcname, nm, len); /* increments Isize */
-
- inp->destname = Isize;
- STRCPY(destname, tnm, tlen); /* increments Isize */
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
-
- CODA_FREE(inp, coda_rename_size);
- return error;
-}
-
-int
-venus_mkdir(void *mdp, CodaFid *fid,
- const char *nm, int len, struct vattr *va,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid, struct vattr *ova)
-{
- DECL(coda_mkdir); /* sets Isize & Osize */
- coda_mkdir_size += len + 1;
- ALLOC(coda_mkdir); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_MKDIR, cred, p);
- inp->Fid = *fid;
- CNV_V2VV_ATTR(&inp->attr, va);
-
- inp->name = Isize;
- STRCPY(name, nm, len); /* increments Isize */
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
- if (!error) {
- *VFid = outp->Fid;
- CNV_VV2V_ATTR(ova, &outp->attr);
- }
-
- CODA_FREE(inp, coda_mkdir_size);
- return error;
-}
-
-int
-venus_rmdir(void *mdp, CodaFid *fid,
- const char *nm, int len,
- struct ucred *cred, struct proc *p)
-{
- DECL_NO_OUT(coda_rmdir); /* sets Isize & Osize */
- coda_rmdir_size += len + 1;
- ALLOC_NO_OUT(coda_rmdir); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_RMDIR, cred, p);
- inp->Fid = *fid;
-
- inp->name = Isize;
- STRCPY(name, nm, len); /* increments Isize */
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
-
- CODA_FREE(inp, coda_rmdir_size);
- return error;
-}
-
-int
-venus_symlink(void *mdp, CodaFid *fid,
- const char *lnm, int llen, const char *nm, int len, struct vattr *va,
- struct ucred *cred, struct proc *p)
-{
- DECL_NO_OUT(coda_symlink); /* sets Isize & Osize */
- coda_symlink_size += llen + 1 + len + 1;
- ALLOC_NO_OUT(coda_symlink); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_SYMLINK, cred, p);
- inp->Fid = *fid;
- CNV_V2VV_ATTR(&inp->attr, va);
-
- inp->srcname = Isize;
- STRCPY(srcname, lnm, llen); /* increments Isize */
-
- inp->tname = Isize;
- STRCPY(tname, nm, len); /* increments Isize */
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
-
- CODA_FREE(inp, coda_symlink_size);
- return error;
-}
-
-int
-venus_readdir(void *mdp, CodaFid *fid,
- int count, int offset,
- struct ucred *cred, struct proc *p,
-/*out*/ char *buffer, int *len)
-{
- DECL(coda_readdir); /* sets Isize & Osize */
- coda_readdir_size = VC_MAXMSGSIZE;
- ALLOC(coda_readdir); /* sets inp & outp */
-
- /* send the open to venus. */
- INIT_IN(&inp->ih, CODA_READDIR, cred, p);
- inp->Fid = *fid;
- inp->count = count;
- inp->offset = offset;
-
- Osize = VC_MAXMSGSIZE;
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
- if (!error) {
- bcopy((char *)outp + (long)outp->data, buffer, outp->size);
- *len = outp->size;
- }
-
- CODA_FREE(inp, coda_readdir_size);
- return error;
-}
-
-int
-venus_fhtovp(void *mdp, CodaFid *fid,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid, int *vtype)
-{
- DECL(coda_vget); /* sets Isize & Osize */
- ALLOC(coda_vget); /* sets inp & outp */
-
- /* Send the open to Venus. */
- INIT_IN(&inp->ih, CODA_VGET, cred, p);
- inp->Fid = *fid;
-
- error = coda_call(mdp, Isize, &Osize, (char *)inp);
- if (!error) {
- *VFid = outp->Fid;
- *vtype = outp->vtype;
- }
-
- CODA_FREE(inp, coda_vget_size);
- return error;
-}
diff --git a/sys/fs/coda/coda_venus.h b/sys/fs/coda/coda_venus.h
deleted file mode 100644
index 1d1e0cf..0000000
--- a/sys/fs/coda/coda_venus.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_venus.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-int
-venus_root(void *mdp,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid);
-
-int
-venus_open(void *mdp, CodaFid *fid, int flag,
- struct ucred *cred, struct proc *p,
-/*out*/ struct cdev **dev, ino_t *inode);
-
-int
-venus_close(void *mdp, CodaFid *fid, int flag,
- struct ucred *cred, struct proc *p);
-
-void
-venus_read(void);
-
-void
-venus_write(void);
-
-int
-venus_ioctl(void *mdp, CodaFid *fid,
- int com, int flag, caddr_t data,
- struct ucred *cred, struct proc *p);
-
-int
-venus_getattr(void *mdp, CodaFid *fid,
- struct ucred *cred, struct proc *p,
-/*out*/ struct vattr *vap);
-
-int
-venus_setattr(void *mdp, CodaFid *fid, struct vattr *vap,
- struct ucred *cred, struct proc *p);
-
-int
-venus_access(void *mdp, CodaFid *fid, int mode,
- struct ucred *cred, struct proc *p);
-
-int
-venus_readlink(void *mdp, CodaFid *fid,
- struct ucred *cred, struct proc *p,
-/*out*/ char **str, int *len);
-
-int
-venus_fsync(void *mdp, CodaFid *fid, struct proc *p);
-
-int
-venus_lookup(void *mdp, CodaFid *fid,
- const char *nm, int len,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid, int *vtype);
-
-int
-venus_create(void *mdp, CodaFid *fid,
- const char *nm, int len, int exclusive, int mode, struct vattr *va,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid, struct vattr *attr);
-
-int
-venus_remove(void *mdp, CodaFid *fid,
- const char *nm, int len,
- struct ucred *cred, struct proc *p);
-
-int
-venus_link(void *mdp, CodaFid *fid, CodaFid *tfid,
- const char *nm, int len,
- struct ucred *cred, struct proc *p);
-
-int
-venus_rename(void *mdp, CodaFid *fid, CodaFid *tfid,
- const char *nm, int len, const char *tnm, int tlen,
- struct ucred *cred, struct proc *p);
-
-int
-venus_mkdir(void *mdp, CodaFid *fid,
- const char *nm, int len, struct vattr *va,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid, struct vattr *ova);
-
-int
-venus_rmdir(void *mdp, CodaFid *fid,
- const char *nm, int len,
- struct ucred *cred, struct proc *p);
-
-int
-venus_symlink(void *mdp, CodaFid *fid,
- const char *lnm, int llen, const char *nm, int len, struct vattr *va,
- struct ucred *cred, struct proc *p);
-
-int
-venus_readdir(void *mdp, CodaFid *fid,
- int count, int offset,
- struct ucred *cred, struct proc *p,
-/*out*/ char *buffer, int *len);
-
-int
-venus_fhtovp(void *mdp, CodaFid *fid,
- struct ucred *cred, struct proc *p,
-/*out*/ CodaFid *VFid, int *vtype);
diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c
deleted file mode 100644
index c73d364..0000000
--- a/sys/fs/coda/coda_vfsops.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/*-
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- */
-/*-
- * Mach Operating System
- * Copyright (c) 1989 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * This code was written for the Coda filesystem at Carnegie Mellon
- * University. Contributers include David Steere, James Kistler, and
- * M. Satyanarayanan.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mount.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
-
-#include <coda/coda.h>
-#include <coda/cnode.h>
-#include <coda/coda_vfsops.h>
-#include <coda/coda_venus.h>
-#include <coda/coda_subr.h>
-#include <coda/coda_opstats.h>
-
-MALLOC_DEFINE(M_CODA, "CODA storage", "Various Coda Structures");
-
-int codadebug = 0;
-int coda_vfsop_print_entry = 0;
-#define ENTRY if(coda_vfsop_print_entry) myprintf(("Entered %s\n",__func__))
-
-struct vnode *coda_ctlvp;
-
-/* structure to keep statistics of internally generated/satisfied calls */
-
-struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE];
-
-#define MARK_ENTRY(op) (coda_vfsopstats[op].entries++)
-#define MARK_INT_SAT(op) (coda_vfsopstats[op].sat_intrn++)
-#define MARK_INT_FAIL(op) (coda_vfsopstats[op].unsat_intrn++)
-#define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++)
-
-extern int coda_nc_initialized; /* Set if cache has been initialized */
-extern int vc_nb_open(struct cdev *, int, int, struct thread *);
-
-int
-coda_vfsopstats_init(void)
-{
- register int i;
-
- for (i=0;i<CODA_VFSOPS_SIZE;i++) {
- coda_vfsopstats[i].opcode = i;
- coda_vfsopstats[i].entries = 0;
- coda_vfsopstats[i].sat_intrn = 0;
- coda_vfsopstats[i].unsat_intrn = 0;
- coda_vfsopstats[i].gen_intrn = 0;
- }
-
- return 0;
-}
-
-static const char *coda_opts[] = { "from", NULL };
-/*
- * cfs mount vfsop
- * Set up mount info record and attach it to vfs struct.
- */
-/*ARGSUSED*/
-int
-coda_mount(struct mount *vfsp, struct thread *td)
-{
- struct vnode *dvp;
- struct cnode *cp;
- struct cdev *dev;
- struct coda_mntinfo *mi;
- struct vnode *rootvp;
- CodaFid rootfid = INVAL_FID;
- CodaFid ctlfid = CTL_FID;
- int error;
- struct nameidata ndp;
- ENTRY;
- char *from;
-
- if (vfs_filteropt(vfsp->mnt_optnew, coda_opts))
- return (EINVAL);
-
- from = vfs_getopts(vfsp->mnt_optnew, "from", &error);
- if (error)
- return (error);
-
- coda_vfsopstats_init();
- coda_vnodeopstats_init();
-
- MARK_ENTRY(CODA_MOUNT_STATS);
- if (CODA_MOUNTED(vfsp)) {
- MARK_INT_FAIL(CODA_MOUNT_STATS);
- return(EBUSY);
- }
-
- /* Validate mount device. Similar to getmdev(). */
- NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, from, td);
- error = namei(&ndp);
- dvp = ndp.ni_vp;
-
- if (error) {
- MARK_INT_FAIL(CODA_MOUNT_STATS);
- return (error);
- }
- if (dvp->v_type != VCHR) {
- MARK_INT_FAIL(CODA_MOUNT_STATS);
- vrele(dvp);
- NDFREE(&ndp, NDF_ONLY_PNBUF);
- return(ENXIO);
- }
- dev = dvp->v_rdev;
- vrele(dvp);
- NDFREE(&ndp, NDF_ONLY_PNBUF);
-
- /*
- * See if the device table matches our expectations.
- */
- if (dev->si_devsw->d_open != vc_nb_open)
- {
- MARK_INT_FAIL(CODA_MOUNT_STATS);
- return(ENXIO);
- }
-
- /*
- * Initialize the mount record and link it to the vfs struct
- */
- mi = dev2coda_mntinfo(dev);
-
- if (!VC_OPEN(&mi->mi_vcomm)) {
- MARK_INT_FAIL(CODA_MOUNT_STATS);
- return(ENODEV);
- }
-
- /* No initialization (here) of mi_vcomm! */
- vfsp->mnt_data = (qaddr_t)mi;
- vfs_getnewfsid (vfsp);
-
- mi->mi_vfsp = vfsp;
- mi->mi_started = 0; /* XXX See coda_root() */
-
- /*
- * Make a root vnode to placate the Vnode interface, but don't
- * actually make the CODA_ROOT call to venus until the first call
- * to coda_root in case a server is down while venus is starting.
- */
- cp = make_coda_node(&rootfid, vfsp, VDIR);
- rootvp = CTOV(cp);
- rootvp->v_vflag |= VV_ROOT;
-
-/* cp = make_coda_node(&ctlfid, vfsp, VCHR);
- The above code seems to cause a loop in the cnode links.
- I don't totally understand when it happens, it is caught
- when closing down the system.
- */
- cp = make_coda_node(&ctlfid, 0, VCHR);
-
- coda_ctlvp = CTOV(cp);
-
- /* Add vfs and rootvp to chain of vfs hanging off mntinfo */
- mi->mi_vfsp = vfsp;
- mi->mi_rootvp = rootvp;
-
- vfs_mountedfrom(vfsp, from);
- /* error is currently guaranteed to be zero, but in case some
- code changes... */
- CODADEBUG(1,
- myprintf(("coda_omount returned %d\n",error)););
- if (error)
- MARK_INT_FAIL(CODA_MOUNT_STATS);
- else
- MARK_INT_SAT(CODA_MOUNT_STATS);
-
- return(error);
-}
-
-int
-coda_unmount(vfsp, mntflags, td)
- struct mount *vfsp;
- int mntflags;
- struct thread *td;
-{
- struct coda_mntinfo *mi = vftomi(vfsp);
- int active, error = 0;
-
- ENTRY;
- MARK_ENTRY(CODA_UMOUNT_STATS);
- if (!CODA_MOUNTED(vfsp)) {
- MARK_INT_FAIL(CODA_UMOUNT_STATS);
- return(EINVAL);
- }
-
- if (mi->mi_vfsp == vfsp) { /* We found the victim */
- if (!IS_UNMOUNTING(VTOC(mi->mi_rootvp)))
- return (EBUSY); /* Venus is still running */
-
-#ifdef DEBUG
- printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp));
-#endif
- vrele(mi->mi_rootvp);
- active = coda_kill(vfsp, NOT_DOWNCALL);
- ASSERT_VOP_LOCKED(mi->mi_rootvp, "coda_unmount");
- mi->mi_rootvp->v_vflag &= ~VV_ROOT;
- error = vflush(mi->mi_vfsp, 0, FORCECLOSE, td);
-#ifdef CODA_VERBOSE
- printf("coda_unmount: active = %d, vflush active %d\n", active, error);
-#endif
- error = 0;
- /* I'm going to take this out to allow lookups to go through. I'm
- * not sure it's important anyway. -- DCS 2/2/94
- */
- /* vfsp->VFS_DATA = NULL; */
-
- /* No more vfsp's to hold onto */
- mi->mi_vfsp = NULL;
- mi->mi_rootvp = NULL;
-
- if (error)
- MARK_INT_FAIL(CODA_UMOUNT_STATS);
- else
- MARK_INT_SAT(CODA_UMOUNT_STATS);
-
- return(error);
- }
- return (EINVAL);
-}
-
-/*
- * find root of cfs
- */
-int
-coda_root(vfsp, flags, vpp, td)
- struct mount *vfsp;
- int flags;
- struct vnode **vpp;
- struct thread *td;
-{
- struct coda_mntinfo *mi = vftomi(vfsp);
- struct vnode **result;
- int error;
- struct proc *p = td->td_proc;
- CodaFid VFid;
- static const CodaFid invalfid = INVAL_FID;
-
- ENTRY;
- MARK_ENTRY(CODA_ROOT_STATS);
- result = NULL;
-
- if (vfsp == mi->mi_vfsp) {
- /*
- * Cache the root across calls. We only need to pass the request
- * on to Venus if the root vnode is the dummy we installed in
- * coda_omount() with all c_fid members zeroed.
- *
- * XXX In addition, we assume that the first call to coda_root()
- * is from vfs_omount()
- * (before the call to checkdirs()) and return the dummy root
- * node to avoid a deadlock. This bug is fixed in the Coda CVS
- * repository but not in any released versions as of 6 Mar 2003.
- */
- if (memcmp(&VTOC(mi->mi_rootvp)->c_fid, &invalfid,
- sizeof(CodaFid)) != 0 || mi->mi_started == 0)
- { /* Found valid root. */
- *vpp = mi->mi_rootvp;
- mi->mi_started = 1;
-
- /* On Mach, this is vref. On NetBSD, VOP_LOCK */
-#if 1
- vref(*vpp);
- vn_lock(*vpp, LK_EXCLUSIVE, td);
-#else
- vget(*vpp, LK_EXCLUSIVE, td);
-#endif
- MARK_INT_SAT(CODA_ROOT_STATS);
- return(0);
- }
- }
-
- error = venus_root(vftomi(vfsp), td->td_ucred, p, &VFid);
-
- if (!error) {
- /*
- * Save the new rootfid in the cnode, and rehash the cnode into the
- * cnode hash with the new fid key.
- */
- coda_unsave(VTOC(mi->mi_rootvp));
- VTOC(mi->mi_rootvp)->c_fid = VFid;
- coda_save(VTOC(mi->mi_rootvp));
-
- *vpp = mi->mi_rootvp;
-#if 1
- vref(*vpp);
- vn_lock(*vpp, LK_EXCLUSIVE, td);
-#else
- vget(*vpp, LK_EXCLUSIVE, td);
-#endif
-
- MARK_INT_SAT(CODA_ROOT_STATS);
- goto exit;
- } else if (error == ENODEV || error == EINTR) {
- /* Gross hack here! */
- /*
- * If Venus fails to respond to the CODA_ROOT call, coda_call returns
- * ENODEV. Return the uninitialized root vnode to allow vfs
- * operations such as unmount to continue. Without this hack,
- * there is no way to do an unmount if Venus dies before a
- * successful CODA_ROOT call is done. All vnode operations
- * will fail.
- */
- *vpp = mi->mi_rootvp;
-#if 1
- vref(*vpp);
- vn_lock(*vpp, LK_EXCLUSIVE, td);
-#else
- vget(*vpp, LK_EXCLUSIVE, td);
-#endif
-
- MARK_INT_FAIL(CODA_ROOT_STATS);
- error = 0;
- goto exit;
- } else {
- CODADEBUG( CODA_ROOT, myprintf(("error %d in CODA_ROOT\n", error)); );
- MARK_INT_FAIL(CODA_ROOT_STATS);
-
- goto exit;
- }
-
- exit:
- return(error);
-}
-
-/*
- * Get filesystem statistics.
- */
-int
-coda_nb_statfs(vfsp, sbp, td)
- register struct mount *vfsp;
- struct statfs *sbp;
- struct thread *td;
-{
- ENTRY;
-/* MARK_ENTRY(CODA_STATFS_STATS); */
- if (!CODA_MOUNTED(vfsp)) {
-/* MARK_INT_FAIL(CODA_STATFS_STATS);*/
- return(EINVAL);
- }
-
- bzero(sbp, sizeof(struct statfs));
- /* XXX - what to do about f_flags, others? --bnoble */
- /* Below This is what AFS does
- #define NB_SFS_SIZ 0x895440
- */
- /* Note: Normal fs's have a bsize of 0x400 == 1024 */
- sbp->f_type = vfsp->mnt_vfc->vfc_typenum;
- sbp->f_bsize = 8192; /* XXX */
- sbp->f_iosize = 8192; /* XXX */
-#define NB_SFS_SIZ 0x8AB75D
- sbp->f_blocks = NB_SFS_SIZ;
- sbp->f_bfree = NB_SFS_SIZ;
- sbp->f_bavail = NB_SFS_SIZ;
- sbp->f_files = NB_SFS_SIZ;
- sbp->f_ffree = NB_SFS_SIZ;
- bcopy((caddr_t)&(vfsp->mnt_stat.f_fsid), (caddr_t)&(sbp->f_fsid), sizeof (fsid_t));
- snprintf(sbp->f_mntonname, sizeof(sbp->f_mntonname), "/coda");
- snprintf(sbp->f_fstypename, sizeof(sbp->f_fstypename), "coda");
-/* MARK_INT_SAT(CODA_STATFS_STATS); */
- return(0);
-}
-
-/*
- * Flush any pending I/O.
- */
-int
-coda_sync(vfsp, waitfor, td)
- struct mount *vfsp;
- int waitfor;
- struct thread *td;
-{
- ENTRY;
- MARK_ENTRY(CODA_SYNC_STATS);
- MARK_INT_SAT(CODA_SYNC_STATS);
- return(0);
-}
-
-/*
- * fhtovp is now what vget used to be in 4.3-derived systems. For
- * some silly reason, vget is now keyed by a 32 bit ino_t, rather than
- * a type-specific fid.
- */
-int
-coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp)
- register struct mount *vfsp;
- struct fid *fhp;
- struct mbuf *nam;
- struct vnode **vpp;
- int *exflagsp;
- struct ucred **creadanonp;
-{
- struct cfid *cfid = (struct cfid *)fhp;
- struct cnode *cp = 0;
- int error;
- struct thread *td = curthread; /* XXX -mach */
- struct proc *p = td->td_proc;
- CodaFid VFid;
- int vtype;
-
- ENTRY;
-
- MARK_ENTRY(CODA_VGET_STATS);
- /* Check for vget of control object. */
- if (IS_CTL_FID(&cfid->cfid_fid)) {
- *vpp = coda_ctlvp;
- vref(coda_ctlvp);
- MARK_INT_SAT(CODA_VGET_STATS);
- return(0);
- }
-
- error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, td->td_ucred, p, &VFid, &vtype);
-
- if (error) {
- CODADEBUG(CODA_VGET, myprintf(("vget error %d\n",error));)
- *vpp = (struct vnode *)0;
- } else {
- CODADEBUG(CODA_VGET,
- myprintf(("vget: %s type %d result %d\n",
- coda_f2s(&VFid), vtype, error)); )
- cp = make_coda_node(&VFid, vfsp, vtype);
- *vpp = CTOV(cp);
- }
- return(error);
-}
-
-/*
- * To allow for greater ease of use, some vnodes may be orphaned when
- * Venus dies. Certain operations should still be allowed to go
- * through, but without propagating ophan-ness. So this function will
- * get a new vnode for the file from the current run of Venus. */
-
-int
-getNewVnode(vpp)
- struct vnode **vpp;
-{
- struct cfid cfid;
- struct coda_mntinfo *mi = vftomi((*vpp)->v_mount);
-
- ENTRY;
-
- cfid.cfid_len = (short)sizeof(CodaFid);
- cfid.cfid_fid = VTOC(*vpp)->c_fid; /* Structure assignment. */
- /* XXX ? */
-
- /* We're guessing that if set, the 1st element on the list is a
- * valid vnode to use. If not, return ENODEV as venus is dead.
- */
- if (mi->mi_vfsp == NULL)
- return ENODEV;
-
- return coda_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp,
- NULL, NULL);
-}
-
-#include <ufs/ufs/extattr.h>
-#include <ufs/ufs/quota.h>
-#include <ufs/ufs/ufsmount.h>
-/* get the mount structure corresponding to a given device. Assume
- * device corresponds to a UFS. Return NULL if no device is found.
- */
-struct mount *devtomp(dev)
- struct cdev *dev;
-{
- struct mount *mp;
-
- TAILQ_FOREACH(mp, &mountlist, mnt_list) {
- if (((VFSTOUFS(mp))->um_dev == dev)) {
- /* mount corresponds to UFS and the device matches one we want */
- return(mp);
- }
- }
- /* mount structure wasn't found */
- return(NULL);
-}
-
-struct vfsops coda_vfsops = {
- .vfs_mount = coda_mount,
- .vfs_root = coda_root,
- .vfs_statfs = coda_nb_statfs,
- .vfs_sync = coda_sync,
- .vfs_unmount = coda_unmount,
-};
-
-VFS_SET(coda_vfsops, coda, VFCF_NETWORK);
diff --git a/sys/fs/coda/coda_vfsops.h b/sys/fs/coda/coda_vfsops.h
deleted file mode 100644
index 8a66545..0000000
--- a/sys/fs/coda/coda_vfsops.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/cfs/coda_vfsops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-/*
- * cfid structure:
- * This overlays the fid structure (see vfs.h)
- * Only used below and will probably go away.
- */
-
-struct cfid {
- u_short cfid_len;
- u_short padding;
- CodaFid cfid_fid;
-};
-
-struct mbuf;
-struct mount;
-
-int coda_vfsopstats_init(void);
-int coda_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **,
- int *, struct ucred **);
-
-vfs_mount_t coda_mount;
-vfs_unmount_t coda_unmount;
-vfs_root_t coda_root;
-vfs_quotactl_t coda_quotactl;
-vfs_statfs_t coda_nb_statfs;
-vfs_sync_t coda_sync;
-vfs_vget_t coda_vget;
-vfs_vptofh_t coda_vptofh;
-vfs_init_t coda_init;
-
-int getNewVnode(struct vnode **vpp);
diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c
deleted file mode 100644
index a6f6e1a..0000000
--- a/sys/fs/coda/coda_vnops.c
+++ /dev/null
@@ -1,1845 +0,0 @@
-/*-
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- */
-/*
- * Mach Operating System
- * Copyright (c) 1990 Carnegie-Mellon University
- * Copyright (c) 1989 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * This code was written for the Coda filesystem at Carnegie Mellon
- * University. Contributers include David Steere, James Kistler, and
- * M. Satyanarayanan.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/acct.h>
-#include <sys/errno.h>
-#include <sys/fcntl.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/file.h> /* Must come after sys/malloc.h */
-#include <sys/mount.h>
-#include <sys/mutex.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
-#include <sys/uio.h>
-#include <sys/unistd.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/vm_extern.h>
-
-#include <coda/coda.h>
-#include <coda/cnode.h>
-#include <coda/coda_vnops.h>
-#include <coda/coda_venus.h>
-#include <coda/coda_opstats.h>
-#include <coda/coda_subr.h>
-#include <coda/coda_namecache.h>
-#include <coda/coda_pioctl.h>
-
-/*
- * These flags select various performance enhancements.
- */
-int coda_attr_cache = 1; /* Set to cache attributes in the kernel */
-int coda_symlink_cache = 1; /* Set to cache symbolic link information */
-int coda_access_cache = 1; /* Set to handle some access checks directly */
-
-/* structure to keep track of vfs calls */
-
-struct coda_op_stats coda_vnodeopstats[CODA_VNODEOPS_SIZE];
-
-#define MARK_ENTRY(op) (coda_vnodeopstats[op].entries++)
-#define MARK_INT_SAT(op) (coda_vnodeopstats[op].sat_intrn++)
-#define MARK_INT_FAIL(op) (coda_vnodeopstats[op].unsat_intrn++)
-#define MARK_INT_GEN(op) (coda_vnodeopstats[op].gen_intrn++)
-
-/* What we are delaying for in printf */
-int coda_printf_delay = 0; /* in microseconds */
-int coda_vnop_print_entry = 0;
-static int coda_lockdebug = 0;
-
-/*
- * Some NetBSD details:
- *
- * coda_start is called at the end of the mount syscall.
- * coda_init is called at boot time.
- */
-
-#define ENTRY if(coda_vnop_print_entry) myprintf(("Entered %s\n",__func__))
-
-/* Definition of the vnode operation vector */
-
-struct vop_vector coda_vnodeops = {
- .vop_default = VOP_PANIC,
- .vop_lookup = coda_lookup, /* lookup */
- .vop_create = coda_create, /* create */
- .vop_mknod = VOP_PANIC, /* mknod */
- .vop_open = coda_open, /* open */
- .vop_close = coda_close, /* close */
- .vop_access = coda_access, /* access */
- .vop_getattr = coda_getattr, /* getattr */
- .vop_setattr = coda_setattr, /* setattr */
- .vop_read = coda_read, /* read */
- .vop_write = coda_write, /* write */
- .vop_ioctl = coda_ioctl, /* ioctl */
- .vop_fsync = coda_fsync, /* fsync */
- .vop_remove = coda_remove, /* remove */
- .vop_link = coda_link, /* link */
- .vop_rename = coda_rename, /* rename */
- .vop_mkdir = coda_mkdir, /* mkdir */
- .vop_rmdir = coda_rmdir, /* rmdir */
- .vop_symlink = coda_symlink, /* symlink */
- .vop_readdir = coda_readdir, /* readdir */
- .vop_readlink = coda_readlink, /* readlink */
- .vop_inactive = coda_inactive, /* inactive */
- .vop_reclaim = coda_reclaim, /* reclaim */
- .vop_lock = coda_lock, /* lock */
- .vop_unlock = coda_unlock, /* unlock */
- .vop_bmap = coda_bmap, /* bmap */
- .vop_print = VOP_PANIC, /* print */
- .vop_islocked = coda_islocked, /* islocked */
- .vop_pathconf = coda_pathconf, /* pathconf */
- .vop_advlock = VOP_NULL, /* advlock */
- .vop_lease = VOP_NULL, /* lease */
- .vop_poll = vop_stdpoll,
- .vop_getpages = vop_stdgetpages, /* pager intf.*/
- .vop_putpages = vop_stdputpages, /* pager intf.*/
- .vop_getwritemount = vop_stdgetwritemount,
-
-#if 0
- missing
- .vop_cachedlookup = ufs_lookup,
- .vop_whiteout = ufs_whiteout,
-#endif
-
-};
-
-/* A generic do-nothing. For lease_check, advlock */
-int
-coda_vop_nop(void *anon) {
- struct vnodeop_desc **desc = (struct vnodeop_desc **)anon;
-
- if (codadebug) {
- myprintf(("Vnode operation %s called, but unsupported\n",
- (*desc)->vdesc_name));
- }
- return (0);
-}
-
-int
-coda_vnodeopstats_init(void)
-{
- register int i;
-
- for(i=0;i<CODA_VNODEOPS_SIZE;i++) {
- coda_vnodeopstats[i].opcode = i;
- coda_vnodeopstats[i].entries = 0;
- coda_vnodeopstats[i].sat_intrn = 0;
- coda_vnodeopstats[i].unsat_intrn = 0;
- coda_vnodeopstats[i].gen_intrn = 0;
- }
- return 0;
-}
-
-/*
- * coda_open calls Venus to return the device, inode pair of the cache
- * file holding the data. Using iget, coda_open finds the vnode of the
- * cache file, and then opens it.
- */
-int
-coda_open(struct vop_open_args *ap)
-{
- /*
- * NetBSD can pass the O_EXCL flag in mode, even though the check
- * has already happened. Venus defensively assumes that if open
- * is passed the EXCL, it must be a bug. We strip the flag here.
- */
-/* true args */
- register struct vnode **vpp = &(ap->a_vp);
- struct cnode *cp = VTOC(*vpp);
- int flag = ap->a_mode & (~O_EXCL);
- struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
-/* locals */
- int error;
- struct vnode *vp;
- struct cdev *dev;
- ino_t inode;
-
- MARK_ENTRY(CODA_OPEN_STATS);
-
- /* Check for open of control file. */
- if (IS_CTL_VP(*vpp)) {
- /* XXX */
- /* if (WRITEABLE(flag)) */
- if (flag & (FWRITE | O_TRUNC | O_CREAT | O_EXCL)) {
- MARK_INT_FAIL(CODA_OPEN_STATS);
- return(EACCES);
- }
- MARK_INT_SAT(CODA_OPEN_STATS);
- return(0);
- }
-
- error = venus_open(vtomi((*vpp)), &cp->c_fid, flag, cred, td->td_proc, &dev, &inode);
- if (error)
- return (error);
- if (!error) {
- CODADEBUG( CODA_OPEN,myprintf(("open: dev %#lx inode %lu result %d\n",
- (u_long)dev2udev(dev), (u_long)inode,
- error)); )
- }
-
- /* Translate the <device, inode> pair for the cache file into
- an inode pointer. */
- error = coda_grab_vnode(dev, inode, &vp);
- if (error)
- return (error);
-
- /* We get the vnode back locked. Needs unlocked */
- VOP_UNLOCK(vp, 0, td);
- /* Keep a reference until the close comes in. */
- vref(*vpp);
-
- /* Save the vnode pointer for the cache file. */
- if (cp->c_ovp == NULL) {
- cp->c_ovp = vp;
- } else {
- if (cp->c_ovp != vp)
- panic("coda_open: cp->c_ovp != ITOV(ip)");
- }
- cp->c_ocount++;
-
- /* Flush the attribute cached if writing the file. */
- if (flag & FWRITE) {
- cp->c_owrite++;
- cp->c_flags &= ~C_VATTR;
- }
-
- /* Save the <device, inode> pair for the cache file to speed
- up subsequent page_read's. */
- cp->c_device = dev;
- cp->c_inode = inode;
-
- /* Open the cache file. */
- error = VOP_OPEN(vp, flag, cred, td, -1);
- if (error) {
- printf("coda_open: VOP_OPEN on container failed %d\n", error);
- return (error);
- }
-/* grab (above) does this when it calls newvnode unless it's in the cache*/
-
- return(error);
-}
-
-/*
- * Close the cache file used for I/O and notify Venus.
- */
-int
-coda_close(struct vop_close_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- int flag = ap->a_fflag;
- struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
-/* locals */
- int error;
-
- MARK_ENTRY(CODA_CLOSE_STATS);
-
- /* Check for close of control file. */
- if (IS_CTL_VP(vp)) {
- MARK_INT_SAT(CODA_CLOSE_STATS);
- return(0);
- }
-
- if (IS_UNMOUNTING(cp)) {
- if (cp->c_ovp) {
-#ifdef CODA_VERBOSE
- printf("coda_close: destroying container ref %d, ufs vp %p of vp %p/cp %p\n",
- vrefcnt(vp), cp->c_ovp, vp, cp);
-#endif
-#ifdef hmm
- vgone(cp->c_ovp);
-#else
- VOP_CLOSE(cp->c_ovp, flag, cred, td); /* Do errors matter here? */
- vrele(cp->c_ovp);
-#endif
- } else {
-#ifdef CODA_VERBOSE
- printf("coda_close: NO container vp %p/cp %p\n", vp, cp);
-#endif
- }
- return ENODEV;
- } else {
- VOP_CLOSE(cp->c_ovp, flag, cred, td); /* Do errors matter here? */
- vrele(cp->c_ovp);
- }
-
- if (--cp->c_ocount == 0)
- cp->c_ovp = NULL;
-
- if (flag & FWRITE) /* file was opened for write */
- --cp->c_owrite;
-
- error = venus_close(vtomi(vp), &cp->c_fid, flag, cred, td->td_proc);
- vrele(CTOV(cp));
-
- CODADEBUG(CODA_CLOSE, myprintf(("close: result %d\n",error)); )
- return(error);
-}
-
-int
-coda_read(struct vop_read_args *ap)
-{
-
- ENTRY;
- return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_READ,
- ap->a_ioflag, ap->a_cred, ap->a_uio->uio_td));
-}
-
-int
-coda_write(struct vop_write_args *ap)
-{
-
- ENTRY;
- return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE,
- ap->a_ioflag, ap->a_cred, ap->a_uio->uio_td));
-}
-
-int
-coda_rdwr(vp, uiop, rw, ioflag, cred, td)
- struct vnode *vp;
- struct uio *uiop;
- enum uio_rw rw;
- int ioflag;
- struct ucred *cred;
- struct thread *td;
-{
-/* upcall decl */
- /* NOTE: container file operation!!! */
-/* locals */
- struct cnode *cp = VTOC(vp);
- struct vnode *cfvp = cp->c_ovp;
- struct proc *p = td->td_proc;
- struct thread *ltd = td;
- int igot_internally = 0;
- int opened_internally = 0;
- int error = 0;
- int iscore = 0;
-
- MARK_ENTRY(CODA_RDWR_STATS);
-
- CODADEBUG(CODA_RDWR, myprintf(("coda_rdwr(%d, %p, %d, %lld, %d)\n", rw,
- (void *)uiop->uio_iov->iov_base, uiop->uio_resid,
- (long long)uiop->uio_offset, uiop->uio_segflg)); )
-
- /* Check for rdwr of control object. */
- if (IS_CTL_VP(vp)) {
- MARK_INT_FAIL(CODA_RDWR_STATS);
- return(EINVAL);
- }
-
- /*
- * If file is not already open this must be a page
- * {read,write} request. Iget the cache file's inode
- * pointer if we still have its <device, inode> pair.
- * Otherwise, we must do an internal open to derive the
- * pair.
- */
- if (cfvp == NULL) {
- /*
- * If we're dumping core, do the internal open. Otherwise
- * venus won't have the correct size of the core when
- * it's completely written.
- */
- if (p) {
- PROC_LOCK(p);
- iscore = (p->p_acflag & ACORE);
- PROC_UNLOCK(p);
- }
- else
- ltd = curthread;
-
- if (cp->c_inode != 0 && !iscore) {
- igot_internally = 1;
- error = coda_grab_vnode(cp->c_device, cp->c_inode, &cfvp);
- if (error) {
- MARK_INT_FAIL(CODA_RDWR_STATS);
- return(error);
- }
- /*
- * We get the vnode back locked by curthread in both Mach and
- * NetBSD. Needs unlocked
- */
- VOP_UNLOCK(cfvp, 0, ltd);
- }
- else {
- opened_internally = 1;
- MARK_INT_GEN(CODA_OPEN_STATS);
- error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE),
- cred, td, -1);
-printf("coda_rdwr: Internally Opening %p\n", vp);
- if (error) {
- printf("coda_rdwr: VOP_OPEN on container failed %d\n", error);
- return (error);
- }
- cfvp = cp->c_ovp;
- }
- }
-
- /* Have UFS handle the call. */
- CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = %s, refcnt = %d\n",
- coda_f2s(&cp->c_fid), CTOV(cp)->v_usecount)); )
- if (rw == UIO_READ) {
- error = VOP_READ(cfvp, uiop, ioflag, cred);
- } else {
- error = VOP_WRITE(cfvp, uiop, ioflag, cred);
- /* ufs_write updates the vnode_pager_setsize for the vnode/object */
-
- { struct vattr attr;
-
- if (VOP_GETATTR(cfvp, &attr, cred, td) == 0) {
- vnode_pager_setsize(vp, attr.va_size);
- }
- }
- }
-
- if (error)
- MARK_INT_FAIL(CODA_RDWR_STATS);
- else
- MARK_INT_SAT(CODA_RDWR_STATS);
-
- /* Do an internal close if necessary. */
- if (opened_internally) {
- MARK_INT_GEN(CODA_CLOSE_STATS);
- (void)VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, td);
- }
-
- /* Invalidate cached attributes if writing. */
- if (rw == UIO_WRITE)
- cp->c_flags &= ~C_VATTR;
- return(error);
-}
-
-
-
-int
-coda_ioctl(struct vop_ioctl_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- int com = ap->a_command;
- caddr_t data = ap->a_data;
- int flag = ap->a_fflag;
- struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
-/* locals */
- int error;
- struct vnode *tvp;
- struct nameidata ndp;
- struct PioctlData *iap = (struct PioctlData *)data;
-
- MARK_ENTRY(CODA_IOCTL_STATS);
-
- CODADEBUG(CODA_IOCTL, myprintf(("in coda_ioctl on %s\n", iap->path));)
-
- /* Don't check for operation on a dying object, for ctlvp it
- shouldn't matter */
-
- /* Must be control object to succeed. */
- if (!IS_CTL_VP(vp)) {
- MARK_INT_FAIL(CODA_IOCTL_STATS);
- CODADEBUG(CODA_IOCTL, myprintf(("coda_ioctl error: vp != ctlvp"));)
- return (EOPNOTSUPP);
- }
- /* Look up the pathname. */
-
- /* Should we use the name cache here? It would get it from
- lookupname sooner or later anyway, right? */
-
- NDINIT(&ndp, LOOKUP, (iap->follow ? FOLLOW : NOFOLLOW), UIO_USERSPACE, iap->path, td);
- error = namei(&ndp);
- tvp = ndp.ni_vp;
-
- if (error) {
- MARK_INT_FAIL(CODA_IOCTL_STATS);
- CODADEBUG(CODA_IOCTL, myprintf(("coda_ioctl error: lookup returns %d\n",
- error));)
- return(error);
- }
-
- /*
- * Make sure this is a coda style cnode, but it may be a
- * different vfsp
- */
- if (tvp->v_op != &coda_vnodeops) {
- vrele(tvp);
- NDFREE(&ndp, NDF_ONLY_PNBUF);
- MARK_INT_FAIL(CODA_IOCTL_STATS);
- CODADEBUG(CODA_IOCTL,
- myprintf(("coda_ioctl error: %s not a coda object\n",
- iap->path));)
- return(EINVAL);
- }
-
- if (iap->vi.in_size > VC_MAXDATASIZE) {
- NDFREE(&ndp, 0);
- return(EINVAL);
- }
- error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, td->td_proc);
-
- if (error)
- MARK_INT_FAIL(CODA_IOCTL_STATS);
- else
- CODADEBUG(CODA_IOCTL, myprintf(("Ioctl returns %d \n", error)); )
-
- vrele(tvp);
- NDFREE(&ndp, NDF_ONLY_PNBUF);
- return(error);
-}
-
-/*
- * To reduce the cost of a user-level venus;we cache attributes in
- * the kernel. Each cnode has storage allocated for an attribute. If
- * c_vattr is valid, return a reference to it. Otherwise, get the
- * attributes from venus and store them in the cnode. There is some
- * question if this method is a security leak. But I think that in
- * order to make this call, the user must have done a lookup and
- * opened the file, and therefore should already have access.
- */
-int
-coda_getattr(struct vop_getattr_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- struct vattr *vap = ap->a_vap;
- struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
-/* locals */
- int error;
-
- MARK_ENTRY(CODA_GETATTR_STATS);
-
- if (IS_UNMOUNTING(cp))
- return ENODEV;
-
- /* Check for getattr of control object. */
- if (IS_CTL_VP(vp)) {
- MARK_INT_FAIL(CODA_GETATTR_STATS);
- return(ENOENT);
- }
-
- /* Check to see if the attributes have already been cached */
- if (VALID_VATTR(cp)) {
- CODADEBUG(CODA_GETATTR, { myprintf(("attr cache hit: %s\n",
- coda_f2s(&cp->c_fid)));});
- CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR))
- print_vattr(&cp->c_vattr); );
-
- *vap = cp->c_vattr;
- MARK_INT_SAT(CODA_GETATTR_STATS);
- return(0);
- }
-
- error = venus_getattr(vtomi(vp), &cp->c_fid, cred, td->td_proc, vap);
-
- if (!error) {
- CODADEBUG(CODA_GETATTR, myprintf(("getattr miss %s: result %d\n",
- coda_f2s(&cp->c_fid), error)); )
-
- CODADEBUG(CODA_GETATTR, if (!(codadebug & ~CODA_GETATTR))
- print_vattr(vap); );
-
- { int size = vap->va_size;
- struct vnode *convp = cp->c_ovp;
- if (convp != (struct vnode *)0) {
- vnode_pager_setsize(convp, size);
- }
- }
- /* If not open for write, store attributes in cnode */
- if ((cp->c_owrite == 0) && (coda_attr_cache)) {
- cp->c_vattr = *vap;
- cp->c_flags |= C_VATTR;
- }
-
- }
- return(error);
-}
-
-int
-coda_setattr(struct vop_setattr_args *ap)
-{
-/* true args */
- register struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- register struct vattr *vap = ap->a_vap;
- struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
-/* locals */
- int error;
-
- MARK_ENTRY(CODA_SETATTR_STATS);
-
- /* Check for setattr of control object. */
- if (IS_CTL_VP(vp)) {
- MARK_INT_FAIL(CODA_SETATTR_STATS);
- return(ENOENT);
- }
-
- if (codadebug & CODADBGMSK(CODA_SETATTR)) {
- print_vattr(vap);
- }
- error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred, td->td_proc);
-
- if (!error)
- cp->c_flags &= ~C_VATTR;
-
- { int size = vap->va_size;
- struct vnode *convp = cp->c_ovp;
- if (size != VNOVAL && convp != (struct vnode *)0) {
- vnode_pager_setsize(convp, size);
- }
- }
- CODADEBUG(CODA_SETATTR, myprintf(("setattr %d\n", error)); )
- return(error);
-}
-
-int
-coda_access(struct vop_access_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- int mode = ap->a_mode;
- struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_td;
-/* locals */
- int error;
-
- MARK_ENTRY(CODA_ACCESS_STATS);
-
- /* Check for access of control object. Only read access is
- allowed on it. */
- if (IS_CTL_VP(vp)) {
- /* bogus hack - all will be marked as successes */
- MARK_INT_SAT(CODA_ACCESS_STATS);
- return(((mode & VREAD) && !(mode & (VWRITE | VEXEC)))
- ? 0 : EACCES);
- }
-
- /*
- * if the file is a directory, and we are checking exec (eg lookup)
- * access, and the file is in the namecache, then the user must have
- * lookup access to it.
- */
- if (coda_access_cache) {
- if ((vp->v_type == VDIR) && (mode & VEXEC)) {
- if (coda_nc_lookup(cp, ".", 1, cred)) {
- MARK_INT_SAT(CODA_ACCESS_STATS);
- return(0); /* it was in the cache */
- }
- }
- }
-
- error = venus_access(vtomi(vp), &cp->c_fid, mode, cred, td->td_proc);
-
- return(error);
-}
-
-int
-coda_readlink(struct vop_readlink_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- struct uio *uiop = ap->a_uio;
- struct ucred *cred = ap->a_cred;
- struct thread *td = ap->a_uio->uio_td;
-/* locals */
- int error;
- char *str;
- int len;
-
- MARK_ENTRY(CODA_READLINK_STATS);
-
- /* Check for readlink of control object. */
- if (IS_CTL_VP(vp)) {
- MARK_INT_FAIL(CODA_READLINK_STATS);
- return(ENOENT);
- }
-
- if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) { /* symlink was cached */
- uiop->uio_rw = UIO_READ;
- error = uiomove(cp->c_symlink, (int)cp->c_symlen, uiop);
- if (error)
- MARK_INT_FAIL(CODA_READLINK_STATS);
- else
- MARK_INT_SAT(CODA_READLINK_STATS);
- return(error);
- }
-
- error = venus_readlink(vtomi(vp), &cp->c_fid, cred,
- td != NULL ? td->td_proc : NULL, &str, &len);
-
- if (!error) {
- uiop->uio_rw = UIO_READ;
- error = uiomove(str, len, uiop);
-
- if (coda_symlink_cache) {
- cp->c_symlink = str;
- cp->c_symlen = len;
- cp->c_flags |= C_SYMLINK;
- } else
- CODA_FREE(str, len);
- }
-
- CODADEBUG(CODA_READLINK, myprintf(("in readlink result %d\n",error));)
- return(error);
-}
-
-int
-coda_fsync(struct vop_fsync_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- struct thread *td = ap->a_td;
-/* locals */
- struct vnode *convp = cp->c_ovp;
- int error;
-
- MARK_ENTRY(CODA_FSYNC_STATS);
-
- /* Check for fsync on an unmounting object */
- /* The NetBSD kernel, in it's infinite wisdom, can try to fsync
- * after an unmount has been initiated. This is a Bad Thing,
- * which we have to avoid. Not a legitimate failure for stats.
- */
- if (IS_UNMOUNTING(cp)) {
- return(ENODEV);
- }
-
- /* Check for fsync of control object. */
- if (IS_CTL_VP(vp)) {
- MARK_INT_SAT(CODA_FSYNC_STATS);
- return(0);
- }
-
- if (convp)
- VOP_FSYNC(convp, MNT_WAIT, td);
-
- /*
- * We see fsyncs with usecount == 1 then usecount == 0.
- * For now we ignore them.
- */
- /*
- VI_LOCK(vp);
- if (!vp->v_usecount) {
- printf("coda_fsync on vnode %p with %d usecount. c_flags = %x (%x)\n",
- vp, vp->v_usecount, cp->c_flags, cp->c_flags&C_PURGING);
- }
- VI_UNLOCK(vp);
- */
-
- /*
- * We can expect fsync on any vnode at all if venus is pruging it.
- * Venus can't very well answer the fsync request, now can it?
- * Hopefully, it won't have to, because hopefully, venus preserves
- * the (possibly untrue) invariant that it never purges an open
- * vnode. Hopefully.
- */
- if (cp->c_flags & C_PURGING) {
- return(0);
- }
-
- /* needs research */
- return 0;
- error = venus_fsync(vtomi(vp), &cp->c_fid, td->td_proc);
-
- CODADEBUG(CODA_FSYNC, myprintf(("in fsync result %d\n",error)); );
- return(error);
-}
-
-int
-coda_inactive(struct vop_inactive_args *ap)
-{
- /* XXX - at the moment, inactive doesn't look at cred, and doesn't
- have a proc pointer. Oops. */
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- struct ucred *cred __attribute__((unused)) = NULL;
- struct thread *td __attribute__((unused)) = curthread;
-/* upcall decl */
-/* locals */
-
- /* We don't need to send inactive to venus - DCS */
- MARK_ENTRY(CODA_INACTIVE_STATS);
-
- if (IS_CTL_VP(vp)) {
- MARK_INT_SAT(CODA_INACTIVE_STATS);
- return 0;
- }
-
- CODADEBUG(CODA_INACTIVE, myprintf(("in inactive, %s, vfsp %p\n",
- coda_f2s(&cp->c_fid), vp->v_mount));)
-
- /* If an array has been allocated to hold the symlink, deallocate it */
- if ((coda_symlink_cache) && (VALID_SYMLINK(cp))) {
- if (cp->c_symlink == NULL)
- panic("coda_inactive: null symlink pointer in cnode");
-
- CODA_FREE(cp->c_symlink, cp->c_symlen);
- cp->c_flags &= ~C_SYMLINK;
- cp->c_symlen = 0;
- }
-
- /* Remove it from the table so it can't be found. */
- coda_unsave(cp);
- if ((struct coda_mntinfo *)(vp->v_mount->mnt_data) == NULL) {
- myprintf(("Help! vfsp->vfs_data was NULL, but vnode %p wasn't dying\n", vp));
- panic("badness in coda_inactive\n");
- }
-
- if (IS_UNMOUNTING(cp)) {
-#ifdef DEBUG
- printf("coda_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vrefcnt(vp), vp, cp);
- if (cp->c_ovp != NULL)
- printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n",
- vrefcnt(vp), vp, cp);
-#endif
- } else {
-#ifdef OLD_DIAGNOSTIC
- if (vrefcnt(CTOV(cp))) {
- panic("coda_inactive: nonzero reference count");
- }
- if (cp->c_ovp != NULL) {
- panic("coda_inactive: cp->ovp != NULL");
- }
-#endif
- vgone(vp);
- }
-
- MARK_INT_SAT(CODA_INACTIVE_STATS);
- return(0);
-}
-
-/*
- * Remote filesystem operations having to do with directory manipulation.
- */
-
-/*
- * It appears that in NetBSD, lookup is supposed to return the vnode locked
- */
-int
-coda_lookup(struct vop_lookup_args *ap)
-{
-/* true args */
- struct vnode *dvp = ap->a_dvp;
- struct cnode *dcp = VTOC(dvp);
- struct vnode **vpp = ap->a_vpp;
- /*
- * It looks as though ap->a_cnp->ni_cnd->cn_nameptr holds the rest
- * of the string to xlate, and that we must try to get at least
- * ap->a_cnp->ni_cnd->cn_namelen of those characters to macth. I
- * could be wrong.
- */
- struct componentname *cnp = ap->a_cnp;
- struct ucred *cred = cnp->cn_cred;
- struct thread *td = cnp->cn_thread;
-/* locals */
- struct cnode *cp;
- const char *nm = cnp->cn_nameptr;
- int len = cnp->cn_namelen;
- CodaFid VFid;
- int vtype;
- int error = 0;
-
- MARK_ENTRY(CODA_LOOKUP_STATS);
-
- CODADEBUG(CODA_LOOKUP, myprintf(("lookup: %s in %s\n",
- nm, coda_f2s(&dcp->c_fid))););
-
- /* Check for lookup of control object. */
- if (IS_CTL_NAME(dvp, nm, len)) {
- *vpp = coda_ctlvp;
- vref(*vpp);
- MARK_INT_SAT(CODA_LOOKUP_STATS);
- goto exit;
- }
-
- if (len+1 > CODA_MAXNAMLEN) {
- MARK_INT_FAIL(CODA_LOOKUP_STATS);
-
- CODADEBUG(CODA_LOOKUP, myprintf(("name too long: lookup, %s (%s)\n",
- coda_f2s(&dcp->c_fid), nm)););
- *vpp = (struct vnode *)0;
- error = EINVAL;
- goto exit;
- }
- /* First try to look the file up in the cfs name cache */
- /* lock the parent vnode? */
- cp = coda_nc_lookup(dcp, nm, len, cred);
- if (cp) {
- *vpp = CTOV(cp);
- vref(*vpp);
- CODADEBUG(CODA_LOOKUP,
- myprintf(("lookup result %d vpp %p\n",error,*vpp));)
- } else {
-
- /* The name wasn't cached, so we need to contact Venus */
- error = venus_lookup(vtomi(dvp), &dcp->c_fid, nm, len, cred, td->td_proc, &VFid, &vtype);
-
- if (error) {
- MARK_INT_FAIL(CODA_LOOKUP_STATS);
-
- CODADEBUG(CODA_LOOKUP, myprintf(("lookup error on %s (%s)%d\n",
- coda_f2s(&dcp->c_fid), nm, error));)
- *vpp = (struct vnode *)0;
- } else {
- MARK_INT_SAT(CODA_LOOKUP_STATS);
- CODADEBUG(CODA_LOOKUP,
- myprintf(("lookup: %s type %o result %d\n",
- coda_f2s(&VFid), vtype, error)); )
- cp = make_coda_node(&VFid, dvp->v_mount, vtype);
- *vpp = CTOV(cp);
-
- /* enter the new vnode in the Name Cache only if the top bit isn't set */
- /* And don't enter a new vnode for an invalid one! */
- if (!(vtype & CODA_NOCACHE))
- coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp));
- }
- }
-
- exit:
- /*
- * If we are creating, and this was the last name to be looked up,
- * and the error was ENOENT, then there really shouldn't be an
- * error and we can make the leaf NULL and return success. Since
- * this is supposed to work under Mach as well as NetBSD, we're
- * leaving this fn wrapped. We also must tell lookup/namei that
- * we need to save the last component of the name. (Create will
- * have to free the name buffer later...lucky us...)
- */
- if (((cnp->cn_nameiop == CREATE) || (cnp->cn_nameiop == RENAME))
- && (cnp->cn_flags & ISLASTCN)
- && (error == ENOENT))
- {
- error = EJUSTRETURN;
- cnp->cn_flags |= SAVENAME;
- *ap->a_vpp = NULL;
- }
-
- /*
- * If we are removing, and we are at the last element, and we
- * found it, then we need to keep the name around so that the
- * removal will go ahead as planned. Unfortunately, this will
- * probably also lock the to-be-removed vnode, which may or may
- * not be a good idea. I'll have to look at the bits of
- * coda_remove to make sure. We'll only save the name if we did in
- * fact find the name, otherwise coda_remove won't have a chance
- * to free the pathname.
- */
- if ((cnp->cn_nameiop == DELETE)
- && (cnp->cn_flags & ISLASTCN)
- && !error)
- {
- cnp->cn_flags |= SAVENAME;
- }
-
- /*
- * If the lookup went well, we need to (potentially?) unlock the
- * parent, and lock the child. We are only responsible for
- * checking to see if the parent is supposed to be unlocked before
- * we return. We must always lock the child (provided there is
- * one, and (the parent isn't locked or it isn't the same as the
- * parent.) Simple, huh? We can never leave the parent locked unless
- * we are ISLASTCN
- */
- if (!error || (error == EJUSTRETURN)) {
- if (cnp->cn_flags & ISDOTDOT) {
- if ((error = VOP_UNLOCK(dvp, 0, td))) {
- return error;
- }
- /*
- * The parent is unlocked. As long as there is a child,
- * lock it without bothering to check anything else.
- */
- if (*ap->a_vpp) {
- if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) {
- vn_lock(dvp, LK_RETRY|LK_EXCLUSIVE, td);
- return (error);
- }
- }
- vn_lock(dvp, LK_RETRY|LK_EXCLUSIVE, td);
- } else {
- /* The parent is locked, and may be the same as the child */
- if (*ap->a_vpp && (*ap->a_vpp != dvp)) {
- /* Different, go ahead and lock it. */
- if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) {
- return (error);
- }
- }
- }
- } else {
- /* If the lookup failed, we need to ensure that the leaf is NULL */
- /* Don't change any locking? */
- *ap->a_vpp = NULL;
- }
- return(error);
-}
-
-/*ARGSUSED*/
-int
-coda_create(struct vop_create_args *ap)
-{
-/* true args */
- struct vnode *dvp = ap->a_dvp;
- struct cnode *dcp = VTOC(dvp);
- struct vattr *va = ap->a_vap;
- int exclusive = 1;
- int mode = ap->a_vap->va_mode;
- struct vnode **vpp = ap->a_vpp;
- struct componentname *cnp = ap->a_cnp;
- struct ucred *cred = cnp->cn_cred;
- struct thread *td = cnp->cn_thread;
-/* locals */
- int error;
- struct cnode *cp;
- const char *nm = cnp->cn_nameptr;
- int len = cnp->cn_namelen;
- CodaFid VFid;
- struct vattr attr;
-
- MARK_ENTRY(CODA_CREATE_STATS);
-
- /* All creates are exclusive XXX */
- /* I'm assuming the 'mode' argument is the file mode bits XXX */
-
- /* Check for create of control object. */
- if (IS_CTL_NAME(dvp, nm, len)) {
- *vpp = (struct vnode *)0;
- MARK_INT_FAIL(CODA_CREATE_STATS);
- return(EACCES);
- }
-
- error = venus_create(vtomi(dvp), &dcp->c_fid, nm, len, exclusive, mode, va, cred, td->td_proc, &VFid, &attr);
-
- if (!error) {
-
- /* If this is an exclusive create, panic if the file already exists. */
- /* Venus should have detected the file and reported EEXIST. */
-
- if ((exclusive == 1) &&
- (coda_find(&VFid) != NULL))
- panic("cnode existed for newly created file!");
-
- cp = make_coda_node(&VFid, dvp->v_mount, attr.va_type);
- *vpp = CTOV(cp);
-
- /* Update va to reflect the new attributes. */
- (*va) = attr;
-
- /* Update the attribute cache and mark it as valid */
- if (coda_attr_cache) {
- VTOC(*vpp)->c_vattr = attr;
- VTOC(*vpp)->c_flags |= C_VATTR;
- }
-
- /* Invalidate the parent's attr cache, the modification time has changed */
- VTOC(dvp)->c_flags &= ~C_VATTR;
-
- /* enter the new vnode in the Name Cache */
- coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp));
-
- CODADEBUG(CODA_CREATE,
- myprintf(("create: %s, result %d\n",
- coda_f2s(&VFid), error)); )
- } else {
- *vpp = (struct vnode *)0;
- CODADEBUG(CODA_CREATE, myprintf(("create error %d\n", error));)
- }
-
- if (!error) {
- if (cnp->cn_flags & LOCKLEAF) {
- if ((error = VOP_LOCK(*ap->a_vpp, LK_EXCLUSIVE, td))) {
- printf("coda_create: ");
- panic("unlocked parent but couldn't lock child");
- }
- }
-#ifdef OLD_DIAGNOSTIC
- else {
- printf("coda_create: LOCKLEAF not set!\n");
- }
-#endif
- }
- return(error);
-}
-
-int
-coda_remove(struct vop_remove_args *ap)
-{
-/* true args */
- struct vnode *dvp = ap->a_dvp;
- struct cnode *cp = VTOC(dvp);
- struct componentname *cnp = ap->a_cnp;
- struct ucred *cred = cnp->cn_cred;
- struct thread *td = cnp->cn_thread;
-/* locals */
- int error;
- const char *nm = cnp->cn_nameptr;
- int len = cnp->cn_namelen;
- struct cnode *tp;
-
- MARK_ENTRY(CODA_REMOVE_STATS);
-
- CODADEBUG(CODA_REMOVE, myprintf(("remove: %s in %s\n",
- nm, coda_f2s(&cp->c_fid))););
- /* Remove the file's entry from the CODA Name Cache */
- /* We're being conservative here, it might be that this person
- * doesn't really have sufficient access to delete the file
- * but we feel zapping the entry won't really hurt anyone -- dcs
- */
- /* I'm gonna go out on a limb here. If a file and a hardlink to it
- * exist, and one is removed, the link count on the other will be
- * off by 1. We could either invalidate the attrs if cached, or
- * fix them. I'll try to fix them. DCS 11/8/94
- */
- tp = coda_nc_lookup(VTOC(dvp), nm, len, cred);
- if (tp) {
- if (VALID_VATTR(tp)) { /* If attrs are cached */
- if (tp->c_vattr.va_nlink > 1) { /* If it's a hard link */
- tp->c_vattr.va_nlink--;
- }
- }
-
- coda_nc_zapfile(VTOC(dvp), nm, len);
- /* No need to flush it if it doesn't exist! */
- }
- /* Invalidate the parent's attr cache, the modification time has changed */
- VTOC(dvp)->c_flags &= ~C_VATTR;
-
- /* Check for remove of control object. */
- if (IS_CTL_NAME(dvp, nm, len)) {
- MARK_INT_FAIL(CODA_REMOVE_STATS);
- return(ENOENT);
- }
-
- error = venus_remove(vtomi(dvp), &cp->c_fid, nm, len, cred, td->td_proc);
-
- CODADEBUG(CODA_REMOVE, myprintf(("in remove result %d\n",error)); )
-
- return(error);
-}
-
-int
-coda_link(struct vop_link_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- struct vnode *tdvp = ap->a_tdvp;
- struct cnode *tdcp = VTOC(tdvp);
- struct componentname *cnp = ap->a_cnp;
- struct ucred *cred = cnp->cn_cred;
- struct thread *td = cnp->cn_thread;
-/* locals */
- int error;
- const char *nm = cnp->cn_nameptr;
- int len = cnp->cn_namelen;
-
- MARK_ENTRY(CODA_LINK_STATS);
-
- if (codadebug & CODADBGMSK(CODA_LINK)) {
- myprintf(("nb_link: vp fid: %s\n",
- coda_f2s(&cp->c_fid)));
- myprintf(("nb_link: tdvp fid: %s)\n",
- coda_f2s(&tdcp->c_fid)));
- }
- if (codadebug & CODADBGMSK(CODA_LINK)) {
- myprintf(("link: vp fid: %s\n",
- coda_f2s(&cp->c_fid)));
- myprintf(("link: tdvp fid: %s\n",
- coda_f2s(&tdcp->c_fid)));
- }
-
- /* Check for link to/from control object. */
- if (IS_CTL_NAME(tdvp, nm, len) || IS_CTL_VP(vp)) {
- MARK_INT_FAIL(CODA_LINK_STATS);
- return(EACCES);
- }
-
- error = venus_link(vtomi(vp), &cp->c_fid, &tdcp->c_fid, nm, len, cred, td->td_proc);
-
- /* Invalidate the parent's attr cache, the modification time has changed */
- VTOC(tdvp)->c_flags &= ~C_VATTR;
- VTOC(vp)->c_flags &= ~C_VATTR;
-
- CODADEBUG(CODA_LINK, myprintf(("in link result %d\n",error)); )
-
- return(error);
-}
-
-int
-coda_rename(struct vop_rename_args *ap)
-{
-/* true args */
- struct vnode *odvp = ap->a_fdvp;
- struct cnode *odcp = VTOC(odvp);
- struct componentname *fcnp = ap->a_fcnp;
- struct vnode *ndvp = ap->a_tdvp;
- struct cnode *ndcp = VTOC(ndvp);
- struct componentname *tcnp = ap->a_tcnp;
- struct ucred *cred = fcnp->cn_cred;
- struct thread *td = fcnp->cn_thread;
-/* true args */
- int error;
- const char *fnm = fcnp->cn_nameptr;
- int flen = fcnp->cn_namelen;
- const char *tnm = tcnp->cn_nameptr;
- int tlen = tcnp->cn_namelen;
-
- MARK_ENTRY(CODA_RENAME_STATS);
-
- /* Hmmm. The vnodes are already looked up. Perhaps they are locked?
- This could be Bad. XXX */
-#ifdef OLD_DIAGNOSTIC
- if ((fcnp->cn_cred != tcnp->cn_cred)
- || (fcnp->cn_thread != tcnp->cn_thread))
- {
- panic("coda_rename: component names don't agree");
- }
-#endif
-
- /* Check for rename involving control object. */
- if (IS_CTL_NAME(odvp, fnm, flen) || IS_CTL_NAME(ndvp, tnm, tlen)) {
- MARK_INT_FAIL(CODA_RENAME_STATS);
- return(EACCES);
- }
-
- /* Problem with moving directories -- need to flush entry for .. */
- if (odvp != ndvp) {
- struct cnode *ovcp = coda_nc_lookup(VTOC(odvp), fnm, flen, cred);
- if (ovcp) {
- struct vnode *ovp = CTOV(ovcp);
- if ((ovp) &&
- (ovp->v_type == VDIR)) /* If it's a directory */
- coda_nc_zapfile(VTOC(ovp),"..", 2);
- }
- }
-
- /* Remove the entries for both source and target files */
- coda_nc_zapfile(VTOC(odvp), fnm, flen);
- coda_nc_zapfile(VTOC(ndvp), tnm, tlen);
-
- /* Invalidate the parent's attr cache, the modification time has changed */
- VTOC(odvp)->c_flags &= ~C_VATTR;
- VTOC(ndvp)->c_flags &= ~C_VATTR;
-
- if (flen+1 > CODA_MAXNAMLEN) {
- MARK_INT_FAIL(CODA_RENAME_STATS);
- error = EINVAL;
- goto exit;
- }
-
- if (tlen+1 > CODA_MAXNAMLEN) {
- MARK_INT_FAIL(CODA_RENAME_STATS);
- error = EINVAL;
- goto exit;
- }
-
- error = venus_rename(vtomi(odvp), &odcp->c_fid, &ndcp->c_fid, fnm, flen, tnm, tlen, cred, td->td_proc);
-
- exit:
- CODADEBUG(CODA_RENAME, myprintf(("in rename result %d\n",error));)
- /* XXX - do we need to call cache pureg on the moved vnode? */
- cache_purge(ap->a_fvp);
-
- /* It seems to be incumbent on us to drop locks on all four vnodes */
- /* From-vnodes are not locked, only ref'd. To-vnodes are locked. */
-
- vrele(ap->a_fvp);
- vrele(odvp);
-
- if (ap->a_tvp) {
- if (ap->a_tvp == ndvp) {
- vrele(ap->a_tvp);
- } else {
- vput(ap->a_tvp);
- }
- }
-
- vput(ndvp);
- return(error);
-}
-
-int
-coda_mkdir(struct vop_mkdir_args *ap)
-{
-/* true args */
- struct vnode *dvp = ap->a_dvp;
- struct cnode *dcp = VTOC(dvp);
- struct componentname *cnp = ap->a_cnp;
- register struct vattr *va = ap->a_vap;
- struct vnode **vpp = ap->a_vpp;
- struct ucred *cred = cnp->cn_cred;
- struct thread *td = cnp->cn_thread;
-/* locals */
- int error;
- const char *nm = cnp->cn_nameptr;
- int len = cnp->cn_namelen;
- struct cnode *cp;
- CodaFid VFid;
- struct vattr ova;
-
- MARK_ENTRY(CODA_MKDIR_STATS);
-
- /* Check for mkdir of target object. */
- if (IS_CTL_NAME(dvp, nm, len)) {
- *vpp = (struct vnode *)0;
- MARK_INT_FAIL(CODA_MKDIR_STATS);
- return(EACCES);
- }
-
- if (len+1 > CODA_MAXNAMLEN) {
- *vpp = (struct vnode *)0;
- MARK_INT_FAIL(CODA_MKDIR_STATS);
- return(EACCES);
- }
-
- error = venus_mkdir(vtomi(dvp), &dcp->c_fid, nm, len, va, cred, td->td_proc, &VFid, &ova);
-
- if (!error) {
- if (coda_find(&VFid) != NULL)
- panic("cnode existed for newly created directory!");
-
-
- cp = make_coda_node(&VFid, dvp->v_mount, va->va_type);
- *vpp = CTOV(cp);
-
- /* enter the new vnode in the Name Cache */
- coda_nc_enter(VTOC(dvp), nm, len, cred, VTOC(*vpp));
-
- /* as a side effect, enter "." and ".." for the directory */
- coda_nc_enter(VTOC(*vpp), ".", 1, cred, VTOC(*vpp));
- coda_nc_enter(VTOC(*vpp), "..", 2, cred, VTOC(dvp));
-
- if (coda_attr_cache) {
- VTOC(*vpp)->c_vattr = ova; /* update the attr cache */
- VTOC(*vpp)->c_flags |= C_VATTR; /* Valid attributes in cnode */
- }
-
- /* Invalidate the parent's attr cache, the modification time has changed */
- VTOC(dvp)->c_flags &= ~C_VATTR;
-
- CODADEBUG( CODA_MKDIR, myprintf(("mkdir: %s result %d\n",
- coda_f2s(&VFid), error)); )
- } else {
- *vpp = (struct vnode *)0;
- CODADEBUG(CODA_MKDIR, myprintf(("mkdir error %d\n",error));)
- }
-
- return(error);
-}
-
-int
-coda_rmdir(struct vop_rmdir_args *ap)
-{
-/* true args */
- struct vnode *dvp = ap->a_dvp;
- struct cnode *dcp = VTOC(dvp);
- struct componentname *cnp = ap->a_cnp;
- struct ucred *cred = cnp->cn_cred;
- struct thread *td = cnp->cn_thread;
-/* true args */
- int error;
- const char *nm = cnp->cn_nameptr;
- int len = cnp->cn_namelen;
- struct cnode *cp;
-
- MARK_ENTRY(CODA_RMDIR_STATS);
-
- /* Check for rmdir of control object. */
- if (IS_CTL_NAME(dvp, nm, len)) {
- MARK_INT_FAIL(CODA_RMDIR_STATS);
- return(ENOENT);
- }
-
- /* We're being conservative here, it might be that this person
- * doesn't really have sufficient access to delete the file
- * but we feel zapping the entry won't really hurt anyone -- dcs
- */
- /*
- * As a side effect of the rmdir, remove any entries for children of
- * the directory, especially "." and "..".
- */
- cp = coda_nc_lookup(dcp, nm, len, cred);
- if (cp) coda_nc_zapParentfid(&(cp->c_fid), NOT_DOWNCALL);
-
- /* Remove the file's entry from the CODA Name Cache */
- coda_nc_zapfile(dcp, nm, len);
-
- /* Invalidate the parent's attr cache, the modification time has changed */
- dcp->c_flags &= ~C_VATTR;
-
- error = venus_rmdir(vtomi(dvp), &dcp->c_fid, nm, len, cred, td->td_proc);
-
- CODADEBUG(CODA_RMDIR, myprintf(("in rmdir result %d\n", error)); )
-
- return(error);
-}
-
-int
-coda_symlink(struct vop_symlink_args *ap)
-{
-/* true args */
- struct vnode *tdvp = ap->a_dvp;
- struct cnode *tdcp = VTOC(tdvp);
- struct componentname *cnp = ap->a_cnp;
- struct vattr *tva = ap->a_vap;
- char *path = ap->a_target;
- struct ucred *cred = cnp->cn_cred;
- struct thread *td = cnp->cn_thread;
- struct vnode **vpp = ap->a_vpp;
-/* locals */
- int error;
- /*
- * XXX I'm assuming the following things about coda_symlink's
- * arguments:
- * t(foo) is the new name/parent/etc being created.
- * lname is the contents of the new symlink.
- */
- char *nm = cnp->cn_nameptr;
- int len = cnp->cn_namelen;
- int plen = strlen(path);
-
- /*
- * Here's the strategy for the moment: perform the symlink, then
- * do a lookup to grab the resulting vnode. I know this requires
- * two communications with Venus for a new sybolic link, but
- * that's the way the ball bounces. I don't yet want to change
- * the way the Mach symlink works. When Mach support is
- * deprecated, we should change symlink so that the common case
- * returns the resultant vnode in a vpp argument.
- */
-
- MARK_ENTRY(CODA_SYMLINK_STATS);
-
- /* Check for symlink of control object. */
- if (IS_CTL_NAME(tdvp, nm, len)) {
- MARK_INT_FAIL(CODA_SYMLINK_STATS);
- return(EACCES);
- }
-
- if (plen+1 > CODA_MAXPATHLEN) {
- MARK_INT_FAIL(CODA_SYMLINK_STATS);
- return(EINVAL);
- }
-
- if (len+1 > CODA_MAXNAMLEN) {
- MARK_INT_FAIL(CODA_SYMLINK_STATS);
- error = EINVAL;
- goto exit;
- }
-
- error = venus_symlink(vtomi(tdvp), &tdcp->c_fid, path, plen, nm, len, tva, cred, td->td_proc);
-
- /* Invalidate the parent's attr cache, the modification time has changed */
- tdcp->c_flags &= ~C_VATTR;
-
- if (error == 0)
- error = VOP_LOOKUP(tdvp, vpp, cnp);
-
- exit:
- CODADEBUG(CODA_SYMLINK, myprintf(("in symlink result %d\n",error)); )
- return(error);
-}
-
-/*
- * Read directory entries.
- */
-int
-coda_readdir(struct vop_readdir_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
- register struct uio *uiop = ap->a_uio;
- struct ucred *cred = ap->a_cred;
- int *eofflag = ap->a_eofflag;
- u_long **cookies = ap->a_cookies;
- int *ncookies = ap->a_ncookies;
- struct thread *td = ap->a_uio->uio_td;
-/* upcall decl */
-/* locals */
- int error = 0;
-
- MARK_ENTRY(CODA_READDIR_STATS);
-
- CODADEBUG(CODA_READDIR, myprintf(("coda_readdir(%p, %d, %lld, %d)\n",
- (void *)uiop->uio_iov->iov_base,
- uiop->uio_resid,
- (long long)uiop->uio_offset,
- uiop->uio_segflg)); )
-
- /* Check for readdir of control object. */
- if (IS_CTL_VP(vp)) {
- MARK_INT_FAIL(CODA_READDIR_STATS);
- return(ENOENT);
- }
-
- {
- /* If directory is not already open do an "internal open" on it. */
- int opened_internally = 0;
- if (cp->c_ovp == NULL) {
- opened_internally = 1;
- MARK_INT_GEN(CODA_OPEN_STATS);
- error = VOP_OPEN(vp, FREAD, cred, td, -1);
-printf("coda_readdir: Internally Opening %p\n", vp);
- if (error) {
- printf("coda_readdir: VOP_OPEN on container failed %d\n", error);
- return (error);
- }
- }
-
- /* Have UFS handle the call. */
- CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = %s, refcnt = %d\n", coda_f2s(&cp->c_fid), vp->v_usecount)); )
- error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, ncookies,
- cookies);
-
- if (error)
- MARK_INT_FAIL(CODA_READDIR_STATS);
- else
- MARK_INT_SAT(CODA_READDIR_STATS);
-
- /* Do an "internal close" if necessary. */
- if (opened_internally) {
- MARK_INT_GEN(CODA_CLOSE_STATS);
- (void)VOP_CLOSE(vp, FREAD, cred, td);
- }
- }
-
- return(error);
-}
-
-/*
- * Convert from filesystem blocks to device blocks
- */
-int
-coda_bmap(struct vop_bmap_args *ap)
-{
- /* XXX on the global proc */
-/* true args */
- struct vnode *vp __attribute__((unused)) = ap->a_vp; /* file's vnode */
- daddr_t bn __attribute__((unused)) = ap->a_bn; /* fs block number */
- struct bufobj **bop = ap->a_bop; /* RETURN bufobj of device */
- daddr_t *bnp __attribute__((unused)) = ap->a_bnp; /* RETURN device block number */
- struct thread *td __attribute__((unused)) = curthread;
-/* upcall decl */
-/* locals */
-
- int ret = 0;
- struct cnode *cp;
-
- cp = VTOC(vp);
- if (cp->c_ovp) {
- return EINVAL;
- ret = VOP_BMAP(cp->c_ovp, bn, bop, bnp, ap->a_runp, ap->a_runb);
-#if 0
- printf("VOP_BMAP(cp->c_ovp %p, bn %p, bop %p, bnp %lld, ap->a_runp %p, ap->a_runb %p) = %d\n",
- cp->c_ovp, bn, bop, bnp, ap->a_runp, ap->a_runb, ret);
-#endif
- return ret;
- } else {
-#if 0
- printf("coda_bmap: no container\n");
-#endif
- return(EOPNOTSUPP);
- }
-}
-
-int
-coda_reclaim(struct vop_reclaim_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
-/* upcall decl */
-/* locals */
-
-/*
- * Forced unmount/flush will let vnodes with non zero use be destroyed!
- */
- ENTRY;
-
- if (IS_UNMOUNTING(cp)) {
-#ifdef DEBUG
- if (VTOC(vp)->c_ovp) {
- if (IS_UNMOUNTING(cp))
- printf("coda_reclaim: c_ovp not void: vp %p, cp %p\n", vp, cp);
- }
-#endif
- } else {
-#ifdef OLD_DIAGNOSTIC
- if (vrefcnt(vp) != 0)
- print("coda_reclaim: pushing active %p\n", vp);
- if (VTOC(vp)->c_ovp) {
- panic("coda_reclaim: c_ovp not void");
- }
-#endif
- }
- cache_purge(vp);
- coda_free(VTOC(vp));
- vp->v_data = NULL;
- vnode_destroy_vobject(vp);
- return (0);
-}
-
-int
-coda_lock(struct vop_lock_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
-/* upcall decl */
-/* locals */
-
- ENTRY;
-
- if ((ap->a_flags & LK_INTERLOCK) == 0) {
- VI_LOCK(vp);
- ap->a_flags |= LK_INTERLOCK;
- }
-
- if (coda_lockdebug) {
- myprintf(("Attempting lock on %s\n",
- coda_f2s(&cp->c_fid)));
- }
-
- return (vop_stdlock(ap));
-}
-
-int
-coda_unlock(struct vop_unlock_args *ap)
-{
-/* true args */
- struct vnode *vp = ap->a_vp;
- struct cnode *cp = VTOC(vp);
-/* upcall decl */
-/* locals */
-
- ENTRY;
- if (coda_lockdebug) {
- myprintf(("Attempting unlock on %s\n",
- coda_f2s(&cp->c_fid)));
- }
-
- return (vop_stdunlock(ap));
-}
-
-int
-coda_islocked(struct vop_islocked_args *ap)
-{
-/* true args */
- ENTRY;
-
- return (vop_stdislocked(ap));
-}
-
-/* How one looks up a vnode given a device/inode pair: */
-int
-coda_grab_vnode(struct cdev *dev, ino_t ino, struct vnode **vpp)
-{
- /* This is like VFS_VGET() or igetinode()! */
- int error;
- struct mount *mp;
-
- if (!(mp = devtomp(dev))) {
- myprintf(("coda_grab_vnode: devtomp(%#lx) returns NULL\n",
- (u_long)dev2udev(dev)));
- return(ENXIO);
- }
-
- /* XXX - ensure that nonzero-return means failure */
- error = VFS_VGET(mp,ino,LK_EXCLUSIVE,vpp);
- if (error) {
- myprintf(("coda_grab_vnode: iget/vget(%lx, %lu) returns %p, err %d\n",
- (u_long)dev2udev(dev), (u_long)ino, (void *)*vpp, error));
- return(ENOENT);
- }
- return(0);
-}
-
-void
-print_vattr( attr )
- struct vattr *attr;
-{
- char *typestr;
-
- switch (attr->va_type) {
- case VNON:
- typestr = "VNON";
- break;
- case VREG:
- typestr = "VREG";
- break;
- case VDIR:
- typestr = "VDIR";
- break;
- case VBLK:
- typestr = "VBLK";
- break;
- case VCHR:
- typestr = "VCHR";
- break;
- case VLNK:
- typestr = "VLNK";
- break;
- case VSOCK:
- typestr = "VSCK";
- break;
- case VFIFO:
- typestr = "VFFO";
- break;
- case VBAD:
- typestr = "VBAD";
- break;
- default:
- typestr = "????";
- break;
- }
-
-
- myprintf(("attr: type %s mode %d uid %d gid %d fsid %d rdev %d\n",
- typestr, (int)attr->va_mode, (int)attr->va_uid,
- (int)attr->va_gid, (int)attr->va_fsid, (int)attr->va_rdev));
-
- myprintf((" fileid %d nlink %d size %d blocksize %d bytes %d\n",
- (int)attr->va_fileid, (int)attr->va_nlink,
- (int)attr->va_size,
- (int)attr->va_blocksize,(int)attr->va_bytes));
- myprintf((" gen %ld flags %ld vaflags %d\n",
- attr->va_gen, attr->va_flags, attr->va_vaflags));
- myprintf((" atime sec %d nsec %d\n",
- (int)attr->va_atime.tv_sec, (int)attr->va_atime.tv_nsec));
- myprintf((" mtime sec %d nsec %d\n",
- (int)attr->va_mtime.tv_sec, (int)attr->va_mtime.tv_nsec));
- myprintf((" ctime sec %d nsec %d\n",
- (int)attr->va_ctime.tv_sec, (int)attr->va_ctime.tv_nsec));
-}
-
-/* How to print a ucred */
-void
-print_cred(cred)
- struct ucred *cred;
-{
-
- int i;
-
- myprintf(("ref %d\tuid %d\n",cred->cr_ref,cred->cr_uid));
-
- for (i=0; i < cred->cr_ngroups; i++)
- myprintf(("\tgroup %d: (%d)\n",i,cred->cr_groups[i]));
- myprintf(("\n"));
-
-}
-
-/*
- * Return a vnode for the given fid.
- * If no cnode exists for this fid create one and put it
- * in a table hashed by coda_f2i(). If the cnode for
- * this fid is already in the table return it (ref count is
- * incremented by coda_find. The cnode will be flushed from the
- * table when coda_inactive calls coda_unsave.
- */
-struct cnode *
-make_coda_node(fid, vfsp, type)
- CodaFid *fid; struct mount *vfsp; short type;
-{
- struct cnode *cp;
- int err;
-
- if ((cp = coda_find(fid)) == NULL) {
- struct vnode *vp;
-
- cp = coda_alloc();
- cp->c_fid = *fid;
-
- err = getnewvnode("coda", vfsp, &coda_vnodeops, &vp);
- if (err) {
- panic("coda: getnewvnode returned error %d\n", err);
- }
- vp->v_data = cp;
- vp->v_type = type;
- cp->c_vnode = vp;
- coda_save(cp);
-
- } else {
- vref(CTOV(cp));
- }
-
- return cp;
-}
-
-int
-coda_pathconf( struct vop_pathconf_args *ap)
-{
- int error;
- register_t *retval;
-
- retval = ap->a_retval;
- error = 0;
-
- switch (ap->a_name) {
- case _PC_NAME_MAX:
- *retval = CODA_MAXNAMLEN;
- break;
- case _PC_PATH_MAX:
- *retval = CODA_MAXPATHLEN;
- break;
- default:
- error = vop_stdpathconf(ap);
- break;
- }
-
- return (error);
-}
diff --git a/sys/fs/coda/coda_vnops.h b/sys/fs/coda/coda_vnops.h
deleted file mode 100644
index db8e3f8..0000000
--- a/sys/fs/coda/coda_vnops.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- *
- * Coda: an Experimental Distributed File System
- * Release 3.1
- *
- * Copyright (c) 1987-1998 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, and
- * that credit is given to Carnegie Mellon University in all documents
- * and publicity pertaining to direct or indirect use of this code or its
- * derivatives.
- *
- * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
- * SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. 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 DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
- * ANY DERIVATIVE WORK.
- *
- * Carnegie Mellon encourages users of this software to return any
- * improvements or extensions that they make, and to grant Carnegie
- * Mellon the rights to redistribute these changes without encumbrance.
- *
- * @(#) src/sys/coda/coda_vnops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $FreeBSD$
- *
- */
-
-/*
- * Mach Operating System
- * Copyright (c) 1990 Carnegie-Mellon University
- * Copyright (c) 1989 Carnegie-Mellon University
- * All rights reserved. The CMU software License Agreement specifies
- * the terms and conditions for use and redistribution.
- */
-
-/*
- * This code was written for the Coda filesystem at Carnegie Mellon
- * University. Contributers include David Steere, James Kistler, and
- * M. Satyanarayanan.
- */
-
-
-/* NetBSD interfaces to the vnodeops */
-vop_open_t coda_open;
-vop_close_t coda_close;
-vop_read_t coda_read;
-vop_write_t coda_write;
-vop_ioctl_t coda_ioctl;
-/* 1.3 int cfs_select(void *);*/
-vop_getattr_t coda_getattr;
-vop_setattr_t coda_setattr;
-vop_access_t coda_access;
-int coda_abortop(void *);
-vop_readlink_t coda_readlink;
-vop_fsync_t coda_fsync;
-vop_inactive_t coda_inactive;
-vop_lookup_t coda_lookup;
-vop_create_t coda_create;
-vop_remove_t coda_remove;
-vop_link_t coda_link;
-vop_rename_t coda_rename;
-vop_mkdir_t coda_mkdir;
-vop_rmdir_t coda_rmdir;
-vop_symlink_t coda_symlink;
-vop_readdir_t coda_readdir;
-vop_bmap_t coda_bmap;
-vop_strategy_t coda_strategy;
-vop_reclaim_t coda_reclaim;
-vop_lock_t coda_lock;
-vop_unlock_t coda_unlock;
-vop_islocked_t coda_islocked;
-int coda_vop_error(void *);
-int coda_vop_nop(void *);
-vop_pathconf_t coda_pathconf;
-
-int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw,
- int ioflag, struct ucred *cred, struct thread *td);
-int coda_grab_vnode(struct cdev *dev, ino_t ino, struct vnode **vpp);
-void print_vattr(struct vattr *attr);
-void print_cred(struct ucred *cred);
diff --git a/sys/i4b/include/i4b_cause.h b/sys/i4b/include/i4b_cause.h
deleted file mode 100644
index 0e94483..0000000
--- a/sys/i4b/include/i4b_cause.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*---------------------------------------------------------------------------
- *
- * i4b_cause.h - causes and cause handling for i4b
- * -----------------------------------------------
- *
- * $FreeBSD$
- *
- * last edit-date: [Sun Mar 17 10:08:21 2002]
- *
- *---------------------------------------------------------------------------*/
-
-#ifndef _I4B_CAUSE_H_
-#define _I4B_CAUSE_H_
-
-/*---------------------------------------------------------------------------*
- * ISDN4BSD internal causes specification
- *---------------------------------------------------------------------------*/
-
-#define CAUSE_VAL 0x000000ff /* cause value */
-#define CAUSE_TYPE 0x0000ff00 /* cause type */
-#define CAUSET_Q850 0 /* value coded according to Q.850 */
-#define CAUSET_I4B 1 /* i4b protocol independent causes*/
-
-#define GET_CAUSE_VAL(cause) ((cause) & 0xff)
-#define SET_CAUSE_VAL(dest, val) ((dest) = ((dest & 0xffffff00) | \
- (val & 0x000000ff)))
-
-#define GET_CAUSE_TYPE(cause) (((cause) >> 8) & 0xff)
-#define SET_CAUSE_TYPE(dest, type) ((dest) = ((dest & 0xffff00ff) | \
- ((type << 8) & 0x0000ff00)))
-
-#define SET_CAUSE_TV(dest, type, val) ((dest) = ((val & 0x000000ff) | \
- ((type << 8) & 0x0000ff00)))
-
-/* CAUSET_I4B - protocol independent cause values */
-
-#define CAUSE_I4B_NORMAL 0 /* normal call clearing */
-#define CAUSE_I4B_BUSY 1 /* user busy */
-#define CAUSE_I4B_NOCHAN 2 /* circuit/channel not available*/
-#define CAUSE_I4B_INCOMP 3 /* incompatible source/dest */
-#define CAUSE_I4B_REJECT 4 /* call rejected */
-#define CAUSE_I4B_OOO 5 /* destination out of order */
-#define CAUSE_I4B_TMPFAIL 6 /* temporary failure */
-#define CAUSE_I4B_L1ERROR 7 /* L1 error / persistent deact */
-#define CAUSE_I4B_LLDIAL 8 /* no dialout on leased line */
-#define CAUSE_I4B_MAX 9
- /* NOTE: update isdnd/pcause.c when adding causes !!!!! */
- /* NOTE: update layer3/i4b_q931.c when adding causes !!!!! */
-
-/* CAUSET_Q850 - causes defined in Q.850 */
-
-#define CAUSE_Q850_SHUTDN 0x00 /* normal D-channel shutdown */
-#define CAUSE_Q850_NUNALLC 0x01 /* Unallocated (unassigned) number */
-#define CAUSE_Q850_NRTTN 0x02 /* No route to specified transit network */
-#define CAUSE_Q850_NRTDST 0x03 /* No route to destination */
-#define CAUSE_Q850_SSINFTN 0x04 /* Send special information tone */
-#define CAUSE_Q850_MDIALTP 0x05 /* Misdialled trunk prefix */
-#define CAUSE_Q850_CHUNACC 0x06 /* Channel unacceptable */
-#define CAUSE_Q850_CALLAWD 0x07 /* Call awarded and being delivered in an established channel */
-#define CAUSE_Q850_PREEMPT 0x08 /* Preemption */
-#define CAUSE_Q850_PREECRR 0x09 /* Preemption - circuit reserved for reuse */
-#define CAUSE_Q850_NCCLR 0x10 /* Normal call clearing */
-#define CAUSE_Q850_USRBSY 0x11 /* User busy */
-#define CAUSE_Q850_NOUSRRSP 0x12 /* No user responding */
-#define CAUSE_Q850_NOANSWR 0x13 /* No answer from user (user alerted) */
-#define CAUSE_Q850_SUBSABS 0x14 /* Subscriber absent */
-#define CAUSE_Q850_CALLREJ 0x15 /* Call rejected */
-#define CAUSE_Q850_NUCHNG 0x16 /* Number changed */
-#define CAUSE_Q850_NONSELUC 0x1A /* Non-selected user clearing */
-#define CAUSE_Q850_DSTOOORDR 0x1B /* Destination out of order */
-#define CAUSE_Q850_INVNUFMT 0x1C /* Invalid number format */
-#define CAUSE_Q850_FACREJ 0x1D /* Facility rejected */
-#define CAUSE_Q850_STENQRSP 0x1E /* Response to STATUS ENQUIRY */
-#define CAUSE_Q850_NORMUNSP 0x1F /* Normal, unspecified */
-#define CAUSE_Q850_NOCAVAIL 0x22 /* No circuit / channel available */
-#define CAUSE_Q850_NETOOORDR 0x26 /* Network out of order */
-#define CAUSE_Q850_PFMCDOOSERV 0x27 /* Permanent frame mode connection out of service */
-#define CAUSE_Q850_PFMCOPER 0x28 /* Permanent frame mode connection operational */
-#define CAUSE_Q850_TMPFAIL 0x29 /* Temporary failure */
-#define CAUSE_Q850_SWEQCONG 0x2A /* Switching equipment congestion */
-#define CAUSE_Q850_ACCINFDIS 0x2B /* Access information discarded */
-#define CAUSE_Q850_REQCNOTAV 0x2C /* Requested circuit/channel not available */
-#define CAUSE_Q850_PRECALBLK 0x2E /* Precedence call blocked */
-#define CAUSE_Q850_RESUNAVAIL 0x2F /* Resources unavailable, unspecified */
-#define CAUSE_Q850_QOSUNAVAIL 0x31 /* Quality of service unavailable */
-#define CAUSE_Q850_REQSERVNS 0x32 /* Requested facility not subscribed */
-#define CAUSE_Q850_OCBARRCUG 0x35 /* Outgoing calls barred within CUG */
-#define CAUSE_Q850_ICBARRCUG 0x36 /* Incoming calls barred within CUG */
-#define CAUSE_Q850_BCAPNAUTH 0x39 /* Bearer capability not authorized */
-#define CAUSE_Q850_BCAPNAVAIL 0x3A /* Bearer capability not presently available */
-#define CAUSE_Q850_INCSTOACISC 0x3E /* Inconsistenciy in designated outgoing access information and subscriber class */
-#define CAUSE_Q850_SOONOTAVAIL 0x3F /* Service or option not available, unspecified */
-#define CAUSE_Q850_BCAPNOTIMPL 0x41 /* Bearer capability not implemented */
-#define CAUSE_Q850_CHTYPNIMPL 0x42 /* Channel type not implemented */
-#define CAUSE_Q850_REQFACNIMPL 0x45 /* Requested facility not implemented */
-#define CAUSE_Q850_ORDINBCAVL 0x46 /* Only restricted digital information bearer capability is available */
-#define CAUSE_Q850_SOONOTIMPL 0x4F /* Service or option not implemented, unspecified */
-#define CAUSE_Q850_INVCLRFVAL 0x51 /* Invalid call reference value */
-#define CAUSE_Q850_IDCHDNOEX 0x52 /* Identified channel does not exist */
-#define CAUSE_Q850_SUSCAEXIN 0x53 /* A suspended call exists, but this call identity does not */
-#define CAUSE_Q850_CLIDINUSE 0x54 /* Call identity in use */
-#define CAUSE_Q850_NOCLSUSP 0x55 /* No call suspended */
-#define CAUSE_Q850_CLIDCLRD 0x56 /* Call having the requested call identity has been cleared */
-#define CAUSE_Q850_UNOTMEMCUG 0x57 /* User not member of CUG */
-#define CAUSE_Q850_INCDEST 0x58 /* Incompatible destination */
-#define CAUSE_Q850_NONEXCUG 0x5A /* Non-existent CUG */
-#define CAUSE_Q850_INVNTWSEL 0x5B /* Invalid transit network selection */
-#define CAUSE_Q850_INVMSG 0x5F /* Invalid message, unspecified */
-#define CAUSE_Q850_MIEMISS 0x60 /* Mandatory information element is missing */
-#define CAUSE_Q850_MSGTNI 0x61 /* Message type non-existent or not implemented */
-#define CAUSE_Q850_MSGNCMPT 0x62 /* Message not compatible with call state or message type non-existent or not implemented */
-#define CAUSE_Q850_IENENI 0x63 /* Information element/parameter non-existent or not implemented */
-#define CAUSE_Q850_INVIEC 0x64 /* Invalid information element contents */
-#define CAUSE_Q850_MSGNCWCS 0x65 /* Message not compatible with call state */
-#define CAUSE_Q850_RECOTIMEXP 0x66 /* Recovery on timer expiry */
-#define CAUSE_Q850_PARMNENIPO 0x67 /* Parameter non-existent or not implemented, passed on */
-#define CAUSE_Q850_MSGUNRDPRM 0x6E /* Message with unrecognized parameter, discarded */
-#define CAUSE_Q850_PROTERR 0x6F /* Protocol error, unspecified */
-#define CAUSE_Q850_INTWRKU 0x7F /* Interworking, unspecified */
-
-#define CAUSE_Q850_MAX 128
-
-#endif /* _I4B_CAUSE_H_ */
diff --git a/sys/i4b/include/i4b_debug.h b/sys/i4b/include/i4b_debug.h
deleted file mode 100644
index 38ae5ad..0000000
--- a/sys/i4b/include/i4b_debug.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*-
- * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*---------------------------------------------------------------------------
- *
- * i4b_debug.h - i4b debug header file
- * -----------------------------------
- *
- * $FreeBSD$
- *
- * last edit-date: [Sun Mar 17 10:08:41 2002]
- *
- *---------------------------------------------------------------------------*/
-
-#if !defined DO_I4B_DEBUG
-# define DO_I4B_DEBUG 1 /* default = include debugging code */
-#elif DO_I4B_DEBUG != 0
-# undef DO_I4B_DEBUG
-# define DO_I4B_DEBUG 1
-#endif
-
-#undef DO_I4B_MAXDEBUG /* default = disable ALL debug messages */
-
-#if DO_I4B_DEBUG
-
-extern unsigned int i4b_l1_debug;
-extern unsigned int i4b_l2_debug;
-extern unsigned int i4b_l3_debug;
-extern unsigned int i4b_l4_debug;
-
-#define NDBGL1(bits, fmt, args...) \
- if(bits & i4b_l1_debug) \
- { printf("i4b-L1 %s: " fmt "\n", __func__ , ##args ); }
-
-#define NDBGL2(bits, fmt, args...) \
- if(bits & i4b_l2_debug) \
- { printf("i4b-L2 %s: " fmt "\n", __func__ , ##args ); }
-
-#define NDBGL3(bits, fmt, args...) \
- if(bits & i4b_l3_debug) \
- { printf("i4b-L3 %s: " fmt "\n", __func__ , ##args ); }
-
-#define NDBGL4(bits, fmt, args...) \
- if(bits & i4b_l4_debug) \
- { printf("i4b-L4 %s: " fmt "\n", __func__ , ##args ); }
-
-#else /* !DO_I4B_DEBUG */
-
-#define NDBGL1(bits, fmt, args...);
-#define NDBGL2(bits, fmt, args...);
-#define NDBGL3(bits, fmt, args...);
-#define NDBGL4(bits, fmt, args...);
-
-#endif /* DO_I4B_DEBUG */
-
-/* Layer 1 */
-
-#define L1_ERROR 0x000001 /* general error message*/
-#define L1_PRIM 0x000002 /* interlayer primitives*/
-#define L1_BCHAN 0x000004 /* B channel action */
-#define L1_H_ERR 0x000008 /* HSCX errors */
-#define L1_H_IRQ 0x000010 /* HSCX IRQ messages */
-#define L1_I_ERR 0x000020 /* ISAC errors */
-#define L1_I_MSG 0x000040 /* ISAC messages */
-#define L1_I_SETUP 0x000080 /* ISAC setup messages */
-#define L1_F_MSG 0x000100 /* FSM messages */
-#define L1_F_ERR 0x000200 /* FSM error messages */
-#define L1_T_MSG 0x000400 /* Timer messages */
-#define L1_T_ERR 0x000800 /* Timer error messages */
-#define L1_H_XFRERR 0x001000 /* HSCX data xfer error */
-#define L1_I_CICO 0x002000 /* ISAC command in/out */
-#define L1_S_MSG 0x004000 /* silent messages (soft-HDLC) */
-#define L1_S_ERR 0x008000 /* error messages (soft-HDLC) */
-#define L1_HFC_DBG 0x010000 /* HFC-S PCI messages */
-#define L1_DEBUG_MAX 0x01ffef /* all messages on except IRQ! */
-#define L1_DEBUG_ERR (L1_S_ERR | L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR)
-
-#ifndef L1_DEBUG_DEFAULT
-#ifdef DO_I4B_MAXDEBUG
-#define L1_DEBUG_DEFAULT L1_DEBUG_MAX
-#else
-#define L1_DEBUG_DEFAULT L1_DEBUG_ERR
-#endif
-#endif
-
-/* Layer 2 */
-
-#define L2_ERROR 0x0001 /* general error message */
-#define L2_PRIM 0x0002 /* interlayer primitives */
-#define L2_U_MSG 0x0004 /* U frame messages */
-#define L2_U_ERR 0x0008 /* U frame error messages */
-#define L2_S_MSG 0x0010 /* S frame messages */
-#define L2_S_ERR 0x0020 /* S frame error messages */
-#define L2_I_MSG 0x0040 /* I frame messages */
-#define L2_I_ERR 0x0080 /* I frame error messages */
-#define L2_F_MSG 0x0100 /* FSM messages */
-#define L2_F_ERR 0x0200 /* FSM error messages */
-#define L2_T_MSG 0x0400 /* timer messages */
-#define L2_T_ERR 0x0800 /* timer error messages */
-#define L2_TEI_MSG 0x1000 /* TEI messages */
-#define L2_TEI_ERR 0x2000 /* TEI error messages */
-
-#define L2_DEBUG_MAX 0x3fff /* all messages on */
-#define L2_DEBUG_ERR (L2_ERROR | L2_I_ERR | L2_F_ERR | L2_T_ERR | L2_S_ERR | L2_TEI_ERR | L2_U_ERR )
-
-#ifndef L2_DEBUG_DEFAULT
-#ifdef DO_I4B_MAXDEBUG
-#define L2_DEBUG_DEFAULT L2_DEBUG_MAX
-#else
-#define L2_DEBUG_DEFAULT L2_DEBUG_ERR
-#endif
-#endif
-
-/* Layer 3 */
-
-#define L3_ERR 0x0001 /* general error message */
-#define L3_MSG 0x0002 /* general message */
-#define L3_F_MSG 0x0004 /* FSM messages */
-#define L3_F_ERR 0x0008 /* FSM error messages */
-#define L3_T_MSG 0x0010 /* timer messages */
-#define L3_T_ERR 0x0020 /* timer error messages */
-#define L3_P_MSG 0x0040 /* protocol messages */
-#define L3_P_ERR 0x0080 /* protocol error messages */
-#define L3_A_MSG 0x0100 /* AOC messages */
-#define L3_A_ERR 0x0200 /* AOC error messages */
-#define L3_PRIM 0x0400 /* messages exchanged */
-
-#define L3_DEBUG_MAX 0x07ff /* all messages on */
-#define L3_DEBUG_ERR (L3_ERR | L3_F_ERR | L3_T_ERR | L3_P_ERR | L3_A_ERR)
-
-#ifndef L3_DEBUG_DEFAULT
-#ifdef DO_I4B_MAXDEBUG
-#define L3_DEBUG_DEFAULT L3_DEBUG_MAX
-#else
-#define L3_DEBUG_DEFAULT L3_DEBUG_ERR
-#endif
-#endif
-
-/* Layer 4 */
-
-#define L4_ERR 0x0001 /* general error message */
-#define L4_MSG 0x0002 /* general message */
-#define L4_TIMO 0x0004 /* b channel idle timeout msgs */
-#define L4_DIALST 0x0008 /* network driver dial states */
-#define L4_IPRDBG 0x0010 /* ipr driver debug messages */
-#define L4_RBCHDBG 0x0020 /* rbch driver debug messages */
-#define L4_ISPDBG 0x0040 /* isp driver debug messages */
-#define L4_TELDBG 0x0080 /* tel driver debug messages */
-#define L4_INGDBG 0x0100 /* ing driver debug messages */
-#define L4_IAVCDBG 0x0200 /* AVM B1 driver debug messages */
-#define L4_CAPIDBG 0x0400 /* CAPI driver debug messages */
-
-#define L4_DEBUG_MAX 0x0fff /* all messages on */
-#define L4_DEBUG_ERR L4_ERR
-
-#ifndef L4_DEBUG_DEFAULT
-#ifdef DO_I4B_MAXDEBUG
-#define L4_DEBUG_DEFAULT L4_DEBUG_MAX
-#else
-#define L4_DEBUG_DEFAULT L4_DEBUG_ERR
-#endif
-#endif
-
-/*---------------------------------------------------------------------------*
- * ioctl via /dev/i4bctl:
- * get/set current debug bits settings
- *---------------------------------------------------------------------------*/
-
-typedef struct {
- unsigned int l1;
- unsigned int l2;
- unsigned int l3;
- unsigned int l4;
-} ctl_debug_t;
-
-#define I4B_CTL_GET_DEBUG _IOR('C', 0, ctl_debug_t)
-
-#define I4B_CTL_SET_DEBUG _IOW('C', 1, ctl_debug_t)
-
-/*---------------------------------------------------------------------------*
- * generic get chipset statistics
- *---------------------------------------------------------------------------*/
-
-/* for the ihfc-driver: structure for HFC-1/S/SP statistics */
-
-typedef struct {
- int txframes;
- int rxframes;
- int xdu;
- int rdo;
- int crc;
- int rab;
-} hfcstat_t;
-
-
-/* for the isic-driver: structure for HSCX statistics */
-
-typedef struct {
- int unit; /* controller number */
- int chan; /* channel number */
- int vfr;
- int rdo;
- int crc;
- int rab;
- int xdu;
- int rfo;
-} hscxstat_t;
-
-/* generic statistics structure */
-
-struct chipstat {
- int driver_type; /* type, L1DRVR_XXXX */
- int driver_unit; /* the unit number */
- int driver_bchannel; /* the B-channel */
- union stats { /* union for all drivers */
- hfcstat_t hfcstat; /* for ihfc driver, L1DRVR_IHFC */
- hscxstat_t hscxstat; /* for isic driver, L1DRVR_ISIC */
- } stats;
-};
-
-/* get statistics */
-
-#define I4B_CTL_GET_CHIPSTAT _IOWR('C', 2, struct chipstat)
-
-/* clear statistics */
-
-#define I4B_CTL_CLR_CHIPSTAT _IOW('C', 3, struct chipstat)
-
-/*---------------------------------------------------------------------------*
- * get LAPD/Q.921 statistics
- *---------------------------------------------------------------------------*/
-typedef struct {
-
- /* transmit */
-
- u_long tx_i; /* I */
- u_long tx_rr; /* RR */
- u_long tx_rnr; /* RNR */
- u_long tx_rej; /* REJ */
- u_long tx_sabme; /* SABME*/
- u_long tx_dm; /* DM */
- u_long tx_disc; /* DISC */
- u_long tx_ua; /* UA */
- u_long tx_frmr; /* FRMR */
- u_long tx_tei; /* TEI */
-
- /* receive */
-
- u_long rx_i; /* I */
- u_long rx_rr; /* RR */
- u_long rx_rnr; /* RNR */
- u_long rx_rej; /* REJ */
- u_long rx_sabme; /* SABME*/
- u_long rx_tei; /* TEI */
- u_long rx_ui; /* UI */
- u_long rx_disc; /* DISC */
- u_long rx_xid; /* XID */
- u_long rx_dm; /* DM */
- u_long rx_ua; /* UA */
- u_long rx_frmr; /* FRMR */
-
- /* errors */
-
- u_long err_rx_len; /* incorrect length */
- u_long err_rx_badf; /* bad frame type */
- u_long err_rx_bads; /* bad s frame */
- u_long err_rx_badu; /* bad u frame */
- u_long err_rx_badui; /* bad ui frame */
-} lapdstat_t;
-
-typedef struct {
- int unit;
- lapdstat_t lapdstat;
-} l2stat_t;
-
-#define I4B_CTL_GET_LAPDSTAT _IOWR('C', 4, l2stat_t)
-
-#define I4B_CTL_CLR_LAPDSTAT _IOW('C', 5, int)
-
-/* EOF */
diff --git a/sys/i4b/include/i4b_ioctl.h b/sys/i4b/include/i4b_ioctl.h
deleted file mode 100644
index bcf131a..0000000
--- a/sys/i4b/include/i4b_ioctl.h
+++ /dev/null
@@ -1,743 +0,0 @@
-/*-
- * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*---------------------------------------------------------------------------
- *
- * i4b_ioctl.h - messages kernel <--> userland
- * -------------------------------------------
- *
- * $FreeBSD$
- *
- * last edit-date: [Sun Aug 11 19:19:08 2002]
- *
- *---------------------------------------------------------------------------*/
-
-#ifndef _I4B_IOCTL_H_
-#define _I4B_IOCTL_H_
-
-/*---------------------------------------------------------------------------*
- * version and release number for isdn4bsd package
- *---------------------------------------------------------------------------*/
-#define VERSION 1 /* version number */
-#define REL 4 /* release number */
-#define STEP 0 /* release step */
-
-/*---------------------------------------------------------------------------*
- * date/time format in i4b log messages
- * ------------------------------------
- * Being year 2000 clean is not easy with the current state of the
- * ANSI C library standard and it's implementation for some locales.
- * You might like to use the "%c" format of "strftime" sometimes,
- * but this breaks Y2K in some locales. Also the old standard logfile
- * format "%d.%m.%y %H:%M:%S" is non compliant.
- * NetBSD's current toolset warns about this problems, and we compile
- * with -Werror, so this problems need to be resolved.
- *---------------------------------------------------------------------------*/
-#define I4B_TIME_FORMAT "%d.%m.%Y %H:%M:%S"
-
-/*---------------------------------------------------------------------------*
- * max number of controllers in system
- *---------------------------------------------------------------------------*/
-#define MAX_CONTROLLERS 8 /* max number of controllers */
-
-/*---------------------------------------------------------------------------*
- * ISDN D-channel protocols
- *---------------------------------------------------------------------------*/
-#define PROTOCOL_DSS1 0 /* default, Euro-ISDN/DSS1 */
-#define PROTOCOL_D64S 1 /* 64k leased line, no protocol */
-
-/*---------------------------------------------------------------------------*
- * controller types
- *---------------------------------------------------------------------------*/
-#define CTRL_INVALID (-1) /* invalid, error */
-#define CTRL_UNKNOWN 0 /* unknown controller type */
-#define CTRL_PASSIVE 1 /* passive ISDN controller cards*/
-#define CTRL_DAIC 2 /* Diehl active controller cards*/
-#define CTRL_TINADD 3 /* Stollmann Tina-dd active card*/
-#define CTRL_AVMB1 4 /* AVM B1 active card */
-#define CTRL_CAPI 5 /* cards seen via the CAPI layer*/
-#define CTRL_NUMTYPES 6 /* number of controller types */
-
-/*---------------------------------------------------------------------------*
- * CTRL_PASSIVE: driver types
- *---------------------------------------------------------------------------*/
-#define MAXL1UNITS 8 /* max number of units */
-
-#define L1DRVR_ISIC 0 /* isic - driver */
-#define L1DRVR_IWIC 1 /* iwic - driver */
-#define L1DRVR_IFPI 2 /* ifpi - driver */
-#define L1DRVR_IHFC 3 /* ihfc - driver */
-#define L1DRVR_IFPNP 4 /* ifpnp - driver */
-#define L1DRVR_ICCHP 5 /* icchp - driver */
-#define L1DRVR_ITJC 6 /* itjc - driver */
-#define L1DRVR_IFPI2 7 /* ifpi2 - driver */
-
-/* MAXL1DRVR MUST be updated when more passive drivers are added !!! */
-#define MAXL1DRVR (L1DRVR_IFPI2 + 1)
-
-/*---------------------------------------------------------------------------*
- * card types for CTRL_PASSIVE
- *---------------------------------------------------------------------------*/
-#define CARD_TYPEP_INVAL (-1) /* invalid, error */
-#define CARD_TYPEP_UNK 0 /* unknown */
-#define CARD_TYPEP_8 1 /* Teles, S0/8 */
-#define CARD_TYPEP_16 2 /* Teles, S0/16 */
-#define CARD_TYPEP_16_3 3 /* Teles, S0/16.3 */
-#define CARD_TYPEP_AVMA1 4 /* AVM A1 or AVM Fritz!Card */
-#define CARD_TYPEP_163P 5 /* Teles, S0/16.3 PnP */
-#define CARD_TYPEP_CS0P 6 /* Creatix, S0 PnP */
-#define CARD_TYPEP_USRTA 7 /* US Robotics ISDN TA internal */
-#define CARD_TYPEP_DRNNGO 8 /* Dr. Neuhaus Niccy GO@ */
-#define CARD_TYPEP_SWS 9 /* Sedlbauer Win Speed */
-#define CARD_TYPEP_DYNALINK 10 /* Dynalink IS64PH */
-#define CARD_TYPEP_BLMASTER 11 /* ISDN Blaster / ISDN Master */
-#define CARD_TYPEP_PCFRITZ 12 /* AVM PCMCIA Fritz!Card */
-#define CARD_TYPEP_ELSAQS1ISA 13 /* ELSA QuickStep 1000pro ISA */
-#define CARD_TYPEP_ELSAQS1PCI 14 /* ELSA QuickStep 1000pro PCI */
-#define CARD_TYPEP_SIEMENSITALK 15 /* Siemens I-Talk */
-#define CARD_TYPEP_ELSAMLIMC 16 /* ELSA MicroLink ISDN/MC */
-#define CARD_TYPEP_ELSAMLMCALL 17 /* ELSA MicroLink MCall */
-#define CARD_TYPEP_ITKIX1 18 /* ITK ix1 micro */
-#define CARD_TYPEP_AVMA1PCI 19 /* AVM FRITZ!CARD PCI */
-#define CARD_TYPEP_PCC16 20 /* ELSA PCC-16 */
-#define CARD_TYPEP_AVM_PNP 21 /* AVM FRITZ!CARD PnP */
-#define CARD_TYPEP_SIE_ISURF2 22 /* Siemens I-Surf 2 PnP */
-#define CARD_TYPEP_ASUSCOMIPAC 23 /* Asuscom ISDNlink 128 K PnP */
-#define CARD_TYPEP_WINB6692 24 /* Winbond W6692 based */
-#define CARD_TYPEP_16_3C 25 /* Teles S0/16.3c PnP (HFC-S/SP */
-#define CARD_TYPEP_ACERP10 26 /* Acer ISDN P10 (HFC-S) */
-#define CARD_TYPEP_TELEINT_NO_1 27 /* TELEINT ISDN SPEED No. 1 (HFC-1) */
-#define CARD_TYPEP_CCD_HFCS_PCI 28 /* Cologne Chip HFC-S PCI based */
-#define CARD_TYPEP_NETJET_S 29 /* Traverse NetJet-S (Tiger300) */
-#define CARD_TYPEP_DIVA_ISA 30 /* Eicon DIVA ISA PnP 2.0 or 2.02 */
-#define CARD_TYPEP_COMPAQ_M610 31 /* Compaq Microcom 610 */
-#define CARD_TYPEP_AVMA1PCI_V2 32 /* AVM FRITZ!CARD PCI Ver. 2 */
-/*
- * in case you add support for more cards, please update:
- *
- * isdnd: controller.c, name_of_controller()
- *
- * and adjust CARD_TYPEP_MAX below.
- */
-
-#define CARD_TYPEP_MAX 32 /* max type */
-
-/*---------------------------------------------------------------------------*
- * card types for CTRL_DAIC
- *---------------------------------------------------------------------------*/
-#define CARD_TYPEA_DAIC_UNK 0
-#define CARD_TYPEA_DAIC_S 1
-#define CARD_TYPEA_DAIC_SX 2
-#define CARD_TYPEA_DAIC_SCOM 3
-#define CARD_TYPEA_DAIC_QUAD 4
-
-/*---------------------------------------------------------------------------*
- * card types for CTRL_CAPI
- *---------------------------------------------------------------------------*/
-#define CARD_TYPEC_CAPI_UNK 0
-#define CARD_TYPEC_AVM_T1_PCI 1
-#define CARD_TYPEC_AVM_B1_PCI 2
-#define CARD_TYPEC_AVM_B1_ISA 3
-
-/*---------------------------------------------------------------------------*
- * max length of some strings
- *---------------------------------------------------------------------------*/
-#define TELNO_MAX 41 /* max length of a telephone number (+ '\0') */
-#define SUBADDR_MAX 21 /* max length of a subaddress (+ '\0') */
-#define DISPLAY_MAX 91 /* max length of display information (+ '\0') */
-#define DATETIME_MAX 21 /* max length of datetime information (+ '\0')*/
-#define KEYPAD_MAX 35 /* max length of a keypad string (+ '\0') */
-
-/*---------------------------------------------------------------------------*
- * in case the src or dst telephone number is empty
- *---------------------------------------------------------------------------*/
-#define TELNO_EMPTY "NotAvailable"
-
-/*---------------------------------------------------------------------------*
- * B channel parameters
- *---------------------------------------------------------------------------*/
-#define BCH_MAX_DATALEN 2048 /* max length of a B channel frame */
-
-/*---------------------------------------------------------------------------*
- * userland driver types
- * ---------------------
- * a "driver" is defined here as a piece of software interfacing an
- * ISDN B channel with a userland service, such as IP, Telephony etc.
- *---------------------------------------------------------------------------*/
-#define BDRV_RBCH 0 /* raw b-channel interface driver */
-#define BDRV_TEL 1 /* telephone (speech) interface driver */
-#define BDRV_IPR 2 /* IP over raw HDLC interface driver */
-#define BDRV_ISPPP 3 /* sync Kernel PPP interface driver */
-#define BDRV_IBC 4 /* BSD/OS point to point driver */
-#define BDRV_ING 5 /* NetGraph ing driver */
-
-/*---------------------------------------------------------------------------*
- * B channel protocol
- *---------------------------------------------------------------------------*/
-#define BPROT_NONE 0 /* no protocol at all, raw data */
-#define BPROT_RHDLC 1 /* raw HDLC: flag, data, crc, flag */
-
-/*---------------------------------------------------------------------------*
- * special bearer capability settings (i.e. Data over Voice)
- *---------------------------------------------------------------------------*/
-#define BCAP_NONE 0 /* no special bearer capability */
-#define BCAP_DOV 1 /* Data over Voice */
-
-/*---------------------------------------------------------------------------*
- * causes data type
- *---------------------------------------------------------------------------*/
-typedef unsigned int cause_t; /* 32 bit unsigned int */
-
-/*---------------------------------------------------------------------------*
- * call descriptor id (cdid) definitions
- *---------------------------------------------------------------------------*/
-#define CDID_UNUSED 0 /* cdid is invalid and unused */
-#define CDID_MAX 99999 /* highest valid cdid, wraparound to 1 */
-
-/*---------------------------------------------------------------------------*
- * The shorthold algorithm to use
- *---------------------------------------------------------------------------*/
-#define SHA_FIXU 0 /* timeout algorithm for fix unit charging */
-#define SHA_VARU 1 /* timeout algorithm for variable unit charging */
-
-/*---------------------------------------------------------------------------*
- * The shorthold data struct
- *---------------------------------------------------------------------------*/
-typedef struct {
- int shorthold_algorithm; /* shorthold algorithm to use */
- int unitlen_time; /* length of a charging unit */
- int idle_time; /* time without activity on b ch*/
- int earlyhup_time; /* safety area at end of unit */
-} msg_shorthold_t;
-
-
-/****************************************************************************
-
- outgoing call:
- --------------
-
- userland kernel
- -------- ------
-
- CDID_REQ ----------------->
-
- <------------------ cdid
-
- CONNECT_REQ -------------->
-
- <------------------ PROCEEDING_IND (if connect req ok)
-
- <------------------ CONNECT_ACTIVE_IND (if connection ok)
-
- or
-
- <------------------ DISCONNECT_IND (if connection failed)
-
-
-
- incoming call:
- --------------
-
- userland kernel
- -------- ------
-
- <------------------ CONNECT_IND
-
- CONNECT_RESP ------------->
-
- <------------------ CONNECT_ACTIVE_IND (if accepted)
-
-
-
- active disconnect:
- ------------------
-
- userland kernel
- -------- ------
-
- DISCONNECT_REQ ------------>
-
- <------------------ DISCONNECT_IND
-
-
- passive disconnect:
- -------------------
-
- userland kernel
- -------- ------
-
- <------------------ DISCONNECT_IND
-
-
-****************************************************************************/
-
-
-/*===========================================================================*
- *===========================================================================*
- * "read" messages from kernel -> userland
- *===========================================================================*
- *===========================================================================*/
-
-
-/*---------------------------------------------------------------------------*
- * message header, included in every message
- *---------------------------------------------------------------------------*/
-typedef struct {
- char type; /* message identifier */
-#define MSG_CONNECT_IND 'a'
-#define MSG_CONNECT_ACTIVE_IND 'b'
-#define MSG_DISCONNECT_IND 'c'
-#define MSG_DIALOUT_IND 'd'
-#define MSG_IDLE_TIMEOUT_IND 'e'
-#define MSG_ACCT_IND 'f'
-#define MSG_CHARGING_IND 'g'
-#define MSG_PROCEEDING_IND 'h'
-#define MSG_ALERT_IND 'i'
-#define MSG_DRVRDISC_REQ 'j'
-#define MSG_L12STAT_IND 'k'
-#define MSG_TEIASG_IND 'l'
-#define MSG_PDEACT_IND 'm'
-#define MSG_NEGCOMP_IND 'n'
-#define MSG_IFSTATE_CHANGED_IND 'o'
-#define MSG_DIALOUTNUMBER_IND 'p'
-#define MSG_PACKET_IND 'q'
-#define MSG_KEYPAD_IND 'r'
- int cdid; /* call descriptor id */
-} msg_hdr_t;
-
-/*---------------------------------------------------------------------------*
- * connect indication
- * indicates incoming connection
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int controller; /* controller number */
- int channel; /* channel number */
-#define CHAN_B1 0 /* this _must_ be 0, HSCX B1 is also 0 */
-#define CHAN_B2 1 /* this _must_ be 1, HSCX B2 is also 1 */
-#define CHAN_ANY (-1) /* outgoing, not possible for incoming */
-#define CHAN_NO (-2) /* call waiting (CW) for incoming */
- int bprot; /* b channel protocot, see BPROT_XXX */
- int bcap; /* special bearer capability, see BCAP_XXX */
- char dst_telno[TELNO_MAX]; /* destination telno */
- char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
- char src_telno[TELNO_MAX]; /* source telno */
- char src_subaddr[SUBADDR_MAX]; /* src subaddr */
- int dst_ton; /* dest. type of number */
- int src_ton; /* src. type of number */
-#define TON_OTHER 0 /* other type of number */
-#define TON_INTERNAT 1 /* international number */
-#define TON_NATIONAL 2 /* national number */
- int scr_ind;/* screening indicator */
-#define SCR_NONE 0 /* no screening indicator transmitted */
-#define SCR_USR_NOSC 1 /* screening user provided, not screened*/
-#define SCR_USR_PASS 2 /* screening user provided, verified & passed */
-#define SCR_USR_FAIL 3 /* screening user provided, verified & failed */
-#define SCR_NET 4 /* screening network provided */
- int prs_ind;/* presentation indicator */
-#define PRS_NONE 0 /* no presentation indicator transmitted*/
-#define PRS_ALLOWED 1 /* presentation allowed */
-#define PRS_RESTRICT 2 /* presentation restricted */
-#define PRS_NNINTERW 3 /* number not available due to interworking */
-#define PRS_RESERVED 4 /* reserved */
- char display[DISPLAY_MAX]; /* content of display IE*/
-} msg_connect_ind_t;
-
-/*---------------------------------------------------------------------------*
- * connect active indication
- * indicates active connection
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int controller; /* controller number actually used */
- int channel; /* channel number actually used */
- char datetime[DATETIME_MAX]; /* content of date/time IE */
-} msg_connect_active_ind_t;
-
-/*---------------------------------------------------------------------------*
- * disconnect indication
- * indicates a disconnect
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- cause_t cause; /* cause code */
-} msg_disconnect_ind_t;
-
-/*---------------------------------------------------------------------------*
- * negotiation complete
- * indicates an interface is completely up & running
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
-} msg_negcomplete_ind_t;
-
-/*---------------------------------------------------------------------------*
- * interface changes internal state
- * indicates an interface has somehow switched its FSM
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int state; /* new interface state */
-} msg_ifstatechg_ind_t;
-
-/*---------------------------------------------------------------------------*
- * initiate a call to a remote site
- * i.e. the IP driver got a packet and wants a connection
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int driver; /* driver type */
- int driver_unit; /* driver unit number */
-} msg_dialout_ind_t;
-
-/*---------------------------------------------------------------------------*
- * dial a number
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int driver; /* driver type */
- int driver_unit; /* driver unit number */
- int cmdlen; /* length of string */
- int subaddrlen; /* length of subaddr */
- char cmd[TELNO_MAX]; /* the number to dial */
- char subaddr[SUBADDR_MAX]; /* dest subaddr */
-} msg_dialoutnumber_ind_t;
-
-/*---------------------------------------------------------------------------*
- * send keypad string
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int driver; /* driver type */
- int driver_unit; /* driver unit number */
- int cmdlen; /* length of string */
- char cmd[KEYPAD_MAX];/* keypad string */
-} msg_keypad_ind_t;
-
-/*---------------------------------------------------------------------------*
- * idle timeout disconnect sent indication
- * kernel has sent disconnect request because of b-ch idle
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
-} msg_idle_timeout_ind_t;
-
-/*---------------------------------------------------------------------------*
- * accounting information from userland interface driver to daemon
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int accttype; /* accounting type */
-#define ACCT_DURING 0
-#define ACCT_FINAL 1
- int driver; /* driver type */
- int driver_unit; /* driver unit number */
- int ioutbytes; /* ISDN # of bytes sent */
- int iinbytes; /* ISDN # of bytes received */
- int outbps; /* bytes per sec out */
- int inbps; /* bytes per sec in */
- int outbytes; /* driver # of bytes sent */
- int inbytes; /* driver # of bytes received */
-} msg_accounting_ind_t;
-
-/*---------------------------------------------------------------------------*
- * charging information from isdn driver to daemon
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int units; /* number of units */
- int units_type; /* type of units info */
-#define CHARGE_INVALID 0 /* invalid, unknown */
-#define CHARGE_AOCD 1 /* advice of charge during call */
-#define CHARGE_AOCE 2 /* advice of charge at end of call */
-#define CHARGE_CALC 3 /* locally calculated from rates information */
-} msg_charging_ind_t;
-
-/*---------------------------------------------------------------------------*
- * call proceeding indication
- * indicates outgoing SETUP has been acknowleged
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int controller; /* controller number actually used */
- int channel; /* channel number actually used */
-} msg_proceeding_ind_t;
-
-/*---------------------------------------------------------------------------*
- * alert indication
- * indicates remote user side "rings"
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
-} msg_alert_ind_t;
-
-/*---------------------------------------------------------------------------*
- * driver requests to disconnect line
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int driver; /* driver type */
- int driver_unit; /* driver unit number */
-} msg_drvrdisc_req_t;
-
-/*---------------------------------------------------------------------------*
- * connect packet logging
- *---------------------------------------------------------------------------*/
-
-typedef struct {
- msg_hdr_t header; /* common header */
- int driver; /* driver type */
- int driver_unit; /* driver unit number */
- int direction; /* 0=in 1=out */
-#define DIRECTION_IN 0 /* sending packet to remote */
-#define DIRECTION_OUT 1 /* received packet from remote */
-#define MAX_PACKET_LOG 40 /* space for IP and TCP header */
- u_int8_t pktdata[MAX_PACKET_LOG];
-} msg_packet_ind_t;
-
-/*---------------------------------------------------------------------------*
- * state of layer 1/2
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int controller; /* controller unit */
- int layer; /* layer number (1/2) */
-#define LAYER_ONE 1
-#define LAYER_TWO 2
- int state; /* state info */
-#define LAYER_IDLE 0
-#define LAYER_ACTIVE 1
-} msg_l12stat_ind_t;
-
-/*---------------------------------------------------------------------------*
- * TEI assignment messages
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int controller; /* controller unit */
- int tei; /* TEI or -1 if invalid */
-} msg_teiasg_ind_t;
-
-/*---------------------------------------------------------------------------*
- * persistent deactivation state of stack
- *---------------------------------------------------------------------------*/
-typedef struct {
- msg_hdr_t header; /* common header */
- int controller; /* controller unit */
- int numactive; /* number of active connections */
-} msg_pdeact_ind_t;
-
-
-/*===========================================================================*
- *===========================================================================*
- * "ioctl" messages from userland -> kernel
- *===========================================================================*
- *===========================================================================*/
-
-/*---------------------------------------------------------------------------*
- * request a unique cdid (to setup an outgoing call)
- *---------------------------------------------------------------------------*/
-typedef struct {
- int cdid; /* call descriptor id */
-} msg_cdid_req_t;
-
-#define I4B_CDID_REQ _IOWR('4', 0, int)
-
-/*---------------------------------------------------------------------------*
- * connect request
- * requests an outgoing connection
- *---------------------------------------------------------------------------*/
-typedef struct {
- int cdid; /* call descriptor id */
- int controller; /* controller to use */
- int channel; /* channel to use */
- int txdelay; /* tx delay after connect */
- int bprot; /* b channel protocol */
- int bcap; /* special bearer capability */
- int driver; /* driver to route b channel data to */
- int driver_unit; /* unit number for above driver */
- msg_shorthold_t shorthold_data; /* the shorthold data */
- int unitlen_method; /* how to calculate the unitlength */
-#define ULEN_METHOD_STATIC 0 /* use unitlen_time value (see above) */
-#define ULEN_METHOD_DYNAMIC 1 /* use AOCD */
- char dst_telno[TELNO_MAX]; /* destination telephone no */
- char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
- char src_telno[TELNO_MAX]; /* source telephone number */
- char src_subaddr[SUBADDR_MAX]; /* source subaddr */
- char keypad[KEYPAD_MAX]; /* keypad string */
-} msg_connect_req_t;
-
-#define I4B_CONNECT_REQ _IOW('4', 1, msg_connect_req_t)
-
-/*---------------------------------------------------------------------------*
- * connect response
- * this is the answer to an incoming connect indication
- *---------------------------------------------------------------------------*/
-typedef struct {
- int cdid; /* call descriptor id */
- int response; /* what to do with incoming call */
-#define SETUP_RESP_DNTCRE 0 /* dont care, call is not for me */
-#define SETUP_RESP_REJECT 1 /* reject call */
-#define SETUP_RESP_ACCEPT 2 /* accept call */
- cause_t cause; /* cause for case SETUP_RESP_REJECT */
- /* the following are only used for SETUP_RESP_ACCEPT !! */
- int txdelay; /* tx delay after connect */
- int bprot; /* B chan protocol */
- int bcap; /* special bearer capability */
- int driver; /* driver to route b channel data to */
- int driver_unit; /* unit number for above driver */
- int max_idle_time; /* max time without activity on b ch */
-} msg_connect_resp_t;
-
-#define I4B_CONNECT_RESP _IOW('4', 2, msg_connect_resp_t)
-
-/*---------------------------------------------------------------------------*
- * disconnect request
- * active disconnect request
- *---------------------------------------------------------------------------*/
-typedef struct {
- int cdid; /* call descriptor id */
- cause_t cause; /* protocol independent cause */
-} msg_discon_req_t;
-
-#define I4B_DISCONNECT_REQ _IOW('4', 3, msg_discon_req_t)
-
-/*---------------------------------------------------------------------------*
- * controller info request
- *---------------------------------------------------------------------------*/
-typedef struct {
- int controller; /* controller number */
- int ncontroller; /* number of controllers in system */
- int ctrl_type; /* controller type passive/active */
- int card_type; /* brand / version */
- int tei; /* tei controller probably has */
- int nbch; /* number of b channels provided */
-} msg_ctrl_info_req_t;
-
-#define I4B_CTRL_INFO_REQ _IOWR('4', 4, msg_ctrl_info_req_t)
-
-/*---------------------------------------------------------------------------*
- * dialout response
- * status report to driver who requested a dialout
- *---------------------------------------------------------------------------*/
-typedef struct {
- int driver; /* driver to route b channel data to */
- int driver_unit; /* unit number for above driver */
- int stat; /* state of dialout request */
-#define DSTAT_NONE 0
-#define DSTAT_TFAIL 1 /* transient failure */
-#define DSTAT_PFAIL 2 /* permanent failure */
-#define DSTAT_INONLY 3 /* no outgoing dials allowed */
- cause_t cause; /* exact i4b cause */
-} msg_dialout_resp_t;
-
-#define I4B_DIALOUT_RESP _IOW('4', 5, msg_dialout_resp_t)
-
-/*---------------------------------------------------------------------------*
- * timeout value update
- *---------------------------------------------------------------------------*/
-typedef struct {
- int cdid; /* call descriptor id */
- msg_shorthold_t shorthold_data;
-} msg_timeout_upd_t;
-
-#define I4B_TIMEOUT_UPD _IOW('4', 6, msg_timeout_upd_t)
-
-/*---------------------------------------------------------------------------*
- * soft enable/disable
- *---------------------------------------------------------------------------*/
-typedef struct {
- int driver; /* driver to route b channel data to */
- int driver_unit; /* unit number for above driver */
- int updown; /* what to do */
-#define SOFT_ENA 0 /* enable interface */
-#define SOFT_DIS 1 /* disable interface */
-} msg_updown_ind_t;
-
-#define I4B_UPDOWN_IND _IOW('4', 7, msg_updown_ind_t)
-
-/*---------------------------------------------------------------------------*
- * send alert request
- *---------------------------------------------------------------------------*/
-typedef struct {
- int cdid; /* call descriptor id */
-} msg_alert_req_t;
-
-#define I4B_ALERT_REQ _IOW('4', 8, msg_alert_req_t)
-
-/*---------------------------------------------------------------------------*
- * request version and release info from kernel part
- * (msg_vr_req_t is also used by tel & rbch drivers)
- *---------------------------------------------------------------------------*/
-typedef struct {
- int version; /* version number */
- int release; /* release number */
- int step; /* release step number */
-} msg_vr_req_t;
-
-#define I4B_VR_REQ _IOR('4', 9, msg_vr_req_t)
-
-/*---------------------------------------------------------------------------*
- * set ISDN protocol used by a controller
- *---------------------------------------------------------------------------*/
-typedef struct {
- int controller; /* controller number */
- int protocol; /* ISDN D-channel protocol type */
-} msg_prot_ind_t;
-
-#define I4B_PROT_IND _IOW('4', 10, msg_prot_ind_t)
-
-/*---------------------------------------------------------------------------*
- * Protocol download to active cards
- *---------------------------------------------------------------------------*/
-struct isdn_dr_prot {
- size_t bytecount; /* length of code */
- u_int8_t *microcode; /* pointer to microcode */
-};
-
-struct isdn_download_request {
- int controller; /* controller number */
- int numprotos; /* number of protocols in 'protocols' */
- struct isdn_dr_prot *protocols;
-};
-
-#define I4B_CTRL_DOWNLOAD _IOW('4', 100, struct isdn_download_request)
-
-/*---------------------------------------------------------------------------*
- * Generic diagnostic interface for active cards
- *---------------------------------------------------------------------------*/
-struct isdn_diagnostic_request {
- int controller; /* controller number */
- u_int32_t cmd; /* diagnostic command to execute */
- size_t in_param_len; /* length of additional input parameter */
-#define I4B_ACTIVE_DIAGNOSTIC_MAXPARAMLEN 65536
- void *in_param; /* optional input parameter */
- size_t out_param_len; /* available output space */
- void *out_param; /* output data goes here */
-};
-
-#define I4B_ACTIVE_DIAGNOSTIC _IOW('4', 102, struct isdn_diagnostic_request)
-
-#endif /* _I4B_IOCTL_H_ */
diff --git a/sys/i4b/include/i4b_rbch_ioctl.h b/sys/i4b/include/i4b_rbch_ioctl.h
deleted file mode 100644
index 334aa9dc..0000000
--- a/sys/i4b/include/i4b_rbch_ioctl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c) 1999, 2002 Hellmuth Michaelis. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*---------------------------------------------------------------------------
- *
- * i4b_rbch_ioctl.h raw B-channel driver interface ioctls
- * ------------------------------------------------------
- *
- * $FreeBSD$
- *
- * last edit-date: [Sun Mar 17 10:10:25 2002]
- *
- *---------------------------------------------------------------------------*/
-
-#ifndef _I4B_RBCH_IOCTL_H_
-#define _I4B_RBCH_IOCTL_H_
-
-/*---------------------------------------------------------------------------*
- * instruct the rbch device to dial the given number
- *---------------------------------------------------------------------------*/
-
-typedef char telno_t[TELNO_MAX];
-
-#define I4B_RBCH_DIALOUT _IOW('R', 1, telno_t)
-
-/*---------------------------------------------------------------------------*
- * request version and release info from kernel part
- *---------------------------------------------------------------------------*/
-
-#define I4B_RBCH_VR_REQ _IOR('R', 2, msg_vr_req_t)
-
-#endif /* _I4B_RBCH_IOCTL_H_ */
diff --git a/sys/i4b/include/i4b_tel_ioctl.h b/sys/i4b/include/i4b_tel_ioctl.h
deleted file mode 100644
index 47ffc70..0000000
--- a/sys/i4b/include/i4b_tel_ioctl.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*---------------------------------------------------------------------------
- *
- * i4b_tel_ioctl.h telephony interface ioctls
- * ------------------------------------------
- *
- * $FreeBSD$
- *
- * last edit-date: [Sun Mar 17 10:10:39 2002]
- *
- *---------------------------------------------------------------------------*/
-
-#ifndef _I4B_TEL_IOCTL_H_
-#define _I4B_TEL_IOCTL_H_
-
-/*===========================================================================*
- * /dev/i4btel<n> devices (audio data)
- *===========================================================================*/
-
-/* supported audio format conversions */
-
-#define CVT_NONE 0 /* no A-law/u-law conversion */
-#define CVT_ALAW2ULAW 1 /* ISDN line: A-law, user: u-law */
-#define CVT_ULAW2ALAW 2 /* ISDN line: u-law, user: A-law */
-
-/*---------------------------------------------------------------------------*
- * get / set audio format
- *---------------------------------------------------------------------------*/
-
-#define I4B_TEL_GETAUDIOFMT _IOR('A', 0, int)
-#define I4B_TEL_SETAUDIOFMT _IOW('A', 1, int)
-#define I4B_TEL_EMPTYINPUTQUEUE _IOW('A', 2, int)
-
-/*---------------------------------------------------------------------------*
- * request version and release info from kernel part
- *---------------------------------------------------------------------------*/
-
-#define I4B_TEL_VR_REQ _IOR('A', 3, msg_vr_req_t)
-
-/*---------------------------------------------------------------------------*
- * send tones out of the tel interface
- *---------------------------------------------------------------------------*/
-
-#define I4B_TEL_MAXTONES 32
-
-struct i4b_tel_tones {
- int frequency[I4B_TEL_MAXTONES];
- int duration[I4B_TEL_MAXTONES];
-};
-
-#define I4B_TEL_TONES _IOR('A', 4, struct i4b_tel_tones)
-
-/*===========================================================================*
- * /dev/i4bteld<n> devices (dialer interface)
- *===========================================================================*/
-
-/* dialer commands */
-
-#define CMD_DIAL 'D' /* dial the following number string */
-#define CMD_HUP 'H' /* hangup */
-#define CMD_KEYP 'K' /* send keypad string */
-
-/* dialer responses */
-
-#define RSP_CONN '0' /* connect */
-#define RSP_BUSY '1' /* busy */
-#define RSP_HUP '2' /* hangup */
-#define RSP_NOA '3' /* no answer */
-
-#endif /* _I4B_TEL_IOCTL_H_ */
diff --git a/sys/i4b/include/i4b_trace.h b/sys/i4b/include/i4b_trace.h
deleted file mode 100644
index fbd40af..0000000
--- a/sys/i4b/include/i4b_trace.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*---------------------------------------------------------------------------
- *
- * i4b_trace.h - header file for trace data read device
- * ----------------------------------------------------
- *
- * $FreeBSD$
- *
- * last edit-date: [Sun Mar 17 10:10:52 2002]
- *
- *---------------------------------------------------------------------------*/
-
-#ifndef _I4B_TRACE_H_
-#define _I4B_TRACE_H_
-
-/*---------------------------------------------------------------------------*
- * structure of the header at the beginning of every trace mbuf
- *---------------------------------------------------------------------------*/
-typedef struct {
- int length; /* length of the following mbuf */
- int unit; /* controller unit number */
- int type; /* type of channel */
-#define TRC_CH_I 0 /* Layer 1 INFO's */
-#define TRC_CH_D 1 /* D channel */
-#define TRC_CH_B1 2 /* B1 channel */
-#define TRC_CH_B2 3 /* B2 channel */
- int dir; /* direction */
-#define FROM_TE 0 /* user -> network */
-#define FROM_NT 1 /* network -> user */
- int trunc; /* # of truncated bytes (frame > MCLBYTES) */
- unsigned int count; /* frame count for this unit/type */
- struct timeval time; /* timestamp for this frame */
-} i4b_trace_hdr_t;
-
-#define INFO0 0 /* layer 1 */
-#define INFO1_8 1
-#define INFO1_10 2
-#define INFO2 3
-#define INFO3 4
-#define INFO4_8 5
-#define INFO4_10 6
-
-/*---------------------------------------------------------------------------*
- * ioctl via /dev/i4btrc device(s):
- * get/set current trace flag settings
- *---------------------------------------------------------------------------*/
-
-#define I4B_TRC_SET _IOW('T', 0, int) /* set trace settings */
-
-#define TRACE_OFF 0x00 /* tracing off */
-#define TRACE_I 0x01 /* trace L1 INFO's on */
-#define TRACE_D_TX 0x02 /* trace D channel on */
-#define TRACE_D_RX 0x04 /* trace D channel on */
-#define TRACE_B_TX 0x08 /* trace B channel on */
-#define TRACE_B_RX 0x10 /* trace B channel on */
-
-typedef struct {
- int rxunit; /* unit # for rx frames */
- int rxflags; /* d and/or b channel */
- int txunit; /* unit # for tx frames */
- int txflags; /* d and/or b channel */
-} i4b_trace_setupa_t;
-
-#define I4B_TRC_SETA _IOW('T', 1, i4b_trace_setupa_t) /* set analyze mode */
-#define I4B_TRC_RESETA _IOW('T', 2, int) /* reset analyze mode */
-
-#endif /* _I4B_TRACE_H_ */
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
deleted file mode 100644
index 3570be1..0000000
--- a/sys/isa/atrtc.c
+++ /dev/null
@@ -1,970 +0,0 @@
-/*-
- * 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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: @(#)clock.c 7.2 (Berkeley) 5/12/91
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Routines to handle clock hardware.
- */
-
-/*
- * inittodr, settodr and support routines written
- * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at>
- *
- * reintroduced and updated by Chris Stenton <chris@gnome.co.uk> 8/10/94
- */
-
-#include "opt_apic.h"
-#include "opt_clock.h"
-#include "opt_isa.h"
-#include "opt_mca.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/kdb.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/time.h>
-#include <sys/timetc.h>
-#include <sys/kernel.h>
-#include <sys/limits.h>
-#include <sys/module.h>
-#include <sys/sysctl.h>
-#include <sys/cons.h>
-#include <sys/power.h>
-
-#include <machine/clock.h>
-#include <machine/cputypes.h>
-#include <machine/frame.h>
-#include <machine/intr_machdep.h>
-#include <machine/md_var.h>
-#include <machine/psl.h>
-#ifdef DEV_APIC
-#include <machine/apicvar.h>
-#endif
-#include <machine/specialreg.h>
-#include <machine/ppireg.h>
-#include <machine/timerreg.h>
-
-#include <isa/rtc.h>
-#ifdef DEV_ISA
-#include <isa/isareg.h>
-#include <isa/isavar.h>
-#endif
-
-#ifdef DEV_MCA
-#include <i386/bios/mca_machdep.h>
-#endif
-
-/*
- * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we
- * can use a simple formula for leap years.
- */
-#define LEAPYEAR(y) (((u_int)(y) % 4 == 0) ? 1 : 0)
-#define DAYSPERYEAR (31+28+31+30+31+30+31+31+30+31+30+31)
-
-#define TIMER_DIV(x) ((timer_freq + (x) / 2) / (x))
-
-int adjkerntz; /* local offset from GMT in seconds */
-int clkintr_pending;
-int disable_rtc_set; /* disable resettodr() if != 0 */
-int pscnt = 1;
-int psdiv = 1;
-int statclock_disable;
-#ifndef TIMER_FREQ
-#define TIMER_FREQ 1193182
-#endif
-u_int timer_freq = TIMER_FREQ;
-int timer0_max_count;
-int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
-struct mtx clock_lock;
-#define RTC_LOCK mtx_lock_spin(&clock_lock)
-#define RTC_UNLOCK mtx_unlock_spin(&clock_lock)
-
-static int beeping = 0;
-static const u_char daysinmonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
-static u_int hardclock_max_count;
-static struct intsrc *i8254_intsrc;
-static u_int32_t i8254_lastcount;
-static u_int32_t i8254_offset;
-static int (*i8254_pending)(struct intsrc *);
-static int i8254_ticked;
-static int using_lapic_timer;
-static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
-static u_char rtc_statusb = RTCSB_24HR;
-
-/* Values for timerX_state: */
-#define RELEASED 0
-#define RELEASE_PENDING 1
-#define ACQUIRED 2
-#define ACQUIRE_PENDING 3
-
-static u_char timer2_state;
-
-static unsigned i8254_get_timecount(struct timecounter *tc);
-static unsigned i8254_simple_get_timecount(struct timecounter *tc);
-static void set_timer_freq(u_int freq, int intr_freq);
-
-static struct timecounter i8254_timecounter = {
- i8254_get_timecount, /* get_timecount */
- 0, /* no poll_pps */
- ~0u, /* counter_mask */
- 0, /* frequency */
- "i8254", /* name */
- 0 /* quality */
-};
-
-static void
-clkintr(struct clockframe *frame)
-{
-
- if (timecounter->tc_get_timecount == i8254_get_timecount) {
- mtx_lock_spin(&clock_lock);
- if (i8254_ticked)
- i8254_ticked = 0;
- else {
- i8254_offset += timer0_max_count;
- i8254_lastcount = 0;
- }
- clkintr_pending = 0;
- mtx_unlock_spin(&clock_lock);
- }
- if (!using_lapic_timer)
- hardclock(frame);
-#ifdef DEV_MCA
- /* Reset clock interrupt by asserting bit 7 of port 0x61 */
- if (MCA_system)
- outb(0x61, inb(0x61) | 0x80);
-#endif
-}
-
-int
-acquire_timer2(int mode)
-{
-
- if (timer2_state != RELEASED)
- return (-1);
- timer2_state = ACQUIRED;
-
- /*
- * This access to the timer registers is as atomic as possible
- * because it is a single instruction. We could do better if we
- * knew the rate. Use of splclock() limits glitches to 10-100us,
- * and this is probably good enough for timer2, so we aren't as
- * careful with it as with timer0.
- */
- outb(TIMER_MODE, TIMER_SEL2 | (mode & 0x3f));
-
- return (0);
-}
-
-int
-release_timer2()
-{
-
- if (timer2_state != ACQUIRED)
- return (-1);
- timer2_state = RELEASED;
- outb(TIMER_MODE, TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT);
- return (0);
-}
-
-/*
- * This routine receives statistical clock interrupts from the RTC.
- * As explained above, these occur at 128 interrupts per second.
- * When profiling, we receive interrupts at a rate of 1024 Hz.
- *
- * This does not actually add as much overhead as it sounds, because
- * when the statistical clock is active, the hardclock driver no longer
- * needs to keep (inaccurate) statistics on its own. This decouples
- * statistics gathering from scheduling interrupts.
- *
- * The RTC chip requires that we read status register C (RTC_INTR)
- * to acknowledge an interrupt, before it will generate the next one.
- * Under high interrupt load, rtcintr() can be indefinitely delayed and
- * the clock can tick immediately after the read from RTC_INTR. In this
- * case, the mc146818A interrupt signal will not drop for long enough
- * to register with the 8259 PIC. If an interrupt is missed, the stat
- * clock will halt, considerably degrading system performance. This is
- * why we use 'while' rather than a more straightforward 'if' below.
- * Stat clock ticks can still be lost, causing minor loss of accuracy
- * in the statistics, but the stat clock will no longer stop.
- */
-static void
-rtcintr(struct clockframe *frame)
-{
-
- while (rtcin(RTC_INTR) & RTCIR_PERIOD) {
- if (profprocs != 0) {
- if (--pscnt == 0)
- pscnt = psdiv;
- profclock(frame);
- }
- if (pscnt == psdiv)
- statclock(frame);
- }
-}
-
-#include "opt_ddb.h"
-#ifdef DDB
-#include <ddb/ddb.h>
-
-DB_SHOW_COMMAND(rtc, rtc)
-{
- printf("%02x/%02x/%02x %02x:%02x:%02x, A = %02x, B = %02x, C = %02x\n",
- rtcin(RTC_YEAR), rtcin(RTC_MONTH), rtcin(RTC_DAY),
- rtcin(RTC_HRS), rtcin(RTC_MIN), rtcin(RTC_SEC),
- rtcin(RTC_STATUSA), rtcin(RTC_STATUSB), rtcin(RTC_INTR));
-}
-#endif /* DDB */
-
-static int
-getit(void)
-{
- int high, low;
-
- mtx_lock_spin(&clock_lock);
-
- /* Select timer0 and latch counter value. */
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
-
- low = inb(TIMER_CNTR0);
- high = inb(TIMER_CNTR0);
-
- mtx_unlock_spin(&clock_lock);
- return ((high << 8) | low);
-}
-
-/*
- * Wait "n" microseconds.
- * Relies on timer 1 counting down from (timer_freq / hz)
- * Note: timer had better have been programmed before this is first used!
- */
-void
-DELAY(int n)
-{
- int delta, prev_tick, tick, ticks_left;
-
-#ifdef DELAYDEBUG
- int getit_calls = 1;
- int n1;
- static int state = 0;
-
- if (state == 0) {
- state = 1;
- for (n1 = 1; n1 <= 10000000; n1 *= 10)
- DELAY(n1);
- state = 2;
- }
- if (state == 1)
- printf("DELAY(%d)...", n);
-#endif
- /*
- * Guard against the timer being uninitialized if we are called
- * early for console i/o.
- */
- if (timer0_max_count == 0)
- set_timer_freq(timer_freq, hz);
-
- /*
- * Read the counter first, so that the rest of the setup overhead is
- * counted. Guess the initial overhead is 20 usec (on most systems it
- * takes about 1.5 usec for each of the i/o's in getit(). The loop
- * takes about 6 usec on a 486/33 and 13 usec on a 386/20. The
- * multiplications and divisions to scale the count take a while).
- *
- * However, if ddb is active then use a fake counter since reading
- * the i8254 counter involves acquiring a lock. ddb must not do
- * locking for many reasons, but it calls here for at least atkbd
- * input.
- */
-#ifdef KDB
- if (kdb_active)
- prev_tick = 1;
- else
-#endif
- prev_tick = getit();
- n -= 0; /* XXX actually guess no initial overhead */
- /*
- * Calculate (n * (timer_freq / 1e6)) without using floating point
- * and without any avoidable overflows.
- */
- if (n <= 0)
- ticks_left = 0;
- else if (n < 256)
- /*
- * Use fixed point to avoid a slow division by 1000000.
- * 39099 = 1193182 * 2^15 / 10^6 rounded to nearest.
- * 2^15 is the first power of 2 that gives exact results
- * for n between 0 and 256.
- */
- ticks_left = ((u_int)n * 39099 + (1 << 15) - 1) >> 15;
- else
- /*
- * Don't bother using fixed point, although gcc-2.7.2
- * generates particularly poor code for the long long
- * division, since even the slow way will complete long
- * before the delay is up (unless we're interrupted).
- */
- ticks_left = ((u_int)n * (long long)timer_freq + 999999)
- / 1000000;
-
- while (ticks_left > 0) {
-#ifdef KDB
- if (kdb_active) {
- inb(0x84);
- tick = prev_tick - 1;
- if (tick <= 0)
- tick = timer0_max_count;
- } else
-#endif
- tick = getit();
-#ifdef DELAYDEBUG
- ++getit_calls;
-#endif
- delta = prev_tick - tick;
- prev_tick = tick;
- if (delta < 0) {
- delta += timer0_max_count;
- /*
- * Guard against timer0_max_count being wrong.
- * This shouldn't happen in normal operation,
- * but it may happen if set_timer_freq() is
- * traced.
- */
- if (delta < 0)
- delta = 0;
- }
- ticks_left -= delta;
- }
-#ifdef DELAYDEBUG
- if (state == 1)
- printf(" %d calls to getit() at %d usec each\n",
- getit_calls, (n + 5) / getit_calls);
-#endif
-}
-
-static void
-sysbeepstop(void *chan)
-{
- ppi_spkr_off(); /* disable counter2 output to speaker */
- timer_spkr_release();
- beeping = 0;
-}
-
-int
-sysbeep(int pitch, int period)
-{
- int x = splclock();
-
- if (timer_spkr_acquire())
- if (!beeping) {
- /* Something else owns it. */
- splx(x);
- return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */
- }
- mtx_lock_spin(&clock_lock);
- spkr_set_pitch(pitch);
- mtx_unlock_spin(&clock_lock);
- if (!beeping) {
- /* enable counter2 output to speaker */
- ppi_spkr_on();
- beeping = period;
- timeout(sysbeepstop, (void *)NULL, period);
- }
- splx(x);
- return (0);
-}
-
-/*
- * RTC support routines
- */
-
-int
-rtcin(reg)
- int reg;
-{
- u_char val;
-
- RTC_LOCK;
- outb(IO_RTC, reg);
- inb(0x84);
- val = inb(IO_RTC + 1);
- inb(0x84);
- RTC_UNLOCK;
- return (val);
-}
-
-static __inline void
-writertc(u_char reg, u_char val)
-{
-
- RTC_LOCK;
- inb(0x84);
- outb(IO_RTC, reg);
- inb(0x84);
- outb(IO_RTC + 1, val);
- inb(0x84); /* XXX work around wrong order in rtcin() */
- RTC_UNLOCK;
-}
-
-static __inline int
-readrtc(int port)
-{
- return(bcd2bin(rtcin(port)));
-}
-
-static u_int
-calibrate_clocks(void)
-{
- u_int count, prev_count, tot_count;
- int sec, start_sec, timeout;
-
- if (bootverbose)
- printf("Calibrating clock(s) ... ");
- if (!(rtcin(RTC_STATUSD) & RTCSD_PWR))
- goto fail;
- timeout = 100000000;
-
- /* Read the mc146818A seconds counter. */
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
- sec = rtcin(RTC_SEC);
- break;
- }
- if (--timeout == 0)
- goto fail;
- }
-
- /* Wait for the mC146818A seconds counter to change. */
- start_sec = sec;
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP)) {
- sec = rtcin(RTC_SEC);
- if (sec != start_sec)
- break;
- }
- if (--timeout == 0)
- goto fail;
- }
-
- /* Start keeping track of the i8254 counter. */
- prev_count = getit();
- if (prev_count == 0 || prev_count > timer0_max_count)
- goto fail;
- tot_count = 0;
-
- /*
- * Wait for the mc146818A seconds counter to change. Read the i8254
- * counter for each iteration since this is convenient and only
- * costs a few usec of inaccuracy. The timing of the final reads
- * of the counters almost matches the timing of the initial reads,
- * so the main cause of inaccuracy is the varying latency from
- * inside getit() or rtcin(RTC_STATUSA) to the beginning of the
- * rtcin(RTC_SEC) that returns a changed seconds count. The
- * maximum inaccuracy from this cause is < 10 usec on 486's.
- */
- start_sec = sec;
- for (;;) {
- if (!(rtcin(RTC_STATUSA) & RTCSA_TUP))
- sec = rtcin(RTC_SEC);
- count = getit();
- if (count == 0 || count > timer0_max_count)
- goto fail;
- if (count > prev_count)
- tot_count += prev_count - (count - timer0_max_count);
- else
- tot_count += prev_count - count;
- prev_count = count;
- if (sec != start_sec)
- break;
- if (--timeout == 0)
- goto fail;
- }
-
- if (bootverbose) {
- printf("i8254 clock: %u Hz\n", tot_count);
- }
- return (tot_count);
-
-fail:
- if (bootverbose)
- printf("failed, using default i8254 clock of %u Hz\n",
- timer_freq);
- return (timer_freq);
-}
-
-static void
-set_timer_freq(u_int freq, int intr_freq)
-{
- int new_timer0_max_count;
-
- i8254_timecounter.tc_frequency = freq;
- mtx_lock_spin(&clock_lock);
- timer_freq = freq;
- new_timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq);
- if (using_lapic_timer) {
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
- outb(TIMER_CNTR0, 0);
- outb(TIMER_CNTR0, 0);
- } else if (new_timer0_max_count != timer0_max_count) {
- timer0_max_count = new_timer0_max_count;
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
- outb(TIMER_CNTR0, timer0_max_count & 0xff);
- outb(TIMER_CNTR0, timer0_max_count >> 8);
- }
- mtx_unlock_spin(&clock_lock);
-}
-
-static void
-i8254_restore(void)
-{
-
- set_timer_freq(timer_freq, hz);
-}
-
-static void
-rtc_restore(void)
-{
-
- /* Restore all of the RTC's "status" (actually, control) registers. */
- /* XXX locking is needed for RTC access. */
- writertc(RTC_STATUSB, RTCSB_24HR);
- writertc(RTC_STATUSA, rtc_statusa);
- writertc(RTC_STATUSB, rtc_statusb);
- rtcin(RTC_INTR);
-}
-
-/*
- * Restore all the timers non-atomically (XXX: should be atomically).
- *
- * This function is called from pmtimer_resume() to restore all the timers.
- * This should not be necessary, but there are broken laptops that do not
- * restore all the timers on resume.
- */
-void
-timer_restore(void)
-{
-
- i8254_restore(); /* restore timer_freq and hz */
- rtc_restore(); /* reenable RTC interrupts */
-}
-
-/*
- * Initialize 8254 timer 0 early so that it can be used in DELAY().
- * XXX initialization of other timers is unintentionally left blank.
- */
-void
-startrtclock()
-{
- u_int delta, freq;
-
- writertc(RTC_STATUSA, rtc_statusa);
- writertc(RTC_STATUSB, RTCSB_24HR);
-
- set_timer_freq(timer_freq, hz);
- freq = calibrate_clocks();
-#ifdef CLK_CALIBRATION_LOOP
- if (bootverbose) {
- printf(
- "Press a key on the console to abort clock calibration\n");
- while (cncheckc() == -1)
- calibrate_clocks();
- }
-#endif
-
- /*
- * Use the calibrated i8254 frequency if it seems reasonable.
- * Otherwise use the default, and don't use the calibrated i586
- * frequency.
- */
- delta = freq > timer_freq ? freq - timer_freq : timer_freq - freq;
- if (delta < timer_freq / 100) {
-#ifndef CLK_USE_I8254_CALIBRATION
- if (bootverbose)
- printf(
-"CLK_USE_I8254_CALIBRATION not specified - using default frequency\n");
- freq = timer_freq;
-#endif
- timer_freq = freq;
- } else {
- if (bootverbose)
- printf(
- "%d Hz differs from default of %d Hz by more than 1%%\n",
- freq, timer_freq);
- }
-
- set_timer_freq(timer_freq, hz);
- tc_init(&i8254_timecounter);
-
- init_TSC();
-}
-
-/*
- * Initialize the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-void
-inittodr(time_t base)
-{
- unsigned long sec, days;
- int year, month;
- int y, m, s;
- struct timespec ts;
-
- if (base) {
- s = splclock();
- ts.tv_sec = base;
- ts.tv_nsec = 0;
- tc_setclock(&ts);
- splx(s);
- }
-
- /* Look if we have a RTC present and the time is valid */
- if (!(rtcin(RTC_STATUSD) & RTCSD_PWR))
- goto wrong_time;
-
- /* wait for time update to complete */
- /* If RTCSA_TUP is zero, we have at least 244us before next update */
- s = splhigh();
- while (rtcin(RTC_STATUSA) & RTCSA_TUP) {
- splx(s);
- s = splhigh();
- }
-
- days = 0;
-#ifdef USE_RTC_CENTURY
- year = readrtc(RTC_YEAR) + readrtc(RTC_CENTURY) * 100;
-#else
- year = readrtc(RTC_YEAR) + 1900;
- if (year < 1970)
- year += 100;
-#endif
- if (year < 1970) {
- splx(s);
- goto wrong_time;
- }
- month = readrtc(RTC_MONTH);
- for (m = 1; m < month; m++)
- days += daysinmonth[m-1];
- if ((month > 2) && LEAPYEAR(year))
- days ++;
- days += readrtc(RTC_DAY) - 1;
- for (y = 1970; y < year; y++)
- days += DAYSPERYEAR + LEAPYEAR(y);
- sec = ((( days * 24 +
- readrtc(RTC_HRS)) * 60 +
- readrtc(RTC_MIN)) * 60 +
- readrtc(RTC_SEC));
- /* sec now contains the number of seconds, since Jan 1 1970,
- in the local time zone */
-
- sec += tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
-
- y = time_second - sec;
- if (y <= -2 || y >= 2) {
- /* badly off, adjust it */
- ts.tv_sec = sec;
- ts.tv_nsec = 0;
- tc_setclock(&ts);
- }
- splx(s);
- return;
-
-wrong_time:
- printf("Invalid time in real time clock.\n");
- printf("Check and reset the date immediately!\n");
-}
-
-/*
- * Write system time back to RTC
- */
-void
-resettodr()
-{
- unsigned long tm;
- int y, m, s;
-
- if (disable_rtc_set)
- return;
-
- s = splclock();
- tm = time_second;
- splx(s);
-
- /* Disable RTC updates and interrupts. */
- writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
-
- /* Calculate local time to put in RTC */
-
- tm -= tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
-
- writertc(RTC_SEC, bin2bcd(tm%60)); tm /= 60; /* Write back Seconds */
- writertc(RTC_MIN, bin2bcd(tm%60)); tm /= 60; /* Write back Minutes */
- writertc(RTC_HRS, bin2bcd(tm%24)); tm /= 24; /* Write back Hours */
-
- /* We have now the days since 01-01-1970 in tm */
- writertc(RTC_WDAY, (tm + 4) % 7 + 1); /* Write back Weekday */
- for (y = 1970, m = DAYSPERYEAR + LEAPYEAR(y);
- tm >= m;
- y++, m = DAYSPERYEAR + LEAPYEAR(y))
- tm -= m;
-
- /* Now we have the years in y and the day-of-the-year in tm */
- writertc(RTC_YEAR, bin2bcd(y%100)); /* Write back Year */
-#ifdef USE_RTC_CENTURY
- writertc(RTC_CENTURY, bin2bcd(y/100)); /* ... and Century */
-#endif
- for (m = 0; ; m++) {
- int ml;
-
- ml = daysinmonth[m];
- if (m == 1 && LEAPYEAR(y))
- ml++;
- if (tm < ml)
- break;
- tm -= ml;
- }
-
- writertc(RTC_MONTH, bin2bcd(m + 1)); /* Write back Month */
- writertc(RTC_DAY, bin2bcd(tm + 1)); /* Write back Month Day */
-
- /* Reenable RTC updates and interrupts. */
- writertc(RTC_STATUSB, rtc_statusb);
- rtcin(RTC_INTR);
-}
-
-
-/*
- * Start both clocks running.
- */
-void
-cpu_initclocks()
-{
- int diag;
-
-#ifdef DEV_APIC
- using_lapic_timer = lapic_setup_clock();
-#endif
- /*
- * If we aren't using the local APIC timer to drive the kernel
- * clocks, setup the interrupt handler for the 8254 timer 0 so
- * that it can drive hardclock(). Otherwise, change the 8254
- * timecounter to user a simpler algorithm.
- */
- if (!using_lapic_timer) {
- intr_add_handler("clk", 0, (driver_intr_t *)clkintr, NULL,
- INTR_TYPE_CLK | INTR_FAST, NULL);
- i8254_intsrc = intr_lookup_source(0);
- if (i8254_intsrc != NULL)
- i8254_pending =
- i8254_intsrc->is_pic->pic_source_pending;
- } else {
- i8254_timecounter.tc_get_timecount =
- i8254_simple_get_timecount;
- i8254_timecounter.tc_counter_mask = 0xffff;
- set_timer_freq(timer_freq, hz);
- }
-
- /* Initialize RTC. */
- writertc(RTC_STATUSA, rtc_statusa);
- writertc(RTC_STATUSB, RTCSB_24HR);
-
- /*
- * If the separate statistics clock hasn't been explicility disabled
- * and we aren't already using the local APIC timer to drive the
- * kernel clocks, then setup the RTC to periodically interrupt to
- * drive statclock() and profclock().
- */
- if (!statclock_disable && !using_lapic_timer) {
- diag = rtcin(RTC_DIAG);
- if (diag != 0)
- printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS);
-
- /* Setting stathz to nonzero early helps avoid races. */
- stathz = RTC_NOPROFRATE;
- profhz = RTC_PROFRATE;
-
- /* Enable periodic interrupts from the RTC. */
- rtc_statusb |= RTCSB_PINTR;
- intr_add_handler("rtc", 8, (driver_intr_t *)rtcintr, NULL,
- INTR_TYPE_CLK | INTR_FAST, NULL);
-
- writertc(RTC_STATUSB, rtc_statusb);
- rtcin(RTC_INTR);
- }
-
- init_TSC_tc();
-}
-
-void
-cpu_startprofclock(void)
-{
-
- if (using_lapic_timer)
- return;
- rtc_statusa = RTCSA_DIVIDER | RTCSA_PROF;
- writertc(RTC_STATUSA, rtc_statusa);
- psdiv = pscnt = psratio;
-}
-
-void
-cpu_stopprofclock(void)
-{
-
- if (using_lapic_timer)
- return;
- rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
- writertc(RTC_STATUSA, rtc_statusa);
- psdiv = pscnt = 1;
-}
-
-static int
-sysctl_machdep_i8254_freq(SYSCTL_HANDLER_ARGS)
-{
- int error;
- u_int freq;
-
- /*
- * Use `i8254' instead of `timer' in external names because `timer'
- * is is too generic. Should use it everywhere.
- */
- freq = timer_freq;
- error = sysctl_handle_int(oidp, &freq, sizeof(freq), req);
- if (error == 0 && req->newptr != NULL)
- set_timer_freq(freq, hz);
- return (error);
-}
-
-SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
- 0, sizeof(u_int), sysctl_machdep_i8254_freq, "IU", "");
-
-static unsigned
-i8254_simple_get_timecount(struct timecounter *tc)
-{
- u_int count;
- u_int high, low;
-
- mtx_lock_spin(&clock_lock);
-
- /* Select timer0 and latch counter value. */
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
-
- low = inb(TIMER_CNTR0);
- high = inb(TIMER_CNTR0);
- count = 0xffff - ((high << 8) | low);
- mtx_unlock_spin(&clock_lock);
- return (count);
-}
-
-static unsigned
-i8254_get_timecount(struct timecounter *tc)
-{
- u_int count;
- u_int high, low;
- u_int eflags;
-
- eflags = read_eflags();
- mtx_lock_spin(&clock_lock);
-
- /* Select timer0 and latch counter value. */
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
-
- low = inb(TIMER_CNTR0);
- high = inb(TIMER_CNTR0);
- count = timer0_max_count - ((high << 8) | low);
- if (count < i8254_lastcount ||
- (!i8254_ticked && (clkintr_pending ||
- ((count < 20 || (!(eflags & PSL_I) && count < timer0_max_count / 2u)) &&
- i8254_pending != NULL && i8254_pending(i8254_intsrc))))) {
- i8254_ticked = 1;
- i8254_offset += timer0_max_count;
- }
- i8254_lastcount = count;
- count += i8254_offset;
- mtx_unlock_spin(&clock_lock);
- return (count);
-}
-
-#ifdef DEV_ISA
-/*
- * Attach to the ISA PnP descriptors for the timer and realtime clock.
- */
-static struct isa_pnp_id attimer_ids[] = {
- { 0x0001d041 /* PNP0100 */, "AT timer" },
- { 0x000bd041 /* PNP0B00 */, "AT realtime clock" },
- { 0 }
-};
-
-static int
-attimer_probe(device_t dev)
-{
- int result;
-
- if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, attimer_ids)) <= 0)
- device_quiet(dev);
- return(result);
-}
-
-static int
-attimer_attach(device_t dev)
-{
- return(0);
-}
-
-static device_method_t attimer_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, attimer_probe),
- DEVMETHOD(device_attach, attimer_attach),
- DEVMETHOD(device_detach, bus_generic_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend), /* XXX stop statclock? */
- DEVMETHOD(device_resume, bus_generic_resume), /* XXX restart statclock? */
- { 0, 0 }
-};
-
-static driver_t attimer_driver = {
- "attimer",
- attimer_methods,
- 1, /* no softc */
-};
-
-static devclass_t attimer_devclass;
-
-DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
-DRIVER_MODULE(attimer, acpi, attimer_driver, attimer_devclass, 0, 0);
-#endif /* DEV_ISA */
diff --git a/sys/kern/ksched.c b/sys/kern/ksched.c
deleted file mode 100644
index a266c57..0000000
--- a/sys/kern/ksched.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*-
- * Copyright (c) 1996, 1997
- * HD Associates, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by HD Associates, Inc
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* ksched: Soft real time scheduling based on "rtprio".
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_posix.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/resource.h>
-#include <sys/sched.h>
-
-#include <posix4/posix4.h>
-
-/* ksched: Real-time extension to support POSIX priority scheduling.
- */
-
-struct ksched {
- struct timespec rr_interval;
-};
-
-int ksched_attach(struct ksched **p)
-{
- struct ksched *ksched= p31b_malloc(sizeof(*ksched));
-
- ksched->rr_interval.tv_sec = 0;
- ksched->rr_interval.tv_nsec = 1000000000L / sched_rr_interval();
-
- *p = ksched;
- return 0;
-}
-
-int ksched_detach(struct ksched *ks)
-{
- p31b_free(ks);
-
- return 0;
-}
-
-/*
- * XXX About priorities
- *
- * POSIX 1003.1b requires that numerically higher priorities be of
- * higher priority. It also permits sched_setparam to be
- * implementation defined for SCHED_OTHER. I don't like
- * the notion of inverted priorites for normal processes when
- * you can use "setpriority" for that.
- *
- * I'm rejecting sched_setparam for SCHED_OTHER with EINVAL.
- */
-
-/* Macros to convert between the unix (lower numerically is higher priority)
- * and POSIX 1003.1b (higher numerically is higher priority)
- */
-
-#define p4prio_to_rtpprio(P) (RTP_PRIO_MAX - (P))
-#define rtpprio_to_p4prio(P) (RTP_PRIO_MAX - (P))
-
-/* These improve readability a bit for me:
- */
-#define P1B_PRIO_MIN rtpprio_to_p4prio(RTP_PRIO_MAX)
-#define P1B_PRIO_MAX rtpprio_to_p4prio(RTP_PRIO_MIN)
-
-static __inline int
-getscheduler(register_t *ret, struct ksched *ksched, struct thread *td)
-{
- struct rtprio rtp;
- int e = 0;
-
- mtx_lock_spin(&sched_lock);
- pri_to_rtp(td->td_ksegrp, &rtp);
- mtx_unlock_spin(&sched_lock);
- switch (rtp.type)
- {
- case RTP_PRIO_FIFO:
- *ret = SCHED_FIFO;
- break;
-
- case RTP_PRIO_REALTIME:
- *ret = SCHED_RR;
- break;
-
- default:
- *ret = SCHED_OTHER;
- break;
- }
-
- return e;
-}
-
-int ksched_setparam(register_t *ret, struct ksched *ksched,
- struct thread *td, const struct sched_param *param)
-{
- register_t policy;
- int e;
-
- e = getscheduler(&policy, ksched, td);
-
- if (e == 0)
- {
- if (policy == SCHED_OTHER)
- e = EINVAL;
- else
- e = ksched_setscheduler(ret, ksched, td, policy, param);
- }
-
- return e;
-}
-
-int ksched_getparam(register_t *ret, struct ksched *ksched,
- struct thread *td, struct sched_param *param)
-{
- struct rtprio rtp;
-
- mtx_lock_spin(&sched_lock);
- pri_to_rtp(td->td_ksegrp, &rtp);
- mtx_unlock_spin(&sched_lock);
- if (RTP_PRIO_IS_REALTIME(rtp.type))
- param->sched_priority = rtpprio_to_p4prio(rtp.prio);
-
- return 0;
-}
-
-/*
- * XXX The priority and scheduler modifications should
- * be moved into published interfaces in kern/kern_sync.
- *
- * The permissions to modify process p were checked in "p31b_proc()".
- *
- */
-int ksched_setscheduler(register_t *ret, struct ksched *ksched,
- struct thread *td, int policy, const struct sched_param *param)
-{
- int e = 0;
- struct rtprio rtp;
- struct ksegrp *kg = td->td_ksegrp;
-
- switch(policy)
- {
- case SCHED_RR:
- case SCHED_FIFO:
-
- if (param->sched_priority >= P1B_PRIO_MIN &&
- param->sched_priority <= P1B_PRIO_MAX)
- {
- rtp.prio = p4prio_to_rtpprio(param->sched_priority);
- rtp.type = (policy == SCHED_FIFO)
- ? RTP_PRIO_FIFO : RTP_PRIO_REALTIME;
-
- mtx_lock_spin(&sched_lock);
- rtp_to_pri(&rtp, kg);
- FOREACH_THREAD_IN_GROUP(kg, td) { /* XXXKSE */
- if (TD_IS_RUNNING(td)) {
- td->td_flags |= TDF_NEEDRESCHED;
- } else if (TD_ON_RUNQ(td)) {
- if (td->td_priority > kg->kg_user_pri) {
- sched_prio(td, kg->kg_user_pri);
- }
- }
- }
- mtx_unlock_spin(&sched_lock);
- }
- else
- e = EPERM;
-
-
- break;
-
- case SCHED_OTHER:
- {
- rtp.type = RTP_PRIO_NORMAL;
- rtp.prio = p4prio_to_rtpprio(param->sched_priority);
- mtx_lock_spin(&sched_lock);
- rtp_to_pri(&rtp, kg);
-
- /* XXX Simply revert to whatever we had for last
- * normal scheduler priorities.
- * This puts a requirement
- * on the scheduling code: You must leave the
- * scheduling info alone.
- */
- FOREACH_THREAD_IN_GROUP(kg, td) {
- if (TD_IS_RUNNING(td)) {
- td->td_flags |= TDF_NEEDRESCHED;
- } else if (TD_ON_RUNQ(td)) {
- if (td->td_priority > kg->kg_user_pri) {
- sched_prio(td, kg->kg_user_pri);
- }
- }
-
- }
- mtx_unlock_spin(&sched_lock);
- }
- break;
-
- default:
- e = EINVAL;
- break;
- }
-
- return e;
-}
-
-int ksched_getscheduler(register_t *ret, struct ksched *ksched, struct thread *td)
-{
- return getscheduler(ret, ksched, td);
-}
-
-/* ksched_yield: Yield the CPU.
- */
-int ksched_yield(register_t *ret, struct ksched *ksched)
-{
- mtx_lock_spin(&sched_lock);
- curthread->td_flags |= TDF_NEEDRESCHED;
- mtx_unlock_spin(&sched_lock);
- return 0;
-}
-
-int ksched_get_priority_max(register_t*ret, struct ksched *ksched, int policy)
-{
- int e = 0;
-
- switch (policy)
- {
- case SCHED_FIFO:
- case SCHED_RR:
- *ret = RTP_PRIO_MAX;
- break;
-
- case SCHED_OTHER:
- *ret = PRIO_MAX;
- break;
-
- default:
- e = EINVAL;
- }
-
- return e;
-}
-
-int ksched_get_priority_min(register_t *ret, struct ksched *ksched, int policy)
-{
- int e = 0;
-
- switch (policy)
- {
- case SCHED_FIFO:
- case SCHED_RR:
- *ret = P1B_PRIO_MIN;
- break;
-
- case SCHED_OTHER:
- *ret = PRIO_MIN;
- break;
-
- default:
- e = EINVAL;
- }
-
- return e;
-}
-
-int ksched_rr_get_interval(register_t *ret, struct ksched *ksched,
- struct thread *td, struct timespec *timespec)
-{
- *timespec = ksched->rr_interval;
-
- return 0;
-}
diff --git a/sys/kern/p1003_1b.c b/sys/kern/p1003_1b.c
deleted file mode 100644
index 7f366f1..0000000
--- a/sys/kern/p1003_1b.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/*-
- * Copyright (c) 1996, 1997, 1998
- * HD Associates, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by HD Associates, Inc
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* p1003_1b: Real Time common code.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_posix.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/module.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/syscallsubr.h>
-#include <sys/sysctl.h>
-#include <sys/sysent.h>
-#include <sys/syslog.h>
-#include <sys/sysproto.h>
-
-#include <posix4/posix4.h>
-
-MALLOC_DEFINE(M_P31B, "p1003.1b", "Posix 1003.1B");
-
-/* The system calls return ENOSYS if an entry is called that is
- * not run-time supported. I am also logging since some programs
- * start to use this when they shouldn't. That will be removed if annoying.
- */
-int
-syscall_not_present(struct thread *td, const char *s, struct nosys_args *uap)
-{
- log(LOG_ERR, "cmd %s pid %d tried to use non-present %s\n",
- td->td_proc->p_comm, td->td_proc->p_pid, s);
-
- /* a " return nosys(p, uap); " here causes a core dump.
- */
-
- return ENOSYS;
-}
-
-#if !defined(_KPOSIX_PRIORITY_SCHEDULING)
-
-/* Not configured but loadable via a module:
- */
-
-static int sched_attach(void)
-{
- return 0;
-}
-
-SYSCALL_NOT_PRESENT_GEN(sched_setparam)
-SYSCALL_NOT_PRESENT_GEN(sched_getparam)
-SYSCALL_NOT_PRESENT_GEN(sched_setscheduler)
-SYSCALL_NOT_PRESENT_GEN(sched_getscheduler)
-SYSCALL_NOT_PRESENT_GEN(sched_yield)
-SYSCALL_NOT_PRESENT_GEN(sched_get_priority_max)
-SYSCALL_NOT_PRESENT_GEN(sched_get_priority_min)
-SYSCALL_NOT_PRESENT_GEN(sched_rr_get_interval)
-
-#else
-
-/* Configured in kernel version:
- */
-static struct ksched *ksched;
-
-static int sched_attach(void)
-{
- int ret = ksched_attach(&ksched);
-
- if (ret == 0)
- p31b_setcfg(CTL_P1003_1B_PRIORITY_SCHEDULING, 1);
-
- return ret;
-}
-
-/*
- * MPSAFE
- */
-int sched_setparam(struct thread *td,
- struct sched_setparam_args *uap)
-{
- struct thread *targettd;
- struct proc *targetp;
- int e;
- struct sched_param sched_param;
-
- e = copyin(uap->param, &sched_param, sizeof(sched_param));
- if (e)
- return (e);
-
- mtx_lock(&Giant);
- if (uap->pid == 0) {
- targetp = td->td_proc;
- targettd = td;
- PROC_LOCK(targetp);
- } else {
- targetp = pfind(uap->pid);
- if (targetp == NULL) {
- e = ESRCH;
- goto done2;
- }
- targettd = FIRST_THREAD_IN_PROC(targetp); /* XXXKSE */
- }
-
- e = p_cansched(td, targetp);
- PROC_UNLOCK(targetp);
- if (e == 0) {
- e = ksched_setparam(&td->td_retval[0], ksched, targettd,
- (const struct sched_param *)&sched_param);
- }
-done2:
- mtx_unlock(&Giant);
- return (e);
-}
-
-/*
- * MPSAFE
- */
-int sched_getparam(struct thread *td,
- struct sched_getparam_args *uap)
-{
- int e;
- struct sched_param sched_param;
- struct thread *targettd;
- struct proc *targetp;
-
- mtx_lock(&Giant);
- if (uap->pid == 0) {
- targetp = td->td_proc;
- targettd = td;
- PROC_LOCK(targetp);
- } else {
- targetp = pfind(uap->pid);
- if (targetp == NULL) {
- e = ESRCH;
- goto done2;
- }
- targettd = FIRST_THREAD_IN_PROC(targetp); /* XXXKSE */
- }
-
- e = p_cansee(td, targetp);
- PROC_UNLOCK(targetp);
- if (e)
- goto done2;
-
- e = ksched_getparam(&td->td_retval[0], ksched, targettd, &sched_param);
- if (e == 0)
- e = copyout(&sched_param, uap->param, sizeof(sched_param));
-done2:
- mtx_unlock(&Giant);
- return (e);
-}
-
-/*
- * MPSAFE
- */
-int sched_setscheduler(struct thread *td,
- struct sched_setscheduler_args *uap)
-{
- int e;
- struct sched_param sched_param;
- struct thread *targettd;
- struct proc *targetp;
-
- e = copyin(uap->param, &sched_param, sizeof(sched_param));
- if (e)
- return (e);
-
- mtx_lock(&Giant);
- if (uap->pid == 0) {
- targetp = td->td_proc;
- targettd = td;
- PROC_LOCK(targetp);
- } else {
- targetp = pfind(uap->pid);
- if (targetp == NULL) {
- e = ESRCH;
- goto done2;
- }
- targettd = FIRST_THREAD_IN_PROC(targetp); /* XXXKSE */
- }
-
- e = p_cansched(td, targetp);
- PROC_UNLOCK(targetp);
- if (e == 0) {
- e = ksched_setscheduler(&td->td_retval[0], ksched, targettd,
- uap->policy, (const struct sched_param *)&sched_param);
- }
-done2:
- mtx_unlock(&Giant);
- return (e);
-}
-
-/*
- * MPSAFE
- */
-int sched_getscheduler(struct thread *td,
- struct sched_getscheduler_args *uap)
-{
- int e;
- struct thread *targettd;
- struct proc *targetp;
-
- mtx_lock(&Giant);
- if (uap->pid == 0) {
- targetp = td->td_proc;
- targettd = td;
- PROC_LOCK(targetp);
- } else {
- targetp = pfind(uap->pid);
- if (targetp == NULL) {
- e = ESRCH;
- goto done2;
- }
- targettd = FIRST_THREAD_IN_PROC(targetp); /* XXXKSE */
- }
-
- e = p_cansee(td, targetp);
- PROC_UNLOCK(targetp);
- if (e == 0)
- e = ksched_getscheduler(&td->td_retval[0], ksched, targettd);
-
-done2:
- mtx_unlock(&Giant);
- return (e);
-}
-
-/*
- * MPSAFE
- */
-int sched_yield(struct thread *td,
- struct sched_yield_args *uap)
-{
- int error;
-
- mtx_lock(&Giant);
- error = ksched_yield(&td->td_retval[0], ksched);
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int sched_get_priority_max(struct thread *td,
- struct sched_get_priority_max_args *uap)
-{
- int error;
-
- mtx_lock(&Giant);
- error = ksched_get_priority_max(&td->td_retval[0], ksched, uap->policy);
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int sched_get_priority_min(struct thread *td,
- struct sched_get_priority_min_args *uap)
-{
- int error;
-
- mtx_lock(&Giant);
- error = ksched_get_priority_min(&td->td_retval[0], ksched, uap->policy);
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int sched_rr_get_interval(struct thread *td,
- struct sched_rr_get_interval_args *uap)
-{
- struct timespec timespec;
- int error;
-
- error = kern_sched_rr_get_interval(td, uap->pid, &timespec);
- if (error == 0)
- error = copyout(&timespec, uap->interval, sizeof(timespec));
- return (error);
-}
-
-int kern_sched_rr_get_interval(struct thread *td, pid_t pid,
- struct timespec *ts)
-{
- int e;
- struct thread *targettd;
- struct proc *targetp;
-
- mtx_lock(&Giant);
- if (pid == 0) {
- targettd = td;
- targetp = td->td_proc;
- PROC_LOCK(targetp);
- } else {
- targetp = pfind(pid);
- if (targetp == NULL) {
- mtx_unlock(&Giant);
- return (ESRCH);
- }
- targettd = FIRST_THREAD_IN_PROC(targetp); /* XXXKSE */
- }
-
- e = p_cansee(td, targetp);
- if (e == 0)
- e = ksched_rr_get_interval(&td->td_retval[0], ksched, targettd,
- ts);
- PROC_UNLOCK(targetp);
- mtx_unlock(&Giant);
- return (e);
-}
-
-#endif
-
-static void p31binit(void *notused)
-{
- (void) sched_attach();
- p31b_setcfg(CTL_P1003_1B_PAGESIZE, PAGE_SIZE);
-}
-
-SYSINIT(p31b, SI_SUB_P1003_1B, SI_ORDER_FIRST, p31binit, NULL);
diff --git a/sys/kern/posix4_mib.c b/sys/kern/posix4_mib.c
deleted file mode 100644
index 1909216..0000000
--- a/sys/kern/posix4_mib.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * Copyright (c) 1998
- * HD Associates, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by HD Associates, Inc
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/queue.h>
-#include <sys/sysctl.h>
-#include <sys/vnode.h>
-#include <posix4/posix4.h>
-
-static int facility[CTL_P1003_1B_MAXID - 1];
-static int facility_initialized[CTL_P1003_1B_MAXID - 1];
-
-/* OID_AUTO isn't working with sysconf(3). I guess I'd have to
- * modify it to do a lookup by name from the index.
- * For now I've left it a top-level sysctl.
- */
-
-#if 1
-
-SYSCTL_DECL(_p1003_1b);
-
-#define P1B_SYSCTL(num, name) \
-SYSCTL_INT(_p1003_1b, num, \
- name, CTLFLAG_RD, facility + num - 1, 0, "");
-
-#else
-
-SYSCTL_DECL(_kern_p1003_1b);
-
-#define P1B_SYSCTL(num, name) \
-SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \
- name, CTLFLAG_RD, facility + num - 1, 0, "");
-SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B");
-
-#endif
-
-SYSCTL_INT(_p1003_1b, CTL_P1003_1B_ASYNCHRONOUS_IO, \
- asynchronous_io, CTLFLAG_RD, &async_io_version, 0, "");
-P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files);
-P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock);
-P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range);
-P1B_SYSCTL(CTL_P1003_1B_MEMORY_PROTECTION, memory_protection);
-P1B_SYSCTL(CTL_P1003_1B_MESSAGE_PASSING, message_passing);
-P1B_SYSCTL(CTL_P1003_1B_PRIORITIZED_IO, prioritized_io);
-P1B_SYSCTL(CTL_P1003_1B_PRIORITY_SCHEDULING, priority_scheduling);
-P1B_SYSCTL(CTL_P1003_1B_REALTIME_SIGNALS, realtime_signals);
-P1B_SYSCTL(CTL_P1003_1B_SEMAPHORES, semaphores);
-P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync);
-P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects);
-P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io);
-P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers);
-P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max);
-P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max);
-P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max);
-P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max);
-P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max);
-P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize);
-P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max);
-P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max);
-P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max);
-P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max);
-P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max);
-
-#define P31B_VALID(num) ((num) >= 1 && (num) < CTL_P1003_1B_MAXID)
-
-/* p31b_setcfg: Set the configuration
- */
-void
-p31b_setcfg(int num, int value)
-{
-
- if (P31B_VALID(num)) {
- facility[num - 1] = value;
- facility_initialized[num - 1] = 1;
- }
-}
-
-int
-p31b_getcfg(int num)
-{
-
- if (P31B_VALID(num))
- return (facility[num - 1]);
- return (0);
-}
-
-int
-p31b_iscfg(int num)
-{
-
- if (P31B_VALID(num))
- return (facility_initialized[num - 1]);
- return (0);
-}
-
-/*
- * Turn on indications for standard (non-configurable) kernel features.
- */
-static void
-p31b_set_standard(void *dummy)
-{
- /* ??? p31b_setcfg(CTL_P1003_1B_FSYNC, 1); */
- p31b_setcfg(CTL_P1003_1B_MAPPED_FILES, 1);
- p31b_setcfg(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, 1);
- p31b_setcfg(CTL_P1003_1B_PAGESIZE, PAGE_SIZE);
- if (!p31b_iscfg(CTL_P1003_1B_AIO_LISTIO_MAX))
- p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, -1);
- if (!p31b_iscfg(CTL_P1003_1B_AIO_MAX))
- p31b_setcfg(CTL_P1003_1B_AIO_MAX, -1);
- if (!p31b_iscfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX))
- p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, -1);
-}
-
-SYSINIT(p31b_set_standard, SI_SUB_P1003_1B, SI_ORDER_ANY, p31b_set_standard,
- 0);
-
diff --git a/sys/kern/subr_acl_posix1e.c b/sys/kern/subr_acl_posix1e.c
deleted file mode 100644
index 7beca5c..0000000
--- a/sys/kern/subr_acl_posix1e.c
+++ /dev/null
@@ -1,1023 +0,0 @@
-/*-
- * Copyright (c) 1999-2003 Robert N. M. Watson
- * All rights reserved.
- *
- * This software was developed by Robert Watson for the TrustedBSD Project.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-/*
- * Developed by the TrustedBSD Project.
- * Support for POSIX.1e access control lists.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_mac.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/kernel.h>
-#include <sys/mac.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/namei.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/proc.h>
-#include <sys/sysent.h>
-#include <sys/errno.h>
-#include <sys/stat.h>
-#include <sys/acl.h>
-
-MALLOC_DEFINE(M_ACL, "acl", "access control list");
-
-static int vacl_set_acl(struct thread *td, struct vnode *vp,
- acl_type_t type, struct acl *aclp);
-static int vacl_get_acl(struct thread *td, struct vnode *vp,
- acl_type_t type, struct acl *aclp);
-static int vacl_aclcheck(struct thread *td, struct vnode *vp,
- acl_type_t type, struct acl *aclp);
-
-/*
- * Implement a version of vaccess() that understands POSIX.1e ACL semantics.
- * Return 0 on success, else an errno value. Should be merged into
- * vaccess() eventually.
- */
-int
-vaccess_acl_posix1e(enum vtype type, uid_t file_uid, gid_t file_gid,
- struct acl *acl, mode_t acc_mode, struct ucred *cred, int *privused)
-{
- struct acl_entry *acl_other, *acl_mask;
- mode_t dac_granted;
- mode_t cap_granted;
- mode_t acl_mask_granted;
- int group_matched, i;
-
- /*
- * Look for a normal, non-privileged way to access the file/directory
- * as requested. If it exists, go with that. Otherwise, attempt
- * to use privileges granted via cap_granted. In some cases,
- * which privileges to use may be ambiguous due to "best match",
- * in which case fall back on first match for the time being.
- */
- if (privused != NULL)
- *privused = 0;
-
- /*
- * Determine privileges now, but don't apply until we've found
- * a DAC entry that matches but has failed to allow access.
- */
-#ifndef CAPABILITIES
- if (suser_cred(cred, SUSER_ALLOWJAIL) == 0)
- cap_granted = VALLPERM;
- else
- cap_granted = 0;
-#else
- cap_granted = 0;
-
- if (type == VDIR) {
- if ((acc_mode & VEXEC) && !cap_check(cred, NULL,
- CAP_DAC_READ_SEARCH, SUSER_ALLOWJAIL))
- cap_granted |= VEXEC;
- } else {
- if ((acc_mode & VEXEC) && !cap_check(cred, NULL,
- CAP_DAC_EXECUTE, SUSER_ALLOWJAIL))
- cap_granted |= VEXEC;
- }
-
- if ((acc_mode & VREAD) && !cap_check(cred, NULL, CAP_DAC_READ_SEARCH,
- SUSER_ALLOWJAIL))
- cap_granted |= VREAD;
-
- if (((acc_mode & VWRITE) || (acc_mode & VAPPEND)) &&
- !cap_check(cred, NULL, CAP_DAC_WRITE, SUSER_ALLOWJAIL))
- cap_granted |= (VWRITE | VAPPEND);
-
- if ((acc_mode & VADMIN) && !cap_check(cred, NULL, CAP_FOWNER,
- SUSER_ALLOWJAIL))
- cap_granted |= VADMIN;
-#endif /* CAPABILITIES */
-
- /*
- * The owner matches if the effective uid associated with the
- * credential matches that of the ACL_USER_OBJ entry. While we're
- * doing the first scan, also cache the location of the ACL_MASK
- * and ACL_OTHER entries, preventing some future iterations.
- */
- acl_mask = acl_other = NULL;
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_USER_OBJ:
- if (file_uid != cred->cr_uid)
- break;
- dac_granted = 0;
- dac_granted |= VADMIN;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
- if ((acc_mode & (dac_granted | cap_granted)) ==
- acc_mode) {
- if (privused != NULL)
- *privused = 1;
- return (0);
- }
- goto error;
-
- case ACL_MASK:
- acl_mask = &acl->acl_entry[i];
- break;
-
- case ACL_OTHER:
- acl_other = &acl->acl_entry[i];
- break;
-
- default:
- break;
- }
- }
-
- /*
- * An ACL_OTHER entry should always exist in a valid access
- * ACL. If it doesn't, then generate a serious failure. For now,
- * this means a debugging message and EPERM, but in the future
- * should probably be a panic.
- */
- if (acl_other == NULL) {
- /*
- * XXX This should never happen
- */
- printf("vaccess_acl_posix1e: ACL_OTHER missing\n");
- return (EPERM);
- }
-
- /*
- * Checks against ACL_USER, ACL_GROUP_OBJ, and ACL_GROUP fields
- * are masked by an ACL_MASK entry, if any. As such, first identify
- * the ACL_MASK field, then iterate through identifying potential
- * user matches, then group matches. If there is no ACL_MASK,
- * assume that the mask allows all requests to succeed.
- */
- if (acl_mask != NULL) {
- acl_mask_granted = 0;
- if (acl_mask->ae_perm & ACL_EXECUTE)
- acl_mask_granted |= VEXEC;
- if (acl_mask->ae_perm & ACL_READ)
- acl_mask_granted |= VREAD;
- if (acl_mask->ae_perm & ACL_WRITE)
- acl_mask_granted |= (VWRITE | VAPPEND);
- } else
- acl_mask_granted = VEXEC | VREAD | VWRITE | VAPPEND;
-
- /*
- * Iterate through user ACL entries. Do checks twice, first
- * without privilege, and then if a match is found but failed,
- * a second time with privilege.
- */
-
- /*
- * Check ACL_USER ACL entries.
- */
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_USER:
- if (acl->acl_entry[i].ae_id != cred->cr_uid)
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
- if ((acc_mode & (dac_granted | cap_granted)) !=
- acc_mode)
- goto error;
-
- if (privused != NULL)
- *privused = 1;
- return (0);
- }
- }
-
- /*
- * Group match is best-match, not first-match, so find a
- * "best" match. Iterate across, testing each potential group
- * match. Make sure we keep track of whether we found a match
- * or not, so that we know if we should try again with any
- * available privilege, or if we should move on to ACL_OTHER.
- */
- group_matched = 0;
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_GROUP_OBJ:
- if (!groupmember(file_gid, cred))
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
-
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
-
- group_matched = 1;
- break;
-
- case ACL_GROUP:
- if (!groupmember(acl->acl_entry[i].ae_id, cred))
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
-
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
-
- group_matched = 1;
- break;
-
- default:
- break;
- }
- }
-
- if (group_matched == 1) {
- /*
- * There was a match, but it did not grant rights via
- * pure DAC. Try again, this time with privilege.
- */
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_GROUP_OBJ:
- if (!groupmember(file_gid, cred))
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
-
- if ((acc_mode & (dac_granted | cap_granted)) !=
- acc_mode)
- break;
-
- if (privused != NULL)
- *privused = 1;
- return (0);
-
- case ACL_GROUP:
- if (!groupmember(acl->acl_entry[i].ae_id,
- cred))
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
-
- if ((acc_mode & (dac_granted | cap_granted)) !=
- acc_mode)
- break;
-
- if (privused != NULL)
- *privused = 1;
- return (0);
-
- default:
- break;
- }
- }
- /*
- * Even with privilege, group membership was not sufficient.
- * Return failure.
- */
- goto error;
- }
-
- /*
- * Fall back on ACL_OTHER. ACL_MASK is not applied to ACL_OTHER.
- */
- dac_granted = 0;
- if (acl_other->ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl_other->ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl_other->ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
-
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
- if ((acc_mode & (dac_granted | cap_granted)) == acc_mode) {
- if (privused != NULL)
- *privused = 1;
- return (0);
- }
-
-error:
- return ((acc_mode & VADMIN) ? EPERM : EACCES);
-}
-
-/*
- * For the purposes of filesystems maintaining the _OBJ entries in an
- * inode with a mode_t field, this routine converts a mode_t entry
- * to an acl_perm_t.
- */
-acl_perm_t
-acl_posix1e_mode_to_perm(acl_tag_t tag, mode_t mode)
-{
- acl_perm_t perm = 0;
-
- switch(tag) {
- case ACL_USER_OBJ:
- if (mode & S_IXUSR)
- perm |= ACL_EXECUTE;
- if (mode & S_IRUSR)
- perm |= ACL_READ;
- if (mode & S_IWUSR)
- perm |= ACL_WRITE;
- return (perm);
-
- case ACL_GROUP_OBJ:
- if (mode & S_IXGRP)
- perm |= ACL_EXECUTE;
- if (mode & S_IRGRP)
- perm |= ACL_READ;
- if (mode & S_IWGRP)
- perm |= ACL_WRITE;
- return (perm);
-
- case ACL_OTHER:
- if (mode & S_IXOTH)
- perm |= ACL_EXECUTE;
- if (mode & S_IROTH)
- perm |= ACL_READ;
- if (mode & S_IWOTH)
- perm |= ACL_WRITE;
- return (perm);
-
- default:
- printf("acl_posix1e_mode_to_perm: invalid tag (%d)\n", tag);
- return (0);
- }
-}
-
-/*
- * Given inode information (uid, gid, mode), return an acl entry of the
- * appropriate type.
- */
-struct acl_entry
-acl_posix1e_mode_to_entry(acl_tag_t tag, uid_t uid, gid_t gid, mode_t mode)
-{
- struct acl_entry acl_entry;
-
- acl_entry.ae_tag = tag;
- acl_entry.ae_perm = acl_posix1e_mode_to_perm(tag, mode);
- switch(tag) {
- case ACL_USER_OBJ:
- acl_entry.ae_id = uid;
- break;
-
- case ACL_GROUP_OBJ:
- acl_entry.ae_id = gid;
- break;
-
- case ACL_OTHER:
- acl_entry.ae_id = ACL_UNDEFINED_ID;
- break;
-
- default:
- acl_entry.ae_id = ACL_UNDEFINED_ID;
- printf("acl_posix1e_mode_to_entry: invalid tag (%d)\n", tag);
- }
-
- return (acl_entry);
-}
-
-/*
- * Utility function to generate a file mode given appropriate ACL entries.
- */
-mode_t
-acl_posix1e_perms_to_mode(struct acl_entry *acl_user_obj_entry,
- struct acl_entry *acl_group_obj_entry, struct acl_entry *acl_other_entry)
-{
- mode_t mode;
-
- mode = 0;
- if (acl_user_obj_entry->ae_perm & ACL_EXECUTE)
- mode |= S_IXUSR;
- if (acl_user_obj_entry->ae_perm & ACL_READ)
- mode |= S_IRUSR;
- if (acl_user_obj_entry->ae_perm & ACL_WRITE)
- mode |= S_IWUSR;
- if (acl_group_obj_entry->ae_perm & ACL_EXECUTE)
- mode |= S_IXGRP;
- if (acl_group_obj_entry->ae_perm & ACL_READ)
- mode |= S_IRGRP;
- if (acl_group_obj_entry->ae_perm & ACL_WRITE)
- mode |= S_IWGRP;
- if (acl_other_entry->ae_perm & ACL_EXECUTE)
- mode |= S_IXOTH;
- if (acl_other_entry->ae_perm & ACL_READ)
- mode |= S_IROTH;
- if (acl_other_entry->ae_perm & ACL_WRITE)
- mode |= S_IWOTH;
-
- return (mode);
-}
-
-/*
- * Utility function to generate a file mode given a complete POSIX.1e
- * access ACL. Note that if the ACL is improperly formed, this may
- * result in a panic.
- */
-mode_t
-acl_posix1e_acl_to_mode(struct acl *acl)
-{
- struct acl_entry *acl_mask, *acl_user_obj, *acl_group_obj, *acl_other;
- int i;
-
- /*
- * Find the ACL entries relevant to a POSIX permission mode.
- */
- acl_user_obj = acl_group_obj = acl_other = acl_mask = NULL;
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_USER_OBJ:
- acl_user_obj = &acl->acl_entry[i];
- break;
-
- case ACL_GROUP_OBJ:
- acl_group_obj = &acl->acl_entry[i];
- break;
-
- case ACL_OTHER:
- acl_other = &acl->acl_entry[i];
- break;
-
- case ACL_MASK:
- acl_mask = &acl->acl_entry[i];
- break;
-
- case ACL_USER:
- case ACL_GROUP:
- break;
-
- default:
- panic("acl_posix1e_acl_to_mode: bad ae_tag");
- }
- }
-
- if (acl_user_obj == NULL || acl_group_obj == NULL || acl_other == NULL)
- panic("acl_posix1e_acl_to_mode: missing base ae_tags");
-
- /*
- * POSIX.1e specifies that if there is an ACL_MASK entry, we replace
- * the mode "group" bits with its permissions. If there isn't, we
- * use the ACL_GROUP_OBJ permissions.
- */
- if (acl_mask != NULL)
- return (acl_posix1e_perms_to_mode(acl_user_obj, acl_mask,
- acl_other));
- else
- return (acl_posix1e_perms_to_mode(acl_user_obj, acl_group_obj,
- acl_other));
-}
-
-/*
- * Perform a syntactic check of the ACL, sufficient to allow an
- * implementing filesystem to determine if it should accept this and
- * rely on the POSIX.1e ACL properties.
- */
-int
-acl_posix1e_check(struct acl *acl)
-{
- int num_acl_user_obj, num_acl_user, num_acl_group_obj, num_acl_group;
- int num_acl_mask, num_acl_other, i;
-
- /*
- * Verify that the number of entries does not exceed the maximum
- * defined for acl_t.
- * Verify that the correct number of various sorts of ae_tags are
- * present:
- * Exactly one ACL_USER_OBJ
- * Exactly one ACL_GROUP_OBJ
- * Exactly one ACL_OTHER
- * If any ACL_USER or ACL_GROUP entries appear, then exactly one
- * ACL_MASK entry must also appear.
- * Verify that all ae_perm entries are in ACL_PERM_BITS.
- * Verify all ae_tag entries are understood by this implementation.
- * Note: Does not check for uniqueness of qualifier (ae_id) field.
- */
- num_acl_user_obj = num_acl_user = num_acl_group_obj = num_acl_group =
- num_acl_mask = num_acl_other = 0;
- if (acl->acl_cnt > ACL_MAX_ENTRIES || acl->acl_cnt < 0)
- return (EINVAL);
- for (i = 0; i < acl->acl_cnt; i++) {
- /*
- * Check for a valid tag.
- */
- switch(acl->acl_entry[i].ae_tag) {
- case ACL_USER_OBJ:
- acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID; /* XXX */
- if (acl->acl_entry[i].ae_id != ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_user_obj++;
- break;
- case ACL_GROUP_OBJ:
- acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID; /* XXX */
- if (acl->acl_entry[i].ae_id != ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_group_obj++;
- break;
- case ACL_USER:
- if (acl->acl_entry[i].ae_id == ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_user++;
- break;
- case ACL_GROUP:
- if (acl->acl_entry[i].ae_id == ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_group++;
- break;
- case ACL_OTHER:
- acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID; /* XXX */
- if (acl->acl_entry[i].ae_id != ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_other++;
- break;
- case ACL_MASK:
- acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID; /* XXX */
- if (acl->acl_entry[i].ae_id != ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_mask++;
- break;
- default:
- return (EINVAL);
- }
- /*
- * Check for valid perm entries.
- */
- if ((acl->acl_entry[i].ae_perm | ACL_PERM_BITS) !=
- ACL_PERM_BITS)
- return (EINVAL);
- }
- if ((num_acl_user_obj != 1) || (num_acl_group_obj != 1) ||
- (num_acl_other != 1) || (num_acl_mask != 0 && num_acl_mask != 1))
- return (EINVAL);
- if (((num_acl_group != 0) || (num_acl_user != 0)) &&
- (num_acl_mask != 1))
- return (EINVAL);
- return (0);
-}
-
-/*
- * Given a requested mode for a new object, and a default ACL, combine
- * the two to produce a new mode. Be careful not to clear any bits that
- * aren't intended to be affected by the POSIX.1e ACL. Eventually,
- * this might also take the cmask as an argument, if we push that down
- * into per-filesystem-code.
- */
-mode_t
-acl_posix1e_newfilemode(mode_t cmode, struct acl *dacl)
-{
- mode_t mode;
-
- mode = cmode;
- /*
- * The current composition policy is that a permission bit must
- * be set in *both* the ACL and the requested creation mode for
- * it to appear in the resulting mode/ACL. First clear any
- * possibly effected bits, then reconstruct.
- */
- mode &= ACL_PRESERVE_MASK;
- mode |= (ACL_OVERRIDE_MASK & cmode & acl_posix1e_acl_to_mode(dacl));
-
- return (mode);
-}
-
-/*
- * These calls wrap the real vnode operations, and are called by the
- * syscall code once the syscall has converted the path or file
- * descriptor to a vnode (unlocked). The aclp pointer is assumed
- * still to point to userland, so this should not be consumed within
- * the kernel except by syscall code. Other code should directly
- * invoke VOP_{SET,GET}ACL.
- */
-
-/*
- * Given a vnode, set its ACL.
- */
-static int
-vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
- struct acl *aclp)
-{
- struct acl inkernacl;
- struct mount *mp;
- int error;
-
- error = copyin(aclp, &inkernacl, sizeof(struct acl));
- if (error)
- return(error);
- error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
- if (error != 0)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-#ifdef MAC
- error = mac_check_vnode_setacl(td->td_ucred, vp, type, &inkernacl);
- if (error != 0)
- goto out;
-#endif
- error = VOP_SETACL(vp, type, &inkernacl, td->td_ucred, td);
-#ifdef MAC
-out:
-#endif
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return(error);
-}
-
-/*
- * Given a vnode, get its ACL.
- */
-static int
-vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
- struct acl *aclp)
-{
- struct acl inkernelacl;
- int error;
-
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-#ifdef MAC
- error = mac_check_vnode_getacl(td->td_ucred, vp, type);
- if (error != 0)
- goto out;
-#endif
- error = VOP_GETACL(vp, type, &inkernelacl, td->td_ucred, td);
-#ifdef MAC
-out:
-#endif
- VOP_UNLOCK(vp, 0, td);
- if (error == 0)
- error = copyout(&inkernelacl, aclp, sizeof(struct acl));
- return (error);
-}
-
-/*
- * Given a vnode, delete its ACL.
- */
-static int
-vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type)
-{
- struct mount *mp;
- int error;
-
- error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
- if (error)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-#ifdef MAC
- error = mac_check_vnode_deleteacl(td->td_ucred, vp, type);
- if (error)
- goto out;
-#endif
- error = VOP_SETACL(vp, type, 0, td->td_ucred, td);
-#ifdef MAC
-out:
-#endif
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return (error);
-}
-
-/*
- * Given a vnode, check whether an ACL is appropriate for it
- */
-static int
-vacl_aclcheck(struct thread *td, struct vnode *vp, acl_type_t type,
- struct acl *aclp)
-{
- struct acl inkernelacl;
- int error;
-
- error = copyin(aclp, &inkernelacl, sizeof(struct acl));
- if (error)
- return(error);
- error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_ucred, td);
- return (error);
-}
-
-/*
- * syscalls -- convert the path/fd to a vnode, and call vacl_whatever.
- * Don't need to lock, as the vacl_ code will get/release any locks
- * required.
- */
-
-/*
- * Given a file path, get an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_get_file(struct thread *td, struct __acl_get_file_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_get_acl(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, get an ACL for it; don't follow links.
- *
- * MPSAFE
- */
-int
-__acl_get_link(struct thread *td, struct __acl_get_link_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_get_acl(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, set an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_set_file(struct thread *td, struct __acl_set_file_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_set_acl(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, set an ACL for it; don't follow links.
- *
- * MPSAFE
- */
-int
-__acl_set_link(struct thread *td, struct __acl_set_link_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_set_acl(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file descriptor, get an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap)
-{
- struct file *fp;
- int error;
-
- mtx_lock(&Giant);
- error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
- if (error == 0) {
- error = vacl_get_acl(td, fp->f_vnode, uap->type, uap->aclp);
- fdrop(fp, td);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file descriptor, set an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap)
-{
- struct file *fp;
- int error;
-
- mtx_lock(&Giant);
- error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
- if (error == 0) {
- error = vacl_set_acl(td, fp->f_vnode, uap->type, uap->aclp);
- fdrop(fp, td);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, delete an ACL from it.
- *
- * MPSAFE
- */
-int
-__acl_delete_file(struct thread *td, struct __acl_delete_file_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_delete(td, nd.ni_vp, uap->type);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, delete an ACL from it; don't follow links.
- *
- * MPSAFE
- */
-int
-__acl_delete_link(struct thread *td, struct __acl_delete_link_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_delete(td, nd.ni_vp, uap->type);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, delete an ACL from it.
- *
- * MPSAFE
- */
-int
-__acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap)
-{
- struct file *fp;
- int error;
-
- mtx_lock(&Giant);
- error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
- if (error == 0) {
- error = vacl_delete(td, fp->f_vnode, uap->type);
- fdrop(fp, td);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, check an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_aclcheck_file(struct thread *td, struct __acl_aclcheck_file_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_aclcheck(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, check an ACL for it; don't follow links.
- *
- * MPSAFE
- */
-int
-__acl_aclcheck_link(struct thread *td, struct __acl_aclcheck_link_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_aclcheck(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file descriptor, check an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap)
-{
- struct file *fp;
- int error;
-
- mtx_lock(&Giant);
- error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
- if (error == 0) {
- error = vacl_aclcheck(td, fp->f_vnode, uap->type, uap->aclp);
- fdrop(fp, td);
- }
- mtx_unlock(&Giant);
- return (error);
-}
diff --git a/sys/kern/subr_clist.c b/sys/kern/subr_clist.c
deleted file mode 100644
index f0dc88d..0000000
--- a/sys/kern/subr_clist.c
+++ /dev/null
@@ -1,697 +0,0 @@
-/*-
- * Copyright (c) 1994, David Greenman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice unmodified, this list of conditions, and the following
- * disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*
- * clist support routines
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/tty.h>
-#include <sys/clist.h>
-
-static void clist_init(void *);
-SYSINIT(clist, SI_SUB_CLIST, SI_ORDER_FIRST, clist_init, NULL)
-
-static struct cblock *cfreelist = 0;
-int cfreecount = 0;
-static int cslushcount;
-static int ctotcount;
-
-#ifndef INITIAL_CBLOCKS
-#define INITIAL_CBLOCKS 50
-#endif
-
-static struct cblock *cblock_alloc(void);
-static void cblock_alloc_cblocks(int number);
-static void cblock_free(struct cblock *cblockp);
-static void cblock_free_cblocks(int number);
-
-#include "opt_ddb.h"
-#ifdef DDB
-#include <ddb/ddb.h>
-
-DB_SHOW_COMMAND(cbstat, cbstat)
-{
- int cbsize = CBSIZE;
-
- printf(
- "tot = %d (active = %d, free = %d (reserved = %d, slush = %d))\n",
- ctotcount * cbsize, ctotcount * cbsize - cfreecount, cfreecount,
- cfreecount - cslushcount * cbsize, cslushcount * cbsize);
-}
-#endif /* DDB */
-
-/*
- * Called from init_main.c
- */
-/* ARGSUSED*/
-static void
-clist_init(dummy)
- void *dummy;
-{
- /*
- * Allocate an initial base set of cblocks as a 'slush'.
- * We allocate non-slush cblocks with each initial tty_open() and
- * deallocate them with each tty_close().
- * We should adjust the slush allocation. This can't be done in
- * the i/o routines because they are sometimes called from
- * interrupt handlers when it may be unsafe to call malloc().
- */
- cblock_alloc_cblocks(cslushcount = INITIAL_CBLOCKS);
-}
-
-/*
- * Remove a cblock from the cfreelist queue and return a pointer
- * to it.
- */
-static __inline struct cblock *
-cblock_alloc()
-{
- struct cblock *cblockp;
-
- cblockp = cfreelist;
- if (cblockp == NULL)
- panic("clist reservation botch");
- cfreelist = cblockp->c_next;
- cblockp->c_next = NULL;
- cfreecount -= CBSIZE;
- return (cblockp);
-}
-
-/*
- * Add a cblock to the cfreelist queue.
- */
-static __inline void
-cblock_free(cblockp)
- struct cblock *cblockp;
-{
- if (isset(cblockp->c_quote, CBQSIZE * NBBY - 1))
- bzero(cblockp->c_quote, sizeof cblockp->c_quote);
- cblockp->c_next = cfreelist;
- cfreelist = cblockp;
- cfreecount += CBSIZE;
-}
-
-/*
- * Allocate some cblocks for the cfreelist queue.
- */
-static void
-cblock_alloc_cblocks(number)
- int number;
-{
- int i;
- struct cblock *cbp;
-
- for (i = 0; i < number; ++i) {
- cbp = malloc(sizeof *cbp, M_TTYS, M_NOWAIT);
- if (cbp == NULL) {
- printf(
-"cblock_alloc_cblocks: M_NOWAIT malloc failed, trying M_WAITOK\n");
- cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK);
- }
- /*
- * Freed cblocks have zero quotes and garbage elsewhere.
- * Set the may-have-quote bit to force zeroing the quotes.
- */
- setbit(cbp->c_quote, CBQSIZE * NBBY - 1);
- cblock_free(cbp);
- }
- ctotcount += number;
-}
-
-/*
- * Set the cblock allocation policy for a clist.
- * Must be called in process context at spltty().
- */
-void
-clist_alloc_cblocks(clistp, ccmax, ccreserved)
- struct clist *clistp;
- int ccmax;
- int ccreserved;
-{
- int dcbr;
-
- /*
- * Allow for wasted space at the head.
- */
- if (ccmax != 0)
- ccmax += CBSIZE - 1;
- if (ccreserved != 0)
- ccreserved += CBSIZE - 1;
-
- clistp->c_cbmax = roundup(ccmax, CBSIZE) / CBSIZE;
- dcbr = roundup(ccreserved, CBSIZE) / CBSIZE - clistp->c_cbreserved;
- if (dcbr >= 0)
- cblock_alloc_cblocks(dcbr);
- else {
- if (clistp->c_cbreserved + dcbr < clistp->c_cbcount)
- dcbr = clistp->c_cbcount - clistp->c_cbreserved;
- cblock_free_cblocks(-dcbr);
- }
- clistp->c_cbreserved += dcbr;
-}
-
-/*
- * Free some cblocks from the cfreelist queue back to the
- * system malloc pool.
- */
-static void
-cblock_free_cblocks(number)
- int number;
-{
- int i;
-
- for (i = 0; i < number; ++i)
- free(cblock_alloc(), M_TTYS);
- ctotcount -= number;
-}
-
-/*
- * Free the cblocks reserved for a clist.
- * Must be called at spltty().
- */
-void
-clist_free_cblocks(clistp)
- struct clist *clistp;
-{
- if (clistp->c_cbcount != 0)
- panic("freeing active clist cblocks");
- cblock_free_cblocks(clistp->c_cbreserved);
- clistp->c_cbmax = 0;
- clistp->c_cbreserved = 0;
-}
-
-/*
- * Get a character from the head of a clist.
- */
-int
-getc(clistp)
- struct clist *clistp;
-{
- int chr = -1;
- int s;
- struct cblock *cblockp;
-
- s = spltty();
-
- /* If there are characters in the list, get one */
- if (clistp->c_cc) {
- cblockp = (struct cblock *)((intptr_t)clistp->c_cf & ~CROUND);
- chr = (u_char)*clistp->c_cf;
-
- /*
- * If this char is quoted, set the flag.
- */
- if (isset(cblockp->c_quote, clistp->c_cf - (char *)cblockp->c_info))
- chr |= TTY_QUOTE;
-
- /*
- * Advance to next character.
- */
- clistp->c_cf++;
- clistp->c_cc--;
- /*
- * If we have advanced the 'first' character pointer
- * past the end of this cblock, advance to the next one.
- * If there are no more characters, set the first and
- * last pointers to NULL. In either case, free the
- * current cblock.
- */
- if ((clistp->c_cf >= (char *)(cblockp+1)) || (clistp->c_cc == 0)) {
- if (clistp->c_cc > 0) {
- clistp->c_cf = cblockp->c_next->c_info;
- } else {
- clistp->c_cf = clistp->c_cl = NULL;
- }
- cblock_free(cblockp);
- if (--clistp->c_cbcount >= clistp->c_cbreserved)
- ++cslushcount;
- }
- }
-
- splx(s);
- return (chr);
-}
-
-/*
- * Copy 'amount' of chars, beginning at head of clist 'clistp' to
- * destination linear buffer 'dest'. Return number of characters
- * actually copied.
- */
-int
-q_to_b(clistp, dest, amount)
- struct clist *clistp;
- char *dest;
- int amount;
-{
- struct cblock *cblockp;
- struct cblock *cblockn;
- char *dest_orig = dest;
- int numc;
- int s;
-
- s = spltty();
-
- while (clistp && amount && (clistp->c_cc > 0)) {
- cblockp = (struct cblock *)((intptr_t)clistp->c_cf & ~CROUND);
- cblockn = cblockp + 1; /* pointer arithmetic! */
- numc = min(amount, (char *)cblockn - clistp->c_cf);
- numc = min(numc, clistp->c_cc);
- bcopy(clistp->c_cf, dest, numc);
- amount -= numc;
- clistp->c_cf += numc;
- clistp->c_cc -= numc;
- dest += numc;
- /*
- * If this cblock has been emptied, advance to the next
- * one. If there are no more characters, set the first
- * and last pointer to NULL. In either case, free the
- * current cblock.
- */
- if ((clistp->c_cf >= (char *)cblockn) || (clistp->c_cc == 0)) {
- if (clistp->c_cc > 0) {
- clistp->c_cf = cblockp->c_next->c_info;
- } else {
- clistp->c_cf = clistp->c_cl = NULL;
- }
- cblock_free(cblockp);
- if (--clistp->c_cbcount >= clistp->c_cbreserved)
- ++cslushcount;
- }
- }
-
- splx(s);
- return (dest - dest_orig);
-}
-
-/*
- * Flush 'amount' of chars, beginning at head of clist 'clistp'.
- */
-void
-ndflush(clistp, amount)
- struct clist *clistp;
- int amount;
-{
- struct cblock *cblockp;
- struct cblock *cblockn;
- int numc;
- int s;
-
- s = spltty();
-
- while (amount && (clistp->c_cc > 0)) {
- cblockp = (struct cblock *)((intptr_t)clistp->c_cf & ~CROUND);
- cblockn = cblockp + 1; /* pointer arithmetic! */
- numc = min(amount, (char *)cblockn - clistp->c_cf);
- numc = min(numc, clistp->c_cc);
- amount -= numc;
- clistp->c_cf += numc;
- clistp->c_cc -= numc;
- /*
- * If this cblock has been emptied, advance to the next
- * one. If there are no more characters, set the first
- * and last pointer to NULL. In either case, free the
- * current cblock.
- */
- if ((clistp->c_cf >= (char *)cblockn) || (clistp->c_cc == 0)) {
- if (clistp->c_cc > 0) {
- clistp->c_cf = cblockp->c_next->c_info;
- } else {
- clistp->c_cf = clistp->c_cl = NULL;
- }
- cblock_free(cblockp);
- if (--clistp->c_cbcount >= clistp->c_cbreserved)
- ++cslushcount;
- }
- }
-
- splx(s);
-}
-
-/*
- * Add a character to the end of a clist. Return -1 is no
- * more clists, or 0 for success.
- */
-int
-putc(chr, clistp)
- int chr;
- struct clist *clistp;
-{
- struct cblock *cblockp;
- int s;
-
- s = spltty();
-
- if (clistp->c_cl == NULL) {
- if (clistp->c_cbreserved < 1) {
- splx(s);
- printf("putc to a clist with no reserved cblocks\n");
- return (-1); /* nothing done */
- }
- cblockp = cblock_alloc();
- clistp->c_cbcount = 1;
- clistp->c_cf = clistp->c_cl = cblockp->c_info;
- clistp->c_cc = 0;
- } else {
- cblockp = (struct cblock *)((intptr_t)clistp->c_cl & ~CROUND);
- if (((intptr_t)clistp->c_cl & CROUND) == 0) {
- struct cblock *prev = (cblockp - 1);
-
- if (clistp->c_cbcount >= clistp->c_cbreserved) {
- if (clistp->c_cbcount >= clistp->c_cbmax
- || cslushcount <= 0) {
- splx(s);
- return (-1);
- }
- --cslushcount;
- }
- cblockp = cblock_alloc();
- clistp->c_cbcount++;
- prev->c_next = cblockp;
- clistp->c_cl = cblockp->c_info;
- }
- }
-
- /*
- * If this character is quoted, set the quote bit, if not, clear it.
- */
- if (chr & TTY_QUOTE) {
- setbit(cblockp->c_quote, clistp->c_cl - (char *)cblockp->c_info);
- /*
- * Use one of the spare quote bits to record that something
- * may be quoted.
- */
- setbit(cblockp->c_quote, CBQSIZE * NBBY - 1);
- } else
- clrbit(cblockp->c_quote, clistp->c_cl - (char *)cblockp->c_info);
-
- *clistp->c_cl++ = chr;
- clistp->c_cc++;
-
- splx(s);
- return (0);
-}
-
-/*
- * Copy data from linear buffer to clist chain. Return the
- * number of characters not copied.
- */
-int
-b_to_q(src, amount, clistp)
- char *src;
- int amount;
- struct clist *clistp;
-{
- struct cblock *cblockp;
- char *firstbyte, *lastbyte;
- u_char startmask, endmask;
- int startbit, endbit, num_between, numc;
- int s;
-
- /*
- * Avoid allocating an initial cblock and then not using it.
- * c_cc == 0 must imply c_cbount == 0.
- */
- if (amount <= 0)
- return (amount);
-
- s = spltty();
-
- /*
- * If there are no cblocks assigned to this clist yet,
- * then get one.
- */
- if (clistp->c_cl == NULL) {
- if (clistp->c_cbreserved < 1) {
- splx(s);
- printf("b_to_q to a clist with no reserved cblocks.\n");
- return (amount); /* nothing done */
- }
- cblockp = cblock_alloc();
- clistp->c_cbcount = 1;
- clistp->c_cf = clistp->c_cl = cblockp->c_info;
- clistp->c_cc = 0;
- } else {
- cblockp = (struct cblock *)((intptr_t)clistp->c_cl & ~CROUND);
- }
-
- while (amount) {
- /*
- * Get another cblock if needed.
- */
- if (((intptr_t)clistp->c_cl & CROUND) == 0) {
- struct cblock *prev = cblockp - 1;
-
- if (clistp->c_cbcount >= clistp->c_cbreserved) {
- if (clistp->c_cbcount >= clistp->c_cbmax
- || cslushcount <= 0) {
- splx(s);
- return (amount);
- }
- --cslushcount;
- }
- cblockp = cblock_alloc();
- clistp->c_cbcount++;
- prev->c_next = cblockp;
- clistp->c_cl = cblockp->c_info;
- }
-
- /*
- * Copy a chunk of the linear buffer up to the end
- * of this cblock.
- */
- numc = min(amount, (char *)(cblockp + 1) - clistp->c_cl);
- bcopy(src, clistp->c_cl, numc);
-
- /*
- * Clear quote bits if they aren't known to be clear.
- * The following could probably be made into a separate
- * "bitzero()" routine, but why bother?
- */
- if (isset(cblockp->c_quote, CBQSIZE * NBBY - 1)) {
- startbit = clistp->c_cl - (char *)cblockp->c_info;
- endbit = startbit + numc - 1;
-
- firstbyte = (u_char *)cblockp->c_quote + (startbit / NBBY);
- lastbyte = (u_char *)cblockp->c_quote + (endbit / NBBY);
-
- /*
- * Calculate mask of bits to preserve in first and
- * last bytes.
- */
- startmask = NBBY - (startbit % NBBY);
- startmask = 0xff >> startmask;
- endmask = (endbit % NBBY);
- endmask = 0xff << (endmask + 1);
-
- if (firstbyte != lastbyte) {
- *firstbyte &= startmask;
- *lastbyte &= endmask;
-
- num_between = lastbyte - firstbyte - 1;
- if (num_between)
- bzero(firstbyte + 1, num_between);
- } else {
- *firstbyte &= (startmask | endmask);
- }
- }
-
- /*
- * ...and update pointer for the next chunk.
- */
- src += numc;
- clistp->c_cl += numc;
- clistp->c_cc += numc;
- amount -= numc;
- /*
- * If we go through the loop again, it's always
- * for data in the next cblock, so by adding one (cblock),
- * (which makes the pointer 1 beyond the end of this
- * cblock) we prepare for the assignment of 'prev'
- * above.
- */
- cblockp += 1;
-
- }
-
- splx(s);
- return (amount);
-}
-
-/*
- * Get the next character in the clist. Store it at dst. Don't
- * advance any clist pointers, but return a pointer to the next
- * character position.
- */
-char *
-nextc(clistp, cp, dst)
- struct clist *clistp;
- char *cp;
- int *dst;
-{
- struct cblock *cblockp;
-
- ++cp;
- /*
- * See if the next character is beyond the end of
- * the clist.
- */
- if (clistp->c_cc && (cp != clistp->c_cl)) {
- /*
- * If the next character is beyond the end of this
- * cblock, advance to the next cblock.
- */
- if (((intptr_t)cp & CROUND) == 0)
- cp = ((struct cblock *)cp - 1)->c_next->c_info;
- cblockp = (struct cblock *)((intptr_t)cp & ~CROUND);
-
- /*
- * Get the character. Set the quote flag if this character
- * is quoted.
- */
- *dst = (u_char)*cp | (isset(cblockp->c_quote, cp - (char *)cblockp->c_info) ? TTY_QUOTE : 0);
-
- return (cp);
- }
-
- return (NULL);
-}
-
-/*
- * "Unput" a character from a clist.
- */
-int
-unputc(clistp)
- struct clist *clistp;
-{
- struct cblock *cblockp = 0, *cbp = 0;
- int s;
- int chr = -1;
-
-
- s = spltty();
-
- if (clistp->c_cc) {
- --clistp->c_cc;
- --clistp->c_cl;
-
- chr = (u_char)*clistp->c_cl;
-
- cblockp = (struct cblock *)((intptr_t)clistp->c_cl & ~CROUND);
-
- /*
- * Set quote flag if this character was quoted.
- */
- if (isset(cblockp->c_quote, (u_char *)clistp->c_cl - cblockp->c_info))
- chr |= TTY_QUOTE;
-
- /*
- * If all of the characters have been unput in this
- * cblock, then find the previous one and free this
- * one.
- */
- if (clistp->c_cc && (clistp->c_cl <= (char *)cblockp->c_info)) {
- cbp = (struct cblock *)((intptr_t)clistp->c_cf & ~CROUND);
-
- while (cbp->c_next != cblockp)
- cbp = cbp->c_next;
-
- /*
- * When the previous cblock is at the end, the 'last'
- * pointer always points (invalidly) one past.
- */
- clistp->c_cl = (char *)(cbp+1);
- cblock_free(cblockp);
- if (--clistp->c_cbcount >= clistp->c_cbreserved)
- ++cslushcount;
- cbp->c_next = NULL;
- }
- }
-
- /*
- * If there are no more characters on the list, then
- * free the last cblock.
- */
- if ((clistp->c_cc == 0) && clistp->c_cl) {
- cblockp = (struct cblock *)((intptr_t)clistp->c_cl & ~CROUND);
- cblock_free(cblockp);
- if (--clistp->c_cbcount >= clistp->c_cbreserved)
- ++cslushcount;
- clistp->c_cf = clistp->c_cl = NULL;
- }
-
- splx(s);
- return (chr);
-}
-
-/*
- * Move characters in source clist to destination clist,
- * preserving quote bits.
- */
-void
-catq(src_clistp, dest_clistp)
- struct clist *src_clistp, *dest_clistp;
-{
- int chr, s;
-
- s = spltty();
- /*
- * If the destination clist is empty (has no cblocks atttached),
- * and there are no possible complications with the resource counters,
- * then we simply assign the current clist to the destination.
- */
- if (!dest_clistp->c_cf
- && src_clistp->c_cbcount <= src_clistp->c_cbmax
- && src_clistp->c_cbcount <= dest_clistp->c_cbmax) {
- dest_clistp->c_cf = src_clistp->c_cf;
- dest_clistp->c_cl = src_clistp->c_cl;
- src_clistp->c_cf = src_clistp->c_cl = NULL;
-
- dest_clistp->c_cc = src_clistp->c_cc;
- src_clistp->c_cc = 0;
- dest_clistp->c_cbcount = src_clistp->c_cbcount;
- src_clistp->c_cbcount = 0;
-
- splx(s);
- return;
- }
-
- splx(s);
-
- /*
- * XXX This should probably be optimized to more than one
- * character at a time.
- */
- while ((chr = getc(src_clistp)) != -1)
- putc(chr, dest_clistp);
-}
diff --git a/sys/kern/subr_rtc.c b/sys/kern/subr_rtc.c
deleted file mode 100644
index bfa1e10..0000000
--- a/sys/kern/subr_rtc.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*-
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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.2 (Berkeley) 1/12/94
- * from: NetBSD: clock_subr.c,v 1.6 2001/07/07 17:04:02 thorpej Exp
- * and
- * from: src/sys/i386/isa/clock.c,v 1.176 2001/09/04
- */
-
-/*
- * Helpers for time-of-day clocks. This is useful for architectures that need
- * support multiple models of such clocks, and generally serves to make the
- * code more machine-independent.
- * If the clock in question can also be used as a time counter, the driver
- * needs to initiate this.
- * This code is not yet used by all architectures.
- */
-
-/*
- * Generic routines to convert between a POSIX date
- * (seconds since 1/1/1970) and yr/mo/day/hr/min/sec
- * Derived from NetBSD arch/hp300/hp300/clock.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/bus.h>
-#include <sys/clock.h>
-#include <sys/sysctl.h>
-#include <sys/timetc.h>
-
-/* XXX: for the CPU_* sysctl OID constants. */
-#include <machine/cpu.h>
-
-#include "clock_if.h"
-
-static __inline int leapyear(int year);
-static int sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS);
-
-#define FEBRUARY 2
-#define days_in_year(y) (leapyear(y) ? 366 : 365)
-#define days_in_month(y, m) \
- (month_days[(m) - 1] + (m == FEBRUARY ? leapyear(y) : 0))
-/* Day of week. Days are counted from 1/1/1970, which was a Thursday */
-#define day_of_week(days) (((days) + 4) % 7)
-
-static const int month_days[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-static device_t clock_dev = NULL;
-static long clock_res;
-
-int adjkerntz; /* local offset from GMT in seconds */
-int disable_rtc_set; /* disable resettodr() if != 0 */
-int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
-
-/*
- * These have traditionally been in machdep, but should probably be moved to
- * kern.
- */
-SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz, CTLTYPE_INT|CTLFLAG_RW,
- &adjkerntz, 0, sysctl_machdep_adjkerntz, "I", "");
-
-SYSCTL_INT(_machdep, CPU_DISRTCSET, disable_rtc_set,
- CTLFLAG_RW, &disable_rtc_set, 0, "");
-
-SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
- CTLFLAG_RW, &wall_cmos_clock, 0, "");
-
-static int
-sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS)
-{
- int error;
- error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2,
- req);
- if (!error && req->newptr)
- resettodr();
- return (error);
-}
-
-/*
- * This inline avoids some unnecessary modulo operations
- * as compared with the usual macro:
- * ( ((year % 4) == 0 &&
- * (year % 100) != 0) ||
- * ((year % 400) == 0) )
- * It is otherwise equivalent.
- */
-static __inline int
-leapyear(int year)
-{
- int rv = 0;
-
- if ((year & 3) == 0) {
- rv = 1;
- if ((year % 100) == 0) {
- rv = 0;
- if ((year % 400) == 0)
- rv = 1;
- }
- }
- return (rv);
-}
-
-int
-clock_ct_to_ts(struct clocktime *ct, struct timespec *ts)
-{
- time_t secs;
- int i, year, days;
-
- year = ct->year;
-
- /* Sanity checks. */
- if (ct->mon < 1 || ct->mon > 12 || ct->day < 1 ||
- ct->day > days_in_month(year, ct->mon) ||
- ct->hour > 23 || ct->min > 59 || ct->sec > 59 ||
- ct->year > 2037) /* time_t overflow */
- return (EINVAL);
-
- /*
- * Compute days since start of time
- * First from years, then from months.
- */
- days = 0;
- for (i = POSIX_BASE_YEAR; i < year; i++)
- days += days_in_year(i);
-
- /* Months */
- for (i = 1; i < ct->mon; i++)
- days += days_in_month(year, i);
- days += (ct->day - 1);
-
- /* Another sanity check. */
- if (ct->dow != -1 && ct->dow != day_of_week(days))
- return (EINVAL);
-
- /* Add hours, minutes, seconds. */
- secs = ((days * 24 + ct->hour) * 60 + ct->min) * 60 + ct->sec;
-
- ts->tv_sec = secs;
- ts->tv_nsec = ct->nsec;
- return (0);
-}
-
-void
-clock_ts_to_ct(struct timespec *ts, struct clocktime *ct)
-{
- int i, year, days;
- time_t rsec; /* remainder seconds */
- time_t secs;
-
- secs = ts->tv_sec;
- days = secs / SECDAY;
- rsec = secs % SECDAY;
-
- ct->dow = day_of_week(days);
-
- /* Subtract out whole years, counting them in i. */
- for (year = POSIX_BASE_YEAR; days >= days_in_year(year); year++)
- days -= days_in_year(year);
- ct->year = year;
-
- /* Subtract out whole months, counting them in i. */
- for (i = 1; days >= days_in_month(year, i); i++)
- days -= days_in_month(year, i);
- ct->mon = i;
-
- /* Days are what is left over (+1) from all that. */
- ct->day = days + 1;
-
- /* Hours, minutes, seconds are easy */
- ct->hour = rsec / 3600;
- rsec = rsec % 3600;
- ct->min = rsec / 60;
- rsec = rsec % 60;
- ct->sec = rsec;
- ct->nsec = ts->tv_nsec;
-}
-
-void
-clock_register(device_t dev, long res)
-{
-
- if (clock_dev != NULL) {
- if (clock_res > res) {
- if (bootverbose) {
- device_printf(dev, "not installed as "
- "time-of-day clock: clock %s has higher "
- "resolution\n", device_get_name(clock_dev));
- }
- return;
- } else {
- if (bootverbose) {
- device_printf(clock_dev, "removed as "
- "time-of-day clock: clock %s has higher "
- "resolution\n", device_get_name(dev));
- }
- }
- }
- clock_dev = dev;
- clock_res = res;
- if (bootverbose) {
- device_printf(dev, "registered as a time-of-day clock "
- "(resolution %ldus)\n", res);
- }
-}
-
-/*
- * inittodr and settodr derived from the i386 versions written
- * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at>, reintroduced and
- * updated by Chris Stenton <chris@gnome.co.uk> 8/10/94
- */
-
-/*
- * Initialize the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-void
-inittodr(time_t base)
-{
- struct timespec diff, ref, ts;
- int error;
-
- if (base) {
- ref.tv_sec = base;
- ref.tv_nsec = 0;
- tc_setclock(&ref);
- }
-
- if (clock_dev == NULL) {
- printf("warning: no time-of-day clock registered, system time "
- "will not be set accurately\n");
- return;
- }
- error = CLOCK_GETTIME(clock_dev, &ts);
- if (error != 0 && error != EINVAL) {
- printf("warning: clock_gettime failed (%d), the system time "
- "will not be set accurately\n", error);
- return;
- }
- if (error == EINVAL || ts.tv_sec < 0) {
- printf("Invalid time in real time clock.\n");
- printf("Check and reset the date immediately!\n");
- }
-
- ts.tv_sec += tz_minuteswest * 60 +
- (wall_cmos_clock ? adjkerntz : 0);
-
- if (timespeccmp(&ref, &ts, >)) {
- diff = ref;
- timespecsub(&ref, &ts);
- } else {
- diff = ts;
- timespecsub(&diff, &ref);
- }
- if (ts.tv_sec >= 2) {
- /* badly off, adjust it */
- tc_setclock(&ts);
- }
-}
-
-/*
- * Write system time back to RTC
- */
-void
-resettodr()
-{
- struct timespec ts;
- int error;
-
- if (disable_rtc_set || clock_dev == NULL)
- return;
-
- getnanotime(&ts);
- ts.tv_sec -= tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
- if ((error = CLOCK_SETTIME(clock_dev, &ts)) != 0) {
- printf("warning: clock_settime failed (%d), time-of-day clock "
- "not adjusted to system time\n", error);
- return;
- }
-}
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
deleted file mode 100644
index e979251..0000000
--- a/sys/kern/uipc_sockbuf.c
+++ /dev/null
@@ -1,1503 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1988, 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_mac.h"
-#include "opt_param.h"
-
-#include <sys/param.h>
-#include <sys/aio.h> /* for aio_swake proto */
-#include <sys/domain.h>
-#include <sys/event.h>
-#include <sys/file.h> /* for maxfiles */
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/mac.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/protosw.h>
-#include <sys/resourcevar.h>
-#include <sys/signalvar.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <sys/systm.h>
-
-int maxsockets;
-
-void (*aio_swake)(struct socket *, struct sockbuf *);
-
-/*
- * Primitive routines for operating on sockets and socket buffers
- */
-
-u_long sb_max = SB_MAX;
-static u_long sb_max_adj =
- SB_MAX * MCLBYTES / (MSIZE + MCLBYTES); /* adjusted sb_max */
-
-static u_long sb_efficiency = 8; /* parameter for sbreserve() */
-
-/*
- * Procedures to manipulate state flags of socket
- * and do appropriate wakeups. Normal sequence from the
- * active (originating) side is that soisconnecting() is
- * called during processing of connect() call,
- * resulting in an eventual call to soisconnected() if/when the
- * connection is established. When the connection is torn down
- * soisdisconnecting() is called during processing of disconnect() call,
- * and soisdisconnected() is called when the connection to the peer
- * is totally severed. The semantics of these routines are such that
- * connectionless protocols can call soisconnected() and soisdisconnected()
- * only, bypassing the in-progress calls when setting up a ``connection''
- * takes no time.
- *
- * From the passive side, a socket is created with
- * two queues of sockets: so_incomp for connections in progress
- * and so_comp for connections already made and awaiting user acceptance.
- * As a protocol is preparing incoming connections, it creates a socket
- * structure queued on so_incomp by calling sonewconn(). When the connection
- * is established, soisconnected() is called, and transfers the
- * socket structure to so_comp, making it available to accept().
- *
- * If a socket is closed with sockets on either
- * so_incomp or so_comp, these sockets are dropped.
- *
- * If higher level protocols are implemented in
- * the kernel, the wakeups done here will sometimes
- * cause software-interrupt process scheduling.
- */
-
-void
-soisconnecting(so)
- register struct socket *so;
-{
-
- SOCK_LOCK(so);
- so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING);
- so->so_state |= SS_ISCONNECTING;
- SOCK_UNLOCK(so);
-}
-
-void
-soisconnected(so)
- struct socket *so;
-{
- struct socket *head;
-
- ACCEPT_LOCK();
- SOCK_LOCK(so);
- so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
- so->so_state |= SS_ISCONNECTED;
- head = so->so_head;
- if (head != NULL && (so->so_qstate & SQ_INCOMP)) {
- if ((so->so_options & SO_ACCEPTFILTER) == 0) {
- SOCK_UNLOCK(so);
- TAILQ_REMOVE(&head->so_incomp, so, so_list);
- head->so_incqlen--;
- so->so_qstate &= ~SQ_INCOMP;
- TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
- head->so_qlen++;
- so->so_qstate |= SQ_COMP;
- ACCEPT_UNLOCK();
- sorwakeup(head);
- wakeup_one(&head->so_timeo);
- } else {
- ACCEPT_UNLOCK();
- so->so_upcall =
- head->so_accf->so_accept_filter->accf_callback;
- so->so_upcallarg = head->so_accf->so_accept_filter_arg;
- so->so_rcv.sb_flags |= SB_UPCALL;
- so->so_options &= ~SO_ACCEPTFILTER;
- SOCK_UNLOCK(so);
- so->so_upcall(so, so->so_upcallarg, M_DONTWAIT);
- }
- return;
- }
- SOCK_UNLOCK(so);
- ACCEPT_UNLOCK();
- wakeup(&so->so_timeo);
- sorwakeup(so);
- sowwakeup(so);
-}
-
-void
-soisdisconnecting(so)
- register struct socket *so;
-{
-
- /*
- * XXXRW: This code assumes that SOCK_LOCK(so) and
- * SOCKBUF_LOCK(&so->so_rcv) are the same.
- */
- SOCKBUF_LOCK(&so->so_rcv);
- so->so_state &= ~SS_ISCONNECTING;
- so->so_state |= SS_ISDISCONNECTING;
- so->so_rcv.sb_state |= SBS_CANTRCVMORE;
- sorwakeup_locked(so);
- SOCKBUF_LOCK(&so->so_snd);
- so->so_snd.sb_state |= SBS_CANTSENDMORE;
- sowwakeup_locked(so);
- wakeup(&so->so_timeo);
-}
-
-void
-soisdisconnected(so)
- register struct socket *so;
-{
-
- /*
- * XXXRW: This code assumes that SOCK_LOCK(so) and
- * SOCKBUF_LOCK(&so->so_rcv) are the same.
- */
- SOCKBUF_LOCK(&so->so_rcv);
- so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
- so->so_state |= SS_ISDISCONNECTED;
- so->so_rcv.sb_state |= SBS_CANTRCVMORE;
- sorwakeup_locked(so);
- SOCKBUF_LOCK(&so->so_snd);
- so->so_snd.sb_state |= SBS_CANTSENDMORE;
- sbdrop_locked(&so->so_snd, so->so_snd.sb_cc);
- sowwakeup_locked(so);
- wakeup(&so->so_timeo);
-}
-
-/*
- * When an attempt at a new connection is noted on a socket
- * which accepts connections, sonewconn is called. If the
- * connection is possible (subject to space constraints, etc.)
- * then we allocate a new structure, propoerly linked into the
- * data structure of the original socket, and return this.
- * Connstatus may be 0, or SO_ISCONFIRMING, or SO_ISCONNECTED.
- *
- * note: the ref count on the socket is 0 on return
- */
-struct socket *
-sonewconn(head, connstatus)
- register struct socket *head;
- int connstatus;
-{
- register struct socket *so;
- int over;
-
- ACCEPT_LOCK();
- over = (head->so_qlen > 3 * head->so_qlimit / 2);
- ACCEPT_UNLOCK();
- if (over)
- return (NULL);
- so = soalloc(M_NOWAIT);
- if (so == NULL)
- return (NULL);
- if ((head->so_options & SO_ACCEPTFILTER) != 0)
- connstatus = 0;
- so->so_head = head;
- so->so_type = head->so_type;
- so->so_options = head->so_options &~ SO_ACCEPTCONN;
- so->so_linger = head->so_linger;
- so->so_state = head->so_state | SS_NOFDREF;
- so->so_proto = head->so_proto;
- so->so_timeo = head->so_timeo;
- so->so_cred = crhold(head->so_cred);
-#ifdef MAC
- SOCK_LOCK(head);
- mac_create_socket_from_socket(head, so);
- SOCK_UNLOCK(head);
-#endif
- knlist_init(&so->so_rcv.sb_sel.si_note, SOCKBUF_MTX(&so->so_rcv),
- NULL, NULL, NULL);
- knlist_init(&so->so_snd.sb_sel.si_note, SOCKBUF_MTX(&so->so_snd),
- NULL, NULL, NULL);
- if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) ||
- (*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) {
- sodealloc(so);
- return (NULL);
- }
- so->so_state |= connstatus;
- ACCEPT_LOCK();
- if (connstatus) {
- TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
- so->so_qstate |= SQ_COMP;
- head->so_qlen++;
- } else {
- /*
- * Keep removing sockets from the head until there's room for
- * us to insert on the tail. In pre-locking revisions, this
- * was a simple if(), but as we could be racing with other
- * threads and soabort() requires dropping locks, we must
- * loop waiting for the condition to be true.
- */
- while (head->so_incqlen > head->so_qlimit) {
- struct socket *sp;
- sp = TAILQ_FIRST(&head->so_incomp);
- TAILQ_REMOVE(&so->so_incomp, sp, so_list);
- head->so_incqlen--;
- sp->so_qstate &= ~SQ_INCOMP;
- sp->so_head = NULL;
- ACCEPT_UNLOCK();
- (void) soabort(sp);
- ACCEPT_LOCK();
- }
- TAILQ_INSERT_TAIL(&head->so_incomp, so, so_list);
- so->so_qstate |= SQ_INCOMP;
- head->so_incqlen++;
- }
- ACCEPT_UNLOCK();
- if (connstatus) {
- sorwakeup(head);
- wakeup_one(&head->so_timeo);
- }
- return (so);
-}
-
-/*
- * Socantsendmore indicates that no more data will be sent on the
- * socket; it would normally be applied to a socket when the user
- * informs the system that no more data is to be sent, by the protocol
- * code (in case PRU_SHUTDOWN). Socantrcvmore indicates that no more data
- * will be received, and will normally be applied to the socket by a
- * protocol when it detects that the peer will send no more data.
- * Data queued for reading in the socket may yet be read.
- */
-void
-socantsendmore_locked(so)
- struct socket *so;
-{
-
- SOCKBUF_LOCK_ASSERT(&so->so_snd);
-
- so->so_snd.sb_state |= SBS_CANTSENDMORE;
- sowwakeup_locked(so);
- mtx_assert(SOCKBUF_MTX(&so->so_snd), MA_NOTOWNED);
-}
-
-void
-socantsendmore(so)
- struct socket *so;
-{
-
- SOCKBUF_LOCK(&so->so_snd);
- socantsendmore_locked(so);
- mtx_assert(SOCKBUF_MTX(&so->so_snd), MA_NOTOWNED);
-}
-
-void
-socantrcvmore_locked(so)
- struct socket *so;
-{
-
- SOCKBUF_LOCK_ASSERT(&so->so_rcv);
-
- so->so_rcv.sb_state |= SBS_CANTRCVMORE;
- sorwakeup_locked(so);
- mtx_assert(SOCKBUF_MTX(&so->so_rcv), MA_NOTOWNED);
-}
-
-void
-socantrcvmore(so)
- struct socket *so;
-{
-
- SOCKBUF_LOCK(&so->so_rcv);
- socantrcvmore_locked(so);
- mtx_assert(SOCKBUF_MTX(&so->so_rcv), MA_NOTOWNED);
-}
-
-/*
- * Wait for data to arrive at/drain from a socket buffer.
- */
-int
-sbwait(sb)
- struct sockbuf *sb;
-{
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- sb->sb_flags |= SB_WAIT;
- return (msleep(&sb->sb_cc, &sb->sb_mtx,
- (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK | PCATCH, "sbwait",
- sb->sb_timeo));
-}
-
-/*
- * Lock a sockbuf already known to be locked;
- * return any error returned from sleep (EINTR).
- */
-int
-sb_lock(sb)
- register struct sockbuf *sb;
-{
- int error;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- while (sb->sb_flags & SB_LOCK) {
- sb->sb_flags |= SB_WANT;
- error = msleep(&sb->sb_flags, &sb->sb_mtx,
- (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK|PCATCH,
- "sblock", 0);
- if (error)
- return (error);
- }
- sb->sb_flags |= SB_LOCK;
- return (0);
-}
-
-/*
- * Wakeup processes waiting on a socket buffer. Do asynchronous
- * notification via SIGIO if the socket has the SS_ASYNC flag set.
- *
- * Called with the socket buffer lock held; will release the lock by the end
- * of the function. This allows the caller to acquire the socket buffer lock
- * while testing for the need for various sorts of wakeup and hold it through
- * to the point where it's no longer required. We currently hold the lock
- * through calls out to other subsystems (with the exception of kqueue), and
- * then release it to avoid lock order issues. It's not clear that's
- * correct.
- */
-void
-sowakeup(so, sb)
- register struct socket *so;
- register struct sockbuf *sb;
-{
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- selwakeuppri(&sb->sb_sel, PSOCK);
- sb->sb_flags &= ~SB_SEL;
- if (sb->sb_flags & SB_WAIT) {
- sb->sb_flags &= ~SB_WAIT;
- wakeup(&sb->sb_cc);
- }
- KNOTE_LOCKED(&sb->sb_sel.si_note, 0);
- SOCKBUF_UNLOCK(sb);
- if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL)
- pgsigio(&so->so_sigio, SIGIO, 0);
- if (sb->sb_flags & SB_UPCALL)
- (*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT);
- if (sb->sb_flags & SB_AIO)
- aio_swake(so, sb);
- mtx_assert(SOCKBUF_MTX(sb), MA_NOTOWNED);
-}
-
-/*
- * Socket buffer (struct sockbuf) utility routines.
- *
- * Each socket contains two socket buffers: one for sending data and
- * one for receiving data. Each buffer contains a queue of mbufs,
- * information about the number of mbufs and amount of data in the
- * queue, and other fields allowing select() statements and notification
- * on data availability to be implemented.
- *
- * Data stored in a socket buffer is maintained as a list of records.
- * Each record is a list of mbufs chained together with the m_next
- * field. Records are chained together with the m_nextpkt field. The upper
- * level routine soreceive() expects the following conventions to be
- * observed when placing information in the receive buffer:
- *
- * 1. If the protocol requires each message be preceded by the sender's
- * name, then a record containing that name must be present before
- * any associated data (mbuf's must be of type MT_SONAME).
- * 2. If the protocol supports the exchange of ``access rights'' (really
- * just additional data associated with the message), and there are
- * ``rights'' to be received, then a record containing this data
- * should be present (mbuf's must be of type MT_RIGHTS).
- * 3. If a name or rights record exists, then it must be followed by
- * a data record, perhaps of zero length.
- *
- * Before using a new socket structure it is first necessary to reserve
- * buffer space to the socket, by calling sbreserve(). This should commit
- * some of the available buffer space in the system buffer pool for the
- * socket (currently, it does nothing but enforce limits). The space
- * should be released by calling sbrelease() when the socket is destroyed.
- */
-
-int
-soreserve(so, sndcc, rcvcc)
- register struct socket *so;
- u_long sndcc, rcvcc;
-{
- struct thread *td = curthread;
-
- SOCKBUF_LOCK(&so->so_snd);
- SOCKBUF_LOCK(&so->so_rcv);
- if (sbreserve_locked(&so->so_snd, sndcc, so, td) == 0)
- goto bad;
- if (sbreserve_locked(&so->so_rcv, rcvcc, so, td) == 0)
- goto bad2;
- if (so->so_rcv.sb_lowat == 0)
- so->so_rcv.sb_lowat = 1;
- if (so->so_snd.sb_lowat == 0)
- so->so_snd.sb_lowat = MCLBYTES;
- if (so->so_snd.sb_lowat > so->so_snd.sb_hiwat)
- so->so_snd.sb_lowat = so->so_snd.sb_hiwat;
- SOCKBUF_UNLOCK(&so->so_rcv);
- SOCKBUF_UNLOCK(&so->so_snd);
- return (0);
-bad2:
- sbrelease_locked(&so->so_snd, so);
-bad:
- SOCKBUF_UNLOCK(&so->so_rcv);
- SOCKBUF_UNLOCK(&so->so_snd);
- return (ENOBUFS);
-}
-
-static int
-sysctl_handle_sb_max(SYSCTL_HANDLER_ARGS)
-{
- int error = 0;
- u_long old_sb_max = sb_max;
-
- error = SYSCTL_OUT(req, arg1, sizeof(u_long));
- if (error || !req->newptr)
- return (error);
- error = SYSCTL_IN(req, arg1, sizeof(u_long));
- if (error)
- return (error);
- if (sb_max < MSIZE + MCLBYTES) {
- sb_max = old_sb_max;
- return (EINVAL);
- }
- sb_max_adj = (u_quad_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES);
- return (0);
-}
-
-/*
- * Allot mbufs to a sockbuf.
- * Attempt to scale mbmax so that mbcnt doesn't become limiting
- * if buffering efficiency is near the normal case.
- */
-int
-sbreserve_locked(sb, cc, so, td)
- struct sockbuf *sb;
- u_long cc;
- struct socket *so;
- struct thread *td;
-{
- rlim_t sbsize_limit;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- /*
- * td will only be NULL when we're in an interrupt
- * (e.g. in tcp_input())
- */
- if (cc > sb_max_adj)
- return (0);
- if (td != NULL) {
- PROC_LOCK(td->td_proc);
- sbsize_limit = lim_cur(td->td_proc, RLIMIT_SBSIZE);
- PROC_UNLOCK(td->td_proc);
- } else
- sbsize_limit = RLIM_INFINITY;
- if (!chgsbsize(so->so_cred->cr_uidinfo, &sb->sb_hiwat, cc,
- sbsize_limit))
- return (0);
- sb->sb_mbmax = min(cc * sb_efficiency, sb_max);
- if (sb->sb_lowat > sb->sb_hiwat)
- sb->sb_lowat = sb->sb_hiwat;
- return (1);
-}
-
-int
-sbreserve(sb, cc, so, td)
- struct sockbuf *sb;
- u_long cc;
- struct socket *so;
- struct thread *td;
-{
- int error;
-
- SOCKBUF_LOCK(sb);
- error = sbreserve_locked(sb, cc, so, td);
- SOCKBUF_UNLOCK(sb);
- return (error);
-}
-
-/*
- * Free mbufs held by a socket, and reserved mbuf space.
- */
-void
-sbrelease_locked(sb, so)
- struct sockbuf *sb;
- struct socket *so;
-{
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- sbflush_locked(sb);
- (void)chgsbsize(so->so_cred->cr_uidinfo, &sb->sb_hiwat, 0,
- RLIM_INFINITY);
- sb->sb_mbmax = 0;
-}
-
-void
-sbrelease(sb, so)
- struct sockbuf *sb;
- struct socket *so;
-{
-
- SOCKBUF_LOCK(sb);
- sbrelease_locked(sb, so);
- SOCKBUF_UNLOCK(sb);
-}
-/*
- * Routines to add and remove
- * data from an mbuf queue.
- *
- * The routines sbappend() or sbappendrecord() are normally called to
- * append new mbufs to a socket buffer, after checking that adequate
- * space is available, comparing the function sbspace() with the amount
- * of data to be added. sbappendrecord() differs from sbappend() in
- * that data supplied is treated as the beginning of a new record.
- * To place a sender's address, optional access rights, and data in a
- * socket receive buffer, sbappendaddr() should be used. To place
- * access rights and data in a socket receive buffer, sbappendrights()
- * should be used. In either case, the new data begins a new record.
- * Note that unlike sbappend() and sbappendrecord(), these routines check
- * for the caller that there will be enough space to store the data.
- * Each fails if there is not enough space, or if it cannot find mbufs
- * to store additional information in.
- *
- * Reliable protocols may use the socket send buffer to hold data
- * awaiting acknowledgement. Data is normally copied from a socket
- * send buffer in a protocol with m_copy for output to a peer,
- * and then removing the data from the socket buffer with sbdrop()
- * or sbdroprecord() when the data is acknowledged by the peer.
- */
-
-#ifdef SOCKBUF_DEBUG
-void
-sblastrecordchk(struct sockbuf *sb, const char *file, int line)
-{
- struct mbuf *m = sb->sb_mb;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- while (m && m->m_nextpkt)
- m = m->m_nextpkt;
-
- if (m != sb->sb_lastrecord) {
- printf("%s: sb_mb %p sb_lastrecord %p last %p\n",
- __func__, sb->sb_mb, sb->sb_lastrecord, m);
- printf("packet chain:\n");
- for (m = sb->sb_mb; m != NULL; m = m->m_nextpkt)
- printf("\t%p\n", m);
- panic("%s from %s:%u", __func__, file, line);
- }
-}
-
-void
-sblastmbufchk(struct sockbuf *sb, const char *file, int line)
-{
- struct mbuf *m = sb->sb_mb;
- struct mbuf *n;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- while (m && m->m_nextpkt)
- m = m->m_nextpkt;
-
- while (m && m->m_next)
- m = m->m_next;
-
- if (m != sb->sb_mbtail) {
- printf("%s: sb_mb %p sb_mbtail %p last %p\n",
- __func__, sb->sb_mb, sb->sb_mbtail, m);
- printf("packet tree:\n");
- for (m = sb->sb_mb; m != NULL; m = m->m_nextpkt) {
- printf("\t");
- for (n = m; n != NULL; n = n->m_next)
- printf("%p ", n);
- printf("\n");
- }
- panic("%s from %s:%u", __func__, file, line);
- }
-}
-#endif /* SOCKBUF_DEBUG */
-
-#define SBLINKRECORD(sb, m0) do { \
- SOCKBUF_LOCK_ASSERT(sb); \
- if ((sb)->sb_lastrecord != NULL) \
- (sb)->sb_lastrecord->m_nextpkt = (m0); \
- else \
- (sb)->sb_mb = (m0); \
- (sb)->sb_lastrecord = (m0); \
-} while (/*CONSTCOND*/0)
-
-/*
- * Append mbuf chain m to the last record in the
- * socket buffer sb. The additional space associated
- * the mbuf chain is recorded in sb. Empty mbufs are
- * discarded and mbufs are compacted where possible.
- */
-void
-sbappend_locked(sb, m)
- struct sockbuf *sb;
- struct mbuf *m;
-{
- register struct mbuf *n;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- if (m == 0)
- return;
-
- SBLASTRECORDCHK(sb);
- n = sb->sb_mb;
- if (n) {
- while (n->m_nextpkt)
- n = n->m_nextpkt;
- do {
- if (n->m_flags & M_EOR) {
- sbappendrecord_locked(sb, m); /* XXXXXX!!!! */
- return;
- }
- } while (n->m_next && (n = n->m_next));
- } else {
- /*
- * XXX Would like to simply use sb_mbtail here, but
- * XXX I need to verify that I won't miss an EOR that
- * XXX way.
- */
- if ((n = sb->sb_lastrecord) != NULL) {
- do {
- if (n->m_flags & M_EOR) {
- sbappendrecord_locked(sb, m); /* XXXXXX!!!! */
- return;
- }
- } while (n->m_next && (n = n->m_next));
- } else {
- /*
- * If this is the first record in the socket buffer,
- * it's also the last record.
- */
- sb->sb_lastrecord = m;
- }
- }
- sbcompress(sb, m, n);
- SBLASTRECORDCHK(sb);
-}
-
-/*
- * Append mbuf chain m to the last record in the
- * socket buffer sb. The additional space associated
- * the mbuf chain is recorded in sb. Empty mbufs are
- * discarded and mbufs are compacted where possible.
- */
-void
-sbappend(sb, m)
- struct sockbuf *sb;
- struct mbuf *m;
-{
-
- SOCKBUF_LOCK(sb);
- sbappend_locked(sb, m);
- SOCKBUF_UNLOCK(sb);
-}
-
-/*
- * This version of sbappend() should only be used when the caller
- * absolutely knows that there will never be more than one record
- * in the socket buffer, that is, a stream protocol (such as TCP).
- */
-void
-sbappendstream_locked(struct sockbuf *sb, struct mbuf *m)
-{
- SOCKBUF_LOCK_ASSERT(sb);
-
- KASSERT(m->m_nextpkt == NULL,("sbappendstream 0"));
- KASSERT(sb->sb_mb == sb->sb_lastrecord,("sbappendstream 1"));
-
- SBLASTMBUFCHK(sb);
-
- sbcompress(sb, m, sb->sb_mbtail);
-
- sb->sb_lastrecord = sb->sb_mb;
- SBLASTRECORDCHK(sb);
-}
-
-/*
- * This version of sbappend() should only be used when the caller
- * absolutely knows that there will never be more than one record
- * in the socket buffer, that is, a stream protocol (such as TCP).
- */
-void
-sbappendstream(struct sockbuf *sb, struct mbuf *m)
-{
-
- SOCKBUF_LOCK(sb);
- sbappendstream_locked(sb, m);
- SOCKBUF_UNLOCK(sb);
-}
-
-#ifdef SOCKBUF_DEBUG
-void
-sbcheck(sb)
- struct sockbuf *sb;
-{
- struct mbuf *m;
- struct mbuf *n = 0;
- u_long len = 0, mbcnt = 0;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- for (m = sb->sb_mb; m; m = n) {
- n = m->m_nextpkt;
- for (; m; m = m->m_next) {
- len += m->m_len;
- mbcnt += MSIZE;
- if (m->m_flags & M_EXT) /*XXX*/ /* pretty sure this is bogus */
- mbcnt += m->m_ext.ext_size;
- }
- }
- if (len != sb->sb_cc || mbcnt != sb->sb_mbcnt) {
- printf("cc %ld != %u || mbcnt %ld != %u\n", len, sb->sb_cc,
- mbcnt, sb->sb_mbcnt);
- panic("sbcheck");
- }
-}
-#endif
-
-/*
- * As above, except the mbuf chain
- * begins a new record.
- */
-void
-sbappendrecord_locked(sb, m0)
- register struct sockbuf *sb;
- register struct mbuf *m0;
-{
- register struct mbuf *m;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- if (m0 == 0)
- return;
- m = sb->sb_mb;
- if (m)
- while (m->m_nextpkt)
- m = m->m_nextpkt;
- /*
- * Put the first mbuf on the queue.
- * Note this permits zero length records.
- */
- sballoc(sb, m0);
- SBLASTRECORDCHK(sb);
- SBLINKRECORD(sb, m0);
- if (m)
- m->m_nextpkt = m0;
- else
- sb->sb_mb = m0;
- m = m0->m_next;
- m0->m_next = 0;
- if (m && (m0->m_flags & M_EOR)) {
- m0->m_flags &= ~M_EOR;
- m->m_flags |= M_EOR;
- }
- sbcompress(sb, m, m0);
-}
-
-/*
- * As above, except the mbuf chain
- * begins a new record.
- */
-void
-sbappendrecord(sb, m0)
- register struct sockbuf *sb;
- register struct mbuf *m0;
-{
-
- SOCKBUF_LOCK(sb);
- sbappendrecord_locked(sb, m0);
- SOCKBUF_UNLOCK(sb);
-}
-
-/*
- * As above except that OOB data
- * is inserted at the beginning of the sockbuf,
- * but after any other OOB data.
- */
-void
-sbinsertoob_locked(sb, m0)
- register struct sockbuf *sb;
- register struct mbuf *m0;
-{
- register struct mbuf *m;
- register struct mbuf **mp;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- if (m0 == 0)
- return;
- for (mp = &sb->sb_mb; *mp ; mp = &((*mp)->m_nextpkt)) {
- m = *mp;
- again:
- switch (m->m_type) {
-
- case MT_OOBDATA:
- continue; /* WANT next train */
-
- case MT_CONTROL:
- m = m->m_next;
- if (m)
- goto again; /* inspect THIS train further */
- }
- break;
- }
- /*
- * Put the first mbuf on the queue.
- * Note this permits zero length records.
- */
- sballoc(sb, m0);
- m0->m_nextpkt = *mp;
- *mp = m0;
- m = m0->m_next;
- m0->m_next = 0;
- if (m && (m0->m_flags & M_EOR)) {
- m0->m_flags &= ~M_EOR;
- m->m_flags |= M_EOR;
- }
- sbcompress(sb, m, m0);
-}
-
-/*
- * As above except that OOB data
- * is inserted at the beginning of the sockbuf,
- * but after any other OOB data.
- */
-void
-sbinsertoob(sb, m0)
- register struct sockbuf *sb;
- register struct mbuf *m0;
-{
-
- SOCKBUF_LOCK(sb);
- sbinsertoob_locked(sb, m0);
- SOCKBUF_UNLOCK(sb);
-}
-
-/*
- * Append address and data, and optionally, control (ancillary) data
- * to the receive queue of a socket. If present,
- * m0 must include a packet header with total length.
- * Returns 0 if no space in sockbuf or insufficient mbufs.
- */
-int
-sbappendaddr_locked(sb, asa, m0, control)
- struct sockbuf *sb;
- const struct sockaddr *asa;
- struct mbuf *m0, *control;
-{
- struct mbuf *m, *n, *nlast;
- int space = asa->sa_len;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- if (m0 && (m0->m_flags & M_PKTHDR) == 0)
- panic("sbappendaddr_locked");
- if (m0)
- space += m0->m_pkthdr.len;
- space += m_length(control, &n);
-
- if (space > sbspace(sb))
- return (0);
-#if MSIZE <= 256
- if (asa->sa_len > MLEN)
- return (0);
-#endif
- MGET(m, M_DONTWAIT, MT_SONAME);
- if (m == 0)
- return (0);
- m->m_len = asa->sa_len;
- bcopy(asa, mtod(m, caddr_t), asa->sa_len);
- if (n)
- n->m_next = m0; /* concatenate data to control */
- else
- control = m0;
- m->m_next = control;
- for (n = m; n->m_next != NULL; n = n->m_next)
- sballoc(sb, n);
- sballoc(sb, n);
- nlast = n;
- SBLINKRECORD(sb, m);
-
- sb->sb_mbtail = nlast;
- SBLASTMBUFCHK(sb);
-
- SBLASTRECORDCHK(sb);
- return (1);
-}
-
-/*
- * Append address and data, and optionally, control (ancillary) data
- * to the receive queue of a socket. If present,
- * m0 must include a packet header with total length.
- * Returns 0 if no space in sockbuf or insufficient mbufs.
- */
-int
-sbappendaddr(sb, asa, m0, control)
- struct sockbuf *sb;
- const struct sockaddr *asa;
- struct mbuf *m0, *control;
-{
- int retval;
-
- SOCKBUF_LOCK(sb);
- retval = sbappendaddr_locked(sb, asa, m0, control);
- SOCKBUF_UNLOCK(sb);
- return (retval);
-}
-
-int
-sbappendcontrol_locked(sb, m0, control)
- struct sockbuf *sb;
- struct mbuf *control, *m0;
-{
- struct mbuf *m, *n, *mlast;
- int space;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- if (control == 0)
- panic("sbappendcontrol_locked");
- space = m_length(control, &n) + m_length(m0, NULL);
-
- if (space > sbspace(sb))
- return (0);
- n->m_next = m0; /* concatenate data to control */
-
- SBLASTRECORDCHK(sb);
-
- for (m = control; m->m_next; m = m->m_next)
- sballoc(sb, m);
- sballoc(sb, m);
- mlast = m;
- SBLINKRECORD(sb, control);
-
- sb->sb_mbtail = mlast;
- SBLASTMBUFCHK(sb);
-
- SBLASTRECORDCHK(sb);
- return (1);
-}
-
-int
-sbappendcontrol(sb, m0, control)
- struct sockbuf *sb;
- struct mbuf *control, *m0;
-{
- int retval;
-
- SOCKBUF_LOCK(sb);
- retval = sbappendcontrol_locked(sb, m0, control);
- SOCKBUF_UNLOCK(sb);
- return (retval);
-}
-
-/*
- * Compress mbuf chain m into the socket
- * buffer sb following mbuf n. If n
- * is null, the buffer is presumed empty.
- */
-void
-sbcompress(sb, m, n)
- register struct sockbuf *sb;
- register struct mbuf *m, *n;
-{
- register int eor = 0;
- register struct mbuf *o;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- while (m) {
- eor |= m->m_flags & M_EOR;
- if (m->m_len == 0 &&
- (eor == 0 ||
- (((o = m->m_next) || (o = n)) &&
- o->m_type == m->m_type))) {
- if (sb->sb_lastrecord == m)
- sb->sb_lastrecord = m->m_next;
- m = m_free(m);
- continue;
- }
- if (n && (n->m_flags & M_EOR) == 0 &&
- M_WRITABLE(n) &&
- m->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */
- m->m_len <= M_TRAILINGSPACE(n) &&
- n->m_type == m->m_type) {
- bcopy(mtod(m, caddr_t), mtod(n, caddr_t) + n->m_len,
- (unsigned)m->m_len);
- n->m_len += m->m_len;
- sb->sb_cc += m->m_len;
- if (m->m_type != MT_DATA && m->m_type != MT_HEADER &&
- m->m_type != MT_OOBDATA)
- /* XXX: Probably don't need.*/
- sb->sb_ctl += m->m_len;
- m = m_free(m);
- continue;
- }
- if (n)
- n->m_next = m;
- else
- sb->sb_mb = m;
- sb->sb_mbtail = m;
- sballoc(sb, m);
- n = m;
- m->m_flags &= ~M_EOR;
- m = m->m_next;
- n->m_next = 0;
- }
- if (eor) {
- if (n)
- n->m_flags |= eor;
- else
- printf("semi-panic: sbcompress\n");
- }
- SBLASTMBUFCHK(sb);
-}
-
-/*
- * Free all mbufs in a sockbuf.
- * Check that all resources are reclaimed.
- */
-void
-sbflush_locked(sb)
- register struct sockbuf *sb;
-{
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- if (sb->sb_flags & SB_LOCK)
- panic("sbflush_locked: locked");
- while (sb->sb_mbcnt) {
- /*
- * Don't call sbdrop(sb, 0) if the leading mbuf is non-empty:
- * we would loop forever. Panic instead.
- */
- if (!sb->sb_cc && (sb->sb_mb == NULL || sb->sb_mb->m_len))
- break;
- sbdrop_locked(sb, (int)sb->sb_cc);
- }
- if (sb->sb_cc || sb->sb_mb || sb->sb_mbcnt)
- panic("sbflush_locked: cc %u || mb %p || mbcnt %u", sb->sb_cc, (void *)sb->sb_mb, sb->sb_mbcnt);
-}
-
-void
-sbflush(sb)
- register struct sockbuf *sb;
-{
-
- SOCKBUF_LOCK(sb);
- sbflush_locked(sb);
- SOCKBUF_UNLOCK(sb);
-}
-
-/*
- * Drop data from (the front of) a sockbuf.
- */
-void
-sbdrop_locked(sb, len)
- register struct sockbuf *sb;
- register int len;
-{
- register struct mbuf *m;
- struct mbuf *next;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- next = (m = sb->sb_mb) ? m->m_nextpkt : 0;
- while (len > 0) {
- if (m == 0) {
- if (next == 0)
- panic("sbdrop");
- m = next;
- next = m->m_nextpkt;
- continue;
- }
- if (m->m_len > len) {
- m->m_len -= len;
- m->m_data += len;
- sb->sb_cc -= len;
- if (m->m_type != MT_DATA && m->m_type != MT_HEADER &&
- m->m_type != MT_OOBDATA)
- sb->sb_ctl -= len;
- break;
- }
- len -= m->m_len;
- sbfree(sb, m);
- m = m_free(m);
- }
- while (m && m->m_len == 0) {
- sbfree(sb, m);
- m = m_free(m);
- }
- if (m) {
- sb->sb_mb = m;
- m->m_nextpkt = next;
- } else
- sb->sb_mb = next;
- /*
- * First part is an inline SB_EMPTY_FIXUP(). Second part
- * makes sure sb_lastrecord is up-to-date if we dropped
- * part of the last record.
- */
- m = sb->sb_mb;
- if (m == NULL) {
- sb->sb_mbtail = NULL;
- sb->sb_lastrecord = NULL;
- } else if (m->m_nextpkt == NULL) {
- sb->sb_lastrecord = m;
- }
-}
-
-/*
- * Drop data from (the front of) a sockbuf.
- */
-void
-sbdrop(sb, len)
- register struct sockbuf *sb;
- register int len;
-{
-
- SOCKBUF_LOCK(sb);
- sbdrop_locked(sb, len);
- SOCKBUF_UNLOCK(sb);
-}
-
-/*
- * Drop a record off the front of a sockbuf
- * and move the next record to the front.
- */
-void
-sbdroprecord_locked(sb)
- register struct sockbuf *sb;
-{
- register struct mbuf *m;
-
- SOCKBUF_LOCK_ASSERT(sb);
-
- m = sb->sb_mb;
- if (m) {
- sb->sb_mb = m->m_nextpkt;
- do {
- sbfree(sb, m);
- m = m_free(m);
- } while (m);
- }
- SB_EMPTY_FIXUP(sb);
-}
-
-/*
- * Drop a record off the front of a sockbuf
- * and move the next record to the front.
- */
-void
-sbdroprecord(sb)
- register struct sockbuf *sb;
-{
-
- SOCKBUF_LOCK(sb);
- sbdroprecord_locked(sb);
- SOCKBUF_UNLOCK(sb);
-}
-
-/*
- * Create a "control" mbuf containing the specified data
- * with the specified type for presentation on a socket buffer.
- */
-struct mbuf *
-sbcreatecontrol(p, size, type, level)
- caddr_t p;
- register int size;
- int type, level;
-{
- register struct cmsghdr *cp;
- struct mbuf *m;
-
- if (CMSG_SPACE((u_int)size) > MCLBYTES)
- return ((struct mbuf *) NULL);
- if (CMSG_SPACE((u_int)size) > MLEN)
- m = m_getcl(M_DONTWAIT, MT_CONTROL, 0);
- else
- m = m_get(M_DONTWAIT, MT_CONTROL);
- if (m == NULL)
- return ((struct mbuf *) NULL);
- cp = mtod(m, struct cmsghdr *);
- m->m_len = 0;
- KASSERT(CMSG_SPACE((u_int)size) <= M_TRAILINGSPACE(m),
- ("sbcreatecontrol: short mbuf"));
- if (p != NULL)
- (void)memcpy(CMSG_DATA(cp), p, size);
- m->m_len = CMSG_SPACE(size);
- cp->cmsg_len = CMSG_LEN(size);
- cp->cmsg_level = level;
- cp->cmsg_type = type;
- return (m);
-}
-
-/*
- * Some routines that return EOPNOTSUPP for entry points that are not
- * supported by a protocol. Fill in as needed.
- */
-int
-pru_abort_notsupp(struct socket *so)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_accept_notsupp(struct socket *so, struct sockaddr **nam)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_attach_notsupp(struct socket *so, int proto, struct thread *td)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_bind_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_connect_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_connect2_notsupp(struct socket *so1, struct socket *so2)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data,
- struct ifnet *ifp, struct thread *td)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_detach_notsupp(struct socket *so)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_disconnect_notsupp(struct socket *so)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_listen_notsupp(struct socket *so, struct thread *td)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_peeraddr_notsupp(struct socket *so, struct sockaddr **nam)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_rcvd_notsupp(struct socket *so, int flags)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_send_notsupp(struct socket *so, int flags, struct mbuf *m,
- struct sockaddr *addr, struct mbuf *control, struct thread *td)
-{
- return EOPNOTSUPP;
-}
-
-/*
- * This isn't really a ``null'' operation, but it's the default one
- * and doesn't do anything destructive.
- */
-int
-pru_sense_null(struct socket *so, struct stat *sb)
-{
- sb->st_blksize = so->so_snd.sb_hiwat;
- return 0;
-}
-
-int
-pru_shutdown_notsupp(struct socket *so)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_sockaddr_notsupp(struct socket *so, struct sockaddr **nam)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_sosend_notsupp(struct socket *so, struct sockaddr *addr, struct uio *uio,
- struct mbuf *top, struct mbuf *control, int flags, struct thread *td)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_soreceive_notsupp(struct socket *so, struct sockaddr **paddr,
- struct uio *uio, struct mbuf **mp0, struct mbuf **controlp,
- int *flagsp)
-{
- return EOPNOTSUPP;
-}
-
-int
-pru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred,
- struct thread *td)
-{
- return EOPNOTSUPP;
-}
-
-/*
- * For protocol types that don't keep cached copies of labels in their
- * pcbs, provide a null sosetlabel that does a NOOP.
- */
-void
-pru_sosetlabel_null(struct socket *so)
-{
-
-}
-
-/*
- * Make a copy of a sockaddr in a malloced buffer of type M_SONAME.
- */
-struct sockaddr *
-sodupsockaddr(const struct sockaddr *sa, int mflags)
-{
- struct sockaddr *sa2;
-
- sa2 = malloc(sa->sa_len, M_SONAME, mflags);
- if (sa2)
- bcopy(sa, sa2, sa->sa_len);
- return sa2;
-}
-
-/*
- * Create an external-format (``xsocket'') structure using the information
- * in the kernel-format socket structure pointed to by so. This is done
- * to reduce the spew of irrelevant information over this interface,
- * to isolate user code from changes in the kernel structure, and
- * potentially to provide information-hiding if we decide that
- * some of this information should be hidden from users.
- */
-void
-sotoxsocket(struct socket *so, struct xsocket *xso)
-{
- xso->xso_len = sizeof *xso;
- xso->xso_so = so;
- xso->so_type = so->so_type;
- xso->so_options = so->so_options;
- xso->so_linger = so->so_linger;
- xso->so_state = so->so_state;
- xso->so_pcb = so->so_pcb;
- xso->xso_protocol = so->so_proto->pr_protocol;
- xso->xso_family = so->so_proto->pr_domain->dom_family;
- xso->so_qlen = so->so_qlen;
- xso->so_incqlen = so->so_incqlen;
- xso->so_qlimit = so->so_qlimit;
- xso->so_timeo = so->so_timeo;
- xso->so_error = so->so_error;
- xso->so_pgid = so->so_sigio ? so->so_sigio->sio_pgid : 0;
- xso->so_oobmark = so->so_oobmark;
- sbtoxsockbuf(&so->so_snd, &xso->so_snd);
- sbtoxsockbuf(&so->so_rcv, &xso->so_rcv);
- xso->so_uid = so->so_cred->cr_uid;
-}
-
-/*
- * This does the same for sockbufs. Note that the xsockbuf structure,
- * since it is always embedded in a socket, does not include a self
- * pointer nor a length. We make this entry point public in case
- * some other mechanism needs it.
- */
-void
-sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb)
-{
- xsb->sb_cc = sb->sb_cc;
- xsb->sb_hiwat = sb->sb_hiwat;
- xsb->sb_mbcnt = sb->sb_mbcnt;
- xsb->sb_mbmax = sb->sb_mbmax;
- xsb->sb_lowat = sb->sb_lowat;
- xsb->sb_flags = sb->sb_flags;
- xsb->sb_timeo = sb->sb_timeo;
-}
-
-/*
- * Here is the definition of some of the basic objects in the kern.ipc
- * branch of the MIB.
- */
-SYSCTL_NODE(_kern, KERN_IPC, ipc, CTLFLAG_RW, 0, "IPC");
-
-/* This takes the place of kern.maxsockbuf, which moved to kern.ipc. */
-static int dummy;
-SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW, &dummy, 0, "");
-SYSCTL_OID(_kern_ipc, KIPC_MAXSOCKBUF, maxsockbuf, CTLTYPE_ULONG|CTLFLAG_RW,
- &sb_max, 0, sysctl_handle_sb_max, "LU", "Maximum socket buffer size");
-SYSCTL_INT(_kern_ipc, OID_AUTO, maxsockets, CTLFLAG_RDTUN,
- &maxsockets, 0, "Maximum number of sockets avaliable");
-SYSCTL_ULONG(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW,
- &sb_efficiency, 0, "");
-
-/*
- * Initialise maxsockets
- */
-static void init_maxsockets(void *ignored)
-{
- TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets);
- maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters));
-}
-SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL);
diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c
deleted file mode 100644
index 7beca5c..0000000
--- a/sys/kern/vfs_acl.c
+++ /dev/null
@@ -1,1023 +0,0 @@
-/*-
- * Copyright (c) 1999-2003 Robert N. M. Watson
- * All rights reserved.
- *
- * This software was developed by Robert Watson for the TrustedBSD Project.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-/*
- * Developed by the TrustedBSD Project.
- * Support for POSIX.1e access control lists.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_mac.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/kernel.h>
-#include <sys/mac.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/namei.h>
-#include <sys/file.h>
-#include <sys/filedesc.h>
-#include <sys/proc.h>
-#include <sys/sysent.h>
-#include <sys/errno.h>
-#include <sys/stat.h>
-#include <sys/acl.h>
-
-MALLOC_DEFINE(M_ACL, "acl", "access control list");
-
-static int vacl_set_acl(struct thread *td, struct vnode *vp,
- acl_type_t type, struct acl *aclp);
-static int vacl_get_acl(struct thread *td, struct vnode *vp,
- acl_type_t type, struct acl *aclp);
-static int vacl_aclcheck(struct thread *td, struct vnode *vp,
- acl_type_t type, struct acl *aclp);
-
-/*
- * Implement a version of vaccess() that understands POSIX.1e ACL semantics.
- * Return 0 on success, else an errno value. Should be merged into
- * vaccess() eventually.
- */
-int
-vaccess_acl_posix1e(enum vtype type, uid_t file_uid, gid_t file_gid,
- struct acl *acl, mode_t acc_mode, struct ucred *cred, int *privused)
-{
- struct acl_entry *acl_other, *acl_mask;
- mode_t dac_granted;
- mode_t cap_granted;
- mode_t acl_mask_granted;
- int group_matched, i;
-
- /*
- * Look for a normal, non-privileged way to access the file/directory
- * as requested. If it exists, go with that. Otherwise, attempt
- * to use privileges granted via cap_granted. In some cases,
- * which privileges to use may be ambiguous due to "best match",
- * in which case fall back on first match for the time being.
- */
- if (privused != NULL)
- *privused = 0;
-
- /*
- * Determine privileges now, but don't apply until we've found
- * a DAC entry that matches but has failed to allow access.
- */
-#ifndef CAPABILITIES
- if (suser_cred(cred, SUSER_ALLOWJAIL) == 0)
- cap_granted = VALLPERM;
- else
- cap_granted = 0;
-#else
- cap_granted = 0;
-
- if (type == VDIR) {
- if ((acc_mode & VEXEC) && !cap_check(cred, NULL,
- CAP_DAC_READ_SEARCH, SUSER_ALLOWJAIL))
- cap_granted |= VEXEC;
- } else {
- if ((acc_mode & VEXEC) && !cap_check(cred, NULL,
- CAP_DAC_EXECUTE, SUSER_ALLOWJAIL))
- cap_granted |= VEXEC;
- }
-
- if ((acc_mode & VREAD) && !cap_check(cred, NULL, CAP_DAC_READ_SEARCH,
- SUSER_ALLOWJAIL))
- cap_granted |= VREAD;
-
- if (((acc_mode & VWRITE) || (acc_mode & VAPPEND)) &&
- !cap_check(cred, NULL, CAP_DAC_WRITE, SUSER_ALLOWJAIL))
- cap_granted |= (VWRITE | VAPPEND);
-
- if ((acc_mode & VADMIN) && !cap_check(cred, NULL, CAP_FOWNER,
- SUSER_ALLOWJAIL))
- cap_granted |= VADMIN;
-#endif /* CAPABILITIES */
-
- /*
- * The owner matches if the effective uid associated with the
- * credential matches that of the ACL_USER_OBJ entry. While we're
- * doing the first scan, also cache the location of the ACL_MASK
- * and ACL_OTHER entries, preventing some future iterations.
- */
- acl_mask = acl_other = NULL;
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_USER_OBJ:
- if (file_uid != cred->cr_uid)
- break;
- dac_granted = 0;
- dac_granted |= VADMIN;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
- if ((acc_mode & (dac_granted | cap_granted)) ==
- acc_mode) {
- if (privused != NULL)
- *privused = 1;
- return (0);
- }
- goto error;
-
- case ACL_MASK:
- acl_mask = &acl->acl_entry[i];
- break;
-
- case ACL_OTHER:
- acl_other = &acl->acl_entry[i];
- break;
-
- default:
- break;
- }
- }
-
- /*
- * An ACL_OTHER entry should always exist in a valid access
- * ACL. If it doesn't, then generate a serious failure. For now,
- * this means a debugging message and EPERM, but in the future
- * should probably be a panic.
- */
- if (acl_other == NULL) {
- /*
- * XXX This should never happen
- */
- printf("vaccess_acl_posix1e: ACL_OTHER missing\n");
- return (EPERM);
- }
-
- /*
- * Checks against ACL_USER, ACL_GROUP_OBJ, and ACL_GROUP fields
- * are masked by an ACL_MASK entry, if any. As such, first identify
- * the ACL_MASK field, then iterate through identifying potential
- * user matches, then group matches. If there is no ACL_MASK,
- * assume that the mask allows all requests to succeed.
- */
- if (acl_mask != NULL) {
- acl_mask_granted = 0;
- if (acl_mask->ae_perm & ACL_EXECUTE)
- acl_mask_granted |= VEXEC;
- if (acl_mask->ae_perm & ACL_READ)
- acl_mask_granted |= VREAD;
- if (acl_mask->ae_perm & ACL_WRITE)
- acl_mask_granted |= (VWRITE | VAPPEND);
- } else
- acl_mask_granted = VEXEC | VREAD | VWRITE | VAPPEND;
-
- /*
- * Iterate through user ACL entries. Do checks twice, first
- * without privilege, and then if a match is found but failed,
- * a second time with privilege.
- */
-
- /*
- * Check ACL_USER ACL entries.
- */
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_USER:
- if (acl->acl_entry[i].ae_id != cred->cr_uid)
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
- if ((acc_mode & (dac_granted | cap_granted)) !=
- acc_mode)
- goto error;
-
- if (privused != NULL)
- *privused = 1;
- return (0);
- }
- }
-
- /*
- * Group match is best-match, not first-match, so find a
- * "best" match. Iterate across, testing each potential group
- * match. Make sure we keep track of whether we found a match
- * or not, so that we know if we should try again with any
- * available privilege, or if we should move on to ACL_OTHER.
- */
- group_matched = 0;
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_GROUP_OBJ:
- if (!groupmember(file_gid, cred))
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
-
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
-
- group_matched = 1;
- break;
-
- case ACL_GROUP:
- if (!groupmember(acl->acl_entry[i].ae_id, cred))
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
-
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
-
- group_matched = 1;
- break;
-
- default:
- break;
- }
- }
-
- if (group_matched == 1) {
- /*
- * There was a match, but it did not grant rights via
- * pure DAC. Try again, this time with privilege.
- */
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_GROUP_OBJ:
- if (!groupmember(file_gid, cred))
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
-
- if ((acc_mode & (dac_granted | cap_granted)) !=
- acc_mode)
- break;
-
- if (privused != NULL)
- *privused = 1;
- return (0);
-
- case ACL_GROUP:
- if (!groupmember(acl->acl_entry[i].ae_id,
- cred))
- break;
- dac_granted = 0;
- if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl->acl_entry[i].ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl->acl_entry[i].ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
- dac_granted &= acl_mask_granted;
-
- if ((acc_mode & (dac_granted | cap_granted)) !=
- acc_mode)
- break;
-
- if (privused != NULL)
- *privused = 1;
- return (0);
-
- default:
- break;
- }
- }
- /*
- * Even with privilege, group membership was not sufficient.
- * Return failure.
- */
- goto error;
- }
-
- /*
- * Fall back on ACL_OTHER. ACL_MASK is not applied to ACL_OTHER.
- */
- dac_granted = 0;
- if (acl_other->ae_perm & ACL_EXECUTE)
- dac_granted |= VEXEC;
- if (acl_other->ae_perm & ACL_READ)
- dac_granted |= VREAD;
- if (acl_other->ae_perm & ACL_WRITE)
- dac_granted |= (VWRITE | VAPPEND);
-
- if ((acc_mode & dac_granted) == acc_mode)
- return (0);
- if ((acc_mode & (dac_granted | cap_granted)) == acc_mode) {
- if (privused != NULL)
- *privused = 1;
- return (0);
- }
-
-error:
- return ((acc_mode & VADMIN) ? EPERM : EACCES);
-}
-
-/*
- * For the purposes of filesystems maintaining the _OBJ entries in an
- * inode with a mode_t field, this routine converts a mode_t entry
- * to an acl_perm_t.
- */
-acl_perm_t
-acl_posix1e_mode_to_perm(acl_tag_t tag, mode_t mode)
-{
- acl_perm_t perm = 0;
-
- switch(tag) {
- case ACL_USER_OBJ:
- if (mode & S_IXUSR)
- perm |= ACL_EXECUTE;
- if (mode & S_IRUSR)
- perm |= ACL_READ;
- if (mode & S_IWUSR)
- perm |= ACL_WRITE;
- return (perm);
-
- case ACL_GROUP_OBJ:
- if (mode & S_IXGRP)
- perm |= ACL_EXECUTE;
- if (mode & S_IRGRP)
- perm |= ACL_READ;
- if (mode & S_IWGRP)
- perm |= ACL_WRITE;
- return (perm);
-
- case ACL_OTHER:
- if (mode & S_IXOTH)
- perm |= ACL_EXECUTE;
- if (mode & S_IROTH)
- perm |= ACL_READ;
- if (mode & S_IWOTH)
- perm |= ACL_WRITE;
- return (perm);
-
- default:
- printf("acl_posix1e_mode_to_perm: invalid tag (%d)\n", tag);
- return (0);
- }
-}
-
-/*
- * Given inode information (uid, gid, mode), return an acl entry of the
- * appropriate type.
- */
-struct acl_entry
-acl_posix1e_mode_to_entry(acl_tag_t tag, uid_t uid, gid_t gid, mode_t mode)
-{
- struct acl_entry acl_entry;
-
- acl_entry.ae_tag = tag;
- acl_entry.ae_perm = acl_posix1e_mode_to_perm(tag, mode);
- switch(tag) {
- case ACL_USER_OBJ:
- acl_entry.ae_id = uid;
- break;
-
- case ACL_GROUP_OBJ:
- acl_entry.ae_id = gid;
- break;
-
- case ACL_OTHER:
- acl_entry.ae_id = ACL_UNDEFINED_ID;
- break;
-
- default:
- acl_entry.ae_id = ACL_UNDEFINED_ID;
- printf("acl_posix1e_mode_to_entry: invalid tag (%d)\n", tag);
- }
-
- return (acl_entry);
-}
-
-/*
- * Utility function to generate a file mode given appropriate ACL entries.
- */
-mode_t
-acl_posix1e_perms_to_mode(struct acl_entry *acl_user_obj_entry,
- struct acl_entry *acl_group_obj_entry, struct acl_entry *acl_other_entry)
-{
- mode_t mode;
-
- mode = 0;
- if (acl_user_obj_entry->ae_perm & ACL_EXECUTE)
- mode |= S_IXUSR;
- if (acl_user_obj_entry->ae_perm & ACL_READ)
- mode |= S_IRUSR;
- if (acl_user_obj_entry->ae_perm & ACL_WRITE)
- mode |= S_IWUSR;
- if (acl_group_obj_entry->ae_perm & ACL_EXECUTE)
- mode |= S_IXGRP;
- if (acl_group_obj_entry->ae_perm & ACL_READ)
- mode |= S_IRGRP;
- if (acl_group_obj_entry->ae_perm & ACL_WRITE)
- mode |= S_IWGRP;
- if (acl_other_entry->ae_perm & ACL_EXECUTE)
- mode |= S_IXOTH;
- if (acl_other_entry->ae_perm & ACL_READ)
- mode |= S_IROTH;
- if (acl_other_entry->ae_perm & ACL_WRITE)
- mode |= S_IWOTH;
-
- return (mode);
-}
-
-/*
- * Utility function to generate a file mode given a complete POSIX.1e
- * access ACL. Note that if the ACL is improperly formed, this may
- * result in a panic.
- */
-mode_t
-acl_posix1e_acl_to_mode(struct acl *acl)
-{
- struct acl_entry *acl_mask, *acl_user_obj, *acl_group_obj, *acl_other;
- int i;
-
- /*
- * Find the ACL entries relevant to a POSIX permission mode.
- */
- acl_user_obj = acl_group_obj = acl_other = acl_mask = NULL;
- for (i = 0; i < acl->acl_cnt; i++) {
- switch (acl->acl_entry[i].ae_tag) {
- case ACL_USER_OBJ:
- acl_user_obj = &acl->acl_entry[i];
- break;
-
- case ACL_GROUP_OBJ:
- acl_group_obj = &acl->acl_entry[i];
- break;
-
- case ACL_OTHER:
- acl_other = &acl->acl_entry[i];
- break;
-
- case ACL_MASK:
- acl_mask = &acl->acl_entry[i];
- break;
-
- case ACL_USER:
- case ACL_GROUP:
- break;
-
- default:
- panic("acl_posix1e_acl_to_mode: bad ae_tag");
- }
- }
-
- if (acl_user_obj == NULL || acl_group_obj == NULL || acl_other == NULL)
- panic("acl_posix1e_acl_to_mode: missing base ae_tags");
-
- /*
- * POSIX.1e specifies that if there is an ACL_MASK entry, we replace
- * the mode "group" bits with its permissions. If there isn't, we
- * use the ACL_GROUP_OBJ permissions.
- */
- if (acl_mask != NULL)
- return (acl_posix1e_perms_to_mode(acl_user_obj, acl_mask,
- acl_other));
- else
- return (acl_posix1e_perms_to_mode(acl_user_obj, acl_group_obj,
- acl_other));
-}
-
-/*
- * Perform a syntactic check of the ACL, sufficient to allow an
- * implementing filesystem to determine if it should accept this and
- * rely on the POSIX.1e ACL properties.
- */
-int
-acl_posix1e_check(struct acl *acl)
-{
- int num_acl_user_obj, num_acl_user, num_acl_group_obj, num_acl_group;
- int num_acl_mask, num_acl_other, i;
-
- /*
- * Verify that the number of entries does not exceed the maximum
- * defined for acl_t.
- * Verify that the correct number of various sorts of ae_tags are
- * present:
- * Exactly one ACL_USER_OBJ
- * Exactly one ACL_GROUP_OBJ
- * Exactly one ACL_OTHER
- * If any ACL_USER or ACL_GROUP entries appear, then exactly one
- * ACL_MASK entry must also appear.
- * Verify that all ae_perm entries are in ACL_PERM_BITS.
- * Verify all ae_tag entries are understood by this implementation.
- * Note: Does not check for uniqueness of qualifier (ae_id) field.
- */
- num_acl_user_obj = num_acl_user = num_acl_group_obj = num_acl_group =
- num_acl_mask = num_acl_other = 0;
- if (acl->acl_cnt > ACL_MAX_ENTRIES || acl->acl_cnt < 0)
- return (EINVAL);
- for (i = 0; i < acl->acl_cnt; i++) {
- /*
- * Check for a valid tag.
- */
- switch(acl->acl_entry[i].ae_tag) {
- case ACL_USER_OBJ:
- acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID; /* XXX */
- if (acl->acl_entry[i].ae_id != ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_user_obj++;
- break;
- case ACL_GROUP_OBJ:
- acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID; /* XXX */
- if (acl->acl_entry[i].ae_id != ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_group_obj++;
- break;
- case ACL_USER:
- if (acl->acl_entry[i].ae_id == ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_user++;
- break;
- case ACL_GROUP:
- if (acl->acl_entry[i].ae_id == ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_group++;
- break;
- case ACL_OTHER:
- acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID; /* XXX */
- if (acl->acl_entry[i].ae_id != ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_other++;
- break;
- case ACL_MASK:
- acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID; /* XXX */
- if (acl->acl_entry[i].ae_id != ACL_UNDEFINED_ID)
- return (EINVAL);
- num_acl_mask++;
- break;
- default:
- return (EINVAL);
- }
- /*
- * Check for valid perm entries.
- */
- if ((acl->acl_entry[i].ae_perm | ACL_PERM_BITS) !=
- ACL_PERM_BITS)
- return (EINVAL);
- }
- if ((num_acl_user_obj != 1) || (num_acl_group_obj != 1) ||
- (num_acl_other != 1) || (num_acl_mask != 0 && num_acl_mask != 1))
- return (EINVAL);
- if (((num_acl_group != 0) || (num_acl_user != 0)) &&
- (num_acl_mask != 1))
- return (EINVAL);
- return (0);
-}
-
-/*
- * Given a requested mode for a new object, and a default ACL, combine
- * the two to produce a new mode. Be careful not to clear any bits that
- * aren't intended to be affected by the POSIX.1e ACL. Eventually,
- * this might also take the cmask as an argument, if we push that down
- * into per-filesystem-code.
- */
-mode_t
-acl_posix1e_newfilemode(mode_t cmode, struct acl *dacl)
-{
- mode_t mode;
-
- mode = cmode;
- /*
- * The current composition policy is that a permission bit must
- * be set in *both* the ACL and the requested creation mode for
- * it to appear in the resulting mode/ACL. First clear any
- * possibly effected bits, then reconstruct.
- */
- mode &= ACL_PRESERVE_MASK;
- mode |= (ACL_OVERRIDE_MASK & cmode & acl_posix1e_acl_to_mode(dacl));
-
- return (mode);
-}
-
-/*
- * These calls wrap the real vnode operations, and are called by the
- * syscall code once the syscall has converted the path or file
- * descriptor to a vnode (unlocked). The aclp pointer is assumed
- * still to point to userland, so this should not be consumed within
- * the kernel except by syscall code. Other code should directly
- * invoke VOP_{SET,GET}ACL.
- */
-
-/*
- * Given a vnode, set its ACL.
- */
-static int
-vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
- struct acl *aclp)
-{
- struct acl inkernacl;
- struct mount *mp;
- int error;
-
- error = copyin(aclp, &inkernacl, sizeof(struct acl));
- if (error)
- return(error);
- error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
- if (error != 0)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-#ifdef MAC
- error = mac_check_vnode_setacl(td->td_ucred, vp, type, &inkernacl);
- if (error != 0)
- goto out;
-#endif
- error = VOP_SETACL(vp, type, &inkernacl, td->td_ucred, td);
-#ifdef MAC
-out:
-#endif
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return(error);
-}
-
-/*
- * Given a vnode, get its ACL.
- */
-static int
-vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
- struct acl *aclp)
-{
- struct acl inkernelacl;
- int error;
-
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-#ifdef MAC
- error = mac_check_vnode_getacl(td->td_ucred, vp, type);
- if (error != 0)
- goto out;
-#endif
- error = VOP_GETACL(vp, type, &inkernelacl, td->td_ucred, td);
-#ifdef MAC
-out:
-#endif
- VOP_UNLOCK(vp, 0, td);
- if (error == 0)
- error = copyout(&inkernelacl, aclp, sizeof(struct acl));
- return (error);
-}
-
-/*
- * Given a vnode, delete its ACL.
- */
-static int
-vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type)
-{
- struct mount *mp;
- int error;
-
- error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
- if (error)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-#ifdef MAC
- error = mac_check_vnode_deleteacl(td->td_ucred, vp, type);
- if (error)
- goto out;
-#endif
- error = VOP_SETACL(vp, type, 0, td->td_ucred, td);
-#ifdef MAC
-out:
-#endif
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return (error);
-}
-
-/*
- * Given a vnode, check whether an ACL is appropriate for it
- */
-static int
-vacl_aclcheck(struct thread *td, struct vnode *vp, acl_type_t type,
- struct acl *aclp)
-{
- struct acl inkernelacl;
- int error;
-
- error = copyin(aclp, &inkernelacl, sizeof(struct acl));
- if (error)
- return(error);
- error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_ucred, td);
- return (error);
-}
-
-/*
- * syscalls -- convert the path/fd to a vnode, and call vacl_whatever.
- * Don't need to lock, as the vacl_ code will get/release any locks
- * required.
- */
-
-/*
- * Given a file path, get an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_get_file(struct thread *td, struct __acl_get_file_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_get_acl(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, get an ACL for it; don't follow links.
- *
- * MPSAFE
- */
-int
-__acl_get_link(struct thread *td, struct __acl_get_link_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_get_acl(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, set an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_set_file(struct thread *td, struct __acl_set_file_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_set_acl(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, set an ACL for it; don't follow links.
- *
- * MPSAFE
- */
-int
-__acl_set_link(struct thread *td, struct __acl_set_link_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_set_acl(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file descriptor, get an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap)
-{
- struct file *fp;
- int error;
-
- mtx_lock(&Giant);
- error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
- if (error == 0) {
- error = vacl_get_acl(td, fp->f_vnode, uap->type, uap->aclp);
- fdrop(fp, td);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file descriptor, set an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap)
-{
- struct file *fp;
- int error;
-
- mtx_lock(&Giant);
- error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
- if (error == 0) {
- error = vacl_set_acl(td, fp->f_vnode, uap->type, uap->aclp);
- fdrop(fp, td);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, delete an ACL from it.
- *
- * MPSAFE
- */
-int
-__acl_delete_file(struct thread *td, struct __acl_delete_file_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_delete(td, nd.ni_vp, uap->type);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, delete an ACL from it; don't follow links.
- *
- * MPSAFE
- */
-int
-__acl_delete_link(struct thread *td, struct __acl_delete_link_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_delete(td, nd.ni_vp, uap->type);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, delete an ACL from it.
- *
- * MPSAFE
- */
-int
-__acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap)
-{
- struct file *fp;
- int error;
-
- mtx_lock(&Giant);
- error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
- if (error == 0) {
- error = vacl_delete(td, fp->f_vnode, uap->type);
- fdrop(fp, td);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, check an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_aclcheck_file(struct thread *td, struct __acl_aclcheck_file_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_aclcheck(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file path, check an ACL for it; don't follow links.
- *
- * MPSAFE
- */
-int
-__acl_aclcheck_link(struct thread *td, struct __acl_aclcheck_link_args *uap)
-{
- struct nameidata nd;
- int error;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error == 0) {
- error = vacl_aclcheck(td, nd.ni_vp, uap->type, uap->aclp);
- NDFREE(&nd, 0);
- }
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Given a file descriptor, check an ACL for it
- *
- * MPSAFE
- */
-int
-__acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap)
-{
- struct file *fp;
- int error;
-
- mtx_lock(&Giant);
- error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
- if (error == 0) {
- error = vacl_aclcheck(td, fp->f_vnode, uap->type, uap->aclp);
- fdrop(fp, td);
- }
- mtx_unlock(&Giant);
- return (error);
-}
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
deleted file mode 100644
index fb7f467..0000000
--- a/sys/kern/vfs_extattr.c
+++ /dev/null
@@ -1,4923 +0,0 @@
-/*-
- * Copyright (c) 1989, 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_compat.h"
-#include "opt_mac.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/sysent.h>
-#include <sys/mac.h>
-#include <sys/malloc.h>
-#include <sys/mount.h>
-#include <sys/mutex.h>
-#include <sys/sysproto.h>
-#include <sys/namei.h>
-#include <sys/filedesc.h>
-#include <sys/kernel.h>
-#include <sys/fcntl.h>
-#include <sys/file.h>
-#include <sys/limits.h>
-#include <sys/linker.h>
-#include <sys/stat.h>
-#include <sys/sx.h>
-#include <sys/unistd.h>
-#include <sys/vnode.h>
-#include <sys/proc.h>
-#include <sys/dirent.h>
-#include <sys/extattr.h>
-#include <sys/jail.h>
-#include <sys/syscallsubr.h>
-#include <sys/sysctl.h>
-
-#include <machine/stdarg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_object.h>
-#include <vm/vm_page.h>
-#include <vm/uma.h>
-
-static int chroot_refuse_vdir_fds(struct filedesc *fdp);
-static int getutimes(const struct timeval *, enum uio_seg, struct timespec *);
-static int setfown(struct thread *td, struct vnode *, uid_t, gid_t);
-static int setfmode(struct thread *td, struct vnode *, int);
-static int setfflags(struct thread *td, struct vnode *, int);
-static int setutimes(struct thread *td, struct vnode *,
- const struct timespec *, int, int);
-static int vn_access(struct vnode *vp, int user_flags, struct ucred *cred,
- struct thread *td);
-
-static int extattr_list_vp(struct vnode *vp, int attrnamespace, void *data,
- size_t nbytes, struct thread *td);
-
-int (*union_dircheckp)(struct thread *td, struct vnode **, struct file *);
-
-/*
- * The module initialization routine for POSIX asynchronous I/O will
- * set this to the version of AIO that it implements. (Zero means
- * that it is not implemented.) This value is used here by pathconf()
- * and in kern_descrip.c by fpathconf().
- */
-int async_io_version;
-
-/*
- * Sync each mounted filesystem.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct sync_args {
- int dummy;
-};
-#endif
-
-#ifdef DEBUG
-static int syncprt = 0;
-SYSCTL_INT(_debug, OID_AUTO, syncprt, CTLFLAG_RW, &syncprt, 0, "");
-#endif
-
-/* ARGSUSED */
-int
-sync(td, uap)
- struct thread *td;
- struct sync_args *uap;
-{
- struct mount *mp, *nmp;
- int asyncflag;
-
- mtx_lock(&Giant);
- mtx_lock(&mountlist_mtx);
- for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
- if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx, td)) {
- nmp = TAILQ_NEXT(mp, mnt_list);
- continue;
- }
- if ((mp->mnt_flag & MNT_RDONLY) == 0 &&
- vn_start_write(NULL, &mp, V_NOWAIT) == 0) {
- asyncflag = mp->mnt_flag & MNT_ASYNC;
- mp->mnt_flag &= ~MNT_ASYNC;
- vfs_msync(mp, MNT_NOWAIT);
- VFS_SYNC(mp, MNT_NOWAIT, td);
- mp->mnt_flag |= asyncflag;
- vn_finished_write(mp);
- }
- mtx_lock(&mountlist_mtx);
- nmp = TAILQ_NEXT(mp, mnt_list);
- vfs_unbusy(mp, td);
- }
- mtx_unlock(&mountlist_mtx);
-#if 0
-/*
- * XXX don't call vfs_bufstats() yet because that routine
- * was not imported in the Lite2 merge.
- */
-#ifdef DIAGNOSTIC
- if (syncprt)
- vfs_bufstats();
-#endif /* DIAGNOSTIC */
-#endif
- mtx_unlock(&Giant);
- return (0);
-}
-
-/* XXX PRISON: could be per prison flag */
-static int prison_quotas;
-#if 0
-SYSCTL_INT(_kern_prison, OID_AUTO, quotas, CTLFLAG_RW, &prison_quotas, 0, "");
-#endif
-
-/*
- * Change filesystem quotas.
- *
- * MP SAFE
- */
-#ifndef _SYS_SYSPROTO_H_
-struct quotactl_args {
- char *path;
- int cmd;
- int uid;
- caddr_t arg;
-};
-#endif
-int
-quotactl(td, uap)
- struct thread *td;
- register struct quotactl_args /* {
- char *path;
- int cmd;
- int uid;
- caddr_t arg;
- } */ *uap;
-{
- struct mount *mp, *vmp;
- int error;
- struct nameidata nd;
-
- if (jailed(td->td_ucred) && !prison_quotas)
- return (EPERM);
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- if ((error = namei(&nd)) != 0) {
- mtx_unlock(&Giant);
- return (error);
- }
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = vn_start_write(nd.ni_vp, &vmp, V_WAIT | PCATCH);
- mp = nd.ni_vp->v_mount;
- vrele(nd.ni_vp);
- if (error) {
- mtx_unlock(&Giant);
- return (error);
- }
- error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg, td);
- vn_finished_write(vmp);
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Get filesystem statistics.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct statfs_args {
- char *path;
- struct statfs *buf;
-};
-#endif
-int
-statfs(td, uap)
- struct thread *td;
- register struct statfs_args /* {
- char *path;
- struct statfs *buf;
- } */ *uap;
-{
- struct statfs sf;
- int error;
-
- error = kern_statfs(td, uap->path, UIO_USERSPACE, &sf);
- if (error == 0)
- error = copyout(&sf, uap->buf, sizeof(sf));
- return (error);
-}
-
-int
-kern_statfs(struct thread *td, char *path, enum uio_seg pathseg,
- struct statfs *buf)
-{
- struct mount *mp;
- struct statfs *sp, sb;
- int error;
- struct nameidata nd;
-
- mtx_lock(&Giant);
- NDINIT(&nd, LOOKUP, FOLLOW, pathseg, path, td);
- error = namei(&nd);
- if (error) {
- mtx_unlock(&Giant);
- return (error);
- }
- mp = nd.ni_vp->v_mount;
- sp = &mp->mnt_stat;
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vrele(nd.ni_vp);
-#ifdef MAC
- error = mac_check_mount_stat(td->td_ucred, mp);
- if (error) {
- mtx_unlock(&Giant);
- return (error);
- }
-#endif
- /*
- * Set these in case the underlying filesystem fails to do so.
- */
- sp->f_version = STATFS_VERSION;
- sp->f_namemax = NAME_MAX;
- sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- error = VFS_STATFS(mp, sp, td);
- if (error) {
- mtx_unlock(&Giant);
- return (error);
- }
- if (suser(td)) {
- bcopy(sp, &sb, sizeof(sb));
- sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
- prison_enforce_statfs(td->td_ucred, mp, &sb);
- sp = &sb;
- }
- mtx_unlock(&Giant);
- *buf = *sp;
- return (0);
-}
-
-/*
- * Get filesystem statistics.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct fstatfs_args {
- int fd;
- struct statfs *buf;
-};
-#endif
-int
-fstatfs(td, uap)
- struct thread *td;
- register struct fstatfs_args /* {
- int fd;
- struct statfs *buf;
- } */ *uap;
-{
- struct statfs sf;
- int error;
-
- error = kern_fstatfs(td, uap->fd, &sf);
- if (error == 0)
- error = copyout(&sf, uap->buf, sizeof(sf));
- return (error);
-}
-
-int
-kern_fstatfs(struct thread *td, int fd, struct statfs *buf)
-{
- struct file *fp;
- struct mount *mp;
- struct statfs *sp, sb;
- int error;
-
- error = getvnode(td->td_proc->p_fd, fd, &fp);
- if (error)
- return (error);
- mtx_lock(&Giant);
- mp = fp->f_vnode->v_mount;
- fdrop(fp, td);
- if (mp == NULL) {
- mtx_unlock(&Giant);
- return (EBADF);
- }
-#ifdef MAC
- error = mac_check_mount_stat(td->td_ucred, mp);
- if (error) {
- mtx_unlock(&Giant);
- return (error);
- }
-#endif
- sp = &mp->mnt_stat;
- /*
- * Set these in case the underlying filesystem fails to do so.
- */
- sp->f_version = STATFS_VERSION;
- sp->f_namemax = NAME_MAX;
- sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- error = VFS_STATFS(mp, sp, td);
- if (error) {
- mtx_unlock(&Giant);
- return (error);
- }
- if (suser(td)) {
- bcopy(sp, &sb, sizeof(sb));
- sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
- prison_enforce_statfs(td->td_ucred, mp, &sb);
- sp = &sb;
- }
- mtx_unlock(&Giant);
- *buf = *sp;
- return (0);
-}
-
-/*
- * Get statistics on all filesystems.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct getfsstat_args {
- struct statfs *buf;
- long bufsize;
- int flags;
-};
-#endif
-int
-getfsstat(td, uap)
- struct thread *td;
- register struct getfsstat_args /* {
- struct statfs *buf;
- long bufsize;
- int flags;
- } */ *uap;
-{
-
- return (kern_getfsstat(td, &uap->buf, uap->bufsize, UIO_USERSPACE,
- uap->flags));
-}
-
-/*
- * If (bufsize > 0 && bufseg == UIO_SYSSPACE)
- * The caller is responsible for freeing memory which will be allocated
- * in '*buf'.
- */
-int
-kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
- enum uio_seg bufseg, int flags)
-{
- struct mount *mp, *nmp;
- struct statfs *sfsp, *sp, sb;
- size_t count, maxcount;
- int error;
-
- maxcount = bufsize / sizeof(struct statfs);
- if (bufsize == 0)
- sfsp = NULL;
- else if (bufseg == UIO_USERSPACE)
- sfsp = *buf;
- else /* if (bufseg == UIO_SYSSPACE) */ {
- count = 0;
- mtx_lock(&mountlist_mtx);
- TAILQ_FOREACH(mp, &mountlist, mnt_list) {
- count++;
- }
- mtx_unlock(&mountlist_mtx);
- if (maxcount > count)
- maxcount = count;
- sfsp = *buf = malloc(maxcount * sizeof(struct statfs), M_TEMP,
- M_WAITOK);
- }
- count = 0;
- mtx_lock(&Giant);
- mtx_lock(&mountlist_mtx);
- for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
- if (prison_canseemount(td->td_ucred, mp) != 0) {
- nmp = TAILQ_NEXT(mp, mnt_list);
- continue;
- }
-#ifdef MAC
- if (mac_check_mount_stat(td->td_ucred, mp) != 0) {
- nmp = TAILQ_NEXT(mp, mnt_list);
- continue;
- }
-#endif
- if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx, td)) {
- nmp = TAILQ_NEXT(mp, mnt_list);
- continue;
- }
- if (sfsp && count < maxcount) {
- sp = &mp->mnt_stat;
- /*
- * Set these in case the underlying filesystem
- * fails to do so.
- */
- sp->f_version = STATFS_VERSION;
- sp->f_namemax = NAME_MAX;
- sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- /*
- * If MNT_NOWAIT or MNT_LAZY is specified, do not
- * refresh the fsstat cache. MNT_NOWAIT or MNT_LAZY
- * overrides MNT_WAIT.
- */
- if (((flags & (MNT_LAZY|MNT_NOWAIT)) == 0 ||
- (flags & MNT_WAIT)) &&
- (error = VFS_STATFS(mp, sp, td))) {
- mtx_lock(&mountlist_mtx);
- nmp = TAILQ_NEXT(mp, mnt_list);
- vfs_unbusy(mp, td);
- continue;
- }
- if (suser(td)) {
- bcopy(sp, &sb, sizeof(sb));
- sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
- prison_enforce_statfs(td->td_ucred, mp, &sb);
- sp = &sb;
- }
- if (bufseg == UIO_SYSSPACE)
- bcopy(sp, sfsp, sizeof(*sp));
- else /* if (bufseg == UIO_USERSPACE) */ {
- error = copyout(sp, sfsp, sizeof(*sp));
- if (error) {
- vfs_unbusy(mp, td);
- mtx_unlock(&Giant);
- return (error);
- }
- }
- sfsp++;
- }
- count++;
- mtx_lock(&mountlist_mtx);
- nmp = TAILQ_NEXT(mp, mnt_list);
- vfs_unbusy(mp, td);
- }
- mtx_unlock(&mountlist_mtx);
- mtx_unlock(&Giant);
- if (sfsp && count > maxcount)
- td->td_retval[0] = maxcount;
- else
- td->td_retval[0] = count;
- return (0);
-}
-
-#ifdef COMPAT_FREEBSD4
-/*
- * Get old format filesystem statistics.
- */
-static void cvtstatfs(struct statfs *, struct ostatfs *);
-
-#ifndef _SYS_SYSPROTO_H_
-struct freebsd4_statfs_args {
- char *path;
- struct ostatfs *buf;
-};
-#endif
-int
-freebsd4_statfs(td, uap)
- struct thread *td;
- struct freebsd4_statfs_args /* {
- char *path;
- struct ostatfs *buf;
- } */ *uap;
-{
- struct ostatfs osb;
- struct statfs sf;
- int error;
-
- error = kern_statfs(td, uap->path, UIO_USERSPACE, &sf);
- if (error)
- return (error);
- cvtstatfs(&sf, &osb);
- return (copyout(&osb, uap->buf, sizeof(osb)));
-}
-
-/*
- * Get filesystem statistics.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct freebsd4_fstatfs_args {
- int fd;
- struct ostatfs *buf;
-};
-#endif
-int
-freebsd4_fstatfs(td, uap)
- struct thread *td;
- struct freebsd4_fstatfs_args /* {
- int fd;
- struct ostatfs *buf;
- } */ *uap;
-{
- struct ostatfs osb;
- struct statfs sf;
- int error;
-
- error = kern_fstatfs(td, uap->fd, &sf);
- if (error)
- return (error);
- cvtstatfs(&sf, &osb);
- return (copyout(&osb, uap->buf, sizeof(osb)));
-}
-
-/*
- * Get statistics on all filesystems.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct freebsd4_getfsstat_args {
- struct ostatfs *buf;
- long bufsize;
- int flags;
-};
-#endif
-int
-freebsd4_getfsstat(td, uap)
- struct thread *td;
- register struct freebsd4_getfsstat_args /* {
- struct ostatfs *buf;
- long bufsize;
- int flags;
- } */ *uap;
-{
- struct statfs *buf, *sp;
- struct ostatfs osb;
- size_t count, size;
- int error;
-
- count = uap->bufsize / sizeof(struct ostatfs);
- size = count * sizeof(struct statfs);
- error = kern_getfsstat(td, &buf, size, UIO_SYSSPACE, uap->flags);
- if (size > 0) {
- count = td->td_retval[0];
- sp = buf;
- while (count > 0 && error == 0) {
- cvtstatfs(sp, &osb);
- error = copyout(&osb, uap->buf, sizeof(osb));
- sp++;
- uap->buf++;
- count--;
- }
- free(buf, M_TEMP);
- }
- return (error);
-}
-
-/*
- * Implement fstatfs() for (NFS) file handles.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct freebsd4_fhstatfs_args {
- struct fhandle *u_fhp;
- struct ostatfs *buf;
-};
-#endif
-int
-freebsd4_fhstatfs(td, uap)
- struct thread *td;
- struct freebsd4_fhstatfs_args /* {
- struct fhandle *u_fhp;
- struct ostatfs *buf;
- } */ *uap;
-{
- struct ostatfs osb;
- struct statfs sf;
- fhandle_t fh;
- int error;
-
- error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t));
- if (error)
- return (error);
- error = kern_fhstatfs(td, fh, &sf);
- if (error)
- return (error);
- cvtstatfs(&sf, &osb);
- return (copyout(&osb, uap->buf, sizeof(osb)));
-}
-
-/*
- * Convert a new format statfs structure to an old format statfs structure.
- */
-static void
-cvtstatfs(nsp, osp)
- struct statfs *nsp;
- struct ostatfs *osp;
-{
-
- bzero(osp, sizeof(*osp));
- osp->f_bsize = MIN(nsp->f_bsize, LONG_MAX);
- osp->f_iosize = MIN(nsp->f_iosize, LONG_MAX);
- osp->f_blocks = MIN(nsp->f_blocks, LONG_MAX);
- osp->f_bfree = MIN(nsp->f_bfree, LONG_MAX);
- osp->f_bavail = MIN(nsp->f_bavail, LONG_MAX);
- osp->f_files = MIN(nsp->f_files, LONG_MAX);
- osp->f_ffree = MIN(nsp->f_ffree, LONG_MAX);
- osp->f_owner = nsp->f_owner;
- osp->f_type = nsp->f_type;
- osp->f_flags = nsp->f_flags;
- osp->f_syncwrites = MIN(nsp->f_syncwrites, LONG_MAX);
- osp->f_asyncwrites = MIN(nsp->f_asyncwrites, LONG_MAX);
- osp->f_syncreads = MIN(nsp->f_syncreads, LONG_MAX);
- osp->f_asyncreads = MIN(nsp->f_asyncreads, LONG_MAX);
- bcopy(nsp->f_fstypename, osp->f_fstypename,
- MIN(MFSNAMELEN, OMNAMELEN));
- bcopy(nsp->f_mntonname, osp->f_mntonname,
- MIN(MFSNAMELEN, OMNAMELEN));
- bcopy(nsp->f_mntfromname, osp->f_mntfromname,
- MIN(MFSNAMELEN, OMNAMELEN));
- osp->f_fsid = nsp->f_fsid;
-}
-#endif /* COMPAT_FREEBSD4 */
-
-/*
- * Change current working directory to a given file descriptor.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct fchdir_args {
- int fd;
-};
-#endif
-int
-fchdir(td, uap)
- struct thread *td;
- struct fchdir_args /* {
- int fd;
- } */ *uap;
-{
- register struct filedesc *fdp = td->td_proc->p_fd;
- struct vnode *vp, *tdp, *vpold;
- struct mount *mp;
- struct file *fp;
- int vfslocked;
- int error;
-
- if ((error = getvnode(fdp, uap->fd, &fp)) != 0)
- return (error);
- vp = fp->f_vnode;
- vfslocked = VFS_LOCK_GIANT(vp->v_mount);
- VREF(vp);
- fdrop(fp, td);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- if (vp->v_type != VDIR)
- error = ENOTDIR;
-#ifdef MAC
- else if ((error = mac_check_vnode_chdir(td->td_ucred, vp)) != 0) {
- }
-#endif
- else
- error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
- while (!error && (mp = vp->v_mountedhere) != NULL) {
- int tvfslocked;
- if (vfs_busy(mp, 0, 0, td))
- continue;
- tvfslocked = VFS_LOCK_GIANT(mp);
- error = VFS_ROOT(mp, LK_EXCLUSIVE, &tdp, td);
- vfs_unbusy(mp, td);
- if (error) {
- VFS_UNLOCK_GIANT(tvfslocked);
- break;
- }
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- vp = tdp;
- vfslocked = tvfslocked;
- }
- if (error) {
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
- }
- VOP_UNLOCK(vp, 0, td);
- FILEDESC_LOCK_FAST(fdp);
- vpold = fdp->fd_cdir;
- fdp->fd_cdir = vp;
- FILEDESC_UNLOCK_FAST(fdp);
- vrele(vpold);
- VFS_UNLOCK_GIANT(vfslocked);
- return (0);
-}
-
-/*
- * Change current working directory (``.'').
- */
-#ifndef _SYS_SYSPROTO_H_
-struct chdir_args {
- char *path;
-};
-#endif
-int
-chdir(td, uap)
- struct thread *td;
- struct chdir_args /* {
- char *path;
- } */ *uap;
-{
-
- return (kern_chdir(td, uap->path, UIO_USERSPACE));
-}
-
-int
-kern_chdir(struct thread *td, char *path, enum uio_seg pathseg)
-{
- register struct filedesc *fdp = td->td_proc->p_fd;
- int error;
- struct nameidata nd;
- struct vnode *vp;
- int vfslocked;
-
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- if ((error = change_dir(nd.ni_vp, td)) != 0) {
- vput(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- return (error);
- }
- VOP_UNLOCK(nd.ni_vp, 0, td);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- FILEDESC_LOCK_FAST(fdp);
- vp = fdp->fd_cdir;
- fdp->fd_cdir = nd.ni_vp;
- FILEDESC_UNLOCK_FAST(fdp);
- vrele(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (0);
-}
-
-/*
- * Helper function for raised chroot(2) security function: Refuse if
- * any filedescriptors are open directories.
- */
-static int
-chroot_refuse_vdir_fds(fdp)
- struct filedesc *fdp;
-{
- struct vnode *vp;
- struct file *fp;
- int fd;
-
- FILEDESC_LOCK_ASSERT(fdp, MA_OWNED);
- for (fd = 0; fd < fdp->fd_nfiles ; fd++) {
- fp = fget_locked(fdp, fd);
- if (fp == NULL)
- continue;
- if (fp->f_type == DTYPE_VNODE) {
- vp = fp->f_vnode;
- if (vp->v_type == VDIR)
- return (EPERM);
- }
- }
- return (0);
-}
-
-/*
- * This sysctl determines if we will allow a process to chroot(2) if it
- * has a directory open:
- * 0: disallowed for all processes.
- * 1: allowed for processes that were not already chroot(2)'ed.
- * 2: allowed for all processes.
- */
-
-static int chroot_allow_open_directories = 1;
-
-SYSCTL_INT(_kern, OID_AUTO, chroot_allow_open_directories, CTLFLAG_RW,
- &chroot_allow_open_directories, 0, "");
-
-/*
- * Change notion of root (``/'') directory.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct chroot_args {
- char *path;
-};
-#endif
-int
-chroot(td, uap)
- struct thread *td;
- struct chroot_args /* {
- char *path;
- } */ *uap;
-{
- int error;
- struct nameidata nd;
- int vfslocked;
-
- error = suser_cred(td->td_ucred, SUSER_ALLOWJAIL);
- if (error)
- return (error);
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE,
- UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error)
- goto error;
- vfslocked = NDHASGIANT(&nd);
- if ((error = change_dir(nd.ni_vp, td)) != 0)
- goto e_vunlock;
-#ifdef MAC
- if ((error = mac_check_vnode_chroot(td->td_ucred, nd.ni_vp)))
- goto e_vunlock;
-#endif
- VOP_UNLOCK(nd.ni_vp, 0, td);
- error = change_root(nd.ni_vp, td);
- vrele(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- return (error);
-e_vunlock:
- vput(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
-error:
- NDFREE(&nd, NDF_ONLY_PNBUF);
- return (error);
-}
-
-/*
- * Common routine for chroot and chdir. Callers must provide a locked vnode
- * instance.
- */
-int
-change_dir(vp, td)
- struct vnode *vp;
- struct thread *td;
-{
- int error;
-
- ASSERT_VOP_LOCKED(vp, "change_dir(): vp not locked");
- if (vp->v_type != VDIR)
- return (ENOTDIR);
-#ifdef MAC
- error = mac_check_vnode_chdir(td->td_ucred, vp);
- if (error)
- return (error);
-#endif
- error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
- return (error);
-}
-
-/*
- * Common routine for kern_chroot() and jail_attach(). The caller is
- * responsible for invoking suser() and mac_check_chroot() to authorize this
- * operation.
- */
-int
-change_root(vp, td)
- struct vnode *vp;
- struct thread *td;
-{
- struct filedesc *fdp;
- struct vnode *oldvp;
- int error;
-
- VFS_ASSERT_GIANT(vp->v_mount);
- fdp = td->td_proc->p_fd;
- FILEDESC_LOCK(fdp);
- if (chroot_allow_open_directories == 0 ||
- (chroot_allow_open_directories == 1 && fdp->fd_rdir != rootvnode)) {
- error = chroot_refuse_vdir_fds(fdp);
- if (error) {
- FILEDESC_UNLOCK(fdp);
- return (error);
- }
- }
- oldvp = fdp->fd_rdir;
- fdp->fd_rdir = vp;
- VREF(fdp->fd_rdir);
- if (!fdp->fd_jdir) {
- fdp->fd_jdir = vp;
- VREF(fdp->fd_jdir);
- }
- FILEDESC_UNLOCK(fdp);
- vrele(oldvp);
- return (0);
-}
-
-/*
- * Check permissions, allocate an open file structure,
- * and call the device open routine if any.
- *
- * MP SAFE
- */
-#ifndef _SYS_SYSPROTO_H_
-struct open_args {
- char *path;
- int flags;
- int mode;
-};
-#endif
-int
-open(td, uap)
- struct thread *td;
- register struct open_args /* {
- char *path;
- int flags;
- int mode;
- } */ *uap;
-{
- int error;
-
- error = kern_open(td, uap->path, UIO_USERSPACE, uap->flags, uap->mode);
- if (mtx_owned(&Giant))
- printf("open: %s: %d\n", uap->path, error);
- return (error);
-}
-
-int
-kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
- int mode)
-{
- struct proc *p = td->td_proc;
- struct filedesc *fdp = p->p_fd;
- struct file *fp;
- struct vnode *vp;
- struct vattr vat;
- struct mount *mp;
- int cmode;
- struct file *nfp;
- int type, indx, error;
- struct flock lf;
- struct nameidata nd;
- int vfslocked;
-
- if ((flags & O_ACCMODE) == O_ACCMODE)
- return (EINVAL);
- flags = FFLAGS(flags);
- error = falloc(td, &nfp, &indx);
- if (error)
- return (error);
- /* An extra reference on `nfp' has been held for us by falloc(). */
- fp = nfp;
- cmode = ((mode &~ fdp->fd_cmask) & ALLPERMS) &~ S_ISTXT;
- NDINIT(&nd, LOOKUP, FOLLOW, pathseg, path, td);
- td->td_dupfd = -1; /* XXX check for fdopen */
- error = vn_open(&nd, &flags, cmode, indx);
- if (error) {
- /*
- * If the vn_open replaced the method vector, something
- * wonderous happened deep below and we just pass it up
- * pretending we know what we do.
- */
- if (error == ENXIO && fp->f_ops != &badfileops) {
- fdrop(fp, td);
- td->td_retval[0] = indx;
- return (0);
- }
-
- /*
- * release our own reference
- */
- fdrop(fp, td);
-
- /*
- * handle special fdopen() case. bleh. dupfdopen() is
- * responsible for dropping the old contents of ofiles[indx]
- * if it succeeds.
- */
- if ((error == ENODEV || error == ENXIO) &&
- td->td_dupfd >= 0 && /* XXX from fdopen */
- (error =
- dupfdopen(td, fdp, indx, td->td_dupfd, flags, error)) == 0) {
- td->td_retval[0] = indx;
- return (0);
- }
- /*
- * Clean up the descriptor, but only if another thread hadn't
- * replaced or closed it.
- */
- fdclose(fdp, fp, indx, td);
-
- if (error == ERESTART)
- error = EINTR;
- return (error);
- }
- td->td_dupfd = 0;
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vp = nd.ni_vp;
-
- /*
- * There should be 2 references on the file, one from the descriptor
- * table, and one for us.
- *
- * Handle the case where someone closed the file (via its file
- * descriptor) while we were blocked. The end result should look
- * like opening the file succeeded but it was immediately closed.
- * We call vn_close() manually because we haven't yet hooked up
- * the various 'struct file' fields.
- */
- FILEDESC_LOCK(fdp);
- FILE_LOCK(fp);
- if (fp->f_count == 1) {
- mp = vp->v_mount;
- KASSERT(fdp->fd_ofiles[indx] != fp,
- ("Open file descriptor lost all refs"));
- FILE_UNLOCK(fp);
- FILEDESC_UNLOCK(fdp);
- VOP_UNLOCK(vp, 0, td);
- vn_close(vp, flags & FMASK, fp->f_cred, td);
- VFS_UNLOCK_GIANT(vfslocked);
- fdrop(fp, td);
- td->td_retval[0] = indx;
- return (0);
- }
- fp->f_vnode = vp;
- if (fp->f_data == NULL)
- fp->f_data = vp;
- fp->f_flag = flags & FMASK;
- if (fp->f_ops == &badfileops)
- fp->f_ops = &vnops;
- fp->f_seqcount = 1;
- fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE);
- FILE_UNLOCK(fp);
- FILEDESC_UNLOCK(fdp);
-
- VOP_UNLOCK(vp, 0, td);
- if (flags & (O_EXLOCK | O_SHLOCK)) {
- lf.l_whence = SEEK_SET;
- lf.l_start = 0;
- lf.l_len = 0;
- if (flags & O_EXLOCK)
- lf.l_type = F_WRLCK;
- else
- lf.l_type = F_RDLCK;
- type = F_FLOCK;
- if ((flags & FNONBLOCK) == 0)
- type |= F_WAIT;
- if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf,
- type)) != 0)
- goto bad;
- fp->f_flag |= FHASLOCK;
- }
- if (flags & O_TRUNC) {
- if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
- goto bad;
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- VATTR_NULL(&vat);
- vat.va_size = 0;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-#ifdef MAC
- error = mac_check_vnode_write(td->td_ucred, fp->f_cred, vp);
- if (error == 0)
-#endif
- error = VOP_SETATTR(vp, &vat, td->td_ucred, td);
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- if (error)
- goto bad;
- }
- VFS_UNLOCK_GIANT(vfslocked);
- /*
- * Release our private reference, leaving the one associated with
- * the descriptor table intact.
- */
- fdrop(fp, td);
- td->td_retval[0] = indx;
- return (0);
-bad:
- VFS_UNLOCK_GIANT(vfslocked);
- fdclose(fdp, fp, indx, td);
- fdrop(fp, td);
- return (error);
-}
-
-#ifdef COMPAT_43
-/*
- * Create a file.
- *
- * MP SAFE
- */
-#ifndef _SYS_SYSPROTO_H_
-struct ocreat_args {
- char *path;
- int mode;
-};
-#endif
-int
-ocreat(td, uap)
- struct thread *td;
- register struct ocreat_args /* {
- char *path;
- int mode;
- } */ *uap;
-{
-
- return (kern_open(td, uap->path, UIO_USERSPACE,
- O_WRONLY | O_CREAT | O_TRUNC, uap->mode));
-}
-#endif /* COMPAT_43 */
-
-/*
- * Create a special file.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct mknod_args {
- char *path;
- int mode;
- int dev;
-};
-#endif
-int
-mknod(td, uap)
- struct thread *td;
- register struct mknod_args /* {
- char *path;
- int mode;
- int dev;
- } */ *uap;
-{
-
- return (kern_mknod(td, uap->path, UIO_USERSPACE, uap->mode, uap->dev));
-}
-
-int
-kern_mknod(struct thread *td, char *path, enum uio_seg pathseg, int mode,
- int dev)
-{
- struct vnode *vp;
- struct mount *mp;
- struct vattr vattr;
- int error;
- int whiteout = 0;
- struct nameidata nd;
- int vfslocked;
-
- switch (mode & S_IFMT) {
- case S_IFCHR:
- case S_IFBLK:
- error = suser(td);
- break;
- default:
- error = suser_cred(td->td_ucred, SUSER_ALLOWJAIL);
- break;
- }
- if (error)
- return (error);
-restart:
- bwillwrite();
- NDINIT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- vp = nd.ni_vp;
- if (vp != NULL) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vrele(vp);
- if (vp == nd.ni_dvp)
- vrele(nd.ni_dvp);
- else
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (EEXIST);
- } else {
- VATTR_NULL(&vattr);
- FILEDESC_LOCK_FAST(td->td_proc->p_fd);
- vattr.va_mode = (mode & ALLPERMS) &
- ~td->td_proc->p_fd->fd_cmask;
- FILEDESC_UNLOCK_FAST(td->td_proc->p_fd);
- vattr.va_rdev = dev;
- whiteout = 0;
-
- switch (mode & S_IFMT) {
- case S_IFMT: /* used by badsect to flag bad sectors */
- vattr.va_type = VBAD;
- break;
- case S_IFCHR:
- vattr.va_type = VCHR;
- break;
- case S_IFBLK:
- vattr.va_type = VBLK;
- break;
- case S_IFWHT:
- whiteout = 1;
- break;
- default:
- error = EINVAL;
- break;
- }
- }
- if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
- return (error);
- goto restart;
- }
-#ifdef MAC
- if (error == 0 && !whiteout)
- error = mac_check_vnode_create(td->td_ucred, nd.ni_dvp,
- &nd.ni_cnd, &vattr);
-#endif
- if (!error) {
- VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
- if (whiteout)
- error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, CREATE);
- else {
- error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp,
- &nd.ni_cnd, &vattr);
- if (error == 0)
- vput(nd.ni_vp);
- }
- }
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_dvp);
- vn_finished_write(mp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Create a named pipe.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct mkfifo_args {
- char *path;
- int mode;
-};
-#endif
-int
-mkfifo(td, uap)
- struct thread *td;
- register struct mkfifo_args /* {
- char *path;
- int mode;
- } */ *uap;
-{
-
- return (kern_mkfifo(td, uap->path, UIO_USERSPACE, uap->mode));
-}
-
-int
-kern_mkfifo(struct thread *td, char *path, enum uio_seg pathseg, int mode)
-{
- struct mount *mp;
- struct vattr vattr;
- int error;
- struct nameidata nd;
- int vfslocked;
-
-restart:
- bwillwrite();
- NDINIT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- if (nd.ni_vp != NULL) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vrele(nd.ni_vp);
- if (nd.ni_vp == nd.ni_dvp)
- vrele(nd.ni_dvp);
- else
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (EEXIST);
- }
- if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
- return (error);
- goto restart;
- }
- VATTR_NULL(&vattr);
- vattr.va_type = VFIFO;
- FILEDESC_LOCK_FAST(td->td_proc->p_fd);
- vattr.va_mode = (mode & ALLPERMS) & ~td->td_proc->p_fd->fd_cmask;
- FILEDESC_UNLOCK_FAST(td->td_proc->p_fd);
-#ifdef MAC
- error = mac_check_vnode_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd,
- &vattr);
- if (error)
- goto out;
-#endif
- VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
- error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
- if (error == 0)
- vput(nd.ni_vp);
-#ifdef MAC
-out:
-#endif
- vput(nd.ni_dvp);
- vn_finished_write(mp);
- VFS_UNLOCK_GIANT(vfslocked);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- return (error);
-}
-
-/*
- * Make a hard file link.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct link_args {
- char *path;
- char *link;
-};
-#endif
-int
-link(td, uap)
- struct thread *td;
- register struct link_args /* {
- char *path;
- char *link;
- } */ *uap;
-{
- int error;
-
- error = kern_link(td, uap->path, uap->link, UIO_USERSPACE);
- return (error);
-}
-
-SYSCTL_DECL(_security_bsd);
-
-static int hardlink_check_uid = 0;
-SYSCTL_INT(_security_bsd, OID_AUTO, hardlink_check_uid, CTLFLAG_RW,
- &hardlink_check_uid, 0,
- "Unprivileged processes cannot create hard links to files owned by other "
- "users");
-static int hardlink_check_gid = 0;
-SYSCTL_INT(_security_bsd, OID_AUTO, hardlink_check_gid, CTLFLAG_RW,
- &hardlink_check_gid, 0,
- "Unprivileged processes cannot create hard links to files owned by other "
- "groups");
-
-static int
-can_hardlink(struct vnode *vp, struct thread *td, struct ucred *cred)
-{
- struct vattr va;
- int error;
-
- if (suser_cred(cred, SUSER_ALLOWJAIL) == 0)
- return (0);
-
- if (!hardlink_check_uid && !hardlink_check_gid)
- return (0);
-
- error = VOP_GETATTR(vp, &va, cred, td);
- if (error != 0)
- return (error);
-
- if (hardlink_check_uid) {
- if (cred->cr_uid != va.va_uid)
- return (EPERM);
- }
-
- if (hardlink_check_gid) {
- if (!groupmember(va.va_gid, cred))
- return (EPERM);
- }
-
- return (0);
-}
-
-int
-kern_link(struct thread *td, char *path, char *link, enum uio_seg segflg)
-{
- struct vnode *vp;
- struct mount *mp;
- struct nameidata nd;
- int vfslocked;
- int lvfslocked;
- int error;
-
- bwillwrite();
- NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, segflg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vp = nd.ni_vp;
- if (vp->v_type == VDIR) {
- vrele(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (EPERM); /* POSIX */
- }
- if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
- vrele(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
- }
- NDINIT(&nd, CREATE, LOCKPARENT | SAVENAME, segflg, link, td);
- if ((error = namei(&nd)) == 0) {
- lvfslocked = NDHASGIANT(&nd);
- if (nd.ni_vp != NULL) {
- vrele(nd.ni_vp);
- if (nd.ni_dvp == nd.ni_vp)
- vrele(nd.ni_dvp);
- else
- vput(nd.ni_dvp);
- error = EEXIST;
- } else if ((error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td))
- == 0) {
- VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- error = can_hardlink(vp, td, td->td_ucred);
- if (error == 0)
-#ifdef MAC
- error = mac_check_vnode_link(td->td_ucred,
- nd.ni_dvp, vp, &nd.ni_cnd);
- if (error == 0)
-#endif
- error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
- VOP_UNLOCK(vp, 0, td);
- vput(nd.ni_dvp);
- }
- NDFREE(&nd, NDF_ONLY_PNBUF);
- VFS_UNLOCK_GIANT(lvfslocked);
- }
- vrele(vp);
- vn_finished_write(mp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Make a symbolic link.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct symlink_args {
- char *path;
- char *link;
-};
-#endif
-int
-symlink(td, uap)
- struct thread *td;
- register struct symlink_args /* {
- char *path;
- char *link;
- } */ *uap;
-{
-
- return (kern_symlink(td, uap->path, uap->link, UIO_USERSPACE));
-}
-
-int
-kern_symlink(struct thread *td, char *path, char *link, enum uio_seg segflg)
-{
- struct mount *mp;
- struct vattr vattr;
- char *syspath;
- int error;
- struct nameidata nd;
- int vfslocked;
-
- if (segflg == UIO_SYSSPACE) {
- syspath = path;
- } else {
- syspath = uma_zalloc(namei_zone, M_WAITOK);
- if ((error = copyinstr(path, syspath, MAXPATHLEN, NULL)) != 0)
- goto out;
- }
-restart:
- bwillwrite();
- NDINIT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE,
- segflg, link, td);
- if ((error = namei(&nd)) != 0)
- goto out;
- vfslocked = NDHASGIANT(&nd);
- if (nd.ni_vp) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vrele(nd.ni_vp);
- if (nd.ni_vp == nd.ni_dvp)
- vrele(nd.ni_dvp);
- else
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- error = EEXIST;
- goto out;
- }
- if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
- goto out;
- goto restart;
- }
- VATTR_NULL(&vattr);
- FILEDESC_LOCK_FAST(td->td_proc->p_fd);
- vattr.va_mode = ACCESSPERMS &~ td->td_proc->p_fd->fd_cmask;
- FILEDESC_UNLOCK_FAST(td->td_proc->p_fd);
-#ifdef MAC
- vattr.va_type = VLNK;
- error = mac_check_vnode_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd,
- &vattr);
- if (error)
- goto out2;
-#endif
- VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
- error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, syspath);
- if (error == 0)
- vput(nd.ni_vp);
-#ifdef MAC
-out2:
-#endif
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_dvp);
- vn_finished_write(mp);
- VFS_UNLOCK_GIANT(vfslocked);
-out:
- if (segflg != UIO_SYSSPACE)
- uma_zfree(namei_zone, syspath);
- return (error);
-}
-
-/*
- * Delete a whiteout from the filesystem.
- */
-int
-undelete(td, uap)
- struct thread *td;
- register struct undelete_args /* {
- char *path;
- } */ *uap;
-{
- int error;
- struct mount *mp;
- struct nameidata nd;
- int vfslocked;
-
-restart:
- bwillwrite();
- NDINIT(&nd, DELETE, LOCKPARENT | DOWHITEOUT | MPSAFE, UIO_USERSPACE,
- uap->path, td);
- error = namei(&nd);
- if (error)
- return (error);
- vfslocked = NDHASGIANT(&nd);
-
- if (nd.ni_vp != NULLVP || !(nd.ni_cnd.cn_flags & ISWHITEOUT)) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- if (nd.ni_vp)
- vrele(nd.ni_vp);
- if (nd.ni_vp == nd.ni_dvp)
- vrele(nd.ni_dvp);
- else
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (EEXIST);
- }
- if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
- return (error);
- goto restart;
- }
- VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
- error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, DELETE);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_dvp);
- vn_finished_write(mp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Delete a name from the filesystem.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct unlink_args {
- char *path;
-};
-#endif
-int
-unlink(td, uap)
- struct thread *td;
- struct unlink_args /* {
- char *path;
- } */ *uap;
-{
- int error;
-
- error = kern_unlink(td, uap->path, UIO_USERSPACE);
- return (error);
-}
-
-int
-kern_unlink(struct thread *td, char *path, enum uio_seg pathseg)
-{
- struct mount *mp;
- struct vnode *vp;
- int error;
- struct nameidata nd;
- int vfslocked;
-
-restart:
- bwillwrite();
- NDINIT(&nd, DELETE, LOCKPARENT | LOCKLEAF | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- vp = nd.ni_vp;
- if (vp->v_type == VDIR)
- error = EPERM; /* POSIX */
- else {
- /*
- * The root of a mounted filesystem cannot be deleted.
- *
- * XXX: can this only be a VDIR case?
- */
- if (vp->v_vflag & VV_ROOT)
- error = EBUSY;
- }
- if (error == 0) {
- if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- if (vp == nd.ni_dvp)
- vrele(vp);
- else
- vput(vp);
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- if ((error = vn_start_write(NULL, &mp,
- V_XSLEEP | PCATCH)) != 0)
- return (error);
- goto restart;
- }
-#ifdef MAC
- error = mac_check_vnode_delete(td->td_ucred, nd.ni_dvp, vp,
- &nd.ni_cnd);
- if (error)
- goto out;
-#endif
- VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
- error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd);
-#ifdef MAC
-out:
-#endif
- vn_finished_write(mp);
- }
- NDFREE(&nd, NDF_ONLY_PNBUF);
- if (vp == nd.ni_dvp)
- vrele(vp);
- else
- vput(vp);
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Reposition read/write file offset.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct lseek_args {
- int fd;
- int pad;
- off_t offset;
- int whence;
-};
-#endif
-int
-lseek(td, uap)
- struct thread *td;
- register struct lseek_args /* {
- int fd;
- int pad;
- off_t offset;
- int whence;
- } */ *uap;
-{
- struct ucred *cred = td->td_ucred;
- struct file *fp;
- struct vnode *vp;
- struct vattr vattr;
- off_t offset;
- int error, noneg;
- int vfslocked;
-
- if ((error = fget(td, uap->fd, &fp)) != 0)
- return (error);
- if (!(fp->f_ops->fo_flags & DFLAG_SEEKABLE)) {
- fdrop(fp, td);
- return (ESPIPE);
- }
- vp = fp->f_vnode;
- vfslocked = VFS_LOCK_GIANT(vp->v_mount);
- noneg = (vp->v_type != VCHR);
- offset = uap->offset;
- switch (uap->whence) {
- case L_INCR:
- if (noneg &&
- (fp->f_offset < 0 ||
- (offset > 0 && fp->f_offset > OFF_MAX - offset))) {
- error = EOVERFLOW;
- break;
- }
- offset += fp->f_offset;
- break;
- case L_XTND:
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_GETATTR(vp, &vattr, cred, td);
- VOP_UNLOCK(vp, 0, td);
- if (error)
- break;
- if (noneg &&
- (vattr.va_size > OFF_MAX ||
- (offset > 0 && vattr.va_size > OFF_MAX - offset))) {
- error = EOVERFLOW;
- break;
- }
- offset += vattr.va_size;
- break;
- case L_SET:
- break;
- default:
- error = EINVAL;
- }
- if (error == 0 && noneg && offset < 0)
- error = EINVAL;
- if (error != 0)
- goto drop;
- fp->f_offset = offset;
- *(off_t *)(td->td_retval) = fp->f_offset;
-drop:
- fdrop(fp, td);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-#if defined(COMPAT_43)
-/*
- * Reposition read/write file offset.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct olseek_args {
- int fd;
- long offset;
- int whence;
-};
-#endif
-int
-olseek(td, uap)
- struct thread *td;
- register struct olseek_args /* {
- int fd;
- long offset;
- int whence;
- } */ *uap;
-{
- struct lseek_args /* {
- int fd;
- int pad;
- off_t offset;
- int whence;
- } */ nuap;
- int error;
-
- nuap.fd = uap->fd;
- nuap.offset = uap->offset;
- nuap.whence = uap->whence;
- error = lseek(td, &nuap);
- return (error);
-}
-#endif /* COMPAT_43 */
-
-/*
- * Check access permissions using passed credentials.
- */
-static int
-vn_access(vp, user_flags, cred, td)
- struct vnode *vp;
- int user_flags;
- struct ucred *cred;
- struct thread *td;
-{
- int error, flags;
-
- /* Flags == 0 means only check for existence. */
- error = 0;
- if (user_flags) {
- flags = 0;
- if (user_flags & R_OK)
- flags |= VREAD;
- if (user_flags & W_OK)
- flags |= VWRITE;
- if (user_flags & X_OK)
- flags |= VEXEC;
-#ifdef MAC
- error = mac_check_vnode_access(cred, vp, flags);
- if (error)
- return (error);
-#endif
- if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
- error = VOP_ACCESS(vp, flags, cred, td);
- }
- return (error);
-}
-
-/*
- * Check access permissions using "real" credentials.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct access_args {
- char *path;
- int flags;
-};
-#endif
-int
-access(td, uap)
- struct thread *td;
- register struct access_args /* {
- char *path;
- int flags;
- } */ *uap;
-{
-
- return (kern_access(td, uap->path, UIO_USERSPACE, uap->flags));
-}
-
-int
-kern_access(struct thread *td, char *path, enum uio_seg pathseg, int flags)
-{
- struct ucred *cred, *tmpcred;
- register struct vnode *vp;
- struct nameidata nd;
- int vfslocked;
- int error;
-
- /*
- * Create and modify a temporary credential instead of one that
- * is potentially shared. This could also mess up socket
- * buffer accounting which can run in an interrupt context.
- */
- cred = td->td_ucred;
- tmpcred = crdup(cred);
- tmpcred->cr_uid = cred->cr_ruid;
- tmpcred->cr_groups[0] = cred->cr_rgid;
- td->td_ucred = tmpcred;
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- goto out1;
- vfslocked = NDHASGIANT(&nd);
- vp = nd.ni_vp;
-
- error = vn_access(vp, flags, tmpcred, td);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
-out1:
- td->td_ucred = cred;
- crfree(tmpcred);
- return (error);
-}
-
-/*
- * Check access permissions using "effective" credentials.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct eaccess_args {
- char *path;
- int flags;
-};
-#endif
-int
-eaccess(td, uap)
- struct thread *td;
- register struct eaccess_args /* {
- char *path;
- int flags;
- } */ *uap;
-{
- struct nameidata nd;
- struct vnode *vp;
- int vfslocked;
- int error;
-
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, UIO_USERSPACE,
- uap->path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vp = nd.ni_vp;
- vfslocked = NDHASGIANT(&nd);
- error = vn_access(vp, uap->flags, td->td_ucred, td);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-#if defined(COMPAT_43)
-/*
- * Get file status; this version follows links.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct ostat_args {
- char *path;
- struct ostat *ub;
-};
-#endif
-int
-ostat(td, uap)
- struct thread *td;
- register struct ostat_args /* {
- char *path;
- struct ostat *ub;
- } */ *uap;
-{
- struct stat sb;
- struct ostat osb;
- int error;
-
- error = kern_stat(td, uap->path, UIO_USERSPACE, &sb);
- if (error)
- return (error);
- cvtstat(&sb, &osb);
- error = copyout(&osb, uap->ub, sizeof (osb));
- return (error);
-}
-
-/*
- * Get file status; this version does not follow links.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct olstat_args {
- char *path;
- struct ostat *ub;
-};
-#endif
-int
-olstat(td, uap)
- struct thread *td;
- register struct olstat_args /* {
- char *path;
- struct ostat *ub;
- } */ *uap;
-{
- struct stat sb;
- struct ostat osb;
- int error;
-
- error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb);
- if (error)
- return (error);
- cvtstat(&sb, &osb);
- error = copyout(&osb, uap->ub, sizeof (osb));
- return (error);
-}
-
-/*
- * Convert from an old to a new stat structure.
- */
-void
-cvtstat(st, ost)
- struct stat *st;
- struct ostat *ost;
-{
-
- ost->st_dev = st->st_dev;
- ost->st_ino = st->st_ino;
- ost->st_mode = st->st_mode;
- ost->st_nlink = st->st_nlink;
- ost->st_uid = st->st_uid;
- ost->st_gid = st->st_gid;
- ost->st_rdev = st->st_rdev;
- if (st->st_size < (quad_t)1 << 32)
- ost->st_size = st->st_size;
- else
- ost->st_size = -2;
- ost->st_atime = st->st_atime;
- ost->st_mtime = st->st_mtime;
- ost->st_ctime = st->st_ctime;
- ost->st_blksize = st->st_blksize;
- ost->st_blocks = st->st_blocks;
- ost->st_flags = st->st_flags;
- ost->st_gen = st->st_gen;
-}
-#endif /* COMPAT_43 */
-
-/*
- * Get file status; this version follows links.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct stat_args {
- char *path;
- struct stat *ub;
-};
-#endif
-int
-stat(td, uap)
- struct thread *td;
- register struct stat_args /* {
- char *path;
- struct stat *ub;
- } */ *uap;
-{
- struct stat sb;
- int error;
-
- error = kern_stat(td, uap->path, UIO_USERSPACE, &sb);
- if (error == 0)
- error = copyout(&sb, uap->ub, sizeof (sb));
- return (error);
-}
-
-int
-kern_stat(struct thread *td, char *path, enum uio_seg pathseg, struct stat *sbp)
-{
- struct nameidata nd;
- struct stat sb;
- int error, vfslocked;
-
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE,
- pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- if (error)
- return (error);
- *sbp = sb;
- return (0);
-}
-
-/*
- * Get file status; this version does not follow links.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct lstat_args {
- char *path;
- struct stat *ub;
-};
-#endif
-int
-lstat(td, uap)
- struct thread *td;
- register struct lstat_args /* {
- char *path;
- struct stat *ub;
- } */ *uap;
-{
- struct stat sb;
- int error;
-
- error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb);
- if (error == 0)
- error = copyout(&sb, uap->ub, sizeof (sb));
- return (error);
-}
-
-int
-kern_lstat(struct thread *td, char *path, enum uio_seg pathseg, struct stat *sbp)
-{
- struct vnode *vp;
- struct stat sb;
- struct nameidata nd;
- int error, vfslocked;
-
- NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | LOCKSHARED | MPSAFE,
- pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- vp = nd.ni_vp;
- error = vn_stat(vp, &sb, td->td_ucred, NOCRED, td);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- if (error)
- return (error);
- *sbp = sb;
- return (0);
-}
-
-/*
- * Implementation of the NetBSD [l]stat() functions.
- */
-void
-cvtnstat(sb, nsb)
- struct stat *sb;
- struct nstat *nsb;
-{
- bzero(nsb, sizeof *nsb);
- nsb->st_dev = sb->st_dev;
- nsb->st_ino = sb->st_ino;
- nsb->st_mode = sb->st_mode;
- nsb->st_nlink = sb->st_nlink;
- nsb->st_uid = sb->st_uid;
- nsb->st_gid = sb->st_gid;
- nsb->st_rdev = sb->st_rdev;
- nsb->st_atimespec = sb->st_atimespec;
- nsb->st_mtimespec = sb->st_mtimespec;
- nsb->st_ctimespec = sb->st_ctimespec;
- nsb->st_size = sb->st_size;
- nsb->st_blocks = sb->st_blocks;
- nsb->st_blksize = sb->st_blksize;
- nsb->st_flags = sb->st_flags;
- nsb->st_gen = sb->st_gen;
- nsb->st_birthtimespec = sb->st_birthtimespec;
-}
-
-#ifndef _SYS_SYSPROTO_H_
-struct nstat_args {
- char *path;
- struct nstat *ub;
-};
-#endif
-int
-nstat(td, uap)
- struct thread *td;
- register struct nstat_args /* {
- char *path;
- struct nstat *ub;
- } */ *uap;
-{
- struct stat sb;
- struct nstat nsb;
- int error;
-
- error = kern_stat(td, uap->path, UIO_USERSPACE, &sb);
- if (error)
- return (error);
- cvtnstat(&sb, &nsb);
- error = copyout(&nsb, uap->ub, sizeof (nsb));
- return (error);
-}
-
-/*
- * NetBSD lstat. Get file status; this version does not follow links.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct lstat_args {
- char *path;
- struct stat *ub;
-};
-#endif
-int
-nlstat(td, uap)
- struct thread *td;
- register struct nlstat_args /* {
- char *path;
- struct nstat *ub;
- } */ *uap;
-{
- struct stat sb;
- struct nstat nsb;
- int error;
-
- error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb);
- if (error)
- return (error);
- cvtnstat(&sb, &nsb);
- error = copyout(&nsb, uap->ub, sizeof (nsb));
- return (error);
-}
-
-/*
- * Get configurable pathname variables.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct pathconf_args {
- char *path;
- int name;
-};
-#endif
-int
-pathconf(td, uap)
- struct thread *td;
- register struct pathconf_args /* {
- char *path;
- int name;
- } */ *uap;
-{
-
- return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name));
-}
-
-int
-kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name)
-{
- struct nameidata nd;
- int error, vfslocked;
-
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
-
- /* If asynchronous I/O is available, it works for all files. */
- if (name == _PC_ASYNC_IO)
- td->td_retval[0] = async_io_version;
- else
- error = VOP_PATHCONF(nd.ni_vp, name, td->td_retval);
- vput(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Return target name of a symbolic link.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct readlink_args {
- char *path;
- char *buf;
- int count;
-};
-#endif
-int
-readlink(td, uap)
- struct thread *td;
- register struct readlink_args /* {
- char *path;
- char *buf;
- int count;
- } */ *uap;
-{
-
- return (kern_readlink(td, uap->path, UIO_USERSPACE, uap->buf,
- UIO_USERSPACE, uap->count));
-}
-
-int
-kern_readlink(struct thread *td, char *path, enum uio_seg pathseg, char *buf,
- enum uio_seg bufseg, int count)
-{
- register struct vnode *vp;
- struct iovec aiov;
- struct uio auio;
- int error;
- struct nameidata nd;
- int vfslocked;
-
- NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vfslocked = NDHASGIANT(&nd);
- vp = nd.ni_vp;
-#ifdef MAC
- error = mac_check_vnode_readlink(td->td_ucred, vp);
- if (error) {
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
- }
-#endif
- if (vp->v_type != VLNK)
- error = EINVAL;
- else {
- aiov.iov_base = buf;
- aiov.iov_len = count;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_offset = 0;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = bufseg;
- auio.uio_td = td;
- auio.uio_resid = count;
- error = VOP_READLINK(vp, &auio, td->td_ucred);
- }
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- td->td_retval[0] = count - auio.uio_resid;
- return (error);
-}
-
-/*
- * Common implementation code for chflags() and fchflags().
- */
-static int
-setfflags(td, vp, flags)
- struct thread *td;
- struct vnode *vp;
- int flags;
-{
- int error;
- struct mount *mp;
- struct vattr vattr;
-
- /*
- * Prevent non-root users from setting flags on devices. When
- * a device is reused, users can retain ownership of the device
- * if they are allowed to set flags and programs assume that
- * chown can't fail when done as root.
- */
- if (vp->v_type == VCHR || vp->v_type == VBLK) {
- error = suser_cred(td->td_ucred, SUSER_ALLOWJAIL);
- if (error)
- return (error);
- }
-
- if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- VATTR_NULL(&vattr);
- vattr.va_flags = flags;
-#ifdef MAC
- error = mac_check_vnode_setflags(td->td_ucred, vp, vattr.va_flags);
- if (error == 0)
-#endif
- error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return (error);
-}
-
-/*
- * Change flags of a file given a path name.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct chflags_args {
- char *path;
- int flags;
-};
-#endif
-int
-chflags(td, uap)
- struct thread *td;
- register struct chflags_args /* {
- char *path;
- int flags;
- } */ *uap;
-{
- int error;
- struct nameidata nd;
- int vfslocked;
-
- NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_USERSPACE, uap->path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vfslocked = NDHASGIANT(&nd);
- error = setfflags(td, nd.ni_vp, uap->flags);
- vrele(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Same as chflags() but doesn't follow symlinks.
- */
-int
-lchflags(td, uap)
- struct thread *td;
- register struct lchflags_args /* {
- char *path;
- int flags;
- } */ *uap;
-{
- int error;
- struct nameidata nd;
- int vfslocked;
-
- NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_USERSPACE, uap->path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = setfflags(td, nd.ni_vp, uap->flags);
- vrele(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Change flags of a file given a file descriptor.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct fchflags_args {
- int fd;
- int flags;
-};
-#endif
-int
-fchflags(td, uap)
- struct thread *td;
- register struct fchflags_args /* {
- int fd;
- int flags;
- } */ *uap;
-{
- struct file *fp;
- int vfslocked;
- int error;
-
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
- return (error);
- vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
- error = setfflags(td, fp->f_vnode, uap->flags);
- fdrop(fp, td);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Common implementation code for chmod(), lchmod() and fchmod().
- */
-static int
-setfmode(td, vp, mode)
- struct thread *td;
- struct vnode *vp;
- int mode;
-{
- int error;
- struct mount *mp;
- struct vattr vattr;
-
- if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- VATTR_NULL(&vattr);
- vattr.va_mode = mode & ALLPERMS;
-#ifdef MAC
- error = mac_check_vnode_setmode(td->td_ucred, vp, vattr.va_mode);
- if (error == 0)
-#endif
- error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return (error);
-}
-
-/*
- * Change mode of a file given path name.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct chmod_args {
- char *path;
- int mode;
-};
-#endif
-int
-chmod(td, uap)
- struct thread *td;
- register struct chmod_args /* {
- char *path;
- int mode;
- } */ *uap;
-{
-
- return (kern_chmod(td, uap->path, UIO_USERSPACE, uap->mode));
-}
-
-int
-kern_chmod(struct thread *td, char *path, enum uio_seg pathseg, int mode)
-{
- int error;
- struct nameidata nd;
- int vfslocked;
-
- NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = setfmode(td, nd.ni_vp, mode);
- vrele(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Change mode of a file given path name (don't follow links.)
- */
-#ifndef _SYS_SYSPROTO_H_
-struct lchmod_args {
- char *path;
- int mode;
-};
-#endif
-int
-lchmod(td, uap)
- struct thread *td;
- register struct lchmod_args /* {
- char *path;
- int mode;
- } */ *uap;
-{
- int error;
- struct nameidata nd;
- int vfslocked;
-
- NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_USERSPACE, uap->path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = setfmode(td, nd.ni_vp, uap->mode);
- vrele(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Change mode of a file given a file descriptor.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct fchmod_args {
- int fd;
- int mode;
-};
-#endif
-int
-fchmod(td, uap)
- struct thread *td;
- register struct fchmod_args /* {
- int fd;
- int mode;
- } */ *uap;
-{
- struct file *fp;
- int vfslocked;
- int error;
-
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
- return (error);
- vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
- error = setfmode(td, fp->f_vnode, uap->mode);
- fdrop(fp, td);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Common implementation for chown(), lchown(), and fchown()
- */
-static int
-setfown(td, vp, uid, gid)
- struct thread *td;
- struct vnode *vp;
- uid_t uid;
- gid_t gid;
-{
- int error;
- struct mount *mp;
- struct vattr vattr;
-
- if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- VATTR_NULL(&vattr);
- vattr.va_uid = uid;
- vattr.va_gid = gid;
-#ifdef MAC
- error = mac_check_vnode_setowner(td->td_ucred, vp, vattr.va_uid,
- vattr.va_gid);
- if (error == 0)
-#endif
- error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return (error);
-}
-
-/*
- * Set ownership given a path name.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct chown_args {
- char *path;
- int uid;
- int gid;
-};
-#endif
-int
-chown(td, uap)
- struct thread *td;
- register struct chown_args /* {
- char *path;
- int uid;
- int gid;
- } */ *uap;
-{
-
- return (kern_chown(td, uap->path, UIO_USERSPACE, uap->uid, uap->gid));
-}
-
-int
-kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid,
- int gid)
-{
- int error;
- struct nameidata nd;
- int vfslocked;
-
- NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = setfown(td, nd.ni_vp, uid, gid);
- vrele(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Set ownership given a path name, do not cross symlinks.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct lchown_args {
- char *path;
- int uid;
- int gid;
-};
-#endif
-int
-lchown(td, uap)
- struct thread *td;
- register struct lchown_args /* {
- char *path;
- int uid;
- int gid;
- } */ *uap;
-{
-
- return (kern_lchown(td, uap->path, UIO_USERSPACE, uap->uid, uap->gid));
-}
-
-int
-kern_lchown(struct thread *td, char *path, enum uio_seg pathseg, int uid,
- int gid)
-{
- int error;
- struct nameidata nd;
- int vfslocked;
-
- NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = setfown(td, nd.ni_vp, uid, gid);
- vrele(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Set ownership given a file descriptor.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct fchown_args {
- int fd;
- int uid;
- int gid;
-};
-#endif
-int
-fchown(td, uap)
- struct thread *td;
- register struct fchown_args /* {
- int fd;
- int uid;
- int gid;
- } */ *uap;
-{
- struct file *fp;
- int vfslocked;
- int error;
-
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
- return (error);
- vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
- error = setfown(td, fp->f_vnode, uap->uid, uap->gid);
- fdrop(fp, td);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Common implementation code for utimes(), lutimes(), and futimes().
- */
-static int
-getutimes(usrtvp, tvpseg, tsp)
- const struct timeval *usrtvp;
- enum uio_seg tvpseg;
- struct timespec *tsp;
-{
- struct timeval tv[2];
- const struct timeval *tvp;
- int error;
-
- if (usrtvp == NULL) {
- microtime(&tv[0]);
- TIMEVAL_TO_TIMESPEC(&tv[0], &tsp[0]);
- tsp[1] = tsp[0];
- } else {
- if (tvpseg == UIO_SYSSPACE) {
- tvp = usrtvp;
- } else {
- if ((error = copyin(usrtvp, tv, sizeof(tv))) != 0)
- return (error);
- tvp = tv;
- }
-
- TIMEVAL_TO_TIMESPEC(&tvp[0], &tsp[0]);
- TIMEVAL_TO_TIMESPEC(&tvp[1], &tsp[1]);
- }
- return (0);
-}
-
-/*
- * Common implementation code for utimes(), lutimes(), and futimes().
- */
-static int
-setutimes(td, vp, ts, numtimes, nullflag)
- struct thread *td;
- struct vnode *vp;
- const struct timespec *ts;
- int numtimes;
- int nullflag;
-{
- int error, setbirthtime;
- struct mount *mp;
- struct vattr vattr;
-
- if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- setbirthtime = 0;
- if (numtimes < 3 && VOP_GETATTR(vp, &vattr, td->td_ucred, td) == 0 &&
- timespeccmp(&ts[1], &vattr.va_birthtime, < ))
- setbirthtime = 1;
- VATTR_NULL(&vattr);
- vattr.va_atime = ts[0];
- vattr.va_mtime = ts[1];
- if (setbirthtime)
- vattr.va_birthtime = ts[1];
- if (numtimes > 2)
- vattr.va_birthtime = ts[2];
- if (nullflag)
- vattr.va_vaflags |= VA_UTIMES_NULL;
-#ifdef MAC
- error = mac_check_vnode_setutimes(td->td_ucred, vp, vattr.va_atime,
- vattr.va_mtime);
-#endif
- if (error == 0)
- error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return (error);
-}
-
-/*
- * Set the access and modification times of a file.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct utimes_args {
- char *path;
- struct timeval *tptr;
-};
-#endif
-int
-utimes(td, uap)
- struct thread *td;
- register struct utimes_args /* {
- char *path;
- struct timeval *tptr;
- } */ *uap;
-{
-
- return (kern_utimes(td, uap->path, UIO_USERSPACE, uap->tptr,
- UIO_USERSPACE));
-}
-
-int
-kern_utimes(struct thread *td, char *path, enum uio_seg pathseg,
- struct timeval *tptr, enum uio_seg tptrseg)
-{
- struct timespec ts[2];
- int error;
- struct nameidata nd;
- int vfslocked;
-
- if ((error = getutimes(tptr, tptrseg, ts)) != 0)
- return (error);
- NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = setutimes(td, nd.ni_vp, ts, 2, tptr == NULL);
- vrele(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Set the access and modification times of a file.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct lutimes_args {
- char *path;
- struct timeval *tptr;
-};
-#endif
-int
-lutimes(td, uap)
- struct thread *td;
- register struct lutimes_args /* {
- char *path;
- struct timeval *tptr;
- } */ *uap;
-{
-
- return (kern_lutimes(td, uap->path, UIO_USERSPACE, uap->tptr,
- UIO_USERSPACE));
-}
-
-int
-kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg,
- struct timeval *tptr, enum uio_seg tptrseg)
-{
- struct timespec ts[2];
- int error;
- struct nameidata nd;
- int vfslocked;
-
- if ((error = getutimes(tptr, tptrseg, ts)) != 0)
- return (error);
- NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- error = setutimes(td, nd.ni_vp, ts, 2, tptr == NULL);
- vrele(nd.ni_vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Set the access and modification times of a file.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct futimes_args {
- int fd;
- struct timeval *tptr;
-};
-#endif
-int
-futimes(td, uap)
- struct thread *td;
- register struct futimes_args /* {
- int fd;
- struct timeval *tptr;
- } */ *uap;
-{
-
- return (kern_futimes(td, uap->fd, uap->tptr, UIO_USERSPACE));
-}
-
-int
-kern_futimes(struct thread *td, int fd, struct timeval *tptr,
- enum uio_seg tptrseg)
-{
- struct timespec ts[2];
- struct file *fp;
- int vfslocked;
- int error;
-
- if ((error = getutimes(tptr, tptrseg, ts)) != 0)
- return (error);
- if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0)
- return (error);
- vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount);
- error = setutimes(td, fp->f_vnode, ts, 2, tptr == NULL);
- fdrop(fp, td);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Truncate a file given its path name.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct truncate_args {
- char *path;
- int pad;
- off_t length;
-};
-#endif
-int
-truncate(td, uap)
- struct thread *td;
- register struct truncate_args /* {
- char *path;
- int pad;
- off_t length;
- } */ *uap;
-{
-
- return (kern_truncate(td, uap->path, UIO_USERSPACE, uap->length));
-}
-
-int
-kern_truncate(struct thread *td, char *path, enum uio_seg pathseg, off_t length)
-{
- struct mount *mp;
- struct vnode *vp;
- struct vattr vattr;
- int error;
- struct nameidata nd;
- int vfslocked;
-
- if (length < 0)
- return(EINVAL);
- NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- vp = nd.ni_vp;
- if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
- vrele(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
- }
- NDFREE(&nd, NDF_ONLY_PNBUF);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- if (vp->v_type == VDIR)
- error = EISDIR;
-#ifdef MAC
- else if ((error = mac_check_vnode_write(td->td_ucred, NOCRED, vp))) {
- }
-#endif
- else if ((error = vn_writechk(vp)) == 0 &&
- (error = VOP_ACCESS(vp, VWRITE, td->td_ucred, td)) == 0) {
- VATTR_NULL(&vattr);
- vattr.va_size = length;
- error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
- }
- vput(vp);
- vn_finished_write(mp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Truncate a file given a file descriptor.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct ftruncate_args {
- int fd;
- int pad;
- off_t length;
-};
-#endif
-int
-ftruncate(td, uap)
- struct thread *td;
- register struct ftruncate_args /* {
- int fd;
- int pad;
- off_t length;
- } */ *uap;
-{
- struct mount *mp;
- struct vattr vattr;
- struct vnode *vp;
- struct file *fp;
- int vfslocked;
- int error;
-
- if (uap->length < 0)
- return(EINVAL);
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
- return (error);
- if ((fp->f_flag & FWRITE) == 0) {
- fdrop(fp, td);
- return (EINVAL);
- }
- vp = fp->f_vnode;
- vfslocked = VFS_LOCK_GIANT(vp->v_mount);
- if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
- goto drop;
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- if (vp->v_type == VDIR)
- error = EISDIR;
-#ifdef MAC
- else if ((error = mac_check_vnode_write(td->td_ucred, fp->f_cred,
- vp))) {
- }
-#endif
- else if ((error = vn_writechk(vp)) == 0) {
- VATTR_NULL(&vattr);
- vattr.va_size = uap->length;
- error = VOP_SETATTR(vp, &vattr, fp->f_cred, td);
- }
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
-drop:
- VFS_UNLOCK_GIANT(vfslocked);
- fdrop(fp, td);
- return (error);
-}
-
-#if defined(COMPAT_43)
-/*
- * Truncate a file given its path name.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct otruncate_args {
- char *path;
- long length;
-};
-#endif
-int
-otruncate(td, uap)
- struct thread *td;
- register struct otruncate_args /* {
- char *path;
- long length;
- } */ *uap;
-{
- struct truncate_args /* {
- char *path;
- int pad;
- off_t length;
- } */ nuap;
-
- nuap.path = uap->path;
- nuap.length = uap->length;
- return (truncate(td, &nuap));
-}
-
-/*
- * Truncate a file given a file descriptor.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct oftruncate_args {
- int fd;
- long length;
-};
-#endif
-int
-oftruncate(td, uap)
- struct thread *td;
- register struct oftruncate_args /* {
- int fd;
- long length;
- } */ *uap;
-{
- struct ftruncate_args /* {
- int fd;
- int pad;
- off_t length;
- } */ nuap;
-
- nuap.fd = uap->fd;
- nuap.length = uap->length;
- return (ftruncate(td, &nuap));
-}
-#endif /* COMPAT_43 */
-
-/*
- * Sync an open file.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct fsync_args {
- int fd;
-};
-#endif
-int
-fsync(td, uap)
- struct thread *td;
- struct fsync_args /* {
- int fd;
- } */ *uap;
-{
- struct vnode *vp;
- struct mount *mp;
- struct file *fp;
- int vfslocked;
- int error;
-
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
- return (error);
- vp = fp->f_vnode;
- vfslocked = VFS_LOCK_GIANT(vp->v_mount);
- if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
- goto drop;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- if (vp->v_object != NULL) {
- VM_OBJECT_LOCK(vp->v_object);
- vm_object_page_clean(vp->v_object, 0, 0, 0);
- VM_OBJECT_UNLOCK(vp->v_object);
- }
- error = VOP_FSYNC(vp, MNT_WAIT, td);
-
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
-drop:
- VFS_UNLOCK_GIANT(vfslocked);
- fdrop(fp, td);
- return (error);
-}
-
-/*
- * Rename files. Source and destination must either both be directories,
- * or both not be directories. If target is a directory, it must be empty.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct rename_args {
- char *from;
- char *to;
-};
-#endif
-int
-rename(td, uap)
- struct thread *td;
- register struct rename_args /* {
- char *from;
- char *to;
- } */ *uap;
-{
-
- return (kern_rename(td, uap->from, uap->to, UIO_USERSPACE));
-}
-
-int
-kern_rename(struct thread *td, char *from, char *to, enum uio_seg pathseg)
-{
- struct mount *mp = NULL;
- struct vnode *tvp, *fvp, *tdvp;
- struct nameidata fromnd, tond;
- int tvfslocked;
- int fvfslocked;
- int error;
-
- bwillwrite();
-#ifdef MAC
- NDINIT(&fromnd, DELETE, LOCKPARENT | LOCKLEAF | SAVESTART | MPSAFE,
- pathseg, from, td);
-#else
- NDINIT(&fromnd, DELETE, WANTPARENT | SAVESTART | MPSAFE,
- pathseg, from, td);
-#endif
- if ((error = namei(&fromnd)) != 0)
- return (error);
- fvfslocked = NDHASGIANT(&fromnd);
- tvfslocked = 0;
-#ifdef MAC
- error = mac_check_vnode_rename_from(td->td_ucred, fromnd.ni_dvp,
- fromnd.ni_vp, &fromnd.ni_cnd);
- VOP_UNLOCK(fromnd.ni_dvp, 0, td);
- VOP_UNLOCK(fromnd.ni_vp, 0, td);
-#endif
- fvp = fromnd.ni_vp;
- if (error == 0)
- error = vn_start_write(fvp, &mp, V_WAIT | PCATCH);
- if (error != 0) {
- NDFREE(&fromnd, NDF_ONLY_PNBUF);
- vrele(fromnd.ni_dvp);
- vrele(fvp);
- goto out1;
- }
- NDINIT(&tond, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART |
- MPSAFE, pathseg, to, td);
- if (fromnd.ni_vp->v_type == VDIR)
- tond.ni_cnd.cn_flags |= WILLBEDIR;
- if ((error = namei(&tond)) != 0) {
- /* Translate error code for rename("dir1", "dir2/."). */
- if (error == EISDIR && fvp->v_type == VDIR)
- error = EINVAL;
- NDFREE(&fromnd, NDF_ONLY_PNBUF);
- vrele(fromnd.ni_dvp);
- vrele(fvp);
- goto out1;
- }
- tvfslocked = NDHASGIANT(&tond);
- tdvp = tond.ni_dvp;
- tvp = tond.ni_vp;
- if (tvp != NULL) {
- if (fvp->v_type == VDIR && tvp->v_type != VDIR) {
- error = ENOTDIR;
- goto out;
- } else if (fvp->v_type != VDIR && tvp->v_type == VDIR) {
- error = EISDIR;
- goto out;
- }
- }
- if (fvp == tdvp)
- error = EINVAL;
- /*
- * If the source is the same as the destination (that is, if they
- * are links to the same vnode), then there is nothing to do.
- */
- if (fvp == tvp)
- error = -1;
-#ifdef MAC
- else
- error = mac_check_vnode_rename_to(td->td_ucred, tdvp,
- tond.ni_vp, fromnd.ni_dvp == tdvp, &tond.ni_cnd);
-#endif
-out:
- if (!error) {
- VOP_LEASE(tdvp, td, td->td_ucred, LEASE_WRITE);
- if (fromnd.ni_dvp != tdvp) {
- VOP_LEASE(fromnd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
- }
- if (tvp) {
- VOP_LEASE(tvp, td, td->td_ucred, LEASE_WRITE);
- }
- error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
- tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
- NDFREE(&fromnd, NDF_ONLY_PNBUF);
- NDFREE(&tond, NDF_ONLY_PNBUF);
- } else {
- NDFREE(&fromnd, NDF_ONLY_PNBUF);
- NDFREE(&tond, NDF_ONLY_PNBUF);
- if (tvp)
- vput(tvp);
- if (tdvp == tvp)
- vrele(tdvp);
- else
- vput(tdvp);
- vrele(fromnd.ni_dvp);
- vrele(fvp);
- }
- vrele(tond.ni_startdir);
-out1:
- vn_finished_write(mp);
- if (fromnd.ni_startdir)
- vrele(fromnd.ni_startdir);
- VFS_UNLOCK_GIANT(fvfslocked);
- VFS_UNLOCK_GIANT(tvfslocked);
- if (error == -1)
- return (0);
- return (error);
-}
-
-/*
- * Make a directory file.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct mkdir_args {
- char *path;
- int mode;
-};
-#endif
-int
-mkdir(td, uap)
- struct thread *td;
- register struct mkdir_args /* {
- char *path;
- int mode;
- } */ *uap;
-{
-
- return (kern_mkdir(td, uap->path, UIO_USERSPACE, uap->mode));
-}
-
-int
-kern_mkdir(struct thread *td, char *path, enum uio_seg segflg, int mode)
-{
- struct mount *mp;
- struct vnode *vp;
- struct vattr vattr;
- int error;
- struct nameidata nd;
- int vfslocked;
-
-restart:
- bwillwrite();
- NDINIT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE, segflg, path, td);
- nd.ni_cnd.cn_flags |= WILLBEDIR;
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- vp = nd.ni_vp;
- if (vp != NULL) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vrele(vp);
- /*
- * XXX namei called with LOCKPARENT but not LOCKLEAF has
- * the strange behaviour of leaving the vnode unlocked
- * if the target is the same vnode as the parent.
- */
- if (vp == nd.ni_dvp)
- vrele(nd.ni_dvp);
- else
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (EEXIST);
- }
- if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_dvp);
- VFS_UNLOCK_GIANT(vfslocked);
- if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
- return (error);
- goto restart;
- }
- VATTR_NULL(&vattr);
- vattr.va_type = VDIR;
- FILEDESC_LOCK_FAST(td->td_proc->p_fd);
- vattr.va_mode = (mode & ACCESSPERMS) &~ td->td_proc->p_fd->fd_cmask;
- FILEDESC_UNLOCK_FAST(td->td_proc->p_fd);
-#ifdef MAC
- error = mac_check_vnode_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd,
- &vattr);
- if (error)
- goto out;
-#endif
- VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
- error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
-#ifdef MAC
-out:
-#endif
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vput(nd.ni_dvp);
- if (!error)
- vput(nd.ni_vp);
- vn_finished_write(mp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Remove a directory file.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct rmdir_args {
- char *path;
-};
-#endif
-int
-rmdir(td, uap)
- struct thread *td;
- struct rmdir_args /* {
- char *path;
- } */ *uap;
-{
-
- return (kern_rmdir(td, uap->path, UIO_USERSPACE));
-}
-
-int
-kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg)
-{
- struct mount *mp;
- struct vnode *vp;
- int error;
- struct nameidata nd;
- int vfslocked;
-
-restart:
- bwillwrite();
- NDINIT(&nd, DELETE, LOCKPARENT | LOCKLEAF | MPSAFE, pathseg, path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- vp = nd.ni_vp;
- if (vp->v_type != VDIR) {
- error = ENOTDIR;
- goto out;
- }
- /*
- * No rmdir "." please.
- */
- if (nd.ni_dvp == vp) {
- error = EINVAL;
- goto out;
- }
- /*
- * The root of a mounted filesystem cannot be deleted.
- */
- if (vp->v_vflag & VV_ROOT) {
- error = EBUSY;
- goto out;
- }
-#ifdef MAC
- error = mac_check_vnode_delete(td->td_ucred, nd.ni_dvp, vp,
- &nd.ni_cnd);
- if (error)
- goto out;
-#endif
- if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) {
- NDFREE(&nd, NDF_ONLY_PNBUF);
- if (nd.ni_dvp == vp)
- vrele(nd.ni_dvp);
- else
- vput(nd.ni_dvp);
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
- return (error);
- goto restart;
- }
- VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
- vn_finished_write(mp);
-out:
- NDFREE(&nd, NDF_ONLY_PNBUF);
- if (nd.ni_dvp == vp)
- vrele(nd.ni_dvp);
- else
- vput(nd.ni_dvp);
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-#ifdef COMPAT_43
-/*
- * Read a block of directory entries in a filesystem independent format.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct ogetdirentries_args {
- int fd;
- char *buf;
- u_int count;
- long *basep;
-};
-#endif
-int
-ogetdirentries(td, uap)
- struct thread *td;
- register struct ogetdirentries_args /* {
- int fd;
- char *buf;
- u_int count;
- long *basep;
- } */ *uap;
-{
- struct vnode *vp;
- struct file *fp;
- struct uio auio, kuio;
- struct iovec aiov, kiov;
- struct dirent *dp, *edp;
- caddr_t dirbuf;
- int error, eofflag, readcnt;
- long loff;
-
- /* XXX arbitrary sanity limit on `count'. */
- if (uap->count > 64 * 1024)
- return (EINVAL);
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
- return (error);
- if ((fp->f_flag & FREAD) == 0) {
- fdrop(fp, td);
- return (EBADF);
- }
- vp = fp->f_vnode;
-unionread:
- if (vp->v_type != VDIR) {
- fdrop(fp, td);
- return (EINVAL);
- }
- aiov.iov_base = uap->buf;
- aiov.iov_len = uap->count;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_td = td;
- auio.uio_resid = uap->count;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- loff = auio.uio_offset = fp->f_offset;
-#ifdef MAC
- error = mac_check_vnode_readdir(td->td_ucred, vp);
- if (error) {
- VOP_UNLOCK(vp, 0, td);
- fdrop(fp, td);
- return (error);
- }
-#endif
-# if (BYTE_ORDER != LITTLE_ENDIAN)
- if (vp->v_mount->mnt_maxsymlinklen <= 0) {
- error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag,
- NULL, NULL);
- fp->f_offset = auio.uio_offset;
- } else
-# endif
- {
- kuio = auio;
- kuio.uio_iov = &kiov;
- kuio.uio_segflg = UIO_SYSSPACE;
- kiov.iov_len = uap->count;
- MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, M_WAITOK);
- kiov.iov_base = dirbuf;
- error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag,
- NULL, NULL);
- fp->f_offset = kuio.uio_offset;
- if (error == 0) {
- readcnt = uap->count - kuio.uio_resid;
- edp = (struct dirent *)&dirbuf[readcnt];
- for (dp = (struct dirent *)dirbuf; dp < edp; ) {
-# if (BYTE_ORDER == LITTLE_ENDIAN)
- /*
- * The expected low byte of
- * dp->d_namlen is our dp->d_type.
- * The high MBZ byte of dp->d_namlen
- * is our dp->d_namlen.
- */
- dp->d_type = dp->d_namlen;
- dp->d_namlen = 0;
-# else
- /*
- * The dp->d_type is the high byte
- * of the expected dp->d_namlen,
- * so must be zero'ed.
- */
- dp->d_type = 0;
-# endif
- if (dp->d_reclen > 0) {
- dp = (struct dirent *)
- ((char *)dp + dp->d_reclen);
- } else {
- error = EIO;
- break;
- }
- }
- if (dp >= edp)
- error = uiomove(dirbuf, readcnt, &auio);
- }
- FREE(dirbuf, M_TEMP);
- }
- VOP_UNLOCK(vp, 0, td);
- if (error) {
- fdrop(fp, td);
- return (error);
- }
- if (uap->count == auio.uio_resid) {
- if (union_dircheckp) {
- error = union_dircheckp(td, &vp, fp);
- if (error == -1)
- goto unionread;
- if (error) {
- fdrop(fp, td);
- return (error);
- }
- }
- /*
- * XXX We could delay dropping the lock above but
- * union_dircheckp complicates things.
- */
- vn_lock(vp, LK_EXCLUSIVE|LK_RETRY, td);
- if ((vp->v_vflag & VV_ROOT) &&
- (vp->v_mount->mnt_flag & MNT_UNION)) {
- struct vnode *tvp = vp;
- vp = vp->v_mount->mnt_vnodecovered;
- VREF(vp);
- fp->f_vnode = vp;
- fp->f_data = vp;
- fp->f_offset = 0;
- vput(tvp);
- goto unionread;
- }
- VOP_UNLOCK(vp, 0, td);
- }
- error = copyout(&loff, uap->basep, sizeof(long));
- fdrop(fp, td);
- td->td_retval[0] = uap->count - auio.uio_resid;
- return (error);
-}
-#endif /* COMPAT_43 */
-
-/*
- * Read a block of directory entries in a filesystem independent format.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct getdirentries_args {
- int fd;
- char *buf;
- u_int count;
- long *basep;
-};
-#endif
-int
-getdirentries(td, uap)
- struct thread *td;
- register struct getdirentries_args /* {
- int fd;
- char *buf;
- u_int count;
- long *basep;
- } */ *uap;
-{
- struct vnode *vp;
- struct file *fp;
- struct uio auio;
- struct iovec aiov;
- int vfslocked;
- long loff;
- int error, eofflag;
-
- if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
- return (error);
- if ((fp->f_flag & FREAD) == 0) {
- fdrop(fp, td);
- return (EBADF);
- }
- vp = fp->f_vnode;
-unionread:
- vfslocked = VFS_LOCK_GIANT(vp->v_mount);
- if (vp->v_type != VDIR) {
- error = EINVAL;
- goto fail;
- }
- aiov.iov_base = uap->buf;
- aiov.iov_len = uap->count;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_td = td;
- auio.uio_resid = uap->count;
- /* vn_lock(vp, LK_SHARED | LK_RETRY, td); */
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- loff = auio.uio_offset = fp->f_offset;
-#ifdef MAC
- error = mac_check_vnode_readdir(td->td_ucred, vp);
- if (error == 0)
-#endif
- error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL,
- NULL);
- fp->f_offset = auio.uio_offset;
- VOP_UNLOCK(vp, 0, td);
- if (error)
- goto fail;
- if (uap->count == auio.uio_resid) {
- if (union_dircheckp) {
- error = union_dircheckp(td, &vp, fp);
- if (error == -1) {
- VFS_UNLOCK_GIANT(vfslocked);
- goto unionread;
- }
- if (error)
- goto fail;
- }
- /*
- * XXX We could delay dropping the lock above but
- * union_dircheckp complicates things.
- */
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- if ((vp->v_vflag & VV_ROOT) &&
- (vp->v_mount->mnt_flag & MNT_UNION)) {
- struct vnode *tvp = vp;
- vp = vp->v_mount->mnt_vnodecovered;
- VREF(vp);
- fp->f_vnode = vp;
- fp->f_data = vp;
- fp->f_offset = 0;
- vput(tvp);
- VFS_UNLOCK_GIANT(vfslocked);
- goto unionread;
- }
- VOP_UNLOCK(vp, 0, td);
- }
- if (uap->basep != NULL) {
- error = copyout(&loff, uap->basep, sizeof(long));
- }
- td->td_retval[0] = uap->count - auio.uio_resid;
-fail:
- VFS_UNLOCK_GIANT(vfslocked);
- fdrop(fp, td);
- return (error);
-}
-#ifndef _SYS_SYSPROTO_H_
-struct getdents_args {
- int fd;
- char *buf;
- size_t count;
-};
-#endif
-int
-getdents(td, uap)
- struct thread *td;
- register struct getdents_args /* {
- int fd;
- char *buf;
- u_int count;
- } */ *uap;
-{
- struct getdirentries_args ap;
- ap.fd = uap->fd;
- ap.buf = uap->buf;
- ap.count = uap->count;
- ap.basep = NULL;
- return (getdirentries(td, &ap));
-}
-
-/*
- * Set the mode mask for creation of filesystem nodes.
- *
- * MP SAFE
- */
-#ifndef _SYS_SYSPROTO_H_
-struct umask_args {
- int newmask;
-};
-#endif
-int
-umask(td, uap)
- struct thread *td;
- struct umask_args /* {
- int newmask;
- } */ *uap;
-{
- register struct filedesc *fdp;
-
- FILEDESC_LOCK_FAST(td->td_proc->p_fd);
- fdp = td->td_proc->p_fd;
- td->td_retval[0] = fdp->fd_cmask;
- fdp->fd_cmask = uap->newmask & ALLPERMS;
- FILEDESC_UNLOCK_FAST(td->td_proc->p_fd);
- return (0);
-}
-
-/*
- * Void all references to file by ripping underlying filesystem
- * away from vnode.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct revoke_args {
- char *path;
-};
-#endif
-int
-revoke(td, uap)
- struct thread *td;
- register struct revoke_args /* {
- char *path;
- } */ *uap;
-{
- struct vnode *vp;
- struct vattr vattr;
- int error;
- struct nameidata nd;
- int vfslocked;
-
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, UIO_USERSPACE,
- uap->path, td);
- if ((error = namei(&nd)) != 0)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- vp = nd.ni_vp;
- NDFREE(&nd, NDF_ONLY_PNBUF);
- if (vp->v_type != VCHR) {
- error = EINVAL;
- goto out;
- }
-#ifdef MAC
- error = mac_check_vnode_revoke(td->td_ucred, vp);
- if (error)
- goto out;
-#endif
- error = VOP_GETATTR(vp, &vattr, td->td_ucred, td);
- if (error)
- goto out;
- if (td->td_ucred->cr_uid != vattr.va_uid) {
- error = suser_cred(td->td_ucred, SUSER_ALLOWJAIL);
- if (error)
- goto out;
- }
- if (vcount(vp) > 1)
- VOP_REVOKE(vp, REVOKEALL);
-out:
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- return (error);
-}
-
-/*
- * Convert a user file descriptor to a kernel file entry.
- * A reference on the file entry is held upon returning.
- */
-int
-getvnode(fdp, fd, fpp)
- struct filedesc *fdp;
- int fd;
- struct file **fpp;
-{
- int error;
- struct file *fp;
-
- fp = NULL;
- if (fdp == NULL)
- error = EBADF;
- else {
- FILEDESC_LOCK(fdp);
- if ((u_int)fd >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[fd]) == NULL)
- error = EBADF;
- else if (fp->f_vnode == NULL) {
- fp = NULL;
- error = EINVAL;
- } else {
- fhold(fp);
- error = 0;
- }
- FILEDESC_UNLOCK(fdp);
- }
- *fpp = fp;
- return (error);
-}
-
-/*
- * Get (NFS) file handle
- */
-#ifndef _SYS_SYSPROTO_H_
-struct lgetfh_args {
- char *fname;
- fhandle_t *fhp;
-};
-#endif
-int
-lgetfh(td, uap)
- struct thread *td;
- register struct lgetfh_args *uap;
-{
- struct nameidata nd;
- fhandle_t fh;
- register struct vnode *vp;
- int vfslocked;
- int error;
-
- error = suser(td);
- if (error)
- return (error);
- NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | MPSAFE,
- UIO_USERSPACE, uap->fname, td);
- error = namei(&nd);
- if (error)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vp = nd.ni_vp;
- bzero(&fh, sizeof(fh));
- fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
- error = VFS_VPTOFH(vp, &fh.fh_fid);
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- if (error)
- return (error);
- error = copyout(&fh, uap->fhp, sizeof (fh));
- return (error);
-}
-
-#ifndef _SYS_SYSPROTO_H_
-struct getfh_args {
- char *fname;
- fhandle_t *fhp;
-};
-#endif
-int
-getfh(td, uap)
- struct thread *td;
- register struct getfh_args *uap;
-{
- struct nameidata nd;
- fhandle_t fh;
- register struct vnode *vp;
- int vfslocked;
- int error;
-
- error = suser(td);
- if (error)
- return (error);
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE,
- UIO_USERSPACE, uap->fname, td);
- error = namei(&nd);
- if (error)
- return (error);
- vfslocked = NDHASGIANT(&nd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
- vp = nd.ni_vp;
- bzero(&fh, sizeof(fh));
- fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
- error = VFS_VPTOFH(vp, &fh.fh_fid);
- vput(vp);
- VFS_UNLOCK_GIANT(vfslocked);
- if (error)
- return (error);
- error = copyout(&fh, uap->fhp, sizeof (fh));
- return (error);
-}
-
-/*
- * syscall for the rpc.lockd to use to translate a NFS file handle into
- * an open descriptor.
- *
- * warning: do not remove the suser() call or this becomes one giant
- * security hole.
- *
- * MP SAFE
- */
-#ifndef _SYS_SYSPROTO_H_
-struct fhopen_args {
- const struct fhandle *u_fhp;
- int flags;
-};
-#endif
-int
-fhopen(td, uap)
- struct thread *td;
- struct fhopen_args /* {
- const struct fhandle *u_fhp;
- int flags;
- } */ *uap;
-{
- struct proc *p = td->td_proc;
- struct mount *mp;
- struct vnode *vp;
- struct fhandle fhp;
- struct vattr vat;
- struct vattr *vap = &vat;
- struct flock lf;
- struct file *fp;
- register struct filedesc *fdp = p->p_fd;
- int fmode, mode, error, type;
- struct file *nfp;
- int indx;
-
- error = suser(td);
- if (error)
- return (error);
- fmode = FFLAGS(uap->flags);
- /* why not allow a non-read/write open for our lockd? */
- if (((fmode & (FREAD | FWRITE)) == 0) || (fmode & O_CREAT))
- return (EINVAL);
- error = copyin(uap->u_fhp, &fhp, sizeof(fhp));
- if (error)
- return(error);
- /* find the mount point */
- mtx_lock(&Giant);
- mp = vfs_getvfs(&fhp.fh_fsid);
- if (mp == NULL) {
- error = ESTALE;
- goto out;
- }
- /* now give me my vnode, it gets returned to me locked */
- error = VFS_FHTOVP(mp, &fhp.fh_fid, &vp);
- if (error)
- goto out;
- /*
- * from now on we have to make sure not
- * to forget about the vnode
- * any error that causes an abort must vput(vp)
- * just set error = err and 'goto bad;'.
- */
-
- /*
- * from vn_open
- */
- if (vp->v_type == VLNK) {
- error = EMLINK;
- goto bad;
- }
- if (vp->v_type == VSOCK) {
- error = EOPNOTSUPP;
- goto bad;
- }
- mode = 0;
- if (fmode & (FWRITE | O_TRUNC)) {
- if (vp->v_type == VDIR) {
- error = EISDIR;
- goto bad;
- }
- error = vn_writechk(vp);
- if (error)
- goto bad;
- mode |= VWRITE;
- }
- if (fmode & FREAD)
- mode |= VREAD;
- if (fmode & O_APPEND)
- mode |= VAPPEND;
-#ifdef MAC
- error = mac_check_vnode_open(td->td_ucred, vp, mode);
- if (error)
- goto bad;
-#endif
- if (mode) {
- error = VOP_ACCESS(vp, mode, td->td_ucred, td);
- if (error)
- goto bad;
- }
- if (fmode & O_TRUNC) {
- VOP_UNLOCK(vp, 0, td); /* XXX */
- if ((error = vn_start_write(NULL, &mp, V_WAIT | PCATCH)) != 0) {
- vrele(vp);
- goto out;
- }
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); /* XXX */
-#ifdef MAC
- /*
- * We don't yet have fp->f_cred, so use td->td_ucred, which
- * should be right.
- */
- error = mac_check_vnode_write(td->td_ucred, td->td_ucred, vp);
- if (error == 0) {
-#endif
- VATTR_NULL(vap);
- vap->va_size = 0;
- error = VOP_SETATTR(vp, vap, td->td_ucred, td);
-#ifdef MAC
- }
-#endif
- vn_finished_write(mp);
- if (error)
- goto bad;
- }
- error = VOP_OPEN(vp, fmode, td->td_ucred, td, -1);
- if (error)
- goto bad;
-
- if (fmode & FWRITE)
- vp->v_writecount++;
-
- /*
- * end of vn_open code
- */
-
- if ((error = falloc(td, &nfp, &indx)) != 0) {
- if (fmode & FWRITE)
- vp->v_writecount--;
- goto bad;
- }
- /* An extra reference on `nfp' has been held for us by falloc(). */
- fp = nfp;
-
- nfp->f_vnode = vp;
- nfp->f_data = vp;
- nfp->f_flag = fmode & FMASK;
- nfp->f_ops = &vnops;
- nfp->f_type = DTYPE_VNODE;
- if (fmode & (O_EXLOCK | O_SHLOCK)) {
- lf.l_whence = SEEK_SET;
- lf.l_start = 0;
- lf.l_len = 0;
- if (fmode & O_EXLOCK)
- lf.l_type = F_WRLCK;
- else
- lf.l_type = F_RDLCK;
- type = F_FLOCK;
- if ((fmode & FNONBLOCK) == 0)
- type |= F_WAIT;
- VOP_UNLOCK(vp, 0, td);
- if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf,
- type)) != 0) {
- /*
- * The lock request failed. Normally close the
- * descriptor but handle the case where someone might
- * have dup()d or close()d it when we weren't looking.
- */
- fdclose(fdp, fp, indx, td);
-
- /*
- * release our private reference
- */
- fdrop(fp, td);
- goto out;
- }
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- fp->f_flag |= FHASLOCK;
- }
-
- VOP_UNLOCK(vp, 0, td);
- fdrop(fp, td);
- mtx_unlock(&Giant);
- td->td_retval[0] = indx;
- return (0);
-
-bad:
- vput(vp);
-out:
- mtx_unlock(&Giant);
- return (error);
-}
-
-/*
- * Stat an (NFS) file handle.
- *
- * MP SAFE
- */
-#ifndef _SYS_SYSPROTO_H_
-struct fhstat_args {
- struct fhandle *u_fhp;
- struct stat *sb;
-};
-#endif
-int
-fhstat(td, uap)
- struct thread *td;
- register struct fhstat_args /* {
- struct fhandle *u_fhp;
- struct stat *sb;
- } */ *uap;
-{
- struct stat sb;
- fhandle_t fh;
- struct mount *mp;
- struct vnode *vp;
- int error;
-
- error = suser(td);
- if (error)
- return (error);
- error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t));
- if (error)
- return (error);
- mtx_lock(&Giant);
- if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL) {
- mtx_unlock(&Giant);
- return (ESTALE);
- }
- if ((error = VFS_FHTOVP(mp, &fh.fh_fid, &vp))) {
- mtx_unlock(&Giant);
- return (error);
- }
- error = vn_stat(vp, &sb, td->td_ucred, NOCRED, td);
- vput(vp);
- mtx_unlock(&Giant);
- if (error)
- return (error);
- error = copyout(&sb, uap->sb, sizeof(sb));
- return (error);
-}
-
-/*
- * Implement fstatfs() for (NFS) file handles.
- *
- * MP SAFE
- */
-#ifndef _SYS_SYSPROTO_H_
-struct fhstatfs_args {
- struct fhandle *u_fhp;
- struct statfs *buf;
-};
-#endif
-int
-fhstatfs(td, uap)
- struct thread *td;
- struct fhstatfs_args /* {
- struct fhandle *u_fhp;
- struct statfs *buf;
- } */ *uap;
-{
- struct statfs sf;
- fhandle_t fh;
- int error;
-
- error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t));
- if (error)
- return (error);
- error = kern_fhstatfs(td, fh, &sf);
- if (error)
- return (error);
- return (copyout(&sf, uap->buf, sizeof(sf)));
-}
-
-int
-kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf)
-{
- struct statfs *sp;
- struct mount *mp;
- struct vnode *vp;
- int error;
-
- error = suser(td);
- if (error)
- return (error);
- mtx_lock(&Giant);
- if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL) {
- mtx_unlock(&Giant);
- return (ESTALE);
- }
- error = VFS_FHTOVP(mp, &fh.fh_fid, &vp);
- if (error) {
- mtx_unlock(&Giant);
- return (error);
- }
- mp = vp->v_mount;
- sp = &mp->mnt_stat;
- vput(vp);
- error = prison_canseemount(td->td_ucred, mp);
- if (error)
- return (error);
-#ifdef MAC
- error = mac_check_mount_stat(td->td_ucred, mp);
- if (error) {
- mtx_unlock(&Giant);
- return (error);
- }
-#endif
- /*
- * Set these in case the underlying filesystem fails to do so.
- */
- sp->f_version = STATFS_VERSION;
- sp->f_namemax = NAME_MAX;
- sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- error = VFS_STATFS(mp, sp, td);
- mtx_unlock(&Giant);
- if (error)
- return (error);
- *buf = *sp;
- return (0);
-}
-
-/*
- * Syscall to push extended attribute configuration information into the
- * VFS. Accepts a path, which it converts to a mountpoint, as well as
- * a command (int cmd), and attribute name and misc data. For now, the
- * attribute name is left in userspace for consumption by the VFS_op.
- * It will probably be changed to be copied into sysspace by the
- * syscall in the future, once issues with various consumers of the
- * attribute code have raised their hands.
- *
- * Currently this is used only by UFS Extended Attributes.
- */
-int
-extattrctl(td, uap)
- struct thread *td;
- struct extattrctl_args /* {
- const char *path;
- int cmd;
- const char *filename;
- int attrnamespace;
- const char *attrname;
- } */ *uap;
-{
- struct vnode *filename_vp;
- struct nameidata nd;
- struct mount *mp, *mp_writable;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- /*
- * uap->attrname is not always defined. We check again later when we
- * invoke the VFS call so as to pass in NULL there if needed.
- */
- if (uap->attrname != NULL) {
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN,
- NULL);
- if (error)
- return (error);
- }
-
- /*
- * uap->filename is not always defined. If it is, grab a vnode lock,
- * which VFS_EXTATTRCTL() will later release.
- */
- filename_vp = NULL;
- if (uap->filename != NULL) {
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
- uap->filename, td);
- error = namei(&nd);
- if (error)
- return (error);
- filename_vp = nd.ni_vp;
- NDFREE(&nd, NDF_NO_VP_RELE | NDF_NO_VP_UNLOCK);
- }
-
- /* uap->path is always defined. */
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error) {
- if (filename_vp != NULL)
- vput(filename_vp);
- return (error);
- }
- mp = nd.ni_vp->v_mount;
- error = vn_start_write(nd.ni_vp, &mp_writable, V_WAIT | PCATCH);
- NDFREE(&nd, 0);
- if (error) {
- if (filename_vp != NULL)
- vput(filename_vp);
- return (error);
- }
-
- error = VFS_EXTATTRCTL(mp, uap->cmd, filename_vp, uap->attrnamespace,
- uap->attrname != NULL ? attrname : NULL, td);
-
- vn_finished_write(mp_writable);
- /*
- * VFS_EXTATTRCTL will have unlocked, but not de-ref'd,
- * filename_vp, so vrele it if it is defined.
- */
- if (filename_vp != NULL)
- vrele(filename_vp);
- return (error);
-}
-
-/*-
- * Set a named extended attribute on a file or directory
- *
- * Arguments: unlocked vnode "vp", attribute namespace "attrnamespace",
- * kernelspace string pointer "attrname", userspace buffer
- * pointer "data", buffer length "nbytes", thread "td".
- * Returns: 0 on success, an error number otherwise
- * Locks: none
- * References: vp must be a valid reference for the duration of the call
- */
-static int
-extattr_set_vp(struct vnode *vp, int attrnamespace, const char *attrname,
- void *data, size_t nbytes, struct thread *td)
-{
- struct mount *mp;
- struct uio auio;
- struct iovec aiov;
- ssize_t cnt;
- int error;
-
- error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
- if (error)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-
- aiov.iov_base = data;
- aiov.iov_len = nbytes;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_offset = 0;
- if (nbytes > INT_MAX) {
- error = EINVAL;
- goto done;
- }
- auio.uio_resid = nbytes;
- auio.uio_rw = UIO_WRITE;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_td = td;
- cnt = nbytes;
-
-#ifdef MAC
- error = mac_check_vnode_setextattr(td->td_ucred, vp, attrnamespace,
- attrname, &auio);
- if (error)
- goto done;
-#endif
-
- error = VOP_SETEXTATTR(vp, attrnamespace, attrname, &auio,
- td->td_ucred, td);
- cnt -= auio.uio_resid;
- td->td_retval[0] = cnt;
-
-done:
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return (error);
-}
-
-int
-extattr_set_fd(td, uap)
- struct thread *td;
- struct extattr_set_fd_args /* {
- int fd;
- int attrnamespace;
- const char *attrname;
- void *data;
- size_t nbytes;
- } */ *uap;
-{
- struct file *fp;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
- if (error)
- return (error);
-
- error = getvnode(td->td_proc->p_fd, uap->fd, &fp);
- if (error)
- return (error);
-
- error = extattr_set_vp(fp->f_vnode, uap->attrnamespace,
- attrname, uap->data, uap->nbytes, td);
- fdrop(fp, td);
-
- return (error);
-}
-
-int
-extattr_set_file(td, uap)
- struct thread *td;
- struct extattr_set_file_args /* {
- const char *path;
- int attrnamespace;
- const char *attrname;
- void *data;
- size_t nbytes;
- } */ *uap;
-{
- struct nameidata nd;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
- if (error)
- return (error);
-
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error)
- return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
-
- error = extattr_set_vp(nd.ni_vp, uap->attrnamespace, attrname,
- uap->data, uap->nbytes, td);
-
- vrele(nd.ni_vp);
- return (error);
-}
-
-int
-extattr_set_link(td, uap)
- struct thread *td;
- struct extattr_set_link_args /* {
- const char *path;
- int attrnamespace;
- const char *attrname;
- void *data;
- size_t nbytes;
- } */ *uap;
-{
- struct nameidata nd;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
- if (error)
- return (error);
-
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error)
- return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
-
- error = extattr_set_vp(nd.ni_vp, uap->attrnamespace, attrname,
- uap->data, uap->nbytes, td);
-
- vrele(nd.ni_vp);
- return (error);
-}
-
-/*-
- * Get a named extended attribute on a file or directory
- *
- * Arguments: unlocked vnode "vp", attribute namespace "attrnamespace",
- * kernelspace string pointer "attrname", userspace buffer
- * pointer "data", buffer length "nbytes", thread "td".
- * Returns: 0 on success, an error number otherwise
- * Locks: none
- * References: vp must be a valid reference for the duration of the call
- */
-static int
-extattr_get_vp(struct vnode *vp, int attrnamespace, const char *attrname,
- void *data, size_t nbytes, struct thread *td)
-{
- struct uio auio, *auiop;
- struct iovec aiov;
- ssize_t cnt;
- size_t size, *sizep;
- int error;
-
- VOP_LEASE(vp, td, td->td_ucred, LEASE_READ);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-
- /*
- * Slightly unusual semantics: if the user provides a NULL data
- * pointer, they don't want to receive the data, just the
- * maximum read length.
- */
- auiop = NULL;
- sizep = NULL;
- cnt = 0;
- if (data != NULL) {
- aiov.iov_base = data;
- aiov.iov_len = nbytes;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_offset = 0;
- if (nbytes > INT_MAX) {
- error = EINVAL;
- goto done;
- }
- auio.uio_resid = nbytes;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_td = td;
- auiop = &auio;
- cnt = nbytes;
- } else
- sizep = &size;
-
-#ifdef MAC
- error = mac_check_vnode_getextattr(td->td_ucred, vp, attrnamespace,
- attrname, &auio);
- if (error)
- goto done;
-#endif
-
- error = VOP_GETEXTATTR(vp, attrnamespace, attrname, auiop, sizep,
- td->td_ucred, td);
-
- if (auiop != NULL) {
- cnt -= auio.uio_resid;
- td->td_retval[0] = cnt;
- } else
- td->td_retval[0] = size;
-
-done:
- VOP_UNLOCK(vp, 0, td);
- return (error);
-}
-
-int
-extattr_get_fd(td, uap)
- struct thread *td;
- struct extattr_get_fd_args /* {
- int fd;
- int attrnamespace;
- const char *attrname;
- void *data;
- size_t nbytes;
- } */ *uap;
-{
- struct file *fp;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
- if (error)
- return (error);
-
- error = getvnode(td->td_proc->p_fd, uap->fd, &fp);
- if (error)
- return (error);
-
- error = extattr_get_vp(fp->f_vnode, uap->attrnamespace,
- attrname, uap->data, uap->nbytes, td);
-
- fdrop(fp, td);
- return (error);
-}
-
-int
-extattr_get_file(td, uap)
- struct thread *td;
- struct extattr_get_file_args /* {
- const char *path;
- int attrnamespace;
- const char *attrname;
- void *data;
- size_t nbytes;
- } */ *uap;
-{
- struct nameidata nd;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
- if (error)
- return (error);
-
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error)
- return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
-
- error = extattr_get_vp(nd.ni_vp, uap->attrnamespace, attrname,
- uap->data, uap->nbytes, td);
-
- vrele(nd.ni_vp);
- return (error);
-}
-
-int
-extattr_get_link(td, uap)
- struct thread *td;
- struct extattr_get_link_args /* {
- const char *path;
- int attrnamespace;
- const char *attrname;
- void *data;
- size_t nbytes;
- } */ *uap;
-{
- struct nameidata nd;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
- if (error)
- return (error);
-
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error)
- return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
-
- error = extattr_get_vp(nd.ni_vp, uap->attrnamespace, attrname,
- uap->data, uap->nbytes, td);
-
- vrele(nd.ni_vp);
- return (error);
-}
-
-/*
- * extattr_delete_vp(): Delete a named extended attribute on a file or
- * directory
- *
- * Arguments: unlocked vnode "vp", attribute namespace "attrnamespace",
- * kernelspace string pointer "attrname", proc "p"
- * Returns: 0 on success, an error number otherwise
- * Locks: none
- * References: vp must be a valid reference for the duration of the call
- */
-static int
-extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname,
- struct thread *td)
-{
- struct mount *mp;
- int error;
-
- error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
- if (error)
- return (error);
- VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-
-#ifdef MAC
- error = mac_check_vnode_deleteextattr(td->td_ucred, vp, attrnamespace,
- attrname);
- if (error)
- goto done;
-#endif
-
- error = VOP_DELETEEXTATTR(vp, attrnamespace, attrname, td->td_ucred,
- td);
- if (error == EOPNOTSUPP)
- error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
- td->td_ucred, td);
-#ifdef MAC
-done:
-#endif
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- return (error);
-}
-
-int
-extattr_delete_fd(td, uap)
- struct thread *td;
- struct extattr_delete_fd_args /* {
- int fd;
- int attrnamespace;
- const char *attrname;
- } */ *uap;
-{
- struct file *fp;
- struct vnode *vp;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
- if (error)
- return (error);
-
- error = getvnode(td->td_proc->p_fd, uap->fd, &fp);
- if (error)
- return (error);
- vp = fp->f_vnode;
-
- error = extattr_delete_vp(vp, uap->attrnamespace, attrname, td);
- fdrop(fp, td);
- return (error);
-}
-
-int
-extattr_delete_file(td, uap)
- struct thread *td;
- struct extattr_delete_file_args /* {
- const char *path;
- int attrnamespace;
- const char *attrname;
- } */ *uap;
-{
- struct nameidata nd;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
- if (error)
- return(error);
-
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error)
- return(error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
-
- error = extattr_delete_vp(nd.ni_vp, uap->attrnamespace, attrname, td);
- vrele(nd.ni_vp);
- return(error);
-}
-
-int
-extattr_delete_link(td, uap)
- struct thread *td;
- struct extattr_delete_link_args /* {
- const char *path;
- int attrnamespace;
- const char *attrname;
- } */ *uap;
-{
- struct nameidata nd;
- char attrname[EXTATTR_MAXNAMELEN];
- int error;
-
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
- if (error)
- return(error);
-
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error)
- return(error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
-
- error = extattr_delete_vp(nd.ni_vp, uap->attrnamespace, attrname, td);
- vrele(nd.ni_vp);
- return(error);
-}
-
-/*-
- * Retrieve a list of extended attributes on a file or directory.
- *
- * Arguments: unlocked vnode "vp", attribute namespace 'attrnamespace",
- * userspace buffer pointer "data", buffer length "nbytes",
- * thread "td".
- * Returns: 0 on success, an error number otherwise
- * Locks: none
- * References: vp must be a valid reference for the duration of the call
- */
-static int
-extattr_list_vp(struct vnode *vp, int attrnamespace, void *data,
- size_t nbytes, struct thread *td)
-{
- struct uio auio, *auiop;
- size_t size, *sizep;
- struct iovec aiov;
- ssize_t cnt;
- int error;
-
- VOP_LEASE(vp, td, td->td_ucred, LEASE_READ);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
-
- auiop = NULL;
- sizep = NULL;
- cnt = 0;
- if (data != NULL) {
- aiov.iov_base = data;
- aiov.iov_len = nbytes;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_offset = 0;
- if (nbytes > INT_MAX) {
- error = EINVAL;
- goto done;
- }
- auio.uio_resid = nbytes;
- auio.uio_rw = UIO_READ;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_td = td;
- auiop = &auio;
- cnt = nbytes;
- } else
- sizep = &size;
-
-#ifdef MAC
- error = mac_check_vnode_listextattr(td->td_ucred, vp, attrnamespace);
- if (error)
- goto done;
-#endif
-
- error = VOP_LISTEXTATTR(vp, attrnamespace, auiop, sizep,
- td->td_ucred, td);
-
- if (auiop != NULL) {
- cnt -= auio.uio_resid;
- td->td_retval[0] = cnt;
- } else
- td->td_retval[0] = size;
-
-done:
- VOP_UNLOCK(vp, 0, td);
- return (error);
-}
-
-
-int
-extattr_list_fd(td, uap)
- struct thread *td;
- struct extattr_list_fd_args /* {
- int fd;
- int attrnamespace;
- void *data;
- size_t nbytes;
- } */ *uap;
-{
- struct file *fp;
- int error;
-
- error = getvnode(td->td_proc->p_fd, uap->fd, &fp);
- if (error)
- return (error);
-
- error = extattr_list_vp(fp->f_vnode, uap->attrnamespace, uap->data,
- uap->nbytes, td);
-
- fdrop(fp, td);
- return (error);
-}
-
-int
-extattr_list_file(td, uap)
- struct thread*td;
- struct extattr_list_file_args /* {
- const char *path;
- int attrnamespace;
- void *data;
- size_t nbytes;
- } */ *uap;
-{
- struct nameidata nd;
- int error;
-
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error)
- return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
-
- error = extattr_list_vp(nd.ni_vp, uap->attrnamespace, uap->data,
- uap->nbytes, td);
-
- vrele(nd.ni_vp);
- return (error);
-}
-
-int
-extattr_list_link(td, uap)
- struct thread*td;
- struct extattr_list_link_args /* {
- const char *path;
- int attrnamespace;
- void *data;
- size_t nbytes;
- } */ *uap;
-{
- struct nameidata nd;
- int error;
-
- NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td);
- error = namei(&nd);
- if (error)
- return (error);
- NDFREE(&nd, NDF_ONLY_PNBUF);
-
- error = extattr_list_vp(nd.ni_vp, uap->attrnamespace, uap->data,
- uap->nbytes, td);
-
- vrele(nd.ni_vp);
- return (error);
-}
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c
deleted file mode 100644
index c86a3ec..0000000
--- a/sys/netinet/tcp_reass.c
+++ /dev/null
@@ -1,3250 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995
- * 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
- * $FreeBSD$
- */
-
-#include "opt_ipfw.h" /* for ipfw_fwd */
-#include "opt_inet.h"
-#include "opt_inet6.h"
-#include "opt_ipsec.h"
-#include "opt_mac.h"
-#include "opt_tcpdebug.h"
-#include "opt_tcp_input.h"
-#include "opt_tcp_sack.h"
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/mac.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/proc.h> /* for proc0 declaration */
-#include <sys/protosw.h>
-#include <sys/signalvar.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/sysctl.h>
-#include <sys/syslog.h>
-#include <sys/systm.h>
-
-#include <machine/cpu.h> /* before tcp_seq.h, for tcp_random18() */
-
-#include <vm/uma.h>
-
-#include <net/if.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-#include <netinet/in_pcb.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/ip_icmp.h> /* for ICMP_BANDLIM */
-#include <netinet/icmp_var.h> /* for ICMP_BANDLIM */
-#include <netinet/ip_var.h>
-#include <netinet/ip6.h>
-#include <netinet/icmp6.h>
-#include <netinet6/in6_pcb.h>
-#include <netinet6/ip6_var.h>
-#include <netinet6/nd6.h>
-#include <netinet/tcp.h>
-#include <netinet/tcp_fsm.h>
-#include <netinet/tcp_seq.h>
-#include <netinet/tcp_timer.h>
-#include <netinet/tcp_var.h>
-#include <netinet6/tcp6_var.h>
-#include <netinet/tcpip.h>
-#ifdef TCPDEBUG
-#include <netinet/tcp_debug.h>
-#endif /* TCPDEBUG */
-
-#ifdef FAST_IPSEC
-#include <netipsec/ipsec.h>
-#include <netipsec/ipsec6.h>
-#endif /*FAST_IPSEC*/
-
-#ifdef IPSEC
-#include <netinet6/ipsec.h>
-#include <netinet6/ipsec6.h>
-#include <netkey/key.h>
-#endif /*IPSEC*/
-
-#include <machine/in_cksum.h>
-
-static const int tcprexmtthresh = 3;
-
-struct tcpstat tcpstat;
-SYSCTL_STRUCT(_net_inet_tcp, TCPCTL_STATS, stats, CTLFLAG_RW,
- &tcpstat , tcpstat, "TCP statistics (struct tcpstat, netinet/tcp_var.h)");
-
-static int log_in_vain = 0;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_in_vain, CTLFLAG_RW,
- &log_in_vain, 0, "Log all incoming TCP connections");
-
-static int blackhole = 0;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, blackhole, CTLFLAG_RW,
- &blackhole, 0, "Do not send RST when dropping refused connections");
-
-int tcp_delack_enabled = 1;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, delayed_ack, CTLFLAG_RW,
- &tcp_delack_enabled, 0,
- "Delay ACK to try and piggyback it onto a data packet");
-
-#ifdef TCP_DROP_SYNFIN
-static int drop_synfin = 0;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop_synfin, CTLFLAG_RW,
- &drop_synfin, 0, "Drop TCP packets with SYN+FIN set");
-#endif
-
-static int tcp_do_rfc3042 = 1;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc3042, CTLFLAG_RW,
- &tcp_do_rfc3042, 0, "Enable RFC 3042 (Limited Transmit)");
-
-static int tcp_do_rfc3390 = 1;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc3390, CTLFLAG_RW,
- &tcp_do_rfc3390, 0,
- "Enable RFC 3390 (Increasing TCP's Initial Congestion Window)");
-
-static int tcp_insecure_rst = 0;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, insecure_rst, CTLFLAG_RW,
- &tcp_insecure_rst, 0,
- "Follow the old (insecure) criteria for accepting RST packets.");
-
-SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0,
- "TCP Segment Reassembly Queue");
-
-static int tcp_reass_maxseg = 0;
-SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN,
- &tcp_reass_maxseg, 0,
- "Global maximum number of TCP Segments in Reassembly Queue");
-
-int tcp_reass_qsize = 0;
-SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD,
- &tcp_reass_qsize, 0,
- "Global number of TCP Segments currently in Reassembly Queue");
-
-static int tcp_reass_maxqlen = 48;
-SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxqlen, CTLFLAG_RW,
- &tcp_reass_maxqlen, 0,
- "Maximum number of TCP Segments per individual Reassembly Queue");
-
-static int tcp_reass_overflows = 0;
-SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD,
- &tcp_reass_overflows, 0,
- "Global number of TCP Segment Reassembly Queue Overflows");
-
-struct inpcbhead tcb;
-#define tcb6 tcb /* for KAME src sync over BSD*'s */
-struct inpcbinfo tcbinfo;
-struct mtx *tcbinfo_mtx;
-
-static void tcp_dooptions(struct tcpopt *, u_char *, int, int);
-
-static void tcp_pulloutofband(struct socket *,
- struct tcphdr *, struct mbuf *, int);
-static int tcp_reass(struct tcpcb *, struct tcphdr *, int *,
- struct mbuf *);
-static void tcp_xmit_timer(struct tcpcb *, int);
-static void tcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *);
-static int tcp_timewait(struct tcptw *, struct tcpopt *,
- struct tcphdr *, struct mbuf *, int);
-
-/* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */
-#ifdef INET6
-#define ND6_HINT(tp) \
-do { \
- if ((tp) && (tp)->t_inpcb && \
- ((tp)->t_inpcb->inp_vflag & INP_IPV6) != 0) \
- nd6_nud_hint(NULL, NULL, 0); \
-} while (0)
-#else
-#define ND6_HINT(tp)
-#endif
-
-/*
- * Indicate whether this ack should be delayed. We can delay the ack if
- * - there is no delayed ack timer in progress and
- * - our last ack wasn't a 0-sized window. We never want to delay
- * the ack that opens up a 0-sized window and
- * - delayed acks are enabled or
- * - this is a half-synchronized T/TCP connection.
- */
-#define DELAY_ACK(tp) \
- ((!callout_active(tp->tt_delack) && \
- (tp->t_flags & TF_RXWIN0SENT) == 0) && \
- (tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN)))
-
-/* Initialize TCP reassembly queue */
-uma_zone_t tcp_reass_zone;
-void
-tcp_reass_init()
-{
- tcp_reass_maxseg = nmbclusters / 16;
- TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments",
- &tcp_reass_maxseg);
- tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
- uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg);
-}
-
-static int
-tcp_reass(tp, th, tlenp, m)
- register struct tcpcb *tp;
- register struct tcphdr *th;
- int *tlenp;
- struct mbuf *m;
-{
- struct tseg_qent *q;
- struct tseg_qent *p = NULL;
- struct tseg_qent *nq;
- struct tseg_qent *te = NULL;
- struct socket *so = tp->t_inpcb->inp_socket;
- int flags;
-
- INP_LOCK_ASSERT(tp->t_inpcb);
-
- /*
- * XXX: tcp_reass() is rather inefficient with its data structures
- * and should be rewritten (see NetBSD for optimizations). While
- * doing that it should move to its own file tcp_reass.c.
- */
-
- /*
- * Call with th==NULL after become established to
- * force pre-ESTABLISHED data up to user socket.
- */
- if (th == NULL)
- goto present;
-
- /*
- * Limit the number of segments in the reassembly queue to prevent
- * holding on to too many segments (and thus running out of mbufs).
- * Make sure to let the missing segment through which caused this
- * queue. Always keep one global queue entry spare to be able to
- * process the missing segment.
- */
- if (th->th_seq != tp->rcv_nxt &&
- (tcp_reass_qsize + 1 >= tcp_reass_maxseg ||
- tp->t_segqlen >= tcp_reass_maxqlen)) {
- tcp_reass_overflows++;
- tcpstat.tcps_rcvmemdrop++;
- m_freem(m);
- *tlenp = 0;
- return (0);
- }
-
- /*
- * Allocate a new queue entry. If we can't, or hit the zone limit
- * just drop the pkt.
- */
- te = uma_zalloc(tcp_reass_zone, M_NOWAIT);
- if (te == NULL) {
- tcpstat.tcps_rcvmemdrop++;
- m_freem(m);
- *tlenp = 0;
- return (0);
- }
- tp->t_segqlen++;
- tcp_reass_qsize++;
-
- /*
- * Find a segment which begins after this one does.
- */
- LIST_FOREACH(q, &tp->t_segq, tqe_q) {
- if (SEQ_GT(q->tqe_th->th_seq, th->th_seq))
- break;
- p = q;
- }
-
- /*
- * If there is a preceding segment, it may provide some of
- * our data already. If so, drop the data from the incoming
- * segment. If it provides all of our data, drop us.
- */
- if (p != NULL) {
- register int i;
- /* conversion to int (in i) handles seq wraparound */
- i = p->tqe_th->th_seq + p->tqe_len - th->th_seq;
- if (i > 0) {
- if (i >= *tlenp) {
- tcpstat.tcps_rcvduppack++;
- tcpstat.tcps_rcvdupbyte += *tlenp;
- m_freem(m);
- uma_zfree(tcp_reass_zone, te);
- tp->t_segqlen--;
- tcp_reass_qsize--;
- /*
- * Try to present any queued data
- * at the left window edge to the user.
- * This is needed after the 3-WHS
- * completes.
- */
- goto present; /* ??? */
- }
- m_adj(m, i);
- *tlenp -= i;
- th->th_seq += i;
- }
- }
- tcpstat.tcps_rcvoopack++;
- tcpstat.tcps_rcvoobyte += *tlenp;
-
- /*
- * While we overlap succeeding segments trim them or,
- * if they are completely covered, dequeue them.
- */
- while (q) {
- register int i = (th->th_seq + *tlenp) - q->tqe_th->th_seq;
- if (i <= 0)
- break;
- if (i < q->tqe_len) {
- q->tqe_th->th_seq += i;
- q->tqe_len -= i;
- m_adj(q->tqe_m, i);
- break;
- }
-
- nq = LIST_NEXT(q, tqe_q);
- LIST_REMOVE(q, tqe_q);
- m_freem(q->tqe_m);
- uma_zfree(tcp_reass_zone, q);
- tp->t_segqlen--;
- tcp_reass_qsize--;
- q = nq;
- }
-
- /* Insert the new segment queue entry into place. */
- te->tqe_m = m;
- te->tqe_th = th;
- te->tqe_len = *tlenp;
-
- if (p == NULL) {
- LIST_INSERT_HEAD(&tp->t_segq, te, tqe_q);
- } else {
- LIST_INSERT_AFTER(p, te, tqe_q);
- }
-
-present:
- /*
- * Present data to user, advancing rcv_nxt through
- * completed sequence space.
- */
- if (!TCPS_HAVEESTABLISHED(tp->t_state))
- return (0);
- q = LIST_FIRST(&tp->t_segq);
- if (!q || q->tqe_th->th_seq != tp->rcv_nxt)
- return (0);
- SOCKBUF_LOCK(&so->so_rcv);
- do {
- tp->rcv_nxt += q->tqe_len;
- flags = q->tqe_th->th_flags & TH_FIN;
- nq = LIST_NEXT(q, tqe_q);
- LIST_REMOVE(q, tqe_q);
- if (so->so_rcv.sb_state & SBS_CANTRCVMORE)
- m_freem(q->tqe_m);
- else
- sbappendstream_locked(&so->so_rcv, q->tqe_m);
- uma_zfree(tcp_reass_zone, q);
- tp->t_segqlen--;
- tcp_reass_qsize--;
- q = nq;
- } while (q && q->tqe_th->th_seq == tp->rcv_nxt);
- ND6_HINT(tp);
- sorwakeup_locked(so);
- return (flags);
-}
-
-/*
- * TCP input routine, follows pages 65-76 of the
- * protocol specification dated September, 1981 very closely.
- */
-#ifdef INET6
-int
-tcp6_input(mp, offp, proto)
- struct mbuf **mp;
- int *offp, proto;
-{
- register struct mbuf *m = *mp;
- struct in6_ifaddr *ia6;
-
- IP6_EXTHDR_CHECK(m, *offp, sizeof(struct tcphdr), IPPROTO_DONE);
-
- /*
- * draft-itojun-ipv6-tcp-to-anycast
- * better place to put this in?
- */
- ia6 = ip6_getdstifaddr(m);
- if (ia6 && (ia6->ia6_flags & IN6_IFF_ANYCAST)) {
- struct ip6_hdr *ip6;
-
- ip6 = mtod(m, struct ip6_hdr *);
- icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR,
- (caddr_t)&ip6->ip6_dst - (caddr_t)ip6);
- return IPPROTO_DONE;
- }
-
- tcp_input(m, *offp);
- return IPPROTO_DONE;
-}
-#endif
-
-void
-tcp_input(m, off0)
- register struct mbuf *m;
- int off0;
-{
- register struct tcphdr *th;
- register struct ip *ip = NULL;
- register struct ipovly *ipov;
- register struct inpcb *inp = NULL;
- u_char *optp = NULL;
- int optlen = 0;
- int len, tlen, off;
- int drop_hdrlen;
- register struct tcpcb *tp = 0;
- register int thflags;
- struct socket *so = 0;
- int todrop, acked, ourfinisacked, needoutput = 0;
- u_long tiwin;
- struct tcpopt to; /* options in this segment */
- int headlocked = 0;
-#ifdef IPFIREWALL_FORWARD
- struct m_tag *fwd_tag;
-#endif
- int rstreason; /* For badport_bandlim accounting purposes */
-
- struct ip6_hdr *ip6 = NULL;
-#ifdef INET6
- int isipv6;
-#else
- const int isipv6 = 0;
-#endif
-
-#ifdef TCPDEBUG
- /*
- * The size of tcp_saveipgen must be the size of the max ip header,
- * now IPv6.
- */
- u_char tcp_saveipgen[40];
- struct tcphdr tcp_savetcp;
- short ostate = 0;
-#endif
-
-#ifdef INET6
- isipv6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0;
-#endif
- bzero((char *)&to, sizeof(to));
-
- tcpstat.tcps_rcvtotal++;
-
- if (isipv6) {
-#ifdef INET6
- /* IP6_EXTHDR_CHECK() is already done at tcp6_input() */
- ip6 = mtod(m, struct ip6_hdr *);
- tlen = sizeof(*ip6) + ntohs(ip6->ip6_plen) - off0;
- if (in6_cksum(m, IPPROTO_TCP, off0, tlen)) {
- tcpstat.tcps_rcvbadsum++;
- goto drop;
- }
- th = (struct tcphdr *)((caddr_t)ip6 + off0);
-
- /*
- * Be proactive about unspecified IPv6 address in source.
- * As we use all-zero to indicate unbounded/unconnected pcb,
- * unspecified IPv6 address can be used to confuse us.
- *
- * Note that packets with unspecified IPv6 destination is
- * already dropped in ip6_input.
- */
- if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) {
- /* XXX stat */
- goto drop;
- }
-#else
- th = NULL; /* XXX: avoid compiler warning */
-#endif
- } else {
- /*
- * Get IP and TCP header together in first mbuf.
- * Note: IP leaves IP header in first mbuf.
- */
- if (off0 > sizeof (struct ip)) {
- ip_stripoptions(m, (struct mbuf *)0);
- off0 = sizeof(struct ip);
- }
- if (m->m_len < sizeof (struct tcpiphdr)) {
- if ((m = m_pullup(m, sizeof (struct tcpiphdr))) == 0) {
- tcpstat.tcps_rcvshort++;
- return;
- }
- }
- ip = mtod(m, struct ip *);
- ipov = (struct ipovly *)ip;
- th = (struct tcphdr *)((caddr_t)ip + off0);
- tlen = ip->ip_len;
-
- if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) {
- if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR)
- th->th_sum = m->m_pkthdr.csum_data;
- else
- th->th_sum = in_pseudo(ip->ip_src.s_addr,
- ip->ip_dst.s_addr,
- htonl(m->m_pkthdr.csum_data +
- ip->ip_len +
- IPPROTO_TCP));
- th->th_sum ^= 0xffff;
-#ifdef TCPDEBUG
- ipov->ih_len = (u_short)tlen;
- ipov->ih_len = htons(ipov->ih_len);
-#endif
- } else {
- /*
- * Checksum extended TCP header and data.
- */
- len = sizeof (struct ip) + tlen;
- bzero(ipov->ih_x1, sizeof(ipov->ih_x1));
- ipov->ih_len = (u_short)tlen;
- ipov->ih_len = htons(ipov->ih_len);
- th->th_sum = in_cksum(m, len);
- }
- if (th->th_sum) {
- tcpstat.tcps_rcvbadsum++;
- goto drop;
- }
-#ifdef INET6
- /* Re-initialization for later version check */
- ip->ip_v = IPVERSION;
-#endif
- }
-
- /*
- * Check that TCP offset makes sense,
- * pull out TCP options and adjust length. XXX
- */
- off = th->th_off << 2;
- if (off < sizeof (struct tcphdr) || off > tlen) {
- tcpstat.tcps_rcvbadoff++;
- goto drop;
- }
- tlen -= off; /* tlen is used instead of ti->ti_len */
- if (off > sizeof (struct tcphdr)) {
- if (isipv6) {
-#ifdef INET6
- IP6_EXTHDR_CHECK(m, off0, off, );
- ip6 = mtod(m, struct ip6_hdr *);
- th = (struct tcphdr *)((caddr_t)ip6 + off0);
-#endif
- } else {
- if (m->m_len < sizeof(struct ip) + off) {
- if ((m = m_pullup(m, sizeof (struct ip) + off))
- == 0) {
- tcpstat.tcps_rcvshort++;
- return;
- }
- ip = mtod(m, struct ip *);
- ipov = (struct ipovly *)ip;
- th = (struct tcphdr *)((caddr_t)ip + off0);
- }
- }
- optlen = off - sizeof (struct tcphdr);
- optp = (u_char *)(th + 1);
- }
- thflags = th->th_flags;
-
-#ifdef TCP_DROP_SYNFIN
- /*
- * If the drop_synfin option is enabled, drop all packets with
- * both the SYN and FIN bits set. This prevents e.g. nmap from
- * identifying the TCP/IP stack.
- *
- * This is a violation of the TCP specification.
- */
- if (drop_synfin && (thflags & (TH_SYN|TH_FIN)) == (TH_SYN|TH_FIN))
- goto drop;
-#endif
-
- /*
- * Convert TCP protocol specific fields to host format.
- */
- th->th_seq = ntohl(th->th_seq);
- th->th_ack = ntohl(th->th_ack);
- th->th_win = ntohs(th->th_win);
- th->th_urp = ntohs(th->th_urp);
-
- /*
- * Delay dropping TCP, IP headers, IPv6 ext headers, and TCP options,
- * until after ip6_savecontrol() is called and before other functions
- * which don't want those proto headers.
- * Because ip6_savecontrol() is going to parse the mbuf to
- * search for data to be passed up to user-land, it wants mbuf
- * parameters to be unchanged.
- * XXX: the call of ip6_savecontrol() has been obsoleted based on
- * latest version of the advanced API (20020110).
- */
- drop_hdrlen = off0 + off;
-
- /*
- * Locate pcb for segment.
- */
- INP_INFO_WLOCK(&tcbinfo);
- headlocked = 1;
-findpcb:
- KASSERT(headlocked, ("tcp_input: findpcb: head not locked"));
-#ifdef IPFIREWALL_FORWARD
- /* Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain. */
- fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL);
-
- if (fwd_tag != NULL && isipv6 == 0) { /* IPv6 support is not yet */
- struct sockaddr_in *next_hop;
-
- next_hop = (struct sockaddr_in *)(fwd_tag+1);
- /*
- * Transparently forwarded. Pretend to be the destination.
- * already got one like this?
- */
- inp = in_pcblookup_hash(&tcbinfo,
- ip->ip_src, th->th_sport,
- ip->ip_dst, th->th_dport,
- 0, m->m_pkthdr.rcvif);
- if (!inp) {
- /* It's new. Try to find the ambushing socket. */
- inp = in_pcblookup_hash(&tcbinfo,
- ip->ip_src, th->th_sport,
- next_hop->sin_addr,
- next_hop->sin_port ?
- ntohs(next_hop->sin_port) :
- th->th_dport,
- 1, m->m_pkthdr.rcvif);
- }
- /* Remove the tag from the packet. We don't need it anymore. */
- m_tag_delete(m, fwd_tag);
- } else {
-#endif /* IPFIREWALL_FORWARD */
- if (isipv6) {
-#ifdef INET6
- inp = in6_pcblookup_hash(&tcbinfo,
- &ip6->ip6_src, th->th_sport,
- &ip6->ip6_dst, th->th_dport,
- 1, m->m_pkthdr.rcvif);
-#endif
- } else
- inp = in_pcblookup_hash(&tcbinfo,
- ip->ip_src, th->th_sport,
- ip->ip_dst, th->th_dport,
- 1, m->m_pkthdr.rcvif);
-#ifdef IPFIREWALL_FORWARD
- }
-#endif /* IPFIREWALL_FORWARD */
-
-#if defined(IPSEC) || defined(FAST_IPSEC)
-#ifdef INET6
- if (isipv6) {
- if (inp != NULL && ipsec6_in_reject(m, inp)) {
-#ifdef IPSEC
- ipsec6stat.in_polvio++;
-#endif
- goto drop;
- }
- } else
-#endif /* INET6 */
- if (inp != NULL && ipsec4_in_reject(m, inp)) {
-#ifdef IPSEC
- ipsecstat.in_polvio++;
-#endif
- goto drop;
- }
-#endif /*IPSEC || FAST_IPSEC*/
-
- /*
- * If the state is CLOSED (i.e., TCB does not exist) then
- * all data in the incoming segment is discarded.
- * If the TCB exists but is in CLOSED state, it is embryonic,
- * but should either do a listen or a connect soon.
- */
- if (inp == NULL) {
- if (log_in_vain) {
-#ifdef INET6
- char dbuf[INET6_ADDRSTRLEN+2], sbuf[INET6_ADDRSTRLEN+2];
-#else
- char dbuf[4*sizeof "123"], sbuf[4*sizeof "123"];
-#endif
-
- if (isipv6) {
-#ifdef INET6
- strcpy(dbuf, "[");
- strcpy(sbuf, "[");
- strcat(dbuf, ip6_sprintf(&ip6->ip6_dst));
- strcat(sbuf, ip6_sprintf(&ip6->ip6_src));
- strcat(dbuf, "]");
- strcat(sbuf, "]");
-#endif
- } else {
- strcpy(dbuf, inet_ntoa(ip->ip_dst));
- strcpy(sbuf, inet_ntoa(ip->ip_src));
- }
- switch (log_in_vain) {
- case 1:
- if ((thflags & TH_SYN) == 0)
- break;
- /* FALLTHROUGH */
- case 2:
- log(LOG_INFO,
- "Connection attempt to TCP %s:%d "
- "from %s:%d flags:0x%02x\n",
- dbuf, ntohs(th->th_dport), sbuf,
- ntohs(th->th_sport), thflags);
- break;
- default:
- break;
- }
- }
- if (blackhole) {
- switch (blackhole) {
- case 1:
- if (thflags & TH_SYN)
- goto drop;
- break;
- case 2:
- goto drop;
- default:
- goto drop;
- }
- }
- rstreason = BANDLIM_RST_CLOSEDPORT;
- goto dropwithreset;
- }
- INP_LOCK(inp);
- if (inp->inp_vflag & INP_TIMEWAIT) {
- /*
- * The only option of relevance is TOF_CC, and only if
- * present in a SYN segment. See tcp_timewait().
- */
- if (thflags & TH_SYN)
- tcp_dooptions(&to, optp, optlen, 1);
- if (tcp_timewait((struct tcptw *)inp->inp_ppcb,
- &to, th, m, tlen))
- goto findpcb;
- /*
- * tcp_timewait unlocks inp.
- */
- INP_INFO_WUNLOCK(&tcbinfo);
- return;
- }
- tp = intotcpcb(inp);
- if (tp == 0) {
- INP_UNLOCK(inp);
- rstreason = BANDLIM_RST_CLOSEDPORT;
- goto dropwithreset;
- }
- if (tp->t_state == TCPS_CLOSED)
- goto drop;
-
- /* Unscale the window into a 32-bit value. */
- if ((thflags & TH_SYN) == 0)
- tiwin = th->th_win << tp->snd_scale;
- else
- tiwin = th->th_win;
-
-#ifdef MAC
- INP_LOCK_ASSERT(inp);
- if (mac_check_inpcb_deliver(inp, m))
- goto drop;
-#endif
- so = inp->inp_socket;
-#ifdef TCPDEBUG
- if (so->so_options & SO_DEBUG) {
- ostate = tp->t_state;
- if (isipv6)
- bcopy((char *)ip6, (char *)tcp_saveipgen, sizeof(*ip6));
- else
- bcopy((char *)ip, (char *)tcp_saveipgen, sizeof(*ip));
- tcp_savetcp = *th;
- }
-#endif
- if (so->so_options & SO_ACCEPTCONN) {
- struct in_conninfo inc;
-
-#ifdef INET6
- inc.inc_isipv6 = isipv6;
-#endif
- if (isipv6) {
- inc.inc6_faddr = ip6->ip6_src;
- inc.inc6_laddr = ip6->ip6_dst;
- } else {
- inc.inc_faddr = ip->ip_src;
- inc.inc_laddr = ip->ip_dst;
- }
- inc.inc_fport = th->th_sport;
- inc.inc_lport = th->th_dport;
-
- /*
- * If the state is LISTEN then ignore segment if it contains
- * a RST. If the segment contains an ACK then it is bad and
- * send a RST. If it does not contain a SYN then it is not
- * interesting; drop it.
- *
- * If the state is SYN_RECEIVED (syncache) and seg contains
- * an ACK, but not for our SYN/ACK, send a RST. If the seg
- * contains a RST, check the sequence number to see if it
- * is a valid reset segment.
- */
- if ((thflags & (TH_RST|TH_ACK|TH_SYN)) != TH_SYN) {
- if ((thflags & (TH_RST|TH_ACK|TH_SYN)) == TH_ACK) {
- if (!syncache_expand(&inc, th, &so, m)) {
- /*
- * No syncache entry, or ACK was not
- * for our SYN/ACK. Send a RST.
- */
- tcpstat.tcps_badsyn++;
- rstreason = BANDLIM_RST_OPENPORT;
- goto dropwithreset;
- }
- if (so == NULL) {
- /*
- * Could not complete 3-way handshake,
- * connection is being closed down, and
- * syncache will free mbuf.
- */
- INP_UNLOCK(inp);
- INP_INFO_WUNLOCK(&tcbinfo);
- return;
- }
- /*
- * Socket is created in state SYN_RECEIVED.
- * Continue processing segment.
- */
- INP_UNLOCK(inp);
- inp = sotoinpcb(so);
- INP_LOCK(inp);
- tp = intotcpcb(inp);
- /*
- * This is what would have happened in
- * tcp_output() when the SYN,ACK was sent.
- */
- tp->snd_up = tp->snd_una;
- tp->snd_max = tp->snd_nxt = tp->iss + 1;
- tp->last_ack_sent = tp->rcv_nxt;
- /*
- * RFC1323: The window in SYN & SYN/ACK
- * segments is never scaled.
- */
- tp->snd_wnd = tiwin; /* unscaled */
- goto after_listen;
- }
- if (thflags & TH_RST) {
- syncache_chkrst(&inc, th);
- goto drop;
- }
- if (thflags & TH_ACK) {
- syncache_badack(&inc);
- tcpstat.tcps_badsyn++;
- rstreason = BANDLIM_RST_OPENPORT;
- goto dropwithreset;
- }
- goto drop;
- }
-
- /*
- * Segment's flags are (SYN) or (SYN|FIN).
- */
-#ifdef INET6
- /*
- * If deprecated address is forbidden,
- * we do not accept SYN to deprecated interface
- * address to prevent any new inbound connection from
- * getting established.
- * When we do not accept SYN, we send a TCP RST,
- * with deprecated source address (instead of dropping
- * it). We compromise it as it is much better for peer
- * to send a RST, and RST will be the final packet
- * for the exchange.
- *
- * If we do not forbid deprecated addresses, we accept
- * the SYN packet. RFC2462 does not suggest dropping
- * SYN in this case.
- * If we decipher RFC2462 5.5.4, it says like this:
- * 1. use of deprecated addr with existing
- * communication is okay - "SHOULD continue to be
- * used"
- * 2. use of it with new communication:
- * (2a) "SHOULD NOT be used if alternate address
- * with sufficient scope is available"
- * (2b) nothing mentioned otherwise.
- * Here we fall into (2b) case as we have no choice in
- * our source address selection - we must obey the peer.
- *
- * The wording in RFC2462 is confusing, and there are
- * multiple description text for deprecated address
- * handling - worse, they are not exactly the same.
- * I believe 5.5.4 is the best one, so we follow 5.5.4.
- */
- if (isipv6 && !ip6_use_deprecated) {
- struct in6_ifaddr *ia6;
-
- if ((ia6 = ip6_getdstifaddr(m)) &&
- (ia6->ia6_flags & IN6_IFF_DEPRECATED)) {
- INP_UNLOCK(inp);
- tp = NULL;
- rstreason = BANDLIM_RST_OPENPORT;
- goto dropwithreset;
- }
- }
-#endif
- /*
- * If it is from this socket, drop it, it must be forged.
- * Don't bother responding if the destination was a broadcast.
- */
- if (th->th_dport == th->th_sport) {
- if (isipv6) {
- if (IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst,
- &ip6->ip6_src))
- goto drop;
- } else {
- if (ip->ip_dst.s_addr == ip->ip_src.s_addr)
- goto drop;
- }
- }
- /*
- * RFC1122 4.2.3.10, p. 104: discard bcast/mcast SYN
- *
- * Note that it is quite possible to receive unicast
- * link-layer packets with a broadcast IP address. Use
- * in_broadcast() to find them.
- */
- if (m->m_flags & (M_BCAST|M_MCAST))
- goto drop;
- if (isipv6) {
- if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
- IN6_IS_ADDR_MULTICAST(&ip6->ip6_src))
- goto drop;
- } else {
- if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) ||
- IN_MULTICAST(ntohl(ip->ip_src.s_addr)) ||
- ip->ip_src.s_addr == htonl(INADDR_BROADCAST) ||
- in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif))
- goto drop;
- }
- /*
- * SYN appears to be valid; create compressed TCP state
- * for syncache, or perform t/tcp connection.
- */
- if (so->so_qlen <= so->so_qlimit) {
-#ifdef TCPDEBUG
- if (so->so_options & SO_DEBUG)
- tcp_trace(TA_INPUT, ostate, tp,
- (void *)tcp_saveipgen, &tcp_savetcp, 0);
-#endif
- tcp_dooptions(&to, optp, optlen, 1);
- if (!syncache_add(&inc, &to, th, &so, m))
- goto drop;
- if (so == NULL) {
- /*
- * Entry added to syncache, mbuf used to
- * send SYN,ACK packet.
- */
- KASSERT(headlocked, ("headlocked"));
- INP_UNLOCK(inp);
- INP_INFO_WUNLOCK(&tcbinfo);
- return;
- }
- /*
- * Segment passed TAO tests.
- */
- INP_UNLOCK(inp);
- inp = sotoinpcb(so);
- INP_LOCK(inp);
- tp = intotcpcb(inp);
- tp->snd_wnd = tiwin;
- tp->t_starttime = ticks;
- tp->t_state = TCPS_ESTABLISHED;
-
- /*
- * T/TCP logic:
- * If there is a FIN or if there is data, then
- * delay SYN,ACK(SYN) in the hope of piggy-backing
- * it on a response segment. Otherwise must send
- * ACK now in case the other side is slow starting.
- */
- if (thflags & TH_FIN || tlen != 0)
- tp->t_flags |= (TF_DELACK | TF_NEEDSYN);
- else
- tp->t_flags |= (TF_ACKNOW | TF_NEEDSYN);
- tcpstat.tcps_connects++;
- soisconnected(so);
- goto trimthenstep6;
- }
- goto drop;
- }
-after_listen:
- KASSERT(headlocked, ("tcp_input: after_listen: head not locked"));
- INP_LOCK_ASSERT(inp);
-
- /* XXX temp debugging */
- /* should not happen - syncache should pick up these connections */
- if (tp->t_state == TCPS_LISTEN)
- panic("tcp_input: TCPS_LISTEN");
-
- /*
- * This is the second part of the MSS DoS prevention code (after
- * minmss on the sending side) and it deals with too many too small
- * tcp packets in a too short timeframe (1 second).
- *
- * For every full second we count the number of received packets
- * and bytes. If we get a lot of packets per second for this connection
- * (tcp_minmssoverload) we take a closer look at it and compute the
- * average packet size for the past second. If that is less than
- * tcp_minmss we get too many packets with very small payload which
- * is not good and burdens our system (and every packet generates
- * a wakeup to the process connected to our socket). We can reasonable
- * expect this to be small packet DoS attack to exhaust our CPU
- * cycles.
- *
- * Care has to be taken for the minimum packet overload value. This
- * value defines the minimum number of packets per second before we
- * start to worry. This must not be too low to avoid killing for
- * example interactive connections with many small packets like
- * telnet or SSH.
- *
- * Setting either tcp_minmssoverload or tcp_minmss to "0" disables
- * this check.
- *
- * Account for packet if payload packet, skip over ACK, etc.
- */
- if (tcp_minmss && tcp_minmssoverload &&
- tp->t_state == TCPS_ESTABLISHED && tlen > 0) {
- if ((unsigned int)(tp->rcv_second - ticks) < hz) {
- tp->rcv_pps++;
- tp->rcv_byps += tlen + off;
- if (tp->rcv_pps > tcp_minmssoverload) {
- if ((tp->rcv_byps / tp->rcv_pps) < tcp_minmss) {
- printf("too many small tcp packets from "
- "%s:%u, av. %lubyte/packet, "
- "dropping connection\n",
-#ifdef INET6
- isipv6 ?
- ip6_sprintf(&inp->inp_inc.inc6_faddr) :
-#endif
- inet_ntoa(inp->inp_inc.inc_faddr),
- inp->inp_inc.inc_fport,
- tp->rcv_byps / tp->rcv_pps);
- KASSERT(headlocked, ("tcp_input: "
- "after_listen: tcp_drop: head "
- "not locked"));
- tp = tcp_drop(tp, ECONNRESET);
- tcpstat.tcps_minmssdrops++;
- goto drop;
- }
- }
- } else {
- tp->rcv_second = ticks + hz;
- tp->rcv_pps = 1;
- tp->rcv_byps = tlen + off;
- }
- }
-
- /*
- * Segment received on connection.
- * Reset idle time and keep-alive timer.
- */
- tp->t_rcvtime = ticks;
- if (TCPS_HAVEESTABLISHED(tp->t_state))
- callout_reset(tp->tt_keep, tcp_keepidle, tcp_timer_keep, tp);
-
- /*
- * Process options only when we get SYN/ACK back. The SYN case
- * for incoming connections is handled in tcp_syncache.
- * XXX this is traditional behavior, may need to be cleaned up.
- */
- tcp_dooptions(&to, optp, optlen, thflags & TH_SYN);
- if (tp->t_state == TCPS_SYN_SENT && (thflags & TH_SYN)) {
- if (to.to_flags & TOF_SCALE) {
- tp->t_flags |= TF_RCVD_SCALE;
- tp->requested_s_scale = to.to_requested_s_scale;
- }
- if (to.to_flags & TOF_TS) {
- tp->t_flags |= TF_RCVD_TSTMP;
- tp->ts_recent = to.to_tsval;
- tp->ts_recent_age = ticks;
- }
- if (to.to_flags & TOF_MSS)
- tcp_mss(tp, to.to_mss);
- if (tp->sack_enable) {
- if (!(to.to_flags & TOF_SACK))
- tp->sack_enable = 0;
- else
- tp->t_flags |= TF_SACK_PERMIT;
- }
-
- }
-
- /*
- * Header prediction: check for the two common cases
- * of a uni-directional data xfer. If the packet has
- * no control flags, is in-sequence, the window didn't
- * change and we're not retransmitting, it's a
- * candidate. If the length is zero and the ack moved
- * forward, we're the sender side of the xfer. Just
- * free the data acked & wake any higher level process
- * that was blocked waiting for space. If the length
- * is non-zero and the ack didn't move, we're the
- * receiver side. If we're getting packets in-order
- * (the reassembly queue is empty), add the data to
- * the socket buffer and note that we need a delayed ack.
- * Make sure that the hidden state-flags are also off.
- * Since we check for TCPS_ESTABLISHED above, it can only
- * be TH_NEEDSYN.
- */
- if (tp->t_state == TCPS_ESTABLISHED &&
- (thflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) == TH_ACK &&
- ((tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN)) == 0) &&
- ((to.to_flags & TOF_TS) == 0 ||
- TSTMP_GEQ(to.to_tsval, tp->ts_recent)) &&
- th->th_seq == tp->rcv_nxt && tiwin && tiwin == tp->snd_wnd &&
- tp->snd_nxt == tp->snd_max) {
-
- /*
- * If last ACK falls within this segment's sequence numbers,
- * record the timestamp.
- * NOTE that the test is modified according to the latest
- * proposal of the tcplw@cray.com list (Braden 1993/04/26).
- */
- if ((to.to_flags & TOF_TS) != 0 &&
- SEQ_LEQ(th->th_seq, tp->last_ack_sent)) {
- tp->ts_recent_age = ticks;
- tp->ts_recent = to.to_tsval;
- }
-
- if (tlen == 0) {
- if (SEQ_GT(th->th_ack, tp->snd_una) &&
- SEQ_LEQ(th->th_ack, tp->snd_max) &&
- tp->snd_cwnd >= tp->snd_wnd &&
- ((!tcp_do_newreno && !tp->sack_enable &&
- tp->t_dupacks < tcprexmtthresh) ||
- ((tcp_do_newreno || tp->sack_enable) &&
- !IN_FASTRECOVERY(tp) && to.to_nsacks == 0 &&
- TAILQ_EMPTY(&tp->snd_holes)))) {
- KASSERT(headlocked, ("headlocked"));
- INP_INFO_WUNLOCK(&tcbinfo);
- headlocked = 0;
- /*
- * this is a pure ack for outstanding data.
- */
- ++tcpstat.tcps_predack;
- /*
- * "bad retransmit" recovery
- */
- if (tp->t_rxtshift == 1 &&
- ticks < tp->t_badrxtwin) {
- ++tcpstat.tcps_sndrexmitbad;
- tp->snd_cwnd = tp->snd_cwnd_prev;
- tp->snd_ssthresh =
- tp->snd_ssthresh_prev;
- tp->snd_recover = tp->snd_recover_prev;
- if (tp->t_flags & TF_WASFRECOVERY)
- ENTER_FASTRECOVERY(tp);
- tp->snd_nxt = tp->snd_max;
- tp->t_badrxtwin = 0;
- }
-
- /*
- * Recalculate the transmit timer / rtt.
- *
- * Some boxes send broken timestamp replies
- * during the SYN+ACK phase, ignore
- * timestamps of 0 or we could calculate a
- * huge RTT and blow up the retransmit timer.
- */
- if ((to.to_flags & TOF_TS) != 0 &&
- to.to_tsecr) {
- tcp_xmit_timer(tp,
- ticks - to.to_tsecr + 1);
- } else if (tp->t_rtttime &&
- SEQ_GT(th->th_ack, tp->t_rtseq)) {
- tcp_xmit_timer(tp,
- ticks - tp->t_rtttime);
- }
- tcp_xmit_bandwidth_limit(tp, th->th_ack);
- acked = th->th_ack - tp->snd_una;
- tcpstat.tcps_rcvackpack++;
- tcpstat.tcps_rcvackbyte += acked;
- sbdrop(&so->so_snd, acked);
- if (SEQ_GT(tp->snd_una, tp->snd_recover) &&
- SEQ_LEQ(th->th_ack, tp->snd_recover))
- tp->snd_recover = th->th_ack - 1;
- tp->snd_una = th->th_ack;
- /*
- * pull snd_wl2 up to prevent seq wrap relative
- * to th_ack.
- */
- tp->snd_wl2 = th->th_ack;
- tp->t_dupacks = 0;
- m_freem(m);
- ND6_HINT(tp); /* some progress has been done */
-
- /*
- * If all outstanding data are acked, stop
- * retransmit timer, otherwise restart timer
- * using current (possibly backed-off) value.
- * If process is waiting for space,
- * wakeup/selwakeup/signal. If data
- * are ready to send, let tcp_output
- * decide between more output or persist.
-
-#ifdef TCPDEBUG
- if (so->so_options & SO_DEBUG)
- tcp_trace(TA_INPUT, ostate, tp,
- (void *)tcp_saveipgen,
- &tcp_savetcp, 0);
-#endif
- */
- if (tp->snd_una == tp->snd_max)
- callout_stop(tp->tt_rexmt);
- else if (!callout_active(tp->tt_persist))
- callout_reset(tp->tt_rexmt,
- tp->t_rxtcur,
- tcp_timer_rexmt, tp);
-
- sowwakeup(so);
- if (so->so_snd.sb_cc)
- (void) tcp_output(tp);
- goto check_delack;
- }
- } else if (th->th_ack == tp->snd_una &&
- LIST_EMPTY(&tp->t_segq) &&
- tlen <= sbspace(&so->so_rcv)) {
- KASSERT(headlocked, ("headlocked"));
- INP_INFO_WUNLOCK(&tcbinfo);
- headlocked = 0;
- /*
- * this is a pure, in-sequence data packet
- * with nothing on the reassembly queue and
- * we have enough buffer space to take it.
- */
- /* Clean receiver SACK report if present */
- if (tp->sack_enable && tp->rcv_numsacks)
- tcp_clean_sackreport(tp);
- ++tcpstat.tcps_preddat;
- tp->rcv_nxt += tlen;
- /*
- * Pull snd_wl1 up to prevent seq wrap relative to
- * th_seq.
- */
- tp->snd_wl1 = th->th_seq;
- /*
- * Pull rcv_up up to prevent seq wrap relative to
- * rcv_nxt.
- */
- tp->rcv_up = tp->rcv_nxt;
- tcpstat.tcps_rcvpack++;
- tcpstat.tcps_rcvbyte += tlen;
- ND6_HINT(tp); /* some progress has been done */
- /*
-#ifdef TCPDEBUG
- if (so->so_options & SO_DEBUG)
- tcp_trace(TA_INPUT, ostate, tp,
- (void *)tcp_saveipgen, &tcp_savetcp, 0);
-#endif
- * Add data to socket buffer.
- */
- SOCKBUF_LOCK(&so->so_rcv);
- if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
- m_freem(m);
- } else {
- m_adj(m, drop_hdrlen); /* delayed header drop */
- sbappendstream_locked(&so->so_rcv, m);
- }
- sorwakeup_locked(so);
- if (DELAY_ACK(tp)) {
- tp->t_flags |= TF_DELACK;
- } else {
- tp->t_flags |= TF_ACKNOW;
- tcp_output(tp);
- }
- goto check_delack;
- }
- }
-
- /*
- * Calculate amount of space in receive window,
- * and then do TCP input processing.
- * Receive window is amount of space in rcv queue,
- * but not less than advertised window.
- */
- { int win;
-
- win = sbspace(&so->so_rcv);
- if (win < 0)
- win = 0;
- tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt));
- }
-
- switch (tp->t_state) {
-
- /*
- * If the state is SYN_RECEIVED:
- * if seg contains an ACK, but not for our SYN/ACK, send a RST.
- */
- case TCPS_SYN_RECEIVED:
- if ((thflags & TH_ACK) &&
- (SEQ_LEQ(th->th_ack, tp->snd_una) ||
- SEQ_GT(th->th_ack, tp->snd_max))) {
- rstreason = BANDLIM_RST_OPENPORT;
- goto dropwithreset;
- }
- break;
-
- /*
- * If the state is SYN_SENT:
- * if seg contains an ACK, but not for our SYN, drop the input.
- * if seg contains a RST, then drop the connection.
- * if seg does not contain SYN, then drop it.
- * Otherwise this is an acceptable SYN segment
- * initialize tp->rcv_nxt and tp->irs
- * if seg contains ack then advance tp->snd_una
- * if SYN has been acked change to ESTABLISHED else SYN_RCVD state
- * arrange for segment to be acked (eventually)
- * continue processing rest of data/controls, beginning with URG
- */
- case TCPS_SYN_SENT:
- if ((thflags & TH_ACK) &&
- (SEQ_LEQ(th->th_ack, tp->iss) ||
- SEQ_GT(th->th_ack, tp->snd_max))) {
- rstreason = BANDLIM_UNLIMITED;
- goto dropwithreset;
- }
- if (thflags & TH_RST) {
- if (thflags & TH_ACK) {
- KASSERT(headlocked, ("tcp_input: after_listen"
- ": tcp_drop.2: head not locked"));
- tp = tcp_drop(tp, ECONNREFUSED);
- }
- goto drop;
- }
- if ((thflags & TH_SYN) == 0)
- goto drop;
- tp->snd_wnd = th->th_win; /* initial send window */
-
- tp->irs = th->th_seq;
- tcp_rcvseqinit(tp);
- if (thflags & TH_ACK) {
- tcpstat.tcps_connects++;
- soisconnected(so);
-#ifdef MAC
- SOCK_LOCK(so);
- mac_set_socket_peer_from_mbuf(m, so);
- SOCK_UNLOCK(so);
-#endif
- /* Do window scaling on this connection? */
- if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
- (TF_RCVD_SCALE|TF_REQ_SCALE)) {
- tp->snd_scale = tp->requested_s_scale;
- tp->rcv_scale = tp->request_r_scale;
- }
- tp->rcv_adv += tp->rcv_wnd;
- tp->snd_una++; /* SYN is acked */
- /*
- * If there's data, delay ACK; if there's also a FIN
- * ACKNOW will be turned on later.
- */
- if (DELAY_ACK(tp) && tlen != 0)
- callout_reset(tp->tt_delack, tcp_delacktime,
- tcp_timer_delack, tp);
- else
- tp->t_flags |= TF_ACKNOW;
- /*
- * Received <SYN,ACK> in SYN_SENT[*] state.
- * Transitions:
- * SYN_SENT --> ESTABLISHED
- * SYN_SENT* --> FIN_WAIT_1
- */
- tp->t_starttime = ticks;
- if (tp->t_flags & TF_NEEDFIN) {
- tp->t_state = TCPS_FIN_WAIT_1;
- tp->t_flags &= ~TF_NEEDFIN;
- thflags &= ~TH_SYN;
- } else {
- tp->t_state = TCPS_ESTABLISHED;
- callout_reset(tp->tt_keep, tcp_keepidle,
- tcp_timer_keep, tp);
- }
- } else {
- /*
- * Received initial SYN in SYN-SENT[*] state =>
- * simultaneous open. If segment contains CC option
- * and there is a cached CC, apply TAO test.
- * If it succeeds, connection is * half-synchronized.
- * Otherwise, do 3-way handshake:
- * SYN-SENT -> SYN-RECEIVED
- * SYN-SENT* -> SYN-RECEIVED*
- * If there was no CC option, clear cached CC value.
- */
- tp->t_flags |= TF_ACKNOW;
- callout_stop(tp->tt_rexmt);
- tp->t_state = TCPS_SYN_RECEIVED;
- }
-
-trimthenstep6:
- KASSERT(headlocked, ("tcp_input: trimthenstep6: head not "
- "locked"));
- INP_LOCK_ASSERT(inp);
-
- /*
- * Advance th->th_seq to correspond to first data byte.
- * If data, trim to stay within window,
- * dropping FIN if necessary.
- */
- th->th_seq++;
- if (tlen > tp->rcv_wnd) {
- todrop = tlen - tp->rcv_wnd;
- m_adj(m, -todrop);
- tlen = tp->rcv_wnd;
- thflags &= ~TH_FIN;
- tcpstat.tcps_rcvpackafterwin++;
- tcpstat.tcps_rcvbyteafterwin += todrop;
- }
- tp->snd_wl1 = th->th_seq - 1;
- tp->rcv_up = th->th_seq;
- /*
- * Client side of transaction: already sent SYN and data.
- * If the remote host used T/TCP to validate the SYN,
- * our data will be ACK'd; if so, enter normal data segment
- * processing in the middle of step 5, ack processing.
- * Otherwise, goto step 6.
- */
- if (thflags & TH_ACK)
- goto process_ACK;
-
- goto step6;
-
- /*
- * If the state is LAST_ACK or CLOSING or TIME_WAIT:
- * do normal processing.
- *
- * NB: Leftover from RFC1644 T/TCP. Cases to be reused later.
- */
- case TCPS_LAST_ACK:
- case TCPS_CLOSING:
- case TCPS_TIME_WAIT:
- KASSERT(tp->t_state != TCPS_TIME_WAIT, ("timewait"));
- break; /* continue normal processing */
- }
-
- /*
- * States other than LISTEN or SYN_SENT.
- * First check the RST flag and sequence number since reset segments
- * are exempt from the timestamp and connection count tests. This
- * fixes a bug introduced by the Stevens, vol. 2, p. 960 bugfix
- * below which allowed reset segments in half the sequence space
- * to fall though and be processed (which gives forged reset
- * segments with a random sequence number a 50 percent chance of
- * killing a connection).
- * Then check timestamp, if present.
- * Then check the connection count, if present.
- * Then check that at least some bytes of segment are within
- * receive window. If segment begins before rcv_nxt,
- * drop leading data (and SYN); if nothing left, just ack.
- *
- *
- * If the RST bit is set, check the sequence number to see
- * if this is a valid reset segment.
- * RFC 793 page 37:
- * In all states except SYN-SENT, all reset (RST) segments
- * are validated by checking their SEQ-fields. A reset is
- * valid if its sequence number is in the window.
- * Note: this does not take into account delayed ACKs, so
- * we should test against last_ack_sent instead of rcv_nxt.
- * The sequence number in the reset segment is normally an
- * echo of our outgoing acknowlegement numbers, but some hosts
- * send a reset with the sequence number at the rightmost edge
- * of our receive window, and we have to handle this case.
- * Note 2: Paul Watson's paper "Slipping in the Window" has shown
- * that brute force RST attacks are possible. To combat this,
- * we use a much stricter check while in the ESTABLISHED state,
- * only accepting RSTs where the sequence number is equal to
- * last_ack_sent. In all other states (the states in which a
- * RST is more likely), the more permissive check is used.
- * If we have multiple segments in flight, the intial reset
- * segment sequence numbers will be to the left of last_ack_sent,
- * but they will eventually catch up.
- * In any case, it never made sense to trim reset segments to
- * fit the receive window since RFC 1122 says:
- * 4.2.2.12 RST Segment: RFC-793 Section 3.4
- *
- * A TCP SHOULD allow a received RST segment to include data.
- *
- * DISCUSSION
- * It has been suggested that a RST segment could contain
- * ASCII text that encoded and explained the cause of the
- * RST. No standard has yet been established for such
- * data.
- *
- * If the reset segment passes the sequence number test examine
- * the state:
- * SYN_RECEIVED STATE:
- * If passive open, return to LISTEN state.
- * If active open, inform user that connection was refused.
- * ESTABLISHED, FIN_WAIT_1, FIN_WAIT_2, CLOSE_WAIT STATES:
- * Inform user that connection was reset, and close tcb.
- * CLOSING, LAST_ACK STATES:
- * Close the tcb.
- * TIME_WAIT STATE:
- * Drop the segment - see Stevens, vol. 2, p. 964 and
- * RFC 1337.
- */
- if (thflags & TH_RST) {
- if ((SEQ_GEQ(th->th_seq, tp->last_ack_sent) &&
- SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) ||
- (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) {
- switch (tp->t_state) {
-
- case TCPS_SYN_RECEIVED:
- so->so_error = ECONNREFUSED;
- goto close;
-
- case TCPS_ESTABLISHED:
- if (tp->last_ack_sent != th->th_seq &&
- tcp_insecure_rst == 0) {
- tcpstat.tcps_badrst++;
- goto drop;
- }
- case TCPS_FIN_WAIT_1:
- case TCPS_FIN_WAIT_2:
- case TCPS_CLOSE_WAIT:
- so->so_error = ECONNRESET;
- close:
- tp->t_state = TCPS_CLOSED;
- tcpstat.tcps_drops++;
- KASSERT(headlocked, ("tcp_input: "
- "trimthenstep6: tcp_close: head not "
- "locked"));
- tp = tcp_close(tp);
- break;
-
- case TCPS_CLOSING:
- case TCPS_LAST_ACK:
- KASSERT(headlocked, ("trimthenstep6: "
- "tcp_close.2: head not locked"));
- tp = tcp_close(tp);
- break;
-
- case TCPS_TIME_WAIT:
- KASSERT(tp->t_state != TCPS_TIME_WAIT,
- ("timewait"));
- break;
- }
- }
- goto drop;
- }
-
- /*
- * RFC 1323 PAWS: If we have a timestamp reply on this segment
- * and it's less than ts_recent, drop it.
- */
- if ((to.to_flags & TOF_TS) != 0 && tp->ts_recent &&
- TSTMP_LT(to.to_tsval, tp->ts_recent)) {
-
- /* Check to see if ts_recent is over 24 days old. */
- if ((int)(ticks - tp->ts_recent_age) > TCP_PAWS_IDLE) {
- /*
- * Invalidate ts_recent. If this segment updates
- * ts_recent, the age will be reset later and ts_recent
- * will get a valid value. If it does not, setting
- * ts_recent to zero will at least satisfy the
- * requirement that zero be placed in the timestamp
- * echo reply when ts_recent isn't valid. The
- * age isn't reset until we get a valid ts_recent
- * because we don't want out-of-order segments to be
- * dropped when ts_recent is old.
- */
- tp->ts_recent = 0;
- } else {
- tcpstat.tcps_rcvduppack++;
- tcpstat.tcps_rcvdupbyte += tlen;
- tcpstat.tcps_pawsdrop++;
- if (tlen)
- goto dropafterack;
- goto drop;
- }
- }
-
- /*
- * In the SYN-RECEIVED state, validate that the packet belongs to
- * this connection before trimming the data to fit the receive
- * window. Check the sequence number versus IRS since we know
- * the sequence numbers haven't wrapped. This is a partial fix
- * for the "LAND" DoS attack.
- */
- if (tp->t_state == TCPS_SYN_RECEIVED && SEQ_LT(th->th_seq, tp->irs)) {
- rstreason = BANDLIM_RST_OPENPORT;
- goto dropwithreset;
- }
-
- todrop = tp->rcv_nxt - th->th_seq;
- if (todrop > 0) {
- if (thflags & TH_SYN) {
- thflags &= ~TH_SYN;
- th->th_seq++;
- if (th->th_urp > 1)
- th->th_urp--;
- else
- thflags &= ~TH_URG;
- todrop--;
- }
- /*
- * Following if statement from Stevens, vol. 2, p. 960.
- */
- if (todrop > tlen
- || (todrop == tlen && (thflags & TH_FIN) == 0)) {
- /*
- * Any valid FIN must be to the left of the window.
- * At this point the FIN must be a duplicate or out
- * of sequence; drop it.
- */
- thflags &= ~TH_FIN;
-
- /*
- * Send an ACK to resynchronize and drop any data.
- * But keep on processing for RST or ACK.
- */
- tp->t_flags |= TF_ACKNOW;
- todrop = tlen;
- tcpstat.tcps_rcvduppack++;
- tcpstat.tcps_rcvdupbyte += todrop;
- } else {
- tcpstat.tcps_rcvpartduppack++;
- tcpstat.tcps_rcvpartdupbyte += todrop;
- }
- drop_hdrlen += todrop; /* drop from the top afterwards */
- th->th_seq += todrop;
- tlen -= todrop;
- if (th->th_urp > todrop)
- th->th_urp -= todrop;
- else {
- thflags &= ~TH_URG;
- th->th_urp = 0;
- }
- }
-
- /*
- * If new data are received on a connection after the
- * user processes are gone, then RST the other end.
- */
- if ((so->so_state & SS_NOFDREF) &&
- tp->t_state > TCPS_CLOSE_WAIT && tlen) {
- KASSERT(headlocked, ("trimthenstep6: tcp_close.3: head not "
- "locked"));
- tp = tcp_close(tp);
- tcpstat.tcps_rcvafterclose++;
- rstreason = BANDLIM_UNLIMITED;
- goto dropwithreset;
- }
-
- /*
- * If segment ends after window, drop trailing data
- * (and PUSH and FIN); if nothing left, just ACK.
- */
- todrop = (th->th_seq+tlen) - (tp->rcv_nxt+tp->rcv_wnd);
- if (todrop > 0) {
- tcpstat.tcps_rcvpackafterwin++;
- if (todrop >= tlen) {
- tcpstat.tcps_rcvbyteafterwin += tlen;
- /*
- * If a new connection request is received
- * while in TIME_WAIT, drop the old connection
- * and start over if the sequence numbers
- * are above the previous ones.
- */
- KASSERT(tp->t_state != TCPS_TIME_WAIT, ("timewait"));
- if (thflags & TH_SYN &&
- tp->t_state == TCPS_TIME_WAIT &&
- SEQ_GT(th->th_seq, tp->rcv_nxt)) {
- KASSERT(headlocked, ("trimthenstep6: "
- "tcp_close.4: head not locked"));
- tp = tcp_close(tp);
- goto findpcb;
- }
- /*
- * If window is closed can only take segments at
- * window edge, and have to drop data and PUSH from
- * incoming segments. Continue processing, but
- * remember to ack. Otherwise, drop segment
- * and ack.
- */
- if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) {
- tp->t_flags |= TF_ACKNOW;
- tcpstat.tcps_rcvwinprobe++;
- } else
- goto dropafterack;
- } else
- tcpstat.tcps_rcvbyteafterwin += todrop;
- m_adj(m, -todrop);
- tlen -= todrop;
- thflags &= ~(TH_PUSH|TH_FIN);
- }
-
- /*
- * If last ACK falls within this segment's sequence numbers,
- * record its timestamp.
- * NOTE:
- * 1) That the test incorporates suggestions from the latest
- * proposal of the tcplw@cray.com list (Braden 1993/04/26).
- * 2) That updating only on newer timestamps interferes with
- * our earlier PAWS tests, so this check should be solely
- * predicated on the sequence space of this segment.
- * 3) That we modify the segment boundary check to be
- * Last.ACK.Sent <= SEG.SEQ + SEG.Len
- * instead of RFC1323's
- * Last.ACK.Sent < SEG.SEQ + SEG.Len,
- * This modified check allows us to overcome RFC1323's
- * limitations as described in Stevens TCP/IP Illustrated
- * Vol. 2 p.869. In such cases, we can still calculate the
- * RTT correctly when RCV.NXT == Last.ACK.Sent.
- */
- if ((to.to_flags & TOF_TS) != 0 &&
- SEQ_LEQ(th->th_seq, tp->last_ack_sent) &&
- SEQ_LEQ(tp->last_ack_sent, th->th_seq + tlen +
- ((thflags & (TH_SYN|TH_FIN)) != 0))) {
- tp->ts_recent_age = ticks;
- tp->ts_recent = to.to_tsval;
- }
-
- /*
- * If a SYN is in the window, then this is an
- * error and we send an RST and drop the connection.
- */
- if (thflags & TH_SYN) {
- KASSERT(headlocked, ("tcp_input: tcp_drop: trimthenstep6: "
- "head not locked"));
- tp = tcp_drop(tp, ECONNRESET);
- rstreason = BANDLIM_UNLIMITED;
- goto drop;
- }
-
- /*
- * If the ACK bit is off: if in SYN-RECEIVED state or SENDSYN
- * flag is on (half-synchronized state), then queue data for
- * later processing; else drop segment and return.
- */
- if ((thflags & TH_ACK) == 0) {
- if (tp->t_state == TCPS_SYN_RECEIVED ||
- (tp->t_flags & TF_NEEDSYN))
- goto step6;
- else
- goto drop;
- }
-
- /*
- * Ack processing.
- */
- switch (tp->t_state) {
-
- /*
- * In SYN_RECEIVED state, the ack ACKs our SYN, so enter
- * ESTABLISHED state and continue processing.
- * The ACK was checked above.
- */
- case TCPS_SYN_RECEIVED:
-
- tcpstat.tcps_connects++;
- soisconnected(so);
- /* Do window scaling? */
- if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
- (TF_RCVD_SCALE|TF_REQ_SCALE)) {
- tp->snd_scale = tp->requested_s_scale;
- tp->rcv_scale = tp->request_r_scale;
- }
- /*
- * Make transitions:
- * SYN-RECEIVED -> ESTABLISHED
- * SYN-RECEIVED* -> FIN-WAIT-1
- */
- tp->t_starttime = ticks;
- if (tp->t_flags & TF_NEEDFIN) {
- tp->t_state = TCPS_FIN_WAIT_1;
- tp->t_flags &= ~TF_NEEDFIN;
- } else {
- tp->t_state = TCPS_ESTABLISHED;
- callout_reset(tp->tt_keep, tcp_keepidle,
- tcp_timer_keep, tp);
- }
- /*
- * If segment contains data or ACK, will call tcp_reass()
- * later; if not, do so now to pass queued data to user.
- */
- if (tlen == 0 && (thflags & TH_FIN) == 0)
- (void) tcp_reass(tp, (struct tcphdr *)0, 0,
- (struct mbuf *)0);
- tp->snd_wl1 = th->th_seq - 1;
- /* FALLTHROUGH */
-
- /*
- * In ESTABLISHED state: drop duplicate ACKs; ACK out of range
- * ACKs. If the ack is in the range
- * tp->snd_una < th->th_ack <= tp->snd_max
- * then advance tp->snd_una to th->th_ack and drop
- * data from the retransmission queue. If this ACK reflects
- * more up to date window information we update our window information.
- */
- case TCPS_ESTABLISHED:
- case TCPS_FIN_WAIT_1:
- case TCPS_FIN_WAIT_2:
- case TCPS_CLOSE_WAIT:
- case TCPS_CLOSING:
- case TCPS_LAST_ACK:
- case TCPS_TIME_WAIT:
- KASSERT(tp->t_state != TCPS_TIME_WAIT, ("timewait"));
- if (SEQ_GT(th->th_ack, tp->snd_max)) {
- tcpstat.tcps_rcvacktoomuch++;
- goto dropafterack;
- }
- if (tp->sack_enable &&
- (to.to_nsacks > 0 || !TAILQ_EMPTY(&tp->snd_holes)))
- tcp_sack_doack(tp, &to, th->th_ack);
- if (SEQ_LEQ(th->th_ack, tp->snd_una)) {
- if (tlen == 0 && tiwin == tp->snd_wnd) {
- tcpstat.tcps_rcvdupack++;
- /*
- * If we have outstanding data (other than
- * a window probe), this is a completely
- * duplicate ack (ie, window info didn't
- * change), the ack is the biggest we've
- * seen and we've seen exactly our rexmt
- * threshhold of them, assume a packet
- * has been dropped and retransmit it.
- * Kludge snd_nxt & the congestion
- * window so we send only this one
- * packet.
- *
- * We know we're losing at the current
- * window size so do congestion avoidance
- * (set ssthresh to half the current window
- * and pull our congestion window back to
- * the new ssthresh).
- *
- * Dup acks mean that packets have left the
- * network (they're now cached at the receiver)
- * so bump cwnd by the amount in the receiver
- * to keep a constant cwnd packets in the
- * network.
- */
- if (!callout_active(tp->tt_rexmt) ||
- th->th_ack != tp->snd_una)
- tp->t_dupacks = 0;
- else if (++tp->t_dupacks > tcprexmtthresh ||
- ((tcp_do_newreno || tp->sack_enable) &&
- IN_FASTRECOVERY(tp))) {
- if (tp->sack_enable && IN_FASTRECOVERY(tp)) {
- int awnd;
-
- /*
- * Compute the amount of data in flight first.
- * We can inject new data into the pipe iff
- * we have less than 1/2 the original window's
- * worth of data in flight.
- */
- awnd = (tp->snd_nxt - tp->snd_fack) +
- tp->sackhint.sack_bytes_rexmit;
- if (awnd < tp->snd_ssthresh) {
- tp->snd_cwnd += tp->t_maxseg;
- if (tp->snd_cwnd > tp->snd_ssthresh)
- tp->snd_cwnd = tp->snd_ssthresh;
- }
- } else
- tp->snd_cwnd += tp->t_maxseg;
- (void) tcp_output(tp);
- goto drop;
- } else if (tp->t_dupacks == tcprexmtthresh) {
- tcp_seq onxt = tp->snd_nxt;
- u_int win;
-
- /*
- * If we're doing sack, check to
- * see if we're already in sack
- * recovery. If we're not doing sack,
- * check to see if we're in newreno
- * recovery.
- */
- if (tp->sack_enable) {
- if (IN_FASTRECOVERY(tp)) {
- tp->t_dupacks = 0;
- break;
- }
- } else if (tcp_do_newreno) {
- if (SEQ_LEQ(th->th_ack,
- tp->snd_recover)) {
- tp->t_dupacks = 0;
- break;
- }
- }
- win = min(tp->snd_wnd, tp->snd_cwnd) /
- 2 / tp->t_maxseg;
- if (win < 2)
- win = 2;
- tp->snd_ssthresh = win * tp->t_maxseg;
- ENTER_FASTRECOVERY(tp);
- tp->snd_recover = tp->snd_max;
- callout_stop(tp->tt_rexmt);
- tp->t_rtttime = 0;
- if (tp->sack_enable) {
- KASSERT(tp->sackhint.
- sack_bytes_rexmit == 0,
- ("sackhint rexmit == 0"));
- tcpstat.tcps_sack_recovery_episode++;
- tp->sack_newdata = tp->snd_nxt;
- tp->snd_cwnd = tp->t_maxseg;
- (void) tcp_output(tp);
- goto drop;
- }
- tp->snd_nxt = th->th_ack;
- tp->snd_cwnd = tp->t_maxseg;
- (void) tcp_output(tp);
- KASSERT(tp->snd_limited <= 2,
- ("tp->snd_limited too big"));
- tp->snd_cwnd = tp->snd_ssthresh +
- tp->t_maxseg *
- (tp->t_dupacks - tp->snd_limited);
- if (SEQ_GT(onxt, tp->snd_nxt))
- tp->snd_nxt = onxt;
- goto drop;
- } else if (tcp_do_rfc3042) {
- u_long oldcwnd = tp->snd_cwnd;
- tcp_seq oldsndmax = tp->snd_max;
- u_int sent;
-
- KASSERT(tp->t_dupacks == 1 ||
- tp->t_dupacks == 2,
- ("dupacks not 1 or 2"));
- if (tp->t_dupacks == 1)
- tp->snd_limited = 0;
- tp->snd_cwnd =
- (tp->snd_nxt - tp->snd_una) +
- (tp->t_dupacks - tp->snd_limited) *
- tp->t_maxseg;
- (void) tcp_output(tp);
- sent = tp->snd_max - oldsndmax;
- if (sent > tp->t_maxseg) {
- KASSERT((tp->t_dupacks == 2 &&
- tp->snd_limited == 0) ||
- (sent == tp->t_maxseg + 1 &&
- tp->t_flags & TF_SENTFIN),
- ("sent too much"));
- tp->snd_limited = 2;
- } else if (sent > 0)
- ++tp->snd_limited;
- tp->snd_cwnd = oldcwnd;
- goto drop;
- }
- } else
- tp->t_dupacks = 0;
- break;
- }
-
- KASSERT(SEQ_GT(th->th_ack, tp->snd_una), ("th_ack <= snd_una"));
-
- /*
- * If the congestion window was inflated to account
- * for the other side's cached packets, retract it.
- */
- if (tcp_do_newreno || tp->sack_enable) {
- if (IN_FASTRECOVERY(tp)) {
- if (SEQ_LT(th->th_ack, tp->snd_recover)) {
- if (tp->sack_enable)
- tcp_sack_partialack(tp, th);
- else
- tcp_newreno_partial_ack(tp, th);
- } else {
- /*
- * Out of fast recovery.
- * Window inflation should have left us
- * with approximately snd_ssthresh
- * outstanding data.
- * But in case we would be inclined to
- * send a burst, better to do it via
- * the slow start mechanism.
- */
- if (SEQ_GT(th->th_ack +
- tp->snd_ssthresh,
- tp->snd_max))
- tp->snd_cwnd = tp->snd_max -
- th->th_ack +
- tp->t_maxseg;
- else
- tp->snd_cwnd = tp->snd_ssthresh;
- }
- }
- } else {
- if (tp->t_dupacks >= tcprexmtthresh &&
- tp->snd_cwnd > tp->snd_ssthresh)
- tp->snd_cwnd = tp->snd_ssthresh;
- }
- tp->t_dupacks = 0;
- /*
- * If we reach this point, ACK is not a duplicate,
- * i.e., it ACKs something we sent.
- */
- if (tp->t_flags & TF_NEEDSYN) {
- /*
- * T/TCP: Connection was half-synchronized, and our
- * SYN has been ACK'd (so connection is now fully
- * synchronized). Go to non-starred state,
- * increment snd_una for ACK of SYN, and check if
- * we can do window scaling.
- */
- tp->t_flags &= ~TF_NEEDSYN;
- tp->snd_una++;
- /* Do window scaling? */
- if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
- (TF_RCVD_SCALE|TF_REQ_SCALE)) {
- tp->snd_scale = tp->requested_s_scale;
- tp->rcv_scale = tp->request_r_scale;
- }
- }
-
-process_ACK:
- KASSERT(headlocked, ("tcp_input: process_ACK: head not "
- "locked"));
- INP_LOCK_ASSERT(inp);
-
- acked = th->th_ack - tp->snd_una;
- tcpstat.tcps_rcvackpack++;
- tcpstat.tcps_rcvackbyte += acked;
-
- /*
- * If we just performed our first retransmit, and the ACK
- * arrives within our recovery window, then it was a mistake
- * to do the retransmit in the first place. Recover our
- * original cwnd and ssthresh, and proceed to transmit where
- * we left off.
- */
- if (tp->t_rxtshift == 1 && ticks < tp->t_badrxtwin) {
- ++tcpstat.tcps_sndrexmitbad;
- tp->snd_cwnd = tp->snd_cwnd_prev;
- tp->snd_ssthresh = tp->snd_ssthresh_prev;
- tp->snd_recover = tp->snd_recover_prev;
- if (tp->t_flags & TF_WASFRECOVERY)
- ENTER_FASTRECOVERY(tp);
- tp->snd_nxt = tp->snd_max;
- tp->t_badrxtwin = 0; /* XXX probably not required */
- }
-
- /*
- * If we have a timestamp reply, update smoothed
- * round trip time. If no timestamp is present but
- * transmit timer is running and timed sequence
- * number was acked, update smoothed round trip time.
- * Since we now have an rtt measurement, cancel the
- * timer backoff (cf., Phil Karn's retransmit alg.).
- * Recompute the initial retransmit timer.
- *
- * Some boxes send broken timestamp replies
- * during the SYN+ACK phase, ignore
- * timestamps of 0 or we could calculate a
- * huge RTT and blow up the retransmit timer.
- */
- if ((to.to_flags & TOF_TS) != 0 &&
- to.to_tsecr) {
- tcp_xmit_timer(tp, ticks - to.to_tsecr + 1);
- } else if (tp->t_rtttime && SEQ_GT(th->th_ack, tp->t_rtseq)) {
- tcp_xmit_timer(tp, ticks - tp->t_rtttime);
- }
- tcp_xmit_bandwidth_limit(tp, th->th_ack);
-
- /*
- * If all outstanding data is acked, stop retransmit
- * timer and remember to restart (more output or persist).
- * If there is more data to be acked, restart retransmit
- * timer, using current (possibly backed-off) value.
- */
- if (th->th_ack == tp->snd_max) {
- callout_stop(tp->tt_rexmt);
- needoutput = 1;
- } else if (!callout_active(tp->tt_persist))
- callout_reset(tp->tt_rexmt, tp->t_rxtcur,
- tcp_timer_rexmt, tp);
-
- /*
- * If no data (only SYN) was ACK'd,
- * skip rest of ACK processing.
- */
- if (acked == 0)
- goto step6;
-
- /*
- * When new data is acked, open the congestion window.
- * If the window gives us less than ssthresh packets
- * in flight, open exponentially (maxseg per packet).
- * Otherwise open linearly: maxseg per window
- * (maxseg^2 / cwnd per packet).
- */
- if ((!tcp_do_newreno && !tp->sack_enable) ||
- !IN_FASTRECOVERY(tp)) {
- register u_int cw = tp->snd_cwnd;
- register u_int incr = tp->t_maxseg;
- if (cw > tp->snd_ssthresh)
- incr = incr * incr / cw;
- tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<<tp->snd_scale);
- }
- SOCKBUF_LOCK(&so->so_snd);
- if (acked > so->so_snd.sb_cc) {
- tp->snd_wnd -= so->so_snd.sb_cc;
- sbdrop_locked(&so->so_snd, (int)so->so_snd.sb_cc);
- ourfinisacked = 1;
- } else {
- sbdrop_locked(&so->so_snd, acked);
- tp->snd_wnd -= acked;
- ourfinisacked = 0;
- }
- sowwakeup_locked(so);
- /* detect una wraparound */
- if ((tcp_do_newreno || tp->sack_enable) &&
- !IN_FASTRECOVERY(tp) &&
- SEQ_GT(tp->snd_una, tp->snd_recover) &&
- SEQ_LEQ(th->th_ack, tp->snd_recover))
- tp->snd_recover = th->th_ack - 1;
- if ((tcp_do_newreno || tp->sack_enable) &&
- IN_FASTRECOVERY(tp) &&
- SEQ_GEQ(th->th_ack, tp->snd_recover))
- EXIT_FASTRECOVERY(tp);
- tp->snd_una = th->th_ack;
- if (tp->sack_enable) {
- if (SEQ_GT(tp->snd_una, tp->snd_recover))
- tp->snd_recover = tp->snd_una;
- }
- if (SEQ_LT(tp->snd_nxt, tp->snd_una))
- tp->snd_nxt = tp->snd_una;
-
- switch (tp->t_state) {
-
- /*
- * In FIN_WAIT_1 STATE in addition to the processing
- * for the ESTABLISHED state if our FIN is now acknowledged
- * then enter FIN_WAIT_2.
- */
- case TCPS_FIN_WAIT_1:
- if (ourfinisacked) {
- /*
- * If we can't receive any more
- * data, then closing user can proceed.
- * Starting the timer is contrary to the
- * specification, but if we don't get a FIN
- * we'll hang forever.
- */
- /* XXXjl
- * we should release the tp also, and use a
- * compressed state.
- */
- if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
- soisdisconnected(so);
- callout_reset(tp->tt_2msl, tcp_maxidle,
- tcp_timer_2msl, tp);
- }
- tp->t_state = TCPS_FIN_WAIT_2;
- }
- break;
-
- /*
- * In CLOSING STATE in addition to the processing for
- * the ESTABLISHED state if the ACK acknowledges our FIN
- * then enter the TIME-WAIT state, otherwise ignore
- * the segment.
- */
- case TCPS_CLOSING:
- if (ourfinisacked) {
- KASSERT(headlocked, ("tcp_input: process_ACK: "
- "head not locked"));
- tcp_twstart(tp);
- INP_INFO_WUNLOCK(&tcbinfo);
- m_freem(m);
- return;
- }
- break;
-
- /*
- * In LAST_ACK, we may still be waiting for data to drain
- * and/or to be acked, as well as for the ack of our FIN.
- * If our FIN is now acknowledged, delete the TCB,
- * enter the closed state and return.
- */
- case TCPS_LAST_ACK:
- if (ourfinisacked) {
- KASSERT(headlocked, ("tcp_input: process_ACK:"
- " tcp_close: head not locked"));
- tp = tcp_close(tp);
- goto drop;
- }
- break;
-
- /*
- * In TIME_WAIT state the only thing that should arrive
- * is a retransmission of the remote FIN. Acknowledge
- * it and restart the finack timer.
- */
- case TCPS_TIME_WAIT:
- KASSERT(tp->t_state != TCPS_TIME_WAIT, ("timewait"));
- callout_reset(tp->tt_2msl, 2 * tcp_msl,
- tcp_timer_2msl, tp);
- goto dropafterack;
- }
- }
-
-step6:
- KASSERT(headlocked, ("tcp_input: step6: head not locked"));
- INP_LOCK_ASSERT(inp);
-
- /*
- * Update window information.
- * Don't look at window if no ACK: TAC's send garbage on first SYN.
- */
- if ((thflags & TH_ACK) &&
- (SEQ_LT(tp->snd_wl1, th->th_seq) ||
- (tp->snd_wl1 == th->th_seq && (SEQ_LT(tp->snd_wl2, th->th_ack) ||
- (tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd))))) {
- /* keep track of pure window updates */
- if (tlen == 0 &&
- tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd)
- tcpstat.tcps_rcvwinupd++;
- tp->snd_wnd = tiwin;
- tp->snd_wl1 = th->th_seq;
- tp->snd_wl2 = th->th_ack;
- if (tp->snd_wnd > tp->max_sndwnd)
- tp->max_sndwnd = tp->snd_wnd;
- needoutput = 1;
- }
-
- /*
- * Process segments with URG.
- */
- if ((thflags & TH_URG) && th->th_urp &&
- TCPS_HAVERCVDFIN(tp->t_state) == 0) {
- /*
- * This is a kludge, but if we receive and accept
- * random urgent pointers, we'll crash in
- * soreceive. It's hard to imagine someone
- * actually wanting to send this much urgent data.
- */
- SOCKBUF_LOCK(&so->so_rcv);
- if (th->th_urp + so->so_rcv.sb_cc > sb_max) {
- th->th_urp = 0; /* XXX */
- thflags &= ~TH_URG; /* XXX */
- SOCKBUF_UNLOCK(&so->so_rcv); /* XXX */
- goto dodata; /* XXX */
- }
- /*
- * If this segment advances the known urgent pointer,
- * then mark the data stream. This should not happen
- * in CLOSE_WAIT, CLOSING, LAST_ACK or TIME_WAIT STATES since
- * a FIN has been received from the remote side.
- * In these states we ignore the URG.
- *
- * According to RFC961 (Assigned Protocols),
- * the urgent pointer points to the last octet
- * of urgent data. We continue, however,
- * to consider it to indicate the first octet
- * of data past the urgent section as the original
- * spec states (in one of two places).
- */
- if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) {
- tp->rcv_up = th->th_seq + th->th_urp;
- so->so_oobmark = so->so_rcv.sb_cc +
- (tp->rcv_up - tp->rcv_nxt) - 1;
- if (so->so_oobmark == 0)
- so->so_rcv.sb_state |= SBS_RCVATMARK;
- sohasoutofband(so);
- tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
- }
- SOCKBUF_UNLOCK(&so->so_rcv);
- /*
- * Remove out of band data so doesn't get presented to user.
- * This can happen independent of advancing the URG pointer,
- * but if two URG's are pending at once, some out-of-band
- * data may creep in... ick.
- */
- if (th->th_urp <= (u_long)tlen &&
- !(so->so_options & SO_OOBINLINE)) {
- /* hdr drop is delayed */
- tcp_pulloutofband(so, th, m, drop_hdrlen);
- }
- } else {
- /*
- * If no out of band data is expected,
- * pull receive urgent pointer along
- * with the receive window.
- */
- if (SEQ_GT(tp->rcv_nxt, tp->rcv_up))
- tp->rcv_up = tp->rcv_nxt;
- }
-dodata: /* XXX */
- KASSERT(headlocked, ("tcp_input: dodata: head not locked"));
- INP_LOCK_ASSERT(inp);
-
- /*
- * Process the segment text, merging it into the TCP sequencing queue,
- * and arranging for acknowledgment of receipt if necessary.
- * This process logically involves adjusting tp->rcv_wnd as data
- * is presented to the user (this happens in tcp_usrreq.c,
- * case PRU_RCVD). If a FIN has already been received on this
- * connection then we just ignore the text.
- */
- if ((tlen || (thflags & TH_FIN)) &&
- TCPS_HAVERCVDFIN(tp->t_state) == 0) {
- tcp_seq save_start = th->th_seq;
- tcp_seq save_end = th->th_seq + tlen;
- m_adj(m, drop_hdrlen); /* delayed header drop */
- /*
- * Insert segment which includes th into TCP reassembly queue
- * with control block tp. Set thflags to whether reassembly now
- * includes a segment with FIN. This handles the common case
- * inline (segment is the next to be received on an established
- * connection, and the queue is empty), avoiding linkage into
- * and removal from the queue and repetition of various
- * conversions.
- * Set DELACK for segments received in order, but ack
- * immediately when segments are out of order (so
- * fast retransmit can work).
- */
- if (th->th_seq == tp->rcv_nxt &&
- LIST_EMPTY(&tp->t_segq) &&
- TCPS_HAVEESTABLISHED(tp->t_state)) {
- if (DELAY_ACK(tp))
- tp->t_flags |= TF_DELACK;
- else
- tp->t_flags |= TF_ACKNOW;
- tp->rcv_nxt += tlen;
- thflags = th->th_flags & TH_FIN;
- tcpstat.tcps_rcvpack++;
- tcpstat.tcps_rcvbyte += tlen;
- ND6_HINT(tp);
- SOCKBUF_LOCK(&so->so_rcv);
- if (so->so_rcv.sb_state & SBS_CANTRCVMORE)
- m_freem(m);
- else
- sbappendstream_locked(&so->so_rcv, m);
- sorwakeup_locked(so);
- } else {
- thflags = tcp_reass(tp, th, &tlen, m);
- tp->t_flags |= TF_ACKNOW;
- }
- if (tlen > 0 && tp->sack_enable)
- tcp_update_sack_list(tp, save_start, save_end);
- /*
- * Note the amount of data that peer has sent into
- * our window, in order to estimate the sender's
- * buffer size.
- */
- len = so->so_rcv.sb_hiwat - (tp->rcv_adv - tp->rcv_nxt);
- } else {
- m_freem(m);
- thflags &= ~TH_FIN;
- }
-
- /*
- * If FIN is received ACK the FIN and let the user know
- * that the connection is closing.
- */
- if (thflags & TH_FIN) {
- if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
- socantrcvmore(so);
- /*
- * If connection is half-synchronized
- * (ie NEEDSYN flag on) then delay ACK,
- * so it may be piggybacked when SYN is sent.
- * Otherwise, since we received a FIN then no
- * more input can be expected, send ACK now.
- */
- if (tp->t_flags & TF_NEEDSYN)
- tp->t_flags |= TF_DELACK;
- else
- tp->t_flags |= TF_ACKNOW;
- tp->rcv_nxt++;
- }
- switch (tp->t_state) {
-
- /*
- * In SYN_RECEIVED and ESTABLISHED STATES
- * enter the CLOSE_WAIT state.
- */
- case TCPS_SYN_RECEIVED:
- tp->t_starttime = ticks;
- /*FALLTHROUGH*/
- case TCPS_ESTABLISHED:
- tp->t_state = TCPS_CLOSE_WAIT;
- break;
-
- /*
- * If still in FIN_WAIT_1 STATE FIN has not been acked so
- * enter the CLOSING state.
- */
- case TCPS_FIN_WAIT_1:
- tp->t_state = TCPS_CLOSING;
- break;
-
- /*
- * In FIN_WAIT_2 state enter the TIME_WAIT state,
- * starting the time-wait timer, turning off the other
- * standard timers.
- */
- case TCPS_FIN_WAIT_2:
- KASSERT(headlocked == 1, ("tcp_input: dodata: "
- "TCP_FIN_WAIT_2: head not locked"));
- tcp_twstart(tp);
- INP_INFO_WUNLOCK(&tcbinfo);
- return;
-
- /*
- * In TIME_WAIT state restart the 2 MSL time_wait timer.
- */
- case TCPS_TIME_WAIT:
- KASSERT(tp->t_state != TCPS_TIME_WAIT, ("timewait"));
- callout_reset(tp->tt_2msl, 2 * tcp_msl,
- tcp_timer_2msl, tp);
- break;
- }
- }
- INP_INFO_WUNLOCK(&tcbinfo);
- headlocked = 0;
-#ifdef TCPDEBUG
- if (so->so_options & SO_DEBUG)
- tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen,
- &tcp_savetcp, 0);
-#endif
-
- /*
- * Return any desired output.
- */
- if (needoutput || (tp->t_flags & TF_ACKNOW))
- (void) tcp_output(tp);
-
-check_delack:
- KASSERT(headlocked == 0, ("tcp_input: check_delack: head locked"));
- INP_LOCK_ASSERT(inp);
- if (tp->t_flags & TF_DELACK) {
- tp->t_flags &= ~TF_DELACK;
- callout_reset(tp->tt_delack, tcp_delacktime,
- tcp_timer_delack, tp);
- }
- INP_UNLOCK(inp);
- return;
-
-dropafterack:
- KASSERT(headlocked, ("tcp_input: dropafterack: head not locked"));
- /*
- * Generate an ACK dropping incoming segment if it occupies
- * sequence space, where the ACK reflects our state.
- *
- * We can now skip the test for the RST flag since all
- * paths to this code happen after packets containing
- * RST have been dropped.
- *
- * In the SYN-RECEIVED state, don't send an ACK unless the
- * segment we received passes the SYN-RECEIVED ACK test.
- * If it fails send a RST. This breaks the loop in the
- * "LAND" DoS attack, and also prevents an ACK storm
- * between two listening ports that have been sent forged
- * SYN segments, each with the source address of the other.
- */
- if (tp->t_state == TCPS_SYN_RECEIVED && (thflags & TH_ACK) &&
- (SEQ_GT(tp->snd_una, th->th_ack) ||
- SEQ_GT(th->th_ack, tp->snd_max)) ) {
- rstreason = BANDLIM_RST_OPENPORT;
- goto dropwithreset;
- }
-#ifdef TCPDEBUG
- if (so->so_options & SO_DEBUG)
- tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
- &tcp_savetcp, 0);
-#endif
- KASSERT(headlocked, ("headlocked should be 1"));
- INP_INFO_WUNLOCK(&tcbinfo);
- tp->t_flags |= TF_ACKNOW;
- (void) tcp_output(tp);
- INP_UNLOCK(inp);
- m_freem(m);
- return;
-
-dropwithreset:
- KASSERT(headlocked, ("tcp_input: dropwithreset: head not locked"));
- /*
- * Generate a RST, dropping incoming segment.
- * Make ACK acceptable to originator of segment.
- * Don't bother to respond if destination was broadcast/multicast.
- */
- if ((thflags & TH_RST) || m->m_flags & (M_BCAST|M_MCAST))
- goto drop;
- if (isipv6) {
- if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
- IN6_IS_ADDR_MULTICAST(&ip6->ip6_src))
- goto drop;
- } else {
- if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) ||
- IN_MULTICAST(ntohl(ip->ip_src.s_addr)) ||
- ip->ip_src.s_addr == htonl(INADDR_BROADCAST) ||
- in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif))
- goto drop;
- }
- /* IPv6 anycast check is done at tcp6_input() */
-
- /*
- * Perform bandwidth limiting.
- */
- if (badport_bandlim(rstreason) < 0)
- goto drop;
-
-#ifdef TCPDEBUG
- if (tp == 0 || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
- tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
- &tcp_savetcp, 0);
-#endif
-
- if (thflags & TH_ACK)
- /* mtod() below is safe as long as hdr dropping is delayed */
- tcp_respond(tp, mtod(m, void *), th, m, (tcp_seq)0, th->th_ack,
- TH_RST);
- else {
- if (thflags & TH_SYN)
- tlen++;
- /* mtod() below is safe as long as hdr dropping is delayed */
- tcp_respond(tp, mtod(m, void *), th, m, th->th_seq+tlen,
- (tcp_seq)0, TH_RST|TH_ACK);
- }
-
- if (tp)
- INP_UNLOCK(inp);
- if (headlocked)
- INP_INFO_WUNLOCK(&tcbinfo);
- return;
-
-drop:
- /*
- * Drop space held by incoming segment and return.
- */
-#ifdef TCPDEBUG
- if (tp == 0 || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
- tcp_trace(TA_DROP, ostate, tp, (void *)tcp_saveipgen,
- &tcp_savetcp, 0);
-#endif
- if (tp)
- INP_UNLOCK(inp);
- if (headlocked)
- INP_INFO_WUNLOCK(&tcbinfo);
- m_freem(m);
- return;
-}
-
-/*
- * Parse TCP options and place in tcpopt.
- */
-static void
-tcp_dooptions(to, cp, cnt, is_syn)
- struct tcpopt *to;
- u_char *cp;
- int cnt;
- int is_syn;
-{
- int opt, optlen;
-
- to->to_flags = 0;
- for (; cnt > 0; cnt -= optlen, cp += optlen) {
- opt = cp[0];
- if (opt == TCPOPT_EOL)
- break;
- if (opt == TCPOPT_NOP)
- optlen = 1;
- else {
- if (cnt < 2)
- break;
- optlen = cp[1];
- if (optlen < 2 || optlen > cnt)
- break;
- }
- switch (opt) {
- case TCPOPT_MAXSEG:
- if (optlen != TCPOLEN_MAXSEG)
- continue;
- if (!is_syn)
- continue;
- to->to_flags |= TOF_MSS;
- bcopy((char *)cp + 2,
- (char *)&to->to_mss, sizeof(to->to_mss));
- to->to_mss = ntohs(to->to_mss);
- break;
- case TCPOPT_WINDOW:
- if (optlen != TCPOLEN_WINDOW)
- continue;
- if (! is_syn)
- continue;
- to->to_flags |= TOF_SCALE;
- to->to_requested_s_scale = min(cp[2], TCP_MAX_WINSHIFT);
- break;
- case TCPOPT_TIMESTAMP:
- if (optlen != TCPOLEN_TIMESTAMP)
- continue;
- to->to_flags |= TOF_TS;
- bcopy((char *)cp + 2,
- (char *)&to->to_tsval, sizeof(to->to_tsval));
- to->to_tsval = ntohl(to->to_tsval);
- bcopy((char *)cp + 6,
- (char *)&to->to_tsecr, sizeof(to->to_tsecr));
- to->to_tsecr = ntohl(to->to_tsecr);
- /*
- * If echoed timestamp is later than the current time,
- * fall back to non RFC1323 RTT calculation.
- */
- if ((to->to_tsecr != 0) && TSTMP_GT(to->to_tsecr, ticks))
- to->to_tsecr = 0;
- break;
-#ifdef TCP_SIGNATURE
- /*
- * XXX In order to reply to a host which has set the
- * TCP_SIGNATURE option in its initial SYN, we have to
- * record the fact that the option was observed here
- * for the syncache code to perform the correct response.
- */
- case TCPOPT_SIGNATURE:
- if (optlen != TCPOLEN_SIGNATURE)
- continue;
- to->to_flags |= (TOF_SIGNATURE | TOF_SIGLEN);
- break;
-#endif
- case TCPOPT_SACK_PERMITTED:
- if (!tcp_do_sack ||
- optlen != TCPOLEN_SACK_PERMITTED)
- continue;
- if (is_syn) {
- /* MUST only be set on SYN */
- to->to_flags |= TOF_SACK;
- }
- break;
- case TCPOPT_SACK:
- if (optlen <= 2 || (optlen - 2) % TCPOLEN_SACK != 0)
- continue;
- to->to_nsacks = (optlen - 2) / TCPOLEN_SACK;
- to->to_sacks = cp + 2;
- tcpstat.tcps_sack_rcv_blocks++;
- break;
- default:
- continue;
- }
- }
-}
-
-/*
- * Pull out of band byte out of a segment so
- * it doesn't appear in the user's data queue.
- * It is still reflected in the segment length for
- * sequencing purposes.
- */
-static void
-tcp_pulloutofband(so, th, m, off)
- struct socket *so;
- struct tcphdr *th;
- register struct mbuf *m;
- int off; /* delayed to be droped hdrlen */
-{
- int cnt = off + th->th_urp - 1;
-
- while (cnt >= 0) {
- if (m->m_len > cnt) {
- char *cp = mtod(m, caddr_t) + cnt;
- struct tcpcb *tp = sototcpcb(so);
-
- tp->t_iobc = *cp;
- tp->t_oobflags |= TCPOOB_HAVEDATA;
- bcopy(cp+1, cp, (unsigned)(m->m_len - cnt - 1));
- m->m_len--;
- if (m->m_flags & M_PKTHDR)
- m->m_pkthdr.len--;
- return;
- }
- cnt -= m->m_len;
- m = m->m_next;
- if (m == 0)
- break;
- }
- panic("tcp_pulloutofband");
-}
-
-/*
- * Collect new round-trip time estimate
- * and update averages and current timeout.
- */
-static void
-tcp_xmit_timer(tp, rtt)
- register struct tcpcb *tp;
- int rtt;
-{
- register int delta;
-
- INP_LOCK_ASSERT(tp->t_inpcb);
-
- tcpstat.tcps_rttupdated++;
- tp->t_rttupdated++;
- if (tp->t_srtt != 0) {
- /*
- * srtt is stored as fixed point with 5 bits after the
- * binary point (i.e., scaled by 8). The following magic
- * is equivalent to the smoothing algorithm in rfc793 with
- * an alpha of .875 (srtt = rtt/8 + srtt*7/8 in fixed
- * point). Adjust rtt to origin 0.
- */
- delta = ((rtt - 1) << TCP_DELTA_SHIFT)
- - (tp->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT));
-
- if ((tp->t_srtt += delta) <= 0)
- tp->t_srtt = 1;
-
- /*
- * We accumulate a smoothed rtt variance (actually, a
- * smoothed mean difference), then set the retransmit
- * timer to smoothed rtt + 4 times the smoothed variance.
- * rttvar is stored as fixed point with 4 bits after the
- * binary point (scaled by 16). The following is
- * equivalent to rfc793 smoothing with an alpha of .75
- * (rttvar = rttvar*3/4 + |delta| / 4). This replaces
- * rfc793's wired-in beta.
- */
- if (delta < 0)
- delta = -delta;
- delta -= tp->t_rttvar >> (TCP_RTTVAR_SHIFT - TCP_DELTA_SHIFT);
- if ((tp->t_rttvar += delta) <= 0)
- tp->t_rttvar = 1;
- if (tp->t_rttbest > tp->t_srtt + tp->t_rttvar)
- tp->t_rttbest = tp->t_srtt + tp->t_rttvar;
- } else {
- /*
- * No rtt measurement yet - use the unsmoothed rtt.
- * Set the variance to half the rtt (so our first
- * retransmit happens at 3*rtt).
- */
- tp->t_srtt = rtt << TCP_RTT_SHIFT;
- tp->t_rttvar = rtt << (TCP_RTTVAR_SHIFT - 1);
- tp->t_rttbest = tp->t_srtt + tp->t_rttvar;
- }
- tp->t_rtttime = 0;
- tp->t_rxtshift = 0;
-
- /*
- * the retransmit should happen at rtt + 4 * rttvar.
- * Because of the way we do the smoothing, srtt and rttvar
- * will each average +1/2 tick of bias. When we compute
- * the retransmit timer, we want 1/2 tick of rounding and
- * 1 extra tick because of +-1/2 tick uncertainty in the
- * firing of the timer. The bias will give us exactly the
- * 1.5 tick we need. But, because the bias is
- * statistical, we have to test that we don't drop below
- * the minimum feasible timer (which is 2 ticks).
- */
- TCPT_RANGESET(tp->t_rxtcur, TCP_REXMTVAL(tp),
- max(tp->t_rttmin, rtt + 2), TCPTV_REXMTMAX);
-
- /*
- * We received an ack for a packet that wasn't retransmitted;
- * it is probably safe to discard any error indications we've
- * received recently. This isn't quite right, but close enough
- * for now (a route might have failed after we sent a segment,
- * and the return path might not be symmetrical).
- */
- tp->t_softerror = 0;
-}
-
-/*
- * Determine a reasonable value for maxseg size.
- * If the route is known, check route for mtu.
- * If none, use an mss that can be handled on the outgoing
- * interface without forcing IP to fragment; if bigger than
- * an mbuf cluster (MCLBYTES), round down to nearest multiple of MCLBYTES
- * to utilize large mbufs. If no route is found, route has no mtu,
- * or the destination isn't local, use a default, hopefully conservative
- * size (usually 512 or the default IP max size, but no more than the mtu
- * of the interface), as we can't discover anything about intervening
- * gateways or networks. We also initialize the congestion/slow start
- * window to be a single segment if the destination isn't local.
- * While looking at the routing entry, we also initialize other path-dependent
- * parameters from pre-set or cached values in the routing entry.
- *
- * Also take into account the space needed for options that we
- * send regularly. Make maxseg shorter by that amount to assure
- * that we can send maxseg amount of data even when the options
- * are present. Store the upper limit of the length of options plus
- * data in maxopd.
- *
- *
- * In case of T/TCP, we call this routine during implicit connection
- * setup as well (offer = -1), to initialize maxseg from the cached
- * MSS of our peer.
- *
- * NOTE that this routine is only called when we process an incoming
- * segment. Outgoing SYN/ACK MSS settings are handled in tcp_mssopt().
- */
-void
-tcp_mss(tp, offer)
- struct tcpcb *tp;
- int offer;
-{
- int rtt, mss;
- u_long bufsize;
- u_long maxmtu;
- struct inpcb *inp = tp->t_inpcb;
- struct socket *so;
- struct hc_metrics_lite metrics;
- int origoffer = offer;
-#ifdef INET6
- int isipv6 = ((inp->inp_vflag & INP_IPV6) != 0) ? 1 : 0;
- size_t min_protoh = isipv6 ?
- sizeof (struct ip6_hdr) + sizeof (struct tcphdr) :
- sizeof (struct tcpiphdr);
-#else
- const size_t min_protoh = sizeof(struct tcpiphdr);
-#endif
-
- /* initialize */
-#ifdef INET6
- if (isipv6) {
- maxmtu = tcp_maxmtu6(&inp->inp_inc);
- tp->t_maxopd = tp->t_maxseg = tcp_v6mssdflt;
- } else
-#endif
- {
- maxmtu = tcp_maxmtu(&inp->inp_inc);
- tp->t_maxopd = tp->t_maxseg = tcp_mssdflt;
- }
- so = inp->inp_socket;
-
- /*
- * no route to sender, stay with default mss and return
- */
- if (maxmtu == 0)
- return;
-
- /* what have we got? */
- switch (offer) {
- case 0:
- /*
- * Offer == 0 means that there was no MSS on the SYN
- * segment, in this case we use tcp_mssdflt.
- */
- offer =
-#ifdef INET6
- isipv6 ? tcp_v6mssdflt :
-#endif
- tcp_mssdflt;
- break;
-
- case -1:
- /*
- * Offer == -1 means that we didn't receive SYN yet.
- */
- /* FALLTHROUGH */
-
- default:
- /*
- * Prevent DoS attack with too small MSS. Round up
- * to at least minmss.
- */
- offer = max(offer, tcp_minmss);
- /*
- * Sanity check: make sure that maxopd will be large
- * enough to allow some data on segments even if the
- * all the option space is used (40bytes). Otherwise
- * funny things may happen in tcp_output.
- */
- offer = max(offer, 64);
- }
-
- /*
- * rmx information is now retrieved from tcp_hostcache
- */
- tcp_hc_get(&inp->inp_inc, &metrics);
-
- /*
- * if there's a discovered mtu int tcp hostcache, use it
- * else, use the link mtu.
- */
- if (metrics.rmx_mtu)
- mss = min(metrics.rmx_mtu, maxmtu) - min_protoh;
- else {
-#ifdef INET6
- if (isipv6) {
- mss = maxmtu - min_protoh;
- if (!path_mtu_discovery &&
- !in6_localaddr(&inp->in6p_faddr))
- mss = min(mss, tcp_v6mssdflt);
- } else
-#endif
- {
- mss = maxmtu - min_protoh;
- if (!path_mtu_discovery &&
- !in_localaddr(inp->inp_faddr))
- mss = min(mss, tcp_mssdflt);
- }
- }
- mss = min(mss, offer);
-
- /*
- * maxopd stores the maximum length of data AND options
- * in a segment; maxseg is the amount of data in a normal
- * segment. We need to store this value (maxopd) apart
- * from maxseg, because now every segment carries options
- * and thus we normally have somewhat less data in segments.
- */
- tp->t_maxopd = mss;
-
- /*
- * origoffer==-1 indicates, that no segments were received yet.
- * In this case we just guess.
- */
- if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP &&
- (origoffer == -1 ||
- (tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP))
- mss -= TCPOLEN_TSTAMP_APPA;
- tp->t_maxseg = mss;
-
-#if (MCLBYTES & (MCLBYTES - 1)) == 0
- if (mss > MCLBYTES)
- mss &= ~(MCLBYTES-1);
-#else
- if (mss > MCLBYTES)
- mss = mss / MCLBYTES * MCLBYTES;
-#endif
- tp->t_maxseg = mss;
-
- /*
- * If there's a pipesize, change the socket buffer to that size,
- * don't change if sb_hiwat is different than default (then it
- * has been changed on purpose with setsockopt).
- * Make the socket buffers an integral number of mss units;
- * if the mss is larger than the socket buffer, decrease the mss.
- */
- SOCKBUF_LOCK(&so->so_snd);
- if ((so->so_snd.sb_hiwat == tcp_sendspace) && metrics.rmx_sendpipe)
- bufsize = metrics.rmx_sendpipe;
- else
- bufsize = so->so_snd.sb_hiwat;
- if (bufsize < mss)
- mss = bufsize;
- else {
- bufsize = roundup(bufsize, mss);
- if (bufsize > sb_max)
- bufsize = sb_max;
- if (bufsize > so->so_snd.sb_hiwat)
- (void)sbreserve_locked(&so->so_snd, bufsize, so, NULL);
- }
- SOCKBUF_UNLOCK(&so->so_snd);
- tp->t_maxseg = mss;
-
- SOCKBUF_LOCK(&so->so_rcv);
- if ((so->so_rcv.sb_hiwat == tcp_recvspace) && metrics.rmx_recvpipe)
- bufsize = metrics.rmx_recvpipe;
- else
- bufsize = so->so_rcv.sb_hiwat;
- if (bufsize > mss) {
- bufsize = roundup(bufsize, mss);
- if (bufsize > sb_max)
- bufsize = sb_max;
- if (bufsize > so->so_rcv.sb_hiwat)
- (void)sbreserve_locked(&so->so_rcv, bufsize, so, NULL);
- }
- SOCKBUF_UNLOCK(&so->so_rcv);
- /*
- * While we're here, check the others too
- */
- if (tp->t_srtt == 0 && (rtt = metrics.rmx_rtt)) {
- tp->t_srtt = rtt;
- tp->t_rttbest = tp->t_srtt + TCP_RTT_SCALE;
- tcpstat.tcps_usedrtt++;
- if (metrics.rmx_rttvar) {
- tp->t_rttvar = metrics.rmx_rttvar;
- tcpstat.tcps_usedrttvar++;
- } else {
- /* default variation is +- 1 rtt */
- tp->t_rttvar =
- tp->t_srtt * TCP_RTTVAR_SCALE / TCP_RTT_SCALE;
- }
- TCPT_RANGESET(tp->t_rxtcur,
- ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1,
- tp->t_rttmin, TCPTV_REXMTMAX);
- }
- if (metrics.rmx_ssthresh) {
- /*
- * There's some sort of gateway or interface
- * buffer limit on the path. Use this to set
- * the slow start threshhold, but set the
- * threshold to no less than 2*mss.
- */
- tp->snd_ssthresh = max(2 * mss, metrics.rmx_ssthresh);
- tcpstat.tcps_usedssthresh++;
- }
- if (metrics.rmx_bandwidth)
- tp->snd_bandwidth = metrics.rmx_bandwidth;
-
- /*
- * Set the slow-start flight size depending on whether this
- * is a local network or not.
- *
- * Extend this so we cache the cwnd too and retrieve it here.
- * Make cwnd even bigger than RFC3390 suggests but only if we
- * have previous experience with the remote host. Be careful
- * not make cwnd bigger than remote receive window or our own
- * send socket buffer. Maybe put some additional upper bound
- * on the retrieved cwnd. Should do incremental updates to
- * hostcache when cwnd collapses so next connection doesn't
- * overloads the path again.
- *
- * RFC3390 says only do this if SYN or SYN/ACK didn't got lost.
- * We currently check only in syncache_socket for that.
- */
-#define TCP_METRICS_CWND
-#ifdef TCP_METRICS_CWND
- if (metrics.rmx_cwnd)
- tp->snd_cwnd = max(mss,
- min(metrics.rmx_cwnd / 2,
- min(tp->snd_wnd, so->so_snd.sb_hiwat)));
- else
-#endif
- if (tcp_do_rfc3390)
- tp->snd_cwnd = min(4 * mss, max(2 * mss, 4380));
-#ifdef INET6
- else if ((isipv6 && in6_localaddr(&inp->in6p_faddr)) ||
- (!isipv6 && in_localaddr(inp->inp_faddr)))
-#else
- else if (in_localaddr(inp->inp_faddr))
-#endif
- tp->snd_cwnd = mss * ss_fltsz_local;
- else
- tp->snd_cwnd = mss * ss_fltsz;
-}
-
-/*
- * Determine the MSS option to send on an outgoing SYN.
- */
-int
-tcp_mssopt(inc)
- struct in_conninfo *inc;
-{
- int mss = 0;
- u_long maxmtu = 0;
- u_long thcmtu = 0;
- size_t min_protoh;
-#ifdef INET6
- int isipv6 = inc->inc_isipv6 ? 1 : 0;
-#endif
-
- KASSERT(inc != NULL, ("tcp_mssopt with NULL in_conninfo pointer"));
-
-#ifdef INET6
- if (isipv6) {
- mss = tcp_v6mssdflt;
- maxmtu = tcp_maxmtu6(inc);
- thcmtu = tcp_hc_getmtu(inc); /* IPv4 and IPv6 */
- min_protoh = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
- } else
-#endif
- {
- mss = tcp_mssdflt;
- maxmtu = tcp_maxmtu(inc);
- thcmtu = tcp_hc_getmtu(inc); /* IPv4 and IPv6 */
- min_protoh = sizeof(struct tcpiphdr);
- }
- if (maxmtu && thcmtu)
- mss = min(maxmtu, thcmtu) - min_protoh;
- else if (maxmtu || thcmtu)
- mss = max(maxmtu, thcmtu) - min_protoh;
-
- return (mss);
-}
-
-
-/*
- * On a partial ack arrives, force the retransmission of the
- * next unacknowledged segment. Do not clear tp->t_dupacks.
- * By setting snd_nxt to ti_ack, this forces retransmission timer to
- * be started again.
- */
-static void
-tcp_newreno_partial_ack(tp, th)
- struct tcpcb *tp;
- struct tcphdr *th;
-{
- tcp_seq onxt = tp->snd_nxt;
- u_long ocwnd = tp->snd_cwnd;
-
- callout_stop(tp->tt_rexmt);
- tp->t_rtttime = 0;
- tp->snd_nxt = th->th_ack;
- /*
- * Set snd_cwnd to one segment beyond acknowledged offset.
- * (tp->snd_una has not yet been updated when this function is called.)
- */
- tp->snd_cwnd = tp->t_maxseg + (th->th_ack - tp->snd_una);
- tp->t_flags |= TF_ACKNOW;
- (void) tcp_output(tp);
- tp->snd_cwnd = ocwnd;
- if (SEQ_GT(onxt, tp->snd_nxt))
- tp->snd_nxt = onxt;
- /*
- * Partial window deflation. Relies on fact that tp->snd_una
- * not updated yet.
- */
- if (tp->snd_cwnd > th->th_ack - tp->snd_una)
- tp->snd_cwnd -= th->th_ack - tp->snd_una;
- else
- tp->snd_cwnd = 0;
- tp->snd_cwnd += tp->t_maxseg;
-}
-
-/*
- * Returns 1 if the TIME_WAIT state was killed and we should start over,
- * looking for a pcb in the listen state. Returns 0 otherwise.
- */
-static int
-tcp_timewait(tw, to, th, m, tlen)
- struct tcptw *tw;
- struct tcpopt *to;
- struct tcphdr *th;
- struct mbuf *m;
- int tlen;
-{
- int thflags;
- tcp_seq seq;
-#ifdef INET6
- int isipv6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0;
-#else
- const int isipv6 = 0;
-#endif
-
- /* tcbinfo lock required for tcp_twclose(), tcp_2msl_reset. */
- INP_INFO_WLOCK_ASSERT(&tcbinfo);
- INP_LOCK_ASSERT(tw->tw_inpcb);
-
- thflags = th->th_flags;
-
- /*
- * NOTE: for FIN_WAIT_2 (to be added later),
- * must validate sequence number before accepting RST
- */
-
- /*
- * If the segment contains RST:
- * Drop the segment - see Stevens, vol. 2, p. 964 and
- * RFC 1337.
- */
- if (thflags & TH_RST)
- goto drop;
-
-#if 0
-/* PAWS not needed at the moment */
- /*
- * RFC 1323 PAWS: If we have a timestamp reply on this segment
- * and it's less than ts_recent, drop it.
- */
- if ((to.to_flags & TOF_TS) != 0 && tp->ts_recent &&
- TSTMP_LT(to.to_tsval, tp->ts_recent)) {
- if ((thflags & TH_ACK) == 0)
- goto drop;
- goto ack;
- }
- /*
- * ts_recent is never updated because we never accept new segments.
- */
-#endif
-
- /*
- * If a new connection request is received
- * while in TIME_WAIT, drop the old connection
- * and start over if the sequence numbers
- * are above the previous ones.
- */
- if ((thflags & TH_SYN) && SEQ_GT(th->th_seq, tw->rcv_nxt)) {
- (void) tcp_twclose(tw, 0);
- return (1);
- }
-
- /*
- * Drop the the segment if it does not contain an ACK.
- */
- if ((thflags & TH_ACK) == 0)
- goto drop;
-
- /*
- * Reset the 2MSL timer if this is a duplicate FIN.
- */
- if (thflags & TH_FIN) {
- seq = th->th_seq + tlen + (thflags & TH_SYN ? 1 : 0);
- if (seq + 1 == tw->rcv_nxt)
- tcp_timer_2msl_reset(tw, 2 * tcp_msl);
- }
-
- /*
- * Acknowledge the segment if it has data or is not a duplicate ACK.
- */
- if (thflags != TH_ACK || tlen != 0 ||
- th->th_seq != tw->rcv_nxt || th->th_ack != tw->snd_nxt)
- tcp_twrespond(tw, TH_ACK);
- goto drop;
-
- /*
- * Generate a RST, dropping incoming segment.
- * Make ACK acceptable to originator of segment.
- * Don't bother to respond if destination was broadcast/multicast.
- */
- if (m->m_flags & (M_BCAST|M_MCAST))
- goto drop;
- if (isipv6) {
- struct ip6_hdr *ip6;
-
- /* IPv6 anycast check is done at tcp6_input() */
- ip6 = mtod(m, struct ip6_hdr *);
- if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
- IN6_IS_ADDR_MULTICAST(&ip6->ip6_src))
- goto drop;
- } else {
- struct ip *ip;
-
- ip = mtod(m, struct ip *);
- if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) ||
- IN_MULTICAST(ntohl(ip->ip_src.s_addr)) ||
- ip->ip_src.s_addr == htonl(INADDR_BROADCAST) ||
- in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif))
- goto drop;
- }
- if (thflags & TH_ACK) {
- tcp_respond(NULL,
- mtod(m, void *), th, m, 0, th->th_ack, TH_RST);
- } else {
- seq = th->th_seq + (thflags & TH_SYN ? 1 : 0);
- tcp_respond(NULL,
- mtod(m, void *), th, m, seq, 0, TH_RST|TH_ACK);
- }
- INP_UNLOCK(tw->tw_inpcb);
- return (0);
-
-drop:
- INP_UNLOCK(tw->tw_inpcb);
- m_freem(m);
- return (0);
-}
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
deleted file mode 100644
index 8376b07..0000000
--- a/sys/netinet/tcp_timewait.c
+++ /dev/null
@@ -1,2254 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
- * 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
- * $FreeBSD$
- */
-
-#include "opt_compat.h"
-#include "opt_inet.h"
-#include "opt_inet6.h"
-#include "opt_ipsec.h"
-#include "opt_mac.h"
-#include "opt_tcpdebug.h"
-#include "opt_tcp_sack.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/callout.h>
-#include <sys/kernel.h>
-#include <sys/sysctl.h>
-#include <sys/mac.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#ifdef INET6
-#include <sys/domain.h>
-#endif
-#include <sys/proc.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/protosw.h>
-#include <sys/random.h>
-
-#include <vm/uma.h>
-
-#include <net/route.h>
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
-#include <netinet/in_pcb.h>
-#ifdef INET6
-#include <netinet6/in6_pcb.h>
-#endif
-#include <netinet/in_var.h>
-#include <netinet/ip_var.h>
-#ifdef INET6
-#include <netinet6/ip6_var.h>
-#include <netinet6/nd6.h>
-#endif
-#include <netinet/ip_icmp.h>
-#include <netinet/tcp.h>
-#include <netinet/tcp_fsm.h>
-#include <netinet/tcp_seq.h>
-#include <netinet/tcp_timer.h>
-#include <netinet/tcp_var.h>
-#ifdef INET6
-#include <netinet6/tcp6_var.h>
-#endif
-#include <netinet/tcpip.h>
-#ifdef TCPDEBUG
-#include <netinet/tcp_debug.h>
-#endif
-#include <netinet6/ip6protosw.h>
-
-#ifdef IPSEC
-#include <netinet6/ipsec.h>
-#ifdef INET6
-#include <netinet6/ipsec6.h>
-#endif
-#include <netkey/key.h>
-#endif /*IPSEC*/
-
-#ifdef FAST_IPSEC
-#include <netipsec/ipsec.h>
-#include <netipsec/xform.h>
-#ifdef INET6
-#include <netipsec/ipsec6.h>
-#endif
-#include <netipsec/key.h>
-#define IPSEC
-#endif /*FAST_IPSEC*/
-
-#include <machine/in_cksum.h>
-#include <sys/md5.h>
-
-int tcp_mssdflt = TCP_MSS;
-SYSCTL_INT(_net_inet_tcp, TCPCTL_MSSDFLT, mssdflt, CTLFLAG_RW,
- &tcp_mssdflt , 0, "Default TCP Maximum Segment Size");
-
-#ifdef INET6
-int tcp_v6mssdflt = TCP6_MSS;
-SYSCTL_INT(_net_inet_tcp, TCPCTL_V6MSSDFLT, v6mssdflt,
- CTLFLAG_RW, &tcp_v6mssdflt , 0,
- "Default TCP Maximum Segment Size for IPv6");
-#endif
-
-/*
- * Minimum MSS we accept and use. This prevents DoS attacks where
- * we are forced to a ridiculous low MSS like 20 and send hundreds
- * of packets instead of one. The effect scales with the available
- * bandwidth and quickly saturates the CPU and network interface
- * with packet generation and sending. Set to zero to disable MINMSS
- * checking. This setting prevents us from sending too small packets.
- */
-int tcp_minmss = TCP_MINMSS;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, minmss, CTLFLAG_RW,
- &tcp_minmss , 0, "Minmum TCP Maximum Segment Size");
-/*
- * Number of TCP segments per second we accept from remote host
- * before we start to calculate average segment size. If average
- * segment size drops below the minimum TCP MSS we assume a DoS
- * attack and reset+drop the connection. Care has to be taken not to
- * set this value too small to not kill interactive type connections
- * (telnet, SSH) which send many small packets.
- */
-int tcp_minmssoverload = TCP_MINMSSOVERLOAD;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, minmssoverload, CTLFLAG_RW,
- &tcp_minmssoverload , 0, "Number of TCP Segments per Second allowed to"
- "be under the MINMSS Size");
-
-#if 0
-static int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ;
-SYSCTL_INT(_net_inet_tcp, TCPCTL_RTTDFLT, rttdflt, CTLFLAG_RW,
- &tcp_rttdflt , 0, "Default maximum TCP Round Trip Time");
-#endif
-
-int tcp_do_rfc1323 = 1;
-SYSCTL_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_RW,
- &tcp_do_rfc1323 , 0, "Enable rfc1323 (high performance TCP) extensions");
-
-static int tcp_tcbhashsize = 0;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcbhashsize, CTLFLAG_RDTUN,
- &tcp_tcbhashsize, 0, "Size of TCP control-block hashtable");
-
-static int do_tcpdrain = 1;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_tcpdrain, CTLFLAG_RW, &do_tcpdrain, 0,
- "Enable tcp_drain routine for extra help when low on mbufs");
-
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, pcbcount, CTLFLAG_RD,
- &tcbinfo.ipi_count, 0, "Number of active PCBs");
-
-static int icmp_may_rst = 1;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, icmp_may_rst, CTLFLAG_RW, &icmp_may_rst, 0,
- "Certain ICMP unreachable messages may abort connections in SYN_SENT");
-
-static int tcp_isn_reseed_interval = 0;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, isn_reseed_interval, CTLFLAG_RW,
- &tcp_isn_reseed_interval, 0, "Seconds between reseeding of ISN secret");
-
-/*
- * TCP bandwidth limiting sysctls. Note that the default lower bound of
- * 1024 exists only for debugging. A good production default would be
- * something like 6100.
- */
-SYSCTL_NODE(_net_inet_tcp, OID_AUTO, inflight, CTLFLAG_RW, 0,
- "TCP inflight data limiting");
-
-static int tcp_inflight_enable = 1;
-SYSCTL_INT(_net_inet_tcp_inflight, OID_AUTO, enable, CTLFLAG_RW,
- &tcp_inflight_enable, 0, "Enable automatic TCP inflight data limiting");
-
-static int tcp_inflight_debug = 0;
-SYSCTL_INT(_net_inet_tcp_inflight, OID_AUTO, debug, CTLFLAG_RW,
- &tcp_inflight_debug, 0, "Debug TCP inflight calculations");
-
-static int tcp_inflight_min = 6144;
-SYSCTL_INT(_net_inet_tcp_inflight, OID_AUTO, min, CTLFLAG_RW,
- &tcp_inflight_min, 0, "Lower-bound for TCP inflight window");
-
-static int tcp_inflight_max = TCP_MAXWIN << TCP_MAX_WINSHIFT;
-SYSCTL_INT(_net_inet_tcp_inflight, OID_AUTO, max, CTLFLAG_RW,
- &tcp_inflight_max, 0, "Upper-bound for TCP inflight window");
-
-static int tcp_inflight_stab = 20;
-SYSCTL_INT(_net_inet_tcp_inflight, OID_AUTO, stab, CTLFLAG_RW,
- &tcp_inflight_stab, 0, "Inflight Algorithm Stabilization 20 = 2 packets");
-
-uma_zone_t sack_hole_zone;
-
-static struct inpcb *tcp_notify(struct inpcb *, int);
-static void tcp_discardcb(struct tcpcb *);
-static void tcp_isn_tick(void *);
-
-/*
- * Target size of TCP PCB hash tables. Must be a power of two.
- *
- * Note that this can be overridden by the kernel environment
- * variable net.inet.tcp.tcbhashsize
- */
-#ifndef TCBHASHSIZE
-#define TCBHASHSIZE 512
-#endif
-
-/*
- * XXX
- * Callouts should be moved into struct tcp directly. They are currently
- * separate because the tcpcb structure is exported to userland for sysctl
- * parsing purposes, which do not know about callouts.
- */
-struct tcpcb_mem {
- struct tcpcb tcb;
- struct callout tcpcb_mem_rexmt, tcpcb_mem_persist, tcpcb_mem_keep;
- struct callout tcpcb_mem_2msl, tcpcb_mem_delack;
-};
-
-static uma_zone_t tcpcb_zone;
-static uma_zone_t tcptw_zone;
-struct callout isn_callout;
-
-/*
- * Tcp initialization
- */
-void
-tcp_init()
-{
- int hashsize = TCBHASHSIZE;
-
- tcp_delacktime = TCPTV_DELACK;
- tcp_keepinit = TCPTV_KEEP_INIT;
- tcp_keepidle = TCPTV_KEEP_IDLE;
- tcp_keepintvl = TCPTV_KEEPINTVL;
- tcp_maxpersistidle = TCPTV_KEEP_IDLE;
- tcp_msl = TCPTV_MSL;
- tcp_rexmit_min = TCPTV_MIN;
- tcp_rexmit_slop = TCPTV_CPU_VAR;
-
- INP_INFO_LOCK_INIT(&tcbinfo, "tcp");
- LIST_INIT(&tcb);
- tcbinfo.listhead = &tcb;
- TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize);
- if (!powerof2(hashsize)) {
- printf("WARNING: TCB hash size not a power of 2\n");
- hashsize = 512; /* safe default */
- }
- tcp_tcbhashsize = hashsize;
- tcbinfo.hashbase = hashinit(hashsize, M_PCB, &tcbinfo.hashmask);
- tcbinfo.porthashbase = hashinit(hashsize, M_PCB,
- &tcbinfo.porthashmask);
- tcbinfo.ipi_zone = uma_zcreate("inpcb", sizeof(struct inpcb),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
- uma_zone_set_max(tcbinfo.ipi_zone, maxsockets);
-#ifdef INET6
-#define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr))
-#else /* INET6 */
-#define TCP_MINPROTOHDR (sizeof(struct tcpiphdr))
-#endif /* INET6 */
- if (max_protohdr < TCP_MINPROTOHDR)
- max_protohdr = TCP_MINPROTOHDR;
- if (max_linkhdr + TCP_MINPROTOHDR > MHLEN)
- panic("tcp_init");
-#undef TCP_MINPROTOHDR
- /*
- * These have to be type stable for the benefit of the timers.
- */
- tcpcb_zone = uma_zcreate("tcpcb", sizeof(struct tcpcb_mem),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
- uma_zone_set_max(tcpcb_zone, maxsockets);
- tcptw_zone = uma_zcreate("tcptw", sizeof(struct tcptw),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
- uma_zone_set_max(tcptw_zone, maxsockets / 5);
- tcp_timer_init();
- syncache_init();
- tcp_hc_init();
- tcp_reass_init();
- callout_init(&isn_callout, CALLOUT_MPSAFE);
- tcp_isn_tick(NULL);
- EVENTHANDLER_REGISTER(shutdown_pre_sync, tcp_fini, NULL,
- SHUTDOWN_PRI_DEFAULT);
- sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
-}
-
-void
-tcp_fini(xtp)
- void *xtp;
-{
- callout_stop(&isn_callout);
-
-}
-
-/*
- * Fill in the IP and TCP headers for an outgoing packet, given the tcpcb.
- * tcp_template used to store this data in mbufs, but we now recopy it out
- * of the tcpcb each time to conserve mbufs.
- */
-void
-tcpip_fillheaders(inp, ip_ptr, tcp_ptr)
- struct inpcb *inp;
- void *ip_ptr;
- void *tcp_ptr;
-{
- struct tcphdr *th = (struct tcphdr *)tcp_ptr;
-
- INP_LOCK_ASSERT(inp);
-
-#ifdef INET6
- if ((inp->inp_vflag & INP_IPV6) != 0) {
- struct ip6_hdr *ip6;
-
- ip6 = (struct ip6_hdr *)ip_ptr;
- ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) |
- (inp->in6p_flowinfo & IPV6_FLOWINFO_MASK);
- ip6->ip6_vfc = (ip6->ip6_vfc & ~IPV6_VERSION_MASK) |
- (IPV6_VERSION & IPV6_VERSION_MASK);
- ip6->ip6_nxt = IPPROTO_TCP;
- ip6->ip6_plen = sizeof(struct tcphdr);
- ip6->ip6_src = inp->in6p_laddr;
- ip6->ip6_dst = inp->in6p_faddr;
- } else
-#endif
- {
- struct ip *ip;
-
- ip = (struct ip *)ip_ptr;
- ip->ip_v = IPVERSION;
- ip->ip_hl = 5;
- ip->ip_tos = inp->inp_ip_tos;
- ip->ip_len = 0;
- ip->ip_id = 0;
- ip->ip_off = 0;
- ip->ip_ttl = inp->inp_ip_ttl;
- ip->ip_sum = 0;
- ip->ip_p = IPPROTO_TCP;
- ip->ip_src = inp->inp_laddr;
- ip->ip_dst = inp->inp_faddr;
- }
- th->th_sport = inp->inp_lport;
- th->th_dport = inp->inp_fport;
- th->th_seq = 0;
- th->th_ack = 0;
- th->th_x2 = 0;
- th->th_off = 5;
- th->th_flags = 0;
- th->th_win = 0;
- th->th_urp = 0;
- th->th_sum = 0; /* in_pseudo() is called later for ipv4 */
-}
-
-/*
- * Create template to be used to send tcp packets on a connection.
- * Allocates an mbuf and fills in a skeletal tcp/ip header. The only
- * use for this function is in keepalives, which use tcp_respond.
- */
-struct tcptemp *
-tcpip_maketemplate(inp)
- struct inpcb *inp;
-{
- struct mbuf *m;
- struct tcptemp *n;
-
- m = m_get(M_DONTWAIT, MT_HEADER);
- if (m == NULL)
- return (0);
- m->m_len = sizeof(struct tcptemp);
- n = mtod(m, struct tcptemp *);
-
- tcpip_fillheaders(inp, (void *)&n->tt_ipgen, (void *)&n->tt_t);
- return (n);
-}
-
-/*
- * Send a single message to the TCP at address specified by
- * the given TCP/IP header. If m == NULL, then we make a copy
- * of the tcpiphdr at ti and send directly to the addressed host.
- * This is used to force keep alive messages out using the TCP
- * template for a connection. If flags are given then we send
- * a message back to the TCP which originated the * segment ti,
- * and discard the mbuf containing it and any other attached mbufs.
- *
- * In any case the ack and sequence number of the transmitted
- * segment are as specified by the parameters.
- *
- * NOTE: If m != NULL, then ti must point to *inside* the mbuf.
- */
-void
-tcp_respond(tp, ipgen, th, m, ack, seq, flags)
- struct tcpcb *tp;
- void *ipgen;
- register struct tcphdr *th;
- register struct mbuf *m;
- tcp_seq ack, seq;
- int flags;
-{
- register int tlen;
- int win = 0;
- struct ip *ip;
- struct tcphdr *nth;
-#ifdef INET6
- struct ip6_hdr *ip6;
- int isipv6;
-#endif /* INET6 */
- int ipflags = 0;
- struct inpcb *inp;
-
- KASSERT(tp != NULL || m != NULL, ("tcp_respond: tp and m both NULL"));
-
-#ifdef INET6
- isipv6 = ((struct ip *)ipgen)->ip_v == 6;
- ip6 = ipgen;
-#endif /* INET6 */
- ip = ipgen;
-
- if (tp != NULL) {
- inp = tp->t_inpcb;
- KASSERT(inp != NULL, ("tcp control block w/o inpcb"));
- INP_INFO_WLOCK_ASSERT(&tcbinfo);
- INP_LOCK_ASSERT(inp);
- } else
- inp = NULL;
-
- if (tp != NULL) {
- if (!(flags & TH_RST)) {
- win = sbspace(&inp->inp_socket->so_rcv);
- if (win > (long)TCP_MAXWIN << tp->rcv_scale)
- win = (long)TCP_MAXWIN << tp->rcv_scale;
- }
- }
- if (m == NULL) {
- m = m_gethdr(M_DONTWAIT, MT_HEADER);
- if (m == NULL)
- return;
- tlen = 0;
- m->m_data += max_linkhdr;
-#ifdef INET6
- if (isipv6) {
- bcopy((caddr_t)ip6, mtod(m, caddr_t),
- sizeof(struct ip6_hdr));
- ip6 = mtod(m, struct ip6_hdr *);
- nth = (struct tcphdr *)(ip6 + 1);
- } else
-#endif /* INET6 */
- {
- bcopy((caddr_t)ip, mtod(m, caddr_t), sizeof(struct ip));
- ip = mtod(m, struct ip *);
- nth = (struct tcphdr *)(ip + 1);
- }
- bcopy((caddr_t)th, (caddr_t)nth, sizeof(struct tcphdr));
- flags = TH_ACK;
- } else {
- m_freem(m->m_next);
- m->m_next = NULL;
- m->m_data = (caddr_t)ipgen;
- /* m_len is set later */
- tlen = 0;
-#define xchg(a,b,type) { type t; t=a; a=b; b=t; }
-#ifdef INET6
- if (isipv6) {
- xchg(ip6->ip6_dst, ip6->ip6_src, struct in6_addr);
- nth = (struct tcphdr *)(ip6 + 1);
- } else
-#endif /* INET6 */
- {
- xchg(ip->ip_dst.s_addr, ip->ip_src.s_addr, n_long);
- nth = (struct tcphdr *)(ip + 1);
- }
- if (th != nth) {
- /*
- * this is usually a case when an extension header
- * exists between the IPv6 header and the
- * TCP header.
- */
- nth->th_sport = th->th_sport;
- nth->th_dport = th->th_dport;
- }
- xchg(nth->th_dport, nth->th_sport, n_short);
-#undef xchg
- }
-#ifdef INET6
- if (isipv6) {
- ip6->ip6_flow = 0;
- ip6->ip6_vfc = IPV6_VERSION;
- ip6->ip6_nxt = IPPROTO_TCP;
- ip6->ip6_plen = htons((u_short)(sizeof (struct tcphdr) +
- tlen));
- tlen += sizeof (struct ip6_hdr) + sizeof (struct tcphdr);
- } else
-#endif
- {
- tlen += sizeof (struct tcpiphdr);
- ip->ip_len = tlen;
- ip->ip_ttl = ip_defttl;
- if (path_mtu_discovery)
- ip->ip_off |= IP_DF;
- }
- m->m_len = tlen;
- m->m_pkthdr.len = tlen;
- m->m_pkthdr.rcvif = NULL;
-#ifdef MAC
- if (inp != NULL) {
- /*
- * Packet is associated with a socket, so allow the
- * label of the response to reflect the socket label.
- */
- INP_LOCK_ASSERT(inp);
- mac_create_mbuf_from_inpcb(inp, m);
- } else {
- /*
- * Packet is not associated with a socket, so possibly
- * update the label in place.
- */
- mac_reflect_mbuf_tcp(m);
- }
-#endif
- nth->th_seq = htonl(seq);
- nth->th_ack = htonl(ack);
- nth->th_x2 = 0;
- nth->th_off = sizeof (struct tcphdr) >> 2;
- nth->th_flags = flags;
- if (tp != NULL)
- nth->th_win = htons((u_short) (win >> tp->rcv_scale));
- else
- nth->th_win = htons((u_short)win);
- nth->th_urp = 0;
-#ifdef INET6
- if (isipv6) {
- nth->th_sum = 0;
- nth->th_sum = in6_cksum(m, IPPROTO_TCP,
- sizeof(struct ip6_hdr),
- tlen - sizeof(struct ip6_hdr));
- ip6->ip6_hlim = in6_selecthlim(tp != NULL ? tp->t_inpcb :
- NULL, NULL);
- } else
-#endif /* INET6 */
- {
- nth->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
- htons((u_short)(tlen - sizeof(struct ip) + ip->ip_p)));
- m->m_pkthdr.csum_flags = CSUM_TCP;
- m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
- }
-#ifdef TCPDEBUG
- if (tp == NULL || (inp->inp_socket->so_options & SO_DEBUG))
- tcp_trace(TA_OUTPUT, 0, tp, mtod(m, void *), th, 0);
-#endif
-#ifdef INET6
- if (isipv6)
- (void) ip6_output(m, NULL, NULL, ipflags, NULL, NULL, inp);
- else
-#endif /* INET6 */
- (void) ip_output(m, NULL, NULL, ipflags, NULL, inp);
-}
-
-/*
- * Create a new TCP control block, making an
- * empty reassembly queue and hooking it to the argument
- * protocol control block. The `inp' parameter must have
- * come from the zone allocator set up in tcp_init().
- */
-struct tcpcb *
-tcp_newtcpcb(inp)
- struct inpcb *inp;
-{
- struct tcpcb_mem *tm;
- struct tcpcb *tp;
-#ifdef INET6
- int isipv6 = (inp->inp_vflag & INP_IPV6) != 0;
-#endif /* INET6 */
-
- tm = uma_zalloc(tcpcb_zone, M_NOWAIT | M_ZERO);
- if (tm == NULL)
- return (NULL);
- tp = &tm->tcb;
- /* LIST_INIT(&tp->t_segq); */ /* XXX covered by M_ZERO */
- tp->t_maxseg = tp->t_maxopd =
-#ifdef INET6
- isipv6 ? tcp_v6mssdflt :
-#endif /* INET6 */
- tcp_mssdflt;
-
- /* Set up our timeouts. */
- callout_init(tp->tt_rexmt = &tm->tcpcb_mem_rexmt, NET_CALLOUT_MPSAFE);
- callout_init(tp->tt_persist = &tm->tcpcb_mem_persist, NET_CALLOUT_MPSAFE);
- callout_init(tp->tt_keep = &tm->tcpcb_mem_keep, NET_CALLOUT_MPSAFE);
- callout_init(tp->tt_2msl = &tm->tcpcb_mem_2msl, NET_CALLOUT_MPSAFE);
- callout_init(tp->tt_delack = &tm->tcpcb_mem_delack, NET_CALLOUT_MPSAFE);
-
- if (tcp_do_rfc1323)
- tp->t_flags = (TF_REQ_SCALE|TF_REQ_TSTMP);
- tp->sack_enable = tcp_do_sack;
- TAILQ_INIT(&tp->snd_holes);
- tp->t_inpcb = inp; /* XXX */
- /*
- * Init srtt to TCPTV_SRTTBASE (0), so we can tell that we have no
- * rtt estimate. Set rttvar so that srtt + 4 * rttvar gives
- * reasonable initial retransmit time.
- */
- tp->t_srtt = TCPTV_SRTTBASE;
- tp->t_rttvar = ((TCPTV_RTOBASE - TCPTV_SRTTBASE) << TCP_RTTVAR_SHIFT) / 4;
- tp->t_rttmin = tcp_rexmit_min;
- tp->t_rxtcur = TCPTV_RTOBASE;
- tp->snd_cwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT;
- tp->snd_bwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT;
- tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT;
- tp->t_rcvtime = ticks;
- tp->t_bw_rtttime = ticks;
- /*
- * IPv4 TTL initialization is necessary for an IPv6 socket as well,
- * because the socket may be bound to an IPv6 wildcard address,
- * which may match an IPv4-mapped IPv6 address.
- */
- inp->inp_ip_ttl = ip_defttl;
- inp->inp_ppcb = (caddr_t)tp;
- return (tp); /* XXX */
-}
-
-/*
- * Drop a TCP connection, reporting
- * the specified error. If connection is synchronized,
- * then send a RST to peer.
- */
-struct tcpcb *
-tcp_drop(tp, errno)
- register struct tcpcb *tp;
- int errno;
-{
- struct socket *so = tp->t_inpcb->inp_socket;
-
- INP_INFO_WLOCK_ASSERT(&tcbinfo);
- INP_LOCK_ASSERT(tp->t_inpcb);
-
- if (TCPS_HAVERCVDSYN(tp->t_state)) {
- tp->t_state = TCPS_CLOSED;
- (void) tcp_output(tp);
- tcpstat.tcps_drops++;
- } else
- tcpstat.tcps_conndrops++;
- if (errno == ETIMEDOUT && tp->t_softerror)
- errno = tp->t_softerror;
- so->so_error = errno;
- return (tcp_close(tp));
-}
-
-static void
-tcp_discardcb(tp)
- struct tcpcb *tp;
-{
- struct tseg_qent *q;
- struct inpcb *inp = tp->t_inpcb;
- struct socket *so = inp->inp_socket;
-#ifdef INET6
- int isipv6 = (inp->inp_vflag & INP_IPV6) != 0;
-#endif /* INET6 */
-
- INP_LOCK_ASSERT(inp);
-
- /*
- * Make sure that all of our timers are stopped before we
- * delete the PCB.
- */
- callout_stop(tp->tt_rexmt);
- callout_stop(tp->tt_persist);
- callout_stop(tp->tt_keep);
- callout_stop(tp->tt_2msl);
- callout_stop(tp->tt_delack);
-
- /*
- * If we got enough samples through the srtt filter,
- * save the rtt and rttvar in the routing entry.
- * 'Enough' is arbitrarily defined as 4 rtt samples.
- * 4 samples is enough for the srtt filter to converge
- * to within enough % of the correct value; fewer samples
- * and we could save a bogus rtt. The danger is not high
- * as tcp quickly recovers from everything.
- * XXX: Works very well but needs some more statistics!
- */
- if (tp->t_rttupdated >= 4) {
- struct hc_metrics_lite metrics;
- u_long ssthresh;
-
- bzero(&metrics, sizeof(metrics));
- /*
- * Update the ssthresh always when the conditions below
- * are satisfied. This gives us better new start value
- * for the congestion avoidance for new connections.
- * ssthresh is only set if packet loss occured on a session.
- */
- ssthresh = tp->snd_ssthresh;
- if (ssthresh != 0 && ssthresh < so->so_snd.sb_hiwat / 2) {
- /*
- * convert the limit from user data bytes to
- * packets then to packet data bytes.
- */
- ssthresh = (ssthresh + tp->t_maxseg / 2) / tp->t_maxseg;
- if (ssthresh < 2)
- ssthresh = 2;
- ssthresh *= (u_long)(tp->t_maxseg +
-#ifdef INET6
- (isipv6 ? sizeof (struct ip6_hdr) +
- sizeof (struct tcphdr) :
-#endif
- sizeof (struct tcpiphdr)
-#ifdef INET6
- )
-#endif
- );
- } else
- ssthresh = 0;
- metrics.rmx_ssthresh = ssthresh;
-
- metrics.rmx_rtt = tp->t_srtt;
- metrics.rmx_rttvar = tp->t_rttvar;
- /* XXX: This wraps if the pipe is more than 4 Gbit per second */
- metrics.rmx_bandwidth = tp->snd_bandwidth;
- metrics.rmx_cwnd = tp->snd_cwnd;
- metrics.rmx_sendpipe = 0;
- metrics.rmx_recvpipe = 0;
-
- tcp_hc_update(&inp->inp_inc, &metrics);
- }
-
- /* free the reassembly queue, if any */
- while ((q = LIST_FIRST(&tp->t_segq)) != NULL) {
- LIST_REMOVE(q, tqe_q);
- m_freem(q->tqe_m);
- uma_zfree(tcp_reass_zone, q);
- tp->t_segqlen--;
- tcp_reass_qsize--;
- }
- tcp_free_sackholes(tp);
- inp->inp_ppcb = NULL;
- tp->t_inpcb = NULL;
- uma_zfree(tcpcb_zone, tp);
- soisdisconnected(so);
-}
-
-/*
- * Close a TCP control block:
- * discard all space held by the tcp
- * discard internet protocol block
- * wake up any sleepers
- */
-struct tcpcb *
-tcp_close(tp)
- struct tcpcb *tp;
-{
- struct inpcb *inp = tp->t_inpcb;
-#ifdef INET6
- struct socket *so = inp->inp_socket;
-#endif
-
- INP_INFO_WLOCK_ASSERT(&tcbinfo);
- INP_LOCK_ASSERT(inp);
-
- tcp_discardcb(tp);
-#ifdef INET6
- if (INP_CHECK_SOCKAF(so, AF_INET6))
- in6_pcbdetach(inp);
- else
-#endif
- in_pcbdetach(inp);
- tcpstat.tcps_closed++;
- return (NULL);
-}
-
-void
-tcp_drain()
-{
- if (do_tcpdrain)
- {
- struct inpcb *inpb;
- struct tcpcb *tcpb;
- struct tseg_qent *te;
-
- /*
- * Walk the tcpbs, if existing, and flush the reassembly queue,
- * if there is one...
- * XXX: The "Net/3" implementation doesn't imply that the TCP
- * reassembly queue should be flushed, but in a situation
- * where we're really low on mbufs, this is potentially
- * usefull.
- */
- INP_INFO_RLOCK(&tcbinfo);
- LIST_FOREACH(inpb, tcbinfo.listhead, inp_list) {
- if (inpb->inp_vflag & INP_TIMEWAIT)
- continue;
- INP_LOCK(inpb);
- if ((tcpb = intotcpcb(inpb)) != NULL) {
- while ((te = LIST_FIRST(&tcpb->t_segq))
- != NULL) {
- LIST_REMOVE(te, tqe_q);
- m_freem(te->tqe_m);
- uma_zfree(tcp_reass_zone, te);
- tcpb->t_segqlen--;
- tcp_reass_qsize--;
- }
- tcp_clean_sackreport(tcpb);
- }
- INP_UNLOCK(inpb);
- }
- INP_INFO_RUNLOCK(&tcbinfo);
- }
-}
-
-/*
- * Notify a tcp user of an asynchronous error;
- * store error as soft error, but wake up user
- * (for now, won't do anything until can select for soft error).
- *
- * Do not wake up user since there currently is no mechanism for
- * reporting soft errors (yet - a kqueue filter may be added).
- */
-static struct inpcb *
-tcp_notify(inp, error)
- struct inpcb *inp;
- int error;
-{
- struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb;
-
- INP_INFO_WLOCK_ASSERT(&tcbinfo);
- INP_LOCK_ASSERT(inp);
-
- /*
- * Ignore some errors if we are hooked up.
- * If connection hasn't completed, has retransmitted several times,
- * and receives a second error, give up now. This is better
- * than waiting a long time to establish a connection that
- * can never complete.
- */
- if (tp->t_state == TCPS_ESTABLISHED &&
- (error == EHOSTUNREACH || error == ENETUNREACH ||
- error == EHOSTDOWN)) {
- return (inp);
- } else if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift > 3 &&
- tp->t_softerror) {
- tcp_drop(tp, error);
- return (struct inpcb *)0;
- } else {
- tp->t_softerror = error;
- return (inp);
- }
-#if 0
- wakeup( &so->so_timeo);
- sorwakeup(so);
- sowwakeup(so);
-#endif
-}
-
-static int
-tcp_pcblist(SYSCTL_HANDLER_ARGS)
-{
- int error, i, n, s;
- struct inpcb *inp, **inp_list;
- inp_gen_t gencnt;
- struct xinpgen xig;
-
- /*
- * The process of preparing the TCB list is too time-consuming and
- * resource-intensive to repeat twice on every request.
- */
- if (req->oldptr == NULL) {
- n = tcbinfo.ipi_count;
- req->oldidx = 2 * (sizeof xig)
- + (n + n/8) * sizeof(struct xtcpcb);
- return (0);
- }
-
- if (req->newptr != NULL)
- return (EPERM);
-
- /*
- * OK, now we're committed to doing something.
- */
- s = splnet();
- INP_INFO_RLOCK(&tcbinfo);
- gencnt = tcbinfo.ipi_gencnt;
- n = tcbinfo.ipi_count;
- INP_INFO_RUNLOCK(&tcbinfo);
- splx(s);
-
- error = sysctl_wire_old_buffer(req, 2 * (sizeof xig)
- + n * sizeof(struct xtcpcb));
- if (error != 0)
- return (error);
-
- xig.xig_len = sizeof xig;
- xig.xig_count = n;
- xig.xig_gen = gencnt;
- xig.xig_sogen = so_gencnt;
- error = SYSCTL_OUT(req, &xig, sizeof xig);
- if (error)
- return (error);
-
- inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
- if (inp_list == NULL)
- return (ENOMEM);
-
- s = splnet();
- INP_INFO_RLOCK(&tcbinfo);
- for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp != NULL && i < n;
- inp = LIST_NEXT(inp, inp_list)) {
- INP_LOCK(inp);
- if (inp->inp_gencnt <= gencnt) {
- /*
- * XXX: This use of cr_cansee(), introduced with
- * TCP state changes, is not quite right, but for
- * now, better than nothing.
- */
- if (inp->inp_vflag & INP_TIMEWAIT)
- error = cr_cansee(req->td->td_ucred,
- intotw(inp)->tw_cred);
- else
- error = cr_canseesocket(req->td->td_ucred,
- inp->inp_socket);
- if (error == 0)
- inp_list[i++] = inp;
- }
- INP_UNLOCK(inp);
- }
- INP_INFO_RUNLOCK(&tcbinfo);
- splx(s);
- n = i;
-
- error = 0;
- for (i = 0; i < n; i++) {
- inp = inp_list[i];
- if (inp->inp_gencnt <= gencnt) {
- struct xtcpcb xt;
- caddr_t inp_ppcb;
-
- bzero(&xt, sizeof(xt));
- xt.xt_len = sizeof xt;
- /* XXX should avoid extra copy */
- bcopy(inp, &xt.xt_inp, sizeof *inp);
- inp_ppcb = inp->inp_ppcb;
- if (inp_ppcb == NULL)
- bzero((char *) &xt.xt_tp, sizeof xt.xt_tp);
- else if (inp->inp_vflag & INP_TIMEWAIT) {
- bzero((char *) &xt.xt_tp, sizeof xt.xt_tp);
- xt.xt_tp.t_state = TCPS_TIME_WAIT;
- } else
- bcopy(inp_ppcb, &xt.xt_tp, sizeof xt.xt_tp);
- if (inp->inp_socket != NULL)
- sotoxsocket(inp->inp_socket, &xt.xt_socket);
- else {
- bzero(&xt.xt_socket, sizeof xt.xt_socket);
- xt.xt_socket.xso_protocol = IPPROTO_TCP;
- }
- xt.xt_inp.inp_gencnt = inp->inp_gencnt;
- error = SYSCTL_OUT(req, &xt, sizeof xt);
- }
- }
- if (!error) {
- /*
- * Give the user an updated idea of our state.
- * If the generation differs from what we told
- * her before, she knows that something happened
- * while we were processing this request, and it
- * might be necessary to retry.
- */
- s = splnet();
- INP_INFO_RLOCK(&tcbinfo);
- xig.xig_gen = tcbinfo.ipi_gencnt;
- xig.xig_sogen = so_gencnt;
- xig.xig_count = tcbinfo.ipi_count;
- INP_INFO_RUNLOCK(&tcbinfo);
- splx(s);
- error = SYSCTL_OUT(req, &xig, sizeof xig);
- }
- free(inp_list, M_TEMP);
- return (error);
-}
-
-SYSCTL_PROC(_net_inet_tcp, TCPCTL_PCBLIST, pcblist, CTLFLAG_RD, 0, 0,
- tcp_pcblist, "S,xtcpcb", "List of active TCP connections");
-
-static int
-tcp_getcred(SYSCTL_HANDLER_ARGS)
-{
- struct xucred xuc;
- struct sockaddr_in addrs[2];
- struct inpcb *inp;
- int error, s;
-
- error = suser_cred(req->td->td_ucred, SUSER_ALLOWJAIL);
- if (error)
- return (error);
- error = SYSCTL_IN(req, addrs, sizeof(addrs));
- if (error)
- return (error);
- s = splnet();
- INP_INFO_RLOCK(&tcbinfo);
- inp = in_pcblookup_hash(&tcbinfo, addrs[1].sin_addr, addrs[1].sin_port,
- addrs[0].sin_addr, addrs[0].sin_port, 0, NULL);
- if (inp == NULL) {
- error = ENOENT;
- goto outunlocked;
- }
- INP_LOCK(inp);
- if (inp->inp_socket == NULL) {
- error = ENOENT;
- goto out;
- }
- error = cr_canseesocket(req->td->td_ucred, inp->inp_socket);
- if (error)
- goto out;
- cru2x(inp->inp_socket->so_cred, &xuc);
-out:
- INP_UNLOCK(inp);
-outunlocked:
- INP_INFO_RUNLOCK(&tcbinfo);
- splx(s);
- if (error == 0)
- error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
- return (error);
-}
-
-SYSCTL_PROC(_net_inet_tcp, OID_AUTO, getcred,
- CTLTYPE_OPAQUE|CTLFLAG_RW|CTLFLAG_PRISON, 0, 0,
- tcp_getcred, "S,xucred", "Get the xucred of a TCP connection");
-
-#ifdef INET6
-static int
-tcp6_getcred(SYSCTL_HANDLER_ARGS)
-{
- struct xucred xuc;
- struct sockaddr_in6 addrs[2];
- struct in6_addr a6[2];
- struct inpcb *inp;
- int error, s, mapped = 0;
-
- error = suser_cred(req->td->td_ucred, SUSER_ALLOWJAIL);
- if (error)
- return (error);
- error = SYSCTL_IN(req, addrs, sizeof(addrs));
- if (error)
- return (error);
- if (IN6_IS_ADDR_V4MAPPED(&addrs[0].sin6_addr)) {
- if (IN6_IS_ADDR_V4MAPPED(&addrs[1].sin6_addr))
- mapped = 1;
- else
- return (EINVAL);
- } else {
- error = in6_embedscope(&a6[0], &addrs[0], NULL, NULL);
- if (error)
- return (EINVAL);
- error = in6_embedscope(&a6[1], &addrs[1], NULL, NULL);
- if (error)
- return (EINVAL);
- }
- s = splnet();
- INP_INFO_RLOCK(&tcbinfo);
- if (mapped == 1)
- inp = in_pcblookup_hash(&tcbinfo,
- *(struct in_addr *)&addrs[1].sin6_addr.s6_addr[12],
- addrs[1].sin6_port,
- *(struct in_addr *)&addrs[0].sin6_addr.s6_addr[12],
- addrs[0].sin6_port,
- 0, NULL);
- else
- inp = in6_pcblookup_hash(&tcbinfo, &a6[1], addrs[1].sin6_port,
- &a6[0], addrs[0].sin6_port, 0, NULL);
- if (inp == NULL) {
- error = ENOENT;
- goto outunlocked;
- }
- INP_LOCK(inp);
- if (inp->inp_socket == NULL) {
- error = ENOENT;
- goto out;
- }
- error = cr_canseesocket(req->td->td_ucred, inp->inp_socket);
- if (error)
- goto out;
- cru2x(inp->inp_socket->so_cred, &xuc);
-out:
- INP_UNLOCK(inp);
-outunlocked:
- INP_INFO_RUNLOCK(&tcbinfo);
- splx(s);
- if (error == 0)
- error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
- return (error);
-}
-
-SYSCTL_PROC(_net_inet6_tcp6, OID_AUTO, getcred,
- CTLTYPE_OPAQUE|CTLFLAG_RW|CTLFLAG_PRISON, 0, 0,
- tcp6_getcred, "S,xucred", "Get the xucred of a TCP6 connection");
-#endif
-
-
-void
-tcp_ctlinput(cmd, sa, vip)
- int cmd;
- struct sockaddr *sa;
- void *vip;
-{
- struct ip *ip = vip;
- struct tcphdr *th;
- struct in_addr faddr;
- struct inpcb *inp;
- struct tcpcb *tp;
- struct inpcb *(*notify)(struct inpcb *, int) = tcp_notify;
- struct icmp *icp;
- struct in_conninfo inc;
- tcp_seq icmp_tcp_seq;
- int mtu, s;
-
- faddr = ((struct sockaddr_in *)sa)->sin_addr;
- if (sa->sa_family != AF_INET || faddr.s_addr == INADDR_ANY)
- return;
-
- if (cmd == PRC_MSGSIZE)
- notify = tcp_mtudisc;
- else if (icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB ||
- cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) && ip)
- notify = tcp_drop_syn_sent;
- /*
- * Redirects don't need to be handled up here.
- */
- else if (PRC_IS_REDIRECT(cmd))
- return;
- /*
- * Source quench is depreciated.
- */
- else if (cmd == PRC_QUENCH)
- return;
- /*
- * Hostdead is ugly because it goes linearly through all PCBs.
- * XXX: We never get this from ICMP, otherwise it makes an
- * excellent DoS attack on machines with many connections.
- */
- else if (cmd == PRC_HOSTDEAD)
- ip = NULL;
- else if ((unsigned)cmd >= PRC_NCMDS || inetctlerrmap[cmd] == 0)
- return;
- if (ip != NULL) {
- s = splnet();
- icp = (struct icmp *)((caddr_t)ip
- - offsetof(struct icmp, icmp_ip));
- th = (struct tcphdr *)((caddr_t)ip
- + (ip->ip_hl << 2));
- INP_INFO_WLOCK(&tcbinfo);
- inp = in_pcblookup_hash(&tcbinfo, faddr, th->th_dport,
- ip->ip_src, th->th_sport, 0, NULL);
- if (inp != NULL) {
- INP_LOCK(inp);
- if (inp->inp_socket != NULL) {
- icmp_tcp_seq = htonl(th->th_seq);
- tp = intotcpcb(inp);
- if (SEQ_GEQ(icmp_tcp_seq, tp->snd_una) &&
- SEQ_LT(icmp_tcp_seq, tp->snd_max)) {
- if (cmd == PRC_MSGSIZE) {
- /*
- * MTU discovery:
- * If we got a needfrag set the MTU
- * in the route to the suggested new
- * value (if given) and then notify.
- */
- bzero(&inc, sizeof(inc));
- inc.inc_flags = 0; /* IPv4 */
- inc.inc_faddr = faddr;
-
- mtu = ntohs(icp->icmp_nextmtu);
- /*
- * If no alternative MTU was
- * proposed, try the next smaller
- * one.
- */
- if (!mtu)
- mtu = ip_next_mtu(ntohs(ip->ip_len),
- 1);
- if (mtu < max(296, (tcp_minmss)
- + sizeof(struct tcpiphdr)))
- mtu = 0;
- if (!mtu)
- mtu = tcp_mssdflt
- + sizeof(struct tcpiphdr);
- /*
- * Only cache the the MTU if it
- * is smaller than the interface
- * or route MTU. tcp_mtudisc()
- * will do right thing by itself.
- */
- if (mtu <= tcp_maxmtu(&inc))
- tcp_hc_updatemtu(&inc, mtu);
- }
-
- inp = (*notify)(inp, inetctlerrmap[cmd]);
- }
- }
- if (inp != NULL)
- INP_UNLOCK(inp);
- } else {
- inc.inc_fport = th->th_dport;
- inc.inc_lport = th->th_sport;
- inc.inc_faddr = faddr;
- inc.inc_laddr = ip->ip_src;
-#ifdef INET6
- inc.inc_isipv6 = 0;
-#endif
- syncache_unreach(&inc, th);
- }
- INP_INFO_WUNLOCK(&tcbinfo);
- splx(s);
- } else
- in_pcbnotifyall(&tcbinfo, faddr, inetctlerrmap[cmd], notify);
-}
-
-#ifdef INET6
-void
-tcp6_ctlinput(cmd, sa, d)
- int cmd;
- struct sockaddr *sa;
- void *d;
-{
- struct tcphdr th;
- struct inpcb *(*notify)(struct inpcb *, int) = tcp_notify;
- struct ip6_hdr *ip6;
- struct mbuf *m;
- struct ip6ctlparam *ip6cp = NULL;
- const struct sockaddr_in6 *sa6_src = NULL;
- int off;
- struct tcp_portonly {
- u_int16_t th_sport;
- u_int16_t th_dport;
- } *thp;
-
- if (sa->sa_family != AF_INET6 ||
- sa->sa_len != sizeof(struct sockaddr_in6))
- return;
-
- if (cmd == PRC_MSGSIZE)
- notify = tcp_mtudisc;
- else if (!PRC_IS_REDIRECT(cmd) &&
- ((unsigned)cmd >= PRC_NCMDS || inet6ctlerrmap[cmd] == 0))
- return;
- /* Source quench is depreciated. */
- else if (cmd == PRC_QUENCH)
- return;
-
- /* if the parameter is from icmp6, decode it. */
- if (d != NULL) {
- ip6cp = (struct ip6ctlparam *)d;
- m = ip6cp->ip6c_m;
- ip6 = ip6cp->ip6c_ip6;
- off = ip6cp->ip6c_off;
- sa6_src = ip6cp->ip6c_src;
- } else {
- m = NULL;
- ip6 = NULL;
- off = 0; /* fool gcc */
- sa6_src = &sa6_any;
- }
-
- if (ip6 != NULL) {
- struct in_conninfo inc;
- /*
- * XXX: We assume that when IPV6 is non NULL,
- * M and OFF are valid.
- */
-
- /* check if we can safely examine src and dst ports */
- if (m->m_pkthdr.len < off + sizeof(*thp))
- return;
-
- bzero(&th, sizeof(th));
- m_copydata(m, off, sizeof(*thp), (caddr_t)&th);
-
- in6_pcbnotify(&tcbinfo, sa, th.th_dport,
- (struct sockaddr *)ip6cp->ip6c_src,
- th.th_sport, cmd, NULL, notify);
-
- inc.inc_fport = th.th_dport;
- inc.inc_lport = th.th_sport;
- inc.inc6_faddr = ((struct sockaddr_in6 *)sa)->sin6_addr;
- inc.inc6_laddr = ip6cp->ip6c_src->sin6_addr;
- inc.inc_isipv6 = 1;
- INP_INFO_WLOCK(&tcbinfo);
- syncache_unreach(&inc, &th);
- INP_INFO_WUNLOCK(&tcbinfo);
- } else
- in6_pcbnotify(&tcbinfo, sa, 0, (const struct sockaddr *)sa6_src,
- 0, cmd, NULL, notify);
-}
-#endif /* INET6 */
-
-
-/*
- * Following is where TCP initial sequence number generation occurs.
- *
- * There are two places where we must use initial sequence numbers:
- * 1. In SYN-ACK packets.
- * 2. In SYN packets.
- *
- * All ISNs for SYN-ACK packets are generated by the syncache. See
- * tcp_syncache.c for details.
- *
- * The ISNs in SYN packets must be monotonic; TIME_WAIT recycling
- * depends on this property. In addition, these ISNs should be
- * unguessable so as to prevent connection hijacking. To satisfy
- * the requirements of this situation, the algorithm outlined in
- * RFC 1948 is used, with only small modifications.
- *
- * Implementation details:
- *
- * Time is based off the system timer, and is corrected so that it
- * increases by one megabyte per second. This allows for proper
- * recycling on high speed LANs while still leaving over an hour
- * before rollover.
- *
- * As reading the *exact* system time is too expensive to be done
- * whenever setting up a TCP connection, we increment the time
- * offset in two ways. First, a small random positive increment
- * is added to isn_offset for each connection that is set up.
- * Second, the function tcp_isn_tick fires once per clock tick
- * and increments isn_offset as necessary so that sequence numbers
- * are incremented at approximately ISN_BYTES_PER_SECOND. The
- * random positive increments serve only to ensure that the same
- * exact sequence number is never sent out twice (as could otherwise
- * happen when a port is recycled in less than the system tick
- * interval.)
- *
- * net.inet.tcp.isn_reseed_interval controls the number of seconds
- * between seeding of isn_secret. This is normally set to zero,
- * as reseeding should not be necessary.
- *
- * Locking of the global variables isn_secret, isn_last_reseed, isn_offset,
- * isn_offset_old, and isn_ctx is performed using the TCP pcbinfo lock. In
- * general, this means holding an exclusive (write) lock.
- */
-
-#define ISN_BYTES_PER_SECOND 1048576
-#define ISN_STATIC_INCREMENT 4096
-#define ISN_RANDOM_INCREMENT (4096 - 1)
-
-static u_char isn_secret[32];
-static int isn_last_reseed;
-static u_int32_t isn_offset, isn_offset_old;
-static MD5_CTX isn_ctx;
-
-tcp_seq
-tcp_new_isn(tp)
- struct tcpcb *tp;
-{
- u_int32_t md5_buffer[4];
- tcp_seq new_isn;
-
- INP_INFO_WLOCK_ASSERT(&tcbinfo);
- INP_LOCK_ASSERT(tp->t_inpcb);
-
- /* Seed if this is the first use, reseed if requested. */
- if ((isn_last_reseed == 0) || ((tcp_isn_reseed_interval > 0) &&
- (((u_int)isn_last_reseed + (u_int)tcp_isn_reseed_interval*hz)
- < (u_int)ticks))) {
- read_random(&isn_secret, sizeof(isn_secret));
- isn_last_reseed = ticks;
- }
-
- /* Compute the md5 hash and return the ISN. */
- MD5Init(&isn_ctx);
- MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_fport, sizeof(u_short));
- MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_lport, sizeof(u_short));
-#ifdef INET6
- if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0) {
- MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->in6p_faddr,
- sizeof(struct in6_addr));
- MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->in6p_laddr,
- sizeof(struct in6_addr));
- } else
-#endif
- {
- MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_faddr,
- sizeof(struct in_addr));
- MD5Update(&isn_ctx, (u_char *) &tp->t_inpcb->inp_laddr,
- sizeof(struct in_addr));
- }
- MD5Update(&isn_ctx, (u_char *) &isn_secret, sizeof(isn_secret));
- MD5Final((u_char *) &md5_buffer, &isn_ctx);
- new_isn = (tcp_seq) md5_buffer[0];
- isn_offset += ISN_STATIC_INCREMENT +
- (arc4random() & ISN_RANDOM_INCREMENT);
- new_isn += isn_offset;
- return (new_isn);
-}
-
-/*
- * Increment the offset to the next ISN_BYTES_PER_SECOND / hz boundary
- * to keep time flowing at a relatively constant rate. If the random
- * increments have already pushed us past the projected offset, do nothing.
- */
-static void
-tcp_isn_tick(xtp)
- void *xtp;
-{
- u_int32_t projected_offset;
-
- INP_INFO_WLOCK(&tcbinfo);
- projected_offset = isn_offset_old + ISN_BYTES_PER_SECOND / 100;
-
- if (projected_offset > isn_offset)
- isn_offset = projected_offset;
-
- isn_offset_old = isn_offset;
- callout_reset(&isn_callout, hz/100, tcp_isn_tick, NULL);
- INP_INFO_WUNLOCK(&tcbinfo);
-}
-
-/*
- * When a specific ICMP unreachable message is received and the
- * connection state is SYN-SENT, drop the connection. This behavior
- * is controlled by the icmp_may_rst sysctl.
- */
-struct inpcb *
-tcp_drop_syn_sent(inp, errno)
- struct inpcb *inp;
- int errno;
-{
- struct tcpcb *tp = intotcpcb(inp);
-
- INP_INFO_WLOCK_ASSERT(&tcbinfo);
- INP_LOCK_ASSERT(inp);
-
- if (tp != NULL && tp->t_state == TCPS_SYN_SENT) {
- tcp_drop(tp, errno);
- return (NULL);
- }
- return (inp);
-}
-
-/*
- * When `need fragmentation' ICMP is received, update our idea of the MSS
- * based on the new value in the route. Also nudge TCP to send something,
- * since we know the packet we just sent was dropped.
- * This duplicates some code in the tcp_mss() function in tcp_input.c.
- */
-struct inpcb *
-tcp_mtudisc(inp, errno)
- struct inpcb *inp;
- int errno;
-{
- struct tcpcb *tp = intotcpcb(inp);
- struct socket *so = inp->inp_socket;
- u_int maxmtu;
- u_int romtu;
- int mss;
-#ifdef INET6
- int isipv6;
-#endif /* INET6 */
-
- INP_LOCK_ASSERT(inp);
- if (tp != NULL) {
-#ifdef INET6
- isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) != 0;
-#endif
- maxmtu = tcp_hc_getmtu(&inp->inp_inc); /* IPv4 and IPv6 */
- romtu =
-#ifdef INET6
- isipv6 ? tcp_maxmtu6(&inp->inp_inc) :
-#endif /* INET6 */
- tcp_maxmtu(&inp->inp_inc);
- if (!maxmtu)
- maxmtu = romtu;
- else
- maxmtu = min(maxmtu, romtu);
- if (!maxmtu) {
- tp->t_maxopd = tp->t_maxseg =
-#ifdef INET6
- isipv6 ? tcp_v6mssdflt :
-#endif /* INET6 */
- tcp_mssdflt;
- return (inp);
- }
- mss = maxmtu -
-#ifdef INET6
- (isipv6 ?
- sizeof(struct ip6_hdr) + sizeof(struct tcphdr) :
-#endif /* INET6 */
- sizeof(struct tcpiphdr)
-#ifdef INET6
- )
-#endif /* INET6 */
- ;
-
- /*
- * XXX - The above conditional probably violates the TCP
- * spec. The problem is that, since we don't know the
- * other end's MSS, we are supposed to use a conservative
- * default. But, if we do that, then MTU discovery will
- * never actually take place, because the conservative
- * default is much less than the MTUs typically seen
- * on the Internet today. For the moment, we'll sweep
- * this under the carpet.
- *
- * The conservative default might not actually be a problem
- * if the only case this occurs is when sending an initial
- * SYN with options and data to a host we've never talked
- * to before. Then, they will reply with an MSS value which
- * will get recorded and the new parameters should get
- * recomputed. For Further Study.
- */
- if (tp->t_maxopd <= mss)
- return (inp);
- tp->t_maxopd = mss;
-
- if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP &&
- (tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP)
- mss -= TCPOLEN_TSTAMP_APPA;
-#if (MCLBYTES & (MCLBYTES - 1)) == 0
- if (mss > MCLBYTES)
- mss &= ~(MCLBYTES-1);
-#else
- if (mss > MCLBYTES)
- mss = mss / MCLBYTES * MCLBYTES;
-#endif
- if (so->so_snd.sb_hiwat < mss)
- mss = so->so_snd.sb_hiwat;
-
- tp->t_maxseg = mss;
-
- tcpstat.tcps_mturesent++;
- tp->t_rtttime = 0;
- tp->snd_nxt = tp->snd_una;
- tcp_output(tp);
- }
- return (inp);
-}
-
-/*
- * Look-up the routing entry to the peer of this inpcb. If no route
- * is found and it cannot be allocated, then return NULL. This routine
- * is called by TCP routines that access the rmx structure and by tcp_mss
- * to get the interface MTU.
- */
-u_long
-tcp_maxmtu(inc)
- struct in_conninfo *inc;
-{
- struct route sro;
- struct sockaddr_in *dst;
- struct ifnet *ifp;
- u_long maxmtu = 0;
-
- KASSERT(inc != NULL, ("tcp_maxmtu with NULL in_conninfo pointer"));
-
- bzero(&sro, sizeof(sro));
- if (inc->inc_faddr.s_addr != INADDR_ANY) {
- dst = (struct sockaddr_in *)&sro.ro_dst;
- dst->sin_family = AF_INET;
- dst->sin_len = sizeof(*dst);
- dst->sin_addr = inc->inc_faddr;
- rtalloc_ign(&sro, RTF_CLONING);
- }
- if (sro.ro_rt != NULL) {
- ifp = sro.ro_rt->rt_ifp;
- if (sro.ro_rt->rt_rmx.rmx_mtu == 0)
- maxmtu = ifp->if_mtu;
- else
- maxmtu = min(sro.ro_rt->rt_rmx.rmx_mtu, ifp->if_mtu);
- RTFREE(sro.ro_rt);
- }
- return (maxmtu);
-}
-
-#ifdef INET6
-u_long
-tcp_maxmtu6(inc)
- struct in_conninfo *inc;
-{
- struct route_in6 sro6;
- struct ifnet *ifp;
- u_long maxmtu = 0;
-
- KASSERT(inc != NULL, ("tcp_maxmtu6 with NULL in_conninfo pointer"));
-
- bzero(&sro6, sizeof(sro6));
- if (!IN6_IS_ADDR_UNSPECIFIED(&inc->inc6_faddr)) {
- sro6.ro_dst.sin6_family = AF_INET6;
- sro6.ro_dst.sin6_len = sizeof(struct sockaddr_in6);
- sro6.ro_dst.sin6_addr = inc->inc6_faddr;
- rtalloc_ign((struct route *)&sro6, RTF_CLONING);
- }
- if (sro6.ro_rt != NULL) {
- ifp = sro6.ro_rt->rt_ifp;
- if (sro6.ro_rt->rt_rmx.rmx_mtu == 0)
- maxmtu = IN6_LINKMTU(sro6.ro_rt->rt_ifp);
- else
- maxmtu = min(sro6.ro_rt->rt_rmx.rmx_mtu,
- IN6_LINKMTU(sro6.ro_rt->rt_ifp));
- RTFREE(sro6.ro_rt);
- }
-
- return (maxmtu);
-}
-#endif /* INET6 */
-
-#ifdef IPSEC
-/* compute ESP/AH header size for TCP, including outer IP header. */
-size_t
-ipsec_hdrsiz_tcp(tp)
- struct tcpcb *tp;
-{
- struct inpcb *inp;
- struct mbuf *m;
- size_t hdrsiz;
- struct ip *ip;
-#ifdef INET6
- struct ip6_hdr *ip6;
-#endif
- struct tcphdr *th;
-
- if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL))
- return (0);
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (!m)
- return (0);
-
-#ifdef INET6
- if ((inp->inp_vflag & INP_IPV6) != 0) {
- ip6 = mtod(m, struct ip6_hdr *);
- th = (struct tcphdr *)(ip6 + 1);
- m->m_pkthdr.len = m->m_len =
- sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
- tcpip_fillheaders(inp, ip6, th);
- hdrsiz = ipsec6_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp);
- } else
-#endif /* INET6 */
- {
- ip = mtod(m, struct ip *);
- th = (struct tcphdr *)(ip + 1);
- m->m_pkthdr.len = m->m_len = sizeof(struct tcpiphdr);
- tcpip_fillheaders(inp, ip, th);
- hdrsiz = ipsec4_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp);
- }
-
- m_free(m);
- return (hdrsiz);
-}
-#endif /*IPSEC*/
-
-/*
- * Move a TCP connection into TIME_WAIT state.
- * tcbinfo is locked.
- * inp is locked, and is unlocked before returning.
- */
-void
-tcp_twstart(tp)
- struct tcpcb *tp;
-{
- struct tcptw *tw;
- struct inpcb *inp;
- int tw_time, acknow;
- struct socket *so;
-
- INP_INFO_WLOCK_ASSERT(&tcbinfo); /* tcp_timer_2msl_reset(). */
- INP_LOCK_ASSERT(tp->t_inpcb);
-
- tw = uma_zalloc(tcptw_zone, M_NOWAIT);
- if (tw == NULL) {
- tw = tcp_timer_2msl_tw(1);
- if (tw == NULL) {
- tcp_close(tp);
- return;
- }
- }
- inp = tp->t_inpcb;
- tw->tw_inpcb = inp;
-
- /*
- * Recover last window size sent.
- */
- tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale;
-
- /*
- * Set t_recent if timestamps are used on the connection.
- */
- if ((tp->t_flags & (TF_REQ_TSTMP|TF_RCVD_TSTMP|TF_NOOPT)) ==
- (TF_REQ_TSTMP|TF_RCVD_TSTMP))
- tw->t_recent = tp->ts_recent;
- else
- tw->t_recent = 0;
-
- tw->snd_nxt = tp->snd_nxt;
- tw->rcv_nxt = tp->rcv_nxt;
- tw->iss = tp->iss;
- tw->irs = tp->irs;
- tw->t_starttime = tp->t_starttime;
- tw->tw_time = 0;
-
-/* XXX
- * If this code will
- * be used for fin-wait-2 state also, then we may need
- * a ts_recent from the last segment.
- */
- tw_time = 2 * tcp_msl;
- acknow = tp->t_flags & TF_ACKNOW;
- tcp_discardcb(tp);
- so = inp->inp_socket;
- ACCEPT_LOCK();
- SOCK_LOCK(so);
- so->so_pcb = NULL;
- tw->tw_cred = crhold(so->so_cred);
- tw->tw_so_options = so->so_options;
- sotryfree(so);
- inp->inp_socket = NULL;
- if (acknow)
- tcp_twrespond(tw, TH_ACK);
- inp->inp_ppcb = (caddr_t)tw;
- inp->inp_vflag |= INP_TIMEWAIT;
- tcp_timer_2msl_reset(tw, tw_time);
- INP_UNLOCK(inp);
-}
-
-/*
- * The appromixate rate of ISN increase of Microsoft TCP stacks;
- * the actual rate is slightly higher due to the addition of
- * random positive increments.
- *
- * Most other new OSes use semi-randomized ISN values, so we
- * do not need to worry about them.
- */
-#define MS_ISN_BYTES_PER_SECOND 250000
-
-/*
- * Determine if the ISN we will generate has advanced beyond the last
- * sequence number used by the previous connection. If so, indicate
- * that it is safe to recycle this tw socket by returning 1.
- *
- * XXXRW: This function should assert the inpcb lock as it does multiple
- * non-atomic reads from the tcptw, but is currently called without it from
- * in_pcb.c:in_pcblookup_local().
- */
-int
-tcp_twrecycleable(struct tcptw *tw)
-{
- tcp_seq new_iss = tw->iss;
- tcp_seq new_irs = tw->irs;
-
- new_iss += (ticks - tw->t_starttime) * (ISN_BYTES_PER_SECOND / hz);
- new_irs += (ticks - tw->t_starttime) * (MS_ISN_BYTES_PER_SECOND / hz);
-
- if (SEQ_GT(new_iss, tw->snd_nxt) && SEQ_GT(new_irs, tw->rcv_nxt))
- return (1);
- else
- return (0);
-}
-
-struct tcptw *
-tcp_twclose(struct tcptw *tw, int reuse)
-{
- struct inpcb *inp;
-
- inp = tw->tw_inpcb;
- INP_INFO_WLOCK_ASSERT(&tcbinfo); /* tcp_timer_2msl_stop(). */
- INP_LOCK_ASSERT(inp);
-
- tw->tw_inpcb = NULL;
- tcp_timer_2msl_stop(tw);
- inp->inp_ppcb = NULL;
-#ifdef INET6
- if (inp->inp_vflag & INP_IPV6PROTO)
- in6_pcbdetach(inp);
- else
-#endif
- in_pcbdetach(inp);
- tcpstat.tcps_closed++;
- crfree(tw->tw_cred);
- tw->tw_cred = NULL;
- if (reuse)
- return (tw);
- uma_zfree(tcptw_zone, tw);
- return (NULL);
-}
-
-int
-tcp_twrespond(struct tcptw *tw, int flags)
-{
- struct inpcb *inp = tw->tw_inpcb;
- struct tcphdr *th;
- struct mbuf *m;
- struct ip *ip = NULL;
- u_int8_t *optp;
- u_int hdrlen, optlen;
- int error;
-#ifdef INET6
- struct ip6_hdr *ip6 = NULL;
- int isipv6 = inp->inp_inc.inc_isipv6;
-#endif
-
- INP_LOCK_ASSERT(inp);
-
- m = m_gethdr(M_DONTWAIT, MT_HEADER);
- if (m == NULL)
- return (ENOBUFS);
- m->m_data += max_linkhdr;
-
-#ifdef MAC
- mac_create_mbuf_from_inpcb(inp, m);
-#endif
-
-#ifdef INET6
- if (isipv6) {
- hdrlen = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
- ip6 = mtod(m, struct ip6_hdr *);
- th = (struct tcphdr *)(ip6 + 1);
- tcpip_fillheaders(inp, ip6, th);
- } else
-#endif
- {
- hdrlen = sizeof(struct tcpiphdr);
- ip = mtod(m, struct ip *);
- th = (struct tcphdr *)(ip + 1);
- tcpip_fillheaders(inp, ip, th);
- }
- optp = (u_int8_t *)(th + 1);
-
- /*
- * Send a timestamp and echo-reply if both our side and our peer
- * have sent timestamps in our SYN's and this is not a RST.
- */
- if (tw->t_recent && flags == TH_ACK) {
- u_int32_t *lp = (u_int32_t *)optp;
-
- /* Form timestamp option as shown in appendix A of RFC 1323. */
- *lp++ = htonl(TCPOPT_TSTAMP_HDR);
- *lp++ = htonl(ticks);
- *lp = htonl(tw->t_recent);
- optp += TCPOLEN_TSTAMP_APPA;
- }
-
- optlen = optp - (u_int8_t *)(th + 1);
-
- m->m_len = hdrlen + optlen;
- m->m_pkthdr.len = m->m_len;
-
- KASSERT(max_linkhdr + m->m_len <= MHLEN, ("tcptw: mbuf too small"));
-
- th->th_seq = htonl(tw->snd_nxt);
- th->th_ack = htonl(tw->rcv_nxt);
- th->th_off = (sizeof(struct tcphdr) + optlen) >> 2;
- th->th_flags = flags;
- th->th_win = htons(tw->last_win);
-
-#ifdef INET6
- if (isipv6) {
- th->th_sum = in6_cksum(m, IPPROTO_TCP, sizeof(struct ip6_hdr),
- sizeof(struct tcphdr) + optlen);
- ip6->ip6_hlim = in6_selecthlim(inp, NULL);
- error = ip6_output(m, inp->in6p_outputopts, NULL,
- (tw->tw_so_options & SO_DONTROUTE), NULL, NULL, inp);
- } else
-#endif
- {
- th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
- htons(sizeof(struct tcphdr) + optlen + IPPROTO_TCP));
- m->m_pkthdr.csum_flags = CSUM_TCP;
- m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
- ip->ip_len = m->m_pkthdr.len;
- if (path_mtu_discovery)
- ip->ip_off |= IP_DF;
- error = ip_output(m, inp->inp_options, NULL,
- ((tw->tw_so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0),
- NULL, inp);
- }
- if (flags & TH_ACK)
- tcpstat.tcps_sndacks++;
- else
- tcpstat.tcps_sndctrl++;
- tcpstat.tcps_sndtotal++;
- return (error);
-}
-
-/*
- * TCP BANDWIDTH DELAY PRODUCT WINDOW LIMITING
- *
- * This code attempts to calculate the bandwidth-delay product as a
- * means of determining the optimal window size to maximize bandwidth,
- * minimize RTT, and avoid the over-allocation of buffers on interfaces and
- * routers. This code also does a fairly good job keeping RTTs in check
- * across slow links like modems. We implement an algorithm which is very
- * similar (but not meant to be) TCP/Vegas. The code operates on the
- * transmitter side of a TCP connection and so only effects the transmit
- * side of the connection.
- *
- * BACKGROUND: TCP makes no provision for the management of buffer space
- * at the end points or at the intermediate routers and switches. A TCP
- * stream, whether using NewReno or not, will eventually buffer as
- * many packets as it is able and the only reason this typically works is
- * due to the fairly small default buffers made available for a connection
- * (typicaly 16K or 32K). As machines use larger windows and/or window
- * scaling it is now fairly easy for even a single TCP connection to blow-out
- * all available buffer space not only on the local interface, but on
- * intermediate routers and switches as well. NewReno makes a misguided
- * attempt to 'solve' this problem by waiting for an actual failure to occur,
- * then backing off, then steadily increasing the window again until another
- * failure occurs, ad-infinitum. This results in terrible oscillation that
- * is only made worse as network loads increase and the idea of intentionally
- * blowing out network buffers is, frankly, a terrible way to manage network
- * resources.
- *
- * It is far better to limit the transmit window prior to the failure
- * condition being achieved. There are two general ways to do this: First
- * you can 'scan' through different transmit window sizes and locate the
- * point where the RTT stops increasing, indicating that you have filled the
- * pipe, then scan backwards until you note that RTT stops decreasing, then
- * repeat ad-infinitum. This method works in principle but has severe
- * implementation issues due to RTT variances, timer granularity, and
- * instability in the algorithm which can lead to many false positives and
- * create oscillations as well as interact badly with other TCP streams
- * implementing the same algorithm.
- *
- * The second method is to limit the window to the bandwidth delay product
- * of the link. This is the method we implement. RTT variances and our
- * own manipulation of the congestion window, bwnd, can potentially
- * destabilize the algorithm. For this reason we have to stabilize the
- * elements used to calculate the window. We do this by using the minimum
- * observed RTT, the long term average of the observed bandwidth, and
- * by adding two segments worth of slop. It isn't perfect but it is able
- * to react to changing conditions and gives us a very stable basis on
- * which to extend the algorithm.
- */
-void
-tcp_xmit_bandwidth_limit(struct tcpcb *tp, tcp_seq ack_seq)
-{
- u_long bw;
- u_long bwnd;
- int save_ticks;
-
- INP_LOCK_ASSERT(tp->t_inpcb);
-
- /*
- * If inflight_enable is disabled in the middle of a tcp connection,
- * make sure snd_bwnd is effectively disabled.
- */
- if (tcp_inflight_enable == 0) {
- tp->snd_bwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT;
- tp->snd_bandwidth = 0;
- return;
- }
-
- /*
- * Figure out the bandwidth. Due to the tick granularity this
- * is a very rough number and it MUST be averaged over a fairly
- * long period of time. XXX we need to take into account a link
- * that is not using all available bandwidth, but for now our
- * slop will ramp us up if this case occurs and the bandwidth later
- * increases.
- *
- * Note: if ticks rollover 'bw' may wind up negative. We must
- * effectively reset t_bw_rtttime for this case.
- */
- save_ticks = ticks;
- if ((u_int)(save_ticks - tp->t_bw_rtttime) < 1)
- return;
-
- bw = (int64_t)(ack_seq - tp->t_bw_rtseq) * hz /
- (save_ticks - tp->t_bw_rtttime);
- tp->t_bw_rtttime = save_ticks;
- tp->t_bw_rtseq = ack_seq;
- if (tp->t_bw_rtttime == 0 || (int)bw < 0)
- return;
- bw = ((int64_t)tp->snd_bandwidth * 15 + bw) >> 4;
-
- tp->snd_bandwidth = bw;
-
- /*
- * Calculate the semi-static bandwidth delay product, plus two maximal
- * segments. The additional slop puts us squarely in the sweet
- * spot and also handles the bandwidth run-up case and stabilization.
- * Without the slop we could be locking ourselves into a lower
- * bandwidth.
- *
- * Situations Handled:
- * (1) Prevents over-queueing of packets on LANs, especially on
- * high speed LANs, allowing larger TCP buffers to be
- * specified, and also does a good job preventing
- * over-queueing of packets over choke points like modems
- * (at least for the transmit side).
- *
- * (2) Is able to handle changing network loads (bandwidth
- * drops so bwnd drops, bandwidth increases so bwnd
- * increases).
- *
- * (3) Theoretically should stabilize in the face of multiple
- * connections implementing the same algorithm (this may need
- * a little work).
- *
- * (4) Stability value (defaults to 20 = 2 maximal packets) can
- * be adjusted with a sysctl but typically only needs to be
- * on very slow connections. A value no smaller then 5
- * should be used, but only reduce this default if you have
- * no other choice.
- */
-#define USERTT ((tp->t_srtt + tp->t_rttbest) / 2)
- bwnd = (int64_t)bw * USERTT / (hz << TCP_RTT_SHIFT) + tcp_inflight_stab * tp->t_maxseg / 10;
-#undef USERTT
-
- if (tcp_inflight_debug > 0) {
- static int ltime;
- if ((u_int)(ticks - ltime) >= hz / tcp_inflight_debug) {
- ltime = ticks;
- printf("%p bw %ld rttbest %d srtt %d bwnd %ld\n",
- tp,
- bw,
- tp->t_rttbest,
- tp->t_srtt,
- bwnd
- );
- }
- }
- if ((long)bwnd < tcp_inflight_min)
- bwnd = tcp_inflight_min;
- if (bwnd > tcp_inflight_max)
- bwnd = tcp_inflight_max;
- if ((long)bwnd < tp->t_maxseg * 2)
- bwnd = tp->t_maxseg * 2;
- tp->snd_bwnd = bwnd;
-}
-
-#ifdef TCP_SIGNATURE
-/*
- * Callback function invoked by m_apply() to digest TCP segment data
- * contained within an mbuf chain.
- */
-static int
-tcp_signature_apply(void *fstate, void *data, u_int len)
-{
-
- MD5Update(fstate, (u_char *)data, len);
- return (0);
-}
-
-/*
- * Compute TCP-MD5 hash of a TCPv4 segment. (RFC2385)
- *
- * Parameters:
- * m pointer to head of mbuf chain
- * off0 offset to TCP header within the mbuf chain
- * len length of TCP segment data, excluding options
- * optlen length of TCP segment options
- * buf pointer to storage for computed MD5 digest
- * direction direction of flow (IPSEC_DIR_INBOUND or OUTBOUND)
- *
- * We do this over ip, tcphdr, segment data, and the key in the SADB.
- * When called from tcp_input(), we can be sure that th_sum has been
- * zeroed out and verified already.
- *
- * This function is for IPv4 use only. Calling this function with an
- * IPv6 packet in the mbuf chain will yield undefined results.
- *
- * Return 0 if successful, otherwise return -1.
- *
- * XXX The key is retrieved from the system's PF_KEY SADB, by keying a
- * search with the destination IP address, and a 'magic SPI' to be
- * determined by the application. This is hardcoded elsewhere to 1179
- * right now. Another branch of this code exists which uses the SPD to
- * specify per-application flows but it is unstable.
- */
-int
-tcp_signature_compute(struct mbuf *m, int off0, int len, int optlen,
- u_char *buf, u_int direction)
-{
- union sockaddr_union dst;
- struct ippseudo ippseudo;
- MD5_CTX ctx;
- int doff;
- struct ip *ip;
- struct ipovly *ipovly;
- struct secasvar *sav;
- struct tcphdr *th;
- u_short savecsum;
-
- KASSERT(m != NULL, ("NULL mbuf chain"));
- KASSERT(buf != NULL, ("NULL signature pointer"));
-
- /* Extract the destination from the IP header in the mbuf. */
- ip = mtod(m, struct ip *);
- bzero(&dst, sizeof(union sockaddr_union));
- dst.sa.sa_len = sizeof(struct sockaddr_in);
- dst.sa.sa_family = AF_INET;
- dst.sin.sin_addr = (direction == IPSEC_DIR_INBOUND) ?
- ip->ip_src : ip->ip_dst;
-
- /* Look up an SADB entry which matches the address of the peer. */
- sav = KEY_ALLOCSA(&dst, IPPROTO_TCP, htonl(TCP_SIG_SPI));
- if (sav == NULL) {
- printf("%s: SADB lookup failed for %s\n", __func__,
- inet_ntoa(dst.sin.sin_addr));
- return (EINVAL);
- }
-
- MD5Init(&ctx);
- ipovly = (struct ipovly *)ip;
- th = (struct tcphdr *)((u_char *)ip + off0);
- doff = off0 + sizeof(struct tcphdr) + optlen;
-
- /*
- * Step 1: Update MD5 hash with IP pseudo-header.
- *
- * XXX The ippseudo header MUST be digested in network byte order,
- * or else we'll fail the regression test. Assume all fields we've
- * been doing arithmetic on have been in host byte order.
- * XXX One cannot depend on ipovly->ih_len here. When called from
- * tcp_output(), the underlying ip_len member has not yet been set.
- */
- ippseudo.ippseudo_src = ipovly->ih_src;
- ippseudo.ippseudo_dst = ipovly->ih_dst;
- ippseudo.ippseudo_pad = 0;
- ippseudo.ippseudo_p = IPPROTO_TCP;
- ippseudo.ippseudo_len = htons(len + sizeof(struct tcphdr) + optlen);
- MD5Update(&ctx, (char *)&ippseudo, sizeof(struct ippseudo));
-
- /*
- * Step 2: Update MD5 hash with TCP header, excluding options.
- * The TCP checksum must be set to zero.
- */
- savecsum = th->th_sum;
- th->th_sum = 0;
- MD5Update(&ctx, (char *)th, sizeof(struct tcphdr));
- th->th_sum = savecsum;
-
- /*
- * Step 3: Update MD5 hash with TCP segment data.
- * Use m_apply() to avoid an early m_pullup().
- */
- if (len > 0)
- m_apply(m, doff, len, tcp_signature_apply, &ctx);
-
- /*
- * Step 4: Update MD5 hash with shared secret.
- */
- MD5Update(&ctx, _KEYBUF(sav->key_auth), _KEYLEN(sav->key_auth));
- MD5Final(buf, &ctx);
-
- key_sa_recordxfer(sav, m);
- KEY_FREESAV(&sav);
- return (0);
-}
-#endif /* TCP_SIGNATURE */
-
-static int
-sysctl_drop(SYSCTL_HANDLER_ARGS)
-{
- /* addrs[0] is a foreign socket, addrs[1] is a local one. */
- struct sockaddr_storage addrs[2];
- struct inpcb *inp;
- struct tcpcb *tp;
- struct sockaddr_in *fin, *lin;
-#ifdef INET6
- struct sockaddr_in6 *fin6, *lin6;
- struct in6_addr f6, l6;
-#endif
- int error;
-
- inp = NULL;
- fin = lin = NULL;
-#ifdef INET6
- fin6 = lin6 = NULL;
-#endif
- error = 0;
-
- if (req->oldptr != NULL || req->oldlen != 0)
- return (EINVAL);
- if (req->newptr == NULL)
- return (EPERM);
- if (req->newlen < sizeof(addrs))
- return (ENOMEM);
- error = SYSCTL_IN(req, &addrs, sizeof(addrs));
- if (error)
- return (error);
-
- switch (addrs[0].ss_family) {
-#ifdef INET6
- case AF_INET6:
- fin6 = (struct sockaddr_in6 *)&addrs[0];
- lin6 = (struct sockaddr_in6 *)&addrs[1];
- if (fin6->sin6_len != sizeof(struct sockaddr_in6) ||
- lin6->sin6_len != sizeof(struct sockaddr_in6))
- return (EINVAL);
- if (IN6_IS_ADDR_V4MAPPED(&fin6->sin6_addr)) {
- if (!IN6_IS_ADDR_V4MAPPED(&lin6->sin6_addr))
- return (EINVAL);
- in6_sin6_2_sin_in_sock((struct sockaddr *)&addrs[0]);
- in6_sin6_2_sin_in_sock((struct sockaddr *)&addrs[1]);
- fin = (struct sockaddr_in *)&addrs[0];
- lin = (struct sockaddr_in *)&addrs[1];
- break;
- }
- error = in6_embedscope(&f6, fin6, NULL, NULL);
- if (error)
- return (EINVAL);
- error = in6_embedscope(&l6, lin6, NULL, NULL);
- if (error)
- return (EINVAL);
- break;
-#endif
- case AF_INET:
- fin = (struct sockaddr_in *)&addrs[0];
- lin = (struct sockaddr_in *)&addrs[1];
- if (fin->sin_len != sizeof(struct sockaddr_in) ||
- lin->sin_len != sizeof(struct sockaddr_in))
- return (EINVAL);
- break;
- default:
- return (EINVAL);
- }
- INP_INFO_WLOCK(&tcbinfo);
- switch (addrs[0].ss_family) {
-#ifdef INET6
- case AF_INET6:
- inp = in6_pcblookup_hash(&tcbinfo, &f6, fin6->sin6_port,
- &l6, lin6->sin6_port, 0, NULL);
- break;
-#endif
- case AF_INET:
- inp = in_pcblookup_hash(&tcbinfo, fin->sin_addr, fin->sin_port,
- lin->sin_addr, lin->sin_port, 0, NULL);
- break;
- }
- if (inp != NULL) {
- INP_LOCK(inp);
- if ((tp = intotcpcb(inp)) &&
- ((inp->inp_socket->so_options & SO_ACCEPTCONN) == 0)) {
- tp = tcp_drop(tp, ECONNABORTED);
- if (tp != NULL)
- INP_UNLOCK(inp);
- } else
- INP_UNLOCK(inp);
- } else
- error = ESRCH;
- INP_INFO_WUNLOCK(&tcbinfo);
- return (error);
-}
-
-SYSCTL_PROC(_net_inet_tcp, TCPCTL_DROP, drop,
- CTLTYPE_STRUCT|CTLFLAG_WR|CTLFLAG_SKIP, NULL,
- 0, sysctl_drop, "", "Drop TCP connection");
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
deleted file mode 100644
index 9922fa2..0000000
--- a/sys/pc98/cbus/pcrtc.c
+++ /dev/null
@@ -1,908 +0,0 @@
-/*-
- * 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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: @(#)clock.c 7.2 (Berkeley) 5/12/91
- * $FreeBSD$
- */
-
-/*
- * Routines to handle clock hardware.
- */
-
-/*
- * inittodr, settodr and support routines written
- * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at>
- *
- * reintroduced and updated by Chris Stenton <chris@gnome.co.uk> 8/10/94
- */
-
-/*
- * modified for PC98 by Kakefuda
- */
-
-#include "opt_apic.h"
-#include "opt_clock.h"
-#include "opt_isa.h"
-#include "opt_mca.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/kdb.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/time.h>
-#include <sys/timetc.h>
-#include <sys/kernel.h>
-#include <sys/limits.h>
-#include <sys/module.h>
-#include <sys/sysctl.h>
-#include <sys/cons.h>
-#include <sys/power.h>
-
-#include <machine/clock.h>
-#include <machine/cputypes.h>
-#include <machine/frame.h>
-#include <machine/intr_machdep.h>
-#include <machine/md_var.h>
-#include <machine/psl.h>
-#ifdef DEV_APIC
-#include <machine/apicvar.h>
-#endif
-#include <machine/specialreg.h>
-#include <machine/ppireg.h>
-#include <machine/timerreg.h>
-
-#include <i386/isa/icu.h>
-#include <pc98/cbus/cbus.h>
-#include <pc98/pc98/pc98_machdep.h>
-#ifdef DEV_ISA
-#include <isa/isavar.h>
-#endif
-
-/*
- * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we
- * can use a simple formula for leap years.
- */
-#define LEAPYEAR(y) (((u_int)(y) % 4 == 0) ? 1 : 0)
-#define DAYSPERYEAR (31+28+31+30+31+30+31+31+30+31+30+31)
-
-#define TIMER_DIV(x) ((timer_freq + (x) / 2) / (x))
-
-int adjkerntz; /* local offset from GMT in seconds */
-int clkintr_pending;
-int disable_rtc_set; /* disable resettodr() if != 0 */
-int pscnt = 1;
-int psdiv = 1;
-int statclock_disable;
-#ifndef TIMER_FREQ
-#define TIMER_FREQ 2457600
-#endif
-u_int timer_freq = TIMER_FREQ;
-int timer0_max_count;
-int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
-struct mtx clock_lock;
-
-static int beeping = 0;
-static const u_char daysinmonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
-static u_int hardclock_max_count;
-static struct intsrc *i8254_intsrc;
-static u_int32_t i8254_lastcount;
-static u_int32_t i8254_offset;
-static int (*i8254_pending)(struct intsrc *);
-static int i8254_ticked;
-static int using_lapic_timer;
-
-/* Values for timerX_state: */
-#define RELEASED 0
-#define RELEASE_PENDING 1
-#define ACQUIRED 2
-#define ACQUIRE_PENDING 3
-
-static u_char timer1_state;
-static u_char timer2_state;
-static void rtc_serialcombit(int);
-static void rtc_serialcom(int);
-static int rtc_inb(void);
-static void rtc_outb(int);
-
-static unsigned i8254_get_timecount(struct timecounter *tc);
-static unsigned i8254_simple_get_timecount(struct timecounter *tc);
-static void set_timer_freq(u_int freq, int intr_freq);
-
-static struct timecounter i8254_timecounter = {
- i8254_get_timecount, /* get_timecount */
- 0, /* no poll_pps */
- ~0u, /* counter_mask */
- 0, /* frequency */
- "i8254", /* name */
- 0 /* quality */
-};
-
-static void
-clkintr(struct clockframe *frame)
-{
-
- if (timecounter->tc_get_timecount == i8254_get_timecount) {
- mtx_lock_spin(&clock_lock);
- if (i8254_ticked)
- i8254_ticked = 0;
- else {
- i8254_offset += timer0_max_count;
- i8254_lastcount = 0;
- }
- clkintr_pending = 0;
- mtx_unlock_spin(&clock_lock);
- }
- if (!using_lapic_timer)
- hardclock(frame);
-}
-
-int
-acquire_timer1(int mode)
-{
-
- if (timer1_state != RELEASED)
- return (-1);
- timer1_state = ACQUIRED;
-
- /*
- * This access to the timer registers is as atomic as possible
- * because it is a single instruction. We could do better if we
- * knew the rate. Use of splclock() limits glitches to 10-100us,
- * and this is probably good enough for timer2, so we aren't as
- * careful with it as with timer0.
- */
- outb(TIMER_MODE, TIMER_SEL1 | (mode & 0x3f));
-
- return (0);
-}
-
-int
-acquire_timer2(int mode)
-{
-
- if (timer2_state != RELEASED)
- return (-1);
- timer2_state = ACQUIRED;
-
- /*
- * This access to the timer registers is as atomic as possible
- * because it is a single instruction. We could do better if we
- * knew the rate. Use of splclock() limits glitches to 10-100us,
- * and this is probably good enough for timer2, so we aren't as
- * careful with it as with timer0.
- */
- outb(TIMER_MODE, TIMER_SEL2 | (mode & 0x3f));
-
- return (0);
-}
-
-int
-release_timer1()
-{
-
- if (timer1_state != ACQUIRED)
- return (-1);
- timer1_state = RELEASED;
- outb(TIMER_MODE, TIMER_SEL1 | TIMER_SQWAVE | TIMER_16BIT);
- return (0);
-}
-
-int
-release_timer2()
-{
-
- if (timer2_state != ACQUIRED)
- return (-1);
- timer2_state = RELEASED;
- outb(TIMER_MODE, TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT);
- return (0);
-}
-
-
-static int
-getit(void)
-{
- int high, low;
-
- mtx_lock_spin(&clock_lock);
-
- /* Select timer0 and latch counter value. */
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
-
- low = inb(TIMER_CNTR0);
- high = inb(TIMER_CNTR0);
-
- mtx_unlock_spin(&clock_lock);
- return ((high << 8) | low);
-}
-
-/*
- * Wait "n" microseconds.
- * Relies on timer 1 counting down from (timer_freq / hz)
- * Note: timer had better have been programmed before this is first used!
- */
-void
-DELAY(int n)
-{
- int delta, prev_tick, tick, ticks_left;
-
-#ifdef DELAYDEBUG
- int getit_calls = 1;
- int n1;
- static int state = 0;
-
- if (state == 0) {
- state = 1;
- for (n1 = 1; n1 <= 10000000; n1 *= 10)
- DELAY(n1);
- state = 2;
- }
- if (state == 1)
- printf("DELAY(%d)...", n);
-#endif
- /*
- * Guard against the timer being uninitialized if we are called
- * early for console i/o.
- */
- if (timer0_max_count == 0)
- set_timer_freq(timer_freq, hz);
-
- /*
- * Read the counter first, so that the rest of the setup overhead is
- * counted. Guess the initial overhead is 20 usec (on most systems it
- * takes about 1.5 usec for each of the i/o's in getit(). The loop
- * takes about 6 usec on a 486/33 and 13 usec on a 386/20. The
- * multiplications and divisions to scale the count take a while).
- *
- * However, if ddb is active then use a fake counter since reading
- * the i8254 counter involves acquiring a lock. ddb must not do
- * locking for many reasons, but it calls here for at least atkbd
- * input.
- */
-#ifdef KDB
- if (kdb_active)
- prev_tick = 1;
- else
-#endif
- prev_tick = getit();
- n -= 0; /* XXX actually guess no initial overhead */
- /*
- * Calculate (n * (timer_freq / 1e6)) without using floating point
- * and without any avoidable overflows.
- */
- if (n <= 0)
- ticks_left = 0;
- else if (n < 256)
- /*
- * Use fixed point to avoid a slow division by 1000000.
- * 39099 = 1193182 * 2^15 / 10^6 rounded to nearest.
- * 2^15 is the first power of 2 that gives exact results
- * for n between 0 and 256.
- */
- ticks_left = ((u_int)n * 39099 + (1 << 15) - 1) >> 15;
- else
- /*
- * Don't bother using fixed point, although gcc-2.7.2
- * generates particularly poor code for the long long
- * division, since even the slow way will complete long
- * before the delay is up (unless we're interrupted).
- */
- ticks_left = ((u_int)n * (long long)timer_freq + 999999)
- / 1000000;
-
- while (ticks_left > 0) {
-#ifdef KDB
- if (kdb_active) {
- outb(0x5f, 0);
- tick = prev_tick - 1;
- if (tick <= 0)
- tick = timer0_max_count;
- } else
-#endif
- tick = getit();
-#ifdef DELAYDEBUG
- ++getit_calls;
-#endif
- delta = prev_tick - tick;
- prev_tick = tick;
- if (delta < 0) {
- delta += timer0_max_count;
- /*
- * Guard against timer0_max_count being wrong.
- * This shouldn't happen in normal operation,
- * but it may happen if set_timer_freq() is
- * traced.
- */
- if (delta < 0)
- delta = 0;
- }
- ticks_left -= delta;
- }
-#ifdef DELAYDEBUG
- if (state == 1)
- printf(" %d calls to getit() at %d usec each\n",
- getit_calls, (n + 5) / getit_calls);
-#endif
-}
-
-static void
-sysbeepstop(void *chan)
-{
- ppi_spkr_off(); /* disable counter1 output to speaker */
- timer_spkr_release();
- beeping = 0;
-}
-
-int
-sysbeep(int pitch, int period)
-{
- int x = splclock();
-
- if (timer_spkr_acquire())
- if (!beeping) {
- /* Something else owns it. */
- splx(x);
- return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */
- }
- disable_intr();
- spkr_set_pitch(pitch);
- enable_intr();
- if (!beeping) {
- /* enable counter1 output to speaker */
- ppi_spkr_on();
- beeping = period;
- timeout(sysbeepstop, (void *)NULL, period);
- }
- splx(x);
- return (0);
-}
-
-
-unsigned int delaycount;
-#define FIRST_GUESS 0x2000
-static void findcpuspeed(void)
-{
- int i;
- int remainder;
-
- /* Put counter in count down mode */
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_16BIT | TIMER_RATEGEN);
- outb(TIMER_CNTR0, 0xff);
- outb(TIMER_CNTR0, 0xff);
- for (i = FIRST_GUESS; i; i--)
- ;
- remainder = getit();
- delaycount = (FIRST_GUESS * TIMER_DIV(1000)) / (0xffff - remainder);
-}
-
-static u_int
-calibrate_clocks(void)
-{
- int timeout;
- u_int count, prev_count, tot_count;
- u_short sec, start_sec;
-
- if (bootverbose)
- printf("Calibrating clock(s) ... ");
- /* Check ARTIC. */
- if (!(PC98_SYSTEM_PARAMETER(0x458) & 0x80) &&
- !(PC98_SYSTEM_PARAMETER(0x45b) & 0x04))
- goto fail;
- timeout = 100000000;
-
- /* Read the ARTIC. */
- sec = inw(0x5e);
-
- /* Wait for the ARTIC to changes. */
- start_sec = sec;
- for (;;) {
- sec = inw(0x5e);
- if (sec != start_sec)
- break;
- if (--timeout == 0)
- goto fail;
- }
- prev_count = getit();
- if (prev_count == 0 || prev_count > timer0_max_count)
- goto fail;
- tot_count = 0;
-
- start_sec = sec;
- for (;;) {
- sec = inw(0x5e);
- count = getit();
- if (count == 0 || count > timer0_max_count)
- goto fail;
- if (count > prev_count)
- tot_count += prev_count - (count - timer0_max_count);
- else
- tot_count += prev_count - count;
- prev_count = count;
- if ((sec == start_sec + 1200) || /* 1200 = 307.2KHz >> 8 */
- (sec < start_sec &&
- (u_int)sec + 0x10000 == (u_int)start_sec + 1200))
- break;
- if (--timeout == 0)
- goto fail;
- }
-
- if (bootverbose) {
- printf("i8254 clock: %u Hz\n", tot_count);
- }
- return (tot_count);
-
-fail:
- if (bootverbose)
- printf("failed, using default i8254 clock of %u Hz\n",
- timer_freq);
- return (timer_freq);
-}
-
-static void
-set_timer_freq(u_int freq, int intr_freq)
-{
- int new_timer0_max_count;
-
- i8254_timecounter.tc_frequency = freq;
- mtx_lock_spin(&clock_lock);
- timer_freq = freq;
- new_timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq);
- if (using_lapic_timer) {
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
- outb(TIMER_CNTR0, 0);
- outb(TIMER_CNTR0, 0);
- } else if (new_timer0_max_count != timer0_max_count) {
- timer0_max_count = new_timer0_max_count;
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
- outb(TIMER_CNTR0, timer0_max_count & 0xff);
- outb(TIMER_CNTR0, timer0_max_count >> 8);
- }
- mtx_unlock_spin(&clock_lock);
-}
-
-static void
-i8254_restore(void)
-{
-
- set_timer_freq(timer_freq, hz);
-}
-
-
-/*
- * Restore all the timers non-atomically (XXX: should be atomically).
- *
- * This function is called from pmtimer_resume() to restore all the timers.
- * This should not be necessary, but there are broken laptops that do not
- * restore all the timers on resume.
- */
-void
-timer_restore(void)
-{
-
- i8254_restore(); /* restore timer_freq and hz */
-}
-
-/*
- * Initialize 8254 timer 0 early so that it can be used in DELAY().
- * XXX initialization of other timers is unintentionally left blank.
- */
-void
-startrtclock()
-{
- u_int delta, freq;
-
- findcpuspeed();
- if (pc98_machine_type & M_8M)
- timer_freq = 1996800L; /* 1.9968 MHz */
- else
- timer_freq = 2457600L; /* 2.4576 MHz */
-
- set_timer_freq(timer_freq, hz);
- freq = calibrate_clocks();
-#ifdef CLK_CALIBRATION_LOOP
- if (bootverbose) {
- printf(
- "Press a key on the console to abort clock calibration\n");
- while (cncheckc() == -1)
- calibrate_clocks();
- }
-#endif
-
- /*
- * Use the calibrated i8254 frequency if it seems reasonable.
- * Otherwise use the default, and don't use the calibrated i586
- * frequency.
- */
- delta = freq > timer_freq ? freq - timer_freq : timer_freq - freq;
- if (delta < timer_freq / 100) {
-#ifndef CLK_USE_I8254_CALIBRATION
- if (bootverbose)
- printf(
-"CLK_USE_I8254_CALIBRATION not specified - using default frequency\n");
- freq = timer_freq;
-#endif
- timer_freq = freq;
- } else {
- if (bootverbose)
- printf(
- "%d Hz differs from default of %d Hz by more than 1%%\n",
- freq, timer_freq);
- }
-
- set_timer_freq(timer_freq, hz);
- tc_init(&i8254_timecounter);
-
- init_TSC();
-}
-
-static void
-rtc_serialcombit(int i)
-{
- outb(IO_RTC, ((i&0x01)<<5)|0x07);
- DELAY(1);
- outb(IO_RTC, ((i&0x01)<<5)|0x17);
- DELAY(1);
- outb(IO_RTC, ((i&0x01)<<5)|0x07);
- DELAY(1);
-}
-
-static void
-rtc_serialcom(int i)
-{
- rtc_serialcombit(i&0x01);
- rtc_serialcombit((i&0x02)>>1);
- rtc_serialcombit((i&0x04)>>2);
- rtc_serialcombit((i&0x08)>>3);
- outb(IO_RTC, 0x07);
- DELAY(1);
- outb(IO_RTC, 0x0f);
- DELAY(1);
- outb(IO_RTC, 0x07);
- DELAY(1);
-}
-
-static void
-rtc_outb(int val)
-{
- int s;
- int sa = 0;
-
- for (s=0;s<8;s++) {
- sa = ((val >> s) & 0x01) ? 0x27 : 0x07;
- outb(IO_RTC, sa); /* set DI & CLK 0 */
- DELAY(1);
- outb(IO_RTC, sa | 0x10); /* CLK 1 */
- DELAY(1);
- }
- outb(IO_RTC, sa & 0xef); /* CLK 0 */
-}
-
-static int
-rtc_inb(void)
-{
- int s;
- int sa = 0;
-
- for (s=0;s<8;s++) {
- sa |= ((inb(0x33) & 0x01) << s);
- outb(IO_RTC, 0x17); /* CLK 1 */
- DELAY(1);
- outb(IO_RTC, 0x07); /* CLK 0 */
- DELAY(2);
- }
- return sa;
-}
-
-/*
- * Initialize the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-void
-inittodr(time_t base)
-{
- unsigned long sec, days;
- int year, month;
- int y, m, s;
- struct timespec ts;
- int second, min, hour;
-
- if (base) {
- s = splclock();
- ts.tv_sec = base;
- ts.tv_nsec = 0;
- tc_setclock(&ts);
- splx(s);
- }
-
- rtc_serialcom(0x03); /* Time Read */
- rtc_serialcom(0x01); /* Register shift command. */
- DELAY(20);
-
- second = bcd2bin(rtc_inb() & 0xff); /* sec */
- min = bcd2bin(rtc_inb() & 0xff); /* min */
- hour = bcd2bin(rtc_inb() & 0xff); /* hour */
- days = bcd2bin(rtc_inb() & 0xff) - 1; /* date */
-
- month = (rtc_inb() >> 4) & 0x0f; /* month */
- for (m = 1; m < month; m++)
- days += daysinmonth[m-1];
- year = bcd2bin(rtc_inb() & 0xff) + 1900; /* year */
- /* 2000 year problem */
- if (year < 1995)
- year += 100;
- if (year < 1970)
- goto wrong_time;
- for (y = 1970; y < year; y++)
- days += DAYSPERYEAR + LEAPYEAR(y);
- if ((month > 2) && LEAPYEAR(year))
- days ++;
- sec = ((( days * 24 +
- hour) * 60 +
- min) * 60 +
- second);
- /* sec now contains the number of seconds, since Jan 1 1970,
- in the local time zone */
-
- s = splhigh();
-
- sec += tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
-
- y = time_second - sec;
- if (y <= -2 || y >= 2) {
- /* badly off, adjust it */
- ts.tv_sec = sec;
- ts.tv_nsec = 0;
- tc_setclock(&ts);
- }
- splx(s);
- return;
-
-wrong_time:
- printf("Invalid time in real time clock.\n");
- printf("Check and reset the date immediately!\n");
-}
-
-/*
- * Write system time back to RTC
- */
-void
-resettodr()
-{
- unsigned long tm;
- int y, m, s;
- int wd;
-
- if (disable_rtc_set)
- return;
-
- s = splclock();
- tm = time_second;
- splx(s);
-
- rtc_serialcom(0x01); /* Register shift command. */
-
- /* Calculate local time to put in RTC */
-
- tm -= tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
-
- rtc_outb(bin2bcd(tm%60)); tm /= 60; /* Write back Seconds */
- rtc_outb(bin2bcd(tm%60)); tm /= 60; /* Write back Minutes */
- rtc_outb(bin2bcd(tm%24)); tm /= 24; /* Write back Hours */
-
- /* We have now the days since 01-01-1970 in tm */
- wd = (tm + 4) % 7 + 1; /* Write back Weekday */
- for (y = 1970, m = DAYSPERYEAR + LEAPYEAR(y);
- tm >= m;
- y++, m = DAYSPERYEAR + LEAPYEAR(y))
- tm -= m;
-
- /* Now we have the years in y and the day-of-the-year in tm */
- for (m = 0; ; m++) {
- int ml;
-
- ml = daysinmonth[m];
- if (m == 1 && LEAPYEAR(y))
- ml++;
- if (tm < ml)
- break;
- tm -= ml;
- }
-
- m++;
- rtc_outb(bin2bcd(tm+1)); /* Write back Day */
- rtc_outb((m << 4) | wd); /* Write back Month & Weekday */
- rtc_outb(bin2bcd(y%100)); /* Write back Year */
-
- rtc_serialcom(0x02); /* Time set & Counter hold command. */
- rtc_serialcom(0x00); /* Register hold command. */
-}
-
-
-/*
- * Start both clocks running.
- */
-void
-cpu_initclocks()
-{
-
-#ifdef DEV_APIC
- using_lapic_timer = lapic_setup_clock();
-#endif
- /*
- * If we aren't using the local APIC timer to drive the kernel
- * clocks, setup the interrupt handler for the 8254 timer 0 so
- * that it can drive hardclock(). Otherwise, change the 8254
- * timecounter to user a simpler algorithm.
- */
- if (!using_lapic_timer) {
- intr_add_handler("clk", 0, (driver_intr_t *)clkintr, NULL,
- INTR_TYPE_CLK | INTR_FAST, NULL);
- i8254_intsrc = intr_lookup_source(0);
- if (i8254_intsrc != NULL)
- i8254_pending =
- i8254_intsrc->is_pic->pic_source_pending;
- } else {
- i8254_timecounter.tc_get_timecount =
- i8254_simple_get_timecount;
- i8254_timecounter.tc_counter_mask = 0xffff;
- set_timer_freq(timer_freq, hz);
- }
-
- init_TSC_tc();
-}
-
-void
-cpu_startprofclock(void)
-{
-}
-
-void
-cpu_stopprofclock(void)
-{
-}
-
-static int
-sysctl_machdep_i8254_freq(SYSCTL_HANDLER_ARGS)
-{
- int error;
- u_int freq;
-
- /*
- * Use `i8254' instead of `timer' in external names because `timer'
- * is is too generic. Should use it everywhere.
- */
- freq = timer_freq;
- error = sysctl_handle_int(oidp, &freq, sizeof(freq), req);
- if (error == 0 && req->newptr != NULL)
- set_timer_freq(freq, hz);
- return (error);
-}
-
-SYSCTL_PROC(_machdep, OID_AUTO, i8254_freq, CTLTYPE_INT | CTLFLAG_RW,
- 0, sizeof(u_int), sysctl_machdep_i8254_freq, "IU", "");
-
-static unsigned
-i8254_simple_get_timecount(struct timecounter *tc)
-{
- u_int count;
- u_int high, low;
-
- mtx_lock_spin(&clock_lock);
-
- /* Select timer0 and latch counter value. */
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
-
- low = inb(TIMER_CNTR0);
- high = inb(TIMER_CNTR0);
- count = 0xffff - ((high << 8) | low);
- mtx_unlock_spin(&clock_lock);
- return (count);
-}
-
-static unsigned
-i8254_get_timecount(struct timecounter *tc)
-{
- u_int count;
- u_int high, low;
- u_int eflags;
-
- eflags = read_eflags();
- mtx_lock_spin(&clock_lock);
-
- /* Select timer0 and latch counter value. */
- outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
-
- low = inb(TIMER_CNTR0);
- high = inb(TIMER_CNTR0);
- count = timer0_max_count - ((high << 8) | low);
- if (count < i8254_lastcount ||
- (!i8254_ticked && (clkintr_pending ||
- ((count < 20 || (!(eflags & PSL_I) && count < timer0_max_count / 2u)) &&
- i8254_pending != NULL && i8254_pending(i8254_intsrc))))) {
- i8254_ticked = 1;
- i8254_offset += timer0_max_count;
- }
- i8254_lastcount = count;
- count += i8254_offset;
- mtx_unlock_spin(&clock_lock);
- return (count);
-}
-
-#ifdef DEV_ISA
-/*
- * Attach to the ISA PnP descriptors for the timer and realtime clock.
- */
-static struct isa_pnp_id attimer_ids[] = {
- { 0x0001d041 /* PNP0100 */, "AT timer" },
- { 0x000bd041 /* PNP0B00 */, "AT realtime clock" },
- { 0 }
-};
-
-static int
-attimer_probe(device_t dev)
-{
- int result;
-
- if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, attimer_ids)) <= 0)
- device_quiet(dev);
- return(result);
-}
-
-static int
-attimer_attach(device_t dev)
-{
- return(0);
-}
-
-static device_method_t attimer_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, attimer_probe),
- DEVMETHOD(device_attach, attimer_attach),
- DEVMETHOD(device_detach, bus_generic_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend), /* XXX stop statclock? */
- DEVMETHOD(device_resume, bus_generic_resume), /* XXX restart statclock? */
- { 0, 0 }
-};
-
-static driver_t attimer_driver = {
- "attimer",
- attimer_methods,
- 1, /* no softc */
-};
-
-static devclass_t attimer_devclass;
-
-DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
-#endif /* DEV_ISA */
diff --git a/sys/powerpc/aim/clock.c b/sys/powerpc/aim/clock.c
deleted file mode 100644
index 8d738ec..0000000
--- a/sys/powerpc/aim/clock.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*-
- * Copyright (C) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 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.
- *
- * $NetBSD: clock.c,v 1.9 2000/01/19 02:52:19 msaitoh Exp $
- */
-/*
- * Copyright (C) 2001 Benno Rice.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
- * 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/sysctl.h>
-#include <sys/bus.h>
-#include <sys/timetc.h>
-#include <sys/interrupt.h>
-
-#include <dev/ofw/openfirm.h>
-
-#include <machine/clock.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-#include <machine/md_var.h>
-
-/*
- * Initially we assume a processor with a bus frequency of 12.5 MHz.
- */
-u_int tickspending;
-u_long ns_per_tick = 80;
-static u_long ticks_per_sec = 12500000;
-static long ticks_per_intr;
-static volatile u_long lasttb;
-
-static int sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS);
-
-int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
-SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
- CTLFLAG_RW, &wall_cmos_clock, 0, "");
-
-int adjkerntz; /* local offset from GMT in seconds */
-SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz, CTLTYPE_INT|CTLFLAG_RW,
- &adjkerntz, 0, sysctl_machdep_adjkerntz, "I", "");
-
-#define SECDAY 86400
-#define DIFF19041970 2082844800
-
-static int clockinitted = 0;
-
-static timecounter_get_t decr_get_timecount;
-
-static struct timecounter decr_timecounter = {
- decr_get_timecount, /* get_timecount */
- 0, /* no poll_pps */
- ~0u, /* counter_mask */
- 0, /* frequency */
- "decrementer" /* name */
-};
-
-static int
-sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS)
-{
- int error;
-
- error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
- if (!error && req->newptr)
- resettodr();
- return (error);
-}
-
-void
-inittodr(time_t base)
-{
- time_t deltat;
- u_int rtc_time;
- struct timespec ts;
- phandle_t phandle;
- ihandle_t ihandle;
- char rtcpath[128];
- u_int rtcsecs;
-
- /*
- * If we can't read from RTC, use the fs time.
- */
- phandle = OF_finddevice("rtc");
- if (phandle != -1) {
- OF_package_to_path(phandle, rtcpath, sizeof(rtcpath));
- ihandle = OF_open(rtcpath);
- if (ihandle != -1) {
- if (OF_call_method("read-rtc", ihandle,
- 0, 1, &rtcsecs))
- printf("RTC call method error\n");
- else {
- ts.tv_sec = rtcsecs - DIFF19041970;
- ts.tv_nsec = 0;
- tc_setclock(&ts);
- return;
- }
- }
- }
-
- {
- ts.tv_sec = base;
- ts.tv_nsec = 0;
- tc_setclock(&ts);
- return;
- }
- clockinitted = 1;
- ts.tv_sec = rtc_time - DIFF19041970;
-
- deltat = ts.tv_sec - base;
- if (deltat < 0) {
- deltat = -deltat;
- }
- if (deltat < 2 * SECDAY) {
- tc_setclock(&ts);
- return;
- }
-
- printf("WARNING: clock %s %d days",
- ts.tv_sec < base ? "lost" : "gained", (int)(deltat / SECDAY));
-
- printf(" -- CHECK AND RESET THE DATE!\n");
-}
-
-/*
- * Similar to the above
- */
-void
-resettodr()
-{
-
-}
-
-void
-decr_intr(struct clockframe *frame)
-{
- u_long tb;
- long tick;
- int nticks;
-
- /*
- * Check whether we are initialized.
- */
- if (!ticks_per_intr)
- return;
-
- /*
- * Based on the actual time delay since the last decrementer reload,
- * we arrange for earlier interrupt next time.
- */
- __asm ("mftb %0; mfdec %1" : "=r"(tb), "=r"(tick));
- for (nticks = 0; tick < 0; nticks++)
- tick += ticks_per_intr;
- mtdec(tick);
- /*
- * lasttb is used during microtime. Set it to the virtual
- * start of this tick interval.
- */
- lasttb = tb + tick - ticks_per_intr;
-
- nticks += tickspending;
- tickspending = 0;
-
- /*
- * Reenable interrupts
- */
-#if 0
- msr = mfmsr();
- mtmsr(msr | PSL_EE | PSL_RI);
-#endif
- /*
- * Do standard timer interrupt stuff.
- * Do softclock stuff only on the last iteration.
- */
-#if 0
- while (--nticks > 0) {
- hardclock(frame);
- }
-#endif
- hardclock(frame);
-}
-
-void
-cpu_initclocks(void)
-{
-
- return;
-}
-
-void
-decr_init(void)
-{
- int qhandle, phandle;
- char name[32];
- unsigned int msr;
-
- phandle = 0;
-
- /*
- * Get this info during autoconf? XXX
- */
- for (qhandle = OF_peer(0); qhandle; qhandle = phandle) {
- if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0
- && !strcmp(name, "cpu")
- && OF_getprop(qhandle, "timebase-frequency",
- &ticks_per_sec, sizeof ticks_per_sec) >= 0) {
- /*
- * Should check for correct CPU here? XXX
- */
- msr = mfmsr();
- mtmsr(msr & ~(PSL_EE|PSL_RI));
-
- decr_timecounter.tc_frequency = ticks_per_sec;
- tc_init(&decr_timecounter);
-
- ns_per_tick = 1000000000 / ticks_per_sec;
- ticks_per_intr = ticks_per_sec / hz;
- __asm __volatile ("mftb %0" : "=r"(lasttb));
- mtdec(ticks_per_intr);
-
- mtmsr(msr);
-
- break;
- }
- if ((phandle = OF_child(qhandle)))
- continue;
- while (qhandle) {
- if ((phandle = OF_peer(qhandle)))
- break;
- qhandle = OF_parent(qhandle);
- }
- }
- if (!phandle)
- panic("no cpu node");
-}
-
-static __inline u_quad_t
-mftb(void)
-{
- u_long scratch;
- u_quad_t tb;
-
- __asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw 0,%0,%1; bne 1b"
- : "=r"(tb), "=r"(scratch));
- return tb;
-}
-
-static unsigned
-decr_get_timecount(struct timecounter *tc)
-{
- return mftb();
-}
-
-/*
- * Wait for about n microseconds (at least!).
- */
-void
-DELAY(int n)
-{
- u_quad_t tb, ttb;
-
- tb = mftb();
- ttb = tb + (n * 1000 + ns_per_tick - 1) / ns_per_tick;
- while (tb < ttb)
- tb = mftb();
-}
-
-/*
- * Nothing to do.
- */
-void
-cpu_startprofclock(void)
-{
-
- /* Do nothing */
-}
-
-void
-cpu_stopprofclock(void)
-{
-}
-
-/*
- * XXX Needed by syscons
- */
-int
-sysbeep(int pitch, int period)
-{
-
- return (0);
-}
diff --git a/sys/powerpc/aim/copyinout.c b/sys/powerpc/aim/copyinout.c
deleted file mode 100644
index 7fa91ce..0000000
--- a/sys/powerpc/aim/copyinout.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*-
- * Copyright (C) 2002 Benno Rice
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
- * 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.
-*/
-/*-
- * 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <vm/vm_map.h>
-
-#include <machine/pcb.h>
-#include <machine/sr.h>
-
-int setfault(faultbuf); /* defined in locore.S */
-
-/*
- * Makes sure that the right segment of userspace is mapped in.
- */
-static __inline void
-set_user_sr(register_t vsid)
-{
-
- isync();
- __asm __volatile ("mtsr %0,%1" :: "n"(USER_SR), "r"(vsid));
- isync();
-}
-
-int
-copyout(const void *kaddr, void *udaddr, size_t len)
-{
- struct thread *td;
- pmap_t pm;
- faultbuf env;
- const char *kp;
- char *up, *p;
- size_t l;
-
- td = PCPU_GET(curthread);
- pm = &td->td_proc->p_vmspace->vm_pmap;
-
- if (setfault(env)) {
- td->td_pcb->pcb_onfault = NULL;
- return (EFAULT);
- }
-
- kp = kaddr;
- up = udaddr;
-
- while (len > 0) {
- p = (char *)USER_ADDR + ((u_int)up & ~SEGMENT_MASK);
-
- l = ((char *)USER_ADDR + SEGMENT_LENGTH) - p;
- if (l > len)
- l = len;
-
- set_user_sr(pm->pm_sr[(u_int)up >> ADDR_SR_SHFT]);
-
- bcopy(kp, p, l);
-
- up += l;
- kp += l;
- len -= l;
- }
-
- td->td_pcb->pcb_onfault = NULL;
- return (0);
-}
-
-int
-copyin(const void *udaddr, void *kaddr, size_t len)
-{
- struct thread *td;
- pmap_t pm;
- faultbuf env;
- const char *up;
- char *kp, *p;
- size_t l;
-
- td = PCPU_GET(curthread);
- pm = &td->td_proc->p_vmspace->vm_pmap;
-
- if (setfault(env)) {
- td->td_pcb->pcb_onfault = NULL;
- return (EFAULT);
- }
-
- kp = kaddr;
- up = udaddr;
-
- while (len > 0) {
- p = (char *)USER_ADDR + ((u_int)up & ~SEGMENT_MASK);
-
- l = ((char *)USER_ADDR + SEGMENT_LENGTH) - p;
- if (l > len)
- l = len;
-
- set_user_sr(pm->pm_sr[(u_int)up >> ADDR_SR_SHFT]);
-
- bcopy(p, kp, l);
-
- up += l;
- kp += l;
- len -= l;
- }
-
- td->td_pcb->pcb_onfault = NULL;
- return (0);
-}
-
-int
-copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done)
-{
- struct thread *td;
- pmap_t pm;
- faultbuf env;
- const char *up;
- char *kp;
- size_t l;
- int rv, c;
-
- td = PCPU_GET(curthread);
- pm = &td->td_proc->p_vmspace->vm_pmap;
-
- if (setfault(env)) {
- td->td_pcb->pcb_onfault = NULL;
- return (EFAULT);
- }
-
- kp = kaddr;
- up = udaddr;
-
- rv = ENAMETOOLONG;
-
- for (l = 0; len-- > 0; l++) {
- if ((c = fubyte(up++)) < 0) {
- rv = EFAULT;
- break;
- }
-
- if (!(*kp++ = c)) {
- l++;
- rv = 0;
- break;
- }
- }
-
- if (done != NULL) {
- *done = l;
- }
-
- td->td_pcb->pcb_onfault = NULL;
- return (rv);
-}
-
-int
-subyte(void *addr, int byte)
-{
- struct thread *td;
- pmap_t pm;
- faultbuf env;
- char *p;
-
- td = PCPU_GET(curthread);
- pm = &td->td_proc->p_vmspace->vm_pmap;
- p = (char *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK));
-
- if (setfault(env)) {
- td->td_pcb->pcb_onfault = NULL;
- return (-1);
- }
-
- set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]);
-
- *p = (char)byte;
-
- td->td_pcb->pcb_onfault = NULL;
- return (0);
-}
-
-int
-suword(void *addr, long word)
-{
- struct thread *td;
- pmap_t pm;
- faultbuf env;
- long *p;
-
- td = PCPU_GET(curthread);
- pm = &td->td_proc->p_vmspace->vm_pmap;
- p = (long *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK));
-
- if (setfault(env)) {
- td->td_pcb->pcb_onfault = NULL;
- return (-1);
- }
-
- set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]);
-
- *p = word;
-
- td->td_pcb->pcb_onfault = NULL;
- return (0);
-}
-
-int
-suword32(void *addr, int32_t word)
-{
- return (suword(addr, (long)word));
-}
-
-
-int
-fubyte(const void *addr)
-{
- struct thread *td;
- pmap_t pm;
- faultbuf env;
- u_char *p;
- int val;
-
- td = PCPU_GET(curthread);
- pm = &td->td_proc->p_vmspace->vm_pmap;
- p = (u_char *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK));
-
- if (setfault(env)) {
- td->td_pcb->pcb_onfault = NULL;
- return (-1);
- }
-
- set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]);
-
- val = *p;
-
- td->td_pcb->pcb_onfault = NULL;
- return (val);
-}
-
-long
-fuword(const void *addr)
-{
- struct thread *td;
- pmap_t pm;
- faultbuf env;
- long *p, val;
-
- td = PCPU_GET(curthread);
- pm = &td->td_proc->p_vmspace->vm_pmap;
- p = (long *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK));
-
- if (setfault(env)) {
- td->td_pcb->pcb_onfault = NULL;
- return (-1);
- }
-
- set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]);
-
- val = *p;
-
- td->td_pcb->pcb_onfault = NULL;
- return (val);
-}
-
-int32_t
-fuword32(const void *addr)
-{
- return ((int32_t)fuword(addr));
-}
-
-intptr_t
-casuptr(intptr_t *addr, intptr_t old, intptr_t new)
-{
- struct thread *td;
- pmap_t pm;
- faultbuf env;
- intptr_t *p, val;
-
- td = PCPU_GET(curthread);
- pm = &td->td_proc->p_vmspace->vm_pmap;
- p = (intptr_t *)((u_int)USER_ADDR + ((u_int)addr & ~SEGMENT_MASK));
-
- set_user_sr(pm->pm_sr[(u_int)addr >> ADDR_SR_SHFT]);
-
- if (setfault(env)) {
- td->td_pcb->pcb_onfault = NULL;
- return (-1);
- }
-
- val = *p;
- (void) atomic_cmpset_32(p, old, new);
-
- td->td_pcb->pcb_onfault = NULL;
-
- return (val);
-}
diff --git a/sys/powerpc/aim/interrupt.c b/sys/powerpc/aim/interrupt.c
deleted file mode 100644
index 08a43b7..0000000
--- a/sys/powerpc/aim/interrupt.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*-
- * Copyright 2002 by Peter Grehan. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * $FreeBSD$
- */
-
-/*
- * Interrupts are dispatched to here from locore asm
- */
-
-#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/interrupt.h>
-#include <sys/kernel.h>
-#include <sys/kthread.h>
-#include <sys/ktr.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/smp.h>
-#include <sys/unistd.h>
-#include <sys/vmmeter.h>
-
-#include <machine/cpu.h>
-#include <machine/db_machdep.h>
-#include <machine/fpu.h>
-#include <machine/frame.h>
-#include <machine/pcb.h>
-#include <machine/psl.h>
-#include <machine/trap.h>
-#include <machine/spr.h>
-#include <machine/sr.h>
-#include <machine/interruptvar.h>
-
-void powerpc_interrupt(struct trapframe *);
-
-/*
- * External interrupt install routines
- */
-static void (*powerpc_extintr_handler)(void);
-
-void
-ext_intr_install(void (*new_extint)(void))
-{
- powerpc_extintr_handler = new_extint;
-}
-
-extern void decr_intr(struct clockframe *);
-extern void trap(struct trapframe *);
-
-/*
- * A very short dispatch, to try and maximise assembler code use
- * between all exception types. Maybe 'true' interrupts should go
- * here, and the trap code can come in separately
- */
-void
-powerpc_interrupt(struct trapframe *framep)
-{
- struct thread *td;
- struct clockframe ckframe;
-
- td = curthread;
-
- switch (framep->exc) {
- case EXC_EXI:
- atomic_add_int(&td->td_intr_nesting_level, 1);
- (*powerpc_extintr_handler)();
- atomic_subtract_int(&td->td_intr_nesting_level, 1);
- break;
-
- case EXC_DECR:
- atomic_add_int(&td->td_intr_nesting_level, 1);
- ckframe.srr0 = framep->srr0;
- ckframe.srr1 = framep->srr1;
- decr_intr(&ckframe);
- atomic_subtract_int(&td->td_intr_nesting_level, 1);
- break;
-
- default:
- /*
- * Re-enable interrupts and call the generic trap code
- */
-#if 0
- printf("powerpc_interrupt: got trap\n");
- mtmsr(mfmsr() | PSL_EE);
- isync();
-#endif
- trap(framep);
- }
-}
diff --git a/sys/powerpc/aim/locore.S b/sys/powerpc/aim/locore.S
deleted file mode 100644
index f4a2379..0000000
--- a/sys/powerpc/aim/locore.S
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $FreeBSD$ */
-/* $NetBSD: locore.S,v 1.24 2000/05/31 05:09:17 thorpej Exp $ */
-
-/*-
- * Copyright (C) 2001 Benno Rice
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
- * 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.
- */
-/*-
- * Copyright (C) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 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 "assym.s"
-
-#include <sys/syscall.h>
-
-#include <machine/trap.h>
-#include <machine/param.h>
-#include <machine/sr.h>
-#include <machine/spr.h>
-#include <machine/psl.h>
-#include <machine/asm.h>
-
-/* Locate the per-CPU data structure */
-#define GET_CPUINFO(r) \
- mfsprg0 r
-
-/*
- * Globals
- */
- .data
-GLOBAL(tmpstk)
- .space 8208
-GLOBAL(esym)
- .long 0 /* end of symbol table */
-
-GLOBAL(ofmsr)
- .long 0 /* msr used in Open Firmware */
-
-GLOBAL(powersave)
- .long 0
-
-#define INTSTK 16384 /* 16K interrupt stack */
-#define INTRCNT_COUNT 256 /* max(HROWPIC_IRQMAX,OPENPIC_IRQMAX) */
-GLOBAL(intrnames)
- .space INTRCNT_COUNT * (MAXCOMLEN + 1) * 2
-GLOBAL(eintrnames)
- .align 4
-GLOBAL(intrcnt)
- .space INTRCNT_COUNT * 4 * 2
-GLOBAL(eintrcnt)
-
-/*
- * File-scope for locore.S
- */
-idle_u:
- .long 0 /* fake uarea during idle after exit */
-openfirmware_entry:
- .long 0 /* Open Firmware entry point */
-srsave:
- .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
-/*
- * This symbol is here for the benefit of kvm_mkdb, and is supposed to
- * mark the start of kernel text.
- */
- .text
- .globl kernel_text
-kernel_text:
-
-/*
- * Startup entry. Note, this must be the first thing in the text
- * segment!
- */
- .text
- .globl __start
-__start:
-#ifdef FIRMWORKSBUGS
- mfmsr 0
- andi. 0,0,PSL_IR|PSL_DR
- beq 1f
-
- bl ofwr_init
-1:
-#endif
- li 8,0
- li 9,0x100
- mtctr 9
-1:
- dcbf 0,8
- icbi 0,8
- addi 8,8,0x20
- bdnz 1b
- sync
- isync
-
- /* Save the argument pointer and length */
- mr 20,6
- mr 21,7
-
- lis 8,openfirmware_entry@ha
- stw 5,openfirmware_entry@l(8) /* save client interface handler */
- mr 3,5
-
- lis 1,tmpstk@ha
- addi 1,1,tmpstk@l
- addi 1,1,8192
-
- mfmsr 0
- lis 9,ofmsr@ha
- stw 0,ofmsr@l(9)
-
- bl OF_init
-
- lis 4,end@ha
- addi 4,4,end@l
- mr 5,4
-
- lis 3,kernel_text@ha
- addi 3,3,kernel_text@l
-
- /* Restore the argument pointer and length */
- mr 6,20
- mr 7,21
-
- bl powerpc_init
- bl mi_startup
- b OF_exit
-
-/*
- * int setfault()
- *
- * Similar to setjmp to setup for handling faults on accesses to user memory.
- * Any routine using this may only call bcopy, either the form below,
- * or the (currently used) C code optimized, so it doesn't use any non-volatile
- * registers.
- */
- .globl setfault
-setfault:
- mflr 0
- mfcr 12
- mfsprg 4,0
- lwz 4,PC_CURTHREAD(4)
- lwz 4,TD_PCB(4)
- stw 3,PCB_ONFAULT(4)
- stw 0,0(3)
- stw 1,4(3)
- stw 2,8(3)
- stmw 12,12(3)
- xor 3,3,3
- blr
-
-#include <powerpc/powerpc/trap_subr.S>
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c
deleted file mode 100644
index 75b5918..0000000
--- a/sys/powerpc/aim/machdep.c
+++ /dev/null
@@ -1,989 +0,0 @@
-/*-
- * Copyright (C) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 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.
- */
-/*-
- * Copyright (C) 2001 Benno Rice
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
- * 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.
- * $NetBSD: machdep.c,v 1.74.2.1 2000/11/01 16:13:48 tv Exp $
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_compat.h"
-#include "opt_ddb.h"
-#include "opt_kstack_pages.h"
-#include "opt_msgbuf.h"
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/bus.h>
-#include <sys/cons.h>
-#include <sys/cpu.h>
-#include <sys/eventhandler.h>
-#include <sys/exec.h>
-#include <sys/imgact.h>
-#include <sys/kdb.h>
-#include <sys/kernel.h>
-#include <sys/ktr.h>
-#include <sys/linker.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/mutex.h>
-#include <sys/ptrace.h>
-#include <sys/reboot.h>
-#include <sys/signalvar.h>
-#include <sys/sysctl.h>
-#include <sys/sysent.h>
-#include <sys/sysproto.h>
-#include <sys/ucontext.h>
-#include <sys/uio.h>
-#include <sys/vmmeter.h>
-#include <sys/vnode.h>
-
-#include <net/netisr.h>
-
-#include <vm/vm.h>
-#include <vm/vm_extern.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <vm/vm_map.h>
-#include <vm/vm_object.h>
-#include <vm/vm_pager.h>
-
-#include <machine/bat.h>
-#include <machine/clock.h>
-#include <machine/cpu.h>
-#include <machine/elf.h>
-#include <machine/fpu.h>
-#include <machine/md_var.h>
-#include <machine/metadata.h>
-#include <machine/pcb.h>
-#include <machine/powerpc.h>
-#include <machine/reg.h>
-#include <machine/sigframe.h>
-#include <machine/trap.h>
-#include <machine/vmparam.h>
-
-#include <ddb/ddb.h>
-
-#include <dev/ofw/openfirm.h>
-
-#ifdef DDB
-extern vm_offset_t ksym_start, ksym_end;
-#endif
-
-int cold = 1;
-
-struct pcpu __pcpu[MAXCPU];
-struct trapframe frame0;
-
-vm_offset_t kstack0;
-vm_offset_t kstack0_phys;
-
-char machine[] = "powerpc";
-SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
-
-static char model[128];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, "");
-
-static int cacheline_size = CACHELINESIZE;
-SYSCTL_INT(_machdep, CPU_CACHELINE, cacheline_size,
- CTLFLAG_RD, &cacheline_size, 0, "");
-
-static void cpu_startup(void *);
-SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL)
-
-void powerpc_init(u_int, u_int, u_int, void *);
-
-int save_ofw_mapping(void);
-int restore_ofw_mapping(void);
-
-void install_extint(void (*)(void));
-
-int setfault(faultbuf); /* defined in locore.S */
-
-static int grab_mcontext(struct thread *, mcontext_t *, int);
-
-void asm_panic(char *);
-
-long Maxmem = 0;
-long realmem = 0;
-
-struct pmap ofw_pmap;
-extern int ofmsr;
-
-struct bat battable[16];
-
-struct kva_md_info kmi;
-
-static void
-powerpc_ofw_shutdown(void *junk, int howto)
-{
- if (howto & RB_HALT) {
- OF_halt();
- }
- OF_reboot();
-}
-
-static void
-cpu_startup(void *dummy)
-{
-
- /*
- * Initialise the decrementer-based clock.
- */
- decr_init();
-
- /*
- * Good {morning,afternoon,evening,night}.
- */
- cpu_setup(PCPU_GET(cpuid));
-
- /* startrtclock(); */
-#ifdef PERFMON
- perfmon_init();
-#endif
- printf("real memory = %ld (%ld MB)\n", ptoa(physmem),
- ptoa(physmem) / 1048576);
- realmem = physmem;
-
- /*
- * Display any holes after the first chunk of extended memory.
- */
- if (bootverbose) {
- int indx;
-
- printf("Physical memory chunk(s):\n");
- for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
- int size1 = phys_avail[indx + 1] - phys_avail[indx];
-
- printf("0x%08x - 0x%08x, %d bytes (%d pages)\n",
- phys_avail[indx], phys_avail[indx + 1] - 1, size1,
- size1 / PAGE_SIZE);
- }
- }
-
- vm_ksubmap_init(&kmi);
-
- printf("avail memory = %ld (%ld MB)\n", ptoa(cnt.v_free_count),
- ptoa(cnt.v_free_count) / 1048576);
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
- vm_pager_bufferinit();
-
- EVENTHANDLER_REGISTER(shutdown_final, powerpc_ofw_shutdown, 0,
- SHUTDOWN_PRI_LAST);
-
-#ifdef SMP
- /*
- * OK, enough kmem_alloc/malloc state should be up, lets get on with it!
- */
- mp_start(); /* fire up the secondaries */
- mp_announce();
-#endif /* SMP */
-}
-
-extern char kernel_text[], _end[];
-
-extern void *trapcode, *trapsize;
-extern void *alitrap, *alisize;
-extern void *dsitrap, *dsisize;
-extern void *decrint, *decrsize;
-extern void *extint, *extsize;
-extern void *dblow, *dbsize;
-
-void
-powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, void *mdp)
-{
- struct pcpu *pc;
- vm_offset_t end, off;
- void *kmdp;
- char *env;
-
- end = 0;
- kmdp = NULL;
-
- /*
- * Parse metadata if present and fetch parameters. Must be done
- * before console is inited so cninit gets the right value of
- * boothowto.
- */
- if (mdp != NULL) {
- preload_metadata = mdp;
- kmdp = preload_search_by_type("elf kernel");
- if (kmdp != NULL) {
- boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
- kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
- end = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t);
-#ifdef DDB
- ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t);
- ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t);
-#endif
- }
- }
-
- /*
- * Init params/tunables that can be overridden by the loader
- */
- init_param1();
-
- /*
- * Start initializing proc0 and thread0.
- */
- proc_linkup(&proc0, &ksegrp0, &thread0);
- thread0.td_frame = &frame0;
-
- /*
- * Set up per-cpu data.
- */
- pc = &__pcpu[0];
- pcpu_init(pc, 0, sizeof(struct pcpu));
- pc->pc_curthread = &thread0;
- pc->pc_curpcb = thread0.td_pcb;
- pc->pc_cpuid = 0;
-
- __asm __volatile("mtsprg 0, %0" :: "r"(pc));
-
- mutex_init();
-
- /*
- * Initialize the console before printing anything.
- */
- cninit();
-
- /*
- * Complain if there is no metadata.
- */
- if (mdp == NULL || kmdp == NULL) {
- printf("powerpc_init: no loader metadata.\n");
- }
-
- kdb_init();
-
- /*
- * XXX: Initialize the interrupt tables.
- * Disable translation in case the vector area
- * hasn't been mapped (G5)
- */
- mtmsr(mfmsr() & ~(PSL_IR | PSL_DR));
- isync();
- bcopy(&trapcode, (void *)EXC_RST, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_MCHK, (size_t)&trapsize);
- bcopy(&dsitrap, (void *)EXC_DSI, (size_t)&dsisize);
- bcopy(&trapcode, (void *)EXC_ISI, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_EXI, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_ALI, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_PGM, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_FPU, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_DECR, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_SC, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_TRC, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_FPA, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_THRM, (size_t)&trapsize);
- bcopy(&trapcode, (void *)EXC_BPT, (size_t)&trapsize);
-#ifdef KDB
- bcopy(&dblow, (void *)EXC_RST, (size_t)&dbsize);
- bcopy(&dblow, (void *)EXC_MCHK, (size_t)&dbsize);
- bcopy(&dblow, (void *)EXC_PGM, (size_t)&dbsize);
- bcopy(&dblow, (void *)EXC_TRC, (size_t)&dbsize);
- bcopy(&dblow, (void *)EXC_BPT, (size_t)&dbsize);
-#endif
- __syncicache(EXC_RSVD, EXC_LAST - EXC_RSVD);
-
- /*
- * Make sure translation has been enabled
- */
- mtmsr(mfmsr() | PSL_IR|PSL_DR|PSL_ME|PSL_RI);
- isync();
-
- /*
- * Initialise virtual memory.
- */
- pmap_bootstrap(startkernel, endkernel);
-
- /*
- * Initialize params/tunables that are derived from memsize
- */
- init_param2(physmem);
-
- /*
- * Grab booted kernel's name
- */
- env = getenv("kernelname");
- if (env != NULL) {
- strlcpy(kernelname, env, sizeof(kernelname));
- freeenv(env);
- }
-
- /*
- * Finish setting up thread0.
- */
- thread0.td_kstack = kstack0;
- thread0.td_pcb = (struct pcb *)
- (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
-
- /*
- * Map and initialise the message buffer.
- */
- for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE)
- pmap_kenter((vm_offset_t)msgbufp + off, msgbuf_phys + off);
- msgbufinit(msgbufp, MSGBUF_SIZE);
-
-#ifdef KDB
- if (boothowto & RB_KDB)
- kdb_enter("Boot flags requested debugger");
-#endif
-}
-
-void
-bzero(void *buf, size_t len)
-{
- caddr_t p;
-
- p = buf;
-
- while (((vm_offset_t) p & (sizeof(u_long) - 1)) && len) {
- *p++ = 0;
- len--;
- }
-
- while (len >= sizeof(u_long) * 8) {
- *(u_long*) p = 0;
- *((u_long*) p + 1) = 0;
- *((u_long*) p + 2) = 0;
- *((u_long*) p + 3) = 0;
- len -= sizeof(u_long) * 8;
- *((u_long*) p + 4) = 0;
- *((u_long*) p + 5) = 0;
- *((u_long*) p + 6) = 0;
- *((u_long*) p + 7) = 0;
- p += sizeof(u_long) * 8;
- }
-
- while (len >= sizeof(u_long)) {
- *(u_long*) p = 0;
- len -= sizeof(u_long);
- p += sizeof(u_long);
- }
-
- while (len) {
- *p++ = 0;
- len--;
- }
-}
-
-void
-sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
-{
- struct trapframe *tf;
- struct sigframe *sfp;
- struct sigacts *psp;
- struct sigframe sf;
- struct thread *td;
- struct proc *p;
- int oonstack, rndfsize;
-
- td = curthread;
- p = td->td_proc;
- PROC_LOCK_ASSERT(p, MA_OWNED);
- psp = p->p_sigacts;
- mtx_assert(&psp->ps_mtx, MA_OWNED);
- tf = td->td_frame;
- oonstack = sigonstack(tf->fixreg[1]);
-
- rndfsize = ((sizeof(sf) + 15) / 16) * 16;
-
- CTR4(KTR_SIG, "sendsig: td=%p (%s) catcher=%p sig=%d", td, p->p_comm,
- catcher, sig);
-
- /*
- * Save user context
- */
- memset(&sf, 0, sizeof(sf));
- grab_mcontext(td, &sf.sf_uc.uc_mcontext, 0);
- sf.sf_uc.uc_sigmask = *mask;
- sf.sf_uc.uc_stack = td->td_sigstk;
- sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
- ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
-
- sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
-
- /*
- * Allocate and validate space for the signal handler context.
- */
- if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
- SIGISMEMBER(psp->ps_sigonstack, sig)) {
- sfp = (struct sigframe *)((caddr_t)td->td_sigstk.ss_sp +
- td->td_sigstk.ss_size - rndfsize);
- } else {
- sfp = (struct sigframe *)(tf->fixreg[1] - rndfsize);
- }
-
- /*
- * Translate the signal if appropriate (Linux emu ?)
- */
- if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
- sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
-
- /*
- * Save the floating-point state, if necessary, then copy it.
- */
- /* XXX */
-
- /*
- * Set up the registers to return to sigcode.
- *
- * r1/sp - sigframe ptr
- * lr - sig function, dispatched to by blrl in trampoline
- * r3 - sig number
- * r4 - SIGINFO ? &siginfo : exception code
- * r5 - user context
- * srr0 - trampoline function addr
- */
- tf->lr = (register_t)catcher;
- tf->fixreg[1] = (register_t)sfp;
- tf->fixreg[FIRSTARG] = sig;
- tf->fixreg[FIRSTARG+2] = (register_t)&sfp->sf_uc;
- if (SIGISMEMBER(psp->ps_siginfo, sig)) {
- /*
- * Signal handler installed with SA_SIGINFO.
- */
- tf->fixreg[FIRSTARG+1] = (register_t)&sfp->sf_si;
-
- /*
- * Fill siginfo structure.
- */
- sf.sf_si.si_signo = sig;
- sf.sf_si.si_code = code;
- sf.sf_si.si_addr = (void *)tf->srr0;
- } else {
- /* Old FreeBSD-style arguments. */
- tf->fixreg[FIRSTARG+1] = code;
- }
- mtx_unlock(&psp->ps_mtx);
- PROC_UNLOCK(p);
-
- tf->srr0 = (register_t)(PS_STRINGS - *(p->p_sysent->sv_szsigcode));
-
- /*
- * copy the frame out to userland.
- */
- if (copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)) != 0) {
- /*
- * Process has trashed its stack. Kill it.
- */
- CTR2(KTR_SIG, "sendsig: sigexit td=%p sfp=%p", td, sfp);
- PROC_LOCK(p);
- sigexit(td, SIGILL);
- }
-
- CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td,
- tf->srr0, tf->fixreg[1]);
-
- PROC_LOCK(p);
- mtx_lock(&psp->ps_mtx);
-}
-
-/*
- * Build siginfo_t for SA thread
- */
-void
-cpu_thread_siginfo(int sig, u_long code, siginfo_t *si)
-{
- struct proc *p;
- struct thread *td;
-
- td = curthread;
- p = td->td_proc;
- PROC_LOCK_ASSERT(p, MA_OWNED);
-
- bzero(si, sizeof(*si));
- si->si_signo = sig;
- si->si_code = code;
- /* XXXKSE fill other fields */
-}
-
-int
-sigreturn(struct thread *td, struct sigreturn_args *uap)
-{
- struct proc *p;
- ucontext_t uc;
- int error;
-
- CTR2(KTR_SIG, "sigreturn: td=%p ucp=%p", td, uap->sigcntxp);
-
- if (copyin(uap->sigcntxp, &uc, sizeof(uc)) != 0) {
- CTR1(KTR_SIG, "sigreturn: efault td=%p", td);
- return (EFAULT);
- }
-
- error = set_mcontext(td, &uc.uc_mcontext);
- if (error != 0)
- return (error);
-
- p = td->td_proc;
- PROC_LOCK(p);
- td->td_sigmask = uc.uc_sigmask;
- SIG_CANTMASK(td->td_sigmask);
- signotify(td);
- PROC_UNLOCK(p);
-
- CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x",
- td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]);
-
- return (EJUSTRETURN);
-}
-
-#ifdef COMPAT_FREEBSD4
-int
-freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap)
-{
-
- return sigreturn(td, (struct sigreturn_args *)uap);
-}
-#endif
-
-/*
- * Construct a PCB from a trapframe. This is called from kdb_trap() where
- * we want to start a backtrace from the function that caused us to enter
- * the debugger. We have the context in the trapframe, but base the trace
- * on the PCB. The PCB doesn't have to be perfect, as long as it contains
- * enough for a backtrace.
- */
-void
-makectx(struct trapframe *tf, struct pcb *pcb)
-{
-
- pcb->pcb_lr = tf->srr0;
- pcb->pcb_sp = tf->fixreg[1];
-}
-
-/*
- * get_mcontext/sendsig helper routine that doesn't touch the
- * proc lock
- */
-static int
-grab_mcontext(struct thread *td, mcontext_t *mcp, int flags)
-{
- struct pcb *pcb;
-
- pcb = td->td_pcb;
-
- memset(mcp, 0, sizeof(mcontext_t));
-
- mcp->mc_vers = _MC_VERSION;
- mcp->mc_flags = 0;
- memcpy(&mcp->mc_frame, td->td_frame, sizeof(struct trapframe));
- if (flags & GET_MC_CLEAR_RET) {
- mcp->mc_gpr[3] = 0;
- mcp->mc_gpr[4] = 0;
- }
-
- /*
- * This assumes that floating-point context is *not* lazy,
- * so if the thread has used FP there would have been a
- * FP-unavailable exception that would have set things up
- * correctly.
- */
- if (pcb->pcb_flags & PCB_FPU) {
- KASSERT(td == curthread,
- ("get_mcontext: fp save not curthread"));
- critical_enter();
- save_fpu(td);
- critical_exit();
- mcp->mc_flags |= _MC_FP_VALID;
- memcpy(&mcp->mc_fpscr, &pcb->pcb_fpu.fpscr, sizeof(double));
- memcpy(mcp->mc_fpreg, pcb->pcb_fpu.fpr, 32*sizeof(double));
- }
-
- /* XXX Altivec context ? */
-
- mcp->mc_len = sizeof(*mcp);
-
- return (0);
-}
-
-int
-get_mcontext(struct thread *td, mcontext_t *mcp, int flags)
-{
- int error;
-
- error = grab_mcontext(td, mcp, flags);
- if (error == 0) {
- PROC_LOCK(curthread->td_proc);
- mcp->mc_onstack = sigonstack(td->td_frame->fixreg[1]);
- PROC_UNLOCK(curthread->td_proc);
- }
-
- return (error);
-}
-
-int
-set_mcontext(struct thread *td, const mcontext_t *mcp)
-{
- struct pcb *pcb;
- struct trapframe *tf;
-
- pcb = td->td_pcb;
- tf = td->td_frame;
-
- if (mcp->mc_vers != _MC_VERSION ||
- mcp->mc_len != sizeof(*mcp))
- return (EINVAL);
-
- /*
- * Don't let the user set privileged MSR bits
- */
- if ((mcp->mc_srr1 & PSL_USERSTATIC) != (tf->srr1 & PSL_USERSTATIC)) {
- return (EINVAL);
- }
-
- memcpy(tf, mcp->mc_frame, sizeof(mcp->mc_frame));
-
- if (mcp->mc_flags & _MC_FP_VALID) {
- if ((pcb->pcb_flags & PCB_FPU) != PCB_FPU) {
- critical_enter();
- enable_fpu(td);
- critical_exit();
- }
- memcpy(&pcb->pcb_fpu.fpscr, &mcp->mc_fpscr, sizeof(double));
- memcpy(pcb->pcb_fpu.fpr, mcp->mc_fpreg, 32*sizeof(double));
- }
-
- /* XXX Altivec context? */
-
- return (0);
-}
-
-void
-cpu_boot(int howto)
-{
-}
-
-/* Get current clock frequency for the given cpu id. */
-int
-cpu_est_clockrate(int cpu_id, uint64_t *rate)
-{
-
- return (ENXIO);
-}
-
-/*
- * Shutdown the CPU as much as possible.
- */
-void
-cpu_halt(void)
-{
-
- OF_exit();
-}
-
-void
-cpu_idle(void)
-{
- /* TODO: Insert code to halt (until next interrupt) */
-
-#ifdef INVARIANTS
- if ((mfmsr() & PSL_EE) != PSL_EE) {
- struct thread *td = curthread;
- printf("td msr %x\n", td->td_md.md_saved_msr);
- panic("ints disabled in idleproc!");
- }
-#endif
-}
-
-/*
- * Set set up registers on exec.
- */
-void
-exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings)
-{
- struct trapframe *tf;
- struct ps_strings arginfo;
-
- tf = trapframe(td);
- bzero(tf, sizeof *tf);
- tf->fixreg[1] = -roundup(-stack + 8, 16);
-
- /*
- * XXX Machine-independent code has already copied arguments and
- * XXX environment to userland. Get them back here.
- */
- (void)copyin((char *)PS_STRINGS, &arginfo, sizeof(arginfo));
-
- /*
- * Set up arguments for _start():
- * _start(argc, argv, envp, obj, cleanup, ps_strings);
- *
- * Notes:
- * - obj and cleanup are the auxilliary and termination
- * vectors. They are fixed up by ld.elf_so.
- * - ps_strings is a NetBSD extention, and will be
- * ignored by executables which are strictly
- * compliant with the SVR4 ABI.
- *
- * XXX We have to set both regs and retval here due to different
- * XXX calling convention in trap.c and init_main.c.
- */
- /*
- * XXX PG: these get overwritten in the syscall return code.
- * execve() should return EJUSTRETURN, like it does on NetBSD.
- * Emulate by setting the syscall return value cells. The
- * registers still have to be set for init's fork trampoline.
- */
- td->td_retval[0] = arginfo.ps_nargvstr;
- td->td_retval[1] = (register_t)arginfo.ps_argvstr;
- tf->fixreg[3] = arginfo.ps_nargvstr;
- tf->fixreg[4] = (register_t)arginfo.ps_argvstr;
- tf->fixreg[5] = (register_t)arginfo.ps_envstr;
- tf->fixreg[6] = 0; /* auxillary vector */
- tf->fixreg[7] = 0; /* termination vector */
- tf->fixreg[8] = (register_t)PS_STRINGS; /* NetBSD extension */
-
- tf->srr0 = entry;
- tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
- td->td_pcb->pcb_flags = 0;
-}
-
-int
-fill_regs(struct thread *td, struct reg *regs)
-{
- struct trapframe *tf;
-
- tf = td->td_frame;
- memcpy(regs, tf, sizeof(struct reg));
-
- return (0);
-}
-
-int
-fill_dbregs(struct thread *td, struct dbreg *dbregs)
-{
- /* No debug registers on PowerPC */
- return (ENOSYS);
-}
-
-int
-fill_fpregs(struct thread *td, struct fpreg *fpregs)
-{
- struct pcb *pcb;
-
- pcb = td->td_pcb;
-
- if ((pcb->pcb_flags & PCB_FPU) == 0)
- memset(fpregs, 0, sizeof(struct fpreg));
- else
- memcpy(fpregs, &pcb->pcb_fpu, sizeof(struct fpreg));
-
- return (0);
-}
-
-int
-set_regs(struct thread *td, struct reg *regs)
-{
- struct trapframe *tf;
-
- tf = td->td_frame;
- memcpy(tf, regs, sizeof(struct reg));
-
- return (0);
-}
-
-int
-set_dbregs(struct thread *td, struct dbreg *dbregs)
-{
- /* No debug registers on PowerPC */
- return (ENOSYS);
-}
-
-int
-set_fpregs(struct thread *td, struct fpreg *fpregs)
-{
- struct pcb *pcb;
-
- pcb = td->td_pcb;
- if ((pcb->pcb_flags & PCB_FPU) == 0)
- enable_fpu(td);
- memcpy(&pcb->pcb_fpu, fpregs, sizeof(struct fpreg));
-
- return (0);
-}
-
-int
-ptrace_set_pc(struct thread *td, unsigned long addr)
-{
- struct trapframe *tf;
-
- tf = td->td_frame;
- tf->srr0 = (register_t)addr;
-
- return (0);
-}
-
-int
-ptrace_single_step(struct thread *td)
-{
- struct trapframe *tf;
-
- tf = td->td_frame;
- tf->srr1 |= PSL_SE;
-
- return (0);
-}
-
-int
-ptrace_clear_single_step(struct thread *td)
-{
- struct trapframe *tf;
-
- tf = td->td_frame;
- tf->srr1 &= ~PSL_SE;
-
- return (0);
-}
-
-/*
- * Initialise a struct pcpu.
- */
-void
-cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz)
-{
-
-}
-
-void
-spinlock_enter(void)
-{
- struct thread *td;
-
- td = curthread;
- if (td->td_md.md_spinlock_count == 0)
- td->td_md.md_saved_msr = intr_disable();
- td->td_md.md_spinlock_count++;
- critical_enter();
-}
-
-void
-spinlock_exit(void)
-{
- struct thread *td;
-
- td = curthread;
- critical_exit();
- td->td_md.md_spinlock_count--;
- if (td->td_md.md_spinlock_count == 0)
- intr_restore(td->td_md.md_saved_msr);
-}
-
-/*
- * kcopy(const void *src, void *dst, size_t len);
- *
- * Copy len bytes from src to dst, aborting if we encounter a fatal
- * page fault.
- *
- * kcopy() _must_ save and restore the old fault handler since it is
- * called by uiomove(), which may be in the path of servicing a non-fatal
- * page fault.
- */
-int
-kcopy(const void *src, void *dst, size_t len)
-{
- struct thread *td;
- faultbuf env, *oldfault;
- int rv;
-
- td = PCPU_GET(curthread);
- oldfault = td->td_pcb->pcb_onfault;
- if ((rv = setfault(env)) != 0) {
- td->td_pcb->pcb_onfault = oldfault;
- return rv;
- }
-
- memcpy(dst, src, len);
-
- td->td_pcb->pcb_onfault = oldfault;
- return (0);
-}
-
-void
-asm_panic(char *pstr)
-{
- panic(pstr);
-}
-
-int db_trap_glue(struct trapframe *); /* Called from trap_subr.S */
-
-int
-db_trap_glue(struct trapframe *frame)
-{
- if (!(frame->srr1 & PSL_PR)
- && (frame->exc == EXC_TRC || frame->exc == EXC_RUNMODETRC
- || (frame->exc == EXC_PGM
- && (frame->srr1 & 0x20000))
- || frame->exc == EXC_BPT
- || frame->exc == EXC_DSI)) {
- int type = frame->exc;
- if (type == EXC_PGM && (frame->srr1 & 0x20000)) {
- type = T_BREAKPOINT;
- }
- return (kdb_trap(type, 0, frame));
- }
-
- return (0);
-}
diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c
deleted file mode 100644
index 2ea798d..0000000
--- a/sys/powerpc/aim/mmu_oea.c
+++ /dev/null
@@ -1,2476 +0,0 @@
-/*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Matt Thomas <matt@3am-software.com> of Allegro Networks, 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 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) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 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.
- *
- * $NetBSD: pmap.c,v 1.28 2000/03/26 20:42:36 kleink Exp $
- */
-/*-
- * Copyright (C) 2001 Benno Rice.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
- * 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * 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
- * 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
- * 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 "opt_kstack_pages.h"
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/ktr.h>
-#include <sys/lock.h>
-#include <sys/msgbuf.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/sysctl.h>
-#include <sys/systm.h>
-#include <sys/vmmeter.h>
-
-#include <dev/ofw/openfirm.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <vm/vm_map.h>
-#include <vm/vm_object.h>
-#include <vm/vm_extern.h>
-#include <vm/vm_pageout.h>
-#include <vm/vm_pager.h>
-#include <vm/uma.h>
-
-#include <machine/cpu.h>
-#include <machine/powerpc.h>
-#include <machine/bat.h>
-#include <machine/frame.h>
-#include <machine/md_var.h>
-#include <machine/psl.h>
-#include <machine/pte.h>
-#include <machine/sr.h>
-
-#define PMAP_DEBUG
-
-#define TODO panic("%s: not implemented", __func__);
-
-#define TLBIE(va) __asm __volatile("tlbie %0" :: "r"(va))
-#define TLBSYNC() __asm __volatile("tlbsync");
-#define SYNC() __asm __volatile("sync");
-#define EIEIO() __asm __volatile("eieio");
-
-#define VSID_MAKE(sr, hash) ((sr) | (((hash) & 0xfffff) << 4))
-#define VSID_TO_SR(vsid) ((vsid) & 0xf)
-#define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff)
-
-#define PVO_PTEGIDX_MASK 0x007 /* which PTEG slot */
-#define PVO_PTEGIDX_VALID 0x008 /* slot is valid */
-#define PVO_WIRED 0x010 /* PVO entry is wired */
-#define PVO_MANAGED 0x020 /* PVO entry is managed */
-#define PVO_EXECUTABLE 0x040 /* PVO entry is executable */
-#define PVO_BOOTSTRAP 0x080 /* PVO entry allocated during
- bootstrap */
-#define PVO_FAKE 0x100 /* fictitious phys page */
-#define PVO_VADDR(pvo) ((pvo)->pvo_vaddr & ~ADDR_POFF)
-#define PVO_ISEXECUTABLE(pvo) ((pvo)->pvo_vaddr & PVO_EXECUTABLE)
-#define PVO_ISFAKE(pvo) ((pvo)->pvo_vaddr & PVO_FAKE)
-#define PVO_PTEGIDX_GET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK)
-#define PVO_PTEGIDX_ISSET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID)
-#define PVO_PTEGIDX_CLR(pvo) \
- ((void)((pvo)->pvo_vaddr &= ~(PVO_PTEGIDX_VALID|PVO_PTEGIDX_MASK)))
-#define PVO_PTEGIDX_SET(pvo, i) \
- ((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID))
-
-#define PMAP_PVO_CHECK(pvo)
-
-struct ofw_map {
- vm_offset_t om_va;
- vm_size_t om_len;
- vm_offset_t om_pa;
- u_int om_mode;
-};
-
-int pmap_bootstrapped = 0;
-
-/*
- * Virtual and physical address of message buffer.
- */
-struct msgbuf *msgbufp;
-vm_offset_t msgbuf_phys;
-
-int pmap_pagedaemon_waken;
-
-/*
- * Map of physical memory regions.
- */
-vm_offset_t phys_avail[128];
-u_int phys_avail_count;
-static struct mem_region *regions;
-static struct mem_region *pregions;
-int regions_sz, pregions_sz;
-static struct ofw_map *translations;
-
-/*
- * First and last available kernel virtual addresses.
- */
-vm_offset_t virtual_avail;
-vm_offset_t virtual_end;
-vm_offset_t kernel_vm_end;
-
-/*
- * Kernel pmap.
- */
-struct pmap kernel_pmap_store;
-extern struct pmap ofw_pmap;
-
-/*
- * Lock for the pteg and pvo tables.
- */
-struct mtx pmap_table_mutex;
-
-/*
- * PTEG data.
- */
-static struct pteg *pmap_pteg_table;
-u_int pmap_pteg_count;
-u_int pmap_pteg_mask;
-
-/*
- * PVO data.
- */
-struct pvo_head *pmap_pvo_table; /* pvo entries by pteg index */
-struct pvo_head pmap_pvo_kunmanaged =
- LIST_HEAD_INITIALIZER(pmap_pvo_kunmanaged); /* list of unmanaged pages */
-struct pvo_head pmap_pvo_unmanaged =
- LIST_HEAD_INITIALIZER(pmap_pvo_unmanaged); /* list of unmanaged pages */
-
-uma_zone_t pmap_upvo_zone; /* zone for pvo entries for unmanaged pages */
-uma_zone_t pmap_mpvo_zone; /* zone for pvo entries for managed pages */
-
-#define BPVO_POOL_SIZE 32768
-static struct pvo_entry *pmap_bpvo_pool;
-static int pmap_bpvo_pool_index = 0;
-
-#define VSID_NBPW (sizeof(u_int32_t) * 8)
-static u_int pmap_vsid_bitmap[NPMAPS / VSID_NBPW];
-
-static boolean_t pmap_initialized = FALSE;
-
-/*
- * Statistics.
- */
-u_int pmap_pte_valid = 0;
-u_int pmap_pte_overflow = 0;
-u_int pmap_pte_replacements = 0;
-u_int pmap_pvo_entries = 0;
-u_int pmap_pvo_enter_calls = 0;
-u_int pmap_pvo_remove_calls = 0;
-u_int pmap_pte_spills = 0;
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pte_valid, CTLFLAG_RD, &pmap_pte_valid,
- 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pte_overflow, CTLFLAG_RD,
- &pmap_pte_overflow, 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pte_replacements, CTLFLAG_RD,
- &pmap_pte_replacements, 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pvo_entries, CTLFLAG_RD, &pmap_pvo_entries,
- 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pvo_enter_calls, CTLFLAG_RD,
- &pmap_pvo_enter_calls, 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pvo_remove_calls, CTLFLAG_RD,
- &pmap_pvo_remove_calls, 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pte_spills, CTLFLAG_RD,
- &pmap_pte_spills, 0, "");
-
-struct pvo_entry *pmap_pvo_zeropage;
-
-vm_offset_t pmap_rkva_start = VM_MIN_KERNEL_ADDRESS;
-u_int pmap_rkva_count = 4;
-
-/*
- * Allocate physical memory for use in pmap_bootstrap.
- */
-static vm_offset_t pmap_bootstrap_alloc(vm_size_t, u_int);
-
-/*
- * PTE calls.
- */
-static int pmap_pte_insert(u_int, struct pte *);
-
-/*
- * PVO calls.
- */
-static int pmap_pvo_enter(pmap_t, uma_zone_t, struct pvo_head *,
- vm_offset_t, vm_offset_t, u_int, int);
-static void pmap_pvo_remove(struct pvo_entry *, int);
-static struct pvo_entry *pmap_pvo_find_va(pmap_t, vm_offset_t, int *);
-static struct pte *pmap_pvo_to_pte(const struct pvo_entry *, int);
-
-/*
- * Utility routines.
- */
-static struct pvo_entry *pmap_rkva_alloc(void);
-static void pmap_pa_map(struct pvo_entry *, vm_offset_t,
- struct pte *, int *);
-static void pmap_pa_unmap(struct pvo_entry *, struct pte *, int *);
-static void pmap_syncicache(vm_offset_t, vm_size_t);
-static boolean_t pmap_query_bit(vm_page_t, int);
-static u_int pmap_clear_bit(vm_page_t, int, int *);
-static void tlbia(void);
-
-static __inline int
-va_to_sr(u_int *sr, vm_offset_t va)
-{
- return (sr[(uintptr_t)va >> ADDR_SR_SHFT]);
-}
-
-static __inline u_int
-va_to_pteg(u_int sr, vm_offset_t addr)
-{
- u_int hash;
-
- hash = (sr & SR_VSID_MASK) ^ (((u_int)addr & ADDR_PIDX) >>
- ADDR_PIDX_SHFT);
- return (hash & pmap_pteg_mask);
-}
-
-static __inline struct pvo_head *
-pa_to_pvoh(vm_offset_t pa, vm_page_t *pg_p)
-{
- struct vm_page *pg;
-
- pg = PHYS_TO_VM_PAGE(pa);
-
- if (pg_p != NULL)
- *pg_p = pg;
-
- if (pg == NULL)
- return (&pmap_pvo_unmanaged);
-
- return (&pg->md.mdpg_pvoh);
-}
-
-static __inline struct pvo_head *
-vm_page_to_pvoh(vm_page_t m)
-{
-
- return (&m->md.mdpg_pvoh);
-}
-
-static __inline void
-pmap_attr_clear(vm_page_t m, int ptebit)
-{
-
- m->md.mdpg_attrs &= ~ptebit;
-}
-
-static __inline int
-pmap_attr_fetch(vm_page_t m)
-{
-
- return (m->md.mdpg_attrs);
-}
-
-static __inline void
-pmap_attr_save(vm_page_t m, int ptebit)
-{
-
- m->md.mdpg_attrs |= ptebit;
-}
-
-static __inline int
-pmap_pte_compare(const struct pte *pt, const struct pte *pvo_pt)
-{
- if (pt->pte_hi == pvo_pt->pte_hi)
- return (1);
-
- return (0);
-}
-
-static __inline int
-pmap_pte_match(struct pte *pt, u_int sr, vm_offset_t va, int which)
-{
- return (pt->pte_hi & ~PTE_VALID) ==
- (((sr & SR_VSID_MASK) << PTE_VSID_SHFT) |
- ((va >> ADDR_API_SHFT) & PTE_API) | which);
-}
-
-static __inline void
-pmap_pte_create(struct pte *pt, u_int sr, vm_offset_t va, u_int pte_lo)
-{
- /*
- * Construct a PTE. Default to IMB initially. Valid bit only gets
- * set when the real pte is set in memory.
- *
- * Note: Don't set the valid bit for correct operation of tlb update.
- */
- pt->pte_hi = ((sr & SR_VSID_MASK) << PTE_VSID_SHFT) |
- (((va & ADDR_PIDX) >> ADDR_API_SHFT) & PTE_API);
- pt->pte_lo = pte_lo;
-}
-
-static __inline void
-pmap_pte_synch(struct pte *pt, struct pte *pvo_pt)
-{
-
- pvo_pt->pte_lo |= pt->pte_lo & (PTE_REF | PTE_CHG);
-}
-
-static __inline void
-pmap_pte_clear(struct pte *pt, vm_offset_t va, int ptebit)
-{
-
- /*
- * As shown in Section 7.6.3.2.3
- */
- pt->pte_lo &= ~ptebit;
- TLBIE(va);
- EIEIO();
- TLBSYNC();
- SYNC();
-}
-
-static __inline void
-pmap_pte_set(struct pte *pt, struct pte *pvo_pt)
-{
-
- pvo_pt->pte_hi |= PTE_VALID;
-
- /*
- * Update the PTE as defined in section 7.6.3.1.
- * Note that the REF/CHG bits are from pvo_pt and thus should havce
- * been saved so this routine can restore them (if desired).
- */
- pt->pte_lo = pvo_pt->pte_lo;
- EIEIO();
- pt->pte_hi = pvo_pt->pte_hi;
- SYNC();
- pmap_pte_valid++;
-}
-
-static __inline void
-pmap_pte_unset(struct pte *pt, struct pte *pvo_pt, vm_offset_t va)
-{
-
- pvo_pt->pte_hi &= ~PTE_VALID;
-
- /*
- * Force the reg & chg bits back into the PTEs.
- */
- SYNC();
-
- /*
- * Invalidate the pte.
- */
- pt->pte_hi &= ~PTE_VALID;
-
- SYNC();
- TLBIE(va);
- EIEIO();
- TLBSYNC();
- SYNC();
-
- /*
- * Save the reg & chg bits.
- */
- pmap_pte_synch(pt, pvo_pt);
- pmap_pte_valid--;
-}
-
-static __inline void
-pmap_pte_change(struct pte *pt, struct pte *pvo_pt, vm_offset_t va)
-{
-
- /*
- * Invalidate the PTE
- */
- pmap_pte_unset(pt, pvo_pt, va);
- pmap_pte_set(pt, pvo_pt);
-}
-
-/*
- * Quick sort callout for comparing memory regions.
- */
-static int mr_cmp(const void *a, const void *b);
-static int om_cmp(const void *a, const void *b);
-
-static int
-mr_cmp(const void *a, const void *b)
-{
- const struct mem_region *regiona;
- const struct mem_region *regionb;
-
- regiona = a;
- regionb = b;
- if (regiona->mr_start < regionb->mr_start)
- return (-1);
- else if (regiona->mr_start > regionb->mr_start)
- return (1);
- else
- return (0);
-}
-
-static int
-om_cmp(const void *a, const void *b)
-{
- const struct ofw_map *mapa;
- const struct ofw_map *mapb;
-
- mapa = a;
- mapb = b;
- if (mapa->om_pa < mapb->om_pa)
- return (-1);
- else if (mapa->om_pa > mapb->om_pa)
- return (1);
- else
- return (0);
-}
-
-void
-pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend)
-{
- ihandle_t mmui;
- phandle_t chosen, mmu;
- int sz;
- int i, j;
- int ofw_mappings;
- vm_size_t size, physsz, hwphyssz;
- vm_offset_t pa, va, off;
- u_int batl, batu;
-
- /*
- * Set up BAT0 to map the lowest 256 MB area
- */
- battable[0x0].batl = BATL(0x00000000, BAT_M, BAT_PP_RW);
- battable[0x0].batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs);
-
- /*
- * Map PCI memory space.
- */
- battable[0x8].batl = BATL(0x80000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0x8].batu = BATU(0x80000000, BAT_BL_256M, BAT_Vs);
-
- battable[0x9].batl = BATL(0x90000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0x9].batu = BATU(0x90000000, BAT_BL_256M, BAT_Vs);
-
- battable[0xa].batl = BATL(0xa0000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0xa].batu = BATU(0xa0000000, BAT_BL_256M, BAT_Vs);
-
- battable[0xb].batl = BATL(0xb0000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0xb].batu = BATU(0xb0000000, BAT_BL_256M, BAT_Vs);
-
- /*
- * Map obio devices.
- */
- battable[0xf].batl = BATL(0xf0000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0xf].batu = BATU(0xf0000000, BAT_BL_256M, BAT_Vs);
-
- /*
- * Use an IBAT and a DBAT to map the bottom segment of memory
- * where we are.
- */
- batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs);
- batl = BATL(0x00000000, BAT_M, BAT_PP_RW);
- __asm ("mtibatu 0,%0; mtibatl 0,%1; isync; \n"
- "mtdbatu 0,%0; mtdbatl 0,%1; isync"
- :: "r"(batu), "r"(batl));
-
-#if 0
- /* map frame buffer */
- batu = BATU(0x90000000, BAT_BL_256M, BAT_Vs);
- batl = BATL(0x90000000, BAT_I|BAT_G, BAT_PP_RW);
- __asm ("mtdbatu 1,%0; mtdbatl 1,%1; isync"
- :: "r"(batu), "r"(batl));
-#endif
-
-#if 1
- /* map pci space */
- batu = BATU(0x80000000, BAT_BL_256M, BAT_Vs);
- batl = BATL(0x80000000, BAT_I|BAT_G, BAT_PP_RW);
- __asm ("mtdbatu 1,%0; mtdbatl 1,%1; isync"
- :: "r"(batu), "r"(batl));
-#endif
-
- /*
- * Set the start and end of kva.
- */
- virtual_avail = VM_MIN_KERNEL_ADDRESS;
- virtual_end = VM_MAX_KERNEL_ADDRESS;
-
- mem_regions(&pregions, &pregions_sz, &regions, &regions_sz);
- CTR0(KTR_PMAP, "pmap_bootstrap: physical memory");
-
- qsort(pregions, pregions_sz, sizeof(*pregions), mr_cmp);
- for (i = 0; i < pregions_sz; i++) {
- vm_offset_t pa;
- vm_offset_t end;
-
- CTR3(KTR_PMAP, "physregion: %#x - %#x (%#x)",
- pregions[i].mr_start,
- pregions[i].mr_start + pregions[i].mr_size,
- pregions[i].mr_size);
- /*
- * Install entries into the BAT table to allow all
- * of physmem to be convered by on-demand BAT entries.
- * The loop will sometimes set the same battable element
- * twice, but that's fine since they won't be used for
- * a while yet.
- */
- pa = pregions[i].mr_start & 0xf0000000;
- end = pregions[i].mr_start + pregions[i].mr_size;
- do {
- u_int n = pa >> ADDR_SR_SHFT;
-
- battable[n].batl = BATL(pa, BAT_M, BAT_PP_RW);
- battable[n].batu = BATU(pa, BAT_BL_256M, BAT_Vs);
- pa += SEGMENT_LENGTH;
- } while (pa < end);
- }
-
- if (sizeof(phys_avail)/sizeof(phys_avail[0]) < regions_sz)
- panic("pmap_bootstrap: phys_avail too small");
- qsort(regions, regions_sz, sizeof(*regions), mr_cmp);
- phys_avail_count = 0;
- physsz = 0;
- hwphyssz = 0;
- TUNABLE_ULONG_FETCH("hw.physmem", (u_long *) &hwphyssz);
- for (i = 0, j = 0; i < regions_sz; i++, j += 2) {
- CTR3(KTR_PMAP, "region: %#x - %#x (%#x)", regions[i].mr_start,
- regions[i].mr_start + regions[i].mr_size,
- regions[i].mr_size);
- if (hwphyssz != 0 &&
- (physsz + regions[i].mr_size) >= hwphyssz) {
- if (physsz < hwphyssz) {
- phys_avail[j] = regions[i].mr_start;
- phys_avail[j + 1] = regions[i].mr_start +
- hwphyssz - physsz;
- physsz = hwphyssz;
- phys_avail_count++;
- }
- break;
- }
- phys_avail[j] = regions[i].mr_start;
- phys_avail[j + 1] = regions[i].mr_start + regions[i].mr_size;
- phys_avail_count++;
- physsz += regions[i].mr_size;
- }
- physmem = btoc(physsz);
-
- /*
- * Allocate PTEG table.
- */
-#ifdef PTEGCOUNT
- pmap_pteg_count = PTEGCOUNT;
-#else
- pmap_pteg_count = 0x1000;
-
- while (pmap_pteg_count < physmem)
- pmap_pteg_count <<= 1;
-
- pmap_pteg_count >>= 1;
-#endif /* PTEGCOUNT */
-
- size = pmap_pteg_count * sizeof(struct pteg);
- CTR2(KTR_PMAP, "pmap_bootstrap: %d PTEGs, %d bytes", pmap_pteg_count,
- size);
- pmap_pteg_table = (struct pteg *)pmap_bootstrap_alloc(size, size);
- CTR1(KTR_PMAP, "pmap_bootstrap: PTEG table at %p", pmap_pteg_table);
- bzero((void *)pmap_pteg_table, pmap_pteg_count * sizeof(struct pteg));
- pmap_pteg_mask = pmap_pteg_count - 1;
-
- /*
- * Allocate pv/overflow lists.
- */
- size = sizeof(struct pvo_head) * pmap_pteg_count;
- pmap_pvo_table = (struct pvo_head *)pmap_bootstrap_alloc(size,
- PAGE_SIZE);
- CTR1(KTR_PMAP, "pmap_bootstrap: PVO table at %p", pmap_pvo_table);
- for (i = 0; i < pmap_pteg_count; i++)
- LIST_INIT(&pmap_pvo_table[i]);
-
- /*
- * Initialize the lock that synchronizes access to the pteg and pvo
- * tables.
- */
- mtx_init(&pmap_table_mutex, "pmap table", NULL, MTX_DEF);
-
- /*
- * Allocate the message buffer.
- */
- msgbuf_phys = pmap_bootstrap_alloc(MSGBUF_SIZE, 0);
-
- /*
- * Initialise the unmanaged pvo pool.
- */
- pmap_bpvo_pool = (struct pvo_entry *)pmap_bootstrap_alloc(
- BPVO_POOL_SIZE*sizeof(struct pvo_entry), 0);
- pmap_bpvo_pool_index = 0;
-
- /*
- * Make sure kernel vsid is allocated as well as VSID 0.
- */
- pmap_vsid_bitmap[(KERNEL_VSIDBITS & (NPMAPS - 1)) / VSID_NBPW]
- |= 1 << (KERNEL_VSIDBITS % VSID_NBPW);
- pmap_vsid_bitmap[0] |= 1;
-
- /*
- * Set up the Open Firmware pmap and add it's mappings.
- */
- pmap_pinit(&ofw_pmap);
- ofw_pmap.pm_sr[KERNEL_SR] = KERNEL_SEGMENT;
- ofw_pmap.pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT;
- if ((chosen = OF_finddevice("/chosen")) == -1)
- panic("pmap_bootstrap: can't find /chosen");
- OF_getprop(chosen, "mmu", &mmui, 4);
- if ((mmu = OF_instance_to_package(mmui)) == -1)
- panic("pmap_bootstrap: can't get mmu package");
- if ((sz = OF_getproplen(mmu, "translations")) == -1)
- panic("pmap_bootstrap: can't get ofw translation count");
- translations = NULL;
- for (i = 0; phys_avail[i] != 0; i += 2) {
- if (phys_avail[i + 1] >= sz) {
- translations = (struct ofw_map *)phys_avail[i];
- break;
- }
- }
- if (translations == NULL)
- panic("pmap_bootstrap: no space to copy translations");
- bzero(translations, sz);
- if (OF_getprop(mmu, "translations", translations, sz) == -1)
- panic("pmap_bootstrap: can't get ofw translations");
- CTR0(KTR_PMAP, "pmap_bootstrap: translations");
- sz /= sizeof(*translations);
- qsort(translations, sz, sizeof (*translations), om_cmp);
- for (i = 0, ofw_mappings = 0; i < sz; i++) {
- CTR3(KTR_PMAP, "translation: pa=%#x va=%#x len=%#x",
- translations[i].om_pa, translations[i].om_va,
- translations[i].om_len);
-
- /*
- * If the mapping is 1:1, let the RAM and device on-demand
- * BAT tables take care of the translation.
- */
- if (translations[i].om_va == translations[i].om_pa)
- continue;
-
- /* Enter the pages */
- for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) {
- struct vm_page m;
-
- m.phys_addr = translations[i].om_pa + off;
- pmap_enter(&ofw_pmap, translations[i].om_va + off, &m,
- VM_PROT_ALL, 1);
- ofw_mappings++;
- }
- }
-#ifdef SMP
- TLBSYNC();
-#endif
-
- /*
- * Initialize the kernel pmap (which is statically allocated).
- */
- PMAP_LOCK_INIT(kernel_pmap);
- for (i = 0; i < 16; i++) {
- kernel_pmap->pm_sr[i] = EMPTY_SEGMENT;
- }
- kernel_pmap->pm_sr[KERNEL_SR] = KERNEL_SEGMENT;
- kernel_pmap->pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT;
- kernel_pmap->pm_active = ~0;
-
- /*
- * Allocate a kernel stack with a guard page for thread0 and map it
- * into the kernel page map.
- */
- pa = pmap_bootstrap_alloc(KSTACK_PAGES * PAGE_SIZE, 0);
- kstack0_phys = pa;
- kstack0 = virtual_avail + (KSTACK_GUARD_PAGES * PAGE_SIZE);
- CTR2(KTR_PMAP, "pmap_bootstrap: kstack0 at %#x (%#x)", kstack0_phys,
- kstack0);
- virtual_avail += (KSTACK_PAGES + KSTACK_GUARD_PAGES) * PAGE_SIZE;
- for (i = 0; i < KSTACK_PAGES; i++) {
- pa = kstack0_phys + i * PAGE_SIZE;
- va = kstack0 + i * PAGE_SIZE;
- pmap_kenter(va, pa);
- TLBIE(va);
- }
-
- /*
- * Calculate the last available physical address.
- */
- for (i = 0; phys_avail[i + 2] != 0; i += 2)
- ;
- Maxmem = powerpc_btop(phys_avail[i + 1]);
-
- /*
- * Allocate virtual address space for the message buffer.
- */
- msgbufp = (struct msgbuf *)virtual_avail;
- virtual_avail += round_page(MSGBUF_SIZE);
-
- /*
- * Initialize hardware.
- */
- for (i = 0; i < 16; i++) {
- mtsrin(i << ADDR_SR_SHFT, EMPTY_SEGMENT);
- }
- __asm __volatile ("mtsr %0,%1"
- :: "n"(KERNEL_SR), "r"(KERNEL_SEGMENT));
- __asm __volatile ("mtsr %0,%1"
- :: "n"(KERNEL2_SR), "r"(KERNEL2_SEGMENT));
- __asm __volatile ("sync; mtsdr1 %0; isync"
- :: "r"((u_int)pmap_pteg_table | (pmap_pteg_mask >> 10)));
- tlbia();
-
- pmap_bootstrapped++;
-}
-
-/*
- * Activate a user pmap. The pmap must be activated before it's address
- * space can be accessed in any way.
- */
-void
-pmap_activate(struct thread *td)
-{
- pmap_t pm, pmr;
-
- /*
- * Load all the data we need up front to encourage the compiler to
- * not issue any loads while we have interrupts disabled below.
- */
- pm = &td->td_proc->p_vmspace->vm_pmap;
-
- if ((pmr = (pmap_t)pmap_kextract((vm_offset_t)pm)) == NULL)
- pmr = pm;
-
- pm->pm_active |= PCPU_GET(cpumask);
- PCPU_SET(curpmap, pmr);
-}
-
-void
-pmap_deactivate(struct thread *td)
-{
- pmap_t pm;
-
- pm = &td->td_proc->p_vmspace->vm_pmap;
- pm->pm_active &= ~(PCPU_GET(cpumask));
- PCPU_SET(curpmap, NULL);
-}
-
-vm_offset_t
-pmap_addr_hint(vm_object_t object, vm_offset_t va, vm_size_t size)
-{
-
- return (va);
-}
-
-void
-pmap_change_wiring(pmap_t pm, vm_offset_t va, boolean_t wired)
-{
- struct pvo_entry *pvo;
-
- PMAP_LOCK(pm);
- pvo = pmap_pvo_find_va(pm, va & ~ADDR_POFF, NULL);
-
- if (pvo != NULL) {
- if (wired) {
- if ((pvo->pvo_vaddr & PVO_WIRED) == 0)
- pm->pm_stats.wired_count++;
- pvo->pvo_vaddr |= PVO_WIRED;
- } else {
- if ((pvo->pvo_vaddr & PVO_WIRED) != 0)
- pm->pm_stats.wired_count--;
- pvo->pvo_vaddr &= ~PVO_WIRED;
- }
- }
- PMAP_UNLOCK(pm);
-}
-
-void
-pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr,
- vm_size_t len, vm_offset_t src_addr)
-{
-
- /*
- * This is not needed as it's mainly an optimisation.
- * It may want to be implemented later though.
- */
-}
-
-void
-pmap_copy_page(vm_page_t msrc, vm_page_t mdst)
-{
- vm_offset_t dst;
- vm_offset_t src;
-
- dst = VM_PAGE_TO_PHYS(mdst);
- src = VM_PAGE_TO_PHYS(msrc);
-
- kcopy((void *)src, (void *)dst, PAGE_SIZE);
-}
-
-/*
- * Zero a page of physical memory by temporarily mapping it into the tlb.
- */
-void
-pmap_zero_page(vm_page_t m)
-{
- vm_offset_t pa = VM_PAGE_TO_PHYS(m);
- caddr_t va;
-
- if (pa < SEGMENT_LENGTH) {
- va = (caddr_t) pa;
- } else if (pmap_initialized) {
- if (pmap_pvo_zeropage == NULL)
- pmap_pvo_zeropage = pmap_rkva_alloc();
- pmap_pa_map(pmap_pvo_zeropage, pa, NULL, NULL);
- va = (caddr_t)PVO_VADDR(pmap_pvo_zeropage);
- } else {
- panic("pmap_zero_page: can't zero pa %#x", pa);
- }
-
- bzero(va, PAGE_SIZE);
-
- if (pa >= SEGMENT_LENGTH)
- pmap_pa_unmap(pmap_pvo_zeropage, NULL, NULL);
-}
-
-void
-pmap_zero_page_area(vm_page_t m, int off, int size)
-{
- vm_offset_t pa = VM_PAGE_TO_PHYS(m);
- caddr_t va;
-
- if (pa < SEGMENT_LENGTH) {
- va = (caddr_t) pa;
- } else if (pmap_initialized) {
- if (pmap_pvo_zeropage == NULL)
- pmap_pvo_zeropage = pmap_rkva_alloc();
- pmap_pa_map(pmap_pvo_zeropage, pa, NULL, NULL);
- va = (caddr_t)PVO_VADDR(pmap_pvo_zeropage);
- } else {
- panic("pmap_zero_page: can't zero pa %#x", pa);
- }
-
- bzero(va + off, size);
-
- if (pa >= SEGMENT_LENGTH)
- pmap_pa_unmap(pmap_pvo_zeropage, NULL, NULL);
-}
-
-void
-pmap_zero_page_idle(vm_page_t m)
-{
-
- /* XXX this is called outside of Giant, is pmap_zero_page safe? */
- /* XXX maybe have a dedicated mapping for this to avoid the problem? */
- mtx_lock(&Giant);
- pmap_zero_page(m);
- mtx_unlock(&Giant);
-}
-
-/*
- * Map the given physical page at the specified virtual address in the
- * target pmap with the protection requested. If specified the page
- * will be wired down.
- */
-void
-pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
- boolean_t wired)
-{
- struct pvo_head *pvo_head;
- uma_zone_t zone;
- vm_page_t pg;
- u_int pte_lo, pvo_flags, was_exec, i;
- int error;
-
- if (!pmap_initialized) {
- pvo_head = &pmap_pvo_kunmanaged;
- zone = pmap_upvo_zone;
- pvo_flags = 0;
- pg = NULL;
- was_exec = PTE_EXEC;
- } else {
- pvo_head = vm_page_to_pvoh(m);
- pg = m;
- zone = pmap_mpvo_zone;
- pvo_flags = PVO_MANAGED;
- was_exec = 0;
- }
- if (pmap_bootstrapped)
- vm_page_lock_queues();
- PMAP_LOCK(pmap);
-
- /* XXX change the pvo head for fake pages */
- if ((m->flags & PG_FICTITIOUS) == PG_FICTITIOUS)
- pvo_head = &pmap_pvo_kunmanaged;
-
- /*
- * If this is a managed page, and it's the first reference to the page,
- * clear the execness of the page. Otherwise fetch the execness.
- */
- if ((pg != NULL) && ((m->flags & PG_FICTITIOUS) == 0)) {
- if (LIST_EMPTY(pvo_head)) {
- pmap_attr_clear(pg, PTE_EXEC);
- } else {
- was_exec = pmap_attr_fetch(pg) & PTE_EXEC;
- }
- }
-
- /*
- * Assume the page is cache inhibited and access is guarded unless
- * it's in our available memory array.
- */
- pte_lo = PTE_I | PTE_G;
- for (i = 0; i < pregions_sz; i++) {
- if ((VM_PAGE_TO_PHYS(m) >= pregions[i].mr_start) &&
- (VM_PAGE_TO_PHYS(m) <
- (pregions[i].mr_start + pregions[i].mr_size))) {
- pte_lo &= ~(PTE_I | PTE_G);
- break;
- }
- }
-
- if (prot & VM_PROT_WRITE)
- pte_lo |= PTE_BW;
- else
- pte_lo |= PTE_BR;
-
- if (prot & VM_PROT_EXECUTE)
- pvo_flags |= PVO_EXECUTABLE;
-
- if (wired)
- pvo_flags |= PVO_WIRED;
-
- if ((m->flags & PG_FICTITIOUS) != 0)
- pvo_flags |= PVO_FAKE;
-
- error = pmap_pvo_enter(pmap, zone, pvo_head, va, VM_PAGE_TO_PHYS(m),
- pte_lo, pvo_flags);
-
- /*
- * Flush the real page from the instruction cache if this page is
- * mapped executable and cacheable and was not previously mapped (or
- * was not mapped executable).
- */
- if (error == 0 && (pvo_flags & PVO_EXECUTABLE) &&
- (pte_lo & PTE_I) == 0 && was_exec == 0) {
- /*
- * Flush the real memory from the cache.
- */
- pmap_syncicache(VM_PAGE_TO_PHYS(m), PAGE_SIZE);
- if (pg != NULL)
- pmap_attr_save(pg, PTE_EXEC);
- }
- if (pmap_bootstrapped)
- vm_page_unlock_queues();
-
- /* XXX syncicache always until problems are sorted */
- pmap_syncicache(VM_PAGE_TO_PHYS(m), PAGE_SIZE);
- PMAP_UNLOCK(pmap);
-}
-
-vm_page_t
-pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_page_t mpte)
-{
-
- vm_page_busy(m);
- vm_page_unlock_queues();
- VM_OBJECT_UNLOCK(m->object);
- mtx_lock(&Giant);
- pmap_enter(pm, va, m, VM_PROT_READ | VM_PROT_EXECUTE, FALSE);
- mtx_unlock(&Giant);
- VM_OBJECT_LOCK(m->object);
- vm_page_lock_queues();
- vm_page_wakeup(m);
- return (NULL);
-}
-
-vm_paddr_t
-pmap_extract(pmap_t pm, vm_offset_t va)
-{
- struct pvo_entry *pvo;
- vm_paddr_t pa;
-
- PMAP_LOCK(pm);
- pvo = pmap_pvo_find_va(pm, va & ~ADDR_POFF, NULL);
- if (pvo == NULL)
- pa = 0;
- else
- pa = (pvo->pvo_pte.pte_lo & PTE_RPGN) | (va & ADDR_POFF);
- PMAP_UNLOCK(pm);
- return (pa);
-}
-
-/*
- * Atomically extract and hold the physical page with the given
- * pmap and virtual address pair if that mapping permits the given
- * protection.
- */
-vm_page_t
-pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
-{
- struct pvo_entry *pvo;
- vm_page_t m;
-
- m = NULL;
- mtx_lock(&Giant);
- vm_page_lock_queues();
- PMAP_LOCK(pmap);
- pvo = pmap_pvo_find_va(pmap, va & ~ADDR_POFF, NULL);
- if (pvo != NULL && (pvo->pvo_pte.pte_hi & PTE_VALID) &&
- ((pvo->pvo_pte.pte_lo & PTE_PP) == PTE_RW ||
- (prot & VM_PROT_WRITE) == 0)) {
- m = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte_lo & PTE_RPGN);
- vm_page_hold(m);
- }
- vm_page_unlock_queues();
- PMAP_UNLOCK(pmap);
- mtx_unlock(&Giant);
- return (m);
-}
-
-/*
- * Grow the number of kernel page table entries. Unneeded.
- */
-void
-pmap_growkernel(vm_offset_t addr)
-{
-}
-
-/*
- * Initialize a vm_page's machine-dependent fields.
- */
-void
-pmap_page_init(vm_page_t m)
-{
-}
-
-void
-pmap_init(void)
-{
-
- CTR0(KTR_PMAP, "pmap_init");
-
- pmap_upvo_zone = uma_zcreate("UPVO entry", sizeof (struct pvo_entry),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
- UMA_ZONE_VM | UMA_ZONE_NOFREE);
- pmap_mpvo_zone = uma_zcreate("MPVO entry", sizeof(struct pvo_entry),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
- UMA_ZONE_VM | UMA_ZONE_NOFREE);
- pmap_initialized = TRUE;
-}
-
-void
-pmap_init2(void)
-{
-
- CTR0(KTR_PMAP, "pmap_init2");
-}
-
-boolean_t
-pmap_is_modified(vm_page_t m)
-{
-
- if ((m->flags & (PG_FICTITIOUS |PG_UNMANAGED)) != 0)
- return (FALSE);
-
- return (pmap_query_bit(m, PTE_CHG));
-}
-
-/*
- * pmap_is_prefaultable:
- *
- * Return whether or not the specified virtual address is elgible
- * for prefault.
- */
-boolean_t
-pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr)
-{
-
- return (FALSE);
-}
-
-void
-pmap_clear_reference(vm_page_t m)
-{
-
- if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
- return;
- pmap_clear_bit(m, PTE_REF, NULL);
-}
-
-void
-pmap_clear_modify(vm_page_t m)
-{
-
- if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
- return;
- pmap_clear_bit(m, PTE_CHG, NULL);
-}
-
-/*
- * pmap_ts_referenced:
- *
- * Return a count of reference bits for a page, clearing those bits.
- * It is not necessary for every reference bit to be cleared, but it
- * is necessary that 0 only be returned when there are truly no
- * reference bits set.
- *
- * XXX: The exact number of bits to check and clear is a matter that
- * should be tested and standardized at some point in the future for
- * optimal aging of shared pages.
- */
-int
-pmap_ts_referenced(vm_page_t m)
-{
- int count;
-
- if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
- return (0);
-
- count = pmap_clear_bit(m, PTE_REF, NULL);
-
- return (count);
-}
-
-/*
- * Map a wired page into kernel virtual address space.
- */
-void
-pmap_kenter(vm_offset_t va, vm_offset_t pa)
-{
- u_int pte_lo;
- int error;
- int i;
-
-#if 0
- if (va < VM_MIN_KERNEL_ADDRESS)
- panic("pmap_kenter: attempt to enter non-kernel address %#x",
- va);
-#endif
-
- pte_lo = PTE_I | PTE_G;
- for (i = 0; i < pregions_sz; i++) {
- if ((pa >= pregions[i].mr_start) &&
- (pa < (pregions[i].mr_start + pregions[i].mr_size))) {
- pte_lo &= ~(PTE_I | PTE_G);
- break;
- }
- }
-
- PMAP_LOCK(kernel_pmap);
- error = pmap_pvo_enter(kernel_pmap, pmap_upvo_zone,
- &pmap_pvo_kunmanaged, va, pa, pte_lo, PVO_WIRED);
-
- if (error != 0 && error != ENOENT)
- panic("pmap_kenter: failed to enter va %#x pa %#x: %d", va,
- pa, error);
-
- /*
- * Flush the real memory from the instruction cache.
- */
- if ((pte_lo & (PTE_I | PTE_G)) == 0) {
- pmap_syncicache(pa, PAGE_SIZE);
- }
- PMAP_UNLOCK(kernel_pmap);
-}
-
-/*
- * Extract the physical page address associated with the given kernel virtual
- * address.
- */
-vm_offset_t
-pmap_kextract(vm_offset_t va)
-{
- struct pvo_entry *pvo;
- vm_paddr_t pa;
-
-#ifdef UMA_MD_SMALL_ALLOC
- /*
- * Allow direct mappings
- */
- if (va < VM_MIN_KERNEL_ADDRESS) {
- return (va);
- }
-#endif
-
- PMAP_LOCK(kernel_pmap);
- pvo = pmap_pvo_find_va(kernel_pmap, va & ~ADDR_POFF, NULL);
- KASSERT(pvo != NULL, ("pmap_kextract: no addr found"));
- pa = (pvo->pvo_pte.pte_lo & PTE_RPGN) | (va & ADDR_POFF);
- PMAP_UNLOCK(kernel_pmap);
- return (pa);
-}
-
-/*
- * Remove a wired page from kernel virtual address space.
- */
-void
-pmap_kremove(vm_offset_t va)
-{
-
- pmap_remove(kernel_pmap, va, va + PAGE_SIZE);
-}
-
-/*
- * Map a range of physical addresses into kernel virtual address space.
- *
- * The value passed in *virt is a suggested virtual address for the mapping.
- * Architectures which can support a direct-mapped physical to virtual region
- * can return the appropriate address within that region, leaving '*virt'
- * unchanged. We cannot and therefore do not; *virt is updated with the
- * first usable address after the mapped region.
- */
-vm_offset_t
-pmap_map(vm_offset_t *virt, vm_offset_t pa_start, vm_offset_t pa_end, int prot)
-{
- vm_offset_t sva, va;
-
- sva = *virt;
- va = sva;
- for (; pa_start < pa_end; pa_start += PAGE_SIZE, va += PAGE_SIZE)
- pmap_kenter(va, pa_start);
- *virt = va;
- return (sva);
-}
-
-int
-pmap_mincore(pmap_t pmap, vm_offset_t addr)
-{
- TODO;
- return (0);
-}
-
-void
-pmap_object_init_pt(pmap_t pm, vm_offset_t addr, vm_object_t object,
- vm_pindex_t pindex, vm_size_t size)
-{
-
- VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
- KASSERT(object->type == OBJT_DEVICE,
- ("pmap_object_init_pt: non-device object"));
- KASSERT(pm == &curproc->p_vmspace->vm_pmap || pm == kernel_pmap,
- ("pmap_object_init_pt: non current pmap"));
-}
-
-/*
- * Lower the permission for all mappings to a given page.
- */
-void
-pmap_page_protect(vm_page_t m, vm_prot_t prot)
-{
- struct pvo_head *pvo_head;
- struct pvo_entry *pvo, *next_pvo;
- struct pte *pt;
- pmap_t pmap;
-
- /*
- * Since the routine only downgrades protection, if the
- * maximal protection is desired, there isn't any change
- * to be made.
- */
- if ((prot & (VM_PROT_READ|VM_PROT_WRITE)) ==
- (VM_PROT_READ|VM_PROT_WRITE))
- return;
-
- pvo_head = vm_page_to_pvoh(m);
- for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) {
- next_pvo = LIST_NEXT(pvo, pvo_vlink);
- PMAP_PVO_CHECK(pvo); /* sanity check */
- pmap = pvo->pvo_pmap;
- PMAP_LOCK(pmap);
-
- /*
- * Downgrading to no mapping at all, we just remove the entry.
- */
- if ((prot & VM_PROT_READ) == 0) {
- pmap_pvo_remove(pvo, -1);
- PMAP_UNLOCK(pmap);
- continue;
- }
-
- /*
- * If EXEC permission is being revoked, just clear the flag
- * in the PVO.
- */
- if ((prot & VM_PROT_EXECUTE) == 0)
- pvo->pvo_vaddr &= ~PVO_EXECUTABLE;
-
- /*
- * If this entry is already RO, don't diddle with the page
- * table.
- */
- if ((pvo->pvo_pte.pte_lo & PTE_PP) == PTE_BR) {
- PMAP_UNLOCK(pmap);
- PMAP_PVO_CHECK(pvo);
- continue;
- }
-
- /*
- * Grab the PTE before we diddle the bits so pvo_to_pte can
- * verify the pte contents are as expected.
- */
- pt = pmap_pvo_to_pte(pvo, -1);
- pvo->pvo_pte.pte_lo &= ~PTE_PP;
- pvo->pvo_pte.pte_lo |= PTE_BR;
- if (pt != NULL)
- pmap_pte_change(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PMAP_UNLOCK(pmap);
- PMAP_PVO_CHECK(pvo); /* sanity check */
- }
-
- /*
- * Downgrading from writeable: clear the VM page flag
- */
- if ((prot & VM_PROT_WRITE) != VM_PROT_WRITE)
- vm_page_flag_clear(m, PG_WRITEABLE);
-}
-
-/*
- * Returns true if the pmap's pv is one of the first
- * 16 pvs linked to from this page. This count may
- * be changed upwards or downwards in the future; it
- * is only necessary that true be returned for a small
- * subset of pmaps for proper page aging.
- */
-boolean_t
-pmap_page_exists_quick(pmap_t pmap, vm_page_t m)
-{
- int loops;
- struct pvo_entry *pvo;
-
- if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
- return FALSE;
-
- loops = 0;
- LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
- if (pvo->pvo_pmap == pmap)
- return (TRUE);
- if (++loops >= 16)
- break;
- }
-
- return (FALSE);
-}
-
-static u_int pmap_vsidcontext;
-
-void
-pmap_pinit(pmap_t pmap)
-{
- int i, mask;
- u_int entropy;
-
- KASSERT((int)pmap < VM_MIN_KERNEL_ADDRESS, ("pmap_pinit: virt pmap"));
- PMAP_LOCK_INIT(pmap);
-
- entropy = 0;
- __asm __volatile("mftb %0" : "=r"(entropy));
-
- /*
- * Allocate some segment registers for this pmap.
- */
- for (i = 0; i < NPMAPS; i += VSID_NBPW) {
- u_int hash, n;
-
- /*
- * Create a new value by mutiplying by a prime and adding in
- * entropy from the timebase register. This is to make the
- * VSID more random so that the PT hash function collides
- * less often. (Note that the prime casues gcc to do shifts
- * instead of a multiply.)
- */
- pmap_vsidcontext = (pmap_vsidcontext * 0x1105) + entropy;
- hash = pmap_vsidcontext & (NPMAPS - 1);
- if (hash == 0) /* 0 is special, avoid it */
- continue;
- n = hash >> 5;
- mask = 1 << (hash & (VSID_NBPW - 1));
- hash = (pmap_vsidcontext & 0xfffff);
- if (pmap_vsid_bitmap[n] & mask) { /* collision? */
- /* anything free in this bucket? */
- if (pmap_vsid_bitmap[n] == 0xffffffff) {
- entropy = (pmap_vsidcontext >> 20);
- continue;
- }
- i = ffs(~pmap_vsid_bitmap[i]) - 1;
- mask = 1 << i;
- hash &= 0xfffff & ~(VSID_NBPW - 1);
- hash |= i;
- }
- pmap_vsid_bitmap[n] |= mask;
- for (i = 0; i < 16; i++)
- pmap->pm_sr[i] = VSID_MAKE(i, hash);
- return;
- }
-
- panic("pmap_pinit: out of segments");
-}
-
-/*
- * Initialize the pmap associated with process 0.
- */
-void
-pmap_pinit0(pmap_t pm)
-{
-
- pmap_pinit(pm);
- bzero(&pm->pm_stats, sizeof(pm->pm_stats));
-}
-
-/*
- * Set the physical protection on the specified range of this map as requested.
- */
-void
-pmap_protect(pmap_t pm, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot)
-{
- struct pvo_entry *pvo;
- struct pte *pt;
- int pteidx;
-
- CTR4(KTR_PMAP, "pmap_protect: pm=%p sva=%#x eva=%#x prot=%#x", pm, sva,
- eva, prot);
-
-
- KASSERT(pm == &curproc->p_vmspace->vm_pmap || pm == kernel_pmap,
- ("pmap_protect: non current pmap"));
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- mtx_lock(&Giant);
- pmap_remove(pm, sva, eva);
- mtx_unlock(&Giant);
- return;
- }
-
- mtx_lock(&Giant);
- vm_page_lock_queues();
- PMAP_LOCK(pm);
- for (; sva < eva; sva += PAGE_SIZE) {
- pvo = pmap_pvo_find_va(pm, sva, &pteidx);
- if (pvo == NULL)
- continue;
-
- if ((prot & VM_PROT_EXECUTE) == 0)
- pvo->pvo_vaddr &= ~PVO_EXECUTABLE;
-
- /*
- * Grab the PTE pointer before we diddle with the cached PTE
- * copy.
- */
- pt = pmap_pvo_to_pte(pvo, pteidx);
- /*
- * Change the protection of the page.
- */
- pvo->pvo_pte.pte_lo &= ~PTE_PP;
- pvo->pvo_pte.pte_lo |= PTE_BR;
-
- /*
- * If the PVO is in the page table, update that pte as well.
- */
- if (pt != NULL)
- pmap_pte_change(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- }
- vm_page_unlock_queues();
- PMAP_UNLOCK(pm);
- mtx_unlock(&Giant);
-}
-
-/*
- * Map a list of wired pages into kernel virtual address space. This is
- * intended for temporary mappings which do not need page modification or
- * references recorded. Existing mappings in the region are overwritten.
- */
-void
-pmap_qenter(vm_offset_t sva, vm_page_t *m, int count)
-{
- vm_offset_t va;
-
- va = sva;
- while (count-- > 0) {
- pmap_kenter(va, VM_PAGE_TO_PHYS(*m));
- va += PAGE_SIZE;
- m++;
- }
-}
-
-/*
- * Remove page mappings from kernel virtual address space. Intended for
- * temporary mappings entered by pmap_qenter.
- */
-void
-pmap_qremove(vm_offset_t sva, int count)
-{
- vm_offset_t va;
-
- va = sva;
- while (count-- > 0) {
- pmap_kremove(va);
- va += PAGE_SIZE;
- }
-}
-
-void
-pmap_release(pmap_t pmap)
-{
- int idx, mask;
-
- /*
- * Free segment register's VSID
- */
- if (pmap->pm_sr[0] == 0)
- panic("pmap_release");
-
- idx = VSID_TO_HASH(pmap->pm_sr[0]) & (NPMAPS-1);
- mask = 1 << (idx % VSID_NBPW);
- idx /= VSID_NBPW;
- pmap_vsid_bitmap[idx] &= ~mask;
- PMAP_LOCK_DESTROY(pmap);
-}
-
-/*
- * Remove the given range of addresses from the specified map.
- */
-void
-pmap_remove(pmap_t pm, vm_offset_t sva, vm_offset_t eva)
-{
- struct pvo_entry *pvo;
- int pteidx;
-
- vm_page_lock_queues();
- PMAP_LOCK(pm);
- for (; sva < eva; sva += PAGE_SIZE) {
- pvo = pmap_pvo_find_va(pm, sva, &pteidx);
- if (pvo != NULL) {
- pmap_pvo_remove(pvo, pteidx);
- }
- }
- PMAP_UNLOCK(pm);
- vm_page_unlock_queues();
-}
-
-/*
- * Remove physical page from all pmaps in which it resides. pmap_pvo_remove()
- * will reflect changes in pte's back to the vm_page.
- */
-void
-pmap_remove_all(vm_page_t m)
-{
- struct pvo_head *pvo_head;
- struct pvo_entry *pvo, *next_pvo;
- pmap_t pmap;
-
- mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-
- pvo_head = vm_page_to_pvoh(m);
- for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) {
- next_pvo = LIST_NEXT(pvo, pvo_vlink);
-
- PMAP_PVO_CHECK(pvo); /* sanity check */
- pmap = pvo->pvo_pmap;
- PMAP_LOCK(pmap);
- pmap_pvo_remove(pvo, -1);
- PMAP_UNLOCK(pmap);
- }
- vm_page_flag_clear(m, PG_WRITEABLE);
-}
-
-/*
- * Remove all pages from specified address space, this aids process exit
- * speeds. This is much faster than pmap_remove in the case of running down
- * an entire address space. Only works for the current pmap.
- */
-void
-pmap_remove_pages(pmap_t pm, vm_offset_t sva, vm_offset_t eva)
-{
-}
-
-/*
- * Allocate a physical page of memory directly from the phys_avail map.
- * Can only be called from pmap_bootstrap before avail start and end are
- * calculated.
- */
-static vm_offset_t
-pmap_bootstrap_alloc(vm_size_t size, u_int align)
-{
- vm_offset_t s, e;
- int i, j;
-
- size = round_page(size);
- for (i = 0; phys_avail[i + 1] != 0; i += 2) {
- if (align != 0)
- s = (phys_avail[i] + align - 1) & ~(align - 1);
- else
- s = phys_avail[i];
- e = s + size;
-
- if (s < phys_avail[i] || e > phys_avail[i + 1])
- continue;
-
- if (s == phys_avail[i]) {
- phys_avail[i] += size;
- } else if (e == phys_avail[i + 1]) {
- phys_avail[i + 1] -= size;
- } else {
- for (j = phys_avail_count * 2; j > i; j -= 2) {
- phys_avail[j] = phys_avail[j - 2];
- phys_avail[j + 1] = phys_avail[j - 1];
- }
-
- phys_avail[i + 3] = phys_avail[i + 1];
- phys_avail[i + 1] = s;
- phys_avail[i + 2] = e;
- phys_avail_count++;
- }
-
- return (s);
- }
- panic("pmap_bootstrap_alloc: could not allocate memory");
-}
-
-/*
- * Return an unmapped pvo for a kernel virtual address.
- * Used by pmap functions that operate on physical pages.
- */
-static struct pvo_entry *
-pmap_rkva_alloc(void)
-{
- struct pvo_entry *pvo;
- struct pte *pt;
- vm_offset_t kva;
- int pteidx;
-
- if (pmap_rkva_count == 0)
- panic("pmap_rkva_alloc: no more reserved KVAs");
-
- kva = pmap_rkva_start + (PAGE_SIZE * --pmap_rkva_count);
- pmap_kenter(kva, 0);
-
- pvo = pmap_pvo_find_va(kernel_pmap, kva, &pteidx);
-
- if (pvo == NULL)
- panic("pmap_kva_alloc: pmap_pvo_find_va failed");
-
- pt = pmap_pvo_to_pte(pvo, pteidx);
-
- if (pt == NULL)
- panic("pmap_kva_alloc: pmap_pvo_to_pte failed");
-
- pmap_pte_unset(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PVO_PTEGIDX_CLR(pvo);
-
- pmap_pte_overflow++;
-
- return (pvo);
-}
-
-static void
-pmap_pa_map(struct pvo_entry *pvo, vm_offset_t pa, struct pte *saved_pt,
- int *depth_p)
-{
- struct pte *pt;
-
- /*
- * If this pvo already has a valid pte, we need to save it so it can
- * be restored later. We then just reload the new PTE over the old
- * slot.
- */
- if (saved_pt != NULL) {
- pt = pmap_pvo_to_pte(pvo, -1);
-
- if (pt != NULL) {
- pmap_pte_unset(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PVO_PTEGIDX_CLR(pvo);
- pmap_pte_overflow++;
- }
-
- *saved_pt = pvo->pvo_pte;
-
- pvo->pvo_pte.pte_lo &= ~PTE_RPGN;
- }
-
- pvo->pvo_pte.pte_lo |= pa;
-
- if (!pmap_pte_spill(pvo->pvo_vaddr))
- panic("pmap_pa_map: could not spill pvo %p", pvo);
-
- if (depth_p != NULL)
- (*depth_p)++;
-}
-
-static void
-pmap_pa_unmap(struct pvo_entry *pvo, struct pte *saved_pt, int *depth_p)
-{
- struct pte *pt;
-
- pt = pmap_pvo_to_pte(pvo, -1);
-
- if (pt != NULL) {
- pmap_pte_unset(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PVO_PTEGIDX_CLR(pvo);
- pmap_pte_overflow++;
- }
-
- pvo->pvo_pte.pte_lo &= ~PTE_RPGN;
-
- /*
- * If there is a saved PTE and it's valid, restore it and return.
- */
- if (saved_pt != NULL && (saved_pt->pte_lo & PTE_RPGN) != 0) {
- if (depth_p != NULL && --(*depth_p) == 0)
- panic("pmap_pa_unmap: restoring but depth == 0");
-
- pvo->pvo_pte = *saved_pt;
-
- if (!pmap_pte_spill(pvo->pvo_vaddr))
- panic("pmap_pa_unmap: could not spill pvo %p", pvo);
- }
-}
-
-static void
-pmap_syncicache(vm_offset_t pa, vm_size_t len)
-{
- __syncicache((void *)pa, len);
-}
-
-static void
-tlbia(void)
-{
- caddr_t i;
-
- SYNC();
- for (i = 0; i < (caddr_t)0x00040000; i += 0x00001000) {
- TLBIE(i);
- EIEIO();
- }
- TLBSYNC();
- SYNC();
-}
-
-static int
-pmap_pvo_enter(pmap_t pm, uma_zone_t zone, struct pvo_head *pvo_head,
- vm_offset_t va, vm_offset_t pa, u_int pte_lo, int flags)
-{
- struct pvo_entry *pvo;
- u_int sr;
- int first;
- u_int ptegidx;
- int i;
- int bootstrap;
-
- pmap_pvo_enter_calls++;
- first = 0;
- bootstrap = 0;
-
- /*
- * Compute the PTE Group index.
- */
- va &= ~ADDR_POFF;
- sr = va_to_sr(pm->pm_sr, va);
- ptegidx = va_to_pteg(sr, va);
-
- /*
- * Remove any existing mapping for this page. Reuse the pvo entry if
- * there is a mapping.
- */
- mtx_lock(&pmap_table_mutex);
- LIST_FOREACH(pvo, &pmap_pvo_table[ptegidx], pvo_olink) {
- if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) {
- if ((pvo->pvo_pte.pte_lo & PTE_RPGN) == pa &&
- (pvo->pvo_pte.pte_lo & PTE_PP) ==
- (pte_lo & PTE_PP)) {
- mtx_unlock(&pmap_table_mutex);
- return (0);
- }
- pmap_pvo_remove(pvo, -1);
- break;
- }
- }
-
- /*
- * If we aren't overwriting a mapping, try to allocate.
- */
- if (pmap_initialized) {
- pvo = uma_zalloc(zone, M_NOWAIT);
- } else {
- if (pmap_bpvo_pool_index >= BPVO_POOL_SIZE) {
- panic("pmap_enter: bpvo pool exhausted, %d, %d, %d",
- pmap_bpvo_pool_index, BPVO_POOL_SIZE,
- BPVO_POOL_SIZE * sizeof(struct pvo_entry));
- }
- pvo = &pmap_bpvo_pool[pmap_bpvo_pool_index];
- pmap_bpvo_pool_index++;
- bootstrap = 1;
- }
-
- if (pvo == NULL) {
- mtx_unlock(&pmap_table_mutex);
- return (ENOMEM);
- }
-
- pmap_pvo_entries++;
- pvo->pvo_vaddr = va;
- pvo->pvo_pmap = pm;
- LIST_INSERT_HEAD(&pmap_pvo_table[ptegidx], pvo, pvo_olink);
- pvo->pvo_vaddr &= ~ADDR_POFF;
- if (flags & VM_PROT_EXECUTE)
- pvo->pvo_vaddr |= PVO_EXECUTABLE;
- if (flags & PVO_WIRED)
- pvo->pvo_vaddr |= PVO_WIRED;
- if (pvo_head != &pmap_pvo_kunmanaged)
- pvo->pvo_vaddr |= PVO_MANAGED;
- if (bootstrap)
- pvo->pvo_vaddr |= PVO_BOOTSTRAP;
- if (flags & PVO_FAKE)
- pvo->pvo_vaddr |= PVO_FAKE;
-
- pmap_pte_create(&pvo->pvo_pte, sr, va, pa | pte_lo);
-
- /*
- * Remember if the list was empty and therefore will be the first
- * item.
- */
- if (LIST_FIRST(pvo_head) == NULL)
- first = 1;
- LIST_INSERT_HEAD(pvo_head, pvo, pvo_vlink);
-
- if (pvo->pvo_pte.pte_lo & PVO_WIRED)
- pm->pm_stats.wired_count++;
- pm->pm_stats.resident_count++;
-
- /*
- * We hope this succeeds but it isn't required.
- */
- i = pmap_pte_insert(ptegidx, &pvo->pvo_pte);
- if (i >= 0) {
- PVO_PTEGIDX_SET(pvo, i);
- } else {
- panic("pmap_pvo_enter: overflow");
- pmap_pte_overflow++;
- }
- mtx_unlock(&pmap_table_mutex);
-
- return (first ? ENOENT : 0);
-}
-
-static void
-pmap_pvo_remove(struct pvo_entry *pvo, int pteidx)
-{
- struct pte *pt;
-
- /*
- * If there is an active pte entry, we need to deactivate it (and
- * save the ref & cfg bits).
- */
- pt = pmap_pvo_to_pte(pvo, pteidx);
- if (pt != NULL) {
- pmap_pte_unset(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PVO_PTEGIDX_CLR(pvo);
- } else {
- pmap_pte_overflow--;
- }
-
- /*
- * Update our statistics.
- */
- pvo->pvo_pmap->pm_stats.resident_count--;
- if (pvo->pvo_pte.pte_lo & PVO_WIRED)
- pvo->pvo_pmap->pm_stats.wired_count--;
-
- /*
- * Save the REF/CHG bits into their cache if the page is managed.
- */
- if ((pvo->pvo_vaddr & (PVO_MANAGED|PVO_FAKE)) == PVO_MANAGED) {
- struct vm_page *pg;
-
- pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte_lo & PTE_RPGN);
- if (pg != NULL) {
- pmap_attr_save(pg, pvo->pvo_pte.pte_lo &
- (PTE_REF | PTE_CHG));
- }
- }
-
- /*
- * Remove this PVO from the PV list.
- */
- LIST_REMOVE(pvo, pvo_vlink);
-
- /*
- * Remove this from the overflow list and return it to the pool
- * if we aren't going to reuse it.
- */
- LIST_REMOVE(pvo, pvo_olink);
- if (!(pvo->pvo_vaddr & PVO_BOOTSTRAP))
- uma_zfree(pvo->pvo_vaddr & PVO_MANAGED ? pmap_mpvo_zone :
- pmap_upvo_zone, pvo);
- pmap_pvo_entries--;
- pmap_pvo_remove_calls++;
-}
-
-static __inline int
-pmap_pvo_pte_index(const struct pvo_entry *pvo, int ptegidx)
-{
- int pteidx;
-
- /*
- * We can find the actual pte entry without searching by grabbing
- * the PTEG index from 3 unused bits in pte_lo[11:9] and by
- * noticing the HID bit.
- */
- pteidx = ptegidx * 8 + PVO_PTEGIDX_GET(pvo);
- if (pvo->pvo_pte.pte_hi & PTE_HID)
- pteidx ^= pmap_pteg_mask * 8;
-
- return (pteidx);
-}
-
-static struct pvo_entry *
-pmap_pvo_find_va(pmap_t pm, vm_offset_t va, int *pteidx_p)
-{
- struct pvo_entry *pvo;
- int ptegidx;
- u_int sr;
-
- va &= ~ADDR_POFF;
- sr = va_to_sr(pm->pm_sr, va);
- ptegidx = va_to_pteg(sr, va);
-
- mtx_lock(&pmap_table_mutex);
- LIST_FOREACH(pvo, &pmap_pvo_table[ptegidx], pvo_olink) {
- if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) {
- if (pteidx_p)
- *pteidx_p = pmap_pvo_pte_index(pvo, ptegidx);
- break;
- }
- }
- mtx_unlock(&pmap_table_mutex);
-
- return (pvo);
-}
-
-static struct pte *
-pmap_pvo_to_pte(const struct pvo_entry *pvo, int pteidx)
-{
- struct pte *pt;
-
- /*
- * If we haven't been supplied the ptegidx, calculate it.
- */
- if (pteidx == -1) {
- int ptegidx;
- u_int sr;
-
- sr = va_to_sr(pvo->pvo_pmap->pm_sr, pvo->pvo_vaddr);
- ptegidx = va_to_pteg(sr, pvo->pvo_vaddr);
- pteidx = pmap_pvo_pte_index(pvo, ptegidx);
- }
-
- pt = &pmap_pteg_table[pteidx >> 3].pt[pteidx & 7];
-
- if ((pvo->pvo_pte.pte_hi & PTE_VALID) && !PVO_PTEGIDX_ISSET(pvo)) {
- panic("pmap_pvo_to_pte: pvo %p has valid pte in pvo but no "
- "valid pte index", pvo);
- }
-
- if ((pvo->pvo_pte.pte_hi & PTE_VALID) == 0 && PVO_PTEGIDX_ISSET(pvo)) {
- panic("pmap_pvo_to_pte: pvo %p has valid pte index in pvo "
- "pvo but no valid pte", pvo);
- }
-
- if ((pt->pte_hi ^ (pvo->pvo_pte.pte_hi & ~PTE_VALID)) == PTE_VALID) {
- if ((pvo->pvo_pte.pte_hi & PTE_VALID) == 0) {
- panic("pmap_pvo_to_pte: pvo %p has valid pte in "
- "pmap_pteg_table %p but invalid in pvo", pvo, pt);
- }
-
- if (((pt->pte_lo ^ pvo->pvo_pte.pte_lo) & ~(PTE_CHG|PTE_REF))
- != 0) {
- panic("pmap_pvo_to_pte: pvo %p pte does not match "
- "pte %p in pmap_pteg_table", pvo, pt);
- }
-
- return (pt);
- }
-
- if (pvo->pvo_pte.pte_hi & PTE_VALID) {
- panic("pmap_pvo_to_pte: pvo %p has invalid pte %p in "
- "pmap_pteg_table but valid in pvo", pvo, pt);
- }
-
- return (NULL);
-}
-
-/*
- * XXX: THIS STUFF SHOULD BE IN pte.c?
- */
-int
-pmap_pte_spill(vm_offset_t addr)
-{
- struct pvo_entry *source_pvo, *victim_pvo;
- struct pvo_entry *pvo;
- int ptegidx, i, j;
- u_int sr;
- struct pteg *pteg;
- struct pte *pt;
-
- pmap_pte_spills++;
-
- sr = mfsrin(addr);
- ptegidx = va_to_pteg(sr, addr);
-
- /*
- * Have to substitute some entry. Use the primary hash for this.
- * Use low bits of timebase as random generator.
- */
- pteg = &pmap_pteg_table[ptegidx];
- mtx_lock(&pmap_table_mutex);
- __asm __volatile("mftb %0" : "=r"(i));
- i &= 7;
- pt = &pteg->pt[i];
-
- source_pvo = NULL;
- victim_pvo = NULL;
- LIST_FOREACH(pvo, &pmap_pvo_table[ptegidx], pvo_olink) {
- /*
- * We need to find a pvo entry for this address.
- */
- PMAP_PVO_CHECK(pvo);
- if (source_pvo == NULL &&
- pmap_pte_match(&pvo->pvo_pte, sr, addr,
- pvo->pvo_pte.pte_hi & PTE_HID)) {
- /*
- * Now found an entry to be spilled into the pteg.
- * The PTE is now valid, so we know it's active.
- */
- j = pmap_pte_insert(ptegidx, &pvo->pvo_pte);
-
- if (j >= 0) {
- PVO_PTEGIDX_SET(pvo, j);
- pmap_pte_overflow--;
- PMAP_PVO_CHECK(pvo);
- mtx_unlock(&pmap_table_mutex);
- return (1);
- }
-
- source_pvo = pvo;
-
- if (victim_pvo != NULL)
- break;
- }
-
- /*
- * We also need the pvo entry of the victim we are replacing
- * so save the R & C bits of the PTE.
- */
- if ((pt->pte_hi & PTE_HID) == 0 && victim_pvo == NULL &&
- pmap_pte_compare(pt, &pvo->pvo_pte)) {
- victim_pvo = pvo;
- if (source_pvo != NULL)
- break;
- }
- }
-
- if (source_pvo == NULL) {
- mtx_unlock(&pmap_table_mutex);
- return (0);
- }
-
- if (victim_pvo == NULL) {
- if ((pt->pte_hi & PTE_HID) == 0)
- panic("pmap_pte_spill: victim p-pte (%p) has no pvo"
- "entry", pt);
-
- /*
- * If this is a secondary PTE, we need to search it's primary
- * pvo bucket for the matching PVO.
- */
- LIST_FOREACH(pvo, &pmap_pvo_table[ptegidx ^ pmap_pteg_mask],
- pvo_olink) {
- PMAP_PVO_CHECK(pvo);
- /*
- * We also need the pvo entry of the victim we are
- * replacing so save the R & C bits of the PTE.
- */
- if (pmap_pte_compare(pt, &pvo->pvo_pte)) {
- victim_pvo = pvo;
- break;
- }
- }
-
- if (victim_pvo == NULL)
- panic("pmap_pte_spill: victim s-pte (%p) has no pvo"
- "entry", pt);
- }
-
- /*
- * We are invalidating the TLB entry for the EA we are replacing even
- * though it's valid. If we don't, we lose any ref/chg bit changes
- * contained in the TLB entry.
- */
- source_pvo->pvo_pte.pte_hi &= ~PTE_HID;
-
- pmap_pte_unset(pt, &victim_pvo->pvo_pte, victim_pvo->pvo_vaddr);
- pmap_pte_set(pt, &source_pvo->pvo_pte);
-
- PVO_PTEGIDX_CLR(victim_pvo);
- PVO_PTEGIDX_SET(source_pvo, i);
- pmap_pte_replacements++;
-
- PMAP_PVO_CHECK(victim_pvo);
- PMAP_PVO_CHECK(source_pvo);
-
- mtx_unlock(&pmap_table_mutex);
- return (1);
-}
-
-static int
-pmap_pte_insert(u_int ptegidx, struct pte *pvo_pt)
-{
- struct pte *pt;
- int i;
-
- /*
- * First try primary hash.
- */
- for (pt = pmap_pteg_table[ptegidx].pt, i = 0; i < 8; i++, pt++) {
- if ((pt->pte_hi & PTE_VALID) == 0) {
- pvo_pt->pte_hi &= ~PTE_HID;
- pmap_pte_set(pt, pvo_pt);
- return (i);
- }
- }
-
- /*
- * Now try secondary hash.
- */
- ptegidx ^= pmap_pteg_mask;
- ptegidx++;
- for (pt = pmap_pteg_table[ptegidx].pt, i = 0; i < 8; i++, pt++) {
- if ((pt->pte_hi & PTE_VALID) == 0) {
- pvo_pt->pte_hi |= PTE_HID;
- pmap_pte_set(pt, pvo_pt);
- return (i);
- }
- }
-
- panic("pmap_pte_insert: overflow");
- return (-1);
-}
-
-static boolean_t
-pmap_query_bit(vm_page_t m, int ptebit)
-{
- struct pvo_entry *pvo;
- struct pte *pt;
-
-#if 0
- if (pmap_attr_fetch(m) & ptebit)
- return (TRUE);
-#endif
-
- LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
- PMAP_PVO_CHECK(pvo); /* sanity check */
-
- /*
- * See if we saved the bit off. If so, cache it and return
- * success.
- */
- if (pvo->pvo_pte.pte_lo & ptebit) {
- pmap_attr_save(m, ptebit);
- PMAP_PVO_CHECK(pvo); /* sanity check */
- return (TRUE);
- }
- }
-
- /*
- * No luck, now go through the hard part of looking at the PTEs
- * themselves. Sync so that any pending REF/CHG bits are flushed to
- * the PTEs.
- */
- SYNC();
- LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
- PMAP_PVO_CHECK(pvo); /* sanity check */
-
- /*
- * See if this pvo has a valid PTE. if so, fetch the
- * REF/CHG bits from the valid PTE. If the appropriate
- * ptebit is set, cache it and return success.
- */
- pt = pmap_pvo_to_pte(pvo, -1);
- if (pt != NULL) {
- pmap_pte_synch(pt, &pvo->pvo_pte);
- if (pvo->pvo_pte.pte_lo & ptebit) {
- pmap_attr_save(m, ptebit);
- PMAP_PVO_CHECK(pvo); /* sanity check */
- return (TRUE);
- }
- }
- }
-
- return (FALSE);
-}
-
-static u_int
-pmap_clear_bit(vm_page_t m, int ptebit, int *origbit)
-{
- u_int count;
- struct pvo_entry *pvo;
- struct pte *pt;
- int rv;
-
- /*
- * Clear the cached value.
- */
- rv = pmap_attr_fetch(m);
- pmap_attr_clear(m, ptebit);
-
- /*
- * Sync so that any pending REF/CHG bits are flushed to the PTEs (so
- * we can reset the right ones). note that since the pvo entries and
- * list heads are accessed via BAT0 and are never placed in the page
- * table, we don't have to worry about further accesses setting the
- * REF/CHG bits.
- */
- SYNC();
-
- /*
- * For each pvo entry, clear the pvo's ptebit. If this pvo has a
- * valid pte clear the ptebit from the valid pte.
- */
- count = 0;
- LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
- PMAP_PVO_CHECK(pvo); /* sanity check */
- pt = pmap_pvo_to_pte(pvo, -1);
- if (pt != NULL) {
- pmap_pte_synch(pt, &pvo->pvo_pte);
- if (pvo->pvo_pte.pte_lo & ptebit) {
- count++;
- pmap_pte_clear(pt, PVO_VADDR(pvo), ptebit);
- }
- }
- rv |= pvo->pvo_pte.pte_lo;
- pvo->pvo_pte.pte_lo &= ~ptebit;
- PMAP_PVO_CHECK(pvo); /* sanity check */
- }
-
- if (origbit != NULL) {
- *origbit = rv;
- }
-
- return (count);
-}
-
-/*
- * Return true if the physical range is encompassed by the battable[idx]
- */
-static int
-pmap_bat_mapped(int idx, vm_offset_t pa, vm_size_t size)
-{
- u_int prot;
- u_int32_t start;
- u_int32_t end;
- u_int32_t bat_ble;
-
- /*
- * Return immediately if not a valid mapping
- */
- if (!battable[idx].batu & BAT_Vs)
- return (EINVAL);
-
- /*
- * The BAT entry must be cache-inhibited, guarded, and r/w
- * so it can function as an i/o page
- */
- prot = battable[idx].batl & (BAT_I|BAT_G|BAT_PP_RW);
- if (prot != (BAT_I|BAT_G|BAT_PP_RW))
- return (EPERM);
-
- /*
- * The address should be within the BAT range. Assume that the
- * start address in the BAT has the correct alignment (thus
- * not requiring masking)
- */
- start = battable[idx].batl & BAT_PBS;
- bat_ble = (battable[idx].batu & ~(BAT_EBS)) | 0x03;
- end = start | (bat_ble << 15) | 0x7fff;
-
- if ((pa < start) || ((pa + size) > end))
- return (ERANGE);
-
- return (0);
-}
-
-int
-pmap_dev_direct_mapped(vm_offset_t pa, vm_size_t size)
-{
- int i;
-
- /*
- * This currently does not work for entries that
- * overlap 256M BAT segments.
- */
-
- for(i = 0; i < 16; i++)
- if (pmap_bat_mapped(i, pa, size) == 0)
- return (0);
-
- return (EFAULT);
-}
-
-/*
- * Map a set of physical memory pages into the kernel virtual
- * address space. Return a pointer to where it is mapped. This
- * routine is intended to be used for mapping device memory,
- * NOT real memory.
- */
-void *
-pmap_mapdev(vm_offset_t pa, vm_size_t size)
-{
- vm_offset_t va, tmpva, ppa, offset;
- int i;
-
- ppa = trunc_page(pa);
- offset = pa & PAGE_MASK;
- size = roundup(offset + size, PAGE_SIZE);
-
- GIANT_REQUIRED;
-
- /*
- * If the physical address lies within a valid BAT table entry,
- * return the 1:1 mapping. This currently doesn't work
- * for regions that overlap 256M BAT segments.
- */
- for (i = 0; i < 16; i++) {
- if (pmap_bat_mapped(i, pa, size) == 0)
- return ((void *) pa);
- }
-
- va = kmem_alloc_nofault(kernel_map, size);
- if (!va)
- panic("pmap_mapdev: Couldn't alloc kernel virtual memory");
-
- for (tmpva = va; size > 0;) {
- pmap_kenter(tmpva, ppa);
- TLBIE(tmpva); /* XXX or should it be invalidate-all ? */
- size -= PAGE_SIZE;
- tmpva += PAGE_SIZE;
- ppa += PAGE_SIZE;
- }
-
- return ((void *)(va + offset));
-}
-
-void
-pmap_unmapdev(vm_offset_t va, vm_size_t size)
-{
- vm_offset_t base, offset;
-
- /*
- * If this is outside kernel virtual space, then it's a
- * battable entry and doesn't require unmapping
- */
- if ((va >= VM_MIN_KERNEL_ADDRESS) && (va <= VM_MAX_KERNEL_ADDRESS)) {
- base = trunc_page(va);
- offset = va & PAGE_MASK;
- size = roundup(offset + size, PAGE_SIZE);
- kmem_free(kernel_map, base, size);
- }
-}
diff --git a/sys/powerpc/aim/nexus.c b/sys/powerpc/aim/nexus.c
deleted file mode 100644
index 277e58c..0000000
--- a/sys/powerpc/aim/nexus.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/*-
- * Copyright 1998 Massachusetts Institute of Technology
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby
- * granted, provided that both the above copyright notice and this
- * permission notice appear in all copies, that both the above
- * copyright notice and this permission notice appear in all
- * supporting documentation, and that the name of M.I.T. not be used
- * in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission. M.I.T. makes
- * no representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied
- * warranty.
- *
- * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
- * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
- * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (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 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * from: FreeBSD: src/sys/i386/i386/nexus.c,v 1.43 2001/02/09
- *
- * $FreeBSD$
- */
-#include "opt_psim.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/cons.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-
-#include <dev/ofw/openfirm.h>
-
-#include <machine/bus.h>
-#include <machine/frame.h>
-#include <machine/intr_machdep.h>
-#include <machine/nexusvar.h>
-#include <machine/resource.h>
-
-#include <sys/rman.h>
-
-#include "pic_if.h"
-
-/*
- * The nexus (which is a pseudo-bus actually) iterates over the nodes that
- * exist in Open Firmware and adds them as devices to this bus so that drivers
- * can be attached to them.
- *
- * Maybe this code should get into dev/ofw to some extent, as some of it should
- * work for all Open Firmware based machines...
- */
-
-static MALLOC_DEFINE(M_NEXUS, "nexus", "nexus device information");
-
-struct nexus_devinfo {
- phandle_t ndi_node;
- /* Some common properties. */
- const char *ndi_name;
- const char *ndi_device_type;
- const char *ndi_compatible;
-};
-
-struct nexus_softc {
- device_t sc_pic;
-};
-
-/*
- * Device interface
- */
-static int nexus_probe(device_t);
-static void nexus_probe_nomatch(device_t, device_t);
-
-/*
- * Bus interface
- */
-static device_t nexus_add_child(device_t, int, const char *, int);
-static int nexus_read_ivar(device_t, device_t, int, uintptr_t *);
-static int nexus_write_ivar(device_t, device_t, int, uintptr_t);
-static int nexus_setup_intr(device_t, device_t, struct resource *, int,
- driver_intr_t *, void *, void **);
-static int nexus_teardown_intr(device_t, device_t, struct resource *,
- void *);
-static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
- u_long, u_long, u_long, u_int);
-static int nexus_activate_resource(device_t, device_t, int, int,
- struct resource *);
-static int nexus_deactivate_resource(device_t, device_t, int, int,
- struct resource *);
-static int nexus_release_resource(device_t, device_t, int, int,
- struct resource *);
-
-/*
- * Local routines
- */
-static device_t nexus_device_from_node(device_t, phandle_t);
-
-static device_method_t nexus_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, nexus_probe),
- DEVMETHOD(device_attach, bus_generic_attach),
- DEVMETHOD(device_detach, bus_generic_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
-
- /* Bus interface. Resource management is business of the children... */
- DEVMETHOD(bus_add_child, nexus_add_child),
- DEVMETHOD(bus_print_child, bus_generic_print_child),
- DEVMETHOD(bus_probe_nomatch, nexus_probe_nomatch),
- DEVMETHOD(bus_read_ivar, nexus_read_ivar),
- DEVMETHOD(bus_write_ivar, nexus_write_ivar),
- DEVMETHOD(bus_setup_intr, nexus_setup_intr),
- DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
- DEVMETHOD(bus_alloc_resource, nexus_alloc_resource),
- DEVMETHOD(bus_activate_resource, nexus_activate_resource),
- DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
- DEVMETHOD(bus_release_resource, nexus_release_resource),
-
- { 0, 0 }
-};
-
-static driver_t nexus_driver = {
- "nexus",
- nexus_methods,
- sizeof(struct nexus_softc),
-};
-
-static devclass_t nexus_devclass;
-
-DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
-
-static int
-nexus_probe(device_t dev)
-{
- phandle_t root;
- phandle_t child;
- struct nexus_softc *sc;
-
- if ((root = OF_peer(0)) == -1)
- panic("nexus_probe: OF_peer failed.");
-
- sc = device_get_softc(dev);
-
- /*
- * Allow devices to identify
- */
- bus_generic_probe(dev);
-
- /*
- * Now walk the OFW tree to locate top-level devices
- */
- for (child = OF_child(root); child != 0; child = OF_peer(child)) {
- if (child == -1)
- panic("nexus_probe(): OF_child failed.");
- (void)nexus_device_from_node(dev, child);
-
- }
- device_set_desc(dev, "Open Firmware Nexus device");
- return (0);
-}
-
-static void
-nexus_probe_nomatch(device_t dev, device_t child)
-{
- char *name, *type;
-
- if (BUS_READ_IVAR(dev, child, NEXUS_IVAR_NAME,
- (uintptr_t *)&name) != 0 ||
- BUS_READ_IVAR(dev, child, NEXUS_IVAR_DEVICE_TYPE,
- (uintptr_t *)&type) != 0)
- return;
-
- if (type == NULL)
- type = "(unknown)";
-
- if (bootverbose)
- device_printf(dev, "<%s>, type %s (no driver attached)\n",
- name, type);
-}
-
-static device_t
-nexus_add_child(device_t dev, int order, const char *name, int unit)
-{
- device_t child;
- struct nexus_devinfo *dinfo;
-
- child = device_add_child_ordered(dev, order, name, unit);
- if (child == NULL)
- return (NULL);
-
- dinfo = malloc(sizeof(struct nexus_devinfo), M_NEXUS, M_NOWAIT|M_ZERO);
- if (dinfo == NULL)
- return (NULL);
-
- dinfo->ndi_node = -1;
- dinfo->ndi_name = name;
- device_set_ivars(child, dinfo);
-
- return (child);
-}
-
-
-static int
-nexus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
-{
- struct nexus_devinfo *dinfo;
-
- if ((dinfo = device_get_ivars(child)) == 0)
- return (ENOENT);
- switch (which) {
- case NEXUS_IVAR_NODE:
- *result = dinfo->ndi_node;
- break;
- case NEXUS_IVAR_NAME:
- *result = (uintptr_t)dinfo->ndi_name;
- break;
- case NEXUS_IVAR_DEVICE_TYPE:
- *result = (uintptr_t)dinfo->ndi_device_type;
- break;
- case NEXUS_IVAR_COMPATIBLE:
- *result = (uintptr_t)dinfo->ndi_compatible;
- break;
- default:
- return (ENOENT);
- }
- return 0;
-}
-
-static int
-nexus_write_ivar(device_t dev, device_t child, int which, uintptr_t value)
-{
- struct nexus_devinfo *dinfo;
-
- if ((dinfo = device_get_ivars(child)) == 0)
- return (ENOENT);
-
- switch (which) {
- case NEXUS_IVAR_NAME:
- return (EINVAL);
-
- /* Identified devices may want to set these */
- case NEXUS_IVAR_NODE:
- dinfo->ndi_node = (phandle_t)value;
- break;
-
- case NEXUS_IVAR_DEVICE_TYPE:
- dinfo->ndi_device_type = (char *)value;
- break;
-
- default:
- return (ENOENT);
- }
- return 0;
-}
-
-static int
-nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
- driver_intr_t *intr, void *arg, void **cookiep)
-{
- struct nexus_softc *sc;
-
- sc = device_get_softc(dev);
-
- if (device_get_state(sc->sc_pic) != DS_ATTACHED)
- panic("nexus_setup_intr: no pic attached\n");
-
- return (PIC_SETUP_INTR(sc->sc_pic, child, res, flags, intr, arg,
- cookiep));
-}
-
-static int
-nexus_teardown_intr(device_t dev, device_t child, struct resource *res,
- void *ih)
-{
- struct nexus_softc *sc;
-
- sc = device_get_softc(dev);
-
- if (device_get_state(sc->sc_pic) != DS_ATTACHED)
- panic("nexus_teardown_intr: no pic attached\n");
-
- return (PIC_TEARDOWN_INTR(sc->sc_pic, child, res, ih));
-}
-
-/*
- * Allocate resources at the behest of a child. This only handles interrupts,
- * since I/O resources are handled by child busses.
- */
-static struct resource *
-nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
- u_long start, u_long end, u_long count, u_int flags)
-{
- struct nexus_softc *sc;
- struct resource *rv;
-
- sc = device_get_softc(bus);
-
- if (type != SYS_RES_IRQ) {
- device_printf(bus, "unknown resource request from %s\n",
- device_get_nameunit(child));
- return (NULL);
- }
-
- if (device_get_state(sc->sc_pic) != DS_ATTACHED)
- panic("nexus_alloc_resource: no pic attached\n");
-
- rv = PIC_ALLOCATE_INTR(sc->sc_pic, child, rid, start, flags);
-
- return (rv);
-}
-
-static int
-nexus_activate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
-{
-
- /* Not much to be done yet... */
- return (rman_activate_resource(res));
-}
-
-static int
-nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
-{
-
- /* Not much to be done yet... */
- return (rman_deactivate_resource(res));
-}
-
-static int
-nexus_release_resource(device_t bus, device_t child, int type, int rid,
- struct resource *res)
-{
- struct nexus_softc *sc;
-
- sc = device_get_softc(bus);
-
- if (type != SYS_RES_IRQ) {
- device_printf(bus, "unknown resource request from %s\n",
- device_get_nameunit(child));
- return (EINVAL);
- }
-
- if (device_get_state(sc->sc_pic) != DS_ATTACHED)
- panic("nexus_release_resource: no pic attached\n");
-
- return (PIC_RELEASE_INTR(sc->sc_pic, child, rid, res));
-}
-
-static device_t
-nexus_device_from_node(device_t parent, phandle_t node)
-{
- device_t cdev;
- struct nexus_devinfo *dinfo;
- char *name, *type, *compatible;
-
- OF_getprop_alloc(node, "name", 1, (void **)&name);
- OF_getprop_alloc(node, "device_type", 1, (void **)&type);
- OF_getprop_alloc(node, "compatible", 1, (void **)&compatible);
- cdev = device_add_child(parent, NULL, -1);
- if (cdev != NULL) {
- dinfo = malloc(sizeof(*dinfo), M_NEXUS, M_WAITOK);
- dinfo->ndi_node = node;
- dinfo->ndi_name = name;
- dinfo->ndi_device_type = type;
- dinfo->ndi_compatible = compatible;
- device_set_ivars(cdev, dinfo);
- } else
- free(name, M_OFWPROP);
-
- return (cdev);
-}
-
-int
-nexus_install_intcntlr(device_t dev)
-{
- struct nexus_softc *sc;
-
- sc = device_get_softc(device_get_parent(dev));
- sc->sc_pic = dev;
-
- return (0);
-}
diff --git a/sys/powerpc/aim/ofw_machdep.c b/sys/powerpc/aim/ofw_machdep.c
deleted file mode 100644
index b4c97a2..0000000
--- a/sys/powerpc/aim/ofw_machdep.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*-
- * Copyright (C) 1996 Wolfgang Solfrank.
- * Copyright (C) 1996 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.
- *
- * $NetBSD: ofw_machdep.c,v 1.5 2000/05/23 13:25:43 tsubai Exp $
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/bus.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/disk.h>
-#include <sys/fcntl.h>
-#include <sys/malloc.h>
-#include <sys/stat.h>
-
-#include <net/ethernet.h>
-
-#include <dev/ofw/openfirm.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/vm_page.h>
-
-#include <machine/powerpc.h>
-#include <machine/ofw_machdep.h>
-#include <powerpc/ofw/ofw_pci.h>
-
-#define OFMEM_REGIONS 32
-static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3];
-static struct mem_region OFfree[OFMEM_REGIONS + 3];
-
-extern long ofmsr;
-extern struct pmap ofw_pmap;
-extern int pmap_bootstrapped;
-static int (*ofwcall)(void *);
-
-/*
- * Memory region utilities: determine if two regions overlap,
- * and merge two overlapping regions into one
- */
-static int
-memr_overlap(struct mem_region *r1, struct mem_region *r2)
-{
- if ((r1->mr_start + r1->mr_size) < r2->mr_start ||
- (r2->mr_start + r2->mr_size) < r1->mr_start)
- return (FALSE);
-
- return (TRUE);
-}
-
-static void
-memr_merge(struct mem_region *from, struct mem_region *to)
-{
- int end;
- end = imax(to->mr_start + to->mr_size, from->mr_start + from->mr_size);
- to->mr_start = imin(from->mr_start, to->mr_start);
- to->mr_size = end - to->mr_start;
-}
-
-/*
- * This is called during powerpc_init, before the system is really initialized.
- * It shall provide the total and the available regions of RAM.
- * Both lists must have a zero-size entry as terminator.
- * The available regions need not take the kernel into account, but needs
- * to provide space for two additional entry beyond the terminating one.
- */
-void
-mem_regions(struct mem_region **memp, int *memsz,
- struct mem_region **availp, int *availsz)
-{
- int phandle;
- int asz, msz, fsz;
- int i, j;
- int still_merging;
-
- /*
- * Get memory.
- */
- if ((phandle = OF_finddevice("/memory")) == -1
- || (msz = OF_getprop(phandle, "reg",
- OFmem, sizeof OFmem[0] * OFMEM_REGIONS))
- <= 0
- || (asz = OF_getprop(phandle, "available",
- OFavail, sizeof OFavail[0] * OFMEM_REGIONS))
- <= 0)
- panic("no memory?");
- *memp = OFmem;
- *memsz = msz / sizeof(struct mem_region);
-
- /*
- * OFavail may have overlapping regions - collapse these
- * and copy out remaining regions to OFfree
- */
- asz /= sizeof(struct mem_region);
- do {
- still_merging = FALSE;
- for (i = 0; i < asz; i++) {
- if (OFavail[i].mr_size == 0)
- continue;
- for (j = i+1; j < asz; j++) {
- if (OFavail[j].mr_size == 0)
- continue;
- if (memr_overlap(&OFavail[j], &OFavail[i])) {
- memr_merge(&OFavail[j], &OFavail[i]);
- /* mark inactive */
- OFavail[j].mr_size = 0;
- still_merging = TRUE;
- }
- }
- }
- } while (still_merging == TRUE);
-
- /* evict inactive ranges */
- for (i = 0, fsz = 0; i < asz; i++) {
- if (OFavail[i].mr_size != 0) {
- OFfree[fsz] = OFavail[i];
- fsz++;
- }
- }
-
- *availp = OFfree;
- *availsz = fsz;
-}
-
-void
-set_openfirm_callback(int (*openfirm)(void *))
-{
-
- ofwcall = openfirm;
-}
-
-int
-openfirmware(void *args)
-{
- long oldmsr;
- int result;
- u_int srsave[16];
- u_int i;
-
- __asm __volatile( "\t"
- "sync\n\t"
- "mfmsr %0\n\t"
- "mtmsr %1\n\t"
- "isync\n"
- : "=r" (oldmsr)
- : "r" (ofmsr)
- );
-
- if (pmap_bootstrapped) {
- /*
- * Swap the kernel's address space with Open Firmware's
- */
- for (i = 0; i < 16; i++) {
- srsave[i] = mfsrin(i << ADDR_SR_SHFT);
- mtsrin(i << ADDR_SR_SHFT, ofw_pmap.pm_sr[i]);
- }
-
- /*
- * Clear battable[] translations
- */
- __asm __volatile("mtdbatu 2, %0\n"
- "mtdbatu 3, %0" : : "r" (0));
- isync();
- }
-
- result = ofwcall(args);
-
- if (pmap_bootstrapped) {
- /*
- * Restore the kernel's addr space. The isync() doesn;t
- * work outside the loop unless mtsrin() is open-coded
- * in an asm statement :(
- */
- for (i = 0; i < 16; i++) {
- mtsrin(i << ADDR_SR_SHFT, srsave[i]);
- isync();
- }
- }
-
- __asm( "\t"
- "mtmsr %0\n\t"
- "isync\n"
- : : "r" (oldmsr)
- );
-
- return (result);
-}
-
-void
-OF_halt()
-{
- int retval; /* dummy, this may not be needed */
-
- OF_interpret("shut-down", 1, &retval);
- for (;;); /* just in case */
-}
-
-void
-OF_reboot()
-{
- int retval; /* dummy, this may not be needed */
-
- OF_interpret("reset-all", 1, &retval);
- for (;;); /* just in case */
-}
-
-void
-OF_getetheraddr(device_t dev, u_char *addr)
-{
- phandle_t node;
-
- node = ofw_pci_find_node(dev);
- OF_getprop(node, "local-mac-address", addr, ETHER_ADDR_LEN);
-}
-
-int
-mem_valid(vm_offset_t addr, int len)
-{
- int i;
-
- for (i = 0; i < OFMEM_REGIONS; i++)
- if ((addr >= OFmem[i].mr_start)
- && (addr + len < OFmem[i].mr_start + OFmem[i].mr_size))
- return (0);
-
- return (EFAULT);
-}
diff --git a/sys/powerpc/aim/ofwmagic.S b/sys/powerpc/aim/ofwmagic.S
deleted file mode 100644
index 55af6d2..0000000
--- a/sys/powerpc/aim/ofwmagic.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $FreeBSD$ */
-/* $NetBSD: ofwmagic.S,v 1.2 1997/10/09 08:38:18 jtc Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the 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.
- */
-
-/*
- * Magic note section used by Open Firmware.
- */
-
- .section ".note"
-
- /*# note header */
-
- /*# length of name */
- .long 8
-
- /*# note descriptor size */
- .long 20
-
- /*# note type (IEEE 1275) */
- .long 0x1275
-
- /*# name of owner */
- .asciz "PowerPC"
- .balign 4
-
-
- /*# note descriptor */
-
- /*# real mode (-1) or virtual mode (0) */
- .long 0
-
- /*# real-base */
- .long -1
- /*# real-size */
- .long -1
-
- /*# virt-base */
- .long -1
- /*# virt-size */
- .long -1
diff --git a/sys/powerpc/aim/swtch.S b/sys/powerpc/aim/swtch.S
deleted file mode 100644
index 038e788..0000000
--- a/sys/powerpc/aim/swtch.S
+++ /dev/null
@@ -1,154 +0,0 @@
-/* $FreeBSD$ */
-/* $NetBSD: locore.S,v 1.24 2000/05/31 05:09:17 thorpej Exp $ */
-
-/*-
- * Copyright (C) 2001 Benno Rice
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
- * 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.
-*/
-/*-
- * Copyright (C) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 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 "assym.s"
-
-#include <sys/syscall.h>
-
-#include <machine/trap.h>
-#include <machine/param.h>
-#include <machine/sr.h>
-#include <machine/psl.h>
-#include <machine/asm.h>
-
-/*
- * void cpu_switch(struct thread *old, struct thread *new)
- *
- * Switch to a new thread saving the current state in the old thread.
- */
-ENTRY(cpu_switch)
- lwz %r5,TD_PCB(%r3) /* Get the old thread's PCB ptr */
-
- mr %r12,%r2
- stmw %r12,PCB_CONTEXT(%r5) /* Save the non-volatile GP regs.
- These can now be used for scratch */
-
- mfcr %r16 /* Save the condition register */
- stw %r16,PCB_CR(%r5)
- mflr %r16 /* Save the link register */
- stw %r16,PCB_LR(%r5)
- mfsr %r16,USER_SR /* Save USER_SR for copyin/out */
- isync
- stw %r16,PCB_USR(%r5)
- stw %r1,PCB_SP(%r5) /* Save the stack pointer */
-
- mr %r14,%r3 /* Copy the old thread ptr... */
- mr %r15,%r4 /* and the new thread ptr in scratch */
-
- lwz %r6,PCB_FLAGS(%r5) /* Save FPU context if needed */
- andi. %r6, %r6, PCB_FPU
- beq .L1
- bl save_fpu
- mr %r3,%r14 /* restore old thread ptr */
-.L1:
- bl pmap_deactivate /* Deactivate the current pmap */
-
- mr %r3,%r15 /* Get new thread ptr */
- bl pmap_activate /* Activate the new address space */
-
- mfsprg %r7,0 /* Get the pcpu pointer */
- stw %r15,PC_CURTHREAD(%r7) /* Store new current thread */
- lwz %r17,TD_PCB(%r15) /* Store new current PCB */
- stw %r17,PC_CURPCB(%r7)
-
- lwz %r6, PCB_FLAGS(%r17) /* Restore FPU context if needed */
- andi. %r6, %r6, PCB_FPU
- beq .L2
- mr %r3,%r15 /* Pass curthread to enable_fpu */
- bl enable_fpu
-
- /* thread to restore is in r3 */
-.L2:
- mr %r3,%r17 /* Recover PCB ptr */
- lmw %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs */
- mr %r2,%r12
- lwz %r5,PCB_CR(%r3) /* Load the condition register */
- mtcr %r5
- lwz %r5,PCB_LR(%r3) /* Load the link register */
- mtlr %r5
- lwz %r5,PCB_USR(%r3) /* Load the USER_SR segment reg */
- mtsr USER_SR,%r5
- isync
- lwz %r1,PCB_SP(%r3) /* Load the stack pointer */
- blr
-
-/*
- * savectx(pcb)
- * Update pcb, saving current processor state
- */
-ENTRY(savectx)
- mr %r12,%r2
- stmw %r12,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs */
- mfcr %r4 /* Save the condition register */
- stw %r4,PCB_CONTEXT(%r3)
- blr
-
-/*
- * fork_trampoline()
- * Set up the return from cpu_fork()
- */
-ENTRY(fork_trampoline)
- lwz %r3,CF_FUNC(%r1)
- lwz %r4,CF_ARG0(%r1)
- lwz %r5,CF_ARG1(%r1)
- bl fork_exit
- addi %r1,%r1,CF_SIZE-FSP /* Allow 8 bytes in front of
- trapframe to simulate FRAME_SETUP
- does when allocating space for
- a frame pointer/saved LR */
- b trapexit
diff --git a/sys/powerpc/aim/trap.c b/sys/powerpc/aim/trap.c
deleted file mode 100644
index 669bb60..0000000
--- a/sys/powerpc/aim/trap.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/*-
- * Copyright (C) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 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.
- *
- * $NetBSD: trap.c,v 1.58 2002/03/04 04:07:35 dbj Exp $
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_ktrace.h"
-
-#include <sys/param.h>
-#include <sys/kdb.h>
-#include <sys/proc.h>
-#include <sys/ktr.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/pioctl.h>
-#include <sys/reboot.h>
-#include <sys/syscall.h>
-#include <sys/sysent.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/signalvar.h>
-#ifdef KTRACE
-#include <sys/ktrace.h>
-#endif
-#include <sys/vmmeter.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <vm/vm_extern.h>
-#include <vm/vm_param.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_map.h>
-#include <vm/vm_page.h>
-
-#include <machine/cpu.h>
-#include <machine/db_machdep.h>
-#include <machine/fpu.h>
-#include <machine/frame.h>
-#include <machine/pcb.h>
-#include <machine/pmap.h>
-#include <machine/psl.h>
-#include <machine/trap.h>
-#include <machine/spr.h>
-#include <machine/sr.h>
-
-void trap(struct trapframe *);
-
-static void trap_fatal(struct trapframe *frame);
-static void printtrap(u_int vector, struct trapframe *frame, int isfatal,
- int user);
-static int trap_pfault(struct trapframe *frame, int user);
-static int fix_unaligned(struct thread *td, struct trapframe *frame);
-static int handle_onfault(struct trapframe *frame);
-static void syscall(struct trapframe *frame);
-
-static __inline void setusr(u_int);
-
-int setfault(faultbuf); /* defined in locore.S */
-
-/* Why are these not defined in a header? */
-int badaddr(void *, size_t);
-int badaddr_read(void *, size_t, int *);
-
-extern char *syscallnames[];
-
-struct powerpc_exception {
- u_int vector;
- char *name;
-};
-
-static struct powerpc_exception powerpc_exceptions[] = {
- { 0x0100, "system reset" },
- { 0x0200, "machine check" },
- { 0x0300, "data storage interrupt" },
- { 0x0400, "instruction storage interrupt" },
- { 0x0500, "external interrupt" },
- { 0x0600, "alignment" },
- { 0x0700, "program" },
- { 0x0800, "floating-point unavailable" },
- { 0x0900, "decrementer" },
- { 0x0c00, "system call" },
- { 0x0d00, "trace" },
- { 0x0e00, "floating-point assist" },
- { 0x0f00, "performance monitoring" },
- { 0x0f20, "altivec unavailable" },
- { 0x1000, "instruction tlb miss" },
- { 0x1100, "data load tlb miss" },
- { 0x1200, "data store tlb miss" },
- { 0x1300, "instruction breakpoint" },
- { 0x1400, "system management" },
- { 0x1600, "altivec assist" },
- { 0x1700, "thermal management" },
- { 0x2000, "run mode/trace" },
- { 0x3000, NULL }
-};
-
-static const char *
-trapname(u_int vector)
-{
- struct powerpc_exception *pe;
-
- for (pe = powerpc_exceptions; pe->vector != 0x3000; pe++) {
- if (pe->vector == vector)
- return (pe->name);
- }
-
- return ("unknown");
-}
-
-void
-trap(struct trapframe *frame)
-{
- struct thread *td;
- struct proc *p;
- int sig, type, user;
- u_int sticks, ucode;
-
- PCPU_LAZY_INC(cnt.v_trap);
-
- td = PCPU_GET(curthread);
- p = td->td_proc;
-
- type = ucode = frame->exc;
- sig = 0;
- user = frame->srr1 & PSL_PR;
- sticks = 0;
-
- CTR3(KTR_TRAP, "trap: %s type=%s (%s)", p->p_comm,
- trapname(type), user ? "user" : "kernel");
-
- if (user) {
- sticks = td->td_sticks;
- td->td_frame = frame;
- if (td->td_ucred != p->p_ucred)
- cred_update_thread(td);
-
- /* User Mode Traps */
- switch (type) {
- case EXC_RUNMODETRC:
- case EXC_TRC:
- frame->srr1 &= ~PSL_SE;
- sig = SIGTRAP;
- break;
-
- case EXC_DSI:
- case EXC_ISI:
- sig = trap_pfault(frame, 1);
- break;
-
- case EXC_SC:
- syscall(frame);
- break;
-
- case EXC_FPU:
- KASSERT((td->td_pcb->pcb_flags & PCB_FPU) != PCB_FPU,
- ("FPU already enabled for thread"));
- enable_fpu(td);
- break;
-
-#ifdef ALTIVEC
- case EXC_VEC:
- if ((vecthread = PCPU_GET(vecthread)) != NULL) {
- KASSERT(vecthread != td,
- ("altivec already enabled"));
- save_vec(vecthread);
- }
- PCPU_SET(vecthread, td);
- td->td_pcb->pcb_veccpu = PCPU_GET(cpuid);
- enable_vec(td);
- frame->srr1 |= PSL_VEC;
- break;
-#endif /* ALTIVEC */
-
- case EXC_ALI:
- if (fix_unaligned(td, frame) != 0)
- sig = SIGBUS;
- else
- frame->srr0 += 4;
- break;
-
- case EXC_PGM:
- /* XXX temporarily */
- /* XXX: Magic Number? */
- if (frame->srr1 & 0x0002000)
- sig = SIGTRAP;
- else
- sig = SIGILL;
- break;
-
- default:
- trap_fatal(frame);
- }
- } else {
- /* Kernel Mode Traps */
-
- KASSERT(cold || td->td_ucred != NULL,
- ("kernel trap doesn't have ucred"));
- switch (type) {
- case EXC_DSI:
- if (trap_pfault(frame, 0) == 0)
- return;
- break;
- case EXC_MCHK:
- if (handle_onfault(frame))
- return;
- break;
- default:
- break;
- }
- trap_fatal(frame);
- }
-
-#ifdef ALTIVEC
- if (td != PCPU_GET(vecthread) ||
- td->td_pcb->pcb_veccpu != PCPU_GET(cpuid))
- frame->srr1 &= ~PSL_VEC;
-#endif /* ALTIVEC */
-
- if (sig != 0) {
- if (p->p_sysent->sv_transtrap != NULL)
- sig = (p->p_sysent->sv_transtrap)(sig, type);
- trapsignal(td, sig, ucode);
- }
-
- userret(td, frame, sticks);
- mtx_assert(&Giant, MA_NOTOWNED);
-}
-
-static void
-trap_fatal(struct trapframe *frame)
-{
-
- printtrap(frame->exc, frame, 1, (frame->srr1 & PSL_PR));
-#ifdef KDB
- if ((debugger_on_panic || kdb_active) &&
- kdb_trap(frame->exc, 0, frame))
- return;
-#endif
- panic("%s trap", trapname(frame->exc));
-}
-
-static void
-printtrap(u_int vector, struct trapframe *frame, int isfatal, int user)
-{
-
- printf("\n");
- printf("%s %s trap:\n", isfatal ? "fatal" : "handled",
- user ? "user" : "kernel");
- printf("\n");
- printf(" exception = 0x%x (%s)\n", vector >> 8,
- trapname(vector));
- switch (vector) {
- case EXC_DSI:
- printf(" virtual address = 0x%x\n", frame->dar);
- break;
- case EXC_ISI:
- printf(" virtual address = 0x%x\n", frame->srr0);
- break;
- }
- printf(" srr0 = 0x%x\n", frame->srr0);
- printf(" srr1 = 0x%x\n", frame->srr1);
- printf(" curthread = %p\n", curthread);
- if (curthread != NULL)
- printf(" pid = %d, comm = %s\n",
- curthread->td_proc->p_pid, curthread->td_proc->p_comm);
- printf("\n");
-}
-
-/*
- * Handles a fatal fault when we have onfault state to recover. Returns
- * non-zero if there was onfault recovery state available.
- */
-static int
-handle_onfault(struct trapframe *frame)
-{
- struct thread *td;
- faultbuf *fb;
-
- td = curthread;
- fb = td->td_pcb->pcb_onfault;
- if (fb != NULL) {
- frame->srr0 = (*fb)[0];
- frame->fixreg[1] = (*fb)[1];
- frame->fixreg[2] = (*fb)[2];
- frame->fixreg[3] = 1;
- frame->cr = (*fb)[3];
- bcopy(&(*fb)[4], &frame->fixreg[13],
- 19 * sizeof(register_t));
- return (1);
- }
- return (0);
-}
-
-void
-syscall(struct trapframe *frame)
-{
- caddr_t params;
- struct sysent *callp;
- struct thread *td;
- struct proc *p;
- int error, n;
- size_t narg;
- register_t args[10];
- u_int code;
-
- td = PCPU_GET(curthread);
- p = td->td_proc;
-
- PCPU_LAZY_INC(cnt.v_syscall);
-
- if (p->p_flag & P_SA)
- thread_user_enter(td);
-
- code = frame->fixreg[0];
- params = (caddr_t)(frame->fixreg + FIRSTARG);
- n = NARGREG;
-
- if (p->p_sysent->sv_prepsyscall) {
- /*
- * The prep code is MP aware.
- */
- (*p->p_sysent->sv_prepsyscall)(frame, args, &code, &params);
- } else if (code == SYS_syscall) {
- /*
- * code is first argument,
- * followed by actual args.
- */
- code = *(u_int *) params;
- params += sizeof(register_t);
- n -= 1;
- } else if (code == SYS___syscall) {
- /*
- * Like syscall, but code is a quad,
- * so as to maintain quad alignment
- * for the rest of the args.
- */
- params += sizeof(register_t);
- code = *(u_int *) params;
- params += sizeof(register_t);
- n -= 2;
- }
-
- if (p->p_sysent->sv_mask)
- code &= p->p_sysent->sv_mask;
-
- if (code >= p->p_sysent->sv_size)
- callp = &p->p_sysent->sv_table[0];
- else
- callp = &p->p_sysent->sv_table[code];
-
- narg = callp->sy_narg & SYF_ARGMASK;
-
- if (narg > n) {
- bcopy(params, args, n * sizeof(register_t));
- error = copyin(MOREARGS(frame->fixreg[1]), args + n,
- (narg - n) * sizeof(register_t));
- params = (caddr_t)args;
- } else
- error = 0;
-
- CTR5(KTR_SYSC, "syscall: p=%s %s(%x %x %x)", p->p_comm,
- syscallnames[code],
- frame->fixreg[FIRSTARG],
- frame->fixreg[FIRSTARG+1],
- frame->fixreg[FIRSTARG+2]);
-
-#ifdef KTRACE
- if (KTRPOINT(td, KTR_SYSCALL))
- ktrsyscall(code, narg, (register_t *)params);
-#endif
- /*
- * Try to run the syscall without Giant if the syscall is MP safe.
- */
- if ((callp->sy_narg & SYF_MPSAFE) == 0)
- mtx_lock(&Giant);
-
- if (error == 0) {
- td->td_retval[0] = 0;
- td->td_retval[1] = frame->fixreg[FIRSTARG + 1];
-
- STOPEVENT(p, S_SCE, narg);
-
- error = (*callp->sy_call)(td, params);
-
- CTR3(KTR_SYSC, "syscall: p=%s %s ret=%x", p->p_comm,
- syscallnames[code], td->td_retval[0]);
- }
- switch (error) {
- case 0:
- if ((frame->fixreg[0] == SYS___syscall) &&
- (code != SYS_lseek)) {
- /*
- * 64-bit return, 32-bit syscall. Fixup byte order
- */
- frame->fixreg[FIRSTARG] = 0;
- frame->fixreg[FIRSTARG + 1] = td->td_retval[0];
- } else {
- frame->fixreg[FIRSTARG] = td->td_retval[0];
- frame->fixreg[FIRSTARG + 1] = td->td_retval[1];
- }
- /* XXX: Magic number */
- frame->cr &= ~0x10000000;
- break;
- case ERESTART:
- /*
- * Set user's pc back to redo the system call.
- */
- frame->srr0 -= 4;
- break;
- case EJUSTRETURN:
- /* nothing to do */
- break;
- default:
- if (p->p_sysent->sv_errsize) {
- if (error >= p->p_sysent->sv_errsize)
- error = -1; /* XXX */
- else
- error = p->p_sysent->sv_errtbl[error];
- }
- frame->fixreg[FIRSTARG] = error;
- /* XXX: Magic number: Carry Flag Equivalent? */
- frame->cr |= 0x10000000;
- break;
- }
-
-
- if ((callp->sy_narg & SYF_MPSAFE) == 0)
- mtx_unlock(&Giant);
-
-#ifdef KTRACE
- if (KTRPOINT(td, KTR_SYSRET))
- ktrsysret(code, error, td->td_retval[0]);
-#endif
-
- /*
- * Does the comment in the i386 code about errno apply here?
- */
- STOPEVENT(p, S_SCX, code);
-
- WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning",
- (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???");
- mtx_assert(&sched_lock, MA_NOTOWNED);
- mtx_assert(&Giant, MA_NOTOWNED);
-}
-
-static int
-trap_pfault(struct trapframe *frame, int user)
-{
- vm_offset_t eva, va;
- struct thread *td;
- struct proc *p;
- vm_map_t map;
- vm_prot_t ftype;
- int rv;
- u_int user_sr;
-
- td = curthread;
- p = td->td_proc;
- if (frame->exc == EXC_ISI) {
- eva = frame->srr0;
- ftype = VM_PROT_READ | VM_PROT_EXECUTE;
- } else {
- eva = frame->dar;
- if (frame->dsisr & DSISR_STORE)
- ftype = VM_PROT_WRITE;
- else
- ftype = VM_PROT_READ;
- }
-
- if (user) {
- map = &p->p_vmspace->vm_map;
- } else {
- if ((eva >> ADDR_SR_SHFT) == USER_SR) {
- if (p->p_vmspace == NULL)
- return (SIGSEGV);
-
- __asm ("mfsr %0, %1"
- : "=r"(user_sr)
- : "K"(USER_SR));
- eva &= ADDR_PIDX | ADDR_POFF;
- eva |= user_sr << ADDR_SR_SHFT;
- map = &p->p_vmspace->vm_map;
- } else {
- map = kernel_map;
- }
- }
- va = trunc_page(eva);
-
- if (map != kernel_map) {
- /*
- * Keep swapout from messing with us during this
- * critical time.
- */
- PROC_LOCK(p);
- ++p->p_lock;
- PROC_UNLOCK(p);
-
- /* Fault in the user page: */
- rv = vm_fault(map, va, ftype,
- (ftype & VM_PROT_WRITE) ? VM_FAULT_DIRTY
- : VM_FAULT_NORMAL);
-
- PROC_LOCK(p);
- --p->p_lock;
- PROC_UNLOCK(p);
- } else {
- /*
- * Don't have to worry about process locking or stacks in the
- * kernel.
- */
- rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
- }
-
- if (rv == KERN_SUCCESS)
- return (0);
-
- if (!user && handle_onfault(frame))
- return (0);
-
- return (SIGSEGV);
-}
-
-static __inline void
-setusr(u_int content)
-{
- __asm __volatile ("isync; mtsr %0,%1; isync"
- :: "n"(USER_SR), "r"(content));
-}
-
-int
-badaddr(void *addr, size_t size)
-{
- return (badaddr_read(addr, size, NULL));
-}
-
-int
-badaddr_read(void *addr, size_t size, int *rptr)
-{
- struct thread *td;
- faultbuf env;
- int x;
-
- /* Get rid of any stale machine checks that have been waiting. */
- __asm __volatile ("sync; isync");
-
- td = PCPU_GET(curthread);
-
- if (setfault(env)) {
- td->td_pcb->pcb_onfault = 0;
- __asm __volatile ("sync");
- return 1;
- }
-
- __asm __volatile ("sync");
-
- switch (size) {
- case 1:
- x = *(volatile int8_t *)addr;
- break;
- case 2:
- x = *(volatile int16_t *)addr;
- break;
- case 4:
- x = *(volatile int32_t *)addr;
- break;
- default:
- panic("badaddr: invalid size (%d)", size);
- }
-
- /* Make sure we took the machine check, if we caused one. */
- __asm __volatile ("sync; isync");
-
- td->td_pcb->pcb_onfault = 0;
- __asm __volatile ("sync"); /* To be sure. */
-
- /* Use the value to avoid reorder. */
- if (rptr)
- *rptr = x;
-
- return (0);
-}
-
-/*
- * For now, this only deals with the particular unaligned access case
- * that gcc tends to generate. Eventually it should handle all of the
- * possibilities that can happen on a 32-bit PowerPC in big-endian mode.
- */
-
-static int
-fix_unaligned(struct thread *td, struct trapframe *frame)
-{
- struct thread *fputhread;
- int indicator, reg;
- double *fpr;
-
- indicator = EXC_ALI_OPCODE_INDICATOR(frame->dsisr);
-
- switch (indicator) {
- case EXC_ALI_LFD:
- case EXC_ALI_STFD:
- reg = EXC_ALI_RST(frame->dsisr);
- fpr = &td->td_pcb->pcb_fpu.fpr[reg];
- fputhread = PCPU_GET(fputhread);
-
- /* Juggle the FPU to ensure that we've initialized
- * the FPRs, and that their current state is in
- * the PCB.
- */
- if (fputhread != td) {
- if (fputhread)
- save_fpu(fputhread);
- enable_fpu(td);
- }
- save_fpu(td);
-
- if (indicator == EXC_ALI_LFD) {
- if (copyin((void *)frame->dar, fpr,
- sizeof(double)) != 0)
- return -1;
- enable_fpu(td);
- } else {
- if (copyout(fpr, (void *)frame->dar,
- sizeof(double)) != 0)
- return -1;
- }
- return 0;
- break;
- }
-
- return -1;
-}
diff --git a/sys/powerpc/aim/trap_subr.S b/sys/powerpc/aim/trap_subr.S
deleted file mode 100644
index 60435dd..0000000
--- a/sys/powerpc/aim/trap_subr.S
+++ /dev/null
@@ -1,530 +0,0 @@
-/* $FreeBSD$ */
-/* $NetBSD: trap_subr.S,v 1.20 2002/04/22 23:20:08 kleink Exp $ */
-
-/*-
- * Copyright (C) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 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.
- */
-
-/*
- * NOTICE: This is not a standalone file. to use it, #include it in
- * your port's locore.S, like so:
- *
- * #include <powerpc/powerpc/trap_subr.S>
- */
-
-/*
- * Save/restore segment registers
- */
-#define RESTORE_SRS(pmap,sr) mtsr 0,sr; \
- lwz sr,1*4(pmap); mtsr 1,sr; \
- lwz sr,2*4(pmap); mtsr 2,sr; \
- lwz sr,3*4(pmap); mtsr 3,sr; \
- lwz sr,4*4(pmap); mtsr 4,sr; \
- lwz sr,5*4(pmap); mtsr 5,sr; \
- lwz sr,6*4(pmap); mtsr 6,sr; \
- lwz sr,7*4(pmap); mtsr 7,sr; \
- lwz sr,8*4(pmap); mtsr 8,sr; \
- lwz sr,9*4(pmap); mtsr 9,sr; \
- lwz sr,10*4(pmap); mtsr 10,sr; \
- lwz sr,11*4(pmap); mtsr 11,sr; \
- lwz sr,12*4(pmap); mtsr 12,sr; \
- lwz sr,13*4(pmap); mtsr 13,sr; \
- lwz sr,14*4(pmap); mtsr 14,sr; \
- lwz sr,15*4(pmap); mtsr 15,sr; isync;
-
-/*
- * User SRs are loaded through a pointer to the current pmap.
- */
-#define RESTORE_USER_SRS(pmap,sr) \
- GET_CPUINFO(pmap); \
- lwz pmap,PC_CURPMAP(pmap); \
- lwzu sr,PM_SR(pmap); \
- RESTORE_SRS(pmap,sr)
-
-/*
- * Kernel SRs are loaded directly from kernel_pmap_
- */
-#define RESTORE_KERN_SRS(pmap,sr) \
- lis pmap,CNAME(kernel_pmap_store)@ha; \
- lwzu sr,CNAME(kernel_pmap_store)+PM_SR@l(pmap); \
- RESTORE_SRS(pmap,sr)
-
-/*
- * FRAME_SETUP assumes:
- * SPRG1 SP (1)
- * savearea r28-r31,DAR,DSISR (DAR & DSISR only for DSI traps)
- * r28 LR
- * r29 CR
- * r30 scratch
- * r31 scratch
- * r1 kernel stack
- * LR trap type (from calling address, mask with 0xff00)
- * SRR0/1 as at start of trap
- */
-#define FRAME_SETUP(savearea) \
-/* Have to enable translation to allow access of kernel stack: */ \
- GET_CPUINFO(%r31); \
- mfsrr0 %r30; \
- stw %r30,(savearea+CPUSAVE_SRR0)(%r31); /* save SRR0 */ \
- mfsrr1 %r30; \
- stw %r30,(savearea+CPUSAVE_SRR1)(%r31); /* save SRR1 */ \
- mfmsr %r30; \
- ori %r30,%r30,(PSL_DR|PSL_IR|PSL_RI)@l; /* relocation on */ \
- mtmsr %r30; /* stack can now be accessed */ \
- isync; \
- mfsprg1 %r31; /* get saved SP */ \
- stwu %r31,-FRAMELEN(%r1); /* save it in the callframe */ \
- stw %r0, FRAME_0+8(%r1); /* save r0 in the trapframe */ \
- stw %r31,FRAME_1+8(%r1); /* save SP " " */ \
- stw %r2, FRAME_2+8(%r1); /* save r2 " " */ \
- stw %r28,FRAME_LR+8(%r1); /* save LR " " */ \
- stw %r29,FRAME_CR+8(%r1); /* save CR " " */ \
- GET_CPUINFO(%r2); \
- lwz %r28,(savearea+CPUSAVE_R28)(%r2); /* get saved r28 */ \
- lwz %r29,(savearea+CPUSAVE_R29)(%r2); /* get saved r29 */ \
- lwz %r30,(savearea+CPUSAVE_R30)(%r2); /* get saved r30 */ \
- lwz %r31,(savearea+CPUSAVE_R31)(%r2); /* get saved r31 */ \
- stw %r3, FRAME_3+8(%r1); /* save r3-r31 */ \
- stw %r4, FRAME_4+8(%r1); \
- stw %r5, FRAME_5+8(%r1); \
- stw %r6, FRAME_6+8(%r1); \
- stw %r7, FRAME_7+8(%r1); \
- stw %r8, FRAME_8+8(%r1); \
- stw %r9, FRAME_9+8(%r1); \
- stw %r10, FRAME_10+8(%r1); \
- stw %r11, FRAME_11+8(%r1); \
- stw %r12, FRAME_12+8(%r1); \
- stw %r13, FRAME_13+8(%r1); \
- stw %r14, FRAME_14+8(%r1); \
- stw %r15, FRAME_15+8(%r1); \
- stw %r16, FRAME_16+8(%r1); \
- stw %r17, FRAME_17+8(%r1); \
- stw %r18, FRAME_18+8(%r1); \
- stw %r19, FRAME_19+8(%r1); \
- stw %r20, FRAME_20+8(%r1); \
- stw %r21, FRAME_21+8(%r1); \
- stw %r22, FRAME_22+8(%r1); \
- stw %r23, FRAME_23+8(%r1); \
- stw %r24, FRAME_24+8(%r1); \
- stw %r25, FRAME_25+8(%r1); \
- stw %r26, FRAME_26+8(%r1); \
- stw %r27, FRAME_27+8(%r1); \
- stw %r28, FRAME_28+8(%r1); \
- stw %r29, FRAME_29+8(%r1); \
- stw %r30, FRAME_30+8(%r1); \
- stw %r31, FRAME_31+8(%r1); \
- lwz %r28,(savearea+CPUSAVE_DAR)(%r2); /* saved DAR */ \
- lwz %r29,(savearea+CPUSAVE_DSISR)(%r2);/* saved DSISR */ \
- lwz %r30,(savearea+CPUSAVE_SRR0)(%r2); /* saved SRR0 */ \
- lwz %r31,(savearea+CPUSAVE_SRR1)(%r2); /* saved SRR1 */ \
- mfxer %r3; \
- mfctr %r4; \
- mflr %r5; \
- andi. %r5,%r5,0xff00; /* convert LR to exc # */ \
- stw %r3, FRAME_XER+8(1); /* save xer/ctr/exc */ \
- stw %r4, FRAME_CTR+8(1); \
- stw %r5, FRAME_EXC+8(1); \
- stw %r28,FRAME_DAR+8(1); \
- stw %r29,FRAME_DSISR+8(1); /* save dsisr/srr0/srr1 */ \
- stw %r30,FRAME_SRR0+8(1); \
- stw %r31,FRAME_SRR1+8(1)
-
-#define FRAME_LEAVE(savearea) \
-/* Now restore regs: */ \
- lwz %r2,FRAME_SRR0+8(%r1); \
- lwz %r3,FRAME_SRR1+8(%r1); \
- lwz %r4,FRAME_CTR+8(%r1); \
- lwz %r5,FRAME_XER+8(%r1); \
- lwz %r6,FRAME_LR+8(%r1); \
- GET_CPUINFO(%r7); \
- stw %r2,(savearea+CPUSAVE_SRR0)(%r7); /* save SRR0 */ \
- stw %r3,(savearea+CPUSAVE_SRR1)(%r7); /* save SRR1 */ \
- lwz %r7,FRAME_CR+8(%r1); \
- mtctr %r4; \
- mtxer %r5; \
- mtlr %r6; \
- mtsprg1 %r7; /* save cr */ \
- lwz %r31,FRAME_31+8(%r1); /* restore r0-31 */ \
- lwz %r30,FRAME_30+8(%r1); \
- lwz %r29,FRAME_29+8(%r1); \
- lwz %r28,FRAME_28+8(%r1); \
- lwz %r27,FRAME_27+8(%r1); \
- lwz %r26,FRAME_26+8(%r1); \
- lwz %r25,FRAME_25+8(%r1); \
- lwz %r24,FRAME_24+8(%r1); \
- lwz %r23,FRAME_23+8(%r1); \
- lwz %r22,FRAME_22+8(%r1); \
- lwz %r21,FRAME_21+8(%r1); \
- lwz %r20,FRAME_20+8(%r1); \
- lwz %r19,FRAME_19+8(%r1); \
- lwz %r18,FRAME_18+8(%r1); \
- lwz %r17,FRAME_17+8(%r1); \
- lwz %r16,FRAME_16+8(%r1); \
- lwz %r15,FRAME_15+8(%r1); \
- lwz %r14,FRAME_14+8(%r1); \
- lwz %r13,FRAME_13+8(%r1); \
- lwz %r12,FRAME_12+8(%r1); \
- lwz %r11,FRAME_11+8(%r1); \
- lwz %r10,FRAME_10+8(%r1); \
- lwz %r9, FRAME_9+8(%r1); \
- lwz %r8, FRAME_8+8(%r1); \
- lwz %r7, FRAME_7+8(%r1); \
- lwz %r6, FRAME_6+8(%r1); \
- lwz %r5, FRAME_5+8(%r1); \
- lwz %r4, FRAME_4+8(%r1); \
- lwz %r3, FRAME_3+8(%r1); \
- lwz %r2, FRAME_2+8(%r1); \
- lwz %r0, FRAME_0+8(%r1); \
- lwz %r1, FRAME_1+8(%r1); \
-/* Can't touch %r1 from here on */ \
- mtsprg2 %r2; /* save r2 & r3 */ \
- mtsprg3 %r3; \
-/* Disable translation, machine check and recoverability: */ \
- mfmsr %r2; \
- andi. %r2,%r2,~(PSL_DR|PSL_IR|PSL_EE|PSL_ME|PSL_RI)@l; \
- mtmsr %r2; \
- isync; \
-/* Decide whether we return to user mode: */ \
- GET_CPUINFO(%r2); \
- lwz %r3,(savearea+CPUSAVE_SRR1)(%r2); \
- mtcr %r3; \
- bf 17,1f; /* branch if PSL_PR is false */ \
-/* Restore user SRs */ \
- RESTORE_USER_SRS(%r2,%r3); \
-1: mfsprg1 %r2; /* restore cr */ \
- mtcr %r2; \
- GET_CPUINFO(%r2); \
- lwz %r3,(savearea+CPUSAVE_SRR0)(%r2); /* restore srr0 */ \
- mtsrr0 %r3; \
- lwz %r3,(savearea+CPUSAVE_SRR1)(%r2); /* restore srr1 */ \
- mtsrr1 %r3; \
- mfsprg2 %r2; /* restore r2 & r3 */ \
- mfsprg3 %r3
-
-#ifdef KDB
-/*
- * Define the kdb debugger stack
- */
- .data
-GLOBAL(dbstk)
- .space INTSTK+8 /* kdb stack */
-#endif
-
-/*
- * This code gets copied to all the trap vectors
- * (except ISI/DSI, ALI, and the interrupts)
- */
- .text
- .globl CNAME(trapcode),CNAME(trapsize)
-CNAME(trapcode):
- mtsprg1 %r1 /* save SP */
- GET_CPUINFO(%r1)
- stw %r28,(PC_TEMPSAVE+CPUSAVE_R28)(%r1) /* free r28-r31 */
- stw %r29,(PC_TEMPSAVE+CPUSAVE_R29)(%r1)
- stw %r30,(PC_TEMPSAVE+CPUSAVE_R30)(%r1)
- stw %r31,(PC_TEMPSAVE+CPUSAVE_R31)(%r1)
- mfsprg1 %r1 /* restore SP, in case of branch */
- mflr %r28 /* save LR */
- mfcr %r29 /* save CR */
-/* Test whether we already had PR set */
- mfsrr1 %r31
- mtcr %r31
- bla s_trap /* LR & 0xff00 is exception # */
-CNAME(trapsize) = .-CNAME(trapcode)
-
-/*
- * For ALI: has to save DSISR and DAR
- */
- .globl CNAME(alitrap),CNAME(alisize)
-CNAME(alitrap):
- mtsprg1 %r1 /* save SP */
- GET_CPUINFO(%r1)
- stw %r28,(PC_TEMPSAVE+CPUSAVE_R28)(%r1) /* free r28-r31 */
- stw %r29,(PC_TEMPSAVE+CPUSAVE_R29)(%r1)
- stw %r30,(PC_TEMPSAVE+CPUSAVE_R30)(%r1)
- stw %r31,(PC_TEMPSAVE+CPUSAVE_R31)(%r1)
- mfdar %r30
- mfdsisr %r31
- stw %r30,(PC_TEMPSAVE+CPUSAVE_DAR)(%r1)
- stw %r31,(PC_TEMPSAVE+CPUSAVE_DSISR)(%r1)
- mfsprg1 %r1 /* restore SP, in case of branch */
- mflr %r28 /* save LR */
- mfcr %r29 /* save CR */
-/* Test whether we already had PR set */
- mfsrr1 %r31
- mtcr %r31
- bla s_trap /* LR & 0xff00 is exception # */
-CNAME(alisize) = .-CNAME(alitrap)
-
-/*
- * Similar to the above for DSI
- * Has to handle BAT spills
- * and standard pagetable spills
- */
- .globl CNAME(dsitrap),CNAME(dsisize)
-CNAME(dsitrap):
- mtsprg1 %r1 /* save SP */
- GET_CPUINFO(%r1)
- stw %r28,(PC_DISISAVE+CPUSAVE_R28)(%r1) /* free r28-r31 */
- stw %r29,(PC_DISISAVE+CPUSAVE_R29)(%r1)
- stw %r30,(PC_DISISAVE+CPUSAVE_R30)(%r1)
- stw %r31,(PC_DISISAVE+CPUSAVE_R31)(%r1)
- mfsprg1 %r1 /* restore SP */
- mfcr %r29 /* save CR */
- mfxer %r30 /* save XER */
- mtsprg2 %r30 /* in SPRG2 */
- mfsrr1 %r31 /* test kernel mode */
- mtcr %r31
- bt 17,1f /* branch if PSL_PR is set */
- mfdar %r31 /* get fault address */
- rlwinm %r31,%r31,7,25,28 /* get segment * 8 */
-
- /* get batu */
- addis %r31,%r31,CNAME(battable)@ha
- lwz %r30,CNAME(battable)@l(31)
- mtcr %r30
- bf 30,1f /* branch if supervisor valid is
- false */
- /* get batl */
- lwz %r31,CNAME(battable)+4@l(31)
-/* We randomly use the highest two bat registers here */
- mftb %r28
- andi. %r28,%r28,1
- bne 2f
- mtdbatu 2,%r30
- mtdbatl 2,%r31
- b 3f
-2:
- mtdbatu 3,%r30
- mtdbatl 3,%r31
-3:
- mfsprg2 %r30 /* restore XER */
- mtxer %r30
- mtcr %r29 /* restore CR */
- mtsprg1 %r1
- GET_CPUINFO(%r1)
- lwz %r28,(PC_DISISAVE+CPUSAVE_R28)(%r1) /* restore r28-r31 */
- lwz %r29,(PC_DISISAVE+CPUSAVE_R29)(%r1)
- lwz %r30,(PC_DISISAVE+CPUSAVE_R30)(%r1)
- lwz %r31,(PC_DISISAVE+CPUSAVE_R31)(%r1)
- mfsprg1 %r1
- rfi /* return to trapped code */
-1:
- mflr %r28 /* save LR (SP already saved) */
- bla disitrap
-CNAME(dsisize) = .-CNAME(dsitrap)
-
-/*
- * Preamble code for DSI/ISI traps
- */
-disitrap:
- GET_CPUINFO(%r1)
- lwz %r30,(PC_DISISAVE+CPUSAVE_R28)(%r1)
- stw %r30,(PC_TEMPSAVE+CPUSAVE_R28)(%r1)
- lwz %r31,(PC_DISISAVE+CPUSAVE_R29)(%r1)
- stw %r31,(PC_TEMPSAVE+CPUSAVE_R29)(%r1)
- lwz %r30,(PC_DISISAVE+CPUSAVE_R30)(%r1)
- stw %r30,(PC_TEMPSAVE+CPUSAVE_R30)(%r1)
- lwz %r31,(PC_DISISAVE+CPUSAVE_R31)(%r1)
- stw %r31,(PC_TEMPSAVE+CPUSAVE_R31)(%r1)
- mfdar %r30
- mfdsisr %r31
- stw %r30,(PC_TEMPSAVE+CPUSAVE_DAR)(%r1)
- stw %r31,(PC_TEMPSAVE+CPUSAVE_DSISR)(%r1)
-
-#ifdef KDB
- /* Try and detect a kernel stack overflow */
- mfsrr1 %r31
- mtcr %r31
- bt 17,realtrap /* branch is user mode */
- mfsprg1 %r31 /* get old SP */
- sub. %r30,%r31,%r30 /* SP - DAR */
- bge 1f
- neg %r30,%r30 /* modulo value */
-1: cmplwi %cr0,%r30,4096 /* is DAR within a page of SP? */
- bge %cr0,realtrap /* no, too far away. */
-
- /* Now convert this DSI into a DDB trap. */
- GET_CPUINFO(%r1)
- lwz %r30,(PC_TEMPSAVE+CPUSAVE_DAR)(%r1) /* get DAR */
- stw %r30,(PC_DBSAVE +CPUSAVE_DAR)(%r1) /* save DAR */
- lwz %r30,(PC_TEMPSAVE+CPUSAVE_DSISR)(%r1) /* get DSISR */
- lwz %r30,(PC_DBSAVE +CPUSAVE_DSISR)(%r1) /* save DSISR */
- lwz %r30,(PC_DISISAVE+CPUSAVE_R28)(%r1) /* get r28 */
- stw %r30,(PC_DBSAVE +CPUSAVE_R28)(%r1) /* save r28 */
- lwz %r31,(PC_DISISAVE+CPUSAVE_R29)(%r1) /* get r29 */
- stw %r31,(PC_DBSAVE +CPUSAVE_R29)(%r1) /* save r29 */
- lwz %r30,(PC_DISISAVE+CPUSAVE_R30)(%r1) /* get r30 */
- stw %r30,(PC_DBSAVE +CPUSAVE_R30)(%r1) /* save r30 */
- lwz %r31,(PC_DISISAVE+CPUSAVE_R31)(%r1) /* get r31 */
- stw %r31,(PC_DBSAVE +CPUSAVE_R31)(%r1) /* save r31 */
- lis %r1,dbstk+INTSTK@ha /* get new SP */
- addi %r1,%r1,dbstk+INTSTK@l
- b dbtrap
-#endif
-
- /* XXX need stack probe here */
-realtrap:
-/* Test whether we already had PR set */
- mfsrr1 %r1
- mtcr %r1
- mfsprg1 %r1 /* restore SP (might have been
- overwritten) */
-s_trap:
- bf 17,k_trap /* branch if PSL_PR is false */
- GET_CPUINFO(%r1)
-u_trap:
- lwz %r1,PC_CURPCB(%r1)
- RESTORE_KERN_SRS(%r30,%r31) /* enable kernel mapping */
-
-/*
- * Now the common trap catching code.
- */
-k_trap:
- FRAME_SETUP(PC_TEMPSAVE)
-/* Call C interrupt dispatcher: */
-trapagain:
- addi %r3,%r1,8
- bl CNAME(powerpc_interrupt)
- .globl CNAME(trapexit) /* backtrace code sentinel */
-CNAME(trapexit):
-
-/* Disable interrupts: */
- mfmsr %r3
- andi. %r3,%r3,~PSL_EE@l
- mtmsr %r3
-/* Test AST pending: */
- lwz %r5,FRAME_SRR1+8(%r1)
- mtcr %r5
- bf 17,1f /* branch if PSL_PR is false */
-
- GET_CPUINFO(%r3) /* get per-CPU pointer */
- lwz %r4, PC_CURTHREAD(%r3) /* deref to get curthread */
- lwz %r4, TD_FLAGS(%r4) /* get thread flags value */
- lis %r5, (TDF_ASTPENDING|TDF_NEEDRESCHED)@h
- ori %r5,%r5, (TDF_ASTPENDING|TDF_NEEDRESCHED)@l
- and. %r4,%r4,%r5
- beq 1f
- mfmsr %r3 /* re-enable interrupts */
- ori %r3,%r3,PSL_EE@l
- mtmsr %r3
- isync
- addi %r3,%r1,8
- bl CNAME(ast)
- b trapexit /* test ast ret value ? */
-1:
- FRAME_LEAVE(PC_TEMPSAVE)
- rfi
-
-#if defined(KDB)
-/*
- * Deliberate entry to dbtrap
- */
- .globl CNAME(ppc_db_trap)
-CNAME(ppc_db_trap):
- mtsprg1 %r1
- mfmsr %r3
- mtsrr1 %r3
- andi. %r3,%r3,~(PSL_EE|PSL_ME)@l
- mtmsr %r3 /* disable interrupts */
- isync
- GET_CPUINFO(%r3)
- stw %r28,(PC_DBSAVE+CPUSAVE_R28)(%r3)
- stw %r29,(PC_DBSAVE+CPUSAVE_R29)(%r3)
- stw %r30,(PC_DBSAVE+CPUSAVE_R30)(%r3)
- stw %r31,(PC_DBSAVE+CPUSAVE_R31)(%r3)
- mflr %r28
- li %r29,EXC_BPT
- mtlr %r29
- mfcr %r29
- mtsrr0 %r28
-
-/*
- * Now the kdb trap catching code.
- */
-dbtrap:
- FRAME_SETUP(PC_DBSAVE)
-/* Call C trap code: */
- addi %r3,%r1,8
- bl CNAME(db_trap_glue)
- or. %r3,%r3,%r3
- bne dbleave
-/* This wasn't for KDB, so switch to real trap: */
- lwz %r3,FRAME_EXC+8(%r1) /* save exception */
- GET_CPUINFO(%r4)
- stw %r3,(PC_DBSAVE+CPUSAVE_R31)(%r4)
- FRAME_LEAVE(PC_DBSAVE)
- mtsprg1 %r1 /* prepare for entrance to realtrap */
- GET_CPUINFO(%r1)
- stw %r28,(PC_TEMPSAVE+CPUSAVE_R28)(%r1)
- stw %r29,(PC_TEMPSAVE+CPUSAVE_R29)(%r1)
- stw %r30,(PC_TEMPSAVE+CPUSAVE_R30)(%r1)
- stw %r31,(PC_TEMPSAVE+CPUSAVE_R31)(%r1)
- mflr %r28
- mfcr %r29
- lwz %r31,(PC_DBSAVE+CPUSAVE_R31)(%r1)
- mtlr %r31
- mfsprg1 %r1
- b realtrap
-dbleave:
- FRAME_LEAVE(PC_DBSAVE)
- rfi
-
-/*
- * In case of KDB we want a separate trap catcher for it
- */
- .globl CNAME(dblow),CNAME(dbsize)
-CNAME(dblow):
- mtsprg1 %r1 /* save SP */
- mtsprg2 %r29 /* save r29 */
- mfcr %r29 /* save CR in r29 */
- mfsrr1 %r1
- mtcr %r1
- GET_CPUINFO(%r1)
- bf 17,1f /* branch if privileged */
- stw %r28,(PC_TEMPSAVE+CPUSAVE_R28)(%r1) /* free r28 */
- mfsprg2 %r28 /* r29 holds cr ... */
- stw %r28,(PC_TEMPSAVE+CPUSAVE_R29)(%r1) /* free r29 */
- stw %r30,(PC_TEMPSAVE+CPUSAVE_R30)(%r1) /* free r30 */
- stw %r31,(PC_TEMPSAVE+CPUSAVE_R31)(%r1) /* free r31 */
- mflr %r28 /* save LR */
- bla u_trap
-1:
- stw %r28,(PC_DBSAVE+CPUSAVE_R28)(%r1) /* free r28 */
- mfsprg2 %r28 /* r29 holds cr... */
- stw %r28,(PC_DBSAVE+CPUSAVE_R29)(%r1) /* free r29 */
- stw %r30,(PC_DBSAVE+CPUSAVE_R30)(%r1) /* free r30 */
- stw %r31,(PC_DBSAVE+CPUSAVE_R31)(%r1) /* free r31 */
- mflr %r28 /* save LR */
- lis %r1,dbstk+INTSTK@ha /* get new SP */
- addi %r1,%r1,dbstk+INTSTK@l
- bla dbtrap
-CNAME(dbsize) = .-CNAME(dblow)
-#endif /* KDB */
diff --git a/sys/powerpc/aim/uio_machdep.c b/sys/powerpc/aim/uio_machdep.c
deleted file mode 100644
index bd2f1b4..0000000
--- a/sys/powerpc/aim/uio_machdep.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*-
- * Copyright (c) 2004 Alan L. Cox <alc@cs.rice.edu>
- * Copyright (c) 1982, 1986, 1991, 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-
-#include <vm/vm.h>
-#include <vm/vm_page.h>
-
-#include <machine/vmparam.h>
-
-/*
- * Implement uiomove(9) from physical memory using the direct map to
- * avoid the creation and destruction of ephemeral mappings.
- */
-int
-uiomove_fromphys(vm_page_t ma[], vm_offset_t offset, int n, struct uio *uio)
-{
- struct thread *td = curthread;
- struct iovec *iov;
- void *cp;
- vm_offset_t page_offset;
- size_t cnt;
- int error = 0;
- int save = 0;
-
- KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE,
- ("uiomove_fromphys: mode"));
- KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread,
- ("uiomove_fromphys proc"));
- save = td->td_pflags & TDP_DEADLKTREAT;
- td->td_pflags |= TDP_DEADLKTREAT;
- while (n > 0 && uio->uio_resid) {
- iov = uio->uio_iov;
- cnt = iov->iov_len;
- if (cnt == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- continue;
- }
- if (cnt > n)
- cnt = n;
- page_offset = offset & PAGE_MASK;
- cnt = min(cnt, PAGE_SIZE - page_offset);
- cp = (char *)VM_PAGE_TO_PHYS(ma[offset >> PAGE_SHIFT]) +
- page_offset;
- switch (uio->uio_segflg) {
- case UIO_USERSPACE:
- if (ticks - PCPU_GET(switchticks) >= hogticks)
- uio_yield();
- if (uio->uio_rw == UIO_READ)
- error = copyout(cp, iov->iov_base, cnt);
- else
- error = copyin(iov->iov_base, cp, cnt);
- if (error)
- goto out;
- break;
- case UIO_SYSSPACE:
- if (uio->uio_rw == UIO_READ)
- bcopy(cp, iov->iov_base, cnt);
- else
- bcopy(iov->iov_base, cp, cnt);
- break;
- case UIO_NOCOPY:
- break;
- }
- iov->iov_base = (char *)iov->iov_base + cnt;
- iov->iov_len -= cnt;
- uio->uio_resid -= cnt;
- uio->uio_offset += cnt;
- offset += cnt;
- n -= cnt;
- }
-out:
- if (save == 0)
- td->td_pflags &= ~TDP_DEADLKTREAT;
- return (error);
-}
diff --git a/sys/powerpc/aim/uma_machdep.c b/sys/powerpc/aim/uma_machdep.c
deleted file mode 100644
index 9fff32e..0000000
--- a/sys/powerpc/aim/uma_machdep.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * Copyright (c) 2003 The FreeBSD Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/systm.h>
-#include <sys/sysctl.h>
-#include <vm/vm.h>
-#include <vm/vm_page.h>
-#include <vm/vm_pageout.h>
-#include <vm/uma.h>
-#include <vm/uma_int.h>
-#include <machine/vmparam.h>
-
-static int hw_uma_mdpages;
-SYSCTL_INT(_hw, OID_AUTO, uma_mdpages, CTLFLAG_RD, &hw_uma_mdpages, 0,
- "UMA MD pages in use");
-
-void *
-uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)
-{
- static vm_pindex_t color;
- void *va;
- vm_page_t m;
- int pflags;
-
- *flags = UMA_SLAB_PRIV;
- if ((wait & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
- pflags = VM_ALLOC_INTERRUPT;
- else
- pflags = VM_ALLOC_SYSTEM;
- if (wait & M_ZERO)
- pflags |= VM_ALLOC_ZERO;
-
- for (;;) {
- m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ);
- if (m == NULL) {
- if (wait & M_NOWAIT)
- return (NULL);
- VM_WAIT;
- } else
- break;
- }
-
- va = (void *) VM_PAGE_TO_PHYS(m);
- if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
- bzero(va, PAGE_SIZE);
- atomic_add_int(&hw_uma_mdpages, 1);
-
- return (va);
-}
-
-void
-uma_small_free(void *mem, int size, u_int8_t flags)
-{
- vm_page_t m;
-
- m = PHYS_TO_VM_PAGE((u_int32_t)mem);
- vm_page_lock_queues();
- vm_page_free(m);
- vm_page_unlock_queues();
- atomic_subtract_int(&hw_uma_mdpages, 1);
-}
diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c
deleted file mode 100644
index 4b896ea..0000000
--- a/sys/powerpc/aim/vm_machdep.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986 The Regents of the University of California.
- * Copyright (c) 1989, 1990 William Jolitz
- * Copyright (c) 1994 John Dyson
- * 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.
- *
- * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
- * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
- * $FreeBSD$
- */
-/*-
- * Copyright (c) 1994, 1995, 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/ktr.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/vnode.h>
-#include <sys/vmmeter.h>
-#include <sys/kernel.h>
-#include <sys/mbuf.h>
-#include <sys/sf_buf.h>
-#include <sys/sysctl.h>
-#include <sys/unistd.h>
-
-#include <machine/clock.h>
-#include <machine/cpu.h>
-#include <machine/fpu.h>
-#include <machine/frame.h>
-#include <machine/md_var.h>
-#include <machine/pcb.h>
-
-#include <dev/ofw/openfirm.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <vm/vm_map.h>
-#include <vm/vm_extern.h>
-
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the pcb, set up the stack so that the child
- * ready to run and return to user mode.
- */
-void
-cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
-{
- struct proc *p1;
- struct trapframe *tf;
- struct callframe *cf;
- struct pcb *pcb;
-
- KASSERT(td1 == curthread || td1 == &thread0,
- ("cpu_fork: p1 not curproc and not proc0"));
- CTR3(KTR_PROC, "cpu_fork: called td1=%08x p2=%08x flags=%x", (u_int)td1, (u_int)p2, flags);
-
- if ((flags & RFPROC) == 0)
- return;
-
- p1 = td1->td_proc;
-
- pcb = (struct pcb *)((td2->td_kstack +
- td2->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb)) & ~0x2fU);
- td2->td_pcb = pcb;
-
- /* Copy the pcb */
- bcopy(td1->td_pcb, pcb, sizeof(struct pcb));
-
- /*
- * Create a fresh stack for the new process.
- * Copy the trap frame for the return to user mode as if from a
- * syscall. This copies most of the user mode register values.
- */
- tf = (struct trapframe *)pcb - 1;
- bcopy(td1->td_frame, tf, sizeof(*tf));
-
- /* Set up trap frame. */
- tf->fixreg[FIRSTARG] = 0;
- tf->fixreg[FIRSTARG + 1] = 0;
- tf->cr &= ~0x10000000;
-
- td2->td_frame = tf;
-
- cf = (struct callframe *)tf - 1;
- memset(cf, 0, sizeof(struct callframe));
- cf->cf_func = (register_t)fork_return;
- cf->cf_arg0 = (register_t)td2;
- cf->cf_arg1 = (register_t)tf;
-
- pcb->pcb_sp = (register_t)cf;
- pcb->pcb_lr = (register_t)fork_trampoline;
- pcb->pcb_usr = kernel_pmap->pm_sr[USER_SR];
-
- /* Setup to release sched_lock in fork_exit(). */
- td2->td_md.md_spinlock_count = 1;
- td2->td_md.md_saved_msr = PSL_KERNSET;
-
- /*
- * Now cpu_switch() can schedule the new process.
- */
-}
-
-/*
- * Intercept the return address from a freshly forked process that has NOT
- * been scheduled yet.
- *
- * This is needed to make kernel threads stay in kernel mode.
- */
-void
-cpu_set_fork_handler(td, func, arg)
- struct thread *td;
- void (*func)(void *);
- void *arg;
-{
- struct callframe *cf;
-
- CTR3(KTR_PROC, "cpu_set_fork_handler: called with td=%08x func=%08x arg=%08x",
- (u_int)td, (u_int)func, (u_int)arg);
-
- cf = (struct callframe *)td->td_pcb->pcb_sp;
-
- cf->cf_func = (register_t)func;
- cf->cf_arg0 = (register_t)arg;
-}
-
-void
-cpu_exit(td)
- register struct thread *td;
-{
-}
-
-/* Temporary helper */
-void
-cpu_throw(struct thread *old, struct thread *new)
-{
-
- cpu_switch(old, new);
- panic("cpu_throw() didn't");
-}
-
-/*
- * Reset back to firmware.
- */
-void
-cpu_reset()
-{
- OF_exit();
-}
-
-/*
- * Allocate an sf_buf for the given vm_page. On this machine, however, there
- * is no sf_buf object. Instead, an opaque pointer to the given vm_page is
- * returned.
- */
-struct sf_buf *
-sf_buf_alloc(struct vm_page *m, int pri)
-{
-
- return ((struct sf_buf *)m);
-}
-
-/*
- * Free the sf_buf. In fact, do nothing because there are no resources
- * associated with the sf_buf.
- */
-void
-sf_buf_free(struct sf_buf *sf)
-{
-}
-
-/*
- * Software interrupt handler for queued VM system processing.
- */
-void
-swi_vm(void *dummy)
-{
-#if 0 /* XXX: Don't have busdma stuff yet */
- if (busdma_swi_pending != 0)
- busdma_swi();
-#endif
-}
-
-/*
- * Tell whether this address is in some physical memory region.
- * Currently used by the kernel coredump code in order to avoid
- * dumping the ``ISA memory hole'' which could cause indefinite hangs,
- * or other unpredictable behaviour.
- */
-
-
-int
-is_physical_memory(addr)
- vm_offset_t addr;
-{
- /*
- * stuff other tests for known memory-mapped devices (PCI?)
- * here
- */
-
- return 1;
-}
-
-/*
- * KSE functions
- */
-void
-cpu_thread_exit(struct thread *td)
-{
-}
-
-void
-cpu_thread_clean(struct thread *td)
-{
-}
-
-void
-cpu_thread_setup(struct thread *td)
-{
- struct pcb *pcb;
-
- pcb = (struct pcb *)((td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
- sizeof(struct pcb)) & ~0x2fU);
- td->td_pcb = pcb;
- td->td_frame = (struct trapframe *)pcb - 1;
-}
-
-void
-cpu_thread_swapin(struct thread *td)
-{
-}
-
-void
-cpu_thread_swapout(struct thread *td)
-{
-}
-
-void
-cpu_set_upcall(struct thread *td, struct thread *td0)
-{
- struct pcb *pcb2;
- struct trapframe *tf;
- struct callframe *cf;
-
- pcb2 = td->td_pcb;
-
- /* Copy the upcall pcb */
- bcopy(td0->td_pcb, pcb2, sizeof(*pcb2));
-
- /* Create a stack for the new thread */
- tf = td->td_frame;
- bcopy(td0->td_frame, tf, sizeof(struct trapframe));
- tf->fixreg[FIRSTARG] = 0;
- tf->fixreg[FIRSTARG + 1] = 0;
- tf->cr &= ~0x10000000;
-
- /* Set registers for trampoline to user mode. */
- cf = (struct callframe *)tf - 1;
- memset(cf, 0, sizeof(struct callframe));
- cf->cf_func = (register_t)fork_return;
- cf->cf_arg0 = (register_t)td;
- cf->cf_arg1 = (register_t)tf;
-
- pcb2->pcb_sp = (register_t)cf;
- pcb2->pcb_lr = (register_t)fork_trampoline;
- pcb2->pcb_usr = kernel_pmap->pm_sr[USER_SR];
-
- /* Setup to release sched_lock in fork_exit(). */
- td->td_md.md_spinlock_count = 1;
- td->td_md.md_saved_msr = PSL_KERNSET;
-}
-
-void
-cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg,
- stack_t *stack)
-{
- struct trapframe *tf;
- uint32_t sp;
-
- tf = td->td_frame;
- /* align stack and alloc space for frame ptr and saved LR */
- sp = ((uint32_t)stack->ss_sp + stack->ss_size
- - 2*sizeof(u_int32_t)) & ~0x1f;
- bzero(tf, sizeof(struct trapframe));
-
- tf->fixreg[1] = (register_t)sp;
- tf->fixreg[3] = (register_t)arg;
- tf->srr0 = (register_t)entry;
- tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
- td->td_pcb->pcb_flags = 0;
-
- td->td_retval[0] = (register_t)entry;
- td->td_retval[1] = 0;
-}
-
-int
-cpu_set_user_tls(struct thread *td, void *tls_base)
-{
-
- td->td_frame->fixreg[2] = (register_t)tls_base;
- return (0);
-}
diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c
deleted file mode 100644
index 2ea798d..0000000
--- a/sys/powerpc/powerpc/mmu_oea.c
+++ /dev/null
@@ -1,2476 +0,0 @@
-/*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Matt Thomas <matt@3am-software.com> of Allegro Networks, 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 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) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 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.
- *
- * $NetBSD: pmap.c,v 1.28 2000/03/26 20:42:36 kleink Exp $
- */
-/*-
- * Copyright (C) 2001 Benno Rice.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
- * 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * 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
- * 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
- * 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 "opt_kstack_pages.h"
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/ktr.h>
-#include <sys/lock.h>
-#include <sys/msgbuf.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/sysctl.h>
-#include <sys/systm.h>
-#include <sys/vmmeter.h>
-
-#include <dev/ofw/openfirm.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <vm/vm_map.h>
-#include <vm/vm_object.h>
-#include <vm/vm_extern.h>
-#include <vm/vm_pageout.h>
-#include <vm/vm_pager.h>
-#include <vm/uma.h>
-
-#include <machine/cpu.h>
-#include <machine/powerpc.h>
-#include <machine/bat.h>
-#include <machine/frame.h>
-#include <machine/md_var.h>
-#include <machine/psl.h>
-#include <machine/pte.h>
-#include <machine/sr.h>
-
-#define PMAP_DEBUG
-
-#define TODO panic("%s: not implemented", __func__);
-
-#define TLBIE(va) __asm __volatile("tlbie %0" :: "r"(va))
-#define TLBSYNC() __asm __volatile("tlbsync");
-#define SYNC() __asm __volatile("sync");
-#define EIEIO() __asm __volatile("eieio");
-
-#define VSID_MAKE(sr, hash) ((sr) | (((hash) & 0xfffff) << 4))
-#define VSID_TO_SR(vsid) ((vsid) & 0xf)
-#define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff)
-
-#define PVO_PTEGIDX_MASK 0x007 /* which PTEG slot */
-#define PVO_PTEGIDX_VALID 0x008 /* slot is valid */
-#define PVO_WIRED 0x010 /* PVO entry is wired */
-#define PVO_MANAGED 0x020 /* PVO entry is managed */
-#define PVO_EXECUTABLE 0x040 /* PVO entry is executable */
-#define PVO_BOOTSTRAP 0x080 /* PVO entry allocated during
- bootstrap */
-#define PVO_FAKE 0x100 /* fictitious phys page */
-#define PVO_VADDR(pvo) ((pvo)->pvo_vaddr & ~ADDR_POFF)
-#define PVO_ISEXECUTABLE(pvo) ((pvo)->pvo_vaddr & PVO_EXECUTABLE)
-#define PVO_ISFAKE(pvo) ((pvo)->pvo_vaddr & PVO_FAKE)
-#define PVO_PTEGIDX_GET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK)
-#define PVO_PTEGIDX_ISSET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID)
-#define PVO_PTEGIDX_CLR(pvo) \
- ((void)((pvo)->pvo_vaddr &= ~(PVO_PTEGIDX_VALID|PVO_PTEGIDX_MASK)))
-#define PVO_PTEGIDX_SET(pvo, i) \
- ((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID))
-
-#define PMAP_PVO_CHECK(pvo)
-
-struct ofw_map {
- vm_offset_t om_va;
- vm_size_t om_len;
- vm_offset_t om_pa;
- u_int om_mode;
-};
-
-int pmap_bootstrapped = 0;
-
-/*
- * Virtual and physical address of message buffer.
- */
-struct msgbuf *msgbufp;
-vm_offset_t msgbuf_phys;
-
-int pmap_pagedaemon_waken;
-
-/*
- * Map of physical memory regions.
- */
-vm_offset_t phys_avail[128];
-u_int phys_avail_count;
-static struct mem_region *regions;
-static struct mem_region *pregions;
-int regions_sz, pregions_sz;
-static struct ofw_map *translations;
-
-/*
- * First and last available kernel virtual addresses.
- */
-vm_offset_t virtual_avail;
-vm_offset_t virtual_end;
-vm_offset_t kernel_vm_end;
-
-/*
- * Kernel pmap.
- */
-struct pmap kernel_pmap_store;
-extern struct pmap ofw_pmap;
-
-/*
- * Lock for the pteg and pvo tables.
- */
-struct mtx pmap_table_mutex;
-
-/*
- * PTEG data.
- */
-static struct pteg *pmap_pteg_table;
-u_int pmap_pteg_count;
-u_int pmap_pteg_mask;
-
-/*
- * PVO data.
- */
-struct pvo_head *pmap_pvo_table; /* pvo entries by pteg index */
-struct pvo_head pmap_pvo_kunmanaged =
- LIST_HEAD_INITIALIZER(pmap_pvo_kunmanaged); /* list of unmanaged pages */
-struct pvo_head pmap_pvo_unmanaged =
- LIST_HEAD_INITIALIZER(pmap_pvo_unmanaged); /* list of unmanaged pages */
-
-uma_zone_t pmap_upvo_zone; /* zone for pvo entries for unmanaged pages */
-uma_zone_t pmap_mpvo_zone; /* zone for pvo entries for managed pages */
-
-#define BPVO_POOL_SIZE 32768
-static struct pvo_entry *pmap_bpvo_pool;
-static int pmap_bpvo_pool_index = 0;
-
-#define VSID_NBPW (sizeof(u_int32_t) * 8)
-static u_int pmap_vsid_bitmap[NPMAPS / VSID_NBPW];
-
-static boolean_t pmap_initialized = FALSE;
-
-/*
- * Statistics.
- */
-u_int pmap_pte_valid = 0;
-u_int pmap_pte_overflow = 0;
-u_int pmap_pte_replacements = 0;
-u_int pmap_pvo_entries = 0;
-u_int pmap_pvo_enter_calls = 0;
-u_int pmap_pvo_remove_calls = 0;
-u_int pmap_pte_spills = 0;
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pte_valid, CTLFLAG_RD, &pmap_pte_valid,
- 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pte_overflow, CTLFLAG_RD,
- &pmap_pte_overflow, 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pte_replacements, CTLFLAG_RD,
- &pmap_pte_replacements, 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pvo_entries, CTLFLAG_RD, &pmap_pvo_entries,
- 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pvo_enter_calls, CTLFLAG_RD,
- &pmap_pvo_enter_calls, 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pvo_remove_calls, CTLFLAG_RD,
- &pmap_pvo_remove_calls, 0, "");
-SYSCTL_INT(_machdep, OID_AUTO, pmap_pte_spills, CTLFLAG_RD,
- &pmap_pte_spills, 0, "");
-
-struct pvo_entry *pmap_pvo_zeropage;
-
-vm_offset_t pmap_rkva_start = VM_MIN_KERNEL_ADDRESS;
-u_int pmap_rkva_count = 4;
-
-/*
- * Allocate physical memory for use in pmap_bootstrap.
- */
-static vm_offset_t pmap_bootstrap_alloc(vm_size_t, u_int);
-
-/*
- * PTE calls.
- */
-static int pmap_pte_insert(u_int, struct pte *);
-
-/*
- * PVO calls.
- */
-static int pmap_pvo_enter(pmap_t, uma_zone_t, struct pvo_head *,
- vm_offset_t, vm_offset_t, u_int, int);
-static void pmap_pvo_remove(struct pvo_entry *, int);
-static struct pvo_entry *pmap_pvo_find_va(pmap_t, vm_offset_t, int *);
-static struct pte *pmap_pvo_to_pte(const struct pvo_entry *, int);
-
-/*
- * Utility routines.
- */
-static struct pvo_entry *pmap_rkva_alloc(void);
-static void pmap_pa_map(struct pvo_entry *, vm_offset_t,
- struct pte *, int *);
-static void pmap_pa_unmap(struct pvo_entry *, struct pte *, int *);
-static void pmap_syncicache(vm_offset_t, vm_size_t);
-static boolean_t pmap_query_bit(vm_page_t, int);
-static u_int pmap_clear_bit(vm_page_t, int, int *);
-static void tlbia(void);
-
-static __inline int
-va_to_sr(u_int *sr, vm_offset_t va)
-{
- return (sr[(uintptr_t)va >> ADDR_SR_SHFT]);
-}
-
-static __inline u_int
-va_to_pteg(u_int sr, vm_offset_t addr)
-{
- u_int hash;
-
- hash = (sr & SR_VSID_MASK) ^ (((u_int)addr & ADDR_PIDX) >>
- ADDR_PIDX_SHFT);
- return (hash & pmap_pteg_mask);
-}
-
-static __inline struct pvo_head *
-pa_to_pvoh(vm_offset_t pa, vm_page_t *pg_p)
-{
- struct vm_page *pg;
-
- pg = PHYS_TO_VM_PAGE(pa);
-
- if (pg_p != NULL)
- *pg_p = pg;
-
- if (pg == NULL)
- return (&pmap_pvo_unmanaged);
-
- return (&pg->md.mdpg_pvoh);
-}
-
-static __inline struct pvo_head *
-vm_page_to_pvoh(vm_page_t m)
-{
-
- return (&m->md.mdpg_pvoh);
-}
-
-static __inline void
-pmap_attr_clear(vm_page_t m, int ptebit)
-{
-
- m->md.mdpg_attrs &= ~ptebit;
-}
-
-static __inline int
-pmap_attr_fetch(vm_page_t m)
-{
-
- return (m->md.mdpg_attrs);
-}
-
-static __inline void
-pmap_attr_save(vm_page_t m, int ptebit)
-{
-
- m->md.mdpg_attrs |= ptebit;
-}
-
-static __inline int
-pmap_pte_compare(const struct pte *pt, const struct pte *pvo_pt)
-{
- if (pt->pte_hi == pvo_pt->pte_hi)
- return (1);
-
- return (0);
-}
-
-static __inline int
-pmap_pte_match(struct pte *pt, u_int sr, vm_offset_t va, int which)
-{
- return (pt->pte_hi & ~PTE_VALID) ==
- (((sr & SR_VSID_MASK) << PTE_VSID_SHFT) |
- ((va >> ADDR_API_SHFT) & PTE_API) | which);
-}
-
-static __inline void
-pmap_pte_create(struct pte *pt, u_int sr, vm_offset_t va, u_int pte_lo)
-{
- /*
- * Construct a PTE. Default to IMB initially. Valid bit only gets
- * set when the real pte is set in memory.
- *
- * Note: Don't set the valid bit for correct operation of tlb update.
- */
- pt->pte_hi = ((sr & SR_VSID_MASK) << PTE_VSID_SHFT) |
- (((va & ADDR_PIDX) >> ADDR_API_SHFT) & PTE_API);
- pt->pte_lo = pte_lo;
-}
-
-static __inline void
-pmap_pte_synch(struct pte *pt, struct pte *pvo_pt)
-{
-
- pvo_pt->pte_lo |= pt->pte_lo & (PTE_REF | PTE_CHG);
-}
-
-static __inline void
-pmap_pte_clear(struct pte *pt, vm_offset_t va, int ptebit)
-{
-
- /*
- * As shown in Section 7.6.3.2.3
- */
- pt->pte_lo &= ~ptebit;
- TLBIE(va);
- EIEIO();
- TLBSYNC();
- SYNC();
-}
-
-static __inline void
-pmap_pte_set(struct pte *pt, struct pte *pvo_pt)
-{
-
- pvo_pt->pte_hi |= PTE_VALID;
-
- /*
- * Update the PTE as defined in section 7.6.3.1.
- * Note that the REF/CHG bits are from pvo_pt and thus should havce
- * been saved so this routine can restore them (if desired).
- */
- pt->pte_lo = pvo_pt->pte_lo;
- EIEIO();
- pt->pte_hi = pvo_pt->pte_hi;
- SYNC();
- pmap_pte_valid++;
-}
-
-static __inline void
-pmap_pte_unset(struct pte *pt, struct pte *pvo_pt, vm_offset_t va)
-{
-
- pvo_pt->pte_hi &= ~PTE_VALID;
-
- /*
- * Force the reg & chg bits back into the PTEs.
- */
- SYNC();
-
- /*
- * Invalidate the pte.
- */
- pt->pte_hi &= ~PTE_VALID;
-
- SYNC();
- TLBIE(va);
- EIEIO();
- TLBSYNC();
- SYNC();
-
- /*
- * Save the reg & chg bits.
- */
- pmap_pte_synch(pt, pvo_pt);
- pmap_pte_valid--;
-}
-
-static __inline void
-pmap_pte_change(struct pte *pt, struct pte *pvo_pt, vm_offset_t va)
-{
-
- /*
- * Invalidate the PTE
- */
- pmap_pte_unset(pt, pvo_pt, va);
- pmap_pte_set(pt, pvo_pt);
-}
-
-/*
- * Quick sort callout for comparing memory regions.
- */
-static int mr_cmp(const void *a, const void *b);
-static int om_cmp(const void *a, const void *b);
-
-static int
-mr_cmp(const void *a, const void *b)
-{
- const struct mem_region *regiona;
- const struct mem_region *regionb;
-
- regiona = a;
- regionb = b;
- if (regiona->mr_start < regionb->mr_start)
- return (-1);
- else if (regiona->mr_start > regionb->mr_start)
- return (1);
- else
- return (0);
-}
-
-static int
-om_cmp(const void *a, const void *b)
-{
- const struct ofw_map *mapa;
- const struct ofw_map *mapb;
-
- mapa = a;
- mapb = b;
- if (mapa->om_pa < mapb->om_pa)
- return (-1);
- else if (mapa->om_pa > mapb->om_pa)
- return (1);
- else
- return (0);
-}
-
-void
-pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend)
-{
- ihandle_t mmui;
- phandle_t chosen, mmu;
- int sz;
- int i, j;
- int ofw_mappings;
- vm_size_t size, physsz, hwphyssz;
- vm_offset_t pa, va, off;
- u_int batl, batu;
-
- /*
- * Set up BAT0 to map the lowest 256 MB area
- */
- battable[0x0].batl = BATL(0x00000000, BAT_M, BAT_PP_RW);
- battable[0x0].batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs);
-
- /*
- * Map PCI memory space.
- */
- battable[0x8].batl = BATL(0x80000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0x8].batu = BATU(0x80000000, BAT_BL_256M, BAT_Vs);
-
- battable[0x9].batl = BATL(0x90000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0x9].batu = BATU(0x90000000, BAT_BL_256M, BAT_Vs);
-
- battable[0xa].batl = BATL(0xa0000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0xa].batu = BATU(0xa0000000, BAT_BL_256M, BAT_Vs);
-
- battable[0xb].batl = BATL(0xb0000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0xb].batu = BATU(0xb0000000, BAT_BL_256M, BAT_Vs);
-
- /*
- * Map obio devices.
- */
- battable[0xf].batl = BATL(0xf0000000, BAT_I|BAT_G, BAT_PP_RW);
- battable[0xf].batu = BATU(0xf0000000, BAT_BL_256M, BAT_Vs);
-
- /*
- * Use an IBAT and a DBAT to map the bottom segment of memory
- * where we are.
- */
- batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs);
- batl = BATL(0x00000000, BAT_M, BAT_PP_RW);
- __asm ("mtibatu 0,%0; mtibatl 0,%1; isync; \n"
- "mtdbatu 0,%0; mtdbatl 0,%1; isync"
- :: "r"(batu), "r"(batl));
-
-#if 0
- /* map frame buffer */
- batu = BATU(0x90000000, BAT_BL_256M, BAT_Vs);
- batl = BATL(0x90000000, BAT_I|BAT_G, BAT_PP_RW);
- __asm ("mtdbatu 1,%0; mtdbatl 1,%1; isync"
- :: "r"(batu), "r"(batl));
-#endif
-
-#if 1
- /* map pci space */
- batu = BATU(0x80000000, BAT_BL_256M, BAT_Vs);
- batl = BATL(0x80000000, BAT_I|BAT_G, BAT_PP_RW);
- __asm ("mtdbatu 1,%0; mtdbatl 1,%1; isync"
- :: "r"(batu), "r"(batl));
-#endif
-
- /*
- * Set the start and end of kva.
- */
- virtual_avail = VM_MIN_KERNEL_ADDRESS;
- virtual_end = VM_MAX_KERNEL_ADDRESS;
-
- mem_regions(&pregions, &pregions_sz, &regions, &regions_sz);
- CTR0(KTR_PMAP, "pmap_bootstrap: physical memory");
-
- qsort(pregions, pregions_sz, sizeof(*pregions), mr_cmp);
- for (i = 0; i < pregions_sz; i++) {
- vm_offset_t pa;
- vm_offset_t end;
-
- CTR3(KTR_PMAP, "physregion: %#x - %#x (%#x)",
- pregions[i].mr_start,
- pregions[i].mr_start + pregions[i].mr_size,
- pregions[i].mr_size);
- /*
- * Install entries into the BAT table to allow all
- * of physmem to be convered by on-demand BAT entries.
- * The loop will sometimes set the same battable element
- * twice, but that's fine since they won't be used for
- * a while yet.
- */
- pa = pregions[i].mr_start & 0xf0000000;
- end = pregions[i].mr_start + pregions[i].mr_size;
- do {
- u_int n = pa >> ADDR_SR_SHFT;
-
- battable[n].batl = BATL(pa, BAT_M, BAT_PP_RW);
- battable[n].batu = BATU(pa, BAT_BL_256M, BAT_Vs);
- pa += SEGMENT_LENGTH;
- } while (pa < end);
- }
-
- if (sizeof(phys_avail)/sizeof(phys_avail[0]) < regions_sz)
- panic("pmap_bootstrap: phys_avail too small");
- qsort(regions, regions_sz, sizeof(*regions), mr_cmp);
- phys_avail_count = 0;
- physsz = 0;
- hwphyssz = 0;
- TUNABLE_ULONG_FETCH("hw.physmem", (u_long *) &hwphyssz);
- for (i = 0, j = 0; i < regions_sz; i++, j += 2) {
- CTR3(KTR_PMAP, "region: %#x - %#x (%#x)", regions[i].mr_start,
- regions[i].mr_start + regions[i].mr_size,
- regions[i].mr_size);
- if (hwphyssz != 0 &&
- (physsz + regions[i].mr_size) >= hwphyssz) {
- if (physsz < hwphyssz) {
- phys_avail[j] = regions[i].mr_start;
- phys_avail[j + 1] = regions[i].mr_start +
- hwphyssz - physsz;
- physsz = hwphyssz;
- phys_avail_count++;
- }
- break;
- }
- phys_avail[j] = regions[i].mr_start;
- phys_avail[j + 1] = regions[i].mr_start + regions[i].mr_size;
- phys_avail_count++;
- physsz += regions[i].mr_size;
- }
- physmem = btoc(physsz);
-
- /*
- * Allocate PTEG table.
- */
-#ifdef PTEGCOUNT
- pmap_pteg_count = PTEGCOUNT;
-#else
- pmap_pteg_count = 0x1000;
-
- while (pmap_pteg_count < physmem)
- pmap_pteg_count <<= 1;
-
- pmap_pteg_count >>= 1;
-#endif /* PTEGCOUNT */
-
- size = pmap_pteg_count * sizeof(struct pteg);
- CTR2(KTR_PMAP, "pmap_bootstrap: %d PTEGs, %d bytes", pmap_pteg_count,
- size);
- pmap_pteg_table = (struct pteg *)pmap_bootstrap_alloc(size, size);
- CTR1(KTR_PMAP, "pmap_bootstrap: PTEG table at %p", pmap_pteg_table);
- bzero((void *)pmap_pteg_table, pmap_pteg_count * sizeof(struct pteg));
- pmap_pteg_mask = pmap_pteg_count - 1;
-
- /*
- * Allocate pv/overflow lists.
- */
- size = sizeof(struct pvo_head) * pmap_pteg_count;
- pmap_pvo_table = (struct pvo_head *)pmap_bootstrap_alloc(size,
- PAGE_SIZE);
- CTR1(KTR_PMAP, "pmap_bootstrap: PVO table at %p", pmap_pvo_table);
- for (i = 0; i < pmap_pteg_count; i++)
- LIST_INIT(&pmap_pvo_table[i]);
-
- /*
- * Initialize the lock that synchronizes access to the pteg and pvo
- * tables.
- */
- mtx_init(&pmap_table_mutex, "pmap table", NULL, MTX_DEF);
-
- /*
- * Allocate the message buffer.
- */
- msgbuf_phys = pmap_bootstrap_alloc(MSGBUF_SIZE, 0);
-
- /*
- * Initialise the unmanaged pvo pool.
- */
- pmap_bpvo_pool = (struct pvo_entry *)pmap_bootstrap_alloc(
- BPVO_POOL_SIZE*sizeof(struct pvo_entry), 0);
- pmap_bpvo_pool_index = 0;
-
- /*
- * Make sure kernel vsid is allocated as well as VSID 0.
- */
- pmap_vsid_bitmap[(KERNEL_VSIDBITS & (NPMAPS - 1)) / VSID_NBPW]
- |= 1 << (KERNEL_VSIDBITS % VSID_NBPW);
- pmap_vsid_bitmap[0] |= 1;
-
- /*
- * Set up the Open Firmware pmap and add it's mappings.
- */
- pmap_pinit(&ofw_pmap);
- ofw_pmap.pm_sr[KERNEL_SR] = KERNEL_SEGMENT;
- ofw_pmap.pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT;
- if ((chosen = OF_finddevice("/chosen")) == -1)
- panic("pmap_bootstrap: can't find /chosen");
- OF_getprop(chosen, "mmu", &mmui, 4);
- if ((mmu = OF_instance_to_package(mmui)) == -1)
- panic("pmap_bootstrap: can't get mmu package");
- if ((sz = OF_getproplen(mmu, "translations")) == -1)
- panic("pmap_bootstrap: can't get ofw translation count");
- translations = NULL;
- for (i = 0; phys_avail[i] != 0; i += 2) {
- if (phys_avail[i + 1] >= sz) {
- translations = (struct ofw_map *)phys_avail[i];
- break;
- }
- }
- if (translations == NULL)
- panic("pmap_bootstrap: no space to copy translations");
- bzero(translations, sz);
- if (OF_getprop(mmu, "translations", translations, sz) == -1)
- panic("pmap_bootstrap: can't get ofw translations");
- CTR0(KTR_PMAP, "pmap_bootstrap: translations");
- sz /= sizeof(*translations);
- qsort(translations, sz, sizeof (*translations), om_cmp);
- for (i = 0, ofw_mappings = 0; i < sz; i++) {
- CTR3(KTR_PMAP, "translation: pa=%#x va=%#x len=%#x",
- translations[i].om_pa, translations[i].om_va,
- translations[i].om_len);
-
- /*
- * If the mapping is 1:1, let the RAM and device on-demand
- * BAT tables take care of the translation.
- */
- if (translations[i].om_va == translations[i].om_pa)
- continue;
-
- /* Enter the pages */
- for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) {
- struct vm_page m;
-
- m.phys_addr = translations[i].om_pa + off;
- pmap_enter(&ofw_pmap, translations[i].om_va + off, &m,
- VM_PROT_ALL, 1);
- ofw_mappings++;
- }
- }
-#ifdef SMP
- TLBSYNC();
-#endif
-
- /*
- * Initialize the kernel pmap (which is statically allocated).
- */
- PMAP_LOCK_INIT(kernel_pmap);
- for (i = 0; i < 16; i++) {
- kernel_pmap->pm_sr[i] = EMPTY_SEGMENT;
- }
- kernel_pmap->pm_sr[KERNEL_SR] = KERNEL_SEGMENT;
- kernel_pmap->pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT;
- kernel_pmap->pm_active = ~0;
-
- /*
- * Allocate a kernel stack with a guard page for thread0 and map it
- * into the kernel page map.
- */
- pa = pmap_bootstrap_alloc(KSTACK_PAGES * PAGE_SIZE, 0);
- kstack0_phys = pa;
- kstack0 = virtual_avail + (KSTACK_GUARD_PAGES * PAGE_SIZE);
- CTR2(KTR_PMAP, "pmap_bootstrap: kstack0 at %#x (%#x)", kstack0_phys,
- kstack0);
- virtual_avail += (KSTACK_PAGES + KSTACK_GUARD_PAGES) * PAGE_SIZE;
- for (i = 0; i < KSTACK_PAGES; i++) {
- pa = kstack0_phys + i * PAGE_SIZE;
- va = kstack0 + i * PAGE_SIZE;
- pmap_kenter(va, pa);
- TLBIE(va);
- }
-
- /*
- * Calculate the last available physical address.
- */
- for (i = 0; phys_avail[i + 2] != 0; i += 2)
- ;
- Maxmem = powerpc_btop(phys_avail[i + 1]);
-
- /*
- * Allocate virtual address space for the message buffer.
- */
- msgbufp = (struct msgbuf *)virtual_avail;
- virtual_avail += round_page(MSGBUF_SIZE);
-
- /*
- * Initialize hardware.
- */
- for (i = 0; i < 16; i++) {
- mtsrin(i << ADDR_SR_SHFT, EMPTY_SEGMENT);
- }
- __asm __volatile ("mtsr %0,%1"
- :: "n"(KERNEL_SR), "r"(KERNEL_SEGMENT));
- __asm __volatile ("mtsr %0,%1"
- :: "n"(KERNEL2_SR), "r"(KERNEL2_SEGMENT));
- __asm __volatile ("sync; mtsdr1 %0; isync"
- :: "r"((u_int)pmap_pteg_table | (pmap_pteg_mask >> 10)));
- tlbia();
-
- pmap_bootstrapped++;
-}
-
-/*
- * Activate a user pmap. The pmap must be activated before it's address
- * space can be accessed in any way.
- */
-void
-pmap_activate(struct thread *td)
-{
- pmap_t pm, pmr;
-
- /*
- * Load all the data we need up front to encourage the compiler to
- * not issue any loads while we have interrupts disabled below.
- */
- pm = &td->td_proc->p_vmspace->vm_pmap;
-
- if ((pmr = (pmap_t)pmap_kextract((vm_offset_t)pm)) == NULL)
- pmr = pm;
-
- pm->pm_active |= PCPU_GET(cpumask);
- PCPU_SET(curpmap, pmr);
-}
-
-void
-pmap_deactivate(struct thread *td)
-{
- pmap_t pm;
-
- pm = &td->td_proc->p_vmspace->vm_pmap;
- pm->pm_active &= ~(PCPU_GET(cpumask));
- PCPU_SET(curpmap, NULL);
-}
-
-vm_offset_t
-pmap_addr_hint(vm_object_t object, vm_offset_t va, vm_size_t size)
-{
-
- return (va);
-}
-
-void
-pmap_change_wiring(pmap_t pm, vm_offset_t va, boolean_t wired)
-{
- struct pvo_entry *pvo;
-
- PMAP_LOCK(pm);
- pvo = pmap_pvo_find_va(pm, va & ~ADDR_POFF, NULL);
-
- if (pvo != NULL) {
- if (wired) {
- if ((pvo->pvo_vaddr & PVO_WIRED) == 0)
- pm->pm_stats.wired_count++;
- pvo->pvo_vaddr |= PVO_WIRED;
- } else {
- if ((pvo->pvo_vaddr & PVO_WIRED) != 0)
- pm->pm_stats.wired_count--;
- pvo->pvo_vaddr &= ~PVO_WIRED;
- }
- }
- PMAP_UNLOCK(pm);
-}
-
-void
-pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr,
- vm_size_t len, vm_offset_t src_addr)
-{
-
- /*
- * This is not needed as it's mainly an optimisation.
- * It may want to be implemented later though.
- */
-}
-
-void
-pmap_copy_page(vm_page_t msrc, vm_page_t mdst)
-{
- vm_offset_t dst;
- vm_offset_t src;
-
- dst = VM_PAGE_TO_PHYS(mdst);
- src = VM_PAGE_TO_PHYS(msrc);
-
- kcopy((void *)src, (void *)dst, PAGE_SIZE);
-}
-
-/*
- * Zero a page of physical memory by temporarily mapping it into the tlb.
- */
-void
-pmap_zero_page(vm_page_t m)
-{
- vm_offset_t pa = VM_PAGE_TO_PHYS(m);
- caddr_t va;
-
- if (pa < SEGMENT_LENGTH) {
- va = (caddr_t) pa;
- } else if (pmap_initialized) {
- if (pmap_pvo_zeropage == NULL)
- pmap_pvo_zeropage = pmap_rkva_alloc();
- pmap_pa_map(pmap_pvo_zeropage, pa, NULL, NULL);
- va = (caddr_t)PVO_VADDR(pmap_pvo_zeropage);
- } else {
- panic("pmap_zero_page: can't zero pa %#x", pa);
- }
-
- bzero(va, PAGE_SIZE);
-
- if (pa >= SEGMENT_LENGTH)
- pmap_pa_unmap(pmap_pvo_zeropage, NULL, NULL);
-}
-
-void
-pmap_zero_page_area(vm_page_t m, int off, int size)
-{
- vm_offset_t pa = VM_PAGE_TO_PHYS(m);
- caddr_t va;
-
- if (pa < SEGMENT_LENGTH) {
- va = (caddr_t) pa;
- } else if (pmap_initialized) {
- if (pmap_pvo_zeropage == NULL)
- pmap_pvo_zeropage = pmap_rkva_alloc();
- pmap_pa_map(pmap_pvo_zeropage, pa, NULL, NULL);
- va = (caddr_t)PVO_VADDR(pmap_pvo_zeropage);
- } else {
- panic("pmap_zero_page: can't zero pa %#x", pa);
- }
-
- bzero(va + off, size);
-
- if (pa >= SEGMENT_LENGTH)
- pmap_pa_unmap(pmap_pvo_zeropage, NULL, NULL);
-}
-
-void
-pmap_zero_page_idle(vm_page_t m)
-{
-
- /* XXX this is called outside of Giant, is pmap_zero_page safe? */
- /* XXX maybe have a dedicated mapping for this to avoid the problem? */
- mtx_lock(&Giant);
- pmap_zero_page(m);
- mtx_unlock(&Giant);
-}
-
-/*
- * Map the given physical page at the specified virtual address in the
- * target pmap with the protection requested. If specified the page
- * will be wired down.
- */
-void
-pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
- boolean_t wired)
-{
- struct pvo_head *pvo_head;
- uma_zone_t zone;
- vm_page_t pg;
- u_int pte_lo, pvo_flags, was_exec, i;
- int error;
-
- if (!pmap_initialized) {
- pvo_head = &pmap_pvo_kunmanaged;
- zone = pmap_upvo_zone;
- pvo_flags = 0;
- pg = NULL;
- was_exec = PTE_EXEC;
- } else {
- pvo_head = vm_page_to_pvoh(m);
- pg = m;
- zone = pmap_mpvo_zone;
- pvo_flags = PVO_MANAGED;
- was_exec = 0;
- }
- if (pmap_bootstrapped)
- vm_page_lock_queues();
- PMAP_LOCK(pmap);
-
- /* XXX change the pvo head for fake pages */
- if ((m->flags & PG_FICTITIOUS) == PG_FICTITIOUS)
- pvo_head = &pmap_pvo_kunmanaged;
-
- /*
- * If this is a managed page, and it's the first reference to the page,
- * clear the execness of the page. Otherwise fetch the execness.
- */
- if ((pg != NULL) && ((m->flags & PG_FICTITIOUS) == 0)) {
- if (LIST_EMPTY(pvo_head)) {
- pmap_attr_clear(pg, PTE_EXEC);
- } else {
- was_exec = pmap_attr_fetch(pg) & PTE_EXEC;
- }
- }
-
- /*
- * Assume the page is cache inhibited and access is guarded unless
- * it's in our available memory array.
- */
- pte_lo = PTE_I | PTE_G;
- for (i = 0; i < pregions_sz; i++) {
- if ((VM_PAGE_TO_PHYS(m) >= pregions[i].mr_start) &&
- (VM_PAGE_TO_PHYS(m) <
- (pregions[i].mr_start + pregions[i].mr_size))) {
- pte_lo &= ~(PTE_I | PTE_G);
- break;
- }
- }
-
- if (prot & VM_PROT_WRITE)
- pte_lo |= PTE_BW;
- else
- pte_lo |= PTE_BR;
-
- if (prot & VM_PROT_EXECUTE)
- pvo_flags |= PVO_EXECUTABLE;
-
- if (wired)
- pvo_flags |= PVO_WIRED;
-
- if ((m->flags & PG_FICTITIOUS) != 0)
- pvo_flags |= PVO_FAKE;
-
- error = pmap_pvo_enter(pmap, zone, pvo_head, va, VM_PAGE_TO_PHYS(m),
- pte_lo, pvo_flags);
-
- /*
- * Flush the real page from the instruction cache if this page is
- * mapped executable and cacheable and was not previously mapped (or
- * was not mapped executable).
- */
- if (error == 0 && (pvo_flags & PVO_EXECUTABLE) &&
- (pte_lo & PTE_I) == 0 && was_exec == 0) {
- /*
- * Flush the real memory from the cache.
- */
- pmap_syncicache(VM_PAGE_TO_PHYS(m), PAGE_SIZE);
- if (pg != NULL)
- pmap_attr_save(pg, PTE_EXEC);
- }
- if (pmap_bootstrapped)
- vm_page_unlock_queues();
-
- /* XXX syncicache always until problems are sorted */
- pmap_syncicache(VM_PAGE_TO_PHYS(m), PAGE_SIZE);
- PMAP_UNLOCK(pmap);
-}
-
-vm_page_t
-pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_page_t mpte)
-{
-
- vm_page_busy(m);
- vm_page_unlock_queues();
- VM_OBJECT_UNLOCK(m->object);
- mtx_lock(&Giant);
- pmap_enter(pm, va, m, VM_PROT_READ | VM_PROT_EXECUTE, FALSE);
- mtx_unlock(&Giant);
- VM_OBJECT_LOCK(m->object);
- vm_page_lock_queues();
- vm_page_wakeup(m);
- return (NULL);
-}
-
-vm_paddr_t
-pmap_extract(pmap_t pm, vm_offset_t va)
-{
- struct pvo_entry *pvo;
- vm_paddr_t pa;
-
- PMAP_LOCK(pm);
- pvo = pmap_pvo_find_va(pm, va & ~ADDR_POFF, NULL);
- if (pvo == NULL)
- pa = 0;
- else
- pa = (pvo->pvo_pte.pte_lo & PTE_RPGN) | (va & ADDR_POFF);
- PMAP_UNLOCK(pm);
- return (pa);
-}
-
-/*
- * Atomically extract and hold the physical page with the given
- * pmap and virtual address pair if that mapping permits the given
- * protection.
- */
-vm_page_t
-pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
-{
- struct pvo_entry *pvo;
- vm_page_t m;
-
- m = NULL;
- mtx_lock(&Giant);
- vm_page_lock_queues();
- PMAP_LOCK(pmap);
- pvo = pmap_pvo_find_va(pmap, va & ~ADDR_POFF, NULL);
- if (pvo != NULL && (pvo->pvo_pte.pte_hi & PTE_VALID) &&
- ((pvo->pvo_pte.pte_lo & PTE_PP) == PTE_RW ||
- (prot & VM_PROT_WRITE) == 0)) {
- m = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte_lo & PTE_RPGN);
- vm_page_hold(m);
- }
- vm_page_unlock_queues();
- PMAP_UNLOCK(pmap);
- mtx_unlock(&Giant);
- return (m);
-}
-
-/*
- * Grow the number of kernel page table entries. Unneeded.
- */
-void
-pmap_growkernel(vm_offset_t addr)
-{
-}
-
-/*
- * Initialize a vm_page's machine-dependent fields.
- */
-void
-pmap_page_init(vm_page_t m)
-{
-}
-
-void
-pmap_init(void)
-{
-
- CTR0(KTR_PMAP, "pmap_init");
-
- pmap_upvo_zone = uma_zcreate("UPVO entry", sizeof (struct pvo_entry),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
- UMA_ZONE_VM | UMA_ZONE_NOFREE);
- pmap_mpvo_zone = uma_zcreate("MPVO entry", sizeof(struct pvo_entry),
- NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
- UMA_ZONE_VM | UMA_ZONE_NOFREE);
- pmap_initialized = TRUE;
-}
-
-void
-pmap_init2(void)
-{
-
- CTR0(KTR_PMAP, "pmap_init2");
-}
-
-boolean_t
-pmap_is_modified(vm_page_t m)
-{
-
- if ((m->flags & (PG_FICTITIOUS |PG_UNMANAGED)) != 0)
- return (FALSE);
-
- return (pmap_query_bit(m, PTE_CHG));
-}
-
-/*
- * pmap_is_prefaultable:
- *
- * Return whether or not the specified virtual address is elgible
- * for prefault.
- */
-boolean_t
-pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr)
-{
-
- return (FALSE);
-}
-
-void
-pmap_clear_reference(vm_page_t m)
-{
-
- if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
- return;
- pmap_clear_bit(m, PTE_REF, NULL);
-}
-
-void
-pmap_clear_modify(vm_page_t m)
-{
-
- if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
- return;
- pmap_clear_bit(m, PTE_CHG, NULL);
-}
-
-/*
- * pmap_ts_referenced:
- *
- * Return a count of reference bits for a page, clearing those bits.
- * It is not necessary for every reference bit to be cleared, but it
- * is necessary that 0 only be returned when there are truly no
- * reference bits set.
- *
- * XXX: The exact number of bits to check and clear is a matter that
- * should be tested and standardized at some point in the future for
- * optimal aging of shared pages.
- */
-int
-pmap_ts_referenced(vm_page_t m)
-{
- int count;
-
- if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
- return (0);
-
- count = pmap_clear_bit(m, PTE_REF, NULL);
-
- return (count);
-}
-
-/*
- * Map a wired page into kernel virtual address space.
- */
-void
-pmap_kenter(vm_offset_t va, vm_offset_t pa)
-{
- u_int pte_lo;
- int error;
- int i;
-
-#if 0
- if (va < VM_MIN_KERNEL_ADDRESS)
- panic("pmap_kenter: attempt to enter non-kernel address %#x",
- va);
-#endif
-
- pte_lo = PTE_I | PTE_G;
- for (i = 0; i < pregions_sz; i++) {
- if ((pa >= pregions[i].mr_start) &&
- (pa < (pregions[i].mr_start + pregions[i].mr_size))) {
- pte_lo &= ~(PTE_I | PTE_G);
- break;
- }
- }
-
- PMAP_LOCK(kernel_pmap);
- error = pmap_pvo_enter(kernel_pmap, pmap_upvo_zone,
- &pmap_pvo_kunmanaged, va, pa, pte_lo, PVO_WIRED);
-
- if (error != 0 && error != ENOENT)
- panic("pmap_kenter: failed to enter va %#x pa %#x: %d", va,
- pa, error);
-
- /*
- * Flush the real memory from the instruction cache.
- */
- if ((pte_lo & (PTE_I | PTE_G)) == 0) {
- pmap_syncicache(pa, PAGE_SIZE);
- }
- PMAP_UNLOCK(kernel_pmap);
-}
-
-/*
- * Extract the physical page address associated with the given kernel virtual
- * address.
- */
-vm_offset_t
-pmap_kextract(vm_offset_t va)
-{
- struct pvo_entry *pvo;
- vm_paddr_t pa;
-
-#ifdef UMA_MD_SMALL_ALLOC
- /*
- * Allow direct mappings
- */
- if (va < VM_MIN_KERNEL_ADDRESS) {
- return (va);
- }
-#endif
-
- PMAP_LOCK(kernel_pmap);
- pvo = pmap_pvo_find_va(kernel_pmap, va & ~ADDR_POFF, NULL);
- KASSERT(pvo != NULL, ("pmap_kextract: no addr found"));
- pa = (pvo->pvo_pte.pte_lo & PTE_RPGN) | (va & ADDR_POFF);
- PMAP_UNLOCK(kernel_pmap);
- return (pa);
-}
-
-/*
- * Remove a wired page from kernel virtual address space.
- */
-void
-pmap_kremove(vm_offset_t va)
-{
-
- pmap_remove(kernel_pmap, va, va + PAGE_SIZE);
-}
-
-/*
- * Map a range of physical addresses into kernel virtual address space.
- *
- * The value passed in *virt is a suggested virtual address for the mapping.
- * Architectures which can support a direct-mapped physical to virtual region
- * can return the appropriate address within that region, leaving '*virt'
- * unchanged. We cannot and therefore do not; *virt is updated with the
- * first usable address after the mapped region.
- */
-vm_offset_t
-pmap_map(vm_offset_t *virt, vm_offset_t pa_start, vm_offset_t pa_end, int prot)
-{
- vm_offset_t sva, va;
-
- sva = *virt;
- va = sva;
- for (; pa_start < pa_end; pa_start += PAGE_SIZE, va += PAGE_SIZE)
- pmap_kenter(va, pa_start);
- *virt = va;
- return (sva);
-}
-
-int
-pmap_mincore(pmap_t pmap, vm_offset_t addr)
-{
- TODO;
- return (0);
-}
-
-void
-pmap_object_init_pt(pmap_t pm, vm_offset_t addr, vm_object_t object,
- vm_pindex_t pindex, vm_size_t size)
-{
-
- VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
- KASSERT(object->type == OBJT_DEVICE,
- ("pmap_object_init_pt: non-device object"));
- KASSERT(pm == &curproc->p_vmspace->vm_pmap || pm == kernel_pmap,
- ("pmap_object_init_pt: non current pmap"));
-}
-
-/*
- * Lower the permission for all mappings to a given page.
- */
-void
-pmap_page_protect(vm_page_t m, vm_prot_t prot)
-{
- struct pvo_head *pvo_head;
- struct pvo_entry *pvo, *next_pvo;
- struct pte *pt;
- pmap_t pmap;
-
- /*
- * Since the routine only downgrades protection, if the
- * maximal protection is desired, there isn't any change
- * to be made.
- */
- if ((prot & (VM_PROT_READ|VM_PROT_WRITE)) ==
- (VM_PROT_READ|VM_PROT_WRITE))
- return;
-
- pvo_head = vm_page_to_pvoh(m);
- for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) {
- next_pvo = LIST_NEXT(pvo, pvo_vlink);
- PMAP_PVO_CHECK(pvo); /* sanity check */
- pmap = pvo->pvo_pmap;
- PMAP_LOCK(pmap);
-
- /*
- * Downgrading to no mapping at all, we just remove the entry.
- */
- if ((prot & VM_PROT_READ) == 0) {
- pmap_pvo_remove(pvo, -1);
- PMAP_UNLOCK(pmap);
- continue;
- }
-
- /*
- * If EXEC permission is being revoked, just clear the flag
- * in the PVO.
- */
- if ((prot & VM_PROT_EXECUTE) == 0)
- pvo->pvo_vaddr &= ~PVO_EXECUTABLE;
-
- /*
- * If this entry is already RO, don't diddle with the page
- * table.
- */
- if ((pvo->pvo_pte.pte_lo & PTE_PP) == PTE_BR) {
- PMAP_UNLOCK(pmap);
- PMAP_PVO_CHECK(pvo);
- continue;
- }
-
- /*
- * Grab the PTE before we diddle the bits so pvo_to_pte can
- * verify the pte contents are as expected.
- */
- pt = pmap_pvo_to_pte(pvo, -1);
- pvo->pvo_pte.pte_lo &= ~PTE_PP;
- pvo->pvo_pte.pte_lo |= PTE_BR;
- if (pt != NULL)
- pmap_pte_change(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PMAP_UNLOCK(pmap);
- PMAP_PVO_CHECK(pvo); /* sanity check */
- }
-
- /*
- * Downgrading from writeable: clear the VM page flag
- */
- if ((prot & VM_PROT_WRITE) != VM_PROT_WRITE)
- vm_page_flag_clear(m, PG_WRITEABLE);
-}
-
-/*
- * Returns true if the pmap's pv is one of the first
- * 16 pvs linked to from this page. This count may
- * be changed upwards or downwards in the future; it
- * is only necessary that true be returned for a small
- * subset of pmaps for proper page aging.
- */
-boolean_t
-pmap_page_exists_quick(pmap_t pmap, vm_page_t m)
-{
- int loops;
- struct pvo_entry *pvo;
-
- if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
- return FALSE;
-
- loops = 0;
- LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
- if (pvo->pvo_pmap == pmap)
- return (TRUE);
- if (++loops >= 16)
- break;
- }
-
- return (FALSE);
-}
-
-static u_int pmap_vsidcontext;
-
-void
-pmap_pinit(pmap_t pmap)
-{
- int i, mask;
- u_int entropy;
-
- KASSERT((int)pmap < VM_MIN_KERNEL_ADDRESS, ("pmap_pinit: virt pmap"));
- PMAP_LOCK_INIT(pmap);
-
- entropy = 0;
- __asm __volatile("mftb %0" : "=r"(entropy));
-
- /*
- * Allocate some segment registers for this pmap.
- */
- for (i = 0; i < NPMAPS; i += VSID_NBPW) {
- u_int hash, n;
-
- /*
- * Create a new value by mutiplying by a prime and adding in
- * entropy from the timebase register. This is to make the
- * VSID more random so that the PT hash function collides
- * less often. (Note that the prime casues gcc to do shifts
- * instead of a multiply.)
- */
- pmap_vsidcontext = (pmap_vsidcontext * 0x1105) + entropy;
- hash = pmap_vsidcontext & (NPMAPS - 1);
- if (hash == 0) /* 0 is special, avoid it */
- continue;
- n = hash >> 5;
- mask = 1 << (hash & (VSID_NBPW - 1));
- hash = (pmap_vsidcontext & 0xfffff);
- if (pmap_vsid_bitmap[n] & mask) { /* collision? */
- /* anything free in this bucket? */
- if (pmap_vsid_bitmap[n] == 0xffffffff) {
- entropy = (pmap_vsidcontext >> 20);
- continue;
- }
- i = ffs(~pmap_vsid_bitmap[i]) - 1;
- mask = 1 << i;
- hash &= 0xfffff & ~(VSID_NBPW - 1);
- hash |= i;
- }
- pmap_vsid_bitmap[n] |= mask;
- for (i = 0; i < 16; i++)
- pmap->pm_sr[i] = VSID_MAKE(i, hash);
- return;
- }
-
- panic("pmap_pinit: out of segments");
-}
-
-/*
- * Initialize the pmap associated with process 0.
- */
-void
-pmap_pinit0(pmap_t pm)
-{
-
- pmap_pinit(pm);
- bzero(&pm->pm_stats, sizeof(pm->pm_stats));
-}
-
-/*
- * Set the physical protection on the specified range of this map as requested.
- */
-void
-pmap_protect(pmap_t pm, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot)
-{
- struct pvo_entry *pvo;
- struct pte *pt;
- int pteidx;
-
- CTR4(KTR_PMAP, "pmap_protect: pm=%p sva=%#x eva=%#x prot=%#x", pm, sva,
- eva, prot);
-
-
- KASSERT(pm == &curproc->p_vmspace->vm_pmap || pm == kernel_pmap,
- ("pmap_protect: non current pmap"));
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- mtx_lock(&Giant);
- pmap_remove(pm, sva, eva);
- mtx_unlock(&Giant);
- return;
- }
-
- mtx_lock(&Giant);
- vm_page_lock_queues();
- PMAP_LOCK(pm);
- for (; sva < eva; sva += PAGE_SIZE) {
- pvo = pmap_pvo_find_va(pm, sva, &pteidx);
- if (pvo == NULL)
- continue;
-
- if ((prot & VM_PROT_EXECUTE) == 0)
- pvo->pvo_vaddr &= ~PVO_EXECUTABLE;
-
- /*
- * Grab the PTE pointer before we diddle with the cached PTE
- * copy.
- */
- pt = pmap_pvo_to_pte(pvo, pteidx);
- /*
- * Change the protection of the page.
- */
- pvo->pvo_pte.pte_lo &= ~PTE_PP;
- pvo->pvo_pte.pte_lo |= PTE_BR;
-
- /*
- * If the PVO is in the page table, update that pte as well.
- */
- if (pt != NULL)
- pmap_pte_change(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- }
- vm_page_unlock_queues();
- PMAP_UNLOCK(pm);
- mtx_unlock(&Giant);
-}
-
-/*
- * Map a list of wired pages into kernel virtual address space. This is
- * intended for temporary mappings which do not need page modification or
- * references recorded. Existing mappings in the region are overwritten.
- */
-void
-pmap_qenter(vm_offset_t sva, vm_page_t *m, int count)
-{
- vm_offset_t va;
-
- va = sva;
- while (count-- > 0) {
- pmap_kenter(va, VM_PAGE_TO_PHYS(*m));
- va += PAGE_SIZE;
- m++;
- }
-}
-
-/*
- * Remove page mappings from kernel virtual address space. Intended for
- * temporary mappings entered by pmap_qenter.
- */
-void
-pmap_qremove(vm_offset_t sva, int count)
-{
- vm_offset_t va;
-
- va = sva;
- while (count-- > 0) {
- pmap_kremove(va);
- va += PAGE_SIZE;
- }
-}
-
-void
-pmap_release(pmap_t pmap)
-{
- int idx, mask;
-
- /*
- * Free segment register's VSID
- */
- if (pmap->pm_sr[0] == 0)
- panic("pmap_release");
-
- idx = VSID_TO_HASH(pmap->pm_sr[0]) & (NPMAPS-1);
- mask = 1 << (idx % VSID_NBPW);
- idx /= VSID_NBPW;
- pmap_vsid_bitmap[idx] &= ~mask;
- PMAP_LOCK_DESTROY(pmap);
-}
-
-/*
- * Remove the given range of addresses from the specified map.
- */
-void
-pmap_remove(pmap_t pm, vm_offset_t sva, vm_offset_t eva)
-{
- struct pvo_entry *pvo;
- int pteidx;
-
- vm_page_lock_queues();
- PMAP_LOCK(pm);
- for (; sva < eva; sva += PAGE_SIZE) {
- pvo = pmap_pvo_find_va(pm, sva, &pteidx);
- if (pvo != NULL) {
- pmap_pvo_remove(pvo, pteidx);
- }
- }
- PMAP_UNLOCK(pm);
- vm_page_unlock_queues();
-}
-
-/*
- * Remove physical page from all pmaps in which it resides. pmap_pvo_remove()
- * will reflect changes in pte's back to the vm_page.
- */
-void
-pmap_remove_all(vm_page_t m)
-{
- struct pvo_head *pvo_head;
- struct pvo_entry *pvo, *next_pvo;
- pmap_t pmap;
-
- mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-
- pvo_head = vm_page_to_pvoh(m);
- for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) {
- next_pvo = LIST_NEXT(pvo, pvo_vlink);
-
- PMAP_PVO_CHECK(pvo); /* sanity check */
- pmap = pvo->pvo_pmap;
- PMAP_LOCK(pmap);
- pmap_pvo_remove(pvo, -1);
- PMAP_UNLOCK(pmap);
- }
- vm_page_flag_clear(m, PG_WRITEABLE);
-}
-
-/*
- * Remove all pages from specified address space, this aids process exit
- * speeds. This is much faster than pmap_remove in the case of running down
- * an entire address space. Only works for the current pmap.
- */
-void
-pmap_remove_pages(pmap_t pm, vm_offset_t sva, vm_offset_t eva)
-{
-}
-
-/*
- * Allocate a physical page of memory directly from the phys_avail map.
- * Can only be called from pmap_bootstrap before avail start and end are
- * calculated.
- */
-static vm_offset_t
-pmap_bootstrap_alloc(vm_size_t size, u_int align)
-{
- vm_offset_t s, e;
- int i, j;
-
- size = round_page(size);
- for (i = 0; phys_avail[i + 1] != 0; i += 2) {
- if (align != 0)
- s = (phys_avail[i] + align - 1) & ~(align - 1);
- else
- s = phys_avail[i];
- e = s + size;
-
- if (s < phys_avail[i] || e > phys_avail[i + 1])
- continue;
-
- if (s == phys_avail[i]) {
- phys_avail[i] += size;
- } else if (e == phys_avail[i + 1]) {
- phys_avail[i + 1] -= size;
- } else {
- for (j = phys_avail_count * 2; j > i; j -= 2) {
- phys_avail[j] = phys_avail[j - 2];
- phys_avail[j + 1] = phys_avail[j - 1];
- }
-
- phys_avail[i + 3] = phys_avail[i + 1];
- phys_avail[i + 1] = s;
- phys_avail[i + 2] = e;
- phys_avail_count++;
- }
-
- return (s);
- }
- panic("pmap_bootstrap_alloc: could not allocate memory");
-}
-
-/*
- * Return an unmapped pvo for a kernel virtual address.
- * Used by pmap functions that operate on physical pages.
- */
-static struct pvo_entry *
-pmap_rkva_alloc(void)
-{
- struct pvo_entry *pvo;
- struct pte *pt;
- vm_offset_t kva;
- int pteidx;
-
- if (pmap_rkva_count == 0)
- panic("pmap_rkva_alloc: no more reserved KVAs");
-
- kva = pmap_rkva_start + (PAGE_SIZE * --pmap_rkva_count);
- pmap_kenter(kva, 0);
-
- pvo = pmap_pvo_find_va(kernel_pmap, kva, &pteidx);
-
- if (pvo == NULL)
- panic("pmap_kva_alloc: pmap_pvo_find_va failed");
-
- pt = pmap_pvo_to_pte(pvo, pteidx);
-
- if (pt == NULL)
- panic("pmap_kva_alloc: pmap_pvo_to_pte failed");
-
- pmap_pte_unset(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PVO_PTEGIDX_CLR(pvo);
-
- pmap_pte_overflow++;
-
- return (pvo);
-}
-
-static void
-pmap_pa_map(struct pvo_entry *pvo, vm_offset_t pa, struct pte *saved_pt,
- int *depth_p)
-{
- struct pte *pt;
-
- /*
- * If this pvo already has a valid pte, we need to save it so it can
- * be restored later. We then just reload the new PTE over the old
- * slot.
- */
- if (saved_pt != NULL) {
- pt = pmap_pvo_to_pte(pvo, -1);
-
- if (pt != NULL) {
- pmap_pte_unset(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PVO_PTEGIDX_CLR(pvo);
- pmap_pte_overflow++;
- }
-
- *saved_pt = pvo->pvo_pte;
-
- pvo->pvo_pte.pte_lo &= ~PTE_RPGN;
- }
-
- pvo->pvo_pte.pte_lo |= pa;
-
- if (!pmap_pte_spill(pvo->pvo_vaddr))
- panic("pmap_pa_map: could not spill pvo %p", pvo);
-
- if (depth_p != NULL)
- (*depth_p)++;
-}
-
-static void
-pmap_pa_unmap(struct pvo_entry *pvo, struct pte *saved_pt, int *depth_p)
-{
- struct pte *pt;
-
- pt = pmap_pvo_to_pte(pvo, -1);
-
- if (pt != NULL) {
- pmap_pte_unset(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PVO_PTEGIDX_CLR(pvo);
- pmap_pte_overflow++;
- }
-
- pvo->pvo_pte.pte_lo &= ~PTE_RPGN;
-
- /*
- * If there is a saved PTE and it's valid, restore it and return.
- */
- if (saved_pt != NULL && (saved_pt->pte_lo & PTE_RPGN) != 0) {
- if (depth_p != NULL && --(*depth_p) == 0)
- panic("pmap_pa_unmap: restoring but depth == 0");
-
- pvo->pvo_pte = *saved_pt;
-
- if (!pmap_pte_spill(pvo->pvo_vaddr))
- panic("pmap_pa_unmap: could not spill pvo %p", pvo);
- }
-}
-
-static void
-pmap_syncicache(vm_offset_t pa, vm_size_t len)
-{
- __syncicache((void *)pa, len);
-}
-
-static void
-tlbia(void)
-{
- caddr_t i;
-
- SYNC();
- for (i = 0; i < (caddr_t)0x00040000; i += 0x00001000) {
- TLBIE(i);
- EIEIO();
- }
- TLBSYNC();
- SYNC();
-}
-
-static int
-pmap_pvo_enter(pmap_t pm, uma_zone_t zone, struct pvo_head *pvo_head,
- vm_offset_t va, vm_offset_t pa, u_int pte_lo, int flags)
-{
- struct pvo_entry *pvo;
- u_int sr;
- int first;
- u_int ptegidx;
- int i;
- int bootstrap;
-
- pmap_pvo_enter_calls++;
- first = 0;
- bootstrap = 0;
-
- /*
- * Compute the PTE Group index.
- */
- va &= ~ADDR_POFF;
- sr = va_to_sr(pm->pm_sr, va);
- ptegidx = va_to_pteg(sr, va);
-
- /*
- * Remove any existing mapping for this page. Reuse the pvo entry if
- * there is a mapping.
- */
- mtx_lock(&pmap_table_mutex);
- LIST_FOREACH(pvo, &pmap_pvo_table[ptegidx], pvo_olink) {
- if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) {
- if ((pvo->pvo_pte.pte_lo & PTE_RPGN) == pa &&
- (pvo->pvo_pte.pte_lo & PTE_PP) ==
- (pte_lo & PTE_PP)) {
- mtx_unlock(&pmap_table_mutex);
- return (0);
- }
- pmap_pvo_remove(pvo, -1);
- break;
- }
- }
-
- /*
- * If we aren't overwriting a mapping, try to allocate.
- */
- if (pmap_initialized) {
- pvo = uma_zalloc(zone, M_NOWAIT);
- } else {
- if (pmap_bpvo_pool_index >= BPVO_POOL_SIZE) {
- panic("pmap_enter: bpvo pool exhausted, %d, %d, %d",
- pmap_bpvo_pool_index, BPVO_POOL_SIZE,
- BPVO_POOL_SIZE * sizeof(struct pvo_entry));
- }
- pvo = &pmap_bpvo_pool[pmap_bpvo_pool_index];
- pmap_bpvo_pool_index++;
- bootstrap = 1;
- }
-
- if (pvo == NULL) {
- mtx_unlock(&pmap_table_mutex);
- return (ENOMEM);
- }
-
- pmap_pvo_entries++;
- pvo->pvo_vaddr = va;
- pvo->pvo_pmap = pm;
- LIST_INSERT_HEAD(&pmap_pvo_table[ptegidx], pvo, pvo_olink);
- pvo->pvo_vaddr &= ~ADDR_POFF;
- if (flags & VM_PROT_EXECUTE)
- pvo->pvo_vaddr |= PVO_EXECUTABLE;
- if (flags & PVO_WIRED)
- pvo->pvo_vaddr |= PVO_WIRED;
- if (pvo_head != &pmap_pvo_kunmanaged)
- pvo->pvo_vaddr |= PVO_MANAGED;
- if (bootstrap)
- pvo->pvo_vaddr |= PVO_BOOTSTRAP;
- if (flags & PVO_FAKE)
- pvo->pvo_vaddr |= PVO_FAKE;
-
- pmap_pte_create(&pvo->pvo_pte, sr, va, pa | pte_lo);
-
- /*
- * Remember if the list was empty and therefore will be the first
- * item.
- */
- if (LIST_FIRST(pvo_head) == NULL)
- first = 1;
- LIST_INSERT_HEAD(pvo_head, pvo, pvo_vlink);
-
- if (pvo->pvo_pte.pte_lo & PVO_WIRED)
- pm->pm_stats.wired_count++;
- pm->pm_stats.resident_count++;
-
- /*
- * We hope this succeeds but it isn't required.
- */
- i = pmap_pte_insert(ptegidx, &pvo->pvo_pte);
- if (i >= 0) {
- PVO_PTEGIDX_SET(pvo, i);
- } else {
- panic("pmap_pvo_enter: overflow");
- pmap_pte_overflow++;
- }
- mtx_unlock(&pmap_table_mutex);
-
- return (first ? ENOENT : 0);
-}
-
-static void
-pmap_pvo_remove(struct pvo_entry *pvo, int pteidx)
-{
- struct pte *pt;
-
- /*
- * If there is an active pte entry, we need to deactivate it (and
- * save the ref & cfg bits).
- */
- pt = pmap_pvo_to_pte(pvo, pteidx);
- if (pt != NULL) {
- pmap_pte_unset(pt, &pvo->pvo_pte, pvo->pvo_vaddr);
- PVO_PTEGIDX_CLR(pvo);
- } else {
- pmap_pte_overflow--;
- }
-
- /*
- * Update our statistics.
- */
- pvo->pvo_pmap->pm_stats.resident_count--;
- if (pvo->pvo_pte.pte_lo & PVO_WIRED)
- pvo->pvo_pmap->pm_stats.wired_count--;
-
- /*
- * Save the REF/CHG bits into their cache if the page is managed.
- */
- if ((pvo->pvo_vaddr & (PVO_MANAGED|PVO_FAKE)) == PVO_MANAGED) {
- struct vm_page *pg;
-
- pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte_lo & PTE_RPGN);
- if (pg != NULL) {
- pmap_attr_save(pg, pvo->pvo_pte.pte_lo &
- (PTE_REF | PTE_CHG));
- }
- }
-
- /*
- * Remove this PVO from the PV list.
- */
- LIST_REMOVE(pvo, pvo_vlink);
-
- /*
- * Remove this from the overflow list and return it to the pool
- * if we aren't going to reuse it.
- */
- LIST_REMOVE(pvo, pvo_olink);
- if (!(pvo->pvo_vaddr & PVO_BOOTSTRAP))
- uma_zfree(pvo->pvo_vaddr & PVO_MANAGED ? pmap_mpvo_zone :
- pmap_upvo_zone, pvo);
- pmap_pvo_entries--;
- pmap_pvo_remove_calls++;
-}
-
-static __inline int
-pmap_pvo_pte_index(const struct pvo_entry *pvo, int ptegidx)
-{
- int pteidx;
-
- /*
- * We can find the actual pte entry without searching by grabbing
- * the PTEG index from 3 unused bits in pte_lo[11:9] and by
- * noticing the HID bit.
- */
- pteidx = ptegidx * 8 + PVO_PTEGIDX_GET(pvo);
- if (pvo->pvo_pte.pte_hi & PTE_HID)
- pteidx ^= pmap_pteg_mask * 8;
-
- return (pteidx);
-}
-
-static struct pvo_entry *
-pmap_pvo_find_va(pmap_t pm, vm_offset_t va, int *pteidx_p)
-{
- struct pvo_entry *pvo;
- int ptegidx;
- u_int sr;
-
- va &= ~ADDR_POFF;
- sr = va_to_sr(pm->pm_sr, va);
- ptegidx = va_to_pteg(sr, va);
-
- mtx_lock(&pmap_table_mutex);
- LIST_FOREACH(pvo, &pmap_pvo_table[ptegidx], pvo_olink) {
- if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) {
- if (pteidx_p)
- *pteidx_p = pmap_pvo_pte_index(pvo, ptegidx);
- break;
- }
- }
- mtx_unlock(&pmap_table_mutex);
-
- return (pvo);
-}
-
-static struct pte *
-pmap_pvo_to_pte(const struct pvo_entry *pvo, int pteidx)
-{
- struct pte *pt;
-
- /*
- * If we haven't been supplied the ptegidx, calculate it.
- */
- if (pteidx == -1) {
- int ptegidx;
- u_int sr;
-
- sr = va_to_sr(pvo->pvo_pmap->pm_sr, pvo->pvo_vaddr);
- ptegidx = va_to_pteg(sr, pvo->pvo_vaddr);
- pteidx = pmap_pvo_pte_index(pvo, ptegidx);
- }
-
- pt = &pmap_pteg_table[pteidx >> 3].pt[pteidx & 7];
-
- if ((pvo->pvo_pte.pte_hi & PTE_VALID) && !PVO_PTEGIDX_ISSET(pvo)) {
- panic("pmap_pvo_to_pte: pvo %p has valid pte in pvo but no "
- "valid pte index", pvo);
- }
-
- if ((pvo->pvo_pte.pte_hi & PTE_VALID) == 0 && PVO_PTEGIDX_ISSET(pvo)) {
- panic("pmap_pvo_to_pte: pvo %p has valid pte index in pvo "
- "pvo but no valid pte", pvo);
- }
-
- if ((pt->pte_hi ^ (pvo->pvo_pte.pte_hi & ~PTE_VALID)) == PTE_VALID) {
- if ((pvo->pvo_pte.pte_hi & PTE_VALID) == 0) {
- panic("pmap_pvo_to_pte: pvo %p has valid pte in "
- "pmap_pteg_table %p but invalid in pvo", pvo, pt);
- }
-
- if (((pt->pte_lo ^ pvo->pvo_pte.pte_lo) & ~(PTE_CHG|PTE_REF))
- != 0) {
- panic("pmap_pvo_to_pte: pvo %p pte does not match "
- "pte %p in pmap_pteg_table", pvo, pt);
- }
-
- return (pt);
- }
-
- if (pvo->pvo_pte.pte_hi & PTE_VALID) {
- panic("pmap_pvo_to_pte: pvo %p has invalid pte %p in "
- "pmap_pteg_table but valid in pvo", pvo, pt);
- }
-
- return (NULL);
-}
-
-/*
- * XXX: THIS STUFF SHOULD BE IN pte.c?
- */
-int
-pmap_pte_spill(vm_offset_t addr)
-{
- struct pvo_entry *source_pvo, *victim_pvo;
- struct pvo_entry *pvo;
- int ptegidx, i, j;
- u_int sr;
- struct pteg *pteg;
- struct pte *pt;
-
- pmap_pte_spills++;
-
- sr = mfsrin(addr);
- ptegidx = va_to_pteg(sr, addr);
-
- /*
- * Have to substitute some entry. Use the primary hash for this.
- * Use low bits of timebase as random generator.
- */
- pteg = &pmap_pteg_table[ptegidx];
- mtx_lock(&pmap_table_mutex);
- __asm __volatile("mftb %0" : "=r"(i));
- i &= 7;
- pt = &pteg->pt[i];
-
- source_pvo = NULL;
- victim_pvo = NULL;
- LIST_FOREACH(pvo, &pmap_pvo_table[ptegidx], pvo_olink) {
- /*
- * We need to find a pvo entry for this address.
- */
- PMAP_PVO_CHECK(pvo);
- if (source_pvo == NULL &&
- pmap_pte_match(&pvo->pvo_pte, sr, addr,
- pvo->pvo_pte.pte_hi & PTE_HID)) {
- /*
- * Now found an entry to be spilled into the pteg.
- * The PTE is now valid, so we know it's active.
- */
- j = pmap_pte_insert(ptegidx, &pvo->pvo_pte);
-
- if (j >= 0) {
- PVO_PTEGIDX_SET(pvo, j);
- pmap_pte_overflow--;
- PMAP_PVO_CHECK(pvo);
- mtx_unlock(&pmap_table_mutex);
- return (1);
- }
-
- source_pvo = pvo;
-
- if (victim_pvo != NULL)
- break;
- }
-
- /*
- * We also need the pvo entry of the victim we are replacing
- * so save the R & C bits of the PTE.
- */
- if ((pt->pte_hi & PTE_HID) == 0 && victim_pvo == NULL &&
- pmap_pte_compare(pt, &pvo->pvo_pte)) {
- victim_pvo = pvo;
- if (source_pvo != NULL)
- break;
- }
- }
-
- if (source_pvo == NULL) {
- mtx_unlock(&pmap_table_mutex);
- return (0);
- }
-
- if (victim_pvo == NULL) {
- if ((pt->pte_hi & PTE_HID) == 0)
- panic("pmap_pte_spill: victim p-pte (%p) has no pvo"
- "entry", pt);
-
- /*
- * If this is a secondary PTE, we need to search it's primary
- * pvo bucket for the matching PVO.
- */
- LIST_FOREACH(pvo, &pmap_pvo_table[ptegidx ^ pmap_pteg_mask],
- pvo_olink) {
- PMAP_PVO_CHECK(pvo);
- /*
- * We also need the pvo entry of the victim we are
- * replacing so save the R & C bits of the PTE.
- */
- if (pmap_pte_compare(pt, &pvo->pvo_pte)) {
- victim_pvo = pvo;
- break;
- }
- }
-
- if (victim_pvo == NULL)
- panic("pmap_pte_spill: victim s-pte (%p) has no pvo"
- "entry", pt);
- }
-
- /*
- * We are invalidating the TLB entry for the EA we are replacing even
- * though it's valid. If we don't, we lose any ref/chg bit changes
- * contained in the TLB entry.
- */
- source_pvo->pvo_pte.pte_hi &= ~PTE_HID;
-
- pmap_pte_unset(pt, &victim_pvo->pvo_pte, victim_pvo->pvo_vaddr);
- pmap_pte_set(pt, &source_pvo->pvo_pte);
-
- PVO_PTEGIDX_CLR(victim_pvo);
- PVO_PTEGIDX_SET(source_pvo, i);
- pmap_pte_replacements++;
-
- PMAP_PVO_CHECK(victim_pvo);
- PMAP_PVO_CHECK(source_pvo);
-
- mtx_unlock(&pmap_table_mutex);
- return (1);
-}
-
-static int
-pmap_pte_insert(u_int ptegidx, struct pte *pvo_pt)
-{
- struct pte *pt;
- int i;
-
- /*
- * First try primary hash.
- */
- for (pt = pmap_pteg_table[ptegidx].pt, i = 0; i < 8; i++, pt++) {
- if ((pt->pte_hi & PTE_VALID) == 0) {
- pvo_pt->pte_hi &= ~PTE_HID;
- pmap_pte_set(pt, pvo_pt);
- return (i);
- }
- }
-
- /*
- * Now try secondary hash.
- */
- ptegidx ^= pmap_pteg_mask;
- ptegidx++;
- for (pt = pmap_pteg_table[ptegidx].pt, i = 0; i < 8; i++, pt++) {
- if ((pt->pte_hi & PTE_VALID) == 0) {
- pvo_pt->pte_hi |= PTE_HID;
- pmap_pte_set(pt, pvo_pt);
- return (i);
- }
- }
-
- panic("pmap_pte_insert: overflow");
- return (-1);
-}
-
-static boolean_t
-pmap_query_bit(vm_page_t m, int ptebit)
-{
- struct pvo_entry *pvo;
- struct pte *pt;
-
-#if 0
- if (pmap_attr_fetch(m) & ptebit)
- return (TRUE);
-#endif
-
- LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
- PMAP_PVO_CHECK(pvo); /* sanity check */
-
- /*
- * See if we saved the bit off. If so, cache it and return
- * success.
- */
- if (pvo->pvo_pte.pte_lo & ptebit) {
- pmap_attr_save(m, ptebit);
- PMAP_PVO_CHECK(pvo); /* sanity check */
- return (TRUE);
- }
- }
-
- /*
- * No luck, now go through the hard part of looking at the PTEs
- * themselves. Sync so that any pending REF/CHG bits are flushed to
- * the PTEs.
- */
- SYNC();
- LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
- PMAP_PVO_CHECK(pvo); /* sanity check */
-
- /*
- * See if this pvo has a valid PTE. if so, fetch the
- * REF/CHG bits from the valid PTE. If the appropriate
- * ptebit is set, cache it and return success.
- */
- pt = pmap_pvo_to_pte(pvo, -1);
- if (pt != NULL) {
- pmap_pte_synch(pt, &pvo->pvo_pte);
- if (pvo->pvo_pte.pte_lo & ptebit) {
- pmap_attr_save(m, ptebit);
- PMAP_PVO_CHECK(pvo); /* sanity check */
- return (TRUE);
- }
- }
- }
-
- return (FALSE);
-}
-
-static u_int
-pmap_clear_bit(vm_page_t m, int ptebit, int *origbit)
-{
- u_int count;
- struct pvo_entry *pvo;
- struct pte *pt;
- int rv;
-
- /*
- * Clear the cached value.
- */
- rv = pmap_attr_fetch(m);
- pmap_attr_clear(m, ptebit);
-
- /*
- * Sync so that any pending REF/CHG bits are flushed to the PTEs (so
- * we can reset the right ones). note that since the pvo entries and
- * list heads are accessed via BAT0 and are never placed in the page
- * table, we don't have to worry about further accesses setting the
- * REF/CHG bits.
- */
- SYNC();
-
- /*
- * For each pvo entry, clear the pvo's ptebit. If this pvo has a
- * valid pte clear the ptebit from the valid pte.
- */
- count = 0;
- LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
- PMAP_PVO_CHECK(pvo); /* sanity check */
- pt = pmap_pvo_to_pte(pvo, -1);
- if (pt != NULL) {
- pmap_pte_synch(pt, &pvo->pvo_pte);
- if (pvo->pvo_pte.pte_lo & ptebit) {
- count++;
- pmap_pte_clear(pt, PVO_VADDR(pvo), ptebit);
- }
- }
- rv |= pvo->pvo_pte.pte_lo;
- pvo->pvo_pte.pte_lo &= ~ptebit;
- PMAP_PVO_CHECK(pvo); /* sanity check */
- }
-
- if (origbit != NULL) {
- *origbit = rv;
- }
-
- return (count);
-}
-
-/*
- * Return true if the physical range is encompassed by the battable[idx]
- */
-static int
-pmap_bat_mapped(int idx, vm_offset_t pa, vm_size_t size)
-{
- u_int prot;
- u_int32_t start;
- u_int32_t end;
- u_int32_t bat_ble;
-
- /*
- * Return immediately if not a valid mapping
- */
- if (!battable[idx].batu & BAT_Vs)
- return (EINVAL);
-
- /*
- * The BAT entry must be cache-inhibited, guarded, and r/w
- * so it can function as an i/o page
- */
- prot = battable[idx].batl & (BAT_I|BAT_G|BAT_PP_RW);
- if (prot != (BAT_I|BAT_G|BAT_PP_RW))
- return (EPERM);
-
- /*
- * The address should be within the BAT range. Assume that the
- * start address in the BAT has the correct alignment (thus
- * not requiring masking)
- */
- start = battable[idx].batl & BAT_PBS;
- bat_ble = (battable[idx].batu & ~(BAT_EBS)) | 0x03;
- end = start | (bat_ble << 15) | 0x7fff;
-
- if ((pa < start) || ((pa + size) > end))
- return (ERANGE);
-
- return (0);
-}
-
-int
-pmap_dev_direct_mapped(vm_offset_t pa, vm_size_t size)
-{
- int i;
-
- /*
- * This currently does not work for entries that
- * overlap 256M BAT segments.
- */
-
- for(i = 0; i < 16; i++)
- if (pmap_bat_mapped(i, pa, size) == 0)
- return (0);
-
- return (EFAULT);
-}
-
-/*
- * Map a set of physical memory pages into the kernel virtual
- * address space. Return a pointer to where it is mapped. This
- * routine is intended to be used for mapping device memory,
- * NOT real memory.
- */
-void *
-pmap_mapdev(vm_offset_t pa, vm_size_t size)
-{
- vm_offset_t va, tmpva, ppa, offset;
- int i;
-
- ppa = trunc_page(pa);
- offset = pa & PAGE_MASK;
- size = roundup(offset + size, PAGE_SIZE);
-
- GIANT_REQUIRED;
-
- /*
- * If the physical address lies within a valid BAT table entry,
- * return the 1:1 mapping. This currently doesn't work
- * for regions that overlap 256M BAT segments.
- */
- for (i = 0; i < 16; i++) {
- if (pmap_bat_mapped(i, pa, size) == 0)
- return ((void *) pa);
- }
-
- va = kmem_alloc_nofault(kernel_map, size);
- if (!va)
- panic("pmap_mapdev: Couldn't alloc kernel virtual memory");
-
- for (tmpva = va; size > 0;) {
- pmap_kenter(tmpva, ppa);
- TLBIE(tmpva); /* XXX or should it be invalidate-all ? */
- size -= PAGE_SIZE;
- tmpva += PAGE_SIZE;
- ppa += PAGE_SIZE;
- }
-
- return ((void *)(va + offset));
-}
-
-void
-pmap_unmapdev(vm_offset_t va, vm_size_t size)
-{
- vm_offset_t base, offset;
-
- /*
- * If this is outside kernel virtual space, then it's a
- * battable entry and doesn't require unmapping
- */
- if ((va >= VM_MIN_KERNEL_ADDRESS) && (va <= VM_MAX_KERNEL_ADDRESS)) {
- base = trunc_page(va);
- offset = va & PAGE_MASK;
- size = roundup(offset + size, PAGE_SIZE);
- kmem_free(kernel_map, base, size);
- }
-}
diff --git a/sys/powerpc/psim/uart_iobus.c b/sys/powerpc/psim/uart_iobus.c
deleted file mode 100644
index 1d6c601..0000000
--- a/sys/powerpc/psim/uart_iobus.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * Copyright 2002 by Peter Grehan. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce 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.
- *
- * $FreeBSD$
- */
-
-/*
- * PSIM local bus 16550
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/module.h>
-#include <sys/tty.h>
-#include <machine/bus.h>
-#include <sys/timepps.h>
-
-#include <dev/ofw/openfirm.h>
-#include <powerpc/psim/iobusvar.h>
-
-#include <dev/sio/sioreg.h>
-#include <dev/sio/siovar.h>
-
-#include <isa/isavar.h> /* for isa_irq_pending() prototype */
-
-static int sio_iobus_attach(device_t dev);
-static int sio_iobus_probe(device_t dev);
-
-static device_method_t sio_iobus_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, sio_iobus_probe),
- DEVMETHOD(device_attach, sio_iobus_attach),
-
- { 0, 0 }
-};
-
-static driver_t sio_iobus_driver = {
- sio_driver_name,
- sio_iobus_methods,
- 0,
-};
-
-static int
-sio_iobus_attach(device_t dev)
-{
- return (sioattach(dev, 0, DEFAULT_RCLK));
-}
-
-static int
-sio_iobus_probe(device_t dev)
-{
- char *type = iobus_get_name(dev);
-
- if (strncmp(type, "com", 3) != 0)
- return (ENXIO);
-
-
- device_set_desc(dev, "PSIM serial port");
-
- /*
- * Call sioprobe with noprobe=1, to avoid hitting a psim bug
- */
- return (sioprobe(dev, 0, 0, 1));
-}
-
-DRIVER_MODULE(sio, iobus, sio_iobus_driver, sio_devclass, 0, 0);
-
-/*
- * Stub function. Perhaps a way to get this to work correctly would
- * be for child devices to set a field in the dev structure to
- * inform the parent that they are isa devices, and then use a
- * intr_pending() call which would propagate up to nexus to see
- * if the interrupt controller had any intrs in the isa group set
- */
-intrmask_t
-isa_irq_pending(void)
-{
- return (0);
-}
diff --git a/sys/rpc/types.h b/sys/rpc/types.h
deleted file mode 100644
index 58d22a8..0000000
--- a/sys/rpc/types.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* $NetBSD: types.h,v 1.13 2000/06/13 01:02:44 thorpej Exp $ */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- *
- * from: @(#)types.h 1.18 87/07/24 SMI
- * from: @(#)types.h 2.3 88/08/15 4.0 RPCSRC
- * $FreeBSD$
- */
-
-/*
- * Rpc additions to <sys/types.h>
- */
-#ifndef _RPC_TYPES_H
-#define _RPC_TYPES_H
-
-#include <sys/types.h>
-#include <sys/_null.h>
-
-typedef int32_t bool_t;
-typedef int32_t enum_t;
-
-typedef u_int32_t rpcprog_t;
-typedef u_int32_t rpcvers_t;
-typedef u_int32_t rpcproc_t;
-typedef u_int32_t rpcprot_t;
-typedef u_int32_t rpcport_t;
-typedef int32_t rpc_inline_t;
-
-#define __dontcare__ -1
-
-#ifndef FALSE
-# define FALSE (0)
-#endif
-#ifndef TRUE
-# define TRUE (1)
-#endif
-
-#define mem_alloc(bsize) calloc(1, bsize)
-#define mem_free(ptr, bsize) free(ptr)
-
-#include <sys/time.h>
-#include <netconfig.h>
-
-/*
- * The netbuf structure is defined here, because FreeBSD / NetBSD only use
- * it inside the RPC code. It's in <xti.h> on SVR4, but it would be confusing
- * to have an xti.h, since FreeBSD / NetBSD does not support XTI/TLI.
- */
-
-/*
- * The netbuf structure is used for transport-independent address storage.
- */
-struct netbuf {
- unsigned int maxlen;
- unsigned int len;
- void *buf;
-};
-
-/*
- * The format of the addres and options arguments of the XTI t_bind call.
- * Only provided for compatibility, it should not be used.
- */
-
-struct t_bind {
- struct netbuf addr;
- unsigned int qlen;
-};
-
-/*
- * Internal library and rpcbind use. This is not an exported interface, do
- * not use.
- */
-struct __rpc_sockinfo {
- int si_af;
- int si_proto;
- int si_socktype;
- int si_alen;
-};
-
-#endif /* !_RPC_TYPES_H */
diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c
deleted file mode 100644
index 9e8d45a..0000000
--- a/sys/security/mac/mac_framework.c
+++ /dev/null
@@ -1,1255 +0,0 @@
-/*-
- * Copyright (c) 1999-2002 Robert N. M. Watson
- * Copyright (c) 2001 Ilmar S. Habibulin
- * Copyright (c) 2001-2005 Networks Associates Technology, Inc.
- * All rights reserved.
- *
- * This software was developed by Robert Watson and Ilmar Habibulin for the
- * TrustedBSD Project.
- *
- * This software was developed for the FreeBSD Project in part by Network
- * Associates Laboratories, the Security Research Division of Network
- * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
- * as part of the DARPA CHATS research program.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*-
- * Framework for extensible kernel access control. This file contains
- * Kernel and userland interface to the framework, policy registration
- * and composition. Per-object interfaces, controls, and labeling may be
- * found in src/sys/security/mac/. Sample policies may be found in
- * src/sys/security/mac_*.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_mac.h"
-#include "opt_devfs.h"
-
-#include <sys/param.h>
-#include <sys/condvar.h>
-#include <sys/extattr.h>
-#include <sys/imgact.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/mac.h>
-#include <sys/module.h>
-#include <sys/proc.h>
-#include <sys/sbuf.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/sysent.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <sys/file.h>
-#include <sys/namei.h>
-#include <sys/socket.h>
-#include <sys/pipe.h>
-#include <sys/socketvar.h>
-#include <sys/sysctl.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <vm/vm_map.h>
-#include <vm/vm_object.h>
-
-#include <sys/mac_policy.h>
-
-#include <fs/devfs/devfs.h>
-
-#include <net/bpfdesc.h>
-#include <net/if.h>
-#include <net/if_var.h>
-
-#include <netinet/in.h>
-#include <netinet/ip_var.h>
-
-#include <security/mac/mac_internal.h>
-
-#ifdef MAC
-
-/*
- * Declare that the kernel provides MAC support, version 1. This permits
- * modules to refuse to be loaded if the necessary support isn't present,
- * even if it's pre-boot.
- */
-MODULE_VERSION(kernel_mac_support, 2);
-
-SYSCTL_NODE(_security, OID_AUTO, mac, CTLFLAG_RW, 0,
- "TrustedBSD MAC policy controls");
-
-#if MAC_MAX_SLOTS > 32
-#error "MAC_MAX_SLOTS too large"
-#endif
-
-static unsigned int mac_max_slots = MAC_MAX_SLOTS;
-static unsigned int mac_slot_offsets_free = (1 << MAC_MAX_SLOTS) - 1;
-SYSCTL_UINT(_security_mac, OID_AUTO, max_slots, CTLFLAG_RD,
- &mac_max_slots, 0, "");
-
-/*
- * Has the kernel started generating labeled objects yet? All read/write
- * access to this variable is serialized during the boot process. Following
- * the end of serialization, we don't update this flag; no locking.
- */
-int mac_late = 0;
-
-/*
- * Flag to indicate whether or not we should allocate label storage for
- * new mbufs. Since most dynamic policies we currently work with don't
- * rely on mbuf labeling, try to avoid paying the cost of mtag allocation
- * unless specifically notified of interest. One result of this is
- * that if a dynamically loaded policy requests mbuf labels, it must
- * be able to deal with a NULL label being returned on any mbufs that
- * were already in flight when the policy was loaded. Since the policy
- * already has to deal with uninitialized labels, this probably won't
- * be a problem. Note: currently no locking. Will this be a problem?
- */
-#ifndef MAC_ALWAYS_LABEL_MBUF
-int mac_labelmbufs = 0;
-#endif
-
-#ifdef MAC_DEBUG
-SYSCTL_NODE(_security_mac, OID_AUTO, debug, CTLFLAG_RW, 0,
- "TrustedBSD MAC debug info");
-SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
- "TrustedBSD MAC object counters");
-
-static unsigned int nmactemp;
-SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
- &nmactemp, 0, "number of temporary labels in use");
-#endif
-
-static int mac_policy_register(struct mac_policy_conf *mpc);
-static int mac_policy_unregister(struct mac_policy_conf *mpc);
-
-MALLOC_DEFINE(M_MACTEMP, "mactemp", "MAC temporary label storage");
-
-/*
- * mac_static_policy_list holds a list of policy modules that are not
- * loaded while the system is "live", and cannot be unloaded. These
- * policies can be invoked without holding the busy count.
- *
- * mac_policy_list stores the list of dynamic policies. A busy count is
- * maintained for the list, stored in mac_policy_busy. The busy count
- * is protected by mac_policy_mtx; the list may be modified only
- * while the busy count is 0, requiring that the lock be held to
- * prevent new references to the list from being acquired. For almost
- * all operations, incrementing the busy count is sufficient to
- * guarantee consistency, as the list cannot be modified while the
- * busy count is elevated. For a few special operations involving a
- * change to the list of active policies, the mtx itself must be held.
- * A condition variable, mac_policy_cv, is used to signal potential
- * exclusive consumers that they should try to acquire the lock if a
- * first attempt at exclusive access fails.
- */
-#ifndef MAC_STATIC
-static struct mtx mac_policy_mtx;
-static struct cv mac_policy_cv;
-static int mac_policy_count;
-#endif
-struct mac_policy_list_head mac_policy_list;
-struct mac_policy_list_head mac_static_policy_list;
-
-/*
- * We manually invoke WITNESS_WARN() to allow Witness to generate
- * warnings even if we don't end up ever triggering the wait at
- * run-time. The consumer of the exclusive interface must not hold
- * any locks (other than potentially Giant) since we may sleep for
- * long (potentially indefinite) periods of time waiting for the
- * framework to become quiescent so that a policy list change may
- * be made.
- */
-void
-mac_policy_grab_exclusive(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
- "mac_policy_grab_exclusive() at %s:%d", __FILE__, __LINE__);
- mtx_lock(&mac_policy_mtx);
- while (mac_policy_count != 0)
- cv_wait(&mac_policy_cv, &mac_policy_mtx);
-#endif
-}
-
-void
-mac_policy_assert_exclusive(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- mtx_assert(&mac_policy_mtx, MA_OWNED);
- KASSERT(mac_policy_count == 0,
- ("mac_policy_assert_exclusive(): not exclusive"));
-#endif
-}
-
-void
-mac_policy_release_exclusive(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- KASSERT(mac_policy_count == 0,
- ("mac_policy_release_exclusive(): not exclusive"));
- mtx_unlock(&mac_policy_mtx);
- cv_signal(&mac_policy_cv);
-#endif
-}
-
-void
-mac_policy_list_busy(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- mtx_lock(&mac_policy_mtx);
- mac_policy_count++;
- mtx_unlock(&mac_policy_mtx);
-#endif
-}
-
-int
-mac_policy_list_conditional_busy(void)
-{
-#ifndef MAC_STATIC
- int ret;
-
- if (!mac_late)
- return (1);
-
- mtx_lock(&mac_policy_mtx);
- if (!LIST_EMPTY(&mac_policy_list)) {
- mac_policy_count++;
- ret = 1;
- } else
- ret = 0;
- mtx_unlock(&mac_policy_mtx);
- return (ret);
-#else
- if (!mac_late)
- return (1);
-
- return (1);
-#endif
-}
-
-void
-mac_policy_list_unbusy(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- mtx_lock(&mac_policy_mtx);
- mac_policy_count--;
- KASSERT(mac_policy_count >= 0, ("MAC_POLICY_LIST_LOCK"));
- if (mac_policy_count == 0)
- cv_signal(&mac_policy_cv);
- mtx_unlock(&mac_policy_mtx);
-#endif
-}
-
-/*
- * Initialize the MAC subsystem, including appropriate SMP locks.
- */
-static void
-mac_init(void)
-{
-
- LIST_INIT(&mac_static_policy_list);
- LIST_INIT(&mac_policy_list);
- mac_labelzone_init();
-
-#ifndef MAC_STATIC
- mtx_init(&mac_policy_mtx, "mac_policy_mtx", NULL, MTX_DEF);
- cv_init(&mac_policy_cv, "mac_policy_cv");
-#endif
-}
-
-/*
- * For the purposes of modules that want to know if they were loaded
- * "early", set the mac_late flag once we've processed modules either
- * linked into the kernel, or loaded before the kernel startup.
- */
-static void
-mac_late_init(void)
-{
-
- mac_late = 1;
-}
-
-/*
- * After the policy list has changed, walk the list to update any global
- * flags. Currently, we support only one flag, and it's conditionally
- * defined; as a result, the entire function is conditional. Eventually,
- * the #else case might also iterate across the policies.
- */
-static void
-mac_policy_updateflags(void)
-{
-#ifndef MAC_ALWAYS_LABEL_MBUF
- struct mac_policy_conf *tmpc;
- int labelmbufs;
-
- mac_policy_assert_exclusive();
-
- labelmbufs = 0;
- LIST_FOREACH(tmpc, &mac_static_policy_list, mpc_list) {
- if (tmpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_LABELMBUFS)
- labelmbufs++;
- }
- LIST_FOREACH(tmpc, &mac_policy_list, mpc_list) {
- if (tmpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_LABELMBUFS)
- labelmbufs++;
- }
- mac_labelmbufs = (labelmbufs != 0);
-#endif
-}
-
-/*
- * Allow MAC policy modules to register during boot, etc.
- */
-int
-mac_policy_modevent(module_t mod, int type, void *data)
-{
- struct mac_policy_conf *mpc;
- int error;
-
- error = 0;
- mpc = (struct mac_policy_conf *) data;
-
-#ifdef MAC_STATIC
- if (mac_late) {
- printf("mac_policy_modevent: MAC_STATIC and late\n");
- return (EBUSY);
- }
-#endif
-
- switch (type) {
- case MOD_LOAD:
- if (mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_NOTLATE &&
- mac_late) {
- printf("mac_policy_modevent: can't load %s policy "
- "after booting\n", mpc->mpc_name);
- error = EBUSY;
- break;
- }
- error = mac_policy_register(mpc);
- break;
- case MOD_UNLOAD:
- /* Don't unregister the module if it was never registered. */
- if ((mpc->mpc_runtime_flags & MPC_RUNTIME_FLAG_REGISTERED)
- != 0)
- error = mac_policy_unregister(mpc);
- else
- error = 0;
- break;
- default:
- error = EOPNOTSUPP;
- break;
- }
-
- return (error);
-}
-
-static int
-mac_policy_register(struct mac_policy_conf *mpc)
-{
- struct mac_policy_conf *tmpc;
- int error, slot, static_entry;
-
- error = 0;
-
- /*
- * We don't technically need exclusive access while !mac_late,
- * but hold it for assertion consistency.
- */
- mac_policy_grab_exclusive();
-
- /*
- * If the module can potentially be unloaded, or we're loading
- * late, we have to stick it in the non-static list and pay
- * an extra performance overhead. Otherwise, we can pay a
- * light locking cost and stick it in the static list.
- */
- static_entry = (!mac_late &&
- !(mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_UNLOADOK));
-
- if (static_entry) {
- LIST_FOREACH(tmpc, &mac_static_policy_list, mpc_list) {
- if (strcmp(tmpc->mpc_name, mpc->mpc_name) == 0) {
- error = EEXIST;
- goto out;
- }
- }
- } else {
- LIST_FOREACH(tmpc, &mac_policy_list, mpc_list) {
- if (strcmp(tmpc->mpc_name, mpc->mpc_name) == 0) {
- error = EEXIST;
- goto out;
- }
- }
- }
- if (mpc->mpc_field_off != NULL) {
- slot = ffs(mac_slot_offsets_free);
- if (slot == 0) {
- error = ENOMEM;
- goto out;
- }
- slot--;
- mac_slot_offsets_free &= ~(1 << slot);
- *mpc->mpc_field_off = slot;
- }
- mpc->mpc_runtime_flags |= MPC_RUNTIME_FLAG_REGISTERED;
-
- /*
- * If we're loading a MAC module after the framework has
- * initialized, it has to go into the dynamic list. If
- * we're loading it before we've finished initializing,
- * it can go into the static list with weaker locker
- * requirements.
- */
- if (static_entry)
- LIST_INSERT_HEAD(&mac_static_policy_list, mpc, mpc_list);
- else
- LIST_INSERT_HEAD(&mac_policy_list, mpc, mpc_list);
-
- /* Per-policy initialization. */
- if (mpc->mpc_ops->mpo_init != NULL)
- (*(mpc->mpc_ops->mpo_init))(mpc);
- mac_policy_updateflags();
-
- printf("Security policy loaded: %s (%s)\n", mpc->mpc_fullname,
- mpc->mpc_name);
-
-out:
- mac_policy_release_exclusive();
- return (error);
-}
-
-static int
-mac_policy_unregister(struct mac_policy_conf *mpc)
-{
-
- /*
- * If we fail the load, we may get a request to unload. Check
- * to see if we did the run-time registration, and if not,
- * silently succeed.
- */
- mac_policy_grab_exclusive();
- if ((mpc->mpc_runtime_flags & MPC_RUNTIME_FLAG_REGISTERED) == 0) {
- mac_policy_release_exclusive();
- return (0);
- }
-#if 0
- /*
- * Don't allow unloading modules with private data.
- */
- if (mpc->mpc_field_off != NULL) {
- MAC_POLICY_LIST_UNLOCK();
- return (EBUSY);
- }
-#endif
- /*
- * Only allow the unload to proceed if the module is unloadable
- * by its own definition.
- */
- if ((mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_UNLOADOK) == 0) {
- mac_policy_release_exclusive();
- return (EBUSY);
- }
- if (mpc->mpc_ops->mpo_destroy != NULL)
- (*(mpc->mpc_ops->mpo_destroy))(mpc);
-
- LIST_REMOVE(mpc, mpc_list);
- mpc->mpc_runtime_flags &= ~MPC_RUNTIME_FLAG_REGISTERED;
- mac_policy_updateflags();
-
- mac_policy_release_exclusive();
-
- printf("Security policy unload: %s (%s)\n", mpc->mpc_fullname,
- mpc->mpc_name);
-
- return (0);
-}
-
-/*
- * Define an error value precedence, and given two arguments, selects the
- * value with the higher precedence.
- */
-int
-mac_error_select(int error1, int error2)
-{
-
- /* Certain decision-making errors take top priority. */
- if (error1 == EDEADLK || error2 == EDEADLK)
- return (EDEADLK);
-
- /* Invalid arguments should be reported where possible. */
- if (error1 == EINVAL || error2 == EINVAL)
- return (EINVAL);
-
- /* Precedence goes to "visibility", with both process and file. */
- if (error1 == ESRCH || error2 == ESRCH)
- return (ESRCH);
-
- if (error1 == ENOENT || error2 == ENOENT)
- return (ENOENT);
-
- /* Precedence goes to DAC/MAC protections. */
- if (error1 == EACCES || error2 == EACCES)
- return (EACCES);
-
- /* Precedence goes to privilege. */
- if (error1 == EPERM || error2 == EPERM)
- return (EPERM);
-
- /* Precedence goes to error over success; otherwise, arbitrary. */
- if (error1 != 0)
- return (error1);
- return (error2);
-}
-
-void
-mac_init_label(struct label *label)
-{
-
- bzero(label, sizeof(*label));
- label->l_flags = MAC_FLAG_INITIALIZED;
-}
-
-void
-mac_destroy_label(struct label *label)
-{
-
- KASSERT(label->l_flags & MAC_FLAG_INITIALIZED,
- ("destroying uninitialized label"));
-
- bzero(label, sizeof(*label));
- /* implicit: label->l_flags &= ~MAC_FLAG_INITIALIZED; */
-}
-
-int
-mac_check_structmac_consistent(struct mac *mac)
-{
-
- if (mac->m_buflen < 0 ||
- mac->m_buflen > MAC_MAX_LABEL_BUF_LEN)
- return (EINVAL);
-
- return (0);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap)
-{
- char *elements, *buffer;
- struct mac mac;
- struct proc *tproc;
- struct ucred *tcred;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- tproc = pfind(uap->pid);
- if (tproc == NULL)
- return (ESRCH);
-
- tcred = NULL; /* Satisfy gcc. */
- error = p_cansee(td, tproc);
- if (error == 0)
- tcred = crhold(tproc->p_ucred);
- PROC_UNLOCK(tproc);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- crfree(tcred);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- error = mac_externalize_cred_label(tcred->cr_label, elements,
- buffer, mac.m_buflen);
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
- crfree(tcred);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap)
-{
- char *elements, *buffer;
- struct mac mac;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- error = mac_externalize_cred_label(td->td_ucred->cr_label,
- elements, buffer, mac.m_buflen);
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap)
-{
- struct ucred *newcred, *oldcred;
- struct label *intlabel;
- struct proc *p;
- struct mac mac;
- char *buffer;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL);
- if (error) {
- free(buffer, M_MACTEMP);
- return (error);
- }
-
- intlabel = mac_cred_label_alloc();
- error = mac_internalize_cred_label(intlabel, buffer);
- free(buffer, M_MACTEMP);
- if (error)
- goto out;
-
- newcred = crget();
-
- p = td->td_proc;
- PROC_LOCK(p);
- oldcred = p->p_ucred;
-
- error = mac_check_cred_relabel(oldcred, intlabel);
- if (error) {
- PROC_UNLOCK(p);
- crfree(newcred);
- goto out;
- }
-
- setsugid(p);
- crcopy(newcred, oldcred);
- mac_relabel_cred(newcred, intlabel);
- p->p_ucred = newcred;
-
- /*
- * Grab additional reference for use while revoking mmaps, prior
- * to releasing the proc lock and sharing the cred.
- */
- crhold(newcred);
- PROC_UNLOCK(p);
-
- if (mac_enforce_vm) {
- mtx_lock(&Giant);
- mac_cred_mmapped_drop_perms(td, newcred);
- mtx_unlock(&Giant);
- }
-
- crfree(newcred); /* Free revocation reference. */
- crfree(oldcred);
-
-out:
- mac_cred_label_free(intlabel);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
-{
- char *elements, *buffer;
- struct label *intlabel;
- struct file *fp;
- struct mac mac;
- struct vnode *vp;
- struct pipe *pipe;
- struct socket *so;
- short label_type;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- error = fget(td, uap->fd, &fp);
- if (error)
- goto out;
-
- label_type = fp->f_type;
- switch (fp->f_type) {
- case DTYPE_FIFO:
- case DTYPE_VNODE:
- vp = fp->f_vnode;
- intlabel = mac_vnode_label_alloc();
- mtx_lock(&Giant); /* VFS */
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- mac_copy_vnode_label(vp->v_label, intlabel);
- VOP_UNLOCK(vp, 0, td);
- mtx_unlock(&Giant); /* VFS */
- error = mac_externalize_vnode_label(intlabel, elements,
- buffer, mac.m_buflen);
- mac_vnode_label_free(intlabel);
- break;
-
- case DTYPE_PIPE:
- pipe = fp->f_data;
- intlabel = mac_pipe_label_alloc();
- PIPE_LOCK(pipe);
- mac_copy_pipe_label(pipe->pipe_pair->pp_label, intlabel);
- PIPE_UNLOCK(pipe);
- error = mac_externalize_pipe_label(intlabel, elements,
- buffer, mac.m_buflen);
- mac_pipe_label_free(intlabel);
- break;
-
- case DTYPE_SOCKET:
- so = fp->f_data;
- intlabel = mac_socket_label_alloc(M_WAITOK);
- NET_LOCK_GIANT();
- SOCK_LOCK(so);
- mac_copy_socket_label(so->so_label, intlabel);
- SOCK_UNLOCK(so);
- NET_UNLOCK_GIANT();
- error = mac_externalize_socket_label(intlabel, elements,
- buffer, mac.m_buflen);
- mac_socket_label_free(intlabel);
- break;
-
- default:
- error = EINVAL;
- }
- fdrop(fp, td);
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
-out:
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_file(struct thread *td, struct __mac_get_file_args *uap)
-{
- char *elements, *buffer;
- struct nameidata nd;
- struct label *intlabel;
- struct mac mac;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- mtx_lock(&Giant); /* VFS */
- NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p,
- td);
- error = namei(&nd);
- if (error)
- goto out;
-
- intlabel = mac_vnode_label_alloc();
- mac_copy_vnode_label(nd.ni_vp->v_label, intlabel);
- error = mac_externalize_vnode_label(intlabel, elements, buffer,
- mac.m_buflen);
-
- NDFREE(&nd, 0);
- mac_vnode_label_free(intlabel);
-
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
-out:
- mtx_unlock(&Giant); /* VFS */
-
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
-
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_link(struct thread *td, struct __mac_get_link_args *uap)
-{
- char *elements, *buffer;
- struct nameidata nd;
- struct label *intlabel;
- struct mac mac;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- mtx_lock(&Giant); /* VFS */
- NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p,
- td);
- error = namei(&nd);
- if (error)
- goto out;
-
- intlabel = mac_vnode_label_alloc();
- mac_copy_vnode_label(nd.ni_vp->v_label, intlabel);
- error = mac_externalize_vnode_label(intlabel, elements, buffer,
- mac.m_buflen);
- NDFREE(&nd, 0);
- mac_vnode_label_free(intlabel);
-
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
-out:
- mtx_unlock(&Giant); /* VFS */
-
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
-
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
-{
- struct label *intlabel;
- struct pipe *pipe;
- struct socket *so;
- struct file *fp;
- struct mount *mp;
- struct vnode *vp;
- struct mac mac;
- char *buffer;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL);
- if (error) {
- free(buffer, M_MACTEMP);
- return (error);
- }
-
- error = fget(td, uap->fd, &fp);
- if (error)
- goto out;
-
- switch (fp->f_type) {
- case DTYPE_FIFO:
- case DTYPE_VNODE:
- intlabel = mac_vnode_label_alloc();
- error = mac_internalize_vnode_label(intlabel, buffer);
- if (error) {
- mac_vnode_label_free(intlabel);
- break;
- }
- vp = fp->f_vnode;
- mtx_lock(&Giant); /* VFS */
- error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
- if (error != 0) {
- mtx_unlock(&Giant); /* VFS */
- mac_vnode_label_free(intlabel);
- break;
- }
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = vn_setlabel(vp, intlabel, td->td_ucred);
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- mtx_unlock(&Giant); /* VFS */
- mac_vnode_label_free(intlabel);
- break;
-
- case DTYPE_PIPE:
- intlabel = mac_pipe_label_alloc();
- error = mac_internalize_pipe_label(intlabel, buffer);
- if (error == 0) {
- pipe = fp->f_data;
- PIPE_LOCK(pipe);
- error = mac_pipe_label_set(td->td_ucred,
- pipe->pipe_pair, intlabel);
- PIPE_UNLOCK(pipe);
- }
- mac_pipe_label_free(intlabel);
- break;
-
- case DTYPE_SOCKET:
- intlabel = mac_socket_label_alloc(M_WAITOK);
- error = mac_internalize_socket_label(intlabel, buffer);
- if (error == 0) {
- so = fp->f_data;
- NET_LOCK_GIANT();
- error = mac_socket_label_set(td->td_ucred, so,
- intlabel);
- NET_UNLOCK_GIANT();
- }
- mac_socket_label_free(intlabel);
- break;
-
- default:
- error = EINVAL;
- }
- fdrop(fp, td);
-out:
- free(buffer, M_MACTEMP);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_set_file(struct thread *td, struct __mac_set_file_args *uap)
-{
- struct label *intlabel;
- struct nameidata nd;
- struct mount *mp;
- struct mac mac;
- char *buffer;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL);
- if (error) {
- free(buffer, M_MACTEMP);
- return (error);
- }
-
- intlabel = mac_vnode_label_alloc();
- error = mac_internalize_vnode_label(intlabel, buffer);
- free(buffer, M_MACTEMP);
- if (error)
- goto out;
-
- mtx_lock(&Giant); /* VFS */
-
- NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p,
- td);
- error = namei(&nd);
- if (error == 0) {
- error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH);
- if (error == 0)
- error = vn_setlabel(nd.ni_vp, intlabel,
- td->td_ucred);
- vn_finished_write(mp);
- }
-
- NDFREE(&nd, 0);
- mtx_unlock(&Giant); /* VFS */
-out:
- mac_vnode_label_free(intlabel);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_set_link(struct thread *td, struct __mac_set_link_args *uap)
-{
- struct label *intlabel;
- struct nameidata nd;
- struct mount *mp;
- struct mac mac;
- char *buffer;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL);
- if (error) {
- free(buffer, M_MACTEMP);
- return (error);
- }
-
- intlabel = mac_vnode_label_alloc();
- error = mac_internalize_vnode_label(intlabel, buffer);
- free(buffer, M_MACTEMP);
- if (error)
- goto out;
-
- mtx_lock(&Giant); /* VFS */
-
- NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p,
- td);
- error = namei(&nd);
- if (error == 0) {
- error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH);
- if (error == 0)
- error = vn_setlabel(nd.ni_vp, intlabel,
- td->td_ucred);
- vn_finished_write(mp);
- }
-
- NDFREE(&nd, 0);
- mtx_unlock(&Giant); /* VFS */
-out:
- mac_vnode_label_free(intlabel);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-mac_syscall(struct thread *td, struct mac_syscall_args *uap)
-{
- struct mac_policy_conf *mpc;
- char target[MAC_MAX_POLICY_NAME];
- int entrycount, error;
-
- error = copyinstr(uap->policy, target, sizeof(target), NULL);
- if (error)
- return (error);
-
- error = ENOSYS;
- LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) {
- if (strcmp(mpc->mpc_name, target) == 0 &&
- mpc->mpc_ops->mpo_syscall != NULL) {
- error = mpc->mpc_ops->mpo_syscall(td,
- uap->call, uap->arg);
- goto out;
- }
- }
-
- if ((entrycount = mac_policy_list_conditional_busy()) != 0) {
- LIST_FOREACH(mpc, &mac_policy_list, mpc_list) {
- if (strcmp(mpc->mpc_name, target) == 0 &&
- mpc->mpc_ops->mpo_syscall != NULL) {
- error = mpc->mpc_ops->mpo_syscall(td,
- uap->call, uap->arg);
- break;
- }
- }
- mac_policy_list_unbusy();
- }
-out:
- return (error);
-}
-
-SYSINIT(mac, SI_SUB_MAC, SI_ORDER_FIRST, mac_init, NULL);
-SYSINIT(mac_late, SI_SUB_MAC_LATE, SI_ORDER_FIRST, mac_late_init, NULL);
-
-#else /* !MAC */
-
-int
-__mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_get_file(struct thread *td, struct __mac_get_file_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_get_link(struct thread *td, struct __mac_get_link_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_set_file(struct thread *td, struct __mac_set_file_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_set_link(struct thread *td, struct __mac_set_link_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-mac_syscall(struct thread *td, struct mac_syscall_args *uap)
-{
-
- return (ENOSYS);
-}
-
-#endif /* !MAC */
diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h
deleted file mode 100644
index 810c320..0000000
--- a/sys/security/mac/mac_framework.h
+++ /dev/null
@@ -1,476 +0,0 @@
-/*-
- * Copyright (c) 1999-2002 Robert N. M. Watson
- * Copyright (c) 2001-2005 Networks Associates Technology, Inc.
- * Copyright (c) 2005 SPARTA, Inc.
- * All rights reserved.
- *
- * This software was developed by Robert Watson for the TrustedBSD Project.
- *
- * This software was developed for the FreeBSD Project in part by Network
- * Associates Laboratories, the Security Research Division of Network
- * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
- * as part of the DARPA CHATS research program.
- *
- * This software was enhanced by SPARTA ISSO under SPAWAR contract
- * N66001-04-C-6019 ("SEFOS").
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-/*
- * Userland/kernel interface for Mandatory Access Control.
- *
- * The POSIX.1e implementation page may be reached at:
- * http://www.trustedbsd.org/
- */
-
-#ifndef _SYS_MAC_H_
-#define _SYS_MAC_H_
-
-#include <sys/_label.h>
-
-#ifndef _POSIX_MAC
-#define _POSIX_MAC
-#endif
-
-/*
- * MAC framework-related constants and limits.
- */
-#define MAC_MAX_POLICY_NAME 32
-#define MAC_MAX_LABEL_ELEMENT_NAME 32
-#define MAC_MAX_LABEL_ELEMENT_DATA 4096
-#define MAC_MAX_LABEL_BUF_LEN 8192
-
-struct mac {
- size_t m_buflen;
- char *m_string;
-};
-
-typedef struct mac *mac_t;
-
-#ifndef _KERNEL
-
-/*
- * Location of the userland MAC framework configuration file. mac.conf
- * binds policy names to shared libraries that understand those policies,
- * as well as setting defaults for MAC-aware applications.
- */
-#define MAC_CONFFILE "/etc/mac.conf"
-
-/*
- * Extended non-POSIX.1e interfaces that offer additional services
- * available from the userland and kernel MAC frameworks.
- */
-__BEGIN_DECLS
-int mac_execve(char *fname, char **argv, char **envv, mac_t _label);
-int mac_free(mac_t _label);
-int mac_from_text(mac_t *_label, const char *_text);
-int mac_get_fd(int _fd, mac_t _label);
-int mac_get_file(const char *_path, mac_t _label);
-int mac_get_link(const char *_path, mac_t _label);
-int mac_get_peer(int _fd, mac_t _label);
-int mac_get_pid(pid_t _pid, mac_t _label);
-int mac_get_proc(mac_t _label);
-int mac_is_present(const char *_policyname);
-int mac_prepare(mac_t *_label, const char *_elements);
-int mac_prepare_file_label(mac_t *_label);
-int mac_prepare_ifnet_label(mac_t *_label);
-int mac_prepare_process_label(mac_t *_label);
-int mac_prepare_type(mac_t *_label, const char *_type);
-int mac_set_fd(int _fildes, const mac_t _label);
-int mac_set_file(const char *_path, mac_t _label);
-int mac_set_link(const char *_path, mac_t _label);
-int mac_set_proc(const mac_t _label);
-int mac_syscall(const char *_policyname, int _call, void *_arg);
-int mac_to_text(mac_t mac, char **_text);
-__END_DECLS
-
-#else /* _KERNEL */
-
-/*
- * Kernel functions to manage and evaluate labels.
- */
-struct bpf_d;
-struct cdev;
-struct componentname;
-struct devfs_dirent;
-struct ifnet;
-struct ifreq;
-struct inpcb;
-struct image_params;
-struct inpcb;
-struct ipq;
-struct ksem;
-struct m_tag;
-struct mbuf;
-struct mount;
-struct msg;
-struct msqid_kernel;
-struct proc;
-struct semid_kernel;
-struct shmid_kernel;
-struct sockaddr;
-struct socket;
-struct sysctl_oid;
-struct sysctl_req;
-struct pipepair;
-struct thread;
-struct timespec;
-struct ucred;
-struct uio;
-struct vattr;
-struct vnode;
-
-#include <sys/acl.h> /* XXX acl_type_t */
-
-struct vop_setlabel_args;
-
-/*
- * Label operations.
- */
-void mac_init_bpfdesc(struct bpf_d *);
-void mac_init_cred(struct ucred *);
-void mac_init_devfsdirent(struct devfs_dirent *);
-void mac_init_ifnet(struct ifnet *);
-int mac_init_inpcb(struct inpcb *, int flag);
-void mac_init_sysv_msgmsg(struct msg *);
-void mac_init_sysv_msgqueue(struct msqid_kernel*);
-void mac_init_sysv_sem(struct semid_kernel*);
-void mac_init_sysv_shm(struct shmid_kernel*);
-int mac_init_ipq(struct ipq *, int flag);
-int mac_init_socket(struct socket *, int flag);
-void mac_init_pipe(struct pipepair *);
-void mac_init_posix_sem(struct ksem *);
-int mac_init_mbuf(struct mbuf *mbuf, int flag);
-int mac_init_mbuf_tag(struct m_tag *, int flag);
-void mac_init_mount(struct mount *);
-void mac_init_proc(struct proc *);
-void mac_init_vnode(struct vnode *);
-void mac_copy_mbuf(struct mbuf *m_from, struct mbuf *m_to);
-void mac_copy_mbuf_tag(struct m_tag *, struct m_tag *);
-void mac_copy_vnode_label(struct label *, struct label *label);
-void mac_destroy_bpfdesc(struct bpf_d *);
-void mac_destroy_cred(struct ucred *);
-void mac_destroy_devfsdirent(struct devfs_dirent *);
-void mac_destroy_ifnet(struct ifnet *);
-void mac_destroy_inpcb(struct inpcb *);
-void mac_destroy_sysv_msgmsg(struct msg *);
-void mac_destroy_sysv_msgqueue(struct msqid_kernel *);
-void mac_destroy_sysv_sem(struct semid_kernel *);
-void mac_destroy_sysv_shm(struct shmid_kernel *);
-void mac_destroy_ipq(struct ipq *);
-void mac_destroy_socket(struct socket *);
-void mac_destroy_pipe(struct pipepair *);
-void mac_destroy_posix_sem(struct ksem *);
-void mac_destroy_proc(struct proc *);
-void mac_destroy_mbuf_tag(struct m_tag *);
-void mac_destroy_mount(struct mount *);
-void mac_destroy_vnode(struct vnode *);
-
-struct label *mac_cred_label_alloc(void);
-void mac_cred_label_free(struct label *label);
-struct label *mac_vnode_label_alloc(void);
-void mac_vnode_label_free(struct label *label);
-
-/*
- * Labeling event operations: file system objects, and things that
- * look a lot like file system objects.
- */
-void mac_associate_vnode_devfs(struct mount *mp, struct devfs_dirent *de,
- struct vnode *vp);
-int mac_associate_vnode_extattr(struct mount *mp, struct vnode *vp);
-void mac_associate_vnode_singlelabel(struct mount *mp, struct vnode *vp);
-void mac_create_devfs_device(struct mount *mp, struct cdev *dev,
- struct devfs_dirent *de);
-void mac_create_devfs_directory(struct mount *mp, char *dirname,
- int dirnamelen, struct devfs_dirent *de);
-void mac_create_devfs_symlink(struct ucred *cred, struct mount *mp,
- struct devfs_dirent *dd, struct devfs_dirent *de);
-int mac_create_vnode_extattr(struct ucred *cred, struct mount *mp,
- struct vnode *dvp, struct vnode *vp, struct componentname *cnp);
-void mac_create_mount(struct ucred *cred, struct mount *mp);
-void mac_create_root_mount(struct ucred *cred, struct mount *mp);
-void mac_relabel_vnode(struct ucred *cred, struct vnode *vp,
- struct label *newlabel);
-void mac_update_devfsdirent(struct mount *mp, struct devfs_dirent *de,
- struct vnode *vp);
-
-/*
- * Labeling event operations: IPC objects.
- */
-void mac_create_mbuf_from_socket(struct socket *so, struct mbuf *m);
-void mac_create_socket(struct ucred *cred, struct socket *socket);
-void mac_create_socket_from_socket(struct socket *oldsocket,
- struct socket *newsocket);
-void mac_set_socket_peer_from_mbuf(struct mbuf *mbuf,
- struct socket *socket);
-void mac_set_socket_peer_from_socket(struct socket *oldsocket,
- struct socket *newsocket);
-void mac_create_pipe(struct ucred *cred, struct pipepair *pp);
-
-/*
- * Labeling event operations: System V IPC primitives
- */
-void mac_create_sysv_msgmsg(struct ucred *cred,
- struct msqid_kernel *msqkptr, struct msg *msgptr);
-void mac_create_sysv_msgqueue(struct ucred *cred,
- struct msqid_kernel *msqkptr);
-void mac_create_sysv_sem(struct ucred *cred,
- struct semid_kernel *semakptr);
-void mac_create_sysv_shm(struct ucred *cred,
- struct shmid_kernel *shmsegptr);
-
-/*
- * Labeling event operations: POSIX (global/inter-process) semaphores.
- */
-void mac_create_posix_sem(struct ucred *cred, struct ksem *ksemptr);
-
-
-/*
- * Labeling event operations: network objects.
- */
-void mac_create_bpfdesc(struct ucred *cred, struct bpf_d *bpf_d);
-void mac_create_ifnet(struct ifnet *ifp);
-void mac_create_inpcb_from_socket(struct socket *so, struct inpcb *inp);
-void mac_create_ipq(struct mbuf *fragment, struct ipq *ipq);
-void mac_create_datagram_from_ipq(struct ipq *ipq, struct mbuf *datagram);
-void mac_create_fragment(struct mbuf *datagram, struct mbuf *fragment);
-void mac_create_mbuf_from_inpcb(struct inpcb *inp, struct mbuf *m);
-void mac_create_mbuf_linklayer(struct ifnet *ifnet, struct mbuf *m);
-void mac_create_mbuf_from_bpfdesc(struct bpf_d *bpf_d, struct mbuf *m);
-void mac_create_mbuf_from_ifnet(struct ifnet *ifnet, struct mbuf *m);
-void mac_create_mbuf_multicast_encap(struct mbuf *oldmbuf,
- struct ifnet *ifnet, struct mbuf *newmbuf);
-void mac_create_mbuf_netlayer(struct mbuf *oldmbuf, struct mbuf *newmbuf);
-int mac_fragment_match(struct mbuf *fragment, struct ipq *ipq);
-void mac_reflect_mbuf_icmp(struct mbuf *m);
-void mac_reflect_mbuf_tcp(struct mbuf *m);
-void mac_update_ipq(struct mbuf *fragment, struct ipq *ipq);
-void mac_inpcb_sosetlabel(struct socket *so, struct inpcb *inp);
-
-/*
- * Labeling event operations: processes.
- */
-void mac_copy_cred(struct ucred *cr1, struct ucred *cr2);
-int mac_execve_enter(struct image_params *imgp, struct mac *mac_p);
-void mac_execve_exit(struct image_params *imgp);
-void mac_execve_transition(struct ucred *old, struct ucred *new,
- struct vnode *vp, struct label *interpvnodelabel,
- struct image_params *imgp);
-int mac_execve_will_transition(struct ucred *old, struct vnode *vp,
- struct label *interpvnodelabel, struct image_params *imgp);
-void mac_create_proc0(struct ucred *cred);
-void mac_create_proc1(struct ucred *cred);
-void mac_thread_userret(struct thread *td);
-
-/*
- * Label cleanup operation: This is the inverse complement for the
- * mac_create and associate type of hooks. This hook lets the policy
- * module(s) perform a cleanup/flushing operation on the label
- * associated with the objects, without freeing up the space allocated.
- * This hook is useful in cases where it is desirable to remove any
- * labeling reference when recycling any object to a pool. This hook
- * does not replace the mac_destroy hooks.
- */
-void mac_cleanup_sysv_msgmsg(struct msg *msgptr);
-void mac_cleanup_sysv_msgqueue(struct msqid_kernel *msqkptr);
-void mac_cleanup_sysv_sem(struct semid_kernel *semakptr);
-void mac_cleanup_sysv_shm(struct shmid_kernel *shmsegptr);
-
-/* Access control checks. */
-int mac_check_bpfdesc_receive(struct bpf_d *bpf_d, struct ifnet *ifnet);
-int mac_check_cred_visible(struct ucred *u1, struct ucred *u2);
-int mac_check_ifnet_transmit(struct ifnet *ifnet, struct mbuf *m);
-int mac_check_inpcb_deliver(struct inpcb *inp, struct mbuf *m);
-int mac_check_sysv_msgmsq(struct ucred *cred, struct msg *msgptr,
- struct msqid_kernel *msqkptr);
-int mac_check_sysv_msgrcv(struct ucred *cred, struct msg *msgptr);
-int mac_check_sysv_msgrmid(struct ucred *cred, struct msg *msgptr);
-int mac_check_sysv_msqget(struct ucred *cred,
- struct msqid_kernel *msqkptr);
-int mac_check_sysv_msqsnd(struct ucred *cred,
- struct msqid_kernel *msqkptr);
-int mac_check_sysv_msqrcv(struct ucred *cred,
- struct msqid_kernel *msqkptr);
-int mac_check_sysv_msqctl(struct ucred *cred,
- struct msqid_kernel *msqkptr, int cmd);
-int mac_check_sysv_semctl(struct ucred *cred,
- struct semid_kernel *semakptr, int cmd);
-int mac_check_sysv_semget(struct ucred *cred,
- struct semid_kernel *semakptr);
-int mac_check_sysv_semop(struct ucred *cred,struct semid_kernel *semakptr,
- size_t accesstype);
-int mac_check_sysv_shmat(struct ucred *cred,
- struct shmid_kernel *shmsegptr, int shmflg);
-int mac_check_sysv_shmctl(struct ucred *cred,
- struct shmid_kernel *shmsegptr, int cmd);
-int mac_check_sysv_shmdt(struct ucred *cred,
- struct shmid_kernel *shmsegptr);
-int mac_check_sysv_shmget(struct ucred *cred,
- struct shmid_kernel *shmsegptr, int shmflg);
-int mac_check_kenv_dump(struct ucred *cred);
-int mac_check_kenv_get(struct ucred *cred, char *name);
-int mac_check_kenv_set(struct ucred *cred, char *name, char *value);
-int mac_check_kenv_unset(struct ucred *cred, char *name);
-int mac_check_kld_load(struct ucred *cred, struct vnode *vp);
-int mac_check_kld_stat(struct ucred *cred);
-int mac_check_kld_unload(struct ucred *cred);
-int mac_check_mount_stat(struct ucred *cred, struct mount *mp);
-int mac_check_pipe_ioctl(struct ucred *cred, struct pipepair *pp,
- unsigned long cmd, void *data);
-int mac_check_pipe_poll(struct ucred *cred, struct pipepair *pp);
-int mac_check_pipe_read(struct ucred *cred, struct pipepair *pp);
-int mac_check_pipe_stat(struct ucred *cred, struct pipepair *pp);
-int mac_check_pipe_write(struct ucred *cred, struct pipepair *pp);
-int mac_check_posix_sem_destroy(struct ucred *cred, struct ksem *ksemptr);
-int mac_check_posix_sem_getvalue(struct ucred *cred,struct ksem *ksemptr);
-int mac_check_posix_sem_open(struct ucred *cred, struct ksem *ksemptr);
-int mac_check_posix_sem_post(struct ucred *cred, struct ksem *ksemptr);
-int mac_check_posix_sem_unlink(struct ucred *cred, struct ksem *ksemptr);
-int mac_check_posix_sem_wait(struct ucred *cred, struct ksem *ksemptr);
-int mac_check_proc_debug(struct ucred *cred, struct proc *proc);
-int mac_check_proc_sched(struct ucred *cred, struct proc *proc);
-int mac_check_proc_setuid(struct proc *proc, struct ucred *cred,
- uid_t uid);
-int mac_check_proc_seteuid(struct proc *proc, struct ucred *cred,
- uid_t euid);
-int mac_check_proc_setgid(struct proc *proc, struct ucred *cred,
- gid_t gid);
-int mac_check_proc_setegid(struct proc *proc, struct ucred *cred,
- gid_t egid);
-int mac_check_proc_setgroups(struct proc *proc, struct ucred *cred,
- int ngroups, gid_t *gidset);
-int mac_check_proc_setreuid(struct proc *proc, struct ucred *cred,
- uid_t ruid, uid_t euid);
-int mac_check_proc_setregid(struct proc *proc, struct ucred *cred,
- gid_t rgid, gid_t egid);
-int mac_check_proc_setresuid(struct proc *proc, struct ucred *cred,
- uid_t ruid, uid_t euid, uid_t suid);
-int mac_check_proc_setresgid(struct proc *proc, struct ucred *cred,
- gid_t rgid, gid_t egid, gid_t sgid);
-int mac_check_proc_signal(struct ucred *cred, struct proc *proc,
- int signum);
-int mac_check_proc_wait(struct ucred *cred, struct proc *proc);
-int mac_check_socket_accept(struct ucred *cred, struct socket *so);
-int mac_check_socket_bind(struct ucred *cred, struct socket *so,
- struct sockaddr *sockaddr);
-int mac_check_socket_connect(struct ucred *cred, struct socket *so,
- struct sockaddr *sockaddr);
-int mac_check_socket_create(struct ucred *cred, int domain, int type,
- int protocol);
-int mac_check_socket_deliver(struct socket *so, struct mbuf *m);
-int mac_check_socket_listen(struct ucred *cred, struct socket *so);
-int mac_check_socket_poll(struct ucred *cred, struct socket *so);
-int mac_check_socket_receive(struct ucred *cred, struct socket *so);
-int mac_check_socket_send(struct ucred *cred, struct socket *so);
-int mac_check_socket_stat(struct ucred *cred, struct socket *so);
-int mac_check_socket_visible(struct ucred *cred, struct socket *so);
-int mac_check_sysarch_ioperm(struct ucred *cred);
-int mac_check_system_acct(struct ucred *cred, struct vnode *vp);
-int mac_check_system_nfsd(struct ucred *cred);
-int mac_check_system_reboot(struct ucred *cred, int howto);
-int mac_check_system_settime(struct ucred *cred);
-int mac_check_system_swapon(struct ucred *cred, struct vnode *vp);
-int mac_check_system_swapoff(struct ucred *cred, struct vnode *vp);
-int mac_check_system_sysctl(struct ucred *cred, struct sysctl_oid *oidp,
- void *arg1, int arg2, struct sysctl_req *req);
-int mac_check_vnode_access(struct ucred *cred, struct vnode *vp,
- int acc_mode);
-int mac_check_vnode_chdir(struct ucred *cred, struct vnode *dvp);
-int mac_check_vnode_chroot(struct ucred *cred, struct vnode *dvp);
-int mac_check_vnode_create(struct ucred *cred, struct vnode *dvp,
- struct componentname *cnp, struct vattr *vap);
-int mac_check_vnode_delete(struct ucred *cred, struct vnode *dvp,
- struct vnode *vp, struct componentname *cnp);
-int mac_check_vnode_deleteacl(struct ucred *cred, struct vnode *vp,
- acl_type_t type);
-int mac_check_vnode_deleteextattr(struct ucred *cred, struct vnode *vp,
- int attrnamespace, const char *name);
-int mac_check_vnode_exec(struct ucred *cred, struct vnode *vp,
- struct image_params *imgp);
-int mac_check_vnode_getacl(struct ucred *cred, struct vnode *vp,
- acl_type_t type);
-int mac_check_vnode_getextattr(struct ucred *cred, struct vnode *vp,
- int attrnamespace, const char *name, struct uio *uio);
-int mac_check_vnode_link(struct ucred *cred, struct vnode *dvp,
- struct vnode *vp, struct componentname *cnp);
-int mac_check_vnode_listextattr(struct ucred *cred, struct vnode *vp,
- int attrnamespace);
-int mac_check_vnode_lookup(struct ucred *cred, struct vnode *dvp,
- struct componentname *cnp);
-int mac_check_vnode_mmap(struct ucred *cred, struct vnode *vp,
- int prot, int flags);
-int mac_check_vnode_mprotect(struct ucred *cred, struct vnode *vp,
- int prot);
-int mac_check_vnode_open(struct ucred *cred, struct vnode *vp,
- int acc_mode);
-int mac_check_vnode_poll(struct ucred *active_cred,
- struct ucred *file_cred, struct vnode *vp);
-int mac_check_vnode_read(struct ucred *active_cred,
- struct ucred *file_cred, struct vnode *vp);
-int mac_check_vnode_readdir(struct ucred *cred, struct vnode *vp);
-int mac_check_vnode_readlink(struct ucred *cred, struct vnode *vp);
-int mac_check_vnode_rename_from(struct ucred *cred, struct vnode *dvp,
- struct vnode *vp, struct componentname *cnp);
-int mac_check_vnode_rename_to(struct ucred *cred, struct vnode *dvp,
- struct vnode *vp, int samedir, struct componentname *cnp);
-int mac_check_vnode_revoke(struct ucred *cred, struct vnode *vp);
-int mac_check_vnode_setacl(struct ucred *cred, struct vnode *vp,
- acl_type_t type, struct acl *acl);
-int mac_check_vnode_setextattr(struct ucred *cred, struct vnode *vp,
- int attrnamespace, const char *name, struct uio *uio);
-int mac_check_vnode_setflags(struct ucred *cred, struct vnode *vp,
- u_long flags);
-int mac_check_vnode_setmode(struct ucred *cred, struct vnode *vp,
- mode_t mode);
-int mac_check_vnode_setowner(struct ucred *cred, struct vnode *vp,
- uid_t uid, gid_t gid);
-int mac_check_vnode_setutimes(struct ucred *cred, struct vnode *vp,
- struct timespec atime, struct timespec mtime);
-int mac_check_vnode_stat(struct ucred *active_cred,
- struct ucred *file_cred, struct vnode *vp);
-int mac_check_vnode_write(struct ucred *active_cred,
- struct ucred *file_cred, struct vnode *vp);
-int mac_getsockopt_label(struct ucred *cred, struct socket *so,
- struct mac *extmac);
-int mac_getsockopt_peerlabel(struct ucred *cred, struct socket *so,
- struct mac *extmac);
-int mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr,
- struct ifnet *ifnet);
-int mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr,
- struct ifnet *ifnet);
-int mac_setsockopt_label(struct ucred *cred, struct socket *so,
- struct mac *extmac);
-int mac_pipe_label_set(struct ucred *cred, struct pipepair *pp,
- struct label *label);
-void mac_cred_mmapped_drop_perms(struct thread *td, struct ucred *cred);
-
-/*
- * Calls to help various file systems implement labeling functionality
- * using their existing EA implementation.
- */
-int vop_stdsetlabel_ea(struct vop_setlabel_args *ap);
-
-#endif /* !_KERNEL */
-
-#endif /* !_SYS_MAC_H_ */
diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h
deleted file mode 100644
index 6f10638..0000000
--- a/sys/security/mac/mac_policy.h
+++ /dev/null
@@ -1,625 +0,0 @@
-/*-
- * Copyright (c) 1999-2002 Robert N. M. Watson
- * Copyright (c) 2001-2005 Networks Associates Technology, Inc.
- * Copyright (c) 2005 SPARTA, Inc.
- * All rights reserved.
- *
- * This software was developed by Robert Watson for the TrustedBSD Project.
- *
- * This software was developed for the FreeBSD Project in part by Network
- * Associates Laboratories, the Security Research Division of Network
- * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
- * as part of the DARPA CHATS research program.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-/*
- * Kernel interface for MAC policy modules.
- */
-#ifndef _SYS_MAC_POLICY_H_
-#define _SYS_MAC_POLICY_H_
-
-/*-
- * Pluggable access control policy definition structure.
- *
- * List of operations that are performed as part of the implementation
- * of a MAC policy. Policy implementors declare operations with a
- * mac_policy_ops structure, and using the MAC_POLICY_SET() macro.
- * If an entry point is not declared, then then the policy will be ignored
- * during evaluation of that event or check.
- *
- * Operations are sorted first by general class of operation, then
- * alphabetically.
- */
-struct acl;
-struct bpf_d;
-struct componentname;
-struct devfs_dirent;
-struct ifnet;
-struct image_params;
-struct inpcb;
-struct ipq;
-struct ksem;
-struct label;
-struct mac_policy_conf;
-struct mbuf;
-struct mount;
-struct msqid_kernel;
-struct pipepair;
-struct proc;
-struct sbuf;
-struct semid_kernel;
-struct shmid_kernel;
-struct sockaddr;
-struct socket;
-struct sysctl_oid;
-struct sysctl_req;
-struct thread;
-struct ucred;
-struct uio;
-struct vattr;
-struct vnode;
-struct mac_policy_ops {
- /*
- * Policy module operations.
- */
- void (*mpo_destroy)(struct mac_policy_conf *mpc);
- void (*mpo_init)(struct mac_policy_conf *mpc);
-
- /*
- * General policy-directed security system call so that policies may
- * implement new services without reserving explicit system call
- * numbers.
- */
- int (*mpo_syscall)(struct thread *td, int call, void *arg);
-
- /*
- * Label operations. Initialize label storage, destroy label
- * storage, recycle for re-use without init/destroy, copy a label to
- * initialized storage, and externalize/internalize from/to
- * initialized storage.
- */
- void (*mpo_init_bpfdesc_label)(struct label *label);
- void (*mpo_init_cred_label)(struct label *label);
- void (*mpo_init_devfsdirent_label)(struct label *label);
- void (*mpo_init_ifnet_label)(struct label *label);
- int (*mpo_init_inpcb_label)(struct label *label, int flag);
- void (*mpo_init_sysv_msgmsg_label)(struct label *label);
- void (*mpo_init_sysv_msgqueue_label)(struct label *label);
- void (*mpo_init_sysv_sem_label)(struct label *label);
- void (*mpo_init_sysv_shm_label)(struct label *label);
- int (*mpo_init_ipq_label)(struct label *label, int flag);
- int (*mpo_init_mbuf_label)(struct label *label, int flag);
- void (*mpo_init_mount_label)(struct label *label);
- void (*mpo_init_mount_fs_label)(struct label *label);
- int (*mpo_init_socket_label)(struct label *label, int flag);
- int (*mpo_init_socket_peer_label)(struct label *label, int flag);
- void (*mpo_init_pipe_label)(struct label *label);
- void (*mpo_init_posix_sem_label)(struct label *label);
- void (*mpo_init_proc_label)(struct label *label);
- void (*mpo_init_vnode_label)(struct label *label);
- void (*mpo_destroy_bpfdesc_label)(struct label *label);
- void (*mpo_destroy_cred_label)(struct label *label);
- void (*mpo_destroy_devfsdirent_label)(struct label *label);
- void (*mpo_destroy_ifnet_label)(struct label *label);
- void (*mpo_destroy_inpcb_label)(struct label *label);
- void (*mpo_destroy_sysv_msgmsg_label)(struct label *label);
- void (*mpo_destroy_sysv_msgqueue_label)(struct label *label);
- void (*mpo_destroy_sysv_sem_label)(struct label *label);
- void (*mpo_destroy_sysv_shm_label)(struct label *label);
- void (*mpo_destroy_ipq_label)(struct label *label);
- void (*mpo_destroy_mbuf_label)(struct label *label);
- void (*mpo_destroy_mount_label)(struct label *label);
- void (*mpo_destroy_mount_fs_label)(struct label *label);
- void (*mpo_destroy_socket_label)(struct label *label);
- void (*mpo_destroy_socket_peer_label)(struct label *label);
- void (*mpo_destroy_pipe_label)(struct label *label);
- void (*mpo_destroy_posix_sem_label)(struct label *label);
- void (*mpo_destroy_proc_label)(struct label *label);
- void (*mpo_destroy_vnode_label)(struct label *label);
- void (*mpo_cleanup_sysv_msgmsg)(struct label *msglabel);
- void (*mpo_cleanup_sysv_msgqueue)(struct label *msqlabel);
- void (*mpo_cleanup_sysv_sem)(struct label *semalabel);
- void (*mpo_cleanup_sysv_shm)(struct label *shmlabel);
- void (*mpo_copy_cred_label)(struct label *src,
- struct label *dest);
- void (*mpo_copy_ifnet_label)(struct label *src,
- struct label *dest);
- void (*mpo_copy_mbuf_label)(struct label *src,
- struct label *dest);
- void (*mpo_copy_pipe_label)(struct label *src,
- struct label *dest);
- void (*mpo_copy_socket_label)(struct label *src,
- struct label *dest);
- void (*mpo_copy_vnode_label)(struct label *src,
- struct label *dest);
- int (*mpo_externalize_cred_label)(struct label *label,
- char *element_name, struct sbuf *sb, int *claimed);
- int (*mpo_externalize_ifnet_label)(struct label *label,
- char *element_name, struct sbuf *sb, int *claimed);
- int (*mpo_externalize_pipe_label)(struct label *label,
- char *element_name, struct sbuf *sb, int *claimed);
- int (*mpo_externalize_socket_label)(struct label *label,
- char *element_name, struct sbuf *sb, int *claimed);
- int (*mpo_externalize_socket_peer_label)(struct label *label,
- char *element_name, struct sbuf *sb, int *claimed);
- int (*mpo_externalize_vnode_label)(struct label *label,
- char *element_name, struct sbuf *sb, int *claimed);
- int (*mpo_internalize_cred_label)(struct label *label,
- char *element_name, char *element_data, int *claimed);
- int (*mpo_internalize_ifnet_label)(struct label *label,
- char *element_name, char *element_data, int *claimed);
- int (*mpo_internalize_pipe_label)(struct label *label,
- char *element_name, char *element_data, int *claimed);
- int (*mpo_internalize_socket_label)(struct label *label,
- char *element_name, char *element_data, int *claimed);
- int (*mpo_internalize_vnode_label)(struct label *label,
- char *element_name, char *element_data, int *claimed);
-
- /*
- * Labeling event operations: file system objects, and things that
- * look a lot like file system objects.
- */
- void (*mpo_associate_vnode_devfs)(struct mount *mp,
- struct label *fslabel, struct devfs_dirent *de,
- struct label *delabel, struct vnode *vp,
- struct label *vlabel);
- int (*mpo_associate_vnode_extattr)(struct mount *mp,
- struct label *fslabel, struct vnode *vp,
- struct label *vlabel);
- void (*mpo_associate_vnode_singlelabel)(struct mount *mp,
- struct label *fslabel, struct vnode *vp,
- struct label *vlabel);
- void (*mpo_create_devfs_device)(struct mount *mp, struct cdev *dev,
- struct devfs_dirent *de, struct label *label);
- void (*mpo_create_devfs_directory)(struct mount *mp, char *dirname,
- int dirnamelen, struct devfs_dirent *de,
- struct label *label);
- void (*mpo_create_devfs_symlink)(struct ucred *cred,
- struct mount *mp, struct devfs_dirent *dd,
- struct label *ddlabel, struct devfs_dirent *de,
- struct label *delabel);
- int (*mpo_create_vnode_extattr)(struct ucred *cred,
- struct mount *mp, struct label *fslabel,
- struct vnode *dvp, struct label *dlabel,
- struct vnode *vp, struct label *vlabel,
- struct componentname *cnp);
- void (*mpo_create_mount)(struct ucred *cred, struct mount *mp,
- struct label *mntlabel, struct label *fslabel);
- void (*mpo_create_root_mount)(struct ucred *cred, struct mount *mp,
- struct label *mountlabel, struct label *fslabel);
- void (*mpo_relabel_vnode)(struct ucred *cred, struct vnode *vp,
- struct label *vnodelabel, struct label *label);
- int (*mpo_setlabel_vnode_extattr)(struct ucred *cred,
- struct vnode *vp, struct label *vlabel,
- struct label *intlabel);
- void (*mpo_update_devfsdirent)(struct mount *mp,
- struct devfs_dirent *devfs_dirent,
- struct label *direntlabel, struct vnode *vp,
- struct label *vnodelabel);
-
- /*
- * Labeling event operations: IPC objects.
- */
- void (*mpo_create_mbuf_from_socket)(struct socket *so,
- struct label *socketlabel, struct mbuf *m,
- struct label *mbuflabel);
- void (*mpo_create_socket)(struct ucred *cred, struct socket *so,
- struct label *socketlabel);
- void (*mpo_create_socket_from_socket)(struct socket *oldsocket,
- struct label *oldsocketlabel, struct socket *newsocket,
- struct label *newsocketlabel);
- void (*mpo_relabel_socket)(struct ucred *cred, struct socket *so,
- struct label *oldlabel, struct label *newlabel);
- void (*mpo_relabel_pipe)(struct ucred *cred, struct pipepair *pp,
- struct label *oldlabel, struct label *newlabel);
- void (*mpo_set_socket_peer_from_mbuf)(struct mbuf *mbuf,
- struct label *mbuflabel, struct socket *so,
- struct label *socketpeerlabel);
- void (*mpo_set_socket_peer_from_socket)(struct socket *oldsocket,
- struct label *oldsocketlabel, struct socket *newsocket,
- struct label *newsocketpeerlabel);
- void (*mpo_create_pipe)(struct ucred *cred, struct pipepair *pp,
- struct label *pipelabel);
-
- /*
- * Labeling event operations: System V IPC primitives.
- */
- void (*mpo_create_sysv_msgmsg)(struct ucred *cred,
- struct msqid_kernel *msqkptr, struct label *msqlabel,
- struct msg *msgptr, struct label *msglabel);
- void (*mpo_create_sysv_msgqueue)(struct ucred *cred,
- struct msqid_kernel *msqkptr, struct label *msqlabel);
- void (*mpo_create_sysv_sem)(struct ucred *cred,
- struct semid_kernel *semakptr, struct label *semalabel);
- void (*mpo_create_sysv_shm)(struct ucred *cred,
- struct shmid_kernel *shmsegptr, struct label *shmlabel);
-
- /*
- * Labeling event operations: POSIX (global/inter-process) semaphores.
- */
- void (*mpo_create_posix_sem)(struct ucred *cred,
- struct ksem *ksemptr, struct label *ks_label);
-
- /*
- * Labeling event operations: network objects.
- */
- void (*mpo_create_bpfdesc)(struct ucred *cred, struct bpf_d *bpf_d,
- struct label *bpflabel);
- void (*mpo_create_ifnet)(struct ifnet *ifnet,
- struct label *ifnetlabel);
- void (*mpo_create_inpcb_from_socket)(struct socket *so,
- struct label *solabel, struct inpcb *inp,
- struct label *inplabel);
- void (*mpo_create_ipq)(struct mbuf *fragment,
- struct label *fragmentlabel, struct ipq *ipq,
- struct label *ipqlabel);
- void (*mpo_create_datagram_from_ipq)
- (struct ipq *ipq, struct label *ipqlabel,
- struct mbuf *datagram, struct label *datagramlabel);
- void (*mpo_create_fragment)(struct mbuf *datagram,
- struct label *datagramlabel, struct mbuf *fragment,
- struct label *fragmentlabel);
- void (*mpo_create_mbuf_from_inpcb)(struct inpcb *inp,
- struct label *inplabel, struct mbuf *m,
- struct label *mlabel);
- void (*mpo_create_mbuf_linklayer)(struct ifnet *ifnet,
- struct label *ifnetlabel, struct mbuf *mbuf,
- struct label *mbuflabel);
- void (*mpo_create_mbuf_from_bpfdesc)(struct bpf_d *bpf_d,
- struct label *bpflabel, struct mbuf *mbuf,
- struct label *mbuflabel);
- void (*mpo_create_mbuf_from_ifnet)(struct ifnet *ifnet,
- struct label *ifnetlabel, struct mbuf *mbuf,
- struct label *mbuflabel);
- void (*mpo_create_mbuf_multicast_encap)(struct mbuf *oldmbuf,
- struct label *oldmbuflabel, struct ifnet *ifnet,
- struct label *ifnetlabel, struct mbuf *newmbuf,
- struct label *newmbuflabel);
- void (*mpo_create_mbuf_netlayer)(struct mbuf *oldmbuf,
- struct label *oldmbuflabel, struct mbuf *newmbuf,
- struct label *newmbuflabel);
- int (*mpo_fragment_match)(struct mbuf *fragment,
- struct label *fragmentlabel, struct ipq *ipq,
- struct label *ipqlabel);
- void (*mpo_reflect_mbuf_icmp)(struct mbuf *m,
- struct label *mlabel);
- void (*mpo_reflect_mbuf_tcp)(struct mbuf *m, struct label *mlabel);
- void (*mpo_relabel_ifnet)(struct ucred *cred, struct ifnet *ifnet,
- struct label *ifnetlabel, struct label *newlabel);
- void (*mpo_update_ipq)(struct mbuf *fragment,
- struct label *fragmentlabel, struct ipq *ipq,
- struct label *ipqlabel);
- void (*mpo_inpcb_sosetlabel)(struct socket *so,
- struct label *label, struct inpcb *inp,
- struct label *inplabel);
-
- /*
- * Labeling event operations: processes.
- */
- void (*mpo_execve_transition)(struct ucred *old, struct ucred *new,
- struct vnode *vp, struct label *vnodelabel,
- struct label *interpvnodelabel,
- struct image_params *imgp, struct label *execlabel);
- int (*mpo_execve_will_transition)(struct ucred *old,
- struct vnode *vp, struct label *vnodelabel,
- struct label *interpvnodelabel,
- struct image_params *imgp, struct label *execlabel);
- void (*mpo_create_proc0)(struct ucred *cred);
- void (*mpo_create_proc1)(struct ucred *cred);
- void (*mpo_relabel_cred)(struct ucred *cred,
- struct label *newlabel);
- void (*mpo_thread_userret)(struct thread *thread);
-
- /*
- * Access control checks.
- */
- int (*mpo_check_bpfdesc_receive)(struct bpf_d *bpf_d,
- struct label *bpflabel, struct ifnet *ifnet,
- struct label *ifnetlabel);
- int (*mpo_check_cred_relabel)(struct ucred *cred,
- struct label *newlabel);
- int (*mpo_check_cred_visible)(struct ucred *u1, struct ucred *u2);
- int (*mpo_check_ifnet_relabel)(struct ucred *cred,
- struct ifnet *ifnet, struct label *ifnetlabel,
- struct label *newlabel);
- int (*mpo_check_ifnet_transmit)(struct ifnet *ifnet,
- struct label *ifnetlabel, struct mbuf *m,
- struct label *mbuflabel);
- int (*mpo_check_inpcb_deliver)(struct inpcb *inp,
- struct label *inplabel, struct mbuf *m,
- struct label *mlabel);
- int (*mpo_check_sysv_msgmsq)(struct ucred *cred,
- struct msg *msgptr, struct label *msglabel,
- struct msqid_kernel *msqkptr, struct label *msqklabel);
- int (*mpo_check_sysv_msgrcv)(struct ucred *cred,
- struct msg *msgptr, struct label *msglabel);
- int (*mpo_check_sysv_msgrmid)(struct ucred *cred,
- struct msg *msgptr, struct label *msglabel);
- int (*mpo_check_sysv_msqget)(struct ucred *cred,
- struct msqid_kernel *msqkptr, struct label *msqklabel);
- int (*mpo_check_sysv_msqsnd)(struct ucred *cred,
- struct msqid_kernel *msqkptr, struct label *msqklabel);
- int (*mpo_check_sysv_msqrcv)(struct ucred *cred,
- struct msqid_kernel *msqkptr, struct label *msqklabel);
- int (*mpo_check_sysv_msqctl)(struct ucred *cred,
- struct msqid_kernel *msqkptr, struct label *msqklabel,
- int cmd);
- int (*mpo_check_sysv_semctl)(struct ucred *cred,
- struct semid_kernel *semakptr, struct label *semaklabel,
- int cmd);
- int (*mpo_check_sysv_semget)(struct ucred *cred,
- struct semid_kernel *semakptr, struct label *semaklabel);
- int (*mpo_check_sysv_semop)(struct ucred *cred,
- struct semid_kernel *semakptr, struct label *semaklabel,
- size_t accesstype);
- int (*mpo_check_sysv_shmat)(struct ucred *cred,
- struct shmid_kernel *shmsegptr,
- struct label *shmseglabel, int shmflg);
- int (*mpo_check_sysv_shmctl)(struct ucred *cred,
- struct shmid_kernel *shmsegptr,
- struct label *shmseglabel, int cmd);
- int (*mpo_check_sysv_shmdt)(struct ucred *cred,
- struct shmid_kernel *shmsegptr,
- struct label *shmseglabel);
- int (*mpo_check_sysv_shmget)(struct ucred *cred,
- struct shmid_kernel *shmsegptr,
- struct label *shmseglabel, int shmflg);
- int (*mpo_check_kenv_dump)(struct ucred *cred);
- int (*mpo_check_kenv_get)(struct ucred *cred, char *name);
- int (*mpo_check_kenv_set)(struct ucred *cred, char *name,
- char *value);
- int (*mpo_check_kenv_unset)(struct ucred *cred, char *name);
- int (*mpo_check_kld_load)(struct ucred *cred, struct vnode *vp,
- struct label *vlabel);
- int (*mpo_check_kld_stat)(struct ucred *cred);
- int (*mpo_check_kld_unload)(struct ucred *cred);
- int (*mpo_check_mount_stat)(struct ucred *cred, struct mount *mp,
- struct label *mntlabel);
- int (*mpo_check_pipe_ioctl)(struct ucred *cred,
- struct pipepair *pp, struct label *pipelabel,
- unsigned long cmd, void *data);
- int (*mpo_check_pipe_poll)(struct ucred *cred,
- struct pipepair *pp, struct label *pipelabel);
- int (*mpo_check_pipe_read)(struct ucred *cred,
- struct pipepair *pp, struct label *pipelabel);
- int (*mpo_check_pipe_relabel)(struct ucred *cred,
- struct pipepair *pp, struct label *pipelabel,
- struct label *newlabel);
- int (*mpo_check_pipe_stat)(struct ucred *cred,
- struct pipepair *pp, struct label *pipelabel);
- int (*mpo_check_pipe_write)(struct ucred *cred,
- struct pipepair *pp, struct label *pipelabel);
- int (*mpo_check_posix_sem_destroy)(struct ucred *cred,
- struct ksem *ksemptr, struct label *ks_label);
- int (*mpo_check_posix_sem_getvalue)(struct ucred *cred,
- struct ksem *ksemptr, struct label *ks_label);
- int (*mpo_check_posix_sem_open)(struct ucred *cred,
- struct ksem *ksemptr, struct label *ks_label);
- int (*mpo_check_posix_sem_post)(struct ucred *cred,
- struct ksem *ksemptr, struct label *ks_label);
- int (*mpo_check_posix_sem_unlink)(struct ucred *cred,
- struct ksem *ksemptr, struct label *ks_label);
- int (*mpo_check_posix_sem_wait)(struct ucred *cred,
- struct ksem *ksemptr, struct label *ks_label);
- int (*mpo_check_proc_debug)(struct ucred *cred,
- struct proc *proc);
- int (*mpo_check_proc_sched)(struct ucred *cred,
- struct proc *proc);
- int (*mpo_check_proc_setuid)(struct ucred *cred, uid_t uid);
- int (*mpo_check_proc_seteuid)(struct ucred *cred, uid_t euid);
- int (*mpo_check_proc_setgid)(struct ucred *cred, gid_t gid);
- int (*mpo_check_proc_setegid)(struct ucred *cred, gid_t egid);
- int (*mpo_check_proc_setgroups)(struct ucred *cred, int ngroups,
- gid_t *gidset);
- int (*mpo_check_proc_setreuid)(struct ucred *cred, uid_t ruid,
- uid_t euid);
- int (*mpo_check_proc_setregid)(struct ucred *cred, gid_t rgid,
- gid_t egid);
- int (*mpo_check_proc_setresuid)(struct ucred *cred, uid_t ruid,
- uid_t euid, uid_t suid);
- int (*mpo_check_proc_setresgid)(struct ucred *cred, gid_t rgid,
- gid_t egid, gid_t sgid);
- int (*mpo_check_proc_signal)(struct ucred *cred,
- struct proc *proc, int signum);
- int (*mpo_check_proc_wait)(struct ucred *cred,
- struct proc *proc);
- int (*mpo_check_socket_accept)(struct ucred *cred,
- struct socket *so, struct label *socketlabel);
- int (*mpo_check_socket_bind)(struct ucred *cred,
- struct socket *so, struct label *socketlabel,
- struct sockaddr *sockaddr);
- int (*mpo_check_socket_connect)(struct ucred *cred,
- struct socket *so, struct label *socketlabel,
- struct sockaddr *sockaddr);
- int (*mpo_check_socket_create)(struct ucred *cred, int domain,
- int type, int protocol);
- int (*mpo_check_socket_deliver)(struct socket *so,
- struct label *socketlabel, struct mbuf *m,
- struct label *mbuflabel);
- int (*mpo_check_socket_listen)(struct ucred *cred,
- struct socket *so, struct label *socketlabel);
- int (*mpo_check_socket_poll)(struct ucred *cred,
- struct socket *so, struct label *socketlabel);
- int (*mpo_check_socket_receive)(struct ucred *cred,
- struct socket *so, struct label *socketlabel);
- int (*mpo_check_socket_relabel)(struct ucred *cred,
- struct socket *so, struct label *socketlabel,
- struct label *newlabel);
- int (*mpo_check_socket_send)(struct ucred *cred,
- struct socket *so, struct label *socketlabel);
- int (*mpo_check_socket_stat)(struct ucred *cred,
- struct socket *so, struct label *socketlabel);
- int (*mpo_check_socket_visible)(struct ucred *cred,
- struct socket *so, struct label *socketlabel);
- int (*mpo_check_sysarch_ioperm)(struct ucred *cred);
- int (*mpo_check_system_acct)(struct ucred *cred,
- struct vnode *vp, struct label *vlabel);
- int (*mpo_check_system_nfsd)(struct ucred *cred);
- int (*mpo_check_system_reboot)(struct ucred *cred, int howto);
- int (*mpo_check_system_settime)(struct ucred *cred);
- int (*mpo_check_system_swapon)(struct ucred *cred,
- struct vnode *vp, struct label *label);
- int (*mpo_check_system_swapoff)(struct ucred *cred,
- struct vnode *vp, struct label *label);
- int (*mpo_check_system_sysctl)(struct ucred *cred,
- struct sysctl_oid *oidp, void *arg1, int arg2,
- struct sysctl_req *req);
- int (*mpo_check_vnode_access)(struct ucred *cred,
- struct vnode *vp, struct label *label, int acc_mode);
- int (*mpo_check_vnode_chdir)(struct ucred *cred,
- struct vnode *dvp, struct label *dlabel);
- int (*mpo_check_vnode_chroot)(struct ucred *cred,
- struct vnode *dvp, struct label *dlabel);
- int (*mpo_check_vnode_create)(struct ucred *cred,
- struct vnode *dvp, struct label *dlabel,
- struct componentname *cnp, struct vattr *vap);
- int (*mpo_check_vnode_delete)(struct ucred *cred,
- struct vnode *dvp, struct label *dlabel,
- struct vnode *vp, struct label *label,
- struct componentname *cnp);
- int (*mpo_check_vnode_deleteacl)(struct ucred *cred,
- struct vnode *vp, struct label *label, acl_type_t type);
- int (*mpo_check_vnode_deleteextattr)(struct ucred *cred,
- struct vnode *vp, struct label *label, int attrnamespace,
- const char *name);
- int (*mpo_check_vnode_exec)(struct ucred *cred, struct vnode *vp,
- struct label *label, struct image_params *imgp,
- struct label *execlabel);
- int (*mpo_check_vnode_getacl)(struct ucred *cred,
- struct vnode *vp, struct label *label, acl_type_t type);
- int (*mpo_check_vnode_getextattr)(struct ucred *cred,
- struct vnode *vp, struct label *label, int attrnamespace,
- const char *name, struct uio *uio);
- int (*mpo_check_vnode_link)(struct ucred *cred, struct vnode *dvp,
- struct label *dlabel, struct vnode *vp,
- struct label *label, struct componentname *cnp);
- int (*mpo_check_vnode_listextattr)(struct ucred *cred,
- struct vnode *vp, struct label *label, int attrnamespace);
- int (*mpo_check_vnode_lookup)(struct ucred *cred,
- struct vnode *dvp, struct label *dlabel,
- struct componentname *cnp);
- int (*mpo_check_vnode_mmap)(struct ucred *cred, struct vnode *vp,
- struct label *label, int prot, int flags);
- void (*mpo_check_vnode_mmap_downgrade)(struct ucred *cred,
- struct vnode *vp, struct label *label, int *prot);
- int (*mpo_check_vnode_mprotect)(struct ucred *cred,
- struct vnode *vp, struct label *label, int prot);
- int (*mpo_check_vnode_open)(struct ucred *cred, struct vnode *vp,
- struct label *label, int acc_mode);
- int (*mpo_check_vnode_poll)(struct ucred *active_cred,
- struct ucred *file_cred, struct vnode *vp,
- struct label *label);
- int (*mpo_check_vnode_read)(struct ucred *active_cred,
- struct ucred *file_cred, struct vnode *vp,
- struct label *label);
- int (*mpo_check_vnode_readdir)(struct ucred *cred,
- struct vnode *dvp, struct label *dlabel);
- int (*mpo_check_vnode_readlink)(struct ucred *cred,
- struct vnode *vp, struct label *label);
- int (*mpo_check_vnode_relabel)(struct ucred *cred,
- struct vnode *vp, struct label *vnodelabel,
- struct label *newlabel);
- int (*mpo_check_vnode_rename_from)(struct ucred *cred,
- struct vnode *dvp, struct label *dlabel, struct vnode *vp,
- struct label *label, struct componentname *cnp);
- int (*mpo_check_vnode_rename_to)(struct ucred *cred,
- struct vnode *dvp, struct label *dlabel, struct vnode *vp,
- struct label *label, int samedir,
- struct componentname *cnp);
- int (*mpo_check_vnode_revoke)(struct ucred *cred,
- struct vnode *vp, struct label *label);
- int (*mpo_check_vnode_setacl)(struct ucred *cred,
- struct vnode *vp, struct label *label, acl_type_t type,
- struct acl *acl);
- int (*mpo_check_vnode_setextattr)(struct ucred *cred,
- struct vnode *vp, struct label *label, int attrnamespace,
- const char *name, struct uio *uio);
- int (*mpo_check_vnode_setflags)(struct ucred *cred,
- struct vnode *vp, struct label *label, u_long flags);
- int (*mpo_check_vnode_setmode)(struct ucred *cred,
- struct vnode *vp, struct label *label, mode_t mode);
- int (*mpo_check_vnode_setowner)(struct ucred *cred,
- struct vnode *vp, struct label *label, uid_t uid,
- gid_t gid);
- int (*mpo_check_vnode_setutimes)(struct ucred *cred,
- struct vnode *vp, struct label *label,
- struct timespec atime, struct timespec mtime);
- int (*mpo_check_vnode_stat)(struct ucred *active_cred,
- struct ucred *file_cred, struct vnode *vp,
- struct label *label);
- int (*mpo_check_vnode_write)(struct ucred *active_cred,
- struct ucred *file_cred, struct vnode *vp,
- struct label *label);
-};
-
-/*
- * struct mac_policy_conf is the registration structure for policies, and is
- * provided to the MAC Framework using MAC_POLICY_SET() to invoke a SYSINIT
- * to register the policy. In general, the fields are immutable, with the
- * exception of the "security field", run-time flags, and policy list entry,
- * which are managed by the MAC Framework. Be careful when modifying this
- * structure, as its layout is statically compiled into all policies.
- */
-struct mac_policy_conf {
- char *mpc_name; /* policy name */
- char *mpc_fullname; /* policy full name */
- struct mac_policy_ops *mpc_ops; /* policy operations */
- int mpc_loadtime_flags; /* flags */
- int *mpc_field_off; /* security field */
- int mpc_runtime_flags; /* flags */
- LIST_ENTRY(mac_policy_conf) mpc_list; /* global list */
-};
-
-/* Flags for the mpc_loadtime_flags field. */
-#define MPC_LOADTIME_FLAG_NOTLATE 0x00000001
-#define MPC_LOADTIME_FLAG_UNLOADOK 0x00000002
-#define MPC_LOADTIME_FLAG_LABELMBUFS 0x00000004
-
-/* Flags for the mpc_runtime_flags field. */
-#define MPC_RUNTIME_FLAG_REGISTERED 0x00000001
-
-#define MAC_POLICY_SET(mpops, mpname, mpfullname, mpflags, privdata_wanted) \
- static struct mac_policy_conf mpname##_mac_policy_conf = { \
- #mpname, \
- mpfullname, \
- mpops, \
- mpflags, \
- privdata_wanted, \
- 0, \
- }; \
- static moduledata_t mpname##_mod = { \
- #mpname, \
- mac_policy_modevent, \
- &mpname##_mac_policy_conf \
- }; \
- MODULE_DEPEND(mpname, kernel_mac_support, 2, 2, 2); \
- DECLARE_MODULE(mpname, mpname##_mod, SI_SUB_MAC_POLICY, \
- SI_ORDER_MIDDLE)
-
-int mac_policy_modevent(module_t mod, int type, void *data);
-
-#define LABEL_TO_SLOT(l, s) (l)->l_perpolicy[s]
-
-#endif /* !_SYS_MAC_POLICY_H_ */
diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c
deleted file mode 100644
index 9e8d45a..0000000
--- a/sys/security/mac/mac_syscalls.c
+++ /dev/null
@@ -1,1255 +0,0 @@
-/*-
- * Copyright (c) 1999-2002 Robert N. M. Watson
- * Copyright (c) 2001 Ilmar S. Habibulin
- * Copyright (c) 2001-2005 Networks Associates Technology, Inc.
- * All rights reserved.
- *
- * This software was developed by Robert Watson and Ilmar Habibulin for the
- * TrustedBSD Project.
- *
- * This software was developed for the FreeBSD Project in part by Network
- * Associates Laboratories, the Security Research Division of Network
- * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
- * as part of the DARPA CHATS research program.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-/*-
- * Framework for extensible kernel access control. This file contains
- * Kernel and userland interface to the framework, policy registration
- * and composition. Per-object interfaces, controls, and labeling may be
- * found in src/sys/security/mac/. Sample policies may be found in
- * src/sys/security/mac_*.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_mac.h"
-#include "opt_devfs.h"
-
-#include <sys/param.h>
-#include <sys/condvar.h>
-#include <sys/extattr.h>
-#include <sys/imgact.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mutex.h>
-#include <sys/mac.h>
-#include <sys/module.h>
-#include <sys/proc.h>
-#include <sys/sbuf.h>
-#include <sys/systm.h>
-#include <sys/sysproto.h>
-#include <sys/sysent.h>
-#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <sys/file.h>
-#include <sys/namei.h>
-#include <sys/socket.h>
-#include <sys/pipe.h>
-#include <sys/socketvar.h>
-#include <sys/sysctl.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <vm/vm_map.h>
-#include <vm/vm_object.h>
-
-#include <sys/mac_policy.h>
-
-#include <fs/devfs/devfs.h>
-
-#include <net/bpfdesc.h>
-#include <net/if.h>
-#include <net/if_var.h>
-
-#include <netinet/in.h>
-#include <netinet/ip_var.h>
-
-#include <security/mac/mac_internal.h>
-
-#ifdef MAC
-
-/*
- * Declare that the kernel provides MAC support, version 1. This permits
- * modules to refuse to be loaded if the necessary support isn't present,
- * even if it's pre-boot.
- */
-MODULE_VERSION(kernel_mac_support, 2);
-
-SYSCTL_NODE(_security, OID_AUTO, mac, CTLFLAG_RW, 0,
- "TrustedBSD MAC policy controls");
-
-#if MAC_MAX_SLOTS > 32
-#error "MAC_MAX_SLOTS too large"
-#endif
-
-static unsigned int mac_max_slots = MAC_MAX_SLOTS;
-static unsigned int mac_slot_offsets_free = (1 << MAC_MAX_SLOTS) - 1;
-SYSCTL_UINT(_security_mac, OID_AUTO, max_slots, CTLFLAG_RD,
- &mac_max_slots, 0, "");
-
-/*
- * Has the kernel started generating labeled objects yet? All read/write
- * access to this variable is serialized during the boot process. Following
- * the end of serialization, we don't update this flag; no locking.
- */
-int mac_late = 0;
-
-/*
- * Flag to indicate whether or not we should allocate label storage for
- * new mbufs. Since most dynamic policies we currently work with don't
- * rely on mbuf labeling, try to avoid paying the cost of mtag allocation
- * unless specifically notified of interest. One result of this is
- * that if a dynamically loaded policy requests mbuf labels, it must
- * be able to deal with a NULL label being returned on any mbufs that
- * were already in flight when the policy was loaded. Since the policy
- * already has to deal with uninitialized labels, this probably won't
- * be a problem. Note: currently no locking. Will this be a problem?
- */
-#ifndef MAC_ALWAYS_LABEL_MBUF
-int mac_labelmbufs = 0;
-#endif
-
-#ifdef MAC_DEBUG
-SYSCTL_NODE(_security_mac, OID_AUTO, debug, CTLFLAG_RW, 0,
- "TrustedBSD MAC debug info");
-SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
- "TrustedBSD MAC object counters");
-
-static unsigned int nmactemp;
-SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
- &nmactemp, 0, "number of temporary labels in use");
-#endif
-
-static int mac_policy_register(struct mac_policy_conf *mpc);
-static int mac_policy_unregister(struct mac_policy_conf *mpc);
-
-MALLOC_DEFINE(M_MACTEMP, "mactemp", "MAC temporary label storage");
-
-/*
- * mac_static_policy_list holds a list of policy modules that are not
- * loaded while the system is "live", and cannot be unloaded. These
- * policies can be invoked without holding the busy count.
- *
- * mac_policy_list stores the list of dynamic policies. A busy count is
- * maintained for the list, stored in mac_policy_busy. The busy count
- * is protected by mac_policy_mtx; the list may be modified only
- * while the busy count is 0, requiring that the lock be held to
- * prevent new references to the list from being acquired. For almost
- * all operations, incrementing the busy count is sufficient to
- * guarantee consistency, as the list cannot be modified while the
- * busy count is elevated. For a few special operations involving a
- * change to the list of active policies, the mtx itself must be held.
- * A condition variable, mac_policy_cv, is used to signal potential
- * exclusive consumers that they should try to acquire the lock if a
- * first attempt at exclusive access fails.
- */
-#ifndef MAC_STATIC
-static struct mtx mac_policy_mtx;
-static struct cv mac_policy_cv;
-static int mac_policy_count;
-#endif
-struct mac_policy_list_head mac_policy_list;
-struct mac_policy_list_head mac_static_policy_list;
-
-/*
- * We manually invoke WITNESS_WARN() to allow Witness to generate
- * warnings even if we don't end up ever triggering the wait at
- * run-time. The consumer of the exclusive interface must not hold
- * any locks (other than potentially Giant) since we may sleep for
- * long (potentially indefinite) periods of time waiting for the
- * framework to become quiescent so that a policy list change may
- * be made.
- */
-void
-mac_policy_grab_exclusive(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
- "mac_policy_grab_exclusive() at %s:%d", __FILE__, __LINE__);
- mtx_lock(&mac_policy_mtx);
- while (mac_policy_count != 0)
- cv_wait(&mac_policy_cv, &mac_policy_mtx);
-#endif
-}
-
-void
-mac_policy_assert_exclusive(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- mtx_assert(&mac_policy_mtx, MA_OWNED);
- KASSERT(mac_policy_count == 0,
- ("mac_policy_assert_exclusive(): not exclusive"));
-#endif
-}
-
-void
-mac_policy_release_exclusive(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- KASSERT(mac_policy_count == 0,
- ("mac_policy_release_exclusive(): not exclusive"));
- mtx_unlock(&mac_policy_mtx);
- cv_signal(&mac_policy_cv);
-#endif
-}
-
-void
-mac_policy_list_busy(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- mtx_lock(&mac_policy_mtx);
- mac_policy_count++;
- mtx_unlock(&mac_policy_mtx);
-#endif
-}
-
-int
-mac_policy_list_conditional_busy(void)
-{
-#ifndef MAC_STATIC
- int ret;
-
- if (!mac_late)
- return (1);
-
- mtx_lock(&mac_policy_mtx);
- if (!LIST_EMPTY(&mac_policy_list)) {
- mac_policy_count++;
- ret = 1;
- } else
- ret = 0;
- mtx_unlock(&mac_policy_mtx);
- return (ret);
-#else
- if (!mac_late)
- return (1);
-
- return (1);
-#endif
-}
-
-void
-mac_policy_list_unbusy(void)
-{
-
-#ifndef MAC_STATIC
- if (!mac_late)
- return;
-
- mtx_lock(&mac_policy_mtx);
- mac_policy_count--;
- KASSERT(mac_policy_count >= 0, ("MAC_POLICY_LIST_LOCK"));
- if (mac_policy_count == 0)
- cv_signal(&mac_policy_cv);
- mtx_unlock(&mac_policy_mtx);
-#endif
-}
-
-/*
- * Initialize the MAC subsystem, including appropriate SMP locks.
- */
-static void
-mac_init(void)
-{
-
- LIST_INIT(&mac_static_policy_list);
- LIST_INIT(&mac_policy_list);
- mac_labelzone_init();
-
-#ifndef MAC_STATIC
- mtx_init(&mac_policy_mtx, "mac_policy_mtx", NULL, MTX_DEF);
- cv_init(&mac_policy_cv, "mac_policy_cv");
-#endif
-}
-
-/*
- * For the purposes of modules that want to know if they were loaded
- * "early", set the mac_late flag once we've processed modules either
- * linked into the kernel, or loaded before the kernel startup.
- */
-static void
-mac_late_init(void)
-{
-
- mac_late = 1;
-}
-
-/*
- * After the policy list has changed, walk the list to update any global
- * flags. Currently, we support only one flag, and it's conditionally
- * defined; as a result, the entire function is conditional. Eventually,
- * the #else case might also iterate across the policies.
- */
-static void
-mac_policy_updateflags(void)
-{
-#ifndef MAC_ALWAYS_LABEL_MBUF
- struct mac_policy_conf *tmpc;
- int labelmbufs;
-
- mac_policy_assert_exclusive();
-
- labelmbufs = 0;
- LIST_FOREACH(tmpc, &mac_static_policy_list, mpc_list) {
- if (tmpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_LABELMBUFS)
- labelmbufs++;
- }
- LIST_FOREACH(tmpc, &mac_policy_list, mpc_list) {
- if (tmpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_LABELMBUFS)
- labelmbufs++;
- }
- mac_labelmbufs = (labelmbufs != 0);
-#endif
-}
-
-/*
- * Allow MAC policy modules to register during boot, etc.
- */
-int
-mac_policy_modevent(module_t mod, int type, void *data)
-{
- struct mac_policy_conf *mpc;
- int error;
-
- error = 0;
- mpc = (struct mac_policy_conf *) data;
-
-#ifdef MAC_STATIC
- if (mac_late) {
- printf("mac_policy_modevent: MAC_STATIC and late\n");
- return (EBUSY);
- }
-#endif
-
- switch (type) {
- case MOD_LOAD:
- if (mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_NOTLATE &&
- mac_late) {
- printf("mac_policy_modevent: can't load %s policy "
- "after booting\n", mpc->mpc_name);
- error = EBUSY;
- break;
- }
- error = mac_policy_register(mpc);
- break;
- case MOD_UNLOAD:
- /* Don't unregister the module if it was never registered. */
- if ((mpc->mpc_runtime_flags & MPC_RUNTIME_FLAG_REGISTERED)
- != 0)
- error = mac_policy_unregister(mpc);
- else
- error = 0;
- break;
- default:
- error = EOPNOTSUPP;
- break;
- }
-
- return (error);
-}
-
-static int
-mac_policy_register(struct mac_policy_conf *mpc)
-{
- struct mac_policy_conf *tmpc;
- int error, slot, static_entry;
-
- error = 0;
-
- /*
- * We don't technically need exclusive access while !mac_late,
- * but hold it for assertion consistency.
- */
- mac_policy_grab_exclusive();
-
- /*
- * If the module can potentially be unloaded, or we're loading
- * late, we have to stick it in the non-static list and pay
- * an extra performance overhead. Otherwise, we can pay a
- * light locking cost and stick it in the static list.
- */
- static_entry = (!mac_late &&
- !(mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_UNLOADOK));
-
- if (static_entry) {
- LIST_FOREACH(tmpc, &mac_static_policy_list, mpc_list) {
- if (strcmp(tmpc->mpc_name, mpc->mpc_name) == 0) {
- error = EEXIST;
- goto out;
- }
- }
- } else {
- LIST_FOREACH(tmpc, &mac_policy_list, mpc_list) {
- if (strcmp(tmpc->mpc_name, mpc->mpc_name) == 0) {
- error = EEXIST;
- goto out;
- }
- }
- }
- if (mpc->mpc_field_off != NULL) {
- slot = ffs(mac_slot_offsets_free);
- if (slot == 0) {
- error = ENOMEM;
- goto out;
- }
- slot--;
- mac_slot_offsets_free &= ~(1 << slot);
- *mpc->mpc_field_off = slot;
- }
- mpc->mpc_runtime_flags |= MPC_RUNTIME_FLAG_REGISTERED;
-
- /*
- * If we're loading a MAC module after the framework has
- * initialized, it has to go into the dynamic list. If
- * we're loading it before we've finished initializing,
- * it can go into the static list with weaker locker
- * requirements.
- */
- if (static_entry)
- LIST_INSERT_HEAD(&mac_static_policy_list, mpc, mpc_list);
- else
- LIST_INSERT_HEAD(&mac_policy_list, mpc, mpc_list);
-
- /* Per-policy initialization. */
- if (mpc->mpc_ops->mpo_init != NULL)
- (*(mpc->mpc_ops->mpo_init))(mpc);
- mac_policy_updateflags();
-
- printf("Security policy loaded: %s (%s)\n", mpc->mpc_fullname,
- mpc->mpc_name);
-
-out:
- mac_policy_release_exclusive();
- return (error);
-}
-
-static int
-mac_policy_unregister(struct mac_policy_conf *mpc)
-{
-
- /*
- * If we fail the load, we may get a request to unload. Check
- * to see if we did the run-time registration, and if not,
- * silently succeed.
- */
- mac_policy_grab_exclusive();
- if ((mpc->mpc_runtime_flags & MPC_RUNTIME_FLAG_REGISTERED) == 0) {
- mac_policy_release_exclusive();
- return (0);
- }
-#if 0
- /*
- * Don't allow unloading modules with private data.
- */
- if (mpc->mpc_field_off != NULL) {
- MAC_POLICY_LIST_UNLOCK();
- return (EBUSY);
- }
-#endif
- /*
- * Only allow the unload to proceed if the module is unloadable
- * by its own definition.
- */
- if ((mpc->mpc_loadtime_flags & MPC_LOADTIME_FLAG_UNLOADOK) == 0) {
- mac_policy_release_exclusive();
- return (EBUSY);
- }
- if (mpc->mpc_ops->mpo_destroy != NULL)
- (*(mpc->mpc_ops->mpo_destroy))(mpc);
-
- LIST_REMOVE(mpc, mpc_list);
- mpc->mpc_runtime_flags &= ~MPC_RUNTIME_FLAG_REGISTERED;
- mac_policy_updateflags();
-
- mac_policy_release_exclusive();
-
- printf("Security policy unload: %s (%s)\n", mpc->mpc_fullname,
- mpc->mpc_name);
-
- return (0);
-}
-
-/*
- * Define an error value precedence, and given two arguments, selects the
- * value with the higher precedence.
- */
-int
-mac_error_select(int error1, int error2)
-{
-
- /* Certain decision-making errors take top priority. */
- if (error1 == EDEADLK || error2 == EDEADLK)
- return (EDEADLK);
-
- /* Invalid arguments should be reported where possible. */
- if (error1 == EINVAL || error2 == EINVAL)
- return (EINVAL);
-
- /* Precedence goes to "visibility", with both process and file. */
- if (error1 == ESRCH || error2 == ESRCH)
- return (ESRCH);
-
- if (error1 == ENOENT || error2 == ENOENT)
- return (ENOENT);
-
- /* Precedence goes to DAC/MAC protections. */
- if (error1 == EACCES || error2 == EACCES)
- return (EACCES);
-
- /* Precedence goes to privilege. */
- if (error1 == EPERM || error2 == EPERM)
- return (EPERM);
-
- /* Precedence goes to error over success; otherwise, arbitrary. */
- if (error1 != 0)
- return (error1);
- return (error2);
-}
-
-void
-mac_init_label(struct label *label)
-{
-
- bzero(label, sizeof(*label));
- label->l_flags = MAC_FLAG_INITIALIZED;
-}
-
-void
-mac_destroy_label(struct label *label)
-{
-
- KASSERT(label->l_flags & MAC_FLAG_INITIALIZED,
- ("destroying uninitialized label"));
-
- bzero(label, sizeof(*label));
- /* implicit: label->l_flags &= ~MAC_FLAG_INITIALIZED; */
-}
-
-int
-mac_check_structmac_consistent(struct mac *mac)
-{
-
- if (mac->m_buflen < 0 ||
- mac->m_buflen > MAC_MAX_LABEL_BUF_LEN)
- return (EINVAL);
-
- return (0);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap)
-{
- char *elements, *buffer;
- struct mac mac;
- struct proc *tproc;
- struct ucred *tcred;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- tproc = pfind(uap->pid);
- if (tproc == NULL)
- return (ESRCH);
-
- tcred = NULL; /* Satisfy gcc. */
- error = p_cansee(td, tproc);
- if (error == 0)
- tcred = crhold(tproc->p_ucred);
- PROC_UNLOCK(tproc);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- crfree(tcred);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- error = mac_externalize_cred_label(tcred->cr_label, elements,
- buffer, mac.m_buflen);
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
- crfree(tcred);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap)
-{
- char *elements, *buffer;
- struct mac mac;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- error = mac_externalize_cred_label(td->td_ucred->cr_label,
- elements, buffer, mac.m_buflen);
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap)
-{
- struct ucred *newcred, *oldcred;
- struct label *intlabel;
- struct proc *p;
- struct mac mac;
- char *buffer;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL);
- if (error) {
- free(buffer, M_MACTEMP);
- return (error);
- }
-
- intlabel = mac_cred_label_alloc();
- error = mac_internalize_cred_label(intlabel, buffer);
- free(buffer, M_MACTEMP);
- if (error)
- goto out;
-
- newcred = crget();
-
- p = td->td_proc;
- PROC_LOCK(p);
- oldcred = p->p_ucred;
-
- error = mac_check_cred_relabel(oldcred, intlabel);
- if (error) {
- PROC_UNLOCK(p);
- crfree(newcred);
- goto out;
- }
-
- setsugid(p);
- crcopy(newcred, oldcred);
- mac_relabel_cred(newcred, intlabel);
- p->p_ucred = newcred;
-
- /*
- * Grab additional reference for use while revoking mmaps, prior
- * to releasing the proc lock and sharing the cred.
- */
- crhold(newcred);
- PROC_UNLOCK(p);
-
- if (mac_enforce_vm) {
- mtx_lock(&Giant);
- mac_cred_mmapped_drop_perms(td, newcred);
- mtx_unlock(&Giant);
- }
-
- crfree(newcred); /* Free revocation reference. */
- crfree(oldcred);
-
-out:
- mac_cred_label_free(intlabel);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
-{
- char *elements, *buffer;
- struct label *intlabel;
- struct file *fp;
- struct mac mac;
- struct vnode *vp;
- struct pipe *pipe;
- struct socket *so;
- short label_type;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- error = fget(td, uap->fd, &fp);
- if (error)
- goto out;
-
- label_type = fp->f_type;
- switch (fp->f_type) {
- case DTYPE_FIFO:
- case DTYPE_VNODE:
- vp = fp->f_vnode;
- intlabel = mac_vnode_label_alloc();
- mtx_lock(&Giant); /* VFS */
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- mac_copy_vnode_label(vp->v_label, intlabel);
- VOP_UNLOCK(vp, 0, td);
- mtx_unlock(&Giant); /* VFS */
- error = mac_externalize_vnode_label(intlabel, elements,
- buffer, mac.m_buflen);
- mac_vnode_label_free(intlabel);
- break;
-
- case DTYPE_PIPE:
- pipe = fp->f_data;
- intlabel = mac_pipe_label_alloc();
- PIPE_LOCK(pipe);
- mac_copy_pipe_label(pipe->pipe_pair->pp_label, intlabel);
- PIPE_UNLOCK(pipe);
- error = mac_externalize_pipe_label(intlabel, elements,
- buffer, mac.m_buflen);
- mac_pipe_label_free(intlabel);
- break;
-
- case DTYPE_SOCKET:
- so = fp->f_data;
- intlabel = mac_socket_label_alloc(M_WAITOK);
- NET_LOCK_GIANT();
- SOCK_LOCK(so);
- mac_copy_socket_label(so->so_label, intlabel);
- SOCK_UNLOCK(so);
- NET_UNLOCK_GIANT();
- error = mac_externalize_socket_label(intlabel, elements,
- buffer, mac.m_buflen);
- mac_socket_label_free(intlabel);
- break;
-
- default:
- error = EINVAL;
- }
- fdrop(fp, td);
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
-out:
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_file(struct thread *td, struct __mac_get_file_args *uap)
-{
- char *elements, *buffer;
- struct nameidata nd;
- struct label *intlabel;
- struct mac mac;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- mtx_lock(&Giant); /* VFS */
- NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p,
- td);
- error = namei(&nd);
- if (error)
- goto out;
-
- intlabel = mac_vnode_label_alloc();
- mac_copy_vnode_label(nd.ni_vp->v_label, intlabel);
- error = mac_externalize_vnode_label(intlabel, elements, buffer,
- mac.m_buflen);
-
- NDFREE(&nd, 0);
- mac_vnode_label_free(intlabel);
-
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
-out:
- mtx_unlock(&Giant); /* VFS */
-
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
-
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_get_link(struct thread *td, struct __mac_get_link_args *uap)
-{
- char *elements, *buffer;
- struct nameidata nd;
- struct label *intlabel;
- struct mac mac;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
- if (error) {
- free(elements, M_MACTEMP);
- return (error);
- }
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
- mtx_lock(&Giant); /* VFS */
- NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p,
- td);
- error = namei(&nd);
- if (error)
- goto out;
-
- intlabel = mac_vnode_label_alloc();
- mac_copy_vnode_label(nd.ni_vp->v_label, intlabel);
- error = mac_externalize_vnode_label(intlabel, elements, buffer,
- mac.m_buflen);
- NDFREE(&nd, 0);
- mac_vnode_label_free(intlabel);
-
- if (error == 0)
- error = copyout(buffer, mac.m_string, strlen(buffer)+1);
-
-out:
- mtx_unlock(&Giant); /* VFS */
-
- free(buffer, M_MACTEMP);
- free(elements, M_MACTEMP);
-
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
-{
- struct label *intlabel;
- struct pipe *pipe;
- struct socket *so;
- struct file *fp;
- struct mount *mp;
- struct vnode *vp;
- struct mac mac;
- char *buffer;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL);
- if (error) {
- free(buffer, M_MACTEMP);
- return (error);
- }
-
- error = fget(td, uap->fd, &fp);
- if (error)
- goto out;
-
- switch (fp->f_type) {
- case DTYPE_FIFO:
- case DTYPE_VNODE:
- intlabel = mac_vnode_label_alloc();
- error = mac_internalize_vnode_label(intlabel, buffer);
- if (error) {
- mac_vnode_label_free(intlabel);
- break;
- }
- vp = fp->f_vnode;
- mtx_lock(&Giant); /* VFS */
- error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
- if (error != 0) {
- mtx_unlock(&Giant); /* VFS */
- mac_vnode_label_free(intlabel);
- break;
- }
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = vn_setlabel(vp, intlabel, td->td_ucred);
- VOP_UNLOCK(vp, 0, td);
- vn_finished_write(mp);
- mtx_unlock(&Giant); /* VFS */
- mac_vnode_label_free(intlabel);
- break;
-
- case DTYPE_PIPE:
- intlabel = mac_pipe_label_alloc();
- error = mac_internalize_pipe_label(intlabel, buffer);
- if (error == 0) {
- pipe = fp->f_data;
- PIPE_LOCK(pipe);
- error = mac_pipe_label_set(td->td_ucred,
- pipe->pipe_pair, intlabel);
- PIPE_UNLOCK(pipe);
- }
- mac_pipe_label_free(intlabel);
- break;
-
- case DTYPE_SOCKET:
- intlabel = mac_socket_label_alloc(M_WAITOK);
- error = mac_internalize_socket_label(intlabel, buffer);
- if (error == 0) {
- so = fp->f_data;
- NET_LOCK_GIANT();
- error = mac_socket_label_set(td->td_ucred, so,
- intlabel);
- NET_UNLOCK_GIANT();
- }
- mac_socket_label_free(intlabel);
- break;
-
- default:
- error = EINVAL;
- }
- fdrop(fp, td);
-out:
- free(buffer, M_MACTEMP);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_set_file(struct thread *td, struct __mac_set_file_args *uap)
-{
- struct label *intlabel;
- struct nameidata nd;
- struct mount *mp;
- struct mac mac;
- char *buffer;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL);
- if (error) {
- free(buffer, M_MACTEMP);
- return (error);
- }
-
- intlabel = mac_vnode_label_alloc();
- error = mac_internalize_vnode_label(intlabel, buffer);
- free(buffer, M_MACTEMP);
- if (error)
- goto out;
-
- mtx_lock(&Giant); /* VFS */
-
- NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p,
- td);
- error = namei(&nd);
- if (error == 0) {
- error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH);
- if (error == 0)
- error = vn_setlabel(nd.ni_vp, intlabel,
- td->td_ucred);
- vn_finished_write(mp);
- }
-
- NDFREE(&nd, 0);
- mtx_unlock(&Giant); /* VFS */
-out:
- mac_vnode_label_free(intlabel);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-__mac_set_link(struct thread *td, struct __mac_set_link_args *uap)
-{
- struct label *intlabel;
- struct nameidata nd;
- struct mount *mp;
- struct mac mac;
- char *buffer;
- int error;
-
- error = copyin(uap->mac_p, &mac, sizeof(mac));
- if (error)
- return (error);
-
- error = mac_check_structmac_consistent(&mac);
- if (error)
- return (error);
-
- buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
- error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL);
- if (error) {
- free(buffer, M_MACTEMP);
- return (error);
- }
-
- intlabel = mac_vnode_label_alloc();
- error = mac_internalize_vnode_label(intlabel, buffer);
- free(buffer, M_MACTEMP);
- if (error)
- goto out;
-
- mtx_lock(&Giant); /* VFS */
-
- NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p,
- td);
- error = namei(&nd);
- if (error == 0) {
- error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH);
- if (error == 0)
- error = vn_setlabel(nd.ni_vp, intlabel,
- td->td_ucred);
- vn_finished_write(mp);
- }
-
- NDFREE(&nd, 0);
- mtx_unlock(&Giant); /* VFS */
-out:
- mac_vnode_label_free(intlabel);
- return (error);
-}
-
-/*
- * MPSAFE
- */
-int
-mac_syscall(struct thread *td, struct mac_syscall_args *uap)
-{
- struct mac_policy_conf *mpc;
- char target[MAC_MAX_POLICY_NAME];
- int entrycount, error;
-
- error = copyinstr(uap->policy, target, sizeof(target), NULL);
- if (error)
- return (error);
-
- error = ENOSYS;
- LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) {
- if (strcmp(mpc->mpc_name, target) == 0 &&
- mpc->mpc_ops->mpo_syscall != NULL) {
- error = mpc->mpc_ops->mpo_syscall(td,
- uap->call, uap->arg);
- goto out;
- }
- }
-
- if ((entrycount = mac_policy_list_conditional_busy()) != 0) {
- LIST_FOREACH(mpc, &mac_policy_list, mpc_list) {
- if (strcmp(mpc->mpc_name, target) == 0 &&
- mpc->mpc_ops->mpo_syscall != NULL) {
- error = mpc->mpc_ops->mpo_syscall(td,
- uap->call, uap->arg);
- break;
- }
- }
- mac_policy_list_unbusy();
- }
-out:
- return (error);
-}
-
-SYSINIT(mac, SI_SUB_MAC, SI_ORDER_FIRST, mac_init, NULL);
-SYSINIT(mac_late, SI_SUB_MAC_LATE, SI_ORDER_FIRST, mac_late_init, NULL);
-
-#else /* !MAC */
-
-int
-__mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_get_file(struct thread *td, struct __mac_get_file_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_get_link(struct thread *td, struct __mac_get_link_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_set_file(struct thread *td, struct __mac_set_file_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-__mac_set_link(struct thread *td, struct __mac_set_link_args *uap)
-{
-
- return (ENOSYS);
-}
-
-int
-mac_syscall(struct thread *td, struct mac_syscall_args *uap)
-{
-
- return (ENOSYS);
-}
-
-#endif /* !MAC */
diff --git a/sys/sparc64/include/ofw_nexus.h b/sys/sparc64/include/ofw_nexus.h
deleted file mode 100644
index 959c9d2..0000000
--- a/sys/sparc64/include/ofw_nexus.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * Copyright (c) 1998, 1999 Eduardo E. Horvath
- * Copyright (c) 1999 Matthew R. 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.
- *
- * from: NetBSD: psychoreg.h,v 1.8 2001/09/10 16:17:06 eeh Exp
- *
- * $FreeBSD$
- */
-
-#ifndef _MACHINE_OFW_UPA_H_
-#define _MACHINE_OFW_UPA_H_
-
-/*
- * These are the regs and ranges property the psycho uses. They should be
- * applicable to all UPA devices. XXX: verify this.
- */
-
-struct upa_regs {
- u_int32_t phys_hi;
- u_int32_t phys_lo;
- u_int32_t size_hi;
- u_int32_t size_lo;
-};
-
-struct upa_ranges {
- u_int32_t cspace;
- u_int32_t child_hi;
- u_int32_t child_lo;
- u_int32_t phys_hi;
- u_int32_t phys_lo;
- u_int32_t size_hi;
- u_int32_t size_lo;
-};
-
-#define UPA_REG_PHYS(r) \
- (((u_int64_t)(r)->phys_hi << 32) | (u_int64_t)(r)->phys_lo)
-#define UPA_REG_SIZE(r) \
- (((u_int64_t)(r)->size_hi << 32) | (u_int64_t)(r)->size_lo)
-
-#define UPA_RANGE_CHILD(r) \
- (((u_int64_t)(r)->child_hi << 32) | (u_int64_t)(r)->child_lo)
-#define UPA_RANGE_PHYS(r) \
- (((u_int64_t)(r)->phys_hi << 32) | (u_int64_t)(r)->phys_lo)
-#define UPA_RANGE_SIZE(r) \
- (((u_int64_t)(r)->size_hi << 32) | (u_int64_t)(r)->size_lo)
-#define UPA_RANGE_CS(r) (((r)->cspace >> 24) & 0x03)
-
-#endif /* !_MACHINE_OFW_UPA_H_ */
diff --git a/sys/sys/_semaphore.h b/sys/sys/_semaphore.h
deleted file mode 100644
index a7bd5d8..0000000
--- a/sys/sys/_semaphore.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * Copyright (c) 2002 Alfred Perlstein <alfred@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-#ifndef __SEMAPHORE_H_
-#define __SEMAPHORE_H_
-
-typedef intptr_t semid_t;
-struct timespec;
-
-#ifndef _KERNEL
-
-#include <sys/cdefs.h>
-
-/*
- * Semaphore definitions.
- */
-struct sem {
-#define SEM_MAGIC ((u_int32_t) 0x09fa4012)
- u_int32_t magic;
- pthread_mutex_t lock;
- pthread_cond_t gtzero;
- u_int32_t count;
- u_int32_t nwaiters;
-#define SEM_USER (NULL)
- semid_t semid; /* semaphore id if kernel (shared) semaphore */
- int syssem; /* 1 if kernel (shared) semaphore */
- LIST_ENTRY(sem) entry;
- struct sem **backpointer;
-};
-
-__BEGIN_DECLS
-
-int ksem_close(semid_t id);
-int ksem_post(semid_t id);
-int ksem_wait(semid_t id);
-int ksem_trywait(semid_t id);
-int ksem_timedwait(semid_t id, struct timespec *abstime);
-int ksem_init(semid_t *idp, unsigned int value);
-int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode,
- unsigned int value);
-int ksem_unlink(const char *name);
-int ksem_getvalue(semid_t id, int *val);
-int ksem_destroy(semid_t id);
-
-__END_DECLS
-
-#endif /* !_KERNEL */
-
-#endif /* __SEMAPHORE_H_ */
diff --git a/sys/sys/ksem.h b/sys/sys/ksem.h
deleted file mode 100644
index 71979da..0000000
--- a/sys/sys/ksem.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * Copyright (c) 2002 Alfred Perlstein <alfred@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _POSIX4_KSEM_H_
-#define _POSIX4_KSEM_H_
-
-#ifndef _KERNEL
-#error "no user-servicable parts inside"
-#endif
-
-#include <sys/condvar.h>
-#include <sys/queue.h>
-
-struct kuser {
- pid_t ku_pid;
- LIST_ENTRY(kuser) ku_next;
-};
-
-struct ksem {
- LIST_ENTRY(ksem) ks_entry; /* global list entry */
- int ks_onlist; /* boolean if on a list (ks_entry) */
- char *ks_name; /* if named, this is the name */
- int ks_ref; /* number of references */
- mode_t ks_mode; /* protection bits */
- uid_t ks_uid; /* creator uid */
- gid_t ks_gid; /* creator gid */
- unsigned int ks_value; /* current value */
- struct cv ks_cv; /* waiters sleep here */
- int ks_waiters; /* number of waiters */
- LIST_HEAD(, kuser) ks_users; /* pids using this sem */
- struct label *ks_label; /* MAC label */
-};
-
-#endif /* !_POSIX4_KSEM_H_ */
diff --git a/sys/sys/posix4.h b/sys/sys/posix4.h
deleted file mode 100644
index b17e927..0000000
--- a/sys/sys/posix4.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef _P1003_1B_P1003_1B_H_
-#define _P1003_1B_P1003_1B_H_
-/*-
- * Copyright (c) 1996, 1997, 1998
- * HD Associates, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by HD Associates, Inc
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <sys/param.h>
-#include <sys/ioccom.h>
-#include <sys/malloc.h>
-#include <posix4/sched.h>
-
-/* Generate syscall stubs for when something is optionally
- * loadable as a module. References "syscall_not_present".
- * XXX Good candidate for sys/syscall.h
- */
-struct proc;
-struct nosys_args;
-extern int syscall_not_present(struct thread *, const char *, struct nosys_args *);
-
-#define SYSCALL_NOT_PRESENT_GEN(SC) \
-int SC (struct thread *td, struct SC##_args *uap) \
-{ \
- return syscall_not_present(td, #SC , (struct nosys_args *)uap); \
-}
-
-
-MALLOC_DECLARE(M_P31B);
-
-#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK)
-#define p31b_free(P) free((P), M_P31B)
-
-int p31b_proc(struct proc *, pid_t, struct proc **);
-
-void p31b_setcfg(int, int);
-int p31b_getcfg(int);
-int p31b_iscfg(int);
-
-#ifdef _KPOSIX_PRIORITY_SCHEDULING
-
-/*
- * KSCHED_OP_RW is a vector of read/write flags for each entry indexed
- * by the enum ksched_op.
- *
- * 1 means you need write access, 0 means read is sufficient.
- */
-
-enum ksched_op {
-
-#define KSCHED_OP_RW { 1, 0, 1, 0, 0, 0, 0, 0 }
-
- SCHED_SETPARAM,
- SCHED_GETPARAM,
- SCHED_SETSCHEDULER,
- SCHED_GETSCHEDULER,
- SCHED_YIELD,
- SCHED_GET_PRIORITY_MAX,
- SCHED_GET_PRIORITY_MIN,
- SCHED_RR_GET_INTERVAL,
- SCHED_OP_MAX
-};
-
-struct ksched;
-
-int ksched_attach(struct ksched **);
-int ksched_detach(struct ksched *);
-
-int ksched_setparam(register_t *, struct ksched *,
- struct thread *, const struct sched_param *);
-int ksched_getparam(register_t *, struct ksched *,
- struct thread *, struct sched_param *);
-
-int ksched_setscheduler(register_t *, struct ksched *,
- struct thread *, int, const struct sched_param *);
-int ksched_getscheduler(register_t *, struct ksched *, struct thread *);
-
-int ksched_yield(register_t *, struct ksched *);
-
-int ksched_get_priority_max(register_t *, struct ksched *, int);
-int ksched_get_priority_min(register_t *, struct ksched *, int);
-
-int ksched_rr_get_interval(register_t *, struct ksched *,
- struct thread *, struct timespec *);
-
-#endif /* _KPOSIX_PRIORITY_SCHEDULING */
-
-#endif /* _P1003_1B_P1003_1B_H_ */
diff --git a/sys/sys/semaphore.h b/sys/sys/semaphore.h
deleted file mode 100644
index 1806252..0000000
--- a/sys/sys/semaphore.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * Copyright (c) 1996, 1997
- * HD Associates, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by HD Associates, Inc
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/* semaphore.h: POSIX 1003.1b semaphores */
-
-#ifndef _SEMAPHORE_H_
-#define _SEMAPHORE_H_
-
-/* Opaque type definition. */
-struct sem;
-typedef struct sem * sem_t;
-
-#define SEM_FAILED ((sem_t *)0)
-#define SEM_VALUE_MAX (~0U) /* Equivalent to UINT_MAX. */
-
-#ifndef _KERNEL
-#include <sys/cdefs.h>
-
-struct timespec;
-
-__BEGIN_DECLS
-int sem_close(sem_t *);
-int sem_destroy(sem_t *);
-int sem_getvalue(sem_t * __restrict, int * __restrict);
-int sem_init(sem_t *, int, unsigned int);
-sem_t *sem_open(const char *, int, ...);
-int sem_post(sem_t *);
-int sem_timedwait(sem_t * __restrict, const struct timespec * __restrict);
-int sem_trywait(sem_t *);
-int sem_unlink(const char *);
-int sem_wait(sem_t *);
-__END_DECLS
-
-#endif
-
-#endif /* !_SEMAPHORE_H_ */
diff --git a/tools/kerneldoc/Doxyfile b/tools/kerneldoc/Doxyfile
deleted file mode 100644
index 146afc3..0000000
--- a/tools/kerneldoc/Doxyfile
+++ /dev/null
@@ -1,211 +0,0 @@
-# Doxyfile 1.3.6
-# $FreeBSD$
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "FreeBSD Kernel"
-PROJECT_NUMBER =
-OUTPUT_DIRECTORY =
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = YES
-STRIP_FROM_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = YES
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = NO
-WARN_IF_DOC_ERROR = NO
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT =
-FILE_PATTERNS = *.c \
- *.h
-RECURSIVE = YES
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = YES
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED = _KERNEL
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE = kernel.tags
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
diff --git a/tools/kerneldoc/Makefile b/tools/kerneldoc/Makefile
deleted file mode 100644
index ec665a7..0000000
--- a/tools/kerneldoc/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/../kern
-
-SRCS+= kern
-SRCS+= sys
-MFILES+= device_if.m
-MFILES+= bus_if.m
-
-all: ${MFILES:T:S/.m/.h/} ${SRCS}
- doxygen
-
-LN?= ln
-AWK?= awk
-S?= ${.CURDIR}/..
-
-CLEANFILES+= ${SRCS}
-.for dir in ${SRCS}
-${dir}:
- ${LN} -sf ${.CURDIR}/../${dir} .
-.endfor
-
-.for mfile in ${MFILES}
-CLEANFILES+= ${mfile:T:S/.m$/.h/}
-${mfile:T:S/.m$/.h/}: ${mfile}
- ${AWK} -f $S/tools/makeobjops.awk $> -h
-.endfor
-
-clean::
- rm -f ${CLEANFILES}
diff --git a/tools/regression/usr.bin/sed/hanoi.sed b/tools/regression/usr.bin/sed/hanoi.sed
deleted file mode 100644
index 6a45dea..0000000
--- a/tools/regression/usr.bin/sed/hanoi.sed
+++ /dev/null
@@ -1,103 +0,0 @@
-# Towers of Hanoi in sed.
-#
-# @(#)hanoi.sed 8.1 (Berkeley) 6/6/93
-# $FreeBSD$
-#
-#
-# Ex:
-# Run "sed -f hanoi.sed", and enter:
-#
-# :abcd: : :<CR>
-#
-# note -- TWO carriage returns were once required, this will output the
-# sequence of states involved in moving 4 rings, the largest called "a" and
-# the smallest called "d", from the first to the second of three towers, so
-# that the rings on any tower at any time are in descending order of size.
-# You can start with a different arrangement and a different number of rings,
-# say :ce:b:ax: and it will give the shortest procedure for moving them all
-# to the middle tower. The rules are: the names of the rings must all be
-# lower-case letters, they must be input within 3 fields (representing the
-# towers) and delimited by 4 colons, such that the letters within each field
-# are in alphabetical order (i.e. rings are in descending order of size).
-#
-# For the benefit of anyone who wants to figure out the script, an "internal"
-# line of the form
-# b:0abx:1a2b3 :2 :3x2
-# has the following meaning: the material after the three markers :1, :2,
-# and :3 represents the three towers; in this case the current set-up is
-# ":ab : :x :". The numbers after a, b and x in these fields indicate
-# that the next time it gets a chance, it will move a to tower 2, move b
-# to tower 3, and move x to tower 2. The string after :0 just keeps track
-# of the alphabetical order of the names of the rings. The b at the
-# beginning means that it is now dealing with ring b (either about to move
-# it, or re-evaluating where it should next be moved to).
-#
-# Although this version is "limited" to 26 rings because of the size of the
-# alphabet, one could write a script using the same idea in which the rings
-# were represented by arbitrary [strings][within][brackets], and in place of
-# the built-in line of the script giving the order of the letters of the
-# alphabet, it would accept from the user a line giving the ordering to be
-# assumed, e.g. [ucbvax][decvax][hplabs][foo][bar].
-#
-# George Bergman
-# Math, UC Berkeley 94720 USA
-
-# cleaning, diagnostics
-s/ *//g
-/^$/d
-/[^a-z:]/{a\
-Illegal characters: use only a-z and ":". Try again.
-d
-}
-/^:[a-z]*:[a-z]*:[a-z]*:$/!{a\
-Incorrect format: use\
-\ : string1 : string2 : string3 :<CR>\
-Try again.
-d
-}
-/\([a-z]\).*\1/{a\
-Repeated letters not allowed. Try again.
-d
-}
-# initial formatting
-h
-s/[a-z]/ /g
-G
-s/^:\( *\):\( *\):\( *\):\n:\([a-z]*\):\([a-z]*\):\([a-z]*\):$/:1\4\2\3:2\5\1\3:3\6\1\2:0/
-s/[a-z]/&2/g
-s/^/abcdefghijklmnopqrstuvwxyz/
-:a
-s/^\(.\).*\1.*/&\1/
-s/.//
-/^[^:]/ba
-s/\([^0]*\)\(:0.*\)/\2\1:/
-s/^[^0]*0\(.\)/\1&/
-:b
-# outputting current state without markers
-h
-s/.*:1/:/
-s/[123]//gp
-g
-:c
-# establishing destinations
-/^\(.\).*\1:1/td
-/^\(.\).*:1[^:]*\11/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\31/
-/^\(.\).*:1[^:]*\12/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\33/
-/^\(.\).*:1[^:]*\13/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\32/
-/^\(.\).*:2[^:]*\11/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\33/
-/^\(.\).*:2[^:]*\12/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\32/
-/^\(.\).*:2[^:]*\13/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\31/
-/^\(.\).*:3[^:]*\11/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\32/
-/^\(.\).*:3[^:]*\12/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\31/
-/^\(.\).*:3[^:]*\13/s/^\(.\)\(.*\1\([a-z]\).*\)\3./\3\2\33/
-bc
-# iterate back to find smallest out-of-place ring
-:d
-s/^\(.\)\(:0[^:]*\([^:]\)\1.*:\([123]\)[^:]*\1\)\4/\3\2\4/
-td
-# move said ring (right, resp. left)
-s/^\(.\)\(.*\)\1\([23]\)\(.*:\3[^ ]*\) /\1\2 \4\1\3/
-s/^\(.\)\(.*:\([12]\)[^ ]*\) \(.*\)\1\3/\1\2\1\3\4 /
-tb
-s/.*/Done! Try another, or end with ^D./p
-d
diff --git a/tools/regression/usr.bin/sed/math.sed b/tools/regression/usr.bin/sed/math.sed
deleted file mode 100644
index cdd18d6..0000000
--- a/tools/regression/usr.bin/sed/math.sed
+++ /dev/null
@@ -1,439 +0,0 @@
-# This is ksb's infamous sed calculator. (ksb@sa.fedex.com)
-#
-# $FreeBSD$
-#
-# $Id: math.sed,v 2.5 1998/08/02 13:23:34 ksb Exp ksb $
-# expr ::= (expr) | expr! |
-# expr ^ expr |
-# -expr | expr * expr | expr / expr | expr % expr |
-# expr + expr | expr - expr |
-# [0-9][0-9]* ;
-# Bugs: some sign combinations don't work, and I got sick of added cases
-# for unary +. Don't depend on signed math working all the time. -- ksb
-#
-# $Compile: echo "4+7*3+2^7/3" | sed -f %f
-
-# make sure the expression is well formed
-s/[ ]//g
-/[*\/^%+-]$/{
- a\
- poorly formed expression, dyadic operator on the end
- q
-}
-/^[*\/^%]/{
- a\
- poorly formed expression, leading dyadic operator
- q
-}
-
-# fill hold space with done token
-x
-s/^.*/done/
-x
-
-# main loop, process operators ((), !, *, /, %, +, and -)
-: loop
-# uncomment the print below to follow the "logic" -- ksb
-#p
-/^[+]/{
- s///
- b loop
-}
-/^--/{
- s///
- b loop
-}
-# eval parenthesised sub expressions first
-/^\(.*\)(\([^)]*\))\(.*\)$/{
- H
- s//\2/
- x
- s/^\(.*\)\n\(.*\)(\([^()]*\))\(.*\)$/()\2@\4@\1/
- x
- b loop
-}
-# reduce a^b^c -> a^(b^c)
-/\([0-9][0-9]*^\)\([0-9][0-9]*^[0-9][0-9^]*\)/{
- s//\1(\2)/
- b loop
-}
-# pull any burried exponents
-/^\(.*[^0-9]\)\([0-9][0-9]*^[0-9][0-9]*\)$/{
- s//\1(\2)/
- b loop
-}
-/^\(.*[^0-9]\)\([0-9][0-9]*^[0-9][0-9]*\)\([^0-9].*\)$/{
- s//\1(\2)\3/
- b loop
-}
-/^\([0-9][0-9]*^[0-9][0-9]*\)\([^0-9].*\)$/{
- s//(\1)\2/
- b loop
-}
-/^\([-]*[0-9]*\)^0*$/{
- s//1/
- b loop
-}
-/^\([-]*[0-9]*\)^0*1$/{
- s//\1/
- b loop
-}
-/^\([-]*[0-9]*\)^-[0-9]*$/{
- s//0/
- b loop
-}
-/^\([-]*\)\([0-9]*\)^\([0-9][0-9]*[13579]\)$/{
- s//\1\2*((\2*\2)^(\3\/2))/
- b loop
-}
-/^[-]*\([0-9]*\)^\([0-9][0-9]*[02468]\)$/{
- s//(\1*\1)^(\2\/2)/
- b loop
-}
-# single digit powers (2 3,9 4,6,8 5,7
-/^[-]*\([0-9]*\)^0*2$/{
- s//(\1*\1)/
- b loop
-}
-/^\([-]*\)\([0-9]*\)^0*\([39]\)$/{
- s//\1(\2*(\2*\2))^(\3\/3)/
- b loop
-}
-/^[-]*\([0-9]*\)^0*\([468]\)$/{
- s//(\1*\1)^(\2\/2)/
- b loop
-}
-# 5 7
-/^\([-]*[0-9]*\)^\([0-9]*\)$/{
- s//\1*(\1^(\2-1))/
- b loop
-}
-# reduce all number factorials
-/^0*[01]!/{
- s//1/
- b loop
-}
-/\([*+-/%^]\)0*[01]!/{
- s//\11/
- b loop
-}
-/\([0-9]*\)!/{
- s//(\1-1)!*\1/
- b loop
-}
-# sign simplifications
-/^-\([0-9]*\)\([*/%]\)-\([0-9]*\)$/{
- s//\1\2\3/
- b loop
-}
-/^\([0-9]*\)\([*/%]\)-\([0-9]*\)$/{
- s//-\1\2\3/
- b loop
-}
-/^-\([0-9][0-9]*\)[+]*-\([0-9][0-9]*\)$/{
- s//\1+\2/
- x
- s/\(.*\)/()-@@\1/
- x
- b loop
-}
-/^-\([0-9]*\)[+]\([0-9]\)*$/{
- s//\2-\1/
- b loop
-}
-/^-.*[-+*/%].*/{
- H
- s/^-//
- x
- s/^\(.*\)\n-.*$/()-@@\1/
- x
- b loop
-}
-# can we simplify multiplications
-/^\([0-9]*\)\([*][0-9]*[1-9]\)00*$/{
- H
- s//\1\2/
- x
- s/^\(.*\)\n[0-9]*[*][0-9]*[1-9]\(00*\)$/()@\2@\1/
- x
- b loop
-}
-/^\([0-9][1-9]*\)00*\([*][0-9]*\)$/{
- H
- s//\1\2/
- x
- s/^\(.*\)\n[0-9][1-9]*\(00*\)[*][0-9]*$/()@\2@\1/
- x
- b loop
-}
-# can we simplify division (20/30 -> 2/3)
-/^\([0-9][0-9]*\)0\([/%]\)\([0-9][0-9]*\)0$/{
- s//\1\2\3/
- b loop
-}
-# n/1 -> n
-/^0*\([0-9][0-9]*\)0[/]0*1$/{
- s//\1/
- b loop
-}
-# n%2 -> last_digit(n)%2 (same for 1, BTW) N.B. NO LOOP
-/^[0-9]*\([0-9]\)%0*\([12]\)$/{
- s//\1%\2/
-}
-# move any mul/divs to the front via parans
-/^\([0-9+]*\)\([-+]\)\([0-9]*[*/][0-9*/]*\)/{
- s//\1\2(\3)/
- b loop
-}
-# can we div or mul
-/^[0-9]*[*][0-9]*$/{
- b mul
-}
-/^[0-9]*[/%]0*$/{
- i\
-divide by zero
- d
-}
-/^[0-9]*[/%][0-9]*$/{
- H
- s/\([0-9]\).*[/%]/\1-/
- x
- s/^\(.*\)\n\([0-9]\)\([0-9]*\)\([/%]\)\([0-9]*\).*$/.\4\3q0r\2-\5@\1/
- x
- b loop
-}
-/^\([0-9]*[*/%][0-9]*\)\(.*\)/{
- H
- s//\1/
- x
- s/^\(.*\)\n\([0-9]*[*/][0-9]*\)\(.*\)$/()@\3@\1/
- x
- b loop
-}
-# can we add or subtract -- note subtract hold expression for underflow
-/^[0-9]*[+][0-9]*$/{
- s/$/=/
- b add
-}
-/^[0-9][0-9]*-[0-9]*$/{
- H
- s/$/=/
- b sub
-}
-/^\([0-9][0-9]*[-+][0-9]*\)\(.*\)/{
- H
- s//\1/
- x
- s/^\(.*\)\n\([0-9]*[-+][0-9]*\)\(.*\)$/()@\3@\1/
- x
- b loop
-}
-# look in hold space for stack to reduce
-x
-/^done$/{
- x
- s/^0*\([0-9][0-9]*\)/\1/
- p
- d
-}
-# .[/%] numerator q quotient r remainder-divisor @stack
-/^\./{
- x
- /^[^-]/{
- H
- x
- s/.\(.\)\([0-9]*\)q\([^r]*\)r\([0-9]*\)-\([0-9]*\)@\(.*\)\n\(.*\)/.\1\2q\3+1r\7-\5@\6/
- h
- s/..[0-9]*q[^r]*r\([0-9]*-[0-9]*\)@.*/\1/
- b loop
- }
- /^-/{
- g
- /.\(.\)\([0-9]\)\([0-9]*\)q\([^r]*\)r0*\([0-9]*\)-\([^@]*\)@.*/{
- s//\5\2-\6/
- x
- s/.\(.\)\([0-9]\)\([0-9]*\)q\([^r]*\)r0*\([0-9]*\)-\([0-9]*\)@\(.*\)/.\1\3q(\4)*10r\5\2-\6@\7/
- x
- b loop
- }
-# no digits to shift on
- s/^\.[/]q\([^r]*\)r[^@]*@.*/\1/
- s/^\.[%]q[^r]*r0*\([0-9][0-9]*\)-[^@]*@.*/\1/
- /^\./{
- i\
-divide error
- q
- }
- x
- s/^\.[/%]q[^r]*r[^@]*@\(.*\)/\1/
- x
- b loop
- }
-}
-/^()/{
- s///
- x
- G
- s/\(.*\)\n\([^@]*\)@\([^@]*\)@\(.*\)/\2\1\3/
- x
- s/[^@]*@[^@]*@\(.*\)/\1/
- x
- b loop
-}
-i\
-help, stack problem - the hold space
-p
-x
-i\
-and the pat space
-p
-i\
-quit
-q
-
-# turn mul into add until 1*x -> x, 0*x -> 0
-: mul
-/^00*\*.*/{
- s//0/
- b loop
-}
-/^0*1\*/{
- s///
-: leading
- s/^0*\([0-9][0-9]*\)/\1/
- b loop
-}
-s/^\([0-9]*\)0\*\([0-9]*\)/\1*\20/
-s/^\([0-9]*\)1\*\([0-9]*\)/\1*\20+\2/
-s/^\([0-9]*\)2\*\([0-9]*\)/\1*\20+(\2+\2)/
-s/^\([0-9]*\)3\*\([0-9]*\)/\1*\20+(\2+\2+\2)/
-s/^\([0-9]*\)4\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2)/
-s/^\([0-9]*\)5\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2)/
-s/^\([0-9]*\)6\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2)/
-s/^\([0-9]*\)7\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2+\2)/
-s/^\([0-9]*\)8\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2+\2+\2)/
-s/^\([0-9]*\)9\*\([0-9]*\)/\1*\20+(\2+\2+\2+\2+\2+\2+\2+\2+\2)/
-/^0*\*[0-9]*[+]*\(.*\)/{
- s//\1/
- b loop
-}
-b mul
-
-# get rid of a plus term until 0+x -> x
-: add
-/^[+]\([0-9+*]*\)=/{
- s//\1/
- b leading
-}
-/^\([0-9*]*\)[+]=/{
- s//\1/
- b loop
-}
-/^\([0-9]*\)0[+]\([0-9]*\)\([0-9]\)=/{
- s//\1+\2=\3/
- b add
-}
-/^\([0-9]*\)\([0-9]\)[+]\([0-9]*\)0=/{
- s//\1+\3=\2/
- b add
-}
-s/^\([0-9]*\)1[+]/\10+/
-s/^\([0-9]*\)2[+]/\11+/
-s/^\([0-9]*\)3[+]/\12+/
-s/^\([0-9]*\)4[+]/\13+/
-s/^\([0-9]*\)5[+]/\14+/
-s/^\([0-9]*\)6[+]/\15+/
-s/^\([0-9]*\)7[+]/\16+/
-s/^\([0-9]*\)8[+]/\17+/
-s/^\([0-9]*\)9[+]/\18+/
-
-s/9=\([0-9]*\)$/_=\1/
-s/8=\([0-9]*\)$/9=\1/
-s/7=\([0-9]*\)$/8=\1/
-s/6=\([0-9]*\)$/7=\1/
-s/5=\([0-9]*\)$/6=\1/
-s/4=\([0-9]*\)$/5=\1/
-s/3=\([0-9]*\)$/4=\1/
-s/2=\([0-9]*\)$/3=\1/
-s/1=\([0-9]*\)$/2=\1/
-/_/{
- s//_0/
- : inc
- s/9_/_0/
- s/8_/9/
- s/7_/8/
- s/6_/7/
- s/5_/6/
- s/4_/5/
- s/3_/4/
- s/2_/3/
- s/1_/2/
- s/0_/1/
- s/[+]_/+1/
- /_/b inc
-}
-b add
-
-# get rid of a sub term until /-0*=/ or underflow
-: sub
-/^\([0-9]*\)-0*=/{
- s//\1/
- x
- s/\(.*\)\n.*$/\1/
- x
- b leading
-}
-/^-\([0-9].*\)=/{
-: under
- g
- s/.*\n\([0-9]*\)-\([0-9]*\).*/-(\2-\1)/
- x
- s/\(.*\)\n.*/\1/
- x
- b loop
-}
-/^\([0-9]*\)\([0-9]\)-\([0-9]*\)0=/{
- s//\1-\3=\2/
- b sub
-}
-s/1=/0=/
-s/2=/1=/
-s/3=/2=/
-s/4=/3=/
-s/5=/4=/
-s/6=/5=/
-s/7=/6=/
-s/8=/7=/
-s/9=/8=/
-
-s/^\([0-9]*\)1-/\1_-/
-s/^\([0-9]*\)2-/\11-/
-s/^\([0-9]*\)3-/\12-/
-s/^\([0-9]*\)4-/\13-/
-s/^\([0-9]*\)5-/\14-/
-s/^\([0-9]*\)6-/\15-/
-s/^\([0-9]*\)7-/\16-/
-s/^\([0-9]*\)8-/\17-/
-s/^\([0-9]*\)9-/\18-/
-s/^\([0-9]*\)0-/\1'9-/
-s/_/0/
-
-: scarry
-/0'/{
- s//'9/
- b scarry
-}
-/^'/{
- b under
-}
-s/1'/0/
-s/2'/1/
-s/3'/2/
-s/4'/3/
-s/5'/4/
-s/6'/5/
-s/7'/6/
-s/8'/7/
-s/9'/8/
-
-b sub
diff --git a/tools/regression/usr.bin/sed/multitest.t b/tools/regression/usr.bin/sed/multitest.t
deleted file mode 100644
index 801e392..0000000
--- a/tools/regression/usr.bin/sed/multitest.t
+++ /dev/null
@@ -1,556 +0,0 @@
-#!/bin/sh -
-#
-# Copyright (c) 1992 Diomidis Spinellis.
-# 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.
-# 4. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# @(#)sed.test 8.1 (Berkeley) 6/6/93
-#
-# $FreeBSD$
-#
-
-# sed Regression Tests
-#
-# The following files are created:
-# lines[1-4], script1, script2
-# Two directories *.out contain the test results
-
-main()
-{
- BASE=/usr/bin/sed
- BASELOG=sed.out
- TEST=`cd ..; make whereobj`/sed
- TESTLOG=nsed.out
- DICT=/usr/share/dict/words
-
- test_error | more
-
- awk 'END { for (i = 1; i < 15; i++) print "l1_" i}' </dev/null >lines1
- awk 'END { for (i = 1; i < 10; i++) print "l2_" i}' </dev/null >lines2
-
- exec 4>&1 5>&2
-
- # Set these flags to get messages about known problems
- BSD=1
- GNU=0
- SUN=0
- tests $BASE $BASELOG
-
- BSD=0
- GNU=0
- SUN=0
- tests $TEST $TESTLOG
- exec 1>&4 2>&5
- diff -c $BASELOG $TESTLOG | more
-}
-
-tests()
-{
- SED=$1
- DIR=$2
- rm -rf $DIR
- mkdir $DIR
- MARK=100
-
- test_args
- test_addr
- echo Testing commands
- test_group
- test_acid
- test_branch
- test_pattern
- test_print
- test_subst
-}
-
-mark()
-{
- MARK=`expr $MARK + 1`
- exec 1>&4 2>&5
- exec >"$DIR/${MARK}_$1"
- echo "Test $1:$MARK"
- # Uncomment this line to match tests with sed error messages
- echo "Test $1:$MARK" >&5
-}
-
-test_args()
-{
- mark '1.1'
- echo Testing argument parsing
- echo First type
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED 's/^/e1_/p' lines1
- fi
- mark '1.2' ; $SED -n 's/^/e1_/p' lines1
- mark '1.3'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED 's/^/e1_/p' <lines1
- fi
- mark '1.4' ; $SED -n 's/^/e1_/p' <lines1
- echo Second type
- mark '1.4.1'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed fails this
- fi
- $SED -e '' <lines1
- echo 's/^/s1_/p' >script1
- echo 's/^/s2_/p' >script2
- mark '1.5'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -f script1 lines1
- fi
- mark '1.6'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -f script1 <lines1
- fi
- mark '1.7'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -e 's/^/e1_/p' lines1
- fi
- mark '1.8'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -e 's/^/e1_/p' <lines1
- fi
- mark '1.9' ; $SED -n -f script1 lines1
- mark '1.10' ; $SED -n -f script1 <lines1
- mark '1.11' ; $SED -n -e 's/^/e1_/p' lines1
- mark '1.12'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -n -e 's/^/e1_/p' <lines1
- fi
- mark '1.13'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -e 's/^/e1_/p' -e 's/^/e2_/p' lines1
- fi
- mark '1.14'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -f script1 -f script2 lines1
- fi
- mark '1.15'
- if [ $GNU -eq 1 -o $SUN -eq 1 ] ; then
- echo GNU and SunOS sed fail this following older POSIX draft
- else
- $SED -e 's/^/e1_/p' -f script1 lines1
- fi
- mark '1.16'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -e 's/^/e1_/p' lines1 lines1
- fi
- # POSIX D11.2:11251
- mark '1.17' ; $SED p <lines1 lines1
-cat >script1 <<EOF
-#n
-# A comment
-
-p
-EOF
- mark '1.18' ; $SED -f script1 <lines1 lines1
-}
-
-test_addr()
-{
- echo Testing address ranges
- mark '2.1' ; $SED -n -e '4p' lines1
- mark '2.2' ; $SED -n -e '20p' lines1 lines2
- mark '2.3' ; $SED -n -e '$p' lines1
- mark '2.4' ; $SED -n -e '$p' lines1 lines2
- mark '2.5' ; $SED -n -e '$a\
-hello' /dev/null
- mark '2.6' ; $SED -n -e '$p' lines1 /dev/null lines2
- # Should not print anything
- mark '2.7' ; $SED -n -e '20p' lines1
- mark '2.8' ; $SED -n -e '0p' lines1
- mark '2.9' ; $SED -n '/l1_7/p' lines1
- mark '2.10' ; $SED -n ' /l1_7/ p' lines1
- mark '2.11'
- if [ $BSD -eq 1 ] ; then
- echo BSD sed fails this test
- fi
- if [ $GNU -eq 1 ] ; then
- echo GNU sed fails this
- fi
- $SED -n '\_l1\_7_p' lines1
- mark '2.12' ; $SED -n '1,4p' lines1
- mark '2.13' ; $SED -n '1,$p' lines1 lines2
- mark '2.14' ; $SED -n '1,/l2_9/p' lines1 lines2
- mark '2.15' ; $SED -n '/4/,$p' lines1 lines2
- mark '2.16' ; $SED -n '/4/,20p' lines1 lines2
- mark '2.17' ; $SED -n '/4/,/10/p' lines1 lines2
- mark '2.18' ; $SED -n '/l2_3/,/l1_8/p' lines1 lines2
- mark '2.19'
- if [ $GNU -eq 1 ] ; then
- echo GNU sed fails this
- fi
- $SED -n '12,3p' lines1 lines2
- mark '2.20'
- if [ $GNU -eq 1 ] ; then
- echo GNU sed fails this
- fi
- $SED -n '/l1_7/,3p' lines1 lines2
-}
-
-test_group()
-{
- echo Brace and other grouping
- mark '3.1' ; $SED -e '
-4,12 {
- s/^/^/
- s/$/$/
- s/_/T/
-}' lines1
- mark '3.2' ; $SED -e '
-4,12 {
- s/^/^/
- /6/,/10/ {
- s/$/$/
- /8/ s/_/T/
- }
-}' lines1
- mark '3.3' ; $SED -e '
-4,12 !{
- s/^/^/
- /6/,/10/ !{
- s/$/$/
- /8/ !s/_/T/
- }
-}' lines1
- mark '3.4' ; $SED -e '4,12!s/^/^/' lines1
-}
-
-test_acid()
-{
- echo Testing a c d and i commands
- mark '4.1' ; $SED -n -e '
-s/^/before_i/p
-20i\
-inserted
-s/^/after_i/p
-' lines1 lines2
- mark '4.2' ; $SED -n -e '
-5,12s/^/5-12/
-s/^/before_a/p
-/5-12/a\
-appended
-s/^/after_a/p
-' lines1 lines2
- mark '4.3'
- if [ $GNU -eq 1 ] ; then
- echo GNU sed fails this
- fi
- $SED -n -e '
-s/^/^/p
-/l1_/a\
-appended
-8,10N
-s/$/$/p
-' lines1 lines2
- mark '4.4' ; $SED -n -e '
-c\
-hello
-' lines1
- mark '4.5' ; $SED -n -e '
-8c\
-hello
-' lines1
- mark '4.6' ; $SED -n -e '
-3,14c\
-hello
-' lines1
-# SunOS and GNU sed behave differently. We follow POSIX
-# mark '4.7' ; $SED -n -e '
-#8,3c\
-#hello
-#' lines1
- mark '4.8' ; $SED d <lines1
-}
-
-test_branch()
-{
- echo Testing labels and branching
- mark '5.1' ; $SED -n -e '
-b label4
-:label3
-s/^/label3_/p
-b end
-:label4
-2,12b label1
-b label2
-:label1
-s/^/label1_/p
-b
-:label2
-s/^/label2_/p
-b label3
-:end
-' lines1
- mark '5.2'
- if [ $BSD -eq 1 ] ; then
- echo BSD sed fails this test
- fi
- $SED -n -e '
-s/l1_/l2_/
-t ok
-b
-:ok
-s/^/tested /p
-' lines1 lines2
-# SunOS sed behaves differently here. Clarification needed.
-# mark '5.3' ; $SED -n -e '
-#5,8b inside
-#1,5 {
-# s/^/^/p
-# :inside
-# s/$/$/p
-#}
-#' lines1
-# Check that t clears the substitution done flag
- mark '5.4' ; $SED -n -e '
-1,8s/^/^/
-t l1
-:l1
-t l2
-s/$/$/p
-b
-:l2
-s/^/ERROR/
-' lines1
-# Check that reading a line clears the substitution done flag
- mark '5.5'
- if [ $BSD -eq 1 ] ; then
- echo BSD sed fails this test
- fi
- $SED -n -e '
-t l2
-1,8s/^/^/p
-2,7N
-b
-:l2
-s/^/ERROR/p
-' lines1
- mark '5.6' ; $SED 5q lines1
- mark '5.7' ; $SED -e '
-5i\
-hello
-5q' lines1
-# Branch across block boundary
- mark '5.8' ; $SED -e '
-{
-:b
-}
-s/l/m/
-tb' lines1
-}
-
-test_pattern()
-{
-echo Pattern space commands
-# Check that the pattern space is deleted
- mark '6.1' ; $SED -n -e '
-c\
-changed
-p
-' lines1
- mark '6.2' ; $SED -n -e '
-4d
-p
-' lines1
-# SunOS sed refused to print here
-# mark '6.3' ; $SED -e '
-#N
-#N
-#N
-#D
-#P
-#4p
-#' lines1
- mark '6.4' ; $SED -e '
-2h
-3H
-4g
-5G
-6x
-6p
-6x
-6p
-' lines1
- mark '6.5' ; $SED -e '4n' lines1
- mark '6.6' ; $SED -n -e '4n' lines1
-}
-
-test_print()
-{
- echo Testing print and file routines
- awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \
- </dev/null >lines3
- # GNU and SunOS sed behave differently here
- mark '7.1'
- $SED -n l lines3
- mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
- rm -f lines4
- mark '7.3' ; $SED -e '3,12w lines4' lines1
- echo w results
- cat lines4
- mark '7.4' ; $SED -e '4r lines2' lines1
- mark '7.5' ; $SED -e '5r /dev/dds' lines1
- mark '7.6' ; $SED -e '6r /dev/null' lines1
- mark '7.7'
- if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then
- echo BSD, GNU and SunOS cannot pass this one
- else
- sed '200q' $DICT | sed 's$.*$s/^/&/w tmpdir/&$' >script1
- rm -rf tmpdir
- mkdir tmpdir
- $SED -f script1 lines1
- cat tmpdir/*
- rm -rf tmpdir
- fi
- mark '7.8'
- if [ $BSD -eq 1 ] ; then
- echo BSD sed cannot pass 7.7
- else
- echo line1 > lines3
- echo "" >> lines3
- $SED -n -e '$p' lines3 /dev/null
- fi
-
-}
-
-test_subst()
-{
- echo Testing substitution commands
- mark '8.1' ; $SED -e 's/./X/g' lines1
- mark '8.2' ; $SED -e 's,.,X,g' lines1
-# GNU and SunOS sed thinks we are escaping . as wildcard, not as separator
-# mark '8.3' ; $SED -e 's.\..X.g' lines1
-# POSIX does not say that this should work
-# mark '8.4' ; $SED -e 's/[/]/Q/' lines1
- mark '8.4' ; $SED -e 's/[\/]/Q/' lines1
- mark '8.5' ; $SED -e 's_\__X_' lines1
- mark '8.6' ; $SED -e 's/./(&)/g' lines1
- mark '8.7' ; $SED -e 's/./(\&)/g' lines1
- mark '8.8' ; $SED -e 's/\(.\)\(.\)\(.\)/x\3x\2x\1/g' lines1
- mark '8.9' ; $SED -e 's/_/u0\
-u1\
-u2/g' lines1
- mark '8.10'
- if [ $BSD -eq 1 -o $GNU -eq 1 ] ; then
- echo 'BSD/GNU sed do not understand digit flags on s commands'
- fi
- $SED -e 's/./X/4' lines1
- rm -f lines4
- mark '8.11' ; $SED -e 's/1/X/w lines4' lines1
- echo s wfile results
- cat lines4
- mark '8.12' ; $SED -e 's/[123]/X/g' lines1
- mark '8.13' ; $SED -e 'y/0123456789/9876543210/' lines1
- mark '8.14' ;
- if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then
- echo BSD/GNU/SUN sed fail this test
- else
- $SED -e 'y10\123456789198765432\101' lines1
- fi
- mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
- mark '8.16'
- echo 'eeefff' | $SED -e '
- p
- s/e/X/p
- :x
- s//Y/p
- # Establish limit counter in the hold space
- # GNU sed version 3.02 enters into an infinite loop here
- x
- /.\{10\}/ {
- s/.*/ERROR/
- b
- }
- s/.*/&./
- x
- /f/bx
- '
-}
-
-test_error()
-{
- exec 0>&3 4>&1 5>&2
- exec 0</dev/null
- exec 2>&1
- set -x
- $TEST -x && exit 1
- $TEST -f && exit 1
- $TEST -e && exit 1
- $TEST -f /dev/dds && exit 1
- $TEST p /dev/dds && exit 1
- $TEST -f /bin/sh && exit 1
- $TEST '{' && exit 1
- $TEST '{' && exit 1
- $TEST '/hello/' && exit 1
- $TEST '1,/hello/' && exit 1
- $TEST -e '-5p' && exit 1
- $TEST '/jj' && exit 1
- $TEST 'a hello' && exit 1
- $TEST 'a \ hello' && exit 1
- $TEST 'b foo' && exit 1
- $TEST 'd hello' && exit 1
- $TEST 's/aa' && exit 1
- $TEST 's/aa/' && exit 1
- $TEST 's/a/b' && exit 1
- $TEST 's/a/b/c/d' && exit 1
- $TEST 's/a/b/ 1 2' && exit 1
- $TEST 's/a/b/ 1 g' && exit 1
- $TEST 's/a/b/w' && exit 1
- $TEST 'y/aa' && exit 1
- $TEST 'y/aa/b/' && exit 1
- $TEST 'y/aa/' && exit 1
- $TEST 'y/a/b' && exit 1
- $TEST 'y/a/b/c/d' && exit 1
- $TEST '!' && exit 1
- $TEST supercalifrangolisticexprialidociussupercalifrangolisticexcius
- set +x
- exec 0>&3 1>&4 2>&5
-}
-
-main
diff --git a/tools/regression/usr.bin/sed/sed.test b/tools/regression/usr.bin/sed/sed.test
deleted file mode 100644
index 801e392..0000000
--- a/tools/regression/usr.bin/sed/sed.test
+++ /dev/null
@@ -1,556 +0,0 @@
-#!/bin/sh -
-#
-# Copyright (c) 1992 Diomidis Spinellis.
-# 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.
-# 4. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# @(#)sed.test 8.1 (Berkeley) 6/6/93
-#
-# $FreeBSD$
-#
-
-# sed Regression Tests
-#
-# The following files are created:
-# lines[1-4], script1, script2
-# Two directories *.out contain the test results
-
-main()
-{
- BASE=/usr/bin/sed
- BASELOG=sed.out
- TEST=`cd ..; make whereobj`/sed
- TESTLOG=nsed.out
- DICT=/usr/share/dict/words
-
- test_error | more
-
- awk 'END { for (i = 1; i < 15; i++) print "l1_" i}' </dev/null >lines1
- awk 'END { for (i = 1; i < 10; i++) print "l2_" i}' </dev/null >lines2
-
- exec 4>&1 5>&2
-
- # Set these flags to get messages about known problems
- BSD=1
- GNU=0
- SUN=0
- tests $BASE $BASELOG
-
- BSD=0
- GNU=0
- SUN=0
- tests $TEST $TESTLOG
- exec 1>&4 2>&5
- diff -c $BASELOG $TESTLOG | more
-}
-
-tests()
-{
- SED=$1
- DIR=$2
- rm -rf $DIR
- mkdir $DIR
- MARK=100
-
- test_args
- test_addr
- echo Testing commands
- test_group
- test_acid
- test_branch
- test_pattern
- test_print
- test_subst
-}
-
-mark()
-{
- MARK=`expr $MARK + 1`
- exec 1>&4 2>&5
- exec >"$DIR/${MARK}_$1"
- echo "Test $1:$MARK"
- # Uncomment this line to match tests with sed error messages
- echo "Test $1:$MARK" >&5
-}
-
-test_args()
-{
- mark '1.1'
- echo Testing argument parsing
- echo First type
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED 's/^/e1_/p' lines1
- fi
- mark '1.2' ; $SED -n 's/^/e1_/p' lines1
- mark '1.3'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED 's/^/e1_/p' <lines1
- fi
- mark '1.4' ; $SED -n 's/^/e1_/p' <lines1
- echo Second type
- mark '1.4.1'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed fails this
- fi
- $SED -e '' <lines1
- echo 's/^/s1_/p' >script1
- echo 's/^/s2_/p' >script2
- mark '1.5'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -f script1 lines1
- fi
- mark '1.6'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -f script1 <lines1
- fi
- mark '1.7'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -e 's/^/e1_/p' lines1
- fi
- mark '1.8'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -e 's/^/e1_/p' <lines1
- fi
- mark '1.9' ; $SED -n -f script1 lines1
- mark '1.10' ; $SED -n -f script1 <lines1
- mark '1.11' ; $SED -n -e 's/^/e1_/p' lines1
- mark '1.12'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -n -e 's/^/e1_/p' <lines1
- fi
- mark '1.13'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -e 's/^/e1_/p' -e 's/^/e2_/p' lines1
- fi
- mark '1.14'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -f script1 -f script2 lines1
- fi
- mark '1.15'
- if [ $GNU -eq 1 -o $SUN -eq 1 ] ; then
- echo GNU and SunOS sed fail this following older POSIX draft
- else
- $SED -e 's/^/e1_/p' -f script1 lines1
- fi
- mark '1.16'
- if [ $SUN -eq 1 ] ; then
- echo SunOS sed prints only with -n
- else
- $SED -e 's/^/e1_/p' lines1 lines1
- fi
- # POSIX D11.2:11251
- mark '1.17' ; $SED p <lines1 lines1
-cat >script1 <<EOF
-#n
-# A comment
-
-p
-EOF
- mark '1.18' ; $SED -f script1 <lines1 lines1
-}
-
-test_addr()
-{
- echo Testing address ranges
- mark '2.1' ; $SED -n -e '4p' lines1
- mark '2.2' ; $SED -n -e '20p' lines1 lines2
- mark '2.3' ; $SED -n -e '$p' lines1
- mark '2.4' ; $SED -n -e '$p' lines1 lines2
- mark '2.5' ; $SED -n -e '$a\
-hello' /dev/null
- mark '2.6' ; $SED -n -e '$p' lines1 /dev/null lines2
- # Should not print anything
- mark '2.7' ; $SED -n -e '20p' lines1
- mark '2.8' ; $SED -n -e '0p' lines1
- mark '2.9' ; $SED -n '/l1_7/p' lines1
- mark '2.10' ; $SED -n ' /l1_7/ p' lines1
- mark '2.11'
- if [ $BSD -eq 1 ] ; then
- echo BSD sed fails this test
- fi
- if [ $GNU -eq 1 ] ; then
- echo GNU sed fails this
- fi
- $SED -n '\_l1\_7_p' lines1
- mark '2.12' ; $SED -n '1,4p' lines1
- mark '2.13' ; $SED -n '1,$p' lines1 lines2
- mark '2.14' ; $SED -n '1,/l2_9/p' lines1 lines2
- mark '2.15' ; $SED -n '/4/,$p' lines1 lines2
- mark '2.16' ; $SED -n '/4/,20p' lines1 lines2
- mark '2.17' ; $SED -n '/4/,/10/p' lines1 lines2
- mark '2.18' ; $SED -n '/l2_3/,/l1_8/p' lines1 lines2
- mark '2.19'
- if [ $GNU -eq 1 ] ; then
- echo GNU sed fails this
- fi
- $SED -n '12,3p' lines1 lines2
- mark '2.20'
- if [ $GNU -eq 1 ] ; then
- echo GNU sed fails this
- fi
- $SED -n '/l1_7/,3p' lines1 lines2
-}
-
-test_group()
-{
- echo Brace and other grouping
- mark '3.1' ; $SED -e '
-4,12 {
- s/^/^/
- s/$/$/
- s/_/T/
-}' lines1
- mark '3.2' ; $SED -e '
-4,12 {
- s/^/^/
- /6/,/10/ {
- s/$/$/
- /8/ s/_/T/
- }
-}' lines1
- mark '3.3' ; $SED -e '
-4,12 !{
- s/^/^/
- /6/,/10/ !{
- s/$/$/
- /8/ !s/_/T/
- }
-}' lines1
- mark '3.4' ; $SED -e '4,12!s/^/^/' lines1
-}
-
-test_acid()
-{
- echo Testing a c d and i commands
- mark '4.1' ; $SED -n -e '
-s/^/before_i/p
-20i\
-inserted
-s/^/after_i/p
-' lines1 lines2
- mark '4.2' ; $SED -n -e '
-5,12s/^/5-12/
-s/^/before_a/p
-/5-12/a\
-appended
-s/^/after_a/p
-' lines1 lines2
- mark '4.3'
- if [ $GNU -eq 1 ] ; then
- echo GNU sed fails this
- fi
- $SED -n -e '
-s/^/^/p
-/l1_/a\
-appended
-8,10N
-s/$/$/p
-' lines1 lines2
- mark '4.4' ; $SED -n -e '
-c\
-hello
-' lines1
- mark '4.5' ; $SED -n -e '
-8c\
-hello
-' lines1
- mark '4.6' ; $SED -n -e '
-3,14c\
-hello
-' lines1
-# SunOS and GNU sed behave differently. We follow POSIX
-# mark '4.7' ; $SED -n -e '
-#8,3c\
-#hello
-#' lines1
- mark '4.8' ; $SED d <lines1
-}
-
-test_branch()
-{
- echo Testing labels and branching
- mark '5.1' ; $SED -n -e '
-b label4
-:label3
-s/^/label3_/p
-b end
-:label4
-2,12b label1
-b label2
-:label1
-s/^/label1_/p
-b
-:label2
-s/^/label2_/p
-b label3
-:end
-' lines1
- mark '5.2'
- if [ $BSD -eq 1 ] ; then
- echo BSD sed fails this test
- fi
- $SED -n -e '
-s/l1_/l2_/
-t ok
-b
-:ok
-s/^/tested /p
-' lines1 lines2
-# SunOS sed behaves differently here. Clarification needed.
-# mark '5.3' ; $SED -n -e '
-#5,8b inside
-#1,5 {
-# s/^/^/p
-# :inside
-# s/$/$/p
-#}
-#' lines1
-# Check that t clears the substitution done flag
- mark '5.4' ; $SED -n -e '
-1,8s/^/^/
-t l1
-:l1
-t l2
-s/$/$/p
-b
-:l2
-s/^/ERROR/
-' lines1
-# Check that reading a line clears the substitution done flag
- mark '5.5'
- if [ $BSD -eq 1 ] ; then
- echo BSD sed fails this test
- fi
- $SED -n -e '
-t l2
-1,8s/^/^/p
-2,7N
-b
-:l2
-s/^/ERROR/p
-' lines1
- mark '5.6' ; $SED 5q lines1
- mark '5.7' ; $SED -e '
-5i\
-hello
-5q' lines1
-# Branch across block boundary
- mark '5.8' ; $SED -e '
-{
-:b
-}
-s/l/m/
-tb' lines1
-}
-
-test_pattern()
-{
-echo Pattern space commands
-# Check that the pattern space is deleted
- mark '6.1' ; $SED -n -e '
-c\
-changed
-p
-' lines1
- mark '6.2' ; $SED -n -e '
-4d
-p
-' lines1
-# SunOS sed refused to print here
-# mark '6.3' ; $SED -e '
-#N
-#N
-#N
-#D
-#P
-#4p
-#' lines1
- mark '6.4' ; $SED -e '
-2h
-3H
-4g
-5G
-6x
-6p
-6x
-6p
-' lines1
- mark '6.5' ; $SED -e '4n' lines1
- mark '6.6' ; $SED -n -e '4n' lines1
-}
-
-test_print()
-{
- echo Testing print and file routines
- awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \
- </dev/null >lines3
- # GNU and SunOS sed behave differently here
- mark '7.1'
- $SED -n l lines3
- mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
- rm -f lines4
- mark '7.3' ; $SED -e '3,12w lines4' lines1
- echo w results
- cat lines4
- mark '7.4' ; $SED -e '4r lines2' lines1
- mark '7.5' ; $SED -e '5r /dev/dds' lines1
- mark '7.6' ; $SED -e '6r /dev/null' lines1
- mark '7.7'
- if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then
- echo BSD, GNU and SunOS cannot pass this one
- else
- sed '200q' $DICT | sed 's$.*$s/^/&/w tmpdir/&$' >script1
- rm -rf tmpdir
- mkdir tmpdir
- $SED -f script1 lines1
- cat tmpdir/*
- rm -rf tmpdir
- fi
- mark '7.8'
- if [ $BSD -eq 1 ] ; then
- echo BSD sed cannot pass 7.7
- else
- echo line1 > lines3
- echo "" >> lines3
- $SED -n -e '$p' lines3 /dev/null
- fi
-
-}
-
-test_subst()
-{
- echo Testing substitution commands
- mark '8.1' ; $SED -e 's/./X/g' lines1
- mark '8.2' ; $SED -e 's,.,X,g' lines1
-# GNU and SunOS sed thinks we are escaping . as wildcard, not as separator
-# mark '8.3' ; $SED -e 's.\..X.g' lines1
-# POSIX does not say that this should work
-# mark '8.4' ; $SED -e 's/[/]/Q/' lines1
- mark '8.4' ; $SED -e 's/[\/]/Q/' lines1
- mark '8.5' ; $SED -e 's_\__X_' lines1
- mark '8.6' ; $SED -e 's/./(&)/g' lines1
- mark '8.7' ; $SED -e 's/./(\&)/g' lines1
- mark '8.8' ; $SED -e 's/\(.\)\(.\)\(.\)/x\3x\2x\1/g' lines1
- mark '8.9' ; $SED -e 's/_/u0\
-u1\
-u2/g' lines1
- mark '8.10'
- if [ $BSD -eq 1 -o $GNU -eq 1 ] ; then
- echo 'BSD/GNU sed do not understand digit flags on s commands'
- fi
- $SED -e 's/./X/4' lines1
- rm -f lines4
- mark '8.11' ; $SED -e 's/1/X/w lines4' lines1
- echo s wfile results
- cat lines4
- mark '8.12' ; $SED -e 's/[123]/X/g' lines1
- mark '8.13' ; $SED -e 'y/0123456789/9876543210/' lines1
- mark '8.14' ;
- if [ $BSD -eq 1 -o $GNU -eq 1 -o $SUN -eq 1 ] ; then
- echo BSD/GNU/SUN sed fail this test
- else
- $SED -e 'y10\123456789198765432\101' lines1
- fi
- mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
- mark '8.16'
- echo 'eeefff' | $SED -e '
- p
- s/e/X/p
- :x
- s//Y/p
- # Establish limit counter in the hold space
- # GNU sed version 3.02 enters into an infinite loop here
- x
- /.\{10\}/ {
- s/.*/ERROR/
- b
- }
- s/.*/&./
- x
- /f/bx
- '
-}
-
-test_error()
-{
- exec 0>&3 4>&1 5>&2
- exec 0</dev/null
- exec 2>&1
- set -x
- $TEST -x && exit 1
- $TEST -f && exit 1
- $TEST -e && exit 1
- $TEST -f /dev/dds && exit 1
- $TEST p /dev/dds && exit 1
- $TEST -f /bin/sh && exit 1
- $TEST '{' && exit 1
- $TEST '{' && exit 1
- $TEST '/hello/' && exit 1
- $TEST '1,/hello/' && exit 1
- $TEST -e '-5p' && exit 1
- $TEST '/jj' && exit 1
- $TEST 'a hello' && exit 1
- $TEST 'a \ hello' && exit 1
- $TEST 'b foo' && exit 1
- $TEST 'd hello' && exit 1
- $TEST 's/aa' && exit 1
- $TEST 's/aa/' && exit 1
- $TEST 's/a/b' && exit 1
- $TEST 's/a/b/c/d' && exit 1
- $TEST 's/a/b/ 1 2' && exit 1
- $TEST 's/a/b/ 1 g' && exit 1
- $TEST 's/a/b/w' && exit 1
- $TEST 'y/aa' && exit 1
- $TEST 'y/aa/b/' && exit 1
- $TEST 'y/aa/' && exit 1
- $TEST 'y/a/b' && exit 1
- $TEST 'y/a/b/c/d' && exit 1
- $TEST '!' && exit 1
- $TEST supercalifrangolisticexprialidociussupercalifrangolisticexcius
- set +x
- exec 0>&3 1>&4 2>&5
-}
-
-main
diff --git a/usr.bin/ministat/Makefile b/usr.bin/ministat/Makefile
deleted file mode 100644
index 62de6a0..0000000
--- a/usr.bin/ministat/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# $FreeBSD$
-PROG= ministat
-NO_MAN=
-DPADD= ${LIBM}
-LDADD= -lm
-
-.include <bsd.prog.mk>
-
-test: ${PROG}
- ./${PROG} < ${.CURDIR}/chameleon
- ./${PROG} ${.CURDIR}/chameleon
- ./${PROG} ${.CURDIR}/chameleon ${.CURDIR}/iguana
- ./${PROG} -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
- ./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
diff --git a/usr.bin/ministat/README b/usr.bin/ministat/README
deleted file mode 100644
index cc5fe27..0000000
--- a/usr.bin/ministat/README
+++ /dev/null
@@ -1,50 +0,0 @@
-$FreeBSD$
-
-A small tool to do the statistics legwork on benchmarks etc.
-
-Prepare your data into two files, one number per line
-run
- ./ministat data_before data_after
-
-and see what it says.
-
-You need at least three data points in each data set, but the more
-you have the better your result generally gets.
-
-Here are two typical outputs:
-
-x _1
-+ _2
-+--------------------------------------------------------------------------+
-|x + x+ x x x + ++ |
-| |_________|______AM_______________|__A___________M_______________||
-+--------------------------------------------------------------------------+
- N Min Max Median Avg Stddev
-x 5 36060 36138 36107 36105.6 31.165686
-+ 5 36084 36187 36163 36142.6 49.952978
-No difference proven at 95.0% confidence
-
-Here nothing can be concluded from the numbers. It _may_ be possible to
-prove something if many more measurements are made, but with only five
-measurements, nothing is proven.
-
-
-x _1
-+ _2
-+--------------------------------------------------------------------------+
-| + |
-| x + +|
-|x x x x + +|
-| |_______________A_____M_________| |_M___A____| |
-+--------------------------------------------------------------------------+
- N Min Max Median Avg Stddev
-x 5 0.133 0.137 0.136 0.1354 0.0015165751
-+ 5 0.139 0.14 0.139 0.1394 0.00054772256
-Difference at 95.0% confidence
- 0.004 +/- 0.00166288
- 2.95421% +/- 1.22812%
- (Student's t, pooled s = 0.00114018)
-
-Here we have a clearcut difference, not very big, but clear and unambiguous.
-
-
diff --git a/usr.bin/ministat/chameleon b/usr.bin/ministat/chameleon
deleted file mode 100644
index c554c99..0000000
--- a/usr.bin/ministat/chameleon
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-150
-400
-720
-500
-930
diff --git a/usr.bin/ministat/iguana b/usr.bin/ministat/iguana
deleted file mode 100644
index d6996c1..0000000
--- a/usr.bin/ministat/iguana
+++ /dev/null
@@ -1,8 +0,0 @@
-# $FreeBSD$
-50
-200
-150
-400
-750
-400
-150
diff --git a/usr.bin/ministat/ministat.c b/usr.bin/ministat/ministat.c
deleted file mode 100644
index 4bce24f..0000000
--- a/usr.bin/ministat/ministat.c
+++ /dev/null
@@ -1,586 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stdio.h>
-#include <math.h>
-#include <err.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/queue.h>
-
-#define NSTUDENT 100
-#define NCONF 6
-double const studentpct[] = { 80, 90, 95, 98, 99, 99.5 };
-double student [NSTUDENT + 1][NCONF] = {
-/* inf */ { 1.282, 1.645, 1.960, 2.326, 2.576, 3.090 },
-/* 1. */ { 3.078, 6.314, 12.706, 31.821, 63.657, 318.313 },
-/* 2. */ { 1.886, 2.920, 4.303, 6.965, 9.925, 22.327 },
-/* 3. */ { 1.638, 2.353, 3.182, 4.541, 5.841, 10.215 },
-/* 4. */ { 1.533, 2.132, 2.776, 3.747, 4.604, 7.173 },
-/* 5. */ { 1.476, 2.015, 2.571, 3.365, 4.032, 5.893 },
-/* 6. */ { 1.440, 1.943, 2.447, 3.143, 3.707, 5.208 },
-/* 7. */ { 1.415, 1.895, 2.365, 2.998, 3.499, 4.782 },
-/* 8. */ { 1.397, 1.860, 2.306, 2.896, 3.355, 4.499 },
-/* 9. */ { 1.383, 1.833, 2.262, 2.821, 3.250, 4.296 },
-/* 10. */ { 1.372, 1.812, 2.228, 2.764, 3.169, 4.143 },
-/* 11. */ { 1.363, 1.796, 2.201, 2.718, 3.106, 4.024 },
-/* 12. */ { 1.356, 1.782, 2.179, 2.681, 3.055, 3.929 },
-/* 13. */ { 1.350, 1.771, 2.160, 2.650, 3.012, 3.852 },
-/* 14. */ { 1.345, 1.761, 2.145, 2.624, 2.977, 3.787 },
-/* 15. */ { 1.341, 1.753, 2.131, 2.602, 2.947, 3.733 },
-/* 16. */ { 1.337, 1.746, 2.120, 2.583, 2.921, 3.686 },
-/* 17. */ { 1.333, 1.740, 2.110, 2.567, 2.898, 3.646 },
-/* 18. */ { 1.330, 1.734, 2.101, 2.552, 2.878, 3.610 },
-/* 19. */ { 1.328, 1.729, 2.093, 2.539, 2.861, 3.579 },
-/* 20. */ { 1.325, 1.725, 2.086, 2.528, 2.845, 3.552 },
-/* 21. */ { 1.323, 1.721, 2.080, 2.518, 2.831, 3.527 },
-/* 22. */ { 1.321, 1.717, 2.074, 2.508, 2.819, 3.505 },
-/* 23. */ { 1.319, 1.714, 2.069, 2.500, 2.807, 3.485 },
-/* 24. */ { 1.318, 1.711, 2.064, 2.492, 2.797, 3.467 },
-/* 25. */ { 1.316, 1.708, 2.060, 2.485, 2.787, 3.450 },
-/* 26. */ { 1.315, 1.706, 2.056, 2.479, 2.779, 3.435 },
-/* 27. */ { 1.314, 1.703, 2.052, 2.473, 2.771, 3.421 },
-/* 28. */ { 1.313, 1.701, 2.048, 2.467, 2.763, 3.408 },
-/* 29. */ { 1.311, 1.699, 2.045, 2.462, 2.756, 3.396 },
-/* 30. */ { 1.310, 1.697, 2.042, 2.457, 2.750, 3.385 },
-/* 31. */ { 1.309, 1.696, 2.040, 2.453, 2.744, 3.375 },
-/* 32. */ { 1.309, 1.694, 2.037, 2.449, 2.738, 3.365 },
-/* 33. */ { 1.308, 1.692, 2.035, 2.445, 2.733, 3.356 },
-/* 34. */ { 1.307, 1.691, 2.032, 2.441, 2.728, 3.348 },
-/* 35. */ { 1.306, 1.690, 2.030, 2.438, 2.724, 3.340 },
-/* 36. */ { 1.306, 1.688, 2.028, 2.434, 2.719, 3.333 },
-/* 37. */ { 1.305, 1.687, 2.026, 2.431, 2.715, 3.326 },
-/* 38. */ { 1.304, 1.686, 2.024, 2.429, 2.712, 3.319 },
-/* 39. */ { 1.304, 1.685, 2.023, 2.426, 2.708, 3.313 },
-/* 40. */ { 1.303, 1.684, 2.021, 2.423, 2.704, 3.307 },
-/* 41. */ { 1.303, 1.683, 2.020, 2.421, 2.701, 3.301 },
-/* 42. */ { 1.302, 1.682, 2.018, 2.418, 2.698, 3.296 },
-/* 43. */ { 1.302, 1.681, 2.017, 2.416, 2.695, 3.291 },
-/* 44. */ { 1.301, 1.680, 2.015, 2.414, 2.692, 3.286 },
-/* 45. */ { 1.301, 1.679, 2.014, 2.412, 2.690, 3.281 },
-/* 46. */ { 1.300, 1.679, 2.013, 2.410, 2.687, 3.277 },
-/* 47. */ { 1.300, 1.678, 2.012, 2.408, 2.685, 3.273 },
-/* 48. */ { 1.299, 1.677, 2.011, 2.407, 2.682, 3.269 },
-/* 49. */ { 1.299, 1.677, 2.010, 2.405, 2.680, 3.265 },
-/* 50. */ { 1.299, 1.676, 2.009, 2.403, 2.678, 3.261 },
-/* 51. */ { 1.298, 1.675, 2.008, 2.402, 2.676, 3.258 },
-/* 52. */ { 1.298, 1.675, 2.007, 2.400, 2.674, 3.255 },
-/* 53. */ { 1.298, 1.674, 2.006, 2.399, 2.672, 3.251 },
-/* 54. */ { 1.297, 1.674, 2.005, 2.397, 2.670, 3.248 },
-/* 55. */ { 1.297, 1.673, 2.004, 2.396, 2.668, 3.245 },
-/* 56. */ { 1.297, 1.673, 2.003, 2.395, 2.667, 3.242 },
-/* 57. */ { 1.297, 1.672, 2.002, 2.394, 2.665, 3.239 },
-/* 58. */ { 1.296, 1.672, 2.002, 2.392, 2.663, 3.237 },
-/* 59. */ { 1.296, 1.671, 2.001, 2.391, 2.662, 3.234 },
-/* 60. */ { 1.296, 1.671, 2.000, 2.390, 2.660, 3.232 },
-/* 61. */ { 1.296, 1.670, 2.000, 2.389, 2.659, 3.229 },
-/* 62. */ { 1.295, 1.670, 1.999, 2.388, 2.657, 3.227 },
-/* 63. */ { 1.295, 1.669, 1.998, 2.387, 2.656, 3.225 },
-/* 64. */ { 1.295, 1.669, 1.998, 2.386, 2.655, 3.223 },
-/* 65. */ { 1.295, 1.669, 1.997, 2.385, 2.654, 3.220 },
-/* 66. */ { 1.295, 1.668, 1.997, 2.384, 2.652, 3.218 },
-/* 67. */ { 1.294, 1.668, 1.996, 2.383, 2.651, 3.216 },
-/* 68. */ { 1.294, 1.668, 1.995, 2.382, 2.650, 3.214 },
-/* 69. */ { 1.294, 1.667, 1.995, 2.382, 2.649, 3.213 },
-/* 70. */ { 1.294, 1.667, 1.994, 2.381, 2.648, 3.211 },
-/* 71. */ { 1.294, 1.667, 1.994, 2.380, 2.647, 3.209 },
-/* 72. */ { 1.293, 1.666, 1.993, 2.379, 2.646, 3.207 },
-/* 73. */ { 1.293, 1.666, 1.993, 2.379, 2.645, 3.206 },
-/* 74. */ { 1.293, 1.666, 1.993, 2.378, 2.644, 3.204 },
-/* 75. */ { 1.293, 1.665, 1.992, 2.377, 2.643, 3.202 },
-/* 76. */ { 1.293, 1.665, 1.992, 2.376, 2.642, 3.201 },
-/* 77. */ { 1.293, 1.665, 1.991, 2.376, 2.641, 3.199 },
-/* 78. */ { 1.292, 1.665, 1.991, 2.375, 2.640, 3.198 },
-/* 79. */ { 1.292, 1.664, 1.990, 2.374, 2.640, 3.197 },
-/* 80. */ { 1.292, 1.664, 1.990, 2.374, 2.639, 3.195 },
-/* 81. */ { 1.292, 1.664, 1.990, 2.373, 2.638, 3.194 },
-/* 82. */ { 1.292, 1.664, 1.989, 2.373, 2.637, 3.193 },
-/* 83. */ { 1.292, 1.663, 1.989, 2.372, 2.636, 3.191 },
-/* 84. */ { 1.292, 1.663, 1.989, 2.372, 2.636, 3.190 },
-/* 85. */ { 1.292, 1.663, 1.988, 2.371, 2.635, 3.189 },
-/* 86. */ { 1.291, 1.663, 1.988, 2.370, 2.634, 3.188 },
-/* 87. */ { 1.291, 1.663, 1.988, 2.370, 2.634, 3.187 },
-/* 88. */ { 1.291, 1.662, 1.987, 2.369, 2.633, 3.185 },
-/* 89. */ { 1.291, 1.662, 1.987, 2.369, 2.632, 3.184 },
-/* 90. */ { 1.291, 1.662, 1.987, 2.368, 2.632, 3.183 },
-/* 91. */ { 1.291, 1.662, 1.986, 2.368, 2.631, 3.182 },
-/* 92. */ { 1.291, 1.662, 1.986, 2.368, 2.630, 3.181 },
-/* 93. */ { 1.291, 1.661, 1.986, 2.367, 2.630, 3.180 },
-/* 94. */ { 1.291, 1.661, 1.986, 2.367, 2.629, 3.179 },
-/* 95. */ { 1.291, 1.661, 1.985, 2.366, 2.629, 3.178 },
-/* 96. */ { 1.290, 1.661, 1.985, 2.366, 2.628, 3.177 },
-/* 97. */ { 1.290, 1.661, 1.985, 2.365, 2.627, 3.176 },
-/* 98. */ { 1.290, 1.661, 1.984, 2.365, 2.627, 3.175 },
-/* 99. */ { 1.290, 1.660, 1.984, 2.365, 2.626, 3.175 },
-/* 100. */ { 1.290, 1.660, 1.984, 2.364, 2.626, 3.174 }
-};
-
-#define MAX_DS 8
-static char symbol[MAX_DS] = { ' ', 'x', '+', '*', '%', '#', '@', 'O' };
-
-TAILQ_HEAD(pointlist, point);
-
-struct dataset {
- struct pointlist list;
- double sy, syy;
- int n;
-};
-
-static struct dataset *
-NewSet(void)
-{
- struct dataset *ds;
-
- ds = calloc(1, sizeof *ds);
- TAILQ_INIT(&ds->list);
- return(ds);
-}
-
-struct point {
- TAILQ_ENTRY(point) list;
- double val;
-};
-
-static void
-AddPoint(struct dataset *ds, double a)
-{
- struct point *pp, *pp2;
-
- pp = calloc(1, sizeof *pp);
- pp->val = a;
-
- ds->n++;
- ds->sy += a;
- ds->syy += a * a;
- if (TAILQ_EMPTY(&ds->list)) {
- TAILQ_INSERT_HEAD(&ds->list, pp, list);
- return;
- }
- TAILQ_FOREACH(pp2, &ds->list, list) {
- if (pp->val < pp2->val) {
- TAILQ_INSERT_BEFORE(pp2, pp, list);
- return;
- }
- }
- TAILQ_INSERT_TAIL(&ds->list, pp, list);
-}
-
-static double
-Min(struct dataset *ds)
-{
-
- return (TAILQ_FIRST(&ds->list)->val);
-}
-
-static double
-Max(struct dataset *ds)
-{
-
- return(TAILQ_LAST(&ds->list, pointlist)->val);
-}
-
-static double
-Avg(struct dataset *ds)
-{
-
- return(ds->sy / ds->n);
-}
-
-static double
-Median(struct dataset *ds)
-{
- int i;
- struct point *pp;
-
- i = ds->n / 2;
- TAILQ_FOREACH(pp, &ds->list, list) {
- if (i--)
- continue;
- return (pp->val);
- }
-}
-
-static double
-Var(struct dataset *ds)
-{
-
- return (ds->syy - ds->sy * ds->sy / ds->n) / (ds->n - 1.0);
-}
-
-static double
-Stddev(struct dataset *ds)
-{
-
- return sqrt(Var(ds));
-}
-
-static void
-VitalsHead(void)
-{
-
- printf(" N Min Max Median Avg Stddev\n");
-}
-
-static void
-Vitals(struct dataset *ds, int flag)
-{
- double a;
-
- printf("%c %3d %13.8g %13.8g %13.8g %13.8g %13.8g", symbol[flag],
- ds->n, Min(ds), Max(ds), Median(ds), Avg(ds), Stddev(ds));
- printf("\n");
-}
-
-static void
-Relative(struct dataset *ds, struct dataset *rs, int confidx)
-{
- double spool, s, d, e, t;
- int i, c;
-
- i = ds->n + rs->n - 2;
- if (i > NSTUDENT)
- t = student[0][confidx];
- else
- t = student[i][confidx];
- spool = (ds->n - 1) * Var(ds) + (rs->n - 1) * Var(rs);
- spool /= ds->n + rs->n - 2;
- spool = sqrt(spool);
- s = spool * sqrt(1.0 / ds->n + 1.0 / rs->n);
- d = Avg(ds) - Avg(rs);
- e = t * s;
-
- if (fabs(d) > e) {
-
- printf("Difference at %.1f%% confidence\n", studentpct[confidx]);
- printf(" %g +/- %g\n", d, e);
- printf(" %g%% +/- %g%%\n", d * 100 / Avg(rs), e * 100 / Avg(rs));
- printf(" (Student's t, pooled s = %g)\n", spool);
- } else {
- printf("No difference proven at %.1f%% confidence\n",
- studentpct[confidx]);
- }
-}
-
-struct plot {
- double min;
- double max;
- double span;
- int width;
-
- double x0, dx;
- int height;
- char *data;
- char **bar;
- int separate_bars;
-};
-
-static struct plot plot;
-
-static void
-SetupPlot(int width, int separate)
-{
- struct plot *pl;
-
- pl = &plot;
- pl->width = width;
- pl->height = 0;
- pl->data = NULL;
- pl->bar = NULL;
- pl->separate_bars = separate;
- pl->min = 999e99;
- pl->max = -999e99;
-}
-
-static void
-AdjPlot(double a)
-{
- struct plot *pl;
-
- pl = &plot;
- if (a < pl->min)
- pl->min = a;
- if (a > pl->max)
- pl->max = a;
- pl->span = pl->max - pl->min;
- pl->dx = pl->span / (pl->width - 1.0);
- pl->x0 = pl->min - .5 * pl->dx;
-}
-
-static void
-DimPlot(struct dataset *ds)
-{
- AdjPlot(Min(ds));
- AdjPlot(Max(ds));
- AdjPlot(Avg(ds) - Stddev(ds));
- AdjPlot(Avg(ds) + Stddev(ds));
-}
-
-static void
-PlotSet(struct dataset *ds, int val)
-{
- struct plot *pl;
- struct point *pp;
- int i, j, m, x;
- int bar;
-
- pl = &plot;
- if (pl->span == 0)
- return;
-
- if (pl->separate_bars)
- bar = val-1;
- else
- bar = 0;
-
- if (pl->bar == NULL) {
- pl->bar = malloc(sizeof(char *) * 2);
- memset(pl->bar, 0, sizeof(char*) * 2);
- }
- if (pl->bar[bar] == NULL) {
- pl->bar[bar] = malloc(pl->width);
- memset(pl->bar[bar], 0, pl->width);
- }
-
- m = 1;
- i = -1;
- j = 0;
- TAILQ_FOREACH(pp, &ds->list, list) {
- x = (pp->val - pl->x0) / pl->dx;
- if (x == i) {
- j++;
- if (j > m)
- m = j;
- } else {
- j = 1;
- i = x;
- }
- }
- m += 1;
- if (m > pl->height) {
- pl->data = realloc(pl->data, pl->width * m);
- memset(pl->data + pl->height * pl->width, 0,
- (m - pl->height) * pl->width);
- }
- pl->height = m;
- i = -1;
- TAILQ_FOREACH(pp, &ds->list, list) {
- x = (pp->val - pl->x0) / pl->dx;
- if (x == i) {
- j++;
- } else {
- j = 1;
- i = x;
- }
- pl->data[j * pl->width + x] |= val;
- }
- x = ((Avg(ds) - Stddev(ds)) - pl->x0) / pl->dx;
- m = ((Avg(ds) + Stddev(ds)) - pl->x0) / pl->dx;
- pl->bar[bar][m] = '|';
- pl->bar[bar][x] = '|';
- for (i = x + 1; i < m; i++)
- if (pl->bar[bar][i] == 0)
- pl->bar[bar][i] = '_';
- x = (Median(ds) - pl->x0) / pl->dx;
- pl->bar[bar][x] = 'M';
- x = (Avg(ds) - pl->x0) / pl->dx;
- pl->bar[bar][x] = 'A';
-}
-
-static void
-DumpPlot(void)
-{
- struct plot *pl;
- int i, j, k;
-
- pl = &plot;
- if (pl->span == 0) {
- printf("[no plot, span is zero width]\n");
- return;
- }
-
- putchar('+');
- for (i = 0; i < pl->width; i++)
- putchar('-');
- putchar('+');
- putchar('\n');
- for (i = 1; i < pl->height; i++) {
- putchar('|');
- for (j = 0; j < pl->width; j++) {
- k = pl->data[(pl->height - i) * pl->width + j];
- if (k >= 0 && k < MAX_DS)
- putchar(symbol[k]);
- else
- printf("[%02x]", k);
- }
- putchar('|');
- putchar('\n');
- }
- for (i = 0; i < 2; i++) {
- if (pl->bar[i] == NULL)
- continue;
- putchar('|');
- for (j = 0; j < pl->width; j++) {
- k = pl->bar[i][j];
- if (k == 0)
- k = ' ';
- putchar(k);
- }
- putchar('|');
- putchar('\n');
- }
- putchar('+');
- for (i = 0; i < pl->width; i++)
- putchar('-');
- putchar('+');
- putchar('\n');
-}
-
-
-static struct dataset *
-ReadSet(char *n)
-{
- FILE *f;
- char buf[BUFSIZ], *p;
- struct dataset *s;
- double d;
- int line;
-
- if (n == NULL) {
- f = stdin;
- n = "<stdin>";
- } else if (!strcmp(n, "-")) {
- f = stdin;
- n = "<stdin>";
- } else {
- f = fopen(n, "r");
- }
- if (f == NULL)
- err(1, "Cannot open %s", n);
- s = NewSet();
- line = 0;
- while (fgets(buf, sizeof buf, f) != NULL) {
- line++;
- p = strchr(buf, '#');
- if (p != NULL)
- *p = '\0';
- p = buf + strlen(buf) - 1;
- while (p >= buf && isspace(*p)) {
- *p = '\0';
- p--;
- }
- d = strtod(buf, &p);
- if (p != NULL && *p != '\0')
- err(2, "Invalid data on line %d in %s\n", line, n);
- if (*buf != '\0')
- AddPoint(s, d);
- }
- fclose(f);
- if (s->n < 3) {
- fprintf(stderr,
- "Dataset %s must contain at least 3 data points\n", n);
- exit (2);
- }
- return (s);
-}
-
-static void
-usage(char const *whine)
-{
- int i;
-
- fprintf(stderr, "%s\n", whine);
- fprintf(stderr,
- "Usage: ministat [ -c confidence ] [-ns] [file [file ...]]\n");
- fprintf(stderr, "\tconfidence = {");
- for (i = 0; i < NCONF; i++) {
- fprintf(stderr, "%s%g%%",
- i ? ", " : "",
- studentpct[i]);
- }
- fprintf(stderr, "}\n");
- fprintf(stderr, "\t-n : print summary statistics only, no graph/test\n");
- fprintf(stderr, "\t-s : print avg/median/stddev bars on separate lines\n");
- exit (2);
-}
-
-int
-main(int argc, char **argv)
-{
- struct dataset *ds[7];
- int nds;
- double a;
- char *p;
- int c, i, ci;
- int flag_s = 0;
- int flag_n = 0;
-
- ci = -1;
- while ((c = getopt(argc, argv, "c:sn")) != -1)
- switch (c) {
- case 'c':
- a = strtod(optarg, &p);
- if (p != NULL && *p != '\0')
- usage("Not a floating point number");
- for (i = 0; i < NCONF; i++)
- if (a == studentpct[i])
- ci = i;
- if (ci == -1)
- usage("No support for confidence level");
- break;
- case 'n':
- flag_n = 1;
- break;
- case 's':
- flag_s = 1;
- break;
- default:
- usage("Unknown option");
- break;
- }
- if (ci == -1)
- ci = 2;
- argc -= optind;
- argv += optind;
-
- if (argc == 0) {
- ds[0] = ReadSet(NULL);
- printf("x stdin\n");
- nds = 1;
- } else {
- if (argc > (MAX_DS - 1))
- usage("Too many datasets.");
- nds = argc;
- for (i = 0; i < nds; i++) {
- ds[i] = ReadSet(argv[i]);
- printf("%c %s\n", symbol[i+1], argv[i]);
- }
- }
-
- if (!flag_n) {
- SetupPlot(74, flag_s);
- for (i = 0; i < nds; i++)
- DimPlot(ds[i]);
- for (i = 0; i < nds; i++)
- PlotSet(ds[i], i + 1);
- DumpPlot();
- }
- VitalsHead();
- Vitals(ds[0], 1);
- for (i = 1; i < nds; i++) {
- Vitals(ds[i], i + 1);
- if (!flag_n)
- Relative(ds[i], ds[0], ci);
- }
- exit(0);
-}
diff --git a/usr.bin/truss/amd64-fbsd32.c b/usr.bin/truss/amd64-fbsd32.c
deleted file mode 100644
index 45da1cd..0000000
--- a/usr.bin/truss/amd64-fbsd32.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Copryight 1997 Sean Eric Fagan
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Sean Eric Fagan
- * 4. Neither 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 AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * FreeBSD/i386-specific system call handling. This is probably the most
- * complex part of the entire truss program, although I've got lots of
- * it handled relatively cleanly now. The system call names are generated
- * automatically, thanks to /usr/src/sys/kern/syscalls.master. The
- * names used for the various structures are confusing, I sadly admit.
- */
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/pioctl.h>
-#include <sys/syscall.h>
-
-#include <machine/reg.h>
-#include <machine/psl.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "truss.h"
-#include "syscall.h"
-#include "extern.h"
-
-static int fd = -1;
-static int cpid = -1;
-
-#include "syscalls.h"
-
-static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]);
-
-/*
- * This is what this particular file uses to keep track of a system call.
- * It is probably not quite sufficient -- I can probably use the same
- * structure for the various syscall personalities, and I also probably
- * need to nest system calls (for signal handlers).
- *
- * 'struct syscall' describes the system call; it may be NULL, however,
- * if we don't know about this particular system call yet.
- */
-static struct freebsd_syscall {
- struct syscall *sc;
- const char *name;
- int number;
- unsigned long *args;
- int nargs; /* number of arguments -- *not* number of words! */
- char **s_args; /* the printable arguments */
-} fsc;
-
-/* Clear up and free parts of the fsc structure. */
-static __inline void
-clear_fsc(void) {
- if (fsc.args) {
- free(fsc.args);
- }
- if (fsc.s_args) {
- int i;
- for (i = 0; i < fsc.nargs; i++)
- if (fsc.s_args[i])
- free(fsc.s_args[i]);
- free(fsc.s_args);
- }
- memset(&fsc, 0, sizeof(fsc));
-}
-
-/*
- * Called when a process has entered a system call. nargs is the
- * number of words, not number of arguments (a necessary distinction
- * in some cases). Note that if the STOPEVENT() code in i386/i386/trap.c
- * is ever changed these functions need to keep up.
- */
-
-void
-i386_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- char buf[32];
- struct reg regs;
- int syscall_num;
- int i;
- unsigned int parm_offset;
- struct syscall *sc;
-
- if (fd == -1 || trussinfo->pid != cpid) {
- sprintf(buf, "/proc/%d/regs", trussinfo->pid);
- fd = open(buf, O_RDWR);
- if (fd == -1) {
- fprintf(trussinfo->outfile, "-- CANNOT OPEN REGISTERS --\n");
- return;
- }
- cpid = trussinfo->pid;
- }
-
- clear_fsc();
- lseek(fd, 0L, 0);
- if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
- fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
- return;
- }
- parm_offset = regs.r_esp + sizeof(int);
-
- /*
- * FreeBSD has two special kinds of system call redirctions --
- * SYS_syscall, and SYS___syscall. The former is the old syscall()
- * routine, basicly; the latter is for quad-aligned arguments.
- */
- syscall_num = regs.r_eax;
- switch (syscall_num) {
- case SYS_syscall:
- lseek(Procfd, parm_offset, SEEK_SET);
- read(Procfd, &syscall_num, sizeof(int));
- parm_offset += sizeof(int);
- break;
- case SYS___syscall:
- lseek(Procfd, parm_offset, SEEK_SET);
- read(Procfd, &syscall_num, sizeof(int));
- parm_offset += sizeof(quad_t);
- break;
- }
-
- fsc.number = syscall_num;
- fsc.name =
- (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
- if (!fsc.name) {
- fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
- }
-
- if (fsc.name && (trussinfo->flags & FOLLOWFORKS)
- && ((!strcmp(fsc.name, "fork")
- || !strcmp(fsc.name, "rfork")
- || !strcmp(fsc.name, "vfork"))))
- {
- trussinfo->in_fork = 1;
- }
-
- if (nargs == 0)
- return;
-
- fsc.args = malloc((1+nargs) * sizeof(unsigned long));
- lseek(Procfd, parm_offset, SEEK_SET);
- if (read(Procfd, fsc.args, nargs * sizeof(unsigned long)) == -1)
- return;
-
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
-#if DEBUG
- fprintf(trussinfo->outfile, "unknown syscall %s -- setting args to %d\n",
- fsc.name, nargs);
-#endif
- fsc.nargs = nargs;
- }
-
- fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*));
- memset(fsc.s_args, 0, fsc.nargs * sizeof(char*));
- fsc.sc = sc;
-
- /*
- * At this point, we set up the system call arguments.
- * We ignore any OUT ones, however -- those are arguments that
- * are set by the system call, and so are probably meaningless
- * now. This doesn't currently support arguments that are
- * passed in *and* out, however.
- */
-
- if (fsc.name) {
-
-#if DEBUG
- fprintf(stderr, "syscall %s(", fsc.name);
-#endif
- for (i = 0; i < fsc.nargs; i++) {
-#if DEBUG
- fprintf(stderr, "0x%x%s",
- sc
- ? fsc.args[sc->args[i].offset]
- : fsc.args[i],
- i < (fsc.nargs - 1) ? "," : "");
-#endif
- if (sc && !(sc->args[i].type & OUT)) {
- fsc.s_args[i] = print_arg(Procfd, &sc->args[i], fsc.args, 0);
- }
- }
-#if DEBUG
- fprintf(stderr, ")\n");
-#endif
- }
-
-#if DEBUG
- fprintf(trussinfo->outfile, "\n");
-#endif
-
- /*
- * Some system calls should be printed out before they are done --
- * execve() and exit(), for example, never return. Possibly change
- * this to work for any system call that doesn't have an OUT
- * parameter?
- */
-
- if (fsc.name != NULL &&
- (!strcmp(fsc.name, "execve") || !strcmp(fsc.name, "exit"))) {
-
- /* XXX
- * This could be done in a more general
- * manner but it still wouldn't be very pretty.
- */
- if (!strcmp(fsc.name, "execve")) {
- if ((trussinfo->flags & EXECVEARGS) == 0)
- if (fsc.s_args[1]) {
- free(fsc.s_args[1]);
- fsc.s_args[1] = NULL;
- }
- if ((trussinfo->flags & EXECVEENVS) == 0)
- if (fsc.s_args[2]) {
- free(fsc.s_args[2]);
- fsc.s_args[2] = NULL;
- }
- }
-
- print_syscall(trussinfo, fsc.name, fsc.nargs, fsc.s_args);
- fprintf(trussinfo->outfile, "\n");
- }
-
- return;
-}
-
-/*
- * And when the system call is done, we handle it here.
- * Currently, no attempt is made to ensure that the system calls
- * match -- this needs to be fixed (and is, in fact, why S_SCX includes
- * the sytem call number instead of, say, an error status).
- */
-
-long
-i386_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused)
-{
- char buf[32];
- struct reg regs;
- long retval;
- int i;
- int errorp;
- struct syscall *sc;
-
- if (fd == -1 || trussinfo->pid != cpid) {
- sprintf(buf, "/proc/%d/regs", trussinfo->pid);
- fd = open(buf, O_RDONLY);
- if (fd == -1) {
- fprintf(trussinfo->outfile, "-- CANNOT OPEN REGISTERS --\n");
- return (-1);
- }
- cpid = trussinfo->pid;
- }
-
- lseek(fd, 0L, 0);
- if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
- fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
- return (-1);
- }
- retval = regs.r_eax;
- errorp = !!(regs.r_eflags & PSL_C);
-
- /*
- * This code, while simpler than the initial versions I used, could
- * stand some significant cleaning.
- */
-
- sc = fsc.sc;
- if (!sc) {
- for (i = 0; i < fsc.nargs; i++)
- asprintf(&fsc.s_args[i], "0x%lx", fsc.args[i]);
- } else {
- /*
- * Here, we only look for arguments that have OUT masked in --
- * otherwise, they were handled in the syscall_entry function.
- */
- for (i = 0; i < sc->nargs; i++) {
- char *temp;
- if (sc->args[i].type & OUT) {
- /*
- * If an error occurred, than don't bothe getting the data;
- * it may not be valid.
- */
- if (errorp)
- asprintf(&temp, "0x%lx", fsc.args[sc->args[i].offset]);
- else
- temp = print_arg(Procfd, &sc->args[i], fsc.args, retval);
- fsc.s_args[i] = temp;
- }
- }
- }
-
- /*
- * It would probably be a good idea to merge the error handling,
- * but that complicates things considerably.
- */
-
- print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp, retval);
- clear_fsc();
-
- return (retval);
-}
diff --git a/usr.bin/truss/amd64-linux32.c b/usr.bin/truss/amd64-linux32.c
deleted file mode 100644
index 01703b5..0000000
--- a/usr.bin/truss/amd64-linux32.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copryight 1997 Sean Eric Fagan
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Sean Eric Fagan
- * 4. Neither 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 AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED 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.
- */
-
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * Linux/i386-specific system call handling. Given how much of this code
- * is taken from the freebsd equivalent, I can probably put even more of
- * it in support routines that can be used by any personality support.
- */
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/pioctl.h>
-
-#include <machine/reg.h>
-#include <machine/psl.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "truss.h"
-#include "syscall.h"
-#include "extern.h"
-
-static int fd = -1;
-static int cpid = -1;
-
-#include "linux_syscalls.h"
-
-static int nsyscalls =
- sizeof(linux_syscallnames) / sizeof(linux_syscallnames[0]);
-
-/*
- * This is what this particular file uses to keep track of a system call.
- * It is probably not quite sufficient -- I can probably use the same
- * structure for the various syscall personalities, and I also probably
- * need to nest system calls (for signal handlers).
- *
- * 'struct syscall' describes the system call; it may be NULL, however,
- * if we don't know about this particular system call yet.
- */
-static struct linux_syscall {
- struct syscall *sc;
- const char *name;
- int number;
- unsigned long args[5];
- int nargs; /* number of arguments -- *not* number of words! */
- char **s_args; /* the printable arguments */
-} fsc;
-
-/* Clear up and free parts of the fsc structure. */
-static __inline void
-clear_fsc(void) {
- if (fsc.s_args) {
- int i;
- for (i = 0; i < fsc.nargs; i++)
- if (fsc.s_args[i])
- free(fsc.s_args[i]);
- free(fsc.s_args);
- }
- memset(&fsc, 0, sizeof(fsc));
-}
-
-/*
- * Called when a process has entered a system call. nargs is the
- * number of words, not number of arguments (a necessary distinction
- * in some cases). Note that if the STOPEVENT() code in i386/i386/trap.c
- * is ever changed these functions need to keep up.
- */
-
-void
-i386_linux_syscall_entry(struct trussinfo *trussinfo, int nargs) {
- char buf[32];
- struct reg regs;
- int syscall_num;
- int i;
- struct syscall *sc;
-
- if (fd == -1 || trussinfo->pid != cpid) {
- sprintf(buf, "/proc/%d/regs", trussinfo->pid);
- fd = open(buf, O_RDWR);
- if (fd == -1) {
- fprintf(trussinfo->outfile, "-- CANNOT OPEN REGISTERS --\n");
- return;
- }
- cpid = trussinfo->pid;
- }
-
- clear_fsc();
- lseek(fd, 0L, 0);
- if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
- fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n");
- return;
- }
- syscall_num = regs.r_eax;
-
- fsc.number = syscall_num;
- fsc.name =
- (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : linux_syscallnames[syscall_num];
- if (!fsc.name) {
- fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
- }
-
- if (fsc.name && (trussinfo->flags & FOLLOWFORKS)
- && ((!strcmp(fsc.name, "linux_fork")
- || !strcmp(fsc.name, "linux_vfork"))))
- {
- trussinfo->in_fork = 1;
- }
-
- if (nargs == 0)
- return;
-
- /*
- * Linux passes syscall arguments in registers, not
- * on the stack. Fortunately, we've got access to the
- * register set. Note that we don't bother checking the
- * number of arguments. And what does linux do for syscalls
- * that have more than five arguments?
- */
-
- fsc.args[0] = regs.r_ebx;
- fsc.args[1] = regs.r_ecx;
- fsc.args[2] = regs.r_edx;
- fsc.args[3] = regs.r_esi;
- fsc.args[4] = regs.r_edi;
-
- sc = get_syscall(fsc.name);
- if (sc) {
- fsc.nargs = sc->nargs;
- } else {
-#if DEBUG
- fprintf(trussinfo->outfile, "unknown syscall %s -- setting args to %d\n",
- fsc.name, nargs);
-#endif
- fsc.nargs = nargs;
- }
-
- fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*));
- memset(fsc.s_args, 0, fsc.nargs * sizeof(char*));
- fsc.sc = sc;
-
- /*
- * At this point, we set up the system call arguments.
- * We ignore any OUT ones, however -- those are arguments that
- * are set by the system call, and so are probably meaningless
- * now. This doesn't currently support arguments that are
- * passed in *and* out, however.
- */
-
- if (fsc.name) {
-
-#if DEBUG
- fprintf(stderr, "syscall %s(", fsc.name);
-#endif
- for (i = 0; i < fsc.nargs; i++) {
-#if DEBUG
- fprintf(stderr, "0x%x%s",
- sc
- ? fsc.args[sc->args[i].offset]
- : fsc.args[i],
- i < (fsc.nargs - 1) ? "," : "");
-#endif
- if (sc && !(sc->args[i].type & OUT)) {
- fsc.s_args[i] = print_arg(Procfd, &sc->args[i], fsc.args, 0);
- }
- }
-#if DEBUG
- fprintf(stderr, ")\n");
-#endif
- }
-
-#if DEBUG
- fprintf(trussinfo->outfile, "\n");
-#endif
-
- /*
- * Some system calls should be printed out before they are done --
- * execve() and exit(), for example, never return. Possibly change
- * this to work for any system call that doesn't have an OUT
- * parameter?
- */
-
- if (!strcmp(fsc.name, "linux_execve") || !strcmp(fsc.name, "exit")) {
-
- /* XXX
- * This could be done in a more general
- * manner but it still wouldn't be very pretty.
- */
- if (!strcmp(fsc.name, "linux_execve")) {
- if ((trussinfo->flags & EXECVEARGS) == 0)
- if (fsc.s_args[1]) {
- free(fsc.s_args[1]);
- fsc.s_args[1] = NULL;
- }
- if ((trussinfo->flags & EXECVEENVS) == 0)
- if (fsc.s_args[2]) {
- free(fsc.s_args[2]);
- fsc.s_args[2] = NULL;
- }
- }
-
- print_syscall(trussinfo, fsc.name, fsc.nargs, fsc.s_args);
- fprintf(trussinfo->outfile, "\n");
- }
-
- return;
-}
-
-/*
- * Linux syscalls return negative errno's, we do positive and map them
- */
-const int bsd_to_linux_errno[] = {
- -0, -1, -2, -3, -4, -5, -6, -7, -8, -9,
- -10, -35, -12, -13, -14, -15, -16, -17, -18, -19,
- -20, -21, -22, -23, -24, -25, -26, -27, -28, -29,
- -30, -31, -32, -33, -34, -11,-115,-114, -88, -89,
- -90, -91, -92, -93, -94, -95, -96, -97, -98, -99,
- -100,-101,-102,-103,-104,-105,-106,-107,-108,-109,
- -110,-111, -40, -36,-112,-113, -39, -11, -87,-122,
- -116, -66, -6, -6, -6, -6, -6, -37, -38, -9,
- -6,
-};
-
-long
-i386_linux_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused)
-{
- char buf[32];
- struct reg regs;
- long retval;
- int i;
- int errorp;
- struct syscall *sc;
-
- if (fd == -1 || trussinfo->pid != cpid) {
- sprintf(buf, "/proc/%d/regs", trussinfo->pid);
- fd = open(buf, O_RDONLY);
- if (fd == -1) {
- fprintf(trussinfo->outfile, "-- CANNOT OPEN REGISTERS --\n");
- return (-1);
- }
- cpid = trussinfo->pid;
- }
-
- lseek(fd, 0L, 0);
- if (read(fd, &regs, sizeof(regs)) != sizeof(regs)) {
- fprintf(trussinfo->outfile, "\n");
- return (-1);
- }
- retval = regs.r_eax;
- errorp = !!(regs.r_eflags & PSL_C);
-
- /*
- * This code, while simpler than the initial versions I used, could
- * stand some significant cleaning.
- */
-
- sc = fsc.sc;
- if (!sc) {
- for (i = 0; i < fsc.nargs; i++)
- asprintf(&fsc.s_args[i], "0x%lx", fsc.args[i]);
- } else {
- /*
- * Here, we only look for arguments that have OUT masked in --
- * otherwise, they were handled in the syscall_entry function.
- */
- for (i = 0; i < sc->nargs; i++) {
- char *temp;
- if (sc->args[i].type & OUT) {
- /*
- * If an error occurred, than don't bothe getting the data;
- * it may not be valid.
- */
- if (errorp)
- asprintf(&temp, "0x%lx", fsc.args[sc->args[i].offset]);
- else
- temp = print_arg(Procfd, &sc->args[i], fsc.args, retval);
- fsc.s_args[i] = temp;
- }
- }
- }
-
- /*
- * It would probably be a good idea to merge the error handling,
- * but that complicates things considerably.
- */
- if (errorp) {
- for (i = 0; (size_t)i < sizeof(bsd_to_linux_errno) / sizeof(int); i++)
- if (retval == bsd_to_linux_errno[i])
- break;
- }
- print_syscall_ret(trussinfo, fsc.name, fsc.nargs, fsc.s_args, errorp,
- errorp ? i : retval);
- clear_fsc();
-
- return (retval);
-}
diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5
deleted file mode 100644
index 84d7cd6..0000000
--- a/usr.sbin/config/config.5
+++ /dev/null
@@ -1,354 +0,0 @@
-.\" Copyright (c) 2003 Joseph Koshy
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 13, 2004
-.Dt CONFIG 5
-.Os
-.Sh NAME
-.Nm config
-.Nd kernel configuration file format
-.Sh DESCRIPTION
-A kernel configuration file specifies the configuration of a
-.Fx
-kernel.
-It is processed by
-.Xr config 8
-to create a build environment where a kernel may be built using
-.Xr make 1 .
-.Ss Lexical Structure
-A kernel configuration file comprises a sequence of specification
-directives.
-.Pp
-A specification directive starts with a keyword at the beginning
-of the line and is followed by additional parameters.
-.Pp
-A specification directive may be terminated by a semicolon
-.Ql \&;
-or by a newline.
-Long input lines may be broken into shorter lines by starting the
-second and subsequent lines with a white space character.
-.Pp
-Case is significant,
-.Dq Li machine
-and
-.Dq Li MACHINE
-are different tokens.
-.Pp
-A double quote character
-.Ql \[dq]
-starts a quoted string.
-All characters up to the next quote character form the value
-of the quoted string.
-A
-.Ql \[dq]
-character may be inserted into a quoted string by
-using the sequence
-.Ql \e\[dq] .
-.Pp
-Numbers are specified using
-.Tn C Ns -style
-syntax.
-.Pp
-A
-.Ql #
-character starts a comment; all characters from the
-.Ql #
-character till the end of the current line are ignored.
-.Pp
-Whitespace between tokens is ignored, except inside quoted strings.
-Whitespace following a comment line is ignored.
-.Ss Configuration Directives
-Kernel configuration directives may appear in any order
-in a kernel configuration file.
-Directives are processed in order of appearance with subsequent
-directive lines overriding the effect of prior ones.
-.Pp
-The list of keywords and their meanings are as follows:
-.Bl -tag -width indent
-.\" -------- CPU --------
-.It Ic cpu Ar cputype
-Specify the CPU this kernel will run on.
-There can be more than one
-.Ic cpu
-directive in a configuration file.
-The allowed list of CPU names is architecture specific and is
-defined in the file
-.Pa sys/conf/options. Ns Aq Ar arch .
-.\" -------- DEVICE --------
-.It Ic device Ar name Op , Ar name Op ...
-.It Ic devices Ar name Op , Ar name Op ...
-Configures the specified devices
-for inclusion into the kernel image.
-Devices that are common to all architectures are
-defined in the file
-.Pa sys/conf/files .
-Devices that are specific to architecture
-.Ar arch
-are defined in the file
-.Pa sys/conf/files. Ns Aq Ar arch .
-.\" -------- ENV --------
-.It Ic env Ar filename
-Specifies a filename containing a kernel environment definition.
-The kernel normally uses an environment prepared for it at boot time
-by
-.Xr loader 8 .
-This directive makes the kernel ignore the boot environment and use
-the compiled-in environment instead.
-.Pp
-This directive is useful for setting kernel tunables in
-embedded environments that do not start from
-.Xr loader 8 .
-.\" -------- FILES --------
-.It Ic files Ar filename
-Specifies a file containing a list of files specific to that kernel
-configuration file (a la
-.Pa files. Ns Aq Ar arch ) .
-.\" -------- HINTS --------
-.It Ic hints Ar filename
-Specifies a file to load a static device configuration specification
-from.
-From
-.Fx 5.0
-onwards, the kernel reads the system's device configuration at boot
-time (see
-.Xr device.hints 5 ) .
-This directive configures the kernel to use the static device configuration
-listed in
-.Ar filename .
-The file
-.Ar filename
-must conform to the syntax specified by
-.Xr device.hints 5 .
-.\" -------- IDENT --------
-.It Ic ident Ar name
-Set the kernel name to
-.Ar name .
-At least one
-.Ic ident
-directive is required.
-.\" -------- INCLUDE --------
-.It Ic include Ar filename
-Read subsequent text from file
-.Ar filename
-and return to the current file after
-.Ar filename
-is successfully processed.
-.\" -------- MACHINE --------
-.It Ic machine Ar arch
-Specifies the architecture of the machine the kernel is being
-compiled for.
-Legal values for
-.Ar arch
-include:
-.Pp
-.Bl -tag -width ".Cm powerpc" -compact
-.It Cm alpha
-The DEC Alpha architecture.
-.It Cm amd64
-The AMD x86-64 architecture.
-.It Cm i386
-The Intel x86 based PC architecture.
-.It Cm ia64
-The Intel IA64 architecture.
-.It Cm pc98
-The PC98 architecture.
-.It Cm powerpc
-The IBM PowerPC architecture.
-.It Cm sparc64
-The Sun Sparc64 architecture.
-.El
-.Pp
-A kernel configuration file may have only one
-.Ic machine
-directive.
-.\" -------- MAKEOPTION --------
-.It Ic makeoptions Ar options
-Add
-.Ar options
-to the generated makefile.
-.Pp
-The
-.Ar options
-argument is a comma separated list of one or more option
-specifications.
-Each option specification has the form
-.Pp
-.D1 Ar MakeVariableName Ns Op = Ns Ar Value
-.Pp
-and results in the appropriate
-.Xr make 1
-variable definition being inserted into the generated makefile.
-If only the name of the
-.Xr make 1
-variable is specified,
-.Ar value
-is assumed to be the empty string.
-.Pp
-Example:
-.Bd -literal -offset indent -compact
-makeoptions MYMAKEOPTION="foobar"
-makeoptions MYNULLMAKEOPTION
-.Ed
-.\" -------- MAXUSERS --------
-.It Ic maxusers Ar number
-This optional directive is used to configure the size
-of some kernel data structures.
-The parameter
-.Ar number
-can be 0 (the default) or an integer greater than or equal to 2.
-A value of 0 indicates that the kernel should configure
-its data structures according to the size of available
-physical memory.
-If auto configuration is requested, the kernel will set
-this tunable to a value between 32 and 384.
-.Pp
-As explained in
-.Xr tuning 7 ,
-this tunable can also be set at boot time using
-.Xr loader 8 .
-.\" -------- NODEVICE --------
-.It Ic nodevice Ar name Op , Ar name Op ...
-.It Ic nodevices Ar name Op , Ar name Op ...
-Remove the specified devices
-from the list of previously selected devices.
-This directive can be used to cancel the effects of
-.Ic device
-or
-.Ic devices
-directives in files included using
-.Ic include .
-.\" -------- NOMAKEOPTION --------
-.It Ic nomakeoption Ar name
-Removes previously defined
-.Xr make 1
-option
-.Ar name
-from the kernel build.
-This directive can be used to cancel the effects of
-.Ic makeoption
-directives in files included using
-.Ic include .
-.\" -------- NOOPTION --------
-.It Ic nooption Ar name Op , Ar name Op ...
-.It Ic nooptions Ar name Op , Ar name Op ...
-Remove the specified kernel options
-from the list of previously defined options.
-This directive can be used to cancel the effects of
-.Ic option
-or
-.Ic options
-directives in files included using
-.Ic include .
-.\" -------- OPTIONS --------
-.It Ic option Ar optionspec Op , Ar optionspec Op ...
-.It Ic options Ar optionspec Op , Ar optionspec Op ...
-Add compile time kernel options to the kernel build.
-Each option specification has the form
-.Pp
-.D1 Ar name Ns Op = Ns Ar value
-.Pp
-If
-.Ar value
-is not specified, it is assumed to be
-.Dv NULL .
-Options common to all architectures are specified in
-the file
-.Pa sys/conf/options .
-Options specific to architecture
-.Ar arch
-are specified in the file
-.Pa sys/conf/options. Ns Aq Ar arch .
-.\" -------- PROFILE --------
-.It Ic profile Ar number
-Enables kernel profiling if
-.Ar number
-is non-zero.
-If
-.Ar number
-is 2 or greater, the kernel is configured for
-high-resolution profiling.
-Kernels can also be built for profiling using the
-.Fl p
-option to
-.Xr config 8 .
-.El
-.Ss Obsolete Directives
-The following kernel configuration directives are obsolete.
-.Bl -tag -width indent
-.\" -------- CONFIG --------
-.It Ic config
-This directive was used to specify the device to be used for the root
-file system.
-From
-.Fx 4.0
-onwards, this information is passed to a booting kernel by
-.Xr loader 8 .
-.El
-.Sh FILES
-.Bl -tag -width ".Pa sys/conf/Makefile. Ns Ar arch" -compact
-.It Pa sys/compile/ Ns Ar NAME
-Compile directory created from a kernel configuration.
-.It Pa sys/conf/Makefile. Ns Ar arch
-.Pa Makefile
-fragments for architecture
-.Ar arch .
-.It Pa sys/conf/files
-Devices common to all architectures.
-.It Pa sys/conf/files. Ns Ar arch
-Devices for architecture
-.Ar arch .
-.It Pa sys/conf/options
-Options common to all architectures.
-.It Pa sys/conf/options. Ns Ar arch
-Options for architecture
-.Ar arch .
-.El
-.Sh SEE ALSO
-.Xr kenv 1 ,
-.Xr make 1 ,
-.Xr device.hints 5 ,
-.Xr loader.conf 5 ,
-.Xr config 8 ,
-.Xr kldload 8 ,
-.Xr loader 8
-.Rs
-.%T "Building 4.4BSD Kernels with Config"
-.%A "Samuel J. Leffler"
-.%A "Michael J. Karels"
-.Re
-.Sh HISTORY
-The
-.Xr config 8
-utility first appeared in
-.Bx 4.1 ,
-and was subsequently revised in
-.Bx 4.4 .
-.Pp
-The kernel configuration mechanism changed further in
-.Fx 4.0
-and
-.Fx 5.0 ,
-moving toward an architecture supporting dynamic kernel
-configuration.
diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile
deleted file mode 100644
index 68d5ad3..0000000
--- a/usr.sbin/sade/Makefile
+++ /dev/null
@@ -1,106 +0,0 @@
-# $FreeBSD$
-
-.if ${MACHINE_ARCH} != "ia64"
-_wizard= wizard.c
-.endif
-
-PROG= sysinstall
-MAN= sysinstall.8
-SRCS= anonFTP.c cdrom.c command.c config.c devices.c dhcp.c \
- disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c \
- ftp.c globals.c http.c index.c install.c installUpgrade.c keymap.c \
- label.c main.c makedevs.c media.c menus.c misc.c modules.c \
- mouse.c msg.c network.c nfs.c options.c package.c \
- system.c tape.c tcpip.c termcap.c ttys.c ufs.c usb.c user.c \
- variable.c ${_wizard} keymap.h
-
-.if ${MACHINE} == "pc98"
-SRCS+= pccard.c
-.endif
-
-CFLAGS+= -DUSE_GZIP=1
-.if ${MACHINE} == "pc98"
-CFLAGS+= -DPC98
-.endif
-CFLAGS+= -I${.CURDIR}/../../gnu/lib/libdialog -I.
-
-DPADD= ${LIBDIALOG} ${LIBNCURSES} ${LIBUTIL} ${LIBDISK} ${LIBFTPIO}
-LDADD= -ldialog -lncurses -lutil -ldisk -lftpio
-
-CLEANFILES= makedevs.c rtermcap
-CLEANFILES+= keymap.tmp keymap.h
-
-.if exists(${.CURDIR}/../../share/termcap/termcap.src)
-RTERMCAP= TERMCAP=${.CURDIR}/../../share/termcap/termcap.src ./rtermcap
-.else
-RTERMCAP= ./rtermcap
-.endif
-
-makedevs.c: Makefile rtermcap
- echo '#include <sys/types.h>' > makedevs.c
- ${RTERMCAP} ansi | \
- file2c 'const char termcap_ansi[] = {' ',0};' \
- >> makedevs.c
- ${RTERMCAP} cons25w | \
- file2c 'const char termcap_cons25w[] = {' ',0};' \
- >> makedevs.c
- ${RTERMCAP} cons25 | \
- file2c 'const char termcap_cons25[] = {' ',0};' \
- >> makedevs.c
- ${RTERMCAP} cons25-m | \
- file2c 'const char termcap_cons25_m[] = {' ',0};' \
- >> makedevs.c
- ${RTERMCAP} cons25r | \
- file2c 'const char termcap_cons25r[] = {' ',0};' \
- >> makedevs.c
- ${RTERMCAP} cons25r-m | \
- file2c 'const char termcap_cons25r_m[] = {' ',0};' \
- >> makedevs.c
- ${RTERMCAP} cons25l1 | \
- file2c 'const char termcap_cons25l1[] = {' ',0};' \
- >> makedevs.c
- ${RTERMCAP} cons25l1-m | \
- file2c 'const char termcap_cons25l1_m[] = {' ',0};' \
- >> makedevs.c
- ${RTERMCAP} vt100 | \
- file2c 'const char termcap_vt100[] = {' ',0};' \
- >> makedevs.c
- ${RTERMCAP} xterm | \
- file2c 'const char termcap_xterm[] = {' ',0};' \
- >> makedevs.c
-
-build-tools: rtermcap
-
-rtermcap: rtermcap.c
- ${CC} -o ${.TARGET} ${.ALLSRC} -ltermcap
-
-.if ${MACHINE} == "pc98"
-KEYMAPS= jp.pc98 jp.pc98.iso
-.else
-KEYMAPS= be.iso bg.bds.ctrlcaps bg.phonetic.ctrlcaps br275.iso \
- ce.iso2 cs.latin2.qwertz danish.iso el.iso07 \
- estonian.cp850 estonian.iso estonian.iso15 finnish.iso fr.iso \
- german.iso gr.elot.acc gr.us101.acc hr.iso hu.iso2.101keys \
- it.iso icelandic.iso jp.106 norwegian.iso pl_PL.ISO8859-2 \
- pt.iso ru.koi8-r si.iso sk.iso2 spanish.iso swedish.iso \
- swissfrench.iso \
- swissgerman.iso ua.koi8-u ua.koi8-u.shift.alt uk.iso us.dvorak \
- us.iso us.pc-ctrl us.unix
-.endif
-
-keymap.h:
- rm -f keymap.tmp
- for map in ${KEYMAPS} ; do \
- KEYMAP_PATH=${.CURDIR}/../../share/syscons/keymaps \
- kbdcontrol -L $$map | \
- sed -e '/^static accentmap_t/,$$d' >> keymap.tmp ; \
- done
- echo "static struct keymapInfo keymapInfos[] = {" >> keymap.tmp
- for map in ${KEYMAPS} ; do \
- echo -n ' { "'$$map'", ' >> keymap.tmp ; \
- echo "&keymap_$$map }," | tr '[-.]' '_' >> keymap.tmp ; \
- done
- ( echo " { 0 }"; echo "};" ; echo "" ) >> keymap.tmp
- mv keymap.tmp keymap.h
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/sade/command.c b/usr.sbin/sade/command.c
deleted file mode 100644
index 33ebc35..0000000
--- a/usr.sbin/sade/command.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-
-#define MAX_NUM_COMMANDS 10
-
-typedef struct {
- char key[FILENAME_MAX];
- struct {
- enum { CMD_SHELL, CMD_FUNCTION } type;
- void *ptr, *data;
- } cmds[MAX_NUM_COMMANDS];
- int ncmds;
-} Command;
-
-#define MAX_CMDS 200
-static Command *commandStack[MAX_CMDS];
-int numCommands;
-
-/* Nuke the command stack */
-void
-command_clear(void)
-{
- int i, j;
-
- for (i = 0; i < numCommands; i++)
- for (j = 0; j < commandStack[i]->ncmds; j++)
- if (commandStack[i]->cmds[j].type == CMD_SHELL)
- free(commandStack[i]->cmds[j].ptr);
- free(commandStack[i]);
- numCommands = 0;
-}
-
-static void
-addit(char *key, int type, void *cmd, void *data)
-{
- int i;
-
- /* First, look for the key already present and add a command to it if found */
- for (i = 0; i < numCommands; i++) {
- if (!strcmp(commandStack[i]->key, key)) {
- if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
- msgFatal("More than %d commands stacked up behind %s??", MAX_NUM_COMMANDS, key);
- commandStack[i]->cmds[commandStack[i]->ncmds].type = type;
- commandStack[i]->cmds[commandStack[i]->ncmds].ptr = cmd;
- commandStack[i]->cmds[commandStack[i]->ncmds].data = data;
- ++(commandStack[i]->ncmds);
- return;
- }
- }
- if (numCommands == MAX_CMDS)
- msgFatal("More than %d commands accumulated??", MAX_CMDS);
-
- /* If we fell to here, it's a new key */
- commandStack[numCommands] = safe_malloc(sizeof(Command));
- strcpy(commandStack[numCommands]->key, key);
- commandStack[numCommands]->ncmds = 1;
- commandStack[numCommands]->cmds[0].type = type;
- commandStack[numCommands]->cmds[0].ptr = cmd;
- commandStack[numCommands]->cmds[0].data = data;
- ++numCommands;
-}
-
-/* Add a shell command under a given key */
-void
-command_shell_add(char *key, char *fmt, ...)
-{
- va_list args;
- char *cmd;
-
- cmd = (char *)safe_malloc(256);
- va_start(args, fmt);
- vsnprintf(cmd, 256, fmt, args);
- va_end(args);
-
- addit(key, CMD_SHELL, cmd, NULL);
-}
-
-/* Add a shell command under a given key */
-void
-command_func_add(char *key, commandFunc func, void *data)
-{
- addit(key, CMD_FUNCTION, func, data);
-}
-
-static int
-sort_compare(Command *p1, Command *p2)
-{
- if (!p1 && !p2)
- return 0;
- else if (!p1 && p2) /* NULL has a "greater" value for commands */
- return 1;
- else if (p1 && !p2)
- return -1;
- else
- return strcmp(p1->key, p2->key);
-}
-
-void
-command_sort(void)
-{
- int i, j;
-
- commandStack[numCommands] = NULL;
- /* Just do a crude bubble sort since the list is small */
- for (i = 0; i < numCommands; i++) {
- for (j = 0; j < numCommands; j++) {
- if (sort_compare(commandStack[j], commandStack[j + 1]) > 0) {
- Command *tmp = commandStack[j];
-
- commandStack[j] = commandStack[j + 1];
- commandStack[j + 1] = tmp;
- }
- }
- }
-}
-
-/* Run all accumulated commands in sorted order */
-void
-command_execute(void)
-{
- int i, j, ret;
- commandFunc func;
-
- for (i = 0; i < numCommands; i++) {
- for (j = 0; j < commandStack[i]->ncmds; j++) {
- /* If it's a shell command, run system on it */
- if (commandStack[i]->cmds[j].type == CMD_SHELL) {
- msgNotify("Doing %s", (char *)commandStack[i]->cmds[j].ptr);
- ret = vsystem("%s", (char *)commandStack[i]->cmds[j].ptr);
- if (isDebug())
- msgDebug("Command `%s' returns status %d\n",
- (char *)commandStack[i]->cmds[j].ptr, ret);
- }
- else {
- /* It's a function pointer - call it with the key and
- the data */
- func = (commandFunc)commandStack[i]->cmds[j].ptr;
- if (isDebug())
- msgDebug("%p: Execute(%s, %s)\n",
- func, commandStack[i]->key,
- (char *)commandStack[i]->cmds[j].data);
- ret = (*func)(commandStack[i]->key, commandStack[i]->cmds[j].data);
- if (isDebug())
- msgDebug("Function @ %p returns status %d\n",
- commandStack[i]->cmds[j].ptr, ret);
- }
- }
- }
-}
diff --git a/usr.sbin/sade/config.c b/usr.sbin/sade/config.c
deleted file mode 100644
index f86ce13..0000000
--- a/usr.sbin/sade/config.c
+++ /dev/null
@@ -1,1115 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <sys/disklabel.h>
-#include <sys/wait.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/mount.h>
-#include <libdisk.h>
-#include <time.h>
-#include <kenv.h>
-
-static Chunk *chunk_list[MAX_CHUNKS];
-static int nchunks;
-static int rootdev_is_od;
-
-/* arg to sort */
-static int
-chunk_compare(Chunk *c1, Chunk *c2)
-{
- if (!c1 && !c2)
- return 0;
- else if (!c1 && c2)
- return 1;
- else if (c1 && !c2)
- return -1;
- else if (!c1->private_data && !c2->private_data)
- return 0;
- else if (c1->private_data && !c2->private_data)
- return 1;
- else if (!c1->private_data && c2->private_data)
- return -1;
- else
- return strcmp(((PartInfo *)(c1->private_data))->mountpoint, ((PartInfo *)(c2->private_data))->mountpoint);
-}
-
-static void
-chunk_sort(void)
-{
- int i, j;
-
- for (i = 0; i < nchunks; i++) {
- for (j = 0; j < nchunks; j++) {
- if (chunk_compare(chunk_list[j], chunk_list[j + 1]) > 0) {
- Chunk *tmp = chunk_list[j];
-
- chunk_list[j] = chunk_list[j + 1];
- chunk_list[j + 1] = tmp;
- }
- }
- }
-}
-
-static void
-check_rootdev(Chunk **list, int n)
-{
- int i;
- Chunk *c;
-
- rootdev_is_od = 0;
- for (i = 0; i < n; i++) {
- c = *list++;
- if (c->type == part && (c->flags & CHUNK_IS_ROOT)
- && strncmp(c->disk->name, "od", 2) == 0)
- rootdev_is_od = 1;
- }
-}
-
-static char *
-name_of(Chunk *c1)
-{
- return c1->name;
-}
-
-static char *
-mount_point(Chunk *c1)
-{
- if (c1->type == part && c1->subtype == FS_SWAP)
- return "none";
- else if (c1->type == part || c1->type == fat || c1->type == efi)
- return ((PartInfo *)c1->private_data)->mountpoint;
- return "/bogus";
-}
-
-static char *
-fstype(Chunk *c1)
-{
- if (c1->type == fat || c1->type == efi)
- return "msdosfs";
- else if (c1->type == part) {
- if (c1->subtype != FS_SWAP)
- return "ufs";
- else
- return "swap";
- }
- return "bogus";
-}
-
-static char *
-fstype_short(Chunk *c1)
-{
- if (c1->type == part) {
- if (c1->subtype != FS_SWAP) {
- if (rootdev_is_od == 0 && strncmp(c1->name, "od", 2) == 0)
- return "rw,noauto";
- else
- return "rw";
- }
- else
- return "sw";
- }
- else if (c1->type == fat) {
- if (strncmp(c1->name, "od", 2) == 0)
- return "ro,noauto";
- else
- return "ro";
- }
- else if (c1->type == efi)
- return "rw";
-
- return "bog";
-}
-
-static int
-seq_num(Chunk *c1)
-{
- if (c1->type == part && c1->subtype != FS_SWAP) {
- if (rootdev_is_od == 0 && strncmp(c1->name, "od", 2) == 0)
- return 0;
- else if (c1->flags & CHUNK_IS_ROOT)
- return 1;
- else
- return 2;
- }
- return 0;
-}
-
-int
-configFstab(dialogMenuItem *self)
-{
- Device **devs;
- Disk *disk;
- FILE *fstab;
- int i, cnt;
- Chunk *c1, *c2;
-
- if (!RunningAsInit) {
- if (file_readable("/etc/fstab"))
- return DITEM_SUCCESS;
- else {
- msgConfirm("Attempting to rebuild your /etc/fstab file. Warning: If you had\n"
- "any CD devices in use before running sysinstall then they may NOT\n"
- "be found by this run!");
- }
- }
-
- devs = deviceFind(NULL, DEVICE_TYPE_DISK);
- if (!devs) {
- msgConfirm("No disks found!");
- return DITEM_FAILURE;
- }
-
- /* Record all the chunks */
- nchunks = 0;
- for (i = 0; devs[i]; i++) {
- if (!devs[i]->enabled)
- continue;
- disk = (Disk *)devs[i]->private;
- if (!disk->chunks)
- msgFatal("No chunk list found for %s!", disk->name);
- for (c1 = disk->chunks->part; c1; c1 = c1->next) {
- if (c1->type == freebsd) {
- for (c2 = c1->part; c2; c2 = c2->next) {
- if (c2->type == part && (c2->subtype == FS_SWAP || c2->private_data))
- chunk_list[nchunks++] = c2;
- }
- }
- else if (((c1->type == fat || c1->type == efi || c1->type == part) &&
- c1->private_data) || (c1->type == part && c1->subtype == FS_SWAP))
- chunk_list[nchunks++] = c1;
- }
- }
- chunk_list[nchunks] = 0;
- chunk_sort();
-
- fstab = fopen("/etc/fstab", "w");
- if (!fstab) {
- msgConfirm("Unable to create a new /etc/fstab file! Manual intervention\n"
- "will be required.");
- return DITEM_FAILURE;
- }
-
- check_rootdev(chunk_list, nchunks);
-
- /* Go for the burn */
- msgDebug("Generating /etc/fstab file\n");
- fprintf(fstab, "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#\n");
- for (i = 0; i < nchunks; i++)
- fprintf(fstab, "/dev/%s\t\t%s\t\t%s\t%s\t\t%d\t%d\n", name_of(chunk_list[i]), mount_point(chunk_list[i]),
- fstype(chunk_list[i]), fstype_short(chunk_list[i]), seq_num(chunk_list[i]), seq_num(chunk_list[i]));
-
- /* Now look for the CDROMs */
- devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
- cnt = deviceCount(devs);
-
- /* Write out the CDROM entries */
- for (i = 0; i < cnt; i++) {
- char cdname[10];
-
- sprintf(cdname, "/cdrom%s", i ? itoa(i) : "");
- if (Mkdir(cdname))
- msgConfirm("Unable to make mount point for: %s", cdname);
- else
- fprintf(fstab, "/dev/%s\t\t%s\t\tcd9660\tro,noauto\t0\t0\n", devs[i]->name, cdname);
- }
-
- fclose(fstab);
- if (isDebug())
- msgDebug("Wrote out /etc/fstab file\n");
- return DITEM_SUCCESS;
-}
-
-/* Do the work of sucking in a config file.
- * config is the filename to read in.
- * lines is a fixed (max) sized array of char*
- * returns number of lines read. line contents
- * are malloc'd and must be freed by the caller.
- */
-int
-readConfig(char *config, char **lines, int max)
-{
- FILE *fp;
- char line[256];
- int i, nlines;
-
- fp = fopen(config, "r");
- if (!fp)
- return -1;
-
- nlines = 0;
- /* Read in the entire file */
- for (i = 0; i < max; i++) {
- if (!fgets(line, sizeof line, fp))
- break;
- lines[nlines++] = strdup(line);
- }
- fclose(fp);
- if (isDebug())
- msgDebug("readConfig: Read %d lines from %s.\n", nlines, config);
- return nlines;
-}
-
-#define MAX_LINES 2000 /* Some big number we're not likely to ever reach - I'm being really lazy here, I know */
-
-static void
-readConfigFile(char *config, int marked)
-{
- char *lines[MAX_LINES], *cp, *cp2;
- int i, nlines;
-
- nlines = readConfig(config, lines, MAX_LINES);
- if (nlines == -1)
- return;
-
- for (i = 0; i < nlines; i++) {
- /* Skip the comments & non-variable settings */
- if (lines[i][0] == '#' || !(cp = index(lines[i], '='))) {
- free(lines[i]);
- continue;
- }
- *cp++ = '\0';
- /* Find quotes */
- if ((cp2 = index(cp, '"')) || (cp2 = index(cp, '\047'))) {
- cp = cp2 + 1;
- cp2 = index(cp, *cp2);
- }
- /* If valid quotes, use it */
- if (cp2) {
- *cp2 = '\0';
- /* If we have a legit value, set it */
- if (strlen(cp))
- variable_set2(lines[i], cp, marked);
- }
- free(lines[i]);
- }
-}
-
-/* Load the environment from rc.conf file(s) */
-void
-configEnvironmentRC_conf(void)
-{
- static struct {
- char *fname;
- int marked;
- } configs[] = {
- { "/etc/defaults/rc.conf", 0 },
- { "/etc/rc.conf", 0 },
- { "/etc/rc.conf.local", 0 },
- { NULL, 0 },
- };
- int i;
-
- for (i = 0; configs[i].fname; i++) {
- if (file_readable(configs[i].fname))
- readConfigFile(configs[i].fname, configs[i].marked);
- }
-}
-
-/* Load the environment from a resolv.conf file */
-void
-configEnvironmentResolv(char *config)
-{
- char *lines[MAX_LINES];
- int i, nlines;
-
- nlines = readConfig(config, lines, MAX_LINES);
- if (nlines == -1)
- return;
- for (i = 0; i < nlines; i++) {
- Boolean name_set = variable_get(VAR_NAMESERVER) ? 1 : 0;
-
- if (!strncmp(lines[i], "domain", 6) && !variable_get(VAR_DOMAINNAME))
- variable_set2(VAR_DOMAINNAME, string_skipwhite(string_prune(lines[i] + 6)), 0);
- else if (!name_set && !strncmp(lines[i], "nameserver", 10)) {
- /* Only take the first nameserver setting - we're lame */
- variable_set2(VAR_NAMESERVER, string_skipwhite(string_prune(lines[i] + 10)), 0);
- }
- free(lines[i]);
- }
-}
-
-/* Version of below for dispatch routines */
-int
-configRC(dialogMenuItem *unused)
-{
- configRC_conf();
- return DITEM_SUCCESS;
-}
-
-/*
- * Write out rc.conf
- *
- * rc.conf is sorted if running as init and the needed utilities are
- * present
- *
- * If rc.conf is sorted, all variables in rc.conf which conflict with
- * the variables in the environment are removed from the original
- * rc.conf
- */
-void
-configRC_conf(void)
-{
- char line[256];
- FILE *rcSite, *rcOld;
- Variable *v;
- int write_header;
- time_t t_loc;
- char *cp;
- static int did_marker = 0;
- int do_sort;
- int do_merge;
- time_t tp;
-
- configTtys();
- write_header = !file_readable("/etc/rc.conf");
- do_sort = RunningAsInit && file_readable("/usr/bin/sort") &&
- file_readable("/usr/bin/uniq");
- do_merge = do_sort && file_readable("/etc/rc.conf");
-
- if(do_merge) {
- rcSite = fopen("/etc/rc.conf.new", "w");
- } else
- rcSite = fopen("/etc/rc.conf", "a");
- if (rcSite == NULL) {
- msgError("Error opening new rc.conf for writing: %s (%u)", strerror(errno), errno);
- return;
- }
-
- if (do_merge) {
- /* "Copy" the old rc.conf */
- rcOld = fopen("/etc/rc.conf", "r");
- if(!rcOld) {
- msgError("Error opening rc.conf for reading: %s (%u)", strerror(errno), errno);
- return;
- }
- while(fgets(line, sizeof(line), rcOld)) {
- if(line[0] == '#' || variable_check2(line) != 0)
- fprintf(rcSite, "%s", line);
- else
- fprintf(rcSite, "#REMOVED: %s", line);
- }
- fclose(rcOld);
- } else if (write_header) {
- fprintf(rcSite, "# This file now contains just the overrides from /etc/defaults/rc.conf.\n");
- fprintf(rcSite, "# Please make all changes to this file, not to /etc/defaults/rc.conf.\n\n");
- fprintf(rcSite, "# Enable network daemons for user convenience.\n");
- if ((t_loc = time(NULL)) != -1 && (cp = ctime(&t_loc)))
- fprintf(rcSite, "# Created: %s", cp);
- }
-
- /* Now do variable substitutions */
- for (v = VarHead; v; v = v->next) {
- if (v->dirty) {
- if (!did_marker) {
- time(&tp);
- fprintf(rcSite, "# -- sysinstall generated deltas -- # "
- "%s", ctime(&tp));
- did_marker = 1;
- }
- fprintf(rcSite, "%s=\"%s\"\n", v->name, v->value);
- v->dirty = 0;
- }
- }
- fclose(rcSite);
-
- if(do_merge) {
- if(rename("/etc/rc.conf.new", "/etc/rc.conf") != 0) {
- msgError("Error renaming temporary rc.conf: %s (%u)", strerror(errno), errno);
- return;
- }
- }
-
- /* Tidy up the resulting file if it's late enough in the installation
- for sort and uniq to be available */
- if (do_sort) {
- (void)vsystem("sort /etc/rc.conf | uniq > /etc/rc.conf.new && mv /etc/rc.conf.new /etc/rc.conf");
- }
-}
-
-int
-configSaver(dialogMenuItem *self)
-{
- variable_set((char *)self->data, 1);
- if (!variable_get(VAR_BLANKTIME))
- variable_set2(VAR_BLANKTIME, "300", 1);
- return DITEM_SUCCESS;
-}
-
-int
-configSaverTimeout(dialogMenuItem *self)
-{
- return (variable_get_value(VAR_BLANKTIME,
- "Enter time-out period in seconds for screen saver", 1) ?
- DITEM_SUCCESS : DITEM_FAILURE);
-}
-
-int
-configNTP(dialogMenuItem *self)
-{
- int status;
-
- status = variable_get_value(VAR_NTPDATE_FLAGS,
- "Enter the name of an NTP server", 1)
- ? DITEM_SUCCESS : DITEM_FAILURE;
- if (status == DITEM_SUCCESS) {
- static char tmp[255];
-
- snprintf(tmp, sizeof(tmp), "ntpdate_enable=YES,ntpdate_flags=%s",
- variable_get(VAR_NTPDATE_FLAGS));
- self->data = tmp;
- dmenuSetVariables(self);
- }
- return status;
-}
-
-int
-configUsers(dialogMenuItem *self)
-{
- WINDOW *w = savescr();
-
- dialog_clear_norefresh();
- dmenuOpenSimple(&MenuUsermgmt, FALSE);
- restorescr(w);
- return DITEM_SUCCESS;
-}
-
-#ifdef WITH_LINUX
-int
-configLinux(dialogMenuItem *self)
-{
- WINDOW *w = savescr();
- int i;
-
- dialog_clear_norefresh();
- variable_set2(VAR_LINUX_ENABLE, "YES", 1);
- Mkdir("/compat/linux");
- msgNotify("Installing Linux compatibility library...");
- i = package_add("linux_base-8");
- restorescr(w);
- return i;
-}
-#endif
-
-#ifdef __alpha__
-int
-configOSF1(dialogMenuItem *self)
-{
-
- variable_set2(VAR_OSF1_ENABLE, "YES", 1);
- Mkdir("/compat/osf1");
- return DITEM_SUCCESS;
-}
-#endif
-
-int
-configSecurelevel(dialogMenuItem *self)
-{
- WINDOW *w = savescr();
-
- dialog_clear_norefresh();
- dmenuOpenSimple(&MenuSecurelevel, FALSE);
- restorescr(w);
- return DITEM_SUCCESS;
-}
-
-int
-configSecurelevelDisabled(dialogMenuItem *self)
-{
-
- variable_set2("kern_securelevel_enable", "NO", 1);
- return DITEM_SUCCESS;
-}
-
-int
-configSecurelevelSecure(dialogMenuItem *self)
-{
-
- variable_set2("kern_securelevel_enable", "YES", 1);
- variable_set2("kern_securelevel", "1", 1);
- return DITEM_SUCCESS;
-}
-
-int
-configSecurelevelHighlySecure(dialogMenuItem *self)
-{
-
- variable_set2("kern_securelevel_enable", "YES", 1);
- variable_set2("kern_securelevel", "2", 1);
- return DITEM_SUCCESS;
-}
-
-int
-configSecurelevelNetworkSecure(dialogMenuItem *self)
-{
-
- variable_set2("kern_securelevel_enable", "YES", 1);
- variable_set2("kern_securelevel", "3", 1);
- return DITEM_SUCCESS;
-}
-
-int
-configSecurity(dialogMenuItem *self)
-{
- WINDOW *w = savescr();
-
- dialog_clear_norefresh();
- dmenuOpenSimple(&MenuSecurity, FALSE);
- restorescr(w);
- return DITEM_SUCCESS;
-}
-
-static void
-write_root_xprofile(char *str)
-{
- FILE *fp;
- int len;
- char **cp;
- static char *flist[] = { /* take care of both xdm and startx */
- "/root/.xinitrc",
- "/root/.xsession",
- "/usr/share/skel/dot.xinitrc",
- "/usr/share/skel/dot.xsession",
- NULL,
- };
-
- len = strlen(str);
- for (cp = flist; *cp; cp++) {
- fp = fopen(*cp, "w");
- if (fp) {
- fwrite(str, 1, len, fp);
- fchmod(fileno(fp), 0755);
- fclose(fp);
- }
- }
-}
-
-static int
-gotit(char *fname)
-{
- char tmp[FILENAME_MAX];
-
- snprintf(tmp, sizeof tmp, "/usr/X11R6/bin/%s", fname);
- if (file_executable(tmp))
- return TRUE;
- snprintf(tmp, sizeof tmp, "/usr/local/bin/%s", fname);
- return file_executable(tmp);
-}
-
-int
-configResolv(dialogMenuItem *ditem)
-{
- FILE *fp;
- char *cp, *c6p, *dp, *hp;
-
- cp = variable_get(VAR_NAMESERVER);
- if (!cp || !*cp)
- goto skip;
- Mkdir("/etc");
- fp = fopen("/etc/resolv.conf", "w");
- if (!fp)
- return DITEM_FAILURE;
- if (variable_get(VAR_DOMAINNAME))
- fprintf(fp, "domain\t%s\n", variable_get(VAR_DOMAINNAME));
- fprintf(fp, "nameserver\t%s\n", cp);
- fclose(fp);
- if (isDebug())
- msgDebug("Wrote out /etc/resolv.conf\n");
-
-skip:
- dp = variable_get(VAR_DOMAINNAME);
- cp = variable_get(VAR_IPADDR);
- c6p = variable_get(VAR_IPV6ADDR);
- hp = variable_get(VAR_HOSTNAME);
- /* Tack ourselves into /etc/hosts */
- fp = fopen("/etc/hosts", "w");
- if (!fp)
- return DITEM_FAILURE;
- /* Add an entry for localhost */
- if (dp) {
- fprintf(fp, "::1\t\t\tlocalhost.%s localhost\n", dp);
- fprintf(fp, "127.0.0.1\t\tlocalhost.%s localhost\n", dp);
- } else {
- fprintf(fp, "::1\t\t\tlocalhost\n");
- fprintf(fp, "127.0.0.1\t\tlocalhost\n");
- }
- /* Now the host entries, if applicable */
- if (((cp && cp[0] != '0') || (c6p && c6p[0] != '0')) && hp) {
- char cp2[255];
-
- if (!index(hp, '.'))
- cp2[0] = '\0';
- else {
- SAFE_STRCPY(cp2, hp);
- *(index(cp2, '.')) = '\0';
- }
- if (c6p && c6p[0] != '0') {
- fprintf(fp, "%s\t%s %s\n", c6p, hp, cp2);
- fprintf(fp, "%s\t%s.\n", c6p, hp);
- }
- if (cp && cp[0] != '0') {
- fprintf(fp, "%s\t\t%s %s\n", cp, hp, cp2);
- fprintf(fp, "%s\t\t%s.\n", cp, hp);
- }
- }
- fclose(fp);
- if (isDebug())
- msgDebug("Wrote out /etc/hosts\n");
- return DITEM_SUCCESS;
-}
-
-int
-configRouter(dialogMenuItem *self)
-{
- int ret;
-
- ret = variable_get_value(VAR_ROUTER,
- "Please specify the router you wish to use. Routed is\n"
- "provided with the stock system and gated is provided\n"
- "as an optional package which this installation system\n"
- "will attempt to load if you select gated. Any other\n"
- "choice of routing daemon will be assumed to be something\n"
- "the user intends to install themselves before rebooting\n"
- "the system. If you don't want any routing daemon, choose NO", 1)
- ? DITEM_SUCCESS : DITEM_FAILURE;
-
- if (ret == DITEM_SUCCESS) {
- char *cp = variable_get(VAR_ROUTER);
-
- if (cp && strcmp(cp, "NO")) {
- variable_set2(VAR_ROUTER_ENABLE, "YES", 1);
- if (!strcmp(cp, "gated")) {
- if (package_add("gated") != DITEM_SUCCESS) {
- msgConfirm("Unable to load gated package. Falling back to no router.");
- variable_unset(VAR_ROUTER);
- variable_unset(VAR_ROUTERFLAGS);
- variable_set2(VAR_ROUTER_ENABLE, "NO", 1);
- cp = NULL;
- }
- }
- if (cp) {
- /* Now get the flags, if they chose a router */
- ret = variable_get_value(VAR_ROUTERFLAGS,
- "Please Specify the routing daemon flags; if you're running routed\n"
- "then -q is the right choice for nodes and -s for gateway hosts.\n", 1)
- ? DITEM_SUCCESS : DITEM_FAILURE;
- if (ret != DITEM_SUCCESS)
- variable_unset(VAR_ROUTERFLAGS);
- }
- }
- else {
- /* No router case */
- variable_set2(VAR_ROUTER_ENABLE, "NO", 1);
- variable_unset(VAR_ROUTERFLAGS);
- variable_unset(VAR_ROUTER);
- }
- }
- else {
- variable_set2(VAR_ROUTER_ENABLE, "NO", 1);
- variable_unset(VAR_ROUTERFLAGS);
- variable_unset(VAR_ROUTER);
- }
- return ret;
-}
-
-/* Shared between us and index_initialize() */
-extern PkgNode Top, Plist;
-
-int
-configPackages(dialogMenuItem *self)
-{
- int i, restoreflag = 0;
- PkgNodePtr tmp;
-
- /* Did we get an INDEX? */
- i = index_initialize("packages/INDEX");
- if (DITEM_STATUS(i) == DITEM_FAILURE)
- return i;
-
- while (1) {
- int ret, pos, scroll;
-
- /* Bring up the packages menu */
- pos = scroll = 0;
- index_menu(&Top, &Top, &Plist, &pos, &scroll);
-
- if (Plist.kids && Plist.kids->name) {
- /* Now show the packing list menu */
- pos = scroll = 0;
- ret = index_menu(&Plist, &Plist, NULL, &pos, &scroll);
- if (ret & DITEM_LEAVE_MENU)
- break;
- else if (DITEM_STATUS(ret) != DITEM_FAILURE) {
- dialog_clear();
- restoreflag = 1;
- for (tmp = Plist.kids; tmp && tmp->name; tmp = tmp->next)
- (void)index_extract(mediaDevice, &Top, tmp, FALSE);
- break;
- }
- }
- else {
- msgConfirm("No packages were selected for extraction.");
- break;
- }
- }
- tmp = Plist.kids;
- while (tmp) {
- PkgNodePtr tmp2 = tmp->next;
-
- safe_free(tmp);
- tmp = tmp2;
- }
- index_init(NULL, &Plist);
- return DITEM_SUCCESS | (restoreflag ? DITEM_RESTORE : 0);
-}
-
-/* Load pcnfsd package */
-int
-configPCNFSD(dialogMenuItem *self)
-{
- int ret;
-
- ret = package_add("pcnfsd");
- if (DITEM_STATUS(ret) == DITEM_SUCCESS) {
- variable_set2(VAR_PCNFSD, "YES", 0);
- variable_set2("mountd_flags", "-n", 1);
- }
- return ret;
-}
-
-int
-configInetd(dialogMenuItem *self)
-{
- char cmd[256];
-
- WINDOW *w = savescr();
-
- if (msgYesNo("The Internet Super Server (inetd) allows a number of simple Internet\n"
- "services to be enabled, including finger, ftp, and telnetd. Enabling\n"
- "these services may increase risk of security problems by increasing\n"
- "the exposure of your system.\n\n"
- "With this in mind, do you wish to enable inetd?\n")) {
- variable_set2("inetd_enable", "NO", 1);
- } else {
- /* If inetd is enabled, we'll need an inetd.conf */
- variable_set2("inetd_enable", "YES", 1);
- if (!msgYesNo("inetd(8) relies on its configuration file, /etc/inetd.conf, to determine\n"
- "which of its Internet services will be available. The default FreeBSD\n"
- "inetd.conf(5) leaves all services disabled by default, so they must be\n"
- "specifically enabled in the configuration file before they will\n"
- "function, even once inetd(8) is enabled. Note that services for\n"
- "IPv6 must be separately enabled from IPv4 services.\n\n"
- "Select [Yes] now to invoke an editor on /etc/inetd.conf, or [No] to\n"
- "use the current settings.\n")) {
- sprintf(cmd, "%s /etc/inetd.conf", variable_get(VAR_EDITOR));
- dialog_clear();
- systemExecute(cmd);
- }
- }
- restorescr(w);
- return DITEM_SUCCESS;
-}
-
-int
-configNFSServer(dialogMenuItem *self)
-{
- char cmd[256];
- int retval = 0;
-
- /* If we're an NFS server, we need an exports file */
- if (!file_readable("/etc/exports")) {
- WINDOW *w = savescr();
-
- if (file_readable("/etc/exports.disabled"))
- vsystem("mv /etc/exports.disabled /etc/exports");
- else {
- dialog_clear_norefresh();
- msgConfirm("Operating as an NFS server means that you must first configure\n"
- "an /etc/exports file to indicate which hosts are allowed certain\n"
- "kinds of access to your local file systems.\n"
- "Press [ENTER] now to invoke an editor on /etc/exports\n");
- vsystem("echo '#The following examples export /usr to 3 machines named after ducks,' > /etc/exports");
- vsystem("echo '#/usr/src and /usr/ports read-only to machines named after trouble makers' >> /etc/exports");
- vsystem("echo '#/home and all directories under it to machines named after dead rock stars' >> /etc/exports");
- vsystem("echo '#and, /a to a network of privileged machines allowed to write on it as root.' >> /etc/exports");
- vsystem("echo '#/usr huey louie dewie' >> /etc/exports");
- vsystem("echo '#/usr/src /usr/obj -ro calvin hobbes' >> /etc/exports");
- vsystem("echo '#/home -alldirs janice jimmy frank' >> /etc/exports");
- vsystem("echo '#/a -maproot=0 -network 10.0.1.0 -mask 255.255.248.0' >> /etc/exports");
- vsystem("echo '#' >> /etc/exports");
- vsystem("echo '# You should replace these lines with your actual exported filesystems.' >> /etc/exports");
- vsystem("echo \"# Note that BSD's export syntax is 'host-centric' vs. Sun's 'FS-centric' one.\" >> /etc/exports");
- vsystem("echo >> /etc/exports");
- sprintf(cmd, "%s /etc/exports", variable_get(VAR_EDITOR));
- dialog_clear();
- systemExecute(cmd);
- }
- variable_set2(VAR_NFS_SERVER, "YES", 1);
- retval = configRpcBind(NULL);
- restorescr(w);
- }
- else if (variable_get(VAR_NFS_SERVER)) { /* We want to turn it off again? */
- vsystem("mv -f /etc/exports /etc/exports.disabled");
- variable_unset(VAR_NFS_SERVER);
- }
- return DITEM_SUCCESS | retval;
-}
-
-/*
- * Extend the standard dmenuToggleVariable() method to also check and set
- * the rpcbind variable if needed.
- */
-int
-configRpcBind(dialogMenuItem *self)
-{
- int retval = 0;
- int doupdate = 1;
-
- if (self != NULL) {
- retval = dmenuToggleVariable(self);
- if (strcmp(variable_get(self->data), "YES") != 0)
- doupdate = 0;
- }
-
- if (doupdate && strcmp(variable_get(VAR_RPCBIND_ENABLE), "YES") != 0) {
- variable_set2(VAR_RPCBIND_ENABLE, "YES", 1);
- retval |= DITEM_REDRAW;
- }
-
- return retval;
-}
-
-int
-configEtcTtys(dialogMenuItem *self)
-{
- char cmd[256];
-
- WINDOW *w = savescr();
-
- /* Simply prompt for confirmation, then edit away. */
- if (msgYesNo("Configuration of system TTYs requires editing the /etc/ttys file.\n"
- "Typical configuration activities might include enabling getty(8)\n"
- "on the first serial port to allow login via serial console after\n"
- "reboot, or to enable xdm. The default ttys file enables normal\n"
- "virtual consoles, and most sites will not need to perform manual\n"
- "configuration.\n\n"
- "To load /etc/ttys in the editor, select [Yes], otherwise, [No].")) {
- } else {
- configTtys();
- sprintf(cmd, "%s /etc/ttys", variable_get(VAR_EDITOR));
- dialog_clear();
- systemExecute(cmd);
- }
-
- restorescr(w);
- return DITEM_SUCCESS;
-}
-
-#ifdef __i386__
-int
-checkLoaderACPI(void)
-{
- char val[4];
-
- if (kenv(KENV_GET, "loader.acpi_disabled_by_user", &val[0], 4) <= 0) {
- return (0);
- }
-
- if (strtol(&val[0], NULL, 10) <= 0) {
- return (0);
- }
-
- return (1);
-}
-
-int
-configLoaderACPI(int disable)
-{
- FILE *ldconf;
-
- ldconf = fopen("/boot/loader.conf", "a");
- if (ldconf == NULL) {
- msgConfirm("Unable to open /boot/loader.conf. Please consult the\n"
- "FreeBSD Handbook for instructions on disabling ACPI");
- return DITEM_FAILURE;
- }
-
- fprintf(ldconf, "# --- Generated by sysinstall ---\n");
- fprintf(ldconf, "hint.acpi.0.disabled=%d\n", disable);
- fclose(ldconf);
-
- return DITEM_SUCCESS;
-}
-#endif
-
-int
-configMTAPostfix(dialogMenuItem *self)
-{
- int ret;
- FILE *perconf;
-
- if(setenv("POSTFIX_DEFAULT_MTA", "YES", 1) != 0)
- msgError("Error setting the enviroment variable POSTFIX_DEFAULT_MTA: %s (%u)",
- strerror(errno), errno);
-
- ret = package_add("postfix-2.2");
- unsetenv("POSTFIX_DEFAULT_MTA");
-
- if(DITEM_STATUS(ret) == DITEM_FAILURE) {
- msgConfirm("An error occurred while adding the postfix package\n"
- "Please change installation media and try again.");
- return ret;
- }
-
- variable_set2(VAR_SENDMAIL_ENABLE, "YES", 1);
- variable_set2("sendmail_flags", "-bd", 1);
- variable_set2("sendmail_outbound_enable", "NO", 1);
- variable_set2("sendmail_submit_enable", "NO", 1);
- variable_set2("sendmail_msp_queue_enable", "NO", 1);
-
- perconf = fopen("/etc/periodic.conf", "a");
- if (perconf == NULL) {
- msgConfirm("Unable to open /etc/periodic.conf.\n"
- "The daily cleanup scripts might generate errors when\n"
- "trying to run some sendmail only cleanup scripts.\n"
- "Please consult the documentation for the postfix port on how to\n"
- "fix this.");
-
- /* Not really a serious problem, so we return success */
- return DITEM_SUCCESS;
- }
-
- fprintf(perconf, "# --- Generated by sysinstall ---\n");
- fprintf(perconf, "daily_clean_hoststat_enable=\"NO\"\n");
- fprintf(perconf, "daily_status_mail_rejects_enable=\"NO\"\n");
- fprintf(perconf, "daily_status_include_submit_mailq=\"NO\"\n");
- fprintf(perconf, "daily_submit_queuerun=\"NO\"\n");
- fclose(perconf);
-
- msgConfirm("Postfix is now installed and enabled as the default MTA.\n"
- "Please check that the configuration works as expected.\n"
- "See the Postfix documentation for more information.\n"
- "The documentation can be found in /usr/local/share/doc/postfix/\n"
- "or on the Postfix website at http://www.postfix.org/.");
-
- return DITEM_SUCCESS;
-}
-
-int
-configMTAExim(dialogMenuItem *self)
-{
- int ret;
- FILE *perconf, *mailerconf, *newsyslogconf;
-
- ret = package_add("exim");
-
- if(DITEM_STATUS(ret) == DITEM_FAILURE) {
- msgConfirm("An error occurred while adding the exim package\n"
- "Please change installation media and try again.");
- return ret;
- }
-
- variable_set2(VAR_SENDMAIL_ENABLE, "NONE", 1);
- variable_set2("exim_enable", "YES", 1);
-
- /* Update periodic.conf */
- perconf = fopen("/etc/periodic.conf", "a");
- if (perconf == NULL) {
- /* Not really a serious problem, so we do not abort */
- msgConfirm("Unable to open /etc/periodic.conf.\n"
- "The daily cleanup scripts might generate errors when\n"
- "trying to run some sendmail only cleanup scripts.\n"
- "Please consult the documentation for the exim port on how to\n"
- "fix this.");
- } else {
- fprintf(perconf, "# --- Generated by sysinstall ---\n");
- fprintf(perconf, "daily_clean_hoststat_enable=\"NO\"\n");
- fprintf(perconf, "daily_status_include_submit_mailq=\"NO\"\n");
- fprintf(perconf, "daily_status_mail_rejects_enable=\"NO\"\n");
- fprintf(perconf, "daily_submit_queuerun=\"NO\"\n");
- fclose(perconf);
- }
-
- /* Update mailer.conf */
- vsystem("mv -f /etc/mail/mailer.conf /etc/mail/mailer.conf.old");
- mailerconf = fopen("/etc/mail/mailer.conf", "w");
- if (mailerconf == NULL) {
- /* Not really a serious problem, so we do not abort */
- msgConfirm("Unable to open /etc/mailer.conf.\n"
- "Some programs which use the sendmail wrappers may not work.\n"
- "Please consult the documentation for the exim port on how\n"
- "to correct this.");
- } else {
- fprintf(mailerconf, "# --- Generated by sysinstall ---\n");
- fprintf(mailerconf, "# Execute exim instead of sendmail\n");
- fprintf(mailerconf, "#\n");
- fprintf(mailerconf, "sendmail /usr/local/sbin/exim\n");
- fprintf(mailerconf, "send-mail /usr/local/sbin/exim\n");
- fprintf(mailerconf, "mailq /usr/local/sbin/exim\n");
- fprintf(mailerconf, "newaliases /usr/local/sbin/exim\n");
- fprintf(mailerconf, "hoststat /usr/bin/true\n");
- fprintf(mailerconf, "purgestat /usr/bin/true\n");
- fclose(mailerconf);
- }
-
- /* Make newsyslog rotate exim logfiles */
- newsyslogconf = fopen("/etc/newsyslog.conf", "a");
- if (newsyslogconf == NULL) {
- /* Not really a serious problem, so we do not abort */
- msgConfirm("Unable to open /etc/newsyslog.conf.\n"
- "The exim logfiles will not be rotated.\n"
- "Please consult the documentation for the exim port on how to\n"
- "rotate the logfiles.");
- } else {
- fprintf(newsyslogconf, "# --- Generated by sysinstall ---\n");
- fprintf(newsyslogconf, "/var/log/exim/mainlog mailnull:mail 640 7 * @T00 ZN\n");
- fprintf(newsyslogconf, "/var/log/exim/rejectlog mailnull:mail 640 7 * @T00 ZN\n");
- fclose(newsyslogconf);
- }
-
- msgConfirm("Exim is now installed and enabled as the default MTA.\n"
- "Please check that the configuration works as expected.\n"
- "See the Exim documentation for more information.\n"
- "The documentation can be found in /usr/local/share/doc/exim/\n"
- "or on the Exim website at http://www.exim.org/.");
-
- return DITEM_SUCCESS;
-}
diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c
deleted file mode 100644
index 7401b1b..0000000
--- a/usr.sbin/sade/devices.c
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <sys/fcntl.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/time.h>
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_dl.h>
-#include <netinet/in.h>
-#include <netinet/in_var.h>
-#include <arpa/inet.h>
-#include <ctype.h>
-#include <libdisk.h>
-
-/* how much to bias minor number for a given /dev/<ct#><un#>s<s#> slice */
-#define SLICE_DELTA (0x10000)
-
-static Device *Devices[DEV_MAX];
-static int numDevs;
-
-static struct _devname {
- DeviceType type;
- char *name;
- char *description;
- int major, minor, delta, max;
-} device_names[] = {
- { DEVICE_TYPE_CDROM, "cd%d", "SCSI CDROM drive", 15, 2, 8, 4 },
- { DEVICE_TYPE_CDROM, "mcd%d", "Mitsumi (old model) CDROM drive", 29, 0, 8, 4 },
- { DEVICE_TYPE_CDROM, "scd%d", "Sony CDROM drive - CDU31/33A type", 45, 0, 8, 4 },
-#ifdef notdef
- { DEVICE_TYPE_CDROM, "matcd%d", "Matsushita CDROM ('sound blaster' type)", 46, 0, 8, 4 },
-#endif
- { DEVICE_TYPE_CDROM, "acd%d", "ATAPI/IDE CDROM", 117, 0, 8, 4 },
- { DEVICE_TYPE_TAPE, "sa%d", "SCSI tape drive", 14, 0, 16, 4 },
- { DEVICE_TYPE_TAPE, "rwt%d", "Wangtek tape drive", 10, 0, 1, 4 },
- { DEVICE_TYPE_DISK, "da%d", "SCSI disk device", 13, 65538, 8, 16 },
- { DEVICE_TYPE_DISK, "ad%d", "ATA/IDE disk device", 116, 65538, 8, 16 },
- { DEVICE_TYPE_DISK, "ar%d", "ATA/IDE RAID device", 157, 65538, 8, 16 },
- { DEVICE_TYPE_DISK, "afd%d", "ATAPI/IDE floppy device", 118, 65538, 8, 4 },
- { DEVICE_TYPE_DISK, "mlxd%d", "Mylex RAID disk", 131, 65538, 8, 4 },
- { DEVICE_TYPE_DISK, "amrd%d", "AMI MegaRAID drive", 133, 65538, 8, 4 },
- { DEVICE_TYPE_DISK, "idad%d", "Compaq RAID array", 109, 65538, 8, 4 },
- { DEVICE_TYPE_DISK, "twed%d", "3ware ATA RAID array", 147, 65538, 8, 4 },
- { DEVICE_TYPE_DISK, "aacd%d", "Adaptec FSA RAID array", 151, 65538, 8, 4 },
- { DEVICE_TYPE_DISK, "ipsd%d", "IBM ServeRAID RAID array", 176, 65538, 8, 4 },
- { DEVICE_TYPE_FLOPPY, "fd%d", "floppy drive unit A", 9, 0, 64, 4 },
- { DEVICE_TYPE_NETWORK, "an", "Aironet 4500/4800 802.11 wireless adapter" },
- { DEVICE_TYPE_NETWORK, "aue", "ADMtek USB ethernet adapter" },
- { DEVICE_TYPE_NETWORK, "axe", "ASIX Electronics USB ethernet adapter" },
- { DEVICE_TYPE_NETWORK, "bfe", "Broadcom BCM440x PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "bge", "Broadcom BCM570x PCI gigabit ethernet card" },
- { DEVICE_TYPE_NETWORK, "cue", "CATC USB ethernet adapter" },
- { DEVICE_TYPE_NETWORK, "fpa", "DEC DEFPA PCI FDDI card" },
- { DEVICE_TYPE_NETWORK, "sr", "SDL T1/E1 sync serial PCI card" },
- { DEVICE_TYPE_NETWORK, "cc3i", "SDL HSSI sync serial PCI card" },
- { DEVICE_TYPE_NETWORK, "en", "Efficient Networks ATM PCI card" },
- { DEVICE_TYPE_NETWORK, "dc", "DEC/Intel 21143 (and clones) PCI fast ethernet card" },
- { DEVICE_TYPE_NETWORK, "de", "DEC DE435 PCI NIC or other DC21040-AA based card" },
- { DEVICE_TYPE_NETWORK, "fxp", "Intel EtherExpress Pro/100B PCI Fast Ethernet card" },
- { DEVICE_TYPE_NETWORK, "ed", "Novell NE1000/2000; 3C503; NE2000-compatible PCMCIA" },
- { DEVICE_TYPE_NETWORK, "ep", "3Com 3C509 ethernet card/3C589 PCMCIA" },
- { DEVICE_TYPE_NETWORK, "el", "3Com 3C501 ethernet card" },
- { DEVICE_TYPE_NETWORK, "em", "Intel(R) PRO/1000 ethernet card" },
- { DEVICE_TYPE_NETWORK, "ex", "Intel EtherExpress Pro/10 ethernet card" },
- { DEVICE_TYPE_NETWORK, "fe", "Fujitsu MB86960A/MB86965A ethernet card" },
- { DEVICE_TYPE_NETWORK, "ie", "AT&T StarLAN 10 and EN100; 3Com 3C507; NI5210" },
- { DEVICE_TYPE_NETWORK, "ix", "Intel Etherexpress ethernet card" },
- { DEVICE_TYPE_NETWORK, "kue", "Kawasaki LSI USB ethernet adapter" },
- { DEVICE_TYPE_NETWORK, "le", "DEC EtherWorks 2 or 3 ethernet card" },
- { DEVICE_TYPE_NETWORK, "lnc", "Lance/PCnet (Isolan/Novell NE2100/NE32-VL) ethernet" },
- { DEVICE_TYPE_NETWORK, "lge", "Level 1 LXT1001 gigabit ethernet card" },
- { DEVICE_TYPE_NETWORK, "nge", "NatSemi PCI gigabit ethernet card" },
- { DEVICE_TYPE_NETWORK, "pcn", "AMD Am79c79x PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "ray", "Raytheon Raylink 802.11 wireless adaptor" },
- { DEVICE_TYPE_NETWORK, "re", "RealTek 8139C+/8169/8169S/8110S PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "rl", "RealTek 8129/8139 PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "rue", "RealTek USB ethernet card" },
- { DEVICE_TYPE_NETWORK, "sf", "Adaptec AIC-6915 PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "sis", "SiS 900/SiS 7016 PCI ethernet card" },
-#ifdef PC98
- { DEVICE_TYPE_NETWORK, "snc", "SONIC ethernet card" },
-#endif
- { DEVICE_TYPE_NETWORK, "sn", "SMC/Megahertz ethernet card" },
- { DEVICE_TYPE_NETWORK, "ste", "Sundance ST201 PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "sk", "SysKonnect PCI gigabit ethernet card" },
- { DEVICE_TYPE_NETWORK, "tx", "SMC 9432TX ethernet card" },
- { DEVICE_TYPE_NETWORK, "txp", "3Com 3cR990 ethernet card" },
- { DEVICE_TYPE_NETWORK, "ti", "Alteon Networks PCI gigabit ethernet card" },
- { DEVICE_TYPE_NETWORK, "tl", "Texas Instruments ThunderLAN PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "vge", "VIA VT612x PCI gigabit ethernet card" },
- { DEVICE_TYPE_NETWORK, "vr", "VIA VT3043/VT86C100A Rhine PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "vlan", "IEEE 802.1Q VLAN network interface" },
- { DEVICE_TYPE_NETWORK, "vx", "3COM 3c590 / 3c595 ethernet card" },
- { DEVICE_TYPE_NETWORK, "wb", "Winbond W89C840F PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "wi", "Lucent WaveLAN/IEEE 802.11 wireless adapter" },
- { DEVICE_TYPE_NETWORK, "wx", "Intel Gigabit Ethernet (82452) card" },
- { DEVICE_TYPE_NETWORK, "xe", "Xircom/Intel EtherExpress Pro100/16 ethernet card" },
- { DEVICE_TYPE_NETWORK, "xl", "3COM 3c90x / 3c90xB PCI ethernet card" },
- { DEVICE_TYPE_NETWORK, "cuad%d", "%s on device %s (COM%d)", 28, 128, 1, 16 },
- { DEVICE_TYPE_NETWORK, "fwe", "FireWire Ethernet emulation" },
- { DEVICE_TYPE_NETWORK, "lp", "Parallel Port IP (PLIP) peer connection" },
- { DEVICE_TYPE_NETWORK, "lo", "Loop-back (local) network interface" },
- { DEVICE_TYPE_NETWORK, "disc", "Software discard network interface" },
- { 0 },
-};
-
-Device *
-new_device(char *name)
-{
- Device *dev;
-
- dev = safe_malloc(sizeof(Device));
- bzero(dev, sizeof(Device));
- if (name)
- SAFE_STRCPY(dev->name, name);
- return dev;
-}
-
-/* Stubs for unimplemented strategy routines */
-Boolean
-dummyInit(Device *dev)
-{
- return TRUE;
-}
-
-FILE *
-dummyGet(Device *dev, char *dist, Boolean probe)
-{
- return NULL;
-}
-
-void
-dummyShutdown(Device *dev)
-{
- return;
-}
-
-static int
-deviceTry(struct _devname dev, char *try, int i)
-{
- int fd;
- char unit[80];
- mode_t m;
- dev_t d;
- int fail;
-
- snprintf(unit, sizeof unit, dev.name, i);
- snprintf(try, FILENAME_MAX, "/dev/%s", unit);
- if (isDebug())
- msgDebug("deviceTry: attempting to open %s\n", try);
- fd = open(try, O_RDONLY);
- if (fd >= 0) {
- if (isDebug())
- msgDebug("deviceTry: open of %s succeeded on first try.\n", try);
- return fd;
- }
- m = 0640 | S_IFCHR;
- d = makedev(dev.major, dev.minor + (i * dev.delta));
- if (isDebug())
- msgDebug("deviceTry: Making %s device for %s [%d, %d]\n", m & S_IFCHR ? "raw" : "block", try, dev.major, dev.minor + (i * dev.delta));
- fail = mknod(try, m, d);
- fd = open(try, O_RDONLY);
- if (fd >= 0) {
- if (isDebug())
- msgDebug("deviceTry: open of %s succeeded on second try.\n", try);
- return fd;
- }
- else if (!fail)
- (void)unlink(try);
- /* Don't try a "make-under" here since we're using a fixit floppy in this case */
- snprintf(try, FILENAME_MAX, "/mnt/dev/%s", unit);
- fd = open(try, O_RDONLY);
- if (isDebug())
- msgDebug("deviceTry: final attempt for %s returns %d\n", try, fd);
- return fd;
-}
-
-/* Register a new device in the devices array */
-Device *
-deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled,
- Boolean (*init)(Device *), FILE * (*get)(Device *, char *, Boolean),
- void (*shutdown)(Device *), void *private)
-{
- Device *newdev = NULL;
-
- if (numDevs == DEV_MAX)
- msgFatal("Too many devices found!");
- else {
- newdev = new_device(name);
- newdev->description = desc;
- newdev->devname = devname;
- newdev->type = type;
- newdev->enabled = enabled;
- newdev->init = init ? init : dummyInit;
- newdev->get = get ? get : dummyGet;
- newdev->shutdown = shutdown ? shutdown : dummyShutdown;
- newdev->private = private;
- Devices[numDevs] = newdev;
- Devices[++numDevs] = NULL;
- }
- return newdev;
-}
-
-/* Reset the registered device chain */
-void
-deviceReset(void)
-{
- int i;
-
- for (i = 0; i < numDevs; i++) {
- DEVICE_SHUTDOWN(Devices[i]);
-
- /* XXX this potentially leaks Devices[i]->private if it's being
- * used to point to something dynamic, but you're not supposed
- * to call this routine at such times that some open instance
- * has its private ptr pointing somewhere anyway. XXX
- */
- free(Devices[i]);
- }
- Devices[numDevs = 0] = NULL;
-}
-
-/* Get all device information for devices we have attached */
-void
-deviceGetAll(void)
-{
- int i, j, fd, s;
- struct ifconf ifc;
- struct ifreq *ifptr, *end;
- int ifflags;
- char buffer[INTERFACE_MAX * sizeof(struct ifreq)];
- char **names;
-
- msgNotify("Probing devices, please wait (this can take a while)...");
- /* First go for the network interfaces. Stolen shamelessly from ifconfig! */
- ifc.ifc_len = sizeof(buffer);
- ifc.ifc_buf = buffer;
-
- s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s < 0)
- goto skipif; /* Jump over network iface probing */
-
- if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0)
- goto skipif; /* Jump over network iface probing */
-
- close(s);
- ifflags = ifc.ifc_req->ifr_flags;
- end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len);
- for (ifptr = ifc.ifc_req; ifptr < end; ifptr++) {
- char *descr;
-
- /* If it's not a link entry, forget it */
- if (ifptr->ifr_ifru.ifru_addr.sa_family != AF_LINK)
- goto loopend;
-
- /* Eliminate network devices that don't make sense */
- if (!strncmp(ifptr->ifr_name, "lo", 2))
- goto loopend;
-
- /* If we have a slip device, don't register it */
- if (!strncmp(ifptr->ifr_name, "sl", 2)) {
- goto loopend;
- }
- /* And the same for ppp */
- if (!strncmp(ifptr->ifr_name, "tun", 3) || !strncmp(ifptr->ifr_name, "ppp", 3)) {
- goto loopend;
- }
- /* Try and find its description */
- for (i = 0, descr = NULL; device_names[i].name; i++) {
- int len = strlen(device_names[i].name);
-
- if (!ifptr->ifr_name || !ifptr->ifr_name[0])
- continue;
- else if (!strncmp(ifptr->ifr_name, device_names[i].name, len)) {
- descr = device_names[i].description;
- break;
- }
- }
- if (!descr)
- descr = "<unknown network interface type>";
-
- deviceRegister(ifptr->ifr_name, descr, strdup(ifptr->ifr_name), DEVICE_TYPE_NETWORK, TRUE,
- mediaInitNetwork, NULL, mediaShutdownNetwork, NULL);
- if (isDebug())
- msgDebug("Found a network device named %s\n", ifptr->ifr_name);
- close(s);
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- continue;
-
-loopend:
- if (ifptr->ifr_addr.sa_len) /* I'm not sure why this is here - it's inherited */
- ifptr = (struct ifreq *)((caddr_t)ifptr + ifptr->ifr_addr.sa_len - sizeof(struct sockaddr));
- close(s);
- }
-
-skipif:
- /* Next, try to find all the types of devices one might need
- * during the second stage of the installation.
- */
- for (i = 0; device_names[i].name; i++) {
- for (j = 0; j < device_names[i].max; j++) {
- char try[FILENAME_MAX];
-
- switch(device_names[i].type) {
- case DEVICE_TYPE_CDROM:
- fd = deviceTry(device_names[i], try, j);
- if (fd >= 0 || errno == EBUSY) { /* EBUSY if already mounted */
- char n[BUFSIZ];
-
- if (fd >= 0) close(fd);
- snprintf(n, sizeof n, device_names[i].name, j);
- deviceRegister(strdup(n), device_names[i].description, strdup(try),
- DEVICE_TYPE_CDROM, TRUE, mediaInitCDROM, mediaGetCDROM,
- mediaShutdownCDROM, NULL);
- if (isDebug())
- msgDebug("Found a CDROM device for %s\n", try);
- }
- break;
-
- case DEVICE_TYPE_TAPE:
- fd = deviceTry(device_names[i], try, j);
- if (fd >= 0) {
- char n[BUFSIZ];
-
- close(fd);
- snprintf(n, sizeof n, device_names[i].name, j);
- deviceRegister(strdup(n), device_names[i].description, strdup(try),
- DEVICE_TYPE_TAPE, TRUE, mediaInitTape, mediaGetTape, mediaShutdownTape, NULL);
- if (isDebug())
- msgDebug("Found a TAPE device for %s\n", try);
- }
- break;
-
- case DEVICE_TYPE_DISK:
- fd = deviceTry(device_names[i], try, j);
- if (fd >= 0 && RunningAsInit) {
- dev_t d;
- mode_t m;
- int s, fail;
- char unit[80], slice[80];
-
- close(fd);
- /* Make associated slice entries */
- for (s = 1; s < 8; s++) {
- snprintf(unit, sizeof unit, device_names[i].name, j);
- snprintf(slice, sizeof slice, "/dev/%ss%d", unit, s);
- d = makedev(device_names[i].major, device_names[i].minor +
- (j * device_names[i].delta) + (s * SLICE_DELTA));
- m = 0640 | S_IFCHR;
- fail = mknod(slice, m, d);
- fd = open(slice, O_RDONLY);
- if (fd >= 0)
- close(fd);
- else if (!fail)
- (void)unlink(slice);
- }
- }
- break;
-
- case DEVICE_TYPE_FLOPPY:
- fd = deviceTry(device_names[i], try, j);
- if (fd >= 0) {
- char n[BUFSIZ];
-
- close(fd);
- snprintf(n, sizeof n, device_names[i].name, j);
- deviceRegister(strdup(n), device_names[i].description, strdup(try),
- DEVICE_TYPE_FLOPPY, TRUE, mediaInitFloppy, mediaGetFloppy,
- mediaShutdownFloppy, NULL);
- if (isDebug())
- msgDebug("Found a floppy device for %s\n", try);
- }
- break;
-
- case DEVICE_TYPE_NETWORK:
- fd = deviceTry(device_names[i], try, j);
- /* The only network devices that you can open this way are serial ones */
- if (fd >= 0) {
- char *newdesc, *cp;
-
- close(fd);
- cp = device_names[i].description;
- /* Serial devices get a slip and ppp device each, if supported */
- newdesc = safe_malloc(strlen(cp) + 40);
- sprintf(newdesc, cp, "SLIP interface", try, j + 1);
- deviceRegister("sl0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork,
- NULL, mediaShutdownNetwork, NULL);
- msgDebug("Add mapping for %s to sl0\n", try);
- newdesc = safe_malloc(strlen(cp) + 50);
- sprintf(newdesc, cp, "PPP interface", try, j + 1);
- deviceRegister("ppp0", newdesc, strdup(try), DEVICE_TYPE_NETWORK, TRUE, mediaInitNetwork,
- NULL, mediaShutdownNetwork, NULL);
- if (isDebug())
- msgDebug("Add mapping for %s to ppp0\n", try);
- }
- break;
-
- default:
- break;
- }
- }
- }
-
- /* Finally, go get the disks and look for DOS partitions to register */
- if ((names = Disk_Names()) != NULL) {
- int i;
-
- for (i = 0; names[i]; i++) {
- Chunk *c1;
- Disk *d;
-
- /* Ignore memory disks */
- if (!strncmp(names[i], "md", 2))
- continue;
-
- /*
- * XXX
- * Due to unknown reasons, Disk_Names() returns SCSI CDROM as a
- * valid disk. This is main reason why sysinstall presents SCSI
- * CDROM to available disks in Fdisk/Label menu. In addition,
- * adding a blank SCSI CDROM to the menu generates floating point
- * exception in sparc64. Disk_Names() just extracts sysctl
- * "kern.disks". Why GEOM treats SCSI CDROM as a disk is beyond
- * me and that should be investigated.
- * For temporary workaround, ignore SCSI CDROM device.
- */
- if (!strncmp(names[i], "cd", 2))
- continue;
-
- d = Open_Disk(names[i]);
- if (!d) {
- msgDebug("Unable to open disk %s\n", names[i]);
- continue;
- }
-
- deviceRegister(names[i], names[i], d->name, DEVICE_TYPE_DISK, FALSE,
- dummyInit, dummyGet, dummyShutdown, d);
- if (isDebug())
- msgDebug("Found a disk device named %s\n", names[i]);
-
- /* Look for existing DOS partitions to register as "DOS media devices" */
- for (c1 = d->chunks->part; c1; c1 = c1->next) {
- if (c1->type == fat || c1->type == efi || c1->type == extended) {
- Device *dev;
- char devname[80];
-
- /* Got one! */
- snprintf(devname, sizeof devname, "/dev/%s", c1->name);
- dev = deviceRegister(c1->name, c1->name, strdup(devname), DEVICE_TYPE_DOS, TRUE,
- mediaInitDOS, mediaGetDOS, mediaShutdownDOS, NULL);
- dev->private = c1;
- if (isDebug())
- msgDebug("Found a DOS partition %s on drive %s\n", c1->name, d->name);
- }
- }
- }
- free(names);
- }
- dialog_clear_norefresh();
-}
-
-/* Rescan all devices, after closing previous set - convenience function */
-void
-deviceRescan(void)
-{
- deviceReset();
- deviceGetAll();
-}
-
-/*
- * Find all devices that match the criteria, allowing "wildcarding" as well
- * by allowing NULL or ANY values to match all. The array returned is static
- * and may be used until the next invocation of deviceFind().
- */
-Device **
-deviceFind(char *name, DeviceType class)
-{
- static Device *found[DEV_MAX];
- int i, j;
-
- j = 0;
- for (i = 0; i < numDevs; i++) {
- if ((!name || !strcmp(Devices[i]->name, name))
- && (class == DEVICE_TYPE_ANY || class == Devices[i]->type))
- found[j++] = Devices[i];
- }
- found[j] = NULL;
- return j ? found : NULL;
-}
-
-Device **
-deviceFindDescr(char *name, char *desc, DeviceType class)
-{
- static Device *found[DEV_MAX];
- int i, j;
-
- j = 0;
- for (i = 0; i < numDevs; i++) {
- if ((!name || !strcmp(Devices[i]->name, name)) &&
- (!desc || !strcmp(Devices[i]->description, desc)) &&
- (class == DEVICE_TYPE_ANY || class == Devices[i]->type))
- found[j++] = Devices[i];
- }
- found[j] = NULL;
- return j ? found : NULL;
-}
-
-int
-deviceCount(Device **devs)
-{
- int i;
-
- if (!devs)
- return 0;
- for (i = 0; devs[i]; i++);
- return i;
-}
-
-/*
- * Create a menu listing all the devices of a certain type in the system.
- * The passed-in menu is expected to be a "prototype" from which the new
- * menu is cloned.
- */
-DMenu *
-deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), int (*check)(dialogMenuItem *d))
-{
- Device **devs;
- int numdevs;
- DMenu *tmp = NULL;
- int i, j;
-
- devs = deviceFind(NULL, type);
- numdevs = deviceCount(devs);
- if (!numdevs)
- return NULL;
- tmp = (DMenu *)safe_malloc(sizeof(DMenu) + (sizeof(dialogMenuItem) * (numdevs + 1)));
- bcopy(menu, tmp, sizeof(DMenu));
- for (i = 0; devs[i]; i++) {
- tmp->items[i].prompt = devs[i]->name;
- for (j = 0; j < numDevs; j++) {
- if (devs[i] == Devices[j]) {
- tmp->items[i].title = Devices[j]->description;
- break;
- }
- }
- if (j == numDevs)
- tmp->items[i].title = "<unknown device type>";
- tmp->items[i].fire = hook;
- tmp->items[i].checked = check;
- }
- tmp->items[i].title = NULL;
- return tmp;
-}
diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c
deleted file mode 100644
index a60ced5..0000000
--- a/usr.sbin/sade/disks.c
+++ /dev/null
@@ -1,1001 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <ctype.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <libdisk.h>
-#include <sys/stat.h>
-#include <sys/disklabel.h>
-
-#ifdef WITH_SLICES
-enum size_units_t { UNIT_BLOCKS, UNIT_KILO, UNIT_MEG, UNIT_GIG, UNIT_SIZE };
-
-#ifdef PC98
-#define SUBTYPE_FREEBSD 50324
-#define SUBTYPE_FAT 37218
-#else
-#define SUBTYPE_FREEBSD 165
-#define SUBTYPE_FAT 6
-#endif
-#define SUBTYPE_EFI 239
-
-#ifdef PC98
-#define OTHER_SLICE_VALUES \
- "Other popular values are 37218 for a\n" \
- "DOS FAT partition.\n\n"
-#else
-#define OTHER_SLICE_VALUES \
- "Other popular values are 6 for a\n" \
- "DOS FAT partition, 131 for a Linux ext2fs partition, or\n" \
- "130 for a Linux swap partition.\n\n"
-#endif
-#define NON_FREEBSD_NOTE \
- "Note: If you choose a non-FreeBSD partition type, it will not\n" \
- "be formatted or otherwise prepared, it will simply reserve space\n" \
- "for you to use another tool, such as DOS format, to later format\n" \
- "and actually use the partition."
-
-/* Where we start displaying chunk information on the screen */
-#define CHUNK_START_ROW 5
-
-/* Where we keep track of MBR chunks */
-#define CHUNK_INFO_ENTRIES 16
-static struct chunk *chunk_info[CHUNK_INFO_ENTRIES];
-static int current_chunk;
-
-static void diskPartitionNonInteractive(Device *dev);
-static u_char * bootalloc(char *name, size_t *size);
-
-static void
-record_chunks(Disk *d)
-{
- struct chunk *c1 = NULL;
- int i = 0;
- daddr_t last_free = 0;
-
- if (!d->chunks)
- msgFatal("No chunk list found for %s!", d->name);
-
- for (c1 = d->chunks->part; c1; c1 = c1->next) {
- if (c1->type == unused && c1->size > last_free) {
- last_free = c1->size;
- current_chunk = i;
- }
- chunk_info[i++] = c1;
- }
- chunk_info[i] = NULL;
- if (current_chunk >= i)
- current_chunk = i - 1;
-}
-
-static daddr_t Total;
-
-static void
-print_chunks(Disk *d, int u)
-{
- int row;
- int i;
- daddr_t sz;
- char *szstr;
-
- szstr = (u == UNIT_GIG ? "GB" : (u == UNIT_MEG ? "MB" :
- (u == UNIT_KILO ? "KB" : "ST")));
-
- Total = 0;
- for (i = 0; chunk_info[i]; i++)
- Total += chunk_info[i]->size;
-#ifdef PC98
- if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
-#else
- if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
-#endif
- dialog_clear_norefresh();
- msgConfirm("WARNING: A geometry of %lu/%lu/%lu for %s is incorrect. Using\n"
- "a more likely geometry. If this geometry is incorrect or you\n"
- "are unsure as to whether or not it's correct, please consult\n"
- "the Hardware Guide in the Documentation submenu or use the\n"
- "(G)eometry command to change it now.\n\n"
- "Remember: you need to enter whatever your BIOS thinks the\n"
- "geometry is! For IDE, it's what you were told in the BIOS\n"
- "setup. For SCSI, it's the translation mode your controller is\n"
- "using. Do NOT use a ``physical geometry''.",
- d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
- Sanitize_Bios_Geom(d);
- }
- attrset(A_NORMAL);
- mvaddstr(0, 0, "Disk name:\t");
- clrtobot();
- attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL);
- attrset(A_REVERSE); mvaddstr(0, 55, "FDISK Partition Editor"); attrset(A_NORMAL);
- mvprintw(1, 0,
- "DISK Geometry:\t%lu cyls/%lu heads/%lu sectors = %jd sectors (%jdMB)",
- d->bios_cyl, d->bios_hd, d->bios_sect,
- (intmax_t)d->bios_cyl * d->bios_hd * d->bios_sect,
- (intmax_t)d->bios_cyl * d->bios_hd * d->bios_sect / (1024/512) / 1024);
- mvprintw(3, 0, "%6s %10s(%s) %10s %8s %6s %10s %8s %8s",
- "Offset", "Size", szstr, "End", "Name", "PType", "Desc",
- "Subtype", "Flags");
- for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) {
- switch(u) {
- default: /* fall thru */
- case UNIT_BLOCKS:
- sz = chunk_info[i]->size;
- break;
- case UNIT_KILO:
- sz = chunk_info[i]->size / (1024/512);
- break;
- case UNIT_MEG:
- sz = chunk_info[i]->size / (1024/512) / 1024;
- break;
- case UNIT_GIG:
- sz = chunk_info[i]->size / (1024/512) / 1024 / 1024;
- break;
- }
- if (i == current_chunk)
- attrset(ATTR_SELECTED);
- mvprintw(row, 0, "%10jd %10jd %10jd %8s %6d %10s %8d\t%-6s",
- (intmax_t)chunk_info[i]->offset, (intmax_t)sz,
- (intmax_t)chunk_info[i]->end, chunk_info[i]->name,
- chunk_info[i]->type,
- slice_type_name(chunk_info[i]->type, chunk_info[i]->subtype),
- chunk_info[i]->subtype, ShowChunkFlags(chunk_info[i]));
- if (i == current_chunk)
- attrset(A_NORMAL);
- }
-}
-
-static void
-print_command_summary()
-{
- mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
- mvprintw(16, 0, "A = Use Entire Disk G = set Drive Geometry C = Create Slice F = `DD' mode");
- mvprintw(17, 0, "D = Delete Slice Z = Toggle Size Units S = Set Bootable | = Wizard m.");
- mvprintw(18, 0, "T = Change Type U = Undo All Changes Q = Finish");
- if (!RunningAsInit)
- mvprintw(18, 47, "W = Write Changes");
- mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to select.");
- move(0, 0);
-}
-
-#ifdef PC98
-static void
-getBootMgr(char *dname, u_char **bootipl, size_t *bootipl_size,
- u_char **bootmenu, size_t *bootmenu_size)
-{
- static u_char *boot0;
- static size_t boot0_size;
- static u_char *boot05;
- static size_t boot05_size;
-
- char str[80];
- char *cp;
- int i = 0;
-
- cp = variable_get(VAR_BOOTMGR);
- if (!cp) {
- /* Figure out what kind of IPL the user wants */
- sprintf(str, "Install Boot Manager for drive %s?", dname);
- MenuIPLType.title = str;
- i = dmenuOpenSimple(&MenuIPLType, FALSE);
- } else {
- if (!strncmp(cp, "boot", 4))
- BootMgr = 0;
- else
- BootMgr = 1;
- }
- if (cp || i) {
- switch (BootMgr) {
- case 0:
- if (!boot0) boot0 = bootalloc("boot0", &boot0_size);
- *bootipl = boot0;
- *bootipl_size = boot0_size;
- if (!boot05) boot05 = bootalloc("boot0.5", &boot05_size);
- *bootmenu = boot05;
- *bootmenu_size = boot05_size;
- return;
- case 1:
- default:
- break;
- }
- }
- *bootipl = NULL;
- *bootipl_size = 0;
- *bootmenu = NULL;
- *bootmenu_size = 0;
-}
-#else
-static void
-getBootMgr(char *dname, u_char **bootCode, size_t *bootCodeSize)
-{
-#if defined(__i386__) || defined(__amd64__) /* only meaningful on x86 */
- static u_char *mbr, *boot0;
- static size_t mbr_size, boot0_size;
- char str[80];
- char *cp;
- int i = 0;
-
- cp = variable_get(VAR_BOOTMGR);
- if (!cp) {
- /* Figure out what kind of MBR the user wants */
- sprintf(str, "Install Boot Manager for drive %s?", dname);
- MenuMBRType.title = str;
- i = dmenuOpenSimple(&MenuMBRType, FALSE);
- }
- else {
- if (!strncmp(cp, "boot", 4))
- BootMgr = 0;
- else if (!strcmp(cp, "standard"))
- BootMgr = 1;
- else
- BootMgr = 2;
- }
- if (cp || i) {
- switch (BootMgr) {
- case 0:
- if (!boot0) boot0 = bootalloc("boot0", &boot0_size);
- *bootCode = boot0;
- *bootCodeSize = boot0_size;
- return;
- case 1:
- if (!mbr) mbr = bootalloc("mbr", &mbr_size);
- *bootCode = mbr;
- *bootCodeSize = mbr_size;
- return;
- case 2:
- default:
- break;
- }
- }
-#endif
- *bootCode = NULL;
- *bootCodeSize = 0;
-}
-#endif
-#endif /* WITH_SLICES */
-
-int
-diskGetSelectCount(Device ***devs)
-{
- int i, cnt, enabled;
- char *cp;
- Device **dp;
-
- cp = variable_get(VAR_DISK);
- dp = *devs = deviceFind(cp, DEVICE_TYPE_DISK);
- cnt = deviceCount(dp);
- if (!cnt)
- return -1;
- for (i = 0, enabled = 0; i < cnt; i++) {
- if (dp[i]->enabled)
- ++enabled;
- }
- return enabled;
-}
-
-#ifdef WITH_SLICES
-void
-diskPartition(Device *dev)
-{
- char *cp, *p;
- int rv, key = 0;
- int i;
- Boolean chunking;
- char *msg = NULL;
-#ifdef PC98
- u_char *bootipl;
- size_t bootipl_size;
- u_char *bootmenu;
- size_t bootmenu_size;
-#else
- u_char *mbrContents;
- size_t mbrSize;
-#endif
- WINDOW *w = savescr();
- Disk *d = (Disk *)dev->private;
- int size_unit;
-
- size_unit = UNIT_BLOCKS;
- chunking = TRUE;
- keypad(stdscr, TRUE);
-
- /* Flush both the dialog and curses library views of the screen
- since we don't always know who called us */
- dialog_clear_norefresh(), clear();
- current_chunk = 0;
-
- /* Set up the chunk array */
- record_chunks(d);
-
- while (chunking) {
- char *val, geometry[80];
-
- /* Now print our overall state */
- if (d)
- print_chunks(d, size_unit);
- print_command_summary();
- if (msg) {
- attrset(title_attr); mvprintw(23, 0, msg); attrset(A_NORMAL);
- beep();
- msg = NULL;
- }
- else {
- move(23, 0);
- clrtoeol();
- }
-
- /* Get command character */
- key = getch();
- switch (toupper(key)) {
- case '\014': /* ^L (redraw) */
- clear();
- msg = NULL;
- break;
-
- case '\020': /* ^P */
- case KEY_UP:
- case '-':
- if (current_chunk != 0)
- --current_chunk;
- break;
-
- case '\016': /* ^N */
- case KEY_DOWN:
- case '+':
- case '\r':
- case '\n':
- if (chunk_info[current_chunk + 1])
- ++current_chunk;
- break;
-
- case KEY_HOME:
- current_chunk = 0;
- break;
-
- case KEY_END:
- while (chunk_info[current_chunk + 1])
- ++current_chunk;
- break;
-
- case KEY_F(1):
- case '?':
- systemDisplayHelp("slice");
- clear();
- break;
-
- case 'A':
- case 'F': /* Undocumented magic Dangerously Dedicated mode */
-#if !defined(__i386__) && !defined(__amd64__)
- rv = 1;
-#else /* The rest is only relevant on x86 */
- cp = variable_get(VAR_DEDICATE_DISK);
- if (cp && !strcasecmp(cp, "always"))
- rv = 1;
- else if (toupper(key) == 'A')
- rv = 0;
- else {
- rv = msgYesNo("Do you want to do this with a true partition entry\n"
- "so as to remain cooperative with any future possible\n"
- "operating systems on the drive(s)?\n"
- "(See also the section about ``dangerously dedicated''\n"
- "disks in the FreeBSD FAQ.)");
- if (rv == -1)
- rv = 0;
- }
-#endif
- All_FreeBSD(d, rv);
- variable_set2(DISK_PARTITIONED, "yes", 0);
- record_chunks(d);
- clear();
- break;
-
- case 'C':
- if (chunk_info[current_chunk]->type != unused)
- msg = "Slice in use, delete it first or move to an unused one.";
- else {
- char *val, tmp[20], name[16], *cp;
- daddr_t size;
- int subtype;
- chunk_e partitiontype;
-#ifdef PC98
- snprintf(name, sizeof (name), "%s", "FreeBSD");
- val = msgGetInput(name,
- "Please specify the name for new FreeBSD slice.");
- if (val)
- strncpy(name, val, sizeof (name));
-#else
- name[0] = '\0';
-#endif
- snprintf(tmp, 20, "%jd", (intmax_t)chunk_info[current_chunk]->size);
- val = msgGetInput(tmp, "Please specify the size for new FreeBSD slice in blocks\n"
- "or append a trailing `M' for megabytes (e.g. 20M).");
- if (val && (size = strtoimax(val, &cp, 0)) > 0) {
- if (*cp && toupper(*cp) == 'M')
- size *= ONE_MEG;
- else if (*cp && toupper(*cp) == 'G')
- size *= ONE_GIG;
- sprintf(tmp, "%d", SUBTYPE_FREEBSD);
- val = msgGetInput(tmp, "Enter type of partition to create:\n\n"
- "Pressing Enter will choose the default, a native FreeBSD\n"
- "slice (type %u). "
- OTHER_SLICE_VALUES
- NON_FREEBSD_NOTE, SUBTYPE_FREEBSD);
- if (val && (subtype = strtol(val, NULL, 0)) > 0) {
- if (subtype == SUBTYPE_FREEBSD)
- partitiontype = freebsd;
- else if (subtype == SUBTYPE_FAT)
- partitiontype = fat;
- else if (subtype == SUBTYPE_EFI)
- partitiontype = efi;
- else
-#ifdef PC98
- partitiontype = pc98;
-#else
- partitiontype = mbr;
-#endif
- Create_Chunk(d, chunk_info[current_chunk]->offset, size, partitiontype, subtype,
- (chunk_info[current_chunk]->flags & CHUNK_ALIGN), name);
- variable_set2(DISK_PARTITIONED, "yes", 0);
- record_chunks(d);
- }
- }
- clear();
- }
- break;
-
- case KEY_DC:
- case 'D':
- if (chunk_info[current_chunk]->type == unused)
- msg = "Slice is already unused!";
- else {
- Delete_Chunk(d, chunk_info[current_chunk]);
- variable_set2(DISK_PARTITIONED, "yes", 0);
- record_chunks(d);
- }
- break;
-
- case 'T':
- if (chunk_info[current_chunk]->type == unused)
- msg = "Slice is currently unused (use create instead)";
- else {
- char *val, tmp[20];
- int subtype;
- chunk_e partitiontype;
-
- sprintf(tmp, "%d", chunk_info[current_chunk]->subtype);
- val = msgGetInput(tmp, "New partition type:\n\n"
- "Pressing Enter will use the current type. To choose a native\n"
- "FreeBSD slice enter %u. "
- OTHER_SLICE_VALUES
- NON_FREEBSD_NOTE, SUBTYPE_FREEBSD);
- if (val && (subtype = strtol(val, NULL, 0)) > 0) {
- if (subtype == SUBTYPE_FREEBSD)
- partitiontype = freebsd;
- else if (subtype == SUBTYPE_FAT)
- partitiontype = fat;
- else if (subtype == SUBTYPE_EFI)
- partitiontype = efi;
- else
-#ifdef PC98
- partitiontype = pc98;
-#else
- partitiontype = mbr;
-#endif
- chunk_info[current_chunk]->type = partitiontype;
- chunk_info[current_chunk]->subtype = subtype;
- }
- }
- break;
-
- case 'G':
- snprintf(geometry, 80, "%lu/%lu/%lu", d->bios_cyl, d->bios_hd, d->bios_sect);
- val = msgGetInput(geometry, "Please specify the new geometry in cyl/hd/sect format.\n"
- "Don't forget to use the two slash (/) separator characters!\n"
- "It's not possible to parse the field without them.");
- if (val) {
- long nc, nh, ns;
- nc = strtol(val, &val, 0);
- nh = strtol(val + 1, &val, 0);
- ns = strtol(val + 1, 0, 0);
- Set_Bios_Geom(d, nc, nh, ns);
- }
- clear();
- break;
-
- case 'S':
- /* Clear active states so we won't have two */
- for (i = 0; (chunk_info[i] != NULL) && (i < CHUNK_INFO_ENTRIES); i++)
- chunk_info[i]->flags &= !CHUNK_ACTIVE;
-
- /* Set Bootable */
- chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
- break;
-
- case 'U':
- if (!variable_cmp(DISK_LABELLED, "written")) {
- msgConfirm("You've already written this information out - you\n"
- "can't undo it.");
- }
- else if (!msgNoYes("Are you SURE you want to Undo everything?")) {
- char cp[BUFSIZ];
-
- sstrncpy(cp, d->name, sizeof cp);
- Free_Disk(dev->private);
- d = Open_Disk(cp);
- if (!d)
- msgConfirm("Can't reopen disk %s! Internal state is probably corrupted", cp);
- dev->private = d;
- variable_unset(DISK_PARTITIONED);
- variable_unset(DISK_LABELLED);
- if (d)
- record_chunks(d);
- }
- clear();
- break;
-
- case 'W':
- if (!msgNoYes("WARNING: This should only be used when modifying an EXISTING\n"
- "installation. If you are installing FreeBSD for the first time\n"
- "then you should simply type Q when you're finished here and your\n"
- "changes will be committed in one batch automatically at the end of\n"
- "these questions. If you're adding a disk, you should NOT write\n"
- "from this screen, you should do it from the label editor.\n\n"
- "Are you absolutely sure you want to do this now?")) {
- variable_set2(DISK_PARTITIONED, "yes", 0);
-
-#ifdef PC98
- /*
- * Don't trash the IPL if the first (and therefore only) chunk
- * is marked for a truly dedicated disk (i.e., the disklabel
- * starts at sector 0), even in cases where the user has
- * requested a FreeBSD Boot Manager -- both would be fatal in
- * this case.
- */
- /*
- * Don't offer to update the IPL on this disk if the first
- * "real" chunk looks like a FreeBSD "all disk" partition,
- * or the disk is entirely FreeBSD.
- */
- if ((d->chunks->part->type != freebsd) ||
- (d->chunks->part->offset > 1))
- getBootMgr(d->name, &bootipl, &bootipl_size,
- &bootmenu, &bootmenu_size);
- else {
- bootipl = NULL;
- bootipl_size = 0;
- bootmenu = NULL;
- bootmenu_size = 0;
- }
- Set_Boot_Mgr(d, bootipl, bootipl_size, bootmenu, bootmenu_size);
-#else
- /*
- * Don't trash the MBR if the first (and therefore only) chunk
- * is marked for a truly dedicated disk (i.e., the disklabel
- * starts at sector 0), even in cases where the user has
- * requested booteasy or a "standard" MBR -- both would be
- * fatal in this case.
- */
- /*
- * Don't offer to update the MBR on this disk if the first
- * "real" chunk looks like a FreeBSD "all disk" partition,
- * or the disk is entirely FreeBSD.
- */
- if ((d->chunks->part->type != freebsd) ||
- (d->chunks->part->offset > 1))
- getBootMgr(d->name, &mbrContents, &mbrSize);
- else {
- mbrContents = NULL;
- mbrSize = 0;
- }
- Set_Boot_Mgr(d, mbrContents, mbrSize);
-#endif
-
- if (DITEM_STATUS(diskPartitionWrite(NULL)) != DITEM_SUCCESS)
- msgConfirm("Disk partition write returned an error status!");
- else
- msgConfirm("Wrote FDISK partition information out successfully.");
- }
- clear();
- break;
-
- case '|':
- if (!msgNoYes("Are you SURE you want to go into Wizard mode?\n"
- "No seat belts whatsoever are provided!")) {
- clear();
- refresh();
- slice_wizard(d);
- variable_set2(DISK_PARTITIONED, "yes", 0);
- record_chunks(d);
- }
- else
- msg = "Wise choice!";
- clear();
- break;
-
- case '\033': /* ESC */
- case 'Q':
- chunking = FALSE;
-#ifdef PC98
- /*
- * Don't trash the IPL if the first (and therefore only) chunk
- * is marked for a truly dedicated disk (i.e., the disklabel
- * starts at sector 0), even in cases where the user has requested
- * a FreeBSD Boot Manager -- both would be fatal in this case.
- */
- /*
- * Don't offer to update the IPL on this disk if the first "real"
- * chunk looks like a FreeBSD "all disk" partition, or the disk is
- * entirely FreeBSD.
- */
- if ((d->chunks->part->type != freebsd) ||
- (d->chunks->part->offset > 1)) {
- if (variable_cmp(DISK_PARTITIONED, "written")) {
- getBootMgr(d->name, &bootipl, &bootipl_size,
- &bootmenu, &bootmenu_size);
- if (bootipl != NULL && bootmenu != NULL)
- Set_Boot_Mgr(d, bootipl, bootipl_size,
- bootmenu, bootmenu_size);
- }
- }
-#else
- /*
- * Don't trash the MBR if the first (and therefore only) chunk
- * is marked for a truly dedicated disk (i.e., the disklabel
- * starts at sector 0), even in cases where the user has requested
- * booteasy or a "standard" MBR -- both would be fatal in this case.
- */
- /*
- * Don't offer to update the MBR on this disk if the first "real"
- * chunk looks like a FreeBSD "all disk" partition, or the disk is
- * entirely FreeBSD.
- */
- if ((d->chunks->part->type != freebsd) ||
- (d->chunks->part->offset > 1)) {
- if (variable_cmp(DISK_PARTITIONED, "written")) {
- getBootMgr(d->name, &mbrContents, &mbrSize);
- if (mbrContents != NULL)
- Set_Boot_Mgr(d, mbrContents, mbrSize);
- }
- }
-#endif
- break;
-
- case 'Z':
- size_unit = (size_unit + 1) % UNIT_SIZE;
- break;
-
- default:
- beep();
- msg = "Type F1 or ? for help";
- break;
- }
- }
- p = CheckRules(d);
- if (p) {
- char buf[FILENAME_MAX];
-
- use_helpline("Press F1 to read more about disk slices.");
- use_helpfile(systemHelpFile("partition", buf));
- if (!variable_get(VAR_NO_WARN))
- dialog_mesgbox("Disk slicing warning:", p, -1, -1);
- free(p);
- }
- restorescr(w);
-}
-#endif /* WITH_SLICES */
-
-static u_char *
-bootalloc(char *name, size_t *size)
-{
- char buf[FILENAME_MAX];
- struct stat sb;
-
- snprintf(buf, sizeof buf, "/boot/%s", name);
- if (stat(buf, &sb) != -1) {
- int fd;
-
- fd = open(buf, O_RDONLY);
- if (fd != -1) {
- u_char *cp;
-
- cp = malloc(sb.st_size);
- if (read(fd, cp, sb.st_size) != sb.st_size) {
- free(cp);
- close(fd);
- msgDebug("bootalloc: couldn't read %ld bytes from %s\n", (long)sb.st_size, buf);
- return NULL;
- }
- close(fd);
- if (size != NULL)
- *size = sb.st_size;
- return cp;
- }
- msgDebug("bootalloc: couldn't open %s\n", buf);
- }
- else
- msgDebug("bootalloc: can't stat %s\n", buf);
- return NULL;
-}
-
-#ifdef WITH_SLICES
-static int
-partitionHook(dialogMenuItem *selected)
-{
- Device **devs = NULL;
-
- devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);
- if (!devs) {
- msgConfirm("Unable to find disk %s!", selected->prompt);
- return DITEM_FAILURE;
- }
- /* Toggle enabled status? */
- if (!devs[0]->enabled) {
- devs[0]->enabled = TRUE;
- diskPartition(devs[0]);
- }
- else
- devs[0]->enabled = FALSE;
- return DITEM_SUCCESS;
-}
-
-static int
-partitionCheck(dialogMenuItem *selected)
-{
- Device **devs = NULL;
-
- devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);
- if (!devs || devs[0]->enabled == FALSE)
- return FALSE;
- return TRUE;
-}
-
-int
-diskPartitionEditor(dialogMenuItem *self)
-{
- DMenu *menu;
- Device **devs;
- int i, cnt, devcnt;
-
- cnt = diskGetSelectCount(&devs);
- devcnt = deviceCount(devs);
- if (cnt == -1) {
- msgConfirm("No disks found! Please verify that your disk controller is being\n"
- "properly probed at boot time. See the Hardware Guide on the\n"
- "Documentation menu for clues on diagnosing this type of problem.");
- return DITEM_FAILURE;
- }
- else if (cnt) {
- /* Some are already selected */
- for (i = 0; i < devcnt; i++) {
- if (devs[i]->enabled) {
- if (variable_get(VAR_NONINTERACTIVE) &&
- !variable_get(VAR_DISKINTERACTIVE))
- diskPartitionNonInteractive(devs[i]);
- else
- diskPartition(devs[i]);
- }
- }
- }
- else {
- /* No disks are selected, fall-back case now */
- if (devcnt == 1) {
- devs[0]->enabled = TRUE;
- if (variable_get(VAR_NONINTERACTIVE) &&
- !variable_get(VAR_DISKINTERACTIVE))
- diskPartitionNonInteractive(devs[0]);
- else
- diskPartition(devs[0]);
- return DITEM_SUCCESS;
- }
- else {
- menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook, partitionCheck);
- if (!menu) {
- msgConfirm("No devices suitable for installation found!\n\n"
- "Please verify that your disk controller (and attached drives)\n"
- "were detected properly. This can be done by pressing the\n"
- "[Scroll Lock] key and using the Arrow keys to move back to\n"
- "the boot messages. Press [Scroll Lock] again to return.");
- return DITEM_FAILURE;
- }
- else {
- i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
- free(menu);
- }
- return i;
- }
- }
- return DITEM_SUCCESS;
-}
-#endif /* WITH_SLICES */
-
-int
-diskPartitionWrite(dialogMenuItem *self)
-{
- Device **devs;
- int i;
-
- if (!variable_cmp(DISK_PARTITIONED, "written"))
- return DITEM_SUCCESS;
-
- devs = deviceFind(NULL, DEVICE_TYPE_DISK);
- if (!devs) {
- msgConfirm("Unable to find any disks to write to??");
- return DITEM_FAILURE;
- }
- if (isDebug())
- msgDebug("diskPartitionWrite: Examining %d devices\n", deviceCount(devs));
- for (i = 0; devs[i]; i++) {
- Disk *d = (Disk *)devs[i]->private;
- static u_char *boot1;
-#if defined(__i386__) || defined(__amd64__)
- static u_char *boot2;
-#endif
-
- if (!devs[i]->enabled)
- continue;
-
-#if defined(__i386__) || defined(__amd64__)
- if (!boot1) boot1 = bootalloc("boot1", NULL);
- if (!boot2) boot2 = bootalloc("boot2", NULL);
- Set_Boot_Blocks(d, boot1, boot2);
-#elif !defined(__ia64__)
- if (!boot1) boot1 = bootalloc("boot1", NULL);
- Set_Boot_Blocks(d, boot1, NULL);
-#endif
-
- msgNotify("Writing partition information to drive %s", d->name);
- if (!Fake && Write_Disk(d)) {
- msgConfirm("ERROR: Unable to write data to disk %s!", d->name);
- return DITEM_FAILURE;
- }
- }
- /* Now it's not "yes", but "written" */
- variable_set2(DISK_PARTITIONED, "written", 0);
- return DITEM_SUCCESS | DITEM_RESTORE;
-}
-
-#ifdef WITH_SLICES
-/* Partition a disk based wholly on which variables are set */
-static void
-diskPartitionNonInteractive(Device *dev)
-{
- char *cp;
- int i, all_disk = 0;
- daddr_t sz;
-#ifdef PC98
- u_char *bootipl;
- size_t bootipl_size;
- u_char *bootmenu;
- size_t bootmenu_size;
-#else
- u_char *mbrContents;
- size_t mbrSize;
-#endif
- Disk *d = (Disk *)dev->private;
-
- record_chunks(d);
- cp = variable_get(VAR_GEOMETRY);
- if (cp) {
- msgDebug("Setting geometry from script to: %s\n", cp);
- d->bios_cyl = strtol(cp, &cp, 0);
- d->bios_hd = strtol(cp + 1, &cp, 0);
- d->bios_sect = strtol(cp + 1, 0, 0);
- }
-
- cp = variable_get(VAR_PARTITION);
- if (cp) {
- if (!strcmp(cp, "free")) {
- /* Do free disk space case */
- for (i = 0; chunk_info[i]; i++) {
- /* If a chunk is at least 10MB in size, use it. */
- if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
- Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size,
- freebsd, 3,
- (chunk_info[i]->flags & CHUNK_ALIGN),
- "FreeBSD");
- variable_set2(DISK_PARTITIONED, "yes", 0);
- break;
- }
- }
- if (!chunk_info[i]) {
- msgConfirm("Unable to find any free space on this disk!");
- return;
- }
- }
- else if (!strcmp(cp, "all")) {
- /* Do all disk space case */
- msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
-
- All_FreeBSD(d, FALSE);
- }
- else if (!strcmp(cp, "exclusive")) {
- /* Do really-all-the-disk-space case */
- msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
-
- All_FreeBSD(d, all_disk = TRUE);
- }
- else if ((sz = strtoimax(cp, &cp, 0))) {
- /* Look for sz bytes free */
- if (*cp && toupper(*cp) == 'M')
- sz *= ONE_MEG;
- else if (*cp && toupper(*cp) == 'G')
- sz *= ONE_GIG;
- for (i = 0; chunk_info[i]; i++) {
- /* If a chunk is at least sz MB, use it. */
- if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
- Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
- (chunk_info[i]->flags & CHUNK_ALIGN),
- "FreeBSD");
- variable_set2(DISK_PARTITIONED, "yes", 0);
- break;
- }
- }
- if (!chunk_info[i]) {
- msgConfirm("Unable to find %jd free blocks on this disk!",
- (intmax_t)sz);
- return;
- }
- }
- else if (!strcmp(cp, "existing")) {
- /* Do existing FreeBSD case */
- for (i = 0; chunk_info[i]; i++) {
- if (chunk_info[i]->type == freebsd)
- break;
- }
- if (!chunk_info[i]) {
- msgConfirm("Unable to find any existing FreeBSD partitions on this disk!");
- return;
- }
- }
- else {
- msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_PARTITION);
- return;
- }
- if (!all_disk) {
-#ifdef PC98
- getBootMgr(d->name, &bootipl, &bootipl_size,
- &bootmenu, &bootmenu_size);
- Set_Boot_Mgr(d, bootipl, bootipl_size, bootmenu, bootmenu_size);
-#else
- getBootMgr(d->name, &mbrContents, &mbrSize);
- Set_Boot_Mgr(d, mbrContents, mbrSize);
-#endif
- }
- variable_set2(DISK_PARTITIONED, "yes", 0);
- }
-}
-#endif /* WITH_SLICES */
diff --git a/usr.sbin/sade/dispatch.c b/usr.sbin/sade/dispatch.c
deleted file mode 100644
index 4896b23..0000000
--- a/usr.sbin/sade/dispatch.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <ctype.h>
-#include <errno.h>
-#include <sys/signal.h>
-#include <sys/fcntl.h>
-
-#include "list.h"
-
-static int dispatch_shutdown(dialogMenuItem *unused);
-static int dispatch_systemExecute(dialogMenuItem *unused);
-static int dispatch_msgConfirm(dialogMenuItem *unused);
-static int dispatch_mediaClose(dialogMenuItem *unused);
-
-static struct _word {
- char *name;
- int (*handler)(dialogMenuItem *self);
-} resWords[] = {
- { "configAnonFTP", configAnonFTP },
- { "configRouter", configRouter },
- { "configInetd", configInetd },
- { "configNFSServer", configNFSServer },
- { "configNTP", configNTP },
- { "configPCNFSD", configPCNFSD },
- { "configPackages", configPackages },
- { "configUsers", configUsers },
-#ifdef WITH_SLICES
- { "diskPartitionEditor", diskPartitionEditor },
-#endif
- { "diskPartitionWrite", diskPartitionWrite },
- { "diskLabelEditor", diskLabelEditor },
- { "diskLabelCommit", diskLabelCommit },
- { "distReset", distReset },
- { "distSetCustom", distSetCustom },
- { "distUnsetCustom", distUnsetCustom },
- { "distSetDeveloper", distSetDeveloper },
- { "distSetXDeveloper", distSetXDeveloper },
- { "distSetKernDeveloper", distSetKernDeveloper },
- { "distSetUser", distSetUser },
- { "distSetXUser", distSetXUser },
- { "distSetMinimum", distSetMinimum },
- { "distSetEverything", distSetEverything },
- { "distSetSrc", distSetSrc },
- { "distExtractAll", distExtractAll },
- { "docBrowser", docBrowser },
- { "docShowDocument", docShowDocument },
- { "installCommit", installCommit },
- { "installExpress", installExpress },
- { "installStandard", installStandard },
- { "installUpgrade", installUpgrade },
- { "installFixupBase", installFixupBase },
- { "installFixitHoloShell", installFixitHoloShell },
- { "installFixitCDROM", installFixitCDROM },
- { "installFixitFloppy", installFixitFloppy },
- { "installFilesystems", installFilesystems },
- { "installVarDefaults", installVarDefaults },
- { "loadConfig", dispatch_load_file },
- { "loadFloppyConfig", dispatch_load_floppy },
- { "mediaClose", dispatch_mediaClose },
- { "mediaSetCDROM", mediaSetCDROM },
- { "mediaSetFloppy", mediaSetFloppy },
- { "mediaSetDOS", mediaSetDOS },
- { "mediaSetTape", mediaSetTape },
- { "mediaSetFTP", mediaSetFTP },
- { "mediaSetFTPActive", mediaSetFTPActive },
- { "mediaSetFTPPassive", mediaSetFTPPassive },
- { "mediaSetHTTP", mediaSetHTTP },
- { "mediaSetUFS", mediaSetUFS },
- { "mediaSetNFS", mediaSetNFS },
- { "mediaSetFTPUserPass", mediaSetFTPUserPass },
- { "mediaSetCPIOVerbosity", mediaSetCPIOVerbosity },
- { "mediaGetType", mediaGetType },
- { "msgConfirm", dispatch_msgConfirm },
- { "optionsEditor", optionsEditor },
- { "packageAdd", packageAdd },
- { "addGroup", userAddGroup },
- { "addUser", userAddUser },
- { "shutdown", dispatch_shutdown },
- { "system", dispatch_systemExecute },
- { "dumpVariables", dump_variables },
- { "tcpMenuSelect", tcpMenuSelect },
- { NULL, NULL },
-};
-
-/*
- * Helper routines for buffering data.
- *
- * We read an entire configuration into memory before executing it
- * so that we are truely standalone and can do things like nuke the
- * file or disk we're working on.
- */
-
-typedef struct command_buffer_ {
- qelement queue;
- char * string;
-} command_buffer;
-
-static void
-dispatch_free_command(command_buffer *item)
-{
- REMQUE(item);
- free(item->string);
- free(item);
-}
-
-static void
-dispatch_free_all(qelement *head)
-{
- command_buffer *item;
-
- while (!EMPTYQUE(*head)) {
- item = (command_buffer *) head->q_forw;
- dispatch_free_command(item);
- }
-}
-
-static command_buffer *
-dispatch_add_command(qelement *head, char *string)
-{
- command_buffer *new;
-
- new = malloc(sizeof(command_buffer));
-
- if (!new)
- return NULL;
-
- new->string = strdup(string);
- INSQUEUE(new, head->q_back);
-
- return new;
-}
-
-/*
- * Command processing
- */
-
-/* Just convenience */
-static int
-dispatch_shutdown(dialogMenuItem *unused)
-{
- systemShutdown(0);
- return DITEM_FAILURE;
-}
-
-static int
-dispatch_systemExecute(dialogMenuItem *unused)
-{
- char *cmd = variable_get(VAR_COMMAND);
-
- if (cmd)
- return systemExecute(cmd) ? DITEM_FAILURE : DITEM_SUCCESS;
- else
- msgDebug("_systemExecute: No command passed in `command' variable.\n");
- return DITEM_FAILURE;
-}
-
-static int
-dispatch_msgConfirm(dialogMenuItem *unused)
-{
- char *msg = variable_get(VAR_COMMAND);
-
- if (msg) {
- msgConfirm("%s", msg);
- return DITEM_SUCCESS;
- }
-
- msgDebug("_msgConfirm: No message passed in `command' variable.\n");
- return DITEM_FAILURE;
-}
-
-static int
-dispatch_mediaClose(dialogMenuItem *unused)
-{
- mediaClose();
- return DITEM_SUCCESS;
-}
-
-static int
-call_possible_resword(char *name, dialogMenuItem *value, int *status)
-{
- int i, rval;
-
- rval = 0;
- for (i = 0; resWords[i].name; i++) {
- if (!strcmp(name, resWords[i].name)) {
- *status = resWords[i].handler(value);
- rval = 1;
- break;
- }
- }
- return rval;
-}
-
-/* For a given string, call it or spit out an undefined command diagnostic */
-int
-dispatchCommand(char *str)
-{
- int i;
- char *cp;
-
- if (!str || !*str) {
- msgConfirm("Null or zero-length string passed to dispatchCommand");
- return DITEM_FAILURE;
- }
- /* If it's got a newline, trim it */
- if ((cp = index(str, '\n')) != NULL)
- *cp = '\0';
-
- /* If it's got a `=' sign in there, assume it's a variable setting */
- if (index(str, '=')) {
- if (isDebug())
- msgDebug("dispatch: setting variable `%s'\n", str);
- variable_set(str, 0);
- i = DITEM_SUCCESS;
- }
- else {
- /* A command might be a pathname if it's encoded in argv[0], which
- we also support */
- if ((cp = rindex(str, '/')) != NULL)
- str = cp + 1;
- if (isDebug())
- msgDebug("dispatch: calling resword `%s'\n", str);
- if (!call_possible_resword(str, NULL, &i)) {
- msgNotify("Warning: No such command ``%s''", str);
- i = DITEM_FAILURE;
- }
- /*
- * Allow a user to prefix a command with "noError" to cause
- * us to ignore any errors for that one command.
- */
- if (i != DITEM_SUCCESS && variable_get(VAR_NO_ERROR))
- i = DITEM_SUCCESS;
- variable_unset(VAR_NO_ERROR);
- }
- return i;
-}
-
-
-/*
- * File processing
- */
-
-static qelement *
-dispatch_load_fp(FILE *fp)
-{
- qelement *head;
- char buf[BUFSIZ], *cp;
-
- head = malloc(sizeof(qelement));
-
- if (!head)
- return NULL;
-
- INITQUE(*head);
-
- while (fgets(buf, sizeof buf, fp)) {
-
- if ((cp = strchr(buf, '\n')) != NULL)
- *cp = '\0';
- if (*buf == '\0' || *buf == '#')
- continue;
-
- if (!dispatch_add_command(head, buf))
- return NULL;
- }
-
- return head;
-}
-
-static int
-dispatch_execute(qelement *head)
-{
- int result = DITEM_SUCCESS;
- command_buffer *item;
- char *old_interactive;
-
- if (!head)
- return result | DITEM_FAILURE;
-
- old_interactive = variable_get(VAR_NONINTERACTIVE);
- if (old_interactive)
- old_interactive = strdup(old_interactive); /* save copy */
-
- /* Hint to others that we're running from a script, should they care */
- variable_set2(VAR_NONINTERACTIVE, "yes", 0);
-
- while (!EMPTYQUE(*head)) {
- item = (command_buffer *) head->q_forw;
-
- if (DITEM_STATUS(dispatchCommand(item->string)) != DITEM_SUCCESS) {
- msgConfirm("Command `%s' failed - rest of script aborted.\n",
- item->string);
- result |= DITEM_FAILURE;
- break;
- }
- dispatch_free_command(item);
- }
-
- dispatch_free_all(head);
-
- if (!old_interactive)
- variable_unset(VAR_NONINTERACTIVE);
- else {
- variable_set2(VAR_NONINTERACTIVE, old_interactive, 0);
- free(old_interactive);
- }
-
- return result;
-}
-
-int
-dispatch_load_file_int(int quiet)
-{
- FILE *fp;
- char *cp;
- int i;
- qelement *list;
-
- static const char *names[] = {
- "install.cfg",
- "/stand/install.cfg",
- "/tmp/install.cfg",
- NULL
- };
-
- fp = NULL;
- cp = variable_get(VAR_CONFIG_FILE);
- if (!cp) {
- for (i = 0; names[i]; i++)
- if ((fp = fopen(names[i], "r")) != NULL)
- break;
- } else
- fp = fopen(cp, "r");
-
- if (!fp) {
- if (!quiet)
- msgConfirm("Unable to open %s: %s", cp, strerror(errno));
- return DITEM_FAILURE;
- }
-
- list = dispatch_load_fp(fp);
- fclose(fp);
-
- return dispatch_execute(list);
-}
-
-int
-dispatch_load_file(dialogMenuItem *self)
-{
- return dispatch_load_file_int(FALSE);
-}
-
-int
-dispatch_load_floppy(dialogMenuItem *self)
-{
- int what = DITEM_SUCCESS;
- extern char *distWanted;
- char *cp;
- FILE *fp;
- qelement *list;
-
- mediaClose();
- cp = variable_get_value(VAR_INSTALL_CFG,
- "Specify the name of a configuration file\n"
- "residing on a MSDOS or UFS floppy.", 0);
- if (!cp || !*cp) {
- variable_unset(VAR_INSTALL_CFG);
- what |= DITEM_FAILURE;
- return what;
- }
-
- distWanted = cp;
- /* Try to open the floppy drive */
- if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE) {
- msgConfirm("Unable to set media device to floppy.");
- what |= DITEM_FAILURE;
- mediaClose();
- return what;
- }
-
- if (!DEVICE_INIT(mediaDevice)) {
- msgConfirm("Unable to mount floppy filesystem.");
- what |= DITEM_FAILURE;
- mediaClose();
- return what;
- }
-
- fp = DEVICE_GET(mediaDevice, cp, TRUE);
- if (fp) {
- list = dispatch_load_fp(fp);
- fclose(fp);
- mediaClose();
-
- what |= dispatch_execute(list);
- }
- else {
- if (!variable_get(VAR_NO_ERROR))
- msgConfirm("Configuration file '%s' not found.", cp);
- variable_unset(VAR_INSTALL_CFG);
- what |= DITEM_FAILURE;
- mediaClose();
- }
- return what;
-}
-
diff --git a/usr.sbin/sade/dmenu.c b/usr.sbin/sade/dmenu.c
deleted file mode 100644
index d89f8ce..0000000
--- a/usr.sbin/sade/dmenu.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last attempt in the `sysinstall' line, the next
- * generation being slated for what's essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <errno.h>
-
-#define MAX_MENU 15
-
-static Boolean exited;
-
-int
-dmenuDisplayFile(dialogMenuItem *tmp)
-{
- systemDisplayHelp((char *)tmp->data);
- return DITEM_SUCCESS;
-}
-
-int
-dmenuSubmenu(dialogMenuItem *tmp)
-{
- return (dmenuOpenSimple((DMenu *)(tmp->data), FALSE) ? DITEM_SUCCESS : DITEM_FAILURE);
-}
-
-int
-dmenuSystemCommand(dialogMenuItem *self)
-{
- WINDOW *w = NULL; /* Keep lint happy */
-
- /* If aux is set, the command is known not to produce any screen-spoiling output */
- if (!self->aux)
- w = savescr();
- systemExecute((char *)self->data);
- if (!self->aux)
- restorescr(w);
- return DITEM_SUCCESS;
-}
-
-int
-dmenuSystemCommandBox(dialogMenuItem *tmp)
-{
- WINDOW *w = savescr();
-
- use_helpfile(NULL);
- use_helpline("Select OK to dismiss this dialog");
- dialog_prgbox(tmp->title, (char *)tmp->data, 22, 76, 1, 1);
- restorescr(w);
- return DITEM_SUCCESS;
-}
-
-int
-dmenuExit(dialogMenuItem *tmp)
-{
- exited = TRUE;
- return DITEM_LEAVE_MENU;
-}
-
-int
-dmenuSetVariable(dialogMenuItem *tmp)
-{
- variable_set((char *)tmp->data, *((char *)tmp->data) != '_');
- return DITEM_SUCCESS;
-}
-
-int
-dmenuSetVariables(dialogMenuItem *tmp)
-{
- char *cp1, *cp2;
- char *copy = strdup((char *)tmp->data);
-
- for (cp1 = copy; cp1 != NULL;) {
- cp2 = index(cp1, ',');
- if (cp2 != NULL) *cp2++ = '\0';
- variable_set(cp1, *cp1 != '_');
- cp1 = cp2;
- }
- free(copy);
- return DITEM_SUCCESS;
-}
-
-int
-dmenuSetKmapVariable(dialogMenuItem *tmp)
-{
- char *lang;
- int err;
-
- variable_set((char *)tmp->data, TRUE);
- lang = variable_get(VAR_KEYMAP);
- if (lang != NULL)
- {
- err = loadKeymap(lang);
- if (err == -1)
- msgConfirm("No appropriate keyboard map found, sorry.");
- else if (err == -2)
- msgConfirm("Error installing keyboard map, errno = %d.", errno);
- }
- return DITEM_SUCCESS;
-}
-
-int
-dmenuToggleVariable(dialogMenuItem *tmp)
-{
- char *var, *cp;
- int status;
-
- if (!(var = strdup((char *)tmp->data))) {
- msgConfirm("Incorrect data field for `%s'!", tmp->title);
- return DITEM_FAILURE;
- }
- if (!(cp = index(var, '='))) {
- msgConfirm("Data field for %s is not in var=value format!", tmp->title);
- return DITEM_FAILURE;
- }
- status = variable_check(var);
- *cp = '\0';
- variable_set2(var, status ? "NO" : "YES", *var != '_');
- free(var);
- return DITEM_SUCCESS;
-}
-
-int
-dmenuISetVariable(dialogMenuItem *tmp)
-{
- char *ans, *var;
-
- if (!(var = (char *)tmp->data)) {
- msgConfirm("Incorrect data field for `%s'!", tmp->title);
- return DITEM_FAILURE;
- }
- ans = msgGetInput(variable_get(var), tmp->title, 1);
- if (!ans)
- return DITEM_FAILURE;
- else if (!*ans)
- variable_unset(var);
- else
- variable_set2(var, ans, *var != '_');
- return DITEM_SUCCESS;
-}
-
-int
-dmenuSetFlag(dialogMenuItem *tmp)
-{
- if (*((unsigned int *)tmp->data) & tmp->aux)
- *((unsigned int *)tmp->data) &= ~tmp->aux;
- else
- *((unsigned int *)tmp->data) |= tmp->aux;
- return DITEM_SUCCESS;
-}
-
-int
-dmenuSetValue(dialogMenuItem *tmp)
-{
- *((unsigned int *)tmp->data) = tmp->aux;
- return DITEM_SUCCESS;
-}
-
-/* Traverse menu but give user no control over positioning */
-Boolean
-dmenuOpenSimple(DMenu *menu, Boolean buttons)
-{
- int choice, scroll, curr, max;
-
- choice = scroll = curr = max = 0;
- return dmenuOpen(menu, &choice, &scroll, &curr, &max, buttons);
-}
-
-/* Work functions for the state hook */
-int
-dmenuFlagCheck(dialogMenuItem *item)
-{
- return (*((unsigned int *)item->data) & item->aux);
-}
-
-int
-dmenuVarCheck(dialogMenuItem *item)
-{
- char *w;
-
- w = (char *)item->aux;
- if (!w)
- w = (char *)item->data;
- return variable_check(w);
-}
-
-int
-dmenuVarsCheck(dialogMenuItem *item)
-{
- int res, init;
- char *w, *cp1, *cp2;
- char *copy;
-
- w = (char *)item->aux;
- if (!w)
- w = (char *)item->data;
- if (!w)
- return FALSE;
-
- copy = strdup(w);
- res = TRUE;
- init = FALSE;
- for (cp1 = copy; cp1 != NULL;) {
- init = TRUE;
- cp2 = index(cp1, ',');
- if (cp2 != NULL)
- *cp2++ = '\0';
- res = res && variable_check(cp1);
- cp1 = cp2;
- }
- free(copy);
- return res && init;
-}
-
-int
-dmenuRadioCheck(dialogMenuItem *item)
-{
- return (*((unsigned int *)item->data) == item->aux);
-}
-
-static int
-menu_height(DMenu *menu, int n)
-{
- int max;
- char *t;
-
- max = MAX_MENU;
- if (StatusLine > 24)
- max += StatusLine - 24;
- for (t = menu->prompt; *t; t++) {
- if (*t == '\n')
- --max;
- }
- return n > max ? max : n;
-}
-
-/* Traverse over an internal menu */
-Boolean
-dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max, Boolean buttons)
-{
- int n, rval = 0;
- dialogMenuItem *items;
-
- items = menu->items;
- if (buttons)
- items += 2;
- /* Count up all the items */
- for (n = 0; items[n].title; n++);
-
- while (1) {
- char buf[FILENAME_MAX];
- WINDOW *w = savescr();
-
- /* Any helpful hints, put 'em up! */
- use_helpline(menu->helpline);
- use_helpfile(systemHelpFile(menu->helpfile, buf));
- dialog_clear_norefresh();
- /* Pop up that dialog! */
- if (menu->type & DMENU_NORMAL_TYPE)
- rval = dialog_menu((u_char *)menu->title, (u_char *)menu->prompt,
- -1, -1, menu_height(menu, n), -n, items,
- (char *)(uintptr_t)buttons, choice, scroll);
-
- else if (menu->type & DMENU_RADIO_TYPE)
- rval = dialog_radiolist((u_char *)menu->title,
- (u_char *)menu->prompt, -1, -1, menu_height(menu, n), -n,
- items, (char *)(uintptr_t)buttons);
-
- else if (menu->type & DMENU_CHECKLIST_TYPE)
- rval = dialog_checklist((u_char *)menu->title,
- (u_char *)menu->prompt, -1, -1, menu_height(menu, n), -n,
- items, (char *)(uintptr_t)buttons);
- else
- msgFatal("Menu: `%s' is of an unknown type\n", menu->title);
- if (exited) {
- exited = FALSE;
- restorescr(w);
- return TRUE;
- }
- else if (rval) {
- restorescr(w);
- return FALSE;
- }
- else if (menu->type & DMENU_SELECTION_RETURNS) {
- restorescr(w);
- return TRUE;
- }
- }
-}
diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c
deleted file mode 100644
index 892d852..0000000
--- a/usr.sbin/sade/globals.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-
-/*
- * Various global variables and an initialization hook to set them to
- * whatever values we feel are appropriate.
- */
-
-int DebugFD; /* Where diagnostic output goes */
-Boolean Fake; /* Only pretend to be useful */
-Boolean RunningAsInit; /* Are we running as init? */
-Boolean DialogActive; /* Is libdialog initialized? */
-Boolean ColorDisplay; /* Are we on a color display? */
-Boolean OnVTY; /* Are we on a VTY? */
-Boolean Restarting; /* Are we restarting sysinstall? */
-Variable *VarHead; /* The head of the variable chain */
-Device *mediaDevice; /* Where we're installing from */
-int BootMgr; /* Which boot manager we're using */
-int StatusLine; /* Where to stick our status messages */
-jmp_buf BailOut; /* Beam me up, scotty! The natives are pissed! */
-
-Chunk *HomeChunk;
-Chunk *RootChunk;
-Chunk *SwapChunk;
-Chunk *TmpChunk;
-Chunk *UsrChunk;
-Chunk *VarChunk;
-#ifdef __ia64__
-Chunk *EfiChunk;
-#endif
-
-/*
- * Yes, I know some of these are already automatically initialized as
- * globals. I simply find it clearer to set everything explicitly.
- */
-void
-globalsInit(void)
-{
- DebugFD = -1;
- ColorDisplay = FALSE;
- Fake = FALSE;
- Restarting = FALSE;
- OnVTY = FALSE;
- DialogActive = FALSE;
- VarHead = NULL;
- mediaDevice = NULL;
- RunningAsInit = FALSE;
-
- HomeChunk = NULL;
- RootChunk = NULL;
- SwapChunk = NULL;
- TmpChunk = NULL;
- UsrChunk = NULL;
- VarChunk = NULL;
-#ifdef __ia64__
- EfiChunk = NULL;
-#endif
-}
diff --git a/usr.sbin/sade/help/partition.hlp b/usr.sbin/sade/help/partition.hlp
deleted file mode 100644
index 1d62148..0000000
--- a/usr.sbin/sade/help/partition.hlp
+++ /dev/null
@@ -1,169 +0,0 @@
-This is the FreeBSD DiskLabel Editor.
-
-NOTE: If you're entering this editor from the update procedure then
-you probably shouldn't (C)reate anything at all but rather use only
-the (M)ount command to check and mount existing partitions for
-upgrading.
-
-If you would like the label editor to do most of the following for
-you, simply type `A' for automatic partitioning of the disk.
-
-If you wish to create partitions manually you may do so by moving the
-highlighted selection bar with the arrow keys over the FreeBSD
-partition(s) displayed at the top of the screen. Typing (C)reate
-while a partition with available free space is selected will allow you
-to create a BSD partition inside of it using some or all of its
-available space.
-
-Typing (M)ount over an existing partition entry (displayed in the
-middle of the screen) will allow you to set a mount point for it
-without initializing it. If you want it initialized, use the (T)oggle
-command to flip the Newfs flag. When Newfs is set to "Y", the
-filesystem in question will be ERASED and rebuilt from scratch!
-
-
-You should use this editor to create at least the following
-filesystems:
-
- Name Purpose Min Size? Optional?
- ---- ------- --------- ---------
- / Root filesystem 118MB No
- swap Swap space 2 * MEM No
- /usr System & user files 80MB or more Yes
-
-Note: If you do not create a /usr filesystem then your / filesystem
-will need to be bigger - at least 200MB. This is not recommended as
-any media errors that may occur during disk I/O to user files will
-corrupt the filesystem containing vital system files as well. It is
-for this reason that / is generally kept on its own filesystem, where
-it should be considered essentially "read only" in your administration
-of it.
-
-Swap space is a little tricker, and the rule of "2 * MEM" is simply a
-best-guess approximation and not necessarily accurate for your
-intended usage of the system. If you intend to use the system heavily
-in a server or multi-user application, you may be well advised to
-increase this size. You may also create swap space on multiple drives
-for a larger "total" swap and this is, in fact, recommended if you
-have multiple, fast drives for which such load-balancing can only help
-overall I/O performance.
-
-The /usr filesystem should be sized according to what kind of
-distributions you're trying to load and how many packages you intend
-to install in locations like /usr/local. You can also make /usr/local
-a separate filesystem if you don't want to risk filling up your /usr
-by mistake.
-
-Another useful filesystem to create is /var, which contains mail, news
-printer spool files and other temporary items. It is a popular
-candidate for a separate partition and should be sized according to
-your estimates of the amount of mail, news or spooled print jobs that
-may be stored there.
-
-WARNING: If you do not create a separate filesystem for /var, space
-for such files will be allocated out of the root (/) filesystem
-instead. You may therefore wish to make the / partition bigger if you
-expect a lot of mail or news and do not want to make /var its own
-partition.
-
-If you're new to this installation, you might also want to read the
-following explanation of how FreeBSD's new "slice" paradigm for
-looking at disk storage works:
-
-
-In FreeBSD's new system, a device name can be broken up into up to 3
-parts. Take a typical name like ``/dev/da0s1a'':
-
- The first three characters represent the drive name. If we had
- a system with two SCSI drives on it then we'd see /dev/da0 and
- /dev/da1 as the device entries representing the entire drives.
-
- Next you have the "slice" (or "FDISK Partition") number,
- as seen in the Partition Editor. Assuming that our da0
- contained two slices, a FreeBSD slice and a DOS slice, that
- would give us /dev/da0s1 and /dev/da0s2 as device entries pointing
- to the entire slices.
-
- Next, if a slice is a FreeBSD slice, you can have a number of
- (confusingly named) "partitions" inside of it.
-
- These partitions are where various filesystems or swap areas live,
- and using our hypothetical two-SCSI-disk machine again, we might
- have something like the following layout on da0:
-
- Name Mountpoint
- ---- ----------
- da0s1a /
- da0s1b <swap space>
- da0s1e /usr
-
-Once you understand all this, then the purpose of the label editor
-becomes fairly clear: You're carving up the FreeBSD slices displayed
-at the top of the screen into smaller pieces, which are displayed in
-the middle of the screen, and then assigning FreeBSD file system names
-(mount points) to them.
-
-You can also use the label editor to mount existing partitions/slices
-into your filesystem hierarchy, as is frequently done for DOS FAT
-slices. For FreeBSD partitions, you can also toggle the "newfs" state
-so that the partitions are either (re)created from scratch or simply
-checked and mounted (the contents are preserved).
-
-If you set (S)oftUpdates on a filesystem, it will cause the
-"Soft Updates" policy to be in effect for it. This basically causes
-both metadata and data blocks to be written asynchronously to disk,
-but with extra state information which causes the metadata and any
-related data blocks to be committed in a single transaction. This
-results in async metadata update speeds (which are considerably
-faster than the default sync) without the potential for data loss
-which could occur if you simply mounted the filesystem with purely
-"async" update policy and then had a power failure. If you wish
-to later turn the softupdates policy back off, use the command
-"tunefs -n disable devicename". NOTE: It is probably not wise
-to use this on your root filesystem unless you have a large
-(e.g. non-standard size) root. The reason is that smaller filesystems
-with significant activity can temporarily overflow if the soft updates
-policy results in free'd blocks not being "garbage collected" as fast
-as they're being requested.
-
-The UNIX File System (UFS) on FreeBSD supports two different on-disk
-layouts: UFS1 and UFS2. UFS1 was the default file system in use
-through FreeBSD 5.0-RELEASE; as of FreeBSD 5.1-RELEASE, the default
-is now UFS2, with the exception of the PC98 platform. UFS2 provides
-sparse inode allocation (faster fsck), 64-bit storage pointers (larger
-maximum size), and native extended attributes (required for ACLs, MAC,
-and other advanced security and file system services). The selection
-of UFS1 or UFS2 must be made when the file system is created--later
-conversion is not currently possible. UFS2 is the recommended file
-system, but if disks are to be used on older FreeBSD systems, UFS1
-improves portability. When dual-booting between FreeBSD 4.x or
-earlier and FreeBSD 5.x, UFS1 file systems will be accessible from
-both. To toggle a file system to UFS1, press '1'. To restore it to
-UFS2, press '2'.
-
-WARNING: FreeBSD on i386 is currently unable to boot from root file
-systems larger than 1.5TB.
-
-To add additional flags to the newfs command line for UFS file
-systems, press 'N'. These options will be specified before the
-device argument of the command line, but after any other options
-placed there by sysinstall, such as the UFS version and soft
-updates flag; as such, arguments provided may override existing
-settings. To completely replace the newfs command used by
-sysinstall, press 'Z' to convert a partition to a Custom
-partition type. Sysinstall will prompt you with the newfs
-command line that it would have used based on existing settings
-prior to the change, but allow you to modify any aspect of the
-command line. Once a partition has been converted to a custom
-partition in the label editor, you will need to restart the
-labeling process or delete and recreate the partition to restore
-it to a non-custom state. Custom partitions are represented by
-the letters "CST" instead of "UFS" or "FAT.
-
-When you're done, type `Q' to exit.
-
-No actual changes will be made to the disk until you (C)ommit from the
-Install menu or (W)rite directly from this one. You're working with
-what is essentially a copy of the disk label(s), both here and in the
-FDISK Partition Editor, and the actual on-disk labels won't be
-affected by any changes you make until you explicitly say so.
diff --git a/usr.sbin/sade/help/slice.hlp b/usr.sbin/sade/help/slice.hlp
deleted file mode 100644
index b6f6a83..0000000
--- a/usr.sbin/sade/help/slice.hlp
+++ /dev/null
@@ -1,65 +0,0 @@
-This is the Main Slice (``FDISK'' or PC-style Partition) Editor.
-
-Possible commands are printed at the bottom and the Master Boot Record
-contents are shown at the top. You can move up and down with the
-arrow keys and (C)reate a new slice whenever the highlighted
-selection bar is over a slice whose type is marked as "unused."
-
-You are expected to leave this screen with at least one slice
-marked "FreeBSD." Note that unlike Linux, you don't need to create
-multiple FreeBSD FDISK partition entries for different things like
-swap, file systems, etc. The usual convention is to create ONE
-FreeBSD slice (FDISK partition) per drive and then subsection this slice
-into swap and file systems with the Label editor.
-
-No actual changes will be made to the disk until you (C)ommit from the
-Install menu or use the (W)rite option here! You're working with what
-is essentially a copy of the disk label(s), both here and in the Label
-Editor.
-
-If you want to use the entire disk for FreeBSD, type `A'. You'll be
-asked whether or not you wish to keep the disk (potentially) compatible
-with other operating systems, i.e. the information in the FDISK table
-should be kept valid. If you select the default of `Yes', slices will be
-aligned to fictitious cylinder boundaries and space will be reserved
-in front of the FreeBSD slice for a [future] possible boot manager.
-
-For the truly dedicated disk case, you can select `No' at the
-compatibility prompt. In that case, all BIOS geometry considerations
-will no longer be in effect and you can safely ignore any
-``The detected geometry is invalid'' warning messages you may later
-see. It is also not necessary in this case to set a slice bootable
-or install an MBR boot manager as both things are then irrelevant.
-
-The FreeBSD slice will start at absolute sector 0 of the disk (so that
-FreeBSD's disk label is identical to the Master Boot Record) and
-extend to the very last sector of the disk medium. Needless to say,
-such a disk cannot have any sort of a boot manager, `disk manager',
-or anything else that has to interact with the BIOS. This option is
-therefore only considered safe for SCSI disks and most IDE disks and
-is primarily intended for people who are going to set up a dedicated
-FreeBSD server or workstation, not a typical `home PC'.
-
-The flags field has the following legend:
-
- '=' -- This slice is properly aligned.
- '>' -- This slice doesn't end before cylinder 1024
- 'R' -- This slice contains the root (/) filesystem
- 'B' -- Slice employs BAD144 bad-spot handling
- 'C' -- This is the FreeBSD 2.0-compatibility slice (default)
- 'A' -- This slice is marked active.
-
-If you select a slice for Bad144 handling, it will be scanned
-for bad blocks before any new filesystems are made on it.
-
-If no slice is marked Active, you will need to either install
-a Boot Manager (the option for which will be presented later in the
-installation) or set one Active before leaving this screen.
-
-To leave the slice editor, type `Q'.
-
-Final Note: If you're absolutely sure you know what you're doing
- and you want to use the old "Dangerously Dedicated" mode
- which is now deprecated by sysinstall, use the (purposely)
- undocumented `F' key.
-
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
deleted file mode 100644
index 7c21abf..0000000
--- a/usr.sbin/sade/install.c
+++ /dev/null
@@ -1,1267 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <ctype.h>
-#include <sys/consio.h>
-#include <sys/disklabel.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/wait.h>
-#include <sys/uio.h>
-#include <sys/param.h>
-#define MSDOSFS
-#include <sys/mount.h>
-#include <ufs/ufs/ufsmount.h>
-#include <fs/msdosfs/msdosfsmount.h>
-#undef MSDOSFS
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <libdisk.h>
-#include <limits.h>
-#include <unistd.h>
-#include <termios.h>
-
-/* Hack for rsaref package add, which displays interactive license.
- * Used by package.c
- */
-int _interactiveHack;
-int FixItMode = 0;
-
-static void create_termcap(void);
-static void fixit_common(void);
-
-#define TERMCAP_FILE "/usr/share/misc/termcap"
-
-static void installConfigure(void);
-
-Boolean
-checkLabels(Boolean whinge)
-{
- Device **devs;
- Boolean status;
- Disk *disk;
- PartInfo *pi;
- Chunk *c1, *c2;
- int i;
-
- /* Don't allow whinging if noWarn is set */
- if (variable_get(VAR_NO_WARN))
- whinge = FALSE;
-
- status = TRUE;
- HomeChunk = RootChunk = SwapChunk = NULL;
- TmpChunk = UsrChunk = VarChunk = NULL;
-#ifdef __ia64__
- EfiChunk = NULL;
-#endif
-
- /* We don't need to worry about root/usr/swap if we're already multiuser */
- if (!RunningAsInit)
- return status;
-
- devs = deviceFind(NULL, DEVICE_TYPE_DISK);
- /* First verify that we have a root device */
- for (i = 0; devs[i]; i++) {
- if (!devs[i]->enabled)
- continue;
- disk = (Disk *)devs[i]->private;
- msgDebug("Scanning disk %s for root filesystem\n", disk->name);
- if (!disk->chunks)
- msgFatal("No chunk list found for %s!", disk->name);
- for (c1 = disk->chunks->part; c1; c1 = c1->next) {
-#ifdef __ia64__
- c2 = c1;
-#elif defined(__powerpc__)
- if (c1->type == apple) {
- for (c2 = c1->part; c2; c2 = c2->next) {
-#else
- if (c1->type == freebsd) {
- for (c2 = c1->part; c2; c2 = c2->next) {
-#endif
-
- pi = (PartInfo *)c2->private_data;
- if (c2->type == part && c2->subtype != FS_SWAP && pi != NULL) {
- if (!strcmp(pi->mountpoint, "/")) {
- if (RootChunk) {
- if (whinge)
- msgConfirm("WARNING: You have more than one root device set?!\n"
- "Using the first one found.");
- continue;
- }
- else {
- RootChunk = c2;
- if (isDebug())
- msgDebug("Found rootdev at %s!\n", RootChunk->name);
- }
- }
- else if (!strcmp(pi->mountpoint, "/usr")) {
- if (UsrChunk) {
- if (whinge)
- msgConfirm("WARNING: You have more than one /usr filesystem.\n"
- "Using the first one found.");
- continue;
- }
- else {
- UsrChunk = c2;
- if (isDebug())
- msgDebug("Found usrdev at %s!\n", UsrChunk->name);
- }
- }
- else if (!strcmp(pi->mountpoint, "/var")) {
- if (VarChunk) {
- if (whinge)
- msgConfirm("WARNING: You have more than one /var filesystem.\n"
- "Using the first one found.");
- continue;
- }
- else {
- VarChunk = c2;
- if (isDebug())
- msgDebug("Found vardev at %s!\n", VarChunk->name);
- }
- } else if (!strcmp(pi->mountpoint, "/tmp")) {
- if (TmpChunk) {
- if (whinge)
- msgConfirm("WARNING: You have more than one /tmp filesystem.\n"
- "Using the first one found.");
- continue;
- }
- else {
- TmpChunk = c2;
- if (isDebug())
- msgDebug("Found tmpdev at %s!\n", TmpChunk->name);
- }
- } else if (!strcmp(pi->mountpoint, "/home")) {
- if (HomeChunk) {
- if (whinge)
- msgConfirm("WARNING: You have more than one /home filesystem.\n"
- "Using the first one found.");
- continue;
- }
- else {
- HomeChunk = c2;
- if (isDebug())
- msgDebug("Found homedev at %s!\n", HomeChunk->name);
- }
- }
- }
-#ifndef __ia64__
- }
- }
-#endif
- }
- }
-
- /* Now check for swap devices */
- for (i = 0; devs[i]; i++) {
- if (!devs[i]->enabled)
- continue;
- disk = (Disk *)devs[i]->private;
- msgDebug("Scanning disk %s for swap partitions\n", disk->name);
- if (!disk->chunks)
- msgFatal("No chunk list found for %s!", disk->name);
- for (c1 = disk->chunks->part; c1; c1 = c1->next) {
-
-#ifdef __ia64__
- c2 = c1;
-#elif defined(__powerpc__)
- if (c1->type == apple) {
- for (c2 = c1->part; c2; c2 = c2->next) {
-#else
- if (c1->type == freebsd) {
- for (c2 = c1->part; c2; c2 = c2->next) {
-#endif
- if (c2->type == part && c2->subtype == FS_SWAP && !SwapChunk) {
- SwapChunk = c2;
- if (isDebug())
- msgDebug("Found swapdev at %s!\n", SwapChunk->name);
- break;
- }
-#ifndef __ia64__
- }
- }
-#endif
- }
- }
-
-#ifdef __ia64__
- for (i = 0; devs[i] != NULL; i++) {
- if (!devs[i]->enabled)
- continue;
- disk = (Disk *)devs[i]->private;
- for (c1 = disk->chunks->part; c1 != NULL; c1 = c1->next) {
- pi = (PartInfo *)c1->private_data;
- if (c1->type == efi && pi != NULL && pi->mountpoint[0] == '/')
- EfiChunk = c1;
- }
- }
-#endif
-
- if (!RootChunk && whinge) {
- msgConfirm("No root device found - you must label a partition as /\n"
- "in the label editor.");
- status = FALSE;
- }
- if (!SwapChunk && whinge) {
- if (msgYesNo("No swap devices found - you should create at least one\n"
- "swap partition. Without swap, the install will fail\n"
- "if you do not have enough RAM. Continue anyway?"))
- status = FALSE;
- }
-#ifdef __ia64__
- if (EfiChunk == NULL && whinge) {
- if (msgYesNo("No (mounted) EFI system partition found. Is this what you want?"))
- status = FALSE;
- }
-#endif
- return status;
-}
-
-static int
-installInitial(void)
-{
- static Boolean alreadyDone = FALSE;
- int status = DITEM_SUCCESS;
-
- if (alreadyDone)
- return DITEM_SUCCESS;
-
- if (!variable_get(DISK_LABELLED)) {
- msgConfirm("You need to assign disk labels before you can proceed with\n"
- "the installation.");
- return DITEM_FAILURE;
- }
- /* If it's labelled, assume it's also partitioned */
- if (!variable_get(DISK_PARTITIONED))
- variable_set2(DISK_PARTITIONED, "yes", 0);
-
- /* If we refuse to proceed, bail. */
- dialog_clear_norefresh();
- if (!variable_get(VAR_NO_WARN)) {
- if (msgYesNo(
- "Last Chance! Are you SURE you want continue the installation?\n\n"
- "If you're running this on a disk with data you wish to save\n"
- "then WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before\n"
- "proceeding!\n\n"
- "We can take no responsibility for lost disk contents!") != 0)
- return DITEM_FAILURE;
- }
-
- if (DITEM_STATUS(diskLabelCommit(NULL)) != DITEM_SUCCESS) {
- msgConfirm("Couldn't make filesystems properly. Aborting.");
- return DITEM_FAILURE;
- }
-
- if (!copySelf()) {
- msgConfirm("installInitial: Couldn't clone the boot floppy onto the\n"
- "root file system. Aborting!");
- return DITEM_FAILURE;
- }
-
- if (!Restarting && chroot("/mnt") == -1) {
- msgConfirm("installInitial: Unable to chroot to %s - this is bad!",
- "/mnt");
- return DITEM_FAILURE;
- }
-
- chdir("/");
- variable_set2(RUNNING_ON_ROOT, "yes", 0);
-
- /* Configure various files in /etc */
- if (DITEM_STATUS(configResolv(NULL)) == DITEM_FAILURE)
- status = DITEM_FAILURE;
- if (DITEM_STATUS(configFstab(NULL)) == DITEM_FAILURE)
- status = DITEM_FAILURE;
-
- /* stick a helpful shell over on the 4th VTY */
- if (!variable_get(VAR_NO_HOLOSHELL))
- systemCreateHoloshell();
-
- alreadyDone = TRUE;
- return status;
-}
-
-int
-installFixitHoloShell(dialogMenuItem *self)
-{
- FixItMode = 1;
- systemCreateHoloshell();
- return DITEM_SUCCESS;
- FixItMode = 0;
-}
-
-int
-installFixitCDROM(dialogMenuItem *self)
-{
- struct stat sb;
- int need_eject;
-
- if (!RunningAsInit)
- return DITEM_SUCCESS;
-
- variable_set2(SYSTEM_STATE, "fixit", 0);
- (void)unlink("/mnt2");
- (void)rmdir("/mnt2");
-
- need_eject = 0;
- CDROMInitQuiet = 1;
- while (1) {
- if (need_eject)
- msgConfirm(
- "Please insert a FreeBSD live filesystem CD/DVD and press return");
- if (DITEM_STATUS(mediaSetCDROM(NULL)) != DITEM_SUCCESS
- || !DEVICE_INIT(mediaDevice)) {
- /* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */
- mediaClose();
- if (need_eject && msgYesNo("Unable to mount the disc. Do you want to try again?") != 0)
- return DITEM_FAILURE;
- } else if (!file_readable("/dist/rescue/ldconfig")) {
- mediaClose();
- if (need_eject &&
- msgYesNo("Unable to find a FreeBSD live filesystem. Do you want to try again?") != 0)
- return DITEM_FAILURE;
- } else
- break;
- CDROMInitQuiet = 0;
- need_eject = 1;
- }
- CDROMInitQuiet = 0;
-
- /* Since the fixit code expects everything to be in /mnt2, and the CDROM mounting stuff /dist, do
- * a little kludge dance here..
- */
- if (symlink("/dist", "/mnt2")) {
- msgConfirm("Unable to symlink /mnt2 to the disc mount point. Please report this\n"
- "unexpected failure to freebsd-bugs@FreeBSD.org.");
- return DITEM_FAILURE;
- }
-
- /*
- * If /tmp points to /mnt2/tmp from a previous fixit floppy session, it's
- * not very good for us if we point it to the CDROM now. Rather make it
- * a directory in the root MFS then. Experienced admins will still be
- * able to mount their disk's /tmp over this if they need.
- */
- if (lstat("/tmp", &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFLNK)
- (void)unlink("/tmp");
- Mkdir("/tmp");
-
- /*
- * Since setuid binaries ignore LD_LIBRARY_PATH, we indeed need the
- * ld.so.hints file. Fortunately, it's fairly small (~ 3 KB).
- */
- if (!file_readable("/var/run/ld.so.hints")) {
- Mkdir("/var/run");
- if (vsystem("/mnt2/rescue/ldconfig -s /mnt2/lib /mnt2/usr/lib")) {
- msgConfirm("Warning: ldconfig could not create the ld.so hints file.\n"
- "Dynamic executables from the disc likely won't work.");
- }
- }
-
- /* Yet more iggly hardcoded pathnames. */
- Mkdir("/libexec");
- if (!file_readable("/libexec/ld.so") && file_readable("/mnt2/libexec/ld.so")) {
- if (symlink("/mnt2/libexec/ld.so", "/libexec/ld.so"))
- msgDebug("Couldn't link to ld.so - not necessarily a problem for ELF\n");
- }
- if (!file_readable("/libexec/ld-elf.so.1")) {
- if (symlink("/mnt2/libexec/ld-elf.so.1", "/libexec/ld-elf.so.1")) {
- msgConfirm("Warning: could not create the symlink for ld-elf.so.1\n"
- "Dynamic executables from the disc likely won't work.");
- }
- }
- /* optional nicety */
- if (!file_readable("/usr/bin/vi"))
- symlink("/mnt2/usr/bin/vi", "/usr/bin/vi");
- fixit_common();
- mediaClose();
- if (need_eject)
- msgConfirm("Please remove the FreeBSD fixit CDROM/DVD now.");
- return DITEM_SUCCESS;
-}
-
-int
-installFixitFloppy(dialogMenuItem *self)
-{
- struct ufs_args args;
- extern char *distWanted;
-
- if (!RunningAsInit)
- return DITEM_SUCCESS;
-
- /* Try to open the floppy drive */
- if (DITEM_STATUS(mediaSetFloppy(NULL)) == DITEM_FAILURE || !mediaDevice) {
- msgConfirm("Unable to set media device to floppy.");
- mediaClose();
- return DITEM_FAILURE;
- }
-
- memset(&args, 0, sizeof(args));
- args.fspec = mediaDevice->devname;
- mediaDevice->private = "/mnt2";
- distWanted = NULL;
- Mkdir("/mnt2");
-
- variable_set2(SYSTEM_STATE, "fixit", 0);
-
- while (1) {
- if (!DEVICE_INIT(mediaDevice)) {
- if (msgYesNo("The attempt to mount the fixit floppy failed, bad floppy\n"
- "or unclean filesystem. Do you want to try again?"))
- return DITEM_FAILURE;
- }
- else
- break;
- }
- if (!directory_exists("/tmp"))
- (void)symlink("/mnt2/tmp", "/tmp");
- fixit_common();
- mediaClose();
- msgConfirm("Please remove the fixit floppy now.");
- return DITEM_SUCCESS;
-}
-
-/*
- * The common code for both fixit variants.
- */
-static void
-fixit_common(void)
-{
- pid_t child;
- int waitstatus;
-
- if (!directory_exists("/var/tmp/vi.recover")) {
- if (DITEM_STATUS(Mkdir("/var/tmp/vi.recover")) != DITEM_SUCCESS) {
- msgConfirm("Warning: Was unable to create a /var/tmp/vi.recover directory.\n"
- "vi will kvetch and moan about it as a result but should still\n"
- "be essentially usable.");
- }
- }
- if (!directory_exists("/bin"))
- (void)Mkdir("/bin");
- (void)symlink("/stand/sh", "/bin/sh");
- /* Link the /etc/ files */
- if (DITEM_STATUS(Mkdir("/etc")) != DITEM_SUCCESS)
- msgConfirm("Unable to create an /etc directory! Things are weird on this floppy..");
- else if ((symlink("/mnt2/etc/spwd.db", "/etc/spwd.db") == -1 && errno != EEXIST) ||
- (symlink("/mnt2/etc/protocols", "/etc/protocols") == -1 && errno != EEXIST) ||
- (symlink("/mnt2/etc/group", "/etc/group") == -1 && errno != EEXIST) ||
- (symlink("/mnt2/etc/services", "/etc/services") == -1 && errno != EEXIST))
- msgConfirm("Couldn't symlink the /etc/ files! I'm not sure I like this..");
- if (!file_readable(TERMCAP_FILE))
- create_termcap();
- if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0)
- systemSuspendDialog(); /* must be before the fork() */
- if (!(child = fork())) {
- int i, fd;
- struct termios foo;
- extern int login_tty(int);
-
- ioctl(0, TIOCNOTTY, NULL);
- for (i = getdtablesize(); i >= 0; --i)
- close(i);
-
- if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0)
- fd = open("/dev/console", O_RDWR);
- else
- fd = open("/dev/ttyv3", O_RDWR);
- ioctl(0, TIOCSCTTY, &fd);
- dup2(0, 1);
- dup2(0, 2);
- DebugFD = 2;
- if (login_tty(fd) == -1)
- msgDebug("fixit: I can't set the controlling terminal.\n");
-
- signal(SIGTTOU, SIG_IGN);
- if (tcgetattr(0, &foo) != -1) {
- foo.c_cc[VERASE] = '\010';
- if (tcsetattr(0, TCSANOW, &foo) == -1)
- msgDebug("fixit shell: Unable to set erase character.\n");
- }
- else
- msgDebug("fixit shell: Unable to get terminal attributes!\n");
- setenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin:/stand:"
- "/mnt2/stand:/mnt2/bin:/mnt2/sbin:/mnt2/usr/bin:/mnt2/usr/sbin", 1);
- if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0) {
- printf("Waiting for fixit shell to exit.\n"
- "When you are done, type ``exit'' to exit\n"
- "the fixit shell and be returned here.\n\n");
- fflush(stdout);
- } else {
- ioctl(fd, VT_ACTIVATE, 0);
- }
-
- /* use the .profile from the fixit medium */
- setenv("HOME", "/mnt2", 1);
- chdir("/mnt2");
- execlp("sh", "-sh", (char *)0);
- msgDebug("fixit shell: Failed to execute shell!\n");
- _exit(1);;
- }
- else {
- if (strcmp(variable_get(VAR_FIXIT_TTY), "standard") == 0) {
- dialog_clear_norefresh();
- msgNotify("Waiting for fixit shell to exit. Go to VTY4 now by\n"
- "typing ALT-F4. When you are done, type ``exit'' to exit\n"
- "the fixit shell and be returned here\n.");
- }
- (void)waitpid(child, &waitstatus, 0);
- if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0)
- systemResumeDialog();
- else if (OnVTY) {
- ioctl(0, VT_ACTIVATE, 0);
- msgInfo(NULL);
- }
- }
- dialog_clear();
-}
-
-
-int
-installExpress(dialogMenuItem *self)
-{
- int i;
-
- dialog_clear_norefresh();
- variable_set2(SYSTEM_STATE, "express", 0);
-#ifdef WITH_SLICES
- if (DITEM_STATUS((i = diskPartitionEditor(self))) == DITEM_FAILURE)
- return i;
-#endif
-
- if (DITEM_STATUS((i = diskLabelEditor(self))) == DITEM_FAILURE)
- return i;
-
- if (DITEM_STATUS((i = installCommit(self))) == DITEM_SUCCESS) {
- i |= DITEM_LEAVE_MENU;
-
- /* Give user the option of one last configuration spree */
- installConfigure();
- }
- return i;
-}
-
-/* Standard mode installation */
-int
-installStandard(dialogMenuItem *self)
-{
- int i, tries = 0;
- Device **devs;
-
- variable_set2(SYSTEM_STATE, "standard", 0);
- dialog_clear_norefresh();
-#ifdef WITH_SLICES
- msgConfirm("In the next menu, you will need to set up a DOS-style (\"fdisk\") partitioning\n"
- "scheme for your hard disk. If you simply wish to devote all disk space\n"
- "to FreeBSD (overwriting anything else that might be on the disk(s) selected)\n"
- "then use the (A)ll command to select the default partitioning scheme followed\n"
- "by a (Q)uit. If you wish to allocate only free space to FreeBSD, move to a\n"
- "partition marked \"unused\" and use the (C)reate command.");
-
-nodisks:
- if (DITEM_STATUS(diskPartitionEditor(self)) == DITEM_FAILURE)
- return DITEM_FAILURE;
-
- if (diskGetSelectCount(&devs) <= 0 && tries < 3) {
- msgConfirm("You need to select some disks to operate on! Be sure to use SPACE\n"
- "instead of RETURN in the disk selection menu when selecting a disk.");
- ++tries;
- goto nodisks;
- }
-
- msgConfirm("Now you need to create BSD partitions inside of the fdisk partition(s)\n"
- "just created. If you have a reasonable amount of disk space (200MB or more)\n"
- "and don't have any special requirements, simply use the (A)uto command to\n"
- "allocate space automatically. If you have more specific needs or just don't\n"
- "care for the layout chosen by (A)uto, press F1 for more information on\n"
- "manual layout.");
-#else
- msgConfirm("First you need to create BSD partitions on the disk which you are\n"
- "installing to. If you have a reasonable amount of disk space (200MB or more)\n"
- "and don't have any special requirements, simply use the (A)uto command to\n"
- "allocate space automatically. If you have more specific needs or just don't\n"
- "care for the layout chosen by (A)uto, press F1 for more information on\n"
- "manual layout.");
-#endif
-
- if (DITEM_STATUS(diskLabelEditor(self)) == DITEM_FAILURE)
- return DITEM_FAILURE;
-
- if (DITEM_STATUS((i = installCommit(self))) == DITEM_FAILURE) {
- dialog_clear();
- msgConfirm("Installation completed with some errors. You may wish to\n"
- "scroll through the debugging messages on VTY1 with the\n"
- "scroll-lock feature. You can also choose \"No\" at the next\n"
- "prompt and go back into the installation menus to retry\n"
- "whichever operations have failed.");
- return i;
-
- }
- else {
- dialog_clear();
- msgConfirm("Congratulations! You now have FreeBSD installed on your system.\n\n"
- "We will now move on to the final configuration questions.\n"
- "For any option you do not wish to configure, simply select\n"
- "No.\n\n"
- "If you wish to re-enter this utility after the system is up, you\n"
- "may do so by typing: /usr/sbin/sysinstall.");
- }
- if (mediaDevice->type != DEVICE_TYPE_FTP && mediaDevice->type != DEVICE_TYPE_NFS) {
- if (!msgYesNo("Would you like to configure any Ethernet or SLIP/PPP network devices?")) {
- Device *tmp = tcpDeviceSelect();
-
- if (tmp && !((DevInfo *)tmp->private)->use_dhcp && !msgYesNo("Would you like to bring the %s interface up right now?", tmp->name))
- if (!DEVICE_INIT(tmp))
- msgConfirm("Initialization of %s device failed.", tmp->name);
- }
- dialog_clear_norefresh();
- }
-
- if (!msgNoYes("Do you want this machine to function as a network gateway?"))
- variable_set2("gateway_enable", "YES", 1);
-
- dialog_clear_norefresh();
- if (!msgNoYes("Do you want to configure inetd and the network services that it provides?"))
- configInetd(self);
-
- dialog_clear_norefresh();
- if (!msgNoYes("Would you like to enable SSH login?"))
- variable_set2("sshd_enable", "YES", 1);
-
- dialog_clear_norefresh();
- if (!msgNoYes("Do you want to have anonymous FTP access to this machine?"))
- configAnonFTP(self);
-
- dialog_clear_norefresh();
- if (!msgNoYes("Do you want to configure this machine as an NFS server?"))
- configNFSServer(self);
-
- dialog_clear_norefresh();
- if (!msgNoYes("Do you want to configure this machine as an NFS client?"))
- variable_set2("nfs_client_enable", "YES", 1);
-
-#ifdef WITH_SYSCONS
- dialog_clear_norefresh();
- if (!msgNoYes("Would you like to customize your system console settings?"))
- dmenuOpenSimple(&MenuSyscons, FALSE);
-#endif
-
- dialog_clear_norefresh();
- if (!msgYesNo("Would you like to set this machine's time zone now?"))
- systemExecute("tzsetup");
-
-#ifdef WITH_LINUX
- dialog_clear_norefresh();
- if (!msgYesNo("Would you like to enable Linux binary compatibility?"))
- (void)configLinux(self);
-#endif
-
-#ifdef __alpha__
- dialog_clear_norefresh();
- if (!msgYesNo("Would you like to enable OSF/1 binary compatibility?"))
- (void)configOSF1(self);
-#endif
-
-#ifdef WITH_MICE
- dialog_clear_norefresh();
- if (!msgNoYes("Does this system have a PS/2, serial, or bus mouse?"))
- dmenuOpenSimple(&MenuMouse, FALSE);
-#endif
-
-#ifdef __i386__
- if (checkLoaderACPI() != 0) {
- dialog_clear_norefresh();
- if (!msgNoYes("ACPI was disabled during boot.\n"
- "Would you like to disable it permanently?"))
- (void)configLoaderACPI(1 /*disable*/);
- }
-#endif
-
- /* Now would be a good time to checkpoint the configuration data */
- configRC_conf();
- sync();
-
- dialog_clear_norefresh();
- if (!msgYesNo("The FreeBSD package collection is a collection of thousands of ready-to-run\n"
- "applications, from text editors to games to WEB servers and more. Would you\n"
- "like to browse the collection now?")) {
- (void)configPackages(self);
- }
-
- if (!msgYesNo("Would you like to add any initial user accounts to the system?\n"
- "Adding at least one account for yourself at this stage is suggested\n"
- "since working as the \"root\" user is dangerous (it is easy to do\n"
- "things which adversely affect the entire system)."))
- (void)configUsers(self);
-
- msgConfirm("Now you must set the system manager's password.\n"
- "This is the password you'll use to log in as \"root\".");
- if (!systemExecute("passwd root"))
- variable_set2("root_password", "YES", 0);
-
- /* XXX Put whatever other nice configuration questions you'd like to ask the user here XXX */
-
- /* Give user the option of one last configuration spree */
- dialog_clear_norefresh();
- installConfigure();
- return DITEM_LEAVE_MENU;
-}
-
-/* The version of commit we call from the Install Custom menu */
-int
-installCustomCommit(dialogMenuItem *self)
-{
- int i;
-
- i = installCommit(self);
- if (DITEM_STATUS(i) == DITEM_SUCCESS) {
- /* Give user the option of one last configuration spree */
- installConfigure();
- return i;
- }
- else
- msgConfirm("The commit operation completed with errors. Not\n"
- "updating /etc files.");
- return i;
-}
-
-/*
- * What happens when we finally decide to going ahead with the installation.
- *
- * This is broken into multiple stages so that the user can do a full
- * installation but come back here again to load more distributions,
- * perhaps from a different media type. This would allow, for
- * example, the user to load the majority of the system from CDROM and
- * then use ftp to load a different dist.
- */
-int
-installCommit(dialogMenuItem *self)
-{
- int i;
- char *str;
-
- dialog_clear_norefresh();
- if (!Dists)
- distConfig(NULL);
-
- if (!Dists) {
- (void)dmenuOpenSimple(&MenuDistributions, FALSE);
- /* select reasonable defaults if necessary */
- if (!Dists)
- Dists = _DIST_USER;
- }
-
- if (!mediaVerify())
- return DITEM_FAILURE;
-
- str = variable_get(SYSTEM_STATE);
- if (isDebug())
- msgDebug("installCommit: System state is `%s'\n", str);
-
- /* Installation stuff we wouldn't do to a running system */
- if (RunningAsInit && DITEM_STATUS((i = installInitial())) == DITEM_FAILURE)
- return i;
-
-try_media:
- if (!DEVICE_INIT(mediaDevice)) {
- if (!msgYesNo("Unable to initialize selected media. Would you like to\n"
- "adjust your media configuration and try again?")) {
- mediaDevice = NULL;
- if (!mediaVerify())
- return DITEM_FAILURE;
- else
- goto try_media;
- }
- else
- return DITEM_FAILURE;
- }
-
- /* Now go get it all */
- i = distExtractAll(self);
-
- /* When running as init, *now* it's safe to grab the rc.foo vars */
- installEnvironment();
-
- variable_set2(SYSTEM_STATE, DITEM_STATUS(i) == DITEM_FAILURE ? "error-install" : "full-install", 0);
-
- return i;
-}
-
-static void
-installConfigure(void)
-{
- /* Final menu of last resort */
- if (!msgNoYes("Visit the general configuration menu for a chance to set\n"
- "any last options?"))
- dmenuOpenSimple(&MenuConfigure, FALSE);
- configRC_conf();
- sync();
-}
-
-int
-installFixupBase(dialogMenuItem *self)
-{
- FILE *fp;
-#ifdef __ia64__
- const char *efi_mntpt;
-#endif
-
- /* All of this is done only as init, just to be safe */
- if (RunningAsInit) {
-#if defined(__i386__) || defined(__amd64__)
- if ((fp = fopen("/boot/loader.conf", "a")) != NULL) {
- if (!OnVTY) {
- fprintf(fp, "# -- sysinstall generated deltas -- #\n");
- fprintf(fp, "console=\"comconsole\"\n");
- }
- fclose(fp);
- }
-#endif
-
- /* BOGON #2: We leave /etc in a bad state */
- chmod("/etc", 0755);
-
- /* BOGON #3: No /var/db/mountdtab complains */
- Mkdir("/var/db");
- creat("/var/db/mountdtab", 0644);
-
- /* BOGON #4: /compat created by default in root fs */
- Mkdir("/usr/compat");
- vsystem("ln -s usr/compat /compat");
-
- /* BOGON #5: aliases database not build for bin */
- vsystem("newaliases");
-
- /* BOGON #6: Remove /stand (finally) */
- vsystem("rm -rf /stand");
-
- /* Now run all the mtree stuff to fix things up */
- vsystem("mtree -deU -f /etc/mtree/BSD.root.dist -p /");
- vsystem("mtree -deU -f /etc/mtree/BSD.var.dist -p /var");
- vsystem("mtree -deU -f /etc/mtree/BSD.usr.dist -p /usr");
-
-#ifdef __ia64__
- /* Move /boot to the the EFI partition and make /boot a link to it. */
- efi_mntpt = (EfiChunk != NULL) ? ((PartInfo *)EfiChunk->private_data)->mountpoint : NULL;
- if (efi_mntpt != NULL) {
- vsystem("if [ ! -L /boot ]; then mv /boot %s; fi", efi_mntpt);
- vsystem("if [ ! -e /boot ]; then ln -sf %s/boot /boot; fi",
- efi_mntpt + 1); /* Skip leading '/' */
- /* Make sure the kernel knows which partition is the root file system. */
- vsystem("echo 'vfs.root.mountfrom=\"ufs:/dev/%s\"' >> /boot/loader.conf", RootChunk->name);
- }
-#endif
-
- /* Do all the last ugly work-arounds here */
- }
- return DITEM_SUCCESS | DITEM_RESTORE;
-}
-
-#define QUEUE_YES 1
-#define QUEUE_NO 0
-static int
-performNewfs(PartInfo *pi, char *dname, int queue)
-{
- char buffer[LINE_MAX];
-
- if (pi->do_newfs) {
- switch(pi->newfs_type) {
- case NEWFS_UFS:
- snprintf(buffer, LINE_MAX, "%s %s %s %s %s",
- NEWFS_UFS_CMD,
- pi->newfs_data.newfs_ufs.softupdates ? "-U" : "",
- pi->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2",
- pi->newfs_data.newfs_ufs.user_options,
- dname);
- break;
-
- case NEWFS_MSDOS:
- snprintf(buffer, LINE_MAX, "%s %s", NEWFS_MSDOS_CMD,
- dname);
- break;
-
- case NEWFS_CUSTOM:
- snprintf(buffer, LINE_MAX, "%s %s",
- pi->newfs_data.newfs_custom.command, dname);
- break;
- }
-
- if (queue == QUEUE_YES) {
- command_shell_add(pi->mountpoint, buffer);
- return (0);
- } else
- return (vsystem(buffer));
- }
- return (0);
-}
-
-/* Go newfs and/or mount all the filesystems we've been asked to */
-int
-installFilesystems(dialogMenuItem *self)
-{
- int i;
- Disk *disk;
- Chunk *c1, *c2;
- Device **devs;
- PartInfo *root;
- char dname[80];
- Boolean upgrade = FALSE;
-
- /* If we've already done this, bail out */
- if (!variable_cmp(DISK_LABELLED, "written"))
- return DITEM_SUCCESS;
-
- upgrade = !variable_cmp(SYSTEM_STATE, "upgrade");
- if (!checkLabels(TRUE))
- return DITEM_FAILURE;
-
- root = (RootChunk != NULL) ? (PartInfo *)RootChunk->private_data : NULL;
-
- command_clear();
- if (SwapChunk && RunningAsInit) {
- /* As the very first thing, try to get ourselves some swap space */
- sprintf(dname, "/dev/%s", SwapChunk->name);
- if (!Fake && !file_readable(dname)) {
- msgConfirm("Unable to find device node for %s in /dev!\n"
- "The creation of filesystems will be aborted.", dname);
- return DITEM_FAILURE;
- }
-
- if (!Fake) {
- if (!swapon(dname)) {
- dialog_clear_norefresh();
- msgNotify("Added %s as initial swap device", dname);
- }
- else {
- msgConfirm("WARNING! Unable to swap to %s: %s\n"
- "This may cause the installation to fail at some point\n"
- "if you don't have a lot of memory.", dname, strerror(errno));
- }
- }
- }
-
- if (RootChunk && RunningAsInit) {
- /* Next, create and/or mount the root device */
- sprintf(dname, "/dev/%s", RootChunk->name);
- if (!Fake && !file_readable(dname)) {
- msgConfirm("Unable to make device node for %s in /dev!\n"
- "The creation of filesystems will be aborted.", dname);
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- if (strcmp(root->mountpoint, "/"))
- msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", RootChunk->name, root->mountpoint);
-
- if (root->do_newfs && (!upgrade ||
- !msgNoYes("You are upgrading - are you SURE you want to newfs "
- "the root partition?"))) {
- int i;
-
- dialog_clear_norefresh();
- msgNotify("Making a new root filesystem on %s", dname);
- i = performNewfs(root, dname, QUEUE_NO);
- if (i) {
- msgConfirm("Unable to make new root filesystem on %s!\n"
- "Command returned status %d", dname, i);
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- }
- else {
- if (!upgrade) {
- msgConfirm("Warning: Using existing root partition. It will be assumed\n"
- "that you have the appropriate device entries already in /dev.");
- }
- dialog_clear_norefresh();
- msgNotify("Checking integrity of existing %s filesystem.", dname);
- i = vsystem("fsck_ffs -y %s", dname);
- if (i)
- msgConfirm("Warning: fsck returned status of %d for %s.\n"
- "This partition may be unsafe to use.", i, dname);
- }
-
- /*
- * If soft updates was enabled in the editor but we didn't newfs,
- * use tunefs to update the soft updates flag on the file system.
- */
- if (!root->do_newfs && root->newfs_type == NEWFS_UFS &&
- root->newfs_data.newfs_ufs.softupdates) {
- i = vsystem("tunefs -n enable %s", dname);
- if (i)
- msgConfirm("Warning: Unable to enable soft updates"
- " for root file system on %s", dname);
- }
-
- /* Switch to block device */
- sprintf(dname, "/dev/%s", RootChunk->name);
- if (Mount("/mnt", dname)) {
- msgConfirm("Unable to mount the root file system on %s! Giving up.", dname);
- return DITEM_FAILURE | DITEM_RESTORE;
- }
-
- /* Mount devfs for other partitions to mount */
- Mkdir("/mnt/dev");
- if (!Fake) {
- struct iovec iov[4];
-
- iov[0].iov_base = "fstype";
- iov[0].iov_len = strlen(iov[0].iov_base) + 1;
- iov[1].iov_base = "devfs";
- iov[1].iov_len = strlen(iov[1].iov_base) + 1;
- iov[2].iov_base = "fspath";
- iov[2].iov_len = strlen(iov[2].iov_base) + 1;
- iov[3].iov_base = "/mnt/dev";
- iov[3].iov_len = strlen(iov[3].iov_base) + 1;
- i = nmount(iov, 4, 0);
-
- if (i) {
- dialog_clear_norefresh();
- msgConfirm("Unable to mount DEVFS (error %d)", errno);
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- }
- }
-
- /* Now buzz through the rest of the partitions and mount them too */
- devs = deviceFind(NULL, DEVICE_TYPE_DISK);
- for (i = 0; devs[i]; i++) {
- if (!devs[i]->enabled)
- continue;
-
- disk = (Disk *)devs[i]->private;
- if (!disk->chunks) {
- msgConfirm("No chunk list found for %s!", disk->name);
- return DITEM_FAILURE | DITEM_RESTORE;
- }
- for (c1 = disk->chunks->part; c1; c1 = c1->next) {
-#ifdef __ia64__
- if (c1->type == part) {
- c2 = c1;
- {
-#elif defined(__powerpc__)
- if (c1->type == apple) {
- for (c2 = c1->part; c2; c2 = c2->next) {
-#else
- if (c1->type == freebsd) {
- for (c2 = c1->part; c2; c2 = c2->next) {
-#endif
- if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) {
- PartInfo *tmp = (PartInfo *)c2->private_data;
-
- /* Already did root */
- if (c2 == RootChunk)
- continue;
-
- sprintf(dname, "%s/dev/%s",
- RunningAsInit ? "/mnt" : "", c2->name);
-
- if (tmp->do_newfs && (!upgrade ||
- !msgNoYes("You are upgrading - are you SURE you"
- " want to newfs /dev/%s?", c2->name)))
- performNewfs(tmp, dname, QUEUE_YES);
- else
- command_shell_add(tmp->mountpoint,
- "fsck_ffs -y %s/dev/%s", RunningAsInit ?
- "/mnt" : "", c2->name);
-#if 0
- if (tmp->soft)
- command_shell_add(tmp->mountpoint,
- "tunefs -n enable %s/dev/%s", RunningAsInit ?
- "/mnt" : "", c2->name);
-#endif
- command_func_add(tmp->mountpoint, Mount, c2->name);
- }
- else if (c2->type == part && c2->subtype == FS_SWAP) {
- char fname[80];
- int i;
-
- if (c2 == SwapChunk)
- continue;
- sprintf(fname, "%s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
- i = (Fake || swapon(fname));
- if (!i) {
- dialog_clear_norefresh();
- msgNotify("Added %s as an additional swap device", fname);
- }
- else {
- msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno));
- }
- }
- }
- }
- else if (c1->type == fat && c1->private_data &&
- (root->do_newfs || upgrade)) {
- char name[FILENAME_MAX];
-
- sprintf(name, "%s/%s", RunningAsInit ? "/mnt" : "", ((PartInfo *)c1->private_data)->mountpoint);
- Mkdir(name);
- }
-#if defined(__ia64__)
- else if (c1->type == efi && c1->private_data) {
- char bootdir[FILENAME_MAX];
- PartInfo *pi = (PartInfo *)c1->private_data;
- char *p;
-
- sprintf(dname, "%s/dev/%s", RunningAsInit ? "/mnt" : "",
- c1->name);
-
- if (pi->do_newfs && (!upgrade ||
- !msgNoYes("You are upgrading - are you SURE you want to "
- "newfs /dev/%s?", c1->name)))
- performNewfs(pi, dname, QUEUE_YES);
-
- command_func_add(pi->mountpoint, Mount_msdosfs, c1->name);
- }
-#endif
- }
- }
-
- command_sort();
- command_execute();
- dialog_clear_norefresh();
- return DITEM_SUCCESS | DITEM_RESTORE;
-}
-
-static char *
-getRelname(void)
-{
- static char buf[64];
- size_t sz = (sizeof buf) - 1;
-
- if (sysctlbyname("kern.osrelease", buf, &sz, NULL, 0) != -1) {
- buf[sz] = '\0';
- return buf;
- }
- else
- return "<unknown>";
-}
-
-/* Initialize various user-settable values to their defaults */
-int
-installVarDefaults(dialogMenuItem *self)
-{
- char *cp;
-
- /* Set default startup options */
- variable_set2(VAR_RELNAME, getRelname(), 0);
- variable_set2(VAR_CPIO_VERBOSITY, "high", 0);
- variable_set2(VAR_TAPE_BLOCKSIZE, DEFAULT_TAPE_BLOCKSIZE, 0);
- variable_set2(VAR_INSTALL_ROOT, "/", 0);
- variable_set2(VAR_INSTALL_CFG, "install.cfg", 0);
- variable_set2(VAR_SKIP_PCCARD, "NO", 0);
- cp = getenv("EDITOR");
- if (!cp)
- cp = "/usr/bin/ee";
- variable_set2(VAR_EDITOR, cp, 0);
- variable_set2(VAR_FTP_USER, "ftp", 0);
- variable_set2(VAR_BROWSER_PACKAGE, "links", 0);
- variable_set2(VAR_BROWSER_BINARY, "/usr/local/bin/links", 0);
- variable_set2(VAR_FTP_STATE, "passive", 0);
- variable_set2(VAR_NFS_SECURE, "NO", -1);
- variable_set2(VAR_NFS_TCP, "NO", -1);
- variable_set2(VAR_NFS_V3, "YES", -1);
- if (OnVTY)
- variable_set2(VAR_FIXIT_TTY, "standard", 0);
- else
- variable_set2(VAR_FIXIT_TTY, "serial", 0);
- variable_set2(VAR_PKG_TMPDIR, "/var/tmp", 0);
- variable_set2(VAR_MEDIA_TIMEOUT, itoa(MEDIA_TIMEOUT), 0);
- if (getpid() != 1)
- variable_set2(SYSTEM_STATE, "update", 0);
- else
- variable_set2(SYSTEM_STATE, "init", 0);
- variable_set2(VAR_NEWFS_ARGS, "-b 16384 -f 2048", 0);
- variable_set2(VAR_CONSTERM, "NO", 0);
- return DITEM_SUCCESS;
-}
-
-/* Load the environment up from various system configuration files */
-void
-installEnvironment(void)
-{
- configEnvironmentRC_conf();
- if (file_readable("/etc/resolv.conf"))
- configEnvironmentResolv("/etc/resolv.conf");
-}
-
-/* Copy the boot floppy contents into /stand */
-Boolean
-copySelf(void)
-{
- int i;
-
- if (file_readable("/boot.help"))
- vsystem("cp /boot.help /mnt");
- msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem");
- i = vsystem("find -x /stand | cpio %s -pdum /mnt", cpioVerbosity());
- if (i) {
- msgConfirm("Copy returned error status of %d!", i);
- return FALSE;
- }
-
- /* Copy the /etc files into their rightful place */
- if (vsystem("cd /mnt/stand; find etc | cpio %s -pdum /mnt", cpioVerbosity())) {
- msgConfirm("Couldn't copy up the /etc files!");
- return TRUE;
- }
- return TRUE;
-}
-
-static void
-create_termcap(void)
-{
- FILE *fp;
-
- const char *caps[] = {
- termcap_vt100, termcap_cons25, termcap_cons25_m, termcap_cons25r,
- termcap_cons25r_m, termcap_cons25l1, termcap_cons25l1_m,
- termcap_xterm, NULL,
- };
- const char **cp;
-
- if (!file_readable(TERMCAP_FILE)) {
- Mkdir("/usr/share/misc");
- fp = fopen(TERMCAP_FILE, "w");
- if (!fp) {
- msgConfirm("Unable to initialize termcap file. Some screen-oriented\nutilities may not work.");
- return;
- }
- cp = caps;
- while (*cp)
- fprintf(fp, "%s\n", *(cp++));
- fclose(fp);
- }
-}
diff --git a/usr.sbin/sade/keymap.c b/usr.sbin/sade/keymap.c
deleted file mode 100644
index 3c53a00..0000000
--- a/usr.sbin/sade/keymap.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 1996 Joerg Wunsch
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- *
- */
-
-#include "sysinstall.h"
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/kbio.h>
-
-struct keymapInfo {
- const char *name;
- const struct keymap *map;
-};
-
-#include "keymap.h"
-
-/*
- * keymap.h is being automatically generated by the Makefile. It
- * contains definitions for all desired keymaps. Note that since we
- * don't support font loading nor screen mapping during installation,
- * we simply don't care for any other keys than the ASCII subset.
- *
- * Therefore, if no keymap with the exact name has been found in the
- * first pass, we make a second pass over the table looking just for
- * the language name only.
- */
-
-/*
- * Return values:
- *
- * 0: OK
- * -1: no appropriate keymap found
- * -2: error installing map (other than ENXIO which means we're not on syscons)
- */
-
-int
-loadKeymap(const char *lang)
-{
- int passno, err;
- char *llang;
- size_t l;
- struct keymapInfo *kip;
-
- llang = strdup(lang);
- if (llang == NULL)
- abort();
-
- for (passno = 0; passno < 2; passno++)
- {
- if (passno > 0)
- {
- /* make the match more fuzzy */
- l = strspn(llang, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
- llang[l] = '\0';
- }
-
- l = strlen(llang);
-
- for (kip = keymapInfos; kip->name; kip++)
- if (strncmp(kip->name, llang, l) == 0)
- {
- /* Yep, got it! */
- err = ioctl(0, PIO_KEYMAP, kip->map);
- free(llang);
- return (err == -1 && errno != ENOTTY)? -2: 0;
- }
- }
- free(llang);
- return -1;
-}
diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c
deleted file mode 100644
index c752f73..0000000
--- a/usr.sbin/sade/label.c
+++ /dev/null
@@ -1,1692 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <ctype.h>
-#include <inttypes.h>
-#include <libdisk.h>
-#include <sys/disklabel.h>
-#include <sys/param.h>
-#include <sys/sysctl.h>
-
-#define AUTO_HOME 0 /* do not create /home automatically */
-
-/*
- * Everything to do with editing the contents of disk labels.
- */
-
-/* A nice message we use a lot in the disklabel editor */
-#define MSG_NOT_APPLICABLE "That option is not applicable here"
-
-/* Where to start printing the freebsd slices */
-#define CHUNK_SLICE_START_ROW 2
-#define CHUNK_PART_START_ROW 11
-
-/* The smallest filesystem we're willing to create */
-#define FS_MIN_SIZE ONE_MEG
-
-/*
- * Minimum partition sizes
- */
-#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || defined(__amd64__)
-#define ROOT_MIN_SIZE 128
-#else
-#define ROOT_MIN_SIZE 118
-#endif
-#define SWAP_MIN_SIZE 32
-#define USR_MIN_SIZE 80
-#define VAR_MIN_SIZE 20
-#define TMP_MIN_SIZE 20
-#define HOME_MIN_SIZE 20
-
-/*
- * Swap size limit for auto-partitioning (4G).
- */
-#define SWAP_AUTO_LIMIT_SIZE 4096
-
-/*
- * Default partition sizes. If we do not have sufficient disk space
- * for this configuration we scale things relative to the NOM vs DEFAULT
- * sizes. If the disk is larger then /home will get any remaining space.
- */
-#define ROOT_DEFAULT_SIZE 256
-#define USR_DEFAULT_SIZE 3072
-#define VAR_DEFAULT_SIZE 256
-#define TMP_DEFAULT_SIZE 256
-#define HOME_DEFAULT_SIZE USR_DEFAULT_SIZE
-
-/*
- * Nominal partition sizes. These are used to scale the default sizes down
- * when we have insufficient disk space. If this isn't sufficient we scale
- * down using the MIN sizes instead.
- */
-#define ROOT_NOMINAL_SIZE 192
-#define USR_NOMINAL_SIZE 512
-#define VAR_NOMINAL_SIZE 64
-#define TMP_NOMINAL_SIZE 64
-#define HOME_NOMINAL_SIZE USR_NOMINAL_SIZE
-
-/* The bottom-most row we're allowed to scribble on */
-#define CHUNK_ROW_MAX 16
-
-
-/* All the chunks currently displayed on the screen */
-static struct {
- struct chunk *c;
- PartType type;
-} label_chunk_info[MAX_CHUNKS + 1];
-static int here;
-
-/*** with this value we try to track the most recently added label ***/
-static int label_focus = 0, pslice_focus = 0;
-
-static int diskLabel(Device *dev);
-static int diskLabelNonInteractive(Device *dev);
-static char *try_auto_label(Device **devs, Device *dev, int perc, int *req);
-
-static int
-labelHook(dialogMenuItem *selected)
-{
- Device **devs = NULL;
-
- devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);
- if (!devs) {
- msgConfirm("Unable to find disk %s!", selected->prompt);
- return DITEM_FAILURE;
- }
- /* Toggle enabled status? */
- if (!devs[0]->enabled) {
- devs[0]->enabled = TRUE;
- diskLabel(devs[0]);
- }
- else
- devs[0]->enabled = FALSE;
- return DITEM_SUCCESS;
-}
-
-static int
-labelCheck(dialogMenuItem *selected)
-{
- Device **devs = NULL;
-
- devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);
- if (!devs || devs[0]->enabled == FALSE)
- return FALSE;
- return TRUE;
-}
-
-int
-diskLabelEditor(dialogMenuItem *self)
-{
- DMenu *menu;
- Device **devs;
- int i, cnt;
-
- i = 0;
- cnt = diskGetSelectCount(&devs);
- if (cnt == -1) {
- msgConfirm("No disks found! Please verify that your disk controller is being\n"
- "properly probed at boot time. See the Hardware Guide on the\n"
- "Documentation menu for clues on diagnosing this type of problem.");
- return DITEM_FAILURE;
- }
- else if (cnt) {
- /* Some are already selected */
- if (variable_get(VAR_NONINTERACTIVE) &&
- !variable_get(VAR_DISKINTERACTIVE))
- i = diskLabelNonInteractive(NULL);
- else
- i = diskLabel(NULL);
- }
- else {
- /* No disks are selected, fall-back case now */
- cnt = deviceCount(devs);
- if (cnt == 1) {
- devs[0]->enabled = TRUE;
- if (variable_get(VAR_NONINTERACTIVE) &&
- !variable_get(VAR_DISKINTERACTIVE))
- i = diskLabelNonInteractive(devs[0]);
- else
- i = diskLabel(devs[0]);
- }
- else {
- menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, labelHook, labelCheck);
- if (!menu) {
- msgConfirm("No devices suitable for installation found!\n\n"
- "Please verify that your disk controller (and attached drives)\n"
- "were detected properly. This can be done by pressing the\n"
- "[Scroll Lock] key and using the Arrow keys to move back to\n"
- "the boot messages. Press [Scroll Lock] again to return.");
- i = DITEM_FAILURE;
- }
- else {
- i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
- free(menu);
- }
- }
- }
- if (DITEM_STATUS(i) != DITEM_FAILURE) {
- if (variable_cmp(DISK_LABELLED, "written"))
- variable_set2(DISK_LABELLED, "yes", 0);
- }
- return i;
-}
-
-int
-diskLabelCommit(dialogMenuItem *self)
-{
- char *cp;
- int i;
-
- /* Already done? */
- if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes"))
- i = DITEM_SUCCESS;
- else if (!cp) {
- msgConfirm("You must assign disk labels before this option can be used.");
- i = DITEM_FAILURE;
- }
- /* The routine will guard against redundant writes, just as this one does */
- else if (DITEM_STATUS(diskPartitionWrite(self)) != DITEM_SUCCESS)
- i = DITEM_FAILURE;
- else if (DITEM_STATUS(installFilesystems(self)) != DITEM_SUCCESS)
- i = DITEM_FAILURE;
- else {
- msgInfo("All filesystem information written successfully.");
- variable_set2(DISK_LABELLED, "written", 0);
- i = DITEM_SUCCESS;
- }
- return i;
-}
-
-/* See if we're already using a desired partition name */
-static Boolean
-check_conflict(char *name)
-{
- int i;
-
- for (i = 0; label_chunk_info[i].c; i++)
- if ((label_chunk_info[i].type == PART_FILESYSTEM || label_chunk_info[i].type == PART_FAT
- || label_chunk_info[i].type == PART_EFI) && label_chunk_info[i].c->private_data
- && !strcmp(((PartInfo *)label_chunk_info[i].c->private_data)->mountpoint, name))
- return TRUE;
- return FALSE;
-}
-
-/* How much space is in this FreeBSD slice? */
-static daddr_t
-space_free(struct chunk *c)
-{
- struct chunk *c1;
- daddr_t sz = c->size;
-
- for (c1 = c->part; c1; c1 = c1->next) {
- if (c1->type != unused)
- sz -= c1->size;
- }
- if (sz < 0)
- msgFatal("Partitions are larger than actual chunk??");
- return sz;
-}
-
-/* Snapshot the current situation into the displayed chunks structure */
-static void
-record_label_chunks(Device **devs, Device *dev)
-{
- int i, j, p;
- struct chunk *c1, *c2;
- Disk *d;
-
- j = p = 0;
- /* First buzz through and pick up the FreeBSD slices */
- for (i = 0; devs[i]; i++) {
- if ((dev && devs[i] != dev) || !devs[i]->enabled)
- continue;
- d = (Disk *)devs[i]->private;
- if (!d->chunks)
- msgFatal("No chunk list found for %s!", d->name);
-
-#ifdef __ia64__
- label_chunk_info[j].type = PART_SLICE;
- label_chunk_info[j].c = d->chunks;
- j++;
-#endif
-
- /* Put the slice entries first */
- for (c1 = d->chunks->part; c1; c1 = c1->next) {
- if (c1->type == freebsd) {
- label_chunk_info[j].type = PART_SLICE;
- label_chunk_info[j].c = c1;
- ++j;
- }
-#ifdef __powerpc__
- if (c1->type == apple) {
- label_chunk_info[j].type = PART_SLICE;
- label_chunk_info[j].c = c1;
- ++j;
- }
-#endif
- }
- }
-
- /* Now run through again and get the FreeBSD partition entries */
- for (i = 0; devs[i]; i++) {
- if (!devs[i]->enabled)
- continue;
- d = (Disk *)devs[i]->private;
- /* Then buzz through and pick up the partitions */
- for (c1 = d->chunks->part; c1; c1 = c1->next) {
- if (c1->type == freebsd) {
- for (c2 = c1->part; c2; c2 = c2->next) {
- if (c2->type == part) {
- if (c2->subtype == FS_SWAP)
- label_chunk_info[j].type = PART_SWAP;
- else
- label_chunk_info[j].type = PART_FILESYSTEM;
- label_chunk_info[j].c = c2;
- ++j;
- }
- }
- }
- else if (c1->type == fat) {
- label_chunk_info[j].type = PART_FAT;
- label_chunk_info[j].c = c1;
- ++j;
- }
-#ifdef __ia64__
- else if (c1->type == efi) {
- label_chunk_info[j].type = PART_EFI;
- label_chunk_info[j].c = c1;
- ++j;
- }
- else if (c1->type == part) {
- if (c1->subtype == FS_SWAP)
- label_chunk_info[j].type = PART_SWAP;
- else
- label_chunk_info[j].type = PART_FILESYSTEM;
- label_chunk_info[j].c = c1;
- ++j;
- }
-#endif
-#ifdef __powerpc__
- else if (c1->type == apple) {
- for (c2 = c1->part; c2; c2 = c2->next) {
- if (c2->type == part) {
- if (c2->subtype == FS_SWAP)
- label_chunk_info[j].type = PART_SWAP;
- else
- label_chunk_info[j].type = PART_FILESYSTEM;
- label_chunk_info[j].c = c2;
- ++j;
- }
- }
- }
-#endif
- }
- }
- label_chunk_info[j].c = NULL;
- if (here >= j) {
- here = j ? j - 1 : 0;
- }
-}
-
-/* A new partition entry */
-static PartInfo *
-new_part(PartType type, char *mpoint, Boolean newfs)
-{
- PartInfo *pi;
-
- if (!mpoint)
- mpoint = (type == PART_EFI) ? "/efi" : "/change_me";
-
- pi = (PartInfo *)safe_malloc(sizeof(PartInfo));
- sstrncpy(pi->mountpoint, mpoint, FILENAME_MAX);
-
- pi->do_newfs = newfs;
-
- if (type == PART_EFI) {
- pi->newfs_type = NEWFS_MSDOS;
- } else {
- pi->newfs_type = NEWFS_UFS;
- strcpy(pi->newfs_data.newfs_ufs.user_options, "");
- pi->newfs_data.newfs_ufs.acls = FALSE;
- pi->newfs_data.newfs_ufs.multilabel = FALSE;
- pi->newfs_data.newfs_ufs.softupdates = strcmp(mpoint, "/");
-#ifdef PC98
- pi->newfs_data.newfs_ufs.ufs1 = TRUE;
-#else
- pi->newfs_data.newfs_ufs.ufs1 = FALSE;
-#endif
- }
-
- return pi;
-}
-
-/* Get the mountpoint for a partition and save it away */
-static PartInfo *
-get_mountpoint(PartType type, struct chunk *old)
-{
- char *val;
- PartInfo *tmp;
- Boolean newfs;
-
- if (old && old->private_data)
- tmp = old->private_data;
- else
- tmp = NULL;
- val = (tmp != NULL) ? tmp->mountpoint : (type == PART_EFI) ? "/efi" : NULL;
- val = msgGetInput(val, "Please specify a mount point for the partition");
- if (!val || !*val) {
- if (!old)
- return NULL;
- else {
- free(old->private_data);
- old->private_data = NULL;
- }
- return NULL;
- }
-
- /* Is it just the same value? */
- if (tmp && !strcmp(tmp->mountpoint, val))
- return NULL;
-
- /* Did we use it already? */
- if (check_conflict(val)) {
- msgConfirm("You already have a mount point for %s assigned!", val);
- return NULL;
- }
-
- /* Is it bogus? */
- if (*val != '/') {
- msgConfirm("Mount point must start with a / character");
- return NULL;
- }
-
- /* Is it going to be mounted on root? */
- if (!strcmp(val, "/")) {
- if (old)
- old->flags |= CHUNK_IS_ROOT;
- }
- else if (old)
- old->flags &= ~CHUNK_IS_ROOT;
-
- newfs = TRUE;
- if (tmp) {
- newfs = tmp->do_newfs;
- safe_free(tmp);
- }
- val = string_skipwhite(string_prune(val));
- tmp = new_part(type, val, newfs);
- if (old) {
- old->private_data = tmp;
- old->private_free = safe_free;
- }
- return tmp;
-}
-
-/* Get the type of the new partiton */
-static PartType
-get_partition_type(void)
-{
- char selection[20];
- int i;
- static unsigned char *fs_types[] = {
-#ifdef __ia64__
- "EFI", "An EFI system partition",
-#endif
- "FS", "A file system",
- "Swap", "A swap partition.",
- };
- WINDOW *w = savescr();
-
- i = dialog_menu("Please choose a partition type",
- "If you want to use this partition for swap space, select Swap.\n"
- "If you want to put a filesystem on it, choose FS.",
- -1, -1,
-#ifdef __ia64__
- 3, 3,
-#else
- 2, 2,
-#endif
- fs_types, selection, NULL, NULL);
- restorescr(w);
- if (!i) {
-#ifdef __ia64__
- if (!strcmp(selection, "EFI"))
- return PART_EFI;
-#endif
- if (!strcmp(selection, "FS"))
- return PART_FILESYSTEM;
- else if (!strcmp(selection, "Swap"))
- return PART_SWAP;
- }
- return PART_NONE;
-}
-
-/* If the user wants a special newfs command for this, set it */
-static void
-getNewfsCmd(PartInfo *p)
-{
- char buffer[NEWFS_CMD_ARGS_MAX];
- char *val;
-
- switch (p->newfs_type) {
- case NEWFS_UFS:
- snprintf(buffer, NEWFS_CMD_ARGS_MAX, "%s %s %s %s",
- NEWFS_UFS_CMD, p->newfs_data.newfs_ufs.softupdates ? "-U" : "",
- p->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2",
- p->newfs_data.newfs_ufs.user_options);
- break;
- case NEWFS_MSDOS:
- snprintf(buffer, NEWFS_CMD_ARGS_MAX, "%s", NEWFS_MSDOS_CMD);
- break;
- case NEWFS_CUSTOM:
- strcpy(buffer, p->newfs_data.newfs_custom.command);
- break;
- }
-
- val = msgGetInput(buffer,
- "Please enter the newfs command and options you'd like to use in\n"
- "creating this file system.");
- if (val != NULL) {
- p->newfs_type = NEWFS_CUSTOM;
- strlcpy(p->newfs_data.newfs_custom.command, val, NEWFS_CMD_ARGS_MAX);
- }
-}
-
-static void
-getNewfsOptionalArguments(PartInfo *p)
-{
- char buffer[NEWFS_CMD_ARGS_MAX];
- char *val;
-
- /* Must be UFS, per argument checking in I/O routines. */
-
- strlcpy(buffer, p->newfs_data.newfs_ufs.user_options,
- NEWFS_CMD_ARGS_MAX);
- val = msgGetInput(buffer,
- "Please enter any additional UFS newfs options you'd like to\n"
- "use in creating this file system.");
- if (val != NULL)
- strlcpy(p->newfs_data.newfs_ufs.user_options, val,
- NEWFS_CMD_ARGS_MAX);
-}
-
-#define MAX_MOUNT_NAME 9
-
-#define PART_PART_COL 0
-#define PART_MOUNT_COL 10
-#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 3)
-#define PART_NEWFS_COL (PART_SIZE_COL + 8)
-#define PART_OFF 38
-
-#define TOTAL_AVAIL_LINES (10)
-#define PSLICE_SHOWABLE (4)
-
-
-/* stick this all up on the screen */
-static void
-print_label_chunks(void)
-{
- int i, j, srow, prow, pcol;
- daddr_t sz;
- char clrmsg[80];
- int ChunkPartStartRow;
- WINDOW *ChunkWin;
-
- /********************************************************/
- /*** These values are for controling screen resources ***/
- /*** Each label line holds up to 2 labels, so beware! ***/
- /*** strategy will be to try to always make sure the ***/
- /*** highlighted label is in the active display area. ***/
- /********************************************************/
- int pslice_max, label_max;
- int pslice_count, label_count, label_focus_found, pslice_focus_found;
-
- attrset(A_REVERSE);
- mvaddstr(0, 25, "FreeBSD Disklabel Editor");
- attrset(A_NORMAL);
-
- /*** Count the number of parition slices ***/
- pslice_count = 0;
- for (i = 0; label_chunk_info[i].c ; i++) {
- if (label_chunk_info[i].type == PART_SLICE)
- ++pslice_count;
- }
- pslice_max = pslice_count;
-
- /*** 4 line max for partition slices ***/
- if (pslice_max > PSLICE_SHOWABLE) {
- pslice_max = PSLICE_SHOWABLE;
- }
- ChunkPartStartRow = CHUNK_SLICE_START_ROW + 3 + pslice_max;
-
- /*** View partition slices modulo pslice_max ***/
- label_max = TOTAL_AVAIL_LINES - pslice_max;
-
- for (i = 0; i < 2; i++) {
- mvaddstr(ChunkPartStartRow - 2, PART_PART_COL + (i * PART_OFF), "Part");
- mvaddstr(ChunkPartStartRow - 1, PART_PART_COL + (i * PART_OFF), "----");
-
- mvaddstr(ChunkPartStartRow - 2, PART_MOUNT_COL + (i * PART_OFF), "Mount");
- mvaddstr(ChunkPartStartRow - 1, PART_MOUNT_COL + (i * PART_OFF), "-----");
-
- mvaddstr(ChunkPartStartRow - 2, PART_SIZE_COL + (i * PART_OFF) + 3, "Size");
- mvaddstr(ChunkPartStartRow - 1, PART_SIZE_COL + (i * PART_OFF) + 3, "----");
-
- mvaddstr(ChunkPartStartRow - 2, PART_NEWFS_COL + (i * PART_OFF), "Newfs");
- mvaddstr(ChunkPartStartRow - 1, PART_NEWFS_COL + (i * PART_OFF), "-----");
- }
- srow = CHUNK_SLICE_START_ROW;
- prow = 0;
- pcol = 0;
-
- /*** these variables indicate that the focused item is shown currently ***/
- label_focus_found = 0;
- pslice_focus_found = 0;
-
- label_count = 0;
- pslice_count = 0;
- mvprintw(CHUNK_SLICE_START_ROW - 1, 0, " ");
- mvprintw(CHUNK_SLICE_START_ROW + pslice_max, 0, " ");
-
- ChunkWin = newwin(CHUNK_ROW_MAX - ChunkPartStartRow, 76, ChunkPartStartRow, 0);
-
- wclear(ChunkWin);
- /*** wrefresh(ChunkWin); ***/
-
- for (i = 0; label_chunk_info[i].c; i++) {
- /* Is it a slice entry displayed at the top? */
- if (label_chunk_info[i].type == PART_SLICE) {
- /*** This causes the new pslice to replace the previous display ***/
- /*** focus must remain on the most recently active pslice ***/
- if (pslice_count == pslice_max) {
- if (pslice_focus_found) {
- /*** This is where we can mark the more following ***/
- attrset(A_BOLD);
- mvprintw(CHUNK_SLICE_START_ROW + pslice_max, 0, "***MORE***");
- attrset(A_NORMAL);
- continue;
- }
- else {
- /*** this is where we set the more previous ***/
- attrset(A_BOLD);
- mvprintw(CHUNK_SLICE_START_ROW - 1, 0, "***MORE***");
- attrset(A_NORMAL);
- pslice_count = 0;
- srow = CHUNK_SLICE_START_ROW;
- }
- }
-
- sz = space_free(label_chunk_info[i].c);
- if (i == here)
- attrset(ATTR_SELECTED);
- if (i == pslice_focus)
- pslice_focus_found = -1;
-
- if (label_chunk_info[i].c->type == whole) {
- if (sz >= 100 * ONE_GIG)
- mvprintw(srow++, 0,
- "Disk: %s\t\tFree: %jd blocks (%jdGB)",
- label_chunk_info[i].c->disk->name, (intmax_t)sz,
- (intmax_t)(sz / ONE_GIG));
- else
- mvprintw(srow++, 0,
- "Disk: %s\t\tFree: %jd blocks (%jdMB)",
- label_chunk_info[i].c->disk->name, (intmax_t)sz,
- (intmax_t)(sz / ONE_MEG));
- } else {
- if (sz >= 100 * ONE_GIG)
- mvprintw(srow++, 0,
- "Disk: %s\tPartition name: %s\tFree: %jd blocks (%jdGB)",
- label_chunk_info[i].c->disk->name,
- label_chunk_info[i].c->name,
- (intmax_t)sz, (intmax_t)(sz / ONE_GIG));
- else
- mvprintw(srow++, 0,
- "Disk: %s\tPartition name: %s\tFree: %jd blocks (%jdMB)",
- label_chunk_info[i].c->disk->name,
- label_chunk_info[i].c->name,
- (intmax_t)sz, (intmax_t)(sz / ONE_MEG));
- }
- attrset(A_NORMAL);
- clrtoeol();
- move(0, 0);
- /*** refresh(); ***/
- ++pslice_count;
- }
- /* Otherwise it's a DOS, swap or filesystem entry in the Chunk window */
- else {
- char onestr[PART_OFF], num[10], *mountpoint, newfs[12];
-
- /*
- * We copy this into a blank-padded string so that it looks like
- * a solid bar in reverse-video
- */
- memset(onestr, ' ', PART_OFF - 1);
- onestr[PART_OFF - 1] = '\0';
-
- /*** Track how many labels have been displayed ***/
- if (label_count == ((label_max - 1 ) * 2)) {
- if (label_focus_found) {
- continue;
- }
- else {
- label_count = 0;
- prow = 0;
- pcol = 0;
- }
- }
-
- /* Go for two columns if we've written one full columns worth */
- /*** if (prow == (CHUNK_ROW_MAX - ChunkPartStartRow)) ***/
- if (label_count == label_max - 1) {
- pcol = PART_OFF;
- prow = 0;
- }
- memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name, strlen(label_chunk_info[i].c->name));
- /* If it's a filesystem, display the mountpoint */
- if (label_chunk_info[i].c->private_data && (label_chunk_info[i].type == PART_FILESYSTEM
- || label_chunk_info[i].type == PART_FAT || label_chunk_info[i].type == PART_EFI))
- mountpoint = ((PartInfo *)label_chunk_info[i].c->private_data)->mountpoint;
- else if (label_chunk_info[i].type == PART_SWAP)
- mountpoint = "swap";
- else
- mountpoint = "<none>";
-
- /* Now display the newfs field */
- if (label_chunk_info[i].type == PART_FAT)
- strcpy(newfs, "DOS");
-#if defined(__ia64__)
- else if (label_chunk_info[i].type == PART_EFI) {
- strcpy(newfs, "EFI");
- if (label_chunk_info[i].c->private_data) {
- strcat(newfs, " ");
- PartInfo *pi = (PartInfo *)label_chunk_info[i].c->private_data;
- strcat(newfs, pi->do_newfs ? " Y" : " N");
- }
- }
-#endif
- else if (label_chunk_info[i].c->private_data && label_chunk_info[i].type == PART_FILESYSTEM) {
- PartInfo *pi = (PartInfo *)label_chunk_info[i].c->private_data;
-
- switch (pi->newfs_type) {
- case NEWFS_UFS:
- strcpy(newfs, NEWFS_UFS_STRING);
- if (pi->newfs_data.newfs_ufs.ufs1)
- strcat(newfs, "1");
- else
- strcat(newfs, "2");
- if (pi->newfs_data.newfs_ufs.softupdates)
- strcat(newfs, "+S");
- else
- strcat(newfs, " ");
-
- break;
- case NEWFS_MSDOS:
- strcpy(newfs, "FAT");
- break;
- case NEWFS_CUSTOM:
- strcpy(newfs, "CUST");
- break;
- }
- strcat(newfs, pi->do_newfs ? " Y" : " N ");
- }
- else if (label_chunk_info[i].type == PART_SWAP)
- strcpy(newfs, "SWAP");
- else
- strcpy(newfs, "*");
- for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
- onestr[PART_MOUNT_COL + j] = mountpoint[j];
- if (label_chunk_info[i].c->size == 0)
- snprintf(num, 10, "%5dMB", 0);
- else if (label_chunk_info[i].c->size < (100 * ONE_GIG))
- snprintf(num, 10, "%5jdMB",
- (intmax_t)label_chunk_info[i].c->size / ONE_MEG);
- else
- snprintf(num, 10, "%5jdGB",
- (intmax_t)label_chunk_info[i].c->size / ONE_GIG);
- memcpy(onestr + PART_SIZE_COL, num, strlen(num));
- memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs));
- onestr[PART_NEWFS_COL + strlen(newfs)] = '\0';
- if (i == label_focus) {
- label_focus_found = -1;
- wattrset(ChunkWin, A_BOLD);
- }
- if (i == here)
- wattrset(ChunkWin, ATTR_SELECTED);
-
- /*** lazy man's way of expensively padding this string ***/
- while (strlen(onestr) < 37)
- strcat(onestr, " ");
-
- mvwaddstr(ChunkWin, prow, pcol, onestr);
- wattrset(ChunkWin, A_NORMAL);
- move(0, 0);
- ++prow;
- ++label_count;
- }
- }
-
- /*** this will erase all the extra stuff ***/
- memset(clrmsg, ' ', 37);
- clrmsg[37] = '\0';
-
- while (pslice_count < pslice_max) {
- mvprintw(srow++, 0, clrmsg);
- clrtoeol();
- ++pslice_count;
- }
- while (label_count < (2 * (label_max - 1))) {
- mvwaddstr(ChunkWin, prow++, pcol, clrmsg);
- ++label_count;
- if (prow == (label_max - 1)) {
- prow = 0;
- pcol = PART_OFF;
- }
- }
- refresh();
- wrefresh(ChunkWin);
-}
-
-static void
-print_command_summary(void)
-{
- mvprintw(17, 0, "The following commands are valid here (upper or lower case):");
- mvprintw(18, 0, "C = Create D = Delete M = Mount pt.");
- if (!RunningAsInit)
- mvprintw(18, 56, "W = Write");
- mvprintw(19, 0, "N = Newfs Opts Q = Finish S = Toggle SoftUpdates Z = Custom Newfs");
- mvprintw(20, 0, "T = Toggle Newfs U = Undo A = Auto Defaults R = Delete+Merge");
- mvprintw(22, 0, "Use F1 or ? to get more help, arrow keys to select.");
- move(0, 0);
-}
-
-static void
-clear_wins(void)
-{
- extern void print_label_chunks();
- clear();
- print_label_chunks();
-}
-
-static int
-diskLabel(Device *dev)
-{
- daddr_t sz;
- int key = 0;
- Boolean labeling;
- char *msg = NULL;
- PartInfo *p, *oldp;
- PartType type;
- Device **devs;
- WINDOW *w = savescr();
-
- label_focus = 0;
- pslice_focus = 0;
- here = 0;
-
- devs = deviceFind(NULL, DEVICE_TYPE_DISK);
- if (!devs) {
- msgConfirm("No disks found!");
- restorescr(w);
- return DITEM_FAILURE;
- }
- labeling = TRUE;
- keypad(stdscr, TRUE);
- record_label_chunks(devs, dev);
-
- clear();
- while (labeling) {
- char *cp;
- int rflags = DELCHUNK_NORMAL;
-
- print_label_chunks();
- print_command_summary();
- if (msg) {
- attrset(title_attr); mvprintw(23, 0, msg); attrset(A_NORMAL);
- clrtoeol();
- beep();
- msg = NULL;
- }
- else {
- move(23, 0);
- clrtoeol();
- }
-
- refresh();
- key = getch();
- switch (toupper(key)) {
- int i;
- static char _msg[40];
-
- case '\014': /* ^L */
- clear_wins();
- break;
-
- case '\020': /* ^P */
- case KEY_UP:
- case '-':
- if (here != 0)
- --here;
- else
- while (label_chunk_info[here + 1].c)
- ++here;
- break;
-
- case '\016': /* ^N */
- case KEY_DOWN:
- case '+':
- case '\r':
- case '\n':
- if (label_chunk_info[here + 1].c)
- ++here;
- else
- here = 0;
- break;
-
- case KEY_HOME:
- here = 0;
- break;
-
- case KEY_END:
- while (label_chunk_info[here + 1].c)
- ++here;
- break;
-
- case KEY_F(1):
- case '?':
- systemDisplayHelp("partition");
- clear_wins();
- break;
-
- case '1':
- if (label_chunk_info[here].type == PART_FILESYSTEM) {
- PartInfo *pi =
- ((PartInfo *)label_chunk_info[here].c->private_data);
-
- if ((pi != NULL) &&
- (pi->newfs_type == NEWFS_UFS)) {
- pi->newfs_data.newfs_ufs.ufs1 = true;
- } else
- msg = MSG_NOT_APPLICABLE;
- } else
- msg = MSG_NOT_APPLICABLE;
- break;
- break;
-
- case '2':
- if (label_chunk_info[here].type == PART_FILESYSTEM) {
- PartInfo *pi =
- ((PartInfo *)label_chunk_info[here].c->private_data);
-
- if ((pi != NULL) &&
- (pi->newfs_type == NEWFS_UFS)) {
- pi->newfs_data.newfs_ufs.ufs1 = false;
- } else
- msg = MSG_NOT_APPLICABLE;
- } else
- msg = MSG_NOT_APPLICABLE;
- break;
- break;
-
- case 'A':
- if (label_chunk_info[here].type != PART_SLICE) {
- msg = "You can only do this in a disk slice (at top of screen)";
- break;
- }
- /*
- * Generate standard partitions automatically. If we do not
- * have sufficient space we attempt to scale-down the size
- * of the partitions within certain bounds.
- */
- {
- int perc;
- int req = 0;
-
- for (perc = 100; perc > 0; perc -= 5) {
- req = 0; /* reset for each loop */
- if ((msg = try_auto_label(devs, dev, perc, &req)) == NULL)
- break;
- }
- if (msg) {
- if (req) {
- msgConfirm(msg);
- clear_wins();
- msg = NULL;
- }
- }
- }
- break;
-
- case 'C':
- if (label_chunk_info[here].type != PART_SLICE) {
- msg = "You can only do this in a master partition (see top of screen)";
- break;
- }
- sz = space_free(label_chunk_info[here].c);
- if (sz <= FS_MIN_SIZE) {
- msg = "Not enough space to create an additional FreeBSD partition";
- break;
- }
- else {
- char *val;
- daddr_t size;
- struct chunk *tmp;
- char osize[80];
- u_long flags = 0;
-
-#ifdef __powerpc__
- /* Always use the maximum size for apple partitions */
- if (label_chunk_info[here].c->type == apple)
- size = sz;
- else {
-#endif
- sprintf(osize, "%jd", (intmax_t)sz);
- val = msgGetInput(osize,
- "Please specify the partition size in blocks or append a trailing G for\n"
-#ifdef __ia64__
- "gigabytes, M for megabytes.\n"
-#else
- "gigabytes, M for megabytes, or C for cylinders.\n"
-#endif
- "%jd blocks (%jdMB) are free.",
- (intmax_t)sz, (intmax_t)sz / ONE_MEG);
- if (!val || (size = strtoimax(val, &cp, 0)) <= 0) {
- clear_wins();
- break;
- }
-
- if (*cp) {
- if (toupper(*cp) == 'M')
- size *= ONE_MEG;
- else if (toupper(*cp) == 'G')
- size *= ONE_GIG;
-#ifndef __ia64__
- else if (toupper(*cp) == 'C')
- size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect);
-#endif
- }
- if (size <= FS_MIN_SIZE) {
- msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
- clear_wins();
- break;
- }
-#ifdef __powerpc__
- }
-#endif
- type = get_partition_type();
- if (type == PART_NONE) {
- clear_wins();
- beep();
- break;
- }
-
- if (type == PART_FILESYSTEM || type == PART_EFI) {
- if ((p = get_mountpoint(type, NULL)) == NULL) {
- clear_wins();
- beep();
- break;
- }
- else if (!strcmp(p->mountpoint, "/")) {
- if (type != PART_FILESYSTEM) {
- clear_wins();
- beep();
- break;
- }
- else
- flags |= CHUNK_IS_ROOT;
- }
- else
- flags &= ~CHUNK_IS_ROOT;
- }
- else
- p = NULL;
-
- if ((flags & CHUNK_IS_ROOT) && (size < (ROOT_MIN_SIZE * ONE_MEG))) {
- msgConfirm("Warning: This is smaller than the recommended size for a\n"
- "root partition. For a variety of reasons, root\n"
- "partitions should usually be at least %dMB in size", ROOT_MIN_SIZE);
- }
- tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c, size,
-#ifdef __ia64__
- (type == PART_EFI) ? efi : part,
- (type == PART_EFI) ? 0 : (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS,
-#else
- part, (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS,
-#endif
- flags);
- if (!tmp) {
- msgConfirm("Unable to create the partition. Too big?");
- clear_wins();
- break;
- }
-
-#ifdef __alpha__
- /*
- * SRM requires that the root partition is at the
- * begining of the disk and cannot boot otherwise.
- * Warn Alpha users if they are about to shoot themselves in
- * the foot in this way.
- *
- * Since partitions may not start precisely at offset 0 we
- * check for a "close to 0" instead. :-(
- */
- if ((flags & CHUNK_IS_ROOT) && (tmp->offset > 1024)) {
- msgConfirm("Your root partition `a' does not seem to be the first\n"
- "partition. The Alpha's firmware can only boot from the\n"
- "first partition. So it is unlikely that your current\n"
- "disk layout will be bootable boot after installation.\n"
- "\n"
- "Please allocate the root partition before allocating\n"
- "any others.\n");
- }
-#endif /* alpha */
-
- tmp->private_data = p;
- tmp->private_free = safe_free;
- if (variable_cmp(DISK_LABELLED, "written"))
- variable_set2(DISK_LABELLED, "yes", 0);
- record_label_chunks(devs, dev);
- clear_wins();
- /* This is where we assign focus to new label so it shows. */
- {
- int i;
- label_focus = -1;
- for (i = 0; label_chunk_info[i].c; ++i) {
- if (label_chunk_info[i].c == tmp) {
- label_focus = i;
- break;
- }
- }
- if (label_focus == -1)
- label_focus = i - 1;
- }
- }
- break;
-
- case KEY_DC:
- case 'R': /* recover space (delete w/ recover) */
- /*
- * Delete the partition w/ space recovery.
- */
- rflags = DELCHUNK_RECOVER;
- /* fall through */
- case 'D': /* delete */
- if (label_chunk_info[here].type == PART_SLICE) {
- msg = MSG_NOT_APPLICABLE;
- break;
- }
- else if (label_chunk_info[here].type == PART_FAT) {
- msg = "Use the Disk Partition Editor to delete DOS partitions";
- break;
- }
- Delete_Chunk2(label_chunk_info[here].c->disk, label_chunk_info[here].c, rflags);
- if (variable_cmp(DISK_LABELLED, "written"))
- variable_set2(DISK_LABELLED, "yes", 0);
- record_label_chunks(devs, dev);
- break;
-
- case 'M': /* mount */
- switch(label_chunk_info[here].type) {
- case PART_SLICE:
- msg = MSG_NOT_APPLICABLE;
- break;
-
- case PART_SWAP:
- msg = "You don't need to specify a mountpoint for a swap partition.";
- break;
-
- case PART_FAT:
- case PART_EFI:
- case PART_FILESYSTEM:
- oldp = label_chunk_info[here].c->private_data;
- p = get_mountpoint(label_chunk_info[here].type, label_chunk_info[here].c);
- if (p) {
- if (!oldp)
- p->do_newfs = FALSE;
- if ((label_chunk_info[here].type == PART_FAT ||
- label_chunk_info[here].type == PART_EFI) &&
- (!strcmp(p->mountpoint, "/") ||
- !strcmp(p->mountpoint, "/usr") ||
- !strcmp(p->mountpoint, "/var"))) {
- msgConfirm("%s is an invalid mount point for a DOS partition!", p->mountpoint);
- strcpy(p->mountpoint, "/bogus");
- }
- }
- if (variable_cmp(DISK_LABELLED, "written"))
- variable_set2(DISK_LABELLED, "yes", 0);
- record_label_chunks(devs, dev);
- clear_wins();
- break;
-
- default:
- msgFatal("Bogus partition under cursor???");
- break;
- }
- break;
-
- case 'N': /* Set newfs options */
- if (label_chunk_info[here].c->private_data &&
- ((PartInfo *)label_chunk_info[here].c->private_data)->do_newfs)
- getNewfsOptionalArguments(
- label_chunk_info[here].c->private_data);
- else
- msg = MSG_NOT_APPLICABLE;
- clear_wins();
- break;
-
- case 'S': /* Toggle soft updates flag */
- if (label_chunk_info[here].type == PART_FILESYSTEM) {
- PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private_data);
- if (pi != NULL &&
- pi->newfs_type == NEWFS_UFS)
- pi->newfs_data.newfs_ufs.softupdates =
- !pi->newfs_data.newfs_ufs.softupdates;
- else
- msg = MSG_NOT_APPLICABLE;
- }
- else
- msg = MSG_NOT_APPLICABLE;
- break;
-
- case 'T': /* Toggle newfs state */
- if ((label_chunk_info[here].type == PART_FILESYSTEM ||
- label_chunk_info[here].type == PART_EFI) &&
- (label_chunk_info[here].c->private_data)) {
- PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private_data);
- if (!pi->do_newfs)
- label_chunk_info[here].c->flags |= CHUNK_NEWFS;
- else
- label_chunk_info[here].c->flags &= ~CHUNK_NEWFS;
-
- label_chunk_info[here].c->private_data =
- new_part(label_chunk_info[here].type, pi ? pi->mountpoint : NULL, pi ? !pi->do_newfs
- : TRUE);
- if (pi != NULL &&
- pi->newfs_type == NEWFS_UFS) {
- PartInfo *pi_new = label_chunk_info[here].c->private_data;
-
- pi_new->newfs_data.newfs_ufs = pi->newfs_data.newfs_ufs;
- }
- safe_free(pi);
- label_chunk_info[here].c->private_free = safe_free;
- if (variable_cmp(DISK_LABELLED, "written"))
- variable_set2(DISK_LABELLED, "yes", 0);
- }
- else
- msg = MSG_NOT_APPLICABLE;
- break;
-
- case 'U':
- clear();
- if (!variable_cmp(DISK_LABELLED, "written")) {
- msgConfirm("You've already written out your changes -\n"
- "it's too late to undo!");
- }
- else if (!msgNoYes("Are you SURE you want to Undo everything?")) {
- variable_unset(DISK_PARTITIONED);
- variable_unset(DISK_LABELLED);
- for (i = 0; devs[i]; i++) {
- Disk *d;
-
- if (!devs[i]->enabled)
- continue;
- else if ((d = Open_Disk(devs[i]->name)) != NULL) {
- Free_Disk(devs[i]->private);
- devs[i]->private = d;
-#ifdef WITH_SLICES
- diskPartition(devs[i]);
-#endif
- }
- }
- record_label_chunks(devs, dev);
- }
- clear_wins();
- break;
-
- case 'W':
- if (!variable_cmp(DISK_LABELLED, "written")) {
- msgConfirm("You've already written out your changes - if you\n"
- "wish to overwrite them, you'll have to restart\n"
- "sysinstall first.");
- }
- else if (!msgNoYes("WARNING: This should only be used when modifying an EXISTING\n"
- "installation. If you are installing FreeBSD for the first time\n"
- "then you should simply type Q when you're finished here and your\n"
- "changes will be committed in one batch automatically at the end of\n"
- "these questions.\n\n"
- "Are you absolutely sure you want to do this now?")) {
- variable_set2(DISK_LABELLED, "yes", 0);
- diskLabelCommit(NULL);
- }
- clear_wins();
- break;
-
- case 'Z': /* Set newfs command line */
- if (label_chunk_info[here].c->private_data &&
- ((PartInfo *)label_chunk_info[here].c->private_data)->do_newfs)
- getNewfsCmd(label_chunk_info[here].c->private_data);
- else
- msg = MSG_NOT_APPLICABLE;
- clear_wins();
- break;
-
-#ifndef __ia64__
- case '|':
- if (!msgNoYes("Are you sure you want to go into Wizard mode?\n\n"
- "This is an entirely undocumented feature which you are not\n"
- "expected to understand!")) {
- int i;
- Device **devs;
-
- dialog_clear();
- end_dialog();
- DialogActive = FALSE;
- devs = deviceFind(NULL, DEVICE_TYPE_DISK);
- if (!devs) {
- msgConfirm("Can't find any disk devices!");
- break;
- }
- for (i = 0; devs[i] && ((Disk *)devs[i]->private); i++) {
- if (devs[i]->enabled)
- slice_wizard(((Disk *)devs[i]->private));
- }
- if (variable_cmp(DISK_LABELLED, "written"))
- variable_set2(DISK_LABELLED, "yes", 0);
- DialogActive = TRUE;
- record_label_chunks(devs, dev);
- clear_wins();
- }
- else
- msg = "A most prudent choice!";
- break;
-#endif
-
- case '\033': /* ESC */
- case 'Q':
- labeling = FALSE;
- break;
-
- default:
- beep();
- sprintf(_msg, "Invalid key %d - Type F1 or ? for help", key);
- msg = _msg;
- break;
- }
- if (label_chunk_info[here].type == PART_SLICE)
- pslice_focus = here;
- else
- label_focus = here;
- }
- restorescr(w);
- return DITEM_SUCCESS;
-}
-
-static __inline daddr_t
-requested_part_size(char *varName, daddr_t nom, int def, int perc)
-{
- char *cp;
- daddr_t sz;
-
- if ((cp = variable_get(varName)) != NULL)
- sz = strtoimax(cp, NULL, 0);
- else
- sz = nom + (def - nom) * perc / 100;
- return(sz * ONE_MEG);
-}
-
-/*
- * Attempt to auto-label the disk. 'perc' (0-100) scales
- * the size of the various partitions within appropriate
- * bounds (NOMINAL through DEFAULT sizes). The procedure
- * succeeds of NULL is returned. A non-null return message
- * is either a failure-status message (*req == 0), or
- * a confirmation requestor (*req == 1). *req is 0 on
- * entry to this call.
- *
- * We autolabel the following partitions: /, swap, /var, /tmp, /usr,
- * and /home. /home receives any extra left over disk space.
- */
-static char *
-try_auto_label(Device **devs, Device *dev, int perc, int *req)
-{
- daddr_t sz;
- Chunk *AutoHome, *AutoRoot, *AutoSwap;
- Chunk *AutoTmp, *AutoUsr, *AutoVar;
-#ifdef __ia64__
- Chunk *AutoEfi;
-#endif
- int mib[2];
- unsigned long physmem;
- size_t size;
- char *msg = NULL;
-
- sz = space_free(label_chunk_info[here].c);
- if (sz <= FS_MIN_SIZE)
- return("Not enough free space to create a new partition in the slice");
-
- (void)checkLabels(FALSE);
- AutoHome = AutoRoot = AutoSwap = NULL;
- AutoTmp = AutoUsr = AutoVar = NULL;
-
-#ifdef __ia64__
- AutoEfi = NULL;
- if (EfiChunk == NULL) {
- sz = 100 * ONE_MEG;
- AutoEfi = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c, sz, efi, 0, 0);
- if (AutoEfi == NULL) {
- *req = 1;
- msg = "Unable to create the EFI system partition. Too big?";
- goto done;
- }
- AutoEfi->private_data = new_part(PART_EFI, "/efi", TRUE);
- AutoEfi->private_free = safe_free;
- AutoEfi->flags |= CHUNK_NEWFS;
- record_label_chunks(devs, dev);
- }
-#endif
-
- if (RootChunk == NULL) {
- sz = requested_part_size(VAR_ROOT_SIZE, ROOT_NOMINAL_SIZE, ROOT_DEFAULT_SIZE, perc);
-
- AutoRoot = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c, sz, part,
- FS_BSDFFS, CHUNK_IS_ROOT | CHUNK_AUTO_SIZE);
- if (!AutoRoot) {
- *req = 1;
- msg = "Unable to create the root partition. Too big?";
- goto done;
- }
- AutoRoot->private_data = new_part(PART_FILESYSTEM, "/", TRUE);
- AutoRoot->private_free = safe_free;
- AutoRoot->flags |= CHUNK_NEWFS;
- record_label_chunks(devs, dev);
- }
- if (SwapChunk == NULL) {
- sz = requested_part_size(VAR_SWAP_SIZE, 0, 0, perc);
- if (sz == 0) {
- daddr_t nom;
- daddr_t def;
-
- mib[0] = CTL_HW;
- mib[1] = HW_PHYSMEM;
- size = sizeof physmem;
- sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
- def = 2 * (int)(physmem / 512);
- if (def < SWAP_MIN_SIZE * ONE_MEG)
- def = SWAP_MIN_SIZE * ONE_MEG;
- if (def > SWAP_AUTO_LIMIT_SIZE * ONE_MEG)
- def = SWAP_AUTO_LIMIT_SIZE * ONE_MEG;
- nom = (int)(physmem / 512) / 8;
- sz = nom + (def - nom) * perc / 100;
- }
- AutoSwap = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c, sz, part,
- FS_SWAP, CHUNK_AUTO_SIZE);
- if (!AutoSwap) {
- *req = 1;
- msg = "Unable to create the swap partition. Too big?";
- goto done;
- }
- AutoSwap->private_data = 0;
- AutoSwap->private_free = safe_free;
- record_label_chunks(devs, dev);
- }
- if (VarChunk == NULL) {
- sz = requested_part_size(VAR_VAR_SIZE, VAR_NOMINAL_SIZE, VAR_DEFAULT_SIZE, perc);
-
- AutoVar = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c, sz, part,
- FS_BSDFFS, CHUNK_AUTO_SIZE);
- if (!AutoVar) {
- *req = 1;
- msg = "Not enough free space for /var - you will need to\n"
- "partition your disk manually with a custom install!";
- goto done;
- }
- AutoVar->private_data = new_part(PART_FILESYSTEM, "/var", TRUE);
- AutoVar->private_free = safe_free;
- AutoVar->flags |= CHUNK_NEWFS;
- record_label_chunks(devs, dev);
- }
- if (TmpChunk == NULL && !variable_get(VAR_NO_TMP)) {
- sz = requested_part_size(VAR_TMP_SIZE, TMP_NOMINAL_SIZE, TMP_DEFAULT_SIZE, perc);
-
- AutoTmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c, sz, part,
- FS_BSDFFS, CHUNK_AUTO_SIZE);
- if (!AutoTmp) {
- *req = 1;
- msg = "Not enough free space for /tmp - you will need to\n"
- "partition your disk manually with a custom install!";
- goto done;
- }
- AutoTmp->private_data = new_part(PART_FILESYSTEM, "/tmp", TRUE);
- AutoTmp->private_free = safe_free;
- AutoTmp->flags |= CHUNK_NEWFS;
- record_label_chunks(devs, dev);
- }
- if (UsrChunk == NULL && !variable_get(VAR_NO_USR)) {
- sz = requested_part_size(VAR_USR_SIZE, USR_NOMINAL_SIZE, USR_DEFAULT_SIZE, perc);
-#if AUTO_HOME == 0
- sz = space_free(label_chunk_info[here].c);
-#endif
- if (sz) {
- if (sz < (USR_MIN_SIZE * ONE_MEG)) {
- *req = 1;
- msg = "Not enough free space for /usr - you will need to\n"
- "partition your disk manually with a custom install!";
- }
-
- AutoUsr = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c, sz, part,
- FS_BSDFFS, CHUNK_AUTO_SIZE);
- if (!AutoUsr) {
- msg = "Unable to create the /usr partition. Not enough space?\n"
- "You will need to partition your disk manually with a custom install!";
- goto done;
- }
- AutoUsr->private_data = new_part(PART_FILESYSTEM, "/usr", TRUE);
- AutoUsr->private_free = safe_free;
- AutoUsr->flags |= CHUNK_NEWFS;
- record_label_chunks(devs, dev);
- }
- }
-#if AUTO_HOME == 1
- if (HomeChunk == NULL && !variable_get(VAR_NO_HOME)) {
- sz = requested_part_size(VAR_HOME_SIZE, HOME_NOMINAL_SIZE, HOME_DEFAULT_SIZE, perc);
- if (sz < space_free(label_chunk_info[here].c))
- sz = space_free(label_chunk_info[here].c);
- if (sz) {
- if (sz < (HOME_MIN_SIZE * ONE_MEG)) {
- *req = 1;
- msg = "Not enough free space for /home - you will need to\n"
- "partition your disk manually with a custom install!";
- goto done;
- }
-
- AutoHome = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
- label_chunk_info[here].c, sz, part,
- FS_BSDFFS, CHUNK_AUTO_SIZE);
- if (!AutoHome) {
- msg = "Unable to create the /home partition. Not enough space?\n"
- "You will need to partition your disk manually with a custom install!";
- goto done;
- }
- AutoHome->private_data = new_part(PART_FILESYSTEM, "/home", TRUE);
- AutoHome->private_free = safe_free;
- AutoHome->flags |= CHUNK_NEWFS;
- record_label_chunks(devs, dev);
- }
- }
-#endif
-
- /* At this point, we're reasonably "labelled" */
- if (variable_cmp(DISK_LABELLED, "written"))
- variable_set2(DISK_LABELLED, "yes", 0);
-
-done:
- if (msg) {
- if (AutoRoot != NULL)
- Delete_Chunk(AutoRoot->disk, AutoRoot);
- if (AutoSwap != NULL)
- Delete_Chunk(AutoSwap->disk, AutoSwap);
- if (AutoVar != NULL)
- Delete_Chunk(AutoVar->disk, AutoVar);
- if (AutoTmp != NULL)
- Delete_Chunk(AutoTmp->disk, AutoTmp);
- if (AutoUsr != NULL)
- Delete_Chunk(AutoUsr->disk, AutoUsr);
- if (AutoHome != NULL)
- Delete_Chunk(AutoHome->disk, AutoHome);
- record_label_chunks(devs, dev);
- }
- return(msg);
-}
-
-static int
-diskLabelNonInteractive(Device *dev)
-{
- char *cp;
- PartType type;
- PartInfo *p;
- u_long flags;
- int i, status;
- Device **devs;
- Disk *d;
-
- status = DITEM_SUCCESS;
- cp = variable_get(VAR_DISK);
- if (!cp) {
- msgConfirm("diskLabel: No disk selected - can't label automatically.");
- return DITEM_FAILURE;
- }
- devs = deviceFind(cp, DEVICE_TYPE_DISK);
- if (!devs) {
- msgConfirm("diskLabel: No disk device %s found!", cp);
- return DITEM_FAILURE;
- }
- if (dev)
- d = dev->private;
- else
- d = devs[0]->private;
- record_label_chunks(devs, dev);
- for (i = 0; label_chunk_info[i].c; i++) {
- Chunk *c1 = label_chunk_info[i].c;
-
- if (label_chunk_info[i].type == PART_SLICE) {
- char name[512];
- char typ[10], mpoint[50];
- int entries;
-
- for (entries = 1;; entries++) {
- intmax_t sz;
- int soft = 0;
- snprintf(name, sizeof name, "%s-%d", c1->name, entries);
- if ((cp = variable_get(name)) == NULL)
- break;
- if (sscanf(cp, "%s %jd %s %d", typ, &sz, mpoint, &soft) < 3) {
- msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp);
- status = DITEM_FAILURE;
- break;
- } else {
- Chunk *tmp;
-
- flags = 0;
- if (!strcmp(typ, "swap")) {
- type = PART_SWAP;
- strcpy(mpoint, "SWAP");
- } else {
- type = PART_FILESYSTEM;
- if (!strcmp(mpoint, "/"))
- flags |= CHUNK_IS_ROOT;
- }
- if (!sz)
- sz = space_free(c1);
- if (sz > space_free(c1)) {
- msgConfirm("Not enough free space to create partition: %s", mpoint);
- status = DITEM_FAILURE;
- break;
- }
- if (!(tmp = Create_Chunk_DWIM(d, c1, sz, part,
- (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, flags))) {
- msgConfirm("Unable to create from partition spec: %s. Too big?", cp);
- status = DITEM_FAILURE;
- break;
- } else {
- PartInfo *pi;
- pi = tmp->private_data = new_part(PART_FILESYSTEM, mpoint, TRUE);
- tmp->private_free = safe_free;
- pi->newfs_data.newfs_ufs.softupdates = soft;
- }
- }
- }
- } else {
- /* Must be something we can set a mountpoint for */
- cp = variable_get(c1->name);
- if (cp) {
- char mpoint[50], do_newfs[8];
- Boolean newfs = FALSE;
-
- do_newfs[0] = '\0';
- if (sscanf(cp, "%s %s", mpoint, do_newfs) != 2) {
- msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp);
- status = DITEM_FAILURE;
- break;
- }
- newfs = toupper(do_newfs[0]) == 'Y' ? TRUE : FALSE;
- if (c1->private_data) {
- p = c1->private_data;
- p->do_newfs = newfs;
- strcpy(p->mountpoint, mpoint);
- }
- else {
- c1->private_data = new_part(PART_FILESYSTEM, mpoint, newfs);
- c1->private_free = safe_free;
- }
- if (!strcmp(mpoint, "/"))
- c1->flags |= CHUNK_IS_ROOT;
- else
- c1->flags &= ~CHUNK_IS_ROOT;
- }
- }
- }
- if (status == DITEM_SUCCESS)
- variable_set2(DISK_LABELLED, "yes", 0);
- return status;
-}
diff --git a/usr.sbin/sade/list.h b/usr.sbin/sade/list.h
deleted file mode 100644
index 8300173..0000000
--- a/usr.sbin/sade/list.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last attempt in the `sysinstall' line, the next
- * generation being slated for what's essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1997 FreeBSD, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PAUL TRAINA ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL PAUL TRAINA OR HIS KILLER RATS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 structure */
-typedef struct _qelement {
- struct _qelement *q_forw;
- struct _qelement *q_back;
-} qelement;
-
-#define INITQUE(Xhead) { \
- (Xhead).q_forw = &(Xhead); \
- (Xhead).q_back = &(Xhead); \
-}
-
-#define EMPTYQUE(Xhead) \
- ((Xhead).q_forw == &(Xhead))
-
-#define INSQUEUE(elem, pred) { \
- register qelement *Xe = (qelement *) (elem); \
- register qelement *Xp = (qelement *) (pred); \
- Xp->q_forw = (Xe->q_forw = (Xe->q_back = Xp)->q_forw)->q_back = Xe; \
-}
-
-#define REMQUE(elem) { \
- register qelement *Xe = (qelement *) (elem); \
- (Xe->q_back->q_forw = Xe->q_forw)->q_back = Xe->q_back; \
-}
diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c
deleted file mode 100644
index 695754b..0000000
--- a/usr.sbin/sade/main.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last attempt in the `sysinstall' line, the next
- * generation being slated for what's essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <sys/signal.h>
-#include <sys/fcntl.h>
-
-const char *StartName; /* Initial contents of argv[0] */
-
-static void
-screech(int sig)
-{
- msgDebug("\007Signal %d caught! That's bad!\n", sig);
- longjmp(BailOut, sig);
-}
-
-int
-main(int argc, char **argv)
-{
- int choice, scroll, curr, max, status;
-
- /* Record name to be able to restart */
- StartName = argv[0];
-
- /* Catch fatal signals and complain about them if running as init */
- if (getpid() == 1) {
- signal(SIGBUS, screech);
- signal(SIGSEGV, screech);
- }
- signal(SIGPIPE, SIG_IGN);
-
- /* We don't work too well when running as non-root anymore */
- if (geteuid() != 0) {
- fprintf(stderr, "Error: This utility should only be run as root.\n");
- return 1;
- }
-
-#ifdef PC98
- {
- /* XXX */
- char *p = getenv("TERM");
- if (p && strcmp(p, "cons25") == 0)
- putenv("TERM=cons25w");
- }
-#endif
-
- /* Set up whatever things need setting up */
- systemInitialize(argc, argv);
-
- /* Set default flag and variable values */
- installVarDefaults(NULL);
- /* only when multi-user is it reasonable to do this here */
- if (!RunningAsInit)
- installEnvironment();
-
- if (argc > 1 && !strcmp(argv[1], "-fake")) {
- variable_set2(VAR_DEBUG, "YES", 0);
- Fake = TRUE;
- msgConfirm("I'll be just faking it from here on out, OK?");
- }
- if (argc > 1 && !strcmp(argv[1], "-restart"))
- Restarting = TRUE;
-
- /* Try to preserve our scroll-back buffer */
- if (OnVTY) {
- for (curr = 0; curr < 25; curr++)
- putchar('\n');
- }
- /* Move stderr aside */
- if (DebugFD)
- dup2(DebugFD, 2);
-
- /* Initialize driver modules, if we haven't already done so (ie,
- the user hit Ctrl-C -> Restart. */
- if (!pvariable_get("modulesInitialize")) {
- moduleInitialize();
- pvariable_set("modulesInitialize=1");
- }
-
- /* Initialize PC Card, if we haven't already done so. */
-#ifdef PCCARD_ARCH
- if (!variable_cmp(VAR_SKIP_PCCARD, "YES") &&
- variable_get(VAR_SKIP_PCCARD)!=1 &&
- !pvariable_get("pccardInitialize")) {
- pccardInitialize();
- pvariable_set("pccardInitialize=1");
- }
-#endif
-
- /* Initialize USB, if we haven't already done so. */
- if (!pvariable_get("usbInitialize")) {
- usbInitialize();
- pvariable_set("usbInitialize=1");
- }
-
- /* Probe for all relevant devices on the system */
- deviceGetAll();
-
- /* Prompt for the driver floppy if appropriate. */
- if (!pvariable_get("driverFloppyCheck")) {
- driverFloppyCheck();
- pvariable_set("driverFloppyCheck=1");
- }
-
- /* First, see if we have any arguments to process (and argv[0] counts if it's not "sysinstall") */
- if (!RunningAsInit) {
- int i, start_arg;
-
- if (!strstr(argv[0], "sysinstall"))
- start_arg = 0;
- else if (Fake || Restarting)
- start_arg = 2;
- else
- start_arg = 1;
- for (i = start_arg; i < argc; i++) {
- if (DITEM_STATUS(dispatchCommand(argv[i])) != DITEM_SUCCESS)
- systemShutdown(1);
- }
- if (argc > start_arg)
- systemShutdown(0);
- }
- else
- dispatch_load_file_int(TRUE);
-
- status = setjmp(BailOut);
- if (status) {
- msgConfirm("A signal %d was caught - I'm saving what I can and shutting\n"
- "down. If you can reproduce the problem, please turn Debug on\n"
- "in the Options menu for the extra information it provides\n"
- "in debugging problems like this.", status);
- systemShutdown(status);
- }
-
- /* Begin user dialog at outer menu */
- dialog_clear();
- while (1) {
- choice = scroll = curr = max = 0;
- dmenuOpen(&MenuInitial, &choice, &scroll, &curr, &max, TRUE);
- if (getpid() != 1
-#if defined(__alpha__) || defined(__sparc64__)
- || !msgNoYes("Are you sure you wish to exit? The system will halt.")
-#else
- || !msgNoYes("Are you sure you wish to exit? The system will reboot\n"
- "(be sure to remove any floppies/CDs/DVDs from the drives).")
-#endif
- )
- break;
- }
-
- /* Say goodnight, Gracie */
- systemShutdown(0);
-
- return 0; /* We should never get here */
-}
diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c
deleted file mode 100644
index 1bfad63..0000000
--- a/usr.sbin/sade/menus.c
+++ /dev/null
@@ -1,2290 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif
-
-#include "sysinstall.h"
-
-/* Miscellaneous work routines for menus */
-static int
-setSrc(dialogMenuItem *self)
-{
- Dists |= DIST_SRC;
- SrcDists = DIST_SRC_ALL;
- return DITEM_SUCCESS | DITEM_REDRAW;
-}
-
-static int
-clearSrc(dialogMenuItem *self)
-{
- Dists &= ~DIST_SRC;
- SrcDists = 0;
- return DITEM_SUCCESS | DITEM_REDRAW;
-}
-
-static int
-setX11Misc(dialogMenuItem *self)
-{
- XOrgDists |= DIST_XORG_MISC_ALL;
- Dists |= DIST_XORG;
- return DITEM_SUCCESS | DITEM_REDRAW;
-}
-
-static int
-clearX11Misc(dialogMenuItem *self)
-{
- XOrgDists &= ~DIST_XORG_MISC_ALL;
- if (!XOrgDists)
- Dists &= ~DIST_XORG;
- return DITEM_SUCCESS | DITEM_REDRAW;
-}
-
-static int
-setX11Servers(dialogMenuItem *self)
-{
- XOrgDists |= DIST_XORG_SERVER_ALL;
- return DITEM_SUCCESS | DITEM_REDRAW;
-}
-
-static int
-clearX11Servers(dialogMenuItem *self)
-{
- XOrgDists &= ~DIST_XORG_SERVER_ALL;
- if (!XOrgDists)
- Dists &= ~DIST_XORG;
- return DITEM_SUCCESS | DITEM_REDRAW;
-}
-
-static int
-setX11Fonts(dialogMenuItem *self)
-{
- XOrgDists |= DIST_XORG_FONTS_ALL;
- return DITEM_SUCCESS | DITEM_REDRAW;
-}
-
-static int
-clearX11Fonts(dialogMenuItem *self)
-{
- XOrgDists &= ~DIST_XORG_FONTS_ALL;
- if (!XOrgDists)
- Dists &= ~DIST_XORG;
- return DITEM_SUCCESS | DITEM_REDRAW;
-}
-
-#define _IS_SET(dist, set) (((dist) & (set)) == (set))
-
-#define IS_DEVELOPER(dist, extra) (_IS_SET(dist, _DIST_DEVELOPER | extra) || \
- _IS_SET(dist, _DIST_DEVELOPER | extra))
-
-#define IS_USER(dist, extra) (_IS_SET(dist, _DIST_USER | extra) || \
- _IS_SET(dist, _DIST_USER | extra))
-
-static int
-checkDistDeveloper(dialogMenuItem *self)
-{
- return IS_DEVELOPER(Dists, 0) && _IS_SET(SrcDists, DIST_SRC_ALL);
-}
-
-static int
-checkDistXDeveloper(dialogMenuItem *self)
-{
- return IS_DEVELOPER(Dists, DIST_XORG) && _IS_SET(SrcDists, DIST_SRC_ALL);
-}
-
-static int
-checkDistKernDeveloper(dialogMenuItem *self)
-{
- return IS_DEVELOPER(Dists, 0) && _IS_SET(SrcDists, DIST_SRC_SYS);
-}
-
-static int
-checkDistXKernDeveloper(dialogMenuItem *self)
-{
- return IS_DEVELOPER(Dists, DIST_XORG) && _IS_SET(SrcDists, DIST_SRC_SYS);
-}
-
-static int
-checkDistUser(dialogMenuItem *self)
-{
- return IS_USER(Dists, 0);
-}
-
-static int
-checkDistXUser(dialogMenuItem *self)
-{
- return IS_USER(Dists, DIST_XORG);
-}
-
-static int
-checkDistMinimum(dialogMenuItem *self)
-{
- return Dists == (DIST_BASE);
-}
-
-static int
-checkDistEverything(dialogMenuItem *self)
-{
- return Dists == DIST_ALL &&
- _IS_SET(SrcDists, DIST_SRC_ALL) &&
- _IS_SET(XOrgDists, DIST_XORG_ALL);
-}
-
-static int
-srcFlagCheck(dialogMenuItem *item)
-{
- return SrcDists;
-}
-
-static int
-x11FlagCheck(dialogMenuItem *item)
-{
- if (XOrgDists != 0)
- Dists |= DIST_XORG;
- else
- Dists &= ~DIST_XORG;
-
- return Dists & DIST_XORG;
-}
-
-static int
-checkTrue(dialogMenuItem *item)
-{
- return TRUE;
-}
-
-/* All the system menus go here.
- *
- * Hardcoded things like version number strings will disappear from
- * these menus just as soon as I add the code for doing inline variable
- * expansion.
- */
-
-DMenu MenuIndex = {
- DMENU_NORMAL_TYPE,
- "Glossary of functions",
- "This menu contains an alphabetized index of the top level functions in\n"
- "this program (sysinstall). Invoke an option by pressing [SPACE] or\n"
- "[ENTER]. To exit, use [TAB] to move to the Cancel button.",
- "Use PageUp or PageDown to move through this menu faster!",
- NULL,
- { { " Anon FTP", "Configure anonymous FTP logins.", dmenuVarCheck, configAnonFTP, NULL, "anon_ftp" },
- { " Commit", "Commit any pending actions (dangerous!)", NULL, installCustomCommit },
-#ifdef WITH_SYSCONS
- { " Console settings", "Customize system console behavior.", NULL, dmenuSubmenu, NULL, &MenuSyscons },
-#endif
- { " Configure", "The system configuration menu.", NULL, dmenuSubmenu, NULL, &MenuConfigure },
- { " Defaults, Load", "Load default settings.", NULL, dispatch_load_floppy },
-#ifdef WITH_MICE
- { " Device, Mouse", "The mouse configuration menu.", NULL, dmenuSubmenu, NULL, &MenuMouse },
-#endif
- { " Disklabel", "The disk Label editor", NULL, diskLabelEditor },
- { " Dists, All", "Root of the distribution tree.", NULL, dmenuSubmenu, NULL, &MenuDistributions },
- { " Dists, Basic", "Basic FreeBSD distribution menu.", NULL, dmenuSubmenu, NULL, &MenuSubDistributions },
- { " Dists, Developer", "Select developer's distribution.", checkDistDeveloper, distSetDeveloper },
- { " Dists, Src", "Src distribution menu.", NULL, dmenuSubmenu, NULL, &MenuSrcDistributions },
- { " Dists, X Developer", "Select X developer's distribution.", checkDistXDeveloper, distSetXDeveloper },
- { " Dists, Kern Developer", "Select kernel developer's distribution.", checkDistKernDeveloper, distSetKernDeveloper },
- { " Dists, User", "Select average user distribution.", checkDistUser, distSetUser },
- { " Dists, X User", "Select average X user distribution.", checkDistXUser, distSetXUser },
- { " Distributions, Adding", "Installing additional distribution sets", NULL, distExtractAll },
- { " Distributions, X.Org","X.Org distribution menu.", NULL, distSetXOrg },
- { " Documentation", "Installation instructions, README, etc.", NULL, dmenuSubmenu, NULL, &MenuDocumentation },
- { " Doc, README", "The distribution README file.", NULL, dmenuDisplayFile, NULL, "README" },
- { " Doc, Errata", "The distribution errata.", NULL, dmenuDisplayFile, NULL, "ERRATA" },
- { " Doc, Hardware", "The distribution hardware guide.", NULL, dmenuDisplayFile, NULL, "HARDWARE" },
- { " Doc, Install", "The distribution installation guide.", NULL, dmenuDisplayFile, NULL, "INSTALL" },
- { " Doc, Copyright", "The distribution copyright notices.", NULL, dmenuDisplayFile, NULL, "COPYRIGHT" },
- { " Doc, Release", "The distribution release notes.", NULL, dmenuDisplayFile, NULL, "RELNOTES" },
- { " Doc, HTML", "The HTML documentation menu.", NULL, docBrowser },
- { " Dump Vars", "(debugging) dump out internal variables.", NULL, dump_variables },
- { " Emergency shell", "Start an Emergency Holographic shell.", NULL, installFixitHoloShell },
-#ifdef WITH_SLICES
- { " Fdisk", "The disk Partition Editor", NULL, diskPartitionEditor },
-#endif
- { " Fixit", "Repair mode with CDROM or fixit floppy.", NULL, dmenuSubmenu, NULL, &MenuFixit },
- { " FTP sites", "The FTP mirror site listing.", NULL, dmenuSubmenu, NULL, &MenuMediaFTP },
- { " Gateway", "Set flag to route packets between interfaces.", dmenuVarCheck, dmenuToggleVariable, NULL, "gateway=YES" },
- { " HTML Docs", "The HTML documentation menu", NULL, docBrowser },
- { " inetd Configuration", "Configure inetd and simple internet services.", dmenuVarCheck, configInetd, NULL, "inetd_enable=YES" },
- { " Install, Standard", "A standard system installation.", NULL, installStandard },
- { " Install, Express", "An express system installation.", NULL, installExpress },
- { " Install, Custom", "The custom installation menu", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
- { " Label", "The disk Label editor", NULL, diskLabelEditor },
- { " Media", "Top level media selection menu.", NULL, dmenuSubmenu, NULL, &MenuMedia },
- { " Media, Tape", "Select tape installation media.", NULL, mediaSetTape },
- { " Media, NFS", "Select NFS installation media.", NULL, mediaSetNFS },
- { " Media, Floppy", "Select floppy installation media.", NULL, mediaSetFloppy },
- { " Media, CDROM/DVD", "Select CDROM/DVD installation media.", NULL, mediaSetCDROM },
- { " Media, DOS", "Select DOS installation media.", NULL, mediaSetDOS },
- { " Media, UFS", "Select UFS installation media.", NULL, mediaSetUFS },
- { " Media, FTP", "Select FTP installation media.", NULL, mediaSetFTP },
- { " Media, FTP Passive", "Select passive FTP installation media.", NULL, mediaSetFTPPassive },
- { " Media, HTTP", "Select FTP via HTTP proxy installation media.", NULL, mediaSetHTTP },
- { " Network Interfaces", "Configure network interfaces", NULL, tcpMenuSelect },
- { " Networking Services", "The network services menu.", NULL, dmenuSubmenu, NULL, &MenuNetworking },
- { " NFS, client", "Set NFS client flag.", dmenuVarCheck, dmenuToggleVariable, NULL, "nfs_client_enable=YES" },
- { " NFS, server", "Set NFS server flag.", dmenuVarCheck, configNFSServer, NULL, "nfs_server_enable=YES" },
- { " NTP Menu", "The NTP configuration menu.", NULL, dmenuSubmenu, NULL, &MenuNTP },
- { " Options", "The options editor.", NULL, optionsEditor },
- { " Packages", "The packages collection", NULL, configPackages },
-#ifdef WITH_SLICES
- { " Partition", "The disk Slice (PC-style partition) Editor", NULL, diskPartitionEditor },
-#endif
- { " PCNFSD", "Run authentication server for PC-NFS.", dmenuVarCheck, configPCNFSD, NULL, "pcnfsd" },
- { " Root Password", "Set the system manager's password.", NULL, dmenuSystemCommand, NULL, "passwd root" },
- { " Router", "Select routing daemon (default: routed)", NULL, configRouter, NULL, "router_enable" },
- { " Security", "Configure system security options", NULL, dmenuSubmenu, NULL, &MenuSecurity },
-#ifdef WITH_SYSCONS
- { " Syscons", "The system console configuration menu.", NULL, dmenuSubmenu, NULL, &MenuSyscons },
-#ifndef PC98
- { " Syscons, Font", "The console screen font.", NULL, dmenuSubmenu, NULL, &MenuSysconsFont },
-#endif
- { " Syscons, Keymap", "The console keymap configuration menu.", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap },
- { " Syscons, Keyrate", "The console key rate configuration menu.", NULL, dmenuSubmenu, NULL, &MenuSysconsKeyrate },
- { " Syscons, Saver", "The console screen saver configuration menu.", NULL, dmenuSubmenu, NULL, &MenuSysconsSaver },
-#ifndef PC98
- { " Syscons, Screenmap", "The console screenmap configuration menu.", NULL, dmenuSubmenu, NULL, &MenuSysconsScrnmap },
- { " Syscons, Ttys", "The console terminal type menu.", NULL, dmenuSubmenu, NULL, &MenuSysconsTtys },
-#endif
-#endif /* WITH_SYSCONS */
- { " Time Zone", "Set the system's time zone.", NULL, dmenuSystemCommand, NULL, "tzsetup" },
- { " TTYs", "Configure system ttys.", NULL, configEtcTtys, NULL, "ttys" },
- { " Upgrade", "Upgrade an existing system.", NULL, installUpgrade },
- { " Usage", "Quick start - How to use this menu system.", NULL, dmenuDisplayFile, NULL, "usage" },
- { " User Management", "Add user and group information.", NULL, dmenuSubmenu, NULL, &MenuUsermgmt },
- { " X.Org, Fonts", "X.Org Font selection menu.", NULL, dmenuSubmenu, NULL, &MenuXOrgSelectFonts },
- { " X.Org, Server", "X.Org Server selection menu.", NULL, dmenuSubmenu, NULL, &MenuXOrgSelectServer },
- { NULL } },
-};
-
-/* The initial installation menu */
-DMenu MenuInitial = {
- DMENU_NORMAL_TYPE,
- "sysinstall Main Menu", /* title */
- "Welcome to the FreeBSD installation and configuration tool. Please\n" /* prompt */
- "select one of the options below by using the arrow keys or typing the\n"
- "first character of the option name you're interested in. Invoke an\n"
- "option with [SPACE] or [ENTER]. To exit, use [TAB] to move to Exit.",
- "Press F1 for Installation Guide", /* help line */
- "INSTALL", /* help file */
- { { " Select " },
- { "X Exit Install", NULL, NULL, dmenuExit },
- { " Usage", "Quick start - How to use this menu system", NULL, dmenuDisplayFile, NULL, "usage" },
- { "Standard", "Begin a standard installation (recommended)", NULL, installStandard },
- { "Express", "Begin a quick installation (for experts)", NULL, installExpress },
- { " Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
- { "Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure },
- { "Doc", "Installation instructions, README, etc.", NULL, dmenuSubmenu, NULL, &MenuDocumentation },
-#ifdef WITH_SYSCONS
- { "Keymap", "Select keyboard type", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap },
-#endif
- { "Options", "View/Set various installation options", NULL, optionsEditor },
- { "Fixit", "Repair mode with CDROM/DVD/floppy or start shell", NULL, dmenuSubmenu, NULL, &MenuFixit },
- { "Upgrade", "Upgrade an existing system", NULL, installUpgrade },
- { "Load Config","Load default install configuration", NULL, dispatch_load_floppy },
- { "Index", "Glossary of functions", NULL, dmenuSubmenu, NULL, &MenuIndex },
- { NULL } },
-};
-
-/* The main documentation menu */
-DMenu MenuDocumentation = {
- DMENU_NORMAL_TYPE,
- "FreeBSD Documentation Menu",
- "If you are at all unsure about the configuration of your hardware\n"
- "or are looking to build a system specifically for FreeBSD, read the\n"
- "Hardware guide! New users should also read the Install document for\n"
- "a step-by-step tutorial on installing FreeBSD. For general information,\n"
- "consult the README file.",
- "Confused? Press F1 for help.",
- "usage",
- { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
- { "1 README", "A general description of FreeBSD. Read this!", NULL, dmenuDisplayFile, NULL, "README" },
- { "2 Errata", "Late-breaking, post-release news.", NULL, dmenuDisplayFile, NULL, "ERRATA" },
- { "3 Hardware", "The FreeBSD survival guide for PC hardware.", NULL, dmenuDisplayFile, NULL, "HARDWARE" },
- { "4 Install", "A step-by-step guide to installing FreeBSD.", NULL, dmenuDisplayFile, NULL, "INSTALL" },
- { "5 Copyright", "The FreeBSD Copyright notices.", NULL, dmenuDisplayFile, NULL, "COPYRIGHT" },
- { "6 Release" ,"The release notes for this version of FreeBSD.", NULL, dmenuDisplayFile, NULL, "RELNOTES" },
- { "7 Shortcuts", "Creating shortcuts to sysinstall.", NULL, dmenuDisplayFile, NULL, "shortcuts" },
- { "8 HTML Docs", "Go to the HTML documentation menu (post-install).", NULL, docBrowser },
- { NULL } },
-};
-
-#ifdef WITH_MICE
-DMenu MenuMouseType = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
-#ifdef PC98
- "Select a protocol type for your mouse",
- "If your mouse is attached to the bus mouse port, you should always choose\n"
- "\"Auto\", regardless of the model and the brand of the mouse. All other\n"
- "protocol types are for serial mice and should not be used with the bus\n"
- "mouse. If you have a serial mouse and are not sure about its protocol,\n"
- "you should also try \"Auto\". It may not work for the serial mouse if the\n"
- "mouse does not support the PnP standard. But, it won't hurt. Many\n"
- "2-button serial mice are compatible with \"Microsoft\" or \"MouseMan\".\n"
- "3-button serial mice may be compatible with \"MouseSystems\" or \"MouseMan\".\n"
- "If the serial mouse has a wheel, it may be compatible with \"IntelliMouse\".",
- NULL,
- NULL,
- { { "1 Auto", "Bus mouse or PnP serial mouse",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=auto" },
-#else
- "Select a protocol type for your mouse",
- "If your mouse is attached to the PS/2 mouse port or the bus mouse port,\n"
- "you should always choose \"Auto\", regardless of the model and the brand\n"
- "of the mouse. All other protocol types are for serial mice and should\n"
- "not be used with the PS/2 port mouse or the bus mouse. If you have\n"
- "a serial mouse and are not sure about its protocol, you should also try\n"
- "\"Auto\". It may not work for the serial mouse if the mouse does not\n"
- "support the PnP standard. But, it won't hurt. Many 2-button serial mice\n"
- "are compatible with \"Microsoft\" or \"MouseMan\". 3-button serial mice\n"
- "may be compatible with \"MouseSystems\" or \"MouseMan\". If the serial\n"
- "mouse has a wheel, it may be compatible with \"IntelliMouse\".",
- NULL,
- NULL,
- { { "1 Auto", "Bus mouse, PS/2 style mouse or PnP serial mouse",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=auto" },
-#endif /* PC98 */
- { "2 GlidePoint", "ALPS GlidePoint pad (serial)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=glidepoint" },
- { "3 Hitachi","Hitachi tablet (serial)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=mmhittab" },
- { "4 IntelliMouse", "Microsoft IntelliMouse (serial)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=intellimouse" },
- { "5 Logitech", "Logitech protocol (old models) (serial)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=logitech" },
- { "6 Microsoft", "Microsoft protocol (serial)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=microsoft" },
- { "7 MM Series","MM Series protocol (serial)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=mmseries" },
- { "8 MouseMan", "Logitech MouseMan/TrackMan models (serial)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=mouseman" },
- { "9 MouseSystems", "MouseSystems protocol (serial)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=mousesystems" },
- { "A ThinkingMouse","Kensington ThinkingMouse (serial)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_TYPE "=thinkingmouse" },
- { NULL } },
-};
-
-#ifdef PC98
-DMenu MenuMousePort = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Select your mouse port from the following menu",
- "The built-in pointing device of laptop/notebook computers is usually\n"
- "a BusMouse style device.",
- NULL,
- NULL,
- {
- { "1 BusMouse", "PC-98x1 bus mouse (/dev/mse0)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/mse0" },
- { "2 COM1", "Serial mouse on COM1 (/dev/cuad0)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad0" },
- { "3 COM2", "Serial mouse on COM2 (/dev/cuad1)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad1" },
- { NULL } },
-};
-#else
-DMenu MenuMousePort = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Select your mouse port from the following menu",
- "The built-in pointing device of laptop/notebook computers is usually\n"
- "a PS/2 style device.",
- NULL,
- NULL,
- { { "1 PS/2", "PS/2 style mouse (/dev/psm0)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/psm0" },
- { "2 COM1", "Serial mouse on COM1 (/dev/cuad0)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad0" },
- { "3 COM2", "Serial mouse on COM2 (/dev/cuad1)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad1" },
- { "4 COM3", "Serial mouse on COM3 (/dev/cuad2)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad2" },
- { "5 COM4", "Serial mouse on COM4 (/dev/cuad3)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/cuad3" },
- { "6 BusMouse", "Logitech, ATI or MS bus mouse (/dev/mse0)",
- dmenuVarCheck, dmenuSetVariable, NULL, VAR_MOUSED_PORT "=/dev/mse0" },
- { NULL } },
-};
-#endif /* PC98 */
-
-DMenu MenuMouse = {
- DMENU_NORMAL_TYPE,
- "Please configure your mouse",
- "You can cut and paste text in the text console by running the mouse\n"
- "daemon. Specify a port and a protocol type of your mouse and enable\n"
- "the mouse daemon. If you don't want this feature, select 6 to disable\n"
- "the daemon.\n"
- "Once you've enabled the mouse daemon, you can specify \"/dev/sysmouse\"\n"
- "as your mouse device and \"SysMouse\" or \"MouseSystems\" as mouse\n"
- "protocol when running the X configuration utility (see Configuration\n"
- "menu).",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
- { "2 Enable", "Test and run the mouse daemon", NULL, mousedTest, NULL, NULL },
- { "3 Type", "Select mouse protocol type", NULL, dmenuSubmenu, NULL, &MenuMouseType },
- { "4 Port", "Select mouse port", NULL, dmenuSubmenu, NULL, &MenuMousePort },
- { "5 Flags", "Set additional flags", dmenuVarCheck, setMouseFlags,
- NULL, VAR_MOUSED_FLAGS "=" },
- { "6 Disable", "Disable the mouse daemon", NULL, mousedDisable, NULL, NULL },
- { NULL } },
-};
-#endif /* WITH_MICE */
-
-DMenu MenuMediaCDROM = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Choose a CD/DVD type",
- "FreeBSD can be installed directly from a CD/DVD containing a valid\n"
- "FreeBSD distribution. If you are seeing this menu it is because\n"
- "more than one CD/DVD drive was found on your system. Please select one\n"
- "of the following CD/DVD drives as your installation drive.",
- "Press F1 to read the installation guide",
- "INSTALL",
- { { NULL } },
-};
-
-DMenu MenuMediaFloppy = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Choose a Floppy drive",
- "You have more than one floppy drive. Please choose which drive\n"
- "you would like to use.",
- NULL,
- NULL,
- { { NULL } },
-};
-
-DMenu MenuMediaDOS = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Choose a DOS partition",
- "FreeBSD can be installed directly from a DOS partition\n"
- "assuming, of course, that you have copied the relevant\n"
- "distributions into your DOS partition before starting this\n"
- "installation. If this is not the case then you should reboot\n"
- "DOS at this time and copy the distributions you wish to install\n"
- "into a \"FREEBSD\" subdirectory on one of your DOS partitions.\n"
- "Otherwise, please select the DOS partition containing the FreeBSD\n"
- "distribution files.",
- "Press F1 to read the installation guide",
- "INSTALL",
- { { NULL } },
-};
-
-DMenu MenuMediaFTP = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Please select a FreeBSD FTP distribution site",
- "Please select the site closest to you or \"other\" if you'd like to\n"
- "specify a different choice. Also note that not every site listed here\n"
- "carries more than the base distribution kits. Only Primary sites are\n"
- "guaranteed to carry the full range of possible distributions.",
- "Select a site that's close!",
- "INSTALL",
- { { "Main Site", "ftp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.freebsd.org" },
- { "URL", "Specify some other ftp site by URL", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=other" },
- { "Snapshots Server Japan", "snapshots.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://snapshots.jp.freebsd.org" },
- { "Snapshots Server Sweden", "snapshots.se.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://snapshots.se.freebsd.org" },
-
- { "IPv6 Ireland", "ftp3.ie.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.ie.freebsd.org" },
- { " IPv6 Japan", "ftp2.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.jp.freebsd.org" },
- { " IPv6 USA", "ftp4.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.us.freebsd.org" },
-
- { "Primary", "ftp1.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp1.freebsd.org" },
- { " Primary #2", "ftp2.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.freebsd.org" },
- { " Primary #3", "ftp3.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.freebsd.org" },
- { " Primary #4", "ftp4.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.freebsd.org" },
- { " Primary #5", "ftp5.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.freebsd.org" },
- { " Primary #6", "ftp6.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp6.freebsd.org" },
- { " Primary #7", "ftp7.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp7.freebsd.org" },
- { " Primary #8", "ftp8.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp8.freebsd.org" },
- { " Primary #9", "ftp9.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp9.freebsd.org" },
- { " Primary #10", "ftp10.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp10.freebsd.org" },
- { " Primary #11", "ftp11.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp11.freebsd.org" },
- { " Primary #12", "ftp12.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp12.freebsd.org" },
- { " Primary #13", "ftp13.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp13.freebsd.org" },
- { " Primary #14", "ftp14.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp14.freebsd.org" },
-
- { "Argentina", "ftp.ar.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.ar.freebsd.org" },
-
- { "Australia", "ftp.au.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.au.freebsd.org" },
- { " Australia #2","ftp2.au.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.au.freebsd.org" },
- { " Australia #3","ftp3.au.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.au.freebsd.org" },
-
- { "Austria","ftp.at.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.at.freebsd.org" },
- { " Austria #2","ftp2.at.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.at.freebsd.org" },
-
- { "Brazil", "ftp.br.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.br.freebsd.org" },
- { " Brazil #2", "ftp2.br.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.br.freebsd.org" },
- { " Brazil #3", "ftp3.br.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.br.freebsd.org" },
- { " Brazil #4", "ftp4.br.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.br.freebsd.org" },
- { " Brazil #5", "ftp5.br.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.br.freebsd.org" },
- { " Brazil #6", "ftp6.br.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp6.br.freebsd.org" },
- { " Brazil #7", "ftp7.br.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp7.br.freebsd.org" },
-
- { "Canada", "ftp.ca.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.ca.freebsd.org" },
-
- { "China", "ftp.cn.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.cn.freebsd.org" },
- { " China #2", "ftp2.cn.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.cn.freebsd.org" },
-
- { "Croatia", "ftp.hr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.hr.freebsd.org" },
-
- { "Czech Republic", "ftp.cz.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.cz.freebsd.org" },
-
- { "Denmark", "ftp.dk.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.dk.freebsd.org" },
- { " Denmark #2", "ftp2.dk.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.dk.freebsd.org" },
-
- { "Estonia", "ftp.ee.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.ee.freebsd.org" },
-
- { "Finland", "ftp.fi.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.fi.freebsd.org" },
-
- { "France", "ftp.fr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.fr.freebsd.org" },
- { " France #2", "ftp2.fr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.fr.freebsd.org" },
- { " France #3", "ftp3.fr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.fr.freebsd.org" },
- { " France #5", "ftp5.fr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.fr.freebsd.org" },
- { " France #6", "ftp6.fr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp6.fr.freebsd.org" },
- { " France #8", "ftp8.fr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp8.fr.freebsd.org" },
-
- { "Germany", "ftp.de.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.de.freebsd.org" },
- { " Germany #2", "ftp2.de.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.de.freebsd.org" },
- { " Germany #3", "ftp3.de.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.de.freebsd.org" },
- { " Germany #4", "ftp4.de.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.de.freebsd.org" },
- { " Germany #5", "ftp5.de.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.de.freebsd.org" },
- { " Germany #6", "ftp6.de.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp6.de.freebsd.org" },
- { " Germany #7", "ftp7.de.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp7.de.freebsd.org" },
- { " Germany #8", "ftp8.de.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp8.de.freebsd.org" },
-
- { "Greece", "ftp.gr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.gr.freebsd.org" },
- { " Greece #2", "ftp2.gr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.gr.freebsd.org" },
-
- { "Hong Kong", "ftp.hk.super.net", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.hk.super.net" },
-
- { "Hungary", "ftp.hu.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.hu.freebsd.org" },
-
- { "Iceland", "ftp.is.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.is.freebsd.org" },
-
- { "Ireland", "ftp.ie.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.ie.freebsd.org" },
- { " Ireland #2", "ftp2.ie.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.ie.freebsd.org" },
- { " Ireland #3", "ftp3.ie.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.ie.freebsd.org" },
-
- { "Italy", "ftp.it.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.it.freebsd.org" },
-
- { "Japan", "ftp.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.jp.freebsd.org" },
- { " Japan #2", "ftp2.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.jp.freebsd.org" },
- { " Japan #3", "ftp3.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.jp.freebsd.org" },
- { " Japan #4", "ftp4.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.jp.freebsd.org" },
- { " Japan #5", "ftp5.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.jp.freebsd.org" },
- { " Japan #6", "ftp6.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp6.jp.freebsd.org" },
- { " Japan #7", "ftp7.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp7.jp.freebsd.org" },
- { " Japan #8", "ftp8.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp8.jp.freebsd.org" },
- { " Japan #9", "ftp9.jp.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp9.jp.freebsd.org" },
-
- { "Korea", "ftp.kr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.kr.freebsd.org" },
- { " Korea #2", "ftp2.kr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.kr.freebsd.org" },
-
- { "Lithuania", "ftp.lt.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.lt.freebsd.org" },
-
- { "Netherlands", "ftp.nl.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.nl.freebsd.org" },
- { " Netherlands #2", "ftp2.nl.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.nl.freebsd.org" },
-
- { "Norway", "ftp.no.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.no.freebsd.org" },
- { " Norway #3", "ftp3.no.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.no.freebsd.org" },
-
- { "Poland", "ftp.pl.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.pl.freebsd.org" },
- { " Poland #2", "ftp2.pl.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.pl.freebsd.org" },
- { " Poland #5", "ftp5.pl.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.pl.freebsd.org" },
-
- { "Portugal", "ftp.pt.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.pt.freebsd.org" },
- { " Portugal #2", "ftp2.pt.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.pt.freebsd.org" },
- { " Portugal #4", "ftp4.pt.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.pt.freebsd.org" },
-
- { "Romania", "ftp.ro.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.ro.freebsd.org" },
-
- { "Russia", "ftp.ru.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.ru.freebsd.org" },
- { " Russia #2", "ftp2.ru.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.ru.freebsd.org" },
- { " Russia #3", "ftp3.ru.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.ru.freebsd.org" },
- { " Russia #4", "ftp4.ru.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.ru.freebsd.org" },
-
- { "Singapore", "ftp.sg.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.sg.freebsd.org" },
-
- { "Slovak Republic", "ftp.sk.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.sk.freebsd.org" },
-
- { "Slovenia", "ftp.si.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.si.freebsd.org" },
- { " Slovenia #2", "ftp2.si.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.si.freebsd.org" },
-
- { "South Africa", "ftp.za.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.za.freebsd.org" },
- { " South Africa #2", "ftp2.za.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.za.freebsd.org" },
- { " South Africa #3", "ftp3.za.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.za.freebsd.org" },
- { " South Africa #4", "ftp4.za.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.za.freebsd.org" },
-
- { "Spain", "ftp.es.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.es.freebsd.org" },
- { " Spain #2", "ftp2.es.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.es.freebsd.org" },
- { " Spain #3", "ftp3.es.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.es.freebsd.org" },
-
- { "Sweden", "ftp.se.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.se.freebsd.org" },
- { " Sweden #2", "ftp2.se.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.se.freebsd.org" },
- { " Sweden #3", "ftp3.se.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.se.freebsd.org" },
- { " Sweden #5", "ftp5.se.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.se.freebsd.org" },
-
- { "Switzerland", "ftp.ch.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.ch.freebsd.org" },
- { " Switzerland #2", "ftp2.ch.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.ch.freebsd.org" },
-
- { "Taiwan", "ftp.tw.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.tw.freebsd.org" },
- { " Taiwan #2", "ftp2.tw.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.tw.freebsd.org" },
- { " Taiwan #3", "ftp3.tw.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.tw.freebsd.org" },
- { " Taiwan #4", "ftp4.tw.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.tw.freebsd.org" },
- { " Taiwan #6", "ftp6.tw.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp6.tw.freebsd.org" },
- { " Taiwan #11", "ftp11.tw.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp11.tw.freebsd.org" },
-
- { "Turkey", "ftp.tr.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.tr.freebsd.org" },
-
- { "UK", "ftp.uk.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.uk.freebsd.org" },
- { " UK #2", "ftp2.uk.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.uk.freebsd.org" },
- { " UK #3", "ftp3.uk.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.uk.freebsd.org" },
- { " UK #4", "ftp4.uk.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.uk.freebsd.org" },
- { " UK #5", "ftp5.uk.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.uk.freebsd.org" },
- { " UK #6", "ftp6.uk.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp6.uk.freebsd.org" },
-
- { "Ukraine", "ftp.ua.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp.ua.freebsd.org" },
- { " Ukraine #2", "ftp2.ua.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.ua.freebsd.org" },
- { " Ukraine #5", "ftp5.ua.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.ua.freebsd.org" },
- { " Ukraine #6", "ftp6.ua.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp6.ua.freebsd.org" },
- { " Ukraine #7", "ftp7.ua.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp7.ua.freebsd.org" },
- { " Ukraine #8", "ftp8.ua.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp8.ua.freebsd.org" },
-
- { "USA #1", "ftp1.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp1.us.freebsd.org" },
- { " USA #2", "ftp2.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp2.us.freebsd.org" },
- { " USA #3", "ftp3.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp3.us.freebsd.org" },
- { " USA #4", "ftp4.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp4.us.freebsd.org" },
- { " USA #5", "ftp5.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp5.us.freebsd.org" },
- { " USA #6", "ftp6.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp6.us.freebsd.org" },
- { " USA #7", "ftp7.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp7.us.freebsd.org" },
- { " USA #8", "ftp8.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp8.us.freebsd.org" },
- { " USA #9", "ftp9.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp9.us.freebsd.org" },
- { " USA #10", "ftp10.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp10.us.freebsd.org" },
- { " USA #11", "ftp11.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp11.us.freebsd.org" },
- { " USA #12", "ftp12.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp12.us.freebsd.org" },
- { " USA #13", "ftp13.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp13.us.freebsd.org" },
- { " USA #14", "ftp14.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp14.us.freebsd.org" },
- { " USA #15", "ftp15.us.freebsd.org", NULL, dmenuSetVariable, NULL,
- VAR_FTP_PATH "=ftp://ftp15.us.freebsd.org" },
-
- { NULL } }
-};
-
-DMenu MenuMediaTape = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Choose a tape drive type",
- "FreeBSD can be installed from tape drive, though this installation\n"
- "method requires a certain amount of temporary storage in addition\n"
- "to the space required by the distribution itself (tape drives make\n"
- "poor random-access devices, so we extract _everything_ on the tape\n"
- "in one pass). If you have sufficient space for this, then you should\n"
- "select one of the following tape devices detected on your system.",
- "Press F1 to read the installation guide",
- "INSTALL",
- { { NULL } },
-};
-
-DMenu MenuNetworkDevice = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Network interface information required",
- "If you are using PPP over a serial device, as opposed to a direct\n"
- "ethernet connection, then you may first need to dial your Internet\n"
- "Service Provider using the ppp utility we provide for that purpose.\n"
- "If you're using SLIP over a serial device then the expectation is\n"
- "that you have a HARDWIRED connection.\n\n"
- "You can also install over a parallel port using a special \"laplink\"\n"
- "cable to another machine running FreeBSD.",
- "Press F1 to read network configuration manual",
- "network_device",
- { { NULL } },
-};
-
-/* Prototype KLD load menu */
-DMenu MenuKLD = {
- DMENU_NORMAL_TYPE,
- "KLD Menu",
- "Load a KLD from a floppy\n",
- NULL,
- NULL,
- { { NULL } },
-};
-
-/* The media selection menu */
-DMenu MenuMedia = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Choose Installation Media",
- "FreeBSD can be installed from a variety of different installation\n"
- "media, ranging from floppies to an Internet FTP server. If you're\n"
- "installing FreeBSD from a supported CD/DVD drive then this is generally\n"
- "the best media to use if you have no overriding reason for using other\n"
- "media.",
- "Press F1 for more information on the various media types",
- "media",
- { { "1 CD/DVD", "Install from a FreeBSD CD/DVD", NULL, mediaSetCDROM },
- { "2 FTP", "Install from an FTP server", NULL, mediaSetFTPActive },
- { "3 FTP Passive", "Install from an FTP server through a firewall", NULL, mediaSetFTPPassive },
- { "4 HTTP", "Install from an FTP server through a http proxy", NULL, mediaSetHTTP },
- { "5 DOS", "Install from a DOS partition", NULL, mediaSetDOS },
- { "6 NFS", "Install over NFS", NULL, mediaSetNFS },
- { "7 File System", "Install from an existing filesystem", NULL, mediaSetUFS },
- { "8 Floppy", "Install from a floppy disk set", NULL, mediaSetFloppy },
- { "9 Tape", "Install from SCSI or QIC tape", NULL, mediaSetTape },
- { "X Options", "Go to the Options screen", NULL, optionsEditor },
- { NULL } },
-};
-
-/* The distributions menu */
-DMenu MenuDistributions = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "Choose Distributions",
- "As a convenience, we provide several \"canned\" distribution sets.\n"
- "These select what we consider to be the most reasonable defaults for the\n"
- "type of system in question. If you would prefer to pick and choose the\n"
- "list of distributions yourself, simply select \"Custom\". You can also\n"
- "pick a canned distribution set and then fine-tune it with the Custom item.\n\n"
- "Choose an item by pressing [SPACE] or [ENTER]. When finished, choose the\n"
- "Exit item or move to the OK button with [TAB].",
- "Press F1 for more information on these options.",
- "distributions",
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { "All", "All system sources, binaries and X Window System",
- checkDistEverything, distSetEverything, NULL, NULL, ' ', ' ', ' ' },
- { "Reset", "Reset selected distribution list to nothing",
- NULL, distReset, NULL, NULL, ' ', ' ', ' ' },
- { "4 Developer", "Full sources, binaries and doc but no games",
- checkDistDeveloper, distSetDeveloper },
- { "5 X-Developer", "Same as above + X Window System",
- checkDistXDeveloper, distSetXDeveloper },
- { "6 Kern-Developer", "Full binaries and doc, kernel sources only",
- checkDistKernDeveloper, distSetKernDeveloper },
- { "7 X-Kern-Developer", "Same as above + X Window System",
- checkDistXKernDeveloper, distSetXKernDeveloper },
- { "8 User", "Average user - binaries and doc only",
- checkDistUser, distSetUser },
- { "9 X-User", "Same as above + X Window System",
- checkDistXUser, distSetXUser },
- { "A Minimal", "The smallest configuration possible",
- checkDistMinimum, distSetMinimum },
- { "B Custom", "Specify your own distribution set",
- NULL, dmenuSubmenu, NULL, &MenuSubDistributions, '>', '>', '>' },
- { NULL } },
-};
-
-DMenu MenuSubDistributions = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "Select the distributions you wish to install.",
- "Please check off the distributions you wish to install. At the\n"
- "very minimum, this should be \"base\".",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { "All", "All system sources, binaries and X Window System",
- NULL, distSetEverything, NULL, NULL, ' ', ' ', ' ' },
- { "Reset", "Reset all of the below",
- NULL, distReset, NULL, NULL, ' ', ' ', ' ' },
- { " base", "Binary base distribution (required)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_BASE },
- { " dict", "Spelling checker dictionary files",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_DICT },
- { " doc", "Miscellaneous FreeBSD online docs",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_DOC },
- { " games", "Games (non-commercial)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_GAMES },
- { " info", "GNU info files",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_INFO },
-#ifdef __amd64__
- { " lib32", "32-bit runtime compatibility libraries",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_LIB32 },
-#endif
- { " man", "System manual pages - recommended",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_MANPAGES },
- { " catman", "Preformatted system manual pages",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_CATPAGES },
- { " proflibs", "Profiled versions of the libraries",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_PROFLIBS },
- { " src", "Sources for everything",
- srcFlagCheck, distSetSrc },
- { " ports", "The FreeBSD Ports collection",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_PORTS },
- { " local", "Local additions collection",
- dmenuFlagCheck, dmenuSetFlag, NULL, &Dists, '[', 'X', ']', DIST_LOCAL},
- { " X.Org", "The X.Org distribution",
- x11FlagCheck, distSetXOrg },
- { NULL } },
-};
-
-DMenu MenuSrcDistributions = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "Select the sub-components of src you wish to install.",
- "Please check off those portions of the FreeBSD source tree\n"
- "you wish to install.",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { "All", "Select all of the below",
- NULL, setSrc, NULL, NULL, ' ', ' ', ' ' },
- { "Reset", "Reset all of the below",
- NULL, clearSrc, NULL, NULL, ' ', ' ', ' ' },
- { " base", "top-level files in /usr/src",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_BASE },
- { " contrib", "/usr/src/contrib (contributed software)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_CONTRIB },
- { " crypto", "/usr/src/crypto (contrib encryption sources)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_SCRYPTO },
- { " gnu", "/usr/src/gnu (software from the GNU Project)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_GNU },
- { " etc", "/usr/src/etc (miscellaneous system files)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_ETC },
- { " games", "/usr/src/games (the obvious!)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_GAMES },
- { " include", "/usr/src/include (header files)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_INCLUDE },
- { " krb5", "/usr/src/kerberos5 (sources for Kerberos5)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_SKERBEROS5 },
- { " lib", "/usr/src/lib (system libraries)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_LIB },
- { " libexec", "/usr/src/libexec (system programs)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_LIBEXEC },
- { " release", "/usr/src/release (release-generation tools)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_RELEASE },
- { " rescue", "/usr/src/rescue (static rescue tools)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_RESCUE },
- { " bin", "/usr/src/bin (system binaries)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_BIN },
- { " sbin", "/usr/src/sbin (system binaries)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_SBIN },
- { " secure", "/usr/src/secure (BSD encryption sources)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_SSECURE },
- { " share", "/usr/src/share (documents and shared files)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_SHARE },
- { " sys", "/usr/src/sys (FreeBSD kernel)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_SYS },
- { " tools", "/usr/src/tools (miscellaneous tools)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_TOOLS },
- { " ubin", "/usr/src/usr.bin (user binaries)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_UBIN },
- { " usbin", "/usr/src/usr.sbin (aux system binaries)",
- dmenuFlagCheck, dmenuSetFlag, NULL, &SrcDists, '[', 'X', ']', DIST_SRC_USBIN },
- { NULL } },
-};
-
-DMenu MenuXOrgConfig = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Please select the X.Org configuration tool you want to use.",
- "The first option, xorgcfg, is fully graphical.\n"
- "The second option provides a menu-based interface similar to\n"
- "what you are currently using. "
- "The third option, xorgconfig, is\n"
- "a more simplistic shell-script based tool and less friendly to\n"
- "new users, but it may work in situations where the other options\n"
- "do not.",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- NULL, dmenuExit },
- { "2 xorgcfg", "Fully graphical X.Org configuration tool.",
- NULL, dmenuSetVariable, NULL, VAR_XORG_CONFIG "=xorgcfg" },
- { "3 xorgcfg -textmode", "ncurses-based X.Org configuration tool.",
- NULL, dmenuSetVariable, NULL, VAR_XORG_CONFIG "=xorgcfg -textmode" },
- { "4 xorgconfig", "Shell-script based X.Org configuration tool.",
- NULL, dmenuSetVariable, NULL, VAR_XORG_CONFIG "=xorgconfig" },
- { "D XDesktop", "X already set up, just do desktop configuration.",
- NULL, dmenuSubmenu, NULL, &MenuXDesktops },
- { NULL } },
-};
-
-DMenu MenuXDesktops = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Please select the default X desktop to use.",
- "By default, X.Org comes with a fairly vanilla desktop which\n"
- "is based around the twm(1) window manager and does not offer\n"
- "much in the way of features. It does have the advantage of\n"
- "being a standard part of X so you don't need to load anything\n"
- "extra in order to use it. If, however, you have access to a\n"
- "reasonably full packages collection on your installation media,\n"
- "you can choose any one of the following desktops as alternatives.",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- NULL, dmenuExit },
- { "2 KDE", "The K Desktop Environment (Lite Edition)",
- NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=kde" },
- { "3 GNOME 2", "The GNOME 2 Desktop Environment (Lite Edition)",
- NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=gnome2" },
- { "4 Afterstep", "The Afterstep window manager",
- NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=afterstep" },
- { "5 Windowmaker", "The Windowmaker window manager",
- NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=windowmaker" },
- { "6 fvwm", "The fvwm window manager",
- NULL, dmenuSetVariable, NULL, VAR_DESKSTYLE "=fvwm2" },
- { NULL } },
-};
-
-DMenu MenuXOrgSelect = {
- DMENU_NORMAL_TYPE,
- "X.Org Distribution",
- "Please select the components you need from the X.Org\n"
- "distribution sets.",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
- { "Basic", "Basic component menu (required)", NULL, dmenuSubmenu, NULL, &MenuXOrgSelectCore },
- { "Server", "X server menu", NULL, dmenuSubmenu, NULL, &MenuXOrgSelectServer },
- { "Fonts", "Font set menu", NULL, dmenuSubmenu, NULL, &MenuXOrgSelectFonts },
- { NULL } },
-};
-
-DMenu MenuXOrgSelectCore = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "X.Org base distribution types",
- "Please check off the basic X.Org components you wish to install.\n"
- "Bin, lib, and set are recommended for a minimum installaion.",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { "All", "Select all below",
- NULL, setX11Misc, NULL, NULL, ' ', ' ', ' ' },
- { "Reset", "Reset all below",
- NULL, clearX11Misc, NULL, NULL, ' ', ' ', ' ' },
- { " lib", "Shared libraries and data files needed at runtime",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_LIB },
- { " bin", "Client applications",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_CLIENTS },
- { " man", "Manual pages",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_MAN },
- { " doc", "Documentation",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_DOC },
- { " prog", "Programming tools",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_IMAKE },
- { NULL } },
-};
-
-DMenu MenuXOrgSelectFonts = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "X.Org Font distribution selection.",
- "Please check off the individual font distributions you wish to\n\
-install. At the minimum, you should install the standard\n\
-75 DPI and misc fonts if you're also installing an X server\n\
-(these are selected by default). The TrueType set is also \n\
-highly recommended. The font server is unnecessary in most\n\
-configurations.",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { "All", "All fonts",
- NULL, setX11Fonts, NULL, NULL, ' ', ' ', ' ' },
- { "Reset", "Reset font selections",
- NULL, clearX11Fonts, NULL, NULL, ' ', ' ', ' ' },
- { " fmsc", "Standard miscellaneous fonts",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_FONTS_MISC },
- { " f75", "75 DPI fonts",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_FONTS_75 },
- { " f100", "100 DPI fonts",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_FONTS_100 },
- { " fcyr", "Cyrillic Fonts",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_FONTS_CYR },
- { " ft1", "Type1 scalable fonts",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_FONTS_T1 },
- { " ftt", "TrueType scalable fonts",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_FONTS_TT },
- { " fs", "Font server",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_FONTSERVER },
- { NULL } },
-};
-
-DMenu MenuXOrgSelectServer = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "X.Org X Server selection.",
- "Please check off the types of X servers you wish to install.\n",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { "All", "Select all of the above",
- NULL, setX11Servers, NULL, NULL, ' ', ' ', ' ' },
- { "Reset", "Reset all of the above",
- NULL, clearX11Servers, NULL, NULL, ' ', ' ', ' ' },
- { " srv", "Standard Graphics Framebuffer",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_SERVER },
- { " nest", "Nested X Server",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_NESTSERVER },
- { " prt", "X Print Server",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_PRINTSERVER },
- { " vfb", "Virtual Framebuffer",
- dmenuFlagCheck, dmenuSetFlag, NULL, &XOrgDists, '[', 'X', ']', DIST_XORG_VFBSERVER },
- { NULL } },
-};
-
-DMenu MenuDiskDevices = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "Select Drive(s)",
- "Please select the drive, or drives, on which you wish to perform\n"
- "this operation. If you are attempting to install a boot partition\n"
- "on a drive other than the first one or have multiple operating\n"
- "systems on your machine, you will have the option to install a boot\n"
- "manager later. To select a drive, use the arrow keys to move to it\n"
- "and press [SPACE] or [ENTER]. To de-select it, press it again.\n\n"
- "Use [TAB] to get to the buttons and leave this menu.",
- "Press F1 for important information regarding disk geometry!",
- "drives",
- { { NULL } },
-};
-
-DMenu MenuHTMLDoc = {
- DMENU_NORMAL_TYPE,
- "Select HTML Documentation pointer",
- "Please select the body of documentation you're interested in, the main\n"
- "ones right now being the FAQ and the Handbook. You can also choose \"other\"\n"
- "to enter an arbitrary URL for browsing.",
- "Press F1 for more help on what you see here.",
- "html",
- { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
- { "2 Handbook", "The FreeBSD Handbook.", NULL, docShowDocument },
- { "3 FAQ", "The Frequently Asked Questions guide.", NULL, docShowDocument },
- { "4 Home", "The Home Pages for the FreeBSD Project (requires net)", NULL, docShowDocument },
- { "5 Other", "Enter a URL.", NULL, docShowDocument },
- { NULL } },
-};
-
-/* The main installation menu */
-DMenu MenuInstallCustom = {
- DMENU_NORMAL_TYPE,
- "Choose Custom Installation Options",
- "This is the custom installation menu. You may use this menu to specify\n"
- "details on the type of distribution you wish to have, where you wish\n"
- "to install it from and how you wish to allocate disk storage to FreeBSD.",
- "Press F1 to read the installation guide",
- "INSTALL",
- { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
- { "2 Options", "View/Set various installation options", NULL, optionsEditor },
-#ifndef WITH_SLICES
- { "3 Label", "Label disk partitions", NULL, diskLabelEditor },
- { "4 Distributions", "Select distribution(s) to extract", NULL, dmenuSubmenu, NULL, &MenuDistributions },
- { "5 Media", "Choose the installation media type", NULL, dmenuSubmenu, NULL, &MenuMedia },
- { "6 Commit", "Perform any pending Partition/Label/Extract actions", NULL, installCustomCommit },
-#else
- { "3 Partition", "Allocate disk space for FreeBSD", NULL, diskPartitionEditor },
- { "4 Label", "Label allocated disk partitions", NULL, diskLabelEditor },
- { "5 Distributions", "Select distribution(s) to extract", NULL, dmenuSubmenu, NULL, &MenuDistributions },
- { "6 Media", "Choose the installation media type", NULL, dmenuSubmenu, NULL, &MenuMedia },
- { "7 Commit", "Perform any pending Partition/Label/Extract actions", NULL, installCustomCommit },
-#endif
- { NULL } },
-};
-
-#if defined(__i386__) || defined(__amd64__)
-#ifdef PC98
-/* IPL type menu */
-DMenu MenuIPLType = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "overwrite me", /* will be disk specific label */
- "If you want a FreeBSD Boot Manager, select \"BootMgr\". If you would\n"
- "prefer your Boot Manager to remain untouched then select \"None\".\n\n",
- "Press F1 to read about drive setup",
- "drives",
- { { "BootMgr", "Install the FreeBSD Boot Manager",
- dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr },
- { "None", "Leave the IPL untouched",
- dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 1 },
- { NULL } },
-};
-#else
-/* MBR type menu */
-DMenu MenuMBRType = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "overwrite me", /* will be disk specific label */
- "FreeBSD comes with a boot selector that allows you to easily\n"
- "select between FreeBSD and any other operating systems on your machine\n"
- "at boot time. If you have more than one drive and want to boot\n"
- "from the second one, the boot selector will also make it possible\n"
- "to do so (limitations in the PC BIOS usually prevent this otherwise).\n"
- "If you do not want a boot selector, or wish to replace an existing\n"
- "one, select \"standard\". If you would prefer your Master Boot\n"
- "Record to remain untouched then select \"None\".\n\n"
- " NOTE: PC-DOS users will almost certainly require \"None\"!",
- "Press F1 to read about drive setup",
- "drives",
- { { "BootMgr", "Install the FreeBSD Boot Manager",
- dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr },
- { "Standard", "Install a standard MBR (no boot manager)",
- dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 1 },
- { "None", "Leave the Master Boot Record untouched",
- dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 2 },
- { NULL } },
-};
-#endif /* PC98 */
-#endif /* __i386__ */
-
-/* Final configuration menu */
-DMenu MenuConfigure = {
- DMENU_NORMAL_TYPE,
- "FreeBSD Configuration Menu", /* title */
- "If you've already installed FreeBSD, you may use this menu to customize\n"
- "it somewhat to suit your particular configuration. Most importantly,\n"
- "you can use the Packages utility to load extra \"3rd party\"\n"
- "software not provided in the base distributions.",
- "Press F1 for more information on these options",
- "configure",
- { { "X Exit", "Exit this menu (returning to previous)",
- NULL, dmenuExit },
- { " Distributions", "Install additional distribution sets",
- NULL, distExtractAll },
- { " Packages", "Install pre-packaged software for FreeBSD",
- NULL, configPackages },
- { " Root Password", "Set the system manager's password",
- NULL, dmenuSystemCommand, NULL, "passwd root" },
-#ifdef WITH_SLICES
- { " Fdisk", "The disk Slice (PC-style partition) Editor",
- NULL, diskPartitionEditor },
-#endif
- { " Label", "The disk Label editor",
- NULL, diskLabelEditor },
- { " User Management", "Add user and group information",
- NULL, dmenuSubmenu, NULL, &MenuUsermgmt },
-#ifdef WITH_SYSCONS
- { " Console", "Customize system console behavior",
- NULL, dmenuSubmenu, NULL, &MenuSyscons },
-#endif
- { " Time Zone", "Set which time zone you're in",
- NULL, dmenuSystemCommand, NULL, "tzsetup" },
- { " Media", "Change the installation media type",
- NULL, dmenuSubmenu, NULL, &MenuMedia },
-#ifdef WITH_MICE
- { " Mouse", "Configure your mouse",
- NULL, dmenuSubmenu, NULL, &MenuMouse },
-#endif
- { " Networking", "Configure additional network services",
- NULL, dmenuSubmenu, NULL, &MenuNetworking },
- { " Security", "Configure system security options",
- NULL, dmenuSubmenu, NULL, &MenuSecurity },
- { " Startup", "Configure system startup options",
- NULL, dmenuSubmenu, NULL, &MenuStartup },
- { " TTYs", "Configure system ttys.",
- NULL, configEtcTtys, NULL, "ttys" },
- { " Options", "View/Set various installation options",
- NULL, optionsEditor },
- { " HTML Docs", "Go to the HTML documentation menu (post-install)",
- NULL, docBrowser },
- { " Load KLD", "Load a KLD from a floppy",
- NULL, kldBrowser },
- { NULL } },
-};
-
-DMenu MenuStartup = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "Startup Services Menu",
- "This menu allows you to configure various aspects of your system's\n"
- "startup configuration. Use [SPACE] or [ENTER] to select items, and\n"
- "[TAB] to move to the buttons. Select Exit to leave this menu.",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
-#ifdef __i386__
- { " APM", "Auto-power management services (typically laptops)",
- dmenuVarCheck, dmenuToggleVariable, NULL, "apm_enable=YES" },
-#endif
-#ifdef PCCARD_ARCH
- { " pccard", "Enable PCCARD (AKA PCMCIA) services (also laptops)",
- dmenuVarCheck, dmenuToggleVariable, NULL, "pccard_enable=YES" },
- { " pccard mem", "Set PCCARD memory address (if enabled)",
- dmenuVarCheck, dmenuISetVariable, NULL, "pccard_mem" },
- { " pccard ifconfig", "List of PCCARD ethernet devices to configure",
- dmenuVarCheck, dmenuISetVariable, NULL, "pccard_ifconfig" },
-#endif
- { " usbd", "Enable USB daemon (detect USB attach / detach)",
- dmenuVarCheck, dmenuToggleVariable, NULL, "usbd_enable=YES" },
- { " usbd flags", "Set default flags to usbd (if enabled)",
- dmenuVarCheck, dmenuISetVariable, NULL, "usbd_flags" },
- { " ", " -- ", NULL, NULL, NULL, NULL, ' ', ' ', ' ' },
- { " Startup dirs", "Set the list of dirs to look for startup scripts",
- dmenuVarCheck, dmenuISetVariable, NULL, "local_startup" },
- { " named", "Run a local name server on this host",
- dmenuVarCheck, dmenuToggleVariable, NULL, "named_enable=YES" },
- { " named flags", "Set default flags to named (if enabled)",
- dmenuVarCheck, dmenuISetVariable, NULL, "named_flags" },
- { " NIS client", "This host wishes to be an NIS client.",
- dmenuVarCheck, configRpcBind, NULL, "nis_client_enable=YES" },
- { " NIS domainname", "Set NIS domainname (if enabled)",
- dmenuVarCheck, dmenuISetVariable, NULL, "nisdomainname" },
- { " NIS server", "This host wishes to be an NIS server.",
- dmenuVarCheck, configRpcBind, NULL, "nis_server_enable=YES" },
- { " ", " -- ", NULL, NULL, NULL, NULL, ' ', ' ', ' ' },
- { " Accounting", "This host wishes to run process accounting.",
- dmenuVarCheck, dmenuToggleVariable, NULL, "accounting_enable=YES" },
- { " lpd", "This host has a printer and wants to run lpd.",
- dmenuVarCheck, dmenuToggleVariable, NULL, "lpd_enable=YES" },
-#ifdef WITH_LINUX
- { " Linux", "This host wants to be able to run Linux binaries.",
- dmenuVarCheck, configLinux, NULL, VAR_LINUX_ENABLE "=YES" },
-#endif
-#ifdef __i386__
- { " SCO", "This host wants to be able to run IBCS2 binaries.",
- dmenuVarCheck, dmenuToggleVariable, NULL, "ibcs2_enable=YES" },
- { " SVR4", "This host wants to be able to run SVR4 binaries.",
- dmenuVarCheck, dmenuToggleVariable, NULL, "svr4_enable=YES" },
-#endif
-#ifdef __alpha__
- { " OSF/1", "This host wants to be able to run DEC OSF/1 binaries.",
- dmenuVarCheck, configOSF1, NULL, VAR_OSF1_ENABLE "=YES" },
-#endif
- { " quotas", "This host wishes to check quotas on startup.",
- dmenuVarCheck, dmenuToggleVariable, NULL, "check_quotas=YES" },
- { NULL } },
-};
-
-DMenu MenuNetworking = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "Network Services Menu",
- "You may have already configured one network device (and the other\n"
- "various hostname/gateway/name server parameters) in the process\n"
- "of installing FreeBSD. This menu allows you to configure other\n"
- "aspects of your system's network configuration.",
- NULL,
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { " Interfaces", "Configure additional network interfaces",
- NULL, tcpMenuSelect },
- { " AMD", "This machine wants to run the auto-mounter service",
- dmenuVarCheck, configRpcBind, NULL, "amd_enable=YES" },
- { " AMD Flags", "Set flags to AMD service (if enabled)",
- dmenuVarCheck, dmenuISetVariable, NULL, "amd_flags" },
- { " Anon FTP", "This machine wishes to allow anonymous FTP.",
- dmenuVarCheck, configAnonFTP, NULL, "anon_ftp" },
- { " Gateway", "This machine will route packets between interfaces",
- dmenuVarCheck, dmenuToggleVariable, NULL, "gateway_enable=YES" },
- { " inetd", "This machine wants to run the inet daemon",
- dmenuVarCheck, configInetd, NULL, "inetd_enable=YES" },
- { " Mail", "This machine wants to run a Mail Transfer Agent",
- NULL, dmenuSubmenu, NULL, &MenuMTA },
- { " NFS client", "This machine will be an NFS client",
- dmenuVarCheck, dmenuToggleVariable, NULL, "nfs_client_enable=YES" },
- { " NFS server", "This machine will be an NFS server",
- dmenuVarCheck, configNFSServer, NULL, "nfs_server_enable=YES" },
- { " Ntpdate", "Select a clock-synchronization server",
- dmenuVarCheck, dmenuSubmenu, NULL, &MenuNTP, '[', 'X', ']',
- (uintptr_t)"ntpdate_enable=YES" },
- { " PCNFSD", "Run authentication server for clients with PC-NFS.",
- dmenuVarCheck, configPCNFSD, NULL, "pcnfsd" },
- { " rpcbind", "RPC port mapping daemon (formerly portmapper)",
- dmenuVarCheck, dmenuToggleVariable, NULL, "rpcbind_enable=YES" },
- { " rpc.statd", "NFS status monitoring daemon",
- dmenuVarCheck, configRpcBind, NULL, "rpc_statd_enable=YES" },
- { " rpc.lockd", "NFS file locking daemon",
- dmenuVarCheck, configRpcBind, NULL, "rpc_lockd_enable=YES" },
- { " Routed", "Select routing daemon (default: routed)",
- dmenuVarCheck, configRouter, NULL, "router_enable=YES" },
- { " Rwhod", "This machine wants to run the rwho daemon",
- dmenuVarCheck, dmenuToggleVariable, NULL, "rwhod_enable=YES" },
- { " sshd", "This machine wants to run the SSH daemon",
- dmenuVarCheck, dmenuToggleVariable, NULL, "sshd_enable=YES" },
- { " TCP Extensions", "Allow RFC1323 and RFC1644 TCP extensions?",
- dmenuVarCheck, dmenuToggleVariable, NULL, "tcp_extensions=YES" },
- { NULL } },
-};
-
-DMenu MenuMTA = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Mail Transfer Agent Selection",
- "You can choose which Mail Transfer Agent (MTA) you wish to install and run.\n"
- "Selecting Sendmail local disables sendmail's network socket for\n"
- "incoming mail, but still enables sendmail for local and outbound mail.\n"
- "The Postfix option will install the Postfix MTA from the ports\n"
- "collection. The Exim option will install the Exim MTA from the ports\n"
- "collection. To return to the previous menu, select Exit.",
- NULL,
- NULL,
- {
- { "Sendmail", "Use sendmail",
- dmenuVarCheck, dmenuSetVariable, NULL, "sendmail_enable=YES" },
- { "Sendmail local", "Use sendmail, but do not listen on the network",
- dmenuVarCheck, dmenuSetVariable, NULL, "sendmail_enable=NO" },
- { "Postfix", "Use the Postfix MTA",
- NULL, configMTAPostfix, NULL, NULL },
- { "Exim", "Use the Exim MTA",
- NULL, configMTAExim, NULL, NULL },
- { "None", "Do not install an MTA",
- dmenuVarCheck, dmenuSetVariable, NULL, "sendmail_enable=NONE" },
- { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { NULL } },
-};
-
-DMenu MenuNTP = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "NTPDATE Server Selection",
- "There are a number of time synchronization servers available\n"
- "for public use around the Internet. Please select one reasonably\n"
- "close to you to have your system time synchronized accordingly.",
- "These are the primary open-access NTP servers",
- NULL,
- { { "None", "No NTP server",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=NO,ntpdate_flags=none" },
- { "Other", "Select a site not on this list",
- dmenuVarsCheck, configNTP, NULL, NULL },
- { "Worldwide", "pool.ntp.org",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=pool.ntp.org" },
- { "Asia", "asia.pool.ntp.org",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=asia.pool.ntp.org" },
- { "Europe", "europe.pool.ntp.org",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=europe.pool.ntp.org" },
- { "Oceania", "oceania.pool.ntp.org",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=oceania.pool.ntp.org" },
- { "North America", "north-america.pool.ntp.org",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=north-america.pool.ntp.org" },
- { "Argentina", "tick.nap.com.ar",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tick.nap.com.ar" },
- { "Argentina #2", "time.sinectis.com.ar",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.sinectis.com.ar" },
- { "Argentina #3", "tock.nap.com.ar",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tock.nap.com.ar" },
- { "Australia", "augean.eleceng.adelaide.edu.au",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=augean.eleceng.adelaide.edu.au" },
- { "Australia #2", "ntp.adelaide.edu.au",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.adelaide.edu.au" },
- { "Australia #3", "ntp.saard.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.saard.net" },
- { "Australia #4", "time.deakin.edu.au",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.deakin.edu.au" },
- { "Australia #5", "time.esec.com.au",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.esec.com.au" },
- { "Belgium", "ntp1.belbone.be",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.belbone.be" },
- { "Belgium #2", "ntp2.belbone.be",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2.belbone.be" },
- { "Brazil", "ntp.cais.rnp.br",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.cais.rnp.br" },
- { "Brazil #2", "ntp.pop-df.rnp.br",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.pop-df.rnp.br" },
- { "Brazil #3", "ntp.ufes.br",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.ufes.br" },
- { "Brazil #4", "ntp1.pucpr.br",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.pucpr.br" },
- { "Canada", "ntp.cpsc.ucalgary.ca",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.cpsc.ucalgary.ca" },
- { "Canada #2", "ntp1.cmc.ec.gc.ca",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.cmc.ec.gc.ca" },
- { "Canada #3", "ntp2.cmc.ec.gc.ca",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2.cmc.ec.gc.ca" },
- { "Canada #4", "tick.utoronto.ca",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tick.utoronto.ca" },
- { "Canada #5", "time.chu.nrc.ca",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.chu.nrc.ca" },
- { "Canada #6", "time.nrc.ca",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.nrc.ca" },
- { "Canada #7", "timelord.uregina.ca",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=timelord.uregina.ca" },
- { "Canada #8", "tock.utoronto.ca",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tock.utoronto.ca" },
- { "Czech", "ntp.karpo.cz",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.karpo.cz" },
- { "Denmark", "clock.netcetera.dk",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=clock.netcetera.dk" },
- { "Denmark", "clock2.netcetera.dk",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=clock2.netcetera.dk" },
- { "Spain", "slug.ctv.es",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=slug.ctv.es" },
- { "Finland", "tick.keso.fi",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tick.keso.fi" },
- { "Finland #2", "tock.keso.fi",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tock.keso.fi" },
- { "France", "ntp.obspm.fr",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.obspm.fr" },
- { "France #2", "ntp.univ-lyon1.fr",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.univ-lyon1.fr" },
- { "France #3", "ntp.via.ecp.fr",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.via.ecp.fr" },
- { "Croatia", "zg1.ntp.carnet.hr",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=zg1.ntp.carnet.hr" },
- { "Croatia #2", "zg2.ntp.carnet.hr",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=zg2.ntp.carnet.hr" },
- { "Croatia #3", "st.ntp.carnet.hr",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=st.ntp.carnet.hr" },
- { "Croatia #4", "ri.ntp.carnet.hr",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ri.ntp.carnet.hr" },
- { "Croatia #5", "os.ntp.carnet.hr",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=os.ntp.carnet.hr" },
- { "Hungary", "time.kfki.hu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.kfki.hu" },
- { "Indonesia", "ntp.incaf.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.incaf.net" },
- { "Ireland", "ntp.maths.tcd.ie",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.maths.tcd.ie" },
- { "Italy", "ntps.net4u.it",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=" },
- { "Japan", "ntp.jst.mfeed.ad.jp",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.jst.mfeed.ad.jp" },
- { "Japan IPv6", "ntp1.v6.mfeed.ad.jp",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.v6.mfeed.ad.jp" },
- { "Korea", "time.nuri.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.nuri.net" },
- { "Mexico", "ntp2a.audiotel.com.mx",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2a.audiotel.com.mx" },
- { "Mexico #2", "ntp2b.audiotel.com.mx",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2b.audiotel.com.mx" },
- { "Mexico #3", "ntp2c.audiotel.com.mx",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2c.audiotel.com.mx" },
- { "Nigeria", "ntp.supernet300.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.supernet300.com" },
- { "Netherlands", "ntp0.nl.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp0.nl.net" },
- { "Netherlands #2", "ntp1.nl.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.nl.net" },
- { "Netherlands #3", "ntp2.nl.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2.nl.net" },
- { "Norway", "fartein.ifi.uio.no",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=fartein.ifi.uio.no" },
- { "Norway #2", "time.alcanet.no",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.alcanet.no" },
- { "New Zealand", "ntp.massey.ac.nz",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.massey.ac.nz" },
- { "New Zealand #2", "ntp.public.otago.ac.nz",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.public.otago.ac.nz" },
- { "New Zealand #3", "tk1.ihug.co.nz",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tk1.ihug.co.nz" },
- { "New Zealand #4", "ntp.waikato.ac.nz",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.waikato.ac.nz" },
- { "Poland", "info.cyf-kr.edu.pl",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=info.cyf-kr.edu.pl" },
- { "Portugal", "bug.fe.up.pt",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=bug.fe.up.pt" },
- { "Romania", "ticks.roedu.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ticks.roedu.net" },
- { "Russia", "ntp.psn.ru",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.psn.ru" },
- { "Russia #2", "sign.chg.ru",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=sign.chg.ru" },
- { "Sweden", "ntp.lth.se",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.lth.se" },
- { "Singapore", "ntp.shim.org",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.shim.org" },
- { "Slovenia", "calvus.rzs-hm.si",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=calvus.rzs-hm.si" },
- { "Slovenia #2", "sizif.mf.uni-lj.si",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=sizif.mf.uni-lj.si" },
- { "Slovenia #3", "ntp1.arnes.si",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.arnes.si" },
- { "Slovenia #4", "ntp2.arnes.si",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2.arnes.si" },
- { "Slovenia #5", "time.ijs.si",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.ijs.si" },
- { "Scotland", "ntp.cs.strath.ac.uk",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.cs.strath.ac.uk" },
- { "United Kingdom", "ntp.exnet.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.exnet.com" },
- { "United Kingdom #2", "ntp0.uk.uu.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp0.uk.uu.net" },
- { "United Kingdom #3", "ntp1.uk.uu.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.uk.uu.net" },
- { "United Kingdom #4", "ntp2.uk.uu.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2.uk.uu.net" },
- { "United Kingdom #5", "ntp2a.mcc.ac.uk",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2a.mcc.ac.uk" },
- { "United Kingdom #6", "ntp2b.mcc.ac.uk",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2b.mcc.ac.uk" },
- { "United Kingdom #7", "ntp2c.mcc.ac.uk",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2c.mcc.ac.uk" },
- { "United Kingdom #8", "ntp2d.mcc.ac.uk",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2d.mcc.ac.uk" },
- { "United Kingdom #9", "tick.tanac.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tick.tanac.net" },
- { "U.S. AR", "sushi.compsci.lyon.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=sushi.compsci.lyon.edu" },
- { "U.S. AZ", "ntp.drydog.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.drydog.com" },
- { "U.S. CA", "ntp.ucsd.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.ucsd.edu" },
- { "U.S. CA #2", "ntp1.mainecoon.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.mainecoon.com" },
- { "U.S. CA #3", "ntp2.mainecoon.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2.mainecoon.com" },
- { "U.S. CA #4", "reloj.kjsl.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=reloj.kjsl.com" },
- { "U.S. CA #5", "time.five-ten-sg.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time.five-ten-sg.com" },
- { "U.S. DE", "louie.udel.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=louie.udel.edu" },
- { "U.S. GA", "ntp.shorty.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.shorty.com" },
- { "U.S. GA #2", "rolex.usg.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=rolex.usg.edu" },
- { "U.S. GA #3", "timex.usg.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=timex.usg.edu" },
- { "U.S. IL", "ntp-0.cso.uiuc.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp-0.cso.uiuc.edu" },
- { "U.S. IL #2", "ntp-1.cso.uiuc.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp-1.cso.uiuc.edu" },
- { "U.S. IL #3", "ntp-1.mcs.anl.gov",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp-1.mcs.anl.gov" },
- { "U.S. IL #4", "ntp-2.cso.uiuc.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp-2.cso.uiuc.edu" },
- { "U.S. IL #5", "ntp-2.mcs.anl.gov",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp-2.mcs.anl.gov" },
- { "U.S. IN", "gilbreth.ecn.purdue.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=gilbreth.ecn.purdue.edu" },
- { "U.S. IN #2", "harbor.ecn.purdue.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=harbor.ecn.purdue.edu" },
- { "U.S. IN #3", "molecule.ecn.purdue.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=molecule.ecn.purdue.edu" },
- { "U.S. KS", "ntp1.kansas.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.kansas.net" },
- { "U.S. KS #2", "ntp2.kansas.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2.kansas.net" },
- { "U.S. MA", "ntp.ourconcord.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.ourconcord.net" },
- { "U.S. MA #2", "timeserver.cs.umb.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=timeserver.cs.umb.edu" },
- { "U.S. MN", "ns.nts.umn.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ns.nts.umn.edu" },
- { "U.S. MN #2", "nss.nts.umn.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=nss.nts.umn.edu" },
- { "U.S. MO", "time-ext.missouri.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=time-ext.missouri.edu" },
- { "U.S. MT", "chronos1.umt.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=chronos1.umt.edu" },
- { "U.S. MT #2", "chronos2.umt.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=chronos2.umt.edu" },
- { "U.S. MT #3", "chronos3.umt.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=chronos3.umt.edu" },
- { "U.S. NC", "clock1.unc.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=clock1.unc.edu" },
- { "U.S. NV", "cuckoo.nevada.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=cuckoo.nevada.edu" },
- { "U.S. NV #2", "tick.cs.unlv.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tick.cs.unlv.edu" },
- { "U.S. NV #3", "tock.cs.unlv.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tock.cs.unlv.edu" },
- { "U.S. NY", "clock.linuxshell.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=clock.linuxshell.net" },
- { "U.S. NY #2", "ntp.ctr.columbia.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.ctr.columbia.edu" },
- { "U.S. NY #3", "ntp0.cornell.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp0.cornell.edu" },
- { "U.S. NY #4", "ntp1.mpis.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.mpis.net" },
- { "U.S. NY #5", "ntp2.mpis.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2.mpis.net" },
- { "U.S. NY #6", "sundial.columbia.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=sundial.columbia.edu" },
- { "U.S. NY #7", "timex.cs.columbia.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=timex.cs.columbia.edu" },
- { "U.S. OK", "constellation.ecn.uoknor.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=constellation.ecn.uoknor.edu" },
- { "U.S. PA", "clock-1.cs.cmu.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=clock-1.cs.cmu.edu" },
- { "U.S. PA #2", "clock-2.cs.cmu.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=clock-2.cs.cmu.edu" },
- { "U.S. PA #3", "clock.psu.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=clock.psu.edu" },
- { "U.S. PA #4", "fuzz.psc.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=fuzz.psc.edu" },
- { "U.S. PA #5", "ntp-1.ece.cmu.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp-1.ece.cmu.edu" },
- { "U.S. PA #6", "ntp-2.ece.cmu.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp-2.ece.cmu.edu" },
- { "U.S. TX", "ntp.cox.smu.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.cox.smu.edu" },
- { "U.S. TX #2", "ntp.fnbhs.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.fnbhs.com" },
- { "U.S. TX #3", "ntp.tmc.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.tmc.edu" },
- { "U.S. TX #4", "ntp5.tamu.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp5.tamu.edu" },
- { "U.S. TX #5", "tick.greyware.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tick.greyware.com" },
- { "U.S. TX #6", "tock.greyware.com",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=tock.greyware.com" },
- { "U.S. VA", "ntp-1.vt.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp-1.vt.edu" },
- { "U.S. VA #2", "ntp-2.vt.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp-2.vt.edu" },
- { "U.S. VA #3", "ntp.cmr.gov",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.cmr.gov" },
- { "U.S. VT", "ntp0.state.vt.us",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp0.state.vt.us" },
- { "U.S. VT #2", "ntp1.state.vt.us",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.state.vt.us" },
- { "U.S. VT #3", "ntp2.state.vt.us",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp2.state.vt.us" },
- { "U.S. WA", "clock.tricity.wsu.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=clock.tricity.wsu.edu" },
- { "U.S. WA #2", "ntp.tcp-udp.net",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.tcp-udp.net" },
- { "U.S. WI", "ntp1.cs.wisc.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp1.cs.wisc.edu" },
- { "U.S. WI #2", "ntp3.cs.wisc.edu",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp3.cs.wisc.edu" },
- { "Venezuela", "ntp.linux.org.ve",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.linux.org.ve" },
- { "South Africa", "ntp.cs.unp.ac.za",
- dmenuVarsCheck, dmenuSetVariables, NULL,
- "ntpdate_enable=YES,ntpdate_flags=ntp.cs.unp.ac.za" },
- { NULL } },
-};
-
-#ifdef WITH_SYSCONS
-DMenu MenuSyscons = {
- DMENU_NORMAL_TYPE,
- "System Console Configuration",
- "The default system console driver for FreeBSD (syscons) has a\n"
- "number of configuration options which may be set according to\n"
- "your preference.\n\n"
- "When you are done setting configuration options, select Cancel.",
- "Configure your system console settings",
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
-#ifdef PC98
- { "2 Keymap", "Choose an alternate keyboard map", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap },
- { "3 Repeat", "Set the rate at which keys repeat", NULL, dmenuSubmenu, NULL, &MenuSysconsKeyrate },
- { "4 Saver", "Configure the screen saver", NULL, dmenuSubmenu, NULL, &MenuSysconsSaver },
-#else
- { "2 Font", "Choose an alternate screen font", NULL, dmenuSubmenu, NULL, &MenuSysconsFont },
- { "3 Keymap", "Choose an alternate keyboard map", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap },
- { "4 Repeat", "Set the rate at which keys repeat", NULL, dmenuSubmenu, NULL, &MenuSysconsKeyrate },
- { "5 Saver", "Configure the screen saver", NULL, dmenuSubmenu, NULL, &MenuSysconsSaver },
- { "6 Screenmap", "Choose an alternate screenmap", NULL, dmenuSubmenu, NULL, &MenuSysconsScrnmap },
- { "7 Ttys", "Choose console terminal type", NULL, dmenuSubmenu, NULL, &MenuSysconsTtys },
-#endif
- { NULL } },
-};
-
-#ifdef PC98
-DMenu MenuSysconsKeymap = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "System Console Keymap",
- "The default system console driver for FreeBSD (syscons) defaults\n"
- "to a standard \"PC-98x1\" keyboard map. Users may wish to choose\n"
- "one of the other keymaps below.\n"
- "Note that sysinstall itself only uses the part of the keyboard map\n"
- "which is required to generate the ANSI character subset, but your\n"
- "choice of keymap will also be saved for later (fuller) use.",
- "Choose a keyboard map",
- NULL,
- { { "Japanese PC-98x1", "Japanese PC-98x1 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=jp.pc98" },
- { " Japanese PC-98x1 (ISO)", "Japanese PC-98x1 (ISO) keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=jp.pc98.iso" },
- { NULL } },
-};
-#else
-DMenu MenuSysconsKeymap = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "System Console Keymap",
- "The default system console driver for FreeBSD (syscons) defaults\n"
- "to a standard \"American\" keyboard map. Users in other countries\n"
- "(or with different keyboard preferences) may wish to choose one of\n"
- "the other keymaps below.\n"
- "Note that sysinstall itself only uses the part of the keyboard map\n"
- "which is required to generate the ANSI character subset, but your\n"
- "choice of keymap will also be saved for later (fuller) use.",
- "Choose a keyboard map",
- NULL,
- { { "Belgian", "Belgian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=be.iso" },
- { " Brazil CP850", "Brazil CP850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=br275.cp850" },
- { " Brazil ISO (accent)", "Brazil ISO keymap (accent keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=br275.iso.acc" },
- { " Brazil ISO", "Brazil ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=br275.iso" },
- { " Bulgarian BDS", "Bulgarian BDS keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=bg.bds.ctrlcaps" },
- { " Bulgarian Phonetic", "Bulgarian Phonetic keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=bg.phonetic.ctrlcaps" },
- { "Central European ISO", "Central European ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ce.iso2" },
- { " Croatian ISO", "Croatian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=hr.iso" },
- { " Czech ISO (accent)", "Czech ISO keymap (accent keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=cs.latin2.qwertz" },
- { "Danish CP865", "Danish Code Page 865 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=danish.cp865" },
- { " Danish ISO", "Danish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=danish.iso" },
- { "Estonian ISO", "Estonian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=estonian.iso" },
- { " Estonian ISO 15", "Estonian ISO 8859-15 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=estonian.iso15" },
- { " Estonian CP850", "Estonian Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=estonian.cp850" },
- { "Finnish CP850","Finnish Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=finnish.cp850" },
- { " Finnish ISO", "Finnish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=finnish.iso" },
- { " French ISO (accent)", "French ISO keymap (accent keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=fr.iso.acc" },
- { " French ISO", "French ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=fr.iso" },
- { "German CP850", "German Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=german.cp850" },
- { " German ISO", "German ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=german.iso" },
- { " Greek 101", "Greek ISO keymap (101 keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=gr.us101.acc" },
- { " Greek 104", "Greek ISO keymap (104 keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=el.iso07" },
- { " Greek ELOT", "Greek ISO keymap (ELOT 1000)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=gr.elot.acc" },
- { "Hungarian 101", "Hungarian ISO keymap (101 key)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=hu.iso2.101keys" },
- { " Hungarian 102", "Hungarian ISO keymap (102 key)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=hu.iso2.102keys" },
- { "Icelandic (accent)", "Icelandic ISO keymap (accent keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=icelandic.iso.acc" },
- { " Icelandic", "Icelandic ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=icelandic.iso" },
- { " Italian", "Italian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=it.iso" },
- { "Japanese 106", "Japanese 106 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=jp.106" },
- { "Latin American (accent)", "Latin American ISO keymap (accent keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=latinamerican.iso.acc" },
- { " Latin American", "Latin American ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=latinamerican" },
- { "Norway ISO", "Norwegian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=norwegian.iso" },
- { "Polish ISO", "Polish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=pl_PL.ISO8859-2" },
- { " Portuguese (accent)", "Portuguese ISO keymap (accent keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=pt.iso.acc" },
- { " Portuguese", "Portuguese ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=pt.iso" },
- { "Russia KOI8-R", "Russian KOI8-R keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ru.koi8-r" },
- { "Slovak", "Slovak ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=sk.iso2" },
- { "Slovenian", "Slovenian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=si.iso" },
- { " Spanish (accent)", "Spanish ISO keymap (accent keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=spanish.iso.acc" },
- { " Spanish", "Spanish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=spanish.iso" },
- { " Swedish CP850", "Swedish Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swedish.cp850" },
- { " Swedish ISO", "Swedish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swedish.iso" },
- { " Swiss French ISO (accent)", "Swiss French ISO keymap (accent keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swissfrench.iso.acc" },
- { " Swiss French ISO", "Swiss French ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swissfrench.iso" },
- { " Swiss French CP850", "Swiss French Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swissfrench.cp850" },
- { " Swiss German ISO (accent)", "Swiss German ISO keymap (accent keys)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swissgerman.iso.acc" },
- { " Swiss German ISO", "Swiss German ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swissgerman.iso" },
- { " Swiss German CP850", "Swiss German Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swissgerman.cp850" },
- { "UK CP850", "UK Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=uk.cp850" },
- { " UK ISO", "UK ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=uk.iso" },
- { " Ukrainian KOI8-U", "Ukrainian KOI8-U keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ua.koi8-u" },
- { " Ukrainian KOI8-U+KOI8-R", "Ukrainian KOI8-U+KOI8-R keymap (alter)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ua.koi8-u.shift.alt" },
- { " USA CapsLock->Ctrl", "US standard (Caps as L-Control)", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.pc-ctrl" },
- { " USA Dvorak", "US Dvorak keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.dvorak" },
- { " USA Dvorak (left)", "US left handed Dvorak keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.dvorakl" },
- { " USA Dvorak (right)", "US right handed Dvorak keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.dvorakr" },
- { " USA Emacs", "US standard optimized for EMACS", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.emacs" },
- { " USA ISO", "US ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.iso" },
- { " USA UNIX", "US traditional UNIX-workstation", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.unix" },
- { NULL } },
-};
-#endif /* PC98 */
-
-DMenu MenuSysconsKeyrate = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "System Console Keyboard Repeat Rate",
- "This menu allows you to set the speed at which keys repeat\n"
- "when held down.",
- "Choose a keyboard repeat rate",
- NULL,
- { { "Slow", "Slow keyboard repeat rate", dmenuVarCheck, dmenuSetVariable, NULL, "keyrate=slow" },
- { "Normal", "\"Normal\" keyboard repeat rate", dmenuVarCheck, dmenuSetVariable, NULL, "keyrate=normal" },
- { "Fast", "Fast keyboard repeat rate", dmenuVarCheck, dmenuSetVariable, NULL, "keyrate=fast" },
- { "Default", "Use default keyboard repeat rate", dmenuVarCheck, dmenuSetVariable, NULL, "keyrate=NO" },
- { NULL } },
-};
-
-DMenu MenuSysconsSaver = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "System Console Screen Saver",
- "By default, the console driver will not attempt to do anything\n"
- "special with your screen when it's idle. If you expect to leave your\n"
- "monitor switched on and idle for long periods of time then you should\n"
- "probably enable one of these screen savers to prevent phosphor burn-in.",
- "Choose a nifty-looking screen saver",
- NULL,
- { { "1 Blank", "Simply blank the screen",
- dmenuVarCheck, configSaver, NULL, "saver=blank" },
- { "2 Daemon", "\"BSD Daemon\" animated screen saver (text)",
- dmenuVarCheck, configSaver, NULL, "saver=daemon" },
- { "3 Fade", "Fade out effect screen saver",
- dmenuVarCheck, configSaver, NULL, "saver=fade" },
- { "4 Fire", "Flames effect screen saver",
- dmenuVarCheck, configSaver, NULL, "saver=fire" },
- { "5 Green", "\"Green\" power saving mode (if supported by monitor)",
- dmenuVarCheck, configSaver, NULL, "saver=green" },
- { "6 Logo", "\"BSD Daemon\" animated screen saver (graphics)",
- dmenuVarCheck, configSaver, NULL, "saver=logo" },
- { "7 Rain", "Rain drops screen saver",
- dmenuVarCheck, configSaver, NULL, "saver=rain" },
- { "8 Snake", "Draw a FreeBSD \"snake\" on your screen",
- dmenuVarCheck, configSaver, NULL, "saver=snake" },
- { "9 Star", "A \"twinkling stars\" effect",
- dmenuVarCheck, configSaver, NULL, "saver=star" },
- { "Warp", "A \"stars warping\" effect",
- dmenuVarCheck, configSaver, NULL, "saver=warp" },
- { "Dragon", "Dragon screensaver (graphics)",
- dmenuVarCheck, configSaver, NULL, "saver=dragon" },
- { "Timeout", "Set the screen saver timeout interval",
- NULL, configSaverTimeout, NULL, NULL, ' ', ' ', ' ' },
- { NULL } },
-};
-
-#ifndef PC98
-DMenu MenuSysconsScrnmap = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "System Console Screenmap",
- "Unless you load a specific font, most PC hardware defaults to\n"
- "displaying characters in the IBM 437 character set. However,\n"
- "in the Unix world, this character set is very rarely used. Most\n"
- "Western European countries, for example, prefer ISO 8859-1.\n"
- "American users won't notice the difference since the bottom half\n"
- "of all these character sets is ANSI anyway.\n"
- "If your hardware is capable of downloading a new display font,\n"
- "you should probably choose that option. However, for hardware\n"
- "where this is not possible (e.g. monochrome adapters), a screen\n"
- "map will give you the best approximation that your hardware can\n"
- "display at all.",
- "Choose a screen map",
- NULL,
- { { "1 None", "No screenmap, don't touch font", dmenuVarCheck, dmenuSetVariable, NULL, "scrnmap=NO" },
- { "2 ISO 8859-1 to IBM437", "W-Europe ISO 8859-1 to IBM 437 screenmap", dmenuVarCheck, dmenuSetVariable, NULL, "scrnmap=iso-8859-1_to_cp437" },
- { "3 ISO 8859-7 to IBM437", "Greek ISO 8859-7 to IBM 437 screenmap", dmenuVarCheck, dmenuSetVariable, NULL, "scrnmap=iso-8859-7_to_cp437" },
- { "4 US-ASCII to IBM437", "US-ASCII to IBM 437 screenmap", dmenuVarCheck, dmenuSetVariable, NULL, "scrnmap=us-ascii_to_cp437" },
- { "5 KOI8-R to IBM866", "Russian KOI8-R to IBM 866 screenmap", dmenuVarCheck, dmenuSetVariable, NULL, "scrnmap=koi8-r2cp866" },
- { "6 KOI8-U to IBM866u", "Ukrainian KOI8-U to IBM 866u screenmap", dmenuVarCheck, dmenuSetVariable, NULL, "scrnmap=koi8-u2cp866u" },
- { NULL } },
-};
-
-DMenu MenuSysconsTtys = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "System Console Terminal Type",
- "For various console encodings, a corresponding terminal type\n"
- "must be chosen in /etc/ttys.\n\n"
- "WARNING: For compatibility reasons, only entries starting with\n"
- "ttyv and terminal types starting with cons[0-9] can be changed\n"
- "via this menu.\n",
- "Choose a terminal type",
- NULL,
- { { "1 None", "Don't touch anything", dmenuVarCheck, dmenuSetVariable, NULL, VAR_CONSTERM "=NO" },
- { "2 IBM437 (VGA default)", "cons25", dmenuVarCheck, dmenuSetVariable, NULL, VAR_CONSTERM "=cons25" },
- { "3 ISO 8859-1", "cons25l1", dmenuVarCheck, dmenuSetVariable, NULL, VAR_CONSTERM "=cons25l1" },
- { "4 ISO 8859-2", "cons25l2", dmenuVarCheck, dmenuSetVariable, NULL, VAR_CONSTERM "=cons25l2" },
- { "5 ISO 8859-7", "cons25l7", dmenuVarCheck, dmenuSetVariable, NULL, VAR_CONSTERM "=cons25l7" },
- { "6 KOI8-R", "cons25r", dmenuVarCheck, dmenuSetVariable, NULL, VAR_CONSTERM "=cons25r" },
- { "7 KOI8-U", "cons25u", dmenuVarCheck, dmenuSetVariable, NULL, VAR_CONSTERM "=cons25u" },
- { "8 US-ASCII", "cons25w", dmenuVarCheck, dmenuSetVariable, NULL, VAR_CONSTERM "=cons25w" },
- { NULL } },
-};
-
-DMenu MenuSysconsFont = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "System Console Font",
- "Most PC hardware defaults to displaying characters in the\n"
- "IBM 437 character set. However, in the Unix world, this\n"
- "character set is very rarely used. Most Western European\n"
- "countries, for example, prefer ISO 8859-1.\n"
- "American users won't notice the difference since the bottom half\n"
- "of all these charactersets is ANSI anyway. However, they might\n"
- "want to load a font anyway to use the 30- or 50-line displays.\n"
- "If your hardware is capable of downloading a new display font,\n"
- "you can select the appropriate font below.",
- "Choose a font",
- NULL,
- { { "1 None", "Use hardware default font", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=NO,font8x14=NO,font8x16=NO" },
- { "2 IBM 437", "English and others, VGA default", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=cp437-8x8,font8x14=cp437-8x14,font8x16=cp437-8x16" },
- { "3 IBM 850", "Western Europe, IBM encoding", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=cp850-8x8,font8x14=cp850-8x14,font8x16=cp850-8x16" },
- { "4 IBM 865", "Norwegian, IBM encoding", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=cp865-8x8,font8x14=cp865-8x14,font8x16=cp865-8x16" },
- { "5 IBM 866", "Russian, IBM encoding (use with KOI8-R screenmap)", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=cp866-8x8,font8x14=cp866-8x14,font8x16=cp866b-8x16,mousechar_start=3" },
- { "6 IBM 866u", "Ukrainian, IBM encoding (use with KOI8-U screenmap)", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=cp866u-8x8,font8x14=cp866u-8x14,font8x16=cp866u-8x16,mousechar_start=3" },
- { "7 IBM 1251", "Cyrillic, MS Windows encoding", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=cp1251-8x8,font8x14=cp1251-8x14,font8x16=cp1251-8x16,mousechar_start=3" },
- { "8 ISO 8859-1", "Western Europe, ISO encoding", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=iso-8x8,font8x14=iso-8x14,font8x16=iso-8x16" },
- { "9 ISO 8859-2", "Eastern Europe, ISO encoding", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=iso02-8x8,font8x14=iso02-8x14,font8x16=iso02-8x16" },
- { "a ISO 8859-4", "Baltic, ISO encoding", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=iso04-8x8,font8x14=iso04-8x14,font8x16=iso04-8x16" },
- { "b ISO 8859-7", "Greek, ISO encoding", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=iso07-8x8,font8x14=iso07-8x14,font8x16=iso07-8x16" },
- { "c ISO 8859-8", "Hebrew, ISO encoding", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=iso08-8x8,font8x14=iso08-8x14,font8x16=iso08-8x16" },
- { "d ISO 8859-15", "Europe, ISO encoding", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=iso15-8x8,font8x14=iso15-8x14,font8x16=iso15-8x16" },
- { "e SWISS", "English, better resolution", dmenuVarCheck, dmenuSetVariables, NULL,
- "font8x8=swiss-8x8,font8x14=NO,font8x16=swiss-8x16" },
- { NULL } },
-};
-#endif /* PC98 */
-#endif /* WITH_SYSCONS */
-
-DMenu MenuUsermgmt = {
- DMENU_NORMAL_TYPE,
- "User and group management",
- "The submenus here allow to manipulate user groups and\n"
- "login accounts.\n",
- "Configure your user groups and users",
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
- { "User", "Add a new user to the system.", NULL, userAddUser },
- { "Group", "Add a new user group to the system.", NULL, userAddGroup },
- { NULL } },
-};
-
-DMenu MenuSecurity = {
- DMENU_CHECKLIST_TYPE | DMENU_SELECTION_RETURNS,
- "System Security Options Menu",
- "This menu allows you to configure aspects of the operating system security\n"
- "policy. Please read the system documentation carefully before modifying\n"
- "these settings, as they may cause service disruption if used improperly.\n"
- "\n"
- "Most settings will take affect only following a system reboot.",
- "Configure system security options",
- NULL,
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { " Securelevel", "Configure securelevels for the system",
- NULL, configSecurelevel },
-#if 0
- { " LOMAC", "Use Low Watermark Mandatory Access Control at boot",
- dmenuVarCheck, dmenuToggleVariable, NULL, "lomac_enable=YES" },
-#endif
- { " NFS port", "Require that the NFS clients used reserved ports",
- dmenuVarCheck, dmenuToggleVariable, NULL, "nfs_reserved_port_only=YES" },
- { NULL } },
-};
-
-DMenu MenuSecurelevel = {
- DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
- "Securelevel Configuration Menu",
- "This menu allows you to select the securelevel your system runs with.\n"
- "When operating at a securelevel, certain root privileges are disabled,\n"
- "which may increase resistance to exploits and protect system integrity.\n"
- "In secure mode system flags may not be overriden by the root user,\n"
- "access to direct kernel memory is limited, and kernel modules may not\n"
- "be changed. In highly secure mode, mounted file systems may not be\n"
- "modified on-disk, tampering with the system clock is prohibited. In\n"
- "network secure mode configuration changes to firwalling are prohibited.\n",
- "Select a securelevel to operate at - F1 for help",
- "securelevel",
- { { "X Exit", "Exit this menu (returning to previous)",
- checkTrue, dmenuExit, NULL, NULL, '<', '<', '<' },
- { "Disabled", "Disable securelevels", NULL, configSecurelevelDisabled, },
- { "Secure", "Secure mode", NULL, configSecurelevelSecure },
- { "Highly Secure", "Highly secure mode", NULL, configSecurelevelHighlySecure },
- { "Network Secure", "Network secure mode", NULL, configSecurelevelNetworkSecure },
- { NULL } }
-};
-
-DMenu MenuFixit = {
- DMENU_NORMAL_TYPE,
- "Please choose a fixit option",
- "There are three ways of going into \"fixit\" mode:\n"
- "- you can use the live filesystem CDROM/DVD, in which case there will be\n"
- " full access to the complete set of FreeBSD commands and utilities,\n"
- "- you can use the more limited (but perhaps customized) fixit floppy,\n"
- "- or you can start an Emergency Holographic Shell now, which is\n"
- " limited to the subset of commands that is already available right now.",
- "Press F1 for more detailed repair instructions",
- "fixit",
-{ { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit },
- { "2 CDROM/DVD", "Use the \"live\" filesystem CDROM/DVD", NULL, installFixitCDROM },
- { "3 Floppy", "Use a floppy generated from the fixit image", NULL, installFixitFloppy },
- { "4 Shell", "Start an Emergency Holographic Shell", NULL, installFixitHoloShell },
- { NULL } },
-};
diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c
deleted file mode 100644
index 07cbc81..0000000
--- a/usr.sbin/sade/misc.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * Miscellaneous support routines..
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/errno.h>
-#include <sys/file.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/wait.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <ufs/ufs/ufsmount.h>
-#include <sys/reboot.h>
-#include <sys/disklabel.h>
-#include <fs/msdosfs/msdosfsmount.h>
-
-/* Quick check to see if a file is readable */
-Boolean
-file_readable(char *fname)
-{
- if (!access(fname, F_OK))
- return TRUE;
- return FALSE;
-}
-
-/* Quick check to see if a file is executable */
-Boolean
-file_executable(char *fname)
-{
- if (!access(fname, X_OK))
- return TRUE;
- return FALSE;
-}
-
-/* Concatenate two strings into static storage */
-char *
-string_concat(char *one, char *two)
-{
- static char tmp[FILENAME_MAX];
-
- /* Yes, we're deliberately cavalier about not checking for overflow */
- strcpy(tmp, one);
- strcat(tmp, two);
- return tmp;
-}
-
-/* sane strncpy() function */
-char *
-sstrncpy(char *dst, const char *src, int size)
-{
- dst[size] = '\0';
- return strncpy(dst, src, size);
-}
-
-/* Concatenate three strings into static storage */
-char *
-string_concat3(char *one, char *two, char *three)
-{
- static char tmp[FILENAME_MAX];
-
- /* Yes, we're deliberately cavalier about not checking for overflow */
- strcpy(tmp, one);
- strcat(tmp, two);
- strcat(tmp, three);
- return tmp;
-}
-
-/* Clip the whitespace off the end of a string */
-char *
-string_prune(char *str)
-{
- int len = str ? strlen(str) : 0;
-
- while (len && isspace(str[len - 1]))
- str[--len] = '\0';
- return str;
-}
-
-/* run the whitespace off the front of a string */
-char *
-string_skipwhite(char *str)
-{
- while (*str && isspace(*str))
- ++str;
- return str;
-}
-
-/* copy optionally and allow second arg to be null */
-char *
-string_copy(char *s1, char *s2)
-{
- if (!s1)
- return NULL;
- if (!s2)
- s1[0] = '\0';
- else
- strcpy(s1, s2);
- return s1;
-}
-
-/* convert an integer to a string, using a static buffer */
-char *
-itoa(int value)
-{
- static char buf[13];
-
- snprintf(buf, 12, "%d", value);
- return buf;
-}
-
-Boolean
-directory_exists(const char *dirname)
-{
- DIR *tptr;
-
- if (!dirname)
- return FALSE;
- if (!strlen(dirname))
- return FALSE;
-
- tptr = opendir(dirname);
- if (!tptr)
- return (FALSE);
-
- closedir(tptr);
- return (TRUE);
-}
-
-char *
-pathBaseName(const char *path)
-{
- char *pt;
- char *ret = (char *)path;
-
- pt = strrchr(path,(int)'/');
-
- if (pt != 0) /* if there is a slash */
- {
- ret = ++pt; /* start the file after it */
- }
-
- return(ret);
-}
-
-/* A free guaranteed to take NULL ptrs */
-void
-safe_free(void *ptr)
-{
- if (ptr)
- free(ptr);
-}
-
-/* A malloc that checks errors */
-void *
-safe_malloc(size_t size)
-{
- void *ptr;
-
- if (size <= 0)
- msgFatal("Invalid malloc size of %ld!", (long)size);
- ptr = malloc(size);
- if (!ptr)
- msgFatal("Out of memory!");
- bzero(ptr, size);
- return ptr;
-}
-
-/* A realloc that checks errors */
-void *
-safe_realloc(void *orig, size_t size)
-{
- void *ptr;
-
- if (size <= 0)
- msgFatal("Invalid realloc size of %ld!", (long)size);
- ptr = reallocf(orig, size);
- if (!ptr)
- msgFatal("Out of memory!");
- return ptr;
-}
-
-/* Create a path biased from the VAR_INSTALL_ROOT variable (if not /) */
-char *
-root_bias(char *path)
-{
- static char tmp[FILENAME_MAX];
- char *cp = variable_get(VAR_INSTALL_ROOT);
-
- if (!strcmp(cp, "/"))
- return path;
- strcpy(tmp, variable_get(VAR_INSTALL_ROOT));
- strcat(tmp, path);
- return tmp;
-}
-
-/*
- * These next routines are kind of specialized just for building item lists
- * for dialog_menu().
- */
-
-/* Add an item to an item list */
-dialogMenuItem *
-item_add(dialogMenuItem *list, char *prompt, char *title,
- int (*checked)(dialogMenuItem *self),
- int (*fire)(dialogMenuItem *self),
- void (*selected)(dialogMenuItem *self, int is_selected),
- void *data, int *aux, int *curr, int *max)
-{
- dialogMenuItem *d;
-
- if (*curr == *max) {
- *max += 20;
- list = (dialogMenuItem *)safe_realloc(list, sizeof(dialogMenuItem) * *max);
- }
- d = &list[(*curr)++];
- bzero(d, sizeof(*d));
- d->prompt = prompt ? strdup(prompt) : NULL;
- d->title = title ? strdup(title) : NULL;
- d->checked = checked;
- d->fire = fire;
- d->selected = selected;
- d->data = data;
- d->aux = (long)aux;
- return list;
-}
-
-/* Toss the items out */
-void
-items_free(dialogMenuItem *list, int *curr, int *max)
-{
- int i;
-
- for (i = 0; list[i].prompt; i++) {
- safe_free(list[i].prompt);
- safe_free(list[i].title);
- }
- safe_free(list);
- *curr = *max = 0;
-}
-
-int
-Mkdir(char *ipath)
-{
- struct stat sb;
- int final;
- char *p, *path;
-
- if (file_readable(ipath) || Fake)
- return DITEM_SUCCESS;
-
- path = strcpy(alloca(strlen(ipath) + 1), ipath);
- if (isDebug())
- msgDebug("mkdir(%s)\n", path);
- p = path;
- if (p[0] == '/') /* Skip leading '/'. */
- ++p;
- for (final = FALSE; !final; ++p) {
- if (p[0] == '\0' || (p[0] == '/' && p[1] == '\0'))
- final = TRUE;
- else if (p[0] != '/')
- continue;
- *p = '\0';
- if (stat(path, &sb)) {
- if (errno != ENOENT) {
- msgConfirm("Couldn't stat directory %s: %s", path, strerror(errno));
- return DITEM_FAILURE;
- }
- if (isDebug())
- msgDebug("mkdir(%s..)\n", path);
- if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
- msgConfirm("Couldn't create directory %s: %s", path,strerror(errno));
- return DITEM_FAILURE;
- }
- }
- *p = '/';
- }
- return DITEM_SUCCESS;
-}
-
-int
-Mkdir_command(char *key, void *dir)
-{
- return (Mkdir((char*)dir));
-}
-
-int
-Mount(char *mountp, void *dev)
-{
- struct ufs_args ufsargs;
- char device[80];
- char mountpoint[FILENAME_MAX];
-
- if (Fake)
- return DITEM_SUCCESS;
-
- if (*((char *)dev) != '/') {
- sprintf(device, "%s/dev/%s", RunningAsInit ? "/mnt" : "", (char *)dev);
- sprintf(mountpoint, "%s%s", RunningAsInit ? "/mnt" : "", mountp);
- }
- else {
- strcpy(device, dev);
- strcpy(mountpoint, mountp);
- }
- memset(&ufsargs,0,sizeof ufsargs);
-
- if (Mkdir(mountpoint)) {
- msgConfirm("Unable to make directory mountpoint for %s!", mountpoint);
- return DITEM_FAILURE;
- }
- if (isDebug())
- msgDebug("mount %s %s\n", device, mountpoint);
-
- ufsargs.fspec = device;
- if (mount("ufs", mountpoint, RunningAsInit ? MNT_ASYNC | MNT_NOATIME : 0,
- (caddr_t)&ufsargs) == -1) {
- msgConfirm("Error mounting %s on %s : %s", device, mountpoint, strerror(errno));
- return DITEM_FAILURE;
- }
- return DITEM_SUCCESS;
-}
-
-int
-Mount_msdosfs(char *mountp, void *dev)
-{
- struct msdosfs_args mount_args;
- char device[80];
- char mountpoint[FILENAME_MAX];
-
- if (Fake)
- return DITEM_SUCCESS;
-
- if (*((char *)dev) != '/') {
- sprintf(device, "%s/dev/%s", RunningAsInit ? "/mnt" : "", (char *)dev);
- sprintf(mountpoint, "%s%s", RunningAsInit ? "/mnt" : "", mountp);
- }
- else {
- strcpy(device, dev);
- strcpy(mountpoint, mountp);
- }
-
- if (Mkdir(mountpoint)) {
- msgConfirm("Unable to make directory mountpoint for %s!", mountpoint);
- return DITEM_FAILURE;
- }
- if (isDebug())
- msgDebug("mount %s %s\n", device, mountpoint);
-
- memset(&mount_args, 0, sizeof(mount_args));
- mount_args.fspec = device;
- mount_args.magic = MSDOSFS_ARGSMAGIC;
- mount_args.mask = S_IRWXU | S_IRWXG | S_IRWXO;
- if (mount("msdosfs", mountpoint, RunningAsInit ? MNT_ASYNC|MNT_NOATIME : 0,
- (caddr_t)&mount_args) == -1) {
- msgConfirm("Error mounting %s on %s : %s", device, mountpoint, strerror(errno));
- return DITEM_FAILURE;
- }
- return DITEM_SUCCESS;
-}
-
-WINDOW *
-openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height)
-{
- WINDOW *win;
- static char help[FILENAME_MAX];
-
- /* We need a curses window */
- win = newwin(LINES, COLS, 0, 0);
- if (win) {
- /* Say where our help comes from */
- if (helpfile) {
- use_helpline("Press F1 for more information on this screen.");
- use_helpfile(systemHelpFile(helpfile, help));
- }
- /* Setup a nice screen for us to splat stuff onto */
- draw_box(win, y, x, height, width, dialog_attr, border_attr);
- wattrset(win, dialog_attr);
- mvwaddstr(win, y, x + (COLS - strlen(title)) / 2, title);
- }
- return win;
-}
-
-ComposeObj *
-initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max)
-{
- ComposeObj *obj = NULL, *first;
- int n;
-
- /* Loop over the layout list, create the objects, and add them
- onto the chain of objects that dialog uses for traversal*/
-
- n = 0;
- while (layout[n].help != NULL) {
- int t = TYPE_OF_OBJ(layout[n].type);
-
- switch (t) {
- case STRINGOBJ:
- layout[n].obj = NewStringObj(win, layout[n].prompt, layout[n].var,
- layout[n].y + y, layout[n].x + x, layout[n].len, layout[n].maxlen);
- ((StringObj *)layout[n].obj)->attr_mask = ATTR_OF_OBJ(layout[n].type);
- break;
-
- case BUTTONOBJ:
- layout[n].obj = NewButtonObj(win, layout[n].prompt, layout[n].var, layout[n].y + y, layout[n].x + x);
- break;
-
- default:
- msgFatal("Don't support this object yet!");
- }
- AddObj(&obj, t, (void *) layout[n].obj);
- n++;
- }
- *max = n - 1;
- /* Find the first object in the list */
- for (first = obj; first->prev; first = first->prev);
- return first;
-}
-
-int
-layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj, int *n, int max, int *cbutton, int *cancel)
-{
- char help_line[80];
- int ret, i, len = strlen(layout[*n].help);
-
- /* Display the help line at the bottom of the screen */
- for (i = 0; i < 79; i++)
- help_line[i] = (i < len) ? layout[*n].help[i] : ' ';
- help_line[i] = '\0';
- use_helpline(help_line);
- display_helpline(win, LINES - 1, COLS - 1);
- wrefresh(win);
-
- /* Ask for libdialog to do its stuff */
- ret = PollObj(obj);
- /* Handle special case stuff that libdialog misses. Sigh */
- switch (ret) {
- case SEL_ESC: /* Bail out */
- *cancel = TRUE;
- return FALSE;
-
- /* This doesn't work for list dialogs. Oh well. Perhaps
- should special case the move from the OK button ``up''
- to make it go to the interface list, but then it gets
- awkward for the user to go back and correct screw up's
- in the per-interface section */
- case KEY_DOWN:
- case SEL_CR:
- case SEL_TAB:
- if (*n < max)
- ++*n;
- else
- *n = 0;
- break;
-
- /* The user has pressed enter over a button object */
- case SEL_BUTTON:
- if (cbutton && *cbutton)
- *cancel = TRUE;
- else
- *cancel = FALSE;
- return FALSE;
-
- case KEY_UP:
- case SEL_BACKTAB:
- if (*n)
- --*n;
- else
- *n = max;
- break;
-
- case KEY_F(1):
- display_helpfile();
-
- /* They tried some key combination we don't support - tootle them forcefully! */
- default:
- beep();
- }
- return TRUE;
-}
-
-WINDOW *
-savescr(void)
-{
- WINDOW *w;
-
- w = dupwin(newscr);
- return w;
-}
-
-void
-restorescr(WINDOW *w)
-{
- touchwin(w);
- wrefresh(w);
- delwin(w);
-}
-
diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c
deleted file mode 100644
index 4625ce2..0000000
--- a/usr.sbin/sade/msg.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-#include <stdarg.h>
-#include <sys/ioctl.h>
-#include <sys/consio.h>
-
-Boolean
-isDebug(void)
-{
- char *cp;
-
- return (cp = variable_get(VAR_DEBUG)) && strcmp(cp, "no");
-}
-
-/* Whack up an informational message on the status line, in stand-out */
-void
-msgYap(char *fmt, ...)
-{
- va_list args;
- char *errstr;
- int attrs;
-
- errstr = (char *)alloca(FILENAME_MAX);
- va_start(args, fmt);
- vsnprintf(errstr, FILENAME_MAX, fmt, args);
- va_end(args);
- attrs = getattrs(stdscr);
- attrset(A_REVERSE);
- mvaddstr(StatusLine, 0, errstr);
- attrset(attrs);
- refresh();
-}
-
-/* Whack up an informational message on the status line */
-void
-msgInfo(char *fmt, ...)
-{
- va_list args;
- char *errstr;
- int i, attrs;
- char line[81];
-
- attrs = getattrs(stdscr);
- /* NULL is a special convention meaning "erase the old stuff" */
- if (!fmt) {
- move(StatusLine, 0);
- clrtoeol();
- return;
- }
- errstr = (char *)alloca(FILENAME_MAX);
- va_start(args, fmt);
- vsnprintf(errstr, FILENAME_MAX, fmt, args);
- va_end(args);
- memset(line, ' ', 80);
- for (i = 0; i < 80; i++) {
- if (errstr[i])
- line[i] = errstr[i];
- else
- break;
- }
- line[80] = '\0';
- attrset(ATTR_TITLE);
- mvaddstr(StatusLine, 0, line);
- attrset(attrs);
- move(StatusLine, 79);
- refresh();
-}
-
-/* Whack up a warning on the status line */
-void
-msgWarn(char *fmt, ...)
-{
- va_list args;
- char *errstr;
- int attrs;
-
- errstr = (char *)alloca(FILENAME_MAX);
- strcpy(errstr, "Warning: ");
- va_start(args, fmt);
- vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
- va_end(args);
- attrs = getattrs(stdscr);
- beep();
- attrset(ATTR_TITLE);
- mvaddstr(StatusLine, 0, errstr);
- attrset(attrs);
- refresh();
- if (OnVTY && isDebug())
- msgDebug("Warning message `%s'\n", errstr);
-}
-
-/* Whack up an error on the status line */
-void
-msgError(char *fmt, ...)
-{
- va_list args;
- char *errstr;
- int attrs;
-
- errstr = (char *)alloca(FILENAME_MAX);
- strcpy(errstr, "Error: ");
- va_start(args, fmt);
- vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
- va_end(args);
- beep();
- attrs = getattrs(stdscr);
- attrset(ATTR_TITLE);
- mvaddstr(StatusLine, 0, errstr);
- attrset(attrs);
- refresh();
- if (OnVTY && isDebug())
- msgDebug("Error message `%s'\n", errstr);
-}
-
-/* Whack up a fatal error on the status line */
-void
-msgFatal(char *fmt, ...)
-{
- va_list args;
- char *errstr;
- int attrs;
-
- errstr = (char *)alloca(FILENAME_MAX);
- strcpy(errstr, "Fatal Error: ");
- va_start(args, fmt);
- vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args);
- va_end(args);
- beep();
- attrs = getattrs(stdscr);
- attrset(ATTR_TITLE);
- mvaddstr(StatusLine, 0, errstr);
- addstr(" - ");
- addstr("PRESS ANY KEY TO ");
- if (getpid() == 1)
- addstr("REBOOT");
- else
- addstr("QUIT");
- attrset(attrs);
- refresh();
- if (OnVTY)
- msgDebug("Fatal error `%s'!\n", errstr);
- getch();
- systemShutdown(1);
-}
-
-/* Put up a message in a popup confirmation box */
-void
-msgConfirm(char *fmt, ...)
-{
- va_list args;
- char *errstr;
- WINDOW *w = savescr();
-
- errstr = (char *)alloca(FILENAME_MAX);
- va_start(args, fmt);
- vsnprintf(errstr, FILENAME_MAX, fmt, args);
- va_end(args);
- use_helpline(NULL);
- use_helpfile(NULL);
- if (OnVTY) {
- ioctl(0, VT_ACTIVATE, 1);
- msgInfo(NULL);
- }
- dialog_notify(errstr);
- restorescr(w);
-}
-
-/* Put up a message in a popup information box */
-void
-msgNotify(char *fmt, ...)
-{
- va_list args;
- char *errstr;
-
- errstr = (char *)alloca(FILENAME_MAX);
- va_start(args, fmt);
- vsnprintf(errstr, FILENAME_MAX, fmt, args);
- va_end(args);
- use_helpline(NULL);
- use_helpfile(NULL);
- if (isDebug())
- msgDebug("Notify: %s\n", errstr);
- dialog_msgbox(NULL, errstr, -1, -1, 0);
-}
-
-/* Put up a message in a popup yes/no box and return 0 for YES, 1 for NO */
-int
-msgYesNo(char *fmt, ...)
-{
- va_list args;
- char *errstr;
- int ret;
- WINDOW *w = savescr();
-
- errstr = (char *)alloca(FILENAME_MAX);
- va_start(args, fmt);
- vsnprintf(errstr, FILENAME_MAX, fmt, args);
- va_end(args);
- use_helpline(NULL);
- use_helpfile(NULL);
- if (OnVTY) {
- ioctl(0, VT_ACTIVATE, 1); /* Switch back */
- msgInfo(NULL);
- }
- if (variable_get(VAR_NONINTERACTIVE))
- return 0; /* If non-interactive, return YES all the time */
- ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1);
- restorescr(w);
- return ret;
-}
-
-/* Put up a message in a popup no/yes box and return 0 for YES, 1 for NO */
-int
-msgNoYes(char *fmt, ...)
-{
- va_list args;
- char *errstr;
- int ret;
- WINDOW *w = savescr();
-
- errstr = (char *)alloca(FILENAME_MAX);
- va_start(args, fmt);
- vsnprintf(errstr, FILENAME_MAX, fmt, args);
- va_end(args);
- use_helpline(NULL);
- use_helpfile(NULL);
- if (OnVTY) {
- ioctl(0, VT_ACTIVATE, 1); /* Switch back */
- msgInfo(NULL);
- }
- if (variable_get(VAR_NONINTERACTIVE))
- return 1; /* If non-interactive, return NO all the time */
- ret = dialog_noyes("User Confirmation Requested", errstr, -1, -1);
- restorescr(w);
- return ret;
-}
-
-/* Put up a message in an input box and return the value */
-char *
-msgGetInput(char *buf, char *fmt, ...)
-{
- va_list args;
- char *errstr;
- static char input_buffer[256];
- int rval;
- WINDOW *w = savescr();
-
- errstr = (char *)alloca(FILENAME_MAX);
- va_start(args, fmt);
- vsnprintf(errstr, FILENAME_MAX, fmt, args);
- va_end(args);
- use_helpline(NULL);
- use_helpfile(NULL);
- if (buf)
- SAFE_STRCPY(input_buffer, buf);
- else
- input_buffer[0] = '\0';
- if (OnVTY) {
- ioctl(0, VT_ACTIVATE, 1); /* Switch back */
- msgInfo(NULL);
- }
- rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer);
- restorescr(w);
- if (!rval)
- return input_buffer;
- else
- return NULL;
-}
-
-/* Write something to the debugging port */
-void
-msgDebug(char *fmt, ...)
-{
- va_list args;
- char *dbg;
-
- if (DebugFD == -1)
- return;
- dbg = (char *)alloca(FILENAME_MAX);
- strcpy(dbg, "DEBUG: ");
- va_start(args, fmt);
- vsnprintf((char *)(dbg + strlen(dbg)), FILENAME_MAX, fmt, args);
- va_end(args);
- write(DebugFD, dbg, strlen(dbg));
-}
-
-/* Tell the user there's some output to go look at */
-void
-msgWeHaveOutput(char *fmt, ...)
-{
- va_list args;
- char *errstr;
- WINDOW *w = savescr();
-
- errstr = (char *)alloca(FILENAME_MAX);
- va_start(args, fmt);
- vsnprintf(errstr, FILENAME_MAX, fmt, args);
- va_end(args);
- use_helpline(NULL);
- use_helpfile(NULL);
- msgDebug("Notify: %s\n", errstr);
- dialog_clear_norefresh();
- sleep(2);
- dialog_msgbox(NULL, errstr, -1, -1, 0);
- restorescr(w);
-}
-
-/* Simple versions of msgConfirm() and msgNotify() for calling from scripts */
-int
-msgSimpleConfirm(char *str)
-{
- msgConfirm("%s", str);
- return DITEM_SUCCESS;
-}
-
-int
-msgSimpleNotify(char *str)
-{
- msgNotify("%s", str);
- return DITEM_SUCCESS;
-}
diff --git a/usr.sbin/sade/rtermcap.c b/usr.sbin/sade/rtermcap.c
deleted file mode 100644
index 84b3feb..0000000
--- a/usr.sbin/sade/rtermcap.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <stdio.h>
-#include <termcap.h>
-
-int
-main(int argc, char **argv)
-{
- char buf[4096];
- int i;
-
- if (argc < 2)
- return 1;
- i = tgetent(buf, argv[1]);
- printf("%s",buf);
- return 0;
-}
diff --git a/usr.sbin/sade/sade.8 b/usr.sbin/sade/sade.8
deleted file mode 100644
index e75c673..0000000
--- a/usr.sbin/sade/sade.8
+++ /dev/null
@@ -1,949 +0,0 @@
-.\" Copyright (c) 1997
-.\" Jordan Hubbard <jkh@FreeBSD.org>. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY Jordan Hubbard AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL Jordan Hubbard OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd June 14, 2005
-.Dt SYSINSTALL 8
-.Os
-.Sh NAME
-.Nm sysinstall
-.Nd system installation and configuration tool
-.Sh SYNOPSIS
-.Nm
-.Op Ar var=value
-.Op Ar function
-.Op Ar ...
-.Sh DESCRIPTION
-The
-.Nm
-utility is used for installing and configuring
-.Fx
-systems.
-It is the first utility invoked by the
-.Fx
-installation boot
-floppy and is also available as
-.Pa /usr/sbin/sysinstall
-on newly installed
-.Fx
-systems for use in later configuring the system.
-.Pp
-The
-.Nm
-utility is generally invoked without arguments for the default
-behavior, where the main installation/configuration menu is presented.
-.Pp
-On those occasions where it is deemed necessary to invoke a subsystem
-of sysinstall directly, however, it is also possible to do so by
-naming the appropriate function entry points on the command line.
-Since this action is essentially identical to running an installation
-script, each command-line argument corresponding to a line of script,
-the reader is encouraged to read the section on scripting for more
-information on this feature.
-.Sh NOTES
-The
-.Nm
-utility is essentially nothing more than a monolithic C program with
-the ability to write MBRs and disk labels (through the services
-of the
-.Xr libdisk 3
-library) and install distributions or packages onto new and
-existing
-.Fx
-systems.
-It also contains some extra intelligence
-for running as a replacement for
-.Xr init 8
-when it is invoked by the
-.Fx
-installation boot procedure.
-It
-assumes very little in the way of additional utility support and
-performs most file system operations by calling the relevant syscalls
-(such as
-.Xr mount 2 )
-directly.
-.Pp
-The
-.Nm
-utility currently uses the
-.Xr dialog 3
-library to do user interaction with simple ANSI line graphics, color
-support for which is enabled by either running on a syscons VTY or some
-other color-capable terminal emulator (newer versions of xterm will support
-color when using the
-.Dq xterm-color
-termcap entry).
-.Pp
-This product is currently at the end of its life cycle and will
-eventually be replaced.
-.Sh RUNNING SCRIPTS
-The
-.Nm
-utility may be either driven interactively through its various internal menus
-or run in batch mode, driven by an external script.
-Such a script may
-be loaded and executed in one of 3 ways:
-.Bl -tag -width Ds
-.It Sy "LOAD_CONFIG_FILE"
-If
-.Nm
-is compiled with LOAD_CONFIG_FILE set in the environment
-(or in the Makefile) to some value, then that value will
-be used as the filename to automatically look for and load
-when
-.Nm
-starts up and with no user interaction required.
-This option is aimed primarily at large sites who wish to create a
-single prototype install for multiple machines with largely identical
-configurations and/or installation options.
-.It Sy "MAIN MENU"
-If
-.Nm
-is run interactively, that is to say in the default manner, it will
-bring up a main menu which contains a "load config file" option.
-Selecting this option will prompt for the name of a script file which
-it then will attempt to load from a DOS or UFS formatted floppy.
-.It Sy "COMMAND LINE"
-Each command line argument is treated as a script directive
-when
-.Nm
-is run in multi-user mode.
-Execution ends either by explicit request
-(e.g.\& calling the
-.Ar shutdown
-directive), upon reaching the end of the argument list or on error.
-.Pp
-For example:
-.Bd -literal
-/usr/sbin/sysinstall _ftpPath=ftp://ziggy/pub/ mediaSetFTP configPackages
-.Ed
-.Pp
-Would initialize
-.Nm
-for FTP installation media (using the server `ziggy') and then
-bring up the package installation editor, exiting when finished.
-.El
-.Sh SCRIPT SYNTAX
-A script is a list of one or more directives, each directive taking
-the form of:
-.Pp
-.Ar var=value
-.Pp
-.Ar function
-.Pp
-or
-.Ar #somecomment
-.Pp
-Where
-.Ar var=value
-is the assignment of some internal
-.Nm
-variable, e.g.\& "ftpPass=FuNkYChiKn", and
-.Ar function
-is the name of an internal
-.Nm
-function, e.g.\& "mediaSetFTP", and
-.Ar #comment
-is a single-line comment for documentation purposes (ignored by
-sysinstall).
-Each directive must be by itself on a single line,
-functions taking their arguments by examining known variable names.
-This requires that you be sure to assign the relevant variables before
-calling a function which requires them.
-.Pp
-The
-.Ar noError
-variable can be assigned before each directive: this will cause any error
-detected while processing the directive itself to be ignored.
-The value of
-.Ar noError
-will automatically reset to the default "unassigned" every time a directive is
-processed.
-.Pp
-When and where a function depends on the settings of one or more variables
-will be noted in the following table:
-.Pp
-.Sy "Function Glossary" :
-.Pp
-.Bl -tag -width indent
-.It configAnonFTP
-Invoke the Anonymous FTP configuration menu.
-.Pp
-.Sy Variables :
-None
-.It configRouter
-Select which routing daemon you wish to use, potentially
-loading any required 3rd-party routing daemons as necessary.
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It router
-can be set to the name of the desired routing daemon,
-e.g.\&
-.Dq routed
-or
-.Dq gated ,
-otherwise it is prompted for.
-.El
-.It configNFSServer
-Configure host as an NFS server.
-.Pp
-.Sy Variables :
-None
-.It configNTP
-Configure host as a user of the Network Time Protocol.
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It ntpdate_flags
-The flags to
-.Xr ntpdate 8 ,
-that is to say the name of the server to sync from.
-.El
-.It configPCNFSD
-Configure host to support PC NFS.
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It pcnfsd_pkg
-The name of the PCNFSD package to load if necessary (defaults to hard coded
-version).
-.El
-.It configPackages
-Bring up the interactive package management menu.
-.Pp
-.Sy Variables :
-None
-.It configUsers
-Add users and/or groups to the system.
-.Pp
-.Sy Variables :
-None
-.It diskPartitionEditor
-Invokes the disk partition (MBR) editor.
-.Pp
-.Sy Variables :
-.Bl -tag -width findx
-.It geometry
-The disk geometry, as a cyls/heads/sectors formatted string.
-Default: no
-change to geometry.
-.It partition
-Set to disk partitioning type or size, its value being
-.Ar free
-in order to use only remaining free space for
-.Fx ,
-.Ar all
-to use the entire disk for
-.Fx
-but maintain a proper partition
-table,
-.Ar existing
-to use an existing
-.Fx
-partition (first found),
-.Ar exclusive
-to use the disk in
-.Dq dangerously dedicated
-mode or, finally,
-.Ar somenumber
-to allocate
-.Ar somenumber
-blocks of available free space to a new
-.Fx
-partition.
-Default: Interactive mode.
-.It bootManager
-is set to one of
-.Ar boot
-to signify the installation of a boot manager,
-.Ar standard
-to signify installation of a "standard" non-boot MGR DOS
-MBR or
-.Ar none
-to indicate that no change to the boot manager is desired.
-Default: none.
-.It diskInteractive
-If set, bring up the interactive disk partition editor.
-.El
-.Pp
-Note: Nothing is actually written to disk by this function, an explicit call to
-.Ar diskPartitionWrite
-being required for that to happen.
-.It diskPartitionWrite
-Causes any pending MBR changes (typically from the
-.Ar diskPartitionEditor
-function) to be written out.
-.Pp
-.Sy Variables :
-None
-.It diskLabelEditor
-Invokes the disk label editor.
-This is a bit trickier from a script
-since you need to essentially label everything inside each
-.Fx
-(type 0xA5) partition created by the
-.Ar diskPartitionEditor
-function, and that requires knowing a few rules about how things are
-laid out.
-When creating a script to automatically allocate disk space
-and partition it up, it is suggested that you first perform the
-installation interactively at least once and take careful notes as to
-what the slice names will be, then and only then hardwiring them into
-the script.
-.Pp
-For example, let's say you have a SCSI disk on which you have created a new
-.Fx
-partition in slice 2 (your DOS partition residing in slice 1).
-The slice name would be
-.Ar da0s2
-for the whole
-.Fx
-partition
-.Ar ( da0s1
-being your DOS primary
-partition).
-Now let's further assume that you have 500MB in this
-partition and you want to sub-partition that space into root, swap,
-var and usr file systems for
-.Fx .
-Your invocation of the
-.Ar diskLabelEditor
-function might involve setting the following variables:
-.Bl -tag -width findx
-.It Li "da0s2-1=ufs 40960 /"
-A 20MB root file system (all sizes are in 512 byte blocks).
-.It Li "da0s2-2=swap 131072 /"
-A 64MB swap partition.
-.It Li "da0s2-3=ufs 204800 /var"
-A 100MB /var file system.
-.It Li "da0s2-4=ufs 0 /usr 1"
-With the balance of free space (around 316MB) going to the /usr
-file system and with soft-updates enabled (the argument following
-the mount point, if non-zero, means to set the soft updates flag).
-.El
-.Pp
-One can also use the
-.Ar diskLabelEditor
-for mounting or erasing existing partitions as well as creating new
-ones.
-Using the previous example again, let's say that we also wanted
-to mount our DOS partition and make sure that an
-.Pa /etc/fstab
-entry is created for it in the new installation.
-Before calling the
-.Ar diskLabelEditor
-function, we simply add an additional line:
-.Pp
-.Dl "da0s1=/dos_c N"
-.Pp
-before the call.
-This tells the label editor that you want to mount
-the first slice on
-.Pa /dos_c
-and not to attempt to newfs it (not that
-.Nm
-would attempt this for a DOS partition in any case, but it could just
-as easily be an existing UFS partition being named here and the 2nd
-field is non-optional).
-.Pp
-You can also set the
-.Ar diskInteractive
-variable to request that the disk label editor use an interactive dialog
-to partition the disk instead of using variables to explicitly layout the
-disk as described above.
-.Pp
-Note: No file system data is actually written to disk until an
-explicit call to
-.Ar diskLabelCommit
-is made.
-.It diskLabelCommit
-Writes out all pending disklabel information and creates and/or mounts any
-file systems which have requests pending from the
-.Ar diskLabelEditor
-function.
-.Pp
-.Sy Variables :
-None
-.It distReset
-Resets all selected distributions to the empty set (no distributions selected).
-.Pp
-.Sy Variables :
-None
-.It distSetCustom
-Allows the selection of a custom distribution set (e.g.\& not just one of the
-existing "canned" sets) with no user interaction.
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It dists
-List of distributions to load.
-Possible distribution values are:
-.Bl -tag -width indentxx
-.It Li base
-The base binary distribution.
-.It Li doc
-Miscellaneous documentation
-.It Li games
-Games
-.It Li manpages
-Manual pages (unformatted)
-.It Li catpages
-Pre-formatted manual pages
-.It Li proflibs
-Profiled libraries for developers.
-.It Li dict
-Dictionary information (for tools like spell).
-.It Li info
-GNU info files and other extra docs.
-.It Li lib32
-(amd64 only)
-32-bit runtime compatibility libraries.
-.It Li compat1x
-Compatibility with
-.Fx
-1.x
-.It Li compat20
-Compatibility with
-.Fx 2.0
-.It Li compat21
-Compatibility with
-.Fx 2.1
-.It Li compat22
-.Fx 2.2
-and
-.Fx 3.0
-a.out binary compatibility
-.It Li compat3x
-Compatibility with
-.Fx
-3.x
-(available for
-.Fx 4.0
-systems only)
-.It Li compat4x
-Compatibility with
-.Fx
-4.x
-(available for
-.Fx 5.0
-systems only)
-.It Li ports
-The ports collection.
-.It Li ssecure
-/usr/src/secure
-.It Li sbase
-/usr/src/[top level files]
-.It Li scontrib
-/usr/src/contrib
-.It Li sgnu
-/usr/src/gnu
-.It Li setc
-/usr/src/etc
-.It Li sgames
-/usr/src/games
-.It Li sinclude
-/usr/src/include
-.It Li skrb5
-/usr/src/kerberos5
-.It Li slib
-/usr/src/lib
-.It Li slibexec
-/usr/src/libexec
-.It Li srelease
-/usr/src/release
-.It Li srescue
-/usr/src/rescue
-.It Li sbin
-/usr/src/bin
-.It Li ssbin
-/usr/src/sbin
-.It Li sshare
-/usr/src/share
-.It Li ssys
-/usr/src/sys
-.It Li subin
-/usr/src/usr.bin
-.It Li susbin
-/usr/src/usr.sbin
-.It Li ssmailcf
-/usr/src/usr.sbin/sendmail/cf
-.It Li Xbin
-X.Org client applications.
-.It Li Xlib
-X.Org libraries.
-.It Li Xman
-X.Org manual pages.
-.It Li Xdoc
-X.Org protocol and library documentation.
-.It Li Xprog
-X.Org imake distribution.
-.It Li Xsrv
-X.Org X server.
-.It Li Xnest
-X.Org nested X server.
-.It Li Xprt
-X.Org print server.
-.It Li Xvfb
-X.Org virtual frame-buffer X server.
-.It Li Xfmsc
-X.Org miscellaneous font set.
-.It Li Xf75
-X.Org 75DPI font set.
-.It Li Xf100
-X.Org 100DPI font set.
-.It Li Xfcyr
-X.Org Cyrillic font set.
-.It Li Xft1
-X.Org Type 1 font set.
-.It Li Xftt
-X.Org TrueType font set.
-.It Li Xfs
-X.Org font server.
-.El
-.El
-.It distSetDeveloper
-Selects the standard Developer's distribution set.
-.Pp
-.Sy Variables :
-None
-.It distSetXDeveloper
-Selects the standard X Developer's distribution set.
-.Pp
-.Sy Variables :
-None
-.It distSetKernDeveloper
-Selects the standard kernel Developer's distribution set.
-.Pp
-.Sy Variables :
-None
-.It distSetUser
-Selects the standard user distribution set.
-.Pp
-.Sy Variables :
-None
-.It distSetXUser
-Selects the standard X user's distribution set.
-.Pp
-.Sy Variables :
-None
-.It distSetMinimum
-Selects the very minimum distribution set.
-.Pp
-.Sy Variables :
-None
-.It distSetEverything
-Selects the full whack - all available distributions.
-.Pp
-.Sy Variables :
-None
-.It distSetSrc
-Interactively select source subcomponents.
-.Pp
-.Sy Variables :
-None
-.It distSetXOrg
-Interactively select X.Org subcomponents.
-.Pp
-.Sy Variables :
-None
-.It distExtractAll
-Install all currently selected distributions (requires that
-media device also be selected).
-.Pp
-.Sy Variables :
-None
-.It docBrowser
-Install (if necessary) an HTML documentation browser and go to the
-HTML documentation submenu.
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It browserPackage
-The name of the browser package to try and install as necessary.
-Defaults to latest links package.
-.It browserBinary
-The name of the browser binary itself (if overriding the
-.Ar browserPackage
-variable).
-Defaults to links.
-.El
-.It installCommit
-Commit any and all pending changes to disk.
-This function
-is essentially shorthand for a number of more granular "commit"
-functions.
-.Pp
-.Sy Variables :
-None
-.It installExpress
-Start an "express" installation, asking few questions of
-the user.
-.Pp
-.Sy Variables :
-None
-.It installStandard
-Start a "standard" installation, the most user-friendly
-installation type available.
-.Pp
-.Sy Variables :
-None
-.It installUpgrade
-Start an upgrade installation.
-.Pp
-.Sy Variables :
-None
-.It installFixitHoloShell
-Start up the "emergency holographic shell" over on VTY4
-if running as init.
-This will also happen automatically
-as part of the installation process unless
-.Ar noHoloShell
-is set.
-.Pp
-.Sy Variables :
-None
-.It installFixitCDROM
-Go into "fixit" mode, assuming a live file system CDROM
-currently in the drive.
-.Pp
-.Sy Variables :
-None
-.It installFixitFloppy
-Go into "fixit" mode, assuming an available fixit floppy
-disk (user will be prompted for it).
-.Pp
-.Sy Variables :
-None
-.It installFilesystems
-Do just the file system initialization part of an install.
-.Pp
-.Sy Variables :
-None
-.It installVarDefaults
-Initialize all variables to their defaults, overriding any
-previous settings.
-.Pp
-.Sy Variables :
-None
-.It loadConfig
-Sort of like an #include statement, it allows you to load one
-configuration file from another.
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It configFile
-The fully qualified pathname of the file to load.
-.El
-.It mediaClose
-If a media device is open, close it.
-.Pp
-.Sy Variables :
-None
-.It mediaSetCDROM
-Select a
-.Fx
-CDROM as the installation media.
-.Pp
-.Sy Variables :
-None
-.It mediaSetFloppy
-Select a pre-made floppy installation set as the installation media.
-.Pp
-.Sy Variables :
-None
-.It mediaSetDOS
-Select an existing DOS primary partition as the installation media.
-The first primary partition found is used (e.g.\& C:).
-.Pp
-.Sy Variables :
-None
-.It mediaSetTape
-Select a tape device as the installation media.
-.Pp
-.Sy Variables :
-None
-.It mediaSetFTP
-Select an FTP site as the installation media.
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It hostname
-The name of the host being installed (non-optional).
-.It domainname
-The domain name of the host being installed (optional).
-.It defaultrouter
-The default router for this host (non-optional).
-.It netDev
-Which host interface to use
-.Ar ( ed0
-or
-.Ar ep0 ,
-for example.
-Non-optional).
-.It netInteractive
-If set, bring up the interactive network setup form even
-if all relevant configuration variables are already set (optional).
-.It ipaddr
-The IP address for the selected host interface (non-optional).
-.It netmask
-The netmask for the selected host interface (non-optional).
-.It _ftpPath
-The fully qualified URL of the FTP site containing the
-.Fx
-distribution you are interested in, e.g.\&
-.Ar ftp://ftp.FreeBSD.org/pub/FreeBSD/ .
-.El
-.It mediaSetFTPActive
-Alias for
-.Ar mediaSetFTP
-using "active" FTP transfer mode.
-.Pp
-.Sy Variables :
-Same as for
-.Ar mediaSetFTP .
-.It mediaSetFTPPassive
-Alias for
-.Ar mediaSetFTP
-using "passive" FTP transfer mode.
-.Pp
-.Sy Variables :
-Same as for
-.Ar mediaSetFTP .
-.It mediaSetHTTP
-Alias for
-.Ar mediaSetFTP
-using an HTTP proxy.
-.Pp
-.Sy Variables :
-See
-.Ar mediaSetFTP ,
-plus
-.Bl -tag -width indent
-.It _httpPath
-The proxy to use (host:port) (non-optional).
-.El
-.It mediaSetUFS
-Select an existing UFS partition (mounted with the label editor) as
-the installation media.
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It ufs
-full /path to directory containing the
-.Fx
-distribution you are
-interested in.
-.El
-.It mediaSetNFS
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It hostname
-The name of the host being installed (non-optional).
-.It domainname
-The domain name of the host being installed (optional).
-.It defaultrouter
-The default router for this host (non-optional).
-.It netDev
-Which host interface to use
-.Ar ( ed0
-or
-.Ar ep0 ,
-for example.
-Non-optional).
-.It netInteractive
-If set, bring up the interactive network setup form even
-if all relevant configuration variables are already set (optional).
-.It ipaddr
-The IP address for the selected host interface (non-optional).
-.It netmask
-The netmask for the selected host interface (non-optional).
-.It nfs
-full hostname:/path specification for directory containing
-the
-.Fx
-distribution you are interested in.
-.El
-.It mediaSetFTPUserPass
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It ftpUser
-The username to log in as on the ftp server site.
-Default: ftp
-.It ftpPass
-The password to use for this username on the ftp
-server site.
-Default: user@host
-.El
-.It mediaSetCPIOVerbosity
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It cpioVerbose
-Can be used to set the verbosity of cpio extractions to low, medium or
-high.
-.El
-.It mediaGetType
-Interactively get the user to specify some type of media.
-.Pp
-.Sy Variables :
-None
-.It optionsEditor
-Invoke the interactive options editor.
-.Pp
-.Sy Variables :
-None
-.It packageAdd
-Try to fetch and add a package to the system (requires
-that a media type be set),
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It package
-The name of the package to add, e.g.\& bash-1.14.7 or ncftp-2.4.2.
-.El
-.It addGroup
-Invoke the interactive group editor.
-.Pp
-.Sy Variables :
-None
-.It addUser
-Invoke the interactive user editor.
-.Pp
-.Sy Variables :
-None
-.It shutdown
-Stop the script and terminate sysinstall.
-.Pp
-.Sy Variables :
-None
-.It system
-Execute an arbitrary command with
-.Xr system 3
-.Pp
-.Sy Variables :
-.Bl -tag -width indent
-.It command
-The name of the command to execute.
-When running
-from a boot floppy, very minimal expectations should
-be made as to what is available until/unless a relatively
-full system installation has just been done.
-.El
-.It tcpMenuSelect
-Configure a network device.
-.Pp
-.Sy Variables :
-Same as for
-.Ar mediaSetFTP
-except that
-.Ar _ftpPath
-is not used.
-.El
-.Sh DISTRIBUTION MEDIA
-The following files can be used to affect the operation of
-.Nm
-when used during initial system installation.
-.Bl -tag -width ".Pa packages/INDEX"
-.It Pa cdrom.inf
-A text file of properties, listed one per line, that describe the
-contents of the media in use.
-The syntax for each line is simply
-.Dq Ar property No = Ar value .
-Currently, only the following properties are recognized.
-.Bl -tag -width ".Va CD_MACHINE_ARCH"
-.It Va CD_VERSION
-This property should be set to the
-.Fx
-version on the current
-media volume.
-For example,
-.Dq Li "CD_VERSION = 5.3" .
-.It Va CD_MACHINE_ARCH
-This property should be set to the architecture of the contents on
-this volume.
-This property is normally only used with
-.Fx
-products that contain
-CDs for different architectures, to provide better error messages if
-users try to install Alpha packages on an i386 machine.
-For example,
-.Dq Li "CD_MACHINE_ARCH = alpha" .
-.It Va CD_VOLUME
-In a multi-volume collection (such as the
-.Fx
-4-CD set), the
-.Pa ports/INDEX
-file on each disc should contain the full package index for the set.
-The last field of the
-.Pa INDEX
-file denotes which volume the package
-appears on, and the
-.Va CD_VOLUME
-property here defines the volume ID of the current disc.
-.El
-.It Pa packages/INDEX
-The package index file.
-Each package is listed on a separate line with additional meta-data
-such as the required dependencies.
-This index is generated by
-.Dq Li "make index"
-from the
-.Xr ports 7
-collection.
-When multi-volume support is enabled, an additional field should be
-added to each line indicating which media volume contains the given
-package.
-.El
-.Pp
-For information about building a full release of
-.Fx ,
-please see
-.Xr release 7 .
-.Sh FILES
-This utility may edit the contents of
-.Pa /etc/rc.conf ,
-.Pa /etc/hosts ,
-and
-.Pa /etc/resolv.conf
-as necessary to reflect changes in the network configuration.
-.Sh SEE ALSO
-If you have a reasonably complete source tree online, take
-a look at
-.Pa /usr/src/usr.sbin/sysinstall/install.cfg
-for a sample installation script.
-.Sh HISTORY
-This version of
-.Nm
-first appeared in
-.Fx 2.0 .
-.Sh AUTHORS
-.An Jordan K. Hubbard Aq jkh@FreeBSD.org
-.Sh BUGS
-This utility is a prototype which lasted several years past
-its expiration date and is greatly in need of death.
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
deleted file mode 100644
index 657b35f..0000000
--- a/usr.sbin/sade/sade.h
+++ /dev/null
@@ -1,888 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last attempt in the `sysinstall' line, the next
- * generation being slated to essentially a complete rewrite.
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _SYSINSTALL_H_INCLUDE
-#define _SYSINSTALL_H_INCLUDE
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <errno.h>
-#include <setjmp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <dialog.h>
-#include "ui_objects.h"
-#include "dir.h"
-#include "colors.h"
-#include "dist.h"
-
-/*** Defines ***/
-
-#if defined(__i386__) || defined(__alpha__) || defined(__amd64__)
-#define WITH_SYSCONS
-#define WITH_MICE
-#endif
-
-#if defined(__i386__) || defined(__amd64__)
-#define WITH_SLICES
-#endif
-
-#if defined(__i386__) || defined(__alpha__)
-#define WITH_LINUX
-#endif
-
-#if defined(PC98)
-#define PCCARD_ARCH 1 /* Support PCCARD installations */
-#endif
-
-/* device limits */
-#define DEV_NAME_MAX 128 /* The maximum length of a device name */
-#define DEV_MAX 100 /* The maximum number of devices we'll deal with */
-#define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */
-#define IO_ERROR -2 /* Status code for I/O error rather than normal EOF */
-
-/* Number of seconds to wait for data to come off even the slowest media */
-#define MEDIA_TIMEOUT 300
-
-/*
- * I make some pretty gross assumptions about having a max of 50 chunks
- * total - 8 slices and 42 partitions. I can't easily display many more
- * than that on the screen at once!
- *
- * For 2.1 I'll revisit this and try to make it more dynamic, but since
- * this will catch 99.99% of all possible cases, I'm not too worried.
- */
-#define MAX_CHUNKS 40
-
-/* Internal environment variable names */
-#define DISK_PARTITIONED "_diskPartitioned"
-#define DISK_LABELLED "_diskLabelled"
-#define DISK_SELECTED "_diskSelected"
-#define SYSTEM_STATE "_systemState"
-#define RUNNING_ON_ROOT "_runningOnRoot"
-#define TCP_CONFIGURED "_tcpConfigured"
-
-/* Ones that can be tweaked from config files */
-#define VAR_BLANKTIME "blanktime"
-#define VAR_BOOTMGR "bootManager"
-#define VAR_BROWSER_BINARY "browserBinary"
-#define VAR_BROWSER_PACKAGE "browserPackage"
-#define VAR_CPIO_VERBOSITY "cpioVerbose"
-#define VAR_DEBUG "debug"
-#define VAR_DESKSTYLE "_deskStyle"
-#define VAR_DISK "disk"
-#define VAR_DISKINTERACTIVE "diskInteractive"
-#define VAR_DISTS "dists"
-#define VAR_DIST_MAIN "distMain"
-#define VAR_DIST_SRC "distSRC"
-#define VAR_DIST_X11 "distX11"
-#define VAR_DEDICATE_DISK "dedicateDisk"
-#define VAR_DOMAINNAME "domainname"
-#define VAR_EDITOR "editor"
-#define VAR_EXTRAS "ifconfig_"
-#define VAR_COMMAND "command"
-#define VAR_CONFIG_FILE "configFile"
-#define VAR_FIXIT_TTY "fixitTty"
-#define VAR_FTP_DIR "ftpDirectory"
-#define VAR_FTP_PASS "ftpPass"
-#define VAR_FTP_PATH "_ftpPath"
-#define VAR_FTP_PORT "ftpPort"
-#define VAR_FTP_STATE "ftpState"
-#define VAR_FTP_USER "ftpUser"
-#define VAR_FTP_HOST "ftpHost"
-#define VAR_HTTP_PATH "_httpPath"
-#define VAR_HTTP_PROXY "httpProxy"
-#define VAR_HTTP_PORT "httpPort"
-#define VAR_HTTP_HOST "httpHost"
-#define VAR_HTTP_FTP_MODE "httpFtpMode"
-#define VAR_GATEWAY "defaultrouter"
-#define VAR_GEOMETRY "geometry"
-#define VAR_HOSTNAME "hostname"
-#define VAR_IFCONFIG "ifconfig_"
-#define VAR_INSTALL_CFG "installConfig"
-#define VAR_INSTALL_ROOT "installRoot"
-#define VAR_IPADDR "ipaddr"
-#define VAR_IPV6_ENABLE "ipv6_enable"
-#define VAR_IPV6ADDR "ipv6addr"
-#define VAR_KERN_SECURELEVEL "kern_securelevel"
-#define VAR_KEYMAP "keymap"
-#define VAR_LABEL "label"
-#define VAR_LABEL_COUNT "labelCount"
-#define VAR_LINUX_ENABLE "linux_enable"
-#define VAR_MEDIA_TYPE "mediaType"
-#define VAR_MEDIA_TIMEOUT "MEDIA_TIMEOUT"
-#define VAR_MOUSED "moused_enable"
-#define VAR_MOUSED_FLAGS "moused_flags"
-#define VAR_MOUSED_PORT "moused_port"
-#define VAR_MOUSED_TYPE "moused_type"
-#define VAR_NAMESERVER "nameserver"
-#define VAR_NETINTERACTIVE "netInteractive"
-#define VAR_NETMASK "netmask"
-#define VAR_NETWORK_DEVICE "netDev"
-#define VAR_NEWFS_ARGS "newfsArgs"
-#define VAR_NFS_PATH "nfs"
-#define VAR_NFS_HOST "nfsHost"
-#define VAR_NFS_V3 "nfs_use_v3"
-#define VAR_NFS_TCP "nfs_use_tcp"
-#define VAR_NFS_SECURE "nfs_reserved_port_only"
-#define VAR_NFS_SERVER "nfs_server_enable"
-#define VAR_NO_CONFIRM "noConfirm"
-#define VAR_NO_ERROR "noError"
-#define VAR_NO_HOLOSHELL "noHoloShell"
-#define VAR_NO_INET6 "noInet6"
-#define VAR_NO_WARN "noWarn"
-#define VAR_NO_USR "noUsr"
-#define VAR_NO_TMP "noTmp"
-#define VAR_NO_HOME "noHome"
-#define VAR_NONINTERACTIVE "nonInteractive"
-#define VAR_NOVELL "novell"
-#define VAR_OSF1_ENABLE "osf1_enable"
-#define VAR_RPCBIND_ENABLE "rpcbind_enable"
-#define VAR_NTPDATE_FLAGS "ntpdate_flags"
-#define VAR_PACKAGE "package"
-#define VAR_PARTITION "partition"
-#define VAR_PCNFSD "pcnfsd"
-#define VAR_PKG_TMPDIR "PKG_TMPDIR"
-#define VAR_PORTS_PATH "ports"
-#define VAR_PPP_ENABLE "ppp_enable"
-#define VAR_PPP_PROFILE "ppp_profile"
-#define VAR_RELNAME "releaseName"
-#define VAR_ROOT_SIZE "rootSize"
-#define VAR_ROUTER "router"
-#define VAR_ROUTER_ENABLE "router_enable"
-#define VAR_ROUTERFLAGS "router_flags"
-#define VAR_SENDMAIL_ENABLE "sendmail_enable"
-#define VAR_SERIAL_SPEED "serialSpeed"
-#define VAR_SLOW_ETHER "slowEthernetCard"
-#define VAR_SWAP_SIZE "swapSize"
-#define VAR_TAPE_BLOCKSIZE "tapeBlocksize"
-#define VAR_TRY_DHCP "tryDHCP"
-#define VAR_TRY_RTSOL "tryRTSOL"
-#define VAR_SKIP_PCCARD "skipPCCARD"
-#define VAR_UFS_PATH "ufs"
-#define VAR_USR_SIZE "usrSize"
-#define VAR_VAR_SIZE "varSize"
-#define VAR_TMP_SIZE "tmpSize"
-#define VAR_HOME_SIZE "homeSize"
-#define VAR_XORG_CONFIG "_xorgconfig"
-#define VAR_TERM "TERM"
-#define VAR_CONSTERM "_consterm"
-
-#define DEFAULT_TAPE_BLOCKSIZE "20"
-
-/* One MB worth of blocks */
-#define ONE_MEG 2048
-#define ONE_GIG (ONE_MEG * 1024)
-
-/* Which selection attributes to use */
-#define ATTR_SELECTED (ColorDisplay ? item_selected_attr : item_attr)
-#define ATTR_TITLE button_active_attr
-
-/* Handy strncpy() macro */
-#define SAFE_STRCPY(to, from) sstrncpy((to), (from), sizeof (to) - 1)
-
-/*** Types ***/
-typedef int Boolean;
-typedef struct disk Disk;
-typedef struct chunk Chunk;
-
-/* Bitfields for menu options */
-#define DMENU_NORMAL_TYPE 0x1 /* Normal dialog menu */
-#define DMENU_RADIO_TYPE 0x2 /* Radio dialog menu */
-#define DMENU_CHECKLIST_TYPE 0x4 /* Multiple choice menu */
-#define DMENU_SELECTION_RETURNS 0x8 /* Immediate return on item selection */
-
-typedef struct _dmenu {
- int type; /* What sort of menu we are */
- char *title; /* Our title */
- char *prompt; /* Our prompt */
- char *helpline; /* Line of help at bottom */
- char *helpfile; /* Help file for "F1" */
-#if (__STDC_VERSION__ >= 199901L) || (__GNUC__ >= 3)
- dialogMenuItem items[]; /* Array of menu items */
-#elif __GNUC__
- dialogMenuItem items[0]; /* Array of menu items */
-#else
-#error "Create hack for C89 and K&R compilers."
-#endif
-} DMenu;
-
-/* An rc.conf variable */
-typedef struct _variable {
- struct _variable *next;
- char *name;
- char *value;
- int dirty;
-} Variable;
-
-#define NO_ECHO_OBJ(type) ((type) | (DITEM_NO_ECHO << 16))
-#define TYPE_OF_OBJ(type) ((type) & 0xff)
-#define ATTR_OF_OBJ(type) ((type) >> 16)
-
-/* A screen layout structure */
-typedef struct _layout {
- int y; /* x & Y co-ordinates */
- int x;
- int len; /* The size of the dialog on the screen */
- int maxlen; /* How much the user can type in ... */
- char *prompt; /* The string for the prompt */
- char *help; /* The display for the help line */
- void *var; /* The var to set when this changes */
- int type; /* The type of the dialog to create */
- void *obj; /* The obj pointer returned by libdialog */
-} Layout;
-
-typedef enum {
- DEVICE_TYPE_NONE,
- DEVICE_TYPE_DISK,
- DEVICE_TYPE_FLOPPY,
- DEVICE_TYPE_FTP,
- DEVICE_TYPE_NETWORK,
- DEVICE_TYPE_CDROM,
- DEVICE_TYPE_TAPE,
- DEVICE_TYPE_DOS,
- DEVICE_TYPE_UFS,
- DEVICE_TYPE_NFS,
- DEVICE_TYPE_ANY,
- DEVICE_TYPE_HTTP,
-} DeviceType;
-
-/* CDROM mount codes */
-#define CD_UNMOUNTED 0
-#define CD_ALREADY_MOUNTED 1
-#define CD_WE_MOUNTED_IT 2
-
-/* A "device" from sysinstall's point of view */
-typedef struct _device {
- char name[DEV_NAME_MAX];
- char *description;
- char *devname;
- DeviceType type;
- Boolean enabled;
- Boolean (*init)(struct _device *dev);
- FILE * (*get)(struct _device *dev, char *file, Boolean probe);
- void (*shutdown)(struct _device *dev);
- void *private;
- unsigned int flags;
- unsigned int volume;
-} Device;
-
-/* Some internal representations of partitions */
-typedef enum {
- PART_NONE,
- PART_SLICE,
- PART_SWAP,
- PART_FILESYSTEM,
- PART_FAT,
- PART_EFI
-} PartType;
-
-#define NEWFS_UFS_CMD "newfs"
-#define NEWFS_MSDOS_CMD "newfs_msdos"
-
-enum newfs_type { NEWFS_UFS, NEWFS_MSDOS, NEWFS_CUSTOM };
-#define NEWFS_UFS_STRING "UFS"
-#define NEWFS_MSDOS_STRING "FAT"
-#define NEWFS_CUSTOM_STRING "CST"
-
-/* The longest set of custom command line arguments we'll pass. */
-#define NEWFS_CMD_ARGS_MAX 256
-
-typedef struct _part_info {
- char mountpoint[FILENAME_MAX];
-
- /* Is invocation of newfs desired? */
- Boolean do_newfs;
-
- enum newfs_type newfs_type;
- union {
- struct {
- char user_options[NEWFS_CMD_ARGS_MAX];
- Boolean acls; /* unused */
- Boolean multilabel; /* unused */
- Boolean softupdates;
- Boolean ufs1;
- } newfs_ufs;
- struct {
- /* unused */
- } newfs_msdos;
- struct {
- char command[NEWFS_CMD_ARGS_MAX];
- } newfs_custom;
- } newfs_data;
-} PartInfo;
-
-/* An option */
-typedef struct _opt {
- char *name;
- char *desc;
- enum { OPT_IS_STRING, OPT_IS_INT, OPT_IS_FUNC, OPT_IS_VAR } type;
- void *data;
- void *aux;
- char *(*check)();
-} Option;
-
-/* Weird index nodey things we use for keeping track of package information */
-typedef enum { PACKAGE, PLACE } node_type; /* Types of nodes */
-
-typedef struct _pkgnode { /* A node in the reconstructed hierarchy */
- struct _pkgnode *next; /* My next sibling */
- node_type type; /* What am I? */
- char *name; /* My name */
- char *desc; /* My description (Hook) */
- struct _pkgnode *kids; /* My little children */
- void *data; /* A place to hang my data */
-} PkgNode;
-typedef PkgNode *PkgNodePtr;
-
-/* A single package */
-typedef struct _indexEntry { /* A single entry in an INDEX file */
- char *name; /* name */
- char *path; /* full path to port */
- char *prefix; /* port prefix */
- char *comment; /* one line description */
- char *descrfile; /* path to description file */
- char *deps; /* packages this depends on */
- int depc; /* how many depend on me */
- int installed; /* indicates if it is installed */
- char *maintainer; /* maintainer */
- unsigned int volume; /* Volume of package */
-} IndexEntry;
-typedef IndexEntry *IndexEntryPtr;
-
-typedef int (*commandFunc)(char *key, void *data);
-
-#define HOSTNAME_FIELD_LEN 128
-#define IPADDR_FIELD_LEN 16
-#define EXTRAS_FIELD_LEN 128
-
-/* This is the structure that Network devices carry around in their private, erm, structures */
-typedef struct _devPriv {
- int use_rtsol;
- int use_dhcp;
- char ipaddr[IPADDR_FIELD_LEN];
- char netmask[IPADDR_FIELD_LEN];
- char extras[EXTRAS_FIELD_LEN];
-} DevInfo;
-
-
-/*** Externs ***/
-extern jmp_buf BailOut; /* Used to get the heck out */
-extern int CDROMInitQuiet; /* Don't whine if mount(2) fails */
-extern int DebugFD; /* Where diagnostic output goes */
-extern Boolean Fake; /* Don't actually modify anything - testing */
-extern Boolean Restarting; /* Are we restarting sysinstall? */
-extern Boolean SystemWasInstalled; /* Did we install it? */
-extern Boolean RunningAsInit; /* Are we running stand-alone? */
-extern Boolean DialogActive; /* Is the dialog() stuff up? */
-extern Boolean ColorDisplay; /* Are we on a color display? */
-extern Boolean OnVTY; /* On a syscons VTY? */
-extern Variable *VarHead; /* The head of the variable chain */
-extern Device *mediaDevice; /* Where we're getting our distribution from */
-extern unsigned int Dists; /* Which distributions we want */
-extern unsigned int SrcDists; /* Which src distributions we want */
-extern unsigned int XOrgDists; /* Which X.Org dists we want */
-extern int BootMgr; /* Which boot manager to use */
-extern int StatusLine; /* Where to print our status messages */
-extern DMenu MenuInitial; /* Initial installation menu */
-extern DMenu MenuFixit; /* Fixit repair menu */
-#if defined(__i386__) || defined(__amd64__)
-#ifdef PC98
-extern DMenu MenuIPLType; /* Type of IPL to write on the disk */
-#else
-extern DMenu MenuMBRType; /* Type of MBR to write on the disk */
-#endif
-#endif
-extern DMenu MenuConfigure; /* Final configuration menu */
-extern DMenu MenuDocumentation; /* Documentation menu */
-extern DMenu MenuFTPOptions; /* FTP Installation options */
-extern DMenu MenuIndex; /* Index menu */
-extern DMenu MenuOptions; /* Installation options */
-extern DMenu MenuOptionsLanguage; /* Language options menu */
-extern DMenu MenuKLD; /* Prototype KLD menu */
-extern DMenu MenuMedia; /* Media type menu */
-#ifdef WITH_MICE
-extern DMenu MenuMouse; /* Mouse type menu */
-#endif
-extern DMenu MenuMediaCDROM; /* CDROM media menu */
-extern DMenu MenuMediaDOS; /* DOS media menu */
-extern DMenu MenuMediaFloppy; /* Floppy media menu */
-extern DMenu MenuMediaFTP; /* FTP media menu */
-extern DMenu MenuMediaTape; /* Tape media menu */
-extern DMenu MenuNetworkDevice; /* Network device menu */
-extern DMenu MenuNTP; /* NTP time server menu */
-extern DMenu MenuSecurity; /* System security options menu */
-extern DMenu MenuSecurelevel; /* Securelevel menu */
-extern DMenu MenuStartup; /* Startup services menu */
-#ifdef WITH_SYSCONS
-extern DMenu MenuSyscons; /* System console configuration menu */
-extern DMenu MenuSysconsFont; /* System console font configuration menu */
-extern DMenu MenuSysconsKeymap; /* System console keymap configuration menu */
-extern DMenu MenuSysconsKeyrate; /* System console keyrate configuration menu */
-extern DMenu MenuSysconsSaver; /* System console saver configuration menu */
-extern DMenu MenuSysconsScrnmap; /* System console screenmap configuration menu */
-extern DMenu MenuSysconsTtys; /* System console terminal type menu */
-#endif
-extern DMenu MenuNetworking; /* Network configuration menu */
-extern DMenu MenuMTA; /* MTA selection menu */
-extern DMenu MenuInstallCustom; /* Custom Installation menu */
-extern DMenu MenuDistributions; /* Distribution menu */
-extern DMenu MenuDiskDevices; /* Disk type devices */
-extern DMenu MenuSubDistributions; /* Custom distribution menu */
-extern DMenu MenuSrcDistributions; /* Source distribution menu */
-extern DMenu MenuXOrg; /* X.Org main menu */
-extern DMenu MenuXOrgSelect; /* X.Org distribution selection menu */
-extern DMenu MenuXOrgSelectCore; /* X.Org core distribution menu */
-extern DMenu MenuXOrgSelectServer; /* X.Org server distribution menu */
-extern DMenu MenuXOrgSelectFonts; /* X.Org font selection menu */
-extern DMenu MenuXDesktops; /* X Desktops menu */
-extern DMenu MenuHTMLDoc; /* HTML Documentation menu */
-extern DMenu MenuUsermgmt; /* User management menu */
-extern DMenu MenuFixit; /* Fixit floppy/CDROM/shell menu */
-extern DMenu MenuXOrgConfig; /* Select X.Org configuration tool */
-extern int FixItMode; /* FixItMode starts shell onc urrent device (ie Serial port) */
-extern const char * StartName; /* Which name we were started as */
-
-/* Important chunks. */
-extern Chunk *HomeChunk;
-extern Chunk *RootChunk;
-extern Chunk *SwapChunk;
-extern Chunk *TmpChunk;
-extern Chunk *UsrChunk;
-extern Chunk *VarChunk;
-#ifdef __ia64__
-extern Chunk *EfiChunk;
-#endif
-
-/* Stuff from libdialog which isn't properly declared outside */
-extern void display_helpfile(void);
-extern void display_helpline(WINDOW *w, int y, int width);
-
-/*** Prototypes ***/
-
-/* anonFTP.c */
-extern int configAnonFTP(dialogMenuItem *self);
-
-/* cdrom.c */
-extern Boolean mediaInitCDROM(Device *dev);
-extern FILE *mediaGetCDROM(Device *dev, char *file, Boolean probe);
-extern void mediaShutdownCDROM(Device *dev);
-
-/* command.c */
-extern void command_clear(void);
-extern void command_sort(void);
-extern void command_execute(void);
-extern void command_shell_add(char *key, char *fmt, ...) __printflike(2, 3);
-extern void command_func_add(char *key, commandFunc func, void *data);
-
-/* config.c */
-extern void configEnvironmentRC_conf(void);
-extern void configEnvironmentResolv(char *config);
-extern void configRC_conf(void);
-extern int configFstab(dialogMenuItem *self);
-extern int configRC(dialogMenuItem *self);
-extern int configResolv(dialogMenuItem *self);
-extern int configPackages(dialogMenuItem *self);
-extern int configSaver(dialogMenuItem *self);
-extern int configSaverTimeout(dialogMenuItem *self);
-#ifdef WITH_LINUX
-extern int configLinux(dialogMenuItem *self);
-#endif
-extern int configNTP(dialogMenuItem *self);
-#ifdef __alpha__
-extern int configOSF1(dialogMenuItem *self);
-#endif
-extern int configUsers(dialogMenuItem *self);
-extern int configRouter(dialogMenuItem *self);
-extern int configPCNFSD(dialogMenuItem *self);
-extern int configInetd(dialogMenuItem *self);
-extern int configNFSServer(dialogMenuItem *self);
-extern int configMTAPostfix(dialogMenuItem *self);
-extern int configMTAExim(dialogMenuItem *self);
-extern int configRpcBind(dialogMenuItem *self);
-extern int configWriteRC_conf(dialogMenuItem *self);
-extern int configSecurelevel(dialogMenuItem *self);
-extern int configSecurelevelDisabled(dialogMenuItem *self);
-extern int configSecurelevelSecure(dialogMenuItem *self);
-extern int configSecurelevelHighlySecure(dialogMenuItem *self);
-extern int configSecurelevelNetworkSecure(dialogMenuItem *self);
-extern int configEtcTtys(dialogMenuItem *self);
-#ifdef __i386__
-extern int checkLoaderACPI(void);
-extern int configLoaderACPI(int);
-#endif
-
-/* devices.c */
-extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d),
- int (*check)(dialogMenuItem *d));
-extern void deviceGetAll(void);
-extern void deviceReset(void);
-extern void deviceRescan(void);
-extern Device **deviceFind(char *name, DeviceType type);
-extern Device **deviceFindDescr(char *name, char *desc, DeviceType class);
-extern int deviceCount(Device **devs);
-extern Device *new_device(char *name);
-extern Device *deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled,
- Boolean (*init)(Device *mediadev),
- FILE * (*get)(Device *dev, char *file, Boolean probe),
- void (*shutDown)(Device *mediadev),
- void *private);
-extern Boolean dummyInit(Device *dev);
-extern FILE *dummyGet(Device *dev, char *dist, Boolean probe);
-extern void dummyShutdown(Device *dev);
-
-/* dhcp.c */
-extern int dhcpParseLeases(char *file, char *hostname, char *domain, char *nameserver,
- char *ipaddr, char *gateway, char *netmask);
-
-/* disks.c */
-#ifdef WITH_SLICES
-extern void diskPartition(Device *dev);
-extern int diskPartitionEditor(dialogMenuItem *self);
-#endif
-extern int diskPartitionWrite(dialogMenuItem *self);
-extern int diskGetSelectCount(Device ***devs);
-
-/* dispatch.c */
-extern int dispatchCommand(char *command);
-extern int dispatch_load_floppy(dialogMenuItem *self);
-extern int dispatch_load_file_int(int);
-extern int dispatch_load_file(dialogMenuItem *self);
-
-
-/* dist.c */
-extern int distReset(dialogMenuItem *self);
-extern int distConfig(dialogMenuItem *self);
-extern int distSetCustom(dialogMenuItem *self);
-extern int distUnsetCustom(dialogMenuItem *self);
-extern int distSetDeveloper(dialogMenuItem *self);
-extern int distSetXDeveloper(dialogMenuItem *self);
-extern int distSetKernDeveloper(dialogMenuItem *self);
-extern int distSetXKernDeveloper(dialogMenuItem *self);
-extern int distSetUser(dialogMenuItem *self);
-extern int distSetXUser(dialogMenuItem *self);
-extern int distSetMinimum(dialogMenuItem *self);
-extern int distSetEverything(dialogMenuItem *self);
-extern int distSetSrc(dialogMenuItem *self);
-extern int distSetXOrg(dialogMenuItem *self);
-extern int distExtractAll(dialogMenuItem *self);
-
-/* dmenu.c */
-extern int dmenuDisplayFile(dialogMenuItem *tmp);
-extern int dmenuSubmenu(dialogMenuItem *tmp);
-extern int dmenuSystemCommand(dialogMenuItem *tmp);
-extern int dmenuSystemCommandBox(dialogMenuItem *tmp);
-extern int dmenuExit(dialogMenuItem *tmp);
-extern int dmenuISetVariable(dialogMenuItem *tmp);
-extern int dmenuSetVariable(dialogMenuItem *tmp);
-extern int dmenuSetKmapVariable(dialogMenuItem *tmp);
-extern int dmenuSetVariables(dialogMenuItem *tmp);
-extern int dmenuToggleVariable(dialogMenuItem *tmp);
-extern int dmenuSetFlag(dialogMenuItem *tmp);
-extern int dmenuSetValue(dialogMenuItem *tmp);
-extern Boolean dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max, Boolean buttons);
-extern Boolean dmenuOpenSimple(DMenu *menu, Boolean buttons);
-extern int dmenuVarCheck(dialogMenuItem *item);
-extern int dmenuVarsCheck(dialogMenuItem *item);
-extern int dmenuFlagCheck(dialogMenuItem *item);
-extern int dmenuRadioCheck(dialogMenuItem *item);
-
-/* doc.c */
-extern int docBrowser(dialogMenuItem *self);
-extern int docShowDocument(dialogMenuItem *self);
-
-/* dos.c */
-extern Boolean mediaCloseDOS(Device *dev, FILE *fp);
-extern Boolean mediaInitDOS(Device *dev);
-extern FILE *mediaGetDOS(Device *dev, char *file, Boolean probe);
-extern void mediaShutdownDOS(Device *dev);
-
-/* floppy.c */
-extern int getRootFloppy(void);
-extern Boolean mediaInitFloppy(Device *dev);
-extern FILE *mediaGetFloppy(Device *dev, char *file, Boolean probe);
-extern void mediaShutdownFloppy(Device *dev);
-
-/* ftp_strat.c */
-extern Boolean mediaCloseFTP(Device *dev, FILE *fp);
-extern Boolean mediaInitFTP(Device *dev);
-extern FILE *mediaGetFTP(Device *dev, char *file, Boolean probe);
-extern void mediaShutdownFTP(Device *dev);
-
-/* http.c */
-extern Boolean mediaInitHTTP(Device *dev);
-extern FILE *mediaGetHTTP(Device *dev, char *file, Boolean probe);
-
-/* globals.c */
-extern void globalsInit(void);
-
-/* index.c */
-int index_read(FILE *fp, PkgNodePtr papa);
-int index_menu(PkgNodePtr root, PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll);
-void index_init(PkgNodePtr top, PkgNodePtr plist);
-void index_node_free(PkgNodePtr top, PkgNodePtr plist);
-void index_sort(PkgNodePtr top);
-void index_print(PkgNodePtr top, int level);
-int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended);
-int index_initialize(char *path);
-PkgNodePtr index_search(PkgNodePtr top, char *str, PkgNodePtr *tp);
-
-/* install.c */
-extern Boolean checkLabels(Boolean whinge);
-extern int installCommit(dialogMenuItem *self);
-extern int installCustomCommit(dialogMenuItem *self);
-extern int installExpress(dialogMenuItem *self);
-extern int installStandard(dialogMenuItem *self);
-extern int installFixitHoloShell(dialogMenuItem *self);
-extern int installFixitCDROM(dialogMenuItem *self);
-extern int installFixitFloppy(dialogMenuItem *self);
-extern int installFixupBase(dialogMenuItem *self);
-extern int installUpgrade(dialogMenuItem *self);
-extern int installFilesystems(dialogMenuItem *self);
-extern int installVarDefaults(dialogMenuItem *self);
-extern void installEnvironment(void);
-extern Boolean copySelf(void);
-
-/* kget.c */
-extern int kget(char *out);
-
-/* keymap.c */
-extern int loadKeymap(const char *lang);
-
-/* label.c */
-extern int diskLabelEditor(dialogMenuItem *self);
-extern int diskLabelCommit(dialogMenuItem *self);
-
-/* makedevs.c (auto-generated) */
-extern const char termcap_ansi[];
-extern const char termcap_vt100[];
-extern const char termcap_cons25w[];
-extern const char termcap_cons25[];
-extern const char termcap_cons25_m[];
-extern const char termcap_cons25r[];
-extern const char termcap_cons25r_m[];
-extern const char termcap_cons25l1[];
-extern const char termcap_cons25l1_m[];
-extern const char termcap_xterm[];
-extern const u_char font_iso_8x16[];
-extern const u_char font_cp850_8x16[];
-extern const u_char font_cp866_8x16[];
-extern const u_char koi8_r2cp866[];
-extern u_char default_scrnmap[];
-
-/* media.c */
-extern char *cpioVerbosity(void);
-extern void mediaClose(void);
-extern int mediaTimeout(void);
-extern int mediaSetCDROM(dialogMenuItem *self);
-extern int mediaSetFloppy(dialogMenuItem *self);
-extern int mediaSetDOS(dialogMenuItem *self);
-extern int mediaSetTape(dialogMenuItem *self);
-extern int mediaSetFTP(dialogMenuItem *self);
-extern int mediaSetFTPActive(dialogMenuItem *self);
-extern int mediaSetFTPPassive(dialogMenuItem *self);
-extern int mediaSetHTTP(dialogMenuItem *self);
-extern int mediaSetUFS(dialogMenuItem *self);
-extern int mediaSetNFS(dialogMenuItem *self);
-extern int mediaSetFTPUserPass(dialogMenuItem *self);
-extern int mediaSetCPIOVerbosity(dialogMenuItem *self);
-extern int mediaGetType(dialogMenuItem *self);
-extern Boolean mediaExtractDist(char *dir, char *dist, FILE *fp);
-extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic);
-extern Boolean mediaExtractDistEnd(int zpid, int cpid);
-extern Boolean mediaVerify(void);
-extern FILE *mediaGenericGet(char *base, const char *file);
-
-/* misc.c */
-extern Boolean file_readable(char *fname);
-extern Boolean file_executable(char *fname);
-extern Boolean directory_exists(const char *dirname);
-extern char *root_bias(char *path);
-extern char *itoa(int value);
-extern char *string_concat(char *p1, char *p2);
-extern char *string_concat3(char *p1, char *p2, char *p3);
-extern char *string_prune(char *str);
-extern char *string_skipwhite(char *str);
-extern char *string_copy(char *s1, char *s2);
-extern char *pathBaseName(const char *path);
-extern void safe_free(void *ptr);
-extern void *safe_malloc(size_t size);
-extern void *safe_realloc(void *orig, size_t size);
-extern dialogMenuItem *item_add(dialogMenuItem *list, char *prompt, char *title,
- int (*checked)(dialogMenuItem *self),
- int (*fire)(dialogMenuItem *self),
- void (*selected)(dialogMenuItem *self, int is_selected),
- void *data, int *aux, int *curr, int *max);
-extern void items_free(dialogMenuItem *list, int *curr, int *max);
-extern int Mkdir(char *);
-extern int Mkdir_command(char *key, void *data);
-extern int Mount(char *, void *data);
-extern int Mount_msdosfs(char *mountp, void *devname);
-extern WINDOW *openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height);
-extern ComposeObj *initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max);
-extern int layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj,
- int *n, int max, int *cbutton, int *cancel);
-
-extern WINDOW *savescr(void);
-extern void restorescr(WINDOW *w);
-extern char *sstrncpy(char *dst, const char *src, int size);
-
-/* modules.c */
-extern void driverFloppyCheck(void);
-extern void moduleInitialize(void);
-extern int kldBrowser(dialogMenuItem *self);
-
-/* mouse.c */
-extern int mousedTest(dialogMenuItem *self);
-extern int mousedDisable(dialogMenuItem *self);
-extern int setMouseFlags(dialogMenuItem *self);
-
-/* msg.c */
-extern Boolean isDebug(void);
-extern void msgInfo(char *fmt, ...) __printf0like(1, 2);
-extern void msgYap(char *fmt, ...) __printflike(1, 2);
-extern void msgWarn(char *fmt, ...) __printflike(1, 2);
-extern void msgDebug(char *fmt, ...) __printflike(1, 2);
-extern void msgError(char *fmt, ...) __printflike(1, 2);
-extern void msgFatal(char *fmt, ...) __printflike(1, 2);
-extern void msgConfirm(char *fmt, ...) __printflike(1, 2);
-extern void msgNotify(char *fmt, ...) __printflike(1, 2);
-extern void msgWeHaveOutput(char *fmt, ...) __printflike(1, 2);
-extern int msgYesNo(char *fmt, ...) __printflike(1, 2);
-extern int msgNoYes(char *fmt, ...) __printflike(1, 2);
-extern char *msgGetInput(char *buf, char *fmt, ...) __printflike(2, 3);
-extern int msgSimpleConfirm(char *);
-extern int msgSimpleNotify(char *);
-
-/* network.c */
-extern Boolean mediaInitNetwork(Device *dev);
-extern void mediaShutdownNetwork(Device *dev);
-
-/* nfs.c */
-extern Boolean mediaInitNFS(Device *dev);
-extern FILE *mediaGetNFS(Device *dev, char *file, Boolean probe);
-extern void mediaShutdownNFS(Device *dev);
-
-/* options.c */
-extern int optionsEditor(dialogMenuItem *self);
-
-/* package.c */
-extern int packageAdd(dialogMenuItem *self);
-extern int package_add(char *name);
-extern int package_extract(Device *dev, char *name, Boolean depended);
-extern Boolean package_installed(char *name);
-
-/* pccard.c */
-extern void pccardInitialize(void);
-
-/* system.c */
-extern void systemInitialize(int argc, char **argv);
-extern void systemShutdown(int status);
-extern int execExecute(char *cmd, char *name);
-extern int systemExecute(char *cmd);
-extern void systemSuspendDialog(void);
-extern void systemResumeDialog(void);
-extern int systemDisplayHelp(char *file);
-extern char *systemHelpFile(char *file, char *buf);
-extern void systemChangeFont(const u_char font[]);
-extern void systemChangeLang(char *lang);
-extern void systemChangeTerminal(char *color, const u_char c_termcap[], char *mono, const u_char m_termcap[]);
-extern void systemChangeScreenmap(const u_char newmap[]);
-extern void systemCreateHoloshell(void);
-extern int vsystem(char *fmt, ...) __printflike(1, 2);
-
-/* tape.c */
-extern char *mediaTapeBlocksize(void);
-extern Boolean mediaInitTape(Device *dev);
-extern FILE *mediaGetTape(Device *dev, char *file, Boolean probe);
-extern void mediaShutdownTape(Device *dev);
-
-/* tcpip.c */
-extern int tcpOpenDialog(Device *dev);
-extern int tcpMenuSelect(dialogMenuItem *self);
-extern Device *tcpDeviceSelect(void);
-
-/* termcap.c */
-extern int set_termcap(void);
-
-/* ttys.c */
-extern void configTtys(void);
-
-/* ufs.c */
-extern void mediaShutdownUFS(Device *dev);
-extern Boolean mediaInitUFS(Device *dev);
-extern FILE *mediaGetUFS(Device *dev, char *file, Boolean probe);
-
-/* usb.c */
-extern void usbInitialize(void);
-
-/* user.c */
-extern int userAddGroup(dialogMenuItem *self);
-extern int userAddUser(dialogMenuItem *self);
-
-/* variable.c */
-extern void variable_set(char *var, int dirty);
-extern void variable_set2(char *name, char *value, int dirty);
-extern char *variable_get(char *var);
-extern int variable_cmp(char *var, char *value);
-extern void variable_unset(char *var);
-extern char *variable_get_value(char *var, char *prompt, int dirty);
-extern int variable_check(char *data);
-extern int variable_check2(char *data);
-extern int dump_variables(dialogMenuItem *self);
-extern void free_variables(void);
-extern void pvariable_set(char *var);
-extern char *pvariable_get(char *var);
-
-/* wizard.c */
-extern void slice_wizard(Disk *d);
-
-/*
- * Macros. Please find a better place for us!
- */
-#define DEVICE_INIT(d) ((d) != NULL ? (d)->init((d)) : (Boolean)0)
-#define DEVICE_GET(d, b, f) ((d) != NULL ? (d)->get((d), (b), (f)) : NULL)
-#define DEVICE_SHUTDOWN(d) ((d) != NULL ? (d)->shutdown((d)) : (void)0)
-
-#ifdef USE_GZIP
-#define UNZIPPER "gunzip"
-#else
-#define UNZIPPER "bunzip2"
-#endif
-
-#endif
-/* _SYSINSTALL_H_INCLUDE */
diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c
deleted file mode 100644
index ac453ea..0000000
--- a/usr.sbin/sade/system.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Jordan Hubbard
- *
- * My contributions are in the public domain.
- *
- * Parts of this file are also blatently stolen from Poul-Henning Kamp's
- * previous version of sysinstall, and as such fall under his "BEERWARE license"
- * so buy him a beer if you like it! Buy him a beer for me, too!
- * Heck, get him completely drunk and send me pictures! :-)
- */
-
-#include "sysinstall.h"
-#include <signal.h>
-#include <termios.h>
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/consio.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <ufs/ufs/ufsmount.h>
-
-
-/* Where we stick our temporary expanded doc file */
-#define DOC_TMP_DIR "/tmp/.doc"
-#define DOC_TMP_FILE "/tmp/.doc/doc.tmp"
-
-static pid_t ehs_pid;
-
-/*
- * Handle interrupt signals - this probably won't work in all cases
- * due to our having bogotified the internal state of dialog or curses,
- * but we'll give it a try.
- */
-static int
-intr_continue(dialogMenuItem *self)
-{
- return DITEM_LEAVE_MENU;
-}
-
-static int
-intr_reboot(dialogMenuItem *self)
-{
- systemShutdown(-1);
- /* NOTREACHED */
- return 0;
-}
-
-static int
-intr_restart(dialogMenuItem *self)
-{
- int ret, fd, fdmax;
-
- mediaClose();
- free_variables();
- fdmax = getdtablesize();
- for (fd = 3; fd < fdmax; fd++)
- close(fd);
- ret = execl(StartName, StartName, "-restart", (char *)NULL);
- msgDebug("execl failed (%s)\n", strerror(errno));
- /* NOTREACHED */
- return -1;
-}
-
-static dialogMenuItem intrmenu[] = {
- { "Abort", "Abort the installation", NULL, intr_reboot },
- { "Restart", "Restart the installation program", NULL, intr_restart },
- { "Continue", "Continue the installation", NULL, intr_continue },
-};
-
-
-static void
-handle_intr(int sig)
-{
- WINDOW *save = savescr();
-
- use_helpline(NULL);
- use_helpfile(NULL);
- if (OnVTY) {
- ioctl(0, VT_ACTIVATE, 1); /* Switch back */
- msgInfo(NULL);
- }
- (void)dialog_menu("Installation interrupt",
- "Do you want to abort the installation?",
- -1, -1, 3, -3, intrmenu, NULL, NULL, NULL);
- restorescr(save);
-}
-
-/*
- * Harvest children if we are init.
- */
-static void
-reap_children(int sig)
-{
- int errbak = errno;
-
- while (waitpid(-1, NULL, WNOHANG) > 0)
- ;
- errno = errbak;
-}
-
-/* Expand a file into a convenient location, nuking it each time */
-static char *
-expand(char *fname)
-{
- char *gunzip = RunningAsInit ? "/stand/gunzip" : "/usr/bin/gunzip";
-
- if (!directory_exists(DOC_TMP_DIR)) {
- Mkdir(DOC_TMP_DIR);
- if (chown(DOC_TMP_DIR, 0, 0) < 0)
- return NULL;
- if (chmod(DOC_TMP_DIR, S_IRWXU) < 0)
- return NULL;
- }
- else
- unlink(DOC_TMP_FILE);
- if (!file_readable(fname) || vsystem("%s < %s > %s", gunzip, fname, DOC_TMP_FILE))
- return NULL;
- return DOC_TMP_FILE;
-}
-
-/* Initialize system defaults */
-void
-systemInitialize(int argc, char **argv)
-{
- size_t i;
- int boothowto;
- sigset_t signalset;
-
- signal(SIGINT, SIG_IGN);
- globalsInit();
-
- i = sizeof(boothowto);
- if (!sysctlbyname("debug.boothowto", &boothowto, &i, NULL, 0) &&
- (i == sizeof(boothowto)) && (boothowto & RB_VERBOSE))
- variable_set2(VAR_DEBUG, "YES", 0);
-
- /* Are we running as init? */
- if (getpid() == 1) {
- struct ufs_args ufs_args;
- int fd;
-
- RunningAsInit = 1;
- setsid();
- close(0);
- fd = open("/dev/ttyv0", O_RDWR);
- if (fd == -1) {
- fd = open("/dev/console", O_RDWR); /* fallback */
- variable_set2(VAR_FIXIT_TTY, "serial", 0); /* give fixit a hint */
- } else
- OnVTY = TRUE;
- /*
- * To make _sure_ we're on a VTY and don't have /dev/console switched
- * away to a serial port or something, attempt to set the cursor appearance.
- */
- if (OnVTY) {
- int fd2, type;
-
- type = 0; /* normal */
- if ((fd2 = open("/dev/console", O_RDWR)) != -1) {
- if (ioctl(fd2, CONS_CURSORTYPE, &type) == -1) {
- OnVTY = FALSE;
- variable_set2(VAR_FIXIT_TTY, "serial", 0); /* Tell Fixit
- the console
- type */
- close(fd); close(fd2);
- open("/dev/console", O_RDWR);
- }
- else
- close(fd2);
- }
- }
- close(1); dup(0);
- close(2); dup(0);
- printf("%s running as init on %s\n", argv[0], OnVTY ? "vty0" : "serial console");
- ioctl(0, TIOCSCTTY, (char *)NULL);
- setlogin("root");
- setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/usr/bin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin:/usr/X11R6/bin", 1);
- setbuf(stdin, 0);
- setbuf(stderr, 0);
-#ifdef __alpha__
- i = 0;
- sysctlbyname("machdep.unaligned_print", NULL, 0, &i, sizeof(i));
-#endif
-#if 0
- signal(SIGCHLD, reap_children);
-#endif
- memset(&ufs_args, 0, sizeof(ufs_args));
- mount("ufs", "/", MNT_UPDATE, &ufs_args);
- }
- else {
- char hname[256];
-
- /* Initalize various things for a multi-user environment */
- if (!gethostname(hname, sizeof hname))
- variable_set2(VAR_HOSTNAME, hname, 0);
- }
-
- if (set_termcap() == -1) {
- printf("Can't find terminal entry\n");
- exit(-1);
- }
-
- /* XXX - libdialog has particularly bad return value checking */
- init_dialog();
-
- /* If we haven't crashed I guess dialog is running ! */
- DialogActive = TRUE;
-
- /* Make sure HOME is set for those utilities that need it */
- if (!getenv("HOME"))
- setenv("HOME", "/", 1);
- signal(SIGINT, handle_intr);
- /*
- * Make sure we can be interrupted even if we were re-executed
- * from an interrupt.
- */
- sigemptyset(&signalset);
- sigaddset(&signalset, SIGINT);
- sigprocmask(SIG_UNBLOCK, &signalset, NULL);
-
- (void)vsystem("rm -rf %s", DOC_TMP_DIR);
-}
-
-/* Close down and prepare to exit */
-void
-systemShutdown(int status)
-{
- /* If some media is open, close it down */
- if (status >=0)
- mediaClose();
-
- /* write out any changes to rc.conf .. */
- configRC_conf();
-
- /* Shut down the dialog library */
- if (DialogActive) {
- end_dialog();
- DialogActive = FALSE;
- }
-
- /* Shut down curses */
- endwin();
-
- /* If we have a temporary doc dir lying around, nuke it */
- (void)vsystem("rm -rf %s", DOC_TMP_DIR);
-
- /* REALLY exit! */
- if (RunningAsInit) {
- /* Put the console back */
- ioctl(0, VT_ACTIVATE, 2);
-#if defined(__alpha__) || defined(__sparc64__)
- reboot(RB_HALT);
-#else
- reboot(0);
-#endif
- }
- else
- exit(status);
-}
-
-/* Run some general command */
-int
-systemExecute(char *command)
-{
- int status;
- struct termios foo;
- WINDOW *w = savescr();
-
- dialog_clear();
- dialog_update();
- end_dialog();
- DialogActive = FALSE;
- if (tcgetattr(0, &foo) != -1) {
- foo.c_cc[VERASE] = '\010';
- tcsetattr(0, TCSANOW, &foo);
- }
- if (!Fake)
- status = system(command);
- else {
- status = 0;
- msgDebug("systemExecute: Faked execution of `%s'\n", command);
- }
- DialogActive = TRUE;
- restorescr(w);
- return status;
-}
-
-/* suspend/resume libdialog/curses screen */
-static WINDOW *oldW;
-
-void
-systemSuspendDialog(void)
-{
-
- oldW = savescr();
- dialog_clear();
- dialog_update();
- end_dialog();
- DialogActive = FALSE;
-}
-
-void
-systemResumeDialog(void)
-{
-
- DialogActive = TRUE;
- restorescr(oldW);
-}
-
-/* Display a help file in a filebox */
-int
-systemDisplayHelp(char *file)
-{
- char *fname = NULL;
- char buf[FILENAME_MAX];
- int ret = 0;
- WINDOW *w = savescr();
-
- fname = systemHelpFile(file, buf);
- if (!fname) {
- snprintf(buf, FILENAME_MAX, "The %s file is not provided on this particular floppy image.", file);
- use_helpfile(NULL);
- use_helpline(NULL);
- dialog_mesgbox("Sorry!", buf, -1, -1);
- ret = 1;
- }
- else {
- use_helpfile(NULL);
- use_helpline(NULL);
- dialog_textbox(file, fname, LINES, COLS);
- }
- restorescr(w);
- return ret;
-}
-
-char *
-systemHelpFile(char *file, char *buf)
-{
- if (!file)
- return NULL;
- if (file[0] == '/')
- return file;
- snprintf(buf, FILENAME_MAX, "/stand/help/%s.hlp.gz", file);
- if (file_readable(buf))
- return expand(buf);
- snprintf(buf, FILENAME_MAX, "/stand/help/%s.hlp", file);
- if (file_readable(buf))
- return expand(buf);
- snprintf(buf, FILENAME_MAX, "/stand/help/%s.TXT.gz", file);
- if (file_readable(buf))
- return expand(buf);
- snprintf(buf, FILENAME_MAX, "/stand/help/%s.TXT", file);
- if (file_readable(buf))
- return expand(buf);
- snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/sysinstall/help/%s.hlp", file);
- if (file_readable(buf))
- return buf;
- snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/sysinstall/help/%s.TXT", file);
- if (file_readable(buf))
- return buf;
- return NULL;
-}
-
-void
-systemChangeTerminal(char *color, const u_char c_term[],
- char *mono, const u_char m_term[])
-{
- if (OnVTY) {
- int setupterm(char *color, int, int *);
-
- if (ColorDisplay) {
- setenv("TERM", color, 1);
- setenv("TERMCAP", c_term, 1);
- reset_shell_mode();
- setterm(color);
- cbreak(); noecho();
- }
- else {
- setenv("TERM", mono, 1);
- setenv("TERMCAP", m_term, 1);
- reset_shell_mode();
- setterm(mono);
- cbreak(); noecho();
- }
- }
- clear();
- refresh();
- dialog_clear();
-}
-
-int
-vsystem(char *fmt, ...)
-{
- va_list args;
- int pstat;
- pid_t pid;
- int omask;
- sig_t intsave, quitsave;
- char *cmd;
- int i;
-
- cmd = (char *)alloca(FILENAME_MAX);
- cmd[0] = '\0';
- va_start(args, fmt);
- vsnprintf(cmd, FILENAME_MAX, fmt, args);
- va_end(args);
-
- omask = sigblock(sigmask(SIGCHLD));
- if (Fake) {
- msgDebug("vsystem: Faked execution of `%s'\n", cmd);
- return 0;
- }
- if (isDebug())
- msgDebug("Executing command `%s'\n", cmd);
- pid = fork();
- if (pid == -1) {
- (void)sigsetmask(omask);
- i = 127;
- }
- else if (!pid) { /* Junior */
- (void)sigsetmask(omask);
- if (DebugFD != -1) {
- dup2(DebugFD, 0);
- dup2(DebugFD, 1);
- dup2(DebugFD, 2);
- }
- else {
- close(1); open("/dev/null", O_WRONLY);
- dup2(1, 2);
- }
- if (RunningAsInit)
- execl("/stand/sh", "/stand/sh", "-c", cmd, (char *)NULL);
- else
- execl("/bin/sh", "/bin/sh", "-c", cmd, (char *)NULL);
- exit(1);
- }
- else {
- intsave = signal(SIGINT, SIG_IGN);
- quitsave = signal(SIGQUIT, SIG_IGN);
- pid = waitpid(pid, &pstat, 0);
- (void)sigsetmask(omask);
- (void)signal(SIGINT, intsave);
- (void)signal(SIGQUIT, quitsave);
- i = (pid == -1) ? -1 : WEXITSTATUS(pstat);
- if (isDebug())
- msgDebug("Command `%s' returns status of %d\n", cmd, i);
- }
- return i;
-}
-
-void
-systemCreateHoloshell(void)
-{
- int waitstatus;
-
- if ((FixItMode || OnVTY) && RunningAsInit) {
-
- if (ehs_pid != 0) {
- int pstat;
-
- if (kill(ehs_pid, 0) == 0) {
-
- if (msgNoYes("There seems to be an emergency holographic shell\n"
- "already running on VTY 4.\n\n"
- "Kill it and start a new one?"))
- return;
-
- /* try cleaning up as much as possible */
- (void) kill(ehs_pid, SIGHUP);
- sleep(1);
- (void) kill(ehs_pid, SIGKILL);
- }
-
- /* avoid too many zombies */
- (void) waitpid(ehs_pid, &pstat, WNOHANG);
- }
-
- if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0)
- systemSuspendDialog(); /* must be before the fork() */
- if ((ehs_pid = fork()) == 0) {
- int i, fd;
- struct termios foo;
- extern int login_tty(int);
-
- ioctl(0, TIOCNOTTY, NULL);
- for (i = getdtablesize(); i >= 0; --i)
- close(i);
- if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0)
- fd = open("/dev/console", O_RDWR);
- else
- fd = open("/dev/ttyv3", O_RDWR);
- ioctl(0, TIOCSCTTY, &fd);
- dup2(0, 1);
- dup2(0, 2);
- DebugFD = 2;
- if (login_tty(fd) == -1)
- msgDebug("Doctor: I can't set the controlling terminal.\n");
- signal(SIGTTOU, SIG_IGN);
- if (tcgetattr(fd, &foo) != -1) {
- foo.c_cc[VERASE] = '\010';
- if (tcsetattr(fd, TCSANOW, &foo) == -1)
- msgDebug("Doctor: I'm unable to set the erase character.\n");
- }
- else
- msgDebug("Doctor: I'm unable to get the terminal attributes!\n");
- if (strcmp(variable_get(VAR_FIXIT_TTY), "serial") == 0) {
- printf("Type ``exit'' in this fixit shell to resume sysinstall.\n\n");
- fflush(stdout);
- }
- execlp("sh", "-sh", 0);
- msgDebug("Was unable to execute sh for Holographic shell!\n");
- exit(1);
- }
- else {
- if (strcmp(variable_get(VAR_FIXIT_TTY), "standard") == 0) {
- WINDOW *w = savescr();
-
- msgNotify("Starting an emergency holographic shell on VTY4");
- sleep(2);
- restorescr(w);
- }
- else {
- (void)waitpid(ehs_pid, &waitstatus, 0); /* we only wait for
- shell to finish
- it serial mode
- since there is no
- virtual console */
- systemResumeDialog();
- }
- }
- }
-}
diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c
deleted file mode 100644
index 1d8e047..0000000
--- a/usr.sbin/sade/termcap.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 1994, Paul Richards.
- *
- * All rights reserved.
- *
- * This software may be used, modified, copied, distributed, and sold, in both
- * source and binary form provided that the above copyright and these terms
- * are retained, verbatim, as the first lines of this file. Under no
- * circumstances is the author responsible for the proper functioning of this
- * software, nor does the author assume any responsibility for damages
- * incurred with its use.
- *
- * $FreeBSD$
- */
-
-#include "sysinstall.h"
-#include <stdarg.h>
-#include <fcntl.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/consio.h>
-
-#define VTY_STATUS_LINE 24
-#define TTY_STATUS_LINE 23
-
-static void
-prompt_term(char **termp, char **termcapp)
-{
- char str[80];
- static struct {
- const char *term, *termcap;
- } lookup[] = { { "ansi", termcap_ansi },
- { "vt100", termcap_vt100 },
- { "cons25", termcap_cons25 },
- { "cons25-m", termcap_cons25_m },
- { "xterm", termcap_xterm },
- { "cons25w", termcap_cons25w } }; /* must be last */
-
- if (RunningAsInit) {
- while (1) {
- int i;
-
- printf("\nThese are the predefined terminal types available to\n");
- printf("sysinstall when running stand-alone. Please choose the\n");
- printf("closest match for your particular terminal.\n\n");
- printf("1 ...................... Standard ANSI terminal.\n");
- printf("2 ...................... VT100 or compatible terminal.\n");
- printf("3 ...................... FreeBSD system console (color).\n");
- printf("4 ...................... FreeBSD system console (monochrome).\n\n");
- printf("5 ...................... xterm terminal emulator.\n\n");
- printf("Your choice: (1-5) ");
- fflush(stdout);
- fgets(str, 80, stdin);
- i = str[0] - '0';
- if (i > 0 && i < 6) {
- *termp = (char *)lookup[i - 1].term;
- *termcapp = (char *)lookup[i - 1].termcap;
- break;
- }
- else
- printf("\007Invalid choice, please try again.\n\n");
- }
- }
- else {
- printf("\nPlease set your TERM variable before running this program.\n");
- printf("Defaulting to an ANSI compatible terminal - please press RETURN\n");
- fgets(str, 80, stdin); /* Just to make it interactive */
- *termp = (char *)"ansi";
- *termcapp = (char *)termcap_ansi;
- }
-}
-
-int
-set_termcap(void)
-{
- char *term;
- int stat;
- struct ttysize ts;
-
- term = getenv("TERM");
- stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay);
-
- if (!RunningAsInit) {
- if (isDebug())
- DebugFD = open("sysinstall.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644);
- else
- DebugFD = -1;
- if (DebugFD < 0)
- DebugFD = open("/dev/null", O_RDWR, 0);
- }
-
- if (!OnVTY || (stat < 0)) {
- if (!term) {
- char *term, *termcap;
-
- prompt_term(&term, &termcap);
- if (setenv("TERM", term, 1) < 0)
- return -1;
- if (setenv("TERMCAP", termcap, 1) < 0)
- return -1;
- }
- if (DebugFD < 0)
- DebugFD = open("/dev/null", O_RDWR, 0);
- }
- else {
- int i, on;
-
- if (getpid() == 1) {
- DebugFD = open("/dev/ttyv1", O_WRONLY);
- if (DebugFD != -1) {
- on = 1;
- i = ioctl(DebugFD, TIOCCONS, (char *)&on);
- msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n",
- DebugFD, i, !i ? "success" : strerror(errno));
- }
- }
-
-#ifdef PC98
- if (!term) {
- if (setenv("TERM", "cons25w", 1) < 0)
- return -1;
- if (setenv("TERMCAP", termcap_cons25w, 1) < 0)
- return -1;
- }
-#else
- if (ColorDisplay) {
- if (!term) {
- if (setenv("TERM", "cons25", 1) < 0)
- return -1;
- if (setenv("TERMCAP", termcap_cons25, 1) < 0)
- return -1;
- }
- }
- else {
- if (!term) {
- if (setenv("TERM", "cons25-m", 1) < 0)
- return -1;
- if (setenv("TERMCAP", termcap_cons25_m, 1) < 0)
- return -1;
- }
- }
-#endif
- }
- if (ioctl(0, TIOCGSIZE, &ts) == -1) {
- msgDebug("Unable to get terminal size - errno %d\n", errno);
- ts.ts_lines = 0;
- }
- StatusLine = ts.ts_lines ? ts.ts_lines - 1: (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE);
- return 0;
-}
diff --git a/usr.sbin/sade/usb.c b/usr.sbin/sade/usb.c
deleted file mode 100644
index 4eedbd5..0000000
--- a/usr.sbin/sade/usb.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * USB support for sysinstall
- *
- * $FreeBSD$
- *
- * Copyright (c) 2000 John Baldwin <jhb@FreeBSD.org>. All rights reserved.
- *
- * This software may be used, modified, copied, and distributed, in
- * both source and binary form provided that the above copyright and
- * these terms are retained. Under no circumstances is the author
- * responsible for the proper functioning of this software, nor does
- * the author assume any responsibility for damages incurred with its
- * use.
- */
-
-#include "sysinstall.h"
-#include <sys/fcntl.h>
-#include <sys/time.h>
-
-void
-usbInitialize(void)
-{
- int fd;
- WINDOW *w;
-
- if (!RunningAsInit && !Fake) {
- /* It's not my job... */
- return;
- }
-
- if ((fd = open("/dev/usb", O_RDONLY)) < 0) {
- msgDebug("Can't open USB controller.\n");
- return;
- }
- close(fd);
-
- w = savescr();
- msgNotify("Initializing USB controller....");
-
- variable_set2("usbd_enable", "YES", 1);
-
- vsystem("/stand/usbd");
- restorescr(w);
-}
diff --git a/usr.sbin/sade/variable.c b/usr.sbin/sade/variable.c
deleted file mode 100644
index e86104f..0000000
--- a/usr.sbin/sade/variable.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * The new sysinstall program.
- *
- * This is probably the last program in the `sysinstall' line - the next
- * generation being essentially a complete rewrite.
- *
- * $FreeBSD$
- *
- * Copyright (c) 1995
- * Jordan Hubbard. All rights reserved.
- * Copyright (c) 2001
- * Murray Stokely. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * verbatim and that no modifications are made prior to this
- * point in the file.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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 "sysinstall.h"
-
-/* Routines for dealing with variable lists */
-
-static void
-make_variable(char *var, char *value, int dirty)
-{
- Variable *vp;
-
- /* Trim leading and trailing whitespace */
- var = string_skipwhite(string_prune(var));
-
- if (!var || !*var)
- return;
-
-
- /* Now search to see if it's already in the list */
- for (vp = VarHead; vp; vp = vp->next) {
- if (!strcmp(vp->name, var)) {
- if (vp->dirty && !dirty)
- return;
- setenv(var, value, 1);
- free(vp->value);
- vp->value = strdup(value);
- if (dirty != -1)
- vp->dirty = dirty;
- return;
- }
- }
-
- setenv(var, value, 1);
- /* No? Create a new one */
- vp = (Variable *)safe_malloc(sizeof(Variable));
- vp->name = strdup(var);
- vp->value = strdup(value);
- if (dirty == -1)
- dirty = 0;
- vp->dirty = dirty;
- vp->next = VarHead;
- VarHead = vp;
-}
-
-void
-variable_set(char *var, int dirty)
-{
- char tmp[1024], *cp;
-
- if (!var)
- msgFatal("NULL variable name & value passed.");
- else if (!*var)
- msgDebug("Warning: Zero length name & value passed to variable_set()\n");
- SAFE_STRCPY(tmp, var);
- if ((cp = index(tmp, '=')) == NULL)
- msgFatal("Invalid variable format: %s", var);
- *(cp++) = '\0';
- make_variable(tmp, string_skipwhite(cp), dirty);
-}
-
-void
-variable_set2(char *var, char *value, int dirty)
-{
- if (!var || !value)
- msgFatal("Null name or value passed to set_variable2(%s) = %s!",
- var ? var : "", value ? value : "");
- else if (!*var || !*value)
- msgDebug("Warning: Zero length name or value passed to variable_set2(%s) = %s\n",
- var, value);
- make_variable(var, value, dirty);
-}
-
-char *
-variable_get(char *var)
-{
- return getenv(var);
-}
-
-int
-variable_cmp(char *var, char *value)
-{
- char *val;
-
- if ((val = variable_get(var)))
- return strcmp(val, value);
- return -1;
-}
-
-void
-variable_unset(char *var)
-{
- Variable *vp;
- char name[512], *cp;
-
- if ((cp = index(var, '=')) != NULL)
- sstrncpy(name, var, cp - var);
- else
- SAFE_STRCPY(name, var);
- unsetenv(name);
- /* Now search to see if it's in our list, if we have one.. */
- if (!VarHead)
- return;
- else if (!VarHead->next && !strcmp(VarHead->name, name)) {
- safe_free(VarHead->name);
- safe_free(VarHead->value);
- free(VarHead);
- VarHead = NULL;
- }
- else {
- for (vp = VarHead; vp; vp = vp->next) {
- if (!strcmp(vp->name, name)) {
- Variable *save = vp->next;
-
- safe_free(vp->name);
- safe_free(vp->value);
- *vp = *save;
- safe_free(save);
- break;
- }
- }
- }
-}
-
-/* Prompt user for the name of a variable */
-char *
-variable_get_value(char *var, char *prompt, int dirty)
-{
- char *cp;
-
- cp = variable_get(var);
- if (cp && variable_get(VAR_NONINTERACTIVE))
- return cp;
- else if ((cp = msgGetInput(cp, "%s", prompt)) != NULL)
- variable_set2(var, cp, dirty);
- else
- cp = NULL;
- return cp;
-}
-
-/* Check if value passed in data (in the form "variable=value") is
- * valid, and it's status compared to the value of variable stored in
- * env
- *
- * Possible return values :
- * -3: Invalid line, the data string is NOT set as an env variable
- * -2: Invalid line, the data string is set as an env variable
- * -1: Invalid line
- * 0: Valid line, is NOT equal to env version
- * 1: Valid line, is equal to env version
- * 2: Valid line, value empty - e.g. foo=""
- * 3: Valid line, does not exist in env
-*/
-int
-variable_check2(char *data)
-{
- char *cp, *cp2, *cp3, tmp[256];
-
- if (data == NULL)
- return -1;
- SAFE_STRCPY(tmp, data);
- if ((cp = index(tmp, '=')) != NULL) {
- *(cp++) = '\0';
- if (*cp == '"') { /* smash quotes if present */
- ++cp;
- if ((cp3 = index(cp, '"')) != NULL)
- *cp3 = '\0';
- }
- else if ((cp3 = index(cp, ',')) != NULL)
- *cp3 = '\0';
- cp2 = variable_get(tmp);
- if (cp2 != NULL) {
- if (*cp == '\0')
- return 2;
- else
- return strcmp(cp, cp2) == 0 ? 1 : 0;
- }
- else
- return 3;
- }
- else
- return variable_get(tmp) != NULL ? -2 : -3;
-}
-
-/* Check if the value passed in data (in the form "variable=value") is
- equal to the value of variable stored in env */
-int
-variable_check(char *data)
-{
- int ret;
- ret = variable_check2(data);
-
- switch(ret) {
- case -2:
- case 1:
- case 2:
- return TRUE;
- /* NOT REACHED */
- default:
- return FALSE;
- }
-}
-
-int
-dump_variables(dialogMenuItem *unused)
-{
- FILE *fp;
- Variable *vp;
-
- if (isDebug())
- msgDebug("Writing sysinstall variables to file..\n");
-
- fp = fopen("/etc/sysinstall.vars", "w");
- if (!fp) {
- msgConfirm("Unable to write to /etc/sysinstall.vars: %s",
- strerror(errno));
- return DITEM_FAILURE;
- }
-
- for (vp = VarHead; vp; vp = vp->next)
- fprintf(fp, "%s=\"%s\" (%d)\n", vp->name, vp->value, vp->dirty);
-
- fclose(fp);
-
- return DITEM_SUCCESS;
-}
-
-/* Free all of the variables, useful to really start over as when the
- user selects "restart" from the interrupt menu. */
-void
-free_variables(void)
-{
- Variable *vp;
-
- /* Free the variables from our list, if we have one.. */
- if (!VarHead)
- return;
- else if (!VarHead->next) {
- unsetenv(VarHead->name);
- safe_free(VarHead->name);
- safe_free(VarHead->value);
- free(VarHead);
- VarHead = NULL;
- }
- else {
- for (vp = VarHead; vp; ) {
- Variable *save = vp;
- unsetenv(vp->name);
- safe_free(vp->name);
- safe_free(vp->value);
- vp = vp->next;
- safe_free(save);
- }
- VarHead = NULL;
- }
-}
-
-/*
- * Persistent variables. The variables modified by these functions
- * are not cleared between invocations of sysinstall. This is useful
- * to allow the user to completely restart sysinstall, without having
- * it load all of the modules again from the installation media which
- * are still in memory.
- */
-
-void
-pvariable_set(char *var)
-{
- char tmp[1024];
-
- if (!var)
- msgFatal("NULL variable name & value passed.");
- else if (!*var)
- msgDebug("Warning: Zero length name & value passed to variable_set()\n");
- /* Add a trivial namespace to whatever name the caller chooses. */
- SAFE_STRCPY(tmp, "SYSINSTALL_PVAR");
- if (index(var, '=') == NULL)
- msgFatal("Invalid variable format: %s", var);
- strlcat(tmp, var, 1024);
- putenv(tmp);
-}
-
-char *
-pvariable_get(char *var)
-{
- char tmp[1024];
-
- SAFE_STRCPY(tmp, "SYSINSTALL_PVAR");
- strlcat(tmp, var, 1024);
- return getenv(tmp);
-}
diff --git a/usr.sbin/sade/wizard.c b/usr.sbin/sade/wizard.c
deleted file mode 100644
index 98e0a5c..0000000
--- a/usr.sbin/sade/wizard.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * $FreeBSD$
- *
- */
-
-#include "sysinstall.h"
-#include <fcntl.h>
-#include <err.h>
-#include <libdisk.h>
-
-int
-scan_block(int fd, daddr_t block)
-{
- u_char foo[512];
-
- if (-1 == lseek(fd,block * 512,SEEK_SET))
- err(1,"lseek");
- if (512 != read(fd,foo, 512))
- return 1;
- return 0;
-}
-
-void
-Scan_Disk(Disk *d)
-{
- char device[64];
- u_long l;
- int i,j,fd;
-
- strcpy(device,"/dev/");
- strcat(device,d->name);
-
- fd = open(device,O_RDWR);
- if (fd < 0) {
- msgWarn("open(%s) failed", device);
- return;
- }
- for(i=-1,l=0;;l++) {
- j = scan_block(fd,l);
- if (j != i) {
- if (i == -1) {
- printf("%c: %lu.",j ? 'B' : 'G', l);
- fflush(stdout);
- } else if (i == 0) {
- printf(".%lu\nB: %lu.",l-1,l);
- fflush(stdout);
- } else {
- printf(".%lu\nG: %lu.",l-1,l);
- fflush(stdout);
- }
- i = j;
- }
- }
- close(fd);
-}
-
-void
-slice_wizard(Disk *d)
-{
- Disk *db;
- char myprompt[BUFSIZ];
- char input[BUFSIZ];
- char *p,*q=0;
- char **cp,*cmds[200];
- int ncmd,i;
-
- systemSuspendDialog();
- sprintf(myprompt,"%s> ", d->name);
- while(1) {
- printf("--==##==--\n");
- Debug_Disk(d);
- p = CheckRules(d);
- if (p) {
- printf("%s",p);
- free(p);
- }
- printf("%s", myprompt);
- fflush(stdout);
- q = p = fgets(input,sizeof(input),stdin);
- if(!p)
- break;
- for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
- if (**cp != '\0')
- cp++;
- ncmd = cp - cmds;
- if(!ncmd)
- continue;
- if (!strcasecmp(*cmds,"quit")) { break; }
- if (!strcasecmp(*cmds,"exit")) { break; }
- if (!strcasecmp(*cmds,"q")) { break; }
- if (!strcasecmp(*cmds,"x")) { break; }
- if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
- printf("delete = %d\n",
- Delete_Chunk(d,
- (struct chunk *)strtol(cmds[1],0,0)));
- continue;
- }
- if (!strcasecmp(*cmds,"allfreebsd")) {
- All_FreeBSD(d, 0);
- continue;
- }
- if (!strcasecmp(*cmds,"dedicate")) {
- All_FreeBSD(d, 1);
- continue;
- }
- if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
- Set_Bios_Geom(d,
- strtol(cmds[1],0,0),
- strtol(cmds[2],0,0),
- strtol(cmds[3],0,0));
- continue;
- }
- if (!strcasecmp(*cmds,"list")) {
- cp = Disk_Names();
- printf("Disks:");
- for(i=0;cp[i];i++) {
- printf(" %s",cp[i]);
- free(cp[i]);
- }
- free(cp);
- continue;
- }
-#ifdef PC98
- if (!strcasecmp(*cmds,"create") && ncmd == 7) {
- printf("Create=%d\n",
- Create_Chunk(d,
- strtol(cmds[1],0,0),
- strtol(cmds[2],0,0),
- strtol(cmds[3],0,0),
- strtol(cmds[4],0,0),
- strtol(cmds[5],0,0),
- cmds[6]));
- continue;
- }
-#else
- if (!strcasecmp(*cmds,"create") && ncmd == 6) {
- printf("Create=%d\n",
- Create_Chunk(d,
- strtol(cmds[1],0,0),
- strtol(cmds[2],0,0),
- strtol(cmds[3],0,0),
- strtol(cmds[4],0,0),
- strtol(cmds[5],0,0), ""));
- continue;
- }
-#endif
- if (!strcasecmp(*cmds,"read")) {
- db = d;
- if (ncmd > 1)
- d = Open_Disk(cmds[1]);
- else
- d = Open_Disk(d->name);
- if (d)
- Free_Disk(db);
- else
- d = db;
- continue;
- }
- if (!strcasecmp(*cmds,"scan")) {
- Scan_Disk(d);
- continue;
- }
- if (!strcasecmp(*cmds,"write")) {
- printf("Write=%d\n",
- Fake ? 0 : Write_Disk(d));
- q = strdup(d->name);
- Free_Disk(d);
- d = Open_Disk(q);
- continue;
- }
- if (strcasecmp(*cmds,"help"))
- printf("\007ERROR\n");
- printf("CMDS:\n");
- printf("allfreebsd\t\t");
- printf("dedicate\t\t");
- printf("bios cyl hd sect\n");
- printf("collapse [pointer]\t\t");
-#ifdef PC98
- printf("create offset size enum subtype flags name\n");
-#else
- printf("create offset size enum subtype flags\n");
-#endif
- printf("subtype(part): swap=1, ffs=7\t\t");
- printf("delete pointer\n");
- printf("list\t\t");
- printf("quit\n");
- printf("read [disk]\t\t");
- printf("scan\n");
- printf("write\t\t");
- printf("\n");
-
- }
- systemResumeDialog();
-}
OpenPOWER on IntegriCloud