Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hwpmc/hwpmc_tsc.c
| Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | tsc_config_pmc(int cpu, int ri, struct pmc *pm) | ||||
| phw->phw_pmc = pm; | phw->phw_pmc = pm; | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| static int | static int | ||||
| tsc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) | tsc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) | ||||
| { | { | ||||
| int error; | |||||
| size_t copied; | |||||
| const struct tsc_descr *pd; | const struct tsc_descr *pd; | ||||
| struct pmc_hw *phw; | struct pmc_hw *phw; | ||||
| KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | ||||
| ("[tsc,%d] illegal CPU %d", __LINE__, cpu)); | ("[tsc,%d] illegal CPU %d", __LINE__, cpu)); | ||||
| KASSERT(ri == 0, ("[tsc,%d] illegal row-index %d", __LINE__, ri)); | KASSERT(ri == 0, ("[tsc,%d] illegal row-index %d", __LINE__, ri)); | ||||
| phw = &tsc_pcpu[cpu]->tc_hw; | phw = &tsc_pcpu[cpu]->tc_hw; | ||||
| pd = &tsc_pmcdesc[ri]; | pd = &tsc_pmcdesc[ri]; | ||||
| if ((error = copystr(pd->pm_descr.pd_name, pi->pm_name, | strlcpy(pi->pm_name, pd->pm_descr.pd_name, PMC_NAME_MAX); | ||||
| PMC_NAME_MAX, &copied)) != 0) | |||||
| return (error); | |||||
| pi->pm_class = pd->pm_descr.pd_class; | pi->pm_class = pd->pm_descr.pd_class; | ||||
| if (phw->phw_state & PMC_PHW_FLAG_IS_ENABLED) { | if (phw->phw_state & PMC_PHW_FLAG_IS_ENABLED) { | ||||
| pi->pm_enabled = TRUE; | pi->pm_enabled = TRUE; | ||||
| *ppmc = phw->phw_pmc; | *ppmc = phw->phw_pmc; | ||||
| } else { | } else { | ||||
| pi->pm_enabled = FALSE; | pi->pm_enabled = FALSE; | ||||
| *ppmc = NULL; | *ppmc = NULL; | ||||
| ▲ Show 20 Lines • Show All 240 Lines • Show Last 20 Lines | |||||