2 * Jailhouse, a Linux-based partitioning hypervisor
4 * Copyright (c) Siemens AG, 2013
7 * Jan Kiszka <jan.kiszka@siemens.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
15 #define NS_PER_SEC 1000000000UL
17 #define PM_TIMER_HZ 3579545
18 #define PM_TIMER_OVERFLOW ((0x1000000 * 1000000000ULL) / PM_TIMER_HZ)
20 unsigned long read_pm_timer(void)
22 static unsigned long last, overflows;
25 tmr = (inl(comm_region->pm_timer_address) * NS_PER_SEC) / PM_TIMER_HZ;
27 overflows += PM_TIMER_OVERFLOW;
29 return tmr + overflows;