OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Oct 22, 2018 8:52 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Qemu HPET comparator_count is 2?
PostPosted: Thu Aug 02, 2018 9:15 pm 
Offline

Joined: Wed Aug 01, 2018 9:09 pm
Posts: 10
According to https://wiki.osdev.org/HPET#HPET_-_timer_vs_comparators:

Quote:
There're from 3 to 32 comparators, and the exact amount is indicated by comparator_count field in the above hpet structure.


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:

Code:
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));


When I print comparator_count, I'm seeing the value 2 which is not between 3 and 32. What's going on here?


Top
 Profile  
 
 Post subject: Re: Qemu HPET comparator_count is 2?
PostPosted: Fri Aug 03, 2018 2:34 am 
Offline
Member
Member

Joined: Wed Oct 26, 2011 12:00 pm
Posts: 178
It uses 5 bits to keep comparator count which technically the count can max be 31. This probably means that you need to add 1 to the actual count, as 0 = 1.... 31 = 32 to get the actual number of comparators.

_________________
MollenOS Progress: Userspace Programming
Github
Website


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], JAAman and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group