diff options
author | Stanislav Sedov <stas@FreeBSD.org> | 2011-09-15 23:55:00 +0000 |
---|---|---|
committer | Stanislav Sedov <stas@FreeBSD.org> | 2011-09-15 23:55:00 +0000 |
commit | 70011c80fc656783c3e4e874814d1fa6fc38d845 (patch) | |
tree | 8a2d8c79620a6fbe15a3ede5d578ac3fa2f427d1 | |
parent | 3b7ca2c0dfeee456a073bd37f72ef892354b7979 (diff) |
Notes
-rw-r--r-- | sysutils/x86info/Makefile | 12 | ||||
-rw-r--r-- | sysutils/x86info/distinfo | 4 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-AMD_powernow.c | 13 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-Intel_topology.c | 24 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-Makefile | 25 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-apic.c | 10 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-cpuid.c | 32 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-lsmsr.c | 25 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-mptable.c | 13 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-mtrr.c | 21 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-rdmsr.c | 16 | ||||
-rw-r--r-- | sysutils/x86info/files/patch-x86info.h | 40 |
12 files changed, 158 insertions, 77 deletions
diff --git a/sysutils/x86info/Makefile b/sysutils/x86info/Makefile index 6acaa5a8a9f4..e642c8937e61 100644 --- a/sysutils/x86info/Makefile +++ b/sysutils/x86info/Makefile @@ -6,8 +6,8 @@ # PORTNAME= x86info -PORTVERSION= 1.27 -PORTREVISION= 1 +PORTVERSION= 1.29 +PORTREVISION= 0 CATEGORIES= sysutils MASTER_SITES= http://codemonkey.org.uk/projects/x86info/ \ http://codemonkey.org.uk/projects/x86info/old/ @@ -16,13 +16,19 @@ EXTRACT_SUFX= .tgz MAINTAINER= stas@FreeBSD.org COMMENT= Utility to display information about the systems x86 processor(s) +LIB_DEPENDS= pci.3:${PORTSDIR}/devel/libpci + USE_GMAKE= yes USE_PYTHON_BUILD= yes +LICENSE= GPLv2 +ALL_TARGET= x86info lsmsr ONLY_FOR_ARCHS= i386 amd64 PLIST_FILES= bin/x86info bin/lsmsr MAN1= x86info.1 MAN8= lsmsr.8 -MAKE_ARGS= CFLAGS="${CFLAGS}" + +post-patch: + ${REINPLACE_CMD} -E -e 's,-g -O2,${CFLAGS},g' ${WRKSRC}/Makefile .include <bsd.port.pre.mk> .if ${OSVERSION} < 701102 diff --git a/sysutils/x86info/distinfo b/sysutils/x86info/distinfo index 156ea807a52e..82bdfbdd32db 100644 --- a/sysutils/x86info/distinfo +++ b/sysutils/x86info/distinfo @@ -1,2 +1,2 @@ -SHA256 (x86info-1.27.tgz) = dd6c7d5053fb520e7e47e6e2e08896a162fbbf6c247505127d0177cad19fe2a4 -SIZE (x86info-1.27.tgz) = 83312 +SHA256 (x86info-1.29.tgz) = 9f9a36717af60194fcab2eee39f24a1fa5a01d50b848149da3b63ed39161555c +SIZE (x86info-1.29.tgz) = 87526 diff --git a/sysutils/x86info/files/patch-AMD_powernow.c b/sysutils/x86info/files/patch-AMD_powernow.c new file mode 100644 index 000000000000..fbf97c2d70d5 --- /dev/null +++ b/sysutils/x86info/files/patch-AMD_powernow.c @@ -0,0 +1,13 @@ +--- AMD/powernow.c.orig 2011-09-15 15:43:33.000000000 -0700 ++++ AMD/powernow.c 2011-09-15 15:43:40.000000000 -0700 +@@ -9,8 +9,9 @@ + #include <stdio.h> + #include <unistd.h> + #include <sys/types.h> +-#include <pci/pci.h> + #include "../x86info.h" ++#define PCI_HAVE_Uxx_TYPES ++#include <pci/pci.h> + #include "AMD.h" + #include "powernow.h" + diff --git a/sysutils/x86info/files/patch-Intel_topology.c b/sysutils/x86info/files/patch-Intel_topology.c index eceb99eea824..2519624aae53 100644 --- a/sysutils/x86info/files/patch-Intel_topology.c +++ b/sysutils/x86info/files/patch-Intel_topology.c @@ -1,20 +1,18 @@ ---- Intel/topology.c.orig 2010-09-08 12:19:56.000000000 -0700 -+++ Intel/topology.c 2010-10-01 03:54:54.000000000 -0700 -@@ -20,7 +20,7 @@ +--- Intel/topology.c.orig 2011-09-15 15:36:57.000000000 -0700 ++++ Intel/topology.c 2011-09-15 15:37:10.000000000 -0700 +@@ -20,6 +20,7 @@ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. */ --static int fls(int x) -+static int priv_fls(int x) ++#ifndef __FreeBSD__ /* FreeBSD has fls() in strings.h */ + static int fls(int x) { int r = 32; +@@ -48,6 +49,7 @@ + } + return r; + } ++#endif -@@ -53,7 +53,7 @@ + static int get_count_order(unsigned int count) { - int order; - -- order = fls(count) - 1; -+ order = priv_fls(count) - 1; - if (count & (count - 1)) - order++; - return order; diff --git a/sysutils/x86info/files/patch-Makefile b/sysutils/x86info/files/patch-Makefile index 484a3df508ae..4ad8193f2628 100644 --- a/sysutils/x86info/files/patch-Makefile +++ b/sysutils/x86info/files/patch-Makefile @@ -1,11 +1,22 @@ ---- Makefile.orig 2008-12-30 22:24:01.000000000 +0300 -+++ Makefile 2008-12-30 22:24:09.000000000 +0300 -@@ -15,7 +15,7 @@ - $(CC) $(CFLAGS) -o $@ -c $< +--- Makefile.orig 2011-09-15 15:43:52.000000000 -0700 ++++ Makefile 2011-09-15 15:44:01.000000000 -0700 +@@ -1,8 +1,9 @@ + VERSION=1.29 + CFLAGS = -g -O2 -Werror -Wall -Wshadow -Wextra -Wmissing-declarations -Wdeclaration-after-statement -Wredundant-decls ++CFLAGS+= `pkg-config --cflags libpci` + LDFLAGS = -Wl,-z,relro,-z,now +-CC = gcc ++CC ?= gcc + + SHELL = /bin/sh + +@@ -88,7 +89,7 @@ + X86INFO_OBJS = $(X86INFO_SRC:%.c=%.o) + + x86info: $(X86INFO_OBJS) +- $(CC) $(CFLAGS) $(LDFLAGS) -o x86info $(X86INFO_OBJS) -lpci ++ $(CC) $(CFLAGS) $(LDFLAGS) -o x86info $(X86INFO_OBJS) `pkg-config --libs libpci` -lpci --all: x86info test lsmsr -+all: x86info lsmsr - LSMSR_TMP_HEADERS=AMD/k8.h AMD/fam10h.h generic_msr.h diff --git a/sysutils/x86info/files/patch-apic.c b/sysutils/x86info/files/patch-apic.c new file mode 100644 index 000000000000..f369f020517f --- /dev/null +++ b/sysutils/x86info/files/patch-apic.c @@ -0,0 +1,10 @@ +--- apic.c.orig 2011-09-15 15:38:59.000000000 -0700 ++++ apic.c 2011-09-15 15:39:09.000000000 -0700 +@@ -8,6 +8,7 @@ + */ + + #include <stdio.h> ++#include <unistd.h> + #include "apic.h" + #include "x86info.h" + diff --git a/sysutils/x86info/files/patch-cpuid.c b/sysutils/x86info/files/patch-cpuid.c index 42ce9b51f453..2a6e0f9b04c4 100644 --- a/sysutils/x86info/files/patch-cpuid.c +++ b/sysutils/x86info/files/patch-cpuid.c @@ -1,5 +1,5 @@ ---- cpuid.c.orig 2010-09-08 12:19:56.000000000 -0700 -+++ cpuid.c 2010-10-01 21:37:48.000000000 -0700 +--- cpuid.c.orig 2011-09-15 15:43:00.000000000 -0700 ++++ cpuid.c 2011-09-15 15:43:08.000000000 -0700 @@ -23,8 +23,16 @@ #include <sched.h> @@ -70,14 +70,11 @@ if (ret) return ret; return 0; -@@ -102,11 +129,15 @@ - unsigned int *ecx, - unsigned int *edx) +@@ -104,9 +131,12 @@ { -- static int nodriver=0; -+ static int nodriver=1; + static int nodriver=0; char cpuname[20]; - unsigned char buffer[16]; +- unsigned char buffer[16]; int fh; +#if __FreeBSD_version < 701102 cpu_cpuid_args_t args; @@ -87,7 +84,7 @@ if (nodriver == 1) { if (native_cpuid(CPU_number, idx, eax,ebx,ecx,edx)) -@@ -116,10 +147,14 @@ +@@ -116,10 +146,14 @@ args.level = idx; /* Ok, use the /dev/CPU interface in preference to the _up code. */ @@ -103,21 +100,12 @@ perror(cpuname); exit(EXIT_FAILURE); } -@@ -134,8 +169,6 @@ +@@ -134,8 +168,6 @@ } else { /* Something went wrong, just do UP and hope for the best. */ nodriver = 1; -- if (!silent && nrCPUs != 1) +- if (nrCPUs != 1) - perror(cpuname); - if (native_cpuid(CPU_number, idx, eax,ebx,ecx,edx)) { + if (native_cpuid(CPU_number, idx, eax,ebx,ecx,edx)) printf("%s", NATIVE_CPUID_FAILED_MSG); - used_UP = 1; -@@ -187,7 +220,7 @@ - fh = open(cpuname, O_RDONLY); - if (fh != -1) { - #ifndef S_SPLINT_S -- lseek64(fh, (off64_t)idx, SEEK_CUR); -+ lseek(fh, (off_t)idx, SEEK_CUR); - #endif - if (read(fh, &buffer[0], CPUID_CHUNK_SIZE) == -1) { - perror(cpuname); + diff --git a/sysutils/x86info/files/patch-lsmsr.c b/sysutils/x86info/files/patch-lsmsr.c index 122df376dc2b..50f0d61de1ae 100644 --- a/sysutils/x86info/files/patch-lsmsr.c +++ b/sysutils/x86info/files/patch-lsmsr.c @@ -1,7 +1,7 @@ ---- lsmsr.c.orig 2009-02-06 20:10:58.000000000 +0300 -+++ lsmsr.c 2009-02-09 01:51:49.000000000 +0300 +--- lsmsr.c.orig 2011-04-05 15:54:04.000000000 -0700 ++++ lsmsr.c 2011-09-15 16:44:15.000000000 -0700 @@ -31,6 +31,18 @@ - #include "AMD/fam10h.h" + #include "AMD/fam11h.h" #include "generic_msr.h" +#if defined(__FreeBSD__) @@ -19,13 +19,13 @@ /* Todos: * - add (list and eventually write) support for write-only MSR * - add decoding support for bit fields -@@ -117,6 +129,29 @@ +@@ -116,6 +128,33 @@ fprintf(stdout, "%s version %s\n", g.prog, VERSION); } +#if defined(__FreeBSD__) + -+int get_msr_val(unsigned int msr, unsigned long long *val) ++static int get_msr_val(unsigned int msr, unsigned long long *val) +{ +#if __FreeBSD_version < 701102 + cpu_msr_args_t args; @@ -39,6 +39,10 @@ +#else + if (ioctl(g.fd, CPUCTL_RDMSR, &args) != 0) { +#endif ++ fflush(stdout); ++ fprintf(stderr, ++ "could not read MSR 0x%8.8x (%s): %s\n", ++ msr, get_reg_name(msr, g.msr_table), strerror(errno)); + return 0; + } + *val = args.data; @@ -49,7 +53,7 @@ static int get_msr_val(unsigned int msr, unsigned long long *val) { off64_t off; -@@ -142,11 +177,17 @@ +@@ -141,11 +180,17 @@ return 0; } @@ -67,3 +71,12 @@ g.fd = open(s, O_RDONLY); if (g.fd < 0) fprintf(stderr, "could not open device %s: %s\n", s, +@@ -161,7 +206,7 @@ + + static int _show_msr(struct reg_spec *reg) + { +- unsigned long long val; ++ unsigned long long val = 0; + if (!g.list) + if (get_msr_val(reg->address, &val)) + return 1; diff --git a/sysutils/x86info/files/patch-mptable.c b/sysutils/x86info/files/patch-mptable.c index 735ac673263d..4a08570f95e8 100644 --- a/sysutils/x86info/files/patch-mptable.c +++ b/sysutils/x86info/files/patch-mptable.c @@ -1,11 +1,12 @@ ---- mptable.c.orig Tue Oct 4 19:15:02 2005 -+++ mptable.c Tue Oct 4 19:15:09 2005 -@@ -39,8 +39,6 @@ +--- mptable.c.orig 2011-09-15 15:37:32.000000000 -0700 ++++ mptable.c 2011-09-15 15:37:46.000000000 -0700 +@@ -37,7 +37,9 @@ #include "mptable.h" #include "x86info.h" --typedef unsigned long vm_offset_t; -- ++#ifndef __FreeBSD__ + typedef unsigned long vm_offset_t; ++#endif + /* EBDA is @ 40:0e in real-mode terms */ #define EBDA_POINTER 0x040e /* location of EBDA pointer */ - diff --git a/sysutils/x86info/files/patch-mtrr.c b/sysutils/x86info/files/patch-mtrr.c new file mode 100644 index 000000000000..b4438d6d4999 --- /dev/null +++ b/sysutils/x86info/files/patch-mtrr.c @@ -0,0 +1,21 @@ +--- mtrr.c.orig 2011-09-15 15:38:23.000000000 -0700 ++++ mtrr.c 2011-09-15 15:38:31.000000000 -0700 +@@ -8,7 +8,9 @@ + */ + + #include <stdio.h> ++#ifdef __linux__ + #include <asm/mtrr.h> ++#endif + #include "x86info.h" + + #define IA32_MTRRCAP_SMRR 0x800 +@@ -25,7 +27,7 @@ + + static unsigned int max_phy_addr = 0; + +-static char * mtrr_types[MTRR_NUM_TYPES] = ++static char * mtrr_types[] = + { + "uncacheable", + "write-combining", diff --git a/sysutils/x86info/files/patch-rdmsr.c b/sysutils/x86info/files/patch-rdmsr.c index 35df42cb6774..ba7b187b9648 100644 --- a/sysutils/x86info/files/patch-rdmsr.c +++ b/sysutils/x86info/files/patch-rdmsr.c @@ -1,6 +1,6 @@ ---- rdmsr.c.orig 2008-12-16 22:09:47.000000000 +0300 -+++ rdmsr.c 2008-12-30 22:11:46.000000000 +0300 -@@ -17,8 +17,15 @@ +--- rdmsr.c.orig 2011-09-15 15:39:28.000000000 -0700 ++++ rdmsr.c 2011-09-15 15:39:37.000000000 -0700 +@@ -18,8 +18,15 @@ #include "x86info.h" #if defined(__FreeBSD__) @@ -17,8 +17,12 @@ #endif #if defined(__FreeBSD__) -@@ -30,12 +37,16 @@ - unsigned long lo, hi; +@@ -27,16 +34,18 @@ + int read_msr(int cpu, unsigned int idx, unsigned long long *val) + { + char cpuname[16]; +- unsigned char buffer[8]; +- unsigned long lo, hi; int fh; static int nodriver=0; +#if __FreeBSD_version < 701102 @@ -35,7 +39,7 @@ fh = open(cpuname, O_RDONLY); if (fh==-1) { -@@ -46,7 +57,11 @@ +@@ -46,7 +55,11 @@ } args.msr = idx; diff --git a/sysutils/x86info/files/patch-x86info.h b/sysutils/x86info/files/patch-x86info.h index ff697e093aca..715552105d67 100644 --- a/sysutils/x86info/files/patch-x86info.h +++ b/sysutils/x86info/files/patch-x86info.h @@ -1,18 +1,34 @@ ---- x86info.h.orig 2008-12-30 22:20:56.000000000 +0300 -+++ x86info.h 2008-12-30 22:21:20.000000000 +0300 -@@ -183,6 +183,7 @@ - #include <unistd.h> - static inline void bind_cpu(struct cpudata *cpu) - { -+#if defined(__linux__) - cpu_set_t set; +--- x86info.h.orig 2011-09-15 15:37:57.000000000 -0700 ++++ x86info.h 2011-09-15 15:38:09.000000000 -0700 +@@ -220,6 +220,7 @@ - if (sched_getaffinity(getpid(), sizeof(set), &set) == 0) { -@@ -190,6 +191,7 @@ - CPU_SET(cpu->number, &set); + #define _GNU_SOURCE + #define __USE_GNU ++#ifdef __linux__ + #include <sched.h> + #include <sys/types.h> + #include <unistd.h> +@@ -233,5 +234,23 @@ sched_setaffinity(getpid(), sizeof(set), &set); } -+#endif } ++#elif defined(__FreeBSD__) ++#include <sys/types.h> ++#include <sys/param.h> ++#include <sys/cpuset.h> ++static inline void bind_cpu(struct cpudata *cpu) ++{ ++ cpuset_t set; ++ if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, ++ sizeof(set), &set) == 0) { ++ CPU_ZERO(&set); ++ CPU_SET(cpu->number, &set); ++ cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, ++ sizeof(set), &set); ++ } ++} ++#else ++# error "bind_cpu() is not implemented for this platform!" ++#endif #endif /* _X86INFO_H */ |