Page 1 of 1

Writing PCR-file for use with wpcredit.exe

Posted: Wed Nov 22, 2006 4:32 pm
by DonPedro
I spent the last two days writing a .pcr file for the SiS 530 chipset, to be precise for the SiS "Host to PCI bridge" - device within that chipset.

It was my first approach to dig into this field but since I spent years on programming (long time ago) it was not that much of a problem.

as a starting point I used a pcr-file that was already in production but not finished - thank you stedman5040 for sending me a copy of your work!

I don't want to give here a lecture on how to write a pcr-file but I just want to share some information with all those who did not dare yet to start with but would like to do so.

for beginners: grab (google for) the specific chipset documentation you need. then try to locate "any" .pcr file even it is not for your chipset. just open it and "study" the way it is written. every .pcr-file looks the same and has the same structure. it is just the register-addresses and values (the bits within) and the explaining words YOU have to match to the chipset (device) of your liking.

1. if the chipset spec-documentation says that bit# x within a register is RO (read only) then use "(" ")" to let wpcredit display it colored accordingly.
for example if your spec-doc says that register 84h, bit 7 is RO it tells whether l2-cache is installed or not you would write the line:

(84:7)=L2 cache exists 1=yes 0=no

wpcredit then would use a different color to show this bit as RO. trying to set a RO-bit via wpcredit would not accomplish anything and does not hurt the system (it automatically blocks write access).

2. if register-bit(s) are meant to be RW (read/write) then you would write the line, for example:

[83:6]=L2-cache, 1=Enable 0=disable

the difference here that I want to draw your attention to is that for RW registers/bits you use the "[" "]".

3. a "register" is an address within the memory. it gets its distinctive name by calling it accordingly to the address it is stored within the register memory block. it is not necessary to know where in the memory the registers' are stored. they start at an address known to the system and the very first register gets its distinctive denomination by adding a counter starting from 0, e.g. register 00h, register 01h, ......

the trickier part of writing a pcr-file is the understanding of bit/byte/word/dword values and their representation in a computers memory but also their possible notations as decimal, octal (not of importance here), hexadecimal (suffix h) and binary. here I will not explain how to transcode a value from one notation into another but I will just give you the tip to use the program "calc.exe" that comes along with all windows flavours. just change the program's display and properties from standard to scientific and you get the means for one-click conversions.

for those of you who are not familiar with bits n bytes please note that a byte's 0/1 textual representation starts with bit 7 down to bit 0. BUT the "first" bit of a byte is the "zero"-bit at the 8th textual position (read from left to right):

7 6 5 4 3 2 1 0

so far so easy but the tricky part is already looming. first, what are you going to do when the chipset's spec-sheet says for example: register 58h, graphic window address table, default value 1234h? what is different here is that the value 1234h does not fit into an 8bit register. (for absolute beginners: a byte can handle values from 0 (=00h) up to 255 (=FFh)). logic says that the graphic windows address table needs 2 bytes space. in our case here that means we use register 58h (start register) AND the following register 59h. so we have here a word-value, consisting of a high-byte and a low-byte (2x8bit, bit # (- position) accordingingly:

high-byte............................low-byte
15-14-13-12-11-10-9-8...7-6-5-4-3-2-1-0

at this point it is vitally important to know that a "double-byte" = "word" in a computers memory is stored in "reverse order" compared to the string value "1234h" writtten here in plain text format. when I write 1234h, then the "high" byte value "12h" comes first, followed by the lower byte value "34h". but a computers memory space stores the lower byte value "34" first at a given address and then (in consecutive memory, i.e. higher memory address) the high byte's value "12". to sum it up: "34h" is the default value in register 58h (the starting register address, "12h" belongs to register 59h.

you can actually watch this "byte"/"word" behaviour when you start wpcredit and then change the display of the registers from 8 to 16 bit. you will notice that by switching from 8 to 16bit display mode that two consecutive bytes exchange places.

so when the techpaper says register 58, bit 14..11, then you now should know now that this belongs to register address 59h, because bits 14..11 belong to the high byte. since wpcredit uses byte-notation bits 14..11 must be translated into the bit-location of the single byte they belong to. this gives (in accordance with what I have layed-out above) position 6..3, high byte:

[59:6..3]= ....

last but not least the brain teaser: when the spec-sheet tells you of register 58, bits 10..4 then you have to split this info in 2 lines in your pcr-file:

[59:2..0]=blabla
[58:7..4]=blabla

since I stumbled over these somehow tricky situations several times I helped myself by constructing a blueprint. I hope this will make your life easier too.

Posted: Wed Nov 22, 2006 8:43 pm
by Jim
I think perhaps you should give a lecture on how to write PCR files. I can't speak for others; but you clearly know a lot more about it than I do. (which isn't saying much, cause I don't know anything about it.) In any case a well thought out, clearly written instruction set, would enable a lot of people who know nothing about writing PCR Files to write their own.

I know I need a PCR File for the MVP3 chipset that enables the user to tweak a raid controller's settings. The PCR which I have been unable to find is : 10950649 , wherein the 649 I believe refers to the CMD 649 IDE Controller card; but I don't even know if it is the CMD's data sheet that I need, or is it the MVP3's data sheet, (which I have).

Posted: Thu Nov 23, 2006 7:25 am
by KachiWachi
The only thing I would add is that your text descriptions are limited. If you type too much, it will run over into other registers. At the moment, IIRC, it is 26 characters per "line", but you can count and figure it out.

So what does (84:7]= or [84:7)= mean? I never spent the time to figure this out.

IIRC, for coloring, RW is white, and RO is red. A "zero" is displayed white, while a "one" is displayed blue. IIRC, a changed bit also has color, but I don't recall what that is.

Per convention, the higher bits come first in the PCR file, though it really doesn't matter what order they are in (the program will figure it out). So this means that -

Code: Select all

[58:3..0]=blabla 
[58:7..4]=blabla
should be written as

Code: Select all

[58:7..4]=blabla
[58:3..0]=blabla
Here is a good example of this -

Code: Select all

[MODEL]=Apollo Pro133A
[VID]=1106:VIA
[DID]=0691:Host to PCI bridge

(00)=vendor identification     xx06h: VIA Technologies
(01)=vendor identification     11xxh: VIA Technologies
(02)=device identification     xx91h: VT82C694X
(03)=device identification     06xxh: VT82C694X
will be displayed as -

Code: Select all

00 01 02 03   <- byte
06 11 91 06   <- data
even though -

Code: Select all

(01)=vendor identification     11xxh: VIA Technologies
(00)=vendor identification     xx06h: VIA Technologies
(03)=device identification     06xxh: VT82C694X
(02)=device identification     xx91h: VT82C694X
actually reads better mentally in the PCR file text.


@Jim - You need the CMD datasheet to identify what registers do what. You do not need a PCR file though to see what is in them.

Posted: Thu Nov 23, 2006 1:15 pm
by DonPedro
thank yor for the flowers, jim, but I don't feel to be in the position to write a full-fledged instruction on how to write a .pcr-file. since pcr-files are part of the program wpcredit it would need a thorough knowledge of wpcredit.exe itself.

my "knowledge" about wpcredit and its "counterpart" the pcr-file - which feeds wpcredit with some data interpreting and textualizing the bits found in some memory areas, comes from what I think it is made for (namely changing the bits), then I add common knowledge about a computer system, and shake it well by using common logic, deduction and try and error method.

things would be much easier if h.oda, the programmer of wpcredit, had provided a help-file laying out the structure (and limits) of both the pcr-file and wpcredit.

thank you kachi for your comments. I left out the coloring used in wpcredit because it can be changed by the user at will.

also I just tried what happens if you mix up the notation for RO and RW: "(" and "]". wpcredit just ignores the entry and displays it as RO with the text "reserved".

Posted: Thu Nov 23, 2006 1:35 pm
by DonPedro
one more piece of information:

if one does not know vendor-id and device-id of the host-cpu-brigde (the heart of any chipset), just start wpcredit!

it "knows" both of them because these ids (values) are always stored at the same memory-address on any machine. wpcredit then looks for a pcr-file in its own directory named after these ids. if it does not find such a file it starts anyway but shows both values in the header section as well as in the data section (registers 00h and 01h for the vendorID, 02h and 03h for the deviceID).

this said logic tells that the convention on naming the pcr-file should be (in the case of the host to cpu bridge) the combination of hex-values of vendorID and deviceID with the extension .pcr

of course this naming convention is not mandatory, you can always load a whatever-named pcr-file from within wpcredit.

Posted: Thu Nov 23, 2006 11:56 pm
by Uranium235
Excellent work DonPedro! Is the SiS530 PCR-file complete? I would be very interested in using it. Perhaps you could upload the PCR-file to the Downloads section of this website. :)

Posted: Sat Nov 25, 2006 6:22 am
by KachiWachi
My bad on the following -

"So what does (84:7]= or [84:7)= mean? I never spent the time to figure this out."

I was thinking about something else when I wrote this (such combinations do not exist in wpcredit. :oops:

There are actually help/readme files that come along with wpcredit, but they are in Japanese. I ran them through a translator, but some of the language failed. :(

Posted: Sat Nov 25, 2006 10:36 pm
by DonPedro
@uranium

well, I would not call the pcr-file "complete" but I think it hosts those things that are most interesting. of course I would like to share with everybody. how can I upload the file?

Posted: Sat Nov 25, 2006 10:53 pm
by Uranium235
DonPedro, try here:

http://www.k6plus.com/index.php?name=Downloads

Then click on "Add download" at the top.

Posted: Sat Nov 25, 2006 11:18 pm
by DonPedro
I sent it to nohr a minute ago via e-mail. the "add-download" does not work (at least for me). it expects one to give an http://-address, but that would not do it.

Posted: Sat Nov 25, 2006 11:46 pm
by DonPedro
uranium,

did you notice my todays post at sis530 ... thread. it gives details about what tweaks I applied within wpcredit and gives a LOT of bench-numbers to compare with.

Posted: Sun Nov 26, 2006 12:45 am
by Nohr
I've added DonPedro's SiS530 PCR file to the downloads section.

Here is a direct link to it: http://www.k6plus.com/downloads/10390530.zip