# PaCkAgE DaTaStReAm O5ndsampl 1 1684 # end of header 0707010000000000008092000000000000000000000001000000000000000f000000000000000000000000000000000000001200000000/tmp/._xAtTr_19354 1:acl 2:priv 0707010002384e000081a400000000000000030000000137574688000000ca00001dff0000000100000000000000000000001200000000O5ndsampl/pkginfoPSTAMP=OSR5 03May99 HBL2 ARCH=IA32 PKG=O5ndsampl NAME=OpenServer NIC Driver Samples DESC=Sample MDI network drivers for OpenServer 5 VENDOR=SCO RELEASE=5 VERSION=7.1.0 CATEGORY=application CLASSES=none 0707010002384f000081a400000000000000030000000137574688000030c000001dff0000000100000000000000000000001100000000O5ndsampl/pkgmap: 1 1684 1 d none /usr ? ? ? 1 d none /usr/src ? ? ? 1 d none /usr/src/O5hdk 0755 bin bin 1 d none /usr/src/O5hdk/net 0755 bin bin 1 f none /usr/src/O5hdk/net/Make.inc 0644 root root 2634 3835 928520557 1 f none /usr/src/O5hdk/net/Makefile 0644 root root 18754 17918 928520557 1 f none /usr/src/O5hdk/net/README 0644 root root 9371 63105 928516006 1 d none /usr/src/O5hdk/net/cmd 0755 bin bin 1 f none /usr/src/O5hdk/net/cmd/Makefile 0644 root root 476 36347 900714368 1 d none /usr/src/O5hdk/net/cmd/intl 0755 bin bin 1 f none /usr/src/O5hdk/net/cmd/intl/Makefile 0644 root root 836 50857 900714368 1 f none /usr/src/O5hdk/net/cmd/intl/intl.c 0644 root root 928 5631 900714368 1 d none /usr/src/O5hdk/net/cmd/stzget 0755 bin bin 1 f none /usr/src/O5hdk/net/cmd/stzget/Makefile 0644 root root 425 30259 900714367 1 f none /usr/src/O5hdk/net/cmd/stzget/stzget.c 0644 root root 1488 51644 900714368 1 d none /usr/src/O5hdk/net/drv 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/Makefile 0644 root root 379 26799 900714434 1 d none /usr/src/O5hdk/net/drv/mdi 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/Makefile 0644 root root 864 50082 900714375 1 d none /usr/src/O5hdk/net/drv/mdi/ahdk 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/ahdk/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/AOF/ahdk 0644 root root 403 29711 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/Makefile 0644 root root 450 34177 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/Space.c 0644 root root 627 45996 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/ahdk.h 0644 root root 598 49344 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/ahdkli.c 0644 root root 1509 53579 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/ahdkmac.c 0644 root root 330 25993 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/lkcfg 0644 root root 1641 57727 900714375 1 d none /usr/src/O5hdk/net/drv/mdi/e3B 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/e3B/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/AOF/e3B 0644 root root 577 40411 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/Makefile 0644 root root 598 44696 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/Master 0644 root root 65 3383 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/Space.c 0644 root root 2120 33045 900714374 1 d none /usr/src/O5hdk/net/drv/mdi/e3B/acfg 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/Makefile 0644 root root 611 44633 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/acfg.c 0644 root root 1520 53499 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/boardio.c 0644 root root 1622 55153 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/e503setup.h 0644 root root 1086 17356 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/io.s 0644 root root 1355 28667 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/e3B.h 0644 root root 9463 46457 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/e3Bio.s 0644 root root 2843 18578 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/e3Bli.c 0644 root root 11416 17394 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/e3Bmac.c 0644 root root 14820 7895 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/lkcfg 0644 root root 1843 7645 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/space.h 0644 root root 620 45314 900714374 1 d none /usr/src/O5hdk/net/drv/mdi/e3D 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/e3D/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/AOF/e3D 0644 root root 929 64701 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/Makefile 0644 root root 557 40579 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/Space.c 0644 root root 2735 17444 900714376 1 d none /usr/src/O5hdk/net/drv/mdi/e3D/acfg 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/Makefile 0644 root root 470 34214 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/acfg.c 0644 root root 13694 61432 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/boardio.c 0644 root root 11059 46723 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/e507setup.h 0644 root root 9603 58310 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/io.s 0644 root root 1355 28667 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/e3D.h 0644 root root 26121 29243 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/e3Dli.c 0644 root root 11735 39185 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/e3Dmac.c 0644 root root 43675 51150 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/lkcfg 0644 root root 1446 41687 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/space.h 0644 root root 620 45338 900714376 1 d none /usr/src/O5hdk/net/drv/mdi/shrk 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/shrk/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/AOF/osi2300 0644 root root 497 35374 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/AOF/shrk 0644 root root 514 36900 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/AOF/snapper 0644 root root 521 37663 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/Makefile 0644 root root 779 55418 913401862 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/Master 0644 root root 28 1681 913401862 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/Node 0644 root root 132 10222 913401863 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/Space.c 0644 root root 1781 15878 913401864 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/System 0644 root root 92 3983 913401864 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/lkcfg 0644 root root 1668 61118 913401865 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/shrk.h 0644 root root 36263 65329 918498465 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/shrkhw.c 0644 root root 45507 33737 927835350 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/shrkmdi.c 0644 root root 61236 43401 928251722 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/space.h 0644 root root 703 51469 913401915 1 d none /usr/src/O5hdk/net/drv/mdi/tok 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/tok/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/tok/AOF/tok-isa 0644 root root 889 514 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/tok/AOF/tok-isa-auto 0644 root root 829 62180 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/tok/AOF/tok-mca 0644 root root 853 62591 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/tok/Makefile 0644 root root 640 46926 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/Master 0644 root root 27 1485 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/Space.c 0644 root root 2093 27906 900714373 1 d none /usr/src/O5hdk/net/drv/mdi/tok/acfg 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/tok/acfg/Makefile 0644 root root 492 36073 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/acfg/acfg.c 0644 root root 5541 20417 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/acfg/acfgio.s 0644 root root 854 59644 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/lkcfg 0644 root root 2582 65062 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/space.h 0644 root root 771 53299 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/tok/tok.h 0644 root root 19678 29826 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/tokli.c 0644 root root 11004 48179 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/tokmac.c 0644 root root 53006 22801 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/tokmac.c.aux 0644 root root 44688 60051 900714374 1 d none /usr/src/O5hdk/net/scripts 0755 bin bin 1 d none /usr/src/O5hdk/net/scripts/custom 0755 bin bin 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.cmpnt 0644 root root 555 33405 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.config 0644 root root 1264 37354 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.drv.ctl 0644 root root 331 27314 900714439 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.ne.cfg 0644 root root 413 34559 900714439 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pkg 0644 root root 6893 25748 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pkg.ctl 0644 root root 325 26719 928520557 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pkg.ctl.XX 0644 root root 627 51766 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pkg.doc 0644 root root 203 16975 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pr.cfg 0644 root root 291 23753 900714439 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.prd 0644 root root 217 15841 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/ccs 0644 root root 1495 51073 900714435 1 f none /usr/src/O5hdk/net/scripts/custom/cpcs 0644 root root 7991 49713 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/cqs 0644 root root 2276 41596 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/instlib.sh 0644 root root 896 1131 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/perms 0644 root root 4069 53350 900714435 1 f none /usr/src/O5hdk/net/scripts/custom/pkg.core 0644 root root 3086 26342 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/pkg.ncfg 0644 root root 2274 51455 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/tbird.rmv 0644 root root 2861 11036 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/tbird.upg 0644 root root 1594 59824 900714438 1 d none /usr/src/O5hdk/net/sys 0755 bin bin 1 f none /usr/src/O5hdk/net/sys/attdlpi.h 0644 root root 38889 59263 900714434 1 f none /usr/src/O5hdk/net/sys/dlpimod.h 0644 root root 11073 48973 900714434 1 f none /usr/src/O5hdk/net/sys/lli31.h 0644 root root 8532 49767 900714434 1 f none /usr/src/O5hdk/net/sys/mdi.h 0644 root root 17254 34736 900714434 1 f none /usr/src/O5hdk/net/sys/scodlpi.h 0644 root root 7145 47387 900714434 1 f none /usr/src/O5hdk/net/sys/sr.h 0644 root root 3416 9475 900714434 1 d none /usr/src/O5hdk/net/tools 0755 bin bin 1 f none /usr/src/O5hdk/net/tools/Makefile 0644 root root 381 29605 900714441 1 d none /usr/src/O5hdk/net/tools/aoflint 0755 bin bin 1 f none /usr/src/O5hdk/net/tools/aoflint/Makefile 0644 root root 453 35589 900714440 1 f none /usr/src/O5hdk/net/tools/aoflint/error.c 0644 root root 799 64220 900714440 1 f none /usr/src/O5hdk/net/tools/aoflint/lexer.l 0644 root root 2621 63943 900714440 1 f none /usr/src/O5hdk/net/tools/aoflint/main.c 0644 root root 993 12361 900714441 1 f none /usr/src/O5hdk/net/tools/aoflint/parser.y 0644 root root 8860 48407 900714440 1 f none /usr/src/O5hdk/net/tools/aoflint/tab.h 0644 root root 735 57005 924651813 1 f none /usr/src/O5hdk/net/tools/cvbinCdecl.c 0644 root root 895 62851 900714441 1 f none /usr/src/O5hdk/net/tools/gencmpnt 0644 root root 1879 10863 900714441 1 f none /usr/src/O5hdk/net/tools/gencmpntmacr 0644 root root 545 41605 900714442 1 f none /usr/src/O5hdk/net/tools/gendocpkg 0644 root root 1243 30765 900714442 1 f none /usr/src/O5hdk/net/tools/gendocstubs 0644 root root 459 36558 900714442 1 f none /usr/src/O5hdk/net/tools/gendrvpkg 0644 root root 6145 9278 900714442 1 f none /usr/src/O5hdk/net/tools/gendrvprd 0644 root root 1912 16508 900714442 1 f none /usr/src/O5hdk/net/tools/genlang 0644 root root 1481 52653 900714441 1 f none /usr/src/O5hdk/net/tools/genlliprd 0644 root root 1235 30563 900714442 1 f none /usr/src/O5hdk/net/tools/genlocccs 0644 root root 1766 6914 900714441 1 f none /usr/src/O5hdk/net/tools/genloccmpnt 0644 root root 1513 42433 900714442 1 f none /usr/src/O5hdk/net/tools/genloccqs 0644 root root 691 52186 900714442 1 f none /usr/src/O5hdk/net/tools/genlocdrcpnt 0644 root root 1549 44738 900714441 1 f none /usr/src/O5hdk/net/tools/genlocdrvcqs 0644 root root 632 47457 900714442 1 f none /usr/src/O5hdk/net/tools/genlocdrvpkg 0644 root root 1723 2246 900714442 1 f none /usr/src/O5hdk/net/tools/genmacro 0644 root root 1522 55409 900714442 1 f none /usr/src/O5hdk/net/tools/genmaster 0644 root root 512 39033 900714440 1 f none /usr/src/O5hdk/net/tools/genmcsstr 0644 root root 393 29674 900714440 1 f none /usr/src/O5hdk/net/tools/gennode 0644 root root 882 858 900714440 1 f none /usr/src/O5hdk/net/tools/genoneoffs 0644 root root 3433 12451 900714442 1 f none /usr/src/O5hdk/net/tools/genperms 0644 root root 1703 61444 900714440 1 f none /usr/src/O5hdk/net/tools/genpkg 0644 root root 5168 62159 928511918 1 f none /usr/src/O5hdk/net/tools/genprd 0644 root root 3260 46039 900714441 1 f none /usr/src/O5hdk/net/tools/gensource 0644 root root 527 41578 900714440 1 f none /usr/src/O5hdk/net/tools/gensystem 0644 root root 720 52369 900714440 1 f none /usr/src/O5hdk/net/tools/stripmcs 0644 root root 758 56303 900714440 1 f none /usr/src/O5hdk/net/tools/updatecdmt 0644 root root 669 50872 900714441 1 i copyright 72 6060 925755086 1 i pkginfo 202 15979 928520568 1 i postremove 216 18149 928515480 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!!0707010000000000008092000000000000000000000001000000000000000f000000000000000000000000000000000000001200000000/tmp/._xAtTr_19374 1:acl 2:priv 0707010002384e000081a400000000000000030000000137574688000000ca00001dff0000000100000000000000000000000800000000pkginfoPSTAMP=OSR5 03May99 HBL2 ARCH=IA32 PKG=O5ndsampl NAME=OpenServer NIC Driver Samples DESC=Sample MDI network drivers for OpenServer 5 VENDOR=SCO RELEASE=5 VERSION=7.1.0 CATEGORY=application CLASSES=none 0707010002384f000081a400000000000000030000000137574688000030c000001dff0000000100000000000000000000000700000000pkgmap: 1 1684 1 d none /usr ? ? ? 1 d none /usr/src ? ? ? 1 d none /usr/src/O5hdk 0755 bin bin 1 d none /usr/src/O5hdk/net 0755 bin bin 1 f none /usr/src/O5hdk/net/Make.inc 0644 root root 2634 3835 928520557 1 f none /usr/src/O5hdk/net/Makefile 0644 root root 18754 17918 928520557 1 f none /usr/src/O5hdk/net/README 0644 root root 9371 63105 928516006 1 d none /usr/src/O5hdk/net/cmd 0755 bin bin 1 f none /usr/src/O5hdk/net/cmd/Makefile 0644 root root 476 36347 900714368 1 d none /usr/src/O5hdk/net/cmd/intl 0755 bin bin 1 f none /usr/src/O5hdk/net/cmd/intl/Makefile 0644 root root 836 50857 900714368 1 f none /usr/src/O5hdk/net/cmd/intl/intl.c 0644 root root 928 5631 900714368 1 d none /usr/src/O5hdk/net/cmd/stzget 0755 bin bin 1 f none /usr/src/O5hdk/net/cmd/stzget/Makefile 0644 root root 425 30259 900714367 1 f none /usr/src/O5hdk/net/cmd/stzget/stzget.c 0644 root root 1488 51644 900714368 1 d none /usr/src/O5hdk/net/drv 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/Makefile 0644 root root 379 26799 900714434 1 d none /usr/src/O5hdk/net/drv/mdi 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/Makefile 0644 root root 864 50082 900714375 1 d none /usr/src/O5hdk/net/drv/mdi/ahdk 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/ahdk/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/AOF/ahdk 0644 root root 403 29711 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/Makefile 0644 root root 450 34177 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/Space.c 0644 root root 627 45996 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/ahdk.h 0644 root root 598 49344 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/ahdkli.c 0644 root root 1509 53579 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/ahdkmac.c 0644 root root 330 25993 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/ahdk/lkcfg 0644 root root 1641 57727 900714375 1 d none /usr/src/O5hdk/net/drv/mdi/e3B 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/e3B/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/AOF/e3B 0644 root root 577 40411 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/Makefile 0644 root root 598 44696 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/Master 0644 root root 65 3383 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/Space.c 0644 root root 2120 33045 900714374 1 d none /usr/src/O5hdk/net/drv/mdi/e3B/acfg 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/Makefile 0644 root root 611 44633 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/acfg.c 0644 root root 1520 53499 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/boardio.c 0644 root root 1622 55153 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/e503setup.h 0644 root root 1086 17356 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/acfg/io.s 0644 root root 1355 28667 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/e3B.h 0644 root root 9463 46457 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/e3Bio.s 0644 root root 2843 18578 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/e3Bli.c 0644 root root 11416 17394 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/e3Bmac.c 0644 root root 14820 7895 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/lkcfg 0644 root root 1843 7645 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/e3B/space.h 0644 root root 620 45314 900714374 1 d none /usr/src/O5hdk/net/drv/mdi/e3D 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/e3D/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/AOF/e3D 0644 root root 929 64701 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/Makefile 0644 root root 557 40579 900714375 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/Space.c 0644 root root 2735 17444 900714376 1 d none /usr/src/O5hdk/net/drv/mdi/e3D/acfg 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/Makefile 0644 root root 470 34214 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/acfg.c 0644 root root 13694 61432 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/boardio.c 0644 root root 11059 46723 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/e507setup.h 0644 root root 9603 58310 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/acfg/io.s 0644 root root 1355 28667 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/e3D.h 0644 root root 26121 29243 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/e3Dli.c 0644 root root 11735 39185 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/e3Dmac.c 0644 root root 43675 51150 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/lkcfg 0644 root root 1446 41687 900714376 1 f none /usr/src/O5hdk/net/drv/mdi/e3D/space.h 0644 root root 620 45338 900714376 1 d none /usr/src/O5hdk/net/drv/mdi/shrk 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/shrk/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/AOF/osi2300 0644 root root 497 35374 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/AOF/shrk 0644 root root 514 36900 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/AOF/snapper 0644 root root 521 37663 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/Makefile 0644 root root 779 55418 913401862 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/Master 0644 root root 28 1681 913401862 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/Node 0644 root root 132 10222 913401863 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/Space.c 0644 root root 1781 15878 913401864 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/System 0644 root root 92 3983 913401864 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/lkcfg 0644 root root 1668 61118 913401865 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/shrk.h 0644 root root 36263 65329 918498465 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/shrkhw.c 0644 root root 45507 33737 927835350 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/shrkmdi.c 0644 root root 61236 43401 928251722 1 f none /usr/src/O5hdk/net/drv/mdi/shrk/space.h 0644 root root 703 51469 913401915 1 d none /usr/src/O5hdk/net/drv/mdi/tok 0755 bin bin 1 d none /usr/src/O5hdk/net/drv/mdi/tok/AOF 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/tok/AOF/tok-isa 0644 root root 889 514 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/tok/AOF/tok-isa-auto 0644 root root 829 62180 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/tok/AOF/tok-mca 0644 root root 853 62591 928520558 1 f none /usr/src/O5hdk/net/drv/mdi/tok/Makefile 0644 root root 640 46926 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/Master 0644 root root 27 1485 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/Space.c 0644 root root 2093 27906 900714373 1 d none /usr/src/O5hdk/net/drv/mdi/tok/acfg 0755 bin bin 1 f none /usr/src/O5hdk/net/drv/mdi/tok/acfg/Makefile 0644 root root 492 36073 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/acfg/acfg.c 0644 root root 5541 20417 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/acfg/acfgio.s 0644 root root 854 59644 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/lkcfg 0644 root root 2582 65062 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/space.h 0644 root root 771 53299 900714374 1 f none /usr/src/O5hdk/net/drv/mdi/tok/tok.h 0644 root root 19678 29826 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/tokli.c 0644 root root 11004 48179 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/tokmac.c 0644 root root 53006 22801 900714373 1 f none /usr/src/O5hdk/net/drv/mdi/tok/tokmac.c.aux 0644 root root 44688 60051 900714374 1 d none /usr/src/O5hdk/net/scripts 0755 bin bin 1 d none /usr/src/O5hdk/net/scripts/custom 0755 bin bin 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.cmpnt 0644 root root 555 33405 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.config 0644 root root 1264 37354 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.drv.ctl 0644 root root 331 27314 900714439 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.ne.cfg 0644 root root 413 34559 900714439 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pkg 0644 root root 6893 25748 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pkg.ctl 0644 root root 325 26719 928520557 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pkg.ctl.XX 0644 root root 627 51766 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pkg.doc 0644 root root 203 16975 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.pr.cfg 0644 root root 291 23753 900714439 1 f none /usr/src/O5hdk/net/scripts/custom/CDMT.prd 0644 root root 217 15841 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/ccs 0644 root root 1495 51073 900714435 1 f none /usr/src/O5hdk/net/scripts/custom/cpcs 0644 root root 7991 49713 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/cqs 0644 root root 2276 41596 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/instlib.sh 0644 root root 896 1131 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/perms 0644 root root 4069 53350 900714435 1 f none /usr/src/O5hdk/net/scripts/custom/pkg.core 0644 root root 3086 26342 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/pkg.ncfg 0644 root root 2274 51455 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/tbird.rmv 0644 root root 2861 11036 900714438 1 f none /usr/src/O5hdk/net/scripts/custom/tbird.upg 0644 root root 1594 59824 900714438 1 d none /usr/src/O5hdk/net/sys 0755 bin bin 1 f none /usr/src/O5hdk/net/sys/attdlpi.h 0644 root root 38889 59263 900714434 1 f none /usr/src/O5hdk/net/sys/dlpimod.h 0644 root root 11073 48973 900714434 1 f none /usr/src/O5hdk/net/sys/lli31.h 0644 root root 8532 49767 900714434 1 f none /usr/src/O5hdk/net/sys/mdi.h 0644 root root 17254 34736 900714434 1 f none /usr/src/O5hdk/net/sys/scodlpi.h 0644 root root 7145 47387 900714434 1 f none /usr/src/O5hdk/net/sys/sr.h 0644 root root 3416 9475 900714434 1 d none /usr/src/O5hdk/net/tools 0755 bin bin 1 f none /usr/src/O5hdk/net/tools/Makefile 0644 root root 381 29605 900714441 1 d none /usr/src/O5hdk/net/tools/aoflint 0755 bin bin 1 f none /usr/src/O5hdk/net/tools/aoflint/Makefile 0644 root root 453 35589 900714440 1 f none /usr/src/O5hdk/net/tools/aoflint/error.c 0644 root root 799 64220 900714440 1 f none /usr/src/O5hdk/net/tools/aoflint/lexer.l 0644 root root 2621 63943 900714440 1 f none /usr/src/O5hdk/net/tools/aoflint/main.c 0644 root root 993 12361 900714441 1 f none /usr/src/O5hdk/net/tools/aoflint/parser.y 0644 root root 8860 48407 900714440 1 f none /usr/src/O5hdk/net/tools/aoflint/tab.h 0644 root root 735 57005 924651813 1 f none /usr/src/O5hdk/net/tools/cvbinCdecl.c 0644 root root 895 62851 900714441 1 f none /usr/src/O5hdk/net/tools/gencmpnt 0644 root root 1879 10863 900714441 1 f none /usr/src/O5hdk/net/tools/gencmpntmacr 0644 root root 545 41605 900714442 1 f none /usr/src/O5hdk/net/tools/gendocpkg 0644 root root 1243 30765 900714442 1 f none /usr/src/O5hdk/net/tools/gendocstubs 0644 root root 459 36558 900714442 1 f none /usr/src/O5hdk/net/tools/gendrvpkg 0644 root root 6145 9278 900714442 1 f none /usr/src/O5hdk/net/tools/gendrvprd 0644 root root 1912 16508 900714442 1 f none /usr/src/O5hdk/net/tools/genlang 0644 root root 1481 52653 900714441 1 f none /usr/src/O5hdk/net/tools/genlliprd 0644 root root 1235 30563 900714442 1 f none /usr/src/O5hdk/net/tools/genlocccs 0644 root root 1766 6914 900714441 1 f none /usr/src/O5hdk/net/tools/genloccmpnt 0644 root root 1513 42433 900714442 1 f none /usr/src/O5hdk/net/tools/genloccqs 0644 root root 691 52186 900714442 1 f none /usr/src/O5hdk/net/tools/genlocdrcpnt 0644 root root 1549 44738 900714441 1 f none /usr/src/O5hdk/net/tools/genlocdrvcqs 0644 root root 632 47457 900714442 1 f none /usr/src/O5hdk/net/tools/genlocdrvpkg 0644 root root 1723 2246 900714442 1 f none /usr/src/O5hdk/net/tools/genmacro 0644 root root 1522 55409 900714442 1 f none /usr/src/O5hdk/net/tools/genmaster 0644 root root 512 39033 900714440 1 f none /usr/src/O5hdk/net/tools/genmcsstr 0644 root root 393 29674 900714440 1 f none /usr/src/O5hdk/net/tools/gennode 0644 root root 882 858 900714440 1 f none /usr/src/O5hdk/net/tools/genoneoffs 0644 root root 3433 12451 900714442 1 f none /usr/src/O5hdk/net/tools/genperms 0644 root root 1703 61444 900714440 1 f none /usr/src/O5hdk/net/tools/genpkg 0644 root root 5168 62159 928511918 1 f none /usr/src/O5hdk/net/tools/genprd 0644 root root 3260 46039 900714441 1 f none /usr/src/O5hdk/net/tools/gensource 0644 root root 527 41578 900714440 1 f none /usr/src/O5hdk/net/tools/gensystem 0644 root root 720 52369 900714440 1 f none /usr/src/O5hdk/net/tools/stripmcs 0644 root root 758 56303 900714440 1 f none /usr/src/O5hdk/net/tools/updatecdmt 0644 root root 669 50872 900714441 1 i copyright 72 6060 925755086 1 i pkginfo 202 15979 928520568 1 i postremove 216 18149 928515480 070701000238ad000081a40000000000000003000000013757467d00000a4a00001dff0000000100000000000000000000002000000000root/usr/src/O5hdk/net/Make.inc# # @(#) Make.inc 77.2 99/05/03 SCOINC # # Copyright (C) 1993-1999 The Santa Cruz Operation, Inc. # All Rights Reserved. # The information in this file is provided for the exclusive use of # the licensees of The Santa Cruz Operation, Inc. Such users have the # right to use, modify, and incorporate this code into other products # for purposes authorized by the license agreement provided they include # this notice and the associated copyright notice with any such product. # The information in this file is provided "AS IS" without warranty. # ################################################################################ # This section of the file contains those Makefile defines which can be # modified. ################################################################################ PRODDESC=AHDK Prototype Network Drivers # PRODVENDOR and PRODPRD are combined to form a unique identifier which # is used by custom as the internal name of the product. PRODVENDOR=AHDK PRODPRD=netdriver # PRODREL is the version of the product. Use a version number which is # syntactically similar to the example PRODREL=1.0.0a # PRODMEDIA is the media type of the product. Use TAPE or FLOPPY PRODMEDIA=TAPE # The source for these drivers may be shipped to external 3rd parties as # example driver source. SCO_OWNED_DLIST=e3B e3D shrk tok # The source for these drivers will only be passed to groups within SCO. RESTRICTED_DLIST=btok \ dcxe dcxf dex dfx d21x \ e3C e3E e3G e3H \ eeA eeB eeC eeD eeE \ exos \ hfm hfs hpe hpi \ hhtr \ i3B i6E \ nat ne \ pnt \ sebm sme smpw \ skfp \ stbg trps wwdu \ wdn # DLIST and CONTENTS list the drivers that are shipped in the product. # DLIST is a space separated list of the drivers. # CONTENTS is DLIST plus any other support packages. # For 3rd party driver disks, CONTENTS and DLIST are the same. DLIST=ahdk CONTENTS=$(DLIST) ################################################################################ # Here ends the section of user modifiable parameters and begins all # those parameters which are derived from the above. ################################################################################ SHELL=/bin/sh PRODCODE=$(PRODVENDOR):$(PRODPRD) SRC=$(ROOT) DIST=$(ROOT)/dist/ahdk CDMT_DIR=$(ROOT) CDIST=$(ROOT)/cdist DRVDISTDIR=$(ROOT)/dist DRVDIST=$(ROOT)/dist/ahdk MDISRC=$(SRC)/drv/mdi LLISRC=$(SRC)/drv/dlpi NCFGSRC=$(SRC)/scripts/ncfg CUSTOMSRC=$(SRC)/scripts/custom DOCSRC=$(SRC)/NetDrivers_DOC TOOLSBIN=$(ROOT)/tools SYSADMLIBS=-lsysadm -lPW /usr/lib/CC/libC.a MKCATDECL=mkcatdecl AOFLINT=$(TOOLSBIN)/aoflint/aoflint 070701000238ae000081a40000000000000003000000013757467d0000494200001dff0000000100000000000000000000002000000000root/usr/src/O5hdk/net/Makefile# # %Z% %M% %I% %E% %Q% # # Copyright (C) 1993-1999 The Santa Cruz Operation, Inc. # All Rights Reserved. # The information in this file is provided for the exclusive use of # the licensees of The Santa Cruz Operation, Inc. Such users have the # right to use, modify, and incorporate this code into other products # for purposes authorized by the license agreement provided they include # this notice and the associated copyright notice with any such product. # The information in this file is provided "AS IS" without warranty. # ROOT=. include Make.inc all: tree dist clean: rm -fr cdmt.config cdmt.copyList input/*.cmpnt input/*.pkg cd tools ; make clean cd cmd ; make clean cd drv ; make clean clobber: rm -fr $(DIST) archives sso cdmt.config cdmt.copyList input cd tools ; make clobber cd cmd ; make clobber cd drv ; make clobber sampledrivers: @for d in $(SCO_OWNED_DLIST) ; \ do \ if [ -d drv/mdi/$$d ] ; \ then \ echo "cd drv/mdi/$$d ; make all" ; \ cd drv/mdi/$$d ; \ $(MAKE) all ; \ ../../../$(AOFLINT) AOF/* ; \ cd ../../.. ; \ fi ; \ done sampledist: tree sampledrivers prep_dist $(SCO_OWNED_DLIST) cp $(CUSTOMSRC)/CDMT.prd $(CDMT_DIR)/input/$(PRODPRD).prd chmod u+w $(CDMT_DIR)/input/$(PRODPRD).prd ROOT=$(ROOT) sh $(TOOLSBIN)/genprd $(CDMT_DIR)/input/$(PRODPRD).prd $(PRODVENDOR) $(PRODCODE) $(DOCSRC) $(SCO_OWNED_DLIST) sh $(TOOLSBIN)/updatecdmt ahdk $(PRODREL) $(CDMT_DIR)/input/$(PRODPRD).prd $(PRODCODE) $(PRODMEDIA) $(PRODDESC) dist: prep_dist $(CONTENTS) @echo "\nStripping and mcs binaries" sh $(TOOLSBIN)/stripmcs $(DIST) "`sh $(TOOLSBIN)/genmcsstr $(PRODREL) $(PRODDESC)`" dosdd135: # dosformat /dev/fd0135ds18 dosls /dev/fd0135ds18:/SCO || dosmkdir /dev/fd0135ds18:/SCO cd archives/FLOPPY; doscp VOL.000.000 /dev/fd0135ds18:/SCO/CUSTOM.DST dd135: cd archives/TAPE; tar cv6 VOL.000.00? tree: cd tools ; make all cd cmd ; make all cd drv ; make all clean_sso: rm -rf ./dist ./input ./sso cdmt.config stub mkdir -p $(DIST)/cntl/packages $(CDMT_DIR)/input updateprd: cp $(CUSTOMSRC)/CDMT.prd $(CDMT_DIR)/input/$(PRODPRD).prd chmod u+w $(CDMT_DIR)/input/$(PRODPRD).prd ROOT=$(ROOT) sh $(TOOLSBIN)/genprd $(CDMT_DIR)/input/$(PRODPRD).prd $(PRODVENDOR) $(PRODCODE) $(DOCSRC) $(CONTENTS) sh $(TOOLSBIN)/updatecdmt ahdk $(PRODREL) $(CDMT_DIR)/input/$(PRODPRD).prd $(PRODCODE) $(PRODMEDIA) $(PRODDESC) prep_dist: clean_sso updateprd echo $@ -mkdir -p $(DIST)/input [ ! $(PRODCODE) = "SCO:lli" ] || { \ PRODDIST=$(DRVDISTDIR)/$(PRODPRD) ; \ [ -d $$PRODDIST ] || mkdir -p $$PRODDIST/input ; \ cp $(CUSTOMSRC)/CDMT.cmpnt $$PRODDIST/input/$(PRODPRD).cmpnt ; \ chmod u+w $$PRODDIST/input/$(PRODPRD).cmpnt ; \ ROOT=$(ROOT) DRVDIST=$$PRODDIST sh $(TOOLSBIN)/gencmpnt $$PRODDIST/input/$(PRODPRD).cmpnt $(PRODVENDOR) $(PRODPRD) ; \ cp $(CUSTOMSRC)/CDMT.pkg.ctl $$PRODDIST/input/$(PRODPRD).pkg ; \ chmod u+w $$PRODDIST/input/$(PRODPRD).pkg ; \ cp $(CUSTOMSRC)/CDMT.pkg.doc $$PRODDIST/input/LLI_DOC.pkg ; \ ROOT=$(ROOT) sh $(TOOLSBIN)/genlliprd $(DIST)/input/lli.prd $(PRODVENDOR) $(PRODCODE) $(DOCSRC) $(SCO_OWNED_DLIST) ; \ sh $(TOOLSBIN)/updatecdmt ahdk $(PRODREL) $(DIST)/input/lli.prd $(PRODCODE) $(PRODMEDIA) $(PRODDESC) ; \ } cp $(CUSTOMSRC)/CDMT.config $(CDMT_DIR)/cdmt.config chmod u+w $(CDMT_DIR)/cdmt.config sh $(TOOLSBIN)/genmacro $(CDMT_DIR)/cdmt.config $(DOCSRC) $(DLIST) sh $(TOOLSBIN)/updatecdmt ahdk $(PRODREL) $(CDMT_DIR)/cdmt.config $(PRODCODE) $(PRODMEDIA) $(PRODDESC) cp $(CUSTOMSRC)/CDMT.pr.cfg $(DIST)/cdmt.prd.config chmod u+w $(DIST)/cdmt.prd.config sh $(TOOLSBIN)/gencmpntmacr $(DIST)/cdmt.prd.config ahdk ahdk cat $(CUSTOMSRC)/CDMT.ne.cfg >> $(DIST)/cdmt.prd.config sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $(DIST)/cdmt.prd.config $(PRODCODE) FLOPPY $(PRODDESC) sh $(TOOLSBIN)/gencmpntmacr $(DIST)/cdmt.config ahdk ahdk sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $(DIST)/cdmt.config $(PRODCODE) $(PRODMEDIA) $(PRODDESC) cp $(CUSTOMSRC)/ccs $(DIST)/cntl cp $(CUSTOMSRC)/cqs $(DIST)/cntl cp $(CUSTOMSRC)/instlib.sh $(DIST)/cntl [ ! -f $(CUSTOMSRC)/tbird.rmv ] || cp $(CUSTOMSRC)/tbird.rmv $(DIST)/cntl/oldcustom.rmv [ ! -d $(SRC)/cmd/netconfig ] || ROOT=$(ROOT) sh $(TOOLSBIN)/genncfg [ ! -f $(CUSTOMSRC)/ncfg_tbird_upgrade ] || cp $(CUSTOMSRC)/ncfg_tbird_upgrade $(DIST)/cntl # CDMT input files [ ! -f $(CUSTOMSRC)/CDMT.pkg ] || cat $(CUSTOMSRC)/CDMT.pkg >>$(DIST)/input/lli.pkg [ ! -f $(CUSTOMSRC)/pkg.ncfg ] || cp $(CUSTOMSRC)/pkg.ncfg $(DIST)/cntl/packages/pkg.ncfg [ ! -f $(CUSTOMSRC)/pkg.core ] || cp $(CUSTOMSRC)/pkg.core $(DIST)/cntl/packages/pkg.core base_dist: echo $@ mkdir -p $(DIST)/ncfg/olddir cp $(SRC)/cmd/netconfig/netconfig $(DIST)/ncfg/netconfig cp $(SRC)/cmd/netconfig/ncfginstall $(DIST)/ncfg/ncfginstall mkdir -p $(DIST)/ncfg/bin cp $(SRC)/cmd/intl/en/netconfig.msg.tcl $(DIST)/ncfg/bin cp $(SRC)/cmd/intl/en/ncfginstall.msg.tcl $(DIST)/ncfg/bin cp $(SRC)/cmd/netconfig/ncfgUI $(DIST)/ncfg/bin cp $(SRC)/cmd/intl/en/ncfgUI.msg.tcl $(DIST)/ncfg/bin cp $(SRC)/cmd/netconfig/ncfgBE $(DIST)/ncfg/bin cp $(SRC)/cmd/netconfig/ncfgprompter $(DIST)/ncfg/bin/ncfgprompter cp $(SRC)/cmd/intl/en/ncfgprompter.msg.tcl $(DIST)/ncfg/bin cp $(SRC)/cmd/pop/pop $(DIST)/ncfg/bin/pop touch $(DIST)/ncfg/olddir/chains mkdir -p $(DIST)/ncfg/icons cp $(SRC)/cmd/netconfig/icons/*.px $(DIST)/ncfg/icons cd $(DIST)/ncfg/icons; for i in L R ; { \ mv gcard$$i.px ghostcard$$i.px ; \ mv gcard16$$i.px ghostcard16$$i.px ; \ } mkdir -p $(DIST)/ncfg/netconfig.obj/en_US cp $(SRC)/cmd/netconfig/netconfig.obj/act.scoadmin $(DIST)/ncfg/netconfig.obj/activate.scoadmin cp $(SRC)/cmd/netconfig/netconfig.obj/activate $(DIST)/ncfg/netconfig.obj cp $(SRC)/cmd/netconfig/netconfig.obj/picture.px $(DIST)/ncfg/netconfig.obj cp $(SRC)/cmd/netconfig/netconfig.obj/open.px $(DIST)/ncfg/netconfig.obj cp $(SRC)/cmd/netconfig/netconfig.obj/s_picture.px $(DIST)/ncfg/netconfig.obj cp $(SRC)/cmd/netconfig/netconfig.obj/s_open.px $(DIST)/ncfg/netconfig.obj cp $(SRC)/cmd/intl/en/SAncfg.title $(DIST)/ncfg/netconfig.obj/en_US/title mkdir -p $(DIST)/llicompat/bin cp $(CUSTOMSRC)/perms $(DIST)/llicompat/perms chmod u+w $(DIST)/llicompat/perms sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $(DIST)/llicompat/perms $(PRODCODE) $(PRODMEDIA) $(PRODDESC) cp $(SRC)/sys/lli34/dlpi.h $(DIST)/llicompat/dlpi.h cp $(SRC)/sys/lli34/macstat.h $(DIST)/llicompat/macstat.h cp $(SRC)/cmd/llilib/ha $(DIST)/llicompat/bin/ha cp $(SRC)/cmd/llilib/hc $(DIST)/llicompat/bin/hc mkdir -p $(DIST)/bin mkdir -p $(DIST)/tmp mkdir -p $(DIST)/sysdb mkdir -p $(DIST)/lib touch $(DIST)/llimdi cp $(SRC)/scripts/libcfg.sh $(DIST)/lib/libcfg.sh cp $(SRC)/scripts/libSCO.tcl $(DIST)/lib/libSCO.tcl cp $(SRC)/cmd/intl/en/libSCO.msg.tcl $(DIST)/lib/libSCO.msg.tcl mkdir -p $(DIST)/inc for i in mdi.h dlpimod.h sr.h scodlpi.h attdlpi.h lli31.h ; { \ cp $(SRC)/sys/$$i $(DIST)/inc ; \ } cp $(SRC)/scripts/ndinstall $(DIST)/bin/ndinstall cp $(SRC)/cmd/intl/en/ndinstall.msg.tcl $(DIST)/bin/ndinstall.msg.tcl cp $(SRC)/scripts/ndipu $(DIST)/bin/ndipu cp $(SRC)/cmd/intl/en/ndipu.msg.tcl $(DIST)/bin/ndipu.msg.tcl cp $(SRC)/scripts/ndscript $(DIST)/bin/ndscript cp $(SRC)/cmd/intl/en/ndscript.msg.tcl $(DIST)/bin/ndscript.msg.tcl cp $(SRC)/scripts/ndprompter $(DIST)/bin/ndprompter.BE cp $(SRC)/cmd/intl/en/ndprompter.msg.tcl $(DIST)/bin/ndprompter.msg.tcl cp $(SRC)/cmd/llipathmap/llipathmap $(DIST)/bin/llipathmap cp $(SRC)/cmd/ndnamemap/ndnamemap $(DIST)/bin/ndnamemap cp $(SRC)/cmd/stzget/stzget $(DIST)/bin/stzget cp $(SRC)/cmd/llistat/llistat $(DIST)/bin/llistat cp $(SRC)/cmd/dlpid/dlpi $(DIST)/bin/start_stop cp $(SRC)/cmd/intl/en/dlpid.msg.tcl $(DIST)/bin/dlpid.msg.tcl cp $(SRC)/cmd/dlpid/dlpid $(DIST)/bin/dlpid cp $(SRC)/cmd/pcislot/pcislot $(DIST)/bin/pcislot mkdir -p $(DIST)/dlpi/dummy cp $(SRC)/drv/dummy/Driver.o $(DIST)/dlpi/dummy mkdir -p $(DIST)/dlpi/dlpi cp $(LLISRC)/lkcfg $(DIST)/dlpi/dlpi/lkcfg cp $(LLISRC)/Driver.o $(DIST)/dlpi/dlpi/Driver.o cp $(LLISRC)/Master $(DIST)/dlpi/dlpi/Master cp $(LLISRC)/Space.c $(DIST)/dlpi/dlpi/Space.c cp $(LLISRC)/System $(DIST)/dlpi/dlpi/System cp $(LLISRC)/space.h $(DIST)/dlpi/dlpi/space.h cp $(LLISRC)/DOF $(DIST)/dlpi/dlpi/DOF mkdir -p $(DIST)/ncfg/net0 cp $(NCFGSRC)/Info $(DIST)/ncfg/net0/Info cp $(NCFGSRC)/Init $(DIST)/ncfg/net0/Init cp $(NCFGSRC)/List $(DIST)/ncfg/net0/List cp $(NCFGSRC)/Reconf $(DIST)/ncfg/net0/Reconf cp $(NCFGSRC)/Remove $(DIST)/ncfg/net0/Remove cp $(SRC)/cmd/intl/en/ncfgnetx.msg.tcl $(DIST)/bin mkdir -p $(SRC)/stub/dist cp -r $(SRC)/prodUpgrade $(SRC)/stub/dist sh $(TOOLSBIN)/gendocstubs $(ROOT) nls_dist: prep_dist base_dist @ for d in $(SRC)/cmd/intl/* ;\ do \ if [ -d $$d ] ;\ then \ if [ $$d = "./cmd/intl/en" ] ;\ then \ NLSDIST=$(DIST) ;\ else \ NLS=`basename $$d | tr "[:lower:]" "[:upper:]"`;\ NLS_LOW_UP=`basename $$d`_$$NLS ;\ NLSDIST=$(DIST)_$$NLS ;\ mkdir -p $$NLSDIST/input ;\ cp $(CUSTOMSRC)/CDMT.pkg.doc \ $$NLSDIST/input/LLI_DOC.pkg ;\ mkdir -p $$NLSDIST/cntl ;\ mkdir -p \ $$NLSDIST/ncfg/netconfig.obj/$$NLS_LOW_UP ;\ cp $(SRC)/cmd/intl/`basename $$d`/SAncfg.title \ $$NLSDIST/ncfg/netconfig.obj/$$NLS_LOW_UP/title ;\ fi ;\ mkdir -p $$NLSDIST/lib/nls/msg/`basename $$d` ;\ cp $(SRC)/cmd/intl/`basename $$d`/lli.cat \ $$NLSDIST/lib/nls/msg/`basename $$d`/lli.cat ;\ cp $(SRC)/cmd/intl/`basename $$d`/ncfg.cat \ $$NLSDIST/lib/nls/msg/`basename $$d`/ncfg.cat;\ cp $(SRC)/cmd/intl/`basename $$d`/ndinst.cat \ $$NLSDIST/lib/nls/msg/`basename $$d`/ndinst.cat;\ cp $(SRC)/cmd/intl/`basename $$d`/dlpid.cat \ $$NLSDIST/lib/nls/msg/`basename $$d`/dlpid.cat;\ fi ;\ done sh $(TOOLSBIN)/genloccmpnt FR French > $(DIST)_FR/input/lli_FR.cmpnt sh $(TOOLSBIN)/updatecdmt ahdk $(PRODREL) $(DIST)_FR/input/lli_FR.cmpnt $(PRODCODE) $(PRODMEDIA) $(PRODDESC) sh $(TOOLSBIN)/genlang fr fr_FR.ISO8859-1 french_france.8859 fr_FR \ > $(DIST)_FR/input/lli.pkg sh $(TOOLSBIN)/genloccqs French FR > $(DIST)_FR/cntl/cqs sh $(TOOLSBIN)/genlocccs fr_FR > $(DIST)_FR/cntl/ccs sh $(TOOLSBIN)/gencmpntmacr $(DIST)_FR/cdmt.config lli_FR lli_FR sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $(DIST)_FR/cdmt.config $(PRODCODE) $(PRODMEDIA) $(PRODDESC) cat $(DIST)_FR/cdmt.config >> $(DIST)/cdmt.prd.config sh $(TOOLSBIN)/genloccmpnt DE German > $(DIST)_DE/input/lli_DE.cmpnt sh $(TOOLSBIN)/updatecdmt ahdk $(PRODREL) $(DIST)_DE/input/lli_DE.cmpnt $(PRODCODE) $(PRODMEDIA) $(PRODDESC) sh $(TOOLSBIN)/genlang de de_DE.ISO8859-1 german_germany.8859 de_DE \ > $(DIST)_DE/input/lli.pkg sh $(TOOLSBIN)/genloccqs German DE > $(DIST)_DE/cntl/cqs sh $(TOOLSBIN)/genlocccs de_DE > $(DIST)_DE/cntl/ccs sh $(TOOLSBIN)/gencmpntmacr $(DIST)_DE/cdmt.config lli_DE lli_DE sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $(DIST)_DE/cdmt.config $(PRODCODE) $(PRODMEDIA) $(PRODDESC) cat $(DIST)_DE/cdmt.config >> $(DIST)/cdmt.prd.config $(SCO_OWNED_DLIST) $(DLIST): @echo $@ -[ -d $(DRVDISTDIR)/netdrivers_doc/ID/$@ ] || mkdir -p $(DRVDISTDIR)/netdrivers_doc/ID/$@ -[ -f $(DRVDISTDIR)/netdrivers_doc/cdmt.config ] || echo "\tnetdrivers_doc_DIR=$(DRVDISTDIR)/netdrivers_doc" > $(DRVDISTDIR)/netdrivers_doc/cdmt.config -[ -f $(DRVDISTDIR)/netdrivers_doc/cdmt.config ] || echo "\tnetdrivers_doc_VER=1.0.0a ">> $(DRVDISTDIR)/netdrivers_doc/cdmt.config -[ -d $(DRVDISTDIR)/netdrivers_doc/input ] || mkdir -p $(DRVDISTDIR)/netdrivers_doc/input [ -d $(DRVDISTDIR)/$@/ID/$@/AOF ] || mkdir -p $(DRVDISTDIR)/$@/ID/$@/AOF [ ! -f $(DOCSRC)/$@\.netcardsC.html ] || cp $(DOCSRC)/$@\.netcardsC.html $(DRVDISTDIR)/netdrivers_doc/ID/$@/ cp $(MDISRC)/$@/lkcfg $(DRVDISTDIR)/$@/ID/$@/lkcfg cp $(MDISRC)/$@/AOF/* $(DRVDISTDIR)/$@/ID/$@/AOF cp $(MDISRC)/$@/Driver.o $(DRVDISTDIR)/$@/ID/$@ cp $(MDISRC)/$@/Space.c $(DRVDISTDIR)/$@/ID/$@ [ ! -f $(MDISRC)/$@/acfg ] || cp $(MDISRC)/$@/acfg $(DRVDISTDIR)/$@/ID/$@ [ ! -f $(MDISRC)/$@/acfg/acfg ] || cp $(MDISRC)/$@/acfg/acfg $(DRVDISTDIR)/$@/ID/$@ [ ! -f $(MDISRC)/$@/$@.h ] || cp $(MDISRC)/$@/$@.h $(DRVDISTDIR)/$@/ID/$@ [ ! -f $(MDISRC)/$@/space.h ] || cp $(MDISRC)/$@/space.h $(DRVDISTDIR)/$@/ID/$@ ROOT=$(ROOT) sh $(TOOLSBIN)/genmaster $@ > $(DRVDISTDIR)/$@/ID/$@/Master ROOT=$(ROOT) sh $(TOOLSBIN)/gennode $@ > $(DRVDISTDIR)/$@/ID/$@/Node ROOT=$(ROOT) sh $(TOOLSBIN)/gensystem $@ > $(DRVDISTDIR)/$@/ID/$@/System [ ! -f $(MDISRC)/$@/copy ] || sh $(MDISRC)/$@/copy $(MDISRC)/$@ $(DRVDISTDIR)/$@ $(DRVDISTDIR)/$@ [ -d $(DRVDISTDIR)/$@/input ] || mkdir -p $(DRVDISTDIR)/$@/input [ -d $(DRVDISTDIR)/$@/cntl/packages ] || mkdir -p $(DRVDISTDIR)/$@/cntl/packages cp $(CUSTOMSRC)/ccs $(DRVDISTDIR)/$@/cntl cp $(CUSTOMSRC)/instlib.sh $(DRVDISTDIR)/$@/cntl sh $(TOOLSBIN)/gendrvpkg > $(DRVDISTDIR)/$@/cntl/packages/pkg.drv cp $(CUSTOMSRC)/CDMT.cmpnt $(DRVDISTDIR)/$@/input/$@.cmpnt chmod u+w $(DRVDISTDIR)/$@/input/$@.cmpnt DOCDIST=$(DRVDISTDIR)/netdrivers_doc ROOT=$(ROOT) DRVDIST=$(DRVDISTDIR)/$@/ID sh $(TOOLSBIN)/gencmpnt $(DRVDISTDIR)/$@/input/$@.cmpnt $(PRODVENDOR) $@ cp $(CUSTOMSRC)/CDMT.drv.ctl $(DRVDISTDIR)/$@/input/$@.pkg chmod u+w $(DRVDISTDIR)/$@/input/$@.pkg ROOT=$(ROOT) PRODCODE=$(PRODCODE) DRVDIST=$(DRVDISTDIR)/$@/ID sh $(TOOLSBIN)/genpkg $@ >> $(DRVDISTDIR)/$@/input/$@.pkg ROOT=$(ROOT) DRVDIST=$(DRVDISTDIR)/netdrivers_doc/ID/$@ sh $(TOOLSBIN)/gendocpkg $@ >> $(DRVDISTDIR)/netdrivers_doc/input/$@_doc.pkg cp $(CUSTOMSRC)/CDMT.pr.cfg $(DRVDISTDIR)/$@/cdmt.prd.config chmod u+w $(DRVDISTDIR)/$@/cdmt.prd.config sh $(TOOLSBIN)/gencmpntmacr $(DRVDISTDIR)/$@/cdmt.prd.config $@ $@ sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $(DRVDISTDIR)/$@/cdmt.prd.config $(PRODCODE) FLOPPY $(PRODDESC) sh $(TOOLSBIN)/gencmpntmacr $(DRVDISTDIR)/$@/cdmt.config $@ $@ sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $(DRVDISTDIR)/$@/cdmt.config $(PRODCODE) $(PRODMEDIA) $(PRODDESC) ROOT=$(ROOT) sh $(TOOLSBIN)/gendrvprd $(DRVDISTDIR)/$@/input/$@.prd $(PRODVENDOR) $(PRODCODE) $(DOCSRC) $@ sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $(DRVDISTDIR)/$@/input/$@.prd SCO:$@ $(PRODMEDIA) $(PRODDESC) [ ! -f $(DOCSRC)/fr/$@\.netcardsC.html ] || { \ DRVLOCDOCDIST="./dist/$@_FR" ; \ DRVDOC="./dist/netdrivers_doc_FR" ; \ [ ! -d $$DRVDOC ] && { \ mkdir -p $$DRVDOC/input ; \ echo "\tnetdrivers_doc_FR_DIR=$$PWD" > $$DRVDOC/cdmt.config ;\ echo "\tnetdrivers_doc_FR_VER=1.0.0a" > $$DRVDOC/cdmt.config ;\ } ;\ mkdir -p $$DRVDOC/ID/$@ ; \ mkdir -p $$DRVLOCDOCDIST/input ; \ mkdir -p $$DRVLOCDOCDIST/cntl/packages ; \ cp $(CUSTOMSRC)/ccs $$DRVLOCDOCDIST/cntl ; \ cp $(CUSTOMSRC)/instlib.sh $$DRVLOCDOCDIST/cntl ; \ sh $(TOOLSBIN)/gendrvpkg fr_FR.ISO8859-1/ > $$DRVLOCDOCDIST/cntl/packages/pkg.drv ;\ sh $(TOOLSBIN)/genlocdrvcqs FR fr_FR.ISO8859-1 > $$DRVLOCDOCDIST/cntl/cqs ; \ cp $(DOCSRC)/fr/$@\.netcardsC.html $$DRVDOC/ID/$@ ; \ ROOT=$(ROOT) DRVDIST=$$DRVDOC/ID sh $(TOOLSBIN)/genlocdrvpkg $@ fr_FR.ISO8859-1 >> $$DRVDOC/input/$@_doc.pkg ; \ ROOT=$(ROOT) sh $(TOOLSBIN)/genlocdrcpnt $@ $(PRODVENDOR) $@_FR French > $$DRVLOCDOCDIST/input/$@_FR.cmpnt ; \ sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $$DRVLOCDOCDIST/input/$@_FR.cmpnt $(PRODCODE) $(PRODMEDIA) $(PRODDESC) ; \ sh $(TOOLSBIN)/gencmpntmacr $$DRVLOCDOCDIST/cdmt.config $@_FR $@_FR ;\ sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $$DRVLOCDOCDIST/cdmt.config $(PRODCODE) $(PRODMEDIA) $(PRODDESC) ; \ cat $$DRVLOCDOCDIST/cdmt.config >> $(DRVDISTDIR)/$@/cdmt.prd.config ; \ } [ ! -f $(DOCSRC)/de/$@\.netcardsC.html ] || { \ DRVLOCDOCDIST="./dist/$@_DE" ; \ DRVDOC="./dist/netdrivers_doc_DE" ; \ [ ! -d $$DRVDOC ] && { \ mkdir -p $$DRVDOC/input ; \ echo "\tnetdrivers_doc_DE_DIR=$$PWD" > $$DRVDOC/cdmt.config ;\ echo "\tnetdrivers_doc_DE_VER=1.0.0a" > $$DRVDOC/cdmt.config ;\ } ;\ mkdir -p $$DRVDOC/ID/$@ ; \ mkdir -p $$DRVLOCDOCDIST/input ; \ mkdir -p $$DRVLOCDOCDIST/cntl/packages ; \ cp $(CUSTOMSRC)/ccs $$DRVLOCDOCDIST/cntl ; \ cp $(CUSTOMSRC)/instlib.sh $$DRVLOCDOCDIST/cntl ; \ sh $(TOOLSBIN)/gendrvpkg de_DE.ISO8859-1/ > $$DRVLOCDOCDIST/cntl/packages/pkg.drv ;\ sh $(TOOLSBIN)/genlocdrvcqs DE de_DE.ISO8859-1 > $$DRVLOCDOCDIST/cntl/cqs ; \ cp $(DOCSRC)/de/$@\.netcardsC.html $$DRVDOC/ID/$@ ; \ ROOT=$(ROOT) DRVDIST=$$DRVDOC/ID sh $(TOOLSBIN)/genlocdrvpkg $@ de_DE.ISO8859-1 >> $$DRVDOC/input/$@_doc.pkg ; \ ROOT=$(ROOT) sh $(TOOLSBIN)/genlocdrcpnt $@ $(PRODVENDOR) $@_DE German > $$DRVLOCDOCDIST/input/$@_DE.cmpnt ; \ sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $$DRVLOCDOCDIST/input/$@_DE.cmpnt $(PRODCODE) $(PRODMEDIA) $(PRODDESC) ; \ sh $(TOOLSBIN)/gencmpntmacr $$DRVLOCDOCDIST/cdmt.config $@_DE $@_DE ;\ sh $(TOOLSBIN)/updatecdmt $(PRODPRD) $(PRODREL) $$DRVLOCDOCDIST/cdmt.config $(PRODCODE) $(PRODMEDIA) $(PRODDESC) ; \ cat $$DRVLOCDOCDIST/cdmt.config >> $(DRVDISTDIR)/$@/cdmt.prd.config ; \ } sh $(TOOLSBIN)/stripmcs $(DRVDISTDIR)/$@ "`sh $(TOOLSBIN)/genmcsstr $(PRODREL) $(PRODDESC)`" cdmt: cp $(CUSTOMSRC)/CDMT.config $(CDMT_DIR)/cdmt.config chmod u+w $(CDMT_DIR)/cdmt.config sh $(TOOLSBIN)/genmacro $(CDMT_DIR)/cdmt.config $(DOCSRC) $(DLIST) sh $(TOOLSBIN)/updatecdmt ahdk $(PRODREL) $(CDMT_DIR)/cdmt.config $(PRODCODE) $(DISTMEDIA) $(PRODDESC) CDMT_DIR=$(CDMT_DIR) cdmtParse -f CDMT_DIR=$(CDMT_DIR) cdmtCompress CDMT_DIR=$(CDMT_DIR) cdmtArchive -f tape: updateprd DISTMEDIA=TAPE make cdmt disk: tape floppy: updateprd DISTMEDIA=FLOPPY make cdmt dos: floppy odt_source: clobber ROOT=$(ROOT) sh $(TOOLSBIN)/gensource $(DLIST) 3pty_source: clobber mv $(ROOT)/dlist /tmp/dlist.sav echo "DLIST=$(SCO_OWNED_DLIST)" >$(ROOT)/dlist ROOT=$(ROOT) sh $(TOOLSBIN)/gensource $(SCO_OWNED_DLIST) mv /tmp/dlist.sav $(ROOT)/dlist prd: @ for d in $(SRC)/dist/* ;\ do \ if [ -d $$d ] ;\ then \ if [ -f $$d/cdmt.prd.config ] ;\ then \ CDMT_DIR=$$d cdmtParse -f -config $$d/cdmt.prd.config ;\ CDMT_DIR=$$d cdmtCompress -config $$d/cdmt.prd.config ;\ CDMT_DIR=$$d cdmtArchive -f -config $$d/cdmt.prd.config ;\ fi ;\ fi ;\ done isl \ everestisl: [ -d $(DIST)/nflop ] || mkdir -p $(DIST)/nflop cp $(SRC)/cmd/iqmacfg/iqmacfg $(DIST)/nflop/iqmacfg rm -f ./stzlist @for d in drv/mdi/* ; { \ [ $$d = "drv/mdi/ahdk" -o ! -d $$d ] || { \ echo "$$d/AOF/* \c" >> ./stzlist; \ osavtcl $(TOOLSBIN)/iqmstz.tcl `cat stzlist` > $(DIST)/nflop/ndiqm.stz ; \ } \ } clean-oneoffs: rm -rf oneoffs oneoffs: clean-oneoffs ROOT=$(ROOT) sh $(TOOLSBIN)/genoneoffs 070701000238af000081a4000000000000000300000001375734b60000249b00001dff0000000100000000000000000000001e00000000root/usr/src/O5hdk/net/README# # %Z% %M% %I% %E% %Q% # # Copyright (C) The Santa Cruz Operation, 1995-1999 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. This README covers the following topics: * Building Sample MAC (Media Access Control) Driver Interface (MDI) Drivers * Network Driver Directory Source Contents * Network Driver Software Package (NDSP) extensions - copy and pkg scripts * Installing your driver into the network driver source tree Building Sample MAC (Media Access Control) Driver Interface (MDI) Drivers ------------------------------------------------------------------------- This directory contains a buildable sample source tree that contains code for three MDI drivers: * 3Com 3c503 EtherLink II - "network/mdi/src/drv/mdi/e3B" (ISA) * 3Com 3c507 EtherLink 16 - "network/mdi/src/drv/mdi/e3D" (ISA) * IBM Token-Ring Network - "network/mdi/src/drv/mdi/tok" (ISA and MCA) * Matrox/Osicom D21140A - "network/mdi/src/drv/mdi/shrk" (PCI) Also included in these sub-directories are working AOF files, lkcfg scripts, and "acfg" configuration utility code. The purpose of this tree is to build a custom installable product that contains your MDI driver. Network Driver Directory Source Contents ---------------------------------------- The sample source code tree is structured as a build tree that creates a sample Network Drivers disk with a sample MDI drivers on it. This serves as an example and facilitates the production of a finished diskette that includes your driver for testing purposes. The following diagram describes the layout of the Network Drivers source tree on the build machine, where "driver" is replaced by your driver code in the drv/mdi directory below: /usr/src/O5hdk/net/drv/mdi/ | -------------------------------------------------------------- | | | | cmd/ drv/ scripts/ tools/ (SCO provided | (SCO provided (utilities utility source) | installation and used during mdi/ configuration scripts) build) | --------------------------------------------------------------------------- | | | | | ahdk/ shrk/ e3D/ tok/ driver (example AHDK (example DEC D21140A (example 3Com (example IBM | stub driver multithreaded PCI EtherLink/16 Token-Ring | source) driver source) driver source) driver source) | | | | ----------------------------------------------------------------------- | | | | | | | | Makefile driver src AOF/ Driver.o Space.c acfg/ lkcfg driver.h Each individual MDI driver has its own self contained directory (driver in the diagram above). This directory contains the following: Makefile Driver source Include files (driver.h gets placed in driver package file and copied into the linkkit /etc/pack.d/driver when it's configured) AOF/ Space.c lkcfg Master (Optional - override default Master generated by tools/genmaster) Node (Optional - override default Node generated by tools/gennode) System (Optional - override default System generated by tools/gensystem) acfg/Makefile, acfg/ (Optional - ISA only) "pkg" and "copy" (Optional - adds files to driver package file) Note the custom(ADM) and netconfig(ADM) product scripts are no longer provided. Your self-contained mdi driver directory should be capable of producing a Driver.o. NDSP extensions - copy and pkg scripts -------------------------------------- The examples below show how to get an include file (ne3200.h) placed into the distribution in "ID/ne/ne3200.h". If you need files placed under directories in your driver directory, please refer to the cdmtInput(CDMT) man page. More information on CDMT can be found in the "CDMT - Custom Distribution Mastering Toolkit" reference pages in the "Development System Documentation" set. Copy scripts are called as "copy ". Example copy script: # our copy script cp $1/ne3200.h $3/ID/ne/ne3200.h The pkg file contains file and directory definitions used by CDMT to add files to your package other than those defined in the Network Driver Software Package. Example pkg script: FILE:ne:SERVER:./ID/ne/ne3200.h: Installing your driver into the network driver source tree ---------------------------------------------------------- Follow the instructions below to install your driver into the Network Driver Source tree: 1. Choose a 3 or 4 letter code for your driver. Codes currently in use are: btok IBM Busmaster Token Ring Adapter/A ctr Compaq Token Ring e3A 3Com EtherLink (3C501) e3B 3Com EtherLink II (3C503) e3C 3Com EtherLink MC (3C523) e3D 3Com EtherLink 16 (3C507) e3E 3Com EtherLink III (3C5X9) eeA Intel EtherExpress 16 eeB Intel EtherExpress Flash 32 eeC Intel EtherExpress PRO eeD Intel EtherExpress PRO/100 exos Excelan 205T hfs Hewlett Packard ISA/EISA/PCI 10/100VG adapters hfm Hewlett Packard ISA/EISA/PCI 10/100VG adapters hvm Hewlett Packard ISA/EISA/PCI 10/100VG adapters hvs Hewlett Packard ISA/EISA/PCI 10/100VG adapters hpe Hewlett Packard EISA adapters hpi Hewlett Packard ISA adapters i3B Racal Interlan EISA i6E Racal Interlan NI6510 nat Novell NE2000/NSC InfoMover NE2000+ ne Novell NE3200 EISA pnt AMD Am2100/1500 PCNet-ISA, PCNet-ISA+, PCNet-PCI shrk Osicom 2300, Matrox Shark NS-100/1 and NS-100/4 sebm SMC 82M32 EtherCard Elite 32C Ultra sme SMC EtherCard Elite 16C Ultra smpw SMC EtherPower PCI (8432 series) spwr SMC EtherPower 10/100 (9432) tok IBM Token Ring Network Adapter wdn Western Digital/SMC 8003,8013 series wwdu IBM Ether, LAN and Auto LANStreamer MC 32 Note: It is important that driver writers ensure that all external function names begin with your driver code. A symbol checking tool is now part of the OpenServer NIC Driver Testsuite to verify this requirement. 2. Copy the source tree onto your build machine. 3. Edit the file "Make.inc" and change the following macros: PRODDESC= PRODVENDOR= PRODPRD= PRODREL= DLIST= 4. Type "cd drv/mdi" and create a new directory for your driver; this directory must be the same name as your driver code. 5. Place your driver source into this directory. You should not need to modify anything outside of this directory other than the Make.inc file mentioned above. 6. Set up a Makefile in the directory, such that make Builds the driver and any utility source make clean Removes any .o's, tags files etc. make clobber Removes everything built by make The cc line in the Makefile should include at least optimization, and the CFLAGS macro should specify "-w3 -O -I../../.." so the correct MDI include files are used. Use a Makefile from one of the SCO sample drivers as a model. When the driver is compiled, there should be no warnings. It is strongly recommended that you run "lint" on your sources. 7. Run "make" from the top level directory (e.g., /u/ND) followed by "make floppy". Then cd to archives/FLOPPY and run the command "dd if=VOL.000.000 of=/dev/rfd0135ds18" to copy the image onto a floppy disk. Then use custom to install from this floppy on the target machine. 8. You may also run "make sampledist" to make a distribution for the sample drivers provided in this developers kit followed by "make floppy" to create the custom installable archive. NOTE: Before installing this media image, make sure you remove the driver packages that will be replaced. These can be found under the custom "SCO OpenServer Enterprise Connectivity" parcel in the "SCO Network Drivers" component. The packages are named "3Com EtherLink II Adapter series", "3Com EtherLink 16/16TP Adapter", and "IBM Token-Ring Network ISA Series (Shared RAM". 9. SCO OpenServer Release 5.0 Custom is able to install images from DOS floppies from the image "\SCO\CUSTOM.DST". To install the images on a DOS floppy diskette for inclusion on a floppy that you ship with your adapters, you may run "make dosdd135" with a 1.4 Meg. DOS format floppy in the drive. 07070100023859000081a400000000000000030000000135aefc90000001dc00001dff0000000100000000000000000000002400000000root/usr/src/O5hdk/net/cmd/Makefile# # @(#) Makefile 11.1 95/05/11 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. SHELL=/bin/sh all clean clobber: @for d in intl llistat dlpid stzget llipathmap ndnamemap llilib iqmacfg pop pcislot netconfig ; { \ [ ! -f $$d/Makefile ] || { \ echo "cd lli/cmd/$$d ; make $@" ; \ cd $$d ; \ $(MAKE) $@ ; \ cd .. ; \ } \ } 07070100023858000081a400000000000000030000000135aefc900000034400001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/cmd/intl/Makefile# # @(#) Makefile 12.1 95/12/04 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # ROOT=../.. include $(ROOT)/Make.inc #MKCATDECL=./mkcatdecl CFLAGS = -O -belf OBJS = intl.o all: $(OBJS) @for d in * ; \ do \ if [ -d $$d ] ; \ then \ cd $$d ; \ make -f ../Makelang ; \ cd .. ; \ fi ; \ done clean: rm -f $(OBJS) tags @for d in * ; \ do \ if [ -d $$d ] ; \ then \ cd $$d ; \ make -f ../Makelang clean ; \ cd .. ; \ fi ; \ done clobber: clean @for d in * ; \ do \ if [ -d $$d ] ; \ then \ cd $$d ; \ make -f ../Makelang clobber ; \ cd .. ; \ fi ; \ done 07070100023857000081a400000000000000030000000135aefc90000003a000001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/cmd/intl/intl.c#pragma comment(exestr, "@(#) intl.c 12.1 95/12/04 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1995. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include #include #include #include #include #define CATNAME "lli.cat@lli" extern int set_id; static nl_catd catd = (nl_catd)-2; catfprintf(FILE *f, int msg_id, char *def, int a, int b, int c, int d, int e, int g) { char *s; if (catd == -2) { setlocale(LC_ALL, ""); catd=catopen(CATNAME, NL_CAT_LOCALE); if (catd == (nl_catd)-1 && errno != ENOENT) { fprintf(stderr,"lli.cat: Unable to open message catalogue (%s)\n", CATNAME); perror("lli.cat"); } } if (catd == -1) { fprintf(f, def, a,b,c,d,e, g); return; } s = catgets(catd, set_id, msg_id, def); fprintf(f, s, a,b,c,d,e, g); } 0707010002385b000081a400000000000000030000000135aefc8f000001a900001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/cmd/stzget/Makefile# # @(#) Makefile 7.1 94/12/03 SCOINC # # Copyright (C) 1993-1994 The Santa Cruz Operation, Inc. # All Rights Reserved. # ROOT=../.. include $(ROOT)/Make.inc CFLAGS=-belf LDFLAGS=$(SYSADMLIBS) -lintl -lc OBJS=stzget.o ../intl/intl.o all: stzget stzget: $(OBJS) cc -o $@ $(OBJS) $(LDFLAGS) ../intl/intl.o: cd ../intl ; $(MAKE) stzget.i: cc -P $(CFLAGS) stzget.c clean: rm -f *.o clobber: clean rm -f stzget 0707010002385c000081a400000000000000030000000135aefc90000005d000001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/cmd/stzget/stzget.c#pragma comment(exestr, "@(#) stzget.c 5.2 94/06/17 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * Read a value from a stanza file. */ #include #include #include #include #include #include #include #include #include errStatus_cl *errStack; char *progname; int set_id = 3; main(argc, argv) char **argv; { char *stanzafile, *sectname, *attrname; stanza_cl *sfp; const char **valList; errStack = ErrorNew(); progname = argv[0]; if (argc != 4) { catfprintf(stdout, 1, "usage: %s stanza-file section-name attribute-name\n", progname ); exit (3); } stanzafile=argv[1]; sectname = argv[2]; attrname = argv[3]; sfp = StanzaHandle(); if ( ! StanzaOpen(sfp, stanzafile, STZ_RDONLY, errStack)) { logstack(); exit(2); } if ( ! StanzaGetVals(sfp, sectname, attrname, &valList, errStack)) { exit(1); } { const char **x; if (*valList) printf("%s", *valList); for (x=&valList[1]; *x; x++) { printf(" %s", *x); } } if ( ! StanzaClose(sfp, errStack)) { logstack(); exit(5); } exit(0); } logstack() { ErrorOutput(errStack, stderr, 0, "stzget: "); } logerror(code, a1, a2, a3) intlMsg_t *code; { ErrorPush(errStack, code, a1, a2, a3); logstack(); } 0707010002385e000081a400000000000000030000000135aefcd20000017b00001dff0000000100000000000000000000002400000000root/usr/src/O5hdk/net/drv/Makefile# @(#) Makefile 5.1 94/06/10 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1994 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. SHELL=/bin/sh all clean clobber: @for d in * ; { \ [ -d $$d ] && { \ echo "cd lli/drv/$$d ; make $@" ; \ cd $$d ; \ $(MAKE) $@ ; \ cd .. ; \ } \ } 0707010002388b000081a400000000000000030000000135aefc970000036000001dff0000000100000000000000000000002800000000root/usr/src/O5hdk/net/drv/mdi/Makefile# # @(#) Makefile 5.1 94/06/10 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1994 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. ROOT=../.. include $(ROOT)/Make.inc all: @for d in $(DLIST) ; \ do \ if [ -d $$d ] ; \ then \ echo "cd lli/drv/mdi/$$d ; make $@" ; \ cd $$d ; \ $(MAKE) $@ ; \ ../$(AOFLINT) AOF/* ; \ cd .. ; \ fi ; \ done aoflint: @for d in $(DLIST) ; \ do \ if [ -d $$d ] ; \ then \ cd $$d/AOF ; \ ../../$(AOFLINT) * ; \ cd ../.. ; \ fi ; \ done clean clobber: @for d in $(DLIST) ; \ do \ if [ -d $$d ] ; \ then \ echo "cd lli/drv/mdi/$$d ; make $@" ; \ cd $$d ; \ $(MAKE) $@ ; \ cd .. ; \ fi ; \ done 07070100023865000081a400000000000000030000000135aefc970000019300001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/drv/mdi/ahdk/AOF/ahdk# # @(#) ahdk 55.1 96/06/12 SCOINC # # Copyright (C) The Santa Cruz Operation, 1995-1996. # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. BASE_IO: SIZE=f VALUES=200-400:10 TYPE=link-kit ADAPTER: DESCRIPTION="AHDK MDI Driver Test Stub" BUS=ISA MEDIA_TYPE=ethernet MAX_BD=3 KEY=BASE_IO REQUIRED= ADVANCED= SPEED=slow 07070100023867000081a400000000000000030000000135aefc97000001c200001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/drv/mdi/ahdk/Makefile# # @(#) Makefile 11.1 95/05/11 SCOINC # # Copyright (C) The Santa Cruz Operation, 1995. # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Example Makefile for AHDK # SHELL=/bin/sh CFLAGS = -DAT386 -I../../.. -D_INKERNEL OBJ=ahdkli.o ahdkmac.o all: Driver.o Driver.o: $(OBJ) /lib/coff/ld -r -o Driver.o $(OBJ) clean: rm -f $(OBJ) tags clobber: clean rm -f Driver.o 07070100023868000081a400000000000000030000000135aefc970000027300001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/drv/mdi/ahdk/Space.c/* * @(#) Space.c 11.2 95/07/13 SCOINC * * Copyright (C) The Santa Cruz Operation, 1995. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include "sys/types.h" #include "sys/stream.h" #include "sys/mdi.h" #include "ahdk.h" #include "config.h" unsigned int ahdk_units = AHDK_CNTLS; struct ahdkdevice ahdkdevs[AHDK_CNTLS] = { #ifdef AHDK_0 { 0, AHDK_0_SIOA, }, #endif #ifdef AHDK_1 { 1, AHDK_1_SIOA, }, #endif #ifdef AHDK_2 { 2, AHDK_2_SIOA, }, #endif #ifdef AHDK_3_SIOA { 3, AHDK_3_SIOA, }, #endif }; 07070100023861000081a400000000000000030000000135aefc970000025600001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/ahdk/ahdk.h/* * @(#) ahdk.h 11.1 95/05/11 SCOINC * * Copyright (C) The Santa Cruz Operation, 1995. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * ahdk.h stub include file * * This will be copied into the distribution * automatically during the build and into the * link-kit during driver configuration. */ extern unsigned int ahdk_units; #define AHDK_ETHER_MTU 1514 struct ahdkdevice { unsigned short unit; unsigned short iobase; unsigned short open; }; extern struct ahdkdevice ahdkdevs[]; 07070100023862000081a400000000000000030000000135aefc97000005e500001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/drv/mdi/ahdk/ahdkli.c#pragma comment(exestr, "@(#) ahdkli.c 11.1 95/05/11 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1995. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" #include "sys/stream.h" #include "sys/mdi.h" #include "ahdk.h" int ahdkopen(), ahdkclose(), ahdkuwput(); struct module_info ahdk_minfo = { 0, "ahdk", 1, AHDK_ETHER_MTU, 16*AHDK_ETHER_MTU, 12*AHDK_ETHER_MTU }; struct qinit ahdkurinit = { 0, 0, ahdkopen, ahdkclose, 0, &ahdk_minfo, 0 }; struct qinit ahdkuwinit = { ahdkuwput, 0, ahdkopen, ahdkclose, 0, &ahdk_minfo, 0 }; struct streamtab ahdkinfo = { &ahdkurinit, &ahdkuwinit, 0, 0 }; void ahdkinit() { register int i; struct ahdkdevice *dv = ahdkdevs; for (i = 0; i < ahdk_units; i++, dv++) { printcfg("ahdk", dv->iobase, 0, -1, -1, "%s addr=%s", "AHDK test stub", "00:00:00:00:00:00"); } } int ahdkopen(queue_t *q, int dev, int flag, int sflag) { int unit; struct ahdkdevice *dv; printf("ahdk open\n"); unit = minor(dev); dv = &ahdkdevs[unit]; q->q_ptr = WR(q)->q_ptr = (char *)unit; if (dv->open) return(OPENFAIL); dv->open = 1; return (unit); } ahdkclose(queue_t *q) { int unit; struct ahdkdevice *dv; printf("ahdk close\n"); unit = (int) q->q_ptr; dv = &ahdkdevs[unit]; dv->open = 0; q->q_ptr = NULL; WR(q)->q_ptr = NULL; } ahdkuwput(queue_t *q, mblk_t *mp) { freemsg(mp); } 07070100023863000081a400000000000000030000000135aefc970000014a00001dff0000000100000000000000000000002e00000000root/usr/src/O5hdk/net/drv/mdi/ahdk/ahdkmac.c#pragma comment(exestr, "@(#) ahdkmac.c 11.1 95/05/11 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1995. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ void ahdkintr(int v) { /* interrupt service routine goes here */ } 07070100023866000081a400000000000000030000000135aefc970000066900001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/drv/mdi/ahdk/lkcfg: # # @(#) lkcfg 75.1 98/06/26 SCOINC # # Copyright (C) The Santa Cruz Operation, 1995-1998 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # # XX MDI driver Link Kit configuration script # [ "$#" != "5" ] && { echo "Usage:\n\t$0 <-ird> INIT_DB_RECORD MDI_driver Board_number" exit $FAIL } LLI_ROOT=$MKMOKROOT`llipathmap` . $LLI_ROOT/lib/libcfg.sh PATH=$PATH:$LLI_ROOT/bin option=$1 INITDBR=$2 AOFFILE=$3 drv=$4 bd=$5 SYSTEM_FILE=$MKMOKROOT/etc/conf/sdevice.d/$drv MASTER_FILE=$MKMOKROOT/etc/conf/cf.d/mdevice DRIVER_DIR=$MKMOKROOT/etc/conf/pack.d/$drv # de-configure driver [ "$option" = "-d" ] && { # removes the driver from the system [ -f $SYSTEM_FILE ] && { set_system_info $SYSTEM_FILE $bd "N" 0 0 0 0 0 0 0 awk '{ if ( $2 == "Y" ) exit 1 }' $SYSTEM_FILE && idinstall -d -e $drv } exit $OK } [ -f "$INITDBR" ] || { echo "No INIT DB RECORD, \"$INITBDR\" found" exit $FAIL } cd $LLI_ROOT/ID/$drv for i in System Master Node Driver.o Space.c $drv.h do [ -f "$i" ] || { echo "$drv: File, \"$LLI_ROOT/ID/$drv/$i\" not found" exit $FAIL } done BASE_IO=`stzget $INITDBR BASE_IO SELECT` || { echo "$drv: BASE_IO: SELECT does not exist in stanza file" exit $FAIL } BASE_IO_SIZE=`stzget $AOFFILE BASE_IO SIZE` || { echo "$drv: BASE_IO: SELECT does not exist in stanza file ($AOFFILE)" exit $FAIL } EIO=`hex_add $BASE_IO $BASE_IO_SIZE` # check to see if the driver is in the link-kit [ -f $SYSTEM_FILE ] || { idinstall -a -e -k $drv idinstall -u -e -k -H $drv } set_system_info $SYSTEM_FILE $bd "Y" 0 0 0 $BASE_IO $EIO 0 0 exit $OK 07070100023871000081a40000000000000003000000013757467e0000024100001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/e3B/AOF/e3B# # @(#) e3B 11.1 95/07/21 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. BASE_IO: SIZE=f VALUES=250,280,2a0,2e0,300,310,330,350 DEFAULTS=300,310,330,350 TYPE=link-kit IRQ: VALUES=2,3,4,5 DEFAULTS=3,2,5,4 TYPE=link-kit MEDIA: VALUES=AUI,BNC/TP TYPE=link-kit ADAPTER: DESCRIPTION="!AHDK! 3Com 3C503 EtherLink II" BUS=ISA MEDIA_TYPE=ethernet MAX_BD=3 KEY=BASE_IO REQUIRED=IRQ,MEDIA ADVANCED= SPEED=slow NET_BOOT=dynamic 07070100023877000081a400000000000000030000000135aefc960000025600001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/drv/mdi/e3B/Makefile# @(#)Makefile 6.1 94/08/31 SCOINC # SCCS IDENTIFICATION # # Copyright (C) The Santa Cruz Operation, 1984-1994. # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # 3Com 503 Driver for LLI disk # SHELL=/bin/sh CFLAGS = -DAT386 -I../../.. -D_INKERNEL OBJ=e3Bli.o e3Bmac.o e3Bio.o all: Driver.o acfg.e3B e3Bio.o: e3Bio.s cc -c e3Bio.s Driver.o: $(OBJ) /lib/coff/ld -r -o Driver.o $(OBJ) acfg.e3B: cd acfg; make clean: rm -f $(OBJ) tags cd acfg; make clean clobber: clean rm -f Driver.o cd acfg; make clobber 07070100023878000081a400000000000000030000000135aefc960000004100001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/drv/mdi/e3B/Master* @(#)Master 5.1 94/06/10 SCOINC e3B I icSH e3B 0 0 0 1 -1 07070100023879000081a400000000000000030000000135aefc960000084800001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/e3B/Space.c/* * @(#) Space.c 7.1 94/11/27 SCOINC * * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * System V STREAMS TCP - Release 4.0 * * Copyright 1987, 1988 Lachman Associates, Incorporated (LAI) * * All Rights Reserved. * * The copyright above and this notice must be preserved in all * copies of this source code. The copyright above does not * evidence any actual or intended publication of this source * code. * * This is unpublished proprietary trade secret source code of * Lachman Associates. This source code may not be copied, * disclosed, distributed, demonstrated or licensed except as * expressly authorized by Lachman Associates. * * System V STREAMS TCP was jointly developed by Lachman * Associates and Convergent Technologies. */ #include "sys/types.h" #include "sys/stream.h" #include "sys/mdi.h" #include "e3B.h" #include "config.h" #include "space.h" /* IRQ LEVEL */ u_int e3Bintl[E3B_CNTLS] = { #ifdef E3B_0 E3B_0_IRQ, #endif #ifdef E3B_1 E3B_1_IRQ, #endif #ifdef E3B_2 E3B_2_IRQ, #endif #ifdef E3B_3 E3B_3_IRQ, #endif }; /* I/O BASE ADDRESS */ u_int e3Biobase[E3B_CNTLS] = { #ifdef E3B_0 E3B_0_BASE_IO, #endif #ifdef E3B_1 E3B_1_BASE_IO, #endif #ifdef E3B_2 E3B_2_BASE_IO, #endif #ifdef E3B_3 E3B_3_BASE_IO, #endif }; /* Transceiver = external if E3B_?_MEDIA == 1 */ u_int e3Bxcvr[E3B_CNTLS] = { #ifdef E3B_0 E3B_0_MEDIA, #endif #ifdef E3B_1 E3B_1_MEDIA, #endif #ifdef E3B_2 E3B_2_MEDIA, #endif #ifdef E3B_3 E3B_3_MEDIA, #endif }; u_int e3B_nunit = E3B_CNTLS; struct e3Bdevice e3Bdevice[E3B_CNTLS]; extern int e3Bopen(), e3Bclose(), e3Buwput(); extern int nulldev(); struct module_info e3B_minfo = { 0, "e3B", 1, E3BETHERMTU, 16*E3BETHERMTU, 12*E3BETHERMTU }; struct qinit e3Burinit = { 0, 0, e3Bopen, e3Bclose, nulldev, &e3B_minfo, 0 }; struct qinit e3Buwinit = { e3Buwput,0,e3Bopen,e3Bclose, nulldev, &e3B_minfo, 0 }; struct streamtab e3Binfo = { &e3Burinit, &e3Buwinit, 0, 0 }; 0707010002386f000081a400000000000000030000000135aefc960000026300001dff0000000100000000000000000000003100000000root/usr/src/O5hdk/net/drv/mdi/e3B/acfg/Makefile # # @(#) Makefile 11.1 95/06/13 SCOINC # # Makefile for 3c503 presence test program # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PROG=acfg SHELL=/bin/sh CC=cc CFLAGS=-O LIB=-lx OBJ= acfg.o \ boardio.o \ io.o acfg: $(OBJ) $(CC) $(OBJ) -s -o $(PROG) $(LIB) acfg.o: e503setup.h acfg.c $(CC) -c $(CFLAGS) acfg.c boardio.o: e503setup.h boardio.c $(CC) -c $(CFLAGS) boardio.c io.o: io.s $(CC) -c io.s clean: @echo $@ rm -f $(OBJ) clobber: clean @echo $@ rm -f $(PROG) 0707010002386b000081a400000000000000030000000135aefc96000005f000001dff0000000100000000000000000000002f00000000root/usr/src/O5hdk/net/drv/mdi/e3B/acfg/acfg.c#pragma comment(exestr, "@(#) acfg.c 5.1 94/06/10 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1994 * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated as * Confidential. */ #include #include #include #include #include #include "e503setup.h" #include #include #include #include #include #include #include #include ushort io_addrs[] = { 0x250, 0x280, 0x2a0, 0x2e0, 0x300, 0x310, 0x330, 0x350 }; unchar io_BCR[] = { 0x08, 0x04, 0x02, 0x01, 0x80, 0x40, 0x20, 0x10 }; char dir[128]; struct e3Bset e3Bset[MAXBRDS]; unsigned int numio; /* * usage(): Display usage message and exit. */ usage(prog) char *prog; { fprintf(stderr, "\nUsage: %s -d \n", prog); exit (0); } /* * get_args(): Parse command line argumants. */ get_args(argc, argv) char **argv; { if (argc != 3) { usage(argv[0]); } if (strcmp(argv[1], "-d") != 0) { usage(argv[0]); } strcpy(dir, argv[2]); return 0; } main(argc, argv) char **argv; { if (geteuid() != 0) { fprintf(stderr, "You must be superuser to run this program!\n"); exit(1); } /* Call the routine that enables I/O operation */ if (sysi86(SI86V86, V86SC_IOPL, 0x3000) < 0) { perror("Cannot enable direct I/O!"); exit(1); } get_args(argc, argv); numio = sizeof(io_addrs)/sizeof(short); brdsrch(); exit(0); } 0707010002386c000081a400000000000000030000000135aefc960000065600001dff0000000100000000000000000000003200000000root/usr/src/O5hdk/net/drv/mdi/e3B/acfg/boardio.c#pragma comment(exestr, "@(#) boardio.c 8.1 95/02/01 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1995. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include #include "e503setup.h" #include #include #include #include /* * brdsrch(): search for 3c503 boards. * * Returns: number of 3c503 boards found. */ void brdsrch() { register int i = 0; register struct e3Bset *dv = &e3Bset[i]; char path[128]; extern numio; int boardnum = 0, bit_16; extern char dir[]; FILE *fp; for (i = 0; i < numio; i++) { dv->ex_ioaddr = io_addrs[i]; if (inb(EB_BCR(dv)) != io_BCR[i]) continue; /* reset ethernet controller */ outb(EB_CTRL(dv), XSEL|SRST); /* initialize gate array */ outb(EB_CTRL(dv), XSEL); /* toggle software reset bit */ /* Find out if its 16 bit or 8 bit */ outb(EB_BASE(dv), 0x20); /* page 0 registers */ outb(EB_DCR(dv), 0); outb(EB_BASE(dv), 0xA0); /* page 2 registers */ bit_16 = inb(EB_DCR(dv)) & 0x01; outb(EB_BASE(dv), 0x20); /* page 0 registers */ sprintf(path, "%s/%d", dir, boardnum++); if ((fp = fopen(path, "w")) == (FILE *)0 ) { perror("e3B-acfg: Unable to create AOF output stanza file"); exit(1); } fprintf(fp, "BASE_IO:\n"); /* Stanza Section */ fprintf(fp, "\tSELECT=%x\n", io_addrs[i]); fprintf(fp, "ADAPTER:\n\tAOF=e3B\n"); if (bit_16) fprintf(fp, "\tDESCRIPTION=\"3Com EtherLink II-16 series\"\n"); fflush(fp); fclose(fp); } } 0707010002386d000081a400000000000000030000000135aefc960000043e00001dff0000000100000000000000000000003400000000root/usr/src/O5hdk/net/drv/mdi/e3B/acfg/e503setup.h#pragma comment(exestr, "@(#) e503setup.h 5.1 94/06/10 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #define EADDRSIZE 6 /* # bytes in an ethernet address */ typedef unsigned char e_addr[EADDRSIZE]; struct e3Bset { unsigned long ex_ioaddr; /* I/O ports for device */ }; #define EB_BASE(d) ((d)->ex_ioaddr) #define EB_DCR(d) (((d)->ex_ioaddr)+0xe) #define EB_PSTART(d) (((d)->ex_ioaddr)+0x400) #define EB_BCR(d) (((d)->ex_ioaddr)+0x403) #define EB_CTRL(d) (((d)->ex_ioaddr)+0x406) #define EB_VEC0(d) (((d)->ex_ioaddr)+0x40D) #define SRST 0x01 /* Software reset */ #define XSEL 0x02 /* Transceiver select */ #define EALO 0x04 /* Ethernet address low */ #define MAXBRDS 4 /* num boards this program supports */ extern struct e3Bset e3Bset[]; /* 3c503 setup structures */ extern unsigned short io_addrs[]; /* I/O addresses */ extern unsigned char io_BCR[]; /* BCR value for addresses */ 0707010002386e000081a400000000000000030000000135aefc960000054b00001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/drv/mdi/e3B/acfg/io.s .ident "@(#) io.s 5.1 94/06/10 SCOINC" / / Copyright (C) The Santa Cruz Operation, 1993-1994. / This Module contains Proprietary Information of / The Santa Cruz Operation and should be treated / as Confidential. .data .text .align 4 .def inb; .val inb; .scl 2; .type 042; .endef .globl inb inb: jmp .L14 .L13: movl 8(%ebp),%edx sub %eax,%eax inb (%dx) jmp .L12 /REGAL 0 NODBL /REGAL 6 AUTO -1(%ebp) 1 .L12: leave ret .L14: pushl %ebp movl %esp,%ebp pushl %eax jmp .L13 .def inb; .val .; .scl -1; .endef .data .text .align 4 .def outp; .val outb; .scl 2; .type 044; .endef .globl outb outb: jmp .L18 .L17: movsbl 12(%ebp),%eax movl 8(%ebp),%edx outb (%dx) movl $0,%eax jmp .L16 /REGAL 0 NODBL .L16: leave ret .L18: pushl %ebp movl %esp,%ebp jmp .L17 .def outb; .val .; .scl -1; .endef .data .text .align 4 .def enable; .val enable; .scl 2; .type 044; .endef .globl enable enable: jmp .L19 .L20: sti jmp .L21 /REGAL 0 NODBL .L21: leave ret .L19: pushl %ebp movl %esp,%ebp jmp .L20 .def enable; .val .; .scl -1; .endef .data .text .align 4 .def disable; .val disable; .scl 2; .type 044; .endef .globl disable disable: jmp .L22 .L23: cli jmp .L24 /REGAL 0 NODBL .L24: leave ret .L22: pushl %ebp movl %esp,%ebp jmp .L23 .def disable; .val .; .scl -1; .endef .data 07070100023872000081a400000000000000030000000135aefc96000024f700001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/drv/mdi/e3B/e3B.h/* * @(#) e3B.h 5.1 94/06/10 SCOINC * * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * System V STREAMS TCP - Release 4.0 * * Copyright 1990 Interactive Systems Corporation,(ISC) * All Rights Reserved. * * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) * All Rights Reserved. * * System V STREAMS TCP was jointly developed by Lachman * Associates and Convergent Technologies. */ /* SCCS IDENTIFICATION */ /* Header for 3com Ethernet board */ #define E3COM_NMCADDR 16 #define E3COM_ADDR 6 #define MCON 0 /* turn on multicast mode */ #define MCOFF 1 /* turn off multicast mode */ /* LAN Controller, Control Register bits 3=0, 2=0 */ #define CR (device->base) /* Command register (r/w) */ #define XSTP 0x01 /* Stop */ #define STA 0x02 /* Start */ #define TXP 0x04 /* Transmit packet */ #define RD0 0x08 /* Remote DMA command */ #define RD1 0x10 #define RD2 0x20 #define PS0 0x40 /* Page select */ #define PS1 0x80 /* page 0 registers */ #define PSTART (device->base+0x01) /* Page start register (w) */ #define PSTOP (device->base+0x02) /* Page stop register (w) */ #define BNRY (device->base+0x03) /* Boundary pointer (r/w) */ #define TSR (device->base+0x04) /* Transmit status (r) */ #define PTX 0x01 /* Packet transmitted */ #define NDT 0x02 /* Non-deferred transmission */ #define COL 0x04 /* Transmit collided */ #define ABT 0x08 /* Transmit aborted */ #define CRS 0x10 /* Carrier sense lost */ #define FU 0x20 /* FIFO underrun */ #define CDH 0x40 /* Collision-detect heartbeat */ #define OWC 0x80 /* Out-of-windown collision */ #define TPSR (device->base+0x04) /* Transmit page start (w) */ #define NCR (device->base+0x05) /* # collisions (r) */ #define TBCR0 (device->base+0x05) /* Transmit byte count (w) */ #define TBCR1 (device->base+0x06) #define ISR (device->base+0x07) /* Interrupt status (r/w) */ #define IPRX 0x01 /* Packet received */ #define IPTX 0x02 /* Packet transmitted */ #define IRXE 0x04 /* Receive error */ #define ITXE 0x08 /* Transmit error */ #define IOVW 0x10 /* Overwrite warning */ #define ICNT 0x20 /* Counter overflow */ #define IRDC 0x40 /* Remote DMA complete */ #define IRST 0x80 /* Reset status */ #define RSAR0 (device->base+0x08) /* Remote start address (w) */ #define RSAR1 (device->base+0x09) #define RBCR0 (device->base+0x0a) /* Remote byte count (w) */ #define RBCR1 (device->base+0x0b) #define RSR (device->base+0x0c) /* Receive status (r) */ #define PRX 0x01 /* Pakcet received intact */ #define CRCE 0x02 /* CRC error */ #define FAE 0x04 /* Frame alignment error */ #define FO 0x08 /* FIFO overrun */ #define MPA 0x10 /* Missed packet */ #define PHY 0x20 /* Physical/multicast address */ #define DIS 0x40 /* Receiver disabled */ #define DFR 0x80 /* Deferring */ #define RCR (device->base+0x0c) /* Receive configuration (w) */ #define SEP 0x01 /* Save errored packets */ #define AR 0x02 /* Accept runt packets */ #define AB 0x04 /* Accept broadcast */ #define AM 0x08 /* Accept multicast */ #define PRO 0x10 /* Promiscuous physical */ #define MON 0x20 /* Monitor mode */ #define CNTR0 (device->base+0x0d) /* Frame alignment errors (r) */ #define TCR (device->base+0x0d) /* Transmit configuration (w) */ #define CRC 0x01 /* Inhibit CRC */ #define LB0 0x02 /* Encoded loopback control */ #define LB1 0x04 #define ATD 0x08 /* Auto-transmit disable */ #define OFST 0x10 /* Collision offset enable */ #define CNTR1 (device->base+0x0e) /* CRC errors (r) */ #define DCR (device->base+0x0e) /* Data configuration (w) */ #define WTS 0x01 /* Word transfer select */ #define BOS 0x02 /* Byte order select */ #define LAS 0x04 /* Long address select */ #define BMS 0x08 /* Burst mode select */ #define ARM 0x10 /* Autoinitialize remote */ #define FT0 0x20 /* FIFO threshold select */ #define FT1 0x40 #define CNTR2 (device->base+0x0f) /* Missed packet errors (r) */ #define IMR (device->base+0x0f) /* Interrupt mask (w) */ #define PRXE 0x01 /* Packet received */ #define PTXE 0x02 /* Packet transmitted */ #define RXEE 0x04 /* Receive error */ #define TXEE 0x08 /* Transmit error */ #define OVWE 0x10 /* Overwrite warning */ #define CNTE 0x20 /* Counter overflow */ #define RDCE 0x40 /* DMA complete */ /* page 1 registers */ #define PAR0 (device->base+0x01) /* Physical address (r/w) */ #define CURR (device->base+0x07) /* Current page (r/w) */ #define MAR0 (device->base+0x08) /* Multicast address (r/w) */ /* Ethernet Address PROM, Control Register bits 3=0, 2=1 */ #define EADDR (device->base) /* Address (read & write)*/ /* Gate Array */ #define PSTR (device->base+0x400) /* Page Start Register (r/w) */ #define PSPR (device->base+0x401) /* Page Stop Register (r/w) */ #define DQTR (device->base+0x402) /* Drq Timer Register (r/w) */ #define BCFR (device->base+0x403) /* Base Configuration Register (ro) */ #define PCFR (device->base+0x404) /* EPROM Configuration Register (ro) */ #define GACFR (device->base+0x405) /* Ga Configuration Register (r/w) */ #define MBS0 0x01 /* Memory bank select 0 */ #define MBS1 0x02 /* Memory bank select 1 */ #define MBS2 0x04 /* Memory bank select 2 */ #define REL 0x08 /* RAM select */ #define TEST 0x10 /* Test */ #define OWS 0x20 /* Zero wait state */ #define TCM 0x40 /* Terminal count mask */ #define NIM 0x80 /* NIC int mask */ #define CTRL (device->base+0x406) /* Control Register (r/w) */ #define SRST 0x01 /* Software reset */ #define XSEL 0x02 /* Transceiver select */ #define EALO 0x04 /* Ethernet address low */ #define EAHI 0x08 /* Ethernet address high */ #define SHARE 0x10 /* Interrupt share */ #define DBSEL 0x20 /* Double buffer select */ #define DDIR 0x40 /* DMA direction */ #define START 0x80 /* Start DMA controller */ #define STREG (device->base+0x407) /* Status Register (ro) */ #define REV 0x07 /* Ga revision */ #define DIP 0x08 /* DMA in progress */ #define DTC 0x10 /* DMA terminal count */ #define OFLW 0x20 /* Overflow */ #define UFLW 0x40 /* Underflow */ #define DPRDY 0x80 /* Data port ready */ #define IDCFR (device->base+0x408) /* Interrupt/DMA Configuration Register (r/w) */ #define DRQ1 0x01 /* DMA request 1 */ #define DRQ2 0x02 /* DMA request 2 */ #define DRQ3 0x04 /* DMA request 3 */ #define IRQ2 0x10 /* Interrupt request 2 */ #define IRQ3 0x20 /* Interrupt request 3 */ #define IRQ4 0x40 /* Interrupt request 4 */ #define IRQ5 0x80 /* Interrupt request 5 */ #define DAMSB (device->base+0x409) /* DMA Address Register MSB (r/w) */ #define DALSB (device->base+0x40a) /* DMA Address Register LSB (r/w) */ #define VPTR2 (device->base+0x40b) /* Vector Pointer Register 2 (r/w) */ #define VPTR1 (device->base+0x40c) /* Vector Pointer Register 1 (r/w) */ #define VPTR0 (device->base+0x40d) /* Vector Pointer Register 0 (r/w) */ #define RFMSB (device->base+0x40e) /* Register File Access MSB (r/w) */ #define RFLSB (device->base+0x40f) /* Register File Access LSB (r/w) */ #define EDEVSIZ (0x10 * sizeof(char)) /* * Total buffer size, is therefore 1566. We allow 2000. */ #define TX_BUFBASE 0x20 #define TX_BUFSIZE 0x06 #define RX_BUFBASE 0x2c #define RX_BUFLIM 0x40 #define RX_BUFLIM16 0x60 #define NXT_RXBUF(p) ((p)==device->rx_buflim-1 ? RX_BUFBASE : (p)+1) #define PRV_RXBUF(p) ((p)==RX_BUFBASE ? device->rx_buflim-1 : (p)-1) #define CURRXBUF(t) (outb(CR, PS0|RD2|STA), t=inb(CURR), outb(CR, RD2|STA), t) #define E3COM_MINPACK 60 /* minimum output packet length */ #define E3COM_MAXPACK 1514 /* maximum output packet length */ /* transfer limits */ #define E3BETHERMIN (E3COM_MINPACK) #define E3BETHERMTU (E3COM_MAXPACK) struct e3Bdevice { #ifdef DYNAMIC #define RX_MBLKS 64 mblk_t *mblk[RX_MBLKS]; #endif queue_t *up_queue; unsigned int base; int open; /* device open already? */ unsigned char type16; unsigned char rx_buflim; unsigned int flags; unsigned int tid; /* TX timeout */ mac_stats_eth_t macstats; /* stats */ unsigned char eaddr[E3COM_ADDR]; /* H/W address */ /* Multicast table */ unsigned char mctbl[E3COM_NMCADDR][E3COM_ADDR]; int mccnt; /* dual transmit buffer stuff */ unsigned char curtxbuf; unsigned char txbufstate[2]; unsigned char txbufaddr[2]; unsigned short txbuflen[2]; }; /* device flags */ #define E3BBUSY 0x01 #define E3BWAITO 0x02 /* miscellany */ #define OK 1 #define NOT_OK 0 #define TX_TIMEOUT (5*HZ) #define WATCHDOG2 (5*HZ) #if 1 #define E3BIMASK (PRXE|PTXE|RXEE|TXEE|OVWE|CNTE) #else #define E3BIMASK (PRXE|RXEE|OVWE|CNTE) #endif extern struct e3Bdevice e3Bdevice[]; extern unsigned int e3Biobase[]; extern unsigned int e3Bintl[]; extern unsigned int e3Bxcvr[]; /* Transceiver select */ extern unsigned int e3B_nunit; #ifndef _INKERNEL #define N3C503UNIT 4 /* maximum number of boards possible */ #endif #define DIAGON 1 #define DIAGINTR 2 #ifdef DEBUG #define E3BDIAG(M,S) if (e3Bdiag & (M)) S #else #define E3BDIAG(M,S) #endif #define E3B_INITED (1) #define E3B_ACTIVE (2) #define E3B_DOWN (4) #if !defined(ENETM_ID) #define ENETM_ID 101 #endif /* two transmit buffer state flags */ #define TX_FREE 0 #define TX_LOADED 1 #define TX_TXING 2 07070100023873000081a400000000000000030000000135aefc9600000b1b00001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/e3B/e3Bio.s .ident "@(#) e3Bio.s 5.1 94/06/10 SCOINC" / / Copyright (C) The Santa Cruz Operation, 1993-1994. / This Module contains Proprietary Information of / The Santa Cruz Operation and should be treated / as Confidential. / / System V STREAMS TCP - Release 4.0 / / Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) / / All Rights Reserved. / / The copyright above and this notice must be preserved in all / copies of this source code. The copyright above does not / evidence any actual or intended publication of this source / code. / / This is unpublished proprietary trade secret source code of / Lachman Associates. This source code may not be copied, / disclosed, distributed, demonstrated or licensed except as / expressly authorized by Lachman Associates. / / System V STREAMS TCP was jointly developed by Lachman / Associates and Convergent Technologies. / .set PTR, 8 .set LEN, 12 .set PORT, 16 .set STREG, 20 .set TYPE16,24 .set OADDR, 28 .set DPRDY, 0x80 .globl e3Bioout e3Bioout: pushl %ebp movl %esp,%ebp pushl %edx pushl %esi pushl %ecx pushl %ebx cld movl PTR(%ebp),%esi testb $1,TYPE16(%ebp) jnz ogot16 otop: cmpl $0,LEN(%ebp) jg odprdy odone: popl %ebx popl %ecx popl %esi popl %edx leave ret odprdy: movw STREG(%ebp),%dx oloop: inb (%dx) testb $DPRDY,%al je oloop movl $8,%ecx subl %ecx,LEN(%ebp) jge output movl LEN(%ebp),%ecx addl $8,%ecx output: movw PORT(%ebp),%dx rep outsb jmp otop ogot16: testb $1,OADDR(%ebp) jz oloop2 movw STREG(%ebp),%dx olp1: inb (%dx) testb $DPRDY,%al je olp1 subl $1,LEN(%ebp) movw PORT(%ebp),%dx outsb oloop2: movl LEN(%ebp),%ebx cmp $1,%ebx jle odone16 movw STREG(%ebp),%dx olp2: inb (%dx) testb $DPRDY,%al je olp2 cmp $16,%ebx jle ol1 mov $16,%ebx ol1: testb $1,%bl jz ol2 dec %ebx ol2: mov %ebx,%ecx shrl $1,%ecx movw PORT(%ebp),%dx rep outsw subl %ebx,LEN(%ebp) jmp oloop2 odone16: cmp $0,%ebx jz odone movw STREG(%ebp),%dx olp3: inb (%dx) testb $DPRDY,%al je olp3 movw PORT(%ebp),%dx outsb jmp odone .globl e3Bioin e3Bioin: pushl %ebp movl %esp,%ebp pushl %edx pushl %edi pushl %ecx push %ebx cld movl PTR(%ebp),%edi testb $1,TYPE16(%ebp) jnz igot16 itop: cmpl $0,LEN(%ebp) jg idprdy idone: popl %ebx popl %ecx popl %edi popl %edx leave ret idprdy: movw STREG(%ebp),%dx iloop: inb (%dx) testb $DPRDY,%al je iloop movl $8,%ecx subl %ecx,LEN(%ebp) jge input movl LEN(%ebp),%ecx addl $8,%ecx input: movw PORT(%ebp),%dx rep insb jmp itop igot16: movl LEN(%ebp),%ebx testb $1,%bl jz il1 inc %ebx il1: shrl %ebx iloop1: cmp $0,%ebx jz idone movw STREG(%ebp),%dx ilp1: inb (%dx) testb $DPRDY,%al je ilp1 mov %ebx,%ecx cmp $8,%ecx jle il2 mov $8,%ecx il2: subl %ecx,%ebx movw PORT(%ebp),%dx rep insw jmp iloop1 07070100023874000081a400000000000000030000000135aefc9600002c9800001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/e3B/e3Bli.c#pragma comment(exestr, "@(#) e3Bli.c 8.2 95/02/01 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1995. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * System V STREAMS TCP - Release 4.0 * * Copyright 1990 Interactive Systems Corporation,(ISC) * All Rights Reserved. * * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) * All Rights Reserved. * * The copyright above and this notice must be preserved in all * copies of this source code. The copyright above does not * evidence any actual or intended publication of this source * code. * * This is unpublished proprietary trade secret source code of * Lachman Associates. This source code may not be copied, * disclosed, distributed, demonstrated or licensed except as * expressly authorized by Lachman Associates. * * System V STREAMS TCP was jointly developed by Lachman * Associates and Convergent Technologies. */ /* SCCS IDENTIFICATION */ #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" #include "sys/stream.h" #include "sys/stropts.h" #include "sys/strlog.h" #include "sys/log.h" #include "sys/mdi.h" #include "sys/signal.h" /* needed for sys/user.h */ #include "sys/dir.h" /* needed for sys/user.h */ #include "sys/page.h" /* needed for sys/user.h */ #include "sys/seg.h" /* needed for sys/user.h */ #include "sys/user.h" #include "sys/errno.h" #include "sys/conf.h" #include "sys/debug.h" #include "sys/cmn_err.h" #include "bool.h" #include "e3B.h" unsigned char e3B_broad[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int e3Bstrncmp(); extern e3Bhwput(), e3Bhwinit(); /* * The following six routines are the normal streams driver * access routines */ e3Bopen(q, dev, flag, sflag) register queue_t *q; { struct e3Bdevice * device; unsigned int unit; int x; unit = minor(dev); if (unit >= e3B_nunit) { u.u_error = ENXIO; return(OPENFAIL); } if (sflag == CLONEOPEN) { u.u_error = EINVAL; return (OPENFAIL); } device = &(e3Bdevice[unit]); if (device->open == TRUE) { u.u_error = EBUSY; return (OPENFAIL); } if (e3BINIT(unit)) { u.u_error = ENXIO; return(OPENFAIL); } device->up_queue = (queue_t *)0; device->open = TRUE; x = splstr(); q->q_ptr = WR(q)->q_ptr = (char *)unit; noenable(WR(q)); /* enabled after tx completion */ splx(x); return(unit); } e3Bclose(q) register queue_t *q; { int bd = (int)q->q_ptr; struct e3Bdevice *device = &e3Bdevice[bd]; int x; x = splstr(); flushq(WR(q), 1); q->q_ptr = NULL; device->up_queue = 0; device->open = FALSE; e3Bhwclose(bd); e3Bmcset(bd, MCOFF); device->mccnt = 0; splx(x); } e3Buwput(q, mp) register queue_t *q; register mblk_t *mp; { STRLOG(ENETM_ID, 0, 9, SL_TRACE, "e3Buwput: type=0x%x", mp->b_datap->db_type); switch (mp->b_datap->db_type) { case M_PROTO: case M_PCPROTO: e3Bmacproto(q, mp); return; case M_DATA: e3Bdata(q, mp); return; case M_IOCTL: e3Bioctl(q, mp); return; case M_FLUSH: if (*mp->b_rptr & FLUSHW) { flushq(q, FLUSHALL); *mp->b_rptr &= ~FLUSHW; } if (*mp->b_rptr & FLUSHR) { flushq(RD(q), FLUSHALL); qreply(q, mp); } else freemsg(mp); return; default: printf("e3Buwput: unknown STR msg type %x received mp = %x\n", mp->b_datap->db_type, mp); freemsg(mp); return; } } e3Bdequeue(q) register queue_t *q; { register unit = (int)q->q_ptr; while (q->q_first) { if (!e3Boktoput(unit)) return; e3Bhwput(unit, getq(q)); } } e3Binit() { extern char *eaddrstr(); unsigned char e[6]; int i; int t; int boottmp; char *tp; extern int e3Bintr(); for (i = 0; i < e3B_nunit; i++) { /* set defaults from boot line if they're available */ if ((boottmp = mdi_netboot_info("e3B", i, "io")) > 0) { e3Biobase[i] = (unsigned int)boottmp; if ((boottmp = mdi_netboot_info("e3B", i, "irq")) > 0) e3Bintl[i] = (unsigned int)boottmp; if ((boottmp = mdi_netboot_info("e3B", i, "phy")) > 0) { if (boottmp == MDI_MEDIA_AUI) e3Bxcvr[i] = 1L; else e3Bxcvr[i] = 0L; } } if ((t = e3Bpresent(i,e)) != 0) { if (t == 1) tp = "3c503"; else tp = "3c503-16"; if (add_intr_handler(1, e3Bintl[i], e3Bintr, 5) != 0) { printcfg("e3B", e3Bio_base(i), EDEVSIZ - 1, -1, -1, "UNABLE TO ADD INTR HANDLER (%d)", e3Bintl[i]); continue; } printcfg("e3B", e3Bio_base(i), EDEVSIZ-1, e3Bintl[i], -1, "type=%s addr=%s", tp, eaddrstr(e)); } else if (!mdi_netboot_quiet("e3B", i)) printcfg("e3B", e3Bio_base(i), EDEVSIZ-1, -1, -1, "ADAPTER NOT FOUND"); } } /* * real init */ static e3BINIT(unit) register unit; { int i; int x; mac_stats_eth_t *macstats = &(e3Bdevice[unit].macstats); unsigned char *e = (e3Bdevice[unit].eaddr); int t; x = splstr(); if ((t = e3Bhwinit(unit, e)) == 0) { printf("No board for unit %d\n", unit); splx(x); return(1); } splx(x); return(0); } /* * The following four routines implement MDI interface */ /*static*/ e3Bmacproto(q, mp) queue_t *q; mblk_t *mp; { int bd = (int)q->q_ptr; struct e3Bdevice *device = &e3Bdevice[bd]; union MAC_primitives *prim = (union MAC_primitives *) mp->b_rptr; mblk_t *mp1, *mp2; mac_info_ack_t *info_ack; mac_ok_ack_t *ok_ack; int s; mac_stats_eth_t *e3Bmacstats = &(e3Bdevice[bd].macstats); STRLOG(ENETM_ID, 0, 9, SL_TRACE, "e3Bmacproto: prim=0x%x", prim->mac_primitive); switch(prim->mac_primitive) { case MAC_INFO_REQ: if ((mp1 = allocb(sizeof(mac_info_ack_t), BPRI_HI)) == NULL) { cmn_err(CE_WARN, "e3Bmacproto - Out of STREAMs"); freemsg(mp); return; } info_ack = (mac_info_ack_t *) mp1->b_rptr; mp1->b_wptr += sizeof(mac_info_ack_t); mp1->b_datap->db_type = M_PCPROTO; info_ack->mac_primitive = MAC_INFO_ACK; info_ack->mac_max_sdu = E3BETHERMTU; info_ack->mac_min_sdu = 14; info_ack->mac_mac_type = MAC_CSMACD; info_ack->mac_driver_version = MDI_VERSION; info_ack->mac_if_speed = 10000000; freemsg(mp); qreply(q, mp1); break; case MAC_BIND_REQ: if (device->up_queue) { mdi_macerrorack(RD(q),prim->mac_primitive,MAC_OUTSTATE); freemsg(mp); return; } device->up_queue = RD(q); mdi_macokack(RD(q),prim->mac_primitive); freemsg(mp); break; default: freemsg(mp); mdi_macerrorack(RD(q), prim->mac_primitive, MAC_BADPRIM); break; } } static e3Bdata(q,mp) queue_t *q; mblk_t *mp; { int bd = (int)q->q_ptr; struct e3Bdevice *device = &e3Bdevice[bd]; int s; mac_stats_eth_t *e3Bmacstats = &(e3Bdevice[bd].macstats); int do_loop; if (!device->up_queue) { mdi_macerrorack(RD(q), M_DATA, MAC_OUTSTATE); freemsg(mp); return; } if (*mp->b_rptr & 0x01) { /* Multicast/B'cast */ do_loop=!e3Bchktbl(mp->b_rptr, bd); } else { do_loop=!e3Bstrncmp(device->eaddr, mp->b_rptr, E3COM_ADDR); } if (do_loop) mdi_do_loopback(q, mp, E3COM_MINPACK); s = splstr(); if (q->q_first || !e3Boktoput(bd)) putq(q, mp); else e3Bhwput(bd, mp); splx(s); } static e3Bioctl(q, mp) queue_t *q; mblk_t *mp; { int unit = (int) q->q_ptr; struct e3Bdevice *device = &e3Bdevice[unit]; struct iocblk *iocp = (struct iocblk *) mp->b_rptr; unsigned char *data; int mccnt; int i; int j; unsigned char *cp; unsigned int x; data = (mp->b_cont) ? mp->b_cont->b_rptr : NULL; switch (iocp->ioc_cmd) { case MACIOC_GETSTAT: /* dump mac or dod statistics */ if (data == NULL) { iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } if (iocp->ioc_count != sizeof(mac_stats_eth_t)) { iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } bcopy(&device->macstats, data, sizeof(mac_stats_eth_t)); mp->b_cont->b_wptr=mp->b_cont->b_rptr + sizeof(mac_stats_eth_t); goto e3Bioctl_ack; case MACIOC_CLRSTAT: /* clear mac statistics */ if (iocp->ioc_uid != 0) { iocp->ioc_error = EPERM; goto e3Bioctl_nak; } x = splstr(); bzero(&device->macstats, sizeof(mac_stats_eth_t)); iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } splx(x); goto e3Bioctl_ack; case MACIOC_GETADDR: /* get mac address */ if (data == NULL || iocp->ioc_count != E3COM_ADDR) { iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } bcopy(device->eaddr, data, E3COM_ADDR); mp->b_cont->b_wptr = mp->b_cont->b_rptr + E3COM_ADDR; goto e3Bioctl_ack; case MACIOC_GETMCSIZ: /* get multicast table size */ iocp->ioc_rval = device->mccnt * E3COM_ADDR; iocp->ioc_count = 0; goto e3Bioctl_ack; case MACIOC_GETMCA: /* get multicast table */ i = E3COM_ADDR * device->mccnt; if (data == NULL || iocp->ioc_count < i) { iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } bcopy(device->mctbl, data, i); iocp->ioc_count = i; mp->b_cont->b_wptr = mp->b_cont->b_rptr + i; goto e3Bioctl_ack; case MACIOC_SETMCA: /* multicast setup */ mccnt = device->mccnt; if (data == NULL) { iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } if (mccnt == E3COM_NMCADDR) { iocp->ioc_error = ENOSPC; goto e3Bioctl_nak; } if (iocp->ioc_count != E3COM_ADDR) { iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } if (iocp->ioc_uid != 0) { iocp->ioc_error = EPERM; goto e3Bioctl_nak; } if (!(*data & 0x01)) { iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } for (i = 0; i < device->mccnt; i++) { if (!e3Bstrncmp(device->mctbl[i], data, E3COM_ADDR)) { iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } goto e3Bioctl_ack; } } x = splstr(); bcopy(data,device->mctbl[mccnt], E3COM_ADDR); if (device->mccnt == 0) e3Bmcset(unit,MCON); device->mccnt++; iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } splx(x); goto e3Bioctl_ack; case MACIOC_DELMCA: /* multicast delete */ mccnt = device->mccnt; if (data == NULL) { iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } if (iocp->ioc_count != E3COM_ADDR) { iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } if (iocp->ioc_uid != 0) { iocp->ioc_error = EPERM; goto e3Bioctl_nak; } for (i = 0; i < mccnt; i++) { if (!e3Bstrncmp(data, device->mctbl[i], E3COM_ADDR)) break; } if (i >= mccnt) { iocp->ioc_error = ENOENT; goto e3Bioctl_nak; } x = splstr(); mccnt = --device->mccnt; if (i < device->mccnt) bcopy(device->mctbl[i+1], device->mctbl[i], (mccnt-i) * E3COM_ADDR); if (mccnt == 0) e3Bmcset(unit,MCOFF); iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } splx(x); goto e3Bioctl_ack; default: iocp->ioc_error = EINVAL; goto e3Bioctl_nak; } e3Bioctl_ack: mp->b_datap->db_type = M_IOCACK; qreply(q, mp); return; e3Bioctl_nak: mp->b_datap->db_type = M_IOCNAK; iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } qreply(q, mp); return; } static char* eaddrstr(ea) unsigned char ea[6]; { static char buf[18]; char* s = "0123456789abcdef"; int i; for (i=0; i<6; ++i) { buf[i*3] = s[(ea[i] >> 4) & 0xf]; buf[i*3 + 1] = s[ea[i] & 0xf]; buf[i*3 + 2] = ':'; } buf[17] = 0; return buf; } int e3Bstrncmp(s1,s2,n) register char *s1,*s2; register int n; { ++n; while (--n > 0 && *s1++ == *s2++); return (n); } 07070100023875000081a400000000000000030000000135aefc96000039e400001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/drv/mdi/e3B/e3Bmac.c#pragma comment(exestr, "@(#) e3Bmac.c 11.1 95/05/17 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1995. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. * * Copyright 1990 Interactive Systems Corporation,(ISC) * All Rights Reserved. * * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) * All Rights Reserved. * * The copyright above and this notice must be preserved in all * copies of this source code. The copyright above does not * evidence any actual or intended publication of this source * code. * * This is unpublished proprietary trade secret source code of * Lachman Associates. This source code may not be copied, * disclosed, distributed, demonstrated or licensed except as * expressly authorized by Lachman Associates. * * System V STREAMS TCP was jointly developed by Lachman * Associates and Convergent Technologies. */ #include "sys/types.h" #include "sys/param.h" /* for KERNADDR used in page.h */ #include "sys/sysmacros.h" /* for ctob */ #include "sys/page.h" /* for virtual to physical translation */ #include "sys/stream.h" #include "sys/log.h" #include "sys/strlog.h" #include "sys/cmn_err.h" #include #include "e3B.h" static ushort io_addrs[] = { 0x250, 0x280, 0x2a0, 0x2e0, 0x300, 0x310, 0x330, 0x350 }; static unchar io_BCR[] = { 0x08, 0x04, 0x02, 0x01, 0x80, 0x40, 0x20, 0x10 }; static unsigned int e3Bimsk[] = { /* vec no 0 */ 0, /* vec no 1 */ 0, /* vec no 2 */ IRQ2, /* vec no 3 */ IRQ3, /* vec no 4 */ IRQ4, /* vec no 5 */ IRQ5, 0,0,0,IRQ2,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,IRQ2 }; #define intlev_to_msk(l) (e3Bimsk[l]) static unsigned int e3Bdmask[] = {DRQ1, DRQ1, DRQ2, DRQ3}; #define dchan_to_msk(c) (e3Bdmask[c]) e3Bio_base(unit) register unit; { return(e3Biobase[unit]); } /* probe routine for 3c503 - it's rude and crude but works */ int e3Bpresent(unit,e) int unit; unsigned char e[]; { register int i; register struct e3Bdevice *device = &e3Bdevice[unit]; int t; unsigned int numio; /* set the io address of the board */ device->base = e3Bio_base(unit); /* determine if card is present */ numio = sizeof(io_addrs)/sizeof(short); for (i = 0; i < numio; i++) { if (device->base == io_addrs[i]) break; } if (i >= numio) return (0); if ((inb(BCFR)) != io_BCR[i]) return (0); /* reset ethernet controller */ outb(CTRL, XSEL|SRST); /* initialize gate array */ outb(CTRL, XSEL); /* toggle software reset bit */ outb(CTRL, EALO|XSEL); /* enable Ethernet address prom */ for (i = 0; i < 6; i++) { e[i] = inb(EADDR+i); } /* recognize board type */ outb(CTRL, XSEL); outb(CR, RD2); /* page 0 registers */ outb(DCR, 0); /* write a zero */ outb(CR, PS1|RD2); /* page 2 registers */ t = inb(DCR)&WTS; /* if WTS on then it is a 16-bit brd */ outb(CR, RD2); /* page 0 registers */ if (t) { device->type16 = 1; device->rx_buflim = RX_BUFLIM16; } else { device->rx_buflim = RX_BUFLIM; } return(t + 1); } e3Bhwinit(unit, eaddr) register unit; unsigned char *eaddr; { register struct e3Bdevice *device = &e3Bdevice[unit]; register int i; int s; /* set the io address of the board */ STRLOG(ENETM_ID, 0, 9, SL_TRACE, "e3Bhwinit"); device->base = e3Bio_base(unit); /* reset ethernet controller */ outb(CTRL, XSEL|SRST); /* initialize gate array */ outb(CTRL, XSEL); /* toggle software reset bit */ outb(CTRL, EALO|XSEL); /* enable Ethernet address prom */ /* Grab the ethernet address */ for (i=0; i < 6; i++) { eaddr[i] = inb(EADDR+i); } if (e3Bxcvr[unit]) outb(CTRL, 0); /* external transceiver */ else outb(CTRL, XSEL); /* on-board transceiver */ outb(PSTR, RX_BUFBASE); outb(PSPR, device->rx_buflim); /* 5K or 13k of receive space */ /* Set interrupt level and DMA channel */ outb(IDCFR, intlev_to_msk(e3Bintl[unit])); outb(DQTR, 8); /* 8 bytes/DMA transfer */ outb(DAMSB, TX_BUFBASE); /* 3k (2 x 1.5K) transmit buffers */ outb(DALSB, 0); s = splstr(); e3Bstrtnic(unit, 1); /* start NIC */ device->txbufaddr[0] = TX_BUFBASE; device->txbufaddr[1] = TX_BUFBASE + TX_BUFSIZE; splx(s); return(OK); } e3Bwatchdog(unit) { register struct e3Bdevice *device = &e3Bdevice[unit]; device->tid = 0; device->macstats.mac_timeouts++; e3Brestrtnic(unit,0); if (!(device->flags & E3BBUSY)) { /* should be BUSY */ return; } outb(TCR, 0); /* retry current transmission */ device->tid = timeout(e3Bwatchdog, unit, TX_TIMEOUT); /* chip bug */ outb(CR, RD2|TXP|STA); /* transmit */ } e3Brestrtnic(unit, flag) { register struct e3Bdevice *device = &e3Bdevice[unit]; static int restarting; STRLOG(ENETM_ID, 0, 9, SL_TRACE, "Restarting 3c503 NIC"); if (restarting) return; restarting = 1; device->macstats.mac_tx_errors++; outb(CR, RD2|XSTP); /* stop NIC first */ /*MAF while (!(inb(ISR) & IRST)) ; */ e3Bstrtnic(unit, flag); restarting = 0; } static e3Bstrtnic(unit, flag) { register struct e3Bdevice *device = &e3Bdevice[unit]; unsigned char *eaddr = device->eaddr; int i; outb(CR, RD2|XSTP); /* page 0 registers */ outb(DCR, FT1|BMS); /* 8 bytes/DMA burst */ outb(RCR, AB|AM); /* accept broadcast and multicast */ outb(TCR, LB0); /* loopback mode */ if (flag) outb(BNRY, device->rx_buflim-1); /* CURR - 1 */ outb(PSTART, RX_BUFBASE); /* same as PSTR */ outb(PSTOP, device->rx_buflim); /* same as PSTOP */ outb(ISR, 0xff); /* reset interrupt status */ outb(IMR, E3BIMASK); /* enable interrupts */ outb(CR, PS0|RD2|XSTP); /* page 1 registers */ for (i=0; imacstats); outb(IMR, 0); /* disable interrupts */ if ((c = inb(ISR)) == 0) { e3Bmacstats->mac_spur_intr++; return; } outb(ISR, c); /* clear status */ STRLOG(ENETM_ID, 0, 9, SL_TRACE, "e3Bintr: lev = %d, status = %x", lev, c); if (c & (IPTX|ITXE)) { e3Bcktsr(board); e3Bstrtout(board); } if (c & IRXE) { /* Receive error */ c2 = inb(RSR); STRLOG(ENETM_ID, 0, 9, SL_TRACE, "receive error status = %x", c2); if (c2 & CRCE) { e3Bmacstats->mac_badsum++; } if (c2 & FAE) { e3Bmacstats->mac_align++; } if (c2 & FO) { e3Bmacstats->mac_baddma++; } if (c2 & MPA) { e3Bmacstats->mac_no_resource++; } if (c2 & ~(CRCE|FAE|FO|MPA)) { /* Huh? */ e3Bmacstats->mac_spur_intr++; } } if (c & ICNT) { /* Counter overflow */ (void)inb(CNTR0); /* clear counters */ (void)inb(CNTR1); (void)inb(CNTR2); } if (c & (IPRX|IOVW)) { /* Packet received */ if (c & IOVW) { outb(CR, RD2|XSTP); outb(RBCR0, 0); outb(RBCR1, 0); /*MAF while (!(inb(ISR) & IRST)) ; */ outb(TSR, LB0); outb(CR, RD2|STA); } nxtpkt = NXT_RXBUF(inb(BNRY)); while (nxtpkt != CURRXBUF(j)) { outb(DAMSB, nxtpkt); outb(DALSB, 0); outb(CTRL, (e3Bxcvr[board] ? 0 : XSEL)|START); while(!(inb(STREG) & DPRDY)) /* wait for board to fill register */; c2 = inb(RFMSB); curpkt = nxtpkt; nxtpkt = inb(RFMSB); len = inw(RFMSB); STRLOG(ENETM_ID, 0, 9, SL_TRACE, "packet received, s %x cn %x l %x", c2, (curpkt<<8)|nxtpkt, len); if (e3Bpktsft(curpkt, nxtpkt, len, device)) { STRLOG(ENETM_ID, 0, 9, SL_TRACE, "shifted packet rcvd"); outb(CTRL, (e3Bxcvr[board] ? 0 : XSEL)); e3Bmacstats->mac_align++; e3Brestrtnic(board, 1); return; } if (c2 & (DIS|DFR)) { STRLOG(ENETM_ID, 0, 9, SL_TRACE, "packet rcvd erronously, status=%x", c2); e3Bmacstats->mac_no_resource++; outb(CTRL, (e3Bxcvr[board] ? 0 : XSEL)); outb(BNRY, PRV_RXBUF(nxtpkt)); /* update read ptr */ continue; } len -= 4; /* dump the CRC */ if ((len < E3COM_MINPACK) || (len > E3COM_MAXPACK)) { e3Bmacstats->mac_badlen++; STRLOG(ENETM_ID, 0, 9, SL_TRACE, "bad length %d recvd", len); outb(CTRL, (e3Bxcvr[board] ? 0 : XSEL)); outb(BNRY, PRV_RXBUF(nxtpkt)); /* update read ptr */ continue; } STRLOG(ENETM_ID, 0, 9, SL_TRACE, "allocating buffer size %d", len); if (!(mp = allocb(len+2, BPRI_HI))) { e3Bmacstats->mac_frame_nosr++; STRLOG(ENETM_ID, 0, 9, SL_TRACE, "allocb length %d failed", len); outb(CTRL, (e3Bxcvr[board] ? 0 : XSEL)); outb(BNRY, PRV_RXBUF(nxtpkt)); /* update read ptr */ continue; } /* Align user data on 4 byte boundary for speed */ mp->b_rptr += 2; e3Bioin(mp->b_rptr, len, RFMSB, STREG, device->type16); outb(CTRL, (e3Bxcvr[board] ? 0 : XSEL)); outb(BNRY, PRV_RXBUF(nxtpkt)); /* update read ptr */ /* adjust length of write pointer */ mp->b_wptr = mp->b_rptr + len; /* is it a broadcast/multicast address? */ if (*mp->b_rptr & 0x01 && e3Bchktbl(mp->b_rptr, board)) { freeb(mp); continue; } if (device->up_queue) { putnext(device->up_queue, mp); } else freeb(mp); } } if (c & IOVW) { /* Overwrite warning */ e3Bmacstats->mac_baddma++; outb(TCR, 0); } outb(IMR, E3BIMASK); } e3Bcktsr(unit) int unit; { register struct e3Bdevice *device = &e3Bdevice[unit]; register mac_stats_eth_t *e3Bmacstats = &device->macstats; unsigned char c; while (!((c = inb(TSR)) & (PTX|ABT|FU))) ; STRLOG(ENETM_ID, 0, 9, SL_TRACE, "e3Bcktsr: status = %x", c); if (c & PTX) { } else if (c & ABT) { e3Bmacstats->mac_xs_coll++; } else if (c & FU) { e3Bmacstats->mac_baddma++; } if (c & COL) { int n = inb(NCR); if (n >= 1 && n <= 16) { n--; e3Bmacstats->mac_colltable[n]++; } } else if ((c & NDT) == 0) e3Bmacstats->mac_frame_def++; if (c & CRS) { e3Bmacstats->mac_carrier++; } if (c & OWC) { e3Bmacstats->mac_oframe_coll++; } if (c & CDH) e3Bmacstats->mac_sqetesterrors++; return(c); } e3Bstrtout(unit) int unit; { register struct e3Bdevice *device = &e3Bdevice[unit]; queue_t *q; int i; int s; unsigned char nxttxbuf; uint len; nxttxbuf = device->curtxbuf; device->txbufstate[nxttxbuf] = TX_FREE; nxttxbuf ^= 1; if (device->txbufstate[nxttxbuf] == TX_LOADED) { outb(TCR, 0); outb(TPSR, device->txbufaddr[nxttxbuf]); len = device->txbuflen[nxttxbuf]; outb(TBCR0, len & 0xff); outb(TBCR1, len >> 8); outb(CR, RD2|TXP|STA); /* transmit */ device->curtxbuf = nxttxbuf; /* restart timeout for the chip bug */ untimeout(device->tid); device->tid = timeout(e3Bwatchdog, unit, TX_TIMEOUT); } else { if (device->flags & E3BBUSY) { untimeout(device->tid); /* call off watchdog */ device->tid = 0; device->flags &= ~E3BBUSY; } } /* we need to qenable only if writer is waiting */ if (device->flags & E3BWAITO) { device->flags &= ~E3BWAITO; e3Bdequeue(WR(device->up_queue)); } } e3Bpktsft(curpkt, nxtpkt, len, device) int curpkt; int nxtpkt; int len; register struct e3Bdevice *device; { curpkt += (len>>8) + 1; if (curpkt >= (int)device->rx_buflim) curpkt -= device->rx_buflim - RX_BUFBASE; if (nxtpkt == curpkt || nxtpkt == NXT_RXBUF(curpkt)) return(0); else return(1); } /* * check if send windows are available, basically avoid putbq's if possible * as they are extremely expensive */ e3Boktoput(unit) { register struct e3Bdevice *device = &e3Bdevice[unit]; register int nxttxbuf; nxttxbuf = device->curtxbuf; if (device->txbufstate[0] && device->txbufstate[1]) { device->flags |= E3BWAITO; /* caller waits */ return(NOT_OK); } return(OK); } /* * e3Bhwput - copy to board and send packet * */ static char e3Bzerobuf[E3COM_MINPACK]; /* preinitialized to zero */ e3Bhwput(unit, m) register unit; mblk_t *m; { register struct e3Bdevice *device = &e3Bdevice[unit]; register mblk_t *mp; mac_stats_eth_t *e3Bmacstats = &(device->macstats); register uint len = 0; register uint tlen; unsigned char nxttxbuf; int oaddr; nxttxbuf = device->curtxbuf; if (device->txbufstate[nxttxbuf] != TX_FREE) { nxttxbuf ^= 1; if (device->txbufstate[nxttxbuf] != TX_FREE) { cmn_err(CE_WARN, "e3Bhwput: No free tx bufs"); freemsg(m); return; } } outb(DAMSB, device->txbufaddr[nxttxbuf]); outb(DALSB, 0); outb(CTRL, (e3Bxcvr[unit] ? 0 : XSEL)|START|DDIR); oaddr = 0; /* fake it, only care about odd/even align */ for (mp=m; mp; mp=mp->b_cont) { len += (tlen = mp->b_wptr - mp->b_rptr); if (len > E3COM_MAXPACK) break; if (tlen) e3Bioout(mp->b_rptr, tlen, RFMSB, STREG, device->type16, oaddr); oaddr += tlen; } freemsg(m); if (len > E3COM_MAXPACK) { /* drop the packet */ return; } else if (len < E3COM_MINPACK) { e3Bioout(e3Bzerobuf, E3COM_MINPACK - len, RFMSB, STREG, device->type16, oaddr); len = E3COM_MINPACK; } STRLOG(ENETM_ID, 0, 9, SL_TRACE, "e3Bhwput, len = %d", len); outb(CTRL, (e3Bxcvr[unit] ? 0 : XSEL)); device->txbufstate[nxttxbuf] = TX_LOADED; device->txbuflen[nxttxbuf] = len; if (nxttxbuf != device->curtxbuf) { return; } device->txbufstate[nxttxbuf] = TX_TXING; device->flags |= E3BBUSY; outb(TCR, 0); outb(TPSR, device->txbufaddr[nxttxbuf]); outb(TBCR0, len & 0xff); outb(TBCR1, len >> 8); device->tid = timeout(e3Bwatchdog, unit, TX_TIMEOUT); /* chip bug */ outb(CR, RD2|TXP|STA); /* transmit */ return; } e3Bhwclose(unit) int unit; { register struct e3Bdevice *device = &e3Bdevice[unit]; int i; STRLOG(ENETM_ID, 0, 9, SL_TRACE, "e3Bhwclose"); /* reset ethernet controller */ outb(CR, RD2|XSTP); outb(CTRL, XSEL|SRST); } static int_to_board(lev) { int i; for (i=0; imccnt-1; i>=0; --i) { if (!e3Bstrncmp(device->mctbl[i], addr, E3COM_ADDR)) return(0); /* FOUND */ } return (1); /* FAIL */ } e3Bmcset(unit,mode) int unit; int mode; { register struct e3Bdevice *device = &e3Bdevice[unit]; int i; unsigned char val; val = (mode == MCOFF) ? 0 : 0xff; outb(CR, PS0|RD2|STA); /* page 1 registers */ for (i = 0; i < 8; i++) outb((MAR0 + i),val); outb(CR, RD2|STA); /* page 0 registers */ } 07070100023876000081a400000000000000030000000135aefc960000073300001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/drv/mdi/e3B/lkcfg: # # @(#) lkcfg 75.1 98/06/26 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1998 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # e3B MDI driver Link Kit configuration script # [ "$#" != "5" ] && { echo "Usage:\n\t$0 <-ird> INIT_DB_RECORD MDI_driver Board_number" exit $FAIL } LLI_ROOT=$MKMOKROOT`llipathmap` . $LLI_ROOT/lib/libcfg.sh PATH=$PATH:$LLI_ROOT/bin option=$1 INITDBR=$2 AOFFILE=$3 drv=$4 bd=$5 SYSTEM_FILE=$MKMOKROOT/etc/conf/sdevice.d/$drv MASTER_FILE=$MKMOKROOT/etc/conf/cf.d/mdevice DRIVER_DIR=$MKMOKROOT/etc/conf/pack.d/$drv # de-configure driver [ "$option" = "-d" ] && { # removes the driver from the system [ -f $SYSTEM_FILE ] && { set_system_info $SYSTEM_FILE $bd "N" 0 0 0 0 0 0 0 awk '{ if ( $2 == "Y" ) exit 1 }' $SYSTEM_FILE && idinstall -d -e $drv } exit $OK } [ -f "$INITDBR" ] || { echo "No INIT DB RECORD, \"$INITBDR\" found" exit $FAIL } cd $LLI_ROOT/ID/$drv for i in System Master Node Driver.o Space.c space.h $drv.h do [ -f "$i" ] || { echo "$drv: File, \"$LLI_ROOT/ID/$drv/$i\" not found" exit $FAIL } done BASE_IO=`stzget $INITDBR BASE_IO SELECT` || { echo "$drv: BASE_IO: SELECT does not exist in stanza file" exit $FAIL } IRQ=`stzget $INITDBR IRQ SELECT` || { echo "$drv: IRQ: SELECT does not exist in stanza file" exit $FAIL } MEDIA="0" X=`stzget $INITDBR MEDIA SELECT` || { echo "$drv: MEDIA: SELECT does not exist in stanza file" exit $FAIL } [ "$X" = "AUI" ] && MEDIA="1" # check to see if the driver is in the link-kit [ -f $SYSTEM_FILE ] || { idinstall -a -e -k $drv idinstall -u -e -k -H $drv } set_system_info $SYSTEM_FILE $bd "Y" 0 0 0 0 0 0 0 set_header_info $drv $bd IRQ $IRQ set_header_info $drv $bd BASE_IO 0x$BASE_IO set_header_info $drv $bd MEDIA $MEDIA exit $OK 0707010002387a000081a400000000000000030000000135aefc960000026c00001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/e3B/space.h/* * @(#) space.h 7.1 94/11/27 SCOINC * * Copyright (C) The Santa Cruz Operation, 1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* interrupt number */ #define E3B_0_IRQ 0x0 #define E3B_1_IRQ 0x0 #define E3B_2_IRQ 0x0 #define E3B_3_IRQ 0x0 /* Base I/O address */ #define E3B_0_BASE_IO 0x0 #define E3B_1_BASE_IO 0x0 #define E3B_2_BASE_IO 0x0 #define E3B_3_BASE_IO 0x0 /* transceiver type - 0 is BNC/TP, 1 is AUI */ #define E3B_0_MEDIA 0x0 #define E3B_1_MEDIA 0x0 #define E3B_2_MEDIA 0x0 #define E3B_3_MEDIA 0x0 07070100023883000081a40000000000000003000000013757467e000003a100001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/e3D/AOF/e3D# # # @(#) e3D 55.1 96/06/12 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. BASE_IO: SIZE=f VALUES=200-260:10, 280-2e0:10, 300-360:10, 380-3a0:10, 3e0 DEFAULTS=300, 310, 330, 350 TYPE=link-kit, swconfig RAM: VALUES=c0000-d0000:8000(16|32|48|64), d8000(16|32), f00000-f80000:20000(64) TYPE=swconfig IRQ: VALUES=3, 5, 7, 9, 10, 11, 12, 15 DEFAULTS=3, 9, 5, 7 TYPE=swconfig TRANSCEIVER: VALUES=BNC/TP, AUI TYPE=swconfig ZERO_WAIT_STATE: PROMPT="Zero Wait State" VALUES=disabled, enabled TYPE=swconfig DATA_MODE: PROMPT="Data Mode" VALUES=turbo, standard TYPE=swconfig ADAPTER: DESCRIPTION="!AHDK! 3Com 3C507 EtherLink 16 Series" BUS=ISA MEDIA_TYPE=ethernet MAX_BD=3 KEY=BASE_IO REQUIRED=IRQ, RAM, TRANSCEIVER ADVANCED=ZERO_WAIT_STATE, DATA_MODE NET_BOOT=dynamic 07070100023888000081a400000000000000030000000135aefc970000022d00001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/drv/mdi/e3D/Makefile# # @(#) Makefile 5.1 94/06/10 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1994 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. #DEBUG = -DDEBUG CFLAGS=-O -DAT386 -I../../.. -D_INKERNEL $(DEBUG) $(CPPFLAGS) OBJ=e3Dli.o e3Dmac.o all: Driver.o acfg.e3D acfg.e3D: cd acfg; $(MAKE) $(OBJ): e3D.h ../../../sys/mdi.h Driver.o: $(OBJ) /lib/coff/ld -r -o Driver.o $(OBJ) clean: rm -f $(OBJ) cd acfg; make clean clobber: rm -f $(OBJ) Driver.o cd acfg; make clobber 07070100023889000081a400000000000000030000000135aefc9800000aaf00001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/e3D/Space.c#ident "@(#) Space.c 7.1 94/11/27 SCOINC" /* * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * System V STREAMS TCP - Release 2.0 * * Copyright 1987, 1988 Lachman Associates, Incorporated (LAI) * * All Rights Reserved. * * The copyright above and this notice must be preserved in all * copies of this source code. The copyright above does not * evidence any actual or intended publication of this source * code. * * System V STREAMS TCP was jointly developed by Lachman * Associates and Convergent Technologies. */ /* * (C) Copyright 1991 SCO Canada, Inc. * All Rights Reserved. * * The copyright above and this notice must be preserved in all * copies of this source code. The copyright above does not * evidence any actual or intended publication of this source * code. * * This is unpublished proprietary trade secret source code of * SCO Canada, Inc. This source code may not be copied, * disclosed, distributed, demonstrated or licensed except as * expressly authorized by SCO Canada, Inc. */ #include "sys/types.h" #include "sys/stream.h" #include "sys/mdi.h" #include "e3D.h" #include "config.h" #include "space.h" /* * Global: e3Diobase * * Purpose: * Table of io base addresses. */ u_int e3Diobase[E3D_CNTLS] = { #ifdef E3D_0 E3D_0_BASE_IO, #endif #ifdef E3D_1 E3D_1_BASE_IO, #endif #ifdef E3D_2 E3D_2_BASE_IO, #endif #ifdef E3D_3 E3D_3_BASE_IO, #endif }; /* * Global: e3Deth_addr * * Purpose: * To override the ethernet address stored on the PROM. * An address below will override the PROM address if its * first element is non-zero. */ macaddr_t e3Deth_addr[E3D_CNTLS] = { #ifdef E3D_0 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, #endif #ifdef E3D_1 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, #endif #ifdef E3D_2 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, #endif #ifdef E3D_3 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, #endif }; u_int e3D_nunit = E3D_CNTLS; e3Ddev_t e3Ddevice[E3D_CNTLS]; extern int e3Dopen(), e3Dclose(), e3Duwput(); extern int nulldev(); struct module_info e3D_minfo = { 0, "e3D", 1, E3D_ETH_MAXPACK, 16 * E3D_ETH_MAXPACK, 12 * E3D_ETH_MAXPACK }; struct qinit e3Durinit = { 0, 0, e3Dopen, e3Dclose, nulldev, &e3D_minfo, 0 }; struct qinit e3Duwinit = { e3Duwput, nulldev, e3Dopen, e3Dclose, nulldev, &e3D_minfo, 0 }; struct streamtab e3Dinfo = { &e3Durinit, &e3Duwinit, 0, 0 }; unsigned int e3Ddelaycount = 0x400; /* initial delay count for wait loops */ /* Debug control */ unsigned long e3Ddbgcntrl = 0x0; unsigned long e3Ddbgstop = 0; /* stop after each line */ 07070100023881000081a400000000000000030000000135aefc98000001d600001dff0000000100000000000000000000003100000000root/usr/src/O5hdk/net/drv/mdi/e3D/acfg/Makefile# # @(#) Makefile 8.1 95/01/18 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. ROOT=../../../.. include $(ROOT)/Make.inc CFLAGS=-O -belf LIBS=$(SYSADMLIBS) OBJ= acfg.o \ boardio.o \ io.o acfg: $(OBJ) $(CC) $(OBJ) -s -o acfg $(LIBS) $(OBJ): e507setup.h io.o: io.s cc -c io.s clobber: clean rm -f acfg clean: rm -f $(OBJ) 0707010002387d000081a400000000000000030000000135aefc980000357e00001dff0000000100000000000000000000002f00000000root/usr/src/O5hdk/net/drv/mdi/e3D/acfg/acfg.c#pragma comment(exestr, "@(#) acfg.c 6.1 94/08/19 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include #include #include #include #include #include #include "e507setup.h" #include #include #include #include #include #include #include #include #include #include #include #include errStatus_cl * errStack; const char * progname; struct e3dset e3dset[MAXBRDS]; unsigned short e3dnboards = 0; unsigned short e3daddrs[] = { 0x200, 0x210, 0x220, 0x230, 0x240, 0x250, 0x260, 0x280, 0x290, 0x2a0, 0x2b0, 0x2c0, 0x2d0, 0x2e0, 0x300, 0x310, 0x320, 0x330, 0x340, 0x350, 0x360, 0x380, 0x390, 0x3a0, 0x3e0 }; /* * disp_boards(): Display the of board(s) configurations. * * Args: changes - set when displaying a re-configured board. */ void disp_boards() { register struct e3dset *dv; int i; printf("EtherLink 16 Adapter Configuration\n\n"); if (e3dnboards > 1) { printf("Board Number: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { printf("%d", dv->ex_index); if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } printf("\n\n"); } printf("Ethernet Address: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { for (i = 0; i < EADDRSIZE; i++) printf("%02x", dv->ex_eaddr[i]); if (dv != &e3dset[e3dnboards - 1]) printf("\t"); } printf("\nRevision Level: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { for (i = 0; i < PARTNO_REV; i++) printf("%02x", dv->ex_partno[i]); printf("-"); printf("%02x", dv->ex_partno[i++]); /* rev */ if (dv != &e3dset[e3dnboards - 1]) printf("\t"); } printf("\n"); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { if (dv->ex_partno[5] != 0xff) { printf("Manufacture Date: "); } for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { printf("%02d-", dv->ex_partno[5] >> 4); printf("%02d-", dv->ex_partno[4]); printf("%02d", (dv->ex_partno[5] & 0x0f) + 90); if (dv != &e3dset[e3dnboards - 1]) printf("\t"); } printf("\n"); } printf("\nI/O Base Address: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { printf("%x", dv->ex_ioaddr); if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } printf("\n"); printf("Interrupt Level: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { printf("%d", dv->ex_int); if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } printf("\n"); printf("Transceiver Type: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { if (dv->ex_bnc) printf("OTHER"); else printf("AUI"); if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } printf("\n"); printf("RAM Base Address: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { printf("%06x", dv->ex_rambase); if (dv == e3dset) printf("\t"); else if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } printf("\n"); printf("RAM Size: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { printf("%02d K", (dv->ex_memsize/1024)); if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } printf("\n"); printf("ROM Base Address: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { printf("%06x", dv->ex_rombase); if (dv == e3dset) printf("\t"); else if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } printf("\n"); printf("ROM Size: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { printf("%02d K", (dv->ex_romsize/1024)); if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } printf("\n"); printf("Zero Wait State: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { if (dv->ex_zerows) { printf("Enabled"); if (dv == e3dset) printf("\t"); else if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } else { printf("Disabled"); if (dv != &e3dset[e3dnboards - 1]) printf("\t"); } } printf("\n"); printf("Data Mode: "); for (dv = e3dset; dv < &e3dset[e3dnboards]; dv++) { if (dv->ex_sad) { printf("Standard"); if (dv != &e3dset[e3dnboards - 1]) printf("\t"); } else { printf("Turbo"); if (dv != &e3dset[e3dnboards - 1]) printf("\t\t"); } } printf("\n"); } void usage() { fprintf(stderr, "usage: %s -d \n", progname); fprintf(stderr, " %s -f -k \n", progname); exit(2); } int validdir(char * dir) { struct stat stbuf; if (stat(dir, &stbuf) == -1) { fprintf(stderr,"%s: directory '%s' not found\n", progname, dir); return (FALSE); } if (!S_ISDIR(stbuf.st_mode)) { fprintf(stderr,"%s: '%s' not a directory\n", progname, dir); return (FALSE); } return (TRUE); } int validfile(char * file) { struct stat stbuf; if (stat(file, &stbuf) == -1) { fprintf(stderr, "%s: file '%s' not found\n", progname, file); return (FALSE); } if (!S_ISREG(stbuf.st_mode)) { fprintf(stderr, "%s: '%s' not a file\n", progname, file); return (FALSE); } } /* * Function: write_board_list * * Purpose: * Write out the set of configurable parameters for each board. * Output is placed in separate files, one per board, in the provided * directory. The filename used is a non-negative number corresponding * to the board index plus "first_file" offset. This offset is found * by searching "dir" for the sequence of files 0, 1, 2, ..., 9999 until * a match is *not* found eg. if dir contains files "0" and "1", the file * corresponding to board index 0 is "2". * * It is impossible to configure more than one e3D at one time. * If more than one board is detected, we write out that the parameters * are not software configurable, that is, we set "TYPE=" for each * parameter, and make all parameters non-REQUIRED and non-ADVANCED. */ void write_board_list(char * dir) { unsigned short board; char * descr; struct e3dset * dv; int first_file; char * ioaddr_typestr; char * isa_sect; FILE * output_file; static char path[280]; struct stat stbuf; char * typestr; for (first_file = 0; first_file < 10000; first_file++) { sprintf(path, "%s/%d", dir, first_file); if (stat(path, &stbuf) == -1) break; } if (e3dnboards > 1) { /* make all parameters read-only */ descr = "\tDESCRIPTION=\"3Com EtherLink 16/16TP (READ ONLY CONFIG)\"\n"; typestr = "\tTYPE=\n"; ioaddr_typestr = "\tTYPE=unique, link-kit\n"; isa_sect = "\tREQUIRED=\n\tADVANCED=\n"; } else isa_sect = descr = typestr = ioaddr_typestr = ""; for (board = 0, dv = e3dset; board < e3dnboards; board++, dv++) { sprintf(path, "%s/%d", dir, first_file + board); if ((output_file = fopen(path, "w")) == NULL) { perror("e3D-acfg: unable to create AOF update file"); exit(1); } fprintf(output_file, "BASE_IO:\n"); fprintf(output_file, "\tSELECT=%x\n%s", dv->ex_ioaddr, ioaddr_typestr); fprintf(output_file, "IRQ:\n"); fprintf(output_file, "\tSELECT=%d\n%s", dv->ex_int, typestr); fprintf(output_file, "RAM:\n"); fprintf(output_file, "\tSELECT=%x(%d)\n%s", dv->ex_rambase, dv->ex_memsize / 1024, typestr); fprintf(output_file, "TRANSCEIVER:\n"); fprintf(output_file, "\tSELECT=%s\n%s", dv->ex_bnc ? "BNC/TP" : "AUI", typestr); fprintf(output_file, "ZERO_WAIT_STATE:\n"); fprintf(output_file, "\tSELECT=%s\n%s", dv->ex_zerows ? "enabled" : "disabled", typestr); fprintf(output_file, "DATA_MODE:\n"); fprintf(output_file, "\tSELECT=%s\n%s", dv->ex_sad ? "standard" : "turbo", typestr); fprintf(output_file, "ADAPTER:\n\tAOF=e3D\n%s%s", descr, isa_sect); fclose(output_file); } } int get_hex_val(stanza_cl * sfp, char * section) { int ret_value; const char * *values; StanzaGetVals(sfp, section, "SELECT", &values, errStack); if (ErrorIsOk(errStack) == FALSE) { ErrorClear(errStack); return (-1); } if (values == NULL || *values == '\0') return (-1); sscanf(*values, "%x", &ret_value); return (ret_value); } int get_dec_val(stanza_cl * sfp, char * section) { int ret_value; const char * *values; StanzaGetVals(sfp, section, "SELECT", &values, errStack); if (ErrorIsOk(errStack) == FALSE) { ErrorClear(errStack); return (-1); } if (values == NULL || *values == '\0') return (-1); sscanf(*values, "%d", &ret_value); return (ret_value); } const char * get_string_val(stanza_cl * sfp, char * section) { const char * *values; StanzaGetVals(sfp, section, "SELECT", &values, errStack); if (ErrorIsOk(errStack) == FALSE) { ErrorClear(errStack); return (NULL); } if (values == NULL || *values == '\0') return (NULL); return (*values); } int parse_input(char * filename, struct e3dset * cfg) { int ioaddr; const char * data_mode; int i; int irq; const char * ram_base_size; stanza_cl * sfp; const char * transceiver; const char * zerows; errStack = ErrorNew(); sfp = StanzaHandle(); StanzaOpen(sfp, filename, STZ_RDONLY, errStack); if (ErrorIsOk(errStack) == FALSE) { logstack(); return (FALSE); } if ((irq = get_dec_val(sfp, "IRQ")) != -1) cfg->ex_int = irq; if ((ioaddr = get_hex_val(sfp, "BASE_IO")) != -1) cfg->ex_ioaddr = ioaddr; if ((ram_base_size = get_string_val(sfp, "RAM")) != NULL) { /* parse out the ram base address and size */ sscanf(ram_base_size, "%x(%d)", &cfg->ex_rambase, &cfg->ex_memsize); cfg->ex_memsize *= 1024; } if ((transceiver = get_string_val(sfp, "TRANSCEIVER")) != NULL) cfg->ex_bnc = (strcmp(transceiver, "BNC/TP") == 0) ? TRUE : FALSE; if ((data_mode = get_string_val(sfp, "DATA_MODE")) != NULL) cfg->ex_sad = (strcmp(data_mode, "standard") == 0) ? TRUE : FALSE; if ((zerows = get_string_val(sfp, "ZERO_WAIT_STATE")) != NULL) cfg->ex_zerows = (strcmp(zerows, "enabled") == 0) ? TRUE : FALSE; /* we don't support booting off cards, so disable boot ROM */ cfg->ex_romsize = 0; cfg->ex_rombase = 0xc6000; StanzaClose(sfp, errStack); if (ErrorIsOk(errStack) == FALSE) { logstack(); return (FALSE); } return (TRUE); } void print_config(struct e3dset * cfg) { printf("Base:\t\t\t0x%x\n", cfg->ex_ioaddr); printf("Irq:\t\t\t%d\n", cfg->ex_int); printf("Ram Base:\t\t0x%x\n", cfg->ex_rambase); printf("Ram Size:\t\t%d\n", cfg->ex_memsize); printf("Rom Base:\t\t0x%x\n", cfg->ex_rombase); printf("Rom Size:\t\t%d\n", cfg->ex_romsize); printf("Transceiver:\t\t%s\n", cfg->ex_bnc ? "BNC/TP" : "AUi"); printf("Zero Wait State:\t%s\n", cfg->ex_zerows ? "enabled" : "disabled"); printf("Data Mode:\t\t%s\n", cfg->ex_sad ? "standard" : "turbo"); } /* * Function: set_board * * Purpose: * Parses the given file, setting the new config parameters, * then write the new information to the card. * Note: * e3dset[0] contains the current settings, * e3dset[1] contains the new settings */ void set_board(char * filename) { /* get copy of the current settings */ e3dset[1] = e3dset[0]; /* update with new information */ if (parse_input(filename, &e3dset[1]) == FALSE) { fprintf(stderr, "%s: error parsing file '%s'\n", progname, filename); exit(1); } /* initialize the delay times for talking to the card */ initcps(); /* configure the card */ if (configure() != TRUE) { fprintf(stderr, "%s: failed to write configuration to board\n", progname); exit (1); } } logstack() { ErrorOutput(errStack, stderr, 0, "e3D-acfg: "); } main(argc, argv) char **argv; { int c; int D_flag = 0; int d_flag = 0; char * directory; int f_flag = 0; int k_flag = 0; int old_base_addr; extern char * optarg; extern int optind; char * stanza_file; if (geteuid() != 0) { printf("You must be superuser to run this program!\n"); exit(1); } progname = argv[0]; while (EOF != (c = getopt(argc, argv, "Dd:f:k:"))) { switch(c) { case 'D': D_flag = 1; break; case 'd': d_flag = 1; directory = optarg; break; case 'f': f_flag = 1; stanza_file = optarg; break; case 'k': k_flag = 1; sscanf(optarg, "%x", &old_base_addr); break; case '?': default: usage(); break; } } if (d_flag) { if (k_flag || f_flag) usage(); if (validdir(directory) == FALSE) exit(1); } else { if (!(k_flag && f_flag)) usage(); if (validfile(stanza_file) == FALSE) exit(1); } /* Call the routine that enables I/O operation */ if (sysi86(SI86V86, V86SC_IOPL, 0x3000) < 0) { perror("Cannot enable direct I/O!"); exit(1); } /* fill table of boards */ brdsrch(); if (e3dnboards == 0) { /* printf("No boards present\n"); */ exit(0); } /* if DEBUG set, display the board settings */ if (D_flag) disp_boards(); if (d_flag) { /* search mode */ write_board_list(directory); } else { /* set mode */ if (e3dnboards > 1) { fprintf(stderr, "%s : more than one card detected\n", progname); fprintf(stderr, " remove all but one card and try again\n"); exit(1); } if (e3dset[0].ex_ioaddr != old_base_addr) { fprintf(stderr, "%s : no board present at address 0x%x\n", progname, old_base_addr); exit(1); } set_board(stanza_file); } exit(0); } 0707010002387e000081a400000000000000030000000135aefc9800002b3300001dff0000000100000000000000000000003200000000root/usr/src/O5hdk/net/drv/mdi/e3D/acfg/boardio.c#pragma comment(exestr, "@(#) boardio.c 5.1 94/06/10 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include #include "e507setup.h" #include #include #include #include u_long cps; static char e3dsig[] = "*3COM*"; /* RAM configuration widow base and window size settings. */ struct e3draminfo { u_short ram_setting; /* ram configuration register bits */ u_long ram_base; /* raw widow base */ u_long ram_size; /* ram window size */ }; struct e3draminfo e3draminfo[] = { { HRAM_0C0_16KB, 0x0C0000, 16*1024, }, { HRAM_0C0_32KB, 0x0C0000, 32*1024, }, { HRAM_0C0_48KB, 0x0C0000, 48*1024, }, { HRAM_0C0_64KB, 0x0C0000, 64*1024, }, { HRAM_0C8_16KB, 0x0C8000, 16*1024, }, { HRAM_0C8_32KB, 0x0C8000, 32*1024, }, { HRAM_0C8_48KB, 0x0C8000, 48*1024, }, { HRAM_0C8_64KB, 0x0C8000, 64*1024, }, { HRAM_0D0_16KB, 0x0D0000, 16*1024, }, { HRAM_0D0_32KB, 0x0D0000, 32*1024, }, { HRAM_0D0_48KB, 0x0D0000, 48*1024, }, { HRAM_0D0_64KB, 0x0D0000, 64*1024, }, { HRAM_0D8_16KB, 0x0D8000, 16*1024, }, { HRAM_0D8_32KB, 0x0D8000, 32*1024, }, { HRAM_F00_64KB, 0xF00000, 64*1024, }, { HRAM_F20_64KB, 0xF20000, 64*1024, }, { HRAM_F40_64KB, 0xF40000, 64*1024, }, { HRAM_F60_64KB, 0xF60000, 64*1024, }, { HRAM_F80_64KB, 0xF80000, 64*1024, }, { 0, 0, 0, } }; struct e3drominfo { u_short rom_setting; /* rom configuration register bits */ u_long rom_size; /* rom window size */ }; static struct e3drominfo e3drominfo[] = { { HROM_NONE, 0, }, { HROM_08KB, 8*1024, }, { HROM_16KB, 16*1024, }, { HROM_32KB, 32*1024, }, }; #define ROMINFO_CNT (sizeof(e3drominfo)/sizeof(struct e3drominfo)) /* * e3dchangestate(): Put all 3c507 adapters in indicated state (run or ioload). * * There is no way to reset an individual E3D 507 adapter. * The RST bit in the Interrupt Configuraton Register only * restarts the board configuration logic. After that you * have to write to the ID port and all installed adapters * react to writes to the ID port. The only thing that can * be done is to bring all adapters to the CONFIG state * or to the RUN state. */ e3dchangestate(ioload) { unsigned short al, cx; outb(ED_ID_PORT, 0); for (al = 0xff, cx = 0; cx < 255; cx++) { outb(ED_ID_PORT, al & 0xff); al <<= 1; if (al & 0x100) al ^= 0xe7; } if (ioload) for (al = 0xff, cx = 0; cx < 255; cx++) { outb(ED_ID_PORT, al & 0xff); al <<= 1; if (al & 0x100) al ^= 0xe7; } else /* run state */ outb(ED_ID_PORT, 0); } /* * get_config(): initialize e3dset struct. */ get_config(dv) struct e3dset *dv; { register struct e3draminfo *ramp; register struct e3drominfo *romp; register int i; u_short ram_setting; u_short rom_size; /* Get interrupt level */ dv->ex_int = GET_INTLEVEL(dv); /* Get RAM settings */ ram_setting = GET_RAMCONF(dv); for (ramp = e3draminfo; ramp->ram_base; ramp++) { if (ram_setting == ramp->ram_setting) { dv->ex_rambase = ramp->ram_base; dv->ex_memsize = ramp->ram_size; } } dv->ex_sad = (inb(ED_RAM_CONF(dv)) & HRAM_SAD); /* Get ROM settings */ rom_size = GET_ROMSIZE(dv); dv->ex_rombase = GET_ROMADDR(dv); for (romp = e3drominfo; romp < &e3drominfo[ROMINFO_CNT]; romp++) { if (rom_size == romp->rom_setting) { dv->ex_romsize = romp->rom_size; } } dv->ex_bnc = dv->ex_romr2 & HROM_BNC; /* Get Zero Wait State */ dv->ex_zerows = GET_0WS(dv); /* Get the board's ethernet address. */ SELECT_EADDR(dv); for (i = 0; i < EADDRSIZE; i++) dv->ex_eaddr[i] = inb(ED_NM_DATA(dv)+i); /* Get the board's part number. */ SELECT_PARTNO(dv); for (i = 0; i < EADDRSIZE; i++) dv->ex_partno[i] = inb(ED_NM_DATA(dv)+i); return(OK); } /* * brdsrch(): search for 3c507 boards * * Initializes: e3dnboards, e3dset[] (partially). * Returns: e3dnboards */ int brdsrch() { int i = 0, j; register struct e3dset *dv = &e3dset[i]; disable(); e3dchangestate(RUN); /* puts all 3c507 adapters in RUN state */ enable(); /* * Look for 3COM signatures. */ for (i = 0; i < NIOADDRS && e3dnboards < MAXBRDS; i++) { dv->ex_ioaddr = e3daddrs[i]; for (j = 0; j < HNM_SIZE; j++) { if ((inb(ED_NM_DATA(dv) + j) & 0xff) != e3dsig[j]) break; } if (j == HNM_SIZE) { /* found signature */ dv->ex_index = e3dnboards++; /* Initialize copies of board registers. */ dv->ex_creg2 = ((unsigned char) inb(ED_CNTRL(dv))) | HCTL_RST; dv->ex_romr2 = (u_char) inb(ED_ROM_CONF(dv)); dv->ex_ramr2 = (u_char) inb(ED_RAM_CONF(dv)); dv->ex_intr2 = (u_char) inb(ED_INT_CONF(dv)); get_config(dv++); } } return(e3dnboards); } /* * initcps(): initialize cps variable. * Increases cps by a factor of 1.5 so oneusdelay(X) should * actually delay for (1.5 * X) microseconds. */ u_long initcps() { struct timeb tb1; struct timeb tb2; long count; long try; long msdiff; long time(); long l; l = 0; try = 10000L; msdiff = 0; while (msdiff < 1000) { try *= 2; ftime(&tb1); for (count = 0; count < try; count++); ftime(&tb2); if (tb1.millitm == 0 || tb2.millitm == 0) { try /= 2; continue; } msdiff = tb2.time - tb1.time; if (msdiff == 0) msdiff += tb2.millitm - tb1.millitm; else msdiff += (tb2.millitm + (msdiff*1000)) - tb1.millitm; } cps = (try * 1500.0) / msdiff; /* should cause oneusdelay(1) 1.5 us */ return(cps); } /* * delay in one microsecond increments */ oneusdelay(ms) long ms; { long try; long count; try = ((float)cps * ms) / 1000000L; if (try < 1) try = 1; for (count = 0; count < try; count++); } /* * start_eeprom_cmd(): Set up EEPROM for a command. */ start_eeprom_cmd(dp, cmd) struct e3dset *dp; { register int i; dp->ex_intr2 &= 0x0f; /* ECS=0, ESK=0, EDI=0, RST=0 */ /* clear chip select and do one clock cycle */ SET_ECS_EEPROM(dp) /* ECS=1 */ oneusdelay(2); /* instruction start bits 01 */ SET_ESK_EEPROM(dp) /* start bit 0 clocked in */ oneusdelay(2); CLR_ESK_EEPROM(dp) oneusdelay(2); SET_EDI(dp) SET_ESK_EEPROM(dp) /* start bit 1 clocked in */ oneusdelay(2); /* output command opcode */ for (i = (NEEPROM_CMD - 1); i >= 0; i--) { CLR_ESK_EEPROM(dp) if ((cmd >> i) & 1) SET_EDI(dp) else CLR_EDI(dp); oneusdelay(2); SET_ESK_EEPROM(dp) oneusdelay(2); } } /* * data_eeprom(): Writes 2 bytes of data to the EEPROM. */ data_eeprom(dp, data) struct e3dset *dp; { register int i; /* output data */ for (i = (NEEPROM_DATA_BITS - 1); i >= 0; i--) { CLR_ESK_EEPROM(dp) if ((data >> i) & 1) SET_EDI(dp) else CLR_EDI(dp); oneusdelay(2); SET_ESK_EEPROM(dp) oneusdelay(2); } } /* * end_eeeprom_cmd(): complete EEPROM command. */ end_eeprom_cmd(dp) struct e3dset *dp; { CLR_ECS_EEPROM(dp) /* clear chip select */ SET_EDI(dp) SET_ESK_EEPROM(dp) /* wait for one ESK clock cycle */ oneusdelay(2); CLR_ESK_EEPROM(dp) oneusdelay(2); } /* * read_eeprom(): reads data from the EEPROM. */ u_short read_eeprom(dp, addr) struct e3dset *dp; { register int i; register u_short eeword = 0; if (addr) start_eeprom_cmd(dp, EEPROM_READ1); else start_eeprom_cmd(dp, EEPROM_READ0); /* first data bit is always 0 - toss it */ CLR_ESK_EEPROM(dp) oneusdelay(2); SET_ESK_EEPROM(dp) oneusdelay(2); /* read 16 bits */ for (i = 15; i >= 0; i--) { eeword |= (GET_EDO(dp) << i); CLR_ESK_EEPROM(dp) oneusdelay(2); SET_ESK_EEPROM(dp) oneusdelay(2); } end_eeprom_cmd(dp); return(eeword); } /* * write_eeprom(): Writes 2 bytes of data to the EEPROM. */ write_eeprom(dp, eeprom) struct e3dset *dp; u_long eeprom; { register int i; register u_short eeprom_word; u_long new_eeprom; start_eeprom_cmd(dp, EEPROM_EWEN); /* enable erase/write */ data_eeprom(dp, 0); end_eeprom_cmd(dp); start_eeprom_cmd(dp, EEPROM_ERASE0); /* erase register 0 */ data_eeprom(dp, 0); end_eeprom_cmd(dp); oneusdelay(10000); /* Te/w is 10-30 ms */ /* write data word register 0 */ eeprom_word = (u_short) eeprom & WORD_MASK; start_eeprom_cmd(dp, EEPROM_WRITE0); data_eeprom(dp, eeprom_word); end_eeprom_cmd(dp); oneusdelay(10000); /* Te/w is 10-30 ms */ start_eeprom_cmd(dp, EEPROM_ERASE1); /* erase register 1 */ data_eeprom(dp, 0); end_eeprom_cmd(dp); oneusdelay(10000); /* Te/w is 10-30 ms */ /* write data word register 1 */ eeprom_word = (u_short) (eeprom >> 16) & WORD_MASK; start_eeprom_cmd(dp, EEPROM_WRITE1); data_eeprom(dp, eeprom_word); end_eeprom_cmd(dp); oneusdelay(10000); /* Te/w is 10-30 ms */ start_eeprom_cmd(dp, EEPROM_EWDS); /* disable erase/write */ data_eeprom(dp, 0); end_eeprom_cmd(dp); /* RESET EEPROM state machine logic by writing to offset 0x0c */ dp->ex_intr2 &= 0x1f; /* ECS=0, ESK=0, EDI=0, RST=0 */ SET_INTREG(dp, dp->ex_intr2); oneusdelay(20000); /* Takes 20ms to read out config registers */ new_eeprom = read_eeprom(dp, 0); new_eeprom |= (u_long)(read_eeprom(dp, 1) << 16); #ifdef DEBUG printf("DEBUG: write_eeprom(%x) new_eeprom:%x\n", eeprom, new_eeprom); #endif e3dchangestate(RUN); /* run state */ if (eeprom != new_eeprom) return(NOT_OK); return(OK); } /* * soft_config: Re-configure the boards PCR, RCR, and ICR registers. * * Returns: data to be written into EEPROM. */ u_long soft_config(dp) struct e3dset *dp; { register struct e3drominfo *pp; register struct e3draminfo *rp; u_long eeprom; u_char pcr; /* ROM config reg */ u_char rcr; /* RAM config reg */ u_char icr; /* IRQ config reg */ u_char iobase; /* I/O base, IO4..IO0 */ /* ROM settings */ CONFIG_ROMADDR(dp, pcr); if (dp->ex_bnc) pcr |= HROM_BNC; for (pp = e3drominfo; pp < &e3drominfo[ROMINFO_CNT]; pp++) { if (pp->rom_size == dp->ex_romsize) { pcr |= pp->rom_setting; break; } } SET_ROMREG(dp, pcr); /* RAM settings */ for (rp = e3draminfo; rp->ram_base; rp++) { if ((dp->ex_rambase == rp->ram_base) && (dp->ex_memsize == rp->ram_size)) { rcr = rp->ram_setting; break; } } if (dp->ex_zerows) rcr |= HRAM_0WS; if (dp->ex_sad) { rcr |= HRAM_SAD; } SET_RAMREG(dp, rcr); /* Interrupt setting */ SET_INTREG(dp, dp->ex_int); dp->ex_intr2 = dp->ex_int; /* I/O base address setting - already set on board in IOLOAD state */ CONFIG_IOADDR(dp, iobase); eeprom = pcr << 24; eeprom |= rcr << 16; eeprom |= dp->ex_int << 8; eeprom |= iobase; return(eeprom); } /* * configure: Re-configure the board. * Assumes e3dset[1] has the new configuration. * * The adapter is placed in the IOLOAD state; writing the (new) I/O address * to the ID port puts the adapter into the CONFIG state; then other parameters * can be written. */ int configure() { register struct e3dset *dp = &e3dset[1]; register int i; u_long eeprom = 0; e3dchangestate(IOLOAD); /* ioload state */ LOAD_IOADDR(dp->ex_ioaddr); /* config state */ eeprom = soft_config(dp); if (!write_eeprom(dp, eeprom)) return (FALSE); return (TRUE); } 0707010002387f000081a400000000000000030000000135aefc980000258300001dff0000000100000000000000000000003400000000root/usr/src/O5hdk/net/drv/mdi/e3D/acfg/e507setup.h#pragma comment(exestr, "@(#) e507setup.h 5.1 94/06/10 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * System V STREAMS TCP - Release 3.0 * * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) * All Rights Reserved. * * The copyright above and this notice must be preserved in all copies of this * source code. The copyright above does not evidence any actual or intended * publication of this source code. * * System V STREAMS TCP was jointly developed by Lachman Associates and * Convergent Technologies. */ /* * (C) Copyright 1991 SCO Canada, Inc. * All Rights Reserved. * * The copyright above and this notice must be preserved in all * copies of this source code. The copyright above does not * evidence any actual or intended publication of this source * code. * * This is unpublished proprietary trade secret source code of * SCO Canada, Inc. This source code may not be copied, * disclosed, distributed, demonstrated or licensed except as * expressly authorized by SCO Canada, Inc. * * Copyright (C) The Santa Cruz Operation, 1991-1994 * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated as Confidential. * */ extern unsigned long e507dbg; #define EADDRSIZE 6 /* # bytes in ethernet address */ typedef unsigned char e_addr[EADDRSIZE]; /* * Definitions related to 82586 network controller */ struct e3dset { u_short ex_index; /* board index */ u_long ex_ioaddr; /* I/O ports for device */ u_short ex_int; /* interrupt vector number */ u_short ex_bnc; /* 0 = AUI, 0x80 = BNC */ u_long ex_rambase; /* phys address of board memory */ u_long ex_memsize; /* size of board memory */ u_long ex_rombase; /* phys address of ROM */ u_long ex_romsize; /* size of ROM */ u_short ex_zerows; /* Zero Wait State */ u_short ex_sad; /* SA Address Decode */ u_short ex_creg2; /* copy of board control register */ u_short ex_ramr2; /* copy of ram configuration register */ u_short ex_romr2; /* copy of rom configuration register */ u_short ex_intr2; /* copy of interrupt config register */ e_addr ex_eaddr; /* current ethernet addr */ u_char ex_partno[6]; /* part number (in BCD) */ }; /* * These defines describe the control ports on the 3com 507 * The base address for these registers is obtained from from * the e3dset structures, thus there must be an initialized * pointer to the e3dset structure for this board in scope * when the define is used. */ #define ED_ID_PORT 0x100 #define ED_NM_DATA(d) (((d)->ex_ioaddr)+0) #define ED_CNTRL(d) (((d)->ex_ioaddr)+6) #define ED_INTR_CLR(d) (((d)->ex_ioaddr)+0xA) #define ED_CHAN_ATTN(d) (((d)->ex_ioaddr)+0xB) #define ED_ROM_CONF(d) (((d)->ex_ioaddr)+0xD) #define ED_RAM_CONF(d) (((d)->ex_ioaddr)+0xE) #define ED_INT_CONF(d) (((d)->ex_ioaddr)+0xF) #define ED_IO_SIZE 16 /* * Network management data banks */ #define HNM_SIZE 6 /* # bytes of data */ /* * The bits in the ED_CNTRL register */ #define HCTL_VB 0x03 /* network management data bank */ #define HCTL_IEN 0x04 /* interrupt enable */ #define HCTL_INT 0x08 /* interrupt active */ #define HCTL_LAD 0x10 /* adapter as 8 or 16 bit device */ #define HCTL_LBK 0x20 /* loopback enable */ #define HCTL_RST 0x80 /* 82586 reset */ /* * The network management data bank settings (use HCTL_VB as a mask) */ #define HCTL_SIGNAT 0x00 /* 3Com signature = "*3COM*" */ #define HCTL_EADDR 0x01 /* ethernet address */ #define HCTL_PARTNO 0x02 /* adapter part numb and rev level */ /* * The bits in the ED_ROM_CONF register */ #define HROM_SIZE 0x03 /* ROM window size */ #define HROM_ADDR 0x3C /* ROM window base address */ #define HROM_CONF 0x3F /* ROM configuration bits */ #define HROM_BNC 0x80 /* enable on-board transceiver */ /* * The ROM window size settings (use HROM_SIZE as a mask) */ #define HROM_NONE 0x00 /* no boot ROM present */ #define HROM_08KB 0x01 /* 08 KB */ #define HROM_16KB 0x02 /* 16 KB */ #define HROM_32KB 0x03 /* 32 KB */ /* * The bits in the ED_RAM_CONF register */ #define HRAM_CONF 0x3F /* RAM configuration bits */ #define HRAM_SAD 0x40 /* disable SAD mode */ #define HRAM_0WS 0x80 /* enable zero wait state */ /* * The RAM window base and size settings (use HRAM_CONF as a mask) */ #define HRAM_0C0_16KB 0x00 /* 0x0C0000 base, 16KB size */ #define HRAM_0C0_32KB 0x01 /* 0x0C0000 base, 32KB size */ #define HRAM_0C0_48KB 0x02 /* 0x0C0000 base, 48KB size */ #define HRAM_0C0_64KB 0x03 /* 0x0C0000 base, 64KB size */ #define HRAM_0C8_16KB 0x08 /* 0x0C8000 base, 16KB size */ #define HRAM_0C8_32KB 0x09 /* 0x0C8000 base, 32KB size */ #define HRAM_0C8_48KB 0x0A /* 0x0C8000 base, 48KB size */ #define HRAM_0C8_64KB 0x0B /* 0x0C8000 base, 64KB size */ #define HRAM_0D0_16KB 0x10 /* 0x0D0000 base, 16KB size */ #define HRAM_0D0_32KB 0x11 /* 0x0D0000 base, 32KB size */ #define HRAM_0D0_48KB 0x12 /* 0x0D0000 base, 48KB size */ #define HRAM_0D0_64KB 0x13 /* 0x0D0000 base, 64KB size */ #define HRAM_0D8_16KB 0x18 /* 0x0D8000 base, 16KB size */ #define HRAM_0D8_32KB 0x19 /* 0x0D8000 base, 32KB size */ #define HRAM_F00_64KB 0x30 /* 0xF00000 base, 64KB size */ #define HRAM_F20_64KB 0x31 /* 0xF20000 base, 64KB size */ #define HRAM_F40_64KB 0x32 /* 0xF40000 base, 64KB size */ #define HRAM_F60_64KB 0x33 /* 0xF60000 base, 64KB size */ #define HRAM_F80_64KB 0x38 /* 0xF80000 base, 64KB size */ /* * The bits in the ED_INT_CONF register */ #define HINT_LEVEL 0x0F /* interrupt level select */ #define HINT_RST 0x10 /* reset adapter */ #define HINT_EDO 0x10 /* serial data from EEPROM */ #define HINT_EDI 0x20 /* serial data into EEPROM */ #define HINT_ESK 0x40 /* shift clock to EEPROM */ #define HINT_ECS 0x80 /* chip select to EEPROM */ /* * The interrupt request levels */ #define HINT_IRL3 0x03 /* IR level 3 */ #define HINT_IRL5 0x05 /* IR level 5 */ #define HINT_IRL7 0x07 /* IR level 7 */ #define HINT_IRL9 0x09 /* IR level 9 */ #define HINT_IRL10 0x0A /* IR level 10 */ #define HINT_IRL11 0x0B /* IR level 11 */ #define HINT_IRL12 0x0C /* IR level 12 */ #define HINT_IRL15 0x0F /* IR level 15 */ /* * Defines for doing common board operations */ #define LOAD_IOADDR(v) outb(ED_ID_PORT, ((((v) - 0x200) / 0x10) & 0x1f)) #define CONFIG_IOADDR(d,a) (a) = (((dp)->ex_ioaddr - 0x200) / 0x10) & 0x1f #define SELECT_SIGNAT(d) {(d)->ex_creg2 &= ~HCTL_VB; \ (d)->ex_creg2 |= HCTL_SIGNAT; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define SELECT_EADDR(d) {(d)->ex_creg2 &= ~HCTL_VB; \ (d)->ex_creg2 |= HCTL_EADDR; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define SELECT_PARTNO(d) {(d)->ex_creg2 &= ~HCTL_VB; \ (d)->ex_creg2 |= HCTL_PARTNO; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define DEVICE_16BIT(d) {(d)->ex_creg2 |= HCTL_LAD; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define SET_ESK_EEPROM(d) {(d)->ex_intr2 |= HINT_ESK; \ outb(ED_INT_CONF(d), (d)->ex_intr2);} #define SET_ECS_EEPROM(d) {(d)->ex_intr2 |= HINT_ECS; \ outb(ED_INT_CONF(d), (d)->ex_intr2);} #define CLR_ESK_EEPROM(d) {(d)->ex_intr2 &= ~HINT_ESK; \ outb(ED_INT_CONF(d), (d)->ex_intr2);} #define CLR_ECS_EEPROM(d) {(d)->ex_intr2 &= ~HINT_ECS; \ outb(ED_INT_CONF(d), (d)->ex_intr2);} #define GET_EDO(d) (inb(ED_INT_CONF(d)) & HINT_EDO) >> 4 #define SET_EDI(d) {(d)->ex_intr2 |= HINT_EDI; \ outb(ED_INT_CONF(d), (d)->ex_intr2);} #define CLR_EDI(d) {(d)->ex_intr2 &= ~HINT_EDI; \ outb(ED_INT_CONF(d), (d)->ex_intr2);} #define SET_INTREG(d,c) outb(ED_INT_CONF(d), (c)) #define GET_INTLEVEL(d) (inb(ED_INT_CONF(d)) & HINT_LEVEL) #define SET_RAMREG(d,c) outb(ED_RAM_CONF(d), (c)) #define GET_RAMCONF(d) (inb(ED_RAM_CONF(d)) & HRAM_CONF) #define GET_0WS(d) inb(ED_RAM_CONF(d)) & HRAM_0WS #define SET_ROMREG(d,c) outb(ED_ROM_CONF(d), (c)) #define CONFIG_ROMADDR(d,a) (a) = ((dp)->ex_rombase - 0xc0000) >> 0xb #define GET_ROMADDR(d) ((inb(ED_ROM_CONF(d)) & HROM_ADDR) << 0xb) + 0xc0000 #define GET_ROMSIZE(d) (inb(ED_ROM_CONF(d)) & HROM_SIZE) /* ID state machine values */ #define RUN 0 #define IOLOAD 1 /* EEPROM defines */ /* #define TEE_EW 5 /* Time eeprom Te/w (usec) */ #define NEEPROM_CMD 8 /* number op code & addr bits per cmd */ #define NEEPROM_ADDR_BITS 4 /* number of addr bits per eeprom cmd */ #define NEEPROM_DATA_BITS 16 /* number of data bits per eeprom cmd */ #define WORD_MASK 0xffff #define EEPROM_READ0 0x80 /* read register 0 op code 10XX */ #define EEPROM_READ1 0x81 /* read register 1 op code 10XX */ #define EEPROM_WRITE0 0x40 /* write register 0 op code 01XX */ #define EEPROM_WRITE1 0x41 /* write register 1 op code 01XX */ #define EEPROM_ERASE0 0xc0 /* erase register 0 op code 11XX */ #define EEPROM_ERASE1 0xc1 /* erase register 1 op code 11XX */ #define EEPROM_EWEN 0x30 /* erase/write enable op code 0011 */ #define EEPROM_EWDS 0x00 /* erase/write disable op code 0000 */ #define EEPROM_ERAL 0x20 /* chip erase op code 0010 */ /* miscellaneous */ #define OK 1 #define NOT_OK 0 #define MAXBRDS 4 /* num boards this program supports */ #define NIOADDRS 25 /* num valid I/O base addrs */ #define PARTNO_REV 3 /* num bytes in 3com part number */ extern struct e3dset e3dset[]; /* 3c507 setup structures */ extern unsigned short e3dnboards; /* num boards in system */ extern unsigned short e3daddrs[]; 07070100023880000081a400000000000000030000000135aefc980000054b00001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/drv/mdi/e3D/acfg/io.s .ident "@(#) io.s 5.1 94/06/10 SCOINC" / / Copyright (C) The Santa Cruz Operation, 1993-1994. / This Module contains Proprietary Information of / The Santa Cruz Operation and should be treated / as Confidential. .data .text .align 4 .def inb; .val inb; .scl 2; .type 042; .endef .globl inb inb: jmp .L14 .L13: movl 8(%ebp),%edx sub %eax,%eax inb (%dx) jmp .L12 /REGAL 0 NODBL /REGAL 6 AUTO -1(%ebp) 1 .L12: leave ret .L14: pushl %ebp movl %esp,%ebp pushl %eax jmp .L13 .def inb; .val .; .scl -1; .endef .data .text .align 4 .def outp; .val outb; .scl 2; .type 044; .endef .globl outb outb: jmp .L18 .L17: movsbl 12(%ebp),%eax movl 8(%ebp),%edx outb (%dx) movl $0,%eax jmp .L16 /REGAL 0 NODBL .L16: leave ret .L18: pushl %ebp movl %esp,%ebp jmp .L17 .def outb; .val .; .scl -1; .endef .data .text .align 4 .def enable; .val enable; .scl 2; .type 044; .endef .globl enable enable: jmp .L19 .L20: sti jmp .L21 /REGAL 0 NODBL .L21: leave ret .L19: pushl %ebp movl %esp,%ebp jmp .L20 .def enable; .val .; .scl -1; .endef .data .text .align 4 .def disable; .val disable; .scl 2; .type 044; .endef .globl disable disable: jmp .L22 .L23: cli jmp .L24 /REGAL 0 NODBL .L24: leave ret .L22: pushl %ebp movl %esp,%ebp jmp .L23 .def disable; .val .; .scl -1; .endef .data 07070100023884000081a400000000000000030000000135aefc980000660900001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/drv/mdi/e3D/e3D.h/* * "@(#) e3D.h 5.1 94/06/10 SCOINC" * * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * System V STREAMS TCP - Release 3.0 * * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) * All Rights Reserved. * * The copyright above and this notice must be preserved in all copies of this * source code. The copyright above does not evidence any actual or intended * publication of this source code. * * System V STREAMS TCP was jointly developed by Lachman Associates and * Convergent Technologies. */ /* * (C) Copyright 1991 SCO Canada, Inc. * All Rights Reserved. * * The copyright above and this notice must be preserved in all * copies of this source code. The copyright above does not * evidence any actual or intended publication of this source * code. * * This is unpublished proprietary trade secret source code of * SCO Canada, Inc. This source code may not be copied, * disclosed, distributed, demonstrated or licensed except as * expressly authorized by SCO Canada, Inc. */ /* Header for 3com507 Ethernet board */ /* * The ethernet header data is contained in the 586 data structures * not in the received packet data, so these numbers do not include * either the checksum or the ethernet header. */ #define E3D_MINPACK 46 /* minimum output packet length */ #define E3D_MAXPACK 1500 /* maximum output packet length */ #define E3D_ETH_MINPACK 60 /* min with ethernet header */ #define E3D_ETH_MAXPACK 1514 /* max with ethernet header */ /* * Sizes of network controller data structure values */ #define RFD_MIN 20 /* minimum # rfds (in 16KB window) */ #define RB_SIZE 256 /* receive buffer size */ #define TCB_MIN 3 /* minimum # tcbs (in 16KB window) */ #define TBD_MIN TCB_MIN /* minimum # tbds (in 16KB window) */ /** ** Start of 82586 network controller definitions -------------------------- **/ /* * System Control Pointer */ struct scp { u_char scp_sysbus; /* system bus size */ u_char scp_reserved[5]; /* not used */ u_short scp_iscpaddrl; /* address of iscp (low bits) */ u_short scp_iscpaddrh; /* address of iscp (high bits) */ }; /* scp_sysbus bit mappings */ #define SYSBUS_8BIT 1 #define SYSBUS_16BIT 0 /* * Immediate System Control Pointer */ struct iscp { u_char iscp_busy; /* initialization indicator */ u_char iscp_reserved; /* not used */ u_short iscp_scboffset; /* offset of scb in memory */ u_short iscp_scbbasel; /* scb base in memory (low bits) */ u_short iscp_scbbaseh; /* scb base in memory (high bits) */ }; /* * System Control Block */ struct scb { u_short scb_status; /* status of 82586 */ u_short scb_command; /* command register */ u_short scb_cbl_ofst; /* command block offset */ u_short scb_rfd_ofst; /* receive frame descriptor offset */ u_short scb_crc_errs; /* crc error counter */ u_short scb_aln_errs; /* alignment error counter */ u_short scb_rsc_errs; /* no of resources counter */ u_short scb_ovr_errs; /* over-run error counter */ }; /* scb_status bit mappings */ #define SCB_CX_BIT 0x8000 /* command completed */ #define SCB_FR_BIT 0x4000 /* received a packet */ #define SCB_CNA_BIT 0x2000 /* command unit not active */ #define SCB_RNR_BIT 0x1000 /* no more resources */ #define SCB_INT_BITS 0xF000 /* interrupt bits */ #define SCB_CUS_MASK 0x0F00 /* command unit mask */ #define SCB_CUS_IDLE 0x0000 /* command unit idle */ #define SCB_CUS_SUSP 0x0100 /* command unit suspended */ #define SCB_CUS_ACTIVE 0x0200 /* command unit active */ #define SCB_RUS_MASK 0x00F0 /* receive unit mask */ #define SCB_RUS_IDLE 0x0000 /* receive unit idle */ #define SCB_RUS_SUSP 0x0010 /* receive unit suspended */ #define SCB_RUS_NO_RES 0x0020 /* no resources for receive unit */ #define SCB_RUS_READY 0x0040 /* receive unit ready */ /* scb_command bit mappings */ #define SCB_CUC_START 0x0100 /* command to start command unit */ #define SCB_CUC_RESUME 0x0200 /* command to resume the unit */ #define SCB_CUC_SUSP 0x0300 /* command to suspend the unit */ #define SCB_CUC_ABORT 0x0400 /* command to abort active command */ #define SCB_RUC_START 0x0010 /* command to start receive unit */ #define SCB_RUC_RESUME 0x0020 /* command to resume the unit */ #define SCB_RUC_SUSP 0x0030 /* command to suspend the unit */ #define SCB_RUC_ABORT 0x0040 /* command to abort the unit */ #define SCB_RESET_BIT 0x0800 /* software reset bit */ #define RESET_OK_BITS 0xA000 /* reset status bits */ #define RECVUNIT_INT 0x5000 /* receive unit needs attention */ #define RECV_UNIT_ACK 0x5000 /* receive unit ack */ #define CMDUNIT_INT 0xA000 /* command unit needs attention */ #define CMD_UNIT_ACK 0xA000 /* command unit ack */ #define SCB_MAX_ERRS 0xffff /* max value of error counters */ /* * Struct of a General Action Command Block */ struct cbl { u_short cbl_status; /* command completion code */ u_short cbl_command; /* command code */ u_short cbl_link; /* next command block */ u_char cbl_data[100]; /* command specific data */ }; /* cbl_status bit mappings */ #define CBL_C_BIT 0x8000 /* completion bit */ #define CBL_B_BIT 0x4000 /* busy bit */ #define CBL_OK_BIT 0x2000 /* error-free bit */ #define CBL_A_BIT 0x1000 /* aborted bit */ /* cbl_command bit mappings */ #define CBL_EL_BIT 0x8000 /* last command block on list */ #define CBL_I_BIT 0x2000 /* interrupt host after completion */ #define CBL_S_BIT 0x4000 /* suspend cu after completion */ #define CBL_CMD_MASK 0x0007 /* command code */ /* cbl_command values */ #define CMD_NOP 0 /* no-operation */ #define CMD_IASETUP 1 /* individual address setup */ #define CMD_CONFIGURE 2 /* configuration (options) */ #define CMD_MULTICAST 3 /* multicast address setup */ #define CMD_TRANSMIT 4 /* transmit a packet */ #define CMD_TDR 5 /* Time Domain Reflectometry test */ #define CMD_DUMP 6 /* dump chip configuaration */ #define CMD_DIAGNOSE 7 /* internal diagnostic test */ /* * Individual Address command block */ struct iasetup { u_short ias_status; /* command completion code */ u_short ias_command; /* command code */ u_short ias_link; /* next command block */ macaddr_t ias_addr; /* ethernet address */ }; /* * Multicast Control Block */ struct mcsetup { u_short mcs_status; /* Command status */ u_short mcs_command; /* Command */ u_short mcs_link; /* Address of next command block */ u_short mcs_cnt; /* # of bytes is list field */ macaddr_t mcs_list[MDI_NMCADDR];/* The multicast addresses */ }; /* * Diagnose Command Block */ struct diag { u_short diag_status; /* command completion code */ u_short diag_command; /* command code */ u_short diag_link; /* next command block */ }; /* * Dump Command Block */ struct dump { u_short dmp_status; /* command completion code */ u_short dmp_command; /* command code */ u_short dmp_link; /* next command block */ u_short dmp_bufoffset; /* dump buffer offset */ }; /* * Dump Buffer */ #define DUMPBUFSIZE 170 typedef char dump_buf[DUMPBUFSIZE]; /* * Transmit Control Block */ struct tcb { u_short tcb_status; /* command completion code */ u_short tcb_command; /* command code */ u_short tcb_link; /* next command block */ u_short tcb_tbdoffset; /* offset of transmit buffer des */ macaddr_t tcb_dstaddr; /* Ethernet address of destination */ u_short tcb_len; /* 16 bit length field */ }; /* tcb_status bit mappings */ #define TCB_C_BIT 0x8000 /* Command Completed */ #define TCB_B_BIT 0x4000 /* Busy with Execution */ #define TCB_OK_BIT 0x2000 /* Error free Completion */ #define TCB_ABORT 0x1000 /* Command Aborted */ #define TCB_CSLOST 0x0400 /* No Carrier Sense during xmit */ #define TCB_NOCTS 0x0200 /* Lost off Clear to Send */ #define TCB_DMAURUN 0x0100 /* DMA Underrun */ #define TCB_DEFER 0x0080 /* Traffic caused defer of send */ #define TCB_HEARTBEAT 0x0040 /* SQE test failed */ #define TCB_MAXCOLLSNS 0x0020 /* Too many collisions on xmit */ #define TCB_COLLSNS_CNT 0x000F /* Number of collision */ /* tcb_command bit mappings */ #define TCB_EL_BIT 0x8000 /* End of command list */ #define TCB_I_BIT 0x2000 /* Interrupt after completion */ /* * Transmit Buffer Descriptor */ struct tbd { u_short tbd_count; /* size of xmit buffer + EOF bit */ u_short tbd_link; /* next tbd */ u_short tbd_xbuffpl; /* addr of xmit buffer (low bits) */ u_short tbd_xbuffph; /* addr of xmit buffer (high bits) */ }; #define TBD_EOF_BIT 0x8000 /* Last buffer of this chain */ /* * Transmit Buffer */ struct tbuff { u_char tb_data[E3D_MAXPACK]; /* Max size of ethernet packet */ }; /* * Command Block Union */ union cbu { struct cbl cbl; struct tcb tcb; struct iasetup ias; struct diag diag; struct dump dump; struct mcsetup mcs; }; /* * Receive Frame Descriptor */ struct rfd { u_short rfd_status; /* receive packet status */ u_short rfd_cntl; /* control bits for 586 */ u_short rfd_link; /* next rfd on the link-list */ u_short rfd_rbd_ofst; /* offset of the rbd */ macaddr_t rfd_dstaddr; /* dest of received packet */ macaddr_t rfd_srcaddr; /* source of received packet */ u_short rfd_length; /* Length/Type field of packet */ }; /* rfd_status bit mappings */ #define RFD_C_BIT 0x8000 /* completion bit */ #define RFD_B_BIT 0x4000 /* busy bit */ #define RFD_OK_BIT 0x2000 /* error-free bit */ #define RFD_CRCERR_BIT 0x0800 /* crc error bit */ #define RFD_ALNERR_BIT 0x0400 /* alignment error bit */ #define RFD_RSCERR_BIT 0x0200 /* out-of-resources bit */ #define RFD_OVRERR_BIT 0x0100 /* over-run error bit */ #define RFD_SHORT_BIT 0x0080 /* short frame */ #define RFD_EOFERR_BIT 0x0040 /* No eof flag detected bit */ /* rfd_cntl bit mappings */ #define RFD_EL_BIT 0x8000 /* last rfd on the list */ #define RFD_S_BIT 0x4000 /* suspend after this recv */ /* * Receive Buffer Descriptor */ struct rbd { u_short rbd_status; /* stat bit + actual frame size */ u_short rbd_link; /* next rbd on the link-list */ u_short rbd_rbaddrl; /* addr of recv buffer (low bits) */ u_short rbd_rbaddrh; /* addr of recv buffer (how bits) */ u_short rbd_rbuffsize; /* receive buffer size */ }; #define RBD_EOF_BIT 0x8000 /* last buffer holding the packet */ #define RBD_F_BIT 0x4000 /* act count field valid */ #define RBD_PKTLEN_BITS 0x3FFF /* mask for packet length */ /* rbd_rbuffsize bit mappings */ #define RBD_EL_BIT 0x8000 /* last rbd on the link-list */ /* * Receive Buffer */ struct rbuff { u_char rbuff_data[RB_SIZE]; /* Maximum receiveable packet */ }; /* * The last byte of the RAM window accesible by the host always * appears at address 0xFFFF (highest) in the 82586's address space. */ #define SCB_OFFSET 0x0 /* control structure offset in mem */ #define SCP_BADDR 0xfff6 /* SCP address in 586 mem space */ #define START_BADDR(d) ((u_long)(64*1024) - (u_long)(d)->ex_memsize) #define BADDR_TO_VADDR(d,a) (((a) - START_BADDR(d)) + (u_long)(d)->ex_rambase) #define VADDR_TO_BADDR(d,a) ((u_short)(((u_long)(a) - \ (u_long)(d)->ex_rambase) + START_BADDR(d))) #define BOFF_TO_VADDR(d,o) (((o) - SCB_OFFSET) + (u_long)(d)->ex_rambase) #define VADDR_TO_BOFF(d,a) ((u_short)((u_long)(a) - (u_long)(d)->ex_rambase) \ + SCB_OFFSET) #define NULL_OFFSET 0xFFFF /* * The following structure describes the usage of the RAM memory window. * These are some of the 82586 control structures. */ struct control { struct iscp iscp; /* Immediate System Config Pointer */ struct scb scb; /* System Control Block */ union cbu cbu; /* Command Block List */ }; /** ** End of 82586 network controller definitions -------------------------- **/ /* Multicast address */ #define ISMULTICAST(ea) (((caddr_t)(ea))[0] & 1) /* Broadcast address */ #define ISBROADCAST(ea) ((((caddr_t)(ea))[0] & 0xff) == 0xff && \ mdi_addrs_equal(e3D_broad, ea)) /* Ethernet frame */ typedef struct { macaddr_t eh_daddr; /* 48-bit destination address */ macaddr_t eh_saddr; /* 48-bit source address */ unsigned short eh_type; /* 16-bit type field */ } e_frame_t; typedef struct e3Ddev_s { short ex_int; /* interrupt vector number */ short ex_ioaddr; /* I/O ports for device */ caddr_t ex_base; /* phys address of board memory */ long ex_memsize; /* size of board memory */ caddr_t ex_rambase; /* Virtual address of board mem */ u_short ex_creg2; /* copy of board control register */ u_short ex_ramr2; /* copy of ram configuration register */ u_short ex_romr2; /* copy of rom configuration register */ u_short ex_intr2; /* copy of interrupt config register */ int ex_open; /* opened yet ? */ queue_t * ex_up_queue; /* upstream queue */ short ex_present; /* board present */ short ex_hwinited; /* hardware initialized flag */ macaddr_t ex_eaddr; /* ethernet addr */ mctbl_t ex_mc; /* multicast table */ struct control *ex_control; /* 586 control structures */ #ifdef DUMP_82586_REGS dump_buf *ex_dumpbuf; /* 586 register dump buffer */ #endif long ex_ntcb; /* # of Transmit Control Blocks */ struct tcb *ex_tcb; /* Transmit Control Blocks */ long ex_ntbd; /* # of Transmit Block Descriptors */ struct tbd *ex_tbd; /* Transmit Block Descriptors */ long ex_ntbuff; /* # of Transmit Buffers */ struct tbuff *ex_tbuff; /* Transmit Buffers */ long ex_nrfd; /* # of Receive Frame Descriptors */ struct rfd *ex_rfd; /* Receive Frame Descriptors */ long ex_nrbd; /* # of Receive Block Descriptors */ struct rbd *ex_rbd; /* Receive Block Descriptors */ long ex_nrbuff; /* # of Receive Buffers */ struct rbuff *ex_rbuff; /* Receive Buffers */ u_int ex_flags; /* private flags */ struct tcb *ex_tcbhead; /* next xmit cmd to be executed */ struct tcb *ex_tcbnext; /* next available unused xmit blk */ struct tcb *ex_tcbtail; /* end of xmit block list */ struct rfd *ex_rfdhead; /* First rfd on 586 list */ struct rfd *ex_rfdtail; /* Last rfd on 586 list */ struct rbd *ex_rbdhead; /* First rbd on 586 list */ struct rbd *ex_rbdtail; /* Last rbd on 586 list */ #ifdef KEEP_LAST_RBD_EMPTY struct rbd *ex_rbdtail2; /* rbd before last on 586 list */ #endif union cbu *ex_cbuhead; /* next action cmnd to be executed */ queue_t *ex_iocq; /* queue for ioctl reply */ mblk_t *ex_iocmp; /* message block with ioctl request */ mac_stats_eth_t ex_macstats; /* MAC statistics */ } e3Ddev_t; /* Definitions for flags field */ #define ED_BUFSBUSY 0x01 /* All buffers in use */ #define ED_CUWORKING 0x02 /* Xmit or Cmnd in progress */ #define ED_CBLSBUSY 0x04 /* All cbls in use */ #define ED_CBLREADY 0x08 /* Action command ready to execute */ /* * These defines describe the control ports on the 3com 507 * The base address for these registers is obtained from * the device structure, thus there must be an initialized * pointer to the structure for this board in scope * when the define is used. */ #define ED_ID_PORT 0x100 #define ED_NM_DATA(d) (((d)->ex_ioaddr)+0) #define ED_CNTRL(d) (((d)->ex_ioaddr)+6) #define ED_INTR_CLR(d) (((d)->ex_ioaddr)+0xA) #define ED_CHAN_ATTN(d) (((d)->ex_ioaddr)+0xB) #define ED_ROM_CONF(d) (((d)->ex_ioaddr)+0xD) #define ED_RAM_CONF(d) (((d)->ex_ioaddr)+0xE) #define ED_INT_CONF(d) (((d)->ex_ioaddr)+0xF) #define ED_IO_SIZE 16 /* * Network management data banks */ #define HNM_SIZE 6 /* # bytes of data */ /* * The bits in the ED_CNTRL register */ #define HCTL_VB 0x03 /* network management data bank */ #define HCTL_IEN 0x04 /* interrupt enable */ #define HCTL_INT 0x08 /* interrupt active */ #define HCTL_LAD 0x10 /* adapter as 8 or 16 bit device */ #define HCTL_LBK 0x20 /* loopback enable */ #define HCTL_RST 0x80 /* 82586 reset */ /* * The network management data bank settings (use HCTL_VB as a mask) */ #define HCTL_SIGNAT 0x00 /* 3Com signature = "*3COM*" */ #define HCTL_EADDR 0x01 /* ethernet address */ #define HCTL_PARTNO 0x02 /* adapter part numb and rev level */ /* * The bits in the ED_ROM_CONF register */ #define HROM_SIZE 0x03 /* ROM window size */ #define HROM_ADDR 0x3C /* ROM window base address */ #define HROM_BNC 0x80 /* enable on-board transceiver */ /* * The ROM window size settings (use HROM_SIZE as a mask) */ #define HROM_NONE 0x00 /* no boot ROM present */ #define HROM_08KB 0x01 /* 08 KB */ #define HROM_16KB 0x02 /* 16 KB */ #define HROM_32KB 0x03 /* 32 KB */ /* * The bits in the ED_RAM_CONF register */ #define HRAM_CONF 0x3F /* RAM configuration bits */ #define HRAM_SAD 0x40 /* disable SAD mode */ #define HRAM_0WS 0x80 /* enable zero wait state */ /* * The RAM window base and size settings (use HRAM_CONF as a mask) */ #define HRAM_0C0_16KB 0x00 /* 0x0C0000 base, 16KB size */ #define HRAM_0C0_32KB 0x01 /* 0x0C0000 base, 32KB size */ #define HRAM_0C0_48KB 0x02 /* 0x0C0000 base, 48KB size */ #define HRAM_0C0_64KB 0x03 /* 0x0C0000 base, 64KB size */ #define HRAM_0C8_16KB 0x08 /* 0x0C8000 base, 16KB size */ #define HRAM_0C8_32KB 0x09 /* 0x0C8000 base, 32KB size */ #define HRAM_0C8_48KB 0x0A /* 0x0C8000 base, 48KB size */ #define HRAM_0C8_64KB 0x0B /* 0x0C8000 base, 64KB size */ #define HRAM_0D0_16KB 0x10 /* 0x0D0000 base, 16KB size */ #define HRAM_0D0_32KB 0x11 /* 0x0D0000 base, 32KB size */ #define HRAM_0D0_48KB 0x12 /* 0x0D0000 base, 48KB size */ #define HRAM_0D0_64KB 0x13 /* 0x0D0000 base, 64KB size */ #define HRAM_0D8_16KB 0x18 /* 0x0D8000 base, 16KB size */ #define HRAM_0D8_32KB 0x19 /* 0x0D8000 base, 32KB size */ #define HRAM_F00_64KB 0x30 /* 0xF00000 base, 64KB size */ #define HRAM_F20_64KB 0x31 /* 0xF20000 base, 64KB size */ #define HRAM_F40_64KB 0x32 /* 0xF40000 base, 64KB size */ #define HRAM_F60_64KB 0x33 /* 0xF60000 base, 64KB size */ #define HRAM_F80_64KB 0x38 /* 0xF80000 base, 64KB size */ /* * The bits in the ED_INT_CONF register */ #define HINT_LEVEL 0x0F /* interrupt level select */ #define HINT_RST 0x10 /* reset adapter */ #define HINT_EDO 0x10 /* serial data from EEPROM */ #define HINT_EDI 0x20 /* serial data into EEPROM */ #define HINT_ESK 0x40 /* shift clock to EEPROM */ #define HINT_ECS 0x80 /* chip select to EEPROM */ /* * The interrupt request levels */ #define HINT_IRL3 0x03 /* IR level 3 */ #define HINT_IRL5 0x05 /* IR level 5 */ #define HINT_IRL7 0x07 /* IR level 7 */ #define HINT_IRL9 0x09 /* IR level 9 */ #define HINT_IRL10 0x0A /* IR level 10 */ #define HINT_IRL11 0x0B /* IR level 11 */ #define HINT_IRL12 0x0C /* IR level 12 */ #define HINT_IRL15 0x0F /* IR level 15 */ /* * Defines for doing common board operations */ #define LOAD_IOADDR(v) outb(ED_ID, ((((v) * 0x10) + 0x200) & 0x1F)) #define SET_CNTRL(d,c) {(d)->ex_creg2 = (c); \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define SELECT_SIGNAT(d) {(d)->ex_creg2 &= ~HCTL_VB; \ (d)->ex_creg2 |= HCTL_SIGNAT; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define SELECT_EADDR(d) {(d)->ex_creg2 &= ~HCTL_VB; \ (d)->ex_creg2 |= HCTL_EADDR; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define SELECT_PARTNO(d) {(d)->ex_creg2 &= ~HCTL_VB; \ (d)->ex_creg2 |= HCTL_PARTNO; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define ENABLE_586INT(d) {(d)->ex_creg2 |= HCTL_IEN; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define DISABL_586INT(d) {(d)->ex_creg2 &= ~HCTL_IEN; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define ACTIVE_586INT(d) (inb(ED_CNTRL(d)) & HCTL_INT) #define LOOPBK_ENABLE(d) {(d)->ex_creg2 |= HCTL_LBK; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define LOOPBK_DISABL(d) {(d)->ex_creg2 &= ~HCTL_LBK; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define DEVICE_8BIT(d) {(d)->ex_creg2 &= ~HCTL_LAD; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define DEVICE_16BIT(d) {(d)->ex_creg2 |= HCTL_LAD; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define RESET_586(d) {outb(ED_CNTRL(d),(d)->ex_creg2 & ~HCTL_RST); \ (d)->ex_creg2 |= HCTL_RST; \ outb(ED_CNTRL(d), (d)->ex_creg2);} #define SEND_586CA(d) outb(ED_CHAN_ATTN(d), 1) #define CLR_586INT(d) outb(ED_INTR_CLR(d), 1) #define SET_ROMREG(d,c) {(d)->ex_romr2 = (c); \ outb(ED_ROM_CONF(d), (d)->ex_romr2);} #define SET_ROMSIZE(d,s) {(d)->ex_romr2 &= ~HROM_SIZE; \ (d)->ex_romr2 |= (HROM_SIZE & (s)); \ outb(ED_ROM_CONF(d), (d)->ex_romr2);} #define SET_ROMADDR(d,a) {(d)->ex_romr2 &= ~HROM_ADDR; \ (d)->ex_romr2 |= (HROM_ADDR & (a)); \ outb(ED_ROM_CONF(d), (d)->ex_romr2);} #define BNC_ENABLE(d) {(d)->ex_romr2 |= HROM_BNC; \ outb(ED_ROM_CONF(d), (d)->ex_romr2);} #define BNC_DISABLE(d) {(d)->ex_romr2 &= ~HROM_BNC; \ outb(ED_ROM_CONF(d), (d)->ex_romr2);} #define SET_RAMREG(d,c) {(d)->ex_ramr2 = (c); \ outb(ED_RAM_CONF(d), (d)->ex_ramr2);} #define SET_RAMCONF(d,c) {(d)->ex_ramr2 &= ~HRAM_CONF; \ (d)->ex_ramr2 |= (HRAM_CONF & (c)); \ outb(ED_RAM_CONF(d), (d)->ex_ramr2);} #define GET_RAMCONF(d) (inb(ED_RAM_CONF(d)) & HRAM_CONF) #define ENABLE_0WS(d) {(d)->ex_ramr2 |= HRAM_0WS; \ outb(ED_RAM_CONF(d), (d)->ex_ramr2);} #define DISABLE_0WS(d) {(d)->ex_ramr2 &= ~HRAM_0WS; \ outb(ED_RAM_CONF(d), (d)->ex_ramr2);} #define ENABLE_SAD(d) {(d)->ex_ramr2 &= ~HRAM_SAD; \ outb(ED_RAM_CONF(d), (d)->ex_ramr2);} #define DISABLE_SAD(d) {(d)->ex_ramr2 |= HRAM_SAD; \ outb(ED_RAM_CONF(d), (d)->ex_ramr2);} #define SET_INTREG(d,c) {(d)->ex_intr2 = (c); \ outb(ED_INT_CONF(d), (d)->ex_intr2);} #define SET_INTLEVEL(d,l) {(d)->ex_intr2 &= HINT_LEVEL; \ (d)->ex_intr2 |= (HINT_LEVEL & (l)); \ outb(ED_INT_CONF(d), (d)->ex_intr2);} #define GET_INTLEVEL(d) (inb(ED_INT_CONF(d)) & HINT_LEVEL) #define RESET_BOARD(d) outb(ED_INT_CONF(d), (d)->ex_intr2 | HINT_RST) /* miscellany */ #define BRD_MINWINSIZE (16*1024) /* 16k window minimum */ #define BRD_MAXWINSIZE (64*1024) /* 64k window maximum */ #define MEMTST_PATTERN 0x55CC /* Pattern to use for memory test */ #define OK 1 #define NOT_OK 0 #define E3D_POLL 1 /* number of ticks to poll for */ /* * Global Variables: */ extern e3Ddev_t e3Ddevice[]; /* device structure */ extern u_int e3Diobase[]; /* io base address table */ extern u_int e3D_nunit; /* number of boards configured */ extern macaddr_t e3D_broad; extern macaddr_t e3Deth_addr[]; /* override h/w mac address */ /* * Macros to provide fine controls over debugging messages. */ extern unsigned long e3Ddbgstop; extern unsigned long e3Ddbgcntrl; /* * Functions: */ #if defined(__STDC__) && !defined(_NO_PROTOTYPE) extern char * e3Daddrstr(macaddr_t ea); extern void e3Dhwclose(e3Ddev_t * dev); extern int e3Dhwinit(e3Ddev_t * dev, int unit); extern void e3Dhwput(e3Ddev_t * dv, mblk_t * m); extern void e3Dintr(int lev); extern void e3Dioctlack(e3Ddev_t * dev, queue_t * q, mblk_t * mp, int status); extern int e3Dmcaddrset(e3Ddev_t * dv, queue_t * q, mblk_t * mp); extern int e3Doktoput(e3Ddev_t * dev); extern int e3Dpresent(int unit); extern void e3Drunstate(void); #endif #if defined(DEBUG) #define STATIC #define DEBUGZZ(x) {printf x; } #define DEBUG00(x) if (e3Ddbgcntrl&0x00000001) DEBUGZZ(x) else #define DEBUG01(x) if (e3Ddbgcntrl&0x00000002) DEBUGZZ(x) else #define DEBUG02(x) if (e3Ddbgcntrl&0x00000004) DEBUGZZ(x) else #define DEBUG03(x) if (e3Ddbgcntrl&0x00000008) DEBUGZZ(x) else #define DEBUG04(x) if (e3Ddbgcntrl&0x00000010) DEBUGZZ(x) else #define DEBUG05(x) if (e3Ddbgcntrl&0x00000020) DEBUGZZ(x) else #define DEBUG06(x) if (e3Ddbgcntrl&0x00000040) DEBUGZZ(x) else #define DEBUG07(x) if (e3Ddbgcntrl&0x00000080) DEBUGZZ(x) else #define DEBUG08(x) if (e3Ddbgcntrl&0x00000100) DEBUGZZ(x) else #define DEBUG09(x) if (e3Ddbgcntrl&0x00000200) DEBUGZZ(x) else #define DEBUG10(x) if (e3Ddbgcntrl&0x00000400) DEBUGZZ(x) else #define DEBUG11(x) if (e3Ddbgcntrl&0x00000800) DEBUGZZ(x) else #define DEBUG12(x) if (e3Ddbgcntrl&0x00001000) DEBUGZZ(x) else #define DEBUG13(x) if (e3Ddbgcntrl&0x00002000) DEBUGZZ(x) else #define DEBUG14(x) if (e3Ddbgcntrl&0x00004000) DEBUGZZ(x) else #define DEBUG15(x) if (e3Ddbgcntrl&0x00008000) DEBUGZZ(x) else #define DEBUG16(x) if (e3Ddbgcntrl&0x00010000) DEBUGZZ(x) else #define DEBUG17(x) if (e3Ddbgcntrl&0x00020000) DEBUGZZ(x) else #define DEBUG18(x) if (e3Ddbgcntrl&0x00040000) DEBUGZZ(x) else #define DEBUG19(x) if (e3Ddbgcntrl&0x00080000) DEBUGZZ(x) else #define DEBUG20(x) if (e3Ddbgcntrl&0x00100000) DEBUGZZ(x) else #define DEBUG21(x) if (e3Ddbgcntrl&0x00200000) DEBUGZZ(x) else #define DEBUG22(x) if (e3Ddbgcntrl&0x00400000) DEBUGZZ(x) else #define DEBUG23(x) if (e3Ddbgcntrl&0x00800000) DEBUGZZ(x) else #define DEBUG24(x) if (e3Ddbgcntrl&0x01000000) DEBUGZZ(x) else #define DEBUG25(x) if (e3Ddbgcntrl&0x02000000) DEBUGZZ(x) else #define DEBUG26(x) if (e3Ddbgcntrl&0x04000000) DEBUGZZ(x) else #define DEBUG27(x) if (e3Ddbgcntrl&0x08000000) DEBUGZZ(x) else #define DEBUG28(x) if (e3Ddbgcntrl&0x10000000) DEBUGZZ(x) else #define DEBUG29(x) if (e3Ddbgcntrl&0x20000000) DEBUGZZ(x) else #define DEBUG30(x) if (e3Ddbgcntrl&0x40000000) DEBUGZZ(x) else #define DEBUG31(x) if (e3Ddbgcntrl&0x80000000) DEBUGZZ(x) else #define DEBUGXX(v,x) if (e3Ddbgcntrl&(v)) DEBUGZZ(x) else #else /* * The Xenix loader cannot handle "ld -r" commands if STATIC * is defined to be static. */ #define STATIC static #define DEBUG00(x) #define DEBUG01(x) #define DEBUG02(x) #define DEBUG03(x) #define DEBUG04(x) #define DEBUG05(x) #define DEBUG06(x) #define DEBUG07(x) #define DEBUG08(x) #define DEBUG09(x) #define DEBUG10(x) #define DEBUG11(x) #define DEBUG12(x) #define DEBUG13(x) #define DEBUG14(x) #define DEBUG15(x) #define DEBUG16(x) #define DEBUG17(x) #define DEBUG18(x) #define DEBUG19(x) #define DEBUG20(x) #define DEBUG21(x) #define DEBUG22(x) #define DEBUG23(x) #define DEBUG24(x) #define DEBUG25(x) #define DEBUG26(x) #define DEBUG27(x) #define DEBUG28(x) #define DEBUG29(x) #define DEBUG30(x) #define DEBUG31(x) #define DEBUGXX(v,x) #endif /* SCO000 vvv */ #define htons ntohs #define ntohs(s) ( (((s) & 0x00ff) << 8) | (((s) & 0xff00) >> 8) ) /* SCO000 ^^^ */ 07070100023885000081a400000000000000030000000135aefc9800002dd700001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/e3D/e3Dli.c#pragma comment(exestr, "@(#) e3Dli.c 5.2 94/08/10 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * System V STREAMS TCP - Release 3.0 * * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) * All Rights Reserved. * * The copyright above and this notice must be preserved in all copies of this * source code. The copyright above does not evidence any actual or intended * publication of this source code. * * System V STREAMS TCP was jointly developed by Lachman Associates and * Convergent Technologies. */ /* * (C) Copyright 1991 SCO Canada, Inc. * All Rights Reserved. * * The copyright above and this notice must be preserved in all * copies of this source code. The copyright above does not * evidence any actual or intended publication of this source * code. * * This is unpublished proprietary trade secret source code of * SCO Canada, Inc. This source code may not be copied, * disclosed, distributed, demonstrated or licensed except as * expressly authorized by SCO Canada, Inc. */ #include "sys/types.h" #include "sys/param.h" #include "sys/sysmacros.h" #include "sys/stream.h" #include "sys/stropts.h" #include "sys/strlog.h" #include "sys/log.h" #include "sys/signal.h" /* needed for sys/user.h */ #include "sys/dir.h" /* needed for sys/user.h */ #include "sys/page.h" /* needed for sys/user.h */ #include "sys/seg.h" /* needed for sys/user.h */ #include "sys/user.h" #include "sys/conf.h" #include "sys/errno.h" #include "sys/mdi.h" #include "bool.h" #include "sys/cmn_err.h" #include "sys/debug.h" #ifdef DEBUG #include "sys/xdebug.h" #endif #include "e3D.h" /* test string */ static char *testp = "Cspvhiu!up!zpv!cz!Gjsnbo-!Hbsxppe-!NdWpz-!boe!Wjl/"; /* broadcast address for routing to this interface */ macaddr_t e3D_broad = {0xff,0xff,0xff,0xff,0xff,0xff}; /* * Function: e3Daddrstr * * Purpose: * Generate a printable version of the hw mac address * ie. turn 02 60 8c f0 12 3a into "02:60:8c:f0:12:3a" */ #define EASTRINGSIZE 18 /* size of string with ether address */ char * e3Daddrstr(macaddr_t ea) { static char buf[EASTRINGSIZE]; int i; char * s = "0123456789abcdef"; for (i = 0; i < sizeof(macaddr_t); ++i) { buf[i*3] = s[(ea[i] >> 4) & 0xf]; buf[i*3 + 1] = s[ea[i] & 0xf]; buf[i*3 + 2] = ':'; } buf[EASTRINGSIZE - 1] = '\0'; return(buf); } /* * Function: S_data * * Purpose: * Handle a data message. */ static void S_data(queue_t * q, mblk_t * mp) { int board; e3Ddev_t * dev; int do_loop; macaddr_t * ea; int s; board = (int) q->q_ptr; dev = &e3Ddevice[board]; if (!dev->ex_up_queue) { mdi_macerrorack(RD(q), M_DATA, MAC_OUTSTATE); freemsg(mp); return; } ea = &(((e_frame_t *) mp->b_rptr)->eh_daddr); if ((ISMULTICAST(*ea) && mdi_in_mctbl(&dev->ex_mc, *ea) != -1) || ISBROADCAST(*ea) || mdi_addrs_equal(dev->ex_eaddr, *ea)) mdi_do_loopback(q, mp, E3D_ETH_MINPACK); s = splstr(); if (q->q_first || !e3Doktoput(dev)) putq(q, mp); else { e3Dhwput(dev, mp); freemsg(mp); } splx(s); } /* * Function: S_ioctl * * Purpose: * Process an ioctl streams message. */ static void S_ioctl(queue_t * q, mblk_t * mp) { unsigned char * cp; unsigned char * data; e3Ddev_t * dev; struct iocblk * iocp = (struct iocblk *) mp->b_rptr; int j; int size; int unit; unsigned int x; unit = (int) q->q_ptr; dev = &e3Ddevice[unit]; data = (mp->b_cont) ? mp->b_cont->b_rptr : NULL; iocp->ioc_error = 0; iocp->ioc_rval = 0; switch (iocp->ioc_cmd) { case MACIOC_GETSTAT: /* dump mac or dod statistics */ if (data == NULL || iocp->ioc_count < sizeof(mac_stats_eth_t)) iocp->ioc_error = EINVAL; else { bcopy(&dev->ex_macstats, data, sizeof(mac_stats_eth_t)); mp->b_cont->b_wptr = mp->b_cont->b_rptr + sizeof(mac_stats_eth_t); iocp->ioc_count = sizeof(mac_stats_eth_t); } break; case MACIOC_CLRSTAT: /* clear mac statistics */ if (iocp->ioc_uid != 0) iocp->ioc_error = EPERM; else { x = splstr(); bzero(&dev->ex_macstats, sizeof(mac_stats_eth_t)); splx(x); iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } } break; case MACIOC_GETADDR: /* get mac address */ if (data == NULL || iocp->ioc_count < sizeof(macaddr_t)) iocp->ioc_error = EINVAL; else { x = splstr(); bcopy(&dev->ex_eaddr, data, sizeof(macaddr_t)); splx(x); mp->b_cont->b_wptr = mp->b_cont->b_rptr + sizeof(macaddr_t); iocp->ioc_count = sizeof(macaddr_t); } break; case MACIOC_GETMCSIZ: /* get multicast table size */ iocp->ioc_rval = dev->ex_mc.cnt * sizeof(macaddr_t); iocp->ioc_count = 0; break; case MACIOC_GETMCA: /* get multicast table */ size = sizeof(macaddr_t) * dev->ex_mc.cnt; if (data == NULL || iocp->ioc_count < size) iocp->ioc_error = EINVAL; else { x = splstr(); bcopy(&dev->ex_mc.tbl, data, size); splx(x); mp->b_cont->b_wptr = mp->b_cont->b_rptr + size; iocp->ioc_count = size; } break; case MACIOC_SETMCA: /* multicast setup */ if (data == NULL) iocp->ioc_error = EINVAL; else if (dev->ex_mc.cnt == MDI_NMCADDR) iocp->ioc_error = ENOSPC; else if (iocp->ioc_count != sizeof(macaddr_t)) iocp->ioc_error = EINVAL; else if (iocp->ioc_uid != 0) iocp->ioc_error = EPERM; else if (!ISMULTICAST( *((macaddr_t *) data))) iocp->ioc_error = EINVAL; else { x = splstr(); if (mdi_add_mctbl_entry(&dev->ex_mc, *((macaddr_t *) data)) == FALSE) iocp->ioc_error = EINVAL; else { if (e3Dmcaddrset(dev, q, mp) == TRUE) { splx(x); /* the h/w has to respond before we acknowledge the IOCTL */ return; } /* can't handle IOCTL until previous one completes */ iocp->ioc_error = EBUSY; } splx(x); } break; case MACIOC_DELMCA: /* multicast delete */ if (data == NULL) iocp->ioc_error = EINVAL; else if (iocp->ioc_count != sizeof(macaddr_t)) iocp->ioc_error = EINVAL; else if (iocp->ioc_uid != 0) iocp->ioc_error = EPERM; else { x = splstr(); if (mdi_del_mctbl_entry(&dev->ex_mc, *((macaddr_t *) data)) == FALSE) iocp->ioc_error = ENOENT; else { if (e3Dmcaddrset(dev, q, mp) == TRUE) { splx(x); /* the h/w has to respond before we acknowledge the IOCTL */ return; } /* can't handle IOCTL until previous one completes */ iocp->ioc_error = EBUSY; } splx(x); } break; default: iocp->ioc_error = EINVAL; break; } if (iocp->ioc_error) { mp->b_datap->db_type = M_IOCNAK; iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } } else mp->b_datap->db_type = M_IOCACK; qreply(q, mp); return; } /* * Function: S_macproto * * Purpose: * Handle MAC protocol messages. */ STATIC void S_macproto(queue_t * q, mblk_t * mp) { int board; e3Ddev_t * dev; mac_stats_eth_t * e3Dmacstats; mac_info_ack_t * info_ack; union MAC_primitives * prim; mblk_t * reply_mp; int s; board = (int) q->q_ptr; dev = &e3Ddevice[board]; prim = (union MAC_primitives *) mp->b_rptr; e3Dmacstats = &dev->ex_macstats; DEBUG12(("e3D%S_macproto: prim=x%x\n", board, prim->mac_primitive)); switch(prim->mac_primitive) { case MAC_INFO_REQ: if ((reply_mp = allocb(sizeof(mac_info_ack_t), BPRI_HI)) == NULL) cmn_err(CE_WARN, "e3D:S_macproto - Out of STREAMs"); else { info_ack = (mac_info_ack_t *) reply_mp->b_rptr; reply_mp->b_wptr += sizeof(mac_info_ack_t); reply_mp->b_datap->db_type = M_PCPROTO; info_ack->mac_primitive = MAC_INFO_ACK; info_ack->mac_max_sdu = E3D_ETH_MAXPACK; info_ack->mac_min_sdu = 1; info_ack->mac_mac_type = MAC_CSMACD; info_ack->mac_driver_version = MDI_VERSION; info_ack->mac_if_speed = 10000000; qreply(q, reply_mp); } break; case MAC_BIND_REQ: if (dev->ex_up_queue) mdi_macerrorack(RD(q), prim->mac_primitive, MAC_OUTSTATE); else { dev->ex_up_queue = RD(q); mdi_macokack(RD(q), prim->mac_primitive); } break; default: mdi_macerrorack(RD(q), prim->mac_primitive, MAC_BADPRIM); break; } freemsg(mp); return; } /* * Function: e3Dioctlack * * Purpose: * Acknowledge an ioctl request. */ void e3Dioctlack(e3Ddev_t * dv, queue_t * q, mblk_t * mp, int status) { struct iocblk * iocp = (struct iocblk *) mp->b_rptr; DEBUG15(("e3Dioctlack: unit=%d\n", dv - e3Ddevice)); ASSERT(q && mp); ASSERT(mp->b_datap->db_type == M_IOCTL); if (status == OK) { iocp->ioc_rval = 0; iocp->ioc_count = 0; iocp->ioc_error = 0; mp->b_datap->db_type = M_IOCACK; } else { iocp->ioc_rval = -1; iocp->ioc_count = 0; iocp->ioc_error = EIO; mp->b_datap->db_type = M_IOCNAK; } if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } qreply(q, mp); return; } /* * Function: e3Dopen * * Purpose: * Usual driver open routine. */ int e3Dopen(register queue_t * q, int dev, int flag, int sflag) { e3Ddev_t * dv; int unit; int x; unit = minor(dev); if (unit >= e3D_nunit) { u.u_error = ENXIO; return(OPENFAIL); } if (sflag == CLONEOPEN) { u.u_error = EINVAL; return (OPENFAIL); } dv = &e3Ddevice[unit]; if (dv->ex_present != TRUE) { DEBUG11(("e3Dopen: %d not present\n", unit)); u.u_error = ENXIO; return(OPENFAIL); } if (dv->ex_open == TRUE) { u.u_error = EBUSY; return (OPENFAIL); } x = splstr(); if (e3Dhwinit(dv, unit) == FALSE) { splx(x); u.u_error = ENXIO; return(OPENFAIL); } q->q_ptr = WR(q)->q_ptr = (char *) unit; dv->ex_open = TRUE; dv->ex_up_queue = 0; dv->ex_mc.cnt = 0; dv->ex_hwinited = 1; splx(x); return(unit); } void e3Dclose(queue_t * q) { e3Ddev_t * dev; int unit; int x; unit = (int) q->q_ptr; dev = &e3Ddevice[unit]; DEBUG11(("e3Dclose: board %d\n", unit)); x = splstr(); flushq(WR(q), 1); q->q_ptr = NULL; dev->ex_up_queue = 0; e3Dhwclose(dev); dev->ex_mc.cnt = 0; dev->ex_open = FALSE; dev->ex_hwinited = FALSE; splx(x); } /* * Function: e3Duwput * * Purpose: * Write put routine. */ int e3Duwput(queue_t * q, mblk_t * mp) { DEBUG12(("e3Duwput: type=x%x\n",mp->b_datap->db_type)); switch (mp->b_datap->db_type) { case M_PROTO: case M_PCPROTO: S_macproto(q, mp); break; case M_DATA: S_data(q, mp); break; case M_IOCTL: S_ioctl(q, mp); break; case M_FLUSH: if (*mp->b_rptr & FLUSHW) { flushq(q, FLUSHALL); *mp->b_rptr &= ~FLUSHW; } if (*mp->b_rptr & FLUSHR) { flushq(RD(q), FLUSHALL); qreply(q, mp); } else freemsg(mp); break; default: DEBUG12(("e3Duwput:unknown STR msg type=x%x mp=x%x\n", mp->b_datap->db_type, mp)); freemsg(mp); break; } return; } /* * Function: e3Dinit * * Purpose: * Run presence tests, configure ourselves to match the hardware. */ void e3Dinit() { int i; int unit; e3Drunstate(); for (unit = 0; unit < e3D_nunit; unit++) if (e3Dpresent(unit) == TRUE) { printcfg("e3D", e3Ddevice[unit].ex_ioaddr, ED_IO_SIZE - 1, e3Ddevice[unit].ex_int, -1, "type=3c507 addr=%s", e3Daddrstr(e3Ddevice[unit].ex_eaddr)); e3Ddevice[unit].ex_present = TRUE; } } 07070100023886000081a400000000000000030000000135aefc980000aa9b00001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/drv/mdi/e3D/e3Dmac.c#pragma comment(exestr, "@(#) e3Dmac.c 7.3 94/12/01 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * System V STREAMS TCP - Release 3.0 * * Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI) * All Rights Reserved. * * The copyright above and this notice must be preserved in all copies of this * source code. The copyright above does not evidence any actual or intended * publication of this source code. * * System V STREAMS TCP was jointly developed by Lachman Associates and * Convergent Technologies. */ /* * (C) Copyright 1991 SCO Canada, Inc. * All Rights Reserved. * * The copyright above and this notice must be preserved in all * copies of this source code. The copyright above does not * evidence any actual or intended publication of this source * code. * * This is unpublished proprietary trade secret source code of * SCO Canada, Inc. This source code may not be copied, * disclosed, distributed, demonstrated or licensed except as * expressly authorized by SCO Canada, Inc. * */ #include "sys/types.h" #include "sys/param.h" /* for KERNADDR used in page.h */ #include "sys/sysmacros.h" /* for ctob */ #include "sys/stream.h" #include "sys/immu.h" #include "sys/pit.h" #include "sys/mdi.h" #include "sys/devreg.h" #include "sys/debug.h" #include "bool.h" #include "sys/ipl.h" #ifdef DEBUG #include "sys/xdebug.h" #endif #include "e3D.h" STATIC void e3Dstartru(); /* * Valid RAM configuration widow base and window size settings. */ struct e3Draminfo { u_short ram_setting; /* ram configuration register bits */ caddr_t ram_base; /* ram window base */ u_long ram_size; /* ram window size */ }; STATIC struct e3Draminfo e3Draminfo[] = { { HRAM_0C0_16KB, (caddr_t) 0x0C0000, 16*1024, }, { HRAM_0C0_32KB, (caddr_t) 0x0C0000, 32*1024, }, { HRAM_0C0_48KB, (caddr_t) 0x0C0000, 48*1024, }, { HRAM_0C0_64KB, (caddr_t) 0x0C0000, 64*1024, }, { HRAM_0C8_16KB, (caddr_t) 0x0C8000, 16*1024, }, { HRAM_0C8_32KB, (caddr_t) 0x0C8000, 32*1024, }, { HRAM_0C8_48KB, (caddr_t) 0x0C8000, 48*1024, }, { HRAM_0C8_64KB, (caddr_t) 0x0C8000, 64*1024, }, { HRAM_0D0_16KB, (caddr_t) 0x0D0000, 16*1024, }, { HRAM_0D0_32KB, (caddr_t) 0x0D0000, 32*1024, }, { HRAM_0D0_48KB, (caddr_t) 0x0D0000, 48*1024, }, { HRAM_0D0_64KB, (caddr_t) 0x0D0000, 64*1024, }, { HRAM_0D8_16KB, (caddr_t) 0x0D8000, 16*1024, }, { HRAM_0D8_32KB, (caddr_t) 0x0D8000, 32*1024, }, { HRAM_F00_64KB, (caddr_t) 0xF00000, 64*1024, }, { HRAM_F20_64KB, (caddr_t) 0xF20000, 64*1024, }, { HRAM_F40_64KB, (caddr_t) 0xF40000, 64*1024, }, { HRAM_F60_64KB, (caddr_t) 0xF60000, 64*1024, }, { HRAM_F80_64KB, (caddr_t) 0xF80000, 64*1024, }, }; #define RAMINFO_CNT (sizeof(e3Draminfo)/sizeof(struct e3Draminfo)) /* * Valid interrupt request level settings. */ struct e3Dirinfo { u_short ir_setting; /* interrupt configuration register bits */ u_short ir_level; /* interrupt request level */ }; STATIC struct e3Dirinfo e3Dirinfo[] = { { HINT_IRL3, 3, }, { HINT_IRL5, 5, }, { HINT_IRL7, 7, }, { HINT_IRL9, 9, }, { HINT_IRL10, 10, }, { HINT_IRL11, 11, }, { HINT_IRL12, 12, }, { HINT_IRL15, 15, }, }; #define IRINFO_CNT (sizeof(e3Dirinfo)/sizeof(struct e3Dirinfo)) /* * Function: S_test_init_complete * * Purpose: * Return whether 82586 has completed initialization. */ static int S_test_init_complete(struct scb * scb) { return (scb->scb_status == RESET_OK_BITS ? TRUE : FALSE); } /* * Function: S_test_cmd_clear * * Purpose: * Return whether the SCB command word has cleared, signifying * that the 82586 has no more pending control commands. */ static int S_test_cmd_clear(struct scb * scb) { return (scb->scb_command == 0 ? TRUE : FALSE); } /* * Function: S_test_cmd_complete * * Purpose: * Return whether the command status indicates that the command * has completed. */ static int S_test_cmd_complete(union cbu * cbu) { return ((cbu->cbl.cbl_status & CBL_C_BIT) ? TRUE : FALSE); } /* * Function: S_test_ru_ready * * Purpose: * Return whether the receive unit is ready. */ static int S_test_ru_ready(struct scb * scb) { return (((scb->scb_status & SCB_RUS_MASK) == SCB_RUS_READY) ? TRUE : FALSE); } /* * Function: S_poll * * Purpose: * continue to call (*func)() until it returns TRUE, or timeout_length * useconds have elapsed. * * Parameters: * func: a routine which returns TRUE when * its condition is satisfied, FALSE otherwise * arg: argument passed to func, unconditionally * timeout_length: positive timeout value in ticks (1/100th) * * Returns: * TRUE: func returned TRUE before timeout_length * FALSE: timeout_length expired before func returned TRUE * * Notes: * 1) The test below "while (lbolt - start_time <= timeout_length)" means that * this spin loop will execute for a maximum time of at least * "timeout_length" ticks. The "at least" part is the residual time left * in the current tick. Note: lbolt can be negative, so the test was * changed to use subtraction, which in 2's complement arithmetic yields * the desired result. * * 2) The motivation behind this routine is to give a processor-speed * independent method of polling a hardware register for a bounded * period of time. The assumption is that if S_poll() returns * FALSE, the h/w has gone belly up, so the only thing left to do * is to shut the h/w down, and do some sort of error handling. */ static int S_poll(int (*func)(), void *arg, int timeout_length) { extern volatile time_t lbolt; time_t start_time; start_time = lbolt; while (lbolt - start_time <= timeout_length) { if ((*func)(arg) == TRUE) return (TRUE); } return (FALSE); } /* * Function: S_memvalid * * Purpose: * Test the newly mapped in memory to see if we can write/read * to it. * * Returns: * TRUE if memory valid, FALSE otherwise. */ static int S_memvalid(caddr_t startp, int len) { register u_short *cp; register u_short *end; cp = (u_short *) startp; end = cp + (len / sizeof(u_short)); while (cp < end) *(cp++) = MEMTST_PATTERN; cp = (u_short *) startp; while (cp < end) { if (*(cp++) != MEMTST_PATTERN) { DEBUG00(("memtst failed i %d => %x\n", cp - (u_short *) startp, *cp)); return (FALSE); } } cp = (u_short *) startp; while (cp < end) *(cp++) = 0; return (TRUE); } /* * Function: S_isvalid_3COM_sig * * Purpose: * Ensure that the signature is a valid 3COM signature. * * Returns: * TRUE if valid, FALSE otherwise. * */ static int S_isvalid_3COM_sig(e3Ddev_t * dv) { static char e3Dsig[] = "*3COM*"; int i; DEBUG00(("signature x%b x%b x%b x%b x%b x%b\n", inb(ED_NM_DATA(dv)+0), inb(ED_NM_DATA(dv)+1), inb(ED_NM_DATA(dv)+2), inb(ED_NM_DATA(dv)+3), inb(ED_NM_DATA(dv)+4), inb(ED_NM_DATA(dv)+5))); for (i = 0; i < HNM_SIZE; i++) { if ((inb(ED_NM_DATA(dv) + i) & 0xff) != e3Dsig[i]) { DEBUG00(("e3D%d: Incorrect 3COM signature\n", dv - e3Ddevice)); return (FALSE); } } return (TRUE); } /* * Function: S_find_ram_setting * * Purpose: * Return the shared ram information for the given ram setting. * * Returns: * Pointer to ram information structure if found, NULL otherwise. */ static struct e3Draminfo * S_get_ram_info(int ram_setting) { int i; for (i = 0; i < RAMINFO_CNT; i++) if (ram_setting == e3Draminfo[i].ram_setting) return (e3Draminfo + i); return (NULL); } /* * Function: S_get_irq * * Purpose: * Find the irq for the given interrupt setting. * * Returns: * The irq level if found, -1 otherwise. */ static int S_get_irq(int ir_setting) { int i; for (i = 0; i < IRINFO_CNT; i++) if (ir_setting == e3Dirinfo[i].ir_setting) return (e3Dirinfo[i].ir_level); return (-1); } /* * Function: S_read_eaddr * * Purpose: * Read the ethernet mac address from the card's EEPROM. */ static void S_read_eaddr(e3Ddev_t * dv, macaddr_t ea) { int i; SELECT_EADDR(dv); for (i = 0; i < sizeof(macaddr_t); i++) ea[i] = inb(ED_NM_DATA(dv) + i); SELECT_SIGNAT(dv); } /* * Function: e3Dpresent * * Purpose: * This is the probe/config routine for the e3D (3COM 507) network * card. This routine reads the appropriate io base address from * the link kit. This base address is then used to check for * board presence, and read the rest of the configuration from the * card. * * Returns: * Fills in information in the e3Ddev_t structure: * ex_int * ex_ioaddr * ex_base * ex_memsize * ex_rambase * ex_creg2 * ex_romr2 * ex_ramr2 * ex_intr2 * ex_eaddr * * Returns TRUE if board is present/OK, FALSE otherwise. * * Notes: * * At this point the board must be already configured * with the parameters read from the on-board EEPROM and * must be in the RUN state. The control register must be * in the default state (all zeroes). * * The driver completely relies on the configuration * parameters stored in the on-board EEPROM. */ int e3Dpresent(int unit) { e3Ddev_t * dv; int ir_level; int ir_setting; struct e3Draminfo * ram_info; int ram_setting; dv = &e3Ddevice[unit]; /* get iobase address - netboot parameters override link-kit */ if ((dv->ex_ioaddr = mdi_netboot_info("e3D", unit, "io")) <= 0) dv->ex_ioaddr = e3Diobase[unit]; /* make sure that this is an e3D card we're talking to */ if (S_isvalid_3COM_sig(dv) == FALSE) { if (!mdi_netboot_quiet("e3D", unit)) printcfg("e3D", dv->ex_ioaddr, ED_IO_SIZE - 1, -1, -1, "NO BOARD PRESENT"); return (FALSE); } /* initialize copies of board registers */ DEBUG00(("probe: unit %d: ED_CNTRL is at x%x\n", unit, ED_CNTRL(dv))); dv->ex_creg2 = ((u_char) inb(ED_CNTRL(dv))) | HCTL_RST; dv->ex_romr2 = (u_char) inb(ED_ROM_CONF(dv)); dv->ex_ramr2 = (u_char) inb(ED_RAM_CONF(dv)); dv->ex_intr2 = (u_char) inb(ED_INT_CONF(dv)); DEBUG00(("cr x%b romr x%b ramr x%b icr x%b\n", dv->ex_creg2, dv->ex_romr2, dv->ex_ramr2, dv->ex_intr2)); /* * Initialize the Control Register * The 8 bit setting only takes effect if Standard mode is * used in the setup program, otherwise 16-bit operation takes place * automatically. Essentially, this setup is required to support * the 8/16 bit mode toggle in the setup program. */ DEVICE_8BIT(dv); /* initialize the ram setting */ ram_setting = GET_RAMCONF(dv); if ((ram_info = S_get_ram_info(ram_setting)) == NULL) { if (!mdi_netboot_quiet("e3D", unit)) printcfg("e3D", dv->ex_ioaddr, ED_IO_SIZE - 1, -1, -1, "INVALID RAM CONFIGURATION RC5-RC0=0x%b", ram_setting); return (FALSE); } dv->ex_base = ram_info->ram_base; dv->ex_memsize = ram_info->ram_size; DEBUG00(("base x%x size %d\n", dv->ex_base, dv->ex_memsize)); /* map the board memory into virtual address space */ if ((dv->ex_rambase = (caddr_t) sptalloc(btoc(dv->ex_memsize), PG_P, pfnum(dv->ex_base), NOSLEEP)) == NULL) { if (!mdi_netboot_quiet("e3D", unit)) printcfg("e3D", dv->ex_ioaddr, ED_IO_SIZE - 1, -1, -1, "UNABLE TO ALLOC RAM (0x%x - 0x%x)", dv->ex_base, dv->ex_base + dv->ex_memsize - 1); return (FALSE); } DEBUG00(("rambase x%x\n", dv->ex_rambase)); /* verify board's memory */ DEBUG00(("Started memory test\n")); if (S_memvalid(dv->ex_rambase, dv->ex_memsize) == FALSE) { if (!mdi_netboot_quiet("e3D", unit)) printcfg("e3D", dv->ex_ioaddr, ED_IO_SIZE - 1, -1, -1, "MEMORY TEST FAILED (0x%x - 0x%x)", dv->ex_base, dv->ex_base + dv->ex_memsize - 1); return (FALSE); } DEBUG00(("Memory tests passed\n")); /* read the interrupt level */ ir_setting = GET_INTLEVEL(dv); if ((ir_level = S_get_irq(ir_setting)) == -1) { if (!mdi_netboot_quiet("e3D", unit)) printcfg("e3D", dv->ex_ioaddr, ED_IO_SIZE - 1, -1, -1, "INVALID INTERRUPT LEVEL IL3-IL0=0x%b", ir_setting); return (FALSE); } dv->ex_int = ir_level; if (add_intr_handler(1, dv->ex_int, e3Dintr, SPL5) != 0) { printcfg("e3D", dv->ex_ioaddr, ED_IO_SIZE - 1, -1, -1, "UNABLE TO ADD INTR HANDLER (%d)", dv->ex_int); return (FALSE); } /* * set the ethernet mac address. use the link-kit override if it is * non-zero, otherwise read the address from the card. */ if (e3Deth_addr[unit][0] != '\0') bcopy(e3Deth_addr[unit], dv->ex_eaddr, sizeof(dv->ex_eaddr)); else S_read_eaddr(dv, dv->ex_eaddr); DEBUG00(("eaddr x%b x%b x%b x%b x%b x%b\n", dv->ex_eaddr[0], dv->ex_eaddr[1], dv->ex_eaddr[2], dv->ex_eaddr[3], dv->ex_eaddr[4], dv->ex_eaddr[5])); return (TRUE); } /* * Function: e3Dhwinit * * Purpose: * Set up the 82586 data structures in the shared memory, * initialize the hardware to a known, running state. */ int e3Dhwinit(e3Ddev_t * dv, int unit) { struct control *cntl; struct scp *scp; struct iscp *iscp; struct scb *scb; union cbu *cbu; struct rfd *rfd; struct rbd *rbd; struct tcb *tcb; struct tbd *tbd; register int i; long memleft; caddr_t memfree; int n16kblocks; DEBUG01(("hwinit: unit %d ram 0x%x len %d\n", unit, dv->ex_rambase, dv->ex_memsize)); ASSERT(dv->ex_memsize <= BRD_MAXWINSIZE); ASSERT(dv->ex_memsize >= BRD_MINWINSIZE); dv->ex_flags = 0; /* * Depending on the size of the memory window, determine the * location and count of the control structures for the 82586. * SCP is always at the end of the memory window. */ memfree = dv->ex_rambase; memleft = dv->ex_memsize - sizeof(struct scp); dv->ex_control = (struct control *)memfree; memfree += sizeof(struct control); memleft -= sizeof(struct control); #ifdef DUMP_82586_REGS dv->ex_dumpbuf = (dump_buf *)memfree; memfree += sizeof(dump_buf); memleft -= sizeof(dump_buf); #endif n16kblocks = dv->ex_memsize / BRD_MINWINSIZE; dv->ex_ntcb = TCB_MIN * n16kblocks; dv->ex_tcb = (struct tcb *)memfree; memfree += sizeof(struct tcb) * dv->ex_ntcb; memleft -= sizeof(struct tcb) * dv->ex_ntcb; dv->ex_ntbd = TBD_MIN * n16kblocks; dv->ex_tbd = (struct tbd *)memfree; memfree += sizeof(struct tbd) * dv->ex_ntbd; memleft -= sizeof(struct tbd) * dv->ex_ntbd; dv->ex_ntbuff = dv->ex_ntbd; dv->ex_tbuff = (struct tbuff *)memfree; memfree += sizeof(struct tbuff) * dv->ex_ntbuff; memleft -= sizeof(struct tbuff) * dv->ex_ntbuff; dv->ex_nrfd = RFD_MIN * n16kblocks; dv->ex_rfd = (struct rfd *)memfree; memfree += sizeof(struct rfd) * dv->ex_nrfd; memleft -= sizeof(struct rfd) * dv->ex_nrfd; dv->ex_nrbd = memleft / (sizeof(struct rbd)+sizeof(struct rbuff)); dv->ex_rbd = (struct rbd *)memfree; memfree += sizeof(struct rbd) * dv->ex_nrbd; memleft -= sizeof(struct rbd) * dv->ex_nrbd; dv->ex_nrbuff = dv->ex_nrbd; dv->ex_rbuff = (struct rbuff *)memfree; memfree += sizeof(struct rbuff) * dv->ex_nrbuff; memleft -= sizeof(struct rbuff) * dv->ex_nrbuff; DEBUG01(("cntl=0x%x cntlsz=%d n16k=%d\n", dv->ex_control, sizeof(struct control), n16kblocks)); #ifdef DUMP_82586_REGS DEBUG01(("dump=0x%x dumpsz=%d\n", dv->ex_dumpbuf, sizeof(dump_buf))); #endif DEBUG01(("ntcb=%d tcb=0x%x tcbsz=%d\n", dv->ex_ntcb, dv->ex_tcb, sizeof(struct tcb))); DEBUG01(("ntbd=%d tbd=0x%x tbdsz=%d\n", dv->ex_ntbd, dv->ex_tbd, sizeof(struct tbd))); DEBUG01(("ntbuff=%d tbuff=0x%x tbuffsz=%d\n", dv->ex_ntbuff, dv->ex_tbuff, sizeof(struct tbuff))); DEBUG01(("nrfd=%d rfd=0x%x rfdsz=%d\n", dv->ex_nrfd, dv->ex_rfd, sizeof(struct rfd))); DEBUG01(("nrbd=%d rbd=0x%x rbdsz=%d\n", dv->ex_nrbd, dv->ex_rbd, sizeof(struct rbd))); DEBUG01(("nrbuff=%d rbuff=0x%x rbuffsz=%d\n", dv->ex_nrbuff, dv->ex_rbuff, sizeof(struct rbuff))); DEBUG01(("memfree=x%x memleft=%d\n", memfree, memleft)); /* * Now we must set up the control structures for the 82586 on * the board, and kick it to life. * The last byte of the RAM window accesible by the host always * appears at address 0xFFFF (highest) in the 82586's address space. */ /* Set up the System Control Pointer */ scp = (struct scp *) BADDR_TO_VADDR(dv, SCP_BADDR); bzero(scp, sizeof(struct scp)); scp->scp_sysbus = SYSBUS_16BIT; scp->scp_iscpaddrl = VADDR_TO_BADDR(dv, dv->ex_control); scp->scp_iscpaddrh = 0; DEBUG01(("scp=x%x bus=x%x adrl=x%x adrh=x%x\n", scp, scp->scp_sysbus, scp->scp_iscpaddrl, scp->scp_iscpaddrh)); cntl = dv->ex_control; bzero(cntl, sizeof (struct control)); /* Set up the Immediate System Control Pointer */ iscp = &cntl->iscp; iscp->iscp_busy = 1; iscp->iscp_reserved = 0; iscp->iscp_scboffset = sizeof(struct iscp); iscp->iscp_scbbasel = VADDR_TO_BADDR(dv, cntl); iscp->iscp_scbbaseh = 0; DEBUG01(("iscp=x%x ofs=x%x basel=x%x baseh=x%x\n", iscp, iscp->iscp_scboffset, iscp->iscp_scbbasel, iscp->iscp_scbbaseh)); /* Set up the System Control Block */ /* * It should be noted that we are setting things up with 2 command * buffer chains. * * The Command Block chain is only one element long, and is used by * the driver itself to perform some board action (like setting the * ethernet address), or multicast set-up. * * The Transmit Control block chain is a linked list of transmit * command buffers. This is the chain that is used for putting * packets onto the ethernet. * * We initialize the scb pointing to the CBL since we are soon going * to issue DIAGNOSE and IASETUP commands and will need our special * buffer. */ scb = &cntl->scb; scb->scb_cbl_ofst = VADDR_TO_BOFF(dv, &cntl->cbu); scb->scb_rfd_ofst = VADDR_TO_BOFF(dv, dv->ex_rfd); DEBUG01(("scb=x%x cblofs=x%x rfdofs=x%x\n", scb, scb->scb_cbl_ofst, scb->scb_rfd_ofst)); /* Set up the Command Block */ cbu = &cntl->cbu; cbu->cbl.cbl_command = CBL_EL_BIT; cbu->cbl.cbl_link = VADDR_TO_BOFF(dv, cbu); /* Set up kernel pointer */ dv->ex_cbuhead = cbu; /* Set up the Transmit Command Blocks */ tcb = dv->ex_tcb; for (i = 0; i < dv->ex_ntcb; i++, tcb++) { tcb->tcb_status = 0; tcb->tcb_command = CMD_TRANSMIT | TCB_EL_BIT | TCB_I_BIT; tcb->tcb_link = VADDR_TO_BOFF(dv, tcb+1); tcb->tcb_tbdoffset = VADDR_TO_BOFF(dv, &dv->ex_tbd[i]); tcb->tcb_len = 0; } /* Now back up to the last TCB, and link it to the first */ tcb--; tcb->tcb_link = VADDR_TO_BOFF(dv, dv->ex_tcb); /* Set the kernel xmit list pointers */ dv->ex_tcbhead = dv->ex_tcb; dv->ex_tcbnext = dv->ex_tcb; dv->ex_tcbtail = dv->ex_tcb + dv->ex_ntcb - 1; /* Set up the Transmit Buffer Descriptors */ tbd = dv->ex_tbd; for (i = 0; i < dv->ex_ntbd; i++, tbd++) { tbd->tbd_count = TBD_EOF_BIT; tbd->tbd_link = NULL_OFFSET; tbd->tbd_xbuffpl = VADDR_TO_BADDR(dv, dv->ex_tbuff + i); tbd->tbd_xbuffph = 0; } /* Set up the Receive Frame Descriptors */ rfd = dv->ex_rfd; for (i = 0; i < dv->ex_nrfd; i++, rfd++) { rfd->rfd_status = 0; rfd->rfd_cntl = 0; rfd->rfd_link = VADDR_TO_BOFF(dv, rfd+1); rfd->rfd_rbd_ofst = NULL_OFFSET; } /* * Now we want to set the End of List flag in the last rfd, and * make the rbd_ofst field of the first rfd point to the list of * rbd's as required by the 82586 spec. */ rfd--; rfd->rfd_link = VADDR_TO_BOFF(dv, dv->ex_rfd); rfd->rfd_cntl = RFD_EL_BIT; rfd = dv->ex_rfd; rfd->rfd_rbd_ofst = VADDR_TO_BOFF(dv, dv->ex_rbd); /* Set the kernel frame descriptor list pointers */ dv->ex_rfdhead = dv->ex_rfd; dv->ex_rfdtail = dv->ex_rfd + dv->ex_nrfd - 1; /* Set up the Receive Buffer Descriptors */ rbd = dv->ex_rbd; for (i = 0; i < dv->ex_nrbd; i++, rbd++) { rbd->rbd_status = 0; rbd->rbd_link = VADDR_TO_BOFF(dv, rbd+1); rbd->rbd_rbaddrl = VADDR_TO_BADDR(dv, dv->ex_rbuff + i); rbd->rbd_rbaddrh = 0; rbd->rbd_rbuffsize = sizeof(struct rbuff); } /* Terminate the list */ rbd--; rbd->rbd_link = VADDR_TO_BOFF(dv, dv->ex_rbd); rbd->rbd_rbuffsize |= RBD_EL_BIT; /* Set the kernel buffer descriptor list pointers */ dv->ex_rbdhead = dv->ex_rbd; dv->ex_rbdtail = dv->ex_rbd + dv->ex_nrbd - 1; DEBUG07(("rlst: fh %x ft %x bh %x bf %x\n", dv->ex_rfdhead, dv->ex_rfdtail, dv->ex_rbdhead, dv->ex_rbdtail)); /* Finally. We now have a set of valid 82586 data structures. */ /* start up the 586 */ SEND_586CA(dv); scb = &cntl->scb; if (S_poll(S_test_init_complete, scb, E3D_POLL) == FALSE) { printf("e3D%d: 82586 INIT failed. iscp.busy x%x Status x%x\n", unit, iscp->iscp_busy, scb->scb_status); RESET_586(dv); return (FALSE); } scb->scb_command = RESET_OK_BITS; SEND_586CA(dv); if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3D%d: 82586 INIT failed. Status x%x\n", unit, scb->scb_status); RESET_586(dv); return (FALSE); } DEBUG01(("586 is up and running!\n")); /* * Run the 82586 internal self test to insure it is working. */ cbu->diag.diag_command = CMD_DIAGNOSE | CBL_EL_BIT; cbu->diag.diag_status = 0; scb->scb_command = SCB_CUC_START; SEND_586CA(dv); if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3D%d: DIAGNOSE timeout. Status x%x\n", unit, scb->scb_status); RESET_586(dv); return (FALSE); } DEBUG01(("diag_status x%x\n", cbu->diag.diag_status)); if (S_poll(S_test_cmd_complete, cbu, E3D_POLL) == FALSE) { printf("e3D%d: DIAGNOSE failed. diagstatus x%x scbstatus x%x\n", unit, cbu->diag.diag_status, scb->scb_status); RESET_586(dv); return (FALSE); } DEBUG01(("DIAGNOSE done diag_status x%x scbstatus x%x\n", cbu->diag.diag_status, scb->scb_status)); scb->scb_command = CMD_UNIT_ACK; SEND_586CA(dv); if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3D%d: DIAGNOSE ack failed. Status x%x\n", unit, scb->scb_status); RESET_586(dv); return (FALSE); } /* * set the ethernet address in the 82586 */ cbu->ias.ias_command = CMD_IASETUP | CBL_EL_BIT; cbu->ias.ias_status = 0; bcopy((caddr_t) dv->ex_eaddr, (caddr_t) cbu->ias.ias_addr, sizeof(cbu->ias.ias_addr)); DEBUG01(("iasetup addr %s\n", e3Daddrstr(cbu->ias.ias_addr))); scb->scb_command = SCB_CUC_START; SEND_586CA(dv); if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3D%d: IASETUP timeout. Status x%x\n", unit, scb->scb_status); RESET_586(dv); return (FALSE); } DEBUG01(("ias_status x%x\n", cbu->ias.ias_status)); if (S_poll(S_test_cmd_complete, cbu, E3D_POLL) == FALSE) { printf("e3D%d: IASETUP failed. iastatus x%x scbstatus x%x\n", unit, cbu->ias.ias_status, scb->scb_status); RESET_586(dv); return (FALSE); } DEBUG01(("IASETUP done iastatus x%x scbstatus x%x\n", cbu->ias.ias_status, scb->scb_status)); scb->scb_command = CMD_UNIT_ACK; SEND_586CA(dv); if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3D%d: IASETUP ack failed. Status x%x\n", unit, scb->scb_status); RESET_586(dv); return (FALSE); } /* Ta Da! We are now running */ /* Prepare for xmits */ scb->scb_cbl_ofst = VADDR_TO_BOFF(dv, dv->ex_tcb); /* Start reception of frames */ scb->scb_command = SCB_RUC_START; SEND_586CA(dv); if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3D%d: RUC_START cmdclr timeout. Status x%x\n", unit, scb->scb_status); RESET_586(dv); return (FALSE); } DEBUG01(("hwinit done scbstatus x%x\n", scb->scb_status)); CLR_586INT(dv); ENABLE_586INT(dv); #ifdef DUMP_82586_REGS e3Ddumpregs(unit); #endif return (TRUE); } /* * Function: e3Dhwclose * * Purpose: * Shut the board down. */ void e3Dhwclose(e3Ddev_t * dv) { /* Disable interrupts from ethernet controller */ DISABL_586INT(dv); RESET_586(dv); } /* * Function: e3Dstartcu * * Purpose: * Start the 82586 command unit. */ STATIC void e3Dstartcu(e3Ddev_t * dv) { register struct scb * scb; DEBUG04(("e3Dstartcu: flags %x\n", dv->ex_flags)); scb = &dv->ex_control->scb; scb->scb_cbl_ofst = VADDR_TO_BOFF(dv, (dv->ex_flags & ED_CBLREADY) ? dv->ex_cbuhead : (union cbu *) dv->ex_tcbhead); DEBUG04(("head %x -> off %x\n", (dv->ex_flags & ED_CBLREADY) ? dv->ex_cbuhead : (union cbu *) dv->ex_tcbhead, scb->scb_cbl_ofst)); scb->scb_command = SCB_CUC_START; SEND_586CA(dv); dv->ex_flags |= ED_CUWORKING; if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3Dstartcu cmd start timeout\n"); dv->ex_hwinited = 0; /* mark card down */ return; } } /* * Function: e3Dstartru * * Purpose: * Start the 82586's receive unit. */ STATIC void e3Dstartru(e3Ddev_t * dv, struct scb * scb) { struct rfd * rfd; struct rbd * rbd; DEBUG07(("e3Dstartru status %x\n", scb->scb_status)); rfd = dv->ex_rfdhead; if (rfd->rfd_cntl & RFD_EL_BIT) { /* Less than 2 rfd's, don't start recv unit */ DEBUG07(("not enough rfd's\n")); return; } ASSERT((rfd->rfd_cntl & RFD_EL_BIT) == 0); rbd = dv->ex_rbdhead; if (rbd->rbd_rbuffsize & RBD_EL_BIT) { /* Less than 2 rbd's, don't start recv unit */ DEBUG07(("not enough rbd's\n")); return; } ASSERT((rbd->rbd_rbuffsize & RBD_EL_BIT) == 0); DEBUG07(("rbd_ofst set to %x -> %x\n", rbd, VADDR_TO_BOFF(dv, rbd))); rfd->rfd_rbd_ofst = VADDR_TO_BOFF(dv, rbd); DEBUG07(("rfd_ofst set to %x -> %x\n", rfd, VADDR_TO_BOFF(dv, rfd))); scb->scb_rfd_ofst = VADDR_TO_BOFF(dv, rfd); scb->scb_command = SCB_RUC_START; SEND_586CA(dv); if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3Dstartru: cmd clear timeout"); dv->ex_hwinited = 0; /* mark card down */ return; } if (S_poll(S_test_ru_ready, scb, E3D_POLL) == FALSE) { printf("e3Dstartru: ru ready timeout"); dv->ex_hwinited = 0; /* mark card down */ return; } } /* * Function: e3Doktoput * * Purpose: * Routine to check whether there are any free blocks on the transmit * queue. If there are, it is OK to call e3Dhwput(). The main reason * for the routine is to avoid doing getq()'s and putbq()'s unnecessarily. * * Returns: * TRUE if ok to call e3Dhwput(), FALSE otherwise. * * Note: * You must splstr() around the calls. */ int e3Doktoput(e3Ddev_t * dev) { if (dev->ex_flags & ED_BUFSBUSY) return (FALSE); return (TRUE); } /* * Function: e3Dhwput * * Purpose: * Copy frame to board and send it. * * Note: * Must call e3Doktoput() before calling to * ensure that there are buffers available. */ void e3Dhwput(e3Ddev_t * dv, mblk_t * m) { register u_char * dp; register e_frame_t * eh; register uint len; mac_stats_eth_t * mst; register struct tbd * tbd; register struct tcb * tcb; register uint tlen; ASSERT(!(dv->ex_flags & ED_BUFSBUSY)); mst = &dv->ex_macstats; DEBUG08(("hwput(%d, x%x) len %d\n", dv - e3Ddevice, m, m->b_wptr - m->b_rptr)); ASSERT(m->b_wptr - m->b_rptr >= sizeof(e_frame_t)); tcb = dv->ex_tcbnext; tcb->tcb_status = 0; eh = (e_frame_t *) m->b_rptr; m->b_rptr += sizeof (e_frame_t); /* the first message block probably has only the Ethernet header */ if ((m->b_wptr - m->b_rptr) == 0) m = m->b_cont; tbd = (struct tbd *) BOFF_TO_VADDR(dv, tcb->tcb_tbdoffset); dp = (u_char *) BADDR_TO_VADDR(dv, tbd->tbd_xbuffpl); len = 0; while (m) { len += (tlen = m->b_wptr - m->b_rptr); if (len > E3D_MAXPACK) break; bcopy((caddr_t) m->b_rptr, (caddr_t) dp, tlen); DEBUG08(("data %x %x %x %x %x\n", dp[0], dp[1], dp[2], dp[3], dp[4])); dp += tlen; m = m->b_cont; } DEBUG08(("hwput len %d\n", len)); if (len > E3D_MAXPACK) { return; } /* the frame size does not include the frame header */ if (len < E3D_MINPACK) { bzero((caddr_t) dp, E3D_MINPACK - len); len = E3D_MINPACK; } bcopy((caddr_t) eh->eh_daddr, (caddr_t) tcb->tcb_dstaddr, sizeof(eh->eh_daddr)); tcb->tcb_len = eh->eh_type; DEBUG08(("hwput typ %x dst %s\n", tcb->tcb_len, e3Daddrstr(tcb->tcb_dstaddr))); tbd->tbd_count = len | TBD_EOF_BIT; DEBUG08(("head %x next %x tail %x\n", dv->ex_tcbhead, dv->ex_tcbnext, dv->ex_tcbtail)); if (!(dv->ex_flags & ED_CUWORKING)) e3Dstartcu(dv); /* * If this is the last transmit buffer, mark transmit buffers full, * otherwise, advance the next available transmit buffer pointer. */ if (tcb == dv->ex_tcbtail) dv->ex_flags |= ED_BUFSBUSY; else dv->ex_tcbnext = (struct tcb *) BOFF_TO_VADDR(dv, tcb->tcb_link); return; } /* * Function: S_int_to_board * * Purpose: * Translate interrupt level to board number. */ static int S_int_to_board(int level) { register int i; for (i = 0; i < e3D_nunit; i++) if (e3Ddevice[i].ex_int == level) return (i); return (-1); } /* * Function: e3Dintr * * Purpose: * Interrupt service routine for the e3D. We are interrupted * whenever a command is completed and whenever a frame is received. * We loop checking for valid receive frame descriptors (corresponding * to a valid, received frame) in the rfd queue. We also check for * having completed a command. A command will be a transmit, or * an mcsetup. */ void e3Dintr(int lev) { u_long done_work = 0; register e3Ddev_t * dv; register mac_stats_eth_t * mst; register mblk_t * mp; register struct scb * scb; register status; int unit; if ((unit = S_int_to_board(lev)) < 0) { printf("e3Dintr: unexpected interrupt\n"); return; } dv = &e3Ddevice[unit]; mst = &dv->ex_macstats; scb = &dv->ex_control->scb; DEBUG03(("e3Dintr(0%o): unit %d\n", lev, unit)); if (!dv->ex_hwinited) /* card is down */ return; ASSERT(scb->scb_command == 0); while (TRUE) { /* check for another frame received, transmitted */ CLR_586INT(dv); status = scb->scb_status; DEBUG03(("check_again status x%x\n", status)); /* Ack the 586 interrupt */ scb->scb_command = status & SCB_INT_BITS; SEND_586CA(dv); if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3Dintr: interrupt ack timeout\n"); dv->ex_hwinited = 0; /* mark card down */ return; } if (status & RECVUNIT_INT) { /* We have received a frame */ register struct rfd *rfd; register struct rbd *rp, *rbd; register uint len; register u_char *sp, *dp; register e_frame_t *eh; register s; done_work = 1; /* * read the error counters */ if (scb->scb_rsc_errs) { mst->mac_no_resource += scb->scb_rsc_errs; scb->scb_rsc_errs = 0; } if (scb->scb_crc_errs) { mst->mac_badsum += scb->scb_crc_errs; scb->scb_crc_errs = 0; } if (scb->scb_aln_errs) { mst->mac_align += scb->scb_aln_errs; scb->scb_aln_errs = 0; } if (scb->scb_ovr_errs) { mst->mac_baddma += scb->scb_ovr_errs; scb->scb_ovr_errs = 0; } while (TRUE) { /* continue processing frames */ #ifdef CHECK_82586_CRASHED { register struct iscp *iscp = &dv->ex_control->iscp; ASSERT(iscp->iscp_reserved == 0); ASSERT(iscp->iscp_scboffset == sizeof(struct iscp)); ASSERT(iscp->iscp_scbbasel == VADDR_TO_BADDR(dv, dv->ex_control)); } #endif mp = NULL; rfd = dv->ex_rfdhead; DEBUG04(("recv: rfd x%x\n", rfd)); s = rfd->rfd_status; if (!(s & RFD_C_BIT)) { /* no more frames ready right now */ DEBUG04(("C_BIT clr")); if ((scb->scb_status & SCB_RUS_MASK) != SCB_RUS_READY) e3Dstartru(dv, scb); break; /* out of while (TRUE) */ } /* Now we are sure we have a frame */ dv->ex_rfdhead = (struct rfd *)BOFF_TO_VADDR(dv, rfd->rfd_link); rbd = (struct rbd *) BOFF_TO_VADDR(dv, rfd->rfd_rbd_ofst); DEBUG04(("rbd x%x\n", rbd)); if (!(s & RFD_OK_BIT)) { DEBUG04(("recv err x%x\n", s)); if (s & RFD_SHORT_BIT) mst->mac_badlen++; } /* Now find and process the data */ if (rfd->rfd_rbd_ofst == NULL_OFFSET) goto return_rfds; ASSERT(rbd == dv->ex_rbdhead); /* * check for broadcast and filter multicast addresses * the 82586 does not have perfect multicast address filtering */ if (ISBROADCAST(rfd->rfd_dstaddr)) ; else if (ISMULTICAST(rfd->rfd_dstaddr)) if (mdi_in_mctbl(&dv->ex_mc, rfd->rfd_dstaddr) == -1) goto return_rbds_clear; rp = rbd; len = 0; for (;;) { ASSERT(rp->rbd_status & RBD_F_BIT); ASSERT(rp->rbd_status & RBD_PKTLEN_BITS); len += rp->rbd_status & RBD_PKTLEN_BITS; if (rp->rbd_status & RBD_EOF_BIT) break; ASSERT((rp->rbd_rbuffsize & RBD_EL_BIT) == 0); rp = (struct rbd *) BOFF_TO_VADDR(dv, rp->rbd_link); } DEBUG04(("len %d\n", len)); /* frame header is in rfd, not part of the recv frame */ len += sizeof(e_frame_t); if ((mp = allocb(len, BPRI_HI)) == NULL) { DEBUG04(("allocb failed\n")); mst->mac_frame_nosr++; goto return_rbds_clear; } mp->b_wptr = mp->b_rptr + len; /* Copy the frame header from the rfd to the mblock */ eh = (e_frame_t *) mp->b_rptr; bcopy ((caddr_t) rfd->rfd_dstaddr, (caddr_t) eh->eh_daddr, sizeof(eh->eh_daddr)); bcopy ((caddr_t) rfd->rfd_srcaddr, (caddr_t) eh->eh_saddr, sizeof(eh->eh_saddr)); eh->eh_type = rfd->rfd_length; dp = mp->b_rptr + sizeof (e_frame_t); DEBUG06(("src %s ", e3Daddrstr(eh->eh_saddr))); DEBUG06(("dst %s ", e3Daddrstr(eh->eh_daddr))); DEBUG06(("typ/len x%x\n", eh->eh_type)); /* Copy the data from receive buffer to the mblock */ rp = rbd; for (;;) { sp = (u_char *) BADDR_TO_VADDR(dv, rp->rbd_rbaddrl); ASSERT(rp->rbd_status & RBD_F_BIT); len = rp->rbd_status & RBD_PKTLEN_BITS; DEBUG04(("copy %d from %x to %x\n", len, sp, dp)); bcopy ((caddr_t) sp, (caddr_t) dp, len); dp += len; if (rp->rbd_status & RBD_EOF_BIT) break; rp->rbd_status = 0; rp = (struct rbd *) BOFF_TO_VADDR(dv, rp->rbd_link); } goto return_rbds; return_rbds_clear: ASSERT(rfd->rfd_rbd_ofst != NULL_OFFSET); ASSERT(rbd == dv->ex_rbdhead); rp = rbd; while (!(rp->rbd_status & RBD_EOF_BIT)) { rp->rbd_status = 0; ASSERT((rp->rbd_rbuffsize & RBD_EL_BIT) == 0); rp = (struct rbd *) BOFF_TO_VADDR(dv, rp->rbd_link); } return_rbds: ASSERT(rp->rbd_status & RBD_EOF_BIT); ASSERT(dv->ex_rbdtail->rbd_link == VADDR_TO_BOFF(dv, rbd)); dv->ex_rbdhead = (struct rbd *) BOFF_TO_VADDR(dv, rp->rbd_link); /* * Return the used rbd's to the available list. * The link offsets are already in place. Set the EL bit in * the new last rbd and clear the EL bit in the old last rbd. * rbd = first used rbd; rp = last used rbd * * The 82586 has problems if the next rbd offset in the last * rbd is changed by the driver. The 82586 seems to (1) load * the offset to the next rbd and then (2) look at the EL bit. * It does not reload the offset after looking at the EL bit. * If the last rbd on the list has (for example) 0xffff as the * next rbd offset, and the offset is changed and the EL bit * cleared between (1) and (2), then the 82586 will use 0xffff * as the next rbd offset. */ rp->rbd_status = 0; DEBUG04(("Return rbds rbd=%x rp=%x\n", rbd, rp)); ASSERT(dv->ex_rbdtail->rbd_rbuffsize & RBD_EL_BIT); rp->rbd_rbuffsize |= RBD_EL_BIT; dv->ex_rbdtail->rbd_rbuffsize &= ~RBD_EL_BIT; dv->ex_rbdtail = rp; return_rfds: /* * Return used rfd's to the available list. * The link offsets are already in place. Set the EL bit in * the new last rfd and clear the EL bit in the old last rfd. * rfd = the used frame descriptor */ DEBUG04(("Return rfd %x\n", rfd)); ASSERT(rfd->rfd_status & RFD_C_BIT); rfd->rfd_status = 0; rfd->rfd_cntl = RFD_EL_BIT; rfd->rfd_rbd_ofst = NULL_OFFSET; ASSERT(dv->ex_rfdtail->rfd_cntl & RFD_EL_BIT); ASSERT(dv->ex_rfdtail->rfd_link == VADDR_TO_BOFF(dv, rfd)); dv->ex_rfdtail->rfd_cntl = 0; dv->ex_rfdtail = rfd; DEBUG07(("rlst: fh %x ft %x bh %x bf %x\n", dv->ex_rfdhead, dv->ex_rfdtail, dv->ex_rbdhead, dv->ex_rbdtail)); if (mp == NULL) { /* error - frame not filled */ DEBUG04(("mp == NULL, looping\n")); } else if (dv->ex_up_queue) { putnext(dv->ex_up_queue, mp); } else { freeb(mp); } } /* while (TRUE) - continue processing frames */ } /* if (status & RECVUNIT_INT) - We have received a frame */ if (status & CMDUNIT_INT) { /* a command completed */ register union cbu * cbu; queue_t * q; register int s; done_work = 1; cbu = (union cbu *) BOFF_TO_VADDR(dv, scb->scb_cbl_ofst); if ((cbu->cbl.cbl_command & CBL_CMD_MASK) == CMD_TRANSMIT) { /* transmit command completed */ ASSERT(&cbu->tcb == dv->ex_tcbhead); ASSERT(cbu->tcb.tcb_status & TCB_C_BIT); DEBUG05(("xmit intr tcb x%x\n", &cbu->tcb)); dv->ex_tcbhead = (struct tcb *) BOFF_TO_VADDR(dv, dv->ex_tcbhead->tcb_link); s = cbu->tcb.tcb_status; if (s & TCB_OK_BIT) { /* transmission successful */ if (s & TCB_COLLSNS_CNT) mst->mac_colltable[(s & TCB_COLLSNS_CNT) - 1]++; } else { /* transmission failure */ DEBUG05(("xmit err status x%x\n", s)); if (s & TCB_CSLOST) mst->mac_carrier++; if (s & TCB_DMAURUN) mst->mac_baddma++; if (s & TCB_DEFER) mst->mac_frame_def++; if (s & TCB_MAXCOLLSNS) { if (s & TCB_COLLSNS_CNT) mst->mac_colltable[(s & TCB_COLLSNS_CNT) - 1]++; else mst->mac_colltable[15]++; mst->mac_xs_coll++; } } dv->ex_tcbtail = &cbu->tcb; dv->ex_flags &= ~ED_CUWORKING; /* transmit a frame if it is ready to be transmitted */ if (dv->ex_tcbhead != dv->ex_tcbnext) /* tx queue not empty */ e3Dstartcu(dv); if (dv->ex_flags & ED_BUFSBUSY) { /* were all tx buffers full */ dv->ex_flags &= ~ED_BUFSBUSY; /* not any more since */ dv->ex_tcbnext = &cbu->tcb; /* this one now free */ q = WR(dv->ex_up_queue); if (q->q_first) { e3Dhwput(dv, mp = getq(q)); freemsg(mp); } } } else { /* other type of command completed */ ASSERT(cbu == dv->ex_cbuhead); ASSERT(cbu->cbl.cbl_status & CBL_C_BIT); DEBUG05(("cmnd intr cbl x%x\n", &cbu->cbl)); /* reply to ioctl request */ if (dv->ex_iocq) { e3Dioctlack(dv, dv->ex_iocq, dv->ex_iocmp, (cbu->cbl.cbl_status & CBL_OK_BIT) ? OK : NOT_OK); dv->ex_iocq = (queue_t *) 0; dv->ex_iocmp = (mblk_t *) 0; } dv->ex_flags &= ~(ED_CUWORKING | ED_CBLREADY); if (dv->ex_flags & ED_CBLSBUSY) dv->ex_flags &= ~ED_CBLSBUSY; } if (!(dv->ex_flags & ED_CUWORKING)) { if ((dv->ex_tcbhead != dv->ex_tcbnext || (dv->ex_flags & ED_CBLREADY))) e3Dstartcu(dv); } } /* if (status & CMDUNIT_INT) - a command completed */ if (!(status & SCB_INT_BITS)) { /* no more interrupts */ if (!done_work) { DEBUG03(("e3D%dintr: spurious x%x\n", dv - e3Ddevice, status)); mst->mac_spur_intr++; } break; } } /* while (TRUE) - checking for frames received/command complete */ return; } /* * Purpose: e3Dmcaddrset * * Purpose: * Set board's multicast address. */ int e3Dmcaddrset(e3Ddev_t * dv, queue_t * q, mblk_t * mp) { macaddr_t * mc; struct mcsetup * mcs = &dv->ex_control->cbu.mcs; int cnt; int s; register int i; DEBUG01(("e3Dmcaddrset: unit %d\n", dv - e3Ddevice)); if (dv->ex_flags & ED_CBLSBUSY) return (NOT_OK); /* there is only one cbl */ dv->ex_iocq = q; dv->ex_iocmp = mp; dv->ex_flags |= (ED_CBLSBUSY | ED_CBLREADY); bzero ((caddr_t) mcs->mcs_list, sizeof (mcs->mcs_list)); mcs->mcs_cnt = 0; cnt = dv->ex_mc.cnt; mc = dv->ex_mc.tbl; DEBUG10(("mcaddrset unit %d cnt %d\n", dv - e3Ddevice, cnt)); for (i = 0; i < cnt; i++, mc++) { bcopy((caddr_t) mc, mcs->mcs_list[i], sizeof(macaddr_t)); mcs->mcs_cnt += sizeof(macaddr_t); DEBUG10(("addr[%d] %s\n", i, e3Daddrstr(mcs->mcs_list[i]))); } /* * Now we pass the address list to the 586 */ mcs->mcs_command = CMD_MULTICAST | CBL_EL_BIT | CBL_I_BIT; mcs->mcs_status = 0; if (!(dv->ex_flags & ED_CUWORKING)) e3Dstartcu(dv); return (OK); } /* * Function: e3Drunstate * * Purpose: * Bring all the installed adapters to the RUN state. * * Notes: * There is no way to reset an individual E3D 507 adapter. * The RST bit in the Interrupt Configuraton Register only * restarts the board configuration logic. After that you * have to write to the ID port and all installed adapters * react to writes to the ID port. The only thing that can * be done is to bring all adapters to the CONFIG state * or to the RUN state. */ void e3Drunstate() { u_short al, cx; DEBUG00(("e3Drunstate called\n")); outb(ED_ID_PORT, 0); for (al = 0xff, cx = 0; cx < 255; cx++) { outb(ED_ID_PORT, al & 0xff); al <<= 1; if (al & 0x100) al ^= 0xe7; } outb(ED_ID_PORT, 0); } /* * dump the internal registers of 82586 */ #ifdef DUMP_82586_REGS e3Ddumpregs(unit) int unit; { register e3Ddev_t *dv = &e3Ddevice[unit]; struct scb *scb = &dv->ex_control->scb; struct dump *dmp = &dv->ex_control->cbu.dump; register dump_buf *dumpbuf = dv->ex_dumpbuf; register int i; u_short old_offset; int s, rcode = OK; DEBUG01(("e3Ddumpregs: unit %d buf x%x\n", unit, dumpbuf)); if (dumpbuf == (dump_buf *)NULL) return (rcode); s = splstr(); /* * Set up scb command list to point to our special command buffer */ old_offset = scb->scb_cbl_ofst; scb->scb_cbl_ofst = VADDR_TO_BOFF(dv, dmp); dmp->dmp_command = CMD_DUMP | CBL_EL_BIT; dmp->dmp_status = 0; dmp->dmp_bufoffset = VADDR_TO_BOFF(dv, dumpbuf); DEBUG01(("dump offs x%x\n", dmp->dmp_bufoffset)); scb->scb_command = SCB_CUC_START; SEND_586CA(dv); if (S_poll(S_test_cmd_clear, scb, E3D_POLL) == FALSE) { printf("e3D%d: DUMP timeout. Status x%x\n", unit, scb->scb_status); RESET_586(dv); rcode = NOT_OK; goto out; } DEBUG01(("dmp_status x%x\n", dmp->dmp_status)); if (S_poll(S_test_cmd_complete, (union cbu *) dmp, E3D_POLL) == FALSE) { printf("e3D%d: DUMP failed. dmpstatus x%x scbstatus x%x\n", unit, dmp->dmp_status, scb->scb_status); RESET_586(dv); rcode = NOT_OK; goto out; } DEBUG01(("DUMP done dmpstatus x%x scbstatus x%x\n", dmp->dmp_status, scb->scb_status)); scb->scb_command = CMD_UNIT_ACK; SEND_586CA(dv); out: /* * Restore the command buffer pointer to the transmit buffer list */ scb->scb_cbl_ofst = old_offset; splx(s); if (rcode == OK) { printf("-------- DUMP OF 82586 REGISTERS --------"); for (i = 0; i < sizeof(dump_buf) - 1; i += 2) { if (!(i % 16)) printf("\n%x: ", i); printf("%b%b ", (*dumpbuf)[i + 1], (*dumpbuf)[i]); } printf("\n"); } return (rcode); } #endif 07070100023887000081a400000000000000030000000135aefc98000005a600001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/drv/mdi/e3D/lkcfg: # # @(#) lkcfg 75.1 98/06/26 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1998 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # [ "$#" != "5" ] && { echo "Usage:\n\t$0 <-ird> INIT_DB_RECORD MDI_driver Board_number" exit $FAIL } LLI_ROOT=$MKMOKROOT`llipathmap` . $LLI_ROOT/lib/libcfg.sh PATH=$PATH:$LLI_ROOT/bin option=$1 INITDBR=$2 AOFFILE=$3 drv=$4 bd=$5 SYSTEM_FILE=$MKMOKROOT/etc/conf/sdevice.d/$drv MASTER_FILE=$MKMOKROOT/etc/conf/cf.d/mdevice DRIVER_DIR=$MKMOKROOT/etc/conf/pack.d/$drv # de-configure driver [ "$option" = "-d" ] && { [ -f $SYSTEM_FILE ] && { set_system_info $SYSTEM_FILE $bd "N" 0 0 0 0 0 0 0 awk '{ if ( $2 == "Y" ) exit 1 }' $SYSTEM_FILE && idinstall -d -e $drv } exit $OK } # source INIT DB RECORD [ -f "$INITDBR" ] || { echo "No INIT DB RECORD, \"$INITBDR\" found" exit $FAIL } cd $LLI_ROOT/ID/$drv for i in System Master Node Driver.o Space.c space.h $drv.h do [ -f "$i" ] || { echo "$drv: File, \"$LLI_ROOT/ID/$drv/$i\" not found" exit $FAIL } done # set a few system file fields BASE_IO=`stzget $INITDBR BASE_IO SELECT` || { echo "$drv: BASE_IO: SELECT does not exist in stanza file" exit $FAIL } [ -f $SYSTEM_FILE ] || { idinstall -a -e -k $drv idinstall -u -e -k -H $drv } set_system_info $SYSTEM_FILE $bd "Y" 0 0 0 0 0 0 0 set_header_info $drv $bd BASE_IO 0x$BASE_IO exit $OK 0707010002388a000081a400000000000000030000000135aefc980000026c00001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/e3D/space.h/* * @(#) space.h 7.1 94/11/27 SCOINC * * Copyright (C) The Santa Cruz Operation, 1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* interrupt number */ #define E3D_0_IRQ 0x0 #define E3D_1_IRQ 0x0 #define E3D_2_IRQ 0x0 #define E3D_3_IRQ 0x0 /* Base I/O address */ #define E3D_0_BASE_IO 0x0 #define E3D_1_BASE_IO 0x0 #define E3D_2_BASE_IO 0x0 #define E3D_3_BASE_IO 0x0 /* transceiver type - 0 is BNC/TP, 1 is AUI */ #define E3D_0_MEDIA 0x0 #define E3D_1_MEDIA 0x0 #define E3D_2_MEDIA 0x0 #define E3D_3_MEDIA 0x0 0707010002388e000081a40000000000000003000000013757467e000001f100001dff0000000100000000000000000000003000000000root/usr/src/O5hdk/net/drv/mdi/shrk/AOF/osi2300# # @(#) osi2300 77.1 98/12/11 # # Copyright (C) The Santa Cruz Operation, 1998 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PCI_BUS: VALUES=0-255:1 PROMPT="PCI Bus#" TYPE=link-kit PCI_DEV: VALUES=0-15:1 PROMPT="Device#" TYPE=link-kit ADAPTER: DESCRIPTION="!AHDK! Osicom 2300" BUS=PCI MEDIA_TYPE=ethernet MAX_BD=15 KEY=PCI_BUS,PCI_DEV REQUIRED= ADVANCED= SPEED=fast ID=1011000922 1011000922="Osicom 2300" 0707010002388f000081a40000000000000003000000013757467e0000020200001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/drv/mdi/shrk/AOF/shrk# # @(#) shrk 77.1 98/12/11 # # Copyright (C) The Santa Cruz Operation, 1998 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PCI_BUS: VALUES=0-255:1 PROMPT="PCI Bus#" TYPE=link-kit PCI_DEV: VALUES=0-15:1 PROMPT="Device#" TYPE=link-kit ADAPTER: DESCRIPTION="!AHDK! Matrox Shark NS-100/4" BUS=PCI MEDIA_TYPE=ethernet MAX_BD=15 KEY=PCI_BUS,PCI_DEV REQUIRED= ADVANCED= SPEED=fast ID=1011000922 1011000922="Matrox Shark NS-100/4" 07070100023890000081a40000000000000003000000013757467e0000020900001dff0000000100000000000000000000003000000000root/usr/src/O5hdk/net/drv/mdi/shrk/AOF/snapper# # @(#) snapper 77.1 98/12/11 # # Copyright (C) The Santa Cruz Operation, 1998 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PCI_BUS: VALUES=0-255:1 PROMPT="PCI Bus#" TYPE=link-kit PCI_DEV: VALUES=0-15:1 PROMPT="Device#" TYPE=link-kit ADAPTER: DESCRIPTION="!AHDK! Matrox Snapper NS-100/1" BUS=PCI MEDIA_TYPE=ethernet MAX_BD=15 KEY=PCI_BUS,PCI_DEV REQUIRED= ADVANCED= SPEED=fast ID=1011000922 1011000922="Matrox Snapper NS-100/1" 07070100023892000081a4000000000000000300000001367087060000030b00001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/drv/mdi/shrk/Makefile# # @(#) Makefile 77.1 98/12/11 # # Copyright (C) The Santa Cruz Operation, 1998 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # ROOT=../../.. include $(ROOT)/Make.inc MAKEFILE = shrk.mk IDINSTALL = /etc/conf/bin/idinstall CONF = /etc/conf DEBUG = -DSTATIC=static # DEBUG = -DSTATIC= -DSHRK_DEBUG CFLAGS = -O -DOPENSERVER -DAT386 -I../../.. -D_INKERNEL $(DEBUG) OBJ = shrkmdi.o shrkhw.o LOBJS = shrkmdi.L shrkhw.L DRV = Driver.o .c.L: $(LINT) $(LINTFLAGS) $(DEFLIST) $(INCLIST) $< >$@ all: $(DRV) $(OBJ): shrk.h $(DRV): $(OBJ) ld -r -o $@ $(OBJ) install: all # $(IDINSTALL) -e -u -k shrk lintit: $(LOBJS) clean: rm -f $(OBJ) tags *.L clobber: clean rm -f $(DRV) # $(IDINSTALL) -e -d -k shrk 07070100023893000081a4000000000000000300000001367087060000001c00001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/shrk/Mastershrk I icSH shrk 0 0 0 1 -1 07070100023894000081a4000000000000000300000001367087070000008400001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/drv/mdi/shrk/Nodeshrk mdi/shrk0 c 0 root root 600 shrk mdi/shrk1 c 0 root root 600 shrk mdi/shrk2 c 0 root root 600 shrk mdi/shrk3 c 0 root root 600 07070100023898000081a400000000000000030000000136708708000006f500001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/drv/mdi/shrk/Space.c/* * @(#) Space.c 77.1 98/12/11 * * Copyright (C) The Santa Cruz Operation, 1998. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated as Confidential. */ #include #include #include "config.h" #include "space.h" #define OPENSERVER #include "shrk.h" /* The definitions below apply globally to shrk for each configured NIC */ /* Number of receive descriptors. */ unsigned long shrk_num_rx_desc = 64; /* Number of transmit descriptors. */ unsigned long shrk_num_tx_desc = 64; /* * Number of transmit data buffers per streams message. * If this limit is reached (on fragmented streams messages), we copy data. * Note: shrk_max_txbuf_per_msg must be less than ((shrk_num_tx_desc * 2) - 2). */ unsigned long shrk_max_txbuf_per_msg = 32; /* * Number of transmit descriptors per transmit complete interrupt (threshold). * Notes: * - shrk_num_tx_descs_per_interrupt cannot not be more than shrk_num_tx_desc * - Set to zero to eliminate transmit interrupts completely */ unsigned long shrk_num_tx_descs_per_interrupt = 32; /* number of adapters configured - from config.h */ uint shrk_nunit = SHRK_CNTLS; /* obtain configuration parameters (up to 8 NICs are supported) */ shrkparam_t shrk_param[SHRK_CNTLS] = { #ifdef SHRK_0 { SHRK_0_PCI_BUS, SHRK_0_PCI_DEV }, #endif #ifdef SHRK_1 { SHRK_1_PCI_BUS, SHRK_1_PCI_DEV }, #endif #ifdef SHRK_2 { SHRK_2_PCI_BUS, SHRK_2_PCI_DEV }, #endif #ifdef SHRK_3 { SHRK_3_PCI_BUS, SHRK_3_PCI_DEV }, #endif #ifdef SHRK_4 { SHRK_4_PCI_BUS, SHRK_4_PCI_DEV }, #endif #ifdef SHRK_5 { SHRK_5_PCI_BUS, SHRK_5_PCI_DEV }, #endif #ifdef SHRK_6 { SHRK_6_PCI_BUS, SHRK_6_PCI_DEV }, #endif #ifdef SHRK_7 { SHRK_7_PCI_BUS, SHRK_7_PCI_DEV }, #endif }; 0707010002389a000081a4000000000000000300000001367087080000005c00001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/shrk/Systemshrk Y 0 0 0 0 0 0 0 0 shrk N 0 0 0 0 0 0 0 0 shrk N 0 0 0 0 0 0 0 0 shrk N 0 0 0 0 0 0 0 0 07070100023891000081a4000000000000000300000001367087090000068400001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/drv/mdi/shrk/lkcfg#!/bin/sh # # @(#) lkcfg 77.1 98/12/11 # # Copyright (C) The Santa Cruz Operation, 1993-1998 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # shrk MDI driver Link Kit configuration script # [ "$#" != "5" ] && { echo "Usage:\n\t$0 <-ird> INIT_DB_RECORD MDI_driver Board_number" exit $FAIL } LLI_ROOT=$MKMOKROOT`llipathmap` . $LLI_ROOT/lib/libcfg.sh PATH=$PATH:$LLI_ROOT/bin option=$1 INITDBR=$2 AOFFILE=$3 drv=$4 bd=$5 SYSTEM_FILE=$MKMOKROOT/etc/conf/sdevice.d/$drv MASTER_FILE=$MKMOKROOT/etc/conf/cf.d/mdevice DRIVER_DIR=$MKMOKROOT/etc/conf/pack.d/$drv # de-configure driver [ "$option" = "-d" ] && { # removes the driver from the system [ -f $SYSTEM_FILE ] && { set_system_info $SYSTEM_FILE $bd "N" 0 0 0 0 0 0 0 awk '{ if ( $2 == "Y" ) exit 1 }' $SYSTEM_FILE && idinstall -d -e $drv } exit $OK } [ -f "$INITDBR" ] || { echo "No INIT DB RECORD, \"$INITBDR\" found" exit $FAIL } cd $LLI_ROOT/ID/$drv for i in System Master Node Driver.o Space.c space.h $drv.h do [ -f "$i" ] || { echo "$drv: File, \"$LLI_ROOT/ID/$drv/$i\" not found" exit $FAIL } done PCI_DEV=`stzget $INITDBR PCI_DEV SELECT` || { echo "$drv: PCI_DEV: SELECT does not exist in stanza file" exit $FAIL } PCI_BUS=`stzget $INITDBR PCI_BUS SELECT` || { echo "$drv: PCI_BUS: SELECT does not exist in stanza file" exit $FAIL } # check to see if the driver is in the link-kit [ -f $SYSTEM_FILE ] || { idinstall -a -e -k $drv idinstall -u -e -k -H $drv } set_system_info $SYSTEM_FILE $bd "Y" 0 0 0 0 0 0 0 set_header_info $drv $bd PCI_BUS $PCI_BUS set_header_info $drv $bd PCI_DEV $PCI_DEV exit $OK 07070100023895000081a400000000000000030000000136be4ba100008da700001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/shrk/shrk.h/* * @(#)shrk.h 77.2 * * Copyright (C) The Santa Cruz Operation, 1998-1999. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated as Confidential. */ /* shrk MDI UnixWare driver - sample driver for the Matrox SHARK NS100/4 * Matrox * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ * $ -- __ $ * $ --_ -- __ $ * $ vv \__ - (| $ * $ vv \__ (o) ) ( | $ * $ vv \__ ) ( - | $ * $ vv \ ) ( -- | $ * $ / ) | /--- | $ * $ \ ) | \--- | $ * $ ^^ / ) ( -- | $ * $ ^^_/ ) ( - | $ * $ ^^_/ ) ( | $ * $ ^^_/ __ - (| $ * $ -- __ -- $ * $ -- $ * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ * Networks */ /* Header file for shrk FastEthernet board */ #ifndef OPENSERVER #define _DDI 8 /* to appease ddi.h */ #endif /* ndef OPENSERVER */ #if defined(_KERNEL_HEADERS) && !defined(OPENSERVER) #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #else #include #include #include #include #include #include #include #include #include #include #include #ifdef OPENSERVER #include #include #include #include #include #include #include #include #include #else #include #include #include #include #include #include #endif /* OPENSERVER */ #endif /* _KERNEL_HEADERS && !OPENSERVER */ extern ulong_t shrk_num_rx_desc; /* Space.c: number of rx descriptors */ extern ulong_t shrk_num_tx_desc; /* Space.c: number of tx descriptors */ extern ulong_t shrk_max_txbuf_per_msg; /* Space.c: data bufs/tx frame */ extern ulong_t shrk_num_tx_descs_per_interrupt; /* Space.c: tx descs per irq */ extern unsigned int shrk_free_esballoc; /* Space.c: workaround NFS mount hang */ #ifndef OPENSERVER extern physreq_t *shrk_phys; extern physreq_t *shrk_txphys; #endif /* ndef OPENSERVER */ /* Ethernet headers and packet sizes */ #define SHRK_HEADERSZ 14 /* ethernet header size */ #define SHRK_MINPACK 60 /* minimum packet size including header */ #define SHRK_MAXPACK 1518 /* max packet size including header & crc */ #define SHRK_TXMAXSZ (SHRK_MAXPACK - 4) /* subtract crc length */ /* Multicast address */ #define SHRK_MCA(ea) (((caddr_t)(ea))[0] & 1) /* Broadcast address */ #define SHRK_BCAST(ea) ((((caddr_t)(ea))[0] & 0xff) == 0xff && \ mdi_addrs_equal(shrk_broad, ea)) /* PCI configuration space definitions */ #define PCI_CMD_OFFSET 0x4 /* PCI command register offset */ #define PCI_IO_ENABLE 0x00000001 /* PCI I/O space access */ #define PCI_MEM_ENABLE 0x00000002 /* PCI memory space access */ #define PCI_MASTER 0x00000004 /* PCI bus master enabled */ #define PCI_IO_OFFSET 0x10 /* PCI base address registers offset */ /* Serial ROM as documented in DEC Serial ROM Application Note */ #pragma pack(1) typedef struct srom { ushort svid; /* subsystem vendor ID */ ushort sid; /* subsystem ID */ unchar ID_reserved1[12]; unchar id_block_crc; /* CRC8 calue of the ID block */ unchar ID_reserved2; unchar srom_format_version; /* current version is 0x03 */ unchar chip_count; /* number of chips sharing the srom */ macaddr_t hwaddr; /* factory MAC address */ unchar chip_info[98]; /* chip specific stuff */ ushort reserved; ushort crc; /* srom checksum up to crc */ } srom_t; #pragma pack() #pragma pack(1) typedef struct devoff { unchar devno; /* chip_n device number */ ushort leaf_offset; /* chip_n info offset */ } devoff_t; #pragma pack() #pragma pack(1) typedef struct infoleaf { ushort conn; /* selected connection type */ unchar gpcontrol; /* general purpose control */ unchar bcount; /* number of info blocks present */ } infoleaf_t; #pragma pack() #pragma pack(1) /* using bitfields is generally discouraged due to portability */ typedef struct chipinfo { unchar media_code:6, /* supported medium code */ reserved:1, format:1; /* format indicator bit (0) */ unchar port; /* general purpose port data */ ushort command; /* general purpose port data */ } chipinfo_t; #pragma pack(1) /* using bitfields is generally discouraged due to portability */ typedef struct chipinfo_ext { unchar length:7, /* length of this info block */ format:1; /* format indicator bit (1) */ unchar block_type; /* 00 non-mii, 01 mii phy */ } chipinfo_ext_t; #pragma pack() /* block data types */ #define SHRK_NON_MII 0x00 /* non-MII Media block block_type */ #define SHRK_MII_PHY 0x01 /* MII PHY chip block_type */ typedef chipinfo_t non_mii_t; /* format is identical */ #pragma pack(1) /* MII PHY chip block format is variable length, but first 2 bytes are known */ typedef struct mii { unchar phyno; /* phy number */ unchar gprlen; /* number of bytes in GPR sequence */ } mii_t; #pragma pack() /* structures and definitions used for initializing MAC address */ typedef struct srom_macaddr { macaddr_t hwaddr; /* Hardware MAC address */ volatile unchar valid; /* 1 if hwaddr is valid */ } srom_macaddr_t; #define SHRK_NUM_PCI_BUS 255 /* maximum number of PCI busses */ #define SHRK_PCIDEV_ECU0 0x8 /* Ethernet Controller Unit 0 at pcidev 8 */ #define SHRK_PCIDEV_ECU1 0xc /* Ethernet Controller Unit 1 at pcidev 12 */ #define SHRK_PCIDEV_ECU2 0x5 /* Ethernet Controller Unit 2 at pcidev 5 */ #define SHRK_PCIDEV_ECU3 0x9 /* Ethernet Controller Unit 3 at pcidev 9 */ #define SHRK_MAX_PCIDEV (SHRK_PCIDEV_ECU1 + 1) #define SHRK_TWO_SEC_HZ drv_usectohz(2000000) /* Structure and definitions for receive and transmit data descriptors */ #pragma pack(1) typedef struct desc { volatile uint_t status; /* RDES0/TDES0 - Status */ volatile uint_t cntrl; /* control bits and byte counts */ volatile uint_t paddr1; /* physical address of buffer 1 */ volatile uint_t paddr2; /* physical addr of next descriptor */ volatile mblk_t *mp; /* pointer to mesg block to free */ } rxd_t, txd_t; #pragma pack() /* RDES0 - Receive Status */ #define RX_OWN 0x80000000 /* Own Bit RDES0*/ #define RX_FF 0x40000000 /* Filtering Fail RDES0*/ #define RX_FL 0x3FFF0000 /* Frame Length mask, (incl CRC) RDES0*/ #define RX_ES 0x00008000 /* Error Summary RDES0*/ #define RX_DE 0x00004000 /* Descriptor Error RDES0*/ #define RX_DT 0x00003000 /* Data Type RDES0*/ #define RX_RF 0x00000800 /* Runt Frame RDES0*/ #define RX_MF 0x00000400 /* Multicast Frame RDES0*/ #define RX_FS 0x00000200 /* First Descriptor RDES0*/ #define RX_LS 0x00000100 /* Last Descriptor RDES0*/ #define RX_TL 0x00000080 /* frame Too Long RDES0*/ #define RX_CS 0x00000040 /* Collision Seen RDES0*/ #define RX_FT 0x00000020 /* Frame Type RDES0*/ #define RX_RW 0x00000010 /* Receive Watchdog RDES0*/ #define RX_RE 0x00000008 /* Report on mii Error RDES0*/ #define RX_DB 0x00000004 /* Dribbling Bit RDES0*/ #define RX_CE 0x00000002 /* Crc Error RDES0*/ #define RX_ZER 0x00000001 /* ZERo for legal length packets RDES0*/ #define RX_FL_BIT_POS 16 /* bit position of Frame Length RDES0*/ #define RX_CRC 4 /* sizeof Cyclical Redundancy Check */ /* RDES1 - Receive control bits, byte counts of receive buffers */ #define RX_RER 0x02000000 /* Receive End of Ring RDES1*/ #define RX_RCH 0x01000000 /* Receive 2nd address CHained RDES1*/ #define RX_RBS2 0x003FF800 /* Receive Buffer Size 2 RDES1*/ #define RX_RBS1 0x000007FF /* Receive Buffer Size 1 RDES1*/ #define RX_RBS2_BIT_POS 11 /* bit position of RBS2 RDES1*/ /* Miscellaneous receive macros */ #define SHRK_RX_MIN_DESC 3 /* minimum number of rx descriptors */ #define SHRK_RX_SZ (SHRK_MAXPACK + sizeof(rxd_t)) /* TDES0 - Transmit Status */ #define TX_OWN 0x80000000 /* Own Bit TDES0*/ #define TX_ES 0x00008000 /* Error Summary TDES0*/ #define TX_TO 0x00004000 /* transmit jabber TimeOut TDES0*/ #define TX_LO 0x00000800 /* Loss Of carrier TDES0*/ #define TX_NC 0x00000400 /* No Carrier TDES0*/ #define TX_LC 0x00000200 /* Late Collision TDES0*/ #define TX_EX 0x00000100 /* Excessive Collisions TDES0*/ #define TX_HF 0x00000080 /* Heartbeat Fail TDES0*/ #define TX_CC 0x00000078 /* Collision Count TDES0*/ #define TX_LF 0x00000004 /* Link Fail Report TDES0*/ #define TX_UF 0x00000002 /* UnderFlow Error TDES0*/ #define TX_DE 0x00000001 /* Deferred TDES0*/ #define TX_CC_BIT_POS 0x00000003 /* bit position of collision cnt TDES0*/ /* TDES1 - Transmit control bits, byte counts of receive buffers */ #define TX_IC 0x80000000 /* Interrupt on Completion TDES1*/ #define TX_LS 0x40000000 /* Last Segment TDES1*/ #define TX_FS 0x20000000 /* First Segment TDES1*/ #define TX_FT1 0x10000000 /* Filter Type bit 1 TDES1*/ #define TX_SET 0x08000000 /* SETup packet TDES1*/ #define TX_AC 0x04000000 /* Add Crc disable TDES1*/ #define TX_TER 0x02000000 /* Transmit End of Ring TDES1*/ #define TX_TCH 0x01000000 /* Tx second address CHained TDES1*/ #define TX_DPD 0x00800000 /* Disabled PaDding TDES1*/ #define TX_FT0 0x00400000 /* Filter Type bit 0 TDES1*/ #define TX_TBS2 0x003FF800 /* Transmit Buffer Size 2 TDES1*/ #define TX_TBS1 0x000007FF /* Transmit Buffer Size 1 TDES1*/ #define TX_TBS2_BIT_POS 11 /* bit position of TBS2 TDES1*/ /* Miscellaneous transmit macros */ #define SHRK_TX_MIN_DESC 4 /* minimum number of tx descriptors */ #define SHRK_TX_MAX_BUF 6 /* minimum tx buffers per streams msg */ #define TXD_NEXT(N) ((((N)+1) == shrk_num_tx_desc) ? 0 : ((N)+1)) #define TXD_AVAIL(dv) (TXD_NEXT((dv)->txci) != (dv)->txpi) #define TXD_ALLCLEAN(dv) ((dv)->txpi == (dv)->txci) #define TXD_LAST(dv) ((dv)->txpi == (dv)->txci) #define TXD_LAST_N(N,dv) ((N) == (dv)->txci) #define TXD_CONS(dv) (&(dv)->txd[(dv)->txci]) /* consumer transmit descr */ #define TXD_PROD(dv) (&(dv)->txd[(dv)->txpi]) /* producer transmit descr */ #define TXD_PROD_N(N,dv) (&(dv)->txd[(N)]) /* transmit complete check descr */ /* structure used by OpenServer Release 5 configuration */ typedef struct shrkparam { ushort pci_bus; /* PCI bus number */ ushort pci_dev; /* PCI device number */ } shrkparam_t; /* Per-device structure - one allocated per ethernet port */ typedef struct shrkdev { ulong_t flags; /* driver flags */ paddr_t ioaddr; /* base I/O address */ paddr_t addrlen; /* I/O address range */ ushort irq; /* interrupt */ ushort mii_par; /* MII media/link status */ unchar pci_bus; /* PCI bus number */ unchar pci_dev; /* PCI device number */ unchar port; /* port number (1-4) */ unchar phy_addr; /* address of PHY */ macaddr_t hwaddr; /* factory mac address */ macaddr_t eaddr; /* ethernet address currently in use */ void *intr_cookie; /* used to detatch interrupts */ void *dlpi_cookie; /* passed from DLPI BIND_REQ */ queue_t *up_queue; /* upstream queue */ queue_t *tx_queue; /* our transmit queue */ mblk_t *rxcurr; /* current/first receive descriptor */ uint_t rxpaddr; /* phys addr of first rx descriptor */ txd_t *txd; /* transmit descriptors list */ ulong_t txci; /* txdesc consumer index (txframe) */ ulong_t txpi; /* txdesc producer index (txclean) */ #ifdef OPENSERVER paddr_t txpaddr; /* phys addr of first tx descriptor */ #else paddr32_t txpaddr; /* phys addr of first tx descriptor */ #endif /* OPENSERVER */ ulong_t txcnt; /* number of frames transmitted */ mac_stats_eth_t macstats; /* MAC statistics */ ulong_t dropsuspended; /* packets dropped while suspended */ srom_t srom; /* copy of serial ROM for easy access */ unchar gpcontrol; /* general purpose control - infoleaf */ unchar *gpresetlen; /* general purpose reset length */ unchar *gpresetseq; /* general purpose reset sequence */ unchar media; /* media configuration */ int tid; /* timeout id */ #ifdef OPENSERVER struct lockb lktx; /* transmit lock */ struct lockb lktxcomplete; /* transmit complete lock */ struct lockb lkdv; /* general per-device structure lock */ struct lockb lkintr; /* interrupt lock */ int iarg; /* interrupt argument */ ushort pciindex; /* NIC index for OSr5 pci functions */ mctbl_t mctbl; /* multicast table */ #else lock_t *lktx; /* transmit lock */ lock_t *lktxcomplete; /* transmit complete lock */ lock_t *lkdv; /* general per-device structure lock */ lock_t *lkintr; /* interrupt lock */ #endif /* OPENSERVER */ } shrkdev_t; /* Per-device flags */ #define SHRK_PRESENT 0x00000001 #define SHRK_OPEN 0x00000002 #define SHRK_SUSPENDED 0x00000004 #define SHRK_REMOVED 0x00000008 /* CFG_REMOVE on open device */ #define SHRK_MCA_HASH 0x00000010 /* using imperfect address filtering */ #define SHRK_MCA_ALL 0x00000020 /* all multicast address reception */ #define SHRK_PROMISCUOUS 0x00000040 /* receive all address mode */ #define SHRK_NICPRESENT 0x00000080 /* a D21140 NIC is in system */ #define SHRK_SNAPPER 0x80000000 /* Matrox Snapper Adapter selected */ #define SHRK_SHARK 0x40000000 /* Matrox Shark Adapter selected */ #define SHRK_OSICOM 0x20000000 /* Osicom 2300 Adapter detected */ #define SHRK_OSI_QUAD 0x10000000 /* Osicom 2340 Adapter detected */ #define SHRK_CARD_MASK 0xf0000000 /* adapter type mask */ /* Adapter differentiation definitions */ #define SHRK_BIA_SHARK 0x0e /* first 7 bits BIA 4th byte NS100/4 */ /* Per-device media definitions */ #define SHRK_MEDIA_AUTO 0x01 /* autoconfigure media speed */ #define SHRK_MEDIA_10 0x02 /* 10 Mbps */ #define SHRK_MEDIA_100 0x04 /* 100 Mbps */ #define SHRK_MEDIA_FDX 0x08 /* Full Duplex */ #ifdef OPENSERVER extern shrkdev_t *shrk_dv; extern uint shrk_nunit; extern shrkparam_t shrk_param[]; #endif /* OPENSERVER */ /* 21140A and adapter specific definitions */ #define SHRK_BRDID "0x10110009" /* 21140 vendor_device id string */ #define SHRK_SNAPPER_NAME "Matrox Snapper" #define SHRK_SHARK_NAME "Matrox Shark" /* CSR0 - Bus Mode Register */ #define BM_CACHE_32 0x0000C000 /* 32-bit cache alignment CSR0*/ #define BM_PBL_32 0x00002000 /* 32-bit Programmable Burst Len CSR0*/ #define BM_DSL 0x0000007C /* Descriptor Skip Length CSR0*/ #define BM_SWR 0x00000001 /* Software Reset CSR0*/ #define BM_DSL_BIT_POS 2 /* bit position of DSL CSR0*/ /* CSR5 - Status Register */ #define ST_EB_MASK 0x03800000 /* Error Bits Mask CSR5*/ #define ST_EB_PARITY 0x00000000 /* Parity Error CSR5*/ #define ST_EB_MABORT 0x00800000 /* Master Abort CSR5*/ #define ST_EB_TABORT 0x01000000 /* Target Abort CSR5*/ #define ST_TS_MASK 0x00700000 /* Transmit Process State Mask CSR5*/ #define ST_RPS_MASK 0x000E0000 /* Receive Proceess State Mask CSR5*/ #define ST_NIS 0x00010000 /* Normal Interrupt Summary CSR5*/ #define ST_AIS 0x00008000 /* Abnormal Interrupt Summary CSR5*/ #define ST_ERI 0x00004000 /* Early Receive Interrupt CSR5*/ #define ST_FBE 0x00002000 /* Fatal Bus Error CSR5*/ #define ST_GTE 0x00000800 /* General Timer Expired CSR5*/ #define ST_ETI 0x00000400 /* Early Transmit Interrupt CSR5*/ #define ST_RWT 0x00000200 /* Receive Watchdog Timeout CSR5*/ #define ST_RPS 0x00000100 /* Receive Process Stopped CSR5*/ #define ST_RU 0x00000080 /* Receive Buffer Unavailable CSR5*/ #define ST_RI 0x00000040 /* Receive Interrupt CSR5*/ #define ST_UNF 0x00000020 /* Transmit Underflow CSR5*/ #define ST_TJT 0x00000008 /* Transmit Jabber Timeout CSR5*/ #define ST_TU 0x00000004 /* Transmit Buffer Unavailable CSR5*/ #define ST_TPS 0x00000002 /* Transmit Process Stopped CSR5*/ #define ST_TI 0x00000001 /* Transmit Interrupt CSR5*/ #define IRQ_MASK 0x0001EFEF /* Interrupt Mask CSR5*/ /* CSR6 - Operating Mode Register */ #define OM_SC 0x80000000 /* Special Capture Effect Enable CSR6*/ #define OM_RA 0x40000000 /* Receive All stats in RDES0<30> CSR6*/ #define OM_MBO 0x02000000 /* Must Be One CSR6*/ #define OM_SCR 0x01000000 /* Scrambler Mode CSR6*/ #define OM_PCS 0x00800000 /* PCS Functions active CSR6*/ #define OM_TTM 0x00400000 /* Transmit Threshold Mode CSR6*/ #define OM_SF 0x00200000 /* Store and Forward CSR6*/ #define OM_HBD 0x00080000 /* Heartbeat Disable CSR6*/ #define OM_PS 0x00040000 /* Port Select CSR6*/ #define OM_CA 0x00020000 /* Capture Effect Enable CSR6*/ #define OM_TR_MASK 0x0000C000 /* Threshold Control Bits CSR6*/ #define OM_ST 0x00002000 /* Start/Stop Transmit command CSR6*/ #define OM_FC 0x00001000 /* Force Collision mode CSR6*/ #define OM_EXL 0x00000800 /* EXternal Loopback CSR6*/ #define OM_INL 0x00000400 /* INternal Loopback CSR6*/ #define OM_NOL 0x00000000 /* NOrmal Loopback CSR6*/ #define OM_FD 0x00000200 /* Full Duplex mode CSR6*/ #define OM_PM 0x00000080 /* Pass all Multicast CSR6*/ #define OM_PR 0x00000040 /* PRomiscuous CSR6*/ #define OM_SB 0x00000020 /* Start/Stop Backoff Counter CSR6*/ #define OM_IF 0x00000010 /* Inverse Filtering CSR6*/ #define OM_PB 0x00000008 /* Pass Bad frames CSR6*/ #define OM_HO 0x00000004 /* Hash-Only filtering mode CSR6*/ #define OM_SR 0x00000002 /* Start/Stop Receive CSR6*/ #define OM_HP 0x00000001 /* Hash/Perfect recieve filter CSR6*/ #define CSR6_RESET (OM_SC|OM_MBO|OM_SF|OM_HBD|OM_PS|OM_CA|OM_EXL|OM_SB) /* CSR7 - Interrupt Enable Register */ #define IE_NI 0x00010000 /* Normal Interrupt summary enbl CSR7*/ #define IE_AI 0x00008000 /* Abnormal Interrupt summary enb CSR7*/ #define IE_ERE 0x00004000 /* Early Receive interrupt Enable CSR7*/ #define IE_FBE 0x00002000 /* Fatal Bus Error enable CSR7*/ #define IE_GPT 0x00000800 /* General Purpose Timer enable CSR7*/ #define IE_ETE 0x00000400 /* Early Transmit interrupt Enbl CSR7*/ #define IE_RW 0x00000200 /* Receive Watchdog timeout enbl CSR7*/ #define IE_RS 0x00000100 /* Receive Stopped enable CSR7*/ #define IE_RU 0x00000080 /* Receive buffer Unavailable enb CSR7*/ #define IE_RI 0x00000040 /* Receive Interupt enable CSR7*/ #define IE_UN 0x00000020 /* Underflow interrupt enable CSR7*/ #define IE_TJ 0x00000008 /* Transmit Jabber timeout enable CSR7*/ #define IE_TU 0x00000004 /* Transmit buff Unavailable enbl CSR7*/ #define IE_TS 0x00000002 /* Transmit Stopped enable CSR7*/ #define IE_TI 0x00000001 /* Transmit Interrupt enable CSR7*/ #define CSR7_RESET (IE_NI | IE_FBE | IE_RU | IE_TJ | IE_TS) /* CSR8 - Missed Frames and Overflow Counter */ #define MFO_OCO 0x10000000 /* Overflow Counter Overflow CSR8*/ #define MFO_FOC_MASK 0x0FFE0000 /* FIFO Overflow Counter CSR8*/ #define MFO_MFO 0x00010000 /* Missed Frame Overflow CSR8*/ #define MFO_MFC_MASK 0x0000FFFF /* Missed Frame Counter CSR8*/ /* CSR9 - Boot ROM, Serial ROM, and MII Management Register */ #define MII_MDI 0x00080000 /* MII Management read Data In CSR9*/ #define MII_MDI_BIT_POS 19 /* bit position of MDI */ #define MII_MII 0x00040000 /* MII Management Operation Mode CSR9*/ #define MII_MDO 0x00020000 /* MII Management write Data Out CSR9*/ #define MII_MDC 0x00010000 /* MII Management Clock CSR9*/ #define ROM_RD 0x00004000 /* ROM Read Operation CSR9*/ #define ROM_WR 0x00002000 /* ROM Write Operation CSR9*/ #define ROM_BR 0x00001000 /* Boot ROM Select CSR9*/ #define ROM_SR 0x00000800 /* Serial ROM Select CSR9*/ #define ROM_REG 0x00000400 /* External Register Select CSR9*/ #define ROM_DATA 0x000000FF /* Boot ROM Data/SROM Control CSR9*/ #define ROM_SDOUT 0x00000008 /* Serial ROM Data Out CSR9*/ #define ROM_SDIN 0x00000004 /* Serial ROM Data In CSR9*/ #define ROM_SCLK 0x00000002 /* Serial ROM Clock CSR9*/ #define ROM_SCS 0x00000001 /* Serial ROM Chip Select CSR9*/ /* CSR12 - General-Purpose Port Register */ #define GP_GPC 0x00000100 /* General-Purpose Control CSR12*/ /* Osicom 2300 Series General-Purpose Port Register */ #define GP_OSI_LPBKPDX 0x00000001 /* when=0, loopback to PDT and PDR */ #define GP_OSI_LPBKXCVR 0x00000002 /* when=1, loopback to transceiver */ #define GP_OSI_MODE_SEL 0x00000008 /* 0 => 10Mbps HDX, 1 => 10Mbps FDX */ #define GP_OSI_FDPLX10M 0x00000010 /* when=1, 10M FDX capability detected*/ #define GP_OSI_SIGDET 0x00000020 /* when=1, signal detected on wire */ #define GP_OSI_SYM_DET 0x00000040 /* when=1, descrambler locked on input*/ #define GP_OSI_LINK10M_L 0x00000080 /* when=1, 10M SIA link pulse detected*/ #define GP_OSI_HDX 0x01 /* Osicom GEP setting for half-duplex */ #define GP_OSI_FDX 0x09 /* Osicom GEP setting for full-duplex */ /* CSR offsets from base io address */ #define CSR0(dv) ((dv)->ioaddr) /* CSR0: Bus mode */ #define CSR1(dv) ((dv)->ioaddr + 0x08) /* CSR1: Transmit Poll Demand */ #define CSR2(dv) ((dv)->ioaddr + 0x10) /* CSR2: Receive Poll Demand */ #define CSR3(dv) ((dv)->ioaddr + 0x18) /* CSR3: Receive descr addr */ #define CSR4(dv) ((dv)->ioaddr + 0x20) /* CSR5: Transmit descr addr */ #define CSR5(dv) ((dv)->ioaddr + 0x28) /* CSR5: Status */ #define CSR6(dv) ((dv)->ioaddr + 0x30) /* CSR6: Operating mode */ #define CSR7(dv) ((dv)->ioaddr + 0x38) /* CSR7: Interrupt Enable */ #define CSR9(dv) ((dv)->ioaddr + 0x48) /* CSR9: ROMs and MII */ #define CSR12(dv) ((dv)->ioaddr + 0x60) /* CSR12: General Purpose */ /* definitions for setup frames */ #define SHRK_SET_SZ 192 /* size of the setup frame */ #define SHRK_SET_MAXPERF 16 /* maximum perfect filtering addrs */ #define SHRK_SET_MINADDR 2 /* minimum perfect filtering addrs */ #define SHRK_SET_INIT 0 /* setup cmd - initial setup frame */ #define SHRK_SET_ADDR 1 /* setup cmd - enable multicast addr */ #define SHRK_SET_ENABMC 2 /* setup cmd - enable multicast addr */ #define SHRK_SET_DISABMC 3 /* setup cmd - disable multicast addr */ #define SHRK_SET_RETRY 100 /* maximum setup complete poll loops */ #define SHRK_SET_NUMTXDS 2 /* use two txdescs per setup frame */ typedef struct imperfect { ushort_t hash; ushort_t dont_care; } imperfect_t; #define SHRK_HASH_SZ (sizeof(ushort_t) * 8) #define SHRK_HASH_OFF 156 /* unicast addr offset in setup buf */ /* definitions for DP83940 MII/PHY */ #define SHRK_PHY_ADDRLEN 5 /* number of bits in phy/reg addrs */ #define SHRK_BMCR 0x00 /* Basic Mode Control Register */ #define SHRK_BMSR 0x01 /* Basic Mode Status Register */ #define SHRK_ANAR 0x04 /* Auto-Negotiation Advertisement Reg */ #define SHRK_ANAR_INIT 0x1e1 /* ANARinit: 10/100Base-T/TXfdx 802.3 */ #define SHRK_ANLPAR 0x05 /* Auto-Neg Link Partner Ability Reg */ #define SHRK_ANER 0x06 /* Auto-Negotiation Expansion Reg */ #define SHRK_PAR 0x19 /* Phy Address Register */ #define SHRK_BMCR_RESET 0x8000 /* Software Reset */ #define SHRK_BMCR_AUTO 0x1000 /* BMCR - enable auto negotiation */ #define SHRK_BMCR_ASTRT 0x0200 /* BMCR - restart auto negotiation */ #define SHRK_BMSR_ANC 0x0020 /* BMSR - Auto-Negotiation Complete */ #define SHRK_BMSR_ANA 0x0008 /* BMSR - Auto-Negotiation Ability */ #define SHRK_BMSR_LINK 0x0004 /* BMSR - link status */ #define SHRK_MAX_PHY 32 /* maximum phy address (5 bit addr) */ #define SHRK_PHY_RETRY 3500 /* maximum phy reset/autoneg loops */ /* Phy Address Register - also used in per-device media flags (mii_par) */ #define SHRK_PAR_AN 0x0400 /* Auto-Neg mode status (1=enabled) */ #define SHRK_PAR_FDX 0x0080 /* Full-DupleX mode */ #define SHRK_PAR_10 0x0040 /* 10Mbp/s operation */ #ifdef OPENSERVER /* make porting to OpenServer Release 5 a bit easier */ #define mdi_printcfg printcfg #define strcat kstrcat #define drv_usecwait suspend /* lock macros */ #define LOCK(l) lockb5(&(l)) #define UNLOCK(l, s) unlockb(&(l), (s)) /* priority level typedef */ typedef int pl_t; /* streams scatter gather definitions and structures */ #define SCGTH32 0 typedef struct scgth_el32 { uint_t sg_base; /* base physical address */ uint_t sg_size; /* size, in bytes, of this piece */ } scgth_el32_t; typedef struct scgth { union { scgth_el32_t *el32; } sg_elem; unchar sg_nelem; unchar sg_format; } scgth_t; typedef struct mac_mcast { ulong mac_all_mca; /* all multicasts enabled */ ulong mac_mca_count; /* number of multicast addrs enabled */ ulong mac_mca_length; /* size (# bytes) of multicast table */ } mac_mcast_t; #endif /* OPENSERVER */ /* Debug Macros */ #if defined(DEBUG) # define SHRK_DEBUG #endif #ifdef SHRK_DEBUG #define DEBUG00 if (shrkdebug&0x00000001) cmn_err /* load/config/hwinit */ #define DEBUG01 if (shrkdebug&0x00000002) cmn_err /* open/close */ #define DEBUG02 if (shrkdebug&0x00000004) cmn_err /* streams uwput */ #define DEBUG03 if (shrkdebug&0x00000008) cmn_err /* normal interrupt */ #define DEBUG04 if (shrkdebug&0x00000010) cmn_err /* ioctls */ #define DEBUG05 if (shrkdebug&0x00000020) cmn_err /* primitives */ #define DEBUG06 if (shrkdebug&0x00000040) cmn_err /* transmit data */ #define DEBUG07 if (shrkdebug&0x00000080) cmn_err /* receive data */ #define DEBUG08 if (shrkdebug&0x00000100) cmn_err /* srom, rom, mii */ #define DEBUG09 if (shrkdebug&0x00000200) cmn_err /* rxinit */ #define DEBUG10 if (shrkdebug&0x00000400) cmn_err /* setup_frame */ #define DEBUG11 if (shrkdebug&0x00000800) cmn_err /* transmit queues */ #define DEBUG12 if (shrkdebug&0x00001000) cmn_err /* locking */ #define DEBUG13 if (shrkdebug&0x00002000) cmn_err /* abnormal interrupt */ #define DEBUG14 if (shrkdebug&0x00004000) cmn_err /* transmit failures */ #define DEBUG15 if (shrkdebug&0x00008000) cmn_err #define DEBUG16 if (shrkdebug&0x00010000) cmn_err /* tx_complete failure*/ #define DEBUG17 if (shrkdebug&0x00020000) cmn_err #define DEBUG18 if (shrkdebug&0x00040000) cmn_err #define DEBUG19 if (shrkdebug&0x00080000) cmn_err #define DEBUG20 if (shrkdebug&0x00100000) cmn_err #define DEBUG21 if (shrkdebug&0x00200000) cmn_err #define DEBUG22 if (shrkdebug&0x00400000) cmn_err #define DEBUG23 if (shrkdebug&0x00800000) cmn_err #define DEBUG24 if (shrkdebug&0x01000000) cmn_err #define DEBUG25 if (shrkdebug&0x02000000) cmn_err #define DEBUG26 if (shrkdebug&0x04000000) cmn_err #define DEBUG27 if (shrkdebug&0x08000000) cmn_err #define DEBUG28 if (shrkdebug&0x10000000) cmn_err #define DEBUG29 if (shrkdebug&0x20000000) cmn_err #define DEBUG30 if (shrkdebug&0x40000000) cmn_err /* miscellaneous debug */ #define DEBUG31 if (shrkdebug&0x80000000) cmn_err #else #define DEBUG00 if (0) cmn_err #define DEBUG01 if (0) cmn_err #define DEBUG02 if (0) cmn_err #define DEBUG03 if (0) cmn_err #define DEBUG04 if (0) cmn_err #define DEBUG05 if (0) cmn_err #define DEBUG06 if (0) cmn_err #define DEBUG07 if (0) cmn_err #define DEBUG08 if (0) cmn_err #define DEBUG09 if (0) cmn_err #define DEBUG10 if (0) cmn_err #define DEBUG11 if (0) cmn_err #define DEBUG12 if (0) cmn_err #define DEBUG13 if (0) cmn_err #define DEBUG14 if (0) cmn_err #define DEBUG15 if (0) cmn_err #define DEBUG16 if (0) cmn_err #define DEBUG17 if (0) cmn_err #define DEBUG18 if (0) cmn_err #define DEBUG19 if (0) cmn_err #define DEBUG20 if (0) cmn_err #define DEBUG21 if (0) cmn_err #define DEBUG22 if (0) cmn_err #define DEBUG23 if (0) cmn_err #define DEBUG24 if (0) cmn_err #define DEBUG25 if (0) cmn_err #define DEBUG26 if (0) cmn_err #define DEBUG27 if (0) cmn_err #define DEBUG28 if (0) cmn_err #define DEBUG29 if (0) cmn_err #define DEBUG30 if (0) cmn_err #define DEBUG31 if (0) cmn_err #endif /* Function prototypes */ #if defined(__STDC__) && !defined(_NO_PROTOTYPE) /* shrkmdi.c */ extern int shrkuwput(queue_t *, mblk_t *); extern int nulldev(); extern boolean_t shrk_adapter_detect(shrkdev_t *); #ifdef OPENSERVER extern int shrkopen(queue_t *, int, int, int); extern int shrkclose(queue_t *); #else extern int shrkopen(void *, channel_t *, int, cred_t *, queue_t *); extern int shrkclose(void *, channel_t, int, cred_t *, queue_t *); extern int shrkconfig(cfg_func_t, void *, rm_key_t); extern int shrkdevinfo(void *, channel_t, di_parm_t, void *); extern void shrkbiostart(void *, channel_t , buf_t *); extern int shrkwrongioctl(void *, channel_t, int, void *, int, cred_t *, int *); extern int shrkdrvctl(void *, channel_t, int, void *); extern ppid_t shrkmmap(void *, channel_t, size_t, int); STATIC boolean_t shrkcm_params(shrkdev_t *, rm_key_t); STATIC boolean_t shrkverify_brdid(rm_key_t); #endif /* OPENSERVER */ extern char *shrkaddrstr(macaddr_t); extern void shrkioctlack(shrkdev_t *, queue_t *, mblk_t *, int, int); void shrkfreemem(shrkdev_t *); void shrkmacaddr(shrkdev_t *); STATIC boolean_t shrkrxinit(shrkdev_t *); uint_t shrkalloc_rxbuf(mblk_t **); STATIC boolean_t shrkalloc_txdesc(shrkdev_t *); void shrksrom(shrkdev_t *); #ifdef SHRK_DEBUG void shrkdv(shrkdev_t *); void shrkrxd(shrkdev_t *); void shrktxd(shrkdev_t *); void shrktxset(volatile mblk_t *); #endif /* SHRK_DEBUG */ /* shrkhw.c */ #ifdef OPENSERVER int shrkintr(int); #else int shrkintr(void *); #endif /* OPENSERVER */ extern boolean_t shrkhwinit(shrkdev_t *); extern boolean_t shrkreset(shrkdev_t *); STATIC boolean_t shrkreset_phy(shrkdev_t *); extern void shrkhwclose(shrkdev_t *); extern boolean_t shrkhwstart(shrkdev_t *); extern boolean_t shrksetup_frame(shrkdev_t *, ulong_t, mblk_t *); STATIC void shrkset_perfaddr(unchar *, macaddr_t); static void clk_latch(int, uint_t, uint_t); ushort shrk_srom_read(shrkdev_t *, unchar); STATIC boolean_t shrk_mii_read(shrkdev_t *, unchar, ushort *); STATIC void shrk_mii_write(shrkdev_t *, unchar, ushort); STATIC void shrk_mii_init(shrkdev_t *); STATIC void shrk_mii_phy_addr(shrkdev_t *); void shrkrx(shrkdev_t *); extern boolean_t shrktx(shrkdev_t *, mblk_t *); STATIC boolean_t shrktxd_navail(shrkdev_t *, int); extern void shrktx_complete(shrkdev_t *); extern void shrktx_queued(shrkdev_t *); extern void shrkset_all(shrkdev_t *); STATIC uint_t shrkcrc32_mchash(unchar *mca); STATIC boolean_t shrkauto_osi(shrkdev_t *); STATIC boolean_t shrkauto_mii(shrkdev_t *); #endif /* defined(__STDC__) && !defined(_NO_PROTOTYPE) */ 07070100023896000081a4000000000000000300000001374cd1e60000b1c300001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/drv/mdi/shrk/shrkhw.c/* * @(#)shrkhw.c 77.4 * * Copyright (C) The Santa Cruz Operation, 1998-1999. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated as Confidential. */ /* shrk MDI UnixWare driver - sample driver for the Matrox SHARK NS100/4 * Matrox * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ * $ -- __ $ * $ --_ -- __ $ * $ vv \__ - (| $ * $ vv \__ (o) ) ( | $ * $ vv \__ ) ( - | $ * $ vv \ ) ( -- | $ * $ / ) | /--- | $ * $ \ ) | \--- | $ * $ ^^ / ) ( -- | $ * $ ^^_/ ) ( - | $ * $ ^^_/ ) ( | $ * $ ^^_/ __ - (| $ * $ -- __ -- $ * $ -- $ * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ * Networks */ #ifdef _KERNEL_HEADERS #include #else #include "shrk.h" #endif #ifdef SHRK_DEBUG extern ulong_t shrkdebug; #endif extern macaddr_t shrk_broad; /* * Function: shrkreset_phy * * Purpose: * Reset the PHY, determine media if link is invalid (default 10Mbps, HDX) */ STATIC boolean_t shrkreset_phy(shrkdev_t *dv) { register int i; ushort bmcr, mii; DEBUG08(CE_CONT, "shrkreset_phy(%x)\n", dv); ASSERT(!(dv->flags & SHRK_OSICOM)); #ifdef SHRK_DEBUG if (shrk_mii_read(dv, SHRK_ANAR, &mii) == B_FALSE) { cmn_err(CE_WARN, "shrkreset_phy: cannot read PHY ANAR"); return(B_FALSE); } DEBUG08(CE_CONT, "mii_read ANAR: %x\n", mii); if (shrk_mii_read(dv, SHRK_ANER, &mii) == B_FALSE) { cmn_err(CE_WARN, "shrkreset_phy: cannot read PHY ANER"); return(B_FALSE); } DEBUG08(CE_CONT, "mii_read ANER: %x\n", mii); if (shrk_mii_read(dv, SHRK_ANLPAR, &mii) == B_FALSE) { cmn_err(CE_WARN, "shrkreset_phy: cannot read PHY ANLPAR"); return(B_FALSE); } DEBUG08(CE_CONT, "mii_read ANLPAR: %x\n", mii); if (shrk_mii_read(dv, SHRK_PAR, &mii) == B_FALSE) { cmn_err(CE_WARN, "shrkreset_phy: cannot read PHY PAR"); return(B_FALSE); } DEBUG08(CE_CONT, "mii_read PAR: %x\n", mii); if (shrk_mii_read(dv, SHRK_BMSR, &mii) == B_FALSE) { cmn_err(CE_WARN, "shrkreset_phy: BMSR read failed"); return(B_FALSE); } DEBUG08(CE_CONT, "mii_read BMSR: %x\n", mii); #endif /* SHRK_DEBUG */ /* reset phy */ drv_usecwait(500); shrk_mii_write(dv, SHRK_BMCR, SHRK_BMCR_RESET); drv_usecwait(500); /* send preamble to mii after reset if preamble suppression enabled */ for (i = 0; i < 32; i++) { clk_latch(CSR9(dv), MII_MDO, MII_MDC); } for (i = 0; i < SHRK_PHY_RETRY; i++) { drv_usecwait(500); if (shrk_mii_read(dv, SHRK_BMCR, &bmcr) == B_FALSE) { continue; } if (!(bmcr & SHRK_BMCR_RESET)) { /* bit clears when reset is complete */ break; } } if (i == SHRK_PHY_RETRY) { cmn_err(CE_WARN, "shrkreset_phy: BMCR-reset read failed"); return(B_FALSE); } DEBUG08(CE_CONT, "BMCR %x reset after %d tries\n", bmcr, i); /* determine link status */ if (shrk_mii_read(dv, SHRK_BMSR, &mii) == B_FALSE) { cmn_err(CE_WARN, "shrkreset_phy: cannot read PHY BMSR-1"); return(B_FALSE); } DEBUG08(CE_CONT, "shrkreset_phy: BMSR %x\n", mii); if (!(mii & SHRK_BMSR_LINK)) { DEBUG08(CE_NOTE, "shrkreset_phy: BMSR %x - no link\n", mii); if (shrk_mii_read(dv, SHRK_PAR, &dv->mii_par) == B_FALSE) { cmn_err(CE_WARN, "shrkreset_phy: cannot read PAR"); return(B_FALSE); } DEBUG08(CE_CONT, "shrkreset_phy: nolink PAR %x\n", dv->mii_par); if (!(dv->mii_par & SHRK_PAR_AN) || (mii & SHRK_BMSR_ANC)) { DEBUG08(CE_CONT, "autonegotiation complete\n"); return(B_TRUE); } /* wait for autonegotiation complete bit */ for (i = 0; i < SHRK_PHY_RETRY; i++) { if (shrk_mii_read(dv, SHRK_BMSR, &mii) == B_FALSE) { cmn_err(CE_WARN, "shrkreset_phy: BMSR-autoneg"); return(B_FALSE); } if (mii & SHRK_BMSR_ANC) { /* bit set when autonegotiation is complete */ break; } drv_usecwait(100); } DEBUG08(CE_CONT, "mii_read autoneg i %d BMSR %x\n", i, mii); if (i == SHRK_PHY_RETRY) { DEBUG08(CE_CONT, "autonegotiation complete failed\n"); cmn_err(CE_WARN, "shrk: check port=%b network cable", dv->port); cmn_err(CE_NOTE, "shrk: using 10Mbps, HDX"); dv->mii_par = SHRK_PAR_10; /* default 10Mbps, HDX */ } } if (shrk_mii_read(dv, SHRK_PAR, &dv->mii_par) == B_FALSE) { cmn_err(CE_WARN, "shrkreset_phy: cannot read PAR"); return(B_FALSE); } DEBUG08(CE_CONT, "mii_read PAR: %x\n", dv->mii_par); return(B_TRUE); } /* * Function: shrkauto_mii * * Purpose: * Autodetect media connection with non-Osicom adapters; i.e., Matrox * If connected, initialize dv->mii_par */ STATIC boolean_t shrkauto_mii(shrkdev_t *dv) { ushort mii; /* read phy status register */ if (shrk_mii_read(dv, SHRK_BMSR, &mii) == B_FALSE) { cmn_err(CE_WARN, "shrkauto_mii: cannot read PHY BMSR"); return(B_FALSE); } DEBUG08(CE_CONT, "shrkauto_mii: BMSR mii: %x\n", mii); if (!(mii & SHRK_BMSR_LINK)) { DEBUG08(CE_WARN, "Houston we have a problem! bad link"); if (shrkreset_phy(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkauto_mii: reset_phy - no link"); return(B_FALSE); } } else { if (shrk_mii_read(dv, SHRK_PAR, &dv->mii_par) == B_FALSE) { cmn_err(CE_WARN,"shrkauto_mii: can't read phy PAR"); return(B_FALSE); } DEBUG08(CE_CONT, "shrkauto_mii: mii_par %x\n",dv->mii_par); } return(B_TRUE); } /* * Function: shrkauto_osi * * Purpose: * Autodetect media connection (currently only used for Osicom adapter) * If connected, initialize dv->mii_par */ STATIC boolean_t shrkauto_osi(shrkdev_t *dv) { uint_t val; uint_t gep; DEBUG00(CE_CONT, "shrkauto_osi(%x)\n", dv); ASSERT(dv->flags & SHRK_OSICOM); /* try 100Mbps media */ val = CSR6_RESET | OM_SCR | OM_PCS; if (dv->media & SHRK_MEDIA_FDX) { val |= OM_FD; } outl(CSR6(dv), val); drv_usecwait(1000000); /* Osicom says 5 seconds */ outl(CSR12(dv), GP_GPC); /* configure GEP pins 7:0 as input */ gep = inl(CSR12(dv)); if ((gep & GP_OSI_SIGDET) || (gep & GP_OSI_SYM_DET)) { DEBUG00(CE_CONT, "shrkauto_osi: 100M media %x\n", dv->media); dv->mii_par &= ~SHRK_PAR_10; if (dv->media & SHRK_MEDIA_10) { cmn_err(CE_NOTE, "shrk: 10Mbps configured, found 100"); } return(B_TRUE); } /* try 10Mbps media (defaults to 10Mbps if unplugged) */ val = CSR6_RESET | OM_TTM; val &= ~(OM_HBD | OM_PS); outl(CSR6(dv), val); outl(CSR12(dv), GP_GPC | dv->gpcontrol); if (dv->media & SHRK_MEDIA_FDX) { outl(CSR12(dv), GP_OSI_FDX); } else { outl(CSR12(dv), GP_OSI_HDX); } outl(CSR12(dv), GP_GPC); drv_usecwait(2000000); /* two second delay */ gep = inl(CSR12(dv)); if (!(gep & (GP_OSI_SIGDET | GP_OSI_LINK10M_L))) { DEBUG00(CE_CONT, "shrkauto_osi: 10M media %x\n", dv->media); dv->mii_par |= SHRK_PAR_10; if (dv->media & SHRK_MEDIA_100) { cmn_err(CE_NOTE, "shrk: 100Mbps configured, found 10"); } return(B_TRUE); } cmn_err(CE_WARN, "shrkauto_osi: no link, check network cable"); cmn_err(CE_NOTE, "shrk: using 10Mbps, HDX"); dv->mii_par = SHRK_PAR_10; /* default 10Mbps, HDX */ return(B_TRUE); } /* * Function: shrkreset * * Purpose: * Reset the NIC and initialize Control and Status Registers * * Context: * Called from open(), config() */ STATIC boolean_t shrkreset(shrkdev_t *dv) { uint_t val; DEBUG08(CE_CONT, "shrkreset(%x)\n", dv); /* bus mode register - perf: BM_PBL_32? */ outl(CSR0(dv), BM_CACHE_32 | BM_PBL_32 | BM_SWR); drv_usecwait(5000); /* wait at least 50 PCI clock cycles after reset */ /* must write descriptor skip length _after_ reset */ val = ((sizeof(mblk_t *) / sizeof(uint_t)) << BM_DSL_BIT_POS) & BM_DSL; outl(CSR0(dv), BM_CACHE_32 | BM_PBL_32 | val); /* interrupt enable register - perf: IE_ERE? IE_ETE? IE_GPT? */ outl(CSR7(dv), CSR7_RESET); if (dv->flags & SHRK_OSICOM) { if (shrkauto_osi(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkreset: Osicom - bad link\n"); } } else { if (shrkauto_mii(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkreset: mii - bad link\n"); } } /* operating mode register - perf: OM_SF? */ val = CSR6_RESET; if (dv->mii_par & SHRK_PAR_10) { val |= OM_TTM; val &= ~OM_HBD; if (dv->flags & SHRK_OSICOM) { val &= ~OM_PS; /* 10Mbps Osicom uses SRL port */ } } else if (dv->flags & SHRK_OSICOM) { val |= OM_SCR; /* 100Mbps Osicom uses Scrambler function */ val |= OM_PCS; /* 100Mbps Osicom uses MII/SYM symbol mode */ } if (dv->mii_par & SHRK_PAR_FDX) { val |= OM_FD; } outl(CSR6(dv), val); DEBUG00(CE_CONT, "shrkreset: CSR0-BM %x\n", inl(CSR0(dv))); DEBUG00(CE_CONT, "shrkreset: CSR5-Status %x\n", inl(CSR5(dv))); DEBUG00(CE_CONT, "shrkreset: CSR6-OM %x\n", inl(CSR6(dv))); DEBUG00(CE_CONT, "shrkreset: CSR7-IE %x\n", inl(CSR7(dv))); DEBUG00(CE_CONT, "shrkreset: CSR12-GEP %x\n", inl(CSR12(dv))); return(B_TRUE); } /* * Function: shrkhwinit * * Purpose: * Initialize the hardware to a known, running state. * Called once for each CFG_ADD. */ boolean_t shrkhwinit(shrkdev_t *dv) { ushort *s; uint_t i; DEBUG00(CE_CONT, "shrkhwinit(%x) flags %x\n", dv, dv->flags); /* read the srom contents into the per-device struct */ s = (ushort *)&dv->srom; for (i = 0; i < sizeof(srom_t); i += 2) { *s++ = shrk_srom_read(dv, i); } if (dv->flags & SHRK_OSICOM) { shrksrom(dv); bcopy(dv->srom.hwaddr, dv->hwaddr, sizeof(macaddr_t)); } shrk_mii_init(dv); if (dv->phy_addr >= SHRK_MAX_PHY) { cmn_err(CE_WARN, "shrkhwinit: no PHYs found"); return(B_FALSE); } if ((shrkreset(dv)) == B_FALSE) { cmn_err(CE_WARN, "shrkhwinit: reset failed"); return(B_FALSE); } return(B_TRUE); } #define CRC32POLY 0xEDB88320UL /* CRC-32 Poly - Little Endian */ #define SHRK_HASH_BITS 9 /* Number of bits in hash */ STATIC uint_t shrkcrc32_mchash(unchar *mca) { uint_t idx, bit, data, crc=0xffffffffUL; for (idx = 0; idx < 6; idx++) for (data = *mca++, bit = 0; bit < 8; bit++, data >>= 1) crc = (crc >> 1) ^ (((crc ^ data) & 1) ? CRC32POLY : 0); return(crc & ((1 << SHRK_HASH_BITS) - 1)); /* low bits for hash */ } STATIC void shrkset_perfaddr(unchar *s, macaddr_t addr) { register int i; for (i = 0; i < sizeof(macaddr_t); i += 2) { *s++ = addr[i]; *s++ = addr[i + 1]; #ifdef SHRK_DEBUG *s++ = 0xAA; *s++ = 0xAA; #else s += 2; #endif /* SHRK_DEBUG */ } } /* * Purpose: shrksetup_frame * * Purpose: * Build appropriate setup frame and return it's physical address. */ boolean_t shrksetup_frame(shrkdev_t *dv, ulong_t cmd, mblk_t *mp) { register int i, done; mblk_t *smp, *mmp, *nmp; /* scatter mp, multicast mp, new mp */ mac_mcast_t *mcast; /* multicast structure */ #ifdef OPENSERVER mac_mcast_t mcastr; #endif /* OPENSERVER */ scgth_t sg; pl_t s, t; macaddr_t *mc; /* pointer to existing multicast address table */ macaddr_t *mca; /* multicast address to add or delete */ uint_t paddr; /* physical address of setup buffer to return */ ulong_t cnt = SHRK_SET_MINADDR; /* two addrs: broadcast & unicast */ txd_t *txd, *stxd; uint_t hsh; /* hash bit to set for imperfect filtering */ DEBUG10(CE_CONT, "shrksetup_frame(%x %x %x)\n", dv, cmd, mp); mmp = NULL; /* initialize mmp */ /* allocate mblk with physically contiguous memory */ #ifdef OPENSERVER if ((nmp = allocb(SHRK_SET_SZ, BPRI_MED)) == NULL) { #else if ((nmp = allocb_physreq(SHRK_SET_SZ, BPRI_MED, shrk_phys)) == NULL) { #endif /* OPENSERVER */ cmn_err(CE_WARN, "shrksetup_frame: allocb_physreq failed"); return(B_FALSE); } /* obtain physical memory addresses */ nmp->b_wptr = nmp->b_rptr + SHRK_SET_SZ; #ifdef OPENSERVER smp = nmp; paddr = kvtophys(nmp->b_rptr); #else if ((smp = msgscgth(nmp, shrk_phys, &sg)) == NULL) { cmn_err(CE_WARN, "shrksetup_frame: msgscgth failed"); freemsg(nmp); /* prevent memory leak if msgscgth fails */ return(B_FALSE); } ASSERT(sg.sg_format == SCGTH32); /* 32-bit address */ paddr = sg.sg_elem.el32->sg_base; /* assign before scgth_free */ scgth_free(&sg); #endif /* OPENSERVER */ if ((cmd == SHRK_SET_ENABMC) || (cmd == SHRK_SET_DISABMC)) { mca = (macaddr_t *)mp->b_cont->b_rptr; /* mca to add/delete */ } #ifdef OPENSERVER if (cmd != SHRK_SET_INIT) { mcast = &mcastr; mcast->mac_mca_count = dv->mctbl.cnt; mcast->mac_mca_length = dv->mctbl.cnt * sizeof(macaddr_t); mc = dv->mctbl.tbl; #else /* check for non-zero dlpi_cookie to avoid mdi_get_mctable panic */ if ((cmd != SHRK_SET_INIT) && (dv->dlpi_cookie)) { if (!(mmp = mdi_get_mctable(dv->dlpi_cookie))) { freemsg(smp); cmn_err(CE_WARN, "shrksetup_frame: mdi_get_mctable"); return(B_FALSE); } mcast = (mac_mcast_t *)mmp->b_rptr; mc = (macaddr_t *)((ulong_t)mcast + mcast->mac_mca_offset); #endif /* OPENSERVER */ cnt += mcast->mac_mca_count; if (cmd == SHRK_SET_ENABMC) { cnt++; /* multicast address getting added */ } else if (cmd == SHRK_SET_DISABMC) { --cnt; /* multicast address getting deleted */ } } /* * Use perfect address filtering if 16 addresses or less (including * unicast MAC and broadcast addresses) are being set. A setup frame * is exactly 192 bytes and the format is as follows for ethernet * address 00:01:02:03:04:05 where XX is don't care. Any valid * address can be used to fill out the frame: * XXXXFFFF * XXXXFFFF * XXXXFFFF * XXXX0100 * XXXX0302 * XXXX0504 * ...last 3 lines repeated until end of setup frame... */ if (cnt <= SHRK_SET_MAXPERF) { macaddr_t *fill = (macaddr_t *)smp->b_rptr; DEBUG10(CE_CONT, "shrksetup_frame: perfect filtering\n"); /* clear imperfect filtering flag */ dv->flags &= ~SHRK_MCA_HASH; /* add broadcast address */ shrkset_perfaddr((unchar *)fill, shrk_broad); fill += 2; /* skip 6 unused bytes per address */ /* add unicast mac address */ shrkset_perfaddr((unchar *)fill, dv->eaddr); fill += 2; /* skip 6 unused bytes per address */ /* add multicast addresses */ if (cmd == SHRK_SET_ENABMC) { shrkset_perfaddr((unchar *)fill, *mca); fill += 2; /* skip 6 unused bytes per address */ --cnt; } if (cnt > SHRK_SET_MINADDR) { /* won't get here unless mcas still need to be set */ done = 0; for (i = 0; i < mcast->mac_mca_count; i++, mc++) { DEBUG10(CE_CONT, "mcaddr[%d] %s mca %s\n", i, shrkaddrstr(*mc), shrkaddrstr(*mca)); if ((!done) && (cmd == SHRK_SET_DISABMC)) { if (mdi_addrs_equal(*mc, *mca)) { /* skip mca to delete */ done = 1; continue; } } shrkset_perfaddr((unchar *)fill, *mc); fill += 2; /* skip 6 unused bytes per addr */ } } /* fill out setup frame with the unicast mac address */ while (cnt++ < SHRK_SET_MAXPERF) { shrkset_perfaddr((unchar *)fill, dv->eaddr); fill += 2; /* skip 6 unused bytes per address */ } } else { imperfect_t *imp = (imperfect_t *)smp->b_rptr; DEBUG10(CE_CONT, "shrksetup_frame: imperfect filtering\n"); dv->flags |= SHRK_MCA_HASH; bzero(smp->b_rptr, SHRK_SET_SZ); /* enable broadcast address hash */ hsh = shrkcrc32_mchash(&shrk_broad[0]); imp[hsh/SHRK_HASH_SZ].hash |= (1 << (hsh%SHRK_HASH_SZ)); /* hash multicast addresses */ for (i = 0, done = 0; i < mcast->mac_mca_count; i++, mc++) { DEBUG10(CE_CONT, "mcaddr[%d] %s mca %s\n", i, shrkaddrstr(*mc), shrkaddrstr(*mca)); if ((!done) && (cmd == SHRK_SET_DISABMC)) { if (mdi_addrs_equal(*mc, *mca)) { /* skip mca to delete */ done = 1; continue; } } hsh = shrkcrc32_mchash(*mc); imp[hsh/SHRK_HASH_SZ].hash |= (1 << (hsh%SHRK_HASH_SZ)); } if (cmd == SHRK_SET_ENABMC) { hsh = shrkcrc32_mchash(*mca); imp[hsh/SHRK_HASH_SZ].hash |= (1 << (hsh%SHRK_HASH_SZ)); } /* add unicast mac address */ shrkset_perfaddr((unchar *)smp->b_rptr + SHRK_HASH_OFF, dv->eaddr); } DEBUG12(CE_CONT, "shrksetup_frame: L tx\n"); #ifdef OPENSERVER s = LOCK(dv->lktx); #else s = LOCK(dv->lktx, plstr); #endif /* OPENSERVER */ DEBUG12(CE_CONT, "shrksetup_frame: L txcomplete\n"); #ifdef OPENSERVER t = LOCK(dv->lktxcomplete); #else t = LOCK(dv->lktxcomplete, plstr); #endif /* OPENSERVER */ if (shrktxd_navail(dv, SHRK_SET_NUMTXDS) == B_FALSE) { shrktx_complete(dv); /* free up some transmit descriptors */ if (shrktxd_navail(dv, SHRK_SET_NUMTXDS) == B_FALSE) { DEBUG12(CE_CONT, "setup_frame: U txcomplete-no TXDs\n"); UNLOCK(dv->lktxcomplete, t); DEBUG12(CE_CONT, "shrksetup_frame: U tx - no TXDs\n"); UNLOCK(dv->lktx, s); return(B_FALSE); } } /* skip 1 transmit descriptor; ensures correct setup frame processing */ stxd = TXD_CONS(dv); stxd->cntrl |= TX_SET; stxd->cntrl &= ~(TX_LS | TX_FS | TX_TBS2 | TX_TBS1); DEBUG10(CE_CONT, "shrksetup_frame: cntrl0: %x\n", stxd->cntrl); stxd->paddr1 = 0; stxd->paddr2 = 0; stxd->mp = NULL; stxd->status = TX_OWN; /* increment txdesc consumer index past skipped transmit descriptor */ dv->txci = TXD_NEXT(dv->txci); /* initialize setup transmit descriptor */ txd = TXD_CONS(dv); txd->cntrl |= TX_SET; txd->cntrl &= ~(TX_TBS2 | TX_TBS1); txd->cntrl |= SHRK_SET_SZ; if (dv->flags & SHRK_MCA_HASH) { /* hash filtering plus one perfect address */ txd->cntrl &= ~TX_FT1; txd->cntrl |= TX_FT0; } else { /* perfect filtering */ txd->cntrl &= ~(TX_FT1 | TX_FT0); } txd->paddr1 = paddr; txd->paddr2 = 0; txd->mp = NULL; txd->status = TX_OWN; #ifdef SHRK_DEBUG txd->mp = smp; shrktxd(dv); txd->mp = NULL; #endif /* SHRK_DEBUG */ outl(CSR1(dv), 1); /* transmit poll */ /* increment txdesc consumer index past setup before releasing txlock */ dv->txci = TXD_NEXT(dv->txci); DEBUG10(CE_CONT, "shrksetup_frame txci %x txpi %x\n",dv->txci,dv->txpi); /* wait for nic to indicate setup is complete */ for (i = 0; i < SHRK_SET_RETRY; i++) { if (txd->status == 0x7fffffff) break; drv_usecwait(1000); } shrktx_complete(dv); /* clean up setup transmit descriptors */ DEBUG12(CE_CONT, "setup_frame: U txcomplete\n"); UNLOCK(dv->lktxcomplete, t); DEBUG12(CE_CONT, "shrksetup_frame: U tx\n"); UNLOCK(dv->lktx, s); freemsg(smp); if (mmp != NULL) { freemsg(mmp); } if (i == SHRK_SET_RETRY) { cmn_err(CE_WARN, "shrksetup_frame: SETUP failed"); return(B_FALSE); } DEBUG10(CE_CONT, "shrksetup_frame: SETUP i %d ss %x s %x sc %x c %x\n", i, stxd->status, txd->status, stxd->cntrl, txd->cntrl); return(B_TRUE); } /* * Function: shrkhwstart * * Purpose: * Put the hardware into the running state. */ boolean_t shrkhwstart(shrkdev_t *dv) { uint_t om; DEBUG00(CE_CONT, "shrkhwstart(%x)\n", dv); ASSERT(TXD_AVAIL(dv)); if ((shrkreset(dv)) == B_FALSE) { cmn_err(CE_WARN, "shrkhwstart: reset failed"); return(B_FALSE); } /* start transmit */ DEBUG00(CE_CONT, "shrkhwstart: txpaddr %x\n", dv->txpaddr); om = inl(CSR6(dv)); outl(CSR4(dv), dv->txpaddr); /* transmit descriptor base */ outl(CSR6(dv), om | OM_ST); /* start */ /* issue setup frame */ dv->txci = dv->txpi = 0; /* reset txdesc indices to zero */ if (shrksetup_frame(dv, SHRK_SET_INIT, NULL) == B_FALSE) { cmn_err(CE_WARN, "shrkhwstart: shrksetup_frame failed"); return(B_FALSE); } /* start receive */ #ifdef SHRK_DEBUG shrkrxd(dv); #endif /* SHRK_DEBUG */ outl(CSR3(dv), dv->rxpaddr); /* receive descriptor base */ outl(CSR6(dv), om | OM_ST | OM_SR); /* start */ DEBUG00(CE_CONT, "shrkhwstart: rxpaddr %x txci %x txpi %x\n", dv->rxpaddr, dv->txci, dv->txpi); outl(CSR7(dv), CSR7_RESET | IE_TI | IE_RI); /* enable interrupts */ outl(CSR2(dv), 1); /* receive poll */ DEBUG00(CE_CONT, "shrkhwstart: CSR5-Status-enbl %x\n", inl(CSR5(dv))); return(B_TRUE); } /* * Function: shrkhwstop * * Purpose: * Shut the board down. */ void shrkhwstop(shrkdev_t *dv) { DEBUG00(CE_CONT, "shrkhwstop(%x)\n", dv); shrkreset(dv); /* stops everything */ } /* * Function: shrktxd_navail * * Purpose: * Return B_TRUE if num transmit descriptors are available. * Return B_FALSE otherwise. * * Note: * This function always leaves one unused transmit descriptor; * although the hardware can handle all of the tx descriptors used, * this simplifies the transmit descriptor cleanup code. * * MP Locking: * Called by shrktx(), which is called with txlock held. */ STATIC boolean_t shrktxd_navail(shrkdev_t *dv, int num) { register int i, next; DEBUG06(CE_CONT, "shrktxd_navail(%x %d)\n", dv, num); next = dv->txci; for (i = 0; i < ((num / 2) + (num & 1)); i++) { DEBUG06(CE_CONT, "shrktxd_navail: i %d next %x txpi %x\n", i, next, dv->txpi); if ((TXD_NEXT(next)) == dv->txpi) { return(B_FALSE); } next = TXD_NEXT(next); } return(B_TRUE); } /* * Function: shrktx * * Purpose: * Send frame. * Consumer of free transmit descriptors. * * MP Locking: * Called with tx lock held. */ boolean_t shrktx(shrkdev_t *dv, mblk_t *mp) { register txd_t *txd, *first_txd; uchar_t i; mblk_t *smp, *tmp; mac_stats_eth_t *mst; int nelem; scgth_t sg; pl_t s; uchar_t *start, *end; DEBUG06(CE_CONT, "shrktx() len_mp1 %x cont %x txci %x txpi %x\n", mp->b_wptr - mp->b_rptr, mp->b_cont, dv->txci, dv->txpi); ASSERT(!(dv->flags & SHRK_SUSPENDED)); ASSERT((mp->b_wptr - mp->b_rptr) >= SHRK_HEADERSZ); ASSERT(TXD_AVAIL(dv)); mst = &dv->macstats; #ifdef OPENSERVER bzero(&sg, sizeof(scgth_t)); sg.sg_elem.el32 = (scgth_el32_t *)kmem_zalloc(shrk_max_txbuf_per_msg * sizeof(scgth_el32_t), KM_NOSLEEP); for (smp = mp; mp; mp = mp->b_cont ) { for (start = mp->b_rptr; start < mp->b_wptr; ) { end = mdi_end_of_contig_segment(start, mp->b_wptr - 1); sg.sg_elem.el32[sg.sg_nelem].sg_base = (uint_t) kvtophys(start); sg.sg_elem.el32[sg.sg_nelem].sg_size = end - start + 1; DEBUG06(CE_CONT, "shrktx: segment %i start %x end %x\n", sg.sg_nelem, start, end); sg.sg_nelem++; start = end + 1; } } #else if ((smp = msgscgth(mp, shrk_txphys, &sg)) == NULL) { /* more than shrk_max_txbuf_per_msg fragments */ DEBUG14(CE_CONT, "shrktx: msgscgth-1 failed\n"); if ((smp = msgpullup_physreq(mp, -1, shrk_phys)) == NULL) { DEBUG14(CE_CONT, "shrktx: msgpullup_physreq failed\n"); freemsg(mp); /* prevent memory leak on msgscgth fail */ mst->mac_frame_nosr++; return(B_FALSE); } freemsg(mp); mp = smp; /* save pointer to free in case msgscgth fails */ if ((smp = msgscgth(mp, shrk_txphys, &sg)) == NULL) { DEBUG14(CE_CONT, "shrktx: msgscgth-2 failed\n"); freemsg(mp); return(B_FALSE); } } ASSERT(sg.sg_format == SCGTH32); /* 32-bit address */ #endif /* OPENSERVER */ DEBUG06(CE_CONT, "shrktx: scgth base %x nelem %d\n", sg.sg_elem.el32->sg_base, sg.sg_nelem); if (shrktxd_navail(dv, sg.sg_nelem) == B_FALSE) { DEBUG12(CE_CONT, "shrktx: L txcomplete\n"); #ifdef OPENSERVER s = LOCK(dv->lktxcomplete); #else s = LOCK(dv->lktxcomplete, plstr); #endif /* OPENSERVER */ shrktx_complete(dv); DEBUG12(CE_CONT, "shrktx: U txcomplete\n"); UNLOCK(dv->lktxcomplete, s); if (shrktxd_navail(dv, sg.sg_nelem) == B_FALSE) { DEBUG14(CE_CONT, "shrktx: shrktxd_navail-2 failed\n"); #ifdef OPENSERVER kmem_free(sg.sg_elem.el32, shrk_max_txbuf_per_msg*sizeof(scgth_el32_t)); #else scgth_free(&sg); #endif /* OPENSERVER */ if (!putbq(dv->tx_queue, smp)) { cmn_err(CE_WARN, "shrktx: putbq failed"); freemsg(smp); /* can't queue - drop frame */ } return(B_FALSE); } } first_txd = txd = TXD_CONS(dv); txd->status &= ~TX_OWN; /* don't give frame to the 21140 yet */ txd->cntrl &= TX_TER; /* clear everything but Transmit End of Ring */ txd->cntrl |= TX_FS; dv->txcnt += sg.sg_nelem; txd->cntrl |= sg.sg_elem.el32->sg_size; txd->paddr1 = sg.sg_elem.el32->sg_base; /* before scgth_free */ txd->mp = smp; /* * shrktxd_navail() indicates there are enough transmit descriptors * so there's no need to call TXD_AVAIL() in the loop below. */ for (i = 1; i < sg.sg_nelem; i++) { txd->cntrl |= sg.sg_elem.el32[i].sg_size << TX_TBS2_BIT_POS; txd->paddr2 = sg.sg_elem.el32[i].sg_base; if (++i < sg.sg_nelem) { /* fill in next transmit descriptor */ dv->txci = TXD_NEXT(dv->txci); txd = TXD_CONS(dv); txd->cntrl &= TX_TER; /* clear everything else */ txd->cntrl |= sg.sg_elem.el32[i].sg_size; txd->paddr1 = sg.sg_elem.el32[i].sg_base; txd->mp = NULL; txd->status = TX_OWN; } } if (sg.sg_nelem & 1) { /* odd number of data buffers */ txd->paddr2 = 0; } txd->cntrl |= TX_LS; #if (defined(UNIXWARE) && defined(FREE_ESBALLOC)) tmp = smp; while (tmp != NULL) { if (tmp->b_datap->db_frtnp) { break; } tmp = tmp->b_cont; } if ((shrk_free_esballoc && (tmp != NULL)) || (shrk_num_tx_descs_per_interrupt && #else if ((shrk_num_tx_descs_per_interrupt && #endif /* UNIXWARE && FREE_ESBALLOC */ ((dv->txcnt >= shrk_num_tx_descs_per_interrupt)))) { txd->cntrl |= TX_IC; dv->txcnt = 0; } first_txd->status = TX_OWN; /* give frame to the 21140 */ dv->txci = TXD_NEXT(dv->txci); /* move consumer index to next txdesc */ #ifdef OPENSERVER kmem_free(sg.sg_elem.el32, shrk_max_txbuf_per_msg*sizeof(scgth_el32_t)); #else scgth_free(&sg); #endif /* OPENSERVER */ outl(CSR1(dv), 1); /* transmit poll */ return(B_TRUE); } /* * Function: shrktx_complete * * Purpose: * Cleans up after frame(s) have been transmited. * Producer of free transmit descriptors. * * MP Locking: * Called with txcomplete lock held. */ void shrktx_complete(shrkdev_t *dv) { register int i; register txd_t *txd, *txdc; mac_stats_eth_t *mst; int tx_complete = 0; DEBUG06(CE_CONT, "shrktx_complete(%x) txci %x txpi %x\n", dv, dv->txci, dv->txpi); if (dv->txd == NULL) return; mst = &dv->macstats; /* loop below relies on the hardware to let us know which are done */ txd = TXD_PROD(dv); while (!(txd->status & TX_OWN) && !(TXD_ALLCLEAN(dv))) { if (!tx_complete) { /* check if all transmit descriptors are complete */ i = dv->txpi; txdc = TXD_PROD_N(i, dv); while (!(txdc->status & TX_OWN)) { if (txdc->cntrl & TX_LS) { tx_complete = 1; break; } if (txdc->cntrl & TX_SET) { DEBUG16(CE_CONT,"tx_complete: SETUP\n"); tx_complete = 1; break; } if (txdc->status == 0) { DEBUG16(CE_CONT, "tx_complete: loop\n"); dv->txpi = i; break; } if (TXD_LAST_N(i, dv)) { DEBUG16(CE_CONT, "tx_complete: last\n"); break; } i = TXD_NEXT(i); txdc = TXD_PROD_N(i, dv); } } if (!tx_complete) { DEBUG16(CE_CONT, "shrktx_complete: tx not complete\n"); break; } /* transmit descriptor belongs to the host */ DEBUG06(CE_CONT,"tx_complete txpi %d mp %x\n",dv->txpi,txd->mp); if (txd->mp != NULL) { freemsg((mblk_t *)txd->mp); txd->mp = NULL; } if (txdc->cntrl & TX_SET) { tx_complete = 0; } if (txd->cntrl & TX_LS) { tx_complete = 0; /* gather transmit statistics */ if (txd->status & TX_TO) { mst->mac_tx_errors++; } if ((txd->status & TX_LO) || (txd->status & TX_NC)) { mst->mac_carrier++; } if (txd->status & TX_LC) { mst->mac_oframe_coll++; } if (txd->status & TX_EX) { mst->mac_xs_coll++; } else if (txd->status & TX_CC) { unchar cnt; cnt = (txd->status & TX_CC) >> TX_CC_BIT_POS; mst->mac_colltable[cnt]++; } if ((dv->mii_par & SHRK_PAR_10) && (txd->status & TX_HF)) { mst->mac_sqetesterrors++; } if (txd->status & TX_UF) { mst->mac_baddma++; } if (txd->status & TX_DE) { mst->mac_frame_def++; } } #ifdef SHRK_DEBUG if (TXD_LAST(dv)) { ASSERT((txd->cntrl & TX_LS) || (txd->cntrl & TX_SET)); } #endif /* SHRK_DEBUG */ txd->status = 0; txd->cntrl &= TX_TER; /* preserve Transmit End of Ring */ dv->txpi = TXD_NEXT(dv->txpi); txd = TXD_PROD(dv); } return; } /* * Function: shrktx_queued * * Purpose: * Transmit queued packets * * MP Locking: * Called with tx lock held. */ void shrktx_queued(shrkdev_t *dv) { mblk_t *mp; pl_t s; DEBUG11(CE_CONT, "shrktx_queued(%x) flags %x\n", dv, dv->flags); while ((mp = getq(dv->tx_queue)) != NULL) { if (!TXD_AVAIL(dv)) { DEBUG11(CE_CONT, "shrktx_queued: out of TXDs\n"); DEBUG12(CE_CONT, "shrktx_queued: T txcomplete\n"); #ifdef OPENSERVER s = LOCK(dv->lktxcomplete); shrktx_complete(dv); DEBUG12(CE_CONT, "shrktx_queued: U txcomplete\n"); UNLOCK(dv->lktxcomplete, s); #else if ((s = TRYLOCK(dv->lktxcomplete, plstr)) != invpl) { shrktx_complete(dv); DEBUG12(CE_CONT, "shrktx_queued: U txcomplete\n"); UNLOCK(dv->lktxcomplete, s); } else if (!putbq(dv->tx_queue, mp)) { cmn_err(CE_WARN, "shrktx_queued: putbq failed"); freemsg(mp); /* can't queue - drop frame */ break; } else { break; /* message is requeued for later */ } #endif /* OPENSERVER */ } if (shrktx(dv, mp) == B_FALSE) { /* probably memory allocation failure */ DEBUG11(CE_CONT, "shrktx_queued: shrktx failed\n"); break; /* shrktx() may requeue message */ } } return; } /* * Function: shrkrx * * Purpose: * Process received packets * * MP Locking: * Since shrkrx() is ONLY called from interrupt context, and receive * interrupts are masked out before this function gets called, there is * no need for locks. */ void shrkrx(shrkdev_t *dv) { mblk_t *mp; volatile mblk_t *rxmp; /* received message ptr */ uint_t paddr; rxd_t *rxd; mac_stats_eth_t *mst; int len; macaddr_t *ma; DEBUG07(CE_CONT, "shrkrx(%x) rxcurr %x\n", dv, dv->rxcurr); mst = &dv->macstats; rxd = (rxd_t *)dv->rxcurr->b_rptr; #if 0 shrkrxd(dv); #endif while (!(rxd->status & RX_OWN)) { ASSERT(rxd->status & RX_LS); ASSERT(!(rxd->status & RX_DE)); /* don't replace receive descriptor if driver is not bound */ if (! dv->up_queue) { rxmp = NULL; goto rxd_cleanup; } len = ((rxd->status & RX_FL) >> RX_FL_BIT_POS) - RX_CRC; DEBUG07(CE_CONT, "shrkrx: rxd %x len %x\n", rxd, len); /* don't replace receive descriptor if MCA hash is not valid */ if (dv->flags & SHRK_MCA_HASH) { ma = (macaddr_t *)rxd->mp->b_rptr; if (SHRK_MCA(*ma) && !(SHRK_BCAST(*ma)) && #ifdef OPENSERVER mdi_in_mctbl(&dv->mctbl, *ma)) { #else dv->dlpi_cookie && !(mdi_valid_mca(dv->dlpi_cookie, *ma))) { #endif /* OPENSERVER */ rxmp = NULL; goto rxd_cleanup; } } /* copy frame if we can't replace receive buffer */ if ((paddr = shrkalloc_rxbuf(&mp)) == NULL) { DEBUG07(CE_CONT, "shrkrx: shrkalloc_rxbuf failed\n"); if ((rxmp = allocb(len, BPRI_MED)) == NULL) { /* must drop packet due to no memory */ DEBUG07(CE_CONT, "shrkrx: allocb failed\n"); mst->mac_frame_nosr++; rxd->status = RX_OWN; /* 21140A owns buffer */ } else { bcopy((rxd->mp->b_rptr + sizeof(rxd_t)), rxmp->b_rptr, len); } } else { rxmp = rxd->mp; /* pass received message upstream */ DEBUG07(CE_CONT, "shrkrx: rxmp %x mp %x\n", rxmp, mp); mp->b_prev = rxmp->b_prev; mp->b_next = rxmp->b_next; rxmp->b_prev->b_next = mp; rxmp->b_next->b_prev = mp; ((rxd_t *)rxmp->b_prev->b_rptr)->paddr2 = paddr; rxd = (rxd_t *)mp->b_rptr; rxd->paddr1 = paddr + sizeof(rxd_t); /* data buffer */ rxd->paddr2 = ((rxd_t *)rxmp->b_rptr)->paddr2; rxd->mp = mp; } rxd_cleanup: rxd->status = RX_OWN; /* buffer belongs to 21140A */ rxd->cntrl = (SHRK_MAXPACK & RX_RBS1) | RX_RCH; if (rxmp != NULL) { rxmp->b_prev = NULL; /* cleanup rxdesc list pointer */ rxmp->b_next = NULL; /* cleanup rxdesc list pointer */ rxmp->b_rptr += sizeof(rxd_t); /* move rptr to data */ rxmp->b_wptr = rxmp->b_rptr + len; putnext(dv->up_queue, (mblk_t *)rxmp); } rxd = (rxd_t *)rxd->mp->b_next->b_rptr; /* next descriptor */ } dv->rxcurr = (mblk_t *)rxd->mp; /* next receive block to look at */ dv->rxpaddr = ((rxd_t *)rxd->mp->b_rptr)->paddr1 - sizeof(rxd_t); DEBUG07(CE_CONT, "shrkrx: rxcurr %x rxpaddr %x\n", dv->rxcurr, dv->rxpaddr); #if 0 shrkrxd(dv); #endif return; } /* * Function: shrkintr * * Purpose: * Interrupt service routine for the shrk driver. * * DDI8 Note: New return values. The kernel internally considers * all ddi < 7 drivers to return ISTAT_ASSUMED * DDI8 SUSPEND Note: we may get interrupts if we're almost-suspended: * - outstanding command completion interrupt * - interrupt from board that wasn't disabled yet. */ int #ifdef OPENSERVER shrkintr(int idata) #else shrkintr(void *idata) #endif /* OPENSERVER */ { register shrkdev_t *dv; mac_stats_eth_t *mst; uint_t status, mask; pl_t s; #ifdef OPENSERVER int i; for (i = 0; i < shrk_nunit; i++) { dv = &shrk_dv[i]; if (dv->iarg == idata) { break; } } DEBUG03(CE_CONT, "shrkintr(%x) i %x\n", idata, i); if (i == shrk_nunit) { return; } #else dv = (shrkdev_t *)idata; #endif /* OPENSERVER */ mst = &dv->macstats; DEBUG03(CE_CONT, "shrkintr(%x) irq %x\n", idata, dv->irq); if (!(dv->flags & SHRK_PRESENT)) { /* adapter is not present or down */ #ifdef OPENSERVER return; #else return(ISTAT_NONE); #endif /* OPENSERVER */ } DEBUG12(CE_CONT, "shrkintr: L intr\n"); #ifdef OPENSERVER s = LOCK(dv->lkintr); #else s = LOCK(dv->lkintr, plstr); #endif /* OPENSERVER */ /* get interrupt status */ status = inl(CSR5(dv)); DEBUG03(CE_CONT, "shrkintr CSR5-status %x\n", status); if (!(status & IRQ_MASK)) { /* our device didn't generate this interrupt */ DEBUG12(CE_CONT, "shrkintr: U intr - no interrupt\n"); UNLOCK(dv->lkintr, s); #ifdef OPENSERVER return; #else return(ISTAT_NONE); #endif /* OPENSERVER */ } /* mask out similar interrupt(s) while holding interrupt lock */ mask = inl(CSR7(dv)); /* don't change other threads mask */ if (status & ST_ERI) { /* disable receive interrupts while processing early receive */ mask |= IE_RI; } outl(CSR7(dv), (~status) & mask & IRQ_MASK); /* * ack interrupt: clear status bits while holding interrupt lock * so other threads won't attempt to process these interrupts. */ outl(CSR5(dv), status & IRQ_MASK); DEBUG03(CE_CONT, "shrkintr CSR5-status_ack %x\n", inl(CSR5(dv))); /* * We don't need the lock now that status bits are cleared and * similar interrupts are masked out - this allows shrk interrupts * for other reasons to be processed. */ DEBUG12(CE_CONT, "shrkintr: U intr\n"); UNLOCK(dv->lkintr, s); if (status & ST_RI) { /* receive interrupt */ shrkrx(dv); /* only called from interrupt - no locks needed */ } if (status & ST_TI) { /* transmit interrupt */ /* * If we can't get the txcomplete lock, another thread * (streams wput) is already processing transmit completes. */ DEBUG12(CE_CONT, "shrkintr: T txcomplete\n"); #ifdef OPENSERVER s = LOCK(dv->lktxcomplete); { #else if ((s = TRYLOCK(dv->lktxcomplete, plstr)) != invpl) { #endif /* OPENSERVER */ shrktx_complete(dv); DEBUG12(CE_CONT, "shrkintr: U txcomplete\n"); UNLOCK(dv->lktxcomplete, s); } DEBUG12(CE_CONT, "shrkintr: L tx\n"); #ifdef OPENSERVER s = LOCK(dv->lktx); #else s = LOCK(dv->lktx, plstr); #endif /* OPENSERVER */ if (dv->tx_queue->q_first) { shrktx_queued(dv); } DEBUG12(CE_CONT, "shrkintr: U tx\n"); UNLOCK(dv->lktx, s); } if (status & ST_TU) { /* transmit buffer unavailable */ DEBUG03(CE_CONT, "shrkintr: TU txci %x txpi %x\n", dv->txci, dv->txpi); } if (status & ST_ERI) { /* * We can call shrkrx() here because we mask out normal * receive interrupts on early receive interrupts. * Note: Although we didn't explicitly enable early receive * interrupts, sometimes they occur on busy 100Mbps networks. */ DEBUG03(CE_WARN, "shrkintr(%x) early receive", dv); shrkrx(dv); /* only called from interrupt - no locks needed */ } if (status & ST_GTE) { /* we don't use the general timer */ cmn_err(CE_WARN, "shrkintr(%x) general timer expired", dv); } if (status & ST_FBE) { /* fatal bus error */ switch (status & ST_EB_MASK) { case ST_EB_PARITY: cmn_err(CE_CONT, "!shrkintr(%x): parity error\n", dv); /* TODO - issue software reset */ break; case ST_EB_MABORT: cmn_err(CE_CONT, "!shrkintr(%x): master abort\n", dv); break; case ST_EB_TABORT: cmn_err(CE_CONT, "!shrkintr(%x): target abort\n", dv); break; default: cmn_err(CE_CONT, "!shrkintr: abnormal interrupt %x\n", status & ST_EB_MASK); break; } /* * The 21140A spec is a bit unclear about fatal bus errors * (FBE). CSR5-status claims FBEs are not included in the * abnormal interrupt summary AIS, while CSR7-interrupt_enable * claims FBEs are included in AIS. We used to enable * abnormal interrupts here (in case the CSR-5 doc actually * is correct :-), but found that the hardware can get into * a state where it generates lots of abnormal interrupts with * no reason. So, we'll disable abnormal interrupts here... */ status &= ~IE_AI; } /* handle abnormal interrupts */ if (status & ST_AIS) { DEBUG13(CE_CONT, "shrkintr: abnormal status %x\n", status); DEBUG13(CE_CONT, "shrkintr: CSR7-mask %x\n", (~status) & mask & IRQ_MASK); DEBUG13(CE_CONT, "shrkintr: CSR5-ack wr %x\n", status & IRQ_MASK); DEBUG13(CE_CONT, "shrkintr: CSR5-ack rd %x\n", inl(CSR5(dv))); /* * disable abnormal interrupts because the NIC sometimes * generates abnormal interrupts with no underlying cause */ status &= ~ST_AIS; if (status & ST_TPS) { /* transmit process stopped */ DEBUG13(CE_WARN, "shrkintr(%x) TPS", dv); } if (status & ST_TJT) { /* transmit jabber timeout */ DEBUG13(CE_WARN, "shrkintr(%x) TJT", dv); mst->mac_tx_errors++; } if (status & ST_UNF) { /* transmit underflow */ DEBUG13(CE_WARN, "shrkintr(%x) tx UNF", dv); mst->mac_baddma++; } if (status & ST_RU) { /* receive buffer unavailable */ DEBUG13(CE_WARN, "shrkintr(%x) RU", dv); mst->mac_no_resource++; } if (status & ST_RPS) { /* receive process stopped */ DEBUG13(CE_WARN, "shrkintr(%x) RPS", dv); } if (status & ST_RWT) { /* receive watchdog timeout */ DEBUG13(CE_WARN, "shrkintr(%x) RWT", dv); mst->mac_timeouts++; } if (status & ST_ETI) { /* * Early transmit interrupts are not enabled, but they * may occur when other interrupts are processed when * the transmit packet has been fully transferred into * the chip's transmit FIFOs. */ DEBUG13(CE_WARN, "shrkintr(%x) ETI", dv); } } /* * Unmask the interrupts processed by this interrupt thread. * Must get interrupt lock first because CSR7 read/write isn't atomic. */ DEBUG12(CE_CONT, "shrkintr: L intr\n"); #ifdef OPENSERVER s = LOCK(dv->lkintr); #else s = LOCK(dv->lkintr, plstr); #endif /* OPENSERVER */ mask = inl(CSR7(dv)); /* get current mask with lock held */ /* reenable receive interrupts on early receive interrupts */ if (status & ST_ERI) { mask |= IE_RI; } mask |= (status & IRQ_MASK); /* unmask interrupts processed above */ outl(CSR7(dv), mask); DEBUG12(CE_CONT, "shrkintr: U intr\n"); UNLOCK(dv->lkintr, s); #ifdef OPENSERVER return; #else return(ISTAT_ASSERTED); #endif /* OPENSERVER */ } /* * Function: shrkset_all * * Purpose: * Enables or disables all multicast address reception. * OR * Enables or disables all address reception (promiscuous mode). */ void shrkset_all(shrkdev_t *dv) { uint_t om; DEBUG04(CE_CONT, "shrkset_all(%x) flags %x\n", dv, dv->flags); om = inl(CSR6(dv)); DEBUG04(CE_CONT, "shrkset_all(%x) CSR6-OM cur %x ", dv, om); outl(CSR6(dv), (om & ~OM_SR)); /* stop receive */ DEBUG04(CE_CONT, "stop %x ", inl(CSR6(dv))); if (dv->flags & SHRK_PROMISCUOUS) { om |= OM_PR; } if (dv->flags & SHRK_MCA_ALL) { om |= OM_PM; } else { om &= ~OM_FD; } outl(CSR6(dv), om); DEBUG04(CE_CONT, "write %x read %x\n", om, inl(CSR6(dv))); return; } /* * clk_latch latches cmd into serial rom or mii */ static void clk_latch(int addr, uint_t cmd, uint_t clk_bit) { /* DEBUG08(CE_CONT, "clk_latch(%x %x %x)\n", addr, cmd, clk_bit); */ outl(addr, cmd); drv_usecwait(1); outl(addr, cmd | clk_bit); drv_usecwait(1); outl(addr, cmd); drv_usecwait(1); return; } /* * shrk_srom_read reads the contents of the serial rom from offset * the memory location specified by addr. */ ushort shrk_srom_read(shrkdev_t *dv, unchar offset) { register int i; ushort data = 0; uint_t tmp; uint_t addr = CSR9(dv); /* DEBUG08(CE_CONT, "shrk_srom_read(%x %b)\n", addr, offset); */ ASSERT((offset <= 126) && !(offset & 0x1)); /* initialize and select srom */ outl(addr, ROM_WR | ROM_SR); drv_usecwait(1); clk_latch (addr, ROM_WR | ROM_SR | ROM_SCS, ROM_SCLK); /* read command: 110 */ clk_latch(addr, ROM_WR | ROM_SR | ROM_SCS | ROM_SDIN, ROM_SCLK); clk_latch(addr, ROM_WR | ROM_SR | ROM_SCS | ROM_SDIN, ROM_SCLK); clk_latch(addr, ROM_WR | ROM_SR | ROM_SCS, ROM_SCLK); /* load 6-bit address offset */ for (i = 0; i < 6; i++, offset <<= 1) { tmp = ROM_WR | ROM_SR | ROM_SCS; if (offset & 0x40) { /* send 1 if high-bit of 6-bit address is set */ tmp |= ROM_SDIN; } clk_latch(addr, tmp, ROM_SCLK); } drv_usecwait(1); /* read the data from the srom */ for (i = 15; i >= 0; --i) { outl(addr, ROM_RD | ROM_SR | ROM_SCLK | ROM_SCS); drv_usecwait(1); tmp = (inl(addr) & ROM_SDOUT) >> 3; data |= tmp << i; outl(addr, ROM_RD | ROM_SR | ROM_SCS); drv_usecwait(1); } /* done with srom */ outl(addr, 0x0000ff00); drv_usecwait(1); return(data); } STATIC void shrk_mii_phy_addr(shrkdev_t *dv) { register int i; unchar addr; addr = dv->phy_addr; for (i = 0; i < SHRK_PHY_ADDRLEN; i++, addr <<= 1) { if (addr & 0x10) { clk_latch(CSR9(dv), MII_MDO, MII_MDC); } else { clk_latch(CSR9(dv), 0, MII_MDC); } } return; } /* * shrk_mii_init initializes dv->phy_addr */ STATIC void shrk_mii_init(shrkdev_t *dv) { ushort mii; uint_t i; DEBUG08(CE_CONT, "shrk_mii_init(%x) gpcontrol %x\n", dv, dv->gpcontrol); /* initialize general purpose register with values from srom */ outl(CSR12(dv), GP_GPC | dv->gpcontrol); if (dv->gpresetlen && *dv->gpresetlen) { unchar *gpreset; gpreset = dv->gpresetseq; DEBUG08(CE_CONT, "shrk_mii_init: gpreset"); for (i = 0; i < *dv->gpresetlen; i++) { DEBUG08(CE_CONT, " %b", *gpreset); outl(CSR12(dv), *gpreset); gpreset++; } DEBUG08(CE_CONT, "\n"); } drv_usecwait(500000); /* find phy address */ for (dv->phy_addr = 0; dv->phy_addr < SHRK_MAX_PHY; dv->phy_addr++) { if (shrk_mii_read(dv, SHRK_BMCR, &mii) == B_TRUE) { if (shrk_mii_read(dv, SHRK_BMSR, &mii) == B_TRUE) { break; } } } #ifdef SHRK_DEBUG if (dv->phy_addr == SHRK_MAX_PHY) { DEBUG08(CE_CONT, "shrk_mii_init: NO PHYs FOUND\n"); } else { DEBUG08(CE_CONT, "shrk_mii_init: found phy %b\n", dv->phy_addr); } #endif return; } /* * shrk_mii_read reads the mii contents of the mii register * specified by register and returns the result in data. */ STATIC boolean_t shrk_mii_read(shrkdev_t *dv, unchar reg, ushort *data) { register int i; uint_t tmp; boolean_t ret = B_TRUE; #if 0 DEBUG08(CE_CONT, "shrk_mii_read(%x %b %x) ", dv, reg, *data); DEBUG08(CE_CONT, "phy_addr %b\n", dv->phy_addr); #endif /* send preamble to mii: 32 1's */ for (i = 0; i < 32; i++) { clk_latch(CSR9(dv), MII_MDO, MII_MDC); } /* mii start: 01 */ clk_latch(CSR9(dv), 0, MII_MDC); clk_latch(CSR9(dv), MII_MDO, MII_MDC); /* mii read: 10 */ clk_latch(CSR9(dv), MII_MDO, MII_MDC); clk_latch(CSR9(dv), 0, MII_MDC); /* load phy address */ shrk_mii_phy_addr(dv); /* load mii register number */ for (i = 0; i < SHRK_PHY_ADDRLEN; i++, reg <<= 1) { (reg & 0x10) ? (tmp = MII_MDO) : (tmp = 0); clk_latch(CSR9(dv), tmp, MII_MDC); } /* turnaround */ clk_latch(CSR9(dv), MII_MII, MII_MDC); tmp = inl(CSR9(dv)); if (tmp & MII_MDI) { DEBUG08(CE_CONT, "MII turnaround NOT zero\n"); ret = B_FALSE; /* continue with read so mii won't be left in funky state */ } *data = 0; for (i = 15; i >= 0; --i) { outl(CSR9(dv), MII_MII); drv_usecwait(1); outl(CSR9(dv), MII_MII | MII_MDC); drv_usecwait(1); tmp = (inl(CSR9(dv)) & MII_MDI) >> MII_MDI_BIT_POS; *data |= tmp << i; } return(ret); } /* * shrk_mii_write writes val to the mii register reg */ STATIC void shrk_mii_write(shrkdev_t *dv, unchar reg, ushort val) { register int i; int addr = CSR9(dv); uint_t tmp; /* send preamble to mii: 32 1's */ for (i = 0; i < 32; i++) { clk_latch(addr, MII_MDO, MII_MDC); } /* mii start: 01 */ clk_latch(addr, 0, MII_MDC); clk_latch(addr, MII_MDO, MII_MDC); /* mii write: 01 */ clk_latch(addr, 0, MII_MDC); clk_latch(addr, MII_MDO, MII_MDC); /* load phy address */ shrk_mii_phy_addr(dv); /* load mii register address */ for (i = 0; i < SHRK_PHY_ADDRLEN; i++) { (reg & 0x10) ? (tmp = MII_MDO) : (tmp = 0); clk_latch(addr, tmp, MII_MDC); reg <<= 1; } /* turnaround: 10 */ clk_latch(addr, MII_MDO, MII_MDC); clk_latch(addr, 0, MII_MDC); /* write value to mii register */ for (i = 0; i < sizeof(ushort); i++, val <<=1 ) { (val & 0x8000) ? (tmp = MII_MDO) : (tmp = 0); clk_latch(addr, tmp, MII_MDC); } drv_usecwait(500); return; } 07070100023897000081a400000000000000030000000137532c5a0000ef3400001dff0000000100000000000000000000002e00000000root/usr/src/O5hdk/net/drv/mdi/shrk/shrkmdi.c/* * @(#)shrkmdi.c 77.6 * * Copyright (C) The Santa Cruz Operation, 1998-1999. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated as Confidential. */ /* shrk MDI UnixWare driver - sample driver for the Matrox SHARK NS100/4 * Matrox * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ * $ -- __ $ * $ --_ -- __ $ * $ vv \__ - (| $ * $ vv \__ (o) ) ( | $ * $ vv \__ ) ( - | $ * $ vv \ ) ( -- | $ * $ / ) | /--- | $ * $ \ ) | \--- | $ * $ ^^ / ) ( -- | $ * $ ^^_/ ) ( - | $ * $ ^^_/ ) ( | $ * $ ^^_/ __ - (| $ * $ -- __ -- $ * $ -- $ * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ * Networks * begin 644 shrk.gif M1TE&.#=A)@ O ,0 /___^_P\/_>Y]'=XL?%QIBMO9^;G(R-C9>!A'!]A:I1 M7SYSDF-C8[ A.S15:4)"0L8 (:L!'P!"3>=:0/H$0RDQZ/' "1F$]HCT9L\&;FDZ0 @) "!SV00*)8! M"$#7 !@ #DT" %G*?LCJ,H/K5@+\!Q]S=P ?; ,G61-O!@$/XN;BU'$(D'1+!PL/$ MQ<(4PAF^'QT4&!<6%A?3&C8VEK<[0,%".#QXQ?I)-C#48)= 0IN"+P+UX" '$ ZZT;%J! @@$+&S ( MH !B,0H3!"[[4,Q-@(4*#/_$PS",@C21VT@06S#@P *%_L:ALU"!Y4 [U^2H MS DAXH4*%3+ O">S&$U]"_U%H$"!G 5D/PNF.T(40@:>2+--O!8)0 6B%\A5 ML" V)C"R!0I\RQE!+=NE!+E=6U!@0$>B=MLR?6N,3("S.2^(NYM5[\P$"Q(, M]<<6; 7!>9D9:]<%<;P*R"@@!8TWBX;'$MS\]<1^+C6QGQ.I$F38S]X5P.6ULK\0%1QY;1C MSL(N )_/>D%5(YA(5)I2L4/4YX\0WSYQF:3Q*]=?ZW_ )X@@'.$* 04L Z(:7P!0P"(, M$%') 01,^$<: &R @"0F4C' W(@(L<&!\#(0QD%//)! @0,8, ! 801DR<, ?GC!"E#!0F5D06):00)9:89)*Y40@ ._)! end * */ #ifdef _KERNEL_HEADERS #include #else #include "shrk.h" #endif #ifdef SHRK_DEBUG ulong_t shrkdebug = 0x00000001; #endif /* broadcast address for routing to this interface */ macaddr_t shrk_broad = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; /* shrk_srom_mac contains the mac address for ECU 0 (found at PCI Device 8) */ srom_macaddr_t shrk_srom_mac[SHRK_NUM_PCI_BUS]; #ifdef OPENSERVER shrkdev_t *shrk_dv; #else /* lock declarations */ #define SHRK_HIER 1 STATIC LKINFO_DECL(shrk_lkdv, "MDI::shrk device lock", 0); STATIC LKINFO_DECL(shrk_lktx, "MDI::shrk transmit lock", 0); STATIC LKINFO_DECL(shrk_lktxcomplete, "MDI::shrk transmit complete lock", 0); STATIC LKINFO_DECL(shrk_lkintr, "MDI::shrk interrupt lock", 0); /* pointers used to specify physical memory limitations */ physreq_t *shrk_phys; /* buffer descriptors and receive buffers */ physreq_t *shrk_txphys; /* transmit */ /* * ndcfg/netcfg version info string * 1.0: initial UnixWare version * 2.0: add support for OpenServer */ static char _ndversion[]="2.0"; static const char shrk_drv_name[]="shrk"; /* MUST be MODNAME */ /* d_open and d_close can't be NULL */ STATIC drvops_t shrk_drvops = { /* d_config d_open d_close d_devinfo */ shrkconfig, shrkopen, shrkclose, shrkdevinfo, /* d_biostart d_ioctl d_drvctl d_mmap */ NULL, NULL, NULL, NULL }; #endif /* OPENSERVER */ /* old ddi7 style for now until struct qinit changes in stream.h */ struct module_info shrk_minfo = { 0, "shrk", SHRK_HEADERSZ, SHRK_TXMAXSZ, 16*SHRK_TXMAXSZ, 12*SHRK_TXMAXSZ }; #ifdef OPENSERVER struct qinit shrkurinit = { NULL, NULL, shrkopen, shrkclose, NULL, &shrk_minfo, NULL }; struct qinit shrkuwinit = { shrkuwput, NULL, NULL, NULL, NULL, &shrk_minfo, NULL }; #else struct qinit shrkurinit = { NULL, NULL, NULL, NULL, NULL, &shrk_minfo, 0 }; struct qinit shrkuwinit = { shrkuwput, NULL, NULL, NULL, NULL, &shrk_minfo, 0 }; #endif /* OPENSERVER */ const struct streamtab shrkinfo = { &shrkurinit, &shrkuwinit, NULL, NULL }; #ifndef OPENSERVER /* * Driver is multithreaded - use D_MP in drv_flags. * We do not implement cloning, so drv_maxchan is set to 0. */ STATIC drvinfo_t shrk_drvinfo = { /* drv_ops drv_name drv_flags drv_str drv_maxchan */ &shrk_drvops, shrk_drv_name, D_HOT|D_MP, &shrkinfo, 0 }; int shrkdevinfo(void *idata, channel_t channel, di_parm_t parm, void *valp) { switch(parm) { case DI_MEDIA: *(char **)valp = "NIC"; /* short names here */ return(0); case DI_SIZE: case DI_RBCBP: case DI_WBCBP: case DI_PHYS_HINT: default: return(EOPNOTSUPP); } /* NOTREACHED */ } /* * Function: _load(void) * * Purpose: * Called by DLM when the module is loaded * and calls our CFG_ADD code from drv_attach() */ int _load(void) { /* specify physical memory requirements for descriptors and rx bufs */ shrk_phys = physreq_alloc(KM_SLEEP); /* wait until we get memory */ shrk_phys->phys_align = 32; /* longword aligned */ shrk_phys->phys_boundary = 0; /* no boundary constraints */ shrk_phys->phys_dmasize = 32; /* 32 address lines */ shrk_phys->phys_max_scgth = 1; /* used by msgscgth */ shrk_phys->phys_flags = PREQ_PHYSCONTIG; /* physically contiguous */ if (physreq_prep(shrk_phys, KM_SLEEP) == B_FALSE) { cmn_err(CE_WARN, "shrk: _load: physreq_prep - RX failed"); return(EINVAL); } /* specify physical memory requirements for transmit buffers */ shrk_txphys = physreq_alloc(KM_SLEEP); shrk_txphys->phys_align = 32; /* longword aligned */ shrk_txphys->phys_boundary = 0; /* no boundaries */ shrk_txphys->phys_dmasize = 32; /* 32 address lines */ shrk_txphys->phys_max_scgth = shrk_max_txbuf_per_msg; /* data bufs */ shrk_txphys->phys_flags = PREQ_PHYSCONTIG; /* physically contig */ if (physreq_prep(shrk_txphys, KM_SLEEP) == B_FALSE) { cmn_err(CE_WARN, "shrk: _load: physreq_prep - TX failed"); return(EINVAL); } return(drv_attach(&shrk_drvinfo)); } /* * Function: _unload * * Purpose: * Called by DLM when the module is unloading. You should remember to: * - deallocate memory acquired for private data in _load * - cancel any outstanding itimeout(), btimeout(), or bufcall() * requests made by the module * - call drv_detach() to deregister the driver */ int _unload(void) { /* * Note: drv_detach() may call XXconfig() with CFG_SUSPEND and * CFG_REMOVE arguments. Do not free up data strucures before * calling drv_detach(). */ drv_detach(&shrk_drvinfo); physreq_free(shrk_phys); physreq_free(shrk_txphys); return(0); } #endif /* ndef OPENSERVER */ /* * Function: shrkfreemem * * Purpose: * Frees up all space allocated for per-device structures. */ void shrkfreemem(shrkdev_t *dv) { register int i; mblk_t *mp, *nmp; if (dv == NULL) return; #ifndef OPENSERVER /* free up locks */ if (dv->lkdv) LOCK_DEALLOC(dv->lkdv); if (dv->lktx) LOCK_DEALLOC(dv->lktx); if (dv->lktxcomplete) LOCK_DEALLOC(dv->lktxcomplete); if (dv->lkintr) LOCK_DEALLOC(dv->lkintr); #endif /* ndef OPENSERVER */ /* TODO - free pending tx buffers */ /* free transmit descriptors */ if (dv->txd) kmem_free((void *)dv->txd, shrk_num_tx_desc * sizeof(txd_t)); /* free rx buffers */ mp = dv->rxcurr; for (i = 0; mp && (i < shrk_num_rx_desc); i++) { nmp = mp->b_next; mp->b_next = NULL; mp->b_prev = NULL; freemsg(mp); mp = nmp; } #ifndef OPENSERVER kmem_free((void *)dv, sizeof(shrkdev_t)); #endif /* ndef OPENSERVER */ return; } /* * Function: shrkalloc_txdesc * * Purpose: * Allocate and initialize transmit descriptors. * Also initializes per-device structure. * Called once for each CFG_ADD. * * Note: * The hardware supports two types of buffer allocation models: * a ring of descriptors or a chain of descriptors. For transmit, * the ring model is nice because it reduces the number of * descriptors needed for fragmented packets. */ STATIC boolean_t shrkalloc_txdesc(shrkdev_t *dv) { size_t sz; DEBUG09(CE_CONT, "shrkalloc_txdesc(%x)\n", dv); /* verify Space.c variables are set to reasonable values */ if (shrk_num_tx_desc < SHRK_TX_MIN_DESC) { cmn_err(CE_NOTE, "shrk_num_tx_desc (%d) reset to %d\n", shrk_num_tx_desc, SHRK_TX_MIN_DESC); shrk_num_tx_desc = SHRK_TX_MIN_DESC; } if (shrk_max_txbuf_per_msg < SHRK_TX_MAX_BUF) { cmn_err(CE_NOTE, "shrk_max_txbuf_per_msg (%d) reset to %d\n", shrk_max_txbuf_per_msg, SHRK_TX_MAX_BUF); shrk_max_txbuf_per_msg = SHRK_TX_MAX_BUF; } if (shrk_max_txbuf_per_msg > ((shrk_num_tx_desc * 2) - 2)) { cmn_err(CE_NOTE, "shrk_max_txbuf_per_msg (%d) reset to %d\n", shrk_max_txbuf_per_msg, ((shrk_num_tx_desc * 2) - 2)); shrk_max_txbuf_per_msg = ((shrk_num_tx_desc * 2) - 2); } if (shrk_num_tx_descs_per_interrupt > shrk_num_tx_desc) { cmn_err(CE_NOTE, "shrk_num_tx_descs_per_interrupt " "(%d) reset to %d\n", shrk_num_tx_descs_per_interrupt, (shrk_num_tx_desc / 2)); shrk_num_tx_descs_per_interrupt = shrk_num_tx_desc / 2; } sz = shrk_num_tx_desc * sizeof(txd_t); /* allocate physically contiguous memory for transmit descriptors */ #ifdef OPENSERVER if ((dv->txd = kmem_alloc(sz, KM_NOSLEEP)) #else if ((dv->txd = kmem_alloc_phys(sz, shrk_phys, &dv->txpaddr, KM_FAIL_OK)) #endif /* OPENSERVER */ == NULL) { cmn_err(CE_WARN, "shrkalloc_txdesc: kmem_alloc_phys failed"); return(NULL); } #ifdef OPENSERVER dv->txpaddr = kvtophys(dv->txd); #endif /* OPENSERVER */ DEBUG10(CE_CONT, "tx txd %x paddr %x\n", dv->txd, dv->txpaddr); /* initialize transmit buffer descriptors and per-device structure */ bzero(dv->txd, sz); dv->txd[shrk_num_tx_desc-1].cntrl = TX_TER; /* last desc end of ring */ return(B_TRUE); } /* * Function: shrkalloc_rxbuf * * Purpose: * Allocate a receive descriptor/buffer * * Returns: * Physical address of data buffer * * Side effects: * Writes message pointer into the address of mp passed as an argument */ uint_t shrkalloc_rxbuf(mblk_t **mp) { uint_t ret; scgth_t sg; mblk_t *nmp; /* save pointer to allocated mblk for failures */ /* allocate mblk with physically contiguous memory */ #ifdef OPENSERVER if ((nmp = allocb(SHRK_RX_SZ, BPRI_MED)) == NULL) { #else if ((nmp = allocb_physreq(SHRK_RX_SZ, BPRI_MED, shrk_phys)) == NULL) { #endif /* OPENSERVER */ cmn_err(CE_WARN, "shrkalloc_rxbuf: allocb_physreq failed"); return(NULL); } /* obtain physical memory addresses */ nmp->b_wptr = nmp->b_rptr + SHRK_RX_SZ; #ifdef OPENSERVER *mp = nmp; ret = kvtophys(nmp->b_rptr); #else if ((*mp = msgscgth(nmp, shrk_phys, &sg)) == NULL) { cmn_err(CE_WARN, "shrkalloc_rxbuf: msgscgth failed"); freemsg(nmp); /* prevent memory leak if msgscgth fails */ return(NULL); } ASSERT(sg.sg_format == SCGTH32); /* 32-bit address */ ret = sg.sg_elem.el32->sg_base; /* assign before scgth_free */ DEBUG09(CE_CONT, "rx nelem %b paddr %x\n", sg.sg_nelem, ret); scgth_free(&sg); #endif /* OPENSERVER */ DEBUG09(CE_CONT, "rx msgscgth mp %x rptr %x\n", *mp, (*mp)->b_rptr); return(ret); } /* * Function: shrkrxinit * * Purpose: * Allocate and initialize receive descriptors and buffers * Called once for each CFG_ADD. * * Note: * The hardware supports two types of receive buffer allocation models: * a ring of descriptors or a chain of descriptors. The ring model lends * itself nicely to server-oriented networking traffic (i.e., we expect * lots of large transmits and receive consists primarily of smaller ACKs) * because each descriptor has space for two data buffers. The first one * could be large enough for a minimum-sized ethernet packet, and the * second data buffer could be large enough for the rest of the packet. * Unfortunately, ddi-8 has removed the vtop() function. To obtain the * physical memory address of the receive descriptor array, we would have * to allocate the memory for the contiguous rx descriptors using * allocb_physreq, then obtain the base physical memory address of that * with msgscgth(). It would be more straightforward to allocate the * memory with kmem_alloc_physreq(), and obtain the physical memory * address (which is needed to initialize CSR3) using vtop(). * * So, we'll use the chained receive descriptor model which lends itself * quite nicely to ddi-8. What the heck, these servers are supposed to * have a lot of memory anyhow! */ STATIC boolean_t shrkrxinit(shrkdev_t *dv) { register int i; mblk_t *mp, *prevmp; uint_t paddr; rxd_t *rxd; DEBUG09(CE_CONT, "shrkrxinit(%x)\n", dv); /* verify Space.c variable is set to reasonable value */ if (shrk_num_rx_desc < SHRK_RX_MIN_DESC) { cmn_err(CE_NOTE, "shrk_num_rx_desc (%d) below minimum (%d)\n", shrk_num_rx_desc, SHRK_RX_MIN_DESC); shrk_num_rx_desc = SHRK_RX_MIN_DESC; } /* allocate rx descriptors and buffers */ for (i = 0; i < shrk_num_rx_desc; i++) { if ((paddr = shrkalloc_rxbuf(&mp)) == NULL) { cmn_err(CE_WARN, "shrkrxinit: %d no rxbuf memory", i); break; } if (!i) { mp->b_prev = (mblk_t *)0xDEADBEEF; dv->rxcurr = mp; dv->rxpaddr = paddr; } else { mp->b_prev = prevmp; prevmp->b_next = mp; ((rxd_t *)prevmp->b_rptr)->paddr2 = paddr; } rxd = (rxd_t *)mp->b_rptr; rxd->status = RX_OWN; /* buffer belongs to 21140A */ rxd->cntrl = (SHRK_MAXPACK & RX_RBS1) | RX_RCH; rxd->paddr1 = paddr + sizeof(rxd_t); /* scribble after descr */ rxd->mp = mp; /* need this to hook up replacement rx buffers */ prevmp = mp; } if (i) { /* complete the ring of chained descriptors */ rxd->paddr2 = dv->rxpaddr; mp->b_next = dv->rxcurr; dv->rxcurr->b_prev = mp; } #if 0 shrkrxd(dv); #endif /* handle memory allocation failures */ if (i < shrk_num_rx_desc) { shrk_num_rx_desc = i; /* reset maximum descriptors */ if (i < SHRK_RX_MIN_DESC) { return(B_FALSE); /* shrkfreemem will free up mblks */ } else { /* allow CFG_ADD to continue */ cmn_err(CE_NOTE, "shrkrxinit: set num_rx_desc=%d\n", i); --rxd; } } return(B_TRUE); } /* * Function: shrkmacaddr * * Purpose: * Initialize per-device mac addresses after ECU 0 has been CFG_ADDed */ void shrkmacaddr(shrkdev_t *dv) { srom_macaddr_t *srm; char p[2]; DEBUG00(CE_CONT, "shrkmacaddr(%x)\n", dv); srm = &shrk_srom_mac[dv->pci_bus]; if (!srm->valid) { DEBUG00(CE_CONT, "shrkmacaddr(%x) invalid macaddr\n", dv); /* * Note: we didn't use a periodic timeout because we need * to cancel it from this routine, and that's not allowed */ #ifdef OPENSERVER if (!(dv->tid = timeout(shrkmacaddr, dv, 2 * HZ))) { #else if (!(dv->tid = itimeout(shrkmacaddr, dv, SHRK_TWO_SEC_HZ, plstr))) { #endif /* OPENSERVER */ cmn_err(CE_WARN, "shrkmacaddr: timeout failed"); } return; } dv->tid = 0; if (!(dv->flags & SHRK_OSICOM)) { bcopy(srm->hwaddr, dv->hwaddr, MDI_MACADDRSIZE); } switch (dv->port) { case 0: case 1: break; case 2: dv->hwaddr[MDI_MACADDRSIZE-1] += 1; break; case 3: dv->hwaddr[MDI_MACADDRSIZE-1] += 2; break; case 4: dv->hwaddr[MDI_MACADDRSIZE-1] += 3; break; default: mdi_printcfg("shrk", /* name */ dv->ioaddr, /* base */ dv->addrlen, /* offset */ dv->irq, /* vec */ -1, /* dma */ "BAD PORT %b", /* fmt */ dv->port); return; } p[0] = dv->port + 0x30; p[1] = 0; bcopy(dv->hwaddr, dv->eaddr, MDI_MACADDRSIZE); dv->flags |= SHRK_PRESENT; /* announce ourselves to the world */ mdi_printcfg("shrk", /* name */ dv->ioaddr, /* base */ dv->addrlen, /* offset */ dv->irq, /* vec */ -1, /* dma */ #ifdef OPENSERVER "%s addr=%s", /* fmt */ #else "%s addr=%s Speed/Dx=%d/%s", /* fmt */ #endif /* OPENSERVER */ (dv->flags & SHRK_SNAPPER) ? "Snapper" : strcat("port=", p), #ifdef OPENSERVER shrkaddrstr(dv->eaddr)); #else shrkaddrstr(dv->eaddr), (!(dv->mii_par & SHRK_PAR_10)) ? 100 : 10, (dv->mii_par & SHRK_PAR_FDX) ? "F" : "H"); #endif /* OPENSERVER */ return; } boolean_t shrk_adapter_detect(shrkdev_t *dv) { int i; ushort sr; /* the word from the static rom */ macaddr_t ma; srom_macaddr_t *srm; for (i = 0; i < sizeof(macaddr_t); i += 2) { /* macaddr is offset two bytes into srom */ sr = shrk_srom_read(dv, i+2); ma[i] = (unchar)(sr >> 8); ma[i+1] = (unchar)(sr & 0xff); } switch (*((ulong_t *)ma)) { case 0: dv->flags |= SHRK_OSICOM; dv->port = 0; break; default: if ((ma[0] == 0x00) && (ma[1] == 0x20) && (ma[2] == 0xfc)) { if ((ma[3] & 0xfe) == SHRK_BIA_SHARK) { switch (dv->pci_dev) { case SHRK_PCIDEV_ECU0: dv->port = 1; break; case SHRK_PCIDEV_ECU1: dv->port = 2; break; case SHRK_PCIDEV_ECU2: dv->port = 3; break; case SHRK_PCIDEV_ECU3: dv->port = 4; break; default: cmn_err(CE_WARN, "shrk_adapter_detect: unexpected pci device %b", dv->pci_dev); return(B_FALSE); } dv->flags |= SHRK_SHARK; } else { dv->flags |= SHRK_SNAPPER; dv->port = 1; } } else { return(B_FALSE); } break; } /* copy mac address into shrk_srom_mac[] on Matrox adapters */ srm = &shrk_srom_mac[dv->pci_bus]; switch (dv->port) { case 0: /* Osicom adapter */ srm->valid = 1; break; case 1: /* Matrox Snapper or ECU0 on Matrox Shark card */ bcopy(ma, srm->hwaddr, sizeof(macaddr_t)); srm->valid = 1; break; } return(B_TRUE); } #ifdef OPENSERVER void shrkinit() { shrkdev_t *dv; shrkparam_t *cp; ushort cmd, unit, pciunit; int i; struct pci_businfo bi; struct pci_devinfo di; driver_info idi; boolean_t got_mac_addr; /* make sure this system has a PCI bus */ if (!pci_buspresent(&bi)) { cmn_err(CE_WARN, "shrkinit: no pci bus present"); shrk_nunit = 0; return; } /* allocate space needed for per-device structures */ if ((shrk_dv = (shrkdev_t *)kmem_zalloc((sizeof(shrkdev_t)*shrk_nunit), KM_NOSLEEP)) == NULL) { cmn_err(CE_WARN, "shrkinit: no memory for shrk_dv[]"); shrk_nunit = 0; return; } DEBUG00(CE_CONT, "shrkinit: shrk_dv %x\n", shrk_dv); /* * verify NIC is present and handle mapping the ordering of * board configuration to pci_finddevice() order below so * the user can configure pci unit #1 as minor #0 if there * is more than one board in the system */ for (unit = 0; unit < shrk_nunit; unit++) { dv = &shrk_dv[unit]; di.funcnum = 0; for (pciunit = 0; pci_finddevice(0x1011, 0x0009, pciunit, &di); pciunit++) { DEBUG00(CE_CONT, "shrkinit: unit %d pciunit %d\n", unit, pciunit); for (i = 0; i < shrk_nunit; i++) { cp = &shrk_param[i]; if ((cp->pci_bus == di.busnum) && (cp->pci_dev == di.slotnum)) { break; } } if (i == shrk_nunit) { continue; } dv->pciindex = i; dv->pci_bus = cp->pci_bus; dv->pci_dev = cp->pci_dev; if (!pci_readword(&di, PCI_IO_OFFSET, (ushort *)&dv->ioaddr)) { mdi_printcfg("shrk", -1, -1, -1, -1, "pci_readword: IOaddr FAILED"); continue; } dv->ioaddr &= ~PCI_IO_ENABLE; if (!pci_readbyte(&di, PCI_INTLINE, (unchar *)&dv->irq)) { mdi_printcfg("shrk", dv->ioaddr, -1, -1, -1, "pci_readword IRQ"); continue; } dv->flags = SHRK_NICPRESENT; break; } if (!(dv->flags & SHRK_NICPRESENT)) { mdi_printcfg("shrk", dv->ioaddr, -1, -1, -1, "ADAPTER NOT PRESENT"); continue; } if (!pci_readword(&di, PCI_CMD_OFFSET, &cmd)) { mdi_printcfg("shrk", dv->ioaddr, -1, -1, -1, "pci_readword(CMD) FAILED"); continue; } DEBUG00(CE_CONT, "shrkinit: cmd %x\n", cmd); if (! (cmd & PCI_IO_ENABLE)) { mdi_printcfg("shrk", dv->ioaddr, -1, -1, -1, "PCI I/O DISABLED"); continue; } if (! (cmd & PCI_MEM_ENABLE)) { mdi_printcfg("shrk", dv->ioaddr, -1, -1, -1, "PCI MEMORY DISABLED"); continue; } if (! (cmd & PCI_MASTER)) { mdi_printcfg("shrk", dv->ioaddr, -1, -1, -1, "PCI BUSMASTER DISABLED"); continue; } /* obtain configuration information */ dv->media = SHRK_MEDIA_AUTO; /* cm_params may overwrite this */ got_mac_addr = shrk_adapter_detect(dv); idi.version = DRV_INFO_VERS_2; /* this is a pci device */ idi.name = "shrk"; idi.irq = IDIST_PCI_IRQ(dv->pci_dev, 0); idi.bus = dv->pci_bus; idi.weight = SPL5; idi.intr = shrkintr; idi.ipl = SPL5; idi.route = IROUTE_GLOBAL; idi.mode = IMODE_SHARED_CDRIVERIPL; idi.processor_mask = remap_driver_cpu(1, ICPU_ANY); idistributed(&idi); /* initialize hardware */ if (shrkhwinit(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkinit: shrkhwinit FAILED"); shrkfreemem(dv); continue; } /* determine our mac address if ecu 0 had been CFG_ADDed */ if (got_mac_addr == B_TRUE) { /* * When ecu 0 is CFG_ADDed, the global mac address * array for these four nics gets initialized. * * Unfortunately, this adapter doesn't fit perfectly * into the ddi 8 device independence model. The card * has one srom that hangs off of ecu 0 (found at pci * device 8) that contains the base mac address used * by ecu 0. Ecu 1 uses the base mac address plus 1, * ecu 2 uses the base mac address plus 2, and ecu 3 * uses the base mac address plus 3. To determine each * mac address, we have to know the base mac address, * but it's only available from the srom which is at * offset 0x48 from the base I/O address of ecu 0. * Since each CFG_ADD only knows about it's own resmgr * key, we use a global array to contain the base mac * address. */ shrkmacaddr(dv); /* prints adapter present message */ } } } #else /* * Function: shrkverify_brdid * * Purpose: read brdid from the resmgr and verify pci configuration */ STATIC boolean_t shrkverify_brdid(rm_key_t rmkey) { struct cm_args cm_args; char brdid[11]; /* 0xVVVVDDDD */ ushort cmd; int i; ushort sr; /* the word from static rom */ srom_macaddr_t *srm; int ret; DEBUG00(CE_CONT, "shrkverify_brdid(%x)\n", rmkey); /* * Verify that the boardid is correct for this resmgr key. * This isn't necessary here since we only support one NIC, * but this would be a good time to loop through all of * the supported brdid's and compare them to the brdid * being used here if we need to differentiate chips. */ bzero((caddr_t)brdid, sizeof(brdid)); cm_args.cm_key = rmkey; cm_args.cm_n = 0; cm_args.cm_param = CM_BRDID; cm_args.cm_val = brdid; cm_args.cm_vallen = sizeof(brdid); cm_begin_trans(cm_args.cm_key, RM_READ); ret = cm_getval(&cm_args); cm_end_trans(cm_args.cm_key); if (ret) { cmn_err(CE_WARN, "shrkverify_brdid: cm_getval failed"); return(B_FALSE); } if (strncmp(brdid, SHRK_BRDID, (sizeof(SHRK_BRDID) - 1))) { cmn_err(CE_WARN, "shrkverify_brdid: boardid <%s> expected <%s>", brdid, SHRK_BRDID); return(B_FALSE); } /* verify PCI configuration */ cm_begin_trans(cm_args.cm_key, RM_READ); ret = cm_read_devconfig(rmkey, PCI_CMD_OFFSET, &cmd, sizeof(cmd)); cm_end_trans(cm_args.cm_key); if (ret < 0) { cmn_err(CE_WARN, "shrkverify_brdid: cm_read_devconfig " "failed at key %d, error=%d", rmkey, ret); return(B_FALSE); } if (! (cmd & PCI_IO_ENABLE)) { cmn_err(CE_WARN, "shrkverify_brdid: PCI I/O access not " "enabled at key %d", rmkey); return(B_FALSE); } if (! (cmd & PCI_MEM_ENABLE)) { cmn_err(CE_WARN, "shrkverify_brdid: PCI memory access " "not enabled at key %d", rmkey); return(B_FALSE); } if (! (cmd & PCI_MASTER)) { cmn_err(CE_WARN, "shrkverify_brdid: PCI busmaster " "access not enabled at key %d", rmkey); return(B_FALSE); } return(B_TRUE); } /* * Function: shrkcm_params * * Purpose: read relevant parameters from the resmgr */ STATIC boolean_t shrkcm_params(shrkdev_t *dv, rm_key_t rmkey) { int ret; struct cm_args cm_args; cm_range_t range; cm_num_t cm_num; char str[512]; /* configuration strings from bcfg */ DEBUG00(CE_CONT, "shrkcm_params(%x, %x)\n", dv, rmkey); /* get the I/O address */ cm_args.cm_key = rmkey; cm_args.cm_n = 0; cm_args.cm_param = CM_IOADDR; cm_args.cm_val = ⦥ cm_args.cm_vallen = sizeof(cm_range_t); cm_begin_trans(cm_args.cm_key, RM_READ); ret = cm_getval(&cm_args); cm_end_trans(cm_args.cm_key); if (ret) { cmn_err(CE_WARN, "shrkcm_params: cm_getval(IOADDR) " "failed at key %d, error=%d", rmkey, ret); return(B_FALSE); } dv->ioaddr = range.startaddr; dv->addrlen = range.endaddr - range.startaddr; /* get the PCI BUS number (needed to find Shark Static ROMs) */ cm_args.cm_key = rmkey; cm_args.cm_n = 0; cm_args.cm_param = CM_BUSNUM; cm_args.cm_val = &cm_num; cm_args.cm_vallen = sizeof(cm_num_t); cm_begin_trans(cm_args.cm_key, RM_READ); ret = cm_getval(&cm_args); cm_end_trans(cm_args.cm_key); if (ret) { cmn_err(CE_WARN, "shrkcm_params: cm_getval(BUSNUM) " "failed at key %d, error=%d", rmkey, ret); return(B_FALSE); } dv->pci_bus = cm_num; /* get the PCI device number (needed to find Shark Static ROMs) */ cm_args.cm_key = rmkey; cm_args.cm_n = 0; cm_args.cm_param = CM_DEVNUM; cm_args.cm_val = &cm_num; cm_args.cm_vallen = sizeof(cm_num_t); cm_begin_trans(cm_args.cm_key, RM_READ); ret = cm_getval(&cm_args); cm_end_trans(cm_args.cm_key); if (ret) { cmn_err(CE_WARN, "shrkcm_params: cm_getval(DEVNUM) " "failed at key %d, error=%d", rmkey, ret); return(B_FALSE); } dv->pci_dev = cm_num; /* get interrupt for mdi_printcfg() */ cm_args.cm_key = rmkey; cm_args.cm_n = 0; cm_args.cm_param = CM_IRQ; cm_args.cm_val = &cm_num; cm_args.cm_vallen = sizeof(cm_num_t); cm_begin_trans(cm_args.cm_key, RM_READ); ret = cm_getval(&cm_args); cm_end_trans(cm_args.cm_key); if (ret) { cmn_err(CE_WARN, "shrkcm_params: cm_getval(IRQ) " "failed at key %d, error=%d", rmkey, ret); dv->irq = (ushort)-1; } else { dv->irq = (ushort)cm_num; } /* osi2300 bcfg used to list HDX as '0', FDX as '1' */ bzero((caddr_t)str, sizeof(str)); cm_args.cm_key = rmkey; cm_args.cm_n = 0; cm_args.cm_param = "DUPLEX"; cm_args.cm_val = str; cm_args.cm_vallen = sizeof(str); cm_begin_trans(cm_args.cm_key, RM_READ); ret = cm_getval(&cm_args); cm_end_trans(cm_args.cm_key); if (ret) { DEBUG00(CE_NOTE, "shrkcm_params: cm_getval(DUPLEX) " "failed, key %d, error=%d", rmkey, ret); } else if (str[0] == '1') { dv->media |= SHRK_MEDIA_FDX; dv->mii_par |= SHRK_PAR_FDX; } return(B_TRUE); } /* * Function: shrkconfig * * Purpose: */ int shrkconfig(cfg_func_t func, void *idata, rm_key_t rmkey) { int ret; pl_t s; DEBUG00(CE_CONT, "shrkconfig(%x %x %x)\n", func, idata, rmkey); switch(func) { case CFG_ADD: { void **idatap = idata; shrkdev_t *dv; boolean_t got_mac_addr; if (shrkverify_brdid(rmkey) == B_FALSE) { return(ENXIO); } /* allocate space needed for per-device structure */ if ((dv = (shrkdev_t *)kmem_zalloc((sizeof(shrkdev_t)), KM_NOSLEEP)) == NULL) { cmn_err(CE_WARN, "shrkconfig: no memory for shrkdev_t"); return(ENOMEM); } DEBUG00(CE_CONT, "shrk: dv %x\n", dv); /* allocate locks */ if (!(dv->lkdv = LOCK_ALLOC(SHRK_HIER, plstr, &shrk_lkdv, KM_SLEEP))) { cmn_err(CE_WARN, "shrkconfig: LOCK_ALLOC-dv fail"); shrkfreemem(dv); return(ENOMEM); } if (!(dv->lktx = LOCK_ALLOC(SHRK_HIER+1, plstr, &shrk_lktx, KM_SLEEP))) { cmn_err(CE_WARN, "shrkconfig: LOCK_ALLOC-tx fail"); shrkfreemem(dv); return(ENOMEM); } if (!(dv->lktxcomplete = LOCK_ALLOC(SHRK_HIER+2, plstr, &shrk_lktxcomplete, KM_SLEEP))) { cmn_err(CE_WARN, "shrkconfig: LOCK_ALOC-txcomplete"); shrkfreemem(dv); return(ENOMEM); } if (!(dv->lkintr = LOCK_ALLOC(SHRK_HIER+1, plstr, &shrk_lkintr, KM_SLEEP))) { cmn_err(CE_WARN, "shrkconfig: LOCK_ALLOC-intr fail"); shrkfreemem(dv); return(ENOMEM); } dv->media = SHRK_MEDIA_AUTO; /* cm_params may overwrite this */ /* must obtain IOADDR before calling shrk_adapter_detect() */ if (shrkcm_params(dv, rmkey) == B_FALSE) { cmn_err(CE_CONT, "!shrkconfig: shrkcm_params failed"); shrkfreemem(dv); return(ENXIO); } got_mac_addr = shrk_adapter_detect(dv); /* * Most drivers should call mdi_get_unit at the top of CFG_ADD. * However, this adapter is somewhat unique because there is * only one srom used for all four devices on an adapter. As * a result, we _must_ obtain the MAC addresses by looking at * the srom contents, which is hanging off of the NIC at PCI * device number eight (ethernet controller unit zero). */ if (mdi_get_unit(rmkey, NULL) == B_FALSE) { mdi_printcfg("shrk", dv->ioaddr, dv->addrlen, dv->irq, -1, "port=%b ADAPTER NOT CONFIGURED", dv->port); shrkfreemem(dv); return(ENXIO); } /* idata is passed as an arg to other entry point routines */ *idatap = (void *)dv; /* * Fill in cookie with a non-NULL value because we want to call * cm_intr_detach later on. If you pass in NULL for cookie to * cm_intr_attach that means that interrupts will never be * detached. cm_intr_attach reads IRQ, ITYPE, IPL, and BINDCPU * from the resmgr for us. */ if (cm_intr_attach(rmkey, shrkintr, (void *)dv, &shrk_drvinfo, &dv->intr_cookie) == 0) { cmn_err(CE_WARN, "shrkconfig(ADD): cm_intr_attach " "failed at key %d", rmkey); shrkfreemem(dv); return(ENXIO); } DEBUG12(CE_CONT, "shrkconfig(ADD): L dv\n"); s = LOCK(dv->lkdv, plstr); /* initialize hardware */ if (shrkhwinit(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkconfig(ADD): shrkhwinit FAILED"); shrkfreemem(dv); DEBUG12(CE_CONT, "shrkconfig(ADD): U dv\n"); UNLOCK(dv->lkdv, s); shrkfreemem(dv); return(ENXIO); } /* determine our mac address if ecu 0 had been CFG_ADDed */ if (got_mac_addr == B_TRUE) { /* * When ecu 0 is CFG_ADDed, the global mac address * array for these four nics gets initialized. * * Unfortunately, this adapter doesn't fit perfectly * into the ddi 8 device independence model. The card * has one srom that hangs off of ecu 0 (found at pci * device 8) that contains the base mac address used * by ecu 0. Ecu 1 uses the base mac address plus 1, * ecu 2 uses the base mac address plus 2, and ecu 3 * uses the base mac address plus 3. To determine each * mac address, we have to know the base mac address, * but it's only available from the srom which is at * offset 0x48 from the base I/O address of ecu 0. * Since each CFG_ADD only knows about it's own resmgr * key, we use a global array to contain the base mac * address. */ shrkmacaddr(dv); /* prints adapter present message */ } DEBUG12(CE_CONT, "shrkconfig(ADD): U dv\n"); UNLOCK(dv->lkdv, s); } /* end of CFG_ADD code */ break; case CFG_SUSPEND: { /* normally called by mod_notifyd/mod_notify_daemon * but can be called by our own driver for testing purposes */ shrkdev_t *dv = idata; if (dv == NULL) { /* shouldn't happen */ cmn_err(CE_WARN, "shrkconfig(SUSPEND) idata NULL"); return(ENXIO); } DEBUG12(CE_CONT, "shrkconfig(SUSPEND): L dv\n"); s = LOCK(dv->lkdv, plstr); /* return OK if we're already suspended */ if (dv->flags & SHRK_SUSPENDED) { DEBUG12(CE_CONT, "shrkconfig(SUSPEND): U dv\n"); UNLOCK(dv->lkdv, s); break; } /* we need to both pacify the kernel and hardware: * - disable interrupts on board * - call cm_intr_detach */ shrkhwstop(dv); cm_intr_detach(dv->intr_cookie); DEBUG12(CE_CONT, "shrkconfig(SUSPEND): U dv\n"); UNLOCK(dv->lkdv, s); /* tell whatever's above us (dlpi module, stream head) that * the hardware is suspended */ if (dv->up_queue) { if ((ret=mdi_hw_suspended(dv->up_queue, rmkey)) != 0) { DEBUG12(CE_CONT, "shrkconfig(SUSPEND): U dv\n"); return(ret); } } dv->flags |= SHRK_SUSPENDED; } /* end of CFG_SUSPEND code */ break; case CFG_RESUME: { shrkdev_t *dv = idata; if (shrkcm_params(dv, rmkey) == B_FALSE) { cmn_err(CE_WARN, "shrkconfig(RESUME): shrkcm_params"); return(ENXIO); } DEBUG12(CE_CONT, "shrkconfig(RESUME): L dv\n"); s = LOCK(dv->lkdv, plstr); if (!(dv->flags & SHRK_SUSPENDED)) { cmn_err(CE_WARN, "shrkconfig(RESUME): not SUSPENDED"); DEBUG12(CE_CONT, "shrkconfig(RESUME): U dv\n"); UNLOCK(dv->lkdv, s); break; } /* re-initialize the hardware */ if (shrkhwstart(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkconfig(RESUME): hwstart"); DEBUG12(CE_CONT, "shrkconfig(RESUME): U dv\n"); UNLOCK(dv->lkdv, s); return(ENXIO); } if (shrksetup_frame(dv, SHRK_SET_ADDR, NULL) == B_FALSE) { cmn_err(CE_WARN, "shrkconfig(RESUME): shrksetup_frame"); DEBUG12(CE_CONT, "shrkconfig(RESUME): U dv\n"); UNLOCK(dv->lkdv, s); return(ENXIO); } DEBUG12(CE_CONT, "shrkconfig(RESUME): U dv\n"); UNLOCK(dv->lkdv, s); /* call mdi_hw_resumed if we're bound */ if (dv->up_queue) { if ((ret = mdi_hw_resumed(dv->up_queue, rmkey)) != 0) { DEBUG12(CE_CONT, "shrkconfig(RESUME): U dv\n"); return(ENXIO); } } /* restore multicast list */ if (cm_intr_attach(rmkey, shrkintr, (void *)dv, &shrk_drvinfo, &dv->intr_cookie) == 0) { cmn_err(CE_WARN, "shrkconfig(RESUME): cm_intr_attach " "failed at key %d", rmkey); /* don't kmem_free dv yet */ DEBUG12(CE_CONT, "shrkconfig(RESUME): U dv\n"); return(ENXIO); } dv->flags &= ~SHRK_SUSPENDED; } /* end of CFG_RESUME code */ break; case CFG_REMOVE: { /* * Notes: * - we can't manipulate remsgr key rmkey at all here * - device may or may not be currently suspended */ shrkdev_t *dv=idata; if (dv == NULL) { /* previously freed */ break; } DEBUG12(CE_CONT, "shrkconfig(REMOVE): L dv\n"); s = LOCK(dv->lkdv, plstr); if (dv->tid) { untimeout(dv->tid); } if (!(dv->flags & SHRK_SUSPENDED)) { cm_intr_detach(dv->intr_cookie); } if (dv->flags & SHRK_OPEN) { dv->flags |= SHRK_REMOVED; DEBUG12(CE_CONT, "shrkconfig(REMOVE): U dv\n"); UNLOCK(dv->lkdv, s); } else { DEBUG12(CE_CONT, "shrkconfig(REMOVE): U dv\n"); UNLOCK(dv->lkdv, s); /* before shrkfreemem */ shrkfreemem(dv); } } /* end of CFG_REMOVE code */ break; case CFG_MODIFY: break; case CFG_VERIFY: { shrkdev_t *tmpdv; if (shrkverify_brdid(rmkey) == B_FALSE) { return(ENODEV); } /* allocate space for temporary per-device structure */ if ((tmpdv = (shrkdev_t *)kmem_zalloc((sizeof(shrkdev_t)), KM_NOSLEEP)) == NULL) { cmn_err(CE_WARN, "shrkconfig: no memory for shrkdev_t"); return(EOPNOTSUPP); } /* must obtain IOADDR before calling shrk_adapter_detect() */ if (shrkcm_params(tmpdv, rmkey) == B_FALSE) { cmn_err(CE_CONT, "!shrkconfig: shrkcm_params failed"); shrkfreemem(tmpdv); return(EOPNOTSUPP); } if (shrk_adapter_detect(tmpdv) == B_FALSE) { shrkfreemem(tmpdv); return(ENODEV); } return(0); } /* end of CFG_VERIFY code */ break; default: { return(EOPNOTSUPP); } } return(0); } #endif /* OPENSERVER */ /* * Function: shrkaddrstr * * Purpose: * Generate a printable version of the hw mac address * ie. turn 02 60 8c f0 12 3a into "02:60:8c:f0:12:3a" */ #define EASTRINGSIZE 18 /* size of string with ether address */ char * shrkaddrstr(macaddr_t ea) { static char buf[EASTRINGSIZE]; int i; char *s = "0123456789abcdef"; for (i = 0; i < sizeof(macaddr_t); ++i) { buf[i*3] = s[(ea[i] >> 4) & 0xf]; buf[i*3 + 1] = s[ea[i] & 0xf]; buf[i*3 + 2] = ':'; } buf[EASTRINGSIZE - 1] = '\0'; return(buf); } /* * Function: shrkdata * * Purpose: * Handle a data message. * * DDI8 SUSPEND note: silently drop data if driver is suspended */ STATIC void shrkdata(queue_t *q, mblk_t *mp) { shrkdev_t *dv; pl_t s; macaddr_t *ea; dv = (shrkdev_t *)q->q_ptr; ASSERT(dv != NULL); DEBUG06(CE_CONT, "shrkdata(q %x mp %x)\n", q, mp); if (!dv->up_queue) { mdi_macerrorack(RD(q), M_DATA, MAC_OUTSTATE); freemsg(mp); return; } /* silently drop data if driver is suspended or removed */ if ((dv->flags & SHRK_SUSPENDED) || (dv->flags & SHRK_REMOVED)) { dv->dropsuspended++; freemsg(mp); return; } /* the nic doesn't loop back frames for us in 100Mbps mode */ if (!(dv->mii_par & SHRK_PAR_10)) { ea = (macaddr_t *)mp->b_rptr; if ((SHRK_MCA(*ea) && #ifdef OPENSERVER mdi_in_mctbl(&dv->mctbl, *ea)) #else dv->dlpi_cookie && mdi_valid_mca(dv->dlpi_cookie, *ea) != -1) #endif /* OPENSERVER */ || (dv->flags & SHRK_PROMISCUOUS) || SHRK_BCAST(*ea) || mdi_addrs_equal(dv->eaddr, *ea)) { mdi_do_loopback(q, mp, SHRK_MINPACK); } } DEBUG12(CE_CONT, "shrkdata: L tx\n"); #ifdef OPENSERVER s = LOCK(dv->lktx); #else s = LOCK(dv->lktx, plstr); #endif /* OPENSERVER */ if (q->q_first || !TXD_AVAIL(dv)) { DEBUG06(CE_CONT, "shrkdata: flags %x txci %x txpi %x\n", dv->flags, dv->txci, dv->txpi); if (!putq(WR(q), mp)) { cmn_err(CE_WARN, "shrkdata: putq failed"); freemsg(mp); } /* * If we can't get the txcomplete lock, another thread * (intr) is already processing transmit completes. */ DEBUG12(CE_CONT, "shrkdata: T txcomplete\n"); #ifdef OPENSERVER s = LOCK(dv->lktxcomplete); { #else if ((s = TRYLOCK(dv->lktxcomplete, plstr)) != invpl) { #endif /* OPENSERVER */ shrktx_complete(dv); /* free up transmit descriptors */ DEBUG12(CE_CONT, "shrkdata: U txcomplete\n"); UNLOCK(dv->lktxcomplete, s); } shrktx_queued(dv); /* transmit queued frames */ } else { if (shrktx(dv, mp) == B_FALSE) { /* probably out of memory - shrktx queues packet */ DEBUG06(CE_CONT, "shrkdata: shrktx failed\n"); } } DEBUG12(CE_CONT, "shrkdata: U tx\n"); UNLOCK(dv->lktx, s); } /* * Function: shrkioctl * * Purpose: * Process an ioctl streams message. * DDI8 SUSPEND note: if ioctl cmd doesn't talk to the hardware we allow it * but if it does and if we're suspended then we fail * ioctl with EAGAIN. */ STATIC void shrkioctl(queue_t *q, mblk_t *mp) { unsigned char *data; shrkdev_t *dv; struct iocblk *iocp = (struct iocblk *) mp->b_rptr; int size; dv = (shrkdev_t *)q->q_ptr; ASSERT(dv != NULL); data = (mp->b_cont) ? mp->b_cont->b_rptr : NULL; iocp->ioc_error = 0; iocp->ioc_rval = 0; DEBUG04(CE_CONT, "shrkioctl(%x, %x) dv %x data %x iocp %x cmd %x\n", q, mp, dv, data, iocp, iocp->ioc_cmd); switch (iocp->ioc_cmd) { #ifdef OPENSERVER case MACIOC_GETMCSIZ: /* get multicast table size */ iocp->ioc_rval = dv->mctbl.cnt * sizeof(macaddr_t); iocp->ioc_count = 0; break; case MACIOC_GETMCA: /* get multicast table */ size = sizeof(macaddr_t) * dv->mctbl.cnt; if (data == NULL || iocp->ioc_count < size) { iocp->ioc_error = EINVAL; } else { bcopy(&dv->mctbl.tbl, data, size); mp->b_cont->b_wptr = mp->b_cont->b_rptr + size; iocp->ioc_count = size; } break; #endif /* OPENSERVER */ case MACIOC_GETSTAT: /* dump mac or dod statistics */ if (data == NULL || iocp->ioc_count < sizeof(mac_stats_eth_t)) { iocp->ioc_error = EINVAL; } else { bcopy(&dv->macstats, data, sizeof(mac_stats_eth_t)); mp->b_cont->b_wptr = mp->b_cont->b_rptr + sizeof(mac_stats_eth_t); iocp->ioc_count = sizeof(mac_stats_eth_t); } break; case MACIOC_CLRSTAT: /* clear mac statistics */ #ifdef OPENSERVER if (iocp->ioc_uid != 0) { #else if (drv_priv(iocp->ioc_cr) == EPERM) { #endif /* OPENSERVER */ iocp->ioc_error = EPERM; } else { bzero(&dv->macstats, sizeof(mac_stats_eth_t)); iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } } break; case MACIOC_GETRADDR: /* get factory mac address */ if (data == NULL || iocp->ioc_count < sizeof(macaddr_t)) { iocp->ioc_error = EINVAL; } else { bcopy(dv->hwaddr, data, sizeof(macaddr_t)); mp->b_cont->b_wptr = mp->b_cont->b_rptr + sizeof(macaddr_t); iocp->ioc_count = sizeof(macaddr_t); } break; case MACIOC_GETADDR: /* get mac address */ if (data == NULL || iocp->ioc_count < sizeof(macaddr_t)) { iocp->ioc_error = EINVAL; } else { bcopy(dv->eaddr, data, sizeof(macaddr_t)); mp->b_cont->b_wptr = mp->b_cont->b_rptr + sizeof(macaddr_t); iocp->ioc_count = sizeof(macaddr_t); } break; case MACIOC_SETADDR: /* set mac address */ if (dv->flags & SHRK_SUSPENDED) iocp->ioc_error = EAGAIN; else if (data == NULL) iocp->ioc_error = EINVAL; else if (iocp->ioc_count != sizeof(macaddr_t)) iocp->ioc_error = EINVAL; #ifdef OPENSERVER else if (iocp->ioc_uid != 0) #else else if (drv_priv(iocp->ioc_cr) == EPERM) #endif /* OPENSERVER */ iocp->ioc_error = EPERM; else { macaddr_t prevaddr; bcopy(dv->eaddr, prevaddr, sizeof(macaddr_t)); bcopy(data, dv->eaddr, sizeof(macaddr_t)); /* * There is a small window where the mac address * doesn't match transmit packets if driver is busy * transmitting, but that's OK. */ if (shrksetup_frame(dv, SHRK_SET_ADDR, NULL)==B_FALSE) { /* restore previous mac address to dev struct */ bcopy(prevaddr, dv->eaddr, sizeof(macaddr_t)); iocp->ioc_error = EPERM; } } break; case MACIOC_SETMCA: /* multicast setup */ DEBUG04(CE_CONT, "shrkioctl SETMCA %s\n", shrkaddrstr(data)); if (data == NULL) iocp->ioc_error = EINVAL; else if (dv->flags & SHRK_SUSPENDED) iocp->ioc_error = EAGAIN; else if (iocp->ioc_count != sizeof(macaddr_t)) iocp->ioc_error = EINVAL; #ifdef OPENSERVER else if (dv->mctbl.cnt == MDI_NMCADDR) iocp->ioc_error = ENOSPC; else if (iocp->ioc_uid != 0) #else else if (drv_priv(iocp->ioc_cr) == EPERM) #endif /* OPENSERVER */ iocp->ioc_error = EPERM; else if (!SHRK_MCA( *((macaddr_t *) data))) iocp->ioc_error = EINVAL; else if (shrksetup_frame(dv, SHRK_SET_ENABMC, mp) == B_FALSE) iocp->ioc_error = ENOMEM; /* most likely */ #ifdef OPENSERVER else mdi_add_mctbl_entry((mctbl_t *)&dv->mctbl, data); #endif /* OPENSERVER */ break; case MACIOC_DELMCA: /* multicast delete */ DEBUG04(CE_CONT, "shrkioctl DELMCA %s\n", shrkaddrstr(data)); if (data == NULL) iocp->ioc_error = EINVAL; else if (dv->flags & SHRK_SUSPENDED) iocp->ioc_error = EAGAIN; else if (iocp->ioc_count != sizeof(macaddr_t)) iocp->ioc_error = EINVAL; #ifdef OPENSERVER else if (mdi_in_mctbl(&dv->mctbl, data) == -1) iocp->ioc_error = EINVAL; else if (iocp->ioc_uid != 0) #else else if (drv_priv(iocp->ioc_cr) == EPERM) #endif /* OPENSERVER */ iocp->ioc_error = EPERM; else if (shrksetup_frame(dv, SHRK_SET_DISABMC, mp) == B_FALSE) iocp->ioc_error = ENOMEM; /* most likely */ #ifdef OPENSERVER else mdi_del_mctbl_entry((mctbl_t *)&dv->mctbl, data); #endif /* OPENSERVER */ break; #ifndef OPENSERVER case MACIOC_SETALLMCA: /* enable all multicast addresses */ if (drv_priv(iocp->ioc_cr) == EPERM) iocp->ioc_error = EPERM; else if (!(dv->flags & SHRK_MCA_ALL)) { dv->flags |= SHRK_MCA_ALL; shrkset_all(dv); } break; case MACIOC_DELALLMCA: /* disable all multicast addresses */ if (drv_priv(iocp->ioc_cr) == EPERM) iocp->ioc_error = EPERM; else if (!(dv->flags & SHRK_MCA_ALL)) iocp->ioc_error = EINVAL; else { dv->flags &= ~SHRK_MCA_ALL; shrkset_all(dv); } break; #endif /* ndef OPENSERVER */ case MACIOC_PROMISC: /* enable promiscuous mode */ #ifdef OPENSERVER if (iocp->ioc_uid != 0) #else if (drv_priv(iocp->ioc_cr) == EPERM) #endif /* OPENSERVER */ iocp->ioc_error = EPERM; else if (!(dv->flags & SHRK_PROMISCUOUS)) { dv->flags |= SHRK_PROMISCUOUS; shrkset_all(dv); } break; default: DEBUG04(CE_CONT, "shrkioctl unknown ioctl\n"); iocp->ioc_error = EINVAL; break; } if (iocp->ioc_error) { mp->b_datap->db_type = M_IOCNAK; iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = NULL; } } else { mp->b_datap->db_type = M_IOCACK; } DEBUG04(CE_CONT, "shrkioctl: cmd %x return %s\n", iocp->ioc_cmd, (mp->b_datap->db_type == M_IOCACK) ? "ACK" : "NAK"); qreply(q, mp); return; } /* * Function: shrkmacproto * * Purpose: * Handle MAC protocol messages. */ STATIC void shrkmacproto(queue_t *q, mblk_t *mp) { shrkdev_t *dv; mac_stats_eth_t *shrkmacstats; mac_info_ack_t *info_ack; union MAC_primitives *prim; mblk_t *reply_mp; dv = (shrkdev_t *)q->q_ptr; ASSERT(dv != NULL); prim = (union MAC_primitives *) mp->b_rptr; shrkmacstats = &dv->macstats; DEBUG05(CE_CONT,"shrkmacproto: prim=%lx\n", prim->mac_primitive); switch(prim->mac_primitive) { case MAC_INFO_REQ: /* it's legal to issue this if hardware is suspended from both * ddi8 and DLPI point of view. */ if ((reply_mp=allocb(sizeof(mac_info_ack_t), BPRI_HI)) == NULL) cmn_err(CE_WARN, "shrk:shrkmacproto - out of STREAMs"); else { info_ack = (mac_info_ack_t *) reply_mp->b_rptr; reply_mp->b_wptr += sizeof(mac_info_ack_t); reply_mp->b_datap->db_type = M_PCPROTO; info_ack->mac_primitive = MAC_INFO_ACK; info_ack->mac_max_sdu = SHRK_TXMAXSZ; info_ack->mac_min_sdu = SHRK_HEADERSZ; info_ack->mac_mac_type = MAC_CSMACD; info_ack->mac_driver_version = MDI_VERSION; info_ack->mac_if_speed = (dv->mii_par & SHRK_PAR_10) ? /* 10 Mbps */ 10000000 : /* 100 Mbps */ 100000000; qreply(q, reply_mp); } break; case MAC_BIND_REQ: /* DLPI says that hardware must be ready after BIND succeeds * we fail the bind if hardware is currently suspended * we emulate this for MDI. */ #ifndef OPENSERVER if (dv->flags & SHRK_SUSPENDED) mdi_macerrorack(RD(q), prim->mac_primitive, MAC_HWNOTAVAIL); #endif /* ndef OPENSERVER */ if (dv->up_queue) mdi_macerrorack(RD(q), prim->mac_primitive, MAC_OUTSTATE); else { DEBUG05(CE_CONT,"bind: csr0 %x\n", inl(CSR0(dv))); DEBUG05(CE_CONT,"bind: csr1 %x\n", inl(CSR1(dv))); DEBUG05(CE_CONT,"bind: csr2 %x\n", inl(CSR2(dv))); DEBUG05(CE_CONT,"bind: csr3 %x\n", inl(CSR3(dv))); DEBUG05(CE_CONT,"bind: csr4 %x\n", inl(CSR4(dv))); DEBUG05(CE_CONT,"bind: csr5 %x\n", inl(CSR5(dv))); DEBUG05(CE_CONT,"bind: csr6 %x\n", inl(CSR6(dv))); DEBUG05(CE_CONT,"bind: csr7 %x\n", inl(CSR7(dv))); DEBUG05(CE_CONT,"bind: csr9 %x\n", inl(CSR9(dv))); DEBUG05(CE_CONT,"bind: csr12 %x\n", inl(CSR12(dv))); if (shrkhwstart(dv) == B_FALSE) { cmn_err(CE_WARN,"shrkmacproto: hwstart failed"); mdi_macerrorack(RD(q), prim->mac_primitive, #ifdef OPENSERVER MAC_INITFAILED); #else MAC_HWNOTAVAIL); #endif /* OPENSERVER */ } else { dv->up_queue = RD(q); #ifndef OPENSERVER dv->dlpi_cookie = prim->bind_req.mac_cookie; #endif /* ndef OPENSERVER */ mdi_macokack(RD(q), prim->mac_primitive); } DEBUG05(CE_CONT,"bind_hw: csr0 %x\n", inl(CSR0(dv))); DEBUG05(CE_CONT,"bind_hw: csr1 %x\n", inl(CSR1(dv))); DEBUG05(CE_CONT,"bind_hw: csr2 %x\n", inl(CSR2(dv))); DEBUG05(CE_CONT,"bind_hw: csr3 %x\n", inl(CSR3(dv))); DEBUG05(CE_CONT,"bind_hw: csr4 %x\n", inl(CSR4(dv))); DEBUG05(CE_CONT,"bind_hw: csr5 %x\n", inl(CSR5(dv))); DEBUG05(CE_CONT,"bind_hw: csr6 %x\n", inl(CSR6(dv))); DEBUG05(CE_CONT,"bind_hw: csr7 %x\n", inl(CSR7(dv))); DEBUG05(CE_CONT,"bind_hw: csr9 %x\n", inl(CSR9(dv))); DEBUG05(CE_CONT,"bind_hw: csr12 %x\n", inl(CSR12(dv))); } break; default: mdi_macerrorack(RD(q), prim->mac_primitive, MAC_BADPRIM); break; } freemsg(mp); return; } /* * Function: shrkopen * * Purpose: * Driver open routine. * Generally called by ddi_bind_open which uses the routine shrkopen * from the shrk_drvops structure and not from the qinit structures. */ int #ifdef OPENSERVER shrkopen(queue_t *q, int dev, int oflags, int sflag) #else shrkopen(void *idata, channel_t *channelp, int oflags, cred_t *crp, queue_t *q) #endif /* OPENSERVER */ { shrkdev_t *dv; pl_t s; #ifdef OPENSERVER DEBUG01(CE_CONT,"shrkopen q %x dev %x oflags %x\n", q, dev, oflags); if (sflag == CLONEOPEN) { u.u_error = EINVAL; return(OPENFAIL); } dev = minor(dev); if (dev >= shrk_nunit) { u.u_error = EINVAL; return(OPENFAIL); } dv = &shrk_dv[dev]; dv->iarg = get_intr_arg(dv->pci_bus, IDIST_PCI_IRQ(dv->pci_dev, 0)); #else if (idata == NULL) { /* shrkconfig with CFG_ADD failed previously */ return(ENXIO); } dv = (shrkdev_t *)idata; DEBUG01(CE_CONT,"shrkopen idata %x flags %lx\n", idata, dv->flags); #endif /* OPENSERVER */ /* allocate and initialize receive descriptors on first open */ if (! dv->rxcurr) { if (shrkrxinit(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkopen: shrkrxinit FAILED"); shrkfreemem(dv); #ifdef OPENSERVER u.u_error = ENOMEM; return(OPENFAIL); #else return(ENOMEM); #endif /* OPENSERVER */ } } /* allocate and initialize transmit descriptors on first open */ if (! dv->txd) { if (shrkalloc_txdesc(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkopen: shrkalloc_txdesc FAILED"); shrkfreemem(dv); #ifdef OPENSERVER u.u_error = ENOMEM; return(OPENFAIL); #else return(ENOMEM); #endif /* OPENSERVER */ } } /* initialize hardware */ if (shrkhwinit(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkopen: shrkhwinit FAILED"); shrkfreemem(dv); #ifdef OPENSERVER u.u_error = ENXIO; return(OPENFAIL); #else return(ENXIO); #endif /* OPENSERVER */ } DEBUG12(CE_CONT, "shrkopen: L dv\n"); #ifdef OPENSERVER s = LOCK(dv->lkdv); #else s = LOCK(dv->lkdv, plstr); #endif /* OPENSERVER */ if (!(dv->flags & SHRK_PRESENT)) { DEBUG01(CE_CONT,"shrkopen: mac address not initialized\n"); if (!dv->tid) { shrkmacaddr(dv); /* schedules timeout to keep trying */ } if (!shrk_srom_mac[dv->pci_bus].valid) { DEBUG12(CE_CONT, "shrkopen: U dv - open\n"); UNLOCK(dv->lkdv, s); #ifdef OPENSERVER u.u_error = EINVAL; return(OPENFAIL); #else return(ENXIO); #endif /* OPENSERVER */ } } if (dv->flags & SHRK_OPEN) { DEBUG01(CE_CONT,"shrkopen: board already open\n"); DEBUG12(CE_CONT, "shrkopen: U dv - open\n"); UNLOCK(dv->lkdv, s); #ifdef OPENSERVER u.u_error = EBUSY; return(OPENFAIL); #else return(EBUSY); #endif /* OPENSERVER */ } #ifndef OPENSERVER if (dv->flags & SHRK_SUSPENDED) { /* * hardware currently suspended, can't call hwstart, fail open. * XXX should block here unless O_NONBLOCK/O_NDELAY set. * * Note that opens on /dev/netX are not impacted by this * return(EAGAIN), but by the earlier call to mdi_hw_suspended * * EAGAIN impacts raw MDI consumers: dlpid, tcpdump, test suites */ DEBUG01(CE_CONT,"shrkopen: board suspended\n"); DEBUG12(CE_CONT, "shrkopen: U dv - suspended\n"); UNLOCK(dv->lkdv, s); return(EAGAIN); } #endif /* ndef OPENSERVER */ q->q_ptr = WR(q)->q_ptr = (caddr_t)dv; dv->flags |= SHRK_OPEN; dv->up_queue = 0; dv->tx_queue = WR(q); if (shrkhwstart(dv) == B_FALSE) { cmn_err(CE_WARN, "shrkopen: hwstart failed"); DEBUG12(CE_CONT, "shrkopen: U dv\n"); UNLOCK(dv->lkdv, s); /* release lock before return() */ #ifdef OPENSERVER u.u_error = ENXIO; return(OPENFAIL); #else return(ENXIO); #endif /* OPENSERVER */ } DEBUG12(CE_CONT, "shrkopen: U dv\n"); UNLOCK(dv->lkdv, s); /* must release lock before qprocson() */ #ifndef OPENSERVER qprocson(q); #else sdistributed(q, SDIST_WPUTP); #endif /* ndef OPENSERVER */ qenable(q); return(0); } /* * Function: shrkclose * * Purpose: * Driver close routine. * * Note: * One close call is issued for each open call for all DDI8 drivers. */ int #ifdef OPENSERVER shrkclose(queue_t *q) #else shrkclose(void *idata, channel_t channel, int oflags, cred_t *crp, queue_t *q) #endif /* OPENSERVER */ { shrkdev_t *dv; pl_t s, t, u; dv = (shrkdev_t *)q->q_ptr; ASSERT(dv != NULL); ASSERT(dv == idata); DEBUG01(CE_CONT,"shrkclose(%x, ...) dv %x\n", q, dv); #ifndef OPENSERVER qprocsoff(q); #endif /* ndef OPENSERVER */ flushq(WR(q), 1); q->q_ptr = NULL; #ifndef OPENSERVER if (dv->flags & SHRK_REMOVED) { /* can't touch the hardware because it may not be there */ shrkfreemem(dv); return (0); } #endif /* ndef OPENSERVER */ DEBUG12(CE_CONT, "shrkclose: L dv\n"); #ifdef OPENSERVER s = LOCK(dv->lkdv); /* clear multicast table */ dv->mctbl.cnt = 0; bzero(dv->mctbl.tbl, sizeof(dv->mctbl.tbl)); #else s = LOCK(dv->lkdv, plstr); #endif /* OPENSERVER */ dv->up_queue = 0; DEBUG12(CE_CONT, "shrkclose: L tx\n"); #ifdef OPENSERVER t = LOCK(dv->lktx); DEBUG12(CE_CONT, "shrkclose: L txcomplete\n"); u = LOCK(dv->lktxcomplete); #else t = LOCK(dv->lktx, plstr); DEBUG12(CE_CONT, "shrkclose: L txcomplete\n"); u = LOCK(dv->lktxcomplete, plstr); #endif /* OPENSERVER */ shrktx_complete(dv); DEBUG12(CE_CONT, "shrktx_queued: U txcomplete\n"); UNLOCK(dv->lktxcomplete, u); DEBUG12(CE_CONT, "shrktx_queued: U tx\n"); UNLOCK(dv->lktx, t); #ifndef OPENSERVER if (!(dv->flags & SHRK_SUSPENDED)) { /* * We also check if the device is open at CFG_RESUME * time to see if we should call shrkhwstop again; * i.e., user process terminated while we were suspended */ dv->flags &= ~SHRK_MCA_ALL; dv->flags &= ~SHRK_PROMISCUOUS; shrkset_all(dv); /* turn off all address reception modes */ shrkhwstop(dv); } #endif /* ndef OPENSERVER */ dv->flags &= ~SHRK_OPEN; DEBUG12(CE_CONT, "shrkclose: U dv\n"); UNLOCK(dv->lkdv, s); /* before shrkfreemem */ return (0); } /* * Function: shrkuwput * * Purpose: * Write put routine. */ int shrkuwput(queue_t *q, mblk_t *mp) { DEBUG02(CE_CONT,"shrkuwput: type=x%x\n",mp->b_datap->db_type); switch (mp->b_datap->db_type) { case M_PROTO: case M_PCPROTO: shrkmacproto(q, mp); break; case M_DATA: shrkdata(q, mp); break; case M_IOCTL: shrkioctl(q, mp); break; case M_FLUSH: if (*mp->b_rptr & FLUSHW) { flushq(q, FLUSHALL); *mp->b_rptr &= ~FLUSHW; } if (*mp->b_rptr & FLUSHR) { flushq(RD(q), FLUSHALL); qreply(q, mp); } else { freemsg(mp); } break; default: DEBUG02(CE_CONT,"shrkuwput:unknown STR msg type=x%x mp=x%x\n", mp->b_datap->db_type, mp); freemsg(mp); break; } return 0; } /* * Note: * The srom format of the Matrox SHARK adpater is not the same as that * documented in the "Using the Digital Semiconductor 21140A with Boot ROM, * Serial ROM, and External Register: An Application Note" document from * DEC. shrksrom() is complicated due to variable length data structures * found in the srom. */ void shrksrom(shrkdev_t *dv) { register srom_t *s; register unchar i, j, k; devoff_t *dev; infoleaf_t *il; chipinfo_t *ci; chipinfo_ext_t *ce; non_mii_t *nmb; mii_t *mb; if (! &dv->srom) { DEBUG08(CE_CONT, "dv->srom not initialized\n"); return; } s = &dv->srom; DEBUG08(CE_CONT, "svid %x\n", s->svid); DEBUG08(CE_CONT, "sid %x\n", s->sid); DEBUG08(CE_CONT, "ID_reserved1 "); for (i = 0; i < sizeof(s->ID_reserved1); i++) DEBUG08(CE_CONT, "%b ", s->ID_reserved1[i]); DEBUG08(CE_CONT, "\n"); DEBUG08(CE_CONT, "id_block_crc %b\n", s->id_block_crc); DEBUG08(CE_CONT, "ID_reserved2 %b\n", s->ID_reserved2); DEBUG08(CE_CONT, "srom_format_version %b\n", s->srom_format_version); DEBUG08(CE_CONT, "chip_count %b\n", s->chip_count); DEBUG08(CE_CONT, "hwaddr %s\n", shrkaddrstr(s->hwaddr)); DEBUG08(CE_CONT, "chip_info "); for (i = 0; i < sizeof(s->chip_info); i++) DEBUG08(CE_CONT, "%b ", s->chip_info[i]); DEBUG08(CE_CONT, "\n"); for (i = 0; i < s->chip_count; i++) { dev = (devoff_t *)&s->chip_info[i*3]; DEBUG08(CE_CONT, "devoff %b: devno %b leaf_offset %x\n", i, dev->devno, dev->leaf_offset); il = (infoleaf_t *)((caddr_t)s + dev->leaf_offset); DEBUG08(CE_CONT, "infoleaf: conn %x gpcontrol %b bcount %b\n", il->conn, il->gpcontrol, il->bcount); dv->gpcontrol = il->gpcontrol; /* print out info blocks */ switch (*((caddr_t)il + sizeof(infoleaf_t)) & 0x80) { case 0: /* compact */ ci = (chipinfo_t *)((caddr_t)il + sizeof(infoleaf_t)); ASSERT(!ci->format); for (j = 0; j < il->bcount; j++, ci++) { DEBUG08(CE_CONT, "compact chipinfo: " "media_code %b port %b command %x\n", ci->media_code, ci->port, ci->command); } break; default: /* extended */ ce = (chipinfo_ext_t *)((caddr_t)il+sizeof(infoleaf_t)); ASSERT(ce->format); for (j = 0; j < il->bcount; j++, ce++) { DEBUG08(CE_CONT, "extended chipinfo: " "length %b block_type %b\n", ce->length, ce->block_type); switch (ce->block_type) { case SHRK_NON_MII: /* format same as compact chipinfo */ nmb = (non_mii_t *)((caddr_t)ce + sizeof(chipinfo_ext_t)); DEBUG08(CE_CONT, "non_mii: " "media_code %b port %b" "command %x\n", nmb->media_code, nmb->port, nmb->command); break; case SHRK_MII_PHY: { unchar rl; /* reset length */ ushort *d; /* misc data */ mb = (mii_t *)((caddr_t)ce + sizeof(chipinfo_ext_t)); DEBUG08(CE_CONT, "mii: " "phyno %b gprlen %b ", mb->phyno, mb->gprlen); if (mb->gprlen) { DEBUG08(CE_CONT, "gprseq: "); } for (k = 0; k < mb->gprlen; k++) { DEBUG08(CE_CONT, "%b ", *((caddr_t)mb + sizeof(mii_t) + k)); } DEBUG08(CE_CONT, "\n"); dv->gpresetlen = (unchar *)mb + sizeof(mii_t) + mb->gprlen; DEBUG08(CE_CONT, " resetlen: %b ", *dv->gpresetlen); if (*dv->gpresetlen) { DEBUG08(CE_CONT, "resetseq:"); dv->gpresetseq = (unchar *)mb + sizeof(mii_t) + mb->gprlen + 1; } for (k = 0; k < *dv->gpresetlen; k++) { DEBUG08(CE_CONT, " %b", *(dv->gpresetseq + k)); } DEBUG08(CE_CONT, "\n"); d = (ushort *)((caddr_t)mb + sizeof(mii_t) + mb->gprlen + sizeof(unchar) + rl); DEBUG08(CE_CONT, " media_cap: %x ", (*d & 0x0000ffff)); d++; DEBUG08(CE_CONT, "autoneg: " "%x ", (*d & 0x0000ffff)); d++; DEBUG08(CE_CONT, "fdx: %x ", (*d & 0x0000ffff)); d++; DEBUG08(CE_CONT, "txthreshold: %x\n", (*d & 0x0000ffff)); break; } default: DEBUG08(CE_CONT,"unknown block_type\n"); break; } } } } DEBUG08(CE_CONT, "reserved %x\n", s->reserved); DEBUG08(CE_CONT, "crc %x\n", s->crc); return; } /* DEBUG printf functions are below */ #ifdef SHRK_DEBUG void shrkdv(shrkdev_t *dv) { register int i; register unchar *srom; cmn_err(CE_CONT, "flags %lx\n", dv->flags); cmn_err(CE_CONT, "ioaddr %lx irq %x\n", dv->ioaddr, dv->irq); cmn_err(CE_CONT, "mii_par %x pci_bus %b pci_dev %b\n", dv->mii_par, dv->pci_bus, dv->pci_dev); cmn_err(CE_CONT, "intr_cookie %x dlpi_cookie %x up_queue %x\n", dv->intr_cookie, dv->dlpi_cookie, dv->up_queue); cmn_err(CE_CONT, "hwaddr %s eaddr %s\n", shrkaddrstr(dv->hwaddr), shrkaddrstr(dv->eaddr)); cmn_err(CE_CONT, "macstats(addr) %x\n", &dv->macstats); cmn_err(CE_CONT, "dropsuspended %lx\n", dv->dropsuspended); cmn_err(CE_CONT, "phy_addr %b\n", dv->phy_addr); cmn_err(CE_CONT, "gpcontrol %b gpresetlen(addr) %x\n", dv->gpcontrol, dv->gpresetlen); cmn_err(CE_CONT, "rxcurr %x rxpaddr %x\n", dv->rxcurr, dv->rxpaddr); cmn_err(CE_CONT, "txd %x txci %x txpi %x txpaddr %x\n", dv->txd, dv->txci, dv->txpi, dv->txpaddr); cmn_err(CE_CONT, "media %x\n", dv->media); return; } void shrkrxd(shrkdev_t *dv) { register int i; mblk_t *mp; register rxd_t *rxd; DEBUG07(CE_CONT, "shrk_num_rx_desc %x\n", shrk_num_rx_desc); for (i = 0, mp = dv->rxcurr; mp && (i < shrk_num_rx_desc); i++) { rxd = (rxd_t *)mp->b_rptr; DEBUG07(CE_CONT, "%b: mp %x next %x prev %x\n", i, mp, mp->b_next, mp->b_prev); DEBUG07(CE_CONT, " rdes0/status %x\n", rxd->status); DEBUG07(CE_CONT, " rdes1/cntrl %x\n", rxd->cntrl); DEBUG07(CE_CONT, " pa1 %x pa2 %x\n",rxd->paddr1,rxd->paddr2); DEBUG07(CE_CONT, " mp %x\n", rxd->mp); mp = mp->b_next; } } void shrktxset(volatile mblk_t *mp) { register int i; uint_t *data; if (mp == NULL) return; data = (uint_t *)mp->b_rptr; DEBUG10(CE_CONT, "SETUP DATA:\n"); for (i = 0; i < (SHRK_SET_SZ / 4); i++) { DEBUG10(CE_CONT, " %lx\n", *data++); } } void shrktxd(shrkdev_t *dv) { register int i, j; register txd_t *txd; DEBUG10(CE_CONT, "shrk_num_tx_desc %x txci %x txpi %x\n", shrk_num_tx_desc, dv->txci, dv->txpi); for (i = 0, txd = dv->txd; i < shrk_num_tx_desc; i++, txd++) { DEBUG10(CE_CONT, "%b tdes0/status %x\n", i, txd->status); DEBUG10(CE_CONT, " tdes1/cntrl %x\n", txd->cntrl); DEBUG10(CE_CONT, " pa1 %x pa2 %x\n",txd->paddr1,txd->paddr2); DEBUG10(CE_CONT, " mp %x\n", txd->mp); if (txd->cntrl & TX_SET) { shrktxset(txd->mp); } } } #endif /* SHRK_DEBUG */ 07070100023899000081a40000000000000003000000013670873b000002bf00001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/drv/mdi/shrk/space.h/* * @(#) space.h 77.1 98/12/11 * * Copyright (C) The Santa Cruz Operation, 1998. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated as Confidential. */ /* PCI Bus Number */ #define SHRK_0_PCI_BUS -1 #define SHRK_1_PCI_BUS -1 #define SHRK_2_PCI_BUS -1 #define SHRK_3_PCI_BUS -1 #define SHRK_4_PCI_BUS -1 #define SHRK_5_PCI_BUS -1 #define SHRK_6_PCI_BUS -1 #define SHRK_7_PCI_BUS -1 /* PCI Device Number */ #define SHRK_0_PCI_DEV -1 #define SHRK_1_PCI_DEV -1 #define SHRK_2_PCI_DEV -1 #define SHRK_3_PCI_DEV -1 #define SHRK_4_PCI_DEV -1 #define SHRK_5_PCI_DEV -1 #define SHRK_6_PCI_DEV -1 #define SHRK_7_PCI_DEV -1 070701000238a1000081a40000000000000003000000013757467e0000037900001dff0000000100000000000000000000002f00000000root/usr/src/O5hdk/net/drv/mdi/tok/AOF/tok-isa# # @(#) tok-isa 59.2 96/11/11 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PRI_ALT: PROMPT="Primary/Alternate Address" VALUES=primary,alternate TYPE=unique,link-kit RAM: VALUES=c0000-dc000:4000 DEFAULTS=d8000,d4000 TYPE=link-kit MAC_ADDRESS: VALUES=default PROMPT="Hardware Address" TYPE=link-kit FDX: PROMPT="Full-duplex mode enabled" VALUES=0,1 DEFAULTS=0 TYPE=link-kit SHMODE: PROMPT="Shallow mode enabled" VALUES=0,1 DEFAULTS=0 TYPE=link-kit FRAMESZ: VALUES=988,1500,2000 PROMPT="Maximum Frame Size" DEFAULTS=2000 TYPE=link-kit ADAPTER: DESCRIPTION="!AHDK! IBM Token-Ring Network ISA Series (Shared RAM)" BUS=ISA MEDIA_TYPE=token-ring MAX_BD=1 KEY=PRI_ALT REQUIRED=RAM ADVANCED=MAC_ADDRESS,FRAMESZ,FDX,SHMODE 070701000238a2000081a40000000000000003000000013757467e0000033d00001dff0000000100000000000000000000003400000000root/usr/src/O5hdk/net/drv/mdi/tok/AOF/tok-isa-auto# # @(#) tok-isa-auto 59.2 96/11/11 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PRI_ALT: PROMPT="Primary/Alternate Address" VALUES=primary,alternate TYPE=unique,link-kit MAC_ADDRESS: VALUES=default PROMPT="Hardware Address" TYPE=link-kit FDX: PROMPT="Full-duplex mode enabled" VALUES=0,1 DEFAULTS=0 TYPE=link-kit SHMODE: PROMPT="Shallow mode enabled" VALUES=0,1 DEFAULTS=0 TYPE=link-kit FRAMESZ: VALUES=988,1500,2000 PROMPT="Maximum Frame Size" DEFAULTS=2000 TYPE=link-kit ADAPTER: DESCRIPTION="!AHDK! IBM Auto 16/4 Token-Ring Network ISA-16 (Shared RAM)" BUS=ISA MEDIA_TYPE=token-ring MAX_BD=1 KEY=PRI_ALT REQUIRED= ADVANCED=MAC_ADDRESS,FRAMESZ,FDX,SHMODE 070701000238a3000081a40000000000000003000000013757467e0000035500001dff0000000100000000000000000000002f00000000root/usr/src/O5hdk/net/drv/mdi/tok/AOF/tok-mca# # @(#) tok-mca 60.1 96/12/11 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. SLOT: VALUES=1,2,3,4,5,6,7,8 TYPE=link-kit MAC_ADDRESS: VALUES=default PROMPT="Hardware Address" TYPE=link-kit FDX: PROMPT="Full-duplex mode enabled" VALUES=0,1 DEFAULTS=0 TYPE=link-kit SHMODE: PROMPT="Shallow mode enabled" VALUES=0,1 DEFAULTS=0 TYPE=link-kit FRAMESZ: VALUES=988,1500,2000 PROMPT="Maximum Frame Size" DEFAULTS=2000 TYPE=link-kit ADAPTER: DESCRIPTION="!AHDK! IBM Token-Ring Network Adapter/A" BUS=MCA MEDIA_TYPE=token-ring MAX_BD=1 KEY=SLOT REQUIRED= ADVANCED=MAC_ADDRESS,FRAMESZ,FDX,SHMODE ID=e000,e001 e000="IBM Token-Ring Network Adapter/A" e001="IBM Token-Ring Network 16/4 Adapter/A" 070701000238a5000081a400000000000000030000000135aefc950000028000001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/drv/mdi/tok/Makefile# # @(#) Makefile 59.2 96/11/11 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # IBM Token Ring Driver Makefile # SHELL=/bin/sh # CFLAGS= -O -I../../.. -D_INKERNEL -DDEBUG CFLAGS= -O -I../../.. -D_INKERNEL OBJ=tokli.o tokmac.o .SUFFIXES: .c .i .c.i: $(CC) $(CFLAGS) -L $< all: Driver.o acfg.tok Driver.o: $(OBJ) /lib/coff/ld -r -o Driver.o $(OBJ) acfg.tok: cd acfg; $(MAKE) clean: rm -f $(OBJ) tags cd acfg; make clean clobber: clean rm -f Driver.o cd acfg; make clobber $(OBJ): tok.h 070701000238a6000081a400000000000000030000000135aefc950000001b00001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/drv/mdi/tok/Mastertok I icSH tok 0 0 0 8 -1 070701000238a7000081a400000000000000030000000135aefc950000082d00001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/tok/Space.c/* * @(#) Space.c 59.2 96/11/11 SCOINC * * Copyright (C) The Santa Cruz Operation, 1993-1996. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * Driver for the IBM Token Ring Adapter */ #include #include #include #include #include "tok.h" #include "space.h" #include "config.h" extern tokopen(), tokclose(), tokuwput(); extern nulldev(); /* MIN PDU, MAX PDU, HI WATER MK, LO WATER MK */ static struct module_info tok_minfo = { 0,"tok", 0, MAX_PDU, 40000, 0 }; static struct qinit tokurinit = { NULL, NULL, tokopen,tokclose,nulldev,&tok_minfo,NULL }; static struct qinit tokuwinit = { tokuwput,NULL,tokopen,tokclose,nulldev,&tok_minfo,NULL }; struct streamtab tokinfo = { &tokurinit,&tokuwinit,NULL,NULL }; struct tokdevice tokdevice[TOK_CNTLS]; struct tokhwconf tokhwconf[TOK_CNTLS] = { #ifdef TOK_0 { TOK_0, TOK_0_SIOA, TOK_0_SCMA, TOK_0_ECMA-TOK_0_SCMA+1, 0 }, #endif #ifdef TOK_1 { TOK_1, TOK_1_SIOA, TOK_1_SCMA, TOK_1_ECMA-TOK_1_SCMA+1, 0 }, #endif #ifdef TOK_2 { TOK_2, TOK_2_SIOA, TOK_2_SCMA, TOK_2_ECMA-TOK_2_SCMA+1, 0 }, #endif #ifdef TOK_3 { TOK_3, TOK_3_SIOA, TOK_3_SCMA, TOK_3_ECMA-TOK_3_SCMA+1, 0 } #endif }; unchar tokhwaddr[TOK_CNTLS][6] = { #ifdef TOK_0 TOK_0_HWADDR, #endif #ifdef TOK_1 TOK_1_HWADDR, #endif #ifdef TOK_2 TOK_2_HWADDR, #endif #ifdef TOK_3 TOK_3_HWADDR, #endif }; ulong tokframsz[TOK_CNTLS] = { #ifdef TOK_0 TOK_0_FRAMESZ, #endif #ifdef TOK_1 TOK_1_FRAMESZ, #endif #ifdef TOK_2 TOK_2_FRAMESZ, #endif #ifdef TOK_3 TOK_3_FRAMESZ, #endif }; int tok_fdx [TOK_CNTLS] = { /* //thc-fdx */ #ifdef TOK_0 TOK_0_FDX, #endif #ifdef TOK_1 TOK_1_FDX, #endif #ifdef TOK_2 TOK_2_FDX, #endif #ifdef TOK_3 TOK_3_FDX, #endif }; int tok_smode [TOK_CNTLS] = { /* //thc-fdx */ #ifdef TOK_0 TOK_0_SHMODE, #endif #ifdef TOK_1 TOK_1_SHMODE, #endif #ifdef TOK_2 TOK_2_SHMODE, #endif #ifdef TOK_3 TOK_3_SHMODE, #endif }; u_int tok_nunit = TOK_CNTLS; 0707010002389f000081a400000000000000030000000135aefc95000001ec00001dff0000000100000000000000000000003100000000root/usr/src/O5hdk/net/drv/mdi/tok/acfg/Makefile# # @(#) Makefile 59.1 96/11/11 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # IBM Token Ring Driver Makefile # SHELL=/bin/sh CFLAGS= -O -I../../.. AOBJ=acfg.o acfgio.o .SUFFIXES: .c .i .c.i: $(CC) $(CFLAGS) -L $< all: acfg acfgio.o: acfgio.s cc -c acfgio.s acfg: $(AOBJ) cc -o acfg $(AOBJ) clean: rm -f $(AOBJ) clobber: clean rm -f acfg 0707010002389d000081a400000000000000030000000135aefc95000015a500001dff0000000100000000000000000000002f00000000root/usr/src/O5hdk/net/drv/mdi/tok/acfg/acfg.c#pragma comment(exestr, "@(#) acfg.c 59.1 96/11/11 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1996. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. * * MDI001 9 Feb 1995 donwo@sco.com * - Fixed assignment of value of func_id. Added debug to display value. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include unchar id_area[48]; unchar id[24] = { 0x5,0x0,0x4,0x9,0x4,0x3,0x4,0xf,0x3,0x6,0x3,0x1,0x3,0x1,0x3,0x0,0x3, 0x9,0x3,0x9,0x3,0x0,0x2,0x0 }; int debug_flag = 0; struct tok_brd { unchar func_id; int ramsz; }; /* * Presence test for IBM Token Ring Network Adapter */ tokpresent(int addr, struct tok_brd *tb) { unchar x; ulong i, mmio; int fd, match; if ( debug_flag ) { printf("Search I/O address 0x%x:\n", addr); } x = inb(addr); mmio = (x & 0xfc) << 11; mmio |= 1 << 19; if ( debug_flag ) { printf(" Read ROM address 0x%x:\n", mmio); } fd = open("/dev/mem", O_RDONLY); if (fd < 0) { perror("acfg: Unable to open /dev/mem"); exit(1); } if ( lseek(fd, mmio+0x1f30, SEEK_SET) == -1) { fprintf(stderr,"acfg: Unable to seek to 0x%x in /dev/mem", mmio); perror("acfg"); exit(1); } if ( read(fd, id_area, sizeof(id_area)) != sizeof(id_area) ) { perror("acfg: Unable to read TR ROM from /dev/mem"); exit(1); } match = 1; if ( debug_flag ) { printf(" Check ROM signature:\n:"); } for (i=0; i<24; i++) { if (debug_flag) { printf("Read 0x%x == 0x%x ", id_area[i*2], id[i]); } if (((id_area[i*2]) & 0xf) != id[i]) { if (debug_flag) { printf("ERROR "); } match=0; } } if (debug_flag) { printf("\n"); } if (!match) return(0); if ( lseek(fd, mmio+0x1fa0, SEEK_SET) == -1) { fprintf(stderr,"acfg: Unable to seek to 0x%x in /dev/mem", mmio+0x1fa0); perror("acfg"); exit(1); } if ( read(fd, id_area, 2) != 2) { perror("acfg: Unable to read Function Identifier from /dev/mem"); exit(1); } tb->func_id = id_area[0]; /* MDI001 */ if (debug_flag) { printf(" Adapter Type: 0x%x\n", tb->func_id); /* MDI001 */ } if ( lseek(fd, mmio+0x1e00, SEEK_SET) == -1) { fprintf(stderr,"acfg: Unable to seek to 0x%x in /dev/mem", mmio); perror("acfg"); exit(1); } if ( read(fd, id_area, 2) != 2) { perror("acfg: Unable to read RRR from /dev/mem"); exit(1); } switch ( (id_area[1] >> 2) & 0x03) { case 0: tb->ramsz = 8; break; case 1: tb->ramsz = 16; break; case 2: tb->ramsz = 32; break; case 3: tb->ramsz = 64; break; } return; } found(char *dir, char *key, struct tok_brd *tb) { static int file_no=0; char path[128]; FILE *f; struct stat stbuf; if (debug_flag) { printf(" %s adapter found RAM Size=%dK\n", key, tb->ramsz); } while (file_no < 10000) { sprintf(path, "%s/%d", dir, file_no); if (stat(path, &stbuf) == -1) break; file_no++; } if ( (f=fopen(path, "w")) == (FILE *)0 ) { perror("acfg: Unable to create AOF update file"); exit(1); } fprintf(f, "PRI_ALT:\n"); /* Stanza Section */ fprintf(f, "\tSELECT=%s\n", key); if ( tb->func_id > 0xc ) { fprintf(f, "RAM:\n"); switch (tb->ramsz) { case 8: fprintf(f, "\tVALUES=c0000-dc000:2000\n"); fprintf(f, "\tDEFAULTS=d8000,d4000\n"); break; case 16: fprintf(f, "\tVALUES=c0000-dc000:4000\n"); fprintf(f, "\tDEFAULTS=d8000,d4000\n"); break; case 32: fprintf(f, "\tVALUES=c0000-dc000:8000\n"); fprintf(f, "\tDEFAULTS=d8000,d0000\n"); break; case 64: fprintf(f, "\tVALUES=d0000,c0000\n"); fprintf(f, "\tDEFAULTS=d0000,c0000\n"); break; } fprintf(f,"ADAPTER:\n\tAOF=tok-isa\n"); fprintf(f,"\tDESCRIPTION=\"IBM Token-Ring Network Adapter\"\n"); } else { fprintf(f, "ADAPTER:\n\tAOF=tok-isa-auto\n"); fprintf(f, "\tDESCRIPTION=\"IBM Auto 16/4 Token-Ring Network Adapter\"\n"); } fclose(f); } /****************************************************************************/ /* Search for all tok adapters in the system and write out configuration * files containing their configuration into 'dir' */ autosearch_for_boards(char *dir) { FILE *f; struct stat stbuf; struct tok_brd tb; if (stat(dir, &stbuf) == -1 || !S_ISDIR(stbuf.st_mode)) { fprintf(stderr,"acfg: '%s' isn't a directory\n", dir); exit(1); } tb.func_id = tb.ramsz = 0; if (tokpresent(0xa20, &tb)) { found(dir, "primary", &tb); } tb.func_id = tb.ramsz = 0; if (tokpresent(0xa24, &tb)) { found(dir, "alternate", &tb); } return(0); } usage() { fprintf(stderr,"Usage:\n"); fprintf(stderr,"\tacfg [-D] -d directory - Autosearch\n"); fprintf(stderr,"\t -D - Debug\n"); exit(1); } main (int argc, char **argv) { int c; extern int optind; extern char *optarg; int autosearch_flag=0, setattr_flag=0, key_flag=0; char *autodir, *attrfile; int key; while ( (c=getopt(argc,argv,"d:D")) != -1) { switch (c) { case 'd': autosearch_flag++; autodir = optarg; break; case 'D': debug_flag++; break; default: usage(); } } /* Call the routine that enables I/O operation */ if (sysi86 (SI86V86, V86SC_IOPL, 0x3000) < 0) { perror("sysi86() failed"); exit (1); } if (autosearch_flag) exit(autosearch_for_boards(autodir)); usage(); } 0707010002389e000081a400000000000000030000000135aefc950000035600001dff0000000100000000000000000000003100000000root/usr/src/O5hdk/net/drv/mdi/tok/acfg/acfgio.s .ident "@(#) acfgio.s 59.1 96/11/11 SCOINC" / / Copyright (C) The Santa Cruz Operation, 1993-1996. / This Module contains Proprietary Information of / The Santa Cruz Operation and should be treated / as Confidential. .data .text .align 4 .def inb; .val inb; .scl 2; .type 042; .endef .globl inb inb: jmp .L14 .L13: movl 8(%ebp),%edx sub %eax,%eax inb (%dx) jmp .L12 /REGAL 0 NODBL /REGAL 6 AUTO -1(%ebp) 1 .L12: leave ret .L14: pushl %ebp movl %esp,%ebp pushl %eax jmp .L13 .def inb; .val .; .scl -1; .endef .data .text .align 4 .def outp; .val outb; .scl 2; .type 044; .endef .globl outb outb: jmp .L18 .L17: movsbl 12(%ebp),%eax movl 8(%ebp),%edx outb (%dx) movl $0,%eax jmp .L16 /REGAL 0 NODBL .L16: leave ret .L18: pushl %ebp movl %esp,%ebp jmp .L17 .def outb; .val .; .scl -1; .endef 070701000238a4000081a400000000000000030000000135aefc9500000a1600001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/drv/mdi/tok/lkcfg: # # @(#) lkcfg 75.1 98/06/26 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1998 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # tok MDI driver Link Kit configuration script # [ "$#" != "5" ] && { echo "Usage:\n\t$0 <-ird> INIT_DB_RECORD MDI_driver Board_number" exit $FAIL } LLI_ROOT=$MKMOKROOT`llipathmap` . $LLI_ROOT/lib/libcfg.sh PATH=$PATH:$LLI_ROOT/bin option=$1 INITDBR=$2 AOFFILE=$3 drv=$4 bd=$5 SYSTEM_FILE=$MKMOKROOT/etc/conf/sdevice.d/$drv MASTER_FILE=$MKMOKROOT/etc/conf/cf.d/mdevice DRIVER_DIR=$MKMOKROOT/etc/conf/pack.d/$drv # de-configure driver [ "$option" = "-d" ] && { # removes the driver from the system [ -f $SYSTEM_FILE ] && { set_system_info $SYSTEM_FILE $bd "N" 0 0 0 0 0 0 0 awk '{ if ( $2 == "Y" ) exit 1 }' $SYSTEM_FILE && idinstall -d $drv } exit $OK } [ -f "$INITDBR" ] || { echo "No INIT DB RECORD, \"$INITBDR\" found" exit $FAIL } cd $LLI_ROOT/ID/$drv for i in System Master Node Driver.o Space.c do [ -f "$i" ] || { echo "$drv: File, \"$LLI_ROOT/ID/$drv/$i\" not found" exit $FAIL } done # set a few system file fields X=`stzget $INITDBR PRI_ALT SELECT` if [ $? = 0 ] then if [ "$X" = "alternate" ] then BASE_IO=a24 else BASE_IO=a20 fi EIO=`hex_add $BASE_IO 3` else BASE_IO="0" EIO="0" fi SLOT=`stzget $INITDBR SLOT SELECT` || SLOT="0" RAM=`stzget $INITDBR RAM SELECT` || RAM="0" # check to see if the driver is in the link-kit [ -f $SYSTEM_FILE ] || { idinstall -a -e -k $drv idinstall -u -k -H $drv } # set the system file information set_system_info $SYSTEM_FILE $bd "Y" $SLOT 0 0 $BASE_IO $EIO $RAM $RAM MAC_ADDR=`stzget $INITDBR MAC_ADDRESS SELECT` || MAC_ADDR="default" [ "$MAC_ADDR" = "default" ] && MAC_ADDR="00:00:00:00:00:00" MAC_ADDR=`echo $MAC_ADDR | sed -e 's/:/,0x/g' -e 's/^/0x/'` set_header_info $drv $bd HWADDR $MAC_ADDR # Set maximum frame size. # Even though the adapter can handle a larger frame size (2042 bytes # as defined in tok.h) it is limited to 2k for compatibility with # other token ring adapters which cannot receive frames this big. # The 1500 choice is for compatibility with Ethernet. FRAMESZ=`stzget $INITDBR FRAMESZ SELECT` || FRAMESZ="default" [ "$FRAMESZ" = "default" ] && FRAMESZ="2000" set_header_info $drv $bd FRAMESZ $FRAMESZ # Set the FDX enbled flag. FDX=`stzget $INITDBR FDX SELECT` || FDX="0" set_header_info $drv $bd FDX $FDX # Set the Shallow mode enbled flag. SHMODE=`stzget $INITDBR SHMODE SELECT` || SHMODE="0" set_header_info $drv $bd SHMODE $SHMODE exit $OK 070701000238a8000081a400000000000000030000000135aefc960000030300001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/tok/space.h/* * @(#) space.h 59.2 96/11/11 SCOINC * * Copyright (C) The Santa Cruz Operation, 1993-1996. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #define TOK_0_HWADDR 0x00,0x00,0x00,0x00,0x00,0x00 #define TOK_1_HWADDR 0x00,0x00,0x00,0x00,0x00,0x00 #define TOK_2_HWADDR 0x00,0x00,0x00,0x00,0x00,0x00 #define TOK_3_HWADDR 0x00,0x00,0x00,0x00,0x00,0x00 #define TOK_0_FRAMESZ 2000 #define TOK_1_FRAMESZ 2000 #define TOK_2_FRAMESZ 2000 #define TOK_3_FRAMESZ 2000 #define TOK_0_FDX 0 #define TOK_1_FDX 0 #define TOK_2_FDX 0 #define TOK_3_FDX 0 #define TOK_0_SHMODE 0 #define TOK_1_SHMODE 0 #define TOK_2_SHMODE 0 #define TOK_3_SHMODE 0 070701000238a9000081a400000000000000030000000135aefc9500004cde00001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/drv/mdi/tok/tok.h/* * @(#) tok.h 59.2 96/11/11 SCOINC * * Copyright (C) The Santa Cruz Operation, 1993-1996. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #ifndef DEBUG #define STATIC static #else /* #define STATIC */ #define STATIC static #endif #define FALSE 0 #define TRUE (!FALSE) /**********************************************/ /* Defines for address check (thc-sm/thc-fdx) */ /**********************************************/ #define ADDR_LEN 6 typedef unchar n_addr [ADDR_LEN]; /* * MAC header structure (token ring) */ typedef struct mac_hdr_tr { unchar mh_pcf0; /* Access Control Field */ unchar mh_pcf1; /* Frame Control Field */ n_addr mh_dst; /* Destination address */ n_addr mh_src; /* Source address */ } mac_hdr_tr; /* macro that determine if the address is a MultiCastAddress */ #define ISMCATR(ma) (*(u_char *)(ma) == 0xC0 && *((u_char *)(ma)+1) == 0x00) /* macro that determine if the address is a BroadcastAddress */ #define ISBROADCAST(ma) (*(u_char *)(ma) == 0xFF && \ *((u_char *)(ma)+1) == 0xFF && \ *((u_char *)(ma)+2) == 0xFF && \ *((u_char *)(ma)+3) == 0xFF && \ *((u_char *)(ma)+4) == 0xFF && \ *((u_char *)(ma)+5) == 0xFF) /*********************************************/ /* End of the Defines for address check */ /*********************************************/ #define TXBUF_LEN 2048 /* Size of a transmit buffer */ #define RXBUF_LEN 2048 /* Size of a receive buffer */ #define MAX_PDU (RXBUF_LEN - 6) /* MAX PDU Size (at MDI I/F) */ #define NTOKMCA 16 /* Max no of multi-casts per board */ struct tokhwconf { /* ISA MCA */ u_int slot; /* - Link-kit */ u_int iobase; /* Link-kit Boot-time */ u_int rambase;/* Link-kit Boot-time */ u_int ramsz; /* Link-kit Boot-time */ u_int irq; /* Boot-time Boot-time */ }; #define ADDR_TO_LONG(x) (*((ulong *)(((unchar *)(x))+2))) /* Base addr for MCA adapters is encoded in low bit of POS register 3 */ #define TOKEN_MCA_BASE(pos3) (((pos3) & 1) ? 0xa24 : 0xa20) #define ADENABLE 0x96 /* adapter enable/setup on MCA */ #define CH_SETUP 0x08 /* adapter enable/setup on MCA */ #define POS3 0x103 /* POS register 3 - info port 1 on MCA*/ /* Base addr of PIO on Primary / Alternate card */ #define TOKEN_BASE(unit) (tokhwconf[unit].iobase) #define TOKEN_SWTCH_RD(u) TOKEN_BASE(u) /* a PIO read to this offset returns the contents of the ROS/MMIO domain switches */ #define TOKEN_RESET(u) (TOKEN_BASE(u)+ 1) /* any PIO to this offset cause adapter reset */ #define TOKEN_SWTCH2_RD(u) (TOKEN_BASE(u)+2)/* a PIO read to this offset returns the Microchannel info */ #define TOKEN_RELEASE(u) (TOKEN_BASE(u)+2)/* a PIO write to this offset terminates reset state... wait at least 50ms between RESET and RELEASE */ #define TOKEN_INTR_REL(u) (TOKEN_BASE(u)+3)/* PIO write to this offset are used to reenable only the adapter interrupt after a interrupt has been serviced */ #define ACA 0x1e00 /* attached control area offset */ #define AIP 0x1f00 /* adapter ID PROM */ struct aca { unchar rrr_even, rrr_odd; ushort wrb; ushort wwo; ushort wwc; unchar isrp_even, isrp_odd; unchar isra_even, isra_odd; ushort tcr; ushort tvr; char filler1[0x8]; unchar srpr_even, srpr_odd; char filler2[0xe]; unchar isrp_even_rst, isrp_odd_rst; unchar filler3, isra_odd_rst; char filler4[0x1c]; unchar isrp_even_set, isrp_odd_set; unchar filler5, isra_odd_set; }; /* Interrupts to the PC (see page 7 in S.G.12.002) */ #define ADAP_CHK 0x40 /* Adapter check */ #define SRB_RESP 0x20 /* SRB response */ #define ARB_CMD 0x08 /* ARB command */ /* Interrupts to the PC when in normal mode */ /* //thc-sm */ #define NM_IMPL_RCV 0x80 /* Received IMPL Force MAC fr */ #define NM_ASB_FREE 0x10 /* ASB free */ #define NM_SSB_RESP 0x04 /* SSB response */ #define NM_BR_FWD_CMPLT 0x02 /* Bridge frame forward is complete */ /* Interrupts to the PC when in shalow mode */ /* //thc-sm */ #define SM_RXBUFF_POST 0x10 /* Receive Buffers Posted */ #define SM_TXCPLT 0x02 /* Transmit Complete */ /* Interrupts to the PC (in isrp_high) */ #define TIMER_INT 0x10 /* TVR-even expired */ #define ERROR_INT 0x08 /* Machine check error/Adapter error */ #define ACCESS_INT 0x04 /* Shared RAM Access violation */ /* Interrupts to the card (see page 6 in S.G.12.002) */ #define SRB_CMD 0x20 /* Command in SRB */ #define SRB_FREE_REQ 0x08 /* SRB free request */ #define ARB_FREE 0x02 /* ARB free */ /* Interrupts to the card when in normal mode */ /* //thc-sm */ #define NM_ASB_RESP 0x10 /* Response in ASB */ #define NM_ASB_FREE_REQ 0x04 /* ASB free request */ #define NM_SSB_FREE 0x01 /* SSB free */ /* Interrupts to the card when in shallow mode */ /* //thc-sm */ #define SM_TX_REQUEST 0x40 /* Fast Path Trasnmit Request */ #define SM_RXBUFF_CPLT 0x10 /* Receive Buffers completed */ /* SRB Response for Initialization (see page 27 in S.G.12.002) */ struct srb_init_status { unchar command; unchar status; unchar status2; unchar reserved[3]; ushort bringup_code; ushort encoded_address; ushort level_address; ushort adapter_address; ushort parms_address; ushort mac_address; }; /* SRB Open Command (see page 35 in S.G.12.002) */ struct srb_open { unchar command; unchar reserved[7]; ushort open_options; unchar node_address[6]; unchar group_address[4]; unchar func_address[4]; ushort num_rcv_buff; ushort rcv_buf_len; ushort dhb_buf_len; unchar num_dhb; unchar reserv1; unchar dlc_max_sap; unchar dlc_max_stations; unchar dlc_max_gsap; unchar dlc_max_gsap_mems; unchar dlc_t1_tick_one; unchar dlc_t2_tick_one; unchar dlc_ti_tick_one; unchar dlc_t1_tick_two; unchar dlc_t2_tick_two; unchar dlc_ti_tick_two; unchar product_id[18]; }; /* SRB Open Response (see page 39 in S.G.12.002) */ struct srb_open_response { unchar command; unchar reserved; unchar retc; unchar reserved1[3]; ushort open_error_code; ushort asb_address; ushort srb_address; ushort arb_address; ushort ssb_address; unchar open_status; /* //thc-fdx Extend open status */ }; /* open_options */ #define MON_CONTENDER 0x0100 /* participate in monitor contention if set */ struct srb_modify_open { unchar command; /* == 0x01 */ unchar reserved; unchar retc; unchar reserved1; ushort open_options; }; /* SRB Send Command (see page 65 in S.G.12.002) */ struct srb_send { unchar command; unchar correlate; unchar retc; unchar reserved; ushort station_id; }; /* SRB Set Functional Address Command */ struct srb_set_func_addr { unchar command; /* == 0x07 */ char res1; /* Reserved */ unchar retc; /* Return code */ char res2[3]; /* Reserved */ ulong func_addr; /* New functional address */ }; /* ARB Transmit Data Request Command (see page 78 in S.G.12.002) */ struct arb_xmt_cmd { unchar command; unchar correlate; ushort reserved; ushort station_id; ushort dhb_address; }; struct asb_status { unchar command; unchar correlate; unchar retc; }; /* ASB Response to ARB Transmit Data Request Command (see page 79 in S.G.12.002 */ struct asb_xmt_resp { unchar command; unchar correlate; unchar retc; unchar reserved; ushort station_id; ushort frame_len; unchar hdr_len; unchar rsap_value; }; /* SSB Response to SRB Send Command (see page 67 in S.G.12.002) */ struct ssb_xmt_resp { unchar command; unchar correlate; unchar retc; unchar reserved; ushort station_id; unchar xmt_error; }; /* SRB Close Command (see page 32 in S.G.12.002) */ struct srb_close { unchar command; unchar reserved; unchar retc; }; /* Receive Buffer Format (see page 72 in S.G.12.002) */ struct rcv_buf { ushort reserved; ushort rcv_buf_ptr; unchar reserved1; unchar receive_pcfe; ushort frame_len; unchar data[1]; }; /* ARB Received Data Command (see page 73 in S.G.12.002) */ struct arb_rcv_data { unchar command; unchar reserved[3]; ushort station_id; ushort rcv_buf_ptr; unchar hdr_len; unchar dlc_len; ushort frame_len; unchar msg_type; }; /* ASB Received Data Command Response (see page 75 in S.G.12.002) */ struct asb_rcv_resp { unchar command; unchar reserved; unchar retc; unchar reserved1; ushort station_id; ushort rcv_buf_ptr; }; struct srb_sap_open { unchar command; unchar reserved; unchar retc; unchar reserved1; ushort station_id; unchar timer_t1; unchar timer_t2; unchar timer_ti; unchar maxout; unchar maxin; unchar maxout_incr; unchar max_retry_count; unchar gsap_max_mem; ushort max_i_field; unchar sap_value; unchar sap_options; unchar station_count; unchar sap_gsap_mem; unchar gsaps[8]; }; struct srb_sap_close { unchar command; unchar reserved; unchar retc; unchar reserved1; ushort station_id; }; struct srb_read_log { unchar command; unchar reserved; unchar retc; unchar reserved1[3]; /* ERROR Counters */ unchar line, internal, burst, ac, abort; unchar reserved2; unchar lost_frames, congestion, copied, freq, token; }; struct arb_ring_status { unchar command; unchar reserved[5]; ushort ring_status; unchar fdx_error; /* //thc-fdx */ }; /* ring status codes */ #define RST_SIGNAL_LOSS 0x8000 #define RST_HARD_ERROR 0x4000 #define RST_SOFT_ERROR 0x2000 #define RST_TRANSMIT_BEACON 0x1000 #define RST_LOBE_WIRE_FAULT 0x0800 #define RST_AUTO_RMV_ERROR 0x0400 #define RST_FDX_ERROR 0x0200 /* //thc-fdx */ #define RST_REMOVE_RECEIVED 0x0100 #define RST_COUNTER_OVERFLOW 0x0080 #define RST_SINGLE_STATION 0x0040 #define RST_RING_RECOVERY 0x0020 struct adapter_address_area { unchar node_addr[6]; /* Adapter's node address */ unchar group_addr[4]; /* Adapter's group address */ ulong func_addr; /* Adapter's functional address */ }; struct adapter_parameters_area { unchar phys_addr[4]; /* Adapter's physical address */ unchar up_node_addr[6]; /* Next active upstream neighbour */ unchar up_phys_addr[4]; /* Next active up' b'bor phys addr */ unchar poll_addr[6]; /* Last poll address */ unchar reserved[2]; ushort acc_priority; /* Transmit access priority */ ushort source_class; /* Source class authority */ ushort att_code; /* Last attention code */ unchar source_addr[6]; /* Last source address */ ushort beacon_type; /* Last beacon type */ ushort major_vector; /* Last major vector */ ushort netw_status; /* Network status */ ushort soft_error; /* Soft error timer value */ ushort fe_error; /* Front end error counter */ ushort local_ring; /* Ring number */ ushort mon_error; /* Monitor error code */ ushort beacon_transmit; /* Beacon transmit type */ ushort beacon_receive; /* Beacon receive type */ ushort frame_correl; /* Frame correlator save */ unchar beacon_naun[6]; /* Beaconing station's NAUN */ unchar reserved2[4]; unchar beacon_phys[4]; /* Beaconing station's phys addr */ }; struct tokdevice { queue_t *up_queue; /* Read Queue to MDI */ uint mdi_state; /* See below */ uint wait_srb_complete:1, /* Sleep() for an SRB to end */ device_timeout:1, /* timed out open/closing */ tokstartio_going:1, /* tokstartio() called */ srb_busy:1, /* SRB in use */ wait_send_xmt_srb:1, /* Waiting to send TX SRB */ wait_send_close_srb:1, /* Wait-send CLOSE SRB */ wait_send_log_srb:1, /* Wait-send READ LOG SRB */ asb_busy:1, /* ASB in use */ wait_send_xmt_asb:1, /* Waiting to send TX ASB */ wait_send_rcv_asb:1, /* Waiting to send RX ASB */ wait_send_mod_srb:1 /* Waiting on MODIFY OPEN SRB */ ; mblk_t *iocmp; int timeout_id; /* Transmit information */ unchar * txbufp; /* Addr of a free tx buffer */ struct srb_send srb_send; /* Local copy of SRB */ struct asb_xmt_resp asb_xmt_resp; /* Local copy of ASB */ /* Receive information */ struct asb_rcv_resp asb_rcv_resp; /* Local copy of ASB */ /* Other SRB buffers */ struct srb_set_func_addr srb_set_func_addr; struct srb_close srb_close; struct srb_read_log srb_read_log; struct srb_modify_open srb_modify_open; /* H/W Information */ unchar hw_address[6]; ulong max_pdu; /* MAX PDU Size */ unchar ring_speed_detector; /* detect ring speed mismatch */ unchar ring_speed_save; /* auto update ring speed */ ulong ring_speed; /* 4/16Mb/s */ unchar fdx_enable; /* enable FULL-DUPLEX //thc-fdx*/ unchar fdx_opened; /* adapter opened FDX //thc-fdx*/ unchar sm_enable; /* enable SHALLOW-MODE //thc-sm */ /* Multicast address table */ ulong mccnt; /* #Entries in mctbl */ ulong mctbl[NTOKMCA]; /* MCA Table */ /* Pointers into the adapter's workspace */ unchar * mmio; /* MMIO Area */ volatile struct aca *aca; /* The ACA in the MMIO Area */ unchar * sram; /* Shared Memory */ struct adapter_address_area *addr; /* The 'adapter_addr' area in */ /* the S-RAM area */ struct adapter_parameters_area *parms; /* The 'parameters' area in */ /* the S-RAM area */ unchar * srb; /* Addr of SRB */ unchar * asb; /* Addr of ASB */ unchar * ssb; /* Addr of SSB (R-only) */ unchar * arb; /* Addr of ARB (R-only) */ /* Shallow Mode adapter's workspace */ /* //thc-sm */ struct fp_tx_c_area * fp_tx_ca; /* fast path transmit */ /* control area. */ struct fp_rx_c_area * fp_rx_ca; /* fast path receive */ /* control area. */ /* Shallow Mode adapter's tx operation */ /* //thc-sm */ volatile ushort tx_completion_q_head; /* completion queue */ /* head. */ volatile int tx_buffer_count; /* transmission */ /* buffers count. */ /* Shallow Mode adapter's rx operation */ /* //thc-sm */ volatile ushort rx_queue_pointer; /* receive queue */ /* head. */ /* Shallow Mode adapter's general operation */ /* //thc-sm */ volatile int sm_retc; /* SM return code */ /* of the adapter */ mac_stats_tr_t stats; /* Statistics */ }; /* * VALID VALUES FOR mdi_state */ #define MDI_NOT_PRESENT 0 /* Adapter not present */ #define MDI_CLOSED 1 /* Adapter present */ #define MDI_OPEN 2 /* MDI device is open */ #define MDI_BOUND 3 /* LLI module bound to MDI device */ /* //thc-fdx * DEFINES FOR FULL-DUPLEX MODE */ /* open_status codes */ #define OPEN_STATUS_FDX 0x08 /* //thc-sm * DEFINES FOR SHALOW MODE */ #define SM_RX_BUFFER_SIZE 512 /* length of receive buffers. */ #define SM_RX_BUFHEADER_SZ 8 /* size of the buffer header. */ #define SM_RX_BUFDATA_SZ (SM_RX_BUFFER_SIZE - SM_RX_BUFHEADER_SZ) /* The min. number of received */ /* buffer must be calculated by:*/ /* (tokframsz[unit]/BUFDATA_SZ) */ /* + 1 */ #define SM_OFFSET_RXNEXT 2 /* offset of the next_buffer */ /* field in rx buffer. */ #define SM_RX_STATUS_EOF 0x0001 /* end of frame mask for the */ /* status in rx buffer. */ /* ALREADY IN ADAPTER FORMAT */ #define SM_TX_BUFFER_SIZE 512 /* size of transmit buffers */ #define SM_TX_BUFHEADER_SZ 22 /* size of the buffer header. */ #define SM_TX_BUFDATA_SZ (SM_TX_BUFFER_SIZE - SM_TX_BUFHEADER_SZ) /* size of the buffer header. */ #define SM_OFFSET_TXNEXT 16 /* offset of the next_buffer */ /* field in tx buffer. */ #define SM_TX_RAM_SIZE 2818 /* ram size to allocate for */ /* transmit buffer (in number */ /* of eight bytes blocks) */ #define SM_CNF_EXT_OPTIONS 0x80 /* bit7: 1 -> shallow mode */ /* bit6: 0 \ no lookahead */ /* bit5: 0 / */ /* SRB Configure Extensions Command */ /* //thc-sm */ struct srb_cnf_ext { unchar command; unchar reserved [1]; unchar retc; unchar reserved1 [3]; unchar options_flag; }; typedef struct srb_cnf_ext srb_cnf_ext; /* SRB Configure Extensions response */ /* //thc-sm */ struct srb_cnf_ext_resp { unchar command; unchar reserved [1]; unchar retc; unchar reserved1 [5]; }; typedef struct srb_cnf_ext_resp srb_cnf_ext_resp; /* SRB Configure Fast Path RAM Command */ /* //thc-sm */ struct srb_cnf_fp_ram { unchar command; unchar reserved [1]; unchar retc; unchar reserved1 [5]; ushort tx_ram_size; ushort tx_buffer_size; }; typedef struct srb_cnf_fp_ram srb_cnf_fp_ram; /* SRB Configure Fast Path RAM response */ /* //thc-sm */ struct srb_cnf_fp_ram_resp { unchar command; unchar reserved [1]; unchar retc; unchar reserved1 [5]; ushort fp_tx_sram; ushort srb_address; ushort fp_rx_sram; }; typedef struct srb_cnf_fp_ram_resp srb_cnf_fp_ram_resp; /* Shallow Mode Fast Path Transmit Control Area */ /* //thc-sm */ struct fp_tx_c_area { ushort buffer_count; ushort free_q_head; ushort free_q_tail; ushort adp_q_head; ushort buffer_size; ushort completion_q_tail; unchar reserved [4]; }; typedef struct fp_tx_c_area fp_tx_c_area; /* Shallow Mode trasmit Buffer Format */ /* //thc-sm */ struct sm_tx_buf { ushort reserved1; unchar retcode; unchar reserved2; ushort station_id; ushort frame_len; unchar reserved3 [4]; ushort last_buffer; ushort frame_pointer; /* reserved for the adapter */ ushort next_buffer; unchar xmit_status; /* reserved for the adapter */ unchar stripped_FS; ushort buffer_len; unchar frame_data[1]; }; typedef struct sm_tx_buf sm_tx_buf; /* Shallow Mode Fast Path Receive Control Area */ /* //thc-sm */ struct fp_rx_c_area { ushort posted_count; ushort completion_count; ushort freed_count; ushort posted_q_head; ushort posted_q_tail; unchar reserved [6]; }; typedef struct fp_rx_c_area fp_rx_c_area; /* Shallow Mode Receive Buffer Format */ /* //thc-sm */ struct sm_rx_buf { ushort frame_len; ushort next_buffer; ushort receive_status; ushort buffer_len; unchar frame_data[1]; }; typedef struct sm_rx_buf sm_rx_buf; 070701000238aa000081a400000000000000030000000135aefc9500002afc00001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/drv/mdi/tok/tokli.c#pragma comment(exestr, "@(#) tokli.c 63.1 97/04/08 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1997. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * MDI Driver for the IBM Token Ring Adapter */ #include #include #include #include #include /* needed for sys/user.h */ #include /* needed for sys/user.h */ #include /* needed for sys/user.h */ #include /* needed for sys/user.h */ #include #include #include #include #include "tok.h" extern struct tokdevice tokdevice[]; extern struct tokhwconf tokhwconf[]; extern int tokSMtx (int unit, mblk_t *mp); //thc-sm /* * The following six routines are the normal streams driver * access routines */ tokopen(queue_t *q, int dev, int flag, int sflag) { int x; struct tokdevice *device; dev = minor(dev); device = &(tokdevice[dev]); if (sflag==CLONEOPEN) { u.u_error = EINVAL; return(OPENFAIL); } if (device->mdi_state != MDI_CLOSED) { u.u_error = ENXIO; return(OPENFAIL); } bzero(&device->stats, sizeof(mac_stats_tr_t)); q->q_ptr = WR(q)->q_ptr = (char *)dev; if (!tokhwinit(dev)) { u.u_error = ENXIO; return(OPENFAIL); } device->mdi_state = MDI_OPEN; return(dev); } tokclose(queue_t *q) { int bd = (int)q->q_ptr; struct tokdevice *device = &tokdevice[bd]; int x; x = splstr(); flushq(WR(q),1); q->q_ptr = (char *)0; splx(x); if (device->mdi_state == MDI_OPEN || device->mdi_state == MDI_BOUND) tokhwhalt(bd); device->up_queue = 0; device->mdi_state = MDI_CLOSED; return(0); } tokuwput(queue_t *q, mblk_t *mp) { switch (mp->b_datap->db_type) { case M_PROTO: case M_PCPROTO: tokmacproto(q, mp); return; case M_DATA: tokdata(q,mp); return; case M_IOCTL: tokioctl(q, mp); return; case M_FLUSH: if (*mp->b_rptr & FLUSHW) { flushq(q, FLUSHALL); *mp->b_rptr &= ~FLUSHW; } if (*mp->b_rptr & FLUSHR) { flushq(RD(q), FLUSHALL); qreply(q, mp); } else freemsg(mp); return; default: printf("tokuwput: unknown STR msg type %x received mp = %x\n" , mp->b_datap->db_type, mp); freemsg(mp); return; } } STATIC tokdata(q,mp) queue_t *q; mblk_t *mp; { int bd; struct tokdevice *device; int s; mac_hdr_tr *hdr; //thc-sm thc-fdx bd = (int)q->q_ptr; device = &tokdevice[bd]; if (device->mdi_state != MDI_BOUND) { mdi_macerrorack(RD(q), M_DATA, MAC_OUTSTATE); freemsg(mp); return; } if (mp == 0) { // cmn_err(CE_WARN, "tok%d - tokdata called with null msg data", bd); freemsg(mp); return (TRUE); } /* //thc-sm thc-fdx * * The hardware can't do loopback in shallow mode neither in FDX mode: * Do it here */ if (device->sm_enable || device->fdx_opened) { hdr = (struct mac_hdr_tr *) mp->b_rptr; if ((ISMCATR(hdr->mh_dst) && tokcheckaddr(device, ADDR_TO_LONG(hdr->mh_dst))) || ISBROADCAST(hdr->mh_dst)) { // #ifdef DEBUG // printf ("\ntokdata: loopback MCA or BROADCAST\n"); // #endif mdi_do_loopback (q, mp, 14); } else { if (mdi_addrs_equal (device->hw_address, hdr->mh_dst)) { // #ifdef DEBUG // printf ("\ntokdata: loopback my address\n"); // #endif putnext (RD(q), mp); return; } // #ifdef DEBUG // printf ("\ntokdata: ** not loopback frame **\n"); // #endif } } s = splstr(); if (device->sm_enable) //thc-sm { /* shallow mode operation */ if (q->q_first || !tokSMtx (bd, mp)) putq(q, mp); } else { /* normal operation */ if (!device->tokstartio_going) { device->tokstartio_going = 1; tokstartio(device); putq(q,mp); } else { if (q->q_first || !device->txbufp) { putq(q, mp); } else { tokhwput(bd,mp); } } } splx(s); } /* * Messages are placed on the write queue in tokdata. This function is called * from a transmit complete interrupt to get a message from the queue and * send it to the adapter using tokhwput. Assumes splstr() */ toksend_queued(q) register queue_t *q; { mblk_t *mp; int unit = (int)q->q_ptr; struct tokdevice *device = &tokdevice[unit]; if (mp=getq(q)) { if (device->txbufp) tokhwput(unit, mp); else putbq(q,mp); } } /* * boot init */ tokinit() { struct tokdevice *device; extern int tok_nunit; int i, t; char *tp; unsigned char *x; for (i = 0; i < tok_nunit; i++) { device = &tokdevice[i]; device->mdi_state = MDI_NOT_PRESENT; if ( (t=tokpresent(i)) ) { x=device->hw_address; printcfg("tok", tokhwconf[i].iobase, 3, tokhwconf[i].irq, -1, "RAMsz=%dk, addr=%b:%b:%b:%b:%b:%b", tokhwconf[i].ramsz/1024, *(x+0),*(x+1),*(x+2),*(x+3),*(x+4),*(x+5) ); if (tokhwconf[i].ramsz < (16*1024)) /* MDI003 */ switch (device->mmio[0x1fa2]) { /* case 0x0f: /* 4 mbps bus */ /* break; */ case 0x0e: /* 16 mbps bus */ case 0x0d: /* 4 and 16 mbps bus */ printf("At least 16K Token Ring adapter RAM suggested\n"); } device->mdi_state = MDI_CLOSED; } else { printf("IBM Token Ring Network Adapter at io=0x%x not present\n", tokhwconf[i].iobase); } } } /* * The following three routines implement MDI interface */ STATIC tokmacproto(q,mp) queue_t *q; mblk_t *mp; { union MAC_primitives *prim; mblk_t *mp1; mac_info_ack_t *info_ack; mac_ok_ack_t *ok_ack; int bd = (int)q->q_ptr; struct tokdevice *device = &tokdevice[bd]; prim = (union MAC_primitives *) mp->b_rptr; switch(prim->mac_primitive) { case MAC_INFO_REQ: if (!(mp1 = allocb(sizeof(mac_info_ack_t), BPRI_HI))) { cmn_err(CE_WARN, "tokmacproto - Out of STREAMs"); freemsg(mp); return; } info_ack = (mac_info_ack_t *) mp1->b_rptr; mp1->b_wptr += sizeof(mac_info_ack_t); mp1->b_datap->db_type = M_PCPROTO; info_ack->mac_primitive = MAC_INFO_ACK; info_ack->mac_max_sdu = device->max_pdu; // info_ack->mac_min_sdu = 1; info_ack->mac_min_sdu = 14; info_ack->mac_mac_type = MAC_TPR; // info_ack->mac_driver_version = 0x3200; info_ack->mac_driver_version = MDI_VERSION; info_ack->mac_if_speed = device->ring_speed; freemsg(mp); qreply(q, mp1); break; case MAC_BIND_REQ: if (device->mdi_state != MDI_OPEN) { mdi_macerrorack(RD(q),prim->mac_primitive,MAC_OUTSTATE); freemsg(mp); return; } device->mdi_state = MDI_BOUND; device->up_queue = RD(q); mdi_macokack(RD(q),prim->mac_primitive); freemsg(mp); break; default: mdi_macerrorack(RD(q), prim->mac_primitive, MAC_BADPRIM); freemsg(mp); break; } } /* * Handle an ioctl message from the stream. */ STATIC tokioctl(queue_t *q, mblk_t *mp) { struct iocblk *iocp; int bd = (int)q->q_ptr; struct tokdevice *device = &tokdevice[bd]; int i, j; unsigned char *datap; ulong l; iocp = (struct iocblk *)mp->b_rptr; if (mp->b_cont) datap = mp->b_cont->b_rptr; else datap = (unsigned char *)0; switch (iocp->ioc_cmd) { case MACIOC_GETADDR: /* Return hardware address of the card */ if (!datap || iocp->ioc_count != 6) { iocp->ioc_error = EINVAL; goto ioctl_nak; } bcopy(device->hw_address, datap, 6); mp->b_cont->b_wptr = mp->b_cont->b_rptr + 6; goto ioctl_ack; case MACIOC_SETMCA: /* Set Multicast address */ if (iocp->ioc_uid != 0) { iocp->ioc_error = EPERM; goto ioctl_nak; } if (!datap || iocp->ioc_count != 6) { iocp->ioc_error = EINVAL; goto ioctl_nak; } if (device->mccnt == NTOKMCA) { iocp->ioc_error = ENOSPC; goto ioctl_nak; } if (*datap != 0xc0 || *(datap+1) != 00) { iocp->ioc_error = EINVAL; goto ioctl_nak; } l = ADDR_TO_LONG(datap); for (i = 0; i < device->mccnt; i++) { if (l == device->mctbl[i]) break; } if (i == device->mccnt) { /* Not already in table */ device->mctbl[device->mccnt] = ADDR_TO_LONG(datap); ++device->mccnt; } goto ioctl_ack; case MACIOC_DELMCA: /* Del Multicast address */ if (iocp->ioc_uid != 0) { iocp->ioc_error = EPERM; goto ioctl_nak; } if (!datap || iocp->ioc_count != 6) { iocp->ioc_error = EINVAL; goto ioctl_nak; } if (*datap != 0xc0 || *(datap+1) != 00) { iocp->ioc_error = EINVAL; goto ioctl_nak; } l = ADDR_TO_LONG(datap); for (i = 0; i < device->mccnt; i++) { if (l == device->mctbl[i]) break; } if (i == device->mccnt) { iocp->ioc_error = EINVAL; goto ioctl_nak; } /* Found this MCA for deletion */ if (i < --device->mccnt) bcopy(&device->mctbl[i+1], &device->mctbl[i], (device->mccnt-i)*sizeof(long)); goto ioctl_ack; case MACIOC_GETMCA: /* Get MCA table */ i = device->mccnt*6; if (!datap || iocp->ioc_count < i) { iocp->ioc_error = EINVAL; goto ioctl_nak; } for (j=0; jmccnt; ++j) { ADDR_TO_LONG(datap) = device->mctbl[j]; *datap = 0xc0; *(datap+1)= 0x00; datap += 6; } iocp->ioc_count = i; mp->b_cont->b_wptr = mp->b_cont->b_rptr + i; goto ioctl_ack; case MACIOC_GETSTAT: if (!datap || iocp->ioc_count!=sizeof(mac_stats_tr_t)) { iocp->ioc_error = EINVAL; goto ioctl_nak; } tokupdate_stats(bd, mp); return; case MACIOC_CLRSTAT: /* clear statistics */ if (iocp->ioc_uid != 0) { iocp->ioc_error=EPERM; goto ioctl_nak; } bzero(&device->stats, sizeof(mac_stats_tr_t)); goto ioctl_ack; case MACIOC_GETMCSIZ: /* clear statistics */ iocp->ioc_rval = device->mccnt*6; iocp->ioc_count = 0; goto ioctl_ack; case MACIOC_SETSTAT: /* set MAC statistics */ if (!datap || (iocp->ioc_count != sizeof(mac_setstat_t))) { iocp->ioc_error = EINVAL; goto ioctl_nak; } else { i = 0; /* * loop starts at highest bit to verify valid flag(s) * are set before updating statistic */ for (j = ((10*NFLBITS) - 1); j >= 0; --j) { if (MACFL_ISSET(j, (mac_setstat_t *) datap)) { switch (j) { case MACSTAT_ACTMONPARTICIPATE: if (((mac_setstat_t *)datap)->mac_stats.tr.mac_actmonparticipate) { i |= MON_CONTENDER; device->stats.mac_actmonparticipate = 1; } else { i &= ~MON_CONTENDER; device->stats.mac_actmonparticipate = 0; } break; default: /* invalid setstat flag set */ iocp->ioc_error = EINVAL; goto ioctl_nak; } } } tokmodopen(bd, i); iocp->ioc_count = 0; iocp->ioc_rval = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = (mblk_t *)0; } } goto ioctl_ack; default: ioctl_nak: mp->b_datap->db_type = M_IOCNAK; iocp->ioc_count = 0; if (mp->b_cont) { freemsg(mp->b_cont); mp->b_cont = (mblk_t *)0; } qreply(q, mp); return; } ioctl_ack: mp->b_datap->db_type = M_IOCACK; qreply(q, mp); } 070701000238ab000081a400000000000000030000000135aefc950000cf0e00001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/drv/mdi/tok/tokmac.c#pragma comment(exestr, "@(#) tokmac.c 66.1 97/09/03 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1997. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include #include #include #include #include #include #include #include #include #include "tok.h" struct tok_diag { char i; char *s; }; extern struct tokdevice tokdevice[]; extern struct tokhwconf tokhwconf[]; extern unchar tokhwaddr[][6]; extern ulong tokframsz[]; extern int tok_fdx []; //thc-fdx extern int tok_smode []; //thc-sm extern unchar *sptalloc(int,int,int,int); STATIC unchar tokirq_to_unit[20]; /* IRQ->Unit number map */ STATIC unchar tokfuncaddr[] = { 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff }; STATIC int tok_SMopen (int unit); //thc-sm STATIC int process_SMopen_cnf_ext (int unit); //thc-sm STATIC int process_SMopen_cnf_ram (int unit); //thc-sm STATIC int tok_normalopen (int unit); //thc-sm int tokSMtx (int unit, mblk_t *mp); //thc-sm STATIC mblk_t *fill_txbuffer (mblk_t *mp, sm_tx_buf *tx_buff); //thc-sm STATIC void tokSMtx_completion (int unit); //thc-sm STATIC void tokSM_process_recv (int unit); //thc-sm STATIC int tokSM_rxframe (struct tokdevice *device, //thc-sm sm_rx_buf *frame_inic, sm_rx_buf *frame_last, ushort n_bufs_fr); STATIC int tokhwreset(int unit); STATIC void toktimeout(int unit); STATIC unchar tok_num_txbuf(int unit); STATIC ushort tok_num_rxbuf(int unit); STATIC int process_open(int unit); STATIC void issue_close_srb(struct tokdevice *device); STATIC void tokhwfailed(struct tokdevice *device); STATIC void issue_send_srb(struct tokdevice *device); STATIC void process_startio(struct tokdevice *device); STATIC void issue_send_asb(struct tokdevice *device); STATIC void process_modify_open(int unit); STATIC void process_send_error(int unit); STATIC void send_waiting_asb(struct tokdevice *device); STATIC void send_waiting_srb(struct tokdevice *device); STATIC void process_ring_status_change(int unit); int tokcheckaddr(struct tokdevice *device, ulong l); STATIC void process_recv(int unit); STATIC void issue_recv_asb(struct tokdevice *device); STATIC void issue_log_srb(struct tokdevice *device); STATIC void issue_mod_srb(struct tokdevice *device); STATIC void process_read_log(int unit); STATIC char *check_t(struct tok_diag *table, unchar errno); STATIC void tokdiag_retc(int unit, char *desc, int errno); STATIC void tokdiag_openerr(int unit, unchar errno, ushort open_err);//thc-fdx STATIC int tokhwreset(int unit) { struct tokdevice *device = &tokdevice[unit]; struct tokhwconf *hwconf = &tokhwconf[unit]; struct srb_init_status *srb; int j; unchar x; unchar *y; /* * To completely reset the adapter software must ensure at least * 50ms between the RESET and RELEASE (see S.G.12.001.03 page 17) */ outb(TOKEN_RESET(unit), 0); /* reset the adapter */ suspend(50000); outb(TOKEN_RELEASE(unit), 0); /* now release the adapter */ /* enable interrupts */ device->aca->isrp_even_set = 0xc0; /* * wait for init to complete (bit 5 in ISRP odd set) * wait for up to a second */ for (j=1000; j; --j) { if (device->aca->isrp_odd & SRB_RESP) break; suspend(10000); } if (!j) { cmn_err(CE_WARN, "tok%d: Timed out waiting for adapter to initialize", unit); return(0); } if (arch & (AT|EISA)) { unsigned char z; y = device->mmio + 0x1fa0; if ((uint)((*y) & 0x0f) > 0x0c) /* old adapter */ { z = hwconf->rambase >> 12; device->aca->rrr_even = z; x = device->aca->rrr_even; if ( z != x) { cmn_err(CE_WARN,"tok%d: Failed to set RAM base address to 0x%x", unit, hwconf->rambase); return(0); } } else { z = device->aca->rrr_even; hwconf->rambase = (u_int)z << 12; /* MDI002 */ device->aca->rrr_even = z; } } /* Read the RAM size */ j = 1; x = device->aca->rrr_odd & 0x0c; switch (x) { case 0x00: hwconf->ramsz = 8*1024; j = 0; break; case 0x04: hwconf->ramsz = 16*1024; j = device->aca->rrr_even & 0x03; /* MDI003 */ break; case 0x08: hwconf->ramsz = 32*1024; j = device->aca->rrr_even & 0x07; /* MDI003 */ break; case 0x0c: hwconf->ramsz = 64*1024; j = device->aca->rrr_even & 0x0f; /* MDI003 */ /* * There is a hardware failure on some adapters if * 64k RAM is selected. */ cmn_err(CE_WARN, /* MDI003 */ "tok%d: Greater than 32k RAM is not supported for this adapter", unit); return(0); break; } if (j) /* MDI003 */ { cmn_err(CE_WARN, "tok%d: Invalid RAM boundry for %dk: 0x%x", unit, hwconf->ramsz/1024, hwconf->rambase); return(0); } if (!device->sram) { device->sram = sptalloc(btoc(hwconf->ramsz),PG_P,btoc(hwconf->rambase), NOSLEEP); if (!device->sram) { cmn_err(CE_WARN, "tok%d: sptalloc(sram=0x%x) failed", unit, hwconf->rambase); return(0); } } /* Now look at the SRB just returned */ device->srb = device->sram + mdi_ntohs(device->aca->wrb); srb = (struct srb_init_status *)device->srb; if (srb->command != 0x80) { cmn_err(CE_WARN, "tok%d: Reset response(%b) is not SRB_INIT_STATUS(0x80)", unit, srb->command); return(0); } if (srb->bringup_code) { cmn_err(CE_WARN, "tok%d: Initialization failed, code=%x", unit, srb->bringup_code); return(0); } /* verify if hw is fdx capable */ device->fdx_enable = (srb->status2 & 0x08) && tok_fdx [unit]; //thc-fdx /* verify if hw is shallow mode capable */ device->sm_enable = (srb->status & 0x80) && tok_smode [unit]; //thc-sm /* The IBM H/W Tech Ref states that bit 7 of status bit is the ring */ /* speed indicator, it is in fact, bit 0 vvvvvv */ device->ring_speed_save = (srb->status2 & 0x04) ? 1 : 0; device->ring_speed_detector = (srb->status & 0x40) ? 1 : 0; device->ring_speed = (srb->status & 0x01) ? 16000000L:4000000L; device->addr = (struct adapter_address_area *)(device->sram + mdi_ntohs(srb->adapter_address)); device->parms = (struct adapter_parameters_area *)(device->sram + mdi_ntohs(srb->parms_address)); /* Initialize the pre-allocation of tx buffer stuff */ device->tokstartio_going = 0; device->txbufp = (unchar *)0; device->srb_busy = device->asb_busy = 0; /* Initialize the ASB buffers */ bzero(&device->asb_xmt_resp, sizeof(struct asb_xmt_resp)); bzero(&device->asb_rcv_resp, sizeof(struct asb_rcv_resp)); device->asb_xmt_resp.command = 0x0a; /* TRANSMIT.DIR.frame */ device->asb_rcv_resp.command = 0x81; /* RECEIVED.DATA */ device->wait_send_xmt_asb = device->wait_send_rcv_asb = 0; /* Initialize the SRB buffers */ bzero(&device->srb_send, sizeof(struct srb_send)); bzero(&device->srb_close, sizeof(struct srb_close)); bzero(&device->srb_read_log, sizeof(struct srb_read_log)); bzero(&device->srb_set_func_addr, sizeof(struct srb_set_func_addr)); bzero(&device->srb_modify_open, sizeof(struct srb_modify_open)); device->wait_send_xmt_srb = device->wait_send_close_srb = 0; device->wait_send_log_srb = 0; device->wait_send_mod_srb = 0; device->srb_send.command = 0x0a; /* TRANSMIT.DIR.frame */ device->srb_send.retc = 0xfe; device->srb_send.station_id = 0; device->srb_set_func_addr.command = 0x07; /* DIR.SET.FUNC.ADDR */ device->srb_set_func_addr.retc = 0xfe; device->srb_set_func_addr.func_addr = 0xffffffff; device->srb_close.command = 0x04; /* DIR.CLOSE.ADAPTER */ device->srb_close.retc = 0xfe; device->srb_read_log.command = 0x08; /* DIR.READ.LOG */ device->srb_read_log.retc = 0xfe; device->mccnt = 0; /* If tokhwaddr set, display IT */ if (*(ulong *)(tokhwaddr[unit])) { bcopy(tokhwaddr[unit], device->hw_address, 6); } else { /* else build up the hw_address from the AIP */ y = device->mmio+AIP; for (j=0; j< 6; j++) { device->hw_address[j] = (((*y) & 0x0f)<<4) | ((*(y+2)) & 0x0f); y+=4; } } device->aca->isrp_odd_rst = ~SRB_RESP; outb(TOKEN_INTR_REL(unit), 0); /* release TOKEN interrupt */ return(1); } /* * Presence test for IBM Token Ring Network Adapter */ int tokpresent(int unit) { static unchar mca_irq[] = { 9, 3,10,11 }; static unchar isa_irq[2][4] = { { 9, 3, 6, 7 }, { 9, 3, 10, 11 } }; struct tokdevice *device = &tokdevice[unit]; struct tokhwconf *hwconf = &tokhwconf[unit]; void tokintr(int); unchar x, irq; ulong mmio; int dei; /* get adapters I/O base address from Slot and POS regs if MCA */ if (arch & MC) { outb(ADENABLE, CH_SETUP + hwconf->slot - 1); hwconf->iobase = TOKEN_MCA_BASE(inb(POS3)); outb(ADENABLE, 0); } x = inb(TOKEN_SWTCH_RD(unit)); mmio = (x & 0xfc) << 11; if (arch & MC) { unchar setup2; setup2 = inb(TOKEN_SWTCH2_RD(unit)); mmio |= (setup2 & 0x01) << 19; hwconf->rambase = (setup2 & 0xfe) << 12; } else { mmio |= 1 << 19; } if (!(device->mmio = sptalloc(btoc(8192), PG_P, btoc(mmio), NOSLEEP))) { cmn_err(CE_WARN,"tokpresent - sptalloc(mmio=0x%x) failed",mmio); return(0); } if (arch & MC) { irq = mca_irq[x & 0x03]; } else { unchar *y, i; /* old ISA adp ISA adp, Func ID=0xf ISA adp, Func ID=0xe * =========== ==================== ==================== * IRQ 2(9) IRQ 2(9) IRQ 2(9) * IRQ 3 IRQ 3 IRQ 3 * IRQ 6 IRQ 6 IRQ 10 * IRQ 7 IRQ 7 IRQ 11 */ y = device->mmio + 0x1fba; i = ( ((*y) & 0x0f) == 0x0e ) ? 1 : 0; irq = isa_irq[i][x & 0x03]; } if (dei = add_intr_handler(1, irq, tokintr, 5)) { pr_intr_adderr("tok", 1, irq, tokintr, 5, dei); return(0); } hwconf->irq = irq; device->aca = (struct aca *)(device->mmio + ACA); tokirq_to_unit[hwconf->irq] = unit; device->max_pdu = tokframsz[unit]; /* If reset fails then the hardware must not exist */ return (tokhwreset(unit)); } STATIC void toktimeout(int unit) { struct tokdevice *device = &tokdevice[unit]; device->wait_srb_complete=0; device->device_timeout=1; wakeup(&device->srb); } /* modifies open_options */ void tokmodopen(int unit, int options) { struct tokdevice *device = &tokdevice[unit]; struct srb_modify_open *srb_modify_open; srb_modify_open = &device->srb_modify_open; srb_modify_open->open_options = options; srb_modify_open->command = 0x01; if (device->srb_busy) device->wait_send_mod_srb = 1; else issue_mod_srb(device); } /* * The original Token-Ring Network PC Adapter has 8k of shared RAM * The Token-Ring Network PC Adapter II has 16k of shared RAM * The Token-Ring Network Adapter/A has 16k of shared RAM * The Token-Ring Network 16/4 Adapter/A has 64k of shared RAM * The Token-Ring Network 16/4 Adapter has 64k of shared RAM * * Adapter Shared Memory is broken down like this: * * TXBUF_LEN must be 96..2048 % 8 * RXBUF_LEN must be 96..2048 % 8 * * Private Variables: 1496 bytes (or 1416 bytes for newer cards) * 1 x SSB: 20 bytes * 1 x ARB: 28 bytes * 1 x SRB: 28 bytes * 1 x ASB: 12 bytes * SUBTOTAL: 1584 bytes * * 8K RAM 16, 32, 64 * ---------- ---------- * num_txbuf x TXBUF_LEN 2048 bytes 4096 bytes * ========== ========== * TOTAL: 3632 bytes 5680 bytes (6k-464) * ========== ========== * Rest for RXBUF's * 8k RAM 2x2048 7728 * 16k RAM 5x2048 15920 * 32k RAM 13x2048 32304 * 64k RAM 29x2048 65072 * * On 64k cards, 512 kytes are reserved at the top. * * HOWEVER: Testing shows that: * for 32k cards, above 12 buffers fails * for 64k cards, above 26 buffers fails * * Shared RAM paging is not supported by this driver. * These routines are written in anticipation that > 64k may someday be used. */ /* * For RAM sizes below 16k (like 8k) we only use one transmit buffer * otherwise we use two. The value must be either one or two. */ STATIC unchar tok_num_txbuf(int unit) /* MDI002 */ { return(tokhwconf[unit].ramsz < (16*1024) ? 1 : 2); } STATIC ushort tok_num_rxbuf(int unit) /* MDI002 */ { #ifdef RAM_CALCULATED u_int Used; Used = 1584 + (tok_num_txbuf(unit) * TXBUF_LEN); if (tokhwconf[unit].ramsz > (32*1024)) Used += 512; /* Adapter reserved area on 64k cards */ return((tokhwconf[unit].ramsz - Used) / RXBUF_LEN); #else register u_int ramsz = tokhwconf[unit].ramsz; if (ramsz >= (64*1024)) return 26; /* 64k */ if (ramsz >= (32*1024)) return 12; /* 32k */ if (ramsz >= (16*1024)) return 5; /* 16k */ return 2; /* 8k */ #endif } /* * Initiate the opening of the token ring adapter */ int tokhwinit(unit) { //thc-sm struct tokdevice *device = &tokdevice[unit]; if (!tokhwreset(unit)) return(0); if (device->sm_enable) return (tok_SMopen (unit)); //thc-sm else return (tok_normalopen (unit)); //thc-sm } STATIC int tok_SMopen (unit) //thc-sm { struct tokdevice *device; srb_cnf_ext *srb_cnfext; srb_cnf_fp_ram *srb_cnffp; struct srb_open *srb_open; volatile fp_tx_c_area *fp_tx_ca; volatile fp_rx_c_area *fp_rx_ca; ushort tx_ram_size; // #ifdef DEBUG printf ("tok%d: Opening in shallow mode\n", unit); // #endif device = &tokdevice[unit]; /* * Config Extension */ /* build Config Extension SRB */ srb_cnfext = (struct srb_cnf_ext *)device->srb; bzero(srb_cnfext, sizeof(struct srb_cnf_ext)); srb_cnfext->command = 0x20; srb_cnfext->retc = 0x0; srb_cnfext->options_flag = SM_CNF_EXT_OPTIONS; device->wait_srb_complete = 1; device->device_timeout=0; device->timeout_id = timeout(toktimeout, unit, 30*Hz); device->aca->isra_odd_set = SRB_CMD; /* tell card that cmd is avail*/ while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Config Extensions: Device timed out", unit); return(0); } if (device->sm_retc != 0) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - SMopen: Config Extensions failed", unit); return(0); } /* * Config Extension Fast Path Ram */ tx_ram_size = (tokframsz [unit]/SM_TX_BUFDATA_SZ + 2) * SM_TX_BUFFER_SIZE; if (tx_ram_size < tokhwconf [unit].ramsz/2) tx_ram_size = tokhwconf [unit].ramsz/2; tx_ram_size = (tx_ram_size+7)/8; /* build Config Fast Path RAM SRB */ srb_cnffp = (struct srb_cnf_fp_ram *)device->srb; bzero(srb_cnffp, sizeof(struct srb_cnf_fp_ram)); srb_cnffp->command = 0x12; srb_cnffp->retc = 0x00; //thc srb_cnffp->tx_ram_size = mdi_htons (SM_TX_RAM_SIZE); srb_cnffp->tx_ram_size = mdi_htons (tx_ram_size); srb_cnffp->tx_buffer_size = mdi_htons (SM_TX_BUFFER_SIZE); device->wait_srb_complete = 1; device->timeout_id = timeout(toktimeout, unit, 5*Hz); device->aca->isra_odd_set = SRB_CMD; while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Config RAM Extensions: Device timed out", unit); return(0); } if (device->sm_retc != 0) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - SMopen: Config RAM failed", unit); return(0); } /* * Open the adapter */ /* now build SRB Open */ srb_open = (struct srb_open *)device->srb; bzero(srb_open, sizeof(struct srb_open)); srb_open->command = 0x03; srb_open->num_rcv_buff = mdi_htons (tokframsz [unit]/SM_RX_BUFDATA_SZ+1); srb_open->rcv_buf_len = mdi_htons (SM_RX_BUFFER_SIZE); srb_open->dhb_buf_len = mdi_htons (tokframsz [unit]); bcopy(tokhwaddr[unit], srb_open->node_address, 6); if (device->fdx_enable) //thc-fdx srb_open->open_options |= mdi_htons (0x0040); /* enables FDX */ device->wait_srb_complete = 1; device->device_timeout=0; device->timeout_id = timeout(toktimeout, unit, 30*Hz); device->aca->isra_odd_set = SRB_CMD; /* tell card that cmd is avail*/ while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Device timed out while attempting to open", unit); return(0); } /* update shallow mode fields */ fp_tx_ca = device->fp_tx_ca; device->tx_completion_q_head = mdi_ntohs (fp_tx_ca->completion_q_tail); device->tx_buffer_count = mdi_ntohs (fp_tx_ca->buffer_count) - 1; fp_rx_ca = device->fp_rx_ca; device->rx_queue_pointer = mdi_ntohs (fp_rx_ca->posted_q_head); /* * Set Functional Address */ device->wait_srb_complete = 1; bcopy (&device->srb_set_func_addr, device->srb, sizeof(struct srb_set_func_addr)); device->timeout_id = timeout(toktimeout, unit, 5*Hz); device->aca->isra_odd_set = SRB_CMD; while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Device timed out while attempting to set func addr", unit); return(0); } bcopy(tokfuncaddr, device->stats.mac_funcaddr, 6); return(device->arb != 0); } STATIC int process_SMopen_cnf_ext (int unit) //thc-sm { struct tokdevice *device = &tokdevice[unit]; struct srb_cnf_ext_resp *srb_resp; srb_resp = (struct srb_cnf_ext_resp *)device->srb; device->sm_retc = srb_resp->retc; return; } STATIC int process_SMopen_cnf_ram (int unit) //thc-sm { struct tokdevice *device = &tokdevice[unit]; srb_cnf_fp_ram_resp *srb_resp; srb_resp = (struct srb_cnf_fp_ram_resp *)device->srb; device->sm_retc = srb_resp->retc; if (srb_resp->retc == 0) { /* update the fast path transmit and receive controls areas */ device->fp_tx_ca = (struct fp_tx_c_area *)(device->sram + mdi_ntohs (srb_resp->fp_tx_sram)); device->fp_rx_ca = (struct fp_rx_c_area *)(device->sram + mdi_ntohs (srb_resp->fp_rx_sram)); /* update the srb with the next one */ device->srb = device->sram + mdi_ntohs (srb_resp->srb_address); } return; } STATIC int tok_normalopen (unit) //thc-sm { struct tokdevice *device = &tokdevice[unit]; struct tokhwconf *hwconf = &tokhwconf[unit]; struct srb_open *srb_open; struct srb_open_response *srb_resp; /* now build SRB Open */ srb_open = (struct srb_open *)device->srb; bzero(srb_open, sizeof(struct srb_open)); srb_open->command = 0x03; srb_open->num_rcv_buff = mdi_htons((ushort)tok_num_rxbuf(unit)); srb_open->rcv_buf_len = mdi_htons(RXBUF_LEN); srb_open->dhb_buf_len = mdi_htons(TXBUF_LEN); srb_open->num_dhb = tok_num_txbuf(unit); bcopy(tokhwaddr[unit], srb_open->node_address, 6); if (device->fdx_enable) //thc-fdx srb_open->open_options |= mdi_htons (0x0040); /* enables FDX */ device->wait_srb_complete = 1; device->device_timeout=0; device->timeout_id = timeout(toktimeout, unit, 30*Hz); device->aca->isra_odd_set = SRB_CMD; /* tell card that cmd is avail*/ while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Device timed out while attempting to open", unit); return(0); } /* now set functional adress */ device->wait_srb_complete = 1; bcopy (&device->srb_set_func_addr, device->srb, sizeof(struct srb_set_func_addr)); device->timeout_id = timeout(toktimeout, unit, 5*Hz); device->aca->isra_odd_set = SRB_CMD; while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Device timed out while attempting to set func addr", unit); return(0); } bcopy(tokfuncaddr, device->stats.mac_funcaddr, 6); return(device->arb != 0); } STATIC int process_open(int unit) //thc-sm { struct tokdevice *device = &tokdevice[unit]; struct srb_open_response *srb_resp; static unchar retry_open = 0; srb_resp = (struct srb_open_response *)device->srb; #ifdef DEBUG printf ("tok%d: process_open retc = [x%x]\n", unit, srb_resp->retc); #endif if (srb_resp->retc == 0) { /* operation completed successfully */ /* set all addresses */ if (!device->sm_enable) //thc-sm { device->asb = device->sram + mdi_ntohs(srb_resp->asb_address); } if (device->fdx_enable && //thc-fdx ((srb_resp->open_status & OPEN_STATUS_FDX) != 0)) //thc-fdx { device->fdx_opened = TRUE; //thc-fdx } else { device->fdx_opened = FALSE; //thc-fdx } device->srb = device->sram + mdi_ntohs(srb_resp->srb_address); device->arb = device->sram + mdi_ntohs(srb_resp->arb_address); device->ssb = device->sram + mdi_ntohs(srb_resp->ssb_address); retry_open = 0; return(1); } /* an error has occurred */ if ( (srb_resp->retc == 0x7) && (mdi_ntohs(srb_resp->open_error_code) == 0x24) && (device->ring_speed_detector) && (device->ring_speed_save) && (++retry_open == 1) ) /* First open fails, because of frequency error (0x24). * If adapter can detect adapter and ring speed mismatch * and can automatically update the default ring speed, * reset ring speed and retry open. * But only retry once. */ { struct srb_open *srb_open; #ifdef DEBUG printf ("tok%d: process_open recovering freq. error\n", unit); #endif device->ring_speed = (device->ring_speed==16000000L) ? 4000000L : 16000000L; srb_open = (struct srb_open *)device->srb; bzero(srb_open, sizeof(struct srb_open)); srb_open->command = 0x03; if (device->sm_enable) //thc-sm { srb_open->num_rcv_buff = mdi_htons (tokframsz [unit]/SM_RX_BUFDATA_SZ+1); srb_open->rcv_buf_len = mdi_htons (SM_RX_BUFFER_SIZE); srb_open->dhb_buf_len = mdi_htons (tokframsz [unit]); } else { srb_open->num_rcv_buff = mdi_htons((ushort)tok_num_rxbuf(unit)); srb_open->rcv_buf_len = mdi_htons(RXBUF_LEN); srb_open->dhb_buf_len = mdi_htons(TXBUF_LEN); srb_open->num_dhb = tok_num_txbuf(unit); } bcopy(tokhwaddr[unit], srb_open->node_address, 6); if (device->fdx_enable) //thc-fdx srb_open->open_options |= mdi_htons (0x0040); /* enables FDX */ device->aca->isra_odd_set = SRB_CMD; return(0); } if (retry_open > 1) cmn_err(CE_WARN, "tok(unit=%d) - retry open failed", unit); #ifdef DEBUG printf ("tok%d: process_open ERROR = [x%x]\n", unit, mdi_ntohs(srb_resp->open_error_code)); #endif retry_open = 0; tokdiag_openerr(unit, srb_resp->retc, mdi_ntohs(srb_resp->open_error_code)); device->asb = device->arb = device->ssb = 0; return(1); } /* This function will close adapter */ void tokhwhalt(int unit) { struct tokdevice *device = &tokdevice[unit]; int x; device->wait_srb_complete = 1; device->device_timeout=0; device->timeout_id = timeout(toktimeout, unit, 5*Hz); x=splstr(); if (device->srb_busy) device->wait_send_close_srb = 1; else issue_close_srb(device); splx(x); while (device->wait_srb_complete) sleep(&device->srb, PZERO+3); if (device->device_timeout) cmn_err(CE_NOTE, "tokhwhalt(unit=%d) - Device timed out while attempting to close", unit); } STATIC void issue_close_srb(struct tokdevice *device) { if (device->srb_busy) cmn_err(CE_WARN, "tok(issue_close_srb) - SRB is busy"); device->srb_busy = 1; bcopy(&device->srb_close, device->srb, sizeof(struct srb_close)); /* tell card that cmd is avail*/ device->aca->isra_odd_set = SRB_CMD|SRB_FREE_REQ; } /* * This function should be called to signal that the adapter has failed * and is being closed */ STATIC void tokhwfailed(struct tokdevice *device) { mblk_t *mp; int len, j; struct mac_hwfail_ind *hp; unchar *datap; len = device->mccnt*6; mp = allocb(sizeof(struct mac_hwfail_ind) + len, BPRI_HI); if (mp) { hp = (struct mac_hwfail_ind *)(mp->b_rptr); mp->b_datap->db_type = M_PCPROTO; mp->b_wptr += len + sizeof(struct mac_hwfail_ind); hp->mac_primitive = MAC_HWFAIL_IND; hp->mac_mcast_length = len; hp->mac_mcast_offset = sizeof(struct mac_hwfail_ind); datap = mp->b_rptr + sizeof(struct mac_hwfail_ind); for (j=0; jmccnt; ++j) { *((ushort *)(datap)) = 0x00c0; ADDR_TO_LONG(datap) = device->mctbl[j]; datap += 6; } putnext(device->up_queue, mp); } device->mdi_state = MDI_CLOSED; } /* thc-sm * Send a frame to the ring in shallow mode. * it will return FALSE if there isn't enough buffer available. */ int tokSMtx (int unit, mblk_t *mp) //thc-sm { struct tokdevice *device; volatile fp_tx_c_area *fp_tx_ca; ushort len; mblk_t *m, *mp1; ushort frame_len; ushort frag_len; ushort n_buffers_neded; ushort n_buffers_used; ushort free_q_head_offset; sm_tx_buf *free_q_head; ushort next_buff_offset_n; ushort last_buff_offset; sm_tx_buf *tx_buff; mblk_t *mp_aux; device = &tokdevice[unit]; /* * check packet length and if there is enough buffers available. */ frame_len = 0; for (mp_aux = mp; mp_aux; mp_aux = mp_aux->b_cont) { frame_len += (mp_aux->b_wptr - mp_aux->b_rptr); } n_buffers_neded = (frame_len + SM_TX_BUFDATA_SZ - 1)/(SM_TX_BUFDATA_SZ); if (n_buffers_neded > device->tx_buffer_count) { return (FALSE); } fp_tx_ca = device->fp_tx_ca; free_q_head_offset = mdi_ntohs (fp_tx_ca->free_q_head); free_q_head = (struct sm_tx_buf *) (device->sram + free_q_head_offset - SM_OFFSET_TXNEXT); next_buff_offset_n = fp_tx_ca->free_q_head; mp_aux = mp; n_buffers_used = 0; while (mp_aux) { if (fp_tx_ca->free_q_tail == next_buff_offset_n) { // cmn_err(CE_WARN, "tokSMtx(unit=%d) - adapter buffers fail", unit); // freemsg(mp); // return (TRUE); return (FALSE); } last_buff_offset = mdi_ntohs (next_buff_offset_n); tx_buff = (struct sm_tx_buf *) (device->sram + last_buff_offset - SM_OFFSET_TXNEXT); next_buff_offset_n = tx_buff->next_buffer; n_buffers_used++; mp_aux = fill_txbuffer (mp_aux, tx_buff); } freemsg(mp); device->tx_buffer_count += n_buffers_used; tx_buff = free_q_head; free_q_head->retcode = 0xFE; free_q_head->station_id = 0; free_q_head->frame_len = mdi_htons (frame_len); free_q_head->last_buffer = mdi_htons (last_buff_offset); fp_tx_ca->free_q_head = next_buff_offset_n; /* issue the transmit request */ device->aca->isra_odd_set = SM_TX_REQUEST; return (TRUE); } mblk_t *fill_txbuffer (mblk_t *mp, sm_tx_buf *tx_buff) { mblk_t *mp_aux; unchar *p_data; ushort data_len; unchar *p_buff; ushort buff_space; ushort buff_len; p_buff = tx_buff->frame_data; buff_space = SM_TX_BUFDATA_SZ; buff_len =0; for (mp_aux = mp; mp_aux && buff_space > 0; mp_aux = mp_aux->b_cont) { p_data = mp_aux->b_rptr; data_len = mp_aux->b_wptr - p_data; if (data_len > buff_space) { bcopy (p_data, p_buff, buff_space); buff_len += buff_space; mp_aux->b_rptr += buff_space; buff_space = 0; break; } bcopy(p_data, p_buff, data_len); buff_len += data_len; p_buff += data_len; buff_space -= data_len; } tx_buff->buffer_len = mdi_htons (buff_len); return (mp_aux); } STATIC void tokSMtx_completion (int unit) //thc-sm { struct tokdevice *device; volatile fp_tx_c_area *fp_tx_ca; sm_tx_buf *frame_ptr; sm_tx_buf *frame; ushort frame_len; ushort n_buffers_used; queue_t *q; mblk_t *mp; device = &tokdevice[unit]; fp_tx_ca = device->fp_tx_ca; while (device->tx_completion_q_head != mdi_ntohs (fp_tx_ca->completion_q_tail)) { frame_ptr = (struct sm_tx_buf *) (device->sram + device->tx_completion_q_head - SM_OFFSET_TXNEXT); frame = (struct sm_tx_buf *) (device->sram + mdi_ntohs (frame_ptr->next_buffer) - SM_OFFSET_TXNEXT); /* * Calculate the number of buffers used by this frame and release them. * * We assume that for all buffers, except the last, the Buffer.length is * SM_TX_BUFDATA_SZ. */ frame_len = mdi_ntohs (frame->frame_len); n_buffers_used = (frame_len + SM_TX_BUFDATA_SZ - 1)/(SM_TX_BUFDATA_SZ); device->tx_buffer_count += n_buffers_used; device->tx_completion_q_head = mdi_ntohs (frame->last_buffer); fp_tx_ca->free_q_tail = frame->last_buffer; } /* * Verify if there are a message in in the trasnmit queue. * If so send-it using tokSMtx. */ q = WR(device->up_queue); if (mp=getq(q)) { if (!tokSMtx (unit, mp)) putbq (q,mp); } } STATIC void tokSM_process_recv (int unit) //thc-sm { struct tokdevice *device; volatile fp_rx_c_area *fp_rx_ca; sm_rx_buf *frame; sm_rx_buf *frame_inic; sm_rx_buf *last_frame; ushort last_frame_offset; ushort nbufs_posted; ushort nbufs_fr; device = &tokdevice [unit]; fp_rx_ca = device->fp_rx_ca; nbufs_posted = mdi_ntohs (fp_rx_ca->posted_count) - mdi_ntohs (fp_rx_ca->completion_count); while (nbufs_posted > 0) { frame = (struct sm_rx_buf *) (device->sram + device->rx_queue_pointer - SM_OFFSET_RXNEXT); frame_inic = (struct sm_rx_buf *) (device->sram + mdi_ntohs (frame->next_buffer) - SM_OFFSET_RXNEXT); /* find the end of frame */ last_frame = 0; for (nbufs_fr = 1; (nbufs_fr <= nbufs_posted) && (frame->next_buffer != 0); nbufs_fr++) { last_frame_offset = mdi_ntohs (frame->next_buffer); frame = (struct sm_rx_buf *) (device->sram + last_frame_offset - SM_OFFSET_RXNEXT); if (frame->receive_status & SM_RX_STATUS_EOF) { last_frame = frame; break; } } if (last_frame == 0) { #ifdef DEBUG printf ("tok%d: ERROR: end of rx not found\n", unit); printf ("fp_rx_ca: [x%x] - next_buffer: [x%x] - nbufs_fr: [%d]\n", fp_rx_ca, mdi_ntohs (frame->next_buffer), nbufs_fr); printf ("Posted.Count: [x%x] Completion.Count: [x%x] nbufs_posted: [%d]\n", mdi_ntohs (fp_rx_ca->posted_count), mdi_ntohs (fp_rx_ca->completion_count), nbufs_posted); #endif // cmn_err(CE_WARN, "tokSMrx(unit=%d) - end of rx frame not found",unit); break; } tokSM_rxframe (device, frame_inic, last_frame, nbufs_fr); device->rx_queue_pointer = last_frame_offset; fp_rx_ca->completion_count = mdi_htons (mdi_ntohs (fp_rx_ca->completion_count) + nbufs_fr); /* issue the rx buffer complete request */ device->aca->isra_odd_set = SM_RXBUFF_CPLT; /* verify if there more buffers posted. */ nbufs_posted = mdi_ntohs (fp_rx_ca->posted_count) - mdi_ntohs (fp_rx_ca->completion_count); } } STATIC int tokSM_rxframe (struct tokdevice *device, //thc-sm sm_rx_buf *frame_inic, sm_rx_buf *frame_last, ushort nbufs_fr) { mblk_t *mp; sm_rx_buf *frame; int frame_len; int buff_len; int dif_last; int i; frame_len = mdi_ntohs (frame_last->frame_len) - 4; if (frame_len > MAX_PDU) { #ifdef DEBUG printf ("tokSM_rxframe - frame too large\n"); #endif device->stats.mac_badlen++; return (FALSE); } if (frame_len <= 4) //thc?? { #ifdef DEBUG printf ("tokSM_rxframe - frame too small\n"); #endif device->stats.mac_badlen++; return (FALSE); } if (!(mp = allocb(frame_len,BPRI_MED))) { #ifdef DEBUG printf ("tokSM_rxframe - no message block available\n"); #endif device->stats.mac_frame_nosr++; return (FALSE); } buff_len = mdi_ntohs (frame_last->buffer_len); if (buff_len > 4) dif_last = 4; else { nbufs_fr -= 1; dif_last = 4 - buff_len; } frame = frame_inic; for (i = 1; i <= nbufs_fr; i++) { buff_len = mdi_ntohs (frame->buffer_len); if (i == nbufs_fr) //thc?? buff_len -= dif_last; bcopy (frame->frame_data, mp->b_wptr, buff_len); mp->b_wptr += buff_len; frame = (struct sm_rx_buf *) (device->sram + mdi_ntohs (frame->next_buffer) - SM_OFFSET_RXNEXT); } /* * We have a packet from the ring, check the first two bytes of the * destination address to see if it starts with 'C000', if it does * then its possibly a Multi-cast address, perform filtering. */ if (*(mp->b_rptr+2)==0xc0 && *(mp->b_rptr+3)==0x00) { if (!tokcheckaddr(device, ADDR_TO_LONG(mp->b_rptr+2))) { #ifdef DEBUG printf ("tokSM_rxframe - discarding Multicast address\n"); #endif freemsg(mp); return (FALSE); } } if (device->up_queue) putnext(device->up_queue, mp); else { #ifdef DEBUG printf ("tokSM_rxframe - no upperstream queue\n"); #endif freemsg(mp); } return (TRUE); } /* * The driver has a frame to send, so tell the adapter. When the adapter * is ready to send, enable the WR(q) so that toksend_queued will run and that * will call tokhwput to send the frame to the network */ void tokstartio(struct tokdevice *device) { /* Tell the adapter we wish to send something */ if (device->srb_busy) { device->wait_send_xmt_srb = 1; } else { issue_send_srb(device); } } STATIC void issue_send_srb(struct tokdevice *device) { if (device->srb_busy) cmn_err(CE_WARN, "tok(issue_send_srb) - SRB is busy"); device->srb_busy = 1; bcopy(&device->srb_send, device->srb, sizeof(struct srb_send)); /* tell card that cmd is avail*/ device->aca->isra_odd_set = SRB_CMD|SRB_FREE_REQ; } /* Called when the SRB TRANSMIT.DIR.frame command has completed */ STATIC void process_startio(struct tokdevice *device) { struct arb_xmt_cmd *arbp = (struct arb_xmt_cmd *)device->arb; device->txbufp = device->sram + mdi_ntohs(arbp->dhb_address); device->asb_xmt_resp.correlate = arbp->correlate; toksend_queued(WR(device->up_queue)); } /* * Send a frame to the ring. This function actually only queues the transfer * it will return an error (-1) if there is an immediate error. */ void tokhwput(int unit, mblk_t *mp) { struct tokdevice *device = &tokdevice[unit]; unchar *tx_buf; ushort len, tlen; mblk_t *mp1; if (!device->txbufp) { cmn_err(CE_WARN, "tokhwput(unit=%d) - Called with no send buffer", unit); freemsg(mp); return; } tx_buf = device->txbufp; device->txbufp = (unchar *)0; /* We have previously told the adapter we wish to send */ /* something, now we should actually send the data */ tlen = 0; mp1=mp; while (mp1) { len = mp1->b_wptr - mp1->b_rptr; if ((uint)(tlen + len) > (uint)TXBUF_LEN) { device->stats.mac_badlen++; break; } tlen += len; bcopy(mp1->b_rptr, tx_buf, len); tx_buf += len; mp1 = mp1->b_cont; } freemsg(mp); /* Build ASB Command Block */ device->asb_xmt_resp.frame_len = mdi_ntohs(tlen); if (device->asb_busy) { device->wait_send_xmt_asb = 1; } else { issue_send_asb(device); /* Send the ASB now */ } } STATIC void issue_send_asb(struct tokdevice *device) { if (device->asb_busy) cmn_err(CE_WARN, "tok(issue_send_asb) - ASB is busy"); device->asb_busy = 1; bcopy(&device->asb_xmt_resp, device->asb, sizeof(struct asb_xmt_resp)); device->aca->isra_odd_set = NM_ASB_RESP|NM_ASB_FREE_REQ; /* send ASB */ tokstartio(device); /* Preallocate next tx buf */ } STATIC void process_modify_open(int unit) { struct tokdevice *device = &tokdevice[unit]; struct srb_modify_open *srbp = (struct srb_modify_open *)device->srb; if (srbp->retc) tokdiag_retc(unit, "DIR.MODIFY.OPEN.PARMS", srbp->retc); } STATIC void process_send_error(int unit) { struct tokdevice *device = &tokdevice[unit]; struct srb_send *srbp = (struct srb_send *)device->srb; if (srbp->retc = 0xff) return; cmn_err(CE_WARN, "tok(unit=%d) - Send failed, retc=%b",unit,srbp->retc); tokhwfailed(device); } STATIC void send_waiting_asb(struct tokdevice *device) { device->asb_busy = 0; if (device->wait_send_xmt_asb) { device->wait_send_xmt_asb = 0; issue_send_asb(device); } else if (device->wait_send_rcv_asb) { device->wait_send_rcv_asb = 0; issue_recv_asb(device); } } STATIC void send_waiting_srb(struct tokdevice *device) { device->srb_busy = 0; if (device->wait_send_close_srb) { device->wait_send_close_srb = 0; issue_close_srb(device); } else if (device->wait_send_xmt_srb) { device->wait_send_xmt_srb = 0; issue_send_srb(device); } else if (device->wait_send_log_srb) { device->wait_send_log_srb = 0; issue_log_srb(device); } else if (device->wait_send_mod_srb) { device->wait_send_mod_srb = 0; issue_mod_srb(device); } } void tokintr(int lev) { int unit = tokirq_to_unit[lev]; struct tokdevice *device = &tokdevice[unit]; unchar isrp_odd; unchar count; unchar x; if (device->mdi_state == MDI_NOT_PRESENT) { device->stats.mac_spur_intr++; return; } count = 50; isrp_odd = device->aca->isrp_odd; while (--count && isrp_odd) { if (device->sm_enable) //thc-sm { /* shallow mode operation */ if (isrp_odd & SM_RXBUFF_POST) //thc-sm { device->aca->isrp_odd_rst= ~SM_RXBUFF_POST; tokSM_process_recv (unit); } if (isrp_odd & SM_TXCPLT) //thc-sm { device->aca->isrp_odd_rst= ~SM_TXCPLT; tokSMtx_completion (unit); } } else { /* normal mode operation */ if (isrp_odd & NM_ASB_FREE) { device->aca->isrp_odd_rst= ~NM_ASB_FREE; send_waiting_asb(device); } if (isrp_odd & NM_SSB_RESP) { struct ssb_xmt_resp *ssbp; device->aca->isrp_odd_rst= ~NM_SSB_RESP; ssbp = (struct ssb_xmt_resp *)device->ssb; switch (ssbp->retc) { case 0x00: /* Completed sucessfully */ case 0x22: /* Status from remote MAC */ break; default: cmn_err(CE_NOTE, "tokintr(unit=%d) - Send error, code=%b", unit, ssbp->retc); } device->aca->isra_odd_set = NM_SSB_FREE; } } if (isrp_odd & SRB_RESP) /* SRB response */ { device->aca->isrp_odd_rst= ~SRB_RESP; switch (*(device->srb)) { case 0x01: /* DIR.MODIFY.OPEN.PARMS */ process_modify_open(unit); break; case 0x03: /* DIR.OPEN.ADAPTER */ if (process_open(unit) == 0 ) break; /* Fall through */ case 0x04: /* DIR.CLOSE.ADAPTER */ case 0x07: /* DIR.SET.FUNCTIONAL.ADDR */ if (device->wait_srb_complete) { device->wait_srb_complete = 0; untimeout(device->timeout_id); wakeup(&device->srb); } break; case 0x08: process_read_log(unit); break; case 0x0a: /* TRANSMIT.DATA.REQ */ process_send_error(unit); break; case 0x12: /* DIR.CONFIG.FAST.PATH.RAM */ //thc-sm process_SMopen_cnf_ram (unit); if (device->wait_srb_complete) { device->wait_srb_complete = 0; untimeout(device->timeout_id); wakeup(&device->srb); } break; case 0x20: /* DIR.CONFIG.EXTENSIONS */ //thc-sm process_SMopen_cnf_ext (unit); if (device->wait_srb_complete) { device->wait_srb_complete = 0; untimeout(device->timeout_id); wakeup(&device->srb); } break; default: cmn_err(CE_WARN, "tokintr(unit=%d) - Unknown SRB response %b", unit, *(device->srb)); } device->srb_busy = 0; send_waiting_srb(device); } if (isrp_odd & ARB_CMD) /* ARB command */ { device->aca->isrp_odd_rst= ~ARB_CMD; switch (*(device->arb)) { case 0x82: /* TRANSMIT.DATA.REQ */ process_startio(device); break; case 0x85: /* Global broadcast is passed as bridge data */ case 0x81: /* Received Data */ process_recv(unit); break; case 0x84: /* RING.STATUS.CHANGE */ process_ring_status_change(unit); break; default: cmn_err(CE_WARN, "tokintr(unit=%d) - Unknown ARB command 0x%b", unit, *(device->arb)); } device->aca->isra_odd_set = ARB_FREE; } if (!device->sm_enable) //thc-sm { /* normal mode operation */ if (isrp_odd & NM_IMPL_RCV) /* Force IMPL MAC frame */ device->aca->isrp_odd_rst= ~NM_IMPL_RCV; } if (isrp_odd & ADAP_CHK) /* Adapter check */ { cmn_err(CE_WARN, "tokintr(unit=%d) - Adapter Check", unit); tokhwfailed(device); device->aca->isrp_odd_rst= ~ADAP_CHK; return; /* MDI003 */ } /* Adapter error */ if (device->aca->isrp_even & (TIMER_INT|ERROR_INT|ACCESS_INT)) { cmn_err(CE_WARN, "tokintr(unit=%d) - Adapter Failure: 0x%b", unit, device->aca->isrp_even); tokhwfailed(device); device->aca->isrp_even_rst = ~(TIMER_INT|ERROR_INT|ACCESS_INT); return; /* MDI003 */ } isrp_odd = device->aca->isrp_odd; } outb(TOKEN_INTR_REL(unit), 0); /* release interrupt */ if (!count) { cmn_err(CE_WARN, "tokintr(unit=%d) - Fatal interrupt flood", unit); tokhwfailed(device); } } STATIC void process_ring_status_change(int unit) { struct tokdevice *device = &tokdevice[unit]; struct arb_ring_status *arbp = (struct arb_ring_status *)device->arb; ushort old_s = device->stats.mac_ringstatus; ushort new_s = mdi_ntohs(arbp->ring_status); ushort changed = old_s ^ new_s; /* X-OR */ device->stats.mac_ringstatus = new_s; if (changed & RST_RING_RECOVERY) { if (new_s & RST_RING_RECOVERY) device->stats.mac_recoverys++; } if (changed & RST_SINGLE_STATION) { if (new_s & RST_SINGLE_STATION) device->stats.mac_statssingles++; } #ifdef NON_FATAL_MESSAGE /* MDI001 */ if (new_s & RST_COUNTER_OVERFLOW) { cmn_err(CE_WARN, "tok(unit=%d) - Status: Counter overflow", unit); } #endif if (new_s & RST_FDX_ERROR) { //thc-fdx cmn_err(CE_WARN, "tok(unit=%d) - Status: FDX protocol error, adapter closing",unit); //thc-fdx tokhwfailed(device); //thc-fdx } //thc-fdx if (new_s & RST_REMOVE_RECEIVED) { cmn_err(CE_WARN, "tok(unit=%d) - Status: Remove received, adapter closing",unit); tokhwfailed(device); } if (new_s & RST_AUTO_RMV_ERROR) { cmn_err(CE_WARN, "tok(unit=%d) - Status: H/W Error detected", unit); tokhwfailed(device); } if (new_s & RST_LOBE_WIRE_FAULT) { cmn_err(CE_WARN,"tok(unit=%d) - Status: Open/Short circuit in data path",unit); tokhwfailed(device); } if (changed & RST_TRANSMIT_BEACON) { if (new_s & RST_TRANSMIT_BEACON) device->stats.mac_transmitbeacons++; } if (changed & RST_SOFT_ERROR) { if (new_s & RST_SOFT_ERROR) device->stats.mac_softerrors++; } if (changed & RST_HARD_ERROR) { if (new_s & RST_HARD_ERROR) device->stats.mac_harderrors++; } if (changed & RST_SIGNAL_LOSS) { if (new_s & RST_SIGNAL_LOSS) device->stats.mac_signalloss++; } } int tokcheckaddr( struct tokdevice *device, ulong l ) { int i; if (l == 0xffffffff) return(1); for (i=0; imccnt; ++i) { if (device->mctbl[i] == l) { return(1); } } return(0); } STATIC void process_recv(int unit) { struct tokdevice *device = &tokdevice[unit]; struct arb_rcv_data *arbp = (struct arb_rcv_data *)device->arb; struct rcv_buf *rcv_buf; /* Receive Buffer pointer */ mblk_t *mp; ushort x; int i, frame_len; long l; device->asb_rcv_resp.rcv_buf_ptr = arbp->rcv_buf_ptr; x = mdi_ntohs(arbp->rcv_buf_ptr); frame_len = mdi_ntohs(arbp->frame_len); if (frame_len > MAX_PDU) { device->stats.mac_badlen++; if (device->asb_busy) device->wait_send_rcv_asb = 1; else issue_recv_asb(device); return; } if (!(mp = allocb(frame_len,BPRI_MED))) { device->stats.mac_frame_nosr++; if (device->asb_busy) device->wait_send_rcv_asb = 1; else issue_recv_asb(device); return; } while (1) { int j; rcv_buf = (struct rcv_buf *)(device->sram + x); j = mdi_ntohs(rcv_buf->frame_len); bcopy(rcv_buf->data, mp->b_wptr, j); mp->b_wptr += j; if (rcv_buf->rcv_buf_ptr == 0) break; x = mdi_ntohs(rcv_buf->rcv_buf_ptr)-2; } /* We have copied the data from the ARB, now issue the ASB response */ if (device->asb_busy) { device->wait_send_rcv_asb = 1; } else { issue_recv_asb(device); } /* * We have a packet from the ring, check the first two bytes of the * destination address to see if it starts with 'C000', if it does * then its possibly a Multi-cast address, perform filtering. */ if (*(mp->b_rptr+2)==0xc0 && *(mp->b_rptr+3)==0x00) { if (!tokcheckaddr(device, ADDR_TO_LONG(mp->b_rptr+2))) { freemsg(mp); return; } } if (device->up_queue) putnext(device->up_queue, mp); else freemsg(mp); return; } STATIC void issue_recv_asb(struct tokdevice *device) { if (device->asb_busy) cmn_err(CE_WARN, "tok(issue_recv_asb) - ASB is busy"); device->asb_busy = 1; bcopy(&device->asb_rcv_resp, device->asb, sizeof(struct asb_rcv_resp)); device->aca->isra_odd_set = NM_ASB_RESP|NM_ASB_FREE_REQ; /* send ASB */ } STATIC void issue_log_srb(struct tokdevice *device) { if (device->srb_busy) cmn_err(CE_WARN, "tok(issue_log_srb) SRB is busy"); device->srb_busy = 1; bcopy(&device->srb_read_log, device->srb, sizeof(struct srb_read_log)); device->aca->isra_odd_set = SRB_CMD|SRB_FREE_REQ; } STATIC void issue_mod_srb(struct tokdevice *device) { if (device->srb_busy) cmn_err(CE_WARN, "tok(issue_mod_srb) SRB is busy"); device->srb_busy = 1; bcopy(&device->srb_modify_open, device->srb, sizeof(struct srb_modify_open)); device->aca->isra_odd_set = SRB_CMD|SRB_FREE_REQ; } STATIC void process_read_log(int unit) { struct tokdevice *device = &tokdevice[unit]; struct srb_read_log *srbp = (struct srb_read_log *)device->srb; mblk_t *mp = device->iocmp; struct iocblk *iocp; if (mp) iocp = (struct iocblk *)mp->b_rptr; if (srbp->retc) { if (mp) { mp->b_datap->db_type = M_IOCNAK; iocp->ioc_count = 0; } } else { device->stats.mac_lineerrors += srbp->line; device->stats.mac_internalerrors += srbp->internal; device->stats.mac_bursterrors += srbp->burst; device->stats.mac_acerrors += srbp->ac; device->stats.mac_aborttranserrors += srbp->abort; device->stats.mac_lostframeerrors += srbp->lost_frames; device->stats.mac_receivecongestions += srbp->congestion; device->stats.mac_framecopiederrors += srbp->copied; device->stats.mac_frequencyerrors += srbp->freq; device->stats.mac_tokenerrors += srbp->token; if (mp) { mp->b_datap->db_type = M_IOCACK; bcopy(&device->stats, mp->b_cont->b_rptr, sizeof(mac_stats_tr_t)); } } if (mp) { device->iocmp = (mblk_t *)0; putnext(device->up_queue, mp); } } /* * This function issues a DIR.READ.LOG to obtain statistics, and then * returns them in 'mp' */ void tokupdate_stats(int unit, mblk_t *mp) { struct tokdevice *device = &tokdevice[unit]; device->iocmp = mp; ADDR_TO_LONG(device->stats.mac_funcaddr) = device->addr->func_addr; bcopy(device->parms->up_node_addr, device->stats.mac_upstream, 6); if (device->srb_busy) device->wait_send_log_srb = 1; else issue_log_srb(device); } static struct tok_diag retc_t[] = { { 0x00, "Operation completed OK (no error)" }, { 0x01, "Invalid command code" }, { 0x03, "Adapter should be closed, but isn't" }, { 0x04, "Adapter should be open, but isn't" }, { 0x07, "Command canceled, unrecoverable failure" }, { 0x09, "Adapter not initialized" }, { 0x0B, "Adapter closed while in use" }, { 0x0C, "Command completed, adapter is now closed" }, { 0x11, "Lobe failure, check connection between host and ring" }, { 0x19, "Insufficient buffers for request" }, { 0x20, "Dropped data on receipt, no buffers" }, { 0x21, "Dropped data on receipt, no buffer space" }, { 0x22, "Error detected during a receive" }, { 0x25, "Maximum commands exceeded" }, { 0x26, "Unrecognised command correlator" }, { 0x27, "Link not transmitting I-frames" }, { 0x28, "Invalid transmit frame length" }, { 0x30, "Not enough receive buffers for adapter to open" }, { 0x32, "Invalid NODE address" }, { 0x33, "Invalid adapter receive buffer length defined" }, { 0x34, "Invalid adapter transmit buffer length defined" }, { 0x40, "Invalid station ID" }, { 0x43, "Invalid SAP / SAP in use" }, { 0x44, "Invalid routing field length" }, { 0x46, "Inadequate link stations" }, { 0x47, "SAP cannot close until all SAP's stations are closed" }, { 0x5A, "Cannot initialize adapter" }, { -1, 0 } }; static struct tok_diag open_t[] = { { 0x0f, "FDX Protocol Error" }, //thc-fdx { 0x24, "Frequency error, adapter does not match ring speed" }, { 0x26, "Ring failure, try again or contact system admin" }, { 0x27, "Wrong data rate / claim token failure" }, { 0x2A, "Ring connect timeout - try again in about 10 minutes" }, { 0x2D, "No ring monitor detected" }, { 0x38, "Duplicate node address" }, { 0x42, "Signal loss, ring failure" }, { -1, 0 } }; STATIC char * check_t(struct tok_diag *table, unchar errno) { static char unknown[]="Error 0xXX is unknown"; static char atox[] = "0123456789abcdef"; for (; table->i != -1; table++) if (table->i == errno) return (table->s); table = retc_t; for (; table->i != -1; table++) if (table->i == errno) return (table->s); unknown[8] = atox[errno >> 4]; unknown[9] = atox[errno & 0xf]; return (unknown); } STATIC void tokdiag_retc(int unit, char *desc, int errno) { cmn_err(CE_WARN, "tok(unit=%d) - %s failed:", unit, desc); cmn_err(CE_WARN, "\t\"%s\"", check_t(retc_t, (unchar)errno)); } STATIC void tokdiag_openerr(int unit, unchar errno, ushort open_err) //thc-fdx { cmn_err(CE_WARN, "tok(unit=%d) - Adapter open failed:", unit); if (errno == 0x07) { if (((unchar)open_err & 0x0f) == 0x0f) //thc-fdx cmn_err(CE_WARN, "\t\"%s\"", check_t(open_t, 0x0f)); //thc-fdx else //thc-fdx cmn_err(CE_WARN, "\t\"%s\"", check_t(open_t, (unchar)open_err)); } else cmn_err(CE_WARN, "\t\"%s\"", check_t(retc_t, (unchar)errno)); } 070701000238ac000081a400000000000000030000000135aefc960000ae9000001dff0000000100000000000000000000003000000000root/usr/src/O5hdk/net/drv/mdi/tok/tokmac.c.aux#pragma comment(exestr, "@(#) tokmac.c.aux 63.1 97/04/08 ") /* * Copyright (C) The Santa Cruz Operation, 1993-1997. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include #include #include #include #include #include #include #include #include #include "tok.h" struct tok_diag { char i; char *s; }; extern struct tokdevice tokdevice[]; extern struct tokhwconf tokhwconf[]; extern unchar tokhwaddr[][6]; extern ulong tokframsz[]; extern int tok_fdx []; //thc-fdx extern int tok_smode []; //thc-sm extern unchar *sptalloc(int,int,int,int); STATIC unchar tokirq_to_unit[20]; /* IRQ->Unit number map */ STATIC unchar tokfuncaddr[] = { 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff }; STATIC int tok_SMopen (unit); //thc-sm STATIC int process_SMopen_cnf_ext (int unit); //thc-sm STATIC int process_SMopen_cnf_ram (int unit); //thc-sm STATIC int tok_normalopen (unit); //thc-sm STATIC int tokhwreset(int unit); STATIC void toktimeout(int unit); STATIC unchar tok_num_txbuf(int unit); STATIC ushort tok_num_rxbuf(int unit); STATIC int process_open(int unit); STATIC void issue_close_srb(struct tokdevice *device); STATIC void tokhwfailed(struct tokdevice *device); STATIC void issue_send_srb(struct tokdevice *device); STATIC void process_startio(struct tokdevice *device); STATIC void issue_send_asb(struct tokdevice *device); STATIC void process_modify_open(int unit); STATIC void process_send_error(int unit); STATIC void send_waiting_asb(struct tokdevice *device); STATIC void send_waiting_srb(struct tokdevice *device); STATIC void process_ring_status_change(int unit); STATIC int tokcheckaddr(struct tokdevice *device, ulong l); STATIC void process_recv(int unit); STATIC void issue_recv_asb(struct tokdevice *device); STATIC void issue_log_srb(struct tokdevice *device); STATIC void issue_mod_srb(struct tokdevice *device); STATIC void process_read_log(int unit); STATIC char *check_t(struct tok_diag *table, unchar errno); STATIC void tokdiag_retc(int unit, char *desc, int errno); STATIC void tokdiag_openerr(int unit, unchar errno, ushort open_err);//thc-fdx STATIC int tokhwreset(int unit) { struct tokdevice *device = &tokdevice[unit]; struct tokhwconf *hwconf = &tokhwconf[unit]; struct srb_init_status *srb; int j; unchar x; unchar *y; /* * To completely reset the adapter software must ensure at least * 50ms between the RESET and RELEASE (see S.G.12.001.03 page 17) */ outb(TOKEN_RESET(unit), 0); /* reset the adapter */ suspend(50000); outb(TOKEN_RELEASE(unit), 0); /* now release the adapter */ /* enable interrupts */ device->aca->isrp_even_set = 0xc0; /* * wait for init to complete (bit 5 in ISRP odd set) * wait for up to a second */ for (j=1000; j; --j) { if (device->aca->isrp_odd & SRB_RESP) break; suspend(10000); } if (!j) { cmn_err(CE_WARN, "tok%d: Timed out waiting for adapter to initialize", unit); return(0); } if (arch & (AT|EISA)) { unsigned char z; y = device->mmio + 0x1fa0; if ((uint)((*y) & 0x0f) > 0x0c) /* old adapter */ { z = hwconf->rambase >> 12; device->aca->rrr_even = z; x = device->aca->rrr_even; if ( z != x) { cmn_err(CE_WARN,"tok%d: Failed to set RAM base address to 0x%x", unit, hwconf->rambase); return(0); } } else { z = device->aca->rrr_even; hwconf->rambase = (u_int)z << 12; /* MDI002 */ device->aca->rrr_even = z; } } /* Read the RAM size */ j = 1; x = device->aca->rrr_odd & 0x0c; switch (x) { case 0x00: hwconf->ramsz = 8*1024; j = 0; break; case 0x04: hwconf->ramsz = 16*1024; j = device->aca->rrr_even & 0x03; /* MDI003 */ break; case 0x08: hwconf->ramsz = 32*1024; j = device->aca->rrr_even & 0x07; /* MDI003 */ break; case 0x0c: hwconf->ramsz = 64*1024; j = device->aca->rrr_even & 0x0f; /* MDI003 */ /* * There is a hardware failure on some adapters if * 64k RAM is selected. */ cmn_err(CE_WARN, /* MDI003 */ "tok%d: Greater than 32k RAM is not supported for this adapter", unit); return(0); break; } if (j) /* MDI003 */ { cmn_err(CE_WARN, "tok%d: Invalid RAM boundry for %dk: 0x%x", unit, hwconf->ramsz/1024, hwconf->rambase); return(0); } if (!device->sram) { device->sram = sptalloc(btoc(hwconf->ramsz),PG_P,btoc(hwconf->rambase), NOSLEEP); if (!device->sram) { cmn_err(CE_WARN, "tok%d: sptalloc(sram=0x%x) failed", unit, hwconf->rambase); return(0); } } /* Now look at the SRB just returned */ device->srb = device->sram + mdi_ntohs(device->aca->wrb); srb = (struct srb_init_status *)device->srb; if (srb->command != 0x80) { cmn_err(CE_WARN, "tok%d: Reset response(%b) is not SRB_INIT_STATUS(0x80)", unit, srb->command); return(0); } if (srb->bringup_code) { cmn_err(CE_WARN, "tok%d: Initialization failed, code=%x", unit, srb->bringup_code); return(0); } /* verify if hw is fdx capable */ device->fdx_enable = (srb->status2 & 0x08) && tok_fdx [unit]; //thc-fdx /* verify if hw is shallow mode capable */ device->sm_enable = (srb->status1 & 0x80) && tok_smode [unit]; //thc-sm /* The IBM H/W Tech Ref states that bit 7 of status bit is the ring */ /* speed indicator, it is in fact, bit 0 vvvvvv */ device->ring_speed_save = (srb->status2 & 0x04) ? 1 : 0; device->ring_speed_detector = (srb->status & 0x40) ? 1 : 0; device->ring_speed = (srb->status & 0x01) ? 16000000L:4000000L; device->addr = (struct adapter_address_area *)(device->sram + mdi_ntohs(srb->adapter_address)); device->parms = (struct adapter_parameters_area *)(device->sram + mdi_ntohs(srb->parms_address)); /* Initialize the pre-allocation of tx buffer stuff */ device->tokstartio_going = 0; device->txbufp = (unchar *)0; device->srb_busy = device->asb_busy = 0; /* Initialize the ASB buffers */ bzero(&device->asb_xmt_resp, sizeof(struct asb_xmt_resp)); bzero(&device->asb_rcv_resp, sizeof(struct asb_rcv_resp)); device->asb_xmt_resp.command = 0x0a; /* TRANSMIT.DIR.frame */ device->asb_rcv_resp.command = 0x81; /* RECEIVED.DATA */ device->wait_send_xmt_asb = device->wait_send_rcv_asb = 0; /* Initialize the SRB buffers */ bzero(&device->srb_send, sizeof(struct srb_send)); bzero(&device->srb_close, sizeof(struct srb_close)); bzero(&device->srb_read_log, sizeof(struct srb_read_log)); bzero(&device->srb_set_func_addr, sizeof(struct srb_set_func_addr)); bzero(&device->srb_modify_open, sizeof(struct srb_modify_open)); device->wait_send_xmt_srb = device->wait_send_close_srb = 0; device->wait_send_log_srb = 0; device->wait_send_mod_srb = 0; device->srb_send.command = 0x0a; /* TRANSMIT.DIR.frame */ device->srb_send.retc = 0xfe; device->srb_send.station_id = 0; device->srb_set_func_addr.command = 0x07; /* DIR.SET.FUNC.ADDR */ device->srb_set_func_addr.retc = 0xfe; device->srb_set_func_addr.func_addr = 0xffffffff; device->srb_close.command = 0x04; /* DIR.CLOSE.ADAPTER */ device->srb_close.retc = 0xfe; device->srb_read_log.command = 0x08; /* DIR.READ.LOG */ device->srb_read_log.retc = 0xfe; device->mccnt = 0; /* If tokhwaddr set, display IT */ if (*(ulong *)(tokhwaddr[unit])) { bcopy(tokhwaddr[unit], device->hw_address, 6); } else { /* else build up the hw_address from the AIP */ y = device->mmio+AIP; for (j=0; j< 6; j++) { device->hw_address[j] = (((*y) & 0x0f)<<4) | ((*(y+2)) & 0x0f); y+=4; } } device->aca->isrp_odd_rst = ~SRB_RESP; outb(TOKEN_INTR_REL(unit), 0); /* release TOKEN interrupt */ return(1); } /* * Presence test for IBM Token Ring Network Adapter */ int tokpresent(int unit) { static unchar mca_irq[] = { 9, 3,10,11 }; static unchar isa_irq[2][4] = { { 9, 3, 6, 7 }, { 9, 3, 10, 11 } }; struct tokdevice *device = &tokdevice[unit]; struct tokhwconf *hwconf = &tokhwconf[unit]; void tokintr(int); unchar x, irq; ulong mmio; int dei; /* get adapters I/O base address from Slot and POS regs if MCA */ if (arch & MC) { outb(ADENABLE, CH_SETUP + hwconf->slot - 1); hwconf->iobase = TOKEN_MCA_BASE(inb(POS3)); outb(ADENABLE, 0); } x = inb(TOKEN_SWTCH_RD(unit)); mmio = (x & 0xfc) << 11; if (arch & MC) { unchar setup2; setup2 = inb(TOKEN_SWTCH2_RD(unit)); mmio |= (setup2 & 0x01) << 19; hwconf->rambase = (setup2 & 0xfe) << 12; } else { mmio |= 1 << 19; } if (!(device->mmio = sptalloc(btoc(8192), PG_P, btoc(mmio), NOSLEEP))) { cmn_err(CE_WARN,"tokpresent - sptalloc(mmio=0x%x) failed",mmio); return(0); } if (arch & MC) { irq = mca_irq[x & 0x03]; } else { unchar *y, i; /* old ISA adp ISA adp, Func ID=0xf ISA adp, Func ID=0xe * =========== ==================== ==================== * IRQ 2(9) IRQ 2(9) IRQ 2(9) * IRQ 3 IRQ 3 IRQ 3 * IRQ 6 IRQ 6 IRQ 10 * IRQ 7 IRQ 7 IRQ 11 */ y = device->mmio + 0x1fba; i = ( ((*y) & 0x0f) == 0x0e ) ? 1 : 0; irq = isa_irq[i][x & 0x03]; } if (dei = add_intr_handler(1, irq, tokintr, 5)) { pr_intr_adderr("tok", 1, irq, tokintr, 5, dei); return(0); } hwconf->irq = irq; device->aca = (struct aca *)(device->mmio + ACA); tokirq_to_unit[hwconf->irq] = unit; device->max_pdu = tokframsz[unit]; /* If reset fails then the hardware must not exist */ return (tokhwreset(unit)); } STATIC void toktimeout(int unit) { struct tokdevice *device = &tokdevice[unit]; device->wait_srb_complete=0; device->device_timeout=1; wakeup(&device->srb); } /* modifies open_options */ void tokmodopen(int unit, int options) { struct tokdevice *device = &tokdevice[unit]; struct srb_modify_open *srb_modify_open; srb_modify_open = &device->srb_modify_open; srb_modify_open->open_options = options; srb_modify_open->command = 0x01; if (device->srb_busy) device->wait_send_mod_srb = 1; else issue_mod_srb(device); } /* * The original Token-Ring Network PC Adapter has 8k of shared RAM * The Token-Ring Network PC Adapter II has 16k of shared RAM * The Token-Ring Network Adapter/A has 16k of shared RAM * The Token-Ring Network 16/4 Adapter/A has 64k of shared RAM * The Token-Ring Network 16/4 Adapter has 64k of shared RAM * * Adapter Shared Memory is broken down like this: * * TXBUF_LEN must be 96..2048 % 8 * RXBUF_LEN must be 96..2048 % 8 * * Private Variables: 1496 bytes (or 1416 bytes for newer cards) * 1 x SSB: 20 bytes * 1 x ARB: 28 bytes * 1 x SRB: 28 bytes * 1 x ASB: 12 bytes * SUBTOTAL: 1584 bytes * * 8K RAM 16, 32, 64 * ---------- ---------- * num_txbuf x TXBUF_LEN 2048 bytes 4096 bytes * ========== ========== * TOTAL: 3632 bytes 5680 bytes (6k-464) * ========== ========== * Rest for RXBUF's * 8k RAM 2x2048 7728 * 16k RAM 5x2048 15920 * 32k RAM 13x2048 32304 * 64k RAM 29x2048 65072 * * On 64k cards, 512 kytes are reserved at the top. * * HOWEVER: Testing shows that: * for 32k cards, above 12 buffers fails * for 64k cards, above 26 buffers fails * * Shared RAM paging is not supported by this driver. * These routines are written in anticipation that > 64k may someday be used. */ /* * For RAM sizes below 16k (like 8k) we only use one transmit buffer * otherwise we use two. The value must be either one or two. */ STATIC unchar tok_num_txbuf(int unit) /* MDI002 */ { return(tokhwconf[unit].ramsz < (16*1024) ? 1 : 2); } STATIC ushort tok_num_rxbuf(int unit) /* MDI002 */ { #ifdef RAM_CALCULATED u_int Used; Used = 1584 + (tok_num_txbuf(unit) * TXBUF_LEN); if (tokhwconf[unit].ramsz > (32*1024)) Used += 512; /* Adapter reserved area on 64k cards */ return((tokhwconf[unit].ramsz - Used) / RXBUF_LEN); #else register u_int ramsz = tokhwconf[unit].ramsz; if (ramsz >= (64*1024)) return 26; /* 64k */ if (ramsz >= (32*1024)) return 12; /* 32k */ if (ramsz >= (16*1024)) return 5; /* 16k */ return 2; /* 8k */ #endif } /* * Initiate the opening of the token ring adapter */ int tokhwinit(unit) { //thc-sm struct tokdevice *device = &tokdevice[unit]; if (!tokhwreset(unit)) return(0); if (device->sm_enable) return (tok_SMopen (unit)); //thc-sm else return (tok_normalopen (unit)); //thc-sm } STATIC int tok_SMopen (unit) //thc-sm { struct tokdevice *device; struct srb_cnf_ext *srb_cnfext; struct srb_cnf_fp_ram *srb_cnffp; struct srb_open *srb_open; struct fp_tx_c_area *fp_tx_ca; struct fp_rx_c_area *fp_rx_ca; device = &tokdevice[unit]; /* * Config Extension */ /* build Config Extension SRB */ srb_cnfext = (struct srb_cnf_ext *)device->srb; bzero(srb_cnfext, sizeof(struct srb_cnf_ext)); srb_cnfext->command = 0x20; srb_cnfext->ret_code = 0x0; srb_cnfext->options_flag = SM_CNF_EXT_OPTIONS; device->wait_srb_complete = 1; device->device_timeout=0; device->timeout_id = timeout(toktimeout, unit, 30*Hz); device->aca->isra_odd_set = SRB_CMD; /* tell card that cmd is avail*/ while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->retc != 0) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - SMopen: Config Extensions failed", unit); return(0); } /* * Config Extension Fast Path Ram */ /* build Config Fast Path RAM SRB */ srb_cnffp = (struct srb_cnf_fp_ram *)device->srb; bzero(srb_cnffp, sizeof(struct srb_cnf_fp_ram)); srb_cnfpp->command = 0x12; srb_cnfpp->ret_code = 0x0; srb_cnfpp->tx_ram_size = mdi_htons (SM_TX_RAM_SIZE); srb_cnfpp->tx_buffer_size = mdi_htons (SM_TX_BUFFER_SIZE); device->wait_srb_complete = 1; device->timeout_id = timeout(toktimeout, unit, 5*Hz); device->aca->isra_odd_set = SRB_CMD; while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->retc != 0) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - SMopen: Config RAM failed", unit); return(0); } /* * Open the adapter */ /* now build SRB Open */ srb_open = (struct srb_open *)device->srb; bzero(srb_open, sizeof(struct srb_open)); srb_open->command = 0x03; bcopy(tokhwaddr[unit], srb_open->node_address, 6); if (device->fdx_enable) //thc-fdx srb_open->open_options |= 0x0040; /* enables FDX */ //thc-fdx srb_open->num_rcv_buff = mdi_htons (tokframsz [unit]/SM_RCV_BUFFER_LEN); srb_open->rcv_buf_len = mdi_htons (SM_RCV_BUFFER_LEN); srb_open->dhb_buf_len = mdi_htons (tokframsz [unit]); device->wait_srb_complete = 1; device->device_timeout=0; device->timeout_id = timeout(toktimeout, unit, 30*Hz); device->aca->isra_odd_set = SRB_CMD; /* tell card that cmd is avail*/ while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Device timed out while attempting to open", unit); return(0); } /* update shallow mode fields */ fp_tx_ca = device->fp_tx_ca; device->tx_completion_q_head = mdi_ntohs (fp_tx_ca->completion_q_tail); device->tx_buffer_count = mdi_ntohs (fp_tx_ca->buffer_count) - 1; fp_rx_ca = device->fp_rx_ca; device->rx_queue_pointer = device->sram + mdi_ntohs (fp_rx_ca->posted_q_head); /* * Set Functional Address */ device->wait_srb_complete = 1; bcopy (&device->srb_set_func_addr, device->srb, sizeof(struct srb_set_func_addr)); device->timeout_id = timeout(toktimeout, unit, 5*Hz); device->aca->isra_odd_set = SRB_CMD; while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Device timed out while attempting to set func addr", unit); return(0); } bcopy(tokfuncaddr, device->stats.mac_funcaddr, 6); return(device->arb != 0); } STATIC int process_SMopen_cnf_ext (int unit) //thc-sm { struct tokdevice *device = &tokdevice[unit]; struct srb_cnf_ext_resp *srb_resp; srb_resp = (struct srb_cnf_ext_resp *)device->srb; device->retc = srb_resp->retc; return; } STATIC int process_SMopen_cnf_ram (int unit) //thc-sm { struct tokdevice *device = &tokdevice[unit]; struct srb_cnf_fp_ram_resp *srb_resp; srb_resp = (struct srb_cnf_fp_ram_resp *)device->srb; device->retc = srb_resp->retc; if (srb_resp->retc == 0) { /* update the fast path transmit and receive controls areas */ device->fp_tx_ca = (struct fp_tx_c_area *)(device->sram + mdi_ntohs (srb_resp->fp_tx_sram)); device->fp_rx_ca = (struct fp_rx_c_area *)(device->sram + mdi_ntohs (srb_resp->fp_rx_sram)); /* update the srb with the next one */ device->srb = device->sram + mdi_ntohs (srb_resp->srb_address)); } return; } STATIC int tok_normalopen (unit) //thc-sm { struct tokdevice *device = &tokdevice[unit]; struct tokhwconf *hwconf = &tokhwconf[unit]; struct srb_open *srb_open; struct srb_open_response *srb_resp; /* now build SRB Open */ srb_open = (struct srb_open *)device->srb; bzero(srb_open, sizeof(struct srb_open)); srb_open->command = 0x03; srb_open->num_rcv_buff = mdi_htons((ushort)tok_num_rxbuf(unit)); srb_open->rcv_buf_len = mdi_htons(RXBUF_LEN); srb_open->dhb_buf_len = mdi_htons(TXBUF_LEN); srb_open->num_dhb = tok_num_txbuf(unit); bcopy(tokhwaddr[unit], srb_open->node_address, 6); if (device->fdx_enable) //thc-fdx srb_open->open_options |= 0x0040; /* enables FDX */ //thc-fdx device->wait_srb_complete = 1; device->device_timeout=0; device->timeout_id = timeout(toktimeout, unit, 30*Hz); device->aca->isra_odd_set = SRB_CMD; /* tell card that cmd is avail*/ while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Device timed out while attempting to open", unit); return(0); } /* now set functional adress */ device->wait_srb_complete = 1; bcopy (&device->srb_set_func_addr, device->srb, sizeof(struct srb_set_func_addr)); device->timeout_id = timeout(toktimeout, unit, 5*Hz); device->aca->isra_odd_set = SRB_CMD; while (device->wait_srb_complete) sleep(&device->srb, PZERO+3 | PCATCH); if (device->device_timeout) { cmn_err (CE_WARN, "tokhwinit(unit=%d) - Device timed out while attempting to set func addr", unit); return(0); } bcopy(tokfuncaddr, device->stats.mac_funcaddr, 6); return(device->arb != 0); } STATIC int process_open(int unit) //thc-sm { struct tokdevice *device = &tokdevice[unit]; struct srb_open_response *srb_resp; static unchar retry_open = 0; srb_resp = (struct srb_open_response *)device->srb; if (srb_resp->retc == 0) { /* operation completed successfully */ /* set all addresses */ if (!device->sm_enable) //thc-sm device->asb = device->sram + mdi_ntohs(srb_resp->asb_address); device->srb = device->sram + mdi_ntohs(srb_resp->srb_address); device->arb = device->sram + mdi_ntohs(srb_resp->arb_address); device->ssb = device->sram + mdi_ntohs(srb_resp->ssb_address); retry_open = 0; return(1); } /* an error has occurred */ if ( (srb_resp->retc == 0x7) && (mdi_ntohs(srb_resp->open_error_code) == 0x24) && (device->ring_speed_detector) && (device->ring_speed_save) && (++retry_open == 1) ) /* First open fails, because of frequency error (0x24). * If adapter can detect adapter and ring speed mismatch * and can automatically update the default ring speed, * reset ring speed and retry open. * But only retry once. */ { struct srb_open *srb_open; device->ring_speed = (device->ring_speed==16000000L) ? 4000000L : 16000000L; srb_open = (struct srb_open *)device->srb; bzero(srb_open, sizeof(struct srb_open)); srb_open->command = 0x03; srb_open->num_rcv_buff = mdi_htons((ushort)tok_num_rxbuf(unit)); srb_open->rcv_buf_len = mdi_htons(RXBUF_LEN); srb_open->dhb_buf_len = mdi_htons(TXBUF_LEN); srb_open->num_dhb = tok_num_txbuf(unit); bcopy(tokhwaddr[unit], srb_open->node_address, 6); device->aca->isra_odd_set = SRB_CMD; return(0); } if (retry_open > 1) cmn_err(CE_WARN, "tok(unit=%d) - retry open failed", unit); retry_open = 0; tokdiag_openerr(unit, srb_resp->retc, mdi_ntohs(srb_resp->open_error_code)); device->asb = device->arb = device->ssb = 0; return(1); } /* This function will close adapter */ void tokhwhalt(int unit) { struct tokdevice *device = &tokdevice[unit]; int x; device->wait_srb_complete = 1; device->device_timeout=0; device->timeout_id = timeout(toktimeout, unit, 5*Hz); x=splstr(); if (device->srb_busy) device->wait_send_close_srb = 1; else issue_close_srb(device); splx(x); while (device->wait_srb_complete) sleep(&device->srb, PZERO+3); if (device->device_timeout) cmn_err(CE_NOTE, "tokhwhalt(unit=%d) - Device timed out while attempting to close", unit); } STATIC void issue_close_srb(struct tokdevice *device) { if (device->srb_busy) cmn_err(CE_WARN, "tok(issue_close_srb) - SRB is busy"); device->srb_busy = 1; bcopy(&device->srb_close, device->srb, sizeof(struct srb_close)); /* tell card that cmd is avail*/ device->aca->isra_odd_set = SRB_CMD|SRB_FREE_REQ; } /* * This function should be called to signal that the adapter has failed * and is being closed */ STATIC void tokhwfailed(struct tokdevice *device) { mblk_t *mp; int len, j; struct mac_hwfail_ind *hp; unchar *datap; len = device->mccnt*6; mp = allocb(sizeof(struct mac_hwfail_ind) + len, BPRI_HI); if (mp) { hp = (struct mac_hwfail_ind *)(mp->b_rptr); mp->b_datap->db_type = M_PCPROTO; mp->b_wptr += len + sizeof(struct mac_hwfail_ind); hp->mac_primitive = MAC_HWFAIL_IND; hp->mac_mcast_length = len; hp->mac_mcast_offset = sizeof(struct mac_hwfail_ind); datap = mp->b_rptr + sizeof(struct mac_hwfail_ind); for (j=0; jmccnt; ++j) { *((ushort *)(datap)) = 0x00c0; ADDR_TO_LONG(datap) = device->mctbl[j]; datap += 6; } putnext(device->up_queue, mp); } device->mdi_state = MDI_CLOSED; } /* thc-sm * Send a frame to the ring in shallow mode. * it will return an error (-1) if there is an immediate error. */ int tokSMtx (int unit, mblk_t *mp) //thc-sm { unchar *tx_buf; -=-=-=-= struct tokdevice *device; int i; ushort len; mblk_t *m, *mp1; ushort frame_len; ushort frag_len; ushort n_buffers_neded; fp_tx_c_area *fp_tx_ca; ushort free_q_head_offset; sm_tx_buf *free_q_head; ushort next_buff_offset; ushort last_buff_offset; sm_tx_buf *tx_buff; ushort buff_length; mblk_t *mp_aux; uchar *p_data; device = &tokdevice[unit]; if (!device->txbufp) { // cmn_err(CE_WARN, "tokSMtx(unit=%d) - Called with null msg data", unit); freemsg(mp); return (true); } /* * check packet length and if there is enough buffers available. */ frame_len = 0; for (mp_aux = mp; mp_aux; mp_aux = mp_aux->b_cont) { frame_len += (mp_aux->b_wptr - mp_aux->b_rptr); } n_buffers_neded = frame_len/(SM_TX_BUFDATA_SZ); if (n_buffers_neded < device->tx_buffer_count) { return (false); } fp_tx_ca = device->fp_tx_ca; free_q_head_offset = mdi_ntohs (fp_tx_ca->free_q_head); free_q_head = (struct sm_tx_buf *) (device->sram + free_q_head_offset - SM_OFFSET_TXNEXT); next_buff_offset = free_q_head_offset; for (mp_aux = mp; mp_aux; mp_aux = mp_aux->b_cont) { last_buff_offset = next_buff_offset; tx_buff = (struct sm_tx_buf *) (device->sram + last_buff_offset - SM_OFFSET_TXNEXT); next_buff_offset = mdi_ntohs (tx_buff->next_buffer); pdata = mp_aux->b_rptr; buff_length = mp_aux->b_wptr - pdata; while (buff_length > SM_TX_BUFDATA_SZ) { bcopy(pdata, tx_buff->frame_data, SM_TX_BUFDATA_SZ)); tx_buff->buffer_len = mdi_htons (SM_TX_BUFDATA_SZ); tx_buff = (struct sm_tx_buf *) (device->sram + mdi_ntohs (tx_buff->next_buffer) - SM_OFFSET_TXNEXT); buff_length -= SM_TX_BUFDATA_SZ; } bcopy(pdata, tx_buff->frame_data, buff_length)); tx_buff->buffer_len = mdi_htons (buff_length); } freemsg(mp); tx_buff = free_q_head; free_q_head->retcode = 0xFE; free_q_head->station_id = 0; free_q_head->frame_len = mdi_htons (frame_len); free_q_head->last_buffer = mdi_htons (last_buff_offset); fp_tx_ca->free_q_head = mdi_htons (next_buff_offset); /* issue the transmit request */ device->aca->isra_odd_set = SM_TX_REQUEST; /* We have previously told the adapter we wish to send */ /* something, now we should actually send the data */ frame_len = 0; mp1=mp; while (mp1) { len = mp1->b_wptr - mp1->b_rptr; if ((uint)(frame_len + len) > (uint)TXBUF_LEN) { device->stats.mac_badlen++; break; } frame_len += len; bcopy(mp1->b_rptr, tx_buf, len); tx_buf += len; mp1 = mp1->b_cont; } freemsg(mp); /* Build ASB Command Block */ device->asb_xmt_resp.frame_len = mdi_ntohs(frame_len); if (device->asb_busy) { device->wait_send_xmt_asb = 1; } else { issue_send_asb(device); /* Send the ASB now */ } -=-=-=-= } /* * The driver has a frame to send, so tell the adapter. When the adapter * is ready to send, enable the WR(q) so that toksend_queued will run and that * will call tokhwput to send the frame to the network */ void tokstartio(struct tokdevice *device) { /* Tell the adapter we wish to send something */ if (device->srb_busy) { device->wait_send_xmt_srb = 1; } else { issue_send_srb(device); } } STATIC void issue_send_srb(struct tokdevice *device) { if (device->srb_busy) cmn_err(CE_WARN, "tok(issue_send_srb) - SRB is busy"); device->srb_busy = 1; bcopy(&device->srb_send, device->srb, sizeof(struct srb_send)); /* tell card that cmd is avail*/ device->aca->isra_odd_set = SRB_CMD|SRB_FREE_REQ; } /* Called when the SRB TRANSMIT.DIR.frame command has completed */ STATIC void process_startio(struct tokdevice *device) { struct arb_xmt_cmd *arbp = (struct arb_xmt_cmd *)device->arb; device->txbufp = device->sram + mdi_ntohs(arbp->dhb_address); device->asb_xmt_resp.correlate = arbp->correlate; toksend_queued(WR(device->up_queue)); } /* * Send a frame to the ring. This function actually only queues the transfer * it will return an error (-1) if there is an immediate error. */ void tokhwput(int unit, mblk_t *mp) { struct tokdevice *device = &tokdevice[unit]; unchar *tx_buf; ushort len, tlen; mblk_t *mp1; if (!device->txbufp) { cmn_err(CE_WARN, "tokhwput(unit=%d) - Called with no send buffer", unit); freemsg(mp); return; } tx_buf = device->txbufp; device->txbufp = (unchar *)0; /* We have previously told the adapter we wish to send */ /* something, now we should actually send the data */ tlen = 0; mp1=mp; while (mp1) { len = mp1->b_wptr - mp1->b_rptr; if ((uint)(tlen + len) > (uint)TXBUF_LEN) { device->stats.mac_badlen++; break; } tlen += len; bcopy(mp1->b_rptr, tx_buf, len); tx_buf += len; mp1 = mp1->b_cont; } freemsg(mp); /* Build ASB Command Block */ device->asb_xmt_resp.frame_len = mdi_ntohs(tlen); if (device->asb_busy) { device->wait_send_xmt_asb = 1; } else { issue_send_asb(device); /* Send the ASB now */ } } STATIC void issue_send_asb(struct tokdevice *device) { if (device->asb_busy) cmn_err(CE_WARN, "tok(issue_send_asb) - ASB is busy"); device->asb_busy = 1; bcopy(&device->asb_xmt_resp, device->asb, sizeof(struct asb_xmt_resp)); device->aca->isra_odd_set = ASB_RESP|ASB_FREE_REQ; /* send ASB */ tokstartio(device); /* Preallocate next tx buf */ } STATIC void process_modify_open(int unit) { struct tokdevice *device = &tokdevice[unit]; struct srb_modify_open *srbp = (struct srb_modify_open *)device->srb; if (srbp->retc) tokdiag_retc(unit, "DIR.MODIFY.OPEN.PARMS", srbp->retc); } STATIC void process_send_error(int unit) { struct tokdevice *device = &tokdevice[unit]; struct srb_send *srbp = (struct srb_send *)device->srb; if (srbp->retc = 0xff) return; cmn_err(CE_WARN, "tok(unit=%d) - Send failed, retc=%b",unit,srbp->retc); tokhwfailed(device); } STATIC void send_waiting_asb(struct tokdevice *device) { device->asb_busy = 0; if (device->wait_send_xmt_asb) { device->wait_send_xmt_asb = 0; issue_send_asb(device); } else if (device->wait_send_rcv_asb) { device->wait_send_rcv_asb = 0; issue_recv_asb(device); } } STATIC void send_waiting_srb(struct tokdevice *device) { device->srb_busy = 0; if (device->wait_send_close_srb) { device->wait_send_close_srb = 0; issue_close_srb(device); } else if (device->wait_send_xmt_srb) { device->wait_send_xmt_srb = 0; issue_send_srb(device); } else if (device->wait_send_log_srb) { device->wait_send_log_srb = 0; issue_log_srb(device); } else if (device->wait_send_mod_srb) { device->wait_send_mod_srb = 0; issue_mod_srb(device); } } void tokintr(int lev) { int unit = tokirq_to_unit[lev]; struct tokdevice *device = &tokdevice[unit]; unchar isrp_odd; unchar count; unchar x; if (device->mdi_state == MDI_NOT_PRESENT) { device->stats.mac_spur_intr++; return; } count = 50; isrp_odd = device->aca->isrp_odd; while (--count && isrp_odd) { if (device->sm_enable) //thc-sm { /* shallow mode operation */ if (isrp_odd & SM_RXBUFF_POST) //thc-sm { /* thc-sm: todo */ } if (isrp_odd & SM_TXCPLT) //thc-sm { /* thc-sm: todo */ } } else { /* normal mode operation */ if (isrp_odd & ASB_FREE) { device->aca->isrp_odd_rst= ~ASB_FREE; send_waiting_asb(device); } if (isrp_odd & SSB_RESP) { struct ssb_xmt_resp *ssbp; device->aca->isrp_odd_rst= ~SSB_RESP; ssbp = (struct ssb_xmt_resp *)device->ssb; switch (ssbp->retc) { case 0x00: /* Completed sucessfully */ case 0x22: /* Status from remote MAC */ break; default: cmn_err(CE_NOTE, "tokintr(unit=%d) - Send error, code=%b", unit, ssbp->retc); } device->aca->isra_odd_set = SSB_FREE; } } if (isrp_odd & SRB_RESP) /* SRB response */ { device->aca->isrp_odd_rst= ~SRB_RESP; switch (*(device->srb)) { case 0x01: /* DIR.MODIFY.OPEN.PARMS */ process_modify_open(unit); break; case 0x03: /* DIR.OPEN.ADAPTER */ if (process_open(unit) == 0 ) break; /* Fall through */ case 0x04: /* DIR.CLOSE.ADAPTER */ case 0x07: /* DIR.SET.FUNCTIONAL.ADDR */ if (device->wait_srb_complete) { device->wait_srb_complete = 0; untimeout(device->timeout_id); wakeup(&device->srb); } break; case 0x08: process_read_log(unit); break; case 0x0a: /* TRANSMIT.DATA.REQ */ process_send_error(unit); break; case 0x12: /* DIR.CONFIG.FAST.PATH.RAM */ //thc-sm process_SMopen_cnf_ram (unit); if (device->wait_srb_complete) { device->wait_srb_complete = 0; untimeout(device->timeout_id); wakeup(&device->srb); } break; case 0x20: /* DIR.CONFIG.EXTENSIONS */ //thc-sm process_SMopen_cnf_ext (unit); if (device->wait_srb_complete) { device->wait_srb_complete = 0; untimeout(device->timeout_id); wakeup(&device->srb); } break; default: cmn_err(CE_WARN, "tokintr(unit=%d) - Unknown SRB response %b", unit, *(device->srb)); } device->srb_busy = 0; send_waiting_srb(device); } if (isrp_odd & ARB_CMD) /* ARB command */ { device->aca->isrp_odd_rst= ~ARB_CMD; switch (*(device->arb)) { case 0x82: /* TRANSMIT.DATA.REQ */ process_startio(device); break; case 0x85: /* Global broadcast is passed as bridge data */ case 0x81: /* Received Data */ process_recv(unit); break; case 0x84: /* RING.STATUS.CHANGE */ process_ring_status_change(unit); break; default: cmn_err(CE_WARN, "tokintr(unit=%d) - Unknown ARB command 0x%b", unit, *(device->arb)); } device->aca->isra_odd_set = ARB_FREE; } if (!device->sm_enable) //thc-sm { /* normal mode operation */ if (isrp_odd & IMPL_RCV) /* Force IMPL MAC frame */ device->aca->isrp_odd_rst= ~IMPL_RCV; } if (isrp_odd & ADAP_CHK) /* Adapter check */ { cmn_err(CE_WARN, "tokintr(unit=%d) - Adapter Check", unit); tokhwfailed(device); device->aca->isrp_odd_rst= ~ADAP_CHK; return; /* MDI003 */ } /* Adapter error */ if (device->aca->isrp_even & (TIMER_INT|ERROR_INT|ACCESS_INT)) { cmn_err(CE_WARN, "tokintr(unit=%d) - Adapter Failure: 0x%b", unit, device->aca->isrp_even); tokhwfailed(device); device->aca->isrp_even_rst = ~(TIMER_INT|ERROR_INT|ACCESS_INT); return; /* MDI003 */ } isrp_odd = device->aca->isrp_odd; } outb(TOKEN_INTR_REL(unit), 0); /* release interrupt */ if (!count) { cmn_err(CE_WARN, "tokintr(unit=%d) - Fatal interrupt flood", unit); tokhwfailed(device); } } STATIC void process_ring_status_change(int unit) { struct tokdevice *device = &tokdevice[unit]; struct arb_ring_status *arbp = (struct arb_ring_status *)device->arb; ushort old_s = device->stats.mac_ringstatus; ushort new_s = mdi_ntohs(arbp->ring_status); ushort changed = old_s ^ new_s; /* X-OR */ device->stats.mac_ringstatus = new_s; if (changed & RST_RING_RECOVERY) { if (new_s & RST_RING_RECOVERY) device->stats.mac_recoverys++; } if (changed & RST_SINGLE_STATION) { if (new_s & RST_SINGLE_STATION) device->stats.mac_statssingles++; } #ifdef NON_FATAL_MESSAGE /* MDI001 */ if (new_s & RST_COUNTER_OVERFLOW) { cmn_err(CE_WARN, "tok(unit=%d) - Status: Counter overflow", unit); } #endif if (new_s & RST_FDX_ERROR) { //thc-fdx cmn_err(CE_WARN, "tok(unit=%d) - Status: FDX protocol error, adapter closing",unit); //thc-fdx tokhwfailed(device); //thc-fdx } //thc-fdx if (new_s & RST_REMOVE_RECEIVED) { cmn_err(CE_WARN, "tok(unit=%d) - Status: Remove received, adapter closing",unit); tokhwfailed(device); } if (new_s & RST_AUTO_RMV_ERROR) { cmn_err(CE_WARN, "tok(unit=%d) - Status: H/W Error detected", unit); tokhwfailed(device); } if (new_s & RST_LOBE_WIRE_FAULT) { cmn_err(CE_WARN,"tok(unit=%d) - Status: Open/Short circuit in data path",unit); tokhwfailed(device); } if (changed & RST_TRANSMIT_BEACON) { if (new_s & RST_TRANSMIT_BEACON) device->stats.mac_transmitbeacons++; } if (changed & RST_SOFT_ERROR) { if (new_s & RST_SOFT_ERROR) device->stats.mac_softerrors++; } if (changed & RST_HARD_ERROR) { if (new_s & RST_HARD_ERROR) device->stats.mac_harderrors++; } if (changed & RST_SIGNAL_LOSS) { if (new_s & RST_SIGNAL_LOSS) device->stats.mac_signalloss++; } } STATIC int tokcheckaddr( struct tokdevice *device, ulong l ) { int i; if (l == 0xffffffff) return(1); for (i=0; imccnt; ++i) { if (device->mctbl[i] == l) { return(1); } } return(0); } STATIC void process_recv(int unit) { struct tokdevice *device = &tokdevice[unit]; struct arb_rcv_data *arbp = (struct arb_rcv_data *)device->arb; struct rcv_buf *rcv_buf; /* Receive Buffer pointer */ mblk_t *mp; ushort x; int i, frame_len; long l; device->asb_rcv_resp.rcv_buf_ptr = arbp->rcv_buf_ptr; x = mdi_ntohs(arbp->rcv_buf_ptr); frame_len = mdi_ntohs(arbp->frame_len); if (frame_len > MAX_PDU) { device->stats.mac_badlen++; if (device->asb_busy) device->wait_send_rcv_asb = 1; else issue_recv_asb(device); return; } if (!(mp = allocb(frame_len,BPRI_MED))) { device->stats.mac_frame_nosr++; if (device->asb_busy) device->wait_send_rcv_asb = 1; else issue_recv_asb(device); return; } while (1) { int j; rcv_buf = (struct rcv_buf *)(device->sram + x); j = mdi_ntohs(rcv_buf->frame_len); bcopy(rcv_buf->data, mp->b_wptr, j); mp->b_wptr += j; if (rcv_buf->rcv_buf_ptr == 0) break; x = mdi_ntohs(rcv_buf->rcv_buf_ptr)-2; } /* We have copied the data from the ARB, now issue the ASB response */ if (device->asb_busy) { device->wait_send_rcv_asb = 1; } else { issue_recv_asb(device); } /* * We have a packet from the ring, check the first two bytes of the * destination address to see if it starts with 'C000', if it does * then its possibly a Multi-cast address, perform filtering. */ if (*(mp->b_rptr+2)==0xc0 && *(mp->b_rptr+3)==0x00) { if (!tokcheckaddr(device, ADDR_TO_LONG(mp->b_rptr+2))) { freemsg(mp); return; } } if (device->up_queue) putnext(device->up_queue, mp); else freemsg(mp); return; } STATIC void issue_recv_asb(struct tokdevice *device) { if (device->asb_busy) cmn_err(CE_WARN, "tok(issue_recv_asb) - ASB is busy"); device->asb_busy = 1; bcopy(&device->asb_rcv_resp, device->asb, sizeof(struct asb_rcv_resp)); device->aca->isra_odd_set = ASB_RESP|ASB_FREE_REQ; /* send ASB */ } STATIC void issue_log_srb(struct tokdevice *device) { if (device->srb_busy) cmn_err(CE_WARN, "tok(issue_log_srb) SRB is busy"); device->srb_busy = 1; bcopy(&device->srb_read_log, device->srb, sizeof(struct srb_read_log)); device->aca->isra_odd_set = SRB_CMD|SRB_FREE_REQ; } STATIC void issue_mod_srb(struct tokdevice *device) { if (device->srb_busy) cmn_err(CE_WARN, "tok(issue_mod_srb) SRB is busy"); device->srb_busy = 1; bcopy(&device->srb_modify_open, device->srb, sizeof(struct srb_modify_open)); device->aca->isra_odd_set = SRB_CMD|SRB_FREE_REQ; } STATIC void process_read_log(int unit) { struct tokdevice *device = &tokdevice[unit]; struct srb_read_log *srbp = (struct srb_read_log *)device->srb; mblk_t *mp = device->iocmp; struct iocblk *iocp; if (mp) iocp = (struct iocblk *)mp->b_rptr; if (srbp->retc) { if (mp) { mp->b_datap->db_type = M_IOCNAK; iocp->ioc_count = 0; } } else { device->stats.mac_lineerrors += srbp->line; device->stats.mac_internalerrors += srbp->internal; device->stats.mac_bursterrors += srbp->burst; device->stats.mac_acerrors += srbp->ac; device->stats.mac_aborttranserrors += srbp->abort; device->stats.mac_lostframeerrors += srbp->lost_frames; device->stats.mac_receivecongestions += srbp->congestion; device->stats.mac_framecopiederrors += srbp->copied; device->stats.mac_frequencyerrors += srbp->freq; device->stats.mac_tokenerrors += srbp->token; if (mp) { mp->b_datap->db_type = M_IOCACK; bcopy(&device->stats, mp->b_cont->b_rptr, sizeof(mac_stats_tr_t)); } } if (mp) { device->iocmp = (mblk_t *)0; putnext(device->up_queue, mp); } } /* * This function issues a DIR.READ.LOG to obtain statistics, and then * returns them in 'mp' */ void tokupdate_stats(int unit, mblk_t *mp) { struct tokdevice *device = &tokdevice[unit]; device->iocmp = mp; ADDR_TO_LONG(device->stats.mac_funcaddr) = device->addr->func_addr; bcopy(device->parms->up_node_addr, device->stats.mac_upstream, 6); if (device->srb_busy) device->wait_send_log_srb = 1; else issue_log_srb(device); } static struct tok_diag retc_t[] = { { 0x00, "Operation completed OK (no error)" }, { 0x01, "Invalid command code" }, { 0x03, "Adapter should be closed, but isn't" }, { 0x04, "Adapter should be open, but isn't" }, { 0x07, "Command canceled, unrecoverable failure" }, { 0x09, "Adapter not initialized" }, { 0x0B, "Adapter closed while in use" }, { 0x0C, "Command completed, adapter is now closed" }, { 0x11, "Lobe failure, check connection between host and ring" }, { 0x19, "Insufficient buffers for request" }, { 0x20, "Dropped data on receipt, no buffers" }, { 0x21, "Dropped data on receipt, no buffer space" }, { 0x22, "Error detected during a receive" }, { 0x25, "Maximum commands exceeded" }, { 0x26, "Unrecognised command correlator" }, { 0x27, "Link not transmitting I-frames" }, { 0x28, "Invalid transmit frame length" }, { 0x30, "Not enough receive buffers for adapter to open" }, { 0x32, "Invalid NODE address" }, { 0x33, "Invalid adapter receive buffer length defined" }, { 0x34, "Invalid adapter transmit buffer length defined" }, { 0x40, "Invalid station ID" }, { 0x43, "Invalid SAP / SAP in use" }, { 0x44, "Invalid routing field length" }, { 0x46, "Inadequate link stations" }, { 0x47, "SAP cannot close until all SAP's stations are closed" }, { 0x5A, "Cannot initialize adapter" }, { -1, 0 } }; static struct tok_diag open_t[] = { { 0x0f, "FDX Protocol Error" }, //thc-fdx { 0x24, "Frequency error, adapter does not match ring speed" }, { 0x26, "Ring failure, try again or contact system admin" }, { 0x27, "Wrong data rate / claim token failure" }, { 0x2A, "Ring connect timeout - try again in about 10 minutes" }, { 0x2D, "No ring monitor detected" }, { 0x38, "Duplicate node address" }, { 0x42, "Signal loss, ring failure" }, { -1, 0 } }; STATIC char * check_t(struct tok_diag *table, unchar errno) { static char unknown[]="Error 0xXX is unknown"; static char atox[] = "0123456789abcdef"; for (; table->i != -1; table++) if (table->i == errno) return (table->s); table = retc_t; for (; table->i != -1; table++) if (table->i == errno) return (table->s); unknown[8] = atox[errno >> 4]; unknown[9] = atox[errno & 0xf]; return (unknown); } STATIC void tokdiag_retc(int unit, char *desc, int errno) { cmn_err(CE_WARN, "tok(unit=%d) - %s failed:", unit, desc); cmn_err(CE_WARN, "\t\"%s\"", check_t(retc_t, (unchar)errno)); } STATIC void tokdiag_openerr(int unit, unchar errno, ushort open_err) //thc-fdx { cmn_err(CE_WARN, "tok(unit=%d) - Adapter open failed:", unit); if (errno == 0x07) { if (((unchar)open_err & 0x0f) == 0x0f) //thc-fdx cmn_err(CE_WARN, "\t\"%s\"", check_t(open_t, 0x0f)); //thc-fdx else //thc-fdx cmn_err(CE_WARN, "\t\"%s\"", check_t(open_t, (unchar)open_err)); } else cmn_err(CE_WARN, "\t\"%s\"", check_t(retc_t, (unchar)errno)); } 070701000238b3000081a400000000000000030000000135aefcd60000022b00001dff0000000100000000000000000000003100000000root/usr/src/O5hdk/net/scripts/custom/CDMT.cmpnt# # Component Description File # COMP: description = version = subpackages = distTreeRoot = distTreeRootSERVER = distTreeRootCLIENT = pkgFiles = # # default attributes may be overwritten in the pkg files # DIR_DEFAULT: perms =0755 owner =bin group =bin FILE_DEFAULT: perms =0644 owner =bin group =bin 070701000238b4000081a400000000000000030000000135aefcd6000004f000001dff0000000100000000000000000000003200000000root/usr/src/O5hdk/net/scripts/custom/CDMT.configMACROS: ahs_lli_VER =VERSION_REPLACED_FROM_Make.inc ahs_lli_doc_VER =VERSION_REPLACED_FROM_Make.inc ahs_lli_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli ahs_lli_doc_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli PRD_REPLACED_FROM_Make.inc_VER =VERSION_REPLACED_FROM_Make.inc CONFIG: archiveMedia =MEDIA_REPLACED_FROM_Make.inc TAPE_MEDIA: distCode =cdmtTapeDistribution distVersion =$PRD_REPLACED_FROM_Make.inc_VER FLOPPY_MEDIA: distCode =cdmtFloppyDistribution distVersion =$PRD_REPLACED_FROM_Make.inc_VER MACROS: PRD_REPLACED_FROM_Make.inc_doc_VER =VERSION_REPLACED_FROM_Make.inc PRD_REPLACED_FROM_Make.inc_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli PRD_REPLACED_FROM_Make.inc_doc_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli PRD_REPLACED_FROM_Make.inc_FR_VER =VERSION_REPLACED_FROM_Make.inc PRD_REPLACED_FROM_Make.inc_FR_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli_FR PRD_REPLACED_FROM_Make.inc_doc_FR_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli_FR PRD_REPLACED_FROM_Make.inc_DE_VER =VERSION_REPLACED_FROM_Make.inc PRD_REPLACED_FROM_Make.inc_DE_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli_DE PRD_REPLACED_FROM_Make.inc_doc_DE_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli_DE PRODUPGRADE_DIR =CWD_REPLACED_FROM_updatecdmt/stub/dist/prodUpgrade 070701000238b7000081a400000000000000030000000135aefcd70000014b00001dff0000000100000000000000000000003300000000root/usr/src/O5hdk/net/scripts/custom/CDMT.drv.ctl# # Package description for the SharedControl package # PKG:Control: description = "Driver Control Package" DIR:Control:SERVER:./cntl: DIR:Control:SERVER:./cntl/packages: FILE:Control:SERVER:./cntl/ccs: perms = 0755 FILE:Control:SERVER:./cntl/instlib.sh: perms = 0755 FILE:Control:SERVER:./cntl/packages/pkg.drv: perms = 0755 070701000238b8000081a400000000000000030000000135aefcd70000019d00001dff0000000100000000000000000000003200000000root/usr/src/O5hdk/net/scripts/custom/CDMT.ne.cfgMACROS: AHSBase_doc_DIR =CWD_REPLACED_FROM_updatecdmt/dist/AHSBase_doc PRODUPGRADE_VER=VERSION_REPLACED_FROM_Make.inc PRODUPGRADE_DIR =CWD_REPLACED_FROM_updatecdmt/stub/dist/prodUpgrade ahs_lli_doc_VER =VERSION_REPLACED_FROM_Make.inc ahs_lli_doc_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli ahs_lli_doc_FR_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli ahs_lli_doc_DE_DIR =CWD_REPLACED_FROM_updatecdmt/dist/lli 070701000238b5000081a400000000000000030000000135aefcd600001aed00001dff0000000100000000000000000000002f00000000root/usr/src/O5hdk/net/scripts/custom/CDMT.pkg# # Netconfig package description # PKG:NCFG: description = "Netconfig Network Configuration Manager" dependencies = SCO:adminfw::.*, SCO:WServer::.* required = CORE upgradeMappings = SCO:Unix:NETCFG::.* DIR:NCFG:SERVER:./ncfg: DIR:NCFG:SERVER:./ncfg/bin: FILE:NCFG:SERVER:./ncfg/netconfig: perms = 0755 exportPathRegPhase = /etc/netconfig FILE:NCFG:SERVER:./ncfg/bin/netconfig.msg.tcl: perms = 0644 FILE:NCFG:SERVER:./ncfg/ncfginstall: perms = 0755 exportPathRegPhase = ./bin/ncfginstall exportPathRegPhase = /etc/ncfginstall FILE:NCFG:SERVER:./ncfg/bin/ncfginstall.msg.tcl: perms = 0644 FILE:NCFG:SERVER:./ncfg/bin/ncfgUI: perms = 0755 FILE:NCFG:SERVER:./ncfg/bin/ncfgUI.msg.tcl: perms = 0644 FILE:NCFG:SERVER:./ncfg/bin/ncfgBE: perms = 0755 FILE:NCFG:SERVER:./ncfg/bin/pop: perms = 0755 FILE:NCFG:SERVER:./ncfg/bin/ncfgprompter: perms = 0755 exportPath = ./bin/ncfgprompter FILE:NCFG:SERVER:./ncfg/bin/ncfgprompter.msg.tcl: perms = 0644 DIR:NCFG:SERVER:./ncfg/netconfig.obj: FILE:NCFG:SERVER:./ncfg/netconfig.obj/picture.px: FILE:NCFG:SERVER:./ncfg/netconfig.obj/open.px: FILE:NCFG:SERVER:./ncfg/netconfig.obj/s_picture.px: FILE:NCFG:SERVER:./ncfg/netconfig.obj/s_open.px: FILE:NCFG:SERVER:./ncfg/netconfig.obj/activate: FILE:NCFG:SERVER:./ncfg/netconfig.obj/activate.scoadmin: perms = 0755 DIR:NCFG:SERVER:./ncfg/netconfig.obj/en_US: FILE:NCFG:SERVER:./ncfg/netconfig.obj/en_US/title: DIR:NCFG:CLIENT:./ncfg: DIR:NCFG:CLIENT:./ncfg/olddir: perms = 0755 exportPathRegPhase = ./lib/netconfig DIR:NCFG:CLIENT:./ncfg/olddir/info: DIR:NCFG:CLIENT:./ncfg/olddir/init: DIR:NCFG:CLIENT:./ncfg/olddir/list: DIR:NCFG:CLIENT:./ncfg/olddir/reconf: DIR:NCFG:CLIENT:./ncfg/olddir/remove: DIR:NCFG:CLIENT:./ncfg/olddir/bin: DIR:NCFG:CLIENT:./ncfg/olddir/rc0: DIR:NCFG:CLIENT:./ncfg/olddir/rc2: DIR:NCFG:CLIENT:./ncfg/olddir/src: DIR:NCFG:CLIENT:./ncfg/olddir/tmp: DIR:NCFG:SERVER:./ncfg/icons: FILE:NCFG:SERVER:./ncfg/icons/blank.px: FILE:NCFG:SERVER:./ncfg/icons/cardL.px: FILE:NCFG:SERVER:./ncfg/icons/cardR.px: FILE:NCFG:SERVER:./ncfg/icons/card16L.px: FILE:NCFG:SERVER:./ncfg/icons/card16R.px: FILE:NCFG:SERVER:./ncfg/icons/dline0.px: FILE:NCFG:SERVER:./ncfg/icons/dline0end.px: FILE:NCFG:SERVER:./ncfg/icons/dline1.px: FILE:NCFG:SERVER:./ncfg/icons/dline1A.px: FILE:NCFG:SERVER:./ncfg/icons/dline1B.px: FILE:NCFG:SERVER:./ncfg/icons/dline2.px: FILE:NCFG:SERVER:./ncfg/icons/dline3.px: FILE:NCFG:SERVER:./ncfg/icons/dline4.px: FILE:NCFG:SERVER:./ncfg/icons/dline4A.px: FILE:NCFG:SERVER:./ncfg/icons/dline4B.px: FILE:NCFG:SERVER:./ncfg/icons/ghostcardL.px: FILE:NCFG:SERVER:./ncfg/icons/ghostcardR.px: FILE:NCFG:SERVER:./ncfg/icons/ghostcard16L.px: FILE:NCFG:SERVER:./ncfg/icons/ghostcard16R.px: FILE:NCFG:SERVER:./ncfg/icons/line0.px: FILE:NCFG:SERVER:./ncfg/icons/line0end.px: FILE:NCFG:SERVER:./ncfg/icons/line1.px: FILE:NCFG:SERVER:./ncfg/icons/line2.px: FILE:NCFG:SERVER:./ncfg/icons/line3.px: FILE:NCFG:SERVER:./ncfg/icons/line4.px: FILE:NCFG:SERVER:./ncfg/icons/serialL.px: FILE:NCFG:SERVER:./ncfg/icons/serialR.px: DIR:NCFG:SHARED:./lib: DIR:NCFG:SHARED:./lib/nls: DIR:NCFG:SHARED:./lib/nls/msg: DIR:NCFG:SHARED:./lib/nls/msg/en: exportPathRegPhase = /usr/lib/nls/msg/en/lli exportPathRegPhase = /usr/lib/nls/msg/english/lli FILE:NCFG:SHARED:./lib/nls/msg/en/ncfg.cat: perms = 444 # # Network Adapter Drivers CORE package description # PKG:CORE: description = "Network Driver Configuration" DIR:CORE:SERVER:./llicompat: FILE:CORE:SERVER:./llicompat/perms: exportPath = /etc/perms/lli DIR:CORE:SERVER:./llicompat/bin: FILE:CORE:SERVER:./llicompat/bin/ha: perms = 0755 exportPath = ./lib/lli/ha FILE:CORE:SERVER:./llicompat/bin/hc: perms = 0755 exportPath = ./lib/lli/hc FILE:CORE:SERVER:./llicompat/dlpi.h: exportPathRegPhase = ./include/sys/dlpi.h FILE:CORE:SERVER:./llicompat/macstat.h: exportPathRegPhase = ./include/sys/macstat.h DIR:CORE:CLIENT:./tmp: DIR:CORE:CLIENT:./sysdb: FILE:CORE:CLIENT:./llimdi: DIR:CORE:SERVER:./lib: FILE:CORE:SERVER:./lib/libcfg.sh: FILE:CORE:SERVER:./lib/libSCO.tcl: FILE:CORE:SERVER:./lib/libSCO.msg.tcl: DIR:CORE:SERVER:./inc: FILE:CORE:SERVER:./inc/attdlpi.h: exportPathRegPhase = ./include/sys/attdlpi.h FILE:CORE:SERVER:./inc/dlpimod.h: exportPathRegPhase = ./include/sys/dlpimod.h FILE:CORE:SERVER:./inc/lli31.h: exportPathRegPhase = ./include/sys/lli31.h FILE:CORE:SERVER:./inc/mdi.h: exportPathRegPhase = ./include/sys/mdi.h FILE:CORE:SERVER:./inc/scodlpi.h: exportPathRegPhase = ./include/sys/scodlpi.h FILE:CORE:SERVER:./inc/sr.h: exportPathRegPhase = ./include/sys/sr.h DIR:CORE:SERVER:./bin: FILE:CORE:SERVER:./bin/ndinstall: perms = 0755 exportPathRegPhase = ./bin/ndinstall FILE:CORE:SERVER:./bin/ndinstall.msg.tcl: perms = 0644 FILE:CORE:SERVER:./bin/ndipu: perms = 0755 FILE:CORE:SERVER:./bin/ndipu.msg.tcl: perms = 0644 FILE:CORE:SERVER:./bin/ndscript: perms = 0755 FILE:CORE:SERVER:./bin/ndscript.msg.tcl: perms = 0644 FILE:CORE:SERVER:./bin/ndprompter.BE: perms = 0755 FILE:CORE:SERVER:./bin/ndprompter.msg.tcl: perms = 0644 FILE:CORE:SERVER:./bin/llipathmap: perms = 0755 flags = ssoPatch exportPathRegPhase = ./bin/llipathmap exportPathRegPhase = /etc/llipathmap FILE:CORE:SERVER:./bin/ndnamemap: perms = 0755 exportPathRegPhase = ./bin/ndnamemap exportPathRegPhase = /etc/ndnamemap FILE:CORE:SERVER:./bin/stzget: perms = 0755 FILE:CORE:SERVER:./bin/llistat: perms = 02755 group = mem flags = ssoPatch exportPath = ./bin/ndstat exportPath = ./bin/llistat FILE:CORE:SERVER:./bin/start_stop: perms = 0755 exportPath = /etc/lli exportPath = /etc/nd FILE:CORE:SERVER:./bin/dlpid.msg.tcl: perms = 0644 FILE:CORE:SERVER:./bin/pcislot: perms = 0755 FILE:CORE:SERVER:./bin/dlpid: perms = 0755 DIR:CORE:CLIENT:./ID: DIR:CORE:SERVER:./dlpi: DIR:CORE:SERVER:./dlpi/dummy: DIR:CORE:SERVER:./dlpi/dlpi: FILE:CORE:SERVER:./dlpi/dummy/Driver.o: exportPath = ./lib/lli/Driver.o FILE:CORE:SERVER:./dlpi/dlpi/lkcfg: perms = 0755 FILE:CORE:SERVER:./dlpi/dlpi/Driver.o: FILE:CORE:SERVER:./dlpi/dlpi/Master: FILE:CORE:SERVER:./dlpi/dlpi/Space.c: FILE:CORE:SERVER:./dlpi/dlpi/System: FILE:CORE:SERVER:./dlpi/dlpi/space.h: FILE:CORE:SERVER:./dlpi/dlpi/DOF: DIR:CORE:SERVER:./ncfg/net0: FILE:CORE:SERVER:./ncfg/net0/Info: perms = 0644 FILE:CORE:SERVER:./ncfg/net0/Init: perms = 0555 FILE:CORE:SERVER:./ncfg/net0/List: perms = 0555 FILE:CORE:SERVER:./ncfg/net0/Reconf: perms = 0555 FILE:CORE:SERVER:./ncfg/net0/Remove: perms = 0555 FILE:CORE:SERVER:./bin/ncfgnetx.msg.tcl: perms = 0644 DIR:CORE:SHARED:./lib: DIR:CORE:SHARED:./lib/nls: DIR:CORE:SHARED:./lib/nls/msg: DIR:CORE:SHARED:./lib/nls/msg/en: exportPathRegPhase = /usr/lib/nls/msg/en/lli exportPathRegPhase = /usr/lib/nls/msg/english/lli FILE:CORE:SHARED:./lib/nls/msg/en/lli.cat: perms = 444 FILE:CORE:SHARED:./lib/nls/msg/en/ndinst.cat: perms = 444 FILE:CORE:SHARED:./lib/nls/msg/en/dlpid.cat: perms = 444 070701000238b9000081a40000000000000003000000013757467d0000014500001dff0000000100000000000000000000003300000000root/usr/src/O5hdk/net/scripts/custom/CDMT.pkg.ctl# # Package description for the SharedControl package # PKG:Control: description = "Installation Control Package" DIR:Control:SERVER:./cntl: DIR:Control:SERVER:./cntl/packages: FILE:Control:SERVER:./cntl/ccs: perms = 0755 FILE:Control:SERVER:./cntl/cqs: perms = 0755 FILE:Control:SERVER:./cntl/instlib.sh: perms = 0755 070701000238bb000081a400000000000000030000000135aefcd60000027300001dff0000000100000000000000000000003600000000root/usr/src/O5hdk/net/scripts/custom/CDMT.pkg.ctl.XX# # Package description for the SharedControl package # PKG:Control: description = "Installation Control Package" DIR:Control:SERVER:./cntl: DIR:Control:SERVER:./cntl/packages: FILE:Control:SERVER:./cntl/ncfg_tbird_upgrade: perms = 0755 flags = isl exportPath = /ibin/ncfg_tbird_upgrade FILE:Control:SERVER:./cntl/oldcustom.rmv: perms = 0755 flags = isl FILE:Control:SERVER:./cntl/ccs: perms = 0755 FILE:Control:SERVER:./cntl/cqs: perms = 0755 FILE:Control:SERVER:./cntl/instlib.sh: perms = 0755 FILE:Control:SERVER:./cntl/packages/pkg.core: perms = 0755 FILE:Control:SERVER:./cntl/packages/pkg.ncfg: perms = 0755 070701000238ba000081a400000000000000030000000135aefcd6000000cb00001dff0000000100000000000000000000003300000000root/usr/src/O5hdk/net/scripts/custom/CDMT.pkg.doc# # Package description for the LLI_DOC package # PKG:LLI_DOC: description = "Stub LLI_DOC package" # put in one bogus entry so custom doesn't complain during layered install DIR:LLI_DOC:SERVER:./lib: 070701000238bc000081a400000000000000030000000135aefcd70000012300001dff0000000100000000000000000000003200000000root/usr/src/O5hdk/net/scripts/custom/CDMT.pr.cfgCONFIG: archiveMedia =MEDIA_REPLACED_FROM_Make.inc TAPE_MEDIA: distCode =cdmtTapeDistribution distVersion =VERSION_REPLACED_FROM_Make.inc FLOPPY_MEDIA: distCode =cdmtFloppyDistribution distVersion =VERSION_REPLACED_FROM_Make.inc MACROS: ahs_lli_VER =VERSION_REPLACED_FROM_Make.inc 070701000238b6000081a400000000000000030000000135aefcd6000000d900001dff0000000100000000000000000000002f00000000root/usr/src/O5hdk/net/scripts/custom/CDMT.prd# # Product Description File # Describes entire product. # PROD:CODE_REPLACED_FROM_Make.inc: description ="DESC_REPLACED_FROM_Make.inc" version =VERSION_REPLACED_FROM_Make.inc 070701000238b2000081a400000000000000030000000135aefcd3000005d700001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/scripts/custom/ccs: # # @(#) ccs 60.1 97/01/30 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1997 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Custom Control Script (ccs) # OK=0; FAIL=1; WARN=2 PATH=${PATH}:/usr/bin:${SSO_SHARED_ROOT}/bin ret=$OK step=$1 key=$2 pkgs=$3 LLI_DEBUG=/tmp/_lli_debug export LLI_DEBUG . ccsSetup.sh . ${SSO_SHARED_ROOT}/cntl/instlib.sh # package specific stuff done by calling driver package scripts # expects "$pkgs", "$step", and "$key" to be set by calling script callbasepkgscripts() { do_core="N" do_ncfg="N" for pkg in $pkgs do p=`getPackageCode $pkg` case $p in *CORE) do_core="Y";; *NCFG) do_ncfg="Y";; esac done if [ "$do_core" = "Y" ] then sh $pkgscripts/pkg.core "$step" "$key" "$pkgs" || ret=$FAIL fi if [ "$do_ncfg" = "Y" ] then sh $pkgscripts/pkg.ncfg "$step" "$key" "$pkgs" || ret=$FAIL fi } # MAIN Main main if [ -f "$LLI_DEBUG" ] then LLI_DEBUG_FLAG=1 export LLI_DEBUG_FLAG echo "ccs <$*>" echo "ccs step <$step> key <$key> pkgs <$pkgs>" echo "About to source $LLI_DEBUG - to continue..." /ibin/sh [ -f "$LLI_DEBUG" ] && . $LLI_DEBUG fi # call NCFG/CORE pkg scripts for lli component, drv pkg scripts for drivers callbasepkgscripts # for DOC - calls into .../cntl/packages/*_DOC/ccs scripts calldrvpkgscripts if [ -f "$LLI_DEBUG" ] then echo "ccs $step after package scripts - to continue..." /ibin/sh fi exit $ret 070701000238bd000081a400000000000000030000000135aefcd600001f3700001dff0000000100000000000000000000002b00000000root/usr/src/O5hdk/net/scripts/custom/cpcs#! /bin/sh # # @(#) cpcs 11.1 95/05/17 SCOINC # # Copyright (C) 1988-1995 The Santa Cruz Operation, Inc. # All Rights Reserved. # The information in this file is provided for the exclusive use of # the licensees of The Santa Cruz Operation, Inc. Such users have the # right to use, modify, and incorporate this code into other products # for purposes authorized by the license agreement provided they include # this notice and the associated copyright notice with any such product. # The information in this file is provided "AS IS" without warranty. # # Define return values : ${OK=0} ${FAIL=1} ${WARN=2} ${STOP=3} SSO_VER=`basename $SSO_SHARED_ROOT` SME_PKG=SCO:lli:sme::$SSO_VER VER=`echo $0 | sed 's/.*cpcs\.//'` PKG_DBLIST="$SSO_SHARED_ROOT/.softmgmt/sme.fl" # driver specific information relinkFile=/tmp/relink.lli$VER drvrFile=/tmp/drivers.lli$VER drvrHome=ID drvrList=sme linkHome=/etc/conf/pack.d # home of id* binaries, except idar/idas/idld idbin=/etc/conf/bin # if LANG is not defined, default to english : ${LANG=english_us.ascii} ; export LANG # string "_drvr_" is a tag for substitution; do not delete MSG_top="WARNING: The _drvr_ driver currently running on this system is" MSG_drvInstall="\tdifferent from the expected version. Do you wish to REPLACE the current driver with the new driver included in this patch? (y/n) \c" MSG_drvRestore="\tdifferent from the expected version. Do you wish to REPLACE the current driver with the old driver saved during the original installation of this patch? (y/n) \c" MSG_noReplace="Patch installation and configuration will continue for remaining files. You may reapply this patch later, at which time you may choose to REPLACE rather than keep this file." MSG_yn="Please enter y or n. \c" MSG_missingDrv="WARNING: unable to restore driver for _drvr_. The backup file has been removed from the system prior to patch rollback." MSG_abortRem="Should patch rollback be aborted? (y/n) \c" MSG_userRelink="NOTE: Rollback of this patch requires a kernel relink. If you are rolling back several patches at this time, you may choose to defer the relink until the last patch rollback. However, you must relink for the system to return to the pre-patch state. Do you want to relink the kernel now? (y/n) \c" # #COM=`basename $0` #case $LANG in # de*|ger*) . /usr/lib/nls/msg/de/lli/$COM.cat # ;; # fr*) . /usr/lib/nls/msg/fr/lli/$COM.cat # ;; # *) . /usr/lib/nls/msg/en/lli/$COM.cat # ;; #esac # get installation standard functions [ -f /ibin/ccsSetup.sh ] && . /ibin/ccsSetup.sh getYN () { while read x do case $x in y|Y) return $OK ;; n|N) return $FAIL ;; *) echo "\n$MSG_yn" ;; esac done return $FAIL } save_driver () { # save a copy of the current master driver, for comparison # on the client systems during ENABLE:chk_driver() for drvr in $drvrList do [ -f $SSO_SHARED_ROOT/$drvrHome/$drvr/Driver.o ] || continue cd $SSO_SHARED_ROOT/$drvrHome/$drvr cp Driver.o Driver.pre$VER || return $FAIL done return $OK } restore_driver () { # move the saved "prePatch" driver back into place for idinstall # are there any drivers to be installed? [ -f $drvrFile ] && drvrList=`cat $drvrFile` || return $OK # Check that all previous drivers are present before restoring for drvr in $drvrList do [ -f $SSO_SHARED_ROOT/$drvrHome/$drvr/Driver.pre$VER ] || { echo "\n$MSG_missingDrv" | sed "s/_drvr_/$drvr/" echo "\n$MSG_abortRem" getYN && return $FAIL } done # now restore them for drvr in $drvrList do [ -f $SSO_SHARED_ROOT/$drvrHome/$drvr/Driver.pre$VER ] && { cd $SSO_SHARED_ROOT/$drvrHome/$drvr mv -f Driver.pre$VER Driver.o } done return $OK } chk_driver () { # Confirm that the driver currently in the link kit is the # same as the one in the SSO tree. Otherwise, delete driver # from install list, and issue warning to the user. # fully configured and in the current running kernel = 31 # fully configured but not in the running kernel = 23 (for # example: NFS fully configured, kernel relinked, but # patch installation before system reboot) rm -f $drvrFile for drvr in $drvrList do [ -d $SSO_SHARED_ROOT/$drvrHome/$drvr ] || continue cd $SSO_SHARED_ROOT/$drvrHome/$drvr $idbin/idcheck -p $drvr [ $? -eq 31 -o $? -eq 23 ] || continue case $FLAG in Install) # during patch apply, current Driver.o is renamed to # Driver.pre$VER by save_driver before the chk function. sso=`checksum Driver.pre$VER` # on net installed client, save_driver is not run, # so Driver.o will be the already patched file patch=`checksum Driver.o` ;; Restore) # during patch rollback, current Driver.o is still in # place, and only overwritten if chk is ok. sso=`checksum Driver.o` ;; esac linkkit=`checksum $linkHome/$drvr/Driver.o` if [ "$sso" = "$linkkit" ] ; then echo " $drvr " >> $drvrFile elif [ "$patch" = "$linkkit" ] ; then continue else echo "$MSG_top" | sed "s/_drvr_/$drvr/" case $FLAG in Install) echo $MSG_drvInstall ;; Restore) echo $MSG_drvRestore ;; esac if getYN; then echo " $drvr " >> $drvrFile else echo "\n$MSG_noReplace" fi fi done return $OK } user_relink () { # Tell the user they must relink the kernel after custom is # finished rolling back the patch(es). This is required because # custom does not schedule relinks after POST_UNLOAD, but this # is when the drivers have been restored. Let the user do the # relink rather than relink in every patch rollback script. [ -f $relinkFile ] && { rm -f $relinkFile echo "\n$MSG_userRelink" if getYN; then /etc/conf/cf.d/link_unix -y || return $FAIL fi } return $OK } install_driver () { # The driver is already updated in the SSO tree, but it # may need to be copied into the LinkKit as well. First # we test the status of this driver, then if currently # configured on this system, idinstall the new driver # into place. [ -f $drvrFile ] && drvrList=`cat $drvrFile` || return $OK rm -f $drvrFile for drvr in $drvrList do [ -d $SSO_SHARED_ROOT/$drvrHome/$drvr ] || continue cd $SSO_SHARED_ROOT/$drvrHome/$drvr $idbin/idinstall -uHok $drvr touch $relinkFile done return $OK } custom_relink () { # let custom do the relink during patch installation [ -f $relinkFile ] && { customSched kernellink rm -f $relinkFile } return $OK } is_loaded() { customquery ListPhases $1 | grep LOAD > /dev/null return $? } checksum() { if [ -f $1 ]; then sum -r $1 | awk '{ print $1 }' else echo 00000 fi } edit_customdb() { tmpfile=/tmp/cpcs$$ status=$OK for db in $PKG_DBLIST do awk -v ver="$VER" ' BEGIN { suffix = ".*pre" ver; } /^FILE/ { if ($11 == "-" && $12 == "-" && $13 ~ suffix) { $11 = "0"; $12 = "0"; } } { print; }' $db > $tmpfile oldsize=`cat $db | wc -c` newsize=`cat $tmpfile | wc -c` if [ $? -ne 0 -o "$oldsize" != "$newsize" ]; then status=$FAIL rm -f $tmpfile echo "Error editing $db" continue fi trap '' 0 1 2 3 15 cp $tmpfile /tmp/`basename $db` || { status=$FAIL rm -f $tmpfile echo "Error installing new $db" continue } rm -f $tmpfile trap 0 1 2 3 15 status=$OK done return $status } ########################################################################### #MAIN case $1 in APPLY_CHECK) is_loaded $SME_PKG || exit $OK ;; PRE_LOAD) is_loaded $SME_PKG || exit $OK save_driver || exit $WARN ;; POST_LOAD) is_loaded $SME_PKG || exit $OK edit_customdb || exit $FAIL ;; ENABLE) FLAG=Install is_loaded $SME_PKG || exit $OK chk_driver || exit $WARN install_driver || exit $WARN custom_relink || exit $WARN ;; DISABLE) FLAG=Restore is_loaded $SME_PKG || exit $OK chk_driver || exit $WARN restore_driver || exit $FAIL install_driver || exit $WARN user_relink || exit $FAIL ;; *) # do nothing in other phases ;; esac exit $OK 070701000238be000081a400000000000000030000000135aefcd6000008e400001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/scripts/custom/cqs: # # @(#) cqs 60.1 97/01/09 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1997 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Custom Control Script (ccs) # OK=0; FAIL=1; WARN=2 keys=$1 pkgs=$2 llincfgmsg="false" LLI_DEBUG=/tmp/_lli_debug . ccsSetup.sh . ${SSO_SHARED_ROOT}/cntl/instlib.sh iqmsave() { if [ -f "$IQM_FILE" ] then . $IQM_FILE [ "$IQM_LLI_DRVBD" ] && grep "^IQM_LLI" $IQM_FILE > $CCS_PERSISTENT_STORAGE/lli_iqm_file fi } SSOupgrade() { SAVE_DIR=$CCS_PERSISTENT_STORAGE/ssoipu # replace AHS 5.[12] ccs script if this is an IPU. # otherwise, net0 doesn't get removed properly ver= for i in 5.0.1i 5.0.3c do ver=`customquery ListComponents -p ATTACH SCO:lli::$i` if [ -n "$ver" ] then break fi done # if ver is not null, then we must have AHS 5.1 or AHS 5.2 # on this system, so let's continue. Get the lli version # and then overwrite the old ccs with the new ccs. if [ -n "$ver" ] then lli_ver=`echo "$ver" | awk -F: '{print $4 }'` OLD_LLI_DIR=/opt/K/SCO/lli/${lli_ver}/cntl NEW_LLI_CCS="$SSO_SHARED_ROOT"/cntl/ccs if [ -d ${OLD_LLI_DIR} -a -f ${NEW_LLI_CCS} ] then ex_cmd -m "ERR_NULL" cp ${NEW_LLI_CCS} ${OLD_LLI_DIR} fi fi [ "$SSO_UPGRADE_COMPONENTS" ] || { echo "lli cqs: SSO_UPGRADE_COMPONENTS not set" exit $FAIL } rm -f /usr/lib/netconfig/../../name_map oldrel=`echo $SSO_UPGRADE_COMPONENTS | sed -n "s/^.*:.*:\([^:]*\)$/\1/p"` mkdir $CCS_PERSISTENT_STORAGE/ssoipu for sysdb in /var/opt/K/SCO/lli/$oldrel/sysdb/* do [ -f $sysdb ] && cp $sysdb $SAVE_DIR done } if [ -f "$LLI_DEBUG" ] then LLI_DEBUG_FLAG=1 export LLI_DEBUG_FLAG echo "cqs <$*>" echo "About to source $LLI_DEBUG - to continue..." /ibin/sh [ -f "$LLI_DEBUG" ] && . $LLI_DEBUG fi for key in $keys do case "$key" in IQM_SAVE) llincfgmsg="false"; iqmsave ;; OLD_CUSTOM_UPGRADE) llincfgmsg="false" step=$key calldrvpkgscripts ncfg_tbird_upgrade -ncfg if [ -f /usr/lib/custom/lli.rmv ] then cp ${SSO_SHARED_ROOT}/cntl/oldcustom.rmv /usr/lib/custom/lli.rmv fi ;; UPGRADE) llincfgmsg="false"; SSOupgrade ;; esac done if [ "$llincfgmsg" = "true" ] then echo $CQS_NCFG_MSG fi exit $OK 070701000238bf000081a400000000000000030000000135aefcd60000038000001dff0000000100000000000000000000003100000000root/usr/src/O5hdk/net/scripts/custom/instlib.sh: # # @(#) instlib.sh 60.1 97/01/30 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1997 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. pkgscripts=${SSO_SHARED_ROOT}/cntl/packages LLI_DOCTITLE="Network Driver Configuration Notes" # package specific stuff done by calling driver package scripts # expects "$pkgs", "$step", and "$key" to be set by calling script calldrvpkgscripts() { for pkg in $pkgs do p=`getPackageCode $pkg` DOCPKG=$pkgscripts/$p/ccs case $p in "") ;; *CORE) ;; *NCFG) ;; *Control) ;; *_DOC) if [ -f "$DOCPKG" ] then sh $DOCPKG "$step" "$key" "$pkgs" || ret=$FAIL fi ;; *) sh ${pkgscripts}/pkg.drv "$step" "$key" "$p" # exit with most severe exit code case $? in 1) ret=1 ;; 2) [ "$ret" = "0" ] && ret=2 ;; esac ;; esac done } 070701000238c0000081a400000000000000030000000135aefcd300000fe500001dff0000000100000000000000000000002c00000000root/usr/src/O5hdk/net/scripts/custom/perms# # @(#) perms 5.1 94/08/04 SCOINC # # COMPATIBILITY NOTE: # This file is provided for backwards compatibility only. It's # contents are not intended to represent any complete or actual # product. # # Existing custom format products may use fixperm in init or prep # scripts to determine whether or not a package is already installed # on the system. New custom format products do not use perms lists. # # This file is designed to allow 'fixperm' status checking commands in # existing product installation scripts to succeed and return useful # information about software packages distributed in the # new custom format. It allows status checking at the package level # only. It is not intended to function properly for any 'fixperm' # commands which list file names, check status on particular files, # create files, or modify permissions on files. # # Copyright (C) The Santa Cruz Operation, 1994. # This Module contains Proprietary Information of # The Santa Cruz Operation, and Lachman Associates Inc. # and should be treated as Confidential. # #prd=lli #typ=ku386 #rel=VERSION_REPLACED_FROM_Make.inc #set="SCO LLI Drivers" # # User id's: # uid bin 2 # # Group id's: # gid bin 2 # # Fields are: package [d,f,x]mode, user/group, links, path, volume # #!ALL 700 Entire LLI Disk # PERM f644 bin/bin 1 /etc/perms/lli 000 # #!BTOK 82 IBM Busmaster Token Ring Adapter Driver # BTOK f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/btok/Driver.o # #!EEA 64 Intel EtherExpress 16 # EEA f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/eeA/Driver.o # #!EEB 396 Intel EtherExpress Flash32 LLI Driver # EEB f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/eeB/Driver.o # #!E3A 64 3Com 501 Driver # E3A f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/e3A/Driver.o # #!E3B 98 3Com 503 Driver # E3B f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/e3B/Driver.o # #!E3C 114 3Com 523 Driver # E3C f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/e3C/Driver.o # #!E3D 114 3Com 507 Driver # E3D f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/e3D/Driver.o # #!E3E 446 3Com EtherLink III Driver # E3E f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/e3E/Driver.o # #!EXOS 64 Excelan 205 Ethernet Driver # EXOS f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/exos/Driver.o # #!HPE 128 HP EISA-32 SCO LLI Driver # HPE f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/hpe/Driver.o # #!HPI 128 HP ISA SCO LLI Driver # HPI f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/hpi/Driver.o # #!I3B 64 ES-3210 Racal Interlan Driver # I3B f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/i3B/Driver.o # #!I6E 64 NI6510 Racal Interlan Driver # I6E f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/i6E/Driver.o # #!NAT 104 Novell NE2000 Ethernet Driver # NAT f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/nat/Driver.o # #!NE 506 Novell NE3200 Bus Master Ethernet # NE f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/ne/Driver.o # #!PNT 64 AMD PCNet Family # PNT f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/pnt/Driver.o # #!SEBM 114 SMC Elite32 Ultra LAN Adapter LLI Driver # SEBM f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/sebm/Driver.o # #!SME 114 SMC EtherCard Elite16 Ultra LAN Adapter Driver # SME f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/sme/Driver.o # #!TOK 82 IBM Token Ring Adapter Driver # TOK f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/tok/Driver.o # #!WDN 104 SMC/WD 8003/8013 Driver # WDN f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/wdn/Driver.o # #!WWDU 492 IBM Streamer Family Adapter Device Driver # WWDU f755 bin/bin 1 /var/opt/K/SCO/lli/VERSION_REPLACED_FROM_Make.inc/ID/wwdu/Driver.o 070701000238c1000081a400000000000000030000000135aefcd600000c0e00001dff0000000100000000000000000000002f00000000root/usr/src/O5hdk/net/scripts/custom/pkg.core: # # @(#) pkg.core 12.2 96/02/28 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Custom Control Script (ccs) # OK=0; FAIL=1; WARN=2 PATH=${PATH}:/usr/bin:${SSO_SHARED_ROOT}/bin ret=$OK step=$1 key=$2 shift; shift pkgs=$* . ccsSetup.sh . ${SSO_SHARED_ROOT}/cntl/instlib.sh postattach() { if [ "$key" = "UPGRADE" ] then cwd=`pwd` cd $SSO_OLD_CLIENT_ROOTS/ID find . -print | cpio -dump /$SSO_CLIENT_ROOT/ID 2>/dev/null cd $cwd # remove drivers with broken symlinks for i in `ndinstall -l` do [ -f /$SSO_CLIENT_ROOT/ID/$i/Driver.o ] || { ndinstall -d $i } done fi return $OK } preregister() { # move previous config info from PERSIST to stanza files if [ "$key" = "OLD_CUSTOM_UPGRADE" ] then p="" for pkg in $pkgs do p="${p} `getPackageCode $pkg`" done ndipu $p elif [ "$key" = "UPGRADE" ] then for sysdb in $CCS_PERSISTENT_STORAGE/ssoipu/* do ccsExec mv $sysdb $SSO_CLIENT_ROOT/sysdb done elif [ -s "$CCS_PERSISTENT_STORAGE/lli_iqm_file" ] then . $CCS_PERSISTENT_STORAGE/lli_iqm_file llicfg=$SSO_CLIENT_ROOT/sysdb/$IQM_LLI_DRVBD for attr in ${IQM_LLI_ATTRS:-} do if [ ! -z "$attr" ] then eval tmp=\$IQM_LLI_$attr # kludge to handle single KEY from iqmacfg for PCI if [ "$attr" = "PCI_BUSDEVFUNC" ] then bus=`echo $tmp | awk -F: '{ print $1 }'` device=`echo $tmp | awk -F: '{ print $2 }'` function=`echo $tmp | awk -F: '{ print $3 }'` echo "PCI_BUS:" >> $llicfg echo " SELECT=\"$bus\"" >> $llicfg echo "PCI_DEV:" >> $llicfg echo " SELECT=\"$device\"" >> $llicfg echo "PCI_FUNC:" >> $llicfg echo " SELECT=\"$function\"" >> $llicfg else echo "${attr}:" >> $llicfg echo "$tmp" | grep "[ ]" > /dev/null 2>&1 if [ "$?" = "0" ] then echo " SELECT=\"$tmp\"" >> $llicfg else echo " SELECT=$tmp" >> $llicfg fi fi fi done echo "ADAPTER:" >> $llicfg if [ ! -z "$IQM_LLI_DESC" ] then echo " DESCRIPTION=\"${IQM_LLI_DESC}\"" >> $llicfg fi echo " AOF=$IQM_LLI_MDI_DRV/AOF/$IQM_LLI_AOF_NAME" >> $llicfg if [ "$IQM_LLI_MDI_DRV" = "wdn" -a "$IQM_LLI_AOF_NAME" = "wdn-isa" ] then echo " REQUIRED=" >> $llicfg fi fi return $OK } preconfigure() { cwd=`pwd` cd ${SSO_SHARED_ROOT}/ncfg/net0 ccsExec ncfginstall -a net0 if [ "$key" = "UPGRADE" ] then # "ncfginstall -a net0" above parses /tmp/llincfgPchains for Pel in `ncfginstall -P` do case $Pel in net[0-9]*) ccsExec ncfginstall -a $Pel ;; esac done fi cd $cwd return $OK } postunconfigure() { for i in `ncfginstall -l` do case $i in net[0-9]*) ccsExec ncfginstall -d $i ;; esac done } # MAIN Main main if [ "$LLI_DEBUG_FLAG" ] then echo "lli pkg.core $*" [ -f "$LLI_DEBUG" ] && . $LLI_DEBUG fi case "$step" in POST_ATTACH) postattach ;; PRE_REGISTER) preregister ;; PRE_CONFIGURE) preconfigure ;; POST_UNCONFIGURE) postunconfigure esac exit $ret 070701000238c2000081a400000000000000030000000135aefcd6000008e200001dff0000000100000000000000000000002f00000000root/usr/src/O5hdk/net/scripts/custom/pkg.ncfg: # # @(#) pkg.ncfg 10.1 95/04/05 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Package Control Script (pkg) # OK=0; FAIL=1; WARN=2 ret=$OK step=$1 key=$2 pkgs=$3 . ccsSetup.sh # Set NCFG_DIR shell variable to previous SSO Client Root if SSO upgrade set_ncfg_dir() { case "$key" in UPGRADE) [ "$SSO_UPGRADE_COMPONENTS" ] || return 0 oldrel=`echo $SSO_UPGRADE_COMPONENTS | sed -n "s/^.*:.*:\([^:]*\)$/\1/p"` NCFG_DIR=/var/opt/K/SCO/lli/$oldrel/ncfg/olddir ;; *) NCFG_DIR=/usr/lib/netconfig ;; esac } # copy any files in /usr/lib/netconfig that have been provided by # netconfig chain elements into the client SSO. save_netconfig() { set_ncfg_dir [ -d $NCFG_DIR ] || return 0 ccsLog "Saving files in $NCFG_DIR\n\tto $SSO_CLIENT_ROOT/ncfg/olddir..." cd $NCFG_DIR find . -print | cpio -dump /$SSO_CLIENT_ROOT/ncfg/olddir 2>/dev/null cd / ccsExec rm -rf $NCFG_DIR } # Restore files inside SSO to /usr/lib/netconfig restore_netconfig() { ccsLog "Restoring files to /usr/lib/netconfig\n\tfrom $SSO_CLIENT_ROOT/ncfg/olddir..." cd /$SSO_CLIENT_ROOT/ncfg/olddir ccsExec mkdir /usr/lib/netconfig find . -print | cpio -dump /usr/lib/netconfig 2>/dev/null cd / ccsExec rm -rf /$SSO_CLIENT_ROOT/ncfg/olddir } postattach() { ccsExec touch /$SSO_CLIENT_ROOT/ncfg/olddir/chains save_netconfig return $OK } preunattach() { # SSO-SSO IPU - don't wipe out new netconfig in deferred unattach if [ -h /usr/lib/netconfig ] then return else restore_netconfig fi } preregister() { # preunattach saved this junk because removal scripts don't get UPGRADE key [ "$key" = "UPGRADE" ] && ccsExec rm -rf /usr/lib/netconfig } preconfigure() { ccsExec scoadmin -p Networks -c /$SSO_SHARED_ROOT/ncfg/netconfig.obj } postunconfigure() { ccsExec scoadmin -P Networks -d netconfig.obj } # MAIN Main main PATH=$PATH:/usr/bin if [ "$LLI_DEBUG_FLAG" ] then echo "lli pkg.ncfg $*" [ -f "$LLI_DEBUG" ] && . $LLI_DEBUG fi case "$step" in POST_ATTACH) postattach ;; PRE_REGISTER) preregister ;; PRE_CONFIGURE) preconfigure ;; PRE_UNATTACH) preunattach ;; POST_UNCONFIGURE) postunconfigure ;; esac exit $ret 070701000238c3000081a400000000000000030000000135aefcd600000b2d00001dff0000000100000000000000000000003000000000root/usr/src/O5hdk/net/scripts/custom/tbird.rmv: # # @(#) tbird.rmv 9.3 95/03/15 SCOINC # # # Copyright (C) The Santa Cruz Operation, 1988-1995. # This Module contains Proprietary Information of # The Santa Cruz Operation, and Lachman Associates Inc. # and should be treated as Confidential. # PCHAINS=/tmp/llincfgPchains # Remove temp files and exit with the status passed as argument if [ -z "$*" ] then args="ALL" else args="$*" fi if [ "$args" = "ALL" -o "$args" = "all" ] then args="a2x btok eeA eeB e3A e3B e3C e3D e3E exos hpe hpi i3B i6E nat ne pnt sebm sme tok wdn wwdu" fi DRIVERS="" for i in $args do case $i in "A2X"|"a2x") DRIVERS=${DRIVERS}" a2x3 a2x2 a2x1 a2x0";; "BTOK"|"btok") DRIVERS=${DRIVERS}" btok3 btok2 btok1 btok0";; "EEA"|"eeA"|"eea") DRIVERS=${DRIVERS}" eeA3 eeA2 eeA1 eeA0";; "EEB"|"eeB"|"eeb") DRIVERS=${DRIVERS}" eeB3 eeB2 eeB1 eeB0";; "E3A"|"e3A"|"e3a") DRIVERS=${DRIVERS}" e3A3 e3A2 e3A1 e3A0";; "E3B"|"e3B"|"e3b") DRIVERS=${DRIVERS}" e3B3 e3B2 e3B1 e3B0";; "E3C"|"e3C"|"e3c") DRIVERS=${DRIVERS}" e3C3 e3C2 e3C1 e3C0";; "E3D"|"e3D"|"e3d") DRIVERS=${DRIVERS}" e3D3 e3D2 e3D1 e3D0";; "E3E"|"e3E"|"e3e") DRIVERS=${DRIVERS}" e3E3 e3E2 e3E1 e3E0";; "EXOS"|"exos") DRIVERS=${DRIVERS}" exos3 exos2 exos1 exos0";; "HPI"|"hpi") DRIVERS=${DRIVERS}" hpi3 hpi2 hpi1 hpi0";; "HPE"|"hpe") DRIVERS=${DRIVERS}" hpe3 hpe2 hpe1 hpe0";; "I3B"|"i3B"|"i3b") DRIVERS=${DRIVERS}" i3B3 i3B2 i3B1 i3B0";; "I6E"|"i6E"|"i6e") DRIVERS=${DRIVERS}" i6E1 i6E0";; "NAT"|"nat") DRIVERS=${DRIVERS}" nat3 nat2 nat1 nat0";; "NE"|"ne") DRIVERS=${DRIVERS}" ne3 ne2 ne1 ne0 ne_d";; "PNT"|"pnt") DRIVERS=${DRIVERS}" pnt3 pnt2 pnt1 pnt0";; "SEBM"|"sebm") DRIVERS=${DRIVERS}" sebm3 sebm2 sebm1 sebm0";; "SME"|"sme") DRIVERS=${DRIVERS}" sme3 sme2 sme1 sme0";; "TOK"|"tok") DRIVERS=${DRIVERS}" tok1 tok0";; "WDN"|"wdn") DRIVERS=${DRIVERS}" wdn3 wdn2 wdn1 wdn0";; "WWDU"|"wwdu") DRIVERS=${DRIVERS}" wwdu3 wwdu2 wwdu1 wwdu0";; esac done if [ -z "$DRIVERS" ] then exit 0 fi for i in $DRIVERS do drv=`echo $i | sed -e 's/[0-9]*$//` if [ -f /usr/lib/netconfig/chains -a -x /etc/netconfig -a -f $PCHAINS ] then for j in `/etc/netconfig -s | grep "#${i}"` do pchain=\(`/bin/echo $j | sed -e "s/#/)#(/g"`\) if `grep $pchain $PCHAINS >/dev/null 2>&1` then /etc/netconfig -dnr $j >/dev/null 2>&1 fi done fi # # If the driver is still in the link kit, crowbar it out # /etc/conf/bin/idcheck -p $i if [ $? -gt 16 ] then /etc/conf/bin/idinstall -d -e $i fi # # Remove some files that are still going to be kicking about # rm -f /usr/lib/mkdev/$drv cd /usr/lib/netconfig rm -f info/$i init/${i}* remove/$i reconf/$i cd /usr/lib/lli rm -f init/$i remove/$i reconf/$i [ "$drv" = "tok" ] && rm -f /usr/lib/lli/tok/noroute* [ "$drv" = "btok" ] && rm -f /usr/lib/lli/btok/noroute* done exit 0 070701000238c4000081a400000000000000030000000135aefcd60000063a00001dff0000000100000000000000000000003000000000root/usr/src/O5hdk/net/scripts/custom/tbird.upgfo# @(#) tbird.upg 5.3 94/08/16 SCOINC # FileMOG sets file mode, owner, group proc FileMOG { file mode owner group } \ { chmod $mode $file chown $owner $file chgrp $group $file } # SaveRmvScripts saves NOT partial netconfig Remove scripts and stubs real ones proc SaveRmvScripts { Pchains } \ { global NCFG_DIR global RESTORE_DIR foreach el [ GetElements $Pchains ] { set rmv $NCFG_DIR/remove/$el file stat $rmv fstat exec cp $rmv $RESTORE_DIR/$el if { $fstat(nlink) > 1 } { unlink $rmv } set fd [ open $rmv w ] puts $fd "exit 0" close $fd FileMOG $rmv $fstat(mode) $fstat(uid) $fstat(gid) FileMOG $RESTORE_DIR/$el $fstat(mode) $fstat(uid) $fstat(gid) } } proc RestoreRmvScript { Pchains el } { global NCFG_DIR global RESTORE_DIR set to $NCFG_DIR/remove/$el set from $RESTORE_DIR/$el file stat $from fstat exec cp $from $to unlink $from FileMOG $to $fstat(mode) $fstat(uid) $fstat(gid) } # main Main MAIN if { [ llength $argv ] == 0 } { puts stderr "Usage\n\tncfg_tbird_upgrade -ncfg | \[...\]" exit $FAIL } else { if { ! [ file exists $PCHAINS ] } { if { [ file exists $CHAINS ] } { exec cp $CHAINS $PCHAINS } else { exit $OK } } } case [ lindex $argv 0 ] { -ncfg { mkdir $RESTORE_DIR SaveRmvScripts $PCHAINS exit $OK } } foreach llielement $argv { foreach ncfgelement [ GetElements $PCHAINS ] { if { ! [ string compare $llielement $ncfgelement ] } { SetPartial $PCHAINS $ncfgelement if [ file isdirectory $RESTORE_DIR ] { RestoreRmvScript $PCHAINS $llielement } break } } } exit $OK 070701000238c6000081a400000000000000030000000135aefcd2000097e900001dff0000000100000000000000000000002500000000root/usr/src/O5hdk/net/sys/attdlpi.h/* * @(#) attdlpi.h 7.1 94/11/09 SCOINC * * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #ifndef _NET_DLPI_H /* wrapper symbol for kernel use */ #define _NET_DLPI_H /* subject to change without warning */ /* * dlpi.h header for Data Link Provider Interface */ /* * This header file has encoded the values so an existing driver * or user which was written with the Logical Link Interface(LLI) * can migrate to the DLPI interface in a binary compatible manner. * Any fields which require a specific format or value are flagged * with a comment containing the message LLI compatibility. */ /* * DLPI revision definition history */ #define DL_CURRENT_VERSION 0x02 /* current version of dlpi */ #define DL_VERSION_2 0x02 /* version of dlpi March 12,1991 */ /* * Primitives for Local Management Services */ #define DL_INFO_REQ 0x00 /* Information Req, LLI compatibility */ #define DL_INFO_ACK 0x03 /* Information Ack, LLI compatibility */ #define DL_ATTACH_REQ 0x0b /* Attach a PPA */ #define DL_DETACH_REQ 0x0c /* Detach a PPA */ #define DL_BIND_REQ 0x01 /* Bind dlsap address, LLI compatibility */ #define DL_BIND_ACK 0x04 /* Dlsap address bound, LLI compatibility */ #define DL_UNBIND_REQ 0x02 /* Unbind dlsap address, LLI compatibility */ #define DL_OK_ACK 0x06 /* Success acknowledgment, LLI compatibility */ #define DL_ERROR_ACK 0x05 /* Error acknowledgment, LLI compatibility */ #define DL_SUBS_BIND_REQ 0x1b /* Bind Subsequent DLSAP address */ #define DL_SUBS_BIND_ACK 0x1c /* Subsequent DLSAP address bound */ #define DL_SUBS_UNBIND_REQ 0x15 /* Subsequent unbind */ #define DL_ENABMULTI_REQ 0x1d /* Enable multicast addresses */ #define DL_DISABMULTI_REQ 0x1e /* Disable multicast addresses */ #define DL_PROMISCON_REQ 0x1f /* Turn on promiscuous mode */ #define DL_PROMISCOFF_REQ 0x20 /* Turn off promiscuous mode */ /* * Primitives used for Connectionless Service */ #define DL_UNITDATA_REQ 0x07 /* datagram send request, LLI compatibility */ #define DL_UNITDATA_IND 0x08 /* datagram receive indication, LLI compatibility */ #define DL_UDERROR_IND 0x09 /* datagram error indication, LLI compatibility */ #define DL_UDQOS_REQ 0x0a /* set QOS for subsequent datagram transmissions */ /* * Primitives used for Connection-Oriented Service */ #define DL_CONNECT_REQ 0x0d /* Connect request */ #define DL_CONNECT_IND 0x0e /* Incoming connect indication */ #define DL_CONNECT_RES 0x0f /* Accept previous connect indication */ #define DL_CONNECT_CON 0x10 /* Connection established */ #define DL_TOKEN_REQ 0x11 /* Passoff token request */ #define DL_TOKEN_ACK 0x12 /* Passoff token ack */ #define DL_DISCONNECT_REQ 0x13 /* Disconnect request */ #define DL_DISCONNECT_IND 0x14 /* Disconnect indication */ #define DL_RESET_REQ 0x17 /* Reset service request */ #define DL_RESET_IND 0x18 /* Incoming reset indication */ #define DL_RESET_RES 0x19 /* Complete reset processing */ #define DL_RESET_CON 0x1a /* Reset processing complete */ /* * Primitives used for Acknowledged Connectionless Service */ #define DL_DATA_ACK_REQ 0x21 /* data unit transmission request */ #define DL_DATA_ACK_IND 0x22 /* Arrival of a command PDU */ #define DL_DATA_ACK_STATUS_IND 0x23 /* Status indication of DATA_ACK_REQ*/ #define DL_REPLY_REQ 0x24 /* Request a DLSDU from the remote */ #define DL_REPLY_IND 0x25 /* Arrival of a command PDU */ #define DL_REPLY_STATUS_IND 0x26 /* Status indication of REPLY_REQ */ #define DL_REPLY_UPDATE_REQ 0x27 /* Hold a DLSDU for transmission */ #define DL_REPLY_UPDATE_STATUS_IND 0x28 /* Status of REPLY_UPDATE req */ /* * Primitives used for XID and TEST operations */ #define DL_XID_REQ 0x29 /* Request to send an XID PDU */ #define DL_XID_IND 0x2a /* Arrival of an XID PDU */ #define DL_XID_RES 0x2b /* request to send a response XID PDU*/ #define DL_XID_CON 0x2c /* Arrival of a response XID PDU */ #define DL_TEST_REQ 0x2d /* TEST command request */ #define DL_TEST_IND 0x2e /* TEST response indication */ #define DL_TEST_RES 0x2f /* TEST response */ #define DL_TEST_CON 0x30 /* TEST Confirmation */ /* * Primitives to get and set the physical address, and to get * Statistics */ #define DL_PHYS_ADDR_REQ 0x31 /* Request to get physical addr */ #define DL_PHYS_ADDR_ACK 0x32 /* Return physical addr */ #define DL_SET_PHYS_ADDR_REQ 0x33 /* set physical addr */ #define DL_GET_STATISTICS_REQ 0x34 /* Request to get statistics */ #define DL_GET_STATISTICS_ACK 0x35 /* Return statistics */ /* * DLPI interface states */ #define DL_UNATTACHED 0x04 /* PPA not attached */ #define DL_ATTACH_PENDING 0x05 /* Waiting ack of DL_ATTACH_REQ */ #define DL_DETACH_PENDING 0x06 /* Waiting ack of DL_DETACH_REQ */ #define DL_UNBOUND 0x00 /* PPA attached, LLI compatibility */ #define DL_BIND_PENDING 0x01 /* Waiting ack of DL_BIND_REQ, LLI compatibility */ #define DL_UNBIND_PENDING 0x02 /* Waiting ack of DL_UNBIND_REQ, LLI compatibility */ #define DL_IDLE 0x03 /* dlsap bound, awaiting use, LLI compatibility */ #define DL_UDQOS_PENDING 0x07 /* Waiting ack of DL_UDQOS_REQ */ #define DL_OUTCON_PENDING 0x08 /* outgoing connection, awaiting DL_CONN_CON */ #define DL_INCON_PENDING 0x09 /* incoming connection, awaiting DL_CONN_RES */ #define DL_CONN_RES_PENDING 0x0a /* Waiting ack of DL_CONNECT_RES */ #define DL_DATAXFER 0x0b /* connection-oriented data transfer */ #define DL_USER_RESET_PENDING 0x0c /* user initiated reset, awaiting DL_RESET_CON */ #define DL_PROV_RESET_PENDING 0x0d /* provider initiated reset, awaiting DL_RESET_RES */ #define DL_RESET_RES_PENDING 0x0e /* Waiting ack of DL_RESET_RES */ #define DL_DISCON8_PENDING 0x0f /* Waiting ack of DL_DISC_REQ when in DL_OUTCON_PENDING */ #define DL_DISCON9_PENDING 0x10 /* Waiting ack of DL_DISC_REQ when in DL_INCON_PENDING */ #define DL_DISCON11_PENDING 0x11 /* Waiting ack of DL_DISC_REQ when in DL_DATAXFER */ #define DL_DISCON12_PENDING 0x12 /* Waiting ack of DL_DISC_REQ when in DL_USER_RESET_PENDING */ #define DL_DISCON13_PENDING 0x13 /* Waiting ack of DL_DISC_REQ when in DL_DL_PROV_RESET_PENDING */ #define DL_SUBS_BIND_PND 0x14 /* Waiting ack of DL_SUBS_BIND_REQ */ #define DL_SUBS_UNBIND_PND 0x15 /* Waiting ack of DL_SUBS_UNBIND_REQ */ /* * DL_ERROR_ACK error return values * */ #define DL_ACCESS 0x02 /* Improper permissions for request, LLI compatibility */ #define DL_BADADDR 0x01 /* DLSAP address in improper format or invalid */ #define DL_BADCORR 0x05 /* Sequence number not from outstanding DL_CONN_IND */ #define DL_BADDATA 0x06 /* User data exceeded provider limit */ #define DL_BADPPA 0x08 /* Specified PPA was invalid */ #define DL_BADPRIM 0x09 /* Primitive received is not known by DLS provider */ #define DL_BADQOSPARAM 0x0a /* QOS parameters contained invalid values */ #define DL_BADQOSTYPE 0x0b /* QOS structure type is unknown or unsupported */ #define DL_BADSAP 0x00 /* Bad LSAP selector, LLI compatibility */ #define DL_BADTOKEN 0x0c /* Token used not associated with an active stream */ #define DL_BOUND 0x0d /* Attempted second bind with dl_max_conind or */ /* dl_conn_mgmt > 0 on same DLSAP or PPA */ #define DL_INITFAILED 0x0e /* Physical Link initialization failed */ #define DL_NOADDR 0x0f /* Provider couldn't allocate alternate address */ #define DL_NOTINIT 0x10 /* Physical Link not initialized */ #define DL_OUTSTATE 0x03 /* Primitive issued in improper state, LLI compatibility */ #define DL_SYSERR 0x04 /* UNIX system error occurred, LLI compatibility */ #define DL_UNSUPPORTED 0x07 /* Requested service not supplied by provider */ #define DL_UNDELIVERABLE 0x11 /* Previous data unit could not be delivered */ #define DL_NOTSUPPORTED 0x12 /* Primitive is known but not supported by DLS provider */ #define DL_TOOMANY 0x13 /* limit exceeded */ #define DL_NOTENAB 0x14 /* Promiscuous mode not enabled */ #define DL_BUSY 0x15 /* Other streams for a particular PPA in the post-attached state */ #define DL_NOAUTO 0x16 /* Automatic handling of XID & TEST responses not supported */ #define DL_NOXIDAUTO 0x17 /* Automatic handling of XID not supported */ #define DL_NOTESTAUTO 0x18 /* Automatic handling of TEST not supported */ #define DL_XIDAUTO 0x19 /* Automatic handling of XID response */ #define DL_TESTAUTO 0x1a /* AUtomatic handling of TEST response*/ #define DL_PENDING 0x1b /* pending outstanding connect indications */ /* * NOTE: The range of error codes, 0x80 - 0xff is reserved for * implementation specific error codes. This reserved range of error * codes will be defined by the DLS Provider. */ /* * DLPI media types supported */ #define DL_CSMACD 0x0 /* IEEE 802.3 CSMA/CD network, LLI Compatibility */ #define DL_TPB 0x1 /* IEEE 802.4 Token Passing Bus, LLI Compatibility */ #define DL_TPR 0x2 /* IEEE 802.5 Token Passing Ring, LLI Compatibility */ #define DL_METRO 0x3 /* IEEE 802.6 Metro Net, LLI Compatibility */ #define DL_ETHER 0x4 /* Ethernet Bus, LLI Compatibility */ #define DL_HDLC 0x05 /* ISO HDLC protocol support, bit synchronous */ #define DL_CHAR 0x06 /* Character Synchronous protocol support, eg BISYNC */ #define DL_CTCA 0x07 /* IBM Channel-to-Channel Adapter */ #define DL_FDDI 0x08 /* Fiber Distributed data interface */ #define DL_OTHER 0x09 /* Any other medium not listed above */ /* * DLPI provider service supported. * These must be allowed to be bitwise-OR for dl_service_mode in * DL_INFO_ACK. */ #define DL_CODLS 0x01 /* support connection-oriented service */ #define DL_CLDLS 0x02 /* support connectionless data link service */ #define DL_ACLDLS 0x04 /* support acknowledged connectionless service*/ /* * DLPI provider style. * The DLPI provider style which determines whether a provider * requires a DL_ATTACH_REQ to inform the provider which PPA * user messages should be sent/received on. */ #define DL_STYLE1 0x0500 /* PPA is implicitly bound by open(2) */ #define DL_STYLE2 0x0501 /* PPA must be explicitly bound via DL_ATTACH_REQ */ /* * DLPI Originator for Disconnect and Resets */ #define DL_PROVIDER 0x0700 #define DL_USER 0x0701 /* * DLPI Disconnect Reasons */ #define DL_CONREJ_DEST_UNKNOWN 0x0800 #define DL_CONREJ_DEST_UNREACH_PERMANENT 0x0801 #define DL_CONREJ_DEST_UNREACH_TRANSIENT 0x0802 #define DL_CONREJ_QOS_UNAVAIL_PERMANENT 0x0803 #define DL_CONREJ_QOS_UNAVAIL_TRANSIENT 0x0804 #define DL_CONREJ_PERMANENT_COND 0x0805 #define DL_CONREJ_TRANSIENT_COND 0x0806 #define DL_DISC_ABNORMAL_CONDITION 0x0807 #define DL_DISC_NORMAL_CONDITION 0x0808 #define DL_DISC_PERMANENT_CONDITION 0x0809 #define DL_DISC_TRANSIENT_CONDITION 0x080a #define DL_DISC_UNSPECIFIED 0x080b /* * DLPI Reset Reasons */ #define DL_RESET_FLOW_CONTROL 0x0900 #define DL_RESET_LINK_ERROR 0x0901 #define DL_RESET_RESYNCH 0x0902 /* * DLPI status values for acknowledged connectionless data transfer */ #define DL_CMD_MASK 0x0f /* mask for command portion of status */ #define DL_CMD_OK 0x00 /* Command Accepted */ #define DL_CMD_RS 0x01 /* Unimplemented or inactivated service */ #define DL_CMD_UE 0x05 /* Data Link User interface error */ #define DL_CMD_PE 0x06 /* Protocol error */ #define DL_CMD_IP 0x07 /* Permanent implementation dependent error*/ #define DL_CMD_UN 0x09 /* Resources temporarily unavailable */ #define DL_CMD_IT 0x0f /* Temporary implementation dependent error */ #define DL_RSP_MASK 0xf0 /* mask for response portion of status */ #define DL_RSP_OK 0x00 /* Response DLSDU present */ #define DL_RSP_RS 0x10 /* Unimplemented or inactivated service */ #define DL_RSP_NE 0x30 /* Response DLSDU never submitted */ #define DL_RSP_NR 0x40 /* Response DLSDU not requested */ #define DL_RSP_UE 0x50 /* Data Link User interface error */ #define DL_RSP_IP 0x70 /* Permanent implementation dependent error */ #define DL_RSP_UN 0x90 /* Resources temporarily unavailable */ #define DL_RSP_IT 0xf0 /* Temporary implementation dependent error */ /* * Service Class values for acknowledged connectionless data transfer */ #define DL_RQST_RSP 0x01 /* Use acknowledge capability in MAC sublayer*/ #define DL_RQST_NORSP 0x02 /* No acknowledgement service requested */ /* * DLPI address type definition */ #define DL_FACT_PHYS_ADDR 0x01 /* factory physical address */ #define DL_CURR_PHYS_ADDR 0x02 /* current physical address */ /* * DLPI flag definitions */ #define DL_POLL_FINAL 0x01 /* if set,indicates poll/final bit set*/ /* * XID and TEST responses supported by the provider */ #define DL_AUTO_XID 0x01 /* provider will respond to XID */ #define DL_AUTO_TEST 0x02 /* provider will respond to TEST */ /* * Subsequent bind type */ #define DL_PEER_BIND 0x01 /* subsequent bind on a peer addr */ #define DL_HIERARCHICAL_BIND 0x02 /* subs_bind on a hierarchical addr*/ /* * DLPI promiscuous mode definitions */ #define DL_PROMISC_PHYS 0x01 /* promiscuous mode at phys level */ #define DL_PROMISC_SAP 0x02 /* promiscous mode at sap level */ #define DL_PROMISC_MULTI 0x03 /* promiscuous mode for multicast */ /* * DLPI Quality Of Service definition for use in QOS structure definitions. * The QOS structures are used in connection establishment, DL_INFO_ACK, * and setting connectionless QOS values. */ /* * Throughput * * This parameter is specified for both directions. */ typedef struct { long dl_target_value; /* desired bits/second desired */ long dl_accept_value; /* min. acceptable bits/second */ } dl_through_t; /* * transit delay specification * * This parameter is specified for both directions. * expressed in milliseconds assuming a DLSDU size of 128 octets. * The scaling of the value to the current DLSDU size is provider dependent. */ typedef struct { long dl_target_value; /* desired value of service */ long dl_accept_value; /* min. acceptable value of service */ } dl_transdelay_t; /* * priority specification * priority range is 0-100, with 0 being highest value. */ typedef struct { long dl_min; long dl_max; } dl_priority_t; /* * protection specification * */ #define DL_NONE 0x0B01 /* no protection supplied */ #define DL_MONITOR 0x0B02 /* protection against passive monitoring */ #define DL_MAXIMUM 0x0B03 /* protection against modification, replay, */ /* addition, or deletion */ typedef struct { long dl_min; long dl_max; } dl_protect_t; /* * Resilience specification * probabilities are scaled by a factor of 10,000 with a time interval * of 10,000 seconds. */ typedef struct { long dl_disc_prob; /* probability of provider init DISC */ long dl_reset_prob; /* probability of provider init RESET */ } dl_resilience_t; /* * QOS type definition to be used for negotiation with the * remote end of a connection, or a connectionless unitdata request. * There are two type definitions to handle the negotiation * process at connection establishment. The typedef dl_qos_range_t * is used to present a range for parameters. This is used * in the DL_CONNECT_REQ and DL_CONNECT_IND messages. The typedef * dl_qos_sel_t is used to select a specific value for the QOS * parameters. This is used in the DL_CONNECT_RES, DL_CONNECT_CON, * and DL_INFO_ACK messages to define the selected QOS parameters * for a connection. * * NOTE * A DataLink provider which has unknown values for any of the fields * will use a value of DL_UNKNOWN for all values in the fields. * * NOTE * A QOS parameter value of DL_QOS_DONT_CARE informs the DLS * provider the user requesting this value doesn't care * what the QOS parameter is set to. This value becomes the * least possible value in the range of QOS parameters. * The order of the QOS parameter range is then: * * DL_QOS_DONT_CARE < 0 < MAXIMUM QOS VALUE */ #define DL_UNKNOWN -1 #define DL_QOS_DONT_CARE -2 /* * Every QOS structure has the first 4 bytes containing a type * field, denoting the definition of the rest of the structure. * This is used in the same manner has the dl_primitive variable * is in messages. * * The following list is the defined QOS structure type values and structures. */ #define DL_QOS_CO_RANGE1 0x0101 /* QOS range struct. for Connection modeservice */ #define DL_QOS_CO_SEL1 0x0102 /* QOS selection structure */ #define DL_QOS_CL_RANGE1 0x0103 /* QOS range struct. for connectionless*/ #define DL_QOS_CL_SEL1 0x0104 /* QOS selection for connectionless mode*/ typedef struct { ulong dl_qos_type; dl_through_t dl_rcv_throughput; /* desired and acceptable*/ dl_transdelay_t dl_rcv_trans_delay; /* desired and acceptable*/ dl_through_t dl_xmt_throughput; dl_transdelay_t dl_xmt_trans_delay; dl_priority_t dl_priority; /* min and max values */ dl_protect_t dl_protection; /* min and max values */ long dl_residual_error; dl_resilience_t dl_resilience; } dl_qos_co_range1_t; typedef struct { ulong dl_qos_type; long dl_rcv_throughput; long dl_rcv_trans_delay; long dl_xmt_throughput; long dl_xmt_trans_delay; long dl_priority; long dl_protection; long dl_residual_error; dl_resilience_t dl_resilience; } dl_qos_co_sel1_t; typedef struct { ulong dl_qos_type; dl_transdelay_t dl_trans_delay; dl_priority_t dl_priority; dl_protect_t dl_protection; long dl_residual_error; } dl_qos_cl_range1_t; typedef struct { ulong dl_qos_type; long dl_trans_delay; long dl_priority; long dl_protection; long dl_residual_error; } dl_qos_cl_sel1_t; /* * DLPI interface primitive definitions. * * Each primitive is sent as a stream message. It is possible that * the messages may be viewed as a sequence of bytes that have the * following form without any padding. The structure definition * of the following messages may have to change depending on the * underlying hardware architecture and crossing of a hardware * boundary with a different hardware architecture. * * Fields in the primitives having a name of the form * dl_reserved cannot be used and have the value of * binary zero, no bits turned on. * * Each message has the name defined followed by the * stream message type (M_PROTO, M_PCPROTO, M_DATA) */ /* * LOCAL MANAGEMENT SERVICE PRIMITIVES */ /* * DL_INFO_REQ, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* set to DL_INFO_REQ */ } dl_info_req_t; /* * DL_INFO_ACK, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* set to DL_INFO_ACK */ ulong dl_max_sdu; /* Max bytes in a DLSDU */ ulong dl_min_sdu; /* Min bytes in a DLSDU */ ulong dl_addr_length; /* length of DLSAP address */ ulong dl_mac_type; /* type of medium supported*/ ulong dl_reserved; /* value set to zero */ ulong dl_current_state; /* state of DLPI interface */ long dl_sap_length; /*current length of SAP part of dlsap address */ ulong dl_service_mode; /* CO, CL or ACL */ ulong dl_qos_length; /* length of qos values */ ulong dl_qos_offset; /* offset from beg. of block*/ ulong dl_qos_range_length; /* available range of qos */ ulong dl_qos_range_offset; /* offset from beg. of block*/ ulong dl_provider_style; /* style1 or style2 */ ulong dl_addr_offset; /* offset of the dlsap addr */ ulong dl_version; /* version number */ ulong dl_brdcst_addr_length; /* length of broadcast addr */ ulong dl_brdcst_addr_offset; /* offset from beg. of block*/ ulong dl_growth; /* set to zero */ } dl_info_ack_t; /* * DL_ATTACH_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* set to DL_ATTACH_REQ*/ ulong dl_ppa; /* id of the PPA */ } dl_attach_req_t; /* * DL_DETACH_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* set to DL_DETACH_REQ */ } dl_detach_req_t; /* * DL_BIND_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* set to DL_BIND_REQ */ ulong dl_sap; /* info to identify dlsap addr*/ ulong dl_max_conind; /* max # of outstanding con_ind*/ ushort dl_service_mode; /* CO, CL or ACL */ ushort dl_conn_mgmt; /* if non-zero, is con-mgmt stream*/ ulong dl_xidtest_flg; /* if set to 1 indicates automatic initiation of test and xid frames */ } dl_bind_req_t; /* * DL_BIND_ACK, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* DL_BIND_ACK */ ulong dl_sap; /* DLSAP addr info */ ulong dl_addr_length; /* length of complete DLSAP addr */ ulong dl_addr_offset; /* offset from beginning of M_PCPROTO*/ ulong dl_max_conind; /* allowed max. # of con-ind */ ulong dl_xidtest_flg; /* responses supported by provider*/ } dl_bind_ack_t; /* * DL_SUBS_BIND_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_SUBS_BIND_REQ */ ulong dl_subs_sap_offset; /* offset of subs_sap */ ulong dl_subs_sap_length; /* length of subs_sap */ ulong dl_subs_bind_class; /* peer or hierarchical */ } dl_subs_bind_req_t; /* * DL_SUBS_BIND_ACK, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* DL_SUBS_BIND_ACK */ ulong dl_subs_sap_offset; /* offset of subs_sap */ ulong dl_subs_sap_length; /* length of subs_sap */ } dl_subs_bind_ack_t; /* * DL_UNBIND_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_UNBIND_REQ */ } dl_unbind_req_t; /* * DL_SUBS_UNBIND_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_SUBS_UNBIND_REQ */ ulong dl_subs_sap_offset; /* offset of subs_sap */ ulong dl_subs_sap_length; /* length of subs_sap */ } dl_subs_unbind_req_t; /* * DL_OK_ACK, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* DL_OK_ACK */ ulong dl_correct_primitive; /* primitive being acknowledged */ } dl_ok_ack_t; /* * DL_ERROR_ACK, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* DL_ERROR_ACK */ ulong dl_error_primitive; /* primitive in error */ ulong dl_errno; /* DLPI error code */ ulong dl_unix_errno; /* UNIX system error code */ } dl_error_ack_t; /* * DL_ENABMULTI_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_ENABMULTI_REQ */ ulong dl_addr_length; /* length of multicast address */ ulong dl_addr_offset; /* offset from beg. of M_PROTO block*/ } dl_enabmulti_req_t; /* * DL_DISABMULTI_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_DISABMULTI_REQ */ ulong dl_addr_length; /* length of multicast address */ ulong dl_addr_offset; /* offset from beg. of M_PROTO block*/ } dl_disabmulti_req_t; /* * DL_PROMISCON_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_PROMISCON_REQ */ ulong dl_level; /* physical,SAP level or ALL multicast*/ } dl_promiscon_req_t; /* * DL_PROMISCOFF_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_PROMISCOFF_REQ */ ulong dl_level; /* Physical,SAP level or ALL multicast*/ } dl_promiscoff_req_t; /* * Primitives to get and set the Physical address */ /* * DL_PHYS_ADDR_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_PHYS_ADDR_REQ */ ulong dl_addr_type; /* factory or current physical addr */ } dl_phys_addr_req_t; /* * DL_PHYS_ADDR_ACK, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* DL_PHYS_ADDR_ACK */ ulong dl_addr_length; /* length of the physical addr */ ulong dl_addr_offset; /* offset from beg. of block */ } dl_phys_addr_ack_t; /* * DL_SET_PHYS_ADDR_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_SET_PHYS_ADDR_REQ */ ulong dl_addr_length; /* length of physical addr */ ulong dl_addr_offset; /* offset from beg. of block */ } dl_set_phys_addr_req_t; /* * Primitives to get statistics */ /* * DL_GET_STATISTICS_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_GET_STATISTICS_REQ */ } dl_get_statistics_req_t; /* * DL_GET_STATISTICS_ACK, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* DL_GET_STATISTICS_ACK */ ulong dl_stat_length; /* length of statistics structure*/ ulong dl_stat_offset; /* offset from beg. of block */ } dl_get_statistics_ack_t; /* * CONNECTION-ORIENTED SERVICE PRIMITIVES */ /* * DL_CONNECT_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_CONNECT_REQ */ ulong dl_dest_addr_length; /* len. of dlsap addr*/ ulong dl_dest_addr_offset; /* offset */ ulong dl_qos_length; /* len. of QOS parm val*/ ulong dl_qos_offset; /* offset */ ulong dl_growth; /* set to zero */ } dl_connect_req_t; /* * DL_CONNECT_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_CONNECT_IND */ ulong dl_correlation; /* provider's correlation token*/ ulong dl_called_addr_length; /* length of called address */ ulong dl_called_addr_offset; /* offset from beginning of block */ ulong dl_calling_addr_length; /* length of calling address */ ulong dl_calling_addr_offset; /* offset from beginning of block */ ulong dl_qos_length; /* length of qos structure */ ulong dl_qos_offset; /* offset from beginning of block */ ulong dl_growth; /* set to zero */ } dl_connect_ind_t; /* * DL_CONNECT_RES, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_CONNECT_RES */ ulong dl_correlation; /* provider's correlation token */ ulong dl_resp_token; /* token associated with responding stream */ ulong dl_qos_length; /* length of qos structure */ ulong dl_qos_offset; /* offset from beginning of block */ ulong dl_growth; /* set to zero */ } dl_connect_res_t; /* * DL_CONNECT_CON, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_CONNECT_CON*/ ulong dl_resp_addr_length; /* length of responder's address */ ulong dl_resp_addr_offset; /* offset from beginning of block*/ ulong dl_qos_length; /* length of qos structure */ ulong dl_qos_offset; /* offset from beginning of block*/ ulong dl_growth; /* set to zero */ } dl_connect_con_t; /* * DL_TOKEN_REQ, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* DL_TOKEN_REQ */ } dl_token_req_t; /* * DL_TOKEN_ACK, M_PCPROTO type */ typedef struct { ulong dl_primitive; /* DL_TOKEN_ACK */ ulong dl_token; /* Connection response token associated with the stream */ }dl_token_ack_t; /* * DL_DISCONNECT_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_DISCONNECT_REQ */ ulong dl_reason; /*normal, abnormal, perm. or transient*/ ulong dl_correlation; /* association with connect_ind */ } dl_disconnect_req_t; /* * DL_DISCONNECT_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_DISCONNECT_IND */ ulong dl_originator; /* USER or PROVIDER */ ulong dl_reason; /* permanent or transient */ ulong dl_correlation; /* association with connect_ind */ } dl_disconnect_ind_t; /* * DL_RESET_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_RESET_REQ */ } dl_reset_req_t; /* * DL_RESET_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_RESET_IND */ ulong dl_originator; /* Provider or User */ ulong dl_reason; /* flow control, link error or resynch*/ } dl_reset_ind_t; /* * DL_RESET_RES, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_RESET_RES */ } dl_reset_res_t; /* * DL_RESET_CON, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_RESET_CON */ } dl_reset_con_t; /* * CONNECTIONLESS SERVICE PRIMITIVES */ /* * DL_UNITDATA_REQ, M_PROTO type, with M_DATA block(s) */ typedef struct { ulong dl_primitive; /* DL_UNITDATA_REQ */ ulong dl_dest_addr_length; /* DLSAP length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ dl_priority_t dl_priority; /* priority value */ } dl_unitdata_req_t; /* * DL_UNITDATA_IND, M_PROTO type, with M_DATA block(s) */ typedef struct { ulong dl_primitive; /* DL_UNITDATA_IND */ ulong dl_dest_addr_length; /* DLSAP length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ ulong dl_src_addr_length; /* DLSAP addr length of sending user*/ ulong dl_src_addr_offset; /* offset from beg. of block */ ulong dl_group_address; /* set to one if multicast/broadcast*/ } dl_unitdata_ind_t; /* * DL_UDERROR_IND, M_PROTO type * (or M_PCPROTO type if LLI-based provider) */ typedef struct { ulong dl_primitive; /* DL_UDERROR_IND */ ulong dl_dest_addr_length; /* Destination DLSAP */ ulong dl_dest_addr_offset; /* Offset from beg. of block */ ulong dl_unix_errno; /* unix system error code*/ ulong dl_errno; /* DLPI error code */ } dl_uderror_ind_t; /* * DL_UDQOS_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_UDQOS_REQ */ ulong dl_qos_length; /* length in bytes of requested qos*/ ulong dl_qos_offset; /* offset from beg. of block */ } dl_udqos_req_t; /* * Primitives to handle XID and TEST operations */ /* * DL_TEST_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_TEST_REQ */ ulong dl_flag; /* poll/final */ ulong dl_dest_addr_length; /* DLSAP length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ } dl_test_req_t; /* * DL_TEST_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_TEST_IND */ ulong dl_flag; /* poll/final */ ulong dl_dest_addr_length; /* dlsap length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ ulong dl_src_addr_length; /* dlsap length of source user */ ulong dl_src_addr_offset; /* offset from beg. of block */ } dl_test_ind_t; /* * DL_TEST_RES, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_TEST_RES */ ulong dl_flag; /* poll/final */ ulong dl_dest_addr_length; /* DLSAP length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ } dl_test_res_t; /* * DL_TEST_CON, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_TEST_CON */ ulong dl_flag; /* poll/final */ ulong dl_dest_addr_length; /* dlsap length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ ulong dl_src_addr_length; /* dlsap length of source user */ ulong dl_src_addr_offset; /* offset from beg. of block */ } dl_test_con_t; /* * DL_XID_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_XID_REQ */ ulong dl_flag; /* poll/final */ ulong dl_dest_addr_length; /* dlsap length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ } dl_xid_req_t; /* * DL_XID_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_XID_IND */ ulong dl_flag; /* poll/final */ ulong dl_dest_addr_length; /* dlsap length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ ulong dl_src_addr_length; /* dlsap length of source user */ ulong dl_src_addr_offset; /* offset from beg. of block */ } dl_xid_ind_t; /* * DL_XID_RES, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_XID_RES */ ulong dl_flag; /* poll/final */ ulong dl_dest_addr_length; /* DLSAP length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ } dl_xid_res_t; /* * DL_XID_CON, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_XID_CON */ ulong dl_flag; /* poll/final */ ulong dl_dest_addr_length; /* dlsap length of dest. user */ ulong dl_dest_addr_offset; /* offset from beg. of block */ ulong dl_src_addr_length; /* dlsap length of source user */ ulong dl_src_addr_offset; /* offset from beg. of block */ } dl_xid_con_t; /* * ACKNOWLEDGED CONNECTIONLESS SERVICE PRIMITIVES */ /* * DL_DATA_ACK_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_DATA_ACK_REQ */ ulong dl_correlation; /* User's correlation token */ ulong dl_dest_addr_length; /* length of destination addr */ ulong dl_dest_addr_offset; /* offset from beginning of block */ ulong dl_src_addr_length; /* length of source address */ ulong dl_src_addr_offset; /* offset from beginning of block */ ulong dl_priority; /* priority */ ulong dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */ } dl_data_ack_req_t; /* * DL_DATA_ACK_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_DATA_ACK_IND */ ulong dl_dest_addr_length; /* length of destination addr */ ulong dl_dest_addr_offset; /* offset from beginning of block */ ulong dl_src_addr_length; /* length of source address */ ulong dl_src_addr_offset; /* offset from beginning of block */ ulong dl_priority; /* priority for data unit transm. */ ulong dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */ } dl_data_ack_ind_t; /* * DL_DATA_ACK_STATUS_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_DATA_ACK_STATUS_IND */ ulong dl_correlation; /* User's correlation token */ ulong dl_status; /* success or failure of previous req*/ } dl_data_ack_status_ind_t; /* * DL_REPLY_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_REPLY_REQ */ ulong dl_correlation; /* User's correlation token */ ulong dl_dest_addr_length; /* length of destination address */ ulong dl_dest_addr_offset; /* offset from beginning of block */ ulong dl_src_addr_length; /* source address length */ ulong dl_src_addr_offset; /* offset from beginning of block */ ulong dl_priority; /* priority for data unit transmission*/ ulong dl_service_class; } dl_reply_req_t; /* * DL_REPLY_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_REPLY_IND */ ulong dl_dest_addr_length; /* length of destination address */ ulong dl_dest_addr_offset; /* offset from beginning of block*/ ulong dl_src_addr_length; /* length of source address */ ulong dl_src_addr_offset; /* offset from beginning of block */ ulong dl_priority; /* priority for data unit transmission*/ ulong dl_service_class; /* DL_RQST_RSP or DL_RQST_NORSP */ } dl_reply_ind_t; /* * DL_REPLY_STATUS_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_REPLY_STATUS_IND */ ulong dl_correlation; /* User's correlation token */ ulong dl_status; /* success or failure of previous req*/ } dl_reply_status_ind_t; /* * DL_REPLY_UPDATE_REQ, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_REPLY_UPDATE_REQ */ ulong dl_correlation; /* user's correlation token */ ulong dl_src_addr_length; /* length of source address */ ulong dl_src_addr_offset; /* offset from beginning of block */ } dl_reply_update_req_t; /* * DL_REPLY_UPDATE_STATUS_IND, M_PROTO type */ typedef struct { ulong dl_primitive; /* DL_REPLY_UPDATE_STATUS_IND */ ulong dl_correlation; /* User's correlation token */ ulong dl_status; /* success or failure of previous req*/ } dl_reply_update_status_ind_t; union DL_primitives { ulong dl_primitive; dl_info_req_t info_req; dl_info_ack_t info_ack; dl_attach_req_t attach_req; dl_detach_req_t detach_req; dl_bind_req_t bind_req; dl_bind_ack_t bind_ack; dl_unbind_req_t unbind_req; dl_subs_bind_req_t subs_bind_req; dl_subs_bind_ack_t subs_bind_ack; dl_subs_unbind_req_t subs_unbind_req; dl_ok_ack_t ok_ack; dl_error_ack_t error_ack; dl_connect_req_t connect_req; dl_connect_ind_t connect_ind; dl_connect_res_t connect_res; dl_connect_con_t connect_con; dl_token_req_t token_req; dl_token_ack_t token_ack; dl_disconnect_req_t disconnect_req; dl_disconnect_ind_t disconnect_ind; dl_reset_req_t reset_req; dl_reset_ind_t reset_ind; dl_reset_res_t reset_res; dl_reset_con_t reset_con; dl_unitdata_req_t unitdata_req; dl_unitdata_ind_t unitdata_ind; dl_uderror_ind_t uderror_ind; dl_udqos_req_t udqos_req; dl_enabmulti_req_t enabmulti_req; dl_disabmulti_req_t disabmulti_req; dl_promiscon_req_t promiscon_req; dl_promiscoff_req_t promiscoff_req; dl_phys_addr_req_t physaddr_req; dl_phys_addr_ack_t physaddr_ack; dl_set_phys_addr_req_t set_physaddr_req; dl_get_statistics_req_t get_statistics_req; dl_get_statistics_ack_t get_statistics_ack; dl_test_req_t test_req; dl_test_ind_t test_ind; dl_test_res_t test_res; dl_test_con_t test_con; dl_xid_req_t xid_req; dl_xid_ind_t xid_ind; dl_xid_res_t xid_res; dl_xid_con_t xid_con; dl_data_ack_req_t data_ack_req; dl_data_ack_ind_t data_ack_ind; dl_data_ack_status_ind_t data_ack_status_ind; dl_reply_req_t reply_req; dl_reply_ind_t reply_ind; dl_reply_status_ind_t reply_status_ind; dl_reply_update_req_t reply_update_req; dl_reply_update_status_ind_t reply_update_status_ind; }; #define DL_INFO_REQ_SIZE sizeof(dl_info_req_t) #define DL_INFO_ACK_SIZE sizeof(dl_info_ack_t) #define DL_ATTACH_REQ_SIZE sizeof(dl_attach_req_t) #define DL_DETACH_REQ_SIZE sizeof(dl_detach_req_t) #define DL_BIND_REQ_SIZE sizeof(dl_bind_req_t) #define DL_BIND_ACK_SIZE sizeof(dl_bind_ack_t) #define DL_UNBIND_REQ_SIZE sizeof(dl_unbind_req_t) #define DL_SUBS_BIND_REQ_SIZE sizeof(dl_subs_bind_req_t) #define DL_SUBS_BIND_ACK_SIZE sizeof(dl_subs_bind_ack_t) #define DL_SUBS_UNBIND_REQ_SIZE sizeof(dl_subs_unbind_req_t) #define DL_OK_ACK_SIZE sizeof(dl_ok_ack_t) #define DL_ERROR_ACK_SIZE sizeof(dl_error_ack_t) #define DL_CONNECT_REQ_SIZE sizeof(dl_connect_req_t) #define DL_CONNECT_IND_SIZE sizeof(dl_connect_ind_t) #define DL_CONNECT_RES_SIZE sizeof(dl_connect_res_t) #define DL_CONNECT_CON_SIZE sizeof(dl_connect_con_t) #define DL_TOKEN_REQ_SIZE sizeof(dl_token_req_t) #define DL_TOKEN_ACK_SIZE sizeof(dl_token_ack_t) #define DL_DISCONNECT_REQ_SIZE sizeof(dl_disconnect_req_t) #define DL_DISCONNECT_IND_SIZE sizeof(dl_disconnect_ind_t) #define DL_RESET_REQ_SIZE sizeof(dl_reset_req_t) #define DL_RESET_IND_SIZE sizeof(dl_reset_ind_t) #define DL_RESET_RES_SIZE sizeof(dl_reset_res_t) #define DL_RESET_CON_SIZE sizeof(dl_reset_con_t) #define DL_UNITDATA_REQ_SIZE sizeof(dl_unitdata_req_t) #define DL_UNITDATA_IND_SIZE sizeof(dl_unitdata_ind_t) #define DL_UDERROR_IND_SIZE sizeof(dl_uderror_ind_t) #define DL_UDQOS_REQ_SIZE sizeof(dl_udqos_req_t) #define DL_ENABMULTI_REQ_SIZE sizeof(dl_enabmulti_req_t) #define DL_DISABMULTI_REQ_SIZE sizeof(dl_disabmulti_req_t) #define DL_PROMISCON_REQ_SIZE sizeof(dl_promiscon_req_t) #define DL_PROMISCOFF_REQ_SIZE sizeof(dl_promiscoff_req_t) #define DL_PHYS_ADDR_REQ_SIZE sizeof(dl_phys_addr_req_t) #define DL_PHYS_ADDR_ACK_SIZE sizeof(dl_phys_addr_ack_t) #define DL_SET_PHYS_ADDR_REQ_SIZE sizeof(dl_set_phys_addr_req_t) #define DL_GET_STATISTICS_REQ_SIZE sizeof(dl_get_statistics_req_t) #define DL_GET_STATISTICS_ACK_SIZE sizeof(dl_get_statistics_ack_t) #define DL_XID_REQ_SIZE sizeof(dl_xid_req_t) #define DL_XID_IND_SIZE sizeof(dl_xid_ind_t) #define DL_XID_RES_SIZE sizeof(dl_xid_res_t) #define DL_XID_CON_SIZE sizeof(dl_xid_con_t) #define DL_TEST_REQ_SIZE sizeof(dl_test_req_t) #define DL_TEST_IND_SIZE sizeof(dl_test_ind_t) #define DL_TEST_RES_SIZE sizeof(dl_test_res_t) #define DL_TEST_CON_SIZE sizeof(dl_test_con_t) #define DL_DATA_ACK_REQ_SIZE sizeof(dl_data_ack_req_t) #define DL_DATA_ACK_IND_SIZE sizeof(dl_data_ack_ind_t) #define DL_DATA_ACK_STATUS_IND_SIZE sizeof(dl_data_ack_status_ind_t) #define DL_REPLY_REQ_SIZE sizeof(dl_reply_req_t) #define DL_REPLY_IND_SIZE sizeof(dl_reply_ind_t) #define DL_REPLY_STATUS_IND_SIZE sizeof(dl_reply_status_ind_t) #define DL_REPLY_UPDATE_REQ_SIZE sizeof(dl_reply_update_req_t) #define DL_REPLY_UPDATE_STATUS_IND_SIZE sizeof(dl_reply_update_status_ind_t) #endif /* _NET_DLPI_H */ 070701000238c7000081a400000000000000030000000135aefcd200002b4100001dff0000000100000000000000000000002500000000root/usr/src/O5hdk/net/sys/dlpimod.h/* * @(#) dlpimod.h 58.2 96/09/25 SCOINC * * Copyright (C) The Santa Cruz Operation, 1993-1996. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #ifndef _sys_dlpimod_h #define _sys_dlpimod_h #define dlpi_frame_test /* for dlpi_biloop support */ typedef struct per_card_info per_card_info_t; typedef struct per_sap_info per_sap_info_t; /****************************************************************************** * Media dependent frame processing information: * This section is used to store information about a frame as it is being * processed. ******************************************************************************/ struct per_frame_info { unchar * frame_dest; /* Ptr to MAC Destination Address */ unchar dest_type; /*FR_UNICAST/FR_MULTICAST/FR_BROADCAST*/ unchar frame_dsap; /* LLC DSAP (if llcmode is LLC_1) */ unchar * frame_src; /* Ptr to MAC Source Address */ unchar frame_ssap; /* LLC SSAP (if llcmode is LLC_1) */ ulong frame_type; /* FR_ETHER_II/FR_LLC/FR_XNS */ ulong frame_sap; /* SAP Bound */ uint frame_len; /* Frame length */ unchar * frame_data; /* Pointer to MAC Data */ uint route_present; /* Route Information field present */ uint route_len; /* Source Route length (if any) */ unchar * route_info; /* Pointer to Route Info field */ mblk_t *unitdata; /* DL_UNITDATA(REQ/IND) received */ }; /* Valid values for dest_type field */ #define FR_UNICAST 0 #define FR_MULTICAST 1 #define FR_BROADCAST 2 /****************************************************************************** * DLPI Module Information * This section is used to store information used internally by the DLPI * module. ******************************************************************************/ struct sap_counters { ulong bcast; /* #Frames Broadcast */ ulong mcast; /* #Frames Multicast */ ulong ucast_xid; /* #LLC XID Frames (Unicast) */ ulong ucast_test; /* #LLC TEST Frames (Unicast) */ ulong ucast; /* #Frames Unicast (not covered above) */ ulong error; /* #Frames with errors */ ulong octets; /* #MAC Octets sent/received */ }; struct per_sap_info { struct lockb lock_sap_stats; /* per sap stats lock */ /* BIND Related information */ ulong sap_type; /* FR_ETHER_II/FR_LLC/FR_XNS */ ulong sap; /* Bind address */ ulong sap_state; /* SAP_FREE/ALLOC/BOUND */ ulong sap_protid; /* used for SNAP SAPs only */ queue_t *up_queue; /* (READ)queue to proto'stk */ per_card_info_t *card_info; ulong srmode; /* SR_NON/SR_AUTO/SR_STACK */ ulong llcmode; /* LLC_OFF/LLC_1 */ ulong dlpimode; /* LLI31_STACK/DLPI20_STACK */ ulong llcxidtest_flg; /* dl_xidtest_flg in DL_BIND */ struct sap_counters sap_tx; /* Statistics for sends */ struct sap_counters sap_rx; /* Statistics for receives */ /* DLPI PRIMITIVE currently being processed */ ulong dlpi_prim; }; /* * Type: dlpi_init_t * * Purpose: * Configurable variables that get set in the Space.c file. * Its real purpose is to have the initializers be a manageable * enough size to avoid errors. */ typedef struct dlpi_init_s { int is_mp; int txmon_consume_time; int txmon_enabled; } dlpi_init_t; /* * Type: txmon_t * * Purpose: * Transmit traffic monitoring data. * Fields: * trylock : lock access to code * last_qsize : qsize last time we checked * last_send_time : time of last time we thought the * card consumed a message ie. delivered * a packet to the card * restart_in_progress: Counter used by txmon to send HWFAIL * to dlpi daemon, and is expecting it * to re-open/I_LINK mdi driver * nrestarts : number of txmon restarts */ typedef struct txmon_s { trylock_t trylock; int last_qsize; time_t last_send_time; int restart_in_progress; int nrestarts; } txmon_t; /* Valid values for sap_state */ #define SAP_FREE 0 /* SAP not in use */ #define SAP_ALLOC 1 /* SAP allocated, but not in use */ #define SAP_BOUND 2 /* SAP allocated, and in use */ /* Valid values for dlpimode */ #define LLI31_STACK 0 /* LLI 3.1 compatible stack */ #define DLPI20_STACK 1 /* DLPI 2.0 compatible stack */ typedef enum { MIOCRET_PUTBQ, /* Put the message back on the queue for */ /* later processing */ MIOCRET_DONE, /* The ioctl has been handled (ACK/NAK) */ MIOCRET_NOT_MINE /* This ioctl is not recognized by the media */ /* manager. Send it to the MDI driver */ } miocret_t; #ifdef _NO_PROTOTYPE /* The link kit can not handle modern code */ typedef void (*media_init_t)(); typedef void (*media_halt_t)(); typedef int (*media_svc_reg_t)(); typedef int (*media_svc_rcv_t)(); typedef void (*media_svc_close_t)(); typedef int (*make_hdr_t)(); typedef void (*rx_parse_t)(); typedef int (*rx_errors_t)(); typedef int (*tx_errors_t)(); typedef miocret_t (*media_ioctl_t)(); #else typedef void (*media_init_t)(per_card_info_t *cp); typedef void (*media_halt_t)(per_card_info_t *cp); typedef int (*media_svc_reg_t)(per_card_info_t *cp, mblk_t *mp, per_sap_info_t *sp); typedef int (*media_svc_rcv_t)(queue_t *q, mblk_t *mp); typedef void (*media_svc_close_t)(per_card_info_t *cp); typedef int (*make_hdr_t)(per_sap_info_t *sp, mblk_t *hdrmp, unchar *dest, unchar *src, int route_len); typedef void (*rx_parse_t)(per_card_info_t *cp, struct per_frame_info *fp); typedef int (*rx_errors_t)(void *statp); typedef int (*tx_errors_t)(void *statp); typedef miocret_t (*media_ioctl_t)(mblk_t *mp, per_card_info_t *cp, per_sap_info_t *sp); #endif typedef struct per_media_info { int hdr_sz; int stats_sz; ulong media_flags; /* Used by dlpi */ ulong media_private_flags; /* Used by media mgr */ media_init_t media_init; /* These may be NULL */ media_halt_t media_halt; media_svc_reg_t media_svc_reg; media_svc_rcv_t media_svc_rcv; media_svc_close_t media_svc_close; make_hdr_t make_hdr; /* These may not be NULL */ rx_parse_t rx_parse; rx_errors_t rx_errors; /* These may be NULL */ tx_errors_t tx_errors; media_ioctl_t media_ioctl; } per_media_info_t; #define MAX_MEDIA_TYPE 0x20 /* See MAC_CSMACD, MAC_TPR ... */ #define HAVE_MEDIA_SUPPORT(type) mdi_media_info[type].make_hdr #define MEDIA_MAGIC 0x5a5a0100 /* Registration validation - v1.00 */ /* * Values for the per_media_info_t->media_flags */ #define MEDIA_SOURCE_ROUTING 0x01 #define MEDIA_ETHERNET_II 0x02 #define MEDIA_XNS 0x04 #define MEDIA_LLC 0x08 #define MEDIA_SNAP 0x10 struct per_card_info { struct lockb lock_sap_id; /* lock sap id allocations */ struct lockb lock_card; /* lock anything else */ struct lockb lock_card_stats; /* lock stats */ int nopens; /* #opens at LLI layer */ ulong maxsaps; /* SAP Table size */ ulong maxroutes; /* Route Table size */ ulong rxunbound; /* #frames rx'ed with bad type*/ per_sap_info_t *sap_table; /*ptr to 1st SAP Table struct */ struct route_table *route_table; /*ptr to route table */ /* MDI Interface Information */ unsigned char local_mac_addr[6]; queue_t *down_queue; /* (WRITE)Queue to MDI driver */ int mdi_driver_ready:1, dlpidRegistered:1; ulong mac_driver_version; /* 0x3200 */ ulong mac_media_type; /* Ethernet/T-R/FDDI */ ulong mac_max_sdu; /* SDU MAX at MDI layer */ ulong mac_min_sdu; /* SDU MIN at MDI layer */ ulong mac_ifspeed; /* Speed of i/f in bits/sec */ per_media_info_t *media_specific; /* Media switch */ queue_t *media_svcs_queue; /* The daemon connection */ void *media_private; /* media mgr private data */ per_sap_info_t *control_sap; /* SAP issuing I_(UN)LINK */ mblk_t *hwfail_waiting; /* Tmp storage for HWFAIL_IND */ int (*mdi_primitive_handler)(); /* MDI IOCTL Issue/Wait-forACK/NAK information */ per_sap_info_t *ioctl_sap; /* SAP issuing the ioctl */ mblk_t *dlpi_iocblk; /* ioctl rx'ed from DLPI user*/ /* Info about the ioctl being issued to the MDI driver */ void (*ioctl_handler)(); /* IOCACK/NAK handler */ struct sap_counters old_tx, old_rx; struct txmon_s txmon; /* transmit traffic monitor */ dlpi_init_t *init; /* Space.c settable stuff */ #ifdef dlpi_frame_test /* enables dlpi write loopback to the sap that requested loopback */ per_sap_info_t *dlpi_biloopmode; #endif }; /****************************************************************************** * Macros ******************************************************************************/ #define MDI_DRIVER_NAME(cp) ((cp)->down_queue->q_next->q_qinfo->qi_minfo->mi_idname) #define PROTOCOL_STACK_NAME(sp) ((sp)->up_queue->q_next->q_qinfo->qi_minfo->mi_idname) /* * MP Lock Macros */ #define LOCK_CARDINFO(cp) crllry_ilockb(&((cp)->lock_card)) #define UNLOCK_CARDINFO(cp, spl) crllry_iunlockb(&((cp)->lock_card), spl) #define LOCK_SAP_ID(cp) crllry_ilockb(&((cp)->lock_sap_id)) #define UNLOCK_SAP_ID(cp, spl) crllry_iunlockb(&((cp)->lock_sap_id), spl) #ifdef DO_LOCK_STATS #define LOCK_STAT_VAR(s) int s #define LOCK_CARDSTATS(cp, s) s = crllry_ilockb(&((cp)->lock_card_stats)) #define UNLOCK_CARDSTATS(cp, spl) crllry_iunlockb(&((cp)->lock_card_stats), spl) #define LOCK_SAPSTATS(sp, s) s = crllry_ilockb(&((sp)->lock_sap_stats)) #define UNLOCK_SAPSTATS(sp, spl) crllry_iunlockb(&((sp)->lock_sap_stats), spl) #else #define LOCK_STAT_VAR(s) #define LOCK_CARDSTATS(cp, s) #define UNLOCK_CARDSTATS(cp, spl) #define LOCK_SAPSTATS(sp, s) #define UNLOCK_SAPSTATS(sp, spl) #endif /* * MP DLPI Module switch * - set to non-zero, means that the dlpi's queues will be * marked as MP-safe */ #define DLPI_IS_MP 1 /* ****************************************************************************** * DLPId Ioctls ****************************************************************************** */ #define DLPIDIOC(x) (('D' << 8) | (x)) #define DLPID_REGISTER DLPIDIOC(1) /* ****************************************************************************** * Media Support ****************************************************************************** */ #ifdef _NO_PROTOTYPE /* The link kit can not handle modern code */ int mdi_register_media(); #else int mdi_register_media(ulong media_magic, int type, const per_media_info_t *mi); #endif #define DLPIMIOC(x) (('m' << 8) | (x)) #define DLPI_MEDA_REGISTER DLPIMIOC(10) #endif /* _sys_dlpimod_h */ 070701000238c8000081a400000000000000030000000135aefcd20000215400001dff0000000100000000000000000000002300000000root/usr/src/O5hdk/net/sys/lli31.h#ifndef _SYS_LLI31_H #define _SYS_LLI31_H /* * @(#) lli31.h 5.1 94/06/10 SCOINC * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ /* * LLI31.h * This header file contains definitions for the now obsolete LLI 3.1 * network driver interface. It is provided for those prototocol stacks * that wish to remain LLI 3.1 driver compatible. */ /* * This header file has encoded the values so an existing driver * or user which was written with the Logical Link Interface(LLI) * can migrate to the DLPI interface in a binary compatible manner. * Any fields which require a specific format or value are flagged * with a comment containing the message LLI compatibility. */ /* * Primitives for Local Management Services */ #define LLI31_INFO_REQ 0x00 /* Information Req */ #define LLI31_INFO_ACK 0x03 /* Information Ack */ #define LLI31_BIND_REQ 0x01 /* Bind dlsap address */ #define LLI31_BIND_ACK 0x04 /* Dlsap address bound */ #define LLI31_UNBIND_REQ 0x02 /* Unbind dlsap address */ #define LLI31_OK_ACK 0x06 /* Success acknowledgment */ #define LLI31_ERROR_ACK 0x05 /* Error acknowledgment */ /* * Primitives used for Connectionless Service */ #define LLI31_UNITDATA_REQ 0x07 /* datagram send request */ #define LLI31_UNITDATA_IND 0x08 /* datagram receive indication */ #define LLI31_UDERROR_IND 0x09 /* datagram error indication */ /* * LLI3.1 interface states */ #define LLI31_UNBOUND 0x00 /* PPA attached */ #define LLI31_BIND_PENDING 0x01 /* Waiting ack of LLI31_BIND_REQ */ #define LLI31_UNBIND_PENDING 0x02 /* Waiting ack of LLI31_UNBIND_REQ */ #define LLI31_IDLE 0x03 /* dlsap bound, awaiting use */ /* * LLI31_ERROR_ACK error return values */ #define LLI31_ACCESS 0x02 /* Improper permissions for request */ #define LLI31_BADADDR 0x01 /* DLSAP address in improper format or invalid*/ #define LLI31_BADDATA 0x06 /* User data exceeded provider limit */ #define LLI31_BADPRIM 0x09 /* Prim. received but unknown by DLS provider */ #define LLI31_BADSAP 0x00 /* Bad LSAP selector */ #define LLI31_BOUND 0x0d /* Attempted second bind with lli31_max_conind*/ /* or lli31_conn_mgmt>0 on same DLSAP or PPA */ #define LLI31_NOTINIT 0x10 /* Physical Link not initialized */ #define LLI31_OUTSTATE 0x03 /* Primitive issued in improper state */ #define LLI31_SYSERR 0x04 /* UNIX system error occurred */ /* * LLI31 media types supported */ #define LLI31_CSMACD 0x0 /* IEEE 802.3 CSMA/CD network */ #define LLI31_TPR 0x2 /* IEEE 802.5 Token Passing Ring */ /* * LOCAL MANAGEMENT SERVICE PRIMITIVES */ /* * LLI31_INFO_REQ, M_PCPROTO type */ typedef struct lli31_info_req { ulong dl_primitive; } lli31_info_req_t; /* * LLI31_INFO_ACK, M_PCPROTO type */ typedef struct lli31_info_ack { ulong dl_primitive; ulong dl_max_sdu; ulong dl_min_sdu; ulong dl_addr_length; ulong dl_mac_type; ulong dl_reserved; ulong dl_current_state; ulong dl_max_idu; ulong dl_service_mode; ulong dl_qos_length; ulong dl_qos_offset; ulong dl_qos_range_length; ulong dl_qos_range_offset; long dl_provider_style; ulong dl_addr_offset; ulong dl_growth; } lli31_info_ack_t; /* * LLI31_BIND_REQ, M_PROTO type */ typedef struct lli31_bind_req { ulong dl_primitive; ulong dl_sap; ulong dl_max_conind; ushort dl_service_mode; ushort dl_conn_mgmt; } lli31_bind_req_t; /* * LLI31_BIND_ACK, M_PCPROTO type */ typedef struct lli31_bind_ack { ulong dl_primitive; ulong dl_sap; ulong dl_addr_length; ulong dl_addr_offset; ulong dl_max_conind; ulong dl_growth; } lli31_bind_ack_t; /* * LLI31_UNBIND_REQ, M_PROTO type */ typedef struct lli31_unbind_req { ulong dl_primitive; } lli31_unbind_req_t; /* * LLI31_OK_ACK, M_PCPROTO type */ typedef struct lli31_ok_ack { ulong dl_primitive; ulong dl_correct_primitive; } lli31_ok_ack_t; /* * LLI31_ERROR_ACK, M_PCPROTO type */ typedef struct lli31_error_ack { ulong dl_primitive; ulong dl_error_primitive; ulong dl_errno; ulong dl_unix_errno; } lli31_error_ack_t; /* * CONNECTIONLESS SERVICE PRIMITIVES */ /* * LLI31_UNITDATA_REQ, M_PROTO type, with M_DATA block(s) */ typedef struct lli31_unitdata_req { ulong dl_primitive; ulong dl_dest_addr_length; ulong dl_dest_addr_offset; ulong dl_reserved[2]; } lli31_unitdata_req_t; /* * LLI31_UNITDATA_IND, M_PROTO type, with M_DATA block(s) */ typedef struct lli31_unitdata_ind { ulong dl_primitive; ulong dl_src_addr_length; ulong dl_src_addr_offset; ulong dl_dest_addr_length; ulong dl_dest_addr_offset; ulong dl_reserved; } lli31_unitdata_ind_t; /* * LLI31_UDERROR_IND, M_PCPROTO type */ typedef struct lli31_uderror_ind { ulong dl_primitive; ulong dl_dest_addr_length; ulong dl_dest_addr_offset; ulong dl_reserved; ulong dl_errno; } lli31_uderror_ind_t; union LLI31_primitives { ulong dl_primitive; lli31_info_req_t info_req; lli31_info_ack_t info_ack; lli31_bind_req_t bind_req; lli31_bind_ack_t bind_ack; lli31_unbind_req_t unbind_req; lli31_ok_ack_t ok_ack; lli31_error_ack_t error_ack; lli31_unitdata_req_t unitdata_req; lli31_unitdata_ind_t unitdata_ind; lli31_uderror_ind_t uderror_ind; }; #define LLI31_INFO_REQ_SIZE sizeof(lli31_info_req_t) #define LLI31_INFO_ACK_SIZE sizeof(lli31_info_ack_t) #define LLI31_BIND_REQ_SIZE sizeof(lli31_bind_req_t) #define LLI31_BIND_ACK_SIZE sizeof(lli31_bind_ack_t) #define LLI31_UNBIND_REQ_SIZE sizeof(lli31_unbind_req_t) #define LLI31_OK_ACK_SIZE sizeof(lli31_ok_ack_t) #define LLI31_ERROR_ACK_SIZE sizeof(lli31_error_ack_t) #define LLI31_UNITDATA_REQ_SIZE sizeof(lli31_unitdata_req_t) #define LLI31_UNITDATA_IND_SIZE sizeof(lli31_unitdata_ind_t) #define LLI31_UDERROR_IND_SIZE sizeof(lli31_uderror_ind_t) /* statistics structure (for the MACIOC_GETSTAT ioctl) */ typedef struct lli31_mac_stats { unsigned long mac_frame_xmit; /* Frames Transmitted */ unsigned long mac_bcast_xmit; /* Broadcast Frames Transmitted */ unsigned long mac_mcast_xmit; /* Multicast Frames Transmitted */ unsigned long mac_lbolt_xmit; /* Frames Transmitted per Second */ unsigned long mac_frame_recv; /* Frames Received */ unsigned long mac_bcast_recv; /* Broadcast Frames Received */ unsigned long mac_mcast_recv; /* Multicast Frames Received */ unsigned long mac_lbolt_recv; /* Frames Received per Second */ unsigned long mac_frame_def; /* Frames Deferred */ unsigned long mac_collisions; /* Total Collisions */ unsigned long mac_frame_coll; /* Frames Involved in a Collision */ unsigned long mac_oframe_coll; /* Out of Frame Collisions */ unsigned long mac_xs_coll; /* Dropped Due To Excess Collisions */ unsigned long mac_frame_nosr; /* Dropped Due To Lack of STREAMS */ unsigned long mac_no_resource; /* Dropped Due To Lack of Resources */ unsigned long mac_badsum; /* Bad Checksum Received */ unsigned long mac_align; /* Bad Alignment Received */ unsigned long mac_badlen; /* Bad Length Received */ unsigned long mac_badsap; /* Bad SAP Received */ unsigned long mac_mcast_rjct; /* Multicast Frames Rejected */ unsigned long mac_carrier; /* Errors Due To Lost Carrier */ unsigned long mac_badcts; /* Errors Due To Lost CTS */ unsigned long mac_baddma; /* Errors Due To Over/Under Runs */ unsigned long mac_timeouts; /* Device Timeouts */ unsigned long mac_intr; /* Device Interrupts */ unsigned long mac_spur_intr; /* Spurious Interrupts */ unsigned long mac_ioctets; /* received octets */ unsigned long mac_ooctets; /* transmitted octets */ unsigned long mac_ifspeed; /* net interface speed in bits/sec */ unsigned long mac_reserved[1]; /* Reserved */ } lli31_mac_stats_t; /* statistics structure (for the MACIOC_GETIFSTAT ioctl) */ typedef struct lli31_mac_ifstats { struct lli31_mac_ifstats *ifs_next; /* next if on chain */ char *ifs_name; /* interface name */ short ifs_unit; /* unit number */ short ifs_active; /* non-zero if this if is running */ caddr_t *ifs_addrs; /* list of addresses */ short ifs_mtu; /* Maximum transmission unit */ /* generic interface statistics */ int ifs_ipackets; /* packets received on interface */ int ifs_ierrors; /* input errors on interface */ int ifs_opackets; /* packets sent on interface */ int ifs_oerrors; /* output errors on interface */ int ifs_collisions; /* collisions on csma interfaces */ } lli31_mac_ifstats_t; #endif /* _SYS_LLI31_H */ 070701000238c9000081a400000000000000030000000135aefcd20000436600001dff0000000100000000000000000000002100000000root/usr/src/O5hdk/net/sys/mdi.h/* * @(#) mdi.h 67.1 97/09/29 SCOINC * * Copyright (C) The Santa Cruz Operation, 1993-1997. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #ifndef _SYS_MDI_H #define _SYS_MDI_H /* * mdi.h header for MAC Driver Interface */ /* * Primitives for Local Management Services */ #define MAC_INFO_REQ 0x00 /* Information Req */ #define MAC_INFO_ACK 0x03 /* Information Ack */ #define MAC_BIND_REQ 0x01 /* Bind dlsap address */ #define MAC_OK_ACK 0x06 /* Success acknowledgment */ #define MAC_ERROR_ACK 0x05 /* Error acknowledgment */ #define MAC_HWFAIL_IND 0x07 /* H/W Failure Indication */ #define MAC_ISDN_MSG 0x10 /* SCO ISDN Message */ /* * MAC_ERROR_ACK error return values */ #define MAC_OUTSTATE 0x02 /* Primitive issued in improper state */ #define MAC_BADPRIM 0x03 /* Primitive received unknown by MDI driver */ #define MAC_INITFAILED 0x04 /* Physical Link initialization failed */ /* * MDI media types supported */ #define MAC_CSMACD 0x0 /* IEEE 802.3 CSMA/CD network */ #define MAC_TPR 0x02 /* IEEE 802.5 Token Passing Ring */ #define MAC_FDDI 0x08 /* FDDI on Copper/Fiber */ #define MAC_ISDN_BRI 0x10 /* Basic Rate ISDN 1D(16)+2B(64) */ #define MAC_ISDN_PRI 0x11 /* Primary Rate ISDN 1D(64)+23B(64) */ /* * Device minor numbers * * If there are more than 32 channels associated with a single * adapter, extended minors must be used. See mdevice(F) for * the procedure for allocating extended minors. * * The card number is in the low bits so that single channel * cards (Ethernet, Token Ring) have consecutive minor numbering * and are not bothered with extended minors. */ #define MDI_DEV_TO_CARD(dev) (minor(dev) & 0x07) #define MDI_DEV_TO_CHANNEL(dev) (minor(dev) >> 3) /* * MDI interface primitive definitions. * * Each primitive is sent as a stream message. The * the messages may be viewed as a sequence of bytes that have the * following form without any padding. The structure definition * of the following messages may have to change depending on the * underlying hardware architecture and crossing of a hardware * boundary with a different hardware architecture. * * Fields in the primitives having a name of the form * mac_reserved cannot be used and have the value of * binary zero, no bits turned on. * * Each message has the name defined followed by the * stream message type (M_PROTO, M_PCPROTO, M_DATA) */ /* * LOCAL MANAGEMENT SERVICE PRIMITIVES */ /* * MAC_INFO_REQ, M_PROTO type */ typedef struct mac_info_req { ulong mac_primitive; } mac_info_req_t; /* * MAC_INFO_ACK, M_PROTO type */ typedef struct mac_info_ack { ulong mac_primitive; ulong mac_max_sdu; ulong mac_min_sdu; ulong mac_mac_type; ulong mac_driver_version; ulong mac_if_speed; } mac_info_ack_t; /* * MAC_BIND_REQ, M_PROTO type * Return MAC_OK_ACK/MAC_ERROR_ACK */ typedef struct mac_bind_req { ulong mac_primitive; } mac_bind_req_t; /* * MAC_OK_ACK, M_PROTO type */ typedef struct mac_ok_ack { ulong mac_primitive; ulong mac_correct_primitive; } mac_ok_ack_t; /* * MAC_ERROR_ACK, M_PROTO type */ typedef struct mac_error_ack { ulong mac_primitive; ulong mac_error_primitive; ulong mac_errno; } mac_error_ack_t; /* * MAC_HWFAIL_IND, M_PROTO type */ typedef struct mac_hwfail_ind { ulong mac_primitive; ulong mac_mcast_length; ulong mac_mcast_offset; } mac_hwfail_ind_t; /* * MAC_ISDN_MSG, M_PROTO type */ typedef struct mac_isdn_hdr { ulong mac_primitive; u_char mac_isdn_cmd; u_char mac_isdn_subcmd; u_short mac_isdn_msgnum; } mac_isdn_hdr_t; typedef union MAC_primitives { ulong mac_primitive; mac_info_req_t info_req; mac_info_ack_t info_ack; mac_bind_req_t bind_req; mac_ok_ack_t ok_ack; mac_error_ack_t error_ack; mac_hwfail_ind_t hwfail_ind; mac_isdn_hdr_t isdn_hdr; } mac_prim_t; #define MAC_INFO_REQ_SIZE sizeof(mac_info_req_t) #define MAC_INFO_ACK_SIZE sizeof(mac_info_ack_t) #define MAC_BIND_REQ_SIZE sizeof(mac_bind_req_t) #define MAC_OK_ACK_SIZE sizeof(mac_ok_ack_t) #define MAC_ERROR_ACK_SIZE sizeof(mac_error_ack_t) #define MAC_HWFAIL_IND_SIZE sizeof(mac_hwfail_ind_t) #define MAC_ISDN_MSG_SIZE sizeof(mac_isdn_hdr_t) #define MDI_VERSION 0x0100 /* Value passed back from MDI driver */ /* Valid ioctls for MDI drivers */ #define MACIOC(x) (('M' << 8) | (x)) #define MACIOC_SETMCA MACIOC(3) /* Multicast set */ #define MACIOC_DELMCA MACIOC(4) /* Multicast delete */ #define MACIOC_GETMCA MACIOC(6) /* Get multicast table */ #define MACIOC_GETADDR MACIOC(8) /* Get MAC address */ #define MACIOC_SETADDR MACIOC(9) /* Set MAC address */ #define MACIOC_GETSTAT MACIOC(10) /* Get MAC statistics */ #define MACIOC_PROMISC MACIOC(11) /* Set Promiscuous Reception */ #define MACIOC_GETRADDR MACIOC(12) /* Get factory MAC Address */ #define MACIOC_CLRSTAT MACIOC(13) /* Clear MAC statistics */ #define MACIOC_GETMCSIZ MACIOC(14) /* Get multicast table size */ #define MACIOC_SETSTAT MACIOC(16) /* Set MAC statistics */ /* UNSUPPORTED MACIOC ioctl values - DO NOT USE */ #ifdef LLI31_UNSUPPORTED #define MACIOC_DIAG MACIOC(1) /* Set MAC diagnostics */ #define MACIOC_UNITSEL MACIOC(2) /* MAC unit select */ #define MACIOC_CLRMCA MACIOC(5) /* Flush multicast table */ #define MACIOC_GETIFSTAT MACIOC(7) /* Dump BSD statistics */ #define MACIOC_HWDEPEND MACIOC(15) /* Hardware dependent */ #define MACIOC_LOCALSTAT MACIOC(254) /* dump statistics */ #endif /* * Ethernet statistics structure for the MACIOC_GETSTAT ioctl */ typedef struct mac_stats_eth { ulong mac_align; /* Bad Alignment Received */ ulong mac_badsum; /* Bad Checksum Received */ ulong mac_sqetesterrors; /* NEW SQE Test Errors */ ulong mac_frame_def; /* #Frames Deferred (not dropped) */ ulong mac_oframe_coll; /* #Times coll' det'ed >512bits into frame*/ ulong mac_xs_coll; /* #Frames(tx) Dropped due Excess Collisions */ ulong mac_tx_errors; /* NEW #Internal MAC Transmit Errors */ ulong mac_carrier; /* #Frames Dropped(tx) Due To Lost Carrier */ ulong mac_badlen; /* #Frames(rx) Dropped due >MAX_MACPDUSZ */ ulong mac_no_resource; /* #Internal MAC Receive Errors */ /* NEW Table of #frames involved in N collisions, where */ /* N-1 is the table index (e.g. mac_colltable[0] == #frames */ /* involved in 1 collision) */ ulong mac_colltable[16]; /* FIELDS NOT REQUIRED BY MIB */ ulong mac_spur_intr; /* Spurious interrupts */ ulong mac_frame_nosr; /* Dropped Due To Lack of STREAMS */ /* FIELDS NOT REQUIRED BY MIB, ARE THEY USEFUL?? */ ulong mac_baddma; /* Errors Due To Over/Under Runs */ ulong mac_timeouts; /* Device Timeouts */ } mac_stats_eth_t; /* * Token-Ring statistics structure for the MACIOC_GETSTAT ioctl */ typedef struct mac_stats_tr { ulong mac_ringstatus; /* Bit field holding T-R status */ unchar mac_funcaddr[6]; /* Currently set functional address */ unchar mac_upstream[6]; /* MAC addr of upstream neighbor */ unchar mac_actmonparticipate; /* Active Mon selection participation */ ulong mac_lineerrors; /* #Frames copied with FCS error */ ulong mac_bursterrors; /* #times no transitions detected */ ulong mac_acerrors; /* #times stn. detected with bad A/C response */ ulong mac_aborttranserrors; /* #frames aborted on transmission */ ulong mac_internalerrors; /* #internal errors */ ulong mac_lostframeerrors; ulong mac_receivecongestions; /* #frames received and then dropped */ ulong mac_framecopiederrors; /* #times duplicate address detected */ ulong mac_tokenerrors; /* #times Act' Mon detects token err */ ulong mac_softerrors; /* #errors recoverable by MAC protocol */ ulong mac_harderrors; /* #times MAC beacon frames tx'ed or rx'ed */ ulong mac_signalloss; /* #times detection of ring signal lost */ ulong mac_transmitbeacons; /* #MAC beacon frames sent */ ulong mac_recoverys; /* #times MAC claim frames tx'ed or rx'ed */ ulong mac_lobewires; /* #times open/short circuit in lobe path */ ulong mac_removes; /* #MAC remove-ring-stn frames received */ ulong mac_statssingles; /* #times only stn. on ring */ ulong mac_frequencyerrors; /* #times signal freq. out of range */ /* FIELDS NOT REQUIRED BY MIB */ ulong mac_badlen; /* #Frames(tx) Dropped due >MAX_MACPDUSZ */ ulong mac_spur_intr; /* Spurious interrupts */ ulong mac_frame_nosr; /* Dropped Due To Lack of STREAMS */ /* FIELDS NOT REQUIRED BY MIB, ARE THEY USEFUL?? */ ulong mac_baddma; /* Errors Due To Over/Under Runs */ ulong mac_timeouts; /* Device Timeouts */ } mac_stats_tr_t; /* * FDDI statistics structure for the MACIOC_GETSTAT ioctl */ typedef struct mac_stats_fddi { unchar smt_station_id[8]; /* SMT Attributes */ ulong smt_op_version_id; ulong smt_hi_version_id; ulong smt_lo_version_id; unchar smt_user_data[32]; /* read-write */ ulong smt_mib_version_id; ulong smt_mac_cts; ulong smt_non_master_cts; ulong smt_master_cts; ulong smt_available_paths; ulong smt_config_capabilities; ulong smt_config_policy; /* read-write */ ulong smt_connection_policy; /* read-write */ ulong smt_t_notify; /* read-write */ ulong smt_stat_rpt_policy; /* read-write */ ulong smt_trace_max_expiration; /* read-write */ ulong smt_bypass_present; ulong smt_ecm_state; ulong smt_cf_state; ulong smt_remote_disconnect_flag; ulong smt_station_status; ulong smt_peer_wrap_flag; ulong smt_time_stamp; /* RFC1512 32bit signed int, SMT 7.2c 64bits */ ulong smt_transition_time_stamp; /* RFC1512 32b, SMT 7.2c 64b */ ulong mac_frame_status_functions; /* MAC Attributes */ ulong mac_t_max_capability; ulong mac_tvx_capability; ulong mac_available_paths; ulong mac_current_path; unchar mac_upstream_nbr[6]; unchar mac_downstream_nbr[6]; unchar mac_old_upstream_nbr[6]; unchar mac_old_downstream_nbr[6]; ulong mac_dup_address_test; ulong mac_requested_paths; /* read-write */ ulong mac_downstream_port_type; unchar mac_smt_address[6]; ulong mac_t_req; ulong mac_t_neg; ulong mac_t_max; ulong mac_tvx_value; ulong mac_frame_cts; ulong mac_copied_cts; ulong mac_transmit_cts; ulong mac_error_cts; ulong mac_lost_cts; ulong mac_frame_error_threshold; /* read-write */ ulong mac_frame_error_ratio; ulong mac_rmt_state; ulong mac_da_flag; ulong mac_una_da_flag; ulong mac_frame_error_flag; ulong mac_ma_unitdata_available; ulong mac_hardware_present; ulong mac_ma_unitdata_enable; /* read-write */ ulong path_tvx_lower_bound; /* read-write */ ulong path_t_max_lower_bound; /* read-write */ ulong path_max_t_req; /* read-write */ ulong path_configuration[8]; /* PATH Attributes */ ulong port_my_type[2]; /* PORT Attributes */ ulong port_neighbor_type[2]; ulong port_connection_policies[2]; /* read-write */ ulong port_mac_indicated[2]; ulong port_current_path[2]; unchar port_requested_paths[3*2]; /* read-write */ ulong port_mac_placement[2]; ulong port_available_paths[2]; ulong port_pmd_class[2]; ulong port_connection_capabilities[2]; ulong port_bs_flag[2]; ulong port_lct_fail_cts[2]; ulong port_ler_estimate[2]; ulong port_lem_reject_cts[2]; ulong port_lem_cts[2]; ulong port_ler_cutoff[2]; /* read-write */ ulong port_ler_alarm[2]; /* read-write */ ulong port_connect_state[2]; ulong port_pcm_state[2]; ulong port_pc_withhold[2]; ulong port_ler_flag[2]; ulong port_hardware_present[2]; } mac_stats_fddi_t; /* * ISDN statistics structure for the MACIOC_GETSTAT ioctl */ #ifdef ISDN_SUPPORT_ADDED /* Not Yet */ typedef struct mac_stats_isdn { /* ############### */ ulong mac_align; /* Bad Alignment Received */ ulong mac_badsum; /* Bad Checksum Received */ ulong mac_sqetesterrors; /* NEW SQE Test Errors */ ulong mac_frame_def; /* #Frames Deferred (not dropped) */ ulong mac_oframe_coll; /* #Times coll' det'ed >512bits into frame*/ ulong mac_xs_coll; /* #Frames(tx) Dropped due Excess Collisions */ ulong mac_tx_errors; /* NEW #Internal MAC Transmit Errors */ ulong mac_carrier; /* #Frames Dropped(tx) Due To Lost Carrier */ ulong mac_badlen; /* #Frames(rx) Dropped due >MAX_MACPDUSZ */ ulong mac_no_resource; /* #Internal MAC Receive Errors */ /* NEW Table of #frames involved in N collisions, where */ /* N-1 is the table index (e.g. mac_colltable[0] == #frames */ /* involved in 1 collision) */ ulong mac_colltable[16]; /* FIELDS NOT REQUIRED BY MIB */ ulong mac_spur_intr; /* Spurious interrupts */ ulong mac_frame_nosr; /* Dropped Due To Lack of STREAMS */ /* FIELDS NOT REQUIRED BY MIB, ARE THEY USEFUL?? */ ulong mac_baddma; /* Errors Due To Over/Under Runs */ ulong mac_timeouts; /* Device Timeouts */ /* ############### */ } mac_stats_isdn_t; #endif /* * MACIOC_SETSTAT - support for writeable MIBs. */ /* MACSTATs for the mac_flags bit field */ #define MACSTAT_ACTMONPARTICIPATE 0 /* Active Mon selection participation */ typedef long macflags_t[10]; #define NFLBITS (sizeof(long) * 8) /* bits per mask */ #define MACFL_SET(n, p) ((p)->mac_flags[(n)/NFLBITS] |= (1L << ((n) % NFLBITS))) #define MACFL_CLR(n, p) ((p)->mac_flags[(n)/NFLBITS] &= ~(1L<< ((n) % NFLBITS))) #define MACFL_ISSET(n, p) ((p)->mac_flags[(n)/NFLBITS] &(1L << ((n) % NFLBITS))) #define MACFL_ZERO(p) memset((char *)((p)->mac_flags), '\0', sizeof(*(p))) typedef struct mac_setstat { macflags_t mac_flags; union { mac_stats_eth_t eth; mac_stats_tr_t tr; mac_stats_fddi_t fddi; } mac_stats; } mac_setstat_t; /* * Type: macaddr_t * * Purpose: * Store a network address. */ #define MDI_MACADDRSIZE 6 typedef unsigned char macaddr_t[MDI_MACADDRSIZE]; /* * Type: mctbl_t * * Purpose: * Store a multicast table. */ #define MDI_NMCADDR 16 typedef struct { macaddr_t tbl[MDI_NMCADDR]; int cnt; } mctbl_t; /* * Type: trylock_t * * Purpose: * Implement a trylock. */ typedef struct trylock_s { struct lockb lock; int busy; } trylock_t; /* * MDI TX Interface routines/structures */ #if defined(__STDC__) && !defined(_NO_PROTOTYPE) typedef void (*mditx_ProcessMsg_t)(void * handle, mblk_t * mp); typedef int (*mditx_CheckAvail_t)(void * handle); typedef void (*mditx_ProcessMsgMT_t)(void * handle, void * txr, mblk_t * mp); typedef void * (*mditx_GetResource_t)(void * handle); #else typedef void (*mditx_ProcessMsg_t)(); typedef int (*mditx_CheckAvail_t)(); typedef void (*mditx_ProcessMsgMT_t)(); typedef void * (*mditx_GetResource_t)(); #endif typedef struct { int frames_queued; queue_t * q; trylock_t trylock; mditx_CheckAvail_t tx_avail; mditx_ProcessMsg_t process_msg; void * handle; } mditx_IF_t; typedef struct { int frames_queued; queue_t * q; struct lockb txlock; mditx_GetResource_t get_txr; mditx_ProcessMsgMT_t process_msg; void * handle; } mditx_IFMT_t; /* * MDI NetBoot/ksl stuff */ #define MDI_BUS_ISA 0x00000001 #define MDI_BUS_MCA 0x00000002 #define MDI_BUS_EISA 0x00000004 #define MDI_BUS_PCI 0x00000010 #define MDI_BUS_PCMCIA 0x10000000 /* not defined in arch.h yet */ /* * lots of adapter docs mix up media types, cabling, and connector type * so a small bit of the media mess we live with gets propagated below */ #define MDI_MEDIA_AUTO 0x00000001 #define MDI_MEDIA_AUI 0x00000002 #define MDI_MEDIA_BNC 0x00000004 #define MDI_MEDIA_TP 0x00000008 #define MDI_MEDIA_COAX 0x00000010 #define MDI_MEDIA_BNC_TP 0x00000020 #define MDI_MEDIA_TP_COAX 0x00000040 #define MDI_SET_BOOTPARAMS 0 #define MDI_GET_BOOTPARAMS 1 typedef struct { char *lbl; int val; } mdi_netboot_t; /* MDI Library functions */ #if defined(__STDC__) && !defined(_NO_PROTOTYPE) extern int mdi_add_mctbl_entry(mctbl_t * mctbl, macaddr_t addr); extern int mdi_addrs_equal(macaddr_t addr1, macaddr_t addr2); extern int mdi_del_mctbl_entry(mctbl_t * mctbl, macaddr_t addr); extern int mdi_in_mctbl(mctbl_t * mctbl, macaddr_t ea); extern int mdi_num_mctbl_entries(mctbl_t * mctbl); extern u_short mdi_htons(u_short); extern u_short mdi_ntohs(u_short); extern void mdi_do_loopback(queue_t *, mblk_t *, int); extern void mdi_macerrorack(queue_t *, long, int); extern void mdi_macokack(queue_t *, long); extern int mdi_trylock(trylock_t * trylock); extern void mdi_trylock_init(trylock_t * trylock); extern void mdi_tryunlock(trylock_t * trylock); extern void mditx_register(mditx_IF_t * txint, queue_t * q, mditx_CheckAvail_t tx_avail, mditx_ProcessMsg_t process_msg, void * handle); extern void mditx_registerMT(mditx_IFMT_t * txint, queue_t * q, mditx_GetResource_t get_txr, mditx_ProcessMsgMT_t process_msg, void * handle); extern void mditx_interface(mditx_IF_t * txint, mblk_t * msg); extern void mditx_interfaceMT(mditx_IFMT_t * txint, mblk_t * msg); extern u_char * mdi_EndOfContigSegment(u_char *, u_char *); #define mdi_end_of_contig_segment(c1, c2) mdi_EndOfContigSegment(c1, c2) extern int mdi_isdma(u_char *); extern mblk_t * mdi_dma_allocb(u_long); #endif #endif /* _SYS_MDI_H */ 070701000238ca000081a400000000000000030000000135aefcd200001be900001dff0000000100000000000000000000002500000000root/usr/src/O5hdk/net/sys/scodlpi.h/* * "@(#) scodlpi.h 68.1 98/01/12 SCOINC" * * Copyright (C) The Santa Cruz Operation, 1993-1998. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #ifndef _SYS_SCODLPI_H #define _SYS_SCODLPI_H #include #ifndef dlpi_frame_test #define dlpi_frame_test #endif /* * scodlpi.h header for SCO specific extensions to AT&T DLPI V2.0 */ #define MAC_ADDR_SZ 6 /* * Media types not defined by AT&T DLPI */ /* SCO TCP/IP Drivers */ #define DL_SLIP 0x60 /* Serial-Line IP (RFC 1055) */ #define DL_PPP 0x61 /* Point-to-point Protocol (RFC 117[12]) */ #define DL_LOOP 0x62 /* Loopback */ #define LLC_OFF 0 /* LLC and SNAP off */ #define LLC_SNAP 1 /* LLC 1 framing on for SNAP */ #define LLC_1 2 /* LLC 1 framing on */ /* LLC commands and bits */ #define LLC_CMD_UI 0x03 #define LLC_CMD_XID 0xaf #define LLC_CMD_TEST 0xe3 #define LLC_POLL_FINAL 0x10 #define LLC_RESPONSE 0x01 /* Values for dl_saptype */ #define FR_ETHER_II 0 #define FR_XNS 1 #define FR_LLC 2 #define FR_SNAP 3 /* Values for dl_srmode */ #define SR_NON 0 #define SR_AUTO 1 #define SR_STACK 2 /* Values for dl_sap in DL_BIND_REQ */ #define SNAP_SAP 0x000000aa #define LLC_DEFAULT_SAP 0xfffffffe #define XNS_SAP 0x000000ff struct mac_counters { ulong mac_bcast; /* #Frames Broadcast */ ulong mac_mcast; /* #Frames Multicast */ ulong mac_ucast; /* #Frames Unicast */ ulong mac_error; /* #Frames with errors */ ulong mac_octets; /* #MAC Octets sent/received */ ulong mac_queue_len; /* #Frames queued for tx/on rx */ }; struct dlpi_stats { /* DLPI module info */ ulong dl_nsaps; /* #SAPs currently bound to DLPI */ ulong dl_maxsaps; /* Max. #SAPs usable */ ulong dl_rxunbound; /* #frames received not delivered */ /* Source Routing info */ ulong dl_nroutes; /* #Source Routes currently in use */ ulong dl_maxroutes; /* Max #Source Routes usable */ /* MAC Driver info */ ulong mac_driver_version; ulong mac_media_type; /* Ethernet/T-R/FDDI */ ulong mac_max_sdu; /* SDU MAX at MDI layer */ ulong mac_min_sdu; /* SDU MIN at MDI layer */ ulong mac_addr_length; /* ADDR SIZE at MDI layer */ ulong mac_stats_len; /* Size of h/w dep. stats struct */ ulong mac_ifspeed; /* Speed of interface in bits/sec */ struct mac_counters mac_tx; /* Data collected for sends */ struct mac_counters mac_rx; /* Data collected for receives */ }; struct dlpi_counters { ulong dl_bcast; /* #Broadcast frames */ ulong dl_mcast; /* #Multicast frames */ ulong dl_ucast_xid; /* #Unicast LLC XID Frames */ ulong dl_ucast_test; /* #Unicast LLC TEST Frames */ ulong dl_ucast; /* #Unicast frames not covered above */ ulong dl_error; /* #Frames with errors */ ulong dl_octets; /* #MAC Octets sent/received */ ulong dl_queue_len; /* #Frames on the send/receive queue */ }; #define DL_USER_SZ 32 struct dlpi_sapstats { ulong dl_saptype; /* Ethernet-II/XNS/LLC/SNAP */ ulong dl_sap; /* Bind address */ char dl_user[DL_USER_SZ]; /* Name of module bound to DLPI */ ulong dl_llcmode; /* LLC_OFF or LLC_1 */ struct dlpi_counters dl_tx; /* Statistics for sends */ struct dlpi_counters dl_rx; /* Statistics for receives */ ulong dl_srmode; /* SR_NON or SR_AUTO or SR_STACK */ }; #define SR_ROUTE_SZ 30 struct sr_table_entry { unchar sr_remote_mac[MAC_ADDR_SZ]; /* Remote MAC address */ unchar sr_state; /* State machine's state */ unchar sr_route_len; /* #Valid hops in sr_route */ time_t sr_timeout; /* Time @ next timeout */ ulong sr_max_pdu; /* Max. PDU size allowed to sr_remote_mac */ ushort sr_route[SR_ROUTE_SZ]; /* Best Route to sr_remote_mac */ }; typedef struct snap_sap { ulong prot_id; ushort type; } snap_sap_t; /****************************************************************************** * SCO Specific DLPI Primitives. This section describes the new DLPI * primitives which replace LLI 3.1 MACIOC ioctls. * ******************************************************************************/ #define SCODLPI_BASE 500 #define DL_CLR_STATISTICS_REQ (SCODLPI_BASE+0x00) #define DL_SAP_STATISTICS_REQ (SCODLPI_BASE+0x01) #define DL_SAP_STATISTICS_ACK (SCODLPI_BASE+0x02) #define DL_SET_SRMODE_REQ (SCODLPI_BASE+0x03) #define DL_SRTABLE_REQ (SCODLPI_BASE+0x04) #define DL_SRTABLE_ACK (SCODLPI_BASE+0x05) #define DL_SR_REQ (SCODLPI_BASE+0x06) #define DL_SR_ACK (SCODLPI_BASE+0x07) #define DL_SET_SR_REQ (SCODLPI_BASE+0x08) #define DL_CLR_SR_REQ (SCODLPI_BASE+0x09) #define DL_MCTABLE_REQ (SCODLPI_BASE+0x0a) #define DL_MCTABLE_ACK (SCODLPI_BASE+0x0b) #define DL_SET_SRPARMS_REQ (SCODLPI_BASE+0x0c) #ifdef dlpi_frame_test #define DL_DLPI_BILOOPMODE (SCODLPI_BASE+0x70) #endif struct sco_prim { ulong dl_primitive; }; typedef struct sco_prim dl_clr_statistics_req_t; typedef struct sco_prim dl_sap_statistics_req_t; typedef struct sco_prim dl_srtable_req_t; typedef struct sco_prim dl_mctable_req_t; #ifdef dlpi_frame_test typedef struct { ulong dl_primitive; /* DL_DLPI_BILOOPMODE */ ulong dl_biloopmode; } dl_set_biloopmode_req_t; #endif typedef struct { ulong dl_primitive; /* DL_SET_SRMODE_REQ */ ulong dl_srmode; } dl_set_srmode_req_t; typedef struct { ulong dl_primitive; /* DL_SR_REQ */ ulong dl_addr_len; ulong dl_addr_offset; } dl_sr_req_t; typedef struct { ulong dl_primitive; /* DL_SET_SR_REQ */ ulong dl_addr_len; ulong dl_addr_offset; ulong dl_route_len; ulong dl_route_offset; } dl_set_sr_req_t; typedef struct { ulong dl_primitive; /* DL_CLR_SR_REQ */ ulong dl_addr_len; ulong dl_addr_offset; } dl_clr_sr_req_t; typedef struct { ulong dl_primitive; /* DL_SET_SRPARMS_REQ */ ulong dl_parms_len; ulong dl_parms_offset; } dl_set_srparms_req_t; typedef struct { ulong dl_primitive; /* DL_SAP_STATISTICS_ACK */ ulong dl_sapstats_len; ulong dl_sapstats_offset; /* of struct dlpi_sap_stats */ } dl_sap_statistics_ack_t; typedef struct { ulong dl_primitive; /* DL_SRTABLE_ACK */ ulong dl_srtable_len; time_t dl_time_now; /* lbolt */ ulong dl_route_table_sz;/* Number of entrys in the table */ ulong dl_routes_in_use;/* Number of entrys currently being used */ int dl_tx_resp; /* timeout for responding to rx */ int dl_rx_ARE; /* window for rejecting more AREs */ int dl_rx_STE_bcs; /* # STE bcs before invalidating route entry * and find new route */ int dl_rx_STE_ucs; /* # STE ucs before invalidating route entry * and find new route */ int dl_max_tx; /* upper limit for tx "recur" window */ int dl_min_tx; /* lower limit for tx "recur" window */ int dl_tx_recur; /* detected "recurs" before tx STE */ int dl_ARE_disa; /* disable sending ARE frames */ } dl_srtable_ack_t; typedef struct { ulong dl_primitive; /* DL_MCTABLE_ACK */ ulong dl_mctable_len; ulong dl_mctable_offset; } dl_mctable_ack_t; typedef struct { ulong dl_primitive; /* DL_SR_ACK */ ulong dl_srtablee_len; ulong dl_srtablee_offset; } dl_sr_ack_t; #define DL_CLR_SR_REQ_SIZE sizeof(dl_clr_sr_req_t) #define DL_SET_SRPARMS_REQ_SIZE sizeof(dl_set_srparms_req_t) #endif /* _SYS_SCODLPI_H */ 070701000238cb000081a400000000000000030000000135aefcd200000d5800001dff0000000100000000000000000000002000000000root/usr/src/O5hdk/net/sys/sr.h/* * @(#) sr.h 58.2 96/10/03 SCOINC * * Copyright (C) The Santa Cruz Operation, 1993-1996. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #ifndef MAX_ROUTES #define MAX_ROUTES 2 #endif #define MAX_SEGMENTS 14 #define MAX_ROUTE_SZ (MAX_SEGMENTS * sizeof(ushort)) struct route_info { unchar ri_control0; unchar ri_control1; ushort ri_segments[MAX_SEGMENTS]; }; /* Broadcast indicator bits, for control0 field */ #define SRF 0x00 /* Specifically Routed Frame */ #define STE 0xc0 /* Spanning Tree Explorer Frame */ #define ARE 0x80 /* All Routes Explorer Frame */ #define IS_SRF(x) (((x) & 0x80)==SRF) #define IS_STE(x) (((x) & 0xc0)==STE) #define IS_ARE(x) (((x) & 0xc0)==ARE) #define LEN_MASK 0x1f /* Route Length mask */ /* Direction indicator bits, for control1 field */ #define DIR_FORWARD 0x00 /* Interpret Route Left to Right */ #define DIR_BACKWARD 0x80 /* Interpret Route Right to Left */ #define DIR_BIT 0x80 /* Maximum frame size, for control1 field */ #define LEN_516 0x00 #define LEN_1500 0x10 #define LEN_2052 0x20 #define LEN_4472 0x30 #define LEN_8144 0x40 #define LEN_11407 0x50 #define LEN_17800 0x60 #define LEN_NOT_SPEC 0x70 /* Route Indicator bit of source address */ #define ROUTE_INDICATOR 0x80 struct route { struct route *r_next, *r_back, *hsh_next; time_t r_timeout; /* in seconds */ time_t r_last_tx; /* time of last tx */ unchar r_mac_addr[6]; unchar r_state; unchar r_list; ulong r_ARP_mon; ulong r_tx_mon; ulong r_STE_ucs; struct route_info r_info; }; /* following timing parameters are in seconds */ struct route_param { int tx_resp; /* timeout for responding to rx */ int rx_ARE; /* window for rejecting more AREs */ int rx_STE_bcs; /* # STE bcs before invalidating route entry * and find new route */ int rx_STE_ucs; /* # STE ucs before invalidating route entry * and find new route */ int max_tx; /* upper limit for tx "recur" window */ int min_tx; /* lower limit for tx "recur" window */ int tx_recur; /* detected "recurs" before tx STE */ int ARE_disa; /* disable sending ARE frames */ }; #define MAX_HASH_HEADS 512 #define HASH_MODULUS 509 /* nearest prime */ struct route_table { struct lockb lock_rt; struct route_param *parms; uint nroutes; /* number of routes in route_table */ uint nhash_heads; /* number of hash heads per table */ uint ninuse; /* #Currently in use */ struct route *free; /* Free list head */ struct route *free_b; /* Free list tail */ struct route *inuse; /* List head for 'SR_IN_USE' */ struct route *inuse_b; /* tail for above */ struct route *disco; /* List head for other states */ struct route *disco_b; /* tail for above */ struct route *hash_heads[MAX_HASH_HEADS]; /* Routes */ struct route no_route, /* 'No route' */ ste_route, /* 'Single-route broadcast' */ are_route; /* 'All-routes broadcast' */ struct route routes[MAX_ROUTES-1]; }; #if defined(__STDC__) && !defined(_NO_PROTOTYPE) void dlpiSR_init(per_card_info_t *cp); int dlpiSR_make_header(per_card_info_t *cp, unchar *, unchar *); int dlpiSR_primitives(per_card_info_t *cp, queue_t *, mblk_t *); void dlpiSR_rx_parse(per_card_info_t *cp, struct per_frame_info *); void dlpiSR_auto_rx(per_card_info_t *cp, struct per_frame_info *f); #endif 070701000238ed000081a400000000000000030000000135aefcd90000017d00001dff0000000100000000000000000000002600000000root/usr/src/O5hdk/net/tools/Makefile# # @(#) Makefile 11.3 95/06/30 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. ROOT=.. include $(ROOT)/Make.inc PROG=cvbinCdecl all: $(PROG) cd aoflint; make $@ clean: cd aoflint; make $@ clobber: clean rm -f $(PROG) cd aoflint; make $@ 070701000238d1000081a400000000000000030000000135aefcd8000001c500001dff0000000100000000000000000000002e00000000root/usr/src/O5hdk/net/tools/aoflint/Makefile# # @(#) Makefile 5.1 94/06/10 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1994 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. OBJ=lexer.o parser.o error.o main.o all: aoflint aoflint: $(OBJ) $(CC) -o $@ $(OBJ) -ly -ll lexer.c: y.tab.h y.tab.h: yacc -v -d parser.y clean: rm -f $(OBJ) ctags y.tab.h lexer.c parser.c y.output clobber: clean rm -f aoflint 070701000238ce000081a400000000000000030000000135aefcd80000031f00001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/tools/aoflint/error.c#pragma comment(exestr, "@(#) error.c 5.1 94/06/10 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1994. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include extern int lineno; extern char *progname; extern char *filename; extern int exitcode; static char errbuf[1024]; static error_count=0; yyerror(str, a,b,c,d,e,f) char *str; { sprintf(errbuf, str,a,b,c,d,e); fprintf(stderr, "%s: %s(%d): Error: %s\n", progname, filename, lineno, errbuf); exitcode=1; if (error_count++ == 5) exit(exitcode); } yywarning(str, a,b,c,d,e,f) char *str; { sprintf(errbuf, str,a,b,c,d,e); fprintf(stderr, "%s: %s(%d): Warning: %s\n", progname, filename, lineno, errbuf); } 070701000238cf000081a400000000000000030000000135aefcd800000a3d00001dff0000000100000000000000000000002d00000000root/usr/src/O5hdk/net/tools/aoflint/lexer.l%a 4000 %o 5000 %{ #pragma comment(exestr, "@(#) lexer.l 11.1 95/07/21 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1995. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include "y.tab.h" int tokval; int lineno; %} %% PROMPT return (TOKEN_PROMPT); TYPE return (TOKEN_TYPE); VALUES return (TOKEN_VALUES); DEFAULTS return (TOKEN_DEFAULTS); SIZE return (TOKEN_SIZE); ADAPTER return (TOKEN_ADAPTER); DESCRIPTION return (TOKEN_DESCRIPTION); PKGDESC return (TOKEN_PKGDESC); BUS return (TOKEN_BUS); MEDIA_TYPE return (TOKEN_MEDIA_TYPE); MAX_BD return (TOKEN_MAX_BD); KEY return (TOKEN_KEY); REQUIRED return (TOKEN_REQUIRED); ADVANCED return (TOKEN_ADVANCED); SPEED return (TOKEN_SPEED); NET_BOOT return (TOKEN_NET_BOOT); ISA return (TOKEN_ISA); EISA return (TOKEN_EISA); MCA return (TOKEN_MCA); PCI return (TOKEN_PCI); ID return (TOKEN_ID); swconfig return (TOKEN_SWCONFIG); link-kit return (TOKEN_LINK_KIT); unique return (TOKEN_UNIQUE); very_slow return (TOKEN_VERYSLOW); slow return (TOKEN_SLOW); medium return (TOKEN_MEDIUM); fast return (TOKEN_FAST); ethernet return (TOKEN_ETHERNET); token-ring return (TOKEN_TOKEN_RING); fddi return (TOKEN_FDDI); dynamic return (TOKEN_DYNAMIC); static return (TOKEN_STATIC); autosearch return (TOKEN_AUTOSEARCH); = return (EQUAL); : return (COLON); - return (DASH); \, return (COMMA); \( return (OPEN_PAREN); \) return (CLOSE_PAREN); \| return (BAR); [0-9a-f]+ { #ifdef DEBUG printf("hex(%s)", yytext); fflush(stdout); #endif tokval = put_in_tbl(yytext); return (HEX_NUMBER); } [a-zA-Z][a-zA-Z0-9_/]* { #ifdef DEBUG printf("id(%s)", yytext); fflush(stdout); #endif tokval = put_in_tbl(yytext); return (IDENTIFIER); } \".*\" { yytext[yyleng]=0; tokval = put_in_tbl(yytext+1); #ifdef DEBUG printf("str(%s)", yytext+1); fflush(stdout); #endif return (STRING); } \n { lineno++; return (NEWLINE); } ^\#[^\n]* { } [ \t]+ { } %% #include "tab.h" char symtab[SYMTAB_SZ][SYM_SZ]; int symtab_used; int put_in_tbl(char *text) { int i; if (strlen(text) > SYM_SZ) { fprintf(stderr, "aoflint: Symbol too large (\"%s\", %d)\n", text, SYM_SZ); exit(1); } for (i=0; i #include #include #include char *progname; char *filename; int exitcode=0; extern int lineno, symtab_used, values_type, co_inuse, id_inuse; usage() { fprintf(stderr, "Usage:\n\taoflint AOF_file\n"); exit(1); } main(int argc, char **argv) { int i,fd; char *x; if (argc<2) usage(); x = strrchr(argv[0], '/'); if (x) { progname = x+1; } else { progname = argv[0]; } fd=0; close(fd); filename = argv[1]; fd = open(filename, O_RDONLY); if (fd == -1) { fprintf(stderr, "%s: Unable to open %s\n", progname, filename); perror("open"); exit(1); } lineno=1; symtab_used=0; values_type=0; co_inuse=0; id_inuse=0; yyparse(); exit(exitcode); } 070701000238d2000081a400000000000000030000000135aefcd80000229c00001dff0000000100000000000000000000002e00000000root/usr/src/O5hdk/net/tools/aoflint/parser.y%{ #pragma comment(exestr, "@(#) parser.y 59.1 96/11/20 SCOINC") /* * Copyright (C) The Santa Cruz Operation, 1993-1996. * This Module contains Proprietary Information of * The Santa Cruz Operation and should be treated * as Confidential. */ #include "tab.h" #include "ctype.h" extern int tokval; extern int lineno; int co_id; #define CO_NAME symtab[cotab[co_id].co_id_sym] int bus_type; #define BUS_ISA 1 #define BUS_EISA 2 #define BUS_MCA 3 #define BUS_PCI 3 int values_type; #define VAL_SIMPLE 1 #define VAL_REGION 2 known_param(char *str) { if ( !strcmp("BASE_IO", str) || !strcmp("SLOT", str) || !strcmp("IRQ", str) || !strcmp("RAM", str) || !strcmp("ROM", str) || !strcmp("DMA", str) || !strcmp("MEDIA", str) || !strcmp("TRANSCEIVER",str) ) { return 1; } return 0; } %} %token TOKEN_PROMPT %token TOKEN_TYPE %token TOKEN_VALUES %token TOKEN_DEFAULTS %token TOKEN_SIZE %token TOKEN_ADAPTER %token TOKEN_DESCRIPTION %token TOKEN_PKGDESC %token TOKEN_BUS %token TOKEN_MEDIA_TYPE %token TOKEN_MAX_BD %token TOKEN_KEY %token TOKEN_REQUIRED %token TOKEN_ADVANCED %token TOKEN_ISA %token TOKEN_EISA %token TOKEN_MCA %token TOKEN_PCI %token TOKEN_ETHERNET %token TOKEN_TOKEN_RING %token TOKEN_FDDI %token TOKEN_SWCONFIG %token TOKEN_LINK_KIT %token TOKEN_UNIQUE %token TOKEN_ID %token TOKEN_NET_BOOT %token TOKEN_AUTO %token TOKEN_DYNAMIC %token TOKEN_STATIC %token TOKEN_AUTOSEARCH %token EQUAL %token COLON %token DASH %token COMMA %token OPEN_PAREN %token CLOSE_PAREN %token BAR %token NEWLINE %token HEX_NUMBER %token IDENTIFIER %token STRING %token TOKEN_SPEED %token TOKEN_VERYSLOW %token TOKEN_SLOW %token TOKEN_MEDIUM %token TOKEN_FAST %% AOF_FILE : CONFIGURABLE_OPTION_LIST ADAPTER_SECTION ; BLANK_LINES : /* empty */ | BLS ; BLS : NEWLINE | BLS NEWLINE ; CONFIGURABLE_OPTION_LIST : CONFIGURABLE_OPTION | CONFIGURABLE_OPTION_LIST CONFIGURABLE_OPTION ; CONFIGURABLE_OPTION : BLANK_LINES IDENTIFIER { co_id = put_in_cotbl(tokval); } COLON NEWLINE CO_LINE_LIST { if (!cotab[co_id].co_type_line) yyerror("Missing \"TYPE=\""); if (!cotab[co_id].co_values_line) yywarning("Missing \"VALUES=\""); if (!cotab[co_id].co_prompt_line && !known_param(CO_NAME)) yyerror("Missing \"PROMPT=\""); if (!cotab[co_id].co_size_line && !strcmp("BASE_IO", CO_NAME) ) yyerror("Missing \"SIZE=\""); } ; CO_LINE_LIST : CO_LINE | CO_LINE_LIST CO_LINE ; CO_LINE : SIZE_LINE { cotab[co_id].co_size_line = 1; } | PROMPT_LINE { cotab[co_id].co_prompt_line = 1; } | TYPE_LINE { cotab[co_id].co_type_line = 1; } | VALUES_LINE { cotab[co_id].co_values_line = 1; } | DEFAULTS_LINE { cotab[co_id].co_defaults_line = 1; } ; SIZE_LINE : TOKEN_SIZE EQUAL HEX NEWLINE { if ( strcmp("BASE_IO", CO_NAME ) ) yyerror("\"SIZE\" only legal for BASE_IO attribute"); } ; PROMPT_LINE : TOKEN_PROMPT EQUAL STRING NEWLINE { if (known_param( CO_NAME ) ) yywarning("\"PROMPT\" not necessary"); } ; TYPE_LINE : TOKEN_TYPE EQUAL TYPE_LIST NEWLINE { if (!cotab[co_id].co_type_link_kit && !cotab[co_id].co_type_swconfig ) yyerror("\"TYPE\" must include swconfig or link_kit"); } ; TYPE_LIST : TYPE | TYPE_LIST COMMA TYPE ; TYPE : TOKEN_LINK_KIT { cotab[co_id].co_type_link_kit = 1; } | TOKEN_SWCONFIG { cotab[co_id].co_type_swconfig = 1; } | TOKEN_UNIQUE { cotab[co_id].co_type_unique = 1; if (known_param( CO_NAME )) yyerror("\"TYPE=unique\" not relevant"); } ; VALUES_LINE : TOKEN_VALUES EQUAL { values_type = 0; } VALUES_LIST NEWLINE ; VALUES_LIST : VAL_1 | VALUES_LIST COMMA VAL_1 ; VAL_1 : VAL_1A { if ( values_type == VAL_REGION ) yyerror("Type mismatch in list"); values_type = VAL_SIMPLE; } | VAL_1B { if ( values_type == VAL_SIMPLE ) yyerror("Type mismatch in list"); values_type = VAL_REGION; } | IDENTIFIER ; VAL_1A : HEX | RNG ; VAL_1B : REGION | RNG OPEN_PAREN RNG_SIZES CLOSE_PAREN ; RNG_SIZES : DEC | RNG_SIZES BAR DEC ; RNG : HEX DASH HEX COLON HEX { int x; if ( $1 >= $3 ) yyerror("Start of range >= End of range"); x = ($3-$1)/$5; if ( x < 2 ) yywarning("Only 0 or 1 elements in range"); if ( $1+($5*x) != $3 ) yyerror("Range end not aligned in units of 'step'"); } ; DEFAULTS_LINE : TOKEN_DEFAULTS EQUAL { if (!cotab[co_id].co_values_line) yywarning("\"VALUES=\" must preceed DEFAULTS"); } DEFAULTS_LIST NEWLINE ; DEFAULTS_LIST : VAL_2 | DEFAULTS_LIST COMMA VAL_2 ; VAL_2 : HEX { if (values_type == VAL_REGION) { yyerror("Type mismatch between VALUES and DEFAULTS"); } } | IDENTIFIER | REGION { if (values_type == VAL_SIMPLE) { yyerror("Type mismatch between VALUES and DEFAULTS"); } } ; REGION : HEX OPEN_PAREN RNG_SIZES CLOSE_PAREN ; HEX : HEX_NUMBER { int x; sscanf(symtab[tokval], "%x", &x); $$ = x; } ; DEC : HEX_NUMBER { char *x; int i; for (x=symtab[tokval]; *x; x++) { if (isalpha(*x++)) { yyerror("Syntax Error"); break; } } sscanf(symtab[tokval], "%d", &i); $$ = i; } ; ADAPTER_SECTION : ADAPTER_SECTION1 ADAPTER_SECTION2 ; ADAPTER_SECTION1 : BLANK_LINES TOKEN_ADAPTER COLON NEWLINE TOKEN_DESCRIPTION EQUAL STRING NEWLINE PKG_DEFINITION TOKEN_BUS EQUAL BUS_TYPE NEWLINE TOKEN_MEDIA_TYPE EQUAL MEDIA_TYPE NEWLINE TOKEN_MAX_BD EQUAL DEC NEWLINE ; ADAPTER_SECTION2 : TOKEN_KEY EQUAL ATTRIBUTE_LIST NEWLINE TOKEN_REQUIRED EQUAL ATTRIBUTE_LIST NEWLINE TOKEN_ADVANCED EQUAL ATTRIBUTE_LIST NEWLINE SPEED_DEFINITION { check_cotbl(); } ID_DEFINITIONS NETBOOT_DEFINITION BLANK_LINES ; BUS_TYPE : TOKEN_ISA { bus_type = BUS_ISA; } | TOKEN_EISA { bus_type = BUS_EISA; } | TOKEN_MCA { bus_type = BUS_MCA; } | TOKEN_PCI { bus_type = BUS_PCI; } ; MEDIA_TYPE : TOKEN_ETHERNET | TOKEN_TOKEN_RING | TOKEN_FDDI ; ATTRIBUTE_LIST : /* empty */ | ATTR_LIST ; ATTR_LIST : ATTRIBUTE | ATTR_LIST COMMA ATTRIBUTE ; ATTRIBUTE : IDENTIFIER { int x = is_in_cotbl(tokval); if (x == -1) { yyerror("Attribute '%s' not defined in AOF", symtab[tokval]); } else if ( cotab[x].co_used ) { yyerror("Attribute '%s' already used in KEY/REQUIRED/ADVANCED=", symtab[tokval]); } else { cotab[x].co_used = 1; } } ; SPEED_DEFINITION : /* empty */ | TOKEN_SPEED EQUAL SPEED_DEFS NEWLINE ; SPEED_DEFS : TOKEN_VERYSLOW | TOKEN_SLOW | TOKEN_MEDIUM | TOKEN_FAST ; PKG_DEFINITION : /* empty */ | TOKEN_PKGDESC EQUAL STRING NEWLINE ; NETBOOT_DEFINITION : /* empty */ | TOKEN_NET_BOOT EQUAL NETBOOT_DEFS NEWLINE ; NETBOOT_DEFS : /* empty */ | TOKEN_DYNAMIC | TOKEN_STATIC | TOKEN_AUTOSEARCH ; ID_DEFINITIONS : /* empty */ | TOKEN_ID EQUAL ID_DEFS NEWLINE { if (bus_type != BUS_EISA && bus_type != BUS_MCA) yyerror("\"ID=\" not valid for this bus"); } ID_DESCRIPTIONS { check_idtbl(); } ; ID_DEFS : ID | ID_DEFS COMMA ID ; ID : HEX { put_in_idtbl($1); } ; ID_DESCRIPTIONS : ID_DESC | ID_DESCRIPTIONS ID_DESC ; ID_DESC : HEX EQUAL STRING NEWLINE { int x = is_in_idtbl($1); if (x == -1) { yyerror("%x not defined in ID= line", $1); } else if (idtab[x].used) { yyerror("Duplicate %x= line", $1); } else { idtab[x].used = 1; } } ; %% #include int co_inuse; struct co cotab[COTAB_SZ]; is_in_cotbl(int sym) { int i; for (i=0; i= 0) { yyerror("Duplicate configuration option section"); return; } if (co_inuse == COTAB_SZ) { fprintf(stderr,"aoflint: Configuration Option table too small (%d entries)\n", COTAB_SZ); exit(1); } memset(&cotab[co_inuse], 0, sizeof(struct co)); cotab[co_inuse].co_id_sym = sym; return(co_inuse++); } int id_inuse; struct id idtab[IDTAB_SZ]; is_in_idtbl(int sym) { int i; for (i=0; i= 0) { yyerror("Duplicate ID"); return; } if (id_inuse == IDTAB_SZ) { fprintf(stderr,"aoflint: ID table too small (%d entries)\n", IDTAB_SZ); exit(1); } idtab[id_inuse].id = sym; idtab[id_inuse].used=0; return(id_inuse++); } check_idtbl() { int i; for (i=0; i " exit 1 fi CMPNT_FILE=$1 VENDOR=$2 COMP=$3 CODE=$VENDOR:$COMP: if [ $CODE = "SCO:lli:" ] then VERSION="\$${COMP}_VER" DIST_TREE="\$${COMP}_DIR" PKGLIST="LLI_DOC,CORE,NCFG" PKGFILE="\$${COMP}_DIR/input/$COMP.pkg,\$${COMP}_doc_DIR/input/LLI_DOC.pkg" DESC="Network Configuration Manager" else VERSION="\$${COMP}_VER" DIST_TREE="\$${COMP}_DIR" if [ -f $DOCDIST/ID/$COMP/${COMP}.*.html ] ; then PKGLIST=$COMP,${COMP}_DOC PKGFILE="\$${COMP}_DIR/input/$COMP.pkg,\$netdrivers_doc_DIR/input/${COMP}_doc.pkg" else PKGLIST=$COMP PKGFILE="\$${COMP}_DIR/input/$COMP.pkg" fi ROOT=${ROOT:-..} DRV_DIR=$ROOT/drv/mdi/$COMP AOF_DIR=$DRV_DIR/AOF AOF_FILE=`echo $AOF_DIR/* | sed -e 's/ .*//'` STZGET=$ROOT/cmd/stzget/stzget DRV_DESC="`$STZGET $AOF_FILE ADAPTER PKGDESC`" [ $? -ne 0 ] && DRV_DESC="`$STZGET $AOF_FILE ADAPTER DESCRIPTION`" DESC="`expr substr \"$DRV_DESC\" 1 43`" fi # update CDMT component file - add to subpackage awk ' /COMP/ { printf "%s%s\n",$0,comp next } /subpackages/ { printf "%s%s\n",$0,pkg next } /description/ { printf "%s%s\n",$0,desc next } /version/ { printf "%s%s\n",$0,version next } /distTreeRoot/ { printf "%s%s\n",$0,disttree next } /distTreeRootSERVER/ { printf "%s%s\n",$0,disttree next } /distTreeRootCLIENT/ { printf "%s%s\n",$0,disttree next } /pkgFiles/ { printf "%s%s\n",$0,pkgfile next } { print }' comp="$CODE" pkg="$PKGLIST" desc=\""$DESC\"" version="$VERSION" disttree="$DIST_TREE" pkgfile="$PKGFILE" < $CMPNT_FILE > /tmp/bog$$ mv /tmp/bog$$ $CMPNT_FILE exit 0 070701000238d6000081a400000000000000030000000135aefcda0000022100001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/tools/gencmpntmacr: # # @(#) gencmpntmacr 12.3 96/03/20 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates component macro entries for CDMT # if [ $# -lt 3 ] then echo "usage: $0 " exit 1 fi CONFIG_FILE=$1 COMP=$2 MNAME=$3 cat <>$CONFIG_FILE MACROS: ${MNAME}_VER =VERSION_REPLACED_FROM_Make.inc ${MNAME}_DIR =CWD_REPLACED_FROM_updatecdmt/dist/$COMP ! exit 0 070701000238d7000081a400000000000000030000000135aefcda000004db00001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/gendocpkg: # # @(#) gendocpkg 58.1 96/10/03 # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates common pkg entries for CDMT # if [ $# -ne 1 ] then echo "usage: $0 " exit 1 fi ROOT=${ROOT:-..} DRV_NAME=$1 DRV_DIR=$ROOT/drv/mdi/$DRV_NAME AOF_DIR=$DRV_DIR/AOF AOF_FILE=`echo $AOF_DIR/* | sed -e 's/ .*//'` PKG_FILE=$DRV_DIR/pkg STZGET=$ROOT/cmd/stzget/stzget DRVDIST_DIR=$ROOT/dist/netdrivers_doc/ID DRV_DESC="`$STZGET $AOF_FILE ADAPTER PKGDESC`" [ $? -ne 0 ] && DRV_DESC="`$STZGET $AOF_FILE ADAPTER DESCRIPTION`" DRV_DESC="`expr substr \"$DRV_DESC\" 1 45`" cat << -EOT # # ${DRV_NAME} (${DRV_DESC}) Documentation # PKG:${DRV_NAME}_DOC: description = "${DRV_DESC} Documentation" dependencies = SCO:Unix:UNIX_DOC::.* distTreeRoot = \$netdrivers_doc_DIR distTreeRootSERVER = \$netdrivers_doc_DIR distTreeRootCLIENT = \$netdrivers_doc_DIR DIR:${DRV_NAME}:SERVER:./ID/${DRV_NAME}: -EOT for f in $DRVDIST_DIR/${DRV_NAME}/${DRV_NAME}.*.html do echo "FILE:${DRV_NAME}_DOC:SERVER:./ID/${DRV_NAME}/`basename $f`:" echo "exportPathRegPhase = ./lib/scohelp/NetDrivers/`basename $f`" done exit 0 070701000238d8000081a400000000000000030000000135aefcda000001cb00001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/tools/gendocstubs: [ $# -eq 1 ] || { echo "Usage: $0 " >&2 exit 1 } [ ! -d $1/NetDrivers_DOC ] && mkdir -p $1/NetDrivers_DOC [ ! -d $1/NetDrivers_DOC/fr ] && mkdir -p $1/NetDrivers_DOC/fr [ ! -d $1/NetDrivers_DOC/de ] && mkdir -p $1/NetDrivers_DOC/de # make a stub for i in $1/drv/mdi/* do touch $1/NetDrivers_DOC/`basename $i`.netcardsC.html touch $1/NetDrivers_DOC/fr/`basename $i`.netcardsC.html touch $1/NetDrivers_DOC/de/`basename $i`.netcardsC.html done 070701000238d9000081a400000000000000030000000135aefcda0000180100001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/gendrvpkg: # # @(#) gendrvpkg 58.2 96/10/28 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates driver package ccs script # cat << -EOT # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # The information in this file is provided for the exclusive use of # the licensees of The Santa Cruz Operation, Inc. Such users have the # right to use, modify, and incorporate this code into other products # for purposes authorized by the license agreement provided they include # this notice and the associated copyright notice with any such product. # The information in this file is provided "AS IS" without warranty. # # # Set possible return codes for this script # OK=0; FAIL=1; WARN=2; PATH=\${PATH}:/usr/bin . ccsSetup.sh cleanup() { cd / rm -rf /tmp/lli exit \$1 } # save off the source routing OFF file if it exists # expects lli_dir to be set save_routing_file() { drvdir=\$1 unit=\$2 SRfile=/usr/lib/lli/\$drvdir/noroute\$unit [ -f "\$SRfile" ] && cp \$SRfile \$lli_dir/noroute } # save_lli may effect the return code (\$ret) of this script save_lli() { mdidrv=\$1 savedir=\$CCS_PERSISTENT_STORAGE/lli_save [ -d \$savedir ] || mkdir -p \$savedir for bd in 0 1 2 3 4 5 6 7 do lli=\$mdidrv\$bd grep "#\$lli\$" /usr/lib/netconfig/chains >/dev/null 2>&1 if [ "\$?" = "0" ] then lli_dir=\$savedir/\$lli mkdir -p \$lli_dir if [ "\$mdidrv" = "tok" -o "\$mdidrv" = "btok" ] then save_routing_file \$mdidrv \$bd fi lk=/etc/conf system=\$lli_dir/\$lli space=\$lli_dir/Space.c master=\$lli_dir/Master llisys=\$lk/sdevice.d/\$lli if [ -f \$llisys ] then awk '{ if ( \$2 == "N" ) exit 1 }' < \$llisys if [ "\$?" = "1" ] then ccsWarn "\$lli in chains, not kernel" rm -rf \$lli_dir ret=\$WARN fi cp \$llisys \$system else ccsWarn "\$lli in chains, no sdevice file" rm -rf \$lli_dir ret=\$WARN fi if [ -f \$lk/pack.d/\$lli/space.c ] then cp \$lk/pack.d/\$lli/space.c \$space fi grep "^\$lli[ ]" \$lk/cf.d/mdevice > \$master if [ -z \$master ] then ccsWarn "\$lli in chains, no mdevice entry" rm -rf \$lli_dir ret=\$WARN fi fi done return \$OK } # store previous configurations for IPU from Tbird. compatsave() { save_lli \$drv if [ "\$drv" = "pnt" ] then # the a2x LLI driver was replaced with pnt in LLI 3.3 save_lli a2x fi return \$OK } remove_lli_drivers() { mdidrv=\$1 for bd in 0 1 2 3 4 5 6 7 do llidrv=\${mdidrv}\${bd} [ -f /etc/conf/sdevice.d/\$llidrv ] && { /etc/conf/bin/idinstall -d -e \$llidrv } done if [ "\$drv" = "ne" -a -f /etc/conf/sdevice.d/ne_d ] then /etc/conf/bin/idinstall -d -e ne_d fi } clean_lli() { remove_lli_drivers \$drv if [ "\$drv" = "pnt" ] then # the a2x LLI driver was replaced with pnt in LLI 3.3 remove_lli_drivers a2x fi return \$OK } pcibuscheck() { while read type info do [ "\$type" = "%pci" ] && { echo "PCI" break } done < /dev/string/cfg } # convert previous IPU configuration data into SYSDB stanza file format preregister() { return \$OK } preconfigure() { # # Clean out any old LLI drivers that may still be in the link-kit # clean_lli # # Find out which I/O Buses supported on this machine # MACHINE_BUS=\`uname -X | awk '/ISA|EISA|MCA/ { print \$NF }'\` case \$MACHINE_BUS in ISA) MACHINE_HAS_ISA_BUS="Y" ;; EISA) MACHINE_BUS="EISA ISA" MACHINE_HAS_ISA_BUS="Y" ;; *) MACHINE_HAS_ISA_BUS="N" ;; esac MACHINE_BUS="\$MACHINE_BUS \`pcibuscheck\`" # pcmcia could be on any machine MACHINE_BUS="\$MACHINE_BUS PCMCIA" # # Look at all the AOF files in the driver's directory and link only the # ones which represent adapters supported on this platform into this # directory # STZGET=\`llipathmap\`/bin/stzget DRV_DIR=\$SSO_SHARED_ROOT/ID/\$drv INSTALL_DIR=/tmp/lli rm -rf \$INSTALL_DIR mkdir -p \$INSTALL_DIR/AOF copied_some_aofs="N" cd \$DRV_DIR/AOF for i in * do ADAPTER_BUS="\`\$STZGET \$i ADAPTER BUS\`" match=0 for a_arch in \$ADAPTER_BUS do for m_arch in \$MACHINE_BUS do [ "\$a_arch" = "\$m_arch" ] && { match=1 break } done [ \$match = 1 ] && break done [ \$match = 1 ] && { ln -s \$DRV_DIR/AOF/\$i \$INSTALL_DIR/AOF/\$i copied_some_aofs="Y" } done # If none of the adapters supported by this driver work in this machine # then do not install the driver into the configuration framework [ "\$copied_some_aofs" = "N" ] && cleanup \$OK cd \$DRV_DIR for i in * do case \$i in AOF) ;; acfg) [ "\$MACHINE_HAS_ISA_BUS" = "Y" ] && \\ ln -s \$DRV_DIR/\$i \$INSTALL_DIR/\$i ;; *) ln -s \$DRV_DIR/\$i \$INSTALL_DIR/\$i ;; esac done ccsLog "Installing the \$drv driver" cd \$INSTALL_DIR ccsExec ndinstall -a \$drv return \$OK } postunconfigure() { [ "\$key" = "UPGRADE" ] && return \$OK for i in \`ndinstall -l\` do [ \$drv = \$i ] && ccsExec ndinstall -d \$drv done return \$OK } ncfg_upg() { lliel=\$1 list=\${lliel}0 for bd in 1 2 3 4 5 6 7 do list="\$list \$lliel\$bd" done ncfg_tbird_upgrade \$list } update_doc() { DOC_SERVICE_BIN="/usr/man/bin/odssi/bin" NET_DRIVERS_DIR="/usr/lib/scohelp/$1NetDrivers" PATH=\${PATH}:\$DOC_SERVICE_BIN [ -x \$DOC_SERVICE_BIN/MkContents ] && { cd \$NET_DRIVERS_DIR ccsExec MkContents -t "\$LLI_DOCTITLE" } } #main Main MAIN step=\$1 key=\$2 drv=\$3 ret=\$OK if [ "\$LLI_DEBUG_FLAG" ] then echo "lli pkg.drv <\$*>" [ -f "\$LLI_DEBUG" ] && . \$LLI_DEBUG fi expr "\$drv" : '.*_DOC' >/dev/null 2>&1 status=\$? if [ \$status -ne 0 ] then case "\$step" in OLD_CUSTOM_UPGRADE) compatsave ncfg_upg \$drv if [ "\$drv" = "pnt" ] then ncfg_upg a2x fi ;; PRE_REGISTER) preregister ;; PRE_CONFIGURE) preconfigure ;; POST_UNCONFIGURE) postunconfigure ;; esac fi cleanup \$ret -EOT 070701000238da000081a400000000000000030000000135aefcda0000077800001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/gendrvprd: # # @(#) gendrvprd 12.1 96/03/15 SCOINC # # Copyright (C) The Santa Cruz Operation, 1995-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates single driver product file for CDMT # if [ $# -lt 5 ] then echo "usage: $0 " exit 1 fi PRD_FILE=$1 VENDOR=$2 CODE=$3 DOCSRC=$4 shift ; shift ; shift ; shift drv="$*" # get driver description ROOT=${ROOT:-..} DRV_DIR=$ROOT/drv/mdi/$drv AOF_DIR=$DRV_DIR/AOF AOF_FILE=`echo $AOF_DIR/* | sed -e 's/ .*//'` STZGET=$ROOT/cmd/stzget/stzget DRV_DESC="`$STZGET $AOF_FILE ADAPTER PKGDESC`" [ $? -ne 0 ] && DRV_DESC="`$STZGET $AOF_FILE ADAPTER DESCRIPTION`" # generate product header cat <>$PRD_FILE # # Product Description File # Describes entire product. # PROD:CODE_REPLACED_FROM_Make.inc: description ="$DRV_DESC" version =VERSION_REPLACED_FROM_Make.inc ! # generate driver component when without doc, driver parcel when with doc if [ -f $DOCSRC/$drv\.netcardsC.html ] then cat <>$PRD_FILE subparcels =CODE_REPLACED_FROM_Make.inc:${drv}p ! else cat <>$PRD_FILE packages =$VENDOR:$drv cmpntFiles =\$${drv}_DIR/input/${drv}.cmpnt ! fi # generate driver subparcels with doc (drivers without doc are not parcels) if [ -f $DOCSRC/$drv\.netcardsC.html ] then cat <>$PRD_FILE PARCEL:CODE_REPLACED_FROM_Make.inc:${drv}p: description ="$DRV_DESC" packages =$VENDOR:$drv cmpntFiles =\$${drv}_DIR/input/$drv.cmpnt ! if [ -f $DOCSRC/fr/$drv\.netcardsC.html ] then cat <>$PRD_FILE packages =$VENDOR:${drv}_FR cmpntFiles =\$${drv}_FR_DIR/input/${drv}_FR.cmpnt ! fi if [ -f $DOCSRC/de/$drv\.netcardsC.html ] then cat <>$PRD_FILE packages =$VENDOR:${drv}_DE cmpntFiles =\$${drv}_DE_DIR/input/${drv}_DE.cmpnt ! fi fi exit 0 070701000238db000081a400000000000000030000000135aefcd9000005c900001dff0000000100000000000000000000002500000000root/usr/src/O5hdk/net/tools/genlang: # # @(#) genlang 12.2 96/02/28 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates packages for localized layered languages # cat << -EOT # # Package description for the SharedControl package # PKG:Control: description = "Installation Control Package" DIR:Control:SERVER:./cntl: FILE:Control:SERVER:./cntl/ccs: perms = 0755 FILE:Control:SERVER:./cntl/cqs: perms = 0755 # # Netconfig package description # PKG:NCFG: description = "Netconfig Network Configuration Manager" DIR:NCFG:SERVER:./ncfg/netconfig.obj/$4: FILE:NCFG:SERVER:./ncfg/netconfig.obj/$4/title: DIR:NCFG:SHARED:./lib: DIR:NCFG:SHARED:./lib/nls: DIR:NCFG:SHARED:./lib/nls/msg: DIR:NCFG:SHARED:./lib/nls/msg/$1: exportPathRegPhase = /usr/lib/nls/msg/$2/lli exportPathRegPhase = /usr/lib/nls/msg/$3/lli FILE:NCFG:SHARED:./lib/nls/msg/$1/ncfg.cat: perms = 444 # # Network Adapter Drivers CORE package description # PKG:CORE: description = "Network Driver Configuration" DIR:CORE:SHARED:./lib: DIR:CORE:SHARED:./lib/nls: DIR:CORE:SHARED:./lib/nls/msg: DIR:CORE:SHARED:./lib/nls/msg/$1: exportPathRegPhase = /usr/lib/nls/msg/$2/lli exportPathRegPhase = /usr/lib/nls/msg/$3/lli FILE:CORE:SHARED:./lib/nls/msg/$1/lli.cat: perms = 444 FILE:CORE:SHARED:./lib/nls/msg/$1/ndinst.cat: perms = 444 FILE:CORE:SHARED:./lib/nls/msg/$1/dlpid.cat: perms = 444 -EOT 070701000238dc000081a400000000000000030000000135aefcda000004d300001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/genlliprd: # # @(#) genlliprd 55.2 96/06/19 SCOINC # # Copyright (C) The Santa Cruz Operation, 1995-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates netconfig product file for CDMT # if [ $# -lt 5 ] then echo "usage: $0 " exit 1 fi PRD_FILE=$1 VENDOR=$2 CODE=$3 DOCSRC=$4 shift ; shift ; shift ; shift DLIST="$*" # generate product upgrade component # cwd=`pwd` ; cd $ROOT/prodUpgrade ; make ; cd $cwd # generate configuration manager product cat <>$PRD_FILE # # Product Description File # Describes entire product. # PROD:CODE_REPLACED_FROM_Make.inc: description =Network Configuration Manager and Language Support version =VERSION_REPLACED_FROM_Make.inc packages =CODE_REPLACED_FROM_Make.inc cmpntFiles =\$PRD_REPLACED_FROM_Make.inc_DIR/input/lli.cmpnt packages =CODE_REPLACED_FROM_Make.inc_FR cmpntFiles =\$PRD_REPLACED_FROM_Make.inc_FR_DIR/input/lli_FR.cmpnt packages =CODE_REPLACED_FROM_Make.inc_DE cmpntFiles =\$PRD_REPLACED_FROM_Make.inc_DE_DIR/input/lli_DE.cmpnt ! exit 0 070701000238dd000081a400000000000000030000000135aefcd9000006e600001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/genlocccscat << -EOT : # # @(#) genlocccs 12.2 96/01/10 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Custom Control Script (ccs) # OK=0; FAIL=1; WARN=2 step=\$1 key=\$2 pkgs=\$3 LLI_DEBUG=/tmp/_lli_debug export LLI_DEBUG pkgscripts=\${SSO_SHARED_ROOT}/cntl/packages DOCPKG=\$pkgscripts/LLI_DOC/ccs base_everest=false . ccsSetup.sh # MAIN Main main if [ -f "\$LLI_DEBUG" ] then LLI_DEBUG_FLAG=1 export LLI_DEBUG_FLAG echo "ccs <\$*>" echo "ccs step <\$step> key <\$key> pkgs <\$pkgs>" echo "About to source \$LLI_DEBUG - to continue..." /ibin/sh [ -f "\$LLI_DEBUG" ] && . \$LLI_DEBUG fi calldrvpkgscripts() { for pkg in \$pkgs do p=\`getPackageCode \$pkg\` case \$p in *LLI_DOC) if [ -f "\$DOCPKG" ] then sh \$DOCPKG "\$step" "\$key" "\$pkgs" || ret=\$FAIL fi ;; esac done } case "\$step" in PRE_CONFIGURE) currentVer=\`customquery ListComponents -p ATTACH SCO:Unix\` for component in \$currentVer do case \$component in SCO:Unix::5.0.0Cl) base_everest=true ;; esac done [ \$base_everest = false ] && scoadmin -p Networks -f -i \${SSO_SHARED_ROOT}/ncfg/netconfig.obj ;; POST_UNCONFIGURE) currentVer=\`customquery ListComponents -p ATTACH SCO:Unix\` for component in \$currentVer do case \$component in SCO:Unix::5.0.0Cl) base_everest=true ;; esac done [ \$base_everest = false ] && scoadmin -P Networks -d netconfig.obj/$1 ;; PRE_EXPORT|POST_EXPORT|PRE_UNEXPORT|POST_UNEXPORT) # for the LLI_DOC package calldrvpkgscripts ;; esac if [ -f "\$LLI_DEBUG" ] then echo "ccs \$step after package scripts - to continue..." /ibin/sh fi exit \$OK -EOT 070701000238de000081a400000000000000030000000135aefcda000005e900001dff0000000100000000000000000000002900000000root/usr/src/O5hdk/net/tools/genloccmpnt: # # @(#) genloccmpnt 12.2 96/02/28 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates component files for localized layered languages # cat << -EOT # # Component Description File # Describes entire component. # # NOTE: A dependency to the SCO UNIX Link Kit is listed. # COMP:CODE_REPLACED_FROM_Make.inc_$1: description ="Network Configuration Manager $2 Support" version =\$PRD_REPLACED_FROM_Make.inc_$1_VER subpackages =LLI_DOC,CORE,NCFG required = distTreeRoot =\$PRD_REPLACED_FROM_Make.inc_$1_DIR distTreeRootSERVER =\$PRD_REPLACED_FROM_Make.inc_$1_DIR distTreeRootCLIENT =\$PRD_REPLACED_FROM_Make.inc_$1_DIR pkgFiles =\$PRD_REPLACED_FROM_Make.inc_$1_DIR/input/lli.pkg pkgFiles =\$PRD_REPLACED_FROM_Make.inc_doc_$1_DIR/input/LLI_DOC.pkg # # Now let's define some defaults attributes for our files: # # These defaults will be used if definitions for these # attributes are missing in the package description files. # DIR_DEFAULT: perms =0755 owner =bin group =bin FILE_DEFAULT: perms =0644 owner =bin group =bin -EOT 070701000238df000081a400000000000000030000000135aefcda000002b300001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/genloccqscat << -EOT : # # @(#) genloccqs 55.1 96/06/13 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Custom Control Script (ccs) # OK=0; FAIL=1; WARN=2 keys=\$1 pkgs=\$2 LLI_DEBUG=/tmp/_lli_debug . ccsSetup.sh if [ -f "\$LLI_DEBUG" ] then LLI_DEBUG_FLAG=1 export LLI_DEBUG_FLAG echo "cqs <\$*>" echo "About to source \$LLI_DEBUG - to continue..." /ibin/sh [ -f "\$LLI_DEBUG" ] && . \$LLI_DEBUG fi currentVer=\`customquery ListComponents -p ATTACH SCO:Unix\` [ "\$currentVer" = "SCO:Unix::5.0.0Cl" ] && { exit \$STOP } exit \$OK -EOT 070701000238e0000081a400000000000000030000000135aefcd90000060d00001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/tools/genlocdrcpnt: # # @(#) genlocdrcpnt 58.3 96/10/18 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates foreign language driver doc cmpnt entries for CDMT # if [ $# -ne 4 ] then echo "usage: $0 " exit 1 fi DRV_NAME=$1 VENDOR=$2 COMP=$3 ROOT=${ROOT:-..} DRV_DIR=$ROOT/drv/mdi/$DRV_NAME AOF_DIR=$DRV_DIR/AOF AOF_FILE=`echo $AOF_DIR/* | sed -e 's/ .*//'` STZGET=$ROOT/cmd/stzget/stzget DRV_DESC="`$STZGET $AOF_FILE ADAPTER PKGDESC`" [ $? -ne 0 ] && DRV_DESC="`$STZGET $AOF_FILE ADAPTER DESCRIPTION`" DRV_DESC="`expr substr \"$DRV_DESC\" 1 45`" case $4 in German) stubname=netdrivers_doc_DE ;; French) stubname=netdrivers_doc_FR ;; esac cat << -EOT # # Component Description File # COMP:$VENDOR:$COMP: description = "$4 Documentation" version =\$$3_VER subpackages =$1_DOC distTreeRoot =\$${stubname}_DIR distTreeRootSERVER =\$${stubname}_DIR distTreeRootCLIENT =\$${stubname}_DIR pkgFiles =\$${stubname}_DIR/input/${DRV_NAME}_doc.pkg # # default attributes may be overwritten in the pkg files # DIR_DEFAULT: perms =0755 owner =bin group =bin FILE_DEFAULT: perms =0644 owner =bin group =bin -EOT exit 0 070701000238e1000081a400000000000000030000000135aefcda0000027800001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/tools/genlocdrvcqscat << -EOT : # # @(#) genlocdrvcqs 12.2 96/03/19 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Custom Control Script (ccs) # OK=0; FAIL=1; WARN=2 keys=\$1 pkgs=\$2 LLI_DEBUG=/tmp/_lli_debug . ccsSetup.sh if [ -f "\$LLI_DEBUG" ] then LLI_DEBUG_FLAG=1 export LLI_DEBUG_FLAG echo "cqs <\$*>" echo "About to source \$LLI_DEBUG - to continue..." /ibin/sh [ -f "\$LLI_DEBUG" ] && . \$LLI_DEBUG fi [ -f /usr/lib/scohelp/$2/dochome.html ] || { exit \$STOP } exit \$OK -EOT 070701000238e2000081a400000000000000030000000135aefcda000006bb00001dff0000000100000000000000000000002a00000000root/usr/src/O5hdk/net/tools/genlocdrvpkg: # # @(#) genlocdrvpkg 58.1 96/10/03 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates common foreign language driver doc pkg entries for CDMT # if [ $# -ne 2 ] then echo "usage: $0 " exit 1 fi ROOT=${ROOT:-..} DRV_NAME=$1 DRV_DIR=$ROOT/drv/mdi/$DRV_NAME AOF_DIR=$DRV_DIR/AOF AOF_FILE=`echo $AOF_DIR/* | sed -e 's/ .*//'` STZGET=$ROOT/cmd/stzget/stzget DRVDIST_DIR=$DRVDIST/$DRV_NAME DRV_DESC="`$STZGET $AOF_FILE ADAPTER PKGDESC`" [ $? -ne 0 ] && DRV_DESC="`$STZGET $AOF_FILE ADAPTER DESCRIPTION`" DRV_DESC="`expr substr \"$DRV_DESC\" 1 45`" case $2 in fr_FR.ISO8859-1) name=${DRV_NAME}_FR ;; de_DE.ISO8859-1) name=${DRV_NAME}_DE ;; esac cat << -EOT # # Package description for the SharedControl package # PKG:Control: description = "Driver Control Package" distTreeRoot = \$${name}_DIR distTreeRootCLIENT = \$${name}_DIR distTreeRootSERVER = \$${name}_DIR DIR:Control:SERVER:./cntl: DIR:Control:SERVER:./cntl/packages: FILE:Control:SERVER:./cntl/cqs: perms = 0755 FILE:Control:SERVER:./cntl/ccs: perms = 0755 FILE:Control:SERVER:./cntl/instlib.sh: perms = 0755 FILE:Control:SERVER:./cntl/packages/pkg.drv: perms = 0755 # # ${DRV_NAME} (${DRV_DESC}) Documentation # PKG:${DRV_NAME}_DOC: description = "${DRV_DESC} Documentation" dependencies = SCO:Unix:UNIX_DOC::.* DIR:${DRV_NAME}_DOC:SERVER:./ID/${DRV_NAME}: -EOT for f in $DRVDIST_DIR/${DRV_NAME}.*.html do echo "FILE:${DRV_NAME}_DOC:SERVER:./ID/${DRV_NAME}/`basename $f`:" echo "exportPathRegPhase = ./lib/scohelp/$2/NetDrivers/`basename $f`" done exit 0 070701000238e3000081a400000000000000030000000135aefcda000005f200001dff0000000100000000000000000000002600000000root/usr/src/O5hdk/net/tools/genmacro: # # @(#) genmacro 58.1 96/10/03 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates foreign language driver doc macro entries for CDMT # if [ $# -lt 3 ] then echo "usage: $0 " exit 1 fi CONFIG_FILE=$1 DOCSRC=$2 shift ; shift DLIST="$*" # need macros for the stub doc pseudo-components: cat <<_DONE_>>$CONFIG_FILE netdrivers_doc_VER =VERSION_REPLACED_FROM_Make.inc netdrivers_doc_DIR =CWD_REPLACED_FROM_updatecdmt/dist/netdrivers_doc netdrivers_doc_FR_VER =VERSION_REPLACED_FROM_Make.inc netdrivers_doc_FR_DIR =CWD_REPLACED_FROM_updatecdmt/dist/netdrivers_doc_FR netdrivers_doc_DE_VER =VERSION_REPLACED_FROM_Make.inc netdrivers_doc_DE_DIR =CWD_REPLACED_FROM_updatecdmt/dist/netdrivers_doc_DE _DONE_ for drv in $DLIST do [ $drv = base_dist -o $drv = isl -o $drv = nls_dist ] && continue cat <>$CONFIG_FILE ${drv}_VER =VERSION_REPLACED_FROM_Make.inc ${drv}_DIR =CWD_REPLACED_FROM_updatecdmt/dist/$drv ! if [ -f $DOCSRC/fr/$drv\.netcardsC.html ] then cat <>$CONFIG_FILE ${drv}_FR_VER =VERSION_REPLACED_FROM_Make.inc ${drv}_FR_DIR =CWD_REPLACED_FROM_updatecdmt/dist/${drv}_FR ! fi if [ -f $DOCSRC/de/$drv\.netcardsC.html ] then cat <>$CONFIG_FILE ${drv}_DE_VER =VERSION_REPLACED_FROM_Make.inc ${drv}_DE_DIR =CWD_REPLACED_FROM_updatecdmt/dist/${drv}_DE ! fi done exit 0 070701000238e4000081a400000000000000030000000135aefcd80000020000001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/genmaster: # # @(#) genmaster 5.1 94/06/10 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1994 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PROG=$0 usage() { echo "usage: $PROG driver_name" exit 1 } if [ "$1" = "" ] then usage fi ROOT=${ROOT:-../..} DRV_NAME=$1 DRV_DIR=${ROOT}/drv/mdi/${DRV_NAME} if [ -f $DRV_DIR/Master ] then cat $DRV_DIR/Master else echo "${DRV_NAME}\tI\ticSH\t${DRV_NAME}\t0\t0\t0\t1\t-1" fi exit 0 070701000238e5000081a400000000000000030000000135aefcd80000018900001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/genmcsstr: # # @(#) genmcsstr 8.1 95/01/23 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. if [ $# -lt 2 ] then echo "usage: $0 " exit 1 fi PRODREL=$1 shift PRODDESC=$* echo "@(#) $PRODDESC Release $PRODREL `date +%Y/%m/%d`" exit 0 070701000238e6000081a400000000000000030000000135aefcd80000037200001dff0000000100000000000000000000002500000000root/usr/src/O5hdk/net/tools/gennode: # # @(#) gennode 12.1 95/12/04 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PROG=$0 usage() { echo "usage: $PROG driver_name" exit 1 } if [ "$1" = "" ] then usage fi ROOT=${ROOT:-../..} DRV_NAME=$1 DRV_DIR=${ROOT}/drv/mdi/${DRV_NAME} # # If there is a Node file, it overrides auto-generation # if [ -f "${DRV_DIR}/Node" ] then cat "${DRV_DIR}/Node" exit 0 fi # # Generate netconfig info file # DRV_NAME_UC=`echo ${DRV_NAME} | tr '[:lower:]' '[:upper:]'` AOF_FILE=`echo ${DRV_DIR}/AOF/* | sed -e 's/ .*//'` STZGET=$ROOT/cmd/stzget/stzget DRV_MAXBDS="`$STZGET $AOF_FILE ADAPTER MAX_BD`" BD=0 while [ $BD -le "${DRV_MAXBDS}" ] do echo "${DRV_NAME} mdi/${DRV_NAME}${BD} c ${BD} root root 600" BD=`expr $BD + 1` done exit 0 070701000238e7000081a400000000000000030000000135aefcda00000d6900001dff0000000100000000000000000000002800000000root/usr/src/O5hdk/net/tools/genoneoffs#!/bin/sh # # @(#) genoneoffs 67.5 97/11/05 # # Copyright (C) The Santa Cruz Operation, 1997. # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Script used to build individual driver VOL.000.000's. # Does not build lli. Does not build *_FR, *_DE, *_doc # peices because these require handoff from documentation. # # Basically this script massages the cdmt configuration files # (like cdmt.config and input/*). # # NOTE: When making a driver available on the SCO BBS, update # oneoffs.inc with that driver name and new release number or bump # up the release number letter if the driver already exists in # oneoffs.inc. # # WARNING: If the content of the dist/*/input/* and dist/*/cdmt.* files # are changed or additional information is added, this script will require # further modification! # rm -rf oneoffs . oneoffs.inc if [ -f Make.inc ]; then TMPPROD=`grep "PRODREL=" Make.inc` if [ $? != 0 ]; then echo "\nERROR:" echo "Couldn't find PRODREL in Make.inc to verify release." echo "There could be a problem with release versions in the" echo "cdmt configuration files for each oneoff/driver." exit 1 elif [ "$TMPPROD" != "PRODREL=$CURREL" ]; then echo "\nERROR:" echo "Make.inc has been updated with a new release ($TMPPROD)." echo "Update oneoffs.inc and possibly tools/genoneoffs accordingly." exit 1 fi fi [ ! -d ./oneoffs ] && mkdir ./oneoffs echo Copying files from dist ... (cd dist; find . -print | egrep -v 'lli|_FR|_DE|_doc' | cpio -dump ../oneoffs) rm -f oneoffs/*/cdmt.config cd oneoffs echo Processing input/\*.prd files ... for i in `ls */input/*.prd` ; do mv $i $i.old #echo Processing $i ... sed -e '/subparcels/{ s.*=SCO:\([a-zA-Z0-9]*\):.* packages =SCO:\1 h s.* =SCO:\([a-zA-Z0-9]*\) cmpntFiles =$\1_DIR/input/\1.cmpnt G }' -e '/^PARCEL/,$d' $i.old > $i rm -f $i.old done echo Processing input/\*.pkg files ... for i in `ls */input/*.pkg` ; do mv $i $i.old #echo Processing $i ... sed -e '/LINK/d' -e '/upgradeMappings/d' $i.old > $i rm -f $i.old done echo Processing input/\*.cmpnt files ... for i in `ls */input/*.cmpnt` ; do mv $i $i.old #echo Processing $i ... sed -e '/subpackages/{ s,[a-zA-Z0-9]*_DOC }' -e '/pkgFiles/{ s,$netdrivers_doc_DIR[a-zA-Z0-9_/.]*\.pkg }' $i.old > $i rm -f $i.old done echo Processing cdmt.prd.config files ... for i in `ls */cdmt.prd.config` ; do new="`echo $i | sed -e 's/\.prd//g'`" sed -e '/_DIR/{ sdistoneoffs }' -e "/ahs_lli_VER/{ sahs_lli_VER =5.0.\([0-9]\).*lli_VER =$lli_VER # Warning: leave above sed command double quoted instead of # single quoted. $lli_VER must be expanded by the shell. }" $i > $new rm -f $i done echo Processing cdmt.prd.config and input/\*.prd with release numbers ... for i in * do eval "TMPREL=$`echo ${i}_REL`" # if drv_REL not set, default to DRVREL release number if [ -z "$TMPREL" ]; then eval "TMPREL=$DRVREL" fi mv ${i}/cdmt.config ${i}/cdmt.config.old eval "sed -e s/$CURREL/$TMPREL/g \ < ${i}/cdmt.config.old > ${i}/cdmt.config" rm -f ${i}/cdmt.config.old mv ${i}/input/${i}.prd ${i}/input/${i}.prd.old eval "sed -e s/$CURREL/$TMPREL/g \ < ${i}/input/${i}.prd.old > ${i}/input/${i}.prd" rm -f ${i}/input/${i}.prd.old done echo Running cdmt tools ... for i in * ; do ( cd $i ; cdmtParse && cdmtCompress && cdmtArchive | tee cdmt.log ) done 070701000238e8000081a400000000000000030000000135aefcd8000006a700001dff0000000100000000000000000000002600000000root/usr/src/O5hdk/net/tools/genperms: # # @(#) genperms 12.1 95/12/04 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PROG=$0 usage() { echo "usage: $PROG driver_name" exit 1 } if [ "$1" = "" ] then usage fi ROOT=${ROOT:-..} DRV_NAME=$1 DRV_NAME_UC=`echo ${DRV_NAME} | tr '[:lower:]' '[:upper:]'` AOF_DIR=$ROOT/drv/mdi/${DRV_NAME}/AOF AOF_FILE=`echo $AOF_DIR/* | sed -e 's/ .*//'` PERM_FILE=$ROOT/drv/mdi/${DRV_NAME}/perms STZGET=$ROOT/cmd/stzget/stzget DRV_DESC="`$STZGET $AOF_FILE ADAPTER DESCRIPTION`" DRV_DESC="`expr substr \"$DRV_DESC Adapter \" 1 45`" # # Generate the common perms entries # cat << -EOT # #!${DRV_NAME_UC} 98 ${DRV_DESC} ${DRV_NAME_UC} F700 bin/bin 1 ./tmp/init.${DRV_NAME} 01 ${DRV_NAME_UC} f644 bin/bin 1 ./usr/lib/lli/netconfig/info/${DRV_NAME}0 01 ${DRV_NAME_UC} D755 bin/bin 1 ./usr/lib/lli/ID/${DRV_NAME} ${DRV_NAME_UC} sf644 bin/bin 1 ./usr/lib/lli/ID/${DRV_NAME}/Master 01 ${DRV_NAME_UC} sf644 bin/bin 1 ./usr/lib/lli/ID/${DRV_NAME}/System 01 ${DRV_NAME_UC} sf644 bin/bin 1 ./usr/lib/lli/ID/${DRV_NAME}/Node 01 ${DRV_NAME_UC} sf644 bin/bin 1 ./usr/lib/lli/ID/${DRV_NAME}/Space.c 01 ${DRV_NAME_UC} sf644 bin/bin 1 ./usr/lib/lli/ID/${DRV_NAME}/Driver.o 01 ${DRV_NAME_UC} sf755 bin/bin 1 ./usr/lib/lli/ID/${DRV_NAME}/lkcfg 01 ${DRV_NAME_UC} D755 bin/bin 1 ./usr/lib/lli/ID/${DRV_NAME}/AOF -EOT for i in $AOF_DIR/* do echo "${DRV_NAME_UC} sF644 bin/bin 1 ./usr/lib/lli/ID/${DRV_NAME}/AOF/`basename $i` 01" done # # Append the files which are not common to all mdi drivers # [ ! -f $PERM_FILE ] || cat ${PERM_FILE} 070701000238e9000081a4000000000000000300000001375724be0000143000001dff0000000100000000000000000000002400000000root/usr/src/O5hdk/net/tools/genpkg: # # %Z% %M% %I% %E% %Q% # # Copyright (C) The Santa Cruz Operation, 1994-1999 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates common pkg entries for CDMT # if [ $# -ne 1 ] then echo "usage: $0 " exit 1 fi ROOT=${ROOT:-..} DRV_NAME=$1 DRV_DIR=$ROOT/drv/mdi/$DRV_NAME AOF_DIR=$DRV_DIR/AOF AOF_FILE=`echo $AOF_DIR/* | sed -e 's/ .*//'` PKG_FILE=$DRV_DIR/pkg STZGET=$ROOT/cmd/stzget/stzget DRVDIST_DIR=$DRVDIST/$DRV_NAME DRV_DESC="`$STZGET $AOF_FILE ADAPTER PKGDESC`" [ $? -ne 0 ] && DRV_DESC="`$STZGET $AOF_FILE ADAPTER DESCRIPTION`" DRV_DESC="`expr substr \"$DRV_DESC\" 1 45`" case $DRV_NAME in "btok") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:btok::.* upgradeMappings=SCO:lli:BTOK::.*" ;; "dcxe") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "dcxf") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "dex") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "dfx") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "e3A") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:e3A::.* upgradeMappings=SCO:lli:E3A::.*" ;; "e3B") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:e3B::.* upgradeMappings=SCO:lli:E3B::.*" ;; "e3C") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:e3C::.* upgradeMappings=SCO:lli:E3C::.*" ;; "e3D") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:e3D::.* upgradeMappings=SCO:lli:E3D::.*" ;; "e3E") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:e3E::.* upgradeMappings=SCO:lli:E3E::.*" ;; "e3G") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "e3H") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "eeA") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:eeA::.* upgradeMappings=SCO:lli:EEA::.*" ;; "eeB") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:eeB::.* upgradeMappings=SCO:lli:EEB::.*" ;; "eeC") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "eeD") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "eeE") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "exos") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:exos::.* upgradeMappings=SCO:lli:EXOS::.*" ;; "hfm") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "hfs") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "hhtr") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "hpe") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:hpe::.* upgradeMappings=SCO:lli:HPE::.*" ;; "hpi") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:hpi::.* upgradeMappings=SCO:lli:HPI::.*" ;; "i3B") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:i3B::.* upgradeMappings=SCO:lli:I3B::.*" ;; "i6E") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:i6E::.* upgradeMappings=SCO:lli:I6E::.*" ;; "nat") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:nat::.* upgradeMappings=SCO:lli:NAT::.*" ;; "ne") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:ne::.* upgradeMappings=SCO:lli:NE::.*" ;; "pnt") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:A2X::.* upgradeMappings=SCO:lli:pnt::.* upgradeMappings=SCO:lli:PNT::.*" ;; "sebm") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:sebm::.* upgradeMappings=SCO:lli:SEBM::.*" ;; "sme") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:sme::.* upgradeMappings=SCO:lli:SME::.*" ;; "smpw") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "spwr") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "stbg") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "tok") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:tok::.* upgradeMappings=SCO:lli:TOK::.*" ;; "trps") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:NCFG::5.0.[^4-9].*" ;; "wdn") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:wdn::.* upgradeMappings=SCO:lli:WDN::.*" ;; "wwdu") UPGRADE_MAPPING=" upgradeMappings=SCO:lli:wwdu::.* upgradeMappings=SCO:lli:WWDU::.*" ;; *) UPGRADE_MAPPING="" ;; esac cat << -EOT # # ${DRV_NAME} (${DRV_DESC}) # PKG:${DRV_NAME}: description = "${DRV_DESC}" dependencies = SCO:link:LINK:: -EOT if [ "$PRODCODE" = "SCO:lli" ]; then echo "dependencies = SCO:lli:NCFG::\$lli_VER" else echo "dependencies = SCO:lli:NCFG::" fi cat << -EOT ${UPGRADE_MAPPING} DIR:${DRV_NAME}:SERVER:./ID/${DRV_NAME}: FILE:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/Driver.o: perms = 0555 FILE:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/Master: perms = 0444 FILE:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/System: perms = 0644 FILE:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/Node: perms = 0444 FILE:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/Space.c: perms = 0644 FILE:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/lkcfg: perms = 0555 DIR:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/AOF: -EOT for f in $AOF_DIR/* do echo "FILE:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/AOF/`basename $f`:" echo " perms = 0444" done [ -f $DRVDIST_DIR/acfg ] && { echo "FILE:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/acfg:" echo " perms = 0555" } for i in ${DRV_NAME} space do [ -f $DRV_DIR/${i}.h ] && { echo "FILE:${DRV_NAME}:SERVER:./ID/${DRV_NAME}/${i}.h:" echo " perms = 0444" } done # # Append the files which are not common to all mdi drivers # [ ! -f $PKG_FILE ] || cat ${PKG_FILE} exit 0 070701000238ea000081a400000000000000030000000135aefcd900000cbc00001dff0000000100000000000000000000002400000000root/usr/src/O5hdk/net/tools/genprd: # # @(#) genprd 55.4 96/06/19 SCOINC # # Copyright (C) The Santa Cruz Operation, 1995-1996 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # # Generates product file for CDMT # if [ $# -lt 5 ] then echo "usage: $0 " exit 1 fi PRD_FILE=$1 VENDOR=$2 CODE=$3 DOCSRC=$4 shift ; shift ; shift ; shift DLIST="$*" PARCEL_NAME=${VENDOR}doc PKGS="" CMPNTS="" # sort components based on descriptions ROOT=${ROOT:-..} for drv in $DLIST do [ $drv = base_dist -o $drv = isl -o $drv = nls_dist ] && continue DRV_DIR=$ROOT/drv/mdi/$drv AOF_DIR=$DRV_DIR/AOF AOF_FILE=`echo $AOF_DIR/* | sed -e 's/ .*//'` STZGET=$ROOT/cmd/stzget/stzget DRV_DESC="`$STZGET $AOF_FILE ADAPTER PKGDESC`" [ $? -ne 0 ] && DRV_DESC="`$STZGET $AOF_FILE ADAPTER DESCRIPTION`" echo "$drv $DRV_DESC" >> /tmp/llidesc$$ done # generate product upgrade component # if [ $CODE = "SCO:lli" ] # then # cwd=`pwd` ; cd $ROOT/prodUpgrade ; make ; cd $cwd # cat <>$PRD_FILE # ! # fi # generate configuration manager parcel if [ $CODE = "SCO:lli" ] then cat <>$PRD_FILE subparcels =CODE_REPLACED_FROM_Make.inc:llip # subparcels =CODE_REPLACED_FROM_Make.inc:$PARCEL_NAME ! fi # generate driver component when without doc, driver parcel when with doc if [ -f /tmp/llidesc$$ ] then sort +1 /tmp/llidesc$$ > /tmp/llisort$$ for p in `awk '{ print $1 }' < /tmp/llisort$$` do case $p in base_dist) ;; isl) ;; nls_dist) ;; *) cat <>$PRD_FILE subparcels =CODE_REPLACED_FROM_Make.inc:${p}p ! esac done fi # generate configuration manager subparcel with language support if [ $CODE = "SCO:lli" ] then cat <>$PRD_FILE PARCEL:CODE_REPLACED_FROM_Make.inc:llip: description =Network Configuration Manager and Language Support packages =CODE_REPLACED_FROM_Make.inc cmpntFiles =\$PRD_REPLACED_FROM_Make.inc_DIR/input/lli.cmpnt packages =CODE_REPLACED_FROM_Make.inc_FR cmpntFiles =\$PRD_REPLACED_FROM_Make.inc_FR_DIR/input/lli_FR.cmpnt packages =CODE_REPLACED_FROM_Make.inc_DE cmpntFiles =\$PRD_REPLACED_FROM_Make.inc_DE_DIR/input/lli_DE.cmpnt ! fi # generate driver subparcels if [ -f /tmp/llidesc$$ ] then for p in `awk '{ print $1 }' < /tmp/llisort$$` do case $p in base_dist) ;; isl) ;; nls_dist) ;; *) DRV_DIR=$ROOT/drv/mdi/$p AOF_DIR=$DRV_DIR/AOF AOF_FILE=`echo $AOF_DIR/* | sed -e 's/ .*//'` STZGET=$ROOT/cmd/stzget/stzget DRV_DESC="`$STZGET $AOF_FILE ADAPTER PKGDESC`" [ $? -ne 0 ] && DRV_DESC="`$STZGET $AOF_FILE ADAPTER DESCRIPTION`" cat <>$PRD_FILE PARCEL:CODE_REPLACED_FROM_Make.inc:${p}p: description ="$DRV_DESC" packages =$VENDOR:$p cmpntFiles =\$${p}_DIR/input/$p.cmpnt ! if [ -f $DOCSRC/fr/$p\.netcardsC.html ] then cat <>$PRD_FILE packages =$VENDOR:${p}_FR cmpntFiles =\$${p}_FR_DIR/input/${p}_FR.cmpnt ! fi if [ -f $DOCSRC/de/$p\.netcardsC.html ] then cat <>$PRD_FILE packages =$VENDOR:${p}_DE cmpntFiles =\$${p}_DE_DIR/input/${p}_DE.cmpnt ! fi esac done fi rm -f /tmp/llisort$$ /tmp/llidesc$$ exit 0 070701000238eb000081a400000000000000030000000135aefcd80000020f00001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/gensource: # # @(#) gensource 5.1 94/06/10 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1994 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. [ $# = 0 ] && { echo "Usage\n\tgensource driver..." exit 1 } ROOT=${ROOT:-..} cd $ROOT rm -f ./src.tar.Z find . -follow -type f -print | grep -v './drv/mdi/[^/]*/' >/tmp/tarlist for i in $* do find ./drv/mdi/$i -follow -type f -print >>/tmp/tarlist done tar cFf /tmp/tarlist - | compress >./src.tar.Z 070701000238ec000081a400000000000000030000000135aefcd8000002d000001dff0000000100000000000000000000002700000000root/usr/src/O5hdk/net/tools/gensystem: # # @(#) gensystem 5.1 94/06/10 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1994 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. PROG=$0 usage() { echo "usage: $PROG driver_name" exit 1 } if [ "$1" = "" ] then usage fi ROOT=${ROOT:-../..} DRV_NAME=$1 DRV_DIR=$ROOT/drv/mdi/$DRV_NAME AOF_FILE=`echo $DRV_DIR/AOF/* | sed -e 's/ .*//'` STZGET=$ROOT/cmd/stzget/stzget [ -f $DRV_DIR/System ] && { cat $DRV_DIR/System exit 0 } # # Generate netconfig info file # DRV_MAXBDS="`$STZGET $AOF_FILE ADAPTER MAX_BD`" BD=0 while [ $BD -le "${DRV_MAXBDS}" ] do echo "${DRV_NAME} N 0 0 0 0 0 0 0 0" BD=`expr $BD + 1` done exit 0 070701000238ee000081a400000000000000030000000135aefcd8000002f600001dff0000000100000000000000000000002600000000root/usr/src/O5hdk/net/tools/stripmcs: # # @(#) stripmcs 5.1 94/06/10 SCOINC # # Copyright (C) The Santa Cruz Operation, 1993-1994 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. usage() { echo "usage: $0 " exit 1 } bail() { echo $1 exit 1 } if [ "$1" = "" -o "$2" = "" ] then usage fi DIR=$1 MCSSTRING=$2 if [ ! -d "$DIR" ] then bail "directory \"$DIR\" does not exist" fi echo strip \& mcs binaries in \"$DIR\", MCS string \"$MCSSTRING\" find $DIR -type f -print | xargs file | fgrep "executable" \ | sed 's%^\(..*\):.*$%\1%' | while read file ; do echo "\t$file" strip $file 2>/dev/null mcs -d $file 2>/dev/null mcs -a "$MCSSTRING" $file 2>/dev/null done exit 0 070701000238ef000081a400000000000000030000000135aefcd90000029d00001dff0000000100000000000000000000002800000000root/usr/src/O5hdk/net/tools/updatecdmt: # # @(#) updatecdmt 12.1 95/11/21 SCOINC # # Copyright (C) The Santa Cruz Operation, 1994-1995 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. # PRD=$1 REL=$2 FILE=$3 CODE=$4 MEDIA=$5 shift ; shift ; shift ; shift ; shift DESC=$* cwd=`pwd` [ -f $FILE ] || exit 1 sed -e "s~PRD_REPLACED_FROM_Make.inc~$PRD~g" \ -e "s~DESC_REPLACED_FROM_Make.inc~$DESC~g" \ -e "s~VERSION_REPLACED_FROM_Make.inc~$REL~g" \ -e "s~CODE_REPLACED_FROM_Make.inc~$CODE~g" \ -e "s~MEDIA_REPLACED_FROM_Make.inc~$MEDIA~g" \ -e "s~CWD_REPLACED_FROM_updatecdmt~$cwd~g" $FILE > /tmp/bog$$ mv /tmp/bog$$ $FILE exit 0 0707010002384c000081a4000000000000000300000001372d13de0000004800001dff0000000100000000000000000000001200000000install/copyright(C) Copyright 1999 The Santa Cruz Operation, Inc. All rights reserved. 0707010002384d000081a4000000000000000300000001375732a8000000d800001dff0000000100000000000000000000001300000000install/postremove#!/bin/sh #ident "%W%" # # Copyright (C) The Santa Cruz Operation, 1999 # This Module contains Proprietary Information of # The Santa Cruz Operation, and should be treated as Confidential. rm -rf /usr/src/O5hdk/net 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!!