diff options
Diffstat (limited to 'sys/sys/cpu.h')
-rw-r--r-- | sys/sys/cpu.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sys/sys/cpu.h b/sys/sys/cpu.h index b6a0094f0c51..5bb55679a05b 100644 --- a/sys/sys/cpu.h +++ b/sys/sys/cpu.h @@ -40,25 +40,31 @@ #define CPU_IVAR_CPUID_SIZE 3 #define CPU_IVAR_CPUID 4 -static __inline struct pcpu *cpu_get_pcpu(device_t dev) +static __inline struct pcpu * +cpu_get_pcpu(device_t dev) { uintptr_t v = 0; + BUS_READ_IVAR(device_get_parent(dev), dev, CPU_IVAR_PCPU, &v); return ((struct pcpu *)v); } -static __inline int32_t cpu_get_nominal_mhz(device_t dev) +static __inline int32_t +cpu_get_nominal_mhz(device_t dev) { uintptr_t v = 0; + if (BUS_READ_IVAR(device_get_parent(dev), dev, CPU_IVAR_NOMINAL_MHZ, &v) != 0) return (-1); return ((int32_t)v); } -static __inline const uint32_t *cpu_get_cpuid(device_t dev, size_t *count) +static __inline const uint32_t * +cpu_get_cpuid(device_t dev, size_t *count) { uintptr_t v = 0; + if (BUS_READ_IVAR(device_get_parent(dev), dev, CPU_IVAR_CPUID_SIZE, &v) != 0) return (NULL); @@ -124,10 +130,10 @@ TAILQ_HEAD(cf_level_lst, cf_level); * state. It is probably a bug to not combine this with "info only" */ #define CPUFREQ_TYPE_MASK 0xffff -#define CPUFREQ_TYPE_RELATIVE (1<<0) -#define CPUFREQ_TYPE_ABSOLUTE (1<<1) -#define CPUFREQ_FLAG_INFO_ONLY (1<<16) -#define CPUFREQ_FLAG_UNCACHED (1<<17) +#define CPUFREQ_TYPE_RELATIVE (1 << 0) +#define CPUFREQ_TYPE_ABSOLUTE (1 << 1) +#define CPUFREQ_FLAG_INFO_ONLY (1 << 16) +#define CPUFREQ_FLAG_UNCACHED (1 << 17) /* * When setting a level, the caller indicates the priority of this request. @@ -162,7 +168,7 @@ int cpufreq_settings_changed(device_t dev); * The new level and the result of the change (0 is success) is passed in. * If the driver wishes to revoke the change from cpufreq_pre_change, it * stores a non-zero error code in the result parameter and the change will - * not be made. If the post-change eventhandler gets a non-zero result, + * not be made. If the post-change eventhandler gets a non-zero result, * no change was made and the previous level remains in effect. If a change * is revoked, the post-change eventhandler is still called with the error * value supplied by the revoking driver. This gives listeners who cached |