From 0812297dbefe7b3f2293baae67b80399092e8262 Mon Sep 17 00:00:00 2001 From: Emanuel Haupt Date: Sat, 3 Dec 2016 13:13:24 +0000 Subject: - Update to latest GitHub version - Update WWW PR: 214878 Submitted by: kib --- sysutils/x86info/files/patch-AMD_powernow.c | 13 --- sysutils/x86info/files/patch-Intel_cachesize.c | 10 --- sysutils/x86info/files/patch-Intel_topology.c | 18 ---- sysutils/x86info/files/patch-Makefile | 39 ++++++--- sysutils/x86info/files/patch-apic.c | 10 --- sysutils/x86info/files/patch-cpuid.c | 111 ------------------------- sysutils/x86info/files/patch-lsmsr.c | 82 ------------------ sysutils/x86info/files/patch-lsmsr_Makefile | 24 ++++++ sysutils/x86info/files/patch-lsmsr_lsmsr.c | 100 ++++++++++++++++++++++ sysutils/x86info/files/patch-mptable.c | 12 --- sysutils/x86info/files/patch-mtrr.c | 21 ----- sysutils/x86info/files/patch-rdmsr.c | 54 ------------ sysutils/x86info/files/patch-x86info.h | 34 -------- 13 files changed, 151 insertions(+), 377 deletions(-) delete mode 100644 sysutils/x86info/files/patch-AMD_powernow.c delete mode 100644 sysutils/x86info/files/patch-Intel_cachesize.c delete mode 100644 sysutils/x86info/files/patch-Intel_topology.c delete mode 100644 sysutils/x86info/files/patch-apic.c delete mode 100644 sysutils/x86info/files/patch-cpuid.c delete mode 100644 sysutils/x86info/files/patch-lsmsr.c create mode 100644 sysutils/x86info/files/patch-lsmsr_Makefile create mode 100644 sysutils/x86info/files/patch-lsmsr_lsmsr.c delete mode 100644 sysutils/x86info/files/patch-mptable.c delete mode 100644 sysutils/x86info/files/patch-mtrr.c delete mode 100644 sysutils/x86info/files/patch-rdmsr.c delete mode 100644 sysutils/x86info/files/patch-x86info.h (limited to 'sysutils/x86info/files') diff --git a/sysutils/x86info/files/patch-AMD_powernow.c b/sysutils/x86info/files/patch-AMD_powernow.c deleted file mode 100644 index fbf97c2d70d5..000000000000 --- a/sysutils/x86info/files/patch-AMD_powernow.c +++ /dev/null @@ -1,13 +0,0 @@ ---- 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 - #include - #include --#include - #include "../x86info.h" -+#define PCI_HAVE_Uxx_TYPES -+#include - #include "AMD.h" - #include "powernow.h" - diff --git a/sysutils/x86info/files/patch-Intel_cachesize.c b/sysutils/x86info/files/patch-Intel_cachesize.c deleted file mode 100644 index c0230358db1a..000000000000 --- a/sysutils/x86info/files/patch-Intel_cachesize.c +++ /dev/null @@ -1,10 +0,0 @@ ---- Intel/cachesize.c.orig 2008-08-09 22:04:12.000000000 +0400 -+++ Intel/cachesize.c 2008-08-09 22:04:24.000000000 +0400 -@@ -147,6 +147,7 @@ - { - {0xf0, 64, "64 byte prefetching."}, - {0xf1, 64, "128 byte prefetching."}, -+ { 0, 0, NULL } - }; - - static unsigned char found_unknown=0; diff --git a/sysutils/x86info/files/patch-Intel_topology.c b/sysutils/x86info/files/patch-Intel_topology.c deleted file mode 100644 index 2519624aae53..000000000000 --- a/sysutils/x86info/files/patch-Intel_topology.c +++ /dev/null @@ -1,18 +0,0 @@ ---- 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. - */ - -+#ifndef __FreeBSD__ /* FreeBSD has fls() in strings.h */ - static int fls(int x) - { - int r = 32; -@@ -48,6 +49,7 @@ - } - return r; - } -+#endif - - static int get_count_order(unsigned int count) - { diff --git a/sysutils/x86info/files/patch-Makefile b/sysutils/x86info/files/patch-Makefile index c9b2f2771fbc..7a0a29ef08a5 100644 --- a/sysutils/x86info/files/patch-Makefile +++ b/sysutils/x86info/files/patch-Makefile @@ -1,22 +1,37 @@ ---- Makefile.orig 2011-09-15 15:43:52.000000000 -0700 -+++ Makefile 2011-09-15 15:44:01.000000000 -0700 -@@ -1,8 +1,8 @@ - VERSION=1.30 +--- Makefile.orig 2016-10-12 19:04:55 UTC ++++ Makefile +@@ -18,6 +18,7 @@ CFLAGS += -Wstrict-prototypes -Wmissing- + CFLAGS += -Wswitch-enum + CFLAGS += -Wundef + CFLAGS += -Wwrite-strings ++CFLAGS += `pkg-config --cflags libpci` --CFLAGS = -g -O2 -Werror -Wall -Wshadow -Wextra -Wmissing-declarations -Wdeclaration-after-statement -Wredundant-decls -+CFLAGS += -Wall -Wshadow -Wextra -Wmissing-declarations -Wdeclaration-after-statement -Wredundant-decls `pkg-config --cflags libpci` + # gcc specific + ifneq ($(shell $(CC) -v 2>&1 | grep -c "clang"), 1) +@@ -37,7 +38,7 @@ CFLAGS += $(shell if [ $(CPP_MAJOR) -eq LDFLAGS = -Wl,-z,relro,-z,now + + ifeq ($(CC),"") -CC = gcc +CC ?= gcc + endif - SHELL = /bin/sh + ifdef STATIC_LIBPCI +@@ -50,7 +51,7 @@ SHELL = /bin/sh -@@ -91,7 +91,7 @@ - X86INFO_OBJS = $(X86INFO_SRC:%.c=%.o) + V = @ + Q = $(V:1=) +-QUIET_CC = $(Q:@=@echo ' CC '$@;) ++#QUIET_CC = $(Q:@=@echo ' CC '$@;) - 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 +@@ -67,7 +68,7 @@ X86INFO_OBJS = $(sort $(patsubst %.c,%.o + x86info: $(X86INFO_OBJS) $(X86INFO_HEADERS) + $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o x86info $(X86INFO_OBJS) \ +- $(LIBPCI) ++ `pkg-config --libs libpci` $(LIBPCI) + DEPDIR= .deps + -include $(X86INFO_SRC:%.c=$(DEPDIR)/%.d) diff --git a/sysutils/x86info/files/patch-apic.c b/sysutils/x86info/files/patch-apic.c deleted file mode 100644 index f369f020517f..000000000000 --- a/sysutils/x86info/files/patch-apic.c +++ /dev/null @@ -1,10 +0,0 @@ ---- 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 -+#include - #include "apic.h" - #include "x86info.h" - diff --git a/sysutils/x86info/files/patch-cpuid.c b/sysutils/x86info/files/patch-cpuid.c deleted file mode 100644 index 2a6e0f9b04c4..000000000000 --- a/sysutils/x86info/files/patch-cpuid.c +++ /dev/null @@ -1,111 +0,0 @@ ---- 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 - - #if defined(__FreeBSD__) -+# include -+# include - # include --# include -+# if __FreeBSD_version < 701102 -+# define CPUDEV "/dev/cpu%d" -+# include -+# else -+# define CPUDEV "/dev/cpuctl%d" -+# include -+# endif - #endif - - #include "x86info.h" -@@ -45,7 +53,11 @@ - unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) - { -+#if defined(__FreeBSD__) -+ cpuset_t set, tmp_set; -+#else - cpu_set_t set, tmp_set; -+#endif - unsigned int a = 0, b = 0, c = 0, d = 0; - int ret; - -@@ -58,15 +70,25 @@ - if (edx != NULL) - d = *edx; - -+#if defined(__FreeBSD__) -+ ret = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -+ -1, sizeof(set), &set); -+#else - ret = sched_getaffinity(getpid(), sizeof(set), &set); -+#endif - if (ret) - return ret; - - /* man CPU_SET(3): To duplicate a CPU set, use memcpy(3) */ -- memcpy(&tmp_set, &set, sizeof(cpu_set_t)); -+ memcpy(&tmp_set, &set, sizeof(tmp_set)); - CPU_ZERO(&set); - CPU_SET(cpunr, &set); -+#if defined(__FreeBSD__) -+ ret = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -+ -1, sizeof(set), &set); -+#else - ret = sched_setaffinity(getpid(), sizeof(set), &set); -+#endif - if (ret) - return ret; - -@@ -87,7 +109,12 @@ - *edx = d; - - /* Restore initial sched affinity */ -+#if defined(__FreeBSD__) -+ ret = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -+ -1, sizeof(tmp_set), &tmp_set); -+#else - ret = sched_setaffinity(getpid(), sizeof(tmp_set), &tmp_set); -+#endif - if (ret) - return ret; - return 0; -@@ -104,9 +131,12 @@ - { - static int nodriver=0; - char cpuname[20]; -- unsigned char buffer[16]; - int fh; -+#if __FreeBSD_version < 701102 - cpu_cpuid_args_t args; -+#else -+ cpuctl_cpuid_args_t args; -+#endif - - if (nodriver == 1) { - if (native_cpuid(CPU_number, idx, eax,ebx,ecx,edx)) -@@ -116,10 +146,14 @@ - - args.level = idx; - /* Ok, use the /dev/CPU interface in preference to the _up code. */ -- (void)snprintf(cpuname,18, "/dev/cpu%d", CPU_number); -+ (void)snprintf(cpuname,18, CPUDEV, CPU_number); - fh = open(cpuname, O_RDONLY); - if (fh != -1) { -+#if __FreeBSD_version < 701102 - if (ioctl(fh, CPU_CPUID, &args) != 0) { -+#else -+ if (ioctl(fh, CPUCTL_CPUID, &args) != 0) { -+#endif - perror(cpuname); - exit(EXIT_FAILURE); - } -@@ -134,8 +168,6 @@ - } else { - /* Something went wrong, just do UP and hope for the best. */ - nodriver = 1; -- if (nrCPUs != 1) -- perror(cpuname); - if (native_cpuid(CPU_number, idx, eax,ebx,ecx,edx)) - printf("%s", NATIVE_CPUID_FAILED_MSG); - diff --git a/sysutils/x86info/files/patch-lsmsr.c b/sysutils/x86info/files/patch-lsmsr.c deleted file mode 100644 index 50f0d61de1ae..000000000000 --- a/sysutils/x86info/files/patch-lsmsr.c +++ /dev/null @@ -1,82 +0,0 @@ ---- 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/fam11h.h" - #include "generic_msr.h" - -+#if defined(__FreeBSD__) -+# include -+# include -+# if __FreeBSD_version < 701102 -+# define CPUDEV "/dev/cpu%d" -+# include -+# else -+# define CPUDEV "/dev/cpuctl%d" -+# include -+# endif -+#endif -+ - /* Todos: - * - add (list and eventually write) support for write-only MSR - * - add decoding support for bit fields -@@ -116,6 +128,33 @@ - fprintf(stdout, "%s version %s\n", g.prog, VERSION); - } - -+#if defined(__FreeBSD__) -+ -+static int get_msr_val(unsigned int msr, unsigned long long *val) -+{ -+#if __FreeBSD_version < 701102 -+ cpu_msr_args_t args; -+#else -+ cpuctl_msr_args_t args; -+#endif -+ -+ args.msr = msr; -+#if __FreeBSD_version < 701102 -+ if (ioctl(g.fd, CPU_RDMSR, &args) != 0) { -+#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; -+ -+ return 0; -+} -+#else /* !__FreeBSD__ */ - static int get_msr_val(unsigned int msr, unsigned long long *val) - { - off64_t off; -@@ -141,11 +180,17 @@ - return 0; - } - -+#endif -+ - static int open_dev(int cpu) - { - char s[20]; - -+#ifdef __FreeBSD__ -+ snprintf(s, sizeof(s), CPUDEV, cpu); -+#else - snprintf(s, sizeof(s), "/dev/cpu/%d/msr", cpu); -+#endif - 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-lsmsr_Makefile b/sysutils/x86info/files/patch-lsmsr_Makefile new file mode 100644 index 000000000000..ab2ec08ff82e --- /dev/null +++ b/sysutils/x86info/files/patch-lsmsr_Makefile @@ -0,0 +1,24 @@ +--- lsmsr/Makefile.orig 2016-10-12 19:04:55 UTC ++++ lsmsr/Makefile +@@ -14,12 +14,10 @@ CFLAGS += -Wdeclaration-after-statement + CFLAGS += -Wformat=2 + CFLAGS += -Wimplicit + CFLAGS += -Winit-self +-CFLAGS += -Wlogical-op + CFLAGS += -Wmissing-declarations -Wredundant-decls + CFLAGS += -Wnested-externs + CFLAGS += -Wpacked + CFLAGS += -Wshadow +-CFLAGS += -Wstrict-aliasing=3 + CFLAGS += -Wstrict-prototypes -Wmissing-prototypes + CFLAGS += -Wswitch-enum + CFLAGS += -Wundef +@@ -40,7 +38,7 @@ LSMSR_TMP_HEADERS=AMD_k8.h \ + generic_msr.h + + %.h: %.regs createheader.py +- @python createheader.py $< `basename $< .regs` >$@ ++ @/usr/local/bin/python2.7 createheader.py $< `basename $< .regs` >$@ + + LSMSR_SRC = \ + lsmsr.c \ diff --git a/sysutils/x86info/files/patch-lsmsr_lsmsr.c b/sysutils/x86info/files/patch-lsmsr_lsmsr.c new file mode 100644 index 000000000000..929e3feadfc1 --- /dev/null +++ b/sysutils/x86info/files/patch-lsmsr_lsmsr.c @@ -0,0 +1,100 @@ +--- lsmsr/lsmsr.c.orig 2016-10-12 19:04:55 UTC ++++ lsmsr/lsmsr.c +@@ -34,6 +34,18 @@ + #include "AMD_fam15h.h" + #include "generic_msr.h" + ++#if defined(__FreeBSD__) ++# include ++# include ++# if __FreeBSD_version < 701102 ++# define CPUDEV "/dev/cpu%d" ++# include ++# else ++# define CPUDEV "/dev/cpuctl%d" ++# include ++# endif ++#endif ++ + /* Todos: + * - add (list and eventually write) support for write-only MSR + * - add decoding support for bit fields +@@ -119,13 +131,40 @@ static void version(void) + fprintf(stdout, "%s version %s\n", g.prog, LSMSR_VERSION); + } + ++#if defined(__FreeBSD__) ++ ++static int get_msr_val(unsigned int msr, unsigned long long *val) ++{ ++#if __FreeBSD_version < 701102 ++ cpu_msr_args_t args; ++#else ++ cpuctl_msr_args_t args; ++#endif ++ ++ args.msr = msr; ++#if __FreeBSD_version < 701102 ++ if (ioctl(g.fd, CPU_RDMSR, &args) != 0) { ++#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; ++ ++ return 0; ++} ++#else /* !__FreeBSD__ */ + static int get_msr_val(unsigned int msr, unsigned long long *val) + { + off64_t off; + int err; + + *val = 0; +- off = lseek64(g.fd, (off64_t) msr, SEEK_SET); ++ off = lseek(g.fd, (off64_t) msr, SEEK_SET); + if (off == (off_t) -1) { + perror("invalid MSR"); + return 1; +@@ -144,11 +183,17 @@ static int get_msr_val(unsigned int msr, + return 0; + } + ++#endif ++ + static int open_dev(int cpu) + { + char s[20]; + ++#ifdef __FreeBSD__ ++ snprintf(s, sizeof(s), CPUDEV, cpu); ++#else + snprintf(s, sizeof(s), "/dev/cpu/%d/msr", cpu); ++#endif + g.fd = open(s, O_RDONLY); + if (g.fd < 0) + fprintf(stderr, "could not open device %s: %s\n", s, +@@ -317,6 +362,7 @@ static int set_msr_table(void) + } + + struct reg_spec unknown_msr = {0, "unknown", "(at your own risk)", NULL, NULL}; ++unsigned int nrCPUs = 1; + + #define OPT_MAX 32 + int main(int argc, char *argv[]) +@@ -325,6 +371,10 @@ int main(int argc, char *argv[]) + int i, li, ret; + struct reg_spec *reg; + ++ nrCPUs = sysconf(_SC_NPROCESSORS_ONLN); ++ if (nrCPUs > 65535) ++ nrCPUs = 1; ++ + ret = 1; + if((g.prog = rindex(argv[0], '/'))) + ++g.prog; diff --git a/sysutils/x86info/files/patch-mptable.c b/sysutils/x86info/files/patch-mptable.c deleted file mode 100644 index 4a08570f95e8..000000000000 --- a/sysutils/x86info/files/patch-mptable.c +++ /dev/null @@ -1,12 +0,0 @@ ---- 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" - -+#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 deleted file mode 100644 index b4438d6d4999..000000000000 --- a/sysutils/x86info/files/patch-mtrr.c +++ /dev/null @@ -1,21 +0,0 @@ ---- 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 -+#ifdef __linux__ - #include -+#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 deleted file mode 100644 index ba7b187b9648..000000000000 --- a/sysutils/x86info/files/patch-rdmsr.c +++ /dev/null @@ -1,54 +0,0 @@ ---- 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__) -+# include - # include --# include -+# if __FreeBSD_version < 701102 -+# define CPUDEV "/dev/cpu%d" -+# include -+# else -+# define CPUDEV "/dev/cpuctl%d" -+# include -+# endif - #endif - - #if defined(__FreeBSD__) -@@ -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 - cpu_msr_args_t args; -+#else -+ cpuctl_msr_args_t args; -+#endif - - if (nodriver==1) - return 0; - -- (void)snprintf(cpuname, sizeof(cpuname), "/dev/cpu%d", cpu); -+ (void)snprintf(cpuname, sizeof(cpuname), CPUDEV, cpu); - - fh = open(cpuname, O_RDONLY); - if (fh==-1) { -@@ -46,7 +55,11 @@ - } - - args.msr = idx; -- if (ioctl(fh, CPU_RDMSR, &args) != 0) { -+#if __FreeBSD_version < 701102 -+ if (ioctl(fh, CPU_RDMSR, &args) != 0) { -+#else -+ if (ioctl(fh, CPUCTL_RDMSR, &args) != 0) { -+#endif - if (close(fh) == -1) { - perror("close"); - exit(EXIT_FAILURE); diff --git a/sysutils/x86info/files/patch-x86info.h b/sysutils/x86info/files/patch-x86info.h deleted file mode 100644 index 715552105d67..000000000000 --- a/sysutils/x86info/files/patch-x86info.h +++ /dev/null @@ -1,34 +0,0 @@ ---- 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 @@ - - #define _GNU_SOURCE - #define __USE_GNU -+#ifdef __linux__ - #include - #include - #include -@@ -233,5 +234,23 @@ - sched_setaffinity(getpid(), sizeof(set), &set); - } - } -+#elif defined(__FreeBSD__) -+#include -+#include -+#include -+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 */ -- cgit v1.2.3