add s390 network support
authorHarald Hoyer <harald@redhat.com>
Thu, 8 Oct 2009 16:10:02 +0000 (18:10 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 8 Oct 2009 16:10:02 +0000 (18:10 +0200)
dracut.8
modules.d/95ccw/55-ccw.rules [new file with mode: 0644]
modules.d/95ccw/ccw_init [new file with mode: 0755]
modules.d/95ccw/check [new file with mode: 0755]
modules.d/95ccw/install [new file with mode: 0755]
modules.d/95ccw/parse-ccw.sh [new file with mode: 0755]

index c1972ac..309d0dd 100644 (file)
--- a/dracut.8
+++ b/dracut.8
@@ -183,6 +183,12 @@ example: rd_ZFCP=0.0.4000,0x5005076300C213e9,0x5022000000000000
 .B rd_NO_ZFCPCONF
 ignore zfcp.conf included in the initramfs
 
+.SH CCW
+.TP
+.B rd_CCW=<nettype>,<subchannels>,<options>
+rd_CCW can be specified multiple times on the kernel command line.
+e.g. rd_CCW=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
+e.g. rd_CCW=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar
 .SH DHCP
 .TP
 .B root=dhcp
diff --git a/modules.d/95ccw/55-ccw.rules b/modules.d/95ccw/55-ccw.rules
new file mode 100644 (file)
index 0000000..2c6a805
--- /dev/null
@@ -0,0 +1,12 @@
+ACTION!="add|change", GOTO="ccw_end"
+SUBSYSTEM!="ccw", GOTO="ccw_end"
+SYSFS{cutype}=="1731/01", RUN+="ccw_init"
+SYSFS{cutype}=="1731/05", RUN+="ccw_init"
+SYSFS{cutype}=="1731/06", RUN+="ccw_init"
+SYSFS{cutype}=="3088/01", RUN+="ccw_init"
+SYSFS{cutype}=="3088/08", RUN+="ccw_init"
+SYSFS{cutype}=="3088/60", RUN+="ccw_init"
+SYSFS{cutype}=="3088/61", RUN+="ccw_init"
+SYSFS{cutype}=="3088/1E", RUN+="ccw_init"
+SYSFS{cutype}=="3088/1F", RUN+="ccw_init"
+LABEL="ccw_end"
diff --git a/modules.d/95ccw/ccw_init b/modules.d/95ccw/ccw_init
new file mode 100755 (executable)
index 0000000..839b7da
--- /dev/null
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+[ -z "$DEVPATH" ] && exit 0
+[ "$SUBSYSTEM" != "ccw" ] && exit 0
+
+[ -e /etc/ccw.conf ] || exit 0
+
+get_config_by_subchannel()
+{
+    CHANNEL="$1"
+    while read line; do        
+       IFS=, 
+       set $line
+       for i in $@; do
+           if [ "$CHANNEL" = "$i" ]; then
+               echo $line
+               return 0
+            fi
+       done
+       if [ "$CHANNEL" = "$2" ]; then
+           echo $line
+           return 0
+       fi
+    done < /etc/ccw.conf
+    return 1
+}
+
+# First, determine our channel
+
+CHANNEL=${DEVPATH##*/}
+
+CONFIG=$(get_config_by_subchannel $CHANNEL)
+
+[ $? -ne 0 -o -z "$CONFIG" ] && exit 0
+
+set $CONFIG
+NETTYPE=$1
+shift
+SUBCHANNELS="$1"
+OPTIONS=""
+CHANNEL1="$1"
+shift
+while [ $# -gt 0 ]; do
+    case $1 in
+       layer1=*) LAYER1=${1##layer1=};;
+       *=*) OPTIONS="$OPTIONS $1";;
+       [0-9]*) SUBCHANNELS="$SUBCHANNELS,$1";;
+    esac
+    shift
+done
+
+# SUBCHANNELS is only set on mainframe ccwgroup devices
+[ -z "$SUBCHANNELS" -o -z "$NETTYPE" ] && exit 0
+DIR="/sys/bus/ccwgroup/drivers/$NETTYPE"
+
+i=0
+while [ $i -lt 20 ]; do
+    [ -e $DIR ] && break
+    sleep 0.1
+    i=$(($i+1))
+done
+
+SYSDIR="$DIR/$CHANNEL1"
+
+if [ ! -e $SYSDIR ]; then
+    echo "$SUBCHANNELS" > $DIR/group
+    i=0
+    while [ $i -lt 20 ]; do
+       [ -e $SYSDIR ] && break
+       sleep 0.1
+       i=$(($i+1))
+    done
+fi
+
+# check if the interface is already online
+if [ -e $SYSDIR/online ]; then
+    read on <$SYSDIR/online
+    [ "$on" = "1" ] && exit 0
+fi
+
+# first set layer1, other options may depend on it
+[ -n "$LAYER1" ] && echo $LAYER1 > $SYSDIR/layer1
+
+if [ -n "$OPTIONS" ]; then         
+    for i in $OPTIONS; do
+       echo "${i##*=}" > "$SYSDIR/${i%%=*}"
+    done
+fi
+
+[ -e $SYSDIR/online ] && echo 1 > $SYSDIR/online
diff --git a/modules.d/95ccw/check b/modules.d/95ccw/check
new file mode 100755 (executable)
index 0000000..a26196c
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+arch=$(uname -m)
+[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1 
+
+exit 0
diff --git a/modules.d/95ccw/install b/modules.d/95ccw/install
new file mode 100755 (executable)
index 0000000..7ff37b3
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+inst_hook cmdline 30 "$moddir/parse-ccw.sh"
+inst "$moddir/ccw_init" /lib/udev/ccw_init
+#inst_rules 55-ccw.rules || inst_rules "$moddir/55-ccw.rules"
+inst_rules "$moddir/55-ccw.rules"
diff --git a/modules.d/95ccw/parse-ccw.sh b/modules.d/95ccw/parse-ccw.sh
new file mode 100755 (executable)
index 0000000..c8b257f
--- /dev/null
@@ -0,0 +1,4 @@
+for ccw_arg in $(getargs 'rd_CCW='); do
+    echo $ccw_arg >> /etc/ccw.conf
+done
+