--- /dev/null 2004-09-09 09:18:19.101224496 -0400 +++ /etc/hotplug/macio.rc 2004-09-09 08:41:55.000000000 -0400 @@ -0,0 +1,96 @@ +#!/bin/bash +# $Id: ccw.rc,v 1.3 2004/05/13 11:59:50 hare Exp $ +# vim: syntax=sh +# +# macio.rc configure macio devices. +# + +SYSFS=needed +cd /etc/hotplug +. hotplug.functions + +if [ ! -d ${SYSFS}/bus/macio ]; then + echo "No macio bus support" + exit 0 +fi + +HWUP=/sbin/hwup +macio_call_hotplug () { + # There may be /etc/hotplug.d/default/eventrecorder.hotplug + # that logs the environment of every hotplug events. Therefore + # we keep environment clean. +# echo " "\ + eval \ + $ENV \ + ${ACTION:+ ACTION=$ACTION} \ + ${DEVPATH:+ DEVPATH="$DEVPATH"} \ + ${OF_NAME:+ OF_NAME="$OF_NAME"} \ + ${OF_TYPE:+ OF_TYPE="$OF_TYPE"} \ + ${OF_COMPATIBLE:+ OF_COMPATIBLE="$OF_COMPATIBLE"} \ + ${HOTPLUG_TRACE:+ HOTPLUG_TRACE="$HOTPLUG_TRACE"} \ + /sbin/hotplug macio \ + < /dev/null > /dev/null 2>&1 & +} +macio_boot_events_sysfs () { + cd /sys/bus/macio/devices + for i in *; do + + if [ -d /sys/bus/macio/drivers/*/$i \ + -a "$SKIP_DRIVEN_DEVICES" != no ]; then + echo -n . >&3 + fi + OF_NAME=`cat $i/name` + OF_TYPE=`cat $i/type` + OF_COMPATIBLE=`cat $i/compatible` + DEVPATH=`cd $i/ ; /bin/pwd` + echo -n "*" >&3 + macio_call_hotplug + done +} + +macio_boot_events () { + macio_boot_events_sysfs +} + +# See how we were called. +case "$1" in + start) + ACTION=add + macio_boot_events; + + # Configure all macio devices for which a hwcfg file is found + cd /etc/sysconfig/hardware + for cfg in hwcfg-bus-macio*; do + # Skip all symbolic links, only use the actual configuration + if [ -f "$cfg" -a ! -L "$cfg" ] ; then + cfgname=`echo $cfg | sed -n 's,hwcfg-.*-bus,bus,p;s,hwcfg-.*-id,id,p;s,hwcfg-bus,bus,p'` + if [ "$cfgname" ]; then + debug_mesg "Calling ${HWUP} ${cfgname}" + ${HWUP} ${cfgname} + echo -n "*" >&3 + else + echo -n "." >&3 + fi + fi + done + + + ;; + stop) + # echo "$0 stop -- ignored" + ;; + status) + # echo "$0 status -- ignored" + ;; + status-verbose) + # echo "$0 status-verbose -- ignored" + ;; + restart) + # always invoke by absolute path, else PATH=$PATH: + $0 stop && $0 start + ;; + *) + echo $"Usage: $0 {start|stop|status[-verbose]|restart}" + exit 1 + ;; +esac --- /dev/null 2004-09-09 09:18:19.101224496 -0400 +++ /etc/hotplug/macio.agent 2004-09-09 09:07:58.000000000 -0400 @@ -0,0 +1,84 @@ +#!/bin/bash +# $Id: generic_empty.agent,v 1.1.1.1 2004/03/10 15:41:49 adrian Exp $ +# +# empty hotplug policy agent for Linux kernels. For events that need not to be +# handled, but should have an agent. +# If you need to do something for this event, then copy this file to $1.agent +# before modifying. +# +# Kernel hotplug params include: +# +# ACTION=%s [add or remove] +# DEVPATH=%s +# +: ${ACTION?Bad invocation: \$ACTION is not set} +: ${DEVPATH?Bad invocation: \$DEVPATH is not set} +: ${OF_NAME?Bad invocation: \$OF_NAME is not set} +: ${OF_TYPE?Bad invocation: \$OF_TYPE is not set} +: ${OF_COMPATIBLE?Bad invocation: \$OF_COMPATIBLE is not set} + + + +cd /etc/hotplug +. ./hotplug.functions + +# generated by module-init-tools +MAP_CURRENT=$MODULE_DIR/modules.ofmap + +declare OF_ANY="*" + +of_map_modules () +{ + # read modules.ofmap + while read line + do + declare -a compat + # skip comments and blank lines + case "$line" in + \#*|"") continue ;; + esac + + set -o noglob + set -- $line + module=$1 + name=$2 + type=$3 + clist=$4 + set -- `IFS=,; echo $clist` + compat=($@) + + if [ $name != "$OF_ANY" -a $name != $OF_NAME ]; then + continue + fi + + if [ $type != "$OF_ANY" -a $type != $OF_TYPE ]; then + continue + fi + + if [ $clist != "$OF_ANY" -a -n "$clist" ]; then + set -- `IFS=,; echo $OF_COMPATIBLE` + of_compatible=($@) + while [ ${#compat} -gt 0]; do + let index=0 + centry=$1 + while [ $index -lt ${#of_compatible} ]; do + debug_mesg "outer=$centry inner=${of_compatible[$index]}" + list_entry=${of_compatible[$index]} + if [ $centry = $list_entry ]; then + COMPAT_MATCH="$COMPAT_MATCH $centry" + break 2 + fi + let index++ + done + shift + done + if [ -z $COMPAT_MATCH ]; then + continue + fi + fi + + DRIVERS="$module $DRIVERS" + done +} + +load_drivers of $MAP_CURRENT "$OF_NAME; $OF_TYPE"