Dear coreboot folks,
to read the value of the BIOS Timer (section 2.11.4 of the BIOS and Kernel Developer’s Guide (BKDG) for the AMD Family 14 processors [1]), I am stuck at how to do that.
Below is the register description from the BKDG.
D0F0xE4_x0130_80F0 BIOS Timer ----------------------------- Reset: 0000_0000h. ----------------------------- Bits 31:0 Description MicroSeconds. Read-write; updated-by hardware. This field increments once every microsecond when the timer is enabled. The counter rolls over and continues counting when it reaches FFFF_FFFFh. A write to this register causes the counter to reset and begin counting from the value written.
I could not find any wrapper(?) function in the non-vendor code for that. In the vendor code directory `src/vendorcode/amd/agesa/f14/`, I found only `PcieRegisterRead`, which looks “hard” to access from outside.
$ git grep -i iocf8 $ git grep -i d0f0xe4 src/vendorcode/amd/agesa/f14
Any pointers to code already dealing with such indexed registers or instructions how to do that would help me very much.
Thanks,
Paul
[1] http://www.coreboot.org/Datasheets#AMD_Fam14 BKDG 43170 Rev 3.13 – February 17, 2012
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