From owner-svn-src-user@FreeBSD.ORG Sun Sep 27 22:49:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0746B1065670; Sun, 27 Sep 2009 22:49:30 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9A2F8FC17; Sun, 27 Sep 2009 22:49:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8RMnTeG036837; Sun, 27 Sep 2009 22:49:29 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8RMnT9I036833; Sun, 27 Sep 2009 22:49:29 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200909272249.n8RMnT9I036833@svn.freebsd.org> From: Rui Paulo Date: Sun, 27 Sep 2009 22:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197548 - in user/rpaulo/armpmc: arm/include dev/hwpmc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2009 22:49:30 -0000 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 + * 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 +__FBSDID("$FreeBSD$"); + +/* Support for the Intel XScale network processors */ + +#include +#include + +#include + +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; +}