cpu.c (c97ad5cd) cpu.c (5cff7825)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 2063 unchanged lines hidden (view full) ---

2072 kstat_named_t ci_state_begin;
2073 kstat_named_t ci_cpu_type;
2074 kstat_named_t ci_fpu_type;
2075 kstat_named_t ci_clock_MHz;
2076 kstat_named_t ci_chip_id;
2077 kstat_named_t ci_implementation;
2078 kstat_named_t ci_brandstr;
2079 kstat_named_t ci_core_id;
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 2063 unchanged lines hidden (view full) ---

2072 kstat_named_t ci_state_begin;
2073 kstat_named_t ci_cpu_type;
2074 kstat_named_t ci_fpu_type;
2075 kstat_named_t ci_clock_MHz;
2076 kstat_named_t ci_chip_id;
2077 kstat_named_t ci_implementation;
2078 kstat_named_t ci_brandstr;
2079 kstat_named_t ci_core_id;
2080 kstat_named_t ci_curr_clock_Hz;
2081 kstat_named_t ci_supp_freq_Hz;
2080#if defined(__sparcv9)
2081 kstat_named_t ci_device_ID;
2082 kstat_named_t ci_cpu_fru;
2083#endif
2084#if defined(__x86)
2085 kstat_named_t ci_vendorstr;
2086 kstat_named_t ci_family;
2087 kstat_named_t ci_model;
2088 kstat_named_t ci_step;
2089 kstat_named_t ci_clogid;
2090#endif
2091} cpu_info_template = {
2082#if defined(__sparcv9)
2083 kstat_named_t ci_device_ID;
2084 kstat_named_t ci_cpu_fru;
2085#endif
2086#if defined(__x86)
2087 kstat_named_t ci_vendorstr;
2088 kstat_named_t ci_family;
2089 kstat_named_t ci_model;
2090 kstat_named_t ci_step;
2091 kstat_named_t ci_clogid;
2092#endif
2093} cpu_info_template = {
2092 { "state", KSTAT_DATA_CHAR },
2093 { "state_begin", KSTAT_DATA_LONG },
2094 { "cpu_type", KSTAT_DATA_CHAR },
2095 { "fpu_type", KSTAT_DATA_CHAR },
2096 { "clock_MHz", KSTAT_DATA_LONG },
2097 { "chip_id", KSTAT_DATA_LONG },
2098 { "implementation", KSTAT_DATA_STRING },
2099 { "brand", KSTAT_DATA_STRING },
2100 { "core_id", KSTAT_DATA_LONG },
2094 { "state", KSTAT_DATA_CHAR },
2095 { "state_begin", KSTAT_DATA_LONG },
2096 { "cpu_type", KSTAT_DATA_CHAR },
2097 { "fpu_type", KSTAT_DATA_CHAR },
2098 { "clock_MHz", KSTAT_DATA_LONG },
2099 { "chip_id", KSTAT_DATA_LONG },
2100 { "implementation", KSTAT_DATA_STRING },
2101 { "brand", KSTAT_DATA_STRING },
2102 { "core_id", KSTAT_DATA_LONG },
2103 { "current_clock_Hz", KSTAT_DATA_UINT64 },
2104 { "supported_frequencies_Hz", KSTAT_DATA_STRING },
2101#if defined(__sparcv9)
2105#if defined(__sparcv9)
2102 { "device_ID", KSTAT_DATA_UINT64 },
2103 { "cpu_fru", KSTAT_DATA_STRING },
2106 { "device_ID", KSTAT_DATA_UINT64 },
2107 { "cpu_fru", KSTAT_DATA_STRING },
2104#endif
2105#if defined(__x86)
2108#endif
2109#if defined(__x86)
2106 { "vendor_id", KSTAT_DATA_STRING },
2107 { "family", KSTAT_DATA_INT32 },
2108 { "model", KSTAT_DATA_INT32 },
2109 { "stepping", KSTAT_DATA_INT32 },
2110 { "clog_id", KSTAT_DATA_INT32 },
2110 { "vendor_id", KSTAT_DATA_STRING },
2111 { "family", KSTAT_DATA_INT32 },
2112 { "model", KSTAT_DATA_INT32 },
2113 { "stepping", KSTAT_DATA_INT32 },
2114 { "clog_id", KSTAT_DATA_INT32 },
2111#endif
2112};
2113
2114static kmutex_t cpu_info_template_lock;
2115
2116static int
2117cpu_info_kstat_update(kstat_t *ksp, int rw)
2118{

--- 33 unchanged lines hidden (view full) ---

2152 cp->cpu_type_info.pi_fputypes, 15);
2153 cpu_info_template.ci_clock_MHz.value.l = cp->cpu_type_info.pi_clock;
2154 cpu_info_template.ci_chip_id.value.l =
2155 pg_plat_hw_instance_id(cp, PGHW_CHIP);
2156 kstat_named_setstr(&cpu_info_template.ci_implementation,
2157 cp->cpu_idstr);
2158 kstat_named_setstr(&cpu_info_template.ci_brandstr, cp->cpu_brandstr);
2159 cpu_info_template.ci_core_id.value.l = pg_plat_get_core_id(cp);
2115#endif
2116};
2117
2118static kmutex_t cpu_info_template_lock;
2119
2120static int
2121cpu_info_kstat_update(kstat_t *ksp, int rw)
2122{

--- 33 unchanged lines hidden (view full) ---

2156 cp->cpu_type_info.pi_fputypes, 15);
2157 cpu_info_template.ci_clock_MHz.value.l = cp->cpu_type_info.pi_clock;
2158 cpu_info_template.ci_chip_id.value.l =
2159 pg_plat_hw_instance_id(cp, PGHW_CHIP);
2160 kstat_named_setstr(&cpu_info_template.ci_implementation,
2161 cp->cpu_idstr);
2162 kstat_named_setstr(&cpu_info_template.ci_brandstr, cp->cpu_brandstr);
2163 cpu_info_template.ci_core_id.value.l = pg_plat_get_core_id(cp);
2160
2164 cpu_info_template.ci_curr_clock_Hz.value.ui64 =
2165 cp->cpu_type_info.pi_curr_clock;
2166 if (cp->cpu_type_info.pi_supp_freqs == NULL) {
2167 char clkstr[sizeof ("18446744073709551615") + 1]; /* ui64 MAX */
2168 (void) snprintf(clkstr, sizeof (clkstr), "%"PRIu64,
2169 cpu_info_template.ci_curr_clock_Hz.value.ui64);
2170 kstat_named_setstr(&cpu_info_template.ci_supp_freq_Hz, clkstr);
2171 } else {
2172 kstat_named_setstr(&cpu_info_template.ci_supp_freq_Hz,
2173 cp->cpu_type_info.pi_supp_freqs);
2174 }
2161#if defined(__sparcv9)
2162 cpu_info_template.ci_device_ID.value.ui64 =
2163 cpunodes[cp->cpu_id].device_id;
2164 kstat_named_setstr(&cpu_info_template.ci_cpu_fru, cpu_fru_fmri(cp));
2165#endif
2166#if defined(__x86)
2167 kstat_named_setstr(&cpu_info_template.ci_vendorstr,
2168 cpuid_getvendorstr(cp));

--- 1023 unchanged lines hidden ---
2175#if defined(__sparcv9)
2176 cpu_info_template.ci_device_ID.value.ui64 =
2177 cpunodes[cp->cpu_id].device_id;
2178 kstat_named_setstr(&cpu_info_template.ci_cpu_fru, cpu_fru_fmri(cp));
2179#endif
2180#if defined(__x86)
2181 kstat_named_setstr(&cpu_info_template.ci_vendorstr,
2182 cpuid_getvendorstr(cp));

--- 1023 unchanged lines hidden ---