FreeBSD/sys/dev/hwpmc/hwpmc_amd.c
/*
 * configure hardware pmc according to the configuration recorded in
 * pmc 'pm'.
 */
configure hardware pmc according to the configuration recorded in
pmc 'pm'.
configure hardware pmc according to the configuration recorded in pmc ' pm ' .
static int
amd_config_pmc(int cpu, int ri, struct pmc *pm)
{
	struct pmc_hw *phw;
	PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
	    ("[amd,%d] illegal CPU value %d", __LINE__, cpu));
	KASSERT(ri >= 0 && ri < AMD_NPMCS,
	    ("[amd,%d] illegal row-index %d", __LINE__, ri));
	phw = &amd_pcpu[cpu]->pc_amdpmcs[ri];
	KASSERT(pm == NULL || phw->phw_pmc == NULL,
	    ("[amd,%d] pm=%p phw->pm=%p hwpmc not unconfigured",
		__LINE__, pm, phw->phw_pmc));
	phw->phw_pmc = pm;
	return 0;
}
static int amd_config_pmc ( int cpu , int ri , struct pmc * pm ) { struct pmc_hw * phw ; PMCDBG3 ( MDP , CFG , 1 , " " , cpu , ri , pm ) ; KASSERT ( cpu >= 0 && cpu < pmc_cpu_max ( ) , ( " " , __LINE__ , cpu ) ) ; KASSERT ( ri >= 0 && ri < AMD_NPMCS , ( " " , __LINE__ , ri ) ) ; phw = & amd_pcpu [ cpu ] -> pc_amdpmcs [ ri ] ; KASSERT ( pm == NULL || phw -> phw_pmc == NULL , ( " " , __LINE__ , pm , phw -> phw_pmc ) ) ; phw -> phw_pmc = pm ; return 0 ; }
configure hardware pmc according to the configuration recorded in
 pmc 'pm'.
configure hardware pmc according to the configuration recorded in pmc ' pm ' .