From: mikebo@i88.isc.com (Michael Borowiec)
Subject: SUMMARY: Remote ID Sun CPUs
Organization: INTERACTIVE Systems Corporation, Naperville, IL
Date: Thu, 15 Oct 1992 20:35:42 GMT

A while back I posted asking for some way to ID Sun CPUs via network.
Thanks to all who responded with pointers to the "devinfo" and "hostid"
commands. Turns out that "devinfo" is not implemented on the old Sun-3
architecture "yet" and probably never will be. Because we have a mix
of old/new Sun equipment I opted for a "hostid" solution.

The following shell script is derived almost entirely from a script I
received from Mike Khaw (khaw@parcplace.com). Thanks Mike!

--------------------------------------------------------------------------
Michael Borowiec  (N9EUZ)  -  mikebo@isc.com  -  mikebo@timesink.chi.il.us
INTERACTIVE Systems Corp. - 1901 N. Naper Blvd. - Naperville, IL 60563 USA
A Kodak Company  -  Telephone: 708-505-9100 ext. 229  -  FAX: 708-505-9133
--------------------------------------------------------------------------

#! /bin/sh
# Call this script "sunid" and make a hard link to "sunhexid".
#
# hostids are AMXXXXXX
#	A = architecture, M = machine type, XXXXXX = hex CPU serial number
# see /usr/include/sun{2,3,3x,386,4,4c,4m}/cpu.h for A and M.
# see /usr/include/mon/idprom.h for processor ID prom names

myname=`basename $0`

case $myname in
  sunid)
	case $# in
	  0)	host=`hostname | cut -d. -f1` ; hex=`hostid` ;;
	  1)	host=$1; hex=`rsh $host hostid` ;;
	  *)	echo "Usage: $myname [remote_sun]" ; exit 1 ;;
	esac
	;;

  sunhexid)
	case $# in
	  0)	echo -n "hostid: " ; read hex ;;
	  1)	hex=$1 ;;
	  *)	echo "Usage: $myname [hostid]" ; exit 1 ;;
	esac

	echo $hex | grep -s '^[0-9A-Fa-f]\{7,8\}$'
	case $? in
	  0)	;;
	  *)	echo "$myname: $hex is not a valid hostid" ; exit 1 ;;
	esac
	;;
esac
		  
case $hex in
  0???????)	arch="Sun-2"	;;
  1???????)	arch="Sun-3"	;;
  2???????)	arch="Sun-4"	;;
  4???????)	arch="Sun-3x"	;;
  5???????)	arch="Sun-4c"	;;
  7???????)	arch="Sun-4m"	;;
  *)		arch="Sun-?"	;;
esac

case $hex in
  11??????)	mach='3/1x0|3/75' ;;	# Carrera
  12??????)	mach='3/50' ;;		# M25
  13??????)	mach='3/2x0' ;;		# Sirius
  14??????)	mach='3/110' ;;		# Prism
  17??????)	mach='3/60' ;;		# 3F
  18??????)	mach='3/E' ;;		# 3E
  21??????)	mach='4/2x0' ;;		# Sparc
  22??????)	mach='4/110' ;;		# Cobra
  23??????)	mach='4/3x0' ;;		# Stingray
  24??????)	mach='4/4x0' ;;		# Sunray
  31??????)	mach='386i' ;;		# RoadRunner
  41??????)	mach='3/4x0' ;;		# Pegasus
  42??????)	mach='3/80' ;;		# Hydra
  51??????)	mach='SS1 (4/60)' ;;		# Campus1
  52??????)	mach='IPC (4/40)' ;;		# 
  53??????)	mach='SS1+ (4/65)' ;;		# 
  54??????)	mach='SLC (4/20)' ;;		# 
  55??????)	mach='SS2 (4/75)' ;;		# 
  56??????)	mach='ELC (4/25)' ;;		# 
  57??????)	mach='IPX (4/50)' ;;		# 
  58??????)	mach='? (4/70)' ;;		# 
  59??????)	mach='? (4/80)' ;;		# 
  5a??????)	mach='? (4/10)' ;;		# 
  5b??????)	mach='? (4/45)' ;;		# 
  5c??????)	mach='? (4/05)' ;;		# 
  5d??????)	mach='? (4/85)' ;;		# 
  5e??????)	mach='? (4/32)' ;;		# 
  5f??????)	mach="? (0x$hex)" ;;		# 
  71??????)	mach='4/600' ;;			#
  72??????)	mach="? (0x$hex)" ;;		#
  [12]??????)	mach='Sun-2' ;;
  *)		mach="(0x$hex)" ;;
esac

echo "$host $arch ($mach)"