From: Andrew Cooper Subject: [RFC 7/8] x86/hpet: debug keyhandlers Date: Mon, 4 Nov 2013 18:54:45 +0000 Message-ID: <1383591286-19976-8-git-send-email-andrew.cooper3@citrix.com> References: <1383591286-19976-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383591286-19976-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper List-Id: xen-devel@lists.xenproject.org Debug key for dumping HPET state. --- xen/arch/x86/hpet.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index e8a3f66..c5468fa 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -22,6 +22,8 @@ #define MAX_DELTA_NS MILLISECS(10*1000) #define MIN_DELTA_NS MICROSECS(20) +#include + #define HPET_EVT_USED_BIT 0 #define HPET_EVT_USED (1 << HPET_EVT_USED_BIT) #define HPET_EVT_DISABLE_BIT 1 @@ -822,6 +824,21 @@ int hpet_legacy_irq_tick(void) return 1; } +static void do_hpet_dump_state(unsigned char key) +{ + unsigned i; + printk("'%c' pressed - dumping HPET state\n", key); + + for ( i = 0; i < num_hpets_used; ++i ) + dump_hpet_timer(i); +} + +static struct keyhandler hpet_dump_state = { + .irq_callback = 0, + .u.fn = do_hpet_dump_state, + .desc = "Dump hpet state" +}; + u64 __init hpet_setup(void) { static u64 __initdata hpet_rate; @@ -879,6 +896,8 @@ u64 __init hpet_setup(void) hpet_rate = 1000000000000000ULL; /* 10^15 */ (void)do_div(hpet_rate, hpet_period); + register_keyhandler('1', &hpet_dump_state); + return hpet_rate; } -- 1.7.10.4