summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Bennett <sb476@cam.ac.uk>2007-12-07 01:24:48 +0000
committerStuart Bennett <sb476@cam.ac.uk>2007-12-07 01:33:49 +0000
commitfb251a452f572b6084e5bd0253804da363f7523b (patch)
tree5b705b3ddef7cf77b51d9e6023125c8670c653e6
parent1a8dc551181470eb14421711e8918cdd1e5dc7ff (diff)
Allow force reading of shadow ram bios image
-rw-r--r--README5
-rwxr-xr-xpostandrestore.bash10
-rw-r--r--vbtracetool.c9
3 files changed, 15 insertions, 9 deletions
diff --git a/README b/README
index 29453f7..4fef5ab 100644
--- a/README
+++ b/README
@@ -8,17 +8,18 @@ Building:
Run make
Running:
-./vbtracetool [-d] [-l] [-g | -p | -s MODENUMBER | -w]
+./vbtracetool [-d] [-l] [-r] [-g | -p | -s MODENUMBER | -w]
-d gives trace output *to stderr*. you'll want to redirect that.
-l gives IO logging *to stderr*. you'll want to redirect that.
+-r forces use of the shadow ram bios image
-g gets the current display mode number (default)
-p posts the card. could induce several seconds of pants cacking with -d.
-s sets the given mode number
-w writes the bios image that would be executed by the other options *to stderr*
-./postandrestore.bash [-d] [-l]
+./postandrestore.bash [-d] [-l] [-r]
options as for vbtracetool
diff --git a/postandrestore.bash b/postandrestore.bash
index c9244e1..4bc52fe 100755
--- a/postandrestore.bash
+++ b/postandrestore.bash
@@ -7,7 +7,7 @@
VBTT="`dirname "$0"`/vbtracetool"
-TEMP=`getopt -o dl -n 'postandrestore.bash' -- "$@"`
+TEMP=`getopt -o dlr -n 'postandrestore.bash' -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
@@ -15,18 +15,20 @@ eval set -- "$TEMP"
debug=""
log=""
+shadow=""
while true ; do
case "$1" in
-d) debug=$1 ; shift ;;
-l) log=$1 ; shift ;;
+ -r) shadow=$1 ; shift ;;
--) shift ; break ;;
*) echo "Option parsing error!" ; exit 1 ;;
esac
done
for arg do echo 'Invalid argument '"\`$arg'" ; exit 1 ; done
-mode=$($VBTT -g | tail -1 | sed 's/^.*(//g' | sed 's/)//g')
-$VBTT $debug $log -p
-$VBTT -s $mode > /dev/null
+mode=$($VBTT $shadow -g | tail -1 | sed 's/^.*(//g' | sed 's/)//g')
+$VBTT $debug $log $shadow -p
+$VBTT $shadow -s $mode > /dev/null
echo ""
diff --git a/vbtracetool.c b/vbtracetool.c
index 9a1e88b..2b6472a 100644
--- a/vbtracetool.c
+++ b/vbtracetool.c
@@ -105,9 +105,9 @@ int main(int argc, char *argv[])
struct pci_dev *p;
unsigned int c;
unsigned int pci_id = 0, pci_vendor;
- int opt, debug = 0, mode, op = 'g', opset = 0, nvlog = 0;
+ int opt, debug = 0, mode, op = 'g', opset = 0, nvlog = 0, shadow = 0;
- while ((opt = getopt(argc, argv, "dglps:w")) != -1) {
+ while ((opt = getopt(argc, argv, "dglprs:w")) != -1) {
switch (opt) {
case 'd':
debug = 1;
@@ -118,6 +118,9 @@ int main(int argc, char *argv[])
case 'l':
nvlog = 1;
break;
+ case 'r':
+ shadow = 1;
+ break;
case 'p':
op = 'p';
opset++;
@@ -182,7 +185,7 @@ int main(int argc, char *argv[])
printf("Using card %04x:%04x on %04x\n", pci_vendor,
pci_read_word(p, PCI_DEVICE_ID), pci_id);
- if (pci_vendor == 0x10de) {
+ if (pci_vendor == 0x10de && !shadow) {
printf("Nvidia card -- using PROM/PRAMIN BIOS\n");
if (reload_nv_bios(p->base_addr[0]))
exit(EXIT_FAILURE);