~ubuntu-branches/ubuntu/gutsy/linux-source-2.6.22/gutsy-updates

« back to all changes in this revision

Viewing changes to debian/binary-custom.d/lpia/patchset/0006-Thermal-Poulsbo-Thottling-support-from-SMI.patch

  • Committer: Bazaar Package Importer
  • Author(s): Tim Gardner, Amit Kucheria, Kees Cook, Tim Gardner, Upstream Kernel Changes
  • Date: 2008-01-28 13:46:21 UTC
  • Revision ID: james.westby@ubuntu.com-20080128134621-2g3o1x6zrnf4gf81
Tags: 2.6.22-14.51
[Amit Kucheria]

* Poulsbo: Mass update of all patches from moblin repo
* Update config.lpia to reflect new patches
* [sata_sil][sata->ide-bridg] failed to set xfermode
  - LP: #153096
* Poulsbo: remove extra patch

[Kees Cook]

* fix NFSv4 client mount regression
  - LP: #164231

[Tim Gardner]

* Support of new AMD PowerNow! (family 0x11 and beyond)
  - LP: #185649

[Upstream Kernel Changes]

* minixfs: limit minixfs printks on corrupted dir i_size (CVE-2006-6058)
* [JFFS2] Fix ACL vs. mode handling. (CVE-2007-4849)
* [IEEE80211]: avoid integer underflow for runt rx frames (CVE-2007-4997)
* [TCP]: Make sure write_queue_from does not begin with NULL ptr
  (CVE-2007-5501)
* wait_task_stopped: Check p->exit_state instead of TASK_TRACED
  (CVE-2007-5500)
* fix DLM regression
* CVE-2008-0001: Use access mode instead of open flags to determine
  needed permissions
* hrtimers: avoid overflow for large relative timeouts (CVE-2007-5966)
* isdn: avoid copying overly-long strings (CVE-2007-6063)
* I4L: fix isdn_ioctl memory overrun vulnerability (CVE-2007-6151)
* vfs: coredumping fix (CVE-2007-6206)
* tmpfs: restore missing clear_highpage (CVE-2007-6417)
* [UBUNTU] fs/dlm: Fix regression introduced with last security fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From c60b635637f0baadc4cc937519f11634f5a0d0f8 Mon Sep 17 00:00:00 2001
2
 
From: Sujith Thomas <sujith.thomas@intel.com>
3
 
Date: Tue, 14 Aug 2007 16:23:56 +0800
4
 
Subject: [PATCH] Poulsbo: Thottling support from SMI
5
 
 
6
 
- Generic support for throttling of any component using SMI
7
 
- Memory throttling for Intel platform Poulsbo
8
 
 
9
 
Signed-off-by: Sujith Thomas <sujith.thomas@intel.com>
10
 
---
11
 
 drivers/acpi/Kconfig               |   13 +++
12
 
 drivers/acpi/Makefile              |    2 +
13
 
 drivers/acpi/smi_device_throttle.c |  108 ++++++++++++++++++++
14
 
 drivers/acpi/smi_thermal.c         |  193 ++++++++++++++++++++++++++++++++++++
15
 
 include/linux/smi_thermal.h        |   60 +++++++++++
16
 
 5 files changed, 376 insertions(+), 0 deletions(-)
17
 
 create mode 100644 drivers/acpi/smi_device_throttle.c
18
 
 create mode 100644 drivers/acpi/smi_thermal.c
19
 
 create mode 100644 include/linux/smi_thermal.h
20
 
 
21
 
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
22
 
index c8f50c0..2f65654 100644
23
 
--- a/drivers/acpi/Kconfig
24
 
+++ b/drivers/acpi/Kconfig
25
 
@@ -189,6 +189,19 @@ config THERMAL_SENSOR
26
 
        help
27
 
          This driver adds support for AUX trip programming of sensors withing ACPI thermal zones. This is an intel platform specific driver.
28
 
 
29
 
+config SMI_THERMAL
30
 
+       tristate "SMI Thermal driver"
31
 
+       depends on ACPI_THERMAL
32
 
+       default y
33
 
+       help
34
 
+         This driver adds support for AUX trip programming of sensors withing ACPI thermal zones. This is an intel platform specific driver.
35
 
+
36
 
+config SMI_DEVICE_THROTTLE
37
 
+       tristate "SMI Device Throttle Driver"
38
 
+       depends on SMI_THERMAL
39
 
+       default y
40
 
+       help
41
 
+         This driver adds support for throttling of device based on SMI. This is an intel platform specific driver.
42
 
 
43
 
 config ACPI_NUMA
44
 
        bool "NUMA support"
45
 
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
46
 
index 4cda36c..84252a3 100644
47
 
--- a/drivers/acpi/Makefile
48
 
+++ b/drivers/acpi/Makefile
49
 
@@ -52,7 +52,9 @@ obj-$(CONFIG_ACPI_POWER)      += power.o
50
 
 obj-$(CONFIG_ACPI_PROCESSOR)   += processor.o
51
 
 obj-$(CONFIG_ACPI_CONTAINER)   += container.o
52
 
 obj-$(CONFIG_ACPI_THERMAL)     += thermal.o
53
 
+obj-$(CONFIG_SMI_THERMAL)      += smi_thermal.o
54
 
 obj-$(CONFIG_THERMAL_SENSOR)   += thermal_sensor.o
55
 
+obj-$(CONFIG_SMI_DEVICE_THROTTLE)+= smi_device_throttle.o
56
 
 obj-$(CONFIG_ACPI_SYSTEM)      += system.o event.o
57
 
 obj-$(CONFIG_ACPI_DEBUG)       += debug.o
58
 
 obj-$(CONFIG_ACPI_NUMA)                += numa.o
59
 
diff --git a/drivers/acpi/smi_device_throttle.c b/drivers/acpi/smi_device_throttle.c
60
 
new file mode 100644
61
 
index 0000000..f0d3861
62
 
--- /dev/null
63
 
+++ b/drivers/acpi/smi_device_throttle.c
64
 
@@ -0,0 +1,108 @@
65
 
+/*
66
 
+ *  smi_device_throttle.c - SMI Device Throttle Driver ($Revision: 1 $)
67
 
+ *
68
 
+ *  Copyright (C) 2006, 2007 Sujith Thomas <sujith.thomas@intel.com>
69
 
+ *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70
 
+ *
71
 
+ *  This program is free software; you can redistribute it and/or modify
72
 
+ *  it under the terms of the GNU General Public License as published by
73
 
+ *  the Free Software Foundation; version 2 of the License.
74
 
+ *
75
 
+ *  This program is distributed in the hope that it will be useful, but
76
 
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
77
 
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
78
 
+ *  General Public License for more details.
79
 
+ *
80
 
+ *  You should have received a copy of the GNU General Public License along
81
 
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
82
 
+ *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
83
 
+ *
84
 
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85
 
+ */
86
 
+
87
 
+#include <linux/kernel.h>
88
 
+#include <linux/module.h>
89
 
+#include <linux/init.h>
90
 
+#include <linux/types.h>
91
 
+#include <linux/pci.h>
92
 
+#include <linux/pm.h>
93
 
+
94
 
+#include <linux/smi_thermal.h>
95
 
+
96
 
+MODULE_AUTHOR("Sujith Thomas");
97
 
+MODULE_DESCRIPTION("SMI throttle driver");
98
 
+MODULE_LICENSE("GPL");
99
 
+
100
 
+/*No:of devices using SMI interface for throttling*/
101
 
+#define SMI_THERMAL_DEVICE_COUNT 1
102
 
+
103
 
+/*Port and data associated with each device*/
104
 
+static struct smi_thermal_info smi_thermal_device_info[SMI_THERMAL_DEVICE_COUNT]
105
 
+    = {
106
 
+       {.name = "MEM0",
107
 
+        .cmdport = 0xB2,
108
 
+        .dataport = 0xB3,
109
 
+        .setthrottlelimit = 0xDC,
110
 
+        .getthrottlelimit = 0xDD,
111
 
+        .getmaxthrottle = 0xDD,
112
 
+        .maxdat = 0x00,
113
 
+        .getdat = 0x01,
114
 
+        .caps = DEVICE_CAPS_SW_PGM_THERMAL_EVENTS,
115
 
+        .td = NULL,
116
 
+        .driver = {
117
 
+                   .class = THERMAL_MEM_CLASS,
118
 
+                   .ops = NULL,
119
 
+                   },
120
 
+        },
121
 
+};
122
 
+static int __init smi_devices_init(void)
123
 
+{
124
 
+       int result = 0;
125
 
+       int i;
126
 
+       struct thermal_device_ops *ops;
127
 
+
128
 
+       /*Query the ops interface from smi thermal driver*/
129
 
+       ops = smi_get_thermalops();
130
 
+       if (!ops)
131
 
+               return -EINVAL;
132
 
+       for (i = 0; i < SMI_THERMAL_DEVICE_COUNT; i++) {
133
 
+               smi_thermal_device_info[i].driver.ops = ops;
134
 
+
135
 
+               /*Register component driver with thermal zone driver*/
136
 
+               result =
137
 
+                   thermal_register_device_driver(&smi_thermal_device_info[i].
138
 
+                                                  driver);
139
 
+               if (result) {
140
 
+                       return result;
141
 
+               }
142
 
+               /*Register singleton device with thermal zone driver*/
143
 
+               if (NULL ==
144
 
+                   (smi_thermal_device_info[i].td =
145
 
+                    thermal_register_device(smi_thermal_device_info[i].
146
 
+                                            name,
147
 
+                                            smi_thermal_device_info[i].
148
 
+                                            driver.class,
149
 
+                                            &smi_thermal_device_info[i]))) {
150
 
+                       return -EFAULT;
151
 
+               }
152
 
+               if (result) {
153
 
+                       thermal_unregister_device_driver
154
 
+                           (&smi_thermal_device_info[i].driver);
155
 
+                       return result;
156
 
+               }
157
 
+       }
158
 
+       return 0;
159
 
+}
160
 
+static void __exit smi_devices_exit(void)
161
 
+{
162
 
+       int i;
163
 
+       for (i = 0; i < SMI_THERMAL_DEVICE_COUNT; i++) {
164
 
+               thermal_unregister_device(smi_thermal_device_info[i].td);
165
 
+               thermal_unregister_device_driver(&smi_thermal_device_info[i].
166
 
+                                                driver);
167
 
+       }
168
 
+}
169
 
+
170
 
+module_init(smi_devices_init);
171
 
+module_exit(smi_devices_exit);
172
 
+MODULE_ALIAS("smi_device_throttle");
173
 
diff --git a/drivers/acpi/smi_thermal.c b/drivers/acpi/smi_thermal.c
174
 
new file mode 100644
175
 
index 0000000..21e8e30
176
 
--- /dev/null
177
 
+++ b/drivers/acpi/smi_thermal.c
178
 
@@ -0,0 +1,193 @@
179
 
+/*
180
 
+ *  smi_thermal.c - SMI thermal Driver ($Revision: 1 $)
181
 
+ *
182
 
+ *  Copyright (C) 2006, 2007 Sujith Thomas <sujith.thomas@intel.com>
183
 
+ *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184
 
+ *
185
 
+ *  This program is free software; you can redistribute it and/or modify
186
 
+ *  it under the terms of the GNU General Public License as published by
187
 
+ *  the Free Software Foundation; version 2 of the License.
188
 
+ *
189
 
+ *  This program is distributed in the hope that it will be useful, but
190
 
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
191
 
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
192
 
+ *  General Public License for more details.
193
 
+ *
194
 
+ *  You should have received a copy of the GNU General Public License along
195
 
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
196
 
+ *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
197
 
+ *
198
 
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
199
 
+ */
200
 
+
201
 
+#include <linux/kernel.h>
202
 
+#include <linux/module.h>
203
 
+#include <linux/init.h>
204
 
+#include <linux/types.h>
205
 
+#include <linux/pci.h>
206
 
+#include <linux/delay.h>
207
 
+#include <linux/smi_thermal.h>
208
 
+
209
 
+MODULE_AUTHOR("Sujith Thomas");
210
 
+MODULE_DESCRIPTION("SMI Device Throttle Driver");
211
 
+MODULE_LICENSE("GPL");
212
 
+
213
 
+/*
214
 
+ * getmaxthrottlestate
215
 
+ * -----------------------------
216
 
+ * call back function for getting the device's maximum throttle limit
217
 
+ * sinfo : smi_thermal_info
218
 
+ */
219
 
+static int get_max_throttle_limit(struct smi_thermal_info *sinfo)
220
 
+{
221
 
+       int maxthrottlestate;
222
 
+
223
 
+       outb(sinfo->maxdat, sinfo->dataport);
224
 
+       outb(sinfo->getmaxthrottle, sinfo->cmdport);
225
 
+       msleep(100);
226
 
+       maxthrottlestate = inb(sinfo->dataport);
227
 
+
228
 
+       return maxthrottlestate;
229
 
+}
230
 
+
231
 
+/*
232
 
+ * smi_thermal_device_get_throttle_limit
233
 
+ * -----------------------------
234
 
+ * call back function for getting the device's current throttle limit
235
 
+ * data : smi_thermal_info
236
 
+ * buf : sysfs buffer that needs to be filled back
237
 
+ */
238
 
+static int smi_thermal_device_get_throttle_limit(void *data, char *buf)
239
 
+{
240
 
+       char *s = buf;
241
 
+       int throttlevalue = 0;
242
 
+
243
 
+       struct smi_thermal_info *sinfo = (struct smi_thermal_info *)data;
244
 
+
245
 
+       if (!buf || !data)
246
 
+               return -EINVAL;
247
 
+
248
 
+       /*Read the value*/
249
 
+       outb(sinfo->getdat, sinfo->dataport);
250
 
+       outb(sinfo->getthrottlelimit, sinfo->cmdport);
251
 
+       msleep(100);
252
 
+       throttlevalue = inb(sinfo->dataport);
253
 
+
254
 
+       s += sprintf(s, "%d\n", throttlevalue);
255
 
+
256
 
+       return 0;
257
 
+}
258
 
+
259
 
+/*
260
 
+ * smi_thermal_device_set_throttle_limit
261
 
+ * -----------------------------
262
 
+ * call back function for setting the device's new throttle limit
263
 
+ * data : smi_thermal_info
264
 
+ * buf : sysfs buffer that contains the new value
265
 
+ */
266
 
+static int smi_thermal_device_set_throttle_limit(enum throttle_set_type type,
267
 
+                                                void *data, const char *buf)
268
 
+{
269
 
+       int new_state = 0;
270
 
+       int maxthrottlestate = 0;
271
 
+
272
 
+       struct smi_thermal_info *sinfo = (struct smi_thermal_info *)data;
273
 
+
274
 
+       if (!buf || !data)
275
 
+               return -EINVAL;
276
 
+
277
 
+       /*Only absolute value throttling is supported for time being*/
278
 
+       if (THROTTLE_ABS != type)
279
 
+               return -EINVAL;
280
 
+
281
 
+       maxthrottlestate = get_max_throttle_limit(sinfo);
282
 
+       new_state = simple_strtol(buf, NULL, 0);
283
 
+
284
 
+       /* we need to check if state is <= max */
285
 
+       if (new_state >= maxthrottlestate || new_state < 0) {
286
 
+               return -EINVAL;
287
 
+       }
288
 
+       /*Write new value*/
289
 
+       outb(new_state, sinfo->dataport);
290
 
+       outb(sinfo->setthrottlelimit, sinfo->cmdport);
291
 
+
292
 
+       return 0;
293
 
+}
294
 
+
295
 
+/*
296
 
+ * smi_thermal_device_get_throttle_limit
297
 
+ * -----------------------------
298
 
+ * call back function for getting the device's maximum throttle limit
299
 
+ * data : smi_thermal_info
300
 
+ * buf : sysfs buffer that needs to be filled back
301
 
+ */
302
 
+static int smi_thermal_device_get_maxthrottle_limit(void *data, char *buf)
303
 
+{
304
 
+       int maxthrottlestate = 0;
305
 
+       char *s = buf;
306
 
+       struct smi_thermal_info *sinfo = (struct smi_thermal_info *)data;
307
 
+
308
 
+       if (!buf || !data)
309
 
+               return -EINVAL;
310
 
+
311
 
+       maxthrottlestate = get_max_throttle_limit(sinfo);
312
 
+
313
 
+       s += sprintf(s, "%d\n", maxthrottlestate);
314
 
+
315
 
+       return (s - buf);
316
 
+}
317
 
+
318
 
+/*
319
 
+ * smi_thermal_device_get_caps
320
 
+ * -----------------------------
321
 
+ * call back function for getting the device's capabilities
322
 
+ * data : smi_thermal_info
323
 
+ * buf : sysfs buffer that needs to be filled back
324
 
+ */
325
 
+static int smi_thermal_device_get_caps(void *data, char *buf)
326
 
+{
327
 
+       char *s = buf;
328
 
+       struct smi_thermal_info *sinfo = NULL;
329
 
+
330
 
+       if (NULL == data || NULL == buf)
331
 
+               return -EINVAL;
332
 
+
333
 
+       sinfo = (struct smi_thermal_info *)data;
334
 
+
335
 
+       s += sprintf(buf, "%lu \n", sinfo->caps);
336
 
+
337
 
+       return (s - buf);
338
 
+}
339
 
+
340
 
+static struct thermal_device_ops smi_thermal_ops = {
341
 
+       .getthrottlelimit = smi_thermal_device_get_throttle_limit,
342
 
+       .setthrottlelimit = smi_thermal_device_set_throttle_limit,
343
 
+       .getmaxthrottlelimit = smi_thermal_device_get_maxthrottle_limit,
344
 
+       .getcaps = smi_thermal_device_get_caps,
345
 
+};
346
 
+
347
 
+/*
348
 
+ * smi_get_thermalops
349
 
+ * -------------------
350
 
+ * Interface for other drivers which uses SMI for throttling
351
 
+ */
352
 
+struct thermal_device_ops *smi_get_thermalops(void)
353
 
+{
354
 
+       return &smi_thermal_ops;
355
 
+}
356
 
+EXPORT_SYMBOL(smi_get_thermalops);
357
 
+
358
 
+static int __init smi_thermal_init(void)
359
 
+{
360
 
+       return 0;
361
 
+}
362
 
+
363
 
+static void __exit smi_thermal_exit(void)
364
 
+{
365
 
+
366
 
+}
367
 
+
368
 
+module_init(smi_thermal_init);
369
 
+module_exit(smi_thermal_exit);
370
 
+
371
 
+MODULE_ALIAS("smi_thermal");
372
 
diff --git a/include/linux/smi_thermal.h b/include/linux/smi_thermal.h
373
 
new file mode 100644
374
 
index 0000000..ba428ad
375
 
--- /dev/null
376
 
+++ b/include/linux/smi_thermal.h
377
 
@@ -0,0 +1,60 @@
378
 
+/*
379
 
+*  smi_thermal.h - Generic smi driver for thermal extensions ($Revision: 1 $)
380
 
+*
381
 
+*  Copyright (C) 2006, 2007 Sujith Thomas <sujith.thomas@intel.com>
382
 
+*  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
383
 
+*
384
 
+*  This program is free software; you can redistribute it and/or modify
385
 
+*  it under the terms of the GNU General Public License as published by
386
 
+*  the Free Software Foundation; version 2 of the License.
387
 
+*
388
 
+*  This program is distributed in the hope that it will be useful, but
389
 
+*  WITHOUT ANY WARRANTY; without even the implied warranty of
390
 
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
391
 
+*  General Public License for more details.
392
 
+*
393
 
+*  You should have received a copy of the GNU General Public License along
394
 
+*  with this program; if not, write to the Free Software Foundation, Inc.,
395
 
+*  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
396
 
+*
397
 
+* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
398
 
+*
399
 
+*
400
 
+*
401
 
+*/
402
 
+
403
 
+#include <linux/thermal.h>
404
 
+
405
 
+#define SMI_MAX_THROTTLE_LIMIT 8
406
 
+
407
 
+struct smi_thermal_info {
408
 
+       /*ACPI device name (eg:- TZ00)*/
409
 
+       char name[ACPI_MAX_CHAR];
410
 
+       /*Command port for SMI driver*/
411
 
+       unsigned int cmdport;
412
 
+       /*Data port for SMI driver*/
413
 
+       unsigned int dataport;
414
 
+       /*Command code for set new throttle limit*/
415
 
+       unsigned int setthrottlelimit;
416
 
+       /*Command code for get current throttle limit*/
417
 
+       unsigned int getthrottlelimit;
418
 
+       /*Command code for get max throttle limit*/
419
 
+       unsigned int getmaxthrottle;
420
 
+       /*Argument passed for getting max throttle limit*/
421
 
+       unsigned int maxdat;
422
 
+       /*Argument passed for getting current throttle limit*/
423
 
+       unsigned int getdat;
424
 
+
425
 
+       /*Device capabilities*/
426
 
+       unsigned long caps;
427
 
+       struct thermal_device *td;
428
 
+       struct thermal_device_driver driver;
429
 
+};
430
 
+
431
 
+/*
432
 
+ * smi_get_thermalops
433
 
+ * -------------------
434
 
+ * Interface for other drivers which uses SMI for throttling
435
 
+ * for getting the callback functions
436
 
+ */
437
 
+struct thermal_device_ops *smi_get_thermalops(void);
438
 
1.5.2.4
439