Loading arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +34 −41 Original line number Diff line number Diff line Loading @@ -128,26 +128,24 @@ static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data) static void wrport(u16 port, u8 bit_width, u32 value) { if (bit_width <= 8) { if (bit_width <= 8) outb(value, port); } else if (bit_width <= 16) { else if (bit_width <= 16) outw(value, port); } else if (bit_width <= 32) { else if (bit_width <= 32) outl(value, port); } } static void rdport(u16 port, u8 bit_width, u32 * ret) { *ret = 0; if (bit_width <= 8) { if (bit_width <= 8) *ret = inb(port); } else if (bit_width <= 16) { else if (bit_width <= 16) *ret = inw(port); } else if (bit_width <= 32) { else if (bit_width <= 32) *ret = inl(port); } } struct msr_addr { u32 reg; Loading Loading @@ -202,7 +200,7 @@ static void do_drv_write(struct drv_cmd *cmd) } } static inline void drv_read(struct drv_cmd *cmd) static void drv_read(struct drv_cmd *cmd) { cpumask_t saved_mask = current->cpus_allowed; cmd->val = 0; Loading @@ -210,7 +208,6 @@ static inline void drv_read(struct drv_cmd *cmd) set_cpus_allowed(current, cmd->mask); do_drv_read(cmd); set_cpus_allowed(current, saved_mask); } static void drv_write(struct drv_cmd *cmd) Loading Loading @@ -323,11 +320,10 @@ static unsigned int get_measured_perf(unsigned int cpu) mperf_cur.split.lo >>= shift_count; } if (aperf_cur.split.lo && mperf_cur.split.lo) { if (aperf_cur.split.lo && mperf_cur.split.lo) perf_percent = (aperf_cur.split.lo * 100) / mperf_cur.split.lo; } else { else perf_percent = 0; } #else if (unlikely(((unsigned long)(-1) / 100) < aperf_cur.whole)) { Loading @@ -336,11 +332,10 @@ static unsigned int get_measured_perf(unsigned int cpu) mperf_cur.whole >>= shift_count; } if (aperf_cur.whole && mperf_cur.whole) { if (aperf_cur.whole && mperf_cur.whole) perf_percent = (aperf_cur.whole * 100) / mperf_cur.whole; } else { else perf_percent = 0; } #endif Loading Loading @@ -608,9 +603,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) data->acpi_data = acpi_perf_data[cpu]; drv_data[cpu] = data; if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; } result = acpi_processor_register_performance(data->acpi_data, cpu); if (result) Loading @@ -618,6 +612,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) perf = data->acpi_data; policy->shared_type = perf->shared_type; /* * Will let policy->cpus know about dependency only when software * coordination is required. Loading Loading @@ -667,8 +662,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) goto err_unreg; } data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (perf->state_count+1), GFP_KERNEL); if (!data->freq_table) { result = -ENOMEM; Loading Loading @@ -700,9 +694,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) data->freq_table[perf->state_count].frequency = CPUFREQ_TABLE_END; result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); if (result) { if (result) goto err_freqfree; } switch (data->cpu_feature) { case ACPI_ADR_SPACE_SYSTEM_IO: Loading @@ -724,10 +717,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) { unsigned int ecx; ecx = cpuid_ecx(6); if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY) { if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY) acpi_cpufreq_driver.getavg = get_measured_perf; } } dprintk("CPU%u - ACPI performance management activated.\n", cpu); for (i = 0; i < perf->state_count; i++) Loading Loading @@ -827,7 +819,8 @@ static void __exit acpi_cpufreq_exit(void) module_param(acpi_pstate_strict, uint, 0644); MODULE_PARM_DESC(acpi_pstate_strict, "value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes."); "value 0 or non-zero. non-zero -> strict ACPI checks are " "performed during frequency changes."); late_initcall(acpi_cpufreq_init); module_exit(acpi_cpufreq_exit); Loading Loading
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +34 −41 Original line number Diff line number Diff line Loading @@ -128,26 +128,24 @@ static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data) static void wrport(u16 port, u8 bit_width, u32 value) { if (bit_width <= 8) { if (bit_width <= 8) outb(value, port); } else if (bit_width <= 16) { else if (bit_width <= 16) outw(value, port); } else if (bit_width <= 32) { else if (bit_width <= 32) outl(value, port); } } static void rdport(u16 port, u8 bit_width, u32 * ret) { *ret = 0; if (bit_width <= 8) { if (bit_width <= 8) *ret = inb(port); } else if (bit_width <= 16) { else if (bit_width <= 16) *ret = inw(port); } else if (bit_width <= 32) { else if (bit_width <= 32) *ret = inl(port); } } struct msr_addr { u32 reg; Loading Loading @@ -202,7 +200,7 @@ static void do_drv_write(struct drv_cmd *cmd) } } static inline void drv_read(struct drv_cmd *cmd) static void drv_read(struct drv_cmd *cmd) { cpumask_t saved_mask = current->cpus_allowed; cmd->val = 0; Loading @@ -210,7 +208,6 @@ static inline void drv_read(struct drv_cmd *cmd) set_cpus_allowed(current, cmd->mask); do_drv_read(cmd); set_cpus_allowed(current, saved_mask); } static void drv_write(struct drv_cmd *cmd) Loading Loading @@ -323,11 +320,10 @@ static unsigned int get_measured_perf(unsigned int cpu) mperf_cur.split.lo >>= shift_count; } if (aperf_cur.split.lo && mperf_cur.split.lo) { if (aperf_cur.split.lo && mperf_cur.split.lo) perf_percent = (aperf_cur.split.lo * 100) / mperf_cur.split.lo; } else { else perf_percent = 0; } #else if (unlikely(((unsigned long)(-1) / 100) < aperf_cur.whole)) { Loading @@ -336,11 +332,10 @@ static unsigned int get_measured_perf(unsigned int cpu) mperf_cur.whole >>= shift_count; } if (aperf_cur.whole && mperf_cur.whole) { if (aperf_cur.whole && mperf_cur.whole) perf_percent = (aperf_cur.whole * 100) / mperf_cur.whole; } else { else perf_percent = 0; } #endif Loading Loading @@ -608,9 +603,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) data->acpi_data = acpi_perf_data[cpu]; drv_data[cpu] = data; if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; } result = acpi_processor_register_performance(data->acpi_data, cpu); if (result) Loading @@ -618,6 +612,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) perf = data->acpi_data; policy->shared_type = perf->shared_type; /* * Will let policy->cpus know about dependency only when software * coordination is required. Loading Loading @@ -667,8 +662,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) goto err_unreg; } data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (perf->state_count+1), GFP_KERNEL); if (!data->freq_table) { result = -ENOMEM; Loading Loading @@ -700,9 +694,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) data->freq_table[perf->state_count].frequency = CPUFREQ_TABLE_END; result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); if (result) { if (result) goto err_freqfree; } switch (data->cpu_feature) { case ACPI_ADR_SPACE_SYSTEM_IO: Loading @@ -724,10 +717,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) { unsigned int ecx; ecx = cpuid_ecx(6); if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY) { if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY) acpi_cpufreq_driver.getavg = get_measured_perf; } } dprintk("CPU%u - ACPI performance management activated.\n", cpu); for (i = 0; i < perf->state_count; i++) Loading Loading @@ -827,7 +819,8 @@ static void __exit acpi_cpufreq_exit(void) module_param(acpi_pstate_strict, uint, 0644); MODULE_PARM_DESC(acpi_pstate_strict, "value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes."); "value 0 or non-zero. non-zero -> strict ACPI checks are " "performed during frequency changes."); late_initcall(acpi_cpufreq_init); module_exit(acpi_cpufreq_exit); Loading