aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-10-03 01:33:17 -0400
committerPaul Mackerras <paulus@samba.org>2007-10-03 01:33:17 -0400
commit70f227d8846a8a9b1f36f71c42e11cc7c6e9408d (patch)
treefb4dd5c8240bdaada819fb569c01a392b52847b9 /drivers
parenta0c7ce9c877ceef8428798ac91fb794f83609aed (diff)
parentf778089cb2445dfc6dfd30a7a567925fd8589f1e (diff)
Merge branch 'linux-2.6' into for-2.6.24
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/processor_core.c2
-rw-r--r--drivers/acpi/processor_idle.c19
-rw-r--r--drivers/acpi/sleep/Makefile4
-rw-r--r--drivers/acpi/sleep/main.c61
-rw-r--r--drivers/acpi/sleep/poweroff.c75
-rw-r--r--drivers/acpi/video.c3
-rw-r--r--drivers/ata/ahci.c10
-rw-r--r--drivers/ata/ata_piix.c7
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/libata-sff.c5
-rw-r--r--drivers/ata/pata_sis.c3
-rw-r--r--drivers/ata/sata_sil24.c16
-rw-r--r--drivers/base/core.c1
-rw-r--r--drivers/cdrom/cdrom.c4
-rw-r--r--drivers/char/drm/i915_drv.h6
-rw-r--r--drivers/char/drm/i915_irq.c12
-rw-r--r--drivers/char/hpet.c9
-rw-r--r--drivers/char/mspec.c26
-rw-r--r--drivers/char/random.c10
-rw-r--r--drivers/char/vt_ioctl.c15
-rw-r--r--drivers/ieee1394/ieee1394_core.c2
-rw-r--r--drivers/ieee1394/ohci1394.c4
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c62
-rw-r--r--drivers/input/joystick/Kconfig2
-rw-r--r--drivers/input/mouse/appletouch.c6
-rw-r--r--drivers/kvm/Kconfig3
-rw-r--r--drivers/lguest/lguest_asm.S6
-rw-r--r--drivers/md/raid5.c17
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c6
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c5
-rw-r--r--drivers/net/bnx2.c7
-rw-r--r--drivers/net/e1000/e1000_ethtool.c1
-rw-r--r--drivers/net/e1000/e1000_hw.c1
-rw-r--r--drivers/net/e1000/e1000_hw.h1
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/mv643xx_eth.c5
-rw-r--r--drivers/net/mv643xx_eth.h4
-rw-r--r--drivers/net/myri10ge/myri10ge.c3
-rw-r--r--drivers/net/pcmcia/3c589_cs.c2
-rw-r--r--drivers/net/phy/phy.c1
-rw-r--r--drivers/net/ppp_mppe.c14
-rw-r--r--drivers/net/pppoe.c3
-rw-r--r--drivers/net/pppol2tp.c118
-rwxr-xr-xdrivers/net/qla3xxx.c7
-rw-r--r--drivers/net/r8169.c14
-rw-r--r--drivers/net/sky2.c408
-rw-r--r--drivers/net/sky2.h41
-rw-r--r--drivers/net/usb/dm9601.c2
-rw-r--r--drivers/net/wireless/Makefile2
-rw-r--r--drivers/pci/quirks.c7
-rw-r--r--drivers/power/power_supply_sysfs.c1
-rw-r--r--drivers/scsi/aic94xx/aic94xx_task.c4
-rw-r--r--drivers/scsi/esp_scsi.c3
-rw-r--r--drivers/scsi/scsi_transport_spi.c28
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.h2
-rw-r--r--drivers/serial/sunsab.c2
-rw-r--r--drivers/w1/w1.c1
57 files changed, 699 insertions, 390 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 2afb3d2086b3..9f11dc296cdd 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -102,6 +102,8 @@ static struct acpi_driver acpi_processor_driver = {
102 .add = acpi_processor_add, 102 .add = acpi_processor_add,
103 .remove = acpi_processor_remove, 103 .remove = acpi_processor_remove,
104 .start = acpi_processor_start, 104 .start = acpi_processor_start,
105 .suspend = acpi_processor_suspend,
106 .resume = acpi_processor_resume,
105 }, 107 },
106}; 108};
107 109
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index d9b8af763e1e..f18261368e76 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -325,6 +325,23 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr,
325 325
326#endif 326#endif
327 327
328/*
329 * Suspend / resume control
330 */
331static int acpi_idle_suspend;
332
333int acpi_processor_suspend(struct acpi_device * device, pm_message_t state)
334{
335 acpi_idle_suspend = 1;
336 return 0;
337}
338
339int acpi_processor_resume(struct acpi_device * device)
340{
341 acpi_idle_suspend = 0;
342 return 0;
343}
344
328static void acpi_processor_idle(void) 345static void acpi_processor_idle(void)
329{ 346{
330 struct acpi_processor *pr = NULL; 347 struct acpi_processor *pr = NULL;
@@ -355,7 +372,7 @@ static void acpi_processor_idle(void)
355 } 372 }
356 373
357 cx = pr->power.state; 374 cx = pr->power.state;
358 if (!cx) { 375 if (!cx || acpi_idle_suspend) {
359 if (pm_idle_save) 376 if (pm_idle_save)
360 pm_idle_save(); 377 pm_idle_save();
361 else 378 else
diff --git a/drivers/acpi/sleep/Makefile b/drivers/acpi/sleep/Makefile
index 195a4f69c0f7..f1fb888c2d29 100644
--- a/drivers/acpi/sleep/Makefile
+++ b/drivers/acpi/sleep/Makefile
@@ -1,5 +1,5 @@
1obj-y := poweroff.o wakeup.o 1obj-y := wakeup.o
2obj-$(CONFIG_ACPI_SLEEP) += main.o 2obj-y += main.o
3obj-$(CONFIG_ACPI_SLEEP) += proc.o 3obj-$(CONFIG_ACPI_SLEEP) += proc.o
4 4
5EXTRA_CFLAGS += $(ACPI_CFLAGS) 5EXTRA_CFLAGS += $(ACPI_CFLAGS)
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index c52ade816fb4..2cbb9aabd00e 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -15,13 +15,39 @@
15#include <linux/dmi.h> 15#include <linux/dmi.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/suspend.h> 17#include <linux/suspend.h>
18
19#include <asm/io.h>
20
18#include <acpi/acpi_bus.h> 21#include <acpi/acpi_bus.h>
19#include <acpi/acpi_drivers.h> 22#include <acpi/acpi_drivers.h>
20#include "sleep.h" 23#include "sleep.h"
21 24
22u8 sleep_states[ACPI_S_STATE_COUNT]; 25u8 sleep_states[ACPI_S_STATE_COUNT];
23 26
27#ifdef CONFIG_PM_SLEEP
24static u32 acpi_target_sleep_state = ACPI_STATE_S0; 28static u32 acpi_target_sleep_state = ACPI_STATE_S0;
29#endif
30
31int acpi_sleep_prepare(u32 acpi_state)
32{
33#ifdef CONFIG_ACPI_SLEEP
34 /* do we have a wakeup address for S2 and S3? */
35 if (acpi_state == ACPI_STATE_S3) {
36 if (!acpi_wakeup_address) {
37 return -EFAULT;
38 }
39 acpi_set_firmware_waking_vector((acpi_physical_address)
40 virt_to_phys((void *)
41 acpi_wakeup_address));
42
43 }
44 ACPI_FLUSH_CPU_CACHE();
45 acpi_enable_wakeup_device_prep(acpi_state);
46#endif
47 acpi_gpe_sleep_prepare(acpi_state);
48 acpi_enter_sleep_state_prep(acpi_state);
49 return 0;
50}
25 51
26#ifdef CONFIG_SUSPEND 52#ifdef CONFIG_SUSPEND
27static struct pm_ops acpi_pm_ops; 53static struct pm_ops acpi_pm_ops;
@@ -275,6 +301,7 @@ int acpi_suspend(u32 acpi_state)
275 return -EINVAL; 301 return -EINVAL;
276} 302}
277 303
304#ifdef CONFIG_PM_SLEEP
278/** 305/**
279 * acpi_pm_device_sleep_state - return preferred power state of ACPI device 306 * acpi_pm_device_sleep_state - return preferred power state of ACPI device
280 * in the system sleep state given by %acpi_target_sleep_state 307 * in the system sleep state given by %acpi_target_sleep_state
@@ -349,6 +376,21 @@ int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p)
349 *d_min_p = d_min; 376 *d_min_p = d_min;
350 return d_max; 377 return d_max;
351} 378}
379#endif
380
381static void acpi_power_off_prepare(void)
382{
383 /* Prepare to power off the system */
384 acpi_sleep_prepare(ACPI_STATE_S5);
385}
386
387static void acpi_power_off(void)
388{
389 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
390 printk("%s called\n", __FUNCTION__);
391 local_irq_disable();
392 acpi_enter_sleep_state(ACPI_STATE_S5);
393}
352 394
353int __init acpi_sleep_init(void) 395int __init acpi_sleep_init(void)
354{ 396{
@@ -363,16 +405,17 @@ int __init acpi_sleep_init(void)
363 if (acpi_disabled) 405 if (acpi_disabled)
364 return 0; 406 return 0;
365 407
408 sleep_states[ACPI_STATE_S0] = 1;
409 printk(KERN_INFO PREFIX "(supports S0");
410
366#ifdef CONFIG_SUSPEND 411#ifdef CONFIG_SUSPEND
367 printk(KERN_INFO PREFIX "(supports"); 412 for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) {
368 for (i = ACPI_STATE_S0; i < ACPI_STATE_S4; i++) {
369 status = acpi_get_sleep_type_data(i, &type_a, &type_b); 413 status = acpi_get_sleep_type_data(i, &type_a, &type_b);
370 if (ACPI_SUCCESS(status)) { 414 if (ACPI_SUCCESS(status)) {
371 sleep_states[i] = 1; 415 sleep_states[i] = 1;
372 printk(" S%d", i); 416 printk(" S%d", i);
373 } 417 }
374 } 418 }
375 printk(")\n");
376 419
377 pm_set_ops(&acpi_pm_ops); 420 pm_set_ops(&acpi_pm_ops);
378#endif 421#endif
@@ -382,10 +425,16 @@ int __init acpi_sleep_init(void)
382 if (ACPI_SUCCESS(status)) { 425 if (ACPI_SUCCESS(status)) {
383 hibernation_set_ops(&acpi_hibernation_ops); 426 hibernation_set_ops(&acpi_hibernation_ops);
384 sleep_states[ACPI_STATE_S4] = 1; 427 sleep_states[ACPI_STATE_S4] = 1;
428 printk(" S4");
385 } 429 }
386#else
387 sleep_states[ACPI_STATE_S4] = 0;
388#endif 430#endif
389 431 status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
432 if (ACPI_SUCCESS(status)) {
433 sleep_states[ACPI_STATE_S5] = 1;
434 printk(" S5");
435 pm_power_off_prepare = acpi_power_off_prepare;
436 pm_power_off = acpi_power_off;
437 }
438 printk(")\n");
390 return 0; 439 return 0;
391} 440}
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c
deleted file mode 100644
index 39e40d56b034..000000000000
--- a/drivers/acpi/sleep/poweroff.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * poweroff.c - ACPI handler for powering off the system.
3 *
4 * AKA S5, but it is independent of whether or not the kernel supports
5 * any other sleep support in the system.
6 *
7 * Copyright (c) 2005 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
8 *
9 * This file is released under the GPLv2.
10 */
11
12#include <linux/pm.h>
13#include <linux/init.h>
14#include <acpi/acpi_bus.h>
15#include <linux/sysdev.h>
16#include <asm/io.h>
17#include "sleep.h"
18
19int acpi_sleep_prepare(u32 acpi_state)
20{
21#ifdef CONFIG_ACPI_SLEEP
22 /* do we have a wakeup address for S2 and S3? */
23 if (acpi_state == ACPI_STATE_S3) {
24 if (!acpi_wakeup_address) {
25 return -EFAULT;
26 }
27 acpi_set_firmware_waking_vector((acpi_physical_address)
28 virt_to_phys((void *)
29 acpi_wakeup_address));
30
31 }
32 ACPI_FLUSH_CPU_CACHE();
33 acpi_enable_wakeup_device_prep(acpi_state);
34#endif
35 acpi_gpe_sleep_prepare(acpi_state);
36 acpi_enter_sleep_state_prep(acpi_state);
37 return 0;
38}
39
40#ifdef CONFIG_PM
41
42static void acpi_power_off_prepare(void)
43{
44 /* Prepare to power off the system */
45 acpi_sleep_prepare(ACPI_STATE_S5);
46}
47
48static void acpi_power_off(void)
49{
50 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
51 printk("%s called\n", __FUNCTION__);
52 local_irq_disable();
53 /* Some SMP machines only can poweroff in boot CPU */
54 acpi_enter_sleep_state(ACPI_STATE_S5);
55}
56
57static int acpi_poweroff_init(void)
58{
59 if (!acpi_disabled) {
60 u8 type_a, type_b;
61 acpi_status status;
62
63 status =
64 acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
65 if (ACPI_SUCCESS(status)) {
66 pm_power_off_prepare = acpi_power_off_prepare;
67 pm_power_off = acpi_power_off;
68 }
69 }
70 return 0;
71}
72
73late_initcall(acpi_poweroff_init);
74
75#endif /* CONFIG_PM */
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 3c9bb85a6a93..d05891f16282 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -417,7 +417,6 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
417 arg0.integer.value = level; 417 arg0.integer.value = level;
418 status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL); 418 status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
419 419
420 printk(KERN_DEBUG "set_level status: %x\n", status);
421 return status; 420 return status;
422} 421}
423 422
@@ -1754,7 +1753,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1754 1753
1755static int acpi_video_bus_start_devices(struct acpi_video_bus *video) 1754static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
1756{ 1755{
1757 return acpi_video_bus_DOS(video, 1, 0); 1756 return acpi_video_bus_DOS(video, 0, 0);
1758} 1757}
1759 1758
1760static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) 1759static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 06f212ff2b4f..c16820325d7b 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -418,10 +418,12 @@ static const struct pci_device_id ahci_pci_tbl[] = {
418 418
419 /* ATI */ 419 /* ATI */
420 { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */ 420 { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */
421 { PCI_VDEVICE(ATI, 0x4390), board_ahci_sb600 }, /* ATI SB700 IDE */ 421 { PCI_VDEVICE(ATI, 0x4390), board_ahci_sb600 }, /* ATI SB700/800 */
422 { PCI_VDEVICE(ATI, 0x4391), board_ahci_sb600 }, /* ATI SB700 AHCI */ 422 { PCI_VDEVICE(ATI, 0x4391), board_ahci_sb600 }, /* ATI SB700/800 */
423 { PCI_VDEVICE(ATI, 0x4392), board_ahci_sb600 }, /* ATI SB700 nraid5 */ 423 { PCI_VDEVICE(ATI, 0x4392), board_ahci_sb600 }, /* ATI SB700/800 */
424 { PCI_VDEVICE(ATI, 0x4393), board_ahci_sb600 }, /* ATI SB700 raid5 */ 424 { PCI_VDEVICE(ATI, 0x4393), board_ahci_sb600 }, /* ATI SB700/800 */
425 { PCI_VDEVICE(ATI, 0x4394), board_ahci_sb600 }, /* ATI SB700/800 */
426 { PCI_VDEVICE(ATI, 0x4395), board_ahci_sb600 }, /* ATI SB700/800 */
425 427
426 /* VIA */ 428 /* VIA */
427 { PCI_VDEVICE(VIA, 0x3349), board_ahci_vt8251 }, /* VIA VT8251 */ 429 { PCI_VDEVICE(VIA, 0x3349), board_ahci_vt8251 }, /* VIA VT8251 */
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 3b8bf1812dc8..6996eb5b7506 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -921,6 +921,13 @@ static int piix_broken_suspend(void)
921{ 921{
922 static struct dmi_system_id sysids[] = { 922 static struct dmi_system_id sysids[] = {
923 { 923 {
924 .ident = "TECRA M3",
925 .matches = {
926 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
927 DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M3"),
928 },
929 },
930 {
924 .ident = "TECRA M5", 931 .ident = "TECRA M5",
925 .matches = { 932 .matches = {
926 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 933 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c43de9a710db..772be09b4689 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3778,6 +3778,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3778 { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ }, 3778 { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ },
3779 { "Maxtor 6B200M0", "BANC1BM0", ATA_HORKAGE_NONCQ }, 3779 { "Maxtor 6B200M0", "BANC1BM0", ATA_HORKAGE_NONCQ },
3780 { "Maxtor 6B200M0", "BANC1B10", ATA_HORKAGE_NONCQ }, 3780 { "Maxtor 6B200M0", "BANC1B10", ATA_HORKAGE_NONCQ },
3781 { "Maxtor 7B250S0", "BANC1B70", ATA_HORKAGE_NONCQ, },
3782 { "Maxtor 7B300S0", "BANC1B70", ATA_HORKAGE_NONCQ },
3783 { "Maxtor 7V300F0", "VA111630", ATA_HORKAGE_NONCQ },
3781 { "HITACHI HDS7250SASUN500G 0621KTAWSD", "K2AOAJ0AHITACHI", 3784 { "HITACHI HDS7250SASUN500G 0621KTAWSD", "K2AOAJ0AHITACHI",
3782 ATA_HORKAGE_NONCQ }, 3785 ATA_HORKAGE_NONCQ },
3783 /* NCQ hard hangs device under heavier load, needs hard power cycle */ 3786 /* NCQ hard hangs device under heavier load, needs hard power cycle */
@@ -3794,6 +3797,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3794 { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, 3797 { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, },
3795 { "FUJITSU MHV2080BH", "00840028", ATA_HORKAGE_NONCQ, }, 3798 { "FUJITSU MHV2080BH", "00840028", ATA_HORKAGE_NONCQ, },
3796 { "ST9160821AS", "3.CLF", ATA_HORKAGE_NONCQ, }, 3799 { "ST9160821AS", "3.CLF", ATA_HORKAGE_NONCQ, },
3800 { "ST3160812AS", "3.AD", ATA_HORKAGE_NONCQ, },
3797 { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, 3801 { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, },
3798 3802
3799 /* devices which puke on READ_NATIVE_MAX */ 3803 /* devices which puke on READ_NATIVE_MAX */
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 1cce2198baaf..8023167bbbeb 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -297,7 +297,7 @@ void ata_bmdma_start (struct ata_queued_cmd *qc)
297 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 297 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
298 iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 298 iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
299 299
300 /* Strictly, one may wish to issue a readb() here, to 300 /* Strictly, one may wish to issue an ioread8() here, to
301 * flush the mmio write. However, control also passes 301 * flush the mmio write. However, control also passes
302 * to the hardware at this point, and it will interrupt 302 * to the hardware at this point, and it will interrupt
303 * us when we are to resume control. So, in effect, 303 * us when we are to resume control. So, in effect,
@@ -307,6 +307,9 @@ void ata_bmdma_start (struct ata_queued_cmd *qc)
307 * is expected, so I think it is best to not add a readb() 307 * is expected, so I think it is best to not add a readb()
308 * without first all the MMIO ATA cards/mobos. 308 * without first all the MMIO ATA cards/mobos.
309 * Or maybe I'm just being paranoid. 309 * Or maybe I'm just being paranoid.
310 *
311 * FIXME: The posting of this write means I/O starts are
312 * unneccessarily delayed for MMIO
310 */ 313 */
311} 314}
312 315
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 2bd7645f1a88..cce2834b2b60 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -375,8 +375,9 @@ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev)
375 int drive_pci = sis_old_port_base(adev); 375 int drive_pci = sis_old_port_base(adev);
376 u16 timing; 376 u16 timing;
377 377
378 /* MWDMA 0-2 and UDMA 0-5 */
378 const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 }; 379 const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 };
379 const u16 udma_bits[] = { 0xF000, 0xD000, 0xB000, 0xA000, 0x9000}; 380 const u16 udma_bits[] = { 0xF000, 0xD000, 0xB000, 0xA000, 0x9000, 0x8000 };
380 381
381 pci_read_config_word(pdev, drive_pci, &timing); 382 pci_read_config_word(pdev, drive_pci, &timing);
382 383
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index ef83e6b1e314..233e88693395 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -888,6 +888,16 @@ static inline void sil24_host_intr(struct ata_port *ap)
888 u32 slot_stat, qc_active; 888 u32 slot_stat, qc_active;
889 int rc; 889 int rc;
890 890
891 /* If PCIX_IRQ_WOC, there's an inherent race window between
892 * clearing IRQ pending status and reading PORT_SLOT_STAT
893 * which may cause spurious interrupts afterwards. This is
894 * unavoidable and much better than losing interrupts which
895 * happens if IRQ pending is cleared after reading
896 * PORT_SLOT_STAT.
897 */
898 if (ap->flags & SIL24_FLAG_PCIX_IRQ_WOC)
899 writel(PORT_IRQ_COMPLETE, port + PORT_IRQ_STAT);
900
891 slot_stat = readl(port + PORT_SLOT_STAT); 901 slot_stat = readl(port + PORT_SLOT_STAT);
892 902
893 if (unlikely(slot_stat & HOST_SSTAT_ATTN)) { 903 if (unlikely(slot_stat & HOST_SSTAT_ATTN)) {
@@ -895,9 +905,6 @@ static inline void sil24_host_intr(struct ata_port *ap)
895 return; 905 return;
896 } 906 }
897 907
898 if (ap->flags & SIL24_FLAG_PCIX_IRQ_WOC)
899 writel(PORT_IRQ_COMPLETE, port + PORT_IRQ_STAT);
900
901 qc_active = slot_stat & ~HOST_SSTAT_ATTN; 908 qc_active = slot_stat & ~HOST_SSTAT_ATTN;
902 rc = ata_qc_complete_multiple(ap, qc_active, sil24_finish_qc); 909 rc = ata_qc_complete_multiple(ap, qc_active, sil24_finish_qc);
903 if (rc > 0) 910 if (rc > 0)
@@ -910,7 +917,8 @@ static inline void sil24_host_intr(struct ata_port *ap)
910 return; 917 return;
911 } 918 }
912 919
913 if (ata_ratelimit()) 920 /* spurious interrupts are expected if PCIX_IRQ_WOC */
921 if (!(ap->flags & SIL24_FLAG_PCIX_IRQ_WOC) && ata_ratelimit())
914 ata_port_printk(ap, KERN_INFO, "spurious interrupt " 922 ata_port_printk(ap, KERN_INFO, "spurious interrupt "
915 "(slot_stat 0x%x active_tag %d sactive 0x%x)\n", 923 "(slot_stat 0x%x active_tag %d sactive 0x%x)\n",
916 slot_stat, ap->active_tag, ap->sactive); 924 slot_stat, ap->active_tag, ap->sactive);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 6de33d7a29ba..67c92582d6ef 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -284,6 +284,7 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
284 284
285 /* let the kset specific function add its keys */ 285 /* let the kset specific function add its keys */
286 pos = data; 286 pos = data;
287 memset(envp, 0, sizeof(envp));
287 retval = kset->uevent_ops->uevent(kset, &dev->kobj, 288 retval = kset->uevent_ops->uevent(kset, &dev->kobj,
288 envp, ARRAY_SIZE(envp), 289 envp, ARRAY_SIZE(envp),
289 pos, PAGE_SIZE); 290 pos, PAGE_SIZE);
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 67ee3d4b2878..79245714f0a7 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -1032,6 +1032,10 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
1032 check_disk_change(ip->i_bdev); 1032 check_disk_change(ip->i_bdev);
1033 return 0; 1033 return 0;
1034err_release: 1034err_release:
1035 if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) {
1036 cdi->ops->lock_door(cdi, 0);
1037 cdinfo(CD_OPEN, "door unlocked.\n");
1038 }
1035 cdi->ops->release(cdi); 1039 cdi->ops->release(cdi);
1036err: 1040err:
1037 cdi->use_count--; 1041 cdi->use_count--;
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index 737088bd0780..28b98733beb8 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -210,6 +210,12 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
210#define I915REG_INT_MASK_R 0x020a8 210#define I915REG_INT_MASK_R 0x020a8
211#define I915REG_INT_ENABLE_R 0x020a0 211#define I915REG_INT_ENABLE_R 0x020a0
212 212
213#define I915REG_PIPEASTAT 0x70024
214#define I915REG_PIPEBSTAT 0x71024
215
216#define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
217#define I915_VBLANK_CLEAR (1UL<<1)
218
213#define SRX_INDEX 0x3c4 219#define SRX_INDEX 0x3c4
214#define SRX_DATA 0x3c5 220#define SRX_DATA 0x3c5
215#define SR01 1 221#define SR01 1
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
index 4b4b2ce89863..bb8e9e9c8201 100644
--- a/drivers/char/drm/i915_irq.c
+++ b/drivers/char/drm/i915_irq.c
@@ -214,6 +214,10 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
214 struct drm_device *dev = (struct drm_device *) arg; 214 struct drm_device *dev = (struct drm_device *) arg;
215 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 215 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
216 u16 temp; 216 u16 temp;
217 u32 pipea_stats, pipeb_stats;
218
219 pipea_stats = I915_READ(I915REG_PIPEASTAT);
220 pipeb_stats = I915_READ(I915REG_PIPEBSTAT);
217 221
218 temp = I915_READ16(I915REG_INT_IDENTITY_R); 222 temp = I915_READ16(I915REG_INT_IDENTITY_R);
219 223
@@ -225,6 +229,8 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
225 return IRQ_NONE; 229 return IRQ_NONE;
226 230
227 I915_WRITE16(I915REG_INT_IDENTITY_R, temp); 231 I915_WRITE16(I915REG_INT_IDENTITY_R, temp);
232 (void) I915_READ16(I915REG_INT_IDENTITY_R);
233 DRM_READMEMORYBARRIER();
228 234
229 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); 235 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
230 236
@@ -252,6 +258,12 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
252 258
253 if (dev_priv->swaps_pending > 0) 259 if (dev_priv->swaps_pending > 0)
254 drm_locked_tasklet(dev, i915_vblank_tasklet); 260 drm_locked_tasklet(dev, i915_vblank_tasklet);
261 I915_WRITE(I915REG_PIPEASTAT,
262 pipea_stats|I915_VBLANK_INTERRUPT_ENABLE|
263 I915_VBLANK_CLEAR);
264 I915_WRITE(I915REG_PIPEBSTAT,
265 pipeb_stats|I915_VBLANK_INTERRUPT_ENABLE|
266 I915_VBLANK_CLEAR);
255 } 267 }
256 268
257 return IRQ_HANDLED; 269 return IRQ_HANDLED;
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 7ecffc9c738f..4c16778e3f84 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -62,6 +62,8 @@
62 62
63static u32 hpet_nhpet, hpet_max_freq = HPET_USER_FREQ; 63static u32 hpet_nhpet, hpet_max_freq = HPET_USER_FREQ;
64 64
65/* This clocksource driver currently only works on ia64 */
66#ifdef CONFIG_IA64
65static void __iomem *hpet_mctr; 67static void __iomem *hpet_mctr;
66 68
67static cycle_t read_hpet(void) 69static cycle_t read_hpet(void)
@@ -79,6 +81,7 @@ static struct clocksource clocksource_hpet = {
79 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 81 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
80}; 82};
81static struct clocksource *hpet_clocksource; 83static struct clocksource *hpet_clocksource;
84#endif
82 85
83/* A lock for concurrent access by app and isr hpet activity. */ 86/* A lock for concurrent access by app and isr hpet activity. */
84static DEFINE_SPINLOCK(hpet_lock); 87static DEFINE_SPINLOCK(hpet_lock);
@@ -943,14 +946,14 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
943 printk(KERN_DEBUG "%s: 0x%lx is busy\n", 946 printk(KERN_DEBUG "%s: 0x%lx is busy\n",
944 __FUNCTION__, hdp->hd_phys_address); 947 __FUNCTION__, hdp->hd_phys_address);
945 iounmap(hdp->hd_address); 948 iounmap(hdp->hd_address);
946 return -EBUSY; 949 return AE_ALREADY_EXISTS;
947 } 950 }
948 } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) { 951 } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) {
949 struct acpi_resource_fixed_memory32 *fixmem32; 952 struct acpi_resource_fixed_memory32 *fixmem32;
950 953
951 fixmem32 = &res->data.fixed_memory32; 954 fixmem32 = &res->data.fixed_memory32;
952 if (!fixmem32) 955 if (!fixmem32)
953 return -EINVAL; 956 return AE_NO_MEMORY;
954 957
955 hdp->hd_phys_address = fixmem32->address; 958 hdp->hd_phys_address = fixmem32->address;
956 hdp->hd_address = ioremap(fixmem32->address, 959 hdp->hd_address = ioremap(fixmem32->address,
@@ -960,7 +963,7 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
960 printk(KERN_DEBUG "%s: 0x%lx is busy\n", 963 printk(KERN_DEBUG "%s: 0x%lx is busy\n",
961 __FUNCTION__, hdp->hd_phys_address); 964 __FUNCTION__, hdp->hd_phys_address);
962 iounmap(hdp->hd_address); 965 iounmap(hdp->hd_address);
963 return -EBUSY; 966 return AE_ALREADY_EXISTS;
964 } 967 }
965 } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { 968 } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) {
966 struct acpi_resource_extended_irq *irqp; 969 struct acpi_resource_extended_irq *irqp;
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c
index 049a46cc9f87..04ac155d3a07 100644
--- a/drivers/char/mspec.c
+++ b/drivers/char/mspec.c
@@ -155,23 +155,22 @@ mspec_open(struct vm_area_struct *vma)
155 * mspec_close 155 * mspec_close
156 * 156 *
157 * Called when unmapping a device mapping. Frees all mspec pages 157 * Called when unmapping a device mapping. Frees all mspec pages
158 * belonging to the vma. 158 * belonging to all the vma's sharing this vma_data structure.
159 */ 159 */
160static void 160static void
161mspec_close(struct vm_area_struct *vma) 161mspec_close(struct vm_area_struct *vma)
162{ 162{
163 struct vma_data *vdata; 163 struct vma_data *vdata;
164 int index, last_index, result; 164 int index, last_index;
165 unsigned long my_page; 165 unsigned long my_page;
166 166
167 vdata = vma->vm_private_data; 167 vdata = vma->vm_private_data;
168 168
169 BUG_ON(vma->vm_start < vdata->vm_start || vma->vm_end > vdata->vm_end); 169 if (!atomic_dec_and_test(&vdata->refcnt))
170 return;
170 171
171 spin_lock(&vdata->lock); 172 last_index = (vdata->vm_end - vdata->vm_start) >> PAGE_SHIFT;
172 index = (vma->vm_start - vdata->vm_start) >> PAGE_SHIFT; 173 for (index = 0; index < last_index; index++) {
173 last_index = (vma->vm_end - vdata->vm_start) >> PAGE_SHIFT;
174 for (; index < last_index; index++) {
175 if (vdata->maddr[index] == 0) 174 if (vdata->maddr[index] == 0)
176 continue; 175 continue;
177 /* 176 /*
@@ -180,20 +179,12 @@ mspec_close(struct vm_area_struct *vma)
180 */ 179 */
181 my_page = vdata->maddr[index]; 180 my_page = vdata->maddr[index];
182 vdata->maddr[index] = 0; 181 vdata->maddr[index] = 0;
183 spin_unlock(&vdata->lock); 182 if (!mspec_zero_block(my_page, PAGE_SIZE))
184 result = mspec_zero_block(my_page, PAGE_SIZE);
185 if (!result)
186 uncached_free_page(my_page); 183 uncached_free_page(my_page);
187 else 184 else
188 printk(KERN_WARNING "mspec_close(): " 185 printk(KERN_WARNING "mspec_close(): "
189 "failed to zero page %i\n", 186 "failed to zero page %ld\n", my_page);
190 result);
191 spin_lock(&vdata->lock);
192 } 187 }
193 spin_unlock(&vdata->lock);
194
195 if (!atomic_dec_and_test(&vdata->refcnt))
196 return;
197 188
198 if (vdata->flags & VMD_VMALLOCED) 189 if (vdata->flags & VMD_VMALLOCED)
199 vfree(vdata); 190 vfree(vdata);
@@ -201,7 +192,6 @@ mspec_close(struct vm_area_struct *vma)
201 kfree(vdata); 192 kfree(vdata);
202} 193}
203 194
204
205/* 195/*
206 * mspec_nopfn 196 * mspec_nopfn
207 * 197 *
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 397c714cf2ba..af274e5a25ee 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1550,11 +1550,13 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
1550 * As close as possible to RFC 793, which 1550 * As close as possible to RFC 793, which
1551 * suggests using a 250 kHz clock. 1551 * suggests using a 250 kHz clock.
1552 * Further reading shows this assumes 2 Mb/s networks. 1552 * Further reading shows this assumes 2 Mb/s networks.
1553 * For 10 Gb/s Ethernet, a 1 GHz clock is appropriate. 1553 * For 10 Mb/s Ethernet, a 1 MHz clock is appropriate.
1554 * That's funny, Linux has one built in! Use it! 1554 * For 10 Gb/s Ethernet, a 1 GHz clock should be ok, but
1555 * (Networks are faster now - should this be increased?) 1555 * we also need to limit the resolution so that the u32 seq
1556 * overlaps less than one time per MSL (2 minutes).
1557 * Choosing a clock of 64 ns period is OK. (period of 274 s)
1556 */ 1558 */
1557 seq += ktime_get_real().tv64; 1559 seq += ktime_get_real().tv64 >> 6;
1558#if 0 1560#if 0
1559 printk("init_seq(%lx, %lx, %d, %d) = %d\n", 1561 printk("init_seq(%lx, %lx, %d, %d) = %d\n",
1560 saddr, daddr, sport, dport, seq); 1562 saddr, daddr, sport, dport, seq);
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index c6f6f4209739..c799b7f7bbb3 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -770,6 +770,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
770 /* 770 /*
771 * Switching-from response 771 * Switching-from response
772 */ 772 */
773 acquire_console_sem();
773 if (vc->vt_newvt >= 0) { 774 if (vc->vt_newvt >= 0) {
774 if (arg == 0) 775 if (arg == 0)
775 /* 776 /*
@@ -784,7 +785,6 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
784 * complete the switch. 785 * complete the switch.
785 */ 786 */
786 int newvt; 787 int newvt;
787 acquire_console_sem();
788 newvt = vc->vt_newvt; 788 newvt = vc->vt_newvt;
789 vc->vt_newvt = -1; 789 vc->vt_newvt = -1;
790 i = vc_allocate(newvt); 790 i = vc_allocate(newvt);
@@ -798,7 +798,6 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
798 * other console switches.. 798 * other console switches..
799 */ 799 */
800 complete_change_console(vc_cons[newvt].d); 800 complete_change_console(vc_cons[newvt].d);
801 release_console_sem();
802 } 801 }
803 } 802 }
804 803
@@ -810,9 +809,12 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
810 /* 809 /*
811 * If it's just an ACK, ignore it 810 * If it's just an ACK, ignore it
812 */ 811 */
813 if (arg != VT_ACKACQ) 812 if (arg != VT_ACKACQ) {
813 release_console_sem();
814 return -EINVAL; 814 return -EINVAL;
815 }
815 } 816 }
817 release_console_sem();
816 818
817 return 0; 819 return 0;
818 820
@@ -1208,15 +1210,18 @@ void change_console(struct vc_data *new_vc)
1208 /* 1210 /*
1209 * Send the signal as privileged - kill_pid() will 1211 * Send the signal as privileged - kill_pid() will
1210 * tell us if the process has gone or something else 1212 * tell us if the process has gone or something else
1211 * is awry 1213 * is awry.
1214 *
1215 * We need to set vt_newvt *before* sending the signal or we
1216 * have a race.
1212 */ 1217 */
1218 vc->vt_newvt = new_vc->vc_num;
1213 if (kill_pid(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) { 1219 if (kill_pid(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) {
1214 /* 1220 /*
1215 * It worked. Mark the vt to switch to and 1221 * It worked. Mark the vt to switch to and
1216 * return. The process needs to send us a 1222 * return. The process needs to send us a
1217 * VT_RELDISP ioctl to complete the switch. 1223 * VT_RELDISP ioctl to complete the switch.
1218 */ 1224 */
1219 vc->vt_newvt = new_vc->vc_num;
1220 return; 1225 return;
1221 } 1226 }
1222 1227
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
index ee45259573c8..98fd985a32ff 100644
--- a/drivers/ieee1394/ieee1394_core.c
+++ b/drivers/ieee1394/ieee1394_core.c
@@ -1273,7 +1273,7 @@ static void __exit ieee1394_cleanup(void)
1273 unregister_chrdev_region(IEEE1394_CORE_DEV, 256); 1273 unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
1274} 1274}
1275 1275
1276fs_initcall(ieee1394_init); /* same as ohci1394 */ 1276module_init(ieee1394_init);
1277module_exit(ieee1394_cleanup); 1277module_exit(ieee1394_cleanup);
1278 1278
1279/* Exported symbols */ 1279/* Exported symbols */
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 5667c8102efc..372c5c16eb31 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -3537,7 +3537,5 @@ static int __init ohci1394_init(void)
3537 return pci_register_driver(&ohci1394_pci_driver); 3537 return pci_register_driver(&ohci1394_pci_driver);
3538} 3538}
3539 3539
3540/* Register before most other device drivers. 3540module_init(ohci1394_init);
3541 * Useful for remote debugging via physical DMA, e.g. using firescope. */
3542fs_initcall(ohci1394_init);
3543module_exit(ohci1394_cleanup); 3541module_exit(ohci1394_cleanup);
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index ba0428d872aa..85c51bdc36f1 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1211,12 +1211,42 @@ static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg,
1211 dseg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey); 1211 dseg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey);
1212} 1212}
1213 1213
1214static void set_data_seg(struct mlx4_wqe_data_seg *dseg, 1214static void set_mlx_icrc_seg(void *dseg)
1215 struct ib_sge *sg) 1215{
1216 u32 *t = dseg;
1217 struct mlx4_wqe_inline_seg *iseg = dseg;
1218
1219 t[1] = 0;
1220
1221 /*
1222 * Need a barrier here before writing the byte_count field to
1223 * make sure that all the data is visible before the
1224 * byte_count field is set. Otherwise, if the segment begins
1225 * a new cacheline, the HCA prefetcher could grab the 64-byte
1226 * chunk and get a valid (!= * 0xffffffff) byte count but
1227 * stale data, and end up sending the wrong data.
1228 */
1229 wmb();
1230
1231 iseg->byte_count = cpu_to_be32((1 << 31) | 4);
1232}
1233
1234static void set_data_seg(struct mlx4_wqe_data_seg *dseg, struct ib_sge *sg)
1216{ 1235{
1217 dseg->byte_count = cpu_to_be32(sg->length);
1218 dseg->lkey = cpu_to_be32(sg->lkey); 1236 dseg->lkey = cpu_to_be32(sg->lkey);
1219 dseg->addr = cpu_to_be64(sg->addr); 1237 dseg->addr = cpu_to_be64(sg->addr);
1238
1239 /*
1240 * Need a barrier here before writing the byte_count field to
1241 * make sure that all the data is visible before the
1242 * byte_count field is set. Otherwise, if the segment begins
1243 * a new cacheline, the HCA prefetcher could grab the 64-byte
1244 * chunk and get a valid (!= * 0xffffffff) byte count but
1245 * stale data, and end up sending the wrong data.
1246 */
1247 wmb();
1248
1249 dseg->byte_count = cpu_to_be32(sg->length);
1220} 1250}
1221 1251
1222int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, 1252int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
@@ -1225,6 +1255,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1225 struct mlx4_ib_qp *qp = to_mqp(ibqp); 1255 struct mlx4_ib_qp *qp = to_mqp(ibqp);
1226 void *wqe; 1256 void *wqe;
1227 struct mlx4_wqe_ctrl_seg *ctrl; 1257 struct mlx4_wqe_ctrl_seg *ctrl;
1258 struct mlx4_wqe_data_seg *dseg;
1228 unsigned long flags; 1259 unsigned long flags;
1229 int nreq; 1260 int nreq;
1230 int err = 0; 1261 int err = 0;
@@ -1324,22 +1355,27 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1324 break; 1355 break;
1325 } 1356 }
1326 1357
1327 for (i = 0; i < wr->num_sge; ++i) { 1358 /*
1328 set_data_seg(wqe, wr->sg_list + i); 1359 * Write data segments in reverse order, so as to
1360 * overwrite cacheline stamp last within each
1361 * cacheline. This avoids issues with WQE
1362 * prefetching.
1363 */
1329 1364
1330 wqe += sizeof (struct mlx4_wqe_data_seg); 1365 dseg = wqe;
1331 size += sizeof (struct mlx4_wqe_data_seg) / 16; 1366 dseg += wr->num_sge - 1;
1332 } 1367 size += wr->num_sge * (sizeof (struct mlx4_wqe_data_seg) / 16);
1333 1368
1334 /* Add one more inline data segment for ICRC for MLX sends */ 1369 /* Add one more inline data segment for ICRC for MLX sends */
1335 if (qp->ibqp.qp_type == IB_QPT_SMI || qp->ibqp.qp_type == IB_QPT_GSI) { 1370 if (unlikely(qp->ibqp.qp_type == IB_QPT_SMI ||
1336 ((struct mlx4_wqe_inline_seg *) wqe)->byte_count = 1371 qp->ibqp.qp_type == IB_QPT_GSI)) {
1337 cpu_to_be32((1 << 31) | 4); 1372 set_mlx_icrc_seg(dseg + 1);
1338 ((u32 *) wqe)[1] = 0;
1339 wqe += sizeof (struct mlx4_wqe_data_seg);
1340 size += sizeof (struct mlx4_wqe_data_seg) / 16; 1373 size += sizeof (struct mlx4_wqe_data_seg) / 16;
1341 } 1374 }
1342 1375
1376 for (i = wr->num_sge - 1; i >= 0; --i, --dseg)
1377 set_data_seg(dseg, wr->sg_list + i);
1378
1343 ctrl->fence_size = (wr->send_flags & IB_SEND_FENCE ? 1379 ctrl->fence_size = (wr->send_flags & IB_SEND_FENCE ?
1344 MLX4_WQE_CTRL_FENCE : 0) | size; 1380 MLX4_WQE_CTRL_FENCE : 0) | size;
1345 1381
diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
index e2abe18e575d..7c662ee594a3 100644
--- a/drivers/input/joystick/Kconfig
+++ b/drivers/input/joystick/Kconfig
@@ -277,7 +277,7 @@ config JOYSTICK_XPAD_FF
277 277
278config JOYSTICK_XPAD_LEDS 278config JOYSTICK_XPAD_LEDS
279 bool "LED Support for Xbox360 controller 'BigX' LED" 279 bool "LED Support for Xbox360 controller 'BigX' LED"
280 depends on LEDS_CLASS && JOYSTICK_XPAD 280 depends on JOYSTICK_XPAD && (LEDS_CLASS=y || LEDS_CLASS=JOYSTICK_XPAD)
281 ---help--- 281 ---help---
282 This option enables support for the LED which surrounds the Big X on 282 This option enables support for the LED which surrounds the Big X on
283 XBox 360 controller. 283 XBox 360 controller.
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 2bea1b2c631c..a1804bfdbb8c 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -328,6 +328,7 @@ static void atp_complete(struct urb* urb)
328{ 328{
329 int x, y, x_z, y_z, x_f, y_f; 329 int x, y, x_z, y_z, x_f, y_f;
330 int retval, i, j; 330 int retval, i, j;
331 int key;
331 struct atp *dev = urb->context; 332 struct atp *dev = urb->context;
332 333
333 switch (urb->status) { 334 switch (urb->status) {
@@ -468,6 +469,7 @@ static void atp_complete(struct urb* urb)
468 ATP_XFACT, &x_z, &x_f); 469 ATP_XFACT, &x_z, &x_f);
469 y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS, 470 y = atp_calculate_abs(dev->xy_acc + ATP_XSENSORS, ATP_YSENSORS,
470 ATP_YFACT, &y_z, &y_f); 471 ATP_YFACT, &y_z, &y_f);
472 key = dev->data[dev->datalen - 1] & 1;
471 473
472 if (x && y) { 474 if (x && y) {
473 if (dev->x_old != -1) { 475 if (dev->x_old != -1) {
@@ -505,7 +507,7 @@ static void atp_complete(struct urb* urb)
505 the first touch unless reinitialised. Do so if it's been 507 the first touch unless reinitialised. Do so if it's been
506 idle for a while in order to avoid waking the kernel up 508 idle for a while in order to avoid waking the kernel up
507 several hundred times a second */ 509 several hundred times a second */
508 if (atp_is_geyser_3(dev)) { 510 if (!key && atp_is_geyser_3(dev)) {
509 dev->idlecount++; 511 dev->idlecount++;
510 if (dev->idlecount == 10) { 512 if (dev->idlecount == 10) {
511 dev->valid = 0; 513 dev->valid = 0;
@@ -514,7 +516,7 @@ static void atp_complete(struct urb* urb)
514 } 516 }
515 } 517 }
516 518
517 input_report_key(dev->input, BTN_LEFT, dev->data[dev->datalen - 1] & 1); 519 input_report_key(dev->input, BTN_LEFT, key);
518 input_sync(dev->input); 520 input_sync(dev->input);
519 521
520exit: 522exit:
diff --git a/drivers/kvm/Kconfig b/drivers/kvm/Kconfig
index 7b64fd4aa2f3..0a419a0de603 100644
--- a/drivers/kvm/Kconfig
+++ b/drivers/kvm/Kconfig
@@ -6,7 +6,8 @@ menuconfig VIRTUALIZATION
6 depends on X86 6 depends on X86
7 default y 7 default y
8 ---help--- 8 ---help---
9 Say Y here to get to see options for virtualization guest drivers. 9 Say Y here to get to see options for using your Linux host to run other
10 operating systems inside virtual machines (guests).
10 This option alone does not add any kernel code. 11 This option alone does not add any kernel code.
11 12
12 If you say N, all options in this submenu will be skipped and disabled. 13 If you say N, all options in this submenu will be skipped and disabled.
diff --git a/drivers/lguest/lguest_asm.S b/drivers/lguest/lguest_asm.S
index f182c6a36209..1ddcd5cd20f6 100644
--- a/drivers/lguest/lguest_asm.S
+++ b/drivers/lguest/lguest_asm.S
@@ -22,8 +22,9 @@
22 jmp lguest_init 22 jmp lguest_init
23 23
24/*G:055 We create a macro which puts the assembler code between lgstart_ and 24/*G:055 We create a macro which puts the assembler code between lgstart_ and
25 * lgend_ markers. These templates end up in the .init.text section, so they 25 * lgend_ markers. These templates are put in the .text section: they can't be
26 * are discarded after boot. */ 26 * discarded after boot as we may need to patch modules, too. */
27.text
27#define LGUEST_PATCH(name, insns...) \ 28#define LGUEST_PATCH(name, insns...) \
28 lgstart_##name: insns; lgend_##name:; \ 29 lgstart_##name: insns; lgend_##name:; \
29 .globl lgstart_##name; .globl lgend_##name 30 .globl lgstart_##name; .globl lgend_##name
@@ -34,7 +35,6 @@ LGUEST_PATCH(popf, movl %eax, lguest_data+LGUEST_DATA_irq_enabled)
34LGUEST_PATCH(pushf, movl lguest_data+LGUEST_DATA_irq_enabled, %eax) 35LGUEST_PATCH(pushf, movl lguest_data+LGUEST_DATA_irq_enabled, %eax)
35/*:*/ 36/*:*/
36 37
37.text
38/* These demark the EIP range where host should never deliver interrupts. */ 38/* These demark the EIP range where host should never deliver interrupts. */
39.global lguest_noirq_start 39.global lguest_noirq_start
40.global lguest_noirq_end 40.global lguest_noirq_end
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 4d63773ee73a..f96dea975fa5 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -514,7 +514,7 @@ static void ops_complete_biofill(void *stripe_head_ref)
514 struct stripe_head *sh = stripe_head_ref; 514 struct stripe_head *sh = stripe_head_ref;
515 struct bio *return_bi = NULL; 515 struct bio *return_bi = NULL;
516 raid5_conf_t *conf = sh->raid_conf; 516 raid5_conf_t *conf = sh->raid_conf;
517 int i, more_to_read = 0; 517 int i;
518 518
519 pr_debug("%s: stripe %llu\n", __FUNCTION__, 519 pr_debug("%s: stripe %llu\n", __FUNCTION__,
520 (unsigned long long)sh->sector); 520 (unsigned long long)sh->sector);
@@ -522,16 +522,14 @@ static void ops_complete_biofill(void *stripe_head_ref)
522 /* clear completed biofills */ 522 /* clear completed biofills */
523 for (i = sh->disks; i--; ) { 523 for (i = sh->disks; i--; ) {
524 struct r5dev *dev = &sh->dev[i]; 524 struct r5dev *dev = &sh->dev[i];
525 /* check if this stripe has new incoming reads */
526 if (dev->toread)
527 more_to_read++;
528 525
529 /* acknowledge completion of a biofill operation */ 526 /* acknowledge completion of a biofill operation */
530 /* and check if we need to reply to a read request 527 /* and check if we need to reply to a read request,
531 */ 528 * new R5_Wantfill requests are held off until
532 if (test_bit(R5_Wantfill, &dev->flags) && !dev->toread) { 529 * !test_bit(STRIPE_OP_BIOFILL, &sh->ops.pending)
530 */
531 if (test_and_clear_bit(R5_Wantfill, &dev->flags)) {
533 struct bio *rbi, *rbi2; 532 struct bio *rbi, *rbi2;
534 clear_bit(R5_Wantfill, &dev->flags);
535 533
536 /* The access to dev->read is outside of the 534 /* The access to dev->read is outside of the
537 * spin_lock_irq(&conf->device_lock), but is protected 535 * spin_lock_irq(&conf->device_lock), but is protected
@@ -558,8 +556,7 @@ static void ops_complete_biofill(void *stripe_head_ref)
558 556
559 return_io(return_bi); 557 return_io(return_bi);
560 558
561 if (more_to_read) 559 set_bit(STRIPE_HANDLE, &sh->state);
562 set_bit(STRIPE_HANDLE, &sh->state);
563 release_stripe(sh); 560 release_stripe(sh);
564} 561}
565 562
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index 0285c4a830eb..66ea3cbc369c 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -754,9 +754,11 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
754 ivtv_yuv_close(itv); 754 ivtv_yuv_close(itv);
755 } 755 }
756 if (s->type == IVTV_DEC_STREAM_TYPE_YUV && itv->output_mode == OUT_YUV) 756 if (s->type == IVTV_DEC_STREAM_TYPE_YUV && itv->output_mode == OUT_YUV)
757 itv->output_mode = OUT_NONE; 757 itv->output_mode = OUT_NONE;
758 else if (s->type == IVTV_DEC_STREAM_TYPE_YUV && itv->output_mode == OUT_UDMA_YUV)
759 itv->output_mode = OUT_NONE;
758 else if (s->type == IVTV_DEC_STREAM_TYPE_MPG && itv->output_mode == OUT_MPG) 760 else if (s->type == IVTV_DEC_STREAM_TYPE_MPG && itv->output_mode == OUT_MPG)
759 itv->output_mode = OUT_NONE; 761 itv->output_mode = OUT_NONE;
760 762
761 itv->speed = 0; 763 itv->speed = 0;
762 clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags); 764 clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index e3371f972240..0cb006f2943d 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -1387,7 +1387,6 @@ static const struct file_operations usbvision_fops = {
1387 .ioctl = video_ioctl2, 1387 .ioctl = video_ioctl2,
1388 .llseek = no_llseek, 1388 .llseek = no_llseek,
1389/* .poll = video_poll, */ 1389/* .poll = video_poll, */
1390 .mmap = usbvision_v4l2_mmap,
1391 .compat_ioctl = v4l_compat_ioctl32, 1390 .compat_ioctl = v4l_compat_ioctl32,
1392}; 1391};
1393static struct video_device usbvision_video_template = { 1392static struct video_device usbvision_video_template = {
@@ -1413,7 +1412,7 @@ static struct video_device usbvision_video_template = {
1413 .vidioc_s_input = vidioc_s_input, 1412 .vidioc_s_input = vidioc_s_input,
1414 .vidioc_queryctrl = vidioc_queryctrl, 1413 .vidioc_queryctrl = vidioc_queryctrl,
1415 .vidioc_g_audio = vidioc_g_audio, 1414 .vidioc_g_audio = vidioc_g_audio,
1416 .vidioc_g_audio = vidioc_s_audio, 1415 .vidioc_s_audio = vidioc_s_audio,
1417 .vidioc_g_ctrl = vidioc_g_ctrl, 1416 .vidioc_g_ctrl = vidioc_g_ctrl,
1418 .vidioc_s_ctrl = vidioc_s_ctrl, 1417 .vidioc_s_ctrl = vidioc_s_ctrl,
1419 .vidioc_streamon = vidioc_streamon, 1418 .vidioc_streamon = vidioc_streamon,
@@ -1459,7 +1458,7 @@ static struct video_device usbvision_radio_template=
1459 .vidioc_s_input = vidioc_s_input, 1458 .vidioc_s_input = vidioc_s_input,
1460 .vidioc_queryctrl = vidioc_queryctrl, 1459 .vidioc_queryctrl = vidioc_queryctrl,
1461 .vidioc_g_audio = vidioc_g_audio, 1460 .vidioc_g_audio = vidioc_g_audio,
1462 .vidioc_g_audio = vidioc_s_audio, 1461 .vidioc_s_audio = vidioc_s_audio,
1463 .vidioc_g_ctrl = vidioc_g_ctrl, 1462 .vidioc_g_ctrl = vidioc_g_ctrl,
1464 .vidioc_s_ctrl = vidioc_s_ctrl, 1463 .vidioc_s_ctrl = vidioc_s_ctrl,
1465 .vidioc_g_tuner = vidioc_g_tuner, 1464 .vidioc_g_tuner = vidioc_g_tuner,
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 854d80c330ec..66eed22cbd21 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "1.6.4" 57#define DRV_MODULE_VERSION "1.6.5"
58#define DRV_MODULE_RELDATE "August 3, 2007" 58#define DRV_MODULE_RELDATE "September 20, 2007"
59 59
60#define RUN_AT(x) (jiffies + (x)) 60#define RUN_AT(x) (jiffies + (x))
61 61
@@ -6727,7 +6727,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
6727 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || 6727 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 ||
6728 CHIP_NUM(bp) == CHIP_NUM_5708) 6728 CHIP_NUM(bp) == CHIP_NUM_5708)
6729 bp->phy_flags |= PHY_CRC_FIX_FLAG; 6729 bp->phy_flags |= PHY_CRC_FIX_FLAG;
6730 else if (CHIP_ID(bp) == CHIP_ID_5709_A0) 6730 else if (CHIP_ID(bp) == CHIP_ID_5709_A0 ||
6731 CHIP_ID(bp) == CHIP_ID_5709_A1)
6731 bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG; 6732 bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG;
6732 6733
6733 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || 6734 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) ||
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 4c3785c9d4b8..9ecc3adcf6c1 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1726,6 +1726,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol
1726 case E1000_DEV_ID_82571EB_QUAD_COPPER: 1726 case E1000_DEV_ID_82571EB_QUAD_COPPER:
1727 case E1000_DEV_ID_82571EB_QUAD_FIBER: 1727 case E1000_DEV_ID_82571EB_QUAD_FIBER:
1728 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 1728 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
1729 case E1000_DEV_ID_82571PT_QUAD_COPPER:
1729 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: 1730 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
1730 /* quad port adapters only support WoL on port A */ 1731 /* quad port adapters only support WoL on port A */
1731 if (!adapter->quad_port_a) { 1732 if (!adapter->quad_port_a) {
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index ba120f7fb0be..8604adbe351c 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -387,6 +387,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
387 case E1000_DEV_ID_82571EB_SERDES_DUAL: 387 case E1000_DEV_ID_82571EB_SERDES_DUAL:
388 case E1000_DEV_ID_82571EB_SERDES_QUAD: 388 case E1000_DEV_ID_82571EB_SERDES_QUAD:
389 case E1000_DEV_ID_82571EB_QUAD_COPPER: 389 case E1000_DEV_ID_82571EB_QUAD_COPPER:
390 case E1000_DEV_ID_82571PT_QUAD_COPPER:
390 case E1000_DEV_ID_82571EB_QUAD_FIBER: 391 case E1000_DEV_ID_82571EB_QUAD_FIBER:
391 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 392 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
392 hw->mac_type = e1000_82571; 393 hw->mac_type = e1000_82571;
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index fe8714655c90..07f0ea73676e 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -475,6 +475,7 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw);
475#define E1000_DEV_ID_82571EB_FIBER 0x105F 475#define E1000_DEV_ID_82571EB_FIBER 0x105F
476#define E1000_DEV_ID_82571EB_SERDES 0x1060 476#define E1000_DEV_ID_82571EB_SERDES 0x1060
477#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 477#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
478#define E1000_DEV_ID_82571PT_QUAD_COPPER 0x10D5
478#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5 479#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5
479#define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC 480#define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC
480#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9 481#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4a225950fb43..e7c8951f47fa 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -108,6 +108,7 @@ static struct pci_device_id e1000_pci_tbl[] = {
108 INTEL_E1000_ETHERNET_DEVICE(0x10BC), 108 INTEL_E1000_ETHERNET_DEVICE(0x10BC),
109 INTEL_E1000_ETHERNET_DEVICE(0x10C4), 109 INTEL_E1000_ETHERNET_DEVICE(0x10C4),
110 INTEL_E1000_ETHERNET_DEVICE(0x10C5), 110 INTEL_E1000_ETHERNET_DEVICE(0x10C5),
111 INTEL_E1000_ETHERNET_DEVICE(0x10D5),
111 INTEL_E1000_ETHERNET_DEVICE(0x10D9), 112 INTEL_E1000_ETHERNET_DEVICE(0x10D9),
112 INTEL_E1000_ETHERNET_DEVICE(0x10DA), 113 INTEL_E1000_ETHERNET_DEVICE(0x10DA),
113 /* required last entry */ 114 /* required last entry */
@@ -1101,6 +1102,7 @@ e1000_probe(struct pci_dev *pdev,
1101 case E1000_DEV_ID_82571EB_QUAD_COPPER: 1102 case E1000_DEV_ID_82571EB_QUAD_COPPER:
1102 case E1000_DEV_ID_82571EB_QUAD_FIBER: 1103 case E1000_DEV_ID_82571EB_QUAD_FIBER:
1103 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 1104 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
1105 case E1000_DEV_ID_82571PT_QUAD_COPPER:
1104 /* if quad port adapter, disable WoL on all but port A */ 1106 /* if quad port adapter, disable WoL on all but port A */
1105 if (global_quad_port_a != 0) 1107 if (global_quad_port_a != 0)
1106 adapter->eeprom_wol = 0; 1108 adapter->eeprom_wol = 0;
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 6a117e9968cb..315335671f0f 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -534,7 +534,7 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id)
534 } 534 }
535 535
536 /* PHY status changed */ 536 /* PHY status changed */
537 if (eth_int_cause_ext & ETH_INT_CAUSE_PHY) { 537 if (eth_int_cause_ext & (ETH_INT_CAUSE_PHY | ETH_INT_CAUSE_STATE)) {
538 struct ethtool_cmd cmd; 538 struct ethtool_cmd cmd;
539 539
540 if (mii_link_ok(&mp->mii)) { 540 if (mii_link_ok(&mp->mii)) {
@@ -1357,7 +1357,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
1357#endif 1357#endif
1358 1358
1359 dev->watchdog_timeo = 2 * HZ; 1359 dev->watchdog_timeo = 2 * HZ;
1360 dev->tx_queue_len = mp->tx_ring_size;
1361 dev->base_addr = 0; 1360 dev->base_addr = 0;
1362 dev->change_mtu = mv643xx_eth_change_mtu; 1361 dev->change_mtu = mv643xx_eth_change_mtu;
1363 dev->do_ioctl = mv643xx_eth_do_ioctl; 1362 dev->do_ioctl = mv643xx_eth_do_ioctl;
@@ -2768,8 +2767,6 @@ static const struct ethtool_ops mv643xx_ethtool_ops = {
2768 .get_stats_count = mv643xx_get_stats_count, 2767 .get_stats_count = mv643xx_get_stats_count,
2769 .get_ethtool_stats = mv643xx_get_ethtool_stats, 2768 .get_ethtool_stats = mv643xx_get_ethtool_stats,
2770 .get_strings = mv643xx_get_strings, 2769 .get_strings = mv643xx_get_strings,
2771 .get_stats_count = mv643xx_get_stats_count,
2772 .get_ethtool_stats = mv643xx_get_ethtool_stats,
2773 .nway_reset = mv643xx_eth_nway_restart, 2770 .nway_reset = mv643xx_eth_nway_restart,
2774}; 2771};
2775 2772
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h
index 82f8c0cbfb64..565b96696aca 100644
--- a/drivers/net/mv643xx_eth.h
+++ b/drivers/net/mv643xx_eth.h
@@ -64,7 +64,9 @@
64#define ETH_INT_CAUSE_TX_ERROR (ETH_TX_QUEUES_ENABLED << 8) 64#define ETH_INT_CAUSE_TX_ERROR (ETH_TX_QUEUES_ENABLED << 8)
65#define ETH_INT_CAUSE_TX (ETH_INT_CAUSE_TX_DONE | ETH_INT_CAUSE_TX_ERROR) 65#define ETH_INT_CAUSE_TX (ETH_INT_CAUSE_TX_DONE | ETH_INT_CAUSE_TX_ERROR)
66#define ETH_INT_CAUSE_PHY 0x00010000 66#define ETH_INT_CAUSE_PHY 0x00010000
67#define ETH_INT_UNMASK_ALL_EXT (ETH_INT_CAUSE_TX | ETH_INT_CAUSE_PHY) 67#define ETH_INT_CAUSE_STATE 0x00100000
68#define ETH_INT_UNMASK_ALL_EXT (ETH_INT_CAUSE_TX | ETH_INT_CAUSE_PHY | \
69 ETH_INT_CAUSE_STATE)
68 70
69#define ETH_INT_MASK_ALL 0x00000000 71#define ETH_INT_MASK_ALL 0x00000000
70#define ETH_INT_MASK_ALL_EXT 0x00000000 72#define ETH_INT_MASK_ALL_EXT 0x00000000
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 1c42266bf889..556962f9612d 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -3094,9 +3094,12 @@ static void myri10ge_remove(struct pci_dev *pdev)
3094} 3094}
3095 3095
3096#define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E 0x0008 3096#define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E 0x0008
3097#define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E_9 0x0009
3097 3098
3098static struct pci_device_id myri10ge_pci_tbl[] = { 3099static struct pci_device_id myri10ge_pci_tbl[] = {
3099 {PCI_DEVICE(PCI_VENDOR_ID_MYRICOM, PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E)}, 3100 {PCI_DEVICE(PCI_VENDOR_ID_MYRICOM, PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E)},
3101 {PCI_DEVICE
3102 (PCI_VENDOR_ID_MYRICOM, PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E_9)},
3100 {0}, 3103 {0},
3101}; 3104};
3102 3105
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index c06cae3f0b56..503f2685fb73 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -116,7 +116,7 @@ struct el3_private {
116 spinlock_t lock; 116 spinlock_t lock;
117}; 117};
118 118
119static const char *if_names[] = { "auto", "10base2", "10baseT", "AUI" }; 119static const char *if_names[] = { "auto", "10baseT", "10base2", "AUI" };
120 120
121/*====================================================================*/ 121/*====================================================================*/
122 122
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 0cc4369cacba..cb230f44d6fc 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -409,6 +409,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
409 409
410 return 0; 410 return 0;
411} 411}
412EXPORT_SYMBOL(phy_mii_ioctl);
412 413
413/** 414/**
414 * phy_start_aneg - start auto-negotiation for this PHY device 415 * phy_start_aneg - start auto-negotiation for this PHY device
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c
index f79cf87a2bff..c0b6d19d1457 100644
--- a/drivers/net/ppp_mppe.c
+++ b/drivers/net/ppp_mppe.c
@@ -136,7 +136,7 @@ struct ppp_mppe_state {
136 * Key Derivation, from RFC 3078, RFC 3079. 136 * Key Derivation, from RFC 3078, RFC 3079.
137 * Equivalent to Get_Key() for MS-CHAP as described in RFC 3079. 137 * Equivalent to Get_Key() for MS-CHAP as described in RFC 3079.
138 */ 138 */
139static void get_new_key_from_sha(struct ppp_mppe_state * state, unsigned char *InterimKey) 139static void get_new_key_from_sha(struct ppp_mppe_state * state)
140{ 140{
141 struct hash_desc desc; 141 struct hash_desc desc;
142 struct scatterlist sg[4]; 142 struct scatterlist sg[4];
@@ -153,8 +153,6 @@ static void get_new_key_from_sha(struct ppp_mppe_state * state, unsigned char *I
153 desc.flags = 0; 153 desc.flags = 0;
154 154
155 crypto_hash_digest(&desc, sg, nbytes, state->sha1_digest); 155 crypto_hash_digest(&desc, sg, nbytes, state->sha1_digest);
156
157 memcpy(InterimKey, state->sha1_digest, state->keylen);
158} 156}
159 157
160/* 158/*
@@ -163,21 +161,21 @@ static void get_new_key_from_sha(struct ppp_mppe_state * state, unsigned char *I
163 */ 161 */
164static void mppe_rekey(struct ppp_mppe_state * state, int initial_key) 162static void mppe_rekey(struct ppp_mppe_state * state, int initial_key)
165{ 163{
166 unsigned char InterimKey[MPPE_MAX_KEY_LEN];
167 struct scatterlist sg_in[1], sg_out[1]; 164 struct scatterlist sg_in[1], sg_out[1];
168 struct blkcipher_desc desc = { .tfm = state->arc4 }; 165 struct blkcipher_desc desc = { .tfm = state->arc4 };
169 166
170 get_new_key_from_sha(state, InterimKey); 167 get_new_key_from_sha(state);
171 if (!initial_key) { 168 if (!initial_key) {
172 crypto_blkcipher_setkey(state->arc4, InterimKey, state->keylen); 169 crypto_blkcipher_setkey(state->arc4, state->sha1_digest,
173 setup_sg(sg_in, InterimKey, state->keylen); 170 state->keylen);
171 setup_sg(sg_in, state->sha1_digest, state->keylen);
174 setup_sg(sg_out, state->session_key, state->keylen); 172 setup_sg(sg_out, state->session_key, state->keylen);
175 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, 173 if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in,
176 state->keylen) != 0) { 174 state->keylen) != 0) {
177 printk(KERN_WARNING "mppe_rekey: cipher_encrypt failed\n"); 175 printk(KERN_WARNING "mppe_rekey: cipher_encrypt failed\n");
178 } 176 }
179 } else { 177 } else {
180 memcpy(state->session_key, InterimKey, state->keylen); 178 memcpy(state->session_key, state->sha1_digest, state->keylen);
181 } 179 }
182 if (state->keylen == 8) { 180 if (state->keylen == 8) {
183 /* See RFC 3078 */ 181 /* See RFC 3078 */
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 0d7f570b9a54..9b30cd600a64 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -879,8 +879,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
879 dev->hard_header(skb, dev, ETH_P_PPP_SES, 879 dev->hard_header(skb, dev, ETH_P_PPP_SES,
880 po->pppoe_pa.remote, NULL, data_len); 880 po->pppoe_pa.remote, NULL, data_len);
881 881
882 if (dev_queue_xmit(skb) < 0) 882 dev_queue_xmit(skb);
883 goto abort;
884 883
885 return 1; 884 return 1;
886 885
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 266e8b38fe10..abe91cb595f4 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -491,44 +491,46 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
491 u16 hdrflags; 491 u16 hdrflags;
492 u16 tunnel_id, session_id; 492 u16 tunnel_id, session_id;
493 int length; 493 int length;
494 struct udphdr *uh; 494 int offset;
495 495
496 tunnel = pppol2tp_sock_to_tunnel(sock); 496 tunnel = pppol2tp_sock_to_tunnel(sock);
497 if (tunnel == NULL) 497 if (tunnel == NULL)
498 goto error; 498 goto error;
499 499
500 /* UDP always verifies the packet length. */
501 __skb_pull(skb, sizeof(struct udphdr));
502
500 /* Short packet? */ 503 /* Short packet? */
501 if (skb->len < sizeof(struct udphdr)) { 504 if (!pskb_may_pull(skb, 12)) {
502 PRINTK(tunnel->debug, PPPOL2TP_MSG_DATA, KERN_INFO, 505 PRINTK(tunnel->debug, PPPOL2TP_MSG_DATA, KERN_INFO,
503 "%s: recv short packet (len=%d)\n", tunnel->name, skb->len); 506 "%s: recv short packet (len=%d)\n", tunnel->name, skb->len);
504 goto error; 507 goto error;
505 } 508 }
506 509
507 /* Point to L2TP header */ 510 /* Point to L2TP header */
508 ptr = skb->data + sizeof(struct udphdr); 511 ptr = skb->data;
509 512
510 /* Get L2TP header flags */ 513 /* Get L2TP header flags */
511 hdrflags = ntohs(*(__be16*)ptr); 514 hdrflags = ntohs(*(__be16*)ptr);
512 515
513 /* Trace packet contents, if enabled */ 516 /* Trace packet contents, if enabled */
514 if (tunnel->debug & PPPOL2TP_MSG_DATA) { 517 if (tunnel->debug & PPPOL2TP_MSG_DATA) {
518 length = min(16u, skb->len);
519 if (!pskb_may_pull(skb, length))
520 goto error;
521
515 printk(KERN_DEBUG "%s: recv: ", tunnel->name); 522 printk(KERN_DEBUG "%s: recv: ", tunnel->name);
516 523
517 for (length = 0; length < 16; length++) 524 offset = 0;
518 printk(" %02X", ptr[length]); 525 do {
526 printk(" %02X", ptr[offset]);
527 } while (++offset < length);
528
519 printk("\n"); 529 printk("\n");
520 } 530 }
521 531
522 /* Get length of L2TP packet */ 532 /* Get length of L2TP packet */
523 uh = (struct udphdr *) skb_transport_header(skb); 533 length = skb->len;
524 length = ntohs(uh->len) - sizeof(struct udphdr);
525
526 /* Too short? */
527 if (length < 12) {
528 PRINTK(tunnel->debug, PPPOL2TP_MSG_DATA, KERN_INFO,
529 "%s: recv short L2TP packet (len=%d)\n", tunnel->name, length);
530 goto error;
531 }
532 534
533 /* If type is control packet, it is handled by userspace. */ 535 /* If type is control packet, it is handled by userspace. */
534 if (hdrflags & L2TP_HDRFLAG_T) { 536 if (hdrflags & L2TP_HDRFLAG_T) {
@@ -606,7 +608,6 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
606 "%s: recv data has no seq numbers when required. " 608 "%s: recv data has no seq numbers when required. "
607 "Discarding\n", session->name); 609 "Discarding\n", session->name);
608 session->stats.rx_seq_discards++; 610 session->stats.rx_seq_discards++;
609 session->stats.rx_errors++;
610 goto discard; 611 goto discard;
611 } 612 }
612 613
@@ -625,7 +626,6 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
625 "%s: recv data has no seq numbers when required. " 626 "%s: recv data has no seq numbers when required. "
626 "Discarding\n", session->name); 627 "Discarding\n", session->name);
627 session->stats.rx_seq_discards++; 628 session->stats.rx_seq_discards++;
628 session->stats.rx_errors++;
629 goto discard; 629 goto discard;
630 } 630 }
631 631
@@ -634,10 +634,14 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
634 } 634 }
635 635
636 /* If offset bit set, skip it. */ 636 /* If offset bit set, skip it. */
637 if (hdrflags & L2TP_HDRFLAG_O) 637 if (hdrflags & L2TP_HDRFLAG_O) {
638 ptr += 2 + ntohs(*(__be16 *) ptr); 638 offset = ntohs(*(__be16 *)ptr);
639 skb->transport_header += 2 + offset;
640 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 2))
641 goto discard;
642 }
639 643
640 skb_pull(skb, ptr - skb->data); 644 __skb_pull(skb, skb_transport_offset(skb));
641 645
642 /* Skip PPP header, if present. In testing, Microsoft L2TP clients 646 /* Skip PPP header, if present. In testing, Microsoft L2TP clients
643 * don't send the PPP header (PPP header compression enabled), but 647 * don't send the PPP header (PPP header compression enabled), but
@@ -673,7 +677,6 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
673 */ 677 */
674 if (PPPOL2TP_SKB_CB(skb)->ns != session->nr) { 678 if (PPPOL2TP_SKB_CB(skb)->ns != session->nr) {
675 session->stats.rx_seq_discards++; 679 session->stats.rx_seq_discards++;
676 session->stats.rx_errors++;
677 PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG, 680 PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG,
678 "%s: oos pkt %hu len %d discarded, " 681 "%s: oos pkt %hu len %d discarded, "
679 "waiting for %hu, reorder_q_len=%d\n", 682 "waiting for %hu, reorder_q_len=%d\n",
@@ -698,6 +701,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
698 return 0; 701 return 0;
699 702
700discard: 703discard:
704 session->stats.rx_errors++;
701 kfree_skb(skb); 705 kfree_skb(skb);
702 sock_put(session->sock); 706 sock_put(session->sock);
703 707
@@ -958,7 +962,6 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
958 int data_len = skb->len; 962 int data_len = skb->len;
959 struct inet_sock *inet; 963 struct inet_sock *inet;
960 __wsum csum = 0; 964 __wsum csum = 0;
961 struct sk_buff *skb2 = NULL;
962 struct udphdr *uh; 965 struct udphdr *uh;
963 unsigned int len; 966 unsigned int len;
964 967
@@ -989,41 +992,30 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
989 */ 992 */
990 headroom = NET_SKB_PAD + sizeof(struct iphdr) + 993 headroom = NET_SKB_PAD + sizeof(struct iphdr) +
991 sizeof(struct udphdr) + hdr_len + sizeof(ppph); 994 sizeof(struct udphdr) + hdr_len + sizeof(ppph);
992 if (skb_headroom(skb) < headroom) { 995 if (skb_cow_head(skb, headroom))
993 skb2 = skb_realloc_headroom(skb, headroom); 996 goto abort;
994 if (skb2 == NULL)
995 goto abort;
996 } else
997 skb2 = skb;
998
999 /* Check that the socket has room */
1000 if (atomic_read(&sk_tun->sk_wmem_alloc) < sk_tun->sk_sndbuf)
1001 skb_set_owner_w(skb2, sk_tun);
1002 else
1003 goto discard;
1004 997
1005 /* Setup PPP header */ 998 /* Setup PPP header */
1006 skb_push(skb2, sizeof(ppph)); 999 __skb_push(skb, sizeof(ppph));
1007 skb2->data[0] = ppph[0]; 1000 skb->data[0] = ppph[0];
1008 skb2->data[1] = ppph[1]; 1001 skb->data[1] = ppph[1];
1009 1002
1010 /* Setup L2TP header */ 1003 /* Setup L2TP header */
1011 skb_push(skb2, hdr_len); 1004 pppol2tp_build_l2tp_header(session, __skb_push(skb, hdr_len));
1012 pppol2tp_build_l2tp_header(session, skb2->data);
1013 1005
1014 /* Setup UDP header */ 1006 /* Setup UDP header */
1015 inet = inet_sk(sk_tun); 1007 inet = inet_sk(sk_tun);
1016 skb_push(skb2, sizeof(struct udphdr)); 1008 __skb_push(skb, sizeof(*uh));
1017 skb_reset_transport_header(skb2); 1009 skb_reset_transport_header(skb);
1018 uh = (struct udphdr *) skb2->data; 1010 uh = udp_hdr(skb);
1019 uh->source = inet->sport; 1011 uh->source = inet->sport;
1020 uh->dest = inet->dport; 1012 uh->dest = inet->dport;
1021 uh->len = htons(sizeof(struct udphdr) + hdr_len + sizeof(ppph) + data_len); 1013 uh->len = htons(sizeof(struct udphdr) + hdr_len + sizeof(ppph) + data_len);
1022 uh->check = 0; 1014 uh->check = 0;
1023 1015
1024 /* Calculate UDP checksum if configured to do so */ 1016 /* *BROKEN* Calculate UDP checksum if configured to do so */
1025 if (sk_tun->sk_no_check != UDP_CSUM_NOXMIT) 1017 if (sk_tun->sk_no_check != UDP_CSUM_NOXMIT)
1026 csum = udp_csum_outgoing(sk_tun, skb2); 1018 csum = udp_csum_outgoing(sk_tun, skb);
1027 1019
1028 /* Debug */ 1020 /* Debug */
1029 if (session->send_seq) 1021 if (session->send_seq)
@@ -1036,7 +1028,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1036 1028
1037 if (session->debug & PPPOL2TP_MSG_DATA) { 1029 if (session->debug & PPPOL2TP_MSG_DATA) {
1038 int i; 1030 int i;
1039 unsigned char *datap = skb2->data; 1031 unsigned char *datap = skb->data;
1040 1032
1041 printk(KERN_DEBUG "%s: xmit:", session->name); 1033 printk(KERN_DEBUG "%s: xmit:", session->name);
1042 for (i = 0; i < data_len; i++) { 1034 for (i = 0; i < data_len; i++) {
@@ -1049,18 +1041,18 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1049 printk("\n"); 1041 printk("\n");
1050 } 1042 }
1051 1043
1052 memset(&(IPCB(skb2)->opt), 0, sizeof(IPCB(skb2)->opt)); 1044 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
1053 IPCB(skb2)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | 1045 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
1054 IPSKB_REROUTED); 1046 IPSKB_REROUTED);
1055 nf_reset(skb2); 1047 nf_reset(skb);
1056 1048
1057 /* Get routing info from the tunnel socket */ 1049 /* Get routing info from the tunnel socket */
1058 dst_release(skb2->dst); 1050 dst_release(skb->dst);
1059 skb2->dst = sk_dst_get(sk_tun); 1051 skb->dst = sk_dst_get(sk_tun);
1060 1052
1061 /* Queue the packet to IP for output */ 1053 /* Queue the packet to IP for output */
1062 len = skb2->len; 1054 len = skb->len;
1063 rc = ip_queue_xmit(skb2, 1); 1055 rc = ip_queue_xmit(skb, 1);
1064 1056
1065 /* Update stats */ 1057 /* Update stats */
1066 if (rc >= 0) { 1058 if (rc >= 0) {
@@ -1073,17 +1065,12 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1073 session->stats.tx_errors++; 1065 session->stats.tx_errors++;
1074 } 1066 }
1075 1067
1076 /* Free the original skb */
1077 kfree_skb(skb);
1078
1079 return 1; 1068 return 1;
1080 1069
1081discard:
1082 /* Free the new skb. Caller will free original skb. */
1083 if (skb2 != skb)
1084 kfree_skb(skb2);
1085abort: 1070abort:
1086 return 0; 1071 /* Free the original skb */
1072 kfree_skb(skb);
1073 return 1;
1087} 1074}
1088 1075
1089/***************************************************************************** 1076/*****************************************************************************
@@ -1326,12 +1313,14 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id,
1326 goto err; 1313 goto err;
1327 } 1314 }
1328 1315
1316 sk = sock->sk;
1317
1329 /* Quick sanity checks */ 1318 /* Quick sanity checks */
1330 err = -ESOCKTNOSUPPORT; 1319 err = -EPROTONOSUPPORT;
1331 if (sock->type != SOCK_DGRAM) { 1320 if (sk->sk_protocol != IPPROTO_UDP) {
1332 PRINTK(-1, PPPOL2TP_MSG_CONTROL, KERN_ERR, 1321 PRINTK(-1, PPPOL2TP_MSG_CONTROL, KERN_ERR,
1333 "tunl %hu: fd %d wrong type, got %d, expected %d\n", 1322 "tunl %hu: fd %d wrong protocol, got %d, expected %d\n",
1334 tunnel_id, fd, sock->type, SOCK_DGRAM); 1323 tunnel_id, fd, sk->sk_protocol, IPPROTO_UDP);
1335 goto err; 1324 goto err;
1336 } 1325 }
1337 err = -EAFNOSUPPORT; 1326 err = -EAFNOSUPPORT;
@@ -1343,7 +1332,6 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id,
1343 } 1332 }
1344 1333
1345 err = -ENOTCONN; 1334 err = -ENOTCONN;
1346 sk = sock->sk;
1347 1335
1348 /* Check if this socket has already been prepped */ 1336 /* Check if this socket has already been prepped */
1349 tunnel = (struct pppol2tp_tunnel *)sk->sk_user_data; 1337 tunnel = (struct pppol2tp_tunnel *)sk->sk_user_data;
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 69da95b5ad0c..ea151315050c 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -2248,6 +2248,13 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
2248 qdev->rsp_consumer_index) && (work_done < work_to_do)) { 2248 qdev->rsp_consumer_index) && (work_done < work_to_do)) {
2249 2249
2250 net_rsp = qdev->rsp_current; 2250 net_rsp = qdev->rsp_current;
2251 rmb();
2252 /*
2253 * Fix 4032 chipe undocumented "feature" where bit-8 is set if the
2254 * inbound completion is for a VLAN.
2255 */
2256 if (qdev->device_id == QL3032_DEVICE_ID)
2257 net_rsp->opcode &= 0x7f;
2251 switch (net_rsp->opcode) { 2258 switch (net_rsp->opcode) {
2252 2259
2253 case OPCODE_OB_MAC_IOCB_FN0: 2260 case OPCODE_OB_MAC_IOCB_FN0:
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index b85ab4a8f2a3..c921ec32c232 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1228,7 +1228,10 @@ static void rtl8169_hw_phy_config(struct net_device *dev)
1228 return; 1228 return;
1229 } 1229 }
1230 1230
1231 /* phy config for RTL8169s mac_version C chip */ 1231 if ((tp->mac_version != RTL_GIGA_MAC_VER_02) &&
1232 (tp->mac_version != RTL_GIGA_MAC_VER_03))
1233 return;
1234
1232 mdio_write(ioaddr, 31, 0x0001); //w 31 2 0 1 1235 mdio_write(ioaddr, 31, 0x0001); //w 31 2 0 1
1233 mdio_write(ioaddr, 21, 0x1000); //w 21 15 0 1000 1236 mdio_write(ioaddr, 21, 0x1000); //w 21 15 0 1000
1234 mdio_write(ioaddr, 24, 0x65c7); //w 24 15 0 65c7 1237 mdio_write(ioaddr, 24, 0x65c7); //w 24 15 0 65c7
@@ -2567,6 +2570,15 @@ static void rtl8169_tx_interrupt(struct net_device *dev,
2567 (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) { 2570 (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) {
2568 netif_wake_queue(dev); 2571 netif_wake_queue(dev);
2569 } 2572 }
2573 /*
2574 * 8168 hack: TxPoll requests are lost when the Tx packets are
2575 * too close. Let's kick an extra TxPoll request when a burst
2576 * of start_xmit activity is detected (if it is not detected,
2577 * it is slow enough). -- FR
2578 */
2579 smp_rmb();
2580 if (tp->cur_tx != dirty_tx)
2581 RTL_W8(TxPoll, NPQ);
2570 } 2582 }
2571} 2583}
2572 2584
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 5d812de65d90..162489b9f599 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -51,7 +51,7 @@
51#include "sky2.h" 51#include "sky2.h"
52 52
53#define DRV_NAME "sky2" 53#define DRV_NAME "sky2"
54#define DRV_VERSION "1.17" 54#define DRV_VERSION "1.18"
55#define PFX DRV_NAME " " 55#define PFX DRV_NAME " "
56 56
57/* 57/*
@@ -118,12 +118,15 @@ static const struct pci_device_id sky2_id_table[] = {
118 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4351) }, /* 88E8036 */ 118 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4351) }, /* 88E8036 */
119 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */ 119 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */
120 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */ 120 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */
121 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */
121 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */ 122 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */
123 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */
122 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */ 124 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */
123 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ 125 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */
124 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */ 126 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */
125 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */ 127 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */
126 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */ 128 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */
129 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4365) }, /* 88E8070 */
127 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */ 130 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */
128 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */ 131 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */
129 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ 132 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */
@@ -147,6 +150,7 @@ static const char *yukon2_name[] = {
147 "Extreme", /* 0xb5 */ 150 "Extreme", /* 0xb5 */
148 "EC", /* 0xb6 */ 151 "EC", /* 0xb6 */
149 "FE", /* 0xb7 */ 152 "FE", /* 0xb7 */
153 "FE+", /* 0xb8 */
150}; 154};
151 155
152static void sky2_set_multicast(struct net_device *dev); 156static void sky2_set_multicast(struct net_device *dev);
@@ -217,8 +221,7 @@ static void sky2_power_on(struct sky2_hw *hw)
217 else 221 else
218 sky2_write8(hw, B2_Y2_CLK_GATE, 0); 222 sky2_write8(hw, B2_Y2_CLK_GATE, 0);
219 223
220 if (hw->chip_id == CHIP_ID_YUKON_EC_U || 224 if (hw->flags & SKY2_HW_ADV_POWER_CTL) {
221 hw->chip_id == CHIP_ID_YUKON_EX) {
222 u32 reg; 225 u32 reg;
223 226
224 sky2_pci_write32(hw, PCI_DEV_REG3, 0); 227 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
@@ -311,10 +314,8 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
311 struct sky2_port *sky2 = netdev_priv(hw->dev[port]); 314 struct sky2_port *sky2 = netdev_priv(hw->dev[port]);
312 u16 ctrl, ct1000, adv, pg, ledctrl, ledover, reg; 315 u16 ctrl, ct1000, adv, pg, ledctrl, ledover, reg;
313 316
314 if (sky2->autoneg == AUTONEG_ENABLE 317 if (sky2->autoneg == AUTONEG_ENABLE &&
315 && !(hw->chip_id == CHIP_ID_YUKON_XL 318 !(hw->flags & SKY2_HW_NEWER_PHY)) {
316 || hw->chip_id == CHIP_ID_YUKON_EC_U
317 || hw->chip_id == CHIP_ID_YUKON_EX)) {
318 u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); 319 u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);
319 320
320 ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | 321 ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |
@@ -334,9 +335,19 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
334 335
335 ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); 336 ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);
336 if (sky2_is_copper(hw)) { 337 if (sky2_is_copper(hw)) {
337 if (hw->chip_id == CHIP_ID_YUKON_FE) { 338 if (!(hw->flags & SKY2_HW_GIGABIT)) {
338 /* enable automatic crossover */ 339 /* enable automatic crossover */
339 ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO) >> 1; 340 ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO) >> 1;
341
342 if (hw->chip_id == CHIP_ID_YUKON_FE_P &&
343 hw->chip_rev == CHIP_REV_YU_FE2_A0) {
344 u16 spec;
345
346 /* Enable Class A driver for FE+ A0 */
347 spec = gm_phy_read(hw, port, PHY_MARV_FE_SPEC_2);
348 spec |= PHY_M_FESC_SEL_CL_A;
349 gm_phy_write(hw, port, PHY_MARV_FE_SPEC_2, spec);
350 }
340 } else { 351 } else {
341 /* disable energy detect */ 352 /* disable energy detect */
342 ctrl &= ~PHY_M_PC_EN_DET_MSK; 353 ctrl &= ~PHY_M_PC_EN_DET_MSK;
@@ -346,9 +357,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
346 357
347 /* downshift on PHY 88E1112 and 88E1149 is changed */ 358 /* downshift on PHY 88E1112 and 88E1149 is changed */
348 if (sky2->autoneg == AUTONEG_ENABLE 359 if (sky2->autoneg == AUTONEG_ENABLE
349 && (hw->chip_id == CHIP_ID_YUKON_XL 360 && (hw->flags & SKY2_HW_NEWER_PHY)) {
350 || hw->chip_id == CHIP_ID_YUKON_EC_U
351 || hw->chip_id == CHIP_ID_YUKON_EX)) {
352 /* set downshift counter to 3x and enable downshift */ 361 /* set downshift counter to 3x and enable downshift */
353 ctrl &= ~PHY_M_PC_DSC_MSK; 362 ctrl &= ~PHY_M_PC_DSC_MSK;
354 ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA; 363 ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA;
@@ -364,7 +373,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
364 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl); 373 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);
365 374
366 /* special setup for PHY 88E1112 Fiber */ 375 /* special setup for PHY 88E1112 Fiber */
367 if (hw->chip_id == CHIP_ID_YUKON_XL && !sky2_is_copper(hw)) { 376 if (hw->chip_id == CHIP_ID_YUKON_XL && (hw->flags & SKY2_HW_FIBRE_PHY)) {
368 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); 377 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
369 378
370 /* Fiber: select 1000BASE-X only mode MAC Specific Ctrl Reg. */ 379 /* Fiber: select 1000BASE-X only mode MAC Specific Ctrl Reg. */
@@ -455,7 +464,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
455 464
456 gma_write16(hw, port, GM_GP_CTRL, reg); 465 gma_write16(hw, port, GM_GP_CTRL, reg);
457 466
458 if (hw->chip_id != CHIP_ID_YUKON_FE) 467 if (hw->flags & SKY2_HW_GIGABIT)
459 gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, ct1000); 468 gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, ct1000);
460 469
461 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv); 470 gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv);
@@ -479,6 +488,23 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
479 gm_phy_write(hw, port, PHY_MARV_FE_LED_PAR, ctrl); 488 gm_phy_write(hw, port, PHY_MARV_FE_LED_PAR, ctrl);
480 break; 489 break;
481 490
491 case CHIP_ID_YUKON_FE_P:
492 /* Enable Link Partner Next Page */
493 ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);
494 ctrl |= PHY_M_PC_ENA_LIP_NP;
495
496 /* disable Energy Detect and enable scrambler */
497 ctrl &= ~(PHY_M_PC_ENA_ENE_DT | PHY_M_PC_DIS_SCRAMB);
498 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);
499
500 /* set LED2 -> ACT, LED1 -> LINK, LED0 -> SPEED */
501 ctrl = PHY_M_FELP_LED2_CTRL(LED_PAR_CTRL_ACT_BL) |
502 PHY_M_FELP_LED1_CTRL(LED_PAR_CTRL_LINK) |
503 PHY_M_FELP_LED0_CTRL(LED_PAR_CTRL_SPEED);
504
505 gm_phy_write(hw, port, PHY_MARV_FE_LED_PAR, ctrl);
506 break;
507
482 case CHIP_ID_YUKON_XL: 508 case CHIP_ID_YUKON_XL:
483 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); 509 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
484 510
@@ -548,7 +574,13 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
548 574
549 /* set page register to 0 */ 575 /* set page register to 0 */
550 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 0); 576 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 0);
577 } else if (hw->chip_id == CHIP_ID_YUKON_FE_P &&
578 hw->chip_rev == CHIP_REV_YU_FE2_A0) {
579 /* apply workaround for integrated resistors calibration */
580 gm_phy_write(hw, port, PHY_MARV_PAGE_ADDR, 17);
581 gm_phy_write(hw, port, PHY_MARV_PAGE_DATA, 0x3f60);
551 } else if (hw->chip_id != CHIP_ID_YUKON_EX) { 582 } else if (hw->chip_id != CHIP_ID_YUKON_EX) {
583 /* no effect on Yukon-XL */
552 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); 584 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
553 585
554 if (sky2->autoneg == AUTONEG_DISABLE || sky2->speed == SPEED_100) { 586 if (sky2->autoneg == AUTONEG_DISABLE || sky2->speed == SPEED_100) {
@@ -669,25 +701,25 @@ static void sky2_wol_init(struct sky2_port *sky2)
669 701
670static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port) 702static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port)
671{ 703{
672 if (hw->chip_id == CHIP_ID_YUKON_EX && hw->chip_rev != CHIP_REV_YU_EX_A0) { 704 struct net_device *dev = hw->dev[port];
705
706 if (dev->mtu <= ETH_DATA_LEN)
673 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), 707 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
674 TX_STFW_ENA | 708 TX_JUMBO_DIS | TX_STFW_ENA);
675 (hw->dev[port]->mtu > ETH_DATA_LEN) ? TX_JUMBO_ENA : TX_JUMBO_DIS);
676 } else {
677 if (hw->dev[port]->mtu > ETH_DATA_LEN) {
678 /* set Tx GMAC FIFO Almost Empty Threshold */
679 sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR),
680 (ECU_JUMBO_WM << 16) | ECU_AE_THR);
681 709
682 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), 710 else if (hw->chip_id != CHIP_ID_YUKON_EC_U)
683 TX_JUMBO_ENA | TX_STFW_DIS); 711 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
712 TX_STFW_ENA | TX_JUMBO_ENA);
713 else {
714 /* set Tx GMAC FIFO Almost Empty Threshold */
715 sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR),
716 (ECU_JUMBO_WM << 16) | ECU_AE_THR);
684 717
685 /* Can't do offload because of lack of store/forward */ 718 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
686 hw->dev[port]->features &= ~(NETIF_F_TSO | NETIF_F_SG 719 TX_JUMBO_ENA | TX_STFW_DIS);
687 | NETIF_F_ALL_CSUM); 720
688 } else 721 /* Can't do offload because of lack of store/forward */
689 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), 722 dev->features &= ~(NETIF_F_TSO | NETIF_F_SG | NETIF_F_ALL_CSUM);
690 TX_JUMBO_DIS | TX_STFW_ENA);
691 } 723 }
692} 724}
693 725
@@ -773,7 +805,8 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
773 /* Configure Rx MAC FIFO */ 805 /* Configure Rx MAC FIFO */
774 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); 806 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR);
775 rx_reg = GMF_OPER_ON | GMF_RX_F_FL_ON; 807 rx_reg = GMF_OPER_ON | GMF_RX_F_FL_ON;
776 if (hw->chip_id == CHIP_ID_YUKON_EX) 808 if (hw->chip_id == CHIP_ID_YUKON_EX ||
809 hw->chip_id == CHIP_ID_YUKON_FE_P)
777 rx_reg |= GMF_RX_OVER_ON; 810 rx_reg |= GMF_RX_OVER_ON;
778 811
779 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg); 812 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg);
@@ -782,13 +815,19 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
782 sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR); 815 sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
783 816
784 /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug */ 817 /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug */
785 sky2_write16(hw, SK_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF+1); 818 reg = RX_GMF_FL_THR_DEF + 1;
819 /* Another magic mystery workaround from sk98lin */
820 if (hw->chip_id == CHIP_ID_YUKON_FE_P &&
821 hw->chip_rev == CHIP_REV_YU_FE2_A0)
822 reg = 0x178;
823 sky2_write16(hw, SK_REG(port, RX_GMF_FL_THR), reg);
786 824
787 /* Configure Tx MAC FIFO */ 825 /* Configure Tx MAC FIFO */
788 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR); 826 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR);
789 sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); 827 sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON);
790 828
791 if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) { 829 /* On chips without ram buffer, pause is controled by MAC level */
830 if (sky2_read8(hw, B2_E_0) == 0) {
792 sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8); 831 sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8);
793 sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); 832 sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8);
794 833
@@ -871,6 +910,20 @@ static inline struct sky2_tx_le *get_tx_le(struct sky2_port *sky2)
871 return le; 910 return le;
872} 911}
873 912
913static void tx_init(struct sky2_port *sky2)
914{
915 struct sky2_tx_le *le;
916
917 sky2->tx_prod = sky2->tx_cons = 0;
918 sky2->tx_tcpsum = 0;
919 sky2->tx_last_mss = 0;
920
921 le = get_tx_le(sky2);
922 le->addr = 0;
923 le->opcode = OP_ADDR64 | HW_OWNER;
924 sky2->tx_addr64 = 0;
925}
926
874static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, 927static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2,
875 struct sky2_tx_le *le) 928 struct sky2_tx_le *le)
876{ 929{
@@ -967,19 +1020,15 @@ static void sky2_rx_unmap_skb(struct pci_dev *pdev, struct rx_ring_info *re)
967 */ 1020 */
968static void rx_set_checksum(struct sky2_port *sky2) 1021static void rx_set_checksum(struct sky2_port *sky2)
969{ 1022{
970 struct sky2_rx_le *le; 1023 struct sky2_rx_le *le = sky2_next_rx(sky2);
971
972 if (sky2->hw->chip_id != CHIP_ID_YUKON_EX) {
973 le = sky2_next_rx(sky2);
974 le->addr = cpu_to_le32((ETH_HLEN << 16) | ETH_HLEN);
975 le->ctrl = 0;
976 le->opcode = OP_TCPSTART | HW_OWNER;
977 1024
978 sky2_write32(sky2->hw, 1025 le->addr = cpu_to_le32((ETH_HLEN << 16) | ETH_HLEN);
979 Q_ADDR(rxqaddr[sky2->port], Q_CSR), 1026 le->ctrl = 0;
980 sky2->rx_csum ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); 1027 le->opcode = OP_TCPSTART | HW_OWNER;
981 }
982 1028
1029 sky2_write32(sky2->hw,
1030 Q_ADDR(rxqaddr[sky2->port], Q_CSR),
1031 sky2->rx_csum ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM);
983} 1032}
984 1033
985/* 1034/*
@@ -1175,7 +1224,8 @@ static int sky2_rx_start(struct sky2_port *sky2)
1175 1224
1176 sky2_prefetch_init(hw, rxq, sky2->rx_le_map, RX_LE_SIZE - 1); 1225 sky2_prefetch_init(hw, rxq, sky2->rx_le_map, RX_LE_SIZE - 1);
1177 1226
1178 rx_set_checksum(sky2); 1227 if (!(hw->flags & SKY2_HW_NEW_LE))
1228 rx_set_checksum(sky2);
1179 1229
1180 /* Space needed for frame data + headers rounded up */ 1230 /* Space needed for frame data + headers rounded up */
1181 size = roundup(sky2->netdev->mtu + ETH_HLEN + VLAN_HLEN, 8); 1231 size = roundup(sky2->netdev->mtu + ETH_HLEN + VLAN_HLEN, 8);
@@ -1246,7 +1296,7 @@ static int sky2_up(struct net_device *dev)
1246 struct sky2_port *sky2 = netdev_priv(dev); 1296 struct sky2_port *sky2 = netdev_priv(dev);
1247 struct sky2_hw *hw = sky2->hw; 1297 struct sky2_hw *hw = sky2->hw;
1248 unsigned port = sky2->port; 1298 unsigned port = sky2->port;
1249 u32 ramsize, imask; 1299 u32 imask, ramsize;
1250 int cap, err = -ENOMEM; 1300 int cap, err = -ENOMEM;
1251 struct net_device *otherdev = hw->dev[sky2->port^1]; 1301 struct net_device *otherdev = hw->dev[sky2->port^1];
1252 1302
@@ -1284,7 +1334,8 @@ static int sky2_up(struct net_device *dev)
1284 GFP_KERNEL); 1334 GFP_KERNEL);
1285 if (!sky2->tx_ring) 1335 if (!sky2->tx_ring)
1286 goto err_out; 1336 goto err_out;
1287 sky2->tx_prod = sky2->tx_cons = 0; 1337
1338 tx_init(sky2);
1288 1339
1289 sky2->rx_le = pci_alloc_consistent(hw->pdev, RX_LE_BYTES, 1340 sky2->rx_le = pci_alloc_consistent(hw->pdev, RX_LE_BYTES,
1290 &sky2->rx_le_map); 1341 &sky2->rx_le_map);
@@ -1303,11 +1354,10 @@ static int sky2_up(struct net_device *dev)
1303 1354
1304 /* Register is number of 4K blocks on internal RAM buffer. */ 1355 /* Register is number of 4K blocks on internal RAM buffer. */
1305 ramsize = sky2_read8(hw, B2_E_0) * 4; 1356 ramsize = sky2_read8(hw, B2_E_0) * 4;
1306 printk(KERN_INFO PFX "%s: ram buffer %dK\n", dev->name, ramsize);
1307
1308 if (ramsize > 0) { 1357 if (ramsize > 0) {
1309 u32 rxspace; 1358 u32 rxspace;
1310 1359
1360 pr_debug(PFX "%s: ram buffer %dK\n", dev->name, ramsize);
1311 if (ramsize < 16) 1361 if (ramsize < 16)
1312 rxspace = ramsize / 2; 1362 rxspace = ramsize / 2;
1313 else 1363 else
@@ -1436,13 +1486,15 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1436 /* Check for TCP Segmentation Offload */ 1486 /* Check for TCP Segmentation Offload */
1437 mss = skb_shinfo(skb)->gso_size; 1487 mss = skb_shinfo(skb)->gso_size;
1438 if (mss != 0) { 1488 if (mss != 0) {
1439 if (hw->chip_id != CHIP_ID_YUKON_EX) 1489
1490 if (!(hw->flags & SKY2_HW_NEW_LE))
1440 mss += ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb); 1491 mss += ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb);
1441 1492
1442 if (mss != sky2->tx_last_mss) { 1493 if (mss != sky2->tx_last_mss) {
1443 le = get_tx_le(sky2); 1494 le = get_tx_le(sky2);
1444 le->addr = cpu_to_le32(mss); 1495 le->addr = cpu_to_le32(mss);
1445 if (hw->chip_id == CHIP_ID_YUKON_EX) 1496
1497 if (hw->flags & SKY2_HW_NEW_LE)
1446 le->opcode = OP_MSS | HW_OWNER; 1498 le->opcode = OP_MSS | HW_OWNER;
1447 else 1499 else
1448 le->opcode = OP_LRGLEN | HW_OWNER; 1500 le->opcode = OP_LRGLEN | HW_OWNER;
@@ -1468,8 +1520,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1468 /* Handle TCP checksum offload */ 1520 /* Handle TCP checksum offload */
1469 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1521 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1470 /* On Yukon EX (some versions) encoding change. */ 1522 /* On Yukon EX (some versions) encoding change. */
1471 if (hw->chip_id == CHIP_ID_YUKON_EX 1523 if (hw->flags & SKY2_HW_AUTO_TX_SUM)
1472 && hw->chip_rev != CHIP_REV_YU_EX_B0)
1473 ctrl |= CALSUM; /* auto checksum */ 1524 ctrl |= CALSUM; /* auto checksum */
1474 else { 1525 else {
1475 const unsigned offset = skb_transport_offset(skb); 1526 const unsigned offset = skb_transport_offset(skb);
@@ -1622,9 +1673,6 @@ static int sky2_down(struct net_device *dev)
1622 if (netif_msg_ifdown(sky2)) 1673 if (netif_msg_ifdown(sky2))
1623 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); 1674 printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
1624 1675
1625 if (netif_carrier_ok(dev) && --hw->active == 0)
1626 del_timer(&hw->watchdog_timer);
1627
1628 /* Stop more packets from being queued */ 1676 /* Stop more packets from being queued */
1629 netif_stop_queue(dev); 1677 netif_stop_queue(dev);
1630 1678
@@ -1708,11 +1756,15 @@ static int sky2_down(struct net_device *dev)
1708 1756
1709static u16 sky2_phy_speed(const struct sky2_hw *hw, u16 aux) 1757static u16 sky2_phy_speed(const struct sky2_hw *hw, u16 aux)
1710{ 1758{
1711 if (!sky2_is_copper(hw)) 1759 if (hw->flags & SKY2_HW_FIBRE_PHY)
1712 return SPEED_1000; 1760 return SPEED_1000;
1713 1761
1714 if (hw->chip_id == CHIP_ID_YUKON_FE) 1762 if (!(hw->flags & SKY2_HW_GIGABIT)) {
1715 return (aux & PHY_M_PS_SPEED_100) ? SPEED_100 : SPEED_10; 1763 if (aux & PHY_M_PS_SPEED_100)
1764 return SPEED_100;
1765 else
1766 return SPEED_10;
1767 }
1716 1768
1717 switch (aux & PHY_M_PS_SPEED_MSK) { 1769 switch (aux & PHY_M_PS_SPEED_MSK) {
1718 case PHY_M_PS_SPEED_1000: 1770 case PHY_M_PS_SPEED_1000:
@@ -1745,17 +1797,13 @@ static void sky2_link_up(struct sky2_port *sky2)
1745 1797
1746 netif_carrier_on(sky2->netdev); 1798 netif_carrier_on(sky2->netdev);
1747 1799
1748 if (hw->active++ == 0) 1800 mod_timer(&hw->watchdog_timer, jiffies + 1);
1749 mod_timer(&hw->watchdog_timer, jiffies + 1);
1750
1751 1801
1752 /* Turn on link LED */ 1802 /* Turn on link LED */
1753 sky2_write8(hw, SK_REG(port, LNK_LED_REG), 1803 sky2_write8(hw, SK_REG(port, LNK_LED_REG),
1754 LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF); 1804 LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF);
1755 1805
1756 if (hw->chip_id == CHIP_ID_YUKON_XL 1806 if (hw->flags & SKY2_HW_NEWER_PHY) {
1757 || hw->chip_id == CHIP_ID_YUKON_EC_U
1758 || hw->chip_id == CHIP_ID_YUKON_EX) {
1759 u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); 1807 u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
1760 u16 led = PHY_M_LEDC_LOS_CTRL(1); /* link active */ 1808 u16 led = PHY_M_LEDC_LOS_CTRL(1); /* link active */
1761 1809
@@ -1800,11 +1848,6 @@ static void sky2_link_down(struct sky2_port *sky2)
1800 1848
1801 netif_carrier_off(sky2->netdev); 1849 netif_carrier_off(sky2->netdev);
1802 1850
1803 /* Stop watchdog if both ports are not active */
1804 if (--hw->active == 0)
1805 del_timer(&hw->watchdog_timer);
1806
1807
1808 /* Turn on link LED */ 1851 /* Turn on link LED */
1809 sky2_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF); 1852 sky2_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF);
1810 1853
@@ -1847,7 +1890,7 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
1847 /* Since the pause result bits seem to in different positions on 1890 /* Since the pause result bits seem to in different positions on
1848 * different chips. look at registers. 1891 * different chips. look at registers.
1849 */ 1892 */
1850 if (!sky2_is_copper(hw)) { 1893 if (hw->flags & SKY2_HW_FIBRE_PHY) {
1851 /* Shift for bits in fiber PHY */ 1894 /* Shift for bits in fiber PHY */
1852 advert &= ~(ADVERTISE_PAUSE_CAP|ADVERTISE_PAUSE_ASYM); 1895 advert &= ~(ADVERTISE_PAUSE_CAP|ADVERTISE_PAUSE_ASYM);
1853 lpa &= ~(LPA_PAUSE_CAP|LPA_PAUSE_ASYM); 1896 lpa &= ~(LPA_PAUSE_CAP|LPA_PAUSE_ASYM);
@@ -1958,7 +2001,9 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
1958 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) 2001 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
1959 return -EINVAL; 2002 return -EINVAL;
1960 2003
1961 if (new_mtu > ETH_DATA_LEN && hw->chip_id == CHIP_ID_YUKON_FE) 2004 if (new_mtu > ETH_DATA_LEN &&
2005 (hw->chip_id == CHIP_ID_YUKON_FE ||
2006 hw->chip_id == CHIP_ID_YUKON_FE_P))
1962 return -EINVAL; 2007 return -EINVAL;
1963 2008
1964 if (!netif_running(dev)) { 2009 if (!netif_running(dev)) {
@@ -1975,7 +2020,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
1975 2020
1976 synchronize_irq(hw->pdev->irq); 2021 synchronize_irq(hw->pdev->irq);
1977 2022
1978 if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) 2023 if (sky2_read8(hw, B2_E_0) == 0)
1979 sky2_set_tx_stfwd(hw, port); 2024 sky2_set_tx_stfwd(hw, port);
1980 2025
1981 ctl = gma_read16(hw, port, GM_GP_CTRL); 2026 ctl = gma_read16(hw, port, GM_GP_CTRL);
@@ -2103,6 +2148,13 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
2103 struct sky2_port *sky2 = netdev_priv(dev); 2148 struct sky2_port *sky2 = netdev_priv(dev);
2104 struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next; 2149 struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next;
2105 struct sk_buff *skb = NULL; 2150 struct sk_buff *skb = NULL;
2151 u16 count = (status & GMR_FS_LEN) >> 16;
2152
2153#ifdef SKY2_VLAN_TAG_USED
2154 /* Account for vlan tag */
2155 if (sky2->vlgrp && (status & GMR_FS_VLAN))
2156 count -= VLAN_HLEN;
2157#endif
2106 2158
2107 if (unlikely(netif_msg_rx_status(sky2))) 2159 if (unlikely(netif_msg_rx_status(sky2)))
2108 printk(KERN_DEBUG PFX "%s: rx slot %u status 0x%x len %d\n", 2160 printk(KERN_DEBUG PFX "%s: rx slot %u status 0x%x len %d\n",
@@ -2111,15 +2163,29 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
2111 sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; 2163 sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending;
2112 prefetch(sky2->rx_ring + sky2->rx_next); 2164 prefetch(sky2->rx_ring + sky2->rx_next);
2113 2165
2166 if (length < ETH_ZLEN || length > sky2->rx_data_size)
2167 goto len_error;
2168
2169 /* This chip has hardware problems that generates bogus status.
2170 * So do only marginal checking and expect higher level protocols
2171 * to handle crap frames.
2172 */
2173 if (sky2->hw->chip_id == CHIP_ID_YUKON_FE_P &&
2174 sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0 &&
2175 length != count)
2176 goto okay;
2177
2114 if (status & GMR_FS_ANY_ERR) 2178 if (status & GMR_FS_ANY_ERR)
2115 goto error; 2179 goto error;
2116 2180
2117 if (!(status & GMR_FS_RX_OK)) 2181 if (!(status & GMR_FS_RX_OK))
2118 goto resubmit; 2182 goto resubmit;
2119 2183
2120 if (status >> 16 != length) 2184 /* if length reported by DMA does not match PHY, packet was truncated */
2121 goto len_mismatch; 2185 if (length != count)
2186 goto len_error;
2122 2187
2188okay:
2123 if (length < copybreak) 2189 if (length < copybreak)
2124 skb = receive_copy(sky2, re, length); 2190 skb = receive_copy(sky2, re, length);
2125 else 2191 else
@@ -2129,10 +2195,14 @@ resubmit:
2129 2195
2130 return skb; 2196 return skb;
2131 2197
2132len_mismatch: 2198len_error:
2133 /* Truncation of overlength packets 2199 /* Truncation of overlength packets
2134 causes PHY length to not match MAC length */ 2200 causes PHY length to not match MAC length */
2135 ++sky2->net_stats.rx_length_errors; 2201 ++sky2->net_stats.rx_length_errors;
2202 if (netif_msg_rx_err(sky2) && net_ratelimit())
2203 pr_info(PFX "%s: rx length error: status %#x length %d\n",
2204 dev->name, status, length);
2205 goto resubmit;
2136 2206
2137error: 2207error:
2138 ++sky2->net_stats.rx_errors; 2208 ++sky2->net_stats.rx_errors;
@@ -2202,7 +2272,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
2202 } 2272 }
2203 2273
2204 /* This chip reports checksum status differently */ 2274 /* This chip reports checksum status differently */
2205 if (hw->chip_id == CHIP_ID_YUKON_EX) { 2275 if (hw->flags & SKY2_HW_NEW_LE) {
2206 if (sky2->rx_csum && 2276 if (sky2->rx_csum &&
2207 (le->css & (CSS_ISIPV4 | CSS_ISIPV6)) && 2277 (le->css & (CSS_ISIPV4 | CSS_ISIPV6)) &&
2208 (le->css & CSS_TCPUDPCSOK)) 2278 (le->css & CSS_TCPUDPCSOK))
@@ -2243,8 +2313,14 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
2243 if (!sky2->rx_csum) 2313 if (!sky2->rx_csum)
2244 break; 2314 break;
2245 2315
2246 if (hw->chip_id == CHIP_ID_YUKON_EX) 2316 /* If this happens then driver assuming wrong format */
2317 if (unlikely(hw->flags & SKY2_HW_NEW_LE)) {
2318 if (net_ratelimit())
2319 printk(KERN_NOTICE "%s: unexpected"
2320 " checksum status\n",
2321 dev->name);
2247 break; 2322 break;
2323 }
2248 2324
2249 /* Both checksum counters are programmed to start at 2325 /* Both checksum counters are programmed to start at
2250 * the same offset, so unless there is a problem they 2326 * the same offset, so unless there is a problem they
@@ -2436,20 +2512,72 @@ static void sky2_le_error(struct sky2_hw *hw, unsigned port,
2436 sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK); 2512 sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK);
2437} 2513}
2438 2514
2439/* Check for lost IRQ once a second */ 2515static int sky2_rx_hung(struct net_device *dev)
2516{
2517 struct sky2_port *sky2 = netdev_priv(dev);
2518 struct sky2_hw *hw = sky2->hw;
2519 unsigned port = sky2->port;
2520 unsigned rxq = rxqaddr[port];
2521 u32 mac_rp = sky2_read32(hw, SK_REG(port, RX_GMF_RP));
2522 u8 mac_lev = sky2_read8(hw, SK_REG(port, RX_GMF_RLEV));
2523 u8 fifo_rp = sky2_read8(hw, Q_ADDR(rxq, Q_RP));
2524 u8 fifo_lev = sky2_read8(hw, Q_ADDR(rxq, Q_RL));
2525
2526 /* If idle and MAC or PCI is stuck */
2527 if (sky2->check.last == dev->last_rx &&
2528 ((mac_rp == sky2->check.mac_rp &&
2529 mac_lev != 0 && mac_lev >= sky2->check.mac_lev) ||
2530 /* Check if the PCI RX hang */
2531 (fifo_rp == sky2->check.fifo_rp &&
2532 fifo_lev != 0 && fifo_lev >= sky2->check.fifo_lev))) {
2533 printk(KERN_DEBUG PFX "%s: hung mac %d:%d fifo %d (%d:%d)\n",
2534 dev->name, mac_lev, mac_rp, fifo_lev, fifo_rp,
2535 sky2_read8(hw, Q_ADDR(rxq, Q_WP)));
2536 return 1;
2537 } else {
2538 sky2->check.last = dev->last_rx;
2539 sky2->check.mac_rp = mac_rp;
2540 sky2->check.mac_lev = mac_lev;
2541 sky2->check.fifo_rp = fifo_rp;
2542 sky2->check.fifo_lev = fifo_lev;
2543 return 0;
2544 }
2545}
2546
2440static void sky2_watchdog(unsigned long arg) 2547static void sky2_watchdog(unsigned long arg)
2441{ 2548{
2442 struct sky2_hw *hw = (struct sky2_hw *) arg; 2549 struct sky2_hw *hw = (struct sky2_hw *) arg;
2550 struct net_device *dev;
2443 2551
2552 /* Check for lost IRQ once a second */
2444 if (sky2_read32(hw, B0_ISRC)) { 2553 if (sky2_read32(hw, B0_ISRC)) {
2445 struct net_device *dev = hw->dev[0]; 2554 dev = hw->dev[0];
2446
2447 if (__netif_rx_schedule_prep(dev)) 2555 if (__netif_rx_schedule_prep(dev))
2448 __netif_rx_schedule(dev); 2556 __netif_rx_schedule(dev);
2557 } else {
2558 int i, active = 0;
2559
2560 for (i = 0; i < hw->ports; i++) {
2561 dev = hw->dev[i];
2562 if (!netif_running(dev))
2563 continue;
2564 ++active;
2565
2566 /* For chips with Rx FIFO, check if stuck */
2567 if ((hw->flags & SKY2_HW_FIFO_HANG_CHECK) &&
2568 sky2_rx_hung(dev)) {
2569 pr_info(PFX "%s: receiver hang detected\n",
2570 dev->name);
2571 schedule_work(&hw->restart_work);
2572 return;
2573 }
2574 }
2575
2576 if (active == 0)
2577 return;
2449 } 2578 }
2450 2579
2451 if (hw->active > 0) 2580 mod_timer(&hw->watchdog_timer, round_jiffies(jiffies + HZ));
2452 mod_timer(&hw->watchdog_timer, round_jiffies(jiffies + HZ));
2453} 2581}
2454 2582
2455/* Hardware/software error handling */ 2583/* Hardware/software error handling */
@@ -2546,17 +2674,25 @@ static void sky2_netpoll(struct net_device *dev)
2546#endif 2674#endif
2547 2675
2548/* Chip internal frequency for clock calculations */ 2676/* Chip internal frequency for clock calculations */
2549static inline u32 sky2_mhz(const struct sky2_hw *hw) 2677static u32 sky2_mhz(const struct sky2_hw *hw)
2550{ 2678{
2551 switch (hw->chip_id) { 2679 switch (hw->chip_id) {
2552 case CHIP_ID_YUKON_EC: 2680 case CHIP_ID_YUKON_EC:
2553 case CHIP_ID_YUKON_EC_U: 2681 case CHIP_ID_YUKON_EC_U:
2554 case CHIP_ID_YUKON_EX: 2682 case CHIP_ID_YUKON_EX:
2555 return 125; /* 125 Mhz */ 2683 return 125;
2684
2556 case CHIP_ID_YUKON_FE: 2685 case CHIP_ID_YUKON_FE:
2557 return 100; /* 100 Mhz */ 2686 return 100;
2558 default: /* YUKON_XL */ 2687
2559 return 156; /* 156 Mhz */ 2688 case CHIP_ID_YUKON_FE_P:
2689 return 50;
2690
2691 case CHIP_ID_YUKON_XL:
2692 return 156;
2693
2694 default:
2695 BUG();
2560 } 2696 }
2561} 2697}
2562 2698
@@ -2581,23 +2717,63 @@ static int __devinit sky2_init(struct sky2_hw *hw)
2581 sky2_write8(hw, B0_CTST, CS_RST_CLR); 2717 sky2_write8(hw, B0_CTST, CS_RST_CLR);
2582 2718
2583 hw->chip_id = sky2_read8(hw, B2_CHIP_ID); 2719 hw->chip_id = sky2_read8(hw, B2_CHIP_ID);
2584 if (hw->chip_id < CHIP_ID_YUKON_XL || hw->chip_id > CHIP_ID_YUKON_FE) { 2720 hw->chip_rev = (sky2_read8(hw, B2_MAC_CFG) & CFG_CHIP_R_MSK) >> 4;
2721
2722 switch(hw->chip_id) {
2723 case CHIP_ID_YUKON_XL:
2724 hw->flags = SKY2_HW_GIGABIT
2725 | SKY2_HW_NEWER_PHY;
2726 if (hw->chip_rev < 3)
2727 hw->flags |= SKY2_HW_FIFO_HANG_CHECK;
2728
2729 break;
2730
2731 case CHIP_ID_YUKON_EC_U:
2732 hw->flags = SKY2_HW_GIGABIT
2733 | SKY2_HW_NEWER_PHY
2734 | SKY2_HW_ADV_POWER_CTL;
2735 break;
2736
2737 case CHIP_ID_YUKON_EX:
2738 hw->flags = SKY2_HW_GIGABIT
2739 | SKY2_HW_NEWER_PHY
2740 | SKY2_HW_NEW_LE
2741 | SKY2_HW_ADV_POWER_CTL;
2742
2743 /* New transmit checksum */
2744 if (hw->chip_rev != CHIP_REV_YU_EX_B0)
2745 hw->flags |= SKY2_HW_AUTO_TX_SUM;
2746 break;
2747
2748 case CHIP_ID_YUKON_EC:
2749 /* This rev is really old, and requires untested workarounds */
2750 if (hw->chip_rev == CHIP_REV_YU_EC_A1) {
2751 dev_err(&hw->pdev->dev, "unsupported revision Yukon-EC rev A1\n");
2752 return -EOPNOTSUPP;
2753 }
2754 hw->flags = SKY2_HW_GIGABIT | SKY2_HW_FIFO_HANG_CHECK;
2755 break;
2756
2757 case CHIP_ID_YUKON_FE:
2758 break;
2759
2760 case CHIP_ID_YUKON_FE_P:
2761 hw->flags = SKY2_HW_NEWER_PHY
2762 | SKY2_HW_NEW_LE
2763 | SKY2_HW_AUTO_TX_SUM
2764 | SKY2_HW_ADV_POWER_CTL;
2765 break;
2766 default:
2585 dev_err(&hw->pdev->dev, "unsupported chip type 0x%x\n", 2767 dev_err(&hw->pdev->dev, "unsupported chip type 0x%x\n",
2586 hw->chip_id); 2768 hw->chip_id);
2587 return -EOPNOTSUPP; 2769 return -EOPNOTSUPP;
2588 } 2770 }
2589 2771
2590 hw->chip_rev = (sky2_read8(hw, B2_MAC_CFG) & CFG_CHIP_R_MSK) >> 4; 2772 hw->pmd_type = sky2_read8(hw, B2_PMD_TYP);
2773 if (hw->pmd_type == 'L' || hw->pmd_type == 'S' || hw->pmd_type == 'P')
2774 hw->flags |= SKY2_HW_FIBRE_PHY;
2591 2775
2592 /* This rev is really old, and requires untested workarounds */
2593 if (hw->chip_id == CHIP_ID_YUKON_EC && hw->chip_rev == CHIP_REV_YU_EC_A1) {
2594 dev_err(&hw->pdev->dev, "unsupported revision Yukon-%s (0x%x) rev %d\n",
2595 yukon2_name[hw->chip_id - CHIP_ID_YUKON_XL],
2596 hw->chip_id, hw->chip_rev);
2597 return -EOPNOTSUPP;
2598 }
2599 2776
2600 hw->pmd_type = sky2_read8(hw, B2_PMD_TYP);
2601 hw->ports = 1; 2777 hw->ports = 1;
2602 t8 = sky2_read8(hw, B2_Y2_HW_RES); 2778 t8 = sky2_read8(hw, B2_Y2_HW_RES);
2603 if ((t8 & CFG_DUAL_MAC_MSK) == CFG_DUAL_MAC_MSK) { 2779 if ((t8 & CFG_DUAL_MAC_MSK) == CFG_DUAL_MAC_MSK) {
@@ -2791,7 +2967,9 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
2791 2967
2792 sky2->wol = wol->wolopts; 2968 sky2->wol = wol->wolopts;
2793 2969
2794 if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) 2970 if (hw->chip_id == CHIP_ID_YUKON_EC_U ||
2971 hw->chip_id == CHIP_ID_YUKON_EX ||
2972 hw->chip_id == CHIP_ID_YUKON_FE_P)
2795 sky2_write32(hw, B0_CTST, sky2->wol 2973 sky2_write32(hw, B0_CTST, sky2->wol
2796 ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); 2974 ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
2797 2975
@@ -2809,7 +2987,7 @@ static u32 sky2_supported_modes(const struct sky2_hw *hw)
2809 | SUPPORTED_100baseT_Full 2987 | SUPPORTED_100baseT_Full
2810 | SUPPORTED_Autoneg | SUPPORTED_TP; 2988 | SUPPORTED_Autoneg | SUPPORTED_TP;
2811 2989
2812 if (hw->chip_id != CHIP_ID_YUKON_FE) 2990 if (hw->flags & SKY2_HW_GIGABIT)
2813 modes |= SUPPORTED_1000baseT_Half 2991 modes |= SUPPORTED_1000baseT_Half
2814 | SUPPORTED_1000baseT_Full; 2992 | SUPPORTED_1000baseT_Full;
2815 return modes; 2993 return modes;
@@ -2829,13 +3007,6 @@ static int sky2_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
2829 ecmd->supported = sky2_supported_modes(hw); 3007 ecmd->supported = sky2_supported_modes(hw);
2830 ecmd->phy_address = PHY_ADDR_MARV; 3008 ecmd->phy_address = PHY_ADDR_MARV;
2831 if (sky2_is_copper(hw)) { 3009 if (sky2_is_copper(hw)) {
2832 ecmd->supported = SUPPORTED_10baseT_Half
2833 | SUPPORTED_10baseT_Full
2834 | SUPPORTED_100baseT_Half
2835 | SUPPORTED_100baseT_Full
2836 | SUPPORTED_1000baseT_Half
2837 | SUPPORTED_1000baseT_Full
2838 | SUPPORTED_Autoneg | SUPPORTED_TP;
2839 ecmd->port = PORT_TP; 3010 ecmd->port = PORT_TP;
2840 ecmd->speed = sky2->speed; 3011 ecmd->speed = sky2->speed;
2841 } else { 3012 } else {
@@ -3814,8 +3985,12 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3814 dev->features |= NETIF_F_HIGHDMA; 3985 dev->features |= NETIF_F_HIGHDMA;
3815 3986
3816#ifdef SKY2_VLAN_TAG_USED 3987#ifdef SKY2_VLAN_TAG_USED
3817 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 3988 /* The workaround for FE+ status conflicts with VLAN tag detection. */
3818 dev->vlan_rx_register = sky2_vlan_rx_register; 3989 if (!(sky2->hw->chip_id == CHIP_ID_YUKON_FE_P &&
3990 sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0)) {
3991 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
3992 dev->vlan_rx_register = sky2_vlan_rx_register;
3993 }
3819#endif 3994#endif
3820 3995
3821 /* read the mac address */ 3996 /* read the mac address */
@@ -3846,7 +4021,7 @@ static irqreturn_t __devinit sky2_test_intr(int irq, void *dev_id)
3846 return IRQ_NONE; 4021 return IRQ_NONE;
3847 4022
3848 if (status & Y2_IS_IRQ_SW) { 4023 if (status & Y2_IS_IRQ_SW) {
3849 hw->msi = 1; 4024 hw->flags |= SKY2_HW_USE_MSI;
3850 wake_up(&hw->msi_wait); 4025 wake_up(&hw->msi_wait);
3851 sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ); 4026 sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
3852 } 4027 }
@@ -3874,9 +4049,9 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
3874 sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ); 4049 sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ);
3875 sky2_read8(hw, B0_CTST); 4050 sky2_read8(hw, B0_CTST);
3876 4051
3877 wait_event_timeout(hw->msi_wait, hw->msi, HZ/10); 4052 wait_event_timeout(hw->msi_wait, (hw->flags & SKY2_HW_USE_MSI), HZ/10);
3878 4053
3879 if (!hw->msi) { 4054 if (!(hw->flags & SKY2_HW_USE_MSI)) {
3880 /* MSI test failed, go back to INTx mode */ 4055 /* MSI test failed, go back to INTx mode */
3881 dev_info(&pdev->dev, "No interrupt generated using MSI, " 4056 dev_info(&pdev->dev, "No interrupt generated using MSI, "
3882 "switching to INTx mode.\n"); 4057 "switching to INTx mode.\n");
@@ -4009,7 +4184,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4009 goto err_out_free_netdev; 4184 goto err_out_free_netdev;
4010 } 4185 }
4011 4186
4012 err = request_irq(pdev->irq, sky2_intr, hw->msi ? 0 : IRQF_SHARED, 4187 err = request_irq(pdev->irq, sky2_intr,
4188 (hw->flags & SKY2_HW_USE_MSI) ? 0 : IRQF_SHARED,
4013 dev->name, hw); 4189 dev->name, hw);
4014 if (err) { 4190 if (err) {
4015 dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq); 4191 dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq);
@@ -4042,7 +4218,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4042 return 0; 4218 return 0;
4043 4219
4044err_out_unregister: 4220err_out_unregister:
4045 if (hw->msi) 4221 if (hw->flags & SKY2_HW_USE_MSI)
4046 pci_disable_msi(pdev); 4222 pci_disable_msi(pdev);
4047 unregister_netdev(dev); 4223 unregister_netdev(dev);
4048err_out_free_netdev: 4224err_out_free_netdev:
@@ -4091,7 +4267,7 @@ static void __devexit sky2_remove(struct pci_dev *pdev)
4091 sky2_read8(hw, B0_CTST); 4267 sky2_read8(hw, B0_CTST);
4092 4268
4093 free_irq(pdev->irq, hw); 4269 free_irq(pdev->irq, hw);
4094 if (hw->msi) 4270 if (hw->flags & SKY2_HW_USE_MSI)
4095 pci_disable_msi(pdev); 4271 pci_disable_msi(pdev);
4096 pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma); 4272 pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma);
4097 pci_release_regions(pdev); 4273 pci_release_regions(pdev);
@@ -4159,7 +4335,9 @@ static int sky2_resume(struct pci_dev *pdev)
4159 pci_enable_wake(pdev, PCI_D0, 0); 4335 pci_enable_wake(pdev, PCI_D0, 0);
4160 4336
4161 /* Re-enable all clocks */ 4337 /* Re-enable all clocks */
4162 if (hw->chip_id == CHIP_ID_YUKON_EX || hw->chip_id == CHIP_ID_YUKON_EC_U) 4338 if (hw->chip_id == CHIP_ID_YUKON_EX ||
4339 hw->chip_id == CHIP_ID_YUKON_EC_U ||
4340 hw->chip_id == CHIP_ID_YUKON_FE_P)
4163 sky2_pci_write32(hw, PCI_DEV_REG3, 0); 4341 sky2_pci_write32(hw, PCI_DEV_REG3, 0);
4164 4342
4165 sky2_reset(hw); 4343 sky2_reset(hw);
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 72e12b7cfa40..8bc5c54e3efa 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -470,18 +470,24 @@ enum {
470 CHIP_ID_YUKON_EX = 0xb5, /* Chip ID for YUKON-2 Extreme */ 470 CHIP_ID_YUKON_EX = 0xb5, /* Chip ID for YUKON-2 Extreme */
471 CHIP_ID_YUKON_EC = 0xb6, /* Chip ID for YUKON-2 EC */ 471 CHIP_ID_YUKON_EC = 0xb6, /* Chip ID for YUKON-2 EC */
472 CHIP_ID_YUKON_FE = 0xb7, /* Chip ID for YUKON-2 FE */ 472 CHIP_ID_YUKON_FE = 0xb7, /* Chip ID for YUKON-2 FE */
473 473 CHIP_ID_YUKON_FE_P = 0xb8, /* Chip ID for YUKON-2 FE+ */
474};
475enum yukon_ec_rev {
474 CHIP_REV_YU_EC_A1 = 0, /* Chip Rev. for Yukon-EC A1/A0 */ 476 CHIP_REV_YU_EC_A1 = 0, /* Chip Rev. for Yukon-EC A1/A0 */
475 CHIP_REV_YU_EC_A2 = 1, /* Chip Rev. for Yukon-EC A2 */ 477 CHIP_REV_YU_EC_A2 = 1, /* Chip Rev. for Yukon-EC A2 */
476 CHIP_REV_YU_EC_A3 = 2, /* Chip Rev. for Yukon-EC A3 */ 478 CHIP_REV_YU_EC_A3 = 2, /* Chip Rev. for Yukon-EC A3 */
477 479};
480enum yukon_ec_u_rev {
478 CHIP_REV_YU_EC_U_A0 = 1, 481 CHIP_REV_YU_EC_U_A0 = 1,
479 CHIP_REV_YU_EC_U_A1 = 2, 482 CHIP_REV_YU_EC_U_A1 = 2,
480 CHIP_REV_YU_EC_U_B0 = 3, 483 CHIP_REV_YU_EC_U_B0 = 3,
481 484};
485enum yukon_fe_rev {
482 CHIP_REV_YU_FE_A1 = 1, 486 CHIP_REV_YU_FE_A1 = 1,
483 CHIP_REV_YU_FE_A2 = 2, 487 CHIP_REV_YU_FE_A2 = 2,
484 488};
489enum yukon_fe_p_rev {
490 CHIP_REV_YU_FE2_A0 = 0,
485}; 491};
486enum yukon_ex_rev { 492enum yukon_ex_rev {
487 CHIP_REV_YU_EX_A0 = 1, 493 CHIP_REV_YU_EX_A0 = 1,
@@ -1668,7 +1674,7 @@ enum {
1668 1674
1669/* Receive Frame Status Encoding */ 1675/* Receive Frame Status Encoding */
1670enum { 1676enum {
1671 GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */ 1677 GMR_FS_LEN = 0x7fff<<16, /* Bit 30..16: Rx Frame Length */
1672 GMR_FS_VLAN = 1<<13, /* VLAN Packet */ 1678 GMR_FS_VLAN = 1<<13, /* VLAN Packet */
1673 GMR_FS_JABBER = 1<<12, /* Jabber Packet */ 1679 GMR_FS_JABBER = 1<<12, /* Jabber Packet */
1674 GMR_FS_UN_SIZE = 1<<11, /* Undersize Packet */ 1680 GMR_FS_UN_SIZE = 1<<11, /* Undersize Packet */
@@ -1729,6 +1735,10 @@ enum {
1729 GMF_RX_CTRL_DEF = GMF_OPER_ON | GMF_RX_F_FL_ON, 1735 GMF_RX_CTRL_DEF = GMF_OPER_ON | GMF_RX_F_FL_ON,
1730}; 1736};
1731 1737
1738/* TX_GMF_EA 32 bit Tx GMAC FIFO End Address */
1739enum {
1740 TX_DYN_WM_ENA = 3, /* Yukon-FE+ specific */
1741};
1732 1742
1733/* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test */ 1743/* TX_GMF_CTRL_T 32 bit Tx GMAC FIFO Control/Test */
1734enum { 1744enum {
@@ -2017,6 +2027,14 @@ struct sky2_port {
2017 u16 rx_tag; 2027 u16 rx_tag;
2018 struct vlan_group *vlgrp; 2028 struct vlan_group *vlgrp;
2019#endif 2029#endif
2030 struct {
2031 unsigned long last;
2032 u32 mac_rp;
2033 u8 mac_lev;
2034 u8 fifo_rp;
2035 u8 fifo_lev;
2036 } check;
2037
2020 2038
2021 dma_addr_t rx_le_map; 2039 dma_addr_t rx_le_map;
2022 dma_addr_t tx_le_map; 2040 dma_addr_t tx_le_map;
@@ -2040,12 +2058,20 @@ struct sky2_hw {
2040 void __iomem *regs; 2058 void __iomem *regs;
2041 struct pci_dev *pdev; 2059 struct pci_dev *pdev;
2042 struct net_device *dev[2]; 2060 struct net_device *dev[2];
2061 unsigned long flags;
2062#define SKY2_HW_USE_MSI 0x00000001
2063#define SKY2_HW_FIBRE_PHY 0x00000002
2064#define SKY2_HW_GIGABIT 0x00000004
2065#define SKY2_HW_NEWER_PHY 0x00000008
2066#define SKY2_HW_FIFO_HANG_CHECK 0x00000010
2067#define SKY2_HW_NEW_LE 0x00000020 /* new LSOv2 format */
2068#define SKY2_HW_AUTO_TX_SUM 0x00000040 /* new IP decode for Tx */
2069#define SKY2_HW_ADV_POWER_CTL 0x00000080 /* additional PHY power regs */
2043 2070
2044 u8 chip_id; 2071 u8 chip_id;
2045 u8 chip_rev; 2072 u8 chip_rev;
2046 u8 pmd_type; 2073 u8 pmd_type;
2047 u8 ports; 2074 u8 ports;
2048 u8 active;
2049 2075
2050 struct sky2_status_le *st_le; 2076 struct sky2_status_le *st_le;
2051 u32 st_idx; 2077 u32 st_idx;
@@ -2053,13 +2079,12 @@ struct sky2_hw {
2053 2079
2054 struct timer_list watchdog_timer; 2080 struct timer_list watchdog_timer;
2055 struct work_struct restart_work; 2081 struct work_struct restart_work;
2056 int msi;
2057 wait_queue_head_t msi_wait; 2082 wait_queue_head_t msi_wait;
2058}; 2083};
2059 2084
2060static inline int sky2_is_copper(const struct sky2_hw *hw) 2085static inline int sky2_is_copper(const struct sky2_hw *hw)
2061{ 2086{
2062 return !(hw->pmd_type == 'L' || hw->pmd_type == 'S' || hw->pmd_type == 'P'); 2087 return !(hw->flags & SKY2_HW_FIBRE_PHY);
2063} 2088}
2064 2089
2065/* Register accessor for memory mapped device */ 2090/* Register accessor for memory mapped device */
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 16c7a0e87850..a2de32fabc17 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -405,7 +405,7 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
405 dev->net->ethtool_ops = &dm9601_ethtool_ops; 405 dev->net->ethtool_ops = &dm9601_ethtool_ops;
406 dev->net->hard_header_len += DM_TX_OVERHEAD; 406 dev->net->hard_header_len += DM_TX_OVERHEAD;
407 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; 407 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
408 dev->rx_urb_size = dev->net->mtu + DM_RX_OVERHEAD; 408 dev->rx_urb_size = dev->net->mtu + ETH_HLEN + DM_RX_OVERHEAD;
409 409
410 dev->mii.dev = dev->net; 410 dev->mii.dev = dev->net;
411 dev->mii.mdio_read = dm9601_mdio_read; 411 dev->mii.mdio_read = dm9601_mdio_read;
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index ef35bc6c4a22..4eb6d9752881 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -43,7 +43,7 @@ obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
43obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o 43obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o
44 44
45obj-$(CONFIG_USB_ZD1201) += zd1201.o 45obj-$(CONFIG_USB_ZD1201) += zd1201.o
46obj-$(CONFIG_LIBERTAS_USB) += libertas/ 46obj-$(CONFIG_LIBERTAS) += libertas/
47 47
48rtl8187-objs := rtl8187_dev.o rtl8187_rtl8225.o 48rtl8187-objs := rtl8187_dev.o rtl8187_rtl8225.o
49obj-$(CONFIG_RTL8187) += rtl8187.o 49obj-$(CONFIG_RTL8187) += rtl8187.o
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7dcaa09b3c20..50f2dd9e1bb2 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1444,7 +1444,6 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, quirk_netmos);
1444static void __devinit quirk_e100_interrupt(struct pci_dev *dev) 1444static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
1445{ 1445{
1446 u16 command; 1446 u16 command;
1447 u32 bar;
1448 u8 __iomem *csr; 1447 u8 __iomem *csr;
1449 u8 cmd_hi; 1448 u8 cmd_hi;
1450 1449
@@ -1476,12 +1475,12 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
1476 * re-enable them when it's ready. 1475 * re-enable them when it's ready.
1477 */ 1476 */
1478 pci_read_config_word(dev, PCI_COMMAND, &command); 1477 pci_read_config_word(dev, PCI_COMMAND, &command);
1479 pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar);
1480 1478
1481 if (!(command & PCI_COMMAND_MEMORY) || !bar) 1479 if (!(command & PCI_COMMAND_MEMORY) || !pci_resource_start(dev, 0))
1482 return; 1480 return;
1483 1481
1484 csr = ioremap(bar, 8); 1482 /* Convert from PCI bus to resource space. */
1483 csr = ioremap(pci_resource_start(dev, 0), 8);
1485 if (!csr) { 1484 if (!csr) {
1486 printk(KERN_WARNING "PCI: Can't map %s e100 registers\n", 1485 printk(KERN_WARNING "PCI: Can't map %s e100 registers\n",
1487 pci_name(dev)); 1486 pci_name(dev));
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index c7c4574729b1..de3155b21285 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -289,6 +289,7 @@ int power_supply_uevent(struct device *dev, char **envp, int num_envp,
289 if (ret) 289 if (ret)
290 goto out; 290 goto out;
291 } 291 }
292 envp[i] = NULL;
292 293
293out: 294out:
294 free_page((unsigned long)prop_buf); 295 free_page((unsigned long)prop_buf);
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index d5d8caba3560..ab13824df856 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -451,7 +451,7 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task,
451 struct scb *scb; 451 struct scb *scb;
452 452
453 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1, 453 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1,
454 PCI_DMA_FROMDEVICE); 454 PCI_DMA_TODEVICE);
455 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1, 455 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1,
456 PCI_DMA_FROMDEVICE); 456 PCI_DMA_FROMDEVICE);
457 457
@@ -486,7 +486,7 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a)
486 486
487 BUG_ON(!task); 487 BUG_ON(!task);
488 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1, 488 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1,
489 PCI_DMA_FROMDEVICE); 489 PCI_DMA_TODEVICE);
490 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1, 490 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1,
491 PCI_DMA_FROMDEVICE); 491 PCI_DMA_FROMDEVICE);
492} 492}
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 77b06a983fa7..95cf7b6cd622 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2314,6 +2314,7 @@ int __devinit scsi_esp_register(struct esp *esp, struct device *dev)
2314 esp->host->transportt = esp_transport_template; 2314 esp->host->transportt = esp_transport_template;
2315 esp->host->max_lun = ESP_MAX_LUN; 2315 esp->host->max_lun = ESP_MAX_LUN;
2316 esp->host->cmd_per_lun = 2; 2316 esp->host->cmd_per_lun = 2;
2317 esp->host->unique_id = instance;
2317 2318
2318 esp_set_clock_params(esp); 2319 esp_set_clock_params(esp);
2319 2320
@@ -2337,7 +2338,7 @@ int __devinit scsi_esp_register(struct esp *esp, struct device *dev)
2337 if (err) 2338 if (err)
2338 return err; 2339 return err;
2339 2340
2340 esp->host->unique_id = instance++; 2341 instance++;
2341 2342
2342 scsi_scan_host(esp->host); 2343 scsi_scan_host(esp->host);
2343 2344
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 6f56f8750635..4df21c92ff1e 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -787,10 +787,12 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
787 struct scsi_target *starget = sdev->sdev_target; 787 struct scsi_target *starget = sdev->sdev_target;
788 struct Scsi_Host *shost = sdev->host; 788 struct Scsi_Host *shost = sdev->host;
789 int len = sdev->inquiry_len; 789 int len = sdev->inquiry_len;
790 int min_period = spi_min_period(starget);
791 int max_width = spi_max_width(starget);
790 /* first set us up for narrow async */ 792 /* first set us up for narrow async */
791 DV_SET(offset, 0); 793 DV_SET(offset, 0);
792 DV_SET(width, 0); 794 DV_SET(width, 0);
793 795
794 if (spi_dv_device_compare_inquiry(sdev, buffer, buffer, DV_LOOPS) 796 if (spi_dv_device_compare_inquiry(sdev, buffer, buffer, DV_LOOPS)
795 != SPI_COMPARE_SUCCESS) { 797 != SPI_COMPARE_SUCCESS) {
796 starget_printk(KERN_ERR, starget, "Domain Validation Initial Inquiry Failed\n"); 798 starget_printk(KERN_ERR, starget, "Domain Validation Initial Inquiry Failed\n");
@@ -798,9 +800,13 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
798 return; 800 return;
799 } 801 }
800 802
803 if (!scsi_device_wide(sdev)) {
804 spi_max_width(starget) = 0;
805 max_width = 0;
806 }
807
801 /* test width */ 808 /* test width */
802 if (i->f->set_width && spi_max_width(starget) && 809 if (i->f->set_width && max_width) {
803 scsi_device_wide(sdev)) {
804 i->f->set_width(starget, 1); 810 i->f->set_width(starget, 1);
805 811
806 if (spi_dv_device_compare_inquiry(sdev, buffer, 812 if (spi_dv_device_compare_inquiry(sdev, buffer,
@@ -809,6 +815,11 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
809 != SPI_COMPARE_SUCCESS) { 815 != SPI_COMPARE_SUCCESS) {
810 starget_printk(KERN_ERR, starget, "Wide Transfers Fail\n"); 816 starget_printk(KERN_ERR, starget, "Wide Transfers Fail\n");
811 i->f->set_width(starget, 0); 817 i->f->set_width(starget, 0);
818 /* Make sure we don't force wide back on by asking
819 * for a transfer period that requires it */
820 max_width = 0;
821 if (min_period < 10)
822 min_period = 10;
812 } 823 }
813 } 824 }
814 825
@@ -828,7 +839,8 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
828 839
829 /* now set up to the maximum */ 840 /* now set up to the maximum */
830 DV_SET(offset, spi_max_offset(starget)); 841 DV_SET(offset, spi_max_offset(starget));
831 DV_SET(period, spi_min_period(starget)); 842 DV_SET(period, min_period);
843
832 /* try QAS requests; this should be harmless to set if the 844 /* try QAS requests; this should be harmless to set if the
833 * target supports it */ 845 * target supports it */
834 if (scsi_device_qas(sdev)) { 846 if (scsi_device_qas(sdev)) {
@@ -837,14 +849,14 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
837 DV_SET(qas, 0); 849 DV_SET(qas, 0);
838 } 850 }
839 851
840 if (scsi_device_ius(sdev) && spi_min_period(starget) < 9) { 852 if (scsi_device_ius(sdev) && min_period < 9) {
841 /* This u320 (or u640). Set IU transfers */ 853 /* This u320 (or u640). Set IU transfers */
842 DV_SET(iu, 1); 854 DV_SET(iu, 1);
843 /* Then set the optional parameters */ 855 /* Then set the optional parameters */
844 DV_SET(rd_strm, 1); 856 DV_SET(rd_strm, 1);
845 DV_SET(wr_flow, 1); 857 DV_SET(wr_flow, 1);
846 DV_SET(rti, 1); 858 DV_SET(rti, 1);
847 if (spi_min_period(starget) == 8) 859 if (min_period == 8)
848 DV_SET(pcomp_en, 1); 860 DV_SET(pcomp_en, 1);
849 } else { 861 } else {
850 DV_SET(iu, 0); 862 DV_SET(iu, 0);
@@ -862,6 +874,10 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
862 } else { 874 } else {
863 DV_SET(dt, 1); 875 DV_SET(dt, 1);
864 } 876 }
877 /* set width last because it will pull all the other
878 * parameters down to required values */
879 DV_SET(width, max_width);
880
865 /* Do the read only INQUIRY tests */ 881 /* Do the read only INQUIRY tests */
866 spi_dv_retrain(sdev, buffer, buffer + sdev->inquiry_len, 882 spi_dv_retrain(sdev, buffer, buffer + sdev->inquiry_len,
867 spi_dv_device_compare_inquiry); 883 spi_dv_device_compare_inquiry);
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.h b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
index a99e45e2b6d8..2a6477834c3e 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
@@ -37,6 +37,6 @@ static inline void cpm_set_smc_fcr(volatile smc_uart_t * up)
37 up->smc_tfcr = SMC_EB; 37 up->smc_tfcr = SMC_EB;
38} 38}
39 39
40#define DPRAM_BASE ((unsigned char *)&cpmp->cp_dpmem[0]) 40#define DPRAM_BASE ((unsigned char *)cpm_dpram_addr(0))
41 41
42#endif 42#endif
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index e348ba684050..ff610c23314b 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -38,7 +38,7 @@
38#include <asm/prom.h> 38#include <asm/prom.h>
39#include <asm/of_device.h> 39#include <asm/of_device.h>
40 40
41#if defined(CONFIG_SERIAL_SUNZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 41#if defined(CONFIG_SERIAL_SUNSAB_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
42#define SUPPORT_SYSRQ 42#define SUPPORT_SYSRQ
43#endif 43#endif
44 44
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 8d7ab74170d5..a593f900eff4 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -431,6 +431,7 @@ static int w1_uevent(struct device *dev, char **envp, int num_envp,
431 err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, 431 err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size,
432 &cur_len, "W1_SLAVE_ID=%024LX", 432 &cur_len, "W1_SLAVE_ID=%024LX",
433 (unsigned long long)sl->reg_num.id); 433 (unsigned long long)sl->reg_num.id);
434 envp[cur_index] = NULL;
434 if (err) 435 if (err)
435 return err; 436 return err;
436 437