diff options
106 files changed, 1320 insertions, 783 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 914119309ddb..856c8b114e71 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -126,7 +126,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
126 | See header of drivers/scsi/53c7xx.c. | 126 | See header of drivers/scsi/53c7xx.c. |
127 | See also Documentation/scsi/ncr53c7xx.txt. | 127 | See also Documentation/scsi/ncr53c7xx.txt. |
128 | 128 | ||
129 | acpi= [HW,ACPI] Advanced Configuration and Power Interface | 129 | acpi= [HW,ACPI,X86-64,i386] |
130 | Advanced Configuration and Power Interface | ||
130 | Format: { force | off | ht | strict | noirq } | 131 | Format: { force | off | ht | strict | noirq } |
131 | force -- enable ACPI if default was off | 132 | force -- enable ACPI if default was off |
132 | off -- disable ACPI if default was on | 133 | off -- disable ACPI if default was on |
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt index f9c99c9a54f9..1a3bdc27d95e 100644 --- a/Documentation/sparse.txt +++ b/Documentation/sparse.txt | |||
@@ -45,11 +45,15 @@ special. | |||
45 | Getting sparse | 45 | Getting sparse |
46 | ~~~~~~~~~~~~~~ | 46 | ~~~~~~~~~~~~~~ |
47 | 47 | ||
48 | With git, you can just get it from | 48 | You can get latest released versions from the Sparse homepage at |
49 | http://www.kernel.org/pub/linux/kernel/people/josh/sparse/ | ||
49 | 50 | ||
50 | rsync://rsync.kernel.org/pub/scm/devel/sparse/sparse.git | 51 | Alternatively, you can get snapshots of the latest development version |
52 | of sparse using git to clone.. | ||
51 | 53 | ||
52 | and DaveJ has tar-balls at | 54 | git://git.kernel.org/pub/scm/linux/kernel/git/josh/sparse.git |
55 | |||
56 | DaveJ has hourly generated tarballs of the git tree available at.. | ||
53 | 57 | ||
54 | http://www.codemonkey.org.uk/projects/git-snapshots/sparse/ | 58 | http://www.codemonkey.org.uk/projects/git-snapshots/sparse/ |
55 | 59 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 9993b9009415..17555bba20af 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1103,9 +1103,6 @@ W: http://lanana.org/docs/device-list/index.html | |||
1103 | L: linux-kernel@vger.kernel.org | 1103 | L: linux-kernel@vger.kernel.org |
1104 | S: Maintained | 1104 | S: Maintained |
1105 | 1105 | ||
1106 | DEVICE FILESYSTEM | ||
1107 | S: Obsolete | ||
1108 | |||
1109 | DIGI INTL. EPCA DRIVER | 1106 | DIGI INTL. EPCA DRIVER |
1110 | P: Digi International, Inc | 1107 | P: Digi International, Inc |
1111 | M: Eng.Linux@digi.com | 1108 | M: Eng.Linux@digi.com |
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index e5eb97a910ed..9ea5b8ecc7e1 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -1072,7 +1072,28 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { | |||
1072 | "ASUS A7V ACPI BIOS Revision 1007"), | 1072 | "ASUS A7V ACPI BIOS Revision 1007"), |
1073 | }, | 1073 | }, |
1074 | }, | 1074 | }, |
1075 | 1075 | { | |
1076 | /* | ||
1077 | * Latest BIOS for IBM 600E (1.16) has bad pcinum | ||
1078 | * for LPC bridge, which is needed for the PCI | ||
1079 | * interrupt links to work. DSDT fix is in bug 5966. | ||
1080 | * 2645, 2646 model numbers are shared with 600/600E/600X | ||
1081 | */ | ||
1082 | .callback = disable_acpi_irq, | ||
1083 | .ident = "IBM Thinkpad 600 Series 2645", | ||
1084 | .matches = { | ||
1085 | DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), | ||
1086 | DMI_MATCH(DMI_BOARD_NAME, "2645"), | ||
1087 | }, | ||
1088 | }, | ||
1089 | { | ||
1090 | .callback = disable_acpi_irq, | ||
1091 | .ident = "IBM Thinkpad 600 Series 2646", | ||
1092 | .matches = { | ||
1093 | DMI_MATCH(DMI_BOARD_VENDOR, "IBM"), | ||
1094 | DMI_MATCH(DMI_BOARD_NAME, "2646"), | ||
1095 | }, | ||
1096 | }, | ||
1076 | /* | 1097 | /* |
1077 | * Boxes that need ACPI PCI IRQ routing and PCI scan disabled | 1098 | * Boxes that need ACPI PCI IRQ routing and PCI scan disabled |
1078 | */ | 1099 | */ |
diff --git a/arch/i386/kernel/acpi/earlyquirk.c b/arch/i386/kernel/acpi/earlyquirk.c index bf86f7662d8b..a7d22d9f3d7e 100644 --- a/arch/i386/kernel/acpi/earlyquirk.c +++ b/arch/i386/kernel/acpi/earlyquirk.c | |||
@@ -14,11 +14,8 @@ | |||
14 | 14 | ||
15 | #ifdef CONFIG_ACPI | 15 | #ifdef CONFIG_ACPI |
16 | 16 | ||
17 | static int nvidia_hpet_detected __initdata; | ||
18 | |||
19 | static int __init nvidia_hpet_check(struct acpi_table_header *header) | 17 | static int __init nvidia_hpet_check(struct acpi_table_header *header) |
20 | { | 18 | { |
21 | nvidia_hpet_detected = 1; | ||
22 | return 0; | 19 | return 0; |
23 | } | 20 | } |
24 | #endif | 21 | #endif |
@@ -29,9 +26,7 @@ static int __init check_bridge(int vendor, int device) | |||
29 | /* According to Nvidia all timer overrides are bogus unless HPET | 26 | /* According to Nvidia all timer overrides are bogus unless HPET |
30 | is enabled. */ | 27 | is enabled. */ |
31 | if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) { | 28 | if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) { |
32 | nvidia_hpet_detected = 0; | 29 | if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check)) { |
33 | acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check); | ||
34 | if (nvidia_hpet_detected == 0) { | ||
35 | acpi_skip_timer_override = 1; | 30 | acpi_skip_timer_override = 1; |
36 | printk(KERN_INFO "Nvidia board " | 31 | printk(KERN_INFO "Nvidia board " |
37 | "detected. Ignoring ACPI " | 32 | "detected. Ignoring ACPI " |
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c index 8c331ca6e5c9..c6216f454ffb 100644 --- a/arch/ia64/sn/kernel/io_acpi_init.c +++ b/arch/ia64/sn/kernel/io_acpi_init.c | |||
@@ -53,12 +53,15 @@ sal_ioif_init(u64 *result) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | /* | 55 | /* |
56 | * sn_hubdev_add - The 'add' function of the acpi_sn_hubdev_driver. | 56 | * sn_acpi_hubdev_init() - This function is called by acpi_ns_get_device_callback() |
57 | * Called for every "SGIHUB" or "SGITIO" device defined | 57 | * for all SGIHUB and SGITIO acpi devices defined in the |
58 | * in the ACPI namespace. | 58 | * DSDT. It obtains the hubdev_info pointer from the |
59 | * ACPI vendor resource, which the PROM setup, and sets up the | ||
60 | * hubdev_info in the pda. | ||
59 | */ | 61 | */ |
60 | static int __init | 62 | |
61 | sn_hubdev_add(struct acpi_device *device) | 63 | static acpi_status __init |
64 | sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret) | ||
62 | { | 65 | { |
63 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 66 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
64 | u64 addr; | 67 | u64 addr; |
@@ -67,18 +70,19 @@ sn_hubdev_add(struct acpi_device *device) | |||
67 | int i; | 70 | int i; |
68 | u64 nasid; | 71 | u64 nasid; |
69 | struct acpi_resource *resource; | 72 | struct acpi_resource *resource; |
70 | int ret = 0; | ||
71 | acpi_status status; | 73 | acpi_status status; |
72 | struct acpi_resource_vendor_typed *vendor; | 74 | struct acpi_resource_vendor_typed *vendor; |
73 | extern void sn_common_hubdev_init(struct hubdev_info *); | 75 | extern void sn_common_hubdev_init(struct hubdev_info *); |
74 | 76 | ||
75 | status = acpi_get_vendor_resource(device->handle, METHOD_NAME__CRS, | 77 | status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, |
76 | &sn_uuid, &buffer); | 78 | &sn_uuid, &buffer); |
77 | if (ACPI_FAILURE(status)) { | 79 | if (ACPI_FAILURE(status)) { |
78 | printk(KERN_ERR | 80 | printk(KERN_ERR |
79 | "sn_hubdev_add: acpi_get_vendor_resource() failed: %d\n", | 81 | "sn_acpi_hubdev_init: acpi_get_vendor_resource() " |
80 | status); | 82 | "(0x%x) failed for: ", status); |
81 | return 1; | 83 | acpi_ns_print_node_pathname(handle, NULL); |
84 | printk("\n"); | ||
85 | return AE_OK; /* Continue walking namespace */ | ||
82 | } | 86 | } |
83 | 87 | ||
84 | resource = buffer.pointer; | 88 | resource = buffer.pointer; |
@@ -86,9 +90,10 @@ sn_hubdev_add(struct acpi_device *device) | |||
86 | if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != | 90 | if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) != |
87 | sizeof(struct hubdev_info *)) { | 91 | sizeof(struct hubdev_info *)) { |
88 | printk(KERN_ERR | 92 | printk(KERN_ERR |
89 | "sn_hubdev_add: Invalid vendor data length: %d\n", | 93 | "sn_acpi_hubdev_init: Invalid vendor data length: %d for: ", |
90 | vendor->byte_length); | 94 | vendor->byte_length); |
91 | ret = 1; | 95 | acpi_ns_print_node_pathname(handle, NULL); |
96 | printk("\n"); | ||
92 | goto exit; | 97 | goto exit; |
93 | } | 98 | } |
94 | 99 | ||
@@ -103,7 +108,7 @@ sn_hubdev_add(struct acpi_device *device) | |||
103 | 108 | ||
104 | exit: | 109 | exit: |
105 | kfree(buffer.pointer); | 110 | kfree(buffer.pointer); |
106 | return ret; | 111 | return AE_OK; /* Continue walking namespace */ |
107 | } | 112 | } |
108 | 113 | ||
109 | /* | 114 | /* |
@@ -441,14 +446,6 @@ sn_acpi_slot_fixup(struct pci_dev *dev) | |||
441 | 446 | ||
442 | EXPORT_SYMBOL(sn_acpi_slot_fixup); | 447 | EXPORT_SYMBOL(sn_acpi_slot_fixup); |
443 | 448 | ||
444 | static struct acpi_driver acpi_sn_hubdev_driver = { | ||
445 | .name = "SGI HUBDEV Driver", | ||
446 | .ids = "SGIHUB,SGITIO", | ||
447 | .ops = { | ||
448 | .add = sn_hubdev_add, | ||
449 | }, | ||
450 | }; | ||
451 | |||
452 | 449 | ||
453 | /* | 450 | /* |
454 | * sn_acpi_bus_fixup - Perform SN specific setup of software structs | 451 | * sn_acpi_bus_fixup - Perform SN specific setup of software structs |
@@ -492,7 +489,10 @@ sn_io_acpi_init(void) | |||
492 | /* SN Altix does not follow the IOSAPIC IRQ routing model */ | 489 | /* SN Altix does not follow the IOSAPIC IRQ routing model */ |
493 | acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM; | 490 | acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM; |
494 | 491 | ||
495 | acpi_bus_register_driver(&acpi_sn_hubdev_driver); | 492 | /* Setup hubdev_info for all SGIHUB/SGITIO devices */ |
493 | acpi_get_devices("SGIHUB", sn_acpi_hubdev_init, NULL, NULL); | ||
494 | acpi_get_devices("SGITIO", sn_acpi_hubdev_init, NULL, NULL); | ||
495 | |||
496 | status = sal_ioif_init(&result); | 496 | status = sal_ioif_init(&result); |
497 | if (status || result) | 497 | if (status || result) |
498 | panic("sal_ioif_init failed: [%lx] %s\n", | 498 | panic("sal_ioif_init failed: [%lx] %s\n", |
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c index 8571e52c2efd..bd5373d593e1 100644 --- a/arch/ia64/sn/kernel/setup.c +++ b/arch/ia64/sn/kernel/setup.c | |||
@@ -397,6 +397,8 @@ void __init sn_setup(char **cmdline_p) | |||
397 | ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE); | 397 | ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE); |
398 | ia64_sn_set_os_feature(OSF_ACPI_ENABLE); | 398 | ia64_sn_set_os_feature(OSF_ACPI_ENABLE); |
399 | 399 | ||
400 | /* Load the new DSDT and SSDT tables into the global table list. */ | ||
401 | acpi_table_init(); | ||
400 | 402 | ||
401 | #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) | 403 | #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) |
402 | /* | 404 | /* |
diff --git a/arch/mips/dec/prom/init.c b/arch/mips/dec/prom/init.c index bf2858071f1f..a217aafe59f6 100644 --- a/arch/mips/dec/prom/init.c +++ b/arch/mips/dec/prom/init.c | |||
@@ -103,9 +103,6 @@ void __init prom_init(void) | |||
103 | if (prom_is_rex(magic)) | 103 | if (prom_is_rex(magic)) |
104 | rex_clear_cache(); | 104 | rex_clear_cache(); |
105 | 105 | ||
106 | /* Register the early console. */ | ||
107 | register_prom_console(); | ||
108 | |||
109 | /* Were we compiled with the right CPU option? */ | 106 | /* Were we compiled with the right CPU option? */ |
110 | #if defined(CONFIG_CPU_R3000) | 107 | #if defined(CONFIG_CPU_R3000) |
111 | if ((current_cpu_data.cputype == CPU_R4000SC) || | 108 | if ((current_cpu_data.cputype == CPU_R4000SC) || |
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig index 67dac6204b6d..bdf24a7b5494 100644 --- a/arch/mips/sibyte/Kconfig +++ b/arch/mips/sibyte/Kconfig | |||
@@ -1,31 +1,35 @@ | |||
1 | config SIBYTE_SB1250 | 1 | config SIBYTE_SB1250 |
2 | bool | 2 | bool |
3 | select HW_HAS_PCI | 3 | select HW_HAS_PCI |
4 | select SIBYTE_HAS_LDT | 4 | select SIBYTE_ENABLE_LDT_IF_PCI |
5 | select SIBYTE_SB1xxx_SOC | 5 | select SIBYTE_SB1xxx_SOC |
6 | select SYS_SUPPORTS_SMP | 6 | select SYS_SUPPORTS_SMP |
7 | 7 | ||
8 | config SIBYTE_BCM1120 | 8 | config SIBYTE_BCM1120 |
9 | bool | 9 | bool |
10 | select SIBYTE_BCM112X | 10 | select SIBYTE_BCM112X |
11 | select SIBYTE_HAS_ZBUS_PROFILING | ||
11 | select SIBYTE_SB1xxx_SOC | 12 | select SIBYTE_SB1xxx_SOC |
12 | 13 | ||
13 | config SIBYTE_BCM1125 | 14 | config SIBYTE_BCM1125 |
14 | bool | 15 | bool |
15 | select HW_HAS_PCI | 16 | select HW_HAS_PCI |
16 | select SIBYTE_BCM112X | 17 | select SIBYTE_BCM112X |
18 | select SIBYTE_HAS_ZBUS_PROFILING | ||
17 | select SIBYTE_SB1xxx_SOC | 19 | select SIBYTE_SB1xxx_SOC |
18 | 20 | ||
19 | config SIBYTE_BCM1125H | 21 | config SIBYTE_BCM1125H |
20 | bool | 22 | bool |
21 | select HW_HAS_PCI | 23 | select HW_HAS_PCI |
22 | select SIBYTE_BCM112X | 24 | select SIBYTE_BCM112X |
23 | select SIBYTE_HAS_LDT | 25 | select SIBYTE_ENABLE_LDT_IF_PCI |
26 | select SIBYTE_HAS_ZBUS_PROFILING | ||
24 | select SIBYTE_SB1xxx_SOC | 27 | select SIBYTE_SB1xxx_SOC |
25 | 28 | ||
26 | config SIBYTE_BCM112X | 29 | config SIBYTE_BCM112X |
27 | bool | 30 | bool |
28 | select SIBYTE_SB1xxx_SOC | 31 | select SIBYTE_SB1xxx_SOC |
32 | select SIBYTE_HAS_ZBUS_PROFILING | ||
29 | 33 | ||
30 | config SIBYTE_BCM1x80 | 34 | config SIBYTE_BCM1x80 |
31 | bool | 35 | bool |
@@ -37,6 +41,7 @@ config SIBYTE_BCM1x55 | |||
37 | bool | 41 | bool |
38 | select HW_HAS_PCI | 42 | select HW_HAS_PCI |
39 | select SIBYTE_SB1xxx_SOC | 43 | select SIBYTE_SB1xxx_SOC |
44 | select SIBYTE_HAS_ZBUS_PROFILING | ||
40 | select SYS_SUPPORTS_SMP | 45 | select SYS_SUPPORTS_SMP |
41 | 46 | ||
42 | config SIBYTE_SB1xxx_SOC | 47 | config SIBYTE_SB1xxx_SOC |
@@ -95,8 +100,10 @@ config CPU_SB1_PASS_2 | |||
95 | 100 | ||
96 | config SIBYTE_HAS_LDT | 101 | config SIBYTE_HAS_LDT |
97 | bool | 102 | bool |
98 | depends on PCI && (SIBYTE_SB1250 || SIBYTE_BCM1125H) | 103 | |
99 | default y | 104 | config SIBYTE_ENABLE_LDT_IF_PCI |
105 | bool | ||
106 | select SIBYTE_HAS_LDT if PCI | ||
100 | 107 | ||
101 | config SIMULATION | 108 | config SIMULATION |
102 | bool "Running under simulation" | 109 | bool "Running under simulation" |
@@ -162,5 +169,8 @@ config SIBYTE_SB1250_PROF | |||
162 | depends on SIBYTE_SB1xxx_SOC | 169 | depends on SIBYTE_SB1xxx_SOC |
163 | 170 | ||
164 | config SIBYTE_TBPROF | 171 | config SIBYTE_TBPROF |
165 | bool "Support for ZBbus profiling" | 172 | tristate "Support for ZBbus profiling" |
166 | depends on SIBYTE_SB1xxx_SOC | 173 | depends on SIBYTE_HAS_ZBUS_PROFILING |
174 | |||
175 | config SIBYTE_HAS_ZBUS_PROFILING | ||
176 | bool | ||
diff --git a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c index 212547c57310..ea0ca131a3cf 100644 --- a/arch/mips/sibyte/sb1250/bcm1250_tbprof.c +++ b/arch/mips/sibyte/sb1250/bcm1250_tbprof.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2001, 2002, 2003 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | 2 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License | 3 | * modify it under the terms of the GNU General Public License |
6 | * as published by the Free Software Foundation; either version 2 | 4 | * as published by the Free Software Foundation; either version 2 |
@@ -14,10 +12,16 @@ | |||
14 | * You should have received a copy of the GNU General Public License | 12 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write to the Free Software | 13 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 14 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
15 | * | ||
16 | * Copyright (C) 2001, 2002, 2003 Broadcom Corporation | ||
17 | * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org> | ||
18 | * Copyright (C) 2007 MIPS Technologies, Inc. | ||
19 | * written by Ralf Baechle <ralf@linux-mips.org> | ||
17 | */ | 20 | */ |
18 | 21 | ||
19 | #define SBPROF_TB_DEBUG 0 | 22 | #undef DEBUG |
20 | 23 | ||
24 | #include <linux/device.h> | ||
21 | #include <linux/module.h> | 25 | #include <linux/module.h> |
22 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
23 | #include <linux/types.h> | 27 | #include <linux/types.h> |
@@ -27,24 +31,98 @@ | |||
27 | #include <linux/vmalloc.h> | 31 | #include <linux/vmalloc.h> |
28 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
29 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
30 | #include <linux/reboot.h> | 34 | #include <linux/types.h> |
31 | #include <linux/smp_lock.h> | ||
32 | #include <linux/wait.h> | 35 | #include <linux/wait.h> |
33 | #include <asm/uaccess.h> | 36 | |
34 | #include <asm/io.h> | 37 | #include <asm/io.h> |
35 | #include <asm/sibyte/sb1250.h> | 38 | #include <asm/sibyte/sb1250.h> |
36 | #include <asm/sibyte/sb1250_regs.h> | 39 | #include <asm/sibyte/sb1250_regs.h> |
37 | #include <asm/sibyte/sb1250_scd.h> | 40 | #include <asm/sibyte/sb1250_scd.h> |
38 | #include <asm/sibyte/sb1250_int.h> | 41 | #include <asm/sibyte/sb1250_int.h> |
39 | #include <asm/sibyte/trace_prof.h> | 42 | #include <asm/system.h> |
43 | #include <asm/uaccess.h> | ||
40 | 44 | ||
41 | #define DEVNAME "bcm1250_tbprof" | 45 | #define SBPROF_TB_MAJOR 240 |
46 | |||
47 | typedef u64 tb_sample_t[6*256]; | ||
48 | |||
49 | enum open_status { | ||
50 | SB_CLOSED, | ||
51 | SB_OPENING, | ||
52 | SB_OPEN | ||
53 | }; | ||
54 | |||
55 | struct sbprof_tb { | ||
56 | wait_queue_head_t tb_sync; | ||
57 | wait_queue_head_t tb_read; | ||
58 | struct mutex lock; | ||
59 | enum open_status open; | ||
60 | tb_sample_t *sbprof_tbbuf; | ||
61 | int next_tb_sample; | ||
62 | |||
63 | volatile int tb_enable; | ||
64 | volatile int tb_armed; | ||
65 | |||
66 | }; | ||
42 | 67 | ||
43 | static struct sbprof_tb sbp; | 68 | static struct sbprof_tb sbp; |
44 | 69 | ||
70 | #define MAX_SAMPLE_BYTES (24*1024*1024) | ||
71 | #define MAX_TBSAMPLE_BYTES (12*1024*1024) | ||
72 | |||
73 | #define MAX_SAMPLES (MAX_SAMPLE_BYTES/sizeof(u_int32_t)) | ||
74 | #define TB_SAMPLE_SIZE (sizeof(tb_sample_t)) | ||
75 | #define MAX_TB_SAMPLES (MAX_TBSAMPLE_BYTES/TB_SAMPLE_SIZE) | ||
76 | |||
77 | /* ioctls */ | ||
78 | #define SBPROF_ZBSTART _IOW('s', 0, int) | ||
79 | #define SBPROF_ZBSTOP _IOW('s', 1, int) | ||
80 | #define SBPROF_ZBWAITFULL _IOW('s', 2, int) | ||
81 | |||
82 | /* | ||
83 | * Routines for using 40-bit SCD cycle counter | ||
84 | * | ||
85 | * Client responsible for either handling interrupts or making sure | ||
86 | * the cycles counter never saturates, e.g., by doing | ||
87 | * zclk_timer_init(0) at least every 2^40 - 1 ZCLKs. | ||
88 | */ | ||
89 | |||
90 | /* | ||
91 | * Configures SCD counter 0 to count ZCLKs starting from val; | ||
92 | * Configures SCD counters1,2,3 to count nothing. | ||
93 | * Must not be called while gathering ZBbus profiles. | ||
94 | */ | ||
95 | |||
96 | #define zclk_timer_init(val) \ | ||
97 | __asm__ __volatile__ (".set push;" \ | ||
98 | ".set mips64;" \ | ||
99 | "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \ | ||
100 | "sd %0, 0x10($8);" /* write val to counter0 */ \ | ||
101 | "sd %1, 0($8);" /* config counter0 for zclks*/ \ | ||
102 | ".set pop" \ | ||
103 | : /* no outputs */ \ | ||
104 | /* enable, counter0 */ \ | ||
105 | : /* inputs */ "r"(val), "r" ((1ULL << 33) | 1ULL) \ | ||
106 | : /* modifies */ "$8" ) | ||
107 | |||
108 | |||
109 | /* Reads SCD counter 0 and puts result in value | ||
110 | unsigned long long val; */ | ||
111 | #define zclk_get(val) \ | ||
112 | __asm__ __volatile__ (".set push;" \ | ||
113 | ".set mips64;" \ | ||
114 | "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \ | ||
115 | "ld %0, 0x10($8);" /* write val to counter0 */ \ | ||
116 | ".set pop" \ | ||
117 | : /* outputs */ "=r"(val) \ | ||
118 | : /* inputs */ \ | ||
119 | : /* modifies */ "$8" ) | ||
120 | |||
121 | #define DEVNAME "bcm1250_tbprof" | ||
122 | |||
45 | #define TB_FULL (sbp.next_tb_sample == MAX_TB_SAMPLES) | 123 | #define TB_FULL (sbp.next_tb_sample == MAX_TB_SAMPLES) |
46 | 124 | ||
47 | /************************************************************************ | 125 | /* |
48 | * Support for ZBbus sampling using the trace buffer | 126 | * Support for ZBbus sampling using the trace buffer |
49 | * | 127 | * |
50 | * We use the SCD performance counter interrupt, caused by a Zclk counter | 128 | * We use the SCD performance counter interrupt, caused by a Zclk counter |
@@ -54,30 +132,36 @@ static struct sbprof_tb sbp; | |||
54 | * overflow. | 132 | * overflow. |
55 | * | 133 | * |
56 | * We map the interrupt for trace_buffer_freeze to handle it on CPU 0. | 134 | * We map the interrupt for trace_buffer_freeze to handle it on CPU 0. |
57 | * | 135 | */ |
58 | ************************************************************************/ | ||
59 | 136 | ||
60 | static u_int64_t tb_period; | 137 | static u64 tb_period; |
61 | 138 | ||
62 | static void arm_tb(void) | 139 | static void arm_tb(void) |
63 | { | 140 | { |
64 | u_int64_t scdperfcnt; | 141 | u64 scdperfcnt; |
65 | u_int64_t next = (1ULL << 40) - tb_period; | 142 | u64 next = (1ULL << 40) - tb_period; |
66 | u_int64_t tb_options = M_SCD_TRACE_CFG_FREEZE_FULL; | 143 | u64 tb_options = M_SCD_TRACE_CFG_FREEZE_FULL; |
67 | /* Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to | 144 | |
68 | trigger start of trace. XXX vary sampling period */ | 145 | /* |
146 | * Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to trigger | ||
147 | *start of trace. XXX vary sampling period | ||
148 | */ | ||
69 | __raw_writeq(0, IOADDR(A_SCD_PERF_CNT_1)); | 149 | __raw_writeq(0, IOADDR(A_SCD_PERF_CNT_1)); |
70 | scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); | 150 | scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); |
71 | /* Unfortunately, in Pass 2 we must clear all counters to knock down | 151 | |
72 | a previous interrupt request. This means that bus profiling | 152 | /* |
73 | requires ALL of the SCD perf counters. */ | 153 | * Unfortunately, in Pass 2 we must clear all counters to knock down a |
154 | * previous interrupt request. This means that bus profiling requires | ||
155 | * ALL of the SCD perf counters. | ||
156 | */ | ||
74 | __raw_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) | | 157 | __raw_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) | |
75 | // keep counters 0,2,3 as is | 158 | /* keep counters 0,2,3 as is */ |
76 | M_SPC_CFG_ENABLE | // enable counting | 159 | M_SPC_CFG_ENABLE | /* enable counting */ |
77 | M_SPC_CFG_CLEAR | // clear all counters | 160 | M_SPC_CFG_CLEAR | /* clear all counters */ |
78 | V_SPC_CFG_SRC1(1), // counter 1 counts cycles | 161 | V_SPC_CFG_SRC1(1), /* counter 1 counts cycles */ |
79 | IOADDR(A_SCD_PERF_CNT_CFG)); | 162 | IOADDR(A_SCD_PERF_CNT_CFG)); |
80 | __raw_writeq(next, IOADDR(A_SCD_PERF_CNT_1)); | 163 | __raw_writeq(next, IOADDR(A_SCD_PERF_CNT_1)); |
164 | |||
81 | /* Reset the trace buffer */ | 165 | /* Reset the trace buffer */ |
82 | __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); | 166 | __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); |
83 | #if 0 && defined(M_SCD_TRACE_CFG_FORCECNT) | 167 | #if 0 && defined(M_SCD_TRACE_CFG_FORCECNT) |
@@ -91,43 +175,45 @@ static void arm_tb(void) | |||
91 | static irqreturn_t sbprof_tb_intr(int irq, void *dev_id) | 175 | static irqreturn_t sbprof_tb_intr(int irq, void *dev_id) |
92 | { | 176 | { |
93 | int i; | 177 | int i; |
94 | DBG(printk(DEVNAME ": tb_intr\n")); | 178 | |
179 | pr_debug(DEVNAME ": tb_intr\n"); | ||
180 | |||
95 | if (sbp.next_tb_sample < MAX_TB_SAMPLES) { | 181 | if (sbp.next_tb_sample < MAX_TB_SAMPLES) { |
96 | /* XXX should use XKPHYS to make writes bypass L2 */ | 182 | /* XXX should use XKPHYS to make writes bypass L2 */ |
97 | u_int64_t *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++]; | 183 | u64 *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++]; |
98 | /* Read out trace */ | 184 | /* Read out trace */ |
99 | __raw_writeq(M_SCD_TRACE_CFG_START_READ, | 185 | __raw_writeq(M_SCD_TRACE_CFG_START_READ, |
100 | IOADDR(A_SCD_TRACE_CFG)); | 186 | IOADDR(A_SCD_TRACE_CFG)); |
101 | __asm__ __volatile__ ("sync" : : : "memory"); | 187 | __asm__ __volatile__ ("sync" : : : "memory"); |
102 | /* Loop runs backwards because bundles are read out in reverse order */ | 188 | /* Loop runs backwards because bundles are read out in reverse order */ |
103 | for (i = 256 * 6; i > 0; i -= 6) { | 189 | for (i = 256 * 6; i > 0; i -= 6) { |
104 | // Subscripts decrease to put bundle in the order | 190 | /* Subscripts decrease to put bundle in the order */ |
105 | // t0 lo, t0 hi, t1 lo, t1 hi, t2 lo, t2 hi | 191 | /* t0 lo, t0 hi, t1 lo, t1 hi, t2 lo, t2 hi */ |
106 | p[i - 1] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); | 192 | p[i - 1] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); |
107 | // read t2 hi | 193 | /* read t2 hi */ |
108 | p[i - 2] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); | 194 | p[i - 2] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); |
109 | // read t2 lo | 195 | /* read t2 lo */ |
110 | p[i - 3] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); | 196 | p[i - 3] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); |
111 | // read t1 hi | 197 | /* read t1 hi */ |
112 | p[i - 4] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); | 198 | p[i - 4] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); |
113 | // read t1 lo | 199 | /* read t1 lo */ |
114 | p[i - 5] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); | 200 | p[i - 5] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); |
115 | // read t0 hi | 201 | /* read t0 hi */ |
116 | p[i - 6] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); | 202 | p[i - 6] = __raw_readq(IOADDR(A_SCD_TRACE_READ)); |
117 | // read t0 lo | 203 | /* read t0 lo */ |
118 | } | 204 | } |
119 | if (!sbp.tb_enable) { | 205 | if (!sbp.tb_enable) { |
120 | DBG(printk(DEVNAME ": tb_intr shutdown\n")); | 206 | pr_debug(DEVNAME ": tb_intr shutdown\n"); |
121 | __raw_writeq(M_SCD_TRACE_CFG_RESET, | 207 | __raw_writeq(M_SCD_TRACE_CFG_RESET, |
122 | IOADDR(A_SCD_TRACE_CFG)); | 208 | IOADDR(A_SCD_TRACE_CFG)); |
123 | sbp.tb_armed = 0; | 209 | sbp.tb_armed = 0; |
124 | wake_up(&sbp.tb_sync); | 210 | wake_up(&sbp.tb_sync); |
125 | } else { | 211 | } else { |
126 | arm_tb(); // knock down current interrupt and get another one later | 212 | arm_tb(); /* knock down current interrupt and get another one later */ |
127 | } | 213 | } |
128 | } else { | 214 | } else { |
129 | /* No more trace buffer samples */ | 215 | /* No more trace buffer samples */ |
130 | DBG(printk(DEVNAME ": tb_intr full\n")); | 216 | pr_debug(DEVNAME ": tb_intr full\n"); |
131 | __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); | 217 | __raw_writeq(M_SCD_TRACE_CFG_RESET, IOADDR(A_SCD_TRACE_CFG)); |
132 | sbp.tb_armed = 0; | 218 | sbp.tb_armed = 0; |
133 | if (!sbp.tb_enable) { | 219 | if (!sbp.tb_enable) { |
@@ -135,6 +221,7 @@ static irqreturn_t sbprof_tb_intr(int irq, void *dev_id) | |||
135 | } | 221 | } |
136 | wake_up(&sbp.tb_read); | 222 | wake_up(&sbp.tb_read); |
137 | } | 223 | } |
224 | |||
138 | return IRQ_HANDLED; | 225 | return IRQ_HANDLED; |
139 | } | 226 | } |
140 | 227 | ||
@@ -144,23 +231,30 @@ static irqreturn_t sbprof_pc_intr(int irq, void *dev_id) | |||
144 | return IRQ_NONE; | 231 | return IRQ_NONE; |
145 | } | 232 | } |
146 | 233 | ||
147 | int sbprof_zbprof_start(struct file *filp) | 234 | /* |
235 | * Requires: Already called zclk_timer_init with a value that won't | ||
236 | * saturate 40 bits. No subsequent use of SCD performance counters | ||
237 | * or trace buffer. | ||
238 | */ | ||
239 | |||
240 | static int sbprof_zbprof_start(struct file *filp) | ||
148 | { | 241 | { |
149 | u_int64_t scdperfcnt; | 242 | u64 scdperfcnt; |
243 | int err; | ||
150 | 244 | ||
151 | if (sbp.tb_enable) | 245 | if (xchg(&sbp.tb_enable, 1)) |
152 | return -EBUSY; | 246 | return -EBUSY; |
153 | 247 | ||
154 | DBG(printk(DEVNAME ": starting\n")); | 248 | pr_debug(DEVNAME ": starting\n"); |
155 | 249 | ||
156 | sbp.tb_enable = 1; | ||
157 | sbp.next_tb_sample = 0; | 250 | sbp.next_tb_sample = 0; |
158 | filp->f_pos = 0; | 251 | filp->f_pos = 0; |
159 | 252 | ||
160 | if (request_irq | 253 | err = request_irq(K_INT_TRACE_FREEZE, sbprof_tb_intr, 0, |
161 | (K_INT_TRACE_FREEZE, sbprof_tb_intr, 0, DEVNAME " trace freeze", &sbp)) { | 254 | DEVNAME " trace freeze", &sbp); |
255 | if (err) | ||
162 | return -EBUSY; | 256 | return -EBUSY; |
163 | } | 257 | |
164 | /* Make sure there isn't a perf-cnt interrupt waiting */ | 258 | /* Make sure there isn't a perf-cnt interrupt waiting */ |
165 | scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); | 259 | scdperfcnt = __raw_readq(IOADDR(A_SCD_PERF_CNT_CFG)); |
166 | /* Disable and clear counters, override SRC_1 */ | 260 | /* Disable and clear counters, override SRC_1 */ |
@@ -168,18 +262,21 @@ int sbprof_zbprof_start(struct file *filp) | |||
168 | M_SPC_CFG_ENABLE | M_SPC_CFG_CLEAR | V_SPC_CFG_SRC1(1), | 262 | M_SPC_CFG_ENABLE | M_SPC_CFG_CLEAR | V_SPC_CFG_SRC1(1), |
169 | IOADDR(A_SCD_PERF_CNT_CFG)); | 263 | IOADDR(A_SCD_PERF_CNT_CFG)); |
170 | 264 | ||
171 | /* We grab this interrupt to prevent others from trying to use | 265 | /* |
172 | it, even though we don't want to service the interrupts | 266 | * We grab this interrupt to prevent others from trying to use it, even |
173 | (they only feed into the trace-on-interrupt mechanism) */ | 267 | * though we don't want to service the interrupts (they only feed into |
174 | if (request_irq | 268 | * the trace-on-interrupt mechanism) |
175 | (K_INT_PERF_CNT, sbprof_pc_intr, 0, DEVNAME " scd perfcnt", &sbp)) { | 269 | */ |
176 | free_irq(K_INT_TRACE_FREEZE, &sbp); | 270 | err = request_irq(K_INT_PERF_CNT, sbprof_pc_intr, 0, |
177 | return -EBUSY; | 271 | DEVNAME " scd perfcnt", &sbp); |
178 | } | 272 | if (err) |
179 | 273 | goto out_free_irq; | |
180 | /* I need the core to mask these, but the interrupt mapper to | 274 | |
181 | pass them through. I am exploiting my knowledge that | 275 | /* |
182 | cp0_status masks out IP[5]. krw */ | 276 | * I need the core to mask these, but the interrupt mapper to pass them |
277 | * through. I am exploiting my knowledge that cp0_status masks out | ||
278 | * IP[5]. krw | ||
279 | */ | ||
183 | __raw_writeq(K_INT_MAP_I3, | 280 | __raw_writeq(K_INT_MAP_I3, |
184 | IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) + | 281 | IOADDR(A_IMR_REGISTER(0, R_IMR_INTERRUPT_MAP_BASE) + |
185 | (K_INT_PERF_CNT << 3))); | 282 | (K_INT_PERF_CNT << 3))); |
@@ -201,7 +298,7 @@ int sbprof_zbprof_start(struct file *filp) | |||
201 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_3)); | 298 | __raw_writeq(0, IOADDR(A_ADDR_TRAP_CFG_3)); |
202 | 299 | ||
203 | /* Initialize Trace Event 0-7 */ | 300 | /* Initialize Trace Event 0-7 */ |
204 | // when interrupt | 301 | /* when interrupt */ |
205 | __raw_writeq(M_SCD_TREVT_INTERRUPT, IOADDR(A_SCD_TRACE_EVENT_0)); | 302 | __raw_writeq(M_SCD_TREVT_INTERRUPT, IOADDR(A_SCD_TRACE_EVENT_0)); |
206 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_1)); | 303 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_1)); |
207 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_2)); | 304 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_2)); |
@@ -212,10 +309,10 @@ int sbprof_zbprof_start(struct file *filp) | |||
212 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_7)); | 309 | __raw_writeq(0, IOADDR(A_SCD_TRACE_EVENT_7)); |
213 | 310 | ||
214 | /* Initialize Trace Sequence 0-7 */ | 311 | /* Initialize Trace Sequence 0-7 */ |
215 | // Start on event 0 (interrupt) | 312 | /* Start on event 0 (interrupt) */ |
216 | __raw_writeq(V_SCD_TRSEQ_FUNC_START | 0x0fff, | 313 | __raw_writeq(V_SCD_TRSEQ_FUNC_START | 0x0fff, |
217 | IOADDR(A_SCD_TRACE_SEQUENCE_0)); | 314 | IOADDR(A_SCD_TRACE_SEQUENCE_0)); |
218 | // dsamp when d used | asamp when a used | 315 | /* dsamp when d used | asamp when a used */ |
219 | __raw_writeq(M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE | | 316 | __raw_writeq(M_SCD_TRSEQ_ASAMPLE | M_SCD_TRSEQ_DSAMPLE | |
220 | K_SCD_TRSEQ_TRIGGER_ALL, | 317 | K_SCD_TRSEQ_TRIGGER_ALL, |
221 | IOADDR(A_SCD_TRACE_SEQUENCE_1)); | 318 | IOADDR(A_SCD_TRACE_SEQUENCE_1)); |
@@ -232,33 +329,41 @@ int sbprof_zbprof_start(struct file *filp) | |||
232 | 329 | ||
233 | arm_tb(); | 330 | arm_tb(); |
234 | 331 | ||
235 | DBG(printk(DEVNAME ": done starting\n")); | 332 | pr_debug(DEVNAME ": done starting\n"); |
236 | 333 | ||
237 | return 0; | 334 | return 0; |
335 | |||
336 | out_free_irq: | ||
337 | free_irq(K_INT_TRACE_FREEZE, &sbp); | ||
338 | |||
339 | return err; | ||
238 | } | 340 | } |
239 | 341 | ||
240 | int sbprof_zbprof_stop(void) | 342 | static int sbprof_zbprof_stop(void) |
241 | { | 343 | { |
242 | DEFINE_WAIT(wait); | 344 | int err; |
243 | DBG(printk(DEVNAME ": stopping\n")); | 345 | |
346 | pr_debug(DEVNAME ": stopping\n"); | ||
244 | 347 | ||
245 | if (sbp.tb_enable) { | 348 | if (sbp.tb_enable) { |
349 | /* | ||
350 | * XXXKW there is a window here where the intr handler may run, | ||
351 | * see the disable, and do the wake_up before this sleep | ||
352 | * happens. | ||
353 | */ | ||
354 | pr_debug(DEVNAME ": wait for disarm\n"); | ||
355 | err = wait_event_interruptible(sbp.tb_sync, !sbp.tb_armed); | ||
356 | pr_debug(DEVNAME ": disarm complete, stat %d\n", err); | ||
357 | |||
358 | if (err) | ||
359 | return err; | ||
360 | |||
246 | sbp.tb_enable = 0; | 361 | sbp.tb_enable = 0; |
247 | /* XXXKW there is a window here where the intr handler | ||
248 | may run, see the disable, and do the wake_up before | ||
249 | this sleep happens. */ | ||
250 | if (sbp.tb_armed) { | ||
251 | DBG(printk(DEVNAME ": wait for disarm\n")); | ||
252 | prepare_to_wait(&sbp.tb_sync, &wait, TASK_INTERRUPTIBLE); | ||
253 | schedule(); | ||
254 | finish_wait(&sbp.tb_sync, &wait); | ||
255 | DBG(printk(DEVNAME ": disarm complete\n")); | ||
256 | } | ||
257 | free_irq(K_INT_TRACE_FREEZE, &sbp); | 362 | free_irq(K_INT_TRACE_FREEZE, &sbp); |
258 | free_irq(K_INT_PERF_CNT, &sbp); | 363 | free_irq(K_INT_PERF_CNT, &sbp); |
259 | } | 364 | } |
260 | 365 | ||
261 | DBG(printk(DEVNAME ": done stopping\n")); | 366 | pr_debug(DEVNAME ": done stopping\n"); |
262 | 367 | ||
263 | return 0; | 368 | return 0; |
264 | } | 369 | } |
@@ -268,42 +373,45 @@ static int sbprof_tb_open(struct inode *inode, struct file *filp) | |||
268 | int minor; | 373 | int minor; |
269 | 374 | ||
270 | minor = iminor(inode); | 375 | minor = iminor(inode); |
271 | if (minor != 0) { | 376 | if (minor != 0) |
272 | return -ENODEV; | 377 | return -ENODEV; |
273 | } | 378 | |
274 | if (sbp.open) { | 379 | if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED) |
275 | return -EBUSY; | 380 | return -EBUSY; |
276 | } | ||
277 | 381 | ||
278 | memset(&sbp, 0, sizeof(struct sbprof_tb)); | 382 | memset(&sbp, 0, sizeof(struct sbprof_tb)); |
383 | |||
279 | sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES); | 384 | sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES); |
280 | if (!sbp.sbprof_tbbuf) { | 385 | if (!sbp.sbprof_tbbuf) |
281 | return -ENOMEM; | 386 | return -ENOMEM; |
282 | } | 387 | |
283 | memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES); | 388 | memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES); |
284 | init_waitqueue_head(&sbp.tb_sync); | 389 | init_waitqueue_head(&sbp.tb_sync); |
285 | init_waitqueue_head(&sbp.tb_read); | 390 | init_waitqueue_head(&sbp.tb_read); |
286 | sbp.open = 1; | 391 | mutex_init(&sbp.lock); |
392 | |||
393 | sbp.open = SB_OPEN; | ||
287 | 394 | ||
288 | return 0; | 395 | return 0; |
289 | } | 396 | } |
290 | 397 | ||
291 | static int sbprof_tb_release(struct inode *inode, struct file *filp) | 398 | static int sbprof_tb_release(struct inode *inode, struct file *filp) |
292 | { | 399 | { |
293 | int minor; | 400 | int minor = iminor(inode); |
294 | 401 | ||
295 | minor = iminor(inode); | 402 | if (minor != 0 || !sbp.open) |
296 | if (minor != 0 || !sbp.open) { | ||
297 | return -ENODEV; | 403 | return -ENODEV; |
298 | } | ||
299 | 404 | ||
300 | if (sbp.tb_armed || sbp.tb_enable) { | 405 | mutex_lock(&sbp.lock); |
406 | |||
407 | if (sbp.tb_armed || sbp.tb_enable) | ||
301 | sbprof_zbprof_stop(); | 408 | sbprof_zbprof_stop(); |
302 | } | ||
303 | 409 | ||
304 | vfree(sbp.sbprof_tbbuf); | 410 | vfree(sbp.sbprof_tbbuf); |
305 | sbp.open = 0; | 411 | sbp.open = 0; |
306 | 412 | ||
413 | mutex_unlock(&sbp.lock); | ||
414 | |||
307 | return 0; | 415 | return 0; |
308 | } | 416 | } |
309 | 417 | ||
@@ -311,21 +419,35 @@ static ssize_t sbprof_tb_read(struct file *filp, char *buf, | |||
311 | size_t size, loff_t *offp) | 419 | size_t size, loff_t *offp) |
312 | { | 420 | { |
313 | int cur_sample, sample_off, cur_count, sample_left; | 421 | int cur_sample, sample_off, cur_count, sample_left; |
314 | char *src; | ||
315 | int count = 0; | ||
316 | char *dest = buf; | ||
317 | long cur_off = *offp; | 422 | long cur_off = *offp; |
423 | char *dest = buf; | ||
424 | int count = 0; | ||
425 | char *src; | ||
426 | |||
427 | if (!access_ok(VERIFY_WRITE, buf, size)) | ||
428 | return -EFAULT; | ||
429 | |||
430 | mutex_lock(&sbp.lock); | ||
318 | 431 | ||
319 | count = 0; | 432 | count = 0; |
320 | cur_sample = cur_off / TB_SAMPLE_SIZE; | 433 | cur_sample = cur_off / TB_SAMPLE_SIZE; |
321 | sample_off = cur_off % TB_SAMPLE_SIZE; | 434 | sample_off = cur_off % TB_SAMPLE_SIZE; |
322 | sample_left = TB_SAMPLE_SIZE - sample_off; | 435 | sample_left = TB_SAMPLE_SIZE - sample_off; |
436 | |||
323 | while (size && (cur_sample < sbp.next_tb_sample)) { | 437 | while (size && (cur_sample < sbp.next_tb_sample)) { |
438 | int err; | ||
439 | |||
324 | cur_count = size < sample_left ? size : sample_left; | 440 | cur_count = size < sample_left ? size : sample_left; |
325 | src = (char *)(((long)sbp.sbprof_tbbuf[cur_sample])+sample_off); | 441 | src = (char *)(((long)sbp.sbprof_tbbuf[cur_sample])+sample_off); |
326 | copy_to_user(dest, src, cur_count); | 442 | err = __copy_to_user(dest, src, cur_count); |
327 | DBG(printk(DEVNAME ": read from sample %d, %d bytes\n", | 443 | if (err) { |
328 | cur_sample, cur_count)); | 444 | *offp = cur_off + cur_count - err; |
445 | mutex_unlock(&sbp.lock); | ||
446 | return err; | ||
447 | } | ||
448 | |||
449 | pr_debug(DEVNAME ": read from sample %d, %d bytes\n", | ||
450 | cur_sample, cur_count); | ||
329 | size -= cur_count; | 451 | size -= cur_count; |
330 | sample_left -= cur_count; | 452 | sample_left -= cur_count; |
331 | if (!sample_left) { | 453 | if (!sample_left) { |
@@ -339,37 +461,43 @@ static ssize_t sbprof_tb_read(struct file *filp, char *buf, | |||
339 | dest += cur_count; | 461 | dest += cur_count; |
340 | count += cur_count; | 462 | count += cur_count; |
341 | } | 463 | } |
464 | |||
342 | *offp = cur_off; | 465 | *offp = cur_off; |
466 | mutex_unlock(&sbp.lock); | ||
343 | 467 | ||
344 | return count; | 468 | return count; |
345 | } | 469 | } |
346 | 470 | ||
347 | static long sbprof_tb_ioctl(struct file *filp, | 471 | static long sbprof_tb_ioctl(struct file *filp, unsigned int command, |
348 | unsigned int command, | 472 | unsigned long arg) |
349 | unsigned long arg) | ||
350 | { | 473 | { |
351 | int error = 0; | 474 | int error = 0; |
352 | 475 | ||
353 | lock_kernel(); | ||
354 | switch (command) { | 476 | switch (command) { |
355 | case SBPROF_ZBSTART: | 477 | case SBPROF_ZBSTART: |
478 | mutex_lock(&sbp.lock); | ||
356 | error = sbprof_zbprof_start(filp); | 479 | error = sbprof_zbprof_start(filp); |
480 | mutex_unlock(&sbp.lock); | ||
357 | break; | 481 | break; |
482 | |||
358 | case SBPROF_ZBSTOP: | 483 | case SBPROF_ZBSTOP: |
484 | mutex_lock(&sbp.lock); | ||
359 | error = sbprof_zbprof_stop(); | 485 | error = sbprof_zbprof_stop(); |
486 | mutex_unlock(&sbp.lock); | ||
360 | break; | 487 | break; |
488 | |||
361 | case SBPROF_ZBWAITFULL: | 489 | case SBPROF_ZBWAITFULL: |
362 | DEFINE_WAIT(wait); | 490 | error = wait_event_interruptible(sbp.tb_read, TB_FULL); |
363 | prepare_to_wait(&sbp.tb_read, &wait, TASK_INTERRUPTIBLE); | 491 | if (error) |
364 | schedule(); | 492 | break; |
365 | finish_wait(&sbp.tb_read, &wait); | 493 | |
366 | /* XXXKW check if interrupted? */ | 494 | error = put_user(TB_FULL, (int *) arg); |
367 | return put_user(TB_FULL, (int *) arg); | 495 | break; |
496 | |||
368 | default: | 497 | default: |
369 | error = -EINVAL; | 498 | error = -EINVAL; |
370 | break; | 499 | break; |
371 | } | 500 | } |
372 | unlock_kernel(); | ||
373 | 501 | ||
374 | return error; | 502 | return error; |
375 | } | 503 | } |
@@ -384,23 +512,60 @@ static const struct file_operations sbprof_tb_fops = { | |||
384 | .mmap = NULL, | 512 | .mmap = NULL, |
385 | }; | 513 | }; |
386 | 514 | ||
515 | static struct class *tb_class; | ||
516 | static struct device *tb_dev; | ||
517 | |||
387 | static int __init sbprof_tb_init(void) | 518 | static int __init sbprof_tb_init(void) |
388 | { | 519 | { |
520 | struct device *dev; | ||
521 | struct class *tbc; | ||
522 | int err; | ||
523 | |||
389 | if (register_chrdev(SBPROF_TB_MAJOR, DEVNAME, &sbprof_tb_fops)) { | 524 | if (register_chrdev(SBPROF_TB_MAJOR, DEVNAME, &sbprof_tb_fops)) { |
390 | printk(KERN_WARNING DEVNAME ": initialization failed (dev %d)\n", | 525 | printk(KERN_WARNING DEVNAME ": initialization failed (dev %d)\n", |
391 | SBPROF_TB_MAJOR); | 526 | SBPROF_TB_MAJOR); |
392 | return -EIO; | 527 | return -EIO; |
393 | } | 528 | } |
529 | |||
530 | tbc = class_create(THIS_MODULE, "sb_tracebuffer"); | ||
531 | if (IS_ERR(tbc)) { | ||
532 | err = PTR_ERR(tbc); | ||
533 | goto out_chrdev; | ||
534 | } | ||
535 | |||
536 | tb_class = tbc; | ||
537 | |||
538 | dev = device_create(tbc, NULL, MKDEV(SBPROF_TB_MAJOR, 0), "tb"); | ||
539 | if (IS_ERR(dev)) { | ||
540 | err = PTR_ERR(dev); | ||
541 | goto out_class; | ||
542 | } | ||
543 | tb_dev = dev; | ||
544 | |||
394 | sbp.open = 0; | 545 | sbp.open = 0; |
395 | tb_period = zbbus_mhz * 10000LL; | 546 | tb_period = zbbus_mhz * 10000LL; |
396 | printk(KERN_INFO DEVNAME ": initialized - tb_period = %lld\n", tb_period); | 547 | pr_info(DEVNAME ": initialized - tb_period = %lld\n", tb_period); |
548 | |||
397 | return 0; | 549 | return 0; |
550 | |||
551 | out_class: | ||
552 | class_destroy(tb_class); | ||
553 | out_chrdev: | ||
554 | unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME); | ||
555 | |||
556 | return err; | ||
398 | } | 557 | } |
399 | 558 | ||
400 | static void __exit sbprof_tb_cleanup(void) | 559 | static void __exit sbprof_tb_cleanup(void) |
401 | { | 560 | { |
561 | device_destroy(tb_class, MKDEV(SBPROF_TB_MAJOR, 0)); | ||
402 | unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME); | 562 | unregister_chrdev(SBPROF_TB_MAJOR, DEVNAME); |
563 | class_destroy(tb_class); | ||
403 | } | 564 | } |
404 | 565 | ||
405 | module_init(sbprof_tb_init); | 566 | module_init(sbprof_tb_init); |
406 | module_exit(sbprof_tb_cleanup); | 567 | module_exit(sbprof_tb_cleanup); |
568 | |||
569 | MODULE_ALIAS_CHARDEV_MAJOR(SBPROF_TB_MAJOR); | ||
570 | MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>"); | ||
571 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c index 1cb042eab720..87188f0f6fbe 100644 --- a/arch/mips/sibyte/sb1250/setup.c +++ b/arch/mips/sibyte/sb1250/setup.c | |||
@@ -16,6 +16,7 @@ | |||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/module.h> | ||
19 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
20 | #include <linux/reboot.h> | 21 | #include <linux/reboot.h> |
21 | #include <linux/string.h> | 22 | #include <linux/string.h> |
@@ -32,6 +33,7 @@ unsigned int soc_pass; | |||
32 | unsigned int soc_type; | 33 | unsigned int soc_type; |
33 | unsigned int periph_rev; | 34 | unsigned int periph_rev; |
34 | unsigned int zbbus_mhz; | 35 | unsigned int zbbus_mhz; |
36 | EXPORT_SYMBOL(zbbus_mhz); | ||
35 | 37 | ||
36 | static char *soc_str; | 38 | static char *soc_str; |
37 | static char *pass_str; | 39 | static char *pass_str; |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 7ec4ac77c0fa..e4006dc087ca 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -225,6 +225,22 @@ static struct cpu_spec cpu_specs[] = { | |||
225 | .oprofile_type = PPC_OPROFILE_POWER4, | 225 | .oprofile_type = PPC_OPROFILE_POWER4, |
226 | .platform = "ppc970", | 226 | .platform = "ppc970", |
227 | }, | 227 | }, |
228 | { /* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */ | ||
229 | .pvr_mask = 0xffffffff, | ||
230 | .pvr_value = 0x00440100, | ||
231 | .cpu_name = "PPC970MP", | ||
232 | .cpu_features = CPU_FTRS_PPC970, | ||
233 | .cpu_user_features = COMMON_USER_POWER4 | | ||
234 | PPC_FEATURE_HAS_ALTIVEC_COMP, | ||
235 | .icache_bsize = 128, | ||
236 | .dcache_bsize = 128, | ||
237 | .num_pmcs = 8, | ||
238 | .cpu_setup = __setup_cpu_ppc970, | ||
239 | .cpu_restore = __restore_cpu_ppc970, | ||
240 | .oprofile_cpu_type = "ppc64/970MP", | ||
241 | .oprofile_type = PPC_OPROFILE_POWER4, | ||
242 | .platform = "ppc970", | ||
243 | }, | ||
228 | { /* PPC970MP */ | 244 | { /* PPC970MP */ |
229 | .pvr_mask = 0xffff0000, | 245 | .pvr_mask = 0xffff0000, |
230 | .pvr_value = 0x00440000, | 246 | .pvr_value = 0x00440000, |
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index ea6fd552c7ea..91b443c9a488 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c | |||
@@ -916,7 +916,7 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw); | |||
916 | static int of_irq_map_oldworld(struct device_node *device, int index, | 916 | static int of_irq_map_oldworld(struct device_node *device, int index, |
917 | struct of_irq *out_irq) | 917 | struct of_irq *out_irq) |
918 | { | 918 | { |
919 | const u32 *ints; | 919 | const u32 *ints = NULL; |
920 | int intlen; | 920 | int intlen; |
921 | 921 | ||
922 | /* | 922 | /* |
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c index e5d819166874..8aa9a93e2aa2 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c | |||
@@ -55,9 +55,9 @@ static int mpc834x_usb_cfg(void) | |||
55 | struct device_node *np = NULL; | 55 | struct device_node *np = NULL; |
56 | int port0_is_dr = 0; | 56 | int port0_is_dr = 0; |
57 | 57 | ||
58 | if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL) | 58 | if ((np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr")) != NULL) |
59 | port0_is_dr = 1; | 59 | port0_is_dr = 1; |
60 | if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL){ | 60 | if ((np = of_find_compatible_node(NULL, "usb", "fsl-usb2-mph")) != NULL){ |
61 | if (port0_is_dr) { | 61 | if (port0_is_dr) { |
62 | printk(KERN_WARNING | 62 | printk(KERN_WARNING |
63 | "There is only one USB port on PB board! \n"); | 63 | "There is only one USB port on PB board! \n"); |
@@ -103,8 +103,8 @@ static int mpc834x_usb_cfg(void) | |||
103 | return -1; | 103 | return -1; |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * if MDS board is plug into PIB board, | 106 | * if Processor Board is plugged into PIB board, |
107 | * force to use the PHY on MDS board | 107 | * force to use the PHY on Processor Board |
108 | */ | 108 | */ |
109 | bcsr5 = in_8(bcsr_regs + 5); | 109 | bcsr5 = in_8(bcsr_regs + 5); |
110 | if (!(bcsr5 & BCSR5_INT_USB)) | 110 | if (!(bcsr5 & BCSR5_INT_USB)) |
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index eb661ccf2dab..e764c0aced88 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig | |||
@@ -47,6 +47,7 @@ config MPC85xx | |||
47 | bool | 47 | bool |
48 | select PPC_UDBG_16550 | 48 | select PPC_UDBG_16550 |
49 | select PPC_INDIRECT_PCI | 49 | select PPC_INDIRECT_PCI |
50 | select SERIAL_8250_SHARE_IRQ if SERIAL_8250 | ||
50 | default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS || MPC85xx_MDS | 51 | default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS || MPC85xx_MDS |
51 | 52 | ||
52 | config PPC_INDIRECT_PCI_BE | 53 | config PPC_INDIRECT_PCI_BE |
diff --git a/arch/powerpc/platforms/celleb/scc_epci.c b/arch/powerpc/platforms/celleb/scc_epci.c index c11b39c3776a..fb23d53eb09c 100644 --- a/arch/powerpc/platforms/celleb/scc_epci.c +++ b/arch/powerpc/platforms/celleb/scc_epci.c | |||
@@ -43,11 +43,34 @@ | |||
43 | 43 | ||
44 | #define iob() __asm__ __volatile__("eieio; sync":::"memory") | 44 | #define iob() __asm__ __volatile__("eieio; sync":::"memory") |
45 | 45 | ||
46 | static inline volatile void __iomem *celleb_epci_get_epci_base( | ||
47 | struct pci_controller *hose) | ||
48 | { | ||
49 | /* | ||
50 | * Note: | ||
51 | * Celleb epci uses cfg_addr as a base address for | ||
52 | * epci control registers. | ||
53 | */ | ||
54 | |||
55 | return hose->cfg_addr; | ||
56 | } | ||
57 | |||
58 | static inline volatile void __iomem *celleb_epci_get_epci_cfg( | ||
59 | struct pci_controller *hose) | ||
60 | { | ||
61 | /* | ||
62 | * Note: | ||
63 | * Celleb epci uses cfg_data as a base address for | ||
64 | * configuration area for epci devices. | ||
65 | */ | ||
66 | |||
67 | return hose->cfg_data; | ||
68 | } | ||
46 | 69 | ||
47 | #if 0 /* test code for epci dummy read */ | 70 | #if 0 /* test code for epci dummy read */ |
48 | static void celleb_epci_dummy_read(struct pci_dev *dev) | 71 | static void celleb_epci_dummy_read(struct pci_dev *dev) |
49 | { | 72 | { |
50 | void __iomem *epci_base; | 73 | volatile void __iomem *epci_base; |
51 | struct device_node *node; | 74 | struct device_node *node; |
52 | struct pci_controller *hose; | 75 | struct pci_controller *hose; |
53 | u32 val; | 76 | u32 val; |
@@ -58,7 +81,7 @@ static void celleb_epci_dummy_read(struct pci_dev *dev) | |||
58 | if (!hose) | 81 | if (!hose) |
59 | return; | 82 | return; |
60 | 83 | ||
61 | epci_base = hose->cfg_addr; | 84 | epci_base = celleb_epci_get_epci_base(hose); |
62 | 85 | ||
63 | val = in_be32(epci_base + SCC_EPCI_WATRP); | 86 | val = in_be32(epci_base + SCC_EPCI_WATRP); |
64 | iosync(); | 87 | iosync(); |
@@ -70,19 +93,20 @@ static void celleb_epci_dummy_read(struct pci_dev *dev) | |||
70 | static inline void clear_and_disable_master_abort_interrupt( | 93 | static inline void clear_and_disable_master_abort_interrupt( |
71 | struct pci_controller *hose) | 94 | struct pci_controller *hose) |
72 | { | 95 | { |
73 | void __iomem *addr; | 96 | volatile void __iomem *epci_base, *reg; |
74 | addr = hose->cfg_addr + PCI_COMMAND; | 97 | epci_base = celleb_epci_get_epci_base(hose); |
75 | out_be32(addr, in_be32(addr) | (PCI_STATUS_REC_MASTER_ABORT << 16)); | 98 | reg = epci_base + PCI_COMMAND; |
99 | out_be32(reg, in_be32(reg) | (PCI_STATUS_REC_MASTER_ABORT << 16)); | ||
76 | } | 100 | } |
77 | 101 | ||
78 | static int celleb_epci_check_abort(struct pci_controller *hose, | 102 | static int celleb_epci_check_abort(struct pci_controller *hose, |
79 | void __iomem *addr) | 103 | volatile void __iomem *addr) |
80 | { | 104 | { |
81 | void __iomem *reg, *epci_base; | 105 | volatile void __iomem *reg, *epci_base; |
82 | u32 val; | 106 | u32 val; |
83 | 107 | ||
84 | iob(); | 108 | iob(); |
85 | epci_base = hose->cfg_addr; | 109 | epci_base = celleb_epci_get_epci_base(hose); |
86 | 110 | ||
87 | reg = epci_base + PCI_COMMAND; | 111 | reg = epci_base + PCI_COMMAND; |
88 | val = in_be32(reg); | 112 | val = in_be32(reg); |
@@ -108,20 +132,21 @@ static int celleb_epci_check_abort(struct pci_controller *hose, | |||
108 | return PCIBIOS_SUCCESSFUL; | 132 | return PCIBIOS_SUCCESSFUL; |
109 | } | 133 | } |
110 | 134 | ||
111 | static void __iomem *celleb_epci_make_config_addr(struct pci_controller *hose, | 135 | static volatile void __iomem *celleb_epci_make_config_addr( |
136 | struct pci_controller *hose, | ||
112 | unsigned int devfn, int where) | 137 | unsigned int devfn, int where) |
113 | { | 138 | { |
114 | void __iomem *addr; | 139 | volatile void __iomem *addr; |
115 | struct pci_bus *bus = hose->bus; | 140 | struct pci_bus *bus = hose->bus; |
116 | 141 | ||
117 | if (bus->self) | 142 | if (bus->self) |
118 | addr = hose->cfg_data + | 143 | addr = celleb_epci_get_epci_cfg(hose) + |
119 | (((bus->number & 0xff) << 16) | 144 | (((bus->number & 0xff) << 16) |
120 | | ((devfn & 0xff) << 8) | 145 | | ((devfn & 0xff) << 8) |
121 | | (where & 0xff) | 146 | | (where & 0xff) |
122 | | 0x01000000); | 147 | | 0x01000000); |
123 | else | 148 | else |
124 | addr = hose->cfg_data + | 149 | addr = celleb_epci_get_epci_cfg(hose) + |
125 | (((devfn & 0xff) << 8) | (where & 0xff)); | 150 | (((devfn & 0xff) << 8) | (where & 0xff)); |
126 | 151 | ||
127 | pr_debug("EPCI: config_addr = 0x%p\n", addr); | 152 | pr_debug("EPCI: config_addr = 0x%p\n", addr); |
@@ -132,7 +157,7 @@ static void __iomem *celleb_epci_make_config_addr(struct pci_controller *hose, | |||
132 | static int celleb_epci_read_config(struct pci_bus *bus, | 157 | static int celleb_epci_read_config(struct pci_bus *bus, |
133 | unsigned int devfn, int where, int size, u32 * val) | 158 | unsigned int devfn, int where, int size, u32 * val) |
134 | { | 159 | { |
135 | void __iomem *addr; | 160 | volatile void __iomem *epci_base, *addr; |
136 | struct device_node *node; | 161 | struct device_node *node; |
137 | struct pci_controller *hose; | 162 | struct pci_controller *hose; |
138 | 163 | ||
@@ -142,13 +167,14 @@ static int celleb_epci_read_config(struct pci_bus *bus, | |||
142 | node = (struct device_node *)bus->sysdata; | 167 | node = (struct device_node *)bus->sysdata; |
143 | hose = pci_find_hose_for_OF_device(node); | 168 | hose = pci_find_hose_for_OF_device(node); |
144 | 169 | ||
145 | if (!hose->cfg_data) | 170 | if (!celleb_epci_get_epci_cfg(hose)) |
146 | return PCIBIOS_DEVICE_NOT_FOUND; | 171 | return PCIBIOS_DEVICE_NOT_FOUND; |
147 | 172 | ||
148 | if (bus->number == hose->first_busno && devfn == 0) { | 173 | if (bus->number == hose->first_busno && devfn == 0) { |
149 | /* EPCI controller self */ | 174 | /* EPCI controller self */ |
150 | 175 | ||
151 | addr = hose->cfg_addr + where; | 176 | epci_base = celleb_epci_get_epci_base(hose); |
177 | addr = epci_base + where; | ||
152 | 178 | ||
153 | switch (size) { | 179 | switch (size) { |
154 | case 1: | 180 | case 1: |
@@ -185,7 +211,7 @@ static int celleb_epci_read_config(struct pci_bus *bus, | |||
185 | } | 211 | } |
186 | 212 | ||
187 | pr_debug("EPCI: " | 213 | pr_debug("EPCI: " |
188 | "addr=0x%lx, devfn=0x%x, where=0x%x, size=0x%x, val=0x%x\n", | 214 | "addr=0x%p, devfn=0x%x, where=0x%x, size=0x%x, val=0x%x\n", |
189 | addr, devfn, where, size, *val); | 215 | addr, devfn, where, size, *val); |
190 | 216 | ||
191 | return celleb_epci_check_abort(hose, NULL); | 217 | return celleb_epci_check_abort(hose, NULL); |
@@ -194,7 +220,7 @@ static int celleb_epci_read_config(struct pci_bus *bus, | |||
194 | static int celleb_epci_write_config(struct pci_bus *bus, | 220 | static int celleb_epci_write_config(struct pci_bus *bus, |
195 | unsigned int devfn, int where, int size, u32 val) | 221 | unsigned int devfn, int where, int size, u32 val) |
196 | { | 222 | { |
197 | void __iomem *addr; | 223 | volatile void __iomem *epci_base, *addr; |
198 | struct device_node *node; | 224 | struct device_node *node; |
199 | struct pci_controller *hose; | 225 | struct pci_controller *hose; |
200 | 226 | ||
@@ -204,13 +230,15 @@ static int celleb_epci_write_config(struct pci_bus *bus, | |||
204 | node = (struct device_node *)bus->sysdata; | 230 | node = (struct device_node *)bus->sysdata; |
205 | hose = pci_find_hose_for_OF_device(node); | 231 | hose = pci_find_hose_for_OF_device(node); |
206 | 232 | ||
207 | if (!hose->cfg_data) | 233 | |
234 | if (!celleb_epci_get_epci_cfg(hose)) | ||
208 | return PCIBIOS_DEVICE_NOT_FOUND; | 235 | return PCIBIOS_DEVICE_NOT_FOUND; |
209 | 236 | ||
210 | if (bus->number == hose->first_busno && devfn == 0) { | 237 | if (bus->number == hose->first_busno && devfn == 0) { |
211 | /* EPCI controller self */ | 238 | /* EPCI controller self */ |
212 | 239 | ||
213 | addr = hose->cfg_addr + where; | 240 | epci_base = celleb_epci_get_epci_base(hose); |
241 | addr = epci_base + where; | ||
214 | 242 | ||
215 | switch (size) { | 243 | switch (size) { |
216 | case 1: | 244 | case 1: |
@@ -258,10 +286,10 @@ struct pci_ops celleb_epci_ops = { | |||
258 | static int __devinit celleb_epci_init(struct pci_controller *hose) | 286 | static int __devinit celleb_epci_init(struct pci_controller *hose) |
259 | { | 287 | { |
260 | u32 val; | 288 | u32 val; |
261 | void __iomem *reg, *epci_base; | 289 | volatile void __iomem *reg, *epci_base; |
262 | int hwres = 0; | 290 | int hwres = 0; |
263 | 291 | ||
264 | epci_base = hose->cfg_addr; | 292 | epci_base = celleb_epci_get_epci_base(hose); |
265 | 293 | ||
266 | /* PCI core reset(Internal bus and PCI clock) */ | 294 | /* PCI core reset(Internal bus and PCI clock) */ |
267 | reg = epci_base + SCC_EPCI_CKCTRL; | 295 | reg = epci_base + SCC_EPCI_CKCTRL; |
@@ -382,6 +410,18 @@ int __devinit celleb_setup_epci(struct device_node *node, | |||
382 | 410 | ||
383 | pr_debug("PCI: celleb_setup_epci()\n"); | 411 | pr_debug("PCI: celleb_setup_epci()\n"); |
384 | 412 | ||
413 | /* | ||
414 | * Note: | ||
415 | * Celleb epci uses cfg_addr and cfg_data member of | ||
416 | * pci_controller structure in irregular way. | ||
417 | * | ||
418 | * cfg_addr is used to map for control registers of | ||
419 | * celleb epci. | ||
420 | * | ||
421 | * cfg_data is used for configuration area of devices | ||
422 | * on Celleb epci buses. | ||
423 | */ | ||
424 | |||
385 | if (of_address_to_resource(node, 0, &r)) | 425 | if (of_address_to_resource(node, 0, &r)) |
386 | goto error; | 426 | goto error; |
387 | hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1)); | 427 | hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1)); |
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig index 886c522d78e9..3410bcbc9dbe 100644 --- a/arch/powerpc/platforms/embedded6xx/Kconfig +++ b/arch/powerpc/platforms/embedded6xx/Kconfig | |||
@@ -79,6 +79,7 @@ config LINKSTATION | |||
79 | select MPIC | 79 | select MPIC |
80 | select FSL_SOC | 80 | select FSL_SOC |
81 | select PPC_UDBG_16550 if SERIAL_8250 | 81 | select PPC_UDBG_16550 if SERIAL_8250 |
82 | select DEFAULT_UIMAGE | ||
82 | help | 83 | help |
83 | Select LINKSTATION if configuring for one of PPC- (MPC8241) | 84 | Select LINKSTATION if configuring for one of PPC- (MPC8241) |
84 | based NAS systems from Buffalo Technology. So far only | 85 | based NAS systems from Buffalo Technology. So far only |
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index c29a6a064d22..24cc50c1774a 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c | |||
@@ -810,6 +810,7 @@ core99_ata100_enable(struct device_node *node, long value) | |||
810 | unsigned long flags; | 810 | unsigned long flags; |
811 | struct pci_dev *pdev = NULL; | 811 | struct pci_dev *pdev = NULL; |
812 | u8 pbus, pid; | 812 | u8 pbus, pid; |
813 | int rc; | ||
813 | 814 | ||
814 | if (uninorth_rev < 0x24) | 815 | if (uninorth_rev < 0x24) |
815 | return -ENODEV; | 816 | return -ENODEV; |
@@ -828,7 +829,9 @@ core99_ata100_enable(struct device_node *node, long value) | |||
828 | pdev = pci_find_slot(pbus, pid); | 829 | pdev = pci_find_slot(pbus, pid); |
829 | if (pdev == NULL) | 830 | if (pdev == NULL) |
830 | return 0; | 831 | return 0; |
831 | pci_enable_device(pdev); | 832 | rc = pci_enable_device(pdev); |
833 | if (rc) | ||
834 | return rc; | ||
832 | pci_set_master(pdev); | 835 | pci_set_master(pdev); |
833 | } | 836 | } |
834 | return 0; | 837 | return 0; |
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index f42475b27c15..6fbac308ded6 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c | |||
@@ -1191,8 +1191,11 @@ void __init pmac_pcibios_after_init(void) | |||
1191 | * -- BenH | 1191 | * -- BenH |
1192 | */ | 1192 | */ |
1193 | for_each_pci_dev(dev) { | 1193 | for_each_pci_dev(dev) { |
1194 | if ((dev->class >> 16) == PCI_BASE_CLASS_STORAGE) | 1194 | if ((dev->class >> 16) != PCI_BASE_CLASS_STORAGE) |
1195 | pci_enable_device(dev); | 1195 | continue; |
1196 | if (pci_enable_device(dev)) | ||
1197 | printk(KERN_WARNING | ||
1198 | "pci: Failed to enable %s\n", pci_name(dev)); | ||
1196 | } | 1199 | } |
1197 | #endif /* CONFIG_BLK_DEV_IDE */ | 1200 | #endif /* CONFIG_BLK_DEV_IDE */ |
1198 | 1201 | ||
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 0183e5fbaf46..bf299b66f3fc 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -218,7 +218,7 @@ Commands:\n\ | |||
218 | " ss stop execution on all spus\n\ | 218 | " ss stop execution on all spus\n\ |
219 | sr restore execution on stopped spus\n\ | 219 | sr restore execution on stopped spus\n\ |
220 | sf # dump spu fields for spu # (in hex)\n\ | 220 | sf # dump spu fields for spu # (in hex)\n\ |
221 | sd # dump spu local store for spu # (in hex)\ | 221 | sd # dump spu local store for spu # (in hex)\n\ |
222 | sdi # disassemble spu local store for spu # (in hex)\n" | 222 | sdi # disassemble spu local store for spu # (in hex)\n" |
223 | #endif | 223 | #endif |
224 | " S print special registers\n\ | 224 | " S print special registers\n\ |
diff --git a/arch/x86_64/kernel/early-quirks.c b/arch/x86_64/kernel/early-quirks.c index 8047ea8c2ab2..dec587b293bf 100644 --- a/arch/x86_64/kernel/early-quirks.c +++ b/arch/x86_64/kernel/early-quirks.c | |||
@@ -30,11 +30,8 @@ static void via_bugs(void) | |||
30 | 30 | ||
31 | #ifdef CONFIG_ACPI | 31 | #ifdef CONFIG_ACPI |
32 | 32 | ||
33 | static int nvidia_hpet_detected __initdata; | ||
34 | |||
35 | static int __init nvidia_hpet_check(struct acpi_table_header *header) | 33 | static int __init nvidia_hpet_check(struct acpi_table_header *header) |
36 | { | 34 | { |
37 | nvidia_hpet_detected = 1; | ||
38 | return 0; | 35 | return 0; |
39 | } | 36 | } |
40 | #endif | 37 | #endif |
@@ -52,11 +49,7 @@ static void nvidia_bugs(void) | |||
52 | if (acpi_use_timer_override) | 49 | if (acpi_use_timer_override) |
53 | return; | 50 | return; |
54 | 51 | ||
55 | nvidia_hpet_detected = 0; | 52 | if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check)) { |
56 | if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check)) | ||
57 | return; | ||
58 | |||
59 | if (nvidia_hpet_detected == 0) { | ||
60 | acpi_skip_timer_override = 1; | 53 | acpi_skip_timer_override = 1; |
61 | printk(KERN_INFO "Nvidia board " | 54 | printk(KERN_INFO "Nvidia board " |
62 | "detected. Ignoring ACPI " | 55 | "detected. Ignoring ACPI " |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 7c49e103cf8f..e2ce4a9c1c92 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -7,6 +7,7 @@ menu "ACPI (Advanced Configuration and Power Interface) Support" | |||
7 | depends on !X86_VISWS | 7 | depends on !X86_VISWS |
8 | depends on !IA64_HP_SIM | 8 | depends on !IA64_HP_SIM |
9 | depends on IA64 || X86 | 9 | depends on IA64 || X86 |
10 | depends on PM | ||
10 | 11 | ||
11 | config ACPI | 12 | config ACPI |
12 | bool "ACPI Support" | 13 | bool "ACPI Support" |
@@ -243,6 +244,17 @@ config ACPI_IBM_DOCK | |||
243 | 244 | ||
244 | If you are not sure, say N here. | 245 | If you are not sure, say N here. |
245 | 246 | ||
247 | config ACPI_IBM_BAY | ||
248 | bool "Legacy Removable Bay Support" | ||
249 | depends on ACPI_IBM | ||
250 | default y | ||
251 | ---help--- | ||
252 | Allows the ibm_acpi driver to handle removable bays. It will allow | ||
253 | disabling the device in the bay, and also generate notifications when | ||
254 | the bay lever is ejected or inserted. | ||
255 | |||
256 | If you are not sure, say Y here. | ||
257 | |||
246 | config ACPI_TOSHIBA | 258 | config ACPI_TOSHIBA |
247 | tristate "Toshiba Laptop Extras" | 259 | tristate "Toshiba Laptop Extras" |
248 | depends on X86 | 260 | depends on X86 |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index f289fd41e77d..3ec110ce00c8 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -79,11 +79,17 @@ static int __init blacklist_by_year(void) | |||
79 | { | 79 | { |
80 | int year = dmi_get_year(DMI_BIOS_DATE); | 80 | int year = dmi_get_year(DMI_BIOS_DATE); |
81 | /* Doesn't exist? Likely an old system */ | 81 | /* Doesn't exist? Likely an old system */ |
82 | if (year == -1) | 82 | if (year == -1) { |
83 | printk(KERN_ERR PREFIX "no DMI BIOS year, " | ||
84 | "acpi=force is required to enable ACPI\n" ); | ||
83 | return 1; | 85 | return 1; |
86 | } | ||
84 | /* 0? Likely a buggy new BIOS */ | 87 | /* 0? Likely a buggy new BIOS */ |
85 | if (year == 0) | 88 | if (year == 0) { |
89 | printk(KERN_ERR PREFIX "DMI BIOS year==0, " | ||
90 | "assuming ACPI-capable machine\n" ); | ||
86 | return 0; | 91 | return 0; |
92 | } | ||
87 | if (year < CONFIG_ACPI_BLACKLIST_YEAR) { | 93 | if (year < CONFIG_ACPI_BLACKLIST_YEAR) { |
88 | printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " | 94 | printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " |
89 | "acpi=force is required to enable ACPI\n", | 95 | "acpi=force is required to enable ACPI\n", |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index ab6888373795..a802962ff2b4 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -100,6 +100,7 @@ static struct acpi_ec { | |||
100 | unsigned long global_lock; | 100 | unsigned long global_lock; |
101 | struct mutex lock; | 101 | struct mutex lock; |
102 | atomic_t query_pending; | 102 | atomic_t query_pending; |
103 | atomic_t event_count; | ||
103 | atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */ | 104 | atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */ |
104 | wait_queue_head_t wait; | 105 | wait_queue_head_t wait; |
105 | } *ec_ecdt; | 106 | } *ec_ecdt; |
@@ -131,10 +132,12 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) | |||
131 | outb(data, ec->data_addr); | 132 | outb(data, ec->data_addr); |
132 | } | 133 | } |
133 | 134 | ||
134 | static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | 135 | static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event, |
136 | unsigned old_count) | ||
135 | { | 137 | { |
136 | u8 status = acpi_ec_read_status(ec); | 138 | u8 status = acpi_ec_read_status(ec); |
137 | 139 | if (old_count == atomic_read(&ec->event_count)) | |
140 | return 0; | ||
138 | if (event == ACPI_EC_EVENT_OBF_1) { | 141 | if (event == ACPI_EC_EVENT_OBF_1) { |
139 | if (status & ACPI_EC_FLAG_OBF) | 142 | if (status & ACPI_EC_FLAG_OBF) |
140 | return 1; | 143 | return 1; |
@@ -146,19 +149,19 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | |||
146 | return 0; | 149 | return 0; |
147 | } | 150 | } |
148 | 151 | ||
149 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event) | 152 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, unsigned count) |
150 | { | 153 | { |
151 | if (acpi_ec_mode == EC_POLL) { | 154 | if (acpi_ec_mode == EC_POLL) { |
152 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 155 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
153 | while (time_before(jiffies, delay)) { | 156 | while (time_before(jiffies, delay)) { |
154 | if (acpi_ec_check_status(ec, event)) | 157 | if (acpi_ec_check_status(ec, event, 0)) |
155 | return 0; | 158 | return 0; |
156 | } | 159 | } |
157 | } else { | 160 | } else { |
158 | if (wait_event_timeout(ec->wait, | 161 | if (wait_event_timeout(ec->wait, |
159 | acpi_ec_check_status(ec, event), | 162 | acpi_ec_check_status(ec, event, count), |
160 | msecs_to_jiffies(ACPI_EC_DELAY)) || | 163 | msecs_to_jiffies(ACPI_EC_DELAY)) || |
161 | acpi_ec_check_status(ec, event)) { | 164 | acpi_ec_check_status(ec, event, 0)) { |
162 | return 0; | 165 | return 0; |
163 | } else { | 166 | } else { |
164 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," | 167 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," |
@@ -225,21 +228,22 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
225 | u8 * rdata, unsigned rdata_len) | 228 | u8 * rdata, unsigned rdata_len) |
226 | { | 229 | { |
227 | int result = 0; | 230 | int result = 0; |
228 | 231 | unsigned count = atomic_read(&ec->event_count); | |
229 | acpi_ec_write_cmd(ec, command); | 232 | acpi_ec_write_cmd(ec, command); |
230 | 233 | ||
231 | for (; wdata_len > 0; --wdata_len) { | 234 | for (; wdata_len > 0; --wdata_len) { |
232 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 235 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count); |
233 | if (result) { | 236 | if (result) { |
234 | printk(KERN_ERR PREFIX | 237 | printk(KERN_ERR PREFIX |
235 | "write_cmd timeout, command = %d\n", command); | 238 | "write_cmd timeout, command = %d\n", command); |
236 | goto end; | 239 | goto end; |
237 | } | 240 | } |
241 | count = atomic_read(&ec->event_count); | ||
238 | acpi_ec_write_data(ec, *(wdata++)); | 242 | acpi_ec_write_data(ec, *(wdata++)); |
239 | } | 243 | } |
240 | 244 | ||
241 | if (!rdata_len) { | 245 | if (!rdata_len) { |
242 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 246 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count); |
243 | if (result) { | 247 | if (result) { |
244 | printk(KERN_ERR PREFIX | 248 | printk(KERN_ERR PREFIX |
245 | "finish-write timeout, command = %d\n", command); | 249 | "finish-write timeout, command = %d\n", command); |
@@ -250,13 +254,13 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
250 | } | 254 | } |
251 | 255 | ||
252 | for (; rdata_len > 0; --rdata_len) { | 256 | for (; rdata_len > 0; --rdata_len) { |
253 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1); | 257 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count); |
254 | if (result) { | 258 | if (result) { |
255 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", | 259 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", |
256 | command); | 260 | command); |
257 | goto end; | 261 | goto end; |
258 | } | 262 | } |
259 | 263 | count = atomic_read(&ec->event_count); | |
260 | *(rdata++) = acpi_ec_read_data(ec); | 264 | *(rdata++) = acpi_ec_read_data(ec); |
261 | } | 265 | } |
262 | end: | 266 | end: |
@@ -288,7 +292,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
288 | /* Make sure GPE is enabled before doing transaction */ | 292 | /* Make sure GPE is enabled before doing transaction */ |
289 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 293 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); |
290 | 294 | ||
291 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); | 295 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0); |
292 | if (status) { | 296 | if (status) { |
293 | printk(KERN_DEBUG PREFIX | 297 | printk(KERN_DEBUG PREFIX |
294 | "input buffer is not empty, aborting transaction\n"); | 298 | "input buffer is not empty, aborting transaction\n"); |
@@ -369,8 +373,8 @@ int ec_write(u8 addr, u8 val) | |||
369 | EXPORT_SYMBOL(ec_write); | 373 | EXPORT_SYMBOL(ec_write); |
370 | 374 | ||
371 | int ec_transaction(u8 command, | 375 | int ec_transaction(u8 command, |
372 | const u8 * wdata, unsigned wdata_len, | 376 | const u8 * wdata, unsigned wdata_len, |
373 | u8 * rdata, unsigned rdata_len) | 377 | u8 * rdata, unsigned rdata_len) |
374 | { | 378 | { |
375 | struct acpi_ec *ec; | 379 | struct acpi_ec *ec; |
376 | 380 | ||
@@ -435,7 +439,7 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
435 | acpi_status status = AE_OK; | 439 | acpi_status status = AE_OK; |
436 | u8 value; | 440 | u8 value; |
437 | struct acpi_ec *ec = (struct acpi_ec *)data; | 441 | struct acpi_ec *ec = (struct acpi_ec *)data; |
438 | 442 | atomic_inc(&ec->event_count); | |
439 | if (acpi_ec_mode == EC_INTR) { | 443 | if (acpi_ec_mode == EC_INTR) { |
440 | wake_up(&ec->wait); | 444 | wake_up(&ec->wait); |
441 | } | 445 | } |
@@ -633,6 +637,7 @@ static int acpi_ec_add(struct acpi_device *device) | |||
633 | ec->uid = -1; | 637 | ec->uid = -1; |
634 | mutex_init(&ec->lock); | 638 | mutex_init(&ec->lock); |
635 | atomic_set(&ec->query_pending, 0); | 639 | atomic_set(&ec->query_pending, 0); |
640 | atomic_set(&ec->event_count, 1); | ||
636 | if (acpi_ec_mode == EC_INTR) { | 641 | if (acpi_ec_mode == EC_INTR) { |
637 | atomic_set(&ec->leaving_burst, 1); | 642 | atomic_set(&ec->leaving_burst, 1); |
638 | init_waitqueue_head(&ec->wait); | 643 | init_waitqueue_head(&ec->wait); |
@@ -807,6 +812,7 @@ acpi_fake_ecdt_callback(acpi_handle handle, | |||
807 | acpi_status status; | 812 | acpi_status status; |
808 | 813 | ||
809 | mutex_init(&ec_ecdt->lock); | 814 | mutex_init(&ec_ecdt->lock); |
815 | atomic_set(&ec_ecdt->event_count, 1); | ||
810 | if (acpi_ec_mode == EC_INTR) { | 816 | if (acpi_ec_mode == EC_INTR) { |
811 | init_waitqueue_head(&ec_ecdt->wait); | 817 | init_waitqueue_head(&ec_ecdt->wait); |
812 | } | 818 | } |
@@ -888,6 +894,7 @@ static int __init acpi_ec_get_real_ecdt(void) | |||
888 | return -ENOMEM; | 894 | return -ENOMEM; |
889 | 895 | ||
890 | mutex_init(&ec_ecdt->lock); | 896 | mutex_init(&ec_ecdt->lock); |
897 | atomic_set(&ec_ecdt->event_count, 1); | ||
891 | if (acpi_ec_mode == EC_INTR) { | 898 | if (acpi_ec_mode == EC_INTR) { |
892 | init_waitqueue_head(&ec_ecdt->wait); | 899 | init_waitqueue_head(&ec_ecdt->wait); |
893 | } | 900 | } |
@@ -1016,8 +1023,7 @@ static int __init acpi_ec_set_intr_mode(char *str) | |||
1016 | acpi_ec_mode = EC_POLL; | 1023 | acpi_ec_mode = EC_POLL; |
1017 | } | 1024 | } |
1018 | acpi_ec_driver.ops.add = acpi_ec_add; | 1025 | acpi_ec_driver.ops.add = acpi_ec_add; |
1019 | printk(KERN_NOTICE PREFIX "%s mode.\n", | 1026 | printk(KERN_NOTICE PREFIX "%s mode.\n", intr ? "interrupt" : "polling"); |
1020 | intr ? "interrupt" : "polling"); | ||
1021 | 1027 | ||
1022 | return 1; | 1028 | return 1; |
1023 | } | 1029 | } |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index d572700197f3..8dcade63b04b 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -423,6 +423,8 @@ static acpi_status acpi_ev_remove_global_lock_handler(void) | |||
423 | * the global lock appear as a standard mutex on the OS side. | 423 | * the global lock appear as a standard mutex on the OS side. |
424 | * | 424 | * |
425 | *****************************************************************************/ | 425 | *****************************************************************************/ |
426 | static acpi_thread_id acpi_ev_global_lock_thread_id; | ||
427 | static int acpi_ev_global_lock_acquired; | ||
426 | 428 | ||
427 | acpi_status acpi_ev_acquire_global_lock(u16 timeout) | 429 | acpi_status acpi_ev_acquire_global_lock(u16 timeout) |
428 | { | 430 | { |
@@ -435,11 +437,24 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
435 | * Only one thread can acquire the GL at a time, the global_lock_mutex | 437 | * Only one thread can acquire the GL at a time, the global_lock_mutex |
436 | * enforces this. This interface releases the interpreter if we must wait. | 438 | * enforces this. This interface releases the interpreter if we must wait. |
437 | */ | 439 | */ |
438 | status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout); | 440 | status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, 0); |
441 | if (status == AE_TIME) { | ||
442 | if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) { | ||
443 | acpi_ev_global_lock_acquired++; | ||
444 | return AE_OK; | ||
445 | } | ||
446 | } | ||
447 | |||
448 | if (ACPI_FAILURE(status)) { | ||
449 | status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout); | ||
450 | } | ||
439 | if (ACPI_FAILURE(status)) { | 451 | if (ACPI_FAILURE(status)) { |
440 | return_ACPI_STATUS(status); | 452 | return_ACPI_STATUS(status); |
441 | } | 453 | } |
442 | 454 | ||
455 | acpi_ev_global_lock_thread_id = acpi_os_get_thread_id(); | ||
456 | acpi_ev_global_lock_acquired++; | ||
457 | |||
443 | /* | 458 | /* |
444 | * Make sure that a global lock actually exists. If not, just treat | 459 | * Make sure that a global lock actually exists. If not, just treat |
445 | * the lock as a standard mutex. | 460 | * the lock as a standard mutex. |
@@ -506,6 +521,11 @@ acpi_status acpi_ev_release_global_lock(void) | |||
506 | return_ACPI_STATUS(AE_NOT_ACQUIRED); | 521 | return_ACPI_STATUS(AE_NOT_ACQUIRED); |
507 | } | 522 | } |
508 | 523 | ||
524 | acpi_ev_global_lock_acquired--; | ||
525 | if (acpi_ev_global_lock_acquired > 0) { | ||
526 | return AE_OK; | ||
527 | } | ||
528 | |||
509 | if (acpi_gbl_global_lock_present) { | 529 | if (acpi_gbl_global_lock_present) { |
510 | 530 | ||
511 | /* Allow any thread to release the lock */ | 531 | /* Allow any thread to release the lock */ |
@@ -529,7 +549,8 @@ acpi_status acpi_ev_release_global_lock(void) | |||
529 | acpi_gbl_global_lock_acquired = FALSE; | 549 | acpi_gbl_global_lock_acquired = FALSE; |
530 | 550 | ||
531 | /* Release the local GL mutex */ | 551 | /* Release the local GL mutex */ |
532 | 552 | acpi_ev_global_lock_thread_id = 0; | |
553 | acpi_ev_global_lock_acquired = 0; | ||
533 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex); | 554 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex); |
534 | return_ACPI_STATUS(status); | 555 | return_ACPI_STATUS(status); |
535 | } | 556 | } |
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 4cc534e36e81..36901362fd24 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -86,6 +86,7 @@ | |||
86 | 86 | ||
87 | #include <linux/proc_fs.h> | 87 | #include <linux/proc_fs.h> |
88 | #include <linux/backlight.h> | 88 | #include <linux/backlight.h> |
89 | #include <linux/fb.h> | ||
89 | #include <asm/uaccess.h> | 90 | #include <asm/uaccess.h> |
90 | 91 | ||
91 | #include <linux/dmi.h> | 92 | #include <linux/dmi.h> |
@@ -157,6 +158,7 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */ | |||
157 | "\\_SB.PCI.ISA.SLCE", /* 570 */ | 158 | "\\_SB.PCI.ISA.SLCE", /* 570 */ |
158 | ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */ | 159 | ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */ |
159 | #endif | 160 | #endif |
161 | #ifdef CONFIG_ACPI_IBM_BAY | ||
160 | IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */ | 162 | IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */ |
161 | "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */ | 163 | "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */ |
162 | "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */ | 164 | "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */ |
@@ -174,6 +176,7 @@ IBM_HANDLE(bay2, root, "\\_SB.PCI0.IDE0.PRIM.SLAV", /* A3x, R32 */ | |||
174 | IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */ | 176 | IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */ |
175 | "_EJ0", /* 770x */ | 177 | "_EJ0", /* 770x */ |
176 | ); /* all others */ | 178 | ); /* all others */ |
179 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
177 | 180 | ||
178 | /* don't list other alternatives as we install a notify handler on the 570 */ | 181 | /* don't list other alternatives as we install a notify handler on the 570 */ |
179 | IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ | 182 | IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ |
@@ -1044,6 +1047,7 @@ static int light_write(char *buf) | |||
1044 | return 0; | 1047 | return 0; |
1045 | } | 1048 | } |
1046 | 1049 | ||
1050 | #if defined(CONFIG_ACPI_IBM_DOCK) || defined(CONFIG_ACPI_IBM_BAY) | ||
1047 | static int _sta(acpi_handle handle) | 1051 | static int _sta(acpi_handle handle) |
1048 | { | 1052 | { |
1049 | int status; | 1053 | int status; |
@@ -1053,6 +1057,7 @@ static int _sta(acpi_handle handle) | |||
1053 | 1057 | ||
1054 | return status; | 1058 | return status; |
1055 | } | 1059 | } |
1060 | #endif | ||
1056 | 1061 | ||
1057 | #ifdef CONFIG_ACPI_IBM_DOCK | 1062 | #ifdef CONFIG_ACPI_IBM_DOCK |
1058 | #define dock_docked() (_sta(dock_handle) & 1) | 1063 | #define dock_docked() (_sta(dock_handle) & 1) |
@@ -1119,6 +1124,7 @@ static void dock_notify(struct ibm_struct *ibm, u32 event) | |||
1119 | } | 1124 | } |
1120 | #endif | 1125 | #endif |
1121 | 1126 | ||
1127 | #ifdef CONFIG_ACPI_IBM_BAY | ||
1122 | static int bay_status_supported; | 1128 | static int bay_status_supported; |
1123 | static int bay_status2_supported; | 1129 | static int bay_status2_supported; |
1124 | static int bay_eject_supported; | 1130 | static int bay_eject_supported; |
@@ -1194,6 +1200,7 @@ static void bay_notify(struct ibm_struct *ibm, u32 event) | |||
1194 | { | 1200 | { |
1195 | acpi_bus_generate_event(ibm->device, event, 0); | 1201 | acpi_bus_generate_event(ibm->device, event, 0); |
1196 | } | 1202 | } |
1203 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
1197 | 1204 | ||
1198 | static int cmos_read(char *p) | 1205 | static int cmos_read(char *p) |
1199 | { | 1206 | { |
@@ -1701,7 +1708,10 @@ static int brightness_write(char *buf) | |||
1701 | 1708 | ||
1702 | static int brightness_update_status(struct backlight_device *bd) | 1709 | static int brightness_update_status(struct backlight_device *bd) |
1703 | { | 1710 | { |
1704 | return brightness_set(bd->props.brightness); | 1711 | return brightness_set( |
1712 | (bd->props.fb_blank == FB_BLANK_UNBLANK && | ||
1713 | bd->props.power == FB_BLANK_UNBLANK) ? | ||
1714 | bd->props.brightness : 0); | ||
1705 | } | 1715 | } |
1706 | 1716 | ||
1707 | static struct backlight_ops ibm_backlight_data = { | 1717 | static struct backlight_ops ibm_backlight_data = { |
@@ -1711,6 +1721,12 @@ static struct backlight_ops ibm_backlight_data = { | |||
1711 | 1721 | ||
1712 | static int brightness_init(void) | 1722 | static int brightness_init(void) |
1713 | { | 1723 | { |
1724 | int b; | ||
1725 | |||
1726 | b = brightness_get(NULL); | ||
1727 | if (b < 0) | ||
1728 | return b; | ||
1729 | |||
1714 | ibm_backlight_device = backlight_device_register("ibm", NULL, NULL, | 1730 | ibm_backlight_device = backlight_device_register("ibm", NULL, NULL, |
1715 | &ibm_backlight_data); | 1731 | &ibm_backlight_data); |
1716 | if (IS_ERR(ibm_backlight_device)) { | 1732 | if (IS_ERR(ibm_backlight_device)) { |
@@ -1718,7 +1734,9 @@ static int brightness_init(void) | |||
1718 | return PTR_ERR(ibm_backlight_device); | 1734 | return PTR_ERR(ibm_backlight_device); |
1719 | } | 1735 | } |
1720 | 1736 | ||
1721 | ibm_backlight_device->props.max_brightness = 7; | 1737 | ibm_backlight_device->props.max_brightness = 7; |
1738 | ibm_backlight_device->props.brightness = b; | ||
1739 | backlight_update_status(ibm_backlight_device); | ||
1722 | 1740 | ||
1723 | return 0; | 1741 | return 0; |
1724 | } | 1742 | } |
@@ -2353,6 +2371,7 @@ static struct ibm_struct ibms[] = { | |||
2353 | .type = ACPI_SYSTEM_NOTIFY, | 2371 | .type = ACPI_SYSTEM_NOTIFY, |
2354 | }, | 2372 | }, |
2355 | #endif | 2373 | #endif |
2374 | #ifdef CONFIG_ACPI_IBM_BAY | ||
2356 | { | 2375 | { |
2357 | .name = "bay", | 2376 | .name = "bay", |
2358 | .init = bay_init, | 2377 | .init = bay_init, |
@@ -2362,6 +2381,7 @@ static struct ibm_struct ibms[] = { | |||
2362 | .handle = &bay_handle, | 2381 | .handle = &bay_handle, |
2363 | .type = ACPI_SYSTEM_NOTIFY, | 2382 | .type = ACPI_SYSTEM_NOTIFY, |
2364 | }, | 2383 | }, |
2384 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
2365 | { | 2385 | { |
2366 | .name = "cmos", | 2386 | .name = "cmos", |
2367 | .read = cmos_read, | 2387 | .read = cmos_read, |
@@ -2647,7 +2667,9 @@ IBM_PARAM(light); | |||
2647 | #ifdef CONFIG_ACPI_IBM_DOCK | 2667 | #ifdef CONFIG_ACPI_IBM_DOCK |
2648 | IBM_PARAM(dock); | 2668 | IBM_PARAM(dock); |
2649 | #endif | 2669 | #endif |
2670 | #ifdef CONFIG_ACPI_IBM_BAY | ||
2650 | IBM_PARAM(bay); | 2671 | IBM_PARAM(bay); |
2672 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
2651 | IBM_PARAM(cmos); | 2673 | IBM_PARAM(cmos); |
2652 | IBM_PARAM(led); | 2674 | IBM_PARAM(led); |
2653 | IBM_PARAM(beep); | 2675 | IBM_PARAM(beep); |
@@ -2723,12 +2745,14 @@ static int __init acpi_ibm_init(void) | |||
2723 | IBM_HANDLE_INIT(dock); | 2745 | IBM_HANDLE_INIT(dock); |
2724 | #endif | 2746 | #endif |
2725 | IBM_HANDLE_INIT(pci); | 2747 | IBM_HANDLE_INIT(pci); |
2748 | #ifdef CONFIG_ACPI_IBM_BAY | ||
2726 | IBM_HANDLE_INIT(bay); | 2749 | IBM_HANDLE_INIT(bay); |
2727 | if (bay_handle) | 2750 | if (bay_handle) |
2728 | IBM_HANDLE_INIT(bay_ej); | 2751 | IBM_HANDLE_INIT(bay_ej); |
2729 | IBM_HANDLE_INIT(bay2); | 2752 | IBM_HANDLE_INIT(bay2); |
2730 | if (bay2_handle) | 2753 | if (bay2_handle) |
2731 | IBM_HANDLE_INIT(bay2_ej); | 2754 | IBM_HANDLE_INIT(bay2_ej); |
2755 | #endif /* CONFIG_ACPI_IBM_BAY */ | ||
2732 | IBM_HANDLE_INIT(beep); | 2756 | IBM_HANDLE_INIT(beep); |
2733 | IBM_HANDLE_INIT(ecrd); | 2757 | IBM_HANDLE_INIT(ecrd); |
2734 | IBM_HANDLE_INIT(ecwr); | 2758 | IBM_HANDLE_INIT(ecwr); |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 1ef338545dfe..4ffecd179702 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -436,8 +436,6 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
436 | cl = &device->power.states[device->power.state].resources; | 436 | cl = &device->power.states[device->power.state].resources; |
437 | tl = &device->power.states[state].resources; | 437 | tl = &device->power.states[state].resources; |
438 | 438 | ||
439 | device->power.state = ACPI_STATE_UNKNOWN; | ||
440 | |||
441 | if (!cl->count && !tl->count) { | 439 | if (!cl->count && !tl->count) { |
442 | result = -ENODEV; | 440 | result = -ENODEV; |
443 | goto end; | 441 | goto end; |
@@ -468,12 +466,15 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
468 | goto end; | 466 | goto end; |
469 | } | 467 | } |
470 | 468 | ||
471 | /* We shouldn't change the state till all above operations succeed */ | 469 | end: |
472 | device->power.state = state; | 470 | if (result) { |
473 | end: | 471 | device->power.state = ACPI_STATE_UNKNOWN; |
474 | if (result) | ||
475 | printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", | 472 | printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", |
476 | device->pnp.bus_id, state); | 473 | device->pnp.bus_id, state); |
474 | } else { | ||
475 | /* We shouldn't change the state till all above operations succeed */ | ||
476 | device->power.state = state; | ||
477 | } | ||
477 | 478 | ||
478 | return result; | 479 | return result; |
479 | } | 480 | } |
@@ -687,13 +688,6 @@ static int acpi_power_resume(struct acpi_device *device) | |||
687 | return result; | 688 | return result; |
688 | 689 | ||
689 | mutex_lock(&resource->resource_lock); | 690 | mutex_lock(&resource->resource_lock); |
690 | if ((resource->state == ACPI_POWER_RESOURCE_STATE_ON) && | ||
691 | list_empty(&resource->reference)) { | ||
692 | mutex_unlock(&resource->resource_lock); | ||
693 | result = acpi_power_off_device(device->handle, NULL); | ||
694 | return result; | ||
695 | } | ||
696 | |||
697 | if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) && | 691 | if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) && |
698 | !list_empty(&resource->reference)) { | 692 | !list_empty(&resource->reference)) { |
699 | ref = container_of(resource->reference.next, struct acpi_power_reference, node); | 693 | ref = container_of(resource->reference.next, struct acpi_power_reference, node); |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 1358c06a969c..cc48ab05676c 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -191,6 +191,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); | 191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); |
192 | 192 | ||
193 | for (index = 0; index < number_of_elements; index++) { | 193 | for (index = 0; index < number_of_elements; index++) { |
194 | int source_name_index = 2; | ||
195 | int source_index_index = 3; | ||
196 | |||
194 | /* | 197 | /* |
195 | * Point user_prt past this current structure | 198 | * Point user_prt past this current structure |
196 | * | 199 | * |
@@ -261,10 +264,28 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
261 | } | 264 | } |
262 | 265 | ||
263 | /* | 266 | /* |
267 | * If BIOS erroneously reversed the _PRT source_name and source_index, | ||
268 | * then reverse them back. | ||
269 | */ | ||
270 | if (ACPI_GET_OBJECT_TYPE (sub_object_list[3]) != ACPI_TYPE_INTEGER) { | ||
271 | if (acpi_gbl_enable_interpreter_slack) { | ||
272 | source_name_index = 3; | ||
273 | source_index_index = 2; | ||
274 | printk(KERN_WARNING "ACPI: Handling Garbled _PRT entry\n"); | ||
275 | } else { | ||
276 | ACPI_ERROR((AE_INFO, | ||
277 | "(PRT[%X].source_index) Need Integer, found %s", | ||
278 | index, | ||
279 | acpi_ut_get_object_type_name(sub_object_list[3]))); | ||
280 | return_ACPI_STATUS(AE_BAD_DATA); | ||
281 | } | ||
282 | } | ||
283 | |||
284 | /* | ||
264 | * 3) Third subobject: Dereference the PRT.source_name | 285 | * 3) Third subobject: Dereference the PRT.source_name |
265 | * The name may be unresolved (slack mode), so allow a null object | 286 | * The name may be unresolved (slack mode), so allow a null object |
266 | */ | 287 | */ |
267 | obj_desc = sub_object_list[2]; | 288 | obj_desc = sub_object_list[source_name_index]; |
268 | if (obj_desc) { | 289 | if (obj_desc) { |
269 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 290 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
270 | case ACPI_TYPE_LOCAL_REFERENCE: | 291 | case ACPI_TYPE_LOCAL_REFERENCE: |
@@ -339,7 +360,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
339 | 360 | ||
340 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 361 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
341 | 362 | ||
342 | obj_desc = sub_object_list[3]; | 363 | obj_desc = sub_object_list[source_index_index]; |
343 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 364 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
344 | user_prt->source_index = (u32) obj_desc->integer.value; | 365 | user_prt->source_index = (u32) obj_desc->integer.value; |
345 | } else { | 366 | } else { |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 0771b434feb2..00d25b347255 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -102,9 +102,9 @@ struct acpi_video_bus_cap { | |||
102 | 102 | ||
103 | struct acpi_video_device_attrib { | 103 | struct acpi_video_device_attrib { |
104 | u32 display_index:4; /* A zero-based instance of the Display */ | 104 | u32 display_index:4; /* A zero-based instance of the Display */ |
105 | u32 display_port_attachment:4; /*This field differenates displays type */ | 105 | u32 display_port_attachment:4; /*This field differentiates the display type */ |
106 | u32 display_type:4; /*Describe the specific type in use */ | 106 | u32 display_type:4; /*Describe the specific type in use */ |
107 | u32 vendor_specific:4; /*Chipset Vendor Specifi */ | 107 | u32 vendor_specific:4; /*Chipset Vendor Specific */ |
108 | u32 bios_can_detect:1; /*BIOS can detect the device */ | 108 | u32 bios_can_detect:1; /*BIOS can detect the device */ |
109 | u32 depend_on_vga:1; /*Non-VGA output device whose power is related to | 109 | u32 depend_on_vga:1; /*Non-VGA output device whose power is related to |
110 | the VGA device. */ | 110 | the VGA device. */ |
@@ -484,16 +484,16 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video, | |||
484 | * 0. The system BIOS should NOT automatically switch(toggle) | 484 | * 0. The system BIOS should NOT automatically switch(toggle) |
485 | * the active display output. | 485 | * the active display output. |
486 | * 1. The system BIOS should automatically switch (toggle) the | 486 | * 1. The system BIOS should automatically switch (toggle) the |
487 | * active display output. No swich event. | 487 | * active display output. No switch event. |
488 | * 2. The _DGS value should be locked. | 488 | * 2. The _DGS value should be locked. |
489 | * 3. The system BIOS should not automatically switch (toggle) the | 489 | * 3. The system BIOS should not automatically switch (toggle) the |
490 | * active display output, but instead generate the display switch | 490 | * active display output, but instead generate the display switch |
491 | * event notify code. | 491 | * event notify code. |
492 | * lcd_flag : | 492 | * lcd_flag : |
493 | * 0. The system BIOS should automatically control the brightness level | 493 | * 0. The system BIOS should automatically control the brightness level |
494 | * of the LCD, when the power changes from AC to DC | 494 | * of the LCD when the power changes from AC to DC |
495 | * 1. The system BIOS should NOT automatically control the brightness | 495 | * 1. The system BIOS should NOT automatically control the brightness |
496 | * level of the LCD, when the power changes from AC to DC. | 496 | * level of the LCD when the power changes from AC to DC. |
497 | * Return Value: | 497 | * Return Value: |
498 | * -1 wrong arg. | 498 | * -1 wrong arg. |
499 | */ | 499 | */ |
@@ -525,7 +525,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
525 | * Return Value: | 525 | * Return Value: |
526 | * None | 526 | * None |
527 | * | 527 | * |
528 | * Find out all required AML method defined under the output | 528 | * Find out all required AML methods defined under the output |
529 | * device. | 529 | * device. |
530 | */ | 530 | */ |
531 | 531 | ||
@@ -636,7 +636,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
636 | * Return Value: | 636 | * Return Value: |
637 | * None | 637 | * None |
638 | * | 638 | * |
639 | * Find out all required AML method defined under the video bus device. | 639 | * Find out all required AML methods defined under the video bus device. |
640 | */ | 640 | */ |
641 | 641 | ||
642 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | 642 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) |
@@ -681,19 +681,19 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) | |||
681 | * to check well known required nodes. | 681 | * to check well known required nodes. |
682 | */ | 682 | */ |
683 | 683 | ||
684 | /* Does this device able to support video switching ? */ | 684 | /* Does this device support video switching? */ |
685 | if (video->cap._DOS) { | 685 | if (video->cap._DOS) { |
686 | video->flags.multihead = 1; | 686 | video->flags.multihead = 1; |
687 | status = 0; | 687 | status = 0; |
688 | } | 688 | } |
689 | 689 | ||
690 | /* Does this device able to retrieve a retrieve a video ROM ? */ | 690 | /* Does this device support retrieving a video ROM? */ |
691 | if (video->cap._ROM) { | 691 | if (video->cap._ROM) { |
692 | video->flags.rom = 1; | 692 | video->flags.rom = 1; |
693 | status = 0; | 693 | status = 0; |
694 | } | 694 | } |
695 | 695 | ||
696 | /* Does this device able to configure which video device to POST ? */ | 696 | /* Does this device support configuring which video device to POST? */ |
697 | if (video->cap._GPD && video->cap._SPD && video->cap._VPO) { | 697 | if (video->cap._GPD && video->cap._SPD && video->cap._VPO) { |
698 | video->flags.post = 1; | 698 | video->flags.post = 1; |
699 | status = 0; | 699 | status = 0; |
@@ -860,7 +860,7 @@ acpi_video_device_write_brightness(struct file *file, | |||
860 | if (level > 100) | 860 | if (level > 100) |
861 | return -EFAULT; | 861 | return -EFAULT; |
862 | 862 | ||
863 | /* validate though the list of available levels */ | 863 | /* validate through the list of available levels */ |
864 | for (i = 0; i < dev->brightness->count; i++) | 864 | for (i = 0; i < dev->brightness->count; i++) |
865 | if (level == dev->brightness->levels[i]) { | 865 | if (level == dev->brightness->levels[i]) { |
866 | if (ACPI_SUCCESS | 866 | if (ACPI_SUCCESS |
@@ -1065,10 +1065,10 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) | |||
1065 | printk(KERN_WARNING PREFIX | 1065 | printk(KERN_WARNING PREFIX |
1066 | "The motherboard VGA device is not listed as a possible POST device.\n"); | 1066 | "The motherboard VGA device is not listed as a possible POST device.\n"); |
1067 | printk(KERN_WARNING PREFIX | 1067 | printk(KERN_WARNING PREFIX |
1068 | "This indicate a BIOS bug. Please contact the manufacturer.\n"); | 1068 | "This indicates a BIOS bug. Please contact the manufacturer.\n"); |
1069 | } | 1069 | } |
1070 | printk("%lx\n", options); | 1070 | printk("%lx\n", options); |
1071 | seq_printf(seq, "can POST: <intgrated video>"); | 1071 | seq_printf(seq, "can POST: <integrated video>"); |
1072 | if (options & 2) | 1072 | if (options & 2) |
1073 | seq_printf(seq, " <PCI video>"); | 1073 | seq_printf(seq, " <PCI video>"); |
1074 | if (options & 4) | 1074 | if (options & 4) |
@@ -1102,7 +1102,7 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) | |||
1102 | seq_printf(seq, "<not supported>\n"); | 1102 | seq_printf(seq, "<not supported>\n"); |
1103 | goto end; | 1103 | goto end; |
1104 | } | 1104 | } |
1105 | seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); | 1105 | seq_printf(seq, "device POSTed is <%s>\n", device_decode[id & 3]); |
1106 | 1106 | ||
1107 | end: | 1107 | end: |
1108 | return 0; | 1108 | return 0; |
@@ -1156,7 +1156,7 @@ acpi_video_bus_write_POST(struct file *file, | |||
1156 | if (opt > 3) | 1156 | if (opt > 3) |
1157 | return -EFAULT; | 1157 | return -EFAULT; |
1158 | 1158 | ||
1159 | /* just in case an OEM 'forget' the motherboard... */ | 1159 | /* just in case an OEM 'forgot' the motherboard... */ |
1160 | options |= 1; | 1160 | options |= 1; |
1161 | 1161 | ||
1162 | if (options & (1ul << opt)) { | 1162 | if (options & (1ul << opt)) { |
@@ -1527,13 +1527,13 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1527 | /* | 1527 | /* |
1528 | * Arg: | 1528 | * Arg: |
1529 | * video : video bus device | 1529 | * video : video bus device |
1530 | * event : Nontify Event | 1530 | * event : notify event |
1531 | * | 1531 | * |
1532 | * Return: | 1532 | * Return: |
1533 | * < 0 : error | 1533 | * < 0 : error |
1534 | * | 1534 | * |
1535 | * 1. Find out the current active output device. | 1535 | * 1. Find out the current active output device. |
1536 | * 2. Identify the next output device to switch | 1536 | * 2. Identify the next output device to switch to. |
1537 | * 3. call _DSS to do actual switch. | 1537 | * 3. call _DSS to do actual switch. |
1538 | */ | 1538 | */ |
1539 | 1539 | ||
@@ -1723,12 +1723,12 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
1723 | device = video->device; | 1723 | device = video->device; |
1724 | 1724 | ||
1725 | switch (event) { | 1725 | switch (event) { |
1726 | case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, | 1726 | case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch, |
1727 | * most likely via hotkey. */ | 1727 | * most likely via hotkey. */ |
1728 | acpi_bus_generate_event(device, event, 0); | 1728 | acpi_bus_generate_event(device, event, 0); |
1729 | break; | 1729 | break; |
1730 | 1730 | ||
1731 | case ACPI_VIDEO_NOTIFY_PROBE: /* User plug or remove a video | 1731 | case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video |
1732 | * connector. */ | 1732 | * connector. */ |
1733 | acpi_video_device_enumerate(video); | 1733 | acpi_video_device_enumerate(video); |
1734 | acpi_video_device_rebind(video); | 1734 | acpi_video_device_rebind(video); |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index dc42ba1b46f7..b952c584338f 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -93,7 +93,7 @@ | |||
93 | #include <linux/libata.h> | 93 | #include <linux/libata.h> |
94 | 94 | ||
95 | #define DRV_NAME "ata_piix" | 95 | #define DRV_NAME "ata_piix" |
96 | #define DRV_VERSION "2.10" | 96 | #define DRV_VERSION "2.10ac1" |
97 | 97 | ||
98 | enum { | 98 | enum { |
99 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ | 99 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ |
@@ -667,14 +667,9 @@ static int ich_pata_prereset(struct ata_port *ap) | |||
667 | { | 667 | { |
668 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 668 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
669 | 669 | ||
670 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) { | 670 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) |
671 | ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); | 671 | return -ENOENT; |
672 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | ||
673 | return 0; | ||
674 | } | ||
675 | |||
676 | ich_pata_cbl_detect(ap); | 672 | ich_pata_cbl_detect(ap); |
677 | |||
678 | return ata_std_prereset(ap); | 673 | return ata_std_prereset(ap); |
679 | } | 674 | } |
680 | 675 | ||
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index d14a48e75f1b..c428a56e6f31 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -34,6 +34,13 @@ struct taskfile_array { | |||
34 | u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ | 34 | u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ |
35 | }; | 35 | }; |
36 | 36 | ||
37 | /* | ||
38 | * Helper - belongs in the PCI layer somewhere eventually | ||
39 | */ | ||
40 | static int is_pci_dev(struct device *dev) | ||
41 | { | ||
42 | return (dev->bus == &pci_bus_type); | ||
43 | } | ||
37 | 44 | ||
38 | /** | 45 | /** |
39 | * sata_get_dev_handle - finds acpi_handle and PCI device.function | 46 | * sata_get_dev_handle - finds acpi_handle and PCI device.function |
@@ -53,6 +60,9 @@ static int sata_get_dev_handle(struct device *dev, acpi_handle *handle, | |||
53 | struct pci_dev *pci_dev; | 60 | struct pci_dev *pci_dev; |
54 | acpi_integer addr; | 61 | acpi_integer addr; |
55 | 62 | ||
63 | if (!is_pci_dev(dev)) | ||
64 | return -ENODEV; | ||
65 | |||
56 | pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */ | 66 | pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */ |
57 | /* Please refer to the ACPI spec for the syntax of _ADR. */ | 67 | /* Please refer to the ACPI spec for the syntax of _ADR. */ |
58 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); | 68 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); |
@@ -84,7 +94,12 @@ static int pata_get_dev_handle(struct device *dev, acpi_handle *handle, | |||
84 | acpi_status status; | 94 | acpi_status status; |
85 | struct acpi_device_info *dinfo = NULL; | 95 | struct acpi_device_info *dinfo = NULL; |
86 | int ret = -ENODEV; | 96 | int ret = -ENODEV; |
87 | struct pci_dev *pdev = to_pci_dev(dev); | 97 | struct pci_dev *pdev; |
98 | |||
99 | if (!is_pci_dev(dev)) | ||
100 | return -ENODEV; | ||
101 | |||
102 | pdev = to_pci_dev(dev); | ||
88 | 103 | ||
89 | bus = pdev->bus->number; | 104 | bus = pdev->bus->number; |
90 | devnum = PCI_SLOT(pdev->devfn); | 105 | devnum = PCI_SLOT(pdev->devfn); |
@@ -561,6 +576,13 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
561 | 576 | ||
562 | if (noacpi) | 577 | if (noacpi) |
563 | return 0; | 578 | return 0; |
579 | /* | ||
580 | * TBD - implement PATA support. For now, | ||
581 | * we should not run GTF on PATA devices since some | ||
582 | * PATA require execution of GTM/STM before GTF. | ||
583 | */ | ||
584 | if (!(ap->cbl == ATA_CBL_SATA)) | ||
585 | return 0; | ||
564 | 586 | ||
565 | for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { | 587 | for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { |
566 | if (!ata_dev_enabled(&ap->device[ix])) | 588 | if (!ata_dev_enabled(&ap->device[ix])) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index dc362fa01ca4..3c1f8830ac8b 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3455,7 +3455,8 @@ static void ata_dev_xfermask(struct ata_device *dev) | |||
3455 | "device is on DMA blacklist, disabling DMA\n"); | 3455 | "device is on DMA blacklist, disabling DMA\n"); |
3456 | } | 3456 | } |
3457 | 3457 | ||
3458 | if ((host->flags & ATA_HOST_SIMPLEX) && host->simplex_claimed != ap) { | 3458 | if ((host->flags & ATA_HOST_SIMPLEX) && |
3459 | host->simplex_claimed && host->simplex_claimed != ap) { | ||
3459 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 3460 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); |
3460 | ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " | 3461 | ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " |
3461 | "other device, disabling DMA\n"); | 3462 | "other device, disabling DMA\n"); |
@@ -5684,18 +5685,22 @@ static void ata_host_release(struct device *gendev, void *res) | |||
5684 | for (i = 0; i < host->n_ports; i++) { | 5685 | for (i = 0; i < host->n_ports; i++) { |
5685 | struct ata_port *ap = host->ports[i]; | 5686 | struct ata_port *ap = host->ports[i]; |
5686 | 5687 | ||
5687 | if (!ap) | 5688 | if (ap && ap->ops->port_stop) |
5688 | continue; | ||
5689 | |||
5690 | if (ap->ops->port_stop) | ||
5691 | ap->ops->port_stop(ap); | 5689 | ap->ops->port_stop(ap); |
5692 | |||
5693 | scsi_host_put(ap->scsi_host); | ||
5694 | } | 5690 | } |
5695 | 5691 | ||
5696 | if (host->ops->host_stop) | 5692 | if (host->ops->host_stop) |
5697 | host->ops->host_stop(host); | 5693 | host->ops->host_stop(host); |
5698 | 5694 | ||
5695 | for (i = 0; i < host->n_ports; i++) { | ||
5696 | struct ata_port *ap = host->ports[i]; | ||
5697 | |||
5698 | if (ap) | ||
5699 | scsi_host_put(ap->scsi_host); | ||
5700 | |||
5701 | host->ports[i] = NULL; | ||
5702 | } | ||
5703 | |||
5699 | dev_set_drvdata(gendev, NULL); | 5704 | dev_set_drvdata(gendev, NULL); |
5700 | } | 5705 | } |
5701 | 5706 | ||
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 388d07fab5f7..9d9670a9b117 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -874,8 +874,14 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | |||
874 | 874 | ||
875 | if (status & (NV_ADMA_STAT_DONE | | 875 | if (status & (NV_ADMA_STAT_DONE | |
876 | NV_ADMA_STAT_CPBERR)) { | 876 | NV_ADMA_STAT_CPBERR)) { |
877 | u32 check_commands = notifier | notifier_error; | 877 | u32 check_commands; |
878 | int pos, error = 0; | 878 | int pos, error = 0; |
879 | |||
880 | if(ata_tag_valid(ap->active_tag)) | ||
881 | check_commands = 1 << ap->active_tag; | ||
882 | else | ||
883 | check_commands = ap->sactive; | ||
884 | |||
879 | /** Check CPBs for completed commands */ | 885 | /** Check CPBs for completed commands */ |
880 | while ((pos = ffs(check_commands)) && !error) { | 886 | while ((pos = ffs(check_commands)) && !error) { |
881 | pos--; | 887 | pos--; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index cf2a398aaaa1..f191afe62b4d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -584,17 +584,17 @@ int device_add(struct device *dev) | |||
584 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) | 584 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) |
585 | sysfs_create_link(&dev->class->subsys.kset.kobj, | 585 | sysfs_create_link(&dev->class->subsys.kset.kobj, |
586 | &dev->kobj, dev->bus_id); | 586 | &dev->kobj, dev->bus_id); |
587 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
588 | if (parent) { | 587 | if (parent) { |
589 | sysfs_create_link(&dev->kobj, &dev->parent->kobj, | 588 | sysfs_create_link(&dev->kobj, &dev->parent->kobj, |
590 | "device"); | 589 | "device"); |
590 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
591 | class_name = make_class_name(dev->class->name, | 591 | class_name = make_class_name(dev->class->name, |
592 | &dev->kobj); | 592 | &dev->kobj); |
593 | if (class_name) | 593 | if (class_name) |
594 | sysfs_create_link(&dev->parent->kobj, | 594 | sysfs_create_link(&dev->parent->kobj, |
595 | &dev->kobj, class_name); | 595 | &dev->kobj, class_name); |
596 | } | ||
597 | #endif | 596 | #endif |
597 | } | ||
598 | } | 598 | } |
599 | 599 | ||
600 | if ((error = device_add_attrs(dev))) | 600 | if ((error = device_add_attrs(dev))) |
@@ -651,17 +651,17 @@ int device_add(struct device *dev) | |||
651 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) | 651 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) |
652 | sysfs_remove_link(&dev->class->subsys.kset.kobj, | 652 | sysfs_remove_link(&dev->class->subsys.kset.kobj, |
653 | dev->bus_id); | 653 | dev->bus_id); |
654 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
655 | if (parent) { | 654 | if (parent) { |
655 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
656 | char *class_name = make_class_name(dev->class->name, | 656 | char *class_name = make_class_name(dev->class->name, |
657 | &dev->kobj); | 657 | &dev->kobj); |
658 | if (class_name) | 658 | if (class_name) |
659 | sysfs_remove_link(&dev->parent->kobj, | 659 | sysfs_remove_link(&dev->parent->kobj, |
660 | class_name); | 660 | class_name); |
661 | kfree(class_name); | 661 | kfree(class_name); |
662 | #endif | ||
662 | sysfs_remove_link(&dev->kobj, "device"); | 663 | sysfs_remove_link(&dev->kobj, "device"); |
663 | } | 664 | } |
664 | #endif | ||
665 | 665 | ||
666 | down(&dev->class->sem); | 666 | down(&dev->class->sem); |
667 | /* notify any interfaces that the device is now gone */ | 667 | /* notify any interfaces that the device is now gone */ |
@@ -761,17 +761,17 @@ void device_del(struct device * dev) | |||
761 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) | 761 | if (dev->kobj.parent != &dev->class->subsys.kset.kobj) |
762 | sysfs_remove_link(&dev->class->subsys.kset.kobj, | 762 | sysfs_remove_link(&dev->class->subsys.kset.kobj, |
763 | dev->bus_id); | 763 | dev->bus_id); |
764 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
765 | if (parent) { | 764 | if (parent) { |
765 | #ifdef CONFIG_SYSFS_DEPRECATED | ||
766 | char *class_name = make_class_name(dev->class->name, | 766 | char *class_name = make_class_name(dev->class->name, |
767 | &dev->kobj); | 767 | &dev->kobj); |
768 | if (class_name) | 768 | if (class_name) |
769 | sysfs_remove_link(&dev->parent->kobj, | 769 | sysfs_remove_link(&dev->parent->kobj, |
770 | class_name); | 770 | class_name); |
771 | kfree(class_name); | 771 | kfree(class_name); |
772 | #endif | ||
772 | sysfs_remove_link(&dev->kobj, "device"); | 773 | sysfs_remove_link(&dev->kobj, "device"); |
773 | } | 774 | } |
774 | #endif | ||
775 | 775 | ||
776 | down(&dev->class->sem); | 776 | down(&dev->class->sem); |
777 | /* notify any interfaces that the device is now gone */ | 777 | /* notify any interfaces that the device is now gone */ |
@@ -787,6 +787,13 @@ void device_del(struct device * dev) | |||
787 | device_remove_attrs(dev); | 787 | device_remove_attrs(dev); |
788 | bus_remove_device(dev); | 788 | bus_remove_device(dev); |
789 | 789 | ||
790 | /* | ||
791 | * Some platform devices are driven without driver attached | ||
792 | * and managed resources may have been acquired. Make sure | ||
793 | * all resources are released. | ||
794 | */ | ||
795 | devres_release_all(dev); | ||
796 | |||
790 | /* Notify the platform of the removal, in case they | 797 | /* Notify the platform of the removal, in case they |
791 | * need to do anything... | 798 | * need to do anything... |
792 | */ | 799 | */ |
@@ -1058,14 +1065,14 @@ int device_rename(struct device *dev, char *new_name) | |||
1058 | 1065 | ||
1059 | return error; | 1066 | return error; |
1060 | } | 1067 | } |
1061 | 1068 | EXPORT_SYMBOL_GPL(device_rename); | |
1062 | 1069 | ||
1063 | static int device_move_class_links(struct device *dev, | 1070 | static int device_move_class_links(struct device *dev, |
1064 | struct device *old_parent, | 1071 | struct device *old_parent, |
1065 | struct device *new_parent) | 1072 | struct device *new_parent) |
1066 | { | 1073 | { |
1074 | int error = 0; | ||
1067 | #ifdef CONFIG_SYSFS_DEPRECATED | 1075 | #ifdef CONFIG_SYSFS_DEPRECATED |
1068 | int error; | ||
1069 | char *class_name; | 1076 | char *class_name; |
1070 | 1077 | ||
1071 | class_name = make_class_name(dev->class->name, &dev->kobj); | 1078 | class_name = make_class_name(dev->class->name, &dev->kobj); |
@@ -1093,7 +1100,12 @@ out: | |||
1093 | kfree(class_name); | 1100 | kfree(class_name); |
1094 | return error; | 1101 | return error; |
1095 | #else | 1102 | #else |
1096 | return 0; | 1103 | if (old_parent) |
1104 | sysfs_remove_link(&dev->kobj, "device"); | ||
1105 | if (new_parent) | ||
1106 | error = sysfs_create_link(&dev->kobj, &new_parent->kobj, | ||
1107 | "device"); | ||
1108 | return error; | ||
1097 | #endif | 1109 | #endif |
1098 | } | 1110 | } |
1099 | 1111 | ||
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index d441815a3e0c..fde92ce45153 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -1821,7 +1821,7 @@ static int cma_alloc_port(struct idr *ps, struct rdma_id_private *id_priv, | |||
1821 | struct rdma_bind_list *bind_list; | 1821 | struct rdma_bind_list *bind_list; |
1822 | int port, ret; | 1822 | int port, ret; |
1823 | 1823 | ||
1824 | bind_list = kmalloc(sizeof *bind_list, GFP_KERNEL); | 1824 | bind_list = kzalloc(sizeof *bind_list, GFP_KERNEL); |
1825 | if (!bind_list) | 1825 | if (!bind_list) |
1826 | return -ENOMEM; | 1826 | return -ENOMEM; |
1827 | 1827 | ||
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index b516b93b8550..c859134c1daa 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -266,7 +266,7 @@ static int ucma_event_handler(struct rdma_cm_id *cm_id, | |||
266 | mutex_lock(&ctx->file->mut); | 266 | mutex_lock(&ctx->file->mut); |
267 | if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) { | 267 | if (event->event == RDMA_CM_EVENT_CONNECT_REQUEST) { |
268 | if (!ctx->backlog) { | 268 | if (!ctx->backlog) { |
269 | ret = -EDQUOT; | 269 | ret = -ENOMEM; |
270 | kfree(uevent); | 270 | kfree(uevent); |
271 | goto out; | 271 | goto out; |
272 | } | 272 | } |
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index d737c738d876..818cf1aee8c7 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/sched.h> | 36 | #include <linux/sched.h> |
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/dma-mapping.h> | ||
39 | 40 | ||
40 | #include "cxio_resource.h" | 41 | #include "cxio_resource.h" |
41 | #include "cxio_hal.h" | 42 | #include "cxio_hal.h" |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index b21fde8b659d..d0ed1d35ca3e 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -305,8 +305,7 @@ static int status2errno(int status) | |||
305 | */ | 305 | */ |
306 | static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp) | 306 | static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp) |
307 | { | 307 | { |
308 | if (skb) { | 308 | if (skb && !skb_is_nonlinear(skb) && !skb_cloned(skb)) { |
309 | BUG_ON(skb_cloned(skb)); | ||
310 | skb_trim(skb, 0); | 309 | skb_trim(skb, 0); |
311 | skb_get(skb); | 310 | skb_get(skb); |
312 | } else { | 311 | } else { |
@@ -1415,6 +1414,7 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1415 | wake_up(&ep->com.waitq); | 1414 | wake_up(&ep->com.waitq); |
1416 | break; | 1415 | break; |
1417 | case FPDU_MODE: | 1416 | case FPDU_MODE: |
1417 | start_ep_timer(ep); | ||
1418 | __state_set(&ep->com, CLOSING); | 1418 | __state_set(&ep->com, CLOSING); |
1419 | attrs.next_state = IWCH_QP_STATE_CLOSING; | 1419 | attrs.next_state = IWCH_QP_STATE_CLOSING; |
1420 | iwch_modify_qp(ep->com.qp->rhp, ep->com.qp, | 1420 | iwch_modify_qp(ep->com.qp->rhp, ep->com.qp, |
@@ -1425,7 +1425,6 @@ static int peer_close(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1425 | disconnect = 0; | 1425 | disconnect = 0; |
1426 | break; | 1426 | break; |
1427 | case CLOSING: | 1427 | case CLOSING: |
1428 | start_ep_timer(ep); | ||
1429 | __state_set(&ep->com, MORIBUND); | 1428 | __state_set(&ep->com, MORIBUND); |
1430 | disconnect = 0; | 1429 | disconnect = 0; |
1431 | break; | 1430 | break; |
@@ -1487,8 +1486,10 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1487 | case CONNECTING: | 1486 | case CONNECTING: |
1488 | break; | 1487 | break; |
1489 | case MPA_REQ_WAIT: | 1488 | case MPA_REQ_WAIT: |
1489 | stop_ep_timer(ep); | ||
1490 | break; | 1490 | break; |
1491 | case MPA_REQ_SENT: | 1491 | case MPA_REQ_SENT: |
1492 | stop_ep_timer(ep); | ||
1492 | connect_reply_upcall(ep, -ECONNRESET); | 1493 | connect_reply_upcall(ep, -ECONNRESET); |
1493 | break; | 1494 | break; |
1494 | case MPA_REP_SENT: | 1495 | case MPA_REP_SENT: |
@@ -1507,9 +1508,10 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1507 | get_ep(&ep->com); | 1508 | get_ep(&ep->com); |
1508 | break; | 1509 | break; |
1509 | case MORIBUND: | 1510 | case MORIBUND: |
1511 | case CLOSING: | ||
1510 | stop_ep_timer(ep); | 1512 | stop_ep_timer(ep); |
1513 | /*FALLTHROUGH*/ | ||
1511 | case FPDU_MODE: | 1514 | case FPDU_MODE: |
1512 | case CLOSING: | ||
1513 | if (ep->com.cm_id && ep->com.qp) { | 1515 | if (ep->com.cm_id && ep->com.qp) { |
1514 | attrs.next_state = IWCH_QP_STATE_ERROR; | 1516 | attrs.next_state = IWCH_QP_STATE_ERROR; |
1515 | ret = iwch_modify_qp(ep->com.qp->rhp, | 1517 | ret = iwch_modify_qp(ep->com.qp->rhp, |
@@ -1570,7 +1572,6 @@ static int close_con_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1570 | spin_lock_irqsave(&ep->com.lock, flags); | 1572 | spin_lock_irqsave(&ep->com.lock, flags); |
1571 | switch (ep->com.state) { | 1573 | switch (ep->com.state) { |
1572 | case CLOSING: | 1574 | case CLOSING: |
1573 | start_ep_timer(ep); | ||
1574 | __state_set(&ep->com, MORIBUND); | 1575 | __state_set(&ep->com, MORIBUND); |
1575 | break; | 1576 | break; |
1576 | case MORIBUND: | 1577 | case MORIBUND: |
@@ -1586,6 +1587,8 @@ static int close_con_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1586 | __state_set(&ep->com, DEAD); | 1587 | __state_set(&ep->com, DEAD); |
1587 | release = 1; | 1588 | release = 1; |
1588 | break; | 1589 | break; |
1590 | case ABORTING: | ||
1591 | break; | ||
1589 | case DEAD: | 1592 | case DEAD: |
1590 | default: | 1593 | default: |
1591 | BUG_ON(1); | 1594 | BUG_ON(1); |
@@ -1659,6 +1662,7 @@ static void ep_timeout(unsigned long arg) | |||
1659 | break; | 1662 | break; |
1660 | case MPA_REQ_WAIT: | 1663 | case MPA_REQ_WAIT: |
1661 | break; | 1664 | break; |
1665 | case CLOSING: | ||
1662 | case MORIBUND: | 1666 | case MORIBUND: |
1663 | if (ep->com.cm_id && ep->com.qp) { | 1667 | if (ep->com.cm_id && ep->com.qp) { |
1664 | attrs.next_state = IWCH_QP_STATE_ERROR; | 1668 | attrs.next_state = IWCH_QP_STATE_ERROR; |
@@ -1687,12 +1691,11 @@ int iwch_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len) | |||
1687 | return -ECONNRESET; | 1691 | return -ECONNRESET; |
1688 | } | 1692 | } |
1689 | BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD); | 1693 | BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD); |
1690 | state_set(&ep->com, CLOSING); | ||
1691 | if (mpa_rev == 0) | 1694 | if (mpa_rev == 0) |
1692 | abort_connection(ep, NULL, GFP_KERNEL); | 1695 | abort_connection(ep, NULL, GFP_KERNEL); |
1693 | else { | 1696 | else { |
1694 | err = send_mpa_reject(ep, pdata, pdata_len); | 1697 | err = send_mpa_reject(ep, pdata, pdata_len); |
1695 | err = send_halfclose(ep, GFP_KERNEL); | 1698 | err = iwch_ep_disconnect(ep, 0, GFP_KERNEL); |
1696 | } | 1699 | } |
1697 | return 0; | 1700 | return 0; |
1698 | } | 1701 | } |
@@ -1957,11 +1960,11 @@ int iwch_ep_disconnect(struct iwch_ep *ep, int abrupt, gfp_t gfp) | |||
1957 | case MPA_REQ_RCVD: | 1960 | case MPA_REQ_RCVD: |
1958 | case MPA_REP_SENT: | 1961 | case MPA_REP_SENT: |
1959 | case FPDU_MODE: | 1962 | case FPDU_MODE: |
1963 | start_ep_timer(ep); | ||
1960 | ep->com.state = CLOSING; | 1964 | ep->com.state = CLOSING; |
1961 | close = 1; | 1965 | close = 1; |
1962 | break; | 1966 | break; |
1963 | case CLOSING: | 1967 | case CLOSING: |
1964 | start_ep_timer(ep); | ||
1965 | ep->com.state = MORIBUND; | 1968 | ep->com.state = MORIBUND; |
1966 | close = 1; | 1969 | close = 1; |
1967 | break; | 1970 | break; |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_ev.c b/drivers/infiniband/hw/cxgb3/iwch_ev.c index 54362afbf72f..b40676662a8a 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_ev.c +++ b/drivers/infiniband/hw/cxgb3/iwch_ev.c | |||
@@ -47,12 +47,6 @@ static void post_qp_event(struct iwch_dev *rnicp, struct iwch_cq *chp, | |||
47 | struct iwch_qp_attributes attrs; | 47 | struct iwch_qp_attributes attrs; |
48 | struct iwch_qp *qhp; | 48 | struct iwch_qp *qhp; |
49 | 49 | ||
50 | printk(KERN_ERR "%s - AE qpid 0x%x opcode %d status 0x%x " | ||
51 | "type %d wrid.hi 0x%x wrid.lo 0x%x \n", __FUNCTION__, | ||
52 | CQE_QPID(rsp_msg->cqe), CQE_OPCODE(rsp_msg->cqe), | ||
53 | CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe), | ||
54 | CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe)); | ||
55 | |||
56 | spin_lock(&rnicp->lock); | 50 | spin_lock(&rnicp->lock); |
57 | qhp = get_qhp(rnicp, CQE_QPID(rsp_msg->cqe)); | 51 | qhp = get_qhp(rnicp, CQE_QPID(rsp_msg->cqe)); |
58 | 52 | ||
@@ -73,6 +67,12 @@ static void post_qp_event(struct iwch_dev *rnicp, struct iwch_cq *chp, | |||
73 | return; | 67 | return; |
74 | } | 68 | } |
75 | 69 | ||
70 | printk(KERN_ERR "%s - AE qpid 0x%x opcode %d status 0x%x " | ||
71 | "type %d wrid.hi 0x%x wrid.lo 0x%x \n", __FUNCTION__, | ||
72 | CQE_QPID(rsp_msg->cqe), CQE_OPCODE(rsp_msg->cqe), | ||
73 | CQE_STATUS(rsp_msg->cqe), CQE_TYPE(rsp_msg->cqe), | ||
74 | CQE_WRID_HI(rsp_msg->cqe), CQE_WRID_LOW(rsp_msg->cqe)); | ||
75 | |||
76 | atomic_inc(&qhp->refcnt); | 76 | atomic_inc(&qhp->refcnt); |
77 | spin_unlock(&rnicp->lock); | 77 | spin_unlock(&rnicp->lock); |
78 | 78 | ||
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index 9947a144a929..f2774ae906bf 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -331,6 +331,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
331 | int ret = 0; | 331 | int ret = 0; |
332 | struct iwch_mm_entry *mm; | 332 | struct iwch_mm_entry *mm; |
333 | struct iwch_ucontext *ucontext; | 333 | struct iwch_ucontext *ucontext; |
334 | u64 addr; | ||
334 | 335 | ||
335 | PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff, | 336 | PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff, |
336 | key, len); | 337 | key, len); |
@@ -345,10 +346,11 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
345 | mm = remove_mmap(ucontext, key, len); | 346 | mm = remove_mmap(ucontext, key, len); |
346 | if (!mm) | 347 | if (!mm) |
347 | return -EINVAL; | 348 | return -EINVAL; |
349 | addr = mm->addr; | ||
348 | kfree(mm); | 350 | kfree(mm); |
349 | 351 | ||
350 | if ((mm->addr >= rdev_p->rnic_info.udbell_physbase) && | 352 | if ((addr >= rdev_p->rnic_info.udbell_physbase) && |
351 | (mm->addr < (rdev_p->rnic_info.udbell_physbase + | 353 | (addr < (rdev_p->rnic_info.udbell_physbase + |
352 | rdev_p->rnic_info.udbell_len))) { | 354 | rdev_p->rnic_info.udbell_len))) { |
353 | 355 | ||
354 | /* | 356 | /* |
@@ -362,7 +364,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
362 | vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; | 364 | vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; |
363 | vma->vm_flags &= ~VM_MAYREAD; | 365 | vma->vm_flags &= ~VM_MAYREAD; |
364 | ret = io_remap_pfn_range(vma, vma->vm_start, | 366 | ret = io_remap_pfn_range(vma, vma->vm_start, |
365 | mm->addr >> PAGE_SHIFT, | 367 | addr >> PAGE_SHIFT, |
366 | len, vma->vm_page_prot); | 368 | len, vma->vm_page_prot); |
367 | } else { | 369 | } else { |
368 | 370 | ||
@@ -370,7 +372,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
370 | * Map WQ or CQ contig dma memory... | 372 | * Map WQ or CQ contig dma memory... |
371 | */ | 373 | */ |
372 | ret = remap_pfn_range(vma, vma->vm_start, | 374 | ret = remap_pfn_range(vma, vma->vm_start, |
373 | mm->addr >> PAGE_SHIFT, | 375 | addr >> PAGE_SHIFT, |
374 | len, vma->vm_page_prot); | 376 | len, vma->vm_page_prot); |
375 | } | 377 | } |
376 | 378 | ||
@@ -463,9 +465,6 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd, | |||
463 | php = to_iwch_pd(pd); | 465 | php = to_iwch_pd(pd); |
464 | rhp = php->rhp; | 466 | rhp = php->rhp; |
465 | 467 | ||
466 | acc = iwch_convert_access(acc); | ||
467 | |||
468 | |||
469 | mhp = kzalloc(sizeof(*mhp), GFP_KERNEL); | 468 | mhp = kzalloc(sizeof(*mhp), GFP_KERNEL); |
470 | if (!mhp) | 469 | if (!mhp) |
471 | return ERR_PTR(-ENOMEM); | 470 | return ERR_PTR(-ENOMEM); |
@@ -491,12 +490,7 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd, | |||
491 | mhp->attr.pdid = php->pdid; | 490 | mhp->attr.pdid = php->pdid; |
492 | mhp->attr.zbva = 0; | 491 | mhp->attr.zbva = 0; |
493 | 492 | ||
494 | /* NOTE: TPT perms are backwards from BIND WR perms! */ | 493 | mhp->attr.perms = iwch_ib_to_tpt_access(acc); |
495 | mhp->attr.perms = (acc & 0x1) << 3; | ||
496 | mhp->attr.perms |= (acc & 0x2) << 1; | ||
497 | mhp->attr.perms |= (acc & 0x4) >> 1; | ||
498 | mhp->attr.perms |= (acc & 0x8) >> 3; | ||
499 | |||
500 | mhp->attr.va_fbo = *iova_start; | 494 | mhp->attr.va_fbo = *iova_start; |
501 | mhp->attr.page_size = shift - 12; | 495 | mhp->attr.page_size = shift - 12; |
502 | 496 | ||
@@ -525,7 +519,6 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr, | |||
525 | struct iwch_mr mh, *mhp; | 519 | struct iwch_mr mh, *mhp; |
526 | struct iwch_pd *php; | 520 | struct iwch_pd *php; |
527 | struct iwch_dev *rhp; | 521 | struct iwch_dev *rhp; |
528 | int new_acc; | ||
529 | __be64 *page_list = NULL; | 522 | __be64 *page_list = NULL; |
530 | int shift = 0; | 523 | int shift = 0; |
531 | u64 total_size; | 524 | u64 total_size; |
@@ -546,14 +539,12 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr, | |||
546 | if (rhp != php->rhp) | 539 | if (rhp != php->rhp) |
547 | return -EINVAL; | 540 | return -EINVAL; |
548 | 541 | ||
549 | new_acc = mhp->attr.perms; | ||
550 | |||
551 | memcpy(&mh, mhp, sizeof *mhp); | 542 | memcpy(&mh, mhp, sizeof *mhp); |
552 | 543 | ||
553 | if (mr_rereg_mask & IB_MR_REREG_PD) | 544 | if (mr_rereg_mask & IB_MR_REREG_PD) |
554 | php = to_iwch_pd(pd); | 545 | php = to_iwch_pd(pd); |
555 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) | 546 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) |
556 | mh.attr.perms = iwch_convert_access(acc); | 547 | mh.attr.perms = iwch_ib_to_tpt_access(acc); |
557 | if (mr_rereg_mask & IB_MR_REREG_TRANS) | 548 | if (mr_rereg_mask & IB_MR_REREG_TRANS) |
558 | ret = build_phys_page_list(buffer_list, num_phys_buf, | 549 | ret = build_phys_page_list(buffer_list, num_phys_buf, |
559 | iova_start, | 550 | iova_start, |
@@ -568,7 +559,7 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr, | |||
568 | if (mr_rereg_mask & IB_MR_REREG_PD) | 559 | if (mr_rereg_mask & IB_MR_REREG_PD) |
569 | mhp->attr.pdid = php->pdid; | 560 | mhp->attr.pdid = php->pdid; |
570 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) | 561 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) |
571 | mhp->attr.perms = acc; | 562 | mhp->attr.perms = iwch_ib_to_tpt_access(acc); |
572 | if (mr_rereg_mask & IB_MR_REREG_TRANS) { | 563 | if (mr_rereg_mask & IB_MR_REREG_TRANS) { |
573 | mhp->attr.zbva = 0; | 564 | mhp->attr.zbva = 0; |
574 | mhp->attr.va_fbo = *iova_start; | 565 | mhp->attr.va_fbo = *iova_start; |
@@ -613,8 +604,6 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, struct ib_umem *region, | |||
613 | goto err; | 604 | goto err; |
614 | } | 605 | } |
615 | 606 | ||
616 | acc = iwch_convert_access(acc); | ||
617 | |||
618 | i = n = 0; | 607 | i = n = 0; |
619 | 608 | ||
620 | list_for_each_entry(chunk, ®ion->chunk_list, list) | 609 | list_for_each_entry(chunk, ®ion->chunk_list, list) |
@@ -630,10 +619,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, struct ib_umem *region, | |||
630 | mhp->rhp = rhp; | 619 | mhp->rhp = rhp; |
631 | mhp->attr.pdid = php->pdid; | 620 | mhp->attr.pdid = php->pdid; |
632 | mhp->attr.zbva = 0; | 621 | mhp->attr.zbva = 0; |
633 | mhp->attr.perms = (acc & 0x1) << 3; | 622 | mhp->attr.perms = iwch_ib_to_tpt_access(acc); |
634 | mhp->attr.perms |= (acc & 0x2) << 1; | ||
635 | mhp->attr.perms |= (acc & 0x4) >> 1; | ||
636 | mhp->attr.perms |= (acc & 0x8) >> 3; | ||
637 | mhp->attr.va_fbo = region->virt_base; | 623 | mhp->attr.va_fbo = region->virt_base; |
638 | mhp->attr.page_size = shift - 12; | 624 | mhp->attr.page_size = shift - 12; |
639 | mhp->attr.len = (u32) region->length; | 625 | mhp->attr.len = (u32) region->length; |
@@ -736,10 +722,8 @@ static int iwch_destroy_qp(struct ib_qp *ib_qp) | |||
736 | qhp = to_iwch_qp(ib_qp); | 722 | qhp = to_iwch_qp(ib_qp); |
737 | rhp = qhp->rhp; | 723 | rhp = qhp->rhp; |
738 | 724 | ||
739 | if (qhp->attr.state == IWCH_QP_STATE_RTS) { | 725 | attrs.next_state = IWCH_QP_STATE_ERROR; |
740 | attrs.next_state = IWCH_QP_STATE_ERROR; | 726 | iwch_modify_qp(rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, &attrs, 0); |
741 | iwch_modify_qp(rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, &attrs, 0); | ||
742 | } | ||
743 | wait_event(qhp->wait, !qhp->ep); | 727 | wait_event(qhp->wait, !qhp->ep); |
744 | 728 | ||
745 | remove_handle(rhp, &rhp->qpidr, qhp->wq.qpid); | 729 | remove_handle(rhp, &rhp->qpidr, qhp->wq.qpid); |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.h b/drivers/infiniband/hw/cxgb3/iwch_provider.h index de0fe1b93a0c..93bcc56756bd 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.h +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.h | |||
@@ -286,27 +286,20 @@ static inline int iwch_convert_state(enum ib_qp_state ib_state) | |||
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | enum iwch_mem_perms { | 289 | static inline u32 iwch_ib_to_tpt_access(int acc) |
290 | IWCH_MEM_ACCESS_LOCAL_READ = 1 << 0, | ||
291 | IWCH_MEM_ACCESS_LOCAL_WRITE = 1 << 1, | ||
292 | IWCH_MEM_ACCESS_REMOTE_READ = 1 << 2, | ||
293 | IWCH_MEM_ACCESS_REMOTE_WRITE = 1 << 3, | ||
294 | IWCH_MEM_ACCESS_ATOMICS = 1 << 4, | ||
295 | IWCH_MEM_ACCESS_BINDING = 1 << 5, | ||
296 | IWCH_MEM_ACCESS_LOCAL = | ||
297 | (IWCH_MEM_ACCESS_LOCAL_READ | IWCH_MEM_ACCESS_LOCAL_WRITE), | ||
298 | IWCH_MEM_ACCESS_REMOTE = | ||
299 | (IWCH_MEM_ACCESS_REMOTE_WRITE | IWCH_MEM_ACCESS_REMOTE_READ) | ||
300 | /* cannot go beyond 1 << 31 */ | ||
301 | } __attribute__ ((packed)); | ||
302 | |||
303 | static inline u32 iwch_convert_access(int acc) | ||
304 | { | 290 | { |
305 | return (acc & IB_ACCESS_REMOTE_WRITE ? IWCH_MEM_ACCESS_REMOTE_WRITE : 0) | 291 | return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) | |
306 | | (acc & IB_ACCESS_REMOTE_READ ? IWCH_MEM_ACCESS_REMOTE_READ : 0) | | 292 | (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0) | |
307 | (acc & IB_ACCESS_LOCAL_WRITE ? IWCH_MEM_ACCESS_LOCAL_WRITE : 0) | | 293 | (acc & IB_ACCESS_LOCAL_WRITE ? TPT_LOCAL_WRITE : 0) | |
308 | (acc & IB_ACCESS_MW_BIND ? IWCH_MEM_ACCESS_BINDING : 0) | | 294 | TPT_LOCAL_READ; |
309 | IWCH_MEM_ACCESS_LOCAL_READ; | 295 | } |
296 | |||
297 | static inline u32 iwch_ib_to_mwbind_access(int acc) | ||
298 | { | ||
299 | return (acc & IB_ACCESS_REMOTE_WRITE ? T3_MEM_ACCESS_REM_WRITE : 0) | | ||
300 | (acc & IB_ACCESS_REMOTE_READ ? T3_MEM_ACCESS_REM_READ : 0) | | ||
301 | (acc & IB_ACCESS_LOCAL_WRITE ? T3_MEM_ACCESS_LOCAL_WRITE : 0) | | ||
302 | T3_MEM_ACCESS_LOCAL_READ; | ||
310 | } | 303 | } |
311 | 304 | ||
312 | enum iwch_mmid_state { | 305 | enum iwch_mmid_state { |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c index 9ea00cc4a5f8..0a472c9b44db 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_qp.c +++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c | |||
@@ -439,7 +439,7 @@ int iwch_bind_mw(struct ib_qp *qp, | |||
439 | wqe->bind.type = T3_VA_BASED_TO; | 439 | wqe->bind.type = T3_VA_BASED_TO; |
440 | 440 | ||
441 | /* TBD: check perms */ | 441 | /* TBD: check perms */ |
442 | wqe->bind.perms = iwch_convert_access(mw_bind->mw_access_flags); | 442 | wqe->bind.perms = iwch_ib_to_mwbind_access(mw_bind->mw_access_flags); |
443 | wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey); | 443 | wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey); |
444 | wqe->bind.mw_stag = cpu_to_be32(mw->rkey); | 444 | wqe->bind.mw_stag = cpu_to_be32(mw->rkey); |
445 | wqe->bind.mw_len = cpu_to_be32(mw_bind->length); | 445 | wqe->bind.mw_len = cpu_to_be32(mw_bind->length); |
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 40404c9e2817..82ded44c6cee 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -52,6 +52,8 @@ struct ehca_mw; | |||
52 | struct ehca_pd; | 52 | struct ehca_pd; |
53 | struct ehca_av; | 53 | struct ehca_av; |
54 | 54 | ||
55 | #include <linux/wait.h> | ||
56 | |||
55 | #include <rdma/ib_verbs.h> | 57 | #include <rdma/ib_verbs.h> |
56 | #include <rdma/ib_user_verbs.h> | 58 | #include <rdma/ib_user_verbs.h> |
57 | 59 | ||
@@ -153,7 +155,9 @@ struct ehca_cq { | |||
153 | spinlock_t cb_lock; | 155 | spinlock_t cb_lock; |
154 | struct hlist_head qp_hashtab[QP_HASHTAB_LEN]; | 156 | struct hlist_head qp_hashtab[QP_HASHTAB_LEN]; |
155 | struct list_head entry; | 157 | struct list_head entry; |
156 | u32 nr_callbacks; | 158 | u32 nr_callbacks; /* #events assigned to cpu by scaling code */ |
159 | u32 nr_events; /* #events seen */ | ||
160 | wait_queue_head_t wait_completion; | ||
157 | spinlock_t task_lock; | 161 | spinlock_t task_lock; |
158 | u32 ownpid; | 162 | u32 ownpid; |
159 | /* mmap counter for resources mapped into user space */ | 163 | /* mmap counter for resources mapped into user space */ |
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c index 6ebfa27e4e16..e2cdc1a16fe9 100644 --- a/drivers/infiniband/hw/ehca/ehca_cq.c +++ b/drivers/infiniband/hw/ehca/ehca_cq.c | |||
@@ -146,6 +146,7 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, | |||
146 | spin_lock_init(&my_cq->spinlock); | 146 | spin_lock_init(&my_cq->spinlock); |
147 | spin_lock_init(&my_cq->cb_lock); | 147 | spin_lock_init(&my_cq->cb_lock); |
148 | spin_lock_init(&my_cq->task_lock); | 148 | spin_lock_init(&my_cq->task_lock); |
149 | init_waitqueue_head(&my_cq->wait_completion); | ||
149 | my_cq->ownpid = current->tgid; | 150 | my_cq->ownpid = current->tgid; |
150 | 151 | ||
151 | cq = &my_cq->ib_cq; | 152 | cq = &my_cq->ib_cq; |
@@ -302,6 +303,16 @@ create_cq_exit1: | |||
302 | return cq; | 303 | return cq; |
303 | } | 304 | } |
304 | 305 | ||
306 | static int get_cq_nr_events(struct ehca_cq *my_cq) | ||
307 | { | ||
308 | int ret; | ||
309 | unsigned long flags; | ||
310 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | ||
311 | ret = my_cq->nr_events; | ||
312 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
313 | return ret; | ||
314 | } | ||
315 | |||
305 | int ehca_destroy_cq(struct ib_cq *cq) | 316 | int ehca_destroy_cq(struct ib_cq *cq) |
306 | { | 317 | { |
307 | u64 h_ret; | 318 | u64 h_ret; |
@@ -329,10 +340,11 @@ int ehca_destroy_cq(struct ib_cq *cq) | |||
329 | } | 340 | } |
330 | 341 | ||
331 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | 342 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); |
332 | while (my_cq->nr_callbacks) { | 343 | while (my_cq->nr_events) { |
333 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | 344 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); |
334 | yield(); | 345 | wait_event(my_cq->wait_completion, !get_cq_nr_events(my_cq)); |
335 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | 346 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); |
347 | /* recheck nr_events to assure no cqe has just arrived */ | ||
336 | } | 348 | } |
337 | 349 | ||
338 | idr_remove(&ehca_cq_idr, my_cq->token); | 350 | idr_remove(&ehca_cq_idr, my_cq->token); |
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c index 3ec53c687d08..20f36bf8b2b6 100644 --- a/drivers/infiniband/hw/ehca/ehca_irq.c +++ b/drivers/infiniband/hw/ehca/ehca_irq.c | |||
@@ -404,10 +404,11 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe) | |||
404 | u32 token; | 404 | u32 token; |
405 | unsigned long flags; | 405 | unsigned long flags; |
406 | struct ehca_cq *cq; | 406 | struct ehca_cq *cq; |
407 | |||
407 | eqe_value = eqe->entry; | 408 | eqe_value = eqe->entry; |
408 | ehca_dbg(&shca->ib_device, "eqe_value=%lx", eqe_value); | 409 | ehca_dbg(&shca->ib_device, "eqe_value=%lx", eqe_value); |
409 | if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT, eqe_value)) { | 410 | if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT, eqe_value)) { |
410 | ehca_dbg(&shca->ib_device, "... completion event"); | 411 | ehca_dbg(&shca->ib_device, "Got completion event"); |
411 | token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe_value); | 412 | token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe_value); |
412 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | 413 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); |
413 | cq = idr_find(&ehca_cq_idr, token); | 414 | cq = idr_find(&ehca_cq_idr, token); |
@@ -419,16 +420,20 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe) | |||
419 | return; | 420 | return; |
420 | } | 421 | } |
421 | reset_eq_pending(cq); | 422 | reset_eq_pending(cq); |
422 | if (ehca_scaling_code) { | 423 | cq->nr_events++; |
424 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
425 | if (ehca_scaling_code) | ||
423 | queue_comp_task(cq); | 426 | queue_comp_task(cq); |
424 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | 427 | else { |
425 | } else { | ||
426 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
427 | comp_event_callback(cq); | 428 | comp_event_callback(cq); |
429 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | ||
430 | cq->nr_events--; | ||
431 | if (!cq->nr_events) | ||
432 | wake_up(&cq->wait_completion); | ||
433 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
428 | } | 434 | } |
429 | } else { | 435 | } else { |
430 | ehca_dbg(&shca->ib_device, | 436 | ehca_dbg(&shca->ib_device, "Got non completion event"); |
431 | "Got non completion event"); | ||
432 | parse_identifier(shca, eqe_value); | 437 | parse_identifier(shca, eqe_value); |
433 | } | 438 | } |
434 | } | 439 | } |
@@ -478,6 +483,7 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq) | |||
478 | "token=%x", token); | 483 | "token=%x", token); |
479 | continue; | 484 | continue; |
480 | } | 485 | } |
486 | eqe_cache[eqe_cnt].cq->nr_events++; | ||
481 | spin_unlock(&ehca_cq_idr_lock); | 487 | spin_unlock(&ehca_cq_idr_lock); |
482 | } else | 488 | } else |
483 | eqe_cache[eqe_cnt].cq = NULL; | 489 | eqe_cache[eqe_cnt].cq = NULL; |
@@ -504,12 +510,18 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq) | |||
504 | /* call completion handler for cached eqes */ | 510 | /* call completion handler for cached eqes */ |
505 | for (i = 0; i < eqe_cnt; i++) | 511 | for (i = 0; i < eqe_cnt; i++) |
506 | if (eq->eqe_cache[i].cq) { | 512 | if (eq->eqe_cache[i].cq) { |
507 | if (ehca_scaling_code) { | 513 | if (ehca_scaling_code) |
508 | spin_lock(&ehca_cq_idr_lock); | ||
509 | queue_comp_task(eq->eqe_cache[i].cq); | 514 | queue_comp_task(eq->eqe_cache[i].cq); |
510 | spin_unlock(&ehca_cq_idr_lock); | 515 | else { |
511 | } else | 516 | struct ehca_cq *cq = eq->eqe_cache[i].cq; |
512 | comp_event_callback(eq->eqe_cache[i].cq); | 517 | comp_event_callback(cq); |
518 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | ||
519 | cq->nr_events--; | ||
520 | if (!cq->nr_events) | ||
521 | wake_up(&cq->wait_completion); | ||
522 | spin_unlock_irqrestore(&ehca_cq_idr_lock, | ||
523 | flags); | ||
524 | } | ||
513 | } else { | 525 | } else { |
514 | ehca_dbg(&shca->ib_device, "Got non completion event"); | 526 | ehca_dbg(&shca->ib_device, "Got non completion event"); |
515 | parse_identifier(shca, eq->eqe_cache[i].eqe->entry); | 527 | parse_identifier(shca, eq->eqe_cache[i].eqe->entry); |
@@ -523,7 +535,6 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq) | |||
523 | if (!eqe) | 535 | if (!eqe) |
524 | break; | 536 | break; |
525 | process_eqe(shca, eqe); | 537 | process_eqe(shca, eqe); |
526 | eqe_cnt++; | ||
527 | } while (1); | 538 | } while (1); |
528 | 539 | ||
529 | unlock_irq_spinlock: | 540 | unlock_irq_spinlock: |
@@ -567,8 +578,7 @@ static void __queue_comp_task(struct ehca_cq *__cq, | |||
567 | list_add_tail(&__cq->entry, &cct->cq_list); | 578 | list_add_tail(&__cq->entry, &cct->cq_list); |
568 | cct->cq_jobs++; | 579 | cct->cq_jobs++; |
569 | wake_up(&cct->wait_queue); | 580 | wake_up(&cct->wait_queue); |
570 | } | 581 | } else |
571 | else | ||
572 | __cq->nr_callbacks++; | 582 | __cq->nr_callbacks++; |
573 | 583 | ||
574 | spin_unlock(&__cq->task_lock); | 584 | spin_unlock(&__cq->task_lock); |
@@ -577,18 +587,21 @@ static void __queue_comp_task(struct ehca_cq *__cq, | |||
577 | 587 | ||
578 | static void queue_comp_task(struct ehca_cq *__cq) | 588 | static void queue_comp_task(struct ehca_cq *__cq) |
579 | { | 589 | { |
580 | int cpu; | ||
581 | int cpu_id; | 590 | int cpu_id; |
582 | struct ehca_cpu_comp_task *cct; | 591 | struct ehca_cpu_comp_task *cct; |
592 | int cq_jobs; | ||
593 | unsigned long flags; | ||
583 | 594 | ||
584 | cpu = get_cpu(); | ||
585 | cpu_id = find_next_online_cpu(pool); | 595 | cpu_id = find_next_online_cpu(pool); |
586 | BUG_ON(!cpu_online(cpu_id)); | 596 | BUG_ON(!cpu_online(cpu_id)); |
587 | 597 | ||
588 | cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); | 598 | cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); |
589 | BUG_ON(!cct); | 599 | BUG_ON(!cct); |
590 | 600 | ||
591 | if (cct->cq_jobs > 0) { | 601 | spin_lock_irqsave(&cct->task_lock, flags); |
602 | cq_jobs = cct->cq_jobs; | ||
603 | spin_unlock_irqrestore(&cct->task_lock, flags); | ||
604 | if (cq_jobs > 0) { | ||
592 | cpu_id = find_next_online_cpu(pool); | 605 | cpu_id = find_next_online_cpu(pool); |
593 | cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); | 606 | cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id); |
594 | BUG_ON(!cct); | 607 | BUG_ON(!cct); |
@@ -608,11 +621,17 @@ static void run_comp_task(struct ehca_cpu_comp_task* cct) | |||
608 | cq = list_entry(cct->cq_list.next, struct ehca_cq, entry); | 621 | cq = list_entry(cct->cq_list.next, struct ehca_cq, entry); |
609 | spin_unlock_irqrestore(&cct->task_lock, flags); | 622 | spin_unlock_irqrestore(&cct->task_lock, flags); |
610 | comp_event_callback(cq); | 623 | comp_event_callback(cq); |
611 | spin_lock_irqsave(&cct->task_lock, flags); | ||
612 | 624 | ||
625 | spin_lock_irqsave(&ehca_cq_idr_lock, flags); | ||
626 | cq->nr_events--; | ||
627 | if (!cq->nr_events) | ||
628 | wake_up(&cq->wait_completion); | ||
629 | spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); | ||
630 | |||
631 | spin_lock_irqsave(&cct->task_lock, flags); | ||
613 | spin_lock(&cq->task_lock); | 632 | spin_lock(&cq->task_lock); |
614 | cq->nr_callbacks--; | 633 | cq->nr_callbacks--; |
615 | if (cq->nr_callbacks == 0) { | 634 | if (!cq->nr_callbacks) { |
616 | list_del_init(cct->cq_list.next); | 635 | list_del_init(cct->cq_list.next); |
617 | cct->cq_jobs--; | 636 | cct->cq_jobs--; |
618 | } | 637 | } |
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index c1835121a822..059da9628bb5 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -52,7 +52,7 @@ | |||
52 | MODULE_LICENSE("Dual BSD/GPL"); | 52 | MODULE_LICENSE("Dual BSD/GPL"); |
53 | MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>"); | 53 | MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>"); |
54 | MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver"); | 54 | MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver"); |
55 | MODULE_VERSION("SVNEHCA_0021"); | 55 | MODULE_VERSION("SVNEHCA_0022"); |
56 | 56 | ||
57 | int ehca_open_aqp1 = 0; | 57 | int ehca_open_aqp1 = 0; |
58 | int ehca_debug_level = 0; | 58 | int ehca_debug_level = 0; |
@@ -810,7 +810,7 @@ int __init ehca_module_init(void) | |||
810 | int ret; | 810 | int ret; |
811 | 811 | ||
812 | printk(KERN_INFO "eHCA Infiniband Device Driver " | 812 | printk(KERN_INFO "eHCA Infiniband Device Driver " |
813 | "(Rel.: SVNEHCA_0021)\n"); | 813 | "(Rel.: SVNEHCA_0022)\n"); |
814 | idr_init(&ehca_qp_idr); | 814 | idr_init(&ehca_qp_idr); |
815 | idr_init(&ehca_cq_idr); | 815 | idr_init(&ehca_cq_idr); |
816 | spin_lock_init(&ehca_qp_idr_lock); | 816 | spin_lock_init(&ehca_qp_idr_lock); |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 71dc84bd4254..1c6b63aca268 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -1088,21 +1088,21 @@ static void mthca_unmap_memfree(struct mthca_dev *dev, | |||
1088 | static int mthca_alloc_memfree(struct mthca_dev *dev, | 1088 | static int mthca_alloc_memfree(struct mthca_dev *dev, |
1089 | struct mthca_qp *qp) | 1089 | struct mthca_qp *qp) |
1090 | { | 1090 | { |
1091 | int ret = 0; | ||
1092 | |||
1093 | if (mthca_is_memfree(dev)) { | 1091 | if (mthca_is_memfree(dev)) { |
1094 | qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, | 1092 | qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, |
1095 | qp->qpn, &qp->rq.db); | 1093 | qp->qpn, &qp->rq.db); |
1096 | if (qp->rq.db_index < 0) | 1094 | if (qp->rq.db_index < 0) |
1097 | return ret; | 1095 | return -ENOMEM; |
1098 | 1096 | ||
1099 | qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, | 1097 | qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, |
1100 | qp->qpn, &qp->sq.db); | 1098 | qp->qpn, &qp->sq.db); |
1101 | if (qp->sq.db_index < 0) | 1099 | if (qp->sq.db_index < 0) { |
1102 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); | 1100 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); |
1101 | return -ENOMEM; | ||
1102 | } | ||
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | return ret; | 1105 | return 0; |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | static void mthca_free_memfree(struct mthca_dev *dev, | 1108 | static void mthca_free_memfree(struct mthca_dev *dev, |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index bb2e3d5eee20..56c87a81bb67 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -407,6 +407,10 @@ static int ipoib_mcast_join_complete(int status, | |||
407 | queue_delayed_work(ipoib_workqueue, | 407 | queue_delayed_work(ipoib_workqueue, |
408 | &priv->mcast_task, 0); | 408 | &priv->mcast_task, 0); |
409 | mutex_unlock(&mcast_mutex); | 409 | mutex_unlock(&mcast_mutex); |
410 | |||
411 | if (mcast == priv->broadcast) | ||
412 | netif_carrier_on(dev); | ||
413 | |||
410 | return 0; | 414 | return 0; |
411 | } | 415 | } |
412 | 416 | ||
@@ -594,7 +598,6 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
594 | ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); | 598 | ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n"); |
595 | 599 | ||
596 | clear_bit(IPOIB_MCAST_RUN, &priv->flags); | 600 | clear_bit(IPOIB_MCAST_RUN, &priv->flags); |
597 | netif_carrier_on(dev); | ||
598 | } | 601 | } |
599 | 602 | ||
600 | int ipoib_mcast_start_thread(struct net_device *dev) | 603 | int ipoib_mcast_start_thread(struct net_device *dev) |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index 3cb551b88756..7f3ec205e35f 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c | |||
@@ -259,12 +259,13 @@ void ipoib_event(struct ib_event_handler *handler, | |||
259 | struct ipoib_dev_priv *priv = | 259 | struct ipoib_dev_priv *priv = |
260 | container_of(handler, struct ipoib_dev_priv, event_handler); | 260 | container_of(handler, struct ipoib_dev_priv, event_handler); |
261 | 261 | ||
262 | if (record->event == IB_EVENT_PORT_ERR || | 262 | if ((record->event == IB_EVENT_PORT_ERR || |
263 | record->event == IB_EVENT_PKEY_CHANGE || | 263 | record->event == IB_EVENT_PKEY_CHANGE || |
264 | record->event == IB_EVENT_PORT_ACTIVE || | 264 | record->event == IB_EVENT_PORT_ACTIVE || |
265 | record->event == IB_EVENT_LID_CHANGE || | 265 | record->event == IB_EVENT_LID_CHANGE || |
266 | record->event == IB_EVENT_SM_CHANGE || | 266 | record->event == IB_EVENT_SM_CHANGE || |
267 | record->event == IB_EVENT_CLIENT_REREGISTER) { | 267 | record->event == IB_EVENT_CLIENT_REREGISTER) && |
268 | record->element.port_num == priv->port) { | ||
268 | ipoib_dbg(priv, "Port state change event\n"); | 269 | ipoib_dbg(priv, "Port state change event\n"); |
269 | queue_work(ipoib_workqueue, &priv->flush_task); | 270 | queue_work(ipoib_workqueue, &priv->flush_task); |
270 | } | 271 | } |
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 295e931c0dfb..4b232124a1ab 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -211,7 +211,7 @@ static struct workqueue_struct *led_workqueue; | |||
211 | enum led_brightness value); \ | 211 | enum led_brightness value); \ |
212 | static void object##_led_update(struct work_struct *ignored); \ | 212 | static void object##_led_update(struct work_struct *ignored); \ |
213 | static int object##_led_wk; \ | 213 | static int object##_led_wk; \ |
214 | DECLARE_WORK(object##_led_work, object##_led_update); \ | 214 | static DECLARE_WORK(object##_led_work, object##_led_update); \ |
215 | static struct led_classdev object##_led = { \ | 215 | static struct led_classdev object##_led = { \ |
216 | .name = "asus:" ledname, \ | 216 | .name = "asus:" ledname, \ |
217 | .brightness_set = object##_led_set, \ | 217 | .brightness_set = object##_led_set, \ |
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 2ebe240dd537..ac708bc2f9f3 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -453,7 +453,7 @@ static int sony_acpi_resume(struct acpi_device *device) | |||
453 | static int sony_acpi_add(struct acpi_device *device) | 453 | static int sony_acpi_add(struct acpi_device *device) |
454 | { | 454 | { |
455 | acpi_status status; | 455 | acpi_status status; |
456 | int result; | 456 | int result = 0; |
457 | acpi_handle handle; | 457 | acpi_handle handle; |
458 | 458 | ||
459 | sony_acpi_acpi_device = device; | 459 | sony_acpi_acpi_device = device; |
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index e3acd398fb37..1f6445840461 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
@@ -359,6 +359,8 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) | |||
359 | cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp; | 359 | cfi->chips[i].word_write_time = 1<<cfi->cfiq->WordWriteTimeoutTyp; |
360 | cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; | 360 | cfi->chips[i].buffer_write_time = 1<<cfi->cfiq->BufWriteTimeoutTyp; |
361 | cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; | 361 | cfi->chips[i].erase_time = 1<<cfi->cfiq->BlockEraseTimeoutTyp; |
362 | cfi->chips[i].ref_point_counter = 0; | ||
363 | init_waitqueue_head(&(cfi->chips[i].wq)); | ||
362 | } | 364 | } |
363 | 365 | ||
364 | map->fldrv = &cfi_amdstd_chipdrv; | 366 | map->fldrv = &cfi_amdstd_chipdrv; |
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c index 69d49e0250a9..b344ff858b2d 100644 --- a/drivers/mtd/chips/cfi_cmdset_0020.c +++ b/drivers/mtd/chips/cfi_cmdset_0020.c | |||
@@ -158,6 +158,8 @@ struct mtd_info *cfi_cmdset_0020(struct map_info *map, int primary) | |||
158 | cfi->chips[i].word_write_time = 128; | 158 | cfi->chips[i].word_write_time = 128; |
159 | cfi->chips[i].buffer_write_time = 128; | 159 | cfi->chips[i].buffer_write_time = 128; |
160 | cfi->chips[i].erase_time = 1024; | 160 | cfi->chips[i].erase_time = 1024; |
161 | cfi->chips[i].ref_point_counter = 0; | ||
162 | init_waitqueue_head(&(cfi->chips[i].wq)); | ||
161 | } | 163 | } |
162 | 164 | ||
163 | return cfi_staa_setup(map); | 165 | return cfi_staa_setup(map); |
diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c index b1104fe1f207..1c3b34ad7325 100644 --- a/drivers/mtd/maps/dilnetpc.c +++ b/drivers/mtd/maps/dilnetpc.c | |||
@@ -402,8 +402,8 @@ static int __init init_dnpc(void) | |||
402 | ++higlvl_partition_info[i].name; | 402 | ++higlvl_partition_info[i].name; |
403 | } | 403 | } |
404 | 404 | ||
405 | printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n", | 405 | printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%llx\n", |
406 | is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.phys); | 406 | is_dnp ? "DNPC" : "ADNP", dnpc_map.size, (unsigned long long)dnpc_map.phys); |
407 | 407 | ||
408 | dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size); | 408 | dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size); |
409 | 409 | ||
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c index 0bc013fd66a3..aa64a4752781 100644 --- a/drivers/mtd/maps/esb2rom.c +++ b/drivers/mtd/maps/esb2rom.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | #define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */ | 31 | #define ROM_PROBE_STEP_SIZE (64*1024) /* 64KiB */ |
32 | 32 | ||
33 | #define BIOS_CNTL 0xDC | 33 | #define BIOS_CNTL 0xDC |
34 | #define BIOS_LOCK_ENABLE 0x02 | 34 | #define BIOS_LOCK_ENABLE 0x02 |
35 | #define BIOS_WRITE_ENABLE 0x01 | 35 | #define BIOS_WRITE_ENABLE 0x01 |
36 | 36 | ||
@@ -145,7 +145,7 @@ static void esb2rom_cleanup(struct esb2rom_window *window) | |||
145 | } | 145 | } |
146 | 146 | ||
147 | static int __devinit esb2rom_init_one(struct pci_dev *pdev, | 147 | static int __devinit esb2rom_init_one(struct pci_dev *pdev, |
148 | const struct pci_device_id *ent) | 148 | const struct pci_device_id *ent) |
149 | { | 149 | { |
150 | static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; | 150 | static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; |
151 | struct esb2rom_window *window = &esb2rom_window; | 151 | struct esb2rom_window *window = &esb2rom_window; |
@@ -185,7 +185,7 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev, | |||
185 | /* Find a region continuous to the end of the ROM window */ | 185 | /* Find a region continuous to the end of the ROM window */ |
186 | window->phys = 0; | 186 | window->phys = 0; |
187 | pci_read_config_word(pdev, FWH_DEC_EN1, &word); | 187 | pci_read_config_word(pdev, FWH_DEC_EN1, &word); |
188 | printk(KERN_DEBUG "pci_read_config_byte : %x\n", word); | 188 | printk(KERN_DEBUG "pci_read_config_word : %x\n", word); |
189 | 189 | ||
190 | if ((word & FWH_8MiB) == FWH_8MiB) | 190 | if ((word & FWH_8MiB) == FWH_8MiB) |
191 | window->phys = 0xff400000; | 191 | window->phys = 0xff400000; |
@@ -212,6 +212,11 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev, | |||
212 | else if ((word & FWH_0_5MiB) == FWH_0_5MiB) | 212 | else if ((word & FWH_0_5MiB) == FWH_0_5MiB) |
213 | window->phys = 0xfff80000; | 213 | window->phys = 0xfff80000; |
214 | 214 | ||
215 | if (window->phys == 0) { | ||
216 | printk(KERN_ERR MOD_NAME ": Rom window is closed\n"); | ||
217 | goto out; | ||
218 | } | ||
219 | |||
215 | /* reserved 0x0020 and 0x0010 */ | 220 | /* reserved 0x0020 and 0x0010 */ |
216 | window->phys -= 0x400000UL; | 221 | window->phys -= 0x400000UL; |
217 | window->size = (0xffffffffUL - window->phys) + 1UL; | 222 | window->size = (0xffffffffUL - window->phys) + 1UL; |
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 880580c44e01..41844ea02462 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -727,6 +727,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
727 | concat->mtd.erasesize = subdev[0]->erasesize; | 727 | concat->mtd.erasesize = subdev[0]->erasesize; |
728 | concat->mtd.writesize = subdev[0]->writesize; | 728 | concat->mtd.writesize = subdev[0]->writesize; |
729 | concat->mtd.oobsize = subdev[0]->oobsize; | 729 | concat->mtd.oobsize = subdev[0]->oobsize; |
730 | concat->mtd.oobavail = subdev[0]->oobavail; | ||
730 | if (subdev[0]->writev) | 731 | if (subdev[0]->writev) |
731 | concat->mtd.writev = concat_writev; | 732 | concat->mtd.writev = concat_writev; |
732 | if (subdev[0]->read_oob) | 733 | if (subdev[0]->read_oob) |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 633def3fb087..1af989023c66 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -200,6 +200,11 @@ static int part_erase (struct mtd_info *mtd, struct erase_info *instr) | |||
200 | return -EINVAL; | 200 | return -EINVAL; |
201 | instr->addr += part->offset; | 201 | instr->addr += part->offset; |
202 | ret = part->master->erase(part->master, instr); | 202 | ret = part->master->erase(part->master, instr); |
203 | if (ret) { | ||
204 | if (instr->fail_addr != 0xffffffff) | ||
205 | instr->fail_addr -= part->offset; | ||
206 | instr->addr -= part->offset; | ||
207 | } | ||
203 | return ret; | 208 | return ret; |
204 | } | 209 | } |
205 | 210 | ||
@@ -338,6 +343,7 @@ int add_mtd_partitions(struct mtd_info *master, | |||
338 | slave->mtd.size = parts[i].size; | 343 | slave->mtd.size = parts[i].size; |
339 | slave->mtd.writesize = master->writesize; | 344 | slave->mtd.writesize = master->writesize; |
340 | slave->mtd.oobsize = master->oobsize; | 345 | slave->mtd.oobsize = master->oobsize; |
346 | slave->mtd.oobavail = master->oobavail; | ||
341 | slave->mtd.subpage_sft = master->subpage_sft; | 347 | slave->mtd.subpage_sft = master->subpage_sft; |
342 | 348 | ||
343 | slave->mtd.name = parts[i].name; | 349 | slave->mtd.name = parts[i].name; |
@@ -559,4 +565,3 @@ EXPORT_SYMBOL_GPL(deregister_mtd_parser); | |||
559 | MODULE_LICENSE("GPL"); | 565 | MODULE_LICENSE("GPL"); |
560 | MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>"); | 566 | MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>"); |
561 | MODULE_DESCRIPTION("Generic support for partitioning of MTD devices"); | 567 | MODULE_DESCRIPTION("Generic support for partitioning of MTD devices"); |
562 | |||
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c index 12608c13cce5..595208f965a5 100644 --- a/drivers/mtd/nand/diskonchip.c +++ b/drivers/mtd/nand/diskonchip.c | |||
@@ -114,7 +114,7 @@ module_param(no_autopart, int, 0); | |||
114 | static int show_firmware_partition = 0; | 114 | static int show_firmware_partition = 0; |
115 | module_param(show_firmware_partition, int, 0); | 115 | module_param(show_firmware_partition, int, 0); |
116 | 116 | ||
117 | #ifdef MTD_NAND_DISKONCHIP_BBTWRITE | 117 | #ifdef CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE |
118 | static int inftl_bbt_write = 1; | 118 | static int inftl_bbt_write = 1; |
119 | #else | 119 | #else |
120 | static int inftl_bbt_write = 0; | 120 | static int inftl_bbt_write = 0; |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index acaf97bc80d1..6af37b8cff65 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2524,6 +2524,7 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
2524 | for (i = 0; chip->ecc.layout->oobfree[i].length; i++) | 2524 | for (i = 0; chip->ecc.layout->oobfree[i].length; i++) |
2525 | chip->ecc.layout->oobavail += | 2525 | chip->ecc.layout->oobavail += |
2526 | chip->ecc.layout->oobfree[i].length; | 2526 | chip->ecc.layout->oobfree[i].length; |
2527 | mtd->oobavail = chip->ecc.layout->oobavail; | ||
2527 | 2528 | ||
2528 | /* | 2529 | /* |
2529 | * Set the number of read / write steps for one page depending on ECC | 2530 | * Set the number of read / write steps for one page depending on ECC |
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 7f1cb6e5dccb..9e14a26ca4e8 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c | |||
@@ -4,6 +4,11 @@ | |||
4 | * Copyright (C) 2005-2007 Samsung Electronics | 4 | * Copyright (C) 2005-2007 Samsung Electronics |
5 | * Kyungmin Park <kyungmin.park@samsung.com> | 5 | * Kyungmin Park <kyungmin.park@samsung.com> |
6 | * | 6 | * |
7 | * Credits: | ||
8 | * Adrian Hunter <ext-adrian.hunter@nokia.com>: | ||
9 | * auto-placement support, read-while load support, various fixes | ||
10 | * Copyright (C) Nokia Corporation, 2007 | ||
11 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 13 | * it under the terms of the GNU General Public License version 2 as |
9 | * published by the Free Software Foundation. | 14 | * published by the Free Software Foundation. |
@@ -831,7 +836,7 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col | |||
831 | int readcol = column; | 836 | int readcol = column; |
832 | int readend = column + thislen; | 837 | int readend = column + thislen; |
833 | int lastgap = 0; | 838 | int lastgap = 0; |
834 | uint8_t *oob_buf = this->page_buf + mtd->writesize; | 839 | uint8_t *oob_buf = this->oob_buf; |
835 | 840 | ||
836 | for (free = this->ecclayout->oobfree; free->length; ++free) { | 841 | for (free = this->ecclayout->oobfree; free->length; ++free) { |
837 | if (readcol >= lastgap) | 842 | if (readcol >= lastgap) |
@@ -849,7 +854,8 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col | |||
849 | int n = ed - st; | 854 | int n = ed - st; |
850 | memcpy(buf, oob_buf + st, n); | 855 | memcpy(buf, oob_buf + st, n); |
851 | buf += n; | 856 | buf += n; |
852 | } | 857 | } else |
858 | break; | ||
853 | } | 859 | } |
854 | return 0; | 860 | return 0; |
855 | } | 861 | } |
@@ -947,9 +953,9 @@ static int onenand_do_read_oob(struct mtd_info *mtd, loff_t from, size_t len, | |||
947 | 953 | ||
948 | /** | 954 | /** |
949 | * onenand_read_oob - [MTD Interface] NAND write data and/or out-of-band | 955 | * onenand_read_oob - [MTD Interface] NAND write data and/or out-of-band |
950 | * @mtd: MTD device structure | 956 | * @param mtd: MTD device structure |
951 | * @from: offset to read from | 957 | * @param from: offset to read from |
952 | * @ops: oob operation description structure | 958 | * @param ops: oob operation description structure |
953 | */ | 959 | */ |
954 | static int onenand_read_oob(struct mtd_info *mtd, loff_t from, | 960 | static int onenand_read_oob(struct mtd_info *mtd, loff_t from, |
955 | struct mtd_oob_ops *ops) | 961 | struct mtd_oob_ops *ops) |
@@ -1017,7 +1023,7 @@ static int onenand_bbt_wait(struct mtd_info *mtd, int state) | |||
1017 | * onenand_bbt_read_oob - [MTD Interface] OneNAND read out-of-band for bbt scan | 1023 | * onenand_bbt_read_oob - [MTD Interface] OneNAND read out-of-band for bbt scan |
1018 | * @param mtd MTD device structure | 1024 | * @param mtd MTD device structure |
1019 | * @param from offset to read from | 1025 | * @param from offset to read from |
1020 | * @param @ops oob operation description structure | 1026 | * @param ops oob operation description structure |
1021 | * | 1027 | * |
1022 | * OneNAND read out-of-band data from the spare area for bbt scan | 1028 | * OneNAND read out-of-band data from the spare area for bbt scan |
1023 | */ | 1029 | */ |
@@ -1093,7 +1099,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from, | |||
1093 | static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to) | 1099 | static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to) |
1094 | { | 1100 | { |
1095 | struct onenand_chip *this = mtd->priv; | 1101 | struct onenand_chip *this = mtd->priv; |
1096 | char *readp = this->page_buf + mtd->writesize; | 1102 | char oobbuf[64]; |
1097 | int status, i; | 1103 | int status, i; |
1098 | 1104 | ||
1099 | this->command(mtd, ONENAND_CMD_READOOB, to, mtd->oobsize); | 1105 | this->command(mtd, ONENAND_CMD_READOOB, to, mtd->oobsize); |
@@ -1102,9 +1108,9 @@ static int onenand_verify_oob(struct mtd_info *mtd, const u_char *buf, loff_t to | |||
1102 | if (status) | 1108 | if (status) |
1103 | return status; | 1109 | return status; |
1104 | 1110 | ||
1105 | this->read_bufferram(mtd, ONENAND_SPARERAM, readp, 0, mtd->oobsize); | 1111 | this->read_bufferram(mtd, ONENAND_SPARERAM, oobbuf, 0, mtd->oobsize); |
1106 | for(i = 0; i < mtd->oobsize; i++) | 1112 | for (i = 0; i < mtd->oobsize; i++) |
1107 | if (buf[i] != 0xFF && buf[i] != readp[i]) | 1113 | if (buf[i] != 0xFF && buf[i] != oobbuf[i]) |
1108 | return -EBADMSG; | 1114 | return -EBADMSG; |
1109 | 1115 | ||
1110 | return 0; | 1116 | return 0; |
@@ -1290,7 +1296,8 @@ static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf, | |||
1290 | int n = ed - st; | 1296 | int n = ed - st; |
1291 | memcpy(oob_buf + st, buf, n); | 1297 | memcpy(oob_buf + st, buf, n); |
1292 | buf += n; | 1298 | buf += n; |
1293 | } | 1299 | } else |
1300 | break; | ||
1294 | } | 1301 | } |
1295 | return 0; | 1302 | return 0; |
1296 | } | 1303 | } |
@@ -1312,6 +1319,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1312 | struct onenand_chip *this = mtd->priv; | 1319 | struct onenand_chip *this = mtd->priv; |
1313 | int column, ret = 0, oobsize; | 1320 | int column, ret = 0, oobsize; |
1314 | int written = 0; | 1321 | int written = 0; |
1322 | u_char *oobbuf; | ||
1315 | 1323 | ||
1316 | DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len); | 1324 | DEBUG(MTD_DEBUG_LEVEL3, "onenand_write_oob: to = 0x%08x, len = %i\n", (unsigned int) to, (int) len); |
1317 | 1325 | ||
@@ -1331,7 +1339,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1331 | } | 1339 | } |
1332 | 1340 | ||
1333 | /* For compatibility with NAND: Do not allow write past end of page */ | 1341 | /* For compatibility with NAND: Do not allow write past end of page */ |
1334 | if (column + len > oobsize) { | 1342 | if (unlikely(column + len > oobsize)) { |
1335 | printk(KERN_ERR "onenand_write_oob: " | 1343 | printk(KERN_ERR "onenand_write_oob: " |
1336 | "Attempt to write past end of page\n"); | 1344 | "Attempt to write past end of page\n"); |
1337 | return -EINVAL; | 1345 | return -EINVAL; |
@@ -1348,6 +1356,8 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1348 | /* Grab the lock and see if the device is available */ | 1356 | /* Grab the lock and see if the device is available */ |
1349 | onenand_get_device(mtd, FL_WRITING); | 1357 | onenand_get_device(mtd, FL_WRITING); |
1350 | 1358 | ||
1359 | oobbuf = this->oob_buf; | ||
1360 | |||
1351 | /* Loop until all data write */ | 1361 | /* Loop until all data write */ |
1352 | while (written < len) { | 1362 | while (written < len) { |
1353 | int thislen = min_t(int, oobsize, len - written); | 1363 | int thislen = min_t(int, oobsize, len - written); |
@@ -1358,12 +1368,12 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1358 | 1368 | ||
1359 | /* We send data to spare ram with oobsize | 1369 | /* We send data to spare ram with oobsize |
1360 | * to prevent byte access */ | 1370 | * to prevent byte access */ |
1361 | memset(this->page_buf, 0xff, mtd->oobsize); | 1371 | memset(oobbuf, 0xff, mtd->oobsize); |
1362 | if (mode == MTD_OOB_AUTO) | 1372 | if (mode == MTD_OOB_AUTO) |
1363 | onenand_fill_auto_oob(mtd, this->page_buf, buf, column, thislen); | 1373 | onenand_fill_auto_oob(mtd, oobbuf, buf, column, thislen); |
1364 | else | 1374 | else |
1365 | memcpy(this->page_buf + column, buf, thislen); | 1375 | memcpy(oobbuf + column, buf, thislen); |
1366 | this->write_bufferram(mtd, ONENAND_SPARERAM, this->page_buf, 0, mtd->oobsize); | 1376 | this->write_bufferram(mtd, ONENAND_SPARERAM, oobbuf, 0, mtd->oobsize); |
1367 | 1377 | ||
1368 | this->command(mtd, ONENAND_CMD_PROGOOB, to, mtd->oobsize); | 1378 | this->command(mtd, ONENAND_CMD_PROGOOB, to, mtd->oobsize); |
1369 | 1379 | ||
@@ -1375,7 +1385,7 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1375 | break; | 1385 | break; |
1376 | } | 1386 | } |
1377 | 1387 | ||
1378 | ret = onenand_verify_oob(mtd, this->page_buf, to); | 1388 | ret = onenand_verify_oob(mtd, oobbuf, to); |
1379 | if (ret) { | 1389 | if (ret) { |
1380 | printk(KERN_ERR "onenand_write_oob: verify failed %d\n", ret); | 1390 | printk(KERN_ERR "onenand_write_oob: verify failed %d\n", ret); |
1381 | break; | 1391 | break; |
@@ -1400,9 +1410,9 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, | |||
1400 | 1410 | ||
1401 | /** | 1411 | /** |
1402 | * onenand_write_oob - [MTD Interface] NAND write data and/or out-of-band | 1412 | * onenand_write_oob - [MTD Interface] NAND write data and/or out-of-band |
1403 | * @mtd: MTD device structure | 1413 | * @param mtd: MTD device structure |
1404 | * @from: offset to read from | 1414 | * @param to: offset to write |
1405 | * @ops: oob operation description structure | 1415 | * @param ops: oob operation description structure |
1406 | */ | 1416 | */ |
1407 | static int onenand_write_oob(struct mtd_info *mtd, loff_t to, | 1417 | static int onenand_write_oob(struct mtd_info *mtd, loff_t to, |
1408 | struct mtd_oob_ops *ops) | 1418 | struct mtd_oob_ops *ops) |
@@ -1616,6 +1626,7 @@ static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
1616 | * @param mtd MTD device structure | 1626 | * @param mtd MTD device structure |
1617 | * @param ofs offset relative to mtd start | 1627 | * @param ofs offset relative to mtd start |
1618 | * @param len number of bytes to lock or unlock | 1628 | * @param len number of bytes to lock or unlock |
1629 | * @param cmd lock or unlock command | ||
1619 | * | 1630 | * |
1620 | * Lock or unlock one or more blocks | 1631 | * Lock or unlock one or more blocks |
1621 | */ | 1632 | */ |
@@ -2117,10 +2128,11 @@ static void onenand_check_features(struct mtd_info *mtd) | |||
2117 | } | 2128 | } |
2118 | 2129 | ||
2119 | /** | 2130 | /** |
2120 | * onenand_print_device_info - Print device ID | 2131 | * onenand_print_device_info - Print device & version ID |
2121 | * @param device device ID | 2132 | * @param device device ID |
2133 | * @param version version ID | ||
2122 | * | 2134 | * |
2123 | * Print device ID | 2135 | * Print device & version ID |
2124 | */ | 2136 | */ |
2125 | static void onenand_print_device_info(int device, int version) | 2137 | static void onenand_print_device_info(int device, int version) |
2126 | { | 2138 | { |
@@ -2320,15 +2332,25 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) | |||
2320 | 2332 | ||
2321 | /* Allocate buffers, if necessary */ | 2333 | /* Allocate buffers, if necessary */ |
2322 | if (!this->page_buf) { | 2334 | if (!this->page_buf) { |
2323 | size_t len; | 2335 | this->page_buf = kzalloc(mtd->writesize, GFP_KERNEL); |
2324 | len = mtd->writesize + mtd->oobsize; | ||
2325 | this->page_buf = kmalloc(len, GFP_KERNEL); | ||
2326 | if (!this->page_buf) { | 2336 | if (!this->page_buf) { |
2327 | printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n"); | 2337 | printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n"); |
2328 | return -ENOMEM; | 2338 | return -ENOMEM; |
2329 | } | 2339 | } |
2330 | this->options |= ONENAND_PAGEBUF_ALLOC; | 2340 | this->options |= ONENAND_PAGEBUF_ALLOC; |
2331 | } | 2341 | } |
2342 | if (!this->oob_buf) { | ||
2343 | this->oob_buf = kzalloc(mtd->oobsize, GFP_KERNEL); | ||
2344 | if (!this->oob_buf) { | ||
2345 | printk(KERN_ERR "onenand_scan(): Can't allocate oob_buf\n"); | ||
2346 | if (this->options & ONENAND_PAGEBUF_ALLOC) { | ||
2347 | this->options &= ~ONENAND_PAGEBUF_ALLOC; | ||
2348 | kfree(this->page_buf); | ||
2349 | } | ||
2350 | return -ENOMEM; | ||
2351 | } | ||
2352 | this->options |= ONENAND_OOBBUF_ALLOC; | ||
2353 | } | ||
2332 | 2354 | ||
2333 | this->state = FL_READY; | 2355 | this->state = FL_READY; |
2334 | init_waitqueue_head(&this->wq); | 2356 | init_waitqueue_head(&this->wq); |
@@ -2367,6 +2389,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) | |||
2367 | for (i = 0; this->ecclayout->oobfree[i].length; i++) | 2389 | for (i = 0; this->ecclayout->oobfree[i].length; i++) |
2368 | this->ecclayout->oobavail += | 2390 | this->ecclayout->oobavail += |
2369 | this->ecclayout->oobfree[i].length; | 2391 | this->ecclayout->oobfree[i].length; |
2392 | mtd->oobavail = this->ecclayout->oobavail; | ||
2370 | 2393 | ||
2371 | mtd->ecclayout = this->ecclayout; | 2394 | mtd->ecclayout = this->ecclayout; |
2372 | 2395 | ||
@@ -2424,9 +2447,11 @@ void onenand_release(struct mtd_info *mtd) | |||
2424 | kfree(bbm->bbt); | 2447 | kfree(bbm->bbt); |
2425 | kfree(this->bbm); | 2448 | kfree(this->bbm); |
2426 | } | 2449 | } |
2427 | /* Buffer allocated by onenand_scan */ | 2450 | /* Buffers allocated by onenand_scan */ |
2428 | if (this->options & ONENAND_PAGEBUF_ALLOC) | 2451 | if (this->options & ONENAND_PAGEBUF_ALLOC) |
2429 | kfree(this->page_buf); | 2452 | kfree(this->page_buf); |
2453 | if (this->options & ONENAND_OOBBUF_ALLOC) | ||
2454 | kfree(this->oob_buf); | ||
2430 | } | 2455 | } |
2431 | 2456 | ||
2432 | EXPORT_SYMBOL_GPL(onenand_scan); | 2457 | EXPORT_SYMBOL_GPL(onenand_scan); |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 72995777f809..b406ecfa7268 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -858,19 +858,7 @@ static struct eisa_device_id vortex_eisa_ids[] = { | |||
858 | }; | 858 | }; |
859 | MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids); | 859 | MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids); |
860 | 860 | ||
861 | static int vortex_eisa_probe(struct device *device); | 861 | static int __init vortex_eisa_probe(struct device *device) |
862 | static int vortex_eisa_remove(struct device *device); | ||
863 | |||
864 | static struct eisa_driver vortex_eisa_driver = { | ||
865 | .id_table = vortex_eisa_ids, | ||
866 | .driver = { | ||
867 | .name = "3c59x", | ||
868 | .probe = vortex_eisa_probe, | ||
869 | .remove = vortex_eisa_remove | ||
870 | } | ||
871 | }; | ||
872 | |||
873 | static int vortex_eisa_probe(struct device *device) | ||
874 | { | 862 | { |
875 | void __iomem *ioaddr; | 863 | void __iomem *ioaddr; |
876 | struct eisa_device *edev; | 864 | struct eisa_device *edev; |
@@ -893,7 +881,7 @@ static int vortex_eisa_probe(struct device *device) | |||
893 | return 0; | 881 | return 0; |
894 | } | 882 | } |
895 | 883 | ||
896 | static int vortex_eisa_remove(struct device *device) | 884 | static int __devexit vortex_eisa_remove(struct device *device) |
897 | { | 885 | { |
898 | struct eisa_device *edev; | 886 | struct eisa_device *edev; |
899 | struct net_device *dev; | 887 | struct net_device *dev; |
@@ -918,7 +906,17 @@ static int vortex_eisa_remove(struct device *device) | |||
918 | free_netdev(dev); | 906 | free_netdev(dev); |
919 | return 0; | 907 | return 0; |
920 | } | 908 | } |
921 | #endif | 909 | |
910 | static struct eisa_driver vortex_eisa_driver = { | ||
911 | .id_table = vortex_eisa_ids, | ||
912 | .driver = { | ||
913 | .name = "3c59x", | ||
914 | .probe = vortex_eisa_probe, | ||
915 | .remove = __devexit_p(vortex_eisa_remove) | ||
916 | } | ||
917 | }; | ||
918 | |||
919 | #endif /* CONFIG_EISA */ | ||
922 | 920 | ||
923 | /* returns count found (>= 0), or negative on error */ | 921 | /* returns count found (>= 0), or negative on error */ |
924 | static int __init vortex_eisa_init(void) | 922 | static int __init vortex_eisa_init(void) |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 9ba21e0f27c5..1ee27c360a4b 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -787,6 +787,12 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
787 | unsigned int size; | 787 | unsigned int size; |
788 | int err; | 788 | int err; |
789 | 789 | ||
790 | /* Clear any pending ethernet port interrupts */ | ||
791 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0); | ||
792 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0); | ||
793 | /* wait for previous write to complete */ | ||
794 | mv_read (MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num)); | ||
795 | |||
790 | err = request_irq(dev->irq, mv643xx_eth_int_handler, | 796 | err = request_irq(dev->irq, mv643xx_eth_int_handler, |
791 | IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); | 797 | IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); |
792 | if (err) { | 798 | if (err) { |
@@ -875,10 +881,6 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
875 | 881 | ||
876 | mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */ | 882 | mv643xx_eth_rx_refill_descs(dev); /* Fill RX ring with skb's */ |
877 | 883 | ||
878 | /* Clear any pending ethernet port interrupts */ | ||
879 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0); | ||
880 | mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0); | ||
881 | |||
882 | eth_port_start(dev); | 884 | eth_port_start(dev); |
883 | 885 | ||
884 | /* Interrupt Coalescing */ | 886 | /* Interrupt Coalescing */ |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index b05dc6ed7fb7..ac02b3b60f92 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -181,6 +181,7 @@ struct myri10ge_priv { | |||
181 | int intr_coal_delay; | 181 | int intr_coal_delay; |
182 | __be32 __iomem *intr_coal_delay_ptr; | 182 | __be32 __iomem *intr_coal_delay_ptr; |
183 | int mtrr; | 183 | int mtrr; |
184 | int wc_enabled; | ||
184 | int wake_queue; | 185 | int wake_queue; |
185 | int stop_queue; | 186 | int stop_queue; |
186 | int down_cnt; | 187 | int down_cnt; |
@@ -717,6 +718,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
717 | int status; | 718 | int status; |
718 | size_t bytes; | 719 | size_t bytes; |
719 | u32 len; | 720 | u32 len; |
721 | struct page *dmatest_page; | ||
722 | dma_addr_t dmatest_bus; | ||
720 | 723 | ||
721 | /* try to send a reset command to the card to see if it | 724 | /* try to send a reset command to the card to see if it |
722 | * is alive */ | 725 | * is alive */ |
@@ -726,6 +729,11 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
726 | dev_err(&mgp->pdev->dev, "failed reset\n"); | 729 | dev_err(&mgp->pdev->dev, "failed reset\n"); |
727 | return -ENXIO; | 730 | return -ENXIO; |
728 | } | 731 | } |
732 | dmatest_page = alloc_page(GFP_KERNEL); | ||
733 | if (!dmatest_page) | ||
734 | return -ENOMEM; | ||
735 | dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE, | ||
736 | DMA_BIDIRECTIONAL); | ||
729 | 737 | ||
730 | /* Now exchange information about interrupts */ | 738 | /* Now exchange information about interrupts */ |
731 | 739 | ||
@@ -764,8 +772,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
764 | 772 | ||
765 | len = mgp->tx.boundary; | 773 | len = mgp->tx.boundary; |
766 | 774 | ||
767 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); | 775 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); |
768 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); | 776 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); |
769 | cmd.data2 = len * 0x10000; | 777 | cmd.data2 = len * 0x10000; |
770 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); | 778 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); |
771 | if (status == 0) | 779 | if (status == 0) |
@@ -774,8 +782,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
774 | else | 782 | else |
775 | dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n", | 783 | dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n", |
776 | status); | 784 | status); |
777 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); | 785 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); |
778 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); | 786 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); |
779 | cmd.data2 = len * 0x1; | 787 | cmd.data2 = len * 0x1; |
780 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); | 788 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); |
781 | if (status == 0) | 789 | if (status == 0) |
@@ -785,8 +793,8 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
785 | dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n", | 793 | dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n", |
786 | status); | 794 | status); |
787 | 795 | ||
788 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus); | 796 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus); |
789 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus); | 797 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus); |
790 | cmd.data2 = len * 0x10001; | 798 | cmd.data2 = len * 0x10001; |
791 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); | 799 | status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0); |
792 | if (status == 0) | 800 | if (status == 0) |
@@ -796,6 +804,9 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
796 | dev_warn(&mgp->pdev->dev, | 804 | dev_warn(&mgp->pdev->dev, |
797 | "DMA read/write benchmark failed: %d\n", status); | 805 | "DMA read/write benchmark failed: %d\n", status); |
798 | 806 | ||
807 | pci_unmap_page(mgp->pdev, dmatest_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
808 | put_page(dmatest_page); | ||
809 | |||
799 | memset(mgp->rx_done.entry, 0, bytes); | 810 | memset(mgp->rx_done.entry, 0, bytes); |
800 | 811 | ||
801 | /* reset mcp/driver shared state back to 0 */ | 812 | /* reset mcp/driver shared state back to 0 */ |
@@ -1375,7 +1386,7 @@ myri10ge_get_ethtool_stats(struct net_device *netdev, | |||
1375 | data[i] = ((unsigned long *)&mgp->stats)[i]; | 1386 | data[i] = ((unsigned long *)&mgp->stats)[i]; |
1376 | 1387 | ||
1377 | data[i++] = (unsigned int)mgp->tx.boundary; | 1388 | data[i++] = (unsigned int)mgp->tx.boundary; |
1378 | data[i++] = (unsigned int)(mgp->mtrr >= 0); | 1389 | data[i++] = (unsigned int)mgp->wc_enabled; |
1379 | data[i++] = (unsigned int)mgp->pdev->irq; | 1390 | data[i++] = (unsigned int)mgp->pdev->irq; |
1380 | data[i++] = (unsigned int)mgp->msi_enabled; | 1391 | data[i++] = (unsigned int)mgp->msi_enabled; |
1381 | data[i++] = (unsigned int)mgp->read_dma; | 1392 | data[i++] = (unsigned int)mgp->read_dma; |
@@ -1456,6 +1467,8 @@ static int myri10ge_allocate_rings(struct net_device *dev) | |||
1456 | status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0); | 1467 | status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0); |
1457 | tx_ring_size = cmd.data0; | 1468 | tx_ring_size = cmd.data0; |
1458 | status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0); | 1469 | status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0); |
1470 | if (status != 0) | ||
1471 | return status; | ||
1459 | rx_ring_size = cmd.data0; | 1472 | rx_ring_size = cmd.data0; |
1460 | 1473 | ||
1461 | tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send); | 1474 | tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send); |
@@ -1463,6 +1476,8 @@ static int myri10ge_allocate_rings(struct net_device *dev) | |||
1463 | mgp->tx.mask = tx_ring_entries - 1; | 1476 | mgp->tx.mask = tx_ring_entries - 1; |
1464 | mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1; | 1477 | mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1; |
1465 | 1478 | ||
1479 | status = -ENOMEM; | ||
1480 | |||
1466 | /* allocate the host shadow rings */ | 1481 | /* allocate the host shadow rings */ |
1467 | 1482 | ||
1468 | bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4) | 1483 | bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4) |
@@ -1735,7 +1750,7 @@ static int myri10ge_open(struct net_device *dev) | |||
1735 | goto abort_with_irq; | 1750 | goto abort_with_irq; |
1736 | } | 1751 | } |
1737 | 1752 | ||
1738 | if (myri10ge_wcfifo && mgp->mtrr >= 0) { | 1753 | if (myri10ge_wcfifo && mgp->wc_enabled) { |
1739 | mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4; | 1754 | mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4; |
1740 | mgp->rx_small.wc_fifo = | 1755 | mgp->rx_small.wc_fifo = |
1741 | (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL; | 1756 | (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL; |
@@ -2510,6 +2525,12 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | |||
2510 | bridge->vendor, bridge->device); | 2525 | bridge->vendor, bridge->device); |
2511 | mgp->tx.boundary = 4096; | 2526 | mgp->tx.boundary = 4096; |
2512 | mgp->fw_name = myri10ge_fw_aligned; | 2527 | mgp->fw_name = myri10ge_fw_aligned; |
2528 | } else if (bridge && | ||
2529 | bridge->vendor == PCI_VENDOR_ID_SGI && | ||
2530 | bridge->device == 0x4002 /* TIOCE pcie-port */ ) { | ||
2531 | /* this pcie bridge does not support 4K rdma request */ | ||
2532 | mgp->tx.boundary = 2048; | ||
2533 | mgp->fw_name = myri10ge_fw_aligned; | ||
2513 | } | 2534 | } |
2514 | } else { | 2535 | } else { |
2515 | if (myri10ge_force_firmware == 1) { | 2536 | if (myri10ge_force_firmware == 1) { |
@@ -2830,9 +2851,12 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2830 | mgp->board_span = pci_resource_len(pdev, 0); | 2851 | mgp->board_span = pci_resource_len(pdev, 0); |
2831 | mgp->iomem_base = pci_resource_start(pdev, 0); | 2852 | mgp->iomem_base = pci_resource_start(pdev, 0); |
2832 | mgp->mtrr = -1; | 2853 | mgp->mtrr = -1; |
2854 | mgp->wc_enabled = 0; | ||
2833 | #ifdef CONFIG_MTRR | 2855 | #ifdef CONFIG_MTRR |
2834 | mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span, | 2856 | mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span, |
2835 | MTRR_TYPE_WRCOMB, 1); | 2857 | MTRR_TYPE_WRCOMB, 1); |
2858 | if (mgp->mtrr >= 0) | ||
2859 | mgp->wc_enabled = 1; | ||
2836 | #endif | 2860 | #endif |
2837 | /* Hack. need to get rid of these magic numbers */ | 2861 | /* Hack. need to get rid of these magic numbers */ |
2838 | mgp->sram_size = | 2862 | mgp->sram_size = |
@@ -2927,7 +2951,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2927 | dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", | 2951 | dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", |
2928 | (mgp->msi_enabled ? "MSI" : "xPIC"), | 2952 | (mgp->msi_enabled ? "MSI" : "xPIC"), |
2929 | netdev->irq, mgp->tx.boundary, mgp->fw_name, | 2953 | netdev->irq, mgp->tx.boundary, mgp->fw_name, |
2930 | (mgp->mtrr >= 0 ? "Enabled" : "Disabled")); | 2954 | (mgp->wc_enabled ? "Enabled" : "Disabled")); |
2931 | 2955 | ||
2932 | return 0; | 2956 | return 0; |
2933 | 2957 | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index a2877f33fa85..1be55702557d 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -228,7 +228,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
228 | &adapter->ctx_desc_pdev); | 228 | &adapter->ctx_desc_pdev); |
229 | 229 | ||
230 | printk("ctx_desc_phys_addr: 0x%llx\n", | 230 | printk("ctx_desc_phys_addr: 0x%llx\n", |
231 | (u64) adapter->ctx_desc_phys_addr); | 231 | (unsigned long long) adapter->ctx_desc_phys_addr); |
232 | if (addr == NULL) { | 232 | if (addr == NULL) { |
233 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); | 233 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); |
234 | err = -ENOMEM; | 234 | err = -ENOMEM; |
@@ -247,7 +247,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
247 | adapter->max_tx_desc_count, | 247 | adapter->max_tx_desc_count, |
248 | (dma_addr_t *) & hw->cmd_desc_phys_addr, | 248 | (dma_addr_t *) & hw->cmd_desc_phys_addr, |
249 | &adapter->ahw.cmd_desc_pdev); | 249 | &adapter->ahw.cmd_desc_pdev); |
250 | printk("cmd_desc_phys_addr: 0x%llx\n", (u64) hw->cmd_desc_phys_addr); | 250 | printk("cmd_desc_phys_addr: 0x%llx\n", |
251 | (unsigned long long) hw->cmd_desc_phys_addr); | ||
251 | 252 | ||
252 | if (addr == NULL) { | 253 | if (addr == NULL) { |
253 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); | 254 | DPRINTK(ERR, "bad return from pci_alloc_consistent\n"); |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 15d954e50cae..521b5f0618a4 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -572,8 +572,8 @@ static void rtl8169_xmii_reset_enable(void __iomem *ioaddr) | |||
572 | { | 572 | { |
573 | unsigned int val; | 573 | unsigned int val; |
574 | 574 | ||
575 | mdio_write(ioaddr, MII_BMCR, BMCR_RESET); | 575 | val = mdio_read(ioaddr, MII_BMCR) | BMCR_RESET; |
576 | val = mdio_read(ioaddr, MII_BMCR); | 576 | mdio_write(ioaddr, MII_BMCR, val & 0xffff); |
577 | } | 577 | } |
578 | 578 | ||
579 | static void rtl8169_check_link_status(struct net_device *dev, | 579 | static void rtl8169_check_link_status(struct net_device *dev, |
@@ -1368,11 +1368,7 @@ static inline void rtl8169_request_timer(struct net_device *dev) | |||
1368 | (tp->phy_version >= RTL_GIGA_PHY_VER_H)) | 1368 | (tp->phy_version >= RTL_GIGA_PHY_VER_H)) |
1369 | return; | 1369 | return; |
1370 | 1370 | ||
1371 | init_timer(timer); | 1371 | mod_timer(timer, jiffies + RTL8169_PHY_TIMEOUT); |
1372 | timer->expires = jiffies + RTL8169_PHY_TIMEOUT; | ||
1373 | timer->data = (unsigned long)(dev); | ||
1374 | timer->function = rtl8169_phy_timer; | ||
1375 | add_timer(timer); | ||
1376 | } | 1372 | } |
1377 | 1373 | ||
1378 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1374 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -1685,6 +1681,10 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1685 | tp->mmio_addr = ioaddr; | 1681 | tp->mmio_addr = ioaddr; |
1686 | tp->align = rtl_cfg_info[ent->driver_data].align; | 1682 | tp->align = rtl_cfg_info[ent->driver_data].align; |
1687 | 1683 | ||
1684 | init_timer(&tp->timer); | ||
1685 | tp->timer.data = (unsigned long) dev; | ||
1686 | tp->timer.function = rtl8169_phy_timer; | ||
1687 | |||
1688 | spin_lock_init(&tp->lock); | 1688 | spin_lock_init(&tp->lock); |
1689 | 1689 | ||
1690 | rc = register_netdev(dev); | 1690 | rc = register_netdev(dev); |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 53839979cfb8..ab0ab92583fe 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -2165,9 +2165,27 @@ force_update: | |||
2165 | /* fall through */ | 2165 | /* fall through */ |
2166 | #endif | 2166 | #endif |
2167 | case OP_RXCHKS: | 2167 | case OP_RXCHKS: |
2168 | skb = sky2->rx_ring[sky2->rx_next].skb; | 2168 | if (!sky2->rx_csum) |
2169 | skb->ip_summed = CHECKSUM_COMPLETE; | 2169 | break; |
2170 | skb->csum = status & 0xffff; | 2170 | |
2171 | /* Both checksum counters are programmed to start at | ||
2172 | * the same offset, so unless there is a problem they | ||
2173 | * should match. This failure is an early indication that | ||
2174 | * hardware receive checksumming won't work. | ||
2175 | */ | ||
2176 | if (likely(status >> 16 == (status & 0xffff))) { | ||
2177 | skb = sky2->rx_ring[sky2->rx_next].skb; | ||
2178 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
2179 | skb->csum = status & 0xffff; | ||
2180 | } else { | ||
2181 | printk(KERN_NOTICE PFX "%s: hardware receive " | ||
2182 | "checksum problem (status = %#x)\n", | ||
2183 | dev->name, status); | ||
2184 | sky2->rx_csum = 0; | ||
2185 | sky2_write32(sky2->hw, | ||
2186 | Q_ADDR(rxqaddr[le->link], Q_CSR), | ||
2187 | BMU_DIS_RX_CHKSUM); | ||
2188 | } | ||
2171 | break; | 2189 | break; |
2172 | 2190 | ||
2173 | case OP_TXINDEXLE: | 2191 | case OP_TXINDEXLE: |
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c index 0d97e10ccac5..36202e94ee91 100644 --- a/drivers/net/tokenring/ibmtr.c +++ b/drivers/net/tokenring/ibmtr.c | |||
@@ -186,7 +186,6 @@ static char __devinit *adapter_def(char type) | |||
186 | #define TRC_INITV 0x02 /* verbose init trace points */ | 186 | #define TRC_INITV 0x02 /* verbose init trace points */ |
187 | static unsigned char ibmtr_debug_trace = 0; | 187 | static unsigned char ibmtr_debug_trace = 0; |
188 | 188 | ||
189 | static int ibmtr_probe(struct net_device *dev); | ||
190 | static int ibmtr_probe1(struct net_device *dev, int ioaddr); | 189 | static int ibmtr_probe1(struct net_device *dev, int ioaddr); |
191 | static unsigned char get_sram_size(struct tok_info *adapt_info); | 190 | static unsigned char get_sram_size(struct tok_info *adapt_info); |
192 | static int trdev_init(struct net_device *dev); | 191 | static int trdev_init(struct net_device *dev); |
@@ -335,17 +334,6 @@ static void ibmtr_cleanup_card(struct net_device *dev) | |||
335 | #endif | 334 | #endif |
336 | } | 335 | } |
337 | 336 | ||
338 | int ibmtr_probe_card(struct net_device *dev) | ||
339 | { | ||
340 | int err = ibmtr_probe(dev); | ||
341 | if (!err) { | ||
342 | err = register_netdev(dev); | ||
343 | if (err) | ||
344 | ibmtr_cleanup_card(dev); | ||
345 | } | ||
346 | return err; | ||
347 | } | ||
348 | |||
349 | /**************************************************************************** | 337 | /**************************************************************************** |
350 | * ibmtr_probe(): Routine specified in the network device structure | 338 | * ibmtr_probe(): Routine specified in the network device structure |
351 | * to probe for an IBM Token Ring Adapter. Routine outline: | 339 | * to probe for an IBM Token Ring Adapter. Routine outline: |
@@ -358,7 +346,7 @@ int ibmtr_probe_card(struct net_device *dev) | |||
358 | * which references it. | 346 | * which references it. |
359 | ****************************************************************************/ | 347 | ****************************************************************************/ |
360 | 348 | ||
361 | static int ibmtr_probe(struct net_device *dev) | 349 | static int __init ibmtr_probe(struct net_device *dev) |
362 | { | 350 | { |
363 | int i; | 351 | int i; |
364 | int base_addr = dev->base_addr; | 352 | int base_addr = dev->base_addr; |
@@ -378,6 +366,17 @@ static int ibmtr_probe(struct net_device *dev) | |||
378 | return -ENODEV; | 366 | return -ENODEV; |
379 | } | 367 | } |
380 | 368 | ||
369 | int __init ibmtr_probe_card(struct net_device *dev) | ||
370 | { | ||
371 | int err = ibmtr_probe(dev); | ||
372 | if (!err) { | ||
373 | err = register_netdev(dev); | ||
374 | if (err) | ||
375 | ibmtr_cleanup_card(dev); | ||
376 | } | ||
377 | return err; | ||
378 | } | ||
379 | |||
381 | /*****************************************************************************/ | 380 | /*****************************************************************************/ |
382 | 381 | ||
383 | static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) | 382 | static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index ebbda1d8f542..f3a972e74e9a 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -30,8 +30,8 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define DRV_NAME "via-rhine" | 32 | #define DRV_NAME "via-rhine" |
33 | #define DRV_VERSION "1.4.2" | 33 | #define DRV_VERSION "1.4.3" |
34 | #define DRV_RELDATE "Sept-11-2006" | 34 | #define DRV_RELDATE "2007-03-06" |
35 | 35 | ||
36 | 36 | ||
37 | /* A few user-configurable values. | 37 | /* A few user-configurable values. |
@@ -105,6 +105,7 @@ static const int multicast_filter_limit = 32; | |||
105 | #include <asm/io.h> | 105 | #include <asm/io.h> |
106 | #include <asm/irq.h> | 106 | #include <asm/irq.h> |
107 | #include <asm/uaccess.h> | 107 | #include <asm/uaccess.h> |
108 | #include <linux/dmi.h> | ||
108 | 109 | ||
109 | /* These identify the driver base version and may not be removed. */ | 110 | /* These identify the driver base version and may not be removed. */ |
110 | static char version[] __devinitdata = | 111 | static char version[] __devinitdata = |
@@ -1995,6 +1996,23 @@ static struct pci_driver rhine_driver = { | |||
1995 | .shutdown = rhine_shutdown, | 1996 | .shutdown = rhine_shutdown, |
1996 | }; | 1997 | }; |
1997 | 1998 | ||
1999 | static struct dmi_system_id __initdata rhine_dmi_table[] = { | ||
2000 | { | ||
2001 | .ident = "EPIA-M", | ||
2002 | .matches = { | ||
2003 | DMI_MATCH(DMI_BIOS_VENDOR, "Award Software International, Inc."), | ||
2004 | DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"), | ||
2005 | }, | ||
2006 | }, | ||
2007 | { | ||
2008 | .ident = "KV7", | ||
2009 | .matches = { | ||
2010 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"), | ||
2011 | DMI_MATCH(DMI_BIOS_VERSION, "6.00 PG"), | ||
2012 | }, | ||
2013 | }, | ||
2014 | { NULL } | ||
2015 | }; | ||
1998 | 2016 | ||
1999 | static int __init rhine_init(void) | 2017 | static int __init rhine_init(void) |
2000 | { | 2018 | { |
@@ -2002,6 +2020,16 @@ static int __init rhine_init(void) | |||
2002 | #ifdef MODULE | 2020 | #ifdef MODULE |
2003 | printk(version); | 2021 | printk(version); |
2004 | #endif | 2022 | #endif |
2023 | if (dmi_check_system(rhine_dmi_table)) { | ||
2024 | /* these BIOSes fail at PXE boot if chip is in D3 */ | ||
2025 | avoid_D3 = 1; | ||
2026 | printk(KERN_WARNING "%s: Broken BIOS detected, avoid_D3 " | ||
2027 | "enabled.\n", | ||
2028 | DRV_NAME); | ||
2029 | } | ||
2030 | else if (avoid_D3) | ||
2031 | printk(KERN_INFO "%s: avoid_D3 set.\n", DRV_NAME); | ||
2032 | |||
2005 | return pci_register_driver(&rhine_driver); | 2033 | return pci_register_driver(&rhine_driver); |
2006 | } | 2034 | } |
2007 | 2035 | ||
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c index 8dbcf83bb5f3..8b4540bfc1b0 100644 --- a/drivers/net/wan/z85230.c +++ b/drivers/net/wan/z85230.c | |||
@@ -407,7 +407,7 @@ static void z8530_tx(struct z8530_channel *c) | |||
407 | while(c->txcount) { | 407 | while(c->txcount) { |
408 | /* FIFO full ? */ | 408 | /* FIFO full ? */ |
409 | if(!(read_zsreg(c, R0)&4)) | 409 | if(!(read_zsreg(c, R0)&4)) |
410 | break; | 410 | return; |
411 | c->txcount--; | 411 | c->txcount--; |
412 | /* | 412 | /* |
413 | * Shovel out the byte | 413 | * Shovel out the byte |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index e594af46ff05..80cb88eb98c6 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -1858,9 +1858,6 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id) | |||
1858 | 1858 | ||
1859 | spin_lock(&bcm->irq_lock); | 1859 | spin_lock(&bcm->irq_lock); |
1860 | 1860 | ||
1861 | assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED); | ||
1862 | assert(bcm->current_core->id == BCM43xx_COREID_80211); | ||
1863 | |||
1864 | reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); | 1861 | reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); |
1865 | if (reason == 0xffffffff) { | 1862 | if (reason == 0xffffffff) { |
1866 | /* irq not for us (shared irq) */ | 1863 | /* irq not for us (shared irq) */ |
@@ -1871,6 +1868,9 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id) | |||
1871 | if (!reason) | 1868 | if (!reason) |
1872 | goto out; | 1869 | goto out; |
1873 | 1870 | ||
1871 | assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED); | ||
1872 | assert(bcm->current_core->id == BCM43xx_COREID_80211); | ||
1873 | |||
1874 | bcm->dma_reason[0] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA0_REASON) | 1874 | bcm->dma_reason[0] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA0_REASON) |
1875 | & 0x0001DC00; | 1875 | & 0x0001DC00; |
1876 | bcm->dma_reason[1] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA1_REASON) | 1876 | bcm->dma_reason[1] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA1_REASON) |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index 3a5c9c2b2150..cae89258a640 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -859,6 +859,11 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | |||
859 | bcm43xx_radio_write16(bcm, 0x005D, 0x0088); | 859 | bcm43xx_radio_write16(bcm, 0x005D, 0x0088); |
860 | bcm43xx_radio_write16(bcm, 0x005E, 0x0088); | 860 | bcm43xx_radio_write16(bcm, 0x005E, 0x0088); |
861 | bcm43xx_radio_write16(bcm, 0x007D, 0x0088); | 861 | bcm43xx_radio_write16(bcm, 0x007D, 0x0088); |
862 | bcm43xx_shm_write32(bcm, BCM43xx_SHM_SHARED, | ||
863 | BCM43xx_UCODEFLAGS_OFFSET, | ||
864 | (bcm43xx_shm_read32(bcm, BCM43xx_SHM_SHARED, | ||
865 | BCM43xx_UCODEFLAGS_OFFSET) | ||
866 | | 0x00000200)); | ||
862 | } | 867 | } |
863 | if (radio->revision == 8) { | 868 | if (radio->revision == 8) { |
864 | bcm43xx_radio_write16(bcm, 0x0051, 0x0000); | 869 | bcm43xx_radio_write16(bcm, 0x0051, 0x0000); |
@@ -941,7 +946,8 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | |||
941 | bcm43xx_phy_write(bcm, 0x0038, 0x0668); | 946 | bcm43xx_phy_write(bcm, 0x0038, 0x0668); |
942 | bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF); | 947 | bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF); |
943 | if (radio->revision <= 5) | 948 | if (radio->revision <= 5) |
944 | bcm43xx_phy_write(bcm, 0x005D, bcm43xx_phy_read(bcm, 0x005D) | 0x0003); | 949 | bcm43xx_phy_write(bcm, 0x005D, (bcm43xx_phy_read(bcm, 0x005D) |
950 | & 0xFF80) | 0x0003); | ||
945 | if (radio->revision <= 2) | 951 | if (radio->revision <= 2) |
946 | bcm43xx_radio_write16(bcm, 0x005D, 0x000D); | 952 | bcm43xx_radio_write16(bcm, 0x005D, 0x000D); |
947 | 953 | ||
@@ -958,7 +964,7 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | |||
958 | bcm43xx_phy_write(bcm, 0x0016, 0x0410); | 964 | bcm43xx_phy_write(bcm, 0x0016, 0x0410); |
959 | bcm43xx_phy_write(bcm, 0x0017, 0x0820); | 965 | bcm43xx_phy_write(bcm, 0x0017, 0x0820); |
960 | bcm43xx_phy_write(bcm, 0x0062, 0x0007); | 966 | bcm43xx_phy_write(bcm, 0x0062, 0x0007); |
961 | (void) bcm43xx_radio_calibrationvalue(bcm); | 967 | bcm43xx_radio_init2050(bcm); |
962 | bcm43xx_phy_lo_g_measure(bcm); | 968 | bcm43xx_phy_lo_g_measure(bcm); |
963 | if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) { | 969 | if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) { |
964 | bcm43xx_calc_nrssi_slope(bcm); | 970 | bcm43xx_calc_nrssi_slope(bcm); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 7b665e2386a8..d6d9413d7f23 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c | |||
@@ -105,18 +105,24 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev, | |||
105 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 105 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
106 | unsigned long flags; | 106 | unsigned long flags; |
107 | u8 channel; | 107 | u8 channel; |
108 | s8 expon; | ||
108 | int freq; | 109 | int freq; |
109 | int err = -EINVAL; | 110 | int err = -EINVAL; |
110 | 111 | ||
111 | mutex_lock(&bcm->mutex); | 112 | mutex_lock(&bcm->mutex); |
112 | spin_lock_irqsave(&bcm->irq_lock, flags); | 113 | spin_lock_irqsave(&bcm->irq_lock, flags); |
113 | 114 | ||
114 | if ((data->freq.m >= 0) && (data->freq.m <= 1000)) { | 115 | if ((data->freq.e == 0) && |
116 | (data->freq.m >= 0) && (data->freq.m <= 1000)) { | ||
115 | channel = data->freq.m; | 117 | channel = data->freq.m; |
116 | freq = bcm43xx_channel_to_freq(bcm, channel); | 118 | freq = bcm43xx_channel_to_freq(bcm, channel); |
117 | } else { | 119 | } else { |
118 | channel = bcm43xx_freq_to_channel(bcm, data->freq.m); | ||
119 | freq = data->freq.m; | 120 | freq = data->freq.m; |
121 | expon = 6 - data->freq.e; | ||
122 | while (--expon >= 0) /* scale down the frequency to MHz */ | ||
123 | freq /= 10; | ||
124 | assert(freq > 1000); | ||
125 | channel = bcm43xx_freq_to_channel(bcm, freq); | ||
120 | } | 126 | } |
121 | if (!ieee80211_is_valid_channel(bcm->ieee, channel)) | 127 | if (!ieee80211_is_valid_channel(bcm->ieee, channel)) |
122 | goto out_unlock; | 128 | goto out_unlock; |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index df495300ce3d..a32db0628157 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -757,7 +757,8 @@ int pci_enable_device(struct pci_dev *dev) | |||
757 | * when a device is enabled using managed PCI device enable interface. | 757 | * when a device is enabled using managed PCI device enable interface. |
758 | */ | 758 | */ |
759 | struct pci_devres { | 759 | struct pci_devres { |
760 | unsigned int disable:1; | 760 | unsigned int enabled:1; |
761 | unsigned int pinned:1; | ||
761 | unsigned int orig_intx:1; | 762 | unsigned int orig_intx:1; |
762 | unsigned int restore_intx:1; | 763 | unsigned int restore_intx:1; |
763 | u32 region_mask; | 764 | u32 region_mask; |
@@ -781,7 +782,7 @@ static void pcim_release(struct device *gendev, void *res) | |||
781 | if (this->restore_intx) | 782 | if (this->restore_intx) |
782 | pci_intx(dev, this->orig_intx); | 783 | pci_intx(dev, this->orig_intx); |
783 | 784 | ||
784 | if (this->disable) | 785 | if (this->enabled && !this->pinned) |
785 | pci_disable_device(dev); | 786 | pci_disable_device(dev); |
786 | } | 787 | } |
787 | 788 | ||
@@ -820,12 +821,12 @@ int pcim_enable_device(struct pci_dev *pdev) | |||
820 | dr = get_pci_dr(pdev); | 821 | dr = get_pci_dr(pdev); |
821 | if (unlikely(!dr)) | 822 | if (unlikely(!dr)) |
822 | return -ENOMEM; | 823 | return -ENOMEM; |
823 | WARN_ON(!!dr->disable); | 824 | WARN_ON(!!dr->enabled); |
824 | 825 | ||
825 | rc = pci_enable_device(pdev); | 826 | rc = pci_enable_device(pdev); |
826 | if (!rc) { | 827 | if (!rc) { |
827 | pdev->is_managed = 1; | 828 | pdev->is_managed = 1; |
828 | dr->disable = 1; | 829 | dr->enabled = 1; |
829 | } | 830 | } |
830 | return rc; | 831 | return rc; |
831 | } | 832 | } |
@@ -843,9 +844,9 @@ void pcim_pin_device(struct pci_dev *pdev) | |||
843 | struct pci_devres *dr; | 844 | struct pci_devres *dr; |
844 | 845 | ||
845 | dr = find_pci_dr(pdev); | 846 | dr = find_pci_dr(pdev); |
846 | WARN_ON(!dr || !dr->disable); | 847 | WARN_ON(!dr || !dr->enabled); |
847 | if (dr) | 848 | if (dr) |
848 | dr->disable = 0; | 849 | dr->pinned = 1; |
849 | } | 850 | } |
850 | 851 | ||
851 | /** | 852 | /** |
@@ -876,7 +877,7 @@ pci_disable_device(struct pci_dev *dev) | |||
876 | 877 | ||
877 | dr = find_pci_dr(dev); | 878 | dr = find_pci_dr(dev); |
878 | if (dr) | 879 | if (dr) |
879 | dr->disable = 0; | 880 | dr->enabled = 0; |
880 | 881 | ||
881 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) | 882 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) |
882 | return; | 883 | return; |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index b164de050d4f..db6ad8e763ac 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
@@ -66,7 +66,7 @@ static struct pci_error_handlers aer_error_handlers = { | |||
66 | .resume = aer_error_resume, | 66 | .resume = aer_error_resume, |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static struct pcie_port_service_driver aerdrv = { | 69 | static struct pcie_port_service_driver aerdriver = { |
70 | .name = "aer", | 70 | .name = "aer", |
71 | .id_table = &aer_id[0], | 71 | .id_table = &aer_id[0], |
72 | 72 | ||
@@ -328,7 +328,7 @@ static void aer_error_resume(struct pci_dev *dev) | |||
328 | **/ | 328 | **/ |
329 | static int __init aer_service_init(void) | 329 | static int __init aer_service_init(void) |
330 | { | 330 | { |
331 | return pcie_port_service_register(&aerdrv); | 331 | return pcie_port_service_register(&aerdriver); |
332 | } | 332 | } |
333 | 333 | ||
334 | /** | 334 | /** |
@@ -338,7 +338,7 @@ static int __init aer_service_init(void) | |||
338 | **/ | 338 | **/ |
339 | static void __exit aer_service_exit(void) | 339 | static void __exit aer_service_exit(void) |
340 | { | 340 | { |
341 | pcie_port_service_unregister(&aerdrv); | 341 | pcie_port_service_unregister(&aerdriver); |
342 | } | 342 | } |
343 | 343 | ||
344 | module_init(aer_service_init); | 344 | module_init(aer_service_init); |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index f17e7ed2b2a5..0be5a0b30725 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -276,7 +276,7 @@ static struct pci_error_handlers pcie_portdrv_err_handler = { | |||
276 | .resume = pcie_portdrv_err_resume, | 276 | .resume = pcie_portdrv_err_resume, |
277 | }; | 277 | }; |
278 | 278 | ||
279 | static struct pci_driver pcie_portdrv = { | 279 | static struct pci_driver pcie_portdriver = { |
280 | .name = (char *)device_name, | 280 | .name = (char *)device_name, |
281 | .id_table = &port_pci_ids[0], | 281 | .id_table = &port_pci_ids[0], |
282 | 282 | ||
@@ -298,7 +298,7 @@ static int __init pcie_portdrv_init(void) | |||
298 | printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval); | 298 | printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval); |
299 | goto out; | 299 | goto out; |
300 | } | 300 | } |
301 | retval = pci_register_driver(&pcie_portdrv); | 301 | retval = pci_register_driver(&pcie_portdriver); |
302 | if (retval) | 302 | if (retval) |
303 | pcie_port_bus_unregister(); | 303 | pcie_port_bus_unregister(); |
304 | out: | 304 | out: |
@@ -307,7 +307,7 @@ static int __init pcie_portdrv_init(void) | |||
307 | 307 | ||
308 | static void __exit pcie_portdrv_exit(void) | 308 | static void __exit pcie_portdrv_exit(void) |
309 | { | 309 | { |
310 | pci_unregister_driver(&pcie_portdrv); | 310 | pci_unregister_driver(&pcie_portdriver); |
311 | pcie_port_bus_unregister(); | 311 | pcie_port_bus_unregister(); |
312 | } | 312 | } |
313 | 313 | ||
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index ff98eaddaa73..2dd8681d6b31 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | DECLARE_RWSEM(pci_bus_sem); | 16 | DECLARE_RWSEM(pci_bus_sem); |
17 | 17 | ||
18 | static struct pci_bus * __devinit | 18 | static struct pci_bus * |
19 | pci_do_find_bus(struct pci_bus* bus, unsigned char busnr) | 19 | pci_do_find_bus(struct pci_bus* bus, unsigned char busnr) |
20 | { | 20 | { |
21 | struct pci_bus* child; | 21 | struct pci_bus* child; |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 7a535542fe92..118ac9779b3c 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -89,6 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, | |||
89 | return; | 89 | return; |
90 | 90 | ||
91 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 91 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
92 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); | ||
92 | irq = acpi_register_gsi(gsi, triggering, polarity); | 93 | irq = acpi_register_gsi(gsi, triggering, polarity); |
93 | if (irq < 0) { | 94 | if (irq < 0) { |
94 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; | 95 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; |
@@ -103,8 +104,52 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, | |||
103 | pcibios_penalize_isa_irq(irq, 1); | 104 | pcibios_penalize_isa_irq(irq, 1); |
104 | } | 105 | } |
105 | 106 | ||
107 | static int dma_flags(int type, int bus_master, int transfer) | ||
108 | { | ||
109 | int flags = 0; | ||
110 | |||
111 | if (bus_master) | ||
112 | flags |= IORESOURCE_DMA_MASTER; | ||
113 | switch (type) { | ||
114 | case ACPI_COMPATIBILITY: | ||
115 | flags |= IORESOURCE_DMA_COMPATIBLE; | ||
116 | break; | ||
117 | case ACPI_TYPE_A: | ||
118 | flags |= IORESOURCE_DMA_TYPEA; | ||
119 | break; | ||
120 | case ACPI_TYPE_B: | ||
121 | flags |= IORESOURCE_DMA_TYPEB; | ||
122 | break; | ||
123 | case ACPI_TYPE_F: | ||
124 | flags |= IORESOURCE_DMA_TYPEF; | ||
125 | break; | ||
126 | default: | ||
127 | /* Set a default value ? */ | ||
128 | flags |= IORESOURCE_DMA_COMPATIBLE; | ||
129 | pnp_err("Invalid DMA type"); | ||
130 | } | ||
131 | switch (transfer) { | ||
132 | case ACPI_TRANSFER_8: | ||
133 | flags |= IORESOURCE_DMA_8BIT; | ||
134 | break; | ||
135 | case ACPI_TRANSFER_8_16: | ||
136 | flags |= IORESOURCE_DMA_8AND16BIT; | ||
137 | break; | ||
138 | case ACPI_TRANSFER_16: | ||
139 | flags |= IORESOURCE_DMA_16BIT; | ||
140 | break; | ||
141 | default: | ||
142 | /* Set a default value ? */ | ||
143 | flags |= IORESOURCE_DMA_8AND16BIT; | ||
144 | pnp_err("Invalid DMA transfer type"); | ||
145 | } | ||
146 | |||
147 | return flags; | ||
148 | } | ||
149 | |||
106 | static void | 150 | static void |
107 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) | 151 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma, |
152 | int type, int bus_master, int transfer) | ||
108 | { | 153 | { |
109 | int i = 0; | 154 | int i = 0; |
110 | while (i < PNP_MAX_DMA && | 155 | while (i < PNP_MAX_DMA && |
@@ -112,6 +157,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) | |||
112 | i++; | 157 | i++; |
113 | if (i < PNP_MAX_DMA) { | 158 | if (i < PNP_MAX_DMA) { |
114 | res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag | 159 | res->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag |
160 | res->dma_resource[i].flags |= dma_flags(type, bus_master, transfer); | ||
115 | if (dma == -1) { | 161 | if (dma == -1) { |
116 | res->dma_resource[i].flags |= IORESOURCE_DISABLED; | 162 | res->dma_resource[i].flags |= IORESOURCE_DISABLED; |
117 | return; | 163 | return; |
@@ -123,7 +169,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) | |||
123 | 169 | ||
124 | static void | 170 | static void |
125 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | 171 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, |
126 | u64 io, u64 len) | 172 | u64 io, u64 len, int io_decode) |
127 | { | 173 | { |
128 | int i = 0; | 174 | int i = 0; |
129 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && | 175 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && |
@@ -131,6 +177,8 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
131 | i++; | 177 | i++; |
132 | if (i < PNP_MAX_PORT) { | 178 | if (i < PNP_MAX_PORT) { |
133 | res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag | 179 | res->port_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag |
180 | if (io_decode == ACPI_DECODE_16) | ||
181 | res->port_resource[i].flags |= PNP_PORT_FLAG_16BITADDR; | ||
134 | if (len <= 0 || (io + len -1) >= 0x10003) { | 182 | if (len <= 0 || (io + len -1) >= 0x10003) { |
135 | res->port_resource[i].flags |= IORESOURCE_DISABLED; | 183 | res->port_resource[i].flags |= IORESOURCE_DISABLED; |
136 | return; | 184 | return; |
@@ -142,7 +190,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
142 | 190 | ||
143 | static void | 191 | static void |
144 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, | 192 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, |
145 | u64 mem, u64 len) | 193 | u64 mem, u64 len, int write_protect) |
146 | { | 194 | { |
147 | int i = 0; | 195 | int i = 0; |
148 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && | 196 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && |
@@ -154,6 +202,9 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, | |||
154 | res->mem_resource[i].flags |= IORESOURCE_DISABLED; | 202 | res->mem_resource[i].flags |= IORESOURCE_DISABLED; |
155 | return; | 203 | return; |
156 | } | 204 | } |
205 | if(write_protect == ACPI_READ_WRITE_MEMORY) | ||
206 | res->mem_resource[i].flags |= IORESOURCE_MEM_WRITEABLE; | ||
207 | |||
157 | res->mem_resource[i].start = mem; | 208 | res->mem_resource[i].start = mem; |
158 | res->mem_resource[i].end = mem + len - 1; | 209 | res->mem_resource[i].end = mem + len - 1; |
159 | } | 210 | } |
@@ -178,10 +229,11 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | |||
178 | 229 | ||
179 | if (p->resource_type == ACPI_MEMORY_RANGE) | 230 | if (p->resource_type == ACPI_MEMORY_RANGE) |
180 | pnpacpi_parse_allocated_memresource(res_table, | 231 | pnpacpi_parse_allocated_memresource(res_table, |
181 | p->minimum, p->address_length); | 232 | p->minimum, p->address_length, p->info.mem.write_protect); |
182 | else if (p->resource_type == ACPI_IO_RANGE) | 233 | else if (p->resource_type == ACPI_IO_RANGE) |
183 | pnpacpi_parse_allocated_ioresource(res_table, | 234 | pnpacpi_parse_allocated_ioresource(res_table, |
184 | p->minimum, p->address_length); | 235 | p->minimum, p->address_length, |
236 | p->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16); | ||
185 | } | 237 | } |
186 | 238 | ||
187 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 239 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
@@ -208,13 +260,17 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
208 | case ACPI_RESOURCE_TYPE_DMA: | 260 | case ACPI_RESOURCE_TYPE_DMA: |
209 | if (res->data.dma.channel_count > 0) | 261 | if (res->data.dma.channel_count > 0) |
210 | pnpacpi_parse_allocated_dmaresource(res_table, | 262 | pnpacpi_parse_allocated_dmaresource(res_table, |
211 | res->data.dma.channels[0]); | 263 | res->data.dma.channels[0], |
264 | res->data.dma.type, | ||
265 | res->data.dma.bus_master, | ||
266 | res->data.dma.transfer); | ||
212 | break; | 267 | break; |
213 | 268 | ||
214 | case ACPI_RESOURCE_TYPE_IO: | 269 | case ACPI_RESOURCE_TYPE_IO: |
215 | pnpacpi_parse_allocated_ioresource(res_table, | 270 | pnpacpi_parse_allocated_ioresource(res_table, |
216 | res->data.io.minimum, | 271 | res->data.io.minimum, |
217 | res->data.io.address_length); | 272 | res->data.io.address_length, |
273 | res->data.io.io_decode); | ||
218 | break; | 274 | break; |
219 | 275 | ||
220 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 276 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
@@ -224,7 +280,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
224 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 280 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
225 | pnpacpi_parse_allocated_ioresource(res_table, | 281 | pnpacpi_parse_allocated_ioresource(res_table, |
226 | res->data.fixed_io.address, | 282 | res->data.fixed_io.address, |
227 | res->data.fixed_io.address_length); | 283 | res->data.fixed_io.address_length, |
284 | ACPI_DECODE_10); | ||
228 | break; | 285 | break; |
229 | 286 | ||
230 | case ACPI_RESOURCE_TYPE_VENDOR: | 287 | case ACPI_RESOURCE_TYPE_VENDOR: |
@@ -236,17 +293,20 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
236 | case ACPI_RESOURCE_TYPE_MEMORY24: | 293 | case ACPI_RESOURCE_TYPE_MEMORY24: |
237 | pnpacpi_parse_allocated_memresource(res_table, | 294 | pnpacpi_parse_allocated_memresource(res_table, |
238 | res->data.memory24.minimum, | 295 | res->data.memory24.minimum, |
239 | res->data.memory24.address_length); | 296 | res->data.memory24.address_length, |
297 | res->data.memory24.write_protect); | ||
240 | break; | 298 | break; |
241 | case ACPI_RESOURCE_TYPE_MEMORY32: | 299 | case ACPI_RESOURCE_TYPE_MEMORY32: |
242 | pnpacpi_parse_allocated_memresource(res_table, | 300 | pnpacpi_parse_allocated_memresource(res_table, |
243 | res->data.memory32.minimum, | 301 | res->data.memory32.minimum, |
244 | res->data.memory32.address_length); | 302 | res->data.memory32.address_length, |
303 | res->data.memory32.write_protect); | ||
245 | break; | 304 | break; |
246 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 305 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
247 | pnpacpi_parse_allocated_memresource(res_table, | 306 | pnpacpi_parse_allocated_memresource(res_table, |
248 | res->data.fixed_memory32.address, | 307 | res->data.fixed_memory32.address, |
249 | res->data.fixed_memory32.address_length); | 308 | res->data.fixed_memory32.address_length, |
309 | res->data.fixed_memory32.write_protect); | ||
250 | break; | 310 | break; |
251 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 311 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
252 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 312 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
@@ -304,42 +364,8 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso | |||
304 | 364 | ||
305 | for(i = 0; i < p->channel_count; i++) | 365 | for(i = 0; i < p->channel_count; i++) |
306 | dma->map |= 1 << p->channels[i]; | 366 | dma->map |= 1 << p->channels[i]; |
307 | dma->flags = 0; | 367 | |
308 | if (p->bus_master) | 368 | dma->flags = dma_flags(p->type, p->bus_master, p->transfer); |
309 | dma->flags |= IORESOURCE_DMA_MASTER; | ||
310 | switch (p->type) { | ||
311 | case ACPI_COMPATIBILITY: | ||
312 | dma->flags |= IORESOURCE_DMA_COMPATIBLE; | ||
313 | break; | ||
314 | case ACPI_TYPE_A: | ||
315 | dma->flags |= IORESOURCE_DMA_TYPEA; | ||
316 | break; | ||
317 | case ACPI_TYPE_B: | ||
318 | dma->flags |= IORESOURCE_DMA_TYPEB; | ||
319 | break; | ||
320 | case ACPI_TYPE_F: | ||
321 | dma->flags |= IORESOURCE_DMA_TYPEF; | ||
322 | break; | ||
323 | default: | ||
324 | /* Set a default value ? */ | ||
325 | dma->flags |= IORESOURCE_DMA_COMPATIBLE; | ||
326 | pnp_err("Invalid DMA type"); | ||
327 | } | ||
328 | switch (p->transfer) { | ||
329 | case ACPI_TRANSFER_8: | ||
330 | dma->flags |= IORESOURCE_DMA_8BIT; | ||
331 | break; | ||
332 | case ACPI_TRANSFER_8_16: | ||
333 | dma->flags |= IORESOURCE_DMA_8AND16BIT; | ||
334 | break; | ||
335 | case ACPI_TRANSFER_16: | ||
336 | dma->flags |= IORESOURCE_DMA_16BIT; | ||
337 | break; | ||
338 | default: | ||
339 | /* Set a default value ? */ | ||
340 | dma->flags |= IORESOURCE_DMA_8AND16BIT; | ||
341 | pnp_err("Invalid DMA transfer type"); | ||
342 | } | ||
343 | 369 | ||
344 | pnp_register_dma_resource(option, dma); | 370 | pnp_register_dma_resource(option, dma); |
345 | return; | 371 | return; |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index d38a25f36ea5..31ae661e586a 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -332,9 +332,9 @@ static void acm_rx_tasklet(unsigned long _acm) | |||
332 | if (!ACM_READY(acm)) | 332 | if (!ACM_READY(acm)) |
333 | return; | 333 | return; |
334 | 334 | ||
335 | spin_lock(&acm->throttle_lock); | 335 | spin_lock_irqsave(&acm->throttle_lock, flags); |
336 | throttled = acm->throttle; | 336 | throttled = acm->throttle; |
337 | spin_unlock(&acm->throttle_lock); | 337 | spin_unlock_irqrestore(&acm->throttle_lock, flags); |
338 | if (throttled) | 338 | if (throttled) |
339 | return; | 339 | return; |
340 | 340 | ||
@@ -352,9 +352,9 @@ next_buffer: | |||
352 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); | 352 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); |
353 | 353 | ||
354 | tty_buffer_request_room(tty, buf->size); | 354 | tty_buffer_request_room(tty, buf->size); |
355 | spin_lock(&acm->throttle_lock); | 355 | spin_lock_irqsave(&acm->throttle_lock, flags); |
356 | throttled = acm->throttle; | 356 | throttled = acm->throttle; |
357 | spin_unlock(&acm->throttle_lock); | 357 | spin_unlock_irqrestore(&acm->throttle_lock, flags); |
358 | if (!throttled) | 358 | if (!throttled) |
359 | tty_insert_flip_string(tty, buf->base, buf->size); | 359 | tty_insert_flip_string(tty, buf->base, buf->size); |
360 | tty_flip_buffer_push(tty); | 360 | tty_flip_buffer_push(tty); |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 274f14f1633e..36e7a843bf91 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -912,7 +912,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
912 | struct async *as; | 912 | struct async *as; |
913 | struct usb_ctrlrequest *dr = NULL; | 913 | struct usb_ctrlrequest *dr = NULL; |
914 | unsigned int u, totlen, isofrmlen; | 914 | unsigned int u, totlen, isofrmlen; |
915 | int ret, interval = 0, ifnum = -1; | 915 | int ret, ifnum = -1; |
916 | 916 | ||
917 | if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK| | 917 | if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK| |
918 | URB_NO_FSBR|URB_ZERO_PACKET)) | 918 | URB_NO_FSBR|URB_ZERO_PACKET)) |
@@ -992,7 +992,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
992 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 992 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
993 | != USB_ENDPOINT_XFER_ISOC) | 993 | != USB_ENDPOINT_XFER_ISOC) |
994 | return -EINVAL; | 994 | return -EINVAL; |
995 | interval = 1 << min (15, ep->desc.bInterval - 1); | ||
996 | isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets; | 995 | isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets; |
997 | if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) | 996 | if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) |
998 | return -ENOMEM; | 997 | return -ENOMEM; |
@@ -1021,10 +1020,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1021 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 1020 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
1022 | != USB_ENDPOINT_XFER_INT) | 1021 | != USB_ENDPOINT_XFER_INT) |
1023 | return -EINVAL; | 1022 | return -EINVAL; |
1024 | if (ps->dev->speed == USB_SPEED_HIGH) | ||
1025 | interval = 1 << min (15, ep->desc.bInterval - 1); | ||
1026 | else | ||
1027 | interval = ep->desc.bInterval; | ||
1028 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) | 1023 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) |
1029 | return -EINVAL; | 1024 | return -EINVAL; |
1030 | if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length)) | 1025 | if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length)) |
@@ -1053,7 +1048,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1053 | as->urb->setup_packet = (unsigned char*)dr; | 1048 | as->urb->setup_packet = (unsigned char*)dr; |
1054 | as->urb->start_frame = uurb->start_frame; | 1049 | as->urb->start_frame = uurb->start_frame; |
1055 | as->urb->number_of_packets = uurb->number_of_packets; | 1050 | as->urb->number_of_packets = uurb->number_of_packets; |
1056 | as->urb->interval = interval; | 1051 | if (uurb->type == USBDEVFS_URB_TYPE_ISO || |
1052 | ps->dev->speed == USB_SPEED_HIGH) | ||
1053 | as->urb->interval = 1 << min(15, ep->desc.bInterval - 1); | ||
1054 | else | ||
1055 | as->urb->interval = ep->desc.bInterval; | ||
1057 | as->urb->context = as; | 1056 | as->urb->context = as; |
1058 | as->urb->complete = async_completed; | 1057 | as->urb->complete = async_completed; |
1059 | for (totlen = u = 0; u < uurb->number_of_packets; u++) { | 1058 | for (totlen = u = 0; u < uurb->number_of_packets; u++) { |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 41400743ce2c..b89a98e61323 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1281,12 +1281,6 @@ int usb_new_device(struct usb_device *udev) | |||
1281 | { | 1281 | { |
1282 | int err; | 1282 | int err; |
1283 | 1283 | ||
1284 | /* Lock ourself into memory in order to keep a probe sequence | ||
1285 | * sleeping in a new thread from allowing us to be unloaded. | ||
1286 | */ | ||
1287 | if (!try_module_get(THIS_MODULE)) | ||
1288 | return -EINVAL; | ||
1289 | |||
1290 | /* Determine quirks */ | 1284 | /* Determine quirks */ |
1291 | usb_detect_quirks(udev); | 1285 | usb_detect_quirks(udev); |
1292 | 1286 | ||
@@ -1390,7 +1384,6 @@ int usb_new_device(struct usb_device *udev) | |||
1390 | usb_autoresume_device(udev->parent); | 1384 | usb_autoresume_device(udev->parent); |
1391 | 1385 | ||
1392 | exit: | 1386 | exit: |
1393 | module_put(THIS_MODULE); | ||
1394 | return err; | 1387 | return err; |
1395 | 1388 | ||
1396 | fail: | 1389 | fail: |
@@ -2443,7 +2436,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
2443 | 2436 | ||
2444 | if (portchange & USB_PORT_STAT_C_CONNECTION) { | 2437 | if (portchange & USB_PORT_STAT_C_CONNECTION) { |
2445 | status = hub_port_debounce(hub, port1); | 2438 | status = hub_port_debounce(hub, port1); |
2446 | if (status < 0) { | 2439 | if (status < 0 && printk_ratelimit()) { |
2447 | dev_err (hub_dev, | 2440 | dev_err (hub_dev, |
2448 | "connect-debounce failed, port %d disabled\n", | 2441 | "connect-debounce failed, port %d disabled\n", |
2449 | port1); | 2442 | port1); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 2f17468b5c1e..217a3d6d0a06 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -221,10 +221,15 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, | |||
221 | 221 | ||
222 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 222 | if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
223 | USB_ENDPOINT_XFER_INT) { | 223 | USB_ENDPOINT_XFER_INT) { |
224 | int interval; | ||
225 | |||
226 | if (usb_dev->speed == USB_SPEED_HIGH) | ||
227 | interval = 1 << min(15, ep->desc.bInterval - 1); | ||
228 | else | ||
229 | interval = ep->desc.bInterval; | ||
224 | pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30); | 230 | pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30); |
225 | usb_fill_int_urb(urb, usb_dev, pipe, data, len, | 231 | usb_fill_int_urb(urb, usb_dev, pipe, data, len, |
226 | usb_api_blocking_completion, NULL, | 232 | usb_api_blocking_completion, NULL, interval); |
227 | ep->desc.bInterval); | ||
228 | } else | 233 | } else |
229 | usb_fill_bulk_urb(urb, usb_dev, pipe, data, len, | 234 | usb_fill_bulk_urb(urb, usb_dev, pipe, data, len, |
230 | usb_api_blocking_completion, NULL); | 235 | usb_api_blocking_completion, NULL); |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index a4677802fb20..2a6e3163d944 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1835,7 +1835,7 @@ static int at91udc_resume(struct platform_device *pdev) | |||
1835 | #define at91udc_resume NULL | 1835 | #define at91udc_resume NULL |
1836 | #endif | 1836 | #endif |
1837 | 1837 | ||
1838 | static struct platform_driver at91_udc = { | 1838 | static struct platform_driver at91_udc_driver = { |
1839 | .remove = __exit_p(at91udc_remove), | 1839 | .remove = __exit_p(at91udc_remove), |
1840 | .shutdown = at91udc_shutdown, | 1840 | .shutdown = at91udc_shutdown, |
1841 | .suspend = at91udc_suspend, | 1841 | .suspend = at91udc_suspend, |
@@ -1848,13 +1848,13 @@ static struct platform_driver at91_udc = { | |||
1848 | 1848 | ||
1849 | static int __init udc_init_module(void) | 1849 | static int __init udc_init_module(void) |
1850 | { | 1850 | { |
1851 | return platform_driver_probe(&at91_udc, at91udc_probe); | 1851 | return platform_driver_probe(&at91_udc_driver, at91udc_probe); |
1852 | } | 1852 | } |
1853 | module_init(udc_init_module); | 1853 | module_init(udc_init_module); |
1854 | 1854 | ||
1855 | static void __exit udc_exit_module(void) | 1855 | static void __exit udc_exit_module(void) |
1856 | { | 1856 | { |
1857 | platform_driver_unregister(&at91_udc); | 1857 | platform_driver_unregister(&at91_udc_driver); |
1858 | } | 1858 | } |
1859 | module_exit(udc_exit_module); | 1859 | module_exit(udc_exit_module); |
1860 | 1860 | ||
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index 7b3a326b57ab..65c91d3735de 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -297,27 +297,6 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
297 | 297 | ||
298 | /*-------------------------------------------------------------------------*/ | 298 | /*-------------------------------------------------------------------------*/ |
299 | 299 | ||
300 | #undef USE_KMALLOC | ||
301 | |||
302 | /* many common platforms have dma-coherent caches, which means that it's | ||
303 | * safe to use kmalloc() memory for all i/o buffers without using any | ||
304 | * cache flushing calls. (unless you're trying to share cache lines | ||
305 | * between dma and non-dma activities, which is a slow idea in any case.) | ||
306 | * | ||
307 | * other platforms need more care, with 2.6 having a moderately general | ||
308 | * solution except for the common "buffer is smaller than a page" case. | ||
309 | */ | ||
310 | #if defined(CONFIG_X86) | ||
311 | #define USE_KMALLOC | ||
312 | |||
313 | #elif defined(CONFIG_MIPS) && !defined(CONFIG_DMA_NONCOHERENT) | ||
314 | #define USE_KMALLOC | ||
315 | |||
316 | #elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) | ||
317 | #define USE_KMALLOC | ||
318 | |||
319 | #endif | ||
320 | |||
321 | /* allocating buffers this way eliminates dma mapping overhead, which | 300 | /* allocating buffers this way eliminates dma mapping overhead, which |
322 | * on some platforms will mean eliminating a per-io buffer copy. with | 301 | * on some platforms will mean eliminating a per-io buffer copy. with |
323 | * some kinds of system caches, further tweaks may still be needed. | 302 | * some kinds of system caches, further tweaks may still be needed. |
@@ -334,11 +313,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | |||
334 | return NULL; | 313 | return NULL; |
335 | *dma = DMA_ADDR_INVALID; | 314 | *dma = DMA_ADDR_INVALID; |
336 | 315 | ||
337 | #if defined(USE_KMALLOC) | ||
338 | retval = kmalloc(bytes, gfp_flags); | ||
339 | if (retval) | ||
340 | *dma = virt_to_phys(retval); | ||
341 | #else | ||
342 | if (ep->dma) { | 316 | if (ep->dma) { |
343 | /* the main problem with this call is that it wastes memory | 317 | /* the main problem with this call is that it wastes memory |
344 | * on typical 1/N page allocations: it allocates 1-N pages. | 318 | * on typical 1/N page allocations: it allocates 1-N pages. |
@@ -348,7 +322,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | |||
348 | bytes, dma, gfp_flags); | 322 | bytes, dma, gfp_flags); |
349 | } else | 323 | } else |
350 | retval = kmalloc(bytes, gfp_flags); | 324 | retval = kmalloc(bytes, gfp_flags); |
351 | #endif | ||
352 | return retval; | 325 | return retval; |
353 | } | 326 | } |
354 | 327 | ||
@@ -356,7 +329,6 @@ static void | |||
356 | goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) | 329 | goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) |
357 | { | 330 | { |
358 | /* free memory into the right allocator */ | 331 | /* free memory into the right allocator */ |
359 | #ifndef USE_KMALLOC | ||
360 | if (dma != DMA_ADDR_INVALID) { | 332 | if (dma != DMA_ADDR_INVALID) { |
361 | struct goku_ep *ep; | 333 | struct goku_ep *ep; |
362 | 334 | ||
@@ -365,7 +337,6 @@ goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) | |||
365 | return; | 337 | return; |
366 | dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma); | 338 | dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma); |
367 | } else | 339 | } else |
368 | #endif | ||
369 | kfree (buf); | 340 | kfree (buf); |
370 | } | 341 | } |
371 | 342 | ||
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index f01890dc8751..571f3ebb70ab 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -2616,7 +2616,7 @@ lubbock_fail0: | |||
2616 | if (retval != 0) { | 2616 | if (retval != 0) { |
2617 | printk(KERN_ERR "%s: can't get irq %i, err %d\n", | 2617 | printk(KERN_ERR "%s: can't get irq %i, err %d\n", |
2618 | driver_name, vbus_irq, retval); | 2618 | driver_name, vbus_irq, retval); |
2619 | free_irq(IRQ_USB, dev); | 2619 | free_irq(irq, dev); |
2620 | return -EBUSY; | 2620 | return -EBUSY; |
2621 | } | 2621 | } |
2622 | } | 2622 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 9af529d22b3e..1813b7cac294 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -653,8 +653,7 @@ static int ehci_hub_control ( | |||
653 | if (status & ~0xffff) /* only if wPortChange is interesting */ | 653 | if (status & ~0xffff) /* only if wPortChange is interesting */ |
654 | #endif | 654 | #endif |
655 | dbg_port (ehci, "GetStatus", wIndex + 1, temp); | 655 | dbg_port (ehci, "GetStatus", wIndex + 1, temp); |
656 | // we "know" this alignment is good, caller used kmalloc()... | 656 | put_unaligned(cpu_to_le32 (status), (__le32 *) buf); |
657 | *((__le32 *) buf) = cpu_to_le32 (status); | ||
658 | break; | 657 | break; |
659 | case SetHubFeature: | 658 | case SetHubFeature: |
660 | switch (wValue) { | 659 | switch (wValue) { |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index bacc25c53ba3..8e4427aebb14 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -33,6 +33,9 @@ static __u8 root_hub_hub_des[] = | |||
33 | /* status change bits: nonzero writes will clear */ | 33 | /* status change bits: nonzero writes will clear */ |
34 | #define RWC_BITS (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC) | 34 | #define RWC_BITS (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC) |
35 | 35 | ||
36 | /* suspend/resume bits: port suspended or port resuming */ | ||
37 | #define SUSPEND_BITS (USBPORTSC_SUSP | USBPORTSC_RD) | ||
38 | |||
36 | /* A port that either is connected or has a changed-bit set will prevent | 39 | /* A port that either is connected or has a changed-bit set will prevent |
37 | * us from AUTO_STOPPING. | 40 | * us from AUTO_STOPPING. |
38 | */ | 41 | */ |
@@ -96,8 +99,8 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, | |||
96 | int status; | 99 | int status; |
97 | int i; | 100 | int i; |
98 | 101 | ||
99 | if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) { | 102 | if (inw(port_addr) & SUSPEND_BITS) { |
100 | CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD); | 103 | CLR_RH_PORTSTAT(SUSPEND_BITS); |
101 | if (test_bit(port, &uhci->resuming_ports)) | 104 | if (test_bit(port, &uhci->resuming_ports)) |
102 | set_bit(port, &uhci->port_c_suspend); | 105 | set_bit(port, &uhci->port_c_suspend); |
103 | 106 | ||
@@ -107,7 +110,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, | |||
107 | * Experiments show that some controllers take longer, so | 110 | * Experiments show that some controllers take longer, so |
108 | * we'll poll for completion. */ | 111 | * we'll poll for completion. */ |
109 | for (i = 0; i < 10; ++i) { | 112 | for (i = 0; i < 10; ++i) { |
110 | if (!(inw(port_addr) & USBPORTSC_RD)) | 113 | if (!(inw(port_addr) & SUSPEND_BITS)) |
111 | break; | 114 | break; |
112 | udelay(1); | 115 | udelay(1); |
113 | } | 116 | } |
@@ -289,7 +292,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
289 | wPortStatus |= USB_PORT_STAT_CONNECTION; | 292 | wPortStatus |= USB_PORT_STAT_CONNECTION; |
290 | if (status & USBPORTSC_PE) { | 293 | if (status & USBPORTSC_PE) { |
291 | wPortStatus |= USB_PORT_STAT_ENABLE; | 294 | wPortStatus |= USB_PORT_STAT_ENABLE; |
292 | if (status & (USBPORTSC_SUSP | USBPORTSC_RD)) | 295 | if (status & SUSPEND_BITS) |
293 | wPortStatus |= USB_PORT_STAT_SUSPEND; | 296 | wPortStatus |= USB_PORT_STAT_SUSPEND; |
294 | } | 297 | } |
295 | if (status & USBPORTSC_OC) | 298 | if (status & USBPORTSC_OC) |
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index 0c1d66ddb812..bc3327e3dd78 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -2905,17 +2905,31 @@ static int __init ftdi_elan_init(void) | |||
2905 | { | 2905 | { |
2906 | int result; | 2906 | int result; |
2907 | printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name, | 2907 | printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name, |
2908 | __TIME__, __DATE__); | 2908 | __TIME__, __DATE__); |
2909 | init_MUTEX(&ftdi_module_lock); | 2909 | init_MUTEX(&ftdi_module_lock); |
2910 | INIT_LIST_HEAD(&ftdi_static_list); | 2910 | INIT_LIST_HEAD(&ftdi_static_list); |
2911 | status_queue = create_singlethread_workqueue("ftdi-status-control"); | 2911 | status_queue = create_singlethread_workqueue("ftdi-status-control"); |
2912 | if (!status_queue) | ||
2913 | goto err1; | ||
2912 | command_queue = create_singlethread_workqueue("ftdi-command-engine"); | 2914 | command_queue = create_singlethread_workqueue("ftdi-command-engine"); |
2915 | if (!command_queue) | ||
2916 | goto err2; | ||
2913 | respond_queue = create_singlethread_workqueue("ftdi-respond-engine"); | 2917 | respond_queue = create_singlethread_workqueue("ftdi-respond-engine"); |
2918 | if (!respond_queue) | ||
2919 | goto err3; | ||
2914 | result = usb_register(&ftdi_elan_driver); | 2920 | result = usb_register(&ftdi_elan_driver); |
2915 | if (result) | 2921 | if (result) |
2916 | printk(KERN_ERR "usb_register failed. Error number %d\n", | 2922 | printk(KERN_ERR "usb_register failed. Error number %d\n", |
2917 | result); | 2923 | result); |
2918 | return result; | 2924 | return result; |
2925 | |||
2926 | err3: | ||
2927 | destroy_workqueue(command_queue); | ||
2928 | err2: | ||
2929 | destroy_workqueue(status_queue); | ||
2930 | err1: | ||
2931 | printk(KERN_ERR "%s couldn't create workqueue\n", ftdi_elan_driver.name); | ||
2932 | return -ENOMEM; | ||
2919 | } | 2933 | } |
2920 | 2934 | ||
2921 | static void __exit ftdi_elan_exit(void) | 2935 | static void __exit ftdi_elan_exit(void) |
diff --git a/drivers/usb/net/dm9601.c b/drivers/usb/net/dm9601.c index 4a932e1cd93b..c0bc52be5e10 100644 --- a/drivers/usb/net/dm9601.c +++ b/drivers/usb/net/dm9601.c | |||
@@ -571,6 +571,10 @@ static const struct driver_info dm9601_info = { | |||
571 | 571 | ||
572 | static const struct usb_device_id products[] = { | 572 | static const struct usb_device_id products[] = { |
573 | { | 573 | { |
574 | USB_DEVICE(0x07aa, 0x9601), /* Corega FEther USB-TXC */ | ||
575 | .driver_info = (unsigned long)&dm9601_info, | ||
576 | }, | ||
577 | { | ||
574 | USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */ | 578 | USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */ |
575 | .driver_info = (unsigned long)&dm9601_info, | 579 | .driver_info = (unsigned long)&dm9601_info, |
576 | }, | 580 | }, |
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index 18816bf96a4d..310a8b5f5906 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
@@ -44,8 +44,43 @@ struct airprime_private { | |||
44 | int outstanding_urbs; | 44 | int outstanding_urbs; |
45 | int throttled; | 45 | int throttled; |
46 | struct urb *read_urbp[NUM_READ_URBS]; | 46 | struct urb *read_urbp[NUM_READ_URBS]; |
47 | |||
48 | /* Settings for the port */ | ||
49 | int rts_state; /* Handshaking pins (outputs) */ | ||
50 | int dtr_state; | ||
51 | int cts_state; /* Handshaking pins (inputs) */ | ||
52 | int dsr_state; | ||
53 | int dcd_state; | ||
54 | int ri_state; | ||
47 | }; | 55 | }; |
48 | 56 | ||
57 | static int airprime_send_setup(struct usb_serial_port *port) | ||
58 | { | ||
59 | struct usb_serial *serial = port->serial; | ||
60 | struct airprime_private *priv; | ||
61 | |||
62 | dbg("%s", __FUNCTION__); | ||
63 | |||
64 | if (port->number != 0) | ||
65 | return 0; | ||
66 | |||
67 | priv = usb_get_serial_port_data(port); | ||
68 | |||
69 | if (port->tty) { | ||
70 | int val = 0; | ||
71 | if (priv->dtr_state) | ||
72 | val |= 0x01; | ||
73 | if (priv->rts_state) | ||
74 | val |= 0x02; | ||
75 | |||
76 | return usb_control_msg(serial->dev, | ||
77 | usb_rcvctrlpipe(serial->dev, 0), | ||
78 | 0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT); | ||
79 | } | ||
80 | |||
81 | return 0; | ||
82 | } | ||
83 | |||
49 | static void airprime_read_bulk_callback(struct urb *urb) | 84 | static void airprime_read_bulk_callback(struct urb *urb) |
50 | { | 85 | { |
51 | struct usb_serial_port *port = urb->context; | 86 | struct usb_serial_port *port = urb->context; |
@@ -118,6 +153,10 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) | |||
118 | usb_set_serial_port_data(port, priv); | 153 | usb_set_serial_port_data(port, priv); |
119 | } | 154 | } |
120 | 155 | ||
156 | /* Set some sane defaults */ | ||
157 | priv->rts_state = 1; | ||
158 | priv->dtr_state = 1; | ||
159 | |||
121 | for (i = 0; i < NUM_READ_URBS; ++i) { | 160 | for (i = 0; i < NUM_READ_URBS; ++i) { |
122 | buffer = kmalloc(buffer_size, GFP_KERNEL); | 161 | buffer = kmalloc(buffer_size, GFP_KERNEL); |
123 | if (!buffer) { | 162 | if (!buffer) { |
@@ -151,6 +190,9 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp) | |||
151 | /* remember this urb so we can kill it when the port is closed */ | 190 | /* remember this urb so we can kill it when the port is closed */ |
152 | priv->read_urbp[i] = urb; | 191 | priv->read_urbp[i] = urb; |
153 | } | 192 | } |
193 | |||
194 | airprime_send_setup(port); | ||
195 | |||
154 | goto out; | 196 | goto out; |
155 | 197 | ||
156 | errout: | 198 | errout: |
@@ -176,6 +218,11 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp) | |||
176 | 218 | ||
177 | dbg("%s - port %d", __FUNCTION__, port->number); | 219 | dbg("%s - port %d", __FUNCTION__, port->number); |
178 | 220 | ||
221 | priv->rts_state = 0; | ||
222 | priv->dtr_state = 0; | ||
223 | |||
224 | airprime_send_setup(port); | ||
225 | |||
179 | for (i = 0; i < NUM_READ_URBS; ++i) { | 226 | for (i = 0; i < NUM_READ_URBS; ++i) { |
180 | usb_kill_urb (priv->read_urbp[i]); | 227 | usb_kill_urb (priv->read_urbp[i]); |
181 | kfree (priv->read_urbp[i]->transfer_buffer); | 228 | kfree (priv->read_urbp[i]->transfer_buffer); |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index db623e754899..d7d0ba986a80 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -63,6 +63,8 @@ static struct usb_device_id id_table [] = { | |||
63 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ | 63 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ |
64 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ | 64 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ |
65 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ | 65 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ |
66 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ | ||
67 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | ||
66 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ | 68 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ |
67 | { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ | 69 | { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ |
68 | { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ | 70 | { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index c525b42dadde..1633a0fd48e8 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -315,6 +315,7 @@ static struct usb_device_id id_table_combined [] = { | |||
315 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, | 315 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, |
316 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, | 316 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, |
317 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, | 317 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, |
318 | { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) }, | ||
318 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, | 319 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, |
319 | { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, | 320 | { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, |
320 | { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, | 321 | { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, |
@@ -420,6 +421,14 @@ static struct usb_device_id id_table_combined [] = { | |||
420 | { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) }, | 421 | { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) }, |
421 | { USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) }, | 422 | { USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) }, |
422 | { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) }, | 423 | { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) }, |
424 | { USB_DEVICE(FTDI_VID, FTDI_IBS_US485_PID) }, | ||
425 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PICPRO_PID) }, | ||
426 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PCMCIA_PID) }, | ||
427 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PK1_PID) }, | ||
428 | { USB_DEVICE(FTDI_VID, FTDI_IBS_RS232MON_PID) }, | ||
429 | { USB_DEVICE(FTDI_VID, FTDI_IBS_APP70_PID) }, | ||
430 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) }, | ||
431 | { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) }, | ||
423 | /* | 432 | /* |
424 | * These will probably use user-space drivers. Uncomment them if | 433 | * These will probably use user-space drivers. Uncomment them if |
425 | * you need them or use the user-specified vendor/product module | 434 | * you need them or use the user-specified vendor/product module |
@@ -459,6 +468,7 @@ static struct usb_device_id id_table_combined [] = { | |||
459 | { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, | 468 | { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, |
460 | { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) }, | 469 | { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) }, |
461 | { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, | 470 | { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, |
471 | { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, | ||
462 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, | 472 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, |
463 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, | 473 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, |
464 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, | 474 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, |
@@ -533,6 +543,7 @@ static const char *ftdi_chip_name[] = { | |||
533 | [FT8U232AM] = "FT8U232AM", | 543 | [FT8U232AM] = "FT8U232AM", |
534 | [FT232BM] = "FT232BM", | 544 | [FT232BM] = "FT232BM", |
535 | [FT2232C] = "FT2232C", | 545 | [FT2232C] = "FT2232C", |
546 | [FT232RL] = "FT232RL", | ||
536 | }; | 547 | }; |
537 | 548 | ||
538 | 549 | ||
@@ -588,6 +599,8 @@ struct ftdi_private { | |||
588 | static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); | 599 | static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); |
589 | static int ftdi_sio_attach (struct usb_serial *serial); | 600 | static int ftdi_sio_attach (struct usb_serial *serial); |
590 | static void ftdi_shutdown (struct usb_serial *serial); | 601 | static void ftdi_shutdown (struct usb_serial *serial); |
602 | static int ftdi_sio_port_probe (struct usb_serial_port *port); | ||
603 | static int ftdi_sio_port_remove (struct usb_serial_port *port); | ||
591 | static int ftdi_open (struct usb_serial_port *port, struct file *filp); | 604 | static int ftdi_open (struct usb_serial_port *port, struct file *filp); |
592 | static void ftdi_close (struct usb_serial_port *port, struct file *filp); | 605 | static void ftdi_close (struct usb_serial_port *port, struct file *filp); |
593 | static int ftdi_write (struct usb_serial_port *port, const unsigned char *buf, int count); | 606 | static int ftdi_write (struct usb_serial_port *port, const unsigned char *buf, int count); |
@@ -622,6 +635,8 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
622 | .num_bulk_out = 1, | 635 | .num_bulk_out = 1, |
623 | .num_ports = 1, | 636 | .num_ports = 1, |
624 | .probe = ftdi_sio_probe, | 637 | .probe = ftdi_sio_probe, |
638 | .port_probe = ftdi_sio_port_probe, | ||
639 | .port_remove = ftdi_sio_port_remove, | ||
625 | .open = ftdi_open, | 640 | .open = ftdi_open, |
626 | .close = ftdi_close, | 641 | .close = ftdi_close, |
627 | .throttle = ftdi_throttle, | 642 | .throttle = ftdi_throttle, |
@@ -1024,11 +1039,10 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a | |||
1024 | { | 1039 | { |
1025 | struct usb_serial_port *port = to_usb_serial_port(dev); | 1040 | struct usb_serial_port *port = to_usb_serial_port(dev); |
1026 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1041 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1027 | struct usb_device *udev; | 1042 | struct usb_device *udev = port->serial->dev; |
1028 | unsigned short latency = 0; | 1043 | unsigned short latency = 0; |
1029 | int rv = 0; | 1044 | int rv = 0; |
1030 | 1045 | ||
1031 | udev = to_usb_device(dev); | ||
1032 | 1046 | ||
1033 | dbg("%s",__FUNCTION__); | 1047 | dbg("%s",__FUNCTION__); |
1034 | 1048 | ||
@@ -1052,13 +1066,11 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute * | |||
1052 | { | 1066 | { |
1053 | struct usb_serial_port *port = to_usb_serial_port(dev); | 1067 | struct usb_serial_port *port = to_usb_serial_port(dev); |
1054 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1068 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1055 | struct usb_device *udev; | 1069 | struct usb_device *udev = port->serial->dev; |
1056 | char buf[1]; | 1070 | char buf[1]; |
1057 | int v = simple_strtoul(valbuf, NULL, 10); | 1071 | int v = simple_strtoul(valbuf, NULL, 10); |
1058 | int rv = 0; | 1072 | int rv = 0; |
1059 | 1073 | ||
1060 | udev = to_usb_device(dev); | ||
1061 | |||
1062 | dbg("%s: setting latency timer = %i", __FUNCTION__, v); | 1074 | dbg("%s: setting latency timer = %i", __FUNCTION__, v); |
1063 | 1075 | ||
1064 | rv = usb_control_msg(udev, | 1076 | rv = usb_control_msg(udev, |
@@ -1083,13 +1095,11 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att | |||
1083 | { | 1095 | { |
1084 | struct usb_serial_port *port = to_usb_serial_port(dev); | 1096 | struct usb_serial_port *port = to_usb_serial_port(dev); |
1085 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1097 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1086 | struct usb_device *udev; | 1098 | struct usb_device *udev = port->serial->dev; |
1087 | char buf[1]; | 1099 | char buf[1]; |
1088 | int v = simple_strtoul(valbuf, NULL, 10); | 1100 | int v = simple_strtoul(valbuf, NULL, 10); |
1089 | int rv = 0; | 1101 | int rv = 0; |
1090 | 1102 | ||
1091 | udev = to_usb_device(dev); | ||
1092 | |||
1093 | dbg("%s: setting event char = %i", __FUNCTION__, v); | 1103 | dbg("%s: setting event char = %i", __FUNCTION__, v); |
1094 | 1104 | ||
1095 | rv = usb_control_msg(udev, | 1105 | rv = usb_control_msg(udev, |
@@ -1110,46 +1120,38 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att | |||
1110 | static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer); | 1120 | static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer); |
1111 | static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); | 1121 | static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); |
1112 | 1122 | ||
1113 | static int create_sysfs_attrs(struct usb_serial *serial) | 1123 | static int create_sysfs_attrs(struct usb_serial_port *port) |
1114 | { | 1124 | { |
1115 | struct ftdi_private *priv; | 1125 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1116 | struct usb_device *udev; | ||
1117 | int retval = 0; | 1126 | int retval = 0; |
1118 | 1127 | ||
1119 | dbg("%s",__FUNCTION__); | 1128 | dbg("%s",__FUNCTION__); |
1120 | 1129 | ||
1121 | priv = usb_get_serial_port_data(serial->port[0]); | ||
1122 | udev = serial->dev; | ||
1123 | |||
1124 | /* XXX I've no idea if the original SIO supports the event_char | 1130 | /* XXX I've no idea if the original SIO supports the event_char |
1125 | * sysfs parameter, so I'm playing it safe. */ | 1131 | * sysfs parameter, so I'm playing it safe. */ |
1126 | if (priv->chip_type != SIO) { | 1132 | if (priv->chip_type != SIO) { |
1127 | dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]); | 1133 | dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]); |
1128 | retval = device_create_file(&udev->dev, &dev_attr_event_char); | 1134 | retval = device_create_file(&port->dev, &dev_attr_event_char); |
1129 | if ((!retval) && | 1135 | if ((!retval) && |
1130 | (priv->chip_type == FT232BM || priv->chip_type == FT2232C)) { | 1136 | (priv->chip_type == FT232BM || priv->chip_type == FT2232C)) { |
1131 | retval = device_create_file(&udev->dev, | 1137 | retval = device_create_file(&port->dev, |
1132 | &dev_attr_latency_timer); | 1138 | &dev_attr_latency_timer); |
1133 | } | 1139 | } |
1134 | } | 1140 | } |
1135 | return retval; | 1141 | return retval; |
1136 | } | 1142 | } |
1137 | 1143 | ||
1138 | static void remove_sysfs_attrs(struct usb_serial *serial) | 1144 | static void remove_sysfs_attrs(struct usb_serial_port *port) |
1139 | { | 1145 | { |
1140 | struct ftdi_private *priv; | 1146 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1141 | struct usb_device *udev; | ||
1142 | 1147 | ||
1143 | dbg("%s",__FUNCTION__); | 1148 | dbg("%s",__FUNCTION__); |
1144 | 1149 | ||
1145 | priv = usb_get_serial_port_data(serial->port[0]); | ||
1146 | udev = serial->dev; | ||
1147 | |||
1148 | /* XXX see create_sysfs_attrs */ | 1150 | /* XXX see create_sysfs_attrs */ |
1149 | if (priv->chip_type != SIO) { | 1151 | if (priv->chip_type != SIO) { |
1150 | device_remove_file(&udev->dev, &dev_attr_event_char); | 1152 | device_remove_file(&port->dev, &dev_attr_event_char); |
1151 | if (priv->chip_type == FT232BM || priv->chip_type == FT2232C) { | 1153 | if (priv->chip_type == FT232BM || priv->chip_type == FT2232C) { |
1152 | device_remove_file(&udev->dev, &dev_attr_latency_timer); | 1154 | device_remove_file(&port->dev, &dev_attr_latency_timer); |
1153 | } | 1155 | } |
1154 | } | 1156 | } |
1155 | 1157 | ||
@@ -1169,13 +1171,9 @@ static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id | |||
1169 | return (0); | 1171 | return (0); |
1170 | } | 1172 | } |
1171 | 1173 | ||
1172 | /* attach subroutine */ | 1174 | static int ftdi_sio_port_probe(struct usb_serial_port *port) |
1173 | static int ftdi_sio_attach (struct usb_serial *serial) | ||
1174 | { | 1175 | { |
1175 | struct usb_serial_port *port = serial->port[0]; | ||
1176 | struct ftdi_private *priv; | 1176 | struct ftdi_private *priv; |
1177 | struct ftdi_sio_quirk *quirk; | ||
1178 | int retval; | ||
1179 | 1177 | ||
1180 | dbg("%s",__FUNCTION__); | 1178 | dbg("%s",__FUNCTION__); |
1181 | 1179 | ||
@@ -1215,19 +1213,21 @@ static int ftdi_sio_attach (struct usb_serial *serial) | |||
1215 | kfree(port->bulk_out_buffer); | 1213 | kfree(port->bulk_out_buffer); |
1216 | port->bulk_out_buffer = NULL; | 1214 | port->bulk_out_buffer = NULL; |
1217 | 1215 | ||
1218 | usb_set_serial_port_data(serial->port[0], priv); | 1216 | usb_set_serial_port_data(port, priv); |
1219 | 1217 | ||
1220 | ftdi_determine_type (serial->port[0]); | 1218 | ftdi_determine_type (port); |
1221 | retval = create_sysfs_attrs(serial); | 1219 | create_sysfs_attrs(port); |
1222 | if (retval) | 1220 | return 0; |
1223 | dev_err(&serial->dev->dev, "Error creating sysfs files, " | 1221 | } |
1224 | "continuing\n"); | ||
1225 | 1222 | ||
1223 | /* attach subroutine */ | ||
1224 | static int ftdi_sio_attach (struct usb_serial *serial) | ||
1225 | { | ||
1226 | /* Check for device requiring special set up. */ | 1226 | /* Check for device requiring special set up. */ |
1227 | quirk = (struct ftdi_sio_quirk *)usb_get_serial_data(serial); | 1227 | struct ftdi_sio_quirk *quirk = usb_get_serial_data(serial); |
1228 | if (quirk && quirk->setup) { | 1228 | |
1229 | if (quirk && quirk->setup) | ||
1229 | quirk->setup(serial); | 1230 | quirk->setup(serial); |
1230 | } | ||
1231 | 1231 | ||
1232 | return 0; | 1232 | return 0; |
1233 | } /* ftdi_sio_attach */ | 1233 | } /* ftdi_sio_attach */ |
@@ -1271,17 +1271,18 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial) | |||
1271 | * calls __serial_close for each open of the port | 1271 | * calls __serial_close for each open of the port |
1272 | * shutdown is called then (ie ftdi_shutdown) | 1272 | * shutdown is called then (ie ftdi_shutdown) |
1273 | */ | 1273 | */ |
1274 | |||
1275 | |||
1276 | static void ftdi_shutdown (struct usb_serial *serial) | 1274 | static void ftdi_shutdown (struct usb_serial *serial) |
1277 | { /* ftdi_shutdown */ | 1275 | { |
1276 | dbg("%s", __FUNCTION__); | ||
1277 | } | ||
1278 | 1278 | ||
1279 | struct usb_serial_port *port = serial->port[0]; | 1279 | static int ftdi_sio_port_remove(struct usb_serial_port *port) |
1280 | { | ||
1280 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1281 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1281 | 1282 | ||
1282 | dbg("%s", __FUNCTION__); | 1283 | dbg("%s", __FUNCTION__); |
1283 | 1284 | ||
1284 | remove_sysfs_attrs(serial); | 1285 | remove_sysfs_attrs(port); |
1285 | 1286 | ||
1286 | /* all open ports are closed at this point | 1287 | /* all open ports are closed at this point |
1287 | * (by usbserial.c:__serial_close, which calls ftdi_close) | 1288 | * (by usbserial.c:__serial_close, which calls ftdi_close) |
@@ -1291,8 +1292,9 @@ static void ftdi_shutdown (struct usb_serial *serial) | |||
1291 | usb_set_serial_port_data(port, NULL); | 1292 | usb_set_serial_port_data(port, NULL); |
1292 | kfree(priv); | 1293 | kfree(priv); |
1293 | } | 1294 | } |
1294 | } /* ftdi_shutdown */ | ||
1295 | 1295 | ||
1296 | return 0; | ||
1297 | } | ||
1296 | 1298 | ||
1297 | static int ftdi_open (struct usb_serial_port *port, struct file *filp) | 1299 | static int ftdi_open (struct usb_serial_port *port, struct file *filp) |
1298 | { /* ftdi_open */ | 1300 | { /* ftdi_open */ |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 1bdda935f7d9..513cfe1b768b 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */ | 27 | #define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */ |
28 | #define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */ | 28 | #define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */ |
29 | #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ | 29 | #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ |
30 | #define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */ | ||
30 | #define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */ | 31 | #define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */ |
31 | #define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ | 32 | #define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ |
32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ | 33 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ |
@@ -339,6 +340,12 @@ | |||
339 | #define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */ | 340 | #define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */ |
340 | 341 | ||
341 | /* | 342 | /* |
343 | * TTi (Thurlby Thandar Instruments) | ||
344 | */ | ||
345 | #define TTI_VID 0x103E /* Vendor Id */ | ||
346 | #define TTI_QL355P_PID 0x03E8 /* TTi QL355P power supply */ | ||
347 | |||
348 | /* | ||
342 | * Definitions for B&B Electronics products. | 349 | * Definitions for B&B Electronics products. |
343 | */ | 350 | */ |
344 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ | 351 | #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ |
@@ -497,6 +504,19 @@ | |||
497 | #define TELLDUS_VID 0x1781 /* Vendor ID */ | 504 | #define TELLDUS_VID 0x1781 /* Vendor ID */ |
498 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ | 505 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ |
499 | 506 | ||
507 | /* | ||
508 | * IBS elektronik product ids | ||
509 | * Submitted by Thomas Schleusener | ||
510 | */ | ||
511 | #define FTDI_IBS_US485_PID 0xff38 /* IBS US485 (USB<-->RS422/485 interface) */ | ||
512 | #define FTDI_IBS_PICPRO_PID 0xff39 /* IBS PIC-Programmer */ | ||
513 | #define FTDI_IBS_PCMCIA_PID 0xff3a /* IBS Card reader for PCMCIA SRAM-cards */ | ||
514 | #define FTDI_IBS_PK1_PID 0xff3b /* IBS PK1 - Particel counter */ | ||
515 | #define FTDI_IBS_RS232MON_PID 0xff3c /* IBS RS232 - Monitor */ | ||
516 | #define FTDI_IBS_APP70_PID 0xff3d /* APP 70 (dust monitoring system) */ | ||
517 | #define FTDI_IBS_PEDO_PID 0xff3e /* IBS PEDO-Modem (RF modem 868.35 MHz) */ | ||
518 | #define FTDI_IBS_PROD_PID 0xff3f /* future device */ | ||
519 | |||
500 | /* Commands */ | 520 | /* Commands */ |
501 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 521 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
502 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 522 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
@@ -620,6 +640,7 @@ typedef enum { | |||
620 | FT8U232AM = 2, | 640 | FT8U232AM = 2, |
621 | FT232BM = 3, | 641 | FT232BM = 3, |
622 | FT2232C = 4, | 642 | FT2232C = 4, |
643 | FT232RL = 5, | ||
623 | } ftdi_chip_type_t; | 644 | } ftdi_chip_type_t; |
624 | 645 | ||
625 | typedef enum { | 646 | typedef enum { |
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index a408184334ea..d16e2e1764ad 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -247,6 +247,8 @@ static struct usb_device_id ipaq_id_table [] = { | |||
247 | { USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */ | 247 | { USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */ |
248 | { USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */ | 248 | { USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */ |
249 | { USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */ | 249 | { USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */ |
250 | { USB_DEVICE(0x04AD, 0x0306) }, /* GPS Pocket PC USB Sync */ | ||
251 | { USB_DEVICE(0x04B7, 0x0531) }, /* MyGuide 7000 XL USB Sync */ | ||
250 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ | 252 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ |
251 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ | 253 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ |
252 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ | 254 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 6bf22a28adb8..8511352251f3 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -99,9 +99,12 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po | |||
99 | continue; | 99 | continue; |
100 | 100 | ||
101 | *minor = i; | 101 | *minor = i; |
102 | j = 0; | ||
102 | dbg("%s - minor base = %d", __FUNCTION__, *minor); | 103 | dbg("%s - minor base = %d", __FUNCTION__, *minor); |
103 | for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) | 104 | for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) { |
104 | serial_table[i] = serial; | 105 | serial_table[i] = serial; |
106 | serial->port[j++]->number = i; | ||
107 | } | ||
105 | spin_unlock(&table_lock); | 108 | spin_unlock(&table_lock); |
106 | return serial; | 109 | return serial; |
107 | } | 110 | } |
@@ -135,11 +138,6 @@ static void destroy_serial(struct kref *kref) | |||
135 | 138 | ||
136 | dbg("%s - %s", __FUNCTION__, serial->type->description); | 139 | dbg("%s - %s", __FUNCTION__, serial->type->description); |
137 | 140 | ||
138 | serial->type->shutdown(serial); | ||
139 | |||
140 | /* return the minor range that this device had */ | ||
141 | return_serial(serial); | ||
142 | |||
143 | for (i = 0; i < serial->num_ports; ++i) | 141 | for (i = 0; i < serial->num_ports; ++i) |
144 | serial->port[i]->open_count = 0; | 142 | serial->port[i]->open_count = 0; |
145 | 143 | ||
@@ -150,6 +148,12 @@ static void destroy_serial(struct kref *kref) | |||
150 | serial->port[i] = NULL; | 148 | serial->port[i] = NULL; |
151 | } | 149 | } |
152 | 150 | ||
151 | if (serial->type->shutdown) | ||
152 | serial->type->shutdown(serial); | ||
153 | |||
154 | /* return the minor range that this device had */ | ||
155 | return_serial(serial); | ||
156 | |||
153 | /* If this is a "fake" port, we have to clean it up here, as it will | 157 | /* If this is a "fake" port, we have to clean it up here, as it will |
154 | * not get cleaned up in port_release() as it was never registered with | 158 | * not get cleaned up in port_release() as it was never registered with |
155 | * the driver core */ | 159 | * the driver core */ |
@@ -826,7 +830,6 @@ int usb_serial_probe(struct usb_interface *interface, | |||
826 | num_ports = type->num_ports; | 830 | num_ports = type->num_ports; |
827 | } | 831 | } |
828 | 832 | ||
829 | serial->minor = minor; | ||
830 | serial->num_ports = num_ports; | 833 | serial->num_ports = num_ports; |
831 | serial->num_bulk_in = num_bulk_in; | 834 | serial->num_bulk_in = num_bulk_in; |
832 | serial->num_bulk_out = num_bulk_out; | 835 | serial->num_bulk_out = num_bulk_out; |
@@ -847,7 +850,6 @@ int usb_serial_probe(struct usb_interface *interface, | |||
847 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); | 850 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); |
848 | if (!port) | 851 | if (!port) |
849 | goto probe_error; | 852 | goto probe_error; |
850 | port->number = i + serial->minor; | ||
851 | port->serial = serial; | 853 | port->serial = serial; |
852 | spin_lock_init(&port->lock); | 854 | spin_lock_init(&port->lock); |
853 | mutex_init(&port->mutex); | 855 | mutex_init(&port->mutex); |
@@ -980,6 +982,7 @@ int usb_serial_probe(struct usb_interface *interface, | |||
980 | dev_err(&interface->dev, "No more free serial devices\n"); | 982 | dev_err(&interface->dev, "No more free serial devices\n"); |
981 | goto probe_error; | 983 | goto probe_error; |
982 | } | 984 | } |
985 | serial->minor = minor; | ||
983 | 986 | ||
984 | /* register all of the individual ports with the driver core */ | 987 | /* register all of the individual ports with the driver core */ |
985 | for (i = 0; i < num_ports; ++i) { | 988 | for (i = 0; i < num_ports; ++i) { |
@@ -1034,9 +1037,6 @@ probe_error: | |||
1034 | kfree(port->interrupt_out_buffer); | 1037 | kfree(port->interrupt_out_buffer); |
1035 | } | 1038 | } |
1036 | 1039 | ||
1037 | /* return the minor range that this device had */ | ||
1038 | return_serial (serial); | ||
1039 | |||
1040 | /* free up any memory that we allocated */ | 1040 | /* free up any memory that we allocated */ |
1041 | for (i = 0; i < serial->num_port_pointers; ++i) | 1041 | for (i = 0; i < serial->num_port_pointers; ++i) |
1042 | kfree(serial->port[i]); | 1042 | kfree(serial->port[i]); |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 9644a8ea4aa7..2dd31e3f5107 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -146,6 +146,13 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100, | |||
146 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 146 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
147 | US_FL_IGNORE_RESIDUE ), | 147 | US_FL_IGNORE_RESIDUE ), |
148 | 148 | ||
149 | /* Reported by Andrew Nayenko <relan@bk.ru> */ | ||
150 | UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592, | ||
151 | "Nokia", | ||
152 | "Nokia 6288", | ||
153 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
154 | US_FL_MAX_SECTORS_64 ), | ||
155 | |||
149 | /* Reported by Mario Rettig <mariorettig@web.de> */ | 156 | /* Reported by Mario Rettig <mariorettig@web.de> */ |
150 | UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, | 157 | UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, |
151 | "Nokia", | 158 | "Nokia", |
@@ -1395,16 +1402,6 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, | |||
1395 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1402 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1396 | US_FL_IGNORE_RESIDUE ), | 1403 | US_FL_IGNORE_RESIDUE ), |
1397 | 1404 | ||
1398 | /* Reported by Thomas Baechler <thomas@archlinux.org> | ||
1399 | * Fixes I/O errors with Teac HD-35PU devices | ||
1400 | */ | ||
1401 | |||
1402 | UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, | ||
1403 | "Super Top", | ||
1404 | "USB 2.0 IDE DEVICE", | ||
1405 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1406 | US_FL_IGNORE_RESIDUE), | ||
1407 | |||
1408 | /* patch submitted by Davide Perini <perini.davide@dpsoftware.org> | 1405 | /* patch submitted by Davide Perini <perini.davide@dpsoftware.org> |
1409 | * and Renato Perini <rperini@email.it> | 1406 | * and Renato Perini <rperini@email.it> |
1410 | */ | 1407 | */ |
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c index 6eb3daebd563..888f236e5494 100644 --- a/fs/jffs2/background.c +++ b/fs/jffs2/background.c | |||
@@ -99,7 +99,13 @@ static int jffs2_garbage_collect_thread(void *_c) | |||
99 | if (try_to_freeze()) | 99 | if (try_to_freeze()) |
100 | continue; | 100 | continue; |
101 | 101 | ||
102 | cond_resched(); | 102 | /* This thread is purely an optimisation. But if it runs when |
103 | other things could be running, it actually makes things a | ||
104 | lot worse. Use yield() and put it at the back of the runqueue | ||
105 | every time. Especially during boot, pulling an inode in | ||
106 | with read_inode() is much preferable to having the GC thread | ||
107 | get there first. */ | ||
108 | yield(); | ||
103 | 109 | ||
104 | /* Put_super will send a SIGKILL and then wait on the sem. | 110 | /* Put_super will send a SIGKILL and then wait on the sem. |
105 | */ | 111 | */ |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 58a0b912e9d0..717a48cf7df2 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -373,7 +373,14 @@ free_out: | |||
373 | static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, struct jffs2_unknown_node *un) | 373 | static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, struct jffs2_unknown_node *un) |
374 | { | 374 | { |
375 | /* We don't mark unknown nodes as REF_UNCHECKED */ | 375 | /* We don't mark unknown nodes as REF_UNCHECKED */ |
376 | BUG_ON(ref_flags(ref) == REF_UNCHECKED); | 376 | if (ref_flags(ref) == REF_UNCHECKED) { |
377 | JFFS2_ERROR("REF_UNCHECKED but unknown node at %#08x\n", | ||
378 | ref_offset(ref)); | ||
379 | JFFS2_ERROR("Node is {%04x,%04x,%08x,%08x}. Please report this error.\n", | ||
380 | je16_to_cpu(un->magic), je16_to_cpu(un->nodetype), | ||
381 | je32_to_cpu(un->totlen), je32_to_cpu(un->hdr_crc)); | ||
382 | return 1; | ||
383 | } | ||
377 | 384 | ||
378 | un->nodetype = cpu_to_je16(JFFS2_NODE_ACCURATE | je16_to_cpu(un->nodetype)); | 385 | un->nodetype = cpu_to_je16(JFFS2_NODE_ACCURATE | je16_to_cpu(un->nodetype)); |
379 | 386 | ||
@@ -576,6 +583,13 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf | |||
576 | jffs2_mark_node_obsolete(c, ref); | 583 | jffs2_mark_node_obsolete(c, ref); |
577 | goto cont; | 584 | goto cont; |
578 | } | 585 | } |
586 | /* Due to poor choice of crc32 seed, an all-zero node will have a correct CRC */ | ||
587 | if (!je32_to_cpu(node->u.hdr_crc) && !je16_to_cpu(node->u.nodetype) && | ||
588 | !je16_to_cpu(node->u.magic) && !je32_to_cpu(node->u.totlen)) { | ||
589 | JFFS2_NOTICE("All zero node header at %#08x.\n", ref_offset(ref)); | ||
590 | jffs2_mark_node_obsolete(c, ref); | ||
591 | goto cont; | ||
592 | } | ||
579 | 593 | ||
580 | switch (je16_to_cpu(node->u.nodetype)) { | 594 | switch (je16_to_cpu(node->u.nodetype)) { |
581 | 595 | ||
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 31c1475d922a..7fb45bd4915c 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -734,6 +734,15 @@ scan_more: | |||
734 | ofs += 4; | 734 | ofs += 4; |
735 | continue; | 735 | continue; |
736 | } | 736 | } |
737 | /* Due to poor choice of crc32 seed, an all-zero node will have a correct CRC */ | ||
738 | if (!je32_to_cpu(node->hdr_crc) && !je16_to_cpu(node->nodetype) && | ||
739 | !je16_to_cpu(node->magic) && !je32_to_cpu(node->totlen)) { | ||
740 | noisy_printk(&noise, "jffs2_scan_eraseblock(): All zero node header at 0x%08x.\n", ofs); | ||
741 | if ((err = jffs2_scan_dirty_space(c, jeb, 4))) | ||
742 | return err; | ||
743 | ofs += 4; | ||
744 | continue; | ||
745 | } | ||
737 | 746 | ||
738 | if (ofs + je32_to_cpu(node->totlen) > | 747 | if (ofs + je32_to_cpu(node->totlen) > |
739 | jeb->offset + c->sector_size) { | 748 | jeb->offset + c->sector_size) { |
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index de718e3a1692..4fac6dd53954 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
@@ -238,7 +238,10 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) | |||
238 | jeb = &c->blocks[c->wbuf_ofs / c->sector_size]; | 238 | jeb = &c->blocks[c->wbuf_ofs / c->sector_size]; |
239 | 239 | ||
240 | spin_lock(&c->erase_completion_lock); | 240 | spin_lock(&c->erase_completion_lock); |
241 | jffs2_block_refile(c, jeb, REFILE_NOTEMPTY); | 241 | if (c->wbuf_ofs % c->mtd->erasesize) |
242 | jffs2_block_refile(c, jeb, REFILE_NOTEMPTY); | ||
243 | else | ||
244 | jffs2_block_refile(c, jeb, REFILE_ANYWAY); | ||
242 | spin_unlock(&c->erase_completion_lock); | 245 | spin_unlock(&c->erase_completion_lock); |
243 | 246 | ||
244 | BUG_ON(!ref_obsolete(jeb->last_node)); | 247 | BUG_ON(!ref_obsolete(jeb->last_node)); |
@@ -1087,7 +1090,7 @@ int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct jffs2_eraseblock * | |||
1087 | if (!c->mtd->block_markbad) | 1090 | if (!c->mtd->block_markbad) |
1088 | return 1; // What else can we do? | 1091 | return 1; // What else can we do? |
1089 | 1092 | ||
1090 | D1(printk(KERN_WARNING "jffs2_write_nand_badblock(): Marking bad block at %08x\n", bad_offset)); | 1093 | printk(KERN_WARNING "JFFS2: marking eraseblock at %08x\n as bad", bad_offset); |
1091 | ret = c->mtd->block_markbad(c->mtd, bad_offset); | 1094 | ret = c->mtd->block_markbad(c->mtd, bad_offset); |
1092 | 1095 | ||
1093 | if (ret) { | 1096 | if (ret) { |
diff --git a/include/asm-mips/sibyte/trace_prof.h b/include/asm-mips/sibyte/trace_prof.h deleted file mode 100644 index 557792075e9a..000000000000 --- a/include/asm-mips/sibyte/trace_prof.h +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version 2 | ||
7 | * of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef __ASM_SIBYTE_TRACE_PROF_H | ||
20 | #define __ASM_SIBYTE_TRACE_PROF_H | ||
21 | |||
22 | #undef DBG | ||
23 | #if SBPROF_TB_DEBUG | ||
24 | #define DBG(a) a | ||
25 | #else | ||
26 | #define DBG(a) | ||
27 | #endif | ||
28 | |||
29 | #define SBPROF_TB_MAJOR 240 | ||
30 | #define DEVNAME "bcm1250_tbprof" | ||
31 | |||
32 | typedef u_int64_t tb_sample_t[6*256]; | ||
33 | |||
34 | struct sbprof_tb { | ||
35 | int open; | ||
36 | tb_sample_t *sbprof_tbbuf; | ||
37 | int next_tb_sample; | ||
38 | |||
39 | volatile int tb_enable; | ||
40 | volatile int tb_armed; | ||
41 | |||
42 | wait_queue_head_t tb_sync; | ||
43 | wait_queue_head_t tb_read; | ||
44 | }; | ||
45 | |||
46 | #define MAX_SAMPLE_BYTES (24*1024*1024) | ||
47 | #define MAX_TBSAMPLE_BYTES (12*1024*1024) | ||
48 | |||
49 | #define MAX_SAMPLES (MAX_SAMPLE_BYTES/sizeof(u_int32_t)) | ||
50 | #define TB_SAMPLE_SIZE (sizeof(tb_sample_t)) | ||
51 | #define MAX_TB_SAMPLES (MAX_TBSAMPLE_BYTES/TB_SAMPLE_SIZE) | ||
52 | |||
53 | /* IOCTLs */ | ||
54 | #define SBPROF_ZBSTART _IOW('s', 0, int) | ||
55 | #define SBPROF_ZBSTOP _IOW('s', 1, int) | ||
56 | #define SBPROF_ZBWAITFULL _IOW('s', 2, int) | ||
57 | |||
58 | /*************************************************************************** | ||
59 | * Routines for gathering ZBbus profiles using trace buffer | ||
60 | ***************************************************************************/ | ||
61 | |||
62 | /* Requires: Already called zclk_timer_init with a value that won't | ||
63 | saturate 40 bits. No subsequent use of SCD performance counters | ||
64 | or trace buffer. | ||
65 | Effect: Starts gathering random ZBbus profiles using trace buffer. */ | ||
66 | extern int sbprof_zbprof_start(struct file *filp); | ||
67 | |||
68 | /* Effect: Stops collection of ZBbus profiles */ | ||
69 | extern int sbprof_zbprof_stop(void); | ||
70 | |||
71 | |||
72 | /*************************************************************************** | ||
73 | * Routines for using 40-bit SCD cycle counter | ||
74 | * | ||
75 | * Client responsible for either handling interrupts or making sure | ||
76 | * the cycles counter never saturates, e.g., by doing | ||
77 | * zclk_timer_init(0) at least every 2^40 - 1 ZCLKs. | ||
78 | ***************************************************************************/ | ||
79 | |||
80 | /* Configures SCD counter 0 to count ZCLKs starting from val; | ||
81 | Configures SCD counters1,2,3 to count nothing. | ||
82 | Must not be called while gathering ZBbus profiles. | ||
83 | |||
84 | unsigned long long val; */ | ||
85 | #define zclk_timer_init(val) \ | ||
86 | __asm__ __volatile__ (".set push;" \ | ||
87 | ".set mips64;" \ | ||
88 | "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \ | ||
89 | "sd %0, 0x10($8);" /* write val to counter0 */ \ | ||
90 | "sd %1, 0($8);" /* config counter0 for zclks*/ \ | ||
91 | ".set pop" \ | ||
92 | : /* no outputs */ \ | ||
93 | /* enable, counter0 */ \ | ||
94 | : /* inputs */ "r"(val), "r" ((1ULL << 33) | 1ULL) \ | ||
95 | : /* modifies */ "$8" ) | ||
96 | |||
97 | |||
98 | /* Reads SCD counter 0 and puts result in value | ||
99 | unsigned long long val; */ | ||
100 | #define zclk_get(val) \ | ||
101 | __asm__ __volatile__ (".set push;" \ | ||
102 | ".set mips64;" \ | ||
103 | "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \ | ||
104 | "ld %0, 0x10($8);" /* write val to counter0 */ \ | ||
105 | ".set pop" \ | ||
106 | : /* outputs */ "=r"(val) \ | ||
107 | : /* inputs */ \ | ||
108 | : /* modifies */ "$8" ) | ||
109 | |||
110 | #endif /* __ASM_SIBYTE_TRACE_PROF_H */ | ||
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h index be9509c8f8c1..284dfd01a33d 100644 --- a/include/asm-sparc64/parport.h +++ b/include/asm-sparc64/parport.h | |||
@@ -19,6 +19,17 @@ | |||
19 | */ | 19 | */ |
20 | #define HAS_DMA | 20 | #define HAS_DMA |
21 | 21 | ||
22 | static DEFINE_SPINLOCK(dma_spin_lock); | ||
23 | |||
24 | #define claim_dma_lock() \ | ||
25 | ({ unsigned long flags; \ | ||
26 | spin_lock_irqsave(&dma_spin_lock, flags); \ | ||
27 | flags; \ | ||
28 | }) | ||
29 | |||
30 | #define release_dma_lock(__flags) \ | ||
31 | spin_unlock_irqrestore(&dma_spin_lock, __flags); | ||
32 | |||
22 | static struct sparc_ebus_info { | 33 | static struct sparc_ebus_info { |
23 | struct ebus_dma_info info; | 34 | struct ebus_dma_info info; |
24 | unsigned int addr; | 35 | unsigned int addr; |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 6a8570be331b..3d956c3abb31 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -121,6 +121,7 @@ struct mtd_info { | |||
121 | u_int32_t writesize; | 121 | u_int32_t writesize; |
122 | 122 | ||
123 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) | 123 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) |
124 | u_int32_t oobavail; // Available OOB bytes per block | ||
124 | 125 | ||
125 | // Kernel-only stuff starts here. | 126 | // Kernel-only stuff starts here. |
126 | char *name; | 127 | char *name; |
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index d8af8a95e58d..a56d24ada505 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h | |||
@@ -82,7 +82,8 @@ struct onenand_bufferram { | |||
82 | * @wq: [INTERN] wait queue to sleep on if a OneNAND | 82 | * @wq: [INTERN] wait queue to sleep on if a OneNAND |
83 | * operation is in progress | 83 | * operation is in progress |
84 | * @state: [INTERN] the current state of the OneNAND device | 84 | * @state: [INTERN] the current state of the OneNAND device |
85 | * @page_buf: data buffer | 85 | * @page_buf: [INTERN] page main data buffer |
86 | * @oob_buf: [INTERN] page oob data buffer | ||
86 | * @subpagesize: [INTERN] holds the subpagesize | 87 | * @subpagesize: [INTERN] holds the subpagesize |
87 | * @ecclayout: [REPLACEABLE] the default ecc placement scheme | 88 | * @ecclayout: [REPLACEABLE] the default ecc placement scheme |
88 | * @bbm: [REPLACEABLE] pointer to Bad Block Management | 89 | * @bbm: [REPLACEABLE] pointer to Bad Block Management |
@@ -122,6 +123,7 @@ struct onenand_chip { | |||
122 | wait_queue_head_t wq; | 123 | wait_queue_head_t wq; |
123 | onenand_state_t state; | 124 | onenand_state_t state; |
124 | unsigned char *page_buf; | 125 | unsigned char *page_buf; |
126 | unsigned char *oob_buf; | ||
125 | 127 | ||
126 | int subpagesize; | 128 | int subpagesize; |
127 | struct nand_ecclayout *ecclayout; | 129 | struct nand_ecclayout *ecclayout; |
@@ -156,6 +158,7 @@ struct onenand_chip { | |||
156 | #define ONENAND_HAS_CONT_LOCK (0x0001) | 158 | #define ONENAND_HAS_CONT_LOCK (0x0001) |
157 | #define ONENAND_HAS_UNLOCK_ALL (0x0002) | 159 | #define ONENAND_HAS_UNLOCK_ALL (0x0002) |
158 | #define ONENAND_PAGEBUF_ALLOC (0x1000) | 160 | #define ONENAND_PAGEBUF_ALLOC (0x1000) |
161 | #define ONENAND_OOBBUF_ALLOC (0x2000) | ||
159 | 162 | ||
160 | /* | 163 | /* |
161 | * OneNAND Flash Manufacturer ID Codes | 164 | * OneNAND Flash Manufacturer ID Codes |
diff --git a/kernel/module.c b/kernel/module.c index f77e893e4620..fbc51de6444e 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2419,12 +2419,6 @@ void module_remove_driver(struct device_driver *drv) | |||
2419 | kfree(driver_name); | 2419 | kfree(driver_name); |
2420 | } | 2420 | } |
2421 | } | 2421 | } |
2422 | /* | ||
2423 | * Undo the additional reference we added in module_add_driver() | ||
2424 | * via kset_find_obj() | ||
2425 | */ | ||
2426 | if (drv->mod_name) | ||
2427 | kobject_put(&drv->kobj); | ||
2428 | } | 2422 | } |
2429 | EXPORT_SYMBOL(module_remove_driver); | 2423 | EXPORT_SYMBOL(module_remove_driver); |
2430 | #endif | 2424 | #endif |
diff --git a/lib/kobject.c b/lib/kobject.c index f4f6176dcd12..057921c5945a 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -385,9 +385,11 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent) | |||
385 | goto out; | 385 | goto out; |
386 | old_parent = kobj->parent; | 386 | old_parent = kobj->parent; |
387 | kobj->parent = new_parent; | 387 | kobj->parent = new_parent; |
388 | new_parent = NULL; | ||
388 | kobject_put(old_parent); | 389 | kobject_put(old_parent); |
389 | kobject_uevent_env(kobj, KOBJ_MOVE, envp); | 390 | kobject_uevent_env(kobj, KOBJ_MOVE, envp); |
390 | out: | 391 | out: |
392 | kobject_put(new_parent); | ||
391 | kobject_put(kobj); | 393 | kobject_put(kobj); |
392 | kfree(devpath_string); | 394 | kfree(devpath_string); |
393 | kfree(devpath); | 395 | kfree(devpath); |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 63fe1093b616..0b9c49b3a100 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -360,7 +360,7 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist, | |||
360 | return; | 360 | return; |
361 | } | 361 | } |
362 | 362 | ||
363 | read_lock(&in6_dev->lock); | 363 | read_lock_bh(&in6_dev->lock); |
364 | for (ifp = in6_dev->addr_list; ifp; ifp = ifp->if_next) { | 364 | for (ifp = in6_dev->addr_list; ifp; ifp = ifp->if_next) { |
365 | /* Add the address to the local list. */ | 365 | /* Add the address to the local list. */ |
366 | addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC); | 366 | addr = t_new(struct sctp_sockaddr_entry, GFP_ATOMIC); |
@@ -374,7 +374,7 @@ static void sctp_v6_copy_addrlist(struct list_head *addrlist, | |||
374 | } | 374 | } |
375 | } | 375 | } |
376 | 376 | ||
377 | read_unlock(&in6_dev->lock); | 377 | read_unlock_bh(&in6_dev->lock); |
378 | rcu_read_unlock(); | 378 | rcu_read_unlock(); |
379 | } | 379 | } |
380 | 380 | ||