svn commit: r197548 - in user/rpaulo/armpmc: arm/include dev/hwpmc
Rui Paulo
rpaulo at FreeBSD.org
Sun Sep 27 22:49:30 UTC 2009
Author: rpaulo
Date: Sun Sep 27 22:49:29 2009
New Revision: 197548
URL: http://svn.freebsd.org/changeset/base/197548
Log:
Add initial changes. Cooked mostly during EuroBSDCon 09.
Added:
user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.c (contents, props changed)
Modified:
user/rpaulo/armpmc/arm/include/pmc_mdep.h
user/rpaulo/armpmc/dev/hwpmc/hwpmc_arm.c
Modified: user/rpaulo/armpmc/arm/include/pmc_mdep.h
==============================================================================
--- user/rpaulo/armpmc/arm/include/pmc_mdep.h Sun Sep 27 22:45:15 2009 (r197547)
+++ user/rpaulo/armpmc/arm/include/pmc_mdep.h Sun Sep 27 22:49:29 2009 (r197548)
@@ -15,14 +15,20 @@ union pmc_md_op_pmcallocate {
#define PMCLOG_READADDR PMCLOG_READ32
#define PMCLOG_EMITADDR PMCLOG_EMIT32
-#if _KERNEL
+#ifdef _KERNEL
union pmc_md_pmc {
+ struct pmc_md_xscale_pmc pm_xscale;
};
-#define PMC_TRAPFRAME_TO_PC(TF) (0) /* Stubs */
-#define PMC_TRAPFRAME_TO_FP(TF) (0)
-#define PMC_TRAPFRAME_TO_SP(TF) (0)
+#define PMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_pc)
+#define PMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_usr_lr)
+#define PMC_TRAPFRAME_TO_SP(TF) ((TF)->tf_usr_sp)
-#endif
+/*
+ * Prototypes
+ */
+struct pmc_mdep *pmc_xscale_initialize(void);
+void pmc_xscale_finalize(struct pmc_mdep *_md);
+#endif /* _KERNEL */
#endif /* !_MACHINE_PMC_MDEP_H_ */
Modified: user/rpaulo/armpmc/dev/hwpmc/hwpmc_arm.c
==============================================================================
--- user/rpaulo/armpmc/dev/hwpmc/hwpmc_arm.c Sun Sep 27 22:45:15 2009 (r197547)
+++ user/rpaulo/armpmc/dev/hwpmc/hwpmc_arm.c Sun Sep 27 22:49:29 2009 (r197548)
@@ -36,13 +36,20 @@ __FBSDID("$FreeBSD$");
struct pmc_mdep *
pmc_md_initialize()
{
- return NULL;
+ if (cpu_class == CPU_CLASS_XSCALE)
+ return pmc_xscale_initialize();
+ else
+ return NULL;
}
void
pmc_md_finalize(struct pmc_mdep *md)
{
- (void) md;
+ if (cpu_class == CPU_CLASS_XSCALE)
+ return pmc_xscale_finalize();
+ else
+ KASSERT(0, ("[arm,%d] Unknown CPU Class 0x%x", __LINE__,
+ cpu_class));
}
int
Added: user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/rpaulo/armpmc/dev/hwpmc/hwpmc_xscale.c Sun Sep 27 22:49:29 2009 (r197548)
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2009 Rui Paulo <rpaulo at 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 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 AUTHOR 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>
+__FBSDID("$FreeBSD$");
+
+/* Support for the Intel XScale network processors */
+
+#include <sys/param.h>
+#include <sys/pmc.h>
+
+#include <machine/pmc_mdep.h>
+
+struct xscale_event_code_map {
+ enum pmc_event pe_ev;
+ uint8_t pe_code;
+ uint8_t pe_mask;
+};
+
+struct pmc_mdep *
+pmc_xscale_initialize()
+{
+ return NULL;
+}
+
+void
+pmc_xscale_finalize(struct pmc_mdep *md)
+{
+ (void) md;
+}
More information about the svn-src-user
mailing list