Skip to content

Commit df967d8

Browse files
committed
mb/emulation/qemu-q35: get rid of CONFIG_UNKNOWN_TSC_RATE
This option signifies missing implementation of tsc_freq_mhz() which results in tsc_freq_mhz() from src/arch/x86/timestamp.c returning zero. That zero in turn gets put into TIMESTAMP CBMEM table requiring payloads and user-space tools to figure the frequency on their own. Implement tsc_freq_mhz() to query timer frequency in coreboot, so it gets reported downstream. Change-Id: I88d1206c13f15a9f20c07b65dcec42ec614f7e6a Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
1 parent f8700af commit df967d8

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/cpu/qemu-x86/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ config CPU_QEMU_X86
66
select HAVE_X86_64_SUPPORT
77
select UDELAY_TSC
88
select TSC_MONOTONIC_TIMER
9-
select UNKNOWN_TSC_RATE
109
select NEED_SMALL_2MB_PAGE_TABLES # QEMU doesn't support 1GB pages
1110
select IDT_IN_EVERY_STAGE
1211

src/mainboard/emulation/qemu-q35/Makefile.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
## SPDX-License-Identifier: GPL-2.0-only
22

33
bootblock-y += bootblock.c
4+
bootblock-y += timer.c
45

56
romstage-y += ../qemu-i440fx/memmap.c
7+
romstage-y += timer.c
68

79
postcar-y += ../qemu-i440fx/memmap.c
810
postcar-y += ../qemu-i440fx/exit_car.S
11+
postcar-y += timer.c
912

1013
ramstage-y += ../qemu-i440fx/memmap.c
1114
ramstage-y += ../qemu-i440fx/northbridge.c
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later */
2+
3+
#include <cpu/x86/tsc.h>
4+
#include <device/pci_ops.h>
5+
#include <southbridge/intel/common/pmutil.h>
6+
7+
unsigned long tsc_freq_mhz(void)
8+
{
9+
/* Mimics implementation of acpi_fill_fadt() in southbridge/intel/i82801ix/fadt.c. */
10+
u16 pmbase = pci_read_config16(PCI_DEV(0, 0x1f, 0), 0x40) & 0xfffe;
11+
u16 pm_tmr_blk = pmbase + PM1_TMR;
12+
return inl(pm_tmr_blk);
13+
}

0 commit comments

Comments
 (0)