Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hwpmc/hwpmc_powerpc.c
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
struct powerpc_cpu **powerpc_pcpu; | struct powerpc_cpu **powerpc_pcpu; | ||||
struct pmc_ppc_event *ppc_event_codes; | struct pmc_ppc_event *ppc_event_codes; | ||||
size_t ppc_event_codes_size; | size_t ppc_event_codes_size; | ||||
int ppc_event_first; | int ppc_event_first; | ||||
int ppc_event_last; | int ppc_event_last; | ||||
int ppc_max_pmcs; | int ppc_max_pmcs; | ||||
enum pmc_class ppc_class; | |||||
void (*powerpc_set_pmc)(int cpu, int ri, int config); | void (*powerpc_set_pmc)(int cpu, int ri, int config); | ||||
pmc_value_t (*powerpc_pmcn_read)(unsigned int pmc); | pmc_value_t (*powerpc_pmcn_read)(unsigned int pmc); | ||||
void (*powerpc_pmcn_write)(unsigned int pmc, uint32_t val); | void (*powerpc_pmcn_write)(unsigned int pmc, uint32_t val); | ||||
void (*powerpc_resume_pmc)(bool ie); | void (*powerpc_resume_pmc)(bool ie); | ||||
int | int | ||||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | powerpc_allocate_pmc(int cpu, int ri, struct pmc *pm, | ||||
enum pmc_event pe; | enum pmc_event pe; | ||||
uint32_t caps, config = 0, counter = 0; | uint32_t caps, config = 0, counter = 0; | ||||
int i; | int i; | ||||
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), | ||||
("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); | ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); | ||||
KASSERT(ri >= 0 && ri < ppc_max_pmcs, | KASSERT(ri >= 0 && ri < ppc_max_pmcs, | ||||
("[powerpc,%d] illegal row index %d", __LINE__, ri)); | ("[powerpc,%d] illegal row index %d", __LINE__, ri)); | ||||
if (a->pm_class != ppc_class) | |||||
return (EINVAL); | |||||
caps = a->pm_caps; | caps = a->pm_caps; | ||||
pe = a->pm_ev; | pe = a->pm_ev; | ||||
if (pe < ppc_event_first || pe > ppc_event_last) | if (pe < ppc_event_first || pe > ppc_event_last) | ||||
return (EINVAL); | return (EINVAL); | ||||
▲ Show 20 Lines • Show All 431 Lines • Show Last 20 Lines |