[coreboot] AMD AGESA: How to access an indexed register?

Rudolf Marek r.marek at assembler.cz
Mon May 13 22:19:17 CEST 2013


Hi all,
 > Any pointers to code already dealing with such indexed registers or
> instructions how to do that would help me very much.

Info is on page 150 of that datasheet.

D0F0xE0 and D0F0xE4 are used to access D0F0xE4_x[FFFF_FFFF:0000_0000]. To read 
or write to one of these register, the address is written first into the address 
register D0F0xE0 and then the data is read from or written to the data register 
D0F0xE4.

You can imagine that as a "window" to some internal address space (in this case 
address space of SMU)

You can even access that through a cmdline:

setpci -s 0:0.0 e0.l

This will print current register value of e0


So, to read the counter value:

setpci -s  0:0.0 e0.l=013080F0
setpci -s  0:0.0 e4.l

So, to read the default counter rate:

setpci -s  0:0.0 e0.l=013080F1
setpci -s  0:0.0 e4.l


Program it to any value:

setpci -s  0:0.0 e0.l=013080F0
setpci -s  0:0.0 e4.l=aa55aa55


To program the rate to 42 MHz

setpci -s  0:0.0 e0.l=013080F1
setpci -s  0:0.0 e4.l=0000002a

The setpci command is equivalent of this code:

setpci -s  0:0.0 e0.l=013080F0
setpci -s  0:0.0 e4.l

is:

pci_write_config32(CI_DEV(0, 0, 0), 0xe4, 0x013080F0);
tmp = pci_read_config32(PCI_DEV(0, 0, 0), 0xe4);

Happy hacking,
Rudolf




More information about the coreboot mailing list