0

According to OSDev, to locate the Port I/O address of ACPI timer, we first open FADT table and check entries PM Timer Block Length and PM Timer Block Address. In my computer, PM Timer Block Address gives address 0x408 and it works correctly.

However, in the implementation of OVMF, the I/O address of ACPI timer is calculated as PMBA + 0x8. I search the internet and found no information about this way of calculation.

I'm wondering are both methods to decide ACPI timer address correct? If both are correct, where can I find definitions of information about the second way of calculation?

1
  • It's the same address I suppose. I guess PMBA means the start of entire ACPI block, which is 0x400. Commented Feb 6, 2022 at 13:54

1 Answer 1

1

Firmware (e.g. OVMF) uses chipset specific methods to determine the IO port of the ACPI timer; and then constructs the FADT and fills it in so that an OS doesn't need to be chipset specific.

If you don't want to use FADT, then you can write a chipset specific driver for each chipset. For some cases (open source emulators) this may be relatively easy, and for some cases (proprietary and undocumented real hardware) this will be almost impossible.

Sign up to request clarification or add additional context in comments.

3 Comments

If I understand it correctly, the OVMF way is the fundamental way to calculate the IO port? I downloaded spec of PIIX4 southbridge, which is what used by OVMF, and failed to found description of how to calculate IO port of ACPI timer...
@citrate: For most real motherboards firmware probably just does it completely at compile time (like #define ACPI_TIMER_IO_PORT 0x408). OVFM is different because it supports 3 different chipsets (e.g. the switch (HostBridgeDevId) at line 43 in BaseAcpiTimerLib.c that you provided a link to) and different virtual machines (e.g. PIIIX4 in VirtualBox, PIIIX4 in Qemu, etc) so it has to be a lot more adaptable. Myself, I would've done OVFM differently - let native host code construct the FADT instead of doing it in guest firmware (then let guest firmware read it from FADT if it wants it).
Got it. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.