From c59529f0444e5e34bc39a643282bf49ed2d3edf0 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Sun, 19 Jun 2011 19:03:07 +0200
Subject: [PATCH 04/18] hwpmc: Some DragonFly specific adjustments to libpmc.

* __amd64__ -> __x86_64__

* Comment out arm and xscale cases in the Makefile

* Put the CVS id into the comments
---
 lib/libpmc/Makefile |    6 +++---
 lib/libpmc/libpmc.c |   29 ++++++++++++++---------------
 lib/libpmc/pmclog.c |    5 ++---
 3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile
index 043c817..3936c9a 100644
--- a/lib/libpmc/Makefile
+++ b/lib/libpmc/Makefile
@@ -22,7 +22,7 @@ MAN+=	pmc_start.3
 MAN+=	pmclog.3
 
 # PMC-dependent manual pages
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
 MAN+=	pmc.atom.3
 MAN+=	pmc.core.3
 MAN+=	pmc.core2.3
@@ -38,8 +38,8 @@ MAN+=	pmc.corei7uc.3
 MAN+=	pmc.westmere.3
 MAN+=	pmc.westmereuc.3
 MAN+=	pmc.tsc.3
-.elif ${MACHINE_CPUARCH} == "arm" && ${CPUTYPE} == "xscale"
-MAN+=	pmc.xscale.3
+#.elif ${MACHINE_ARCH} == "arm" && ${CPUTYPE} == "xscale"
+#MAN+=	pmc.xscale.3
 .endif
 
 MLINKS+= \
diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c
index 6fce590..aafe168 100644
--- a/lib/libpmc/libpmc.c
+++ b/lib/libpmc/libpmc.c
@@ -22,11 +22,10 @@
  * 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.
+ *
+ * $FreeBSD: src/lib/libpmc/libpmc.c,v 1.28 2010/09/05 13:31:14 fabient Exp $
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libpmc/libpmc.c,v 1.28 2010/09/05 13:31:14 fabient Exp $");
-
 #include <sys/types.h>
 #include <sys/module.h>
 #include <sys/pmc.h>
@@ -49,7 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libpmc/libpmc.c,v 1.28 2010/09/05 13:31:14 fabient E
 static int k7_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
     struct pmc_op_pmcallocate *_pmc_config);
 #endif
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__x86_64__) || defined(__i386__)
 static int iaf_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
     struct pmc_op_pmcallocate *_pmc_config);
 static int iap_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
@@ -69,7 +68,7 @@ static int p5_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
 static int p6_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
     struct pmc_op_pmcallocate *_pmc_config);
 #endif
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__x86_64__) || defined(__i386__)
 static int tsc_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
     struct pmc_op_pmcallocate *_pmc_config);
 #endif
@@ -230,7 +229,7 @@ static const struct pmc_class_descr NAME##_class_table_descr =	\
 		.pm_evc_allocate_pmc = ALLOCATOR##_allocate_pmc	\
 	}
 
-#if	defined(__i386__) || defined(__amd64__)
+#if	defined(__i386__) || defined(__x86_64__)
 PMC_CLASS_TABLE_DESC(iaf, IAF, iaf, iaf);
 PMC_CLASS_TABLE_DESC(atom, IAP, atom, iap);
 PMC_CLASS_TABLE_DESC(core, IAP, core, iap);
@@ -244,7 +243,7 @@ PMC_CLASS_TABLE_DESC(westmereuc, UCP, westmereuc, ucp);
 #if	defined(__i386__)
 PMC_CLASS_TABLE_DESC(k7, K7, k7, k7);
 #endif
-#if	defined(__i386__) || defined(__amd64__)
+#if	defined(__i386__) || defined(__x86_64__)
 PMC_CLASS_TABLE_DESC(k8, K8, k8, k8);
 PMC_CLASS_TABLE_DESC(p4, P4, p4, p4);
 #endif
@@ -252,7 +251,7 @@ PMC_CLASS_TABLE_DESC(p4, P4, p4, p4);
 PMC_CLASS_TABLE_DESC(p5, P5, p5, p5);
 PMC_CLASS_TABLE_DESC(p6, P6, p6, p6);
 #endif
-#if	defined(__i386__) || defined(__amd64__)
+#if	defined(__i386__) || defined(__x86_64__)
 PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc);
 #endif
 #if	defined(__XSCALE__)
@@ -329,7 +328,7 @@ struct pmc_masks {
 #define	PMCMASK(N,V)	{ .pm_name = #N, .pm_value = (V) }
 #define	NULLMASK	{ .pm_name = NULL }
 
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__x86_64__) || defined(__i386__)
 static int
 pmc_parse_mask(const struct pmc_masks *pmask, char *p, uint32_t *evmask)
 {
@@ -468,7 +467,7 @@ k7_allocate_pmc(enum pmc_event pe, char *ctrspec,
 
 #endif
 
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__x86_64__) || defined(__i386__)
 
 /*
  * Intel Core (Family 6, Model E) PMCs.
@@ -1177,7 +1176,7 @@ k8_allocate_pmc(enum pmc_event pe, char *ctrspec,
 
 #endif
 
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__x86_64__) || defined(__i386__)
 
 /*
  * Intel P4 PMCs
@@ -2132,7 +2131,7 @@ p6_allocate_pmc(enum pmc_event pe, char *ctrspec,
 
 #endif
 
-#if	defined(__i386__) || defined(__amd64__)
+#if	defined(__i386__) || defined(__x86_64__)
 static int
 tsc_allocate_pmc(enum pmc_event pe, char *ctrspec,
     struct pmc_op_pmcallocate *pmc_config)
@@ -2635,7 +2634,7 @@ pmc_init(void)
 	uint32_t abi_version;
 	struct module_stat pmc_modstat;
 	struct pmc_op_getcpuinfo op_cpu_info;
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__x86_64__) || defined(__i386__)
 	int cpu_has_iaf_counters;
 	unsigned int t;
 #endif
@@ -2687,7 +2686,7 @@ pmc_init(void)
 	 * Fill in the class table.
 	 */
 	n = 0;
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__x86_64__) || defined(__i386__)
 	pmc_class_table[n++] = &tsc_class_table_descr;
 
 	/*
@@ -2735,7 +2734,7 @@ pmc_init(void)
 		pmc_class_table[n] = &p6_class_table_descr;
 		break;
 #endif
-#if defined(__amd64__) || defined(__i386__)
+#if defined(__x86_64__) || defined(__i386__)
 	case PMC_CPU_AMD_K8:
 		PMC_MDEP_INIT(k8);
 		pmc_class_table[n] = &k8_class_table_descr;
diff --git a/lib/libpmc/pmclog.c b/lib/libpmc/pmclog.c
index 617ab89..ad58497 100644
--- a/lib/libpmc/pmclog.c
+++ b/lib/libpmc/pmclog.c
@@ -26,11 +26,10 @@
  * 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.
+ *
+ * $FreeBSD: src/lib/libpmc/pmclog.c,v 1.7 2010/06/05 23:00:02 fabient Exp $
  */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libpmc/pmclog.c,v 1.7 2010/06/05 23:00:02 fabient Exp $");
-
 #include <sys/param.h>
 #include <sys/pmc.h>
 #include <sys/pmclog.h>
-- 
1.7.0.5

