From: John L. <mov...@us...> - 2002-06-06 19:09:54
|
Update of /cvsroot/oprofile/oprofile/module/x86 In directory usw-pr-cvs1:/tmp/cvs-serv16876/module/x86 Modified Files: Makefile.in op_apic.h Added Files: apic_compat.h arch_compat.h Log Message: move apic compat stuff around --- NEW FILE: apic_compat.h --- /** * @file apic_up_compat.h * Definitions and functions for APIC interaction * * @remark Copyright 2002 OProfile authors * @remark Read the file COPYING * * @author Philippe Elie <ph...@wa...> * @author John Levon <mo...@co...> */ #ifndef APIC_UP_COMPAT_H #define APIC_UP_COMPAT_H #if V_BEFORE(2,4,0) /* even on SMP, some defines are missing in 2.2 */ #define APIC_LVR 0x30 #define APIC_LVTPC 0x340 #define APIC_LVTERR 0x370 #define GET_APIC_VERSION(x) ((x)&0xFF) #define GET_APIC_MAXLVT(x) (((x)>>16)&0xFF) #define APIC_INTEGRATED(x) ((x)&0xF0) #else #include <asm/apic.h> #include <asm/apicdef.h> #include <asm/mpspec.h> #endif #ifndef MSR_IA32_APICBASE #define MSR_IA32_APICBASE 0x1B #endif #ifndef APIC_SPIV_APIC_ENABLED #define APIC_SPIV_APIC_ENABLED (1<<8) #endif #ifndef APIC_DEFAULT_PHYS_BASE #define APIC_DEFAULT_PHYS_BASE 0xfee00000 #endif #if !defined(CONFIG_X86_LOCAL_APIC) #define APIC_DEFAULT_PHYS_BASE 0xfee00000 #define APIC_SPIV 0xF0 #define APIC_ESR 0x280 #define APIC_LVTT 0x320 #define APIC_LVT0 0x350 #define APIC_LVT_MASKED (1<<16) #define APIC_LVT_LEVEL_TRIGGER (1<<15) #define APIC_MODE_NMI 0x4 #define APIC_MODE_EXINT 0x7 #define GET_APIC_DELIVERY_MODE(x) (((x)>>8)&0x7) #define SET_APIC_DELIVERY_MODE(x,y) (((x)&~0x700)|((y)<<8)) #define APIC_LVT1 0x360 #define APIC_SEND_PENDING (1<<12) #define APIC_TDCR 0x3E0 #define APIC_TDR_DIV_1 0xB /* when !CONFIG_X86_LOCAL_APIC we need to provide a valid va to map the * the pa of APIC onto. This va must be un-cachable/un-swapable*/ /*#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))*/ extern unsigned long virt_apic_base; /* the other define above can be redefined until the ref is identical, this * allow a compile time checking but this need to be redefined differently */ #undef APIC_BASE #define APIC_BASE virt_apic_base static __inline void apic_write(unsigned long reg, unsigned long v) { *((volatile unsigned long *)(APIC_BASE+reg)) = v; } static __inline unsigned long apic_read(unsigned long reg) { return *((volatile unsigned long *)(APIC_BASE+reg)); } #endif /* !defined(CONFIG_X86_LOCAL_APIC) */ #endif /* APIC_UP_COMPAT_H */ --- NEW FILE: arch_compat.h --- /** * @file arch_compat.h * x86-specific compatibility stuff * * @remark Copyright 2002 OProfile authors * @remark Read the file COPYING * * @author John Levon <mo...@co...> * @author Philippe Elie <ph...@wa...> */ #ifndef X86_COMPAT_H #define X86_COMPAT_H /* work-around compiler bug in gcc 2.91.66, just mark all input register as * magically cloberred by wrmsr */ #if __GNUC__ == 2 && __GNUC_MINOR__ == 91 #undef wrmsr #define wrmsr(msr,val1,val2) \ __asm__ __volatile__("wrmsr" \ : /* no outputs */ \ : "c" (msr), "a" (val1), "d" (val2) \ : "ecx", "eax", "edx") #endif /* MSRs */ #ifndef MSR_P6_PERFCTR0 #define MSR_P6_PERFCTR0 0xc1 #endif #ifndef MSR_P6_PERFCTR1 #define MSR_P6_PERFCTR1 0xc2 #endif #ifndef MSR_P6_EVNTSEL0 #define MSR_P6_EVNTSEL0 0x186 #endif #ifndef MSR_P6_EVNTSEL1 #define MSR_P6_EVNTSEL1 0x187 #endif #ifndef MSR_K7_PERFCTL0 #define MSR_K7_PERFCTL0 0xc0010000 #endif #ifndef MSR_K7_PERFCTL1 #define MSR_K7_PERFCTL1 0xc0010001 #endif #ifndef MSR_K7_PERFCTL2 #define MSR_K7_PERFCTL2 0xc0010002 #endif #ifndef MSR_K7_PERFCTL3 #define MSR_K7_PERFCTL3 0xc0010003 #endif #ifndef MSR_K7_PERFCTR0 #define MSR_K7_PERFCTR0 0xc0010004 #endif #ifndef MSR_K7_PERFCTR1 #define MSR_K7_PERFCTR1 0xc0010005 #endif #ifndef MSR_K7_PERFCTR2 #define MSR_K7_PERFCTR2 0xc0010006 #endif #ifndef MSR_K7_PERFCTR3 #define MSR_K7_PERFCTR3 0xc0010007 #endif #endif /* X86_COMPAT_H */ Index: Makefile.in =================================================================== RCS file: /cvsroot/oprofile/oprofile/module/x86/Makefile.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile.in 6 Jun 2002 18:25:43 -0000 1.3 +++ Makefile.in 6 Jun 2002 19:09:49 -0000 1.4 @@ -7,14 +7,14 @@ KCFLAGS += $(BASIC_KCFLAGS) ASMFLAGS = -D__ASSEMBLY__ -DMODULE -D__KERNEL__ -traditional -I@KINC@ -# enable -Werror for non-release versions except for gcc 2.91 +# enable -Werror for non-release versions except for on 2.5 kernels ifneq (,$(findstring cvs,@VERSION@)) -ifneq (yes,@GCC_2_91@) +ifneq (,$(findstring 2.5,@KVERS@)) KCFLAGS += -Werror endif endif -HEADERS= op_apic.h +HEADERS=op_apic.h arch_compat.h apic_compat.h SOURCES=cpu_type.c op_apic.c op_nmi.c op_fixmap.c op_syscalls.c ASMSOURCES=oprofile_nmi.S OBJECTS=cpu_type.o op_apic.o op_nmi.o op_fixmap.o op_syscalls.o oprofile_nmi.o Index: op_apic.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/module/x86/op_apic.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- op_apic.h 6 Jun 2002 16:18:24 -0000 1.2 +++ op_apic.h 6 Jun 2002 19:09:49 -0000 1.3 @@ -12,6 +12,8 @@ #ifndef OP_APIC_H #define OP_APIC_H +#include "apic_compat.h" + /* for installing and restoring the NMI handler */ #define store_idt(addr) \ |