Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/modules/tprof_x86 Merge the tprof_pmi and tprof_amdpmi m...
details: https://anonhg.NetBSD.org/src/rev/e8b272830a2c
branches: trunk
changeset: 991643:e8b272830a2c
user: maxv <maxv%NetBSD.org@localhost>
date: Tue Jul 24 09:47:35 2018 +0000
description:
Merge the tprof_pmi and tprof_amdpmi modules into a single tprof_x86
module.
diffstat:
distrib/sets/lists/modules/md.amd64 | 12 ++-
distrib/sets/lists/modules/md.i386 | 12 ++-
sys/dev/tprof/tprof_x86.c | 93 +++++++++++++++++++++++++++++++++++++
sys/dev/tprof/tprof_x86_amd.c | 25 +--------
sys/dev/tprof/tprof_x86_intel.c | 25 +--------
sys/modules/Makefile | 5 +-
sys/modules/tprof_amdpmi/Makefile | 12 ----
sys/modules/tprof_pmi/Makefile | 12 ----
sys/modules/tprof_x86/Makefile | 12 ++++
9 files changed, 127 insertions(+), 81 deletions(-)
diffs (truncated from 312 to 300 lines):
diff -r ec24aaaab2e2 -r e8b272830a2c distrib/sets/lists/modules/md.amd64
--- a/distrib/sets/lists/modules/md.amd64 Tue Jul 24 09:16:53 2018 +0000
+++ b/distrib/sets/lists/modules/md.amd64 Tue Jul 24 09:47:35 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.75 2018/02/26 07:30:17 pgoyette Exp $
+# $NetBSD: md.amd64,v 1.76 2018/07/24 09:47:35 maxv Exp $
#
# NOTE that there are two sets of files here:
# @MODULEDIR@ and amd64-xen
@@ -157,10 +157,12 @@
./@MODULEDIR@/tco/tco.kmod base-kernel-modules kmod
./@MODULEDIR@/thinkpad base-kernel-modules kmod
./@MODULEDIR@/thinkpad/thinkpad.kmod base-kernel-modules kmod
-./@MODULEDIR@/tprof_amdpmi base-kernel-modules kmod
-./@MODULEDIR@/tprof_amdpmi/tprof_amdpmi.kmod base-kernel-modules kmod
-./@MODULEDIR@/tprof_pmi base-kernel-modules kmod
-./@MODULEDIR@/tprof_pmi/tprof_pmi.kmod base-kernel-modules kmod
+./@MODULEDIR@/tprof_amdpmi base-obsolete obsolete
+./@MODULEDIR@/tprof_amdpmi/tprof_amdpmi.kmod base-obsolete obsolete
+./@MODULEDIR@/tprof_pmi base-obsolete obsolete
+./@MODULEDIR@/tprof_pmi/tprof_pmi.kmod base-obsolete obsolete
+./@MODULEDIR@/tprof_x86 base-kernel-modules kmod
+./@MODULEDIR@/tprof_x86/tprof_x86.kmod base-kernel-modules kmod
./@MODULEDIR@/tvpll base-kernel-modules kmod
./@MODULEDIR@/tvpll/tvpll.kmod base-kernel-modules kmod
./@MODULEDIR@/ubsec base-kernel-modules kmod
diff -r ec24aaaab2e2 -r e8b272830a2c distrib/sets/lists/modules/md.i386
--- a/distrib/sets/lists/modules/md.i386 Tue Jul 24 09:16:53 2018 +0000
+++ b/distrib/sets/lists/modules/md.i386 Tue Jul 24 09:47:35 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.79 2018/07/10 17:01:42 maya Exp $
+# $NetBSD: md.i386,v 1.80 2018/07/24 09:47:35 maxv Exp $
#
# NOTE that there are three sets of files here:
# @MODULEDIR@, i386-xen, and i386pae-xen
@@ -172,10 +172,12 @@
./@MODULEDIR@/tdfxdrm/tdfxdrm.kmod base-kernel-modules kmod
./@MODULEDIR@/thinkpad base-kernel-modules kmod
./@MODULEDIR@/thinkpad/thinkpad.kmod base-kernel-modules kmod
-./@MODULEDIR@/tprof_amdpmi base-kernel-modules kmod
-./@MODULEDIR@/tprof_amdpmi/tprof_amdpmi.kmod base-kernel-modules kmod
-./@MODULEDIR@/tprof_pmi base-kernel-modules kmod
-./@MODULEDIR@/tprof_pmi/tprof_pmi.kmod base-kernel-modules kmod
+./@MODULEDIR@/tprof_amdpmi base-obsolete obsolete
+./@MODULEDIR@/tprof_amdpmi/tprof_amdpmi.kmod base-obsolete obsolete
+./@MODULEDIR@/tprof_pmi base-obsolete obsolete
+./@MODULEDIR@/tprof_pmi/tprof_pmi.kmod base-obsolete obsolete
+./@MODULEDIR@/tprof_x86 base-kernel-modules kmod
+./@MODULEDIR@/tprof_x86/tprof_x86.kmod base-kernel-modules kmod
./@MODULEDIR@/tvpll base-kernel-modules kmod
./@MODULEDIR@/tvpll/tvpll.kmod base-kernel-modules kmod
./@MODULEDIR@/ubsec base-kernel-modules kmod
diff -r ec24aaaab2e2 -r e8b272830a2c sys/dev/tprof/tprof_x86.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/tprof/tprof_x86.c Tue Jul 24 09:47:35 2018 +0000
@@ -0,0 +1,93 @@
+/* $NetBSD: tprof_x86.c,v 1.1 2018/07/24 09:47:35 maxv Exp $ */
+
+/*
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Maxime Villard.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: tprof_x86.c,v 1.1 2018/07/24 09:47:35 maxv Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <sys/cpu.h>
+
+#include <dev/tprof/tprof.h>
+
+#include <machine/cpufunc.h>
+#include <machine/cputypes.h> /* CPUVENDOR_* */
+#include <machine/cpuvar.h> /* cpu_vendor */
+
+MODULE(MODULE_CLASS_DRIVER, tprof_x86, "tprof");
+
+extern const tprof_backend_ops_t tprof_amd_ops;
+extern const tprof_backend_ops_t tprof_intel_ops;
+
+static int
+tprof_x86_init(void)
+{
+ switch (cpu_vendor) {
+ case CPUVENDOR_AMD:
+ return tprof_backend_register("tprof_amd", &tprof_amd_ops,
+ TPROF_BACKEND_VERSION);
+ case CPUVENDOR_INTEL:
+ return tprof_backend_register("tprof_intel", &tprof_intel_ops,
+ TPROF_BACKEND_VERSION);
+ default:
+ return ENOTSUP;
+ }
+}
+
+static int
+tprof_x86_fini(void)
+{
+ switch (cpu_vendor) {
+ case CPUVENDOR_AMD:
+ return tprof_backend_unregister("tprof_amd");
+ case CPUVENDOR_INTEL:
+ return tprof_backend_unregister("tprof_intel");
+ default:
+ return ENOTSUP;
+ }
+}
+
+static int
+tprof_x86_modcmd(modcmd_t cmd, void *arg)
+{
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return tprof_x86_init();
+ case MODULE_CMD_FINI:
+ return tprof_x86_fini();
+ default:
+ return ENOTTY;
+ }
+}
diff -r ec24aaaab2e2 -r e8b272830a2c sys/dev/tprof/tprof_x86_amd.c
--- a/sys/dev/tprof/tprof_x86_amd.c Tue Jul 24 09:16:53 2018 +0000
+++ b/sys/dev/tprof/tprof_x86_amd.c Tue Jul 24 09:47:35 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tprof_x86_amd.c,v 1.1 2018/07/16 06:18:31 maxv Exp $ */
+/* $NetBSD: tprof_x86_amd.c,v 1.2 2018/07/24 09:47:35 maxv Exp $ */
/*
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tprof_x86_amd.c,v 1.1 2018/07/16 06:18:31 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof_x86_amd.c,v 1.2 2018/07/24 09:47:35 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -245,28 +245,9 @@
amd_nmi_handle = NULL;
}
-static const tprof_backend_ops_t tprof_amd_ops = {
+const tprof_backend_ops_t tprof_amd_ops = {
.tbo_estimate_freq = tprof_amd_estimate_freq,
.tbo_ident = tprof_amd_ident,
.tbo_start = tprof_amd_start,
.tbo_stop = tprof_amd_stop,
};
-
-MODULE(MODULE_CLASS_DRIVER, tprof_amdpmi, "tprof");
-
-static int
-tprof_amdpmi_modcmd(modcmd_t cmd, void *arg)
-{
-
- switch (cmd) {
- case MODULE_CMD_INIT:
- return tprof_backend_register("tprof_amd", &tprof_amd_ops,
- TPROF_BACKEND_VERSION);
-
- case MODULE_CMD_FINI:
- return tprof_backend_unregister("tprof_amd");
-
- default:
- return ENOTTY;
- }
-}
diff -r ec24aaaab2e2 -r e8b272830a2c sys/dev/tprof/tprof_x86_intel.c
--- a/sys/dev/tprof/tprof_x86_intel.c Tue Jul 24 09:16:53 2018 +0000
+++ b/sys/dev/tprof/tprof_x86_intel.c Tue Jul 24 09:47:35 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tprof_x86_intel.c,v 1.1 2018/07/16 06:18:31 maxv Exp $ */
+/* $NetBSD: tprof_x86_intel.c,v 1.2 2018/07/24 09:47:35 maxv Exp $ */
/*
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tprof_x86_intel.c,v 1.1 2018/07/16 06:18:31 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof_x86_intel.c,v 1.2 2018/07/24 09:47:35 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -241,28 +241,9 @@
intel_nmi_handle = NULL;
}
-static const tprof_backend_ops_t tprof_intel_ops = {
+const tprof_backend_ops_t tprof_intel_ops = {
.tbo_estimate_freq = tprof_intel_estimate_freq,
.tbo_ident = tprof_intel_ident,
.tbo_start = tprof_intel_start,
.tbo_stop = tprof_intel_stop,
};
-
-MODULE(MODULE_CLASS_DRIVER, tprof_pmi, "tprof");
-
-static int
-tprof_pmi_modcmd(modcmd_t cmd, void *arg)
-{
-
- switch (cmd) {
- case MODULE_CMD_INIT:
- return tprof_backend_register("tprof_pmi", &tprof_intel_ops,
- TPROF_BACKEND_VERSION);
-
- case MODULE_CMD_FINI:
- return tprof_backend_unregister("tprof_pmi");
-
- default:
- return ENOTTY;
- }
-}
diff -r ec24aaaab2e2 -r e8b272830a2c sys/modules/Makefile
--- a/sys/modules/Makefile Tue Jul 24 09:16:53 2018 +0000
+++ b/sys/modules/Makefile Tue Jul 24 09:47:35 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.206 2018/07/10 17:01:43 maya Exp $
+# $NetBSD: Makefile,v 1.207 2018/07/24 09:47:35 maxv Exp $
.include <bsd.own.mk>
@@ -197,8 +197,7 @@
SUBDIR+= odcm
SUBDIR+= powernow
SUBDIR+= tco
-SUBDIR+= tprof_pmi
-SUBDIR+= tprof_amdpmi
+SUBDIR+= tprof_x86
SUBDIR+= vmt
.endif
diff -r ec24aaaab2e2 -r e8b272830a2c sys/modules/tprof_amdpmi/Makefile
--- a/sys/modules/tprof_amdpmi/Makefile Tue Jul 24 09:16:53 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-# $NetBSD: Makefile,v 1.2 2018/07/16 06:18:31 maxv Exp $
-
-.include "../Makefile.inc"
-
-CPPFLAGS+=
-
-.PATH: ${S}/dev/tprof
-
-KMOD= tprof_amdpmi
-SRCS= tprof_x86_amd.c
-
-.include <bsd.kmodule.mk>
diff -r ec24aaaab2e2 -r e8b272830a2c sys/modules/tprof_pmi/Makefile
--- a/sys/modules/tprof_pmi/Makefile Tue Jul 24 09:16:53 2018 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-# $NetBSD: Makefile,v 1.2 2018/07/16 06:18:31 maxv Exp $
-
-.include "../Makefile.inc"
-
-CPPFLAGS+=
-
-.PATH: ${S}/dev/tprof
-
-KMOD= tprof_pmi
-SRCS= tprof_x86_intel.c
-
-.include <bsd.kmodule.mk>
diff -r ec24aaaab2e2 -r e8b272830a2c sys/modules/tprof_x86/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/tprof_x86/Makefile Tue Jul 24 09:47:35 2018 +0000
@@ -0,0 +1,12 @@
Home |
Main Index |
Thread Index |
Old Index