Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hwpmc/hwpmc_dmc620.c
| Show First 20 Lines • Show All 448 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* | /* | ||||
| * describe a PMC | * describe a PMC | ||||
| */ | */ | ||||
| CLASSDEP_FN4(dmc620_describe, int, cpu, int, ri, struct pmc_info *, pi, | CLASSDEP_FN4(dmc620_describe, int, cpu, int, ri, struct pmc_info *, pi, | ||||
| struct pmc **, ppmc) | struct pmc **, ppmc) | ||||
| { | { | ||||
| struct pmc_descr *pd; | |||||
| struct pmc_hw *phw; | struct pmc_hw *phw; | ||||
| size_t copied; | |||||
| int error; | |||||
| KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | ||||
| ("[dmc620,%d] illegal CPU %d", __LINE__, cpu)); | ("[dmc620,%d] illegal CPU %d", __LINE__, cpu)); | ||||
| KASSERT(ri >= 0, ("[dmc620,%d] row-index %d out of range", __LINE__, | KASSERT(ri >= 0, ("[dmc620,%d] row-index %d out of range", __LINE__, | ||||
| ri)); | ri)); | ||||
| phw = dmc620desc(class, cpu, ri)->pd_phw; | phw = dmc620desc(class, cpu, ri)->pd_phw; | ||||
| pd = &dmc620desc(class, cpu, ri)->pd_descr; | |||||
| if ((error = copystr(dmc620desc(class, cpu, ri)->pd_descr.pd_name, | strlcpy(pi->pm_name, pd->pd_name, PMC_NAME_MAX); | ||||
| pi->pm_name, PMC_NAME_MAX, &copied)) != 0) | pi->pm_class = pd->pd_class; | ||||
| return (error); | |||||
| pi->pm_class = dmc620desc(class, cpu, ri)->pd_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 261 Lines • Show Last 20 Lines | |||||