1 /*- 2 * This file is in the public domain. 3 * 4 * $FreeBSD$ 5 */ 6 7 #ifndef _MACHINE_PMC_MDEP_H_ 8 #define _MACHINE_PMC_MDEP_H_ 9 10 #define PMC_MDEP_CLASS_INDEX_POWERPC 1 11 12 union pmc_md_op_pmcallocate { 13 uint64_t __pad[4]; 14 }; 15 16 /* Logging */ 17 #ifdef __powerpc64__ 18 #define PMCLOG_READADDR PMCLOG_READ64 19 #define PMCLOG_EMITADDR PMCLOG_EMIT64 20 #else 21 #define PMCLOG_READADDR PMCLOG_READ32 22 #define PMCLOG_EMITADDR PMCLOG_EMIT32 23 #endif 24 25 #define mtpmr(reg, val) \ 26 __asm __volatile("mtpmr %0,%1" : : "K"(reg), "r"(val)) 27 #define mfpmr(reg) \ 28 ( { register_t val; \ 29 __asm __volatile("mfpmr %0,%1" : "=r"(val) : "K"(reg)); \ 30 val; } ) 31 32 #define PMR_PMC0 16 33 #define PMR_PMC1 17 34 #define PMR_PMC2 18 35 #define PMR_PMC3 19 36 #define PMR_PMLCa0 144 37 #define PMLCax_FC 0x80000000 38 #define PMLCax_FCS 0x40000000 39 #define PMLCax_FCU 0x20000000 40 #define PMLCax_FCM1 0x10000000 41 #define PMLCax_FCM0 0x08000000 42 #define PMLCax_CE 0x04000000 43 #define PMLCax_EVENT(x) ((x) << 16) 44 #define PMLCax_FCGS1 0x00000002 45 #define PMLCax_FCGS0 0x00000001 46 #define PMR_PMLCa1 145 47 #define PMR_PMLCa2 146 48 #define PMR_PMLCa3 147 49 #define PMR_PMLCb0 272 50 #define PMLCbx_TRIGONCTL(x) ((x) << 28) 51 #define PMLCbx_TRIGOFFCTL(x) ((x) << 24) 52 #define PMLCbx_PMCC 0x00800000 53 #define PMLCbx_PMP(x) ((x) << 13) 54 #define PMLCbx_TREHMUL(x) ((x) << 8) 55 #define PMLCbx_TRESHOLD(x) ((x) << 0) 56 #define PMR_PMLCb1 273 57 #define PMR_PMLCb2 274 58 #define PMR_PMLCb3 275 59 #define PMR_PMGC0 400 60 #define PMGC_FAC 0x80000000 61 #define PMGC_PMIE 0x40000000 62 #define PMGC_FCECE 0x20000000 63 #define PMGC_TBSEL(x) ((x) << 11) 64 #define PMGC_TBEE 0x00000100 65 #define PMR_UPMC0 0 66 #define PMR_UPMC1 1 67 #define PMR_UPMC2 2 68 #define PMR_UPMC3 3 69 #define PMR_UPMLCa0 128 70 #define PMR_UPMLCa1 129 71 #define PMR_UPMLCa2 130 72 #define PMR_UPMLCa3 131 73 #define PMR_UPMLCb0 256 74 #define PMR_UPMLCb1 257 75 #define PMR_UPMLCb2 258 76 #define PMR_UPMLCb3 259 77 #define PMR_UPMGC0 384 78 79 #if _KERNEL 80 81 struct pmc_md_powerpc_pmc { 82 uint32_t pm_powerpc_evsel; 83 }; 84 85 union pmc_md_pmc { 86 struct pmc_md_powerpc_pmc pm_powerpc; 87 }; 88 89 #define PMC_TRAPFRAME_TO_PC(TF) ((TF)->srr0) 90 #define PMC_TRAPFRAME_TO_FP(TF) ((TF)->fixreg[1]) 91 #define PMC_TRAPFRAME_TO_SP(TF) (0) 92 93 #endif 94 95 #endif /* !_MACHINE_PMC_MDEP_H_ */ 96