Lines Matching +full:pm +full:- +full:api

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
60 * Per-CPU data structure for TSCs.
70 tsc_allocate_pmc(int cpu __diagused, int ri __diagused, struct pmc *pm __unused, in tsc_allocate_pmc()
79 if (a->pm_class != PMC_CLASS_TSC) in tsc_allocate_pmc()
82 if (a->pm_ev != PMC_EV_TSC_TSC || in tsc_allocate_pmc()
83 a->pm_mode != PMC_MODE_SC) in tsc_allocate_pmc()
90 tsc_config_pmc(int cpu, int ri, struct pmc *pm) in tsc_config_pmc() argument
94 PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); in tsc_config_pmc()
98 KASSERT(ri == 0, ("[tsc,%d] illegal row-index %d", __LINE__, ri)); in tsc_config_pmc()
100 phw = &tsc_pcpu[cpu]->tc_hw; in tsc_config_pmc()
102 KASSERT(pm == NULL || phw->phw_pmc == NULL, in tsc_config_pmc()
103 ("[tsc,%d] pm=%p phw->pm=%p hwpmc not unconfigured", __LINE__, in tsc_config_pmc()
104 pm, phw->phw_pmc)); in tsc_config_pmc()
106 phw->phw_pmc = pm; in tsc_config_pmc()
119 KASSERT(ri == 0, ("[tsc,%d] illegal row-index %d", __LINE__, ri)); in tsc_describe()
121 phw = &tsc_pcpu[cpu]->tc_hw; in tsc_describe()
124 strlcpy(pi->pm_name, pd->pm_descr.pd_name, sizeof(pi->pm_name)); in tsc_describe()
125 pi->pm_class = pd->pm_descr.pd_class; in tsc_describe()
127 if (phw->phw_state & PMC_PHW_FLAG_IS_ENABLED) { in tsc_describe()
128 pi->pm_enabled = TRUE; in tsc_describe()
129 *ppmc = phw->phw_pmc; in tsc_describe()
131 pi->pm_enabled = FALSE; in tsc_describe()
144 KASSERT(ri == 0, ("[tsc,%d] illegal row-index %d", __LINE__, ri)); in tsc_get_config()
146 *ppm = tsc_pcpu[cpu]->tc_hw.phw_pmc; in tsc_get_config()
176 ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_TSC].pcd_ri; in tsc_pcpu_fini()
179 pc->pc_hwpmcs[ri] = NULL; in tsc_pcpu_fini()
195 KASSERT(tsc_pcpu[cpu] == NULL, ("[tsc,%d] non-null per-cpu", in tsc_pcpu_init()
200 tsc_pc->tc_hw.phw_state = PMC_PHW_FLAG_IS_ENABLED | in tsc_pcpu_init()
206 ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_TSC].pcd_ri; in tsc_pcpu_init()
212 KASSERT(pc, ("[tsc,%d] null generic per-cpu", __LINE__)); in tsc_pcpu_init()
214 pc->pc_hwpmcs[ri] = &tsc_pc->tc_hw; in tsc_pcpu_init()
220 tsc_read_pmc(int cpu, int ri, struct pmc *pm, pmc_value_t *v) in tsc_read_pmc() argument
228 mode = PMC_TO_MODE(pm); in tsc_read_pmc()
233 PMCDBG1(MDP,REA,1,"tsc-read id=%d", ri); in tsc_read_pmc()
248 ("[tsc,%d] illegal row-index %d", __LINE__, ri)); in tsc_release_pmc()
250 phw = &tsc_pcpu[cpu]->tc_hw; in tsc_release_pmc()
252 KASSERT(phw->phw_pmc == NULL, in tsc_release_pmc()
253 ("[tsc,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); in tsc_release_pmc()
262 tsc_start_pmc(int cpu __diagused, int ri __diagused, struct pmc *pm __unused) in tsc_start_pmc()
267 KASSERT(ri == 0, ("[tsc,%d] illegal row-index %d", __LINE__, ri)); in tsc_start_pmc()
273 tsc_stop_pmc(int cpu __diagused, int ri __diagused, struct pmc *pm __unused) in tsc_stop_pmc()
278 KASSERT(ri == 0, ("[tsc,%d] illegal row-index %d", __LINE__, ri)); in tsc_stop_pmc()
284 tsc_write_pmc(int cpu __diagused, int ri __diagused, struct pmc *pm __unused, in tsc_write_pmc()
290 KASSERT(ri == 0, ("[tsc,%d] illegal row-index %d", __LINE__, ri)); in tsc_write_pmc()
295 * support writing changing TSC values through the HWPMC API. in tsc_write_pmc()
306 KASSERT(md->pmd_nclass >= 1, ("[tsc,%d] dubious md->nclass %d", in pmc_tsc_initialize()
307 __LINE__, md->pmd_nclass)); in pmc_tsc_initialize()
312 pcd = &md->pmd_classdep[PMC_MDEP_CLASS_INDEX_TSC]; in pmc_tsc_initialize()
314 pcd->pcd_caps = PMC_CAP_READ; in pmc_tsc_initialize()
315 pcd->pcd_class = PMC_CLASS_TSC; in pmc_tsc_initialize()
316 pcd->pcd_num = TSC_NPMCS; in pmc_tsc_initialize()
317 pcd->pcd_ri = md->pmd_npmc; in pmc_tsc_initialize()
318 pcd->pcd_width = 64; in pmc_tsc_initialize()
320 pcd->pcd_allocate_pmc = tsc_allocate_pmc; in pmc_tsc_initialize()
321 pcd->pcd_config_pmc = tsc_config_pmc; in pmc_tsc_initialize()
322 pcd->pcd_describe = tsc_describe; in pmc_tsc_initialize()
323 pcd->pcd_get_config = tsc_get_config; in pmc_tsc_initialize()
324 pcd->pcd_get_msr = tsc_get_msr; in pmc_tsc_initialize()
325 pcd->pcd_pcpu_init = tsc_pcpu_init; in pmc_tsc_initialize()
326 pcd->pcd_pcpu_fini = tsc_pcpu_fini; in pmc_tsc_initialize()
327 pcd->pcd_read_pmc = tsc_read_pmc; in pmc_tsc_initialize()
328 pcd->pcd_release_pmc = tsc_release_pmc; in pmc_tsc_initialize()
329 pcd->pcd_start_pmc = tsc_start_pmc; in pmc_tsc_initialize()
330 pcd->pcd_stop_pmc = tsc_stop_pmc; in pmc_tsc_initialize()
331 pcd->pcd_write_pmc = tsc_write_pmc; in pmc_tsc_initialize()
333 md->pmd_npmc += TSC_NPMCS; in pmc_tsc_initialize()
341 PMCDBG0(MDP, INI, 1, "tsc-finalize"); in pmc_tsc_finalize()
344 KASSERT(tsc_pcpu[i] == NULL, ("[tsc,%d] non-null pcpu cpu %d", in pmc_tsc_finalize()