Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Oct 2009 11:46:01 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r197708 - in user/rpaulo/armpmc: arm/include dev/hwpmc
Message-ID:  <200910021146.n92Bk1XP000173@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Fri Oct  2 11:46:01 2009
New Revision: 197708
URL: http://svn.freebsd.org/changeset/base/197708

Log:
  Build fixes.

Modified:
  user/rpaulo/armpmc/arm/include/pmc_mdep.h
  user/rpaulo/armpmc/dev/hwpmc/hwpmc_arm.c
  user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.c
  user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.h

Modified: user/rpaulo/armpmc/arm/include/pmc_mdep.h
==============================================================================
--- user/rpaulo/armpmc/arm/include/pmc_mdep.h	Fri Oct  2 11:17:51 2009	(r197707)
+++ user/rpaulo/armpmc/arm/include/pmc_mdep.h	Fri Oct  2 11:46:01 2009	(r197708)
@@ -1,5 +1,27 @@
 /*-
- * This file is in the public domain.
+ * Copyright (c) 2009 Rui Paulo <rpaulo@FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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 AUTHOR ``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 AUTHOR 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.
  *
  * $FreeBSD$
  */
@@ -7,6 +29,13 @@
 #ifndef _MACHINE_PMC_MDEP_H_
 #define	_MACHINE_PMC_MDEP_H_
 
+/*
+ * On the ARM platform we support the following PMCs.
+ *
+ * XSCALE	Intel XScale processors
+ */
+#include <dev/hwpmc/hwpmc_xscale.h>
+
 union pmc_md_op_pmcallocate {
 	uint64_t	__pad[4];
 };

Modified: user/rpaulo/armpmc/dev/hwpmc/hwpmc_arm.c
==============================================================================
--- user/rpaulo/armpmc/dev/hwpmc/hwpmc_arm.c	Fri Oct  2 11:17:51 2009	(r197707)
+++ user/rpaulo/armpmc/dev/hwpmc/hwpmc_arm.c	Fri Oct  2 11:46:01 2009	(r197708)
@@ -30,8 +30,10 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/pmc.h>
+#include <sys/systm.h>
 
 #include <machine/pmc_mdep.h>
+#include <machine/md_var.h>
 
 struct pmc_mdep *
 pmc_md_initialize()
@@ -46,7 +48,7 @@ void
 pmc_md_finalize(struct pmc_mdep *md)
 {
 	if (cpu_class == CPU_CLASS_XSCALE)
-		return pmc_xscale_finalize();
+		pmc_xscale_finalize(md);
 	else
 		KASSERT(0, ("[arm,%d] Unknown CPU Class 0x%x", __LINE__,
 		    cpu_class));

Modified: user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.c
==============================================================================
--- user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.c	Fri Oct  2 11:17:51 2009	(r197707)
+++ user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.c	Fri Oct  2 11:46:01 2009	(r197708)
@@ -80,11 +80,37 @@ xscale_describe(int cpu, int ri, struct 
 struct pmc_mdep *
 pmc_xscale_initialize()
 {
-	return NULL;
+	struct pmc_mdep *pmc_mdep;
+
+	pmc_mdep = malloc(sizeof(struct pmc_mdep) + sizeof(struct pmc_classdep),
+	    M_PMC, M_WAITOK|M_ZERO);
+	pmc_mdep->pmd_cputype = PMC_CPU_INTEL_XSCALE;
+	pmc_mdep->pmd_nclass = 1;
+
+	pcd = &pmc_mdep->pmd_classdep[0];
+	pcd->pcd_caps = XSCALE_PMC_CAPS;
+	pcd->pcd_num = XSCALE_NPMCS;
+	pcd->pcd_ri = pmc_mdep->pmd_npmc;
+	pcd->pcd_width = 48; /* XXX */
+
+	pcd->pcd_allocate_pmc = xscale_allocate_pmc;
+	pcd->pcd_config_pmc = xscale_config_pmc;
+	pcd->pcd_describe = xscale_describe;
+	pcd->pcd_get_config = xscale_get_config;
+	pcd->pcd_read_pmc = xscale_read_pmc;
+	pcd->pcd_release_pmc = xscale_release_pmc;
+	pcd->pcd_start_pmc = xscale_start_pmc;
+	pcd->pcd_stop_pmc = xscale_stop_pmc;
+	pcd->pcd_write_pmc = xscale_write_pmc;
+
+	pmc_mdep->pmd_intr = xscale_intr;
+	pmc_mdep->pmd_switch_in = xscale_switch_in;
+	pmc_mdep->pmd_switch_out = xscale_switch_out;
+
+	return (pmc_mdep);
 }
 
 void
 pmc_xscale_finalize(struct pmc_mdep *md)
 {
-	(void) md;
 }

Modified: user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.h
==============================================================================
--- user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.h	Fri Oct  2 11:17:51 2009	(r197707)
+++ user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.h	Fri Oct  2 11:46:01 2009	(r197708)
@@ -37,5 +37,9 @@
 				 PMC_CAP_WRITE | PMC_CAP_INVERT |	\
 				 PMC_CAP_QUALIFIER)
 
-
+#ifdef _KERNEL
+/* MD extension for 'struct pmc' */
+struct pmc_md_xscale_pmc {
+};
+#endif /* _KERNEL */
 #endif /* _DEV_HWPMC_XSCALE_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910021146.n92Bk1XP000173>