summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Horák <dan@danny.cz>2010-03-29 15:02:30 +0200
committerDan Horák <dan@danny.cz>2010-03-29 15:02:30 +0200
commit3790592efda2302d245c3bfaa23ff2d717e1e6dc (patch)
tree9b3760b6941841457237b7df0bffc8de4cd0bbc3
parent5773577f235cd2cd3b55bd82f8fb9c4002f1b978 (diff)
downloadutils-3790592efda2302d245c3bfaa23ff2d717e1e6dc.tar.gz
utils-3790592efda2302d245c3bfaa23ff2d717e1e6dc.tar.xz
utils-3790592efda2302d245c3bfaa23ff2d717e1e6dc.zip
import files
-rw-r--r--.gitignore1
-rw-r--r--Makefile53
-rw-r--r--cpi.initd130
-rw-r--r--cpi.sysconfig5
-rw-r--r--dasd.udev16
-rw-r--r--dasdconf.sh94
-rw-r--r--device_cio_free.conf6
-rw-r--r--zfcp.udev1
-rw-r--r--zfcpconf.sh55
9 files changed, 361 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9adf581
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.tar.bz2
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c815781
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,53 @@
+#
+# Makefile for installing the Fedora/RHEL specific s390(x) stuff
+#
+
+PACKAGE=s390utils
+VERSION=0.1
+
+DESTDIR=
+BINDIR=$(DESTDIR)/bin
+SBINDIR=$(DESTDIR)/sbin
+USRBINDIR=$(DESTDIR)/usr/bin
+USRSBINDIR=$(DESTDIR)/usr/sbin
+UDEVDIR=$(DESTDIR)/lib/udev
+SYSCONFIGDIR=$(DESTDIR)/etc
+
+
+UDEV_RULES=dasd.udev zfcp.udev
+UDEV_HELPERS=dasdconf.sh zfcpconf.sh
+
+SERVICES=cpi.initd
+SYSCONFIGS=cpi.sysconfig
+
+SBIN_SCRIPTS=device_cio_free
+
+UPSTART_CONFIGS=device_cio_free.conf
+
+FILES=Makefile $(UDEV_RULES) $(UDEV_HELPERS) $(SERVICES) $(SYSCONFIGS) $(SCRIPTS) $(UPSTART_CONFIGS)
+
+
+all:
+
+install:
+ mkdir -p $(BINDIR) \
+ $(SBINDIR) \
+ $(USRBINDIR) \
+ $(USRSBINDIR) \
+ $(UDEVDIR)/rules.d \
+ $(SYSCONFIGDIR) \
+ $(SYSCONFIGDIR)/rc.d/init.d \
+ $(SYSCONFIGDIR)/sysconfig \
+ $(SYSCONFIGDIR)/init
+ install -p -m 644 $(UDEV_RULES) $(UDEVDIR)/rules.d
+ install -p -m 755 $(UDEV_HELPERS) $(UDEVDIR)
+ install -p -m 644 $(SERVICES) $(SYSCONFIGDIR)/rc.d/init.d
+ install -p -m 644 $(SYSCONFIGS) $(SYSCONFIGDIR)/sysconfig
+ install -p -m 755 $(SBIN_SCRIPTS) $(SBINDIR)
+ install -p -m 644 $(UPSTART_CONFIGS) $(SYSCONFIGDIR)/init
+
+dist:
+ mkdir -p $(PACKAGE)-$(VERSION)
+ cp -p $(FILES) $(PACKAGE)-$(VERSION)
+ tar cjf $(PACKAGE)-$(VERSION).tar.bz2 $(PACKAGE)-$(VERSION)
+ rm -rf $(PACKAGE)-$(VERSION)
diff --git a/cpi.initd b/cpi.initd
new file mode 100644
index 0000000..463a2e5
--- /dev/null
+++ b/cpi.initd
@@ -0,0 +1,130 @@
+#!/bin/sh
+#
+# Copyright 2009 Red Hat, Inc.
+# License: GPLv2
+# Author: Dan Horák <dhorak@redhat.com>
+#
+# cpi Set Control Program Identification on IBM zSeries
+#
+# chkconfig: 12345 80 20
+# description: Set Control Program Identification on IBM zSeries \
+# that's reported from Linux guest to a LPAR or z/VM
+
+### BEGIN INIT INFO
+# Provides: cpi
+# Required-Start:
+# Required-Stop:
+# Should-Start:
+# Should-Stop:
+# Default-Start: 1 2 3 4 5
+# Default-Stop: 0 6
+# Short-Description: Set control program identification on IBM zSeries
+# Description: Set Control Program Identification on IBM zSeries \
+# that's reported from Linux guest to a LPAR or z/VM
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+prog="cpi"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+cpipath=/sys/firmware/cpi
+
+start() {
+ [ `id -u` -eq 0 ] || return 4
+
+ echo -n $"Starting $prog: "
+
+ if [ -d $cpipath ]; then
+ retval=0
+ echo LINUX > $cpipath/system_type 2> /dev/null || retval=1
+ [ $retval -eq 0 ] && echo "$SYSTEM_NAME" > $cpipath/system_name 2> /dev/null || retval=1
+ [ $retval -eq 0 ] && echo "$SYSPLEX_NAME" > $cpipath/sysplex_name 2> /dev/null || retval=1
+ level_maj=`uname -r | cut -d '-' -f 1 | cut -d '.' -f 1`
+ level_min=`uname -r | cut -d '-' -f 1 | cut -d '.' -f 2`
+ level_mic=`uname -r | cut -d '-' -f 1 | cut -d '.' -f 3`
+ level=`printf '%02x%02x%02x' $level_maj $level_min $level_mic`
+ [ $retval -eq 0 ] && echo $level > $cpipath/system_level 2> /dev/null || retval=1
+
+ [ $retval -eq 0 ] && echo 1 > $cpipath/set 2> /dev/null || retval=1
+ else
+ retval=1
+ fi
+
+ [ $retval -eq 0 ] && success || failure
+ echo
+ return $retval
+}
+
+stop() {
+ echo -n $"Stopping $prog: "
+
+ # nothing to do
+ success
+ echo
+ return 0
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ restart
+}
+
+force_reload() {
+ restart
+}
+
+rh_status() {
+ if [ -d $cpipath ]; then
+ echo -n "System type: "; cat $cpipath/system_type
+ echo -n "System level: "; cat $cpipath/system_level
+ echo -n "System name: "; cat $cpipath/system_name
+ echo -n "Sysplex name: "; cat $cpipath/sysplex_name
+ retval=0
+ else
+ echo "Control Program Identification system interface doesn't exist."
+ retval=1
+ fi
+ return $retval
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+ start)
+ $1
+ ;;
+ stop)
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ force-reload)
+ force_reload
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+ exit 2
+esac
+exit $?
diff --git a/cpi.sysconfig b/cpi.sysconfig
new file mode 100644
index 0000000..22f7bc3
--- /dev/null
+++ b/cpi.sysconfig
@@ -0,0 +1,5 @@
+# Define a system name (8 chars maximum)
+SYSTEM_NAME=
+
+# Define a sysplex name (8 chars maximum)
+SYSPLEX_NAME=
diff --git a/dasd.udev b/dasd.udev
new file mode 100644
index 0000000..5364935
--- /dev/null
+++ b/dasd.udev
@@ -0,0 +1,16 @@
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="dasd-eckd", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="dasd-fba", RUN+="/sbin/dasdconf.sh"
+
+# This list should be autogenerated with "modinfo dasd_{eckd,fba}_mod"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t1750m*dt3380dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t1750m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2107m*dt3380dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2107m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t9343m*dt9345dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2105m*dt3380dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3990m*dt3380dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3880m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2105m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3990m*dt3390dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3880m*dt3370dm*", RUN+="/sbin/dasdconf.sh"
+ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t6310m*dt9336dm*", RUN+="/sbin/dasdconf.sh"
diff --git a/dasdconf.sh b/dasdconf.sh
new file mode 100644
index 0000000..fb3ac90
--- /dev/null
+++ b/dasdconf.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+
+# config file syntax:
+# deviceno sysfs_opts...
+#
+# Examples:
+# 0.0.0203 readonly=1 failfast=1
+# 0.0.0204
+# 0.0.0205 erplog=1
+
+[ -z "$DEVPATH" ] && exit 0
+[ "$ACTION" != "add" ] && exit 0
+
+CHANNEL=${DEVPATH##*/}
+
+CONFIG=/etc/dasd.conf
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+export PATH
+
+warn() {
+ [ -e /dev/kmsg ] && echo "<4>dasdconf.sh Warning: $@" > /dev/kmsg
+ echo "dasdconf.sh Warning: $@" >&2
+}
+
+if [ -f "$CONFIG" ]; then
+ if [ ! -d /sys/bus/ccw/drivers/dasd-eckd ] && [ ! -d /sys/bus/ccw/drivers/dasd-fba ]; then
+ #warn "No dasd-eckd or dasd-eckd loaded"
+ exit 0
+ fi
+ tr "A-Z" "a-z" < $CONFIG | while read line; do
+ case $line in
+ \#*) ;;
+ *)
+ [ -z "$line" ] && continue
+ set $line
+
+ # if we are in single add mode, only add the new CHANNEL
+ [ "$SUBSYSTEM" = "ccw" ] && [ "$1" != "$CHANNEL" ] && continue
+
+ DEVICE=$1
+ SYSFSPATH=
+
+ if [ -r "/sys/bus/ccw/drivers/dasd-eckd/$DEVICE" ]; then
+ SYSFSPATH="/sys/bus/ccw/drivers/dasd-eckd/$DEVICE"
+ elif [ -r "/sys/bus/ccw/drivers/dasd-fba/$DEVICE" ]; then
+ SYSFSPATH="/sys/bus/ccw/drivers/dasd-fba/$DEVICE"
+ else
+ # if we are in single add mode, this is a failure!
+ [ "$SUBSYSTEM" = "ccw" ] && warn "Could not find $DEVICE in sysfs"
+ continue
+ fi
+
+ # skip already onlined devices
+ if [ "$(cat $SYSFSPATH/online)" = "1" ]; then
+ if [ "$SUBSYSTEM" = "ccw" ]; then
+ # if we are in single add mode, we should not touch the device
+ warn "$DEVICE is already online, not configuring"
+ exit 0
+ fi
+ continue
+ fi
+
+ shift
+ while [ -n "$1" ]; do
+ (
+ attribute="$1"
+ IFS="="
+ set $attribute
+
+ if [ "$1" = "use_diag" ]; then
+ # this module better only returns after
+ # all sysfs entries have the "use_diag" file
+ modprobe dasd_diag_mod
+ fi
+
+ if [ -r "$SYSFSPATH/$1" ]; then
+ echo $2 > $SYSFSPATH/$1 || warn "Could not set $1=$2 for $DEVICE"
+ else
+ warn "$1 does not exist for $DEVICE"
+ fi
+ )
+ shift
+ done
+
+ # Now, put the device online
+ echo 1 > $SYSFSPATH/online || echo "Could not activate $DEVICE"
+
+ # if we are in single add mode, we are done
+ [ "$SUBSYSTEM" = "ccw" ] && exit 0
+ ;;
+ esac
+ done
+fi
+exit 0
diff --git a/device_cio_free.conf b/device_cio_free.conf
new file mode 100644
index 0000000..0f4a115
--- /dev/null
+++ b/device_cio_free.conf
@@ -0,0 +1,6 @@
+#
+# free all devices on startup
+#
+
+start on starting rcS
+exec device_cio_free
diff --git a/zfcp.udev b/zfcp.udev
new file mode 100644
index 0000000..5e846a4
--- /dev/null
+++ b/zfcp.udev
@@ -0,0 +1 @@
+KERNEL=="zfcp_cfdc", RUN+="/sbin/zfcpconf.sh"
diff --git a/zfcpconf.sh b/zfcpconf.sh
new file mode 100644
index 0000000..4eb1ab6
--- /dev/null
+++ b/zfcpconf.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# config file syntax:
+# deviceno WWPN FCPLUN
+#
+# Example:
+# 0.0.4000 0x5005076300C213e9 0x5022000000000000
+# 0.0.4001 0x5005076300c213e9 0x5023000000000000
+#
+#
+# manual setup:
+# modprobe zfcp
+# echo 1 > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
+# echo LUN > /sys/bus/ccw/drivers/zfcp/0.0.4000/WWPN/unit_add
+#
+# Example:
+# modprobe zfcp
+# echo 1 > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
+# echo 0x5022000000000000 > /sys/bus/ccw/drivers/zfcp/0.0.4000/0x5005076300c213e9/unit_add
+
+CONFIG=/etc/zfcp.conf
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+if [ -f "$CONFIG" ]; then
+ if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
+ modprobe zfcp
+ fi
+ if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
+ return
+ fi
+ tr "A-Z" "a-z" < $CONFIG| while read line; do
+ case $line in
+ \#*) ;;
+ *)
+ [ -z "$line" ] && continue
+ set $line
+ if [ $# -eq 5 ]; then
+ DEVICE=$1
+ SCSIID=$2
+ WWPN=$3
+ SCSILUN=$4
+ FCPLUN=$5
+ echo "Warning: Deprecated values in /etc/zfcp.conf, ignoring SCSI ID $SCSIID and SCSI LUN $SCSILUN"
+ elif [ $# -eq 3 ]; then
+ DEVICE=${1##*0x}
+ WWPN=$2
+ FCPLUN=$3
+ fi
+ echo 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE}/online
+ [ ! -d /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/${FCPLUN} ] \
+ && echo $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/unit_add
+ ;;
+ esac
+ done
+fi