diff options
author | dm <dm@cvs.openbsd.org> | 1996-08-14 22:03:18 +0000 |
---|---|---|
committer | dm <dm@cvs.openbsd.org> | 1996-08-14 22:03:18 +0000 |
commit | ba2295116662508fbd544e8dc42b33817906b496 (patch) | |
tree | bf942affc485daf76e605bcf5f43f075a91d94e4 /sys/arch/i386 | |
parent | 8195fcf189f6ad6257cb2b14adfccbedc6046272 (diff) |
Pentium Pro support
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/pctr.c | 18 | ||||
-rw-r--r-- | sys/arch/i386/include/pctr.h | 12 |
2 files changed, 20 insertions, 10 deletions
diff --git a/sys/arch/i386/i386/pctr.c b/sys/arch/i386/i386/pctr.c index 15339775cee..2acad08b332 100644 --- a/sys/arch/i386/i386/pctr.c +++ b/sys/arch/i386/i386/pctr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pctr.c,v 1.4 1996/08/14 03:02:54 dm Exp $ */ +/* $OpenBSD: pctr.c,v 1.5 1996/08/14 22:03:15 dm Exp $ */ /* * Pentium performance counter driver for OpenBSD. @@ -56,11 +56,12 @@ pctrattach (int num) if (usep6ctr) printf ("pctr: Pentium Pro user-level performance counters enabled\n"); else if (usep5ctr) - printf ("pctr: Pentium performance counters enabled\n"); + printf ("pctr: Pentium performance counters and user-level " + "cycle counter enabled\n"); else if (usetsc) - printf ("pctr: Cycle counter enabled\n"); + printf ("pctr: user-level cycle counter enabled\n"); else - printf ("pctr: Performance counters not supported by CPU\n"); + printf ("pctr: no performance counters in CPU\n"); } int @@ -99,7 +100,7 @@ p5ctrsel (int fflag, u_int cmd, u_int fn) msr11 &= ~(0x1ffLL << shift); msr11 |= fn << shift; wrmsr (0x11, msr11); - wrmsr (msr, 0LL); + wrmsr (msr, 0); return 0; } @@ -135,8 +136,9 @@ p6ctrsel (int fflag, u_int cmd, u_int fn) if (fn & 0x380000) return EINVAL; + wrmsr (msrval, 0); wrmsr (msrsel, fn); - wrmsr (msrval, 0LL); + wrmsr (msrval, 0); return 0; } @@ -148,8 +150,8 @@ p6ctrrd (struct pctrst *st) st->pctr_fn[1] = rdmsr (P6MSR_CTRSEL1); __asm __volatile ("cli"); st->pctr_tsc = rdtsc (); - st->pctr_hwc[0] = rdmsr (P6MSR_CTR0); - st->pctr_hwc[1] = rdmsr (P6MSR_CTR1); + st->pctr_hwc[0] = rdpmc (0); + st->pctr_hwc[1] = rdpmc (1); __asm __volatile ("sti"); } diff --git a/sys/arch/i386/include/pctr.h b/sys/arch/i386/include/pctr.h index 6b7011a8c27..d86d4db116d 100644 --- a/sys/arch/i386/include/pctr.h +++ b/sys/arch/i386/include/pctr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pctr.h,v 1.2 1996/08/14 03:02:53 dm Exp $ */ +/* $OpenBSD: pctr.h,v 1.3 1996/08/14 22:03:16 dm Exp $ */ /* * Pentium performance counter driver for OpenBSD. @@ -35,6 +35,14 @@ struct pctrst { #define P6CTR_EN 0x400000 /* Enable counters (counter 0 only) */ #define P6CTR_I 0x800000 /* Invert counter mask */ +/* Unit Mask bits */ +#define P6CTR_UM_M 0x0800 /* Modified cache lines */ +#define P6CTR_UM_E 0x0400 /* Exclusive cache lines */ +#define P6CTR_UM_S 0x0200 /* Shared cache lines */ +#define P6CTR_UM_I 0x0100 /* Invalid cache lines */ +#define P6CTR_UM_MESI (P6CTR_UM_M|P6CTR_UM_E|P6CTR_UM_S|P6CTR_UM_I) +#define P6CTR_UM_A 0x2000 /* Any initiator (as opposed to self) */ + /* ioctl to set which counter a device tracks. */ #define PCIOCRD _IOR('c', 1, struct pctrst) /* Read counter value */ #define PCIOCS0 _IOW('c', 8, unsigned int) /* Set counter 0 function */ @@ -115,7 +123,7 @@ struct pctrst { }) #define wrmsr(msr, v) \ - __asm __volatile (".byte 0xf, 0x30" :: "A" (v), "c" (msr)); + __asm __volatile (".byte 0xf, 0x30" :: "A" ((u_quad_t) (v)), "c" (msr)); #endif /* _KERNEL */ #endif /* ! _I386_PERFCNT_H_ */ |