Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hwpmc/hwpmc_powerpc.c
| Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| int | int | ||||
| powerpc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) | powerpc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc) | ||||
| { | { | ||||
| int error; | |||||
| struct pmc_hw *phw; | struct pmc_hw *phw; | ||||
| char powerpc_name[PMC_NAME_MAX]; | |||||
| KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | ||||
| ("[powerpc,%d], illegal CPU %d", __LINE__, cpu)); | ("[powerpc,%d], illegal CPU %d", __LINE__, cpu)); | ||||
| phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; | phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; | ||||
| snprintf(powerpc_name, sizeof(powerpc_name), "POWERPC-%d", ri); | |||||
| if ((error = copystr(powerpc_name, pi->pm_name, PMC_NAME_MAX, | snprintf(pi->pm_name, PMC_NAME_MAX, "POWERPC-%d", ri); | ||||
| NULL)) != 0) | |||||
| return error; | |||||
| pi->pm_class = powerpc_pcpu[cpu]->pc_class; | pi->pm_class = powerpc_pcpu[cpu]->pc_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 508 Lines • Show Last 20 Lines | |||||