Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hwpmc/hwpmc_soft.c
| Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | soft_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 | ||||
| soft_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) | soft_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) | ||||
| { | { | ||||
| int error; | |||||
| size_t copied; | |||||
| const struct soft_descr *pd; | const struct soft_descr *pd; | ||||
| struct pmc_hw *phw; | struct pmc_hw *phw; | ||||
| KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | ||||
| ("[soft,%d] illegal CPU %d", __LINE__, cpu)); | ("[soft,%d] illegal CPU %d", __LINE__, cpu)); | ||||
| KASSERT(ri >= 0 && ri < SOFT_NPMCS, | KASSERT(ri >= 0 && ri < SOFT_NPMCS, | ||||
| ("[soft,%d] illegal row-index %d", __LINE__, ri)); | ("[soft,%d] illegal row-index %d", __LINE__, ri)); | ||||
| phw = &soft_pcpu[cpu]->soft_hw[ri]; | phw = &soft_pcpu[cpu]->soft_hw[ri]; | ||||
| pd = &soft_pmcdesc[ri]; | pd = &soft_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 325 Lines • Show Last 20 Lines | |||||