diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-04-01 00:22:26 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-04-01 00:22:26 -0400 |
commit | 399f486286f44d55c4fff0e9cc5d712f2b443489 (patch) | |
tree | 0c2820b3e04232eaa96f08c1057b87728fb3e7a4 /drivers | |
parent | 481419ec9fbdf3f4ec5389c7e91a81b4a7ebee8d (diff) | |
parent | a9edadbf790d72adf6ebed476cb5caf7743e7e4a (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'drivers')
333 files changed, 4283 insertions, 3685 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index f688c214be0c..b4f5e8542829 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -283,34 +283,22 @@ config ACPI_TOSHIBA | |||
283 | If you have a legacy free Toshiba laptop (such as the Libretto L1 | 283 | If you have a legacy free Toshiba laptop (such as the Libretto L1 |
284 | series), say Y. | 284 | series), say Y. |
285 | 285 | ||
286 | config ACPI_CUSTOM_DSDT | 286 | config ACPI_CUSTOM_DSDT_FILE |
287 | bool "Include Custom DSDT" | 287 | string "Custom DSDT Table file to include" |
288 | default "" | ||
288 | depends on !STANDALONE | 289 | depends on !STANDALONE |
289 | default n | ||
290 | help | 290 | help |
291 | This option supports a custom DSDT by linking it into the kernel. | 291 | This option supports a custom DSDT by linking it into the kernel. |
292 | See Documentation/acpi/dsdt-override.txt | 292 | See Documentation/acpi/dsdt-override.txt |
293 | 293 | ||
294 | If unsure, say N. | ||
295 | |||
296 | config ACPI_CUSTOM_DSDT_FILE | ||
297 | string "Custom DSDT Table file to include" | ||
298 | depends on ACPI_CUSTOM_DSDT | ||
299 | default "" | ||
300 | help | ||
301 | Enter the full path name to the file which includes the AmlCode | 294 | Enter the full path name to the file which includes the AmlCode |
302 | declaration. | 295 | declaration. |
303 | 296 | ||
304 | config ACPI_CUSTOM_DSDT_INITRD | 297 | If unsure, don't enter a file name. |
305 | bool "Read Custom DSDT from initramfs" | ||
306 | depends on BLK_DEV_INITRD | ||
307 | default n | ||
308 | help | ||
309 | This option supports a custom DSDT by optionally loading it from initrd. | ||
310 | See Documentation/acpi/dsdt-override.txt | ||
311 | 298 | ||
312 | If you are not using this feature now, but may use it later, | 299 | config ACPI_CUSTOM_DSDT |
313 | it is safe to say Y here. | 300 | bool |
301 | default ACPI_CUSTOM_DSDT_FILE != "" | ||
314 | 302 | ||
315 | config ACPI_BLACKLIST_YEAR | 303 | config ACPI_BLACKLIST_YEAR |
316 | int "Disable ACPI for systems before Jan 1st this year" if X86_32 | 304 | int "Disable ACPI for systems before Jan 1st this year" if X86_32 |
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index d25ef961415c..44ad90c03c2e 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -610,7 +610,7 @@ write_led(const char __user * buffer, unsigned long count, | |||
610 | (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask); | 610 | (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask); |
611 | 611 | ||
612 | if (invert) /* invert target value */ | 612 | if (invert) /* invert target value */ |
613 | led_out = !led_out & 0x1; | 613 | led_out = !led_out; |
614 | 614 | ||
615 | if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) | 615 | if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) |
616 | printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", | 616 | printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index f6215e809808..d5729d5dc190 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -293,13 +293,12 @@ static int extract_package(struct acpi_battery *battery, | |||
293 | strncpy(ptr, (u8 *)&element->integer.value, | 293 | strncpy(ptr, (u8 *)&element->integer.value, |
294 | sizeof(acpi_integer)); | 294 | sizeof(acpi_integer)); |
295 | ptr[sizeof(acpi_integer)] = 0; | 295 | ptr[sizeof(acpi_integer)] = 0; |
296 | } else return -EFAULT; | 296 | } else |
297 | *ptr = 0; /* don't have value */ | ||
297 | } else { | 298 | } else { |
298 | if (element->type == ACPI_TYPE_INTEGER) { | 299 | int *x = (int *)((u8 *)battery + offsets[i].offset); |
299 | int *x = (int *)((u8 *)battery + | 300 | *x = (element->type == ACPI_TYPE_INTEGER) ? |
300 | offsets[i].offset); | 301 | element->integer.value : -1; |
301 | *x = element->integer.value; | ||
302 | } else return -EFAULT; | ||
303 | } | 302 | } |
304 | } | 303 | } |
305 | return 0; | 304 | return 0; |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index ce3c0a2cbac4..5b6760e0f957 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -776,7 +776,7 @@ static int __init acpi_init(void) | |||
776 | 776 | ||
777 | acpi_kobj = kobject_create_and_add("acpi", firmware_kobj); | 777 | acpi_kobj = kobject_create_and_add("acpi", firmware_kobj); |
778 | if (!acpi_kobj) { | 778 | if (!acpi_kobj) { |
779 | printk(KERN_WARNING "%s: kset create error\n", __FUNCTION__); | 779 | printk(KERN_WARNING "%s: kset create error\n", __func__); |
780 | acpi_kobj = NULL; | 780 | acpi_kobj = NULL; |
781 | } | 781 | } |
782 | 782 | ||
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 24a7865a57cb..6c5da83cdb68 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -449,6 +449,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
449 | input->phys = button->phys; | 449 | input->phys = button->phys; |
450 | input->id.bustype = BUS_HOST; | 450 | input->id.bustype = BUS_HOST; |
451 | input->id.product = button->type; | 451 | input->id.product = button->type; |
452 | input->dev.parent = &device->dev; | ||
452 | 453 | ||
453 | switch (button->type) { | 454 | switch (button->type) { |
454 | case ACPI_BUTTON_TYPE_POWER: | 455 | case ACPI_BUTTON_TYPE_POWER: |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 307cef65c247..fa44fb96fc34 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -710,6 +710,7 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr, | |||
710 | if (!count) | 710 | if (!count) |
711 | return -EINVAL; | 711 | return -EINVAL; |
712 | 712 | ||
713 | begin_undock(dock_station); | ||
713 | ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); | 714 | ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); |
714 | return ret ? ret: count; | 715 | return ret ? ret: count; |
715 | } | 716 | } |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index caf873c14bfb..7222a18a0319 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -943,11 +943,7 @@ int __init acpi_ec_ecdt_probe(void) | |||
943 | boot_ec->command_addr = ecdt_ptr->control.address; | 943 | boot_ec->command_addr = ecdt_ptr->control.address; |
944 | boot_ec->data_addr = ecdt_ptr->data.address; | 944 | boot_ec->data_addr = ecdt_ptr->data.address; |
945 | boot_ec->gpe = ecdt_ptr->gpe; | 945 | boot_ec->gpe = ecdt_ptr->gpe; |
946 | if (ACPI_FAILURE(acpi_get_handle(NULL, ecdt_ptr->id, | 946 | boot_ec->handle = ACPI_ROOT_OBJECT; |
947 | &boot_ec->handle))) { | ||
948 | pr_info("Failed to locate handle for boot EC\n"); | ||
949 | boot_ec->handle = ACPI_ROOT_OBJECT; | ||
950 | } | ||
951 | } else { | 947 | } else { |
952 | /* This workaround is needed only on some broken machines, | 948 | /* This workaround is needed only on some broken machines, |
953 | * which require early EC, but fail to provide ECDT */ | 949 | * which require early EC, but fail to provide ECDT */ |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 8edba7b678eb..a697fb6cf050 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -91,10 +91,6 @@ static DEFINE_SPINLOCK(acpi_res_lock); | |||
91 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ | 91 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ |
92 | static char osi_additional_string[OSI_STRING_LENGTH_MAX]; | 92 | static char osi_additional_string[OSI_STRING_LENGTH_MAX]; |
93 | 93 | ||
94 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD | ||
95 | static int acpi_no_initrd_override; | ||
96 | #endif | ||
97 | |||
98 | /* | 94 | /* |
99 | * "Ode to _OSI(Linux)" | 95 | * "Ode to _OSI(Linux)" |
100 | * | 96 | * |
@@ -324,67 +320,6 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val, | |||
324 | return AE_OK; | 320 | return AE_OK; |
325 | } | 321 | } |
326 | 322 | ||
327 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD | ||
328 | static struct acpi_table_header *acpi_find_dsdt_initrd(void) | ||
329 | { | ||
330 | struct file *firmware_file; | ||
331 | mm_segment_t oldfs; | ||
332 | unsigned long len, len2; | ||
333 | struct acpi_table_header *dsdt_buffer, *ret = NULL; | ||
334 | struct kstat stat; | ||
335 | char *ramfs_dsdt_name = "/DSDT.aml"; | ||
336 | |||
337 | printk(KERN_INFO PREFIX "Checking initramfs for custom DSDT\n"); | ||
338 | |||
339 | /* | ||
340 | * Never do this at home, only the user-space is allowed to open a file. | ||
341 | * The clean way would be to use the firmware loader. | ||
342 | * But this code must be run before there is any userspace available. | ||
343 | * A static/init firmware infrastructure doesn't exist yet... | ||
344 | */ | ||
345 | if (vfs_stat(ramfs_dsdt_name, &stat) < 0) | ||
346 | return ret; | ||
347 | |||
348 | len = stat.size; | ||
349 | /* check especially against empty files */ | ||
350 | if (len <= 4) { | ||
351 | printk(KERN_ERR PREFIX "Failed: DSDT only %lu bytes.\n", len); | ||
352 | return ret; | ||
353 | } | ||
354 | |||
355 | firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0); | ||
356 | if (IS_ERR(firmware_file)) { | ||
357 | printk(KERN_ERR PREFIX "Failed to open %s.\n", ramfs_dsdt_name); | ||
358 | return ret; | ||
359 | } | ||
360 | |||
361 | dsdt_buffer = kmalloc(len, GFP_ATOMIC); | ||
362 | if (!dsdt_buffer) { | ||
363 | printk(KERN_ERR PREFIX "Failed to allocate %lu bytes.\n", len); | ||
364 | goto err; | ||
365 | } | ||
366 | |||
367 | oldfs = get_fs(); | ||
368 | set_fs(KERNEL_DS); | ||
369 | len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, | ||
370 | &firmware_file->f_pos); | ||
371 | set_fs(oldfs); | ||
372 | if (len2 < len) { | ||
373 | printk(KERN_ERR PREFIX "Failed to read %lu bytes from %s.\n", | ||
374 | len, ramfs_dsdt_name); | ||
375 | ACPI_FREE(dsdt_buffer); | ||
376 | goto err; | ||
377 | } | ||
378 | |||
379 | printk(KERN_INFO PREFIX "Found %lu byte DSDT in %s.\n", | ||
380 | len, ramfs_dsdt_name); | ||
381 | ret = dsdt_buffer; | ||
382 | err: | ||
383 | filp_close(firmware_file, NULL); | ||
384 | return ret; | ||
385 | } | ||
386 | #endif | ||
387 | |||
388 | acpi_status | 323 | acpi_status |
389 | acpi_os_table_override(struct acpi_table_header * existing_table, | 324 | acpi_os_table_override(struct acpi_table_header * existing_table, |
390 | struct acpi_table_header ** new_table) | 325 | struct acpi_table_header ** new_table) |
@@ -398,16 +333,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table, | |||
398 | if (strncmp(existing_table->signature, "DSDT", 4) == 0) | 333 | if (strncmp(existing_table->signature, "DSDT", 4) == 0) |
399 | *new_table = (struct acpi_table_header *)AmlCode; | 334 | *new_table = (struct acpi_table_header *)AmlCode; |
400 | #endif | 335 | #endif |
401 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD | ||
402 | if ((strncmp(existing_table->signature, "DSDT", 4) == 0) && | ||
403 | !acpi_no_initrd_override) { | ||
404 | struct acpi_table_header *initrd_table; | ||
405 | |||
406 | initrd_table = acpi_find_dsdt_initrd(); | ||
407 | if (initrd_table) | ||
408 | *new_table = initrd_table; | ||
409 | } | ||
410 | #endif | ||
411 | if (*new_table != NULL) { | 336 | if (*new_table != NULL) { |
412 | printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], " | 337 | printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], " |
413 | "this is unsafe: tainting kernel\n", | 338 | "this is unsafe: tainting kernel\n", |
@@ -418,15 +343,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table, | |||
418 | return AE_OK; | 343 | return AE_OK; |
419 | } | 344 | } |
420 | 345 | ||
421 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD | ||
422 | static int __init acpi_no_initrd_override_setup(char *s) | ||
423 | { | ||
424 | acpi_no_initrd_override = 1; | ||
425 | return 1; | ||
426 | } | ||
427 | __setup("acpi_no_initrd_override", acpi_no_initrd_override_setup); | ||
428 | #endif | ||
429 | |||
430 | static irqreturn_t acpi_irq(int irq, void *dev_id) | 346 | static irqreturn_t acpi_irq(int irq, void *dev_id) |
431 | { | 347 | { |
432 | u32 handled; | 348 | u32 handled; |
@@ -1237,7 +1153,7 @@ int acpi_check_resource_conflict(struct resource *res) | |||
1237 | 1153 | ||
1238 | if (clash) { | 1154 | if (clash) { |
1239 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { | 1155 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { |
1240 | printk(KERN_INFO "%sACPI: %s resource %s [0x%llx-0x%llx]" | 1156 | printk("%sACPI: %s resource %s [0x%llx-0x%llx]" |
1241 | " conflicts with ACPI region %s" | 1157 | " conflicts with ACPI region %s" |
1242 | " [0x%llx-0x%llx]\n", | 1158 | " [0x%llx-0x%llx]\n", |
1243 | acpi_enforce_resources == ENFORCE_RESOURCES_LAX | 1159 | acpi_enforce_resources == ENFORCE_RESOURCES_LAX |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 7f19859580c7..89022a74faee 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | 27 | ||
28 | #include <linux/dmi.h> | ||
28 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
29 | #include <linux/module.h> | 30 | #include <linux/module.h> |
30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
@@ -76,6 +77,101 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, | |||
76 | return NULL; | 77 | return NULL; |
77 | } | 78 | } |
78 | 79 | ||
80 | /* http://bugzilla.kernel.org/show_bug.cgi?id=4773 */ | ||
81 | static struct dmi_system_id medion_md9580[] = { | ||
82 | { | ||
83 | .ident = "Medion MD9580-F laptop", | ||
84 | .matches = { | ||
85 | DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), | ||
86 | DMI_MATCH(DMI_PRODUCT_NAME, "A555"), | ||
87 | }, | ||
88 | }, | ||
89 | { } | ||
90 | }; | ||
91 | |||
92 | /* http://bugzilla.kernel.org/show_bug.cgi?id=5044 */ | ||
93 | static struct dmi_system_id dell_optiplex[] = { | ||
94 | { | ||
95 | .ident = "Dell Optiplex GX1", | ||
96 | .matches = { | ||
97 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), | ||
98 | DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX1 600S+"), | ||
99 | }, | ||
100 | }, | ||
101 | { } | ||
102 | }; | ||
103 | |||
104 | /* http://bugzilla.kernel.org/show_bug.cgi?id=10138 */ | ||
105 | static struct dmi_system_id hp_t5710[] = { | ||
106 | { | ||
107 | .ident = "HP t5710", | ||
108 | .matches = { | ||
109 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
110 | DMI_MATCH(DMI_PRODUCT_NAME, "hp t5000 series"), | ||
111 | DMI_MATCH(DMI_BOARD_NAME, "098Ch"), | ||
112 | }, | ||
113 | }, | ||
114 | { } | ||
115 | }; | ||
116 | |||
117 | struct prt_quirk { | ||
118 | struct dmi_system_id *system; | ||
119 | unsigned int segment; | ||
120 | unsigned int bus; | ||
121 | unsigned int device; | ||
122 | unsigned char pin; | ||
123 | char *source; /* according to BIOS */ | ||
124 | char *actual_source; | ||
125 | }; | ||
126 | |||
127 | /* | ||
128 | * These systems have incorrect _PRT entries. The BIOS claims the PCI | ||
129 | * interrupt at the listed segment/bus/device/pin is connected to the first | ||
130 | * link device, but it is actually connected to the second. | ||
131 | */ | ||
132 | static struct prt_quirk prt_quirks[] = { | ||
133 | { medion_md9580, 0, 0, 9, 'A', | ||
134 | "\\_SB_.PCI0.ISA_.LNKA", | ||
135 | "\\_SB_.PCI0.ISA_.LNKB"}, | ||
136 | { dell_optiplex, 0, 0, 0xd, 'A', | ||
137 | "\\_SB_.LNKB", | ||
138 | "\\_SB_.LNKA"}, | ||
139 | { hp_t5710, 0, 0, 1, 'A', | ||
140 | "\\_SB_.PCI0.LNK1", | ||
141 | "\\_SB_.PCI0.LNK3"}, | ||
142 | }; | ||
143 | |||
144 | static void | ||
145 | do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt) | ||
146 | { | ||
147 | int i; | ||
148 | struct prt_quirk *quirk; | ||
149 | |||
150 | for (i = 0; i < ARRAY_SIZE(prt_quirks); i++) { | ||
151 | quirk = &prt_quirks[i]; | ||
152 | |||
153 | /* All current quirks involve link devices, not GSIs */ | ||
154 | if (!prt->source) | ||
155 | continue; | ||
156 | |||
157 | if (dmi_check_system(quirk->system) && | ||
158 | entry->id.segment == quirk->segment && | ||
159 | entry->id.bus == quirk->bus && | ||
160 | entry->id.device == quirk->device && | ||
161 | entry->pin + 'A' == quirk->pin && | ||
162 | !strcmp(prt->source, quirk->source) && | ||
163 | strlen(prt->source) >= strlen(quirk->actual_source)) { | ||
164 | printk(KERN_WARNING PREFIX "firmware reports " | ||
165 | "%04x:%02x:%02x[%c] connected to %s; " | ||
166 | "changing to %s\n", | ||
167 | entry->id.segment, entry->id.bus, | ||
168 | entry->id.device, 'A' + entry->pin, | ||
169 | prt->source, quirk->actual_source); | ||
170 | strcpy(prt->source, quirk->actual_source); | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | |||
79 | static int | 175 | static int |
80 | acpi_pci_irq_add_entry(acpi_handle handle, | 176 | acpi_pci_irq_add_entry(acpi_handle handle, |
81 | int segment, int bus, struct acpi_pci_routing_table *prt) | 177 | int segment, int bus, struct acpi_pci_routing_table *prt) |
@@ -96,6 +192,8 @@ acpi_pci_irq_add_entry(acpi_handle handle, | |||
96 | entry->id.function = prt->address & 0xFFFF; | 192 | entry->id.function = prt->address & 0xFFFF; |
97 | entry->pin = prt->pin; | 193 | entry->pin = prt->pin; |
98 | 194 | ||
195 | do_prt_fixups(entry, prt); | ||
196 | |||
99 | /* | 197 | /* |
100 | * Type 1: Dynamic | 198 | * Type 1: Dynamic |
101 | * --------------- | 199 | * --------------- |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index f14ff1ffab29..c3fed31166b5 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -184,7 +184,7 @@ static void acpi_pci_bridge_scan(struct acpi_device *device) | |||
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | static int acpi_pci_root_add(struct acpi_device *device) | 187 | static int __devinit acpi_pci_root_add(struct acpi_device *device) |
188 | { | 188 | { |
189 | int result = 0; | 189 | int result = 0; |
190 | struct acpi_pci_root *root = NULL; | 190 | struct acpi_pci_root *root = NULL; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index a3cc8a98255c..36a68fa114e3 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -840,17 +840,19 @@ static int is_processor_present(acpi_handle handle) | |||
840 | 840 | ||
841 | 841 | ||
842 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | 842 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); |
843 | /* | ||
844 | * if a processor object does not have an _STA object, | ||
845 | * OSPM assumes that the processor is present. | ||
846 | */ | ||
847 | if (status == AE_NOT_FOUND) | ||
848 | return 1; | ||
849 | 843 | ||
850 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT)) | 844 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT)) |
851 | return 1; | 845 | return 1; |
852 | 846 | ||
853 | ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); | 847 | /* |
848 | * _STA is mandatory for a processor that supports hot plug | ||
849 | */ | ||
850 | if (status == AE_NOT_FOUND) | ||
851 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
852 | "Processor does not support hot plug\n")); | ||
853 | else | ||
854 | ACPI_EXCEPTION((AE_INFO, status, | ||
855 | "Processor Device is not present")); | ||
854 | return 0; | 856 | return 0; |
855 | } | 857 | } |
856 | 858 | ||
@@ -886,8 +888,8 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | |||
886 | return 0; | 888 | return 0; |
887 | } | 889 | } |
888 | 890 | ||
889 | static void | 891 | static void __ref acpi_processor_hotplug_notify(acpi_handle handle, |
890 | acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) | 892 | u32 event, void *data) |
891 | { | 893 | { |
892 | struct acpi_processor *pr; | 894 | struct acpi_processor *pr; |
893 | struct acpi_device *device = NULL; | 895 | struct acpi_device *device = NULL; |
@@ -897,9 +899,10 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) | |||
897 | switch (event) { | 899 | switch (event) { |
898 | case ACPI_NOTIFY_BUS_CHECK: | 900 | case ACPI_NOTIFY_BUS_CHECK: |
899 | case ACPI_NOTIFY_DEVICE_CHECK: | 901 | case ACPI_NOTIFY_DEVICE_CHECK: |
900 | printk("Processor driver received %s event\n", | 902 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
903 | "Processor driver received %s event\n", | ||
901 | (event == ACPI_NOTIFY_BUS_CHECK) ? | 904 | (event == ACPI_NOTIFY_BUS_CHECK) ? |
902 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); | 905 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK")); |
903 | 906 | ||
904 | if (!is_processor_present(handle)) | 907 | if (!is_processor_present(handle)) |
905 | break; | 908 | break; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 6f3b217699e9..788da9781f80 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -216,8 +216,10 @@ static void acpi_safe_halt(void) | |||
216 | * test NEED_RESCHED: | 216 | * test NEED_RESCHED: |
217 | */ | 217 | */ |
218 | smp_mb(); | 218 | smp_mb(); |
219 | if (!need_resched()) | 219 | if (!need_resched()) { |
220 | safe_halt(); | 220 | safe_halt(); |
221 | local_irq_disable(); | ||
222 | } | ||
221 | current_thread_info()->status |= TS_POLLING; | 223 | current_thread_info()->status |= TS_POLLING; |
222 | } | 224 | } |
223 | 225 | ||
@@ -421,7 +423,9 @@ static void acpi_processor_idle(void) | |||
421 | else | 423 | else |
422 | acpi_safe_halt(); | 424 | acpi_safe_halt(); |
423 | 425 | ||
424 | local_irq_enable(); | 426 | if (irqs_disabled()) |
427 | local_irq_enable(); | ||
428 | |||
425 | return; | 429 | return; |
426 | } | 430 | } |
427 | 431 | ||
@@ -530,7 +534,9 @@ static void acpi_processor_idle(void) | |||
530 | * skew otherwise. | 534 | * skew otherwise. |
531 | */ | 535 | */ |
532 | sleep_ticks = 0xFFFFFFFF; | 536 | sleep_ticks = 0xFFFFFFFF; |
533 | local_irq_enable(); | 537 | if (irqs_disabled()) |
538 | local_irq_enable(); | ||
539 | |||
534 | break; | 540 | break; |
535 | 541 | ||
536 | case ACPI_STATE_C2: | 542 | case ACPI_STATE_C2: |
@@ -1481,7 +1487,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1481 | return 0; | 1487 | return 0; |
1482 | } | 1488 | } |
1483 | 1489 | ||
1484 | acpi_unlazy_tlb(smp_processor_id()); | ||
1485 | /* | 1490 | /* |
1486 | * Must be done before busmaster disable as we might need to | 1491 | * Must be done before busmaster disable as we might need to |
1487 | * access HPET ! | 1492 | * access HPET ! |
@@ -1571,6 +1576,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1571 | return 0; | 1576 | return 0; |
1572 | } | 1577 | } |
1573 | 1578 | ||
1579 | acpi_unlazy_tlb(smp_processor_id()); | ||
1580 | |||
1574 | /* Tell the scheduler that we are going deep-idle: */ | 1581 | /* Tell the scheduler that we are going deep-idle: */ |
1575 | sched_clock_idle_sleep_event(); | 1582 | sched_clock_idle_sleep_event(); |
1576 | /* | 1583 | /* |
@@ -1686,7 +1693,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
1686 | switch (cx->type) { | 1693 | switch (cx->type) { |
1687 | case ACPI_STATE_C1: | 1694 | case ACPI_STATE_C1: |
1688 | state->flags |= CPUIDLE_FLAG_SHALLOW; | 1695 | state->flags |= CPUIDLE_FLAG_SHALLOW; |
1689 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | 1696 | if (cx->entry_method == ACPI_CSTATE_FFH) |
1697 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | ||
1698 | |||
1690 | state->enter = acpi_idle_enter_c1; | 1699 | state->enter = acpi_idle_enter_c1; |
1691 | dev->safe_state = state; | 1700 | dev->safe_state = state; |
1692 | break; | 1701 | break; |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index a2cf3008ce6c..bcf2c70fca87 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -130,7 +130,6 @@ static int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol, | |||
130 | goto end; | 130 | goto end; |
131 | } | 131 | } |
132 | smb_hc_write(hc, ACPI_SMB_COMMAND, command); | 132 | smb_hc_write(hc, ACPI_SMB_COMMAND, command); |
133 | smb_hc_write(hc, ACPI_SMB_COMMAND, command); | ||
134 | if (!(protocol & 0x01)) { | 133 | if (!(protocol & 0x01)) { |
135 | smb_hc_write(hc, ACPI_SMB_BLOCK_COUNT, length); | 134 | smb_hc_write(hc, ACPI_SMB_BLOCK_COUNT, length); |
136 | for (i = 0; i < length; ++i) | 135 | for (i = 0; i < length; ++i) |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 3fac011f9cf9..e6ce262b5d44 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -39,20 +39,26 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
39 | int size) | 39 | int size) |
40 | { | 40 | { |
41 | int len; | 41 | int len; |
42 | int count; | ||
42 | 43 | ||
43 | if (!acpi_dev->flags.hardware_id) | 44 | if (!acpi_dev->flags.hardware_id && !acpi_dev->flags.compatible_ids) |
44 | return -ENODEV; | 45 | return -ENODEV; |
45 | 46 | ||
46 | len = snprintf(modalias, size, "acpi:%s:", | 47 | len = snprintf(modalias, size, "acpi:"); |
47 | acpi_dev->pnp.hardware_id); | ||
48 | if (len < 0 || len >= size) | ||
49 | return -EINVAL; | ||
50 | size -= len; | 48 | size -= len; |
51 | 49 | ||
50 | if (acpi_dev->flags.hardware_id) { | ||
51 | count = snprintf(&modalias[len], size, "%s:", | ||
52 | acpi_dev->pnp.hardware_id); | ||
53 | if (count < 0 || count >= size) | ||
54 | return -EINVAL; | ||
55 | len += count; | ||
56 | size -= count; | ||
57 | } | ||
58 | |||
52 | if (acpi_dev->flags.compatible_ids) { | 59 | if (acpi_dev->flags.compatible_ids) { |
53 | struct acpi_compatible_id_list *cid_list; | 60 | struct acpi_compatible_id_list *cid_list; |
54 | int i; | 61 | int i; |
55 | int count; | ||
56 | 62 | ||
57 | cid_list = acpi_dev->pnp.cid_list; | 63 | cid_list = acpi_dev->pnp.cid_list; |
58 | for (i = 0; i < cid_list->count; i++) { | 64 | for (i = 0; i < cid_list->count; i++) { |
@@ -609,7 +615,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) | |||
609 | status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer); | 615 | status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer); |
610 | if (ACPI_SUCCESS(status)) { | 616 | if (ACPI_SUCCESS(status)) { |
611 | obj = buffer.pointer; | 617 | obj = buffer.pointer; |
612 | status = acpi_get_handle(NULL, obj->string.pointer, ejd); | 618 | status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer, |
619 | ejd); | ||
613 | kfree(buffer.pointer); | 620 | kfree(buffer.pointer); |
614 | } | 621 | } |
615 | return status; | 622 | return status; |
@@ -966,7 +973,7 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
966 | case ACPI_BUS_TYPE_DEVICE: | 973 | case ACPI_BUS_TYPE_DEVICE: |
967 | status = acpi_get_object_info(handle, &buffer); | 974 | status = acpi_get_object_info(handle, &buffer); |
968 | if (ACPI_FAILURE(status)) { | 975 | if (ACPI_FAILURE(status)) { |
969 | printk(KERN_ERR PREFIX "%s: Error reading device info\n", __FUNCTION__); | 976 | printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); |
970 | return; | 977 | return; |
971 | } | 978 | } |
972 | 979 | ||
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 293a1cbb47c0..d2f71a54726c 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -504,7 +504,7 @@ static void acpi_power_off_prepare(void) | |||
504 | static void acpi_power_off(void) | 504 | static void acpi_power_off(void) |
505 | { | 505 | { |
506 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ | 506 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
507 | printk("%s called\n", __FUNCTION__); | 507 | printk("%s called\n", __func__); |
508 | local_irq_disable(); | 508 | local_irq_disable(); |
509 | acpi_enable_wakeup_device(ACPI_STATE_S5); | 509 | acpi_enable_wakeup_device(ACPI_STATE_S5); |
510 | acpi_enter_sleep_state(ACPI_STATE_S5); | 510 | acpi_enter_sleep_state(ACPI_STATE_S5); |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 55cf4c05bb74..4749f379a915 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -319,7 +319,7 @@ void acpi_irq_stats_init(void) | |||
319 | goto fail; | 319 | goto fail; |
320 | 320 | ||
321 | for (i = 0; i < num_counters; ++i) { | 321 | for (i = 0; i < num_counters; ++i) { |
322 | char buffer[10]; | 322 | char buffer[12]; |
323 | char *name; | 323 | char *name; |
324 | 324 | ||
325 | if (i < num_gpes) | 325 | if (i < num_gpes) |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 8d4b79b4f933..c4e00ac8ea85 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -879,6 +879,8 @@ static void acpi_thermal_check(void *data) | |||
879 | } | 879 | } |
880 | 880 | ||
881 | /* sys I/F for generic thermal sysfs support */ | 881 | /* sys I/F for generic thermal sysfs support */ |
882 | #define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200) | ||
883 | |||
882 | static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) | 884 | static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) |
883 | { | 885 | { |
884 | struct acpi_thermal *tz = thermal->devdata; | 886 | struct acpi_thermal *tz = thermal->devdata; |
@@ -886,7 +888,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) | |||
886 | if (!tz) | 888 | if (!tz) |
887 | return -EINVAL; | 889 | return -EINVAL; |
888 | 890 | ||
889 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(tz->temperature)); | 891 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); |
890 | } | 892 | } |
891 | 893 | ||
892 | static const char enabled[] = "kernel"; | 894 | static const char enabled[] = "kernel"; |
@@ -980,21 +982,21 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
980 | 982 | ||
981 | if (tz->trips.critical.flags.valid) { | 983 | if (tz->trips.critical.flags.valid) { |
982 | if (!trip) | 984 | if (!trip) |
983 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( | 985 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( |
984 | tz->trips.critical.temperature)); | 986 | tz->trips.critical.temperature)); |
985 | trip--; | 987 | trip--; |
986 | } | 988 | } |
987 | 989 | ||
988 | if (tz->trips.hot.flags.valid) { | 990 | if (tz->trips.hot.flags.valid) { |
989 | if (!trip) | 991 | if (!trip) |
990 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( | 992 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( |
991 | tz->trips.hot.temperature)); | 993 | tz->trips.hot.temperature)); |
992 | trip--; | 994 | trip--; |
993 | } | 995 | } |
994 | 996 | ||
995 | if (tz->trips.passive.flags.valid) { | 997 | if (tz->trips.passive.flags.valid) { |
996 | if (!trip) | 998 | if (!trip) |
997 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( | 999 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( |
998 | tz->trips.passive.temperature)); | 1000 | tz->trips.passive.temperature)); |
999 | trip--; | 1001 | trip--; |
1000 | } | 1002 | } |
@@ -1002,7 +1004,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
1002 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && | 1004 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && |
1003 | tz->trips.active[i].flags.valid; i++) { | 1005 | tz->trips.active[i].flags.valid; i++) { |
1004 | if (!trip) | 1006 | if (!trip) |
1005 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( | 1007 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( |
1006 | tz->trips.active[i].temperature)); | 1008 | tz->trips.active[i].temperature)); |
1007 | trip--; | 1009 | trip--; |
1008 | } | 1010 | } |
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index 9e8c20c6a0b7..0a43c8e0eff3 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -99,6 +99,13 @@ MODULE_LICENSE("GPL"); | |||
99 | #define HCI_VIDEO_OUT_CRT 0x2 | 99 | #define HCI_VIDEO_OUT_CRT 0x2 |
100 | #define HCI_VIDEO_OUT_TV 0x4 | 100 | #define HCI_VIDEO_OUT_TV 0x4 |
101 | 101 | ||
102 | static const struct acpi_device_id toshiba_device_ids[] = { | ||
103 | {"TOS6200", 0}, | ||
104 | {"TOS1900", 0}, | ||
105 | {"", 0}, | ||
106 | }; | ||
107 | MODULE_DEVICE_TABLE(acpi, toshiba_device_ids); | ||
108 | |||
102 | /* utility | 109 | /* utility |
103 | */ | 110 | */ |
104 | 111 | ||
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index c7e128e5369b..7361204b1eef 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -109,7 +109,7 @@ void acpi_ut_track_stack_ptr(void) | |||
109 | * RETURN: Updated pointer to the function name | 109 | * RETURN: Updated pointer to the function name |
110 | * | 110 | * |
111 | * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. | 111 | * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. |
112 | * This allows compiler macros such as __FUNCTION__ to be used | 112 | * This allows compiler macros such as __func__ to be used |
113 | * with no change to the debug output. | 113 | * with no change to the debug output. |
114 | * | 114 | * |
115 | ******************************************************************************/ | 115 | ******************************************************************************/ |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 76ee766c84f9..e08b3fa6639f 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -432,7 +432,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
432 | * element -- which is legal) | 432 | * element -- which is legal) |
433 | */ | 433 | */ |
434 | if (!internal_object) { | 434 | if (!internal_object) { |
435 | *obj_length = 0; | 435 | *obj_length = sizeof(union acpi_object); |
436 | return_ACPI_STATUS(AE_OK); | 436 | return_ACPI_STATUS(AE_OK); |
437 | } | 437 | } |
438 | 438 | ||
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index eba55b7d6c95..44ea60cf21c0 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -407,6 +407,12 @@ acpi_evaluate_reference(acpi_handle handle, | |||
407 | break; | 407 | break; |
408 | } | 408 | } |
409 | 409 | ||
410 | if (!element->reference.handle) { | ||
411 | printk(KERN_WARNING PREFIX "Invalid reference in" | ||
412 | " package %s\n", pathname); | ||
413 | status = AE_NULL_ENTRY; | ||
414 | break; | ||
415 | } | ||
410 | /* Get the acpi_handle. */ | 416 | /* Get the acpi_handle. */ |
411 | 417 | ||
412 | list->handles[i] = element->reference.handle; | 418 | list->handles[i] = element->reference.handle; |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 12cce69b5441..12fb44f16766 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -713,7 +713,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
713 | 713 | ||
714 | kfree(obj); | 714 | kfree(obj); |
715 | 715 | ||
716 | if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){ | 716 | if (device->cap._BCL && device->cap._BCM && max_level > 0) { |
717 | int result; | 717 | int result; |
718 | static int count = 0; | 718 | static int count = 0; |
719 | char *name; | 719 | char *name; |
@@ -807,40 +807,11 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | |||
807 | static int acpi_video_bus_check(struct acpi_video_bus *video) | 807 | static int acpi_video_bus_check(struct acpi_video_bus *video) |
808 | { | 808 | { |
809 | acpi_status status = -ENOENT; | 809 | acpi_status status = -ENOENT; |
810 | long device_id; | 810 | |
811 | struct device *dev; | ||
812 | struct acpi_device *device; | ||
813 | 811 | ||
814 | if (!video) | 812 | if (!video) |
815 | return -EINVAL; | 813 | return -EINVAL; |
816 | 814 | ||
817 | device = video->device; | ||
818 | |||
819 | status = | ||
820 | acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); | ||
821 | |||
822 | if (!ACPI_SUCCESS(status)) | ||
823 | return -ENODEV; | ||
824 | |||
825 | /* We need to attempt to determine whether the _ADR refers to a | ||
826 | PCI device or not. There's no terribly good way to do this, | ||
827 | so the best we can hope for is to assume that there'll never | ||
828 | be a video device in the host bridge */ | ||
829 | if (device_id >= 0x10000) { | ||
830 | /* It looks like a PCI device. Does it exist? */ | ||
831 | dev = acpi_get_physical_device(device->handle); | ||
832 | } else { | ||
833 | /* It doesn't look like a PCI device. Does its parent | ||
834 | exist? */ | ||
835 | acpi_handle phandle; | ||
836 | if (acpi_get_parent(device->handle, &phandle)) | ||
837 | return -ENODEV; | ||
838 | dev = acpi_get_physical_device(phandle); | ||
839 | } | ||
840 | if (!dev) | ||
841 | return -ENODEV; | ||
842 | put_device(dev); | ||
843 | |||
844 | /* Since there is no HID, CID and so on for VGA driver, we have | 815 | /* Since there is no HID, CID and so on for VGA driver, we have |
845 | * to check well known required nodes. | 816 | * to check well known required nodes. |
846 | */ | 817 | */ |
@@ -1201,7 +1172,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) | |||
1201 | if (!video) | 1172 | if (!video) |
1202 | goto end; | 1173 | goto end; |
1203 | 1174 | ||
1204 | printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__); | 1175 | printk(KERN_INFO PREFIX "Please implement %s\n", __func__); |
1205 | seq_printf(seq, "<TODO>\n"); | 1176 | seq_printf(seq, "<TODO>\n"); |
1206 | 1177 | ||
1207 | end: | 1178 | end: |
@@ -1366,37 +1337,8 @@ acpi_video_bus_write_DOS(struct file *file, | |||
1366 | 1337 | ||
1367 | static int acpi_video_bus_add_fs(struct acpi_device *device) | 1338 | static int acpi_video_bus_add_fs(struct acpi_device *device) |
1368 | { | 1339 | { |
1369 | long device_id; | ||
1370 | int status; | ||
1371 | struct proc_dir_entry *entry = NULL; | 1340 | struct proc_dir_entry *entry = NULL; |
1372 | struct acpi_video_bus *video; | 1341 | struct acpi_video_bus *video; |
1373 | struct device *dev; | ||
1374 | |||
1375 | status = | ||
1376 | acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); | ||
1377 | |||
1378 | if (!ACPI_SUCCESS(status)) | ||
1379 | return -ENODEV; | ||
1380 | |||
1381 | /* We need to attempt to determine whether the _ADR refers to a | ||
1382 | PCI device or not. There's no terribly good way to do this, | ||
1383 | so the best we can hope for is to assume that there'll never | ||
1384 | be a video device in the host bridge */ | ||
1385 | if (device_id >= 0x10000) { | ||
1386 | /* It looks like a PCI device. Does it exist? */ | ||
1387 | dev = acpi_get_physical_device(device->handle); | ||
1388 | } else { | ||
1389 | /* It doesn't look like a PCI device. Does its parent | ||
1390 | exist? */ | ||
1391 | acpi_handle phandle; | ||
1392 | if (acpi_get_parent(device->handle, &phandle)) | ||
1393 | return -ENODEV; | ||
1394 | dev = acpi_get_physical_device(phandle); | ||
1395 | } | ||
1396 | if (!dev) | ||
1397 | return -ENODEV; | ||
1398 | put_device(dev); | ||
1399 | |||
1400 | 1342 | ||
1401 | 1343 | ||
1402 | video = acpi_driver_data(device); | 1344 | video = acpi_driver_data(device); |
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c index efacc9f8bfe3..c33b1c6e93b1 100644 --- a/drivers/acpi/wmi.c +++ b/drivers/acpi/wmi.c | |||
@@ -293,7 +293,7 @@ struct acpi_buffer *out) | |||
293 | { | 293 | { |
294 | struct guid_block *block = NULL; | 294 | struct guid_block *block = NULL; |
295 | struct wmi_block *wblock = NULL; | 295 | struct wmi_block *wblock = NULL; |
296 | acpi_handle handle; | 296 | acpi_handle handle, wc_handle; |
297 | acpi_status status, wc_status = AE_ERROR; | 297 | acpi_status status, wc_status = AE_ERROR; |
298 | struct acpi_object_list input, wc_input; | 298 | struct acpi_object_list input, wc_input; |
299 | union acpi_object wc_params[1], wq_params[1]; | 299 | union acpi_object wc_params[1], wq_params[1]; |
@@ -338,8 +338,10 @@ struct acpi_buffer *out) | |||
338 | * expensive, but have no corresponding WCxx method. So we | 338 | * expensive, but have no corresponding WCxx method. So we |
339 | * should not fail if this happens. | 339 | * should not fail if this happens. |
340 | */ | 340 | */ |
341 | wc_status = acpi_evaluate_object(handle, wc_method, | 341 | wc_status = acpi_get_handle(handle, wc_method, &wc_handle); |
342 | &wc_input, NULL); | 342 | if (ACPI_SUCCESS(wc_status)) |
343 | wc_status = acpi_evaluate_object(handle, wc_method, | ||
344 | &wc_input, NULL); | ||
343 | } | 345 | } |
344 | 346 | ||
345 | strcpy(method, "WQ"); | 347 | strcpy(method, "WQ"); |
@@ -351,7 +353,7 @@ struct acpi_buffer *out) | |||
351 | * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if | 353 | * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if |
352 | * the WQxx method failed - we should disable collection anyway. | 354 | * the WQxx method failed - we should disable collection anyway. |
353 | */ | 355 | */ |
354 | if ((block->flags & ACPI_WMI_EXPENSIVE) && wc_status) { | 356 | if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) { |
355 | wc_params[0].integer.value = 0; | 357 | wc_params[0].integer.value = 0; |
356 | status = acpi_evaluate_object(handle, | 358 | status = acpi_evaluate_object(handle, |
357 | wc_method, &wc_input, NULL); | 359 | wc_method, &wc_input, NULL); |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index e469647330de..25aba69b59b4 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -30,6 +30,7 @@ config ATA_NONSTANDARD | |||
30 | config ATA_ACPI | 30 | config ATA_ACPI |
31 | bool | 31 | bool |
32 | depends on ACPI && PCI | 32 | depends on ACPI && PCI |
33 | select ACPI_DOCK | ||
33 | default y | 34 | default y |
34 | help | 35 | help |
35 | This option adds support for ATA-related ACPI objects. | 36 | This option adds support for ATA-related ACPI objects. |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 6978469eb16d..b1eb4e24c86a 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -49,6 +49,10 @@ | |||
49 | #define DRV_NAME "ahci" | 49 | #define DRV_NAME "ahci" |
50 | #define DRV_VERSION "3.0" | 50 | #define DRV_VERSION "3.0" |
51 | 51 | ||
52 | static int ahci_skip_host_reset; | ||
53 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); | ||
54 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); | ||
55 | |||
52 | static int ahci_enable_alpm(struct ata_port *ap, | 56 | static int ahci_enable_alpm(struct ata_port *ap, |
53 | enum link_pm policy); | 57 | enum link_pm policy); |
54 | static void ahci_disable_alpm(struct ata_port *ap); | 58 | static void ahci_disable_alpm(struct ata_port *ap); |
@@ -429,6 +433,7 @@ static const struct ata_port_info ahci_port_info[] = { | |||
429 | /* board_ahci_sb600 */ | 433 | /* board_ahci_sb600 */ |
430 | { | 434 | { |
431 | AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | | 435 | AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | |
436 | AHCI_HFLAG_32BIT_ONLY | | ||
432 | AHCI_HFLAG_SECT255 | AHCI_HFLAG_NO_PMP), | 437 | AHCI_HFLAG_SECT255 | AHCI_HFLAG_NO_PMP), |
433 | .flags = AHCI_FLAG_COMMON, | 438 | .flags = AHCI_FLAG_COMMON, |
434 | .link_flags = AHCI_LFLAG_COMMON, | 439 | .link_flags = AHCI_LFLAG_COMMON, |
@@ -587,6 +592,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
587 | 592 | ||
588 | /* Marvell */ | 593 | /* Marvell */ |
589 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ | 594 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
595 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ | ||
590 | 596 | ||
591 | /* Generic, PCI class code for AHCI */ | 597 | /* Generic, PCI class code for AHCI */ |
592 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 598 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -661,6 +667,7 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
661 | void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; | 667 | void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; |
662 | u32 cap, port_map; | 668 | u32 cap, port_map; |
663 | int i; | 669 | int i; |
670 | int mv; | ||
664 | 671 | ||
665 | /* make sure AHCI mode is enabled before accessing CAP */ | 672 | /* make sure AHCI mode is enabled before accessing CAP */ |
666 | ahci_enable_ahci(mmio); | 673 | ahci_enable_ahci(mmio); |
@@ -696,12 +703,16 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
696 | * presence register, as bit 4 (counting from 0) | 703 | * presence register, as bit 4 (counting from 0) |
697 | */ | 704 | */ |
698 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { | 705 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { |
706 | if (pdev->device == 0x6121) | ||
707 | mv = 0x3; | ||
708 | else | ||
709 | mv = 0xf; | ||
699 | dev_printk(KERN_ERR, &pdev->dev, | 710 | dev_printk(KERN_ERR, &pdev->dev, |
700 | "MV_AHCI HACK: port_map %x -> %x\n", | 711 | "MV_AHCI HACK: port_map %x -> %x\n", |
701 | hpriv->port_map, | 712 | port_map, |
702 | hpriv->port_map & 0xf); | 713 | port_map & mv); |
703 | 714 | ||
704 | port_map &= 0xf; | 715 | port_map &= mv; |
705 | } | 716 | } |
706 | 717 | ||
707 | /* cross check port_map and cap.n_ports */ | 718 | /* cross check port_map and cap.n_ports */ |
@@ -1088,29 +1099,35 @@ static int ahci_reset_controller(struct ata_host *host) | |||
1088 | ahci_enable_ahci(mmio); | 1099 | ahci_enable_ahci(mmio); |
1089 | 1100 | ||
1090 | /* global controller reset */ | 1101 | /* global controller reset */ |
1091 | tmp = readl(mmio + HOST_CTL); | 1102 | if (!ahci_skip_host_reset) { |
1092 | if ((tmp & HOST_RESET) == 0) { | 1103 | tmp = readl(mmio + HOST_CTL); |
1093 | writel(tmp | HOST_RESET, mmio + HOST_CTL); | 1104 | if ((tmp & HOST_RESET) == 0) { |
1094 | readl(mmio + HOST_CTL); /* flush */ | 1105 | writel(tmp | HOST_RESET, mmio + HOST_CTL); |
1095 | } | 1106 | readl(mmio + HOST_CTL); /* flush */ |
1107 | } | ||
1096 | 1108 | ||
1097 | /* reset must complete within 1 second, or | 1109 | /* reset must complete within 1 second, or |
1098 | * the hardware should be considered fried. | 1110 | * the hardware should be considered fried. |
1099 | */ | 1111 | */ |
1100 | ssleep(1); | 1112 | ssleep(1); |
1101 | 1113 | ||
1102 | tmp = readl(mmio + HOST_CTL); | 1114 | tmp = readl(mmio + HOST_CTL); |
1103 | if (tmp & HOST_RESET) { | 1115 | if (tmp & HOST_RESET) { |
1104 | dev_printk(KERN_ERR, host->dev, | 1116 | dev_printk(KERN_ERR, host->dev, |
1105 | "controller reset failed (0x%x)\n", tmp); | 1117 | "controller reset failed (0x%x)\n", tmp); |
1106 | return -EIO; | 1118 | return -EIO; |
1107 | } | 1119 | } |
1108 | 1120 | ||
1109 | /* turn on AHCI mode */ | 1121 | /* turn on AHCI mode */ |
1110 | ahci_enable_ahci(mmio); | 1122 | ahci_enable_ahci(mmio); |
1111 | 1123 | ||
1112 | /* some registers might be cleared on reset. restore initial values */ | 1124 | /* Some registers might be cleared on reset. Restore |
1113 | ahci_restore_initial_config(host); | 1125 | * initial values. |
1126 | */ | ||
1127 | ahci_restore_initial_config(host); | ||
1128 | } else | ||
1129 | dev_printk(KERN_INFO, host->dev, | ||
1130 | "skipping global host reset\n"); | ||
1114 | 1131 | ||
1115 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { | 1132 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { |
1116 | u16 tmp16; | 1133 | u16 tmp16; |
@@ -1162,9 +1179,14 @@ static void ahci_init_controller(struct ata_host *host) | |||
1162 | int i; | 1179 | int i; |
1163 | void __iomem *port_mmio; | 1180 | void __iomem *port_mmio; |
1164 | u32 tmp; | 1181 | u32 tmp; |
1182 | int mv; | ||
1165 | 1183 | ||
1166 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { | 1184 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { |
1167 | port_mmio = __ahci_port_base(host, 4); | 1185 | if (pdev->device == 0x6121) |
1186 | mv = 2; | ||
1187 | else | ||
1188 | mv = 4; | ||
1189 | port_mmio = __ahci_port_base(host, mv); | ||
1168 | 1190 | ||
1169 | writel(0, port_mmio + PORT_IRQ_MASK); | 1191 | writel(0, port_mmio + PORT_IRQ_MASK); |
1170 | 1192 | ||
@@ -1196,8 +1218,11 @@ static void ahci_dev_config(struct ata_device *dev) | |||
1196 | { | 1218 | { |
1197 | struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; | 1219 | struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; |
1198 | 1220 | ||
1199 | if (hpriv->flags & AHCI_HFLAG_SECT255) | 1221 | if (hpriv->flags & AHCI_HFLAG_SECT255) { |
1200 | dev->max_sectors = 255; | 1222 | dev->max_sectors = 255; |
1223 | ata_dev_printk(dev, KERN_INFO, | ||
1224 | "SB600 AHCI: limiting to 255 sectors per cmd\n"); | ||
1225 | } | ||
1201 | } | 1226 | } |
1202 | 1227 | ||
1203 | static unsigned int ahci_dev_classify(struct ata_port *ap) | 1228 | static unsigned int ahci_dev_classify(struct ata_port *ap) |
@@ -2241,7 +2266,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2241 | if (rc) | 2266 | if (rc) |
2242 | return rc; | 2267 | return rc; |
2243 | 2268 | ||
2244 | rc = pcim_iomap_regions(pdev, 1 << AHCI_PCI_BAR, DRV_NAME); | 2269 | /* AHCI controllers often implement SFF compatible interface. |
2270 | * Grab all PCI BARs just in case. | ||
2271 | */ | ||
2272 | rc = pcim_iomap_regions_request_all(pdev, 1 << AHCI_PCI_BAR, DRV_NAME); | ||
2245 | if (rc == -EBUSY) | 2273 | if (rc == -EBUSY) |
2246 | pcim_pin_device(pdev); | 2274 | pcim_pin_device(pdev); |
2247 | if (rc) | 2275 | if (rc) |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 0770cb7391a4..bf98a566adac 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -118,45 +118,77 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap) | |||
118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | 118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; |
119 | } | 119 | } |
120 | 120 | ||
121 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct kobject *kobj, | 121 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, |
122 | u32 event) | 122 | u32 event) |
123 | { | 123 | { |
124 | char event_string[12]; | 124 | char event_string[12]; |
125 | char *envp[] = { event_string, NULL }; | 125 | char *envp[] = { event_string, NULL }; |
126 | struct ata_eh_info *ehi = &ap->link.eh_info; | 126 | struct ata_eh_info *ehi; |
127 | 127 | struct kobject *kobj = NULL; | |
128 | if (event == 0 || event == 1) { | 128 | int wait = 0; |
129 | unsigned long flags; | 129 | unsigned long flags; |
130 | spin_lock_irqsave(ap->lock, flags); | 130 | |
131 | ata_ehi_clear_desc(ehi); | 131 | if (!ap) |
132 | ata_ehi_push_desc(ehi, "ACPI event"); | 132 | ap = dev->link->ap; |
133 | ata_ehi_hotplugged(ehi); | 133 | ehi = &ap->link.eh_info; |
134 | ata_port_freeze(ap); | 134 | |
135 | spin_unlock_irqrestore(ap->lock, flags); | 135 | spin_lock_irqsave(ap->lock, flags); |
136 | |||
137 | switch (event) { | ||
138 | case ACPI_NOTIFY_BUS_CHECK: | ||
139 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
140 | ata_ehi_push_desc(ehi, "ACPI event"); | ||
141 | ata_ehi_hotplugged(ehi); | ||
142 | ata_port_freeze(ap); | ||
143 | break; | ||
144 | |||
145 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
146 | ata_ehi_push_desc(ehi, "ACPI event"); | ||
147 | if (dev) | ||
148 | dev->flags |= ATA_DFLAG_DETACH; | ||
149 | else { | ||
150 | struct ata_link *tlink; | ||
151 | struct ata_device *tdev; | ||
152 | |||
153 | ata_port_for_each_link(tlink, ap) | ||
154 | ata_link_for_each_dev(tdev, tlink) | ||
155 | tdev->flags |= ATA_DFLAG_DETACH; | ||
156 | } | ||
157 | |||
158 | ata_port_schedule_eh(ap); | ||
159 | wait = 1; | ||
160 | break; | ||
136 | } | 161 | } |
137 | 162 | ||
163 | if (dev) { | ||
164 | if (dev->sdev) | ||
165 | kobj = &dev->sdev->sdev_gendev.kobj; | ||
166 | } else | ||
167 | kobj = &ap->dev->kobj; | ||
168 | |||
138 | if (kobj) { | 169 | if (kobj) { |
139 | sprintf(event_string, "BAY_EVENT=%d", event); | 170 | sprintf(event_string, "BAY_EVENT=%d", event); |
140 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); | 171 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); |
141 | } | 172 | } |
173 | |||
174 | spin_unlock_irqrestore(ap->lock, flags); | ||
175 | |||
176 | if (wait) | ||
177 | ata_port_wait_eh(ap); | ||
142 | } | 178 | } |
143 | 179 | ||
144 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) | 180 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) |
145 | { | 181 | { |
146 | struct ata_device *dev = data; | 182 | struct ata_device *dev = data; |
147 | struct kobject *kobj = NULL; | ||
148 | 183 | ||
149 | if (dev->sdev) | 184 | ata_acpi_handle_hotplug(NULL, dev, event); |
150 | kobj = &dev->sdev->sdev_gendev.kobj; | ||
151 | |||
152 | ata_acpi_handle_hotplug(dev->link->ap, kobj, event); | ||
153 | } | 185 | } |
154 | 186 | ||
155 | static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data) | 187 | static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data) |
156 | { | 188 | { |
157 | struct ata_port *ap = data; | 189 | struct ata_port *ap = data; |
158 | 190 | ||
159 | ata_acpi_handle_hotplug(ap, &ap->dev->kobj, event); | 191 | ata_acpi_handle_hotplug(ap, NULL, event); |
160 | } | 192 | } |
161 | 193 | ||
162 | /** | 194 | /** |
@@ -191,20 +223,30 @@ void ata_acpi_associate(struct ata_host *host) | |||
191 | else | 223 | else |
192 | ata_acpi_associate_ide_port(ap); | 224 | ata_acpi_associate_ide_port(ap); |
193 | 225 | ||
194 | if (ap->acpi_handle) | 226 | if (ap->acpi_handle) { |
195 | acpi_install_notify_handler (ap->acpi_handle, | 227 | acpi_install_notify_handler(ap->acpi_handle, |
196 | ACPI_SYSTEM_NOTIFY, | 228 | ACPI_SYSTEM_NOTIFY, |
197 | ata_acpi_ap_notify, | 229 | ata_acpi_ap_notify, ap); |
198 | ap); | 230 | #if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE) |
231 | /* we might be on a docking station */ | ||
232 | register_hotplug_dock_device(ap->acpi_handle, | ||
233 | ata_acpi_ap_notify, ap); | ||
234 | #endif | ||
235 | } | ||
199 | 236 | ||
200 | for (j = 0; j < ata_link_max_devices(&ap->link); j++) { | 237 | for (j = 0; j < ata_link_max_devices(&ap->link); j++) { |
201 | struct ata_device *dev = &ap->link.device[j]; | 238 | struct ata_device *dev = &ap->link.device[j]; |
202 | 239 | ||
203 | if (dev->acpi_handle) | 240 | if (dev->acpi_handle) { |
204 | acpi_install_notify_handler (dev->acpi_handle, | 241 | acpi_install_notify_handler(dev->acpi_handle, |
205 | ACPI_SYSTEM_NOTIFY, | 242 | ACPI_SYSTEM_NOTIFY, |
206 | ata_acpi_dev_notify, | 243 | ata_acpi_dev_notify, dev); |
207 | dev); | 244 | #if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE) |
245 | /* we might be on a docking station */ | ||
246 | register_hotplug_dock_device(dev->acpi_handle, | ||
247 | ata_acpi_dev_notify, dev); | ||
248 | #endif | ||
249 | } | ||
208 | } | 250 | } |
209 | } | 251 | } |
210 | } | 252 | } |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4bbe31f98ef8..48519887f94a 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -972,7 +972,7 @@ static void ata_dev_disable_pm(struct ata_device *dev) | |||
972 | void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy) | 972 | void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy) |
973 | { | 973 | { |
974 | ap->pm_policy = policy; | 974 | ap->pm_policy = policy; |
975 | ap->link.eh_info.action |= ATA_EHI_LPM; | 975 | ap->link.eh_info.action |= ATA_EH_LPM; |
976 | ap->link.eh_info.flags |= ATA_EHI_NO_AUTOPSY; | 976 | ap->link.eh_info.flags |= ATA_EHI_NO_AUTOPSY; |
977 | ata_port_schedule_eh(ap); | 977 | ata_port_schedule_eh(ap); |
978 | } | 978 | } |
@@ -1416,12 +1416,12 @@ static int ata_hpa_resize(struct ata_device *dev) | |||
1416 | /* read native max address */ | 1416 | /* read native max address */ |
1417 | rc = ata_read_native_max_address(dev, &native_sectors); | 1417 | rc = ata_read_native_max_address(dev, &native_sectors); |
1418 | if (rc) { | 1418 | if (rc) { |
1419 | /* If HPA isn't going to be unlocked, skip HPA | 1419 | /* If device aborted the command or HPA isn't going to |
1420 | * resizing from the next try. | 1420 | * be unlocked, skip HPA resizing. |
1421 | */ | 1421 | */ |
1422 | if (!ata_ignore_hpa) { | 1422 | if (rc == -EACCES || !ata_ignore_hpa) { |
1423 | ata_dev_printk(dev, KERN_WARNING, "HPA support seems " | 1423 | ata_dev_printk(dev, KERN_WARNING, "HPA support seems " |
1424 | "broken, will skip HPA handling\n"); | 1424 | "broken, skipping HPA handling\n"); |
1425 | dev->horkage |= ATA_HORKAGE_BROKEN_HPA; | 1425 | dev->horkage |= ATA_HORKAGE_BROKEN_HPA; |
1426 | 1426 | ||
1427 | /* we can continue if device aborted the command */ | 1427 | /* we can continue if device aborted the command */ |
@@ -2092,24 +2092,34 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
2092 | id, sizeof(id[0]) * ATA_ID_WORDS, 0); | 2092 | id, sizeof(id[0]) * ATA_ID_WORDS, 0); |
2093 | if (err_mask) { | 2093 | if (err_mask) { |
2094 | if (err_mask & AC_ERR_NODEV_HINT) { | 2094 | if (err_mask & AC_ERR_NODEV_HINT) { |
2095 | DPRINTK("ata%u.%d: NODEV after polling detection\n", | 2095 | ata_dev_printk(dev, KERN_DEBUG, |
2096 | ap->print_id, dev->devno); | 2096 | "NODEV after polling detection\n"); |
2097 | return -ENOENT; | 2097 | return -ENOENT; |
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | /* Device or controller might have reported the wrong | 2100 | if ((err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) { |
2101 | * device class. Give a shot at the other IDENTIFY if | 2101 | /* Device or controller might have reported |
2102 | * the current one is aborted by the device. | 2102 | * the wrong device class. Give a shot at the |
2103 | */ | 2103 | * other IDENTIFY if the current one is |
2104 | if (may_fallback && | 2104 | * aborted by the device. |
2105 | (err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) { | 2105 | */ |
2106 | may_fallback = 0; | 2106 | if (may_fallback) { |
2107 | may_fallback = 0; | ||
2107 | 2108 | ||
2108 | if (class == ATA_DEV_ATA) | 2109 | if (class == ATA_DEV_ATA) |
2109 | class = ATA_DEV_ATAPI; | 2110 | class = ATA_DEV_ATAPI; |
2110 | else | 2111 | else |
2111 | class = ATA_DEV_ATA; | 2112 | class = ATA_DEV_ATA; |
2112 | goto retry; | 2113 | goto retry; |
2114 | } | ||
2115 | |||
2116 | /* Control reaches here iff the device aborted | ||
2117 | * both flavors of IDENTIFYs which happens | ||
2118 | * sometimes with phantom devices. | ||
2119 | */ | ||
2120 | ata_dev_printk(dev, KERN_DEBUG, | ||
2121 | "both IDENTIFYs aborted, assuming NODEV\n"); | ||
2122 | return -ENOENT; | ||
2113 | } | 2123 | } |
2114 | 2124 | ||
2115 | rc = -EIO; | 2125 | rc = -EIO; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 681252fd8143..a5830329eda4 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2748,7 +2748,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2748 | ehc->i.flags &= ~ATA_EHI_SETMODE; | 2748 | ehc->i.flags &= ~ATA_EHI_SETMODE; |
2749 | } | 2749 | } |
2750 | 2750 | ||
2751 | if (ehc->i.action & ATA_EHI_LPM) | 2751 | if (ehc->i.action & ATA_EH_LPM) |
2752 | ata_link_for_each_dev(dev, link) | 2752 | ata_link_for_each_dev(dev, link) |
2753 | ata_dev_enable_pm(dev, ap->pm_policy); | 2753 | ata_dev_enable_pm(dev, ap->pm_policy); |
2754 | 2754 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 8f0e8f2bc628..15795394b0a8 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -527,6 +527,14 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, | |||
527 | return qc; | 527 | return qc; |
528 | } | 528 | } |
529 | 529 | ||
530 | static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc) | ||
531 | { | ||
532 | struct scsi_cmnd *scmd = qc->scsicmd; | ||
533 | |||
534 | qc->extrabytes = scmd->request->extra_len; | ||
535 | qc->nbytes = scsi_bufflen(scmd) + qc->extrabytes; | ||
536 | } | ||
537 | |||
530 | /** | 538 | /** |
531 | * ata_dump_status - user friendly display of error info | 539 | * ata_dump_status - user friendly display of error info |
532 | * @id: id of the port in question | 540 | * @id: id of the port in question |
@@ -2539,7 +2547,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2539 | } | 2547 | } |
2540 | 2548 | ||
2541 | qc->tf.command = ATA_CMD_PACKET; | 2549 | qc->tf.command = ATA_CMD_PACKET; |
2542 | qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len; | 2550 | ata_qc_set_pc_nbytes(qc); |
2543 | 2551 | ||
2544 | /* check whether ATAPI DMA is safe */ | 2552 | /* check whether ATAPI DMA is safe */ |
2545 | if (!using_pio && ata_check_atapi_dma(qc)) | 2553 | if (!using_pio && ata_check_atapi_dma(qc)) |
@@ -2550,7 +2558,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2550 | * want to set it properly, and for DMA where it is | 2558 | * want to set it properly, and for DMA where it is |
2551 | * effectively meaningless. | 2559 | * effectively meaningless. |
2552 | */ | 2560 | */ |
2553 | nbytes = min(scmd->request->data_len, (unsigned int)63 * 1024); | 2561 | nbytes = min(ata_qc_raw_nbytes(qc), (unsigned int)63 * 1024); |
2554 | 2562 | ||
2555 | /* Most ATAPI devices which honor transfer chunk size don't | 2563 | /* Most ATAPI devices which honor transfer chunk size don't |
2556 | * behave according to the spec when odd chunk size which | 2564 | * behave according to the spec when odd chunk size which |
@@ -2876,7 +2884,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) | |||
2876 | * TODO: find out if we need to do more here to | 2884 | * TODO: find out if we need to do more here to |
2877 | * cover scatter/gather case. | 2885 | * cover scatter/gather case. |
2878 | */ | 2886 | */ |
2879 | qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len; | 2887 | ata_qc_set_pc_nbytes(qc); |
2880 | 2888 | ||
2881 | /* request result TF and be quiet about device error */ | 2889 | /* request result TF and be quiet about device error */ |
2882 | qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; | 2890 | qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 7e68edf3c0f3..8786455c901d 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -295,7 +295,7 @@ static void ali_lock_sectors(struct ata_device *adev) | |||
295 | static int ali_check_atapi_dma(struct ata_queued_cmd *qc) | 295 | static int ali_check_atapi_dma(struct ata_queued_cmd *qc) |
296 | { | 296 | { |
297 | /* If its not a media command, its not worth it */ | 297 | /* If its not a media command, its not worth it */ |
298 | if (qc->nbytes < 2048) | 298 | if (atapi_cmd_type(qc->cdb[0]) == ATAPI_MISC) |
299 | return -EOPNOTSUPP; | 299 | return -EOPNOTSUPP; |
300 | return 0; | 300 | return 0; |
301 | } | 301 | } |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 109ddd42c266..257951d03dbb 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -564,7 +564,7 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc) | |||
564 | struct it821x_dev *itdev = ap->private_data; | 564 | struct it821x_dev *itdev = ap->private_data; |
565 | 565 | ||
566 | /* Only use dma for transfers to/from the media. */ | 566 | /* Only use dma for transfers to/from the media. */ |
567 | if (qc->nbytes < 2048) | 567 | if (ata_qc_raw_nbytes(qc) < 2048) |
568 | return -EOPNOTSUPP; | 568 | return -EOPNOTSUPP; |
569 | 569 | ||
570 | /* No ATAPI DMA in smart mode */ | 570 | /* No ATAPI DMA in smart mode */ |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index 503245a1eafa..3988e44f4934 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -269,7 +269,11 @@ static u8 sil680_init_chip(struct pci_dev *pdev, int *try_mmio) | |||
269 | dev_dbg(&pdev->dev, "sil680: BA5_EN = %d clock = %02X\n", | 269 | dev_dbg(&pdev->dev, "sil680: BA5_EN = %d clock = %02X\n", |
270 | tmpbyte & 1, tmpbyte & 0x30); | 270 | tmpbyte & 1, tmpbyte & 0x30); |
271 | 271 | ||
272 | *try_mmio = (tmpbyte & 1) || pci_resource_start(pdev, 5); | 272 | *try_mmio = 0; |
273 | #ifdef CONFIG_PPC | ||
274 | if (machine_is(cell)) | ||
275 | *try_mmio = (tmpbyte & 1) || pci_resource_start(pdev, 5); | ||
276 | #endif | ||
273 | 277 | ||
274 | switch(tmpbyte & 0x30) { | 278 | switch(tmpbyte & 0x30) { |
275 | case 0x00: | 279 | case 0x00: |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index f251a5f569d5..11c1afea2db2 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "sata_promise.h" | 46 | #include "sata_promise.h" |
47 | 47 | ||
48 | #define DRV_NAME "sata_promise" | 48 | #define DRV_NAME "sata_promise" |
49 | #define DRV_VERSION "2.11" | 49 | #define DRV_VERSION "2.12" |
50 | 50 | ||
51 | enum { | 51 | enum { |
52 | PDC_MAX_PORTS = 4, | 52 | PDC_MAX_PORTS = 4, |
@@ -145,7 +145,9 @@ static int pdc_old_sata_check_atapi_dma(struct ata_queued_cmd *qc); | |||
145 | static void pdc_irq_clear(struct ata_port *ap); | 145 | static void pdc_irq_clear(struct ata_port *ap); |
146 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); | 146 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); |
147 | static void pdc_freeze(struct ata_port *ap); | 147 | static void pdc_freeze(struct ata_port *ap); |
148 | static void pdc_sata_freeze(struct ata_port *ap); | ||
148 | static void pdc_thaw(struct ata_port *ap); | 149 | static void pdc_thaw(struct ata_port *ap); |
150 | static void pdc_sata_thaw(struct ata_port *ap); | ||
149 | static void pdc_pata_error_handler(struct ata_port *ap); | 151 | static void pdc_pata_error_handler(struct ata_port *ap); |
150 | static void pdc_sata_error_handler(struct ata_port *ap); | 152 | static void pdc_sata_error_handler(struct ata_port *ap); |
151 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); | 153 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); |
@@ -180,8 +182,8 @@ static const struct ata_port_operations pdc_sata_ops = { | |||
180 | 182 | ||
181 | .qc_prep = pdc_qc_prep, | 183 | .qc_prep = pdc_qc_prep, |
182 | .qc_issue = pdc_qc_issue_prot, | 184 | .qc_issue = pdc_qc_issue_prot, |
183 | .freeze = pdc_freeze, | 185 | .freeze = pdc_sata_freeze, |
184 | .thaw = pdc_thaw, | 186 | .thaw = pdc_sata_thaw, |
185 | .error_handler = pdc_sata_error_handler, | 187 | .error_handler = pdc_sata_error_handler, |
186 | .post_internal_cmd = pdc_post_internal_cmd, | 188 | .post_internal_cmd = pdc_post_internal_cmd, |
187 | .cable_detect = pdc_sata_cable_detect, | 189 | .cable_detect = pdc_sata_cable_detect, |
@@ -205,8 +207,8 @@ static const struct ata_port_operations pdc_old_sata_ops = { | |||
205 | 207 | ||
206 | .qc_prep = pdc_qc_prep, | 208 | .qc_prep = pdc_qc_prep, |
207 | .qc_issue = pdc_qc_issue_prot, | 209 | .qc_issue = pdc_qc_issue_prot, |
208 | .freeze = pdc_freeze, | 210 | .freeze = pdc_sata_freeze, |
209 | .thaw = pdc_thaw, | 211 | .thaw = pdc_sata_thaw, |
210 | .error_handler = pdc_sata_error_handler, | 212 | .error_handler = pdc_sata_error_handler, |
211 | .post_internal_cmd = pdc_post_internal_cmd, | 213 | .post_internal_cmd = pdc_post_internal_cmd, |
212 | .cable_detect = pdc_sata_cable_detect, | 214 | .cable_detect = pdc_sata_cable_detect, |
@@ -631,6 +633,41 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc) | |||
631 | } | 633 | } |
632 | } | 634 | } |
633 | 635 | ||
636 | static int pdc_is_sataii_tx4(unsigned long flags) | ||
637 | { | ||
638 | const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS; | ||
639 | return (flags & mask) == mask; | ||
640 | } | ||
641 | |||
642 | static unsigned int pdc_port_no_to_ata_no(unsigned int port_no, | ||
643 | int is_sataii_tx4) | ||
644 | { | ||
645 | static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; | ||
646 | return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no; | ||
647 | } | ||
648 | |||
649 | static unsigned int pdc_sata_nr_ports(const struct ata_port *ap) | ||
650 | { | ||
651 | return (ap->flags & PDC_FLAG_4_PORTS) ? 4 : 2; | ||
652 | } | ||
653 | |||
654 | static unsigned int pdc_sata_ata_port_to_ata_no(const struct ata_port *ap) | ||
655 | { | ||
656 | const struct ata_host *host = ap->host; | ||
657 | unsigned int nr_ports = pdc_sata_nr_ports(ap); | ||
658 | unsigned int i; | ||
659 | |||
660 | for(i = 0; i < nr_ports && host->ports[i] != ap; ++i) | ||
661 | ; | ||
662 | BUG_ON(i >= nr_ports); | ||
663 | return pdc_port_no_to_ata_no(i, pdc_is_sataii_tx4(ap->flags)); | ||
664 | } | ||
665 | |||
666 | static unsigned int pdc_sata_hotplug_offset(const struct ata_port *ap) | ||
667 | { | ||
668 | return (ap->flags & PDC_FLAG_GEN_II) ? PDC2_SATA_PLUG_CSR : PDC_SATA_PLUG_CSR; | ||
669 | } | ||
670 | |||
634 | static void pdc_freeze(struct ata_port *ap) | 671 | static void pdc_freeze(struct ata_port *ap) |
635 | { | 672 | { |
636 | void __iomem *mmio = ap->ioaddr.cmd_addr; | 673 | void __iomem *mmio = ap->ioaddr.cmd_addr; |
@@ -643,6 +680,29 @@ static void pdc_freeze(struct ata_port *ap) | |||
643 | readl(mmio + PDC_CTLSTAT); /* flush */ | 680 | readl(mmio + PDC_CTLSTAT); /* flush */ |
644 | } | 681 | } |
645 | 682 | ||
683 | static void pdc_sata_freeze(struct ata_port *ap) | ||
684 | { | ||
685 | struct ata_host *host = ap->host; | ||
686 | void __iomem *host_mmio = host->iomap[PDC_MMIO_BAR]; | ||
687 | unsigned int hotplug_offset = pdc_sata_hotplug_offset(ap); | ||
688 | unsigned int ata_no = pdc_sata_ata_port_to_ata_no(ap); | ||
689 | u32 hotplug_status; | ||
690 | |||
691 | /* Disable hotplug events on this port. | ||
692 | * | ||
693 | * Locking: | ||
694 | * 1) hotplug register accesses must be serialised via host->lock | ||
695 | * 2) ap->lock == &ap->host->lock | ||
696 | * 3) ->freeze() and ->thaw() are called with ap->lock held | ||
697 | */ | ||
698 | hotplug_status = readl(host_mmio + hotplug_offset); | ||
699 | hotplug_status |= 0x11 << (ata_no + 16); | ||
700 | writel(hotplug_status, host_mmio + hotplug_offset); | ||
701 | readl(host_mmio + hotplug_offset); /* flush */ | ||
702 | |||
703 | pdc_freeze(ap); | ||
704 | } | ||
705 | |||
646 | static void pdc_thaw(struct ata_port *ap) | 706 | static void pdc_thaw(struct ata_port *ap) |
647 | { | 707 | { |
648 | void __iomem *mmio = ap->ioaddr.cmd_addr; | 708 | void __iomem *mmio = ap->ioaddr.cmd_addr; |
@@ -658,6 +718,26 @@ static void pdc_thaw(struct ata_port *ap) | |||
658 | readl(mmio + PDC_CTLSTAT); /* flush */ | 718 | readl(mmio + PDC_CTLSTAT); /* flush */ |
659 | } | 719 | } |
660 | 720 | ||
721 | static void pdc_sata_thaw(struct ata_port *ap) | ||
722 | { | ||
723 | struct ata_host *host = ap->host; | ||
724 | void __iomem *host_mmio = host->iomap[PDC_MMIO_BAR]; | ||
725 | unsigned int hotplug_offset = pdc_sata_hotplug_offset(ap); | ||
726 | unsigned int ata_no = pdc_sata_ata_port_to_ata_no(ap); | ||
727 | u32 hotplug_status; | ||
728 | |||
729 | pdc_thaw(ap); | ||
730 | |||
731 | /* Enable hotplug events on this port. | ||
732 | * Locking: see pdc_sata_freeze(). | ||
733 | */ | ||
734 | hotplug_status = readl(host_mmio + hotplug_offset); | ||
735 | hotplug_status |= 0x11 << ata_no; | ||
736 | hotplug_status &= ~(0x11 << (ata_no + 16)); | ||
737 | writel(hotplug_status, host_mmio + hotplug_offset); | ||
738 | readl(host_mmio + hotplug_offset); /* flush */ | ||
739 | } | ||
740 | |||
661 | static void pdc_common_error_handler(struct ata_port *ap, ata_reset_fn_t hardreset) | 741 | static void pdc_common_error_handler(struct ata_port *ap, ata_reset_fn_t hardreset) |
662 | { | 742 | { |
663 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | 743 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) |
@@ -765,19 +845,6 @@ static void pdc_irq_clear(struct ata_port *ap) | |||
765 | readl(mmio + PDC_INT_SEQMASK); | 845 | readl(mmio + PDC_INT_SEQMASK); |
766 | } | 846 | } |
767 | 847 | ||
768 | static int pdc_is_sataii_tx4(unsigned long flags) | ||
769 | { | ||
770 | const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS; | ||
771 | return (flags & mask) == mask; | ||
772 | } | ||
773 | |||
774 | static unsigned int pdc_port_no_to_ata_no(unsigned int port_no, | ||
775 | int is_sataii_tx4) | ||
776 | { | ||
777 | static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; | ||
778 | return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no; | ||
779 | } | ||
780 | |||
781 | static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | 848 | static irqreturn_t pdc_interrupt(int irq, void *dev_instance) |
782 | { | 849 | { |
783 | struct ata_host *host = dev_instance; | 850 | struct ata_host *host = dev_instance; |
@@ -799,6 +866,8 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
799 | 866 | ||
800 | mmio_base = host->iomap[PDC_MMIO_BAR]; | 867 | mmio_base = host->iomap[PDC_MMIO_BAR]; |
801 | 868 | ||
869 | spin_lock(&host->lock); | ||
870 | |||
802 | /* read and clear hotplug flags for all ports */ | 871 | /* read and clear hotplug flags for all ports */ |
803 | if (host->ports[0]->flags & PDC_FLAG_GEN_II) | 872 | if (host->ports[0]->flags & PDC_FLAG_GEN_II) |
804 | hotplug_offset = PDC2_SATA_PLUG_CSR; | 873 | hotplug_offset = PDC2_SATA_PLUG_CSR; |
@@ -814,11 +883,9 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
814 | 883 | ||
815 | if (mask == 0xffffffff && hotplug_status == 0) { | 884 | if (mask == 0xffffffff && hotplug_status == 0) { |
816 | VPRINTK("QUICK EXIT 2\n"); | 885 | VPRINTK("QUICK EXIT 2\n"); |
817 | return IRQ_NONE; | 886 | goto done_irq; |
818 | } | 887 | } |
819 | 888 | ||
820 | spin_lock(&host->lock); | ||
821 | |||
822 | mask &= 0xffff; /* only 16 tags possible */ | 889 | mask &= 0xffff; /* only 16 tags possible */ |
823 | if (mask == 0 && hotplug_status == 0) { | 890 | if (mask == 0 && hotplug_status == 0) { |
824 | VPRINTK("QUICK EXIT 3\n"); | 891 | VPRINTK("QUICK EXIT 3\n"); |
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index c662d686154a..47c57a4294b7 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c | |||
@@ -331,8 +331,8 @@ module_param(fs_keystream, int, 0); | |||
331 | #define FS_DEBUG_QSIZE 0x00001000 | 331 | #define FS_DEBUG_QSIZE 0x00001000 |
332 | 332 | ||
333 | 333 | ||
334 | #define func_enter() fs_dprintk (FS_DEBUG_FLOW, "fs: enter %s\n", __FUNCTION__) | 334 | #define func_enter() fs_dprintk(FS_DEBUG_FLOW, "fs: enter %s\n", __func__) |
335 | #define func_exit() fs_dprintk (FS_DEBUG_FLOW, "fs: exit %s\n", __FUNCTION__) | 335 | #define func_exit() fs_dprintk(FS_DEBUG_FLOW, "fs: exit %s\n", __func__) |
336 | 336 | ||
337 | 337 | ||
338 | static struct fs_dev *fs_boards = NULL; | 338 | static struct fs_dev *fs_boards = NULL; |
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index f97e050338f0..432181ed7bb5 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -95,8 +95,8 @@ | |||
95 | #if 1 | 95 | #if 1 |
96 | #define ASSERT(expr) if (!(expr)) { \ | 96 | #define ASSERT(expr) if (!(expr)) { \ |
97 | printk(FORE200E "assertion failed! %s[%d]: %s\n", \ | 97 | printk(FORE200E "assertion failed! %s[%d]: %s\n", \ |
98 | __FUNCTION__, __LINE__, #expr); \ | 98 | __func__, __LINE__, #expr); \ |
99 | panic(FORE200E "%s", __FUNCTION__); \ | 99 | panic(FORE200E "%s", __func__); \ |
100 | } | 100 | } |
101 | #else | 101 | #else |
102 | #define ASSERT(expr) do {} while (0) | 102 | #define ASSERT(expr) do {} while (0) |
@@ -1988,19 +1988,19 @@ fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats __user *arg) | |||
1988 | if (fore200e_getstats(fore200e) < 0) | 1988 | if (fore200e_getstats(fore200e) < 0) |
1989 | return -EIO; | 1989 | return -EIO; |
1990 | 1990 | ||
1991 | tmp.section_bip = cpu_to_be32(fore200e->stats->oc3.section_bip8_errors); | 1991 | tmp.section_bip = be32_to_cpu(fore200e->stats->oc3.section_bip8_errors); |
1992 | tmp.line_bip = cpu_to_be32(fore200e->stats->oc3.line_bip24_errors); | 1992 | tmp.line_bip = be32_to_cpu(fore200e->stats->oc3.line_bip24_errors); |
1993 | tmp.path_bip = cpu_to_be32(fore200e->stats->oc3.path_bip8_errors); | 1993 | tmp.path_bip = be32_to_cpu(fore200e->stats->oc3.path_bip8_errors); |
1994 | tmp.line_febe = cpu_to_be32(fore200e->stats->oc3.line_febe_errors); | 1994 | tmp.line_febe = be32_to_cpu(fore200e->stats->oc3.line_febe_errors); |
1995 | tmp.path_febe = cpu_to_be32(fore200e->stats->oc3.path_febe_errors); | 1995 | tmp.path_febe = be32_to_cpu(fore200e->stats->oc3.path_febe_errors); |
1996 | tmp.corr_hcs = cpu_to_be32(fore200e->stats->oc3.corr_hcs_errors); | 1996 | tmp.corr_hcs = be32_to_cpu(fore200e->stats->oc3.corr_hcs_errors); |
1997 | tmp.uncorr_hcs = cpu_to_be32(fore200e->stats->oc3.ucorr_hcs_errors); | 1997 | tmp.uncorr_hcs = be32_to_cpu(fore200e->stats->oc3.ucorr_hcs_errors); |
1998 | tmp.tx_cells = cpu_to_be32(fore200e->stats->aal0.cells_transmitted) + | 1998 | tmp.tx_cells = be32_to_cpu(fore200e->stats->aal0.cells_transmitted) + |
1999 | cpu_to_be32(fore200e->stats->aal34.cells_transmitted) + | 1999 | be32_to_cpu(fore200e->stats->aal34.cells_transmitted) + |
2000 | cpu_to_be32(fore200e->stats->aal5.cells_transmitted); | 2000 | be32_to_cpu(fore200e->stats->aal5.cells_transmitted); |
2001 | tmp.rx_cells = cpu_to_be32(fore200e->stats->aal0.cells_received) + | 2001 | tmp.rx_cells = be32_to_cpu(fore200e->stats->aal0.cells_received) + |
2002 | cpu_to_be32(fore200e->stats->aal34.cells_received) + | 2002 | be32_to_cpu(fore200e->stats->aal34.cells_received) + |
2003 | cpu_to_be32(fore200e->stats->aal5.cells_received); | 2003 | be32_to_cpu(fore200e->stats->aal5.cells_received); |
2004 | 2004 | ||
2005 | if (arg) | 2005 | if (arg) |
2006 | return copy_to_user(arg, &tmp, sizeof(struct sonet_stats)) ? -EFAULT : 0; | 2006 | return copy_to_user(arg, &tmp, sizeof(struct sonet_stats)) ? -EFAULT : 0; |
@@ -2587,7 +2587,7 @@ fore200e_start_fw(struct fore200e* fore200e) | |||
2587 | static int __devinit | 2587 | static int __devinit |
2588 | fore200e_load_fw(struct fore200e* fore200e) | 2588 | fore200e_load_fw(struct fore200e* fore200e) |
2589 | { | 2589 | { |
2590 | u32* fw_data = (u32*) fore200e->bus->fw_data; | 2590 | __le32* fw_data = (__le32*) fore200e->bus->fw_data; |
2591 | u32 fw_size = (u32) *fore200e->bus->fw_size / sizeof(u32); | 2591 | u32 fw_size = (u32) *fore200e->bus->fw_size / sizeof(u32); |
2592 | 2592 | ||
2593 | struct fw_header* fw_header = (struct fw_header*) fw_data; | 2593 | struct fw_header* fw_header = (struct fw_header*) fw_data; |
@@ -2965,8 +2965,8 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
2965 | " 4b5b:\n" | 2965 | " 4b5b:\n" |
2966 | " crc_header_errors:\t\t%10u\n" | 2966 | " crc_header_errors:\t\t%10u\n" |
2967 | " framing_errors:\t\t%10u\n", | 2967 | " framing_errors:\t\t%10u\n", |
2968 | cpu_to_be32(fore200e->stats->phy.crc_header_errors), | 2968 | be32_to_cpu(fore200e->stats->phy.crc_header_errors), |
2969 | cpu_to_be32(fore200e->stats->phy.framing_errors)); | 2969 | be32_to_cpu(fore200e->stats->phy.framing_errors)); |
2970 | 2970 | ||
2971 | if (!left--) | 2971 | if (!left--) |
2972 | return sprintf(page, "\n" | 2972 | return sprintf(page, "\n" |
@@ -2978,13 +2978,13 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
2978 | " path_febe_errors:\t\t%10u\n" | 2978 | " path_febe_errors:\t\t%10u\n" |
2979 | " corr_hcs_errors:\t\t%10u\n" | 2979 | " corr_hcs_errors:\t\t%10u\n" |
2980 | " ucorr_hcs_errors:\t\t%10u\n", | 2980 | " ucorr_hcs_errors:\t\t%10u\n", |
2981 | cpu_to_be32(fore200e->stats->oc3.section_bip8_errors), | 2981 | be32_to_cpu(fore200e->stats->oc3.section_bip8_errors), |
2982 | cpu_to_be32(fore200e->stats->oc3.path_bip8_errors), | 2982 | be32_to_cpu(fore200e->stats->oc3.path_bip8_errors), |
2983 | cpu_to_be32(fore200e->stats->oc3.line_bip24_errors), | 2983 | be32_to_cpu(fore200e->stats->oc3.line_bip24_errors), |
2984 | cpu_to_be32(fore200e->stats->oc3.line_febe_errors), | 2984 | be32_to_cpu(fore200e->stats->oc3.line_febe_errors), |
2985 | cpu_to_be32(fore200e->stats->oc3.path_febe_errors), | 2985 | be32_to_cpu(fore200e->stats->oc3.path_febe_errors), |
2986 | cpu_to_be32(fore200e->stats->oc3.corr_hcs_errors), | 2986 | be32_to_cpu(fore200e->stats->oc3.corr_hcs_errors), |
2987 | cpu_to_be32(fore200e->stats->oc3.ucorr_hcs_errors)); | 2987 | be32_to_cpu(fore200e->stats->oc3.ucorr_hcs_errors)); |
2988 | 2988 | ||
2989 | if (!left--) | 2989 | if (!left--) |
2990 | return sprintf(page,"\n" | 2990 | return sprintf(page,"\n" |
@@ -2995,12 +2995,12 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
2995 | " vpi no conn:\t\t%10u\n" | 2995 | " vpi no conn:\t\t%10u\n" |
2996 | " vci out of range:\t\t%10u\n" | 2996 | " vci out of range:\t\t%10u\n" |
2997 | " vci no conn:\t\t%10u\n", | 2997 | " vci no conn:\t\t%10u\n", |
2998 | cpu_to_be32(fore200e->stats->atm.cells_transmitted), | 2998 | be32_to_cpu(fore200e->stats->atm.cells_transmitted), |
2999 | cpu_to_be32(fore200e->stats->atm.cells_received), | 2999 | be32_to_cpu(fore200e->stats->atm.cells_received), |
3000 | cpu_to_be32(fore200e->stats->atm.vpi_bad_range), | 3000 | be32_to_cpu(fore200e->stats->atm.vpi_bad_range), |
3001 | cpu_to_be32(fore200e->stats->atm.vpi_no_conn), | 3001 | be32_to_cpu(fore200e->stats->atm.vpi_no_conn), |
3002 | cpu_to_be32(fore200e->stats->atm.vci_bad_range), | 3002 | be32_to_cpu(fore200e->stats->atm.vci_bad_range), |
3003 | cpu_to_be32(fore200e->stats->atm.vci_no_conn)); | 3003 | be32_to_cpu(fore200e->stats->atm.vci_no_conn)); |
3004 | 3004 | ||
3005 | if (!left--) | 3005 | if (!left--) |
3006 | return sprintf(page,"\n" | 3006 | return sprintf(page,"\n" |
@@ -3008,9 +3008,9 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
3008 | " TX:\t\t\t%10u\n" | 3008 | " TX:\t\t\t%10u\n" |
3009 | " RX:\t\t\t%10u\n" | 3009 | " RX:\t\t\t%10u\n" |
3010 | " dropped:\t\t\t%10u\n", | 3010 | " dropped:\t\t\t%10u\n", |
3011 | cpu_to_be32(fore200e->stats->aal0.cells_transmitted), | 3011 | be32_to_cpu(fore200e->stats->aal0.cells_transmitted), |
3012 | cpu_to_be32(fore200e->stats->aal0.cells_received), | 3012 | be32_to_cpu(fore200e->stats->aal0.cells_received), |
3013 | cpu_to_be32(fore200e->stats->aal0.cells_dropped)); | 3013 | be32_to_cpu(fore200e->stats->aal0.cells_dropped)); |
3014 | 3014 | ||
3015 | if (!left--) | 3015 | if (!left--) |
3016 | return sprintf(page,"\n" | 3016 | return sprintf(page,"\n" |
@@ -3026,15 +3026,15 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
3026 | " RX:\t\t\t%10u\n" | 3026 | " RX:\t\t\t%10u\n" |
3027 | " dropped:\t\t\t%10u\n" | 3027 | " dropped:\t\t\t%10u\n" |
3028 | " protocol errors:\t\t%10u\n", | 3028 | " protocol errors:\t\t%10u\n", |
3029 | cpu_to_be32(fore200e->stats->aal34.cells_transmitted), | 3029 | be32_to_cpu(fore200e->stats->aal34.cells_transmitted), |
3030 | cpu_to_be32(fore200e->stats->aal34.cells_received), | 3030 | be32_to_cpu(fore200e->stats->aal34.cells_received), |
3031 | cpu_to_be32(fore200e->stats->aal34.cells_dropped), | 3031 | be32_to_cpu(fore200e->stats->aal34.cells_dropped), |
3032 | cpu_to_be32(fore200e->stats->aal34.cells_crc_errors), | 3032 | be32_to_cpu(fore200e->stats->aal34.cells_crc_errors), |
3033 | cpu_to_be32(fore200e->stats->aal34.cells_protocol_errors), | 3033 | be32_to_cpu(fore200e->stats->aal34.cells_protocol_errors), |
3034 | cpu_to_be32(fore200e->stats->aal34.cspdus_transmitted), | 3034 | be32_to_cpu(fore200e->stats->aal34.cspdus_transmitted), |
3035 | cpu_to_be32(fore200e->stats->aal34.cspdus_received), | 3035 | be32_to_cpu(fore200e->stats->aal34.cspdus_received), |
3036 | cpu_to_be32(fore200e->stats->aal34.cspdus_dropped), | 3036 | be32_to_cpu(fore200e->stats->aal34.cspdus_dropped), |
3037 | cpu_to_be32(fore200e->stats->aal34.cspdus_protocol_errors)); | 3037 | be32_to_cpu(fore200e->stats->aal34.cspdus_protocol_errors)); |
3038 | 3038 | ||
3039 | if (!left--) | 3039 | if (!left--) |
3040 | return sprintf(page,"\n" | 3040 | return sprintf(page,"\n" |
@@ -3050,15 +3050,15 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
3050 | " dropped:\t\t\t%10u\n" | 3050 | " dropped:\t\t\t%10u\n" |
3051 | " CRC errors:\t\t%10u\n" | 3051 | " CRC errors:\t\t%10u\n" |
3052 | " protocol errors:\t\t%10u\n", | 3052 | " protocol errors:\t\t%10u\n", |
3053 | cpu_to_be32(fore200e->stats->aal5.cells_transmitted), | 3053 | be32_to_cpu(fore200e->stats->aal5.cells_transmitted), |
3054 | cpu_to_be32(fore200e->stats->aal5.cells_received), | 3054 | be32_to_cpu(fore200e->stats->aal5.cells_received), |
3055 | cpu_to_be32(fore200e->stats->aal5.cells_dropped), | 3055 | be32_to_cpu(fore200e->stats->aal5.cells_dropped), |
3056 | cpu_to_be32(fore200e->stats->aal5.congestion_experienced), | 3056 | be32_to_cpu(fore200e->stats->aal5.congestion_experienced), |
3057 | cpu_to_be32(fore200e->stats->aal5.cspdus_transmitted), | 3057 | be32_to_cpu(fore200e->stats->aal5.cspdus_transmitted), |
3058 | cpu_to_be32(fore200e->stats->aal5.cspdus_received), | 3058 | be32_to_cpu(fore200e->stats->aal5.cspdus_received), |
3059 | cpu_to_be32(fore200e->stats->aal5.cspdus_dropped), | 3059 | be32_to_cpu(fore200e->stats->aal5.cspdus_dropped), |
3060 | cpu_to_be32(fore200e->stats->aal5.cspdus_crc_errors), | 3060 | be32_to_cpu(fore200e->stats->aal5.cspdus_crc_errors), |
3061 | cpu_to_be32(fore200e->stats->aal5.cspdus_protocol_errors)); | 3061 | be32_to_cpu(fore200e->stats->aal5.cspdus_protocol_errors)); |
3062 | 3062 | ||
3063 | if (!left--) | 3063 | if (!left--) |
3064 | return sprintf(page,"\n" | 3064 | return sprintf(page,"\n" |
@@ -3069,11 +3069,11 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
3069 | " large b2:\t\t\t%10u\n" | 3069 | " large b2:\t\t\t%10u\n" |
3070 | " RX PDUs:\t\t\t%10u\n" | 3070 | " RX PDUs:\t\t\t%10u\n" |
3071 | " TX PDUs:\t\t\t%10lu\n", | 3071 | " TX PDUs:\t\t\t%10lu\n", |
3072 | cpu_to_be32(fore200e->stats->aux.small_b1_failed), | 3072 | be32_to_cpu(fore200e->stats->aux.small_b1_failed), |
3073 | cpu_to_be32(fore200e->stats->aux.large_b1_failed), | 3073 | be32_to_cpu(fore200e->stats->aux.large_b1_failed), |
3074 | cpu_to_be32(fore200e->stats->aux.small_b2_failed), | 3074 | be32_to_cpu(fore200e->stats->aux.small_b2_failed), |
3075 | cpu_to_be32(fore200e->stats->aux.large_b2_failed), | 3075 | be32_to_cpu(fore200e->stats->aux.large_b2_failed), |
3076 | cpu_to_be32(fore200e->stats->aux.rpd_alloc_failed), | 3076 | be32_to_cpu(fore200e->stats->aux.rpd_alloc_failed), |
3077 | fore200e->tx_sat); | 3077 | fore200e->tx_sat); |
3078 | 3078 | ||
3079 | if (!left--) | 3079 | if (!left--) |
diff --git a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h index b85a54613dea..183841cc8fdf 100644 --- a/drivers/atm/fore200e.h +++ b/drivers/atm/fore200e.h | |||
@@ -349,90 +349,90 @@ typedef struct oc3_block { | |||
349 | /* physical encoding statistics */ | 349 | /* physical encoding statistics */ |
350 | 350 | ||
351 | typedef struct stats_phy { | 351 | typedef struct stats_phy { |
352 | u32 crc_header_errors; /* cells received with bad header CRC */ | 352 | __be32 crc_header_errors; /* cells received with bad header CRC */ |
353 | u32 framing_errors; /* cells received with bad framing */ | 353 | __be32 framing_errors; /* cells received with bad framing */ |
354 | u32 pad[ 2 ]; /* i960 padding */ | 354 | __be32 pad[ 2 ]; /* i960 padding */ |
355 | } stats_phy_t; | 355 | } stats_phy_t; |
356 | 356 | ||
357 | 357 | ||
358 | /* OC-3 statistics */ | 358 | /* OC-3 statistics */ |
359 | 359 | ||
360 | typedef struct stats_oc3 { | 360 | typedef struct stats_oc3 { |
361 | u32 section_bip8_errors; /* section 8 bit interleaved parity */ | 361 | __be32 section_bip8_errors; /* section 8 bit interleaved parity */ |
362 | u32 path_bip8_errors; /* path 8 bit interleaved parity */ | 362 | __be32 path_bip8_errors; /* path 8 bit interleaved parity */ |
363 | u32 line_bip24_errors; /* line 24 bit interleaved parity */ | 363 | __be32 line_bip24_errors; /* line 24 bit interleaved parity */ |
364 | u32 line_febe_errors; /* line far end block errors */ | 364 | __be32 line_febe_errors; /* line far end block errors */ |
365 | u32 path_febe_errors; /* path far end block errors */ | 365 | __be32 path_febe_errors; /* path far end block errors */ |
366 | u32 corr_hcs_errors; /* correctable header check sequence */ | 366 | __be32 corr_hcs_errors; /* correctable header check sequence */ |
367 | u32 ucorr_hcs_errors; /* uncorrectable header check sequence */ | 367 | __be32 ucorr_hcs_errors; /* uncorrectable header check sequence */ |
368 | u32 pad[ 1 ]; /* i960 padding */ | 368 | __be32 pad[ 1 ]; /* i960 padding */ |
369 | } stats_oc3_t; | 369 | } stats_oc3_t; |
370 | 370 | ||
371 | 371 | ||
372 | /* ATM statistics */ | 372 | /* ATM statistics */ |
373 | 373 | ||
374 | typedef struct stats_atm { | 374 | typedef struct stats_atm { |
375 | u32 cells_transmitted; /* cells transmitted */ | 375 | __be32 cells_transmitted; /* cells transmitted */ |
376 | u32 cells_received; /* cells received */ | 376 | __be32 cells_received; /* cells received */ |
377 | u32 vpi_bad_range; /* cell drops: VPI out of range */ | 377 | __be32 vpi_bad_range; /* cell drops: VPI out of range */ |
378 | u32 vpi_no_conn; /* cell drops: no connection for VPI */ | 378 | __be32 vpi_no_conn; /* cell drops: no connection for VPI */ |
379 | u32 vci_bad_range; /* cell drops: VCI out of range */ | 379 | __be32 vci_bad_range; /* cell drops: VCI out of range */ |
380 | u32 vci_no_conn; /* cell drops: no connection for VCI */ | 380 | __be32 vci_no_conn; /* cell drops: no connection for VCI */ |
381 | u32 pad[ 2 ]; /* i960 padding */ | 381 | __be32 pad[ 2 ]; /* i960 padding */ |
382 | } stats_atm_t; | 382 | } stats_atm_t; |
383 | 383 | ||
384 | /* AAL0 statistics */ | 384 | /* AAL0 statistics */ |
385 | 385 | ||
386 | typedef struct stats_aal0 { | 386 | typedef struct stats_aal0 { |
387 | u32 cells_transmitted; /* cells transmitted */ | 387 | __be32 cells_transmitted; /* cells transmitted */ |
388 | u32 cells_received; /* cells received */ | 388 | __be32 cells_received; /* cells received */ |
389 | u32 cells_dropped; /* cells dropped */ | 389 | __be32 cells_dropped; /* cells dropped */ |
390 | u32 pad[ 1 ]; /* i960 padding */ | 390 | __be32 pad[ 1 ]; /* i960 padding */ |
391 | } stats_aal0_t; | 391 | } stats_aal0_t; |
392 | 392 | ||
393 | 393 | ||
394 | /* AAL3/4 statistics */ | 394 | /* AAL3/4 statistics */ |
395 | 395 | ||
396 | typedef struct stats_aal34 { | 396 | typedef struct stats_aal34 { |
397 | u32 cells_transmitted; /* cells transmitted from segmented PDUs */ | 397 | __be32 cells_transmitted; /* cells transmitted from segmented PDUs */ |
398 | u32 cells_received; /* cells reassembled into PDUs */ | 398 | __be32 cells_received; /* cells reassembled into PDUs */ |
399 | u32 cells_crc_errors; /* payload CRC error count */ | 399 | __be32 cells_crc_errors; /* payload CRC error count */ |
400 | u32 cells_protocol_errors; /* SAR or CS layer protocol errors */ | 400 | __be32 cells_protocol_errors; /* SAR or CS layer protocol errors */ |
401 | u32 cells_dropped; /* cells dropped: partial reassembly */ | 401 | __be32 cells_dropped; /* cells dropped: partial reassembly */ |
402 | u32 cspdus_transmitted; /* CS PDUs transmitted */ | 402 | __be32 cspdus_transmitted; /* CS PDUs transmitted */ |
403 | u32 cspdus_received; /* CS PDUs received */ | 403 | __be32 cspdus_received; /* CS PDUs received */ |
404 | u32 cspdus_protocol_errors; /* CS layer protocol errors */ | 404 | __be32 cspdus_protocol_errors; /* CS layer protocol errors */ |
405 | u32 cspdus_dropped; /* reassembled PDUs drop'd (in cells) */ | 405 | __be32 cspdus_dropped; /* reassembled PDUs drop'd (in cells) */ |
406 | u32 pad[ 3 ]; /* i960 padding */ | 406 | __be32 pad[ 3 ]; /* i960 padding */ |
407 | } stats_aal34_t; | 407 | } stats_aal34_t; |
408 | 408 | ||
409 | 409 | ||
410 | /* AAL5 statistics */ | 410 | /* AAL5 statistics */ |
411 | 411 | ||
412 | typedef struct stats_aal5 { | 412 | typedef struct stats_aal5 { |
413 | u32 cells_transmitted; /* cells transmitted from segmented SDUs */ | 413 | __be32 cells_transmitted; /* cells transmitted from segmented SDUs */ |
414 | u32 cells_received; /* cells reassembled into SDUs */ | 414 | __be32 cells_received; /* cells reassembled into SDUs */ |
415 | u32 cells_dropped; /* reassembled PDUs dropped (in cells) */ | 415 | __be32 cells_dropped; /* reassembled PDUs dropped (in cells) */ |
416 | u32 congestion_experienced; /* CRC error and length wrong */ | 416 | __be32 congestion_experienced; /* CRC error and length wrong */ |
417 | u32 cspdus_transmitted; /* CS PDUs transmitted */ | 417 | __be32 cspdus_transmitted; /* CS PDUs transmitted */ |
418 | u32 cspdus_received; /* CS PDUs received */ | 418 | __be32 cspdus_received; /* CS PDUs received */ |
419 | u32 cspdus_crc_errors; /* CS PDUs CRC errors */ | 419 | __be32 cspdus_crc_errors; /* CS PDUs CRC errors */ |
420 | u32 cspdus_protocol_errors; /* CS layer protocol errors */ | 420 | __be32 cspdus_protocol_errors; /* CS layer protocol errors */ |
421 | u32 cspdus_dropped; /* reassembled PDUs dropped */ | 421 | __be32 cspdus_dropped; /* reassembled PDUs dropped */ |
422 | u32 pad[ 3 ]; /* i960 padding */ | 422 | __be32 pad[ 3 ]; /* i960 padding */ |
423 | } stats_aal5_t; | 423 | } stats_aal5_t; |
424 | 424 | ||
425 | 425 | ||
426 | /* auxiliary statistics */ | 426 | /* auxiliary statistics */ |
427 | 427 | ||
428 | typedef struct stats_aux { | 428 | typedef struct stats_aux { |
429 | u32 small_b1_failed; /* receive BD allocation failures */ | 429 | __be32 small_b1_failed; /* receive BD allocation failures */ |
430 | u32 large_b1_failed; /* receive BD allocation failures */ | 430 | __be32 large_b1_failed; /* receive BD allocation failures */ |
431 | u32 small_b2_failed; /* receive BD allocation failures */ | 431 | __be32 small_b2_failed; /* receive BD allocation failures */ |
432 | u32 large_b2_failed; /* receive BD allocation failures */ | 432 | __be32 large_b2_failed; /* receive BD allocation failures */ |
433 | u32 rpd_alloc_failed; /* receive PDU allocation failures */ | 433 | __be32 rpd_alloc_failed; /* receive PDU allocation failures */ |
434 | u32 receive_carrier; /* no carrier = 0, carrier = 1 */ | 434 | __be32 receive_carrier; /* no carrier = 0, carrier = 1 */ |
435 | u32 pad[ 2 ]; /* i960 padding */ | 435 | __be32 pad[ 2 ]; /* i960 padding */ |
436 | } stats_aux_t; | 436 | } stats_aux_t; |
437 | 437 | ||
438 | 438 | ||
@@ -643,10 +643,10 @@ typedef struct host_bsq { | |||
643 | /* header of the firmware image */ | 643 | /* header of the firmware image */ |
644 | 644 | ||
645 | typedef struct fw_header { | 645 | typedef struct fw_header { |
646 | u32 magic; /* magic number */ | 646 | __le32 magic; /* magic number */ |
647 | u32 version; /* firmware version id */ | 647 | __le32 version; /* firmware version id */ |
648 | u32 load_offset; /* fw load offset in board memory */ | 648 | __le32 load_offset; /* fw load offset in board memory */ |
649 | u32 start_offset; /* fw execution start address in board memory */ | 649 | __le32 start_offset; /* fw execution start address in board memory */ |
650 | } fw_header_t; | 650 | } fw_header_t; |
651 | 651 | ||
652 | #define FW_HEADER_MAGIC 0x65726f66 /* 'fore' */ | 652 | #define FW_HEADER_MAGIC 0x65726f66 /* 'fore' */ |
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index eee54c0cde68..b967919fb7e2 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -555,7 +555,7 @@ idt77252_tx_dump(struct idt77252_dev *card) | |||
555 | struct vc_map *vc; | 555 | struct vc_map *vc; |
556 | int i; | 556 | int i; |
557 | 557 | ||
558 | printk("%s\n", __FUNCTION__); | 558 | printk("%s\n", __func__); |
559 | for (i = 0; i < card->tct_size; i++) { | 559 | for (i = 0; i < card->tct_size; i++) { |
560 | vc = card->vcs[i]; | 560 | vc = card->vcs[i]; |
561 | if (!vc) | 561 | if (!vc) |
@@ -1035,7 +1035,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) | |||
1035 | skb = sb_pool_skb(card, le32_to_cpu(rsqe->word_2)); | 1035 | skb = sb_pool_skb(card, le32_to_cpu(rsqe->word_2)); |
1036 | if (skb == NULL) { | 1036 | if (skb == NULL) { |
1037 | printk("%s: NULL skb in %s, rsqe: %08x %08x %08x %08x\n", | 1037 | printk("%s: NULL skb in %s, rsqe: %08x %08x %08x %08x\n", |
1038 | card->name, __FUNCTION__, | 1038 | card->name, __func__, |
1039 | le32_to_cpu(rsqe->word_1), le32_to_cpu(rsqe->word_2), | 1039 | le32_to_cpu(rsqe->word_1), le32_to_cpu(rsqe->word_2), |
1040 | le32_to_cpu(rsqe->word_3), le32_to_cpu(rsqe->word_4)); | 1040 | le32_to_cpu(rsqe->word_3), le32_to_cpu(rsqe->word_4)); |
1041 | return; | 1041 | return; |
@@ -1873,7 +1873,7 @@ add_rx_skb(struct idt77252_dev *card, int queue, | |||
1873 | return; | 1873 | return; |
1874 | 1874 | ||
1875 | if (sb_pool_add(card, skb, queue)) { | 1875 | if (sb_pool_add(card, skb, queue)) { |
1876 | printk("%s: SB POOL full\n", __FUNCTION__); | 1876 | printk("%s: SB POOL full\n", __func__); |
1877 | goto outfree; | 1877 | goto outfree; |
1878 | } | 1878 | } |
1879 | 1879 | ||
@@ -1883,7 +1883,7 @@ add_rx_skb(struct idt77252_dev *card, int queue, | |||
1883 | IDT77252_PRV_PADDR(skb) = paddr; | 1883 | IDT77252_PRV_PADDR(skb) = paddr; |
1884 | 1884 | ||
1885 | if (push_rx_skb(card, skb, queue)) { | 1885 | if (push_rx_skb(card, skb, queue)) { |
1886 | printk("%s: FB QUEUE full\n", __FUNCTION__); | 1886 | printk("%s: FB QUEUE full\n", __func__); |
1887 | goto outunmap; | 1887 | goto outunmap; |
1888 | } | 1888 | } |
1889 | } | 1889 | } |
@@ -3821,12 +3821,12 @@ static int __init idt77252_init(void) | |||
3821 | { | 3821 | { |
3822 | struct sk_buff *skb; | 3822 | struct sk_buff *skb; |
3823 | 3823 | ||
3824 | printk("%s: at %p\n", __FUNCTION__, idt77252_init); | 3824 | printk("%s: at %p\n", __func__, idt77252_init); |
3825 | 3825 | ||
3826 | if (sizeof(skb->cb) < sizeof(struct atm_skb_data) + | 3826 | if (sizeof(skb->cb) < sizeof(struct atm_skb_data) + |
3827 | sizeof(struct idt77252_skb_prv)) { | 3827 | sizeof(struct idt77252_skb_prv)) { |
3828 | printk(KERN_ERR "%s: skb->cb is too small (%lu < %lu)\n", | 3828 | printk(KERN_ERR "%s: skb->cb is too small (%lu < %lu)\n", |
3829 | __FUNCTION__, (unsigned long) sizeof(skb->cb), | 3829 | __func__, (unsigned long) sizeof(skb->cb), |
3830 | (unsigned long) sizeof(struct atm_skb_data) + | 3830 | (unsigned long) sizeof(struct atm_skb_data) + |
3831 | sizeof(struct idt77252_skb_prv)); | 3831 | sizeof(struct idt77252_skb_prv)); |
3832 | return -EIO; | 3832 | return -EIO; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 7de543d1d0b4..24198ad01976 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kdev_t.h> | 19 | #include <linux/kdev_t.h> |
20 | #include <linux/notifier.h> | 20 | #include <linux/notifier.h> |
21 | #include <linux/genhd.h> | 21 | #include <linux/genhd.h> |
22 | #include <linux/kallsyms.h> | ||
22 | #include <asm/semaphore.h> | 23 | #include <asm/semaphore.h> |
23 | 24 | ||
24 | #include "base.h" | 25 | #include "base.h" |
@@ -68,6 +69,10 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr, | |||
68 | 69 | ||
69 | if (dev_attr->show) | 70 | if (dev_attr->show) |
70 | ret = dev_attr->show(dev, dev_attr, buf); | 71 | ret = dev_attr->show(dev, dev_attr, buf); |
72 | if (ret >= (ssize_t)PAGE_SIZE) { | ||
73 | print_symbol("dev_attr_show: %s returned bad count\n", | ||
74 | (unsigned long)dev_attr->show); | ||
75 | } | ||
71 | return ret; | 76 | return ret; |
72 | } | 77 | } |
73 | 78 | ||
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index bf31a0170a48..9a6537f14401 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -133,6 +133,7 @@ int driver_add_kobj(struct device_driver *drv, struct kobject *kobj, | |||
133 | { | 133 | { |
134 | va_list args; | 134 | va_list args; |
135 | char *name; | 135 | char *name; |
136 | int ret; | ||
136 | 137 | ||
137 | va_start(args, fmt); | 138 | va_start(args, fmt); |
138 | name = kvasprintf(GFP_KERNEL, fmt, args); | 139 | name = kvasprintf(GFP_KERNEL, fmt, args); |
@@ -141,7 +142,9 @@ int driver_add_kobj(struct device_driver *drv, struct kobject *kobj, | |||
141 | if (!name) | 142 | if (!name) |
142 | return -ENOMEM; | 143 | return -ENOMEM; |
143 | 144 | ||
144 | return kobject_add(kobj, &drv->p->kobj, "%s", name); | 145 | ret = kobject_add(kobj, &drv->p->kobj, "%s", name); |
146 | kfree(name); | ||
147 | return ret; | ||
145 | } | 148 | } |
146 | EXPORT_SYMBOL_GPL(driver_add_kobj); | 149 | EXPORT_SYMBOL_GPL(driver_add_kobj); |
147 | 150 | ||
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index b6d230b3209f..0d1d2133d9bc 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -44,16 +44,6 @@ config MAC_FLOPPY | |||
44 | If you have a SWIM-3 (Super Woz Integrated Machine 3; from Apple) | 44 | If you have a SWIM-3 (Super Woz Integrated Machine 3; from Apple) |
45 | floppy controller, say Y here. Most commonly found in PowerMacs. | 45 | floppy controller, say Y here. Most commonly found in PowerMacs. |
46 | 46 | ||
47 | config BLK_DEV_PS2 | ||
48 | tristate "PS/2 ESDI hard disk support" | ||
49 | depends on MCA && MCA_LEGACY && BROKEN | ||
50 | help | ||
51 | Say Y here if you have a PS/2 machine with a MCA bus and an ESDI | ||
52 | hard disk. | ||
53 | |||
54 | To compile this driver as a module, choose M here: the | ||
55 | module will be called ps2esdi. | ||
56 | |||
57 | config AMIGA_Z2RAM | 47 | config AMIGA_Z2RAM |
58 | tristate "Amiga Zorro II ramdisk support" | 48 | tristate "Amiga Zorro II ramdisk support" |
59 | depends on ZORRO | 49 | depends on ZORRO |
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 01c972415cb2..5e584306be99 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile | |||
@@ -13,7 +13,6 @@ obj-$(CONFIG_ATARI_FLOPPY) += ataflop.o | |||
13 | obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o | 13 | obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o |
14 | obj-$(CONFIG_BLK_DEV_RAM) += brd.o | 14 | obj-$(CONFIG_BLK_DEV_RAM) += brd.o |
15 | obj-$(CONFIG_BLK_DEV_LOOP) += loop.o | 15 | obj-$(CONFIG_BLK_DEV_LOOP) += loop.o |
16 | obj-$(CONFIG_BLK_DEV_PS2) += ps2esdi.o | ||
17 | obj-$(CONFIG_BLK_DEV_XD) += xd.o | 16 | obj-$(CONFIG_BLK_DEV_XD) += xd.o |
18 | obj-$(CONFIG_BLK_CPQ_DA) += cpqarray.o | 17 | obj-$(CONFIG_BLK_CPQ_DA) += cpqarray.o |
19 | obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss.o | 18 | obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss.o |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 32c79a55511b..7652e87d60c5 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -217,7 +217,6 @@ static int use_virtual_dma; | |||
217 | */ | 217 | */ |
218 | 218 | ||
219 | static DEFINE_SPINLOCK(floppy_lock); | 219 | static DEFINE_SPINLOCK(floppy_lock); |
220 | static struct completion device_release; | ||
221 | 220 | ||
222 | static unsigned short virtual_dma_port = 0x3f0; | 221 | static unsigned short virtual_dma_port = 0x3f0; |
223 | irqreturn_t floppy_interrupt(int irq, void *dev_id); | 222 | irqreturn_t floppy_interrupt(int irq, void *dev_id); |
@@ -4144,7 +4143,6 @@ DEVICE_ATTR(cmos,S_IRUGO,floppy_cmos_show,NULL); | |||
4144 | 4143 | ||
4145 | static void floppy_device_release(struct device *dev) | 4144 | static void floppy_device_release(struct device *dev) |
4146 | { | 4145 | { |
4147 | complete(&device_release); | ||
4148 | } | 4146 | } |
4149 | 4147 | ||
4150 | static struct platform_device floppy_device[N_DRIVE]; | 4148 | static struct platform_device floppy_device[N_DRIVE]; |
@@ -4539,7 +4537,6 @@ void cleanup_module(void) | |||
4539 | { | 4537 | { |
4540 | int drive; | 4538 | int drive; |
4541 | 4539 | ||
4542 | init_completion(&device_release); | ||
4543 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); | 4540 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |
4544 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 4541 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
4545 | 4542 | ||
@@ -4564,8 +4561,6 @@ void cleanup_module(void) | |||
4564 | 4561 | ||
4565 | /* eject disk, if any */ | 4562 | /* eject disk, if any */ |
4566 | fd_eject(0); | 4563 | fd_eject(0); |
4567 | |||
4568 | wait_for_completion(&device_release); | ||
4569 | } | 4564 | } |
4570 | 4565 | ||
4571 | module_param(floppy, charp, 0); | 4566 | module_param(floppy, charp, 0); |
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c deleted file mode 100644 index 3c796e236253..000000000000 --- a/drivers/block/ps2esdi.c +++ /dev/null | |||
@@ -1,1079 +0,0 @@ | |||
1 | /* ps2esdi driver based on assembler code by Arindam Banerji, | ||
2 | written by Peter De Schrijver */ | ||
3 | /* Reassuring note to IBM : This driver was NOT developed by vice-versa | ||
4 | engineering the PS/2's BIOS */ | ||
5 | /* Dedicated to Wannes, Tofke, Ykke, Godot, Killroy and all those | ||
6 | other lovely fish out there... */ | ||
7 | /* This code was written during the long and boring WINA | ||
8 | elections 1994 */ | ||
9 | /* Thanks to Arindam Banerij for giving me the source of his driver */ | ||
10 | /* This code may be freely distributed and modified in any way, | ||
11 | as long as these notes remain intact */ | ||
12 | |||
13 | /* Revised: 05/07/94 by Arindam Banerji (axb@cse.nd.edu) */ | ||
14 | /* Revised: 09/08/94 by Peter De Schrijver (stud11@cc4.kuleuven.ac.be) | ||
15 | Thanks to Arindam Banerij for sending me the docs of the adapter */ | ||
16 | |||
17 | /* BA Modified for ThinkPad 720 by Boris Ashkinazi */ | ||
18 | /* (bash@vnet.ibm.com) 08/08/95 */ | ||
19 | |||
20 | /* Modified further for ThinkPad-720C by Uri Blumenthal */ | ||
21 | /* (uri@watson.ibm.com) Sep 11, 1995 */ | ||
22 | |||
23 | /* TODO : | ||
24 | + Timeouts | ||
25 | + Get disk parameters | ||
26 | + DMA above 16MB | ||
27 | + reset after read/write error | ||
28 | */ | ||
29 | |||
30 | #define DEVICE_NAME "PS/2 ESDI" | ||
31 | |||
32 | #include <linux/major.h> | ||
33 | #include <linux/errno.h> | ||
34 | #include <linux/wait.h> | ||
35 | #include <linux/interrupt.h> | ||
36 | #include <linux/fs.h> | ||
37 | #include <linux/kernel.h> | ||
38 | #include <linux/genhd.h> | ||
39 | #include <linux/ps2esdi.h> | ||
40 | #include <linux/blkdev.h> | ||
41 | #include <linux/mca-legacy.h> | ||
42 | #include <linux/init.h> | ||
43 | #include <linux/ioport.h> | ||
44 | #include <linux/module.h> | ||
45 | #include <linux/hdreg.h> | ||
46 | |||
47 | #include <asm/system.h> | ||
48 | #include <asm/io.h> | ||
49 | #include <asm/dma.h> | ||
50 | #include <asm/mca_dma.h> | ||
51 | #include <asm/uaccess.h> | ||
52 | |||
53 | #define PS2ESDI_IRQ 14 | ||
54 | #define MAX_HD 2 | ||
55 | #define MAX_RETRIES 5 | ||
56 | #define MAX_16BIT 65536 | ||
57 | #define ESDI_TIMEOUT 0xf000 | ||
58 | #define ESDI_STAT_TIMEOUT 4 | ||
59 | |||
60 | #define TYPE_0_CMD_BLK_LENGTH 2 | ||
61 | #define TYPE_1_CMD_BLK_LENGTH 4 | ||
62 | |||
63 | static void reset_ctrl(void); | ||
64 | |||
65 | static int ps2esdi_geninit(void); | ||
66 | |||
67 | static void do_ps2esdi_request(struct request_queue * q); | ||
68 | |||
69 | static void ps2esdi_readwrite(int cmd, struct request *req); | ||
70 | |||
71 | static void ps2esdi_fill_cmd_block(u_short * cmd_blk, u_short cmd, | ||
72 | u_short cyl, u_short head, u_short sector, u_short length, u_char drive); | ||
73 | |||
74 | static int ps2esdi_out_cmd_blk(u_short * cmd_blk); | ||
75 | |||
76 | static void ps2esdi_prep_dma(char *buffer, u_short length, u_char dma_xmode); | ||
77 | |||
78 | static irqreturn_t ps2esdi_interrupt_handler(int irq, void *dev_id); | ||
79 | static void (*current_int_handler) (u_int) = NULL; | ||
80 | static void ps2esdi_normal_interrupt_handler(u_int); | ||
81 | static void ps2esdi_initial_reset_int_handler(u_int); | ||
82 | static void ps2esdi_geometry_int_handler(u_int); | ||
83 | static int ps2esdi_getgeo(struct block_device *bdev, struct hd_geometry *geo); | ||
84 | |||
85 | static int ps2esdi_read_status_words(int num_words, int max_words, u_short * buffer); | ||
86 | |||
87 | static void dump_cmd_complete_status(u_int int_ret_code); | ||
88 | |||
89 | static void ps2esdi_get_device_cfg(void); | ||
90 | |||
91 | static void ps2esdi_reset_timer(unsigned long unused); | ||
92 | |||
93 | static u_int dma_arb_level; /* DMA arbitration level */ | ||
94 | |||
95 | static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_int); | ||
96 | |||
97 | static int no_int_yet; | ||
98 | static int ps2esdi_drives; | ||
99 | static u_short io_base; | ||
100 | static DEFINE_TIMER(esdi_timer, ps2esdi_reset_timer, 0, 0); | ||
101 | static int reset_status; | ||
102 | static int ps2esdi_slot = -1; | ||
103 | static int tp720esdi = 0; /* Is it Integrated ESDI of ThinkPad-720? */ | ||
104 | static int intg_esdi = 0; /* If integrated adapter */ | ||
105 | struct ps2esdi_i_struct { | ||
106 | unsigned int head, sect, cyl, wpcom, lzone, ctl; | ||
107 | }; | ||
108 | static DEFINE_SPINLOCK(ps2esdi_lock); | ||
109 | static struct request_queue *ps2esdi_queue; | ||
110 | static struct request *current_req; | ||
111 | |||
112 | #if 0 | ||
113 | #if 0 /* try both - I don't know which one is better... UB */ | ||
114 | static struct ps2esdi_i_struct ps2esdi_info[MAX_HD] = | ||
115 | { | ||
116 | {4, 48, 1553, 0, 0, 0}, | ||
117 | {0, 0, 0, 0, 0, 0}}; | ||
118 | #else | ||
119 | static struct ps2esdi_i_struct ps2esdi_info[MAX_HD] = | ||
120 | { | ||
121 | {64, 32, 161, 0, 0, 0}, | ||
122 | {0, 0, 0, 0, 0, 0}}; | ||
123 | #endif | ||
124 | #endif | ||
125 | static struct ps2esdi_i_struct ps2esdi_info[MAX_HD] = | ||
126 | { | ||
127 | {0, 0, 0, 0, 0, 0}, | ||
128 | {0, 0, 0, 0, 0, 0}}; | ||
129 | |||
130 | static struct block_device_operations ps2esdi_fops = | ||
131 | { | ||
132 | .owner = THIS_MODULE, | ||
133 | .getgeo = ps2esdi_getgeo, | ||
134 | }; | ||
135 | |||
136 | static struct gendisk *ps2esdi_gendisk[2]; | ||
137 | |||
138 | /* initialization routine called by ll_rw_blk.c */ | ||
139 | static int __init ps2esdi_init(void) | ||
140 | { | ||
141 | |||
142 | int error = 0; | ||
143 | |||
144 | /* register the device - pass the name and major number */ | ||
145 | if (register_blkdev(PS2ESDI_MAJOR, "ed")) | ||
146 | return -EBUSY; | ||
147 | |||
148 | /* set up some global information - indicating device specific info */ | ||
149 | ps2esdi_queue = blk_init_queue(do_ps2esdi_request, &ps2esdi_lock); | ||
150 | if (!ps2esdi_queue) { | ||
151 | unregister_blkdev(PS2ESDI_MAJOR, "ed"); | ||
152 | return -ENOMEM; | ||
153 | } | ||
154 | |||
155 | /* some minor housekeeping - setup the global gendisk structure */ | ||
156 | error = ps2esdi_geninit(); | ||
157 | if (error) { | ||
158 | printk(KERN_WARNING "PS2ESDI: error initialising" | ||
159 | " device, releasing resources\n"); | ||
160 | unregister_blkdev(PS2ESDI_MAJOR, "ed"); | ||
161 | blk_cleanup_queue(ps2esdi_queue); | ||
162 | return error; | ||
163 | } | ||
164 | return 0; | ||
165 | } /* ps2esdi_init */ | ||
166 | |||
167 | #ifndef MODULE | ||
168 | |||
169 | module_init(ps2esdi_init); | ||
170 | |||
171 | #else | ||
172 | |||
173 | static int cyl[MAX_HD] = {-1,-1}; | ||
174 | static int head[MAX_HD] = {-1, -1}; | ||
175 | static int sect[MAX_HD] = {-1, -1}; | ||
176 | |||
177 | module_param(tp720esdi, bool, 0); | ||
178 | module_param_array(cyl, int, NULL, 0); | ||
179 | module_param_array(head, int, NULL, 0); | ||
180 | module_param_array(sect, int, NULL, 0); | ||
181 | MODULE_LICENSE("GPL"); | ||
182 | |||
183 | int init_module(void) { | ||
184 | int drive; | ||
185 | |||
186 | for(drive = 0; drive < MAX_HD; drive++) { | ||
187 | struct ps2esdi_i_struct *info = &ps2esdi_info[drive]; | ||
188 | |||
189 | if (cyl[drive] != -1) { | ||
190 | info->cyl = info->lzone = cyl[drive]; | ||
191 | info->wpcom = 0; | ||
192 | } | ||
193 | if (head[drive] != -1) { | ||
194 | info->head = head[drive]; | ||
195 | info->ctl = (head[drive] > 8 ? 8 : 0); | ||
196 | } | ||
197 | if (sect[drive] != -1) info->sect = sect[drive]; | ||
198 | } | ||
199 | return ps2esdi_init(); | ||
200 | } | ||
201 | |||
202 | void | ||
203 | cleanup_module(void) { | ||
204 | int i; | ||
205 | if(ps2esdi_slot) { | ||
206 | mca_mark_as_unused(ps2esdi_slot); | ||
207 | mca_set_adapter_procfn(ps2esdi_slot, NULL, NULL); | ||
208 | } | ||
209 | release_region(io_base, 4); | ||
210 | free_dma(dma_arb_level); | ||
211 | free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk); | ||
212 | unregister_blkdev(PS2ESDI_MAJOR, "ed"); | ||
213 | blk_cleanup_queue(ps2esdi_queue); | ||
214 | for (i = 0; i < ps2esdi_drives; i++) { | ||
215 | del_gendisk(ps2esdi_gendisk[i]); | ||
216 | put_disk(ps2esdi_gendisk[i]); | ||
217 | } | ||
218 | } | ||
219 | #endif /* MODULE */ | ||
220 | |||
221 | /* handles boot time command line parameters */ | ||
222 | void __init tp720_setup(char *str, int *ints) | ||
223 | { | ||
224 | /* no params, just sets the tp720esdi flag if it exists */ | ||
225 | |||
226 | printk("%s: TP 720 ESDI flag set\n", DEVICE_NAME); | ||
227 | tp720esdi = 1; | ||
228 | } | ||
229 | |||
230 | void __init ed_setup(char *str, int *ints) | ||
231 | { | ||
232 | int hdind = 0; | ||
233 | |||
234 | /* handles 3 parameters only - corresponding to | ||
235 | 1. Number of cylinders | ||
236 | 2. Number of heads | ||
237 | 3. Sectors/track | ||
238 | */ | ||
239 | |||
240 | if (ints[0] != 3) | ||
241 | return; | ||
242 | |||
243 | /* print out the information - seen at boot time */ | ||
244 | printk("%s: ints[0]=%d ints[1]=%d ints[2]=%d ints[3]=%d\n", | ||
245 | DEVICE_NAME, ints[0], ints[1], ints[2], ints[3]); | ||
246 | |||
247 | /* set the index into device specific information table */ | ||
248 | if (ps2esdi_info[0].head != 0) | ||
249 | hdind = 1; | ||
250 | |||
251 | /* set up all the device information */ | ||
252 | ps2esdi_info[hdind].head = ints[2]; | ||
253 | ps2esdi_info[hdind].sect = ints[3]; | ||
254 | ps2esdi_info[hdind].cyl = ints[1]; | ||
255 | ps2esdi_info[hdind].wpcom = 0; | ||
256 | ps2esdi_info[hdind].lzone = ints[1]; | ||
257 | ps2esdi_info[hdind].ctl = (ints[2] > 8 ? 8 : 0); | ||
258 | #if 0 /* this may be needed for PS2/Mod.80, but it hurts ThinkPad! */ | ||
259 | ps2esdi_drives = hdind + 1; /* increment index for the next time */ | ||
260 | #endif | ||
261 | } /* ed_setup */ | ||
262 | |||
263 | static int ps2esdi_getinfo(char *buf, int slot, void *d) | ||
264 | { | ||
265 | int len = 0; | ||
266 | |||
267 | len += sprintf(buf + len, "DMA Arbitration Level: %d\n", | ||
268 | dma_arb_level); | ||
269 | len += sprintf(buf + len, "IO Port: %x\n", io_base); | ||
270 | len += sprintf(buf + len, "IRQ: 14\n"); | ||
271 | len += sprintf(buf + len, "Drives: %d\n", ps2esdi_drives); | ||
272 | |||
273 | return len; | ||
274 | } | ||
275 | |||
276 | /* ps2 esdi specific initialization - called thru the gendisk chain */ | ||
277 | static int __init ps2esdi_geninit(void) | ||
278 | { | ||
279 | /* | ||
280 | The first part contains the initialization code | ||
281 | for the ESDI disk subsystem. All we really do | ||
282 | is search for the POS registers of the controller | ||
283 | to do some simple setup operations. First, we | ||
284 | must ensure that the controller is installed, | ||
285 | enabled, and configured as PRIMARY. Then we must | ||
286 | determine the DMA arbitration level being used by | ||
287 | the controller so we can handle data transfer | ||
288 | operations properly. If all of this works, then | ||
289 | we will set the INIT_FLAG to a non-zero value. | ||
290 | */ | ||
291 | |||
292 | int slot = 0, i, reset_start, reset_end; | ||
293 | u_char status; | ||
294 | unsigned short adapterID; | ||
295 | int error = 0; | ||
296 | |||
297 | if ((slot = mca_find_adapter(INTG_ESDI_ID, 0)) != MCA_NOTFOUND) { | ||
298 | adapterID = INTG_ESDI_ID; | ||
299 | printk("%s: integrated ESDI adapter found in slot %d\n", | ||
300 | DEVICE_NAME, slot+1); | ||
301 | #ifndef MODULE | ||
302 | mca_set_adapter_name(slot, "PS/2 Integrated ESDI"); | ||
303 | #endif | ||
304 | } else if ((slot = mca_find_adapter(NRML_ESDI_ID, 0)) != -1) { | ||
305 | adapterID = NRML_ESDI_ID; | ||
306 | printk("%s: normal ESDI adapter found in slot %d\n", | ||
307 | DEVICE_NAME, slot+1); | ||
308 | mca_set_adapter_name(slot, "PS/2 ESDI"); | ||
309 | } else { | ||
310 | return -ENODEV; | ||
311 | } | ||
312 | |||
313 | ps2esdi_slot = slot; | ||
314 | mca_mark_as_used(slot); | ||
315 | mca_set_adapter_procfn(slot, (MCA_ProcFn) ps2esdi_getinfo, NULL); | ||
316 | |||
317 | /* Found the slot - read the POS register 2 to get the necessary | ||
318 | configuration and status information. POS register 2 has the | ||
319 | following information : | ||
320 | Bit Function | ||
321 | 7 reserved = 0 | ||
322 | 6 arbitration method | ||
323 | 0 - fairness enabled | ||
324 | 1 - fairness disabled, linear priority assignment | ||
325 | 5-2 arbitration level | ||
326 | 1 alternate address | ||
327 | 1 alternate address | ||
328 | 0 - use addresses 0x3510 - 0x3517 | ||
329 | 0 adapter enable | ||
330 | */ | ||
331 | |||
332 | status = mca_read_stored_pos(slot, 2); | ||
333 | /* is it enabled ? */ | ||
334 | if (!(status & STATUS_ENABLED)) { | ||
335 | printk("%s: ESDI adapter disabled\n", DEVICE_NAME); | ||
336 | error = -ENODEV; | ||
337 | goto err_out1; | ||
338 | } | ||
339 | /* try to grab IRQ, and try to grab a slow IRQ if it fails, so we can | ||
340 | share with the SCSI driver */ | ||
341 | if (request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler, | ||
342 | IRQF_DISABLED | IRQF_SHARED, "PS/2 ESDI", &ps2esdi_gendisk) | ||
343 | && request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler, | ||
344 | IRQF_SHARED, "PS/2 ESDI", &ps2esdi_gendisk) | ||
345 | ) { | ||
346 | printk("%s: Unable to get IRQ %d\n", DEVICE_NAME, PS2ESDI_IRQ); | ||
347 | error = -EBUSY; | ||
348 | goto err_out1; | ||
349 | } | ||
350 | if (status & STATUS_ALTERNATE) | ||
351 | io_base = ALT_IO_BASE; | ||
352 | else | ||
353 | io_base = PRIMARY_IO_BASE; | ||
354 | |||
355 | if (!request_region(io_base, 4, "ed")) { | ||
356 | printk(KERN_WARNING"Unable to request region 0x%x\n", io_base); | ||
357 | error = -EBUSY; | ||
358 | goto err_out2; | ||
359 | } | ||
360 | /* get the dma arbitration level */ | ||
361 | dma_arb_level = (status >> 2) & 0xf; | ||
362 | |||
363 | /* BA */ | ||
364 | printk("%s: DMA arbitration level : %d\n", | ||
365 | DEVICE_NAME, dma_arb_level); | ||
366 | |||
367 | LITE_ON; | ||
368 | current_int_handler = ps2esdi_initial_reset_int_handler; | ||
369 | reset_ctrl(); | ||
370 | reset_status = 0; | ||
371 | reset_start = jiffies; | ||
372 | while (!reset_status) { | ||
373 | init_timer(&esdi_timer); | ||
374 | esdi_timer.expires = jiffies + HZ; | ||
375 | esdi_timer.data = 0; | ||
376 | add_timer(&esdi_timer); | ||
377 | sleep_on(&ps2esdi_int); | ||
378 | } | ||
379 | reset_end = jiffies; | ||
380 | LITE_OFF; | ||
381 | printk("%s: reset interrupt after %d jiffies, %u.%02u secs\n", | ||
382 | DEVICE_NAME, reset_end - reset_start, (reset_end - reset_start) / HZ, | ||
383 | (reset_end - reset_start) % HZ); | ||
384 | |||
385 | |||
386 | /* Integrated ESDI Disk and Controller has only one drive! */ | ||
387 | if (adapterID == INTG_ESDI_ID) {/* if not "normal" PS2 ESDI adapter */ | ||
388 | ps2esdi_drives = 1; /* then we have only one physical disk! */ intg_esdi = 1; | ||
389 | } | ||
390 | |||
391 | |||
392 | |||
393 | /* finally this part sets up some global data structures etc. */ | ||
394 | |||
395 | ps2esdi_get_device_cfg(); | ||
396 | |||
397 | /* some annoyance in the above routine returns TWO drives? | ||
398 | Is something else happining in the background? | ||
399 | Regaurdless we fix the # of drives again. AJK */ | ||
400 | /* Integrated ESDI Disk and Controller has only one drive! */ | ||
401 | if (adapterID == INTG_ESDI_ID) /* if not "normal" PS2 ESDI adapter */ | ||
402 | ps2esdi_drives = 1; /* Not three or two, ONE DAMNIT! */ | ||
403 | |||
404 | current_int_handler = ps2esdi_normal_interrupt_handler; | ||
405 | |||
406 | if (request_dma(dma_arb_level, "ed") !=0) { | ||
407 | printk(KERN_WARNING "PS2ESDI: Can't request dma-channel %d\n" | ||
408 | ,(int) dma_arb_level); | ||
409 | error = -EBUSY; | ||
410 | goto err_out3; | ||
411 | } | ||
412 | blk_queue_max_sectors(ps2esdi_queue, 128); | ||
413 | |||
414 | error = -ENOMEM; | ||
415 | for (i = 0; i < ps2esdi_drives; i++) { | ||
416 | struct gendisk *disk = alloc_disk(64); | ||
417 | if (!disk) | ||
418 | goto err_out4; | ||
419 | disk->major = PS2ESDI_MAJOR; | ||
420 | disk->first_minor = i<<6; | ||
421 | sprintf(disk->disk_name, "ed%c", 'a'+i); | ||
422 | disk->fops = &ps2esdi_fops; | ||
423 | ps2esdi_gendisk[i] = disk; | ||
424 | } | ||
425 | |||
426 | for (i = 0; i < ps2esdi_drives; i++) { | ||
427 | struct gendisk *disk = ps2esdi_gendisk[i]; | ||
428 | set_capacity(disk, ps2esdi_info[i].head * ps2esdi_info[i].sect * | ||
429 | ps2esdi_info[i].cyl); | ||
430 | disk->queue = ps2esdi_queue; | ||
431 | disk->private_data = &ps2esdi_info[i]; | ||
432 | add_disk(disk); | ||
433 | } | ||
434 | return 0; | ||
435 | err_out4: | ||
436 | while (i--) | ||
437 | put_disk(ps2esdi_gendisk[i]); | ||
438 | err_out3: | ||
439 | release_region(io_base, 4); | ||
440 | err_out2: | ||
441 | free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk); | ||
442 | err_out1: | ||
443 | if(ps2esdi_slot) { | ||
444 | mca_mark_as_unused(ps2esdi_slot); | ||
445 | mca_set_adapter_procfn(ps2esdi_slot, NULL, NULL); | ||
446 | } | ||
447 | return error; | ||
448 | } | ||
449 | |||
450 | static void __init ps2esdi_get_device_cfg(void) | ||
451 | { | ||
452 | u_short cmd_blk[TYPE_0_CMD_BLK_LENGTH]; | ||
453 | |||
454 | /*BA */ printk("%s: Drive 0\n", DEVICE_NAME); | ||
455 | current_int_handler = ps2esdi_geometry_int_handler; | ||
456 | cmd_blk[0] = CMD_GET_DEV_CONFIG | 0x600; | ||
457 | cmd_blk[1] = 0; | ||
458 | no_int_yet = TRUE; | ||
459 | ps2esdi_out_cmd_blk(cmd_blk); | ||
460 | if (no_int_yet) | ||
461 | sleep_on(&ps2esdi_int); | ||
462 | |||
463 | if (ps2esdi_drives > 1) { | ||
464 | printk("%s: Drive 1\n", DEVICE_NAME); /*BA */ | ||
465 | cmd_blk[0] = CMD_GET_DEV_CONFIG | (1 << 5) | 0x600; | ||
466 | cmd_blk[1] = 0; | ||
467 | no_int_yet = TRUE; | ||
468 | ps2esdi_out_cmd_blk(cmd_blk); | ||
469 | if (no_int_yet) | ||
470 | sleep_on(&ps2esdi_int); | ||
471 | } /* if second physical drive is present */ | ||
472 | return; | ||
473 | } | ||
474 | |||
475 | /* strategy routine that handles most of the IO requests */ | ||
476 | static void do_ps2esdi_request(struct request_queue * q) | ||
477 | { | ||
478 | struct request *req; | ||
479 | /* since, this routine is called with interrupts cleared - they | ||
480 | must be before it finishes */ | ||
481 | |||
482 | req = elv_next_request(q); | ||
483 | if (!req) | ||
484 | return; | ||
485 | |||
486 | #if 0 | ||
487 | printk("%s:got request. device : %s command : %d sector : %ld count : %ld, buffer: %p\n", | ||
488 | DEVICE_NAME, | ||
489 | req->rq_disk->disk_name, | ||
490 | req->cmd, req->sector, | ||
491 | req->current_nr_sectors, req->buffer); | ||
492 | #endif | ||
493 | |||
494 | /* check for above 16Mb dmas */ | ||
495 | if (isa_virt_to_bus(req->buffer + req->current_nr_sectors * 512) > 16 * MB) { | ||
496 | printk("%s: DMA above 16MB not supported\n", DEVICE_NAME); | ||
497 | end_request(req, FAIL); | ||
498 | return; | ||
499 | } | ||
500 | |||
501 | if (req->sector+req->current_nr_sectors > get_capacity(req->rq_disk)) { | ||
502 | printk("Grrr. error. ps2esdi_drives: %d, %llu %llu\n", | ||
503 | ps2esdi_drives, req->sector, | ||
504 | (unsigned long long)get_capacity(req->rq_disk)); | ||
505 | end_request(req, FAIL); | ||
506 | return; | ||
507 | } | ||
508 | |||
509 | switch (rq_data_dir(req)) { | ||
510 | case READ: | ||
511 | ps2esdi_readwrite(READ, req); | ||
512 | break; | ||
513 | case WRITE: | ||
514 | ps2esdi_readwrite(WRITE, req); | ||
515 | break; | ||
516 | default: | ||
517 | printk("%s: Unknown command\n", req->rq_disk->disk_name); | ||
518 | end_request(req, FAIL); | ||
519 | break; | ||
520 | } /* handle different commands */ | ||
521 | } /* main strategy routine */ | ||
522 | |||
523 | /* resets the ESDI adapter */ | ||
524 | static void reset_ctrl(void) | ||
525 | { | ||
526 | |||
527 | u_long expire; | ||
528 | u_short status; | ||
529 | |||
530 | /* enable interrupts on the controller */ | ||
531 | status = inb(ESDI_INTRPT); | ||
532 | outb((status & 0xe0) | ATT_EOI, ESDI_ATTN); /* to be sure we don't have | ||
533 | any interrupt pending... */ | ||
534 | outb_p(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
535 | |||
536 | /* read the ESDI status port - if the controller is not busy, | ||
537 | simply do a soft reset (fast) - otherwise we'll have to do a | ||
538 | hard (slow) reset. */ | ||
539 | if (!(inb_p(ESDI_STATUS) & STATUS_BUSY)) { | ||
540 | /*BA */ printk("%s: soft reset...\n", DEVICE_NAME); | ||
541 | outb_p(CTRL_SOFT_RESET, ESDI_ATTN); | ||
542 | } | ||
543 | /* soft reset */ | ||
544 | else { | ||
545 | /*BA */ | ||
546 | printk("%s: hard reset...\n", DEVICE_NAME); | ||
547 | outb_p(CTRL_HARD_RESET, ESDI_CONTROL); | ||
548 | expire = jiffies + 2*HZ; | ||
549 | while (time_before(jiffies, expire)); | ||
550 | outb_p(1, ESDI_CONTROL); | ||
551 | } /* hard reset */ | ||
552 | |||
553 | |||
554 | } /* reset the controller */ | ||
555 | |||
556 | /* called by the strategy routine to handle read and write requests */ | ||
557 | static void ps2esdi_readwrite(int cmd, struct request *req) | ||
558 | { | ||
559 | struct ps2esdi_i_struct *p = req->rq_disk->private_data; | ||
560 | unsigned block = req->sector; | ||
561 | unsigned count = req->current_nr_sectors; | ||
562 | int drive = p - ps2esdi_info; | ||
563 | u_short track, head, cylinder, sector; | ||
564 | u_short cmd_blk[TYPE_1_CMD_BLK_LENGTH]; | ||
565 | |||
566 | /* do some relevant arithmatic */ | ||
567 | track = block / p->sect; | ||
568 | head = track % p->head; | ||
569 | cylinder = track / p->head; | ||
570 | sector = block % p->sect; | ||
571 | |||
572 | #if 0 | ||
573 | printk("%s: cyl=%d head=%d sect=%d\n", DEVICE_NAME, cylinder, head, sector); | ||
574 | #endif | ||
575 | /* call the routine that actually fills out a command block */ | ||
576 | ps2esdi_fill_cmd_block | ||
577 | (cmd_blk, | ||
578 | (cmd == READ) ? CMD_READ : CMD_WRITE, | ||
579 | cylinder, head, sector, count, drive); | ||
580 | |||
581 | /* send the command block to the controller */ | ||
582 | current_req = req; | ||
583 | spin_unlock_irq(&ps2esdi_lock); | ||
584 | if (ps2esdi_out_cmd_blk(cmd_blk)) { | ||
585 | spin_lock_irq(&ps2esdi_lock); | ||
586 | printk("%s: Controller failed\n", DEVICE_NAME); | ||
587 | if ((++req->errors) >= MAX_RETRIES) | ||
588 | end_request(req, FAIL); | ||
589 | } | ||
590 | /* check for failure to put out the command block */ | ||
591 | else { | ||
592 | spin_lock_irq(&ps2esdi_lock); | ||
593 | #if 0 | ||
594 | printk("%s: waiting for xfer\n", DEVICE_NAME); | ||
595 | #endif | ||
596 | /* turn disk lights on */ | ||
597 | LITE_ON; | ||
598 | } | ||
599 | |||
600 | } /* ps2esdi_readwrite */ | ||
601 | |||
602 | /* fill out the command block */ | ||
603 | static void ps2esdi_fill_cmd_block(u_short * cmd_blk, u_short cmd, | ||
604 | u_short cyl, u_short head, u_short sector, u_short length, u_char drive) | ||
605 | { | ||
606 | |||
607 | cmd_blk[0] = (drive << 5) | cmd; | ||
608 | cmd_blk[1] = length; | ||
609 | cmd_blk[2] = ((cyl & 0x1f) << 11) | (head << 5) | sector; | ||
610 | cmd_blk[3] = (cyl & 0x3E0) >> 5; | ||
611 | |||
612 | } /* fill out the command block */ | ||
613 | |||
614 | /* write a command block to the controller */ | ||
615 | static int ps2esdi_out_cmd_blk(u_short * cmd_blk) | ||
616 | { | ||
617 | |||
618 | int i; | ||
619 | unsigned long jif; | ||
620 | u_char status; | ||
621 | |||
622 | /* enable interrupts */ | ||
623 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
624 | |||
625 | /* do not write to the controller, if it is busy */ | ||
626 | for (jif = jiffies + ESDI_STAT_TIMEOUT; | ||
627 | time_after(jif, jiffies) && | ||
628 | (inb(ESDI_STATUS) & STATUS_BUSY); ) | ||
629 | ; | ||
630 | |||
631 | #if 0 | ||
632 | printk("%s: i(1)=%ld\n", DEVICE_NAME, jif); | ||
633 | #endif | ||
634 | |||
635 | /* if device is still busy - then just time out */ | ||
636 | if (inb(ESDI_STATUS) & STATUS_BUSY) { | ||
637 | printk("%s: ps2esdi_out_cmd timed out (1)\n", DEVICE_NAME); | ||
638 | return ERROR; | ||
639 | } /* timeout ??? */ | ||
640 | /* Set up the attention register in the controller */ | ||
641 | outb(((*cmd_blk) & 0xE0) | 1, ESDI_ATTN); | ||
642 | |||
643 | #if 0 | ||
644 | printk("%s: sending %d words to controller\n", DEVICE_NAME, (((*cmd_blk) >> 14) + 1) << 1); | ||
645 | #endif | ||
646 | |||
647 | /* one by one send each word out */ | ||
648 | for (i = (((*cmd_blk) >> 14) + 1) << 1; i; i--) { | ||
649 | status = inb(ESDI_STATUS); | ||
650 | for (jif = jiffies + ESDI_STAT_TIMEOUT; | ||
651 | time_after(jif, jiffies) && (status & STATUS_BUSY) && | ||
652 | (status & STATUS_CMD_INF); status = inb(ESDI_STATUS)); | ||
653 | if ((status & (STATUS_BUSY | STATUS_CMD_INF)) == STATUS_BUSY) { | ||
654 | #if 0 | ||
655 | printk("%s: sending %04X\n", DEVICE_NAME, *cmd_blk); | ||
656 | #endif | ||
657 | outw(*cmd_blk++, ESDI_CMD_INT); | ||
658 | } else { | ||
659 | printk("%s: ps2esdi_out_cmd timed out while sending command (status=%02X)\n", | ||
660 | DEVICE_NAME, status); | ||
661 | return ERROR; | ||
662 | } | ||
663 | } /* send all words out */ | ||
664 | return OK; | ||
665 | } /* send out the commands */ | ||
666 | |||
667 | |||
668 | /* prepare for dma - do all the necessary setup */ | ||
669 | static void ps2esdi_prep_dma(char *buffer, u_short length, u_char dma_xmode) | ||
670 | { | ||
671 | unsigned long flags = claim_dma_lock(); | ||
672 | |||
673 | mca_disable_dma(dma_arb_level); | ||
674 | |||
675 | mca_set_dma_addr(dma_arb_level, isa_virt_to_bus(buffer)); | ||
676 | |||
677 | mca_set_dma_count(dma_arb_level, length * 512 / 2); | ||
678 | |||
679 | mca_set_dma_mode(dma_arb_level, dma_xmode); | ||
680 | |||
681 | mca_enable_dma(dma_arb_level); | ||
682 | |||
683 | release_dma_lock(flags); | ||
684 | |||
685 | } /* prepare for dma */ | ||
686 | |||
687 | |||
688 | |||
689 | static irqreturn_t ps2esdi_interrupt_handler(int irq, void *dev_id) | ||
690 | { | ||
691 | u_int int_ret_code; | ||
692 | |||
693 | if (inb(ESDI_STATUS) & STATUS_INTR) { | ||
694 | int_ret_code = inb(ESDI_INTRPT); | ||
695 | if (current_int_handler) { | ||
696 | /* Disable adapter interrupts till processing is finished */ | ||
697 | outb(CTRL_DISABLE_INTR, ESDI_CONTROL); | ||
698 | current_int_handler(int_ret_code); | ||
699 | } else | ||
700 | printk("%s: help ! No interrupt handler.\n", DEVICE_NAME); | ||
701 | } else { | ||
702 | return IRQ_NONE; | ||
703 | } | ||
704 | return IRQ_HANDLED; | ||
705 | } | ||
706 | |||
707 | static void ps2esdi_initial_reset_int_handler(u_int int_ret_code) | ||
708 | { | ||
709 | |||
710 | switch (int_ret_code & 0xf) { | ||
711 | case INT_RESET: | ||
712 | /*BA */ | ||
713 | printk("%s: initial reset completed.\n", DEVICE_NAME); | ||
714 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
715 | wake_up(&ps2esdi_int); | ||
716 | break; | ||
717 | case INT_ATTN_ERROR: | ||
718 | printk("%s: Attention error. interrupt status : %02X\n", DEVICE_NAME, | ||
719 | int_ret_code); | ||
720 | printk("%s: status: %02x\n", DEVICE_NAME, inb(ESDI_STATUS)); | ||
721 | break; | ||
722 | default: | ||
723 | printk("%s: initial reset handler received interrupt: %02X\n", | ||
724 | DEVICE_NAME, int_ret_code); | ||
725 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
726 | break; | ||
727 | } | ||
728 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
729 | } | ||
730 | |||
731 | |||
732 | static void ps2esdi_geometry_int_handler(u_int int_ret_code) | ||
733 | { | ||
734 | u_int status, drive_num; | ||
735 | unsigned long rba; | ||
736 | int i; | ||
737 | |||
738 | drive_num = int_ret_code >> 5; | ||
739 | switch (int_ret_code & 0xf) { | ||
740 | case INT_CMD_COMPLETE: | ||
741 | for (i = ESDI_TIMEOUT; i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--); | ||
742 | if (!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) { | ||
743 | printk("%s: timeout reading status word\n", DEVICE_NAME); | ||
744 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
745 | break; | ||
746 | } | ||
747 | status = inw(ESDI_STT_INT); | ||
748 | if ((status & 0x1F) == CMD_GET_DEV_CONFIG) { | ||
749 | #define REPLY_WORDS 5 /* we already read word 0 */ | ||
750 | u_short reply[REPLY_WORDS]; | ||
751 | |||
752 | if (ps2esdi_read_status_words((status >> 8) - 1, REPLY_WORDS, reply)) { | ||
753 | /*BA */ | ||
754 | printk("%s: Device Configuration Status for drive %u\n", | ||
755 | DEVICE_NAME, drive_num); | ||
756 | |||
757 | printk("%s: Spares/cyls: %u", DEVICE_NAME, reply[0] >> 8); | ||
758 | |||
759 | printk | ||
760 | ("Config bits: %s%s%s%s%s\n", | ||
761 | (reply[0] & CONFIG_IS) ? "Invalid Secondary, " : "", | ||
762 | ((reply[0] & CONFIG_ZD) && !(reply[0] & CONFIG_IS)) | ||
763 | ? "Zero Defect, " : "Defects Present, ", | ||
764 | (reply[0] & CONFIG_SF) ? "Skewed Format, " : "", | ||
765 | (reply[0] & CONFIG_FR) ? "Removable, " : "Non-Removable, ", | ||
766 | (reply[0] & CONFIG_RT) ? "No Retries" : "Retries"); | ||
767 | |||
768 | rba = reply[1] | ((unsigned long) reply[2] << 16); | ||
769 | printk("%s: Number of RBA's: %lu\n", DEVICE_NAME, rba); | ||
770 | |||
771 | printk("%s: Physical number of cylinders: %u, Sectors/Track: %u, Heads: %u\n", | ||
772 | DEVICE_NAME, reply[3], reply[4] >> 8, reply[4] & 0xff); | ||
773 | |||
774 | if (!ps2esdi_info[drive_num].head) { | ||
775 | ps2esdi_info[drive_num].head = 64; | ||
776 | ps2esdi_info[drive_num].sect = 32; | ||
777 | ps2esdi_info[drive_num].cyl = rba / (64 * 32); | ||
778 | ps2esdi_info[drive_num].wpcom = 0; | ||
779 | ps2esdi_info[drive_num].lzone = ps2esdi_info[drive_num].cyl; | ||
780 | ps2esdi_info[drive_num].ctl = 8; | ||
781 | if (tp720esdi) { /* store the retrieved parameters */ | ||
782 | ps2esdi_info[0].head = reply[4] & 0Xff; | ||
783 | ps2esdi_info[0].sect = reply[4] >> 8; | ||
784 | ps2esdi_info[0].cyl = reply[3]; | ||
785 | ps2esdi_info[0].wpcom = 0; | ||
786 | ps2esdi_info[0].lzone = reply[3]; | ||
787 | } else { | ||
788 | if (!intg_esdi) | ||
789 | ps2esdi_drives++; | ||
790 | } | ||
791 | } | ||
792 | #ifdef OBSOLETE | ||
793 | if (!ps2esdi_info[drive_num].head) { | ||
794 | ps2esdi_info[drive_num].head = reply[4] & 0Xff; | ||
795 | ps2esdi_info[drive_num].sect = reply[4] >> 8; | ||
796 | ps2esdi_info[drive_num].cyl = reply[3]; | ||
797 | ps2esdi_info[drive_num].wpcom = 0; | ||
798 | ps2esdi_info[drive_num].lzone = reply[3]; | ||
799 | if (tp720esdi) { /* store the retrieved parameters */ | ||
800 | ps2esdi_info[0].head = reply[4] & 0Xff; | ||
801 | ps2esdi_info[0].sect = reply[4] >> 8; | ||
802 | ps2esdi_info[0].cyl = reply[3]; | ||
803 | ps2esdi_info[0].wpcom = 0; | ||
804 | ps2esdi_info[0].lzone = reply[3]; | ||
805 | } else { | ||
806 | ps2esdi_drives++; | ||
807 | } | ||
808 | } | ||
809 | #endif | ||
810 | |||
811 | } else | ||
812 | printk("%s: failed while getting device config\n", DEVICE_NAME); | ||
813 | #undef REPLY_WORDS | ||
814 | } else | ||
815 | printk("%s: command %02X unknown by geometry handler\n", | ||
816 | DEVICE_NAME, status & 0x1f); | ||
817 | |||
818 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
819 | break; | ||
820 | |||
821 | case INT_ATTN_ERROR: | ||
822 | printk("%s: Attention error. interrupt status : %02X\n", DEVICE_NAME, | ||
823 | int_ret_code); | ||
824 | printk("%s: Device not available\n", DEVICE_NAME); | ||
825 | break; | ||
826 | case INT_CMD_ECC: | ||
827 | case INT_CMD_RETRY: | ||
828 | case INT_CMD_ECC_RETRY: | ||
829 | case INT_CMD_WARNING: | ||
830 | case INT_CMD_ABORT: | ||
831 | case INT_CMD_FAILED: | ||
832 | case INT_DMA_ERR: | ||
833 | case INT_CMD_BLK_ERR: | ||
834 | /*BA */ printk("%s: Whaa. Error occurred...\n", DEVICE_NAME); | ||
835 | dump_cmd_complete_status(int_ret_code); | ||
836 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
837 | break; | ||
838 | default: | ||
839 | printk("%s: Unknown interrupt reason: %02X\n", | ||
840 | DEVICE_NAME, int_ret_code & 0xf); | ||
841 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
842 | break; | ||
843 | } | ||
844 | |||
845 | wake_up(&ps2esdi_int); | ||
846 | no_int_yet = FALSE; | ||
847 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
848 | |||
849 | } | ||
850 | |||
851 | static void ps2esdi_normal_interrupt_handler(u_int int_ret_code) | ||
852 | { | ||
853 | unsigned long flags; | ||
854 | u_int status; | ||
855 | u_int ending; | ||
856 | int i; | ||
857 | |||
858 | switch (int_ret_code & 0x0f) { | ||
859 | case INT_TRANSFER_REQ: | ||
860 | ps2esdi_prep_dma(current_req->buffer, | ||
861 | current_req->current_nr_sectors, | ||
862 | (rq_data_dir(current_req) == READ) | ||
863 | ? MCA_DMA_MODE_16 | MCA_DMA_MODE_WRITE | MCA_DMA_MODE_XFER | ||
864 | : MCA_DMA_MODE_16 | MCA_DMA_MODE_READ); | ||
865 | outb(CTRL_ENABLE_DMA | CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
866 | ending = -1; | ||
867 | break; | ||
868 | |||
869 | case INT_ATTN_ERROR: | ||
870 | printk("%s: Attention error. interrupt status : %02X\n", DEVICE_NAME, | ||
871 | int_ret_code); | ||
872 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
873 | ending = FAIL; | ||
874 | break; | ||
875 | |||
876 | case INT_CMD_COMPLETE: | ||
877 | for (i = ESDI_TIMEOUT; i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--); | ||
878 | if (!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) { | ||
879 | printk("%s: timeout reading status word\n", DEVICE_NAME); | ||
880 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
881 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
882 | if ((++current_req->errors) >= MAX_RETRIES) | ||
883 | ending = FAIL; | ||
884 | else | ||
885 | ending = -1; | ||
886 | break; | ||
887 | } | ||
888 | status = inw(ESDI_STT_INT); | ||
889 | switch (status & 0x1F) { | ||
890 | case (CMD_READ & 0xff): | ||
891 | case (CMD_WRITE & 0xff): | ||
892 | LITE_OFF; | ||
893 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
894 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
895 | ending = SUCCES; | ||
896 | break; | ||
897 | default: | ||
898 | printk("%s: interrupt for unknown command %02X\n", | ||
899 | DEVICE_NAME, status & 0x1f); | ||
900 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
901 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
902 | ending = -1; | ||
903 | break; | ||
904 | } | ||
905 | break; | ||
906 | case INT_CMD_ECC: | ||
907 | case INT_CMD_RETRY: | ||
908 | case INT_CMD_ECC_RETRY: | ||
909 | LITE_OFF; | ||
910 | dump_cmd_complete_status(int_ret_code); | ||
911 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
912 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
913 | ending = SUCCES; | ||
914 | break; | ||
915 | case INT_CMD_WARNING: | ||
916 | case INT_CMD_ABORT: | ||
917 | case INT_CMD_FAILED: | ||
918 | case INT_DMA_ERR: | ||
919 | LITE_OFF; | ||
920 | dump_cmd_complete_status(int_ret_code); | ||
921 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
922 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
923 | if ((++current_req->errors) >= MAX_RETRIES) | ||
924 | ending = FAIL; | ||
925 | else | ||
926 | ending = -1; | ||
927 | break; | ||
928 | |||
929 | case INT_CMD_BLK_ERR: | ||
930 | dump_cmd_complete_status(int_ret_code); | ||
931 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
932 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
933 | ending = FAIL; | ||
934 | break; | ||
935 | |||
936 | case INT_CMD_FORMAT: | ||
937 | printk("%s: huh ? Who issued this format command ?\n" | ||
938 | ,DEVICE_NAME); | ||
939 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
940 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
941 | ending = -1; | ||
942 | break; | ||
943 | |||
944 | case INT_RESET: | ||
945 | /* BA printk("%s: reset completed.\n", DEVICE_NAME) */ ; | ||
946 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
947 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
948 | ending = -1; | ||
949 | break; | ||
950 | |||
951 | default: | ||
952 | printk("%s: Unknown interrupt reason: %02X\n", | ||
953 | DEVICE_NAME, int_ret_code & 0xf); | ||
954 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
955 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
956 | ending = -1; | ||
957 | break; | ||
958 | } | ||
959 | if(ending != -1) { | ||
960 | spin_lock_irqsave(&ps2esdi_lock, flags); | ||
961 | end_request(current_req, ending); | ||
962 | current_req = NULL; | ||
963 | do_ps2esdi_request(ps2esdi_queue); | ||
964 | spin_unlock_irqrestore(&ps2esdi_lock, flags); | ||
965 | } | ||
966 | } /* handle interrupts */ | ||
967 | |||
968 | |||
969 | |||
970 | static int ps2esdi_read_status_words(int num_words, | ||
971 | int max_words, | ||
972 | u_short * buffer) | ||
973 | { | ||
974 | int i; | ||
975 | |||
976 | for (; max_words && num_words; max_words--, num_words--, buffer++) { | ||
977 | for (i = ESDI_TIMEOUT; i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--); | ||
978 | if (!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) { | ||
979 | printk("%s: timeout reading status word\n", DEVICE_NAME); | ||
980 | return FAIL; | ||
981 | } | ||
982 | *buffer = inw(ESDI_STT_INT); | ||
983 | } | ||
984 | return SUCCES; | ||
985 | } | ||
986 | |||
987 | |||
988 | |||
989 | |||
990 | static void dump_cmd_complete_status(u_int int_ret_code) | ||
991 | { | ||
992 | #define WAIT_FOR_STATUS \ | ||
993 | for(i=ESDI_TIMEOUT;i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL);i--); \ | ||
994 | if(!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) { \ | ||
995 | printk("%s: timeout reading status word\n",DEVICE_NAME); \ | ||
996 | return; \ | ||
997 | } | ||
998 | |||
999 | int i, word_count; | ||
1000 | u_short stat_word; | ||
1001 | u_long rba; | ||
1002 | |||
1003 | printk("%s: Device: %u, interrupt ID: %02X\n", | ||
1004 | DEVICE_NAME, int_ret_code >> 5, | ||
1005 | int_ret_code & 0xf); | ||
1006 | |||
1007 | WAIT_FOR_STATUS; | ||
1008 | stat_word = inw(ESDI_STT_INT); | ||
1009 | word_count = (stat_word >> 8) - 1; | ||
1010 | printk("%s: %u status words, command: %02X\n", DEVICE_NAME, word_count, | ||
1011 | stat_word & 0xff); | ||
1012 | |||
1013 | if (word_count--) { | ||
1014 | WAIT_FOR_STATUS; | ||
1015 | stat_word = inw(ESDI_STT_INT); | ||
1016 | printk("%s: command status code: %02X, command error code: %02X\n", | ||
1017 | DEVICE_NAME, stat_word >> 8, stat_word & 0xff); | ||
1018 | } | ||
1019 | if (word_count--) { | ||
1020 | WAIT_FOR_STATUS; | ||
1021 | stat_word = inw(ESDI_STT_INT); | ||
1022 | printk("%s: device error code: %s%s%s%s%s,%02X\n", DEVICE_NAME, | ||
1023 | (stat_word & 0x1000) ? "Ready, " : "Not Ready, ", | ||
1024 | (stat_word & 0x0800) ? "Selected, " : "Not Selected, ", | ||
1025 | (stat_word & 0x0400) ? "Write Fault, " : "", | ||
1026 | (stat_word & 0x0200) ? "Track 0, " : "", | ||
1027 | (stat_word & 0x0100) ? "Seek or command complete, " : "", | ||
1028 | stat_word >> 8); | ||
1029 | } | ||
1030 | if (word_count--) { | ||
1031 | WAIT_FOR_STATUS; | ||
1032 | stat_word = inw(ESDI_STT_INT); | ||
1033 | printk("%s: Blocks to do: %u", DEVICE_NAME, stat_word); | ||
1034 | } | ||
1035 | if (word_count -= 2) { | ||
1036 | WAIT_FOR_STATUS; | ||
1037 | rba = inw(ESDI_STT_INT); | ||
1038 | WAIT_FOR_STATUS; | ||
1039 | rba |= inw(ESDI_STT_INT) << 16; | ||
1040 | printk(", Last Cyl: %u Head: %u Sector: %u\n", | ||
1041 | (u_short) ((rba & 0x1ff80000) >> 11), | ||
1042 | (u_short) ((rba & 0x7E0) >> 5), (u_short) (rba & 0x1f)); | ||
1043 | } else | ||
1044 | printk("\n"); | ||
1045 | |||
1046 | if (word_count--) { | ||
1047 | WAIT_FOR_STATUS; | ||
1048 | stat_word = inw(ESDI_STT_INT); | ||
1049 | printk("%s: Blocks required ECC: %u", DEVICE_NAME, stat_word); | ||
1050 | } | ||
1051 | printk("\n"); | ||
1052 | |||
1053 | #undef WAIT_FOR_STATUS | ||
1054 | |||
1055 | } | ||
1056 | |||
1057 | static int ps2esdi_getgeo(struct block_device *bdev, struct hd_geometry *geo) | ||
1058 | { | ||
1059 | struct ps2esdi_i_struct *p = bdev->bd_disk->private_data; | ||
1060 | |||
1061 | geo->heads = p->head; | ||
1062 | geo->sectors = p->sect; | ||
1063 | geo->cylinders = p->cyl; | ||
1064 | return 0; | ||
1065 | } | ||
1066 | |||
1067 | static void ps2esdi_reset_timer(unsigned long unused) | ||
1068 | { | ||
1069 | |||
1070 | int status; | ||
1071 | |||
1072 | status = inb(ESDI_INTRPT); | ||
1073 | if ((status & 0xf) == INT_RESET) { | ||
1074 | outb((status & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
1075 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
1076 | reset_status = 1; | ||
1077 | } | ||
1078 | wake_up(&ps2esdi_int); | ||
1079 | } | ||
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index 9e61fca46117..41ca721d2523 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -528,8 +528,7 @@ static int block_event_to_scatterlist(const struct vioblocklpevent *bevent, | |||
528 | numsg = VIOMAXBLOCKDMA; | 528 | numsg = VIOMAXBLOCKDMA; |
529 | 529 | ||
530 | *total_len = 0; | 530 | *total_len = 0; |
531 | memset(sg, 0, sizeof(sg[0]) * VIOMAXBLOCKDMA); | 531 | sg_init_table(sg, VIOMAXBLOCKDMA); |
532 | |||
533 | for (i = 0; (i < numsg) && (rw_data->dma_info[i].len > 0); ++i) { | 532 | for (i = 0; (i < numsg) && (rw_data->dma_info[i].len > 0); ++i) { |
534 | sg_dma_address(&sg[i]) = rw_data->dma_info[i].token; | 533 | sg_dma_address(&sg[i]) = rw_data->dma_info[i].token; |
535 | sg_dma_len(&sg[i]) = rw_data->dma_info[i].len; | 534 | sg_dma_len(&sg[i]) = rw_data->dma_info[i].len; |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 3b1a68d6eddb..0cfbe8c594a5 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -238,6 +238,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
238 | vblk->disk->first_minor = index_to_minor(index); | 238 | vblk->disk->first_minor = index_to_minor(index); |
239 | vblk->disk->private_data = vblk; | 239 | vblk->disk->private_data = vblk; |
240 | vblk->disk->fops = &virtblk_fops; | 240 | vblk->disk->fops = &virtblk_fops; |
241 | vblk->disk->driverfs_dev = &vdev->dev; | ||
241 | index++; | 242 | index++; |
242 | 243 | ||
243 | /* If barriers are supported, tell block layer that queue is ordered */ | 244 | /* If barriers are supported, tell block layer that queue is ordered */ |
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index f16c94cbf488..8b884f87d8b7 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c | |||
@@ -149,6 +149,9 @@ static struct usb_device_id blacklist_ids[] = { | |||
149 | { USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC }, | 149 | { USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC }, |
150 | { USB_DEVICE(0x0400, 0x080a), .driver_info = HCI_BROKEN_ISOC }, | 150 | { USB_DEVICE(0x0400, 0x080a), .driver_info = HCI_BROKEN_ISOC }, |
151 | 151 | ||
152 | /* CONWISE Technology based adapters with buggy SCO support */ | ||
153 | { USB_DEVICE(0x0e5e, 0x6622), .driver_info = HCI_BROKEN_ISOC }, | ||
154 | |||
152 | /* Belkin F8T012 and F8T013 devices */ | 155 | /* Belkin F8T012 and F8T013 devices */ |
153 | { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | 156 | { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, |
154 | { USB_DEVICE(0x050d, 0x0013), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | 157 | { USB_DEVICE(0x050d, 0x0013), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, |
diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c index d352dbb4ccf7..141f4dfa0a11 100644 --- a/drivers/char/drm/ati_pcigart.c +++ b/drivers/char/drm/ati_pcigart.c | |||
@@ -35,42 +35,23 @@ | |||
35 | 35 | ||
36 | # define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ | 36 | # define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ |
37 | 37 | ||
38 | static void *drm_ati_alloc_pcigart_table(int order) | 38 | static int drm_ati_alloc_pcigart_table(struct drm_device *dev, |
39 | struct drm_ati_pcigart_info *gart_info) | ||
39 | { | 40 | { |
40 | unsigned long address; | 41 | gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size, |
41 | struct page *page; | 42 | PAGE_SIZE, |
42 | int i; | 43 | gart_info->table_mask); |
43 | 44 | if (gart_info->table_handle == NULL) | |
44 | DRM_DEBUG("%d order\n", order); | 45 | return -ENOMEM; |
45 | |||
46 | address = __get_free_pages(GFP_KERNEL | __GFP_COMP, | ||
47 | order); | ||
48 | if (address == 0UL) { | ||
49 | return NULL; | ||
50 | } | ||
51 | |||
52 | page = virt_to_page(address); | ||
53 | |||
54 | for (i = 0; i < order; i++, page++) | ||
55 | SetPageReserved(page); | ||
56 | 46 | ||
57 | DRM_DEBUG("returning 0x%08lx\n", address); | 47 | return 0; |
58 | return (void *)address; | ||
59 | } | 48 | } |
60 | 49 | ||
61 | static void drm_ati_free_pcigart_table(void *address, int order) | 50 | static void drm_ati_free_pcigart_table(struct drm_device *dev, |
51 | struct drm_ati_pcigart_info *gart_info) | ||
62 | { | 52 | { |
63 | struct page *page; | 53 | drm_pci_free(dev, gart_info->table_handle); |
64 | int i; | 54 | gart_info->table_handle = NULL; |
65 | int num_pages = 1 << order; | ||
66 | DRM_DEBUG("\n"); | ||
67 | |||
68 | page = virt_to_page((unsigned long)address); | ||
69 | |||
70 | for (i = 0; i < num_pages; i++, page++) | ||
71 | ClearPageReserved(page); | ||
72 | |||
73 | free_pages((unsigned long)address, order); | ||
74 | } | 55 | } |
75 | 56 | ||
76 | int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) | 57 | int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) |
@@ -78,8 +59,7 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info | |||
78 | struct drm_sg_mem *entry = dev->sg; | 59 | struct drm_sg_mem *entry = dev->sg; |
79 | unsigned long pages; | 60 | unsigned long pages; |
80 | int i; | 61 | int i; |
81 | int order; | 62 | int max_pages; |
82 | int num_pages, max_pages; | ||
83 | 63 | ||
84 | /* we need to support large memory configurations */ | 64 | /* we need to support large memory configurations */ |
85 | if (!entry) { | 65 | if (!entry) { |
@@ -87,15 +67,7 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info | |||
87 | return 0; | 67 | return 0; |
88 | } | 68 | } |
89 | 69 | ||
90 | order = drm_order((gart_info->table_size + (PAGE_SIZE-1)) / PAGE_SIZE); | ||
91 | num_pages = 1 << order; | ||
92 | |||
93 | if (gart_info->bus_addr) { | 70 | if (gart_info->bus_addr) { |
94 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { | ||
95 | pci_unmap_single(dev->pdev, gart_info->bus_addr, | ||
96 | num_pages * PAGE_SIZE, | ||
97 | PCI_DMA_TODEVICE); | ||
98 | } | ||
99 | 71 | ||
100 | max_pages = (gart_info->table_size / sizeof(u32)); | 72 | max_pages = (gart_info->table_size / sizeof(u32)); |
101 | pages = (entry->pages <= max_pages) | 73 | pages = (entry->pages <= max_pages) |
@@ -112,10 +84,9 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info | |||
112 | gart_info->bus_addr = 0; | 84 | gart_info->bus_addr = 0; |
113 | } | 85 | } |
114 | 86 | ||
115 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN | 87 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN && |
116 | && gart_info->addr) { | 88 | gart_info->table_handle) { |
117 | drm_ati_free_pcigart_table(gart_info->addr, order); | 89 | drm_ati_free_pcigart_table(dev, gart_info); |
118 | gart_info->addr = NULL; | ||
119 | } | 90 | } |
120 | 91 | ||
121 | return 1; | 92 | return 1; |
@@ -127,11 +98,10 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
127 | struct drm_sg_mem *entry = dev->sg; | 98 | struct drm_sg_mem *entry = dev->sg; |
128 | void *address = NULL; | 99 | void *address = NULL; |
129 | unsigned long pages; | 100 | unsigned long pages; |
130 | u32 *pci_gart, page_base, bus_address = 0; | 101 | u32 *pci_gart, page_base; |
102 | dma_addr_t bus_address = 0; | ||
131 | int i, j, ret = 0; | 103 | int i, j, ret = 0; |
132 | int order; | ||
133 | int max_pages; | 104 | int max_pages; |
134 | int num_pages; | ||
135 | 105 | ||
136 | if (!entry) { | 106 | if (!entry) { |
137 | DRM_ERROR("no scatter/gather memory!\n"); | 107 | DRM_ERROR("no scatter/gather memory!\n"); |
@@ -141,36 +111,20 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
141 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { | 111 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { |
142 | DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); | 112 | DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); |
143 | 113 | ||
144 | order = drm_order((gart_info->table_size + | 114 | ret = drm_ati_alloc_pcigart_table(dev, gart_info); |
145 | (PAGE_SIZE-1)) / PAGE_SIZE); | 115 | if (ret) { |
146 | num_pages = 1 << order; | ||
147 | address = drm_ati_alloc_pcigart_table(order); | ||
148 | if (!address) { | ||
149 | DRM_ERROR("cannot allocate PCI GART page!\n"); | 116 | DRM_ERROR("cannot allocate PCI GART page!\n"); |
150 | goto done; | 117 | goto done; |
151 | } | 118 | } |
152 | 119 | ||
153 | if (!dev->pdev) { | 120 | address = gart_info->table_handle->vaddr; |
154 | DRM_ERROR("PCI device unknown!\n"); | 121 | bus_address = gart_info->table_handle->busaddr; |
155 | goto done; | ||
156 | } | ||
157 | |||
158 | bus_address = pci_map_single(dev->pdev, address, | ||
159 | num_pages * PAGE_SIZE, | ||
160 | PCI_DMA_TODEVICE); | ||
161 | if (bus_address == 0) { | ||
162 | DRM_ERROR("unable to map PCIGART pages!\n"); | ||
163 | order = drm_order((gart_info->table_size + | ||
164 | (PAGE_SIZE-1)) / PAGE_SIZE); | ||
165 | drm_ati_free_pcigart_table(address, order); | ||
166 | address = NULL; | ||
167 | goto done; | ||
168 | } | ||
169 | } else { | 122 | } else { |
170 | address = gart_info->addr; | 123 | address = gart_info->addr; |
171 | bus_address = gart_info->bus_addr; | 124 | bus_address = gart_info->bus_addr; |
172 | DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n", | 125 | DRM_DEBUG("PCI: Gart Table: VRAM %08LX mapped at %08lX\n", |
173 | bus_address, (unsigned long)address); | 126 | (unsigned long long)bus_address, |
127 | (unsigned long)address); | ||
174 | } | 128 | } |
175 | 129 | ||
176 | pci_gart = (u32 *) address; | 130 | pci_gart = (u32 *) address; |
@@ -214,6 +168,12 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
214 | } | 168 | } |
215 | } | 169 | } |
216 | 170 | ||
171 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) | ||
172 | dma_sync_single_for_device(&dev->pdev->dev, | ||
173 | bus_address, | ||
174 | max_pages * sizeof(u32), | ||
175 | PCI_DMA_TODEVICE); | ||
176 | |||
217 | ret = 1; | 177 | ret = 1; |
218 | 178 | ||
219 | #if defined(__i386__) || defined(__x86_64__) | 179 | #if defined(__i386__) || defined(__x86_64__) |
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index a6789f25009b..8ea9dd1717a9 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/pci.h> | 54 | #include <linux/pci.h> |
55 | #include <linux/jiffies.h> | 55 | #include <linux/jiffies.h> |
56 | #include <linux/smp_lock.h> /* For (un)lock_kernel */ | 56 | #include <linux/smp_lock.h> /* For (un)lock_kernel */ |
57 | #include <linux/dma-mapping.h> | ||
57 | #include <linux/mm.h> | 58 | #include <linux/mm.h> |
58 | #include <linux/cdev.h> | 59 | #include <linux/cdev.h> |
59 | #include <linux/mutex.h> | 60 | #include <linux/mutex.h> |
@@ -551,6 +552,8 @@ struct drm_ati_pcigart_info { | |||
551 | int gart_reg_if; | 552 | int gart_reg_if; |
552 | void *addr; | 553 | void *addr; |
553 | dma_addr_t bus_addr; | 554 | dma_addr_t bus_addr; |
555 | dma_addr_t table_mask; | ||
556 | struct drm_dma_handle *table_handle; | ||
554 | drm_local_map_t mapping; | 557 | drm_local_map_t mapping; |
555 | int table_size; | 558 | int table_size; |
556 | }; | 559 | }; |
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index 3992f73299cc..f09d4b5002b0 100644 --- a/drivers/char/drm/drm_fops.c +++ b/drivers/char/drm/drm_fops.c | |||
@@ -326,6 +326,7 @@ int drm_release(struct inode *inode, struct file *filp) | |||
326 | struct drm_file *file_priv = filp->private_data; | 326 | struct drm_file *file_priv = filp->private_data; |
327 | struct drm_device *dev = file_priv->head->dev; | 327 | struct drm_device *dev = file_priv->head->dev; |
328 | int retcode = 0; | 328 | int retcode = 0; |
329 | unsigned long irqflags; | ||
329 | 330 | ||
330 | lock_kernel(); | 331 | lock_kernel(); |
331 | 332 | ||
@@ -357,9 +358,11 @@ int drm_release(struct inode *inode, struct file *filp) | |||
357 | */ | 358 | */ |
358 | 359 | ||
359 | do{ | 360 | do{ |
360 | spin_lock(&dev->lock.spinlock); | 361 | spin_lock_irqsave(&dev->lock.spinlock, |
362 | irqflags); | ||
361 | locked = dev->lock.idle_has_lock; | 363 | locked = dev->lock.idle_has_lock; |
362 | spin_unlock(&dev->lock.spinlock); | 364 | spin_unlock_irqrestore(&dev->lock.spinlock, |
365 | irqflags); | ||
363 | if (locked) | 366 | if (locked) |
364 | break; | 367 | break; |
365 | schedule(); | 368 | schedule(); |
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c index bea2a7d5b2b2..12dcdd1832f0 100644 --- a/drivers/char/drm/drm_lock.c +++ b/drivers/char/drm/drm_lock.c | |||
@@ -53,6 +53,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
53 | DECLARE_WAITQUEUE(entry, current); | 53 | DECLARE_WAITQUEUE(entry, current); |
54 | struct drm_lock *lock = data; | 54 | struct drm_lock *lock = data; |
55 | int ret = 0; | 55 | int ret = 0; |
56 | unsigned long irqflags; | ||
56 | 57 | ||
57 | ++file_priv->lock_count; | 58 | ++file_priv->lock_count; |
58 | 59 | ||
@@ -71,9 +72,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
71 | return -EINVAL; | 72 | return -EINVAL; |
72 | 73 | ||
73 | add_wait_queue(&dev->lock.lock_queue, &entry); | 74 | add_wait_queue(&dev->lock.lock_queue, &entry); |
74 | spin_lock(&dev->lock.spinlock); | 75 | spin_lock_irqsave(&dev->lock.spinlock, irqflags); |
75 | dev->lock.user_waiters++; | 76 | dev->lock.user_waiters++; |
76 | spin_unlock(&dev->lock.spinlock); | 77 | spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); |
77 | for (;;) { | 78 | for (;;) { |
78 | __set_current_state(TASK_INTERRUPTIBLE); | 79 | __set_current_state(TASK_INTERRUPTIBLE); |
79 | if (!dev->lock.hw_lock) { | 80 | if (!dev->lock.hw_lock) { |
@@ -95,9 +96,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
95 | break; | 96 | break; |
96 | } | 97 | } |
97 | } | 98 | } |
98 | spin_lock(&dev->lock.spinlock); | 99 | spin_lock_irqsave(&dev->lock.spinlock, irqflags); |
99 | dev->lock.user_waiters--; | 100 | dev->lock.user_waiters--; |
100 | spin_unlock(&dev->lock.spinlock); | 101 | spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); |
101 | __set_current_state(TASK_RUNNING); | 102 | __set_current_state(TASK_RUNNING); |
102 | remove_wait_queue(&dev->lock.lock_queue, &entry); | 103 | remove_wait_queue(&dev->lock.lock_queue, &entry); |
103 | 104 | ||
@@ -198,8 +199,9 @@ int drm_lock_take(struct drm_lock_data *lock_data, | |||
198 | { | 199 | { |
199 | unsigned int old, new, prev; | 200 | unsigned int old, new, prev; |
200 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 201 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
202 | unsigned long irqflags; | ||
201 | 203 | ||
202 | spin_lock(&lock_data->spinlock); | 204 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
203 | do { | 205 | do { |
204 | old = *lock; | 206 | old = *lock; |
205 | if (old & _DRM_LOCK_HELD) | 207 | if (old & _DRM_LOCK_HELD) |
@@ -211,7 +213,7 @@ int drm_lock_take(struct drm_lock_data *lock_data, | |||
211 | } | 213 | } |
212 | prev = cmpxchg(lock, old, new); | 214 | prev = cmpxchg(lock, old, new); |
213 | } while (prev != old); | 215 | } while (prev != old); |
214 | spin_unlock(&lock_data->spinlock); | 216 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
215 | 217 | ||
216 | if (_DRM_LOCKING_CONTEXT(old) == context) { | 218 | if (_DRM_LOCKING_CONTEXT(old) == context) { |
217 | if (old & _DRM_LOCK_HELD) { | 219 | if (old & _DRM_LOCK_HELD) { |
@@ -272,15 +274,16 @@ int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context) | |||
272 | { | 274 | { |
273 | unsigned int old, new, prev; | 275 | unsigned int old, new, prev; |
274 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 276 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
277 | unsigned long irqflags; | ||
275 | 278 | ||
276 | spin_lock(&lock_data->spinlock); | 279 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
277 | if (lock_data->kernel_waiters != 0) { | 280 | if (lock_data->kernel_waiters != 0) { |
278 | drm_lock_transfer(lock_data, 0); | 281 | drm_lock_transfer(lock_data, 0); |
279 | lock_data->idle_has_lock = 1; | 282 | lock_data->idle_has_lock = 1; |
280 | spin_unlock(&lock_data->spinlock); | 283 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
281 | return 1; | 284 | return 1; |
282 | } | 285 | } |
283 | spin_unlock(&lock_data->spinlock); | 286 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
284 | 287 | ||
285 | do { | 288 | do { |
286 | old = *lock; | 289 | old = *lock; |
@@ -344,19 +347,20 @@ static int drm_notifier(void *priv) | |||
344 | void drm_idlelock_take(struct drm_lock_data *lock_data) | 347 | void drm_idlelock_take(struct drm_lock_data *lock_data) |
345 | { | 348 | { |
346 | int ret = 0; | 349 | int ret = 0; |
350 | unsigned long irqflags; | ||
347 | 351 | ||
348 | spin_lock(&lock_data->spinlock); | 352 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
349 | lock_data->kernel_waiters++; | 353 | lock_data->kernel_waiters++; |
350 | if (!lock_data->idle_has_lock) { | 354 | if (!lock_data->idle_has_lock) { |
351 | 355 | ||
352 | spin_unlock(&lock_data->spinlock); | 356 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
353 | ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); | 357 | ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); |
354 | spin_lock(&lock_data->spinlock); | 358 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
355 | 359 | ||
356 | if (ret == 1) | 360 | if (ret == 1) |
357 | lock_data->idle_has_lock = 1; | 361 | lock_data->idle_has_lock = 1; |
358 | } | 362 | } |
359 | spin_unlock(&lock_data->spinlock); | 363 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
360 | } | 364 | } |
361 | EXPORT_SYMBOL(drm_idlelock_take); | 365 | EXPORT_SYMBOL(drm_idlelock_take); |
362 | 366 | ||
@@ -364,8 +368,9 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) | |||
364 | { | 368 | { |
365 | unsigned int old, prev; | 369 | unsigned int old, prev; |
366 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 370 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
371 | unsigned long irqflags; | ||
367 | 372 | ||
368 | spin_lock(&lock_data->spinlock); | 373 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
369 | if (--lock_data->kernel_waiters == 0) { | 374 | if (--lock_data->kernel_waiters == 0) { |
370 | if (lock_data->idle_has_lock) { | 375 | if (lock_data->idle_has_lock) { |
371 | do { | 376 | do { |
@@ -376,7 +381,7 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) | |||
376 | lock_data->idle_has_lock = 0; | 381 | lock_data->idle_has_lock = 0; |
377 | } | 382 | } |
378 | } | 383 | } |
379 | spin_unlock(&lock_data->spinlock); | 384 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
380 | } | 385 | } |
381 | EXPORT_SYMBOL(drm_idlelock_release); | 386 | EXPORT_SYMBOL(drm_idlelock_release); |
382 | 387 | ||
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h index 715b361f0c2b..a6a499f97e22 100644 --- a/drivers/char/drm/drm_pciids.h +++ b/drivers/char/drm/drm_pciids.h | |||
@@ -205,9 +205,9 @@ | |||
205 | {0x1002, 0x71D6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 205 | {0x1002, 0x71D6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
206 | {0x1002, 0x71DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \ | 206 | {0x1002, 0x71DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \ |
207 | {0x1002, 0x71DE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 207 | {0x1002, 0x71DE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
208 | {0x1002, 0x7200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \ | 208 | {0x1002, 0x7200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \ |
209 | {0x1002, 0x7210, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 209 | {0x1002, 0x7210, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
210 | {0x1002, 0x7211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 210 | {0x1002, 0x7211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
211 | {0x1002, 0x7240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ | 211 | {0x1002, 0x7240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ |
212 | {0x1002, 0x7243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ | 212 | {0x1002, 0x7243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ |
213 | {0x1002, 0x7244, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ | 213 | {0x1002, 0x7244, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ |
@@ -238,6 +238,7 @@ | |||
238 | {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \ | 238 | {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \ |
239 | {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 239 | {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
240 | {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ | 240 | {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ |
241 | {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ | ||
241 | {0, 0, 0} | 242 | {0, 0, 0} |
242 | 243 | ||
243 | #define r128_PCI_IDS \ | 244 | #define r128_PCI_IDS \ |
diff --git a/drivers/char/drm/drm_scatter.c b/drivers/char/drm/drm_scatter.c index 26d8f675ed5d..b2b0f3d41714 100644 --- a/drivers/char/drm/drm_scatter.c +++ b/drivers/char/drm/drm_scatter.c | |||
@@ -36,6 +36,15 @@ | |||
36 | 36 | ||
37 | #define DEBUG_SCATTER 0 | 37 | #define DEBUG_SCATTER 0 |
38 | 38 | ||
39 | static inline void *drm_vmalloc_dma(unsigned long size) | ||
40 | { | ||
41 | #if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE) | ||
42 | return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL | _PAGE_NO_CACHE); | ||
43 | #else | ||
44 | return vmalloc_32(size); | ||
45 | #endif | ||
46 | } | ||
47 | |||
39 | void drm_sg_cleanup(struct drm_sg_mem * entry) | 48 | void drm_sg_cleanup(struct drm_sg_mem * entry) |
40 | { | 49 | { |
41 | struct page *page; | 50 | struct page *page; |
@@ -104,7 +113,7 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request) | |||
104 | } | 113 | } |
105 | memset((void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr)); | 114 | memset((void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr)); |
106 | 115 | ||
107 | entry->virtual = vmalloc_32(pages << PAGE_SHIFT); | 116 | entry->virtual = drm_vmalloc_dma(pages << PAGE_SHIFT); |
108 | if (!entry->virtual) { | 117 | if (!entry->virtual) { |
109 | drm_free(entry->busaddr, | 118 | drm_free(entry->busaddr, |
110 | entry->pages * sizeof(*entry->busaddr), DRM_MEM_PAGES); | 119 | entry->pages * sizeof(*entry->busaddr), DRM_MEM_PAGES); |
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c index 3d65c4dcd0c6..945df72a51a9 100644 --- a/drivers/char/drm/drm_vm.c +++ b/drivers/char/drm/drm_vm.c | |||
@@ -54,13 +54,24 @@ static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma) | |||
54 | pgprot_val(tmp) |= _PAGE_NO_CACHE; | 54 | pgprot_val(tmp) |= _PAGE_NO_CACHE; |
55 | if (map_type == _DRM_REGISTERS) | 55 | if (map_type == _DRM_REGISTERS) |
56 | pgprot_val(tmp) |= _PAGE_GUARDED; | 56 | pgprot_val(tmp) |= _PAGE_GUARDED; |
57 | #endif | 57 | #elif defined(__ia64__) |
58 | #if defined(__ia64__) | ||
59 | if (efi_range_is_wc(vma->vm_start, vma->vm_end - | 58 | if (efi_range_is_wc(vma->vm_start, vma->vm_end - |
60 | vma->vm_start)) | 59 | vma->vm_start)) |
61 | tmp = pgprot_writecombine(tmp); | 60 | tmp = pgprot_writecombine(tmp); |
62 | else | 61 | else |
63 | tmp = pgprot_noncached(tmp); | 62 | tmp = pgprot_noncached(tmp); |
63 | #elif defined(__sparc__) | ||
64 | tmp = pgprot_noncached(tmp); | ||
65 | #endif | ||
66 | return tmp; | ||
67 | } | ||
68 | |||
69 | static pgprot_t drm_dma_prot(uint32_t map_type, struct vm_area_struct *vma) | ||
70 | { | ||
71 | pgprot_t tmp = vm_get_page_prot(vma->vm_flags); | ||
72 | |||
73 | #if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE) | ||
74 | tmp |= _PAGE_NO_CACHE; | ||
64 | #endif | 75 | #endif |
65 | return tmp; | 76 | return tmp; |
66 | } | 77 | } |
@@ -603,9 +614,6 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) | |||
603 | offset = dev->driver->get_reg_ofs(dev); | 614 | offset = dev->driver->get_reg_ofs(dev); |
604 | vma->vm_flags |= VM_IO; /* not in core dump */ | 615 | vma->vm_flags |= VM_IO; /* not in core dump */ |
605 | vma->vm_page_prot = drm_io_prot(map->type, vma); | 616 | vma->vm_page_prot = drm_io_prot(map->type, vma); |
606 | #ifdef __sparc__ | ||
607 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
608 | #endif | ||
609 | if (io_remap_pfn_range(vma, vma->vm_start, | 617 | if (io_remap_pfn_range(vma, vma->vm_start, |
610 | (map->offset + offset) >> PAGE_SHIFT, | 618 | (map->offset + offset) >> PAGE_SHIFT, |
611 | vma->vm_end - vma->vm_start, | 619 | vma->vm_end - vma->vm_start, |
@@ -624,6 +632,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) | |||
624 | page_to_pfn(virt_to_page(map->handle)), | 632 | page_to_pfn(virt_to_page(map->handle)), |
625 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) | 633 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
626 | return -EAGAIN; | 634 | return -EAGAIN; |
635 | vma->vm_page_prot = drm_dma_prot(map->type, vma); | ||
627 | /* fall through to _DRM_SHM */ | 636 | /* fall through to _DRM_SHM */ |
628 | case _DRM_SHM: | 637 | case _DRM_SHM: |
629 | vma->vm_ops = &drm_vm_shm_ops; | 638 | vma->vm_ops = &drm_vm_shm_ops; |
@@ -631,6 +640,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) | |||
631 | /* Don't let this area swap. Change when | 640 | /* Don't let this area swap. Change when |
632 | DRM_KERNEL advisory is supported. */ | 641 | DRM_KERNEL advisory is supported. */ |
633 | vma->vm_flags |= VM_RESERVED; | 642 | vma->vm_flags |= VM_RESERVED; |
643 | vma->vm_page_prot = drm_dma_prot(map->type, vma); | ||
634 | break; | 644 | break; |
635 | case _DRM_SCATTER_GATHER: | 645 | case _DRM_SCATTER_GATHER: |
636 | vma->vm_ops = &drm_vm_sg_ops; | 646 | vma->vm_ops = &drm_vm_sg_ops; |
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index e9d6663bec73..a043bb12301a 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -804,6 +804,9 @@ void i915_driver_lastclose(struct drm_device * dev) | |||
804 | { | 804 | { |
805 | drm_i915_private_t *dev_priv = dev->dev_private; | 805 | drm_i915_private_t *dev_priv = dev->dev_private; |
806 | 806 | ||
807 | if (!dev_priv) | ||
808 | return; | ||
809 | |||
807 | if (dev_priv->agp_heap) | 810 | if (dev_priv->agp_heap) |
808 | i915_mem_takedown(&(dev_priv->agp_heap)); | 811 | i915_mem_takedown(&(dev_priv->agp_heap)); |
809 | 812 | ||
diff --git a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c index 892e0a589846..f36adbd3aaf5 100644 --- a/drivers/char/drm/r128_cce.c +++ b/drivers/char/drm/r128_cce.c | |||
@@ -558,6 +558,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) | |||
558 | #if __OS_HAS_AGP | 558 | #if __OS_HAS_AGP |
559 | if (dev_priv->is_pci) { | 559 | if (dev_priv->is_pci) { |
560 | #endif | 560 | #endif |
561 | dev_priv->gart_info.table_mask = DMA_BIT_MASK(32); | ||
561 | dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN; | 562 | dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN; |
562 | dev_priv->gart_info.table_size = R128_PCIGART_TABLE_SIZE; | 563 | dev_priv->gart_info.table_size = R128_PCIGART_TABLE_SIZE; |
563 | dev_priv->gart_info.addr = NULL; | 564 | dev_priv->gart_info.addr = NULL; |
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c index 0f4afc44245c..f535812e4057 100644 --- a/drivers/char/drm/r300_cmdbuf.c +++ b/drivers/char/drm/r300_cmdbuf.c | |||
@@ -729,6 +729,47 @@ static void r300_discard_buffer(struct drm_device * dev, struct drm_buf * buf) | |||
729 | buf->used = 0; | 729 | buf->used = 0; |
730 | } | 730 | } |
731 | 731 | ||
732 | static void r300_cmd_wait(drm_radeon_private_t * dev_priv, | ||
733 | drm_r300_cmd_header_t header) | ||
734 | { | ||
735 | u32 wait_until; | ||
736 | RING_LOCALS; | ||
737 | |||
738 | if (!header.wait.flags) | ||
739 | return; | ||
740 | |||
741 | wait_until = 0; | ||
742 | |||
743 | switch(header.wait.flags) { | ||
744 | case R300_WAIT_2D: | ||
745 | wait_until = RADEON_WAIT_2D_IDLE; | ||
746 | break; | ||
747 | case R300_WAIT_3D: | ||
748 | wait_until = RADEON_WAIT_3D_IDLE; | ||
749 | break; | ||
750 | case R300_NEW_WAIT_2D_3D: | ||
751 | wait_until = RADEON_WAIT_2D_IDLE|RADEON_WAIT_3D_IDLE; | ||
752 | break; | ||
753 | case R300_NEW_WAIT_2D_2D_CLEAN: | ||
754 | wait_until = RADEON_WAIT_2D_IDLE|RADEON_WAIT_2D_IDLECLEAN; | ||
755 | break; | ||
756 | case R300_NEW_WAIT_3D_3D_CLEAN: | ||
757 | wait_until = RADEON_WAIT_3D_IDLE|RADEON_WAIT_3D_IDLECLEAN; | ||
758 | break; | ||
759 | case R300_NEW_WAIT_2D_2D_CLEAN_3D_3D_CLEAN: | ||
760 | wait_until = RADEON_WAIT_2D_IDLE|RADEON_WAIT_2D_IDLECLEAN; | ||
761 | wait_until |= RADEON_WAIT_3D_IDLE|RADEON_WAIT_3D_IDLECLEAN; | ||
762 | break; | ||
763 | default: | ||
764 | return; | ||
765 | } | ||
766 | |||
767 | BEGIN_RING(2); | ||
768 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
769 | OUT_RING(wait_until); | ||
770 | ADVANCE_RING(); | ||
771 | } | ||
772 | |||
732 | static int r300_scratch(drm_radeon_private_t *dev_priv, | 773 | static int r300_scratch(drm_radeon_private_t *dev_priv, |
733 | drm_radeon_kcmd_buffer_t *cmdbuf, | 774 | drm_radeon_kcmd_buffer_t *cmdbuf, |
734 | drm_r300_cmd_header_t header) | 775 | drm_r300_cmd_header_t header) |
@@ -909,19 +950,8 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, | |||
909 | break; | 950 | break; |
910 | 951 | ||
911 | case R300_CMD_WAIT: | 952 | case R300_CMD_WAIT: |
912 | /* simple enough, we can do it here */ | ||
913 | DRM_DEBUG("R300_CMD_WAIT\n"); | 953 | DRM_DEBUG("R300_CMD_WAIT\n"); |
914 | if (header.wait.flags == 0) | 954 | r300_cmd_wait(dev_priv, header); |
915 | break; /* nothing to do */ | ||
916 | |||
917 | { | ||
918 | RING_LOCALS; | ||
919 | |||
920 | BEGIN_RING(2); | ||
921 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
922 | OUT_RING((header.wait.flags & 0xf) << 14); | ||
923 | ADVANCE_RING(); | ||
924 | } | ||
925 | break; | 955 | break; |
926 | 956 | ||
927 | case R300_CMD_SCRATCH: | 957 | case R300_CMD_SCRATCH: |
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 833abc7e55fb..9072e4a1894e 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -1807,6 +1807,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) | |||
1807 | } else | 1807 | } else |
1808 | #endif | 1808 | #endif |
1809 | { | 1809 | { |
1810 | dev_priv->gart_info.table_mask = DMA_BIT_MASK(32); | ||
1810 | /* if we have an offset set from userspace */ | 1811 | /* if we have an offset set from userspace */ |
1811 | if (dev_priv->pcigart_offset_set) { | 1812 | if (dev_priv->pcigart_offset_set) { |
1812 | dev_priv->gart_info.bus_addr = | 1813 | dev_priv->gart_info.bus_addr = |
diff --git a/drivers/char/drm/radeon_drm.h b/drivers/char/drm/radeon_drm.h index 71e5b21fad2c..aab82e121e07 100644 --- a/drivers/char/drm/radeon_drm.h +++ b/drivers/char/drm/radeon_drm.h | |||
@@ -225,8 +225,20 @@ typedef union { | |||
225 | #define R300_CMD_WAIT 7 | 225 | #define R300_CMD_WAIT 7 |
226 | # define R300_WAIT_2D 0x1 | 226 | # define R300_WAIT_2D 0x1 |
227 | # define R300_WAIT_3D 0x2 | 227 | # define R300_WAIT_3D 0x2 |
228 | /* these two defines are DOING IT WRONG - however | ||
229 | * we have userspace which relies on using these. | ||
230 | * The wait interface is backwards compat new | ||
231 | * code should use the NEW_WAIT defines below | ||
232 | * THESE ARE NOT BIT FIELDS | ||
233 | */ | ||
228 | # define R300_WAIT_2D_CLEAN 0x3 | 234 | # define R300_WAIT_2D_CLEAN 0x3 |
229 | # define R300_WAIT_3D_CLEAN 0x4 | 235 | # define R300_WAIT_3D_CLEAN 0x4 |
236 | |||
237 | # define R300_NEW_WAIT_2D_3D 0x3 | ||
238 | # define R300_NEW_WAIT_2D_2D_CLEAN 0x4 | ||
239 | # define R300_NEW_WAIT_3D_3D_CLEAN 0x6 | ||
240 | # define R300_NEW_WAIT_2D_2D_CLEAN_3D_3D_CLEAN 0x8 | ||
241 | |||
230 | #define R300_CMD_SCRATCH 8 | 242 | #define R300_CMD_SCRATCH 8 |
231 | 243 | ||
232 | typedef union { | 244 | typedef union { |
diff --git a/drivers/char/drm/radeon_mem.c b/drivers/char/drm/radeon_mem.c index 78b34fa7c89a..4af5286a36fb 100644 --- a/drivers/char/drm/radeon_mem.c +++ b/drivers/char/drm/radeon_mem.c | |||
@@ -88,7 +88,7 @@ static struct mem_block *alloc_block(struct mem_block *heap, int size, | |||
88 | 88 | ||
89 | list_for_each(p, heap) { | 89 | list_for_each(p, heap) { |
90 | int start = (p->start + mask) & ~mask; | 90 | int start = (p->start + mask) & ~mask; |
91 | if (p->file_priv == 0 && start + size <= p->start + p->size) | 91 | if (p->file_priv == NULL && start + size <= p->start + p->size) |
92 | return split_block(p, start, size, file_priv); | 92 | return split_block(p, start, size, file_priv); |
93 | } | 93 | } |
94 | 94 | ||
@@ -113,7 +113,7 @@ static void free_block(struct mem_block *p) | |||
113 | /* Assumes a single contiguous range. Needs a special file_priv in | 113 | /* Assumes a single contiguous range. Needs a special file_priv in |
114 | * 'heap' to stop it being subsumed. | 114 | * 'heap' to stop it being subsumed. |
115 | */ | 115 | */ |
116 | if (p->next->file_priv == 0) { | 116 | if (p->next->file_priv == NULL) { |
117 | struct mem_block *q = p->next; | 117 | struct mem_block *q = p->next; |
118 | p->size += q->size; | 118 | p->size += q->size; |
119 | p->next = q->next; | 119 | p->next = q->next; |
@@ -121,7 +121,7 @@ static void free_block(struct mem_block *p) | |||
121 | drm_free(q, sizeof(*q), DRM_MEM_BUFS); | 121 | drm_free(q, sizeof(*q), DRM_MEM_BUFS); |
122 | } | 122 | } |
123 | 123 | ||
124 | if (p->prev->file_priv == 0) { | 124 | if (p->prev->file_priv == NULL) { |
125 | struct mem_block *q = p->prev; | 125 | struct mem_block *q = p->prev; |
126 | q->size += p->size; | 126 | q->size += p->size; |
127 | q->next = p->next; | 127 | q->next = p->next; |
@@ -174,7 +174,7 @@ void radeon_mem_release(struct drm_file *file_priv, struct mem_block *heap) | |||
174 | * 'heap' to stop it being subsumed. | 174 | * 'heap' to stop it being subsumed. |
175 | */ | 175 | */ |
176 | list_for_each(p, heap) { | 176 | list_for_each(p, heap) { |
177 | while (p->file_priv == 0 && p->next->file_priv == 0) { | 177 | while (p->file_priv == NULL && p->next->file_priv == NULL) { |
178 | struct mem_block *q = p->next; | 178 | struct mem_block *q = p->next; |
179 | p->size += q->size; | 179 | p->size += q->size; |
180 | p->next = q->next; | 180 | p->next = q->next; |
diff --git a/drivers/char/drm/via_dma.c b/drivers/char/drm/via_dma.c index 94baec692b57..7a339dba6a69 100644 --- a/drivers/char/drm/via_dma.c +++ b/drivers/char/drm/via_dma.c | |||
@@ -126,6 +126,8 @@ via_cmdbuf_wait(drm_via_private_t * dev_priv, unsigned int size) | |||
126 | hw_addr, cur_addr, next_addr); | 126 | hw_addr, cur_addr, next_addr); |
127 | return -1; | 127 | return -1; |
128 | } | 128 | } |
129 | if ((cur_addr < hw_addr) && (next_addr >= hw_addr)) | ||
130 | msleep(1); | ||
129 | } while ((cur_addr < hw_addr) && (next_addr >= hw_addr)); | 131 | } while ((cur_addr < hw_addr) && (next_addr >= hw_addr)); |
130 | return 0; | 132 | return 0; |
131 | } | 133 | } |
@@ -416,27 +418,50 @@ static int via_hook_segment(drm_via_private_t * dev_priv, | |||
416 | int paused, count; | 418 | int paused, count; |
417 | volatile uint32_t *paused_at = dev_priv->last_pause_ptr; | 419 | volatile uint32_t *paused_at = dev_priv->last_pause_ptr; |
418 | uint32_t reader,ptr; | 420 | uint32_t reader,ptr; |
421 | uint32_t diff; | ||
419 | 422 | ||
420 | paused = 0; | 423 | paused = 0; |
421 | via_flush_write_combine(); | 424 | via_flush_write_combine(); |
422 | (void) *(volatile uint32_t *)(via_get_dma(dev_priv) -1); | 425 | (void) *(volatile uint32_t *)(via_get_dma(dev_priv) -1); |
426 | |||
423 | *paused_at = pause_addr_lo; | 427 | *paused_at = pause_addr_lo; |
424 | via_flush_write_combine(); | 428 | via_flush_write_combine(); |
425 | (void) *paused_at; | 429 | (void) *paused_at; |
430 | |||
426 | reader = *(dev_priv->hw_addr_ptr); | 431 | reader = *(dev_priv->hw_addr_ptr); |
427 | ptr = ((volatile char *)paused_at - dev_priv->dma_ptr) + | 432 | ptr = ((volatile char *)paused_at - dev_priv->dma_ptr) + |
428 | dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4; | 433 | dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4; |
434 | |||
429 | dev_priv->last_pause_ptr = via_get_dma(dev_priv) - 1; | 435 | dev_priv->last_pause_ptr = via_get_dma(dev_priv) - 1; |
430 | 436 | ||
431 | if ((ptr - reader) <= dev_priv->dma_diff ) { | 437 | /* |
432 | count = 10000000; | 438 | * If there is a possibility that the command reader will |
433 | while (!(paused = (VIA_READ(0x41c) & 0x80000000)) && count--); | 439 | * miss the new pause address and pause on the old one, |
440 | * In that case we need to program the new start address | ||
441 | * using PCI. | ||
442 | */ | ||
443 | |||
444 | diff = (uint32_t) (ptr - reader) - dev_priv->dma_diff; | ||
445 | count = 10000000; | ||
446 | while(diff == 0 && count--) { | ||
447 | paused = (VIA_READ(0x41c) & 0x80000000); | ||
448 | if (paused) | ||
449 | break; | ||
450 | reader = *(dev_priv->hw_addr_ptr); | ||
451 | diff = (uint32_t) (ptr - reader) - dev_priv->dma_diff; | ||
434 | } | 452 | } |
435 | 453 | ||
454 | paused = VIA_READ(0x41c) & 0x80000000; | ||
455 | |||
436 | if (paused && !no_pci_fire) { | 456 | if (paused && !no_pci_fire) { |
437 | reader = *(dev_priv->hw_addr_ptr); | 457 | reader = *(dev_priv->hw_addr_ptr); |
438 | if ((ptr - reader) == dev_priv->dma_diff) { | 458 | diff = (uint32_t) (ptr - reader) - dev_priv->dma_diff; |
439 | 459 | diff &= (dev_priv->dma_high - 1); | |
460 | if (diff != 0 && diff < (dev_priv->dma_high >> 1)) { | ||
461 | DRM_ERROR("Paused at incorrect address. " | ||
462 | "0x%08x, 0x%08x 0x%08x\n", | ||
463 | ptr, reader, dev_priv->dma_diff); | ||
464 | } else if (diff == 0) { | ||
440 | /* | 465 | /* |
441 | * There is a concern that these writes may stall the PCI bus | 466 | * There is a concern that these writes may stall the PCI bus |
442 | * if the GPU is not idle. However, idling the GPU first | 467 | * if the GPU is not idle. However, idling the GPU first |
@@ -577,6 +602,7 @@ static void via_cmdbuf_jump(drm_via_private_t * dev_priv) | |||
577 | uint32_t pause_addr_lo, pause_addr_hi; | 602 | uint32_t pause_addr_lo, pause_addr_hi; |
578 | uint32_t jump_addr_lo, jump_addr_hi; | 603 | uint32_t jump_addr_lo, jump_addr_hi; |
579 | volatile uint32_t *last_pause_ptr; | 604 | volatile uint32_t *last_pause_ptr; |
605 | uint32_t dma_low_save1, dma_low_save2; | ||
580 | 606 | ||
581 | agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr; | 607 | agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr; |
582 | via_align_cmd(dev_priv, HC_HAGPBpID_JUMP, 0, &jump_addr_hi, | 608 | via_align_cmd(dev_priv, HC_HAGPBpID_JUMP, 0, &jump_addr_hi, |
@@ -603,8 +629,29 @@ static void via_cmdbuf_jump(drm_via_private_t * dev_priv) | |||
603 | &pause_addr_lo, 0); | 629 | &pause_addr_lo, 0); |
604 | 630 | ||
605 | *last_pause_ptr = pause_addr_lo; | 631 | *last_pause_ptr = pause_addr_lo; |
632 | dma_low_save1 = dev_priv->dma_low; | ||
606 | 633 | ||
607 | via_hook_segment( dev_priv, jump_addr_hi, jump_addr_lo, 0); | 634 | /* |
635 | * Now, set a trap that will pause the regulator if it tries to rerun the old | ||
636 | * command buffer. (Which may happen if via_hook_segment detecs a command regulator pause | ||
637 | * and reissues the jump command over PCI, while the regulator has already taken the jump | ||
638 | * and actually paused at the current buffer end). | ||
639 | * There appears to be no other way to detect this condition, since the hw_addr_pointer | ||
640 | * does not seem to get updated immediately when a jump occurs. | ||
641 | */ | ||
642 | |||
643 | last_pause_ptr = | ||
644 | via_align_cmd(dev_priv, HC_HAGPBpID_PAUSE, 0, &pause_addr_hi, | ||
645 | &pause_addr_lo, 0) - 1; | ||
646 | via_align_cmd(dev_priv, HC_HAGPBpID_PAUSE, 0, &pause_addr_hi, | ||
647 | &pause_addr_lo, 0); | ||
648 | *last_pause_ptr = pause_addr_lo; | ||
649 | |||
650 | dma_low_save2 = dev_priv->dma_low; | ||
651 | dev_priv->dma_low = dma_low_save1; | ||
652 | via_hook_segment(dev_priv, jump_addr_hi, jump_addr_lo, 0); | ||
653 | dev_priv->dma_low = dma_low_save2; | ||
654 | via_hook_segment(dev_priv, pause_addr_hi, pause_addr_lo, 0); | ||
608 | } | 655 | } |
609 | 656 | ||
610 | 657 | ||
diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c index 33c5197b73c4..409e00afdd07 100644 --- a/drivers/char/drm/via_dmablit.c +++ b/drivers/char/drm/via_dmablit.c | |||
@@ -603,7 +603,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli | |||
603 | * (Not a big limitation anyway.) | 603 | * (Not a big limitation anyway.) |
604 | */ | 604 | */ |
605 | 605 | ||
606 | if ((xfer->mem_stride - xfer->line_length) >= PAGE_SIZE) { | 606 | if ((xfer->mem_stride - xfer->line_length) > 2*PAGE_SIZE) { |
607 | DRM_ERROR("Too large system memory stride. Stride: %d, " | 607 | DRM_ERROR("Too large system memory stride. Stride: %d, " |
608 | "Length: %d\n", xfer->mem_stride, xfer->line_length); | 608 | "Length: %d\n", xfer->mem_stride, xfer->line_length); |
609 | return -EINVAL; | 609 | return -EINVAL; |
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 6bbd4fa50f3b..8d6c2089d2a8 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -9,7 +9,14 @@ config HW_RANDOM | |||
9 | Hardware Random Number Generator Core infrastructure. | 9 | Hardware Random Number Generator Core infrastructure. |
10 | 10 | ||
11 | To compile this driver as a module, choose M here: the | 11 | To compile this driver as a module, choose M here: the |
12 | module will be called rng-core. | 12 | module will be called rng-core. This provides a device |
13 | that's usually called /dev/hw_random, and which exposes one | ||
14 | of possibly several hardware random number generators. | ||
15 | |||
16 | These hardware random number generators do not feed directly | ||
17 | into the kernel's random number generator. That is usually | ||
18 | handled by the "rngd" daemon. Documentation/hw_random.txt | ||
19 | has more information. | ||
13 | 20 | ||
14 | If unsure, say Y. | 21 | If unsure, say Y. |
15 | 22 | ||
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 46b2a1cc8b54..0c09409fa45d 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -1183,7 +1183,7 @@ static int copy_from_read_buf(struct tty_struct *tty, | |||
1183 | return retval; | 1183 | return retval; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | extern ssize_t redirected_tty_write(struct file *, const char *, | 1186 | extern ssize_t redirected_tty_write(struct file *, const char __user *, |
1187 | size_t, loff_t *); | 1187 | size_t, loff_t *); |
1188 | 1188 | ||
1189 | /** | 1189 | /** |
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index 6d0dc5f9b6bb..6a6843a0a674 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c | |||
@@ -438,7 +438,7 @@ static void read_mem32(u32 *buf, const void __iomem *mem_addr_start, | |||
438 | u32 size_bytes) | 438 | u32 size_bytes) |
439 | { | 439 | { |
440 | u32 i = 0; | 440 | u32 i = 0; |
441 | const u32 *ptr = (__force u32 *) mem_addr_start; | 441 | const u32 __iomem *ptr = mem_addr_start; |
442 | u16 *buf16; | 442 | u16 *buf16; |
443 | 443 | ||
444 | if (unlikely(!ptr || !buf)) | 444 | if (unlikely(!ptr || !buf)) |
@@ -448,11 +448,11 @@ static void read_mem32(u32 *buf, const void __iomem *mem_addr_start, | |||
448 | switch (size_bytes) { | 448 | switch (size_bytes) { |
449 | case 2: /* 2 bytes */ | 449 | case 2: /* 2 bytes */ |
450 | buf16 = (u16 *) buf; | 450 | buf16 = (u16 *) buf; |
451 | *buf16 = __le16_to_cpu(readw((void __iomem *)ptr)); | 451 | *buf16 = __le16_to_cpu(readw(ptr)); |
452 | goto out; | 452 | goto out; |
453 | break; | 453 | break; |
454 | case 4: /* 4 bytes */ | 454 | case 4: /* 4 bytes */ |
455 | *(buf) = __le32_to_cpu(readl((void __iomem *)ptr)); | 455 | *(buf) = __le32_to_cpu(readl(ptr)); |
456 | goto out; | 456 | goto out; |
457 | break; | 457 | break; |
458 | } | 458 | } |
@@ -461,11 +461,11 @@ static void read_mem32(u32 *buf, const void __iomem *mem_addr_start, | |||
461 | if (size_bytes - i == 2) { | 461 | if (size_bytes - i == 2) { |
462 | /* Handle 2 bytes in the end */ | 462 | /* Handle 2 bytes in the end */ |
463 | buf16 = (u16 *) buf; | 463 | buf16 = (u16 *) buf; |
464 | *(buf16) = __le16_to_cpu(readw((void __iomem *)ptr)); | 464 | *(buf16) = __le16_to_cpu(readw(ptr)); |
465 | i += 2; | 465 | i += 2; |
466 | } else { | 466 | } else { |
467 | /* Read 4 bytes */ | 467 | /* Read 4 bytes */ |
468 | *(buf) = __le32_to_cpu(readl((void __iomem *)ptr)); | 468 | *(buf) = __le32_to_cpu(readl(ptr)); |
469 | i += 4; | 469 | i += 4; |
470 | } | 470 | } |
471 | buf++; | 471 | buf++; |
@@ -484,7 +484,7 @@ static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, | |||
484 | u32 size_bytes) | 484 | u32 size_bytes) |
485 | { | 485 | { |
486 | u32 i = 0; | 486 | u32 i = 0; |
487 | u32 *ptr = (__force u32 *) mem_addr_start; | 487 | u32 __iomem *ptr = mem_addr_start; |
488 | const u16 *buf16; | 488 | const u16 *buf16; |
489 | 489 | ||
490 | if (unlikely(!ptr || !buf)) | 490 | if (unlikely(!ptr || !buf)) |
@@ -494,7 +494,7 @@ static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, | |||
494 | switch (size_bytes) { | 494 | switch (size_bytes) { |
495 | case 2: /* 2 bytes */ | 495 | case 2: /* 2 bytes */ |
496 | buf16 = (const u16 *)buf; | 496 | buf16 = (const u16 *)buf; |
497 | writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); | 497 | writew(__cpu_to_le16(*buf16), ptr); |
498 | return 2; | 498 | return 2; |
499 | break; | 499 | break; |
500 | case 1: /* | 500 | case 1: /* |
@@ -502,7 +502,7 @@ static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, | |||
502 | * so falling through.. | 502 | * so falling through.. |
503 | */ | 503 | */ |
504 | case 4: /* 4 bytes */ | 504 | case 4: /* 4 bytes */ |
505 | writel(__cpu_to_le32(*buf), (void __iomem *)ptr); | 505 | writel(__cpu_to_le32(*buf), ptr); |
506 | return 4; | 506 | return 4; |
507 | break; | 507 | break; |
508 | } | 508 | } |
@@ -511,11 +511,11 @@ static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, | |||
511 | if (size_bytes - i == 2) { | 511 | if (size_bytes - i == 2) { |
512 | /* 2 bytes */ | 512 | /* 2 bytes */ |
513 | buf16 = (const u16 *)buf; | 513 | buf16 = (const u16 *)buf; |
514 | writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); | 514 | writew(__cpu_to_le16(*buf16), ptr); |
515 | i += 2; | 515 | i += 2; |
516 | } else { | 516 | } else { |
517 | /* 4 bytes */ | 517 | /* 4 bytes */ |
518 | writel(__cpu_to_le32(*buf), (void __iomem *)ptr); | 518 | writel(__cpu_to_le32(*buf), ptr); |
519 | i += 4; | 519 | i += 4; |
520 | } | 520 | } |
521 | buf++; | 521 | buf++; |
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 589ac6f65b9a..3f9d0a9ac36d 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -1709,7 +1709,7 @@ static int __init riscom8_init_module (void) | |||
1709 | 1709 | ||
1710 | if (iobase || iobase1 || iobase2 || iobase3) { | 1710 | if (iobase || iobase1 || iobase2 || iobase3) { |
1711 | for(i = 0; i < RC_NBOARD; i++) | 1711 | for(i = 0; i < RC_NBOARD; i++) |
1712 | rc_board[0].base = 0; | 1712 | rc_board[i].base = 0; |
1713 | } | 1713 | } |
1714 | 1714 | ||
1715 | if (iobase) | 1715 | if (iobase) |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 72f289279d8f..f585bc8579e9 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #include <linux/pci.h> | 83 | #include <linux/pci.h> |
84 | #include <asm/uaccess.h> | 84 | #include <asm/uaccess.h> |
85 | #include <asm/atomic.h> | 85 | #include <asm/atomic.h> |
86 | #include <asm/unaligned.h> | ||
86 | #include <linux/bitops.h> | 87 | #include <linux/bitops.h> |
87 | #include <linux/spinlock.h> | 88 | #include <linux/spinlock.h> |
88 | #include <linux/init.h> | 89 | #include <linux/init.h> |
@@ -1312,7 +1313,7 @@ static int rp_tiocmset(struct tty_struct *tty, struct file *file, | |||
1312 | if (clear & TIOCM_DTR) | 1313 | if (clear & TIOCM_DTR) |
1313 | info->channel.TxControl[3] &= ~SET_DTR; | 1314 | info->channel.TxControl[3] &= ~SET_DTR; |
1314 | 1315 | ||
1315 | sOutDW(info->channel.IndexAddr, *(DWord_t *) & (info->channel.TxControl[0])); | 1316 | out32(info->channel.IndexAddr, info->channel.TxControl); |
1316 | return 0; | 1317 | return 0; |
1317 | } | 1318 | } |
1318 | 1319 | ||
@@ -1748,7 +1749,7 @@ static int rp_write(struct tty_struct *tty, | |||
1748 | 1749 | ||
1749 | /* Write remaining data into the port's xmit_buf */ | 1750 | /* Write remaining data into the port's xmit_buf */ |
1750 | while (1) { | 1751 | while (1) { |
1751 | if (info->tty == 0) /* Seemingly obligatory check... */ | 1752 | if (!info->tty) /* Seemingly obligatory check... */ |
1752 | goto end; | 1753 | goto end; |
1753 | 1754 | ||
1754 | c = min(count, min(XMIT_BUF_SIZE - info->xmit_cnt - 1, XMIT_BUF_SIZE - info->xmit_head)); | 1755 | c = min(count, min(XMIT_BUF_SIZE - info->xmit_cnt - 1, XMIT_BUF_SIZE - info->xmit_head)); |
@@ -2798,7 +2799,7 @@ static int sReadAiopNumChan(WordIO_t io) | |||
2798 | static Byte_t R[4] = { 0x00, 0x00, 0x34, 0x12 }; | 2799 | static Byte_t R[4] = { 0x00, 0x00, 0x34, 0x12 }; |
2799 | 2800 | ||
2800 | /* write to chan 0 SRAM */ | 2801 | /* write to chan 0 SRAM */ |
2801 | sOutDW((DWordIO_t) io + _INDX_ADDR, *((DWord_t *) & R[0])); | 2802 | out32((DWordIO_t) io + _INDX_ADDR, R); |
2802 | sOutW(io + _INDX_ADDR, 0); /* read from SRAM, chan 0 */ | 2803 | sOutW(io + _INDX_ADDR, 0); /* read from SRAM, chan 0 */ |
2803 | x = sInW(io + _INDX_DATA); | 2804 | x = sInW(io + _INDX_DATA); |
2804 | sOutW(io + _INDX_ADDR, 0x4000); /* read from SRAM, chan 4 */ | 2805 | sOutW(io + _INDX_ADDR, 0x4000); /* read from SRAM, chan 4 */ |
@@ -2864,7 +2865,7 @@ static int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, | |||
2864 | R[1] = RData[i + 1] + 0x10 * ChanNum; | 2865 | R[1] = RData[i + 1] + 0x10 * ChanNum; |
2865 | R[2] = RData[i + 2]; | 2866 | R[2] = RData[i + 2]; |
2866 | R[3] = RData[i + 3]; | 2867 | R[3] = RData[i + 3]; |
2867 | sOutDW(ChP->IndexAddr, *((DWord_t *) & R[0])); | 2868 | out32(ChP->IndexAddr, R); |
2868 | } | 2869 | } |
2869 | 2870 | ||
2870 | ChR = ChP->R; | 2871 | ChR = ChP->R; |
@@ -2887,43 +2888,43 @@ static int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, | |||
2887 | ChP->BaudDiv[1] = (Byte_t) ((ChOff + _BAUD) >> 8); | 2888 | ChP->BaudDiv[1] = (Byte_t) ((ChOff + _BAUD) >> 8); |
2888 | ChP->BaudDiv[2] = (Byte_t) brd9600; | 2889 | ChP->BaudDiv[2] = (Byte_t) brd9600; |
2889 | ChP->BaudDiv[3] = (Byte_t) (brd9600 >> 8); | 2890 | ChP->BaudDiv[3] = (Byte_t) (brd9600 >> 8); |
2890 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->BaudDiv[0]); | 2891 | out32(ChP->IndexAddr, ChP->BaudDiv); |
2891 | 2892 | ||
2892 | ChP->TxControl[0] = (Byte_t) (ChOff + _TX_CTRL); | 2893 | ChP->TxControl[0] = (Byte_t) (ChOff + _TX_CTRL); |
2893 | ChP->TxControl[1] = (Byte_t) ((ChOff + _TX_CTRL) >> 8); | 2894 | ChP->TxControl[1] = (Byte_t) ((ChOff + _TX_CTRL) >> 8); |
2894 | ChP->TxControl[2] = 0; | 2895 | ChP->TxControl[2] = 0; |
2895 | ChP->TxControl[3] = 0; | 2896 | ChP->TxControl[3] = 0; |
2896 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxControl[0]); | 2897 | out32(ChP->IndexAddr, ChP->TxControl); |
2897 | 2898 | ||
2898 | ChP->RxControl[0] = (Byte_t) (ChOff + _RX_CTRL); | 2899 | ChP->RxControl[0] = (Byte_t) (ChOff + _RX_CTRL); |
2899 | ChP->RxControl[1] = (Byte_t) ((ChOff + _RX_CTRL) >> 8); | 2900 | ChP->RxControl[1] = (Byte_t) ((ChOff + _RX_CTRL) >> 8); |
2900 | ChP->RxControl[2] = 0; | 2901 | ChP->RxControl[2] = 0; |
2901 | ChP->RxControl[3] = 0; | 2902 | ChP->RxControl[3] = 0; |
2902 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->RxControl[0]); | 2903 | out32(ChP->IndexAddr, ChP->RxControl); |
2903 | 2904 | ||
2904 | ChP->TxEnables[0] = (Byte_t) (ChOff + _TX_ENBLS); | 2905 | ChP->TxEnables[0] = (Byte_t) (ChOff + _TX_ENBLS); |
2905 | ChP->TxEnables[1] = (Byte_t) ((ChOff + _TX_ENBLS) >> 8); | 2906 | ChP->TxEnables[1] = (Byte_t) ((ChOff + _TX_ENBLS) >> 8); |
2906 | ChP->TxEnables[2] = 0; | 2907 | ChP->TxEnables[2] = 0; |
2907 | ChP->TxEnables[3] = 0; | 2908 | ChP->TxEnables[3] = 0; |
2908 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxEnables[0]); | 2909 | out32(ChP->IndexAddr, ChP->TxEnables); |
2909 | 2910 | ||
2910 | ChP->TxCompare[0] = (Byte_t) (ChOff + _TXCMP1); | 2911 | ChP->TxCompare[0] = (Byte_t) (ChOff + _TXCMP1); |
2911 | ChP->TxCompare[1] = (Byte_t) ((ChOff + _TXCMP1) >> 8); | 2912 | ChP->TxCompare[1] = (Byte_t) ((ChOff + _TXCMP1) >> 8); |
2912 | ChP->TxCompare[2] = 0; | 2913 | ChP->TxCompare[2] = 0; |
2913 | ChP->TxCompare[3] = 0; | 2914 | ChP->TxCompare[3] = 0; |
2914 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxCompare[0]); | 2915 | out32(ChP->IndexAddr, ChP->TxCompare); |
2915 | 2916 | ||
2916 | ChP->TxReplace1[0] = (Byte_t) (ChOff + _TXREP1B1); | 2917 | ChP->TxReplace1[0] = (Byte_t) (ChOff + _TXREP1B1); |
2917 | ChP->TxReplace1[1] = (Byte_t) ((ChOff + _TXREP1B1) >> 8); | 2918 | ChP->TxReplace1[1] = (Byte_t) ((ChOff + _TXREP1B1) >> 8); |
2918 | ChP->TxReplace1[2] = 0; | 2919 | ChP->TxReplace1[2] = 0; |
2919 | ChP->TxReplace1[3] = 0; | 2920 | ChP->TxReplace1[3] = 0; |
2920 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxReplace1[0]); | 2921 | out32(ChP->IndexAddr, ChP->TxReplace1); |
2921 | 2922 | ||
2922 | ChP->TxReplace2[0] = (Byte_t) (ChOff + _TXREP2); | 2923 | ChP->TxReplace2[0] = (Byte_t) (ChOff + _TXREP2); |
2923 | ChP->TxReplace2[1] = (Byte_t) ((ChOff + _TXREP2) >> 8); | 2924 | ChP->TxReplace2[1] = (Byte_t) ((ChOff + _TXREP2) >> 8); |
2924 | ChP->TxReplace2[2] = 0; | 2925 | ChP->TxReplace2[2] = 0; |
2925 | ChP->TxReplace2[3] = 0; | 2926 | ChP->TxReplace2[3] = 0; |
2926 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxReplace2[0]); | 2927 | out32(ChP->IndexAddr, ChP->TxReplace2); |
2927 | 2928 | ||
2928 | ChP->TxFIFOPtrs = ChOff + _TXF_OUTP; | 2929 | ChP->TxFIFOPtrs = ChOff + _TXF_OUTP; |
2929 | ChP->TxFIFO = ChOff + _TX_FIFO; | 2930 | ChP->TxFIFO = ChOff + _TX_FIFO; |
@@ -2979,7 +2980,7 @@ static void sStopRxProcessor(CHANNEL_T * ChP) | |||
2979 | R[1] = ChP->R[1]; | 2980 | R[1] = ChP->R[1]; |
2980 | R[2] = 0x0a; | 2981 | R[2] = 0x0a; |
2981 | R[3] = ChP->R[3]; | 2982 | R[3] = ChP->R[3]; |
2982 | sOutDW(ChP->IndexAddr, *(DWord_t *) & R[0]); | 2983 | out32(ChP->IndexAddr, R); |
2983 | } | 2984 | } |
2984 | 2985 | ||
2985 | /*************************************************************************** | 2986 | /*************************************************************************** |
@@ -3094,13 +3095,13 @@ static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data) | |||
3094 | *WordPtr = ChP->TxPrioBuf; /* data byte address */ | 3095 | *WordPtr = ChP->TxPrioBuf; /* data byte address */ |
3095 | 3096 | ||
3096 | DWBuf[2] = Data; /* data byte value */ | 3097 | DWBuf[2] = Data; /* data byte value */ |
3097 | sOutDW(IndexAddr, *((DWord_t *) (&DWBuf[0]))); /* write it out */ | 3098 | out32(IndexAddr, DWBuf); /* write it out */ |
3098 | 3099 | ||
3099 | *WordPtr = ChP->TxPrioCnt; /* Tx priority count address */ | 3100 | *WordPtr = ChP->TxPrioCnt; /* Tx priority count address */ |
3100 | 3101 | ||
3101 | DWBuf[2] = PRI_PEND + 1; /* indicate 1 byte pending */ | 3102 | DWBuf[2] = PRI_PEND + 1; /* indicate 1 byte pending */ |
3102 | DWBuf[3] = 0; /* priority buffer pointer */ | 3103 | DWBuf[3] = 0; /* priority buffer pointer */ |
3103 | sOutDW(IndexAddr, *((DWord_t *) (&DWBuf[0]))); /* write it out */ | 3104 | out32(IndexAddr, DWBuf); /* write it out */ |
3104 | } else { /* write it to Tx FIFO */ | 3105 | } else { /* write it to Tx FIFO */ |
3105 | 3106 | ||
3106 | sWriteTxByte(sGetTxRxDataIO(ChP), Data); | 3107 | sWriteTxByte(sGetTxRxDataIO(ChP), Data); |
@@ -3147,11 +3148,11 @@ static void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags) | |||
3147 | ChP->RxControl[2] |= | 3148 | ChP->RxControl[2] |= |
3148 | ((Byte_t) Flags & (RXINT_EN | SRCINT_EN | MCINT_EN)); | 3149 | ((Byte_t) Flags & (RXINT_EN | SRCINT_EN | MCINT_EN)); |
3149 | 3150 | ||
3150 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->RxControl[0]); | 3151 | out32(ChP->IndexAddr, ChP->RxControl); |
3151 | 3152 | ||
3152 | ChP->TxControl[2] |= ((Byte_t) Flags & TXINT_EN); | 3153 | ChP->TxControl[2] |= ((Byte_t) Flags & TXINT_EN); |
3153 | 3154 | ||
3154 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxControl[0]); | 3155 | out32(ChP->IndexAddr, ChP->TxControl); |
3155 | 3156 | ||
3156 | if (Flags & CHANINT_EN) { | 3157 | if (Flags & CHANINT_EN) { |
3157 | Mask = sInB(ChP->IntMask) | sBitMapSetTbl[ChP->ChanNum]; | 3158 | Mask = sInB(ChP->IntMask) | sBitMapSetTbl[ChP->ChanNum]; |
@@ -3190,9 +3191,9 @@ static void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags) | |||
3190 | 3191 | ||
3191 | ChP->RxControl[2] &= | 3192 | ChP->RxControl[2] &= |
3192 | ~((Byte_t) Flags & (RXINT_EN | SRCINT_EN | MCINT_EN)); | 3193 | ~((Byte_t) Flags & (RXINT_EN | SRCINT_EN | MCINT_EN)); |
3193 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->RxControl[0]); | 3194 | out32(ChP->IndexAddr, ChP->RxControl); |
3194 | ChP->TxControl[2] &= ~((Byte_t) Flags & TXINT_EN); | 3195 | ChP->TxControl[2] &= ~((Byte_t) Flags & TXINT_EN); |
3195 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxControl[0]); | 3196 | out32(ChP->IndexAddr, ChP->TxControl); |
3196 | 3197 | ||
3197 | if (Flags & CHANINT_EN) { | 3198 | if (Flags & CHANINT_EN) { |
3198 | Mask = sInB(ChP->IntMask) & sBitMapClrTbl[ChP->ChanNum]; | 3199 | Mask = sInB(ChP->IntMask) & sBitMapClrTbl[ChP->ChanNum]; |
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h index f3a75791b811..b01d38125a8f 100644 --- a/drivers/char/rocket_int.h +++ b/drivers/char/rocket_int.h | |||
@@ -26,7 +26,6 @@ typedef unsigned int ByteIO_t; | |||
26 | typedef unsigned int Word_t; | 26 | typedef unsigned int Word_t; |
27 | typedef unsigned int WordIO_t; | 27 | typedef unsigned int WordIO_t; |
28 | 28 | ||
29 | typedef unsigned long DWord_t; | ||
30 | typedef unsigned int DWordIO_t; | 29 | typedef unsigned int DWordIO_t; |
31 | 30 | ||
32 | /* | 31 | /* |
@@ -38,7 +37,6 @@ typedef unsigned int DWordIO_t; | |||
38 | * instruction. | 37 | * instruction. |
39 | */ | 38 | */ |
40 | 39 | ||
41 | #ifdef ROCKET_DEBUG_IO | ||
42 | static inline void sOutB(unsigned short port, unsigned char value) | 40 | static inline void sOutB(unsigned short port, unsigned char value) |
43 | { | 41 | { |
44 | #ifdef ROCKET_DEBUG_IO | 42 | #ifdef ROCKET_DEBUG_IO |
@@ -55,12 +53,13 @@ static inline void sOutW(unsigned short port, unsigned short value) | |||
55 | outw_p(value, port); | 53 | outw_p(value, port); |
56 | } | 54 | } |
57 | 55 | ||
58 | static inline void sOutDW(unsigned short port, unsigned long value) | 56 | static inline void out32(unsigned short port, Byte_t *p) |
59 | { | 57 | { |
58 | u32 value = le32_to_cpu(get_unaligned((__le32 *)p)); | ||
60 | #ifdef ROCKET_DEBUG_IO | 59 | #ifdef ROCKET_DEBUG_IO |
61 | printk(KERN_DEBUG "sOutDW(%x, %lx)...\n", port, value); | 60 | printk(KERN_DEBUG "out32(%x, %lx)...\n", port, value); |
62 | #endif | 61 | #endif |
63 | outl_p(cpu_to_le32(value), port); | 62 | outl_p(value, port); |
64 | } | 63 | } |
65 | 64 | ||
66 | static inline unsigned char sInB(unsigned short port) | 65 | static inline unsigned char sInB(unsigned short port) |
@@ -73,14 +72,6 @@ static inline unsigned short sInW(unsigned short port) | |||
73 | return inw_p(port); | 72 | return inw_p(port); |
74 | } | 73 | } |
75 | 74 | ||
76 | #else /* !ROCKET_DEBUG_IO */ | ||
77 | #define sOutB(a, b) outb_p(b, a) | ||
78 | #define sOutW(a, b) outw_p(b, a) | ||
79 | #define sOutDW(port, value) outl_p(cpu_to_le32(value), port) | ||
80 | #define sInB(a) (inb_p(a)) | ||
81 | #define sInW(a) (inw_p(a)) | ||
82 | #endif /* ROCKET_DEBUG_IO */ | ||
83 | |||
84 | /* This is used to move arrays of bytes so byte swapping isn't appropriate. */ | 75 | /* This is used to move arrays of bytes so byte swapping isn't appropriate. */ |
85 | #define sOutStrW(port, addr, count) if (count) outsw(port, addr, count) | 76 | #define sOutStrW(port, addr, count) if (count) outsw(port, addr, count) |
86 | #define sInStrW(port, addr, count) if (count) insw(port, addr, count) | 77 | #define sInStrW(port, addr, count) if (count) insw(port, addr, count) |
@@ -390,7 +381,7 @@ Call: sClrBreak(ChP) | |||
390 | #define sClrBreak(ChP) \ | 381 | #define sClrBreak(ChP) \ |
391 | do { \ | 382 | do { \ |
392 | (ChP)->TxControl[3] &= ~SETBREAK; \ | 383 | (ChP)->TxControl[3] &= ~SETBREAK; \ |
393 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 384 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
394 | } while (0) | 385 | } while (0) |
395 | 386 | ||
396 | /*************************************************************************** | 387 | /*************************************************************************** |
@@ -402,7 +393,7 @@ Call: sClrDTR(ChP) | |||
402 | #define sClrDTR(ChP) \ | 393 | #define sClrDTR(ChP) \ |
403 | do { \ | 394 | do { \ |
404 | (ChP)->TxControl[3] &= ~SET_DTR; \ | 395 | (ChP)->TxControl[3] &= ~SET_DTR; \ |
405 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 396 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
406 | } while (0) | 397 | } while (0) |
407 | 398 | ||
408 | /*************************************************************************** | 399 | /*************************************************************************** |
@@ -415,7 +406,7 @@ Call: sClrRTS(ChP) | |||
415 | do { \ | 406 | do { \ |
416 | if ((ChP)->rtsToggle) break; \ | 407 | if ((ChP)->rtsToggle) break; \ |
417 | (ChP)->TxControl[3] &= ~SET_RTS; \ | 408 | (ChP)->TxControl[3] &= ~SET_RTS; \ |
418 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 409 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
419 | } while (0) | 410 | } while (0) |
420 | 411 | ||
421 | /*************************************************************************** | 412 | /*************************************************************************** |
@@ -489,7 +480,7 @@ Call: sDisCTSFlowCtl(ChP) | |||
489 | #define sDisCTSFlowCtl(ChP) \ | 480 | #define sDisCTSFlowCtl(ChP) \ |
490 | do { \ | 481 | do { \ |
491 | (ChP)->TxControl[2] &= ~CTSFC_EN; \ | 482 | (ChP)->TxControl[2] &= ~CTSFC_EN; \ |
492 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 483 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
493 | } while (0) | 484 | } while (0) |
494 | 485 | ||
495 | /*************************************************************************** | 486 | /*************************************************************************** |
@@ -501,7 +492,7 @@ Call: sDisIXANY(ChP) | |||
501 | #define sDisIXANY(ChP) \ | 492 | #define sDisIXANY(ChP) \ |
502 | do { \ | 493 | do { \ |
503 | (ChP)->R[0x0e] = 0x86; \ | 494 | (ChP)->R[0x0e] = 0x86; \ |
504 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x0c]); \ | 495 | out32((ChP)->IndexAddr,&(ChP)->R[0x0c]); \ |
505 | } while (0) | 496 | } while (0) |
506 | 497 | ||
507 | /*************************************************************************** | 498 | /*************************************************************************** |
@@ -515,7 +506,7 @@ Comments: Function sSetParity() can be used in place of functions sEnParity(), | |||
515 | #define sDisParity(ChP) \ | 506 | #define sDisParity(ChP) \ |
516 | do { \ | 507 | do { \ |
517 | (ChP)->TxControl[2] &= ~PARITY_EN; \ | 508 | (ChP)->TxControl[2] &= ~PARITY_EN; \ |
518 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 509 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
519 | } while (0) | 510 | } while (0) |
520 | 511 | ||
521 | /*************************************************************************** | 512 | /*************************************************************************** |
@@ -527,7 +518,7 @@ Call: sDisRTSToggle(ChP) | |||
527 | #define sDisRTSToggle(ChP) \ | 518 | #define sDisRTSToggle(ChP) \ |
528 | do { \ | 519 | do { \ |
529 | (ChP)->TxControl[2] &= ~RTSTOG_EN; \ | 520 | (ChP)->TxControl[2] &= ~RTSTOG_EN; \ |
530 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 521 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
531 | (ChP)->rtsToggle = 0; \ | 522 | (ChP)->rtsToggle = 0; \ |
532 | } while (0) | 523 | } while (0) |
533 | 524 | ||
@@ -540,7 +531,7 @@ Call: sDisRxFIFO(ChP) | |||
540 | #define sDisRxFIFO(ChP) \ | 531 | #define sDisRxFIFO(ChP) \ |
541 | do { \ | 532 | do { \ |
542 | (ChP)->R[0x32] = 0x0a; \ | 533 | (ChP)->R[0x32] = 0x0a; \ |
543 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x30]); \ | 534 | out32((ChP)->IndexAddr,&(ChP)->R[0x30]); \ |
544 | } while (0) | 535 | } while (0) |
545 | 536 | ||
546 | /*************************************************************************** | 537 | /*************************************************************************** |
@@ -567,7 +558,7 @@ Call: sDisTransmit(ChP) | |||
567 | #define sDisTransmit(ChP) \ | 558 | #define sDisTransmit(ChP) \ |
568 | do { \ | 559 | do { \ |
569 | (ChP)->TxControl[3] &= ~TX_ENABLE; \ | 560 | (ChP)->TxControl[3] &= ~TX_ENABLE; \ |
570 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 561 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
571 | } while (0) | 562 | } while (0) |
572 | 563 | ||
573 | /*************************************************************************** | 564 | /*************************************************************************** |
@@ -579,7 +570,7 @@ Call: sDisTxSoftFlowCtl(ChP) | |||
579 | #define sDisTxSoftFlowCtl(ChP) \ | 570 | #define sDisTxSoftFlowCtl(ChP) \ |
580 | do { \ | 571 | do { \ |
581 | (ChP)->R[0x06] = 0x8a; \ | 572 | (ChP)->R[0x06] = 0x8a; \ |
582 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \ | 573 | out32((ChP)->IndexAddr,&(ChP)->R[0x04]); \ |
583 | } while (0) | 574 | } while (0) |
584 | 575 | ||
585 | /*************************************************************************** | 576 | /*************************************************************************** |
@@ -604,7 +595,7 @@ Call: sEnCTSFlowCtl(ChP) | |||
604 | #define sEnCTSFlowCtl(ChP) \ | 595 | #define sEnCTSFlowCtl(ChP) \ |
605 | do { \ | 596 | do { \ |
606 | (ChP)->TxControl[2] |= CTSFC_EN; \ | 597 | (ChP)->TxControl[2] |= CTSFC_EN; \ |
607 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 598 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
608 | } while (0) | 599 | } while (0) |
609 | 600 | ||
610 | /*************************************************************************** | 601 | /*************************************************************************** |
@@ -616,7 +607,7 @@ Call: sEnIXANY(ChP) | |||
616 | #define sEnIXANY(ChP) \ | 607 | #define sEnIXANY(ChP) \ |
617 | do { \ | 608 | do { \ |
618 | (ChP)->R[0x0e] = 0x21; \ | 609 | (ChP)->R[0x0e] = 0x21; \ |
619 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x0c]); \ | 610 | out32((ChP)->IndexAddr,&(ChP)->R[0x0c]); \ |
620 | } while (0) | 611 | } while (0) |
621 | 612 | ||
622 | /*************************************************************************** | 613 | /*************************************************************************** |
@@ -633,7 +624,7 @@ Warnings: Before enabling parity odd or even parity should be chosen using | |||
633 | #define sEnParity(ChP) \ | 624 | #define sEnParity(ChP) \ |
634 | do { \ | 625 | do { \ |
635 | (ChP)->TxControl[2] |= PARITY_EN; \ | 626 | (ChP)->TxControl[2] |= PARITY_EN; \ |
636 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 627 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
637 | } while (0) | 628 | } while (0) |
638 | 629 | ||
639 | /*************************************************************************** | 630 | /*************************************************************************** |
@@ -647,10 +638,10 @@ Comments: This function will disable RTS flow control and clear the RTS | |||
647 | #define sEnRTSToggle(ChP) \ | 638 | #define sEnRTSToggle(ChP) \ |
648 | do { \ | 639 | do { \ |
649 | (ChP)->RxControl[2] &= ~RTSFC_EN; \ | 640 | (ChP)->RxControl[2] &= ~RTSFC_EN; \ |
650 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \ | 641 | out32((ChP)->IndexAddr,(ChP)->RxControl); \ |
651 | (ChP)->TxControl[2] |= RTSTOG_EN; \ | 642 | (ChP)->TxControl[2] |= RTSTOG_EN; \ |
652 | (ChP)->TxControl[3] &= ~SET_RTS; \ | 643 | (ChP)->TxControl[3] &= ~SET_RTS; \ |
653 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 644 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
654 | (ChP)->rtsToggle = 1; \ | 645 | (ChP)->rtsToggle = 1; \ |
655 | } while (0) | 646 | } while (0) |
656 | 647 | ||
@@ -663,7 +654,7 @@ Call: sEnRxFIFO(ChP) | |||
663 | #define sEnRxFIFO(ChP) \ | 654 | #define sEnRxFIFO(ChP) \ |
664 | do { \ | 655 | do { \ |
665 | (ChP)->R[0x32] = 0x08; \ | 656 | (ChP)->R[0x32] = 0x08; \ |
666 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x30]); \ | 657 | out32((ChP)->IndexAddr,&(ChP)->R[0x30]); \ |
667 | } while (0) | 658 | } while (0) |
668 | 659 | ||
669 | /*************************************************************************** | 660 | /*************************************************************************** |
@@ -684,7 +675,7 @@ Warnings: This function must be called after valid microcode has been | |||
684 | #define sEnRxProcessor(ChP) \ | 675 | #define sEnRxProcessor(ChP) \ |
685 | do { \ | 676 | do { \ |
686 | (ChP)->RxControl[2] |= RXPROC_EN; \ | 677 | (ChP)->RxControl[2] |= RXPROC_EN; \ |
687 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \ | 678 | out32((ChP)->IndexAddr,(ChP)->RxControl); \ |
688 | } while (0) | 679 | } while (0) |
689 | 680 | ||
690 | /*************************************************************************** | 681 | /*************************************************************************** |
@@ -708,7 +699,7 @@ Call: sEnTransmit(ChP) | |||
708 | #define sEnTransmit(ChP) \ | 699 | #define sEnTransmit(ChP) \ |
709 | do { \ | 700 | do { \ |
710 | (ChP)->TxControl[3] |= TX_ENABLE; \ | 701 | (ChP)->TxControl[3] |= TX_ENABLE; \ |
711 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 702 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
712 | } while (0) | 703 | } while (0) |
713 | 704 | ||
714 | /*************************************************************************** | 705 | /*************************************************************************** |
@@ -720,7 +711,7 @@ Call: sEnTxSoftFlowCtl(ChP) | |||
720 | #define sEnTxSoftFlowCtl(ChP) \ | 711 | #define sEnTxSoftFlowCtl(ChP) \ |
721 | do { \ | 712 | do { \ |
722 | (ChP)->R[0x06] = 0xc5; \ | 713 | (ChP)->R[0x06] = 0xc5; \ |
723 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \ | 714 | out32((ChP)->IndexAddr,&(ChP)->R[0x04]); \ |
724 | } while (0) | 715 | } while (0) |
725 | 716 | ||
726 | /*************************************************************************** | 717 | /*************************************************************************** |
@@ -927,7 +918,7 @@ Call: sSendBreak(ChP) | |||
927 | #define sSendBreak(ChP) \ | 918 | #define sSendBreak(ChP) \ |
928 | do { \ | 919 | do { \ |
929 | (ChP)->TxControl[3] |= SETBREAK; \ | 920 | (ChP)->TxControl[3] |= SETBREAK; \ |
930 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 921 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
931 | } while (0) | 922 | } while (0) |
932 | 923 | ||
933 | /*************************************************************************** | 924 | /*************************************************************************** |
@@ -941,7 +932,7 @@ Call: sSetBaud(ChP,Divisor) | |||
941 | do { \ | 932 | do { \ |
942 | (ChP)->BaudDiv[2] = (Byte_t)(DIVISOR); \ | 933 | (ChP)->BaudDiv[2] = (Byte_t)(DIVISOR); \ |
943 | (ChP)->BaudDiv[3] = (Byte_t)((DIVISOR) >> 8); \ | 934 | (ChP)->BaudDiv[3] = (Byte_t)((DIVISOR) >> 8); \ |
944 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->BaudDiv[0]); \ | 935 | out32((ChP)->IndexAddr,(ChP)->BaudDiv); \ |
945 | } while (0) | 936 | } while (0) |
946 | 937 | ||
947 | /*************************************************************************** | 938 | /*************************************************************************** |
@@ -953,7 +944,7 @@ Call: sSetData7(ChP) | |||
953 | #define sSetData7(ChP) \ | 944 | #define sSetData7(ChP) \ |
954 | do { \ | 945 | do { \ |
955 | (ChP)->TxControl[2] &= ~DATA8BIT; \ | 946 | (ChP)->TxControl[2] &= ~DATA8BIT; \ |
956 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 947 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
957 | } while (0) | 948 | } while (0) |
958 | 949 | ||
959 | /*************************************************************************** | 950 | /*************************************************************************** |
@@ -965,7 +956,7 @@ Call: sSetData8(ChP) | |||
965 | #define sSetData8(ChP) \ | 956 | #define sSetData8(ChP) \ |
966 | do { \ | 957 | do { \ |
967 | (ChP)->TxControl[2] |= DATA8BIT; \ | 958 | (ChP)->TxControl[2] |= DATA8BIT; \ |
968 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 959 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
969 | } while (0) | 960 | } while (0) |
970 | 961 | ||
971 | /*************************************************************************** | 962 | /*************************************************************************** |
@@ -977,7 +968,7 @@ Call: sSetDTR(ChP) | |||
977 | #define sSetDTR(ChP) \ | 968 | #define sSetDTR(ChP) \ |
978 | do { \ | 969 | do { \ |
979 | (ChP)->TxControl[3] |= SET_DTR; \ | 970 | (ChP)->TxControl[3] |= SET_DTR; \ |
980 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 971 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
981 | } while (0) | 972 | } while (0) |
982 | 973 | ||
983 | /*************************************************************************** | 974 | /*************************************************************************** |
@@ -994,7 +985,7 @@ Warnings: This function has no effect unless parity is enabled with function | |||
994 | #define sSetEvenParity(ChP) \ | 985 | #define sSetEvenParity(ChP) \ |
995 | do { \ | 986 | do { \ |
996 | (ChP)->TxControl[2] |= EVEN_PAR; \ | 987 | (ChP)->TxControl[2] |= EVEN_PAR; \ |
997 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 988 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
998 | } while (0) | 989 | } while (0) |
999 | 990 | ||
1000 | /*************************************************************************** | 991 | /*************************************************************************** |
@@ -1011,7 +1002,7 @@ Warnings: This function has no effect unless parity is enabled with function | |||
1011 | #define sSetOddParity(ChP) \ | 1002 | #define sSetOddParity(ChP) \ |
1012 | do { \ | 1003 | do { \ |
1013 | (ChP)->TxControl[2] &= ~EVEN_PAR; \ | 1004 | (ChP)->TxControl[2] &= ~EVEN_PAR; \ |
1014 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 1005 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
1015 | } while (0) | 1006 | } while (0) |
1016 | 1007 | ||
1017 | /*************************************************************************** | 1008 | /*************************************************************************** |
@@ -1024,7 +1015,7 @@ Call: sSetRTS(ChP) | |||
1024 | do { \ | 1015 | do { \ |
1025 | if ((ChP)->rtsToggle) break; \ | 1016 | if ((ChP)->rtsToggle) break; \ |
1026 | (ChP)->TxControl[3] |= SET_RTS; \ | 1017 | (ChP)->TxControl[3] |= SET_RTS; \ |
1027 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 1018 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
1028 | } while (0) | 1019 | } while (0) |
1029 | 1020 | ||
1030 | /*************************************************************************** | 1021 | /*************************************************************************** |
@@ -1050,7 +1041,7 @@ Comments: An interrupt will be generated when the trigger level is reached | |||
1050 | do { \ | 1041 | do { \ |
1051 | (ChP)->RxControl[2] &= ~TRIG_MASK; \ | 1042 | (ChP)->RxControl[2] &= ~TRIG_MASK; \ |
1052 | (ChP)->RxControl[2] |= LEVEL; \ | 1043 | (ChP)->RxControl[2] |= LEVEL; \ |
1053 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \ | 1044 | out32((ChP)->IndexAddr,(ChP)->RxControl); \ |
1054 | } while (0) | 1045 | } while (0) |
1055 | 1046 | ||
1056 | /*************************************************************************** | 1047 | /*************************************************************************** |
@@ -1062,7 +1053,7 @@ Call: sSetStop1(ChP) | |||
1062 | #define sSetStop1(ChP) \ | 1053 | #define sSetStop1(ChP) \ |
1063 | do { \ | 1054 | do { \ |
1064 | (ChP)->TxControl[2] &= ~STOP2; \ | 1055 | (ChP)->TxControl[2] &= ~STOP2; \ |
1065 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 1056 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
1066 | } while (0) | 1057 | } while (0) |
1067 | 1058 | ||
1068 | /*************************************************************************** | 1059 | /*************************************************************************** |
@@ -1074,7 +1065,7 @@ Call: sSetStop2(ChP) | |||
1074 | #define sSetStop2(ChP) \ | 1065 | #define sSetStop2(ChP) \ |
1075 | do { \ | 1066 | do { \ |
1076 | (ChP)->TxControl[2] |= STOP2; \ | 1067 | (ChP)->TxControl[2] |= STOP2; \ |
1077 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 1068 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
1078 | } while (0) | 1069 | } while (0) |
1079 | 1070 | ||
1080 | /*************************************************************************** | 1071 | /*************************************************************************** |
@@ -1087,7 +1078,7 @@ Call: sSetTxXOFFChar(ChP,Ch) | |||
1087 | #define sSetTxXOFFChar(ChP,CH) \ | 1078 | #define sSetTxXOFFChar(ChP,CH) \ |
1088 | do { \ | 1079 | do { \ |
1089 | (ChP)->R[0x07] = (CH); \ | 1080 | (ChP)->R[0x07] = (CH); \ |
1090 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \ | 1081 | out32((ChP)->IndexAddr,&(ChP)->R[0x04]); \ |
1091 | } while (0) | 1082 | } while (0) |
1092 | 1083 | ||
1093 | /*************************************************************************** | 1084 | /*************************************************************************** |
@@ -1100,7 +1091,7 @@ Call: sSetTxXONChar(ChP,Ch) | |||
1100 | #define sSetTxXONChar(ChP,CH) \ | 1091 | #define sSetTxXONChar(ChP,CH) \ |
1101 | do { \ | 1092 | do { \ |
1102 | (ChP)->R[0x0b] = (CH); \ | 1093 | (ChP)->R[0x0b] = (CH); \ |
1103 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x08]); \ | 1094 | out32((ChP)->IndexAddr,&(ChP)->R[0x08]); \ |
1104 | } while (0) | 1095 | } while (0) |
1105 | 1096 | ||
1106 | /*************************************************************************** | 1097 | /*************************************************************************** |
@@ -1113,7 +1104,7 @@ Comments: This function is used to start a Rx processor after it was | |||
1113 | will restart both the Rx processor and software input flow control. | 1104 | will restart both the Rx processor and software input flow control. |
1114 | 1105 | ||
1115 | */ | 1106 | */ |
1116 | #define sStartRxProcessor(ChP) sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0]) | 1107 | #define sStartRxProcessor(ChP) out32((ChP)->IndexAddr,&(ChP)->R[0]) |
1117 | 1108 | ||
1118 | /*************************************************************************** | 1109 | /*************************************************************************** |
1119 | Function: sWriteTxByte | 1110 | Function: sWriteTxByte |
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c index 5732ca3259f9..b6fe7e7a2c2f 100644 --- a/drivers/connector/cn_queue.c +++ b/drivers/connector/cn_queue.c | |||
@@ -146,7 +146,7 @@ struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *nls) | |||
146 | 146 | ||
147 | dev->nls = nls; | 147 | dev->nls = nls; |
148 | 148 | ||
149 | dev->cn_queue = create_workqueue(dev->name); | 149 | dev->cn_queue = create_singlethread_workqueue(dev->name); |
150 | if (!dev->cn_queue) { | 150 | if (!dev->cn_queue) { |
151 | kfree(dev); | 151 | kfree(dev); |
152 | return NULL; | 152 | return NULL; |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index d73663a52324..fc555a90bb21 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -67,7 +67,7 @@ static void cpuidle_idle_call(void) | |||
67 | /* enter the state and update stats */ | 67 | /* enter the state and update stats */ |
68 | dev->last_residency = target_state->enter(dev, target_state); | 68 | dev->last_residency = target_state->enter(dev, target_state); |
69 | dev->last_state = target_state; | 69 | dev->last_state = target_state; |
70 | target_state->time += dev->last_residency; | 70 | target_state->time += (unsigned long long)dev->last_residency; |
71 | target_state->usage++; | 71 | target_state->usage++; |
72 | 72 | ||
73 | /* give the governor an opportunity to reflect on the outcome */ | 73 | /* give the governor an opportunity to reflect on the outcome */ |
@@ -224,7 +224,7 @@ static void poll_idle_init(struct cpuidle_device *dev) | |||
224 | state->exit_latency = 0; | 224 | state->exit_latency = 0; |
225 | state->target_residency = 0; | 225 | state->target_residency = 0; |
226 | state->power_usage = -1; | 226 | state->power_usage = -1; |
227 | state->flags = CPUIDLE_FLAG_POLL | CPUIDLE_FLAG_TIME_VALID; | 227 | state->flags = CPUIDLE_FLAG_POLL; |
228 | state->enter = poll_idle; | 228 | state->enter = poll_idle; |
229 | } | 229 | } |
230 | #else | 230 | #else |
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c index 69102ca05685..e949618b9be0 100644 --- a/drivers/cpuidle/sysfs.c +++ b/drivers/cpuidle/sysfs.c | |||
@@ -218,6 +218,12 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \ | |||
218 | return sprintf(buf, "%u\n", state->_name);\ | 218 | return sprintf(buf, "%u\n", state->_name);\ |
219 | } | 219 | } |
220 | 220 | ||
221 | #define define_show_state_ull_function(_name) \ | ||
222 | static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \ | ||
223 | { \ | ||
224 | return sprintf(buf, "%llu\n", state->_name);\ | ||
225 | } | ||
226 | |||
221 | #define define_show_state_str_function(_name) \ | 227 | #define define_show_state_str_function(_name) \ |
222 | static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \ | 228 | static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \ |
223 | { \ | 229 | { \ |
@@ -228,8 +234,8 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \ | |||
228 | 234 | ||
229 | define_show_state_function(exit_latency) | 235 | define_show_state_function(exit_latency) |
230 | define_show_state_function(power_usage) | 236 | define_show_state_function(power_usage) |
231 | define_show_state_function(usage) | 237 | define_show_state_ull_function(usage) |
232 | define_show_state_function(time) | 238 | define_show_state_ull_function(time) |
233 | define_show_state_str_function(name) | 239 | define_show_state_str_function(name) |
234 | define_show_state_str_function(desc) | 240 | define_show_state_str_function(desc) |
235 | 241 | ||
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c index 3110bf7014f7..81f3f950cd7d 100644 --- a/drivers/crypto/hifn_795x.c +++ b/drivers/crypto/hifn_795x.c | |||
@@ -392,8 +392,8 @@ static atomic_t hifn_dev_number; | |||
392 | 392 | ||
393 | struct hifn_desc | 393 | struct hifn_desc |
394 | { | 394 | { |
395 | volatile u32 l; | 395 | volatile __le32 l; |
396 | volatile u32 p; | 396 | volatile __le32 p; |
397 | }; | 397 | }; |
398 | 398 | ||
399 | struct hifn_dma { | 399 | struct hifn_dma { |
@@ -481,10 +481,10 @@ struct hifn_device | |||
481 | 481 | ||
482 | struct hifn_base_command | 482 | struct hifn_base_command |
483 | { | 483 | { |
484 | volatile u16 masks; | 484 | volatile __le16 masks; |
485 | volatile u16 session_num; | 485 | volatile __le16 session_num; |
486 | volatile u16 total_source_count; | 486 | volatile __le16 total_source_count; |
487 | volatile u16 total_dest_count; | 487 | volatile __le16 total_dest_count; |
488 | }; | 488 | }; |
489 | 489 | ||
490 | #define HIFN_BASE_CMD_COMP 0x0100 /* enable compression engine */ | 490 | #define HIFN_BASE_CMD_COMP 0x0100 /* enable compression engine */ |
@@ -504,10 +504,10 @@ struct hifn_base_command | |||
504 | */ | 504 | */ |
505 | struct hifn_crypt_command | 505 | struct hifn_crypt_command |
506 | { | 506 | { |
507 | volatile u16 masks; | 507 | volatile __le16 masks; |
508 | volatile u16 header_skip; | 508 | volatile __le16 header_skip; |
509 | volatile u16 source_count; | 509 | volatile __le16 source_count; |
510 | volatile u16 reserved; | 510 | volatile __le16 reserved; |
511 | }; | 511 | }; |
512 | 512 | ||
513 | #define HIFN_CRYPT_CMD_ALG_MASK 0x0003 /* algorithm: */ | 513 | #define HIFN_CRYPT_CMD_ALG_MASK 0x0003 /* algorithm: */ |
@@ -670,7 +670,7 @@ static inline u32 hifn_read_0(struct hifn_device *dev, u32 reg) | |||
670 | { | 670 | { |
671 | u32 ret; | 671 | u32 ret; |
672 | 672 | ||
673 | ret = readl((char *)(dev->bar[0]) + reg); | 673 | ret = readl(dev->bar[0] + reg); |
674 | 674 | ||
675 | return ret; | 675 | return ret; |
676 | } | 676 | } |
@@ -679,19 +679,19 @@ static inline u32 hifn_read_1(struct hifn_device *dev, u32 reg) | |||
679 | { | 679 | { |
680 | u32 ret; | 680 | u32 ret; |
681 | 681 | ||
682 | ret = readl((char *)(dev->bar[1]) + reg); | 682 | ret = readl(dev->bar[1] + reg); |
683 | 683 | ||
684 | return ret; | 684 | return ret; |
685 | } | 685 | } |
686 | 686 | ||
687 | static inline void hifn_write_0(struct hifn_device *dev, u32 reg, u32 val) | 687 | static inline void hifn_write_0(struct hifn_device *dev, u32 reg, u32 val) |
688 | { | 688 | { |
689 | writel(val, (char *)(dev->bar[0]) + reg); | 689 | writel(val, dev->bar[0] + reg); |
690 | } | 690 | } |
691 | 691 | ||
692 | static inline void hifn_write_1(struct hifn_device *dev, u32 reg, u32 val) | 692 | static inline void hifn_write_1(struct hifn_device *dev, u32 reg, u32 val) |
693 | { | 693 | { |
694 | writel(val, (char *)(dev->bar[1]) + reg); | 694 | writel(val, dev->bar[1] + reg); |
695 | } | 695 | } |
696 | 696 | ||
697 | static void hifn_wait_puc(struct hifn_device *dev) | 697 | static void hifn_wait_puc(struct hifn_device *dev) |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 29965231b912..8db0e7f9d3f4 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -357,7 +357,7 @@ int dma_async_device_register(struct dma_device *device) | |||
357 | !device->device_prep_dma_zero_sum); | 357 | !device->device_prep_dma_zero_sum); |
358 | BUG_ON(dma_has_cap(DMA_MEMSET, device->cap_mask) && | 358 | BUG_ON(dma_has_cap(DMA_MEMSET, device->cap_mask) && |
359 | !device->device_prep_dma_memset); | 359 | !device->device_prep_dma_memset); |
360 | BUG_ON(dma_has_cap(DMA_ZERO_SUM, device->cap_mask) && | 360 | BUG_ON(dma_has_cap(DMA_INTERRUPT, device->cap_mask) && |
361 | !device->device_prep_dma_interrupt); | 361 | !device->device_prep_dma_interrupt); |
362 | 362 | ||
363 | BUG_ON(!device->device_alloc_chan_resources); | 363 | BUG_ON(!device->device_alloc_chan_resources); |
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index cc9a68158d99..72692309398a 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c | |||
@@ -57,12 +57,12 @@ static void dma_init(struct fsl_dma_chan *fsl_chan) | |||
57 | 57 | ||
58 | } | 58 | } |
59 | 59 | ||
60 | static void set_sr(struct fsl_dma_chan *fsl_chan, dma_addr_t val) | 60 | static void set_sr(struct fsl_dma_chan *fsl_chan, u32 val) |
61 | { | 61 | { |
62 | DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32); | 62 | DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32); |
63 | } | 63 | } |
64 | 64 | ||
65 | static dma_addr_t get_sr(struct fsl_dma_chan *fsl_chan) | 65 | static u32 get_sr(struct fsl_dma_chan *fsl_chan) |
66 | { | 66 | { |
67 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32); | 67 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32); |
68 | } | 68 | } |
@@ -123,6 +123,11 @@ static dma_addr_t get_ndar(struct fsl_dma_chan *fsl_chan) | |||
123 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->ndar, 64); | 123 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->ndar, 64); |
124 | } | 124 | } |
125 | 125 | ||
126 | static u32 get_bcr(struct fsl_dma_chan *fsl_chan) | ||
127 | { | ||
128 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->bcr, 32); | ||
129 | } | ||
130 | |||
126 | static int dma_is_idle(struct fsl_dma_chan *fsl_chan) | 131 | static int dma_is_idle(struct fsl_dma_chan *fsl_chan) |
127 | { | 132 | { |
128 | u32 sr = get_sr(fsl_chan); | 133 | u32 sr = get_sr(fsl_chan); |
@@ -406,6 +411,35 @@ static void fsl_dma_free_chan_resources(struct dma_chan *chan) | |||
406 | dma_pool_destroy(fsl_chan->desc_pool); | 411 | dma_pool_destroy(fsl_chan->desc_pool); |
407 | } | 412 | } |
408 | 413 | ||
414 | static struct dma_async_tx_descriptor * | ||
415 | fsl_dma_prep_interrupt(struct dma_chan *chan) | ||
416 | { | ||
417 | struct fsl_dma_chan *fsl_chan; | ||
418 | struct fsl_desc_sw *new; | ||
419 | |||
420 | if (!chan) | ||
421 | return NULL; | ||
422 | |||
423 | fsl_chan = to_fsl_chan(chan); | ||
424 | |||
425 | new = fsl_dma_alloc_descriptor(fsl_chan); | ||
426 | if (!new) { | ||
427 | dev_err(fsl_chan->dev, "No free memory for link descriptor\n"); | ||
428 | return NULL; | ||
429 | } | ||
430 | |||
431 | new->async_tx.cookie = -EBUSY; | ||
432 | new->async_tx.ack = 0; | ||
433 | |||
434 | /* Insert the link descriptor to the LD ring */ | ||
435 | list_add_tail(&new->node, &new->async_tx.tx_list); | ||
436 | |||
437 | /* Set End-of-link to the last link descriptor of new list*/ | ||
438 | set_ld_eol(fsl_chan, new); | ||
439 | |||
440 | return &new->async_tx; | ||
441 | } | ||
442 | |||
409 | static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( | 443 | static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( |
410 | struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src, | 444 | struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src, |
411 | size_t len, unsigned long flags) | 445 | size_t len, unsigned long flags) |
@@ -436,7 +470,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( | |||
436 | dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new); | 470 | dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new); |
437 | #endif | 471 | #endif |
438 | 472 | ||
439 | copy = min(len, FSL_DMA_BCR_MAX_CNT); | 473 | copy = min(len, (size_t)FSL_DMA_BCR_MAX_CNT); |
440 | 474 | ||
441 | set_desc_cnt(fsl_chan, &new->hw, copy); | 475 | set_desc_cnt(fsl_chan, &new->hw, copy); |
442 | set_desc_src(fsl_chan, &new->hw, dma_src); | 476 | set_desc_src(fsl_chan, &new->hw, dma_src); |
@@ -513,7 +547,6 @@ static void fsl_chan_ld_cleanup(struct fsl_dma_chan *fsl_chan) | |||
513 | 547 | ||
514 | spin_lock_irqsave(&fsl_chan->desc_lock, flags); | 548 | spin_lock_irqsave(&fsl_chan->desc_lock, flags); |
515 | 549 | ||
516 | fsl_dma_update_completed_cookie(fsl_chan); | ||
517 | dev_dbg(fsl_chan->dev, "chan completed_cookie = %d\n", | 550 | dev_dbg(fsl_chan->dev, "chan completed_cookie = %d\n", |
518 | fsl_chan->completed_cookie); | 551 | fsl_chan->completed_cookie); |
519 | list_for_each_entry_safe(desc, _desc, &fsl_chan->ld_queue, node) { | 552 | list_for_each_entry_safe(desc, _desc, &fsl_chan->ld_queue, node) { |
@@ -581,8 +614,8 @@ static void fsl_chan_xfer_ld_queue(struct fsl_dma_chan *fsl_chan) | |||
581 | if (ld_node != &fsl_chan->ld_queue) { | 614 | if (ld_node != &fsl_chan->ld_queue) { |
582 | /* Get the ld start address from ld_queue */ | 615 | /* Get the ld start address from ld_queue */ |
583 | next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys; | 616 | next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys; |
584 | dev_dbg(fsl_chan->dev, "xfer LDs staring from 0x%016llx\n", | 617 | dev_dbg(fsl_chan->dev, "xfer LDs staring from %p\n", |
585 | (u64)next_dest_addr); | 618 | (void *)next_dest_addr); |
586 | set_cdar(fsl_chan, next_dest_addr); | 619 | set_cdar(fsl_chan, next_dest_addr); |
587 | dma_start(fsl_chan); | 620 | dma_start(fsl_chan); |
588 | } else { | 621 | } else { |
@@ -662,7 +695,7 @@ static enum dma_status fsl_dma_is_complete(struct dma_chan *chan, | |||
662 | static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) | 695 | static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) |
663 | { | 696 | { |
664 | struct fsl_dma_chan *fsl_chan = (struct fsl_dma_chan *)data; | 697 | struct fsl_dma_chan *fsl_chan = (struct fsl_dma_chan *)data; |
665 | dma_addr_t stat; | 698 | u32 stat; |
666 | 699 | ||
667 | stat = get_sr(fsl_chan); | 700 | stat = get_sr(fsl_chan); |
668 | dev_dbg(fsl_chan->dev, "event: channel %d, stat = 0x%x\n", | 701 | dev_dbg(fsl_chan->dev, "event: channel %d, stat = 0x%x\n", |
@@ -676,15 +709,32 @@ static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) | |||
676 | if (stat & FSL_DMA_SR_TE) | 709 | if (stat & FSL_DMA_SR_TE) |
677 | dev_err(fsl_chan->dev, "Transfer Error!\n"); | 710 | dev_err(fsl_chan->dev, "Transfer Error!\n"); |
678 | 711 | ||
712 | /* Programming Error | ||
713 | * The DMA_INTERRUPT async_tx is a NULL transfer, which will | ||
714 | * triger a PE interrupt. | ||
715 | */ | ||
716 | if (stat & FSL_DMA_SR_PE) { | ||
717 | dev_dbg(fsl_chan->dev, "event: Programming Error INT\n"); | ||
718 | if (get_bcr(fsl_chan) == 0) { | ||
719 | /* BCR register is 0, this is a DMA_INTERRUPT async_tx. | ||
720 | * Now, update the completed cookie, and continue the | ||
721 | * next uncompleted transfer. | ||
722 | */ | ||
723 | fsl_dma_update_completed_cookie(fsl_chan); | ||
724 | fsl_chan_xfer_ld_queue(fsl_chan); | ||
725 | } | ||
726 | stat &= ~FSL_DMA_SR_PE; | ||
727 | } | ||
728 | |||
679 | /* If the link descriptor segment transfer finishes, | 729 | /* If the link descriptor segment transfer finishes, |
680 | * we will recycle the used descriptor. | 730 | * we will recycle the used descriptor. |
681 | */ | 731 | */ |
682 | if (stat & FSL_DMA_SR_EOSI) { | 732 | if (stat & FSL_DMA_SR_EOSI) { |
683 | dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n"); | 733 | dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n"); |
684 | dev_dbg(fsl_chan->dev, "event: clndar 0x%016llx, " | 734 | dev_dbg(fsl_chan->dev, "event: clndar %p, nlndar %p\n", |
685 | "nlndar 0x%016llx\n", (u64)get_cdar(fsl_chan), | 735 | (void *)get_cdar(fsl_chan), (void *)get_ndar(fsl_chan)); |
686 | (u64)get_ndar(fsl_chan)); | ||
687 | stat &= ~FSL_DMA_SR_EOSI; | 736 | stat &= ~FSL_DMA_SR_EOSI; |
737 | fsl_dma_update_completed_cookie(fsl_chan); | ||
688 | } | 738 | } |
689 | 739 | ||
690 | /* If it current transfer is the end-of-transfer, | 740 | /* If it current transfer is the end-of-transfer, |
@@ -726,12 +776,15 @@ static void dma_do_tasklet(unsigned long data) | |||
726 | fsl_chan_ld_cleanup(fsl_chan); | 776 | fsl_chan_ld_cleanup(fsl_chan); |
727 | } | 777 | } |
728 | 778 | ||
779 | #ifdef FSL_DMA_CALLBACKTEST | ||
729 | static void fsl_dma_callback_test(struct fsl_dma_chan *fsl_chan) | 780 | static void fsl_dma_callback_test(struct fsl_dma_chan *fsl_chan) |
730 | { | 781 | { |
731 | if (fsl_chan) | 782 | if (fsl_chan) |
732 | dev_info(fsl_chan->dev, "selftest: callback is ok!\n"); | 783 | dev_info(fsl_chan->dev, "selftest: callback is ok!\n"); |
733 | } | 784 | } |
785 | #endif | ||
734 | 786 | ||
787 | #ifdef CONFIG_FSL_DMA_SELFTEST | ||
735 | static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) | 788 | static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) |
736 | { | 789 | { |
737 | struct dma_chan *chan; | 790 | struct dma_chan *chan; |
@@ -813,6 +866,11 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) | |||
813 | tx3 = fsl_dma_prep_memcpy(chan, dma_dest, dma_src, test_size / 4, 0); | 866 | tx3 = fsl_dma_prep_memcpy(chan, dma_dest, dma_src, test_size / 4, 0); |
814 | async_tx_ack(tx3); | 867 | async_tx_ack(tx3); |
815 | 868 | ||
869 | /* Interrupt tx test */ | ||
870 | tx1 = fsl_dma_prep_interrupt(chan); | ||
871 | async_tx_ack(tx1); | ||
872 | cookie = fsl_dma_tx_submit(tx1); | ||
873 | |||
816 | /* Test exchanging the prepared tx sort */ | 874 | /* Test exchanging the prepared tx sort */ |
817 | cookie = fsl_dma_tx_submit(tx3); | 875 | cookie = fsl_dma_tx_submit(tx3); |
818 | cookie = fsl_dma_tx_submit(tx2); | 876 | cookie = fsl_dma_tx_submit(tx2); |
@@ -837,9 +895,9 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) | |||
837 | if (err) { | 895 | if (err) { |
838 | for (i = 0; (*(src + i) == *(dest + i)) && (i < test_size); | 896 | for (i = 0; (*(src + i) == *(dest + i)) && (i < test_size); |
839 | i++); | 897 | i++); |
840 | dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%d is " | 898 | dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%ld is " |
841 | "error! src 0x%x, dest 0x%x\n", | 899 | "error! src 0x%x, dest 0x%x\n", |
842 | i, test_size, *(src + i), *(dest + i)); | 900 | i, (long)test_size, *(src + i), *(dest + i)); |
843 | } | 901 | } |
844 | 902 | ||
845 | free_resources: | 903 | free_resources: |
@@ -848,6 +906,7 @@ out: | |||
848 | kfree(src); | 906 | kfree(src); |
849 | return err; | 907 | return err; |
850 | } | 908 | } |
909 | #endif | ||
851 | 910 | ||
852 | static int __devinit of_fsl_dma_chan_probe(struct of_device *dev, | 911 | static int __devinit of_fsl_dma_chan_probe(struct of_device *dev, |
853 | const struct of_device_id *match) | 912 | const struct of_device_id *match) |
@@ -1008,8 +1067,8 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev, | |||
1008 | } | 1067 | } |
1009 | 1068 | ||
1010 | dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " | 1069 | dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " |
1011 | "controller at 0x%08x...\n", | 1070 | "controller at %p...\n", |
1012 | match->compatible, fdev->reg.start); | 1071 | match->compatible, (void *)fdev->reg.start); |
1013 | fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end | 1072 | fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end |
1014 | - fdev->reg.start + 1); | 1073 | - fdev->reg.start + 1); |
1015 | 1074 | ||
@@ -1017,6 +1076,7 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev, | |||
1017 | dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask); | 1076 | dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask); |
1018 | fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources; | 1077 | fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources; |
1019 | fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources; | 1078 | fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources; |
1079 | fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt; | ||
1020 | fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy; | 1080 | fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy; |
1021 | fdev->common.device_is_tx_complete = fsl_dma_is_complete; | 1081 | fdev->common.device_is_tx_complete = fsl_dma_is_complete; |
1022 | fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending; | 1082 | fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending; |
diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index ba78c42121ba..6faf07ba0d0e 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #define FSL_DMA_MR_EOTIE 0x00000080 | 40 | #define FSL_DMA_MR_EOTIE 0x00000080 |
41 | 41 | ||
42 | #define FSL_DMA_SR_CH 0x00000020 | 42 | #define FSL_DMA_SR_CH 0x00000020 |
43 | #define FSL_DMA_SR_PE 0x00000010 | ||
43 | #define FSL_DMA_SR_CB 0x00000004 | 44 | #define FSL_DMA_SR_CB 0x00000004 |
44 | #define FSL_DMA_SR_TE 0x00000080 | 45 | #define FSL_DMA_SR_TE 0x00000080 |
45 | #define FSL_DMA_SR_EOSI 0x00000002 | 46 | #define FSL_DMA_SR_EOSI 0x00000002 |
@@ -74,12 +75,15 @@ | |||
74 | #define FSL_DMA_DGSR_EOSI 0x02 | 75 | #define FSL_DMA_DGSR_EOSI 0x02 |
75 | #define FSL_DMA_DGSR_EOLSI 0x01 | 76 | #define FSL_DMA_DGSR_EOLSI 0x01 |
76 | 77 | ||
78 | typedef u64 __bitwise v64; | ||
79 | typedef u32 __bitwise v32; | ||
80 | |||
77 | struct fsl_dma_ld_hw { | 81 | struct fsl_dma_ld_hw { |
78 | u64 __bitwise src_addr; | 82 | v64 src_addr; |
79 | u64 __bitwise dst_addr; | 83 | v64 dst_addr; |
80 | u64 __bitwise next_ln_addr; | 84 | v64 next_ln_addr; |
81 | u32 __bitwise count; | 85 | v32 count; |
82 | u32 __bitwise reserve; | 86 | v32 reserve; |
83 | } __attribute__((aligned(32))); | 87 | } __attribute__((aligned(32))); |
84 | 88 | ||
85 | struct fsl_desc_sw { | 89 | struct fsl_desc_sw { |
@@ -91,13 +95,13 @@ struct fsl_desc_sw { | |||
91 | } __attribute__((aligned(32))); | 95 | } __attribute__((aligned(32))); |
92 | 96 | ||
93 | struct fsl_dma_chan_regs { | 97 | struct fsl_dma_chan_regs { |
94 | u32 __bitwise mr; /* 0x00 - Mode Register */ | 98 | u32 mr; /* 0x00 - Mode Register */ |
95 | u32 __bitwise sr; /* 0x04 - Status Register */ | 99 | u32 sr; /* 0x04 - Status Register */ |
96 | u64 __bitwise cdar; /* 0x08 - Current descriptor address register */ | 100 | u64 cdar; /* 0x08 - Current descriptor address register */ |
97 | u64 __bitwise sar; /* 0x10 - Source Address Register */ | 101 | u64 sar; /* 0x10 - Source Address Register */ |
98 | u64 __bitwise dar; /* 0x18 - Destination Address Register */ | 102 | u64 dar; /* 0x18 - Destination Address Register */ |
99 | u32 __bitwise bcr; /* 0x20 - Byte Count Register */ | 103 | u32 bcr; /* 0x20 - Byte Count Register */ |
100 | u64 __bitwise ndar; /* 0x24 - Next Descriptor Address Register */ | 104 | u64 ndar; /* 0x24 - Next Descriptor Address Register */ |
101 | }; | 105 | }; |
102 | 106 | ||
103 | struct fsl_dma_chan; | 107 | struct fsl_dma_chan; |
@@ -150,25 +154,27 @@ struct fsl_dma_chan { | |||
150 | #ifndef __powerpc64__ | 154 | #ifndef __powerpc64__ |
151 | static u64 in_be64(const u64 __iomem *addr) | 155 | static u64 in_be64(const u64 __iomem *addr) |
152 | { | 156 | { |
153 | return ((u64)in_be32((u32 *)addr) << 32) | (in_be32((u32 *)addr + 1)); | 157 | return ((u64)in_be32((u32 __iomem *)addr) << 32) | |
158 | (in_be32((u32 __iomem *)addr + 1)); | ||
154 | } | 159 | } |
155 | 160 | ||
156 | static void out_be64(u64 __iomem *addr, u64 val) | 161 | static void out_be64(u64 __iomem *addr, u64 val) |
157 | { | 162 | { |
158 | out_be32((u32 *)addr, val >> 32); | 163 | out_be32((u32 __iomem *)addr, val >> 32); |
159 | out_be32((u32 *)addr + 1, (u32)val); | 164 | out_be32((u32 __iomem *)addr + 1, (u32)val); |
160 | } | 165 | } |
161 | 166 | ||
162 | /* There is no asm instructions for 64 bits reverse loads and stores */ | 167 | /* There is no asm instructions for 64 bits reverse loads and stores */ |
163 | static u64 in_le64(const u64 __iomem *addr) | 168 | static u64 in_le64(const u64 __iomem *addr) |
164 | { | 169 | { |
165 | return ((u64)in_le32((u32 *)addr + 1) << 32) | (in_le32((u32 *)addr)); | 170 | return ((u64)in_le32((u32 __iomem *)addr + 1) << 32) | |
171 | (in_le32((u32 __iomem *)addr)); | ||
166 | } | 172 | } |
167 | 173 | ||
168 | static void out_le64(u64 __iomem *addr, u64 val) | 174 | static void out_le64(u64 __iomem *addr, u64 val) |
169 | { | 175 | { |
170 | out_le32((u32 *)addr + 1, val >> 32); | 176 | out_le32((u32 __iomem *)addr + 1, val >> 32); |
171 | out_le32((u32 *)addr, (u32)val); | 177 | out_le32((u32 __iomem *)addr, (u32)val); |
172 | } | 178 | } |
173 | #endif | 179 | #endif |
174 | 180 | ||
@@ -181,9 +187,11 @@ static void out_le64(u64 __iomem *addr, u64 val) | |||
181 | 187 | ||
182 | #define DMA_TO_CPU(fsl_chan, d, width) \ | 188 | #define DMA_TO_CPU(fsl_chan, d, width) \ |
183 | (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ | 189 | (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ |
184 | be##width##_to_cpu(d) : le##width##_to_cpu(d)) | 190 | be##width##_to_cpu((__force __be##width)(v##width)d) : \ |
191 | le##width##_to_cpu((__force __le##width)(v##width)d)) | ||
185 | #define CPU_TO_DMA(fsl_chan, c, width) \ | 192 | #define CPU_TO_DMA(fsl_chan, c, width) \ |
186 | (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ | 193 | (((fsl_chan)->feature & FSL_DMA_BIG_ENDIAN) ? \ |
187 | cpu_to_be##width(c) : cpu_to_le##width(c)) | 194 | (__force v##width)cpu_to_be##width(c) : \ |
195 | (__force v##width)cpu_to_le##width(c)) | ||
188 | 196 | ||
189 | #endif /* __DMA_FSLDMA_H */ | 197 | #endif /* __DMA_FSLDMA_H */ |
diff --git a/drivers/dma/ioat_dca.c b/drivers/dma/ioat_dca.c index 0fa8a98051a8..9e922760b7ff 100644 --- a/drivers/dma/ioat_dca.c +++ b/drivers/dma/ioat_dca.c | |||
@@ -98,7 +98,7 @@ struct ioat_dca_slot { | |||
98 | 98 | ||
99 | struct ioat_dca_priv { | 99 | struct ioat_dca_priv { |
100 | void __iomem *iobase; | 100 | void __iomem *iobase; |
101 | void *dca_base; | 101 | void __iomem *dca_base; |
102 | int max_requesters; | 102 | int max_requesters; |
103 | int requester_count; | 103 | int requester_count; |
104 | u8 tag_map[IOAT_TAG_MAP_LEN]; | 104 | u8 tag_map[IOAT_TAG_MAP_LEN]; |
@@ -338,7 +338,7 @@ static struct dca_ops ioat2_dca_ops = { | |||
338 | .get_tag = ioat2_dca_get_tag, | 338 | .get_tag = ioat2_dca_get_tag, |
339 | }; | 339 | }; |
340 | 340 | ||
341 | static int ioat2_dca_count_dca_slots(void *iobase, u16 dca_offset) | 341 | static int ioat2_dca_count_dca_slots(void __iomem *iobase, u16 dca_offset) |
342 | { | 342 | { |
343 | int slots = 0; | 343 | int slots = 0; |
344 | u32 req; | 344 | u32 req; |
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index 3986d54492bd..f82b0906d466 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -140,7 +140,7 @@ static void __iop_adma_slot_cleanup(struct iop_adma_chan *iop_chan) | |||
140 | int busy = iop_chan_is_busy(iop_chan); | 140 | int busy = iop_chan_is_busy(iop_chan); |
141 | int seen_current = 0, slot_cnt = 0, slots_per_op = 0; | 141 | int seen_current = 0, slot_cnt = 0, slots_per_op = 0; |
142 | 142 | ||
143 | dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); | 143 | dev_dbg(iop_chan->device->common.dev, "%s\n", __func__); |
144 | /* free completed slots from the chain starting with | 144 | /* free completed slots from the chain starting with |
145 | * the oldest descriptor | 145 | * the oldest descriptor |
146 | */ | 146 | */ |
@@ -438,7 +438,7 @@ iop_adma_tx_submit(struct dma_async_tx_descriptor *tx) | |||
438 | spin_unlock_bh(&iop_chan->lock); | 438 | spin_unlock_bh(&iop_chan->lock); |
439 | 439 | ||
440 | dev_dbg(iop_chan->device->common.dev, "%s cookie: %d slot: %d\n", | 440 | dev_dbg(iop_chan->device->common.dev, "%s cookie: %d slot: %d\n", |
441 | __FUNCTION__, sw_desc->async_tx.cookie, sw_desc->idx); | 441 | __func__, sw_desc->async_tx.cookie, sw_desc->idx); |
442 | 442 | ||
443 | return cookie; | 443 | return cookie; |
444 | } | 444 | } |
@@ -520,7 +520,7 @@ iop_adma_prep_dma_interrupt(struct dma_chan *chan) | |||
520 | struct iop_adma_desc_slot *sw_desc, *grp_start; | 520 | struct iop_adma_desc_slot *sw_desc, *grp_start; |
521 | int slot_cnt, slots_per_op; | 521 | int slot_cnt, slots_per_op; |
522 | 522 | ||
523 | dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); | 523 | dev_dbg(iop_chan->device->common.dev, "%s\n", __func__); |
524 | 524 | ||
525 | spin_lock_bh(&iop_chan->lock); | 525 | spin_lock_bh(&iop_chan->lock); |
526 | slot_cnt = iop_chan_interrupt_slot_count(&slots_per_op, iop_chan); | 526 | slot_cnt = iop_chan_interrupt_slot_count(&slots_per_op, iop_chan); |
@@ -548,7 +548,7 @@ iop_adma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dma_dest, | |||
548 | BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); | 548 | BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); |
549 | 549 | ||
550 | dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", | 550 | dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", |
551 | __FUNCTION__, len); | 551 | __func__, len); |
552 | 552 | ||
553 | spin_lock_bh(&iop_chan->lock); | 553 | spin_lock_bh(&iop_chan->lock); |
554 | slot_cnt = iop_chan_memcpy_slot_count(len, &slots_per_op); | 554 | slot_cnt = iop_chan_memcpy_slot_count(len, &slots_per_op); |
@@ -580,7 +580,7 @@ iop_adma_prep_dma_memset(struct dma_chan *chan, dma_addr_t dma_dest, | |||
580 | BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); | 580 | BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); |
581 | 581 | ||
582 | dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", | 582 | dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", |
583 | __FUNCTION__, len); | 583 | __func__, len); |
584 | 584 | ||
585 | spin_lock_bh(&iop_chan->lock); | 585 | spin_lock_bh(&iop_chan->lock); |
586 | slot_cnt = iop_chan_memset_slot_count(len, &slots_per_op); | 586 | slot_cnt = iop_chan_memset_slot_count(len, &slots_per_op); |
@@ -614,7 +614,7 @@ iop_adma_prep_dma_xor(struct dma_chan *chan, dma_addr_t dma_dest, | |||
614 | 614 | ||
615 | dev_dbg(iop_chan->device->common.dev, | 615 | dev_dbg(iop_chan->device->common.dev, |
616 | "%s src_cnt: %d len: %u flags: %lx\n", | 616 | "%s src_cnt: %d len: %u flags: %lx\n", |
617 | __FUNCTION__, src_cnt, len, flags); | 617 | __func__, src_cnt, len, flags); |
618 | 618 | ||
619 | spin_lock_bh(&iop_chan->lock); | 619 | spin_lock_bh(&iop_chan->lock); |
620 | slot_cnt = iop_chan_xor_slot_count(len, src_cnt, &slots_per_op); | 620 | slot_cnt = iop_chan_xor_slot_count(len, src_cnt, &slots_per_op); |
@@ -648,7 +648,7 @@ iop_adma_prep_dma_zero_sum(struct dma_chan *chan, dma_addr_t *dma_src, | |||
648 | return NULL; | 648 | return NULL; |
649 | 649 | ||
650 | dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n", | 650 | dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n", |
651 | __FUNCTION__, src_cnt, len); | 651 | __func__, src_cnt, len); |
652 | 652 | ||
653 | spin_lock_bh(&iop_chan->lock); | 653 | spin_lock_bh(&iop_chan->lock); |
654 | slot_cnt = iop_chan_zero_sum_slot_count(len, src_cnt, &slots_per_op); | 654 | slot_cnt = iop_chan_zero_sum_slot_count(len, src_cnt, &slots_per_op); |
@@ -659,7 +659,7 @@ iop_adma_prep_dma_zero_sum(struct dma_chan *chan, dma_addr_t *dma_src, | |||
659 | iop_desc_set_zero_sum_byte_count(grp_start, len); | 659 | iop_desc_set_zero_sum_byte_count(grp_start, len); |
660 | grp_start->xor_check_result = result; | 660 | grp_start->xor_check_result = result; |
661 | pr_debug("\t%s: grp_start->xor_check_result: %p\n", | 661 | pr_debug("\t%s: grp_start->xor_check_result: %p\n", |
662 | __FUNCTION__, grp_start->xor_check_result); | 662 | __func__, grp_start->xor_check_result); |
663 | sw_desc->unmap_src_cnt = src_cnt; | 663 | sw_desc->unmap_src_cnt = src_cnt; |
664 | sw_desc->unmap_len = len; | 664 | sw_desc->unmap_len = len; |
665 | while (src_cnt--) | 665 | while (src_cnt--) |
@@ -700,7 +700,7 @@ static void iop_adma_free_chan_resources(struct dma_chan *chan) | |||
700 | iop_chan->last_used = NULL; | 700 | iop_chan->last_used = NULL; |
701 | 701 | ||
702 | dev_dbg(iop_chan->device->common.dev, "%s slots_allocated %d\n", | 702 | dev_dbg(iop_chan->device->common.dev, "%s slots_allocated %d\n", |
703 | __FUNCTION__, iop_chan->slots_allocated); | 703 | __func__, iop_chan->slots_allocated); |
704 | spin_unlock_bh(&iop_chan->lock); | 704 | spin_unlock_bh(&iop_chan->lock); |
705 | 705 | ||
706 | /* one is ok since we left it on there on purpose */ | 706 | /* one is ok since we left it on there on purpose */ |
@@ -753,7 +753,7 @@ static irqreturn_t iop_adma_eot_handler(int irq, void *data) | |||
753 | { | 753 | { |
754 | struct iop_adma_chan *chan = data; | 754 | struct iop_adma_chan *chan = data; |
755 | 755 | ||
756 | dev_dbg(chan->device->common.dev, "%s\n", __FUNCTION__); | 756 | dev_dbg(chan->device->common.dev, "%s\n", __func__); |
757 | 757 | ||
758 | tasklet_schedule(&chan->irq_tasklet); | 758 | tasklet_schedule(&chan->irq_tasklet); |
759 | 759 | ||
@@ -766,7 +766,7 @@ static irqreturn_t iop_adma_eoc_handler(int irq, void *data) | |||
766 | { | 766 | { |
767 | struct iop_adma_chan *chan = data; | 767 | struct iop_adma_chan *chan = data; |
768 | 768 | ||
769 | dev_dbg(chan->device->common.dev, "%s\n", __FUNCTION__); | 769 | dev_dbg(chan->device->common.dev, "%s\n", __func__); |
770 | 770 | ||
771 | tasklet_schedule(&chan->irq_tasklet); | 771 | tasklet_schedule(&chan->irq_tasklet); |
772 | 772 | ||
@@ -823,7 +823,7 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
823 | int err = 0; | 823 | int err = 0; |
824 | struct iop_adma_chan *iop_chan; | 824 | struct iop_adma_chan *iop_chan; |
825 | 825 | ||
826 | dev_dbg(device->common.dev, "%s\n", __FUNCTION__); | 826 | dev_dbg(device->common.dev, "%s\n", __func__); |
827 | 827 | ||
828 | src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 828 | src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
829 | if (!src) | 829 | if (!src) |
@@ -906,7 +906,7 @@ iop_adma_xor_zero_sum_self_test(struct iop_adma_device *device) | |||
906 | int err = 0; | 906 | int err = 0; |
907 | struct iop_adma_chan *iop_chan; | 907 | struct iop_adma_chan *iop_chan; |
908 | 908 | ||
909 | dev_dbg(device->common.dev, "%s\n", __FUNCTION__); | 909 | dev_dbg(device->common.dev, "%s\n", __func__); |
910 | 910 | ||
911 | for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) { | 911 | for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) { |
912 | xor_srcs[src_idx] = alloc_page(GFP_KERNEL); | 912 | xor_srcs[src_idx] = alloc_page(GFP_KERNEL); |
@@ -1159,7 +1159,7 @@ static int __devinit iop_adma_probe(struct platform_device *pdev) | |||
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | dev_dbg(&pdev->dev, "%s: allocted descriptor pool virt %p phys %p\n", | 1161 | dev_dbg(&pdev->dev, "%s: allocted descriptor pool virt %p phys %p\n", |
1162 | __FUNCTION__, adev->dma_desc_pool_virt, | 1162 | __func__, adev->dma_desc_pool_virt, |
1163 | (void *) adev->dma_desc_pool); | 1163 | (void *) adev->dma_desc_pool); |
1164 | 1164 | ||
1165 | adev->id = plat_data->hw_id; | 1165 | adev->id = plat_data->hw_id; |
@@ -1289,7 +1289,7 @@ static void iop_chan_start_null_memcpy(struct iop_adma_chan *iop_chan) | |||
1289 | dma_cookie_t cookie; | 1289 | dma_cookie_t cookie; |
1290 | int slot_cnt, slots_per_op; | 1290 | int slot_cnt, slots_per_op; |
1291 | 1291 | ||
1292 | dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); | 1292 | dev_dbg(iop_chan->device->common.dev, "%s\n", __func__); |
1293 | 1293 | ||
1294 | spin_lock_bh(&iop_chan->lock); | 1294 | spin_lock_bh(&iop_chan->lock); |
1295 | slot_cnt = iop_chan_memcpy_slot_count(0, &slots_per_op); | 1295 | slot_cnt = iop_chan_memcpy_slot_count(0, &slots_per_op); |
@@ -1346,7 +1346,7 @@ static void iop_chan_start_null_xor(struct iop_adma_chan *iop_chan) | |||
1346 | dma_cookie_t cookie; | 1346 | dma_cookie_t cookie; |
1347 | int slot_cnt, slots_per_op; | 1347 | int slot_cnt, slots_per_op; |
1348 | 1348 | ||
1349 | dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); | 1349 | dev_dbg(iop_chan->device->common.dev, "%s\n", __func__); |
1350 | 1350 | ||
1351 | spin_lock_bh(&iop_chan->lock); | 1351 | spin_lock_bh(&iop_chan->lock); |
1352 | slot_cnt = iop_chan_xor_slot_count(0, 2, &slots_per_op); | 1352 | slot_cnt = iop_chan_xor_slot_count(0, 2, &slots_per_op); |
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig index fe9e768cfbc4..25bdc2dd9ce1 100644 --- a/drivers/firewire/Kconfig +++ b/drivers/firewire/Kconfig | |||
@@ -1,5 +1,3 @@ | |||
1 | # -*- shell-script -*- | ||
2 | |||
3 | comment "An alternative FireWire stack is available with EXPERIMENTAL=y" | 1 | comment "An alternative FireWire stack is available with EXPERIMENTAL=y" |
4 | depends on EXPERIMENTAL=n | 2 | depends on EXPERIMENTAL=n |
5 | 3 | ||
@@ -21,27 +19,7 @@ config FIREWIRE | |||
21 | NOTE: | 19 | NOTE: |
22 | 20 | ||
23 | You should only build ONE of the stacks, unless you REALLY know what | 21 | You should only build ONE of the stacks, unless you REALLY know what |
24 | you are doing. If you install both, you should configure them only as | 22 | you are doing. |
25 | modules rather than link them statically, and you should blacklist one | ||
26 | of the concurrent low-level drivers in /etc/modprobe.conf. Add either | ||
27 | |||
28 | blacklist firewire-ohci | ||
29 | or | ||
30 | blacklist ohci1394 | ||
31 | |||
32 | there depending on which driver you DON'T want to have auto-loaded. | ||
33 | You can optionally do the same with the other IEEE 1394/ FireWire | ||
34 | drivers. | ||
35 | |||
36 | If you have an old modprobe which doesn't implement the blacklist | ||
37 | directive, use either | ||
38 | |||
39 | install firewire-ohci /bin/true | ||
40 | or | ||
41 | install ohci1394 /bin/true | ||
42 | |||
43 | and so on, depending on which modules you DON't want to have | ||
44 | auto-loaded. | ||
45 | 23 | ||
46 | config FIREWIRE_OHCI | 24 | config FIREWIRE_OHCI |
47 | tristate "Support for OHCI FireWire host controllers" | 25 | tristate "Support for OHCI FireWire host controllers" |
@@ -57,8 +35,24 @@ config FIREWIRE_OHCI | |||
57 | 35 | ||
58 | NOTE: | 36 | NOTE: |
59 | 37 | ||
60 | If you also build ohci1394 of the classic stack, blacklist either | 38 | You should only build ohci1394 or firewire-ohci, but not both. |
61 | ohci1394 or firewire-ohci to let hotplug load only the desired driver. | 39 | If you nevertheless want to install both, you should configure them |
40 | only as modules and blacklist the driver(s) which you don't want to | ||
41 | have auto-loaded. Add either | ||
42 | |||
43 | blacklist firewire-ohci | ||
44 | or | ||
45 | blacklist ohci1394 | ||
46 | blacklist video1394 | ||
47 | blacklist dv1394 | ||
48 | |||
49 | to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf | ||
50 | depending on your distribution. The latter two modules should be | ||
51 | blacklisted together with ohci1394 because they depend on ohci1394. | ||
52 | |||
53 | If you have an old modprobe which doesn't implement the blacklist | ||
54 | directive, use "install modulename /bin/true" for the modules to be | ||
55 | blacklisted. | ||
62 | 56 | ||
63 | config FIREWIRE_SBP2 | 57 | config FIREWIRE_SBP2 |
64 | tristate "Support for storage devices (SBP-2 protocol driver)" | 58 | tristate "Support for storage devices (SBP-2 protocol driver)" |
@@ -75,9 +69,3 @@ config FIREWIRE_SBP2 | |||
75 | 69 | ||
76 | You should also enable support for disks, CD-ROMs, etc. in the SCSI | 70 | You should also enable support for disks, CD-ROMs, etc. in the SCSI |
77 | configuration section. | 71 | configuration section. |
78 | |||
79 | NOTE: | ||
80 | |||
81 | If you also build sbp2 of the classic stack, blacklist either sbp2 | ||
82 | or firewire-sbp2 to let hotplug load only the desired driver. | ||
83 | |||
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index 7ebad3c14cb8..996d61f0d460 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -33,6 +33,10 @@ | |||
33 | #include <asm/page.h> | 33 | #include <asm/page.h> |
34 | #include <asm/system.h> | 34 | #include <asm/system.h> |
35 | 35 | ||
36 | #ifdef CONFIG_PPC_PMAC | ||
37 | #include <asm/pmac_feature.h> | ||
38 | #endif | ||
39 | |||
36 | #include "fw-ohci.h" | 40 | #include "fw-ohci.h" |
37 | #include "fw-transaction.h" | 41 | #include "fw-transaction.h" |
38 | 42 | ||
@@ -175,6 +179,7 @@ struct fw_ohci { | |||
175 | int generation; | 179 | int generation; |
176 | int request_generation; | 180 | int request_generation; |
177 | u32 bus_seconds; | 181 | u32 bus_seconds; |
182 | bool old_uninorth; | ||
178 | 183 | ||
179 | /* | 184 | /* |
180 | * Spinlock for accessing fw_ohci data. Never call out of | 185 | * Spinlock for accessing fw_ohci data. Never call out of |
@@ -276,19 +281,13 @@ static int ar_context_add_page(struct ar_context *ctx) | |||
276 | { | 281 | { |
277 | struct device *dev = ctx->ohci->card.device; | 282 | struct device *dev = ctx->ohci->card.device; |
278 | struct ar_buffer *ab; | 283 | struct ar_buffer *ab; |
279 | dma_addr_t ab_bus; | 284 | dma_addr_t uninitialized_var(ab_bus); |
280 | size_t offset; | 285 | size_t offset; |
281 | 286 | ||
282 | ab = (struct ar_buffer *) __get_free_page(GFP_ATOMIC); | 287 | ab = dma_alloc_coherent(dev, PAGE_SIZE, &ab_bus, GFP_ATOMIC); |
283 | if (ab == NULL) | 288 | if (ab == NULL) |
284 | return -ENOMEM; | 289 | return -ENOMEM; |
285 | 290 | ||
286 | ab_bus = dma_map_single(dev, ab, PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
287 | if (dma_mapping_error(ab_bus)) { | ||
288 | free_page((unsigned long) ab); | ||
289 | return -ENOMEM; | ||
290 | } | ||
291 | |||
292 | memset(&ab->descriptor, 0, sizeof(ab->descriptor)); | 291 | memset(&ab->descriptor, 0, sizeof(ab->descriptor)); |
293 | ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | | 292 | ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | |
294 | DESCRIPTOR_STATUS | | 293 | DESCRIPTOR_STATUS | |
@@ -299,8 +298,6 @@ static int ar_context_add_page(struct ar_context *ctx) | |||
299 | ab->descriptor.res_count = cpu_to_le16(PAGE_SIZE - offset); | 298 | ab->descriptor.res_count = cpu_to_le16(PAGE_SIZE - offset); |
300 | ab->descriptor.branch_address = 0; | 299 | ab->descriptor.branch_address = 0; |
301 | 300 | ||
302 | dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
303 | |||
304 | ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1); | 301 | ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1); |
305 | ctx->last_buffer->next = ab; | 302 | ctx->last_buffer->next = ab; |
306 | ctx->last_buffer = ab; | 303 | ctx->last_buffer = ab; |
@@ -311,15 +308,22 @@ static int ar_context_add_page(struct ar_context *ctx) | |||
311 | return 0; | 308 | return 0; |
312 | } | 309 | } |
313 | 310 | ||
311 | #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) | ||
312 | #define cond_le32_to_cpu(v) \ | ||
313 | (ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v)) | ||
314 | #else | ||
315 | #define cond_le32_to_cpu(v) le32_to_cpu(v) | ||
316 | #endif | ||
317 | |||
314 | static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | 318 | static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) |
315 | { | 319 | { |
316 | struct fw_ohci *ohci = ctx->ohci; | 320 | struct fw_ohci *ohci = ctx->ohci; |
317 | struct fw_packet p; | 321 | struct fw_packet p; |
318 | u32 status, length, tcode; | 322 | u32 status, length, tcode; |
319 | 323 | ||
320 | p.header[0] = le32_to_cpu(buffer[0]); | 324 | p.header[0] = cond_le32_to_cpu(buffer[0]); |
321 | p.header[1] = le32_to_cpu(buffer[1]); | 325 | p.header[1] = cond_le32_to_cpu(buffer[1]); |
322 | p.header[2] = le32_to_cpu(buffer[2]); | 326 | p.header[2] = cond_le32_to_cpu(buffer[2]); |
323 | 327 | ||
324 | tcode = (p.header[0] >> 4) & 0x0f; | 328 | tcode = (p.header[0] >> 4) & 0x0f; |
325 | switch (tcode) { | 329 | switch (tcode) { |
@@ -331,7 +335,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | |||
331 | break; | 335 | break; |
332 | 336 | ||
333 | case TCODE_READ_BLOCK_REQUEST : | 337 | case TCODE_READ_BLOCK_REQUEST : |
334 | p.header[3] = le32_to_cpu(buffer[3]); | 338 | p.header[3] = cond_le32_to_cpu(buffer[3]); |
335 | p.header_length = 16; | 339 | p.header_length = 16; |
336 | p.payload_length = 0; | 340 | p.payload_length = 0; |
337 | break; | 341 | break; |
@@ -340,7 +344,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | |||
340 | case TCODE_READ_BLOCK_RESPONSE: | 344 | case TCODE_READ_BLOCK_RESPONSE: |
341 | case TCODE_LOCK_REQUEST: | 345 | case TCODE_LOCK_REQUEST: |
342 | case TCODE_LOCK_RESPONSE: | 346 | case TCODE_LOCK_RESPONSE: |
343 | p.header[3] = le32_to_cpu(buffer[3]); | 347 | p.header[3] = cond_le32_to_cpu(buffer[3]); |
344 | p.header_length = 16; | 348 | p.header_length = 16; |
345 | p.payload_length = p.header[3] >> 16; | 349 | p.payload_length = p.header[3] >> 16; |
346 | break; | 350 | break; |
@@ -357,7 +361,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | |||
357 | 361 | ||
358 | /* FIXME: What to do about evt_* errors? */ | 362 | /* FIXME: What to do about evt_* errors? */ |
359 | length = (p.header_length + p.payload_length + 3) / 4; | 363 | length = (p.header_length + p.payload_length + 3) / 4; |
360 | status = le32_to_cpu(buffer[length]); | 364 | status = cond_le32_to_cpu(buffer[length]); |
361 | 365 | ||
362 | p.ack = ((status >> 16) & 0x1f) - 16; | 366 | p.ack = ((status >> 16) & 0x1f) - 16; |
363 | p.speed = (status >> 21) & 0x7; | 367 | p.speed = (status >> 21) & 0x7; |
@@ -375,7 +379,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | |||
375 | */ | 379 | */ |
376 | 380 | ||
377 | if (p.ack + 16 == 0x09) | 381 | if (p.ack + 16 == 0x09) |
378 | ohci->request_generation = (buffer[2] >> 16) & 0xff; | 382 | ohci->request_generation = (p.header[2] >> 16) & 0xff; |
379 | else if (ctx == &ohci->ar_request_ctx) | 383 | else if (ctx == &ohci->ar_request_ctx) |
380 | fw_core_handle_request(&ohci->card, &p); | 384 | fw_core_handle_request(&ohci->card, &p); |
381 | else | 385 | else |
@@ -397,6 +401,7 @@ static void ar_context_tasklet(unsigned long data) | |||
397 | 401 | ||
398 | if (d->res_count == 0) { | 402 | if (d->res_count == 0) { |
399 | size_t size, rest, offset; | 403 | size_t size, rest, offset; |
404 | dma_addr_t buffer_bus; | ||
400 | 405 | ||
401 | /* | 406 | /* |
402 | * This descriptor is finished and we may have a | 407 | * This descriptor is finished and we may have a |
@@ -405,9 +410,7 @@ static void ar_context_tasklet(unsigned long data) | |||
405 | */ | 410 | */ |
406 | 411 | ||
407 | offset = offsetof(struct ar_buffer, data); | 412 | offset = offsetof(struct ar_buffer, data); |
408 | dma_unmap_single(ohci->card.device, | 413 | buffer_bus = le32_to_cpu(ab->descriptor.data_address) - offset; |
409 | le32_to_cpu(ab->descriptor.data_address) - offset, | ||
410 | PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
411 | 414 | ||
412 | buffer = ab; | 415 | buffer = ab; |
413 | ab = ab->next; | 416 | ab = ab->next; |
@@ -423,7 +426,8 @@ static void ar_context_tasklet(unsigned long data) | |||
423 | while (buffer < end) | 426 | while (buffer < end) |
424 | buffer = handle_ar_packet(ctx, buffer); | 427 | buffer = handle_ar_packet(ctx, buffer); |
425 | 428 | ||
426 | free_page((unsigned long)buffer); | 429 | dma_free_coherent(ohci->card.device, PAGE_SIZE, |
430 | buffer, buffer_bus); | ||
427 | ar_context_add_page(ctx); | 431 | ar_context_add_page(ctx); |
428 | } else { | 432 | } else { |
429 | buffer = ctx->pointer; | 433 | buffer = ctx->pointer; |
@@ -532,7 +536,7 @@ static int | |||
532 | context_add_buffer(struct context *ctx) | 536 | context_add_buffer(struct context *ctx) |
533 | { | 537 | { |
534 | struct descriptor_buffer *desc; | 538 | struct descriptor_buffer *desc; |
535 | dma_addr_t bus_addr; | 539 | dma_addr_t uninitialized_var(bus_addr); |
536 | int offset; | 540 | int offset; |
537 | 541 | ||
538 | /* | 542 | /* |
@@ -1022,13 +1026,14 @@ static void bus_reset_tasklet(unsigned long data) | |||
1022 | */ | 1026 | */ |
1023 | 1027 | ||
1024 | self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff; | 1028 | self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff; |
1025 | generation = (le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff; | 1029 | generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff; |
1026 | rmb(); | 1030 | rmb(); |
1027 | 1031 | ||
1028 | for (i = 1, j = 0; j < self_id_count; i += 2, j++) { | 1032 | for (i = 1, j = 0; j < self_id_count; i += 2, j++) { |
1029 | if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) | 1033 | if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) |
1030 | fw_error("inconsistent self IDs\n"); | 1034 | fw_error("inconsistent self IDs\n"); |
1031 | ohci->self_id_buffer[j] = le32_to_cpu(ohci->self_id_cpu[i]); | 1035 | ohci->self_id_buffer[j] = |
1036 | cond_le32_to_cpu(ohci->self_id_cpu[i]); | ||
1032 | } | 1037 | } |
1033 | rmb(); | 1038 | rmb(); |
1034 | 1039 | ||
@@ -1316,7 +1321,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) | |||
1316 | unsigned long flags; | 1321 | unsigned long flags; |
1317 | int retval = -EBUSY; | 1322 | int retval = -EBUSY; |
1318 | __be32 *next_config_rom; | 1323 | __be32 *next_config_rom; |
1319 | dma_addr_t next_config_rom_bus; | 1324 | dma_addr_t uninitialized_var(next_config_rom_bus); |
1320 | 1325 | ||
1321 | ohci = fw_ohci(card); | 1326 | ohci = fw_ohci(card); |
1322 | 1327 | ||
@@ -1487,7 +1492,7 @@ static int handle_ir_dualbuffer_packet(struct context *context, | |||
1487 | void *p, *end; | 1492 | void *p, *end; |
1488 | int i; | 1493 | int i; |
1489 | 1494 | ||
1490 | if (db->first_res_count > 0 && db->second_res_count > 0) { | 1495 | if (db->first_res_count != 0 && db->second_res_count != 0) { |
1491 | if (ctx->excess_bytes <= le16_to_cpu(db->second_req_count)) { | 1496 | if (ctx->excess_bytes <= le16_to_cpu(db->second_req_count)) { |
1492 | /* This descriptor isn't done yet, stop iteration. */ | 1497 | /* This descriptor isn't done yet, stop iteration. */ |
1493 | return 0; | 1498 | return 0; |
@@ -1513,7 +1518,7 @@ static int handle_ir_dualbuffer_packet(struct context *context, | |||
1513 | memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4); | 1518 | memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4); |
1514 | i += ctx->base.header_size; | 1519 | i += ctx->base.header_size; |
1515 | ctx->excess_bytes += | 1520 | ctx->excess_bytes += |
1516 | (le32_to_cpu(*(u32 *)(p + 4)) >> 16) & 0xffff; | 1521 | (le32_to_cpu(*(__le32 *)(p + 4)) >> 16) & 0xffff; |
1517 | p += ctx->base.header_size + 4; | 1522 | p += ctx->base.header_size + 4; |
1518 | } | 1523 | } |
1519 | ctx->header_length = i; | 1524 | ctx->header_length = i; |
@@ -2048,6 +2053,18 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2048 | int err; | 2053 | int err; |
2049 | size_t size; | 2054 | size_t size; |
2050 | 2055 | ||
2056 | #ifdef CONFIG_PPC_PMAC | ||
2057 | /* Necessary on some machines if fw-ohci was loaded/ unloaded before */ | ||
2058 | if (machine_is(powermac)) { | ||
2059 | struct device_node *ofn = pci_device_to_OF_node(dev); | ||
2060 | |||
2061 | if (ofn) { | ||
2062 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 1); | ||
2063 | pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1); | ||
2064 | } | ||
2065 | } | ||
2066 | #endif /* CONFIG_PPC_PMAC */ | ||
2067 | |||
2051 | ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); | 2068 | ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); |
2052 | if (ohci == NULL) { | 2069 | if (ohci == NULL) { |
2053 | fw_error("Could not malloc fw_ohci data.\n"); | 2070 | fw_error("Could not malloc fw_ohci data.\n"); |
@@ -2066,6 +2083,10 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2066 | pci_write_config_dword(dev, OHCI1394_PCI_HCI_Control, 0); | 2083 | pci_write_config_dword(dev, OHCI1394_PCI_HCI_Control, 0); |
2067 | pci_set_drvdata(dev, ohci); | 2084 | pci_set_drvdata(dev, ohci); |
2068 | 2085 | ||
2086 | #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) | ||
2087 | ohci->old_uninorth = dev->vendor == PCI_VENDOR_ID_APPLE && | ||
2088 | dev->device == PCI_DEVICE_ID_APPLE_UNI_N_FW; | ||
2089 | #endif | ||
2069 | spin_lock_init(&ohci->lock); | 2090 | spin_lock_init(&ohci->lock); |
2070 | 2091 | ||
2071 | tasklet_init(&ohci->bus_reset_tasklet, | 2092 | tasklet_init(&ohci->bus_reset_tasklet, |
@@ -2182,6 +2203,19 @@ static void pci_remove(struct pci_dev *dev) | |||
2182 | pci_disable_device(dev); | 2203 | pci_disable_device(dev); |
2183 | fw_card_put(&ohci->card); | 2204 | fw_card_put(&ohci->card); |
2184 | 2205 | ||
2206 | #ifdef CONFIG_PPC_PMAC | ||
2207 | /* On UniNorth, power down the cable and turn off the chip clock | ||
2208 | * to save power on laptops */ | ||
2209 | if (machine_is(powermac)) { | ||
2210 | struct device_node *ofn = pci_device_to_OF_node(dev); | ||
2211 | |||
2212 | if (ofn) { | ||
2213 | pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0); | ||
2214 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 0); | ||
2215 | } | ||
2216 | } | ||
2217 | #endif /* CONFIG_PPC_PMAC */ | ||
2218 | |||
2185 | fw_notify("Removed fw-ohci device.\n"); | 2219 | fw_notify("Removed fw-ohci device.\n"); |
2186 | } | 2220 | } |
2187 | 2221 | ||
@@ -2202,6 +2236,16 @@ static int pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2202 | if (err) | 2236 | if (err) |
2203 | fw_error("pci_set_power_state failed with %d\n", err); | 2237 | fw_error("pci_set_power_state failed with %d\n", err); |
2204 | 2238 | ||
2239 | /* PowerMac suspend code comes last */ | ||
2240 | #ifdef CONFIG_PPC_PMAC | ||
2241 | if (machine_is(powermac)) { | ||
2242 | struct device_node *ofn = pci_device_to_OF_node(pdev); | ||
2243 | |||
2244 | if (ofn) | ||
2245 | pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0); | ||
2246 | } | ||
2247 | #endif /* CONFIG_PPC_PMAC */ | ||
2248 | |||
2205 | return 0; | 2249 | return 0; |
2206 | } | 2250 | } |
2207 | 2251 | ||
@@ -2210,6 +2254,16 @@ static int pci_resume(struct pci_dev *pdev) | |||
2210 | struct fw_ohci *ohci = pci_get_drvdata(pdev); | 2254 | struct fw_ohci *ohci = pci_get_drvdata(pdev); |
2211 | int err; | 2255 | int err; |
2212 | 2256 | ||
2257 | /* PowerMac resume code comes first */ | ||
2258 | #ifdef CONFIG_PPC_PMAC | ||
2259 | if (machine_is(powermac)) { | ||
2260 | struct device_node *ofn = pci_device_to_OF_node(pdev); | ||
2261 | |||
2262 | if (ofn) | ||
2263 | pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1); | ||
2264 | } | ||
2265 | #endif /* CONFIG_PPC_PMAC */ | ||
2266 | |||
2213 | pci_set_power_state(pdev, PCI_D0); | 2267 | pci_set_power_state(pdev, PCI_D0); |
2214 | pci_restore_state(pdev); | 2268 | pci_restore_state(pdev); |
2215 | err = pci_enable_device(pdev); | 2269 | err = pci_enable_device(pdev); |
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 03069a454c07..62b4e47d0cc0 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -173,6 +173,7 @@ struct sbp2_target { | |||
173 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ | 173 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ |
174 | #define SBP2_ORB_NULL 0x80000000 | 174 | #define SBP2_ORB_NULL 0x80000000 |
175 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 | 175 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 |
176 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ | ||
176 | 177 | ||
177 | #define SBP2_DIRECTION_TO_MEDIA 0x0 | 178 | #define SBP2_DIRECTION_TO_MEDIA 0x0 |
178 | #define SBP2_DIRECTION_FROM_MEDIA 0x1 | 179 | #define SBP2_DIRECTION_FROM_MEDIA 0x1 |
@@ -330,6 +331,11 @@ static const struct { | |||
330 | .model = ~0, | 331 | .model = ~0, |
331 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | 332 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, |
332 | }, | 333 | }, |
334 | /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ { | ||
335 | .firmware_revision = 0x002600, | ||
336 | .model = ~0, | ||
337 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | ||
338 | }, | ||
333 | 339 | ||
334 | /* | 340 | /* |
335 | * There are iPods (2nd gen, 3rd gen) with model_id == 0, but | 341 | * There are iPods (2nd gen, 3rd gen) with model_id == 0, but |
@@ -812,6 +818,30 @@ static void sbp2_target_put(struct sbp2_target *tgt) | |||
812 | kref_put(&tgt->kref, sbp2_release_target); | 818 | kref_put(&tgt->kref, sbp2_release_target); |
813 | } | 819 | } |
814 | 820 | ||
821 | static void | ||
822 | complete_set_busy_timeout(struct fw_card *card, int rcode, | ||
823 | void *payload, size_t length, void *done) | ||
824 | { | ||
825 | complete(done); | ||
826 | } | ||
827 | |||
828 | static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu) | ||
829 | { | ||
830 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); | ||
831 | DECLARE_COMPLETION_ONSTACK(done); | ||
832 | struct fw_transaction t; | ||
833 | static __be32 busy_timeout; | ||
834 | |||
835 | /* FIXME: we should try to set dual-phase cycle_limit too */ | ||
836 | busy_timeout = cpu_to_be32(SBP2_RETRY_LIMIT); | ||
837 | |||
838 | fw_send_request(device->card, &t, TCODE_WRITE_QUADLET_REQUEST, | ||
839 | lu->tgt->node_id, lu->generation, device->max_speed, | ||
840 | CSR_REGISTER_BASE + CSR_BUSY_TIMEOUT, &busy_timeout, | ||
841 | sizeof(busy_timeout), complete_set_busy_timeout, &done); | ||
842 | wait_for_completion(&done); | ||
843 | } | ||
844 | |||
815 | static void sbp2_reconnect(struct work_struct *work); | 845 | static void sbp2_reconnect(struct work_struct *work); |
816 | 846 | ||
817 | static void sbp2_login(struct work_struct *work) | 847 | static void sbp2_login(struct work_struct *work) |
@@ -864,10 +894,8 @@ static void sbp2_login(struct work_struct *work) | |||
864 | fw_notify("%s: logged in to LUN %04x (%d retries)\n", | 894 | fw_notify("%s: logged in to LUN %04x (%d retries)\n", |
865 | tgt->bus_id, lu->lun, lu->retries); | 895 | tgt->bus_id, lu->lun, lu->retries); |
866 | 896 | ||
867 | #if 0 | 897 | /* set appropriate retry limit(s) in BUSY_TIMEOUT register */ |
868 | /* FIXME: The linux1394 sbp2 does this last step. */ | 898 | sbp2_set_busy_timeout(lu); |
869 | sbp2_set_busy_timeout(scsi_id); | ||
870 | #endif | ||
871 | 899 | ||
872 | PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect); | 900 | PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect); |
873 | sbp2_agent_reset(lu); | 901 | sbp2_agent_reset(lu); |
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c index e47bb040197a..d2c7a3d7e1cb 100644 --- a/drivers/firewire/fw-topology.c +++ b/drivers/firewire/fw-topology.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <asm/bug.h> | ||
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
25 | #include "fw-transaction.h" | 26 | #include "fw-transaction.h" |
26 | #include "fw-topology.h" | 27 | #include "fw-topology.h" |
@@ -424,8 +425,8 @@ update_tree(struct fw_card *card, struct fw_node *root) | |||
424 | node1 = fw_node(list1.next); | 425 | node1 = fw_node(list1.next); |
425 | 426 | ||
426 | while (&node0->link != &list0) { | 427 | while (&node0->link != &list0) { |
428 | WARN_ON(node0->port_count != node1->port_count); | ||
427 | 429 | ||
428 | /* assert(node0->port_count == node1->port_count); */ | ||
429 | if (node0->link_on && !node1->link_on) | 430 | if (node0->link_on && !node1->link_on) |
430 | event = FW_NODE_LINK_OFF; | 431 | event = FW_NODE_LINK_OFF; |
431 | else if (!node0->link_on && node1->link_on) | 432 | else if (!node0->link_on && node1->link_on) |
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c index 7fcc59dedf08..e6f1bda38940 100644 --- a/drivers/firewire/fw-transaction.c +++ b/drivers/firewire/fw-transaction.c | |||
@@ -736,6 +736,12 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p) | |||
736 | break; | 736 | break; |
737 | } | 737 | } |
738 | 738 | ||
739 | /* | ||
740 | * The response handler may be executed while the request handler | ||
741 | * is still pending. Cancel the request handler. | ||
742 | */ | ||
743 | card->driver->cancel_packet(card, &t->packet); | ||
744 | |||
739 | t->callback(card, rcode, data, data_length, t->callback_data); | 745 | t->callback(card, rcode, data, data_length, t->callback_data); |
740 | } | 746 | } |
741 | EXPORT_SYMBOL(fw_core_handle_response); | 747 | EXPORT_SYMBOL(fw_core_handle_response); |
@@ -751,7 +757,7 @@ handle_topology_map(struct fw_card *card, struct fw_request *request, | |||
751 | void *payload, size_t length, void *callback_data) | 757 | void *payload, size_t length, void *callback_data) |
752 | { | 758 | { |
753 | int i, start, end; | 759 | int i, start, end; |
754 | u32 *map; | 760 | __be32 *map; |
755 | 761 | ||
756 | if (!TCODE_IS_READ_REQUEST(tcode)) { | 762 | if (!TCODE_IS_READ_REQUEST(tcode)) { |
757 | fw_send_response(card, request, RCODE_TYPE_ERROR); | 763 | fw_send_response(card, request, RCODE_TYPE_ERROR); |
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 09cb72870454..a43bb22912f9 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h | |||
@@ -86,12 +86,12 @@ | |||
86 | static inline void | 86 | static inline void |
87 | fw_memcpy_from_be32(void *_dst, void *_src, size_t size) | 87 | fw_memcpy_from_be32(void *_dst, void *_src, size_t size) |
88 | { | 88 | { |
89 | u32 *dst = _dst; | 89 | u32 *dst = _dst; |
90 | u32 *src = _src; | 90 | __be32 *src = _src; |
91 | int i; | 91 | int i; |
92 | 92 | ||
93 | for (i = 0; i < size / 4; i++) | 93 | for (i = 0; i < size / 4; i++) |
94 | dst[i] = cpu_to_be32(src[i]); | 94 | dst[i] = be32_to_cpu(src[i]); |
95 | } | 95 | } |
96 | 96 | ||
97 | static inline void | 97 | static inline void |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index d73a768e176e..f0b00ec1e47e 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -968,7 +968,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
968 | size--; | 968 | size--; |
969 | } | 969 | } |
970 | 970 | ||
971 | /* dump the report descriptor */ | 971 | /* dump the report */ |
972 | dbg_hid("report %d (size %u) = ", n, size); | 972 | dbg_hid("report %d (size %u) = ", n, size); |
973 | for (i = 0; i < size; i++) | 973 | for (i = 0; i < size; i++) |
974 | dbg_hid_line(" %02x", data[i]); | 974 | dbg_hid_line(" %02x", data[i]); |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 5a38fb27d69f..c3eb3f13e2ca 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -98,18 +98,16 @@ struct hidinput_key_translation { | |||
98 | 98 | ||
99 | static struct hidinput_key_translation apple_fn_keys[] = { | 99 | static struct hidinput_key_translation apple_fn_keys[] = { |
100 | { KEY_BACKSPACE, KEY_DELETE }, | 100 | { KEY_BACKSPACE, KEY_DELETE }, |
101 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, | 101 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, |
102 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, | 102 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, |
103 | { KEY_F3, KEY_CYCLEWINDOWS, APPLE_FLAG_FKEY }, /* Exposé */ | 103 | { KEY_F3, KEY_FN_F5, APPLE_FLAG_FKEY }, /* Exposé */ |
104 | { KEY_F4, KEY_FN_F4, APPLE_FLAG_FKEY }, /* Dashboard */ | 104 | { KEY_F4, KEY_FN_F4, APPLE_FLAG_FKEY }, /* Dashboard */ |
105 | { KEY_F5, KEY_FN_F5 }, | 105 | { KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY }, |
106 | { KEY_F6, KEY_FN_F6 }, | 106 | { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, |
107 | { KEY_F7, KEY_BACK, APPLE_FLAG_FKEY }, | 107 | { KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY }, |
108 | { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, | 108 | { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, |
109 | { KEY_F9, KEY_FORWARD, APPLE_FLAG_FKEY }, | 109 | { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, |
110 | { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, | 110 | { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, |
111 | { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, | ||
112 | { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, | ||
113 | { KEY_UP, KEY_PAGEUP }, | 111 | { KEY_UP, KEY_PAGEUP }, |
114 | { KEY_DOWN, KEY_PAGEDOWN }, | 112 | { KEY_DOWN, KEY_PAGEDOWN }, |
115 | { KEY_LEFT, KEY_HOME }, | 113 | { KEY_LEFT, KEY_HOME }, |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index b38e559b7a46..d95979f0e028 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -278,7 +278,7 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
278 | usbhid->urbctrl->pipe = usb_rcvctrlpipe(hid_to_usb_dev(hid), 0); | 278 | usbhid->urbctrl->pipe = usb_rcvctrlpipe(hid_to_usb_dev(hid), 0); |
279 | maxpacket = usb_maxpacket(hid_to_usb_dev(hid), usbhid->urbctrl->pipe, 0); | 279 | maxpacket = usb_maxpacket(hid_to_usb_dev(hid), usbhid->urbctrl->pipe, 0); |
280 | if (maxpacket > 0) { | 280 | if (maxpacket > 0) { |
281 | padlen = (len + maxpacket - 1) / maxpacket; | 281 | padlen = DIV_ROUND_UP(len, maxpacket); |
282 | padlen *= maxpacket; | 282 | padlen *= maxpacket; |
283 | if (padlen > usbhid->bufsize) | 283 | if (padlen > usbhid->bufsize) |
284 | padlen = usbhid->bufsize; | 284 | padlen = usbhid->bufsize; |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index e6d05f6b1c1c..e29a057cbea2 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -345,6 +345,9 @@ | |||
345 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 | 345 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 |
346 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 | 346 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 |
347 | 347 | ||
348 | #define USB_VENDOR_ID_NATSU 0x08b7 | ||
349 | #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001 | ||
350 | |||
348 | #define USB_VENDOR_ID_NEC 0x073e | 351 | #define USB_VENDOR_ID_NEC 0x073e |
349 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 | 352 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 |
350 | 353 | ||
@@ -426,6 +429,7 @@ static const struct hid_blacklist { | |||
426 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 429 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
427 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 430 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
428 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 431 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
432 | { USB_VENDOR_ID_NATSU, USB_DEVICE_ID_NATSU_GAMEPAD, HID_QUIRK_BADPAD }, | ||
429 | { USB_VENDOR_ID_NEC, USB_DEVICE_ID_NEC_USB_GAME_PAD, HID_QUIRK_BADPAD }, | 433 | { USB_VENDOR_ID_NEC, USB_DEVICE_ID_NEC_USB_GAME_PAD, HID_QUIRK_BADPAD }, |
430 | { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD }, | 434 | { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD }, |
431 | { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, | 435 | { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, |
@@ -624,7 +628,7 @@ static const struct hid_blacklist { | |||
624 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
625 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, | 629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, |
626 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
627 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 631 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 632 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 633 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN }, |
630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 634 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 368879ff5d8c..4dc76bc45c9d 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -337,8 +337,9 @@ config SENSORS_IBMPEX | |||
337 | help | 337 | help |
338 | If you say yes here you get support for the temperature and | 338 | If you say yes here you get support for the temperature and |
339 | power sensors in various IBM System X servers that support | 339 | power sensors in various IBM System X servers that support |
340 | PowerExecutive. So far this includes the x3550, x3650, x3655, | 340 | PowerExecutive. So far this includes the x3350, x3550, x3650, |
341 | x3755, and certain HS20 blades. | 341 | x3655, and x3755; the x3800, x3850, and x3950 models that have |
342 | PCI Express; and some of the HS2x, LS2x, and QS2x blades. | ||
342 | 343 | ||
343 | This driver can also be built as a module. If so, the module | 344 | This driver can also be built as a module. If so, the module |
344 | will be called ibmpex. | 345 | will be called ibmpex. |
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c index 9c9cdb0685e4..4e9b19c6732f 100644 --- a/drivers/hwmon/ibmpex.c +++ b/drivers/hwmon/ibmpex.c | |||
@@ -327,10 +327,14 @@ static int is_temp_sensor(const char *sensor_id, int len) | |||
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | 329 | ||
330 | static int power_sensor_multiplier(const char *sensor_id, int len) | 330 | static int power_sensor_multiplier(struct ibmpex_bmc_data *data, |
331 | const char *sensor_id, int len) | ||
331 | { | 332 | { |
332 | int i; | 333 | int i; |
333 | 334 | ||
335 | if (data->sensor_major == 2) | ||
336 | return 1000000; | ||
337 | |||
334 | for (i = PEX_SENSOR_TYPE_LEN; i < len - 1; i++) | 338 | for (i = PEX_SENSOR_TYPE_LEN; i < len - 1; i++) |
335 | if (!memcmp(&sensor_id[i], watt_sensor_sig, PEX_MULT_LEN)) | 339 | if (!memcmp(&sensor_id[i], watt_sensor_sig, PEX_MULT_LEN)) |
336 | return 1000000; | 340 | return 1000000; |
@@ -398,14 +402,15 @@ static int ibmpex_find_sensors(struct ibmpex_bmc_data *data) | |||
398 | num_power++; | 402 | num_power++; |
399 | sensor_counter = num_power; | 403 | sensor_counter = num_power; |
400 | data->sensors[i].multiplier = | 404 | data->sensors[i].multiplier = |
401 | power_sensor_multiplier(data->rx_msg_data, | 405 | power_sensor_multiplier(data, |
402 | data->rx_msg_len); | 406 | data->rx_msg_data, |
407 | data->rx_msg_len); | ||
403 | } else if (is_temp_sensor(data->rx_msg_data, | 408 | } else if (is_temp_sensor(data->rx_msg_data, |
404 | data->rx_msg_len)) { | 409 | data->rx_msg_len)) { |
405 | sensor_type = TEMP_SENSOR; | 410 | sensor_type = TEMP_SENSOR; |
406 | num_temp++; | 411 | num_temp++; |
407 | sensor_counter = num_temp; | 412 | sensor_counter = num_temp; |
408 | data->sensors[i].multiplier = 1; | 413 | data->sensors[i].multiplier = 1000; |
409 | } else | 414 | } else |
410 | continue; | 415 | continue; |
411 | 416 | ||
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 476b0bb72d6c..5fa9c3c67e0c 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -100,7 +100,7 @@ config I2C_AU1550 | |||
100 | 100 | ||
101 | config I2C_BLACKFIN_TWI | 101 | config I2C_BLACKFIN_TWI |
102 | tristate "Blackfin TWI I2C support" | 102 | tristate "Blackfin TWI I2C support" |
103 | depends on BF534 || BF536 || BF537 || BF54x | 103 | depends on BF534 || BF536 || BF537 |
104 | help | 104 | help |
105 | This is the TWI I2C device driver for Blackfin 534/536/537/54x. | 105 | This is the TWI I2C device driver for Blackfin 534/536/537/54x. |
106 | This driver can also be built as a module. If so, the module | 106 | This driver can also be built as a module. If so, the module |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 573abe440842..2fa43183d375 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -335,7 +335,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev, | |||
335 | u8 temp; | 335 | u8 temp; |
336 | 336 | ||
337 | /* driver_data might come from user-space, so check it */ | 337 | /* driver_data might come from user-space, so check it */ |
338 | if (id->driver_data > ARRAY_SIZE(chipname)) | 338 | if (id->driver_data >= ARRAY_SIZE(chipname)) |
339 | return -EINVAL; | 339 | return -EINVAL; |
340 | 340 | ||
341 | if (amd756_ioport) { | 341 | if (amd756_ioport) { |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index da6639707ea3..7ba31770d773 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -128,6 +128,8 @@ struct omap_i2c_dev { | |||
128 | size_t buf_len; | 128 | size_t buf_len; |
129 | struct i2c_adapter adapter; | 129 | struct i2c_adapter adapter; |
130 | unsigned rev1:1; | 130 | unsigned rev1:1; |
131 | unsigned idle:1; | ||
132 | u16 iestate; /* Saved interrupt register */ | ||
131 | }; | 133 | }; |
132 | 134 | ||
133 | static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev, | 135 | static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev, |
@@ -174,18 +176,30 @@ static void omap_i2c_put_clocks(struct omap_i2c_dev *dev) | |||
174 | } | 176 | } |
175 | } | 177 | } |
176 | 178 | ||
177 | static void omap_i2c_enable_clocks(struct omap_i2c_dev *dev) | 179 | static void omap_i2c_unidle(struct omap_i2c_dev *dev) |
178 | { | 180 | { |
179 | if (dev->iclk != NULL) | 181 | if (dev->iclk != NULL) |
180 | clk_enable(dev->iclk); | 182 | clk_enable(dev->iclk); |
181 | clk_enable(dev->fclk); | 183 | clk_enable(dev->fclk); |
184 | if (dev->iestate) | ||
185 | omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate); | ||
186 | dev->idle = 0; | ||
182 | } | 187 | } |
183 | 188 | ||
184 | static void omap_i2c_disable_clocks(struct omap_i2c_dev *dev) | 189 | static void omap_i2c_idle(struct omap_i2c_dev *dev) |
185 | { | 190 | { |
191 | u16 iv; | ||
192 | |||
193 | dev->idle = 1; | ||
194 | dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); | ||
195 | omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0); | ||
196 | if (dev->rev1) | ||
197 | iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */ | ||
198 | else | ||
199 | omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate); | ||
200 | clk_disable(dev->fclk); | ||
186 | if (dev->iclk != NULL) | 201 | if (dev->iclk != NULL) |
187 | clk_disable(dev->iclk); | 202 | clk_disable(dev->iclk); |
188 | clk_disable(dev->fclk); | ||
189 | } | 203 | } |
190 | 204 | ||
191 | static int omap_i2c_init(struct omap_i2c_dev *dev) | 205 | static int omap_i2c_init(struct omap_i2c_dev *dev) |
@@ -360,7 +374,7 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
360 | int i; | 374 | int i; |
361 | int r; | 375 | int r; |
362 | 376 | ||
363 | omap_i2c_enable_clocks(dev); | 377 | omap_i2c_unidle(dev); |
364 | 378 | ||
365 | if ((r = omap_i2c_wait_for_bb(dev)) < 0) | 379 | if ((r = omap_i2c_wait_for_bb(dev)) < 0) |
366 | goto out; | 380 | goto out; |
@@ -374,7 +388,7 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
374 | if (r == 0) | 388 | if (r == 0) |
375 | r = num; | 389 | r = num; |
376 | out: | 390 | out: |
377 | omap_i2c_disable_clocks(dev); | 391 | omap_i2c_idle(dev); |
378 | return r; | 392 | return r; |
379 | } | 393 | } |
380 | 394 | ||
@@ -403,6 +417,9 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id) | |||
403 | struct omap_i2c_dev *dev = dev_id; | 417 | struct omap_i2c_dev *dev = dev_id; |
404 | u16 iv, w; | 418 | u16 iv, w; |
405 | 419 | ||
420 | if (dev->idle) | ||
421 | return IRQ_NONE; | ||
422 | |||
406 | iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); | 423 | iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); |
407 | switch (iv) { | 424 | switch (iv) { |
408 | case 0x00: /* None */ | 425 | case 0x00: /* None */ |
@@ -457,6 +474,9 @@ omap_i2c_isr(int this_irq, void *dev_id) | |||
457 | u16 stat, w; | 474 | u16 stat, w; |
458 | int count = 0; | 475 | int count = 0; |
459 | 476 | ||
477 | if (dev->idle) | ||
478 | return IRQ_NONE; | ||
479 | |||
460 | bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); | 480 | bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); |
461 | while ((stat = (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG))) & bits) { | 481 | while ((stat = (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG))) & bits) { |
462 | dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat); | 482 | dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat); |
@@ -575,7 +595,7 @@ omap_i2c_probe(struct platform_device *pdev) | |||
575 | if ((r = omap_i2c_get_clocks(dev)) != 0) | 595 | if ((r = omap_i2c_get_clocks(dev)) != 0) |
576 | goto err_free_mem; | 596 | goto err_free_mem; |
577 | 597 | ||
578 | omap_i2c_enable_clocks(dev); | 598 | omap_i2c_unidle(dev); |
579 | 599 | ||
580 | if (cpu_is_omap15xx()) | 600 | if (cpu_is_omap15xx()) |
581 | dev->rev1 = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) < 0x20; | 601 | dev->rev1 = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) < 0x20; |
@@ -610,7 +630,7 @@ omap_i2c_probe(struct platform_device *pdev) | |||
610 | goto err_free_irq; | 630 | goto err_free_irq; |
611 | } | 631 | } |
612 | 632 | ||
613 | omap_i2c_disable_clocks(dev); | 633 | omap_i2c_idle(dev); |
614 | 634 | ||
615 | return 0; | 635 | return 0; |
616 | 636 | ||
@@ -618,7 +638,7 @@ err_free_irq: | |||
618 | free_irq(dev->irq, dev); | 638 | free_irq(dev->irq, dev); |
619 | err_unuse_clocks: | 639 | err_unuse_clocks: |
620 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); | 640 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); |
621 | omap_i2c_disable_clocks(dev); | 641 | omap_i2c_idle(dev); |
622 | omap_i2c_put_clocks(dev); | 642 | omap_i2c_put_clocks(dev); |
623 | err_free_mem: | 643 | err_free_mem: |
624 | platform_set_drvdata(pdev, NULL); | 644 | platform_set_drvdata(pdev, NULL); |
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile index 501f00cea782..e47aca0ca5ae 100644 --- a/drivers/i2c/chips/Makefile +++ b/drivers/i2c/chips/Makefile | |||
@@ -1,6 +1,13 @@ | |||
1 | # | 1 | # |
2 | # Makefile for miscellaneous I2C chip drivers. | 2 | # Makefile for miscellaneous I2C chip drivers. |
3 | # | 3 | # |
4 | # Think twice before you add a new driver to this directory. | ||
5 | # Device drivers are better grouped according to the functionality they | ||
6 | # implement rather than to the bus they are connected to. In particular: | ||
7 | # * Hardware monitoring chip drivers go to drivers/hwmon | ||
8 | # * RTC chip drivers go to drivers/rtc | ||
9 | # * I/O expander drivers go to drivers/gpio | ||
10 | # | ||
4 | 11 | ||
5 | obj-$(CONFIG_DS1682) += ds1682.o | 12 | obj-$(CONFIG_DS1682) += ds1682.o |
6 | obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o | 13 | obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 96da22e9a5a4..8b645c6b2cb5 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -90,12 +90,16 @@ static int i2c_device_probe(struct device *dev) | |||
90 | { | 90 | { |
91 | struct i2c_client *client = to_i2c_client(dev); | 91 | struct i2c_client *client = to_i2c_client(dev); |
92 | struct i2c_driver *driver = to_i2c_driver(dev->driver); | 92 | struct i2c_driver *driver = to_i2c_driver(dev->driver); |
93 | int status; | ||
93 | 94 | ||
94 | if (!driver->probe) | 95 | if (!driver->probe) |
95 | return -ENODEV; | 96 | return -ENODEV; |
96 | client->driver = driver; | 97 | client->driver = driver; |
97 | dev_dbg(dev, "probe\n"); | 98 | dev_dbg(dev, "probe\n"); |
98 | return driver->probe(client); | 99 | status = driver->probe(client); |
100 | if (status) | ||
101 | client->driver = NULL; | ||
102 | return status; | ||
99 | } | 103 | } |
100 | 104 | ||
101 | static int i2c_device_remove(struct device *dev) | 105 | static int i2c_device_remove(struct device *dev) |
@@ -485,8 +489,8 @@ EXPORT_SYMBOL(i2c_add_adapter); | |||
485 | * Context: can sleep | 489 | * Context: can sleep |
486 | * | 490 | * |
487 | * This routine is used to declare an I2C adapter when its bus number | 491 | * This routine is used to declare an I2C adapter when its bus number |
488 | * matters. Example: for I2C adapters from system-on-chip CPUs, or | 492 | * matters. For example, use it for I2C adapters from system-on-chip CPUs, |
489 | * otherwise built in to the system's mainboard, and where i2c_board_info | 493 | * or otherwise built in to the system's mainboard, and where i2c_board_info |
490 | * is used to properly configure I2C devices. | 494 | * is used to properly configure I2C devices. |
491 | * | 495 | * |
492 | * If no devices have pre-been declared for this bus, then be sure to | 496 | * If no devices have pre-been declared for this bus, then be sure to |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index c419266234a7..01b92208f09d 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -595,6 +595,7 @@ u8 eighty_ninty_three (ide_drive_t *drive) | |||
595 | 595 | ||
596 | /* | 596 | /* |
597 | * FIXME: | 597 | * FIXME: |
598 | * - change master/slave IDENTIFY order | ||
598 | * - force bit13 (80c cable present) check also for !ivb devices | 599 | * - force bit13 (80c cable present) check also for !ivb devices |
599 | * (unless the slave device is pre-ATA3) | 600 | * (unless the slave device is pre-ATA3) |
600 | */ | 601 | */ |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 29e2c9719c30..7031a8dcf692 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -122,7 +122,6 @@ static struct ide_pio_info { | |||
122 | const char *name; | 122 | const char *name; |
123 | int pio; | 123 | int pio; |
124 | } ide_pio_blacklist [] = { | 124 | } ide_pio_blacklist [] = { |
125 | /* { "Conner Peripherals 1275MB - CFS1275A", 4 }, */ | ||
126 | { "Conner Peripherals 540MB - CFS540A", 3 }, | 125 | { "Conner Peripherals 540MB - CFS540A", 3 }, |
127 | 126 | ||
128 | { "WDC AC2700", 3 }, | 127 | { "WDC AC2700", 3 }, |
@@ -138,10 +137,8 @@ static struct ide_pio_info { | |||
138 | { "WDC AC1170", 1 }, | 137 | { "WDC AC1170", 1 }, |
139 | { "WDC AC1210", 1 }, | 138 | { "WDC AC1210", 1 }, |
140 | { "WDC AC280", 0 }, | 139 | { "WDC AC280", 0 }, |
141 | /* { "WDC AC21000", 4 }, */ | ||
142 | { "WDC AC31000", 3 }, | 140 | { "WDC AC31000", 3 }, |
143 | { "WDC AC31200", 3 }, | 141 | { "WDC AC31200", 3 }, |
144 | /* { "WDC AC31600", 4 }, */ | ||
145 | 142 | ||
146 | { "Maxtor 7131 AT", 1 }, | 143 | { "Maxtor 7131 AT", 1 }, |
147 | { "Maxtor 7171 AT", 1 }, | 144 | { "Maxtor 7171 AT", 1 }, |
@@ -155,13 +152,6 @@ static struct ide_pio_info { | |||
155 | { "SAMSUNG SHD-3122A", 1 }, | 152 | { "SAMSUNG SHD-3122A", 1 }, |
156 | { "SAMSUNG SHD-3172A", 1 }, | 153 | { "SAMSUNG SHD-3172A", 1 }, |
157 | 154 | ||
158 | /* { "ST51080A", 4 }, | ||
159 | * { "ST51270A", 4 }, | ||
160 | * { "ST31220A", 4 }, | ||
161 | * { "ST31640A", 4 }, | ||
162 | * { "ST32140A", 4 }, | ||
163 | * { "ST3780A", 4 }, | ||
164 | */ | ||
165 | { "ST5660A", 3 }, | 155 | { "ST5660A", 3 }, |
166 | { "ST3660A", 3 }, | 156 | { "ST3660A", 3 }, |
167 | { "ST3630A", 3 }, | 157 | { "ST3630A", 3 }, |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 194ecb0049eb..47a114927c31 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -774,9 +774,10 @@ static int ide_probe_port(ide_hwif_t *hwif) | |||
774 | printk(KERN_DEBUG "%s: Wait for ready failed before probe !\n", hwif->name); | 774 | printk(KERN_DEBUG "%s: Wait for ready failed before probe !\n", hwif->name); |
775 | 775 | ||
776 | /* | 776 | /* |
777 | * Need to probe slave device first to make it release PDIAG-. | 777 | * Second drive should only exist if first drive was found, |
778 | * but a lot of cdrom drives are configured as single slaves. | ||
778 | */ | 779 | */ |
779 | for (unit = MAX_DRIVES - 1; unit >= 0; unit--) { | 780 | for (unit = 0; unit < MAX_DRIVES; ++unit) { |
780 | ide_drive_t *drive = &hwif->drives[unit]; | 781 | ide_drive_t *drive = &hwif->drives[unit]; |
781 | drive->dn = (hwif->channel ? 2 : 0) + unit; | 782 | drive->dn = (hwif->channel ? 2 : 0) + unit; |
782 | (void) probe_for_drive(drive); | 783 | (void) probe_for_drive(drive); |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 43e0e0557776..0598ecfd5f37 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -3765,11 +3765,6 @@ static int ide_tape_probe(ide_drive_t *drive) | |||
3765 | g->fops = &idetape_block_ops; | 3765 | g->fops = &idetape_block_ops; |
3766 | ide_register_region(g); | 3766 | ide_register_region(g); |
3767 | 3767 | ||
3768 | printk(KERN_WARNING "It is possible that this driver does not have any" | ||
3769 | " users anymore and, as a result, it will be REMOVED soon." | ||
3770 | " Please notify Bart <bzolnier@gmail.com> or Boris" | ||
3771 | " <petkovbb@gmail.com> in case you still need it.\n"); | ||
3772 | |||
3773 | return 0; | 3768 | return 0; |
3774 | 3769 | ||
3775 | out_free_tape: | 3770 | out_free_tape: |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 0518a2e948cf..4c86a8d84b4c 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -423,6 +423,25 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) | |||
423 | } | 423 | } |
424 | 424 | ||
425 | /* | 425 | /* |
426 | * We got an interrupt on a task_in case, but no errors and no DRQ. | ||
427 | * | ||
428 | * It might be a spurious irq (shared irq), but it might be a | ||
429 | * command that had no output. | ||
430 | */ | ||
431 | static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq, u8 stat) | ||
432 | { | ||
433 | /* Command all done? */ | ||
434 | if (OK_STAT(stat, READY_STAT, BUSY_STAT)) { | ||
435 | task_end_request(drive, rq, stat); | ||
436 | return ide_stopped; | ||
437 | } | ||
438 | |||
439 | /* Assume it was a spurious irq */ | ||
440 | ide_set_handler(drive, &task_in_intr, WAIT_WORSTCASE, NULL); | ||
441 | return ide_started; | ||
442 | } | ||
443 | |||
444 | /* | ||
426 | * Handler for command with PIO data-in phase (Read/Read Multiple). | 445 | * Handler for command with PIO data-in phase (Read/Read Multiple). |
427 | */ | 446 | */ |
428 | static ide_startstop_t task_in_intr(ide_drive_t *drive) | 447 | static ide_startstop_t task_in_intr(ide_drive_t *drive) |
@@ -431,18 +450,17 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive) | |||
431 | struct request *rq = HWGROUP(drive)->rq; | 450 | struct request *rq = HWGROUP(drive)->rq; |
432 | u8 stat = ide_read_status(drive); | 451 | u8 stat = ide_read_status(drive); |
433 | 452 | ||
434 | /* new way for dealing with premature shared PCI interrupts */ | 453 | /* Error? */ |
435 | if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) { | 454 | if (stat & ERR_STAT) |
436 | if (stat & (ERR_STAT | DRQ_STAT)) | 455 | return task_error(drive, rq, __FUNCTION__, stat); |
437 | return task_error(drive, rq, __FUNCTION__, stat); | 456 | |
438 | /* No data yet, so wait for another IRQ. */ | 457 | /* Didn't want any data? Odd. */ |
439 | ide_set_handler(drive, &task_in_intr, WAIT_WORSTCASE, NULL); | 458 | if (!(stat & DRQ_STAT)) |
440 | return ide_started; | 459 | return task_in_unexpected(drive, rq, stat); |
441 | } | ||
442 | 460 | ||
443 | ide_pio_datablock(drive, rq, 0); | 461 | ide_pio_datablock(drive, rq, 0); |
444 | 462 | ||
445 | /* If it was the last datablock check status and finish transfer. */ | 463 | /* Are we done? Check status and finish transfer. */ |
446 | if (!hwif->nleft) { | 464 | if (!hwif->nleft) { |
447 | stat = wait_drive_not_busy(drive); | 465 | stat = wait_drive_not_busy(drive); |
448 | if (!OK_STAT(stat, 0, BAD_STAT)) | 466 | if (!OK_STAT(stat, 0, BAD_STAT)) |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 9976f9d627d4..fc69fe2e3ec0 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -1258,7 +1258,7 @@ static int __init ide_setup(char *s) | |||
1258 | drive = &hwif->drives[unit]; | 1258 | drive = &hwif->drives[unit]; |
1259 | if (strncmp(s + 4, "ide-", 4) == 0) { | 1259 | if (strncmp(s + 4, "ide-", 4) == 0) { |
1260 | strlcpy(drive->driver_req, s + 4, sizeof(drive->driver_req)); | 1260 | strlcpy(drive->driver_req, s + 4, sizeof(drive->driver_req)); |
1261 | goto done; | 1261 | goto obsolete_option; |
1262 | } | 1262 | } |
1263 | switch (match_parm(&s[3], hd_words, vals, 3)) { | 1263 | switch (match_parm(&s[3], hd_words, vals, 3)) { |
1264 | case -1: /* "none" */ | 1264 | case -1: /* "none" */ |
@@ -1290,13 +1290,13 @@ static int __init ide_setup(char *s) | |||
1290 | goto done; | 1290 | goto done; |
1291 | case -12: /* "remap" */ | 1291 | case -12: /* "remap" */ |
1292 | drive->remap_0_to_1 = 1; | 1292 | drive->remap_0_to_1 = 1; |
1293 | goto done; | 1293 | goto obsolete_option; |
1294 | case -13: /* "remap63" */ | 1294 | case -13: /* "remap63" */ |
1295 | drive->sect0 = 63; | 1295 | drive->sect0 = 63; |
1296 | goto done; | 1296 | goto obsolete_option; |
1297 | case -14: /* "scsi" */ | 1297 | case -14: /* "scsi" */ |
1298 | drive->scsi = 1; | 1298 | drive->scsi = 1; |
1299 | goto done; | 1299 | goto obsolete_option; |
1300 | case 3: /* cyl,head,sect */ | 1300 | case 3: /* cyl,head,sect */ |
1301 | drive->media = ide_disk; | 1301 | drive->media = ide_disk; |
1302 | drive->ready_stat = READY_STAT; | 1302 | drive->ready_stat = READY_STAT; |
@@ -1370,32 +1370,32 @@ static int __init ide_setup(char *s) | |||
1370 | #ifdef CONFIG_BLK_DEV_ALI14XX | 1370 | #ifdef CONFIG_BLK_DEV_ALI14XX |
1371 | case -17: /* "ali14xx" */ | 1371 | case -17: /* "ali14xx" */ |
1372 | probe_ali14xx = 1; | 1372 | probe_ali14xx = 1; |
1373 | goto done; | 1373 | goto obsolete_option; |
1374 | #endif | 1374 | #endif |
1375 | #ifdef CONFIG_BLK_DEV_UMC8672 | 1375 | #ifdef CONFIG_BLK_DEV_UMC8672 |
1376 | case -16: /* "umc8672" */ | 1376 | case -16: /* "umc8672" */ |
1377 | probe_umc8672 = 1; | 1377 | probe_umc8672 = 1; |
1378 | goto done; | 1378 | goto obsolete_option; |
1379 | #endif | 1379 | #endif |
1380 | #ifdef CONFIG_BLK_DEV_DTC2278 | 1380 | #ifdef CONFIG_BLK_DEV_DTC2278 |
1381 | case -15: /* "dtc2278" */ | 1381 | case -15: /* "dtc2278" */ |
1382 | probe_dtc2278 = 1; | 1382 | probe_dtc2278 = 1; |
1383 | goto done; | 1383 | goto obsolete_option; |
1384 | #endif | 1384 | #endif |
1385 | #ifdef CONFIG_BLK_DEV_CMD640 | 1385 | #ifdef CONFIG_BLK_DEV_CMD640 |
1386 | case -14: /* "cmd640_vlb" */ | 1386 | case -14: /* "cmd640_vlb" */ |
1387 | cmd640_vlb = 1; | 1387 | cmd640_vlb = 1; |
1388 | goto done; | 1388 | goto obsolete_option; |
1389 | #endif | 1389 | #endif |
1390 | #ifdef CONFIG_BLK_DEV_HT6560B | 1390 | #ifdef CONFIG_BLK_DEV_HT6560B |
1391 | case -13: /* "ht6560b" */ | 1391 | case -13: /* "ht6560b" */ |
1392 | probe_ht6560b = 1; | 1392 | probe_ht6560b = 1; |
1393 | goto done; | 1393 | goto obsolete_option; |
1394 | #endif | 1394 | #endif |
1395 | #ifdef CONFIG_BLK_DEV_QD65XX | 1395 | #ifdef CONFIG_BLK_DEV_QD65XX |
1396 | case -12: /* "qd65xx" */ | 1396 | case -12: /* "qd65xx" */ |
1397 | probe_qd65xx = 1; | 1397 | probe_qd65xx = 1; |
1398 | goto done; | 1398 | goto obsolete_option; |
1399 | #endif | 1399 | #endif |
1400 | #ifdef CONFIG_BLK_DEV_4DRIVES | 1400 | #ifdef CONFIG_BLK_DEV_4DRIVES |
1401 | case -11: /* "four" drives on one set of ports */ | 1401 | case -11: /* "four" drives on one set of ports */ |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 9e2b1964d71a..f53f72daae34 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -376,6 +376,11 @@ static const struct { | |||
376 | .model_id = SBP2_ROM_VALUE_WILDCARD, | 376 | .model_id = SBP2_ROM_VALUE_WILDCARD, |
377 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | 377 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, |
378 | }, | 378 | }, |
379 | /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ { | ||
380 | .firmware_revision = 0x002600, | ||
381 | .model_id = SBP2_ROM_VALUE_WILDCARD, | ||
382 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | ||
383 | }, | ||
379 | /* iPod 4th generation */ { | 384 | /* iPod 4th generation */ { |
380 | .firmware_revision = 0x0a2700, | 385 | .firmware_revision = 0x0a2700, |
381 | .model_id = 0x000021, | 386 | .model_id = 0x000021, |
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index a58ad8a470f9..781ea5950373 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -154,7 +154,7 @@ static void addr_send_arp(struct sockaddr_in *dst_in) | |||
154 | { | 154 | { |
155 | struct rtable *rt; | 155 | struct rtable *rt; |
156 | struct flowi fl; | 156 | struct flowi fl; |
157 | u32 dst_ip = dst_in->sin_addr.s_addr; | 157 | __be32 dst_ip = dst_in->sin_addr.s_addr; |
158 | 158 | ||
159 | memset(&fl, 0, sizeof fl); | 159 | memset(&fl, 0, sizeof fl); |
160 | fl.nl_u.ip4_u.daddr = dst_ip; | 160 | fl.nl_u.ip4_u.daddr = dst_ip; |
@@ -169,8 +169,8 @@ static int addr_resolve_remote(struct sockaddr_in *src_in, | |||
169 | struct sockaddr_in *dst_in, | 169 | struct sockaddr_in *dst_in, |
170 | struct rdma_dev_addr *addr) | 170 | struct rdma_dev_addr *addr) |
171 | { | 171 | { |
172 | u32 src_ip = src_in->sin_addr.s_addr; | 172 | __be32 src_ip = src_in->sin_addr.s_addr; |
173 | u32 dst_ip = dst_in->sin_addr.s_addr; | 173 | __be32 dst_ip = dst_in->sin_addr.s_addr; |
174 | struct flowi fl; | 174 | struct flowi fl; |
175 | struct rtable *rt; | 175 | struct rtable *rt; |
176 | struct neighbour *neigh; | 176 | struct neighbour *neigh; |
@@ -257,7 +257,7 @@ static int addr_resolve_local(struct sockaddr_in *src_in, | |||
257 | struct rdma_dev_addr *addr) | 257 | struct rdma_dev_addr *addr) |
258 | { | 258 | { |
259 | struct net_device *dev; | 259 | struct net_device *dev; |
260 | u32 src_ip = src_in->sin_addr.s_addr; | 260 | __be32 src_ip = src_in->sin_addr.s_addr; |
261 | __be32 dst_ip = dst_in->sin_addr.s_addr; | 261 | __be32 dst_ip = dst_in->sin_addr.s_addr; |
262 | int ret; | 262 | int ret; |
263 | 263 | ||
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 4df405157086..faa7ce318a6d 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -393,7 +393,7 @@ static int cm_alloc_id(struct cm_id_private *cm_id_priv) | |||
393 | spin_unlock_irqrestore(&cm.lock, flags); | 393 | spin_unlock_irqrestore(&cm.lock, flags); |
394 | } while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) ); | 394 | } while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) ); |
395 | 395 | ||
396 | cm_id_priv->id.local_id = (__force __be32) (id ^ cm.random_id_operand); | 396 | cm_id_priv->id.local_id = (__force __be32)id ^ cm.random_id_operand; |
397 | return ret; | 397 | return ret; |
398 | } | 398 | } |
399 | 399 | ||
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 34507daaf9b6..d81c156a22b4 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -168,15 +168,15 @@ struct cma_work { | |||
168 | union cma_ip_addr { | 168 | union cma_ip_addr { |
169 | struct in6_addr ip6; | 169 | struct in6_addr ip6; |
170 | struct { | 170 | struct { |
171 | __u32 pad[3]; | 171 | __be32 pad[3]; |
172 | __u32 addr; | 172 | __be32 addr; |
173 | } ip4; | 173 | } ip4; |
174 | }; | 174 | }; |
175 | 175 | ||
176 | struct cma_hdr { | 176 | struct cma_hdr { |
177 | u8 cma_version; | 177 | u8 cma_version; |
178 | u8 ip_version; /* IP version: 7:4 */ | 178 | u8 ip_version; /* IP version: 7:4 */ |
179 | __u16 port; | 179 | __be16 port; |
180 | union cma_ip_addr src_addr; | 180 | union cma_ip_addr src_addr; |
181 | union cma_ip_addr dst_addr; | 181 | union cma_ip_addr dst_addr; |
182 | }; | 182 | }; |
@@ -186,8 +186,8 @@ struct sdp_hh { | |||
186 | u8 sdp_version; /* Major version: 7:4 */ | 186 | u8 sdp_version; /* Major version: 7:4 */ |
187 | u8 ip_version; /* IP version: 7:4 */ | 187 | u8 ip_version; /* IP version: 7:4 */ |
188 | u8 sdp_specific1[10]; | 188 | u8 sdp_specific1[10]; |
189 | __u16 port; | 189 | __be16 port; |
190 | __u16 sdp_specific2; | 190 | __be16 sdp_specific2; |
191 | union cma_ip_addr src_addr; | 191 | union cma_ip_addr src_addr; |
192 | union cma_ip_addr dst_addr; | 192 | union cma_ip_addr dst_addr; |
193 | }; | 193 | }; |
@@ -663,7 +663,7 @@ static inline int cma_any_port(struct sockaddr *addr) | |||
663 | } | 663 | } |
664 | 664 | ||
665 | static int cma_get_net_info(void *hdr, enum rdma_port_space ps, | 665 | static int cma_get_net_info(void *hdr, enum rdma_port_space ps, |
666 | u8 *ip_ver, __u16 *port, | 666 | u8 *ip_ver, __be16 *port, |
667 | union cma_ip_addr **src, union cma_ip_addr **dst) | 667 | union cma_ip_addr **src, union cma_ip_addr **dst) |
668 | { | 668 | { |
669 | switch (ps) { | 669 | switch (ps) { |
@@ -695,7 +695,7 @@ static int cma_get_net_info(void *hdr, enum rdma_port_space ps, | |||
695 | 695 | ||
696 | static void cma_save_net_info(struct rdma_addr *addr, | 696 | static void cma_save_net_info(struct rdma_addr *addr, |
697 | struct rdma_addr *listen_addr, | 697 | struct rdma_addr *listen_addr, |
698 | u8 ip_ver, __u16 port, | 698 | u8 ip_ver, __be16 port, |
699 | union cma_ip_addr *src, union cma_ip_addr *dst) | 699 | union cma_ip_addr *src, union cma_ip_addr *dst) |
700 | { | 700 | { |
701 | struct sockaddr_in *listen4, *ip4; | 701 | struct sockaddr_in *listen4, *ip4; |
@@ -996,7 +996,7 @@ static struct rdma_id_private *cma_new_conn_id(struct rdma_cm_id *listen_id, | |||
996 | struct rdma_cm_id *id; | 996 | struct rdma_cm_id *id; |
997 | struct rdma_route *rt; | 997 | struct rdma_route *rt; |
998 | union cma_ip_addr *src, *dst; | 998 | union cma_ip_addr *src, *dst; |
999 | __u16 port; | 999 | __be16 port; |
1000 | u8 ip_ver; | 1000 | u8 ip_ver; |
1001 | 1001 | ||
1002 | if (cma_get_net_info(ib_event->private_data, listen_id->ps, | 1002 | if (cma_get_net_info(ib_event->private_data, listen_id->ps, |
@@ -1043,7 +1043,7 @@ static struct rdma_id_private *cma_new_udp_id(struct rdma_cm_id *listen_id, | |||
1043 | struct rdma_id_private *id_priv; | 1043 | struct rdma_id_private *id_priv; |
1044 | struct rdma_cm_id *id; | 1044 | struct rdma_cm_id *id; |
1045 | union cma_ip_addr *src, *dst; | 1045 | union cma_ip_addr *src, *dst; |
1046 | __u16 port; | 1046 | __be16 port; |
1047 | u8 ip_ver; | 1047 | u8 ip_ver; |
1048 | int ret; | 1048 | int ret; |
1049 | 1049 | ||
@@ -1165,7 +1165,7 @@ static void cma_set_compare_data(enum rdma_port_space ps, struct sockaddr *addr, | |||
1165 | { | 1165 | { |
1166 | struct cma_hdr *cma_data, *cma_mask; | 1166 | struct cma_hdr *cma_data, *cma_mask; |
1167 | struct sdp_hh *sdp_data, *sdp_mask; | 1167 | struct sdp_hh *sdp_data, *sdp_mask; |
1168 | __u32 ip4_addr; | 1168 | __be32 ip4_addr; |
1169 | struct in6_addr ip6_addr; | 1169 | struct in6_addr ip6_addr; |
1170 | 1170 | ||
1171 | memset(compare, 0, sizeof *compare); | 1171 | memset(compare, 0, sizeof *compare); |
@@ -1181,12 +1181,12 @@ static void cma_set_compare_data(enum rdma_port_space ps, struct sockaddr *addr, | |||
1181 | sdp_set_ip_ver(sdp_data, 4); | 1181 | sdp_set_ip_ver(sdp_data, 4); |
1182 | sdp_set_ip_ver(sdp_mask, 0xF); | 1182 | sdp_set_ip_ver(sdp_mask, 0xF); |
1183 | sdp_data->dst_addr.ip4.addr = ip4_addr; | 1183 | sdp_data->dst_addr.ip4.addr = ip4_addr; |
1184 | sdp_mask->dst_addr.ip4.addr = ~0; | 1184 | sdp_mask->dst_addr.ip4.addr = htonl(~0); |
1185 | } else { | 1185 | } else { |
1186 | cma_set_ip_ver(cma_data, 4); | 1186 | cma_set_ip_ver(cma_data, 4); |
1187 | cma_set_ip_ver(cma_mask, 0xF); | 1187 | cma_set_ip_ver(cma_mask, 0xF); |
1188 | cma_data->dst_addr.ip4.addr = ip4_addr; | 1188 | cma_data->dst_addr.ip4.addr = ip4_addr; |
1189 | cma_mask->dst_addr.ip4.addr = ~0; | 1189 | cma_mask->dst_addr.ip4.addr = htonl(~0); |
1190 | } | 1190 | } |
1191 | break; | 1191 | break; |
1192 | case AF_INET6: | 1192 | case AF_INET6: |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index 320f2b6ddee6..99f2f2a46bf7 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -1745,7 +1745,7 @@ int iwch_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
1745 | 1745 | ||
1746 | /* bind QP to EP and move to RTS */ | 1746 | /* bind QP to EP and move to RTS */ |
1747 | attrs.mpa_attr = ep->mpa_attr; | 1747 | attrs.mpa_attr = ep->mpa_attr; |
1748 | attrs.max_ird = ep->ord; | 1748 | attrs.max_ird = ep->ird; |
1749 | attrs.max_ord = ep->ord; | 1749 | attrs.max_ord = ep->ord; |
1750 | attrs.llp_stream_handle = ep; | 1750 | attrs.llp_stream_handle = ep; |
1751 | attrs.next_state = IWCH_QP_STATE_RTS; | 1751 | attrs.next_state = IWCH_QP_STATE_RTS; |
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h index 414621095540..591901aab6b7 100644 --- a/drivers/infiniband/hw/ipath/ipath_common.h +++ b/drivers/infiniband/hw/ipath/ipath_common.h | |||
@@ -75,7 +75,7 @@ | |||
75 | #define IPATH_IB_LINKDOWN 0 | 75 | #define IPATH_IB_LINKDOWN 0 |
76 | #define IPATH_IB_LINKARM 1 | 76 | #define IPATH_IB_LINKARM 1 |
77 | #define IPATH_IB_LINKACTIVE 2 | 77 | #define IPATH_IB_LINKACTIVE 2 |
78 | #define IPATH_IB_LINKINIT 3 | 78 | #define IPATH_IB_LINKDOWN_ONLY 3 |
79 | #define IPATH_IB_LINKDOWN_SLEEP 4 | 79 | #define IPATH_IB_LINKDOWN_SLEEP 4 |
80 | #define IPATH_IB_LINKDOWN_DISABLE 5 | 80 | #define IPATH_IB_LINKDOWN_DISABLE 5 |
81 | #define IPATH_IB_LINK_LOOPBACK 6 /* enable local loopback */ | 81 | #define IPATH_IB_LINK_LOOPBACK 6 /* enable local loopback */ |
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index d5ff6ca2db30..ca4d0acc6786 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -851,8 +851,7 @@ void ipath_disarm_piobufs(struct ipath_devdata *dd, unsigned first, | |||
851 | * -ETIMEDOUT state can have multiple states set, for any of several | 851 | * -ETIMEDOUT state can have multiple states set, for any of several |
852 | * transitions. | 852 | * transitions. |
853 | */ | 853 | */ |
854 | static int ipath_wait_linkstate(struct ipath_devdata *dd, u32 state, | 854 | int ipath_wait_linkstate(struct ipath_devdata *dd, u32 state, int msecs) |
855 | int msecs) | ||
856 | { | 855 | { |
857 | dd->ipath_state_wanted = state; | 856 | dd->ipath_state_wanted = state; |
858 | wait_event_interruptible_timeout(ipath_state_wait, | 857 | wait_event_interruptible_timeout(ipath_state_wait, |
@@ -1656,8 +1655,8 @@ void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) | |||
1656 | static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which) | 1655 | static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which) |
1657 | { | 1656 | { |
1658 | static const char *what[4] = { | 1657 | static const char *what[4] = { |
1659 | [0] = "DOWN", | 1658 | [0] = "NOP", |
1660 | [INFINIPATH_IBCC_LINKCMD_INIT] = "INIT", | 1659 | [INFINIPATH_IBCC_LINKCMD_DOWN] = "DOWN", |
1661 | [INFINIPATH_IBCC_LINKCMD_ARMED] = "ARMED", | 1660 | [INFINIPATH_IBCC_LINKCMD_ARMED] = "ARMED", |
1662 | [INFINIPATH_IBCC_LINKCMD_ACTIVE] = "ACTIVE" | 1661 | [INFINIPATH_IBCC_LINKCMD_ACTIVE] = "ACTIVE" |
1663 | }; | 1662 | }; |
@@ -1672,9 +1671,9 @@ static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which) | |||
1672 | (dd, dd->ipath_kregs->kr_ibcstatus) >> | 1671 | (dd, dd->ipath_kregs->kr_ibcstatus) >> |
1673 | INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) & | 1672 | INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) & |
1674 | INFINIPATH_IBCS_LINKTRAININGSTATE_MASK]); | 1673 | INFINIPATH_IBCS_LINKTRAININGSTATE_MASK]); |
1675 | /* flush all queued sends when going to DOWN or INIT, to be sure that | 1674 | /* flush all queued sends when going to DOWN to be sure that |
1676 | * they don't block MAD packets */ | 1675 | * they don't block MAD packets */ |
1677 | if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT) | 1676 | if (linkcmd == INFINIPATH_IBCC_LINKCMD_DOWN) |
1678 | ipath_cancel_sends(dd, 1); | 1677 | ipath_cancel_sends(dd, 1); |
1679 | 1678 | ||
1680 | ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, | 1679 | ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, |
@@ -1687,6 +1686,13 @@ int ipath_set_linkstate(struct ipath_devdata *dd, u8 newstate) | |||
1687 | int ret; | 1686 | int ret; |
1688 | 1687 | ||
1689 | switch (newstate) { | 1688 | switch (newstate) { |
1689 | case IPATH_IB_LINKDOWN_ONLY: | ||
1690 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKCMD_DOWN << | ||
1691 | INFINIPATH_IBCC_LINKCMD_SHIFT); | ||
1692 | /* don't wait */ | ||
1693 | ret = 0; | ||
1694 | goto bail; | ||
1695 | |||
1690 | case IPATH_IB_LINKDOWN: | 1696 | case IPATH_IB_LINKDOWN: |
1691 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_POLL << | 1697 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_POLL << |
1692 | INFINIPATH_IBCC_LINKINITCMD_SHIFT); | 1698 | INFINIPATH_IBCC_LINKINITCMD_SHIFT); |
@@ -1709,16 +1715,6 @@ int ipath_set_linkstate(struct ipath_devdata *dd, u8 newstate) | |||
1709 | ret = 0; | 1715 | ret = 0; |
1710 | goto bail; | 1716 | goto bail; |
1711 | 1717 | ||
1712 | case IPATH_IB_LINKINIT: | ||
1713 | if (dd->ipath_flags & IPATH_LINKINIT) { | ||
1714 | ret = 0; | ||
1715 | goto bail; | ||
1716 | } | ||
1717 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKCMD_INIT << | ||
1718 | INFINIPATH_IBCC_LINKCMD_SHIFT); | ||
1719 | lstate = IPATH_LINKINIT; | ||
1720 | break; | ||
1721 | |||
1722 | case IPATH_IB_LINKARM: | 1718 | case IPATH_IB_LINKARM: |
1723 | if (dd->ipath_flags & IPATH_LINKARMED) { | 1719 | if (dd->ipath_flags & IPATH_LINKARMED) { |
1724 | ret = 0; | 1720 | ret = 0; |
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index 4cc0f95ea877..ecf3f7ff7717 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -767,6 +767,7 @@ void ipath_kreceive(struct ipath_portdata *); | |||
767 | int ipath_setrcvhdrsize(struct ipath_devdata *, unsigned); | 767 | int ipath_setrcvhdrsize(struct ipath_devdata *, unsigned); |
768 | int ipath_reset_device(int); | 768 | int ipath_reset_device(int); |
769 | void ipath_get_faststats(unsigned long); | 769 | void ipath_get_faststats(unsigned long); |
770 | int ipath_wait_linkstate(struct ipath_devdata *, u32, int); | ||
770 | int ipath_set_linkstate(struct ipath_devdata *, u8); | 771 | int ipath_set_linkstate(struct ipath_devdata *, u8); |
771 | int ipath_set_mtu(struct ipath_devdata *, u16); | 772 | int ipath_set_mtu(struct ipath_devdata *, u16); |
772 | int ipath_set_lid(struct ipath_devdata *, u32, u8); | 773 | int ipath_set_lid(struct ipath_devdata *, u32, u8); |
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c index d98d5f103700..b34b91d3723a 100644 --- a/drivers/infiniband/hw/ipath/ipath_mad.c +++ b/drivers/infiniband/hw/ipath/ipath_mad.c | |||
@@ -555,10 +555,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
555 | /* FALLTHROUGH */ | 555 | /* FALLTHROUGH */ |
556 | case IB_PORT_DOWN: | 556 | case IB_PORT_DOWN: |
557 | if (lstate == 0) | 557 | if (lstate == 0) |
558 | if (get_linkdowndefaultstate(dd)) | 558 | lstate = IPATH_IB_LINKDOWN_ONLY; |
559 | lstate = IPATH_IB_LINKDOWN_SLEEP; | ||
560 | else | ||
561 | lstate = IPATH_IB_LINKDOWN; | ||
562 | else if (lstate == 1) | 559 | else if (lstate == 1) |
563 | lstate = IPATH_IB_LINKDOWN_SLEEP; | 560 | lstate = IPATH_IB_LINKDOWN_SLEEP; |
564 | else if (lstate == 2) | 561 | else if (lstate == 2) |
@@ -568,6 +565,8 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
568 | else | 565 | else |
569 | goto err; | 566 | goto err; |
570 | ipath_set_linkstate(dd, lstate); | 567 | ipath_set_linkstate(dd, lstate); |
568 | ipath_wait_linkstate(dd, IPATH_LINKINIT | IPATH_LINKARMED | | ||
569 | IPATH_LINKACTIVE, 1000); | ||
571 | break; | 570 | break; |
572 | case IB_PORT_ARMED: | 571 | case IB_PORT_ARMED: |
573 | ipath_set_linkstate(dd, IPATH_IB_LINKARM); | 572 | ipath_set_linkstate(dd, IPATH_IB_LINKARM); |
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 80dc623cee40..087ed3166479 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c | |||
@@ -329,8 +329,9 @@ struct ipath_qp *ipath_lookup_qpn(struct ipath_qp_table *qpt, u32 qpn) | |||
329 | /** | 329 | /** |
330 | * ipath_reset_qp - initialize the QP state to the reset state | 330 | * ipath_reset_qp - initialize the QP state to the reset state |
331 | * @qp: the QP to reset | 331 | * @qp: the QP to reset |
332 | * @type: the QP type | ||
332 | */ | 333 | */ |
333 | static void ipath_reset_qp(struct ipath_qp *qp) | 334 | static void ipath_reset_qp(struct ipath_qp *qp, enum ib_qp_type type) |
334 | { | 335 | { |
335 | qp->remote_qpn = 0; | 336 | qp->remote_qpn = 0; |
336 | qp->qkey = 0; | 337 | qp->qkey = 0; |
@@ -342,7 +343,7 @@ static void ipath_reset_qp(struct ipath_qp *qp) | |||
342 | qp->s_psn = 0; | 343 | qp->s_psn = 0; |
343 | qp->r_psn = 0; | 344 | qp->r_psn = 0; |
344 | qp->r_msn = 0; | 345 | qp->r_msn = 0; |
345 | if (qp->ibqp.qp_type == IB_QPT_RC) { | 346 | if (type == IB_QPT_RC) { |
346 | qp->s_state = IB_OPCODE_RC_SEND_LAST; | 347 | qp->s_state = IB_OPCODE_RC_SEND_LAST; |
347 | qp->r_state = IB_OPCODE_RC_SEND_LAST; | 348 | qp->r_state = IB_OPCODE_RC_SEND_LAST; |
348 | } else { | 349 | } else { |
@@ -414,7 +415,7 @@ int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err) | |||
414 | wc.wr_id = qp->r_wr_id; | 415 | wc.wr_id = qp->r_wr_id; |
415 | wc.opcode = IB_WC_RECV; | 416 | wc.opcode = IB_WC_RECV; |
416 | wc.status = err; | 417 | wc.status = err; |
417 | ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1); | 418 | ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1); |
418 | } | 419 | } |
419 | wc.status = IB_WC_WR_FLUSH_ERR; | 420 | wc.status = IB_WC_WR_FLUSH_ERR; |
420 | 421 | ||
@@ -534,7 +535,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
534 | 535 | ||
535 | switch (new_state) { | 536 | switch (new_state) { |
536 | case IB_QPS_RESET: | 537 | case IB_QPS_RESET: |
537 | ipath_reset_qp(qp); | 538 | ipath_reset_qp(qp, ibqp->qp_type); |
538 | break; | 539 | break; |
539 | 540 | ||
540 | case IB_QPS_ERR: | 541 | case IB_QPS_ERR: |
@@ -647,7 +648,7 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
647 | attr->port_num = 1; | 648 | attr->port_num = 1; |
648 | attr->timeout = qp->timeout; | 649 | attr->timeout = qp->timeout; |
649 | attr->retry_cnt = qp->s_retry_cnt; | 650 | attr->retry_cnt = qp->s_retry_cnt; |
650 | attr->rnr_retry = qp->s_rnr_retry; | 651 | attr->rnr_retry = qp->s_rnr_retry_cnt; |
651 | attr->alt_port_num = 0; | 652 | attr->alt_port_num = 0; |
652 | attr->alt_timeout = 0; | 653 | attr->alt_timeout = 0; |
653 | 654 | ||
@@ -839,7 +840,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
839 | goto bail_qp; | 840 | goto bail_qp; |
840 | } | 841 | } |
841 | qp->ip = NULL; | 842 | qp->ip = NULL; |
842 | ipath_reset_qp(qp); | 843 | ipath_reset_qp(qp, init_attr->qp_type); |
843 | break; | 844 | break; |
844 | 845 | ||
845 | default: | 846 | default: |
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c index 459e46e2c016..40f3e37d7adc 100644 --- a/drivers/infiniband/hw/ipath/ipath_rc.c +++ b/drivers/infiniband/hw/ipath/ipath_rc.c | |||
@@ -1196,6 +1196,10 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev, | |||
1196 | list_move_tail(&qp->timerwait, | 1196 | list_move_tail(&qp->timerwait, |
1197 | &dev->pending[dev->pending_index]); | 1197 | &dev->pending[dev->pending_index]); |
1198 | spin_unlock(&dev->pending_lock); | 1198 | spin_unlock(&dev->pending_lock); |
1199 | |||
1200 | if (opcode == OP(RDMA_READ_RESPONSE_MIDDLE)) | ||
1201 | qp->s_retry = qp->s_retry_cnt; | ||
1202 | |||
1199 | /* | 1203 | /* |
1200 | * Update the RDMA receive state but do the copy w/o | 1204 | * Update the RDMA receive state but do the copy w/o |
1201 | * holding the locks and blocking interrupts. | 1205 | * holding the locks and blocking interrupts. |
diff --git a/drivers/infiniband/hw/ipath/ipath_registers.h b/drivers/infiniband/hw/ipath/ipath_registers.h index 6d2a17f9c1da..92ad73a7fff0 100644 --- a/drivers/infiniband/hw/ipath/ipath_registers.h +++ b/drivers/infiniband/hw/ipath/ipath_registers.h | |||
@@ -185,7 +185,7 @@ | |||
185 | #define INFINIPATH_IBCC_LINKINITCMD_SLEEP 3 | 185 | #define INFINIPATH_IBCC_LINKINITCMD_SLEEP 3 |
186 | #define INFINIPATH_IBCC_LINKINITCMD_SHIFT 16 | 186 | #define INFINIPATH_IBCC_LINKINITCMD_SHIFT 16 |
187 | #define INFINIPATH_IBCC_LINKCMD_MASK 0x3ULL | 187 | #define INFINIPATH_IBCC_LINKCMD_MASK 0x3ULL |
188 | #define INFINIPATH_IBCC_LINKCMD_INIT 1 /* move to 0x11 */ | 188 | #define INFINIPATH_IBCC_LINKCMD_DOWN 1 /* move to 0x11 */ |
189 | #define INFINIPATH_IBCC_LINKCMD_ARMED 2 /* move to 0x21 */ | 189 | #define INFINIPATH_IBCC_LINKCMD_ARMED 2 /* move to 0x21 */ |
190 | #define INFINIPATH_IBCC_LINKCMD_ACTIVE 3 /* move to 0x31 */ | 190 | #define INFINIPATH_IBCC_LINKCMD_ACTIVE 3 /* move to 0x31 */ |
191 | #define INFINIPATH_IBCC_LINKCMD_SHIFT 18 | 191 | #define INFINIPATH_IBCC_LINKCMD_SHIFT 18 |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 39adb267fb15..0bef878e0f65 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/tcp.h> | 40 | #include <linux/tcp.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/if_arp.h> | 42 | #include <linux/if_arp.h> |
43 | #include <linux/if_vlan.h> | ||
43 | #include <linux/notifier.h> | 44 | #include <linux/notifier.h> |
44 | #include <linux/net.h> | 45 | #include <linux/net.h> |
45 | #include <linux/types.h> | 46 | #include <linux/types.h> |
@@ -1072,7 +1073,7 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core, | |||
1072 | ts = current_kernel_time(); | 1073 | ts = current_kernel_time(); |
1073 | cm_node->tcp_cntxt.loc_seq_num = htonl(ts.tv_nsec); | 1074 | cm_node->tcp_cntxt.loc_seq_num = htonl(ts.tv_nsec); |
1074 | cm_node->tcp_cntxt.mss = nesvnic->max_frame_size - sizeof(struct iphdr) - | 1075 | cm_node->tcp_cntxt.mss = nesvnic->max_frame_size - sizeof(struct iphdr) - |
1075 | sizeof(struct tcphdr) - ETH_HLEN; | 1076 | sizeof(struct tcphdr) - ETH_HLEN - VLAN_HLEN; |
1076 | cm_node->tcp_cntxt.rcv_nxt = 0; | 1077 | cm_node->tcp_cntxt.rcv_nxt = 0; |
1077 | /* get a unique session ID , add thread_id to an upcounter to handle race */ | 1078 | /* get a unique session ID , add thread_id to an upcounter to handle race */ |
1078 | atomic_inc(&cm_core->node_cnt); | 1079 | atomic_inc(&cm_core->node_cnt); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 52b1bebfa744..2490b2d79dbb 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <net/icmp.h> | 38 | #include <net/icmp.h> |
39 | #include <linux/icmpv6.h> | 39 | #include <linux/icmpv6.h> |
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/vmalloc.h> | ||
41 | 42 | ||
42 | #include "ipoib.h" | 43 | #include "ipoib.h" |
43 | 44 | ||
@@ -637,6 +638,7 @@ static inline int post_send(struct ipoib_dev_priv *priv, | |||
637 | priv->tx_sge[0].addr = addr; | 638 | priv->tx_sge[0].addr = addr; |
638 | priv->tx_sge[0].length = len; | 639 | priv->tx_sge[0].length = len; |
639 | 640 | ||
641 | priv->tx_wr.num_sge = 1; | ||
640 | priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM; | 642 | priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM; |
641 | 643 | ||
642 | return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr); | 644 | return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr); |
@@ -1030,13 +1032,13 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn, | |||
1030 | struct ipoib_dev_priv *priv = netdev_priv(p->dev); | 1032 | struct ipoib_dev_priv *priv = netdev_priv(p->dev); |
1031 | int ret; | 1033 | int ret; |
1032 | 1034 | ||
1033 | p->tx_ring = kzalloc(ipoib_sendq_size * sizeof *p->tx_ring, | 1035 | p->tx_ring = vmalloc(ipoib_sendq_size * sizeof *p->tx_ring); |
1034 | GFP_KERNEL); | ||
1035 | if (!p->tx_ring) { | 1036 | if (!p->tx_ring) { |
1036 | ipoib_warn(priv, "failed to allocate tx ring\n"); | 1037 | ipoib_warn(priv, "failed to allocate tx ring\n"); |
1037 | ret = -ENOMEM; | 1038 | ret = -ENOMEM; |
1038 | goto err_tx; | 1039 | goto err_tx; |
1039 | } | 1040 | } |
1041 | memset(p->tx_ring, 0, ipoib_sendq_size * sizeof *p->tx_ring); | ||
1040 | 1042 | ||
1041 | p->qp = ipoib_cm_create_tx_qp(p->dev, p); | 1043 | p->qp = ipoib_cm_create_tx_qp(p->dev, p); |
1042 | if (IS_ERR(p->qp)) { | 1044 | if (IS_ERR(p->qp)) { |
@@ -1077,6 +1079,7 @@ err_id: | |||
1077 | ib_destroy_qp(p->qp); | 1079 | ib_destroy_qp(p->qp); |
1078 | err_qp: | 1080 | err_qp: |
1079 | p->qp = NULL; | 1081 | p->qp = NULL; |
1082 | vfree(p->tx_ring); | ||
1080 | err_tx: | 1083 | err_tx: |
1081 | return ret; | 1084 | return ret; |
1082 | } | 1085 | } |
@@ -1127,7 +1130,7 @@ timeout: | |||
1127 | if (p->qp) | 1130 | if (p->qp) |
1128 | ib_destroy_qp(p->qp); | 1131 | ib_destroy_qp(p->qp); |
1129 | 1132 | ||
1130 | kfree(p->tx_ring); | 1133 | vfree(p->tx_ring); |
1131 | kfree(p); | 1134 | kfree(p); |
1132 | } | 1135 | } |
1133 | 1136 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index f96477a8ca5a..57282048865c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
43 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
44 | #include <linux/vmalloc.h> | ||
44 | 45 | ||
45 | #include <linux/if_arp.h> /* For ARPHRD_xxx */ | 46 | #include <linux/if_arp.h> /* For ARPHRD_xxx */ |
46 | 47 | ||
@@ -887,13 +888,13 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port) | |||
887 | goto out; | 888 | goto out; |
888 | } | 889 | } |
889 | 890 | ||
890 | priv->tx_ring = kzalloc(ipoib_sendq_size * sizeof *priv->tx_ring, | 891 | priv->tx_ring = vmalloc(ipoib_sendq_size * sizeof *priv->tx_ring); |
891 | GFP_KERNEL); | ||
892 | if (!priv->tx_ring) { | 892 | if (!priv->tx_ring) { |
893 | printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n", | 893 | printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n", |
894 | ca->name, ipoib_sendq_size); | 894 | ca->name, ipoib_sendq_size); |
895 | goto out_rx_ring_cleanup; | 895 | goto out_rx_ring_cleanup; |
896 | } | 896 | } |
897 | memset(priv->tx_ring, 0, ipoib_sendq_size * sizeof *priv->tx_ring); | ||
897 | 898 | ||
898 | /* priv->tx_head, tx_tail & tx_outstanding are already 0 */ | 899 | /* priv->tx_head, tx_tail & tx_outstanding are already 0 */ |
899 | 900 | ||
@@ -903,7 +904,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port) | |||
903 | return 0; | 904 | return 0; |
904 | 905 | ||
905 | out_tx_ring_cleanup: | 906 | out_tx_ring_cleanup: |
906 | kfree(priv->tx_ring); | 907 | vfree(priv->tx_ring); |
907 | 908 | ||
908 | out_rx_ring_cleanup: | 909 | out_rx_ring_cleanup: |
909 | kfree(priv->rx_ring); | 910 | kfree(priv->rx_ring); |
@@ -928,7 +929,7 @@ void ipoib_dev_cleanup(struct net_device *dev) | |||
928 | ipoib_ib_dev_cleanup(dev); | 929 | ipoib_ib_dev_cleanup(dev); |
929 | 930 | ||
930 | kfree(priv->rx_ring); | 931 | kfree(priv->rx_ring); |
931 | kfree(priv->tx_ring); | 932 | vfree(priv->tx_ring); |
932 | 933 | ||
933 | priv->rx_ring = NULL; | 934 | priv->rx_ring = NULL; |
934 | priv->tx_ring = NULL; | 935 | priv->tx_ring = NULL; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 2628339e3a99..31a53c5bcb13 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -650,7 +650,7 @@ void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb) | |||
650 | */ | 650 | */ |
651 | spin_lock(&priv->lock); | 651 | spin_lock(&priv->lock); |
652 | 652 | ||
653 | if (!test_bit(IPOIB_MCAST_STARTED, &priv->flags) || | 653 | if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags) || |
654 | !priv->broadcast || | 654 | !priv->broadcast || |
655 | !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) { | 655 | !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) { |
656 | ++dev->stats.tx_dropped; | 656 | ++dev->stats.tx_dropped; |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 0727b0a12557..99562cee827e 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -853,6 +853,9 @@ static void evdev_cleanup(struct evdev *evdev) | |||
853 | evdev_hangup(evdev); | 853 | evdev_hangup(evdev); |
854 | evdev_remove_chrdev(evdev); | 854 | evdev_remove_chrdev(evdev); |
855 | 855 | ||
856 | if (evdev->grab) | ||
857 | evdev_ungrab(evdev, evdev->grab); | ||
858 | |||
856 | /* evdev is marked dead so no one else accesses evdev->open */ | 859 | /* evdev is marked dead so no one else accesses evdev->open */ |
857 | if (evdev->open) { | 860 | if (evdev->open) { |
858 | input_flush_device(handle, NULL); | 861 | input_flush_device(handle, NULL); |
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index d2ade7443b7d..798d84c44d03 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c | |||
@@ -25,6 +25,7 @@ | |||
25 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | 25 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); |
26 | MODULE_DESCRIPTION("ixp4xx beeper driver"); | 26 | MODULE_DESCRIPTION("ixp4xx beeper driver"); |
27 | MODULE_LICENSE("GPL"); | 27 | MODULE_LICENSE("GPL"); |
28 | MODULE_ALIAS("platform:ixp4xx-beeper"); | ||
28 | 29 | ||
29 | static DEFINE_SPINLOCK(beep_lock); | 30 | static DEFINE_SPINLOCK(beep_lock); |
30 | 31 | ||
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 9cef6fcf587b..d4ad6992f776 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -981,13 +981,13 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack) | |||
981 | } | 981 | } |
982 | 982 | ||
983 | 983 | ||
984 | static __inline int | 984 | static inline int |
985 | isdn_minor2drv(int minor) | 985 | isdn_minor2drv(int minor) |
986 | { | 986 | { |
987 | return (dev->drvmap[minor]); | 987 | return (dev->drvmap[minor]); |
988 | } | 988 | } |
989 | 989 | ||
990 | static __inline int | 990 | static inline int |
991 | isdn_minor2chan(int minor) | 991 | isdn_minor2chan(int minor) |
992 | { | 992 | { |
993 | return (dev->chanmap[minor]); | 993 | return (dev->chanmap[minor]); |
diff --git a/drivers/isdn/i4l/isdn_v110.c b/drivers/isdn/i4l/isdn_v110.c index 5484d3c38a57..c5d02b6aafab 100644 --- a/drivers/isdn/i4l/isdn_v110.c +++ b/drivers/isdn/i4l/isdn_v110.c | |||
@@ -62,7 +62,7 @@ static unsigned char V110_OffMatrix_38400[] = | |||
62 | * and to 67452301 when keylen = 2. This is necessary because ordering on | 62 | * and to 67452301 when keylen = 2. This is necessary because ordering on |
63 | * the isdn line is the other way. | 63 | * the isdn line is the other way. |
64 | */ | 64 | */ |
65 | static __inline unsigned char | 65 | static inline unsigned char |
66 | FlipBits(unsigned char c, int keylen) | 66 | FlipBits(unsigned char c, int keylen) |
67 | { | 67 | { |
68 | unsigned char b = c; | 68 | unsigned char b = c; |
diff --git a/drivers/lguest/Makefile b/drivers/lguest/Makefile index 5e8272d296d8..7d463c26124f 100644 --- a/drivers/lguest/Makefile +++ b/drivers/lguest/Makefile | |||
@@ -19,3 +19,11 @@ Beer: | |||
19 | @for f in Preparation Guest Drivers Launcher Host Switcher Mastery; do echo "{==- $$f -==}"; make -s $$f; done; echo "{==-==}" | 19 | @for f in Preparation Guest Drivers Launcher Host Switcher Mastery; do echo "{==- $$f -==}"; make -s $$f; done; echo "{==-==}" |
20 | Preparation Preparation! Guest Drivers Launcher Host Switcher Mastery: | 20 | Preparation Preparation! Guest Drivers Launcher Host Switcher Mastery: |
21 | @sh ../../Documentation/lguest/extract $(PREFIX) `find ../../* -name '*.[chS]' -wholename '*lguest*'` | 21 | @sh ../../Documentation/lguest/extract $(PREFIX) `find ../../* -name '*.[chS]' -wholename '*lguest*'` |
22 | Puppy: | ||
23 | @clear | ||
24 | @printf " __ \n (___()'\`;\n /, /\`\n \\\\\\\"--\\\\\\ \n" | ||
25 | @sleep 2; clear; printf "\n\n Sit!\n\n"; sleep 1; clear | ||
26 | @printf " __ \n ()'\`; \n /\\|\` \n / | \n(/_)_|_ \n" | ||
27 | @sleep 2; clear; printf "\n\n Stand!\n\n"; sleep 1; clear | ||
28 | @printf " __ \n ()'\`; \n /\\|\` \n /._.= \n /| / \n(_\_)_ \n" | ||
29 | @sleep 2; clear; printf "\n\n Good puppy!\n\n"; sleep 1; clear | ||
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index c632c08cbbdc..5eea4356d703 100644 --- a/drivers/lguest/core.c +++ b/drivers/lguest/core.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /*P:400 This contains run_guest() which actually calls into the Host<->Guest | 1 | /*P:400 This contains run_guest() which actually calls into the Host<->Guest |
2 | * Switcher and analyzes the return, such as determining if the Guest wants the | 2 | * Switcher and analyzes the return, such as determining if the Guest wants the |
3 | * Host to do something. This file also contains useful helper routines, and a | 3 | * Host to do something. This file also contains useful helper routines. :*/ |
4 | * couple of non-obvious setup and teardown pieces which were implemented after | ||
5 | * days of debugging pain. :*/ | ||
6 | #include <linux/module.h> | 4 | #include <linux/module.h> |
7 | #include <linux/stringify.h> | 5 | #include <linux/stringify.h> |
8 | #include <linux/stddef.h> | 6 | #include <linux/stddef.h> |
@@ -49,8 +47,8 @@ static __init int map_switcher(void) | |||
49 | * easy. | 47 | * easy. |
50 | */ | 48 | */ |
51 | 49 | ||
52 | /* We allocate an array of "struct page"s. map_vm_area() wants the | 50 | /* We allocate an array of struct page pointers. map_vm_area() wants |
53 | * pages in this form, rather than just an array of pointers. */ | 51 | * this, rather than just an array of pages. */ |
54 | switcher_page = kmalloc(sizeof(switcher_page[0])*TOTAL_SWITCHER_PAGES, | 52 | switcher_page = kmalloc(sizeof(switcher_page[0])*TOTAL_SWITCHER_PAGES, |
55 | GFP_KERNEL); | 53 | GFP_KERNEL); |
56 | if (!switcher_page) { | 54 | if (!switcher_page) { |
@@ -172,7 +170,7 @@ void __lgread(struct lg_cpu *cpu, void *b, unsigned long addr, unsigned bytes) | |||
172 | } | 170 | } |
173 | } | 171 | } |
174 | 172 | ||
175 | /* This is the write (copy into guest) version. */ | 173 | /* This is the write (copy into Guest) version. */ |
176 | void __lgwrite(struct lg_cpu *cpu, unsigned long addr, const void *b, | 174 | void __lgwrite(struct lg_cpu *cpu, unsigned long addr, const void *b, |
177 | unsigned bytes) | 175 | unsigned bytes) |
178 | { | 176 | { |
@@ -209,9 +207,9 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user) | |||
209 | if (cpu->break_out) | 207 | if (cpu->break_out) |
210 | return -EAGAIN; | 208 | return -EAGAIN; |
211 | 209 | ||
212 | /* Check if there are any interrupts which can be delivered | 210 | /* Check if there are any interrupts which can be delivered now: |
213 | * now: if so, this sets up the hander to be executed when we | 211 | * if so, this sets up the hander to be executed when we next |
214 | * next run the Guest. */ | 212 | * run the Guest. */ |
215 | maybe_do_interrupt(cpu); | 213 | maybe_do_interrupt(cpu); |
216 | 214 | ||
217 | /* All long-lived kernel loops need to check with this horrible | 215 | /* All long-lived kernel loops need to check with this horrible |
@@ -246,8 +244,10 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user) | |||
246 | lguest_arch_handle_trap(cpu); | 244 | lguest_arch_handle_trap(cpu); |
247 | } | 245 | } |
248 | 246 | ||
247 | /* Special case: Guest is 'dead' but wants a reboot. */ | ||
249 | if (cpu->lg->dead == ERR_PTR(-ERESTART)) | 248 | if (cpu->lg->dead == ERR_PTR(-ERESTART)) |
250 | return -ERESTART; | 249 | return -ERESTART; |
250 | |||
251 | /* The Guest is dead => "No such file or directory" */ | 251 | /* The Guest is dead => "No such file or directory" */ |
252 | return -ENOENT; | 252 | return -ENOENT; |
253 | } | 253 | } |
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c index 0f2cb4fd7c69..54d66f05fefa 100644 --- a/drivers/lguest/hypercalls.c +++ b/drivers/lguest/hypercalls.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "lg.h" | 29 | #include "lg.h" |
30 | 30 | ||
31 | /*H:120 This is the core hypercall routine: where the Guest gets what it wants. | 31 | /*H:120 This is the core hypercall routine: where the Guest gets what it wants. |
32 | * Or gets killed. Or, in the case of LHCALL_CRASH, both. */ | 32 | * Or gets killed. Or, in the case of LHCALL_SHUTDOWN, both. */ |
33 | static void do_hcall(struct lg_cpu *cpu, struct hcall_args *args) | 33 | static void do_hcall(struct lg_cpu *cpu, struct hcall_args *args) |
34 | { | 34 | { |
35 | switch (args->arg0) { | 35 | switch (args->arg0) { |
@@ -190,6 +190,13 @@ static void initialize(struct lg_cpu *cpu) | |||
190 | * pagetable. */ | 190 | * pagetable. */ |
191 | guest_pagetable_clear_all(cpu); | 191 | guest_pagetable_clear_all(cpu); |
192 | } | 192 | } |
193 | /*:*/ | ||
194 | |||
195 | /*M:013 If a Guest reads from a page (so creates a mapping) that it has never | ||
196 | * written to, and then the Launcher writes to it (ie. the output of a virtual | ||
197 | * device), the Guest will still see the old page. In practice, this never | ||
198 | * happens: why would the Guest read a page which it has never written to? But | ||
199 | * a similar scenario might one day bite us, so it's worth mentioning. :*/ | ||
193 | 200 | ||
194 | /*H:100 | 201 | /*H:100 |
195 | * Hypercalls | 202 | * Hypercalls |
@@ -227,7 +234,7 @@ void do_hypercalls(struct lg_cpu *cpu) | |||
227 | * However, if we are signalled or the Guest sends I/O to the | 234 | * However, if we are signalled or the Guest sends I/O to the |
228 | * Launcher, the run_guest() loop will exit without running the | 235 | * Launcher, the run_guest() loop will exit without running the |
229 | * Guest. When it comes back it would try to re-run the | 236 | * Guest. When it comes back it would try to re-run the |
230 | * hypercall. */ | 237 | * hypercall. Finding that bug sucked. */ |
231 | cpu->hcall = NULL; | 238 | cpu->hcall = NULL; |
232 | } | 239 | } |
233 | } | 240 | } |
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c index 32e97c1858e5..0414ddf87587 100644 --- a/drivers/lguest/interrupts_and_traps.c +++ b/drivers/lguest/interrupts_and_traps.c | |||
@@ -144,7 +144,6 @@ void maybe_do_interrupt(struct lg_cpu *cpu) | |||
144 | if (copy_from_user(&blk, cpu->lg->lguest_data->blocked_interrupts, | 144 | if (copy_from_user(&blk, cpu->lg->lguest_data->blocked_interrupts, |
145 | sizeof(blk))) | 145 | sizeof(blk))) |
146 | return; | 146 | return; |
147 | |||
148 | bitmap_andnot(blk, cpu->irqs_pending, blk, LGUEST_IRQS); | 147 | bitmap_andnot(blk, cpu->irqs_pending, blk, LGUEST_IRQS); |
149 | 148 | ||
150 | /* Find the first interrupt. */ | 149 | /* Find the first interrupt. */ |
@@ -237,9 +236,9 @@ void free_interrupts(void) | |||
237 | clear_bit(syscall_vector, used_vectors); | 236 | clear_bit(syscall_vector, used_vectors); |
238 | } | 237 | } |
239 | 238 | ||
240 | /*H:220 Now we've got the routines to deliver interrupts, delivering traps | 239 | /*H:220 Now we've got the routines to deliver interrupts, delivering traps like |
241 | * like page fault is easy. The only trick is that Intel decided that some | 240 | * page fault is easy. The only trick is that Intel decided that some traps |
242 | * traps should have error codes: */ | 241 | * should have error codes: */ |
243 | static int has_err(unsigned int trap) | 242 | static int has_err(unsigned int trap) |
244 | { | 243 | { |
245 | return (trap == 8 || (trap >= 10 && trap <= 14) || trap == 17); | 244 | return (trap == 8 || (trap >= 10 && trap <= 14) || trap == 17); |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 1b2ec0bf5eb1..2bc9bf7e88e5 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /*P:050 Lguest guests use a very simple method to describe devices. It's a | 1 | /*P:050 Lguest guests use a very simple method to describe devices. It's a |
2 | * series of device descriptors contained just above the top of normal | 2 | * series of device descriptors contained just above the top of normal Guest |
3 | * memory. | 3 | * memory. |
4 | * | 4 | * |
5 | * We use the standard "virtio" device infrastructure, which provides us with a | 5 | * We use the standard "virtio" device infrastructure, which provides us with a |
6 | * console, a network and a block driver. Each one expects some configuration | 6 | * console, a network and a block driver. Each one expects some configuration |
7 | * information and a "virtqueue" mechanism to send and receive data. :*/ | 7 | * information and a "virtqueue" or two to send and receive data. :*/ |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/bootmem.h> | 9 | #include <linux/bootmem.h> |
10 | #include <linux/lguest_launcher.h> | 10 | #include <linux/lguest_launcher.h> |
@@ -53,7 +53,7 @@ struct lguest_device { | |||
53 | * Device configurations | 53 | * Device configurations |
54 | * | 54 | * |
55 | * The configuration information for a device consists of one or more | 55 | * The configuration information for a device consists of one or more |
56 | * virtqueues, a feature bitmaks, and some configuration bytes. The | 56 | * virtqueues, a feature bitmap, and some configuration bytes. The |
57 | * configuration bytes don't really matter to us: the Launcher sets them up, and | 57 | * configuration bytes don't really matter to us: the Launcher sets them up, and |
58 | * the driver will look at them during setup. | 58 | * the driver will look at them during setup. |
59 | * | 59 | * |
@@ -179,7 +179,7 @@ struct lguest_vq_info | |||
179 | }; | 179 | }; |
180 | 180 | ||
181 | /* When the virtio_ring code wants to prod the Host, it calls us here and we | 181 | /* When the virtio_ring code wants to prod the Host, it calls us here and we |
182 | * make a hypercall. We hand the page number of the virtqueue so the Host | 182 | * make a hypercall. We hand the physical address of the virtqueue so the Host |
183 | * knows which virtqueue we're talking about. */ | 183 | * knows which virtqueue we're talking about. */ |
184 | static void lg_notify(struct virtqueue *vq) | 184 | static void lg_notify(struct virtqueue *vq) |
185 | { | 185 | { |
@@ -199,7 +199,8 @@ static void lg_notify(struct virtqueue *vq) | |||
199 | * allocate its own pages and tell the Host where they are, but for lguest it's | 199 | * allocate its own pages and tell the Host where they are, but for lguest it's |
200 | * simpler for the Host to simply tell us where the pages are. | 200 | * simpler for the Host to simply tell us where the pages are. |
201 | * | 201 | * |
202 | * So we provide devices with a "find virtqueue and set it up" function. */ | 202 | * So we provide drivers with a "find the Nth virtqueue and set it up" |
203 | * function. */ | ||
203 | static struct virtqueue *lg_find_vq(struct virtio_device *vdev, | 204 | static struct virtqueue *lg_find_vq(struct virtio_device *vdev, |
204 | unsigned index, | 205 | unsigned index, |
205 | void (*callback)(struct virtqueue *vq)) | 206 | void (*callback)(struct virtqueue *vq)) |
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index 2221485b0773..645e6e040bfb 100644 --- a/drivers/lguest/lguest_user.c +++ b/drivers/lguest/lguest_user.c | |||
@@ -73,7 +73,7 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o) | |||
73 | if (current != cpu->tsk) | 73 | if (current != cpu->tsk) |
74 | return -EPERM; | 74 | return -EPERM; |
75 | 75 | ||
76 | /* If the guest is already dead, we indicate why */ | 76 | /* If the Guest is already dead, we indicate why */ |
77 | if (lg->dead) { | 77 | if (lg->dead) { |
78 | size_t len; | 78 | size_t len; |
79 | 79 | ||
@@ -88,7 +88,7 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o) | |||
88 | return len; | 88 | return len; |
89 | } | 89 | } |
90 | 90 | ||
91 | /* If we returned from read() last time because the Guest notified, | 91 | /* If we returned from read() last time because the Guest sent I/O, |
92 | * clear the flag. */ | 92 | * clear the flag. */ |
93 | if (cpu->pending_notify) | 93 | if (cpu->pending_notify) |
94 | cpu->pending_notify = 0; | 94 | cpu->pending_notify = 0; |
@@ -97,14 +97,20 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o) | |||
97 | return run_guest(cpu, (unsigned long __user *)user); | 97 | return run_guest(cpu, (unsigned long __user *)user); |
98 | } | 98 | } |
99 | 99 | ||
100 | /*L:025 This actually initializes a CPU. For the moment, a Guest is only | ||
101 | * uniprocessor, so "id" is always 0. */ | ||
100 | static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) | 102 | static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) |
101 | { | 103 | { |
104 | /* We have a limited number the number of CPUs in the lguest struct. */ | ||
102 | if (id >= NR_CPUS) | 105 | if (id >= NR_CPUS) |
103 | return -EINVAL; | 106 | return -EINVAL; |
104 | 107 | ||
108 | /* Set up this CPU's id, and pointer back to the lguest struct. */ | ||
105 | cpu->id = id; | 109 | cpu->id = id; |
106 | cpu->lg = container_of((cpu - id), struct lguest, cpus[0]); | 110 | cpu->lg = container_of((cpu - id), struct lguest, cpus[0]); |
107 | cpu->lg->nr_cpus++; | 111 | cpu->lg->nr_cpus++; |
112 | |||
113 | /* Each CPU has a timer it can set. */ | ||
108 | init_clockdev(cpu); | 114 | init_clockdev(cpu); |
109 | 115 | ||
110 | /* We need a complete page for the Guest registers: they are accessible | 116 | /* We need a complete page for the Guest registers: they are accessible |
@@ -120,11 +126,11 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) | |||
120 | * address. */ | 126 | * address. */ |
121 | lguest_arch_setup_regs(cpu, start_ip); | 127 | lguest_arch_setup_regs(cpu, start_ip); |
122 | 128 | ||
123 | /* Initialize the queue for the waker to wait on */ | 129 | /* Initialize the queue for the Waker to wait on */ |
124 | init_waitqueue_head(&cpu->break_wq); | 130 | init_waitqueue_head(&cpu->break_wq); |
125 | 131 | ||
126 | /* We keep a pointer to the Launcher task (ie. current task) for when | 132 | /* We keep a pointer to the Launcher task (ie. current task) for when |
127 | * other Guests want to wake this one (inter-Guest I/O). */ | 133 | * other Guests want to wake this one (eg. console input). */ |
128 | cpu->tsk = current; | 134 | cpu->tsk = current; |
129 | 135 | ||
130 | /* We need to keep a pointer to the Launcher's memory map, because if | 136 | /* We need to keep a pointer to the Launcher's memory map, because if |
@@ -136,6 +142,7 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) | |||
136 | * when the same Guest runs on the same CPU twice. */ | 142 | * when the same Guest runs on the same CPU twice. */ |
137 | cpu->last_pages = NULL; | 143 | cpu->last_pages = NULL; |
138 | 144 | ||
145 | /* No error == success. */ | ||
139 | return 0; | 146 | return 0; |
140 | } | 147 | } |
141 | 148 | ||
@@ -182,17 +189,16 @@ static int initialize(struct file *file, const unsigned long __user *input) | |||
182 | } | 189 | } |
183 | 190 | ||
184 | /* Populate the easy fields of our "struct lguest" */ | 191 | /* Populate the easy fields of our "struct lguest" */ |
185 | lg->mem_base = (void __user *)(long)args[0]; | 192 | lg->mem_base = (void __user *)args[0]; |
186 | lg->pfn_limit = args[1]; | 193 | lg->pfn_limit = args[1]; |
187 | 194 | ||
188 | /* This is the first cpu */ | 195 | /* This is the first cpu (cpu 0) and it will start booting at args[3] */ |
189 | err = lg_cpu_start(&lg->cpus[0], 0, args[3]); | 196 | err = lg_cpu_start(&lg->cpus[0], 0, args[3]); |
190 | if (err) | 197 | if (err) |
191 | goto release_guest; | 198 | goto release_guest; |
192 | 199 | ||
193 | /* Initialize the Guest's shadow page tables, using the toplevel | 200 | /* Initialize the Guest's shadow page tables, using the toplevel |
194 | * address the Launcher gave us. This allocates memory, so can | 201 | * address the Launcher gave us. This allocates memory, so can fail. */ |
195 | * fail. */ | ||
196 | err = init_guest_pagetable(lg, args[2]); | 202 | err = init_guest_pagetable(lg, args[2]); |
197 | if (err) | 203 | if (err) |
198 | goto free_regs; | 204 | goto free_regs; |
@@ -218,11 +224,16 @@ unlock: | |||
218 | /*L:010 The first operation the Launcher does must be a write. All writes | 224 | /*L:010 The first operation the Launcher does must be a write. All writes |
219 | * start with an unsigned long number: for the first write this must be | 225 | * start with an unsigned long number: for the first write this must be |
220 | * LHREQ_INITIALIZE to set up the Guest. After that the Launcher can use | 226 | * LHREQ_INITIALIZE to set up the Guest. After that the Launcher can use |
221 | * writes of other values to send interrupts. */ | 227 | * writes of other values to send interrupts. |
228 | * | ||
229 | * Note that we overload the "offset" in the /dev/lguest file to indicate what | ||
230 | * CPU number we're dealing with. Currently this is always 0, since we only | ||
231 | * support uniprocessor Guests, but you can see the beginnings of SMP support | ||
232 | * here. */ | ||
222 | static ssize_t write(struct file *file, const char __user *in, | 233 | static ssize_t write(struct file *file, const char __user *in, |
223 | size_t size, loff_t *off) | 234 | size_t size, loff_t *off) |
224 | { | 235 | { |
225 | /* Once the guest is initialized, we hold the "struct lguest" in the | 236 | /* Once the Guest is initialized, we hold the "struct lguest" in the |
226 | * file private data. */ | 237 | * file private data. */ |
227 | struct lguest *lg = file->private_data; | 238 | struct lguest *lg = file->private_data; |
228 | const unsigned long __user *input = (const unsigned long __user *)in; | 239 | const unsigned long __user *input = (const unsigned long __user *)in; |
@@ -230,6 +241,7 @@ static ssize_t write(struct file *file, const char __user *in, | |||
230 | struct lg_cpu *uninitialized_var(cpu); | 241 | struct lg_cpu *uninitialized_var(cpu); |
231 | unsigned int cpu_id = *off; | 242 | unsigned int cpu_id = *off; |
232 | 243 | ||
244 | /* The first value tells us what this request is. */ | ||
233 | if (get_user(req, input) != 0) | 245 | if (get_user(req, input) != 0) |
234 | return -EFAULT; | 246 | return -EFAULT; |
235 | input++; | 247 | input++; |
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index a7f64a9d67e0..d93500f24fbb 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -2,8 +2,8 @@ | |||
2 | * previous encounters. It's functional, and as neat as it can be in the | 2 | * previous encounters. It's functional, and as neat as it can be in the |
3 | * circumstances, but be wary, for these things are subtle and break easily. | 3 | * circumstances, but be wary, for these things are subtle and break easily. |
4 | * The Guest provides a virtual to physical mapping, but we can neither trust | 4 | * The Guest provides a virtual to physical mapping, but we can neither trust |
5 | * it nor use it: we verify and convert it here to point the hardware to the | 5 | * it nor use it: we verify and convert it here then point the CPU to the |
6 | * actual Guest pages when running the Guest. :*/ | 6 | * converted Guest pages when running the Guest. :*/ |
7 | 7 | ||
8 | /* Copyright (C) Rusty Russell IBM Corporation 2006. | 8 | /* Copyright (C) Rusty Russell IBM Corporation 2006. |
9 | * GPL v2 and any later version */ | 9 | * GPL v2 and any later version */ |
@@ -106,6 +106,11 @@ static unsigned long gpte_addr(pgd_t gpgd, unsigned long vaddr) | |||
106 | BUG_ON(!(pgd_flags(gpgd) & _PAGE_PRESENT)); | 106 | BUG_ON(!(pgd_flags(gpgd) & _PAGE_PRESENT)); |
107 | return gpage + ((vaddr>>PAGE_SHIFT) % PTRS_PER_PTE) * sizeof(pte_t); | 107 | return gpage + ((vaddr>>PAGE_SHIFT) % PTRS_PER_PTE) * sizeof(pte_t); |
108 | } | 108 | } |
109 | /*:*/ | ||
110 | |||
111 | /*M:014 get_pfn is slow; it takes the mmap sem and calls get_user_pages. We | ||
112 | * could probably try to grab batches of pages here as an optimization | ||
113 | * (ie. pre-faulting). :*/ | ||
109 | 114 | ||
110 | /*H:350 This routine takes a page number given by the Guest and converts it to | 115 | /*H:350 This routine takes a page number given by the Guest and converts it to |
111 | * an actual, physical page number. It can fail for several reasons: the | 116 | * an actual, physical page number. It can fail for several reasons: the |
@@ -113,8 +118,8 @@ static unsigned long gpte_addr(pgd_t gpgd, unsigned long vaddr) | |||
113 | * and the page is read-only, or the write flag was set and the page was | 118 | * and the page is read-only, or the write flag was set and the page was |
114 | * shared so had to be copied, but we ran out of memory. | 119 | * shared so had to be copied, but we ran out of memory. |
115 | * | 120 | * |
116 | * This holds a reference to the page, so release_pte() is careful to | 121 | * This holds a reference to the page, so release_pte() is careful to put that |
117 | * put that back. */ | 122 | * back. */ |
118 | static unsigned long get_pfn(unsigned long virtpfn, int write) | 123 | static unsigned long get_pfn(unsigned long virtpfn, int write) |
119 | { | 124 | { |
120 | struct page *page; | 125 | struct page *page; |
@@ -532,13 +537,13 @@ static void do_set_pte(struct lg_cpu *cpu, int idx, | |||
532 | * all processes. So when the page table above that address changes, we update | 537 | * all processes. So when the page table above that address changes, we update |
533 | * all the page tables, not just the current one. This is rare. | 538 | * all the page tables, not just the current one. This is rare. |
534 | * | 539 | * |
535 | * The benefit is that when we have to track a new page table, we can copy keep | 540 | * The benefit is that when we have to track a new page table, we can keep all |
536 | * all the kernel mappings. This speeds up context switch immensely. */ | 541 | * the kernel mappings. This speeds up context switch immensely. */ |
537 | void guest_set_pte(struct lg_cpu *cpu, | 542 | void guest_set_pte(struct lg_cpu *cpu, |
538 | unsigned long gpgdir, unsigned long vaddr, pte_t gpte) | 543 | unsigned long gpgdir, unsigned long vaddr, pte_t gpte) |
539 | { | 544 | { |
540 | /* Kernel mappings must be changed on all top levels. Slow, but | 545 | /* Kernel mappings must be changed on all top levels. Slow, but doesn't |
541 | * doesn't happen often. */ | 546 | * happen often. */ |
542 | if (vaddr >= cpu->lg->kernel_address) { | 547 | if (vaddr >= cpu->lg->kernel_address) { |
543 | unsigned int i; | 548 | unsigned int i; |
544 | for (i = 0; i < ARRAY_SIZE(cpu->lg->pgdirs); i++) | 549 | for (i = 0; i < ARRAY_SIZE(cpu->lg->pgdirs); i++) |
@@ -704,12 +709,11 @@ static __init void populate_switcher_pte_page(unsigned int cpu, | |||
704 | /* We've made it through the page table code. Perhaps our tired brains are | 709 | /* We've made it through the page table code. Perhaps our tired brains are |
705 | * still processing the details, or perhaps we're simply glad it's over. | 710 | * still processing the details, or perhaps we're simply glad it's over. |
706 | * | 711 | * |
707 | * If nothing else, note that all this complexity in juggling shadow page | 712 | * If nothing else, note that all this complexity in juggling shadow page tables |
708 | * tables in sync with the Guest's page tables is for one reason: for most | 713 | * in sync with the Guest's page tables is for one reason: for most Guests this |
709 | * Guests this page table dance determines how bad performance will be. This | 714 | * page table dance determines how bad performance will be. This is why Xen |
710 | * is why Xen uses exotic direct Guest pagetable manipulation, and why both | 715 | * uses exotic direct Guest pagetable manipulation, and why both Intel and AMD |
711 | * Intel and AMD have implemented shadow page table support directly into | 716 | * have implemented shadow page table support directly into hardware. |
712 | * hardware. | ||
713 | * | 717 | * |
714 | * There is just one file remaining in the Host. */ | 718 | * There is just one file remaining in the Host. */ |
715 | 719 | ||
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index 635187812d52..5126d5d9ea0e 100644 --- a/drivers/lguest/x86/core.c +++ b/drivers/lguest/x86/core.c | |||
@@ -17,6 +17,13 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | /*P:450 This file contains the x86-specific lguest code. It used to be all | ||
21 | * mixed in with drivers/lguest/core.c but several foolhardy code slashers | ||
22 | * wrestled most of the dependencies out to here in preparation for porting | ||
23 | * lguest to other architectures (see what I mean by foolhardy?). | ||
24 | * | ||
25 | * This also contains a couple of non-obvious setup and teardown pieces which | ||
26 | * were implemented after days of debugging pain. :*/ | ||
20 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
21 | #include <linux/start_kernel.h> | 28 | #include <linux/start_kernel.h> |
22 | #include <linux/string.h> | 29 | #include <linux/string.h> |
@@ -157,6 +164,8 @@ static void run_guest_once(struct lg_cpu *cpu, struct lguest_pages *pages) | |||
157 | * also simplify copy_in_guest_info(). Note that we'd still need to restore | 164 | * also simplify copy_in_guest_info(). Note that we'd still need to restore |
158 | * things when we exit to Launcher userspace, but that's fairly easy. | 165 | * things when we exit to Launcher userspace, but that's fairly easy. |
159 | * | 166 | * |
167 | * We could also try using this hooks for PGE, but that might be too expensive. | ||
168 | * | ||
160 | * The hooks were designed for KVM, but we can also put them to good use. :*/ | 169 | * The hooks were designed for KVM, but we can also put them to good use. :*/ |
161 | 170 | ||
162 | /*H:040 This is the i386-specific code to setup and run the Guest. Interrupts | 171 | /*H:040 This is the i386-specific code to setup and run the Guest. Interrupts |
@@ -182,7 +191,7 @@ void lguest_arch_run_guest(struct lg_cpu *cpu) | |||
182 | * was doing. */ | 191 | * was doing. */ |
183 | run_guest_once(cpu, lguest_pages(raw_smp_processor_id())); | 192 | run_guest_once(cpu, lguest_pages(raw_smp_processor_id())); |
184 | 193 | ||
185 | /* Note that the "regs" pointer contains two extra entries which are | 194 | /* Note that the "regs" structure contains two extra entries which are |
186 | * not really registers: a trap number which says what interrupt or | 195 | * not really registers: a trap number which says what interrupt or |
187 | * trap made the switcher code come back, and an error code which some | 196 | * trap made the switcher code come back, and an error code which some |
188 | * traps set. */ | 197 | * traps set. */ |
@@ -293,11 +302,10 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu) | |||
293 | break; | 302 | break; |
294 | case 14: /* We've intercepted a Page Fault. */ | 303 | case 14: /* We've intercepted a Page Fault. */ |
295 | /* The Guest accessed a virtual address that wasn't mapped. | 304 | /* The Guest accessed a virtual address that wasn't mapped. |
296 | * This happens a lot: we don't actually set up most of the | 305 | * This happens a lot: we don't actually set up most of the page |
297 | * page tables for the Guest at all when we start: as it runs | 306 | * tables for the Guest at all when we start: as it runs it asks |
298 | * it asks for more and more, and we set them up as | 307 | * for more and more, and we set them up as required. In this |
299 | * required. In this case, we don't even tell the Guest that | 308 | * case, we don't even tell the Guest that the fault happened. |
300 | * the fault happened. | ||
301 | * | 309 | * |
302 | * The errcode tells whether this was a read or a write, and | 310 | * The errcode tells whether this was a read or a write, and |
303 | * whether kernel or userspace code. */ | 311 | * whether kernel or userspace code. */ |
@@ -342,7 +350,7 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu) | |||
342 | if (!deliver_trap(cpu, cpu->regs->trapnum)) | 350 | if (!deliver_trap(cpu, cpu->regs->trapnum)) |
343 | /* If the Guest doesn't have a handler (either it hasn't | 351 | /* If the Guest doesn't have a handler (either it hasn't |
344 | * registered any yet, or it's one of the faults we don't let | 352 | * registered any yet, or it's one of the faults we don't let |
345 | * it handle), it dies with a cryptic error message. */ | 353 | * it handle), it dies with this cryptic error message. */ |
346 | kill_guest(cpu, "unhandled trap %li at %#lx (%#lx)", | 354 | kill_guest(cpu, "unhandled trap %li at %#lx (%#lx)", |
347 | cpu->regs->trapnum, cpu->regs->eip, | 355 | cpu->regs->trapnum, cpu->regs->eip, |
348 | cpu->regs->trapnum == 14 ? cpu->arch.last_pagefault | 356 | cpu->regs->trapnum == 14 ? cpu->arch.last_pagefault |
@@ -375,8 +383,8 @@ void __init lguest_arch_host_init(void) | |||
375 | * The only exception is the interrupt handlers in switcher.S: their | 383 | * The only exception is the interrupt handlers in switcher.S: their |
376 | * addresses are placed in a table (default_idt_entries), so we need to | 384 | * addresses are placed in a table (default_idt_entries), so we need to |
377 | * update the table with the new addresses. switcher_offset() is a | 385 | * update the table with the new addresses. switcher_offset() is a |
378 | * convenience function which returns the distance between the builtin | 386 | * convenience function which returns the distance between the |
379 | * switcher code and the high-mapped copy we just made. */ | 387 | * compiled-in switcher code and the high-mapped copy we just made. */ |
380 | for (i = 0; i < IDT_ENTRIES; i++) | 388 | for (i = 0; i < IDT_ENTRIES; i++) |
381 | default_idt_entries[i] += switcher_offset(); | 389 | default_idt_entries[i] += switcher_offset(); |
382 | 390 | ||
@@ -416,7 +424,7 @@ void __init lguest_arch_host_init(void) | |||
416 | state->guest_gdt_desc.address = (long)&state->guest_gdt; | 424 | state->guest_gdt_desc.address = (long)&state->guest_gdt; |
417 | 425 | ||
418 | /* We know where we want the stack to be when the Guest enters | 426 | /* We know where we want the stack to be when the Guest enters |
419 | * the switcher: in pages->regs. The stack grows upwards, so | 427 | * the Switcher: in pages->regs. The stack grows upwards, so |
420 | * we start it at the end of that structure. */ | 428 | * we start it at the end of that structure. */ |
421 | state->guest_tss.sp0 = (long)(&pages->regs + 1); | 429 | state->guest_tss.sp0 = (long)(&pages->regs + 1); |
422 | /* And this is the GDT entry to use for the stack: we keep a | 430 | /* And this is the GDT entry to use for the stack: we keep a |
@@ -513,8 +521,8 @@ int lguest_arch_init_hypercalls(struct lg_cpu *cpu) | |||
513 | { | 521 | { |
514 | u32 tsc_speed; | 522 | u32 tsc_speed; |
515 | 523 | ||
516 | /* The pointer to the Guest's "struct lguest_data" is the only | 524 | /* The pointer to the Guest's "struct lguest_data" is the only argument. |
517 | * argument. We check that address now. */ | 525 | * We check that address now. */ |
518 | if (!lguest_address_ok(cpu->lg, cpu->hcall->arg1, | 526 | if (!lguest_address_ok(cpu->lg, cpu->hcall->arg1, |
519 | sizeof(*cpu->lg->lguest_data))) | 527 | sizeof(*cpu->lg->lguest_data))) |
520 | return -EFAULT; | 528 | return -EFAULT; |
@@ -546,6 +554,7 @@ int lguest_arch_init_hypercalls(struct lg_cpu *cpu) | |||
546 | 554 | ||
547 | return 0; | 555 | return 0; |
548 | } | 556 | } |
557 | /*:*/ | ||
549 | 558 | ||
550 | /*L:030 lguest_arch_setup_regs() | 559 | /*L:030 lguest_arch_setup_regs() |
551 | * | 560 | * |
diff --git a/drivers/lguest/x86/switcher_32.S b/drivers/lguest/x86/switcher_32.S index 0af8baaa0d4a..3fc15318a80f 100644 --- a/drivers/lguest/x86/switcher_32.S +++ b/drivers/lguest/x86/switcher_32.S | |||
@@ -1,6 +1,6 @@ | |||
1 | /*P:900 This is the Switcher: code which sits at 0xFFC00000 to do the low-level | 1 | /*P:900 This is the Switcher: code which sits at 0xFFC00000 astride both the |
2 | * Guest<->Host switch. It is as simple as it can be made, but it's naturally | 2 | * Host and Guest to do the low-level Guest<->Host switch. It is as simple as |
3 | * very specific to x86. | 3 | * it can be made, but it's naturally very specific to x86. |
4 | * | 4 | * |
5 | * You have now completed Preparation. If this has whet your appetite; if you | 5 | * You have now completed Preparation. If this has whet your appetite; if you |
6 | * are feeling invigorated and refreshed then the next, more challenging stage | 6 | * are feeling invigorated and refreshed then the next, more challenging stage |
@@ -189,7 +189,7 @@ ENTRY(switch_to_guest) | |||
189 | // Interrupts are turned back on: we are Guest. | 189 | // Interrupts are turned back on: we are Guest. |
190 | iret | 190 | iret |
191 | 191 | ||
192 | // We treat two paths to switch back to the Host | 192 | // We tread two paths to switch back to the Host |
193 | // Yet both must save Guest state and restore Host | 193 | // Yet both must save Guest state and restore Host |
194 | // So we put the routine in a macro. | 194 | // So we put the routine in a macro. |
195 | #define SWITCH_TO_HOST \ | 195 | #define SWITCH_TO_HOST \ |
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index 741a2e3f4fc6..a348bb0791d3 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | static struct backlight_ops pmu_backlight_data; | 18 | static struct backlight_ops pmu_backlight_data; |
19 | static DEFINE_SPINLOCK(pmu_backlight_lock); | 19 | static DEFINE_SPINLOCK(pmu_backlight_lock); |
20 | static int sleeping; | 20 | static int sleeping, uses_pmu_bl; |
21 | static u8 bl_curve[FB_BACKLIGHT_LEVELS]; | 21 | static u8 bl_curve[FB_BACKLIGHT_LEVELS]; |
22 | 22 | ||
23 | static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) | 23 | static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) |
@@ -128,7 +128,7 @@ void pmu_backlight_set_sleep(int sleep) | |||
128 | 128 | ||
129 | spin_lock_irqsave(&pmu_backlight_lock, flags); | 129 | spin_lock_irqsave(&pmu_backlight_lock, flags); |
130 | sleeping = sleep; | 130 | sleeping = sleep; |
131 | if (pmac_backlight) { | 131 | if (pmac_backlight && uses_pmu_bl) { |
132 | if (sleep) { | 132 | if (sleep) { |
133 | struct adb_request req; | 133 | struct adb_request req; |
134 | 134 | ||
@@ -166,6 +166,7 @@ void __init pmu_backlight_init() | |||
166 | printk(KERN_ERR "PMU Backlight registration failed\n"); | 166 | printk(KERN_ERR "PMU Backlight registration failed\n"); |
167 | return; | 167 | return; |
168 | } | 168 | } |
169 | uses_pmu_bl = 1; | ||
169 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 170 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
170 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); | 171 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); |
171 | 172 | ||
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index ebec663d5d37..d6365a9f0637 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -2528,7 +2528,7 @@ EXPORT_SYMBOL(pmu_wait_complete); | |||
2528 | EXPORT_SYMBOL(pmu_suspend); | 2528 | EXPORT_SYMBOL(pmu_suspend); |
2529 | EXPORT_SYMBOL(pmu_resume); | 2529 | EXPORT_SYMBOL(pmu_resume); |
2530 | EXPORT_SYMBOL(pmu_unlock); | 2530 | EXPORT_SYMBOL(pmu_unlock); |
2531 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) | 2531 | #if defined(CONFIG_PPC32) |
2532 | EXPORT_SYMBOL(pmu_enable_irled); | 2532 | EXPORT_SYMBOL(pmu_enable_irled); |
2533 | EXPORT_SYMBOL(pmu_battery_count); | 2533 | EXPORT_SYMBOL(pmu_battery_count); |
2534 | EXPORT_SYMBOL(pmu_batteries); | 2534 | EXPORT_SYMBOL(pmu_batteries); |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index b04f98df94ea..835def11419d 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 Christophe Saout <christophe@saout.de> | 2 | * Copyright (C) 2003 Christophe Saout <christophe@saout.de> |
3 | * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org> | 3 | * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org> |
4 | * Copyright (C) 2006-2007 Red Hat, Inc. All rights reserved. | 4 | * Copyright (C) 2006-2008 Red Hat, Inc. All rights reserved. |
5 | * | 5 | * |
6 | * This file is released under the GPL. | 6 | * This file is released under the GPL. |
7 | */ | 7 | */ |
@@ -93,6 +93,8 @@ struct crypt_config { | |||
93 | 93 | ||
94 | struct workqueue_struct *io_queue; | 94 | struct workqueue_struct *io_queue; |
95 | struct workqueue_struct *crypt_queue; | 95 | struct workqueue_struct *crypt_queue; |
96 | wait_queue_head_t writeq; | ||
97 | |||
96 | /* | 98 | /* |
97 | * crypto related data | 99 | * crypto related data |
98 | */ | 100 | */ |
@@ -331,14 +333,7 @@ static void crypt_convert_init(struct crypt_config *cc, | |||
331 | ctx->idx_out = bio_out ? bio_out->bi_idx : 0; | 333 | ctx->idx_out = bio_out ? bio_out->bi_idx : 0; |
332 | ctx->sector = sector + cc->iv_offset; | 334 | ctx->sector = sector + cc->iv_offset; |
333 | init_completion(&ctx->restart); | 335 | init_completion(&ctx->restart); |
334 | /* | 336 | atomic_set(&ctx->pending, 1); |
335 | * Crypto operation can be asynchronous, | ||
336 | * ctx->pending is increased after request submission. | ||
337 | * We need to ensure that we don't call the crypt finish | ||
338 | * operation before pending got incremented | ||
339 | * (dependent on crypt submission return code). | ||
340 | */ | ||
341 | atomic_set(&ctx->pending, 2); | ||
342 | } | 337 | } |
343 | 338 | ||
344 | static int crypt_convert_block(struct crypt_config *cc, | 339 | static int crypt_convert_block(struct crypt_config *cc, |
@@ -411,43 +406,42 @@ static void crypt_alloc_req(struct crypt_config *cc, | |||
411 | static int crypt_convert(struct crypt_config *cc, | 406 | static int crypt_convert(struct crypt_config *cc, |
412 | struct convert_context *ctx) | 407 | struct convert_context *ctx) |
413 | { | 408 | { |
414 | int r = 0; | 409 | int r; |
415 | 410 | ||
416 | while(ctx->idx_in < ctx->bio_in->bi_vcnt && | 411 | while(ctx->idx_in < ctx->bio_in->bi_vcnt && |
417 | ctx->idx_out < ctx->bio_out->bi_vcnt) { | 412 | ctx->idx_out < ctx->bio_out->bi_vcnt) { |
418 | 413 | ||
419 | crypt_alloc_req(cc, ctx); | 414 | crypt_alloc_req(cc, ctx); |
420 | 415 | ||
416 | atomic_inc(&ctx->pending); | ||
417 | |||
421 | r = crypt_convert_block(cc, ctx, cc->req); | 418 | r = crypt_convert_block(cc, ctx, cc->req); |
422 | 419 | ||
423 | switch (r) { | 420 | switch (r) { |
421 | /* async */ | ||
424 | case -EBUSY: | 422 | case -EBUSY: |
425 | wait_for_completion(&ctx->restart); | 423 | wait_for_completion(&ctx->restart); |
426 | INIT_COMPLETION(ctx->restart); | 424 | INIT_COMPLETION(ctx->restart); |
427 | /* fall through*/ | 425 | /* fall through*/ |
428 | case -EINPROGRESS: | 426 | case -EINPROGRESS: |
429 | atomic_inc(&ctx->pending); | ||
430 | cc->req = NULL; | 427 | cc->req = NULL; |
431 | r = 0; | 428 | ctx->sector++; |
432 | /* fall through*/ | 429 | continue; |
430 | |||
431 | /* sync */ | ||
433 | case 0: | 432 | case 0: |
433 | atomic_dec(&ctx->pending); | ||
434 | ctx->sector++; | 434 | ctx->sector++; |
435 | continue; | 435 | continue; |
436 | } | ||
437 | 436 | ||
438 | break; | 437 | /* error */ |
438 | default: | ||
439 | atomic_dec(&ctx->pending); | ||
440 | return r; | ||
441 | } | ||
439 | } | 442 | } |
440 | 443 | ||
441 | /* | 444 | return 0; |
442 | * If there are pending crypto operation run async | ||
443 | * code. Otherwise process return code synchronously. | ||
444 | * The step of 2 ensures that async finish doesn't | ||
445 | * call crypto finish too early. | ||
446 | */ | ||
447 | if (atomic_sub_return(2, &ctx->pending)) | ||
448 | return -EINPROGRESS; | ||
449 | |||
450 | return r; | ||
451 | } | 445 | } |
452 | 446 | ||
453 | static void dm_crypt_bio_destructor(struct bio *bio) | 447 | static void dm_crypt_bio_destructor(struct bio *bio) |
@@ -624,8 +618,10 @@ static void kcryptd_io_read(struct dm_crypt_io *io) | |||
624 | static void kcryptd_io_write(struct dm_crypt_io *io) | 618 | static void kcryptd_io_write(struct dm_crypt_io *io) |
625 | { | 619 | { |
626 | struct bio *clone = io->ctx.bio_out; | 620 | struct bio *clone = io->ctx.bio_out; |
621 | struct crypt_config *cc = io->target->private; | ||
627 | 622 | ||
628 | generic_make_request(clone); | 623 | generic_make_request(clone); |
624 | wake_up(&cc->writeq); | ||
629 | } | 625 | } |
630 | 626 | ||
631 | static void kcryptd_io(struct work_struct *work) | 627 | static void kcryptd_io(struct work_struct *work) |
@@ -698,7 +694,8 @@ static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io) | |||
698 | 694 | ||
699 | r = crypt_convert(cc, &io->ctx); | 695 | r = crypt_convert(cc, &io->ctx); |
700 | 696 | ||
701 | if (r != -EINPROGRESS) { | 697 | if (atomic_dec_and_test(&io->ctx.pending)) { |
698 | /* processed, no running async crypto */ | ||
702 | kcryptd_crypt_write_io_submit(io, r, 0); | 699 | kcryptd_crypt_write_io_submit(io, r, 0); |
703 | if (unlikely(r < 0)) | 700 | if (unlikely(r < 0)) |
704 | return; | 701 | return; |
@@ -706,8 +703,12 @@ static void kcryptd_crypt_write_convert_loop(struct dm_crypt_io *io) | |||
706 | atomic_inc(&io->pending); | 703 | atomic_inc(&io->pending); |
707 | 704 | ||
708 | /* out of memory -> run queues */ | 705 | /* out of memory -> run queues */ |
709 | if (unlikely(remaining)) | 706 | if (unlikely(remaining)) { |
707 | /* wait for async crypto then reinitialize pending */ | ||
708 | wait_event(cc->writeq, !atomic_read(&io->ctx.pending)); | ||
709 | atomic_set(&io->ctx.pending, 1); | ||
710 | congestion_wait(WRITE, HZ/100); | 710 | congestion_wait(WRITE, HZ/100); |
711 | } | ||
711 | } | 712 | } |
712 | } | 713 | } |
713 | 714 | ||
@@ -746,7 +747,7 @@ static void kcryptd_crypt_read_convert(struct dm_crypt_io *io) | |||
746 | 747 | ||
747 | r = crypt_convert(cc, &io->ctx); | 748 | r = crypt_convert(cc, &io->ctx); |
748 | 749 | ||
749 | if (r != -EINPROGRESS) | 750 | if (atomic_dec_and_test(&io->ctx.pending)) |
750 | kcryptd_crypt_read_done(io, r); | 751 | kcryptd_crypt_read_done(io, r); |
751 | 752 | ||
752 | crypt_dec_pending(io); | 753 | crypt_dec_pending(io); |
@@ -1047,6 +1048,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
1047 | goto bad_crypt_queue; | 1048 | goto bad_crypt_queue; |
1048 | } | 1049 | } |
1049 | 1050 | ||
1051 | init_waitqueue_head(&cc->writeq); | ||
1050 | ti->private = cc; | 1052 | ti->private = cc; |
1051 | return 0; | 1053 | return 0; |
1052 | 1054 | ||
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index b8e342fe7586..8f25f628ef16 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -114,7 +114,7 @@ static void dec_count(struct io *io, unsigned int region, int error) | |||
114 | wake_up_process(io->sleeper); | 114 | wake_up_process(io->sleeper); |
115 | 115 | ||
116 | else { | 116 | else { |
117 | int r = io->error; | 117 | unsigned long r = io->error; |
118 | io_notify_fn fn = io->callback; | 118 | io_notify_fn fn = io->callback; |
119 | void *context = io->context; | 119 | void *context = io->context; |
120 | 120 | ||
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 51605870f898..762cb086bb7f 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -753,7 +753,7 @@ out: | |||
753 | * are in the no-sync state. We have to recover these by | 753 | * are in the no-sync state. We have to recover these by |
754 | * recopying from the default mirror to all the others. | 754 | * recopying from the default mirror to all the others. |
755 | *---------------------------------------------------------------*/ | 755 | *---------------------------------------------------------------*/ |
756 | static void recovery_complete(int read_err, unsigned int write_err, | 756 | static void recovery_complete(int read_err, unsigned long write_err, |
757 | void *context) | 757 | void *context) |
758 | { | 758 | { |
759 | struct region *reg = (struct region *)context; | 759 | struct region *reg = (struct region *)context; |
@@ -767,7 +767,7 @@ static void recovery_complete(int read_err, unsigned int write_err, | |||
767 | } | 767 | } |
768 | 768 | ||
769 | if (write_err) { | 769 | if (write_err) { |
770 | DMERR_LIMIT("Write error during recovery (error = 0x%x)", | 770 | DMERR_LIMIT("Write error during recovery (error = 0x%lx)", |
771 | write_err); | 771 | write_err); |
772 | /* | 772 | /* |
773 | * Bits correspond to devices (excluding default mirror). | 773 | * Bits correspond to devices (excluding default mirror). |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index ae24eab8cd81..4dc8a43c034b 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -804,7 +804,7 @@ static void commit_callback(void *context, int success) | |||
804 | * Called when the copy I/O has finished. kcopyd actually runs | 804 | * Called when the copy I/O has finished. kcopyd actually runs |
805 | * this code so don't block. | 805 | * this code so don't block. |
806 | */ | 806 | */ |
807 | static void copy_callback(int read_err, unsigned int write_err, void *context) | 807 | static void copy_callback(int read_err, unsigned long write_err, void *context) |
808 | { | 808 | { |
809 | struct dm_snap_pending_exception *pe = context; | 809 | struct dm_snap_pending_exception *pe = context; |
810 | struct dm_snapshot *s = pe->snap; | 810 | struct dm_snapshot *s = pe->snap; |
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c index f3831f31223e..e76b52ade690 100644 --- a/drivers/md/kcopyd.c +++ b/drivers/md/kcopyd.c | |||
@@ -169,7 +169,7 @@ struct kcopyd_job { | |||
169 | * Error state of the job. | 169 | * Error state of the job. |
170 | */ | 170 | */ |
171 | int read_err; | 171 | int read_err; |
172 | unsigned int write_err; | 172 | unsigned long write_err; |
173 | 173 | ||
174 | /* | 174 | /* |
175 | * Either READ or WRITE | 175 | * Either READ or WRITE |
@@ -293,7 +293,7 @@ static int run_complete_job(struct kcopyd_job *job) | |||
293 | { | 293 | { |
294 | void *context = job->context; | 294 | void *context = job->context; |
295 | int read_err = job->read_err; | 295 | int read_err = job->read_err; |
296 | unsigned int write_err = job->write_err; | 296 | unsigned long write_err = job->write_err; |
297 | kcopyd_notify_fn fn = job->fn; | 297 | kcopyd_notify_fn fn = job->fn; |
298 | struct kcopyd_client *kc = job->kc; | 298 | struct kcopyd_client *kc = job->kc; |
299 | 299 | ||
@@ -396,7 +396,7 @@ static int process_jobs(struct list_head *jobs, int (*fn) (struct kcopyd_job *)) | |||
396 | if (r < 0) { | 396 | if (r < 0) { |
397 | /* error this rogue job */ | 397 | /* error this rogue job */ |
398 | if (job->rw == WRITE) | 398 | if (job->rw == WRITE) |
399 | job->write_err = (unsigned int) -1; | 399 | job->write_err = (unsigned long) -1L; |
400 | else | 400 | else |
401 | job->read_err = 1; | 401 | job->read_err = 1; |
402 | push(&_complete_jobs, job); | 402 | push(&_complete_jobs, job); |
@@ -448,8 +448,8 @@ static void dispatch_job(struct kcopyd_job *job) | |||
448 | } | 448 | } |
449 | 449 | ||
450 | #define SUB_JOB_SIZE 128 | 450 | #define SUB_JOB_SIZE 128 |
451 | static void segment_complete(int read_err, | 451 | static void segment_complete(int read_err, unsigned long write_err, |
452 | unsigned int write_err, void *context) | 452 | void *context) |
453 | { | 453 | { |
454 | /* FIXME: tidy this function */ | 454 | /* FIXME: tidy this function */ |
455 | sector_t progress = 0; | 455 | sector_t progress = 0; |
diff --git a/drivers/md/kcopyd.h b/drivers/md/kcopyd.h index 4621ea055c0e..4845f2a0c676 100644 --- a/drivers/md/kcopyd.h +++ b/drivers/md/kcopyd.h | |||
@@ -32,8 +32,8 @@ void kcopyd_client_destroy(struct kcopyd_client *kc); | |||
32 | * read_err is a boolean, | 32 | * read_err is a boolean, |
33 | * write_err is a bitset, with 1 bit for each destination region | 33 | * write_err is a bitset, with 1 bit for each destination region |
34 | */ | 34 | */ |
35 | typedef void (*kcopyd_notify_fn)(int read_err, | 35 | typedef void (*kcopyd_notify_fn)(int read_err, unsigned long write_err, |
36 | unsigned int write_err, void *context); | 36 | void *context); |
37 | 37 | ||
38 | int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, | 38 | int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, |
39 | unsigned int num_dests, struct io_region *dests, | 39 | unsigned int num_dests, struct io_region *dests, |
diff --git a/drivers/md/md.c b/drivers/md/md.c index ccbbf63727cc..61ccbd2683fa 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1864,17 +1864,6 @@ static struct rdev_sysfs_entry rdev_state = | |||
1864 | __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store); | 1864 | __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store); |
1865 | 1865 | ||
1866 | static ssize_t | 1866 | static ssize_t |
1867 | super_show(mdk_rdev_t *rdev, char *page) | ||
1868 | { | ||
1869 | if (rdev->sb_loaded && rdev->sb_size) { | ||
1870 | memcpy(page, page_address(rdev->sb_page), rdev->sb_size); | ||
1871 | return rdev->sb_size; | ||
1872 | } else | ||
1873 | return 0; | ||
1874 | } | ||
1875 | static struct rdev_sysfs_entry rdev_super = __ATTR_RO(super); | ||
1876 | |||
1877 | static ssize_t | ||
1878 | errors_show(mdk_rdev_t *rdev, char *page) | 1867 | errors_show(mdk_rdev_t *rdev, char *page) |
1879 | { | 1868 | { |
1880 | return sprintf(page, "%d\n", atomic_read(&rdev->corrected_errors)); | 1869 | return sprintf(page, "%d\n", atomic_read(&rdev->corrected_errors)); |
@@ -2060,7 +2049,6 @@ __ATTR(size, S_IRUGO|S_IWUSR, rdev_size_show, rdev_size_store); | |||
2060 | 2049 | ||
2061 | static struct attribute *rdev_default_attrs[] = { | 2050 | static struct attribute *rdev_default_attrs[] = { |
2062 | &rdev_state.attr, | 2051 | &rdev_state.attr, |
2063 | &rdev_super.attr, | ||
2064 | &rdev_errors.attr, | 2052 | &rdev_errors.attr, |
2065 | &rdev_slot.attr, | 2053 | &rdev_slot.attr, |
2066 | &rdev_offset.attr, | 2054 | &rdev_offset.attr, |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 2d6f1a51359c..c574cf5efb5c 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -1143,7 +1143,7 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1143 | rdev = conf->disks[i].rdev; | 1143 | rdev = conf->disks[i].rdev; |
1144 | printk(KERN_INFO "raid5:%s: read error corrected (%lu sectors at %llu on %s)\n", | 1144 | printk(KERN_INFO "raid5:%s: read error corrected (%lu sectors at %llu on %s)\n", |
1145 | mdname(conf->mddev), STRIPE_SECTORS, | 1145 | mdname(conf->mddev), STRIPE_SECTORS, |
1146 | (unsigned long long)sh->sector + rdev->data_offset, | 1146 | (unsigned long long)(sh->sector + rdev->data_offset), |
1147 | bdevname(rdev->bdev, b)); | 1147 | bdevname(rdev->bdev, b)); |
1148 | clear_bit(R5_ReadError, &sh->dev[i].flags); | 1148 | clear_bit(R5_ReadError, &sh->dev[i].flags); |
1149 | clear_bit(R5_ReWrite, &sh->dev[i].flags); | 1149 | clear_bit(R5_ReWrite, &sh->dev[i].flags); |
@@ -1160,13 +1160,13 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1160 | if (conf->mddev->degraded) | 1160 | if (conf->mddev->degraded) |
1161 | printk(KERN_WARNING "raid5:%s: read error not correctable (sector %llu on %s).\n", | 1161 | printk(KERN_WARNING "raid5:%s: read error not correctable (sector %llu on %s).\n", |
1162 | mdname(conf->mddev), | 1162 | mdname(conf->mddev), |
1163 | (unsigned long long)sh->sector + rdev->data_offset, | 1163 | (unsigned long long)(sh->sector + rdev->data_offset), |
1164 | bdn); | 1164 | bdn); |
1165 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) | 1165 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) |
1166 | /* Oh, no!!! */ | 1166 | /* Oh, no!!! */ |
1167 | printk(KERN_WARNING "raid5:%s: read error NOT corrected!! (sector %llu on %s).\n", | 1167 | printk(KERN_WARNING "raid5:%s: read error NOT corrected!! (sector %llu on %s).\n", |
1168 | mdname(conf->mddev), | 1168 | mdname(conf->mddev), |
1169 | (unsigned long long)sh->sector + rdev->data_offset, | 1169 | (unsigned long long)(sh->sector + rdev->data_offset), |
1170 | bdn); | 1170 | bdn); |
1171 | else if (atomic_read(&rdev->read_errors) | 1171 | else if (atomic_read(&rdev->read_errors) |
1172 | > conf->max_nr_stripes) | 1172 | > conf->max_nr_stripes) |
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 168a8d3a5e55..7707b8c7394b 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -306,25 +306,22 @@ static irqreturn_t interrupt_hw(int irq, void *dev_id) | |||
306 | return IRQ_NONE; | 306 | return IRQ_NONE; |
307 | } | 307 | } |
308 | 308 | ||
309 | if( 0 != (dev->ext)) { | 309 | if (dev->ext) { |
310 | if( 0 != (dev->ext->irq_mask & isr )) { | 310 | if (dev->ext->irq_mask & isr) { |
311 | if( 0 != dev->ext->irq_func ) { | 311 | if (dev->ext->irq_func) |
312 | dev->ext->irq_func(dev, &isr); | 312 | dev->ext->irq_func(dev, &isr); |
313 | } | ||
314 | isr &= ~dev->ext->irq_mask; | 313 | isr &= ~dev->ext->irq_mask; |
315 | } | 314 | } |
316 | } | 315 | } |
317 | if (0 != (isr & (MASK_27))) { | 316 | if (0 != (isr & (MASK_27))) { |
318 | DEB_INT(("irq: RPS0 (0x%08x).\n",isr)); | 317 | DEB_INT(("irq: RPS0 (0x%08x).\n",isr)); |
319 | if( 0 != dev->vv_data && 0 != dev->vv_callback) { | 318 | if (dev->vv_data && dev->vv_callback) |
320 | dev->vv_callback(dev,isr); | 319 | dev->vv_callback(dev,isr); |
321 | } | ||
322 | isr &= ~MASK_27; | 320 | isr &= ~MASK_27; |
323 | } | 321 | } |
324 | if (0 != (isr & (MASK_28))) { | 322 | if (0 != (isr & (MASK_28))) { |
325 | if( 0 != dev->vv_data && 0 != dev->vv_callback) { | 323 | if (dev->vv_data && dev->vv_callback) |
326 | dev->vv_callback(dev,isr); | 324 | dev->vv_callback(dev,isr); |
327 | } | ||
328 | isr &= ~MASK_28; | 325 | isr &= ~MASK_28; |
329 | } | 326 | } |
330 | if (0 != (isr & (MASK_16|MASK_17))) { | 327 | if (0 != (isr & (MASK_16|MASK_17))) { |
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index f0703d8bc3e8..171afe7da6b6 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -272,7 +272,7 @@ static int fops_open(struct inode *inode, struct file *file) | |||
272 | 272 | ||
273 | result = 0; | 273 | result = 0; |
274 | out: | 274 | out: |
275 | if( fh != 0 && result != 0 ) { | 275 | if (fh && result != 0) { |
276 | kfree(fh); | 276 | kfree(fh); |
277 | file->private_data = NULL; | 277 | file->private_data = NULL; |
278 | } | 278 | } |
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index ed3f8268ed11..4c8b62e2c035 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -784,8 +784,8 @@ static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len, | |||
784 | { | 784 | { |
785 | struct net_device *dev = feed->priv; | 785 | struct net_device *dev = feed->priv; |
786 | 786 | ||
787 | if (buffer2 != 0) | 787 | if (buffer2) |
788 | printk(KERN_WARNING "buffer2 not 0: %p.\n", buffer2); | 788 | printk(KERN_WARNING "buffer2 not NULL: %p.\n", buffer2); |
789 | if (buffer1_len > 32768) | 789 | if (buffer1_len > 32768) |
790 | printk(KERN_WARNING "length > 32k: %zu.\n", buffer1_len); | 790 | printk(KERN_WARNING "length > 32k: %zu.\n", buffer1_len); |
791 | /* printk("TS callback: %u bytes, %u TS cells @ %p.\n", | 791 | /* printk("TS callback: %u bytes, %u TS cells @ %p.\n", |
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index 21935bf7059e..302cc67407c3 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c | |||
@@ -478,9 +478,9 @@ static int opera1_xilinx_load_firmware(struct usb_device *dev, | |||
478 | err("could not restart the USB controller CPU."); | 478 | err("could not restart the USB controller CPU."); |
479 | ret = -EINVAL; | 479 | ret = -EINVAL; |
480 | } | 480 | } |
481 | kfree(p); | ||
482 | } | 481 | } |
483 | } | 482 | } |
483 | kfree(p); | ||
484 | if (fw) { | 484 | if (fw) { |
485 | release_firmware(fw); | 485 | release_firmware(fw); |
486 | } | 486 | } |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 37072a21d8c9..1832966f53f3 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -305,7 +305,7 @@ comment "MPEG video encoders" | |||
305 | 305 | ||
306 | config VIDEO_CX2341X | 306 | config VIDEO_CX2341X |
307 | tristate "Conexant CX2341x MPEG encoders" | 307 | tristate "Conexant CX2341x MPEG encoders" |
308 | depends on VIDEO_V4L2 && EXPERIMENTAL | 308 | depends on VIDEO_V4L2 && EXPERIMENTAL && VIDEO_V4L2_COMMON |
309 | ---help--- | 309 | ---help--- |
310 | Support for the Conexant CX23416 MPEG encoders | 310 | Support for the Conexant CX23416 MPEG encoders |
311 | and CX23415 MPEG encoder/decoders. | 311 | and CX23415 MPEG encoder/decoders. |
@@ -382,7 +382,7 @@ endmenu # encoder / decoder chips | |||
382 | 382 | ||
383 | config VIDEO_VIVI | 383 | config VIDEO_VIVI |
384 | tristate "Virtual Video Driver" | 384 | tristate "Virtual Video Driver" |
385 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 | 385 | depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64 |
386 | select VIDEOBUF_VMALLOC | 386 | select VIDEOBUF_VMALLOC |
387 | default n | 387 | default n |
388 | ---help--- | 388 | ---help--- |
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index cbab53fc6243..fea2e723e34b 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c | |||
@@ -408,7 +408,7 @@ adv7170_detect_client (struct i2c_adapter *adapter, | |||
408 | return 0; | 408 | return 0; |
409 | 409 | ||
410 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 410 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
411 | if (client == 0) | 411 | if (!client) |
412 | return -ENOMEM; | 412 | return -ENOMEM; |
413 | client->addr = address; | 413 | client->addr = address; |
414 | client->adapter = adapter; | 414 | client->adapter = adapter; |
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 0d0c554bfdf7..10d4d89623f1 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c | |||
@@ -426,7 +426,7 @@ adv7175_detect_client (struct i2c_adapter *adapter, | |||
426 | return 0; | 426 | return 0; |
427 | 427 | ||
428 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 428 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
429 | if (client == 0) | 429 | if (!client) |
430 | return -ENOMEM; | 430 | return -ENOMEM; |
431 | client->addr = address; | 431 | client->addr = address; |
432 | client->adapter = adapter; | 432 | client->adapter = adapter; |
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 12d1b9248be5..e663cc045c41 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c | |||
@@ -524,7 +524,7 @@ bt819_detect_client (struct i2c_adapter *adapter, | |||
524 | return 0; | 524 | return 0; |
525 | 525 | ||
526 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 526 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
527 | if (client == 0) | 527 | if (!client) |
528 | return -ENOMEM; | 528 | return -ENOMEM; |
529 | client->addr = address; | 529 | client->addr = address; |
530 | client->adapter = adapter; | 530 | client->adapter = adapter; |
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index e1028a76c042..7dee2e3235ad 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c | |||
@@ -311,7 +311,7 @@ bt856_detect_client (struct i2c_adapter *adapter, | |||
311 | return 0; | 311 | return 0; |
312 | 312 | ||
313 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 313 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
314 | if (client == 0) | 314 | if (!client) |
315 | return -ENOMEM; | 315 | return -ENOMEM; |
316 | client->addr = address; | 316 | client->addr = address; |
317 | client->adapter = adapter; | 317 | client->adapter = adapter; |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 5404fcc5276d..a080c149cc6c 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -3389,7 +3389,6 @@ static struct video_device bttv_video_template = | |||
3389 | .vidiocgmbuf = vidiocgmbuf, | 3389 | .vidiocgmbuf = vidiocgmbuf, |
3390 | #endif | 3390 | #endif |
3391 | .vidioc_g_crop = bttv_g_crop, | 3391 | .vidioc_g_crop = bttv_g_crop, |
3392 | .vidioc_g_crop = bttv_g_crop, | ||
3393 | .vidioc_s_crop = bttv_s_crop, | 3392 | .vidioc_s_crop = bttv_s_crop, |
3394 | .vidioc_g_fbuf = bttv_g_fbuf, | 3393 | .vidioc_g_fbuf = bttv_g_fbuf, |
3395 | .vidioc_s_fbuf = bttv_s_fbuf, | 3394 | .vidioc_s_fbuf = bttv_s_fbuf, |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index e6b7f518c56e..8c9a8adf52de 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -2196,6 +2196,11 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) | |||
2196 | cx88_reset(core); | 2196 | cx88_reset(core); |
2197 | cx88_card_setup_pre_i2c(core); | 2197 | cx88_card_setup_pre_i2c(core); |
2198 | cx88_i2c_init(core, pci); | 2198 | cx88_i2c_init(core, pci); |
2199 | |||
2200 | /* load tuner module, if needed */ | ||
2201 | if (TUNER_ABSENT != core->board.tuner_type) | ||
2202 | request_module("tuner"); | ||
2203 | |||
2199 | cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL); | 2204 | cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL); |
2200 | cx88_card_setup(core); | 2205 | cx88_card_setup(core); |
2201 | cx88_ir_init(core, pci); | 2206 | cx88_ir_init(core, pci); |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 7f1931aed207..227179620d13 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1826,8 +1826,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1826 | cx_set(MO_PCI_INTMSK, core->pci_irqmask); | 1826 | cx_set(MO_PCI_INTMSK, core->pci_irqmask); |
1827 | 1827 | ||
1828 | /* load and configure helper modules */ | 1828 | /* load and configure helper modules */ |
1829 | if (TUNER_ABSENT != core->board.tuner_type) | ||
1830 | request_module("tuner"); | ||
1831 | 1829 | ||
1832 | if (core->board.audio_chip == AUDIO_CHIP_WM8775) | 1830 | if (core->board.audio_chip == AUDIO_CHIP_WM8775) |
1833 | request_module("wm8775"); | 1831 | request_module("wm8775"); |
diff --git a/drivers/media/video/dpc7146.c b/drivers/media/video/dpc7146.c index 566e479e2629..9ceb6b2f3949 100644 --- a/drivers/media/video/dpc7146.c +++ b/drivers/media/video/dpc7146.c | |||
@@ -131,7 +131,7 @@ static int dpc_probe(struct saa7146_dev* dev) | |||
131 | device_for_each_child(&dpc->i2c_adapter.dev, dpc, dpc_check_clients); | 131 | device_for_each_child(&dpc->i2c_adapter.dev, dpc, dpc_check_clients); |
132 | 132 | ||
133 | /* check if all devices are present */ | 133 | /* check if all devices are present */ |
134 | if( 0 == dpc->saa7111a ) { | 134 | if (!dpc->saa7111a) { |
135 | DEB_D(("dpc_v4l2.o: dpc_attach failed for this device.\n")); | 135 | DEB_D(("dpc_v4l2.o: dpc_attach failed for this device.\n")); |
136 | i2c_del_adapter(&dpc->i2c_adapter); | 136 | i2c_del_adapter(&dpc->i2c_adapter); |
137 | kfree(dpc); | 137 | kfree(dpc); |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 7d1537cab867..c1caaa855b99 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -267,7 +267,7 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val) | |||
267 | for (i = 0; i < 10; i++) { | 267 | for (i = 0; i < 10; i++) { |
268 | if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) | 268 | if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) |
269 | return ret; | 269 | return ret; |
270 | if (!((u8) ret) & 0x01) | 270 | if (!(ret & 0x01)) |
271 | return 0; | 271 | return 0; |
272 | msleep(5); | 272 | msleep(5); |
273 | } | 273 | } |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index d42f120354e5..948ca35e7ee8 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -54,7 +54,6 @@ | |||
54 | #include "ivtv-vbi.h" | 54 | #include "ivtv-vbi.h" |
55 | #include "ivtv-routing.h" | 55 | #include "ivtv-routing.h" |
56 | #include "ivtv-gpio.h" | 56 | #include "ivtv-gpio.h" |
57 | #include "ivtv-yuv.h" | ||
58 | 57 | ||
59 | #include <media/tveeprom.h> | 58 | #include <media/tveeprom.h> |
60 | #include <media/saa7115.h> | 59 | #include <media/saa7115.h> |
@@ -700,6 +699,9 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) | |||
700 | itv->vbi.in.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE; | 699 | itv->vbi.in.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE; |
701 | itv->vbi.sliced_in = &itv->vbi.in.fmt.sliced; | 700 | itv->vbi.sliced_in = &itv->vbi.in.fmt.sliced; |
702 | 701 | ||
702 | /* Init the sg table for osd/yuv output */ | ||
703 | sg_init_table(itv->udma.SGlist, IVTV_DMA_SG_OSD_ENT); | ||
704 | |||
703 | /* OSD */ | 705 | /* OSD */ |
704 | itv->osd_global_alpha_state = 1; | 706 | itv->osd_global_alpha_state = 1; |
705 | itv->osd_global_alpha = 255; | 707 | itv->osd_global_alpha = 255; |
@@ -1053,9 +1055,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev, | |||
1053 | goto free_io; | 1055 | goto free_io; |
1054 | } | 1056 | } |
1055 | 1057 | ||
1056 | /* Check yuv output filter table */ | ||
1057 | if (itv->has_cx23415) ivtv_yuv_filter_check(itv); | ||
1058 | |||
1059 | ivtv_gpio_init(itv); | 1058 | ivtv_gpio_init(itv); |
1060 | 1059 | ||
1061 | /* active i2c */ | 1060 | /* active i2c */ |
diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c index 425eb1063904..6dba55b7e25a 100644 --- a/drivers/media/video/ivtv/ivtv-firmware.c +++ b/drivers/media/video/ivtv/ivtv-firmware.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "ivtv-driver.h" | 22 | #include "ivtv-driver.h" |
23 | #include "ivtv-mailbox.h" | 23 | #include "ivtv-mailbox.h" |
24 | #include "ivtv-firmware.h" | 24 | #include "ivtv-firmware.h" |
25 | #include "ivtv-yuv.h" | ||
25 | #include <linux/firmware.h> | 26 | #include <linux/firmware.h> |
26 | 27 | ||
27 | #define IVTV_MASK_SPU_ENABLE 0xFFFFFFFE | 28 | #define IVTV_MASK_SPU_ENABLE 0xFFFFFFFE |
@@ -225,11 +226,14 @@ int ivtv_firmware_init(struct ivtv *itv) | |||
225 | return 0; | 226 | return 0; |
226 | 227 | ||
227 | itv->dec_mbox.mbox = ivtv_search_mailbox(itv->dec_mem, IVTV_DECODER_SIZE); | 228 | itv->dec_mbox.mbox = ivtv_search_mailbox(itv->dec_mem, IVTV_DECODER_SIZE); |
228 | if (itv->dec_mbox.mbox == NULL) | 229 | if (itv->dec_mbox.mbox == NULL) { |
229 | IVTV_ERR("Decoder mailbox not found\n"); | 230 | IVTV_ERR("Decoder mailbox not found\n"); |
230 | else if (itv->has_cx23415 && ivtv_vapi(itv, CX2341X_DEC_PING_FW, 0)) { | 231 | } else if (itv->has_cx23415 && ivtv_vapi(itv, CX2341X_DEC_PING_FW, 0)) { |
231 | IVTV_ERR("Decoder firmware dead!\n"); | 232 | IVTV_ERR("Decoder firmware dead!\n"); |
232 | itv->dec_mbox.mbox = NULL; | 233 | itv->dec_mbox.mbox = NULL; |
234 | } else { | ||
235 | /* Firmware okay, so check yuv output filter table */ | ||
236 | ivtv_yuv_filter_check(itv); | ||
233 | } | 237 | } |
234 | return itv->dec_mbox.mbox ? 0 : -ENODEV; | 238 | return itv->dec_mbox.mbox ? 0 : -ENODEV; |
235 | } | 239 | } |
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 58bab653330f..74fd6a01d4c4 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -647,7 +647,7 @@ struct dvb_frontend *microtune_attach(struct dvb_frontend *fe, | |||
647 | default: | 647 | default: |
648 | tuner_info("microtune %s found, not (yet?) supported, sorry :-/\n", | 648 | tuner_info("microtune %s found, not (yet?) supported, sorry :-/\n", |
649 | name); | 649 | name); |
650 | return 0; | 650 | return NULL; |
651 | } | 651 | } |
652 | 652 | ||
653 | strlcpy(fe->ops.tuner_ops.info.name, name, | 653 | strlcpy(fe->ops.tuner_ops.info.name, name, |
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index add6d0d680be..cb5a510f9251 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -221,9 +221,8 @@ static int mxb_probe(struct saa7146_dev* dev) | |||
221 | device_for_each_child(&mxb->i2c_adapter.dev, mxb, mxb_check_clients); | 221 | device_for_each_child(&mxb->i2c_adapter.dev, mxb, mxb_check_clients); |
222 | 222 | ||
223 | /* check if all devices are present */ | 223 | /* check if all devices are present */ |
224 | if( 0 == mxb->tea6420_1 || 0 == mxb->tea6420_2 || 0 == mxb->tea6415c | 224 | if (!mxb->tea6420_1 || !mxb->tea6420_2 || !mxb->tea6415c || |
225 | || 0 == mxb->tda9840 || 0 == mxb->saa7111a || 0 == mxb->tuner ) { | 225 | !mxb->tda9840 || !mxb->saa7111a || !mxb->tuner) { |
226 | |||
227 | printk("mxb: did not find all i2c devices. aborting\n"); | 226 | printk("mxb: did not find all i2c devices. aborting\n"); |
228 | i2c_del_adapter(&mxb->i2c_adapter); | 227 | i2c_del_adapter(&mxb->i2c_adapter); |
229 | kfree(mxb); | 228 | kfree(mxb); |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index 46f156fb108c..5a3e8d21a38a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c | |||
@@ -60,7 +60,7 @@ int pvr2_ctrl_set_mask_value(struct pvr2_ctrl *cptr,int mask,int val) | |||
60 | int ret = 0; | 60 | int ret = 0; |
61 | if (!cptr) return -EINVAL; | 61 | if (!cptr) return -EINVAL; |
62 | LOCK_TAKE(cptr->hdw->big_lock); do { | 62 | LOCK_TAKE(cptr->hdw->big_lock); do { |
63 | if (cptr->info->set_value != 0) { | 63 | if (cptr->info->set_value) { |
64 | if (cptr->info->type == pvr2_ctl_bitmask) { | 64 | if (cptr->info->type == pvr2_ctl_bitmask) { |
65 | mask &= cptr->info->def.type_bitmask.valid_bits; | 65 | mask &= cptr->info->def.type_bitmask.valid_bits; |
66 | } else if (cptr->info->type == pvr2_ctl_int) { | 66 | } else if (cptr->info->type == pvr2_ctl_int) { |
@@ -265,7 +265,7 @@ unsigned int pvr2_ctrl_get_v4lflags(struct pvr2_ctrl *cptr) | |||
265 | int pvr2_ctrl_is_writable(struct pvr2_ctrl *cptr) | 265 | int pvr2_ctrl_is_writable(struct pvr2_ctrl *cptr) |
266 | { | 266 | { |
267 | if (!cptr) return 0; | 267 | if (!cptr) return 0; |
268 | return cptr->info->set_value != 0; | 268 | return cptr->info->set_value != NULL; |
269 | } | 269 | } |
270 | 270 | ||
271 | 271 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 41ae980405ed..d6955fa39598 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -2291,7 +2291,7 @@ static int pvr2_hdw_commit_setup(struct pvr2_hdw *hdw) | |||
2291 | 2291 | ||
2292 | for (idx = 0; idx < hdw->control_cnt; idx++) { | 2292 | for (idx = 0; idx < hdw->control_cnt; idx++) { |
2293 | cptr = hdw->controls + idx; | 2293 | cptr = hdw->controls + idx; |
2294 | if (cptr->info->is_dirty == 0) continue; | 2294 | if (!cptr->info->is_dirty) continue; |
2295 | if (!cptr->info->is_dirty(cptr)) continue; | 2295 | if (!cptr->info->is_dirty(cptr)) continue; |
2296 | commit_flag = !0; | 2296 | commit_flag = !0; |
2297 | 2297 | ||
@@ -2646,7 +2646,7 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, | |||
2646 | u16 address; | 2646 | u16 address; |
2647 | unsigned int pipe; | 2647 | unsigned int pipe; |
2648 | LOCK_TAKE(hdw->big_lock); do { | 2648 | LOCK_TAKE(hdw->big_lock); do { |
2649 | if ((hdw->fw_buffer == 0) == !enable_flag) break; | 2649 | if ((hdw->fw_buffer == NULL) == !enable_flag) break; |
2650 | 2650 | ||
2651 | if (!enable_flag) { | 2651 | if (!enable_flag) { |
2652 | pvr2_trace(PVR2_TRACE_FIRMWARE, | 2652 | pvr2_trace(PVR2_TRACE_FIRMWARE, |
@@ -2715,7 +2715,7 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, | |||
2715 | /* Return true if we're in a mode for retrieval CPU firmware */ | 2715 | /* Return true if we're in a mode for retrieval CPU firmware */ |
2716 | int pvr2_hdw_cpufw_get_enabled(struct pvr2_hdw *hdw) | 2716 | int pvr2_hdw_cpufw_get_enabled(struct pvr2_hdw *hdw) |
2717 | { | 2717 | { |
2718 | return hdw->fw_buffer != 0; | 2718 | return hdw->fw_buffer != NULL; |
2719 | } | 2719 | } |
2720 | 2720 | ||
2721 | 2721 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.c b/drivers/media/video/pvrusb2/pvrusb2-io.c index ce3c8982ffe0..a9889ff96ecc 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-io.c +++ b/drivers/media/video/pvrusb2/pvrusb2-io.c | |||
@@ -563,7 +563,7 @@ void pvr2_stream_kill(struct pvr2_stream *sp) | |||
563 | struct pvr2_buffer *bp; | 563 | struct pvr2_buffer *bp; |
564 | mutex_lock(&sp->mutex); do { | 564 | mutex_lock(&sp->mutex); do { |
565 | pvr2_stream_internal_flush(sp); | 565 | pvr2_stream_internal_flush(sp); |
566 | while ((bp = pvr2_stream_get_ready_buffer(sp)) != 0) { | 566 | while ((bp = pvr2_stream_get_ready_buffer(sp)) != NULL) { |
567 | pvr2_buffer_set_idle(bp); | 567 | pvr2_buffer_set_idle(bp); |
568 | } | 568 | } |
569 | if (sp->buffer_total_count != sp->buffer_target_count) { | 569 | if (sp->buffer_total_count != sp->buffer_target_count) { |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.c b/drivers/media/video/pvrusb2/pvrusb2-ioread.c index f782418afa45..c572212c9f15 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ioread.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.c | |||
@@ -165,7 +165,7 @@ static int pvr2_ioread_start(struct pvr2_ioread *cp) | |||
165 | if (!(cp->stream)) return 0; | 165 | if (!(cp->stream)) return 0; |
166 | pvr2_trace(PVR2_TRACE_START_STOP, | 166 | pvr2_trace(PVR2_TRACE_START_STOP, |
167 | "/*---TRACE_READ---*/ pvr2_ioread_start id=%p",cp); | 167 | "/*---TRACE_READ---*/ pvr2_ioread_start id=%p",cp); |
168 | while ((bp = pvr2_stream_get_idle_buffer(cp->stream)) != 0) { | 168 | while ((bp = pvr2_stream_get_idle_buffer(cp->stream)) != NULL) { |
169 | stat = pvr2_buffer_queue(bp); | 169 | stat = pvr2_buffer_queue(bp); |
170 | if (stat < 0) { | 170 | if (stat < 0) { |
171 | pvr2_trace(PVR2_TRACE_DATA_FLOW, | 171 | pvr2_trace(PVR2_TRACE_DATA_FLOW, |
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index f991d72fe108..e0a453a6543d 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -915,7 +915,7 @@ static void pwc_iso_stop(struct pwc_device *pdev) | |||
915 | struct urb *urb; | 915 | struct urb *urb; |
916 | 916 | ||
917 | urb = pdev->sbuf[i].urb; | 917 | urb = pdev->sbuf[i].urb; |
918 | if (urb != 0) { | 918 | if (urb) { |
919 | PWC_DEBUG_MEMORY("Unlinking URB %p\n", urb); | 919 | PWC_DEBUG_MEMORY("Unlinking URB %p\n", urb); |
920 | usb_kill_urb(urb); | 920 | usb_kill_urb(urb); |
921 | } | 921 | } |
@@ -931,7 +931,7 @@ static void pwc_iso_free(struct pwc_device *pdev) | |||
931 | struct urb *urb; | 931 | struct urb *urb; |
932 | 932 | ||
933 | urb = pdev->sbuf[i].urb; | 933 | urb = pdev->sbuf[i].urb; |
934 | if (urb != 0) { | 934 | if (urb) { |
935 | PWC_DEBUG_MEMORY("Freeing URB\n"); | 935 | PWC_DEBUG_MEMORY("Freeing URB\n"); |
936 | usb_free_urb(urb); | 936 | usb_free_urb(urb); |
937 | pdev->sbuf[i].urb = NULL; | 937 | pdev->sbuf[i].urb = NULL; |
@@ -1759,8 +1759,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1759 | 1759 | ||
1760 | /* Allocate video_device structure */ | 1760 | /* Allocate video_device structure */ |
1761 | pdev->vdev = video_device_alloc(); | 1761 | pdev->vdev = video_device_alloc(); |
1762 | if (pdev->vdev == 0) | 1762 | if (!pdev->vdev) { |
1763 | { | ||
1764 | PWC_ERROR("Err, cannot allocate video_device struture. Failing probe."); | 1763 | PWC_ERROR("Err, cannot allocate video_device struture. Failing probe."); |
1765 | kfree(pdev); | 1764 | kfree(pdev); |
1766 | return -ENOMEM; | 1765 | return -ENOMEM; |
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index 061134a7ba9f..1df2602cd184 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c | |||
@@ -488,7 +488,7 @@ saa7110_detect_client (struct i2c_adapter *adapter, | |||
488 | return 0; | 488 | return 0; |
489 | 489 | ||
490 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 490 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
491 | if (client == 0) | 491 | if (!client) |
492 | return -ENOMEM; | 492 | return -ENOMEM; |
493 | client->addr = address; | 493 | client->addr = address; |
494 | client->adapter = adapter; | 494 | client->adapter = adapter; |
@@ -496,7 +496,7 @@ saa7110_detect_client (struct i2c_adapter *adapter, | |||
496 | strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client))); | 496 | strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client))); |
497 | 497 | ||
498 | decoder = kzalloc(sizeof(struct saa7110), GFP_KERNEL); | 498 | decoder = kzalloc(sizeof(struct saa7110), GFP_KERNEL); |
499 | if (decoder == 0) { | 499 | if (!decoder) { |
500 | kfree(client); | 500 | kfree(client); |
501 | return -ENOMEM; | 501 | return -ENOMEM; |
502 | } | 502 | } |
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index 7ae2d646d000..a0772c53bb1f 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -502,7 +502,7 @@ saa7111_detect_client (struct i2c_adapter *adapter, | |||
502 | return 0; | 502 | return 0; |
503 | 503 | ||
504 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 504 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
505 | if (client == 0) | 505 | if (!client) |
506 | return -ENOMEM; | 506 | return -ENOMEM; |
507 | client->addr = address; | 507 | client->addr = address; |
508 | client->adapter = adapter; | 508 | client->adapter = adapter; |
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index 677df51de1a9..bf91a4faa706 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c | |||
@@ -841,7 +841,7 @@ saa7114_detect_client (struct i2c_adapter *adapter, | |||
841 | return 0; | 841 | return 0; |
842 | 842 | ||
843 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 843 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
844 | if (client == 0) | 844 | if (!client) |
845 | return -ENOMEM; | 845 | return -ENOMEM; |
846 | client->addr = address; | 846 | client->addr = address; |
847 | client->adapter = adapter; | 847 | client->adapter = adapter; |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 262830da08c8..6f5744286e8c 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -2484,27 +2484,28 @@ struct saa7134_board saa7134_boards[] = { | |||
2484 | .tuner_addr = ADDR_UNSET, | 2484 | .tuner_addr = ADDR_UNSET, |
2485 | .radio_addr = ADDR_UNSET, | 2485 | .radio_addr = ADDR_UNSET, |
2486 | .gpiomask = 0x080200000, | 2486 | .gpiomask = 0x080200000, |
2487 | .inputs = {{ | 2487 | .inputs = { { |
2488 | .name = name_tv, | 2488 | .name = name_tv, |
2489 | .vmux = 4, | 2489 | .vmux = 4, |
2490 | .amux = TV, | 2490 | .amux = TV, |
2491 | .tv = 1, | 2491 | .tv = 1, |
2492 | },{ | 2492 | }, { |
2493 | .name = name_comp1, | 2493 | .name = name_comp1, |
2494 | .vmux = 1, | 2494 | .vmux = 1, |
2495 | .amux = LINE2, | 2495 | .amux = LINE2, |
2496 | },{ | 2496 | }, { |
2497 | .name = name_comp2, | 2497 | .name = name_comp2, |
2498 | .vmux = 0, | 2498 | .vmux = 0, |
2499 | .amux = LINE2, | 2499 | .amux = LINE2, |
2500 | },{ | 2500 | }, { |
2501 | .name = name_svideo, | 2501 | .name = name_svideo, |
2502 | .vmux = 8, | 2502 | .vmux = 8, |
2503 | .amux = LINE2, | 2503 | .amux = LINE2, |
2504 | }}, | 2504 | } }, |
2505 | .radio = { | 2505 | .radio = { |
2506 | .name = name_radio, | 2506 | .name = name_radio, |
2507 | .amux = LINE1, | 2507 | .amux = TV, |
2508 | .gpio = 0x0200000, | ||
2508 | }, | 2509 | }, |
2509 | }, | 2510 | }, |
2510 | [SAA7134_BOARD_ASUSTeK_P7131_DUAL] = { | 2511 | [SAA7134_BOARD_ASUSTeK_P7131_DUAL] = { |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 52baa4f7f7dd..58ab163fdbd7 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -1022,12 +1022,13 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
1022 | saa7134_i2c_register(dev); | 1022 | saa7134_i2c_register(dev); |
1023 | 1023 | ||
1024 | /* initialize hardware #2 */ | 1024 | /* initialize hardware #2 */ |
1025 | if (TUNER_ABSENT != dev->tuner_type) | ||
1026 | request_module("tuner"); | ||
1025 | saa7134_board_init2(dev); | 1027 | saa7134_board_init2(dev); |
1028 | |||
1026 | saa7134_hwinit2(dev); | 1029 | saa7134_hwinit2(dev); |
1027 | 1030 | ||
1028 | /* load i2c helpers */ | 1031 | /* load i2c helpers */ |
1029 | if (TUNER_ABSENT != dev->tuner_type) | ||
1030 | request_module("tuner"); | ||
1031 | if (card_is_empress(dev)) { | 1032 | if (card_is_empress(dev)) { |
1032 | request_module("saa6752hs"); | 1033 | request_module("saa6752hs"); |
1033 | } | 1034 | } |
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 66cc92c0ea66..41f70440fd3b 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c | |||
@@ -403,7 +403,7 @@ saa7185_detect_client (struct i2c_adapter *adapter, | |||
403 | return 0; | 403 | return 0; |
404 | 404 | ||
405 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 405 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
406 | if (client == 0) | 406 | if (!client) |
407 | return -ENOMEM; | 407 | return -ENOMEM; |
408 | client->addr = address; | 408 | client->addr = address; |
409 | client->adapter = adapter; | 409 | client->adapter = adapter; |
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index ef494febb5e4..bdca5d278978 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c | |||
@@ -172,7 +172,7 @@ static int detect(struct i2c_adapter *adapter, int address, int kind) | |||
172 | 172 | ||
173 | /* allocate memory for client structure */ | 173 | /* allocate memory for client structure */ |
174 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 174 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); |
175 | if (0 == client) { | 175 | if (!client) { |
176 | printk("not enough kernel memory\n"); | 176 | printk("not enough kernel memory\n"); |
177 | return -ENOMEM; | 177 | return -ENOMEM; |
178 | } | 178 | } |
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index 523df0b8cc63..df2fad9f391e 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c | |||
@@ -64,7 +64,7 @@ static int detect(struct i2c_adapter *adapter, int address, int kind) | |||
64 | 64 | ||
65 | /* allocate memory for client structure */ | 65 | /* allocate memory for client structure */ |
66 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 66 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); |
67 | if (0 == client) { | 67 | if (!client) { |
68 | return -ENOMEM; | 68 | return -ENOMEM; |
69 | } | 69 | } |
70 | 70 | ||
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index ca05cd655087..4ff6c63f7237 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c | |||
@@ -101,7 +101,7 @@ static int tea6420_detect(struct i2c_adapter *adapter, int address, int kind) | |||
101 | 101 | ||
102 | /* allocate memory for client structure */ | 102 | /* allocate memory for client structure */ |
103 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | 103 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
104 | if (0 == client) { | 104 | if (!client) { |
105 | return -ENOMEM; | 105 | return -ENOMEM; |
106 | } | 106 | } |
107 | 107 | ||
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 445eba4174d7..b6e24e714a23 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -672,7 +672,7 @@ static int tvp5150_set_vbi(struct i2c_client *c, | |||
672 | if (std == V4L2_STD_ALL) { | 672 | if (std == V4L2_STD_ALL) { |
673 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); | 673 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); |
674 | return 0; | 674 | return 0; |
675 | } else if (std && V4L2_STD_625_50) { | 675 | } else if (std & V4L2_STD_625_50) { |
676 | /* Don't follow NTSC Line number convension */ | 676 | /* Don't follow NTSC Line number convension */ |
677 | line += 3; | 677 | line += 3; |
678 | } | 678 | } |
@@ -719,7 +719,7 @@ static int tvp5150_get_vbi(struct i2c_client *c, | |||
719 | if (std == V4L2_STD_ALL) { | 719 | if (std == V4L2_STD_ALL) { |
720 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); | 720 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); |
721 | return 0; | 721 | return 0; |
722 | } else if (std && V4L2_STD_625_50) { | 722 | } else if (std & V4L2_STD_625_50) { |
723 | /* Don't follow NTSC Line number convension */ | 723 | /* Don't follow NTSC Line number convension */ |
724 | line += 3; | 724 | line += 3; |
725 | } | 725 | } |
@@ -1072,12 +1072,12 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter, | |||
1072 | return 0; | 1072 | return 0; |
1073 | 1073 | ||
1074 | c = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 1074 | c = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); |
1075 | if (c == 0) | 1075 | if (!c) |
1076 | return -ENOMEM; | 1076 | return -ENOMEM; |
1077 | memcpy(c, &client_template, sizeof(struct i2c_client)); | 1077 | memcpy(c, &client_template, sizeof(struct i2c_client)); |
1078 | 1078 | ||
1079 | core = kzalloc(sizeof(struct tvp5150), GFP_KERNEL); | 1079 | core = kzalloc(sizeof(struct tvp5150), GFP_KERNEL); |
1080 | if (core == 0) { | 1080 | if (!core) { |
1081 | kfree(c); | 1081 | kfree(c); |
1082 | return -ENOMEM; | 1082 | return -ENOMEM; |
1083 | } | 1083 | } |
diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index fb434b5602a3..5d363be7bc73 100644 --- a/drivers/media/video/usbvideo/usbvideo.c +++ b/drivers/media/video/usbvideo/usbvideo.c | |||
@@ -1034,6 +1034,11 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) | |||
1034 | info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx", | 1034 | info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx", |
1035 | __FUNCTION__, uvd->iface, uvd->video_endp, uvd->paletteBits); | 1035 | __FUNCTION__, uvd->iface, uvd->video_endp, uvd->paletteBits); |
1036 | } | 1036 | } |
1037 | if (uvd->dev == NULL) { | ||
1038 | err("%s: uvd->dev == NULL", __FUNCTION__); | ||
1039 | return -EINVAL; | ||
1040 | } | ||
1041 | uvd->vdev.dev=&(uvd->dev->dev); | ||
1037 | if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | 1042 | if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { |
1038 | err("%s: video_register_device failed", __FUNCTION__); | 1043 | err("%s: video_register_device failed", __FUNCTION__); |
1039 | return -EPIPE; | 1044 | return -EPIPE; |
@@ -1041,10 +1046,6 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) | |||
1041 | if (uvd->debug > 1) { | 1046 | if (uvd->debug > 1) { |
1042 | info("%s: video_register_device() successful", __FUNCTION__); | 1047 | info("%s: video_register_device() successful", __FUNCTION__); |
1043 | } | 1048 | } |
1044 | if (uvd->dev == NULL) { | ||
1045 | err("%s: uvd->dev == NULL", __FUNCTION__); | ||
1046 | return -EINVAL; | ||
1047 | } | ||
1048 | 1049 | ||
1049 | info("%s on /dev/video%d: canvas=%s videosize=%s", | 1050 | info("%s on /dev/video%d: canvas=%s videosize=%s", |
1050 | (uvd->handle != NULL) ? uvd->handle->drvName : "???", | 1051 | (uvd->handle != NULL) ? uvd->handle->drvName : "???", |
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index dcf22a3b672a..50e1ff9f2be5 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c | |||
@@ -303,7 +303,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
303 | { | 303 | { |
304 | struct video_capability *cap = arg; | 304 | struct video_capability *cap = arg; |
305 | 305 | ||
306 | cap2 = kzalloc(sizeof(*cap2),GFP_KERNEL); | 306 | cap2 = kzalloc(sizeof(*cap2), GFP_KERNEL); |
307 | if (!cap2) { | ||
308 | err = -ENOMEM; | ||
309 | break; | ||
310 | } | ||
307 | memset(cap, 0, sizeof(*cap)); | 311 | memset(cap, 0, sizeof(*cap)); |
308 | memset(&fbuf2, 0, sizeof(fbuf2)); | 312 | memset(&fbuf2, 0, sizeof(fbuf2)); |
309 | 313 | ||
@@ -426,7 +430,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
426 | { | 430 | { |
427 | struct video_window *win = arg; | 431 | struct video_window *win = arg; |
428 | 432 | ||
429 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 433 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
434 | if (!fmt2) { | ||
435 | err = -ENOMEM; | ||
436 | break; | ||
437 | } | ||
430 | memset(win,0,sizeof(*win)); | 438 | memset(win,0,sizeof(*win)); |
431 | 439 | ||
432 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; | 440 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; |
@@ -464,7 +472,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
464 | struct video_window *win = arg; | 472 | struct video_window *win = arg; |
465 | int err1,err2; | 473 | int err1,err2; |
466 | 474 | ||
467 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 475 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
476 | if (!fmt2) { | ||
477 | err = -ENOMEM; | ||
478 | break; | ||
479 | } | ||
468 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 480 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
469 | drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); | 481 | drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); |
470 | err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); | 482 | err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); |
@@ -586,6 +598,12 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
586 | { | 598 | { |
587 | struct video_picture *pict = arg; | 599 | struct video_picture *pict = arg; |
588 | 600 | ||
601 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); | ||
602 | if (!fmt2) { | ||
603 | err = -ENOMEM; | ||
604 | break; | ||
605 | } | ||
606 | |||
589 | pict->brightness = get_v4l_control(inode, file, | 607 | pict->brightness = get_v4l_control(inode, file, |
590 | V4L2_CID_BRIGHTNESS,drv); | 608 | V4L2_CID_BRIGHTNESS,drv); |
591 | pict->hue = get_v4l_control(inode, file, | 609 | pict->hue = get_v4l_control(inode, file, |
@@ -597,7 +615,6 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
597 | pict->whiteness = get_v4l_control(inode, file, | 615 | pict->whiteness = get_v4l_control(inode, file, |
598 | V4L2_CID_WHITENESS, drv); | 616 | V4L2_CID_WHITENESS, drv); |
599 | 617 | ||
600 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | ||
601 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 618 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
602 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 619 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
603 | if (err < 0) { | 620 | if (err < 0) { |
@@ -617,6 +634,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
617 | struct video_picture *pict = arg; | 634 | struct video_picture *pict = arg; |
618 | int mem_err = 0, ovl_err = 0; | 635 | int mem_err = 0, ovl_err = 0; |
619 | 636 | ||
637 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); | ||
638 | if (!fmt2) { | ||
639 | err = -ENOMEM; | ||
640 | break; | ||
641 | } | ||
620 | memset(&fbuf2, 0, sizeof(fbuf2)); | 642 | memset(&fbuf2, 0, sizeof(fbuf2)); |
621 | 643 | ||
622 | set_v4l_control(inode, file, | 644 | set_v4l_control(inode, file, |
@@ -636,7 +658,6 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
636 | * different pixel formats for memory vs overlay. | 658 | * different pixel formats for memory vs overlay. |
637 | */ | 659 | */ |
638 | 660 | ||
639 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | ||
640 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 661 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
641 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 662 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
642 | /* If VIDIOC_G_FMT failed, then the driver likely doesn't | 663 | /* If VIDIOC_G_FMT failed, then the driver likely doesn't |
@@ -890,7 +911,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
890 | { | 911 | { |
891 | struct video_mmap *mm = arg; | 912 | struct video_mmap *mm = arg; |
892 | 913 | ||
893 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 914 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
915 | if (!fmt2) { | ||
916 | err = -ENOMEM; | ||
917 | break; | ||
918 | } | ||
894 | memset(&buf2,0,sizeof(buf2)); | 919 | memset(&buf2,0,sizeof(buf2)); |
895 | 920 | ||
896 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 921 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
@@ -986,7 +1011,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
986 | { | 1011 | { |
987 | struct vbi_format *fmt = arg; | 1012 | struct vbi_format *fmt = arg; |
988 | 1013 | ||
989 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 1014 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
1015 | if (!fmt2) { | ||
1016 | err = -ENOMEM; | ||
1017 | break; | ||
1018 | } | ||
990 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; | 1019 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; |
991 | 1020 | ||
992 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 1021 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
@@ -1018,8 +1047,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
1018 | break; | 1047 | break; |
1019 | } | 1048 | } |
1020 | 1049 | ||
1021 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 1050 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
1022 | 1051 | if (!fmt2) { | |
1052 | err = -ENOMEM; | ||
1053 | break; | ||
1054 | } | ||
1023 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; | 1055 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; |
1024 | fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; | 1056 | fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; |
1025 | fmt2->fmt.vbi.sampling_rate = fmt->sampling_rate; | 1057 | fmt2->fmt.vbi.sampling_rate = fmt->sampling_rate; |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index dd3d7d2c8b0e..fea4946ee713 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -339,7 +339,7 @@ v4l_fbuffer_alloc (struct file *file) | |||
339 | /* Use kmalloc */ | 339 | /* Use kmalloc */ |
340 | 340 | ||
341 | mem = kmalloc(fh->v4l_buffers.buffer_size, GFP_KERNEL); | 341 | mem = kmalloc(fh->v4l_buffers.buffer_size, GFP_KERNEL); |
342 | if (mem == 0) { | 342 | if (!mem) { |
343 | dprintk(1, | 343 | dprintk(1, |
344 | KERN_ERR | 344 | KERN_ERR |
345 | "%s: v4l_fbuffer_alloc() - kmalloc for V4L buf %d failed\n", | 345 | "%s: v4l_fbuffer_alloc() - kmalloc for V4L buf %d failed\n", |
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c index 1b44784d0efb..04949c823654 100644 --- a/drivers/media/video/zr364xx.c +++ b/drivers/media/video/zr364xx.c | |||
@@ -390,7 +390,7 @@ static int read_frame(struct zr364xx_camera *cam, int framenum) | |||
390 | } | 390 | } |
391 | 391 | ||
392 | 392 | ||
393 | static ssize_t zr364xx_read(struct file *file, char *buf, size_t cnt, | 393 | static ssize_t zr364xx_read(struct file *file, char __user *buf, size_t cnt, |
394 | loff_t * ppos) | 394 | loff_t * ppos) |
395 | { | 395 | { |
396 | unsigned long count = cnt; | 396 | unsigned long count = cnt; |
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c index de80dba12f9b..946e3d3506ac 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c | |||
@@ -276,8 +276,6 @@ void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, | |||
276 | mrq->need_card_int = 1; | 276 | mrq->need_card_int = 1; |
277 | else | 277 | else |
278 | mrq->need_card_int = 0; | 278 | mrq->need_card_int = 0; |
279 | |||
280 | mrq->get_int_reg = 0; | ||
281 | } | 279 | } |
282 | EXPORT_SYMBOL(memstick_init_req_sg); | 280 | EXPORT_SYMBOL(memstick_init_req_sg); |
283 | 281 | ||
@@ -311,8 +309,6 @@ void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, | |||
311 | mrq->need_card_int = 1; | 309 | mrq->need_card_int = 1; |
312 | else | 310 | else |
313 | mrq->need_card_int = 0; | 311 | mrq->need_card_int = 0; |
314 | |||
315 | mrq->get_int_reg = 0; | ||
316 | } | 312 | } |
317 | EXPORT_SYMBOL(memstick_init_req); | 313 | EXPORT_SYMBOL(memstick_init_req); |
318 | 314 | ||
@@ -342,6 +338,7 @@ static int h_memstick_read_dev_id(struct memstick_dev *card, | |||
342 | card->id.class = id_reg.class; | 338 | card->id.class = id_reg.class; |
343 | } | 339 | } |
344 | complete(&card->mrq_complete); | 340 | complete(&card->mrq_complete); |
341 | dev_dbg(&card->dev, "if_mode = %02x\n", id_reg.if_mode); | ||
345 | return -EAGAIN; | 342 | return -EAGAIN; |
346 | } | 343 | } |
347 | } | 344 | } |
@@ -422,7 +419,6 @@ static void memstick_power_on(struct memstick_host *host) | |||
422 | { | 419 | { |
423 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | 420 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); |
424 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); | 421 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); |
425 | msleep(1); | ||
426 | } | 422 | } |
427 | 423 | ||
428 | static void memstick_check(struct work_struct *work) | 424 | static void memstick_check(struct work_struct *work) |
@@ -579,7 +575,8 @@ EXPORT_SYMBOL(memstick_suspend_host); | |||
579 | void memstick_resume_host(struct memstick_host *host) | 575 | void memstick_resume_host(struct memstick_host *host) |
580 | { | 576 | { |
581 | mutex_lock(&host->lock); | 577 | mutex_lock(&host->lock); |
582 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | 578 | if (host->card) |
579 | memstick_power_on(host); | ||
583 | mutex_unlock(&host->lock); | 580 | mutex_unlock(&host->lock); |
584 | memstick_detect_change(host); | 581 | memstick_detect_change(host); |
585 | } | 582 | } |
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 1d637e4561d3..557dbbba5cb2 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
@@ -133,6 +133,7 @@ struct mspro_devinfo { | |||
133 | struct mspro_block_data { | 133 | struct mspro_block_data { |
134 | struct memstick_dev *card; | 134 | struct memstick_dev *card; |
135 | unsigned int usage_count; | 135 | unsigned int usage_count; |
136 | unsigned int caps; | ||
136 | struct gendisk *disk; | 137 | struct gendisk *disk; |
137 | struct request_queue *queue; | 138 | struct request_queue *queue; |
138 | spinlock_t q_lock; | 139 | spinlock_t q_lock; |
@@ -577,7 +578,6 @@ static int h_mspro_block_wait_for_ced(struct memstick_dev *card, | |||
577 | static int h_mspro_block_transfer_data(struct memstick_dev *card, | 578 | static int h_mspro_block_transfer_data(struct memstick_dev *card, |
578 | struct memstick_request **mrq) | 579 | struct memstick_request **mrq) |
579 | { | 580 | { |
580 | struct memstick_host *host = card->host; | ||
581 | struct mspro_block_data *msb = memstick_get_drvdata(card); | 581 | struct mspro_block_data *msb = memstick_get_drvdata(card); |
582 | unsigned char t_val = 0; | 582 | unsigned char t_val = 0; |
583 | struct scatterlist t_sg = { 0 }; | 583 | struct scatterlist t_sg = { 0 }; |
@@ -591,12 +591,12 @@ static int h_mspro_block_transfer_data(struct memstick_dev *card, | |||
591 | switch ((*mrq)->tpc) { | 591 | switch ((*mrq)->tpc) { |
592 | case MS_TPC_WRITE_REG: | 592 | case MS_TPC_WRITE_REG: |
593 | memstick_init_req(*mrq, MS_TPC_SET_CMD, &msb->transfer_cmd, 1); | 593 | memstick_init_req(*mrq, MS_TPC_SET_CMD, &msb->transfer_cmd, 1); |
594 | (*mrq)->get_int_reg = 1; | 594 | (*mrq)->need_card_int = 1; |
595 | return 0; | 595 | return 0; |
596 | case MS_TPC_SET_CMD: | 596 | case MS_TPC_SET_CMD: |
597 | t_val = (*mrq)->int_reg; | 597 | t_val = (*mrq)->int_reg; |
598 | memstick_init_req(*mrq, MS_TPC_GET_INT, NULL, 1); | 598 | memstick_init_req(*mrq, MS_TPC_GET_INT, NULL, 1); |
599 | if (host->caps & MEMSTICK_CAP_AUTO_GET_INT) | 599 | if (msb->caps & MEMSTICK_CAP_AUTO_GET_INT) |
600 | goto has_int_reg; | 600 | goto has_int_reg; |
601 | return 0; | 601 | return 0; |
602 | case MS_TPC_GET_INT: | 602 | case MS_TPC_GET_INT: |
@@ -646,12 +646,12 @@ has_int_reg: | |||
646 | ? MS_TPC_READ_LONG_DATA | 646 | ? MS_TPC_READ_LONG_DATA |
647 | : MS_TPC_WRITE_LONG_DATA, | 647 | : MS_TPC_WRITE_LONG_DATA, |
648 | &t_sg); | 648 | &t_sg); |
649 | (*mrq)->get_int_reg = 1; | 649 | (*mrq)->need_card_int = 1; |
650 | return 0; | 650 | return 0; |
651 | case MS_TPC_READ_LONG_DATA: | 651 | case MS_TPC_READ_LONG_DATA: |
652 | case MS_TPC_WRITE_LONG_DATA: | 652 | case MS_TPC_WRITE_LONG_DATA: |
653 | msb->current_page++; | 653 | msb->current_page++; |
654 | if (host->caps & MEMSTICK_CAP_AUTO_GET_INT) { | 654 | if (msb->caps & MEMSTICK_CAP_AUTO_GET_INT) { |
655 | t_val = (*mrq)->int_reg; | 655 | t_val = (*mrq)->int_reg; |
656 | goto has_int_reg; | 656 | goto has_int_reg; |
657 | } else { | 657 | } else { |
@@ -816,12 +816,13 @@ static int mspro_block_wait_for_ced(struct memstick_dev *card) | |||
816 | return card->current_mrq.error; | 816 | return card->current_mrq.error; |
817 | } | 817 | } |
818 | 818 | ||
819 | static int mspro_block_switch_to_parallel(struct memstick_dev *card) | 819 | static int mspro_block_set_interface(struct memstick_dev *card, |
820 | unsigned char sys_reg) | ||
820 | { | 821 | { |
821 | struct memstick_host *host = card->host; | 822 | struct memstick_host *host = card->host; |
822 | struct mspro_block_data *msb = memstick_get_drvdata(card); | 823 | struct mspro_block_data *msb = memstick_get_drvdata(card); |
823 | struct mspro_param_register param = { | 824 | struct mspro_param_register param = { |
824 | .system = MEMSTICK_SYS_PAR4, | 825 | .system = sys_reg, |
825 | .data_count = 0, | 826 | .data_count = 0, |
826 | .data_address = 0, | 827 | .data_address = 0, |
827 | .tpc_param = 0 | 828 | .tpc_param = 0 |
@@ -833,41 +834,70 @@ static int mspro_block_switch_to_parallel(struct memstick_dev *card) | |||
833 | sizeof(param)); | 834 | sizeof(param)); |
834 | memstick_new_req(host); | 835 | memstick_new_req(host); |
835 | wait_for_completion(&card->mrq_complete); | 836 | wait_for_completion(&card->mrq_complete); |
836 | if (card->current_mrq.error) | 837 | return card->current_mrq.error; |
837 | return card->current_mrq.error; | 838 | } |
839 | |||
840 | static int mspro_block_switch_interface(struct memstick_dev *card) | ||
841 | { | ||
842 | struct memstick_host *host = card->host; | ||
843 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
844 | int rc = 0; | ||
845 | |||
846 | if (msb->caps & MEMSTICK_CAP_PAR4) | ||
847 | rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR4); | ||
848 | else | ||
849 | return 0; | ||
850 | |||
851 | if (rc) { | ||
852 | printk(KERN_WARNING | ||
853 | "%s: could not switch to 4-bit mode, error %d\n", | ||
854 | card->dev.bus_id, rc); | ||
855 | return 0; | ||
856 | } | ||
838 | 857 | ||
839 | msb->system = MEMSTICK_SYS_PAR4; | 858 | msb->system = MEMSTICK_SYS_PAR4; |
840 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4); | 859 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4); |
860 | printk(KERN_INFO "%s: switching to 4-bit parallel mode\n", | ||
861 | card->dev.bus_id); | ||
862 | |||
863 | if (msb->caps & MEMSTICK_CAP_PAR8) { | ||
864 | rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR8); | ||
865 | |||
866 | if (!rc) { | ||
867 | msb->system = MEMSTICK_SYS_PAR8; | ||
868 | host->set_param(host, MEMSTICK_INTERFACE, | ||
869 | MEMSTICK_PAR8); | ||
870 | printk(KERN_INFO | ||
871 | "%s: switching to 8-bit parallel mode\n", | ||
872 | card->dev.bus_id); | ||
873 | } else | ||
874 | printk(KERN_WARNING | ||
875 | "%s: could not switch to 8-bit mode, error %d\n", | ||
876 | card->dev.bus_id, rc); | ||
877 | } | ||
841 | 878 | ||
842 | card->next_request = h_mspro_block_req_init; | 879 | card->next_request = h_mspro_block_req_init; |
843 | msb->mrq_handler = h_mspro_block_default; | 880 | msb->mrq_handler = h_mspro_block_default; |
844 | memstick_init_req(&card->current_mrq, MS_TPC_GET_INT, NULL, 1); | 881 | memstick_init_req(&card->current_mrq, MS_TPC_GET_INT, NULL, 1); |
845 | memstick_new_req(card->host); | 882 | memstick_new_req(card->host); |
846 | wait_for_completion(&card->mrq_complete); | 883 | wait_for_completion(&card->mrq_complete); |
884 | rc = card->current_mrq.error; | ||
847 | 885 | ||
848 | if (card->current_mrq.error) { | 886 | if (rc) { |
887 | printk(KERN_WARNING | ||
888 | "%s: interface error, trying to fall back to serial\n", | ||
889 | card->dev.bus_id); | ||
849 | msb->system = MEMSTICK_SYS_SERIAL; | 890 | msb->system = MEMSTICK_SYS_SERIAL; |
850 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); | 891 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); |
851 | msleep(1000); | 892 | msleep(10); |
852 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | 893 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); |
853 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); | 894 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); |
854 | 895 | ||
855 | if (memstick_set_rw_addr(card)) | 896 | rc = memstick_set_rw_addr(card); |
856 | return card->current_mrq.error; | 897 | if (!rc) |
857 | 898 | rc = mspro_block_set_interface(card, msb->system); | |
858 | param.system = msb->system; | ||
859 | |||
860 | card->next_request = h_mspro_block_req_init; | ||
861 | msb->mrq_handler = h_mspro_block_default; | ||
862 | memstick_init_req(&card->current_mrq, MS_TPC_WRITE_REG, ¶m, | ||
863 | sizeof(param)); | ||
864 | memstick_new_req(host); | ||
865 | wait_for_completion(&card->mrq_complete); | ||
866 | |||
867 | return -EFAULT; | ||
868 | } | 899 | } |
869 | 900 | return rc; | |
870 | return 0; | ||
871 | } | 901 | } |
872 | 902 | ||
873 | /* Memory allocated for attributes by this function should be freed by | 903 | /* Memory allocated for attributes by this function should be freed by |
@@ -1052,16 +1082,18 @@ static int mspro_block_init_card(struct memstick_dev *card) | |||
1052 | if (memstick_set_rw_addr(card)) | 1082 | if (memstick_set_rw_addr(card)) |
1053 | return -EIO; | 1083 | return -EIO; |
1054 | 1084 | ||
1055 | if (host->caps & MEMSTICK_CAP_PAR4) { | 1085 | msb->caps = host->caps; |
1056 | if (mspro_block_switch_to_parallel(card)) | 1086 | rc = mspro_block_switch_interface(card); |
1057 | printk(KERN_WARNING "%s: could not switch to " | 1087 | if (rc) |
1058 | "parallel interface\n", card->dev.bus_id); | 1088 | return rc; |
1059 | } | ||
1060 | 1089 | ||
1090 | msleep(200); | ||
1061 | rc = mspro_block_wait_for_ced(card); | 1091 | rc = mspro_block_wait_for_ced(card); |
1062 | if (rc) | 1092 | if (rc) |
1063 | return rc; | 1093 | return rc; |
1064 | dev_dbg(&card->dev, "card activated\n"); | 1094 | dev_dbg(&card->dev, "card activated\n"); |
1095 | if (msb->system != MEMSTICK_SYS_SERIAL) | ||
1096 | msb->caps |= MEMSTICK_CAP_AUTO_GET_INT; | ||
1065 | 1097 | ||
1066 | card->next_request = h_mspro_block_req_init; | 1098 | card->next_request = h_mspro_block_req_init; |
1067 | msb->mrq_handler = h_mspro_block_get_ro; | 1099 | msb->mrq_handler = h_mspro_block_get_ro; |
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c index 03fe8783b1ee..8770a5fac3b6 100644 --- a/drivers/memstick/host/jmb38x_ms.c +++ b/drivers/memstick/host/jmb38x_ms.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
15 | #include <linux/dma-mapping.h> | ||
15 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
16 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
17 | #include <linux/memstick.h> | 18 | #include <linux/memstick.h> |
@@ -56,8 +57,6 @@ struct jmb38x_ms_host { | |||
56 | unsigned long timeout_jiffies; | 57 | unsigned long timeout_jiffies; |
57 | struct timer_list timer; | 58 | struct timer_list timer; |
58 | struct memstick_request *req; | 59 | struct memstick_request *req; |
59 | unsigned char eject:1, | ||
60 | use_dma:1; | ||
61 | unsigned char cmd_flags; | 60 | unsigned char cmd_flags; |
62 | unsigned char io_pos; | 61 | unsigned char io_pos; |
63 | unsigned int io_word[2]; | 62 | unsigned int io_word[2]; |
@@ -94,9 +93,22 @@ struct jmb38x_ms { | |||
94 | #define HOST_CONTROL_IF_PAR4 0x1 | 93 | #define HOST_CONTROL_IF_PAR4 0x1 |
95 | #define HOST_CONTROL_IF_PAR8 0x3 | 94 | #define HOST_CONTROL_IF_PAR8 0x3 |
96 | 95 | ||
96 | #define STATUS_BUSY 0x00080000 | ||
97 | #define STATUS_MS_DAT7 0x00040000 | ||
98 | #define STATUS_MS_DAT6 0x00020000 | ||
99 | #define STATUS_MS_DAT5 0x00010000 | ||
100 | #define STATUS_MS_DAT4 0x00008000 | ||
101 | #define STATUS_MS_DAT3 0x00004000 | ||
102 | #define STATUS_MS_DAT2 0x00002000 | ||
103 | #define STATUS_MS_DAT1 0x00001000 | ||
104 | #define STATUS_MS_DAT0 0x00000800 | ||
97 | #define STATUS_HAS_MEDIA 0x00000400 | 105 | #define STATUS_HAS_MEDIA 0x00000400 |
98 | #define STATUS_FIFO_EMPTY 0x00000200 | 106 | #define STATUS_FIFO_EMPTY 0x00000200 |
99 | #define STATUS_FIFO_FULL 0x00000100 | 107 | #define STATUS_FIFO_FULL 0x00000100 |
108 | #define STATUS_MS_CED 0x00000080 | ||
109 | #define STATUS_MS_ERR 0x00000040 | ||
110 | #define STATUS_MS_BRQ 0x00000020 | ||
111 | #define STATUS_MS_CNK 0x00000001 | ||
100 | 112 | ||
101 | #define INT_STATUS_TPC_ERR 0x00080000 | 113 | #define INT_STATUS_TPC_ERR 0x00080000 |
102 | #define INT_STATUS_CRC_ERR 0x00040000 | 114 | #define INT_STATUS_CRC_ERR 0x00040000 |
@@ -119,11 +131,17 @@ struct jmb38x_ms { | |||
119 | #define PAD_PU_PD_ON_MS_SOCK0 0x5f8f0000 | 131 | #define PAD_PU_PD_ON_MS_SOCK0 0x5f8f0000 |
120 | #define PAD_PU_PD_ON_MS_SOCK1 0x0f0f0000 | 132 | #define PAD_PU_PD_ON_MS_SOCK1 0x0f0f0000 |
121 | 133 | ||
134 | #define CLOCK_CONTROL_40MHZ 0x00000001 | ||
135 | #define CLOCK_CONTROL_50MHZ 0x00000002 | ||
136 | #define CLOCK_CONTROL_60MHZ 0x00000008 | ||
137 | #define CLOCK_CONTROL_62_5MHZ 0x0000000c | ||
138 | #define CLOCK_CONTROL_OFF 0x00000000 | ||
139 | |||
122 | enum { | 140 | enum { |
123 | CMD_READY = 0x01, | 141 | CMD_READY = 0x01, |
124 | FIFO_READY = 0x02, | 142 | FIFO_READY = 0x02, |
125 | REG_DATA = 0x04, | 143 | REG_DATA = 0x04, |
126 | AUTO_GET_INT = 0x08 | 144 | DMA_DATA = 0x08 |
127 | }; | 145 | }; |
128 | 146 | ||
129 | static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host, | 147 | static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host, |
@@ -273,7 +291,7 @@ static int jmb38x_ms_transfer_data(struct jmb38x_ms_host *host) | |||
273 | { | 291 | { |
274 | unsigned int length; | 292 | unsigned int length; |
275 | unsigned int off; | 293 | unsigned int off; |
276 | unsigned int t_size, p_off, p_cnt; | 294 | unsigned int t_size, p_cnt; |
277 | unsigned char *buf; | 295 | unsigned char *buf; |
278 | struct page *pg; | 296 | struct page *pg; |
279 | unsigned long flags = 0; | 297 | unsigned long flags = 0; |
@@ -287,6 +305,8 @@ static int jmb38x_ms_transfer_data(struct jmb38x_ms_host *host) | |||
287 | } | 305 | } |
288 | 306 | ||
289 | while (length) { | 307 | while (length) { |
308 | unsigned int uninitialized_var(p_off); | ||
309 | |||
290 | if (host->req->long_data) { | 310 | if (host->req->long_data) { |
291 | pg = nth_page(sg_page(&host->req->sg), | 311 | pg = nth_page(sg_page(&host->req->sg), |
292 | off >> PAGE_SHIFT); | 312 | off >> PAGE_SHIFT); |
@@ -364,28 +384,27 @@ static int jmb38x_ms_issue_cmd(struct memstick_host *msh) | |||
364 | cmd |= TPC_DIR; | 384 | cmd |= TPC_DIR; |
365 | if (host->req->need_card_int) | 385 | if (host->req->need_card_int) |
366 | cmd |= TPC_WAIT_INT; | 386 | cmd |= TPC_WAIT_INT; |
367 | if (host->req->get_int_reg) | ||
368 | cmd |= TPC_GET_INT; | ||
369 | 387 | ||
370 | data = host->req->data; | 388 | data = host->req->data; |
371 | 389 | ||
372 | host->use_dma = !no_dma; | 390 | if (!no_dma) |
391 | host->cmd_flags |= DMA_DATA; | ||
373 | 392 | ||
374 | if (host->req->long_data) { | 393 | if (host->req->long_data) { |
375 | data_len = host->req->sg.length; | 394 | data_len = host->req->sg.length; |
376 | } else { | 395 | } else { |
377 | data_len = host->req->data_len; | 396 | data_len = host->req->data_len; |
378 | host->use_dma = 0; | 397 | host->cmd_flags &= ~DMA_DATA; |
379 | } | 398 | } |
380 | 399 | ||
381 | if (data_len <= 8) { | 400 | if (data_len <= 8) { |
382 | cmd &= ~(TPC_DATA_SEL | 0xf); | 401 | cmd &= ~(TPC_DATA_SEL | 0xf); |
383 | host->cmd_flags |= REG_DATA; | 402 | host->cmd_flags |= REG_DATA; |
384 | cmd |= data_len & 0xf; | 403 | cmd |= data_len & 0xf; |
385 | host->use_dma = 0; | 404 | host->cmd_flags &= ~DMA_DATA; |
386 | } | 405 | } |
387 | 406 | ||
388 | if (host->use_dma) { | 407 | if (host->cmd_flags & DMA_DATA) { |
389 | if (1 != pci_map_sg(host->chip->pdev, &host->req->sg, 1, | 408 | if (1 != pci_map_sg(host->chip->pdev, &host->req->sg, 1, |
390 | host->req->data_dir == READ | 409 | host->req->data_dir == READ |
391 | ? PCI_DMA_FROMDEVICE | 410 | ? PCI_DMA_FROMDEVICE |
@@ -448,13 +467,12 @@ static void jmb38x_ms_complete_cmd(struct memstick_host *msh, int last) | |||
448 | readl(host->addr + INT_STATUS)); | 467 | readl(host->addr + INT_STATUS)); |
449 | dev_dbg(msh->cdev.dev, "c hstatus %08x\n", readl(host->addr + STATUS)); | 468 | dev_dbg(msh->cdev.dev, "c hstatus %08x\n", readl(host->addr + STATUS)); |
450 | 469 | ||
451 | if (host->req->get_int_reg) { | 470 | host->req->int_reg = readl(host->addr + STATUS) & 0xff; |
452 | t_val = readl(host->addr + TPC_P0); | 471 | |
453 | host->req->int_reg = (t_val & 0xff); | 472 | writel(0, host->addr + BLOCK); |
454 | } | 473 | writel(0, host->addr + DMA_CONTROL); |
455 | 474 | ||
456 | if (host->use_dma) { | 475 | if (host->cmd_flags & DMA_DATA) { |
457 | writel(0, host->addr + DMA_CONTROL); | ||
458 | pci_unmap_sg(host->chip->pdev, &host->req->sg, 1, | 476 | pci_unmap_sg(host->chip->pdev, &host->req->sg, 1, |
459 | host->req->data_dir == READ | 477 | host->req->data_dir == READ |
460 | ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); | 478 | ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); |
@@ -506,7 +524,7 @@ static irqreturn_t jmb38x_ms_isr(int irq, void *dev_id) | |||
506 | else | 524 | else |
507 | host->req->error = -ETIME; | 525 | host->req->error = -ETIME; |
508 | } else { | 526 | } else { |
509 | if (host->use_dma) { | 527 | if (host->cmd_flags & DMA_DATA) { |
510 | if (irq_status & INT_STATUS_EOTRAN) | 528 | if (irq_status & INT_STATUS_EOTRAN) |
511 | host->cmd_flags |= FIFO_READY; | 529 | host->cmd_flags |= FIFO_READY; |
512 | } else { | 530 | } else { |
@@ -595,19 +613,18 @@ static void jmb38x_ms_reset(struct jmb38x_ms_host *host) | |||
595 | { | 613 | { |
596 | unsigned int host_ctl = readl(host->addr + HOST_CONTROL); | 614 | unsigned int host_ctl = readl(host->addr + HOST_CONTROL); |
597 | 615 | ||
598 | writel(host_ctl | HOST_CONTROL_RESET_REQ | HOST_CONTROL_RESET, | 616 | writel(HOST_CONTROL_RESET_REQ, host->addr + HOST_CONTROL); |
599 | host->addr + HOST_CONTROL); | ||
600 | 617 | ||
601 | while (HOST_CONTROL_RESET_REQ | 618 | while (HOST_CONTROL_RESET_REQ |
602 | & (host_ctl = readl(host->addr + HOST_CONTROL))) { | 619 | & (host_ctl = readl(host->addr + HOST_CONTROL))) { |
603 | ndelay(100); | 620 | ndelay(20); |
604 | dev_dbg(&host->chip->pdev->dev, "reset\n"); | 621 | dev_dbg(&host->chip->pdev->dev, "reset %08x\n", host_ctl); |
605 | } | 622 | } |
606 | 623 | ||
607 | writel(INT_STATUS_ALL, host->addr + INT_STATUS_ENABLE); | 624 | writel(HOST_CONTROL_RESET, host->addr + HOST_CONTROL); |
625 | mmiowb(); | ||
608 | writel(INT_STATUS_ALL, host->addr + INT_SIGNAL_ENABLE); | 626 | writel(INT_STATUS_ALL, host->addr + INT_SIGNAL_ENABLE); |
609 | 627 | writel(INT_STATUS_ALL, host->addr + INT_STATUS_ENABLE); | |
610 | dev_dbg(&host->chip->pdev->dev, "reset\n"); | ||
611 | } | 628 | } |
612 | 629 | ||
613 | static void jmb38x_ms_set_param(struct memstick_host *msh, | 630 | static void jmb38x_ms_set_param(struct memstick_host *msh, |
@@ -615,10 +632,8 @@ static void jmb38x_ms_set_param(struct memstick_host *msh, | |||
615 | int value) | 632 | int value) |
616 | { | 633 | { |
617 | struct jmb38x_ms_host *host = memstick_priv(msh); | 634 | struct jmb38x_ms_host *host = memstick_priv(msh); |
618 | unsigned int host_ctl; | 635 | unsigned int host_ctl = readl(host->addr + HOST_CONTROL); |
619 | unsigned long flags; | 636 | unsigned int clock_ctl = CLOCK_CONTROL_40MHZ, clock_delay = 0; |
620 | |||
621 | spin_lock_irqsave(&host->lock, flags); | ||
622 | 637 | ||
623 | switch (param) { | 638 | switch (param) { |
624 | case MEMSTICK_POWER: | 639 | case MEMSTICK_POWER: |
@@ -626,60 +641,57 @@ static void jmb38x_ms_set_param(struct memstick_host *msh, | |||
626 | jmb38x_ms_reset(host); | 641 | jmb38x_ms_reset(host); |
627 | 642 | ||
628 | writel(host->id ? PAD_PU_PD_ON_MS_SOCK1 | 643 | writel(host->id ? PAD_PU_PD_ON_MS_SOCK1 |
629 | : PAD_PU_PD_ON_MS_SOCK0, | 644 | : PAD_PU_PD_ON_MS_SOCK0, |
630 | host->addr + PAD_PU_PD); | 645 | host->addr + PAD_PU_PD); |
631 | 646 | ||
632 | writel(PAD_OUTPUT_ENABLE_MS, | 647 | writel(PAD_OUTPUT_ENABLE_MS, |
633 | host->addr + PAD_OUTPUT_ENABLE); | 648 | host->addr + PAD_OUTPUT_ENABLE); |
634 | 649 | ||
635 | host_ctl = readl(host->addr + HOST_CONTROL); | 650 | host_ctl = 7; |
636 | host_ctl |= 7; | 651 | host_ctl |= HOST_CONTROL_POWER_EN |
637 | writel(host_ctl | (HOST_CONTROL_POWER_EN | 652 | | HOST_CONTROL_CLOCK_EN; |
638 | | HOST_CONTROL_CLOCK_EN), | 653 | writel(host_ctl, host->addr + HOST_CONTROL); |
639 | host->addr + HOST_CONTROL); | ||
640 | 654 | ||
641 | dev_dbg(&host->chip->pdev->dev, "power on\n"); | 655 | dev_dbg(&host->chip->pdev->dev, "power on\n"); |
642 | } else if (value == MEMSTICK_POWER_OFF) { | 656 | } else if (value == MEMSTICK_POWER_OFF) { |
643 | writel(readl(host->addr + HOST_CONTROL) | 657 | host_ctl &= ~(HOST_CONTROL_POWER_EN |
644 | & ~(HOST_CONTROL_POWER_EN | 658 | | HOST_CONTROL_CLOCK_EN); |
645 | | HOST_CONTROL_CLOCK_EN), | 659 | writel(host_ctl, host->addr + HOST_CONTROL); |
646 | host->addr + HOST_CONTROL); | ||
647 | writel(0, host->addr + PAD_OUTPUT_ENABLE); | 660 | writel(0, host->addr + PAD_OUTPUT_ENABLE); |
648 | writel(PAD_PU_PD_OFF, host->addr + PAD_PU_PD); | 661 | writel(PAD_PU_PD_OFF, host->addr + PAD_PU_PD); |
649 | dev_dbg(&host->chip->pdev->dev, "power off\n"); | 662 | dev_dbg(&host->chip->pdev->dev, "power off\n"); |
650 | } | 663 | } |
651 | break; | 664 | break; |
652 | case MEMSTICK_INTERFACE: | 665 | case MEMSTICK_INTERFACE: |
653 | /* jmb38x_ms_reset(host); */ | ||
654 | |||
655 | host_ctl = readl(host->addr + HOST_CONTROL); | ||
656 | host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT); | 666 | host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT); |
657 | /* host_ctl |= 7; */ | ||
658 | 667 | ||
659 | if (value == MEMSTICK_SERIAL) { | 668 | if (value == MEMSTICK_SERIAL) { |
660 | host_ctl &= ~HOST_CONTROL_FAST_CLK; | 669 | host_ctl &= ~HOST_CONTROL_FAST_CLK; |
661 | host_ctl |= HOST_CONTROL_IF_SERIAL | 670 | host_ctl |= HOST_CONTROL_IF_SERIAL |
662 | << HOST_CONTROL_IF_SHIFT; | 671 | << HOST_CONTROL_IF_SHIFT; |
663 | host_ctl |= HOST_CONTROL_REI; | 672 | host_ctl |= HOST_CONTROL_REI; |
664 | writel(0, host->addr + CLOCK_DELAY); | 673 | clock_ctl = CLOCK_CONTROL_40MHZ; |
674 | clock_delay = 0; | ||
665 | } else if (value == MEMSTICK_PAR4) { | 675 | } else if (value == MEMSTICK_PAR4) { |
666 | host_ctl |= HOST_CONTROL_FAST_CLK; | 676 | host_ctl |= HOST_CONTROL_FAST_CLK; |
667 | host_ctl |= HOST_CONTROL_IF_PAR4 | 677 | host_ctl |= HOST_CONTROL_IF_PAR4 |
668 | << HOST_CONTROL_IF_SHIFT; | 678 | << HOST_CONTROL_IF_SHIFT; |
669 | host_ctl &= ~HOST_CONTROL_REI; | 679 | host_ctl &= ~HOST_CONTROL_REI; |
670 | writel(4, host->addr + CLOCK_DELAY); | 680 | clock_ctl = CLOCK_CONTROL_40MHZ; |
681 | clock_delay = 4; | ||
671 | } else if (value == MEMSTICK_PAR8) { | 682 | } else if (value == MEMSTICK_PAR8) { |
672 | host_ctl |= HOST_CONTROL_FAST_CLK; | 683 | host_ctl |= HOST_CONTROL_FAST_CLK; |
673 | host_ctl |= HOST_CONTROL_IF_PAR8 | 684 | host_ctl |= HOST_CONTROL_IF_PAR8 |
674 | << HOST_CONTROL_IF_SHIFT; | 685 | << HOST_CONTROL_IF_SHIFT; |
675 | host_ctl &= ~HOST_CONTROL_REI; | 686 | host_ctl &= ~HOST_CONTROL_REI; |
676 | writel(4, host->addr + CLOCK_DELAY); | 687 | clock_ctl = CLOCK_CONTROL_60MHZ; |
688 | clock_delay = 0; | ||
677 | } | 689 | } |
678 | writel(host_ctl, host->addr + HOST_CONTROL); | 690 | writel(host_ctl, host->addr + HOST_CONTROL); |
691 | writel(clock_ctl, host->addr + CLOCK_CONTROL); | ||
692 | writel(clock_delay, host->addr + CLOCK_DELAY); | ||
679 | break; | 693 | break; |
680 | }; | 694 | }; |
681 | |||
682 | spin_unlock_irqrestore(&host->lock, flags); | ||
683 | } | 695 | } |
684 | 696 | ||
685 | #ifdef CONFIG_PM | 697 | #ifdef CONFIG_PM |
@@ -772,13 +784,10 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt) | |||
772 | snprintf(host->host_id, DEVICE_ID_SIZE, DRIVER_NAME ":slot%d", | 784 | snprintf(host->host_id, DEVICE_ID_SIZE, DRIVER_NAME ":slot%d", |
773 | host->id); | 785 | host->id); |
774 | host->irq = jm->pdev->irq; | 786 | host->irq = jm->pdev->irq; |
775 | host->timeout_jiffies = msecs_to_jiffies(4000); | 787 | host->timeout_jiffies = msecs_to_jiffies(1000); |
776 | msh->request = jmb38x_ms_request; | 788 | msh->request = jmb38x_ms_request; |
777 | msh->set_param = jmb38x_ms_set_param; | 789 | msh->set_param = jmb38x_ms_set_param; |
778 | /* | 790 | |
779 | msh->caps = MEMSTICK_CAP_AUTO_GET_INT | MEMSTICK_CAP_PAR4 | ||
780 | | MEMSTICK_CAP_PAR8; | ||
781 | */ | ||
782 | msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8; | 791 | msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8; |
783 | 792 | ||
784 | setup_timer(&host->timer, jmb38x_ms_abort, (unsigned long)msh); | 793 | setup_timer(&host->timer, jmb38x_ms_abort, (unsigned long)msh); |
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c index 2b5bf52a8302..8577de4ebb0e 100644 --- a/drivers/memstick/host/tifm_ms.c +++ b/drivers/memstick/host/tifm_ms.c | |||
@@ -182,7 +182,7 @@ static unsigned int tifm_ms_transfer_data(struct tifm_ms *host) | |||
182 | struct tifm_dev *sock = host->dev; | 182 | struct tifm_dev *sock = host->dev; |
183 | unsigned int length; | 183 | unsigned int length; |
184 | unsigned int off; | 184 | unsigned int off; |
185 | unsigned int t_size, p_off, p_cnt; | 185 | unsigned int t_size, p_cnt; |
186 | unsigned char *buf; | 186 | unsigned char *buf; |
187 | struct page *pg; | 187 | struct page *pg; |
188 | unsigned long flags = 0; | 188 | unsigned long flags = 0; |
@@ -198,6 +198,8 @@ static unsigned int tifm_ms_transfer_data(struct tifm_ms *host) | |||
198 | host->block_pos); | 198 | host->block_pos); |
199 | 199 | ||
200 | while (length) { | 200 | while (length) { |
201 | unsigned int uninitialized_var(p_off); | ||
202 | |||
201 | if (host->req->long_data) { | 203 | if (host->req->long_data) { |
202 | pg = nth_page(sg_page(&host->req->sg), | 204 | pg = nth_page(sg_page(&host->req->sg), |
203 | off >> PAGE_SHIFT); | 205 | off >> PAGE_SHIFT); |
@@ -340,11 +342,20 @@ static void tifm_ms_complete_cmd(struct tifm_ms *host) | |||
340 | 342 | ||
341 | del_timer(&host->timer); | 343 | del_timer(&host->timer); |
342 | 344 | ||
343 | if (host->use_dma) | 345 | host->req->int_reg = readl(sock->addr + SOCK_MS_STATUS) & 0xff; |
346 | host->req->int_reg = (host->req->int_reg & 1) | ||
347 | | ((host->req->int_reg << 4) & 0xe0); | ||
348 | |||
349 | writel(TIFM_FIFO_INT_SETALL, | ||
350 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | ||
351 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); | ||
352 | |||
353 | if (host->use_dma) { | ||
344 | tifm_unmap_sg(sock, &host->req->sg, 1, | 354 | tifm_unmap_sg(sock, &host->req->sg, 1, |
345 | host->req->data_dir == READ | 355 | host->req->data_dir == READ |
346 | ? PCI_DMA_FROMDEVICE | 356 | ? PCI_DMA_FROMDEVICE |
347 | : PCI_DMA_TODEVICE); | 357 | : PCI_DMA_TODEVICE); |
358 | } | ||
348 | 359 | ||
349 | writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL), | 360 | writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL), |
350 | sock->addr + SOCK_CONTROL); | 361 | sock->addr + SOCK_CONTROL); |
@@ -424,12 +435,6 @@ static void tifm_ms_card_event(struct tifm_dev *sock) | |||
424 | else if (host_status & TIFM_MS_STAT_CRC) | 435 | else if (host_status & TIFM_MS_STAT_CRC) |
425 | host->req->error = -EILSEQ; | 436 | host->req->error = -EILSEQ; |
426 | 437 | ||
427 | if (host->req->error) { | ||
428 | writel(TIFM_FIFO_INT_SETALL, | ||
429 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | ||
430 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); | ||
431 | } | ||
432 | |||
433 | if (host_status & TIFM_MS_STAT_RDY) | 438 | if (host_status & TIFM_MS_STAT_RDY) |
434 | host->cmd_flags |= CMD_READY; | 439 | host->cmd_flags |= CMD_READY; |
435 | 440 | ||
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 6b6df8679585..c6be6eba7dc3 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -1430,6 +1430,98 @@ mpt_get_product_name(u16 vendor, u16 device, u8 revision, char *prod_name) | |||
1430 | sprintf(prod_name, "%s", product_str); | 1430 | sprintf(prod_name, "%s", product_str); |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | /** | ||
1434 | * mpt_mapresources - map in memory mapped io | ||
1435 | * @ioc: Pointer to pointer to IOC adapter | ||
1436 | * | ||
1437 | **/ | ||
1438 | static int | ||
1439 | mpt_mapresources(MPT_ADAPTER *ioc) | ||
1440 | { | ||
1441 | u8 __iomem *mem; | ||
1442 | int ii; | ||
1443 | unsigned long mem_phys; | ||
1444 | unsigned long port; | ||
1445 | u32 msize; | ||
1446 | u32 psize; | ||
1447 | u8 revision; | ||
1448 | int r = -ENODEV; | ||
1449 | struct pci_dev *pdev; | ||
1450 | |||
1451 | pdev = ioc->pcidev; | ||
1452 | ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); | ||
1453 | if (pci_enable_device_mem(pdev)) { | ||
1454 | printk(MYIOC_s_ERR_FMT "pci_enable_device_mem() " | ||
1455 | "failed\n", ioc->name); | ||
1456 | return r; | ||
1457 | } | ||
1458 | if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) { | ||
1459 | printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with " | ||
1460 | "MEM failed\n", ioc->name); | ||
1461 | return r; | ||
1462 | } | ||
1463 | |||
1464 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); | ||
1465 | |||
1466 | if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK) | ||
1467 | && !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) { | ||
1468 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1469 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", | ||
1470 | ioc->name)); | ||
1471 | } else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK) | ||
1472 | && !pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { | ||
1473 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1474 | ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", | ||
1475 | ioc->name)); | ||
1476 | } else { | ||
1477 | printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", | ||
1478 | ioc->name, pci_name(pdev)); | ||
1479 | pci_release_selected_regions(pdev, ioc->bars); | ||
1480 | return r; | ||
1481 | } | ||
1482 | |||
1483 | mem_phys = msize = 0; | ||
1484 | port = psize = 0; | ||
1485 | for (ii = 0; ii < DEVICE_COUNT_RESOURCE; ii++) { | ||
1486 | if (pci_resource_flags(pdev, ii) & PCI_BASE_ADDRESS_SPACE_IO) { | ||
1487 | if (psize) | ||
1488 | continue; | ||
1489 | /* Get I/O space! */ | ||
1490 | port = pci_resource_start(pdev, ii); | ||
1491 | psize = pci_resource_len(pdev, ii); | ||
1492 | } else { | ||
1493 | if (msize) | ||
1494 | continue; | ||
1495 | /* Get memmap */ | ||
1496 | mem_phys = pci_resource_start(pdev, ii); | ||
1497 | msize = pci_resource_len(pdev, ii); | ||
1498 | } | ||
1499 | } | ||
1500 | ioc->mem_size = msize; | ||
1501 | |||
1502 | mem = NULL; | ||
1503 | /* Get logical ptr for PciMem0 space */ | ||
1504 | /*mem = ioremap(mem_phys, msize);*/ | ||
1505 | mem = ioremap(mem_phys, msize); | ||
1506 | if (mem == NULL) { | ||
1507 | printk(MYIOC_s_ERR_FMT ": ERROR - Unable to map adapter" | ||
1508 | " memory!\n", ioc->name); | ||
1509 | return -EINVAL; | ||
1510 | } | ||
1511 | ioc->memmap = mem; | ||
1512 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %lx\n", | ||
1513 | ioc->name, mem, mem_phys)); | ||
1514 | |||
1515 | ioc->mem_phys = mem_phys; | ||
1516 | ioc->chip = (SYSIF_REGS __iomem *)mem; | ||
1517 | |||
1518 | /* Save Port IO values in case we need to do downloadboot */ | ||
1519 | ioc->pio_mem_phys = port; | ||
1520 | ioc->pio_chip = (SYSIF_REGS __iomem *)port; | ||
1521 | |||
1522 | return 0; | ||
1523 | } | ||
1524 | |||
1433 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1525 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1434 | /** | 1526 | /** |
1435 | * mpt_attach - Install a PCI intelligent MPT adapter. | 1527 | * mpt_attach - Install a PCI intelligent MPT adapter. |
@@ -1452,13 +1544,6 @@ int | |||
1452 | mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | 1544 | mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) |
1453 | { | 1545 | { |
1454 | MPT_ADAPTER *ioc; | 1546 | MPT_ADAPTER *ioc; |
1455 | u8 __iomem *mem; | ||
1456 | u8 __iomem *pmem; | ||
1457 | unsigned long mem_phys; | ||
1458 | unsigned long port; | ||
1459 | u32 msize; | ||
1460 | u32 psize; | ||
1461 | int ii; | ||
1462 | u8 cb_idx; | 1547 | u8 cb_idx; |
1463 | int r = -ENODEV; | 1548 | int r = -ENODEV; |
1464 | u8 revision; | 1549 | u8 revision; |
@@ -1468,52 +1553,32 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1468 | struct proc_dir_entry *dent, *ent; | 1553 | struct proc_dir_entry *dent, *ent; |
1469 | #endif | 1554 | #endif |
1470 | 1555 | ||
1471 | if (mpt_debug_level) | ||
1472 | printk(KERN_INFO MYNAM ": mpt_debug_level=%xh\n", mpt_debug_level); | ||
1473 | |||
1474 | ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); | 1556 | ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); |
1475 | if (ioc == NULL) { | 1557 | if (ioc == NULL) { |
1476 | printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); | 1558 | printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); |
1477 | return -ENOMEM; | 1559 | return -ENOMEM; |
1478 | } | 1560 | } |
1479 | ioc->debug_level = mpt_debug_level; | 1561 | |
1480 | ioc->id = mpt_ids++; | 1562 | ioc->id = mpt_ids++; |
1481 | sprintf(ioc->name, "ioc%d", ioc->id); | 1563 | sprintf(ioc->name, "ioc%d", ioc->id); |
1482 | 1564 | ||
1483 | ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); | 1565 | /* |
1484 | if (pci_enable_device_mem(pdev)) { | 1566 | * set initial debug level |
1485 | printk(MYIOC_s_ERR_FMT "pci_enable_device_mem() " | 1567 | * (refer to mptdebug.h) |
1486 | "failed\n", ioc->name); | 1568 | * |
1487 | kfree(ioc); | 1569 | */ |
1488 | return r; | 1570 | ioc->debug_level = mpt_debug_level; |
1489 | } | 1571 | if (mpt_debug_level) |
1490 | if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) { | 1572 | printk(KERN_INFO "mpt_debug_level=%xh\n", mpt_debug_level); |
1491 | printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with " | ||
1492 | "MEM failed\n", ioc->name); | ||
1493 | kfree(ioc); | ||
1494 | return r; | ||
1495 | } | ||
1496 | 1573 | ||
1497 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": mpt_adapter_install\n", ioc->name)); | 1574 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": mpt_adapter_install\n", ioc->name)); |
1498 | 1575 | ||
1499 | if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { | 1576 | ioc->pcidev = pdev; |
1500 | dprintk(ioc, printk(MYIOC_s_INFO_FMT | 1577 | if (mpt_mapresources(ioc)) { |
1501 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", ioc->name)); | ||
1502 | } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { | ||
1503 | printk(MYIOC_s_WARN_FMT ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n", | ||
1504 | ioc->name); | ||
1505 | kfree(ioc); | 1578 | kfree(ioc); |
1506 | return r; | 1579 | return r; |
1507 | } | 1580 | } |
1508 | 1581 | ||
1509 | if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) { | ||
1510 | dprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1511 | ": Using 64 bit consistent mask\n", ioc->name)); | ||
1512 | } else { | ||
1513 | dprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1514 | ": Not using 64 bit consistent mask\n", ioc->name)); | ||
1515 | } | ||
1516 | |||
1517 | ioc->alloc_total = sizeof(MPT_ADAPTER); | 1582 | ioc->alloc_total = sizeof(MPT_ADAPTER); |
1518 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ | 1583 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ |
1519 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; | 1584 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; |
@@ -1551,48 +1616,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1551 | /* Find lookup slot. */ | 1616 | /* Find lookup slot. */ |
1552 | INIT_LIST_HEAD(&ioc->list); | 1617 | INIT_LIST_HEAD(&ioc->list); |
1553 | 1618 | ||
1554 | mem_phys = msize = 0; | ||
1555 | port = psize = 0; | ||
1556 | for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) { | ||
1557 | if (pci_resource_flags(pdev, ii) & PCI_BASE_ADDRESS_SPACE_IO) { | ||
1558 | if (psize) | ||
1559 | continue; | ||
1560 | /* Get I/O space! */ | ||
1561 | port = pci_resource_start(pdev, ii); | ||
1562 | psize = pci_resource_len(pdev,ii); | ||
1563 | } else { | ||
1564 | if (msize) | ||
1565 | continue; | ||
1566 | /* Get memmap */ | ||
1567 | mem_phys = pci_resource_start(pdev, ii); | ||
1568 | msize = pci_resource_len(pdev,ii); | ||
1569 | } | ||
1570 | } | ||
1571 | ioc->mem_size = msize; | ||
1572 | |||
1573 | mem = NULL; | ||
1574 | /* Get logical ptr for PciMem0 space */ | ||
1575 | /*mem = ioremap(mem_phys, msize);*/ | ||
1576 | mem = ioremap(mem_phys, msize); | ||
1577 | if (mem == NULL) { | ||
1578 | printk(MYIOC_s_ERR_FMT "Unable to map adapter memory!\n", ioc->name); | ||
1579 | kfree(ioc); | ||
1580 | return -EINVAL; | ||
1581 | } | ||
1582 | ioc->memmap = mem; | ||
1583 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %lx\n", ioc->name, mem, mem_phys)); | ||
1584 | |||
1585 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "facts @ %p, pfacts[0] @ %p\n", | 1619 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "facts @ %p, pfacts[0] @ %p\n", |
1586 | ioc->name, &ioc->facts, &ioc->pfacts[0])); | 1620 | ioc->name, &ioc->facts, &ioc->pfacts[0])); |
1587 | 1621 | ||
1588 | ioc->mem_phys = mem_phys; | ||
1589 | ioc->chip = (SYSIF_REGS __iomem *)mem; | ||
1590 | |||
1591 | /* Save Port IO values in case we need to do downloadboot */ | ||
1592 | ioc->pio_mem_phys = port; | ||
1593 | pmem = (u8 __iomem *)port; | ||
1594 | ioc->pio_chip = (SYSIF_REGS __iomem *)pmem; | ||
1595 | |||
1596 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); | 1622 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); |
1597 | mpt_get_product_name(pdev->vendor, pdev->device, revision, ioc->prod_name); | 1623 | mpt_get_product_name(pdev->vendor, pdev->device, revision, ioc->prod_name); |
1598 | 1624 | ||
@@ -1688,7 +1714,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1688 | list_del(&ioc->list); | 1714 | list_del(&ioc->list); |
1689 | if (ioc->alt_ioc) | 1715 | if (ioc->alt_ioc) |
1690 | ioc->alt_ioc->alt_ioc = NULL; | 1716 | ioc->alt_ioc->alt_ioc = NULL; |
1691 | iounmap(mem); | 1717 | iounmap(ioc->memmap); |
1718 | if (r != -5) | ||
1719 | pci_release_selected_regions(pdev, ioc->bars); | ||
1692 | kfree(ioc); | 1720 | kfree(ioc); |
1693 | pci_set_drvdata(pdev, NULL); | 1721 | pci_set_drvdata(pdev, NULL); |
1694 | return r; | 1722 | return r; |
@@ -1784,13 +1812,10 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1784 | u32 device_state; | 1812 | u32 device_state; |
1785 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 1813 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1786 | 1814 | ||
1787 | device_state=pci_choose_state(pdev, state); | 1815 | device_state = pci_choose_state(pdev, state); |
1788 | 1816 | printk(MYIOC_s_INFO_FMT "pci-suspend: pdev=0x%p, slot=%s, Entering " | |
1789 | printk(MYIOC_s_INFO_FMT | 1817 | "operating state [D%d]\n", ioc->name, pdev, pci_name(pdev), |
1790 | "pci-suspend: pdev=0x%p, slot=%s, Entering operating state [D%d]\n", | 1818 | device_state); |
1791 | ioc->name, pdev, pci_name(pdev), device_state); | ||
1792 | |||
1793 | pci_save_state(pdev); | ||
1794 | 1819 | ||
1795 | /* put ioc into READY_STATE */ | 1820 | /* put ioc into READY_STATE */ |
1796 | if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) { | 1821 | if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) { |
@@ -1805,10 +1830,14 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1805 | /* Clear any lingering interrupt */ | 1830 | /* Clear any lingering interrupt */ |
1806 | CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); | 1831 | CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); |
1807 | 1832 | ||
1833 | free_irq(ioc->pci_irq, ioc); | ||
1834 | if (mpt_msi_enable) | ||
1835 | pci_disable_msi(ioc->pcidev); | ||
1836 | ioc->pci_irq = -1; | ||
1837 | pci_save_state(pdev); | ||
1808 | pci_disable_device(pdev); | 1838 | pci_disable_device(pdev); |
1809 | pci_release_selected_regions(pdev, ioc->bars); | 1839 | pci_release_selected_regions(pdev, ioc->bars); |
1810 | pci_set_power_state(pdev, device_state); | 1840 | pci_set_power_state(pdev, device_state); |
1811 | |||
1812 | return 0; | 1841 | return 0; |
1813 | } | 1842 | } |
1814 | 1843 | ||
@@ -1823,48 +1852,54 @@ mpt_resume(struct pci_dev *pdev) | |||
1823 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 1852 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1824 | u32 device_state = pdev->current_state; | 1853 | u32 device_state = pdev->current_state; |
1825 | int recovery_state; | 1854 | int recovery_state; |
1855 | int err; | ||
1826 | 1856 | ||
1827 | printk(MYIOC_s_INFO_FMT | 1857 | printk(MYIOC_s_INFO_FMT "pci-resume: pdev=0x%p, slot=%s, Previous " |
1828 | "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", | 1858 | "operating state [D%d]\n", ioc->name, pdev, pci_name(pdev), |
1829 | ioc->name, pdev, pci_name(pdev), device_state); | 1859 | device_state); |
1830 | 1860 | ||
1831 | pci_set_power_state(pdev, 0); | 1861 | pci_set_power_state(pdev, PCI_D0); |
1862 | pci_enable_wake(pdev, PCI_D0, 0); | ||
1832 | pci_restore_state(pdev); | 1863 | pci_restore_state(pdev); |
1833 | if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) { | 1864 | ioc->pcidev = pdev; |
1834 | ioc->bars = pci_select_bars(ioc->pcidev, IORESOURCE_MEM | | 1865 | err = mpt_mapresources(ioc); |
1835 | IORESOURCE_IO); | 1866 | if (err) |
1836 | if (pci_enable_device(pdev)) | 1867 | return err; |
1837 | return 0; | ||
1838 | } else { | ||
1839 | ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); | ||
1840 | if (pci_enable_device_mem(pdev)) | ||
1841 | return 0; | ||
1842 | } | ||
1843 | if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) | ||
1844 | return 0; | ||
1845 | 1868 | ||
1846 | /* enable interrupts */ | 1869 | printk(MYIOC_s_INFO_FMT "pci-resume: ioc-state=0x%x,doorbell=0x%x\n", |
1847 | CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM); | 1870 | ioc->name, (mpt_GetIocState(ioc, 1) >> MPI_IOC_STATE_SHIFT), |
1848 | ioc->active = 1; | 1871 | CHIPREG_READ32(&ioc->chip->Doorbell)); |
1849 | 1872 | ||
1850 | printk(MYIOC_s_INFO_FMT | 1873 | /* |
1851 | "pci-resume: ioc-state=0x%x,doorbell=0x%x\n", | 1874 | * Errata workaround for SAS pci express: |
1852 | ioc->name, | 1875 | * Upon returning to the D0 state, the contents of the doorbell will be |
1853 | (mpt_GetIocState(ioc, 1) >> MPI_IOC_STATE_SHIFT), | 1876 | * stale data, and this will incorrectly signal to the host driver that |
1854 | CHIPREG_READ32(&ioc->chip->Doorbell)); | 1877 | * the firmware is ready to process mpt commands. The workaround is |
1878 | * to issue a diagnostic reset. | ||
1879 | */ | ||
1880 | if (ioc->bus_type == SAS && (pdev->device == | ||
1881 | MPI_MANUFACTPAGE_DEVID_SAS1068E || pdev->device == | ||
1882 | MPI_MANUFACTPAGE_DEVID_SAS1064E)) { | ||
1883 | if (KickStart(ioc, 1, CAN_SLEEP) < 0) { | ||
1884 | printk(MYIOC_s_WARN_FMT "pci-resume: Cannot recover\n", | ||
1885 | ioc->name); | ||
1886 | goto out; | ||
1887 | } | ||
1888 | } | ||
1855 | 1889 | ||
1856 | /* bring ioc to operational state */ | 1890 | /* bring ioc to operational state */ |
1857 | if ((recovery_state = mpt_do_ioc_recovery(ioc, | 1891 | printk(MYIOC_s_INFO_FMT "Sending mpt_do_ioc_recovery\n", ioc->name); |
1858 | MPT_HOSTEVENT_IOC_RECOVER, CAN_SLEEP)) != 0) { | 1892 | recovery_state = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP, |
1859 | printk(MYIOC_s_INFO_FMT | 1893 | CAN_SLEEP); |
1860 | "pci-resume: Cannot recover, error:[%x]\n", | 1894 | if (recovery_state != 0) |
1861 | ioc->name, recovery_state); | 1895 | printk(MYIOC_s_WARN_FMT "pci-resume: Cannot recover, " |
1862 | } else { | 1896 | "error:[%x]\n", ioc->name, recovery_state); |
1897 | else | ||
1863 | printk(MYIOC_s_INFO_FMT | 1898 | printk(MYIOC_s_INFO_FMT |
1864 | "pci-resume: success\n", ioc->name); | 1899 | "pci-resume: success\n", ioc->name); |
1865 | } | 1900 | out: |
1866 | |||
1867 | return 0; | 1901 | return 0; |
1902 | |||
1868 | } | 1903 | } |
1869 | #endif | 1904 | #endif |
1870 | 1905 | ||
@@ -1903,6 +1938,7 @@ mpt_signal_reset(u8 index, MPT_ADAPTER *ioc, int reset_phase) | |||
1903 | * -3 if READY but PrimeIOCFifos Failed | 1938 | * -3 if READY but PrimeIOCFifos Failed |
1904 | * -4 if READY but IOCInit Failed | 1939 | * -4 if READY but IOCInit Failed |
1905 | * -5 if failed to enable_device and/or request_selected_regions | 1940 | * -5 if failed to enable_device and/or request_selected_regions |
1941 | * -6 if failed to upload firmware | ||
1906 | */ | 1942 | */ |
1907 | static int | 1943 | static int |
1908 | mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | 1944 | mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) |
@@ -2097,7 +2133,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
2097 | } else { | 2133 | } else { |
2098 | printk(MYIOC_s_WARN_FMT | 2134 | printk(MYIOC_s_WARN_FMT |
2099 | "firmware upload failure!\n", ioc->name); | 2135 | "firmware upload failure!\n", ioc->name); |
2100 | ret = -5; | 2136 | ret = -6; |
2101 | } | 2137 | } |
2102 | } | 2138 | } |
2103 | } | 2139 | } |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 0c252f60c4c1..c207bda6723b 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -1170,6 +1170,10 @@ mptscsih_shutdown(struct pci_dev *pdev) | |||
1170 | int | 1170 | int |
1171 | mptscsih_suspend(struct pci_dev *pdev, pm_message_t state) | 1171 | mptscsih_suspend(struct pci_dev *pdev, pm_message_t state) |
1172 | { | 1172 | { |
1173 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | ||
1174 | |||
1175 | scsi_block_requests(ioc->sh); | ||
1176 | flush_scheduled_work(); | ||
1173 | mptscsih_shutdown(pdev); | 1177 | mptscsih_shutdown(pdev); |
1174 | return mpt_suspend(pdev,state); | 1178 | return mpt_suspend(pdev,state); |
1175 | } | 1179 | } |
@@ -1183,7 +1187,12 @@ mptscsih_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1183 | int | 1187 | int |
1184 | mptscsih_resume(struct pci_dev *pdev) | 1188 | mptscsih_resume(struct pci_dev *pdev) |
1185 | { | 1189 | { |
1186 | return mpt_resume(pdev); | 1190 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1191 | int rc; | ||
1192 | |||
1193 | rc = mpt_resume(pdev); | ||
1194 | scsi_unblock_requests(ioc->sh); | ||
1195 | return rc; | ||
1187 | } | 1196 | } |
1188 | 1197 | ||
1189 | #endif | 1198 | #endif |
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 63fb1ff3ad10..f6f2d960cadb 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -28,14 +28,14 @@ | |||
28 | static inline void asic3_write_register(struct asic3 *asic, | 28 | static inline void asic3_write_register(struct asic3 *asic, |
29 | unsigned int reg, u32 value) | 29 | unsigned int reg, u32 value) |
30 | { | 30 | { |
31 | iowrite16(value, (unsigned long)asic->mapping + | 31 | iowrite16(value, asic->mapping + |
32 | (reg >> asic->bus_shift)); | 32 | (reg >> asic->bus_shift)); |
33 | } | 33 | } |
34 | 34 | ||
35 | static inline u32 asic3_read_register(struct asic3 *asic, | 35 | static inline u32 asic3_read_register(struct asic3 *asic, |
36 | unsigned int reg) | 36 | unsigned int reg) |
37 | { | 37 | { |
38 | return ioread16((unsigned long)asic->mapping + | 38 | return ioread16(asic->mapping + |
39 | (reg >> asic->bus_shift)); | 39 | (reg >> asic->bus_shift)); |
40 | } | 40 | } |
41 | 41 | ||
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 982e27b86d10..962817e49fba 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -108,6 +108,7 @@ config ACER_WMI | |||
108 | depends on ACPI | 108 | depends on ACPI |
109 | depends on LEDS_CLASS | 109 | depends on LEDS_CLASS |
110 | depends on BACKLIGHT_CLASS_DEVICE | 110 | depends on BACKLIGHT_CLASS_DEVICE |
111 | depends on SERIO_I8042 | ||
111 | select ACPI_WMI | 112 | select ACPI_WMI |
112 | ---help--- | 113 | ---help--- |
113 | This is a driver for newer Acer (and Wistron) laptops. It adds | 114 | This is a driver for newer Acer (and Wistron) laptops. It adds |
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c index 74d12b4a3abd..dd13a3749927 100644 --- a/drivers/misc/acer-wmi.c +++ b/drivers/misc/acer-wmi.c | |||
@@ -219,6 +219,15 @@ static struct dmi_system_id acer_quirks[] = { | |||
219 | }, | 219 | }, |
220 | { | 220 | { |
221 | .callback = dmi_matched, | 221 | .callback = dmi_matched, |
222 | .ident = "Acer Aspire 3610", | ||
223 | .matches = { | ||
224 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
225 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3610"), | ||
226 | }, | ||
227 | .driver_data = &quirk_acer_travelmate_2490, | ||
228 | }, | ||
229 | { | ||
230 | .callback = dmi_matched, | ||
222 | .ident = "Acer Aspire 5100", | 231 | .ident = "Acer Aspire 5100", |
223 | .matches = { | 232 | .matches = { |
224 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 233 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
@@ -228,6 +237,15 @@ static struct dmi_system_id acer_quirks[] = { | |||
228 | }, | 237 | }, |
229 | { | 238 | { |
230 | .callback = dmi_matched, | 239 | .callback = dmi_matched, |
240 | .ident = "Acer Aspire 5610", | ||
241 | .matches = { | ||
242 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
243 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"), | ||
244 | }, | ||
245 | .driver_data = &quirk_acer_travelmate_2490, | ||
246 | }, | ||
247 | { | ||
248 | .callback = dmi_matched, | ||
231 | .ident = "Acer Aspire 5630", | 249 | .ident = "Acer Aspire 5630", |
232 | .matches = { | 250 | .matches = { |
233 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 251 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
@@ -761,11 +779,11 @@ enum led_brightness value) | |||
761 | } | 779 | } |
762 | 780 | ||
763 | static struct led_classdev mail_led = { | 781 | static struct led_classdev mail_led = { |
764 | .name = "acer-mail:green", | 782 | .name = "acer-wmi::mail", |
765 | .brightness_set = mail_led_set, | 783 | .brightness_set = mail_led_set, |
766 | }; | 784 | }; |
767 | 785 | ||
768 | static int __init acer_led_init(struct device *dev) | 786 | static int __devinit acer_led_init(struct device *dev) |
769 | { | 787 | { |
770 | return led_classdev_register(dev, &mail_led); | 788 | return led_classdev_register(dev, &mail_led); |
771 | } | 789 | } |
@@ -798,7 +816,7 @@ static struct backlight_ops acer_bl_ops = { | |||
798 | .update_status = update_bl_status, | 816 | .update_status = update_bl_status, |
799 | }; | 817 | }; |
800 | 818 | ||
801 | static int __init acer_backlight_init(struct device *dev) | 819 | static int __devinit acer_backlight_init(struct device *dev) |
802 | { | 820 | { |
803 | struct backlight_device *bd; | 821 | struct backlight_device *bd; |
804 | 822 | ||
@@ -817,7 +835,7 @@ static int __init acer_backlight_init(struct device *dev) | |||
817 | return 0; | 835 | return 0; |
818 | } | 836 | } |
819 | 837 | ||
820 | static void __exit acer_backlight_exit(void) | 838 | static void acer_backlight_exit(void) |
821 | { | 839 | { |
822 | backlight_device_unregister(acer_backlight_device); | 840 | backlight_device_unregister(acer_backlight_device); |
823 | } | 841 | } |
@@ -1052,11 +1070,12 @@ static int __init acer_wmi_init(void) | |||
1052 | 1070 | ||
1053 | if (wmi_has_guid(WMID_GUID2) && interface) { | 1071 | if (wmi_has_guid(WMID_GUID2) && interface) { |
1054 | if (ACPI_FAILURE(WMID_set_capabilities())) { | 1072 | if (ACPI_FAILURE(WMID_set_capabilities())) { |
1055 | printk(ACER_ERR "Unable to detect available devices\n"); | 1073 | printk(ACER_ERR "Unable to detect available WMID " |
1074 | "devices\n"); | ||
1056 | return -ENODEV; | 1075 | return -ENODEV; |
1057 | } | 1076 | } |
1058 | } else if (!wmi_has_guid(WMID_GUID2) && interface) { | 1077 | } else if (!wmi_has_guid(WMID_GUID2) && interface) { |
1059 | printk(ACER_ERR "Unable to detect available devices\n"); | 1078 | printk(ACER_ERR "No WMID device detection method found\n"); |
1060 | return -ENODEV; | 1079 | return -ENODEV; |
1061 | } | 1080 | } |
1062 | 1081 | ||
@@ -1064,21 +1083,20 @@ static int __init acer_wmi_init(void) | |||
1064 | interface = &AMW0_interface; | 1083 | interface = &AMW0_interface; |
1065 | 1084 | ||
1066 | if (ACPI_FAILURE(AMW0_set_capabilities())) { | 1085 | if (ACPI_FAILURE(AMW0_set_capabilities())) { |
1067 | printk(ACER_ERR "Unable to detect available devices\n"); | 1086 | printk(ACER_ERR "Unable to detect available AMW0 " |
1087 | "devices\n"); | ||
1068 | return -ENODEV; | 1088 | return -ENODEV; |
1069 | } | 1089 | } |
1070 | } | 1090 | } |
1071 | 1091 | ||
1072 | if (wmi_has_guid(AMW0_GUID1)) { | 1092 | if (wmi_has_guid(AMW0_GUID1)) |
1073 | if (ACPI_FAILURE(AMW0_find_mailled())) | 1093 | AMW0_find_mailled(); |
1074 | printk(ACER_ERR "Unable to detect mail LED\n"); | ||
1075 | } | ||
1076 | 1094 | ||
1077 | find_quirks(); | 1095 | find_quirks(); |
1078 | 1096 | ||
1079 | if (!interface) { | 1097 | if (!interface) { |
1080 | printk(ACER_ERR "No or unsupported WMI interface, unable to "); | 1098 | printk(ACER_ERR "No or unsupported WMI interface, unable to " |
1081 | printk(KERN_CONT "load.\n"); | 1099 | "load\n"); |
1082 | return -ENODEV; | 1100 | return -ENODEV; |
1083 | } | 1101 | } |
1084 | 1102 | ||
diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/misc/fujitsu-laptop.c index 1cfd7f3f1294..e2e7c05a147b 100644 --- a/drivers/misc/fujitsu-laptop.c +++ b/drivers/misc/fujitsu-laptop.c | |||
@@ -231,7 +231,7 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type) | |||
231 | 231 | ||
232 | if (!device || !acpi_driver_data(device)) | 232 | if (!device || !acpi_driver_data(device)) |
233 | return -EINVAL; | 233 | return -EINVAL; |
234 | fujitsu->acpi_handle = 0; | 234 | fujitsu->acpi_handle = NULL; |
235 | 235 | ||
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c index 4f9d4a9da983..b5f6add34b0b 100644 --- a/drivers/misc/ibmasm/module.c +++ b/drivers/misc/ibmasm/module.c | |||
@@ -106,7 +106,7 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi | |||
106 | sp->irq = pdev->irq; | 106 | sp->irq = pdev->irq; |
107 | sp->base_address = ioremap(pci_resource_start(pdev, 0), | 107 | sp->base_address = ioremap(pci_resource_start(pdev, 0), |
108 | pci_resource_len(pdev, 0)); | 108 | pci_resource_len(pdev, 0)); |
109 | if (sp->base_address == 0) { | 109 | if (!sp->base_address) { |
110 | dev_err(sp->dev, "Failed to ioremap pci memory\n"); | 110 | dev_err(sp->dev, "Failed to ioremap pci memory\n"); |
111 | result = -ENODEV; | 111 | result = -ENODEV; |
112 | goto error_ioremap; | 112 | goto error_ioremap; |
diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c index c884730c5eaf..1bfe5d16963b 100644 --- a/drivers/misc/lkdtm.c +++ b/drivers/misc/lkdtm.c | |||
@@ -197,7 +197,7 @@ static int lkdtm_parse_commandline(void) | |||
197 | { | 197 | { |
198 | int i; | 198 | int i; |
199 | 199 | ||
200 | if (cpoint_name == INVALID || cpoint_type == NONE || | 200 | if (cpoint_name == NULL || cpoint_type == NULL || |
201 | cpoint_count < 1 || recur_count < 1) | 201 | cpoint_count < 1 || recur_count < 1) |
202 | return -EINVAL; | 202 | return -EINVAL; |
203 | 203 | ||
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 899e3f75f288..02ff3d19b1cc 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -315,7 +315,7 @@ static void sony_laptop_report_input_event(u8 event) | |||
315 | break; | 315 | break; |
316 | 316 | ||
317 | default: | 317 | default: |
318 | if (event > ARRAY_SIZE(sony_laptop_input_index)) { | 318 | if (event >= ARRAY_SIZE(sony_laptop_input_index)) { |
319 | dprintk("sony_laptop_report_input_event, event not known: %d\n", event); | 319 | dprintk("sony_laptop_report_input_event, event not known: %d\n", event); |
320 | break; | 320 | break; |
321 | } | 321 | } |
diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile index 4985807257a8..19a1a254a0c5 100644 --- a/drivers/mmc/core/Makefile +++ b/drivers/mmc/core/Makefile | |||
@@ -7,7 +7,7 @@ ifeq ($(CONFIG_MMC_DEBUG),y) | |||
7 | endif | 7 | endif |
8 | 8 | ||
9 | obj-$(CONFIG_MMC) += mmc_core.o | 9 | obj-$(CONFIG_MMC) += mmc_core.o |
10 | mmc_core-y := core.o sysfs.o bus.o host.o \ | 10 | mmc_core-y := core.o bus.o host.o \ |
11 | mmc.o mmc_ops.o sd.o sd_ops.o \ | 11 | mmc.o mmc_ops.o sd.o sd_ops.o \ |
12 | sdio.o sdio_ops.o sdio_bus.o \ | 12 | sdio.o sdio_ops.o sdio_bus.o \ |
13 | sdio_cis.o sdio_io.o sdio_irq.o | 13 | sdio_cis.o sdio_io.o sdio_irq.o |
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index b0c22cad9423..fd95b18e988b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/mmc/card.h> | 17 | #include <linux/mmc/card.h> |
18 | #include <linux/mmc/host.h> | 18 | #include <linux/mmc/host.h> |
19 | 19 | ||
20 | #include "sysfs.h" | ||
21 | #include "core.h" | 20 | #include "core.h" |
22 | #include "sdio_cis.h" | 21 | #include "sdio_cis.h" |
23 | #include "bus.h" | 22 | #include "bus.h" |
@@ -43,7 +42,7 @@ static ssize_t mmc_type_show(struct device *dev, | |||
43 | } | 42 | } |
44 | 43 | ||
45 | static struct device_attribute mmc_dev_attrs[] = { | 44 | static struct device_attribute mmc_dev_attrs[] = { |
46 | MMC_ATTR_RO(type), | 45 | __ATTR(type, S_IRUGO, mmc_type_show, NULL), |
47 | __ATTR_NULL, | 46 | __ATTR_NULL, |
48 | }; | 47 | }; |
49 | 48 | ||
@@ -189,7 +188,7 @@ static void mmc_release_card(struct device *dev) | |||
189 | /* | 188 | /* |
190 | * Allocate and initialise a new MMC card structure. | 189 | * Allocate and initialise a new MMC card structure. |
191 | */ | 190 | */ |
192 | struct mmc_card *mmc_alloc_card(struct mmc_host *host) | 191 | struct mmc_card *mmc_alloc_card(struct mmc_host *host, struct device_type *type) |
193 | { | 192 | { |
194 | struct mmc_card *card; | 193 | struct mmc_card *card; |
195 | 194 | ||
@@ -204,6 +203,7 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host) | |||
204 | card->dev.parent = mmc_classdev(host); | 203 | card->dev.parent = mmc_classdev(host); |
205 | card->dev.bus = &mmc_bus_type; | 204 | card->dev.bus = &mmc_bus_type; |
206 | card->dev.release = mmc_release_card; | 205 | card->dev.release = mmc_release_card; |
206 | card->dev.type = type; | ||
207 | 207 | ||
208 | return card; | 208 | return card; |
209 | } | 209 | } |
@@ -248,24 +248,10 @@ int mmc_add_card(struct mmc_card *card) | |||
248 | type, card->rca); | 248 | type, card->rca); |
249 | } | 249 | } |
250 | 250 | ||
251 | card->dev.uevent_suppress = 1; | ||
252 | |||
253 | ret = device_add(&card->dev); | 251 | ret = device_add(&card->dev); |
254 | if (ret) | 252 | if (ret) |
255 | return ret; | 253 | return ret; |
256 | 254 | ||
257 | if (card->host->bus_ops->sysfs_add) { | ||
258 | ret = card->host->bus_ops->sysfs_add(card->host, card); | ||
259 | if (ret) { | ||
260 | device_del(&card->dev); | ||
261 | return ret; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | card->dev.uevent_suppress = 0; | ||
266 | |||
267 | kobject_uevent(&card->dev.kobj, KOBJ_ADD); | ||
268 | |||
269 | mmc_card_set_present(card); | 255 | mmc_card_set_present(card); |
270 | 256 | ||
271 | return 0; | 257 | return 0; |
@@ -285,9 +271,6 @@ void mmc_remove_card(struct mmc_card *card) | |||
285 | printk(KERN_INFO "%s: card %04x removed\n", | 271 | printk(KERN_INFO "%s: card %04x removed\n", |
286 | mmc_hostname(card->host), card->rca); | 272 | mmc_hostname(card->host), card->rca); |
287 | } | 273 | } |
288 | |||
289 | if (card->host->bus_ops->sysfs_remove) | ||
290 | card->host->bus_ops->sysfs_remove(card->host, card); | ||
291 | device_del(&card->dev); | 274 | device_del(&card->dev); |
292 | } | 275 | } |
293 | 276 | ||
diff --git a/drivers/mmc/core/bus.h b/drivers/mmc/core/bus.h index 4f35431116a8..18178766ab46 100644 --- a/drivers/mmc/core/bus.h +++ b/drivers/mmc/core/bus.h | |||
@@ -11,7 +11,16 @@ | |||
11 | #ifndef _MMC_CORE_BUS_H | 11 | #ifndef _MMC_CORE_BUS_H |
12 | #define _MMC_CORE_BUS_H | 12 | #define _MMC_CORE_BUS_H |
13 | 13 | ||
14 | struct mmc_card *mmc_alloc_card(struct mmc_host *host); | 14 | #define MMC_DEV_ATTR(name, fmt, args...) \ |
15 | static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ | ||
16 | { \ | ||
17 | struct mmc_card *card = container_of(dev, struct mmc_card, dev); \ | ||
18 | return sprintf(buf, fmt, args); \ | ||
19 | } \ | ||
20 | static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL) | ||
21 | |||
22 | struct mmc_card *mmc_alloc_card(struct mmc_host *host, | ||
23 | struct device_type *type); | ||
15 | int mmc_add_card(struct mmc_card *card); | 24 | int mmc_add_card(struct mmc_card *card); |
16 | void mmc_remove_card(struct mmc_card *card); | 25 | void mmc_remove_card(struct mmc_card *card); |
17 | 26 | ||
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 39daf2fb5dc4..cfa8e15b5923 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h | |||
@@ -18,8 +18,6 @@ | |||
18 | struct mmc_bus_ops { | 18 | struct mmc_bus_ops { |
19 | void (*remove)(struct mmc_host *); | 19 | void (*remove)(struct mmc_host *); |
20 | void (*detect)(struct mmc_host *); | 20 | void (*detect)(struct mmc_host *); |
21 | int (*sysfs_add)(struct mmc_host *, struct mmc_card *card); | ||
22 | void (*sysfs_remove)(struct mmc_host *, struct mmc_card *card); | ||
23 | void (*suspend)(struct mmc_host *); | 21 | void (*suspend)(struct mmc_host *); |
24 | void (*resume)(struct mmc_host *); | 22 | void (*resume)(struct mmc_host *); |
25 | }; | 23 | }; |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 68c0e3b2f0e8..3da29eef8f7d 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/mmc/mmc.h> | 17 | #include <linux/mmc/mmc.h> |
18 | 18 | ||
19 | #include "core.h" | 19 | #include "core.h" |
20 | #include "sysfs.h" | ||
21 | #include "bus.h" | 20 | #include "bus.h" |
22 | #include "mmc_ops.h" | 21 | #include "mmc_ops.h" |
23 | 22 | ||
@@ -248,6 +247,44 @@ out: | |||
248 | return err; | 247 | return err; |
249 | } | 248 | } |
250 | 249 | ||
250 | MMC_DEV_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
251 | card->raw_cid[2], card->raw_cid[3]); | ||
252 | MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
253 | card->raw_csd[2], card->raw_csd[3]); | ||
254 | MMC_DEV_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
255 | MMC_DEV_ATTR(fwrev, "0x%x\n", card->cid.fwrev); | ||
256 | MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev); | ||
257 | MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); | ||
258 | MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name); | ||
259 | MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid); | ||
260 | MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial); | ||
261 | |||
262 | static struct attribute *mmc_std_attrs[] = { | ||
263 | &dev_attr_cid.attr, | ||
264 | &dev_attr_csd.attr, | ||
265 | &dev_attr_date.attr, | ||
266 | &dev_attr_fwrev.attr, | ||
267 | &dev_attr_hwrev.attr, | ||
268 | &dev_attr_manfid.attr, | ||
269 | &dev_attr_name.attr, | ||
270 | &dev_attr_oemid.attr, | ||
271 | &dev_attr_serial.attr, | ||
272 | NULL, | ||
273 | }; | ||
274 | |||
275 | static struct attribute_group mmc_std_attr_group = { | ||
276 | .attrs = mmc_std_attrs, | ||
277 | }; | ||
278 | |||
279 | static struct attribute_group *mmc_attr_groups[] = { | ||
280 | &mmc_std_attr_group, | ||
281 | NULL, | ||
282 | }; | ||
283 | |||
284 | static struct device_type mmc_type = { | ||
285 | .groups = mmc_attr_groups, | ||
286 | }; | ||
287 | |||
251 | /* | 288 | /* |
252 | * Handle the detection and initialisation of a card. | 289 | * Handle the detection and initialisation of a card. |
253 | * | 290 | * |
@@ -308,7 +345,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
308 | /* | 345 | /* |
309 | * Allocate card structure. | 346 | * Allocate card structure. |
310 | */ | 347 | */ |
311 | card = mmc_alloc_card(host); | 348 | card = mmc_alloc_card(host, &mmc_type); |
312 | if (IS_ERR(card)) { | 349 | if (IS_ERR(card)) { |
313 | err = PTR_ERR(card); | 350 | err = PTR_ERR(card); |
314 | goto err; | 351 | goto err; |
@@ -459,53 +496,6 @@ static void mmc_detect(struct mmc_host *host) | |||
459 | } | 496 | } |
460 | } | 497 | } |
461 | 498 | ||
462 | MMC_ATTR_FN(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
463 | card->raw_cid[2], card->raw_cid[3]); | ||
464 | MMC_ATTR_FN(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
465 | card->raw_csd[2], card->raw_csd[3]); | ||
466 | MMC_ATTR_FN(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
467 | MMC_ATTR_FN(fwrev, "0x%x\n", card->cid.fwrev); | ||
468 | MMC_ATTR_FN(hwrev, "0x%x\n", card->cid.hwrev); | ||
469 | MMC_ATTR_FN(manfid, "0x%06x\n", card->cid.manfid); | ||
470 | MMC_ATTR_FN(name, "%s\n", card->cid.prod_name); | ||
471 | MMC_ATTR_FN(oemid, "0x%04x\n", card->cid.oemid); | ||
472 | MMC_ATTR_FN(serial, "0x%08x\n", card->cid.serial); | ||
473 | |||
474 | static struct device_attribute mmc_dev_attrs[] = { | ||
475 | MMC_ATTR_RO(cid), | ||
476 | MMC_ATTR_RO(csd), | ||
477 | MMC_ATTR_RO(date), | ||
478 | MMC_ATTR_RO(fwrev), | ||
479 | MMC_ATTR_RO(hwrev), | ||
480 | MMC_ATTR_RO(manfid), | ||
481 | MMC_ATTR_RO(name), | ||
482 | MMC_ATTR_RO(oemid), | ||
483 | MMC_ATTR_RO(serial), | ||
484 | __ATTR_NULL, | ||
485 | }; | ||
486 | |||
487 | /* | ||
488 | * Adds sysfs entries as relevant. | ||
489 | */ | ||
490 | static int mmc_sysfs_add(struct mmc_host *host, struct mmc_card *card) | ||
491 | { | ||
492 | int ret; | ||
493 | |||
494 | ret = mmc_add_attrs(card, mmc_dev_attrs); | ||
495 | if (ret < 0) | ||
496 | return ret; | ||
497 | |||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | /* | ||
502 | * Removes the sysfs entries added by mmc_sysfs_add(). | ||
503 | */ | ||
504 | static void mmc_sysfs_remove(struct mmc_host *host, struct mmc_card *card) | ||
505 | { | ||
506 | mmc_remove_attrs(card, mmc_dev_attrs); | ||
507 | } | ||
508 | |||
509 | #ifdef CONFIG_MMC_UNSAFE_RESUME | 499 | #ifdef CONFIG_MMC_UNSAFE_RESUME |
510 | 500 | ||
511 | /* | 501 | /* |
@@ -560,8 +550,6 @@ static void mmc_resume(struct mmc_host *host) | |||
560 | static const struct mmc_bus_ops mmc_ops = { | 550 | static const struct mmc_bus_ops mmc_ops = { |
561 | .remove = mmc_remove, | 551 | .remove = mmc_remove, |
562 | .detect = mmc_detect, | 552 | .detect = mmc_detect, |
563 | .sysfs_add = mmc_sysfs_add, | ||
564 | .sysfs_remove = mmc_sysfs_remove, | ||
565 | .suspend = mmc_suspend, | 553 | .suspend = mmc_suspend, |
566 | .resume = mmc_resume, | 554 | .resume = mmc_resume, |
567 | }; | 555 | }; |
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index d1c1e0f592f1..7ef3b15c5e3d 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/mmc/sd.h> | 18 | #include <linux/mmc/sd.h> |
19 | 19 | ||
20 | #include "core.h" | 20 | #include "core.h" |
21 | #include "sysfs.h" | ||
22 | #include "bus.h" | 21 | #include "bus.h" |
23 | #include "mmc_ops.h" | 22 | #include "mmc_ops.h" |
24 | #include "sd_ops.h" | 23 | #include "sd_ops.h" |
@@ -283,6 +282,47 @@ out: | |||
283 | return err; | 282 | return err; |
284 | } | 283 | } |
285 | 284 | ||
285 | MMC_DEV_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
286 | card->raw_cid[2], card->raw_cid[3]); | ||
287 | MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
288 | card->raw_csd[2], card->raw_csd[3]); | ||
289 | MMC_DEV_ATTR(scr, "%08x%08x\n", card->raw_scr[0], card->raw_scr[1]); | ||
290 | MMC_DEV_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
291 | MMC_DEV_ATTR(fwrev, "0x%x\n", card->cid.fwrev); | ||
292 | MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev); | ||
293 | MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); | ||
294 | MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name); | ||
295 | MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid); | ||
296 | MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial); | ||
297 | |||
298 | |||
299 | static struct attribute *sd_std_attrs[] = { | ||
300 | &dev_attr_cid.attr, | ||
301 | &dev_attr_csd.attr, | ||
302 | &dev_attr_scr.attr, | ||
303 | &dev_attr_date.attr, | ||
304 | &dev_attr_fwrev.attr, | ||
305 | &dev_attr_hwrev.attr, | ||
306 | &dev_attr_manfid.attr, | ||
307 | &dev_attr_name.attr, | ||
308 | &dev_attr_oemid.attr, | ||
309 | &dev_attr_serial.attr, | ||
310 | NULL, | ||
311 | }; | ||
312 | |||
313 | static struct attribute_group sd_std_attr_group = { | ||
314 | .attrs = sd_std_attrs, | ||
315 | }; | ||
316 | |||
317 | static struct attribute_group *sd_attr_groups[] = { | ||
318 | &sd_std_attr_group, | ||
319 | NULL, | ||
320 | }; | ||
321 | |||
322 | static struct device_type sd_type = { | ||
323 | .groups = sd_attr_groups, | ||
324 | }; | ||
325 | |||
286 | /* | 326 | /* |
287 | * Handle the detection and initialisation of a card. | 327 | * Handle the detection and initialisation of a card. |
288 | * | 328 | * |
@@ -352,7 +392,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
352 | /* | 392 | /* |
353 | * Allocate card structure. | 393 | * Allocate card structure. |
354 | */ | 394 | */ |
355 | card = mmc_alloc_card(host); | 395 | card = mmc_alloc_card(host, &sd_type); |
356 | if (IS_ERR(card)) { | 396 | if (IS_ERR(card)) { |
357 | err = PTR_ERR(card); | 397 | err = PTR_ERR(card); |
358 | goto err; | 398 | goto err; |
@@ -518,55 +558,6 @@ static void mmc_sd_detect(struct mmc_host *host) | |||
518 | } | 558 | } |
519 | } | 559 | } |
520 | 560 | ||
521 | MMC_ATTR_FN(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
522 | card->raw_cid[2], card->raw_cid[3]); | ||
523 | MMC_ATTR_FN(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
524 | card->raw_csd[2], card->raw_csd[3]); | ||
525 | MMC_ATTR_FN(scr, "%08x%08x\n", card->raw_scr[0], card->raw_scr[1]); | ||
526 | MMC_ATTR_FN(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
527 | MMC_ATTR_FN(fwrev, "0x%x\n", card->cid.fwrev); | ||
528 | MMC_ATTR_FN(hwrev, "0x%x\n", card->cid.hwrev); | ||
529 | MMC_ATTR_FN(manfid, "0x%06x\n", card->cid.manfid); | ||
530 | MMC_ATTR_FN(name, "%s\n", card->cid.prod_name); | ||
531 | MMC_ATTR_FN(oemid, "0x%04x\n", card->cid.oemid); | ||
532 | MMC_ATTR_FN(serial, "0x%08x\n", card->cid.serial); | ||
533 | |||
534 | static struct device_attribute mmc_sd_dev_attrs[] = { | ||
535 | MMC_ATTR_RO(cid), | ||
536 | MMC_ATTR_RO(csd), | ||
537 | MMC_ATTR_RO(scr), | ||
538 | MMC_ATTR_RO(date), | ||
539 | MMC_ATTR_RO(fwrev), | ||
540 | MMC_ATTR_RO(hwrev), | ||
541 | MMC_ATTR_RO(manfid), | ||
542 | MMC_ATTR_RO(name), | ||
543 | MMC_ATTR_RO(oemid), | ||
544 | MMC_ATTR_RO(serial), | ||
545 | __ATTR_NULL, | ||
546 | }; | ||
547 | |||
548 | /* | ||
549 | * Adds sysfs entries as relevant. | ||
550 | */ | ||
551 | static int mmc_sd_sysfs_add(struct mmc_host *host, struct mmc_card *card) | ||
552 | { | ||
553 | int ret; | ||
554 | |||
555 | ret = mmc_add_attrs(card, mmc_sd_dev_attrs); | ||
556 | if (ret < 0) | ||
557 | return ret; | ||
558 | |||
559 | return 0; | ||
560 | } | ||
561 | |||
562 | /* | ||
563 | * Removes the sysfs entries added by mmc_sysfs_add(). | ||
564 | */ | ||
565 | static void mmc_sd_sysfs_remove(struct mmc_host *host, struct mmc_card *card) | ||
566 | { | ||
567 | mmc_remove_attrs(card, mmc_sd_dev_attrs); | ||
568 | } | ||
569 | |||
570 | #ifdef CONFIG_MMC_UNSAFE_RESUME | 561 | #ifdef CONFIG_MMC_UNSAFE_RESUME |
571 | 562 | ||
572 | /* | 563 | /* |
@@ -621,8 +612,6 @@ static void mmc_sd_resume(struct mmc_host *host) | |||
621 | static const struct mmc_bus_ops mmc_sd_ops = { | 612 | static const struct mmc_bus_ops mmc_sd_ops = { |
622 | .remove = mmc_sd_remove, | 613 | .remove = mmc_sd_remove, |
623 | .detect = mmc_sd_detect, | 614 | .detect = mmc_sd_detect, |
624 | .sysfs_add = mmc_sd_sysfs_add, | ||
625 | .sysfs_remove = mmc_sd_sysfs_remove, | ||
626 | .suspend = mmc_sd_suspend, | 615 | .suspend = mmc_sd_suspend, |
627 | .resume = mmc_sd_resume, | 616 | .resume = mmc_sd_resume, |
628 | }; | 617 | }; |
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 87a50f456efc..4eab79e09ccc 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
@@ -287,7 +287,7 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr) | |||
287 | /* | 287 | /* |
288 | * Allocate card structure. | 288 | * Allocate card structure. |
289 | */ | 289 | */ |
290 | card = mmc_alloc_card(host); | 290 | card = mmc_alloc_card(host, NULL); |
291 | if (IS_ERR(card)) { | 291 | if (IS_ERR(card)) { |
292 | err = PTR_ERR(card); | 292 | err = PTR_ERR(card); |
293 | goto err; | 293 | goto err; |
diff --git a/drivers/mmc/core/sysfs.c b/drivers/mmc/core/sysfs.c deleted file mode 100644 index 00a97e70f914..000000000000 --- a/drivers/mmc/core/sysfs.c +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * linux/drivers/mmc/core/sysfs.c | ||
3 | * | ||
4 | * Copyright (C) 2003 Russell King, All Rights Reserved. | ||
5 | * Copyright 2007 Pierre Ossman | ||
6 | * | ||
7 | * 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 | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * MMC sysfs/driver model support. | ||
12 | */ | ||
13 | #include <linux/device.h> | ||
14 | |||
15 | #include <linux/mmc/card.h> | ||
16 | |||
17 | #include "sysfs.h" | ||
18 | |||
19 | int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs) | ||
20 | { | ||
21 | int error = 0; | ||
22 | int i; | ||
23 | |||
24 | for (i = 0; attr_name(attrs[i]); i++) { | ||
25 | error = device_create_file(&card->dev, &attrs[i]); | ||
26 | if (error) { | ||
27 | while (--i >= 0) | ||
28 | device_remove_file(&card->dev, &attrs[i]); | ||
29 | break; | ||
30 | } | ||
31 | } | ||
32 | |||
33 | return error; | ||
34 | } | ||
35 | |||
36 | void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs) | ||
37 | { | ||
38 | int i; | ||
39 | |||
40 | for (i = 0; attr_name(attrs[i]); i++) | ||
41 | device_remove_file(&card->dev, &attrs[i]); | ||
42 | } | ||
43 | |||
diff --git a/drivers/mmc/core/sysfs.h b/drivers/mmc/core/sysfs.h deleted file mode 100644 index 4b8f670bd10f..000000000000 --- a/drivers/mmc/core/sysfs.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * linux/drivers/mmc/core/sysfs.h | ||
3 | * | ||
4 | * Copyright (C) 2003 Russell King, All Rights Reserved. | ||
5 | * Copyright 2007 Pierre Ossman | ||
6 | * | ||
7 | * 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 | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef _MMC_CORE_SYSFS_H | ||
12 | #define _MMC_CORE_SYSFS_H | ||
13 | |||
14 | #define MMC_ATTR_FN(name, fmt, args...) \ | ||
15 | static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ | ||
16 | { \ | ||
17 | struct mmc_card *card = container_of(dev, struct mmc_card, dev);\ | ||
18 | return sprintf(buf, fmt, args); \ | ||
19 | } | ||
20 | |||
21 | #define MMC_ATTR_RO(name) __ATTR(name, S_IRUGO, mmc_##name##_show, NULL) | ||
22 | |||
23 | int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs); | ||
24 | void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs); | ||
25 | |||
26 | #endif | ||
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index 20d5c7bd940a..1c14a186f000 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c | |||
@@ -180,7 +180,7 @@ static void tifm_sd_transfer_data(struct tifm_sd *host) | |||
180 | host->sg_pos++; | 180 | host->sg_pos++; |
181 | if (host->sg_pos == host->sg_len) { | 181 | if (host->sg_pos == host->sg_len) { |
182 | if ((r_data->flags & MMC_DATA_WRITE) | 182 | if ((r_data->flags & MMC_DATA_WRITE) |
183 | && DATA_CARRY) | 183 | && (host->cmd_flags & DATA_CARRY)) |
184 | writel(host->bounce_buf_data[0], | 184 | writel(host->bounce_buf_data[0], |
185 | host->dev->addr | 185 | host->dev->addr |
186 | + SOCK_MMCSD_DATA); | 186 | + SOCK_MMCSD_DATA); |
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index eeaaa9dce6ef..ad1880c67518 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
@@ -408,7 +408,6 @@ static int block2mtd_setup2(const char *val) | |||
408 | if (token[1]) { | 408 | if (token[1]) { |
409 | ret = parse_num(&erase_size, token[1]); | 409 | ret = parse_num(&erase_size, token[1]); |
410 | if (ret) { | 410 | if (ret) { |
411 | kfree(name); | ||
412 | parse_err("illegal erase size"); | 411 | parse_err("illegal erase size"); |
413 | } | 412 | } |
414 | } | 413 | } |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index f00e04efbe28..bc4649a17b9d 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -202,9 +202,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state | |||
202 | int ret = 0; | 202 | int ret = 0; |
203 | int i; | 203 | int i; |
204 | 204 | ||
205 | if (info) | 205 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) |
206 | for (i = 0; i < MAX_RESOURCES; i++) | 206 | ret |= info->mtd[i]->suspend(info->mtd[i]); |
207 | ret |= info->mtd[i]->suspend(info->mtd[i]); | ||
208 | 207 | ||
209 | return ret; | 208 | return ret; |
210 | } | 209 | } |
@@ -214,9 +213,9 @@ static int physmap_flash_resume(struct platform_device *dev) | |||
214 | struct physmap_flash_info *info = platform_get_drvdata(dev); | 213 | struct physmap_flash_info *info = platform_get_drvdata(dev); |
215 | int i; | 214 | int i; |
216 | 215 | ||
217 | if (info) | 216 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) |
218 | for (i = 0; i < MAX_RESOURCES; i++) | 217 | info->mtd[i]->resume(info->mtd[i]); |
219 | info->mtd[i]->resume(info->mtd[i]); | 218 | |
220 | return 0; | 219 | return 0; |
221 | } | 220 | } |
222 | 221 | ||
@@ -225,8 +224,8 @@ static void physmap_flash_shutdown(struct platform_device *dev) | |||
225 | struct physmap_flash_info *info = platform_get_drvdata(dev); | 224 | struct physmap_flash_info *info = platform_get_drvdata(dev); |
226 | int i; | 225 | int i; |
227 | 226 | ||
228 | for (i = 0; i < MAX_RESOURCES; i++) | 227 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) |
229 | if (info && info->mtd[i]->suspend(info->mtd[i]) == 0) | 228 | if (info->mtd[i]->suspend(info->mtd[i]) == 0) |
230 | info->mtd[i]->resume(info->mtd[i]); | 229 | info->mtd[i]->resume(info->mtd[i]); |
231 | } | 230 | } |
232 | #else | 231 | #else |
diff --git a/drivers/mtd/nand/rtc_from4.c b/drivers/mtd/nand/rtc_from4.c index 9189ec8f243e..0f6ac250f434 100644 --- a/drivers/mtd/nand/rtc_from4.c +++ b/drivers/mtd/nand/rtc_from4.c | |||
@@ -460,7 +460,7 @@ static int rtc_from4_errstat(struct mtd_info *mtd, struct nand_chip *this, | |||
460 | er_stat |= 1 << 1; | 460 | er_stat |= 1 << 1; |
461 | kfree(buf); | 461 | kfree(buf); |
462 | } | 462 | } |
463 | 463 | out: | |
464 | rtn = status; | 464 | rtn = status; |
465 | if (er_stat == 0) { /* if ECC is available */ | 465 | if (er_stat == 0) { /* if ECC is available */ |
466 | rtn = (status & ~NAND_STATUS_FAIL); /* clear the error bit */ | 466 | rtn = (status & ~NAND_STATUS_FAIL); /* clear the error bit */ |
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index 7d253686ed0d..5ba4bab6d43e 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c | |||
@@ -485,9 +485,7 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
485 | printk(KERN_DEBUG "%s: burped during tx load.\n", | 485 | printk(KERN_DEBUG "%s: burped during tx load.\n", |
486 | dev->name); | 486 | dev->name); |
487 | spin_lock_irqsave(&lp->lock, flags); | 487 | spin_lock_irqsave(&lp->lock, flags); |
488 | } | 488 | } while (1); |
489 | while (1); | ||
490 | |||
491 | } | 489 | } |
492 | 490 | ||
493 | /** | 491 | /** |
@@ -612,7 +610,8 @@ static irqreturn_t el_interrupt(int irq, void *dev_id) | |||
612 | dev->stats.tx_packets++; | 610 | dev->stats.tx_packets++; |
613 | if (el_debug > 6) | 611 | if (el_debug > 6) |
614 | printk(KERN_DEBUG " Tx succeeded %s\n", | 612 | printk(KERN_DEBUG " Tx succeeded %s\n", |
615 | (txsr & TX_RDY) ? "." : "but tx is busy!"); | 613 | (txsr & TX_RDY) ? "." : |
614 | "but tx is busy!"); | ||
616 | /* | 615 | /* |
617 | * This is safe the interrupt is atomic WRT itself. | 616 | * This is safe the interrupt is atomic WRT itself. |
618 | */ | 617 | */ |
@@ -693,7 +692,8 @@ static void el_receive(struct net_device *dev) | |||
693 | 692 | ||
694 | if (pkt_len < 60 || pkt_len > 1536) { | 693 | if (pkt_len < 60 || pkt_len > 1536) { |
695 | if (el_debug) | 694 | if (el_debug) |
696 | printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len); | 695 | printk(KERN_DEBUG "%s: bogus packet, length=%d\n", |
696 | dev->name, pkt_len); | ||
697 | dev->stats.rx_over_errors++; | 697 | dev->stats.rx_over_errors++; |
698 | return; | 698 | return; |
699 | } | 699 | } |
@@ -711,7 +711,8 @@ static void el_receive(struct net_device *dev) | |||
711 | 711 | ||
712 | outw(0x00, GP_LOW); | 712 | outw(0x00, GP_LOW); |
713 | if (skb == NULL) { | 713 | if (skb == NULL) { |
714 | printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name); | 714 | printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", |
715 | dev->name); | ||
715 | dev->stats.rx_dropped++; | 716 | dev->stats.rx_dropped++; |
716 | return; | 717 | return; |
717 | } else { | 718 | } else { |
@@ -748,7 +749,8 @@ static void el_reset(struct net_device *dev) | |||
748 | if (el_debug > 2) | 749 | if (el_debug > 2) |
749 | printk(KERN_INFO "3c501 reset..."); | 750 | printk(KERN_INFO "3c501 reset..."); |
750 | outb(AX_RESET, AX_CMD); /* Reset the chip */ | 751 | outb(AX_RESET, AX_CMD); /* Reset the chip */ |
751 | outb(AX_LOOP, AX_CMD); /* Aux control, irq and loopback enabled */ | 752 | /* Aux control, irq and loopback enabled */ |
753 | outb(AX_LOOP, AX_CMD); | ||
752 | { | 754 | { |
753 | int i; | 755 | int i; |
754 | for (i = 0; i < 6; i++) /* Set the station address. */ | 756 | for (i = 0; i < 6; i++) /* Set the station address. */ |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index a0f0e605d630..fe7b5ec09708 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2366,15 +2366,15 @@ config GELIC_NET | |||
2366 | module will be called ps3_gelic. | 2366 | module will be called ps3_gelic. |
2367 | 2367 | ||
2368 | config GELIC_WIRELESS | 2368 | config GELIC_WIRELESS |
2369 | bool "PS3 Wireless support" | 2369 | bool "PS3 Wireless support" |
2370 | depends on GELIC_NET | 2370 | depends on GELIC_NET |
2371 | select WIRELESS_EXT | 2371 | select WIRELESS_EXT |
2372 | help | 2372 | help |
2373 | This option adds the support for the wireless feature of PS3. | 2373 | This option adds the support for the wireless feature of PS3. |
2374 | If you have the wireless-less model of PS3 or have no plan to | 2374 | If you have the wireless-less model of PS3 or have no plan to |
2375 | use wireless feature, disabling this option saves memory. As | 2375 | use wireless feature, disabling this option saves memory. As |
2376 | the driver automatically distinguishes the models, you can | 2376 | the driver automatically distinguishes the models, you can |
2377 | safely enable this option even if you have a wireless-less model. | 2377 | safely enable this option even if you have a wireless-less model. |
2378 | 2378 | ||
2379 | config GIANFAR | 2379 | config GIANFAR |
2380 | tristate "Gianfar Ethernet" | 2380 | tristate "Gianfar Ethernet" |
@@ -2519,7 +2519,7 @@ config CHELSIO_T3 | |||
2519 | 2519 | ||
2520 | config EHEA | 2520 | config EHEA |
2521 | tristate "eHEA Ethernet support" | 2521 | tristate "eHEA Ethernet support" |
2522 | depends on IBMEBUS && INET | 2522 | depends on IBMEBUS && INET && SPARSEMEM |
2523 | select INET_LRO | 2523 | select INET_LRO |
2524 | ---help--- | 2524 | ---help--- |
2525 | This driver supports the IBM pSeries eHEA ethernet adapter. | 2525 | This driver supports the IBM pSeries eHEA ethernet adapter. |
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c index 5136d94923aa..b1448637107f 100644 --- a/drivers/net/ac3200.c +++ b/drivers/net/ac3200.c | |||
@@ -369,7 +369,7 @@ MODULE_PARM_DESC(mem, "Memory base address(es)"); | |||
369 | MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver"); | 369 | MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver"); |
370 | MODULE_LICENSE("GPL"); | 370 | MODULE_LICENSE("GPL"); |
371 | 371 | ||
372 | int __init init_module(void) | 372 | static int __init ac3200_module_init(void) |
373 | { | 373 | { |
374 | struct net_device *dev; | 374 | struct net_device *dev; |
375 | int this_dev, found = 0; | 375 | int this_dev, found = 0; |
@@ -404,8 +404,7 @@ static void cleanup_card(struct net_device *dev) | |||
404 | iounmap(ei_status.mem); | 404 | iounmap(ei_status.mem); |
405 | } | 405 | } |
406 | 406 | ||
407 | void __exit | 407 | static void __exit ac3200_module_exit(void) |
408 | cleanup_module(void) | ||
409 | { | 408 | { |
410 | int this_dev; | 409 | int this_dev; |
411 | 410 | ||
@@ -418,4 +417,6 @@ cleanup_module(void) | |||
418 | } | 417 | } |
419 | } | 418 | } |
420 | } | 419 | } |
420 | module_init(ac3200_module_init); | ||
421 | module_exit(ac3200_module_exit); | ||
421 | #endif /* MODULE */ | 422 | #endif /* MODULE */ |
diff --git a/drivers/net/apne.c b/drivers/net/apne.c index c12cbdf368b1..47a8275d3962 100644 --- a/drivers/net/apne.c +++ b/drivers/net/apne.c | |||
@@ -569,7 +569,7 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id) | |||
569 | #ifdef MODULE | 569 | #ifdef MODULE |
570 | static struct net_device *apne_dev; | 570 | static struct net_device *apne_dev; |
571 | 571 | ||
572 | int __init init_module(void) | 572 | static int __init apne_module_init(void) |
573 | { | 573 | { |
574 | apne_dev = apne_probe(-1); | 574 | apne_dev = apne_probe(-1); |
575 | if (IS_ERR(apne_dev)) | 575 | if (IS_ERR(apne_dev)) |
@@ -577,7 +577,7 @@ int __init init_module(void) | |||
577 | return 0; | 577 | return 0; |
578 | } | 578 | } |
579 | 579 | ||
580 | void __exit cleanup_module(void) | 580 | static void __exit apne_module_exit(void) |
581 | { | 581 | { |
582 | unregister_netdev(apne_dev); | 582 | unregister_netdev(apne_dev); |
583 | 583 | ||
@@ -591,7 +591,8 @@ void __exit cleanup_module(void) | |||
591 | 591 | ||
592 | free_netdev(apne_dev); | 592 | free_netdev(apne_dev); |
593 | } | 593 | } |
594 | 594 | module_init(apne_module_init); | |
595 | module_exit(apne_module_exit); | ||
595 | #endif | 596 | #endif |
596 | 597 | ||
597 | static int init_pcmcia(void) | 598 | static int init_pcmcia(void) |
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c index 6ab2c2d4d673..fef5560bc7a2 100644 --- a/drivers/net/appletalk/ltpc.c +++ b/drivers/net/appletalk/ltpc.c | |||
@@ -1252,7 +1252,7 @@ module_param(irq, int, 0); | |||
1252 | module_param(dma, int, 0); | 1252 | module_param(dma, int, 0); |
1253 | 1253 | ||
1254 | 1254 | ||
1255 | int __init init_module(void) | 1255 | static int __init ltpc_module_init(void) |
1256 | { | 1256 | { |
1257 | if(io == 0) | 1257 | if(io == 0) |
1258 | printk(KERN_NOTICE | 1258 | printk(KERN_NOTICE |
@@ -1263,6 +1263,7 @@ int __init init_module(void) | |||
1263 | return PTR_ERR(dev_ltpc); | 1263 | return PTR_ERR(dev_ltpc); |
1264 | return 0; | 1264 | return 0; |
1265 | } | 1265 | } |
1266 | module_init(ltpc_module_init); | ||
1266 | #endif | 1267 | #endif |
1267 | 1268 | ||
1268 | static void __exit ltpc_cleanup(void) | 1269 | static void __exit ltpc_cleanup(void) |
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index cc4610db6395..02cb8f1c1148 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c | |||
@@ -80,17 +80,19 @@ void arcnet_cap_init(void) | |||
80 | 80 | ||
81 | #ifdef MODULE | 81 | #ifdef MODULE |
82 | 82 | ||
83 | int __init init_module(void) | 83 | static int __init capmode_module_init(void) |
84 | { | 84 | { |
85 | printk(VERSION); | 85 | printk(VERSION); |
86 | arcnet_cap_init(); | 86 | arcnet_cap_init(); |
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | void cleanup_module(void) | 90 | static void __exit capmode_module_exit(void) |
91 | { | 91 | { |
92 | arcnet_unregister_proto(&capmode_proto); | 92 | arcnet_unregister_proto(&capmode_proto); |
93 | } | 93 | } |
94 | module_init(capmode_module_init); | ||
95 | module_exit(capmode_module_exit); | ||
94 | 96 | ||
95 | MODULE_LICENSE("GPL"); | 97 | MODULE_LICENSE("GPL"); |
96 | #endif /* MODULE */ | 98 | #endif /* MODULE */ |
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c index b74dbeef8050..13c293b286de 100644 --- a/drivers/net/atarilance.c +++ b/drivers/net/atarilance.c | |||
@@ -336,8 +336,6 @@ struct lance_addr { | |||
336 | 336 | ||
337 | /***************************** Prototypes *****************************/ | 337 | /***************************** Prototypes *****************************/ |
338 | 338 | ||
339 | static int addr_accessible( volatile void *regp, int wordflag, int | ||
340 | writeflag ); | ||
341 | static unsigned long lance_probe1( struct net_device *dev, struct lance_addr | 339 | static unsigned long lance_probe1( struct net_device *dev, struct lance_addr |
342 | *init_rec ); | 340 | *init_rec ); |
343 | static int lance_open( struct net_device *dev ); | 341 | static int lance_open( struct net_device *dev ); |
@@ -406,7 +404,8 @@ struct net_device * __init atarilance_probe(int unit) | |||
406 | 404 | ||
407 | /* Derived from hwreg_present() in atari/config.c: */ | 405 | /* Derived from hwreg_present() in atari/config.c: */ |
408 | 406 | ||
409 | static int __init addr_accessible( volatile void *regp, int wordflag, int writeflag ) | 407 | static noinline int __init addr_accessible(volatile void *regp, int wordflag, |
408 | int writeflag) | ||
410 | { | 409 | { |
411 | int ret; | 410 | int ret; |
412 | long flags; | 411 | long flags; |
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 9200ee59d854..129b8b3aa773 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -1765,15 +1765,12 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
1765 | { | 1765 | { |
1766 | struct atl1_adapter *adapter = netdev_priv(data); | 1766 | struct atl1_adapter *adapter = netdev_priv(data); |
1767 | u32 status; | 1767 | u32 status; |
1768 | u8 update_rx; | ||
1769 | int max_ints = 10; | 1768 | int max_ints = 10; |
1770 | 1769 | ||
1771 | status = adapter->cmb.cmb->int_stats; | 1770 | status = adapter->cmb.cmb->int_stats; |
1772 | if (!status) | 1771 | if (!status) |
1773 | return IRQ_NONE; | 1772 | return IRQ_NONE; |
1774 | 1773 | ||
1775 | update_rx = 0; | ||
1776 | |||
1777 | do { | 1774 | do { |
1778 | /* clear CMB interrupt status at once */ | 1775 | /* clear CMB interrupt status at once */ |
1779 | adapter->cmb.cmb->int_stats = 0; | 1776 | adapter->cmb.cmb->int_stats = 0; |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index ea2a2b548e3c..25f1337cd02c 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -2082,6 +2082,11 @@ static int __devinit b44_get_invariants(struct b44 *bp) | |||
2082 | addr = sdev->bus->sprom.et0mac; | 2082 | addr = sdev->bus->sprom.et0mac; |
2083 | bp->phy_addr = sdev->bus->sprom.et0phyaddr; | 2083 | bp->phy_addr = sdev->bus->sprom.et0phyaddr; |
2084 | } | 2084 | } |
2085 | /* Some ROMs have buggy PHY addresses with the high | ||
2086 | * bits set (sign extension?). Truncate them to a | ||
2087 | * valid PHY address. */ | ||
2088 | bp->phy_addr &= 0x1F; | ||
2089 | |||
2085 | memcpy(bp->dev->dev_addr, addr, 6); | 2090 | memcpy(bp->dev->dev_addr, addr, 6); |
2086 | 2091 | ||
2087 | if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){ | 2092 | if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){ |
diff --git a/drivers/net/bnx2x.c b/drivers/net/bnx2x.c index 8af142ccf373..de32b3fba322 100644 --- a/drivers/net/bnx2x.c +++ b/drivers/net/bnx2x.c | |||
@@ -63,8 +63,8 @@ | |||
63 | #include "bnx2x.h" | 63 | #include "bnx2x.h" |
64 | #include "bnx2x_init.h" | 64 | #include "bnx2x_init.h" |
65 | 65 | ||
66 | #define DRV_MODULE_VERSION "1.40.22" | 66 | #define DRV_MODULE_VERSION "1.42.3" |
67 | #define DRV_MODULE_RELDATE "2007/11/27" | 67 | #define DRV_MODULE_RELDATE "2008/3/9" |
68 | #define BNX2X_BC_VER 0x040200 | 68 | #define BNX2X_BC_VER 0x040200 |
69 | 69 | ||
70 | /* Time in jiffies before concluding the transmitter is hung. */ | 70 | /* Time in jiffies before concluding the transmitter is hung. */ |
@@ -8008,38 +8008,6 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
8008 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, | 8008 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, |
8009 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); | 8009 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); |
8010 | 8010 | ||
8011 | switch (cmd->port) { | ||
8012 | case PORT_TP: | ||
8013 | if (!(bp->supported & SUPPORTED_TP)) { | ||
8014 | DP(NETIF_MSG_LINK, "TP not supported\n"); | ||
8015 | return -EINVAL; | ||
8016 | } | ||
8017 | |||
8018 | if (bp->phy_flags & PHY_XGXS_FLAG) { | ||
8019 | bnx2x_link_reset(bp); | ||
8020 | bnx2x_link_settings_supported(bp, SWITCH_CFG_1G); | ||
8021 | bnx2x_phy_deassert(bp); | ||
8022 | } | ||
8023 | break; | ||
8024 | |||
8025 | case PORT_FIBRE: | ||
8026 | if (!(bp->supported & SUPPORTED_FIBRE)) { | ||
8027 | DP(NETIF_MSG_LINK, "FIBRE not supported\n"); | ||
8028 | return -EINVAL; | ||
8029 | } | ||
8030 | |||
8031 | if (!(bp->phy_flags & PHY_XGXS_FLAG)) { | ||
8032 | bnx2x_link_reset(bp); | ||
8033 | bnx2x_link_settings_supported(bp, SWITCH_CFG_10G); | ||
8034 | bnx2x_phy_deassert(bp); | ||
8035 | } | ||
8036 | break; | ||
8037 | |||
8038 | default: | ||
8039 | DP(NETIF_MSG_LINK, "Unknown port type\n"); | ||
8040 | return -EINVAL; | ||
8041 | } | ||
8042 | |||
8043 | if (cmd->autoneg == AUTONEG_ENABLE) { | 8011 | if (cmd->autoneg == AUTONEG_ENABLE) { |
8044 | if (!(bp->supported & SUPPORTED_Autoneg)) { | 8012 | if (!(bp->supported & SUPPORTED_Autoneg)) { |
8045 | DP(NETIF_MSG_LINK, "Aotoneg not supported\n"); | 8013 | DP(NETIF_MSG_LINK, "Aotoneg not supported\n"); |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index cb3c6faa7888..d16e0e1d2b30 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -310,7 +310,7 @@ static inline int __check_agg_selection_timer(struct port *port) | |||
310 | */ | 310 | */ |
311 | static inline void __get_rx_machine_lock(struct port *port) | 311 | static inline void __get_rx_machine_lock(struct port *port) |
312 | { | 312 | { |
313 | spin_lock(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); | 313 | spin_lock_bh(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); |
314 | } | 314 | } |
315 | 315 | ||
316 | /** | 316 | /** |
@@ -320,7 +320,7 @@ static inline void __get_rx_machine_lock(struct port *port) | |||
320 | */ | 320 | */ |
321 | static inline void __release_rx_machine_lock(struct port *port) | 321 | static inline void __release_rx_machine_lock(struct port *port) |
322 | { | 322 | { |
323 | spin_unlock(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); | 323 | spin_unlock_bh(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); |
324 | } | 324 | } |
325 | 325 | ||
326 | /** | 326 | /** |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index b57bc9467dbe..3f58c3d0b710 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -678,12 +678,8 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon | |||
678 | } | 678 | } |
679 | 679 | ||
680 | if (!list_empty(&bond->vlan_list)) { | 680 | if (!list_empty(&bond->vlan_list)) { |
681 | unsigned short vlan_id; | 681 | if (!vlan_get_tag(skb, &client_info->vlan_id)) |
682 | int res = vlan_get_tag(skb, &vlan_id); | ||
683 | if (!res) { | ||
684 | client_info->tag = 1; | 682 | client_info->tag = 1; |
685 | client_info->vlan_id = vlan_id; | ||
686 | } | ||
687 | } | 683 | } |
688 | 684 | ||
689 | if (!client_info->assigned) { | 685 | if (!client_info->assigned) { |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 0942d82f7cbf..0f0675319e9c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -383,7 +383,7 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) | |||
383 | */ | 383 | */ |
384 | int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev) | 384 | int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev) |
385 | { | 385 | { |
386 | unsigned short vlan_id; | 386 | unsigned short uninitialized_var(vlan_id); |
387 | 387 | ||
388 | if (!list_empty(&bond->vlan_list) && | 388 | if (!list_empty(&bond->vlan_list) && |
389 | !(slave_dev->features & NETIF_F_HW_VLAN_TX) && | 389 | !(slave_dev->features & NETIF_F_HW_VLAN_TX) && |
@@ -4528,8 +4528,7 @@ static void bond_free_all(void) | |||
4528 | netif_tx_unlock_bh(bond_dev); | 4528 | netif_tx_unlock_bh(bond_dev); |
4529 | /* Release the bonded slaves */ | 4529 | /* Release the bonded slaves */ |
4530 | bond_release_all(bond_dev); | 4530 | bond_release_all(bond_dev); |
4531 | bond_deinit(bond_dev); | 4531 | bond_destroy(bond); |
4532 | unregister_netdevice(bond_dev); | ||
4533 | } | 4532 | } |
4534 | 4533 | ||
4535 | #ifdef CONFIG_PROC_FS | 4534 | #ifdef CONFIG_PROC_FS |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 67ccad69d445..a3c74e20aa53 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -22,8 +22,8 @@ | |||
22 | #include "bond_3ad.h" | 22 | #include "bond_3ad.h" |
23 | #include "bond_alb.h" | 23 | #include "bond_alb.h" |
24 | 24 | ||
25 | #define DRV_VERSION "3.2.4" | 25 | #define DRV_VERSION "3.2.5" |
26 | #define DRV_RELDATE "January 28, 2008" | 26 | #define DRV_RELDATE "March 21, 2008" |
27 | #define DRV_NAME "bonding" | 27 | #define DRV_NAME "bonding" |
28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" | 28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" |
29 | 29 | ||
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 979f3fc5e765..98a6bbd11d4c 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -557,9 +557,9 @@ static void t3_free_qset(struct adapter *adapter, struct sge_qset *q) | |||
557 | 557 | ||
558 | for (i = 0; i < SGE_RXQ_PER_SET; ++i) | 558 | for (i = 0; i < SGE_RXQ_PER_SET; ++i) |
559 | if (q->fl[i].desc) { | 559 | if (q->fl[i].desc) { |
560 | spin_lock(&adapter->sge.reg_lock); | 560 | spin_lock_irq(&adapter->sge.reg_lock); |
561 | t3_sge_disable_fl(adapter, q->fl[i].cntxt_id); | 561 | t3_sge_disable_fl(adapter, q->fl[i].cntxt_id); |
562 | spin_unlock(&adapter->sge.reg_lock); | 562 | spin_unlock_irq(&adapter->sge.reg_lock); |
563 | free_rx_bufs(pdev, &q->fl[i]); | 563 | free_rx_bufs(pdev, &q->fl[i]); |
564 | kfree(q->fl[i].sdesc); | 564 | kfree(q->fl[i].sdesc); |
565 | dma_free_coherent(&pdev->dev, | 565 | dma_free_coherent(&pdev->dev, |
@@ -570,9 +570,9 @@ static void t3_free_qset(struct adapter *adapter, struct sge_qset *q) | |||
570 | 570 | ||
571 | for (i = 0; i < SGE_TXQ_PER_SET; ++i) | 571 | for (i = 0; i < SGE_TXQ_PER_SET; ++i) |
572 | if (q->txq[i].desc) { | 572 | if (q->txq[i].desc) { |
573 | spin_lock(&adapter->sge.reg_lock); | 573 | spin_lock_irq(&adapter->sge.reg_lock); |
574 | t3_sge_enable_ecntxt(adapter, q->txq[i].cntxt_id, 0); | 574 | t3_sge_enable_ecntxt(adapter, q->txq[i].cntxt_id, 0); |
575 | spin_unlock(&adapter->sge.reg_lock); | 575 | spin_unlock_irq(&adapter->sge.reg_lock); |
576 | if (q->txq[i].sdesc) { | 576 | if (q->txq[i].sdesc) { |
577 | free_tx_desc(adapter, &q->txq[i], | 577 | free_tx_desc(adapter, &q->txq[i], |
578 | q->txq[i].in_use); | 578 | q->txq[i].in_use); |
@@ -586,9 +586,9 @@ static void t3_free_qset(struct adapter *adapter, struct sge_qset *q) | |||
586 | } | 586 | } |
587 | 587 | ||
588 | if (q->rspq.desc) { | 588 | if (q->rspq.desc) { |
589 | spin_lock(&adapter->sge.reg_lock); | 589 | spin_lock_irq(&adapter->sge.reg_lock); |
590 | t3_sge_disable_rspcntxt(adapter, q->rspq.cntxt_id); | 590 | t3_sge_disable_rspcntxt(adapter, q->rspq.cntxt_id); |
591 | spin_unlock(&adapter->sge.reg_lock); | 591 | spin_unlock_irq(&adapter->sge.reg_lock); |
592 | dma_free_coherent(&pdev->dev, | 592 | dma_free_coherent(&pdev->dev, |
593 | q->rspq.size * sizeof(struct rsp_desc), | 593 | q->rspq.size * sizeof(struct rsp_desc), |
594 | q->rspq.desc, q->rspq.phys_addr); | 594 | q->rspq.desc, q->rspq.phys_addr); |
@@ -1107,9 +1107,15 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | q->in_use += ndesc; | 1109 | q->in_use += ndesc; |
1110 | if (unlikely(credits - ndesc < q->stop_thres)) | 1110 | if (unlikely(credits - ndesc < q->stop_thres)) { |
1111 | if (USE_GTS || !should_restart_tx(q)) | 1111 | t3_stop_queue(dev, qs, q); |
1112 | t3_stop_queue(dev, qs, q); | 1112 | |
1113 | if (should_restart_tx(q) && | ||
1114 | test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) { | ||
1115 | q->restarts++; | ||
1116 | netif_wake_queue(dev); | ||
1117 | } | ||
1118 | } | ||
1113 | 1119 | ||
1114 | gen = q->gen; | 1120 | gen = q->gen; |
1115 | q->unacked += ndesc; | 1121 | q->unacked += ndesc; |
@@ -2661,7 +2667,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, | |||
2661 | (16 * 1024) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) : | 2667 | (16 * 1024) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) : |
2662 | MAX_FRAME_SIZE + 2 + sizeof(struct cpl_rx_pkt); | 2668 | MAX_FRAME_SIZE + 2 + sizeof(struct cpl_rx_pkt); |
2663 | 2669 | ||
2664 | spin_lock(&adapter->sge.reg_lock); | 2670 | spin_lock_irq(&adapter->sge.reg_lock); |
2665 | 2671 | ||
2666 | /* FL threshold comparison uses < */ | 2672 | /* FL threshold comparison uses < */ |
2667 | ret = t3_sge_init_rspcntxt(adapter, q->rspq.cntxt_id, irq_vec_idx, | 2673 | ret = t3_sge_init_rspcntxt(adapter, q->rspq.cntxt_id, irq_vec_idx, |
@@ -2705,7 +2711,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, | |||
2705 | goto err_unlock; | 2711 | goto err_unlock; |
2706 | } | 2712 | } |
2707 | 2713 | ||
2708 | spin_unlock(&adapter->sge.reg_lock); | 2714 | spin_unlock_irq(&adapter->sge.reg_lock); |
2709 | 2715 | ||
2710 | q->adap = adapter; | 2716 | q->adap = adapter; |
2711 | q->netdev = dev; | 2717 | q->netdev = dev; |
@@ -2722,7 +2728,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, | |||
2722 | return 0; | 2728 | return 0; |
2723 | 2729 | ||
2724 | err_unlock: | 2730 | err_unlock: |
2725 | spin_unlock(&adapter->sge.reg_lock); | 2731 | spin_unlock_irq(&adapter->sge.reg_lock); |
2726 | err: | 2732 | err: |
2727 | t3_free_qset(adapter, q); | 2733 | t3_free_qset(adapter, q); |
2728 | return ret; | 2734 | return ret; |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 1fe305ca2cf0..d63cc93f055d 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -798,8 +798,6 @@ dm9000_init_dm9000(struct net_device *dev) | |||
798 | /* Set address filter table */ | 798 | /* Set address filter table */ |
799 | dm9000_hash_table(dev); | 799 | dm9000_hash_table(dev); |
800 | 800 | ||
801 | /* Activate DM9000 */ | ||
802 | iow(db, DM9000_RCR, RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN); | ||
803 | /* Enable TX/RX interrupt mask */ | 801 | /* Enable TX/RX interrupt mask */ |
804 | iow(db, DM9000_IMR, IMR_PAR | IMR_PTM | IMR_PRM); | 802 | iow(db, DM9000_IMR, IMR_PAR | IMR_PTM | IMR_PRM); |
805 | 803 | ||
@@ -970,7 +968,7 @@ dm9000_interrupt(int irq, void *dev_id) | |||
970 | struct dm9000_rxhdr { | 968 | struct dm9000_rxhdr { |
971 | u8 RxPktReady; | 969 | u8 RxPktReady; |
972 | u8 RxStatus; | 970 | u8 RxStatus; |
973 | u16 RxLen; | 971 | __le16 RxLen; |
974 | } __attribute__((__packed__)); | 972 | } __attribute__((__packed__)); |
975 | 973 | ||
976 | /* | 974 | /* |
@@ -1197,6 +1195,7 @@ dm9000_hash_table(struct net_device *dev) | |||
1197 | int i, oft; | 1195 | int i, oft; |
1198 | u32 hash_val; | 1196 | u32 hash_val; |
1199 | u16 hash_table[4]; | 1197 | u16 hash_table[4]; |
1198 | u8 rcr = RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN; | ||
1200 | unsigned long flags; | 1199 | unsigned long flags; |
1201 | 1200 | ||
1202 | dm9000_dbg(db, 1, "entering %s\n", __func__); | 1201 | dm9000_dbg(db, 1, "entering %s\n", __func__); |
@@ -1213,6 +1212,12 @@ dm9000_hash_table(struct net_device *dev) | |||
1213 | /* broadcast address */ | 1212 | /* broadcast address */ |
1214 | hash_table[3] = 0x8000; | 1213 | hash_table[3] = 0x8000; |
1215 | 1214 | ||
1215 | if (dev->flags & IFF_PROMISC) | ||
1216 | rcr |= RCR_PRMSC; | ||
1217 | |||
1218 | if (dev->flags & IFF_ALLMULTI) | ||
1219 | rcr |= RCR_ALL; | ||
1220 | |||
1216 | /* the multicast address in Hash Table : 64 bits */ | 1221 | /* the multicast address in Hash Table : 64 bits */ |
1217 | for (i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { | 1222 | for (i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { |
1218 | hash_val = ether_crc_le(6, mcptr->dmi_addr) & 0x3f; | 1223 | hash_val = ether_crc_le(6, mcptr->dmi_addr) & 0x3f; |
@@ -1225,6 +1230,7 @@ dm9000_hash_table(struct net_device *dev) | |||
1225 | iow(db, oft++, hash_table[i] >> 8); | 1230 | iow(db, oft++, hash_table[i] >> 8); |
1226 | } | 1231 | } |
1227 | 1232 | ||
1233 | iow(db, DM9000_RCR, rcr); | ||
1228 | spin_unlock_irqrestore(&db->lock, flags); | 1234 | spin_unlock_irqrestore(&db->lock, flags); |
1229 | } | 1235 | } |
1230 | 1236 | ||
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 36ba6dc96acc..2d139ec79777 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -960,7 +960,7 @@ static void e100_get_defaults(struct nic *nic) | |||
960 | 960 | ||
961 | /* Template for a freshly allocated RFD */ | 961 | /* Template for a freshly allocated RFD */ |
962 | nic->blank_rfd.command = 0; | 962 | nic->blank_rfd.command = 0; |
963 | nic->blank_rfd.rbd = 0xFFFFFFFF; | 963 | nic->blank_rfd.rbd = cpu_to_le32(0xFFFFFFFF); |
964 | nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN); | 964 | nic->blank_rfd.size = cpu_to_le16(VLAN_ETH_FRAME_LEN); |
965 | 965 | ||
966 | /* MII setup */ | 966 | /* MII setup */ |
@@ -2782,16 +2782,13 @@ static void __devexit e100_remove(struct pci_dev *pdev) | |||
2782 | } | 2782 | } |
2783 | } | 2783 | } |
2784 | 2784 | ||
2785 | #ifdef CONFIG_PM | ||
2786 | static int e100_suspend(struct pci_dev *pdev, pm_message_t state) | 2785 | static int e100_suspend(struct pci_dev *pdev, pm_message_t state) |
2787 | { | 2786 | { |
2788 | struct net_device *netdev = pci_get_drvdata(pdev); | 2787 | struct net_device *netdev = pci_get_drvdata(pdev); |
2789 | struct nic *nic = netdev_priv(netdev); | 2788 | struct nic *nic = netdev_priv(netdev); |
2790 | 2789 | ||
2791 | if (netif_running(netdev)) | 2790 | if (netif_running(netdev)) |
2792 | napi_disable(&nic->napi); | 2791 | e100_down(nic); |
2793 | del_timer_sync(&nic->watchdog); | ||
2794 | netif_carrier_off(nic->netdev); | ||
2795 | netif_device_detach(netdev); | 2792 | netif_device_detach(netdev); |
2796 | 2793 | ||
2797 | pci_save_state(pdev); | 2794 | pci_save_state(pdev); |
@@ -2804,14 +2801,13 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2804 | pci_enable_wake(pdev, PCI_D3cold, 0); | 2801 | pci_enable_wake(pdev, PCI_D3cold, 0); |
2805 | } | 2802 | } |
2806 | 2803 | ||
2807 | free_irq(pdev->irq, netdev); | ||
2808 | |||
2809 | pci_disable_device(pdev); | 2804 | pci_disable_device(pdev); |
2810 | pci_set_power_state(pdev, PCI_D3hot); | 2805 | pci_set_power_state(pdev, PCI_D3hot); |
2811 | 2806 | ||
2812 | return 0; | 2807 | return 0; |
2813 | } | 2808 | } |
2814 | 2809 | ||
2810 | #ifdef CONFIG_PM | ||
2815 | static int e100_resume(struct pci_dev *pdev) | 2811 | static int e100_resume(struct pci_dev *pdev) |
2816 | { | 2812 | { |
2817 | struct net_device *netdev = pci_get_drvdata(pdev); | 2813 | struct net_device *netdev = pci_get_drvdata(pdev); |
@@ -2832,26 +2828,7 @@ static int e100_resume(struct pci_dev *pdev) | |||
2832 | 2828 | ||
2833 | static void e100_shutdown(struct pci_dev *pdev) | 2829 | static void e100_shutdown(struct pci_dev *pdev) |
2834 | { | 2830 | { |
2835 | struct net_device *netdev = pci_get_drvdata(pdev); | 2831 | e100_suspend(pdev, PMSG_SUSPEND); |
2836 | struct nic *nic = netdev_priv(netdev); | ||
2837 | |||
2838 | if (netif_running(netdev)) | ||
2839 | napi_disable(&nic->napi); | ||
2840 | del_timer_sync(&nic->watchdog); | ||
2841 | netif_carrier_off(nic->netdev); | ||
2842 | |||
2843 | if ((nic->flags & wol_magic) | e100_asf(nic)) { | ||
2844 | pci_enable_wake(pdev, PCI_D3hot, 1); | ||
2845 | pci_enable_wake(pdev, PCI_D3cold, 1); | ||
2846 | } else { | ||
2847 | pci_enable_wake(pdev, PCI_D3hot, 0); | ||
2848 | pci_enable_wake(pdev, PCI_D3cold, 0); | ||
2849 | } | ||
2850 | |||
2851 | free_irq(pdev->irq, netdev); | ||
2852 | |||
2853 | pci_disable_device(pdev); | ||
2854 | pci_set_power_state(pdev, PCI_D3hot); | ||
2855 | } | 2832 | } |
2856 | 2833 | ||
2857 | /* ------------------ PCI Error Recovery infrastructure -------------- */ | 2834 | /* ------------------ PCI Error Recovery infrastructure -------------- */ |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 7c4ead35cfa2..93b7fb246960 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | 41 | ||
42 | #define DRV_NAME "ehea" | 42 | #define DRV_NAME "ehea" |
43 | #define DRV_VERSION "EHEA_0087" | 43 | #define DRV_VERSION "EHEA_0089" |
44 | 44 | ||
45 | /* eHEA capability flags */ | 45 | /* eHEA capability flags */ |
46 | #define DLPAR_PORT_ADD_REM 1 | 46 | #define DLPAR_PORT_ADD_REM 1 |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 21af674b764e..07c742dd3f09 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -3108,7 +3108,7 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, | |||
3108 | dev->vlan_rx_add_vid = ehea_vlan_rx_add_vid; | 3108 | dev->vlan_rx_add_vid = ehea_vlan_rx_add_vid; |
3109 | dev->vlan_rx_kill_vid = ehea_vlan_rx_kill_vid; | 3109 | dev->vlan_rx_kill_vid = ehea_vlan_rx_kill_vid; |
3110 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO | 3110 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO |
3111 | | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_TX | 3111 | | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX |
3112 | | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER | 3112 | | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER |
3113 | | NETIF_F_LLTX; | 3113 | | NETIF_F_LLTX; |
3114 | dev->tx_timeout = &ehea_tx_watchdog; | 3114 | dev->tx_timeout = &ehea_tx_watchdog; |
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 0809a6a5a286..46a90e9ec563 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c | |||
@@ -900,7 +900,7 @@ static void enc28j60_hw_rx(struct net_device *ndev) | |||
900 | if (RSV_GETBIT(rxstat, RSV_LENCHECKERR)) | 900 | if (RSV_GETBIT(rxstat, RSV_LENCHECKERR)) |
901 | ndev->stats.rx_frame_errors++; | 901 | ndev->stats.rx_frame_errors++; |
902 | } else { | 902 | } else { |
903 | skb = dev_alloc_skb(len); | 903 | skb = dev_alloc_skb(len + NET_IP_ALIGN); |
904 | if (!skb) { | 904 | if (!skb) { |
905 | if (netif_msg_rx_err(priv)) | 905 | if (netif_msg_rx_err(priv)) |
906 | dev_err(&ndev->dev, | 906 | dev_err(&ndev->dev, |
@@ -908,6 +908,7 @@ static void enc28j60_hw_rx(struct net_device *ndev) | |||
908 | ndev->stats.rx_dropped++; | 908 | ndev->stats.rx_dropped++; |
909 | } else { | 909 | } else { |
910 | skb->dev = ndev; | 910 | skb->dev = ndev; |
911 | skb_reserve(skb, NET_IP_ALIGN); | ||
911 | /* copy the packet from the receive buffer */ | 912 | /* copy the packet from the receive buffer */ |
912 | enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), | 913 | enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), |
913 | len, skb_put(skb, len)); | 914 | len, skb_put(skb, len)); |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 0b365b8d947b..76118ddd1042 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -131,8 +131,8 @@ IIIa. Ring buffers | |||
131 | 131 | ||
132 | IVb. References | 132 | IVb. References |
133 | 133 | ||
134 | http://www.smsc.com/main/datasheets/83c171.pdf | 134 | http://www.smsc.com/main/tools/discontinued/83c171.pdf |
135 | http://www.smsc.com/main/datasheets/83c175.pdf | 135 | http://www.smsc.com/main/tools/discontinued/83c175.pdf |
136 | http://scyld.com/expert/NWay.html | 136 | http://scyld.com/expert/NWay.html |
137 | http://www.national.com/pf/DP/DP83840A.html | 137 | http://www.national.com/pf/DP/DP83840A.html |
138 | 138 | ||
@@ -227,7 +227,12 @@ static const u16 media2miictl[16] = { | |||
227 | 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0, | 227 | 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0, |
228 | 0, 0, 0, 0, 0, 0, 0, 0 }; | 228 | 0, 0, 0, 0, 0, 0, 0, 0 }; |
229 | 229 | ||
230 | /* The EPIC100 Rx and Tx buffer descriptors. */ | 230 | /* |
231 | * The EPIC100 Rx and Tx buffer descriptors. Note that these | ||
232 | * really ARE host-endian; it's not a misannotation. We tell | ||
233 | * the card to byteswap them internally on big-endian hosts - | ||
234 | * look for #ifdef CONFIG_BIG_ENDIAN in epic_open(). | ||
235 | */ | ||
231 | 236 | ||
232 | struct epic_tx_desc { | 237 | struct epic_tx_desc { |
233 | u32 txstatus; | 238 | u32 txstatus; |
@@ -418,7 +423,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, | |||
418 | 423 | ||
419 | /* Note: the '175 does not have a serial EEPROM. */ | 424 | /* Note: the '175 does not have a serial EEPROM. */ |
420 | for (i = 0; i < 3; i++) | 425 | for (i = 0; i < 3; i++) |
421 | ((u16 *)dev->dev_addr)[i] = le16_to_cpu(inw(ioaddr + LAN0 + i*4)); | 426 | ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(inw(ioaddr + LAN0 + i*4)); |
422 | 427 | ||
423 | if (debug > 2) { | 428 | if (debug > 2) { |
424 | dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n"); | 429 | dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n"); |
@@ -682,7 +687,8 @@ static int epic_open(struct net_device *dev) | |||
682 | if (ep->chip_flags & MII_PWRDWN) | 687 | if (ep->chip_flags & MII_PWRDWN) |
683 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); | 688 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); |
684 | 689 | ||
685 | #if defined(__powerpc__) || defined(__sparc__) /* Big endian */ | 690 | /* Tell the chip to byteswap descriptors on big-endian hosts */ |
691 | #ifdef CONFIG_BIG_ENDIAN | ||
686 | outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 692 | outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
687 | inl(ioaddr + GENCTL); | 693 | inl(ioaddr + GENCTL); |
688 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 694 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
@@ -695,7 +701,7 @@ static int epic_open(struct net_device *dev) | |||
695 | udelay(20); /* Looks like EPII needs that if you want reliable RX init. FIXME: pci posting bug? */ | 701 | udelay(20); /* Looks like EPII needs that if you want reliable RX init. FIXME: pci posting bug? */ |
696 | 702 | ||
697 | for (i = 0; i < 3; i++) | 703 | for (i = 0; i < 3; i++) |
698 | outl(cpu_to_le16(((u16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); | 704 | outl(le16_to_cpu(((__le16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); |
699 | 705 | ||
700 | ep->tx_threshold = TX_FIFO_THRESH; | 706 | ep->tx_threshold = TX_FIFO_THRESH; |
701 | outl(ep->tx_threshold, ioaddr + TxThresh); | 707 | outl(ep->tx_threshold, ioaddr + TxThresh); |
@@ -798,7 +804,7 @@ static void epic_restart(struct net_device *dev) | |||
798 | for (i = 16; i > 0; i--) | 804 | for (i = 16; i > 0; i--) |
799 | outl(0x0008, ioaddr + TEST1); | 805 | outl(0x0008, ioaddr + TEST1); |
800 | 806 | ||
801 | #if defined(__powerpc__) || defined(__sparc__) /* Big endian */ | 807 | #ifdef CONFIG_BIG_ENDIAN |
802 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 808 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
803 | #else | 809 | #else |
804 | outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 810 | outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
@@ -808,7 +814,7 @@ static void epic_restart(struct net_device *dev) | |||
808 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); | 814 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); |
809 | 815 | ||
810 | for (i = 0; i < 3; i++) | 816 | for (i = 0; i < 3; i++) |
811 | outl(cpu_to_le16(((u16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); | 817 | outl(le16_to_cpu(((__le16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); |
812 | 818 | ||
813 | ep->tx_threshold = TX_FIFO_THRESH; | 819 | ep->tx_threshold = TX_FIFO_THRESH; |
814 | outl(ep->tx_threshold, ioaddr + TxThresh); | 820 | outl(ep->tx_threshold, ioaddr + TxThresh); |
@@ -919,7 +925,7 @@ static void epic_init_ring(struct net_device *dev) | |||
919 | /* Initialize all Rx descriptors. */ | 925 | /* Initialize all Rx descriptors. */ |
920 | for (i = 0; i < RX_RING_SIZE; i++) { | 926 | for (i = 0; i < RX_RING_SIZE; i++) { |
921 | ep->rx_ring[i].rxstatus = 0; | 927 | ep->rx_ring[i].rxstatus = 0; |
922 | ep->rx_ring[i].buflength = cpu_to_le32(ep->rx_buf_sz); | 928 | ep->rx_ring[i].buflength = ep->rx_buf_sz; |
923 | ep->rx_ring[i].next = ep->rx_ring_dma + | 929 | ep->rx_ring[i].next = ep->rx_ring_dma + |
924 | (i+1)*sizeof(struct epic_rx_desc); | 930 | (i+1)*sizeof(struct epic_rx_desc); |
925 | ep->rx_skbuff[i] = NULL; | 931 | ep->rx_skbuff[i] = NULL; |
@@ -936,7 +942,7 @@ static void epic_init_ring(struct net_device *dev) | |||
936 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ | 942 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ |
937 | ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, | 943 | ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, |
938 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); | 944 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); |
939 | ep->rx_ring[i].rxstatus = cpu_to_le32(DescOwn); | 945 | ep->rx_ring[i].rxstatus = DescOwn; |
940 | } | 946 | } |
941 | ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE); | 947 | ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE); |
942 | 948 | ||
@@ -974,20 +980,20 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
974 | ep->tx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, skb->data, | 980 | ep->tx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, skb->data, |
975 | skb->len, PCI_DMA_TODEVICE); | 981 | skb->len, PCI_DMA_TODEVICE); |
976 | if (free_count < TX_QUEUE_LEN/2) {/* Typical path */ | 982 | if (free_count < TX_QUEUE_LEN/2) {/* Typical path */ |
977 | ctrl_word = cpu_to_le32(0x100000); /* No interrupt */ | 983 | ctrl_word = 0x100000; /* No interrupt */ |
978 | } else if (free_count == TX_QUEUE_LEN/2) { | 984 | } else if (free_count == TX_QUEUE_LEN/2) { |
979 | ctrl_word = cpu_to_le32(0x140000); /* Tx-done intr. */ | 985 | ctrl_word = 0x140000; /* Tx-done intr. */ |
980 | } else if (free_count < TX_QUEUE_LEN - 1) { | 986 | } else if (free_count < TX_QUEUE_LEN - 1) { |
981 | ctrl_word = cpu_to_le32(0x100000); /* No Tx-done intr. */ | 987 | ctrl_word = 0x100000; /* No Tx-done intr. */ |
982 | } else { | 988 | } else { |
983 | /* Leave room for an additional entry. */ | 989 | /* Leave room for an additional entry. */ |
984 | ctrl_word = cpu_to_le32(0x140000); /* Tx-done intr. */ | 990 | ctrl_word = 0x140000; /* Tx-done intr. */ |
985 | ep->tx_full = 1; | 991 | ep->tx_full = 1; |
986 | } | 992 | } |
987 | ep->tx_ring[entry].buflength = ctrl_word | cpu_to_le32(skb->len); | 993 | ep->tx_ring[entry].buflength = ctrl_word | skb->len; |
988 | ep->tx_ring[entry].txstatus = | 994 | ep->tx_ring[entry].txstatus = |
989 | ((skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN) << 16) | 995 | ((skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN) << 16) |
990 | | cpu_to_le32(DescOwn); | 996 | | DescOwn; |
991 | 997 | ||
992 | ep->cur_tx++; | 998 | ep->cur_tx++; |
993 | if (ep->tx_full) | 999 | if (ep->tx_full) |
@@ -1041,7 +1047,7 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep) | |||
1041 | for (dirty_tx = ep->dirty_tx; cur_tx - dirty_tx > 0; dirty_tx++) { | 1047 | for (dirty_tx = ep->dirty_tx; cur_tx - dirty_tx > 0; dirty_tx++) { |
1042 | struct sk_buff *skb; | 1048 | struct sk_buff *skb; |
1043 | int entry = dirty_tx % TX_RING_SIZE; | 1049 | int entry = dirty_tx % TX_RING_SIZE; |
1044 | int txstatus = le32_to_cpu(ep->tx_ring[entry].txstatus); | 1050 | int txstatus = ep->tx_ring[entry].txstatus; |
1045 | 1051 | ||
1046 | if (txstatus & DescOwn) | 1052 | if (txstatus & DescOwn) |
1047 | break; /* It still hasn't been Txed */ | 1053 | break; /* It still hasn't been Txed */ |
@@ -1163,8 +1169,8 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1163 | rx_work_limit = budget; | 1169 | rx_work_limit = budget; |
1164 | 1170 | ||
1165 | /* If we own the next entry, it's a new packet. Send it up. */ | 1171 | /* If we own the next entry, it's a new packet. Send it up. */ |
1166 | while ((ep->rx_ring[entry].rxstatus & cpu_to_le32(DescOwn)) == 0) { | 1172 | while ((ep->rx_ring[entry].rxstatus & DescOwn) == 0) { |
1167 | int status = le32_to_cpu(ep->rx_ring[entry].rxstatus); | 1173 | int status = ep->rx_ring[entry].rxstatus; |
1168 | 1174 | ||
1169 | if (debug > 4) | 1175 | if (debug > 4) |
1170 | printk(KERN_DEBUG " epic_rx() status was %8.8x.\n", status); | 1176 | printk(KERN_DEBUG " epic_rx() status was %8.8x.\n", status); |
@@ -1238,7 +1244,8 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1238 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1244 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1239 | work_done++; | 1245 | work_done++; |
1240 | } | 1246 | } |
1241 | ep->rx_ring[entry].rxstatus = cpu_to_le32(DescOwn); | 1247 | /* AV: shouldn't we add a barrier here? */ |
1248 | ep->rx_ring[entry].rxstatus = DescOwn; | ||
1242 | } | 1249 | } |
1243 | return work_done; | 1250 | return work_done; |
1244 | } | 1251 | } |
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c index 1837584c4504..6a3ac4ea97e9 100644 --- a/drivers/net/fec_mpc52xx_phy.c +++ b/drivers/net/fec_mpc52xx_phy.c | |||
@@ -109,7 +109,8 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of, const struct of_device_i | |||
109 | int irq = irq_of_parse_and_map(child, 0); | 109 | int irq = irq_of_parse_and_map(child, 0); |
110 | if (irq != NO_IRQ) { | 110 | if (irq != NO_IRQ) { |
111 | const u32 *id = of_get_property(child, "reg", NULL); | 111 | const u32 *id = of_get_property(child, "reg", NULL); |
112 | bus->irq[*id] = irq; | 112 | if (id) |
113 | bus->irq[*id] = irq; | ||
113 | } | 114 | } |
114 | } | 115 | } |
115 | 116 | ||
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 801b4d9cd972..6f7e3fde9e7c 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -184,6 +184,7 @@ | |||
184 | #define DEV_HAS_PAUSEFRAME_TX_V1 0x08000 /* device supports tx pause frames version 1 */ | 184 | #define DEV_HAS_PAUSEFRAME_TX_V1 0x08000 /* device supports tx pause frames version 1 */ |
185 | #define DEV_HAS_PAUSEFRAME_TX_V2 0x10000 /* device supports tx pause frames version 2 */ | 185 | #define DEV_HAS_PAUSEFRAME_TX_V2 0x10000 /* device supports tx pause frames version 2 */ |
186 | #define DEV_HAS_PAUSEFRAME_TX_V3 0x20000 /* device supports tx pause frames version 3 */ | 186 | #define DEV_HAS_PAUSEFRAME_TX_V3 0x20000 /* device supports tx pause frames version 3 */ |
187 | #define DEV_NEED_TX_LIMIT 0x40000 /* device needs to limit tx */ | ||
187 | 188 | ||
188 | enum { | 189 | enum { |
189 | NvRegIrqStatus = 0x000, | 190 | NvRegIrqStatus = 0x000, |
@@ -635,6 +636,8 @@ union ring_type { | |||
635 | #define NV_RESTART_TX 0x1 | 636 | #define NV_RESTART_TX 0x1 |
636 | #define NV_RESTART_RX 0x2 | 637 | #define NV_RESTART_RX 0x2 |
637 | 638 | ||
639 | #define NV_TX_LIMIT_COUNT 16 | ||
640 | |||
638 | /* statistics */ | 641 | /* statistics */ |
639 | struct nv_ethtool_str { | 642 | struct nv_ethtool_str { |
640 | char name[ETH_GSTRING_LEN]; | 643 | char name[ETH_GSTRING_LEN]; |
@@ -743,6 +746,8 @@ struct nv_skb_map { | |||
743 | struct sk_buff *skb; | 746 | struct sk_buff *skb; |
744 | dma_addr_t dma; | 747 | dma_addr_t dma; |
745 | unsigned int dma_len; | 748 | unsigned int dma_len; |
749 | struct ring_desc_ex *first_tx_desc; | ||
750 | struct nv_skb_map *next_tx_ctx; | ||
746 | }; | 751 | }; |
747 | 752 | ||
748 | /* | 753 | /* |
@@ -827,6 +832,10 @@ struct fe_priv { | |||
827 | union ring_type tx_ring; | 832 | union ring_type tx_ring; |
828 | u32 tx_flags; | 833 | u32 tx_flags; |
829 | int tx_ring_size; | 834 | int tx_ring_size; |
835 | int tx_limit; | ||
836 | u32 tx_pkts_in_progress; | ||
837 | struct nv_skb_map *tx_change_owner; | ||
838 | struct nv_skb_map *tx_end_flip; | ||
830 | int tx_stop; | 839 | int tx_stop; |
831 | 840 | ||
832 | /* vlan fields */ | 841 | /* vlan fields */ |
@@ -1707,6 +1716,9 @@ static void nv_init_tx(struct net_device *dev) | |||
1707 | np->last_tx.ex = &np->tx_ring.ex[np->tx_ring_size-1]; | 1716 | np->last_tx.ex = &np->tx_ring.ex[np->tx_ring_size-1]; |
1708 | np->get_tx_ctx = np->put_tx_ctx = np->first_tx_ctx = np->tx_skb; | 1717 | np->get_tx_ctx = np->put_tx_ctx = np->first_tx_ctx = np->tx_skb; |
1709 | np->last_tx_ctx = &np->tx_skb[np->tx_ring_size-1]; | 1718 | np->last_tx_ctx = &np->tx_skb[np->tx_ring_size-1]; |
1719 | np->tx_pkts_in_progress = 0; | ||
1720 | np->tx_change_owner = NULL; | ||
1721 | np->tx_end_flip = NULL; | ||
1710 | 1722 | ||
1711 | for (i = 0; i < np->tx_ring_size; i++) { | 1723 | for (i = 0; i < np->tx_ring_size; i++) { |
1712 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1724 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
@@ -1720,6 +1732,9 @@ static void nv_init_tx(struct net_device *dev) | |||
1720 | } | 1732 | } |
1721 | np->tx_skb[i].skb = NULL; | 1733 | np->tx_skb[i].skb = NULL; |
1722 | np->tx_skb[i].dma = 0; | 1734 | np->tx_skb[i].dma = 0; |
1735 | np->tx_skb[i].dma_len = 0; | ||
1736 | np->tx_skb[i].first_tx_desc = NULL; | ||
1737 | np->tx_skb[i].next_tx_ctx = NULL; | ||
1723 | } | 1738 | } |
1724 | } | 1739 | } |
1725 | 1740 | ||
@@ -1771,7 +1786,14 @@ static void nv_drain_tx(struct net_device *dev) | |||
1771 | } | 1786 | } |
1772 | if (nv_release_txskb(dev, &np->tx_skb[i])) | 1787 | if (nv_release_txskb(dev, &np->tx_skb[i])) |
1773 | dev->stats.tx_dropped++; | 1788 | dev->stats.tx_dropped++; |
1789 | np->tx_skb[i].dma = 0; | ||
1790 | np->tx_skb[i].dma_len = 0; | ||
1791 | np->tx_skb[i].first_tx_desc = NULL; | ||
1792 | np->tx_skb[i].next_tx_ctx = NULL; | ||
1774 | } | 1793 | } |
1794 | np->tx_pkts_in_progress = 0; | ||
1795 | np->tx_change_owner = NULL; | ||
1796 | np->tx_end_flip = NULL; | ||
1775 | } | 1797 | } |
1776 | 1798 | ||
1777 | static void nv_drain_rx(struct net_device *dev) | 1799 | static void nv_drain_rx(struct net_device *dev) |
@@ -1948,6 +1970,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev) | |||
1948 | struct ring_desc_ex* start_tx; | 1970 | struct ring_desc_ex* start_tx; |
1949 | struct ring_desc_ex* prev_tx; | 1971 | struct ring_desc_ex* prev_tx; |
1950 | struct nv_skb_map* prev_tx_ctx; | 1972 | struct nv_skb_map* prev_tx_ctx; |
1973 | struct nv_skb_map* start_tx_ctx; | ||
1951 | 1974 | ||
1952 | /* add fragments to entries count */ | 1975 | /* add fragments to entries count */ |
1953 | for (i = 0; i < fragments; i++) { | 1976 | for (i = 0; i < fragments; i++) { |
@@ -1965,6 +1988,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev) | |||
1965 | } | 1988 | } |
1966 | 1989 | ||
1967 | start_tx = put_tx = np->put_tx.ex; | 1990 | start_tx = put_tx = np->put_tx.ex; |
1991 | start_tx_ctx = np->put_tx_ctx; | ||
1968 | 1992 | ||
1969 | /* setup the header buffer */ | 1993 | /* setup the header buffer */ |
1970 | do { | 1994 | do { |
@@ -2037,6 +2061,26 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev) | |||
2037 | 2061 | ||
2038 | spin_lock_irq(&np->lock); | 2062 | spin_lock_irq(&np->lock); |
2039 | 2063 | ||
2064 | if (np->tx_limit) { | ||
2065 | /* Limit the number of outstanding tx. Setup all fragments, but | ||
2066 | * do not set the VALID bit on the first descriptor. Save a pointer | ||
2067 | * to that descriptor and also for next skb_map element. | ||
2068 | */ | ||
2069 | |||
2070 | if (np->tx_pkts_in_progress == NV_TX_LIMIT_COUNT) { | ||
2071 | if (!np->tx_change_owner) | ||
2072 | np->tx_change_owner = start_tx_ctx; | ||
2073 | |||
2074 | /* remove VALID bit */ | ||
2075 | tx_flags &= ~NV_TX2_VALID; | ||
2076 | start_tx_ctx->first_tx_desc = start_tx; | ||
2077 | start_tx_ctx->next_tx_ctx = np->put_tx_ctx; | ||
2078 | np->tx_end_flip = np->put_tx_ctx; | ||
2079 | } else { | ||
2080 | np->tx_pkts_in_progress++; | ||
2081 | } | ||
2082 | } | ||
2083 | |||
2040 | /* set tx flags */ | 2084 | /* set tx flags */ |
2041 | start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); | 2085 | start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); |
2042 | np->put_tx.ex = put_tx; | 2086 | np->put_tx.ex = put_tx; |
@@ -2060,6 +2104,25 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev) | |||
2060 | return NETDEV_TX_OK; | 2104 | return NETDEV_TX_OK; |
2061 | } | 2105 | } |
2062 | 2106 | ||
2107 | static inline void nv_tx_flip_ownership(struct net_device *dev) | ||
2108 | { | ||
2109 | struct fe_priv *np = netdev_priv(dev); | ||
2110 | |||
2111 | np->tx_pkts_in_progress--; | ||
2112 | if (np->tx_change_owner) { | ||
2113 | __le32 flaglen = le32_to_cpu(np->tx_change_owner->first_tx_desc->flaglen); | ||
2114 | flaglen |= NV_TX2_VALID; | ||
2115 | np->tx_change_owner->first_tx_desc->flaglen = cpu_to_le32(flaglen); | ||
2116 | np->tx_pkts_in_progress++; | ||
2117 | |||
2118 | np->tx_change_owner = np->tx_change_owner->next_tx_ctx; | ||
2119 | if (np->tx_change_owner == np->tx_end_flip) | ||
2120 | np->tx_change_owner = NULL; | ||
2121 | |||
2122 | writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); | ||
2123 | } | ||
2124 | } | ||
2125 | |||
2063 | /* | 2126 | /* |
2064 | * nv_tx_done: check for completed packets, release the skbs. | 2127 | * nv_tx_done: check for completed packets, release the skbs. |
2065 | * | 2128 | * |
@@ -2147,6 +2210,10 @@ static void nv_tx_done_optimized(struct net_device *dev, int limit) | |||
2147 | dev->stats.tx_packets++; | 2210 | dev->stats.tx_packets++; |
2148 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2211 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
2149 | np->get_tx_ctx->skb = NULL; | 2212 | np->get_tx_ctx->skb = NULL; |
2213 | |||
2214 | if (np->tx_limit) { | ||
2215 | nv_tx_flip_ownership(dev); | ||
2216 | } | ||
2150 | } | 2217 | } |
2151 | if (unlikely(np->get_tx.ex++ == np->last_tx.ex)) | 2218 | if (unlikely(np->get_tx.ex++ == np->last_tx.ex)) |
2152 | np->get_tx.ex = np->first_tx.ex; | 2219 | np->get_tx.ex = np->first_tx.ex; |
@@ -5333,6 +5400,21 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5333 | np->need_linktimer = 0; | 5400 | np->need_linktimer = 0; |
5334 | } | 5401 | } |
5335 | 5402 | ||
5403 | /* Limit the number of tx's outstanding for hw bug */ | ||
5404 | if (id->driver_data & DEV_NEED_TX_LIMIT) { | ||
5405 | np->tx_limit = 1; | ||
5406 | if ((id->device == PCI_DEVICE_ID_NVIDIA_NVENET_32 || | ||
5407 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_33 || | ||
5408 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_34 || | ||
5409 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_35 || | ||
5410 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_36 || | ||
5411 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_37 || | ||
5412 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_38 || | ||
5413 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_39) && | ||
5414 | pci_dev->revision >= 0xA2) | ||
5415 | np->tx_limit = 0; | ||
5416 | } | ||
5417 | |||
5336 | /* clear phy state and temporarily halt phy interrupts */ | 5418 | /* clear phy state and temporarily halt phy interrupts */ |
5337 | writel(0, base + NvRegMIIMask); | 5419 | writel(0, base + NvRegMIIMask); |
5338 | phystate = readl(base + NvRegAdapterControl); | 5420 | phystate = readl(base + NvRegAdapterControl); |
@@ -5563,19 +5645,19 @@ static struct pci_device_id pci_tbl[] = { | |||
5563 | }, | 5645 | }, |
5564 | { /* CK804 Ethernet Controller */ | 5646 | { /* CK804 Ethernet Controller */ |
5565 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), | 5647 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), |
5566 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, | 5648 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT, |
5567 | }, | 5649 | }, |
5568 | { /* CK804 Ethernet Controller */ | 5650 | { /* CK804 Ethernet Controller */ |
5569 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), | 5651 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), |
5570 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, | 5652 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT, |
5571 | }, | 5653 | }, |
5572 | { /* MCP04 Ethernet Controller */ | 5654 | { /* MCP04 Ethernet Controller */ |
5573 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), | 5655 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), |
5574 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, | 5656 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT, |
5575 | }, | 5657 | }, |
5576 | { /* MCP04 Ethernet Controller */ | 5658 | { /* MCP04 Ethernet Controller */ |
5577 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), | 5659 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), |
5578 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, | 5660 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT, |
5579 | }, | 5661 | }, |
5580 | { /* MCP51 Ethernet Controller */ | 5662 | { /* MCP51 Ethernet Controller */ |
5581 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), | 5663 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), |
@@ -5587,11 +5669,11 @@ static struct pci_device_id pci_tbl[] = { | |||
5587 | }, | 5669 | }, |
5588 | { /* MCP55 Ethernet Controller */ | 5670 | { /* MCP55 Ethernet Controller */ |
5589 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), | 5671 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), |
5590 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5672 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT, |
5591 | }, | 5673 | }, |
5592 | { /* MCP55 Ethernet Controller */ | 5674 | { /* MCP55 Ethernet Controller */ |
5593 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), | 5675 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), |
5594 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5676 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT, |
5595 | }, | 5677 | }, |
5596 | { /* MCP61 Ethernet Controller */ | 5678 | { /* MCP61 Ethernet Controller */ |
5597 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16), | 5679 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16), |
@@ -5611,19 +5693,19 @@ static struct pci_device_id pci_tbl[] = { | |||
5611 | }, | 5693 | }, |
5612 | { /* MCP65 Ethernet Controller */ | 5694 | { /* MCP65 Ethernet Controller */ |
5613 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20), | 5695 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20), |
5614 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, | 5696 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT|DEV_NEED_TX_LIMIT, |
5615 | }, | 5697 | }, |
5616 | { /* MCP65 Ethernet Controller */ | 5698 | { /* MCP65 Ethernet Controller */ |
5617 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21), | 5699 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21), |
5618 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, | 5700 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT, |
5619 | }, | 5701 | }, |
5620 | { /* MCP65 Ethernet Controller */ | 5702 | { /* MCP65 Ethernet Controller */ |
5621 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22), | 5703 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22), |
5622 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, | 5704 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT, |
5623 | }, | 5705 | }, |
5624 | { /* MCP65 Ethernet Controller */ | 5706 | { /* MCP65 Ethernet Controller */ |
5625 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23), | 5707 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23), |
5626 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, | 5708 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT, |
5627 | }, | 5709 | }, |
5628 | { /* MCP67 Ethernet Controller */ | 5710 | { /* MCP67 Ethernet Controller */ |
5629 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_24), | 5711 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_24), |
@@ -5659,35 +5741,35 @@ static struct pci_device_id pci_tbl[] = { | |||
5659 | }, | 5741 | }, |
5660 | { /* MCP77 Ethernet Controller */ | 5742 | { /* MCP77 Ethernet Controller */ |
5661 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32), | 5743 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32), |
5662 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5744 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5663 | }, | 5745 | }, |
5664 | { /* MCP77 Ethernet Controller */ | 5746 | { /* MCP77 Ethernet Controller */ |
5665 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33), | 5747 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33), |
5666 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5748 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5667 | }, | 5749 | }, |
5668 | { /* MCP77 Ethernet Controller */ | 5750 | { /* MCP77 Ethernet Controller */ |
5669 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34), | 5751 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34), |
5670 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5752 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5671 | }, | 5753 | }, |
5672 | { /* MCP77 Ethernet Controller */ | 5754 | { /* MCP77 Ethernet Controller */ |
5673 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), | 5755 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), |
5674 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5756 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5675 | }, | 5757 | }, |
5676 | { /* MCP79 Ethernet Controller */ | 5758 | { /* MCP79 Ethernet Controller */ |
5677 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), | 5759 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), |
5678 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5760 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5679 | }, | 5761 | }, |
5680 | { /* MCP79 Ethernet Controller */ | 5762 | { /* MCP79 Ethernet Controller */ |
5681 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), | 5763 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), |
5682 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5764 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5683 | }, | 5765 | }, |
5684 | { /* MCP79 Ethernet Controller */ | 5766 | { /* MCP79 Ethernet Controller */ |
5685 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), | 5767 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), |
5686 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5768 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5687 | }, | 5769 | }, |
5688 | { /* MCP79 Ethernet Controller */ | 5770 | { /* MCP79 Ethernet Controller */ |
5689 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), | 5771 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), |
5690 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5772 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5691 | }, | 5773 | }, |
5692 | {0,}, | 5774 | {0,}, |
5693 | }; | 5775 | }; |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index e6c69f77259b..0789802d59ed 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -143,6 +143,10 @@ static inline void emac_report_timeout_error(struct emac_instance *dev, | |||
143 | #define STOP_TIMEOUT_1000 13 | 143 | #define STOP_TIMEOUT_1000 13 |
144 | #define STOP_TIMEOUT_1000_JUMBO 73 | 144 | #define STOP_TIMEOUT_1000_JUMBO 73 |
145 | 145 | ||
146 | static unsigned char default_mcast_addr[] = { | ||
147 | 0x01, 0x80, 0xC2, 0x00, 0x00, 0x01 | ||
148 | }; | ||
149 | |||
146 | /* Please, keep in sync with struct ibm_emac_stats/ibm_emac_error_stats */ | 150 | /* Please, keep in sync with struct ibm_emac_stats/ibm_emac_error_stats */ |
147 | static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = { | 151 | static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = { |
148 | "rx_packets", "rx_bytes", "tx_packets", "tx_bytes", "rx_packets_csum", | 152 | "rx_packets", "rx_bytes", "tx_packets", "tx_bytes", "rx_packets_csum", |
@@ -618,6 +622,9 @@ static int emac_configure(struct emac_instance *dev) | |||
618 | if (emac_phy_gpcs(dev->phy.mode)) | 622 | if (emac_phy_gpcs(dev->phy.mode)) |
619 | emac_mii_reset_phy(&dev->phy); | 623 | emac_mii_reset_phy(&dev->phy); |
620 | 624 | ||
625 | /* Required for Pause packet support in EMAC */ | ||
626 | dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1); | ||
627 | |||
621 | return 0; | 628 | return 0; |
622 | } | 629 | } |
623 | 630 | ||
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c index 96417adec326..b023d10d7e1c 100644 --- a/drivers/net/ibm_newemac/tah.c +++ b/drivers/net/ibm_newemac/tah.c | |||
@@ -155,6 +155,10 @@ static int __devexit tah_remove(struct of_device *ofdev) | |||
155 | static struct of_device_id tah_match[] = | 155 | static struct of_device_id tah_match[] = |
156 | { | 156 | { |
157 | { | 157 | { |
158 | .compatible = "ibm,tah", | ||
159 | }, | ||
160 | /* For backward compat with old DT */ | ||
161 | { | ||
158 | .type = "tah", | 162 | .type = "tah", |
159 | }, | 163 | }, |
160 | {}, | 164 | {}, |
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 15949d3df17e..af233b591534 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <net/pkt_sched.h> | 36 | #include <net/pkt_sched.h> |
37 | #include <net/net_namespace.h> | 37 | #include <net/net_namespace.h> |
38 | #include <linux/lockdep.h> | ||
38 | 39 | ||
39 | #define TX_TIMEOUT (2*HZ) | 40 | #define TX_TIMEOUT (2*HZ) |
40 | 41 | ||
@@ -227,6 +228,16 @@ static struct rtnl_link_ops ifb_link_ops __read_mostly = { | |||
227 | module_param(numifbs, int, 0); | 228 | module_param(numifbs, int, 0); |
228 | MODULE_PARM_DESC(numifbs, "Number of ifb devices"); | 229 | MODULE_PARM_DESC(numifbs, "Number of ifb devices"); |
229 | 230 | ||
231 | /* | ||
232 | * dev_ifb->queue_lock is usually taken after dev->ingress_lock, | ||
233 | * reversely to e.g. qdisc_lock_tree(). It should be safe until | ||
234 | * ifb doesn't take dev->queue_lock with dev_ifb->ingress_lock. | ||
235 | * But lockdep should know that ifb has different locks from dev. | ||
236 | */ | ||
237 | static struct lock_class_key ifb_queue_lock_key; | ||
238 | static struct lock_class_key ifb_ingress_lock_key; | ||
239 | |||
240 | |||
230 | static int __init ifb_init_one(int index) | 241 | static int __init ifb_init_one(int index) |
231 | { | 242 | { |
232 | struct net_device *dev_ifb; | 243 | struct net_device *dev_ifb; |
@@ -246,6 +257,10 @@ static int __init ifb_init_one(int index) | |||
246 | err = register_netdevice(dev_ifb); | 257 | err = register_netdevice(dev_ifb); |
247 | if (err < 0) | 258 | if (err < 0) |
248 | goto err; | 259 | goto err; |
260 | |||
261 | lockdep_set_class(&dev_ifb->queue_lock, &ifb_queue_lock_key); | ||
262 | lockdep_set_class(&dev_ifb->ingress_lock, &ifb_ingress_lock_key); | ||
263 | |||
249 | return 0; | 264 | return 0; |
250 | 265 | ||
251 | err: | 266 | err: |
diff --git a/drivers/net/igb/e1000_82575.h b/drivers/net/igb/e1000_82575.h index 6604d96bd567..76ea846663db 100644 --- a/drivers/net/igb/e1000_82575.h +++ b/drivers/net/igb/e1000_82575.h | |||
@@ -61,28 +61,28 @@ | |||
61 | /* Receive Descriptor - Advanced */ | 61 | /* Receive Descriptor - Advanced */ |
62 | union e1000_adv_rx_desc { | 62 | union e1000_adv_rx_desc { |
63 | struct { | 63 | struct { |
64 | u64 pkt_addr; /* Packet buffer address */ | 64 | __le64 pkt_addr; /* Packet buffer address */ |
65 | u64 hdr_addr; /* Header buffer address */ | 65 | __le64 hdr_addr; /* Header buffer address */ |
66 | } read; | 66 | } read; |
67 | struct { | 67 | struct { |
68 | struct { | 68 | struct { |
69 | struct { | 69 | struct { |
70 | u16 pkt_info; /* RSS type, Packet type */ | 70 | __le16 pkt_info; /* RSS type, Packet type */ |
71 | u16 hdr_info; /* Split Header, | 71 | __le16 hdr_info; /* Split Header, |
72 | * header buffer length */ | 72 | * header buffer length */ |
73 | } lo_dword; | 73 | } lo_dword; |
74 | union { | 74 | union { |
75 | u32 rss; /* RSS Hash */ | 75 | __le32 rss; /* RSS Hash */ |
76 | struct { | 76 | struct { |
77 | u16 ip_id; /* IP id */ | 77 | __le16 ip_id; /* IP id */ |
78 | u16 csum; /* Packet Checksum */ | 78 | __le16 csum; /* Packet Checksum */ |
79 | } csum_ip; | 79 | } csum_ip; |
80 | } hi_dword; | 80 | } hi_dword; |
81 | } lower; | 81 | } lower; |
82 | struct { | 82 | struct { |
83 | u32 status_error; /* ext status/error */ | 83 | __le32 status_error; /* ext status/error */ |
84 | u16 length; /* Packet length */ | 84 | __le16 length; /* Packet length */ |
85 | u16 vlan; /* VLAN tag */ | 85 | __le16 vlan; /* VLAN tag */ |
86 | } upper; | 86 | } upper; |
87 | } wb; /* writeback */ | 87 | } wb; /* writeback */ |
88 | }; | 88 | }; |
@@ -97,14 +97,14 @@ union e1000_adv_rx_desc { | |||
97 | /* Transmit Descriptor - Advanced */ | 97 | /* Transmit Descriptor - Advanced */ |
98 | union e1000_adv_tx_desc { | 98 | union e1000_adv_tx_desc { |
99 | struct { | 99 | struct { |
100 | u64 buffer_addr; /* Address of descriptor's data buf */ | 100 | __le64 buffer_addr; /* Address of descriptor's data buf */ |
101 | u32 cmd_type_len; | 101 | __le32 cmd_type_len; |
102 | u32 olinfo_status; | 102 | __le32 olinfo_status; |
103 | } read; | 103 | } read; |
104 | struct { | 104 | struct { |
105 | u64 rsvd; /* Reserved */ | 105 | __le64 rsvd; /* Reserved */ |
106 | u32 nxtseq_seed; | 106 | __le32 nxtseq_seed; |
107 | u32 status; | 107 | __le32 status; |
108 | } wb; | 108 | } wb; |
109 | }; | 109 | }; |
110 | 110 | ||
@@ -119,10 +119,10 @@ union e1000_adv_tx_desc { | |||
119 | 119 | ||
120 | /* Context descriptors */ | 120 | /* Context descriptors */ |
121 | struct e1000_adv_tx_context_desc { | 121 | struct e1000_adv_tx_context_desc { |
122 | u32 vlan_macip_lens; | 122 | __le32 vlan_macip_lens; |
123 | u32 seqnum_seed; | 123 | __le32 seqnum_seed; |
124 | u32 type_tucmd_mlhl; | 124 | __le32 type_tucmd_mlhl; |
125 | u32 mss_l4len_idx; | 125 | __le32 mss_l4len_idx; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | #define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ | 128 | #define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ |
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h index 161fb68764af..7b2c70a3b8cc 100644 --- a/drivers/net/igb/e1000_hw.h +++ b/drivers/net/igb/e1000_hw.h | |||
@@ -143,35 +143,35 @@ enum e1000_fc_type { | |||
143 | 143 | ||
144 | /* Receive Descriptor */ | 144 | /* Receive Descriptor */ |
145 | struct e1000_rx_desc { | 145 | struct e1000_rx_desc { |
146 | u64 buffer_addr; /* Address of the descriptor's data buffer */ | 146 | __le64 buffer_addr; /* Address of the descriptor's data buffer */ |
147 | u16 length; /* Length of data DMAed into data buffer */ | 147 | __le16 length; /* Length of data DMAed into data buffer */ |
148 | u16 csum; /* Packet checksum */ | 148 | __le16 csum; /* Packet checksum */ |
149 | u8 status; /* Descriptor status */ | 149 | u8 status; /* Descriptor status */ |
150 | u8 errors; /* Descriptor Errors */ | 150 | u8 errors; /* Descriptor Errors */ |
151 | u16 special; | 151 | __le16 special; |
152 | }; | 152 | }; |
153 | 153 | ||
154 | /* Receive Descriptor - Extended */ | 154 | /* Receive Descriptor - Extended */ |
155 | union e1000_rx_desc_extended { | 155 | union e1000_rx_desc_extended { |
156 | struct { | 156 | struct { |
157 | u64 buffer_addr; | 157 | __le64 buffer_addr; |
158 | u64 reserved; | 158 | __le64 reserved; |
159 | } read; | 159 | } read; |
160 | struct { | 160 | struct { |
161 | struct { | 161 | struct { |
162 | u32 mrq; /* Multiple Rx Queues */ | 162 | __le32 mrq; /* Multiple Rx Queues */ |
163 | union { | 163 | union { |
164 | u32 rss; /* RSS Hash */ | 164 | __le32 rss; /* RSS Hash */ |
165 | struct { | 165 | struct { |
166 | u16 ip_id; /* IP id */ | 166 | __le16 ip_id; /* IP id */ |
167 | u16 csum; /* Packet Checksum */ | 167 | __le16 csum; /* Packet Checksum */ |
168 | } csum_ip; | 168 | } csum_ip; |
169 | } hi_dword; | 169 | } hi_dword; |
170 | } lower; | 170 | } lower; |
171 | struct { | 171 | struct { |
172 | u32 status_error; /* ext status/error */ | 172 | __le32 status_error; /* ext status/error */ |
173 | u16 length; | 173 | __le16 length; |
174 | u16 vlan; /* VLAN tag */ | 174 | __le16 vlan; /* VLAN tag */ |
175 | } upper; | 175 | } upper; |
176 | } wb; /* writeback */ | 176 | } wb; /* writeback */ |
177 | }; | 177 | }; |
@@ -181,49 +181,49 @@ union e1000_rx_desc_extended { | |||
181 | union e1000_rx_desc_packet_split { | 181 | union e1000_rx_desc_packet_split { |
182 | struct { | 182 | struct { |
183 | /* one buffer for protocol header(s), three data buffers */ | 183 | /* one buffer for protocol header(s), three data buffers */ |
184 | u64 buffer_addr[MAX_PS_BUFFERS]; | 184 | __le64 buffer_addr[MAX_PS_BUFFERS]; |
185 | } read; | 185 | } read; |
186 | struct { | 186 | struct { |
187 | struct { | 187 | struct { |
188 | u32 mrq; /* Multiple Rx Queues */ | 188 | __le32 mrq; /* Multiple Rx Queues */ |
189 | union { | 189 | union { |
190 | u32 rss; /* RSS Hash */ | 190 | __le32 rss; /* RSS Hash */ |
191 | struct { | 191 | struct { |
192 | u16 ip_id; /* IP id */ | 192 | __le16 ip_id; /* IP id */ |
193 | u16 csum; /* Packet Checksum */ | 193 | __le16 csum; /* Packet Checksum */ |
194 | } csum_ip; | 194 | } csum_ip; |
195 | } hi_dword; | 195 | } hi_dword; |
196 | } lower; | 196 | } lower; |
197 | struct { | 197 | struct { |
198 | u32 status_error; /* ext status/error */ | 198 | __le32 status_error; /* ext status/error */ |
199 | u16 length0; /* length of buffer 0 */ | 199 | __le16 length0; /* length of buffer 0 */ |
200 | u16 vlan; /* VLAN tag */ | 200 | __le16 vlan; /* VLAN tag */ |
201 | } middle; | 201 | } middle; |
202 | struct { | 202 | struct { |
203 | u16 header_status; | 203 | __le16 header_status; |
204 | u16 length[3]; /* length of buffers 1-3 */ | 204 | __le16 length[3]; /* length of buffers 1-3 */ |
205 | } upper; | 205 | } upper; |
206 | u64 reserved; | 206 | __le64 reserved; |
207 | } wb; /* writeback */ | 207 | } wb; /* writeback */ |
208 | }; | 208 | }; |
209 | 209 | ||
210 | /* Transmit Descriptor */ | 210 | /* Transmit Descriptor */ |
211 | struct e1000_tx_desc { | 211 | struct e1000_tx_desc { |
212 | u64 buffer_addr; /* Address of the descriptor's data buffer */ | 212 | __le64 buffer_addr; /* Address of the descriptor's data buffer */ |
213 | union { | 213 | union { |
214 | u32 data; | 214 | __le32 data; |
215 | struct { | 215 | struct { |
216 | u16 length; /* Data buffer length */ | 216 | __le16 length; /* Data buffer length */ |
217 | u8 cso; /* Checksum offset */ | 217 | u8 cso; /* Checksum offset */ |
218 | u8 cmd; /* Descriptor control */ | 218 | u8 cmd; /* Descriptor control */ |
219 | } flags; | 219 | } flags; |
220 | } lower; | 220 | } lower; |
221 | union { | 221 | union { |
222 | u32 data; | 222 | __le32 data; |
223 | struct { | 223 | struct { |
224 | u8 status; /* Descriptor status */ | 224 | u8 status; /* Descriptor status */ |
225 | u8 css; /* Checksum start */ | 225 | u8 css; /* Checksum start */ |
226 | u16 special; | 226 | __le16 special; |
227 | } fields; | 227 | } fields; |
228 | } upper; | 228 | } upper; |
229 | }; | 229 | }; |
@@ -231,49 +231,49 @@ struct e1000_tx_desc { | |||
231 | /* Offload Context Descriptor */ | 231 | /* Offload Context Descriptor */ |
232 | struct e1000_context_desc { | 232 | struct e1000_context_desc { |
233 | union { | 233 | union { |
234 | u32 ip_config; | 234 | __le32 ip_config; |
235 | struct { | 235 | struct { |
236 | u8 ipcss; /* IP checksum start */ | 236 | u8 ipcss; /* IP checksum start */ |
237 | u8 ipcso; /* IP checksum offset */ | 237 | u8 ipcso; /* IP checksum offset */ |
238 | u16 ipcse; /* IP checksum end */ | 238 | __le16 ipcse; /* IP checksum end */ |
239 | } ip_fields; | 239 | } ip_fields; |
240 | } lower_setup; | 240 | } lower_setup; |
241 | union { | 241 | union { |
242 | u32 tcp_config; | 242 | __le32 tcp_config; |
243 | struct { | 243 | struct { |
244 | u8 tucss; /* TCP checksum start */ | 244 | u8 tucss; /* TCP checksum start */ |
245 | u8 tucso; /* TCP checksum offset */ | 245 | u8 tucso; /* TCP checksum offset */ |
246 | u16 tucse; /* TCP checksum end */ | 246 | __le16 tucse; /* TCP checksum end */ |
247 | } tcp_fields; | 247 | } tcp_fields; |
248 | } upper_setup; | 248 | } upper_setup; |
249 | u32 cmd_and_length; | 249 | __le32 cmd_and_length; |
250 | union { | 250 | union { |
251 | u32 data; | 251 | __le32 data; |
252 | struct { | 252 | struct { |
253 | u8 status; /* Descriptor status */ | 253 | u8 status; /* Descriptor status */ |
254 | u8 hdr_len; /* Header length */ | 254 | u8 hdr_len; /* Header length */ |
255 | u16 mss; /* Maximum segment size */ | 255 | __le16 mss; /* Maximum segment size */ |
256 | } fields; | 256 | } fields; |
257 | } tcp_seg_setup; | 257 | } tcp_seg_setup; |
258 | }; | 258 | }; |
259 | 259 | ||
260 | /* Offload data descriptor */ | 260 | /* Offload data descriptor */ |
261 | struct e1000_data_desc { | 261 | struct e1000_data_desc { |
262 | u64 buffer_addr; /* Address of the descriptor's buffer address */ | 262 | __le64 buffer_addr; /* Address of the descriptor's buffer address */ |
263 | union { | 263 | union { |
264 | u32 data; | 264 | __le32 data; |
265 | struct { | 265 | struct { |
266 | u16 length; /* Data buffer length */ | 266 | __le16 length; /* Data buffer length */ |
267 | u8 typ_len_ext; | 267 | u8 typ_len_ext; |
268 | u8 cmd; | 268 | u8 cmd; |
269 | } flags; | 269 | } flags; |
270 | } lower; | 270 | } lower; |
271 | union { | 271 | union { |
272 | u32 data; | 272 | __le32 data; |
273 | struct { | 273 | struct { |
274 | u8 status; /* Descriptor status */ | 274 | u8 status; /* Descriptor status */ |
275 | u8 popts; /* Packet Options */ | 275 | u8 popts; /* Packet Options */ |
276 | u16 special; | 276 | __le16 special; |
277 | } fields; | 277 | } fields; |
278 | } upper; | 278 | } upper; |
279 | }; | 279 | }; |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 6a1f23092099..aaee02e9e3f0 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/vmalloc.h> | 31 | #include <linux/vmalloc.h> |
32 | #include <linux/pagemap.h> | 32 | #include <linux/pagemap.h> |
33 | #include <linux/netdevice.h> | 33 | #include <linux/netdevice.h> |
34 | #include <linux/tcp.h> | ||
35 | #include <linux/ipv6.h> | 34 | #include <linux/ipv6.h> |
36 | #include <net/checksum.h> | 35 | #include <net/checksum.h> |
37 | #include <net/ip6_checksum.h> | 36 | #include <net/ip6_checksum.h> |
@@ -2484,10 +2483,24 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter, | |||
2484 | tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT); | 2483 | tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT); |
2485 | 2484 | ||
2486 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2485 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2487 | if (skb->protocol == htons(ETH_P_IP)) | 2486 | switch (skb->protocol) { |
2487 | case __constant_htons(ETH_P_IP): | ||
2488 | tu_cmd |= E1000_ADVTXD_TUCMD_IPV4; | 2488 | tu_cmd |= E1000_ADVTXD_TUCMD_IPV4; |
2489 | if (skb->sk && (skb->sk->sk_protocol == IPPROTO_TCP)) | 2489 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
2490 | tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP; | 2490 | tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP; |
2491 | break; | ||
2492 | case __constant_htons(ETH_P_IPV6): | ||
2493 | /* XXX what about other V6 headers?? */ | ||
2494 | if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP) | ||
2495 | tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP; | ||
2496 | break; | ||
2497 | default: | ||
2498 | if (unlikely(net_ratelimit())) | ||
2499 | dev_warn(&adapter->pdev->dev, | ||
2500 | "partial checksum but proto=%x!\n", | ||
2501 | skb->protocol); | ||
2502 | break; | ||
2503 | } | ||
2491 | } | 2504 | } |
2492 | 2505 | ||
2493 | context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd); | 2506 | context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd); |
@@ -3241,6 +3254,13 @@ quit_polling: | |||
3241 | 3254 | ||
3242 | return 1; | 3255 | return 1; |
3243 | } | 3256 | } |
3257 | |||
3258 | static inline u32 get_head(struct igb_ring *tx_ring) | ||
3259 | { | ||
3260 | void *end = (struct e1000_tx_desc *)tx_ring->desc + tx_ring->count; | ||
3261 | return le32_to_cpu(*(volatile __le32 *)end); | ||
3262 | } | ||
3263 | |||
3244 | /** | 3264 | /** |
3245 | * igb_clean_tx_irq - Reclaim resources after transmit completes | 3265 | * igb_clean_tx_irq - Reclaim resources after transmit completes |
3246 | * @adapter: board private structure | 3266 | * @adapter: board private structure |
@@ -3262,9 +3282,7 @@ static bool igb_clean_tx_irq(struct igb_adapter *adapter, | |||
3262 | unsigned int total_bytes = 0, total_packets = 0; | 3282 | unsigned int total_bytes = 0, total_packets = 0; |
3263 | 3283 | ||
3264 | rmb(); | 3284 | rmb(); |
3265 | head = *(volatile u32 *)((struct e1000_tx_desc *)tx_ring->desc | 3285 | head = get_head(tx_ring); |
3266 | + tx_ring->count); | ||
3267 | head = le32_to_cpu(head); | ||
3268 | i = tx_ring->next_to_clean; | 3286 | i = tx_ring->next_to_clean; |
3269 | while (1) { | 3287 | while (1) { |
3270 | while (i != head) { | 3288 | while (i != head) { |
@@ -3299,9 +3317,7 @@ static bool igb_clean_tx_irq(struct igb_adapter *adapter, | |||
3299 | } | 3317 | } |
3300 | oldhead = head; | 3318 | oldhead = head; |
3301 | rmb(); | 3319 | rmb(); |
3302 | head = *(volatile u32 *)((struct e1000_tx_desc *)tx_ring->desc | 3320 | head = get_head(tx_ring); |
3303 | + tx_ring->count); | ||
3304 | head = le32_to_cpu(head); | ||
3305 | if (head == oldhead) | 3321 | if (head == oldhead) |
3306 | goto done_cleaning; | 3322 | goto done_cleaning; |
3307 | } /* while (1) */ | 3323 | } /* while (1) */ |
@@ -3375,7 +3391,7 @@ done_cleaning: | |||
3375 | * @vlan: descriptor vlan field as written by hardware (no le/be conversion) | 3391 | * @vlan: descriptor vlan field as written by hardware (no le/be conversion) |
3376 | * @skb: pointer to sk_buff to be indicated to stack | 3392 | * @skb: pointer to sk_buff to be indicated to stack |
3377 | **/ | 3393 | **/ |
3378 | static void igb_receive_skb(struct igb_adapter *adapter, u8 status, u16 vlan, | 3394 | static void igb_receive_skb(struct igb_adapter *adapter, u8 status, __le16 vlan, |
3379 | struct sk_buff *skb) | 3395 | struct sk_buff *skb) |
3380 | { | 3396 | { |
3381 | if (adapter->vlgrp && (status & E1000_RXD_STAT_VP)) | 3397 | if (adapter->vlgrp && (status & E1000_RXD_STAT_VP)) |
@@ -3439,8 +3455,8 @@ static bool igb_clean_rx_irq_adv(struct igb_adapter *adapter, | |||
3439 | * that case, it fills the header buffer and spills the rest | 3455 | * that case, it fills the header buffer and spills the rest |
3440 | * into the page. | 3456 | * into the page. |
3441 | */ | 3457 | */ |
3442 | hlen = le16_to_cpu((rx_desc->wb.lower.lo_dword.hdr_info & | 3458 | hlen = (le16_to_cpu(rx_desc->wb.lower.lo_dword.hdr_info) & |
3443 | E1000_RXDADV_HDRBUFLEN_MASK) >> E1000_RXDADV_HDRBUFLEN_SHIFT); | 3459 | E1000_RXDADV_HDRBUFLEN_MASK) >> E1000_RXDADV_HDRBUFLEN_SHIFT; |
3444 | if (hlen > adapter->rx_ps_hdr_size) | 3460 | if (hlen > adapter->rx_ps_hdr_size) |
3445 | hlen = adapter->rx_ps_hdr_size; | 3461 | hlen = adapter->rx_ps_hdr_size; |
3446 | 3462 | ||
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 373f72cdbe8e..1f25263dc7eb 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -1221,7 +1221,8 @@ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) | |||
1221 | } | 1221 | } |
1222 | #endif | 1222 | #endif |
1223 | 1223 | ||
1224 | static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 1224 | static int __devinit ioc3_probe(struct pci_dev *pdev, |
1225 | const struct pci_device_id *ent) | ||
1225 | { | 1226 | { |
1226 | unsigned int sw_physid1, sw_physid2; | 1227 | unsigned int sw_physid1, sw_physid2; |
1227 | struct net_device *dev = NULL; | 1228 | struct net_device *dev = NULL; |
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c index 5e5d9b527ed1..9b358f61ed7f 100644 --- a/drivers/net/ipg.c +++ b/drivers/net/ipg.c | |||
@@ -472,7 +472,6 @@ static int ipg_config_autoneg(struct net_device *dev) | |||
472 | unsigned int txflowcontrol; | 472 | unsigned int txflowcontrol; |
473 | unsigned int rxflowcontrol; | 473 | unsigned int rxflowcontrol; |
474 | unsigned int fullduplex; | 474 | unsigned int fullduplex; |
475 | unsigned int gig; | ||
476 | u32 mac_ctrl_val; | 475 | u32 mac_ctrl_val; |
477 | u32 asicctrl; | 476 | u32 asicctrl; |
478 | u8 phyctrl; | 477 | u8 phyctrl; |
@@ -489,7 +488,6 @@ static int ipg_config_autoneg(struct net_device *dev) | |||
489 | fullduplex = 0; | 488 | fullduplex = 0; |
490 | txflowcontrol = 0; | 489 | txflowcontrol = 0; |
491 | rxflowcontrol = 0; | 490 | rxflowcontrol = 0; |
492 | gig = 0; | ||
493 | 491 | ||
494 | /* To accomodate a problem in 10Mbps operation, | 492 | /* To accomodate a problem in 10Mbps operation, |
495 | * set a global flag if PHY running in 10Mbps mode. | 493 | * set a global flag if PHY running in 10Mbps mode. |
@@ -511,7 +509,6 @@ static int ipg_config_autoneg(struct net_device *dev) | |||
511 | break; | 509 | break; |
512 | case IPG_PC_LINK_SPEED_1000MBPS: | 510 | case IPG_PC_LINK_SPEED_1000MBPS: |
513 | printk("1000Mbps.\n"); | 511 | printk("1000Mbps.\n"); |
514 | gig = 1; | ||
515 | break; | 512 | break; |
516 | default: | 513 | default: |
517 | printk("undefined!\n"); | 514 | printk("undefined!\n"); |
@@ -1900,8 +1897,13 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1900 | 1897 | ||
1901 | /* Specify the TFC field within the TFD. */ | 1898 | /* Specify the TFC field within the TFD. */ |
1902 | txfd->tfc |= cpu_to_le64(IPG_TFC_WORDALIGNDISABLED | | 1899 | txfd->tfc |= cpu_to_le64(IPG_TFC_WORDALIGNDISABLED | |
1903 | (IPG_TFC_FRAMEID & cpu_to_le64(sp->tx_current)) | | 1900 | (IPG_TFC_FRAMEID & sp->tx_current) | |
1904 | (IPG_TFC_FRAGCOUNT & (1 << 24))); | 1901 | (IPG_TFC_FRAGCOUNT & (1 << 24))); |
1902 | /* | ||
1903 | * 16--17 (WordAlign) <- 3 (disable), | ||
1904 | * 0--15 (FrameId) <- sp->tx_current, | ||
1905 | * 24--27 (FragCount) <- 1 | ||
1906 | */ | ||
1905 | 1907 | ||
1906 | /* Request TxComplete interrupts at an interval defined | 1908 | /* Request TxComplete interrupts at an interval defined |
1907 | * by the constant IPG_FRAMESBETWEENTXCOMPLETES. | 1909 | * by the constant IPG_FRAMESBETWEENTXCOMPLETES. |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 269e6f805f47..6738b4d097fe 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -2088,14 +2088,12 @@ ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter) | |||
2088 | struct ixgb_buffer *buffer_info; | 2088 | struct ixgb_buffer *buffer_info; |
2089 | struct sk_buff *skb; | 2089 | struct sk_buff *skb; |
2090 | unsigned int i; | 2090 | unsigned int i; |
2091 | int num_group_tail_writes; | ||
2092 | long cleancount; | 2091 | long cleancount; |
2093 | 2092 | ||
2094 | i = rx_ring->next_to_use; | 2093 | i = rx_ring->next_to_use; |
2095 | buffer_info = &rx_ring->buffer_info[i]; | 2094 | buffer_info = &rx_ring->buffer_info[i]; |
2096 | cleancount = IXGB_DESC_UNUSED(rx_ring); | 2095 | cleancount = IXGB_DESC_UNUSED(rx_ring); |
2097 | 2096 | ||
2098 | num_group_tail_writes = IXGB_RX_BUFFER_WRITE; | ||
2099 | 2097 | ||
2100 | /* leave three descriptors unused */ | 2098 | /* leave three descriptors unused */ |
2101 | while(--cleancount > 2) { | 2099 | while(--cleancount > 2) { |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 23d0a4afe0e1..c2095ce531c9 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2133,7 +2133,7 @@ static void ixgbe_watchdog(unsigned long data) | |||
2133 | (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? | 2133 | (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? |
2134 | "10 Gbps" : | 2134 | "10 Gbps" : |
2135 | (link_speed == IXGBE_LINK_SPEED_1GB_FULL ? | 2135 | (link_speed == IXGBE_LINK_SPEED_1GB_FULL ? |
2136 | "1 Gpbs" : "unknown speed")), | 2136 | "1 Gbps" : "unknown speed")), |
2137 | ((FLOW_RX && FLOW_TX) ? "RX/TX" : | 2137 | ((FLOW_RX && FLOW_TX) ? "RX/TX" : |
2138 | (FLOW_RX ? "RX" : | 2138 | (FLOW_RX ? "RX" : |
2139 | (FLOW_TX ? "TX" : "None")))); | 2139 | (FLOW_TX ? "TX" : "None")))); |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index b528ce77c406..771139e283af 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -2104,6 +2104,7 @@ MODULE_LICENSE("GPL"); | |||
2104 | MODULE_AUTHOR( "Rabeeh Khoury, Assaf Hoffman, Matthew Dharm, Manish Lachwani" | 2104 | MODULE_AUTHOR( "Rabeeh Khoury, Assaf Hoffman, Matthew Dharm, Manish Lachwani" |
2105 | " and Dale Farnsworth"); | 2105 | " and Dale Farnsworth"); |
2106 | MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX"); | 2106 | MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX"); |
2107 | MODULE_ALIAS("platform:mv643xx_eth"); | ||
2107 | 2108 | ||
2108 | /* | 2109 | /* |
2109 | * The second part is the low level driver of the gigE ethernet ports. | 2110 | * The second part is the low level driver of the gigE ethernet ports. |
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c index b569c90da4ba..de0de744a8fa 100644 --- a/drivers/net/ne2k-pci.c +++ b/drivers/net/ne2k-pci.c | |||
@@ -535,9 +535,9 @@ static void ne2k_pci_block_input(struct net_device *dev, int count, | |||
535 | if (count & 3) { | 535 | if (count & 3) { |
536 | buf += count & ~3; | 536 | buf += count & ~3; |
537 | if (count & 2) { | 537 | if (count & 2) { |
538 | u16 *b = (u16 *)buf; | 538 | __le16 *b = (__le16 *)buf; |
539 | 539 | ||
540 | *b++ = le16_to_cpu(inw(NE_BASE + NE_DATAPORT)); | 540 | *b++ = cpu_to_le16(inw(NE_BASE + NE_DATAPORT)); |
541 | buf = (char *)b; | 541 | buf = (char *)b; |
542 | } | 542 | } |
543 | if (count & 1) | 543 | if (count & 1) |
@@ -600,9 +600,9 @@ static void ne2k_pci_block_output(struct net_device *dev, int count, | |||
600 | if (count & 3) { | 600 | if (count & 3) { |
601 | buf += count & ~3; | 601 | buf += count & ~3; |
602 | if (count & 2) { | 602 | if (count & 2) { |
603 | u16 *b = (u16 *)buf; | 603 | __le16 *b = (__le16 *)buf; |
604 | 604 | ||
605 | outw(cpu_to_le16(*b++), NE_BASE + NE_DATAPORT); | 605 | outw(le16_to_cpu(*b++), NE_BASE + NE_DATAPORT); |
606 | buf = (char *)b; | 606 | buf = (char *)b; |
607 | } | 607 | } |
608 | } | 608 | } |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 2bc5eaae141f..7f20a03623a0 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -85,7 +85,7 @@ | |||
85 | (sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count) | 85 | (sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count) |
86 | #define RCV_BUFFSIZE \ | 86 | #define RCV_BUFFSIZE \ |
87 | (sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count) | 87 | (sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count) |
88 | #define find_diff_among(a,b,range) ((a)<=(b)?((b)-(a)):((b)+(range)-(a))) | 88 | #define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a))) |
89 | 89 | ||
90 | #define NETXEN_NETDEV_STATUS 0x1 | 90 | #define NETXEN_NETDEV_STATUS 0x1 |
91 | #define NETXEN_RCV_PRODUCER_OFFSET 0 | 91 | #define NETXEN_RCV_PRODUCER_OFFSET 0 |
@@ -204,7 +204,7 @@ enum { | |||
204 | ? RCV_DESC_LRO : \ | 204 | ? RCV_DESC_LRO : \ |
205 | (RCV_DESC_NORMAL))) | 205 | (RCV_DESC_NORMAL))) |
206 | 206 | ||
207 | #define MAX_CMD_DESCRIPTORS 1024 | 207 | #define MAX_CMD_DESCRIPTORS 4096 |
208 | #define MAX_RCV_DESCRIPTORS 16384 | 208 | #define MAX_RCV_DESCRIPTORS 16384 |
209 | #define MAX_CMD_DESCRIPTORS_HOST (MAX_CMD_DESCRIPTORS / 4) | 209 | #define MAX_CMD_DESCRIPTORS_HOST (MAX_CMD_DESCRIPTORS / 4) |
210 | #define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4) | 210 | #define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4) |
@@ -818,15 +818,8 @@ struct netxen_adapter_stats { | |||
818 | u64 badskblen; | 818 | u64 badskblen; |
819 | u64 nocmddescriptor; | 819 | u64 nocmddescriptor; |
820 | u64 polled; | 820 | u64 polled; |
821 | u64 uphappy; | 821 | u64 rxdropped; |
822 | u64 updropped; | ||
823 | u64 uplcong; | ||
824 | u64 uphcong; | ||
825 | u64 upmcong; | ||
826 | u64 updunno; | ||
827 | u64 skbfreed; | ||
828 | u64 txdropped; | 822 | u64 txdropped; |
829 | u64 txnullskb; | ||
830 | u64 csummed; | 823 | u64 csummed; |
831 | u64 no_rcv; | 824 | u64 no_rcv; |
832 | u64 rxbytes; | 825 | u64 rxbytes; |
@@ -842,7 +835,6 @@ struct netxen_rcv_desc_ctx { | |||
842 | u32 flags; | 835 | u32 flags; |
843 | u32 producer; | 836 | u32 producer; |
844 | u32 rcv_pending; /* Num of bufs posted in phantom */ | 837 | u32 rcv_pending; /* Num of bufs posted in phantom */ |
845 | u32 rcv_free; /* Num of bufs in free list */ | ||
846 | dma_addr_t phys_addr; | 838 | dma_addr_t phys_addr; |
847 | struct pci_dev *phys_pdev; | 839 | struct pci_dev *phys_pdev; |
848 | struct rcv_desc *desc_head; /* address of rx ring in Phantom */ | 840 | struct rcv_desc *desc_head; /* address of rx ring in Phantom */ |
@@ -889,8 +881,6 @@ struct netxen_adapter { | |||
889 | int mtu; | 881 | int mtu; |
890 | int portnum; | 882 | int portnum; |
891 | 883 | ||
892 | spinlock_t tx_lock; | ||
893 | spinlock_t lock; | ||
894 | struct work_struct watchdog_task; | 884 | struct work_struct watchdog_task; |
895 | struct timer_list watchdog_timer; | 885 | struct timer_list watchdog_timer; |
896 | struct work_struct tx_timeout_task; | 886 | struct work_struct tx_timeout_task; |
@@ -899,16 +889,12 @@ struct netxen_adapter { | |||
899 | 889 | ||
900 | u32 cmd_producer; | 890 | u32 cmd_producer; |
901 | __le32 *cmd_consumer; | 891 | __le32 *cmd_consumer; |
902 | |||
903 | u32 last_cmd_consumer; | 892 | u32 last_cmd_consumer; |
893 | |||
904 | u32 max_tx_desc_count; | 894 | u32 max_tx_desc_count; |
905 | u32 max_rx_desc_count; | 895 | u32 max_rx_desc_count; |
906 | u32 max_jumbo_rx_desc_count; | 896 | u32 max_jumbo_rx_desc_count; |
907 | u32 max_lro_rx_desc_count; | 897 | u32 max_lro_rx_desc_count; |
908 | /* Num of instances active on cmd buffer ring */ | ||
909 | u32 proc_cmd_buf_counter; | ||
910 | |||
911 | u32 num_threads, total_threads; /*Use to keep track of xmit threads */ | ||
912 | 898 | ||
913 | u32 flags; | 899 | u32 flags; |
914 | u32 irq; | 900 | u32 irq; |
@@ -942,6 +928,7 @@ struct netxen_adapter { | |||
942 | struct pci_dev *ctx_desc_pdev; | 928 | struct pci_dev *ctx_desc_pdev; |
943 | dma_addr_t ctx_desc_phys_addr; | 929 | dma_addr_t ctx_desc_phys_addr; |
944 | int intr_scheme; | 930 | int intr_scheme; |
931 | int msi_mode; | ||
945 | int (*enable_phy_interrupts) (struct netxen_adapter *); | 932 | int (*enable_phy_interrupts) (struct netxen_adapter *); |
946 | int (*disable_phy_interrupts) (struct netxen_adapter *); | 933 | int (*disable_phy_interrupts) (struct netxen_adapter *); |
947 | void (*handle_phy_intr) (struct netxen_adapter *); | 934 | void (*handle_phy_intr) (struct netxen_adapter *); |
@@ -1075,12 +1062,10 @@ void netxen_tso_check(struct netxen_adapter *adapter, | |||
1075 | struct cmd_desc_type0 *desc, struct sk_buff *skb); | 1062 | struct cmd_desc_type0 *desc, struct sk_buff *skb); |
1076 | int netxen_nic_hw_resources(struct netxen_adapter *adapter); | 1063 | int netxen_nic_hw_resources(struct netxen_adapter *adapter); |
1077 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); | 1064 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); |
1078 | int netxen_nic_rx_has_work(struct netxen_adapter *adapter); | ||
1079 | int netxen_nic_tx_has_work(struct netxen_adapter *adapter); | ||
1080 | void netxen_watchdog_task(struct work_struct *work); | 1065 | void netxen_watchdog_task(struct work_struct *work); |
1081 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, | 1066 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, |
1082 | u32 ringid); | 1067 | u32 ringid); |
1083 | int netxen_process_cmd_ring(unsigned long data); | 1068 | int netxen_process_cmd_ring(struct netxen_adapter *adapter); |
1084 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); | 1069 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); |
1085 | void netxen_nic_set_multi(struct net_device *netdev); | 1070 | void netxen_nic_set_multi(struct net_device *netdev); |
1086 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); | 1071 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 7a876f4b8db2..6e98d830eefb 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -64,15 +64,7 @@ static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = { | |||
64 | {"bad_skb_len", NETXEN_NIC_STAT(stats.badskblen)}, | 64 | {"bad_skb_len", NETXEN_NIC_STAT(stats.badskblen)}, |
65 | {"no_cmd_desc", NETXEN_NIC_STAT(stats.nocmddescriptor)}, | 65 | {"no_cmd_desc", NETXEN_NIC_STAT(stats.nocmddescriptor)}, |
66 | {"polled", NETXEN_NIC_STAT(stats.polled)}, | 66 | {"polled", NETXEN_NIC_STAT(stats.polled)}, |
67 | {"uphappy", NETXEN_NIC_STAT(stats.uphappy)}, | ||
68 | {"updropped", NETXEN_NIC_STAT(stats.updropped)}, | ||
69 | {"uplcong", NETXEN_NIC_STAT(stats.uplcong)}, | ||
70 | {"uphcong", NETXEN_NIC_STAT(stats.uphcong)}, | ||
71 | {"upmcong", NETXEN_NIC_STAT(stats.upmcong)}, | ||
72 | {"updunno", NETXEN_NIC_STAT(stats.updunno)}, | ||
73 | {"skb_freed", NETXEN_NIC_STAT(stats.skbfreed)}, | ||
74 | {"tx_dropped", NETXEN_NIC_STAT(stats.txdropped)}, | 67 | {"tx_dropped", NETXEN_NIC_STAT(stats.txdropped)}, |
75 | {"tx_null_skb", NETXEN_NIC_STAT(stats.txnullskb)}, | ||
76 | {"csummed", NETXEN_NIC_STAT(stats.csummed)}, | 68 | {"csummed", NETXEN_NIC_STAT(stats.csummed)}, |
77 | {"no_rcv", NETXEN_NIC_STAT(stats.no_rcv)}, | 69 | {"no_rcv", NETXEN_NIC_STAT(stats.no_rcv)}, |
78 | {"rx_bytes", NETXEN_NIC_STAT(stats.rxbytes)}, | 70 | {"rx_bytes", NETXEN_NIC_STAT(stats.rxbytes)}, |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index d72f8f8fcb50..160f605e58db 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -456,6 +456,12 @@ enum { | |||
456 | #define ISR_INT_MASK_SLOW (NETXEN_PCIX_PS_REG(PCIX_INT_MASK)) | 456 | #define ISR_INT_MASK_SLOW (NETXEN_PCIX_PS_REG(PCIX_INT_MASK)) |
457 | #define ISR_INT_TARGET_STATUS (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS)) | 457 | #define ISR_INT_TARGET_STATUS (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS)) |
458 | #define ISR_INT_TARGET_MASK (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK)) | 458 | #define ISR_INT_TARGET_MASK (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK)) |
459 | #define ISR_INT_TARGET_STATUS_F1 (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS_F1)) | ||
460 | #define ISR_INT_TARGET_MASK_F1 (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK_F1)) | ||
461 | #define ISR_INT_TARGET_STATUS_F2 (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS_F2)) | ||
462 | #define ISR_INT_TARGET_MASK_F2 (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK_F2)) | ||
463 | #define ISR_INT_TARGET_STATUS_F3 (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS_F3)) | ||
464 | #define ISR_INT_TARGET_MASK_F3 (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK_F3)) | ||
459 | 465 | ||
460 | #define NETXEN_PCI_MAPSIZE 128 | 466 | #define NETXEN_PCI_MAPSIZE 128 |
461 | #define NETXEN_PCI_DDR_NET (0x00000000UL) | 467 | #define NETXEN_PCI_DDR_NET (0x00000000UL) |
@@ -662,6 +668,12 @@ enum { | |||
662 | 668 | ||
663 | #define PCIX_TARGET_STATUS (0x10118) | 669 | #define PCIX_TARGET_STATUS (0x10118) |
664 | #define PCIX_TARGET_MASK (0x10128) | 670 | #define PCIX_TARGET_MASK (0x10128) |
671 | #define PCIX_TARGET_STATUS_F1 (0x10160) | ||
672 | #define PCIX_TARGET_MASK_F1 (0x10170) | ||
673 | #define PCIX_TARGET_STATUS_F2 (0x10164) | ||
674 | #define PCIX_TARGET_MASK_F2 (0x10174) | ||
675 | #define PCIX_TARGET_STATUS_F3 (0x10168) | ||
676 | #define PCIX_TARGET_MASK_F3 (0x10178) | ||
665 | 677 | ||
666 | #define PCIX_MSI_F0 (0x13000) | 678 | #define PCIX_MSI_F0 (0x13000) |
667 | #define PCIX_MSI_F1 (0x13004) | 679 | #define PCIX_MSI_F1 (0x13004) |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 01355701bf8e..05748ca6f216 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -398,6 +398,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
398 | NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW)); | 398 | NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW)); |
399 | printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netxen_nic_driver_name, | 399 | printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netxen_nic_driver_name, |
400 | adapter->intr_scheme); | 400 | adapter->intr_scheme); |
401 | adapter->msi_mode = readl( | ||
402 | NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_FW)); | ||
401 | DPRINTK(INFO, "Receive Peg ready too. starting stuff\n"); | 403 | DPRINTK(INFO, "Receive Peg ready too. starting stuff\n"); |
402 | 404 | ||
403 | addr = netxen_alloc(adapter->ahw.pdev, | 405 | addr = netxen_alloc(adapter->ahw.pdev, |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 9e38bcb3fba9..45fa33e0cb90 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -145,6 +145,8 @@ int netxen_init_firmware(struct netxen_adapter *adapter) | |||
145 | /* Window 1 call */ | 145 | /* Window 1 call */ |
146 | writel(INTR_SCHEME_PERPORT, | 146 | writel(INTR_SCHEME_PERPORT, |
147 | NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_HOST)); | 147 | NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_HOST)); |
148 | writel(MSI_MODE_MULTIFUNC, | ||
149 | NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_HOST)); | ||
148 | writel(MPORT_MULTI_FUNCTION_MODE, | 150 | writel(MPORT_MULTI_FUNCTION_MODE, |
149 | NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE)); | 151 | NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE)); |
150 | writel(PHAN_INITIALIZE_ACK, | 152 | writel(PHAN_INITIALIZE_ACK, |
@@ -183,7 +185,6 @@ void netxen_initialize_adapter_sw(struct netxen_adapter *adapter) | |||
183 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) { | 185 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) { |
184 | struct netxen_rx_buffer *rx_buf; | 186 | struct netxen_rx_buffer *rx_buf; |
185 | rcv_desc = &adapter->recv_ctx[ctxid].rcv_desc[ring]; | 187 | rcv_desc = &adapter->recv_ctx[ctxid].rcv_desc[ring]; |
186 | rcv_desc->rcv_free = rcv_desc->max_rx_desc_count; | ||
187 | rcv_desc->begin_alloc = 0; | 188 | rcv_desc->begin_alloc = 0; |
188 | rx_buf = rcv_desc->rx_buf_arr; | 189 | rx_buf = rcv_desc->rx_buf_arr; |
189 | num_rx_bufs = rcv_desc->max_rx_desc_count; | 190 | num_rx_bufs = rcv_desc->max_rx_desc_count; |
@@ -974,28 +975,6 @@ int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val) | |||
974 | return 0; | 975 | return 0; |
975 | } | 976 | } |
976 | 977 | ||
977 | int netxen_nic_rx_has_work(struct netxen_adapter *adapter) | ||
978 | { | ||
979 | int ctx; | ||
980 | |||
981 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | ||
982 | struct netxen_recv_context *recv_ctx = | ||
983 | &(adapter->recv_ctx[ctx]); | ||
984 | u32 consumer; | ||
985 | struct status_desc *desc_head; | ||
986 | struct status_desc *desc; | ||
987 | |||
988 | consumer = recv_ctx->status_rx_consumer; | ||
989 | desc_head = recv_ctx->rcv_status_desc_head; | ||
990 | desc = &desc_head[consumer]; | ||
991 | |||
992 | if (netxen_get_sts_owner(desc) & STATUS_OWNER_HOST) | ||
993 | return 1; | ||
994 | } | ||
995 | |||
996 | return 0; | ||
997 | } | ||
998 | |||
999 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) | 978 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) |
1000 | { | 979 | { |
1001 | struct net_device *netdev = adapter->netdev; | 980 | struct net_device *netdev = adapter->netdev; |
@@ -1038,7 +1017,6 @@ static int netxen_nic_check_temp(struct netxen_adapter *adapter) | |||
1038 | 1017 | ||
1039 | void netxen_watchdog_task(struct work_struct *work) | 1018 | void netxen_watchdog_task(struct work_struct *work) |
1040 | { | 1019 | { |
1041 | struct net_device *netdev; | ||
1042 | struct netxen_adapter *adapter = | 1020 | struct netxen_adapter *adapter = |
1043 | container_of(work, struct netxen_adapter, watchdog_task); | 1021 | container_of(work, struct netxen_adapter, watchdog_task); |
1044 | 1022 | ||
@@ -1048,20 +1026,6 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1048 | if (adapter->handle_phy_intr) | 1026 | if (adapter->handle_phy_intr) |
1049 | adapter->handle_phy_intr(adapter); | 1027 | adapter->handle_phy_intr(adapter); |
1050 | 1028 | ||
1051 | netdev = adapter->netdev; | ||
1052 | if ((netif_running(netdev)) && !netif_carrier_ok(netdev) && | ||
1053 | netxen_nic_link_ok(adapter) ) { | ||
1054 | printk(KERN_INFO "%s %s (port %d), Link is up\n", | ||
1055 | netxen_nic_driver_name, netdev->name, adapter->portnum); | ||
1056 | netif_carrier_on(netdev); | ||
1057 | netif_wake_queue(netdev); | ||
1058 | } else if(!(netif_running(netdev)) && netif_carrier_ok(netdev)) { | ||
1059 | printk(KERN_ERR "%s %s Link is Down\n", | ||
1060 | netxen_nic_driver_name, netdev->name); | ||
1061 | netif_carrier_off(netdev); | ||
1062 | netif_stop_queue(netdev); | ||
1063 | } | ||
1064 | |||
1065 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 1029 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); |
1066 | } | 1030 | } |
1067 | 1031 | ||
@@ -1125,7 +1089,7 @@ static void netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
1125 | skb = (struct sk_buff *)buffer->skb; | 1089 | skb = (struct sk_buff *)buffer->skb; |
1126 | 1090 | ||
1127 | if (likely(adapter->rx_csum && | 1091 | if (likely(adapter->rx_csum && |
1128 | netxen_get_sts_status(sts_data) == STATUS_CKSUM_OK)) { | 1092 | netxen_get_sts_status(sts_data) == STATUS_CKSUM_OK)) { |
1129 | adapter->stats.csummed++; | 1093 | adapter->stats.csummed++; |
1130 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1094 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1131 | } else | 1095 | } else |
@@ -1142,40 +1106,8 @@ static void netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
1142 | skb->protocol = eth_type_trans(skb, netdev); | 1106 | skb->protocol = eth_type_trans(skb, netdev); |
1143 | 1107 | ||
1144 | ret = netif_receive_skb(skb); | 1108 | ret = netif_receive_skb(skb); |
1145 | |||
1146 | /* | ||
1147 | * RH: Do we need these stats on a regular basis. Can we get it from | ||
1148 | * Linux stats. | ||
1149 | */ | ||
1150 | switch (ret) { | ||
1151 | case NET_RX_SUCCESS: | ||
1152 | adapter->stats.uphappy++; | ||
1153 | break; | ||
1154 | |||
1155 | case NET_RX_CN_LOW: | ||
1156 | adapter->stats.uplcong++; | ||
1157 | break; | ||
1158 | |||
1159 | case NET_RX_CN_MOD: | ||
1160 | adapter->stats.upmcong++; | ||
1161 | break; | ||
1162 | |||
1163 | case NET_RX_CN_HIGH: | ||
1164 | adapter->stats.uphcong++; | ||
1165 | break; | ||
1166 | |||
1167 | case NET_RX_DROP: | ||
1168 | adapter->stats.updropped++; | ||
1169 | break; | ||
1170 | |||
1171 | default: | ||
1172 | adapter->stats.updunno++; | ||
1173 | break; | ||
1174 | } | ||
1175 | |||
1176 | netdev->last_rx = jiffies; | 1109 | netdev->last_rx = jiffies; |
1177 | 1110 | ||
1178 | rcv_desc->rcv_free++; | ||
1179 | rcv_desc->rcv_pending--; | 1111 | rcv_desc->rcv_pending--; |
1180 | 1112 | ||
1181 | /* | 1113 | /* |
@@ -1200,13 +1132,6 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) | |||
1200 | u32 producer = 0; | 1132 | u32 producer = 0; |
1201 | int count = 0, ring; | 1133 | int count = 0, ring; |
1202 | 1134 | ||
1203 | DPRINTK(INFO, "procesing receive\n"); | ||
1204 | /* | ||
1205 | * we assume in this case that there is only one port and that is | ||
1206 | * port #1...changes need to be done in firmware to indicate port | ||
1207 | * number as part of the descriptor. This way we will be able to get | ||
1208 | * the netdev which is associated with that device. | ||
1209 | */ | ||
1210 | while (count < max) { | 1135 | while (count < max) { |
1211 | desc = &desc_head[consumer]; | 1136 | desc = &desc_head[consumer]; |
1212 | if (!(netxen_get_sts_owner(desc) & STATUS_OWNER_HOST)) { | 1137 | if (!(netxen_get_sts_owner(desc) & STATUS_OWNER_HOST)) { |
@@ -1219,11 +1144,8 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) | |||
1219 | consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); | 1144 | consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); |
1220 | count++; | 1145 | count++; |
1221 | } | 1146 | } |
1222 | if (count) { | 1147 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) |
1223 | for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) { | 1148 | netxen_post_rx_buffers_nodb(adapter, ctxid, ring); |
1224 | netxen_post_rx_buffers_nodb(adapter, ctxid, ring); | ||
1225 | } | ||
1226 | } | ||
1227 | 1149 | ||
1228 | /* update the consumer index in phantom */ | 1150 | /* update the consumer index in phantom */ |
1229 | if (count) { | 1151 | if (count) { |
@@ -1233,108 +1155,60 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) | |||
1233 | /* Window = 1 */ | 1155 | /* Window = 1 */ |
1234 | writel(consumer, | 1156 | writel(consumer, |
1235 | NETXEN_CRB_NORMALIZE(adapter, | 1157 | NETXEN_CRB_NORMALIZE(adapter, |
1236 | recv_crb_registers[adapter->portnum]. | 1158 | recv_crb_registers[adapter->portnum]. |
1237 | crb_rcv_status_consumer)); | 1159 | crb_rcv_status_consumer)); |
1238 | wmb(); | ||
1239 | } | 1160 | } |
1240 | 1161 | ||
1241 | return count; | 1162 | return count; |
1242 | } | 1163 | } |
1243 | 1164 | ||
1244 | /* Process Command status ring */ | 1165 | /* Process Command status ring */ |
1245 | int netxen_process_cmd_ring(unsigned long data) | 1166 | int netxen_process_cmd_ring(struct netxen_adapter *adapter) |
1246 | { | 1167 | { |
1247 | u32 last_consumer; | 1168 | u32 last_consumer, consumer; |
1248 | u32 consumer; | 1169 | int count = 0, i; |
1249 | struct netxen_adapter *adapter = (struct netxen_adapter *)data; | ||
1250 | int count1 = 0; | ||
1251 | int count2 = 0; | ||
1252 | struct netxen_cmd_buffer *buffer; | 1170 | struct netxen_cmd_buffer *buffer; |
1253 | struct pci_dev *pdev; | 1171 | struct pci_dev *pdev = adapter->pdev; |
1172 | struct net_device *netdev = adapter->netdev; | ||
1254 | struct netxen_skb_frag *frag; | 1173 | struct netxen_skb_frag *frag; |
1255 | u32 i; | 1174 | int done = 0; |
1256 | int done; | ||
1257 | 1175 | ||
1258 | spin_lock(&adapter->tx_lock); | ||
1259 | last_consumer = adapter->last_cmd_consumer; | 1176 | last_consumer = adapter->last_cmd_consumer; |
1260 | DPRINTK(INFO, "procesing xmit complete\n"); | ||
1261 | /* we assume in this case that there is only one port and that is | ||
1262 | * port #1...changes need to be done in firmware to indicate port | ||
1263 | * number as part of the descriptor. This way we will be able to get | ||
1264 | * the netdev which is associated with that device. | ||
1265 | */ | ||
1266 | |||
1267 | consumer = le32_to_cpu(*(adapter->cmd_consumer)); | 1177 | consumer = le32_to_cpu(*(adapter->cmd_consumer)); |
1268 | if (last_consumer == consumer) { /* Ring is empty */ | ||
1269 | DPRINTK(INFO, "last_consumer %d == consumer %d\n", | ||
1270 | last_consumer, consumer); | ||
1271 | spin_unlock(&adapter->tx_lock); | ||
1272 | return 1; | ||
1273 | } | ||
1274 | |||
1275 | adapter->proc_cmd_buf_counter++; | ||
1276 | /* | ||
1277 | * Not needed - does not seem to be used anywhere. | ||
1278 | * adapter->cmd_consumer = consumer; | ||
1279 | */ | ||
1280 | spin_unlock(&adapter->tx_lock); | ||
1281 | 1178 | ||
1282 | while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { | 1179 | while (last_consumer != consumer) { |
1283 | buffer = &adapter->cmd_buf_arr[last_consumer]; | 1180 | buffer = &adapter->cmd_buf_arr[last_consumer]; |
1284 | pdev = adapter->pdev; | ||
1285 | if (buffer->skb) { | 1181 | if (buffer->skb) { |
1286 | frag = &buffer->frag_array[0]; | 1182 | frag = &buffer->frag_array[0]; |
1287 | pci_unmap_single(pdev, frag->dma, frag->length, | 1183 | pci_unmap_single(pdev, frag->dma, frag->length, |
1288 | PCI_DMA_TODEVICE); | 1184 | PCI_DMA_TODEVICE); |
1289 | frag->dma = 0ULL; | 1185 | frag->dma = 0ULL; |
1290 | for (i = 1; i < buffer->frag_count; i++) { | 1186 | for (i = 1; i < buffer->frag_count; i++) { |
1291 | DPRINTK(INFO, "getting fragment no %d\n", i); | ||
1292 | frag++; /* Get the next frag */ | 1187 | frag++; /* Get the next frag */ |
1293 | pci_unmap_page(pdev, frag->dma, frag->length, | 1188 | pci_unmap_page(pdev, frag->dma, frag->length, |
1294 | PCI_DMA_TODEVICE); | 1189 | PCI_DMA_TODEVICE); |
1295 | frag->dma = 0ULL; | 1190 | frag->dma = 0ULL; |
1296 | } | 1191 | } |
1297 | 1192 | ||
1298 | adapter->stats.skbfreed++; | 1193 | adapter->stats.xmitfinished++; |
1299 | dev_kfree_skb_any(buffer->skb); | 1194 | dev_kfree_skb_any(buffer->skb); |
1300 | buffer->skb = NULL; | 1195 | buffer->skb = NULL; |
1301 | } else if (adapter->proc_cmd_buf_counter == 1) { | ||
1302 | adapter->stats.txnullskb++; | ||
1303 | } | ||
1304 | if (unlikely(netif_queue_stopped(adapter->netdev) | ||
1305 | && netif_carrier_ok(adapter->netdev)) | ||
1306 | && ((jiffies - adapter->netdev->trans_start) > | ||
1307 | adapter->netdev->watchdog_timeo)) { | ||
1308 | SCHEDULE_WORK(&adapter->tx_timeout_task); | ||
1309 | } | 1196 | } |
1310 | 1197 | ||
1311 | last_consumer = get_next_index(last_consumer, | 1198 | last_consumer = get_next_index(last_consumer, |
1312 | adapter->max_tx_desc_count); | 1199 | adapter->max_tx_desc_count); |
1313 | count1++; | 1200 | if (++count >= MAX_STATUS_HANDLE) |
1201 | break; | ||
1314 | } | 1202 | } |
1315 | 1203 | ||
1316 | count2 = 0; | 1204 | if (count) { |
1317 | spin_lock(&adapter->tx_lock); | ||
1318 | if ((--adapter->proc_cmd_buf_counter) == 0) { | ||
1319 | adapter->last_cmd_consumer = last_consumer; | 1205 | adapter->last_cmd_consumer = last_consumer; |
1320 | while ((adapter->last_cmd_consumer != consumer) | 1206 | smp_mb(); |
1321 | && (count2 < MAX_STATUS_HANDLE)) { | 1207 | if (netif_queue_stopped(netdev) && netif_running(netdev)) { |
1322 | buffer = | 1208 | netif_tx_lock(netdev); |
1323 | &adapter->cmd_buf_arr[adapter->last_cmd_consumer]; | 1209 | netif_wake_queue(netdev); |
1324 | count2++; | 1210 | smp_mb(); |
1325 | if (buffer->skb) | 1211 | netif_tx_unlock(netdev); |
1326 | break; | ||
1327 | else | ||
1328 | adapter->last_cmd_consumer = | ||
1329 | get_next_index(adapter->last_cmd_consumer, | ||
1330 | adapter->max_tx_desc_count); | ||
1331 | } | ||
1332 | } | ||
1333 | if (count1 || count2) { | ||
1334 | if (netif_queue_stopped(adapter->netdev) | ||
1335 | && (adapter->flags & NETXEN_NETDEV_STATUS)) { | ||
1336 | netif_wake_queue(adapter->netdev); | ||
1337 | adapter->flags &= ~NETXEN_NETDEV_STATUS; | ||
1338 | } | 1212 | } |
1339 | } | 1213 | } |
1340 | /* | 1214 | /* |
@@ -1350,16 +1224,9 @@ int netxen_process_cmd_ring(unsigned long data) | |||
1350 | * There is still a possible race condition and the host could miss an | 1224 | * There is still a possible race condition and the host could miss an |
1351 | * interrupt. The card has to take care of this. | 1225 | * interrupt. The card has to take care of this. |
1352 | */ | 1226 | */ |
1353 | if (adapter->last_cmd_consumer == consumer && | 1227 | consumer = le32_to_cpu(*(adapter->cmd_consumer)); |
1354 | (((adapter->cmd_producer + 1) % | 1228 | done = (last_consumer == consumer); |
1355 | adapter->max_tx_desc_count) == adapter->last_cmd_consumer)) { | ||
1356 | consumer = le32_to_cpu(*(adapter->cmd_consumer)); | ||
1357 | } | ||
1358 | done = (adapter->last_cmd_consumer == consumer); | ||
1359 | 1229 | ||
1360 | spin_unlock(&adapter->tx_lock); | ||
1361 | DPRINTK(INFO, "last consumer is %d in %s\n", last_consumer, | ||
1362 | __FUNCTION__); | ||
1363 | return (done); | 1230 | return (done); |
1364 | } | 1231 | } |
1365 | 1232 | ||
@@ -1433,8 +1300,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1433 | rcv_desc->begin_alloc = index; | 1300 | rcv_desc->begin_alloc = index; |
1434 | rcv_desc->rcv_pending += count; | 1301 | rcv_desc->rcv_pending += count; |
1435 | rcv_desc->producer = producer; | 1302 | rcv_desc->producer = producer; |
1436 | if (rcv_desc->rcv_free >= 32) { | ||
1437 | rcv_desc->rcv_free = 0; | ||
1438 | /* Window = 1 */ | 1303 | /* Window = 1 */ |
1439 | writel((producer - 1) & | 1304 | writel((producer - 1) & |
1440 | (rcv_desc->max_rx_desc_count - 1), | 1305 | (rcv_desc->max_rx_desc_count - 1), |
@@ -1458,8 +1323,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1458 | writel(msg, | 1323 | writel(msg, |
1459 | DB_NORMALIZE(adapter, | 1324 | DB_NORMALIZE(adapter, |
1460 | NETXEN_RCV_PRODUCER_OFFSET)); | 1325 | NETXEN_RCV_PRODUCER_OFFSET)); |
1461 | wmb(); | ||
1462 | } | ||
1463 | } | 1326 | } |
1464 | } | 1327 | } |
1465 | 1328 | ||
@@ -1523,8 +1386,6 @@ static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, | |||
1523 | rcv_desc->begin_alloc = index; | 1386 | rcv_desc->begin_alloc = index; |
1524 | rcv_desc->rcv_pending += count; | 1387 | rcv_desc->rcv_pending += count; |
1525 | rcv_desc->producer = producer; | 1388 | rcv_desc->producer = producer; |
1526 | if (rcv_desc->rcv_free >= 32) { | ||
1527 | rcv_desc->rcv_free = 0; | ||
1528 | /* Window = 1 */ | 1389 | /* Window = 1 */ |
1529 | writel((producer - 1) & | 1390 | writel((producer - 1) & |
1530 | (rcv_desc->max_rx_desc_count - 1), | 1391 | (rcv_desc->max_rx_desc_count - 1), |
@@ -1534,21 +1395,9 @@ static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, | |||
1534 | rcv_desc_crb[ringid]. | 1395 | rcv_desc_crb[ringid]. |
1535 | crb_rcv_producer_offset)); | 1396 | crb_rcv_producer_offset)); |
1536 | wmb(); | 1397 | wmb(); |
1537 | } | ||
1538 | } | 1398 | } |
1539 | } | 1399 | } |
1540 | 1400 | ||
1541 | int netxen_nic_tx_has_work(struct netxen_adapter *adapter) | ||
1542 | { | ||
1543 | if (find_diff_among(adapter->last_cmd_consumer, | ||
1544 | adapter->cmd_producer, | ||
1545 | adapter->max_tx_desc_count) > 0) | ||
1546 | return 1; | ||
1547 | |||
1548 | return 0; | ||
1549 | } | ||
1550 | |||
1551 | |||
1552 | void netxen_nic_clear_stats(struct netxen_adapter *adapter) | 1401 | void netxen_nic_clear_stats(struct netxen_adapter *adapter) |
1553 | { | 1402 | { |
1554 | memset(&adapter->stats, 0, sizeof(adapter->stats)); | 1403 | memset(&adapter->stats, 0, sizeof(adapter->stats)); |
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c index 48a404aa66ce..c81313b717bd 100644 --- a/drivers/net/netxen/netxen_nic_isr.c +++ b/drivers/net/netxen/netxen_nic_isr.c | |||
@@ -59,7 +59,7 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | |||
59 | /* packet transmit problems */ | 59 | /* packet transmit problems */ |
60 | stats->tx_errors = adapter->stats.nocmddescriptor; | 60 | stats->tx_errors = adapter->stats.nocmddescriptor; |
61 | /* no space in linux buffers */ | 61 | /* no space in linux buffers */ |
62 | stats->rx_dropped = adapter->stats.updropped; | 62 | stats->rx_dropped = adapter->stats.rxdropped; |
63 | /* no space available in linux */ | 63 | /* no space available in linux */ |
64 | stats->tx_dropped = adapter->stats.txdropped; | 64 | stats->tx_dropped = adapter->stats.txdropped; |
65 | 65 | ||
@@ -193,14 +193,14 @@ int netxen_nic_link_ok(struct netxen_adapter *adapter) | |||
193 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) | 193 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) |
194 | { | 194 | { |
195 | struct net_device *netdev = adapter->netdev; | 195 | struct net_device *netdev = adapter->netdev; |
196 | u32 val, val1; | 196 | u32 val; |
197 | 197 | ||
198 | /* WINDOW = 1 */ | 198 | /* WINDOW = 1 */ |
199 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); | 199 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); |
200 | val >>= (physical_port[adapter->portnum] * 8); | 200 | val >>= (physical_port[adapter->portnum] * 8); |
201 | val1 = val & 0xff; | 201 | val &= 0xff; |
202 | 202 | ||
203 | if (adapter->ahw.xg_linkup == 1 && val1 != XG_LINK_UP) { | 203 | if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) { |
204 | printk(KERN_INFO "%s: %s NIC Link is down\n", | 204 | printk(KERN_INFO "%s: %s NIC Link is down\n", |
205 | netxen_nic_driver_name, netdev->name); | 205 | netxen_nic_driver_name, netdev->name); |
206 | adapter->ahw.xg_linkup = 0; | 206 | adapter->ahw.xg_linkup = 0; |
@@ -208,16 +208,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) | |||
208 | netif_carrier_off(netdev); | 208 | netif_carrier_off(netdev); |
209 | netif_stop_queue(netdev); | 209 | netif_stop_queue(netdev); |
210 | } | 210 | } |
211 | /* read twice to clear sticky bits */ | 211 | } else if (adapter->ahw.xg_linkup == 0 && val == XG_LINK_UP) { |
212 | /* WINDOW = 0 */ | ||
213 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1); | ||
214 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1); | ||
215 | |||
216 | if ((val & 0xffb) != 0xffb) { | ||
217 | printk(KERN_INFO "%s ISR: Sync/Align BAD: 0x%08x\n", | ||
218 | netxen_nic_driver_name, val1); | ||
219 | } | ||
220 | } else if (adapter->ahw.xg_linkup == 0 && val1 == XG_LINK_UP) { | ||
221 | printk(KERN_INFO "%s: %s NIC Link is up\n", | 212 | printk(KERN_INFO "%s: %s NIC Link is up\n", |
222 | netxen_nic_driver_name, netdev->name); | 213 | netxen_nic_driver_name, netdev->name); |
223 | adapter->ahw.xg_linkup = 1; | 214 | adapter->ahw.xg_linkup = 1; |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 9737eae5ef11..a8fb439a4d03 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -63,12 +63,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *, struct net_device *); | |||
63 | static void netxen_tx_timeout(struct net_device *netdev); | 63 | static void netxen_tx_timeout(struct net_device *netdev); |
64 | static void netxen_tx_timeout_task(struct work_struct *work); | 64 | static void netxen_tx_timeout_task(struct work_struct *work); |
65 | static void netxen_watchdog(unsigned long); | 65 | static void netxen_watchdog(unsigned long); |
66 | static int netxen_handle_int(struct netxen_adapter *, struct net_device *); | ||
67 | static int netxen_nic_poll(struct napi_struct *napi, int budget); | 66 | static int netxen_nic_poll(struct napi_struct *napi, int budget); |
68 | #ifdef CONFIG_NET_POLL_CONTROLLER | 67 | #ifdef CONFIG_NET_POLL_CONTROLLER |
69 | static void netxen_nic_poll_controller(struct net_device *netdev); | 68 | static void netxen_nic_poll_controller(struct net_device *netdev); |
70 | #endif | 69 | #endif |
71 | static irqreturn_t netxen_intr(int irq, void *data); | 70 | static irqreturn_t netxen_intr(int irq, void *data); |
71 | static irqreturn_t netxen_msi_intr(int irq, void *data); | ||
72 | 72 | ||
73 | int physical_port[] = {0, 1, 2, 3}; | 73 | int physical_port[] = {0, 1, 2, 3}; |
74 | 74 | ||
@@ -149,33 +149,30 @@ static void netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter, | |||
149 | 149 | ||
150 | #define ADAPTER_LIST_SIZE 12 | 150 | #define ADAPTER_LIST_SIZE 12 |
151 | 151 | ||
152 | static uint32_t msi_tgt_status[4] = { | ||
153 | ISR_INT_TARGET_STATUS, ISR_INT_TARGET_STATUS_F1, | ||
154 | ISR_INT_TARGET_STATUS_F2, ISR_INT_TARGET_STATUS_F3 | ||
155 | }; | ||
156 | |||
157 | static uint32_t sw_int_mask[4] = { | ||
158 | CRB_SW_INT_MASK_0, CRB_SW_INT_MASK_1, | ||
159 | CRB_SW_INT_MASK_2, CRB_SW_INT_MASK_3 | ||
160 | }; | ||
161 | |||
152 | static void netxen_nic_disable_int(struct netxen_adapter *adapter) | 162 | static void netxen_nic_disable_int(struct netxen_adapter *adapter) |
153 | { | 163 | { |
154 | uint32_t mask = 0x7ff; | 164 | u32 mask = 0x7ff; |
155 | int retries = 32; | 165 | int retries = 32; |
166 | int port = adapter->portnum; | ||
167 | int pci_fn = adapter->ahw.pci_func; | ||
156 | 168 | ||
157 | DPRINTK(1, INFO, "Entered ISR Disable \n"); | 169 | if (adapter->msi_mode != MSI_MODE_MULTIFUNC) |
158 | 170 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, sw_int_mask[port])); | |
159 | switch (adapter->portnum) { | ||
160 | case 0: | ||
161 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0)); | ||
162 | break; | ||
163 | case 1: | ||
164 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1)); | ||
165 | break; | ||
166 | case 2: | ||
167 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2)); | ||
168 | break; | ||
169 | case 3: | ||
170 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3)); | ||
171 | break; | ||
172 | } | ||
173 | 171 | ||
174 | if (adapter->intr_scheme != -1 && | 172 | if (adapter->intr_scheme != -1 && |
175 | adapter->intr_scheme != INTR_SCHEME_PERPORT) | 173 | adapter->intr_scheme != INTR_SCHEME_PERPORT) |
176 | writel(mask,PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); | 174 | writel(mask,PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); |
177 | 175 | ||
178 | /* Window = 0 or 1 */ | ||
179 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | 176 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { |
180 | do { | 177 | do { |
181 | writel(0xffffffff, | 178 | writel(0xffffffff, |
@@ -190,14 +187,18 @@ static void netxen_nic_disable_int(struct netxen_adapter *adapter) | |||
190 | printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n", | 187 | printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n", |
191 | netxen_nic_driver_name); | 188 | netxen_nic_driver_name); |
192 | } | 189 | } |
190 | } else { | ||
191 | if (adapter->msi_mode == MSI_MODE_MULTIFUNC) { | ||
192 | writel(0xffffffff, PCI_OFFSET_SECOND_RANGE(adapter, | ||
193 | msi_tgt_status[pci_fn])); | ||
194 | } | ||
193 | } | 195 | } |
194 | |||
195 | DPRINTK(1, INFO, "Done with Disable Int\n"); | ||
196 | } | 196 | } |
197 | 197 | ||
198 | static void netxen_nic_enable_int(struct netxen_adapter *adapter) | 198 | static void netxen_nic_enable_int(struct netxen_adapter *adapter) |
199 | { | 199 | { |
200 | u32 mask; | 200 | u32 mask; |
201 | int port = adapter->portnum; | ||
201 | 202 | ||
202 | DPRINTK(1, INFO, "Entered ISR Enable \n"); | 203 | DPRINTK(1, INFO, "Entered ISR Enable \n"); |
203 | 204 | ||
@@ -218,20 +219,7 @@ static void netxen_nic_enable_int(struct netxen_adapter *adapter) | |||
218 | writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); | 219 | writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); |
219 | } | 220 | } |
220 | 221 | ||
221 | switch (adapter->portnum) { | 222 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, sw_int_mask[port])); |
222 | case 0: | ||
223 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0)); | ||
224 | break; | ||
225 | case 1: | ||
226 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1)); | ||
227 | break; | ||
228 | case 2: | ||
229 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2)); | ||
230 | break; | ||
231 | case 3: | ||
232 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3)); | ||
233 | break; | ||
234 | } | ||
235 | 223 | ||
236 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | 224 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { |
237 | mask = 0xbff; | 225 | mask = 0xbff; |
@@ -328,7 +316,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
328 | 316 | ||
329 | adapter->ahw.pdev = pdev; | 317 | adapter->ahw.pdev = pdev; |
330 | adapter->ahw.pci_func = pci_func_id; | 318 | adapter->ahw.pci_func = pci_func_id; |
331 | spin_lock_init(&adapter->tx_lock); | ||
332 | 319 | ||
333 | /* remap phys address */ | 320 | /* remap phys address */ |
334 | mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */ | 321 | mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */ |
@@ -401,6 +388,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
401 | 388 | ||
402 | /* this will be read from FW later */ | 389 | /* this will be read from FW later */ |
403 | adapter->intr_scheme = -1; | 390 | adapter->intr_scheme = -1; |
391 | adapter->msi_mode = -1; | ||
404 | 392 | ||
405 | /* This will be reset for mezz cards */ | 393 | /* This will be reset for mezz cards */ |
406 | adapter->portnum = pci_func_id; | 394 | adapter->portnum = pci_func_id; |
@@ -415,7 +403,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
415 | netdev->set_mac_address = netxen_nic_set_mac; | 403 | netdev->set_mac_address = netxen_nic_set_mac; |
416 | netdev->change_mtu = netxen_nic_change_mtu; | 404 | netdev->change_mtu = netxen_nic_change_mtu; |
417 | netdev->tx_timeout = netxen_tx_timeout; | 405 | netdev->tx_timeout = netxen_tx_timeout; |
418 | netdev->watchdog_timeo = HZ; | 406 | netdev->watchdog_timeo = 2*HZ; |
419 | 407 | ||
420 | netxen_nic_change_mtu(netdev, netdev->mtu); | 408 | netxen_nic_change_mtu(netdev, netdev->mtu); |
421 | 409 | ||
@@ -543,7 +531,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
543 | adapter->watchdog_timer.data = (unsigned long)adapter; | 531 | adapter->watchdog_timer.data = (unsigned long)adapter; |
544 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); | 532 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); |
545 | adapter->ahw.pdev = pdev; | 533 | adapter->ahw.pdev = pdev; |
546 | adapter->proc_cmd_buf_counter = 0; | ||
547 | adapter->ahw.revision_id = pdev->revision; | 534 | adapter->ahw.revision_id = pdev->revision; |
548 | 535 | ||
549 | /* make sure Window == 1 */ | 536 | /* make sure Window == 1 */ |
@@ -833,6 +820,8 @@ static int netxen_nic_open(struct net_device *netdev) | |||
833 | struct netxen_adapter *adapter = (struct netxen_adapter *)netdev->priv; | 820 | struct netxen_adapter *adapter = (struct netxen_adapter *)netdev->priv; |
834 | int err = 0; | 821 | int err = 0; |
835 | int ctx, ring; | 822 | int ctx, ring; |
823 | irq_handler_t handler; | ||
824 | unsigned long flags = IRQF_SAMPLE_RANDOM; | ||
836 | 825 | ||
837 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) { | 826 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) { |
838 | err = netxen_init_firmware(adapter); | 827 | err = netxen_init_firmware(adapter); |
@@ -856,9 +845,14 @@ static int netxen_nic_open(struct net_device *netdev) | |||
856 | netxen_post_rx_buffers(adapter, ctx, ring); | 845 | netxen_post_rx_buffers(adapter, ctx, ring); |
857 | } | 846 | } |
858 | adapter->irq = adapter->ahw.pdev->irq; | 847 | adapter->irq = adapter->ahw.pdev->irq; |
859 | err = request_irq(adapter->ahw.pdev->irq, netxen_intr, | 848 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) |
860 | IRQF_SHARED|IRQF_SAMPLE_RANDOM, netdev->name, | 849 | handler = netxen_msi_intr; |
861 | adapter); | 850 | else { |
851 | flags |= IRQF_SHARED; | ||
852 | handler = netxen_intr; | ||
853 | } | ||
854 | err = request_irq(adapter->irq, handler, | ||
855 | flags, netdev->name, adapter); | ||
862 | if (err) { | 856 | if (err) { |
863 | printk(KERN_ERR "request_irq failed with: %d\n", err); | 857 | printk(KERN_ERR "request_irq failed with: %d\n", err); |
864 | netxen_free_hw_resources(adapter); | 858 | netxen_free_hw_resources(adapter); |
@@ -867,21 +861,12 @@ static int netxen_nic_open(struct net_device *netdev) | |||
867 | 861 | ||
868 | adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; | 862 | adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; |
869 | } | 863 | } |
870 | if (!adapter->driver_mismatch) | ||
871 | mod_timer(&adapter->watchdog_timer, jiffies); | ||
872 | |||
873 | napi_enable(&adapter->napi); | ||
874 | |||
875 | netxen_nic_enable_int(adapter); | ||
876 | |||
877 | /* Done here again so that even if phantom sw overwrote it, | 864 | /* Done here again so that even if phantom sw overwrote it, |
878 | * we set it */ | 865 | * we set it */ |
879 | if (adapter->init_port | 866 | if (adapter->init_port |
880 | && adapter->init_port(adapter, adapter->portnum) != 0) { | 867 | && adapter->init_port(adapter, adapter->portnum) != 0) { |
881 | del_timer_sync(&adapter->watchdog_timer); | ||
882 | printk(KERN_ERR "%s: Failed to initialize port %d\n", | 868 | printk(KERN_ERR "%s: Failed to initialize port %d\n", |
883 | netxen_nic_driver_name, adapter->portnum); | 869 | netxen_nic_driver_name, adapter->portnum); |
884 | napi_disable(&adapter->napi); | ||
885 | return -EIO; | 870 | return -EIO; |
886 | } | 871 | } |
887 | if (adapter->macaddr_set) | 872 | if (adapter->macaddr_set) |
@@ -894,6 +879,12 @@ static int netxen_nic_open(struct net_device *netdev) | |||
894 | adapter->set_mtu(adapter, netdev->mtu); | 879 | adapter->set_mtu(adapter, netdev->mtu); |
895 | 880 | ||
896 | if (!adapter->driver_mismatch) | 881 | if (!adapter->driver_mismatch) |
882 | mod_timer(&adapter->watchdog_timer, jiffies); | ||
883 | |||
884 | napi_enable(&adapter->napi); | ||
885 | netxen_nic_enable_int(adapter); | ||
886 | |||
887 | if (!adapter->driver_mismatch) | ||
897 | netif_start_queue(netdev); | 888 | netif_start_queue(netdev); |
898 | 889 | ||
899 | return 0; | 890 | return 0; |
@@ -958,41 +949,17 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
958 | struct netxen_skb_frag *buffrag; | 949 | struct netxen_skb_frag *buffrag; |
959 | unsigned int i; | 950 | unsigned int i; |
960 | 951 | ||
961 | u32 producer = 0; | 952 | u32 producer, consumer; |
962 | u32 saved_producer = 0; | 953 | u32 saved_producer = 0; |
963 | struct cmd_desc_type0 *hwdesc; | 954 | struct cmd_desc_type0 *hwdesc; |
964 | int k; | 955 | int k; |
965 | struct netxen_cmd_buffer *pbuf = NULL; | 956 | struct netxen_cmd_buffer *pbuf = NULL; |
966 | static int dropped_packet = 0; | ||
967 | int frag_count; | 957 | int frag_count; |
968 | u32 local_producer = 0; | ||
969 | u32 max_tx_desc_count = 0; | ||
970 | u32 last_cmd_consumer = 0; | ||
971 | int no_of_desc; | 958 | int no_of_desc; |
959 | u32 num_txd = adapter->max_tx_desc_count; | ||
972 | 960 | ||
973 | adapter->stats.xmitcalled++; | ||
974 | frag_count = skb_shinfo(skb)->nr_frags + 1; | 961 | frag_count = skb_shinfo(skb)->nr_frags + 1; |
975 | 962 | ||
976 | if (unlikely(skb->len <= 0)) { | ||
977 | dev_kfree_skb_any(skb); | ||
978 | adapter->stats.badskblen++; | ||
979 | return NETDEV_TX_OK; | ||
980 | } | ||
981 | |||
982 | if (frag_count > MAX_BUFFERS_PER_CMD) { | ||
983 | printk("%s: %s netxen_nic_xmit_frame: frag_count (%d) " | ||
984 | "too large, can handle only %d frags\n", | ||
985 | netxen_nic_driver_name, netdev->name, | ||
986 | frag_count, MAX_BUFFERS_PER_CMD); | ||
987 | adapter->stats.txdropped++; | ||
988 | if ((++dropped_packet & 0xff) == 0xff) | ||
989 | printk("%s: %s droppped packets = %d\n", | ||
990 | netxen_nic_driver_name, netdev->name, | ||
991 | dropped_packet); | ||
992 | |||
993 | return NETDEV_TX_OK; | ||
994 | } | ||
995 | |||
996 | /* There 4 fragments per descriptor */ | 963 | /* There 4 fragments per descriptor */ |
997 | no_of_desc = (frag_count + 3) >> 2; | 964 | no_of_desc = (frag_count + 3) >> 2; |
998 | if (netdev->features & NETIF_F_TSO) { | 965 | if (netdev->features & NETIF_F_TSO) { |
@@ -1007,27 +974,16 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1007 | } | 974 | } |
1008 | } | 975 | } |
1009 | 976 | ||
1010 | spin_lock_bh(&adapter->tx_lock); | 977 | producer = adapter->cmd_producer; |
1011 | if (adapter->total_threads >= MAX_XMIT_PRODUCERS) { | 978 | smp_mb(); |
1012 | goto out_requeue; | 979 | consumer = adapter->last_cmd_consumer; |
1013 | } | 980 | if ((no_of_desc+2) > find_diff_among(producer, consumer, num_txd)) { |
1014 | local_producer = adapter->cmd_producer; | 981 | netif_stop_queue(netdev); |
1015 | k = adapter->cmd_producer; | 982 | smp_mb(); |
1016 | max_tx_desc_count = adapter->max_tx_desc_count; | 983 | return NETDEV_TX_BUSY; |
1017 | last_cmd_consumer = adapter->last_cmd_consumer; | ||
1018 | if ((k + no_of_desc) >= | ||
1019 | ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : | ||
1020 | last_cmd_consumer)) { | ||
1021 | goto out_requeue; | ||
1022 | } | 984 | } |
1023 | k = get_index_range(k, max_tx_desc_count, no_of_desc); | ||
1024 | adapter->cmd_producer = k; | ||
1025 | adapter->total_threads++; | ||
1026 | adapter->num_threads++; | ||
1027 | 985 | ||
1028 | spin_unlock_bh(&adapter->tx_lock); | ||
1029 | /* Copy the descriptors into the hardware */ | 986 | /* Copy the descriptors into the hardware */ |
1030 | producer = local_producer; | ||
1031 | saved_producer = producer; | 987 | saved_producer = producer; |
1032 | hwdesc = &hw->cmd_desc_head[producer]; | 988 | hwdesc = &hw->cmd_desc_head[producer]; |
1033 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); | 989 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); |
@@ -1067,8 +1023,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1067 | /* move to next desc. if there is a need */ | 1023 | /* move to next desc. if there is a need */ |
1068 | if ((i & 0x3) == 0) { | 1024 | if ((i & 0x3) == 0) { |
1069 | k = 0; | 1025 | k = 0; |
1070 | producer = get_next_index(producer, | 1026 | producer = get_next_index(producer, num_txd); |
1071 | adapter->max_tx_desc_count); | ||
1072 | hwdesc = &hw->cmd_desc_head[producer]; | 1027 | hwdesc = &hw->cmd_desc_head[producer]; |
1073 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); | 1028 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); |
1074 | pbuf = &adapter->cmd_buf_arr[producer]; | 1029 | pbuf = &adapter->cmd_buf_arr[producer]; |
@@ -1086,7 +1041,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1086 | buffrag->dma = temp_dma; | 1041 | buffrag->dma = temp_dma; |
1087 | buffrag->length = temp_len; | 1042 | buffrag->length = temp_len; |
1088 | 1043 | ||
1089 | DPRINTK(INFO, "for loop. i=%d k=%d\n", i, k); | ||
1090 | switch (k) { | 1044 | switch (k) { |
1091 | case 0: | 1045 | case 0: |
1092 | hwdesc->buffer1_length = cpu_to_le16(temp_len); | 1046 | hwdesc->buffer1_length = cpu_to_le16(temp_len); |
@@ -1107,7 +1061,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1107 | } | 1061 | } |
1108 | frag++; | 1062 | frag++; |
1109 | } | 1063 | } |
1110 | producer = get_next_index(producer, adapter->max_tx_desc_count); | 1064 | producer = get_next_index(producer, num_txd); |
1111 | 1065 | ||
1112 | /* might change opcode to TX_TCP_LSO */ | 1066 | /* might change opcode to TX_TCP_LSO */ |
1113 | netxen_tso_check(adapter, &hw->cmd_desc_head[saved_producer], skb); | 1067 | netxen_tso_check(adapter, &hw->cmd_desc_head[saved_producer], skb); |
@@ -1134,7 +1088,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1134 | /* copy the first 64 bytes */ | 1088 | /* copy the first 64 bytes */ |
1135 | memcpy(((void *)hwdesc) + 2, | 1089 | memcpy(((void *)hwdesc) + 2, |
1136 | (void *)(skb->data), first_hdr_len); | 1090 | (void *)(skb->data), first_hdr_len); |
1137 | producer = get_next_index(producer, max_tx_desc_count); | 1091 | producer = get_next_index(producer, num_txd); |
1138 | 1092 | ||
1139 | if (more_hdr) { | 1093 | if (more_hdr) { |
1140 | hwdesc = &hw->cmd_desc_head[producer]; | 1094 | hwdesc = &hw->cmd_desc_head[producer]; |
@@ -1147,35 +1101,19 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1147 | hwdesc, | 1101 | hwdesc, |
1148 | (hdr_len - | 1102 | (hdr_len - |
1149 | first_hdr_len)); | 1103 | first_hdr_len)); |
1150 | producer = get_next_index(producer, max_tx_desc_count); | 1104 | producer = get_next_index(producer, num_txd); |
1151 | } | 1105 | } |
1152 | } | 1106 | } |
1153 | 1107 | ||
1154 | spin_lock_bh(&adapter->tx_lock); | 1108 | adapter->cmd_producer = producer; |
1155 | adapter->stats.txbytes += skb->len; | 1109 | adapter->stats.txbytes += skb->len; |
1156 | 1110 | ||
1157 | /* Code to update the adapter considering how many producer threads | 1111 | netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); |
1158 | are currently working */ | ||
1159 | if ((--adapter->num_threads) == 0) { | ||
1160 | /* This is the last thread */ | ||
1161 | u32 crb_producer = adapter->cmd_producer; | ||
1162 | netxen_nic_update_cmd_producer(adapter, crb_producer); | ||
1163 | wmb(); | ||
1164 | adapter->total_threads = 0; | ||
1165 | } | ||
1166 | 1112 | ||
1167 | adapter->stats.xmitfinished++; | 1113 | adapter->stats.xmitcalled++; |
1168 | netdev->trans_start = jiffies; | 1114 | netdev->trans_start = jiffies; |
1169 | 1115 | ||
1170 | spin_unlock_bh(&adapter->tx_lock); | ||
1171 | return NETDEV_TX_OK; | 1116 | return NETDEV_TX_OK; |
1172 | |||
1173 | out_requeue: | ||
1174 | netif_stop_queue(netdev); | ||
1175 | adapter->flags |= NETXEN_NETDEV_STATUS; | ||
1176 | |||
1177 | spin_unlock_bh(&adapter->tx_lock); | ||
1178 | return NETDEV_TX_BUSY; | ||
1179 | } | 1117 | } |
1180 | 1118 | ||
1181 | static void netxen_watchdog(unsigned long v) | 1119 | static void netxen_watchdog(unsigned long v) |
@@ -1200,87 +1138,60 @@ static void netxen_tx_timeout_task(struct work_struct *work) | |||
1200 | printk(KERN_ERR "%s %s: transmit timeout, resetting.\n", | 1138 | printk(KERN_ERR "%s %s: transmit timeout, resetting.\n", |
1201 | netxen_nic_driver_name, adapter->netdev->name); | 1139 | netxen_nic_driver_name, adapter->netdev->name); |
1202 | 1140 | ||
1203 | netxen_nic_close(adapter->netdev); | 1141 | netxen_nic_disable_int(adapter); |
1204 | netxen_nic_open(adapter->netdev); | 1142 | napi_disable(&adapter->napi); |
1143 | |||
1205 | adapter->netdev->trans_start = jiffies; | 1144 | adapter->netdev->trans_start = jiffies; |
1145 | |||
1146 | napi_enable(&adapter->napi); | ||
1147 | netxen_nic_enable_int(adapter); | ||
1206 | netif_wake_queue(adapter->netdev); | 1148 | netif_wake_queue(adapter->netdev); |
1207 | } | 1149 | } |
1208 | 1150 | ||
1209 | static int | 1151 | static inline void |
1210 | netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev) | 1152 | netxen_handle_int(struct netxen_adapter *adapter) |
1211 | { | 1153 | { |
1212 | u32 ret = 0; | ||
1213 | |||
1214 | DPRINTK(INFO, "Entered handle ISR\n"); | ||
1215 | adapter->stats.ints++; | ||
1216 | |||
1217 | netxen_nic_disable_int(adapter); | 1154 | netxen_nic_disable_int(adapter); |
1218 | 1155 | napi_schedule(&adapter->napi); | |
1219 | if (netxen_nic_rx_has_work(adapter) || netxen_nic_tx_has_work(adapter)) { | ||
1220 | if (netif_rx_schedule_prep(netdev, &adapter->napi)) { | ||
1221 | /* | ||
1222 | * Interrupts are already disabled. | ||
1223 | */ | ||
1224 | __netif_rx_schedule(netdev, &adapter->napi); | ||
1225 | } else { | ||
1226 | static unsigned int intcount = 0; | ||
1227 | if ((++intcount & 0xfff) == 0xfff) | ||
1228 | DPRINTK(KERN_ERR | ||
1229 | "%s: %s interrupt %d while in poll\n", | ||
1230 | netxen_nic_driver_name, netdev->name, | ||
1231 | intcount); | ||
1232 | } | ||
1233 | ret = 1; | ||
1234 | } | ||
1235 | |||
1236 | if (ret == 0) { | ||
1237 | netxen_nic_enable_int(adapter); | ||
1238 | } | ||
1239 | |||
1240 | return ret; | ||
1241 | } | 1156 | } |
1242 | 1157 | ||
1243 | /* | ||
1244 | * netxen_intr - Interrupt Handler | ||
1245 | * @irq: interrupt number | ||
1246 | * data points to adapter stucture (which may be handling more than 1 port | ||
1247 | */ | ||
1248 | irqreturn_t netxen_intr(int irq, void *data) | 1158 | irqreturn_t netxen_intr(int irq, void *data) |
1249 | { | 1159 | { |
1250 | struct netxen_adapter *adapter = data; | 1160 | struct netxen_adapter *adapter = data; |
1251 | struct net_device *netdev = adapter->netdev; | ||
1252 | u32 our_int = 0; | 1161 | u32 our_int = 0; |
1253 | 1162 | ||
1254 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | 1163 | our_int = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); |
1255 | our_int = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); | 1164 | /* not our interrupt */ |
1256 | /* not our interrupt */ | 1165 | if ((our_int & (0x80 << adapter->portnum)) == 0) |
1257 | if ((our_int & (0x80 << adapter->portnum)) == 0) | 1166 | return IRQ_NONE; |
1258 | return IRQ_NONE; | ||
1259 | } | ||
1260 | 1167 | ||
1261 | if (adapter->intr_scheme == INTR_SCHEME_PERPORT) { | 1168 | if (adapter->intr_scheme == INTR_SCHEME_PERPORT) { |
1262 | /* claim interrupt */ | 1169 | /* claim interrupt */ |
1263 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | 1170 | writel(our_int & ~((u32)(0x80 << adapter->portnum)), |
1264 | writel(our_int & ~((u32)(0x80 << adapter->portnum)), | ||
1265 | NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); | 1171 | NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); |
1266 | } | ||
1267 | } | 1172 | } |
1268 | 1173 | ||
1269 | if (netif_running(netdev)) | 1174 | netxen_handle_int(adapter); |
1270 | netxen_handle_int(adapter, netdev); | ||
1271 | 1175 | ||
1272 | return IRQ_HANDLED; | 1176 | return IRQ_HANDLED; |
1273 | } | 1177 | } |
1274 | 1178 | ||
1179 | irqreturn_t netxen_msi_intr(int irq, void *data) | ||
1180 | { | ||
1181 | struct netxen_adapter *adapter = data; | ||
1182 | |||
1183 | netxen_handle_int(adapter); | ||
1184 | return IRQ_HANDLED; | ||
1185 | } | ||
1186 | |||
1275 | static int netxen_nic_poll(struct napi_struct *napi, int budget) | 1187 | static int netxen_nic_poll(struct napi_struct *napi, int budget) |
1276 | { | 1188 | { |
1277 | struct netxen_adapter *adapter = container_of(napi, struct netxen_adapter, napi); | 1189 | struct netxen_adapter *adapter = container_of(napi, struct netxen_adapter, napi); |
1278 | struct net_device *netdev = adapter->netdev; | 1190 | int tx_complete; |
1279 | int done = 1; | ||
1280 | int ctx; | 1191 | int ctx; |
1281 | int work_done; | 1192 | int work_done; |
1282 | 1193 | ||
1283 | DPRINTK(INFO, "polling for %d descriptors\n", *budget); | 1194 | tx_complete = netxen_process_cmd_ring(adapter); |
1284 | 1195 | ||
1285 | work_done = 0; | 1196 | work_done = 0; |
1286 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | 1197 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { |
@@ -1300,16 +1211,8 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) | |||
1300 | budget / MAX_RCV_CTX); | 1211 | budget / MAX_RCV_CTX); |
1301 | } | 1212 | } |
1302 | 1213 | ||
1303 | if (work_done >= budget) | 1214 | if ((work_done < budget) && tx_complete) { |
1304 | done = 0; | 1215 | netif_rx_complete(adapter->netdev, &adapter->napi); |
1305 | |||
1306 | if (netxen_process_cmd_ring((unsigned long)adapter) == 0) | ||
1307 | done = 0; | ||
1308 | |||
1309 | DPRINTK(INFO, "new work_done: %d work_to_do: %d\n", | ||
1310 | work_done, work_to_do); | ||
1311 | if (done) { | ||
1312 | netif_rx_complete(netdev, napi); | ||
1313 | netxen_nic_enable_int(adapter); | 1216 | netxen_nic_enable_int(adapter); |
1314 | } | 1217 | } |
1315 | 1218 | ||
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h index ffa3b7215ce8..a566b50f36f5 100644 --- a/drivers/net/netxen/netxen_nic_phan_reg.h +++ b/drivers/net/netxen/netxen_nic_phan_reg.h | |||
@@ -126,8 +126,11 @@ | |||
126 | */ | 126 | */ |
127 | #define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8) | 127 | #define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8) |
128 | #define CRB_NIC_CAPABILITIES_FW NETXEN_NIC_REG(0x1dc) | 128 | #define CRB_NIC_CAPABILITIES_FW NETXEN_NIC_REG(0x1dc) |
129 | #define CRB_NIC_MSI_MODE_HOST NETXEN_NIC_REG(0x270) | ||
130 | #define CRB_NIC_MSI_MODE_FW NETXEN_NIC_REG(0x274) | ||
129 | 131 | ||
130 | #define INTR_SCHEME_PERPORT 0x1 | 132 | #define INTR_SCHEME_PERPORT 0x1 |
133 | #define MSI_MODE_MULTIFUNC 0x1 | ||
131 | 134 | ||
132 | /* used for ethtool tests */ | 135 | /* used for ethtool tests */ |
133 | #define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280) | 136 | #define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280) |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index e8a63e483a2b..ce95c5d168fe 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -1268,7 +1268,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) | |||
1268 | } | 1268 | } |
1269 | } | 1269 | } |
1270 | 1270 | ||
1271 | if (interrupts && ei_debug) | 1271 | if (interrupts && ei_debug > 3) |
1272 | { | 1272 | { |
1273 | handled = 1; | 1273 | handled = 1; |
1274 | if (nr_serviced >= MAX_SERVICE) | 1274 | if (nr_serviced >= MAX_SERVICE) |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index f4ca0591231d..3ac8529bb92c 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -67,6 +67,7 @@ config REALTEK_PHY | |||
67 | 67 | ||
68 | config FIXED_PHY | 68 | config FIXED_PHY |
69 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" | 69 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" |
70 | depends on PHYLIB=y | ||
70 | ---help--- | 71 | ---help--- |
71 | Adds the platform "fixed" MDIO Bus to cover the boards that use | 72 | Adds the platform "fixed" MDIO Bus to cover the boards that use |
72 | PHYs that are not connected to the real MDIO bus. | 73 | PHYs that are not connected to the real MDIO bus. |
diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index 7ed632db00d7..d926168bc780 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #define MII_DM9161_SCR 0x10 | 38 | #define MII_DM9161_SCR 0x10 |
39 | #define MII_DM9161_SCR_INIT 0x0610 | 39 | #define MII_DM9161_SCR_INIT 0x0610 |
40 | #define MII_DM9161_SCR_RMII 0x0100 | ||
40 | 41 | ||
41 | /* DM9161 Interrupt Register */ | 42 | /* DM9161 Interrupt Register */ |
42 | #define MII_DM9161_INTR 0x15 | 43 | #define MII_DM9161_INTR 0x15 |
@@ -103,7 +104,7 @@ static int dm9161_config_aneg(struct phy_device *phydev) | |||
103 | 104 | ||
104 | static int dm9161_config_init(struct phy_device *phydev) | 105 | static int dm9161_config_init(struct phy_device *phydev) |
105 | { | 106 | { |
106 | int err; | 107 | int err, temp; |
107 | 108 | ||
108 | /* Isolate the PHY */ | 109 | /* Isolate the PHY */ |
109 | err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE); | 110 | err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE); |
@@ -111,9 +112,19 @@ static int dm9161_config_init(struct phy_device *phydev) | |||
111 | if (err < 0) | 112 | if (err < 0) |
112 | return err; | 113 | return err; |
113 | 114 | ||
114 | /* Do not bypass the scrambler/descrambler */ | 115 | switch (phydev->interface) { |
115 | err = phy_write(phydev, MII_DM9161_SCR, MII_DM9161_SCR_INIT); | 116 | case PHY_INTERFACE_MODE_MII: |
117 | temp = MII_DM9161_SCR_INIT; | ||
118 | break; | ||
119 | case PHY_INTERFACE_MODE_RMII: | ||
120 | temp = MII_DM9161_SCR_INIT | MII_DM9161_SCR_RMII; | ||
121 | break; | ||
122 | default: | ||
123 | return -EINVAL; | ||
124 | } | ||
116 | 125 | ||
126 | /* Do not bypass the scrambler/descrambler */ | ||
127 | err = phy_write(phydev, MII_DM9161_SCR, temp); | ||
117 | if (err < 0) | 128 | if (err < 0) |
118 | return err; | 129 | return err; |
119 | 130 | ||
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index f0574073a2a3..33539917e9b8 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -58,9 +58,25 @@ | |||
58 | #define MII_M1111_RX_DELAY 0x80 | 58 | #define MII_M1111_RX_DELAY 0x80 |
59 | #define MII_M1111_TX_DELAY 0x2 | 59 | #define MII_M1111_TX_DELAY 0x2 |
60 | #define MII_M1111_PHY_EXT_SR 0x1b | 60 | #define MII_M1111_PHY_EXT_SR 0x1b |
61 | #define MII_M1111_HWCFG_MODE_MASK 0xf | 61 | |
62 | #define MII_M1111_HWCFG_MODE_RGMII 0xb | 62 | #define MII_M1111_HWCFG_MODE_MASK 0xf |
63 | #define MII_M1111_HWCFG_MODE_COPPER_RGMII 0xb | ||
64 | #define MII_M1111_HWCFG_MODE_FIBER_RGMII 0x3 | ||
63 | #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK 0x4 | 65 | #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK 0x4 |
66 | #define MII_M1111_HWCFG_FIBER_COPPER_AUTO 0x8000 | ||
67 | #define MII_M1111_HWCFG_FIBER_COPPER_RES 0x2000 | ||
68 | |||
69 | #define MII_M1111_COPPER 0 | ||
70 | #define MII_M1111_FIBER 1 | ||
71 | |||
72 | #define MII_M1011_PHY_STATUS 0x11 | ||
73 | #define MII_M1011_PHY_STATUS_1000 0x8000 | ||
74 | #define MII_M1011_PHY_STATUS_100 0x4000 | ||
75 | #define MII_M1011_PHY_STATUS_SPD_MASK 0xc000 | ||
76 | #define MII_M1011_PHY_STATUS_FULLDUPLEX 0x2000 | ||
77 | #define MII_M1011_PHY_STATUS_RESOLVED 0x0800 | ||
78 | #define MII_M1011_PHY_STATUS_LINK 0x0400 | ||
79 | |||
64 | 80 | ||
65 | MODULE_DESCRIPTION("Marvell PHY driver"); | 81 | MODULE_DESCRIPTION("Marvell PHY driver"); |
66 | MODULE_AUTHOR("Andy Fleming"); | 82 | MODULE_AUTHOR("Andy Fleming"); |
@@ -141,12 +157,22 @@ static int marvell_config_aneg(struct phy_device *phydev) | |||
141 | static int m88e1111_config_init(struct phy_device *phydev) | 157 | static int m88e1111_config_init(struct phy_device *phydev) |
142 | { | 158 | { |
143 | int err; | 159 | int err; |
160 | int temp; | ||
161 | int mode; | ||
162 | |||
163 | /* Enable Fiber/Copper auto selection */ | ||
164 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); | ||
165 | temp |= MII_M1111_HWCFG_FIBER_COPPER_AUTO; | ||
166 | phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); | ||
167 | |||
168 | temp = phy_read(phydev, MII_BMCR); | ||
169 | temp |= BMCR_RESET; | ||
170 | phy_write(phydev, MII_BMCR, temp); | ||
144 | 171 | ||
145 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || | 172 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || |
146 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || | 173 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || |
147 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || | 174 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || |
148 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) { | 175 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) { |
149 | int temp; | ||
150 | 176 | ||
151 | temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); | 177 | temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); |
152 | if (temp < 0) | 178 | if (temp < 0) |
@@ -171,7 +197,13 @@ static int m88e1111_config_init(struct phy_device *phydev) | |||
171 | return temp; | 197 | return temp; |
172 | 198 | ||
173 | temp &= ~(MII_M1111_HWCFG_MODE_MASK); | 199 | temp &= ~(MII_M1111_HWCFG_MODE_MASK); |
174 | temp |= MII_M1111_HWCFG_MODE_RGMII; | 200 | |
201 | mode = phy_read(phydev, MII_M1111_PHY_EXT_CR); | ||
202 | |||
203 | if (mode & MII_M1111_HWCFG_FIBER_COPPER_RES) | ||
204 | temp |= MII_M1111_HWCFG_MODE_FIBER_RGMII; | ||
205 | else | ||
206 | temp |= MII_M1111_HWCFG_MODE_COPPER_RGMII; | ||
175 | 207 | ||
176 | err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); | 208 | err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); |
177 | if (err < 0) | 209 | if (err < 0) |
@@ -262,6 +294,93 @@ static int m88e1145_config_init(struct phy_device *phydev) | |||
262 | return 0; | 294 | return 0; |
263 | } | 295 | } |
264 | 296 | ||
297 | /* marvell_read_status | ||
298 | * | ||
299 | * Generic status code does not detect Fiber correctly! | ||
300 | * Description: | ||
301 | * Check the link, then figure out the current state | ||
302 | * by comparing what we advertise with what the link partner | ||
303 | * advertises. Start by checking the gigabit possibilities, | ||
304 | * then move on to 10/100. | ||
305 | */ | ||
306 | static int marvell_read_status(struct phy_device *phydev) | ||
307 | { | ||
308 | int adv; | ||
309 | int err; | ||
310 | int lpa; | ||
311 | int status = 0; | ||
312 | |||
313 | /* Update the link, but return if there | ||
314 | * was an error */ | ||
315 | err = genphy_update_link(phydev); | ||
316 | if (err) | ||
317 | return err; | ||
318 | |||
319 | if (AUTONEG_ENABLE == phydev->autoneg) { | ||
320 | status = phy_read(phydev, MII_M1011_PHY_STATUS); | ||
321 | if (status < 0) | ||
322 | return status; | ||
323 | |||
324 | lpa = phy_read(phydev, MII_LPA); | ||
325 | if (lpa < 0) | ||
326 | return lpa; | ||
327 | |||
328 | adv = phy_read(phydev, MII_ADVERTISE); | ||
329 | if (adv < 0) | ||
330 | return adv; | ||
331 | |||
332 | lpa &= adv; | ||
333 | |||
334 | if (status & MII_M1011_PHY_STATUS_FULLDUPLEX) | ||
335 | phydev->duplex = DUPLEX_FULL; | ||
336 | else | ||
337 | phydev->duplex = DUPLEX_HALF; | ||
338 | |||
339 | status = status & MII_M1011_PHY_STATUS_SPD_MASK; | ||
340 | phydev->pause = phydev->asym_pause = 0; | ||
341 | |||
342 | switch (status) { | ||
343 | case MII_M1011_PHY_STATUS_1000: | ||
344 | phydev->speed = SPEED_1000; | ||
345 | break; | ||
346 | |||
347 | case MII_M1011_PHY_STATUS_100: | ||
348 | phydev->speed = SPEED_100; | ||
349 | break; | ||
350 | |||
351 | default: | ||
352 | phydev->speed = SPEED_10; | ||
353 | break; | ||
354 | } | ||
355 | |||
356 | if (phydev->duplex == DUPLEX_FULL) { | ||
357 | phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0; | ||
358 | phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; | ||
359 | } | ||
360 | } else { | ||
361 | int bmcr = phy_read(phydev, MII_BMCR); | ||
362 | |||
363 | if (bmcr < 0) | ||
364 | return bmcr; | ||
365 | |||
366 | if (bmcr & BMCR_FULLDPLX) | ||
367 | phydev->duplex = DUPLEX_FULL; | ||
368 | else | ||
369 | phydev->duplex = DUPLEX_HALF; | ||
370 | |||
371 | if (bmcr & BMCR_SPEED1000) | ||
372 | phydev->speed = SPEED_1000; | ||
373 | else if (bmcr & BMCR_SPEED100) | ||
374 | phydev->speed = SPEED_100; | ||
375 | else | ||
376 | phydev->speed = SPEED_10; | ||
377 | |||
378 | phydev->pause = phydev->asym_pause = 0; | ||
379 | } | ||
380 | |||
381 | return 0; | ||
382 | } | ||
383 | |||
265 | static struct phy_driver marvell_drivers[] = { | 384 | static struct phy_driver marvell_drivers[] = { |
266 | { | 385 | { |
267 | .phy_id = 0x01410c60, | 386 | .phy_id = 0x01410c60, |
@@ -296,7 +415,7 @@ static struct phy_driver marvell_drivers[] = { | |||
296 | .flags = PHY_HAS_INTERRUPT, | 415 | .flags = PHY_HAS_INTERRUPT, |
297 | .config_init = &m88e1111_config_init, | 416 | .config_init = &m88e1111_config_init, |
298 | .config_aneg = &marvell_config_aneg, | 417 | .config_aneg = &marvell_config_aneg, |
299 | .read_status = &genphy_read_status, | 418 | .read_status = &marvell_read_status, |
300 | .ack_interrupt = &marvell_ack_interrupt, | 419 | .ack_interrupt = &marvell_ack_interrupt, |
301 | .config_intr = &marvell_config_intr, | 420 | .config_intr = &marvell_config_intr, |
302 | .driver = { .owner = THIS_MODULE }, | 421 | .driver = { .owner = THIS_MODULE }, |
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 86e5dba079fe..3d10ca050b79 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -302,14 +302,14 @@ pppol2tp_session_find(struct pppol2tp_tunnel *tunnel, u16 session_id) | |||
302 | struct pppol2tp_session *session; | 302 | struct pppol2tp_session *session; |
303 | struct hlist_node *walk; | 303 | struct hlist_node *walk; |
304 | 304 | ||
305 | read_lock(&tunnel->hlist_lock); | 305 | read_lock_bh(&tunnel->hlist_lock); |
306 | hlist_for_each_entry(session, walk, session_list, hlist) { | 306 | hlist_for_each_entry(session, walk, session_list, hlist) { |
307 | if (session->tunnel_addr.s_session == session_id) { | 307 | if (session->tunnel_addr.s_session == session_id) { |
308 | read_unlock(&tunnel->hlist_lock); | 308 | read_unlock_bh(&tunnel->hlist_lock); |
309 | return session; | 309 | return session; |
310 | } | 310 | } |
311 | } | 311 | } |
312 | read_unlock(&tunnel->hlist_lock); | 312 | read_unlock_bh(&tunnel->hlist_lock); |
313 | 313 | ||
314 | return NULL; | 314 | return NULL; |
315 | } | 315 | } |
@@ -320,14 +320,14 @@ static struct pppol2tp_tunnel *pppol2tp_tunnel_find(u16 tunnel_id) | |||
320 | { | 320 | { |
321 | struct pppol2tp_tunnel *tunnel = NULL; | 321 | struct pppol2tp_tunnel *tunnel = NULL; |
322 | 322 | ||
323 | read_lock(&pppol2tp_tunnel_list_lock); | 323 | read_lock_bh(&pppol2tp_tunnel_list_lock); |
324 | list_for_each_entry(tunnel, &pppol2tp_tunnel_list, list) { | 324 | list_for_each_entry(tunnel, &pppol2tp_tunnel_list, list) { |
325 | if (tunnel->stats.tunnel_id == tunnel_id) { | 325 | if (tunnel->stats.tunnel_id == tunnel_id) { |
326 | read_unlock(&pppol2tp_tunnel_list_lock); | 326 | read_unlock_bh(&pppol2tp_tunnel_list_lock); |
327 | return tunnel; | 327 | return tunnel; |
328 | } | 328 | } |
329 | } | 329 | } |
330 | read_unlock(&pppol2tp_tunnel_list_lock); | 330 | read_unlock_bh(&pppol2tp_tunnel_list_lock); |
331 | 331 | ||
332 | return NULL; | 332 | return NULL; |
333 | } | 333 | } |
@@ -342,10 +342,11 @@ static struct pppol2tp_tunnel *pppol2tp_tunnel_find(u16 tunnel_id) | |||
342 | static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_buff *skb) | 342 | static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_buff *skb) |
343 | { | 343 | { |
344 | struct sk_buff *skbp; | 344 | struct sk_buff *skbp; |
345 | struct sk_buff *tmp; | ||
345 | u16 ns = PPPOL2TP_SKB_CB(skb)->ns; | 346 | u16 ns = PPPOL2TP_SKB_CB(skb)->ns; |
346 | 347 | ||
347 | spin_lock(&session->reorder_q.lock); | 348 | spin_lock_bh(&session->reorder_q.lock); |
348 | skb_queue_walk(&session->reorder_q, skbp) { | 349 | skb_queue_walk_safe(&session->reorder_q, skbp, tmp) { |
349 | if (PPPOL2TP_SKB_CB(skbp)->ns > ns) { | 350 | if (PPPOL2TP_SKB_CB(skbp)->ns > ns) { |
350 | __skb_insert(skb, skbp->prev, skbp, &session->reorder_q); | 351 | __skb_insert(skb, skbp->prev, skbp, &session->reorder_q); |
351 | PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG, | 352 | PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG, |
@@ -360,7 +361,7 @@ static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_ | |||
360 | __skb_queue_tail(&session->reorder_q, skb); | 361 | __skb_queue_tail(&session->reorder_q, skb); |
361 | 362 | ||
362 | out: | 363 | out: |
363 | spin_unlock(&session->reorder_q.lock); | 364 | spin_unlock_bh(&session->reorder_q.lock); |
364 | } | 365 | } |
365 | 366 | ||
366 | /* Dequeue a single skb. | 367 | /* Dequeue a single skb. |
@@ -371,10 +372,9 @@ static void pppol2tp_recv_dequeue_skb(struct pppol2tp_session *session, struct s | |||
371 | int length = PPPOL2TP_SKB_CB(skb)->length; | 372 | int length = PPPOL2TP_SKB_CB(skb)->length; |
372 | struct sock *session_sock = NULL; | 373 | struct sock *session_sock = NULL; |
373 | 374 | ||
374 | /* We're about to requeue the skb, so unlink it and return resources | 375 | /* We're about to requeue the skb, so return resources |
375 | * to its current owner (a socket receive buffer). | 376 | * to its current owner (a socket receive buffer). |
376 | */ | 377 | */ |
377 | skb_unlink(skb, &session->reorder_q); | ||
378 | skb_orphan(skb); | 378 | skb_orphan(skb); |
379 | 379 | ||
380 | tunnel->stats.rx_packets++; | 380 | tunnel->stats.rx_packets++; |
@@ -442,7 +442,7 @@ static void pppol2tp_recv_dequeue(struct pppol2tp_session *session) | |||
442 | * expect to send up next, dequeue it and any other | 442 | * expect to send up next, dequeue it and any other |
443 | * in-sequence packets behind it. | 443 | * in-sequence packets behind it. |
444 | */ | 444 | */ |
445 | spin_lock(&session->reorder_q.lock); | 445 | spin_lock_bh(&session->reorder_q.lock); |
446 | skb_queue_walk_safe(&session->reorder_q, skb, tmp) { | 446 | skb_queue_walk_safe(&session->reorder_q, skb, tmp) { |
447 | if (time_after(jiffies, PPPOL2TP_SKB_CB(skb)->expires)) { | 447 | if (time_after(jiffies, PPPOL2TP_SKB_CB(skb)->expires)) { |
448 | session->stats.rx_seq_discards++; | 448 | session->stats.rx_seq_discards++; |
@@ -470,13 +470,18 @@ static void pppol2tp_recv_dequeue(struct pppol2tp_session *session) | |||
470 | goto out; | 470 | goto out; |
471 | } | 471 | } |
472 | } | 472 | } |
473 | spin_unlock(&session->reorder_q.lock); | 473 | __skb_unlink(skb, &session->reorder_q); |
474 | |||
475 | /* Process the skb. We release the queue lock while we | ||
476 | * do so to let other contexts process the queue. | ||
477 | */ | ||
478 | spin_unlock_bh(&session->reorder_q.lock); | ||
474 | pppol2tp_recv_dequeue_skb(session, skb); | 479 | pppol2tp_recv_dequeue_skb(session, skb); |
475 | spin_lock(&session->reorder_q.lock); | 480 | spin_lock_bh(&session->reorder_q.lock); |
476 | } | 481 | } |
477 | 482 | ||
478 | out: | 483 | out: |
479 | spin_unlock(&session->reorder_q.lock); | 484 | spin_unlock_bh(&session->reorder_q.lock); |
480 | } | 485 | } |
481 | 486 | ||
482 | /* Internal receive frame. Do the real work of receiving an L2TP data frame | 487 | /* Internal receive frame. Do the real work of receiving an L2TP data frame |
@@ -1059,7 +1064,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1059 | 1064 | ||
1060 | /* Get routing info from the tunnel socket */ | 1065 | /* Get routing info from the tunnel socket */ |
1061 | dst_release(skb->dst); | 1066 | dst_release(skb->dst); |
1062 | skb->dst = sk_dst_get(sk_tun); | 1067 | skb->dst = dst_clone(__sk_dst_get(sk_tun)); |
1063 | skb_orphan(skb); | 1068 | skb_orphan(skb); |
1064 | skb->sk = sk_tun; | 1069 | skb->sk = sk_tun; |
1065 | 1070 | ||
@@ -1107,7 +1112,7 @@ static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel) | |||
1107 | PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, | 1112 | PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, |
1108 | "%s: closing all sessions...\n", tunnel->name); | 1113 | "%s: closing all sessions...\n", tunnel->name); |
1109 | 1114 | ||
1110 | write_lock(&tunnel->hlist_lock); | 1115 | write_lock_bh(&tunnel->hlist_lock); |
1111 | for (hash = 0; hash < PPPOL2TP_HASH_SIZE; hash++) { | 1116 | for (hash = 0; hash < PPPOL2TP_HASH_SIZE; hash++) { |
1112 | again: | 1117 | again: |
1113 | hlist_for_each_safe(walk, tmp, &tunnel->session_hlist[hash]) { | 1118 | hlist_for_each_safe(walk, tmp, &tunnel->session_hlist[hash]) { |
@@ -1129,7 +1134,7 @@ again: | |||
1129 | * disappear as we're jumping between locks. | 1134 | * disappear as we're jumping between locks. |
1130 | */ | 1135 | */ |
1131 | sock_hold(sk); | 1136 | sock_hold(sk); |
1132 | write_unlock(&tunnel->hlist_lock); | 1137 | write_unlock_bh(&tunnel->hlist_lock); |
1133 | lock_sock(sk); | 1138 | lock_sock(sk); |
1134 | 1139 | ||
1135 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { | 1140 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { |
@@ -1154,11 +1159,11 @@ again: | |||
1154 | * list so we are guaranteed to make forward | 1159 | * list so we are guaranteed to make forward |
1155 | * progress. | 1160 | * progress. |
1156 | */ | 1161 | */ |
1157 | write_lock(&tunnel->hlist_lock); | 1162 | write_lock_bh(&tunnel->hlist_lock); |
1158 | goto again; | 1163 | goto again; |
1159 | } | 1164 | } |
1160 | } | 1165 | } |
1161 | write_unlock(&tunnel->hlist_lock); | 1166 | write_unlock_bh(&tunnel->hlist_lock); |
1162 | } | 1167 | } |
1163 | 1168 | ||
1164 | /* Really kill the tunnel. | 1169 | /* Really kill the tunnel. |
@@ -1167,9 +1172,9 @@ again: | |||
1167 | static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel) | 1172 | static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel) |
1168 | { | 1173 | { |
1169 | /* Remove from socket list */ | 1174 | /* Remove from socket list */ |
1170 | write_lock(&pppol2tp_tunnel_list_lock); | 1175 | write_lock_bh(&pppol2tp_tunnel_list_lock); |
1171 | list_del_init(&tunnel->list); | 1176 | list_del_init(&tunnel->list); |
1172 | write_unlock(&pppol2tp_tunnel_list_lock); | 1177 | write_unlock_bh(&pppol2tp_tunnel_list_lock); |
1173 | 1178 | ||
1174 | atomic_dec(&pppol2tp_tunnel_count); | 1179 | atomic_dec(&pppol2tp_tunnel_count); |
1175 | kfree(tunnel); | 1180 | kfree(tunnel); |
@@ -1245,9 +1250,9 @@ static void pppol2tp_session_destruct(struct sock *sk) | |||
1245 | /* Delete the session socket from the | 1250 | /* Delete the session socket from the |
1246 | * hash | 1251 | * hash |
1247 | */ | 1252 | */ |
1248 | write_lock(&tunnel->hlist_lock); | 1253 | write_lock_bh(&tunnel->hlist_lock); |
1249 | hlist_del_init(&session->hlist); | 1254 | hlist_del_init(&session->hlist); |
1250 | write_unlock(&tunnel->hlist_lock); | 1255 | write_unlock_bh(&tunnel->hlist_lock); |
1251 | 1256 | ||
1252 | atomic_dec(&pppol2tp_session_count); | 1257 | atomic_dec(&pppol2tp_session_count); |
1253 | } | 1258 | } |
@@ -1392,9 +1397,9 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id, | |||
1392 | 1397 | ||
1393 | /* Add tunnel to our list */ | 1398 | /* Add tunnel to our list */ |
1394 | INIT_LIST_HEAD(&tunnel->list); | 1399 | INIT_LIST_HEAD(&tunnel->list); |
1395 | write_lock(&pppol2tp_tunnel_list_lock); | 1400 | write_lock_bh(&pppol2tp_tunnel_list_lock); |
1396 | list_add(&tunnel->list, &pppol2tp_tunnel_list); | 1401 | list_add(&tunnel->list, &pppol2tp_tunnel_list); |
1397 | write_unlock(&pppol2tp_tunnel_list_lock); | 1402 | write_unlock_bh(&pppol2tp_tunnel_list_lock); |
1398 | atomic_inc(&pppol2tp_tunnel_count); | 1403 | atomic_inc(&pppol2tp_tunnel_count); |
1399 | 1404 | ||
1400 | /* Bump the reference count. The tunnel context is deleted | 1405 | /* Bump the reference count. The tunnel context is deleted |
@@ -1599,11 +1604,11 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
1599 | sk->sk_user_data = session; | 1604 | sk->sk_user_data = session; |
1600 | 1605 | ||
1601 | /* Add session to the tunnel's hash list */ | 1606 | /* Add session to the tunnel's hash list */ |
1602 | write_lock(&tunnel->hlist_lock); | 1607 | write_lock_bh(&tunnel->hlist_lock); |
1603 | hlist_add_head(&session->hlist, | 1608 | hlist_add_head(&session->hlist, |
1604 | pppol2tp_session_id_hash(tunnel, | 1609 | pppol2tp_session_id_hash(tunnel, |
1605 | session->tunnel_addr.s_session)); | 1610 | session->tunnel_addr.s_session)); |
1606 | write_unlock(&tunnel->hlist_lock); | 1611 | write_unlock_bh(&tunnel->hlist_lock); |
1607 | 1612 | ||
1608 | atomic_inc(&pppol2tp_session_count); | 1613 | atomic_inc(&pppol2tp_session_count); |
1609 | 1614 | ||
@@ -2205,7 +2210,7 @@ static struct pppol2tp_session *next_session(struct pppol2tp_tunnel *tunnel, str | |||
2205 | int next = 0; | 2210 | int next = 0; |
2206 | int i; | 2211 | int i; |
2207 | 2212 | ||
2208 | read_lock(&tunnel->hlist_lock); | 2213 | read_lock_bh(&tunnel->hlist_lock); |
2209 | for (i = 0; i < PPPOL2TP_HASH_SIZE; i++) { | 2214 | for (i = 0; i < PPPOL2TP_HASH_SIZE; i++) { |
2210 | hlist_for_each_entry(session, walk, &tunnel->session_hlist[i], hlist) { | 2215 | hlist_for_each_entry(session, walk, &tunnel->session_hlist[i], hlist) { |
2211 | if (curr == NULL) { | 2216 | if (curr == NULL) { |
@@ -2223,7 +2228,7 @@ static struct pppol2tp_session *next_session(struct pppol2tp_tunnel *tunnel, str | |||
2223 | } | 2228 | } |
2224 | } | 2229 | } |
2225 | out: | 2230 | out: |
2226 | read_unlock(&tunnel->hlist_lock); | 2231 | read_unlock_bh(&tunnel->hlist_lock); |
2227 | if (!found) | 2232 | if (!found) |
2228 | session = NULL; | 2233 | session = NULL; |
2229 | 2234 | ||
@@ -2234,13 +2239,13 @@ static struct pppol2tp_tunnel *next_tunnel(struct pppol2tp_tunnel *curr) | |||
2234 | { | 2239 | { |
2235 | struct pppol2tp_tunnel *tunnel = NULL; | 2240 | struct pppol2tp_tunnel *tunnel = NULL; |
2236 | 2241 | ||
2237 | read_lock(&pppol2tp_tunnel_list_lock); | 2242 | read_lock_bh(&pppol2tp_tunnel_list_lock); |
2238 | if (list_is_last(&curr->list, &pppol2tp_tunnel_list)) { | 2243 | if (list_is_last(&curr->list, &pppol2tp_tunnel_list)) { |
2239 | goto out; | 2244 | goto out; |
2240 | } | 2245 | } |
2241 | tunnel = list_entry(curr->list.next, struct pppol2tp_tunnel, list); | 2246 | tunnel = list_entry(curr->list.next, struct pppol2tp_tunnel, list); |
2242 | out: | 2247 | out: |
2243 | read_unlock(&pppol2tp_tunnel_list_lock); | 2248 | read_unlock_bh(&pppol2tp_tunnel_list_lock); |
2244 | 2249 | ||
2245 | return tunnel; | 2250 | return tunnel; |
2246 | } | 2251 | } |
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index daf5abab9534..ddbc6e475e28 100644 --- a/drivers/net/ps3_gelic_wireless.c +++ b/drivers/net/ps3_gelic_wireless.c | |||
@@ -1644,13 +1644,24 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1644 | } | 1644 | } |
1645 | 1645 | ||
1646 | /* put them in the newtork_list */ | 1646 | /* put them in the newtork_list */ |
1647 | scan_info = wl->buf; | 1647 | for (i = 0, scan_info_size = 0, scan_info = wl->buf; |
1648 | scan_info_size = 0; | 1648 | scan_info_size < data_len; |
1649 | i = 0; | 1649 | i++, scan_info_size += be16_to_cpu(scan_info->size), |
1650 | while (scan_info_size < data_len) { | 1650 | scan_info = (void *)scan_info + be16_to_cpu(scan_info->size)) { |
1651 | pr_debug("%s:size=%d bssid=%s scan_info=%p\n", __func__, | 1651 | pr_debug("%s:size=%d bssid=%s scan_info=%p\n", __func__, |
1652 | be16_to_cpu(scan_info->size), | 1652 | be16_to_cpu(scan_info->size), |
1653 | print_mac(mac, &scan_info->bssid[2]), scan_info); | 1653 | print_mac(mac, &scan_info->bssid[2]), scan_info); |
1654 | |||
1655 | /* | ||
1656 | * The wireless firmware may return invalid channel 0 and/or | ||
1657 | * invalid rate if the AP emits zero length SSID ie. As this | ||
1658 | * scan information is useless, ignore it | ||
1659 | */ | ||
1660 | if (!be16_to_cpu(scan_info->channel) || !scan_info->rate[0]) { | ||
1661 | pr_debug("%s: invalid scan info\n", __func__); | ||
1662 | continue; | ||
1663 | } | ||
1664 | |||
1654 | found = 0; | 1665 | found = 0; |
1655 | oldest = NULL; | 1666 | oldest = NULL; |
1656 | list_for_each_entry(target, &wl->network_list, list) { | 1667 | list_for_each_entry(target, &wl->network_list, list) { |
@@ -1687,10 +1698,6 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1687 | GFP_KERNEL); | 1698 | GFP_KERNEL); |
1688 | if (!target->hwinfo) { | 1699 | if (!target->hwinfo) { |
1689 | pr_info("%s: kzalloc failed\n", __func__); | 1700 | pr_info("%s: kzalloc failed\n", __func__); |
1690 | i++; | ||
1691 | scan_info_size += be16_to_cpu(scan_info->size); | ||
1692 | scan_info = (void *)scan_info + | ||
1693 | be16_to_cpu(scan_info->size); | ||
1694 | continue; | 1701 | continue; |
1695 | } | 1702 | } |
1696 | /* copy hw scan info */ | 1703 | /* copy hw scan info */ |
@@ -1709,10 +1716,6 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1709 | if (scan_info->ext_rate[r]) | 1716 | if (scan_info->ext_rate[r]) |
1710 | target->rate_ext_len++; | 1717 | target->rate_ext_len++; |
1711 | list_move_tail(&target->list, &wl->network_list); | 1718 | list_move_tail(&target->list, &wl->network_list); |
1712 | /* bump pointer */ | ||
1713 | i++; | ||
1714 | scan_info_size += be16_to_cpu(scan_info->size); | ||
1715 | scan_info = (void *)scan_info + be16_to_cpu(scan_info->size); | ||
1716 | } | 1719 | } |
1717 | memset(&data, 0, sizeof(data)); | 1720 | memset(&data, 0, sizeof(data)); |
1718 | wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data, | 1721 | wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data, |
@@ -2389,6 +2392,8 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card) | |||
2389 | if (!netdev) | 2392 | if (!netdev) |
2390 | return NULL; | 2393 | return NULL; |
2391 | 2394 | ||
2395 | strcpy(netdev->name, "wlan%d"); | ||
2396 | |||
2392 | port = netdev_priv(netdev); | 2397 | port = netdev_priv(netdev); |
2393 | port->netdev = netdev; | 2398 | port->netdev = netdev; |
2394 | port->card = card; | 2399 | port->card = card; |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 19184e486ae9..169edc154928 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -239,7 +239,8 @@ static void r6040_free_txbufs(struct net_device *dev) | |||
239 | 239 | ||
240 | for (i = 0; i < TX_DCNT; i++) { | 240 | for (i = 0; i < TX_DCNT; i++) { |
241 | if (lp->tx_insert_ptr->skb_ptr) { | 241 | if (lp->tx_insert_ptr->skb_ptr) { |
242 | pci_unmap_single(lp->pdev, lp->tx_insert_ptr->buf, | 242 | pci_unmap_single(lp->pdev, |
243 | le32_to_cpu(lp->tx_insert_ptr->buf), | ||
243 | MAX_BUF_SIZE, PCI_DMA_TODEVICE); | 244 | MAX_BUF_SIZE, PCI_DMA_TODEVICE); |
244 | dev_kfree_skb(lp->tx_insert_ptr->skb_ptr); | 245 | dev_kfree_skb(lp->tx_insert_ptr->skb_ptr); |
245 | lp->rx_insert_ptr->skb_ptr = NULL; | 246 | lp->rx_insert_ptr->skb_ptr = NULL; |
@@ -255,7 +256,8 @@ static void r6040_free_rxbufs(struct net_device *dev) | |||
255 | 256 | ||
256 | for (i = 0; i < RX_DCNT; i++) { | 257 | for (i = 0; i < RX_DCNT; i++) { |
257 | if (lp->rx_insert_ptr->skb_ptr) { | 258 | if (lp->rx_insert_ptr->skb_ptr) { |
258 | pci_unmap_single(lp->pdev, lp->rx_insert_ptr->buf, | 259 | pci_unmap_single(lp->pdev, |
260 | le32_to_cpu(lp->rx_insert_ptr->buf), | ||
259 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 261 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
260 | dev_kfree_skb(lp->rx_insert_ptr->skb_ptr); | 262 | dev_kfree_skb(lp->rx_insert_ptr->skb_ptr); |
261 | lp->rx_insert_ptr->skb_ptr = NULL; | 263 | lp->rx_insert_ptr->skb_ptr = NULL; |
@@ -542,7 +544,7 @@ static int r6040_rx(struct net_device *dev, int limit) | |||
542 | skb_ptr->dev = priv->dev; | 544 | skb_ptr->dev = priv->dev; |
543 | /* Do not count the CRC */ | 545 | /* Do not count the CRC */ |
544 | skb_put(skb_ptr, descptr->len - 4); | 546 | skb_put(skb_ptr, descptr->len - 4); |
545 | pci_unmap_single(priv->pdev, descptr->buf, | 547 | pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf), |
546 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 548 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
547 | skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev); | 549 | skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev); |
548 | /* Send to upper layer */ | 550 | /* Send to upper layer */ |
@@ -585,7 +587,7 @@ static void r6040_tx(struct net_device *dev) | |||
585 | if (descptr->status & 0x8000) | 587 | if (descptr->status & 0x8000) |
586 | break; /* Not complete */ | 588 | break; /* Not complete */ |
587 | skb_ptr = descptr->skb_ptr; | 589 | skb_ptr = descptr->skb_ptr; |
588 | pci_unmap_single(priv->pdev, descptr->buf, | 590 | pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf), |
589 | skb_ptr->len, PCI_DMA_TODEVICE); | 591 | skb_ptr->len, PCI_DMA_TODEVICE); |
590 | /* Free buffer */ | 592 | /* Free buffer */ |
591 | dev_kfree_skb_irq(skb_ptr); | 593 | dev_kfree_skb_irq(skb_ptr); |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 6179a0a2032c..3c915b82e199 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -1088,7 +1088,7 @@ static int s2io_print_pci_mode(struct s2io_nic *nic) | |||
1088 | * '-1' on failure | 1088 | * '-1' on failure |
1089 | */ | 1089 | */ |
1090 | 1090 | ||
1091 | int init_tti(struct s2io_nic *nic, int link) | 1091 | static int init_tti(struct s2io_nic *nic, int link) |
1092 | { | 1092 | { |
1093 | struct XENA_dev_config __iomem *bar0 = nic->bar0; | 1093 | struct XENA_dev_config __iomem *bar0 = nic->bar0; |
1094 | register u64 val64 = 0; | 1094 | register u64 val64 = 0; |
@@ -4172,6 +4172,9 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4172 | dev->trans_start = jiffies; | 4172 | dev->trans_start = jiffies; |
4173 | spin_unlock_irqrestore(&fifo->tx_lock, flags); | 4173 | spin_unlock_irqrestore(&fifo->tx_lock, flags); |
4174 | 4174 | ||
4175 | if (sp->config.intr_type == MSI_X) | ||
4176 | tx_intr_handler(fifo); | ||
4177 | |||
4175 | return 0; | 4178 | return 0; |
4176 | pci_map_failed: | 4179 | pci_map_failed: |
4177 | stats->pci_map_fail_cnt++; | 4180 | stats->pci_map_fail_cnt++; |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 186eb8ebfda6..2e26dced13a1 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_struct *napi, int to_do) | |||
3199 | skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START); | 3199 | skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START); |
3200 | 3200 | ||
3201 | if (work_done < to_do) { | 3201 | if (work_done < to_do) { |
3202 | spin_lock_irq(&hw->hw_lock); | 3202 | unsigned long flags; |
3203 | |||
3204 | spin_lock_irqsave(&hw->hw_lock, flags); | ||
3203 | __netif_rx_complete(dev, napi); | 3205 | __netif_rx_complete(dev, napi); |
3204 | hw->intr_mask |= napimask[skge->port]; | 3206 | hw->intr_mask |= napimask[skge->port]; |
3205 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 3207 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
3206 | skge_read32(hw, B0_IMSK); | 3208 | skge_read32(hw, B0_IMSK); |
3207 | spin_unlock_irq(&hw->hw_lock); | 3209 | spin_unlock_irqrestore(&hw->hw_lock, flags); |
3208 | } | 3210 | } |
3209 | 3211 | ||
3210 | return work_done; | 3212 | return work_done; |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 51d4134b37b1..98a832a75539 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -92,14 +92,14 @@ | |||
92 | #define SMC_insw(a, r, p, l) insw ((unsigned long *)((a) + (r)), p, l) | 92 | #define SMC_insw(a, r, p, l) insw ((unsigned long *)((a) + (r)), p, l) |
93 | # endif | 93 | # endif |
94 | /* check if the mac in reg is valid */ | 94 | /* check if the mac in reg is valid */ |
95 | #define SMC_GET_MAC_ADDR(addr) \ | 95 | #define SMC_GET_MAC_ADDR(lp, addr) \ |
96 | do { \ | 96 | do { \ |
97 | unsigned int __v; \ | 97 | unsigned int __v; \ |
98 | __v = SMC_inw(ioaddr, ADDR0_REG); \ | 98 | __v = SMC_inw(ioaddr, ADDR0_REG(lp)); \ |
99 | addr[0] = __v; addr[1] = __v >> 8; \ | 99 | addr[0] = __v; addr[1] = __v >> 8; \ |
100 | __v = SMC_inw(ioaddr, ADDR1_REG); \ | 100 | __v = SMC_inw(ioaddr, ADDR1_REG(lp)); \ |
101 | addr[2] = __v; addr[3] = __v >> 8; \ | 101 | addr[2] = __v; addr[3] = __v >> 8; \ |
102 | __v = SMC_inw(ioaddr, ADDR2_REG); \ | 102 | __v = SMC_inw(ioaddr, ADDR2_REG(lp)); \ |
103 | addr[4] = __v; addr[5] = __v >> 8; \ | 103 | addr[4] = __v; addr[5] = __v >> 8; \ |
104 | if (*(u32 *)(&addr[0]) == 0xFFFFFFFF) { \ | 104 | if (*(u32 *)(&addr[0]) == 0xFFFFFFFF) { \ |
105 | random_ether_addr(addr); \ | 105 | random_ether_addr(addr); \ |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 97212799c513..4291458955ef 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -912,7 +912,7 @@ static int gem_poll(struct napi_struct *napi, int budget) | |||
912 | * rx ring - must call napi_disable(), which | 912 | * rx ring - must call napi_disable(), which |
913 | * schedule_timeout()'s if polling is already disabled. | 913 | * schedule_timeout()'s if polling is already disabled. |
914 | */ | 914 | */ |
915 | work_done += gem_rx(gp, budget); | 915 | work_done += gem_rx(gp, budget - work_done); |
916 | 916 | ||
917 | if (work_done >= budget) | 917 | if (work_done >= budget) |
918 | return work_done; | 918 | return work_done; |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 26ffb67f1da2..f9ef8bd8b11e 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -64,8 +64,8 @@ | |||
64 | 64 | ||
65 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
66 | #define PFX DRV_MODULE_NAME ": " | 66 | #define PFX DRV_MODULE_NAME ": " |
67 | #define DRV_MODULE_VERSION "3.87" | 67 | #define DRV_MODULE_VERSION "3.88" |
68 | #define DRV_MODULE_RELDATE "December 20, 2007" | 68 | #define DRV_MODULE_RELDATE "March 20, 2008" |
69 | 69 | ||
70 | #define TG3_DEF_MAC_MODE 0 | 70 | #define TG3_DEF_MAC_MODE 0 |
71 | #define TG3_DEF_RX_MODE 0 | 71 | #define TG3_DEF_RX_MODE 0 |
@@ -11841,7 +11841,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
11841 | } | 11841 | } |
11842 | 11842 | ||
11843 | if (!is_valid_ether_addr(&dev->dev_addr[0])) { | 11843 | if (!is_valid_ether_addr(&dev->dev_addr[0])) { |
11844 | #ifdef CONFIG_SPARC64 | 11844 | #ifdef CONFIG_SPARC |
11845 | if (!tg3_get_default_macaddr_sparc(tp)) | 11845 | if (!tg3_get_default_macaddr_sparc(tp)) |
11846 | return 0; | 11846 | return 0; |
11847 | #endif | 11847 | #endif |
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c index 8909050b8ea7..5f1c5072b96f 100644 --- a/drivers/net/tokenring/smctr.c +++ b/drivers/net/tokenring/smctr.c | |||
@@ -3413,7 +3413,7 @@ static int smctr_make_tx_status_code(struct net_device *dev, | |||
3413 | tsv->svi = TRANSMIT_STATUS_CODE; | 3413 | tsv->svi = TRANSMIT_STATUS_CODE; |
3414 | tsv->svl = S_TRANSMIT_STATUS_CODE; | 3414 | tsv->svl = S_TRANSMIT_STATUS_CODE; |
3415 | 3415 | ||
3416 | tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) || IBM_PASS_SOURCE_ADDR); | 3416 | tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) | IBM_PASS_SOURCE_ADDR); |
3417 | 3417 | ||
3418 | /* Stripped frame status of Transmitted Frame */ | 3418 | /* Stripped frame status of Transmitted Frame */ |
3419 | tsv->svv[1] = tx_fstatus & 0xff; | 3419 | tsv->svv[1] = tx_fstatus & 0xff; |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 77d9dd7ea34f..1b5edd646a8c 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -842,7 +842,7 @@ static inline int de_is_running (struct de_private *de) | |||
842 | static void de_stop_rxtx (struct de_private *de) | 842 | static void de_stop_rxtx (struct de_private *de) |
843 | { | 843 | { |
844 | u32 macmode; | 844 | u32 macmode; |
845 | unsigned int work = 1000; | 845 | unsigned int i = 1300/100; |
846 | 846 | ||
847 | macmode = dr32(MacMode); | 847 | macmode = dr32(MacMode); |
848 | if (macmode & RxTx) { | 848 | if (macmode & RxTx) { |
@@ -850,10 +850,14 @@ static void de_stop_rxtx (struct de_private *de) | |||
850 | dr32(MacMode); | 850 | dr32(MacMode); |
851 | } | 851 | } |
852 | 852 | ||
853 | while (--work > 0) { | 853 | /* wait until in-flight frame completes. |
854 | * Max time @ 10BT: 1500*8b/10Mbps == 1200us (+ 100us margin) | ||
855 | * Typically expect this loop to end in < 50 us on 100BT. | ||
856 | */ | ||
857 | while (--i) { | ||
854 | if (!de_is_running(de)) | 858 | if (!de_is_running(de)) |
855 | return; | 859 | return; |
856 | cpu_relax(); | 860 | udelay(100); |
857 | } | 861 | } |
858 | 862 | ||
859 | printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name); | 863 | printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name); |
@@ -910,7 +914,8 @@ static void de_set_media (struct de_private *de) | |||
910 | unsigned media = de->media_type; | 914 | unsigned media = de->media_type; |
911 | u32 macmode = dr32(MacMode); | 915 | u32 macmode = dr32(MacMode); |
912 | 916 | ||
913 | BUG_ON(de_is_running(de)); | 917 | if (de_is_running(de)) |
918 | printk(KERN_WARNING "%s: chip is running while changing media!\n", de->dev->name); | ||
914 | 919 | ||
915 | if (de->de21040) | 920 | if (de->de21040) |
916 | dw32(CSR11, FULL_DUPLEX_MAGIC); | 921 | dw32(CSR11, FULL_DUPLEX_MAGIC); |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index fba0811d2608..8cc316653a39 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -154,8 +154,8 @@ static struct ucc_geth_info ugeth_primary_info = { | |||
154 | .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, | 154 | .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, |
155 | .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE, | 155 | .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE, |
156 | .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC, | 156 | .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC, |
157 | .numThreadsTx = UCC_GETH_NUM_OF_THREADS_4, | 157 | .numThreadsTx = UCC_GETH_NUM_OF_THREADS_1, |
158 | .numThreadsRx = UCC_GETH_NUM_OF_THREADS_4, | 158 | .numThreadsRx = UCC_GETH_NUM_OF_THREADS_1, |
159 | .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, | 159 | .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, |
160 | .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, | 160 | .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, |
161 | }; | 161 | }; |
@@ -3975,6 +3975,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3975 | ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT; | 3975 | ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT; |
3976 | ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT; | 3976 | ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT; |
3977 | ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; | 3977 | ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; |
3978 | ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4; | ||
3979 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; | ||
3978 | } | 3980 | } |
3979 | 3981 | ||
3980 | /* Set the bus id */ | 3982 | /* Set the bus id */ |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 4b131a6c6b70..0343b00cf1fd 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -341,7 +341,7 @@ static void dm9601_set_multicast(struct net_device *net) | |||
341 | /* We use the 20 byte dev->data for our 8 byte filter buffer | 341 | /* We use the 20 byte dev->data for our 8 byte filter buffer |
342 | * to avoid allocating memory that is tricky to free later */ | 342 | * to avoid allocating memory that is tricky to free later */ |
343 | u8 *hashes = (u8 *) & dev->data; | 343 | u8 *hashes = (u8 *) & dev->data; |
344 | u8 rx_ctl = 0x01; | 344 | u8 rx_ctl = 0x31; |
345 | 345 | ||
346 | memset(hashes, 0x00, DM_MCAST_SIZE); | 346 | memset(hashes, 0x00, DM_MCAST_SIZE); |
347 | hashes[DM_MCAST_SIZE - 1] |= 0x80; /* broadcast address */ | 347 | hashes[DM_MCAST_SIZE - 1] |= 0x80; /* broadcast address */ |
@@ -562,6 +562,10 @@ static const struct usb_device_id products[] = { | |||
562 | USB_DEVICE(0x0a46, 0x8515), /* ADMtek ADM8515 USB NIC */ | 562 | USB_DEVICE(0x0a46, 0x8515), /* ADMtek ADM8515 USB NIC */ |
563 | .driver_info = (unsigned long)&dm9601_info, | 563 | .driver_info = (unsigned long)&dm9601_info, |
564 | }, | 564 | }, |
565 | { | ||
566 | USB_DEVICE(0x0a47, 0x9601), /* Hirose USB-100 */ | ||
567 | .driver_info = (unsigned long)&dm9601_info, | ||
568 | }, | ||
565 | {}, // END | 569 | {}, // END |
566 | }; | 570 | }; |
567 | 571 | ||
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index a61324757b17..369c731114b3 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c | |||
@@ -16,10 +16,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | |||
20 | // #define DEBUG // error path messages, extra info | ||
21 | // #define VERBOSE // more; success messages | ||
22 | |||
23 | #include <linux/module.h> | 19 | #include <linux/module.h> |
24 | #include <linux/init.h> | 20 | #include <linux/init.h> |
25 | #include <linux/netdevice.h> | 21 | #include <linux/netdevice.h> |
@@ -287,7 +283,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) | |||
287 | struct rndis_set_c *set_c; | 283 | struct rndis_set_c *set_c; |
288 | struct rndis_halt *halt; | 284 | struct rndis_halt *halt; |
289 | } u; | 285 | } u; |
290 | u32 tmp, *phym; | 286 | u32 tmp, phym_unspec, *phym; |
291 | int reply_len; | 287 | int reply_len; |
292 | unsigned char *bp; | 288 | unsigned char *bp; |
293 | 289 | ||
@@ -318,6 +314,14 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) | |||
318 | net->hard_header_len += sizeof (struct rndis_data_hdr); | 314 | net->hard_header_len += sizeof (struct rndis_data_hdr); |
319 | dev->hard_mtu = net->mtu + net->hard_header_len; | 315 | dev->hard_mtu = net->mtu + net->hard_header_len; |
320 | 316 | ||
317 | dev->maxpacket = usb_maxpacket(dev->udev, dev->out, 1); | ||
318 | if (dev->maxpacket == 0) { | ||
319 | if (netif_msg_probe(dev)) | ||
320 | dev_dbg(&intf->dev, "dev->maxpacket can't be 0\n"); | ||
321 | retval = -EINVAL; | ||
322 | goto fail_and_release; | ||
323 | } | ||
324 | |||
321 | dev->rx_urb_size = dev->hard_mtu + (dev->maxpacket + 1); | 325 | dev->rx_urb_size = dev->hard_mtu + (dev->maxpacket + 1); |
322 | dev->rx_urb_size &= ~(dev->maxpacket - 1); | 326 | dev->rx_urb_size &= ~(dev->maxpacket - 1); |
323 | u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size); | 327 | u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size); |
@@ -359,12 +363,15 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) | |||
359 | goto halt_fail_and_release; | 363 | goto halt_fail_and_release; |
360 | 364 | ||
361 | /* Check physical medium */ | 365 | /* Check physical medium */ |
366 | phym = NULL; | ||
362 | reply_len = sizeof *phym; | 367 | reply_len = sizeof *phym; |
363 | retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM, | 368 | retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM, |
364 | 0, (void **) &phym, &reply_len); | 369 | 0, (void **) &phym, &reply_len); |
365 | if (retval != 0) | 370 | if (retval != 0 || !phym) { |
366 | /* OID is optional so don't fail here. */ | 371 | /* OID is optional so don't fail here. */ |
367 | *phym = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED; | 372 | phym_unspec = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED; |
373 | phym = &phym_unspec; | ||
374 | } | ||
368 | if ((flags & FLAG_RNDIS_PHYM_WIRELESS) && | 375 | if ((flags & FLAG_RNDIS_PHYM_WIRELESS) && |
369 | *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { | 376 | *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { |
370 | if (netif_msg_probe(dev)) | 377 | if (netif_msg_probe(dev)) |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 7e1f00131f91..df56a518691c 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -376,7 +376,7 @@ static int alloc_all_urbs(rtl8150_t * dev) | |||
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
378 | dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); | 378 | dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); |
379 | if (!dev->intr_urb) { | 379 | if (!dev->ctrl_urb) { |
380 | usb_free_urb(dev->rx_urb); | 380 | usb_free_urb(dev->rx_urb); |
381 | usb_free_urb(dev->tx_urb); | 381 | usb_free_urb(dev->tx_urb); |
382 | usb_free_urb(dev->intr_urb); | 382 | usb_free_urb(dev->intr_urb); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 19fd4cb0ddf8..b58472cf76f8 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -203,8 +203,11 @@ again: | |||
203 | if (received < budget) { | 203 | if (received < budget) { |
204 | netif_rx_complete(vi->dev, napi); | 204 | netif_rx_complete(vi->dev, napi); |
205 | if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) | 205 | if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) |
206 | && netif_rx_reschedule(vi->dev, napi)) | 206 | && napi_schedule_prep(napi)) { |
207 | vi->rvq->vq_ops->disable_cb(vi->rvq); | ||
208 | __netif_rx_schedule(vi->dev, napi); | ||
207 | goto again; | 209 | goto again; |
210 | } | ||
208 | } | 211 | } |
209 | 212 | ||
210 | return received; | 213 | return received; |
@@ -278,10 +281,11 @@ again: | |||
278 | pr_debug("%s: virtio not prepared to send\n", dev->name); | 281 | pr_debug("%s: virtio not prepared to send\n", dev->name); |
279 | netif_stop_queue(dev); | 282 | netif_stop_queue(dev); |
280 | 283 | ||
281 | /* Activate callback for using skbs: if this fails it | 284 | /* Activate callback for using skbs: if this returns false it |
282 | * means some were used in the meantime. */ | 285 | * means some were used in the meantime. */ |
283 | if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) { | 286 | if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) { |
284 | printk("Unlikely: restart svq failed\n"); | 287 | printk("Unlikely: restart svq race\n"); |
288 | vi->svq->vq_ops->disable_cb(vi->svq); | ||
285 | netif_start_queue(dev); | 289 | netif_start_queue(dev); |
286 | goto again; | 290 | goto again; |
287 | } | 291 | } |
@@ -294,6 +298,15 @@ again: | |||
294 | return 0; | 298 | return 0; |
295 | } | 299 | } |
296 | 300 | ||
301 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
302 | static void virtnet_netpoll(struct net_device *dev) | ||
303 | { | ||
304 | struct virtnet_info *vi = netdev_priv(dev); | ||
305 | |||
306 | napi_schedule(&vi->napi); | ||
307 | } | ||
308 | #endif | ||
309 | |||
297 | static int virtnet_open(struct net_device *dev) | 310 | static int virtnet_open(struct net_device *dev) |
298 | { | 311 | { |
299 | struct virtnet_info *vi = netdev_priv(dev); | 312 | struct virtnet_info *vi = netdev_priv(dev); |
@@ -336,6 +349,9 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
336 | dev->stop = virtnet_close; | 349 | dev->stop = virtnet_close; |
337 | dev->hard_start_xmit = start_xmit; | 350 | dev->hard_start_xmit = start_xmit; |
338 | dev->features = NETIF_F_HIGHDMA; | 351 | dev->features = NETIF_F_HIGHDMA; |
352 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
353 | dev->poll_controller = virtnet_netpoll; | ||
354 | #endif | ||
339 | SET_NETDEV_DEV(dev, &vdev->dev); | 355 | SET_NETDEV_DEV(dev, &vdev->dev); |
340 | 356 | ||
341 | /* Do we support "hardware" checksums? */ | 357 | /* Do we support "hardware" checksums? */ |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index cf27bf40d36e..547368e9633d 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -2024,6 +2024,7 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2024 | struct fstioc_write wrthdr; | 2024 | struct fstioc_write wrthdr; |
2025 | struct fstioc_info info; | 2025 | struct fstioc_info info; |
2026 | unsigned long flags; | 2026 | unsigned long flags; |
2027 | void *buf; | ||
2027 | 2028 | ||
2028 | dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data); | 2029 | dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data); |
2029 | 2030 | ||
@@ -2065,16 +2066,22 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2065 | return -ENXIO; | 2066 | return -ENXIO; |
2066 | } | 2067 | } |
2067 | 2068 | ||
2068 | /* Now copy the data to the card. | 2069 | /* Now copy the data to the card. */ |
2069 | * This will probably break on some architectures. | 2070 | |
2070 | * I'll fix it when I have something to test on. | 2071 | buf = kmalloc(wrthdr.size, GFP_KERNEL); |
2071 | */ | 2072 | if (!buf) |
2072 | if (copy_from_user(card->mem + wrthdr.offset, | 2073 | return -ENOMEM; |
2074 | |||
2075 | if (copy_from_user(buf, | ||
2073 | ifr->ifr_data + sizeof (struct fstioc_write), | 2076 | ifr->ifr_data + sizeof (struct fstioc_write), |
2074 | wrthdr.size)) { | 2077 | wrthdr.size)) { |
2078 | kfree(buf); | ||
2075 | return -EFAULT; | 2079 | return -EFAULT; |
2076 | } | 2080 | } |
2077 | 2081 | ||
2082 | memcpy_toio(card->mem + wrthdr.offset, buf, wrthdr.size); | ||
2083 | kfree(buf); | ||
2084 | |||
2078 | /* Writes to the memory of a card in the reset state constitute | 2085 | /* Writes to the memory of a card in the reset state constitute |
2079 | * a download | 2086 | * a download |
2080 | */ | 2087 | */ |
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 15d5c58e57bc..e59255a155a9 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c | |||
@@ -751,7 +751,7 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno, | |||
751 | } | 751 | } |
752 | 752 | ||
753 | 753 | ||
754 | static __inline void | 754 | static inline void |
755 | send_complete( struct net_local *nl ) | 755 | send_complete( struct net_local *nl ) |
756 | { | 756 | { |
757 | #ifdef CONFIG_SBNI_MULTILINE | 757 | #ifdef CONFIG_SBNI_MULTILINE |
diff --git a/drivers/net/wireless/arlan-proc.c b/drivers/net/wireless/arlan-proc.c index c6e70dbc5de8..2ab1d59870f4 100644 --- a/drivers/net/wireless/arlan-proc.c +++ b/drivers/net/wireless/arlan-proc.c | |||
@@ -1202,13 +1202,6 @@ static ctl_table arlan_table[MAX_ARLANS + 1] = | |||
1202 | { .ctl_name = 0 } | 1202 | { .ctl_name = 0 } |
1203 | }; | 1203 | }; |
1204 | #endif | 1204 | #endif |
1205 | #else | ||
1206 | |||
1207 | static ctl_table arlan_table[MAX_ARLANS + 1] = | ||
1208 | { | ||
1209 | { .ctl_name = 0 } | ||
1210 | }; | ||
1211 | #endif | ||
1212 | 1205 | ||
1213 | 1206 | ||
1214 | // static int mmtu = 1234; | 1207 | // static int mmtu = 1234; |
@@ -1233,7 +1226,6 @@ static ctl_table arlan_root_table[] = | |||
1233 | //}; | 1226 | //}; |
1234 | 1227 | ||
1235 | 1228 | ||
1236 | #ifdef CONFIG_PROC_FS | ||
1237 | static struct ctl_table_header *arlan_device_sysctl_header; | 1229 | static struct ctl_table_header *arlan_device_sysctl_header; |
1238 | 1230 | ||
1239 | int __init init_arlan_proc(void) | 1231 | int __init init_arlan_proc(void) |
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c index c2de2d958e8e..01757436353d 100644 --- a/drivers/net/wireless/ath5k/hw.c +++ b/drivers/net/wireless/ath5k/hw.c | |||
@@ -427,6 +427,8 @@ void ath5k_hw_detach(struct ath5k_hw *ah) | |||
427 | { | 427 | { |
428 | ATH5K_TRACE(ah->ah_sc); | 428 | ATH5K_TRACE(ah->ah_sc); |
429 | 429 | ||
430 | __set_bit(ATH_STAT_INVALID, ah->ah_sc->status); | ||
431 | |||
430 | if (ah->ah_rf_banks != NULL) | 432 | if (ah->ah_rf_banks != NULL) |
431 | kfree(ah->ah_rf_banks); | 433 | kfree(ah->ah_rf_banks); |
432 | 434 | ||
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index e38ed0fe72e9..7fca2ebc747f 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -618,6 +618,7 @@ void b43_debugfs_remove_device(struct b43_wldev *dev) | |||
618 | kfree(e); | 618 | kfree(e); |
619 | } | 619 | } |
620 | 620 | ||
621 | /* Called with IRQs disabled. */ | ||
621 | void b43_debugfs_log_txstat(struct b43_wldev *dev, | 622 | void b43_debugfs_log_txstat(struct b43_wldev *dev, |
622 | const struct b43_txstatus *status) | 623 | const struct b43_txstatus *status) |
623 | { | 624 | { |
@@ -629,8 +630,7 @@ void b43_debugfs_log_txstat(struct b43_wldev *dev, | |||
629 | if (!e) | 630 | if (!e) |
630 | return; | 631 | return; |
631 | log = &e->txstatlog; | 632 | log = &e->txstatlog; |
632 | B43_WARN_ON(!irqs_disabled()); | 633 | spin_lock(&log->lock); /* IRQs are already disabled. */ |
633 | spin_lock(&log->lock); | ||
634 | i = log->end + 1; | 634 | i = log->end + 1; |
635 | if (i == B43_NR_LOGGED_TXSTATUS) | 635 | if (i == B43_NR_LOGGED_TXSTATUS) |
636 | i = 0; | 636 | i = 0; |
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 3dfb28a34be9..cfbc1a26f601 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -560,7 +560,7 @@ static int b43_dmacontroller_tx_reset(struct b43_wldev *dev, u16 mmio_base, | |||
560 | /* Check if a DMA mapping address is invalid. */ | 560 | /* Check if a DMA mapping address is invalid. */ |
561 | static bool b43_dma_mapping_error(struct b43_dmaring *ring, | 561 | static bool b43_dma_mapping_error(struct b43_dmaring *ring, |
562 | dma_addr_t addr, | 562 | dma_addr_t addr, |
563 | size_t buffersize) | 563 | size_t buffersize, bool dma_to_device) |
564 | { | 564 | { |
565 | if (unlikely(dma_mapping_error(addr))) | 565 | if (unlikely(dma_mapping_error(addr))) |
566 | return 1; | 566 | return 1; |
@@ -568,11 +568,11 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring, | |||
568 | switch (ring->type) { | 568 | switch (ring->type) { |
569 | case B43_DMA_30BIT: | 569 | case B43_DMA_30BIT: |
570 | if ((u64)addr + buffersize > (1ULL << 30)) | 570 | if ((u64)addr + buffersize > (1ULL << 30)) |
571 | return 1; | 571 | goto address_error; |
572 | break; | 572 | break; |
573 | case B43_DMA_32BIT: | 573 | case B43_DMA_32BIT: |
574 | if ((u64)addr + buffersize > (1ULL << 32)) | 574 | if ((u64)addr + buffersize > (1ULL << 32)) |
575 | return 1; | 575 | goto address_error; |
576 | break; | 576 | break; |
577 | case B43_DMA_64BIT: | 577 | case B43_DMA_64BIT: |
578 | /* Currently we can't have addresses beyond | 578 | /* Currently we can't have addresses beyond |
@@ -582,6 +582,12 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring, | |||
582 | 582 | ||
583 | /* The address is OK. */ | 583 | /* The address is OK. */ |
584 | return 0; | 584 | return 0; |
585 | |||
586 | address_error: | ||
587 | /* We can't support this address. Unmap it again. */ | ||
588 | unmap_descbuffer(ring, addr, buffersize, dma_to_device); | ||
589 | |||
590 | return 1; | ||
585 | } | 591 | } |
586 | 592 | ||
587 | static int setup_rx_descbuffer(struct b43_dmaring *ring, | 593 | static int setup_rx_descbuffer(struct b43_dmaring *ring, |
@@ -599,7 +605,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring, | |||
599 | if (unlikely(!skb)) | 605 | if (unlikely(!skb)) |
600 | return -ENOMEM; | 606 | return -ENOMEM; |
601 | dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); | 607 | dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); |
602 | if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) { | 608 | if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { |
603 | /* ugh. try to realloc in zone_dma */ | 609 | /* ugh. try to realloc in zone_dma */ |
604 | gfp_flags |= GFP_DMA; | 610 | gfp_flags |= GFP_DMA; |
605 | 611 | ||
@@ -612,7 +618,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring, | |||
612 | ring->rx_buffersize, 0); | 618 | ring->rx_buffersize, 0); |
613 | } | 619 | } |
614 | 620 | ||
615 | if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) { | 621 | if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { |
616 | dev_kfree_skb_any(skb); | 622 | dev_kfree_skb_any(skb); |
617 | return -EIO; | 623 | return -EIO; |
618 | } | 624 | } |
@@ -852,7 +858,8 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, | |||
852 | b43_txhdr_size(dev), | 858 | b43_txhdr_size(dev), |
853 | DMA_TO_DEVICE); | 859 | DMA_TO_DEVICE); |
854 | 860 | ||
855 | if (b43_dma_mapping_error(ring, dma_test, b43_txhdr_size(dev))) { | 861 | if (b43_dma_mapping_error(ring, dma_test, |
862 | b43_txhdr_size(dev), 1)) { | ||
856 | /* ugh realloc */ | 863 | /* ugh realloc */ |
857 | kfree(ring->txhdr_cache); | 864 | kfree(ring->txhdr_cache); |
858 | ring->txhdr_cache = kcalloc(nr_slots, | 865 | ring->txhdr_cache = kcalloc(nr_slots, |
@@ -867,7 +874,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, | |||
867 | DMA_TO_DEVICE); | 874 | DMA_TO_DEVICE); |
868 | 875 | ||
869 | if (b43_dma_mapping_error(ring, dma_test, | 876 | if (b43_dma_mapping_error(ring, dma_test, |
870 | b43_txhdr_size(dev))) | 877 | b43_txhdr_size(dev), 1)) |
871 | goto err_kfree_txhdr_cache; | 878 | goto err_kfree_txhdr_cache; |
872 | } | 879 | } |
873 | 880 | ||
@@ -1189,7 +1196,7 @@ static int dma_tx_fragment(struct b43_dmaring *ring, | |||
1189 | 1196 | ||
1190 | meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, | 1197 | meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, |
1191 | hdrsize, 1); | 1198 | hdrsize, 1); |
1192 | if (b43_dma_mapping_error(ring, meta_hdr->dmaaddr, hdrsize)) { | 1199 | if (b43_dma_mapping_error(ring, meta_hdr->dmaaddr, hdrsize, 1)) { |
1193 | ring->current_slot = old_top_slot; | 1200 | ring->current_slot = old_top_slot; |
1194 | ring->used_slots = old_used_slots; | 1201 | ring->used_slots = old_used_slots; |
1195 | return -EIO; | 1202 | return -EIO; |
@@ -1208,7 +1215,7 @@ static int dma_tx_fragment(struct b43_dmaring *ring, | |||
1208 | 1215 | ||
1209 | meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); | 1216 | meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); |
1210 | /* create a bounce buffer in zone_dma on mapping failure. */ | 1217 | /* create a bounce buffer in zone_dma on mapping failure. */ |
1211 | if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len)) { | 1218 | if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { |
1212 | bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); | 1219 | bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); |
1213 | if (!bounce_skb) { | 1220 | if (!bounce_skb) { |
1214 | ring->current_slot = old_top_slot; | 1221 | ring->current_slot = old_top_slot; |
@@ -1222,7 +1229,7 @@ static int dma_tx_fragment(struct b43_dmaring *ring, | |||
1222 | skb = bounce_skb; | 1229 | skb = bounce_skb; |
1223 | meta->skb = skb; | 1230 | meta->skb = skb; |
1224 | meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); | 1231 | meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); |
1225 | if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len)) { | 1232 | if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { |
1226 | ring->current_slot = old_top_slot; | 1233 | ring->current_slot = old_top_slot; |
1227 | ring->used_slots = old_used_slots; | 1234 | ring->used_slots = old_used_slots; |
1228 | err = -EIO; | 1235 | err = -EIO; |
@@ -1337,6 +1344,7 @@ out_unlock: | |||
1337 | return err; | 1344 | return err; |
1338 | } | 1345 | } |
1339 | 1346 | ||
1347 | /* Called with IRQs disabled. */ | ||
1340 | void b43_dma_handle_txstatus(struct b43_wldev *dev, | 1348 | void b43_dma_handle_txstatus(struct b43_wldev *dev, |
1341 | const struct b43_txstatus *status) | 1349 | const struct b43_txstatus *status) |
1342 | { | 1350 | { |
@@ -1349,8 +1357,8 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1349 | ring = parse_cookie(dev, status->cookie, &slot); | 1357 | ring = parse_cookie(dev, status->cookie, &slot); |
1350 | if (unlikely(!ring)) | 1358 | if (unlikely(!ring)) |
1351 | return; | 1359 | return; |
1352 | B43_WARN_ON(!irqs_disabled()); | 1360 | |
1353 | spin_lock(&ring->lock); | 1361 | spin_lock(&ring->lock); /* IRQs are already disabled. */ |
1354 | 1362 | ||
1355 | B43_WARN_ON(!ring->tx); | 1363 | B43_WARN_ON(!ring->tx); |
1356 | ops = ring->ops; | 1364 | ops = ring->ops; |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 51dfce16178a..c73a75b24cd6 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -2049,7 +2049,6 @@ void b43_mac_enable(struct b43_wldev *dev) | |||
2049 | { | 2049 | { |
2050 | dev->mac_suspended--; | 2050 | dev->mac_suspended--; |
2051 | B43_WARN_ON(dev->mac_suspended < 0); | 2051 | B43_WARN_ON(dev->mac_suspended < 0); |
2052 | B43_WARN_ON(irqs_disabled()); | ||
2053 | if (dev->mac_suspended == 0) { | 2052 | if (dev->mac_suspended == 0) { |
2054 | b43_write32(dev, B43_MMIO_MACCTL, | 2053 | b43_write32(dev, B43_MMIO_MACCTL, |
2055 | b43_read32(dev, B43_MMIO_MACCTL) | 2054 | b43_read32(dev, B43_MMIO_MACCTL) |
@@ -2075,7 +2074,6 @@ void b43_mac_suspend(struct b43_wldev *dev) | |||
2075 | u32 tmp; | 2074 | u32 tmp; |
2076 | 2075 | ||
2077 | might_sleep(); | 2076 | might_sleep(); |
2078 | B43_WARN_ON(irqs_disabled()); | ||
2079 | B43_WARN_ON(dev->mac_suspended < 0); | 2077 | B43_WARN_ON(dev->mac_suspended < 0); |
2080 | 2078 | ||
2081 | if (dev->mac_suspended == 0) { | 2079 | if (dev->mac_suspended == 0) { |
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c index 71507b260b6d..575c5436ebdf 100644 --- a/drivers/net/wireless/b43/phy.c +++ b/drivers/net/wireless/b43/phy.c | |||
@@ -860,7 +860,7 @@ static void b43_phy_ww(struct b43_wldev *dev) | |||
860 | b43_phy_write(dev, B43_PHY_OFDM(0xBB), | 860 | b43_phy_write(dev, B43_PHY_OFDM(0xBB), |
861 | (b43_phy_read(dev, B43_PHY_OFDM(0xBB)) & 0xF000) | 0x0053); | 861 | (b43_phy_read(dev, B43_PHY_OFDM(0xBB)) & 0xF000) | 0x0053); |
862 | b43_phy_write(dev, B43_PHY_OFDM61, | 862 | b43_phy_write(dev, B43_PHY_OFDM61, |
863 | (b43_phy_read(dev, B43_PHY_OFDM61 & 0xFE1F)) | 0x0120); | 863 | (b43_phy_read(dev, B43_PHY_OFDM61) & 0xFE1F) | 0x0120); |
864 | b43_phy_write(dev, B43_PHY_OFDM(0x13), | 864 | b43_phy_write(dev, B43_PHY_OFDM(0x13), |
865 | (b43_phy_read(dev, B43_PHY_OFDM(0x13)) & 0x0FFF) | 0x3000); | 865 | (b43_phy_read(dev, B43_PHY_OFDM(0x13)) & 0x0FFF) | 0x3000); |
866 | b43_phy_write(dev, B43_PHY_OFDM(0x14), | 866 | b43_phy_write(dev, B43_PHY_OFDM(0x14), |
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index d1af938b9aa6..b79a35a40ab6 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -20,7 +20,7 @@ config IWL4965 | |||
20 | runs. | 20 | runs. |
21 | 21 | ||
22 | If you want to compile the driver as a module ( = code which can be | 22 | If you want to compile the driver as a module ( = code which can be |
23 | inserted in and remvoed from the running kernel whenever you want), | 23 | inserted in and removed from the running kernel whenever you want), |
24 | say M here and read <file:Documentation/kbuild/modules.txt>. The | 24 | say M here and read <file:Documentation/kbuild/modules.txt>. The |
25 | module will be called iwl4965.ko. | 25 | module will be called iwl4965.ko. |
26 | 26 | ||
@@ -101,7 +101,7 @@ config IWL3945 | |||
101 | runs. | 101 | runs. |
102 | 102 | ||
103 | If you want to compile the driver as a module ( = code which can be | 103 | If you want to compile the driver as a module ( = code which can be |
104 | inserted in and remvoed from the running kernel whenever you want), | 104 | inserted in and removed from the running kernel whenever you want), |
105 | say M here and read <file:Documentation/kbuild/modules.txt>. The | 105 | say M here and read <file:Documentation/kbuild/modules.txt>. The |
106 | module will be called iwl3945.ko. | 106 | module will be called iwl3945.ko. |
107 | 107 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 40b71bc2c4a4..cbaeaf186494 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -6206,11 +6206,11 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv) | |||
6206 | 6206 | ||
6207 | /* At this point, the NIC is initialized and operational */ | 6207 | /* At this point, the NIC is initialized and operational */ |
6208 | priv->notif_missed_beacons = 0; | 6208 | priv->notif_missed_beacons = 0; |
6209 | set_bit(STATUS_READY, &priv->status); | ||
6210 | 6209 | ||
6211 | iwl3945_reg_txpower_periodic(priv); | 6210 | iwl3945_reg_txpower_periodic(priv); |
6212 | 6211 | ||
6213 | IWL_DEBUG_INFO("ALIVE processing complete.\n"); | 6212 | IWL_DEBUG_INFO("ALIVE processing complete.\n"); |
6213 | set_bit(STATUS_READY, &priv->status); | ||
6214 | wake_up_interruptible(&priv->wait_command_queue); | 6214 | wake_up_interruptible(&priv->wait_command_queue); |
6215 | 6215 | ||
6216 | if (priv->error_recovering) | 6216 | if (priv->error_recovering) |
@@ -8706,7 +8706,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
8706 | return err; | 8706 | return err; |
8707 | } | 8707 | } |
8708 | 8708 | ||
8709 | static void iwl3945_pci_remove(struct pci_dev *pdev) | 8709 | static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) |
8710 | { | 8710 | { |
8711 | struct iwl3945_priv *priv = pci_get_drvdata(pdev); | 8711 | struct iwl3945_priv *priv = pci_get_drvdata(pdev); |
8712 | struct list_head *p, *q; | 8712 | struct list_head *p, *q; |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index a23d4798653b..60ec29eab85a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -6628,11 +6628,11 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv) | |||
6628 | 6628 | ||
6629 | /* At this point, the NIC is initialized and operational */ | 6629 | /* At this point, the NIC is initialized and operational */ |
6630 | priv->notif_missed_beacons = 0; | 6630 | priv->notif_missed_beacons = 0; |
6631 | set_bit(STATUS_READY, &priv->status); | ||
6632 | 6631 | ||
6633 | iwl4965_rf_kill_ct_config(priv); | 6632 | iwl4965_rf_kill_ct_config(priv); |
6634 | 6633 | ||
6635 | IWL_DEBUG_INFO("ALIVE processing complete.\n"); | 6634 | IWL_DEBUG_INFO("ALIVE processing complete.\n"); |
6635 | set_bit(STATUS_READY, &priv->status); | ||
6636 | wake_up_interruptible(&priv->wait_command_queue); | 6636 | wake_up_interruptible(&priv->wait_command_queue); |
6637 | 6637 | ||
6638 | if (priv->error_recovering) | 6638 | if (priv->error_recovering) |
@@ -9282,7 +9282,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
9282 | return err; | 9282 | return err; |
9283 | } | 9283 | } |
9284 | 9284 | ||
9285 | static void iwl4965_pci_remove(struct pci_dev *pdev) | 9285 | static void __devexit iwl4965_pci_remove(struct pci_dev *pdev) |
9286 | { | 9286 | { |
9287 | struct iwl4965_priv *priv = pci_get_drvdata(pdev); | 9287 | struct iwl4965_priv *priv = pci_get_drvdata(pdev); |
9288 | struct list_head *p, *q; | 9288 | struct list_head *p, *q; |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index bdc6a1cc2103..f0ef7081bdeb 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -578,7 +578,7 @@ int lbs_process_rx_command(struct lbs_private *priv) | |||
578 | goto done; | 578 | goto done; |
579 | } | 579 | } |
580 | if (respcmd != CMD_RET(curcmd) && | 580 | if (respcmd != CMD_RET(curcmd) && |
581 | respcmd != CMD_802_11_ASSOCIATE && curcmd != CMD_RET_802_11_ASSOCIATE) { | 581 | respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) { |
582 | lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd); | 582 | lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd); |
583 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 583 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
584 | ret = -1; | 584 | ret = -1; |
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c index e7d4aee8799e..98ddbb3b3273 100644 --- a/drivers/net/wireless/p54usb.c +++ b/drivers/net/wireless/p54usb.c | |||
@@ -63,6 +63,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
63 | {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */ | 63 | {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */ |
64 | {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */ | 64 | {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */ |
65 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ | 65 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ |
66 | {USB_DEVICE(0x124a, 0x4025)}, /* IOGear GWU513 (GW3887IK chip) */ | ||
66 | {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ | 67 | {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ |
67 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ | 68 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ |
68 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ | 69 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 05927b908f80..6c725422af5a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -620,6 +620,9 @@ struct rt2x00_dev { | |||
620 | * This will only be compiled in when required. | 620 | * This will only be compiled in when required. |
621 | */ | 621 | */ |
622 | #ifdef CONFIG_RT2X00_LIB_RFKILL | 622 | #ifdef CONFIG_RT2X00_LIB_RFKILL |
623 | unsigned long rfkill_state; | ||
624 | #define RFKILL_STATE_ALLOCATED 1 | ||
625 | #define RFKILL_STATE_REGISTERED 2 | ||
623 | struct rfkill *rfkill; | 626 | struct rfkill *rfkill; |
624 | struct input_polled_dev *poll_dev; | 627 | struct input_polled_dev *poll_dev; |
625 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | 628 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 0d51f478bcdf..bd305f7f3efd 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1098,7 +1098,7 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
1098 | return; | 1098 | return; |
1099 | 1099 | ||
1100 | /* | 1100 | /* |
1101 | * Unregister rfkill. | 1101 | * Unregister extra components. |
1102 | */ | 1102 | */ |
1103 | rt2x00rfkill_unregister(rt2x00dev); | 1103 | rt2x00rfkill_unregister(rt2x00dev); |
1104 | 1104 | ||
@@ -1139,17 +1139,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1139 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); | 1139 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); |
1140 | 1140 | ||
1141 | /* | 1141 | /* |
1142 | * Register the rfkill handler. | 1142 | * Register the extra components. |
1143 | */ | 1143 | */ |
1144 | status = rt2x00rfkill_register(rt2x00dev); | 1144 | rt2x00rfkill_register(rt2x00dev); |
1145 | if (status) | ||
1146 | goto exit_unitialize; | ||
1147 | 1145 | ||
1148 | return 0; | 1146 | return 0; |
1149 | 1147 | ||
1150 | exit_unitialize: | ||
1151 | rt2x00lib_uninitialize(rt2x00dev); | ||
1152 | |||
1153 | exit: | 1148 | exit: |
1154 | rt2x00lib_free_ring_entries(rt2x00dev); | 1149 | rt2x00lib_free_ring_entries(rt2x00dev); |
1155 | 1150 | ||
@@ -1313,15 +1308,9 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1313 | } | 1308 | } |
1314 | 1309 | ||
1315 | /* | 1310 | /* |
1316 | * Allocatie rfkill. | 1311 | * Register extra components. |
1317 | */ | ||
1318 | retval = rt2x00rfkill_allocate(rt2x00dev); | ||
1319 | if (retval) | ||
1320 | goto exit; | ||
1321 | |||
1322 | /* | ||
1323 | * Open the debugfs entry. | ||
1324 | */ | 1312 | */ |
1313 | rt2x00rfkill_allocate(rt2x00dev); | ||
1325 | rt2x00debug_register(rt2x00dev); | 1314 | rt2x00debug_register(rt2x00dev); |
1326 | 1315 | ||
1327 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1316 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); |
@@ -1350,13 +1339,9 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
1350 | rt2x00lib_uninitialize(rt2x00dev); | 1339 | rt2x00lib_uninitialize(rt2x00dev); |
1351 | 1340 | ||
1352 | /* | 1341 | /* |
1353 | * Close debugfs entry. | 1342 | * Free extra components |
1354 | */ | 1343 | */ |
1355 | rt2x00debug_deregister(rt2x00dev); | 1344 | rt2x00debug_deregister(rt2x00dev); |
1356 | |||
1357 | /* | ||
1358 | * Free rfkill | ||
1359 | */ | ||
1360 | rt2x00rfkill_free(rt2x00dev); | 1345 | rt2x00rfkill_free(rt2x00dev); |
1361 | 1346 | ||
1362 | /* | 1347 | /* |
@@ -1395,11 +1380,15 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) | |||
1395 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); | 1380 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); |
1396 | 1381 | ||
1397 | /* | 1382 | /* |
1398 | * Disable radio and unitialize all items | 1383 | * Disable radio. |
1399 | * that must be recreated on resume. | ||
1400 | */ | 1384 | */ |
1401 | rt2x00lib_stop(rt2x00dev); | 1385 | rt2x00lib_stop(rt2x00dev); |
1402 | rt2x00lib_uninitialize(rt2x00dev); | 1386 | rt2x00lib_uninitialize(rt2x00dev); |
1387 | |||
1388 | /* | ||
1389 | * Suspend/disable extra components. | ||
1390 | */ | ||
1391 | rt2x00rfkill_suspend(rt2x00dev); | ||
1403 | rt2x00debug_deregister(rt2x00dev); | 1392 | rt2x00debug_deregister(rt2x00dev); |
1404 | 1393 | ||
1405 | exit: | 1394 | exit: |
@@ -1422,9 +1411,10 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1422 | NOTICE(rt2x00dev, "Waking up.\n"); | 1411 | NOTICE(rt2x00dev, "Waking up.\n"); |
1423 | 1412 | ||
1424 | /* | 1413 | /* |
1425 | * Open the debugfs entry. | 1414 | * Restore/enable extra components. |
1426 | */ | 1415 | */ |
1427 | rt2x00debug_register(rt2x00dev); | 1416 | rt2x00debug_register(rt2x00dev); |
1417 | rt2x00rfkill_resume(rt2x00dev); | ||
1428 | 1418 | ||
1429 | /* | 1419 | /* |
1430 | * Only continue if mac80211 had open interfaces. | 1420 | * Only continue if mac80211 had open interfaces. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 1adbd28e0973..ce58c654ade1 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -100,28 +100,36 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
100 | * RFkill handlers. | 100 | * RFkill handlers. |
101 | */ | 101 | */ |
102 | #ifdef CONFIG_RT2X00_LIB_RFKILL | 102 | #ifdef CONFIG_RT2X00_LIB_RFKILL |
103 | int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); | 103 | void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); |
104 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); | 104 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); |
105 | int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); | 105 | void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); |
106 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); | 106 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); |
107 | void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev); | ||
108 | void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev); | ||
107 | #else | 109 | #else |
108 | static inline int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | 110 | static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) |
109 | { | 111 | { |
110 | return 0; | ||
111 | } | 112 | } |
112 | 113 | ||
113 | static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) | 114 | static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) |
114 | { | 115 | { |
115 | } | 116 | } |
116 | 117 | ||
117 | static inline int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | 118 | static inline void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) |
118 | { | 119 | { |
119 | return 0; | ||
120 | } | 120 | } |
121 | 121 | ||
122 | static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) | 122 | static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) |
123 | { | 123 | { |
124 | } | 124 | } |
125 | |||
126 | static inline void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev) | ||
127 | { | ||
128 | } | ||
129 | |||
130 | static inline void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev) | ||
131 | { | ||
132 | } | ||
125 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | 133 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ |
126 | 134 | ||
127 | #endif /* RT2X00LIB_H */ | 135 | #endif /* RT2X00LIB_H */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c index 34a96d44e306..f95577596206 100644 --- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c +++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c | |||
@@ -69,56 +69,81 @@ static void rt2x00rfkill_poll(struct input_polled_dev *poll_dev) | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | 72 | void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) |
73 | { | 73 | { |
74 | int retval; | 74 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || |
75 | 75 | !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state)) | |
76 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 76 | return; |
77 | return 0; | ||
78 | 77 | ||
79 | retval = rfkill_register(rt2x00dev->rfkill); | 78 | if (rfkill_register(rt2x00dev->rfkill)) { |
80 | if (retval) { | ||
81 | ERROR(rt2x00dev, "Failed to register rfkill handler.\n"); | 79 | ERROR(rt2x00dev, "Failed to register rfkill handler.\n"); |
82 | return retval; | 80 | return; |
83 | } | 81 | } |
84 | 82 | ||
85 | retval = input_register_polled_device(rt2x00dev->poll_dev); | 83 | if (input_register_polled_device(rt2x00dev->poll_dev)) { |
86 | if (retval) { | ||
87 | ERROR(rt2x00dev, "Failed to register polled device.\n"); | 84 | ERROR(rt2x00dev, "Failed to register polled device.\n"); |
88 | rfkill_unregister(rt2x00dev->rfkill); | 85 | rfkill_unregister(rt2x00dev->rfkill); |
89 | return retval; | 86 | return; |
90 | } | 87 | } |
91 | 88 | ||
89 | __set_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state); | ||
90 | |||
92 | /* | 91 | /* |
93 | * Force initial poll which will detect the initial device state, | 92 | * Force initial poll which will detect the initial device state, |
94 | * and correctly sends the signal to the rfkill layer about this | 93 | * and correctly sends the signal to the rfkill layer about this |
95 | * state. | 94 | * state. |
96 | */ | 95 | */ |
97 | rt2x00rfkill_poll(rt2x00dev->poll_dev); | 96 | rt2x00rfkill_poll(rt2x00dev->poll_dev); |
98 | |||
99 | return 0; | ||
100 | } | 97 | } |
101 | 98 | ||
102 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) | 99 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) |
103 | { | 100 | { |
104 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 101 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || |
102 | !test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state)) | ||
105 | return; | 103 | return; |
106 | 104 | ||
107 | input_unregister_polled_device(rt2x00dev->poll_dev); | 105 | input_unregister_polled_device(rt2x00dev->poll_dev); |
108 | rfkill_unregister(rt2x00dev->rfkill); | 106 | rfkill_unregister(rt2x00dev->rfkill); |
107 | |||
108 | __clear_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state); | ||
109 | } | 109 | } |
110 | 110 | ||
111 | int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | 111 | static struct input_polled_dev * |
112 | rt2x00rfkill_allocate_polldev(struct rt2x00_dev *rt2x00dev) | ||
112 | { | 113 | { |
113 | struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); | 114 | struct input_polled_dev *poll_dev; |
115 | |||
116 | poll_dev = input_allocate_polled_device(); | ||
117 | if (!poll_dev) | ||
118 | return NULL; | ||
119 | |||
120 | poll_dev->private = rt2x00dev; | ||
121 | poll_dev->poll = rt2x00rfkill_poll; | ||
122 | poll_dev->poll_interval = RFKILL_POLL_INTERVAL; | ||
123 | |||
124 | poll_dev->input->name = rt2x00dev->ops->name; | ||
125 | poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy); | ||
126 | poll_dev->input->id.bustype = BUS_HOST; | ||
127 | poll_dev->input->id.vendor = 0x1814; | ||
128 | poll_dev->input->id.product = rt2x00dev->chip.rt; | ||
129 | poll_dev->input->id.version = rt2x00dev->chip.rev; | ||
130 | poll_dev->input->dev.parent = wiphy_dev(rt2x00dev->hw->wiphy); | ||
131 | poll_dev->input->evbit[0] = BIT(EV_KEY); | ||
132 | set_bit(KEY_WLAN, poll_dev->input->keybit); | ||
133 | |||
134 | return poll_dev; | ||
135 | } | ||
114 | 136 | ||
137 | void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | ||
138 | { | ||
115 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 139 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) |
116 | return 0; | 140 | return; |
117 | 141 | ||
118 | rt2x00dev->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); | 142 | rt2x00dev->rfkill = |
143 | rfkill_allocate(wiphy_dev(rt2x00dev->hw->wiphy), RFKILL_TYPE_WLAN); | ||
119 | if (!rt2x00dev->rfkill) { | 144 | if (!rt2x00dev->rfkill) { |
120 | ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n"); | 145 | ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n"); |
121 | goto exit; | 146 | return; |
122 | } | 147 | } |
123 | 148 | ||
124 | rt2x00dev->rfkill->name = rt2x00dev->ops->name; | 149 | rt2x00dev->rfkill->name = rt2x00dev->ops->name; |
@@ -126,40 +151,49 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | |||
126 | rt2x00dev->rfkill->state = -1; | 151 | rt2x00dev->rfkill->state = -1; |
127 | rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio; | 152 | rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio; |
128 | 153 | ||
129 | rt2x00dev->poll_dev = input_allocate_polled_device(); | 154 | rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev); |
130 | if (!rt2x00dev->poll_dev) { | 155 | if (!rt2x00dev->poll_dev) { |
131 | ERROR(rt2x00dev, "Failed to allocate polled device.\n"); | 156 | ERROR(rt2x00dev, "Failed to allocate polled device.\n"); |
132 | goto exit_free_rfkill; | 157 | rfkill_free(rt2x00dev->rfkill); |
158 | rt2x00dev->rfkill = NULL; | ||
159 | return; | ||
133 | } | 160 | } |
134 | 161 | ||
135 | rt2x00dev->poll_dev->private = rt2x00dev; | 162 | return; |
136 | rt2x00dev->poll_dev->poll = rt2x00rfkill_poll; | 163 | } |
137 | rt2x00dev->poll_dev->poll_interval = RFKILL_POLL_INTERVAL; | ||
138 | 164 | ||
139 | rt2x00dev->poll_dev->input->name = rt2x00dev->ops->name; | 165 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) |
140 | rt2x00dev->poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy); | 166 | { |
141 | rt2x00dev->poll_dev->input->id.bustype = BUS_HOST; | 167 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || |
142 | rt2x00dev->poll_dev->input->id.vendor = 0x1814; | 168 | !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state)) |
143 | rt2x00dev->poll_dev->input->id.product = rt2x00dev->chip.rt; | 169 | return; |
144 | rt2x00dev->poll_dev->input->id.version = rt2x00dev->chip.rev; | ||
145 | rt2x00dev->poll_dev->input->dev.parent = device; | ||
146 | rt2x00dev->poll_dev->input->evbit[0] = BIT(EV_KEY); | ||
147 | set_bit(KEY_WLAN, rt2x00dev->poll_dev->input->keybit); | ||
148 | 170 | ||
149 | return 0; | 171 | input_free_polled_device(rt2x00dev->poll_dev); |
172 | rt2x00dev->poll_dev = NULL; | ||
150 | 173 | ||
151 | exit_free_rfkill: | ||
152 | rfkill_free(rt2x00dev->rfkill); | 174 | rfkill_free(rt2x00dev->rfkill); |
153 | 175 | rt2x00dev->rfkill = NULL; | |
154 | exit: | ||
155 | return -ENOMEM; | ||
156 | } | 176 | } |
157 | 177 | ||
158 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) | 178 | void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev) |
159 | { | 179 | { |
160 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 180 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || |
181 | !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state)) | ||
161 | return; | 182 | return; |
162 | 183 | ||
163 | input_free_polled_device(rt2x00dev->poll_dev); | 184 | input_free_polled_device(rt2x00dev->poll_dev); |
164 | rfkill_free(rt2x00dev->rfkill); | 185 | rt2x00dev->poll_dev = NULL; |
186 | } | ||
187 | |||
188 | void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev) | ||
189 | { | ||
190 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || | ||
191 | !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state)) | ||
192 | return; | ||
193 | |||
194 | rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev); | ||
195 | if (!rt2x00dev->poll_dev) { | ||
196 | ERROR(rt2x00dev, "Failed to allocate polled device.\n"); | ||
197 | return; | ||
198 | } | ||
165 | } | 199 | } |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index e808db98f2f5..93ea212fedd5 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2302,9 +2302,9 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw, | |||
2302 | * Apply some rules to the filters: | 2302 | * Apply some rules to the filters: |
2303 | * - Some filters imply different filters to be set. | 2303 | * - Some filters imply different filters to be set. |
2304 | * - Some things we can't filter out at all. | 2304 | * - Some things we can't filter out at all. |
2305 | * - Multicast filter seems to kill broadcast traffic so never use it. | ||
2305 | */ | 2306 | */ |
2306 | if (mc_count) | 2307 | *total_flags |= FIF_ALLMULTI; |
2307 | *total_flags |= FIF_ALLMULTI; | ||
2308 | if (*total_flags & FIF_OTHER_BSS || | 2308 | if (*total_flags & FIF_OTHER_BSS || |
2309 | *total_flags & FIF_PROMISC_IN_BSS) | 2309 | *total_flags & FIF_PROMISC_IN_BSS) |
2310 | *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; | 2310 | *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 4fac2d414d84..3909cf42f472 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1869,9 +1869,9 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw, | |||
1869 | * Apply some rules to the filters: | 1869 | * Apply some rules to the filters: |
1870 | * - Some filters imply different filters to be set. | 1870 | * - Some filters imply different filters to be set. |
1871 | * - Some things we can't filter out at all. | 1871 | * - Some things we can't filter out at all. |
1872 | * - Multicast filter seems to kill broadcast traffic so never use it. | ||
1872 | */ | 1873 | */ |
1873 | if (mc_count) | 1874 | *total_flags |= FIF_ALLMULTI; |
1874 | *total_flags |= FIF_ALLMULTI; | ||
1875 | if (*total_flags & FIF_OTHER_BSS || | 1875 | if (*total_flags & FIF_OTHER_BSS || |
1876 | *total_flags & FIF_PROMISC_IN_BSS) | 1876 | *total_flags & FIF_PROMISC_IN_BSS) |
1877 | *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; | 1877 | *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; |
@@ -2095,9 +2095,12 @@ static struct usb_device_id rt73usb_device_table[] = { | |||
2095 | { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, | 2095 | { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, |
2096 | /* Conceptronic */ | 2096 | /* Conceptronic */ |
2097 | { USB_DEVICE(0x14b2, 0x3c22), USB_DEVICE_DATA(&rt73usb_ops) }, | 2097 | { USB_DEVICE(0x14b2, 0x3c22), USB_DEVICE_DATA(&rt73usb_ops) }, |
2098 | /* Corega */ | ||
2099 | { USB_DEVICE(0x07aa, 0x002e), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
2098 | /* D-Link */ | 2100 | /* D-Link */ |
2099 | { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, | 2101 | { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, |
2100 | { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, | 2102 | { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, |
2103 | { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
2101 | /* Gemtek */ | 2104 | /* Gemtek */ |
2102 | { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, | 2105 | { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, |
2103 | /* Gigabyte */ | 2106 | /* Gigabyte */ |
diff --git a/drivers/net/wireless/wavelan_cs.h b/drivers/net/wireless/wavelan_cs.h index fabc63ee153c..2e4bfe4147c6 100644 --- a/drivers/net/wireless/wavelan_cs.h +++ b/drivers/net/wireless/wavelan_cs.h | |||
@@ -309,7 +309,7 @@ struct mmw_t | |||
309 | #define MMW_EXT_ANT_INTERNAL 0x00 /* Internal antenna */ | 309 | #define MMW_EXT_ANT_INTERNAL 0x00 /* Internal antenna */ |
310 | #define MMW_EXT_ANT_EXTERNAL 0x03 /* External antenna */ | 310 | #define MMW_EXT_ANT_EXTERNAL 0x03 /* External antenna */ |
311 | #define MMW_EXT_ANT_IQ_TEST 0x1C /* IQ test pattern (set to 0) */ | 311 | #define MMW_EXT_ANT_IQ_TEST 0x1C /* IQ test pattern (set to 0) */ |
312 | }; | 312 | } __attribute__((packed)); |
313 | 313 | ||
314 | /* Size for structure checking (if padding is correct) */ | 314 | /* Size for structure checking (if padding is correct) */ |
315 | #define MMW_SIZE 37 | 315 | #define MMW_SIZE 37 |
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index de34aa9d3136..f9f9a5f1bbd0 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c | |||
@@ -829,7 +829,7 @@ static ssize_t pdcs_autoboot_write(struct kobject *kobj, | |||
829 | struct kobj_attribute *attr, | 829 | struct kobj_attribute *attr, |
830 | const char *buf, size_t count) | 830 | const char *buf, size_t count) |
831 | { | 831 | { |
832 | return pdcs_auto_write(kset, attr, buf, count, PF_AUTOBOOT); | 832 | return pdcs_auto_write(kobj, attr, buf, count, PF_AUTOBOOT); |
833 | } | 833 | } |
834 | 834 | ||
835 | /** | 835 | /** |
@@ -845,7 +845,7 @@ static ssize_t pdcs_autosearch_write(struct kobject *kobj, | |||
845 | struct kobj_attribute *attr, | 845 | struct kobj_attribute *attr, |
846 | const char *buf, size_t count) | 846 | const char *buf, size_t count) |
847 | { | 847 | { |
848 | return pdcs_auto_write(kset, attr, buf, count, PF_AUTOSEARCH); | 848 | return pdcs_auto_write(kobj, attr, buf, count, PF_AUTOSEARCH); |
849 | } | 849 | } |
850 | 850 | ||
851 | /** | 851 | /** |
@@ -1066,7 +1066,7 @@ pdc_stable_init(void) | |||
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | /* Don't forget the root entries */ | 1068 | /* Don't forget the root entries */ |
1069 | error = sysfs_create_group(stable_kobj, pdcs_attr_group); | 1069 | error = sysfs_create_group(stable_kobj, &pdcs_attr_group); |
1070 | 1070 | ||
1071 | /* register the paths kset as a child of the stable kset */ | 1071 | /* register the paths kset as a child of the stable kset */ |
1072 | paths_kset = kset_create_and_add("paths", NULL, stable_kobj); | 1072 | paths_kset = kset_create_and_add("paths", NULL, stable_kobj); |
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index bdbe780e21c5..8c4d2c13d5f2 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
@@ -314,8 +314,8 @@ sba_dump_sg( struct ioc *ioc, struct scatterlist *startsg, int nents) | |||
314 | #define RESMAP_MASK(n) (~0UL << (BITS_PER_LONG - (n))) | 314 | #define RESMAP_MASK(n) (~0UL << (BITS_PER_LONG - (n))) |
315 | #define RESMAP_IDX_MASK (sizeof(unsigned long) - 1) | 315 | #define RESMAP_IDX_MASK (sizeof(unsigned long) - 1) |
316 | 316 | ||
317 | unsigned long ptr_to_pide(struct ioc *ioc, unsigned long *res_ptr, | 317 | static unsigned long ptr_to_pide(struct ioc *ioc, unsigned long *res_ptr, |
318 | unsigned int bitshiftcnt) | 318 | unsigned int bitshiftcnt) |
319 | { | 319 | { |
320 | return (((unsigned long)res_ptr - (unsigned long)ioc->res_map) << 3) | 320 | return (((unsigned long)res_ptr - (unsigned long)ioc->res_map) << 3) |
321 | + bitshiftcnt; | 321 | + bitshiftcnt; |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 6a9403d79e0c..d708358326e5 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -143,14 +143,18 @@ void pci_bus_add_devices(struct pci_bus *bus) | |||
143 | /* register the bus with sysfs as the parent is now | 143 | /* register the bus with sysfs as the parent is now |
144 | * properly registered. */ | 144 | * properly registered. */ |
145 | child_bus = dev->subordinate; | 145 | child_bus = dev->subordinate; |
146 | if (child_bus->is_added) | ||
147 | continue; | ||
146 | child_bus->dev.parent = child_bus->bridge; | 148 | child_bus->dev.parent = child_bus->bridge; |
147 | retval = device_register(&child_bus->dev); | 149 | retval = device_register(&child_bus->dev); |
148 | if (retval) | 150 | if (retval) |
149 | dev_err(&dev->dev, "Error registering pci_bus," | 151 | dev_err(&dev->dev, "Error registering pci_bus," |
150 | " continuing...\n"); | 152 | " continuing...\n"); |
151 | else | 153 | else { |
154 | child_bus->is_added = 1; | ||
152 | retval = device_create_file(&child_bus->dev, | 155 | retval = device_create_file(&child_bus->dev, |
153 | &dev_attr_cpuaffinity); | 156 | &dev_attr_cpuaffinity); |
157 | } | ||
154 | if (retval) | 158 | if (retval) |
155 | dev_err(&dev->dev, "Error creating cpuaffinity" | 159 | dev_err(&dev->dev, "Error creating cpuaffinity" |
156 | " file, continuing...\n"); | 160 | " file, continuing...\n"); |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 7f4836b8e71e..5fa4ba0d9934 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -467,7 +467,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
467 | t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); | 467 | t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); |
468 | 468 | ||
469 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ | 469 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ |
470 | if (value) { | 470 | if (value && pciehp_force) { |
471 | rc = pciehp_enable_slot(t_slot); | 471 | rc = pciehp_enable_slot(t_slot); |
472 | if (rc) /* -ENODEV: shouldn't happen, but deal with it */ | 472 | if (rc) /* -ENODEV: shouldn't happen, but deal with it */ |
473 | value = 0; | 473 | value = 0; |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 977d29b32295..4cb949f0ebd9 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -1097,6 +1097,8 @@ static void iommu_free_domain(struct dmar_domain *domain) | |||
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | static struct iova_domain reserved_iova_list; | 1099 | static struct iova_domain reserved_iova_list; |
1100 | static struct lock_class_key reserved_alloc_key; | ||
1101 | static struct lock_class_key reserved_rbtree_key; | ||
1100 | 1102 | ||
1101 | static void dmar_init_reserved_ranges(void) | 1103 | static void dmar_init_reserved_ranges(void) |
1102 | { | 1104 | { |
@@ -1107,6 +1109,11 @@ static void dmar_init_reserved_ranges(void) | |||
1107 | 1109 | ||
1108 | init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN); | 1110 | init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN); |
1109 | 1111 | ||
1112 | lockdep_set_class(&reserved_iova_list.iova_alloc_lock, | ||
1113 | &reserved_alloc_key); | ||
1114 | lockdep_set_class(&reserved_iova_list.iova_rbtree_lock, | ||
1115 | &reserved_rbtree_key); | ||
1116 | |||
1110 | /* IOAPIC ranges shouldn't be accessed by DMA */ | 1117 | /* IOAPIC ranges shouldn't be accessed by DMA */ |
1111 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), | 1118 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), |
1112 | IOVA_PFN(IOAPIC_RANGE_END)); | 1119 | IOVA_PFN(IOAPIC_RANGE_END)); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 4a23654184fc..72f7476930c8 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -272,21 +272,29 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
272 | { | 272 | { |
273 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | 273 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); |
274 | acpi_handle tmp; | 274 | acpi_handle tmp; |
275 | static int state_conv[] = { | 275 | static const u8 state_conv[] = { |
276 | [0] = 0, | 276 | [PCI_D0] = ACPI_STATE_D0, |
277 | [1] = 1, | 277 | [PCI_D1] = ACPI_STATE_D1, |
278 | [2] = 2, | 278 | [PCI_D2] = ACPI_STATE_D2, |
279 | [3] = 3, | 279 | [PCI_D3hot] = ACPI_STATE_D3, |
280 | [4] = 3 | 280 | [PCI_D3cold] = ACPI_STATE_D3 |
281 | }; | 281 | }; |
282 | int acpi_state = state_conv[(int __force) state]; | ||
283 | 282 | ||
284 | if (!handle) | 283 | if (!handle) |
285 | return -ENODEV; | 284 | return -ENODEV; |
286 | /* If the ACPI device has _EJ0, ignore the device */ | 285 | /* If the ACPI device has _EJ0, ignore the device */ |
287 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) | 286 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) |
288 | return 0; | 287 | return 0; |
289 | return acpi_bus_set_power(handle, acpi_state); | 288 | |
289 | switch (state) { | ||
290 | case PCI_D0: | ||
291 | case PCI_D1: | ||
292 | case PCI_D2: | ||
293 | case PCI_D3hot: | ||
294 | case PCI_D3cold: | ||
295 | return acpi_bus_set_power(handle, state_conv[state]); | ||
296 | } | ||
297 | return -EINVAL; | ||
290 | } | 298 | } |
291 | 299 | ||
292 | 300 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 183fddaa38b7..a4445b7210bf 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -314,24 +314,6 @@ int pci_find_ht_capability(struct pci_dev *dev, int ht_cap) | |||
314 | } | 314 | } |
315 | EXPORT_SYMBOL_GPL(pci_find_ht_capability); | 315 | EXPORT_SYMBOL_GPL(pci_find_ht_capability); |
316 | 316 | ||
317 | void pcie_wait_pending_transaction(struct pci_dev *dev) | ||
318 | { | ||
319 | int pos; | ||
320 | u16 reg16; | ||
321 | |||
322 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | ||
323 | if (!pos) | ||
324 | return; | ||
325 | while (1) { | ||
326 | pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, ®16); | ||
327 | if (!(reg16 & PCI_EXP_DEVSTA_TRPND)) | ||
328 | break; | ||
329 | cpu_relax(); | ||
330 | } | ||
331 | |||
332 | } | ||
333 | EXPORT_SYMBOL_GPL(pcie_wait_pending_transaction); | ||
334 | |||
335 | /** | 317 | /** |
336 | * pci_find_parent_resource - return resource region of parent bus of given region | 318 | * pci_find_parent_resource - return resource region of parent bus of given region |
337 | * @dev: PCI device structure contains resources to be searched | 319 | * @dev: PCI device structure contains resources to be searched |
@@ -936,9 +918,6 @@ pci_disable_device(struct pci_dev *dev) | |||
936 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) | 918 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) |
937 | return; | 919 | return; |
938 | 920 | ||
939 | /* Wait for all transactions are finished before disabling the device */ | ||
940 | pcie_wait_pending_transaction(dev); | ||
941 | |||
942 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); | 921 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); |
943 | if (pci_command & PCI_COMMAND_MASTER) { | 922 | if (pci_command & PCI_COMMAND_MASTER) { |
944 | pci_command &= ~PCI_COMMAND_MASTER; | 923 | pci_command &= ~PCI_COMMAND_MASTER; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index e9a333d98552..e887aa45c9cd 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -951,6 +951,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375, quirk_e | |||
951 | * accesses to the SMBus registers, with potentially bad effects. Thus you | 951 | * accesses to the SMBus registers, with potentially bad effects. Thus you |
952 | * should be very careful when adding new entries: if SMM is accessing the | 952 | * should be very careful when adding new entries: if SMM is accessing the |
953 | * Intel SMBus, this is a very good reason to leave it hidden. | 953 | * Intel SMBus, this is a very good reason to leave it hidden. |
954 | * | ||
955 | * Likewise, many recent laptops use ACPI for thermal management. If the | ||
956 | * ACPI DSDT code accesses the SMBus, then Linux should not access it | ||
957 | * natively, and keeping the SMBus hidden is the right thing to do. If you | ||
958 | * are about to add an entry in the table below, please first disassemble | ||
959 | * the DSDT and double-check that there is no code accessing the SMBus. | ||
954 | */ | 960 | */ |
955 | static int asus_hides_smbus; | 961 | static int asus_hides_smbus; |
956 | 962 | ||
@@ -1028,11 +1034,6 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
1028 | case 0x12bf: /* HP xw4100 */ | 1034 | case 0x12bf: /* HP xw4100 */ |
1029 | asus_hides_smbus = 1; | 1035 | asus_hides_smbus = 1; |
1030 | } | 1036 | } |
1031 | else if (dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB) | ||
1032 | switch (dev->subsystem_device) { | ||
1033 | case 0x099c: /* HP Compaq nx6110 */ | ||
1034 | asus_hides_smbus = 1; | ||
1035 | } | ||
1036 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { | 1037 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { |
1037 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | 1038 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) |
1038 | switch(dev->subsystem_device) { | 1039 | switch(dev->subsystem_device) { |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 125e7b7f34ff..f7cb8e0758b4 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -486,12 +486,7 @@ void __ref pci_bus_size_bridges(struct pci_bus *bus) | |||
486 | break; | 486 | break; |
487 | 487 | ||
488 | case PCI_CLASS_BRIDGE_PCI: | 488 | case PCI_CLASS_BRIDGE_PCI: |
489 | /* don't size subtractive decoding (transparent) | ||
490 | * PCI-to-PCI bridges */ | ||
491 | if (bus->self->transparent) | ||
492 | break; | ||
493 | pci_bridge_check_ranges(bus); | 489 | pci_bridge_check_ranges(bus); |
494 | /* fall through */ | ||
495 | default: | 490 | default: |
496 | pbus_size_io(bus); | 491 | pbus_size_io(bus); |
497 | /* If the bridge supports prefetchable range, size it | 492 | /* If the bridge supports prefetchable range, size it |
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 2c925b7cd93e..257f5d827d83 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -88,6 +88,15 @@ MODULE_LICENSE("GPL"); | |||
88 | #define _LTAG_MEM32RANGE 0x85 | 88 | #define _LTAG_MEM32RANGE 0x85 |
89 | #define _LTAG_FIXEDMEM32RANGE 0x86 | 89 | #define _LTAG_FIXEDMEM32RANGE 0x86 |
90 | 90 | ||
91 | /* | ||
92 | * Sizes of ISAPNP logical device configuration register sets. | ||
93 | * See PNP-ISA-v1.0a.pdf, Appendix A. | ||
94 | */ | ||
95 | #define ISAPNP_MAX_MEM 4 | ||
96 | #define ISAPNP_MAX_PORT 8 | ||
97 | #define ISAPNP_MAX_IRQ 2 | ||
98 | #define ISAPNP_MAX_DMA 2 | ||
99 | |||
91 | static unsigned char isapnp_checksum_value; | 100 | static unsigned char isapnp_checksum_value; |
92 | static DEFINE_MUTEX(isapnp_cfg_mutex); | 101 | static DEFINE_MUTEX(isapnp_cfg_mutex); |
93 | static int isapnp_csn_count; | 102 | static int isapnp_csn_count; |
@@ -945,14 +954,14 @@ static int isapnp_read_resources(struct pnp_dev *dev, | |||
945 | 954 | ||
946 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); | 955 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); |
947 | if (dev->active) { | 956 | if (dev->active) { |
948 | for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) { | 957 | for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) { |
949 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); | 958 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); |
950 | if (!ret) | 959 | if (!ret) |
951 | continue; | 960 | continue; |
952 | res->port_resource[tmp].start = ret; | 961 | res->port_resource[tmp].start = ret; |
953 | res->port_resource[tmp].flags = IORESOURCE_IO; | 962 | res->port_resource[tmp].flags = IORESOURCE_IO; |
954 | } | 963 | } |
955 | for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) { | 964 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { |
956 | ret = | 965 | ret = |
957 | isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; | 966 | isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; |
958 | if (!ret) | 967 | if (!ret) |
@@ -960,7 +969,7 @@ static int isapnp_read_resources(struct pnp_dev *dev, | |||
960 | res->mem_resource[tmp].start = ret; | 969 | res->mem_resource[tmp].start = ret; |
961 | res->mem_resource[tmp].flags = IORESOURCE_MEM; | 970 | res->mem_resource[tmp].flags = IORESOURCE_MEM; |
962 | } | 971 | } |
963 | for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) { | 972 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { |
964 | ret = | 973 | ret = |
965 | (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> | 974 | (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> |
966 | 8); | 975 | 8); |
@@ -970,7 +979,7 @@ static int isapnp_read_resources(struct pnp_dev *dev, | |||
970 | res->irq_resource[tmp].end = ret; | 979 | res->irq_resource[tmp].end = ret; |
971 | res->irq_resource[tmp].flags = IORESOURCE_IRQ; | 980 | res->irq_resource[tmp].flags = IORESOURCE_IRQ; |
972 | } | 981 | } |
973 | for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) { | 982 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { |
974 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); | 983 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); |
975 | if (ret == 4) | 984 | if (ret == 4) |
976 | continue; | 985 | continue; |
@@ -1002,14 +1011,14 @@ static int isapnp_set_resources(struct pnp_dev *dev, | |||
1002 | isapnp_cfg_begin(dev->card->number, dev->number); | 1011 | isapnp_cfg_begin(dev->card->number, dev->number); |
1003 | dev->active = 1; | 1012 | dev->active = 1; |
1004 | for (tmp = 0; | 1013 | for (tmp = 0; |
1005 | tmp < PNP_MAX_PORT | 1014 | tmp < ISAPNP_MAX_PORT |
1006 | && (res->port_resource[tmp]. | 1015 | && (res->port_resource[tmp]. |
1007 | flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; | 1016 | flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; |
1008 | tmp++) | 1017 | tmp++) |
1009 | isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), | 1018 | isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), |
1010 | res->port_resource[tmp].start); | 1019 | res->port_resource[tmp].start); |
1011 | for (tmp = 0; | 1020 | for (tmp = 0; |
1012 | tmp < PNP_MAX_IRQ | 1021 | tmp < ISAPNP_MAX_IRQ |
1013 | && (res->irq_resource[tmp]. | 1022 | && (res->irq_resource[tmp]. |
1014 | flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; | 1023 | flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; |
1015 | tmp++) { | 1024 | tmp++) { |
@@ -1019,14 +1028,14 @@ static int isapnp_set_resources(struct pnp_dev *dev, | |||
1019 | isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); | 1028 | isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); |
1020 | } | 1029 | } |
1021 | for (tmp = 0; | 1030 | for (tmp = 0; |
1022 | tmp < PNP_MAX_DMA | 1031 | tmp < ISAPNP_MAX_DMA |
1023 | && (res->dma_resource[tmp]. | 1032 | && (res->dma_resource[tmp]. |
1024 | flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; | 1033 | flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; |
1025 | tmp++) | 1034 | tmp++) |
1026 | isapnp_write_byte(ISAPNP_CFG_DMA + tmp, | 1035 | isapnp_write_byte(ISAPNP_CFG_DMA + tmp, |
1027 | res->dma_resource[tmp].start); | 1036 | res->dma_resource[tmp].start); |
1028 | for (tmp = 0; | 1037 | for (tmp = 0; |
1029 | tmp < PNP_MAX_MEM | 1038 | tmp < ISAPNP_MAX_MEM |
1030 | && (res->mem_resource[tmp]. | 1039 | && (res->mem_resource[tmp]. |
1031 | flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; | 1040 | flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; |
1032 | tmp++) | 1041 | tmp++) |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 6aa231ef642d..2dcd1960aca8 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -85,7 +85,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
85 | i < PNP_MAX_IRQ) | 85 | i < PNP_MAX_IRQ) |
86 | i++; | 86 | i++; |
87 | if (i >= PNP_MAX_IRQ && !warned) { | 87 | if (i >= PNP_MAX_IRQ && !warned) { |
88 | printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ " | 88 | printk(KERN_WARNING "pnpacpi: exceeded the max number of IRQ " |
89 | "resources: %d \n", PNP_MAX_IRQ); | 89 | "resources: %d \n", PNP_MAX_IRQ); |
90 | warned = 1; | 90 | warned = 1; |
91 | return; | 91 | return; |
@@ -187,7 +187,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, | |||
187 | res->dma_resource[i].start = dma; | 187 | res->dma_resource[i].start = dma; |
188 | res->dma_resource[i].end = dma; | 188 | res->dma_resource[i].end = dma; |
189 | } else if (!warned) { | 189 | } else if (!warned) { |
190 | printk(KERN_ERR "pnpacpi: exceeded the max number of DMA " | 190 | printk(KERN_WARNING "pnpacpi: exceeded the max number of DMA " |
191 | "resources: %d \n", PNP_MAX_DMA); | 191 | "resources: %d \n", PNP_MAX_DMA); |
192 | warned = 1; | 192 | warned = 1; |
193 | } | 193 | } |
@@ -213,7 +213,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
213 | res->port_resource[i].start = io; | 213 | res->port_resource[i].start = io; |
214 | res->port_resource[i].end = io + len - 1; | 214 | res->port_resource[i].end = io + len - 1; |
215 | } else if (!warned) { | 215 | } else if (!warned) { |
216 | printk(KERN_ERR "pnpacpi: exceeded the max number of IO " | 216 | printk(KERN_WARNING "pnpacpi: exceeded the max number of IO " |
217 | "resources: %d \n", PNP_MAX_PORT); | 217 | "resources: %d \n", PNP_MAX_PORT); |
218 | warned = 1; | 218 | warned = 1; |
219 | } | 219 | } |
@@ -241,7 +241,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, | |||
241 | res->mem_resource[i].start = mem; | 241 | res->mem_resource[i].start = mem; |
242 | res->mem_resource[i].end = mem + len - 1; | 242 | res->mem_resource[i].end = mem + len - 1; |
243 | } else if (!warned) { | 243 | } else if (!warned) { |
244 | printk(KERN_ERR "pnpacpi: exceeded the max number of mem " | 244 | printk(KERN_WARNING "pnpacpi: exceeded the max number of mem " |
245 | "resources: %d\n", PNP_MAX_MEM); | 245 | "resources: %d\n", PNP_MAX_MEM); |
246 | warned = 1; | 246 | warned = 1; |
247 | } | 247 | } |
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 4065139753b6..37993206ae5d 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/pnp.h> | 18 | #include <linux/pnp.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/dmi.h> | ||
21 | #include <linux/kallsyms.h> | 20 | #include <linux/kallsyms.h> |
22 | #include "base.h" | 21 | #include "base.h" |
23 | 22 | ||
@@ -109,42 +108,73 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev) | |||
109 | "pnp: SB audio device quirk - increasing port range\n"); | 108 | "pnp: SB audio device quirk - increasing port range\n"); |
110 | } | 109 | } |
111 | 110 | ||
112 | static void quirk_supermicro_h8dce_system(struct pnp_dev *dev) | 111 | |
112 | #include <linux/pci.h> | ||
113 | |||
114 | static void quirk_system_pci_resources(struct pnp_dev *dev) | ||
113 | { | 115 | { |
114 | int i; | 116 | struct pci_dev *pdev = NULL; |
115 | static struct dmi_system_id supermicro_h8dce[] = { | 117 | resource_size_t pnp_start, pnp_end, pci_start, pci_end; |
116 | { | 118 | int i, j; |
117 | .ident = "Supermicro H8DCE", | ||
118 | .matches = { | ||
119 | DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"), | ||
120 | DMI_MATCH(DMI_PRODUCT_NAME, "H8DCE"), | ||
121 | }, | ||
122 | }, | ||
123 | { } | ||
124 | }; | ||
125 | |||
126 | if (!dmi_check_system(supermicro_h8dce)) | ||
127 | return; | ||
128 | 119 | ||
129 | /* | 120 | /* |
130 | * On the Supermicro H8DCE, there's a system device with resources | 121 | * Some BIOSes have PNP motherboard devices with resources that |
131 | * that overlap BAR 6 of the built-in SATA PCI adapter. If the PNP | 122 | * partially overlap PCI BARs. The PNP system driver claims these |
132 | * system device claims them, the sata_nv driver won't be able to. | 123 | * motherboard resources, which prevents the normal PCI driver from |
133 | * More details at: | 124 | * requesting them later. |
134 | * https://bugzilla.redhat.com/show_bug.cgi?id=280641 | 125 | * |
135 | * https://bugzilla.redhat.com/show_bug.cgi?id=313491 | 126 | * This patch disables the PNP resources that conflict with PCI BARs |
136 | * http://lkml.org/lkml/2008/1/9/449 | 127 | * so they won't be claimed by the PNP system driver. |
137 | * http://thread.gmane.org/gmane.linux.acpi.devel/27312 | ||
138 | */ | 128 | */ |
139 | for (i = 0; i < PNP_MAX_MEM; i++) { | 129 | for_each_pci_dev(pdev) { |
140 | if (pnp_mem_valid(dev, i) && pnp_mem_len(dev, i) && | 130 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
141 | (pnp_mem_start(dev, i) & 0xdfef0000) == 0xdfef0000) { | 131 | if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM) || |
142 | dev_warn(&dev->dev, "disabling 0x%llx-0x%llx to prevent" | 132 | pci_resource_len(pdev, i) == 0) |
143 | " conflict with sata_nv PCI device\n", | 133 | continue; |
144 | (unsigned long long) pnp_mem_start(dev, i), | 134 | |
145 | (unsigned long long) (pnp_mem_start(dev, i) + | 135 | pci_start = pci_resource_start(pdev, i); |
146 | pnp_mem_len(dev, i) - 1)); | 136 | pci_end = pci_resource_end(pdev, i); |
147 | pnp_mem_flags(dev, i) = 0; | 137 | for (j = 0; j < PNP_MAX_MEM; j++) { |
138 | if (!pnp_mem_valid(dev, j) || | ||
139 | pnp_mem_len(dev, j) == 0) | ||
140 | continue; | ||
141 | |||
142 | pnp_start = pnp_mem_start(dev, j); | ||
143 | pnp_end = pnp_mem_end(dev, j); | ||
144 | |||
145 | /* | ||
146 | * If the PNP region doesn't overlap the PCI | ||
147 | * region at all, there's no problem. | ||
148 | */ | ||
149 | if (pnp_end < pci_start || pnp_start > pci_end) | ||
150 | continue; | ||
151 | |||
152 | /* | ||
153 | * If the PNP region completely encloses (or is | ||
154 | * at least as large as) the PCI region, that's | ||
155 | * also OK. For example, this happens when the | ||
156 | * PNP device describes a bridge with PCI | ||
157 | * behind it. | ||
158 | */ | ||
159 | if (pnp_start <= pci_start && | ||
160 | pnp_end >= pci_end) | ||
161 | continue; | ||
162 | |||
163 | /* | ||
164 | * Otherwise, the PNP region overlaps *part* of | ||
165 | * the PCI region, and that might prevent a PCI | ||
166 | * driver from requesting its resources. | ||
167 | */ | ||
168 | dev_warn(&dev->dev, "mem resource " | ||
169 | "(0x%llx-0x%llx) overlaps %s BAR %d " | ||
170 | "(0x%llx-0x%llx), disabling\n", | ||
171 | (unsigned long long) pnp_start, | ||
172 | (unsigned long long) pnp_end, | ||
173 | pci_name(pdev), i, | ||
174 | (unsigned long long) pci_start, | ||
175 | (unsigned long long) pci_end); | ||
176 | pnp_mem_flags(dev, j) = 0; | ||
177 | } | ||
148 | } | 178 | } |
149 | } | 179 | } |
150 | } | 180 | } |
@@ -169,8 +199,8 @@ static struct pnp_fixup pnp_fixups[] = { | |||
169 | {"CTL0043", quirk_sb16audio_resources}, | 199 | {"CTL0043", quirk_sb16audio_resources}, |
170 | {"CTL0044", quirk_sb16audio_resources}, | 200 | {"CTL0044", quirk_sb16audio_resources}, |
171 | {"CTL0045", quirk_sb16audio_resources}, | 201 | {"CTL0045", quirk_sb16audio_resources}, |
172 | {"PNP0c01", quirk_supermicro_h8dce_system}, | 202 | {"PNP0c01", quirk_system_pci_resources}, |
173 | {"PNP0c02", quirk_supermicro_h8dce_system}, | 203 | {"PNP0c02", quirk_system_pci_resources}, |
174 | {""} | 204 | {""} |
175 | }; | 205 | }; |
176 | 206 | ||
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 82f5ad9c3af4..9e7de63b26ef 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -16,7 +16,7 @@ menuconfig RTC_CLASS | |||
16 | probably want to enable one or more of the interfaces below. | 16 | probably want to enable one or more of the interfaces below. |
17 | 17 | ||
18 | This driver can also be built as a module. If so, the module | 18 | This driver can also be built as a module. If so, the module |
19 | will be called rtc-class. | 19 | will be called rtc-core. |
20 | 20 | ||
21 | if RTC_CLASS | 21 | if RTC_CLASS |
22 | 22 | ||
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index bbf10ecf416c..56728a2a3385 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -274,7 +274,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *_rtc) | |||
274 | * SR clears it, so we must only read it in this irq handler! | 274 | * SR clears it, so we must only read it in this irq handler! |
275 | */ | 275 | */ |
276 | mr = rtt_readl(rtc, MR) & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); | 276 | mr = rtt_readl(rtc, MR) & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); |
277 | sr = rtt_readl(rtc, SR) & mr; | 277 | sr = rtt_readl(rtc, SR) & (mr >> 16); |
278 | if (!sr) | 278 | if (!sr) |
279 | return IRQ_NONE; | 279 | return IRQ_NONE; |
280 | 280 | ||
@@ -321,6 +321,10 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
321 | if (!rtc) | 321 | if (!rtc) |
322 | return -ENOMEM; | 322 | return -ENOMEM; |
323 | 323 | ||
324 | /* platform setup code should have handled this; sigh */ | ||
325 | if (!device_can_wakeup(&pdev->dev)) | ||
326 | device_init_wakeup(&pdev->dev, 1); | ||
327 | |||
324 | platform_set_drvdata(pdev, rtc); | 328 | platform_set_drvdata(pdev, rtc); |
325 | rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS); | 329 | rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS); |
326 | rtc->rtt += r->start; | 330 | rtc->rtt += r->start; |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index c46666a24809..b9d374082b65 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -325,7 +325,7 @@ menuconfig SCSI_LOWLEVEL | |||
325 | depends on SCSI!=n | 325 | depends on SCSI!=n |
326 | default y | 326 | default y |
327 | 327 | ||
328 | if SCSI_LOWLEVEL | 328 | if SCSI_LOWLEVEL && SCSI |
329 | 329 | ||
330 | config ISCSI_TCP | 330 | config ISCSI_TCP |
331 | tristate "iSCSI Initiator over TCP/IP" | 331 | tristate "iSCSI Initiator over TCP/IP" |
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index f608d4a1d6da..792b2e807bf3 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c | |||
@@ -674,12 +674,13 @@ static struct orc_scb *__orc_alloc_scb(struct orc_host * host) | |||
674 | for (index = 0; index < 32; index++) { | 674 | for (index = 0; index < 32; index++) { |
675 | if ((host->allocation_map[channel][i] >> index) & 0x01) { | 675 | if ((host->allocation_map[channel][i] >> index) & 0x01) { |
676 | host->allocation_map[channel][i] &= ~(1 << index); | 676 | host->allocation_map[channel][i] &= ~(1 << index); |
677 | break; | 677 | idx = index + 32 * i; |
678 | /* | ||
679 | * Translate the index to a structure instance | ||
680 | */ | ||
681 | return host->scb_virt + idx; | ||
678 | } | 682 | } |
679 | } | 683 | } |
680 | idx = index + 32 * i; | ||
681 | /* Translate the index to a structure instance */ | ||
682 | return (struct orc_scb *) ((unsigned long) host->scb_virt + (idx * sizeof(struct orc_scb))); | ||
683 | } | 684 | } |
684 | return NULL; | 685 | return NULL; |
685 | } | 686 | } |
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 3c2d6888bb8c..8591585e5cc5 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -6439,7 +6439,7 @@ static int AdvLoadMicrocode(AdvPortAddr iop_base, unsigned char *buf, int size, | |||
6439 | i += 2; | 6439 | i += 2; |
6440 | len += 2; | 6440 | len += 2; |
6441 | } else { | 6441 | } else { |
6442 | unsigned char off = buf[i] * 2; | 6442 | unsigned int off = buf[i] * 2; |
6443 | unsigned short word = (buf[off + 1] << 8) | buf[off]; | 6443 | unsigned short word = (buf[off + 1] << 8) | buf[off]; |
6444 | AdvWriteWordAutoIncLram(iop_base, word); | 6444 | AdvWriteWordAutoIncLram(iop_base, word); |
6445 | len += 2; | 6445 | len += 2; |
diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h index 0393707bdfce..3288be2e49f8 100644 --- a/drivers/scsi/arcmsr/arcmsr.h +++ b/drivers/scsi/arcmsr/arcmsr.h | |||
@@ -341,13 +341,13 @@ struct MessageUnit_B | |||
341 | uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE]; | 341 | uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE]; |
342 | uint32_t postq_index; | 342 | uint32_t postq_index; |
343 | uint32_t doneq_index; | 343 | uint32_t doneq_index; |
344 | uint32_t __iomem *drv2iop_doorbell_reg; | 344 | void __iomem *drv2iop_doorbell_reg; |
345 | uint32_t __iomem *drv2iop_doorbell_mask_reg; | 345 | void __iomem *drv2iop_doorbell_mask_reg; |
346 | uint32_t __iomem *iop2drv_doorbell_reg; | 346 | void __iomem *iop2drv_doorbell_reg; |
347 | uint32_t __iomem *iop2drv_doorbell_mask_reg; | 347 | void __iomem *iop2drv_doorbell_mask_reg; |
348 | uint32_t __iomem *msgcode_rwbuffer_reg; | 348 | void __iomem *msgcode_rwbuffer_reg; |
349 | uint32_t __iomem *ioctl_wbuffer_reg; | 349 | void __iomem *ioctl_wbuffer_reg; |
350 | uint32_t __iomem *ioctl_rbuffer_reg; | 350 | void __iomem *ioctl_rbuffer_reg; |
351 | }; | 351 | }; |
352 | 352 | ||
353 | /* | 353 | /* |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 27ebd336409b..0b2080d33575 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -493,6 +493,12 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, | |||
493 | if (!scp) | 493 | if (!scp) |
494 | return -ENOMEM; | 494 | return -ENOMEM; |
495 | 495 | ||
496 | scp->sense_buffer = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); | ||
497 | if (!scp->sense_buffer) { | ||
498 | kfree(scp); | ||
499 | return -ENOMEM; | ||
500 | } | ||
501 | |||
496 | scp->device = sdev; | 502 | scp->device = sdev; |
497 | memset(&cmndinfo, 0, sizeof(cmndinfo)); | 503 | memset(&cmndinfo, 0, sizeof(cmndinfo)); |
498 | 504 | ||
@@ -513,6 +519,7 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, | |||
513 | rval = cmndinfo.status; | 519 | rval = cmndinfo.status; |
514 | if (info) | 520 | if (info) |
515 | *info = cmndinfo.info; | 521 | *info = cmndinfo.info; |
522 | kfree(scp->sense_buffer); | ||
516 | kfree(scp); | 523 | kfree(scp); |
517 | return rval; | 524 | return rval; |
518 | } | 525 | } |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ba21d97d1855..f40898dc2d14 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -2162,10 +2162,15 @@ void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt) | |||
2162 | { | 2162 | { |
2163 | unsigned long flags; | 2163 | unsigned long flags; |
2164 | 2164 | ||
2165 | #if 0 | ||
2166 | /* FIXME: currently this check eliminates all media change events | ||
2167 | * for polled devices. Need to update to discriminate between AN | ||
2168 | * and polled events */ | ||
2165 | if (!test_bit(evt->evt_type, sdev->supported_events)) { | 2169 | if (!test_bit(evt->evt_type, sdev->supported_events)) { |
2166 | kfree(evt); | 2170 | kfree(evt); |
2167 | return; | 2171 | return; |
2168 | } | 2172 | } |
2173 | #endif | ||
2169 | 2174 | ||
2170 | spin_lock_irqsave(&sdev->list_lock, flags); | 2175 | spin_lock_irqsave(&sdev->list_lock, flags); |
2171 | list_add_tail(&evt->node, &sdev->event_list); | 2176 | list_add_tail(&evt->node, &sdev->event_list); |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index ed83cdb6e67d..b9b09a704584 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -294,6 +294,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) | |||
294 | } | 294 | } |
295 | 295 | ||
296 | if (sdev->request_queue) { | 296 | if (sdev->request_queue) { |
297 | bsg_unregister_queue(sdev->request_queue); | ||
297 | sdev->request_queue->queuedata = NULL; | 298 | sdev->request_queue->queuedata = NULL; |
298 | /* user context needed to free queue */ | 299 | /* user context needed to free queue */ |
299 | scsi_free_queue(sdev->request_queue); | 300 | scsi_free_queue(sdev->request_queue); |
@@ -857,7 +858,6 @@ void __scsi_remove_device(struct scsi_device *sdev) | |||
857 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) | 858 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) |
858 | return; | 859 | return; |
859 | 860 | ||
860 | bsg_unregister_queue(sdev->request_queue); | ||
861 | class_device_unregister(&sdev->sdev_classdev); | 861 | class_device_unregister(&sdev->sdev_classdev); |
862 | transport_remove_device(dev); | 862 | transport_remove_device(dev); |
863 | device_del(dev); | 863 | device_del(dev); |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7aee64dbfbeb..5fe7aaed904c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1654,6 +1654,7 @@ static int sd_probe(struct device *dev) | |||
1654 | sdkp->disk = gd; | 1654 | sdkp->disk = gd; |
1655 | sdkp->index = index; | 1655 | sdkp->index = index; |
1656 | sdkp->openers = 0; | 1656 | sdkp->openers = 0; |
1657 | sdkp->previous_state = 1; | ||
1657 | 1658 | ||
1658 | if (!sdp->timeout) { | 1659 | if (!sdp->timeout) { |
1659 | if (sdp->type != TYPE_MOD) | 1660 | if (sdp->type != TYPE_MOD) |
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 208565bdbe8e..7ee86d4a7618 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -623,6 +623,7 @@ static int sr_probe(struct device *dev) | |||
623 | cd->disk = disk; | 623 | cd->disk = disk; |
624 | cd->capacity = 0x1fffff; | 624 | cd->capacity = 0x1fffff; |
625 | cd->device->changed = 1; /* force recheck CD type */ | 625 | cd->device->changed = 1; /* force recheck CD type */ |
626 | cd->previous_state = 1; | ||
626 | cd->use = 1; | 627 | cd->use = 1; |
627 | cd->readcd_known = 0; | 628 | cd->readcd_known = 0; |
628 | cd->readcd_cdda = 0; | 629 | cd->readcd_cdda = 0; |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index a8bec498cad6..f97224ce59da 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -1214,13 +1214,6 @@ static struct pciserial_board pci_boards[] __devinitdata = { | |||
1214 | .base_baud = 115200, | 1214 | .base_baud = 115200, |
1215 | .uart_offset = 8, | 1215 | .uart_offset = 8, |
1216 | }, | 1216 | }, |
1217 | [pbn_b0_8_115200] = { | ||
1218 | .flags = FL_BASE0, | ||
1219 | .num_ports = 8, | ||
1220 | .base_baud = 115200, | ||
1221 | .uart_offset = 8, | ||
1222 | }, | ||
1223 | |||
1224 | [pbn_b0_1_921600] = { | 1217 | [pbn_b0_1_921600] = { |
1225 | .flags = FL_BASE0, | 1218 | .flags = FL_BASE0, |
1226 | .num_ports = 1, | 1219 | .num_ports = 1, |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index a8c116b80bff..9d244d1644e1 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -414,12 +414,12 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | |||
414 | defined(CONFIG_CPU_SUBTYPE_SH7785) | 414 | defined(CONFIG_CPU_SUBTYPE_SH7785) |
415 | static inline int scif_txroom(struct uart_port *port) | 415 | static inline int scif_txroom(struct uart_port *port) |
416 | { | 416 | { |
417 | return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0x7f); | 417 | return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0xff); |
418 | } | 418 | } |
419 | 419 | ||
420 | static inline int scif_rxroom(struct uart_port *port) | 420 | static inline int scif_rxroom(struct uart_port *port) |
421 | { | 421 | { |
422 | return sci_in(port, SCRFDR) & 0x7f; | 422 | return sci_in(port, SCRFDR) & 0xff; |
423 | } | 423 | } |
424 | #else | 424 | #else |
425 | static inline int scif_txroom(struct uart_port *port) | 425 | static inline int scif_txroom(struct uart_port *port) |
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c index 29fcd6d0301d..a0aa33dde0a4 100644 --- a/drivers/sn/ioc3.c +++ b/drivers/sn/ioc3.c | |||
@@ -561,7 +561,7 @@ void ioc3_unregister_submodule(struct ioc3_submodule *is) | |||
561 | printk(KERN_WARNING | 561 | printk(KERN_WARNING |
562 | "%s: IOC3 submodule %s remove failed " | 562 | "%s: IOC3 submodule %s remove failed " |
563 | "for pci_dev %s.\n", | 563 | "for pci_dev %s.\n", |
564 | __FUNCTION__, module_name(is->owner), | 564 | __func__, module_name(is->owner), |
565 | pci_name(idd->pdev)); | 565 | pci_name(idd->pdev)); |
566 | idd->active[is->id] = 0; | 566 | idd->active[is->id] = 0; |
567 | if(is->irq_mask) | 567 | if(is->irq_mask) |
@@ -611,7 +611,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
611 | if ((ret = pci_enable_device(pdev))) { | 611 | if ((ret = pci_enable_device(pdev))) { |
612 | printk(KERN_WARNING | 612 | printk(KERN_WARNING |
613 | "%s: Failed to enable IOC3 device for pci_dev %s.\n", | 613 | "%s: Failed to enable IOC3 device for pci_dev %s.\n", |
614 | __FUNCTION__, pci_name(pdev)); | 614 | __func__, pci_name(pdev)); |
615 | goto out; | 615 | goto out; |
616 | } | 616 | } |
617 | pci_set_master(pdev); | 617 | pci_set_master(pdev); |
@@ -623,7 +623,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
623 | if (ret < 0) { | 623 | if (ret < 0) { |
624 | printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA " | 624 | printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA " |
625 | "for consistent allocations\n", | 625 | "for consistent allocations\n", |
626 | __FUNCTION__); | 626 | __func__); |
627 | } | 627 | } |
628 | } | 628 | } |
629 | #endif | 629 | #endif |
@@ -633,7 +633,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
633 | if (!idd) { | 633 | if (!idd) { |
634 | printk(KERN_WARNING | 634 | printk(KERN_WARNING |
635 | "%s: Failed to allocate IOC3 data for pci_dev %s.\n", | 635 | "%s: Failed to allocate IOC3 data for pci_dev %s.\n", |
636 | __FUNCTION__, pci_name(pdev)); | 636 | __func__, pci_name(pdev)); |
637 | ret = -ENODEV; | 637 | ret = -ENODEV; |
638 | goto out_idd; | 638 | goto out_idd; |
639 | } | 639 | } |
@@ -649,7 +649,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
649 | printk(KERN_WARNING | 649 | printk(KERN_WARNING |
650 | "%s: Unable to find IOC3 resource " | 650 | "%s: Unable to find IOC3 resource " |
651 | "for pci_dev %s.\n", | 651 | "for pci_dev %s.\n", |
652 | __FUNCTION__, pci_name(pdev)); | 652 | __func__, pci_name(pdev)); |
653 | ret = -ENODEV; | 653 | ret = -ENODEV; |
654 | goto out_pci; | 654 | goto out_pci; |
655 | } | 655 | } |
@@ -657,7 +657,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
657 | printk(KERN_WARNING | 657 | printk(KERN_WARNING |
658 | "%s: Unable to request IOC3 region " | 658 | "%s: Unable to request IOC3 region " |
659 | "for pci_dev %s.\n", | 659 | "for pci_dev %s.\n", |
660 | __FUNCTION__, pci_name(pdev)); | 660 | __func__, pci_name(pdev)); |
661 | ret = -ENODEV; | 661 | ret = -ENODEV; |
662 | goto out_pci; | 662 | goto out_pci; |
663 | } | 663 | } |
@@ -666,7 +666,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
666 | printk(KERN_WARNING | 666 | printk(KERN_WARNING |
667 | "%s: Unable to remap IOC3 region " | 667 | "%s: Unable to remap IOC3 region " |
668 | "for pci_dev %s.\n", | 668 | "for pci_dev %s.\n", |
669 | __FUNCTION__, pci_name(pdev)); | 669 | __func__, pci_name(pdev)); |
670 | ret = -ENODEV; | 670 | ret = -ENODEV; |
671 | goto out_misc_region; | 671 | goto out_misc_region; |
672 | } | 672 | } |
@@ -709,7 +709,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
709 | } else { | 709 | } else { |
710 | printk(KERN_WARNING | 710 | printk(KERN_WARNING |
711 | "%s : request_irq fails for IRQ 0x%x\n ", | 711 | "%s : request_irq fails for IRQ 0x%x\n ", |
712 | __FUNCTION__, pdev->irq); | 712 | __func__, pdev->irq); |
713 | } | 713 | } |
714 | if (!request_irq(pdev->irq+2, ioc3_intr_io, IRQF_SHARED, | 714 | if (!request_irq(pdev->irq+2, ioc3_intr_io, IRQF_SHARED, |
715 | "ioc3-io", (void *)idd)) { | 715 | "ioc3-io", (void *)idd)) { |
@@ -717,7 +717,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
717 | } else { | 717 | } else { |
718 | printk(KERN_WARNING | 718 | printk(KERN_WARNING |
719 | "%s : request_irq fails for IRQ 0x%x\n ", | 719 | "%s : request_irq fails for IRQ 0x%x\n ", |
720 | __FUNCTION__, pdev->irq+2); | 720 | __func__, pdev->irq+2); |
721 | } | 721 | } |
722 | } else { | 722 | } else { |
723 | if (!request_irq(pdev->irq, ioc3_intr_io, IRQF_SHARED, | 723 | if (!request_irq(pdev->irq, ioc3_intr_io, IRQF_SHARED, |
@@ -726,7 +726,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
726 | } else { | 726 | } else { |
727 | printk(KERN_WARNING | 727 | printk(KERN_WARNING |
728 | "%s : request_irq fails for IRQ 0x%x\n ", | 728 | "%s : request_irq fails for IRQ 0x%x\n ", |
729 | __FUNCTION__, pdev->irq); | 729 | __func__, pdev->irq); |
730 | } | 730 | } |
731 | } | 731 | } |
732 | 732 | ||
@@ -769,7 +769,7 @@ static void ioc3_remove(struct pci_dev *pdev) | |||
769 | printk(KERN_WARNING | 769 | printk(KERN_WARNING |
770 | "%s: IOC3 submodule 0x%s remove failed " | 770 | "%s: IOC3 submodule 0x%s remove failed " |
771 | "for pci_dev %s.\n", | 771 | "for pci_dev %s.\n", |
772 | __FUNCTION__, | 772 | __func__, |
773 | module_name(ioc3_submodules[id]->owner), | 773 | module_name(ioc3_submodules[id]->owner), |
774 | pci_name(pdev)); | 774 | pci_name(pdev)); |
775 | idd->active[id] = 0; | 775 | idd->active[id] = 0; |
diff --git a/drivers/spi/au1550_spi.c b/drivers/spi/au1550_spi.c index c47a650183a1..41a3d00c4515 100644 --- a/drivers/spi/au1550_spi.c +++ b/drivers/spi/au1550_spi.c | |||
@@ -99,7 +99,7 @@ static dbdev_tab_t au1550_spi_mem_dbdev = | |||
99 | static void au1550_spi_bits_handlers_set(struct au1550_spi *hw, int bpw); | 99 | static void au1550_spi_bits_handlers_set(struct au1550_spi *hw, int bpw); |
100 | 100 | ||
101 | 101 | ||
102 | /** | 102 | /* |
103 | * compute BRG and DIV bits to setup spi clock based on main input clock rate | 103 | * compute BRG and DIV bits to setup spi clock based on main input clock rate |
104 | * that was specified in platform data structure | 104 | * that was specified in platform data structure |
105 | * according to au1550 datasheet: | 105 | * according to au1550 datasheet: |
@@ -650,7 +650,7 @@ static int au1550_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
650 | return hw->txrx_bufs(spi, t); | 650 | return hw->txrx_bufs(spi, t); |
651 | } | 651 | } |
652 | 652 | ||
653 | static irqreturn_t au1550_spi_irq(int irq, void *dev, struct pt_regs *regs) | 653 | static irqreturn_t au1550_spi_irq(int irq, void *dev) |
654 | { | 654 | { |
655 | struct au1550_spi *hw = dev; | 655 | struct au1550_spi *hw = dev; |
656 | return hw->irq_callback(hw); | 656 | return hw->irq_callback(hw); |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index f7f8580edad8..71e881419cdd 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -344,12 +344,14 @@ static void bitbang_work(struct work_struct *work) | |||
344 | t->rx_dma = t->tx_dma = 0; | 344 | t->rx_dma = t->tx_dma = 0; |
345 | status = bitbang->txrx_bufs(spi, t); | 345 | status = bitbang->txrx_bufs(spi, t); |
346 | } | 346 | } |
347 | if (status > 0) | ||
348 | m->actual_length += status; | ||
347 | if (status != t->len) { | 349 | if (status != t->len) { |
348 | if (status > 0) | 350 | /* always report some kind of error */ |
349 | status = -EMSGSIZE; | 351 | if (status >= 0) |
352 | status = -EREMOTEIO; | ||
350 | break; | 353 | break; |
351 | } | 354 | } |
352 | m->actual_length += status; | ||
353 | status = 0; | 355 | status = 0; |
354 | 356 | ||
355 | /* protocol tweaks before next transfer */ | 357 | /* protocol tweaks before next transfer */ |
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 69f19f224875..17e71d56f31e 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | menuconfig THERMAL | 5 | menuconfig THERMAL |
6 | bool "Generic Thermal sysfs driver" | 6 | bool "Generic Thermal sysfs driver" |
7 | default y | ||
8 | help | 7 | help |
9 | Generic Thermal Sysfs driver offers a generic mechanism for | 8 | Generic Thermal Sysfs driver offers a generic mechanism for |
10 | thermal management. Usually it's made up of one or more thermal | 9 | thermal management. Usually it's made up of one or more thermal |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index e8a01f264540..11759080ca54 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -470,6 +470,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
470 | 470 | ||
471 | vma->vm_flags |= VM_IO | VM_RESERVED; | 471 | vma->vm_flags |= VM_IO | VM_RESERVED; |
472 | 472 | ||
473 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
474 | |||
473 | return remap_pfn_range(vma, | 475 | return remap_pfn_range(vma, |
474 | vma->vm_start, | 476 | vma->vm_start, |
475 | idev->info->mem[mi].addr >> PAGE_SHIFT, | 477 | idev->info->mem[mi].addr >> PAGE_SHIFT, |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index fefb92296e8f..c311f67b7f08 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1206,7 +1206,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1206 | return -EINVAL; | 1206 | return -EINVAL; |
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 1209 | if (dev->quirks & USB_QUIRK_NO_SET_INTF) |
1210 | ret = -EPIPE; | ||
1211 | else | ||
1212 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | ||
1210 | USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, | 1213 | USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, |
1211 | alternate, interface, NULL, 0, 5000); | 1214 | alternate, interface, NULL, 0, 5000); |
1212 | 1215 | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index d9d1eb19f2a1..dfc5418ea10c 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -50,6 +50,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
50 | /* M-Systems Flash Disk Pioneers */ | 50 | /* M-Systems Flash Disk Pioneers */ |
51 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, | 51 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, |
52 | 52 | ||
53 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ | ||
54 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, | ||
55 | |||
53 | /* Action Semiconductor flash disk */ | 56 | /* Action Semiconductor flash disk */ |
54 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = | 57 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = |
55 | USB_QUIRK_STRING_FETCH_255 }, | 58 | USB_QUIRK_STRING_FETCH_255 }, |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 805602a687cb..0a6feafc8d28 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1458,7 +1458,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1458 | /* currently one config, two speeds */ | 1458 | /* currently one config, two speeds */ |
1459 | case USB_REQ_SET_CONFIGURATION: | 1459 | case USB_REQ_SET_CONFIGURATION: |
1460 | if (ctrl->bRequestType != 0) | 1460 | if (ctrl->bRequestType != 0) |
1461 | break; | 1461 | goto unrecognized; |
1462 | if (0 == (u8) w_value) { | 1462 | if (0 == (u8) w_value) { |
1463 | value = 0; | 1463 | value = 0; |
1464 | dev->current_config = 0; | 1464 | dev->current_config = 0; |
@@ -1505,7 +1505,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1505 | /* PXA automagically handles this request too */ | 1505 | /* PXA automagically handles this request too */ |
1506 | case USB_REQ_GET_CONFIGURATION: | 1506 | case USB_REQ_GET_CONFIGURATION: |
1507 | if (ctrl->bRequestType != 0x80) | 1507 | if (ctrl->bRequestType != 0x80) |
1508 | break; | 1508 | goto unrecognized; |
1509 | *(u8 *)req->buf = dev->current_config; | 1509 | *(u8 *)req->buf = dev->current_config; |
1510 | value = min (w_length, (u16) 1); | 1510 | value = min (w_length, (u16) 1); |
1511 | break; | 1511 | break; |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 3ba01664f821..72ccd56e36dd 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -152,6 +152,20 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | break; | 154 | break; |
155 | case PCI_VENDOR_ID_VIA: | ||
156 | if (pdev->device == 0x3104 && (pdev->revision & 0xf0) == 0x60) { | ||
157 | u8 tmp; | ||
158 | |||
159 | /* The VT6212 defaults to a 1 usec EHCI sleep time which | ||
160 | * hogs the PCI bus *badly*. Setting bit 5 of 0x4B makes | ||
161 | * that sleep time use the conventional 10 usec. | ||
162 | */ | ||
163 | pci_read_config_byte(pdev, 0x4b, &tmp); | ||
164 | if (tmp & 0x20) | ||
165 | break; | ||
166 | pci_write_config_byte(pdev, 0x4b, tmp | 0x20); | ||
167 | } | ||
168 | break; | ||
155 | } | 169 | } |
156 | 170 | ||
157 | ehci_reset(ehci); | 171 | ehci_reset(ehci); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index ae3ec1a64008..2af778555bdc 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -55,6 +55,7 @@ static struct usb_device_id id_table [] = { | |||
55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, | 55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, |
56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, | 56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, |
57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, | 57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, |
58 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, | ||
58 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 59 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
59 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 60 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
60 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 61 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 237a41f6638a..10cf872e5ecb 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define PL2303_PRODUCT_ID_DCU11 0x1234 | 13 | #define PL2303_PRODUCT_ID_DCU11 0x1234 |
14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 | 14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 |
15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 | 15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 |
16 | #define PL2303_PRODUCT_ID_ALDIGA 0x0611 | ||
16 | 17 | ||
17 | #define ATEN_VENDOR_ID 0x0557 | 18 | #define ATEN_VENDOR_ID 0x0557 |
18 | #define ATEN_VENDOR_ID2 0x0547 | 19 | #define ATEN_VENDOR_ID2 0x0547 |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index e3d44ae8d448..ed678811e6a6 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -14,7 +14,7 @@ | |||
14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> | 14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define DRIVER_VERSION "v.1.2.7" | 17 | #define DRIVER_VERSION "v.1.2.8" |
18 | #define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>" | 18 | #define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>" |
19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" | 19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" |
20 | 20 | ||
@@ -163,6 +163,7 @@ static struct usb_device_id id_table [] = { | |||
163 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ | 163 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ |
164 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ | 164 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ |
165 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */ | 165 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */ |
166 | { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */ | ||
166 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ | 167 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ |
167 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ | 168 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ |
168 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ | 169 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ |
@@ -196,9 +197,9 @@ struct sierra_port_private { | |||
196 | spinlock_t lock; /* lock the structure */ | 197 | spinlock_t lock; /* lock the structure */ |
197 | int outstanding_urbs; /* number of out urbs in flight */ | 198 | int outstanding_urbs; /* number of out urbs in flight */ |
198 | 199 | ||
199 | /* Input endpoints and buffer for this port */ | 200 | /* Input endpoints and buffers for this port */ |
200 | struct urb *in_urbs[N_IN_URB]; | 201 | struct urb *in_urbs[N_IN_URB]; |
201 | char in_buffer[N_IN_URB][IN_BUFLEN]; | 202 | char *in_buffer[N_IN_URB]; |
202 | 203 | ||
203 | /* Settings for the port */ | 204 | /* Settings for the port */ |
204 | int rts_state; /* Handshaking pins (outputs) */ | 205 | int rts_state; /* Handshaking pins (outputs) */ |
@@ -638,6 +639,15 @@ static int sierra_startup(struct usb_serial *serial) | |||
638 | return -ENOMEM; | 639 | return -ENOMEM; |
639 | } | 640 | } |
640 | spin_lock_init(&portdata->lock); | 641 | spin_lock_init(&portdata->lock); |
642 | for (j = 0; j < N_IN_URB; j++) { | ||
643 | portdata->in_buffer[j] = kmalloc(IN_BUFLEN, GFP_KERNEL); | ||
644 | if (!portdata->in_buffer[j]) { | ||
645 | for (--j; j >= 0; j--) | ||
646 | kfree(portdata->in_buffer[j]); | ||
647 | kfree(portdata); | ||
648 | return -ENOMEM; | ||
649 | } | ||
650 | } | ||
641 | 651 | ||
642 | usb_set_serial_port_data(port, portdata); | 652 | usb_set_serial_port_data(port, portdata); |
643 | 653 | ||
@@ -681,7 +691,7 @@ static void sierra_shutdown(struct usb_serial *serial) | |||
681 | for (j = 0; j < N_IN_URB; j++) { | 691 | for (j = 0; j < N_IN_URB; j++) { |
682 | usb_kill_urb(portdata->in_urbs[j]); | 692 | usb_kill_urb(portdata->in_urbs[j]); |
683 | usb_free_urb(portdata->in_urbs[j]); | 693 | usb_free_urb(portdata->in_urbs[j]); |
684 | portdata->in_urbs[j] = NULL; | 694 | kfree(portdata->in_buffer[j]); |
685 | } | 695 | } |
686 | kfree(portdata); | 696 | kfree(portdata); |
687 | usb_set_serial_port_data(port, NULL); | 697 | usb_set_serial_port_data(port, NULL); |
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 2ae1e8673b19..971d13dd5e65 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -1230,6 +1230,7 @@ static int isd200_get_inquiry_data( struct us_data *us ) | |||
1230 | 1230 | ||
1231 | /* Free driver structure */ | 1231 | /* Free driver structure */ |
1232 | us->extra_destructor(info); | 1232 | us->extra_destructor(info); |
1233 | kfree(info); | ||
1233 | us->extra = NULL; | 1234 | us->extra = NULL; |
1234 | us->extra_destructor = NULL; | 1235 | us->extra_destructor = NULL; |
1235 | } | 1236 | } |
@@ -1469,6 +1470,7 @@ static void isd200_free_info_ptrs(void *info_) | |||
1469 | if (info) { | 1470 | if (info) { |
1470 | kfree(info->id); | 1471 | kfree(info->id); |
1471 | kfree(info->RegsBuf); | 1472 | kfree(info->RegsBuf); |
1473 | kfree(info->srb.sense_buffer); | ||
1472 | } | 1474 | } |
1473 | } | 1475 | } |
1474 | 1476 | ||
@@ -1494,7 +1496,9 @@ static int isd200_init_info(struct us_data *us) | |||
1494 | kzalloc(sizeof(struct hd_driveid), GFP_KERNEL); | 1496 | kzalloc(sizeof(struct hd_driveid), GFP_KERNEL); |
1495 | info->RegsBuf = (unsigned char *) | 1497 | info->RegsBuf = (unsigned char *) |
1496 | kmalloc(sizeof(info->ATARegs), GFP_KERNEL); | 1498 | kmalloc(sizeof(info->ATARegs), GFP_KERNEL); |
1497 | if (!info->id || !info->RegsBuf) { | 1499 | info->srb.sense_buffer = |
1500 | kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); | ||
1501 | if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) { | ||
1498 | isd200_free_info_ptrs(info); | 1502 | isd200_free_info_ptrs(info); |
1499 | kfree(info); | 1503 | kfree(info); |
1500 | retStatus = ISD200_ERROR; | 1504 | retStatus = ISD200_ERROR; |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 5780ed15f1ad..bdd4334bed5a 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1009 | US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", | 1009 | US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", |
1010 | le32_to_cpu(bcs->Signature), bcs->Tag, | 1010 | le32_to_cpu(bcs->Signature), bcs->Tag, |
1011 | residue, bcs->Status); | 1011 | residue, bcs->Status); |
1012 | if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) { | 1012 | if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) || |
1013 | bcs->Status > US_BULK_STAT_PHASE) { | ||
1013 | US_DEBUGP("Bulk logical error\n"); | 1014 | US_DEBUGP("Bulk logical error\n"); |
1014 | return USB_STOR_TRANSPORT_ERROR; | 1015 | return USB_STOR_TRANSPORT_ERROR; |
1015 | } | 1016 | } |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 99679a8cfa02..e5219a56947c 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1589,6 +1589,17 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0001, | |||
1589 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1589 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1590 | US_FL_FIX_CAPACITY), | 1590 | US_FL_FIX_CAPACITY), |
1591 | 1591 | ||
1592 | /* | ||
1593 | * Patch by Constantin Baranov <const@tltsu.ru> | ||
1594 | * Report by Andreas Koenecke. | ||
1595 | * Motorola ROKR Z6. | ||
1596 | */ | ||
1597 | UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101, | ||
1598 | "Motorola", | ||
1599 | "MSnc.", | ||
1600 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1601 | US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG), | ||
1602 | |||
1592 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ | 1603 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ |
1593 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, | 1604 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, |
1594 | "MPIO", | 1605 | "MPIO", |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e0b0580705e4..1bd5fb30237d 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1893,6 +1893,20 @@ config FB_XILINX | |||
1893 | framebuffer. ML300 carries a 640*480 LCD display on the board, | 1893 | framebuffer. ML300 carries a 640*480 LCD display on the board, |
1894 | ML403 uses a standard DB15 VGA connector. | 1894 | ML403 uses a standard DB15 VGA connector. |
1895 | 1895 | ||
1896 | config FB_METRONOME | ||
1897 | tristate "Metronome display controller support" | ||
1898 | depends on FB && ARCH_PXA && MMU | ||
1899 | select FB_SYS_FILLRECT | ||
1900 | select FB_SYS_COPYAREA | ||
1901 | select FB_SYS_IMAGEBLIT | ||
1902 | select FB_SYS_FOPS | ||
1903 | select FB_DEFERRED_IO | ||
1904 | help | ||
1905 | This enables support for the Metronome display controller. Tested | ||
1906 | with an E-Ink 800x600 display and Gumstix Connex through an AMLCD | ||
1907 | interface. Please read <file:Documentation/fb/metronomefb.txt> | ||
1908 | for more information. | ||
1909 | |||
1896 | config FB_VIRTUAL | 1910 | config FB_VIRTUAL |
1897 | tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)" | 1911 | tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)" |
1898 | depends on FB | 1912 | depends on FB |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 03371c789039..11c0e5e05f21 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -103,6 +103,7 @@ obj-$(CONFIG_FB_PMAG_AA) += pmag-aa-fb.o | |||
103 | obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o | 103 | obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o |
104 | obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o | 104 | obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o |
105 | obj-$(CONFIG_FB_MAXINE) += maxinefb.o | 105 | obj-$(CONFIG_FB_MAXINE) += maxinefb.o |
106 | obj-$(CONFIG_FB_METRONOME) += metronomefb.o | ||
106 | obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o | 107 | obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o |
107 | obj-$(CONFIG_FB_IMX) += imxfb.o | 108 | obj-$(CONFIG_FB_IMX) += imxfb.o |
108 | obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o | 109 | obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o |
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index 986a550c0439..eefba3d0e4b9 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c | |||
@@ -384,7 +384,7 @@ static int bfin_bf54x_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) | |||
384 | * Other flags can be set, and are documented in | 384 | * Other flags can be set, and are documented in |
385 | * include/linux/mm.h | 385 | * include/linux/mm.h |
386 | */ | 386 | */ |
387 | vma->vm_flags |= VM_MAYSHARE; | 387 | vma->vm_flags |= VM_MAYSHARE | VM_SHARED; |
388 | 388 | ||
389 | return 0; | 389 | return 0; |
390 | } | 390 | } |
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c index a2bb2de9e020..135d6dd7e672 100644 --- a/drivers/video/bfin-t350mcqb-fb.c +++ b/drivers/video/bfin-t350mcqb-fb.c | |||
@@ -91,6 +91,7 @@ struct bfin_t350mcqbfb_info { | |||
91 | int lq043_open_cnt; | 91 | int lq043_open_cnt; |
92 | int irq; | 92 | int irq; |
93 | spinlock_t lock; /* lock */ | 93 | spinlock_t lock; /* lock */ |
94 | u32 pseudo_pal[16]; | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | static int nocursor; | 97 | static int nocursor; |
@@ -182,13 +183,13 @@ static void bfin_t350mcqb_config_dma(struct bfin_t350mcqbfb_info *fbi) | |||
182 | 183 | ||
183 | } | 184 | } |
184 | 185 | ||
185 | static int bfin_t350mcqb_request_ports(int action) | 186 | static u16 ppi0_req_8[] = {P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2, |
186 | { | ||
187 | u16 ppi0_req_8[] = {P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2, | ||
188 | P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, | 187 | P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, |
189 | P_PPI0_D3, P_PPI0_D4, P_PPI0_D5, | 188 | P_PPI0_D3, P_PPI0_D4, P_PPI0_D5, |
190 | P_PPI0_D6, P_PPI0_D7, 0}; | 189 | P_PPI0_D6, P_PPI0_D7, 0}; |
191 | 190 | ||
191 | static int bfin_t350mcqb_request_ports(int action) | ||
192 | { | ||
192 | if (action) { | 193 | if (action) { |
193 | if (peripheral_request_list(ppi0_req_8, DRIVER_NAME)) { | 194 | if (peripheral_request_list(ppi0_req_8, DRIVER_NAME)) { |
194 | printk(KERN_ERR "Requesting Peripherals faild\n"); | 195 | printk(KERN_ERR "Requesting Peripherals faild\n"); |
@@ -301,7 +302,7 @@ static int bfin_t350mcqb_fb_mmap(struct fb_info *info, struct vm_area_struct *vm | |||
301 | * Other flags can be set, and are documented in | 302 | * Other flags can be set, and are documented in |
302 | * include/linux/mm.h | 303 | * include/linux/mm.h |
303 | */ | 304 | */ |
304 | vma->vm_flags |= VM_MAYSHARE; | 305 | vma->vm_flags |= VM_MAYSHARE | VM_SHARED; |
305 | 306 | ||
306 | return 0; | 307 | return 0; |
307 | } | 308 | } |
@@ -520,16 +521,7 @@ static int __init bfin_t350mcqb_probe(struct platform_device *pdev) | |||
520 | 521 | ||
521 | fbinfo->fbops = &bfin_t350mcqb_fb_ops; | 522 | fbinfo->fbops = &bfin_t350mcqb_fb_ops; |
522 | 523 | ||
523 | fbinfo->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); | 524 | fbinfo->pseudo_palette = &info->pseudo_pal; |
524 | if (!fbinfo->pseudo_palette) { | ||
525 | printk(KERN_ERR DRIVER_NAME | ||
526 | "Fail to allocate pseudo_palette\n"); | ||
527 | |||
528 | ret = -ENOMEM; | ||
529 | goto out4; | ||
530 | } | ||
531 | |||
532 | memset(fbinfo->pseudo_palette, 0, sizeof(u32) * 16); | ||
533 | 525 | ||
534 | if (fb_alloc_cmap(&fbinfo->cmap, BFIN_LCD_NBR_PALETTE_ENTRIES, 0) | 526 | if (fb_alloc_cmap(&fbinfo->cmap, BFIN_LCD_NBR_PALETTE_ENTRIES, 0) |
535 | < 0) { | 527 | < 0) { |
@@ -537,7 +529,7 @@ static int __init bfin_t350mcqb_probe(struct platform_device *pdev) | |||
537 | "Fail to allocate colormap (%d entries)\n", | 529 | "Fail to allocate colormap (%d entries)\n", |
538 | BFIN_LCD_NBR_PALETTE_ENTRIES); | 530 | BFIN_LCD_NBR_PALETTE_ENTRIES); |
539 | ret = -EFAULT; | 531 | ret = -EFAULT; |
540 | goto out5; | 532 | goto out4; |
541 | } | 533 | } |
542 | 534 | ||
543 | if (bfin_t350mcqb_request_ports(1)) { | 535 | if (bfin_t350mcqb_request_ports(1)) { |
@@ -552,11 +544,11 @@ static int __init bfin_t350mcqb_probe(struct platform_device *pdev) | |||
552 | goto out7; | 544 | goto out7; |
553 | } | 545 | } |
554 | 546 | ||
555 | if (request_irq(info->irq, (void *)bfin_t350mcqb_irq_error, IRQF_DISABLED, | 547 | ret = request_irq(info->irq, bfin_t350mcqb_irq_error, IRQF_DISABLED, |
556 | "PPI ERROR", info) < 0) { | 548 | "PPI ERROR", info); |
549 | if (ret < 0) { | ||
557 | printk(KERN_ERR DRIVER_NAME | 550 | printk(KERN_ERR DRIVER_NAME |
558 | ": unable to request PPI ERROR IRQ\n"); | 551 | ": unable to request PPI ERROR IRQ\n"); |
559 | ret = -EFAULT; | ||
560 | goto out7; | 552 | goto out7; |
561 | } | 553 | } |
562 | 554 | ||
@@ -584,8 +576,6 @@ out7: | |||
584 | bfin_t350mcqb_request_ports(0); | 576 | bfin_t350mcqb_request_ports(0); |
585 | out6: | 577 | out6: |
586 | fb_dealloc_cmap(&fbinfo->cmap); | 578 | fb_dealloc_cmap(&fbinfo->cmap); |
587 | out5: | ||
588 | kfree(fbinfo->pseudo_palette); | ||
589 | out4: | 579 | out4: |
590 | dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, | 580 | dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, |
591 | info->dma_handle); | 581 | info->dma_handle); |
@@ -605,6 +595,8 @@ static int bfin_t350mcqb_remove(struct platform_device *pdev) | |||
605 | struct fb_info *fbinfo = platform_get_drvdata(pdev); | 595 | struct fb_info *fbinfo = platform_get_drvdata(pdev); |
606 | struct bfin_t350mcqbfb_info *info = fbinfo->par; | 596 | struct bfin_t350mcqbfb_info *info = fbinfo->par; |
607 | 597 | ||
598 | unregister_framebuffer(fbinfo); | ||
599 | |||
608 | free_dma(CH_PPI); | 600 | free_dma(CH_PPI); |
609 | free_irq(info->irq, info); | 601 | free_irq(info->irq, info); |
610 | 602 | ||
@@ -612,7 +604,6 @@ static int bfin_t350mcqb_remove(struct platform_device *pdev) | |||
612 | dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, | 604 | dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, |
613 | info->dma_handle); | 605 | info->dma_handle); |
614 | 606 | ||
615 | kfree(fbinfo->pseudo_palette); | ||
616 | fb_dealloc_cmap(&fbinfo->cmap); | 607 | fb_dealloc_cmap(&fbinfo->cmap); |
617 | 608 | ||
618 | #ifndef NO_BL_SUPPORT | 609 | #ifndef NO_BL_SUPPORT |
@@ -620,10 +611,11 @@ static int bfin_t350mcqb_remove(struct platform_device *pdev) | |||
620 | backlight_device_unregister(bl_dev); | 611 | backlight_device_unregister(bl_dev); |
621 | #endif | 612 | #endif |
622 | 613 | ||
623 | unregister_framebuffer(fbinfo); | ||
624 | |||
625 | bfin_t350mcqb_request_ports(0); | 614 | bfin_t350mcqb_request_ports(0); |
626 | 615 | ||
616 | platform_set_drvdata(pdev, NULL); | ||
617 | framebuffer_release(fbinfo); | ||
618 | |||
627 | printk(KERN_INFO DRIVER_NAME ": Unregister LCD driver.\n"); | 619 | printk(KERN_INFO DRIVER_NAME ": Unregister LCD driver.\n"); |
628 | 620 | ||
629 | return 0; | 621 | return 0; |
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c index 0f8cfb988c90..24843fdd5395 100644 --- a/drivers/video/fb_defio.c +++ b/drivers/video/fb_defio.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 2006 Jaya Kumar | 4 | * Copyright (C) 2006 Jaya Kumar |
5 | * | 5 | * |
6 | * This file is subject to the terms and conditions of the GNU General Public | 6 | * This file is subject to the terms and conditions of the GNU General Public |
7 | * License. See the file COPYING in the main directory of this archive | 7 | * License. See the file COPYING in the main directory of this archive |
8 | * for more details. | 8 | * for more details. |
9 | */ | 9 | */ |
10 | 10 | ||
@@ -31,7 +31,7 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma, | |||
31 | unsigned long offset; | 31 | unsigned long offset; |
32 | struct page *page; | 32 | struct page *page; |
33 | struct fb_info *info = vma->vm_private_data; | 33 | struct fb_info *info = vma->vm_private_data; |
34 | /* info->screen_base is in System RAM */ | 34 | /* info->screen_base is virtual memory */ |
35 | void *screen_base = (void __force *) info->screen_base; | 35 | void *screen_base = (void __force *) info->screen_base; |
36 | 36 | ||
37 | offset = vmf->pgoff << PAGE_SHIFT; | 37 | offset = vmf->pgoff << PAGE_SHIFT; |
@@ -43,6 +43,15 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma, | |||
43 | return VM_FAULT_SIGBUS; | 43 | return VM_FAULT_SIGBUS; |
44 | 44 | ||
45 | get_page(page); | 45 | get_page(page); |
46 | |||
47 | if (vma->vm_file) | ||
48 | page->mapping = vma->vm_file->f_mapping; | ||
49 | else | ||
50 | printk(KERN_ERR "no mapping available\n"); | ||
51 | |||
52 | BUG_ON(!page->mapping); | ||
53 | page->index = vmf->pgoff; | ||
54 | |||
46 | vmf->page = page; | 55 | vmf->page = page; |
47 | return 0; | 56 | return 0; |
48 | } | 57 | } |
@@ -138,11 +147,20 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_init); | |||
138 | 147 | ||
139 | void fb_deferred_io_cleanup(struct fb_info *info) | 148 | void fb_deferred_io_cleanup(struct fb_info *info) |
140 | { | 149 | { |
150 | void *screen_base = (void __force *) info->screen_base; | ||
141 | struct fb_deferred_io *fbdefio = info->fbdefio; | 151 | struct fb_deferred_io *fbdefio = info->fbdefio; |
152 | struct page *page; | ||
153 | int i; | ||
142 | 154 | ||
143 | BUG_ON(!fbdefio); | 155 | BUG_ON(!fbdefio); |
144 | cancel_delayed_work(&info->deferred_work); | 156 | cancel_delayed_work(&info->deferred_work); |
145 | flush_scheduled_work(); | 157 | flush_scheduled_work(); |
158 | |||
159 | /* clear out the mapping that we setup */ | ||
160 | for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) { | ||
161 | page = vmalloc_to_page(screen_base + i); | ||
162 | page->mapping = NULL; | ||
163 | } | ||
146 | } | 164 | } |
147 | EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup); | 165 | EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup); |
148 | 166 | ||
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 1d13dd099af8..a24e680d2b9c 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -1476,7 +1476,7 @@ static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
1476 | struct i810fb_par *par = info->par; | 1476 | struct i810fb_par *par = info->par; |
1477 | u8 __iomem *mmio = par->mmio_start_virtual; | 1477 | u8 __iomem *mmio = par->mmio_start_virtual; |
1478 | 1478 | ||
1479 | if (!(par->dev_flags & LOCKUP)) | 1479 | if (par->dev_flags & LOCKUP) |
1480 | return -ENXIO; | 1480 | return -ENXIO; |
1481 | 1481 | ||
1482 | if (cursor->image.width > 64 || cursor->image.height > 64) | 1482 | if (cursor->image.width > 64 || cursor->image.height > 64) |
diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c new file mode 100644 index 000000000000..e9a89fd82757 --- /dev/null +++ b/drivers/video/metronomefb.c | |||
@@ -0,0 +1,999 @@ | |||
1 | /* | ||
2 | * linux/drivers/video/metronomefb.c -- FB driver for Metronome controller | ||
3 | * | ||
4 | * Copyright (C) 2008, Jaya Kumar | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive for | ||
8 | * more details. | ||
9 | * | ||
10 | * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven. | ||
11 | * | ||
12 | * This work was made possible by help and equipment support from E-Ink | ||
13 | * Corporation. http://support.eink.com/community | ||
14 | * | ||
15 | * This driver is written to be used with the Metronome display controller. | ||
16 | * It was tested with an E-Ink 800x600 Vizplex EPD on a Gumstix Connex board | ||
17 | * using the Lyre interface board. | ||
18 | * | ||
19 | * General notes: | ||
20 | * - User must set metronomefb_enable=1 to enable it. | ||
21 | * - See Documentation/fb/metronomefb.txt for how metronome works. | ||
22 | */ | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/errno.h> | ||
26 | #include <linux/string.h> | ||
27 | #include <linux/mm.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/vmalloc.h> | ||
30 | #include <linux/delay.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/fb.h> | ||
33 | #include <linux/init.h> | ||
34 | #include <linux/platform_device.h> | ||
35 | #include <linux/list.h> | ||
36 | #include <linux/firmware.h> | ||
37 | #include <linux/dma-mapping.h> | ||
38 | #include <linux/uaccess.h> | ||
39 | #include <linux/irq.h> | ||
40 | |||
41 | #include <asm/arch/pxa-regs.h> | ||
42 | #include <asm/unaligned.h> | ||
43 | |||
44 | #define DEBUG 1 | ||
45 | #ifdef DEBUG | ||
46 | #define DPRINTK(f, a...) printk(KERN_DEBUG "%s: " f, __func__ , ## a) | ||
47 | #else | ||
48 | #define DPRINTK(f, a...) | ||
49 | #endif | ||
50 | |||
51 | |||
52 | /* Display specific information */ | ||
53 | #define DPY_W 832 | ||
54 | #define DPY_H 622 | ||
55 | |||
56 | struct metromem_desc { | ||
57 | u32 mFDADR0; | ||
58 | u32 mFSADR0; | ||
59 | u32 mFIDR0; | ||
60 | u32 mLDCMD0; | ||
61 | }; | ||
62 | |||
63 | struct metromem_cmd { | ||
64 | u16 opcode; | ||
65 | u16 args[((64-2)/2)]; | ||
66 | u16 csum; | ||
67 | }; | ||
68 | |||
69 | struct metronomefb_par { | ||
70 | unsigned char *metromem; | ||
71 | struct metromem_desc *metromem_desc; | ||
72 | struct metromem_cmd *metromem_cmd; | ||
73 | unsigned char *metromem_wfm; | ||
74 | unsigned char *metromem_img; | ||
75 | u16 *metromem_img_csum; | ||
76 | u16 *csum_table; | ||
77 | int metromemsize; | ||
78 | dma_addr_t metromem_dma; | ||
79 | dma_addr_t metromem_desc_dma; | ||
80 | struct fb_info *info; | ||
81 | wait_queue_head_t waitq; | ||
82 | u8 frame_count; | ||
83 | }; | ||
84 | |||
85 | /* frame differs from image. frame includes non-visible pixels */ | ||
86 | struct epd_frame { | ||
87 | int fw; /* frame width */ | ||
88 | int fh; /* frame height */ | ||
89 | }; | ||
90 | |||
91 | static struct epd_frame epd_frame_table[] = { | ||
92 | { | ||
93 | .fw = 832, | ||
94 | .fh = 622 | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | static struct fb_fix_screeninfo metronomefb_fix __devinitdata = { | ||
99 | .id = "metronomefb", | ||
100 | .type = FB_TYPE_PACKED_PIXELS, | ||
101 | .visual = FB_VISUAL_STATIC_PSEUDOCOLOR, | ||
102 | .xpanstep = 0, | ||
103 | .ypanstep = 0, | ||
104 | .ywrapstep = 0, | ||
105 | .line_length = DPY_W, | ||
106 | .accel = FB_ACCEL_NONE, | ||
107 | }; | ||
108 | |||
109 | static struct fb_var_screeninfo metronomefb_var __devinitdata = { | ||
110 | .xres = DPY_W, | ||
111 | .yres = DPY_H, | ||
112 | .xres_virtual = DPY_W, | ||
113 | .yres_virtual = DPY_H, | ||
114 | .bits_per_pixel = 8, | ||
115 | .grayscale = 1, | ||
116 | .nonstd = 1, | ||
117 | .red = { 4, 3, 0 }, | ||
118 | .green = { 0, 0, 0 }, | ||
119 | .blue = { 0, 0, 0 }, | ||
120 | .transp = { 0, 0, 0 }, | ||
121 | }; | ||
122 | |||
123 | static unsigned int metronomefb_enable; | ||
124 | |||
125 | struct waveform_hdr { | ||
126 | u8 stuff[32]; | ||
127 | |||
128 | u8 wmta[3]; | ||
129 | u8 fvsn; | ||
130 | |||
131 | u8 luts; | ||
132 | u8 mc; | ||
133 | u8 trc; | ||
134 | u8 stuff3; | ||
135 | |||
136 | u8 endb; | ||
137 | u8 swtb; | ||
138 | u8 stuff2a[2]; | ||
139 | |||
140 | u8 stuff2b[3]; | ||
141 | u8 wfm_cs; | ||
142 | } __attribute__ ((packed)); | ||
143 | |||
144 | /* main metronomefb functions */ | ||
145 | static u8 calc_cksum(int start, int end, u8 *mem) | ||
146 | { | ||
147 | u8 tmp = 0; | ||
148 | int i; | ||
149 | |||
150 | for (i = start; i < end; i++) | ||
151 | tmp += mem[i]; | ||
152 | |||
153 | return tmp; | ||
154 | } | ||
155 | |||
156 | static u16 calc_img_cksum(u16 *start, int length) | ||
157 | { | ||
158 | u16 tmp = 0; | ||
159 | |||
160 | while (length--) | ||
161 | tmp += *start++; | ||
162 | |||
163 | return tmp; | ||
164 | } | ||
165 | |||
166 | /* here we decode the incoming waveform file and populate metromem */ | ||
167 | #define EXP_WFORM_SIZE 47001 | ||
168 | static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | ||
169 | u8 *frame_count) | ||
170 | { | ||
171 | int tta; | ||
172 | int wmta; | ||
173 | int trn = 0; | ||
174 | int i; | ||
175 | unsigned char v; | ||
176 | u8 cksum; | ||
177 | int cksum_idx; | ||
178 | int wfm_idx, owfm_idx; | ||
179 | int mem_idx = 0; | ||
180 | struct waveform_hdr *wfm_hdr; | ||
181 | |||
182 | if (size != EXP_WFORM_SIZE) { | ||
183 | printk(KERN_ERR "Error: unexpected size %d != %d\n", size, | ||
184 | EXP_WFORM_SIZE); | ||
185 | return -EINVAL; | ||
186 | } | ||
187 | |||
188 | wfm_hdr = (struct waveform_hdr *) mem; | ||
189 | |||
190 | if (wfm_hdr->fvsn != 1) { | ||
191 | printk(KERN_ERR "Error: bad fvsn %x\n", wfm_hdr->fvsn); | ||
192 | return -EINVAL; | ||
193 | } | ||
194 | if (wfm_hdr->luts != 0) { | ||
195 | printk(KERN_ERR "Error: bad luts %x\n", wfm_hdr->luts); | ||
196 | return -EINVAL; | ||
197 | } | ||
198 | cksum = calc_cksum(32, 47, mem); | ||
199 | if (cksum != wfm_hdr->wfm_cs) { | ||
200 | printk(KERN_ERR "Error: bad cksum %x != %x\n", cksum, | ||
201 | wfm_hdr->wfm_cs); | ||
202 | return -EINVAL; | ||
203 | } | ||
204 | wfm_hdr->mc += 1; | ||
205 | wfm_hdr->trc += 1; | ||
206 | for (i = 0; i < 5; i++) { | ||
207 | if (*(wfm_hdr->stuff2a + i) != 0) { | ||
208 | printk(KERN_ERR "Error: unexpected value in padding\n"); | ||
209 | return -EINVAL; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | /* calculating trn. trn is something used to index into | ||
214 | the waveform. presumably selecting the right one for the | ||
215 | desired temperature. it works out the offset of the first | ||
216 | v that exceeds the specified temperature */ | ||
217 | if ((sizeof(*wfm_hdr) + wfm_hdr->trc) > size) | ||
218 | return -EINVAL; | ||
219 | |||
220 | for (i = sizeof(*wfm_hdr); i <= sizeof(*wfm_hdr) + wfm_hdr->trc; i++) { | ||
221 | if (mem[i] > t) { | ||
222 | trn = i - sizeof(*wfm_hdr) - 1; | ||
223 | break; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /* check temperature range table checksum */ | ||
228 | cksum_idx = sizeof(*wfm_hdr) + wfm_hdr->trc + 1; | ||
229 | if (cksum_idx > size) | ||
230 | return -EINVAL; | ||
231 | cksum = calc_cksum(sizeof(*wfm_hdr), cksum_idx, mem); | ||
232 | if (cksum != mem[cksum_idx]) { | ||
233 | printk(KERN_ERR "Error: bad temperature range table cksum" | ||
234 | " %x != %x\n", cksum, mem[cksum_idx]); | ||
235 | return -EINVAL; | ||
236 | } | ||
237 | |||
238 | /* check waveform mode table address checksum */ | ||
239 | wmta = le32_to_cpu(get_unaligned((__le32 *) wfm_hdr->wmta)); | ||
240 | wmta &= 0x00FFFFFF; | ||
241 | cksum_idx = wmta + m*4 + 3; | ||
242 | if (cksum_idx > size) | ||
243 | return -EINVAL; | ||
244 | cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); | ||
245 | if (cksum != mem[cksum_idx]) { | ||
246 | printk(KERN_ERR "Error: bad mode table address cksum" | ||
247 | " %x != %x\n", cksum, mem[cksum_idx]); | ||
248 | return -EINVAL; | ||
249 | } | ||
250 | |||
251 | /* check waveform temperature table address checksum */ | ||
252 | tta = le32_to_cpu(get_unaligned((int *) (mem + wmta + m*4))); | ||
253 | tta &= 0x00FFFFFF; | ||
254 | cksum_idx = tta + trn*4 + 3; | ||
255 | if (cksum_idx > size) | ||
256 | return -EINVAL; | ||
257 | cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); | ||
258 | if (cksum != mem[cksum_idx]) { | ||
259 | printk(KERN_ERR "Error: bad temperature table address cksum" | ||
260 | " %x != %x\n", cksum, mem[cksum_idx]); | ||
261 | return -EINVAL; | ||
262 | } | ||
263 | |||
264 | /* here we do the real work of putting the waveform into the | ||
265 | metromem buffer. this does runlength decoding of the waveform */ | ||
266 | wfm_idx = le32_to_cpu(get_unaligned((__le32 *) (mem + tta + trn*4))); | ||
267 | wfm_idx &= 0x00FFFFFF; | ||
268 | owfm_idx = wfm_idx; | ||
269 | if (wfm_idx > size) | ||
270 | return -EINVAL; | ||
271 | while (wfm_idx < size) { | ||
272 | unsigned char rl; | ||
273 | v = mem[wfm_idx++]; | ||
274 | if (v == wfm_hdr->swtb) { | ||
275 | while (((v = mem[wfm_idx++]) != wfm_hdr->swtb) && | ||
276 | wfm_idx < size) | ||
277 | metromem[mem_idx++] = v; | ||
278 | |||
279 | continue; | ||
280 | } | ||
281 | |||
282 | if (v == wfm_hdr->endb) | ||
283 | break; | ||
284 | |||
285 | rl = mem[wfm_idx++]; | ||
286 | for (i = 0; i <= rl; i++) | ||
287 | metromem[mem_idx++] = v; | ||
288 | } | ||
289 | |||
290 | cksum_idx = wfm_idx; | ||
291 | if (cksum_idx > size) | ||
292 | return -EINVAL; | ||
293 | cksum = calc_cksum(owfm_idx, cksum_idx, mem); | ||
294 | if (cksum != mem[cksum_idx]) { | ||
295 | printk(KERN_ERR "Error: bad waveform data cksum" | ||
296 | " %x != %x\n", cksum, mem[cksum_idx]); | ||
297 | return -EINVAL; | ||
298 | } | ||
299 | *frame_count = (mem_idx/64); | ||
300 | |||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | /* register offsets for gpio control */ | ||
305 | #define LED_GPIO_PIN 51 | ||
306 | #define STDBY_GPIO_PIN 48 | ||
307 | #define RST_GPIO_PIN 49 | ||
308 | #define RDY_GPIO_PIN 32 | ||
309 | #define ERR_GPIO_PIN 17 | ||
310 | #define PCBPWR_GPIO_PIN 16 | ||
311 | |||
312 | #define AF_SEL_GPIO_N 0x3 | ||
313 | #define GAFR0_U_OFFSET(pin) ((pin - 16) * 2) | ||
314 | #define GAFR1_L_OFFSET(pin) ((pin - 32) * 2) | ||
315 | #define GAFR1_U_OFFSET(pin) ((pin - 48) * 2) | ||
316 | #define GPDR1_OFFSET(pin) (pin - 32) | ||
317 | #define GPCR1_OFFSET(pin) (pin - 32) | ||
318 | #define GPSR1_OFFSET(pin) (pin - 32) | ||
319 | #define GPCR0_OFFSET(pin) (pin) | ||
320 | #define GPSR0_OFFSET(pin) (pin) | ||
321 | |||
322 | static void metronome_set_gpio_output(int pin, int val) | ||
323 | { | ||
324 | u8 index; | ||
325 | |||
326 | index = pin >> 4; | ||
327 | |||
328 | switch (index) { | ||
329 | case 1: | ||
330 | if (val) | ||
331 | GPSR0 |= (1 << GPSR0_OFFSET(pin)); | ||
332 | else | ||
333 | GPCR0 |= (1 << GPCR0_OFFSET(pin)); | ||
334 | break; | ||
335 | case 2: | ||
336 | break; | ||
337 | case 3: | ||
338 | if (val) | ||
339 | GPSR1 |= (1 << GPSR1_OFFSET(pin)); | ||
340 | else | ||
341 | GPCR1 |= (1 << GPCR1_OFFSET(pin)); | ||
342 | break; | ||
343 | default: | ||
344 | printk(KERN_ERR "unimplemented\n"); | ||
345 | } | ||
346 | } | ||
347 | |||
348 | static void __devinit metronome_init_gpio_pin(int pin, int dir) | ||
349 | { | ||
350 | u8 index; | ||
351 | /* dir 0 is output, 1 is input | ||
352 | - do 2 things here: | ||
353 | - set gpio alternate function to standard gpio | ||
354 | - set gpio direction to input or output */ | ||
355 | |||
356 | index = pin >> 4; | ||
357 | switch (index) { | ||
358 | case 1: | ||
359 | GAFR0_U &= ~(AF_SEL_GPIO_N << GAFR0_U_OFFSET(pin)); | ||
360 | |||
361 | if (dir) | ||
362 | GPDR0 &= ~(1 << pin); | ||
363 | else | ||
364 | GPDR0 |= (1 << pin); | ||
365 | break; | ||
366 | case 2: | ||
367 | GAFR1_L &= ~(AF_SEL_GPIO_N << GAFR1_L_OFFSET(pin)); | ||
368 | |||
369 | if (dir) | ||
370 | GPDR1 &= ~(1 << GPDR1_OFFSET(pin)); | ||
371 | else | ||
372 | GPDR1 |= (1 << GPDR1_OFFSET(pin)); | ||
373 | break; | ||
374 | case 3: | ||
375 | GAFR1_U &= ~(AF_SEL_GPIO_N << GAFR1_U_OFFSET(pin)); | ||
376 | |||
377 | if (dir) | ||
378 | GPDR1 &= ~(1 << GPDR1_OFFSET(pin)); | ||
379 | else | ||
380 | GPDR1 |= (1 << GPDR1_OFFSET(pin)); | ||
381 | break; | ||
382 | default: | ||
383 | printk(KERN_ERR "unimplemented\n"); | ||
384 | } | ||
385 | } | ||
386 | |||
387 | static void __devinit metronome_init_gpio_regs(void) | ||
388 | { | ||
389 | metronome_init_gpio_pin(LED_GPIO_PIN, 0); | ||
390 | metronome_set_gpio_output(LED_GPIO_PIN, 0); | ||
391 | |||
392 | metronome_init_gpio_pin(STDBY_GPIO_PIN, 0); | ||
393 | metronome_set_gpio_output(STDBY_GPIO_PIN, 0); | ||
394 | |||
395 | metronome_init_gpio_pin(RST_GPIO_PIN, 0); | ||
396 | metronome_set_gpio_output(RST_GPIO_PIN, 0); | ||
397 | |||
398 | metronome_init_gpio_pin(RDY_GPIO_PIN, 1); | ||
399 | |||
400 | metronome_init_gpio_pin(ERR_GPIO_PIN, 1); | ||
401 | |||
402 | metronome_init_gpio_pin(PCBPWR_GPIO_PIN, 0); | ||
403 | metronome_set_gpio_output(PCBPWR_GPIO_PIN, 0); | ||
404 | } | ||
405 | |||
406 | static void metronome_disable_lcd_controller(struct metronomefb_par *par) | ||
407 | { | ||
408 | LCSR = 0xffffffff; /* Clear LCD Status Register */ | ||
409 | LCCR0 |= LCCR0_DIS; /* Disable LCD Controller */ | ||
410 | |||
411 | /* we reset and just wait for things to settle */ | ||
412 | msleep(200); | ||
413 | } | ||
414 | |||
415 | static void metronome_enable_lcd_controller(struct metronomefb_par *par) | ||
416 | { | ||
417 | LCSR = 0xffffffff; | ||
418 | FDADR0 = par->metromem_desc_dma; | ||
419 | LCCR0 |= LCCR0_ENB; | ||
420 | } | ||
421 | |||
422 | static void __devinit metronome_init_lcdc_regs(struct metronomefb_par *par) | ||
423 | { | ||
424 | /* here we do: | ||
425 | - disable the lcd controller | ||
426 | - setup lcd control registers | ||
427 | - setup dma descriptor | ||
428 | - reenable lcd controller | ||
429 | */ | ||
430 | |||
431 | /* disable the lcd controller */ | ||
432 | metronome_disable_lcd_controller(par); | ||
433 | |||
434 | /* setup lcd control registers */ | ||
435 | LCCR0 = LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM | LCCR0_PAS | ||
436 | | LCCR0_QDM | LCCR0_BM | LCCR0_OUM; | ||
437 | |||
438 | LCCR1 = (epd_frame_table[0].fw/2 - 1) /* pixels per line */ | ||
439 | | (27 << 10) /* hsync pulse width - 1 */ | ||
440 | | (33 << 16) /* eol pixel count */ | ||
441 | | (33 << 24); /* bol pixel count */ | ||
442 | |||
443 | LCCR2 = (epd_frame_table[0].fh - 1) /* lines per panel */ | ||
444 | | (24 << 10) /* vsync pulse width - 1 */ | ||
445 | | (2 << 16) /* eof pixel count */ | ||
446 | | (0 << 24); /* bof pixel count */ | ||
447 | |||
448 | LCCR3 = 2 /* pixel clock divisor */ | ||
449 | | (24 << 8) /* AC Bias pin freq */ | ||
450 | | LCCR3_16BPP /* BPP */ | ||
451 | | LCCR3_PCP; /* PCP falling edge */ | ||
452 | |||
453 | /* setup dma descriptor */ | ||
454 | par->metromem_desc->mFDADR0 = par->metromem_desc_dma; | ||
455 | par->metromem_desc->mFSADR0 = par->metromem_dma; | ||
456 | par->metromem_desc->mFIDR0 = 0; | ||
457 | par->metromem_desc->mLDCMD0 = epd_frame_table[0].fw | ||
458 | * epd_frame_table[0].fh; | ||
459 | /* reenable lcd controller */ | ||
460 | metronome_enable_lcd_controller(par); | ||
461 | } | ||
462 | |||
463 | static int metronome_display_cmd(struct metronomefb_par *par) | ||
464 | { | ||
465 | int i; | ||
466 | u16 cs; | ||
467 | u16 opcode; | ||
468 | static u8 borderval; | ||
469 | u8 *ptr; | ||
470 | |||
471 | /* setup display command | ||
472 | we can't immediately set the opcode since the controller | ||
473 | will try parse the command before we've set it all up | ||
474 | so we just set cs here and set the opcode at the end */ | ||
475 | |||
476 | ptr = par->metromem; | ||
477 | |||
478 | if (par->metromem_cmd->opcode == 0xCC40) | ||
479 | opcode = cs = 0xCC41; | ||
480 | else | ||
481 | opcode = cs = 0xCC40; | ||
482 | |||
483 | /* set the args ( 2 bytes ) for display */ | ||
484 | i = 0; | ||
485 | par->metromem_cmd->args[i] = 1 << 3 /* border update */ | ||
486 | | ((borderval++ % 4) & 0x0F) << 4 | ||
487 | | (par->frame_count - 1) << 8; | ||
488 | cs += par->metromem_cmd->args[i++]; | ||
489 | |||
490 | /* the rest are 0 */ | ||
491 | memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2); | ||
492 | |||
493 | par->metromem_cmd->csum = cs; | ||
494 | par->metromem_cmd->opcode = opcode; /* display cmd */ | ||
495 | |||
496 | i = wait_event_interruptible_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
497 | return i; | ||
498 | } | ||
499 | |||
500 | static int __devinit metronome_powerup_cmd(struct metronomefb_par *par) | ||
501 | { | ||
502 | int i; | ||
503 | u16 cs; | ||
504 | |||
505 | /* setup power up command */ | ||
506 | par->metromem_cmd->opcode = 0x1234; /* pwr up pseudo cmd */ | ||
507 | cs = par->metromem_cmd->opcode; | ||
508 | |||
509 | /* set pwr1,2,3 to 1024 */ | ||
510 | for (i = 0; i < 3; i++) { | ||
511 | par->metromem_cmd->args[i] = 1024; | ||
512 | cs += par->metromem_cmd->args[i]; | ||
513 | } | ||
514 | |||
515 | /* the rest are 0 */ | ||
516 | memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2); | ||
517 | |||
518 | par->metromem_cmd->csum = cs; | ||
519 | |||
520 | msleep(1); | ||
521 | metronome_set_gpio_output(RST_GPIO_PIN, 1); | ||
522 | |||
523 | msleep(1); | ||
524 | metronome_set_gpio_output(STDBY_GPIO_PIN, 1); | ||
525 | |||
526 | i = wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
527 | return i; | ||
528 | } | ||
529 | |||
530 | static int __devinit metronome_config_cmd(struct metronomefb_par *par) | ||
531 | { | ||
532 | int i; | ||
533 | u16 cs; | ||
534 | |||
535 | /* setup config command | ||
536 | we can't immediately set the opcode since the controller | ||
537 | will try parse the command before we've set it all up | ||
538 | so we just set cs here and set the opcode at the end */ | ||
539 | |||
540 | cs = 0xCC10; | ||
541 | |||
542 | /* set the 12 args ( 8 bytes ) for config. see spec for meanings */ | ||
543 | i = 0; | ||
544 | par->metromem_cmd->args[i] = 15 /* sdlew */ | ||
545 | | 2 << 8 /* sdosz */ | ||
546 | | 0 << 11 /* sdor */ | ||
547 | | 0 << 12 /* sdces */ | ||
548 | | 0 << 15; /* sdcer */ | ||
549 | cs += par->metromem_cmd->args[i++]; | ||
550 | |||
551 | par->metromem_cmd->args[i] = 42 /* gdspl */ | ||
552 | | 1 << 8 /* gdr1 */ | ||
553 | | 1 << 9 /* sdshr */ | ||
554 | | 0 << 15; /* gdspp */ | ||
555 | cs += par->metromem_cmd->args[i++]; | ||
556 | |||
557 | par->metromem_cmd->args[i] = 18 /* gdspw */ | ||
558 | | 0 << 15; /* dispc */ | ||
559 | cs += par->metromem_cmd->args[i++]; | ||
560 | |||
561 | par->metromem_cmd->args[i] = 599 /* vdlc */ | ||
562 | | 0 << 11 /* dsi */ | ||
563 | | 0 << 12; /* dsic */ | ||
564 | cs += par->metromem_cmd->args[i++]; | ||
565 | |||
566 | /* the rest are 0 */ | ||
567 | memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2); | ||
568 | |||
569 | par->metromem_cmd->csum = cs; | ||
570 | par->metromem_cmd->opcode = 0xCC10; /* config cmd */ | ||
571 | |||
572 | i = wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
573 | return i; | ||
574 | } | ||
575 | |||
576 | static int __devinit metronome_init_cmd(struct metronomefb_par *par) | ||
577 | { | ||
578 | int i; | ||
579 | u16 cs; | ||
580 | |||
581 | /* setup init command | ||
582 | we can't immediately set the opcode since the controller | ||
583 | will try parse the command before we've set it all up | ||
584 | so we just set cs here and set the opcode at the end */ | ||
585 | |||
586 | cs = 0xCC20; | ||
587 | |||
588 | /* set the args ( 2 bytes ) for init */ | ||
589 | i = 0; | ||
590 | par->metromem_cmd->args[i] = 0; | ||
591 | cs += par->metromem_cmd->args[i++]; | ||
592 | |||
593 | /* the rest are 0 */ | ||
594 | memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2); | ||
595 | |||
596 | par->metromem_cmd->csum = cs; | ||
597 | par->metromem_cmd->opcode = 0xCC20; /* init cmd */ | ||
598 | |||
599 | i = wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
600 | return i; | ||
601 | } | ||
602 | |||
603 | static int __devinit metronome_init_regs(struct metronomefb_par *par) | ||
604 | { | ||
605 | int res; | ||
606 | |||
607 | metronome_init_gpio_regs(); | ||
608 | metronome_init_lcdc_regs(par); | ||
609 | |||
610 | res = metronome_powerup_cmd(par); | ||
611 | if (res) | ||
612 | return res; | ||
613 | |||
614 | res = metronome_config_cmd(par); | ||
615 | if (res) | ||
616 | return res; | ||
617 | |||
618 | res = metronome_init_cmd(par); | ||
619 | if (res) | ||
620 | return res; | ||
621 | |||
622 | return res; | ||
623 | } | ||
624 | |||
625 | static void metronomefb_dpy_update(struct metronomefb_par *par) | ||
626 | { | ||
627 | u16 cksum; | ||
628 | unsigned char *buf = (unsigned char __force *)par->info->screen_base; | ||
629 | |||
630 | /* copy from vm to metromem */ | ||
631 | memcpy(par->metromem_img, buf, DPY_W*DPY_H); | ||
632 | |||
633 | cksum = calc_img_cksum((u16 *) par->metromem_img, | ||
634 | (epd_frame_table[0].fw * DPY_H)/2); | ||
635 | *((u16 *) (par->metromem_img) + | ||
636 | (epd_frame_table[0].fw * DPY_H)/2) = cksum; | ||
637 | metronome_display_cmd(par); | ||
638 | } | ||
639 | |||
640 | static u16 metronomefb_dpy_update_page(struct metronomefb_par *par, int index) | ||
641 | { | ||
642 | int i; | ||
643 | u16 csum = 0; | ||
644 | u16 *buf = (u16 __force *) (par->info->screen_base + index); | ||
645 | u16 *img = (u16 *) (par->metromem_img + index); | ||
646 | |||
647 | /* swizzle from vm to metromem and recalc cksum at the same time*/ | ||
648 | for (i = 0; i < PAGE_SIZE/2; i++) { | ||
649 | *(img + i) = (buf[i] << 5) & 0xE0E0; | ||
650 | csum += *(img + i); | ||
651 | } | ||
652 | return csum; | ||
653 | } | ||
654 | |||
655 | /* this is called back from the deferred io workqueue */ | ||
656 | static void metronomefb_dpy_deferred_io(struct fb_info *info, | ||
657 | struct list_head *pagelist) | ||
658 | { | ||
659 | u16 cksum; | ||
660 | struct page *cur; | ||
661 | struct fb_deferred_io *fbdefio = info->fbdefio; | ||
662 | struct metronomefb_par *par = info->par; | ||
663 | |||
664 | /* walk the written page list and swizzle the data */ | ||
665 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { | ||
666 | cksum = metronomefb_dpy_update_page(par, | ||
667 | (cur->index << PAGE_SHIFT)); | ||
668 | par->metromem_img_csum -= par->csum_table[cur->index]; | ||
669 | par->csum_table[cur->index] = cksum; | ||
670 | par->metromem_img_csum += cksum; | ||
671 | } | ||
672 | |||
673 | metronome_display_cmd(par); | ||
674 | } | ||
675 | |||
676 | static void metronomefb_fillrect(struct fb_info *info, | ||
677 | const struct fb_fillrect *rect) | ||
678 | { | ||
679 | struct metronomefb_par *par = info->par; | ||
680 | |||
681 | cfb_fillrect(info, rect); | ||
682 | metronomefb_dpy_update(par); | ||
683 | } | ||
684 | |||
685 | static void metronomefb_copyarea(struct fb_info *info, | ||
686 | const struct fb_copyarea *area) | ||
687 | { | ||
688 | struct metronomefb_par *par = info->par; | ||
689 | |||
690 | cfb_copyarea(info, area); | ||
691 | metronomefb_dpy_update(par); | ||
692 | } | ||
693 | |||
694 | static void metronomefb_imageblit(struct fb_info *info, | ||
695 | const struct fb_image *image) | ||
696 | { | ||
697 | struct metronomefb_par *par = info->par; | ||
698 | |||
699 | cfb_imageblit(info, image); | ||
700 | metronomefb_dpy_update(par); | ||
701 | } | ||
702 | |||
703 | /* | ||
704 | * this is the slow path from userspace. they can seek and write to | ||
705 | * the fb. it is based on fb_sys_write | ||
706 | */ | ||
707 | static ssize_t metronomefb_write(struct fb_info *info, const char __user *buf, | ||
708 | size_t count, loff_t *ppos) | ||
709 | { | ||
710 | struct metronomefb_par *par = info->par; | ||
711 | unsigned long p = *ppos; | ||
712 | void *dst; | ||
713 | int err = 0; | ||
714 | unsigned long total_size; | ||
715 | |||
716 | if (info->state != FBINFO_STATE_RUNNING) | ||
717 | return -EPERM; | ||
718 | |||
719 | total_size = info->fix.smem_len; | ||
720 | |||
721 | if (p > total_size) | ||
722 | return -EFBIG; | ||
723 | |||
724 | if (count > total_size) { | ||
725 | err = -EFBIG; | ||
726 | count = total_size; | ||
727 | } | ||
728 | |||
729 | if (count + p > total_size) { | ||
730 | if (!err) | ||
731 | err = -ENOSPC; | ||
732 | |||
733 | count = total_size - p; | ||
734 | } | ||
735 | |||
736 | dst = (void __force *) (info->screen_base + p); | ||
737 | |||
738 | if (copy_from_user(dst, buf, count)) | ||
739 | err = -EFAULT; | ||
740 | |||
741 | if (!err) | ||
742 | *ppos += count; | ||
743 | |||
744 | metronomefb_dpy_update(par); | ||
745 | |||
746 | return (err) ? err : count; | ||
747 | } | ||
748 | |||
749 | static struct fb_ops metronomefb_ops = { | ||
750 | .owner = THIS_MODULE, | ||
751 | .fb_write = metronomefb_write, | ||
752 | .fb_fillrect = metronomefb_fillrect, | ||
753 | .fb_copyarea = metronomefb_copyarea, | ||
754 | .fb_imageblit = metronomefb_imageblit, | ||
755 | }; | ||
756 | |||
757 | static struct fb_deferred_io metronomefb_defio = { | ||
758 | .delay = HZ, | ||
759 | .deferred_io = metronomefb_dpy_deferred_io, | ||
760 | }; | ||
761 | |||
762 | static irqreturn_t metronome_handle_irq(int irq, void *dev_id) | ||
763 | { | ||
764 | struct fb_info *info = dev_id; | ||
765 | struct metronomefb_par *par = info->par; | ||
766 | |||
767 | wake_up_interruptible(&par->waitq); | ||
768 | return IRQ_HANDLED; | ||
769 | } | ||
770 | |||
771 | static int __devinit metronomefb_probe(struct platform_device *dev) | ||
772 | { | ||
773 | struct fb_info *info; | ||
774 | int retval = -ENOMEM; | ||
775 | int videomemorysize; | ||
776 | unsigned char *videomemory; | ||
777 | struct metronomefb_par *par; | ||
778 | const struct firmware *fw_entry; | ||
779 | int cmd_size, wfm_size, img_size, padding_size, totalsize; | ||
780 | int i; | ||
781 | |||
782 | /* we have two blocks of memory. | ||
783 | info->screen_base which is vm, and is the fb used by apps. | ||
784 | par->metromem which is physically contiguous memory and | ||
785 | contains the display controller commands, waveform, | ||
786 | processed image data and padding. this is the data pulled | ||
787 | by the pxa255's LCD controller and pushed to Metronome */ | ||
788 | |||
789 | videomemorysize = (DPY_W*DPY_H); | ||
790 | videomemory = vmalloc(videomemorysize); | ||
791 | if (!videomemory) | ||
792 | return retval; | ||
793 | |||
794 | memset(videomemory, 0, videomemorysize); | ||
795 | |||
796 | info = framebuffer_alloc(sizeof(struct metronomefb_par), &dev->dev); | ||
797 | if (!info) | ||
798 | goto err_vfree; | ||
799 | |||
800 | info->screen_base = (char __iomem *) videomemory; | ||
801 | info->fbops = &metronomefb_ops; | ||
802 | |||
803 | info->var = metronomefb_var; | ||
804 | info->fix = metronomefb_fix; | ||
805 | info->fix.smem_len = videomemorysize; | ||
806 | par = info->par; | ||
807 | par->info = info; | ||
808 | init_waitqueue_head(&par->waitq); | ||
809 | |||
810 | /* this table caches per page csum values. */ | ||
811 | par->csum_table = vmalloc(videomemorysize/PAGE_SIZE); | ||
812 | if (!par->csum_table) | ||
813 | goto err_csum_table; | ||
814 | |||
815 | /* the metromem buffer is divided as follows: | ||
816 | command | CRC | padding | ||
817 | 16kb waveform data | CRC | padding | ||
818 | image data | CRC | ||
819 | and an extra 256 bytes for dma descriptors | ||
820 | eg: IW=832 IH=622 WS=128 | ||
821 | */ | ||
822 | |||
823 | cmd_size = 1 * epd_frame_table[0].fw; | ||
824 | wfm_size = ((16*1024 + 2 + epd_frame_table[0].fw - 1) | ||
825 | / epd_frame_table[0].fw) * epd_frame_table[0].fw; | ||
826 | img_size = epd_frame_table[0].fh * epd_frame_table[0].fw; | ||
827 | padding_size = 4 * epd_frame_table[0].fw; | ||
828 | totalsize = cmd_size + wfm_size + img_size + padding_size; | ||
829 | par->metromemsize = PAGE_ALIGN(totalsize + 256); | ||
830 | DPRINTK("desired memory size = %d\n", par->metromemsize); | ||
831 | dev->dev.coherent_dma_mask = 0xffffffffull; | ||
832 | par->metromem = dma_alloc_writecombine(&dev->dev, par->metromemsize, | ||
833 | &par->metromem_dma, GFP_KERNEL); | ||
834 | if (!par->metromem) { | ||
835 | printk(KERN_ERR | ||
836 | "metronomefb: unable to allocate dma buffer\n"); | ||
837 | goto err_vfree; | ||
838 | } | ||
839 | |||
840 | info->fix.smem_start = par->metromem_dma; | ||
841 | par->metromem_cmd = (struct metromem_cmd *) par->metromem; | ||
842 | par->metromem_wfm = par->metromem + cmd_size; | ||
843 | par->metromem_img = par->metromem + cmd_size + wfm_size; | ||
844 | par->metromem_img_csum = (u16 *) (par->metromem_img + | ||
845 | (epd_frame_table[0].fw * DPY_H)); | ||
846 | DPRINTK("img offset=0x%x\n", cmd_size + wfm_size); | ||
847 | par->metromem_desc = (struct metromem_desc *) (par->metromem + cmd_size | ||
848 | + wfm_size + img_size + padding_size); | ||
849 | par->metromem_desc_dma = par->metromem_dma + cmd_size + wfm_size | ||
850 | + img_size + padding_size; | ||
851 | |||
852 | /* load the waveform in. assume mode 3, temp 31 for now */ | ||
853 | /* a) request the waveform file from userspace | ||
854 | b) process waveform and decode into metromem */ | ||
855 | |||
856 | retval = request_firmware(&fw_entry, "waveform.wbf", &dev->dev); | ||
857 | if (retval < 0) { | ||
858 | printk(KERN_ERR "metronomefb: couldn't get waveform\n"); | ||
859 | goto err_dma_free; | ||
860 | } | ||
861 | |||
862 | retval = load_waveform((u8 *) fw_entry->data, fw_entry->size, | ||
863 | par->metromem_wfm, 3, 31, &par->frame_count); | ||
864 | if (retval < 0) { | ||
865 | printk(KERN_ERR "metronomefb: couldn't process waveform\n"); | ||
866 | goto err_ld_wfm; | ||
867 | } | ||
868 | release_firmware(fw_entry); | ||
869 | |||
870 | retval = request_irq(IRQ_GPIO(RDY_GPIO_PIN), metronome_handle_irq, | ||
871 | IRQF_DISABLED, "Metronome", info); | ||
872 | if (retval) { | ||
873 | dev_err(&dev->dev, "request_irq failed: %d\n", retval); | ||
874 | goto err_ld_wfm; | ||
875 | } | ||
876 | set_irq_type(IRQ_GPIO(RDY_GPIO_PIN), IRQT_FALLING); | ||
877 | |||
878 | retval = metronome_init_regs(par); | ||
879 | if (retval < 0) | ||
880 | goto err_free_irq; | ||
881 | |||
882 | info->flags = FBINFO_FLAG_DEFAULT; | ||
883 | |||
884 | info->fbdefio = &metronomefb_defio; | ||
885 | fb_deferred_io_init(info); | ||
886 | |||
887 | retval = fb_alloc_cmap(&info->cmap, 8, 0); | ||
888 | if (retval < 0) { | ||
889 | printk(KERN_ERR "Failed to allocate colormap\n"); | ||
890 | goto err_fb_rel; | ||
891 | } | ||
892 | |||
893 | /* set cmap */ | ||
894 | for (i = 0; i < 8; i++) | ||
895 | info->cmap.red[i] = (((2*i)+1)*(0xFFFF))/16; | ||
896 | memcpy(info->cmap.green, info->cmap.red, sizeof(u16)*8); | ||
897 | memcpy(info->cmap.blue, info->cmap.red, sizeof(u16)*8); | ||
898 | |||
899 | retval = register_framebuffer(info); | ||
900 | if (retval < 0) | ||
901 | goto err_cmap; | ||
902 | |||
903 | platform_set_drvdata(dev, info); | ||
904 | |||
905 | printk(KERN_INFO | ||
906 | "fb%d: Metronome frame buffer device, using %dK of video" | ||
907 | " memory\n", info->node, videomemorysize >> 10); | ||
908 | |||
909 | return 0; | ||
910 | |||
911 | err_cmap: | ||
912 | fb_dealloc_cmap(&info->cmap); | ||
913 | err_fb_rel: | ||
914 | framebuffer_release(info); | ||
915 | err_free_irq: | ||
916 | free_irq(IRQ_GPIO(RDY_GPIO_PIN), info); | ||
917 | err_ld_wfm: | ||
918 | release_firmware(fw_entry); | ||
919 | err_dma_free: | ||
920 | dma_free_writecombine(&dev->dev, par->metromemsize, par->metromem, | ||
921 | par->metromem_dma); | ||
922 | err_csum_table: | ||
923 | vfree(par->csum_table); | ||
924 | err_vfree: | ||
925 | vfree(videomemory); | ||
926 | return retval; | ||
927 | } | ||
928 | |||
929 | static int __devexit metronomefb_remove(struct platform_device *dev) | ||
930 | { | ||
931 | struct fb_info *info = platform_get_drvdata(dev); | ||
932 | |||
933 | if (info) { | ||
934 | struct metronomefb_par *par = info->par; | ||
935 | fb_deferred_io_cleanup(info); | ||
936 | dma_free_writecombine(&dev->dev, par->metromemsize, | ||
937 | par->metromem, par->metromem_dma); | ||
938 | fb_dealloc_cmap(&info->cmap); | ||
939 | vfree(par->csum_table); | ||
940 | unregister_framebuffer(info); | ||
941 | vfree((void __force *)info->screen_base); | ||
942 | free_irq(IRQ_GPIO(RDY_GPIO_PIN), info); | ||
943 | framebuffer_release(info); | ||
944 | } | ||
945 | return 0; | ||
946 | } | ||
947 | |||
948 | static struct platform_driver metronomefb_driver = { | ||
949 | .probe = metronomefb_probe, | ||
950 | .remove = metronomefb_remove, | ||
951 | .driver = { | ||
952 | .name = "metronomefb", | ||
953 | }, | ||
954 | }; | ||
955 | |||
956 | static struct platform_device *metronomefb_device; | ||
957 | |||
958 | static int __init metronomefb_init(void) | ||
959 | { | ||
960 | int ret; | ||
961 | |||
962 | if (!metronomefb_enable) { | ||
963 | printk(KERN_ERR | ||
964 | "Use metronomefb_enable to enable the device\n"); | ||
965 | return -ENXIO; | ||
966 | } | ||
967 | |||
968 | ret = platform_driver_register(&metronomefb_driver); | ||
969 | if (!ret) { | ||
970 | metronomefb_device = platform_device_alloc("metronomefb", 0); | ||
971 | if (metronomefb_device) | ||
972 | ret = platform_device_add(metronomefb_device); | ||
973 | else | ||
974 | ret = -ENOMEM; | ||
975 | |||
976 | if (ret) { | ||
977 | platform_device_put(metronomefb_device); | ||
978 | platform_driver_unregister(&metronomefb_driver); | ||
979 | } | ||
980 | } | ||
981 | return ret; | ||
982 | |||
983 | } | ||
984 | |||
985 | static void __exit metronomefb_exit(void) | ||
986 | { | ||
987 | platform_device_unregister(metronomefb_device); | ||
988 | platform_driver_unregister(&metronomefb_driver); | ||
989 | } | ||
990 | |||
991 | module_param(metronomefb_enable, uint, 0); | ||
992 | MODULE_PARM_DESC(metronomefb_enable, "Enable communication with Metronome"); | ||
993 | |||
994 | module_init(metronomefb_init); | ||
995 | module_exit(metronomefb_exit); | ||
996 | |||
997 | MODULE_DESCRIPTION("fbdev driver for Metronome controller"); | ||
998 | MODULE_AUTHOR("Jaya Kumar"); | ||
999 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index c8a4332d1132..0b3efc31ee6d 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -152,7 +152,7 @@ static void virtballoon_changed(struct virtio_device *vdev) | |||
152 | wake_up(&vb->config_change); | 152 | wake_up(&vb->config_change); |
153 | } | 153 | } |
154 | 154 | ||
155 | static inline int towards_target(struct virtio_balloon *vb) | 155 | static inline s64 towards_target(struct virtio_balloon *vb) |
156 | { | 156 | { |
157 | u32 v; | 157 | u32 v; |
158 | __virtio_config_val(vb->vdev, | 158 | __virtio_config_val(vb->vdev, |
@@ -176,7 +176,7 @@ static int balloon(void *_vballoon) | |||
176 | 176 | ||
177 | set_freezable(); | 177 | set_freezable(); |
178 | while (!kthread_should_stop()) { | 178 | while (!kthread_should_stop()) { |
179 | int diff; | 179 | s64 diff; |
180 | 180 | ||
181 | try_to_freeze(); | 181 | try_to_freeze(); |
182 | wait_event_interruptible(vb->config_change, | 182 | wait_event_interruptible(vb->config_change, |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 26f787ddd5ff..c0df924766a7 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -37,7 +37,7 @@ struct virtio_pci_device | |||
37 | struct pci_dev *pci_dev; | 37 | struct pci_dev *pci_dev; |
38 | 38 | ||
39 | /* the IO mapping for the PCI config space */ | 39 | /* the IO mapping for the PCI config space */ |
40 | void *ioaddr; | 40 | void __iomem *ioaddr; |
41 | 41 | ||
42 | /* a list of queues so we can dispatch IRQs */ | 42 | /* a list of queues so we can dispatch IRQs */ |
43 | spinlock_t lock; | 43 | spinlock_t lock; |
@@ -111,7 +111,7 @@ static void vp_get(struct virtio_device *vdev, unsigned offset, | |||
111 | void *buf, unsigned len) | 111 | void *buf, unsigned len) |
112 | { | 112 | { |
113 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | 113 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); |
114 | void *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset; | 114 | void __iomem *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset; |
115 | u8 *ptr = buf; | 115 | u8 *ptr = buf; |
116 | int i; | 116 | int i; |
117 | 117 | ||
@@ -125,7 +125,7 @@ static void vp_set(struct virtio_device *vdev, unsigned offset, | |||
125 | const void *buf, unsigned len) | 125 | const void *buf, unsigned len) |
126 | { | 126 | { |
127 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | 127 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); |
128 | void *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset; | 128 | void __iomem *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset; |
129 | const u8 *ptr = buf; | 129 | const u8 *ptr = buf; |
130 | int i; | 130 | int i; |
131 | 131 | ||
@@ -177,6 +177,7 @@ static irqreturn_t vp_interrupt(int irq, void *opaque) | |||
177 | struct virtio_pci_device *vp_dev = opaque; | 177 | struct virtio_pci_device *vp_dev = opaque; |
178 | struct virtio_pci_vq_info *info; | 178 | struct virtio_pci_vq_info *info; |
179 | irqreturn_t ret = IRQ_NONE; | 179 | irqreturn_t ret = IRQ_NONE; |
180 | unsigned long flags; | ||
180 | u8 isr; | 181 | u8 isr; |
181 | 182 | ||
182 | /* reading the ISR has the effect of also clearing it so it's very | 183 | /* reading the ISR has the effect of also clearing it so it's very |
@@ -197,12 +198,12 @@ static irqreturn_t vp_interrupt(int irq, void *opaque) | |||
197 | drv->config_changed(&vp_dev->vdev); | 198 | drv->config_changed(&vp_dev->vdev); |
198 | } | 199 | } |
199 | 200 | ||
200 | spin_lock(&vp_dev->lock); | 201 | spin_lock_irqsave(&vp_dev->lock, flags); |
201 | list_for_each_entry(info, &vp_dev->virtqueues, node) { | 202 | list_for_each_entry(info, &vp_dev->virtqueues, node) { |
202 | if (vring_interrupt(irq, info->vq) == IRQ_HANDLED) | 203 | if (vring_interrupt(irq, info->vq) == IRQ_HANDLED) |
203 | ret = IRQ_HANDLED; | 204 | ret = IRQ_HANDLED; |
204 | } | 205 | } |
205 | spin_unlock(&vp_dev->lock); | 206 | spin_unlock_irqrestore(&vp_dev->lock, flags); |
206 | 207 | ||
207 | return ret; | 208 | return ret; |
208 | } | 209 | } |
@@ -214,6 +215,7 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index, | |||
214 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | 215 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); |
215 | struct virtio_pci_vq_info *info; | 216 | struct virtio_pci_vq_info *info; |
216 | struct virtqueue *vq; | 217 | struct virtqueue *vq; |
218 | unsigned long flags; | ||
217 | u16 num; | 219 | u16 num; |
218 | int err; | 220 | int err; |
219 | 221 | ||
@@ -255,9 +257,9 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index, | |||
255 | vq->priv = info; | 257 | vq->priv = info; |
256 | info->vq = vq; | 258 | info->vq = vq; |
257 | 259 | ||
258 | spin_lock(&vp_dev->lock); | 260 | spin_lock_irqsave(&vp_dev->lock, flags); |
259 | list_add(&info->node, &vp_dev->virtqueues); | 261 | list_add(&info->node, &vp_dev->virtqueues); |
260 | spin_unlock(&vp_dev->lock); | 262 | spin_unlock_irqrestore(&vp_dev->lock, flags); |
261 | 263 | ||
262 | return vq; | 264 | return vq; |
263 | 265 | ||
@@ -274,10 +276,11 @@ static void vp_del_vq(struct virtqueue *vq) | |||
274 | { | 276 | { |
275 | struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); | 277 | struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); |
276 | struct virtio_pci_vq_info *info = vq->priv; | 278 | struct virtio_pci_vq_info *info = vq->priv; |
279 | unsigned long flags; | ||
277 | 280 | ||
278 | spin_lock(&vp_dev->lock); | 281 | spin_lock_irqsave(&vp_dev->lock, flags); |
279 | list_del(&info->node); | 282 | list_del(&info->node); |
280 | spin_unlock(&vp_dev->lock); | 283 | spin_unlock_irqrestore(&vp_dev->lock, flags); |
281 | 284 | ||
282 | vring_del_virtqueue(vq); | 285 | vring_del_virtqueue(vq); |
283 | 286 | ||
@@ -385,6 +388,7 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev) | |||
385 | { | 388 | { |
386 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); | 389 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); |
387 | 390 | ||
391 | unregister_virtio_device(&vp_dev->vdev); | ||
388 | free_irq(pci_dev->irq, vp_dev); | 392 | free_irq(pci_dev->irq, vp_dev); |
389 | pci_set_drvdata(pci_dev, NULL); | 393 | pci_set_drvdata(pci_dev, NULL); |
390 | pci_iounmap(pci_dev, vp_dev->ioaddr); | 394 | pci_iounmap(pci_dev, vp_dev->ioaddr); |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 3a28c1382131..aa714028641e 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -232,7 +232,6 @@ static bool vring_enable_cb(struct virtqueue *_vq) | |||
232 | vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; | 232 | vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; |
233 | mb(); | 233 | mb(); |
234 | if (unlikely(more_used(vq))) { | 234 | if (unlikely(more_used(vq))) { |
235 | vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; | ||
236 | END_USE(vq); | 235 | END_USE(vq); |
237 | return false; | 236 | return false; |
238 | } | 237 | } |