#!/bin/sh # PROVIDE: cx700fix # REQUIRE: FILESYSTEMS # BEFORE: netif . /etc/rc.subr name="cx700fix" start_cmd="reg_fix" stop_cmd=":" reg_fix() { if selector=`pciconf -l | sed -n '/chip=0x324e1106/{s/[[:blank:]].*//;p;}'` && [ -n "$selector" ]; then b=`read_config_byte 0x76` if [ $((b & 64)) -eq 64 ]; then echo "Disabling VIA CX700 PCI parking" write_config_byte 0x76 $((b ^ 64)) fi if [ `read_config_byte 0x72` -ne 0 ]; then echo "Disabling VIA CX700 PCI caching" write_config_byte 0x72 0 write_config_byte 0x75 1 write_config_byte 0x77 0 fi fi return 0 } read_config_byte() { echo $(( 0x$(pciconf -rb $selector $1) )) } write_config_byte() { pciconf -wb $selector $1 $2 } run_rc_command "$1"