#!/sbin/runscript # read this article to know what to do # http://gentoo.org/doc/en/articles/hardware-stability-p2.xml#doc_chap3_pre2 # report bugs to: http://bugs.gentoo.org/show_bug.cgi?id=173347 depend() { before bootmisc hdparm } do_setpci_latency() { if [[ "$1" = "*:*" ]]; then GLOB="global " SWITCH="-d" else SPEC="for card $1 " SWITCH="-s" fi ebegin "Setting ${GLOB}latency timer ${SPEC}to $2" setpci $SETPCI_OPT $SWITCH $1 latency_timer=$2 eend $? GLOB="" SPEC="" SWITCH="" } start() { if get_bootparam "nopciparm" ; then ewarn "Skipping pciparm init as requested in kernel cmdline" return 0 fi SETPCI_OPT="" if [[ "$VERBOSE" = "yes" ]]; then SETPCI_OPT="$SETPCI_OPT -v" fi if [[ -n "$LATENCY_TIMER_ALL" ]]; then do_setpci_latency *:* $LATENCY_TIMER_ALL fi if [[ -n "$TWEAK_CARDS" ]] ; then for pci_id in $TWEAK_CARDS; do FLAT_ID="${pci_id//[:.]/_}" LATENCY_PARAM="LATENCY_TIMER_${FLAT_ID}" if [[ -n "${!LATENCY_PARAM}" ]]; then do_setpci_latency ${pci_id} ${!LATENCY_PARAM} fi done fi }