The ACPI Power Management Timer is a very simple timer which runs at 3.579545 MHz and generates a SCI when the counter has overflown. It is extremely limited (you cannot set custom rates, for example). It is recommended to use other timers, like the HPET or the APIC Timer.
Detecting the ACPI Power Management Timer
The computer must obviously support ACPI first. Then, you need to look into the RSDP to get the RSDT or XSDT, to find the FADT table. Once you got it, you need to check if the PMTimerLength is 4. If it isn't, then you must assume the timer is not available. Then, if the ACPI revision is 2 or greater, and the X_PMTimerBlock Generic Address Structure is available (check if the address is not 0), use it. Otherwise, use PMTimerBlock as an IO port.
24-bit and 32-bit mode
The ACPI Power Management Timer supports 24 and 32 bit counters. To check if the counter is 32 bit, simply check if bit 8 of FADT Flags if set.
Reading the counter value
If using X_PMTimerBlock:
- Check in which address space the address is:
- If it's MMIO: map the address into virtual memory and read the counter as an unsigned 32 bit integer from it
- If it's IO: read the counter as unsigned 32 bit integer from IO
Else if using PMTimerBlock:
- Read the counter as an unsigned 32 bit integer from IO
|0:23||The 24 bits of the counter.|
|24:31||The upper 8 bits of the counter, if it's a 32 bit one. If the counter is 24 bit, then they're 0.|
The ACPI Power Management Timer generates a SCI when the counter has overflown. To know more about SCIs, see FADT#SCI_Interrupt.