[haiku-commits] r35661 - haiku/trunk/src/system/kernel/arch/x86/timers

  • From: stefano.ceccherini@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 28 Feb 2010 18:18:43 +0100 (CET)

Author: jackburton
Date: 2010-02-28 18:18:43 +0100 (Sun, 28 Feb 2010)
New Revision: 35661
Changeset: http://dev.haiku-os.org/changeset/35661/haiku

Modified:
   haiku/trunk/src/system/kernel/arch/x86/timers/x86_hpet.cpp
Log:
Small cleanups, undef TRACE_HPET. Still at priority 0.


Modified: haiku/trunk/src/system/kernel/arch/x86/timers/x86_hpet.cpp
===================================================================
--- haiku/trunk/src/system/kernel/arch/x86/timers/x86_hpet.cpp  2010-02-28 
17:17:42 UTC (rev 35660)
+++ haiku/trunk/src/system/kernel/arch/x86/timers/x86_hpet.cpp  2010-02-28 
17:18:43 UTC (rev 35661)
@@ -1,22 +1,24 @@
 /*
+ * Copyright 2009-2010, Stefano Ceccherini (stefano.ceccherini@xxxxxxxxx)
  * Copyright 2008, Dustin Howett, dustin.howett@xxxxxxxxxx All rights reserved.
  * Distributed under the terms of the MIT License.
  */
 
 #include <debug.h>
+#include <int.h>
+#include <smp.h>
 #include <timer.h>
+
+#include <arch/int.h>
+#include <arch/cpu.h>
 #include <arch/x86/timer.h>
 #include <arch/x86/arch_hpet.h>
 
 #include <boot/kernel_args.h>
-
-#include <arch/int.h>
-#include <arch/cpu.h>
-#include <int.h>
 #include <vm/vm.h>
 
 
-#define TRACE_HPET
+//#define TRACE_HPET
 #ifdef TRACE_HPET
        #define TRACE(x) dprintf x
 #else
@@ -47,7 +49,13 @@
 static int
 hpet_get_priority()
 {
-       return 0; // TODO: Should have the highest priority
+       // TODO: Fix HPET in SMP mode.
+       if (smp_get_num_cpus() > 1)
+               return 0;
+       
+       // HPET timers, being off-chip, are more expensive to setup
+       // than the LAPIC.
+       return 0;
 }
 
 
@@ -67,6 +75,8 @@
 }
 
 
+#define MIN_TIMEOUT 3000
+
 static status_t
 hpet_set_hardware_timer(bigtime_t relativeTimeout)
 {
@@ -76,8 +86,8 @@
        sTimer->config |= HPET_CONF_TIMER_INT_ENABLE;
        
        // TODO:
-       if (relativeTimeout < 3000)
-               relativeTimeout = 3000;
+       if (relativeTimeout < MIN_TIMEOUT)
+               relativeTimeout = MIN_TIMEOUT;
                
        bigtime_t timerValue = hpet_convert_timeout(relativeTimeout);
        
@@ -268,8 +278,6 @@
        
        int32 configuredIRQ = HPET_GET_CONF_TIMER_INT_ROUTE(sTimer);
                
-       //install_io_interrupt_handler(0xfb - ARCH_INTERRUPT_BASE,
-               //&hpet_timer_interrupt, NULL, B_NO_LOCK_VECTOR);
        install_io_interrupt_handler(configuredIRQ, &hpet_timer_interrupt,
                NULL, B_NO_LOCK_VECTOR);
        


Other related posts:

  • » [haiku-commits] r35661 - haiku/trunk/src/system/kernel/arch/x86/timers - stefano . ceccherini