aboutsummaryrefslogtreecommitdiff
path: root/sysutils/x86info/files
diff options
context:
space:
mode:
authorEmanuel Haupt <ehaupt@FreeBSD.org>2016-12-03 13:13:24 +0000
committerEmanuel Haupt <ehaupt@FreeBSD.org>2016-12-03 13:13:24 +0000
commit0812297dbefe7b3f2293baae67b80399092e8262 (patch)
treeeeb9c0959bc70bb4705baa02ead99096130d1119 /sysutils/x86info/files
parent188fd66d21ff227a82024e30e55f5c76ddd2190f (diff)
downloadports-0812297dbefe7b3f2293baae67b80399092e8262.tar.gz
ports-0812297dbefe7b3f2293baae67b80399092e8262.zip
Notes
Diffstat (limited to 'sysutils/x86info/files')
-rw-r--r--sysutils/x86info/files/patch-AMD_powernow.c13
-rw-r--r--sysutils/x86info/files/patch-Intel_cachesize.c10
-rw-r--r--sysutils/x86info/files/patch-Intel_topology.c18
-rw-r--r--sysutils/x86info/files/patch-Makefile39
-rw-r--r--sysutils/x86info/files/patch-apic.c10
-rw-r--r--sysutils/x86info/files/patch-cpuid.c111
-rw-r--r--sysutils/x86info/files/patch-lsmsr_Makefile24
-rw-r--r--sysutils/x86info/files/patch-lsmsr_lsmsr.c (renamed from sysutils/x86info/files/patch-lsmsr.c)48
-rw-r--r--sysutils/x86info/files/patch-mptable.c12
-rw-r--r--sysutils/x86info/files/patch-mtrr.c21
-rw-r--r--sysutils/x86info/files/patch-rdmsr.c54
-rw-r--r--sysutils/x86info/files/patch-x86info.h34
12 files changed, 84 insertions, 310 deletions
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 <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_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 <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
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 <sched.h>
-
- #if defined(__FreeBSD__)
-+# include <sys/param.h>
-+# include <sys/cpuset.h>
- # include <sys/ioctl.h>
--# include <cpu.h>
-+# if __FreeBSD_version < 701102
-+# define CPUDEV "/dev/cpu%d"
-+# include <cpu.h>
-+# else
-+# define CPUDEV "/dev/cpuctl%d"
-+# include <sys/cpuctl.h>
-+# 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_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.c b/sysutils/x86info/files/patch-lsmsr_lsmsr.c
index 50f0d61de1ae..929e3feadfc1 100644
--- a/sysutils/x86info/files/patch-lsmsr.c
+++ b/sysutils/x86info/files/patch-lsmsr_lsmsr.c
@@ -1,7 +1,7 @@
---- 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"
+--- 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__)
@@ -19,8 +19,8 @@
/* 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);
+@@ -119,13 +131,40 @@ static void version(void)
+ fprintf(stdout, "%s version %s\n", g.prog, LSMSR_VERSION);
}
+#if defined(__FreeBSD__)
@@ -53,7 +53,15 @@
static int get_msr_val(unsigned int msr, unsigned long long *val)
{
off64_t off;
-@@ -141,11 +180,17 @@
+ 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;
}
@@ -71,12 +79,22 @@
g.fd = open(s, O_RDONLY);
if (g.fd < 0)
fprintf(stderr, "could not open device %s: %s\n", s,
-@@ -161,7 +206,7 @@
+@@ -317,6 +362,7 @@ static int set_msr_table(void)
+ }
- 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;
+ 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 <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
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 <sys/param.h>
- # include <sys/ioctl.h>
--# include <cpu.h>
-+# if __FreeBSD_version < 701102
-+# define CPUDEV "/dev/cpu%d"
-+# include <cpu.h>
-+# else
-+# define CPUDEV "/dev/cpuctl%d"
-+# include <sys/cpuctl.h>
-+# 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 <sched.h>
- #include <sys/types.h>
- #include <unistd.h>
-@@ -233,5 +234,23 @@
- sched_setaffinity(getpid(), sizeof(set), &set);
- }
- }
-+#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 */