2017-02-21 12:14:26 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# cputype
|
|
|
|
#
|
2017-11-09 21:49:43 +01:00
|
|
|
# Copyright (c) 2014-2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
2017-02-21 12:14:26 +01:00
|
|
|
#
|
|
|
|
# Based on the IBM machine model, returns a (hopefully) human understandable
|
|
|
|
# string that identifies the processor.
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# cputype
|
|
|
|
#
|
|
|
|
# Return values:
|
|
|
|
# 1 The script was executed on a system that is a non-IBM mainframe
|
|
|
|
# architecture
|
|
|
|
# 2 The search for the machine type in /proc/cpuinfo returned a null string
|
|
|
|
# 3 The parsing of the machine type returned a null string
|
|
|
|
# 4 The machine type found is (probably) a new one, and the script needs to
|
|
|
|
# be updated to handle it.
|
|
|
|
#
|
|
|
|
|
|
|
|
architecture=$(/bin/uname -m)
|
|
|
|
if [ "${architecture}" != "s390x" -a "${architecture}" != "s390" ]; then
|
|
|
|
echo "This command is only useful on IBM mainframes." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
args=$(/usr/bin/grep machine /proc/cpuinfo | /usr/bin/cut -f2- -d: | /usr/bin/tr -d ' ' | /usr/bin/tr ',' ';' )
|
|
|
|
|
|
|
|
if [ -z "${args}" ]; then
|
|
|
|
echo "I couldn't find the machine type. Please report a bug with this output:" >&2
|
|
|
|
/bin/cat /proc/cpuinfo >&2
|
|
|
|
echo "******************" >&2
|
|
|
|
/usr/bin/grep machine /proc/cpuinfo >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
eval ${args}
|
|
|
|
|
|
|
|
if [ -z "${machine}" ] ; then
|
|
|
|
echo "The machine type came out null. Please report a bug with this output:" >&2
|
|
|
|
/bin/cat /proc/cpuinfo >&2
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "${machine}" in
|
|
|
|
2064) echo "${machine} = z900 IBM eServer zSeries 900" ;;
|
|
|
|
2066) echo "${machine} = z800 IBM eServer zSeries 800" ;;
|
|
|
|
2084) echo "${machine} = z990 IBM eServer zSeries 990" ;;
|
|
|
|
2086) echo "${machine} = z890 IBM eServer zSeries 890" ;;
|
|
|
|
2094) echo "${machine} = z9-EC IBM System z9 Enterprise Class" ;;
|
|
|
|
2096) echo "${machine} = z9-BC IBM System z9 Business Class" ;;
|
|
|
|
2097) echo "${machine} = z10-EC IBM System z10 Enterprise Class" ;;
|
|
|
|
2098) echo "${machine} = z10-BC IBM System z10 Business Class" ;;
|
|
|
|
2817) echo "${machine} = z196 IBM zEnterprise 196" ;;
|
|
|
|
2818) echo "${machine} = z114 IBM zEnterprise 114" ;;
|
|
|
|
2827) echo "${machine} = z12-EC IBM zEnterprise EC12" ;;
|
|
|
|
2828) echo "${machine} = z12-BC IBM zEnterprise BC12" ;;
|
|
|
|
2964) echo "${machine} = z13 IBM z13" ;;
|
|
|
|
2965) echo "${machine} = z13s IBM z13s (single frame)" ;;
|
2017-11-09 21:49:43 +01:00
|
|
|
3906) echo "${machine} = z14 IBM z14" ;;
|
2017-02-21 12:14:26 +01:00
|
|
|
*) echo "An unknown machine type was reported: ${machine}" >&2
|
|
|
|
echo "Please file a bug report with this output:" >&2
|
|
|
|
/bin/cat /proc/cpuinfo >&2
|
|
|
|
exit 4
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|