Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion service/95-afc.rules
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SUBSYSTEM=="pci", ATTR{vendor}=="0x10ee", ATTR{subsystem_device}=="0x0007", RUN+="/usr/bin/setpci -s %k COMMAND=0x2", RUN+="/bin/sh -c 'chmod 666 /sys/bus/pci/devices/%k/resource*'", RUN+="/opt/afc-epics-ioc/service/ioc-start.sh %k"
SUBSYSTEM=="pci", ATTR{vendor}=="0x10ee", ATTR{subsystem_device}=="0x0007", RUN+="/opt/afc-epics-ioc/service/ioc-start.sh %k"
26 changes: 26 additions & 0 deletions service/ioc-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@ set -eu

DEV=$1

setpci -s $DEV COMMAND=0x2

resource_files=""
for suffix in 0 2 2_wc 4; do
resource_files="$resource_files /sys/bus/pci/devices/$DEV/resource$suffix"
done
resource_files_exist() {
for f in $resource_files; do
if [ ! -f $f ]; then
return 1
fi
done

return 0
}

count=0
until resource_files_exist; do
if [ $count -eq 10 ]; then
exit 1
fi
count=$((count + 1))
sleep .1
done
chmod 666 $resource_files

devslot=
for slot in /sys/bus/pci/slots/* ; do
ADDR=$(cat ${slot}/address)
Expand Down