vserver 1.9.5.x5
[linux-2.6.git] / include / linux / cpufreq.h
index f48a064..910eca3 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/kobject.h>
 #include <linux/sysfs.h>
 #include <linux/completion.h>
+#include <linux/workqueue.h>
+#include <linux/cpumask.h>
 
 #define CPUFREQ_NAME_LEN 16
 
@@ -68,7 +70,8 @@ struct cpufreq_real_policy {
 };
 
 struct cpufreq_policy {
-       unsigned int            cpu;    /* cpu nr */
+       cpumask_t               cpus;   /* affected CPUs */
+       unsigned int            cpu;    /* cpu nr of registered CPU */
        struct cpufreq_cpuinfo  cpuinfo;/* see above */
 
        unsigned int            min;    /* in kHz */
@@ -81,6 +84,9 @@ struct cpufreq_policy {
        struct semaphore        lock;   /* CPU ->setpolicy or ->target may
                                           only be called once a time */
 
+       struct work_struct      update; /* if update_policy() needs to be
+                                        * called, but you're in IRQ context */
+
        struct cpufreq_real_policy      user_policy;
 
        struct kobject          kobj;
@@ -96,11 +102,13 @@ struct cpufreq_policy {
 
 #define CPUFREQ_PRECHANGE      (0)
 #define CPUFREQ_POSTCHANGE     (1)
+#define CPUFREQ_RESUMECHANGE   (8)
 
 struct cpufreq_freqs {
        unsigned int cpu;       /* cpu nr */
        unsigned int old;
        unsigned int new;
+       u8 flags;               /* flags of cpufreq_driver, see below. */
 };
 
 
@@ -187,6 +195,9 @@ struct cpufreq_driver {
                                 unsigned int target_freq,
                                 unsigned int relation);
 
+       /* should be defined, if possible */
+       unsigned int    (*get)  (unsigned int cpu);
+
        /* optional */
        int     (*exit)         (struct cpufreq_policy *policy);
        int     (*resume)       (struct cpufreq_policy *policy);
@@ -195,8 +206,12 @@ struct cpufreq_driver {
 
 /* flags */
 
-#define CPUFREQ_STICKY 0x01    /* the driver isn't removed even if 
-                                  all ->init() calls failed */
+#define CPUFREQ_STICKY         0x01    /* the driver isn't removed even if 
+                                        * all ->init() calls failed */
+#define CPUFREQ_CONST_LOOPS    0x02    /* loops_per_jiffy or other kernel
+                                        * "constants" aren't affected by
+                                        * frequency transitions */
+
 
 int cpufreq_register_driver(struct cpufreq_driver *driver_data);
 int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
@@ -234,69 +249,10 @@ int cpufreq_set_policy(struct cpufreq_policy *policy);
 int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
 int cpufreq_update_policy(unsigned int cpu);
 
-/* the proc_intf.c needs this */
-int cpufreq_parse_governor (char *str_governor, unsigned int *policy, struct cpufreq_governor **governor);
-
-
-/*********************************************************************
- *                      CPUFREQ USERSPACE GOVERNOR                   *
- *********************************************************************/
-int cpufreq_gov_userspace_init(void);
-
-#ifdef CONFIG_CPU_FREQ_24_API
-
-int cpufreq_setmax(unsigned int cpu);
-int cpufreq_set(unsigned int kHz, unsigned int cpu);
+/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
 unsigned int cpufreq_get(unsigned int cpu);
 
 
-/* /proc/sys/cpu */
-enum {
-       CPU_NR   = 1,           /* compatibilty reasons */
-       CPU_NR_0 = 1,
-       CPU_NR_1 = 2,
-       CPU_NR_2 = 3,
-       CPU_NR_3 = 4,
-       CPU_NR_4 = 5,
-       CPU_NR_5 = 6,
-       CPU_NR_6 = 7,
-       CPU_NR_7 = 8,
-       CPU_NR_8 = 9,
-       CPU_NR_9 = 10,
-       CPU_NR_10 = 11,
-       CPU_NR_11 = 12,
-       CPU_NR_12 = 13,
-       CPU_NR_13 = 14,
-       CPU_NR_14 = 15,
-       CPU_NR_15 = 16,
-       CPU_NR_16 = 17,
-       CPU_NR_17 = 18,
-       CPU_NR_18 = 19,
-       CPU_NR_19 = 20,
-       CPU_NR_20 = 21,
-       CPU_NR_21 = 22,
-       CPU_NR_22 = 23,
-       CPU_NR_23 = 24,
-       CPU_NR_24 = 25,
-       CPU_NR_25 = 26,
-       CPU_NR_26 = 27,
-       CPU_NR_27 = 28,
-       CPU_NR_28 = 29,
-       CPU_NR_29 = 30,
-       CPU_NR_30 = 31,
-       CPU_NR_31 = 32,
-};
-
-/* /proc/sys/cpu/{0,1,...,(NR_CPUS-1)} */
-enum {
-       CPU_NR_FREQ_MAX = 1,
-       CPU_NR_FREQ_MIN = 2,
-       CPU_NR_FREQ = 3,
-};
-
-#endif /* CONFIG_CPU_FREQ_24_API */
-
-
 /*********************************************************************
  *                       CPUFREQ DEFAULT GOVERNOR                    *
  *********************************************************************/
@@ -336,6 +292,11 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
                                   unsigned int relation,
                                   unsigned int *index);
 
+/* the following 3 funtions are for cpufreq core use only */
+struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
+struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
+void   cpufreq_cpu_put (struct cpufreq_policy *data);
+
 /* the following are really really optional */
 extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
 
@@ -345,4 +306,23 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
 void cpufreq_frequency_table_put_attr(unsigned int cpu);
 
 
+/*********************************************************************
+ *                     UNIFIED DEBUG HELPERS                         *
+ *********************************************************************/
+
+#define CPUFREQ_DEBUG_CORE     1
+#define CPUFREQ_DEBUG_DRIVER   2
+#define CPUFREQ_DEBUG_GOVERNOR 4
+
+#ifdef CONFIG_CPU_FREQ_DEBUG
+
+extern void cpufreq_debug_printk(unsigned int type, const char *prefix, 
+                                const char *fmt, ...);
+
+#else
+
+#define cpufreq_debug_printk(msg...) do { } while(0)
+
+#endif /* CONFIG_CPU_FREQ_DEBUG */
+
 #endif /* _LINUX_CPUFREQ_H */