Commit c8a250ee authored by Mike Hibler's avatar Mike Hibler
Browse files

Add use_asf node_type_attribute analogous to use_acpi. Set this to 1 if the

node type as ASF support in its broadcom (bge) control net interface.

Also clean up some overzealous quoting in rc.frisbee (lets hope I have not
been under-zealous!)
parent 12385ea3
......@@ -136,17 +136,19 @@ if [ -x /usr/sbin/ntpdate ]; then
/usr/sbin/ntpdate -b $BOSSIP >/dev/null 2>&1
fi
ADDRESS=`echo \"$LOADINFO\" | sed -e 's/.*ADDR=\([^[:space:]]*\).*/\1/'`
PARTITION=`echo \"$LOADINFO\" | sed -e 's/.*PART=\([^[:space:]]*\).*/\1/'`
ADDRESS=`echo $LOADINFO | sed -e 's/.*ADDR=\([^[:space:]]*\).*/\1/'`
PARTITION=`echo $LOADINFO | sed -e 's/.*PART=\([^[:space:]]*\).*/\1/'`
PARTITION=${PARTITION:-'0'}
PARTOS=`echo \"$LOADINFO\" | sed -e 's/.*PARTOS=\([^[:space:]]*\).*/\1/'`
DISK=`echo \"$LOADINFO\" | sed -e 's/.*DISK=\([^[:space:]]*\).*/\1/'`
PARTOS=`echo $LOADINFO | sed -e 's/.*PARTOS=\([^[:space:]]*\).*/\1/'`
DISK=`echo $LOADINFO | sed -e 's/.*DISK=\([^[:space:]]*\).*/\1/'`
DISK=${DISK:-'ad0'}
ZFILL=`echo \"$LOADINFO\" | sed -e 's/.*ZFILL=\([^[:space:]]*\).*/\1/'`
ZFILL=`echo $LOADINFO | sed -e 's/.*ZFILL=\([^[:space:]]*\).*/\1/'`
ZFILL=${ZFILL:-'0'}
ACPI=`echo \"$LOADINFO\" | sed -e 's/.*ACPI=\([^[:space:]]*\).*/\1/'`
ACPI=`echo $LOADINFO | sed -e 's/.*ACPI=\([^[:space:]]*\).*/\1/'`
ACPI=${ACPI:-'unknown'}
MBR=`echo \"$LOADINFO\" | sed -e 's/.*MBRVERS=\([^[:space:]]*\).*/\1/'`
ASF=`echo $LOADINFO | sed -e 's/.*ASF=\([^[:space:]]*\).*/\1/'`
ASF=${ASF:-'unknown'}
MBR=`echo $LOADINFO | sed -e 's/.*MBRVERS=\([^[:space:]]*\).*/\1/'`
MBR=${MBR:-'1'}
if [ "$PARTITION" != "0" ]; then
......@@ -212,8 +214,8 @@ if [ -x /dev/MAKEDEV -a ! -e /dev/$DISK ]; then
fi
if [ x"$ADDRESS" != x ]; then
isurl=`echo \"$ADDRESS\" | grep http -`
ispath=`echo \"$ADDRESS\" | egrep \"^/\" -`
isurl=`echo $ADDRESS | grep http -`
ispath=`echo $ADDRESS | grep '^/' -`
if [ x"$isurl" != x ]; then
echo "Need to download $ADDRESS"
......@@ -227,10 +229,10 @@ if [ x"$ADDRESS" != x ]; then
#
# This needs a lot more work ...
#
imagefile=`echo ${ADDRESS} | sed -e 's,^http[s]*://[^/]*/,,'`
imagefile=`echo $ADDRESS | sed -e 's,^http[s]*://[^/]*/,,'`
imagefile="/images/$imagefile"
wget -nv -N -P /images "${ADDRESS}"
wget -nv -N -P /images "$ADDRESS"
wstat=$?
case $wstat in
0)
......@@ -337,6 +339,7 @@ if [ x"$ADDRESS" != x ]; then
$BINDIR/growdisk -vW /dev/$DISK
echo "Adjusting slice-related files"
export SLICEFIX_ACPI=$ACPI
export SLICEFIX_ASF=$ASF
$BINDIR/slicefix $PARTITION $DISK
echo "Image load complete at `date`"
......
......@@ -43,6 +43,19 @@ case $ACPI in
;;
esac
ASF=${SLICEFIX_ASF:-'unknown'}
case $ASF in
0|no|NO)
ASF=no
;;
1|yes|YES)
ASF=yes
;;
*)
ASF=unknown
;;
esac
#
# ...or the filesystem
#
......@@ -112,6 +125,7 @@ dofreebsd() {
changedisk=0
changeentropy=0
changeacpi=0
changeasf=0
# If our disk does not appear anywhere in fstab, we need to fix it
grep "^/dev/${disk}s" /mnt/etc/fstab >/dev/null 2>&1
......@@ -160,7 +174,37 @@ dofreebsd() {
esac
fi
if [ $changedisk -eq 0 -a $changeentropy -eq 0 -a $changeacpi -eq 0 ]; then
#
# See if we need to change the ASF setting.
#
# Note that, unlike ACPI, we change it even if there was no
# previous setting in /boot/loader.conf.
#
if [ $ASF != "unknown" ]; then
grep "hw.bge.allow_asf=" /mnt/boot/loader.conf >/dev/null 2>&1
case $? in
0)
grep "^hw.bge.allow_asf=1" /mnt/boot/loader.conf >/dev/null 2>&1
case $? in
0)
if [ $ASF = "no" ]; then
changeasf=1
fi
;;
*)
if [ $ASF = "yes" ]; then
changeasf=1
fi
;;
esac
;;
*)
changeasf=1
;;
esac
fi
if [ $changedisk -eq 0 -a $changeentropy -eq 0 -a $changeacpi -eq 0 -a $changeasf -eq 0 ]; then
echo " no changes necessary"
umount $rootdev
return 0
......@@ -221,6 +265,31 @@ EOF2
fi
fi
if [ $changeasf -eq 1 ]; then
if [ $ASF = "no" ]; then
on="dis"
else
on="en"
fi
echo " ${on}abling ASF"
sed -E -i .orig -e "/[Aa][Ss][Ff]/d" /mnt/boot/loader.conf || {
echo "Failed to update /boot/loader.conf"
umount $rootdev
return 1
}
if [ $ASF = "no" ]; then
cat <<EOF1 >>/mnt/boot/loader.conf
# disable ASF
hw.bge.allow_asf=0
EOF1
else
cat <<EOF2 >>/mnt/boot/loader.conf
# enable ASF
hw.bge.allow_asf=1
EOF2
fi
fi
umount $rootdev
# XXX need to fixup FS, see big comment above
......
......@@ -3619,7 +3619,7 @@ COMMAND_PROTOTYPE(doloadinfo)
MYSQL_ROW row;
char buf[MYBUFSIZE];
char *bufp = buf, *ebufp = &buf[sizeof(buf)];
char *disktype, *useacpi, address[MYBUFSIZE];
char *disktype, *useacpi, *useasf, address[MYBUFSIZE];
int disknum, zfill, mbrvers;
/*
......@@ -3701,13 +3701,15 @@ COMMAND_PROTOTYPE(doloadinfo)
disktype = DISKTYPE;
disknum = DISKNUM;
useacpi = "unknown";
useasf = "unknown";
res = mydb_query("select attrkey,attrvalue from nodes as n "
"left join node_type_attributes as a on "
" n.type=a.type "
"where (a.attrkey='bootdisk_unit' or "
" a.attrkey='disktype' or "
" a.attrkey='use_acpi') and "
" a.attrkey='use_acpi' or "
" a.attrkey='use_asf') and "
" n.node_id='%s'", 2, reqp->nodeid);
if (!res) {
......@@ -3732,13 +3734,16 @@ COMMAND_PROTOTYPE(doloadinfo)
else if (strcmp(row[0], "use_acpi") == 0) {
useacpi = row[1];
}
else if (strcmp(row[0], "use_asf") == 0) {
useasf = row[1];
}
}
nrows--;
}
}
bufp += OUTPUT(bufp, ebufp - bufp,
" DISK=%s%d ZFILL=%d ACPI=%s MBRVERS=%d\n",
disktype, disknum, zfill, useacpi, mbrvers);
" DISK=%s%d ZFILL=%d ACPI=%s ASF=%s MBRVERS=%d\n",
disktype, disknum, zfill, useacpi, useasf, mbrvers);
mysql_free_result(res);
client_writeback(sock, buf, strlen(buf), tcp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment