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