A quick 'n dirty guide to tweaking pci
register
settings from bios.
Disclaimer
If
you decide to use this guide and modify your bios, be prepared to revive your
board when things go wrong. Make sure you have a dos/win98 -95 startup disk
that will automatically flash your bios. (See instructions on the MSI website
right here). If
things are really bad, you may have to order a new chip from http://www.badflash.com/ ($23.50 shipped). I
will not be held responsible for whatever you decide to use this information
for.
If you have any
doubts, do not modify your bios.
With everybody out there using
specific tweaks, I thought it would be more useful to explain how to make your
own option rom rather than me making one that will
only satisfy some of you. Also this way you can incorporate it in your own
favorite bios image. So far I’ve only tested this process on the 694x chip. If
you try to do this on a different via chipset-based board, let me know and I’ll
include a compatibility list. Many thanks to 'programmer' who supplied the
basic template, and wrote one of the tools you'll need.
You'll need the following files:
The codegenerator
is an excel file that is this guide again, but then really easy, step by step.
It helps you to figure out the AND and OR
instructions that people seem to have a lot of trouble with. USE IT !
The following assembly file
(tweak.asm) sets 4-way interleave (toggle bit 1), and sets active to precharge
to 5 (toggle bit 6) on a MSI 694D-PRO motherboard.
pushad
mov
eax,0x80000064 ; specifies offset
mov
dx,0xcf8
out dx,eax
mov
dx,0xcfc
in eax,dx
and eax,0xBCBCBCBC ; and operations set
bits to 0
or eax,0x02020202 ; or operations set bits
to 1
out dx,eax
popad
ret
In the example above we want to toggle bit 6 to 0 and bit 1 to 1. You can see how it is done by converting bcbcbcbc and 02020202 (hex) to binary using the conversion table below.
Use an AND instruction to toggle
specific bits to 0 |
||||
reg: |
67 |
66 |
65 |
64 |
hex: |
b c |
b c |
b c |
b c |
bin: |
1011 1100 |
1011 1100 |
1011 1100 |
1011 1100 |
bit: |
31 |
|
|
0 |
Use an OR instruction to toggle
bits to 1 |
||||
reg: |
67 |
66 |
65 |
64 |
hex: |
0 2 |
0 2 |
0 2 |
0 2 |
bin: |
0000 0010 |
0000 0010 |
0000 0010 |
0000 0010 |
bit: |
31 |
|
|
0 |
The 0's in red control the active to
precharge bit. The other zeros are there to set the
interleave bits to 0 just to make sure. The 1's in red control the 4-way
interleave bit. The AND and OR instructions only
change a bit when you use a 0 and a 1 respectively. The other bits remain
unchanged. I would advise to change only those bits that are not accessible
through the standard bios. Note that the via chipsets
only respond to dword calls, so when you specify
offset 64, you will actually be tweaking reg 67-64.
Use wpcredit in 32-bit mode to view the register
settings.
If for some reason you would like to
toggle bit 2 in offset 71 to 1 (PCI fast back to back write enable) you have to
load offset 70, use an AND instruction that will
leave everything alone (11111111111111111111111111111111 bin = FFFFFFFF hex
) use an OR instruction that will
toggle the desired bit (00000000000000000000010000000000 bin = 00000400 hex
mov
eax,0x80000070
mov
dx,0xcf8
out dx,eax
mov
dx,0xcfc
in eax,dx
and eax,0xFFFFFFFF
or eax,0x00000400
out dx,eax
Off course if you want to change
multiple bits in this range you can do it all at the same time.
Some of you might comment that the
AND instruction is not necessary, because it does nothing, but I found it to be
more reliable to keep it in there. It also keeps the whole process in a
standard fashion.
Binary
to hex conversion table
binary |
hexadecimal |
0000 |
0 |
0001 |
1 |
0010 |
2 |
0011 |
3 |
0100 |
4 |
0101 |
5 |
0110 |
6 |
0111 |
7 |
1000 |
8 |
1001 |
9 |
1010 |
A |
1011 |
B |
1100 |
C |
1101 |
D |
1110 |
E |
1111 |
F |
If you want to add other tweaks, just
copy the green lines in the example file, and paste them in before the "popad' instruction.
pushad
mov
eax,0x80000064
mov
dx,0xcf8
out dx,eax
mov
dx,0xcfc
in eax,dx
and eax,0xBCBCBCBC
or eax,0x2020202
out dx,eax
mov
eax,0x80000064
mov
dx,0xcf8
out dx,eax
mov
dx,0xcfc
in eax,dx
and eax,0xBCBCBCBC
or eax,0x2020202
out dx,eax
popad
ret
Then just change the values in red
to your desired offset and logical values, for instance setting reg 50 and 51 to FF.
pushad
mov
eax,0x80000050
mov
dx,0xcf8
out dx,eax
mov
dx,0xcfc
in eax,dx
and eax,0xFFFFFFFF
or eax,0x0000FFFF
out dx,eax
mov
eax,0x80000064
mov
dx,0xcf8
out dx,eax
mov
dx,0xcfc
in eax,dx
and eax,0xBCBCBCBC
or eax,0x2020202
out dx,eax
popad
ret
One problem here is that the bios
does not allow for reg 50 to be set to FF, and the
result will be FC instead, which is too bad, because that is a 10% performance
loss right there. Let me know if you figure out a way to do this.
Once you've incorporated all the
tweaks, you'll have to assemble your .asm file.
Download nasm,
and unzip. copy tweak.asm in
the nasm directory and convert it with the following
command line.
nasmw tweak.asm -f bin -o tweak.com
You can actually test this file by
just double-clicking it (not in win2000) Either boot in win98 and check to see
if the tweak.com file correctly sets the registers with wpcredit, Or boot in dos and check with chiphot.
After you've tested the file, you
have to convert it to a rom file, with com2rom (runs
in windows). Copy all the files from com2rom in your nasm
directory and start com2rom.Just tell the program what file to convert, and you'll have your .bin file.
The next step will be the
incorporation of your option rom into your bios
image. I've had good success with cbrom208, but you may need a different
version depending on your bios version.
Incorporate this file using the
following command line
cbrom208 yourbios.bin
/isa tweak.bin
check to see if the file was incorporated
with the following command line
cbrom208 yourbios.bin
/d
Flash the new bios, and keep your
fingers crossed.
This guide is meant to provide you
with a foolproof method for making an option rom
without explaining too much. If you have any comments or feel that I’ve made a
mistake, or if you have any information to share, let me know. Once again, if
you try this on a different via chipset please let me
know how it worked out.
Good luck!