summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Bennett <sb476@cam.ac.uk>2007-11-27 00:51:00 +0000
committerStuart Bennett <sb476@cam.ac.uk>2007-11-27 00:51:00 +0000
commit12e580608c4abd1bf0bfbb5e3de5da5e5e83eeff (patch)
treed5f8db88aed21915dc4fcecb21177cf72d6c7837
parent6544a40dfd128e8a3ef019a9225d2bd539c51400 (diff)
Always use PROM/PRAMIN on Nvidia cards
-rw-r--r--README13
-rwxr-xr-xpostandrestore.bash13
-rw-r--r--vbtracetool.c14
3 files changed, 23 insertions, 17 deletions
diff --git a/README b/README
index 3b2d7c1..604348d 100644
--- a/README
+++ b/README
@@ -8,17 +8,16 @@ Building:
Run make
Running:
-./vbtracetool [-d] [-l] [-n] [-g | -p | -s MODENUMBER]
+./vbtracetool [-d] [-l] [-g | -p | -s MODENUMBER]
-d gives trace output *to stderr*. you'll want to redirect that.
-l gives IO logging *to stderr*. you'll want to redirect that.
--n attempts to read and execute the bios from an Nvidia card's PROM region
-g gets the current display mode number
-p posts the card. could induce several seconds of pants cacking with -d.
-s sets the given mode number
-./postandrestore.bash [-d] [-l] [-n]
+./postandrestore.bash [-d] [-l]
options as for vbtracetool
@@ -27,3 +26,11 @@ this shell script will run vbtracetool in such a way to do a POST
try either of these in x and lose.
+
+Killing:
+do not interrupt, once started -- you will likely earn yourself a hung machine
+if you really really don't like what's happening, turn the power off
+
+Culprit:
+Stuart Bennett, using code and ideas from Matthew Garrett's libx86 and vbetool,
+and the SciTech/Xorg x86emu emulator
diff --git a/postandrestore.bash b/postandrestore.bash
index c3810a6..c9244e1 100755
--- a/postandrestore.bash
+++ b/postandrestore.bash
@@ -7,23 +7,26 @@
VBTT="`dirname "$0"`/vbtracetool"
-TEMP=`getopt -o dln -n 'postandrestore.bash' -- "$@"`
+TEMP=`getopt -o dl -n 'postandrestore.bash' -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$TEMP"
+debug=""
+log=""
+
while true ; do
case "$1" in
-d) debug=$1 ; shift ;;
-l) log=$1 ; shift ;;
- -n) nvbios=$1 ; shift ;;
--) shift ; break ;;
*) echo "Option parsing error!" ; exit 1 ;;
esac
done
for arg do echo 'Invalid argument '"\`$arg'" ; exit 1 ; done
-mode=$($VBTT $nvbios -g | tail -1 | sed 's/^.*(//g' | sed 's/)//g')
-$VBTT $debug $log $nvbios -p
-$VBTT $nvbios -s $mode > /dev/null
+mode=$($VBTT -g | tail -1 | sed 's/^.*(//g' | sed 's/)//g')
+$VBTT $debug $log -p
+$VBTT -s $mode > /dev/null
+echo ""
diff --git a/vbtracetool.c b/vbtracetool.c
index 9189322..8230935 100644
--- a/vbtracetool.c
+++ b/vbtracetool.c
@@ -95,9 +95,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, nvreload = 0, nvlog = 0;
+ int opt, debug = 0, mode, op = 'g', opset = 0, nvlog = 0;
- while ((opt = getopt(argc, argv, "dglnps:")) != -1) {
+ while ((opt = getopt(argc, argv, "dglps:")) != -1) {
switch (opt) {
case 'd':
debug = 1;
@@ -108,9 +108,6 @@ int main(int argc, char *argv[])
case 'l':
nvlog = 1;
break;
- case 'n':
- nvreload = 1;
- break;
case 'p':
op = 'p';
opset++;
@@ -171,10 +168,9 @@ 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 (nvreload) {
- if (pci_vendor != 0x10de)
- printf("Not an Nvidia card -- -n ignored\n");
- else if (reload_nv_bios(p->base_addr[0]))
+ if (pci_vendor == 0x10de) {
+ printf("Nvidia card -- using PROM/PRAMIN BIOS\n");
+ if (reload_nv_bios(p->base_addr[0]))
exit(EXIT_FAILURE);
}