diff mbox

Linux script to enable ASPM / Documentation for ASPM

Message ID AANLkTikcKM4jAVRdrWHcgG4ED604meekbLj06qYUwjGC@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Luis Rodriguez Jan. 14, 2011, 3:15 a.m. UTC
None
diff mbox

Patch

--- enable-aspm.old	2011-01-14 03:13:33.248428802 +0000
+++ enable-aspm	2011-01-14 03:12:51.711354522 +0000
@@ -161,11 +161,11 @@ 
 		exit
 	fi

-	SEARCH=$(setpci -s $1 34)
+	SEARCH=$(setpci -s $1 34.b)
 	# We know on the first search $SEARCH will not be
 	# 10 but this simplifies the implementation.
 	while [[ $SEARCH != 10 && $SEARCH_COUNT -le $MAX_SEARCH ]]; do
-		END_SEARCH=$(setpci -s $1 $SEARCH)
+		END_SEARCH=$(setpci -s $1 ${SEARCH}.b)

 		# Convert hex digits to uppercase for bc
 		SEARCH_UPPER=$(printf "%X" 0x${SEARCH})
@@ -176,7 +176,7 @@ 
 		fi

 		SEARCH=$(echo "obase=16; ibase=16; $SEARCH + 1" | bc)
-		SEARCH=$(setpci -s $1 $SEARCH)
+		SEARCH=$(setpci -s $1 ${SEARCH}.b)

 		let SEARCH_COUNT=$SEARCH_COUNT+1
 	done
@@ -200,7 +200,7 @@ 
 		return 1
 	fi

-	ASPM_BYTE_HEX=$(setpci -s $1 $ASPM_BYTE_ADDRESS)
+	ASPM_BYTE_HEX=$(setpci -s $1 ${ASPM_BYTE_ADDRESS}.b)
 	ASPM_BYTE_HEX=$(printf "%X" 0x${ASPM_BYTE_HEX})
 	# setpci doesn't support a mask on the query yet, only on the set,
 	# so to verify a setting on a mask we have no other optoin but
@@ -228,11 +228,11 @@ 
 	fi

 	# This only writes the last 3 bits
-	setpci -s $1 ${ASPM_BYTE_ADDRESS}=${ASPM_SETTING}:3
+	setpci -s $1 ${ASPM_BYTE_ADDRESS}.b=${ASPM_SETTING}:3

 	sleep 3

-	ACTUAL_ASPM_BYTE_HEX=$(setpci -s $1 ${ASPM_BYTE_ADDRESS})
+	ACTUAL_ASPM_BYTE_HEX=$(setpci -s $1 ${ASPM_BYTE_ADDRESS}.b)
 	ACTUAL_ASPM_BYTE_HEX=$(printf "%X" 0x${ACTUAL_ASPM_BYTE_HEX})

 	# Do not retry this if it failed, if it failed to set.