Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hwpmc/hwpmc_amd.c
| Show First 20 Lines • Show All 1,167 Lines • ▼ Show 20 Lines | |||||
| /* | /* | ||||
| * Finalization code for AMD CPUs. | * Finalization code for AMD CPUs. | ||||
| */ | */ | ||||
| void | void | ||||
| pmc_amd_finalize(struct pmc_mdep *md) | pmc_amd_finalize(struct pmc_mdep *md) | ||||
| { | { | ||||
| #if defined(INVARIANTS) | PMCDBG0(MDP, INI, 1, "amd-finalize"); | ||||
| int classindex, i, ncpus, pmcclass; | |||||
| #endif | |||||
| pmc_tsc_finalize(md); | pmc_tsc_finalize(md); | ||||
| KASSERT(amd_pcpu != NULL, ("[amd,%d] NULL per-cpu array pointer", | for (int i = 0; i < pmc_cpu_max(); i++) | ||||
| __LINE__)); | KASSERT(amd_pcpu[i] == NULL, | ||||
| ("[amd,%d] non-null pcpu cpu %d", __LINE__, i)); | |||||
| #if defined(INVARIANTS) | |||||
| switch (md->pmd_cputype) { | |||||
| #if defined(__i386__) | |||||
| case PMC_CPU_AMD_K7: | |||||
| classindex = PMC_MDEP_CLASS_INDEX_K7; | |||||
| pmcclass = PMC_CLASS_K7; | |||||
| break; | |||||
| #endif | |||||
| default: | |||||
| classindex = PMC_MDEP_CLASS_INDEX_K8; | |||||
| pmcclass = PMC_CLASS_K8; | |||||
| } | |||||
| KASSERT(md->pmd_classdep[classindex].pcd_class == pmcclass, | |||||
| ("[amd,%d] pmc class mismatch", __LINE__)); | |||||
| ncpus = pmc_cpu_max(); | |||||
| for (i = 0; i < ncpus; i++) | |||||
| KASSERT(amd_pcpu[i] == NULL, ("[amd,%d] non-null pcpu", | |||||
| __LINE__)); | |||||
| #endif | |||||
| free(amd_pcpu, M_PMC); | free(amd_pcpu, M_PMC); | ||||
| amd_pcpu = NULL; | amd_pcpu = NULL; | ||||
| } | } | ||||