Qemu HPET comparator_count is 2?
Posted: Thu Aug 02, 2018 9:15 pm
According to https://wiki.osdev.org/HPET#HPET_-_timer_vs_comparators:
When I print comparator_count, I'm seeing the value 2 which is not between 3 and 32. What's going on here?
However, when I print the value of comparator_count in the acpi HPET table, I'm seeing 2. I use the exact struct shown on that osdev page, namely:There're from 3 to 32 comparators, and the exact amount is indicated by comparator_count field in the above hpet structure.
Code: Select all
struct address_structure
{
uint8_t address_space_id; // 0 - system memory, 1 - system I/O
uint8_t register_bit_width;
uint8_t register_bit_offset;
uint8_t reserved;
uint64_t address;
} __attribute__((packed));
struct description_table_header
{
char signature[4]; // 'HPET' in case of HPET table
uint32_t length;
uint8_t revision;
uint8_t checksum;
char oemid[6];
uint64_t oem_tableid;
uint32_t oem_revision;
uint32_t creator_id;
uint32_t creator_revision;
} __attribute__((packed));
struct hpet : public description_table_header
{
uint8_t hardware_rev_id;
uint8_t comparator_count:5;
uint8_t counter_size:1;
uint8_t reserved:1;
uint8_t legacy_replacement:1;
uint16_t pci_vendor_id;
address_structure address;
uint8_t hpet_number;
uint16_t minimum_tick;
uint8_t page_protection;
} __attribute__((packed));