Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/cpu/qemu-x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ config CPU_QEMU_X86
select HAVE_X86_64_SUPPORT
select UDELAY_TSC
select TSC_MONOTONIC_TIMER
select UNKNOWN_TSC_RATE
select NEED_SMALL_2MB_PAGE_TABLES # QEMU doesn't support 1GB pages
select IDT_IN_EVERY_STAGE

Expand Down
4 changes: 4 additions & 0 deletions src/mainboard/emulation/qemu-q35/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

bootblock-y += bootblock.c
bootblock-y += memmap.c
bootblock-y += timer.c

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

postcar-y += ../qemu-i440fx/memmap.c
postcar-y += ../qemu-i440fx/exit_car.S
postcar-y += memmap.c
postcar-y += timer.c

ramstage-y += ../qemu-i440fx/memmap.c
ramstage-y += ../qemu-i440fx/northbridge.c
ramstage-y += ../qemu-i440fx/rom_media.c
ramstage-y += memmap.c
ramstage-y += cpu.c
ramstage-y += timer.c

all-y += ../qemu-i440fx/fw_cfg.c
all-y += ../qemu-i440fx/bootmode.c
Expand Down
15 changes: 15 additions & 0 deletions src/mainboard/emulation/qemu-q35/timer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

#define __SIMPLE_DEVICE__

#include <cpu/x86/tsc.h>
#include <device/pci_ops.h>
#include <southbridge/intel/common/pmutil.h>

unsigned long tsc_freq_mhz(void)
{
/* Mimics implementation of acpi_fill_fadt() in southbridge/intel/i82801ix/fadt.c. */
u16 pmbase = pci_read_config16(PCI_DEV(0, 0x1f, 0), 0x40) & 0xfffe;
u16 pm_tmr_blk = pmbase + PM1_TMR;
return inl(pm_tmr_blk);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergiiDmytruk this returns the current tick, not the frequency. Am I right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, not sure how I confused it for frequency which is actually hard-coded (as used by AcpiTimerLib selected for QEMU). Should it be simply returned here or better to make EDK handle 0 in some sensible way?

}
Loading