xref: /freebsd/sys/dev/hwpmc/hwpmc_arm.c (revision 0ce207d2afdd09f3d5791ecd066f190cf8c5a374)
1f263522aSJoseph Koshy /*-
2f263522aSJoseph Koshy  * Copyright (c) 2005, Joseph Koshy
3f263522aSJoseph Koshy  * All rights reserved.
4f263522aSJoseph Koshy  *
5f263522aSJoseph Koshy  * Redistribution and use in source and binary forms, with or without
6f263522aSJoseph Koshy  * modification, are permitted provided that the following conditions
7f263522aSJoseph Koshy  * are met:
8f263522aSJoseph Koshy  * 1. Redistributions of source code must retain the above copyright
9f263522aSJoseph Koshy  *    notice, this list of conditions and the following disclaimer.
10f263522aSJoseph Koshy  * 2. Redistributions in binary form must reproduce the above copyright
11f263522aSJoseph Koshy  *    notice, this list of conditions and the following disclaimer in the
12f263522aSJoseph Koshy  *    documentation and/or other materials provided with the distribution.
13f263522aSJoseph Koshy  *
14f263522aSJoseph Koshy  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15f263522aSJoseph Koshy  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16f263522aSJoseph Koshy  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17f263522aSJoseph Koshy  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18f263522aSJoseph Koshy  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19f263522aSJoseph Koshy  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20f263522aSJoseph Koshy  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21f263522aSJoseph Koshy  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22f263522aSJoseph Koshy  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23f263522aSJoseph Koshy  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24f263522aSJoseph Koshy  * SUCH DAMAGE.
25f263522aSJoseph Koshy  *
26f263522aSJoseph Koshy  */
27f263522aSJoseph Koshy 
28f263522aSJoseph Koshy #include <sys/cdefs.h>
29f263522aSJoseph Koshy __FBSDID("$FreeBSD$");
30f263522aSJoseph Koshy 
31f263522aSJoseph Koshy #include <sys/param.h>
32f263522aSJoseph Koshy #include <sys/pmc.h>
330ce207d2SRui Paulo #include <sys/systm.h>
34f263522aSJoseph Koshy 
35f263522aSJoseph Koshy #include <machine/pmc_mdep.h>
360ce207d2SRui Paulo #include <machine/md_var.h>
37f263522aSJoseph Koshy 
38f263522aSJoseph Koshy struct pmc_mdep *
39f263522aSJoseph Koshy pmc_md_initialize()
40f263522aSJoseph Koshy {
410ce207d2SRui Paulo 	if (cpu_class == CPU_CLASS_XSCALE)
420ce207d2SRui Paulo 		return pmc_xscale_initialize();
430ce207d2SRui Paulo 	else
44f263522aSJoseph Koshy 		return NULL;
45f263522aSJoseph Koshy }
469596916cSJoseph Koshy 
47c85e8dcfSJoseph Koshy void
48c85e8dcfSJoseph Koshy pmc_md_finalize(struct pmc_mdep *md)
49c85e8dcfSJoseph Koshy {
500ce207d2SRui Paulo 	if (cpu_class == CPU_CLASS_XSCALE)
510ce207d2SRui Paulo 		pmc_xscale_finalize(md);
520ce207d2SRui Paulo 	else
530ce207d2SRui Paulo 		KASSERT(0, ("[arm,%d] Unknown CPU Class 0x%x", __LINE__,
540ce207d2SRui Paulo 		    cpu_class));
55c85e8dcfSJoseph Koshy }
56c85e8dcfSJoseph Koshy 
579596916cSJoseph Koshy int
589596916cSJoseph Koshy pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples,
599596916cSJoseph Koshy     struct trapframe *tf)
609596916cSJoseph Koshy {
619596916cSJoseph Koshy 	(void) cc;
629596916cSJoseph Koshy 	(void) maxsamples;
639596916cSJoseph Koshy 	(void) tf;
649596916cSJoseph Koshy 	return (0);
659596916cSJoseph Koshy }
669596916cSJoseph Koshy 
679596916cSJoseph Koshy int
689596916cSJoseph Koshy pmc_save_user_callchain(uintptr_t *cc, int maxsamples,
699596916cSJoseph Koshy     struct trapframe *tf)
709596916cSJoseph Koshy {
719596916cSJoseph Koshy 	(void) cc;
729596916cSJoseph Koshy 	(void) maxsamples;
739596916cSJoseph Koshy 	(void) tf;
749596916cSJoseph Koshy 	return (0);
759596916cSJoseph Koshy }
76