[patch] hwpmc [3/13]

Aggelos Economopoulos aoiko at cc.ece.ntua.gr
Sat Nov 24 13:17:45 PST 2007


Support for pmc interrupt. 

Obtained-from: FreeBSD

Index: platform/pc32/include/smp.h
===================================================================
retrieving revision 1.20
diff -u -p -r1.20 smp.h
--- platform/pc32/include/smp.h
+++ platform/pc32/include/smp.h
@@ -16,6 +16,8 @@
 
 #ifdef _KERNEL
 
+#include <machine_base/apic/apicreg.h>
+
 #if defined(SMP)
 
 #ifndef LOCORE
@@ -35,7 +37,6 @@ extern int current_postcode;  /** XXX cu
 			outb(0x80, current_postcode)
 
 
-#include <machine_base/apic/apicreg.h>
 #include <machine/pcb.h>
 
 /* global data in mpboot.s */
@@ -141,9 +142,12 @@ extern cpumask_t		smp_active_mask;
 #endif /* !LOCORE */
 #else	/* !SMP */
 
+extern volatile lapic_t *lapic;
 #define	smp_active_mask	1	/* smp_active_mask always 1 on UP machines */
 
 #endif
 
+void	lapic_enable_pmc_interrupt(void);
+
 #endif /* _KERNEL */
 #endif /* _MACHINE_SMP_H_ */
Index: platform/pc32/i386/machdep.c
===================================================================
retrieving revision 1.127
diff -u -p -r1.127 machdep.c
--- platform/pc32/i386/machdep.c
+++ platform/pc32/i386/machdep.c
@@ -2561,6 +2561,18 @@ outb(u_int port, u_char data)
 
 #endif /* DDB */
 
+#include <machine_base/apic/apicreg.h>
+
+void
+lapic_enable_pmc_interrupt(void)
+{
+	uint32_t value;
+
+	value =  lapic->lvt_pcint;
+	value &= ~APIC_LVT_MASKED;
+	lapic->lvt_pcint = value;
+}
+
 
 
 #include "opt_cpu.h"





More information about the Submit mailing list