Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hwpmc/hwpmc_soft.c
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | soft_allocate_pmc(int cpu, int ri, struct pmc *pm, | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
soft_config_pmc(int cpu, int ri, struct pmc *pm) | soft_config_pmc(int cpu, int ri, struct pmc *pm) | ||||
{ | { | ||||
struct pmc_hw *phw; | struct pmc_hw *phw; | ||||
PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); | PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); | ||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | ||||
("[soft,%d] illegal CPU value %d", __LINE__, cpu)); | ("[soft,%d] illegal CPU value %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]; | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | 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]; | ||||
pm = phw->phw_pmc; | pm = phw->phw_pmc; | ||||
KASSERT(pm != NULL, | KASSERT(pm != NULL, | ||||
("[soft,%d] no owner for PHW [cpu%d,pmc%d]", __LINE__, cpu, ri)); | ("[soft,%d] no owner for PHW [cpu%d,pmc%d]", __LINE__, cpu, ri)); | ||||
PMCDBG(MDP,REA,1,"soft-read id=%d", ri); | PMCDBG1(MDP,REA,1,"soft-read id=%d", ri); | ||||
*v = soft_pcpu[cpu]->soft_values[ri]; | *v = soft_pcpu[cpu]->soft_values[ri]; | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
soft_write_pmc(int cpu, int ri, pmc_value_t v) | soft_write_pmc(int cpu, int ri, pmc_value_t v) | ||||
{ | { | ||||
struct pmc *pm; | struct pmc *pm; | ||||
const struct soft_descr *pd; | const struct soft_descr *pd; | ||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | ||||
("[soft,%d] illegal cpu value %d", __LINE__, cpu)); | ("[soft,%d] illegal cpu value %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)); | ||||
pm = soft_pcpu[cpu]->soft_hw[ri].phw_pmc; | pm = soft_pcpu[cpu]->soft_hw[ri].phw_pmc; | ||||
pd = &soft_pmcdesc[ri]; | pd = &soft_pmcdesc[ri]; | ||||
KASSERT(pm, | KASSERT(pm, | ||||
("[soft,%d] cpu %d ri %d pmc not configured", __LINE__, cpu, ri)); | ("[soft,%d] cpu %d ri %d pmc not configured", __LINE__, cpu, ri)); | ||||
PMCDBG(MDP,WRI,1, "soft-write cpu=%d ri=%d v=%jx", cpu, ri, v); | PMCDBG3(MDP,WRI,1, "soft-write cpu=%d ri=%d v=%jx", cpu, ri, v); | ||||
soft_pcpu[cpu]->soft_values[ri] = v; | soft_pcpu[cpu]->soft_values[ri] = v; | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
soft_release_pmc(int cpu, int ri, struct pmc *pmc) | soft_release_pmc(int cpu, int ri, struct pmc *pmc) | ||||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |