2005-04-16 15:20:36 -07:00
|
|
|
#ifndef __ACPI_PROCESSOR_H
|
|
|
|
#define __ACPI_PROCESSOR_H
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
2005-12-14 13:05:00 -07:00
|
|
|
#include <linux/cpu.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2005-04-15 12:07:10 -07:00
|
|
|
#include <asm/acpi.h>
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#define ACPI_PROCESSOR_BUSY_METRIC 10
|
|
|
|
|
|
|
|
#define ACPI_PROCESSOR_MAX_POWER 8
|
|
|
|
#define ACPI_PROCESSOR_MAX_C2_LATENCY 100
|
|
|
|
#define ACPI_PROCESSOR_MAX_C3_LATENCY 1000
|
|
|
|
|
|
|
|
#define ACPI_PROCESSOR_MAX_THROTTLING 16
|
|
|
|
#define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
|
|
|
|
#define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
|
|
|
|
|
2005-04-15 12:07:10 -07:00
|
|
|
#define ACPI_PDC_REVISION_ID 0x1
|
|
|
|
|
2007-05-09 20:34:35 -07:00
|
|
|
#define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
|
2005-12-14 13:05:00 -07:00
|
|
|
#define ACPI_PSD_REV0_ENTRIES 5
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Types of coordination defined in ACPI 3.0. Same macros can be used across
|
|
|
|
* P, C and T states
|
|
|
|
*/
|
|
|
|
#define DOMAIN_COORD_TYPE_SW_ALL 0xfc
|
|
|
|
#define DOMAIN_COORD_TYPE_SW_ANY 0xfd
|
|
|
|
#define DOMAIN_COORD_TYPE_HW_ALL 0xfe
|
|
|
|
|
2006-09-25 16:28:13 -07:00
|
|
|
#define ACPI_CSTATE_SYSTEMIO (0)
|
|
|
|
#define ACPI_CSTATE_FFH (1)
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/* Power Management */
|
|
|
|
|
|
|
|
struct acpi_processor_cx;
|
|
|
|
|
|
|
|
struct acpi_power_register {
|
2005-08-04 21:44:28 -07:00
|
|
|
u8 descriptor;
|
|
|
|
u16 length;
|
|
|
|
u8 space_id;
|
|
|
|
u8 bit_width;
|
|
|
|
u8 bit_offset;
|
|
|
|
u8 reserved;
|
|
|
|
u64 address;
|
2005-04-16 15:20:36 -07:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
|
|
|
struct acpi_processor_cx_policy {
|
2005-08-04 21:44:28 -07:00
|
|
|
u32 count;
|
2005-04-16 15:20:36 -07:00
|
|
|
struct acpi_processor_cx *state;
|
|
|
|
struct {
|
2005-08-04 21:44:28 -07:00
|
|
|
u32 time;
|
|
|
|
u32 ticks;
|
|
|
|
u32 count;
|
|
|
|
u32 bm;
|
|
|
|
} threshold;
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_processor_cx {
|
2005-08-04 21:44:28 -07:00
|
|
|
u8 valid;
|
|
|
|
u8 type;
|
|
|
|
u32 address;
|
2006-09-25 16:28:13 -07:00
|
|
|
u8 space_id;
|
|
|
|
u8 index;
|
2005-08-04 21:44:28 -07:00
|
|
|
u32 latency;
|
|
|
|
u32 latency_ticks;
|
|
|
|
u32 power;
|
|
|
|
u32 usage;
|
2006-06-24 16:37:00 -07:00
|
|
|
u64 time;
|
2005-04-16 15:20:36 -07:00
|
|
|
struct acpi_processor_cx_policy promotion;
|
|
|
|
struct acpi_processor_cx_policy demotion;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_processor_power {
|
|
|
|
struct acpi_processor_cx *state;
|
2005-08-04 21:44:28 -07:00
|
|
|
unsigned long bm_check_timestamp;
|
|
|
|
u32 default_state;
|
|
|
|
u32 bm_activity;
|
|
|
|
int count;
|
2005-04-16 15:20:36 -07:00
|
|
|
struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
|
2007-02-16 02:27:55 -07:00
|
|
|
int timer_broadcast_on_state;
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Performance Management */
|
|
|
|
|
2005-12-14 13:05:00 -07:00
|
|
|
struct acpi_psd_package {
|
|
|
|
acpi_integer num_entries;
|
|
|
|
acpi_integer revision;
|
|
|
|
acpi_integer domain;
|
|
|
|
acpi_integer coord_type;
|
|
|
|
acpi_integer num_processors;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
struct acpi_pct_register {
|
2005-08-04 21:44:28 -07:00
|
|
|
u8 descriptor;
|
|
|
|
u16 length;
|
|
|
|
u8 space_id;
|
|
|
|
u8 bit_width;
|
|
|
|
u8 bit_offset;
|
|
|
|
u8 reserved;
|
|
|
|
u64 address;
|
2005-04-16 15:20:36 -07:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
|
|
|
struct acpi_processor_px {
|
2005-08-04 21:44:28 -07:00
|
|
|
acpi_integer core_frequency; /* megahertz */
|
|
|
|
acpi_integer power; /* milliWatts */
|
|
|
|
acpi_integer transition_latency; /* microseconds */
|
|
|
|
acpi_integer bus_master_latency; /* microseconds */
|
|
|
|
acpi_integer control; /* control value */
|
|
|
|
acpi_integer status; /* success indicator */
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_processor_performance {
|
2005-08-04 21:44:28 -07:00
|
|
|
unsigned int state;
|
|
|
|
unsigned int platform_limit;
|
2005-04-16 15:20:36 -07:00
|
|
|
struct acpi_pct_register control_register;
|
|
|
|
struct acpi_pct_register status_register;
|
2005-08-04 21:44:28 -07:00
|
|
|
unsigned int state_count;
|
2005-04-16 15:20:36 -07:00
|
|
|
struct acpi_processor_px *states;
|
2005-12-14 13:05:00 -07:00
|
|
|
struct acpi_psd_package domain_info;
|
|
|
|
cpumask_t shared_cpu_map;
|
|
|
|
unsigned int shared_type;
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Throttling Control */
|
|
|
|
|
|
|
|
struct acpi_processor_tx {
|
2005-08-04 21:44:28 -07:00
|
|
|
u16 power;
|
|
|
|
u16 performance;
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_processor_throttling {
|
2005-08-04 21:44:28 -07:00
|
|
|
int state;
|
|
|
|
u32 address;
|
|
|
|
u8 duty_offset;
|
|
|
|
u8 duty_width;
|
|
|
|
int state_count;
|
2005-04-16 15:20:36 -07:00
|
|
|
struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Limit Interface */
|
|
|
|
|
|
|
|
struct acpi_processor_lx {
|
2005-08-04 21:44:28 -07:00
|
|
|
int px; /* performace state */
|
|
|
|
int tx; /* throttle level */
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_processor_limit {
|
2005-08-04 21:44:28 -07:00
|
|
|
struct acpi_processor_lx state; /* current limit */
|
2005-04-16 15:20:36 -07:00
|
|
|
struct acpi_processor_lx thermal; /* thermal limit */
|
2005-08-04 21:44:28 -07:00
|
|
|
struct acpi_processor_lx user; /* user limit */
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_processor_flags {
|
2005-08-04 21:44:28 -07:00
|
|
|
u8 power:1;
|
|
|
|
u8 performance:1;
|
|
|
|
u8 throttling:1;
|
|
|
|
u8 limit:1;
|
|
|
|
u8 bm_control:1;
|
|
|
|
u8 bm_check:1;
|
|
|
|
u8 has_cst:1;
|
|
|
|
u8 power_setup_done:1;
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_processor {
|
2005-08-04 21:44:28 -07:00
|
|
|
acpi_handle handle;
|
|
|
|
u32 acpi_id;
|
|
|
|
u32 id;
|
|
|
|
u32 pblk;
|
|
|
|
int performance_platform_limit;
|
2005-04-16 15:20:36 -07:00
|
|
|
struct acpi_processor_flags flags;
|
|
|
|
struct acpi_processor_power power;
|
|
|
|
struct acpi_processor_performance *performance;
|
|
|
|
struct acpi_processor_throttling throttling;
|
|
|
|
struct acpi_processor_limit limit;
|
2005-10-23 13:31:00 -07:00
|
|
|
|
|
|
|
/* the _PDC objects for this processor, if any */
|
|
|
|
struct acpi_object_list *pdc;
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct acpi_processor_errata {
|
2005-08-04 21:44:28 -07:00
|
|
|
u8 smp;
|
2005-04-16 15:20:36 -07:00
|
|
|
struct {
|
2005-08-04 21:44:28 -07:00
|
|
|
u8 throttle:1;
|
|
|
|
u8 fdma:1;
|
|
|
|
u8 reserved:6;
|
|
|
|
u32 bmisx;
|
|
|
|
} piix4;
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
2007-05-09 20:34:35 -07:00
|
|
|
extern int acpi_processor_preregister_performance(struct
|
|
|
|
acpi_processor_performance
|
|
|
|
**performance);
|
2005-12-14 13:05:00 -07:00
|
|
|
|
2005-08-04 21:44:28 -07:00
|
|
|
extern int acpi_processor_register_performance(struct acpi_processor_performance
|
|
|
|
*performance, unsigned int cpu);
|
|
|
|
extern void acpi_processor_unregister_performance(struct
|
|
|
|
acpi_processor_performance
|
|
|
|
*performance,
|
|
|
|
unsigned int cpu);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/* note: this locks both the calling module and the processor module
|
|
|
|
if a _PPC object exists, rmmod is disallowed then */
|
|
|
|
int acpi_processor_notify_smm(struct module *calling_module);
|
|
|
|
|
|
|
|
/* for communication between multiple parts of the processor kernel module */
|
2005-08-04 21:44:28 -07:00
|
|
|
extern struct acpi_processor *processors[NR_CPUS];
|
2005-04-16 15:20:36 -07:00
|
|
|
extern struct acpi_processor_errata errata;
|
|
|
|
|
2005-10-23 13:31:00 -07:00
|
|
|
void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
|
2005-04-15 12:07:10 -07:00
|
|
|
|
2005-10-23 13:31:00 -07:00
|
|
|
#ifdef ARCH_HAS_POWER_INIT
|
2005-04-15 12:07:10 -07:00
|
|
|
void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
|
2005-08-04 21:44:28 -07:00
|
|
|
unsigned int cpu);
|
2006-09-25 16:28:13 -07:00
|
|
|
int acpi_processor_ffh_cstate_probe(unsigned int cpu,
|
2007-05-09 20:34:35 -07:00
|
|
|
struct acpi_processor_cx *cx,
|
|
|
|
struct acpi_power_register *reg);
|
2006-09-25 16:28:13 -07:00
|
|
|
void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate);
|
2005-04-15 12:07:10 -07:00
|
|
|
#else
|
2005-08-04 21:44:28 -07:00
|
|
|
static inline void acpi_processor_power_init_bm_check(struct
|
|
|
|
acpi_processor_flags
|
|
|
|
*flags, unsigned int cpu)
|
2005-04-15 12:07:10 -07:00
|
|
|
{
|
|
|
|
flags->bm_check = 1;
|
|
|
|
return;
|
|
|
|
}
|
2006-09-25 16:28:13 -07:00
|
|
|
static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu,
|
2007-05-09 20:34:35 -07:00
|
|
|
struct acpi_processor_cx *cx,
|
|
|
|
struct acpi_power_register
|
|
|
|
*reg)
|
2006-09-25 16:28:13 -07:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
2007-05-09 20:34:35 -07:00
|
|
|
static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
|
|
|
|
*cstate)
|
2006-09-25 16:28:13 -07:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2005-04-15 12:07:10 -07:00
|
|
|
#endif
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/* in processor_perflib.c */
|
2005-04-15 12:07:10 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#ifdef CONFIG_CPU_FREQ
|
|
|
|
void acpi_processor_ppc_init(void);
|
|
|
|
void acpi_processor_ppc_exit(void);
|
|
|
|
int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
|
|
|
|
#else
|
2005-08-04 21:44:28 -07:00
|
|
|
static inline void acpi_processor_ppc_init(void)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
static inline void acpi_processor_ppc_exit(void)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
|
|
|
|
{
|
2005-04-16 15:20:36 -07:00
|
|
|
static unsigned int printout = 1;
|
|
|
|
if (printout) {
|
2005-08-04 21:44:28 -07:00
|
|
|
printk(KERN_WARNING
|
|
|
|
"Warning: Processor Platform Limit event detected, but not handled.\n");
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"Consider compiling CPUfreq support into your kernel.\n");
|
2005-04-16 15:20:36 -07:00
|
|
|
printout = 0;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2005-08-04 21:44:28 -07:00
|
|
|
#endif /* CONFIG_CPU_FREQ */
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/* in processor_throttling.c */
|
2005-08-04 21:44:28 -07:00
|
|
|
int acpi_processor_get_throttling_info(struct acpi_processor *pr);
|
|
|
|
int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
|
2005-04-16 15:20:36 -07:00
|
|
|
extern struct file_operations acpi_processor_throttling_fops;
|
|
|
|
|
|
|
|
/* in processor_idle.c */
|
2005-08-04 21:44:28 -07:00
|
|
|
int acpi_processor_power_init(struct acpi_processor *pr,
|
|
|
|
struct acpi_device *device);
|
|
|
|
int acpi_processor_cst_has_changed(struct acpi_processor *pr);
|
|
|
|
int acpi_processor_power_exit(struct acpi_processor *pr,
|
|
|
|
struct acpi_device *device);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/* in processor_thermal.c */
|
2005-08-04 21:44:28 -07:00
|
|
|
int acpi_processor_get_limit_info(struct acpi_processor *pr);
|
2005-04-16 15:20:36 -07:00
|
|
|
extern struct file_operations acpi_processor_limit_fops;
|
|
|
|
|
|
|
|
#ifdef CONFIG_CPU_FREQ
|
|
|
|
void acpi_thermal_cpufreq_init(void);
|
|
|
|
void acpi_thermal_cpufreq_exit(void);
|
|
|
|
#else
|
2005-08-04 21:44:28 -07:00
|
|
|
static inline void acpi_thermal_cpufreq_init(void)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
static inline void acpi_thermal_cpufreq_exit(void)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2005-04-16 15:20:36 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|