The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/osfmk/ppc/hw_perfmon.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
    7  * 
    8  * This file contains Original Code and/or Modifications of Original Code
    9  * as defined in and that are subject to the Apple Public Source License
   10  * Version 2.0 (the 'License'). You may not use this file except in
   11  * compliance with the License. Please obtain a copy of the License at
   12  * http://www.opensource.apple.com/apsl/ and read it before using this
   13  * file.
   14  * 
   15  * The Original Code and all software distributed under the License are
   16  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   17  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   18  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   19  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   20  * Please see the License for the specific language governing rights and
   21  * limitations under the License.
   22  * 
   23  * @APPLE_LICENSE_HEADER_END@
   24  */
   25 #ifndef _HW_PERFMON_H_
   26 #define _HW_PERFMON_H_
   27 
   28 #ifndef __ppc__
   29 #error This file is only useful on PowerPC.
   30 #endif
   31 
   32 #define MAX_CPUPMC_COUNT  8
   33 
   34 #define PMC_1    0
   35 #define PMC_2    1
   36 #define PMC_3    2
   37 #define PMC_4    3
   38 #define PMC_5    4
   39 #define PMC_6    5
   40 #define PMC_7    6
   41 #define PMC_8    7
   42 
   43 /* these actions can be combined and simultaneously performed with a single call to perfmon_control() */
   44 typedef enum {
   45         PPC_PERFMON_CLEAR_COUNTERS =   0x0002,
   46         PPC_PERFMON_START_COUNTERS =   0x0004,
   47         PPC_PERFMON_STOP_COUNTERS  =   0x0008,
   48         PPC_PERFMON_READ_COUNTERS  =   0x0010,
   49         PPC_PERFMON_WRITE_COUNTERS =   0x0020
   50 } perfmon_multi_action_t;
   51 
   52 /* these actions can not be combined and each requires a separate call to perfmon_control() */
   53 typedef enum {
   54         PPC_PERFMON_ENABLE =           0x00010000,
   55         PPC_PERFMON_DISABLE =          0x00020000,
   56         PPC_PERFMON_SET_EVENT =        0x00030000,
   57         PPC_PERFMON_SET_THRESHOLD =    0x00040000,
   58         PPC_PERFMON_SET_TBSEL =        0x00050000,
   59         PPC_PERFMON_SET_EVENT_FUNC =   0x00060000,
   60         PPC_PERFMON_ENABLE_PMI_BRKPT = 0x00070000
   61 } perfmon_single_action_t;
   62 
   63 /* used to select byte lane and speculative events (currently 970 only) */
   64 typedef enum {                        /* SPECSEL[0:1]  TD_CP_DBGxSEL[0:1]  TTM3SEL[0:1]  TTM1SEL[0:1]  TTM0SEL[0:1] */
   65         PPC_PERFMON_FUNC_FPU =         0,   /*           00                  00            00            00            00 */
   66         PPC_PERFMON_FUNC_ISU =         1,   /*           00                  00            00            00            01 */
   67         PPC_PERFMON_FUNC_IFU =         2,   /*           00                  00            00            00            10 */
   68         PPC_PERFMON_FUNC_VMX =         3,   /*           00                  00            00            00            11 */
   69         PPC_PERFMON_FUNC_IDU =        64,   /*           00                  01            00            00            00 */
   70         PPC_PERFMON_FUNC_GPS =        76,   /*           00                  01            00            11            00 */
   71         PPC_PERFMON_FUNC_LSU0 =      128,   /*           00                  10            00            00            00 */
   72         PPC_PERFMON_FUNC_LSU1A =     192,   /*           00                  11            00            00            00 */
   73         PPC_PERFMON_FUNC_LSU1B =     240,   /*           00                  11            11            00            00 */
   74         PPC_PERFMON_FUNC_SPECA =     256,   /*           01                  00            00            00            00 */
   75         PPC_PERFMON_FUNC_SPECB =     512,   /*           10                  00            00            00            00 */
   76         PPC_PERFMON_FUNC_SPECC =     768,   /*           11                  00            00            00            00 */
   77 } perfmon_functional_unit_t;
   78 
   79 #ifdef MACH_KERNEL_PRIVATE
   80 int perfmon_acquire_facility(task_t task);
   81 int perfmon_release_facility(task_t task);
   82 
   83 extern int perfmon_disable(thread_act_t thr_act);
   84 extern int perfmon_init(void);
   85 extern int perfmon_control(struct savearea *save);
   86 extern int perfmon_handle_pmi(struct savearea *ssp);
   87 
   88 /* perfmonFlags */
   89 #define PERFMONFLAG_BREAKPOINT_FOR_PMI     0x1
   90 
   91 #endif /* MACH_KERNEL_PRIVATE */
   92 
   93 /* 
   94  * From user space:
   95  * 
   96  * int perfmon_control(thread_t thread, perfmon_action_t action, int pmc, u_int32_t val, u_int64_t *pmcs);
   97  * 
   98  * r3: thread
   99  * r4: action
  100  * r5: pmc
  101  * r6: event/threshold/tbsel/count
  102  * r7: pointer to space for PMC counts: uint64_t[MAX_CPUPMC_COUNT]
  103  *
  104  * perfmon_control(thread, PPC_PERFMON_CLEAR_COUNTERS, 0, 0, NULL);
  105  * perfmon_control(thread, PPC_PERFMON_START_COUNTERS, 0, 0, NULL);
  106  * perfmon_control(thread, PPC_PERFMON_STOP_COUNTERS, 0, 0, NULL);
  107  * perfmon_control(thread, PPC_PERFMON_READ_COUNTERS, 0, 0, uint64_t *pmcs);
  108  * perfmon_control(thread, PPC_PERFMON_WRITE_COUNTERS, 0, 0, uint64_t *pmcs);
  109  * perfmon_control(thread, PPC_PERFMON_ENABLE, 0, 0, NULL);
  110  * perfmon_control(thread, PPC_PERFMON_DISABLE, 0, 0, NULL);
  111  * perfmon_control(thread, PPC_PERFMON_SET_EVENT, int pmc, int event, NULL);
  112  * perfmon_control(thread, PPC_PERFMON_SET_THRESHOLD, 0, int threshold, NULL);
  113  * perfmon_control(thread, PPC_PERFMON_SET_TBSEL, 0, int tbsel, NULL);
  114  * perfmon_control(thread, PPC_PERFMON_SET_EVENT_FUNC, 0, perfmon_functional_unit_t func, NULL);
  115  * perfmon_control(thread, PPC_PERFMON_ENABLE_PMI_BRKPT, 0, boolean_t enable, NULL);
  116  *
  117  */
  118 
  119 #endif /* _HW_PERFMON_H_ */

Cache object: 367ef88d941c8c57fb202e3ab930869b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.