On 08/09/2011 11:28 AM, limp wrote: > Hi all, > > I am having a deeper look on Linux hpet code and I was wondering how exactly > is_hpet_capable() works. > >From the name of it, I assume that this function checks if the system > supports HPET or not but I can't really tell how it does that. > > The function is the following: > > static inline int is_hpet_capable(void) > { > return !boot_hpet_disable && hpet_address; > } > > Could anyone help me understand how this works? > > Regards. > > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies@xxxxxxxxxxxxxxxxx > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies boot_hpet_disable is a boot time param, which as the name suggests disables the hpet timer(nohpet is the actual parameter given to the kernel by the bootloader I think)... hpet_address is the address where the hpet timers are mapped, which is read by the kernel from the BIOS ACPI table for hpet I think... If you look at the code that does the actual initialization for hpet, it's a bit more complicated than that, but generally, this function checks whether HPET is disabled at boot time, and if a suitable entry / address for HPET timers is found in the BIOS ACPI tables (if it's not found, the hpet_address will be NULL). So if hpet is enabled, and an address is found, this function returns 1/true. Else 0/false. -- Stratos Psomadakis <s.psomadakis@xxxxxxxxx> _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies