Re: How to change PCI Configuration space?

chuck gelm
2005-08-31T02:47:28Z

> Hi List,
>
> I want to change the PCI Configuration space of a particular device in
> my system. I am trying to use the "pcitweak" utility to do so, but am
> not suceeding. I would appreciate if some body could provide me any
> pointers in how to do so.
>
> In this case, I want to change the value at offset 64:
>
> $ pcitweak -r 5:9:1 64
> 0x01000001 //original value
>
> $ pcitweak -w 5:9:1 64 0x02000002 //new value
>
> $ pcitweak -r 5:9:1 64
> 0x01000001 //no change?
>
> TIA,
>
> Rajat Jain
(This response is limited to linux-newbie, although
there should be a better list-server for this depth of a problem.)

Hi, Rajat Jain:

Sorry, I cannot help. Just for fun, I used pcitweak, scanpci, lspci,
and 'cat /proc/pci' and looked at my two rtl8139 ethernet cards. I
think I found that they have 256 bytes of memory; one card uses memory
0x3e014000 - 0x3e140ff or 0x100 bytes.
(cat /proc/pci |grep -A 1 -B 4 ealtek)

pcitweak read 32 bits (4 bytes) so
pcitweak 0:9:0 -r 0
would show bytes offset 0, 1, 2, & 3.

pcitweak 0:9:0 -r[-w] 64 [value]
would read[write] bytes offset 64, 65, 66, 67
or 0x100, 0x101, 0x102, 0x103
which is undefined. There might be no memory at byte offset 64.

I also used pcitweak 0:9:0 -r 4096, which I assume is outside the
configuration space of my pci device, but pcitweak dutifully displayed
output. :-|

Hopefully you are not writing to ROM. :-|

Good luck,
Chuck