mirror of
https://github.com/corundum/corundum.git
synced 2025-01-30 08:32:52 +08:00
Update scripts to use setpci built-in bit masking
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
parent
984aefe508
commit
ffc0a70c40
@ -25,17 +25,16 @@ fi
|
|||||||
|
|
||||||
echo "Disabling fatal error reporting on port $port..."
|
echo "Disabling fatal error reporting on port $port..."
|
||||||
|
|
||||||
cmd=$(setpci -s $port COMMAND)
|
echo "Command:" $(setpci -s $port COMMAND)
|
||||||
|
|
||||||
echo "Command:" $cmd
|
|
||||||
|
|
||||||
# clear SERR bit in command register
|
# clear SERR bit in command register
|
||||||
setpci -s $port COMMAND=$(printf "%04x" $((0x$cmd & ~0x0100)))
|
setpci -s $port COMMAND=0000:0100
|
||||||
|
|
||||||
ctrl=$(setpci -s $port CAP_EXP+8.w)
|
echo "Command:" $(setpci -s $port COMMAND)
|
||||||
|
|
||||||
echo "Device control:" $ctrl
|
echo "Device control:" $(setpci -s $port CAP_EXP+8.w)
|
||||||
|
|
||||||
# clear fatal error reporting enable bit in device control register
|
# clear fatal error reporting enable bit in device control register
|
||||||
setpci -s $port CAP_EXP+8.w=$(printf "%04x" $((0x$ctrl & ~0x0004)))
|
setpci -s $port CAP_EXP+8.w=0000:0004
|
||||||
|
|
||||||
|
echo "Device control:" $(setpci -s $port CAP_EXP+8.w)
|
||||||
|
@ -22,23 +22,14 @@ if [ ! -e "/sys/bus/pci/devices/$dev" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ctrl=$(setpci -s $dev CAP_EXP+8.w)
|
echo "Device control:" $(setpci -s $dev CAP_EXP+8.w)
|
||||||
|
|
||||||
if (($en > 0)); then
|
if (($en > 0)); then
|
||||||
|
|
||||||
echo "Enabling ext tag on $dev..."
|
echo "Enabling ext tag on $dev..."
|
||||||
|
setpci -s $dev CAP_EXP+8.w=0100:0100
|
||||||
echo "Device control:" $ctrl
|
|
||||||
|
|
||||||
setpci -s $dev CAP_EXP+8.w=$(printf "%04x" $((0x$ctrl | 0x0100)))
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "Disabling ext tag on $dev..."
|
echo "Disabling ext tag on $dev..."
|
||||||
|
setpci -s $dev CAP_EXP+8.w=0000:0100
|
||||||
echo "Device control:" $ctrl
|
|
||||||
|
|
||||||
setpci -s $dev CAP_EXP+8.w=$(printf "%04x" $((0x$ctrl & ~0x0100)))
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Device control:" $(setpci -s $dev CAP_EXP+8.w)
|
||||||
|
@ -29,13 +29,11 @@ echo 1 > "/sys/bus/pci/devices/$dev/remove"
|
|||||||
|
|
||||||
echo "Performing hot reset of port $port..."
|
echo "Performing hot reset of port $port..."
|
||||||
|
|
||||||
bc=$(setpci -s $port BRIDGE_CONTROL)
|
echo "Bridge control:" $(setpci -s $port BRIDGE_CONTROL)
|
||||||
|
|
||||||
echo "Bridge control:" $bc
|
setpci -s $port BRIDGE_CONTROL=40:40
|
||||||
|
sleep 0.5
|
||||||
setpci -s $port BRIDGE_CONTROL=$(printf "%04x" $((0x$bc | 0x40)))
|
setpci -s $port BRIDGE_CONTROL=00:40
|
||||||
sleep 0.01
|
|
||||||
setpci -s $port BRIDGE_CONTROL=$bc
|
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
|
|
||||||
echo "Rescanning bus..."
|
echo "Rescanning bus..."
|
||||||
|
@ -60,15 +60,7 @@ setpci -s $dev CAP_EXP+30.L=$lc2n
|
|||||||
|
|
||||||
echo "Triggering link retraining..."
|
echo "Triggering link retraining..."
|
||||||
|
|
||||||
lc=$(setpci -s $dev CAP_EXP+10.L)
|
setpci -s $dev CAP_EXP+10.L=20:20
|
||||||
|
|
||||||
echo "Original link control:" $lc
|
|
||||||
|
|
||||||
lcn=$(printf "%08x" $((0x$lc | 0x20)))
|
|
||||||
|
|
||||||
echo "New link control:" $lcn
|
|
||||||
|
|
||||||
setpci -s $dev CAP_EXP+10.L=$lcn
|
|
||||||
|
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user