From mboxrd@z Thu Jan 1 00:00:00 1970 From: s.psomadakis@gmail.com (Stratos Psomadakis) Date: Tue, 09 Aug 2011 11:57:50 +0300 Subject: About HPET is_hpet_capable() In-Reply-To: References: Message-ID: <4E40F68E.1080003@gmail.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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 at kernelnewbies.org > 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