#!/bin/sh # # sunmodel # from ftp://ftp.fwi.uva.nl/pub/comp/solaris/sunmodel # modified by Phil Budne for C-MAINBOL distribution # # Parse output from devinfo/prtconf # and display the kind of Sun and its clock # frequency. # # Jan Wortelboer (janw@fwi.uva.nl) # idea from Chris Metcalf, metcalf@lcs.mit.edu # version 1.6.1 6 April 1994 # changed trying to adjust to SPARCstation 20 and SPARCstation 5 # version 1.7 01 June 1994 added FrameBuffer # version 1.8 08 June 1994 690 corrected # version 1.9 20 januari 1995 TGX-PLUS added # version 1.99 24 februari 1995 More GX specs # version 1.999 24 may 1995 TCX trial, i am not happy with it. # version 1.9999 04 august 1995 support for Ross,RT625 # version 2.0000 10 oktober 1995 egrep removed, expr was to large for sunos. # added memory size # version 2.0001 17 januari 1996 added support for ultra. # version 2.0002 01 march 1996 added support for Ross,RT625 without cpuF # version 2.0003 01 may 1996 added support for Ross,CY605 without cpuF # # $Log: sunmodel,v $ # Revision 1.3 1997/07/29 19:43:32 phil # cleanup, comments # # Revision 1.2 1997/07/27 01:54:44 phil # use hostid on system without openprom # rearrange to (hopefully) work on sunos 4.0 (and 3.0) shell # if [ -f /usr/bin/uname ]; then version=`uname -r` hostje=`uname -n` else # no uname command; pre-SunOS 4.1 hostje=`hostname` if [ -d /var ]; then version=4.0 else version=3.x fi fi case $version in # DEBUG MODE #*) # pr_conf="cat sunmodel.input" # ;; 6.*|5.*) # solaris machine case `uname -m` in sun4) # old sun4: no openprom. karch=sun4 mach=sparc if [ -f /usr/ucb/hostid ]; then hostid=`/usr/ucb/hostid` else # sysinfo(SI_HW_SERIAL, ...) provides data # but must have bsd compatability software to # get it from command line?! # could compile a small program?? hostid=xxx fi ;; i86pc) # no openprom on x86 # very few properties of value; # cpu-type is always "486", even on Pentium Pro! # bus-type "isa" even when pci present # machine-mfg "generic AT" # boot-path tells if booted from IDE or SCSI, ie; # /isa/ata@1f0,0/cmdk@0,0:a # just show memory size; memsize=`/usr/sbin/prtconf -v | grep 'Memory size:' | sed 's/Memory.size:[ ]*//'` echo Machine $hostje x86 $memsize exit 0 ;; *) # sun4c, sun4m, sun4d, sun4u, ppc?! pr_conf="/usr/sbin/prtconf -vp" ;; esac ;; 3.*|4.*) # pre 4.1 systems don't have uname; karch=`/usr/bin/arch -k` case "$karch" in sun4c|sun4m) # sun4c or sun4m sunos 4 machine. use openprom devinfo pr_conf="/usr/etc/devinfo -vp";; sun2|sun3*|sun386|sun4|Series*|S4*) # non-openprom machine. use hostid mach=`/usr/bin/mach` hostid=`hostid`;; esac ;; *) echo cant determine sunmodel exit 1 ;; esac if [ "$hostid" ]; then # here with systems with no openprom # hostid mappings from hosttype v2.0 # by John DiMarco case "$hostid" in 01*) sys='2/100'; cpu='mc68010 @ 10';; 02*) sys='2/50'; cpu='mc68010 @ 10';; 04*) sys="Solbourne $karch"; cpu="$mach";; 11*) sys='3/100'; cpu='mc68020 @ 16.7';; 12*) sys='3/50'; cpu='mc68020 @ 12.5';; 13*) sys='3/200'; cpu='mc68020 @ 25';; 14*) sys='3/110'; cpu='mc68020 @ 16.7';; 17*) sys='3/60'; cpu='mc68020 @ 16.7';; 18*) sys='3/E'; cpu='mc68020';; 21*) sys='4/200'; cpu='sparc @ 16.7';; 22*) sys='4/100'; cpu='sparc @ 14.2';; 23*) sys='4/300'; cpu='sparc @ 25';; 24*) sys='4/400'; cpu='sparc @ 33';; 31*) sys='386i'; cpu='i80386DX @ 15 or 25';; 32*) sys='486i'; cpu='i80486DX';; 41*) sys='3/400'; cpu='mc68030 @ 33';; 42*) sys='3/80'; cpu='mc68030 @ 20';; *) sys="unknown $karch"; cpu="$mach";; esac # run /usr/etc/mc68881version or /usr/etc/fpuversion4 if present? echo Machine $hostje $sys $cpu exit 0 fi # declare functions here; pre-SunOS4.1 shell did not have functions! name= bname= freq=0 cpus=0 cpu= cpuc= cpuf=0 memsize= name_freq=0 fb= dblbuf=0 vmsize=0 depth=0 height=0 width=0 hfreq=0 vfreq=0 fbmapped=0 emulation="" montype="" fbext="\'cgthree\'|\'cgsix\'|\'cgtwelve\'|501-2325|501-1672|501-2253|SUNW,tcx" fmext="montype|hfreq|vfreq|dblbuf|vmsize|depth|height|width|fbmapped|vram|tcx-8-bit|tcx-24-bit" not="nvramrc|blit-width" hex_to_decm() { f=`hex_to_dec $1` f=`expr $f \/ 100000 | sed 's/\(.*\)\(.\)/\1.\2/'` echo $f } hex_to_deck() { f=`hex_to_dec $1` f=`expr $f \/ 100 | sed 's/\(.*\)\(.\)/\1.\2/'` echo $f } hex_to_dec() { hf=`echo $1 | tr '[a-z]' '[A-Z]'` f=` ( echo "ibase=16" ; echo $hf ) | bc` echo $f } fbuf_calc() { if [ ${hfreq} -eq 0 -o ${vfreq} -eq 0 ] then if [ ${vfreq} -gt 0 ] then sfreq="-${vfreq}Hz" else sfreq= fi else sfreq=@${hfreq}kHz-${vfreq}Hz fi if [ ${dblbuf} -gt 0 -a ${fbmapped} -gt 0 ] then sdb="(Dubble Buffered)" else sdb= fi if [ ${width} -gt 0 -a ${height} -gt 0 ] then if [ ${depth} -gt 0 ] then sfmt=${width}x${height}x${depth} else sfmt=${width}x${height} fi else sfmt= fi if [ ${vmsize} -gt 0 ] then svm=${vmsize}MB else svm= fi if [ "" != "${montype}" ] then smon=Mon${montype} else smon= fi echo ${svm}${sdb} ${smon} ${sfmt}${sfreq} dblbuf=0 vmsize=0 depth=0 height=0 width=0 fbmapped=0 hfreq=0 vfreq=0 montype= } export name bname freq $pr_conf | ( egrep -v "$not" ; echo end ) | while read pr_line do case $pr_line in Memory?size:*) memsize=`echo $pr_line | sed 's/Memory.size:[ ]*//'`" " ;; dblbuf:*) set $pr_line dblbuf=`hex_to_dec $2` ;; vram:*) set $pr_line vmsize=`hex_to_dec $2` ;; vmsize:*) set $pr_line vmsize=`hex_to_dec $2` ;; tcx-8-bit:*) set $pr_line if [ $# = 1 ] then depth=8 else # don't know yet depth=`hex_to_dec $2` fi ;; tcx-24-bit:*) set $pr_line if [ $# = 1 ] then depth=24 else # don't know yet depth=`hex_to_dec $2` fi ;; depth:*) set $pr_line depth=`hex_to_dec $2` ;; height:*) set $pr_line height=`hex_to_dec $2` ;; awidth:*) ;; width:*) set $pr_line width=`hex_to_dec $2` ;; fbmapped:*) set $pr_line fbmapped=`hex_to_decm $2` ;; hfreq:*) set $pr_line hfreq=`hex_to_deck $2` ;; vfreq:*) set $pr_line vfreq=`hex_to_dec $2` ;; montype:*) set $pr_line montype=`hex_to_dec $2` ;; clock-frequency:*) if [ "$freq" = 0 ] then set $pr_line freq=`hex_to_decm $2` else set $pr_line name_freq=`hex_to_decm $2` fi ;; banner-name:*) bname=`echo $pr_line | sed 's/.*banner-name:[ ]*//'` #pcount=`echo $pr_line | sed 's/.*(\(.*\) X.*//'` ;; emulation:*) set $pr_line emulation=$2 ;; *\'cgthree\'*) if [ "$fb" = "" ] then fb="CG3 `fbuf_calc`" fi ;; *\'cgsix\'*) if [ "$fb" = "" ] then fb="GX `fbuf_calc`" fi ;; *\'cgtwelve\'*) fb="GS `fbuf_calc`" ;; *'SUNW,501-2253'*) fb="TGX-PLUS `fbuf_calc`" ;; *'SUNW,501-2325'*) fb="TGX `fbuf_calc`" ;; *'SUNW,tcx'*) fb="TCX `fbuf_calc`" ;; *'SUNW,501-1672'*) fb="GX `fbuf_calc`" ;; name:*) if [ "$name" = "" ] then name=`echo $pr_line | sed 's/.*name:[ ]*//'` if [ "$bname" = "" ] then bname=$name fi fi case $name in *4/20*) bname="'SPARCstation SLC'" ;; *4/25*) bname="'SPARCstation ELC'" ;; *4/40*) bname="'SPARCstation IPC'" ;; *4/50*) bname="'SPARCstation IPX'" ;; *4/60[0-9]*) ;; *4/60*) bname="'SPARCstation 1'" ;; *4/65*) bname="'SPARCstation 1+'" ;; *4/75*) bname="'SPARCstation 2'" ;; esac fname=`echo $pr_line | sed 's/.*name:[ ]*//'` case $fname in *Cypress,CY605*) cpu='Cypress,CY605' cpus=`expr $cpus + 1` if [ $name_freq = 0 ] then #SPARCsystem 600MP (4 X CY605) # no freq with in cpu part name_freq=$freq fi cpuf=$name_freq cpuc= ;; *TI,TMS390Z55*) cpu="Texas Instruments TMS390Z55 1MB S.Cache" cpus=`expr $cpus + 1` cpuf=$name_freq cpuc=1 ;; *TI,TMS390Z50*) cpu="Texas Instruments TMS390Z50" cpus=`expr $cpus + 1` cpuf=$name_freq cpuc= ;; *TI,TMS390S10*) cpu="Texas Instruments TMS390S10 (MicroSparc)" cpus=`expr $cpus + 1` cpuf=$name_freq cpuc= ;; *SUNW,UltraSPARC*) cpu="UltraSPARC" cpus=`expr $cpus + 1` cpuf=$name_freq cpuc= ;; *Ross,RT625*) cpu="Ross,RT625" cpus=`expr $cpus + 1` if [ $name_freq = 0 ] then #SPARCsystem 600MP (4 X RT625) # no freq with in cpu part name_freq=$freq fi cpuf=$name_freq cpuc= ;; esac save_freq=$name_freq name_freq=0 ;; device_type:*'cpu'*) if [ $cpuf = 0 ] then cpu="No Name,Send prtconf -vp output to janw@wins.uva.nl" fi ;; end) if [ $cpuf = 0 ] then cpuf=$freq fi if [ `expr "$bname" : "'.*39.Z.*'"` != 0 -a `expr "$bname" : ".*[21]000.*"` = 0 ] then case $cpuf in 33.0|30.0) if [ "$cpus" != 1 ] then bname="$bname '(Model 2$cpus)'" else bname="$bname '(Model 20)'" fi freq=$cpuf ;; 36.0) if [ "$cpus" != 1 ] then bname="$bname '(Model 3$cpus)'" else bname="$bname '(Model 30)'" fi freq=$cpuf ;; 40.3) if [ "$cpus" != 1 ] then bname="$bname '(Model 4${cpuc}${cpus})'" else bname="$bname '(Model 41)'" fi freq=$cpuf ;; 45.0|50.0) if [ "$cpus" != 1 ] then bname="$bname '(Model 5${cpuc}${cpus})'" else bname="$bname '(Model 51)'" fi freq=$cpuf ;; 60.*) if [ "$cpus" != 1 ] then bname="$bname '(Model 6${cpuc}${cpus})'" else bname="$bname '(Model 61)'" fi freq=$cpuf ;; *) if [ "$cpus" != 1 ] then bname="$bname '(Model X${cpuc}${cpus})'" fi freq=$cpuf ;; esac else if [ $cpus -gt 1 ] then bname="$bname ($cpus X $cpu cpus)" fi fi echo Machine $hostje: $bname @ $cpuf MHz $memsize$fb ;; #*) # echo $pr_line "?????" #;; esac done