diff options
author | 2008-07-26 14:54:09 +0000 | |
---|---|---|
committer | 2008-07-26 14:54:09 +0000 | |
commit | 85deec3c07b459b9b42fe2664517cb85b71cb674 (patch) | |
tree | ea86210fa1121747ed1178e4ef40e533f9ebc3bf /sys-kernel | |
parent | x11-drivers/xf86-video-radeonhd: Adjust dependencies for dri flag (diff) | |
download | jokey-85deec3c07b459b9b42fe2664517cb85b71cb674.tar.gz jokey-85deec3c07b459b9b42fe2664517cb85b71cb674.tar.bz2 jokey-85deec3c07b459b9b42fe2664517cb85b71cb674.zip |
bump to 2.6.26 thinkpad-sources
svn path=/trunk/; revision=437
Diffstat (limited to 'sys-kernel')
14 files changed, 817 insertions, 2040 deletions
diff --git a/sys-kernel/thinkpad-sources/ChangeLog b/sys-kernel/thinkpad-sources/ChangeLog index 97bbe11..98131b2 100644 --- a/sys-kernel/thinkpad-sources/ChangeLog +++ b/sys-kernel/thinkpad-sources/ChangeLog @@ -1,5 +1,25 @@ + 26 Jul 2008; Florian Manschwetus <florianmanschwetus@gmx.de> + -files/2.6.25/04-linux-phc-0.3.1-for-2.6.25.patch, + -files/2.6.25/vt-fix.patch, + -files/2.6.25/kernel-2.6.25-export-init_mm.patch, + +files/2.6.26/power-off-unused-ports.patch, + +files/2.6.26/linux-phc-0.3.2-kernel-vanilla-2.6.26.patch, + -thinkpad-sources-2.6.25.ebuild, + -files/2.6.25/colored-printk-2.6.25.part1.patch, + -files/2.6.25/colored-printk-2.6.25.part2.patch, + -files/2.6.25/colored-printk-2.6.25.part3.patch, + -files/2.6.25/02-disk-protect-for-2.6.25.patch, + -files/2.6.25/03-ipw2200-inject-for-2.6.25.patch, + +thinkpad-sources-2.6.26.ebuild, + +files/2.6.26/colored-printk-2.6.26.patch, -files/2.6.25, + -files/2.6.25/pci-e_aspm_v3.5.patch, +files/2.6.26, + -files/2.6.25/kernel-2.6.25-rcu-license.patch, + +files/2.6.26/01-disk-protect-for-2.6.26.patch, + +files/2.6.26/02-ipw2200-inject-for-2.6.26.patch: + bump to 2.6.26 + 09 Jun 2008; Florian Manschwetus <FlorianManschwetus@gmx.de> -files/2.6.24/linux-phc-0.3.1-for-2.6.24-rc1.patch, +files/2.6.25-r1/04-linux-phc-0.3.1-for-2.6.25.patch, -files/2.6.24-r1, diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/colored-printk-2.6.25.part1.patch b/sys-kernel/thinkpad-sources/files/2.6.25/colored-printk-2.6.25.part1.patch deleted file mode 100644 index e239571..0000000 --- a/sys-kernel/thinkpad-sources/files/2.6.25/colored-printk-2.6.25.part1.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig -index 47c6be8..a55a1c9 100644 ---- a/drivers/char/Kconfig -+++ b/drivers/char/Kconfig -@@ -58,6 +58,49 @@ config VT_CONSOLE - - If unsure, say Y. - -+config VT_CKO -+ bool "Colored kernel message output" -+ depends on VT_CONSOLE -+ ---help--- -+ This option enables kernel messages to be emitted in -+ colors other than the default. -+ This option enlarges your kernel by approximately 1/2 KB. -+ -+ If unsure, say N. -+ -+config VT_PRINTK_COLOR -+ hex "Colored kernel message output" -+ range 0x00 0xFF -+ depends on VT_CKO -+ default 0x07 -+ ---help--- -+ This option defines with which color kernel messages will be -+ printed to the console. -+ -+ The value you need to enter here is the value is composed -+ (OR-ed) of a foreground and a background color. -+ -+ Foreground: -+ 0x00 = black, 0x08 = dark gray, -+ 0x01 = red, 0x09 = light red, -+ 0x02 = green, 0x0A = light green, -+ 0x03 = brown, 0x0B = yellow, -+ 0x04 = blue, 0x0C = light blue, -+ 0x05 = magenta, 0x0D = light magenta, -+ 0x06 = cyan, 0x0E = light cyan, -+ 0x07 = gray, 0x0F = white, -+ -+ (Foreground colors 0x08 to 0x0F do not work when a VGA -+ console font with 512 glyphs is used.) -+ -+ Background: -+ 0x00 = black, 0x40 = blue, -+ 0x10 = red, 0x50 = magenta, -+ 0x20 = green, 0x60 = cyan, -+ 0x30 = brown, 0x70 = gray, -+ -+ For example, 0x1F would yield white on red. -+ - config HW_CONSOLE - bool - depends on VT && !S390 && !UML -diff --git a/drivers/char/vt.c b/drivers/char/vt.c -index 159c9e2..cf61236 100644 ---- a/drivers/char/vt.c -+++ b/drivers/char/vt.c -@@ -73,6 +73,7 @@ - */ - - #include <linux/module.h> -+#include <linux/moduleparam.h> - #include <linux/types.h> - #include <linux/sched.h> - #include <linux/tty.h> -@@ -2392,6 +2393,24 @@ struct tty_driver *console_driver; - - #ifdef CONFIG_VT_CONSOLE - -+#ifdef CONFIG_VT_CKO -+static unsigned int printk_color __read_mostly = CONFIG_VT_PRINTK_COLOR; -+module_param(printk_color, uint, S_IRUGO | S_IWUSR); -+ -+static void vc_set_color(struct vc_data *vc, unsigned char color) -+{ -+ vc->vc_color = color_table[color & 0xF] | -+ (color_table[(color >> 4) & 0x7] << 4) | -+ (color & 0x80); -+ update_attr(vc); -+} -+#else -+static const unsigned int printk_color; -+static inline void vc_set_color(const struct vc_data *vc, unsigned char c) -+{ -+} -+#endif -+ - /* - * Console on virtual terminal - * -@@ -2434,6 +2453,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) - hide_cursor(vc); - - start = (ushort *)vc->vc_pos; -+ vc_set_color(vc, printk_color); - - /* Contrived structure to try to emulate original need_wrap behaviour - * Problems caused when we have need_wrap set on '\n' character */ -@@ -2482,6 +2502,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) - } - } - set_cursor(vc); -+ vc_set_color(vc, vc->vc_def_color); - notify_update(vc); - - quit: --- -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html -Please read the FAQ at http://www.tux.org/lkml/ - diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/colored-printk-2.6.25.part2.patch b/sys-kernel/thinkpad-sources/files/2.6.25/colored-printk-2.6.25.part2.patch deleted file mode 100644 index 231e9d0..0000000 --- a/sys-kernel/thinkpad-sources/files/2.6.25/colored-printk-2.6.25.part2.patch +++ /dev/null @@ -1,220 +0,0 @@ -diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c -index cff84cd..ba137a4 100644 ---- a/arch/x86/kernel/early_printk.c -+++ b/arch/x86/kernel/early_printk.c -@@ -15,7 +15,8 @@ - static int max_ypos = 25, max_xpos = 80; - static int current_ypos = 25, current_xpos = 0; - --static void early_vga_write(struct console *con, const char *str, unsigned n) -+static void early_vga_write(struct console *con, const char *str, unsigned n, -+ unsigned int loglevel) - { - char c; - int i, k, j; -@@ -84,7 +85,8 @@ static int early_serial_putc(unsigned char ch) - return timeout ? 0 : -1; - } - --static void early_serial_write(struct console *con, const char *s, unsigned n) -+static void early_serial_write(struct console *con, const char *s, unsigned n, -+ unsigned int loglevel) - { - while (*s && n-- > 0) { - if (*s == '\n') -@@ -180,7 +182,8 @@ static void __init simnow_init(char *str) - simnow_fd = simnow(XOPEN, (unsigned long)fn, O_WRONLY|O_APPEND|O_CREAT, 0644); - } - --static void simnow_write(struct console *con, const char *s, unsigned n) -+static void simnow_write(struct console *con, const char *s, unsigned n, -+ unsigned int loglevel) - { - simnow(XWRITE, simnow_fd, (unsigned long)s, n); - } -@@ -204,7 +207,7 @@ void early_printk(const char *fmt, ...) - - va_start(ap,fmt); - n = vscnprintf(buf,512,fmt,ap); -- early_console->write(early_console,buf,n); -+ early_console->write(early_console, buf, n, 0); - va_end(ap); - } - -diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig -index a55a1c9..3f5877e 100644 ---- a/drivers/char/Kconfig -+++ b/drivers/char/Kconfig -@@ -75,7 +75,9 @@ config VT_PRINTK_COLOR - default 0x07 - ---help--- - This option defines with which color kernel messages will be -- printed to the console. -+ printed to the console. This applies to all log levels. -+ You can change the colors at run-time, or set them at boot-time -+ using the "vt.printk_color" option. - - The value you need to enter here is the value is composed - (OR-ed) of a foreground and a background color. -diff --git a/drivers/char/vt.c b/drivers/char/vt.c -index cf61236..75ca0cf 100644 ---- a/drivers/char/vt.c -+++ b/drivers/char/vt.c -@@ -2394,8 +2394,17 @@ struct tty_driver *console_driver; - #ifdef CONFIG_VT_CONSOLE - - #ifdef CONFIG_VT_CKO --static unsigned int printk_color __read_mostly = CONFIG_VT_PRINTK_COLOR; --module_param(printk_color, uint, S_IRUGO | S_IWUSR); -+static unsigned int printk_color[8] __read_mostly = { -+ CONFIG_VT_PRINTK_COLOR, /* KERN_EMERG */ -+ CONFIG_VT_PRINTK_COLOR, /* KERN_ALERT */ -+ CONFIG_VT_PRINTK_COLOR, /* KERN_CRIT */ -+ CONFIG_VT_PRINTK_COLOR, /* KERN_ERR */ -+ CONFIG_VT_PRINTK_COLOR, /* KERN_WARNING */ -+ CONFIG_VT_PRINTK_COLOR, /* KERN_NOTICE */ -+ CONFIG_VT_PRINTK_COLOR, /* KERN_INFO */ -+ CONFIG_VT_PRINTK_COLOR, /* KERN_DEBUG */ -+}; -+module_param_array(printk_color, uint, NULL, S_IRUGO | S_IWUSR); - - static void vc_set_color(struct vc_data *vc, unsigned char color) - { -@@ -2405,7 +2414,7 @@ static void vc_set_color(struct vc_data *vc, unsigned char color) - update_attr(vc); - } - #else --static const unsigned int printk_color; -+static const unsigned int printk_color[8]; - static inline void vc_set_color(const struct vc_data *vc, unsigned char c) - { - } -@@ -2417,10 +2426,11 @@ static inline void vc_set_color(const struct vc_data *vc, unsigned char c) - * The console must be locked when we get here. - */ - --static void vt_console_print(struct console *co, const char *b, unsigned count) -+static void vt_console_print(struct console *co, const char *b, -+ unsigned int count, unsigned int loglevel) - { - struct vc_data *vc = vc_cons[fg_console].d; -- unsigned char c; -+ unsigned char current_color, c; - static DEFINE_SPINLOCK(printing_lock); - const ushort *start; - ushort cnt = 0; -@@ -2453,7 +2463,13 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) - hide_cursor(vc); - - start = (ushort *)vc->vc_pos; -- vc_set_color(vc, printk_color); -+ -+ /* -+ * We always get a valid loglevel - <8> and "no level" is transformed -+ * to <4> in the typical kernel. -+ */ -+ current_color = printk_color[loglevel]; -+ vc_set_color(vc, current_color); - - /* Contrived structure to try to emulate original need_wrap behaviour - * Problems caused when we have need_wrap set on '\n' character */ -diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c -index 665341e..ae04e77 100644 ---- a/drivers/net/netconsole.c -+++ b/drivers/net/netconsole.c -@@ -694,7 +694,8 @@ static struct notifier_block netconsole_netdev_notifier = { - .notifier_call = netconsole_netdev_event, - }; - --static void write_msg(struct console *con, const char *msg, unsigned int len) -+static void write_msg(struct console *con, const char *msg, unsigned int len, -+ unsigned int loglevel) - { - int frag, left; - unsigned long flags; -diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c -index 77f7a7f..21a0ebf 100644 ---- a/drivers/serial/8250.c -+++ b/drivers/serial/8250.c -@@ -2466,7 +2466,8 @@ static void serial8250_console_putchar(struct uart_port *port, int ch) - * The console_lock must be held when we get here. - */ - static void --serial8250_console_write(struct console *co, const char *s, unsigned int count) -+serial8250_console_write(struct console *co, const char *s, unsigned int count, -+ unsigned int loglevel) - { - struct uart_8250_port *up = &serial8250_ports[co->index]; - unsigned long flags; -diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c -index 38776e8..88aa01c 100644 ---- a/drivers/serial/8250_early.c -+++ b/drivers/serial/8250_early.c -@@ -83,7 +83,8 @@ static void __init serial_putc(struct uart_port *port, int c) - } - - static void __init early_serial8250_write(struct console *console, -- const char *s, unsigned int count) -+ const char *s, unsigned int count, -+ unsigned int loglevel) - { - struct uart_port *port = &early_device.port; - unsigned int ier; -diff --git a/include/linux/console.h b/include/linux/console.h -index a5f88a6..23626e6 100644 ---- a/include/linux/console.h -+++ b/include/linux/console.h -@@ -94,7 +94,8 @@ void give_up_console(const struct consw *sw); - - struct console { - char name[16]; -- void (*write)(struct console *, const char *, unsigned); -+ void (*write)(struct console *, const char *, -+ unsigned int, unsigned int); - int (*read)(struct console *, char *, unsigned); - struct tty_driver *(*device)(struct console *, int *); - void (*unblank)(void); -diff --git a/kernel/printk.c b/kernel/printk.c -index bdd4ea8..809ba4b 100644 ---- a/kernel/printk.c -+++ b/kernel/printk.c -@@ -435,7 +435,8 @@ asmlinkage long sys_syslog(int type, char __user *buf, int len) - /* - * Call the console drivers on a range of log_buf - */ --static void __call_console_drivers(unsigned start, unsigned end) -+static void __call_console_drivers(unsigned int start, unsigned int end, -+ unsigned int loglevel) - { - struct console *con; - -@@ -443,7 +444,7 @@ static void __call_console_drivers(unsigned start, unsigned end) - if ((con->flags & CON_ENABLED) && con->write && - (cpu_online(smp_processor_id()) || - (con->flags & CON_ANYTIME))) -- con->write(con, &LOG_BUF(start), end - start); -+ con->write(con, &LOG_BUF(start), end - start, loglevel); - } - } - -@@ -470,10 +471,11 @@ static void _call_console_drivers(unsigned start, - if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) { - /* wrapped write */ - __call_console_drivers(start & LOG_BUF_MASK, -- log_buf_len); -- __call_console_drivers(0, end & LOG_BUF_MASK); -+ log_buf_len, msg_log_level); -+ __call_console_drivers(0, end & LOG_BUF_MASK, -+ msg_log_level); - } else { -- __call_console_drivers(start, end); -+ __call_console_drivers(start, end, msg_log_level); - } - } - } --- -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html -Please read the FAQ at http://www.tux.org/lkml/ - diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/colored-printk-2.6.25.part3.patch b/sys-kernel/thinkpad-sources/files/2.6.25/colored-printk-2.6.25.part3.patch deleted file mode 100644 index 06d9f6c..0000000 --- a/sys-kernel/thinkpad-sources/files/2.6.25/colored-printk-2.6.25.part3.patch +++ /dev/null @@ -1,146 +0,0 @@ -diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig -index 3f5877e..600c75a 100644 ---- a/drivers/char/Kconfig -+++ b/drivers/char/Kconfig -@@ -58,28 +58,20 @@ config VT_CONSOLE - - If unsure, say Y. - --config VT_CKO -+menuconfig VT_CKO - bool "Colored kernel message output" - depends on VT_CONSOLE - ---help--- - This option enables kernel messages to be emitted in - colors other than the default. -+ You can also change the colors at run-time, or set them at boot-time -+ using the "vt.printk_color" option. -+ - This option enlarges your kernel by approximately 1/2 KB. - - If unsure, say N. - --config VT_PRINTK_COLOR -- hex "Colored kernel message output" -- range 0x00 0xFF -- depends on VT_CKO -- default 0x07 -- ---help--- -- This option defines with which color kernel messages will be -- printed to the console. This applies to all log levels. -- You can change the colors at run-time, or set them at boot-time -- using the "vt.printk_color" option. -- -- The value you need to enter here is the value is composed -+ The value you need to enter is the value is composed - (OR-ed) of a foreground and a background color. - - Foreground: -@@ -103,6 +95,74 @@ config VT_PRINTK_COLOR - - For example, 0x1F would yield white on red. - -+if VT_CKO -+ -+config VT_PRINTK_EMERG_COLOR -+ hex 'Color for "emergency" level' -+ range 0x00 0xFF -+ default 0x07 -+ ---help--- -+ This option defines in which color kernel emergency messages -+ will be printed to the console. -+ -+config VT_PRINTK_ALERT_COLOR -+ hex 'Color for "alert" level' -+ range 0x00 0xFF -+ default 0x07 -+ ---help--- -+ This option defines in which color kernel alert messages -+ will be printed to the console. -+ -+config VT_PRINTK_CRIT_COLOR -+ hex 'Color for "critical" level' -+ range 0x00 0xFF -+ default 0x07 -+ ---help--- -+ This option defines in which color critical kernel messages -+ will be printed to the console. -+ -+config VT_PRINTK_ERROR_COLOR -+ hex 'Color for "error" level' -+ range 0x00 0xFF -+ default 0x07 -+ ---help--- -+ This option defines in which color kernel error messages -+ will be printed to the console. -+ -+config VT_PRINTK_WARNING_COLOR -+ hex 'Color for "warning" level' -+ range 0x00 0xFF -+ default 0x07 -+ ---help--- -+ This option defines in which color kernel warning messages -+ will be printed to the console. -+ -+config VT_PRINTK_NOTICE_COLOR -+ hex 'Color for "notice" level' -+ range 0x00 0xFF -+ default 0x07 -+ ---help--- -+ This option defines in which color kernel notices -+ will be printed to the console. -+ -+config VT_PRINTK_INFO_COLOR -+ hex 'Color for "info" level' -+ range 0x00 0xFF -+ default 0x07 -+ ---help--- -+ This option defines in which color informational kernel messages -+ will be printed to the console. -+ -+config VT_PRINTK_DEBUG_COLOR -+ hex 'Color for "debug" level' -+ range 0x00 0xFF -+ default 0x07 -+ ---help--- -+ This option defines in which color kernel debugging messages -+ will be printed to the console. -+ -+endif # VT_CKO -+ - config HW_CONSOLE - bool - depends on VT && !S390 && !UML -diff --git a/drivers/char/vt.c b/drivers/char/vt.c -index 75ca0cf..a3f2ff3 100644 ---- a/drivers/char/vt.c -+++ b/drivers/char/vt.c -@@ -2395,14 +2395,14 @@ struct tty_driver *console_driver; - - #ifdef CONFIG_VT_CKO - static unsigned int printk_color[8] __read_mostly = { -- CONFIG_VT_PRINTK_COLOR, /* KERN_EMERG */ -- CONFIG_VT_PRINTK_COLOR, /* KERN_ALERT */ -- CONFIG_VT_PRINTK_COLOR, /* KERN_CRIT */ -- CONFIG_VT_PRINTK_COLOR, /* KERN_ERR */ -- CONFIG_VT_PRINTK_COLOR, /* KERN_WARNING */ -- CONFIG_VT_PRINTK_COLOR, /* KERN_NOTICE */ -- CONFIG_VT_PRINTK_COLOR, /* KERN_INFO */ -- CONFIG_VT_PRINTK_COLOR, /* KERN_DEBUG */ -+ CONFIG_VT_PRINTK_EMERG_COLOR, -+ CONFIG_VT_PRINTK_ALERT_COLOR, -+ CONFIG_VT_PRINTK_CRIT_COLOR, -+ CONFIG_VT_PRINTK_ERROR_COLOR, -+ CONFIG_VT_PRINTK_WARNING_COLOR, -+ CONFIG_VT_PRINTK_NOTICE_COLOR, -+ CONFIG_VT_PRINTK_INFO_COLOR, -+ CONFIG_VT_PRINTK_DEBUG_COLOR, - }; - module_param_array(printk_color, uint, NULL, S_IRUGO | S_IWUSR); - --- -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html -Please read the FAQ at http://www.tux.org/lkml/ - diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/kernel-2.6.25-export-init_mm.patch b/sys-kernel/thinkpad-sources/files/2.6.25/kernel-2.6.25-export-init_mm.patch deleted file mode 100644 index 5f95a6b..0000000 --- a/sys-kernel/thinkpad-sources/files/2.6.25/kernel-2.6.25-export-init_mm.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- arch/x86/kernel/init_task.c.orig 2008-04-17 04:49:44.000000000 +0200 -+++ arch/x86/kernel/init_task.c 2008-04-17 23:52:15.000000000 +0200 -@@ -15,7 +15,7 @@ - static struct signal_struct init_signals = INIT_SIGNALS(init_signals); - static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); - struct mm_struct init_mm = INIT_MM(init_mm); --EXPORT_UNUSED_SYMBOL(init_mm); /* will be removed in 2.6.26 */ -+EXPORT_SYMBOL(init_mm); /* will be removed in 2.6.26 */ // temporary kludge - - /* - * Initial thread structure. diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/kernel-2.6.25-rcu-license.patch b/sys-kernel/thinkpad-sources/files/2.6.25/kernel-2.6.25-rcu-license.patch deleted file mode 100644 index fbdb7c2..0000000 --- a/sys-kernel/thinkpad-sources/files/2.6.25/kernel-2.6.25-rcu-license.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- kernel/rcupreempt.c.orig 2008-04-17 04:49:44.000000000 +0200 -+++ kernel/rcupreempt.c 2008-04-19 12:27:19.000000000 +0200 -@@ -283,7 +283,7 @@ - local_irq_restore(flags); - } - } --EXPORT_SYMBOL_GPL(__rcu_read_lock); -+EXPORT_SYMBOL(__rcu_read_lock); - - void __rcu_read_unlock(void) - { -@@ -353,7 +353,7 @@ - local_irq_restore(flags); - } - } --EXPORT_SYMBOL_GPL(__rcu_read_unlock); -+EXPORT_SYMBOL(__rcu_read_unlock); - - /* - * If a global counter flip has occurred since the last time that we diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/pci-e_aspm_v3.5.patch b/sys-kernel/thinkpad-sources/files/2.6.25/pci-e_aspm_v3.5.patch deleted file mode 100644 index ecdc8cb..0000000 --- a/sys-kernel/thinkpad-sources/files/2.6.25/pci-e_aspm_v3.5.patch +++ /dev/null @@ -1,1101 +0,0 @@ -PCI Express ASPM defines a protocol for PCI Express components in the D0 -state to reduce Link power by placing their Links into a low power state -and instructing the other end of the Link to do likewise. This -capability allows hardware-autonomous, dynamic Link power reduction -beyond what is achievable by software-only controlled power management. -However, The device should be configured by software appropriately. -Enabling ASPM will save power, but will introduce device latency. - -This patch adds ASPM support in Linux. It introduces a global policy for -ASPM, a sysfs file /sys/module/pcie_aspm/parameters/policy can control -it. The interface can be used as a boot option too. Currently we have -below setting: - -default, BIOS default setting - -powersave, highest power saving mode, enable all available ASPM -state and clock power management - -performance, highest performance, disable ASPM and clock power -management -By default, the 'default' policy is used currently. - -In my test, power difference between powersave mode and performance mode -is about 1.3w in a system with 3 PCIE links. - -Note: some devices might not work well with aspm, either because chipset -issue or device issue. The patch provide API (pci_disable_link_state), -driver can disable ASPM for specific device. - -Signed-off-by: Shaohua Li <shaohua.li <at> intel.com> ---- - drivers/pci/pci-sysfs.c | 5 - drivers/pci/pci.c | 4 - drivers/pci/pcie/Kconfig | 20 + - drivers/pci/pcie/Makefile | 3 - drivers/pci/pcie/aspm.c | 811 ++++++++++++++++++++++++++++++++++++++++++++++ - drivers/pci/probe.c | 5 - drivers/pci/remove.c | 4 - include/linux/pci-aspm.h | 56 +++ - include/linux/pci.h | 5 - include/linux/pci_regs.h | 8 - 10 files changed, 921 insertions(+) - -Index: linux/drivers/pci/pcie/Makefile -=================================================================== ---- linux.orig/drivers/pci/pcie/Makefile 2008-02-20 10:22:16.000000000 +0800 -+++ linux/drivers/pci/pcie/Makefile 2008-02-20 13:59:10.000000000 +0800 -@@ -2,6 +2,9 @@ - # Makefile for PCI-Express PORT Driver - # - -+# Build PCI Express ASPM if needed -+obj-$(CONFIG_PCIEASPM) += aspm.o -+ - pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o - - obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o -Index: linux/drivers/pci/pcie/aspm.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux/drivers/pci/pcie/aspm.c 2008-02-20 14:09:59.000000000 +0800 -@@ -0,0 +1,811 @@ -+/* -+ * File: drivers/pci/pcie/aspm.c -+ * Enabling PCIE link L0s/L1 state and Clock Power Management -+ * -+ * Copyright (C) 2007 Intel -+ * Copyright (C) Zhang Yanmin (yanmin.zhang <at> intel.com) -+ * Copyright (C) Shaohua Li (shaohua.li <at> intel.com) -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/moduleparam.h> -+#include <linux/pci.h> -+#include <linux/pci_regs.h> -+#include <linux/errno.h> -+#include <linux/pm.h> -+#include <linux/init.h> -+#include <linux/slab.h> -+#include <linux/pci-aspm.h> -+#include "../pci.h" -+ -+#ifdef MODULE_PARAM_PREFIX -+#undef MODULE_PARAM_PREFIX -+#endif -+#define MODULE_PARAM_PREFIX "pcie_aspm." -+ -+struct endpoint_state { -+ unsigned int l0s_acceptable_latency; -+ unsigned int l1_acceptable_latency; -+}; -+ -+struct pcie_link_state { -+ struct list_head sibiling; -+ struct pci_dev *pdev; -+ -+ /* ASPM state */ -+ unsigned int support_state; -+ unsigned int enabled_state; -+ unsigned int bios_aspm_state; -+ /* upstream component */ -+ unsigned int l0s_upper_latency; -+ unsigned int l1_upper_latency; -+ /* downstream component */ -+ unsigned int l0s_down_latency; -+ unsigned int l1_down_latency; -+ /* Clock PM state*/ -+ unsigned int clk_pm_capable; -+ unsigned int clk_pm_enabled; -+ unsigned int bios_clk_state; -+ -+ /* -+ * A pcie downstream port only has one slot under it, so at most there -+ * are 8 functions -+ */ -+ struct endpoint_state endpoints[8]; -+}; -+ -+static int aspm_disabled; -+static DEFINE_MUTEX(aspm_lock); -+static LIST_HEAD(link_list); -+ -+#define POLICY_DEFAULT 0 /* BIOS default setting */ -+#define POLICY_PERFORMANCE 1 /* high performance */ -+#define POLICY_POWERSAVE 2 /* high power saving */ -+static int aspm_policy; -+static const char *policy_str[] = { -+ [POLICY_DEFAULT] = "default", -+ [POLICY_PERFORMANCE] = "performance", -+ [POLICY_POWERSAVE] = "powersave" -+}; -+ -+static int policy_to_aspm_state(struct pci_dev *pdev) -+{ -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ switch (aspm_policy) { -+ case POLICY_PERFORMANCE: -+ /* Disable ASPM and Clock PM */ -+ return 0; -+ case POLICY_POWERSAVE: -+ /* Enable ASPM L0s/L1 */ -+ return PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1; -+ case POLICY_DEFAULT: -+ return link_state->bios_aspm_state; -+ } -+ return 0; -+} -+ -+static int policy_to_clkpm_state(struct pci_dev *pdev) -+{ -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ switch (aspm_policy) { -+ case POLICY_PERFORMANCE: -+ /* Disable ASPM and Clock PM */ -+ return 0; -+ case POLICY_POWERSAVE: -+ /* Disable Clock PM */ -+ return 1; -+ case POLICY_DEFAULT: -+ return link_state->bios_clk_state; -+ } -+ return 0; -+} -+ -+static void pcie_set_clock_pm(struct pci_dev *pdev, int enable) -+{ -+ struct pci_dev *child_dev; -+ int pos; -+ u16 reg16; -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { -+ pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); -+ if (!pos) -+ return; -+ pci_read_config_word(child_dev, pos + PCI_EXP_LNKCTL, ®16); -+ if (enable) -+ reg16 |= PCI_EXP_LNKCTL_CLKREQ_EN; -+ else -+ reg16 &= ~PCI_EXP_LNKCTL_CLKREQ_EN; -+ pci_write_config_word(child_dev, pos + PCI_EXP_LNKCTL, reg16); -+ } -+ link_state->clk_pm_enabled = !!enable; -+} -+ -+static void pcie_check_clock_pm(struct pci_dev *pdev) -+{ -+ int pos; -+ u32 reg32; -+ u16 reg16; -+ int capable = 1, enabled = 1; -+ struct pci_dev *child_dev; -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ /* All functions should have the same cap and state, take the worst */ -+ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { -+ pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); -+ if (!pos) -+ return; -+ pci_read_config_dword(child_dev, pos + PCI_EXP_LNKCAP, ®32); -+ if (!(reg32 & PCI_EXP_LNKCAP_CLKPM)) { -+ capable = 0; -+ enabled = 0; -+ break; -+ } -+ pci_read_config_word(child_dev, pos + PCI_EXP_LNKCTL, ®16); -+ if (!(reg16 & PCI_EXP_LNKCTL_CLKREQ_EN)) -+ enabled = 0; -+ } -+ link_state->clk_pm_capable = capable; -+ link_state->clk_pm_enabled = enabled; -+ link_state->bios_clk_state = enabled; -+ pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev)); -+} -+ -+/* -+ * pcie_aspm_configure_common_clock: check if the 2 ends of a link -+ * could use common clock. If they are, configure them to use the -+ * common clock. That will reduce the ASPM state exit latency. -+ */ -+static void pcie_aspm_configure_common_clock(struct pci_dev *pdev) -+{ -+ int pos, child_pos; -+ u16 reg16 = 0; -+ struct pci_dev *child_dev; -+ int same_clock = 1; -+ -+ /* -+ * all functions of a slot should have the same Slot Clock -+ * Configuration, so just check one function -+ * */ -+ child_dev = list_entry(pdev->subordinate->devices.next, struct pci_dev, -+ bus_list); -+ BUG_ON(!child_dev->is_pcie); -+ -+ /* Check downstream component if bit Slot Clock Configuration is 1 */ -+ child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); -+ pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKSTA, ®16); -+ if (!(reg16 & PCI_EXP_LNKSTA_SLC)) -+ same_clock = 0; -+ -+ /* Check upstream component if bit Slot Clock Configuration is 1 */ -+ pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); -+ pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, ®16); -+ if (!(reg16 & PCI_EXP_LNKSTA_SLC)) -+ same_clock = 0; -+ -+ /* Configure downstream component, all functions */ -+ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { -+ child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); -+ pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKCTL, -+ ®16); -+ if (same_clock) -+ reg16 |= PCI_EXP_LNKCTL_CCC; -+ else -+ reg16 &= ~PCI_EXP_LNKCTL_CCC; -+ pci_write_config_word(child_dev, child_pos + PCI_EXP_LNKCTL, -+ reg16); -+ } -+ -+ /* Configure upstream component */ -+ pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); -+ if (same_clock) -+ reg16 |= PCI_EXP_LNKCTL_CCC; -+ else -+ reg16 &= ~PCI_EXP_LNKCTL_CCC; -+ pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); -+ -+ /* retrain link */ -+ reg16 |= PCI_EXP_LNKCTL_RL; -+ pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); -+ -+ /* Wait for link training end */ -+ while (1) { -+ pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, ®16); -+ if (!(reg16 & PCI_EXP_LNKSTA_LT)) -+ break; -+ cpu_relax(); -+ } -+} -+ -+/* -+ * calc_L0S_latency: Convert L0s latency encoding to ns -+ */ -+static unsigned int calc_L0S_latency(unsigned int latency_encoding, int ac) -+{ -+ unsigned int ns = 64; -+ -+ if (latency_encoding == 0x7) { -+ if (ac) -+ ns = -1U; -+ else -+ ns = 5*1000; /* > 4us */ -+ } else -+ ns *= (1 << latency_encoding); -+ return ns; -+} -+ -+/* -+ * calc_L1_latency: Convert L1 latency encoding to ns -+ */ -+static unsigned int calc_L1_latency(unsigned int latency_encoding, int ac) -+{ -+ unsigned int ns = 1000; -+ -+ if (latency_encoding == 0x7) { -+ if (ac) -+ ns = -1U; -+ else -+ ns = 65*1000; /* > 64us */ -+ } else -+ ns *= (1 << latency_encoding); -+ return ns; -+} -+ -+static void pcie_aspm_get_cap_device(struct pci_dev *pdev, u32 *state, -+ unsigned int *l0s, unsigned int *l1, unsigned int *enabled) -+{ -+ int pos; -+ u16 reg16; -+ u32 reg32; -+ unsigned int latency; -+ -+ pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); -+ pci_read_config_dword(pdev, pos + PCI_EXP_LNKCAP, ®32); -+ *state = (reg32 & PCI_EXP_LNKCAP_ASPMS) >> 10; -+ if (*state != PCIE_LINK_STATE_L0S && -+ *state != (PCIE_LINK_STATE_L1|PCIE_LINK_STATE_L0S)) -+ *state = 0; -+ if (*state == 0) -+ return; -+ -+ latency = (reg32 & PCI_EXP_LNKCAP_L0SEL) >> 12; -+ *l0s = calc_L0S_latency(latency, 0); -+ if (*state & PCIE_LINK_STATE_L1) { -+ latency = (reg32 & PCI_EXP_LNKCAP_L1EL) >> 15; -+ *l1 = calc_L1_latency(latency, 0); -+ } -+ pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); -+ *enabled = reg16 & (PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1); -+} -+ -+static void pcie_aspm_cap_init(struct pci_dev *pdev) -+{ -+ struct pci_dev *child_dev; -+ u32 state, tmp; -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ /* upstream component states */ -+ pcie_aspm_get_cap_device(pdev, &link_state->support_state, -+ &link_state->l0s_upper_latency, -+ &link_state->l1_upper_latency, -+ &link_state->enabled_state); -+ /* downstream component states, all functions have the same setting */ -+ child_dev = list_entry(pdev->subordinate->devices.next, struct pci_dev, -+ bus_list); -+ pcie_aspm_get_cap_device(child_dev, &state, -+ &link_state->l0s_down_latency, -+ &link_state->l1_down_latency, -+ &tmp); -+ link_state->support_state &= state; -+ if (!link_state->support_state) -+ return; -+ link_state->enabled_state &= link_state->support_state; -+ link_state->bios_aspm_state = link_state->enabled_state; -+ -+ /* ENDPOINT states*/ -+ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { -+ int pos; -+ u32 reg32; -+ unsigned int latency; -+ struct endpoint_state *ep_state = -+ &link_state->endpoints[PCI_FUNC(child_dev->devfn)]; -+ -+ if (child_dev->pcie_type != PCI_EXP_TYPE_ENDPOINT && -+ child_dev->pcie_type != PCI_EXP_TYPE_LEG_END) -+ continue; -+ -+ pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); -+ pci_read_config_dword(child_dev, pos + PCI_EXP_DEVCAP, ®32); -+ latency = (reg32 & PCI_EXP_DEVCAP_L0S) >> 6; -+ latency = calc_L0S_latency(latency, 1); -+ ep_state->l0s_acceptable_latency = latency; -+ if (link_state->support_state & PCIE_LINK_STATE_L1) { -+ latency = (reg32 & PCI_EXP_DEVCAP_L1) >> 9; -+ latency = calc_L1_latency(latency, 1); -+ ep_state->l1_acceptable_latency = latency; -+ } -+ } -+} -+ -+static unsigned int __pcie_aspm_check_state_one(struct pci_dev *pdev, -+ unsigned int state) -+{ -+ struct pci_dev *parent_dev, *tmp_dev; -+ unsigned int latency, l1_latency = 0; -+ struct pcie_link_state *link_state; -+ struct endpoint_state *ep_state; -+ -+ parent_dev = pdev->bus->self; -+ link_state = parent_dev->link_state; -+ state &= link_state->support_state; -+ if (state == 0) -+ return 0; -+ ep_state = &link_state->endpoints[PCI_FUNC(pdev->devfn)]; -+ -+ /* -+ * Check latency for endpoint device. -+ * TBD: The latency from the endpoint to root complex vary per -+ * switch's upstream link state above the device. Here we just do a -+ * simple check which assumes all links above the device can be in L1 -+ * state, that is we just consider the worst case. If switch's upstream -+ * link can't be put into L0S/L1, then our check is too strictly. -+ */ -+ tmp_dev = pdev; -+ while (state & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) { -+ parent_dev = tmp_dev->bus->self; -+ link_state = parent_dev->link_state; -+ if (state & PCIE_LINK_STATE_L0S) { -+ latency = max_t(unsigned int, -+ link_state->l0s_upper_latency, -+ link_state->l0s_down_latency); -+ if (latency > ep_state->l0s_acceptable_latency) -+ state &= ~PCIE_LINK_STATE_L0S; -+ } -+ if (state & PCIE_LINK_STATE_L1) { -+ latency = max_t(unsigned int, -+ link_state->l1_upper_latency, -+ link_state->l1_down_latency); -+ if (latency + l1_latency > -+ ep_state->l1_acceptable_latency) -+ state &= ~PCIE_LINK_STATE_L1; -+ } -+ if (!parent_dev->bus->self) /* parent_dev is a root port */ -+ break; -+ else { -+ /* -+ * parent_dev is the downstream port of a switch, make -+ * tmp_dev the upstream port of the switch -+ */ -+ tmp_dev = parent_dev->bus->self; -+ /* -+ * every switch on the path to root complex need 1 more -+ * microsecond for L1. Spec doesn't mention L0S. -+ */ -+ if (state & PCIE_LINK_STATE_L1) -+ l1_latency += 1000; -+ } -+ } -+ return state; -+} -+ -+static unsigned int pcie_aspm_check_state(struct pci_dev *pdev, -+ unsigned int state) -+{ -+ struct pci_dev *child_dev; -+ -+ /* If no child, disable the link */ -+ if (list_empty(&pdev->subordinate->devices)) -+ return 0; -+ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { -+ if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) { -+ /* -+ * If downstream component of a link is pci bridge, we -+ * disable ASPM for now for the link -+ * */ -+ state = 0; -+ break; -+ } -+ if ((child_dev->pcie_type != PCI_EXP_TYPE_ENDPOINT && -+ child_dev->pcie_type != PCI_EXP_TYPE_LEG_END)) -+ continue; -+ /* Device not in D0 doesn't need check latency */ -+ if (child_dev->current_state == PCI_D1 || -+ child_dev->current_state == PCI_D2 || -+ child_dev->current_state == PCI_D3hot || -+ child_dev->current_state == PCI_D3cold) -+ continue; -+ state = __pcie_aspm_check_state_one(child_dev, state); -+ } -+ return state; -+} -+ -+static void __pcie_aspm_config_one_dev(struct pci_dev *pdev, unsigned int state) -+{ -+ u16 reg16; -+ int pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); -+ -+ pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); -+ reg16 &= ~0x3; -+ reg16 |= state; -+ pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); -+} -+ -+static void __pcie_aspm_config_link(struct pci_dev *pdev, unsigned int state) -+{ -+ struct pci_dev *child_dev; -+ int valid = 1; -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ /* -+ * if the downstream component has pci bridge function, don't do ASPM -+ * now -+ */ -+ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { -+ if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) { -+ valid = 0; -+ break; -+ } -+ } -+ if (!valid) -+ return; -+ -+ /* -+ * spec 2.0 suggests all functions should be configured the same -+ * setting for ASPM. Enabling ASPM L1 should be done in upstream -+ * component first and then downstream, and vice versa for disabling -+ * ASPM L1. Spec doesn't mention L0S. -+ */ -+ if (state & PCIE_LINK_STATE_L1) -+ __pcie_aspm_config_one_dev(pdev, state); -+ -+ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) -+ __pcie_aspm_config_one_dev(child_dev, state); -+ -+ if (!(state & PCIE_LINK_STATE_L1)) -+ __pcie_aspm_config_one_dev(pdev, state); -+ -+ link_state->enabled_state = state; -+} -+ -+static void __pcie_aspm_configure_link_state(struct pci_dev *pdev, -+ unsigned int state) -+{ -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ if (link_state->support_state == 0) -+ return; -+ state &= PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1; -+ -+ /* state 0 means disabling aspm */ -+ state = pcie_aspm_check_state(pdev, state); -+ if (link_state->enabled_state == state) -+ return; -+ __pcie_aspm_config_link(pdev, state); -+} -+ -+/* -+ * pcie_aspm_configure_link_state: enable/disable PCI express link state -+ * @pdev: the root port or switch downstream port -+ */ -+static void pcie_aspm_configure_link_state(struct pci_dev *pdev, -+ unsigned int state) -+{ -+ down_read(&pci_bus_sem); -+ mutex_lock(&aspm_lock); -+ __pcie_aspm_configure_link_state(pdev, state); -+ mutex_unlock(&aspm_lock); -+ up_read(&pci_bus_sem); -+} -+ -+static void free_link_state(struct pci_dev *pdev) -+{ -+ kfree(pdev->link_state); -+ pdev->link_state = NULL; -+} -+ -+/* -+ * pcie_aspm_init_link_state: Initiate PCI express link state. -+ * It is called after the pcie and its children devices are scaned. -+ * @pdev: the root port or switch downstream port -+ */ -+void pcie_aspm_init_link_state(struct pci_dev *pdev) -+{ -+ unsigned int state; -+ struct pcie_link_state *link_state; -+ int error = 0; -+ -+ if (aspm_disabled || !pdev->is_pcie || pdev->link_state) -+ return; -+ if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && -+ pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) -+ return; -+ down_read(&pci_bus_sem); -+ if (list_empty(&pdev->subordinate->devices)) -+ goto out; -+ -+ mutex_lock(&aspm_lock); -+ -+ link_state = kzalloc(sizeof(*link_state), GFP_KERNEL); -+ if (!link_state) -+ goto unlock_out; -+ pdev->link_state = link_state; -+ -+ pcie_aspm_configure_common_clock(pdev); -+ -+ pcie_aspm_cap_init(pdev); -+ -+ /* config link state to avoid BIOS error */ -+ state = pcie_aspm_check_state(pdev, policy_to_aspm_state(pdev)); -+ __pcie_aspm_config_link(pdev, state); -+ -+ pcie_check_clock_pm(pdev); -+ -+ link_state->pdev = pdev; -+ list_add(&link_state->sibiling, &link_list); -+ -+unlock_out: -+ if (error) -+ free_link_state(pdev); -+ mutex_unlock(&aspm_lock); -+out: -+ up_read(&pci_bus_sem); -+} -+ -+/* @pdev: the endpoint device */ -+void pcie_aspm_exit_link_state(struct pci_dev *pdev) -+{ -+ struct pci_dev *parent = pdev->bus->self; -+ struct pcie_link_state *link_state = parent->link_state; -+ -+ if (aspm_disabled || !pdev->is_pcie || !parent || !link_state) -+ return; -+ if (parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT && -+ parent->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) -+ return; -+ down_read(&pci_bus_sem); -+ mutex_lock(&aspm_lock); -+ -+ /* -+ * All PCIe functions are in one slot, remove one function will remove -+ * the the whole slot, so just wait -+ */ -+ if (!list_empty(&parent->subordinate->devices)) -+ goto out; -+ -+ /* All functions are removed, so just disable ASPM for the link */ -+ __pcie_aspm_config_one_dev(parent, 0); -+ list_del(&link_state->sibiling); -+ /* Clock PM is for endpoint device */ -+ -+ free_link_state(parent); -+out: -+ mutex_unlock(&aspm_lock); -+ up_read(&pci_bus_sem); -+} -+ -+/* @pdev: the root port or switch downstream port */ -+void pcie_aspm_pm_state_change(struct pci_dev *pdev) -+{ -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ if (aspm_disabled || !pdev->is_pcie || !pdev->link_state) -+ return; -+ if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && -+ pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) -+ return; -+ /* -+ * devices changed PM state, we should recheck if latency meets all -+ * functions' requirement -+ */ -+ pcie_aspm_configure_link_state(pdev, link_state->enabled_state); -+} -+ -+/* -+ * pci_disable_link_state - disable pci device's link state, so the link will -+ * never enter specific states -+ */ -+void pci_disable_link_state(struct pci_dev *pdev, int state) -+{ -+ struct pci_dev *parent = pdev->bus->self; -+ struct pcie_link_state *link_state; -+ -+ if (aspm_disabled || !pdev->is_pcie) -+ return; -+ if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT || -+ pdev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM) -+ parent = pdev; -+ if (!parent || !parent->link_state) -+ return; -+ -+ down_read(&pci_bus_sem); -+ mutex_lock(&aspm_lock); -+ link_state = parent->link_state; -+ link_state->support_state &= -+ ~(state & (PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1)); -+ if (state & PCIE_LINK_STATE_CLKPM) -+ link_state->clk_pm_capable = 0; -+ -+ __pcie_aspm_configure_link_state(parent, link_state->enabled_state); -+ if (!link_state->clk_pm_capable && link_state->clk_pm_enabled) -+ pcie_set_clock_pm(parent, 0); -+ mutex_unlock(&aspm_lock); -+ up_read(&pci_bus_sem); -+} -+EXPORT_SYMBOL(pci_disable_link_state); -+ -+static int pcie_aspm_set_policy(const char *val, struct kernel_param *kp) -+{ -+ int i; -+ struct pci_dev *pdev; -+ struct pcie_link_state *link_state; -+ -+ for (i = 0; i < ARRAY_SIZE(policy_str); i++) -+ if (!strncmp(val, policy_str[i], strlen(policy_str[i]))) -+ break; -+ if (i >= ARRAY_SIZE(policy_str)) -+ return -EINVAL; -+ if (i == aspm_policy) -+ return 0; -+ -+ down_read(&pci_bus_sem); -+ mutex_lock(&aspm_lock); -+ aspm_policy = i; -+ list_for_each_entry(link_state, &link_list, sibiling) { -+ pdev = link_state->pdev; -+ __pcie_aspm_configure_link_state(pdev, -+ policy_to_aspm_state(pdev)); -+ if (link_state->clk_pm_capable && -+ link_state->clk_pm_enabled != policy_to_clkpm_state(pdev)) -+ pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev)); -+ -+ } -+ mutex_unlock(&aspm_lock); -+ up_read(&pci_bus_sem); -+ return 0; -+} -+ -+static int pcie_aspm_get_policy(char *buffer, struct kernel_param *kp) -+{ -+ int i, cnt = 0; -+ for (i = 0; i < ARRAY_SIZE(policy_str); i++) -+ if (i == aspm_policy) -+ cnt += sprintf(buffer + cnt, "[%s] ", policy_str[i]); -+ else -+ cnt += sprintf(buffer + cnt, "%s ", policy_str[i]); -+ return cnt; -+} -+ -+module_param_call(policy, pcie_aspm_set_policy, pcie_aspm_get_policy, -+ NULL, 0644); -+ -+#ifdef CONFIG_PCIEASPM_DEBUG -+static ssize_t link_state_show(struct device *dev, -+ struct device_attribute *attr, -+ char *buf) -+{ -+ struct pci_dev *pci_device = to_pci_dev(dev); -+ struct pcie_link_state *link_state = pci_device->link_state; -+ -+ return sprintf(buf, "%d\n", link_state->enabled_state); -+} -+ -+static ssize_t link_state_store(struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, -+ size_t n) -+{ -+ struct pci_dev *pci_device = to_pci_dev(dev); -+ int state; -+ -+ if (n < 1) -+ return -EINVAL; -+ state = buf[0]-'0'; -+ if (state >= 0 && state <= 3) { -+ /* setup link aspm state */ -+ pcie_aspm_configure_link_state(pci_device, state); -+ return n; -+ } -+ -+ return -EINVAL; -+} -+ -+static ssize_t clk_ctl_show(struct device *dev, -+ struct device_attribute *attr, -+ char *buf) -+{ -+ struct pci_dev *pci_device = to_pci_dev(dev); -+ struct pcie_link_state *link_state = pci_device->link_state; -+ -+ return sprintf(buf, "%d\n", link_state->clk_pm_enabled); -+} -+ -+static ssize_t clk_ctl_store(struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, -+ size_t n) -+{ -+ struct pci_dev *pci_device = to_pci_dev(dev); -+ int state; -+ -+ if (n < 1) -+ return -EINVAL; -+ state = buf[0]-'0'; -+ -+ down_read(&pci_bus_sem); -+ mutex_lock(&aspm_lock); -+ pcie_set_clock_pm(pci_device, !!state); -+ mutex_unlock(&aspm_lock); -+ up_read(&pci_bus_sem); -+ -+ return n; -+} -+ -+static DEVICE_ATTR(link_state, 0644, link_state_show, link_state_store); -+static DEVICE_ATTR(clk_ctl, 0644, clk_ctl_show, clk_ctl_store); -+ -+static char power_group[] = "power"; -+void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) -+{ -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ if (!pdev->is_pcie || (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && -+ pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) || !link_state) -+ return; -+ -+ if (link_state->support_state) -+ sysfs_add_file_to_group(&pdev->dev.kobj, -+ &dev_attr_link_state.attr, power_group); -+ if (link_state->clk_pm_capable) -+ sysfs_add_file_to_group(&pdev->dev.kobj, -+ &dev_attr_clk_ctl.attr, power_group); -+} -+ -+void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) -+{ -+ struct pcie_link_state *link_state = pdev->link_state; -+ -+ if (!pdev->is_pcie || (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && -+ pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) || !link_state) -+ return; -+ -+ if (link_state->support_state) -+ sysfs_remove_file_from_group(&pdev->dev.kobj, -+ &dev_attr_link_state.attr, power_group); -+ if (link_state->clk_pm_capable) -+ sysfs_remove_file_from_group(&pdev->dev.kobj, -+ &dev_attr_clk_ctl.attr, power_group); -+} -+#endif -+ -+static int __init pcie_aspm_disable(char *str) -+{ -+ aspm_disabled = 1; -+ return 1; -+} -+ -+__setup("pcie_noaspm", pcie_aspm_disable); -+ -+#ifdef CONFIG_ACPI -+#include <acpi/acpi_bus.h> -+#include <linux/pci-acpi.h> -+static void pcie_aspm_platform_init(void) -+{ -+ pcie_osc_support_set(OSC_ACTIVE_STATE_PWR_SUPPORT| -+ OSC_CLOCK_PWR_CAPABILITY_SUPPORT); -+} -+#else -+static inline void pcie_aspm_platform_init(void) { } -+#endif -+ -+static int __init pcie_aspm_init(void) -+{ -+ if (aspm_disabled) -+ return 0; -+ pcie_aspm_platform_init(); -+ return 0; -+} -+ -+fs_initcall(pcie_aspm_init); -Index: linux/drivers/pci/pcie/Kconfig -=================================================================== ---- linux.orig/drivers/pci/pcie/Kconfig 2008-02-20 10:22:16.000000000 +0800 -+++ linux/drivers/pci/pcie/Kconfig 2008-02-20 13:59:10.000000000 +0800 -@@ -26,3 +26,23 @@ config HOTPLUG_PCI_PCIE - When in doubt, say N. - - source "drivers/pci/pcie/aer/Kconfig" -+ -+# -+# PCI Express ASPM -+# -+config PCIEASPM -+ bool "PCI Express ASPM support(Experimental)" -+ depends on PCI && EXPERIMENTAL && PCIEPORTBUS -+ default y -+ help -+ This enables PCI Express ASPM (Active State Power Management) and -+ Clock Power Management. ASPM supports state L0/L0s/L1. -+ -+ When in doubt, say N. -+config PCIEASPM_DEBUG -+ bool "Debug PCI Express ASPM" -+ depends on PCIEASPM -+ default n -+ help -+ This enables PCI Express ASPM debug support. It will add per-device -+ interface to control ASPM. -Index: linux/include/linux/pci.h -=================================================================== ---- linux.orig/include/linux/pci.h 2008-02-20 10:22:16.000000000 +0800 -+++ linux/include/linux/pci.h 2008-02-20 13:59:10.000000000 +0800 -@@ -128,6 +128,7 @@ struct pci_cap_saved_state { - u32 data[0]; - }; - -+struct pcie_link_state; - /* - * The pci_dev structure is used to describe PCI devices. - */ -@@ -165,6 +166,10 @@ struct pci_dev { - this is D0-D3, D0 being fully functional, - and D3 being off. */ - -+#ifdef CONFIG_PCIEASPM -+ struct pcie_link_state *link_state; /* ASPM link state. */ -+#endif -+ - pci_channel_state_t error_state; /* current connectivity state */ - struct device dev; /* Generic device interface */ - -Index: linux/include/linux/pci_regs.h -=================================================================== ---- linux.orig/include/linux/pci_regs.h 2008-02-20 10:22:16.000000000 +0800 -+++ linux/include/linux/pci_regs.h 2008-02-20 13:59:10.000000000 +0800 -@@ -395,9 +395,17 @@ - #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ - #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ - #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ -+#define PCI_EXP_LNKCAP_ASPMS 0xc00 /* ASPM Support */ -+#define PCI_EXP_LNKCAP_L0SEL 0x7000 /* L0s Exit Latency */ -+#define PCI_EXP_LNKCAP_L1EL 0x38000 /* L1 Exit Latency */ -+#define PCI_EXP_LNKCAP_CLKPM 0x40000 /* L1 Clock Power Management */ - #define PCI_EXP_LNKCTL 16 /* Link Control */ -+#define PCI_EXP_LNKCTL_RL 0x20 /* Retrain Link */ -+#define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */ - #define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ - #define PCI_EXP_LNKSTA 18 /* Link Status */ -+#define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */ -+#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ - #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ - #define PCI_EXP_SLTCTL 24 /* Slot Control */ - #define PCI_EXP_SLTSTA 26 /* Slot Status */ -Index: linux/drivers/pci/probe.c -=================================================================== ---- linux.orig/drivers/pci/probe.c 2008-02-20 10:22:16.000000000 +0800 -+++ linux/drivers/pci/probe.c 2008-02-20 13:59:10.000000000 +0800 -@@ -9,6 +9,7 @@ - #include <linux/slab.h> - #include <linux/module.h> - #include <linux/cpumask.h> -+#include <linux/pci-aspm.h> - #include "pci.h" - - #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ -@@ -1005,6 +1006,10 @@ int pci_scan_slot(struct pci_bus *bus, i - break; - } - } -+ -+ if (bus->self) -+ pcie_aspm_init_link_state(bus->self); -+ - return nr; - } - -Index: linux/drivers/pci/remove.c -=================================================================== ---- linux.orig/drivers/pci/remove.c 2008-02-20 10:22:16.000000000 +0800 -+++ linux/drivers/pci/remove.c 2008-02-20 13:59:10.000000000 +0800 -@@ -1,5 +1,6 @@ - #include <linux/pci.h> - #include <linux/module.h> -+#include <linux/pci-aspm.h> - #include "pci.h" - - static void pci_free_resources(struct pci_dev *dev) -@@ -30,6 +31,9 @@ static void pci_stop_dev(struct pci_dev - dev->global_list.next = dev->global_list.prev = NULL; - up_write(&pci_bus_sem); - } -+ -+ if (dev->bus->self) -+ pcie_aspm_exit_link_state(dev); - } - - static void pci_destroy_dev(struct pci_dev *dev) -Index: linux/drivers/pci/pci.c -=================================================================== ---- linux.orig/drivers/pci/pci.c 2008-02-20 10:22:16.000000000 +0800 -+++ linux/drivers/pci/pci.c 2008-02-20 13:59:10.000000000 +0800 -@@ -18,6 +18,7 @@ - #include <linux/spinlock.h> - #include <linux/string.h> - #include <linux/log2.h> -+#include <linux/pci-aspm.h> - #include <asm/dma.h> /* isa_dma_bridge_buggy */ - #include "pci.h" - -@@ -519,6 +520,9 @@ pci_set_power_state(struct pci_dev *dev, - if (need_restore) - pci_restore_bars(dev); - -+ if (dev->bus->self) -+ pcie_aspm_pm_state_change(dev->bus->self); -+ - return 0; - } - -Index: linux/drivers/pci/pci-sysfs.c -=================================================================== ---- linux.orig/drivers/pci/pci-sysfs.c 2008-02-20 10:22:16.000000000 +0800 -+++ linux/drivers/pci/pci-sysfs.c 2008-02-20 13:59:10.000000000 +0800 -@@ -21,6 +21,7 @@ - #include <linux/topology.h> - #include <linux/mm.h> - #include <linux/capability.h> -+#include <linux/pci-aspm.h> - #include "pci.h" - - static int sysfs_initialized; /* = 0 */ -@@ -650,6 +651,8 @@ int __must_check pci_create_sysfs_dev_fi - if (pcibios_add_platform_entries(pdev)) - goto err_rom_file; - -+ pcie_aspm_create_sysfs_dev_files(pdev); -+ - return 0; - - err_rom_file: -@@ -679,6 +682,8 @@ void pci_remove_sysfs_dev_files(struct p - if (!sysfs_initialized) - return; - -+ pcie_aspm_remove_sysfs_dev_files(pdev); -+ - if (pdev->cfg_size < 4096) - sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); - else -Index: linux/include/linux/pci-aspm.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux/include/linux/pci-aspm.h 2008-02-20 13:59:10.000000000 +0800 -@@ -0,0 +1,56 @@ -+/* -+ * aspm.h -+ * -+ * PCI Express ASPM defines and function prototypes -+ * -+ * Copyright (C) 2007 Intel Corp. -+ * Zhang Yanmin (yanmin.zhang <at> intel.com) -+ * Shaohua Li (shaohua.li <at> intel.com) -+ * -+ * For more information, please consult the following manuals (look at -+ * http://www.pcisig.com/ for how to get them): -+ * -+ * PCI Express Specification -+ */ -+ -+#ifndef LINUX_ASPM_H -+#define LINUX_ASPM_H -+ -+#include <linux/pci.h> -+ -+#define PCIE_LINK_STATE_L0S 1 -+#define PCIE_LINK_STATE_L1 2 -+#define PCIE_LINK_STATE_CLKPM 4 -+ -+#ifdef CONFIG_PCIEASPM -+extern void pcie_aspm_init_link_state(struct pci_dev *pdev); -+extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); -+extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); -+extern void pci_disable_link_state(struct pci_dev *pdev, int state); -+#else -+static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) -+{ -+} -+static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) -+{ -+} -+static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) -+{ -+} -+static inline void pci_disable_link_state(struct pci_dev *pdev, int state) -+{ -+} -+#endif -+ -+#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ -+extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); -+extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); -+#else -+static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) -+{ -+} -+static inline void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) -+{ -+} -+#endif -+#endif /* LINUX_ASPM_H */ - diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/vt-fix.patch b/sys-kernel/thinkpad-sources/files/2.6.25/vt-fix.patch deleted file mode 100644 index 62c7a7e..0000000 --- a/sys-kernel/thinkpad-sources/files/2.6.25/vt-fix.patch +++ /dev/null @@ -1,146 +0,0 @@ -diff --git a/drivers/char/vt.c b/drivers/char/vt.c -index 9b58b89..159c9e2 100644 ---- a/drivers/char/vt.c -+++ b/drivers/char/vt.c -@@ -301,7 +301,7 @@ static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr) - d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); - s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr)); - scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row); -- scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_video_erase_char, -+ scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_scrl_erase_char, - vc->vc_size_row * nr); - } - -@@ -319,7 +319,7 @@ static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr) - s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t); - step = vc->vc_cols * nr; - scr_memmovew(s + step, s, (b - t - nr) * vc->vc_size_row); -- scr_memsetw(s, vc->vc_video_erase_char, 2 * step); -+ scr_memsetw(s, vc->vc_scrl_erase_char, 2 * step); - } - - static void do_update_region(struct vc_data *vc, unsigned long start, int count) -@@ -400,7 +400,7 @@ static u8 build_attr(struct vc_data *vc, u8 _color, u8 _intensity, u8 _blink, - * Bit 7 : blink - */ - { -- u8 a = vc->vc_color; -+ u8 a = _color; - if (!vc->vc_can_do_color) - return _intensity | - (_italic ? 2 : 0) | -@@ -434,6 +434,7 @@ static void update_attr(struct vc_data *vc) - vc->vc_blink, vc->vc_underline, - vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic); - vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << 8) | ' '; -+ vc->vc_scrl_erase_char = (build_attr(vc, vc->vc_def_color, 1, false, false, false, false) << 8) | ' '; - } - - /* Note: inverting the screen twice should revert to the original state */ -diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c -index 0222824..ca2a543 100644 ---- a/drivers/video/console/fbcon.c -+++ b/drivers/video/console/fbcon.c -@@ -1882,7 +1882,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, - scr_memsetw((unsigned short *) (vc->vc_origin + - vc->vc_size_row * - (b - count)), -- vc->vc_video_erase_char, -+ vc->vc_scrl_erase_char, - vc->vc_size_row * count); - return 1; - break; -@@ -1954,7 +1954,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, - scr_memsetw((unsigned short *) (vc->vc_origin + - vc->vc_size_row * - (b - count)), -- vc->vc_video_erase_char, -+ vc->vc_scrl_erase_char, - vc->vc_size_row * count); - return 1; - } -@@ -1973,7 +1973,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, - scr_memsetw((unsigned short *) (vc->vc_origin + - vc->vc_size_row * - t), -- vc->vc_video_erase_char, -+ vc->vc_scrl_erase_char, - vc->vc_size_row * count); - return 1; - break; -@@ -2043,7 +2043,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, - scr_memsetw((unsigned short *) (vc->vc_origin + - vc->vc_size_row * - t), -- vc->vc_video_erase_char, -+ vc->vc_scrl_erase_char, - vc->vc_size_row * count); - return 1; - } -diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c -index bd8d995..38a296b 100644 ---- a/drivers/video/console/mdacon.c -+++ b/drivers/video/console/mdacon.c -@@ -531,7 +531,7 @@ static void mdacon_cursor(struct vc_data *c, int mode) - - static int mdacon_scroll(struct vc_data *c, int t, int b, int dir, int lines) - { -- u16 eattr = mda_convert_attr(c->vc_video_erase_char); -+ u16 eattr = mda_convert_attr(c->vc_scrl_erase_char); - - if (!lines) - return 0; -diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c -index 67a682d..a11cc2f 100644 ---- a/drivers/video/console/sticon.c -+++ b/drivers/video/console/sticon.c -@@ -170,12 +170,12 @@ static int sticon_scroll(struct vc_data *conp, int t, int b, int dir, int count) - switch (dir) { - case SM_UP: - sti_bmove(sti, t + count, 0, t, 0, b - t - count, conp->vc_cols); -- sti_clear(sti, b - count, 0, count, conp->vc_cols, conp->vc_video_erase_char); -+ sti_clear(sti, b - count, 0, count, conp->vc_cols, conp->vc_scrl_erase_char); - break; - - case SM_DOWN: - sti_bmove(sti, t, 0, t + count, 0, b - t - count, conp->vc_cols); -- sti_clear(sti, t, 0, count, conp->vc_cols, conp->vc_video_erase_char); -+ sti_clear(sti, t, 0, count, conp->vc_cols, conp->vc_scrl_erase_char); - break; - } - -diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c -index 6df29a6..bd1f57b 100644 ---- a/drivers/video/console/vgacon.c -+++ b/drivers/video/console/vgacon.c -@@ -1350,7 +1350,7 @@ static int vgacon_scroll(struct vc_data *c, int t, int b, int dir, - } else - c->vc_origin += delta; - scr_memsetw((u16 *) (c->vc_origin + c->vc_screenbuf_size - -- delta), c->vc_video_erase_char, -+ delta), c->vc_scrl_erase_char, - delta); - } else { - if (oldo - delta < vga_vram_base) { -@@ -1363,7 +1363,7 @@ static int vgacon_scroll(struct vc_data *c, int t, int b, int dir, - } else - c->vc_origin -= delta; - c->vc_scr_end = c->vc_origin + c->vc_screenbuf_size; -- scr_memsetw((u16 *) (c->vc_origin), c->vc_video_erase_char, -+ scr_memsetw((u16 *) (c->vc_origin), c->vc_scrl_erase_char, - delta); - } - c->vc_scr_end = c->vc_origin + c->vc_screenbuf_size; -diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h -index d71f7c0..b03f80a 100644 ---- a/include/linux/console_struct.h -+++ b/include/linux/console_struct.h -@@ -53,6 +53,7 @@ struct vc_data { - unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ - struct console_font vc_font; /* Current VC font set */ - unsigned short vc_video_erase_char; /* Background erase character */ -+ unsigned short vc_scrl_erase_char; /* Erase character for scroll */ - /* VT terminal data */ - unsigned int vc_state; /* Escape sequence parser state */ - unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ - diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/02-disk-protect-for-2.6.25.patch b/sys-kernel/thinkpad-sources/files/2.6.26/01-disk-protect-for-2.6.26.patch index 9738753..d8a2355 100644 --- a/sys-kernel/thinkpad-sources/files/2.6.25/02-disk-protect-for-2.6.25.patch +++ b/sys-kernel/thinkpad-sources/files/2.6.26/01-disk-protect-for-2.6.26.patch @@ -1,10 +1,96 @@ -diff -Naur a/block/blk-core.c b/block/blk-core.c ---- a/block/blk-core.c 2008-04-13 14:04:22.000000000 +0200 -+++ b/block/blk-core.c 2008-04-13 14:25:48.000000000 +0200 -@@ -320,6 +320,46 @@ +diff --git a/Documentation/block/disk-protection.txt b/Documentation/block/disk-protection.txt +new file mode 100644 +index 0000000..508cc5b +--- /dev/null ++++ b/Documentation/block/disk-protection.txt +@@ -0,0 +1,79 @@ ++Hard disk protection ++==================== ++ ++ ++Intro ++----- ++ATA/ATAPI-7 specifies the IDLE IMMEDIATE command with UNLOAD FEATURE. ++Issuing this command should cause the drive to switch to idle mode and ++unload disk heads. This feature is being used in modern laptops in ++conjunction with accelerometers and appropriate software to implement ++a shock protection facility. The idea is to stop all I/O operations on ++the internal hard drive and park its heads on the ramp when critical ++situations are anticipated. The desire to have such a feature ++available on GNU/Linux systems has been the original motivation to ++implement a generic disk parking interface in the Linux kernel. ++ ++ ++The interface ++------------- ++The interface works as follows: Writing an integer value to ++/sys/block/*/queue/protect will park the respective drive and freeze ++the block layer queue for the specified number of seconds. When the ++timeout expires and no further disk park request has been issued in ++the meantime, the queue is unfrozen and accumulated I/O operations are ++performed. ++ ++IMPORTANT NOTE: ++Not all ATA drives implement IDLE IMMEDIATE with UNLOAD FEATURE and ++quite a few of those that do so, don't report this capability as ++described in the specs. When a disk park has been requested through ++sysfs as described above, the kernel will try to determine if the ++drive supports the UNLOAD FEATURE by default. The kernel will only ++rely on the IDLE IMMEDIATE with UNLOAD FEATURE command if it is ++convinced that this command is actually supported by the disk drive; ++otherwise, it will fall back to STANDBY IMMEDIATE. Resuming from the ++latter will take much longer and it is generally more likely to have a ++negative impact on the drive's lifetime due to the inclease of spin ++down and up cycles. If you want to use this interface in a shock ++protection framework and you know that your drive does indeed support ++the IDLE IMMEDIATE with UNLOAD FEATURE command despite not saying so, ++you can force the kernel to issue that command by doing the following ++on the command line: ++# echo -n unload > /sys/block/sda/queue/protect_method ++(replace sda by the drive identifier as appropriate). ++ ++/sys/block/*/queue/protect_method accepts auto, unload and standby ++respectively. Reading from protect_method shows the available options ++surrounding the active one with brackets. When auto is active, this ++will change to whatever the kernel sees fit after the next disk park ++command has been issued. ++ ++ ++References ++---------- ++ ++There are several laptops from different brands featuring shock ++protection capabilities. As manufacturers have refused to support open ++source development of the required software components so far, Linux ++support for shock protection varies considerably between different ++hardware implementations. Ideally, this section should contain a list ++of poiters at different projects aiming at an implementation of shock ++protection on different systeems. Unfortunately, I only know of a ++single project which, although still considered experimental, is fit ++for use. Please feel free to add projects that have been the victims ++of my ignorance. ++ ++- http://www.thinkwiki.org/wiki/HDAPS ++ See this page for information about Linux support of the hard disk ++ active protection syystem as implemented in IBM/Lenovo Thinkpads. ++ ++ ++CREDITS ++------- ++ ++The patch to implement the interface described in this file has ++originally been published by Jon Escombe <lists@...>. ++ ++ ++05 Dec 2006, Elias Oltmanns <eo@...> +diff --git a/block/blk-core.c b/block/blk-core.c +index 1905aab..0305c21 100644 +--- a/block/blk-core.c ++++ b/block/blk-core.c +@@ -305,6 +305,46 @@ void blk_unplug(struct request_queue *q) } EXPORT_SYMBOL(blk_unplug); - + +/* + * Issue lower level unprotect function if no timers are pending. + */ @@ -48,34 +134,22 @@ diff -Naur a/block/blk-core.c b/block/blk-core.c /** * blk_start_queue - restart a previously stopped queue * @q: The &struct request_queue in question -@@ -482,6 +522,7 @@ +@@ -478,6 +518,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) } - + init_timer(&q->unplug_timer); + init_timer(&q->unfreeze_timer); - + kobject_init(&q->kobj, &blk_queue_ktype); - -diff -Naur a/block/blk.h b/block/blk.h ---- a/block/blk.h 2008-04-13 14:04:22.000000000 +0200 -+++ b/block/blk.h 2008-04-13 14:25:48.000000000 +0200 -@@ -18,6 +18,9 @@ - - void blk_unplug_work(struct work_struct *work); - void blk_unplug_timeout(unsigned long data); -+void blk_unfreeze_work(struct work_struct *work); -+void blk_unfreeze_timeout(unsigned long data); -+void blk_freeze_queue(struct request_queue *q, int seconds); - - struct io_context *current_io_context(gfp_t gfp_flags, int node); - -diff -Naur a/block/blk-settings.c b/block/blk-settings.c ---- a/block/blk-settings.c 2008-04-13 14:04:22.000000000 +0200 -+++ b/block/blk-settings.c 2008-04-13 14:25:48.000000000 +0200 -@@ -112,6 +112,16 @@ + +diff --git a/block/blk-settings.c b/block/blk-settings.c +index 8dd8641..2da72f3 100644 +--- a/block/blk-settings.c ++++ b/block/blk-settings.c +@@ -111,6 +111,16 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn) q->unplug_timer.function = blk_unplug_timeout; q->unplug_timer.data = (unsigned long)q; - + + q->max_unfreeze = 30; + + INIT_WORK(&q->unfreeze_work, blk_unfreeze_work); @@ -89,10 +163,10 @@ diff -Naur a/block/blk-settings.c b/block/blk-settings.c /* * by default assume old behaviour and bounce for any highmem page */ -@@ -119,6 +129,18 @@ +@@ -118,6 +128,18 @@ void blk_queue_make_request(struct request_queue *q, make_request_fn *mfn) } EXPORT_SYMBOL(blk_queue_make_request); - + +void blk_queue_issue_protect_fn(struct request_queue *q, issue_protect_fn *ipf) +{ + q->issue_protect_fn = ipf; @@ -108,13 +182,14 @@ diff -Naur a/block/blk-settings.c b/block/blk-settings.c /** * blk_queue_bounce_limit - set bounce buffer limit for queue * @q: the request queue for the device -diff -Naur a/block/blk-sysfs.c b/block/blk-sysfs.c ---- a/block/blk-sysfs.c 2008-04-13 14:04:22.000000000 +0200 -+++ b/block/blk-sysfs.c 2008-04-13 14:25:48.000000000 +0200 -@@ -270,6 +270,160 @@ +diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c +index 304ec73..2fdca01 100644 +--- a/block/blk-sysfs.c ++++ b/block/blk-sysfs.c +@@ -298,6 +298,160 @@ struct kobj_type blk_queue_ktype = { .release = blk_release_queue, }; - + +/* + * When reading the 'protect' attribute, we return seconds remaining + * before unfreeze timeout expires @@ -272,9 +347,9 @@ diff -Naur a/block/blk-sysfs.c b/block/blk-sysfs.c int blk_register_queue(struct gendisk *disk) { int ret; -@@ -287,13 +441,20 @@ +@@ -318,23 +472,28 @@ int blk_register_queue(struct gendisk *disk) kobject_uevent(&q->kobj, KOBJ_ADD); - + ret = elv_register_queue(q); + if (ret) + goto err; @@ -286,7 +361,7 @@ diff -Naur a/block/blk-sysfs.c b/block/blk-sysfs.c + elv_unregister_queue(q); + goto err; } - + return 0; + +err: @@ -294,115 +369,42 @@ diff -Naur a/block/blk-sysfs.c b/block/blk-sysfs.c + kobject_del(&q->kobj); + return ret; } - + void blk_unregister_queue(struct gendisk *disk) -@@ -301,6 +462,7 @@ + { struct request_queue *q = disk->queue; - - if (q && q->request_fn) { + +- if (WARN_ON(!q)) +- return; +- +- if (q->request_fn) { ++ if (q && q->request_fn) { + blk_protect_unregister(q); elv_unregister_queue(q); - + kobject_uevent(&q->kobj, KOBJ_REMOVE); -diff -Naur a/Documentation/block/disk-protection.txt b/Documentation/block/disk-protection.txt ---- a/Documentation/block/disk-protection.txt 1970-01-01 01:00:00.000000000 +0100 -+++ b/Documentation/block/disk-protection.txt 2008-04-13 14:25:48.000000000 +0200 -@@ -0,0 +1,79 @@ -+Hard disk protection -+==================== -+ -+ -+Intro -+----- -+ATA/ATAPI-7 specifies the IDLE IMMEDIATE command with UNLOAD FEATURE. -+Issuing this command should cause the drive to switch to idle mode and -+unload disk heads. This feature is being used in modern laptops in -+conjunction with accelerometers and appropriate software to implement -+a shock protection facility. The idea is to stop all I/O operations on -+the internal hard drive and park its heads on the ramp when critical -+situations are anticipated. The desire to have such a feature -+available on GNU/Linux systems has been the original motivation to -+implement a generic disk parking interface in the Linux kernel. -+ -+ -+The interface -+------------- -+The interface works as follows: Writing an integer value to -+/sys/block/*/queue/protect will park the respective drive and freeze -+the block layer queue for the specified number of seconds. When the -+timeout expires and no further disk park request has been issued in -+the meantime, the queue is unfrozen and accumulated I/O operations are -+performed. -+ -+IMPORTANT NOTE: -+Not all ATA drives implement IDLE IMMEDIATE with UNLOAD FEATURE and -+quite a few of those that do so, don't report this capability as -+described in the specs. When a disk park has been requested through -+sysfs as described above, the kernel will try to determine if the -+drive supports the UNLOAD FEATURE by default. The kernel will only -+rely on the IDLE IMMEDIATE with UNLOAD FEATURE command if it is -+convinced that this command is actually supported by the disk drive; -+otherwise, it will fall back to STANDBY IMMEDIATE. Resuming from the -+latter will take much longer and it is generally more likely to have a -+negative impact on the drive's lifetime due to the inclease of spin -+down and up cycles. If you want to use this interface in a shock -+protection framework and you know that your drive does indeed support -+the IDLE IMMEDIATE with UNLOAD FEATURE command despite not saying so, -+you can force the kernel to issue that command by doing the following -+on the command line: -+# echo -n unload > /sys/block/sda/queue/protect_method -+(replace sda by the drive identifier as appropriate). -+ -+/sys/block/*/queue/protect_method accepts auto, unload and standby -+respectively. Reading from protect_method shows the available options -+surrounding the active one with brackets. When auto is active, this -+will change to whatever the kernel sees fit after the next disk park -+command has been issued. -+ -+ -+References -+---------- -+ -+There are several laptops from different brands featuring shock -+protection capabilities. As manufacturers have refused to support open -+source development of the required software components so far, Linux -+support for shock protection varies considerably between different -+hardware implementations. Ideally, this section should contain a list -+of poiters at different projects aiming at an implementation of shock -+protection on different systeems. Unfortunately, I only know of a -+single project which, although still considered experimental, is fit -+for use. Please feel free to add projects that have been the victims -+of my ignorance. -+ -+- http://www.thinkwiki.org/wiki/HDAPS -+ See this page for information about Linux support of the hard disk -+ active protection syystem as implemented in IBM/Lenovo Thinkpads. -+ -+ -+CREDITS -+------- -+ -+The patch to implement the interface described in this file has -+originally been published by Jon Escombe <lists-Xbpc2PeERmvQXOPxS62xeg@public.gmane.org>. -+ -+ -+05 Dec 2006, Elias Oltmanns <eo-oA28OIkTjSVZXbeN9DUtxg@public.gmane.org> -diff -Naur a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c ---- a/drivers/ata/libata-scsi.c 2008-04-13 14:04:23.000000000 +0200 -+++ b/drivers/ata/libata-scsi.c 2008-04-13 14:26:04.000000000 +0200 -@@ -831,7 +831,7 @@ - * prevent SCSI midlayer from automatically deferring - * requests. - */ -- sdev->max_device_blocked = 1; -+ sdev->max_device_blocked = 2; - } - - /** -@@ -905,6 +905,38 @@ +diff --git a/block/blk.h b/block/blk.h +index 59776ab..5c89160 100644 +--- a/block/blk.h ++++ b/block/blk.h +@@ -17,6 +17,9 @@ void __blk_queue_free_tags(struct request_queue *q); + + void blk_unplug_work(struct work_struct *work); + void blk_unplug_timeout(unsigned long data); ++void blk_unfreeze_work(struct work_struct *work); ++void blk_unfreeze_timeout(unsigned long data); ++void blk_freeze_queue(struct request_queue *q, int seconds); + + struct io_context *current_io_context(gfp_t gfp_flags, int node); + +diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c +index 57a4364..8f9f118 100644 +--- a/drivers/ata/libata-scsi.c ++++ b/drivers/ata/libata-scsi.c +@@ -917,6 +917,37 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, return 0; } - + +extern int scsi_protect_queue(struct request_queue *q, int unload); +extern int scsi_unprotect_queue(struct request_queue *q); + @@ -412,7 +414,6 @@ diff -Naur a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c + struct ata_port *ap = ata_shost_to_port(sdev->host); + struct ata_device *dev = ata_scsi_find_dev(ap, sdev); + int unload = q->protect_method; -+ unsigned long flags; + + if (!dev) { + printk(KERN_DEBUG "ata_scsi_issue_protect_fn(): Couldn't find ATA device to be parked.\n"); @@ -421,9 +422,7 @@ diff -Naur a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c + + if (unload == 2) { + unload = ata_id_has_unload(dev->id) ? 1 : 0; -+ spin_lock_irqsave(q->queue_lock, flags); + q->protect_method = unload; -+ spin_unlock_irqrestore(q->queue_lock, flags); + } + + /* call scsi_protect_queue, requesting either unload or standby */ @@ -432,38 +431,32 @@ diff -Naur a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c + +static int ata_scsi_issue_unprotect_fn(struct request_queue *q) +{ ++ struct scsi_device *sdev = q->queuedata; ++ + return scsi_unprotect_queue(q); +} + /** * ata_scsi_slave_config - Set SCSI device attributes * @sdev: SCSI device to examine -@@ -927,6 +959,10 @@ - +@@ -939,6 +970,10 @@ int ata_scsi_slave_config(struct scsi_device *sdev) + if (dev) rc = ata_scsi_dev_config(sdev, dev); + blk_queue_issue_protect_fn(sdev->request_queue, + ata_scsi_issue_protect_fn); + blk_queue_issue_unprotect_fn(sdev->request_queue, + ata_scsi_issue_unprotect_fn); - + return rc; } -@@ -3206,7 +3242,7 @@ - * Set host_blocked to 1 to prevent SCSI midlayer from - * automatically deferring requests. - */ -- shost->max_host_blocked = 1; -+ shost->max_host_blocked = 2; - - rc = scsi_add_host(ap->scsi_host, ap->host->dev); - if (rc) -diff -Naur a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c ---- a/drivers/ide/ide-disk.c 2008-04-13 14:04:31.000000000 +0200 -+++ b/drivers/ide/ide-disk.c 2008-04-13 14:25:48.000000000 +0200 -@@ -612,6 +612,148 @@ +diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c +index 8e08d08..5721f43 100644 +--- a/drivers/ide/ide-disk.c ++++ b/drivers/ide/ide-disk.c +@@ -612,6 +612,148 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) } - + /* + * todo: + * - we freeze the queue regardless of success and rely on the @@ -610,22 +603,23 @@ diff -Naur a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c * This is tightly woven into the driver->do_special can not touch. * DON'T do it again until a total personality rewrite is committed. */ -@@ -877,6 +1019,9 @@ +@@ -891,6 +1033,9 @@ static void idedisk_setup(ide_drive_t *drive) drive->wcache = 1; - + write_cache(drive, 1); + + blk_queue_issue_protect_fn(drive->queue, idedisk_issue_protect_fn); + blk_queue_issue_unprotect_fn(drive->queue, idedisk_issue_unprotect_fn); } - + static void ide_cacheflush_p(ide_drive_t *drive) -diff -Naur a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c ---- a/drivers/ide/ide-io.c 2008-04-13 14:04:31.000000000 +0200 -+++ b/drivers/ide/ide-io.c 2008-04-13 14:25:48.000000000 +0200 -@@ -1158,6 +1158,17 @@ +diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c +index 6965253..b40a681 100644 +--- a/drivers/ide/ide-io.c ++++ b/drivers/ide/ide-io.c +@@ -1115,6 +1115,17 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) } - + /* + * Don't accept a request when the queue is stopped (unless we + * are resuming from suspend). Prevents existing queue entries @@ -641,7 +635,7 @@ diff -Naur a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c * Sanity: don't accept a request that isn't a PM request * if we are currently power managed. This is very important as * blk_stop_queue() doesn't prevent the elv_next_request() -@@ -1651,6 +1662,9 @@ +@@ -1607,6 +1618,9 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio where = ELEVATOR_INSERT_FRONT; rq->cmd_flags |= REQ_PREEMPT; } @@ -651,10 +645,11 @@ diff -Naur a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c __elv_add_request(drive->queue, rq, where, 0); ide_do_request(hwgroup, IDE_NO_IRQ); spin_unlock_irqrestore(&ide_lock, flags); -diff -Naur a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c ---- a/drivers/scsi/scsi_lib.c 2008-04-13 14:04:50.000000000 +0200 -+++ b/drivers/scsi/scsi_lib.c 2008-04-13 14:25:48.000000000 +0200 -@@ -2248,7 +2248,13 @@ +diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c +index a82d2fe..1af55f7 100644 +--- a/drivers/scsi/scsi_lib.c ++++ b/drivers/scsi/scsi_lib.c +@@ -2261,7 +2261,13 @@ EXPORT_SYMBOL_GPL(sdev_evt_send_simple); int scsi_device_quiesce(struct scsi_device *sdev) { @@ -667,8 +662,8 @@ diff -Naur a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c + } if (err) return err; - -@@ -2496,3 +2502,168 @@ + +@@ -2509,3 +2515,171 @@ void scsi_kunmap_atomic_sg(void *virt) kunmap_atomic(virt, KM_BIO_SRC_IRQ); } EXPORT_SYMBOL(scsi_kunmap_atomic_sg); @@ -706,8 +701,10 @@ diff -Naur a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c + siocs->result = result; + memcpy(siocs->sense, sense, SCSI_SENSE_BUFFERSIZE); + -+ if (!scsi_device_set_state(siocs->sdev, SDEV_BLOCK)) ++ if (!scsi_device_set_state(siocs->sdev, SDEV_BLOCK)) { ++ siocs->sdev->max_device_blocked = 2; + blk_stop_queue(q); ++ } + + complete(waiting); +} @@ -732,6 +729,7 @@ diff -Naur a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c + rc = scsi_internal_device_unblock(sdev); + if (rc) + return rc; ++ sdev->max_device_blocked = 1; + + if (!pending) { + printk(KERN_DEBUG "scsi_unprotect_queue(): No pending I/O, re-enabling power management..\n"); @@ -837,13 +835,14 @@ diff -Naur a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c + return rc; +} +EXPORT_SYMBOL_GPL(scsi_protect_queue); -diff -Naur a/include/linux/ata.h b/include/linux/ata.h ---- a/include/linux/ata.h 2008-04-13 14:04:53.000000000 +0200 -+++ b/include/linux/ata.h 2008-04-13 14:25:48.000000000 +0200 -@@ -459,6 +459,18 @@ - +diff --git a/include/linux/ata.h b/include/linux/ata.h +index 1c622e2..199a4e3 100644 +--- a/include/linux/ata.h ++++ b/include/linux/ata.h +@@ -459,6 +459,18 @@ static inline int ata_is_data(u8 prot) + #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) - + +static inline int ata_id_has_unload(const u16 *id) +{ + /* ATA-7 specifies two places to indicate unload feature support. @@ -859,31 +858,32 @@ diff -Naur a/include/linux/ata.h b/include/linux/ata.h static inline bool ata_id_has_hipm(const u16 *id) { u16 val = id[76]; -diff -Naur a/include/linux/blkdev.h b/include/linux/blkdev.h ---- a/include/linux/blkdev.h 2008-04-13 14:04:53.000000000 +0200 -+++ b/include/linux/blkdev.h 2008-04-13 14:25:48.000000000 +0200 -@@ -260,6 +260,8 @@ +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index d2a1b71..73e69df 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -263,6 +263,8 @@ typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_ve typedef void (prepare_flush_fn) (struct request_queue *, struct request *); typedef void (softirq_done_fn)(struct request *); typedef int (dma_drain_needed_fn)(struct request *); +typedef int (issue_protect_fn) (struct request_queue *); +typedef int (issue_unprotect_fn) (struct request_queue *); - + enum blk_queue_state { Queue_down, -@@ -297,6 +299,8 @@ +@@ -300,6 +302,8 @@ struct request_queue prepare_flush_fn *prepare_flush_fn; softirq_done_fn *softirq_done_fn; dma_drain_needed_fn *dma_drain_needed; + issue_protect_fn *issue_protect_fn; + issue_unprotect_fn *issue_unprotect_fn; - + /* * Dispatch queue sorting -@@ -312,6 +316,14 @@ +@@ -315,6 +319,14 @@ struct request_queue unsigned long unplug_delay; /* After this many jiffies */ struct work_struct unplug_work; - + + /* + * Auto-unfreeze state + */ @@ -893,21 +893,22 @@ diff -Naur a/include/linux/blkdev.h b/include/linux/blkdev.h + int protect_method; + struct backing_dev_info backing_dev_info; - + /* -@@ -718,6 +730,8 @@ +@@ -764,6 +776,8 @@ extern int blk_do_ordered(struct request_queue *, struct request **); extern unsigned blk_ordered_cur_seq(struct request_queue *); extern unsigned blk_ordered_req_seq(struct request *); extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int); +extern void blk_queue_issue_protect_fn(struct request_queue *, issue_protect_fn *); +extern void blk_queue_issue_unprotect_fn(struct request_queue *, issue_unprotect_fn *); - + extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); extern void blk_dump_rq_flags(struct request *, char *); -diff -Naur a/include/linux/ide.h b/include/linux/ide.h ---- a/include/linux/ide.h 2008-04-13 14:04:53.000000000 +0200 -+++ b/include/linux/ide.h 2008-04-13 14:25:48.000000000 +0200 -@@ -837,6 +837,7 @@ +diff --git a/include/linux/ide.h b/include/linux/ide.h +index 9918772..d7c7762 100644 +--- a/include/linux/ide.h ++++ b/include/linux/ide.h +@@ -864,6 +864,7 @@ extern void ide_init_drive_cmd (struct request *rq); */ typedef enum { ide_wait, /* insert rq at end of list, and wait for it */ diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/03-ipw2200-inject-for-2.6.25.patch b/sys-kernel/thinkpad-sources/files/2.6.26/02-ipw2200-inject-for-2.6.26.patch index ffb49a9..38191f4 100644 --- a/sys-kernel/thinkpad-sources/files/2.6.25/03-ipw2200-inject-for-2.6.25.patch +++ b/sys-kernel/thinkpad-sources/files/2.6.26/02-ipw2200-inject-for-2.6.26.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ipw2200.c 2007-10-07 12:41:29.000000000 +0200 +++ b/drivers/net/wireless/ipw2200.c 2007-10-07 12:50:43.000000000 +0200 -@@ -1860,6 +1860,66 @@ +@@ -1862,6 +1862,66 @@ static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO, show_net_stats, store_net_stats); @@ -67,7 +67,7 @@ static ssize_t show_channels(struct device *d, struct device_attribute *attr, char *buf) -@@ -11498,6 +11558,7 @@ +@@ -11505,6 +11565,7 @@ #ifdef CONFIG_IPW2200_PROMISCUOUS &dev_attr_rtap_iface.attr, &dev_attr_rtap_filter.attr, diff --git a/sys-kernel/thinkpad-sources/files/2.6.26/colored-printk-2.6.26.patch b/sys-kernel/thinkpad-sources/files/2.6.26/colored-printk-2.6.26.patch new file mode 100644 index 0000000..dc97636 --- /dev/null +++ b/sys-kernel/thinkpad-sources/files/2.6.26/colored-printk-2.6.26.patch @@ -0,0 +1,355 @@ +diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c +index 643fd86..837f3c2 100644 +--- a/arch/x86/kernel/early_printk.c ++++ b/arch/x86/kernel/early_printk.c +@@ -15,7 +15,8 @@ + static int max_ypos = 25, max_xpos = 80; + static int current_ypos = 25, current_xpos; + +-static void early_vga_write(struct console *con, const char *str, unsigned n) ++static void early_vga_write(struct console *con, const char *str, unsigned n, ++ unsigned int loglevel) + { + char c; + int i, k, j; +@@ -84,7 +85,8 @@ static int early_serial_putc(unsigned char ch) + return timeout ? 0 : -1; + } + +-static void early_serial_write(struct console *con, const char *s, unsigned n) ++static void early_serial_write(struct console *con, const char *s, unsigned n, ++ unsigned int loglevel) + { + while (*s && n-- > 0) { + if (*s == '\n') +@@ -180,7 +182,8 @@ static void __init simnow_init(char *str) + simnow_fd = simnow(XOPEN, (unsigned long)fn, O_WRONLY|O_APPEND|O_CREAT, 0644); + } + +-static void simnow_write(struct console *con, const char *s, unsigned n) ++static void simnow_write(struct console *con, const char *s, unsigned n, ++ unsigned int loglevel) + { + simnow(XWRITE, simnow_fd, (unsigned long)s, n); + } +@@ -204,7 +207,7 @@ void early_printk(const char *fmt, ...) + + va_start(ap, fmt); + n = vscnprintf(buf, 512, fmt, ap); +- early_console->write(early_console, buf, n); ++ early_console->write(early_console, buf, n, 0); + va_end(ap); + } + +diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig +index 57ba5c2..10556dd 100644 +--- a/drivers/char/Kconfig ++++ b/drivers/char/Kconfig +@@ -71,6 +71,111 @@ config NR_TTY_DEVICES + + If unsure, say 63. + ++menuconfig VT_CKO ++ bool "Colored kernel message output" ++ depends on VT_CONSOLE ++ ---help--- ++ This option enables kernel messages to be emitted in ++ colors other than the default. ++ ++ The color value you need to enter is composed (OR-ed) ++ of a foreground and a background color. ++ ++ Foreground: ++ 0x00 = black, 0x08 = dark gray, ++ 0x01 = red, 0x09 = light red, ++ 0x02 = green, 0x0A = light green, ++ 0x03 = brown, 0x0B = yellow, ++ 0x04 = blue, 0x0C = light blue, ++ 0x05 = magenta, 0x0D = light magenta, ++ 0x06 = cyan, 0x0E = light cyan, ++ 0x07 = gray, 0x0F = white, ++ ++ (Foreground colors 0x08 to 0x0F do not work when a VGA ++ console font with 512 glyphs is used.) ++ ++ Background: ++ 0x00 = black, 0x40 = blue, ++ 0x10 = red, 0x50 = magenta, ++ 0x20 = green, 0x60 = cyan, ++ 0x30 = brown, 0x70 = gray, ++ ++ For example, 0x1F would yield white on red. ++ ++ If unsure, say N. ++ ++config VT_PRINTK_EMERG_COLOR ++ hex "Emergency messages color" ++ range 0x00 0xFF ++ depends on VT_CKO ++ default 0x07 ++ ---help--- ++ This option defines with which color kernel emergency messages will ++ be printed to the console. ++ ++config VT_PRINTK_ALERT_COLOR ++ hex "Alert messages color" ++ range 0x00 0xFF ++ depends on VT_CKO ++ default 0x07 ++ ---help--- ++ This option defines with which color kernel alert messages will ++ be printed to the console. ++ ++config VT_PRINTK_CRIT_COLOR ++ hex "Critical messages color" ++ range 0x00 0xFF ++ depends on VT_CKO ++ default 0x07 ++ ---help--- ++ This option defines with which color kernel critical messages will ++ be printed to the console. ++ ++config VT_PRINTK_ERR_COLOR ++ hex "Error messages color" ++ range 0x00 0xFF ++ depends on VT_CKO ++ default 0x07 ++ ---help--- ++ This option defines with which color kernel error messages will ++ be printed to the console. ++ ++config VT_PRINTK_WARNING_COLOR ++ hex "Warning messages color" ++ range 0x00 0xFF ++ depends on VT_CKO ++ default 0x07 ++ ---help--- ++ This option defines with which color kernel warning messages will ++ be printed to the console. ++ ++config VT_PRINTK_NOTICE_COLOR ++ hex "Notice messages color" ++ range 0x00 0xFF ++ depends on VT_CKO ++ default 0x07 ++ ---help--- ++ This option defines with which color kernel notice messages will ++ be printed to the console. ++ ++config VT_PRINTK_INFO_COLOR ++ hex "Information messages color" ++ range 0x00 0xFF ++ depends on VT_CKO ++ default 0x07 ++ ---help--- ++ This option defines with which color kernel information messages will ++ be printed to the console. ++ ++config VT_PRINTK_DEBUG_COLOR ++ hex "Debug messages color" ++ range 0x00 0xFF ++ depends on VT_CKO ++ default 0x07 ++ ---help--- ++ This option defines with which color kernel debug messages will ++ be printed to the console. ++ + config HW_CONSOLE + bool + depends on VT && !S390 && !UML +diff --git a/drivers/char/vt.c b/drivers/char/vt.c +index 935f1c2..1fee2dc 100644 +--- a/drivers/char/vt.c ++++ b/drivers/char/vt.c +@@ -73,6 +73,7 @@ + */ + + #include <linux/module.h> ++#include <linux/moduleparam.h> + #include <linux/types.h> + #include <linux/sched.h> + #include <linux/tty.h> +@@ -2409,17 +2410,45 @@ struct tty_driver *console_driver; + + #ifdef CONFIG_VT_CONSOLE + ++#ifdef CONFIG_VT_CKO ++static unsigned int printk_color[8] __read_mostly = { ++ CONFIG_VT_PRINTK_EMERG_COLOR, /* KERN_EMERG */ ++ CONFIG_VT_PRINTK_ALERT_COLOR, /* KERN_ALERT */ ++ CONFIG_VT_PRINTK_CRIT_COLOR, /* KERN_CRIT */ ++ CONFIG_VT_PRINTK_ERR_COLOR, /* KERN_ERR */ ++ CONFIG_VT_PRINTK_WARNING_COLOR, /* KERN_WARNING */ ++ CONFIG_VT_PRINTK_NOTICE_COLOR, /* KERN_NOTICE */ ++ CONFIG_VT_PRINTK_INFO_COLOR, /* KERN_INFO */ ++ CONFIG_VT_PRINTK_DEBUG_COLOR, /* KERN_DEBUG */ ++}; ++module_param_array(printk_color, uint, NULL, S_IRUGO | S_IWUSR); ++ ++static inline void vc_set_color(struct vc_data *vc, unsigned char color) ++{ ++ vc->vc_color = color_table[color & 0xF] | ++ (color_table[(color >> 4) & 0x7] << 4) | ++ (color & 0x80); ++ update_attr(vc); ++} ++#else ++static unsigned int printk_color[8]; ++static inline void vc_set_color(const struct vc_data *vc, unsigned char c) ++{ ++} ++#endif ++ + /* + * Console on virtual terminal + * + * The console must be locked when we get here. + */ + +-static void vt_console_print(struct console *co, const char *b, unsigned count) ++static void vt_console_print(struct console *co, const char *b, unsigned count, ++ unsigned int loglevel) + { + struct vc_data *vc = vc_cons[fg_console].d; +- unsigned char c; + static DEFINE_SPINLOCK(printing_lock); ++ unsigned char current_color, c; + const ushort *start; + ushort cnt = 0; + ushort myx; +@@ -2452,11 +2481,19 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) + + start = (ushort *)vc->vc_pos; + ++ /* ++ * We always get a valid loglevel - <8> and "no level" is transformed ++ * to <4> in the typical kernel. ++ */ ++ current_color = printk_color[loglevel]; ++ vc_set_color(vc, current_color); ++ + /* Contrived structure to try to emulate original need_wrap behaviour + * Problems caused when we have need_wrap set on '\n' character */ + while (count--) { + c = *b++; + if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { ++ vc_set_color(vc, vc->vc_def_color); + if (cnt > 0) { + if (CON_IS_VISIBLE(vc)) + vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); +@@ -2469,6 +2506,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) + bs(vc); + start = (ushort *)vc->vc_pos; + myx = vc->vc_x; ++ vc_set_color(vc, current_color); + continue; + } + if (c != 13) +@@ -2476,6 +2514,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) + cr(vc); + start = (ushort *)vc->vc_pos; + myx = vc->vc_x; ++ vc_set_color(vc, current_color); + if (c == 10 || c == 13) + continue; + } +@@ -2498,6 +2537,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) + vc->vc_need_wrap = 1; + } + } ++ vc_set_color(vc, vc->vc_def_color); + set_cursor(vc); + notify_update(vc); + +diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c +index 665341e..4c27de8 100644 +--- a/drivers/net/netconsole.c ++++ b/drivers/net/netconsole.c +@@ -694,7 +694,8 @@ static struct notifier_block netconsole_netdev_notifier = { + .notifier_call = netconsole_netdev_event, + }; + +-static void write_msg(struct console *con, const char *msg, unsigned int len) ++static void write_msg(struct console *con, const char *msg, unsigned int len, ++ unsigned int loglevel) + { + int frag, left; + unsigned long flags; +diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c +index 1bc00b7..b4f1b6f 100644 +--- a/drivers/serial/8250.c ++++ b/drivers/serial/8250.c +@@ -2527,7 +2527,8 @@ static void serial8250_console_putchar(struct uart_port *port, int ch) + * The console_lock must be held when we get here. + */ + static void +-serial8250_console_write(struct console *co, const char *s, unsigned int count) ++serial8250_console_write(struct console *co, const char *s, unsigned int count, ++ unsigned int loglevel) + { + struct uart_8250_port *up = &serial8250_ports[co->index]; + unsigned long flags; +diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c +index f279745..2a928bd 100644 +--- a/drivers/serial/8250_early.c ++++ b/drivers/serial/8250_early.c +@@ -83,7 +83,7 @@ static void __init serial_putc(struct uart_port *port, int c) + } + + static void __init early_serial8250_write(struct console *console, +- const char *s, unsigned int count) ++ const char *s, unsigned int count, unsigned int loglevel) + { + struct uart_port *port = &early_device.port; + unsigned int ier; +diff --git a/include/linux/console.h b/include/linux/console.h +index a4f27fb..46fcfd3 100644 +--- a/include/linux/console.h ++++ b/include/linux/console.h +@@ -95,7 +95,7 @@ void give_up_console(const struct consw *sw); + + struct console { + char name[16]; +- void (*write)(struct console *, const char *, unsigned); ++ void (*write)(struct console *, const char *, unsigned, unsigned int); + int (*read)(struct console *, char *, unsigned); + struct tty_driver *(*device)(struct console *, int *); + void (*unblank)(void); +diff --git a/kernel/printk.c b/kernel/printk.c +index 6e920ce..a1aaa3f 100644 +--- a/kernel/printk.c ++++ b/kernel/printk.c +@@ -444,7 +444,8 @@ asmlinkage long sys_syslog(int type, char __user *buf, int len) + /* + * Call the console drivers on a range of log_buf + */ +-static void __call_console_drivers(unsigned start, unsigned end) ++static void __call_console_drivers(unsigned start, unsigned end, ++ unsigned int loglevel) + { + struct console *con; + +@@ -452,7 +453,7 @@ static void __call_console_drivers(unsigned start, unsigned end) + if ((con->flags & CON_ENABLED) && con->write && + (cpu_online(smp_processor_id()) || + (con->flags & CON_ANYTIME))) +- con->write(con, &LOG_BUF(start), end - start); ++ con->write(con, &LOG_BUF(start), end - start, loglevel); + } + } + +@@ -479,10 +480,11 @@ static void _call_console_drivers(unsigned start, + if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) { + /* wrapped write */ + __call_console_drivers(start & LOG_BUF_MASK, +- log_buf_len); +- __call_console_drivers(0, end & LOG_BUF_MASK); ++ log_buf_len, msg_log_level); ++ __call_console_drivers(0, end & LOG_BUF_MASK, ++ msg_log_level); + } else { +- __call_console_drivers(start, end); ++ __call_console_drivers(start, end, msg_log_level); + } + } + } diff --git a/sys-kernel/thinkpad-sources/files/2.6.25/04-linux-phc-0.3.1-for-2.6.25.patch b/sys-kernel/thinkpad-sources/files/2.6.26/linux-phc-0.3.2-kernel-vanilla-2.6.26.patch index f40f581..4a4db8b 100644 --- a/sys-kernel/thinkpad-sources/files/2.6.25/04-linux-phc-0.3.1-for-2.6.25.patch +++ b/sys-kernel/thinkpad-sources/files/2.6.26/linux-phc-0.3.2-kernel-vanilla-2.6.26.patch @@ -1,31 +1,32 @@ -diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c linux-2.6.24-rc1_phc/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c ---- linux-2.6.23-rc3/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c 2007-08-13 06:25:24.000000000 +0200 -+++ linux-source-2.6.23-rc3/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c 2007-08-14 15:33:30.000000000 +0200 -@@ -23,10 +23,15 @@ +diff --new-file -a --unified=5 --recursive linux-source-2.6.26-rc9_orig/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c linux-source-2.6.26-rc9-custom8/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +--- linux-source-2.6.26-rc9_orig/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c 2008-07-09 16:59:37.000000000 +0200 ++++ linux-source-2.6.26-rc9-custom8/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c 2008-07-09 12:41:37.000000000 +0200 +@@ -23,10 +23,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -+/* This file has been patched with Linux PHC: https://www.dedigentoo.org/trac/linux-phc -+ * Patch version: linux-phc-0.3.1-kernel-vanilla-2.6.23.patch ++/* This file has been patched with Linux PHC: http://phc.athousandnights.de ++ * Patch version: linux-phc-0.3.1-kernel-vanilla-2.6.26.patch + */ + -+ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/smp.h> #include <linux/sched.h> -@@ -59,12 +59,18 @@ +@@ -56,17 +60,22 @@ + SYSTEM_IO_CAPABLE, + }; + #define INTEL_MSR_RANGE (0xffff) #define CPUID_6_ECX_APERFMPERF_CAPABILITY (0x1) - +#define INTEL_MSR_VID_MASK (0x00ff) +#define INTEL_MSR_FID_MASK (0xff00) +#define INTEL_MSR_FID_SHIFT (0x8) -+#define PHC_VERSION_STRING "0.3.1:1" -+ ++#define PHC_VERSION_STRING "0.3.2:1" + struct acpi_cpufreq_data { struct acpi_processor_performance *acpi_data; struct cpufreq_frequency_table *freq_table; @@ -36,7 +37,9 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ }; static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); -@@ -102,17 +113,19 @@ + + /* acpi_perf_data is a pointer to percpu data. */ +@@ -102,17 +111,18 @@ } static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) @@ -51,17 +54,16 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { - if (msr == perf->states[data->freq_table[i].index].status) -+ if (fid == (perf->states[data->freq_table[i].index].status & -+ INTEL_MSR_FID_MASK)) ++ if (fid == (perf->states[data->freq_table[i].index].status & INTEL_MSR_FID_MASK)) return data->freq_table[i].frequency; } return data->freq_table[0].frequency; } -@@ -729,10 +742,12 @@ +@@ -740,10 +750,12 @@ if (data) { cpufreq_frequency_table_put_attr(policy->cpu); - per_cpu(drv_data, policy->cpu) = NULL; + per_cpu(drv_data, policy->cpu) = NULL; acpi_processor_unregister_performance(data->acpi_data, policy->cpu); + if (data->original_controls) @@ -71,7 +73,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ return 0; } -@@ -746,12 +761,452 @@ +@@ -757,12 +769,477 @@ data->resume = 1; return 0; @@ -92,8 +94,25 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + return (control & INTEL_MSR_VID_MASK); +} + ++ ++static bool check_cpu_control_capability(struct acpi_cpufreq_data *data) { ++ /* check if the cpu we are running on is capable of setting new control data ++ * ++ */ ++ if (unlikely(data == NULL || ++ data->acpi_data == NULL || ++ data->freq_table == NULL || ++ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) { ++ return false; ++ } else { ++ return true; ++ }; ++} ++ ++ +static ssize_t check_origial_table (struct acpi_cpufreq_data *data) +{ ++ + struct acpi_processor_performance *acpi_data; + struct cpufreq_frequency_table *freq_table; + unsigned int state_index; @@ -117,6 +136,9 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ +} + +static ssize_t show_freq_attr_vids(struct cpufreq_policy *policy, char *buf) ++ /* display phc's voltage id's ++ * ++ */ +{ + struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); + struct acpi_processor_performance *acpi_data; @@ -125,12 +147,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + unsigned int vid; + ssize_t count = 0; + -+ if (unlikely(data == NULL || -+ data->acpi_data == NULL || -+ data->freq_table == NULL || -+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) { -+ return -ENODEV; -+ } ++ if (!check_cpu_control_capability(data)) return -ENODEV; //check if CPU is capable of changing controls + + acpi_data = data->acpi_data; + freq_table = data->freq_table; @@ -145,6 +162,9 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ +} + +static ssize_t show_freq_attr_default_vids(struct cpufreq_policy *policy, char *buf) ++ /* display acpi's default voltage id's ++ * ++ */ +{ + struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); + struct cpufreq_frequency_table *freq_table; @@ -153,12 +173,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + ssize_t count = 0; + ssize_t retval; + -+ if (unlikely(data == NULL || -+ data->acpi_data == NULL || -+ data->freq_table == NULL || -+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) { -+ return -ENODEV; -+ } ++ if (!check_cpu_control_capability(data)) return -ENODEV; //check if CPU is capable of changing controls + + retval = check_origial_table(data); + if (0 != retval) @@ -176,6 +191,9 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ +} + +static ssize_t show_freq_attr_fids(struct cpufreq_policy *policy, char *buf) ++ /* display phc's frequeny id's ++ * ++ */ +{ + struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); + struct acpi_processor_performance *acpi_data; @@ -184,12 +202,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + unsigned int fid; + ssize_t count = 0; + -+ if (unlikely(data == NULL || -+ data->acpi_data == NULL || -+ data->freq_table == NULL || -+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) { -+ return -ENODEV; -+ } ++ if (!check_cpu_control_capability(data)) return -ENODEV; //check if CPU is capable of changing controls + + acpi_data = data->acpi_data; + freq_table = data->freq_table; @@ -204,6 +217,9 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ +} + +static ssize_t show_freq_attr_controls(struct cpufreq_policy *policy, char *buf) ++ /* display phc's controls for the cpu (frequency id's and related voltage id's) ++ * ++ */ +{ + struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); + struct acpi_processor_performance *acpi_data; @@ -213,12 +229,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + unsigned int vid; + ssize_t count = 0; + -+ if (unlikely(data == NULL || -+ data->acpi_data == NULL || -+ data->freq_table == NULL || -+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) { -+ return -ENODEV; -+ } ++ if (!check_cpu_control_capability(data)) return -ENODEV; //check if CPU is capable of changing controls + + acpi_data = data->acpi_data; + freq_table = data->freq_table; @@ -234,6 +245,9 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ +} + +static ssize_t show_freq_attr_default_controls(struct cpufreq_policy *policy, char *buf) ++ /* display acpi's default controls for the cpu (frequency id's and related voltage id's) ++ * ++ */ +{ + struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); + struct cpufreq_frequency_table *freq_table; @@ -243,12 +257,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + ssize_t count = 0; + ssize_t retval; + -+ if (unlikely(data == NULL || -+ data->acpi_data == NULL || -+ data->freq_table == NULL || -+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) { -+ return -ENODEV; -+ } ++ if (!check_cpu_control_capability(data)) return -ENODEV; //check if CPU is capable of changing controls + + retval = check_origial_table(data); + if (0 != retval) @@ -268,6 +277,10 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + + +static ssize_t store_freq_attr_vids(struct cpufreq_policy *policy, const char *buf, size_t count) ++ /* store the voltage id's for the related frequency ++ * We are going to do some sanity checks here to prevent users ++ * from setting higher voltages than the default one. ++ */ +{ + struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); + struct acpi_processor_performance *acpi_data; @@ -282,12 +295,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + char *next_buf; + ssize_t retval; + -+ if (unlikely(data == NULL || -+ data->acpi_data == NULL || -+ data->freq_table == NULL || -+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) { -+ return -ENODEV; -+ } ++ if (!check_cpu_control_capability(data)) return -ENODEV; //check if CPU is capable of changing controls + + retval = check_origial_table(data); + if (0 != retval) @@ -296,13 +304,15 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + acpi_data = data->acpi_data; + freq_table = data->freq_table; + ++ /* for each value taken from the sysfs interfalce (phc_vids) get entrys and convert them to unsigned long integers*/ + for (freq_index = 0; freq_table[freq_index].frequency != CPUFREQ_TABLE_END; freq_index++) { + new_vid = simple_strtoul(curr_buf, &next_buf, 10); + if (next_buf == curr_buf) { -+ if ((curr_buf - buf == count - 1) && (*curr_buf == '\n')) { ++ if ((curr_buf - buf == count - 1) && (*curr_buf == '\n')) { //end of line? + curr_buf++; + break; + } ++ //if we didn't got end of line but there is nothing more to read something went wrong... + printk("failed to parse vid value at %i (%s)\n", freq_index, curr_buf); + return -EINVAL; + } @@ -310,6 +320,10 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + state_index = freq_table[freq_index].index; + original_control = data->original_controls[state_index]; + original_vid = original_control & INTEL_MSR_VID_MASK; ++ ++ /* before we store the values we do some checks to prevent ++ * users to set up values higher than the default one ++ */ + if (new_vid <= original_vid) { + new_control = (original_control & ~INTEL_MSR_VID_MASK) | new_vid; + dprintk("setting control at %i to %x (default is %x)\n", @@ -322,12 +336,16 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + } + + curr_buf = next_buf; ++ /* jump over value seperators (space or comma). ++ * There could be more than one space or comma character ++ * to separate two values so we better do it using a loop. ++ */ + while ((curr_buf - buf < count) && ((*curr_buf == ' ') || (*curr_buf == ','))) { + curr_buf++; + } + } + -+ /* set new voltage at current frequency */ ++ /* set new voltage for current frequency */ + data->resume = 1; + acpi_cpufreq_target(policy, get_cur_freq_on_cpu(policy->cpu), CPUFREQ_RELATION_L); + @@ -335,6 +353,10 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ +} + +static ssize_t store_freq_attr_controls(struct cpufreq_policy *policy, const char *buf, size_t count) ++ /* store the controls (frequency id's and related voltage id's) ++ * We are going to do some sanity checks here to prevent users ++ * from setting higher voltages than the default one. ++ */ +{ + struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); + struct acpi_processor_performance *acpi_data; @@ -354,12 +376,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + unsigned int new_control; + int found; + -+ if (unlikely(data == NULL || -+ data->acpi_data == NULL || -+ data->freq_table == NULL || -+ data->cpu_feature != SYSTEM_INTEL_MSR_CAPABLE)) { -+ return -ENODEV; -+ } ++ if (!check_cpu_control_capability(data)) return -ENODEV; + + retval = check_origial_table(data); + if (0 != retval) @@ -462,14 +479,19 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ +} + +static ssize_t show_freq_attr_phc_version(struct cpufreq_policy *policy, char *buf) ++ /* print out the phc version string set at the beginning of that file ++ */ +{ + ssize_t count = 0; + count += sprintf(&buf[count], "%s\n", PHC_VERSION_STRING); + return count; +} + ++ ++ +static struct freq_attr cpufreq_freq_attr_phc_version = +{ ++ /*display phc's version string*/ + .attr = { .name = "phc_version", .mode = 0444, .owner = THIS_MODULE }, + .show = show_freq_attr_phc_version, + .store = NULL, @@ -477,6 +499,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + +static struct freq_attr cpufreq_freq_attr_vids = +{ ++ /*display phc's voltage id's for the cpu*/ + .attr = { .name = "phc_vids", .mode = 0644, .owner = THIS_MODULE }, + .show = show_freq_attr_vids, + .store = store_freq_attr_vids, @@ -484,6 +507,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + +static struct freq_attr cpufreq_freq_attr_default_vids = +{ ++ /*display acpi's default frequency id's for the cpu*/ + .attr = { .name = "phc_default_vids", .mode = 0444, .owner = THIS_MODULE }, + .show = show_freq_attr_default_vids, + .store = NULL, @@ -491,6 +515,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + +static struct freq_attr cpufreq_freq_attr_fids = +{ ++ /*display phc's default frequency id's for the cpu*/ + .attr = { .name = "phc_fids", .mode = 0444, .owner = THIS_MODULE }, + .show = show_freq_attr_fids, + .store = NULL, @@ -498,6 +523,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + +static struct freq_attr cpufreq_freq_attr_controls = +{ ++ /*display phc's current voltage/frequency controls for the cpu*/ + .attr = { .name = "phc_controls", .mode = 0644, .owner = THIS_MODULE }, + .show = show_freq_attr_controls, + .store = store_freq_attr_controls, @@ -505,6 +531,7 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + +static struct freq_attr cpufreq_freq_attr_default_controls = +{ ++ /*display acpi's default voltage/frequency controls for the cpu*/ + .attr = { .name = "phc_default_controls", .mode = 0444, .owner = THIS_MODULE }, + .show = show_freq_attr_default_controls, + .store = NULL, @@ -512,8 +539,9 @@ diff --new-file -a --unified=5 --recursive linux-2.6.24-rc1/arch/x86/kernel/cpu/ + + static struct freq_attr *acpi_cpufreq_attr[] = { +- &cpufreq_freq_attr_scaling_available_freqs, + &cpufreq_freq_attr_phc_version, - &cpufreq_freq_attr_scaling_available_freqs, ++ &cpufreq_freq_attr_scaling_available_freqs, + &cpufreq_freq_attr_vids, + &cpufreq_freq_attr_default_vids, + &cpufreq_freq_attr_fids, diff --git a/sys-kernel/thinkpad-sources/files/2.6.26/power-off-unused-ports.patch b/sys-kernel/thinkpad-sources/files/2.6.26/power-off-unused-ports.patch new file mode 100644 index 0000000..72a7b1c --- /dev/null +++ b/sys-kernel/thinkpad-sources/files/2.6.26/power-off-unused-ports.patch @@ -0,0 +1,129 @@ + drivers/ata/ahci.c | 21 +++++++++++++++++++++ + drivers/ata/libata-core.c | 24 ++++++++++++++++++++++++ + include/linux/libata.h | 1 + + 3 files changed, 46 insertions(+) + +Index: linux-ahci-phy/drivers/ata/ahci.c +=================================================================== +--- linux-ahci-phy.orig/drivers/ata/ahci.c 2008-05-08 14:29:02.000000000 -0700 ++++ linux-ahci-phy/drivers/ata/ahci.c 2008-05-08 14:31:05.000000000 -0700 +@@ -53,9 +53,13 @@ static int ahci_skip_host_reset; + module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); + MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); + ++static int ahci_power_save = 1; ++module_param_named(power_save, ahci_power_save, int, 0444); ++MODULE_PARM_DESC(power_save, "Power off unused ports (0=don't power off, 1=power off)"); + static int ahci_enable_alpm(struct ata_port *ap, + enum link_pm policy); + static void ahci_disable_alpm(struct ata_port *ap); ++static int ahci_is_hotplug_capable(struct ata_port *ap); + + enum { + AHCI_PCI_BAR = 5, +@@ -166,6 +170,8 @@ enum { + PORT_CMD_ASP = (1 << 27), /* Aggressive Slumber/Partial */ + PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */ + PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ ++ PORT_CMD_ESP = (1 << 21), /* External SATA Port */ ++ PORT_CMD_HPCP = (1 << 18), /* port is hot plug capable */ + PORT_CMD_PMP = (1 << 17), /* PMP attached */ + PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ + PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ +@@ -1900,6 +1906,18 @@ static int ahci_pci_device_resume(struct + } + #endif + ++static int ahci_is_hotplug_capable(struct ata_port *ap) ++{ ++ void __iomem *port_mmio = ahci_port_base(ap); ++ u8 cmd; ++ ++ if (!ahci_power_save) ++ return 1; ++ ++ cmd = readl(port_mmio + PORT_CMD); ++ return ((cmd & PORT_CMD_HPCP) || (cmd & PORT_CMD_ESP)); ++} ++ + static int ahci_port_start(struct ata_port *ap) + { + struct device *dev = ap->host->dev; +@@ -1951,6 +1969,9 @@ static int ahci_port_start(struct ata_po + + ap->private_data = pp; + ++ /* set some flags based on port capabilities */ ++ if (!ahci_is_hotplug_capable(ap)) ++ ap->flags |= ATA_FLAG_NO_HOTPLUG; + /* engage engines, captain */ + return ahci_port_resume(ap); + } +Index: linux-ahci-phy/drivers/ata/libata-core.c +=================================================================== +--- linux-ahci-phy.orig/drivers/ata/libata-core.c 2008-05-08 14:28:57.000000000 -0700 ++++ linux-ahci-phy/drivers/ata/libata-core.c 2008-05-08 14:29:50.000000000 -0700 +@@ -162,6 +162,19 @@ MODULE_DESCRIPTION("Library module for A + MODULE_LICENSE("GPL"); + MODULE_VERSION(DRV_VERSION); + ++static void ata_phy_offline(struct ata_link *link) ++{ ++ u32 scontrol; ++ int rc; ++ ++ /* set DET to 4 */ ++ rc = sata_scr_read(link, SCR_CONTROL, &scontrol); ++ if (rc) ++ return; ++ scontrol &= ~0xf; ++ scontrol |= (1 << 2); ++ sata_scr_write(link, SCR_CONTROL, scontrol); ++} + + /** + * ata_force_cbl - force cable type according to libata.force +@@ -2671,6 +2684,7 @@ void ata_port_disable(struct ata_port *a + ap->link.device[0].class = ATA_DEV_NONE; + ap->link.device[1].class = ATA_DEV_NONE; + ap->flags |= ATA_FLAG_DISABLED; ++ ata_phy_offline(&ap->link); + } + + /** +@@ -5609,6 +5623,8 @@ int ata_host_register(struct ata_host *h + if (ap->ops->error_handler) { + struct ata_eh_info *ehi = &ap->link.eh_info; + unsigned long flags; ++ int device_attached = 0; ++ struct ata_device *dev; + + ata_port_probe(ap); + +@@ -5627,6 +5643,14 @@ int ata_host_register(struct ata_host *h + + /* wait for EH to finish */ + ata_port_wait_eh(ap); ++ ata_link_for_each_dev(dev, &ap->link) ++ if (ata_dev_enabled(dev)) ++ device_attached++; ++ if (!device_attached && ++ (ap->flags & ATA_FLAG_NO_HOTPLUG)) { ++ /* no device present, disable port */ ++ ata_port_disable(ap); ++ } + } else { + DPRINTK("ata%u: bus probe begin\n", ap->print_id); + rc = ata_bus_probe(ap); +Index: linux-ahci-phy/include/linux/libata.h +=================================================================== +--- linux-ahci-phy.orig/include/linux/libata.h 2008-05-08 14:28:57.000000000 -0700 ++++ linux-ahci-phy/include/linux/libata.h 2008-05-08 14:29:50.000000000 -0700 +@@ -193,6 +193,7 @@ enum { + ATA_FLAG_AN = (1 << 18), /* controller supports AN */ + ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ + ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */ ++ ATA_FLAG_NO_HOTPLUG = (1 << 21), /* port doesn't support HP */ + + /* The following flag belongs to ap->pflags but is kept in + * ap->flags because it's referenced in many LLDs and will be
\ No newline at end of file diff --git a/sys-kernel/thinkpad-sources/thinkpad-sources-2.6.25.ebuild b/sys-kernel/thinkpad-sources/thinkpad-sources-2.6.26.ebuild index c55aa5c..cbab316 100644 --- a/sys-kernel/thinkpad-sources/thinkpad-sources-2.6.25.ebuild +++ b/sys-kernel/thinkpad-sources/thinkpad-sources-2.6.26.ebuild @@ -1,22 +1,23 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: sys-kernel/thinkpad-sources/thinkpad-sources-2.6.25.ebuild 2008 05 14 +# $Header: sys-kernel/thinkpad-sources/thinkpad-sources-2.6.26.ebuild 2008 07 25 ETYPE="sources" K_WANT_GENPATCHES="base extras" -K_GENPATCHES_VER="4" +K_GENPATCHES_VER="1" inherit kernel-2 detect_version detect_arch -DESCRIPTION="Software Suspend 2 + Gentoo patchset sources + SCO Flowcontrol + Latest THINKPAD-Acpi + IWLWIFI-LEDs + PCI-E ASPM + Colored Printk" -HOMEPAGE="http://dev.gentoo.org/~dsd/genpatches http://www.tuxonice.net http://bluetooth-alsa.sourceforge.net/ http://ibm-acpi.sourceforge.net/" +DESCRIPTION="TuxOnIce + Gentoo patches + Latest THINKPAD-Acpi + PCI-E ASPM + Colored Printk + Libata Powermanagement + Bay Fixes + hdaps + phc + ipw2200 inject" +HOMEPAGE="http://dev.gentoo.org/~dsd/genpatches http://www.tuxonice.net http://ibm-acpi.sourceforge.net/" -IUSE="sco_flowcontrol" +IUSE="" +#IUSE="sco_flowcontrol" -TUXONICE_VERSION="3.0-rc7" -TUXONICE_TARGET="2.6.25" +TUXONICE_VERSION="3.0-rc7a" +TUXONICE_TARGET="2.6.26" TUXONICE_SRC="tuxonice-${TUXONICE_VERSION}-for-${TUXONICE_TARGET}" TUXONICE_URI="http://www.tuxonice.net/downloads/all/${TUXONICE_SRC}.patch.bz2" @@ -24,8 +25,8 @@ TUXONICE_URI="http://www.tuxonice.net/downloads/all/${TUXONICE_SRC}.patch.bz2" #SCO_FLOWCONTROL_SRC="sco-flowcontrol-v${SCO_FLOWCONTROL_VERSION}" #SCO_FLOWCONTROL_URI="http://bluetooth-alsa.cvs.sourceforge.net/*checkout*/bluetooth-alsa/plugz/patches/${SCO_FLOWCONTROL_SRC}.diff" -THINKPAD_ACPI_VERSION="0.20-20080430" -THINKPAD_ACPI_TARGET="2.6.25.1" +THINKPAD_ACPI_VERSION="0.21-20080703" +THINKPAD_ACPI_TARGET="2.6.26-rc8" THINKPAD_ACPI_SRC="thinkpad-acpi-${THINKPAD_ACPI_VERSION}_v${THINKPAD_ACPI_TARGET}.patch.gz" THINKPAD_ACPI_URI="mirror://sourceforge/ibm-acpi/${THINKPAD_ACPI_SRC}" @@ -35,19 +36,18 @@ UNIPATCH_LIST="" #if use sco_flowcontrol; then # UNIPATCH_LIST="${UNIPATCH_LIST} ${DISTDIR}/${SCO_FLOWCONTROL_SRC}.diff" #fi +MY_PV="${PV}" UNIPATCH_LIST="${UNIPATCH_LIST} - ${FILESDIR}/2.6.25/vt-fix.patch - ${FILESDIR}/2.6.25/colored-printk-2.6.25.part1.patch - ${FILESDIR}/2.6.25/colored-printk-2.6.25.part2.patch - ${FILESDIR}/2.6.25/colored-printk-2.6.25.part3.patch - ${FILESDIR}/2.6.25/02-disk-protect-for-2.6.25.patch + ${FILESDIR}/${MY_PV}/colored-printk-2.6.26.patch + ${FILESDIR}/${MY_PV}/01-disk-protect-for-2.6.26.patch + ${FILESDIR}/${MY_PV}/02-ipw2200-inject-for-2.6.26.patch + ${FILESDIR}/${MY_PV}/linux-phc-0.3.2-kernel-vanilla-2.6.26.patch ${DISTDIR}/${THINKPAD_ACPI_SRC} - ${FILESDIR}/2.6.25/03-ipw2200-inject-for-2.6.25.patch - ${FILESDIR}/2.6.25/04-linux-phc-0.3.1-for-2.6.25.patch ${DISTDIR}/${TUXONICE_SRC}.patch.bz2 - ${FILESDIR}/2.6.25/kernel-2.6.25-export-init_mm.patch - ${FILESDIR}/2.6.25/kernel-2.6.25-rcu-license.patch - ${FILESDIR}/2.6.25/pci-e_aspm_v3.5.patch" + ${FILESDIR}/${MY_PV}/power-off-unused-ports.patch +" +# ${FILESDIR}/${MY_PV}/00-bay-cleanup_exit-for-2.6.25.patch +# ${FILESDIR}/${MY_PV}/03-libata-acpi_hotplug_fixups-for-2.6.25.patch # ${FILESDIR}/2.6.24-r1/iwlwifi-leds-v2-2.6.24-rc4.diff @@ -65,15 +65,16 @@ pkg_postinst() { kernel-2_pkg_postinst einfo "For more info on this patchset, and how to report problems, see:" einfo "${HOMEPAGE}" + einfo "AND send a mail to linux-thinkpad mailinglist," + einfo "so the patch could be retested and rerated" einfo "In files dir is an example config suitable for T60" einfo "and hopefully all pci-express driven Thinkpads" einfo "but at all you should try for all Thinkpads" einfo "to NOT alter the given storage device controller configuration" - einfo "For rx led do:" - einfo "echo phy0rx >/sys/bus/pci/drivers/iwl3945/0000\:03\:00.0/leds/iwl-phy0\:asoc/trigger" +# einfo "For rx led do:" +# einfo "echo phy0rx >/sys/bus/pci/drivers/iwl3945/0000\:03\:00.0/leds/iwl-phy0\:asoc/trigger" einfo "for powersaving i recommend to append these kernel options:" einfo "usbcore.autosuspend=1 pcie_aspm.policy=powersave" - einfo "if system freezes occur remove pcie_aspm.policy, and report to ltp ml" einfo "additional powertweaks possible (depending on your hardware):" einfo "snd_hda_intel.power_save=1" einfo "echo 7 > /sys/bus/pci/drivers/iwl3945/0000\:03\:00.0/power_level" |