Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hwpmc/hwpmc_amd.c
Show First 20 Lines • Show All 1,067 Lines • ▼ Show 20 Lines | |||||
struct pmc_mdep * | struct pmc_mdep * | ||||
pmc_amd_initialize(void) | pmc_amd_initialize(void) | ||||
{ | { | ||||
int classindex, error, i, ncpus; | int classindex, error, i, ncpus; | ||||
struct pmc_classdep *pcd; | struct pmc_classdep *pcd; | ||||
enum pmc_cputype cputype; | enum pmc_cputype cputype; | ||||
struct pmc_mdep *pmc_mdep; | struct pmc_mdep *pmc_mdep; | ||||
enum pmc_class class; | enum pmc_class class; | ||||
int model, stepping; | int family, model, stepping; | ||||
char *name; | char *name; | ||||
/* | /* | ||||
* The presence of hardware performance counters on the AMD | * The presence of hardware performance counters on the AMD | ||||
* Athlon, Duron or later processors, is _not_ indicated by | * Athlon, Duron or later processors, is _not_ indicated by | ||||
* any of the processor feature flags set by the 'CPUID' | * any of the processor feature flags set by the 'CPUID' | ||||
* instruction, so we only check the 'instruction family' | * instruction, so we only check the 'instruction family' | ||||
* field returned by CPUID for instruction family >= 6. | * field returned by CPUID for instruction family >= 6. | ||||
*/ | */ | ||||
name = NULL; | name = NULL; | ||||
model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); | family = CPUID_TO_FAMILY(cpu_id); | ||||
stepping = cpu_id & 0xF; | model = CPUID_TO_MODEL(cpu_id); | ||||
if (CPUID_TO_FAMILY(cpu_id) == 0x17) | stepping = CPUID_TO_STEPPING(cpu_id); | ||||
snprintf(pmc_cpuid, sizeof(pmc_cpuid), "AuthenticAMD-%d-%02X-%X", | |||||
CPUID_TO_FAMILY(cpu_id), model, stepping); | if (family == 0x18) | ||||
if (CPUID_TO_FAMILY(cpu_id) == 0x18) | |||||
snprintf(pmc_cpuid, sizeof(pmc_cpuid), "HygonGenuine-%d-%02X-%X", | snprintf(pmc_cpuid, sizeof(pmc_cpuid), "HygonGenuine-%d-%02X-%X", | ||||
CPUID_TO_FAMILY(cpu_id), model, stepping); | family, model, stepping); | ||||
else | |||||
snprintf(pmc_cpuid, sizeof(pmc_cpuid), "AuthenticAMD-%d-%02X-%X", | |||||
family, model, stepping); | |||||
switch (cpu_id & 0xF00) { | switch (cpu_id & 0xF00) { | ||||
#if defined(__i386__) | #if defined(__i386__) | ||||
case 0x600: /* Athlon(tm) processor */ | case 0x600: /* Athlon(tm) processor */ | ||||
classindex = PMC_MDEP_CLASS_INDEX_K7; | classindex = PMC_MDEP_CLASS_INDEX_K7; | ||||
cputype = PMC_CPU_AMD_K7; | cputype = PMC_CPU_AMD_K7; | ||||
class = PMC_CLASS_K7; | class = PMC_CLASS_K7; | ||||
name = "K7"; | name = "K7"; | ||||
▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines |