aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-01-03 10:59:55 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-03 10:59:55 -0500
commit02f693c7118f6be9e677070eb630c1f3a654cdd3 (patch)
treeb5493c816a1f76a01319a84955c5ba07d47517c3 /drivers
parente7fb585940a3dc87a42ebc30a62296e5cf6f9cd5 (diff)
parenta18ceba7b40e24a9da87249bd74f16ea5abd6894 (diff)
Merge branch 'upstream'
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/processor_idle.c20
-rw-r--r--drivers/acpi/processor_thermal.c4
-rw-r--r--drivers/acpi/utilities/utmisc.c18
-rw-r--r--drivers/atm/adummy.c2
-rw-r--r--drivers/base/memory.c1
-rw-r--r--drivers/char/Kconfig4
-rw-r--r--drivers/char/drm/radeon_cp.c4
-rw-r--r--drivers/char/drm/radeon_drv.h1
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c6
-rw-r--r--drivers/char/keyboard.c10
-rw-r--r--drivers/char/mwave/mwavepub.h2
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c13
-rw-r--r--drivers/char/vc_screen.c2
-rw-r--r--drivers/char/watchdog/booke_wdt.c15
-rw-r--r--drivers/char/watchdog/wdrtas.c2
-rw-r--r--drivers/fc4/Kconfig8
-rw-r--r--drivers/firmware/dell_rbu.c6
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c11
-rw-r--r--drivers/ide/Kconfig10
-rw-r--r--drivers/ide/ide-cd.c7
-rw-r--r--drivers/ide/ide-cd.h1
-rw-r--r--drivers/ide/ide-disk.c4
-rw-r--r--drivers/ide/ide-dma.c15
-rw-r--r--drivers/ide/mips/Makefile3
-rw-r--r--drivers/ide/mips/au1xxx-ide.c1498
-rw-r--r--drivers/ide/pci/sgiioc4.c8
-rw-r--r--drivers/ide/pci/via82cxxx.c1
-rw-r--r--drivers/ieee1394/hosts.h1
-rw-r--r--drivers/ieee1394/nodemgr.c67
-rw-r--r--drivers/input/joystick/warrior.c2
-rw-r--r--drivers/input/misc/Kconfig2
-rw-r--r--drivers/input/misc/wistron_btns.c2
-rw-r--r--drivers/input/mouse/alps.c2
-rw-r--r--drivers/input/mouse/sermouse.c2
-rw-r--r--drivers/input/serio/i8042.h2
-rw-r--r--drivers/macintosh/therm_pm72.c8
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/media/dvb/bt8xx/dst_ca.c6
-rw-r--r--drivers/media/dvb/ttpci/av7110.c3
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.h3
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c42
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c8
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c2
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c2
-rw-r--r--drivers/media/video/em28xx/em28xx.h8
-rw-r--r--drivers/media/video/saa7127.c6
-rw-r--r--drivers/media/video/saa7134/Kconfig26
-rw-r--r--drivers/media/video/saa7134/Makefile7
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c18
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c18
-rw-r--r--drivers/media/video/tveeprom.c2
-rw-r--r--drivers/message/i2o/pci.c6
-rw-r--r--drivers/mmc/mmc.c10
-rw-r--r--drivers/mmc/mmc_block.c14
-rw-r--r--drivers/mtd/maps/Kconfig2
-rw-r--r--drivers/mtd/onenand/generic.c4
-rw-r--r--drivers/mtd/onenand/onenand_base.c53
-rw-r--r--drivers/mtd/onenand/onenand_bbt.c4
-rw-r--r--drivers/net/forcedeth.c15
-rw-r--r--drivers/net/phy/phy_device.c4
-rw-r--r--drivers/net/ppp_generic.c3
-rw-r--r--drivers/net/s2io.c10
-rw-r--r--drivers/net/sungem.c4
-rw-r--r--drivers/net/tg3.c255
-rw-r--r--drivers/net/tg3.h14
-rw-r--r--drivers/net/wireless/orinoco_nortel.c6
-rw-r--r--drivers/pci/Makefile7
-rw-r--r--drivers/s390/net/qeth_eddp.c3
-rw-r--r--drivers/s390/net/qeth_main.c61
-rw-r--r--drivers/s390/net/qeth_mpc.c2
-rw-r--r--drivers/s390/net/qeth_mpc.h4
-rw-r--r--drivers/s390/net/qeth_proc.c250
-rw-r--r--drivers/s390/net/qeth_sys.c6
-rw-r--r--drivers/s390/net/qeth_tso.h4
-rw-r--r--drivers/sbus/char/jsflash.c19
-rw-r--r--drivers/sbus/char/uctrl.c10
-rw-r--r--drivers/sbus/char/vfc.h2
-rw-r--r--drivers/sbus/char/vfc_dev.c6
-rw-r--r--drivers/scsi/dpt_i2o.c25
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.h2
-rw-r--r--drivers/scsi/ibmvscsi/iseries_vscsi.c3
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c8
-rw-r--r--drivers/scsi/iscsi_tcp.c2
-rw-r--r--drivers/scsi/libata-scsi.c5
-rw-r--r--drivers/scsi/megaraid.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h10
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c15
-rw-r--r--drivers/scsi/scsi_error.c7
-rw-r--r--drivers/scsi/scsi_lib.c33
-rw-r--r--drivers/scsi/scsi_scan.c49
-rw-r--r--drivers/scsi/scsi_transport_fc.c59
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c2
-rw-r--r--drivers/scsi/sd.c16
-rw-r--r--drivers/scsi/sr.c20
-rw-r--r--drivers/scsi/st.c19
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c4
-rw-r--r--drivers/serial/Kconfig10
-rw-r--r--drivers/serial/amba-pl011.c2
-rw-r--r--drivers/serial/pxa.c4
-rw-r--r--drivers/usb/core/usb.c9
-rw-r--r--drivers/usb/host/uhci-hcd.c2
-rw-r--r--drivers/usb/input/aiptek.c2
-rw-r--r--drivers/usb/input/hid-core.c4
-rw-r--r--drivers/usb/input/hid-input.c1
-rw-r--r--drivers/usb/input/kbtab.c2
-rw-r--r--drivers/usb/input/wacom.c2
-rw-r--r--drivers/usb/misc/auerswald.c2
-rw-r--r--drivers/usb/storage/scsiglue.c4
-rw-r--r--drivers/video/Kconfig10
-rw-r--r--drivers/video/arcfb.c2
-rw-r--r--drivers/video/console/Kconfig20
-rw-r--r--drivers/video/console/fbcon_ud.c8
-rw-r--r--drivers/video/cyber2000fb.c4
-rw-r--r--drivers/video/intelfb/intelfb.h5
-rw-r--r--drivers/video/intelfb/intelfbdrv.c51
-rw-r--r--drivers/video/logo/Kconfig2
-rw-r--r--drivers/video/pxafb.c3
-rw-r--r--drivers/video/sbuslib.c3
119 files changed, 1414 insertions, 1720 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 5f51057518b0..807b0df308f1 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -274,8 +274,6 @@ static void acpi_processor_idle(void)
274 } 274 }
275 } 275 }
276 276
277 cx->usage++;
278
279#ifdef CONFIG_HOTPLUG_CPU 277#ifdef CONFIG_HOTPLUG_CPU
280 /* 278 /*
281 * Check for P_LVL2_UP flag before entering C2 and above on 279 * Check for P_LVL2_UP flag before entering C2 and above on
@@ -283,9 +281,12 @@ static void acpi_processor_idle(void)
283 * detection phase, to work cleanly with logical CPU hotplug. 281 * detection phase, to work cleanly with logical CPU hotplug.
284 */ 282 */
285 if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && 283 if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
286 !pr->flags.has_cst && acpi_fadt.plvl2_up) 284 !pr->flags.has_cst && !acpi_fadt.plvl2_up)
287 cx->type = ACPI_STATE_C1; 285 cx = &pr->power.states[ACPI_STATE_C1];
288#endif 286#endif
287
288 cx->usage++;
289
289 /* 290 /*
290 * Sleep: 291 * Sleep:
291 * ------ 292 * ------
@@ -386,6 +387,15 @@ static void acpi_processor_idle(void)
386 387
387 next_state = pr->power.state; 388 next_state = pr->power.state;
388 389
390#ifdef CONFIG_HOTPLUG_CPU
391 /* Don't do promotion/demotion */
392 if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) &&
393 !pr->flags.has_cst && !acpi_fadt.plvl2_up) {
394 next_state = cx;
395 goto end;
396 }
397#endif
398
389 /* 399 /*
390 * Promotion? 400 * Promotion?
391 * ---------- 401 * ----------
@@ -557,7 +567,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
557 * Check for P_LVL2_UP flag before entering C2 and above on 567 * Check for P_LVL2_UP flag before entering C2 and above on
558 * an SMP system. 568 * an SMP system.
559 */ 569 */
560 if ((num_online_cpus() > 1) && acpi_fadt.plvl2_up) 570 if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up)
561 return_VALUE(-ENODEV); 571 return_VALUE(-ENODEV);
562#endif 572#endif
563 573
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
index f37584015324..dc9817cfb882 100644
--- a/drivers/acpi/processor_thermal.c
+++ b/drivers/acpi/processor_thermal.c
@@ -102,8 +102,8 @@ static int cpu_has_cpufreq(unsigned int cpu)
102{ 102{
103 struct cpufreq_policy policy; 103 struct cpufreq_policy policy;
104 if (!acpi_thermal_cpufreq_is_init || cpufreq_get_policy(&policy, cpu)) 104 if (!acpi_thermal_cpufreq_is_init || cpufreq_get_policy(&policy, cpu))
105 return -ENODEV; 105 return 0;
106 return 0; 106 return 1;
107} 107}
108 108
109static int acpi_thermal_cpufreq_increase(unsigned int cpu) 109static int acpi_thermal_cpufreq_increase(unsigned int cpu)
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 0c5abc536c7a..2ce872d75890 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -84,14 +84,14 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
84 84
85 /* Find a free owner ID */ 85 /* Find a free owner ID */
86 86
87 for (i = 0; i < 32; i++) { 87 for (i = 0; i < 64; i++) {
88 if (!(acpi_gbl_owner_id_mask & (1 << i))) { 88 if (!(acpi_gbl_owner_id_mask & (1ULL << i))) {
89 ACPI_DEBUG_PRINT((ACPI_DB_VALUES, 89 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
90 "Current owner_id mask: %8.8X New ID: %2.2X\n", 90 "Current owner_id mask: %16.16LX New ID: %2.2X\n",
91 acpi_gbl_owner_id_mask, 91 acpi_gbl_owner_id_mask,
92 (unsigned int)(i + 1))); 92 (unsigned int)(i + 1)));
93 93
94 acpi_gbl_owner_id_mask |= (1 << i); 94 acpi_gbl_owner_id_mask |= (1ULL << i);
95 *owner_id = (acpi_owner_id) (i + 1); 95 *owner_id = (acpi_owner_id) (i + 1);
96 goto exit; 96 goto exit;
97 } 97 }
@@ -106,7 +106,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
106 */ 106 */
107 *owner_id = 0; 107 *owner_id = 0;
108 status = AE_OWNER_ID_LIMIT; 108 status = AE_OWNER_ID_LIMIT;
109 ACPI_REPORT_ERROR(("Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); 109 ACPI_REPORT_ERROR(("Could not allocate new owner_id (64 max), AE_OWNER_ID_LIMIT\n"));
110 110
111 exit: 111 exit:
112 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); 112 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -123,7 +123,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
123 * control method or unloading a table. Either way, we would 123 * control method or unloading a table. Either way, we would
124 * ignore any error anyway. 124 * ignore any error anyway.
125 * 125 *
126 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 32 126 * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 64
127 * 127 *
128 ******************************************************************************/ 128 ******************************************************************************/
129 129
@@ -140,7 +140,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
140 140
141 /* Zero is not a valid owner_iD */ 141 /* Zero is not a valid owner_iD */
142 142
143 if ((owner_id == 0) || (owner_id > 32)) { 143 if ((owner_id == 0) || (owner_id > 64)) {
144 ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); 144 ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id));
145 return_VOID; 145 return_VOID;
146 } 146 }
@@ -158,8 +158,8 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
158 158
159 /* Free the owner ID only if it is valid */ 159 /* Free the owner ID only if it is valid */
160 160
161 if (acpi_gbl_owner_id_mask & (1 << owner_id)) { 161 if (acpi_gbl_owner_id_mask & (1ULL << owner_id)) {
162 acpi_gbl_owner_id_mask ^= (1 << owner_id); 162 acpi_gbl_owner_id_mask ^= (1ULL << owner_id);
163 } 163 }
164 164
165 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); 165 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index d15c194be44a..d1387cfe2d30 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -123,7 +123,7 @@ static int __init adummy_init(void)
123 } 123 }
124 memset(adummy_dev, 0, sizeof(struct adummy_dev)); 124 memset(adummy_dev, 0, sizeof(struct adummy_dev));
125 125
126 atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, 0); 126 atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, NULL);
127 if (!atm_dev) { 127 if (!atm_dev) {
128 printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n"); 128 printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n");
129 err = -ENODEV; 129 err = -ENODEV;
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index b7ddd651d664..bc3ca6a656b2 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -28,7 +28,6 @@
28static struct sysdev_class memory_sysdev_class = { 28static struct sysdev_class memory_sysdev_class = {
29 set_kset_name(MEMORY_CLASS_NAME), 29 set_kset_name(MEMORY_CLASS_NAME),
30}; 30};
31EXPORT_SYMBOL(memory_sysdev_class);
32 31
33static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj) 32static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj)
34{ 33{
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index b46a72d782d6..84e68cdd451b 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -687,7 +687,7 @@ config NVRAM
687 687
688config RTC 688config RTC
689 tristate "Enhanced Real Time Clock Support" 689 tristate "Enhanced Real Time Clock Support"
690 depends on !PPC32 && !PARISC && !IA64 && !M68K 690 depends on !PPC32 && !PARISC && !IA64 && !M68K && (!SPARC || PCI)
691 ---help--- 691 ---help---
692 If you say Y here and create a character special file /dev/rtc with 692 If you say Y here and create a character special file /dev/rtc with
693 major number 10 and minor number 135 using mknod ("man mknod"), you 693 major number 10 and minor number 135 using mknod ("man mknod"), you
@@ -735,7 +735,7 @@ config SGI_IP27_RTC
735 735
736config GEN_RTC 736config GEN_RTC
737 tristate "Generic /dev/rtc emulation" 737 tristate "Generic /dev/rtc emulation"
738 depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC32 && !SPARC64 738 depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC
739 ---help--- 739 ---help---
740 If you say Y here and create a character special file /dev/rtc with 740 If you say Y here and create a character special file /dev/rtc with
741 major number 10 and minor number 135 using mknod ("man mknod"), you 741 major number 10 and minor number 135 using mknod ("man mknod"), you
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 9f2b4efd0c7a..342302d46743 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1311,7 +1311,7 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
1311 1311
1312static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) 1312static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1313{ 1313{
1314 drm_radeon_private_t *dev_priv = dev->dev_private;; 1314 drm_radeon_private_t *dev_priv = dev->dev_private;
1315 DRM_DEBUG("\n"); 1315 DRM_DEBUG("\n");
1316 1316
1317 dev_priv->is_pci = init->is_pci; 1317 dev_priv->is_pci = init->is_pci;
@@ -1522,7 +1522,7 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
1522 1522
1523 dev_priv->gart_size = init->gart_size; 1523 dev_priv->gart_size = init->gart_size;
1524 dev_priv->gart_vm_start = dev_priv->fb_location 1524 dev_priv->gart_vm_start = dev_priv->fb_location
1525 + RADEON_READ(RADEON_CONFIG_APER_SIZE) * 2; 1525 + RADEON_READ(RADEON_CONFIG_APER_SIZE);
1526 1526
1527#if __OS_HAS_AGP 1527#if __OS_HAS_AGP
1528 if (!dev_priv->is_pci) 1528 if (!dev_priv->is_pci)
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 7bda7e33d2bd..d92ccee3e54c 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -379,6 +379,7 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp,
379# define RADEON_PLL_WR_EN (1 << 7) 379# define RADEON_PLL_WR_EN (1 << 7)
380#define RADEON_CLOCK_CNTL_INDEX 0x0008 380#define RADEON_CLOCK_CNTL_INDEX 0x0008
381#define RADEON_CONFIG_APER_SIZE 0x0108 381#define RADEON_CONFIG_APER_SIZE 0x0108
382#define RADEON_CONFIG_MEMSIZE 0x00f8
382#define RADEON_CRTC_OFFSET 0x0224 383#define RADEON_CRTC_OFFSET 0x0224
383#define RADEON_CRTC_OFFSET_CNTL 0x0228 384#define RADEON_CRTC_OFFSET_CNTL 0x0228
384# define RADEON_CRTC_TILE_EN (1 << 15) 385# define RADEON_CRTC_TILE_EN (1 << 15)
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 01a1f6badb53..beea450ee4b2 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2399,7 +2399,8 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
2399 new_smi->handlers->cleanup(new_smi->si_sm); 2399 new_smi->handlers->cleanup(new_smi->si_sm);
2400 kfree(new_smi->si_sm); 2400 kfree(new_smi->si_sm);
2401 } 2401 }
2402 new_smi->io_cleanup(new_smi); 2402 if (new_smi->io_cleanup)
2403 new_smi->io_cleanup(new_smi);
2403 2404
2404 return rv; 2405 return rv;
2405} 2406}
@@ -2518,7 +2519,8 @@ static void __exit cleanup_one_si(struct smi_info *to_clean)
2518 2519
2519 kfree(to_clean->si_sm); 2520 kfree(to_clean->si_sm);
2520 2521
2521 to_clean->io_cleanup(to_clean); 2522 if (to_clean->io_cleanup)
2523 to_clean->io_cleanup(to_clean);
2522} 2524}
2523 2525
2524static __exit void cleanup_ipmi_si(void) 2526static __exit void cleanup_ipmi_si(void)
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 449d029ad4f4..8b603b2d1c42 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -930,8 +930,8 @@ static void kbd_refresh_leds(struct input_handle *handle)
930} 930}
931 931
932#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ 932#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\
933 defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC32) ||\ 933 defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\
934 defined(CONFIG_SPARC64) || defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ 934 defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\
935 (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC)) 935 (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC))
936 936
937#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ 937#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\
@@ -958,7 +958,7 @@ static unsigned short x86_keycodes[256] =
958extern int mac_hid_mouse_emulate_buttons(int, int, int); 958extern int mac_hid_mouse_emulate_buttons(int, int, int);
959#endif /* CONFIG_MAC_EMUMOUSEBTN */ 959#endif /* CONFIG_MAC_EMUMOUSEBTN */
960 960
961#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) 961#ifdef CONFIG_SPARC
962static int sparc_l1_a_state = 0; 962static int sparc_l1_a_state = 0;
963extern void sun_do_break(void); 963extern void sun_do_break(void);
964#endif 964#endif
@@ -1045,7 +1045,7 @@ static void kbd_keycode(unsigned int keycode, int down,
1045 1045
1046 if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) 1046 if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT)
1047 sysrq_alt = down; 1047 sysrq_alt = down;
1048#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) 1048#ifdef CONFIG_SPARC
1049 if (keycode == KEY_STOP) 1049 if (keycode == KEY_STOP)
1050 sparc_l1_a_state = down; 1050 sparc_l1_a_state = down;
1051#endif 1051#endif
@@ -1072,7 +1072,7 @@ static void kbd_keycode(unsigned int keycode, int down,
1072 return; 1072 return;
1073 } 1073 }
1074#endif 1074#endif
1075#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) 1075#ifdef CONFIG_SPARC
1076 if (keycode == KEY_A && sparc_l1_a_state) { 1076 if (keycode == KEY_A && sparc_l1_a_state) {
1077 sparc_l1_a_state = 0; 1077 sparc_l1_a_state = 0;
1078 sun_do_break(); 1078 sun_do_break();
diff --git a/drivers/char/mwave/mwavepub.h b/drivers/char/mwave/mwavepub.h
index f1f9da7a65c1..60c961ae23b4 100644
--- a/drivers/char/mwave/mwavepub.h
+++ b/drivers/char/mwave/mwavepub.h
@@ -69,7 +69,7 @@ typedef struct _MW_ABILITIES {
69typedef struct _MW_READWRITE { 69typedef struct _MW_READWRITE {
70 unsigned short usDspAddress; /* The dsp address */ 70 unsigned short usDspAddress; /* The dsp address */
71 unsigned long ulDataLength; /* The size in bytes of the data or user buffer */ 71 unsigned long ulDataLength; /* The size in bytes of the data or user buffer */
72 void *pBuf; /* Input:variable sized buffer */ 72 void __user *pBuf; /* Input:variable sized buffer */
73} MW_READWRITE, *pMW_READWRITE; 73} MW_READWRITE, *pMW_READWRITE;
74 74
75#define IOCTL_MW_RESET _IO(MWAVE_MINOR,1) 75#define IOCTL_MW_RESET _IO(MWAVE_MINOR,1)
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index ef011ef5dc46..61681c9f3f72 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1444,6 +1444,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1444 dev_link_t *link; 1444 dev_link_t *link;
1445 int size; 1445 int size;
1446 int rc; 1446 int rc;
1447 void __user *argp = (void __user *)arg;
1447#ifdef PCMCIA_DEBUG 1448#ifdef PCMCIA_DEBUG
1448 char *ioctl_names[CM_IOC_MAXNR + 1] = { 1449 char *ioctl_names[CM_IOC_MAXNR + 1] = {
1449 [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS", 1450 [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS",
@@ -1481,11 +1482,11 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1481 _IOC_DIR(cmd), _IOC_READ, _IOC_WRITE, size, cmd); 1482 _IOC_DIR(cmd), _IOC_READ, _IOC_WRITE, size, cmd);
1482 1483
1483 if (_IOC_DIR(cmd) & _IOC_READ) { 1484 if (_IOC_DIR(cmd) & _IOC_READ) {
1484 if (!access_ok(VERIFY_WRITE, (void *)arg, size)) 1485 if (!access_ok(VERIFY_WRITE, argp, size))
1485 return -EFAULT; 1486 return -EFAULT;
1486 } 1487 }
1487 if (_IOC_DIR(cmd) & _IOC_WRITE) { 1488 if (_IOC_DIR(cmd) & _IOC_WRITE) {
1488 if (!access_ok(VERIFY_READ, (void *)arg, size)) 1489 if (!access_ok(VERIFY_READ, argp, size))
1489 return -EFAULT; 1490 return -EFAULT;
1490 } 1491 }
1491 1492
@@ -1506,14 +1507,14 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1506 status |= CM_NO_READER; 1507 status |= CM_NO_READER;
1507 if (test_bit(IS_BAD_CARD, &dev->flags)) 1508 if (test_bit(IS_BAD_CARD, &dev->flags))
1508 status |= CM_BAD_CARD; 1509 status |= CM_BAD_CARD;
1509 if (copy_to_user((int *)arg, &status, sizeof(int))) 1510 if (copy_to_user(argp, &status, sizeof(int)))
1510 return -EFAULT; 1511 return -EFAULT;
1511 } 1512 }
1512 return 0; 1513 return 0;
1513 case CM_IOCGATR: 1514 case CM_IOCGATR:
1514 DEBUGP(4, dev, "... in CM_IOCGATR\n"); 1515 DEBUGP(4, dev, "... in CM_IOCGATR\n");
1515 { 1516 {
1516 struct atreq *atreq = (struct atreq *) arg; 1517 struct atreq __user *atreq = argp;
1517 int tmp; 1518 int tmp;
1518 /* allow nonblocking io and being interrupted */ 1519 /* allow nonblocking io and being interrupted */
1519 if (wait_event_interruptible 1520 if (wait_event_interruptible
@@ -1597,7 +1598,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1597 { 1598 {
1598 struct ptsreq krnptsreq; 1599 struct ptsreq krnptsreq;
1599 1600
1600 if (copy_from_user(&krnptsreq, (struct ptsreq *) arg, 1601 if (copy_from_user(&krnptsreq, argp,
1601 sizeof(struct ptsreq))) 1602 sizeof(struct ptsreq)))
1602 return -EFAULT; 1603 return -EFAULT;
1603 1604
@@ -1641,7 +1642,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1641 int old_pc_debug = 0; 1642 int old_pc_debug = 0;
1642 1643
1643 old_pc_debug = pc_debug; 1644 old_pc_debug = pc_debug;
1644 if (copy_from_user(&pc_debug, (int *)arg, sizeof(int))) 1645 if (copy_from_user(&pc_debug, argp, sizeof(int)))
1645 return -EFAULT; 1646 return -EFAULT;
1646 1647
1647 if (old_pc_debug != pc_debug) 1648 if (old_pc_debug != pc_debug)
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
index f66c7ad6fd38..3c1dafaa3441 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -419,7 +419,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
419 while (this_round > 1) { 419 while (this_round > 1) {
420 unsigned short w; 420 unsigned short w;
421 421
422 w = get_unaligned(((const unsigned short *)con_buf0)); 422 w = get_unaligned(((unsigned short *)con_buf0));
423 vcs_scr_writew(vc, w, org++); 423 vcs_scr_writew(vc, w, org++);
424 con_buf0 += 2; 424 con_buf0 += 2;
425 this_round -= 2; 425 this_round -= 2;
diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c
index 65830ec71042..b6640606b44d 100644
--- a/drivers/char/watchdog/booke_wdt.c
+++ b/drivers/char/watchdog/booke_wdt.c
@@ -72,7 +72,7 @@ static __inline__ void booke_wdt_ping(void)
72/* 72/*
73 * booke_wdt_write: 73 * booke_wdt_write:
74 */ 74 */
75static ssize_t booke_wdt_write (struct file *file, const char *buf, 75static ssize_t booke_wdt_write (struct file *file, const char __user *buf,
76 size_t count, loff_t *ppos) 76 size_t count, loff_t *ppos)
77{ 77{
78 booke_wdt_ping(); 78 booke_wdt_ping();
@@ -92,14 +92,15 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
92 unsigned int cmd, unsigned long arg) 92 unsigned int cmd, unsigned long arg)
93{ 93{
94 u32 tmp = 0; 94 u32 tmp = 0;
95 u32 __user *p = (u32 __user *)arg;
95 96
96 switch (cmd) { 97 switch (cmd) {
97 case WDIOC_GETSUPPORT: 98 case WDIOC_GETSUPPORT:
98 if (copy_to_user ((struct watchdog_info *) arg, &ident, 99 if (copy_to_user ((struct watchdog_info __user *) arg, &ident,
99 sizeof(struct watchdog_info))) 100 sizeof(struct watchdog_info)))
100 return -EFAULT; 101 return -EFAULT;
101 case WDIOC_GETSTATUS: 102 case WDIOC_GETSTATUS:
102 return put_user(ident.options, (u32 *) arg); 103 return put_user(ident.options, p);
103 case WDIOC_GETBOOTSTATUS: 104 case WDIOC_GETBOOTSTATUS:
104 /* XXX: something is clearing TSR */ 105 /* XXX: something is clearing TSR */
105 tmp = mfspr(SPRN_TSR) & TSR_WRS(3); 106 tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
@@ -109,14 +110,14 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
109 booke_wdt_ping(); 110 booke_wdt_ping();
110 return 0; 111 return 0;
111 case WDIOC_SETTIMEOUT: 112 case WDIOC_SETTIMEOUT:
112 if (get_user(booke_wdt_period, (u32 *) arg)) 113 if (get_user(booke_wdt_period, p))
113 return -EFAULT; 114 return -EFAULT;
114 mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period)); 115 mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
115 return 0; 116 return 0;
116 case WDIOC_GETTIMEOUT: 117 case WDIOC_GETTIMEOUT:
117 return put_user(booke_wdt_period, (u32 *) arg); 118 return put_user(booke_wdt_period, p);
118 case WDIOC_SETOPTIONS: 119 case WDIOC_SETOPTIONS:
119 if (get_user(tmp, (u32 *) arg)) 120 if (get_user(tmp, p))
120 return -EINVAL; 121 return -EINVAL;
121 if (tmp == WDIOS_ENABLECARD) { 122 if (tmp == WDIOS_ENABLECARD) {
122 booke_wdt_ping(); 123 booke_wdt_ping();
@@ -172,7 +173,7 @@ static int __init booke_wdt_init(void)
172 int ret = 0; 173 int ret = 0;
173 174
174 printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); 175 printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n");
175 ident.firmware_version = cpu_specs[0].pvr_value; 176 ident.firmware_version = cur_cpu_spec->pvr_value;
176 177
177 ret = misc_register(&booke_wdt_miscdev); 178 ret = misc_register(&booke_wdt_miscdev);
178 if (ret) { 179 if (ret) {
diff --git a/drivers/char/watchdog/wdrtas.c b/drivers/char/watchdog/wdrtas.c
index 619e2ffca33f..dacfe31caccf 100644
--- a/drivers/char/watchdog/wdrtas.c
+++ b/drivers/char/watchdog/wdrtas.c
@@ -320,7 +320,7 @@ static int
320wdrtas_ioctl(struct inode *inode, struct file *file, 320wdrtas_ioctl(struct inode *inode, struct file *file,
321 unsigned int cmd, unsigned long arg) 321 unsigned int cmd, unsigned long arg)
322{ 322{
323 int __user *argp = (void *)arg; 323 int __user *argp = (void __user *)arg;
324 int i; 324 int i;
325 static struct watchdog_info wdinfo = { 325 static struct watchdog_info wdinfo = {
326 .options = WDRTAS_SUPPORTED_MASK, 326 .options = WDRTAS_SUPPORTED_MASK,
diff --git a/drivers/fc4/Kconfig b/drivers/fc4/Kconfig
index f00c02a13ed6..345dbe6f10df 100644
--- a/drivers/fc4/Kconfig
+++ b/drivers/fc4/Kconfig
@@ -26,7 +26,7 @@ comment "FC4 drivers"
26 26
27config FC4_SOC 27config FC4_SOC
28 tristate "Sun SOC/Sbus" 28 tristate "Sun SOC/Sbus"
29 depends on FC4!=n && (SPARC32 || SPARC64) 29 depends on FC4!=n && SPARC
30 help 30 help
31 Serial Optical Channel is an interface card with one or two Fibre 31 Serial Optical Channel is an interface card with one or two Fibre
32 Optic ports, each of which can be connected to a disk array. Note 32 Optic ports, each of which can be connected to a disk array. Note
@@ -38,7 +38,7 @@ config FC4_SOC
38 38
39config FC4_SOCAL 39config FC4_SOCAL
40 tristate "Sun SOC+ (aka SOCAL)" 40 tristate "Sun SOC+ (aka SOCAL)"
41 depends on FC4!=n && (SPARC32 || SPARC64) 41 depends on FC4!=n && SPARC
42 ---help--- 42 ---help---
43 Serial Optical Channel Plus is an interface card with up to two 43 Serial Optical Channel Plus is an interface card with up to two
44 Fibre Optic ports. This card supports FC Arbitrated Loop (usually 44 Fibre Optic ports. This card supports FC Arbitrated Loop (usually
@@ -62,7 +62,7 @@ config SCSI_PLUTO
62 be called pluto. 62 be called pluto.
63 63
64config SCSI_FCAL 64config SCSI_FCAL
65 tristate "Sun Enterprise Network Array (A5000 and EX500)" if SPARC32 || SPARC64 65 tristate "Sun Enterprise Network Array (A5000 and EX500)" if SPARC
66 depends on FC4!=n && SCSI 66 depends on FC4!=n && SCSI
67 help 67 help
68 This driver drives FC-AL disks connected through a Fibre Channel 68 This driver drives FC-AL disks connected through a Fibre Channel
@@ -75,7 +75,7 @@ config SCSI_FCAL
75 75
76config SCSI_FCAL 76config SCSI_FCAL
77 prompt "Generic FC-AL disk driver" 77 prompt "Generic FC-AL disk driver"
78 depends on FC4!=n && SCSI && !SPARC32 && !SPARC64 78 depends on FC4!=n && SCSI && !SPARC
79 79
80endmenu 80endmenu
81 81
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c
index 6d83299e7c9b..dfedb777d8c9 100644
--- a/drivers/firmware/dell_rbu.c
+++ b/drivers/firmware/dell_rbu.c
@@ -105,8 +105,8 @@ static int create_packet(void *data, size_t length)
105 int ordernum = 0; 105 int ordernum = 0;
106 int retval = 0; 106 int retval = 0;
107 unsigned int packet_array_size = 0; 107 unsigned int packet_array_size = 0;
108 void **invalid_addr_packet_array = 0; 108 void **invalid_addr_packet_array = NULL;
109 void *packet_data_temp_buf = 0; 109 void *packet_data_temp_buf = NULL;
110 unsigned int idx = 0; 110 unsigned int idx = 0;
111 111
112 pr_debug("create_packet: entry \n"); 112 pr_debug("create_packet: entry \n");
@@ -178,7 +178,7 @@ static int create_packet(void *data, size_t length)
178 packet_data_temp_buf), 178 packet_data_temp_buf),
179 allocation_floor); 179 allocation_floor);
180 invalid_addr_packet_array[idx++] = packet_data_temp_buf; 180 invalid_addr_packet_array[idx++] = packet_data_temp_buf;
181 packet_data_temp_buf = 0; 181 packet_data_temp_buf = NULL;
182 } 182 }
183 } 183 }
184 spin_lock(&rbu_data.lock); 184 spin_lock(&rbu_data.lock);
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index afd7634e5cc9..81031eb51056 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -529,14 +529,15 @@ mv64xxx_i2c_probe(struct platform_device *pd)
529 i2c_set_adapdata(&drv_data->adapter, drv_data); 529 i2c_set_adapdata(&drv_data->adapter, drv_data);
530 530
531 if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0, 531 if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0,
532 MV64XXX_I2C_CTLR_NAME, drv_data)) { 532 MV64XXX_I2C_CTLR_NAME, drv_data)) {
533 533 dev_err(&drv_data->adapter.dev,
534 dev_err(dev, "mv64xxx: Can't register intr handler " 534 "mv64xxx: Can't register intr handler irq: %d\n",
535 "irq: %d\n", drv_data->irq); 535 drv_data->irq);
536 rc = -EINVAL; 536 rc = -EINVAL;
537 goto exit_unmap_regs; 537 goto exit_unmap_regs;
538 } else if ((rc = i2c_add_adapter(&drv_data->adapter)) != 0) { 538 } else if ((rc = i2c_add_adapter(&drv_data->adapter)) != 0) {
539 dev_err(dev, "mv64xxx: Can't add i2c adapter, rc: %d\n", -rc); 539 dev_err(&drv_data->adapter.dev,
540 "mv64xxx: Can't add i2c adapter, rc: %d\n", -rc);
540 goto exit_free_irq; 541 goto exit_free_irq;
541 } 542 }
542 543
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 31e649a9ff71..1c81174595b3 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -807,14 +807,6 @@ config BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
807 depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX 807 depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX
808endchoice 808endchoice
809 809
810config BLK_DEV_IDE_AU1XXX_BURSTABLE_ON
811 bool "Enable burstable Mode on DbDMA"
812 default false
813 depends BLK_DEV_IDE_AU1XXX
814 help
815 This option enable the burstable Flag on DbDMA controller
816 (cf. "AMD Alchemy 'Au1200' Processor Data Book - PRELIMINARY").
817
818config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ 810config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
819 int "Maximum transfer size (KB) per request (up to 128)" 811 int "Maximum transfer size (KB) per request (up to 128)"
820 default "128" 812 default "128"
@@ -940,7 +932,7 @@ config BLK_DEV_Q40IDE
940 932
941config BLK_DEV_MPC8xx_IDE 933config BLK_DEV_MPC8xx_IDE
942 bool "MPC8xx IDE support" 934 bool "MPC8xx IDE support"
943 depends on 8xx 935 depends on 8xx && IDE=y && BLK_DEV_IDE=y
944 help 936 help
945 This option provides support for IDE on Motorola MPC8xx Systems. 937 This option provides support for IDE on Motorola MPC8xx Systems.
946 Please see 'Type of MPC8xx IDE interface' for details. 938 Please see 'Type of MPC8xx IDE interface' for details.
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 9455e42abb23..b4d7a3efb90f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1292,7 +1292,6 @@ static ide_startstop_t cdrom_start_seek (ide_drive_t *drive, unsigned int block)
1292 struct cdrom_info *info = drive->driver_data; 1292 struct cdrom_info *info = drive->driver_data;
1293 1293
1294 info->dma = 0; 1294 info->dma = 0;
1295 info->cmd = 0;
1296 info->start_seek = jiffies; 1295 info->start_seek = jiffies;
1297 return cdrom_start_packet_command(drive, 0, cdrom_start_seek_continuation); 1296 return cdrom_start_packet_command(drive, 0, cdrom_start_seek_continuation);
1298} 1297}
@@ -1344,8 +1343,6 @@ static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block)
1344 (rq->nr_sectors & (sectors_per_frame - 1))) 1343 (rq->nr_sectors & (sectors_per_frame - 1)))
1345 info->dma = 0; 1344 info->dma = 0;
1346 1345
1347 info->cmd = READ;
1348
1349 /* Start sending the read request to the drive. */ 1346 /* Start sending the read request to the drive. */
1350 return cdrom_start_packet_command(drive, 32768, cdrom_start_read_continuation); 1347 return cdrom_start_packet_command(drive, 32768, cdrom_start_read_continuation);
1351} 1348}
@@ -1484,7 +1481,6 @@ static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
1484 struct cdrom_info *info = drive->driver_data; 1481 struct cdrom_info *info = drive->driver_data;
1485 1482
1486 info->dma = 0; 1483 info->dma = 0;
1487 info->cmd = 0;
1488 rq->flags &= ~REQ_FAILED; 1484 rq->flags &= ~REQ_FAILED;
1489 len = rq->data_len; 1485 len = rq->data_len;
1490 1486
@@ -1891,7 +1887,6 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq)
1891 /* use dma, if possible. we don't need to check more, since we 1887 /* use dma, if possible. we don't need to check more, since we
1892 * know that the transfer is always (at least!) frame aligned */ 1888 * know that the transfer is always (at least!) frame aligned */
1893 info->dma = drive->using_dma ? 1 : 0; 1889 info->dma = drive->using_dma ? 1 : 0;
1894 info->cmd = WRITE;
1895 1890
1896 info->devinfo.media_written = 1; 1891 info->devinfo.media_written = 1;
1897 1892
@@ -1916,7 +1911,6 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1916 rq->flags |= REQ_QUIET; 1911 rq->flags |= REQ_QUIET;
1917 1912
1918 info->dma = 0; 1913 info->dma = 0;
1919 info->cmd = 0;
1920 1914
1921 /* 1915 /*
1922 * sg request 1916 * sg request
@@ -1925,7 +1919,6 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
1925 int mask = drive->queue->dma_alignment; 1919 int mask = drive->queue->dma_alignment;
1926 unsigned long addr = (unsigned long) page_address(bio_page(rq->bio)); 1920 unsigned long addr = (unsigned long) page_address(bio_page(rq->bio));
1927 1921
1928 info->cmd = rq_data_dir(rq);
1929 info->dma = drive->using_dma; 1922 info->dma = drive->using_dma;
1930 1923
1931 /* 1924 /*
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 7ca3e5afc665..ad1f2ed14a37 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -480,7 +480,6 @@ struct cdrom_info {
480 480
481 struct request request_sense_request; 481 struct request request_sense_request;
482 int dma; 482 int dma;
483 int cmd;
484 unsigned long last_block; 483 unsigned long last_block;
485 unsigned long start_seek; 484 unsigned long start_seek;
486 /* Buffer to hold mechanism status and changer slot table. */ 485 /* Buffer to hold mechanism status and changer slot table. */
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index f4e3d3527b0e..449522f0540c 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -1034,12 +1034,12 @@ static int ide_disk_remove(struct device *dev)
1034 struct ide_disk_obj *idkp = drive->driver_data; 1034 struct ide_disk_obj *idkp = drive->driver_data;
1035 struct gendisk *g = idkp->disk; 1035 struct gendisk *g = idkp->disk;
1036 1036
1037 ide_cacheflush_p(drive);
1038
1039 ide_unregister_subdriver(drive, idkp->driver); 1037 ide_unregister_subdriver(drive, idkp->driver);
1040 1038
1041 del_gendisk(g); 1039 del_gendisk(g);
1042 1040
1041 ide_cacheflush_p(drive);
1042
1043 ide_disk_put(idkp); 1043 ide_disk_put(idkp);
1044 1044
1045 return 0; 1045 return 0;
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 1e1531334c25..0523da77425a 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -90,11 +90,6 @@
90#include <asm/io.h> 90#include <asm/io.h>
91#include <asm/irq.h> 91#include <asm/irq.h>
92 92
93struct drive_list_entry {
94 const char *id_model;
95 const char *id_firmware;
96};
97
98static const struct drive_list_entry drive_whitelist [] = { 93static const struct drive_list_entry drive_whitelist [] = {
99 94
100 { "Micropolis 2112A" , "ALL" }, 95 { "Micropolis 2112A" , "ALL" },
@@ -139,7 +134,7 @@ static const struct drive_list_entry drive_blacklist [] = {
139}; 134};
140 135
141/** 136/**
142 * in_drive_list - look for drive in black/white list 137 * ide_in_drive_list - look for drive in black/white list
143 * @id: drive identifier 138 * @id: drive identifier
144 * @drive_table: list to inspect 139 * @drive_table: list to inspect
145 * 140 *
@@ -147,7 +142,7 @@ static const struct drive_list_entry drive_blacklist [] = {
147 * Returns 1 if the drive is found in the table. 142 * Returns 1 if the drive is found in the table.
148 */ 143 */
149 144
150static int in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) 145int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table)
151{ 146{
152 for ( ; drive_table->id_model ; drive_table++) 147 for ( ; drive_table->id_model ; drive_table++)
153 if ((!strcmp(drive_table->id_model, id->model)) && 148 if ((!strcmp(drive_table->id_model, id->model)) &&
@@ -157,6 +152,8 @@ static int in_drive_list(struct hd_driveid *id, const struct drive_list_entry *d
157 return 0; 152 return 0;
158} 153}
159 154
155EXPORT_SYMBOL_GPL(ide_in_drive_list);
156
160/** 157/**
161 * ide_dma_intr - IDE DMA interrupt handler 158 * ide_dma_intr - IDE DMA interrupt handler
162 * @drive: the drive the interrupt is for 159 * @drive: the drive the interrupt is for
@@ -663,7 +660,7 @@ int __ide_dma_bad_drive (ide_drive_t *drive)
663{ 660{
664 struct hd_driveid *id = drive->id; 661 struct hd_driveid *id = drive->id;
665 662
666 int blacklist = in_drive_list(id, drive_blacklist); 663 int blacklist = ide_in_drive_list(id, drive_blacklist);
667 if (blacklist) { 664 if (blacklist) {
668 printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n", 665 printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n",
669 drive->name, id->model); 666 drive->name, id->model);
@@ -677,7 +674,7 @@ EXPORT_SYMBOL(__ide_dma_bad_drive);
677int __ide_dma_good_drive (ide_drive_t *drive) 674int __ide_dma_good_drive (ide_drive_t *drive)
678{ 675{
679 struct hd_driveid *id = drive->id; 676 struct hd_driveid *id = drive->id;
680 return in_drive_list(id, drive_whitelist); 677 return ide_in_drive_list(id, drive_whitelist);
681} 678}
682 679
683EXPORT_SYMBOL(__ide_dma_good_drive); 680EXPORT_SYMBOL(__ide_dma_good_drive);
diff --git a/drivers/ide/mips/Makefile b/drivers/ide/mips/Makefile
index 578e52a59588..677c7b2bac92 100644
--- a/drivers/ide/mips/Makefile
+++ b/drivers/ide/mips/Makefile
@@ -1 +1,4 @@
1obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o 1obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o
2obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o
3
4EXTRA_CFLAGS := -Idrivers/ide
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 2b6327c576b9..32431dcf5d8e 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -31,865 +31,638 @@
31 */ 31 */
32#undef REALLY_SLOW_IO /* most systems can safely undef this */ 32#undef REALLY_SLOW_IO /* most systems can safely undef this */
33 33
34#include <linux/config.h> /* for CONFIG_BLK_DEV_IDEPCI */
35#include <linux/types.h> 34#include <linux/types.h>
36#include <linux/module.h> 35#include <linux/module.h>
37#include <linux/kernel.h> 36#include <linux/kernel.h>
38#include <linux/delay.h> 37#include <linux/delay.h>
39#include <linux/timer.h> 38#include <linux/platform_device.h>
40#include <linux/mm.h> 39
41#include <linux/ioport.h>
42#include <linux/hdreg.h>
43#include <linux/init.h> 40#include <linux/init.h>
44#include <linux/ide.h> 41#include <linux/ide.h>
45#include <linux/sysdev.h> 42#include <linux/sysdev.h>
46 43
47#include <linux/dma-mapping.h> 44#include <linux/dma-mapping.h>
48 45
46#include "ide-timing.h"
47
49#include <asm/io.h> 48#include <asm/io.h>
50#include <asm/mach-au1x00/au1xxx.h> 49#include <asm/mach-au1x00/au1xxx.h>
51#include <asm/mach-au1x00/au1xxx_dbdma.h> 50#include <asm/mach-au1x00/au1xxx_dbdma.h>
52 51
53#if CONFIG_PM
54#include <asm/mach-au1x00/au1xxx_pm.h>
55#endif
56
57#include <asm/mach-au1x00/au1xxx_ide.h> 52#include <asm/mach-au1x00/au1xxx_ide.h>
58 53
59#define DRV_NAME "au1200-ide" 54#define DRV_NAME "au1200-ide"
60#define DRV_VERSION "1.0" 55#define DRV_VERSION "1.0"
61#define DRV_AUTHOR "AMD PCS / Pete Popov <ppopov@embeddedalley.com>" 56#define DRV_AUTHOR "Enrico Walther <enrico.walther@amd.com> / Pete Popov <ppopov@embeddedalley.com>"
62#define DRV_DESC "Au1200 IDE"
63
64static _auide_hwif auide_hwif;
65static spinlock_t ide_tune_drive_spin_lock = SPIN_LOCK_UNLOCKED;
66static spinlock_t ide_tune_chipset_spin_lock = SPIN_LOCK_UNLOCKED;
67static int dbdma_init_done = 0;
68
69/*
70 * local I/O functions
71 */
72u8 auide_inb(unsigned long port)
73{
74 return (au_readb(port));
75}
76 57
77u16 auide_inw(unsigned long port) 58/* enable the burstmode in the dbdma */
78{ 59#define IDE_AU1XXX_BURSTMODE 1
79 return (au_readw(port));
80}
81 60
82u32 auide_inl(unsigned long port) 61static _auide_hwif auide_hwif;
83{ 62static int dbdma_init_done;
84 return (au_readl(port));
85}
86 63
87void auide_insw(unsigned long port, void *addr, u32 count)
88{
89#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA) 64#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)
90 65
91 _auide_hwif *ahwif = &auide_hwif; 66void auide_insw(unsigned long port, void *addr, u32 count)
92 chan_tab_t *ctp;
93 au1x_ddma_desc_t *dp;
94
95 if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1,
96 DDMA_FLAGS_NOIE)) {
97 printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);
98 return;
99 }
100 ctp = *((chan_tab_t **)ahwif->rx_chan);
101 dp = ctp->cur_ptr;
102 while (dp->dscr_cmd0 & DSCR_CMD0_V)
103 ;
104 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
105#else
106 while (count--)
107 {
108 *(u16 *)addr = au_readw(port);
109 addr +=2 ;
110 }
111#endif
112}
113
114void auide_insl(unsigned long port, void *addr, u32 count)
115{
116 while (count--)
117 {
118 *(u32 *)addr = au_readl(port);
119 /* NOTE: For IDE interfaces over PCMCIA,
120 * 32-bit access does not work
121 */
122 addr += 4;
123 }
124}
125
126void auide_outb(u8 addr, unsigned long port)
127{ 67{
128 return (au_writeb(addr, port)); 68 _auide_hwif *ahwif = &auide_hwif;
129} 69 chan_tab_t *ctp;
70 au1x_ddma_desc_t *dp;
130 71
131void auide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port) 72 if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1,
132{ 73 DDMA_FLAGS_NOIE)) {
133 return (au_writeb(addr, port)); 74 printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);
75 return;
76 }
77 ctp = *((chan_tab_t **)ahwif->rx_chan);
78 dp = ctp->cur_ptr;
79 while (dp->dscr_cmd0 & DSCR_CMD0_V)
80 ;
81 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
134} 82}
135 83
136void auide_outw(u16 addr, unsigned long port) 84void auide_outsw(unsigned long port, void *addr, u32 count)
137{ 85{
138 return (au_writew(addr, port)); 86 _auide_hwif *ahwif = &auide_hwif;
139} 87 chan_tab_t *ctp;
88 au1x_ddma_desc_t *dp;
140 89
141void auide_outl(u32 addr, unsigned long port) 90 if(!put_source_flags(ahwif->tx_chan, (void*)addr,
142{ 91 count << 1, DDMA_FLAGS_NOIE)) {
143 return (au_writel(addr, port)); 92 printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);
93 return;
94 }
95 ctp = *((chan_tab_t **)ahwif->tx_chan);
96 dp = ctp->cur_ptr;
97 while (dp->dscr_cmd0 & DSCR_CMD0_V)
98 ;
99 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
144} 100}
145 101
146void auide_outsw(unsigned long port, void *addr, u32 count)
147{
148#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)
149 _auide_hwif *ahwif = &auide_hwif;
150 chan_tab_t *ctp;
151 au1x_ddma_desc_t *dp;
152
153 if(!put_source_flags(ahwif->tx_chan, (void*)addr,
154 count << 1, DDMA_FLAGS_NOIE)) {
155 printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__);
156 return;
157 }
158 ctp = *((chan_tab_t **)ahwif->tx_chan);
159 dp = ctp->cur_ptr;
160 while (dp->dscr_cmd0 & DSCR_CMD0_V)
161 ;
162 ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp);
163#else
164 while (count--)
165 {
166 au_writew(*(u16 *)addr, port);
167 addr += 2;
168 }
169#endif 102#endif
170}
171
172void auide_outsl(unsigned long port, void *addr, u32 count)
173{
174 while (count--)
175 {
176 au_writel(*(u32 *)addr, port);
177 /* NOTE: For IDE interfaces over PCMCIA,
178 * 32-bit access does not work
179 */
180 addr += 4;
181 }
182}
183 103
184static void auide_tune_drive(ide_drive_t *drive, byte pio) 104static void auide_tune_drive(ide_drive_t *drive, byte pio)
185{ 105{
186 int mem_sttime; 106 int mem_sttime;
187 int mem_stcfg; 107 int mem_stcfg;
188 unsigned long flags; 108 u8 speed;
189 u8 speed; 109
190 110 /* get the best pio mode for the drive */
191 /* get the best pio mode for the drive */ 111 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
192 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 112
193 113 printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n",
194 printk("%s: setting Au1XXX IDE to PIO mode%d\n", 114 drive->name, pio);
195 drive->name, pio); 115
196 116 mem_sttime = 0;
197 spin_lock_irqsave(&ide_tune_drive_spin_lock, flags); 117 mem_stcfg = au_readl(MEM_STCFG2);
198 118
199 mem_sttime = 0; 119 /* set pio mode! */
200 mem_stcfg = au_readl(MEM_STCFG2); 120 switch(pio) {
201 121 case 0:
202 /* set pio mode! */ 122 mem_sttime = SBC_IDE_TIMING(PIO0);
203 switch(pio) { 123
204 case 0: 124 /* set configuration for RCS2# */
205 /* set timing parameters for RCS2# */ 125 mem_stcfg |= TS_MASK;
206 mem_sttime = SBC_IDE_PIO0_TWCS 126 mem_stcfg &= ~TCSOE_MASK;
207 | SBC_IDE_PIO0_TCSH 127 mem_stcfg &= ~TOECS_MASK;
208 | SBC_IDE_PIO0_TCSOFF 128 mem_stcfg |= SBC_IDE_PIO0_TCSOE | SBC_IDE_PIO0_TOECS;
209 | SBC_IDE_PIO0_TWP 129 break;
210 | SBC_IDE_PIO0_TCSW 130
211 | SBC_IDE_PIO0_TPM 131 case 1:
212 | SBC_IDE_PIO0_TA; 132 mem_sttime = SBC_IDE_TIMING(PIO1);
213 /* set configuration for RCS2# */ 133
214 mem_stcfg |= TS_MASK; 134 /* set configuration for RCS2# */
215 mem_stcfg &= ~TCSOE_MASK; 135 mem_stcfg |= TS_MASK;
216 mem_stcfg &= ~TOECS_MASK; 136 mem_stcfg &= ~TCSOE_MASK;
217 mem_stcfg |= SBC_IDE_PIO0_TCSOE | SBC_IDE_PIO0_TOECS; 137 mem_stcfg &= ~TOECS_MASK;
218 138 mem_stcfg |= SBC_IDE_PIO1_TCSOE | SBC_IDE_PIO1_TOECS;
219 au_writel(mem_sttime,MEM_STTIME2); 139 break;
220 au_writel(mem_stcfg,MEM_STCFG2); 140
221 break; 141 case 2:
222 142 mem_sttime = SBC_IDE_TIMING(PIO2);
223 case 1: 143
224 /* set timing parameters for RCS2# */ 144 /* set configuration for RCS2# */
225 mem_sttime = SBC_IDE_PIO1_TWCS 145 mem_stcfg &= ~TS_MASK;
226 | SBC_IDE_PIO1_TCSH 146 mem_stcfg &= ~TCSOE_MASK;
227 | SBC_IDE_PIO1_TCSOFF 147 mem_stcfg &= ~TOECS_MASK;
228 | SBC_IDE_PIO1_TWP 148 mem_stcfg |= SBC_IDE_PIO2_TCSOE | SBC_IDE_PIO2_TOECS;
229 | SBC_IDE_PIO1_TCSW 149 break;
230 | SBC_IDE_PIO1_TPM 150
231 | SBC_IDE_PIO1_TA; 151 case 3:
232 /* set configuration for RCS2# */ 152 mem_sttime = SBC_IDE_TIMING(PIO3);
233 mem_stcfg |= TS_MASK; 153
234 mem_stcfg &= ~TCSOE_MASK; 154 /* set configuration for RCS2# */
235 mem_stcfg &= ~TOECS_MASK; 155 mem_stcfg &= ~TS_MASK;
236 mem_stcfg |= SBC_IDE_PIO1_TCSOE | SBC_IDE_PIO1_TOECS; 156 mem_stcfg &= ~TCSOE_MASK;
237 break; 157 mem_stcfg &= ~TOECS_MASK;
238 158 mem_stcfg |= SBC_IDE_PIO3_TCSOE | SBC_IDE_PIO3_TOECS;
239 case 2: 159
240 /* set timing parameters for RCS2# */ 160 break;
241 mem_sttime = SBC_IDE_PIO2_TWCS 161
242 | SBC_IDE_PIO2_TCSH 162 case 4:
243 | SBC_IDE_PIO2_TCSOFF 163 mem_sttime = SBC_IDE_TIMING(PIO4);
244 | SBC_IDE_PIO2_TWP 164
245 | SBC_IDE_PIO2_TCSW 165 /* set configuration for RCS2# */
246 | SBC_IDE_PIO2_TPM 166 mem_stcfg &= ~TS_MASK;
247 | SBC_IDE_PIO2_TA; 167 mem_stcfg &= ~TCSOE_MASK;
248 /* set configuration for RCS2# */ 168 mem_stcfg &= ~TOECS_MASK;
249 mem_stcfg &= ~TS_MASK; 169 mem_stcfg |= SBC_IDE_PIO4_TCSOE | SBC_IDE_PIO4_TOECS;
250 mem_stcfg &= ~TCSOE_MASK; 170 break;
251 mem_stcfg &= ~TOECS_MASK; 171 }
252 mem_stcfg |= SBC_IDE_PIO2_TCSOE | SBC_IDE_PIO2_TOECS; 172
253 break; 173 au_writel(mem_sttime,MEM_STTIME2);
254 174 au_writel(mem_stcfg,MEM_STCFG2);
255 case 3: 175
256 /* set timing parameters for RCS2# */ 176 speed = pio + XFER_PIO_0;
257 mem_sttime = SBC_IDE_PIO3_TWCS 177 ide_config_drive_speed(drive, speed);
258 | SBC_IDE_PIO3_TCSH
259 | SBC_IDE_PIO3_TCSOFF
260 | SBC_IDE_PIO3_TWP
261 | SBC_IDE_PIO3_TCSW
262 | SBC_IDE_PIO3_TPM
263 | SBC_IDE_PIO3_TA;
264 /* set configuration for RCS2# */
265 mem_stcfg |= TS_MASK;
266 mem_stcfg &= ~TS_MASK;
267 mem_stcfg &= ~TCSOE_MASK;
268 mem_stcfg &= ~TOECS_MASK;
269 mem_stcfg |= SBC_IDE_PIO3_TCSOE | SBC_IDE_PIO3_TOECS;
270
271 break;
272
273 case 4:
274 /* set timing parameters for RCS2# */
275 mem_sttime = SBC_IDE_PIO4_TWCS
276 | SBC_IDE_PIO4_TCSH
277 | SBC_IDE_PIO4_TCSOFF
278 | SBC_IDE_PIO4_TWP
279 | SBC_IDE_PIO4_TCSW
280 | SBC_IDE_PIO4_TPM
281 | SBC_IDE_PIO4_TA;
282 /* set configuration for RCS2# */
283 mem_stcfg &= ~TS_MASK;
284 mem_stcfg &= ~TCSOE_MASK;
285 mem_stcfg &= ~TOECS_MASK;
286 mem_stcfg |= SBC_IDE_PIO4_TCSOE | SBC_IDE_PIO4_TOECS;
287 break;
288 }
289
290 au_writel(mem_sttime,MEM_STTIME2);
291 au_writel(mem_stcfg,MEM_STCFG2);
292
293 spin_unlock_irqrestore(&ide_tune_drive_spin_lock, flags);
294
295 speed = pio + XFER_PIO_0;
296 ide_config_drive_speed(drive, speed);
297} 178}
298 179
299static int auide_tune_chipset (ide_drive_t *drive, u8 speed) 180static int auide_tune_chipset (ide_drive_t *drive, u8 speed)
300{ 181{
301 u8 mode = 0; 182 int mem_sttime;
302 int mem_sttime; 183 int mem_stcfg;
303 int mem_stcfg; 184 unsigned long mode;
304 unsigned long flags; 185
305#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 186#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
306 struct hd_driveid *id = drive->id; 187 if (ide_use_dma(drive))
307 188 mode = ide_dma_speed(drive, 0);
308 /*
309 * Now see what the current drive is capable of,
310 * selecting UDMA only if the mate said it was ok.
311 */
312 if (id && (id->capability & 1) && drive->autodma &&
313 !__ide_dma_bad_drive(drive)) {
314 if (!mode && (id->field_valid & 2) && (id->dma_mword & 7)) {
315 if (id->dma_mword & 4)
316 mode = XFER_MW_DMA_2;
317 else if (id->dma_mword & 2)
318 mode = XFER_MW_DMA_1;
319 else if (id->dma_mword & 1)
320 mode = XFER_MW_DMA_0;
321 }
322 }
323#endif 189#endif
324 190
325 spin_lock_irqsave(&ide_tune_chipset_spin_lock, flags); 191 mem_sttime = 0;
192 mem_stcfg = au_readl(MEM_STCFG2);
326 193
327 mem_sttime = 0; 194 if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {
328 mem_stcfg = au_readl(MEM_STCFG2); 195 auide_tune_drive(drive, speed - XFER_PIO_0);
329 196 return 0;
330 switch(speed) { 197 }
331 case XFER_PIO_4: 198
332 case XFER_PIO_3: 199 switch(speed) {
333 case XFER_PIO_2:
334 case XFER_PIO_1:
335 case XFER_PIO_0:
336 auide_tune_drive(drive, (speed - XFER_PIO_0));
337 break;
338#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 200#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
339 case XFER_MW_DMA_2: 201 case XFER_MW_DMA_2:
340 /* set timing parameters for RCS2# */ 202 mem_sttime = SBC_IDE_TIMING(MDMA2);
341 mem_sttime = SBC_IDE_MDMA2_TWCS 203
342 | SBC_IDE_MDMA2_TCSH 204 /* set configuration for RCS2# */
343 | SBC_IDE_MDMA2_TCSOFF 205 mem_stcfg &= ~TS_MASK;
344 | SBC_IDE_MDMA2_TWP 206 mem_stcfg &= ~TCSOE_MASK;
345 | SBC_IDE_MDMA2_TCSW 207 mem_stcfg &= ~TOECS_MASK;
346 | SBC_IDE_MDMA2_TPM 208 mem_stcfg |= SBC_IDE_MDMA2_TCSOE | SBC_IDE_MDMA2_TOECS;
347 | SBC_IDE_MDMA2_TA; 209
348 /* set configuration for RCS2# */ 210 mode = XFER_MW_DMA_2;
349 mem_stcfg &= ~TS_MASK; 211 break;
350 mem_stcfg &= ~TCSOE_MASK; 212 case XFER_MW_DMA_1:
351 mem_stcfg &= ~TOECS_MASK; 213 mem_sttime = SBC_IDE_TIMING(MDMA1);
352 mem_stcfg |= SBC_IDE_MDMA2_TCSOE | SBC_IDE_MDMA2_TOECS; 214
353 215 /* set configuration for RCS2# */
354 mode = XFER_MW_DMA_2; 216 mem_stcfg &= ~TS_MASK;
355 break; 217 mem_stcfg &= ~TCSOE_MASK;
356 case XFER_MW_DMA_1: 218 mem_stcfg &= ~TOECS_MASK;
357 /* set timing parameters for RCS2# */ 219 mem_stcfg |= SBC_IDE_MDMA1_TCSOE | SBC_IDE_MDMA1_TOECS;
358 mem_sttime = SBC_IDE_MDMA1_TWCS 220
359 | SBC_IDE_MDMA1_TCSH 221 mode = XFER_MW_DMA_1;
360 | SBC_IDE_MDMA1_TCSOFF 222 break;
361 | SBC_IDE_MDMA1_TWP 223 case XFER_MW_DMA_0:
362 | SBC_IDE_MDMA1_TCSW 224 mem_sttime = SBC_IDE_TIMING(MDMA0);
363 | SBC_IDE_MDMA1_TPM 225
364 | SBC_IDE_MDMA1_TA; 226 /* set configuration for RCS2# */
365 /* set configuration for RCS2# */ 227 mem_stcfg |= TS_MASK;
366 mem_stcfg &= ~TS_MASK; 228 mem_stcfg &= ~TCSOE_MASK;
367 mem_stcfg &= ~TCSOE_MASK; 229 mem_stcfg &= ~TOECS_MASK;
368 mem_stcfg &= ~TOECS_MASK; 230 mem_stcfg |= SBC_IDE_MDMA0_TCSOE | SBC_IDE_MDMA0_TOECS;
369 mem_stcfg |= SBC_IDE_MDMA1_TCSOE | SBC_IDE_MDMA1_TOECS; 231
370 232 mode = XFER_MW_DMA_0;
371 mode = XFER_MW_DMA_1; 233 break;
372 break;
373 case XFER_MW_DMA_0:
374 /* set timing parameters for RCS2# */
375 mem_sttime = SBC_IDE_MDMA0_TWCS
376 | SBC_IDE_MDMA0_TCSH
377 | SBC_IDE_MDMA0_TCSOFF
378 | SBC_IDE_MDMA0_TWP
379 | SBC_IDE_MDMA0_TCSW
380 | SBC_IDE_MDMA0_TPM
381 | SBC_IDE_MDMA0_TA;
382 /* set configuration for RCS2# */
383 mem_stcfg |= TS_MASK;
384 mem_stcfg &= ~TCSOE_MASK;
385 mem_stcfg &= ~TOECS_MASK;
386 mem_stcfg |= SBC_IDE_MDMA0_TCSOE | SBC_IDE_MDMA0_TOECS;
387
388 mode = XFER_MW_DMA_0;
389 break;
390#endif 234#endif
391 default: 235 default:
392 return 1; 236 return 1;
393 } 237 }
394 238
395 /* 239 if (ide_config_drive_speed(drive, mode))
396 * Tell the drive to switch to the new mode; abort on failure. 240 return 1;
397 */
398 if (!mode || ide_config_drive_speed(drive, mode))
399 {
400 return 1; /* failure */
401 }
402
403
404 au_writel(mem_sttime,MEM_STTIME2);
405 au_writel(mem_stcfg,MEM_STCFG2);
406 241
407 spin_unlock_irqrestore(&ide_tune_chipset_spin_lock, flags); 242 au_writel(mem_sttime,MEM_STTIME2);
243 au_writel(mem_stcfg,MEM_STCFG2);
408 244
409 return 0; 245 return 0;
410} 246}
411 247
412/* 248/*
413 * Multi-Word DMA + DbDMA functions 249 * Multi-Word DMA + DbDMA functions
414 */ 250 */
415#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
416 251
417static int in_drive_list(struct hd_driveid *id, 252#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
418 const struct drive_list_entry *drive_table)
419{
420 for ( ; drive_table->id_model ; drive_table++){
421 if ((!strcmp(drive_table->id_model, id->model)) &&
422 ((strstr(drive_table->id_firmware, id->fw_rev)) ||
423 (!strcmp(drive_table->id_firmware, "ALL")))
424 )
425 return 1;
426 }
427 return 0;
428}
429 253
430static int auide_build_sglist(ide_drive_t *drive, struct request *rq) 254static int auide_build_sglist(ide_drive_t *drive, struct request *rq)
431{ 255{
432 ide_hwif_t *hwif = drive->hwif; 256 ide_hwif_t *hwif = drive->hwif;
433 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; 257 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;
434 struct scatterlist *sg = hwif->sg_table; 258 struct scatterlist *sg = hwif->sg_table;
435 259
436 ide_map_sg(drive, rq); 260 ide_map_sg(drive, rq);
437 261
438 if (rq_data_dir(rq) == READ) 262 if (rq_data_dir(rq) == READ)
439 hwif->sg_dma_direction = DMA_FROM_DEVICE; 263 hwif->sg_dma_direction = DMA_FROM_DEVICE;
440 else 264 else
441 hwif->sg_dma_direction = DMA_TO_DEVICE; 265 hwif->sg_dma_direction = DMA_TO_DEVICE;
442 266
443 return dma_map_sg(ahwif->dev, sg, hwif->sg_nents, 267 return dma_map_sg(ahwif->dev, sg, hwif->sg_nents,
444 hwif->sg_dma_direction); 268 hwif->sg_dma_direction);
445} 269}
446 270
447static int auide_build_dmatable(ide_drive_t *drive) 271static int auide_build_dmatable(ide_drive_t *drive)
448{ 272{
449 int i, iswrite, count = 0; 273 int i, iswrite, count = 0;
450 ide_hwif_t *hwif = HWIF(drive); 274 ide_hwif_t *hwif = HWIF(drive);
451 275
452 struct request *rq = HWGROUP(drive)->rq; 276 struct request *rq = HWGROUP(drive)->rq;
453 277
454 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; 278 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;
455 struct scatterlist *sg; 279 struct scatterlist *sg;
456 280
457 iswrite = (rq_data_dir(rq) == WRITE); 281 iswrite = (rq_data_dir(rq) == WRITE);
458 /* Save for interrupt context */ 282 /* Save for interrupt context */
459 ahwif->drive = drive; 283 ahwif->drive = drive;
460 284
461 /* Build sglist */ 285 /* Build sglist */
462 hwif->sg_nents = i = auide_build_sglist(drive, rq); 286 hwif->sg_nents = i = auide_build_sglist(drive, rq);
463 287
464 if (!i) 288 if (!i)
465 return 0; 289 return 0;
466 290
467 /* fill the descriptors */ 291 /* fill the descriptors */
468 sg = hwif->sg_table; 292 sg = hwif->sg_table;
469 while (i && sg_dma_len(sg)) { 293 while (i && sg_dma_len(sg)) {
470 u32 cur_addr; 294 u32 cur_addr;
471 u32 cur_len; 295 u32 cur_len;
472 296
473 cur_addr = sg_dma_address(sg); 297 cur_addr = sg_dma_address(sg);
474 cur_len = sg_dma_len(sg); 298 cur_len = sg_dma_len(sg);
475 299
476 while (cur_len) { 300 while (cur_len) {
477 u32 flags = DDMA_FLAGS_NOIE; 301 u32 flags = DDMA_FLAGS_NOIE;
478 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00; 302 unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00;
479 303
480 if (++count >= PRD_ENTRIES) { 304 if (++count >= PRD_ENTRIES) {
481 printk(KERN_WARNING "%s: DMA table too small\n", 305 printk(KERN_WARNING "%s: DMA table too small\n",
482 drive->name); 306 drive->name);
483 goto use_pio_instead; 307 goto use_pio_instead;
484 } 308 }
485 309
486 /* Lets enable intr for the last descriptor only */ 310 /* Lets enable intr for the last descriptor only */
487 if (1==i) 311 if (1==i)
488 flags = DDMA_FLAGS_IE; 312 flags = DDMA_FLAGS_IE;
489 else 313 else
490 flags = DDMA_FLAGS_NOIE; 314 flags = DDMA_FLAGS_NOIE;
491 315
492 if (iswrite) { 316 if (iswrite) {
493 if(!put_source_flags(ahwif->tx_chan, 317 if(!put_source_flags(ahwif->tx_chan,
494 (void*)(page_address(sg->page) 318 (void*)(page_address(sg->page)
495 + sg->offset), 319 + sg->offset),
496 tc, flags)) { 320 tc, flags)) {
497 printk(KERN_ERR "%s failed %d\n", 321 printk(KERN_ERR "%s failed %d\n",
498 __FUNCTION__, __LINE__); 322 __FUNCTION__, __LINE__);
499 } 323 }
500 } else 324 } else
501 { 325 {
502 if(!put_dest_flags(ahwif->rx_chan, 326 if(!put_dest_flags(ahwif->rx_chan,
503 (void*)(page_address(sg->page) 327 (void*)(page_address(sg->page)
504 + sg->offset), 328 + sg->offset),
505 tc, flags)) { 329 tc, flags)) {
506 printk(KERN_ERR "%s failed %d\n", 330 printk(KERN_ERR "%s failed %d\n",
507 __FUNCTION__, __LINE__); 331 __FUNCTION__, __LINE__);
508 } 332 }
509 } 333 }
510 334
511 cur_addr += tc; 335 cur_addr += tc;
512 cur_len -= tc; 336 cur_len -= tc;
513 } 337 }
514 sg++; 338 sg++;
515 i--; 339 i--;
516 } 340 }
517 341
518 if (count) 342 if (count)
519 return 1; 343 return 1;
520 344
521use_pio_instead: 345 use_pio_instead:
522 dma_unmap_sg(ahwif->dev, 346 dma_unmap_sg(ahwif->dev,
523 hwif->sg_table, 347 hwif->sg_table,
524 hwif->sg_nents, 348 hwif->sg_nents,
525 hwif->sg_dma_direction); 349 hwif->sg_dma_direction);
526 350
527 return 0; /* revert to PIO for this request */ 351 return 0; /* revert to PIO for this request */
528} 352}
529 353
530static int auide_dma_end(ide_drive_t *drive) 354static int auide_dma_end(ide_drive_t *drive)
531{ 355{
532 ide_hwif_t *hwif = HWIF(drive); 356 ide_hwif_t *hwif = HWIF(drive);
533 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; 357 _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;
534 358
535 if (hwif->sg_nents) { 359 if (hwif->sg_nents) {
536 dma_unmap_sg(ahwif->dev, hwif->sg_table, hwif->sg_nents, 360 dma_unmap_sg(ahwif->dev, hwif->sg_table, hwif->sg_nents,
537 hwif->sg_dma_direction); 361 hwif->sg_dma_direction);
538 hwif->sg_nents = 0; 362 hwif->sg_nents = 0;
539 } 363 }
540 364
541 return 0; 365 return 0;
542} 366}
543 367
544static void auide_dma_start(ide_drive_t *drive ) 368static void auide_dma_start(ide_drive_t *drive )
545{ 369{
546// printk("%s\n", __FUNCTION__);
547} 370}
548 371
549ide_startstop_t auide_dma_intr(ide_drive_t *drive)
550{
551 //printk("%s\n", __FUNCTION__);
552
553 u8 stat = 0, dma_stat = 0;
554
555 dma_stat = HWIF(drive)->ide_dma_end(drive);
556 stat = HWIF(drive)->INB(IDE_STATUS_REG); /* get drive status */
557 if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
558 if (!dma_stat) {
559 struct request *rq = HWGROUP(drive)->rq;
560
561 ide_end_request(drive, 1, rq->nr_sectors);
562 return ide_stopped;
563 }
564 printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
565 drive->name, dma_stat);
566 }
567 return ide_error(drive, "dma_intr", stat);
568}
569 372
570static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command) 373static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command)
571{ 374{
572 //printk("%s\n", __FUNCTION__); 375 /* issue cmd to drive */
573 376 ide_execute_command(drive, command, &ide_dma_intr,
574 /* issue cmd to drive */ 377 (2*WAIT_CMD), NULL);
575 ide_execute_command(drive, command, &auide_dma_intr,
576 (2*WAIT_CMD), NULL);
577} 378}
578 379
579static int auide_dma_setup(ide_drive_t *drive) 380static int auide_dma_setup(ide_drive_t *drive)
580{ 381{
581// printk("%s\n", __FUNCTION__); 382 struct request *rq = HWGROUP(drive)->rq;
582
583 if (drive->media != ide_disk)
584 return 1;
585
586 if (!auide_build_dmatable(drive))
587 /* try PIO instead of DMA */
588 return 1;
589 383
590 drive->waiting_for_dma = 1; 384 if (!auide_build_dmatable(drive)) {
385 ide_map_sg(drive, rq);
386 return 1;
387 }
591 388
592 return 0; 389 drive->waiting_for_dma = 1;
390 return 0;
593} 391}
594 392
595static int auide_dma_check(ide_drive_t *drive) 393static int auide_dma_check(ide_drive_t *drive)
596{ 394{
597// printk("%s\n", __FUNCTION__); 395 u8 speed;
598 396
599#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 397#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
600 if( !dbdma_init_done ){ 398
601 auide_hwif.white_list = in_drive_list(drive->id, 399 if( dbdma_init_done == 0 ){
602 dma_white_list); 400 auide_hwif.white_list = ide_in_drive_list(drive->id,
603 auide_hwif.black_list = in_drive_list(drive->id, 401 dma_white_list);
604 dma_black_list); 402 auide_hwif.black_list = ide_in_drive_list(drive->id,
605 auide_hwif.drive = drive; 403 dma_black_list);
606 auide_ddma_init(&auide_hwif); 404 auide_hwif.drive = drive;
607 dbdma_init_done = 1; 405 auide_ddma_init(&auide_hwif);
608 } 406 dbdma_init_done = 1;
407 }
609#endif 408#endif
610 409
611 /* Is the drive in our DMA black list? */ 410 /* Is the drive in our DMA black list? */
612 if ( auide_hwif.black_list ) { 411
613 drive->using_dma = 0; 412 if ( auide_hwif.black_list ) {
614 printk("%s found in dma_blacklist[]! Disabling DMA.\n", 413 drive->using_dma = 0;
615 drive->id->model); 414
616 } 415 /* Borrowed the warning message from ide-dma.c */
617 else
618 drive->using_dma = 1;
619 416
620 return HWIF(drive)->ide_dma_host_on(drive); 417 printk(KERN_WARNING "%s: Disabling DMA for %s (blacklisted)\n",
418 drive->name, drive->id->model);
419 }
420 else
421 drive->using_dma = 1;
422
423 speed = ide_find_best_mode(drive, XFER_PIO | XFER_MWDMA);
424
425 if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)
426 return HWIF(drive)->ide_dma_on(drive);
427
428 return HWIF(drive)->ide_dma_off_quietly(drive);
621} 429}
622 430
623static int auide_dma_test_irq(ide_drive_t *drive) 431static int auide_dma_test_irq(ide_drive_t *drive)
624{ 432{
625// printk("%s\n", __FUNCTION__); 433 if (drive->waiting_for_dma == 0)
626 434 printk(KERN_WARNING "%s: ide_dma_test_irq \
627 if (!drive->waiting_for_dma)
628 printk(KERN_WARNING "%s: ide_dma_test_irq \
629 called while not waiting\n", drive->name); 435 called while not waiting\n", drive->name);
630 436
631 /* If dbdma didn't execute the STOP command yet, the 437 /* If dbdma didn't execute the STOP command yet, the
632 * active bit is still set 438 * active bit is still set
633 */ 439 */
634 drive->waiting_for_dma++; 440 drive->waiting_for_dma++;
635 if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) { 441 if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) {
636 printk(KERN_WARNING "%s: timeout waiting for ddma to \ 442 printk(KERN_WARNING "%s: timeout waiting for ddma to \
637 complete\n", drive->name); 443 complete\n", drive->name);
638 return 1; 444 return 1;
639 } 445 }
640 udelay(10); 446 udelay(10);
641 return 0; 447 return 0;
642} 448}
643 449
644static int auide_dma_host_on(ide_drive_t *drive) 450static int auide_dma_host_on(ide_drive_t *drive)
645{ 451{
646// printk("%s\n", __FUNCTION__); 452 return 0;
647 return 0;
648} 453}
649 454
650static int auide_dma_on(ide_drive_t *drive) 455static int auide_dma_on(ide_drive_t *drive)
651{ 456{
652// printk("%s\n", __FUNCTION__); 457 drive->using_dma = 1;
653 drive->using_dma = 1; 458 return auide_dma_host_on(drive);
654 return auide_dma_host_on(drive);
655} 459}
656 460
657 461
658static int auide_dma_host_off(ide_drive_t *drive) 462static int auide_dma_host_off(ide_drive_t *drive)
659{ 463{
660// printk("%s\n", __FUNCTION__); 464 return 0;
661 return 0;
662} 465}
663 466
664static int auide_dma_off_quietly(ide_drive_t *drive) 467static int auide_dma_off_quietly(ide_drive_t *drive)
665{ 468{
666// printk("%s\n", __FUNCTION__); 469 drive->using_dma = 0;
667 drive->using_dma = 0; 470 return auide_dma_host_off(drive);
668 return auide_dma_host_off(drive);
669} 471}
670 472
671static int auide_dma_lostirq(ide_drive_t *drive) 473static int auide_dma_lostirq(ide_drive_t *drive)
672{ 474{
673// printk("%s\n", __FUNCTION__); 475 printk(KERN_ERR "%s: IRQ lost\n", drive->name);
674 476 return 0;
675 printk(KERN_ERR "%s: IRQ lost\n", drive->name);
676 return 0;
677} 477}
678 478
679static void auide_ddma_tx_callback(int irq, void *param, struct pt_regs *regs) 479static void auide_ddma_tx_callback(int irq, void *param, struct pt_regs *regs)
680{ 480{
681// printk("%s\n", __FUNCTION__); 481 _auide_hwif *ahwif = (_auide_hwif*)param;
682 482 ahwif->drive->waiting_for_dma = 0;
683 _auide_hwif *ahwif = (_auide_hwif*)param;
684 ahwif->drive->waiting_for_dma = 0;
685 return;
686} 483}
687 484
688static void auide_ddma_rx_callback(int irq, void *param, struct pt_regs *regs) 485static void auide_ddma_rx_callback(int irq, void *param, struct pt_regs *regs)
689{ 486{
690// printk("%s\n", __FUNCTION__); 487 _auide_hwif *ahwif = (_auide_hwif*)param;
488 ahwif->drive->waiting_for_dma = 0;
489}
490
491#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
691 492
692 _auide_hwif *ahwif = (_auide_hwif*)param; 493static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 devwidth, u32 flags)
693 ahwif->drive->waiting_for_dma = 0; 494{
694 return; 495 dev->dev_id = dev_id;
496 dev->dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
497 dev->dev_intlevel = 0;
498 dev->dev_intpolarity = 0;
499 dev->dev_tsize = tsize;
500 dev->dev_devwidth = devwidth;
501 dev->dev_flags = flags;
695} 502}
503
504#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
696 505
697static int auide_dma_timeout(ide_drive_t *drive) 506static int auide_dma_timeout(ide_drive_t *drive)
698{ 507{
699// printk("%s\n", __FUNCTION__); 508// printk("%s\n", __FUNCTION__);
700 509
701 printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name); 510 printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
702 511
703 if (HWIF(drive)->ide_dma_test_irq(drive)) 512 if (HWIF(drive)->ide_dma_test_irq(drive))
704 return 0; 513 return 0;
705 514
706 return HWIF(drive)->ide_dma_end(drive); 515 return HWIF(drive)->ide_dma_end(drive);
707} 516}
708#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ 517
709 518
519static int auide_ddma_init(_auide_hwif *auide) {
520
521 dbdev_tab_t source_dev_tab, target_dev_tab;
522 u32 dev_id, tsize, devwidth, flags;
523 ide_hwif_t *hwif = auide->hwif;
710 524
711static int auide_ddma_init( _auide_hwif *auide ) 525 dev_id = AU1XXX_ATA_DDMA_REQ;
712{
713// printk("%s\n", __FUNCTION__);
714 526
715 dbdev_tab_t source_dev_tab; 527 if (auide->white_list || auide->black_list) {
716#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 528 tsize = 8;
717 dbdev_tab_t target_dev_tab; 529 devwidth = 32;
718 ide_hwif_t *hwif = auide->hwif; 530 }
719 char warning_output [2][80]; 531 else {
720 int i; 532 tsize = 1;
721#endif 533 devwidth = 16;
534
535 printk(KERN_ERR "au1xxx-ide: %s is not on ide driver whitelist.\n",auide_hwif.drive->id->model);
536 printk(KERN_ERR " please read 'Documentation/mips/AU1xxx_IDE.README'");
537 }
722 538
723 /* Add our custom device to DDMA device table */ 539#ifdef IDE_AU1XXX_BURSTMODE
724 /* Create our new device entries in the table */ 540 flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE;
725#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
726 source_dev_tab.dev_id = AU1XXX_ATA_DDMA_REQ;
727
728 if( auide->white_list || auide->black_list ){
729 source_dev_tab.dev_tsize = 8;
730 source_dev_tab.dev_devwidth = 32;
731 source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
732 source_dev_tab.dev_intlevel = 0;
733 source_dev_tab.dev_intpolarity = 0;
734
735 /* init device table for target - static bus controller - */
736 target_dev_tab.dev_id = DSCR_CMD0_ALWAYS;
737 target_dev_tab.dev_tsize = 8;
738 target_dev_tab.dev_devwidth = 32;
739 target_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
740 target_dev_tab.dev_intlevel = 0;
741 target_dev_tab.dev_intpolarity = 0;
742 target_dev_tab.dev_flags = DEV_FLAGS_ANYUSE;
743 }
744 else{
745 source_dev_tab.dev_tsize = 1;
746 source_dev_tab.dev_devwidth = 16;
747 source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
748 source_dev_tab.dev_intlevel = 0;
749 source_dev_tab.dev_intpolarity = 0;
750
751 /* init device table for target - static bus controller - */
752 target_dev_tab.dev_id = DSCR_CMD0_ALWAYS;
753 target_dev_tab.dev_tsize = 1;
754 target_dev_tab.dev_devwidth = 16;
755 target_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
756 target_dev_tab.dev_intlevel = 0;
757 target_dev_tab.dev_intpolarity = 0;
758 target_dev_tab.dev_flags = DEV_FLAGS_ANYUSE;
759
760 sprintf(&warning_output[0][0],
761 "%s is not on ide driver white list.",
762 auide_hwif.drive->id->model);
763 for ( i=strlen(&warning_output[0][0]) ; i<76; i++ ){
764 sprintf(&warning_output[0][i]," ");
765 }
766
767 sprintf(&warning_output[1][0],
768 "To add %s please read 'Documentation/mips/AU1xxx_IDE.README'.",
769 auide_hwif.drive->id->model);
770 for ( i=strlen(&warning_output[1][0]) ; i<76; i++ ){
771 sprintf(&warning_output[1][i]," ");
772 }
773
774 printk("\n****************************************");
775 printk("****************************************\n");
776 printk("* %s *\n",&warning_output[0][0]);
777 printk("* Switch to safe MWDMA Mode! ");
778 printk(" *\n");
779 printk("* %s *\n",&warning_output[1][0]);
780 printk("****************************************");
781 printk("****************************************\n\n");
782 }
783#else 541#else
784 source_dev_tab.dev_id = DSCR_CMD0_ALWAYS; 542 flags = DEV_FLAGS_SYNC;
785 source_dev_tab.dev_tsize = 8;
786 source_dev_tab.dev_devwidth = 32;
787 source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
788 source_dev_tab.dev_intlevel = 0;
789 source_dev_tab.dev_intpolarity = 0;
790#endif 543#endif
791 544
792#if CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 545 /* setup dev_tab for tx channel */
793 /* set flags for tx channel */ 546 auide_init_dbdma_dev( &source_dev_tab,
794 source_dev_tab.dev_flags = DEV_FLAGS_OUT 547 dev_id,
795 | DEV_FLAGS_SYNC 548 tsize, devwidth, DEV_FLAGS_OUT | flags);
796 | DEV_FLAGS_BURSTABLE; 549 auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
797 auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); 550
798 /* set flags for rx channel */ 551 auide_init_dbdma_dev( &source_dev_tab,
799 source_dev_tab.dev_flags = DEV_FLAGS_IN 552 dev_id,
800 | DEV_FLAGS_SYNC 553 tsize, devwidth, DEV_FLAGS_IN | flags);
801 | DEV_FLAGS_BURSTABLE; 554 auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
802 auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); 555
556 /* We also need to add a target device for the DMA */
557 auide_init_dbdma_dev( &target_dev_tab,
558 (u32)DSCR_CMD0_ALWAYS,
559 tsize, devwidth, DEV_FLAGS_ANYUSE);
560 auide->target_dev_id = au1xxx_ddma_add_device(&target_dev_tab);
561
562 /* Get a channel for TX */
563 auide->tx_chan = au1xxx_dbdma_chan_alloc(auide->target_dev_id,
564 auide->tx_dev_id,
565 auide_ddma_tx_callback,
566 (void*)auide);
567
568 /* Get a channel for RX */
569 auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,
570 auide->target_dev_id,
571 auide_ddma_rx_callback,
572 (void*)auide);
573
574 auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan,
575 NUM_DESCRIPTORS);
576 auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan,
577 NUM_DESCRIPTORS);
578
579 hwif->dmatable_cpu = dma_alloc_coherent(auide->dev,
580 PRD_ENTRIES * PRD_BYTES, /* 1 Page */
581 &hwif->dmatable_dma, GFP_KERNEL);
582
583 au1xxx_dbdma_start( auide->tx_chan );
584 au1xxx_dbdma_start( auide->rx_chan );
585
586 return 0;
587}
803#else 588#else
804 /* set flags for tx channel */ 589
805 source_dev_tab.dev_flags = DEV_FLAGS_OUT | DEV_FLAGS_SYNC; 590static int auide_ddma_init( _auide_hwif *auide )
806 auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); 591{
807 /* set flags for rx channel */ 592 dbdev_tab_t source_dev_tab;
808 source_dev_tab.dev_flags = DEV_FLAGS_IN | DEV_FLAGS_SYNC; 593 int flags;
809 auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
810#endif
811 594
812#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 595#ifdef IDE_AU1XXX_BURSTMODE
813 596 flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE;
814 auide->target_dev_id = au1xxx_ddma_add_device(&target_dev_tab); 597#else
815 598 flags = DEV_FLAGS_SYNC;
816 /* Get a channel for TX */
817 auide->tx_chan = au1xxx_dbdma_chan_alloc(auide->target_dev_id,
818 auide->tx_dev_id,
819 auide_ddma_tx_callback,
820 (void*)auide);
821 /* Get a channel for RX */
822 auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,
823 auide->target_dev_id,
824 auide_ddma_rx_callback,
825 (void*)auide);
826#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */
827 /*
828 * Note: if call back is not enabled, update ctp->cur_ptr manually
829 */
830 auide->tx_chan = au1xxx_dbdma_chan_alloc(DSCR_CMD0_ALWAYS,
831 auide->tx_dev_id,
832 NULL,
833 (void*)auide);
834 auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,
835 DSCR_CMD0_ALWAYS,
836 NULL,
837 (void*)auide);
838#endif 599#endif
839 auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan,
840 NUM_DESCRIPTORS);
841 auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan,
842 NUM_DESCRIPTORS);
843 600
844#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 601 /* setup dev_tab for tx channel */
845 hwif->dmatable_cpu = dma_alloc_coherent(auide->dev, 602 auide_init_dbdma_dev( &source_dev_tab,
846 PRD_ENTRIES * PRD_BYTES, /* 1 Page */ 603 (u32)DSCR_CMD0_ALWAYS,
847 &hwif->dmatable_dma, GFP_KERNEL); 604 8, 32, DEV_FLAGS_OUT | flags);
848 605 auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
849 auide->sg_table = kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES, 606
850 GFP_KERNEL|GFP_DMA); 607 auide_init_dbdma_dev( &source_dev_tab,
851 if (auide->sg_table == NULL) { 608 (u32)DSCR_CMD0_ALWAYS,
852 return -ENOMEM; 609 8, 32, DEV_FLAGS_IN | flags);
853 } 610 auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab );
854#endif 611
855 au1xxx_dbdma_start( auide->tx_chan ); 612 /* Get a channel for TX */
856 au1xxx_dbdma_start( auide->rx_chan ); 613 auide->tx_chan = au1xxx_dbdma_chan_alloc(DSCR_CMD0_ALWAYS,
857 return 0; 614 auide->tx_dev_id,
615 NULL,
616 (void*)auide);
617
618 /* Get a channel for RX */
619 auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id,
620 DSCR_CMD0_ALWAYS,
621 NULL,
622 (void*)auide);
623
624 auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan,
625 NUM_DESCRIPTORS);
626 auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan,
627 NUM_DESCRIPTORS);
628
629 au1xxx_dbdma_start( auide->tx_chan );
630 au1xxx_dbdma_start( auide->rx_chan );
631
632 return 0;
858} 633}
634#endif
859 635
860static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif) 636static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)
861{ 637{
862 int i; 638 int i;
863#define ide_ioreg_t unsigned long 639 unsigned long *ata_regs = hw->io_ports;
864 ide_ioreg_t *ata_regs = hw->io_ports; 640
865 641 /* FIXME? */
866 /* fixme */ 642 for (i = 0; i < IDE_CONTROL_OFFSET; i++) {
867 for (i = 0; i < IDE_CONTROL_OFFSET; i++) { 643 *ata_regs++ = ahwif->regbase + (i << AU1XXX_ATA_REG_OFFSET);
868 *ata_regs++ = (ide_ioreg_t) ahwif->regbase 644 }
869 + (ide_ioreg_t)(i << AU1XXX_ATA_REG_OFFSET); 645
870 } 646 /* set the Alternative Status register */
871 647 *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET);
872 /* set the Alternative Status register */
873 *ata_regs = (ide_ioreg_t) ahwif->regbase
874 + (ide_ioreg_t)(14 << AU1XXX_ATA_REG_OFFSET);
875} 648}
876 649
877static int au_ide_probe(struct device *dev) 650static int au_ide_probe(struct device *dev)
878{ 651{
879 struct platform_device *pdev = to_platform_device(dev); 652 struct platform_device *pdev = to_platform_device(dev);
880 _auide_hwif *ahwif = &auide_hwif; 653 _auide_hwif *ahwif = &auide_hwif;
881 ide_hwif_t *hwif; 654 ide_hwif_t *hwif;
882 struct resource *res; 655 struct resource *res;
883 int ret = 0; 656 int ret = 0;
884 657
885#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 658#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
886 char *mode = "MWDMA2"; 659 char *mode = "MWDMA2";
887#elif defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA) 660#elif defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)
888 char *mode = "PIO+DDMA(offload)"; 661 char *mode = "PIO+DDMA(offload)";
889#endif 662#endif
890 663
891 memset(&auide_hwif, 0, sizeof(_auide_hwif)); 664 memset(&auide_hwif, 0, sizeof(_auide_hwif));
892 auide_hwif.dev = 0; 665 auide_hwif.dev = 0;
893 666
894 ahwif->dev = dev; 667 ahwif->dev = dev;
895 ahwif->irq = platform_get_irq(pdev, 0); 668 ahwif->irq = platform_get_irq(pdev, 0);
@@ -902,11 +675,11 @@ static int au_ide_probe(struct device *dev)
902 goto out; 675 goto out;
903 } 676 }
904 677
905 if (!request_mem_region (res->start, res->end-res->start, pdev->name)) { 678 if (!request_mem_region (res->start, res->end-res->start, pdev->name)) {
906 pr_debug("%s: request_mem_region failed\n", DRV_NAME); 679 pr_debug("%s: request_mem_region failed\n", DRV_NAME);
907 ret = -EBUSY; 680 ret = -EBUSY;
908 goto out; 681 goto out;
909 } 682 }
910 683
911 ahwif->regbase = (u32)ioremap(res->start, res->end-res->start); 684 ahwif->regbase = (u32)ioremap(res->start, res->end-res->start);
912 if (ahwif->regbase == 0) { 685 if (ahwif->regbase == 0) {
@@ -914,130 +687,92 @@ static int au_ide_probe(struct device *dev)
914 goto out; 687 goto out;
915 } 688 }
916 689
917 hwif = &ide_hwifs[pdev->id]; 690 /* FIXME: This might possibly break PCMCIA IDE devices */
691
692 hwif = &ide_hwifs[pdev->id];
918 hw_regs_t *hw = &hwif->hw; 693 hw_regs_t *hw = &hwif->hw;
919 hwif->irq = hw->irq = ahwif->irq; 694 hwif->irq = hw->irq = ahwif->irq;
920 hwif->chipset = ide_au1xxx; 695 hwif->chipset = ide_au1xxx;
921 696
922 auide_setup_ports(hw, ahwif); 697 auide_setup_ports(hw, ahwif);
923 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); 698 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));
924 699
925#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ 700 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */
926 hwif->rqsize = CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ;
927 hwif->rqsize = ((hwif->rqsize > AU1XXX_ATA_RQSIZE)
928 || (hwif->rqsize < 32)) ? AU1XXX_ATA_RQSIZE : hwif->rqsize;
929#else /* if kernel config is not set */
930 hwif->rqsize = AU1XXX_ATA_RQSIZE;
931#endif
932
933 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */
934#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 701#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
935 hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */ 702 hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */
936 hwif->swdma_mask = 0x07; 703 hwif->swdma_mask = 0x00;
937#else 704#else
938 hwif->mwdma_mask = 0x0; 705 hwif->mwdma_mask = 0x0;
939 hwif->swdma_mask = 0x0; 706 hwif->swdma_mask = 0x0;
707#endif
708
709 hwif->noprobe = 0;
710 hwif->drives[0].unmask = 1;
711 hwif->drives[1].unmask = 1;
712
713 /* hold should be on in all cases */
714 hwif->hold = 1;
715 hwif->mmio = 2;
716
717 /* If the user has selected DDMA assisted copies,
718 then set up a few local I/O function entry points
719 */
720
721#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
722 hwif->INSW = auide_insw;
723 hwif->OUTSW = auide_outsw;
940#endif 724#endif
941 //hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; 725
942 hwif->noprobe = 0; 726 hwif->tuneproc = &auide_tune_drive;
943 hwif->drives[0].unmask = 1; 727 hwif->speedproc = &auide_tune_chipset;
944 hwif->drives[1].unmask = 1;
945
946 /* hold should be on in all cases */
947 hwif->hold = 1;
948 hwif->mmio = 2;
949
950 /* set up local I/O function entry points */
951 hwif->INB = auide_inb;
952 hwif->INW = auide_inw;
953 hwif->INL = auide_inl;
954 hwif->INSW = auide_insw;
955 hwif->INSL = auide_insl;
956 hwif->OUTB = auide_outb;
957 hwif->OUTBSYNC = auide_outbsync;
958 hwif->OUTW = auide_outw;
959 hwif->OUTL = auide_outl;
960 hwif->OUTSW = auide_outsw;
961 hwif->OUTSL = auide_outsl;
962
963 hwif->tuneproc = &auide_tune_drive;
964 hwif->speedproc = &auide_tune_chipset;
965 728
966#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 729#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
967 hwif->ide_dma_off_quietly = &auide_dma_off_quietly; 730 hwif->ide_dma_off_quietly = &auide_dma_off_quietly;
968 hwif->ide_dma_timeout = &auide_dma_timeout; 731 hwif->ide_dma_timeout = &auide_dma_timeout;
969 732
970 hwif->ide_dma_check = &auide_dma_check; 733 hwif->ide_dma_check = &auide_dma_check;
971 hwif->dma_exec_cmd = &auide_dma_exec_cmd; 734 hwif->dma_exec_cmd = &auide_dma_exec_cmd;
972 hwif->dma_start = &auide_dma_start; 735 hwif->dma_start = &auide_dma_start;
973 hwif->ide_dma_end = &auide_dma_end; 736 hwif->ide_dma_end = &auide_dma_end;
974 hwif->dma_setup = &auide_dma_setup; 737 hwif->dma_setup = &auide_dma_setup;
975 hwif->ide_dma_test_irq = &auide_dma_test_irq; 738 hwif->ide_dma_test_irq = &auide_dma_test_irq;
976 hwif->ide_dma_host_off = &auide_dma_host_off; 739 hwif->ide_dma_host_off = &auide_dma_host_off;
977 hwif->ide_dma_host_on = &auide_dma_host_on; 740 hwif->ide_dma_host_on = &auide_dma_host_on;
978 hwif->ide_dma_lostirq = &auide_dma_lostirq; 741 hwif->ide_dma_lostirq = &auide_dma_lostirq;
979 hwif->ide_dma_on = &auide_dma_on; 742 hwif->ide_dma_on = &auide_dma_on;
980 743
981 hwif->autodma = 1; 744 hwif->autodma = 1;
982 hwif->drives[0].autodma = hwif->autodma; 745 hwif->drives[0].autodma = hwif->autodma;
983 hwif->drives[1].autodma = hwif->autodma; 746 hwif->drives[1].autodma = hwif->autodma;
984 hwif->atapi_dma = 1; 747 hwif->atapi_dma = 1;
985 hwif->drives[0].using_dma = 1; 748
986 hwif->drives[1].using_dma = 1;
987#else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ 749#else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
988 hwif->autodma = 0; 750 hwif->autodma = 0;
989 hwif->channel = 0; 751 hwif->channel = 0;
990 hwif->hold = 1; 752 hwif->hold = 1;
991 hwif->select_data = 0; /* no chipset-specific code */ 753 hwif->select_data = 0; /* no chipset-specific code */
992 hwif->config_data = 0; /* no chipset-specific code */ 754 hwif->config_data = 0; /* no chipset-specific code */
993 755
994 hwif->drives[0].autodma = 0; 756 hwif->drives[0].autodma = 0;
995 hwif->drives[0].drive_data = 0; /* no drive data */ 757 hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */
996 hwif->drives[0].using_dma = 0;
997 hwif->drives[0].waiting_for_dma = 0;
998 hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */
999 /* secondary hdd not supported */
1000 hwif->drives[1].autodma = 0;
1001
1002 hwif->drives[1].drive_data = 0;
1003 hwif->drives[1].using_dma = 0;
1004 hwif->drives[1].waiting_for_dma = 0;
1005 hwif->drives[1].autotune = 2; /* 1=autotune, 2=noautotune, 0=default */
1006#endif
1007 hwif->drives[0].io_32bit = 0; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
1008 hwif->drives[1].io_32bit = 0; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
1009
1010 /*Register Driver with PM Framework*/
1011#ifdef CONFIG_PM
1012 auide_hwif.pm.lock = SPIN_LOCK_UNLOCKED;
1013 auide_hwif.pm.stopped = 0;
1014
1015 auide_hwif.pm.dev = new_au1xxx_power_device( "ide",
1016 &au1200ide_pm_callback,
1017 NULL);
1018 if ( auide_hwif.pm.dev == NULL )
1019 printk(KERN_INFO "Unable to create a power management \
1020 device entry for the au1200-IDE.\n");
1021 else
1022 printk(KERN_INFO "Power management device entry for the \
1023 au1200-IDE loaded.\n");
1024#endif 758#endif
759 hwif->drives[0].no_io_32bit = 1;
1025 760
1026 auide_hwif.hwif = hwif; 761 auide_hwif.hwif = hwif;
1027 hwif->hwif_data = &auide_hwif; 762 hwif->hwif_data = &auide_hwif;
1028 763
1029#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA 764#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
1030 auide_ddma_init(&auide_hwif); 765 auide_ddma_init(&auide_hwif);
1031 dbdma_init_done = 1; 766 dbdma_init_done = 1;
1032#endif 767#endif
1033 768
1034 probe_hwif_init(hwif); 769 probe_hwif_init(hwif);
1035 dev_set_drvdata(dev, hwif); 770 dev_set_drvdata(dev, hwif);
1036 771
1037 printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); 772 printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode );
1038 773
1039out: 774 out:
1040 return ret; 775 return ret;
1041} 776}
1042 777
1043static int au_ide_remove(struct device *dev) 778static int au_ide_remove(struct device *dev)
@@ -1045,7 +780,7 @@ static int au_ide_remove(struct device *dev)
1045 struct platform_device *pdev = to_platform_device(dev); 780 struct platform_device *pdev = to_platform_device(dev);
1046 struct resource *res; 781 struct resource *res;
1047 ide_hwif_t *hwif = dev_get_drvdata(dev); 782 ide_hwif_t *hwif = dev_get_drvdata(dev);
1048 _auide_hwif *ahwif = &auide_hwif; 783 _auide_hwif *ahwif = &auide_hwif;
1049 784
1050 ide_unregister(hwif - ide_hwifs); 785 ide_unregister(hwif - ide_hwifs);
1051 786
@@ -1069,180 +804,11 @@ static int __init au_ide_init(void)
1069 return driver_register(&au1200_ide_driver); 804 return driver_register(&au1200_ide_driver);
1070} 805}
1071 806
1072static void __init au_ide_exit(void) 807static void __exit au_ide_exit(void)
1073{ 808{
1074 driver_unregister(&au1200_ide_driver); 809 driver_unregister(&au1200_ide_driver);
1075} 810}
1076 811
1077#ifdef CONFIG_PM
1078int au1200ide_pm_callback( au1xxx_power_dev_t *dev,\
1079 au1xxx_request_t request, void *data) {
1080
1081 unsigned int d, err = 0;
1082 unsigned long flags;
1083
1084 spin_lock_irqsave(auide_hwif.pm.lock, flags);
1085
1086 switch (request){
1087 case AU1XXX_PM_SLEEP:
1088 err = au1xxxide_pm_sleep(dev);
1089 break;
1090 case AU1XXX_PM_WAKEUP:
1091 d = *((unsigned int*)data);
1092 if ( d > 0 && d <= 99) {
1093 err = au1xxxide_pm_standby(dev);
1094 }
1095 else {
1096 err = au1xxxide_pm_resume(dev);
1097 }
1098 break;
1099 case AU1XXX_PM_GETSTATUS:
1100 err = au1xxxide_pm_getstatus(dev);
1101 break;
1102 case AU1XXX_PM_ACCESS:
1103 err = au1xxxide_pm_access(dev);
1104 break;
1105 case AU1XXX_PM_IDLE:
1106 err = au1xxxide_pm_idle(dev);
1107 break;
1108 case AU1XXX_PM_CLEANUP:
1109 err = au1xxxide_pm_cleanup(dev);
1110 break;
1111 default:
1112 err = -1;
1113 break;
1114 }
1115
1116 spin_unlock_irqrestore(auide_hwif.pm.lock, flags);
1117
1118 return err;
1119}
1120
1121static int au1xxxide_pm_standby( au1xxx_power_dev_t *dev ) {
1122 return 0;
1123}
1124
1125static int au1xxxide_pm_sleep( au1xxx_power_dev_t *dev ) {
1126
1127 int retval;
1128 ide_hwif_t *hwif = auide_hwif.hwif;
1129 struct request rq;
1130 struct request_pm_state rqpm;
1131 ide_task_t args;
1132
1133 if(auide_hwif.pm.stopped)
1134 return -1;
1135
1136 /*
1137 * wait until hard disc is ready
1138 */
1139 if ( wait_for_ready(&hwif->drives[0], 35000) ) {
1140 printk("Wait for drive sleep timeout!\n");
1141 retval = -1;
1142 }
1143
1144 /*
1145 * sequenz to tell the high level ide driver that pm is resuming
1146 */
1147 memset(&rq, 0, sizeof(rq));
1148 memset(&rqpm, 0, sizeof(rqpm));
1149 memset(&args, 0, sizeof(args));
1150 rq.flags = REQ_PM_SUSPEND;
1151 rq.special = &args;
1152 rq.pm = &rqpm;
1153 rqpm.pm_step = ide_pm_state_start_suspend;
1154 rqpm.pm_state = PMSG_SUSPEND;
1155
1156 retval = ide_do_drive_cmd(&hwif->drives[0], &rq, ide_wait);
1157
1158 if (wait_for_ready (&hwif->drives[0], 35000)) {
1159 printk("Wait for drive sleep timeout!\n");
1160 retval = -1;
1161 }
1162
1163 /*
1164 * stop dbdma channels
1165 */
1166 au1xxx_dbdma_reset(auide_hwif.tx_chan);
1167 au1xxx_dbdma_reset(auide_hwif.rx_chan);
1168
1169 auide_hwif.pm.stopped = 1;
1170
1171 return retval;
1172}
1173
1174static int au1xxxide_pm_resume( au1xxx_power_dev_t *dev ) {
1175
1176 int retval;
1177 ide_hwif_t *hwif = auide_hwif.hwif;
1178 struct request rq;
1179 struct request_pm_state rqpm;
1180 ide_task_t args;
1181
1182 if(!auide_hwif.pm.stopped)
1183 return -1;
1184
1185 /*
1186 * start dbdma channels
1187 */
1188 au1xxx_dbdma_start(auide_hwif.tx_chan);
1189 au1xxx_dbdma_start(auide_hwif.rx_chan);
1190
1191 /*
1192 * wait until hard disc is ready
1193 */
1194 if (wait_for_ready ( &hwif->drives[0], 35000)) {
1195 printk("Wait for drive wake up timeout!\n");
1196 retval = -1;
1197 }
1198
1199 /*
1200 * sequenz to tell the high level ide driver that pm is resuming
1201 */
1202 memset(&rq, 0, sizeof(rq));
1203 memset(&rqpm, 0, sizeof(rqpm));
1204 memset(&args, 0, sizeof(args));
1205 rq.flags = REQ_PM_RESUME;
1206 rq.special = &args;
1207 rq.pm = &rqpm;
1208 rqpm.pm_step = ide_pm_state_start_resume;
1209 rqpm.pm_state = PMSG_ON;
1210
1211 retval = ide_do_drive_cmd(&hwif->drives[0], &rq, ide_head_wait);
1212
1213 /*
1214 * wait for hard disc
1215 */
1216 if ( wait_for_ready(&hwif->drives[0], 35000) ) {
1217 printk("Wait for drive wake up timeout!\n");
1218 retval = -1;
1219 }
1220
1221 auide_hwif.pm.stopped = 0;
1222
1223 return retval;
1224}
1225
1226static int au1xxxide_pm_getstatus( au1xxx_power_dev_t *dev ) {
1227 return dev->cur_state;
1228}
1229
1230static int au1xxxide_pm_access( au1xxx_power_dev_t *dev ) {
1231 if (dev->cur_state != AWAKE_STATE)
1232 return 0;
1233 else
1234 return -1;
1235}
1236
1237static int au1xxxide_pm_idle( au1xxx_power_dev_t *dev ) {
1238 return 0;
1239}
1240
1241static int au1xxxide_pm_cleanup( au1xxx_power_dev_t *dev ) {
1242 return 0;
1243}
1244#endif /* CONFIG_PM */
1245
1246MODULE_LICENSE("GPL"); 812MODULE_LICENSE("GPL");
1247MODULE_DESCRIPTION("AU1200 IDE driver"); 813MODULE_DESCRIPTION("AU1200 IDE driver");
1248 814
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index af526b671c4e..4ee597d08797 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -622,12 +622,18 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d)
622 ide_hwif_t *hwif; 622 ide_hwif_t *hwif;
623 int h; 623 int h;
624 624
625 /*
626 * Find an empty HWIF; if none available, return -ENOMEM.
627 */
625 for (h = 0; h < MAX_HWIFS; ++h) { 628 for (h = 0; h < MAX_HWIFS; ++h) {
626 hwif = &ide_hwifs[h]; 629 hwif = &ide_hwifs[h];
627 /* Find an empty HWIF */
628 if (hwif->chipset == ide_unknown) 630 if (hwif->chipset == ide_unknown)
629 break; 631 break;
630 } 632 }
633 if (h == MAX_HWIFS) {
634 printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n", d->name);
635 return -ENOMEM;
636 }
631 637
632 /* Get the CmdBlk and CtrlBlk Base Registers */ 638 /* Get the CmdBlk and CtrlBlk Base Registers */
633 base = pci_resource_start(dev, 0) + IOC4_CMD_OFFSET; 639 base = pci_resource_start(dev, 0) + IOC4_CMD_OFFSET;
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 7161ce0ef5aa..86fb1e0286d3 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -80,6 +80,7 @@ static struct via_isa_bridge {
80 u16 flags; 80 u16 flags;
81} via_isa_bridges[] = { 81} via_isa_bridges[] = {
82 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 82 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
83 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
83 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 84 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
84 { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 85 { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
85 { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 86 { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
diff --git a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h
index 38f42112dff0..ae9b02cc013f 100644
--- a/drivers/ieee1394/hosts.h
+++ b/drivers/ieee1394/hosts.h
@@ -41,6 +41,7 @@ struct hpsb_host {
41 /* this nodes state */ 41 /* this nodes state */
42 unsigned in_bus_reset:1; 42 unsigned in_bus_reset:1;
43 unsigned is_shutdown:1; 43 unsigned is_shutdown:1;
44 unsigned resume_packet_sent:1;
44 45
45 /* this nodes' duties on the bus */ 46 /* this nodes' duties on the bus */
46 unsigned is_root:1; 47 unsigned is_root:1;
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 7fff5a1d2ea4..0ea37b1bccb2 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -1349,6 +1349,33 @@ static void nodemgr_update_pdrv(struct node_entry *ne)
1349} 1349}
1350 1350
1351 1351
1352/* Write the BROADCAST_CHANNEL as per IEEE1394a 8.3.2.3.11 and 8.4.2.3. This
1353 * seems like an optional service but in the end it is practically mandatory
1354 * as a consequence of these clauses.
1355 *
1356 * Note that we cannot do a broadcast write to all nodes at once because some
1357 * pre-1394a devices would hang. */
1358static void nodemgr_irm_write_bc(struct node_entry *ne, int generation)
1359{
1360 const u64 bc_addr = (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL);
1361 quadlet_t bc_remote, bc_local;
1362 int ret;
1363
1364 if (!ne->host->is_irm || ne->generation != generation ||
1365 ne->nodeid == ne->host->node_id)
1366 return;
1367
1368 bc_local = cpu_to_be32(ne->host->csr.broadcast_channel);
1369
1370 /* Check if the register is implemented and 1394a compliant. */
1371 ret = hpsb_read(ne->host, ne->nodeid, generation, bc_addr, &bc_remote,
1372 sizeof(bc_remote));
1373 if (!ret && bc_remote & cpu_to_be32(0x80000000) &&
1374 bc_remote != bc_local)
1375 hpsb_node_write(ne, bc_addr, &bc_local, sizeof(bc_local));
1376}
1377
1378
1352static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int generation) 1379static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int generation)
1353{ 1380{
1354 struct device *dev; 1381 struct device *dev;
@@ -1360,6 +1387,8 @@ static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int ge
1360 if (!dev) 1387 if (!dev)
1361 return; 1388 return;
1362 1389
1390 nodemgr_irm_write_bc(ne, generation);
1391
1363 /* If "needs_probe", then this is either a new or changed node we 1392 /* If "needs_probe", then this is either a new or changed node we
1364 * rescan totally. If the generation matches for an existing node 1393 * rescan totally. If the generation matches for an existing node
1365 * (one that existed prior to the bus reset) we send update calls 1394 * (one that existed prior to the bus reset) we send update calls
@@ -1413,9 +1442,25 @@ static void nodemgr_node_probe(struct host_info *hi, int generation)
1413 return; 1442 return;
1414} 1443}
1415 1444
1416/* Because we are a 1394a-2000 compliant IRM, we need to inform all the other 1445static int nodemgr_send_resume_packet(struct hpsb_host *host)
1417 * nodes of the broadcast channel. (Really we're only setting the validity 1446{
1418 * bit). Other IRM responsibilities go in here as well. */ 1447 struct hpsb_packet *packet;
1448 int ret = 1;
1449
1450 packet = hpsb_make_phypacket(host,
1451 0x003c0000 | NODEID_TO_NODE(host->node_id) << 24);
1452 if (packet) {
1453 packet->no_waiter = 1;
1454 packet->generation = get_hpsb_generation(host);
1455 ret = hpsb_send_packet(packet);
1456 }
1457 if (ret)
1458 HPSB_WARN("fw-host%d: Failed to broadcast resume packet",
1459 host->id);
1460 return ret;
1461}
1462
1463/* Perform a few high-level IRM responsibilities. */
1419static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles) 1464static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles)
1420{ 1465{
1421 quadlet_t bc; 1466 quadlet_t bc;
@@ -1424,13 +1469,8 @@ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles)
1424 if (!host->is_irm || host->irm_id == (nodeid_t)-1) 1469 if (!host->is_irm || host->irm_id == (nodeid_t)-1)
1425 return 1; 1470 return 1;
1426 1471
1427 host->csr.broadcast_channel |= 0x40000000; /* set validity bit */ 1472 /* We are a 1394a-2000 compliant IRM. Set the validity bit. */
1428 1473 host->csr.broadcast_channel |= 0x40000000;
1429 bc = cpu_to_be32(host->csr.broadcast_channel);
1430
1431 hpsb_write(host, LOCAL_BUS | ALL_NODES, get_hpsb_generation(host),
1432 (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL),
1433 &bc, sizeof(quadlet_t));
1434 1474
1435 /* If there is no bus manager then we should set the root node's 1475 /* If there is no bus manager then we should set the root node's
1436 * force_root bit to promote bus stability per the 1394 1476 * force_root bit to promote bus stability per the 1394
@@ -1463,6 +1503,13 @@ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles)
1463 } 1503 }
1464 } 1504 }
1465 1505
1506 /* Some devices suspend their ports while being connected to an inactive
1507 * host adapter, i.e. if connected before the low-level driver is
1508 * loaded. They become visible either when physically unplugged and
1509 * replugged, or when receiving a resume packet. Send one once. */
1510 if (!host->resume_packet_sent && !nodemgr_send_resume_packet(host))
1511 host->resume_packet_sent = 1;
1512
1466 return 1; 1513 return 1;
1467} 1514}
1468 1515
diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c
index 99a642d2a1fe..1849b176cf18 100644
--- a/drivers/input/joystick/warrior.c
+++ b/drivers/input/joystick/warrior.c
@@ -172,7 +172,7 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv)
172 input_set_abs_params(input_dev, ABS_Y, -64, 64, 0, 8); 172 input_set_abs_params(input_dev, ABS_Y, -64, 64, 0, 8);
173 input_set_abs_params(input_dev, ABS_THROTTLE, -112, 112, 0, 0); 173 input_set_abs_params(input_dev, ABS_THROTTLE, -112, 112, 0, 0);
174 input_set_abs_params(input_dev, ABS_HAT0X, -1, 1, 0, 0); 174 input_set_abs_params(input_dev, ABS_HAT0X, -1, 1, 0, 0);
175 input_set_abs_params(input_dev, ABS_HAT0X, -1, 1, 0, 0); 175 input_set_abs_params(input_dev, ABS_HAT0Y, -1, 1, 0, 0);
176 176
177 serio_set_drvdata(serio, warrior); 177 serio_set_drvdata(serio, warrior);
178 178
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 07813fc0523f..e08dbe08f46d 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -26,7 +26,7 @@ config INPUT_PCSPKR
26 26
27config INPUT_SPARCSPKR 27config INPUT_SPARCSPKR
28 tristate "SPARC Speaker support" 28 tristate "SPARC Speaker support"
29 depends on PCI && (SPARC32 || SPARC64) 29 depends on PCI && SPARC
30 help 30 help
31 Say Y here if you want the standard Speaker on Sparc PCI systems 31 Say Y here if you want the standard Speaker on Sparc PCI systems
32 to be used for bells and whistles. 32 to be used for bells and whistles.
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 49d0416a2a9a..bac3085185fe 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -320,7 +320,7 @@ static struct dmi_system_id dmi_ids[] = {
320 }, 320 },
321 .driver_data = keymap_acer_aspire_1500 321 .driver_data = keymap_acer_aspire_1500
322 }, 322 },
323 { 0, } 323 { NULL, }
324}; 324};
325 325
326static int __init select_keymap(void) 326static int __init select_keymap(void)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 4acc7fd4cd0f..4f41ec3e4332 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -42,7 +42,7 @@ static struct alps_model_info alps_model_data[] = {
42 { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, 42 { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 },
43 { { 0x63, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, 43 { { 0x63, 0x02, 0x0a }, 0xf8, 0xf8, 0 },
44 { { 0x63, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, 44 { { 0x63, 0x02, 0x14 }, 0xf8, 0xf8, 0 },
45 { { 0x63, 0x02, 0x28 }, 0xf8, 0xf8, 0 }, 45 { { 0x63, 0x02, 0x28 }, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Fujitsu Siemens S6010 */
46 { { 0x63, 0x02, 0x3c }, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */ 46 { { 0x63, 0x02, 0x3c }, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */
47 { { 0x63, 0x02, 0x50 }, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */ 47 { { 0x63, 0x02, 0x50 }, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */
48 { { 0x63, 0x02, 0x64 }, 0xf8, 0xf8, 0 }, 48 { { 0x63, 0x02, 0x64 }, 0xf8, 0xf8, 0 },
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
index 4bf584364d28..2f9a04ae725f 100644
--- a/drivers/input/mouse/sermouse.c
+++ b/drivers/input/mouse/sermouse.c
@@ -95,7 +95,7 @@ static void sermouse_process_msc(struct sermouse *sermouse, signed char data, st
95 95
96 input_sync(dev); 96 input_sync(dev);
97 97
98 if (++sermouse->count == (5 - ((sermouse->type == SERIO_SUN) << 1))) 98 if (++sermouse->count == 5)
99 sermouse->count = 0; 99 sermouse->count = 0;
100} 100}
101 101
diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
index 13835039a2a7..cbbf3842da5b 100644
--- a/drivers/input/serio/i8042.h
+++ b/drivers/input/serio/i8042.h
@@ -21,7 +21,7 @@
21#include "i8042-ip22io.h" 21#include "i8042-ip22io.h"
22#elif defined(CONFIG_PPC) 22#elif defined(CONFIG_PPC)
23#include "i8042-ppcio.h" 23#include "i8042-ppcio.h"
24#elif defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) 24#elif defined(CONFIG_SPARC)
25#include "i8042-sparcio.h" 25#include "i8042-sparcio.h"
26#elif defined(CONFIG_X86) || defined(CONFIG_IA64) 26#elif defined(CONFIG_X86) || defined(CONFIG_IA64)
27#include "i8042-x86ia64io.h" 27#include "i8042-x86ia64io.h"
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index 3fc8cdd94c3d..190878eef990 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -923,7 +923,7 @@ static void do_monitor_cpu_combined(void)
923 if (temp_combi >= ((state0->mpu.tmax + 8) << 16)) { 923 if (temp_combi >= ((state0->mpu.tmax + 8) << 16)) {
924 printk(KERN_WARNING "Warning ! Temperature way above maximum (%d) !\n", 924 printk(KERN_WARNING "Warning ! Temperature way above maximum (%d) !\n",
925 temp_combi >> 16); 925 temp_combi >> 16);
926 state0->overtemp = CPU_MAX_OVERTEMP; 926 state0->overtemp += CPU_MAX_OVERTEMP / 4;
927 } else if (temp_combi > (state0->mpu.tmax << 16)) 927 } else if (temp_combi > (state0->mpu.tmax << 16))
928 state0->overtemp++; 928 state0->overtemp++;
929 else 929 else
@@ -933,7 +933,7 @@ static void do_monitor_cpu_combined(void)
933 if (state0->overtemp > 0) { 933 if (state0->overtemp > 0) {
934 state0->rpm = state0->mpu.rmaxn_exhaust_fan; 934 state0->rpm = state0->mpu.rmaxn_exhaust_fan;
935 state0->intake_rpm = intake = state0->mpu.rmaxn_intake_fan; 935 state0->intake_rpm = intake = state0->mpu.rmaxn_intake_fan;
936 pump = state0->pump_min; 936 pump = state0->pump_max;
937 goto do_set_fans; 937 goto do_set_fans;
938 } 938 }
939 939
@@ -998,7 +998,7 @@ static void do_monitor_cpu_split(struct cpu_pid_state *state)
998 printk(KERN_WARNING "Warning ! CPU %d temperature way above maximum" 998 printk(KERN_WARNING "Warning ! CPU %d temperature way above maximum"
999 " (%d) !\n", 999 " (%d) !\n",
1000 state->index, temp >> 16); 1000 state->index, temp >> 16);
1001 state->overtemp = CPU_MAX_OVERTEMP; 1001 state->overtemp += CPU_MAX_OVERTEMP / 4;
1002 } else if (temp > (state->mpu.tmax << 16)) 1002 } else if (temp > (state->mpu.tmax << 16))
1003 state->overtemp++; 1003 state->overtemp++;
1004 else 1004 else
@@ -1060,7 +1060,7 @@ static void do_monitor_cpu_rack(struct cpu_pid_state *state)
1060 printk(KERN_WARNING "Warning ! CPU %d temperature way above maximum" 1060 printk(KERN_WARNING "Warning ! CPU %d temperature way above maximum"
1061 " (%d) !\n", 1061 " (%d) !\n",
1062 state->index, temp >> 16); 1062 state->index, temp >> 16);
1063 state->overtemp = CPU_MAX_OVERTEMP; 1063 state->overtemp = CPU_MAX_OVERTEMP / 4;
1064 } else if (temp > (state->mpu.tmax << 16)) 1064 } else if (temp > (state->mpu.tmax << 16))
1065 state->overtemp++; 1065 state->overtemp++;
1066 else 1066 else
diff --git a/drivers/md/md.c b/drivers/md/md.c
index cd12fca73b0d..8175a2a222da 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1729,7 +1729,7 @@ level_show(mddev_t *mddev, char *page)
1729 if (p == NULL && mddev->raid_disks == 0) 1729 if (p == NULL && mddev->raid_disks == 0)
1730 return 0; 1730 return 0;
1731 if (mddev->level >= 0) 1731 if (mddev->level >= 0)
1732 return sprintf(page, "RAID-%d\n", mddev->level); 1732 return sprintf(page, "raid%d\n", mddev->level);
1733 else 1733 else
1734 return sprintf(page, "%s\n", p->name); 1734 return sprintf(page, "%s\n", p->name);
1735} 1735}
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c
index e6541aff3996..2239651969c8 100644
--- a/drivers/media/dvb/bt8xx/dst_ca.c
+++ b/drivers/media/dvb/bt8xx/dst_ca.c
@@ -406,7 +406,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message,
406 } 406 }
407 dprintk(verbose, DST_CA_DEBUG, 1, " "); 407 dprintk(verbose, DST_CA_DEBUG, 1, " ");
408 408
409 if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) { 409 if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg))) {
410 result = -EFAULT; 410 result = -EFAULT;
411 goto free_mem_and_exit; 411 goto free_mem_and_exit;
412 } 412 }
@@ -579,7 +579,7 @@ static int dst_ca_release(struct inode *inode, struct file *file)
579 return 0; 579 return 0;
580} 580}
581 581
582static int dst_ca_read(struct file *file, char __user *buffer, size_t length, loff_t *offset) 582static ssize_t dst_ca_read(struct file *file, char __user *buffer, size_t length, loff_t *offset)
583{ 583{
584 int bytes_read = 0; 584 int bytes_read = 0;
585 585
@@ -588,7 +588,7 @@ static int dst_ca_read(struct file *file, char __user *buffer, size_t length, lo
588 return bytes_read; 588 return bytes_read;
589} 589}
590 590
591static int dst_ca_write(struct file *file, const char __user *buffer, size_t length, loff_t *offset) 591static ssize_t dst_ca_write(struct file *file, const char __user *buffer, size_t length, loff_t *offset)
592{ 592{
593 dprintk(verbose, DST_CA_DEBUG, 1, " Device write."); 593 dprintk(verbose, DST_CA_DEBUG, 1, " Device write.");
594 594
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 992be0be6b1e..7dae91e5863c 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -176,6 +176,9 @@ static void init_av7110_av(struct av7110 *av7110)
176 } 176 }
177 } 177 }
178 178
179 if (dev->pci->subsystem_vendor == 0x13c2 && dev->pci->subsystem_device == 0x000e)
180 av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, SpdifSwitch, 1, 0); // SPDIF on
181
179 ret = av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); 182 ret = av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right);
180 if (ret < 0) 183 if (ret < 0)
181 printk("dvb-ttpci:cannot set volume :%d\n",ret); 184 printk("dvb-ttpci:cannot set volume :%d\n",ret);
diff --git a/drivers/media/dvb/ttpci/av7110_hw.h b/drivers/media/dvb/ttpci/av7110_hw.h
index fedd20f9815d..2a5e87ba1052 100644
--- a/drivers/media/dvb/ttpci/av7110_hw.h
+++ b/drivers/media/dvb/ttpci/av7110_hw.h
@@ -143,7 +143,8 @@ enum av7110_audio_command {
143 MainSwitch, 143 MainSwitch,
144 ADSwitch, 144 ADSwitch,
145 SendDiSEqC, 145 SendDiSEqC,
146 SetRegister 146 SetRegister,
147 SpdifSwitch
147}; 148};
148 149
149enum av7110_request_command { 150enum av7110_request_command {
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index aea3f038cff6..5b93723a1768 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -333,24 +333,30 @@ static int set_input(struct i2c_client *client, enum cx25840_input input)
333 333
334static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) 334static int set_v4lstd(struct i2c_client *client, v4l2_std_id std)
335{ 335{
336 u8 fmt; 336 u8 fmt=0; /* zero is autodetect */
337 337
338 switch (std) { 338 /* First tests should be against specific std */
339 /* zero is autodetect */ 339 if (std & V4L2_STD_NTSC_M_JP) {
340 case 0: fmt = 0x0; break; 340 fmt=0x2;
341 /* default ntsc to ntsc-m */ 341 } else if (std & V4L2_STD_NTSC_443) {
342 case V4L2_STD_NTSC: 342 fmt=0x3;
343 case V4L2_STD_NTSC_M: fmt = 0x1; break; 343 } else if (std & V4L2_STD_PAL_M) {
344 case V4L2_STD_NTSC_M_JP: fmt = 0x2; break; 344 fmt=0x5;
345 case V4L2_STD_NTSC_443: fmt = 0x3; break; 345 } else if (std & V4L2_STD_PAL_N) {
346 case V4L2_STD_PAL: fmt = 0x4; break; 346 fmt=0x6;
347 case V4L2_STD_PAL_M: fmt = 0x5; break; 347 } else if (std & V4L2_STD_PAL_Nc) {
348 case V4L2_STD_PAL_N: fmt = 0x6; break; 348 fmt=0x7;
349 case V4L2_STD_PAL_Nc: fmt = 0x7; break; 349 } else if (std & V4L2_STD_PAL_60) {
350 case V4L2_STD_PAL_60: fmt = 0x8; break; 350 fmt=0x8;
351 case V4L2_STD_SECAM: fmt = 0xc; break; 351 } else {
352 default: 352 /* Then, test against generic ones */
353 return -ERANGE; 353 if (std & V4L2_STD_NTSC) {
354 fmt=0x1;
355 } else if (std & V4L2_STD_PAL) {
356 fmt=0x4;
357 } else if (std & V4L2_STD_SECAM) {
358 fmt=0xc;
359 }
354 } 360 }
355 361
356 cx25840_and_or(client, 0x400, ~0xf, fmt); 362 cx25840_and_or(client, 0x400, ~0xf, fmt);
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index e8a1c2247567..0cfe75416ec6 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -39,7 +39,7 @@ MODULE_PARM_DESC(core_debug,"enable debug messages [core]");
39#define em28xx_coredbg(fmt, arg...) do {\ 39#define em28xx_coredbg(fmt, arg...) do {\
40 if (core_debug) \ 40 if (core_debug) \
41 printk(KERN_INFO "%s %s :"fmt, \ 41 printk(KERN_INFO "%s %s :"fmt, \
42 dev->name, __FUNCTION__, ##arg); } while (0) 42 dev->name, __FUNCTION__ , ##arg); } while (0)
43 43
44static unsigned int reg_debug; 44static unsigned int reg_debug;
45module_param(reg_debug,int,0644); 45module_param(reg_debug,int,0644);
@@ -48,7 +48,7 @@ MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]");
48#define em28xx_regdbg(fmt, arg...) do {\ 48#define em28xx_regdbg(fmt, arg...) do {\
49 if (reg_debug) \ 49 if (reg_debug) \
50 printk(KERN_INFO "%s %s :"fmt, \ 50 printk(KERN_INFO "%s %s :"fmt, \
51 dev->name, __FUNCTION__, ##arg); } while (0) 51 dev->name, __FUNCTION__ , ##arg); } while (0)
52 52
53static unsigned int isoc_debug; 53static unsigned int isoc_debug;
54module_param(isoc_debug,int,0644); 54module_param(isoc_debug,int,0644);
@@ -57,7 +57,7 @@ MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]");
57#define em28xx_isocdbg(fmt, arg...) do {\ 57#define em28xx_isocdbg(fmt, arg...) do {\
58 if (isoc_debug) \ 58 if (isoc_debug) \
59 printk(KERN_INFO "%s %s :"fmt, \ 59 printk(KERN_INFO "%s %s :"fmt, \
60 dev->name, __FUNCTION__, ##arg); } while (0) 60 dev->name, __FUNCTION__ , ##arg); } while (0)
61 61
62static int alt = EM28XX_PINOUT; 62static int alt = EM28XX_PINOUT;
63module_param(alt, int, 0644); 63module_param(alt, int, 0644);
@@ -126,7 +126,7 @@ u32 em28xx_request_buffers(struct em28xx *dev, u32 count)
126 const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ 126 const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */
127 void *buff = NULL; 127 void *buff = NULL;
128 u32 i; 128 u32 i;
129 em28xx_coredbg("requested %i buffers with size %i", count, imagesize); 129 em28xx_coredbg("requested %i buffers with size %zd", count, imagesize);
130 if (count > EM28XX_NUM_FRAMES) 130 if (count > EM28XX_NUM_FRAMES)
131 count = EM28XX_NUM_FRAMES; 131 count = EM28XX_NUM_FRAMES;
132 132
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 29e21ad187cc..7f5603054f02 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -44,7 +44,7 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
44 printk(fmt, ##args); } while (0) 44 printk(fmt, ##args); } while (0)
45#define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \ 45#define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \
46 printk(KERN_DEBUG "%s at %s: " fmt, \ 46 printk(KERN_DEBUG "%s at %s: " fmt, \
47 dev->name, __FUNCTION__, ##args); } while (0) 47 dev->name, __FUNCTION__ , ##args); } while (0)
48 48
49/* 49/*
50 * em2800_i2c_send_max4() 50 * em2800_i2c_send_max4()
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 8ecaa0803e08..06d76879bde2 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -45,7 +45,7 @@
45#define em28xx_videodbg(fmt, arg...) do {\ 45#define em28xx_videodbg(fmt, arg...) do {\
46 if (video_debug) \ 46 if (video_debug) \
47 printk(KERN_INFO "%s %s :"fmt, \ 47 printk(KERN_INFO "%s %s :"fmt, \
48 dev->name, __FUNCTION__, ##arg); } while (0) 48 dev->name, __FUNCTION__ , ##arg); } while (0)
49 49
50MODULE_AUTHOR(DRIVER_AUTHOR); 50MODULE_AUTHOR(DRIVER_AUTHOR);
51MODULE_DESCRIPTION(DRIVER_DESC); 51MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 1e2ee43db394..5c7a41ce69f3 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -392,18 +392,18 @@ extern const unsigned int em28xx_bcount;
392/* printk macros */ 392/* printk macros */
393 393
394#define em28xx_err(fmt, arg...) do {\ 394#define em28xx_err(fmt, arg...) do {\
395 printk(KERN_ERR fmt, ##arg); } while (0) 395 printk(KERN_ERR fmt , ##arg); } while (0)
396 396
397#define em28xx_errdev(fmt, arg...) do {\ 397#define em28xx_errdev(fmt, arg...) do {\
398 printk(KERN_ERR "%s: "fmt,\ 398 printk(KERN_ERR "%s: "fmt,\
399 dev->name, ##arg); } while (0) 399 dev->name , ##arg); } while (0)
400 400
401#define em28xx_info(fmt, arg...) do {\ 401#define em28xx_info(fmt, arg...) do {\
402 printk(KERN_INFO "%s: "fmt,\ 402 printk(KERN_INFO "%s: "fmt,\
403 dev->name, ##arg); } while (0) 403 dev->name , ##arg); } while (0)
404#define em28xx_warn(fmt, arg...) do {\ 404#define em28xx_warn(fmt, arg...) do {\
405 printk(KERN_WARNING "%s: "fmt,\ 405 printk(KERN_WARNING "%s: "fmt,\
406 dev->name, ##arg); } while (0) 406 dev->name , ##arg); } while (0)
407 407
408inline static int em28xx_audio_source(struct em28xx *dev, int input) 408inline static int em28xx_audio_source(struct em28xx *dev, int input)
409{ 409{
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index 3428e1ed0032..c36f014f1fdf 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -389,7 +389,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat
389static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data *data) 389static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data *data)
390{ 390{
391 struct saa7127_state *state = i2c_get_clientdata(client); 391 struct saa7127_state *state = i2c_get_clientdata(client);
392 u16 cc = data->data[0] << 8 | data->data[1]; 392 u16 cc = data->data[1] << 8 | data->data[0];
393 int enable = (data->line != 0); 393 int enable = (data->line != 0);
394 394
395 if (enable && (data->field != 0 || data->line != 21)) 395 if (enable && (data->field != 0 || data->line != 21))
@@ -397,7 +397,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
397 if (state->cc_enable != enable) { 397 if (state->cc_enable != enable) {
398 saa7127_dbg("Turn CC %s\n", enable ? "on" : "off"); 398 saa7127_dbg("Turn CC %s\n", enable ? "on" : "off");
399 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, 399 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
400 (enable << 6) | 0x11); 400 (state->xds_enable << 7) | (enable << 6) | 0x11);
401 state->cc_enable = enable; 401 state->cc_enable = enable;
402 } 402 }
403 if (!enable) 403 if (!enable)
@@ -423,7 +423,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat
423 if (state->xds_enable != enable) { 423 if (state->xds_enable != enable) {
424 saa7127_dbg("Turn XDS %s\n", enable ? "on" : "off"); 424 saa7127_dbg("Turn XDS %s\n", enable ? "on" : "off");
425 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, 425 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
426 (enable << 7) | 0x11); 426 (enable << 7) | (state->cc_enable << 6) | 0x11);
427 state->xds_enable = enable; 427 state->xds_enable = enable;
428 } 428 }
429 if (!enable) 429 if (!enable)
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index c512c4411b38..8a5c3e71b37d 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -1,11 +1,10 @@
1config VIDEO_SAA7134 1config VIDEO_SAA7134
2 tristate "Philips SAA7134 support" 2 tristate "Philips SAA7134 support"
3 depends on VIDEO_DEV && PCI && I2C && SOUND && SND 3 depends on VIDEO_DEV && PCI && I2C
4 select VIDEO_BUF 4 select VIDEO_BUF
5 select VIDEO_IR 5 select VIDEO_IR
6 select VIDEO_TUNER 6 select VIDEO_TUNER
7 select CRC32 7 select CRC32
8 select SND_PCM_OSS
9 ---help--- 8 ---help---
10 This is a video4linux driver for Philips SAA713x based 9 This is a video4linux driver for Philips SAA713x based
11 TV cards. 10 TV cards.
@@ -13,6 +12,29 @@ config VIDEO_SAA7134
13 To compile this driver as a module, choose M here: the 12 To compile this driver as a module, choose M here: the
14 module will be called saa7134. 13 module will be called saa7134.
15 14
15config VIDEO_SAA7134_ALSA
16 tristate "Philips SAA7134 DMA audio support"
17 depends on VIDEO_SAA7134 && SND
18 select SND_PCM_OSS
19 ---help---
20 This is a video4linux driver for direct (DMA) audio in
21 Philips SAA713x based TV cards using ALSA
22
23 To compile this driver as a module, choose M here: the
24 module will be called saa7134-alsa.
25
26config VIDEO_SAA7134_OSS
27 tristate "Philips SAA7134 DMA audio support (OSS, DEPRECATED)"
28 depends on VIDEO_SAA7134 && SOUND_PRIME && !VIDEO_SAA7134_ALSA
29 ---help---
30 This is a video4linux driver for direct (DMA) audio in
31 Philips SAA713x based TV cards using OSS
32
33 This is deprecated in favor of the ALSA module
34
35 To compile this driver as a module, choose M here: the
36 module will be called saa7134-oss.
37
16config VIDEO_SAA7134_DVB 38config VIDEO_SAA7134_DVB
17 tristate "DVB/ATSC Support for saa7134 based TV cards" 39 tristate "DVB/ATSC Support for saa7134 based TV cards"
18 depends on VIDEO_SAA7134 && DVB_CORE 40 depends on VIDEO_SAA7134 && DVB_CORE
diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile
index 134f83a96218..1ba998424bbd 100644
--- a/drivers/media/video/saa7134/Makefile
+++ b/drivers/media/video/saa7134/Makefile
@@ -4,8 +4,11 @@ saa7134-objs := saa7134-cards.o saa7134-core.o saa7134-i2c.o \
4 saa7134-video.o saa7134-input.o 4 saa7134-video.o saa7134-input.o
5 5
6obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o \ 6obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o \
7 saa6752hs.o saa7134-alsa.o \ 7 saa6752hs.o
8 saa7134-oss.o 8
9obj-$(CONFIG_VIDEO_SAA7134_ALSA) += saa7134-alsa.o
10obj-$(CONFIG_VIDEO_SAA7134_OSS) += saa7134-oss.o
11
9obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o 12obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o
10 13
11EXTRA_CFLAGS += -I$(src)/.. 14EXTRA_CFLAGS += -I$(src)/..
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index b24a26b065c2..ade05f75fdb0 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -60,7 +60,7 @@ module_param_array(index, int, NULL, 0444);
60MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); 60MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s).");
61 61
62#define dprintk(fmt, arg...) if (debug) \ 62#define dprintk(fmt, arg...) if (debug) \
63 printk(KERN_DEBUG "%s/alsa: " fmt, dev->name, ## arg) 63 printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ##arg)
64 64
65 65
66 66
@@ -989,6 +989,14 @@ static int saa7134_alsa_init(void)
989 struct saa7134_dev *dev = NULL; 989 struct saa7134_dev *dev = NULL;
990 struct list_head *list; 990 struct list_head *list;
991 991
992 if (!dmasound_init && !dmasound_exit) {
993 dmasound_init = alsa_device_init;
994 dmasound_exit = alsa_device_exit;
995 } else {
996 printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n");
997 return -EBUSY;
998 }
999
992 printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); 1000 printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n");
993 1001
994 list_for_each(list,&saa7134_devlist) { 1002 list_for_each(list,&saa7134_devlist) {
@@ -1001,9 +1009,6 @@ static int saa7134_alsa_init(void)
1001 } 1009 }
1002 } 1010 }
1003 1011
1004 dmasound_init = alsa_device_init;
1005 dmasound_exit = alsa_device_exit;
1006
1007 if (dev == NULL) 1012 if (dev == NULL)
1008 printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); 1013 printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n");
1009 1014
@@ -1023,12 +1028,15 @@ static void saa7134_alsa_exit(void)
1023 snd_card_free(snd_saa7134_cards[idx]); 1028 snd_card_free(snd_saa7134_cards[idx]);
1024 } 1029 }
1025 1030
1031 dmasound_init = NULL;
1032 dmasound_exit = NULL;
1026 printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); 1033 printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n");
1027 1034
1028 return; 1035 return;
1029} 1036}
1030 1037
1031module_init(saa7134_alsa_init); 1038/* We initialize this late, to make sure the sound system is up and running */
1039late_initcall(saa7134_alsa_init);
1032module_exit(saa7134_alsa_exit); 1040module_exit(saa7134_alsa_exit);
1033MODULE_LICENSE("GPL"); 1041MODULE_LICENSE("GPL");
1034MODULE_AUTHOR("Ricardo Cerqueira"); 1042MODULE_AUTHOR("Ricardo Cerqueira");
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 513a699a6df2..8badd2a9cb2f 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -959,8 +959,17 @@ static int saa7134_oss_init(void)
959 struct saa7134_dev *dev = NULL; 959 struct saa7134_dev *dev = NULL;
960 struct list_head *list; 960 struct list_head *list;
961 961
962 if (!dmasound_init && !dmasound_exit) {
963 dmasound_init = oss_device_init;
964 dmasound_exit = oss_device_exit;
965 } else {
966 printk(KERN_WARNING "saa7134 OSS: can't load, DMA sound handler already assigned (probably to ALSA)\n");
967 return -EBUSY;
968 }
969
962 printk(KERN_INFO "saa7134 OSS driver for DMA sound loaded\n"); 970 printk(KERN_INFO "saa7134 OSS driver for DMA sound loaded\n");
963 971
972
964 list_for_each(list,&saa7134_devlist) { 973 list_for_each(list,&saa7134_devlist) {
965 dev = list_entry(list, struct saa7134_dev, devlist); 974 dev = list_entry(list, struct saa7134_dev, devlist);
966 if (dev->dmasound.priv_data == NULL) { 975 if (dev->dmasound.priv_data == NULL) {
@@ -974,9 +983,6 @@ static int saa7134_oss_init(void)
974 if (dev == NULL) 983 if (dev == NULL)
975 printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n"); 984 printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n");
976 985
977 dmasound_init = oss_device_init;
978 dmasound_exit = oss_device_exit;
979
980 return 0; 986 return 0;
981 987
982} 988}
@@ -997,12 +1003,16 @@ static void saa7134_oss_exit(void)
997 1003
998 } 1004 }
999 1005
1006 dmasound_init = NULL;
1007 dmasound_exit = NULL;
1008
1000 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); 1009 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n");
1001 1010
1002 return; 1011 return;
1003} 1012}
1004 1013
1005module_init(saa7134_oss_init); 1014/* We initialize this late, to make sure the sound system is up and running */
1015late_initcall(saa7134_oss_init);
1006module_exit(saa7134_oss_exit); 1016module_exit(saa7134_oss_exit);
1007MODULE_LICENSE("GPL"); 1017MODULE_LICENSE("GPL");
1008MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 1018MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index cd7cf1bd12b4..5ac235365dd8 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -206,7 +206,7 @@ hauppauge_tuner[] =
206 { TUNER_ABSENT, "TCL 2002MI_3H"}, 206 { TUNER_ABSENT, "TCL 2002MI_3H"},
207 { TUNER_TCL_2002N, "TCL 2002N 5H"}, 207 { TUNER_TCL_2002N, "TCL 2002N 5H"},
208 /* 100-109 */ 208 /* 100-109 */
209 { TUNER_ABSENT, "Philips FMD1216ME"}, 209 { TUNER_PHILIPS_FMD1216ME_MK3, "Philips FMD1216ME"},
210 { TUNER_TEA5767, "Philips TEA5768HL FM Radio"}, 210 { TUNER_TEA5767, "Philips TEA5768HL FM Radio"},
211 { TUNER_ABSENT, "Panasonic ENV57H12D5"}, 211 { TUNER_ABSENT, "Panasonic ENV57H12D5"},
212 { TUNER_PHILIPS_FM1236_MK3, "TCL MFNM05-4"}, 212 { TUNER_PHILIPS_FM1236_MK3, "TCL MFNM05-4"},
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
index 81ef306cb124..ee7075fa1ec3 100644
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -303,6 +303,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
303 struct i2o_controller *c; 303 struct i2o_controller *c;
304 int rc; 304 int rc;
305 struct pci_dev *i960 = NULL; 305 struct pci_dev *i960 = NULL;
306 int pci_dev_busy = 0;
306 307
307 printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n"); 308 printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n");
308 309
@@ -395,6 +396,8 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
395 if ((rc = i2o_pci_alloc(c))) { 396 if ((rc = i2o_pci_alloc(c))) {
396 printk(KERN_ERR "%s: DMA / IO allocation for I2O controller " 397 printk(KERN_ERR "%s: DMA / IO allocation for I2O controller "
397 " failed\n", c->name); 398 " failed\n", c->name);
399 if (rc == -ENODEV)
400 pci_dev_busy = 1;
398 goto free_controller; 401 goto free_controller;
399 } 402 }
400 403
@@ -425,7 +428,8 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
425 i2o_iop_free(c); 428 i2o_iop_free(c);
426 429
427 disable: 430 disable:
428 pci_disable_device(pdev); 431 if (!pci_dev_busy)
432 pci_disable_device(pdev);
429 433
430 return rc; 434 return rc;
431} 435}
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b586a83a9b4c..eb41391e06e9 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -679,7 +679,15 @@ static void mmc_idle_cards(struct mmc_host *host)
679} 679}
680 680
681/* 681/*
682 * Apply power to the MMC stack. 682 * Apply power to the MMC stack. This is a two-stage process.
683 * First, we enable power to the card without the clock running.
684 * We then wait a bit for the power to stabilise. Finally,
685 * enable the bus drivers and clock to the card.
686 *
687 * We must _NOT_ enable the clock prior to power stablising.
688 *
689 * If a host does all the power sequencing itself, ignore the
690 * initial MMC_POWER_UP stage.
683 */ 691 */
684static void mmc_power_up(struct mmc_host *host) 692static void mmc_power_up(struct mmc_host *host)
685{ 693{
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index d91fcf7c3178..abcf19116d70 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -359,7 +359,12 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
359 md->block_bits = card->csd.read_blkbits; 359 md->block_bits = card->csd.read_blkbits;
360 360
361 blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits); 361 blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
362 set_capacity(md->disk, card->csd.capacity); 362
363 /*
364 * The CSD capacity field is in units of read_blkbits.
365 * set_capacity takes units of 512 bytes.
366 */
367 set_capacity(md->disk, card->csd.capacity << (card->csd.read_blkbits - 9));
363 } 368 }
364 out: 369 out:
365 return md; 370 return md;
@@ -373,7 +378,7 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
373 378
374 mmc_card_claim_host(card); 379 mmc_card_claim_host(card);
375 cmd.opcode = MMC_SET_BLOCKLEN; 380 cmd.opcode = MMC_SET_BLOCKLEN;
376 cmd.arg = 1 << card->csd.read_blkbits; 381 cmd.arg = 1 << md->block_bits;
377 cmd.flags = MMC_RSP_R1; 382 cmd.flags = MMC_RSP_R1;
378 err = mmc_wait_for_cmd(card->host, &cmd, 5); 383 err = mmc_wait_for_cmd(card->host, &cmd, 5);
379 mmc_card_release_host(card); 384 mmc_card_release_host(card);
@@ -412,10 +417,9 @@ static int mmc_blk_probe(struct mmc_card *card)
412 if (err) 417 if (err)
413 goto out; 418 goto out;
414 419
415 printk(KERN_INFO "%s: %s %s %dKiB %s\n", 420 printk(KERN_INFO "%s: %s %s %luKiB %s\n",
416 md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), 421 md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
417 (card->csd.capacity << card->csd.read_blkbits) / 1024, 422 get_capacity(md->disk) >> 1, mmc_blk_readonly(card)?"(ro)":"");
418 mmc_blk_readonly(card)?"(ro)":"");
419 423
420 mmc_set_drvdata(card, md); 424 mmc_set_drvdata(card, md);
421 add_disk(md->disk); 425 add_disk(md->disk);
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 452ccd5037c3..b9b77cf39a18 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -62,7 +62,7 @@ config MTD_PHYSMAP_BANKWIDTH
62 62
63config MTD_SUN_UFLASH 63config MTD_SUN_UFLASH
64 tristate "Sun Microsystems userflash support" 64 tristate "Sun Microsystems userflash support"
65 depends on (SPARC32 || SPARC64) && MTD_CFI 65 depends on SPARC && MTD_CFI
66 help 66 help
67 This provides a 'mapping' driver which supports the way in 67 This provides a 'mapping' driver which supports the way in
68 which user-programmable flash chips are connected on various 68 which user-programmable flash chips are connected on various
diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c
index 48cce431f89f..45c077d0f063 100644
--- a/drivers/mtd/onenand/generic.c
+++ b/drivers/mtd/onenand/generic.c
@@ -12,9 +12,9 @@
12 * This is a device driver for the OneNAND flash for generic boards. 12 * This is a device driver for the OneNAND flash for generic boards.
13 */ 13 */
14 14
15#include <linux/device.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/onenand.h> 19#include <linux/mtd/onenand.h>
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
@@ -39,7 +39,7 @@ static int __devinit generic_onenand_probe(struct device *dev)
39{ 39{
40 struct onenand_info *info; 40 struct onenand_info *info;
41 struct platform_device *pdev = to_platform_device(dev); 41 struct platform_device *pdev = to_platform_device(dev);
42 struct onenand_platform_data *pdata = pdev->dev.platform_data; 42 struct flash_platform_data *pdata = pdev->dev.platform_data;
43 struct resource *res = pdev->resource; 43 struct resource *res = pdev->resource;
44 unsigned long size = res->end - res->start + 1; 44 unsigned long size = res->end - res->start + 1;
45 int err; 45 int err;
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index f67d5d6eb9a6..a53a73fc2a5a 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -940,7 +940,7 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
940 u_char *eccbuf, struct nand_oobinfo *oobsel) 940 u_char *eccbuf, struct nand_oobinfo *oobsel)
941{ 941{
942 struct onenand_chip *this = mtd->priv; 942 struct onenand_chip *this = mtd->priv;
943 unsigned char buffer[MAX_ONENAND_PAGESIZE], *pbuf; 943 unsigned char *pbuf;
944 size_t total_len, len; 944 size_t total_len, len;
945 int i, written = 0; 945 int i, written = 0;
946 int ret = 0; 946 int ret = 0;
@@ -975,7 +975,7 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
975 /* Loop until all keve's data has been written */ 975 /* Loop until all keve's data has been written */
976 len = 0; 976 len = 0;
977 while (count) { 977 while (count) {
978 pbuf = buffer; 978 pbuf = this->page_buf;
979 /* 979 /*
980 * If the given tuple is >= pagesize then 980 * If the given tuple is >= pagesize then
981 * write it out from the iov 981 * write it out from the iov
@@ -995,7 +995,7 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
995 int cnt = 0, thislen; 995 int cnt = 0, thislen;
996 while (cnt < mtd->oobblock) { 996 while (cnt < mtd->oobblock) {
997 thislen = min_t(int, mtd->oobblock - cnt, vecs->iov_len - len); 997 thislen = min_t(int, mtd->oobblock - cnt, vecs->iov_len - len);
998 memcpy(buffer + cnt, vecs->iov_base + len, thislen); 998 memcpy(this->page_buf + cnt, vecs->iov_base + len, thislen);
999 cnt += thislen; 999 cnt += thislen;
1000 len += thislen; 1000 len += thislen;
1001 1001
@@ -1296,6 +1296,12 @@ static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
1296 1296
1297 /* Block lock scheme */ 1297 /* Block lock scheme */
1298 for (block = start; block < end; block++) { 1298 for (block = start; block < end; block++) {
1299 /* Set block address */
1300 value = onenand_block_address(this, block);
1301 this->write_word(value, this->base + ONENAND_REG_START_ADDRESS1);
1302 /* Select DataRAM for DDP */
1303 value = onenand_bufferram_address(this, block);
1304 this->write_word(value, this->base + ONENAND_REG_START_ADDRESS2);
1299 /* Set start block address */ 1305 /* Set start block address */
1300 this->write_word(block, this->base + ONENAND_REG_START_BLOCK_ADDRESS); 1306 this->write_word(block, this->base + ONENAND_REG_START_BLOCK_ADDRESS);
1301 /* Write unlock command */ 1307 /* Write unlock command */
@@ -1309,10 +1315,6 @@ static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
1309 & ONENAND_CTRL_ONGO) 1315 & ONENAND_CTRL_ONGO)
1310 continue; 1316 continue;
1311 1317
1312 /* Set block address for read block status */
1313 value = onenand_block_address(this, block);
1314 this->write_word(value, this->base + ONENAND_REG_START_ADDRESS1);
1315
1316 /* Check lock status */ 1318 /* Check lock status */
1317 status = this->read_word(this->base + ONENAND_REG_WP_STATUS); 1319 status = this->read_word(this->base + ONENAND_REG_WP_STATUS);
1318 if (!(status & ONENAND_WP_US)) 1320 if (!(status & ONENAND_WP_US))
@@ -1346,7 +1348,6 @@ static void onenand_print_device_info(int device)
1346 1348
1347static const struct onenand_manufacturers onenand_manuf_ids[] = { 1349static const struct onenand_manufacturers onenand_manuf_ids[] = {
1348 {ONENAND_MFR_SAMSUNG, "Samsung"}, 1350 {ONENAND_MFR_SAMSUNG, "Samsung"},
1349 {ONENAND_MFR_UNKNOWN, "Unknown"}
1350}; 1351};
1351 1352
1352/** 1353/**
@@ -1357,17 +1358,22 @@ static const struct onenand_manufacturers onenand_manuf_ids[] = {
1357 */ 1358 */
1358static int onenand_check_maf(int manuf) 1359static int onenand_check_maf(int manuf)
1359{ 1360{
1361 int size = ARRAY_SIZE(onenand_manuf_ids);
1362 char *name;
1360 int i; 1363 int i;
1361 1364
1362 for (i = 0; onenand_manuf_ids[i].id; i++) { 1365 for (i = 0; i < size; i++)
1363 if (manuf == onenand_manuf_ids[i].id) 1366 if (manuf == onenand_manuf_ids[i].id)
1364 break; 1367 break;
1365 }
1366 1368
1367 printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", 1369 if (i < size)
1368 onenand_manuf_ids[i].name, manuf); 1370 name = onenand_manuf_ids[i].name;
1371 else
1372 name = "Unknown";
1373
1374 printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", name, manuf);
1369 1375
1370 return (i != ONENAND_MFR_UNKNOWN); 1376 return (i == size);
1371} 1377}
1372 1378
1373/** 1379/**
@@ -1513,6 +1519,18 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
1513 this->read_bufferram = onenand_sync_read_bufferram; 1519 this->read_bufferram = onenand_sync_read_bufferram;
1514 } 1520 }
1515 1521
1522 /* Allocate buffers, if necessary */
1523 if (!this->page_buf) {
1524 size_t len;
1525 len = mtd->oobblock + mtd->oobsize;
1526 this->page_buf = kmalloc(len, GFP_KERNEL);
1527 if (!this->page_buf) {
1528 printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n");
1529 return -ENOMEM;
1530 }
1531 this->options |= ONENAND_PAGEBUF_ALLOC;
1532 }
1533
1516 this->state = FL_READY; 1534 this->state = FL_READY;
1517 init_waitqueue_head(&this->wq); 1535 init_waitqueue_head(&this->wq);
1518 spin_lock_init(&this->chip_lock); 1536 spin_lock_init(&this->chip_lock);
@@ -1574,12 +1592,21 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
1574 */ 1592 */
1575void onenand_release(struct mtd_info *mtd) 1593void onenand_release(struct mtd_info *mtd)
1576{ 1594{
1595 struct onenand_chip *this = mtd->priv;
1596
1577#ifdef CONFIG_MTD_PARTITIONS 1597#ifdef CONFIG_MTD_PARTITIONS
1578 /* Deregister partitions */ 1598 /* Deregister partitions */
1579 del_mtd_partitions (mtd); 1599 del_mtd_partitions (mtd);
1580#endif 1600#endif
1581 /* Deregister the device */ 1601 /* Deregister the device */
1582 del_mtd_device (mtd); 1602 del_mtd_device (mtd);
1603
1604 /* Free bad block table memory, if allocated */
1605 if (this->bbm)
1606 kfree(this->bbm);
1607 /* Buffer allocated by onenand_scan */
1608 if (this->options & ONENAND_PAGEBUF_ALLOC)
1609 kfree(this->page_buf);
1583} 1610}
1584 1611
1585EXPORT_SYMBOL_GPL(onenand_scan); 1612EXPORT_SYMBOL_GPL(onenand_scan);
diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c
index f40190f499e1..4510d3361eaa 100644
--- a/drivers/mtd/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
@@ -118,10 +118,10 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
118 */ 118 */
119static inline int onenand_memory_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd) 119static inline int onenand_memory_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd)
120{ 120{
121 unsigned char data_buf[MAX_ONENAND_PAGESIZE]; 121 struct onenand_chip *this = mtd->priv;
122 122
123 bd->options &= ~NAND_BBT_SCANEMPTY; 123 bd->options &= ~NAND_BBT_SCANEMPTY;
124 return create_bbt(mtd, data_buf, bd, -1); 124 return create_bbt(mtd, this->page_buf, bd, -1);
125} 125}
126 126
127/** 127/**
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 525624fc03b4..c39344adecce 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -10,7 +10,7 @@
10 * trademarks of NVIDIA Corporation in the United States and other 10 * trademarks of NVIDIA Corporation in the United States and other
11 * countries. 11 * countries.
12 * 12 *
13 * Copyright (C) 2003,4 Manfred Spraul 13 * Copyright (C) 2003,4,5 Manfred Spraul
14 * Copyright (C) 2004 Andrew de Quincey (wol support) 14 * Copyright (C) 2004 Andrew de Quincey (wol support)
15 * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane 15 * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane
16 * IRQ rate fixes, bigendian fixes, cleanups, verification) 16 * IRQ rate fixes, bigendian fixes, cleanups, verification)
@@ -100,6 +100,7 @@
100 * 0.45: 18 Sep 2005: Remove nv_stop/start_rx from every link check 100 * 0.45: 18 Sep 2005: Remove nv_stop/start_rx from every link check
101 * 0.46: 20 Oct 2005: Add irq optimization modes. 101 * 0.46: 20 Oct 2005: Add irq optimization modes.
102 * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. 102 * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan.
103 * 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single
103 * 104 *
104 * Known bugs: 105 * Known bugs:
105 * We suspect that on some hardware no TX done interrupts are generated. 106 * We suspect that on some hardware no TX done interrupts are generated.
@@ -111,7 +112,7 @@
111 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few 112 * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few
112 * superfluous timer interrupts from the nic. 113 * superfluous timer interrupts from the nic.
113 */ 114 */
114#define FORCEDETH_VERSION "0.47" 115#define FORCEDETH_VERSION "0.48"
115#define DRV_NAME "forcedeth" 116#define DRV_NAME "forcedeth"
116 117
117#include <linux/module.h> 118#include <linux/module.h>
@@ -871,8 +872,8 @@ static int nv_alloc_rx(struct net_device *dev)
871 } else { 872 } else {
872 skb = np->rx_skbuff[nr]; 873 skb = np->rx_skbuff[nr];
873 } 874 }
874 np->rx_dma[nr] = pci_map_single(np->pci_dev, skb->data, skb->len, 875 np->rx_dma[nr] = pci_map_single(np->pci_dev, skb->data,
875 PCI_DMA_FROMDEVICE); 876 skb->end-skb->data, PCI_DMA_FROMDEVICE);
876 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { 877 if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) {
877 np->rx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->rx_dma[nr]); 878 np->rx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->rx_dma[nr]);
878 wmb(); 879 wmb();
@@ -999,7 +1000,7 @@ static void nv_drain_rx(struct net_device *dev)
999 wmb(); 1000 wmb();
1000 if (np->rx_skbuff[i]) { 1001 if (np->rx_skbuff[i]) {
1001 pci_unmap_single(np->pci_dev, np->rx_dma[i], 1002 pci_unmap_single(np->pci_dev, np->rx_dma[i],
1002 np->rx_skbuff[i]->len, 1003 np->rx_skbuff[i]->end-np->rx_skbuff[i]->data,
1003 PCI_DMA_FROMDEVICE); 1004 PCI_DMA_FROMDEVICE);
1004 dev_kfree_skb(np->rx_skbuff[i]); 1005 dev_kfree_skb(np->rx_skbuff[i]);
1005 np->rx_skbuff[i] = NULL; 1006 np->rx_skbuff[i] = NULL;
@@ -1334,7 +1335,7 @@ static void nv_rx_process(struct net_device *dev)
1334 * the performance. 1335 * the performance.
1335 */ 1336 */
1336 pci_unmap_single(np->pci_dev, np->rx_dma[i], 1337 pci_unmap_single(np->pci_dev, np->rx_dma[i],
1337 np->rx_skbuff[i]->len, 1338 np->rx_skbuff[i]->end-np->rx_skbuff[i]->data,
1338 PCI_DMA_FROMDEVICE); 1339 PCI_DMA_FROMDEVICE);
1339 1340
1340 { 1341 {
@@ -2455,7 +2456,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
2455 np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; 2456 np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
2456 dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; 2457 dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
2457#ifdef NETIF_F_TSO 2458#ifdef NETIF_F_TSO
2458 dev->features |= NETIF_F_TSO; 2459 /* disabled dev->features |= NETIF_F_TSO; */
2459#endif 2460#endif
2460 } 2461 }
2461 2462
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 16bebe7a7ce1..7da0e3dd5fe3 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -38,6 +38,10 @@
38#include <asm/irq.h> 38#include <asm/irq.h>
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40 40
41MODULE_DESCRIPTION("PHY library");
42MODULE_AUTHOR("Andy Fleming");
43MODULE_LICENSE("GPL");
44
41static struct phy_driver genphy_driver; 45static struct phy_driver genphy_driver;
42extern int mdio_bus_init(void); 46extern int mdio_bus_init(void);
43extern void mdio_bus_exit(void); 47extern void mdio_bus_exit(void);
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 50430f79f8cf..1c6d328165bb 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -524,9 +524,6 @@ static int get_filter(void __user *arg, struct sock_filter **p)
524 if (copy_from_user(&uprog, arg, sizeof(uprog))) 524 if (copy_from_user(&uprog, arg, sizeof(uprog)))
525 return -EFAULT; 525 return -EFAULT;
526 526
527 if (uprog.len > BPF_MAXINSNS)
528 return -EINVAL;
529
530 if (!uprog.len) { 527 if (!uprog.len) {
531 *p = NULL; 528 *p = NULL;
532 return 0; 529 return 0;
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index e57df8dfe6b4..669dd52c412a 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -3078,7 +3078,7 @@ int s2io_set_swapper(nic_t * sp)
3078 3078
3079static int wait_for_msix_trans(nic_t *nic, int i) 3079static int wait_for_msix_trans(nic_t *nic, int i)
3080{ 3080{
3081 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3081 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3082 u64 val64; 3082 u64 val64;
3083 int ret = 0, cnt = 0; 3083 int ret = 0, cnt = 0;
3084 3084
@@ -3099,7 +3099,7 @@ static int wait_for_msix_trans(nic_t *nic, int i)
3099 3099
3100void restore_xmsi_data(nic_t *nic) 3100void restore_xmsi_data(nic_t *nic)
3101{ 3101{
3102 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3102 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3103 u64 val64; 3103 u64 val64;
3104 int i; 3104 int i;
3105 3105
@@ -3117,7 +3117,7 @@ void restore_xmsi_data(nic_t *nic)
3117 3117
3118static void store_xmsi_data(nic_t *nic) 3118static void store_xmsi_data(nic_t *nic)
3119{ 3119{
3120 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3120 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3121 u64 val64, addr, data; 3121 u64 val64, addr, data;
3122 int i; 3122 int i;
3123 3123
@@ -3140,7 +3140,7 @@ static void store_xmsi_data(nic_t *nic)
3140 3140
3141int s2io_enable_msi(nic_t *nic) 3141int s2io_enable_msi(nic_t *nic)
3142{ 3142{
3143 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3143 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3144 u16 msi_ctrl, msg_val; 3144 u16 msi_ctrl, msg_val;
3145 struct config_param *config = &nic->config; 3145 struct config_param *config = &nic->config;
3146 struct net_device *dev = nic->dev; 3146 struct net_device *dev = nic->dev;
@@ -3190,7 +3190,7 @@ int s2io_enable_msi(nic_t *nic)
3190 3190
3191int s2io_enable_msi_x(nic_t *nic) 3191int s2io_enable_msi_x(nic_t *nic)
3192{ 3192{
3193 XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; 3193 XENA_dev_config_t __iomem *bar0 = nic->bar0;
3194 u64 tx_mat, rx_mat; 3194 u64 tx_mat, rx_mat;
3195 u16 msi_control; /* Temp variable */ 3195 u16 msi_control; /* Temp variable */
3196 int ret, i, j, msix_indx = 1; 3196 int ret, i, j, msix_indx = 1;
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 081717d01374..28ce47a02408 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2907,7 +2907,7 @@ static int __devinit gem_get_device_address(struct gem *gp)
2907 return 0; 2907 return 0;
2908} 2908}
2909 2909
2910static void __devexit gem_remove_one(struct pci_dev *pdev) 2910static void gem_remove_one(struct pci_dev *pdev)
2911{ 2911{
2912 struct net_device *dev = pci_get_drvdata(pdev); 2912 struct net_device *dev = pci_get_drvdata(pdev);
2913 2913
@@ -3181,7 +3181,7 @@ static struct pci_driver gem_driver = {
3181 .name = GEM_MODULE_NAME, 3181 .name = GEM_MODULE_NAME,
3182 .id_table = gem_pci_tbl, 3182 .id_table = gem_pci_tbl,
3183 .probe = gem_init_one, 3183 .probe = gem_init_one,
3184 .remove = __devexit_p(gem_remove_one), 3184 .remove = gem_remove_one,
3185#ifdef CONFIG_PM 3185#ifdef CONFIG_PM
3186 .suspend = gem_suspend, 3186 .suspend = gem_suspend,
3187 .resume = gem_resume, 3187 .resume = gem_resume,
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 47bd4a394420..2fc9893d69e1 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -68,8 +68,8 @@
68 68
69#define DRV_MODULE_NAME "tg3" 69#define DRV_MODULE_NAME "tg3"
70#define PFX DRV_MODULE_NAME ": " 70#define PFX DRV_MODULE_NAME ": "
71#define DRV_MODULE_VERSION "3.44" 71#define DRV_MODULE_VERSION "3.47"
72#define DRV_MODULE_RELDATE "Dec 6, 2005" 72#define DRV_MODULE_RELDATE "Dec 28, 2005"
73 73
74#define TG3_DEF_MAC_MODE 0 74#define TG3_DEF_MAC_MODE 0
75#define TG3_DEF_RX_MODE 0 75#define TG3_DEF_RX_MODE 0
@@ -341,6 +341,16 @@ static struct {
341 { "interrupt test (offline)" }, 341 { "interrupt test (offline)" },
342}; 342};
343 343
344static void tg3_write32(struct tg3 *tp, u32 off, u32 val)
345{
346 writel(val, tp->regs + off);
347}
348
349static u32 tg3_read32(struct tg3 *tp, u32 off)
350{
351 return (readl(tp->regs + off));
352}
353
344static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) 354static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
345{ 355{
346 unsigned long flags; 356 unsigned long flags;
@@ -411,13 +421,29 @@ static u32 tg3_read_indirect_mbox(struct tg3 *tp, u32 off)
411 return val; 421 return val;
412} 422}
413 423
414static void _tw32_flush(struct tg3 *tp, u32 off, u32 val) 424/* usec_wait specifies the wait time in usec when writing to certain registers
425 * where it is unsafe to read back the register without some delay.
426 * GRC_LOCAL_CTRL is one example if the GPIOs are toggled to switch power.
427 * TG3PCI_CLOCK_CTRL is another example if the clock frequencies are changed.
428 */
429static void _tw32_flush(struct tg3 *tp, u32 off, u32 val, u32 usec_wait)
415{ 430{
416 tp->write32(tp, off, val); 431 if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) ||
417 if (!(tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) && 432 (tp->tg3_flags2 & TG3_FLG2_ICH_WORKAROUND))
418 !(tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) && 433 /* Non-posted methods */
419 !(tp->tg3_flags2 & TG3_FLG2_ICH_WORKAROUND)) 434 tp->write32(tp, off, val);
420 tp->read32(tp, off); /* flush */ 435 else {
436 /* Posted method */
437 tg3_write32(tp, off, val);
438 if (usec_wait)
439 udelay(usec_wait);
440 tp->read32(tp, off);
441 }
442 /* Wait again after the read for the posted method to guarantee that
443 * the wait time is met.
444 */
445 if (usec_wait)
446 udelay(usec_wait);
421} 447}
422 448
423static inline void tw32_mailbox_flush(struct tg3 *tp, u32 off, u32 val) 449static inline void tw32_mailbox_flush(struct tg3 *tp, u32 off, u32 val)
@@ -438,16 +464,6 @@ static void tg3_write32_tx_mbox(struct tg3 *tp, u32 off, u32 val)
438 readl(mbox); 464 readl(mbox);
439} 465}
440 466
441static void tg3_write32(struct tg3 *tp, u32 off, u32 val)
442{
443 writel(val, tp->regs + off);
444}
445
446static u32 tg3_read32(struct tg3 *tp, u32 off)
447{
448 return (readl(tp->regs + off));
449}
450
451#define tw32_mailbox(reg, val) tp->write32_mbox(tp, reg, val) 467#define tw32_mailbox(reg, val) tp->write32_mbox(tp, reg, val)
452#define tw32_mailbox_f(reg, val) tw32_mailbox_flush(tp, (reg), (val)) 468#define tw32_mailbox_f(reg, val) tw32_mailbox_flush(tp, (reg), (val))
453#define tw32_rx_mbox(reg, val) tp->write32_rx_mbox(tp, reg, val) 469#define tw32_rx_mbox(reg, val) tp->write32_rx_mbox(tp, reg, val)
@@ -455,7 +471,8 @@ static u32 tg3_read32(struct tg3 *tp, u32 off)
455#define tr32_mailbox(reg) tp->read32_mbox(tp, reg) 471#define tr32_mailbox(reg) tp->read32_mbox(tp, reg)
456 472
457#define tw32(reg,val) tp->write32(tp, reg, val) 473#define tw32(reg,val) tp->write32(tp, reg, val)
458#define tw32_f(reg,val) _tw32_flush(tp,(reg),(val)) 474#define tw32_f(reg,val) _tw32_flush(tp,(reg),(val), 0)
475#define tw32_wait_f(reg,val,us) _tw32_flush(tp,(reg),(val), (us))
459#define tr32(reg) tp->read32(tp, reg) 476#define tr32(reg) tp->read32(tp, reg)
460 477
461static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) 478static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
@@ -595,21 +612,19 @@ static void tg3_switch_clocks(struct tg3 *tp)
595 612
596 if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { 613 if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) {
597 if (orig_clock_ctrl & CLOCK_CTRL_625_CORE) { 614 if (orig_clock_ctrl & CLOCK_CTRL_625_CORE) {
598 tw32_f(TG3PCI_CLOCK_CTRL, 615 tw32_wait_f(TG3PCI_CLOCK_CTRL,
599 clock_ctrl | CLOCK_CTRL_625_CORE); 616 clock_ctrl | CLOCK_CTRL_625_CORE, 40);
600 udelay(40);
601 } 617 }
602 } else if ((orig_clock_ctrl & CLOCK_CTRL_44MHZ_CORE) != 0) { 618 } else if ((orig_clock_ctrl & CLOCK_CTRL_44MHZ_CORE) != 0) {
603 tw32_f(TG3PCI_CLOCK_CTRL, 619 tw32_wait_f(TG3PCI_CLOCK_CTRL,
604 clock_ctrl | 620 clock_ctrl |
605 (CLOCK_CTRL_44MHZ_CORE | CLOCK_CTRL_ALTCLK)); 621 (CLOCK_CTRL_44MHZ_CORE | CLOCK_CTRL_ALTCLK),
606 udelay(40); 622 40);
607 tw32_f(TG3PCI_CLOCK_CTRL, 623 tw32_wait_f(TG3PCI_CLOCK_CTRL,
608 clock_ctrl | (CLOCK_CTRL_ALTCLK)); 624 clock_ctrl | (CLOCK_CTRL_ALTCLK),
609 udelay(40); 625 40);
610 } 626 }
611 tw32_f(TG3PCI_CLOCK_CTRL, clock_ctrl); 627 tw32_wait_f(TG3PCI_CLOCK_CTRL, clock_ctrl, 40);
612 udelay(40);
613} 628}
614 629
615#define PHY_BUSY_LOOPS 5000 630#define PHY_BUSY_LOOPS 5000
@@ -1017,37 +1032,50 @@ static void tg3_frob_aux_power(struct tg3 *tp)
1017 if ((tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) != 0) 1032 if ((tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) != 0)
1018 return; 1033 return;
1019 1034
1020 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { 1035 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
1021 tp_peer = pci_get_drvdata(tp->pdev_peer); 1036 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) {
1022 if (!tp_peer) 1037 struct net_device *dev_peer;
1038
1039 dev_peer = pci_get_drvdata(tp->pdev_peer);
1040 if (!dev_peer)
1023 BUG(); 1041 BUG();
1042 tp_peer = netdev_priv(dev_peer);
1024 } 1043 }
1025 1044
1026
1027 if ((tp->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 || 1045 if ((tp->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 ||
1028 (tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0) { 1046 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0 ||
1047 (tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 ||
1048 (tp_peer->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0) {
1029 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || 1049 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
1030 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) { 1050 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
1031 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 1051 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
1032 (GRC_LCLCTRL_GPIO_OE0 | 1052 (GRC_LCLCTRL_GPIO_OE0 |
1033 GRC_LCLCTRL_GPIO_OE1 | 1053 GRC_LCLCTRL_GPIO_OE1 |
1034 GRC_LCLCTRL_GPIO_OE2 | 1054 GRC_LCLCTRL_GPIO_OE2 |
1035 GRC_LCLCTRL_GPIO_OUTPUT0 | 1055 GRC_LCLCTRL_GPIO_OUTPUT0 |
1036 GRC_LCLCTRL_GPIO_OUTPUT1)); 1056 GRC_LCLCTRL_GPIO_OUTPUT1),
1037 udelay(100); 1057 100);
1038 } else { 1058 } else {
1039 u32 no_gpio2; 1059 u32 no_gpio2;
1040 u32 grc_local_ctrl; 1060 u32 grc_local_ctrl = 0;
1041 1061
1042 if (tp_peer != tp && 1062 if (tp_peer != tp &&
1043 (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0) 1063 (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0)
1044 return; 1064 return;
1045 1065
1066 /* Workaround to prevent overdrawing Amps. */
1067 if (GET_ASIC_REV(tp->pci_chip_rev_id) ==
1068 ASIC_REV_5714) {
1069 grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE3;
1070 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
1071 grc_local_ctrl, 100);
1072 }
1073
1046 /* On 5753 and variants, GPIO2 cannot be used. */ 1074 /* On 5753 and variants, GPIO2 cannot be used. */
1047 no_gpio2 = tp->nic_sram_data_cfg & 1075 no_gpio2 = tp->nic_sram_data_cfg &
1048 NIC_SRAM_DATA_CFG_NO_GPIO2; 1076 NIC_SRAM_DATA_CFG_NO_GPIO2;
1049 1077
1050 grc_local_ctrl = GRC_LCLCTRL_GPIO_OE0 | 1078 grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE0 |
1051 GRC_LCLCTRL_GPIO_OE1 | 1079 GRC_LCLCTRL_GPIO_OE1 |
1052 GRC_LCLCTRL_GPIO_OE2 | 1080 GRC_LCLCTRL_GPIO_OE2 |
1053 GRC_LCLCTRL_GPIO_OUTPUT1 | 1081 GRC_LCLCTRL_GPIO_OUTPUT1 |
@@ -1056,21 +1084,18 @@ static void tg3_frob_aux_power(struct tg3 *tp)
1056 grc_local_ctrl &= ~(GRC_LCLCTRL_GPIO_OE2 | 1084 grc_local_ctrl &= ~(GRC_LCLCTRL_GPIO_OE2 |
1057 GRC_LCLCTRL_GPIO_OUTPUT2); 1085 GRC_LCLCTRL_GPIO_OUTPUT2);
1058 } 1086 }
1059 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 1087 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
1060 grc_local_ctrl); 1088 grc_local_ctrl, 100);
1061 udelay(100);
1062 1089
1063 grc_local_ctrl |= GRC_LCLCTRL_GPIO_OUTPUT0; 1090 grc_local_ctrl |= GRC_LCLCTRL_GPIO_OUTPUT0;
1064 1091
1065 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 1092 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
1066 grc_local_ctrl); 1093 grc_local_ctrl, 100);
1067 udelay(100);
1068 1094
1069 if (!no_gpio2) { 1095 if (!no_gpio2) {
1070 grc_local_ctrl &= ~GRC_LCLCTRL_GPIO_OUTPUT2; 1096 grc_local_ctrl &= ~GRC_LCLCTRL_GPIO_OUTPUT2;
1071 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 1097 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
1072 grc_local_ctrl); 1098 grc_local_ctrl, 100);
1073 udelay(100);
1074 } 1099 }
1075 } 1100 }
1076 } else { 1101 } else {
@@ -1080,19 +1105,16 @@ static void tg3_frob_aux_power(struct tg3 *tp)
1080 (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0) 1105 (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0)
1081 return; 1106 return;
1082 1107
1083 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 1108 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
1084 (GRC_LCLCTRL_GPIO_OE1 | 1109 (GRC_LCLCTRL_GPIO_OE1 |
1085 GRC_LCLCTRL_GPIO_OUTPUT1)); 1110 GRC_LCLCTRL_GPIO_OUTPUT1), 100);
1086 udelay(100);
1087 1111
1088 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 1112 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
1089 (GRC_LCLCTRL_GPIO_OE1)); 1113 GRC_LCLCTRL_GPIO_OE1, 100);
1090 udelay(100);
1091 1114
1092 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | 1115 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl |
1093 (GRC_LCLCTRL_GPIO_OE1 | 1116 (GRC_LCLCTRL_GPIO_OE1 |
1094 GRC_LCLCTRL_GPIO_OUTPUT1)); 1117 GRC_LCLCTRL_GPIO_OUTPUT1), 100);
1095 udelay(100);
1096 } 1118 }
1097 } 1119 }
1098} 1120}
@@ -1105,6 +1127,8 @@ static int tg3_setup_phy(struct tg3 *, int);
1105 1127
1106static void tg3_write_sig_post_reset(struct tg3 *, int); 1128static void tg3_write_sig_post_reset(struct tg3 *, int);
1107static int tg3_halt_cpu(struct tg3 *, u32); 1129static int tg3_halt_cpu(struct tg3 *, u32);
1130static int tg3_nvram_lock(struct tg3 *);
1131static void tg3_nvram_unlock(struct tg3 *);
1108 1132
1109static int tg3_set_power_state(struct tg3 *tp, int state) 1133static int tg3_set_power_state(struct tg3 *tp, int state)
1110{ 1134{
@@ -1133,10 +1157,8 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1133 udelay(100); /* Delay after power state change */ 1157 udelay(100); /* Delay after power state change */
1134 1158
1135 /* Switch out of Vaux if it is not a LOM */ 1159 /* Switch out of Vaux if it is not a LOM */
1136 if (!(tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT)) { 1160 if (!(tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT))
1137 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl); 1161 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl, 100);
1138 udelay(100);
1139 }
1140 1162
1141 return 0; 1163 return 0;
1142 1164
@@ -1179,6 +1201,21 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1179 tg3_setup_phy(tp, 0); 1201 tg3_setup_phy(tp, 0);
1180 } 1202 }
1181 1203
1204 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
1205 int i;
1206 u32 val;
1207
1208 for (i = 0; i < 200; i++) {
1209 tg3_read_mem(tp, NIC_SRAM_FW_ASF_STATUS_MBOX, &val);
1210 if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
1211 break;
1212 msleep(1);
1213 }
1214 }
1215 tg3_write_mem(tp, NIC_SRAM_WOL_MBOX, WOL_SIGNATURE |
1216 WOL_DRV_STATE_SHUTDOWN |
1217 WOL_DRV_WOL | WOL_SET_MAGIC_PKT);
1218
1182 pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps); 1219 pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps);
1183 1220
1184 if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) { 1221 if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) {
@@ -1220,10 +1257,8 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1220 base_val |= (CLOCK_CTRL_RXCLK_DISABLE | 1257 base_val |= (CLOCK_CTRL_RXCLK_DISABLE |
1221 CLOCK_CTRL_TXCLK_DISABLE); 1258 CLOCK_CTRL_TXCLK_DISABLE);
1222 1259
1223 tw32_f(TG3PCI_CLOCK_CTRL, base_val | 1260 tw32_wait_f(TG3PCI_CLOCK_CTRL, base_val | CLOCK_CTRL_ALTCLK |
1224 CLOCK_CTRL_ALTCLK | 1261 CLOCK_CTRL_PWRDOWN_PLL133, 40);
1225 CLOCK_CTRL_PWRDOWN_PLL133);
1226 udelay(40);
1227 } else if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) { 1262 } else if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) {
1228 /* do nothing */ 1263 /* do nothing */
1229 } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && 1264 } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) &&
@@ -1244,11 +1279,11 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1244 newbits2 = newbits1 | CLOCK_CTRL_44MHZ_CORE; 1279 newbits2 = newbits1 | CLOCK_CTRL_44MHZ_CORE;
1245 } 1280 }
1246 1281
1247 tw32_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits1); 1282 tw32_wait_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits1,
1248 udelay(40); 1283 40);
1249 1284
1250 tw32_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits2); 1285 tw32_wait_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits2,
1251 udelay(40); 1286 40);
1252 1287
1253 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 1288 if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
1254 u32 newbits3; 1289 u32 newbits3;
@@ -1262,9 +1297,20 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1262 newbits3 = CLOCK_CTRL_44MHZ_CORE; 1297 newbits3 = CLOCK_CTRL_44MHZ_CORE;
1263 } 1298 }
1264 1299
1265 tw32_f(TG3PCI_CLOCK_CTRL, 1300 tw32_wait_f(TG3PCI_CLOCK_CTRL,
1266 tp->pci_clock_ctrl | newbits3); 1301 tp->pci_clock_ctrl | newbits3, 40);
1267 udelay(40); 1302 }
1303 }
1304
1305 if (!(tp->tg3_flags & TG3_FLAG_WOL_ENABLE) &&
1306 !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
1307 /* Turn off the PHY */
1308 if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) {
1309 tg3_writephy(tp, MII_TG3_EXT_CTRL,
1310 MII_TG3_EXT_CTRL_FORCE_LED_OFF);
1311 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2);
1312 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700)
1313 tg3_writephy(tp, MII_BMCR, BMCR_PDOWN);
1268 } 1314 }
1269 } 1315 }
1270 1316
@@ -1277,8 +1323,12 @@ static int tg3_set_power_state(struct tg3 *tp, int state)
1277 1323
1278 val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1); 1324 val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1);
1279 tw32(0x7d00, val); 1325 tw32(0x7d00, val);
1280 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) 1326 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) {
1327 tg3_nvram_lock(tp);
1281 tg3_halt_cpu(tp, RX_CPU_BASE); 1328 tg3_halt_cpu(tp, RX_CPU_BASE);
1329 tw32_f(NVRAM_SWARB, SWARB_REQ_CLR0);
1330 tg3_nvram_unlock(tp);
1331 }
1282 } 1332 }
1283 1333
1284 /* Finally, set the new power state. */ 1334 /* Finally, set the new power state. */
@@ -1812,7 +1862,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset)
1812 } 1862 }
1813 } 1863 }
1814relink: 1864relink:
1815 if (current_link_up == 0) { 1865 if (current_link_up == 0 || tp->link_config.phy_is_low_power) {
1816 u32 tmp; 1866 u32 tmp;
1817 1867
1818 tg3_phy_copper_begin(tp); 1868 tg3_phy_copper_begin(tp);
@@ -7101,8 +7151,13 @@ do { p = (u32 *)(orig_p + (reg)); \
7101 GET_REG32_LOOP(BUFMGR_MODE, 0x58); 7151 GET_REG32_LOOP(BUFMGR_MODE, 0x58);
7102 GET_REG32_LOOP(RDMAC_MODE, 0x08); 7152 GET_REG32_LOOP(RDMAC_MODE, 0x08);
7103 GET_REG32_LOOP(WDMAC_MODE, 0x08); 7153 GET_REG32_LOOP(WDMAC_MODE, 0x08);
7104 GET_REG32_LOOP(RX_CPU_BASE, 0x280); 7154 GET_REG32_1(RX_CPU_MODE);
7105 GET_REG32_LOOP(TX_CPU_BASE, 0x280); 7155 GET_REG32_1(RX_CPU_STATE);
7156 GET_REG32_1(RX_CPU_PGMCTR);
7157 GET_REG32_1(RX_CPU_HWBKPT);
7158 GET_REG32_1(TX_CPU_MODE);
7159 GET_REG32_1(TX_CPU_STATE);
7160 GET_REG32_1(TX_CPU_PGMCTR);
7106 GET_REG32_LOOP(GRCMBOX_INTERRUPT_0, 0x110); 7161 GET_REG32_LOOP(GRCMBOX_INTERRUPT_0, 0x110);
7107 GET_REG32_LOOP(FTQ_RESET, 0x120); 7162 GET_REG32_LOOP(FTQ_RESET, 0x120);
7108 GET_REG32_LOOP(MSGINT_MODE, 0x0c); 7163 GET_REG32_LOOP(MSGINT_MODE, 0x0c);
@@ -7925,13 +7980,12 @@ static int tg3_test_memory(struct tg3 *tp)
7925 u32 offset; 7980 u32 offset;
7926 u32 len; 7981 u32 len;
7927 } mem_tbl_570x[] = { 7982 } mem_tbl_570x[] = {
7928 { 0x00000000, 0x01000}, 7983 { 0x00000000, 0x00b50},
7929 { 0x00002000, 0x1c000}, 7984 { 0x00002000, 0x1c000},
7930 { 0xffffffff, 0x00000} 7985 { 0xffffffff, 0x00000}
7931 }, mem_tbl_5705[] = { 7986 }, mem_tbl_5705[] = {
7932 { 0x00000100, 0x0000c}, 7987 { 0x00000100, 0x0000c},
7933 { 0x00000200, 0x00008}, 7988 { 0x00000200, 0x00008},
7934 { 0x00000b50, 0x00400},
7935 { 0x00004000, 0x00800}, 7989 { 0x00004000, 0x00800},
7936 { 0x00006000, 0x01000}, 7990 { 0x00006000, 0x01000},
7937 { 0x00008000, 0x02000}, 7991 { 0x00008000, 0x02000},
@@ -8533,6 +8587,7 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
8533 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { 8587 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) {
8534 tp->tg3_flags |= TG3_FLAG_NVRAM; 8588 tp->tg3_flags |= TG3_FLAG_NVRAM;
8535 8589
8590 tg3_nvram_lock(tp);
8536 tg3_enable_nvram_access(tp); 8591 tg3_enable_nvram_access(tp);
8537 8592
8538 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) 8593 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
@@ -8543,6 +8598,7 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
8543 tg3_get_nvram_size(tp); 8598 tg3_get_nvram_size(tp);
8544 8599
8545 tg3_disable_nvram_access(tp); 8600 tg3_disable_nvram_access(tp);
8601 tg3_nvram_unlock(tp);
8546 8602
8547 } else { 8603 } else {
8548 tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED); 8604 tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED);
@@ -8640,10 +8696,10 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
8640 if (ret == 0) 8696 if (ret == 0)
8641 *val = swab32(tr32(NVRAM_RDDATA)); 8697 *val = swab32(tr32(NVRAM_RDDATA));
8642 8698
8643 tg3_nvram_unlock(tp);
8644
8645 tg3_disable_nvram_access(tp); 8699 tg3_disable_nvram_access(tp);
8646 8700
8701 tg3_nvram_unlock(tp);
8702
8647 return ret; 8703 return ret;
8648} 8704}
8649 8705
@@ -8728,6 +8784,10 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
8728 8784
8729 offset = offset + (pagesize - page_off); 8785 offset = offset + (pagesize - page_off);
8730 8786
8787 /* Nvram lock released by tg3_nvram_read() above,
8788 * so need to get it again.
8789 */
8790 tg3_nvram_lock(tp);
8731 tg3_enable_nvram_access(tp); 8791 tg3_enable_nvram_access(tp);
8732 8792
8733 /* 8793 /*
@@ -10426,7 +10486,7 @@ static char * __devinit tg3_bus_string(struct tg3 *tp, char *str)
10426 return str; 10486 return str;
10427} 10487}
10428 10488
10429static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp) 10489static struct pci_dev * __devinit tg3_find_peer(struct tg3 *tp)
10430{ 10490{
10431 struct pci_dev *peer; 10491 struct pci_dev *peer;
10432 unsigned int func, devnr = tp->pdev->devfn & ~7; 10492 unsigned int func, devnr = tp->pdev->devfn & ~7;
@@ -10437,8 +10497,13 @@ static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp)
10437 break; 10497 break;
10438 pci_dev_put(peer); 10498 pci_dev_put(peer);
10439 } 10499 }
10440 if (!peer || peer == tp->pdev) 10500 /* 5704 can be configured in single-port mode, set peer to
10441 BUG(); 10501 * tp->pdev in that case.
10502 */
10503 if (!peer) {
10504 peer = tp->pdev;
10505 return peer;
10506 }
10442 10507
10443 /* 10508 /*
10444 * We don't need to keep the refcount elevated; there's no way 10509 * We don't need to keep the refcount elevated; there's no way
@@ -10674,8 +10739,9 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
10674 tp->rx_pending = 63; 10739 tp->rx_pending = 63;
10675 } 10740 }
10676 10741
10677 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) 10742 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
10678 tp->pdev_peer = tg3_find_5704_peer(tp); 10743 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714))
10744 tp->pdev_peer = tg3_find_peer(tp);
10679 10745
10680 err = tg3_get_device_address(tp); 10746 err = tg3_get_device_address(tp);
10681 if (err) { 10747 if (err) {
@@ -10820,12 +10886,14 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
10820 10886
10821 tg3_full_lock(tp, 0); 10887 tg3_full_lock(tp, 0);
10822 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 10888 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
10889 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
10823 tg3_full_unlock(tp); 10890 tg3_full_unlock(tp);
10824 10891
10825 err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); 10892 err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
10826 if (err) { 10893 if (err) {
10827 tg3_full_lock(tp, 0); 10894 tg3_full_lock(tp, 0);
10828 10895
10896 tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
10829 tg3_init_hw(tp); 10897 tg3_init_hw(tp);
10830 10898
10831 tp->timer.expires = jiffies + tp->timer_offset; 10899 tp->timer.expires = jiffies + tp->timer_offset;
@@ -10859,6 +10927,7 @@ static int tg3_resume(struct pci_dev *pdev)
10859 10927
10860 tg3_full_lock(tp, 0); 10928 tg3_full_lock(tp, 0);
10861 10929
10930 tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE;
10862 tg3_init_hw(tp); 10931 tg3_init_hw(tp);
10863 10932
10864 tp->timer.expires = jiffies + tp->timer_offset; 10933 tp->timer.expires = jiffies + tp->timer_offset;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index fb7e2a5f4a08..890e1635996b 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1124,7 +1124,14 @@
1124/* 0x280 --> 0x400 unused */ 1124/* 0x280 --> 0x400 unused */
1125 1125
1126#define RX_CPU_BASE 0x00005000 1126#define RX_CPU_BASE 0x00005000
1127#define RX_CPU_MODE 0x00005000
1128#define RX_CPU_STATE 0x00005004
1129#define RX_CPU_PGMCTR 0x0000501c
1130#define RX_CPU_HWBKPT 0x00005034
1127#define TX_CPU_BASE 0x00005400 1131#define TX_CPU_BASE 0x00005400
1132#define TX_CPU_MODE 0x00005400
1133#define TX_CPU_STATE 0x00005404
1134#define TX_CPU_PGMCTR 0x0000541c
1128 1135
1129/* Mailboxes */ 1136/* Mailboxes */
1130#define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */ 1137#define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */
@@ -1529,6 +1536,12 @@
1529#define NIC_SRAM_MAC_ADDR_HIGH_MBOX 0x00000c14 1536#define NIC_SRAM_MAC_ADDR_HIGH_MBOX 0x00000c14
1530#define NIC_SRAM_MAC_ADDR_LOW_MBOX 0x00000c18 1537#define NIC_SRAM_MAC_ADDR_LOW_MBOX 0x00000c18
1531 1538
1539#define NIC_SRAM_WOL_MBOX 0x00000d30
1540#define WOL_SIGNATURE 0x474c0000
1541#define WOL_DRV_STATE_SHUTDOWN 0x00000001
1542#define WOL_DRV_WOL 0x00000002
1543#define WOL_SET_MAGIC_PKT 0x00000004
1544
1532#define NIC_SRAM_DATA_CFG_2 0x00000d38 1545#define NIC_SRAM_DATA_CFG_2 0x00000d38
1533 1546
1534#define SHASTA_EXT_LED_MODE_MASK 0x00018000 1547#define SHASTA_EXT_LED_MODE_MASK 0x00018000
@@ -1565,6 +1578,7 @@
1565#define MII_TG3_EXT_CTRL 0x10 /* Extended control register */ 1578#define MII_TG3_EXT_CTRL 0x10 /* Extended control register */
1566#define MII_TG3_EXT_CTRL_FIFO_ELASTIC 0x0001 1579#define MII_TG3_EXT_CTRL_FIFO_ELASTIC 0x0001
1567#define MII_TG3_EXT_CTRL_LNK3_LED_MODE 0x0002 1580#define MII_TG3_EXT_CTRL_LNK3_LED_MODE 0x0002
1581#define MII_TG3_EXT_CTRL_FORCE_LED_OFF 0x0008
1568#define MII_TG3_EXT_CTRL_TBI 0x8000 1582#define MII_TG3_EXT_CTRL_TBI 0x8000
1569 1583
1570#define MII_TG3_EXT_STAT 0x11 /* Extended status register */ 1584#define MII_TG3_EXT_STAT 0x11 /* Extended status register */
diff --git a/drivers/net/wireless/orinoco_nortel.c b/drivers/net/wireless/orinoco_nortel.c
index d8afd51ff8a5..d1a670b35338 100644
--- a/drivers/net/wireless/orinoco_nortel.c
+++ b/drivers/net/wireless/orinoco_nortel.c
@@ -1,6 +1,8 @@
1/* orinoco_nortel.c 1/* orinoco_nortel.c
2 * 2 *
3 * Driver for Prism II devices which would usually be driven by orinoco_cs, 3 * Driver for Prism II devices which would usually be driven by orinoco_cs,
4 * but are connected to the PCI bus by a PCI-to-PCMCIA adapter used in
5 * Nortel emobility, Symbol LA-4113 and Symbol LA-4123.
4 * but are connected to the PCI bus by a Nortel PCI-PCMCIA-Adapter. 6 * but are connected to the PCI bus by a Nortel PCI-PCMCIA-Adapter.
5 * 7 *
6 * Copyright (C) 2002 Tobias Hoffmann 8 * Copyright (C) 2002 Tobias Hoffmann
@@ -165,7 +167,7 @@ static int nortel_pci_init_one(struct pci_dev *pdev,
165 goto fail_resources; 167 goto fail_resources;
166 } 168 }
167 169
168 iomem = pci_iomap(pdev, 3, 0); 170 iomem = pci_iomap(pdev, 2, 0);
169 if (!iomem) { 171 if (!iomem) {
170 err = -ENOMEM; 172 err = -ENOMEM;
171 goto fail_map_io; 173 goto fail_map_io;
@@ -265,6 +267,8 @@ static void __devexit nortel_pci_remove_one(struct pci_dev *pdev)
265static struct pci_device_id nortel_pci_id_table[] = { 267static struct pci_device_id nortel_pci_id_table[] = {
266 /* Nortel emobility PCI */ 268 /* Nortel emobility PCI */
267 {0x126c, 0x8030, PCI_ANY_ID, PCI_ANY_ID,}, 269 {0x126c, 0x8030, PCI_ANY_ID, PCI_ANY_ID,},
270 /* Symbol LA-4123 PCI */
271 {0x1562, 0x0001, PCI_ANY_ID, PCI_ANY_ID,},
268 {0,}, 272 {0,},
269}; 273};
270 274
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 716df015f8d0..6707df968934 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -6,6 +6,9 @@ obj-y += access.o bus.o probe.o remove.o pci.o quirks.o \
6 pci-driver.o search.o pci-sysfs.o rom.o setup-res.o 6 pci-driver.o search.o pci-sysfs.o rom.o setup-res.o
7obj-$(CONFIG_PROC_FS) += proc.o 7obj-$(CONFIG_PROC_FS) += proc.o
8 8
9# Build PCI Express stuff if needed
10obj-$(CONFIG_PCIEPORTBUS) += pcie/
11
9obj-$(CONFIG_HOTPLUG) += hotplug.o 12obj-$(CONFIG_HOTPLUG) += hotplug.o
10 13
11# Build the PCI Hotplug drivers if we were asked to 14# Build the PCI Hotplug drivers if we were asked to
@@ -40,7 +43,3 @@ endif
40ifeq ($(CONFIG_PCI_DEBUG),y) 43ifeq ($(CONFIG_PCI_DEBUG),y)
41EXTRA_CFLAGS += -DDEBUG 44EXTRA_CFLAGS += -DDEBUG
42endif 45endif
43
44# Build PCI Express stuff if needed
45obj-$(CONFIG_PCIEPORTBUS) += pcie/
46
diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c
index 011915d5e243..f94f1f25eec6 100644
--- a/drivers/s390/net/qeth_eddp.c
+++ b/drivers/s390/net/qeth_eddp.c
@@ -62,7 +62,8 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx)
62 for (i = 0; i < ctx->num_pages; ++i) 62 for (i = 0; i < ctx->num_pages; ++i)
63 free_page((unsigned long)ctx->pages[i]); 63 free_page((unsigned long)ctx->pages[i]);
64 kfree(ctx->pages); 64 kfree(ctx->pages);
65 kfree(ctx->elements); 65 if (ctx->elements != NULL)
66 kfree(ctx->elements);
66 kfree(ctx); 67 kfree(ctx);
67} 68}
68 69
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 99cceb242ec4..f8f55cc468ba 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * linux/drivers/s390/net/qeth_main.c ($Revision: 1.242 $) 3 * linux/drivers/s390/net/qeth_main.c ($Revision: 1.251 $)
4 * 4 *
5 * Linux on zSeries OSA Express and HiperSockets support 5 * Linux on zSeries OSA Express and HiperSockets support
6 * 6 *
@@ -12,7 +12,7 @@
12 * Frank Pavlic (fpavlic@de.ibm.com) and 12 * Frank Pavlic (fpavlic@de.ibm.com) and
13 * Thomas Spatzier <tspat@de.ibm.com> 13 * Thomas Spatzier <tspat@de.ibm.com>
14 * 14 *
15 * $Revision: 1.242 $ $Date: 2005/05/04 20:19:18 $ 15 * $Revision: 1.251 $ $Date: 2005/05/04 20:19:18 $
16 * 16 *
17 * This program is free software; you can redistribute it and/or modify 17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by 18 * it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@
72#include "qeth_eddp.h" 72#include "qeth_eddp.h"
73#include "qeth_tso.h" 73#include "qeth_tso.h"
74 74
75#define VERSION_QETH_C "$Revision: 1.242 $" 75#define VERSION_QETH_C "$Revision: 1.251 $"
76static const char *version = "qeth S/390 OSA-Express driver"; 76static const char *version = "qeth S/390 OSA-Express driver";
77 77
78/** 78/**
@@ -518,7 +518,8 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode)
518 518
519 QETH_DBF_TEXT(setup, 3, "setoffl"); 519 QETH_DBF_TEXT(setup, 3, "setoffl");
520 QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); 520 QETH_DBF_HEX(setup, 3, &card, sizeof(void *));
521 521
522 netif_carrier_off(card->dev);
522 recover_flag = card->state; 523 recover_flag = card->state;
523 if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){ 524 if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){
524 PRINT_WARN("Stopping card %s interrupted by user!\n", 525 PRINT_WARN("Stopping card %s interrupted by user!\n",
@@ -1020,7 +1021,6 @@ void
1020qeth_schedule_recovery(struct qeth_card *card) 1021qeth_schedule_recovery(struct qeth_card *card)
1021{ 1022{
1022 QETH_DBF_TEXT(trace,2,"startrec"); 1023 QETH_DBF_TEXT(trace,2,"startrec");
1023
1024 if (qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD) == 0) 1024 if (qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD) == 0)
1025 schedule_work(&card->kernel_thread_starter); 1025 schedule_work(&card->kernel_thread_starter);
1026} 1026}
@@ -1710,7 +1710,6 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob)
1710 "IP address reset.\n", 1710 "IP address reset.\n",
1711 QETH_CARD_IFNAME(card), 1711 QETH_CARD_IFNAME(card),
1712 card->info.chpid); 1712 card->info.chpid);
1713 netif_carrier_on(card->dev);
1714 qeth_schedule_recovery(card); 1713 qeth_schedule_recovery(card);
1715 return NULL; 1714 return NULL;
1716 case IPA_CMD_MODCCID: 1715 case IPA_CMD_MODCCID:
@@ -1959,7 +1958,7 @@ qeth_osn_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
1959{ 1958{
1960 u16 s1, s2; 1959 u16 s1, s2;
1961 1960
1962QETH_DBF_TEXT(trace,4,"osndipa"); 1961 QETH_DBF_TEXT(trace,4,"osndipa");
1963 1962
1964 qeth_prepare_ipa_cmd(card, iob, QETH_PROT_OSN2); 1963 qeth_prepare_ipa_cmd(card, iob, QETH_PROT_OSN2);
1965 s1 = (u16)(IPA_PDU_HEADER_SIZE + data_len); 1964 s1 = (u16)(IPA_PDU_HEADER_SIZE + data_len);
@@ -2203,24 +2202,21 @@ qeth_ulp_setup(struct qeth_card *card)
2203} 2202}
2204 2203
2205static inline int 2204static inline int
2206qeth_check_for_inbound_error(struct qeth_qdio_buffer *buf, 2205qeth_check_qdio_errors(struct qdio_buffer *buf, unsigned int qdio_error,
2207 unsigned int qdio_error, 2206 unsigned int siga_error, const char *dbftext)
2208 unsigned int siga_error)
2209{ 2207{
2210 int rc = 0;
2211
2212 if (qdio_error || siga_error) { 2208 if (qdio_error || siga_error) {
2213 QETH_DBF_TEXT(trace, 2, "qdinerr"); 2209 QETH_DBF_TEXT(trace, 2, dbftext);
2214 QETH_DBF_TEXT(qerr, 2, "qdinerr"); 2210 QETH_DBF_TEXT(qerr, 2, dbftext);
2215 QETH_DBF_TEXT_(qerr, 2, " F15=%02X", 2211 QETH_DBF_TEXT_(qerr, 2, " F15=%02X",
2216 buf->buffer->element[15].flags & 0xff); 2212 buf->element[15].flags & 0xff);
2217 QETH_DBF_TEXT_(qerr, 2, " F14=%02X", 2213 QETH_DBF_TEXT_(qerr, 2, " F14=%02X",
2218 buf->buffer->element[14].flags & 0xff); 2214 buf->element[14].flags & 0xff);
2219 QETH_DBF_TEXT_(qerr, 2, " qerr=%X", qdio_error); 2215 QETH_DBF_TEXT_(qerr, 2, " qerr=%X", qdio_error);
2220 QETH_DBF_TEXT_(qerr, 2, " serr=%X", siga_error); 2216 QETH_DBF_TEXT_(qerr, 2, " serr=%X", siga_error);
2221 rc = 1; 2217 return 1;
2222 } 2218 }
2223 return rc; 2219 return 0;
2224} 2220}
2225 2221
2226static inline struct sk_buff * 2222static inline struct sk_buff *
@@ -2769,8 +2765,9 @@ qeth_qdio_input_handler(struct ccw_device * ccwdev, unsigned int status,
2769 for (i = first_element; i < (first_element + count); ++i) { 2765 for (i = first_element; i < (first_element + count); ++i) {
2770 index = i % QDIO_MAX_BUFFERS_PER_Q; 2766 index = i % QDIO_MAX_BUFFERS_PER_Q;
2771 buffer = &card->qdio.in_q->bufs[index]; 2767 buffer = &card->qdio.in_q->bufs[index];
2772 if (!((status == QDIO_STATUS_LOOK_FOR_ERROR) && 2768 if (!((status & QDIO_STATUS_LOOK_FOR_ERROR) &&
2773 qeth_check_for_inbound_error(buffer, qdio_err, siga_err))) 2769 qeth_check_qdio_errors(buffer->buffer,
2770 qdio_err, siga_err,"qinerr")))
2774 qeth_process_inbound_buffer(card, buffer, index); 2771 qeth_process_inbound_buffer(card, buffer, index);
2775 /* clear buffer and give back to hardware */ 2772 /* clear buffer and give back to hardware */
2776 qeth_put_buffer_pool_entry(card, buffer->pool_entry); 2773 qeth_put_buffer_pool_entry(card, buffer->pool_entry);
@@ -2785,12 +2782,13 @@ qeth_qdio_input_handler(struct ccw_device * ccwdev, unsigned int status,
2785static inline int 2782static inline int
2786qeth_handle_send_error(struct qeth_card *card, 2783qeth_handle_send_error(struct qeth_card *card,
2787 struct qeth_qdio_out_buffer *buffer, 2784 struct qeth_qdio_out_buffer *buffer,
2788 int qdio_err, int siga_err) 2785 unsigned int qdio_err, unsigned int siga_err)
2789{ 2786{
2790 int sbalf15 = buffer->buffer->element[15].flags & 0xff; 2787 int sbalf15 = buffer->buffer->element[15].flags & 0xff;
2791 int cc = siga_err & 3; 2788 int cc = siga_err & 3;
2792 2789
2793 QETH_DBF_TEXT(trace, 6, "hdsnderr"); 2790 QETH_DBF_TEXT(trace, 6, "hdsnderr");
2791 qeth_check_qdio_errors(buffer->buffer, qdio_err, siga_err, "qouterr");
2794 switch (cc) { 2792 switch (cc) {
2795 case 0: 2793 case 0:
2796 if (qdio_err){ 2794 if (qdio_err){
@@ -3047,7 +3045,8 @@ qeth_qdio_output_handler(struct ccw_device * ccwdev, unsigned int status,
3047 for(i = first_element; i < (first_element + count); ++i){ 3045 for(i = first_element; i < (first_element + count); ++i){
3048 buffer = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q]; 3046 buffer = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q];
3049 /*we only handle the KICK_IT error by doing a recovery */ 3047 /*we only handle the KICK_IT error by doing a recovery */
3050 if (qeth_handle_send_error(card, buffer, qdio_error, siga_error) 3048 if (qeth_handle_send_error(card, buffer,
3049 qdio_error, siga_error)
3051 == QETH_SEND_ERROR_KICK_IT){ 3050 == QETH_SEND_ERROR_KICK_IT){
3052 netif_stop_queue(card->dev); 3051 netif_stop_queue(card->dev);
3053 qeth_schedule_recovery(card); 3052 qeth_schedule_recovery(card);
@@ -3289,7 +3288,6 @@ qeth_init_qdio_info(struct qeth_card *card)
3289 card->qdio.in_buf_pool.buf_count = card->qdio.init_pool.buf_count; 3288 card->qdio.in_buf_pool.buf_count = card->qdio.init_pool.buf_count;
3290 INIT_LIST_HEAD(&card->qdio.in_buf_pool.entry_list); 3289 INIT_LIST_HEAD(&card->qdio.in_buf_pool.entry_list);
3291 INIT_LIST_HEAD(&card->qdio.init_pool.entry_list); 3290 INIT_LIST_HEAD(&card->qdio.init_pool.entry_list);
3292 /* outbound */
3293} 3291}
3294 3292
3295static int 3293static int
@@ -3731,6 +3729,9 @@ qeth_verify_vlan_dev(struct net_device *dev, struct qeth_card *card)
3731 break; 3729 break;
3732 } 3730 }
3733 } 3731 }
3732 if (rc && !(VLAN_DEV_INFO(dev)->real_dev->priv == (void *)card))
3733 return 0;
3734
3734#endif 3735#endif
3735 return rc; 3736 return rc;
3736} 3737}
@@ -3807,10 +3808,8 @@ qeth_open(struct net_device *dev)
3807 card->data.state = CH_STATE_UP; 3808 card->data.state = CH_STATE_UP;
3808 card->state = CARD_STATE_UP; 3809 card->state = CARD_STATE_UP;
3809 3810
3810 if (!card->lan_online){ 3811 if (!card->lan_online && netif_carrier_ok(dev))
3811 if (netif_carrier_ok(dev)) 3812 netif_carrier_off(dev);
3812 netif_carrier_off(dev);
3813 }
3814 return 0; 3813 return 0;
3815} 3814}
3816 3815
@@ -5870,10 +5869,8 @@ qeth_add_multicast_ipv6(struct qeth_card *card)
5870 struct inet6_dev *in6_dev; 5869 struct inet6_dev *in6_dev;
5871 5870
5872 QETH_DBF_TEXT(trace,4,"chkmcv6"); 5871 QETH_DBF_TEXT(trace,4,"chkmcv6");
5873 if ((card->options.layer2 == 0) && 5872 if (!qeth_is_supported(card, IPA_IPV6))
5874 (!qeth_is_supported(card, IPA_IPV6)) )
5875 return ; 5873 return ;
5876
5877 in6_dev = in6_dev_get(card->dev); 5874 in6_dev = in6_dev_get(card->dev);
5878 if (in6_dev == NULL) 5875 if (in6_dev == NULL)
5879 return; 5876 return;
@@ -7936,8 +7933,8 @@ __qeth_set_online(struct ccwgroup_device *gdev, int recovery_mode)
7936 QETH_DBF_TEXT_(setup, 2, "6err%d", rc); 7933 QETH_DBF_TEXT_(setup, 2, "6err%d", rc);
7937 goto out_remove; 7934 goto out_remove;
7938 } 7935 }
7939/*maybe it was set offline without ifconfig down 7936 netif_carrier_on(card->dev);
7940 * we can also use this state for recovery purposes*/ 7937
7941 qeth_set_allowed_threads(card, 0xffffffff, 0); 7938 qeth_set_allowed_threads(card, 0xffffffff, 0);
7942 if (recover_flag == CARD_STATE_RECOVER) 7939 if (recover_flag == CARD_STATE_RECOVER)
7943 qeth_start_again(card, recovery_mode); 7940 qeth_start_again(card, recovery_mode);
diff --git a/drivers/s390/net/qeth_mpc.c b/drivers/s390/net/qeth_mpc.c
index f0a080a9e515..5f8754addc14 100644
--- a/drivers/s390/net/qeth_mpc.c
+++ b/drivers/s390/net/qeth_mpc.c
@@ -11,7 +11,7 @@
11#include <asm/cio.h> 11#include <asm/cio.h>
12#include "qeth_mpc.h" 12#include "qeth_mpc.h"
13 13
14const char *VERSION_QETH_MPC_C = "$Revision: 1.12 $"; 14const char *VERSION_QETH_MPC_C = "$Revision: 1.13 $";
15 15
16unsigned char IDX_ACTIVATE_READ[]={ 16unsigned char IDX_ACTIVATE_READ[]={
17 0x00,0x00,0x80,0x00, 0x00,0x00,0x00,0x00, 17 0x00,0x00,0x80,0x00, 0x00,0x00,0x00,0x00,
diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h
index 5f71486e708c..864cec5f6c62 100644
--- a/drivers/s390/net/qeth_mpc.h
+++ b/drivers/s390/net/qeth_mpc.h
@@ -14,14 +14,14 @@
14 14
15#include <asm/qeth.h> 15#include <asm/qeth.h>
16 16
17#define VERSION_QETH_MPC_H "$Revision: 1.44 $" 17#define VERSION_QETH_MPC_H "$Revision: 1.46 $"
18 18
19extern const char *VERSION_QETH_MPC_C; 19extern const char *VERSION_QETH_MPC_C;
20 20
21#define IPA_PDU_HEADER_SIZE 0x40 21#define IPA_PDU_HEADER_SIZE 0x40
22#define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e) 22#define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e)
23#define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26) 23#define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26)
24#define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x2a) 24#define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x29)
25#define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a) 25#define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a)
26 26
27extern unsigned char IPA_PDU_HEADER[]; 27extern unsigned char IPA_PDU_HEADER[];
diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c
index f2ccfea8fdb8..7bf35098831e 100644
--- a/drivers/s390/net/qeth_proc.c
+++ b/drivers/s390/net/qeth_proc.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * linux/drivers/s390/net/qeth_fs.c ($Revision: 1.13 $) 3 * linux/drivers/s390/net/qeth_fs.c ($Revision: 1.16 $)
4 * 4 *
5 * Linux on zSeries OSA Express and HiperSockets support 5 * Linux on zSeries OSA Express and HiperSockets support
6 * This file contains code related to procfs. 6 * This file contains code related to procfs.
@@ -21,7 +21,7 @@
21#include "qeth_mpc.h" 21#include "qeth_mpc.h"
22#include "qeth_fs.h" 22#include "qeth_fs.h"
23 23
24const char *VERSION_QETH_PROC_C = "$Revision: 1.13 $"; 24const char *VERSION_QETH_PROC_C = "$Revision: 1.16 $";
25 25
26/***** /proc/qeth *****/ 26/***** /proc/qeth *****/
27#define QETH_PROCFILE_NAME "qeth" 27#define QETH_PROCFILE_NAME "qeth"
@@ -30,30 +30,26 @@ static struct proc_dir_entry *qeth_procfile;
30static int 30static int
31qeth_procfile_seq_match(struct device *dev, void *data) 31qeth_procfile_seq_match(struct device *dev, void *data)
32{ 32{
33 return 1; 33 return(dev ? 1 : 0);
34} 34}
35 35
36static void * 36static void *
37qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) 37qeth_procfile_seq_start(struct seq_file *s, loff_t *offset)
38{ 38{
39 struct device *dev; 39 struct device *dev = NULL;
40 loff_t nr; 40 loff_t nr = 0;
41 41
42 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 42 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
43 43 if (*offset == 0)
44 nr = *offset;
45 if (nr == 0)
46 return SEQ_START_TOKEN; 44 return SEQ_START_TOKEN;
47 45 while (1) {
48 dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL,
49 NULL, qeth_procfile_seq_match);
50
51 /* get card at pos *offset */
52 nr = *offset;
53 while (nr-- > 1 && dev)
54 dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, 46 dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev,
55 NULL, qeth_procfile_seq_match); 47 NULL, qeth_procfile_seq_match);
56 return (void *) dev; 48 if (++nr == *offset)
49 break;
50 put_device(dev);
51 }
52 return dev;
57} 53}
58 54
59static void 55static void
@@ -66,19 +62,14 @@ static void *
66qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) 62qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
67{ 63{
68 struct device *prev, *next; 64 struct device *prev, *next;
69 65
70 if (it == SEQ_START_TOKEN) { 66 if (it == SEQ_START_TOKEN)
71 next = driver_find_device(&qeth_ccwgroup_driver.driver, 67 prev = NULL;
72 NULL, NULL, qeth_procfile_seq_match); 68 else
73 if (next) 69 prev = (struct device *) it;
74 (*offset)++;
75 return (void *) next;
76 }
77 prev = (struct device *) it;
78 next = driver_find_device(&qeth_ccwgroup_driver.driver, 70 next = driver_find_device(&qeth_ccwgroup_driver.driver,
79 prev, NULL, qeth_procfile_seq_match); 71 prev, NULL, qeth_procfile_seq_match);
80 if (next) 72 (*offset)++;
81 (*offset)++;
82 return (void *) next; 73 return (void *) next;
83} 74}
84 75
@@ -87,7 +78,7 @@ qeth_get_router_str(struct qeth_card *card, int ipv)
87{ 78{
88 int routing_type = 0; 79 int routing_type = 0;
89 80
90 if (ipv == 4){ 81 if (ipv == 4) {
91 routing_type = card->options.route4.type; 82 routing_type = card->options.route4.type;
92 } else { 83 } else {
93#ifdef CONFIG_QETH_IPV6 84#ifdef CONFIG_QETH_IPV6
@@ -154,6 +145,7 @@ qeth_procfile_seq_show(struct seq_file *s, void *it)
154 card->qdio.in_buf_pool.buf_count); 145 card->qdio.in_buf_pool.buf_count);
155 else 146 else
156 seq_printf(s, " +++ LAN OFFLINE +++\n"); 147 seq_printf(s, " +++ LAN OFFLINE +++\n");
148 put_device(device);
157 } 149 }
158 return 0; 150 return 0;
159} 151}
@@ -184,51 +176,16 @@ static struct file_operations qeth_procfile_fops = {
184static struct proc_dir_entry *qeth_perf_procfile; 176static struct proc_dir_entry *qeth_perf_procfile;
185 177
186#ifdef CONFIG_QETH_PERF_STATS 178#ifdef CONFIG_QETH_PERF_STATS
187
188static void *
189qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset)
190{
191 struct device *dev = NULL;
192 int nr;
193
194 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
195 /* get card at pos *offset */
196 dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL,
197 qeth_procfile_seq_match);
198
199 /* get card at pos *offset */
200 nr = *offset;
201 while (nr-- > 1 && dev)
202 dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev,
203 NULL, qeth_procfile_seq_match);
204 return (void *) dev;
205}
206
207static void
208qeth_perf_procfile_seq_stop(struct seq_file *s, void* it)
209{
210 up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
211}
212
213static void *
214qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
215{
216 struct device *prev, *next;
217
218 prev = (struct device *) it;
219 next = driver_find_device(&qeth_ccwgroup_driver.driver, prev,
220 NULL, qeth_procfile_seq_match);
221 if (next)
222 (*offset)++;
223 return (void *) next;
224}
225
226static int 179static int
227qeth_perf_procfile_seq_show(struct seq_file *s, void *it) 180qeth_perf_procfile_seq_show(struct seq_file *s, void *it)
228{ 181{
229 struct device *device; 182 struct device *device;
230 struct qeth_card *card; 183 struct qeth_card *card;
231 184
185
186 if (it == SEQ_START_TOKEN)
187 return 0;
188
232 device = (struct device *) it; 189 device = (struct device *) it;
233 card = device->driver_data; 190 card = device->driver_data;
234 seq_printf(s, "For card with devnos %s/%s/%s (%s):\n", 191 seq_printf(s, "For card with devnos %s/%s/%s (%s):\n",
@@ -295,13 +252,14 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it)
295 card->perf_stats.outbound_do_qdio_time, 252 card->perf_stats.outbound_do_qdio_time,
296 card->perf_stats.outbound_do_qdio_cnt 253 card->perf_stats.outbound_do_qdio_cnt
297 ); 254 );
255 put_device(device);
298 return 0; 256 return 0;
299} 257}
300 258
301static struct seq_operations qeth_perf_procfile_seq_ops = { 259static struct seq_operations qeth_perf_procfile_seq_ops = {
302 .start = qeth_perf_procfile_seq_start, 260 .start = qeth_procfile_seq_start,
303 .stop = qeth_perf_procfile_seq_stop, 261 .stop = qeth_procfile_seq_stop,
304 .next = qeth_perf_procfile_seq_next, 262 .next = qeth_procfile_seq_next,
305 .show = qeth_perf_procfile_seq_show, 263 .show = qeth_perf_procfile_seq_show,
306}; 264};
307 265
@@ -324,93 +282,6 @@ static struct file_operations qeth_perf_procfile_fops = {
324#define qeth_perf_procfile_created 1 282#define qeth_perf_procfile_created 1
325#endif /* CONFIG_QETH_PERF_STATS */ 283#endif /* CONFIG_QETH_PERF_STATS */
326 284
327/***** /proc/qeth_ipa_takeover *****/
328#define QETH_IPATO_PROCFILE_NAME "qeth_ipa_takeover"
329static struct proc_dir_entry *qeth_ipato_procfile;
330
331static void *
332qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset)
333{
334 struct device *dev;
335 loff_t nr;
336
337 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
338 /* TODO: finish this */
339 /*
340 * maybe SEQ_SATRT_TOKEN can be returned for offset 0
341 * output driver settings then;
342 * else output setting for respective card
343 */
344
345 dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL,
346 qeth_procfile_seq_match);
347
348 /* get card at pos *offset */
349 nr = *offset;
350 while (nr-- > 1 && dev)
351 dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev,
352 NULL, qeth_procfile_seq_match);
353 return (void *) dev;
354}
355
356static void
357qeth_ipato_procfile_seq_stop(struct seq_file *s, void* it)
358{
359 up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
360}
361
362static void *
363qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
364{
365 struct device *prev, *next;
366
367 prev = (struct device *) it;
368 next = driver_find_device(&qeth_ccwgroup_driver.driver, prev,
369 NULL, qeth_procfile_seq_match);
370 if (next)
371 (*offset)++;
372 return (void *) next;
373}
374
375static int
376qeth_ipato_procfile_seq_show(struct seq_file *s, void *it)
377{
378 struct device *device;
379 struct qeth_card *card;
380
381 /* TODO: finish this */
382 /*
383 * maybe SEQ_SATRT_TOKEN can be returned for offset 0
384 * output driver settings then;
385 * else output setting for respective card
386 */
387 device = (struct device *) it;
388 card = device->driver_data;
389
390 return 0;
391}
392
393static struct seq_operations qeth_ipato_procfile_seq_ops = {
394 .start = qeth_ipato_procfile_seq_start,
395 .stop = qeth_ipato_procfile_seq_stop,
396 .next = qeth_ipato_procfile_seq_next,
397 .show = qeth_ipato_procfile_seq_show,
398};
399
400static int
401qeth_ipato_procfile_open(struct inode *inode, struct file *file)
402{
403 return seq_open(file, &qeth_ipato_procfile_seq_ops);
404}
405
406static struct file_operations qeth_ipato_procfile_fops = {
407 .owner = THIS_MODULE,
408 .open = qeth_ipato_procfile_open,
409 .read = seq_read,
410 .llseek = seq_lseek,
411 .release = seq_release,
412};
413
414int __init 285int __init
415qeth_create_procfs_entries(void) 286qeth_create_procfs_entries(void)
416{ 287{
@@ -426,13 +297,7 @@ qeth_create_procfs_entries(void)
426 qeth_perf_procfile->proc_fops = &qeth_perf_procfile_fops; 297 qeth_perf_procfile->proc_fops = &qeth_perf_procfile_fops;
427#endif /* CONFIG_QETH_PERF_STATS */ 298#endif /* CONFIG_QETH_PERF_STATS */
428 299
429 qeth_ipato_procfile = create_proc_entry(QETH_IPATO_PROCFILE_NAME,
430 S_IFREG | 0444, NULL);
431 if (qeth_ipato_procfile)
432 qeth_ipato_procfile->proc_fops = &qeth_ipato_procfile_fops;
433
434 if (qeth_procfile && 300 if (qeth_procfile &&
435 qeth_ipato_procfile &&
436 qeth_perf_procfile_created) 301 qeth_perf_procfile_created)
437 return 0; 302 return 0;
438 else 303 else
@@ -446,62 +311,5 @@ qeth_remove_procfs_entries(void)
446 remove_proc_entry(QETH_PROCFILE_NAME, NULL); 311 remove_proc_entry(QETH_PROCFILE_NAME, NULL);
447 if (qeth_perf_procfile) 312 if (qeth_perf_procfile)
448 remove_proc_entry(QETH_PERF_PROCFILE_NAME, NULL); 313 remove_proc_entry(QETH_PERF_PROCFILE_NAME, NULL);
449 if (qeth_ipato_procfile)
450 remove_proc_entry(QETH_IPATO_PROCFILE_NAME, NULL);
451} 314}
452 315
453
454/* ONLY FOR DEVELOPMENT! -> make it as module */
455/*
456static void
457qeth_create_sysfs_entries(void)
458{
459 struct device *dev;
460
461 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
462
463 list_for_each_entry(dev, &qeth_ccwgroup_driver.driver.devices,
464 driver_list)
465 qeth_create_device_attributes(dev);
466
467 up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
468}
469
470static void
471qeth_remove_sysfs_entries(void)
472{
473 struct device *dev;
474
475 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
476
477 list_for_each_entry(dev, &qeth_ccwgroup_driver.driver.devices,
478 driver_list)
479 qeth_remove_device_attributes(dev);
480
481 up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
482}
483
484static int __init
485qeth_fs_init(void)
486{
487 printk(KERN_INFO "qeth_fs_init\n");
488 qeth_create_procfs_entries();
489 qeth_create_sysfs_entries();
490
491 return 0;
492}
493
494static void __exit
495qeth_fs_exit(void)
496{
497 printk(KERN_INFO "qeth_fs_exit\n");
498 qeth_remove_procfs_entries();
499 qeth_remove_sysfs_entries();
500}
501
502
503module_init(qeth_fs_init);
504module_exit(qeth_fs_exit);
505
506MODULE_LICENSE("GPL");
507*/
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c
index ddd6019ba092..0ea185f70f75 100644
--- a/drivers/s390/net/qeth_sys.c
+++ b/drivers/s390/net/qeth_sys.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.58 $) 3 * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.60 $)
4 * 4 *
5 * Linux on zSeries OSA Express and HiperSockets support 5 * Linux on zSeries OSA Express and HiperSockets support
6 * This file contains code related to sysfs. 6 * This file contains code related to sysfs.
@@ -20,7 +20,7 @@
20#include "qeth_mpc.h" 20#include "qeth_mpc.h"
21#include "qeth_fs.h" 21#include "qeth_fs.h"
22 22
23const char *VERSION_QETH_SYS_C = "$Revision: 1.58 $"; 23const char *VERSION_QETH_SYS_C = "$Revision: 1.60 $";
24 24
25/*****************************************************************************/ 25/*****************************************************************************/
26/* */ 26/* */
@@ -160,7 +160,7 @@ qeth_dev_portname_store(struct device *dev, struct device_attribute *attr, const
160 return -EPERM; 160 return -EPERM;
161 161
162 tmp = strsep((char **) &buf, "\n"); 162 tmp = strsep((char **) &buf, "\n");
163 if ((strlen(tmp) > 8) || (strlen(tmp) < 2)) 163 if ((strlen(tmp) > 8) || (strlen(tmp) == 0))
164 return -EINVAL; 164 return -EINVAL;
165 165
166 card->info.portname[0] = strlen(tmp); 166 card->info.portname[0] = strlen(tmp);
diff --git a/drivers/s390/net/qeth_tso.h b/drivers/s390/net/qeth_tso.h
index e245af3c4cbd..3c50b6f24f51 100644
--- a/drivers/s390/net/qeth_tso.h
+++ b/drivers/s390/net/qeth_tso.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/s390/net/qeth_tso.h ($Revision: 1.7 $) 2 * linux/drivers/s390/net/qeth_tso.h ($Revision: 1.8 $)
3 * 3 *
4 * Header file for qeth TCP Segmentation Offload support. 4 * Header file for qeth TCP Segmentation Offload support.
5 * 5 *
@@ -7,7 +7,7 @@
7 * 7 *
8 * Author(s): Frank Pavlic <fpavlic@de.ibm.com> 8 * Author(s): Frank Pavlic <fpavlic@de.ibm.com>
9 * 9 *
10 * $Revision: 1.7 $ $Date: 2005/05/04 20:19:18 $ 10 * $Revision: 1.8 $ $Date: 2005/05/04 20:19:18 $
11 * 11 *
12 */ 12 */
13#ifndef __QETH_TSO_H__ 13#ifndef __QETH_TSO_H__
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index c12c5046e2fa..14631ac11bc7 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -249,11 +249,11 @@ static loff_t jsf_lseek(struct file * file, loff_t offset, int orig)
249/* 249/*
250 * OS SIMM Cannot be read in other size but a 32bits word. 250 * OS SIMM Cannot be read in other size but a 32bits word.
251 */ 251 */
252static ssize_t jsf_read(struct file * file, char * buf, 252static ssize_t jsf_read(struct file * file, char __user * buf,
253 size_t togo, loff_t *ppos) 253 size_t togo, loff_t *ppos)
254{ 254{
255 unsigned long p = *ppos; 255 unsigned long p = *ppos;
256 char *tmp = buf; 256 char __user *tmp = buf;
257 257
258 union byte4 { 258 union byte4 {
259 char s[4]; 259 char s[4];
@@ -305,7 +305,7 @@ static ssize_t jsf_read(struct file * file, char * buf,
305 return tmp-buf; 305 return tmp-buf;
306} 306}
307 307
308static ssize_t jsf_write(struct file * file, const char * buf, 308static ssize_t jsf_write(struct file * file, const char __user * buf,
309 size_t count, loff_t *ppos) 309 size_t count, loff_t *ppos)
310{ 310{
311 return -ENOSPC; 311 return -ENOSPC;
@@ -356,10 +356,10 @@ static int jsf_ioctl_erase(unsigned long arg)
356 * Program a block of flash. 356 * Program a block of flash.
357 * Very simple because we can do it byte by byte anyway. 357 * Very simple because we can do it byte by byte anyway.
358 */ 358 */
359static int jsf_ioctl_program(unsigned long arg) 359static int jsf_ioctl_program(void __user *arg)
360{ 360{
361 struct jsflash_program_arg abuf; 361 struct jsflash_program_arg abuf;
362 char *uptr; 362 char __user *uptr;
363 unsigned long p; 363 unsigned long p;
364 unsigned int togo; 364 unsigned int togo;
365 union { 365 union {
@@ -367,13 +367,13 @@ static int jsf_ioctl_program(unsigned long arg)
367 char s[4]; 367 char s[4];
368 } b; 368 } b;
369 369
370 if (copy_from_user(&abuf, (char *)arg, JSFPRGSZ)) 370 if (copy_from_user(&abuf, arg, JSFPRGSZ))
371 return -EFAULT; 371 return -EFAULT;
372 p = abuf.off; 372 p = abuf.off;
373 togo = abuf.size; 373 togo = abuf.size;
374 if ((togo & 3) || (p & 3)) return -EINVAL; 374 if ((togo & 3) || (p & 3)) return -EINVAL;
375 375
376 uptr = (char *) (unsigned long) abuf.data; 376 uptr = (char __user *) (unsigned long) abuf.data;
377 while (togo != 0) { 377 while (togo != 0) {
378 togo -= 4; 378 togo -= 4;
379 if (copy_from_user(&b.s[0], uptr, 4)) 379 if (copy_from_user(&b.s[0], uptr, 4))
@@ -390,19 +390,20 @@ static int jsf_ioctl(struct inode *inode, struct file *f, unsigned int cmd,
390 unsigned long arg) 390 unsigned long arg)
391{ 391{
392 int error = -ENOTTY; 392 int error = -ENOTTY;
393 void __user *argp = (void __user *)arg;
393 394
394 if (!capable(CAP_SYS_ADMIN)) 395 if (!capable(CAP_SYS_ADMIN))
395 return -EPERM; 396 return -EPERM;
396 switch (cmd) { 397 switch (cmd) {
397 case JSFLASH_IDENT: 398 case JSFLASH_IDENT:
398 if (copy_to_user((void *)arg, &jsf0.id, JSFIDSZ)) 399 if (copy_to_user(argp, &jsf0.id, JSFIDSZ))
399 return -EFAULT; 400 return -EFAULT;
400 break; 401 break;
401 case JSFLASH_ERASE: 402 case JSFLASH_ERASE:
402 error = jsf_ioctl_erase(arg); 403 error = jsf_ioctl_erase(arg);
403 break; 404 break;
404 case JSFLASH_PROGRAM: 405 case JSFLASH_PROGRAM:
405 error = jsf_ioctl_program(arg); 406 error = jsf_ioctl_program(argp);
406 break; 407 break;
407 } 408 }
408 409
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index 858cc683f85c..e2d9a7c85427 100644
--- a/drivers/sbus/char/uctrl.c
+++ b/drivers/sbus/char/uctrl.c
@@ -309,7 +309,7 @@ static void uctrl_do_txn(struct uctrl_txn *txn)
309 } 309 }
310} 310}
311 311
312void uctrl_get_event_status() 312void uctrl_get_event_status(void)
313{ 313{
314 struct uctrl_driver *driver = &drv; 314 struct uctrl_driver *driver = &drv;
315 struct uctrl_txn txn; 315 struct uctrl_txn txn;
@@ -318,7 +318,7 @@ void uctrl_get_event_status()
318 txn.opcode = READ_EVENT_STATUS; 318 txn.opcode = READ_EVENT_STATUS;
319 txn.inbits = 0; 319 txn.inbits = 0;
320 txn.outbits = 2; 320 txn.outbits = 2;
321 txn.inbuf = 0; 321 txn.inbuf = NULL;
322 txn.outbuf = outbits; 322 txn.outbuf = outbits;
323 323
324 uctrl_do_txn(&txn); 324 uctrl_do_txn(&txn);
@@ -329,7 +329,7 @@ void uctrl_get_event_status()
329 dprintk(("ev is %x\n", driver->status.event_status)); 329 dprintk(("ev is %x\n", driver->status.event_status));
330} 330}
331 331
332void uctrl_get_external_status() 332void uctrl_get_external_status(void)
333{ 333{
334 struct uctrl_driver *driver = &drv; 334 struct uctrl_driver *driver = &drv;
335 struct uctrl_txn txn; 335 struct uctrl_txn txn;
@@ -339,7 +339,7 @@ void uctrl_get_external_status()
339 txn.opcode = READ_EXTERNAL_STATUS; 339 txn.opcode = READ_EXTERNAL_STATUS;
340 txn.inbits = 0; 340 txn.inbits = 0;
341 txn.outbits = 2; 341 txn.outbits = 2;
342 txn.inbuf = 0; 342 txn.inbuf = NULL;
343 txn.outbuf = outbits; 343 txn.outbuf = outbits;
344 344
345 uctrl_do_txn(&txn); 345 uctrl_do_txn(&txn);
@@ -414,7 +414,7 @@ static void __exit ts102_uctrl_cleanup(void)
414 if (driver->irq) 414 if (driver->irq)
415 free_irq(driver->irq, driver); 415 free_irq(driver->irq, driver);
416 if (driver->regs) 416 if (driver->regs)
417 driver->regs = 0; 417 driver->regs = NULL;
418} 418}
419 419
420module_init(ts102_uctrl_init); 420module_init(ts102_uctrl_init);
diff --git a/drivers/sbus/char/vfc.h b/drivers/sbus/char/vfc.h
index a7782e7da42e..8045cd5e7cb3 100644
--- a/drivers/sbus/char/vfc.h
+++ b/drivers/sbus/char/vfc.h
@@ -125,7 +125,7 @@ struct vfc_regs {
125 125
126 126
127struct vfc_dev { 127struct vfc_dev {
128 volatile struct vfc_regs *regs; 128 volatile struct vfc_regs __iomem *regs;
129 struct vfc_regs *phys_regs; 129 struct vfc_regs *phys_regs;
130 unsigned int control_reg; 130 unsigned int control_reg;
131 struct semaphore device_lock_sem; 131 struct semaphore device_lock_sem;
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index 7a103698fa3c..dfdd6be551f3 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -149,7 +149,7 @@ int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance)
149 } 149 }
150 printk("Initializing vfc%d\n",instance); 150 printk("Initializing vfc%d\n",instance);
151 dev->regs = NULL; 151 dev->regs = NULL;
152 dev->regs = (volatile struct vfc_regs *) 152 dev->regs = (volatile struct vfc_regs __iomem *)
153 sbus_ioremap(&sdev->resource[0], 0, 153 sbus_ioremap(&sdev->resource[0], 0,
154 sizeof(struct vfc_regs), vfcstr); 154 sizeof(struct vfc_regs), vfcstr);
155 dev->which_io = sdev->reg_addrs[0].which_io; 155 dev->which_io = sdev->reg_addrs[0].which_io;
@@ -319,7 +319,7 @@ int vfc_capture_poll(struct vfc_dev *dev)
319 int timeout = 1000; 319 int timeout = 1000;
320 320
321 while (!timeout--) { 321 while (!timeout--) {
322 if (dev->regs->control & VFC_STATUS_CAPTURE) 322 if (sbus_readl(&dev->regs->control) & VFC_STATUS_CAPTURE)
323 break; 323 break;
324 vfc_i2c_delay_no_busy(dev, 100); 324 vfc_i2c_delay_no_busy(dev, 100);
325 } 325 }
@@ -718,7 +718,7 @@ static void deinit_vfc_device(struct vfc_dev *dev)
718 if(dev == NULL) 718 if(dev == NULL)
719 return; 719 return;
720 devfs_remove("vfc/%d", dev->instance); 720 devfs_remove("vfc/%d", dev->instance);
721 sbus_iounmap((unsigned long)dev->regs, sizeof(struct vfc_regs)); 721 sbus_iounmap(dev->regs, sizeof(struct vfc_regs));
722 kfree(dev); 722 kfree(dev);
723} 723}
724 724
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 418fc7b896ac..6252b9ddc01e 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -660,7 +660,12 @@ static int adpt_abort(struct scsi_cmnd * cmd)
660 msg[2] = 0; 660 msg[2] = 0;
661 msg[3]= 0; 661 msg[3]= 0;
662 msg[4] = (u32)cmd; 662 msg[4] = (u32)cmd;
663 if( (rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER)) != 0){ 663 if (pHba->host)
664 spin_lock_irq(pHba->host->host_lock);
665 rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER);
666 if (pHba->host)
667 spin_unlock_irq(pHba->host->host_lock);
668 if (rcode != 0) {
664 if(rcode == -EOPNOTSUPP ){ 669 if(rcode == -EOPNOTSUPP ){
665 printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name); 670 printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name);
666 return FAILED; 671 return FAILED;
@@ -697,10 +702,15 @@ static int adpt_device_reset(struct scsi_cmnd* cmd)
697 msg[2] = 0; 702 msg[2] = 0;
698 msg[3] = 0; 703 msg[3] = 0;
699 704
705 if (pHba->host)
706 spin_lock_irq(pHba->host->host_lock);
700 old_state = d->state; 707 old_state = d->state;
701 d->state |= DPTI_DEV_RESET; 708 d->state |= DPTI_DEV_RESET;
702 if( (rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER)) ){ 709 rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
703 d->state = old_state; 710 d->state = old_state;
711 if (pHba->host)
712 spin_unlock_irq(pHba->host->host_lock);
713 if (rcode != 0) {
704 if(rcode == -EOPNOTSUPP ){ 714 if(rcode == -EOPNOTSUPP ){
705 printk(KERN_INFO"%s: Device reset not supported\n",pHba->name); 715 printk(KERN_INFO"%s: Device reset not supported\n",pHba->name);
706 return FAILED; 716 return FAILED;
@@ -708,7 +718,6 @@ static int adpt_device_reset(struct scsi_cmnd* cmd)
708 printk(KERN_INFO"%s: Device reset failed\n",pHba->name); 718 printk(KERN_INFO"%s: Device reset failed\n",pHba->name);
709 return FAILED; 719 return FAILED;
710 } else { 720 } else {
711 d->state = old_state;
712 printk(KERN_INFO"%s: Device reset successful\n",pHba->name); 721 printk(KERN_INFO"%s: Device reset successful\n",pHba->name);
713 return SUCCESS; 722 return SUCCESS;
714 } 723 }
@@ -721,6 +730,7 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd)
721{ 730{
722 adpt_hba* pHba; 731 adpt_hba* pHba;
723 u32 msg[4]; 732 u32 msg[4];
733 u32 rcode;
724 734
725 pHba = (adpt_hba*)cmd->device->host->hostdata[0]; 735 pHba = (adpt_hba*)cmd->device->host->hostdata[0];
726 memset(msg, 0, sizeof(msg)); 736 memset(msg, 0, sizeof(msg));
@@ -729,7 +739,12 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd)
729 msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid); 739 msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid);
730 msg[2] = 0; 740 msg[2] = 0;
731 msg[3] = 0; 741 msg[3] = 0;
732 if(adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER) ){ 742 if (pHba->host)
743 spin_lock_irq(pHba->host->host_lock);
744 rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER);
745 if (pHba->host)
746 spin_unlock_irq(pHba->host->host_lock);
747 if (rcode != 0) {
733 printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name); 748 printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name);
734 return FAILED; 749 return FAILED;
735 } else { 750 } else {
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h
index 8bec0438dc8a..5b0edd1f1921 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.h
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.h
@@ -100,7 +100,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
100void ibmvscsi_release_crq_queue(struct crq_queue *queue, 100void ibmvscsi_release_crq_queue(struct crq_queue *queue,
101 struct ibmvscsi_host_data *hostdata, 101 struct ibmvscsi_host_data *hostdata,
102 int max_requests); 102 int max_requests);
103void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 103int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
104 struct ibmvscsi_host_data *hostdata); 104 struct ibmvscsi_host_data *hostdata);
105 105
106void ibmvscsi_handle_crq(struct viosrp_crq *crq, 106void ibmvscsi_handle_crq(struct viosrp_crq *crq,
diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c
index 1045872b0175..ce15d9e39621 100644
--- a/drivers/scsi/ibmvscsi/iseries_vscsi.c
+++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c
@@ -117,9 +117,10 @@ void ibmvscsi_release_crq_queue(struct crq_queue *queue,
117 * 117 *
118 * no-op for iSeries 118 * no-op for iSeries
119 */ 119 */
120void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 120int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
121 struct ibmvscsi_host_data *hostdata) 121 struct ibmvscsi_host_data *hostdata)
122{ 122{
123 return 0;
123} 124}
124 125
125/** 126/**
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 8bf5652f1060..75db2f5c545e 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -230,6 +230,11 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
230 rc = plpar_hcall_norets(H_REG_CRQ, 230 rc = plpar_hcall_norets(H_REG_CRQ,
231 vdev->unit_address, 231 vdev->unit_address,
232 queue->msg_token, PAGE_SIZE); 232 queue->msg_token, PAGE_SIZE);
233 if (rc == H_Resource)
234 /* maybe kexecing and resource is busy. try a reset */
235 rc = ibmvscsi_reset_crq_queue(queue,
236 hostdata);
237
233 if (rc == 2) { 238 if (rc == 2) {
234 /* Adapter is good, but other end is not ready */ 239 /* Adapter is good, but other end is not ready */
235 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n"); 240 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n");
@@ -281,7 +286,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
281 * @hostdata: ibmvscsi_host_data of host 286 * @hostdata: ibmvscsi_host_data of host
282 * 287 *
283 */ 288 */
284void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 289int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
285 struct ibmvscsi_host_data *hostdata) 290 struct ibmvscsi_host_data *hostdata)
286{ 291{
287 int rc; 292 int rc;
@@ -309,4 +314,5 @@ void ibmvscsi_reset_crq_queue(struct crq_queue *queue,
309 printk(KERN_WARNING 314 printk(KERN_WARNING
310 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc); 315 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc);
311 } 316 }
317 return rc;
312} 318}
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 4fea3e4edaa7..3d8009f55342 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -3368,7 +3368,7 @@ iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param,
3368 switch(param) { 3368 switch(param) {
3369 case ISCSI_PARAM_MAX_RECV_DLENGTH: { 3369 case ISCSI_PARAM_MAX_RECV_DLENGTH: {
3370 char *saveptr = conn->data; 3370 char *saveptr = conn->data;
3371 int flags = GFP_KERNEL; 3371 gfp_t flags = GFP_KERNEL;
3372 3372
3373 if (conn->data_size >= value) { 3373 if (conn->data_size >= value) {
3374 conn->max_recv_dlength = value; 3374 conn->max_recv_dlength = value;
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 665ce382eb23..094c9c88a095 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -2040,7 +2040,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc)
2040 else { 2040 else {
2041 u8 *scsicmd = cmd->cmnd; 2041 u8 *scsicmd = cmd->cmnd;
2042 2042
2043 if (scsicmd[0] == INQUIRY) { 2043 if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) {
2044 u8 *buf = NULL; 2044 u8 *buf = NULL;
2045 unsigned int buflen; 2045 unsigned int buflen;
2046 2046
@@ -2054,9 +2054,6 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc)
2054 * device. 2) Ensure response data format / ATAPI information 2054 * device. 2) Ensure response data format / ATAPI information
2055 * are always correct. 2055 * are always correct.
2056 */ 2056 */
2057 /* FIXME: do we ever override EVPD pages and the like, with
2058 * this code?
2059 */
2060 if (buf[2] == 0) { 2057 if (buf[2] == 0) {
2061 buf[2] = 0x5; 2058 buf[2] = 0x5;
2062 buf[3] = 0x32; 2059 buf[3] = 0x32;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index f9792528e33f..578143e93a6f 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -664,7 +664,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
664 sg->offset; 664 sg->offset;
665 } else 665 } else
666 buf = cmd->request_buffer; 666 buf = cmd->request_buffer;
667 memset(cmd->request_buffer, 0, cmd->cmnd[4]); 667 memset(buf, 0, cmd->cmnd[4]);
668 if (cmd->use_sg) { 668 if (cmd->use_sg) {
669 struct scatterlist *sg; 669 struct scatterlist *sg;
670 670
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 7096945ea234..7b3efd531297 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2476,17 +2476,9 @@ typedef struct scsi_qla_host {
2476 */ 2476 */
2477#define LOOP_TRANSITION(ha) \ 2477#define LOOP_TRANSITION(ha) \
2478 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ 2478 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2479 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) 2479 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2480
2481#define LOOP_NOT_READY(ha) \
2482 ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2483 test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || \
2484 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2485 test_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) || \
2486 atomic_read(&ha->loop_state) == LOOP_DOWN) 2480 atomic_read(&ha->loop_state) == LOOP_DOWN)
2487 2481
2488#define LOOP_RDY(ha) (!LOOP_NOT_READY(ha))
2489
2490#define TGT_Q(ha, t) (ha->otgt[t]) 2482#define TGT_Q(ha, t) (ha->otgt[t])
2491 2483
2492#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata) 2484#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 2d720121a0d3..c46d2469b85f 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1259,7 +1259,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1259 rval = qla2x00_get_adapter_id(ha, 1259 rval = qla2x00_get_adapter_id(ha,
1260 &loop_id, &al_pa, &area, &domain, &topo); 1260 &loop_id, &al_pa, &area, &domain, &topo);
1261 if (rval != QLA_SUCCESS) { 1261 if (rval != QLA_SUCCESS) {
1262 if (LOOP_NOT_READY(ha) || atomic_read(&ha->loop_down_timer) || 1262 if (LOOP_TRANSITION(ha) || atomic_read(&ha->loop_down_timer) ||
1263 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { 1263 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) {
1264 DEBUG2(printk("%s(%ld) Loop is in a transition state\n", 1264 DEBUG2(printk("%s(%ld) Loop is in a transition state\n",
1265 __func__, ha->host_no)); 1265 __func__, ha->host_no));
@@ -1796,7 +1796,7 @@ qla2x00_configure_loop(scsi_qla_host_t *ha)
1796 } 1796 }
1797 1797
1798 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) { 1798 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) {
1799 if (LOOP_NOT_READY(ha)) { 1799 if (LOOP_TRANSITION(ha)) {
1800 rval = QLA_FUNCTION_FAILED; 1800 rval = QLA_FUNCTION_FAILED;
1801 } else { 1801 } else {
1802 rval = qla2x00_configure_fabric(ha); 1802 rval = qla2x00_configure_fabric(ha);
@@ -2369,7 +2369,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2369 if (qla2x00_is_reserved_id(ha, loop_id)) 2369 if (qla2x00_is_reserved_id(ha, loop_id))
2370 continue; 2370 continue;
2371 2371
2372 if (atomic_read(&ha->loop_down_timer) || LOOP_NOT_READY(ha)) 2372 if (atomic_read(&ha->loop_down_timer) || LOOP_TRANSITION(ha))
2373 break; 2373 break;
2374 2374
2375 if (swl != NULL) { 2375 if (swl != NULL) {
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 09afc0f06bd4..5181d966fecb 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -909,6 +909,21 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
909 resid = resid_len; 909 resid = resid_len;
910 cp->resid = resid; 910 cp->resid = resid;
911 CMD_RESID_LEN(cp) = resid; 911 CMD_RESID_LEN(cp) = resid;
912
913 if (!lscsi_status &&
914 ((unsigned)(cp->request_bufflen - resid) <
915 cp->underflow)) {
916 qla_printk(KERN_INFO, ha,
917 "scsi(%ld:%d:%d:%d): Mid-layer underflow "
918 "detected (%x of %x bytes)...returning "
919 "error status.\n", ha->host_no,
920 cp->device->channel, cp->device->id,
921 cp->device->lun, resid,
922 cp->request_bufflen);
923
924 cp->result = DID_ERROR << 16;
925 break;
926 }
912 } 927 }
913 cp->result = DID_OK << 16 | lscsi_status; 928 cp->result = DID_OK << 16 | lscsi_status;
914 929
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 18c5d2523014..c0ae9e965f6f 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -422,10 +422,15 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
422 **/ 422 **/
423static void scsi_eh_done(struct scsi_cmnd *scmd) 423static void scsi_eh_done(struct scsi_cmnd *scmd)
424{ 424{
425 struct completion *eh_action;
426
425 SCSI_LOG_ERROR_RECOVERY(3, 427 SCSI_LOG_ERROR_RECOVERY(3,
426 printk("%s scmd: %p result: %x\n", 428 printk("%s scmd: %p result: %x\n",
427 __FUNCTION__, scmd, scmd->result)); 429 __FUNCTION__, scmd, scmd->result));
428 complete(scmd->device->host->eh_action); 430
431 eh_action = scmd->device->host->eh_action;
432 if (eh_action)
433 complete(eh_action);
429} 434}
430 435
431/** 436/**
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ce9d73a292e2..dc249cb970ea 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1085,6 +1085,26 @@ static void scsi_generic_done(struct scsi_cmnd *cmd)
1085 scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0); 1085 scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0);
1086} 1086}
1087 1087
1088void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries)
1089{
1090 struct request *req = cmd->request;
1091
1092 BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd));
1093 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd));
1094 cmd->cmd_len = req->cmd_len;
1095 if (!req->data_len)
1096 cmd->sc_data_direction = DMA_NONE;
1097 else if (rq_data_dir(req) == WRITE)
1098 cmd->sc_data_direction = DMA_TO_DEVICE;
1099 else
1100 cmd->sc_data_direction = DMA_FROM_DEVICE;
1101
1102 cmd->transfersize = req->data_len;
1103 cmd->allowed = retries;
1104 cmd->timeout_per_command = req->timeout;
1105}
1106EXPORT_SYMBOL_GPL(scsi_setup_blk_pc_cmnd);
1107
1088static int scsi_prep_fn(struct request_queue *q, struct request *req) 1108static int scsi_prep_fn(struct request_queue *q, struct request *req)
1089{ 1109{
1090 struct scsi_device *sdev = q->queuedata; 1110 struct scsi_device *sdev = q->queuedata;
@@ -1220,18 +1240,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
1220 goto kill; 1240 goto kill;
1221 } 1241 }
1222 } else { 1242 } else {
1223 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); 1243 scsi_setup_blk_pc_cmnd(cmd, 3);
1224 cmd->cmd_len = req->cmd_len;
1225 if (rq_data_dir(req) == WRITE)
1226 cmd->sc_data_direction = DMA_TO_DEVICE;
1227 else if (req->data_len)
1228 cmd->sc_data_direction = DMA_FROM_DEVICE;
1229 else
1230 cmd->sc_data_direction = DMA_NONE;
1231
1232 cmd->transfersize = req->data_len;
1233 cmd->allowed = 3;
1234 cmd->timeout_per_command = req->timeout;
1235 cmd->done = scsi_generic_done; 1244 cmd->done = scsi_generic_done;
1236 } 1245 }
1237 } 1246 }
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 94e5167f260d..4e6709f448e1 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -400,6 +400,36 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
400 return found_target; 400 return found_target;
401} 401}
402 402
403struct work_queue_wrapper {
404 struct work_struct work;
405 struct scsi_target *starget;
406};
407
408static void scsi_target_reap_work(void *data) {
409 struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data;
410 struct scsi_target *starget = wqw->starget;
411 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
412 unsigned long flags;
413
414 kfree(wqw);
415
416 spin_lock_irqsave(shost->host_lock, flags);
417
418 if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
419 list_del_init(&starget->siblings);
420 spin_unlock_irqrestore(shost->host_lock, flags);
421 transport_remove_device(&starget->dev);
422 device_del(&starget->dev);
423 transport_destroy_device(&starget->dev);
424 put_device(&starget->dev);
425 return;
426
427 }
428 spin_unlock_irqrestore(shost->host_lock, flags);
429
430 return;
431}
432
403/** 433/**
404 * scsi_target_reap - check to see if target is in use and destroy if not 434 * scsi_target_reap - check to see if target is in use and destroy if not
405 * 435 *
@@ -411,19 +441,18 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
411 */ 441 */
412void scsi_target_reap(struct scsi_target *starget) 442void scsi_target_reap(struct scsi_target *starget)
413{ 443{
414 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 444 struct work_queue_wrapper *wqw =
415 unsigned long flags; 445 kzalloc(sizeof(struct work_queue_wrapper), GFP_ATOMIC);
416 spin_lock_irqsave(shost->host_lock, flags);
417 446
418 if (--starget->reap_ref == 0 && list_empty(&starget->devices)) { 447 if (!wqw) {
419 list_del_init(&starget->siblings); 448 starget_printk(KERN_ERR, starget,
420 spin_unlock_irqrestore(shost->host_lock, flags); 449 "Failed to allocate memory in scsi_reap_target()\n");
421 device_del(&starget->dev);
422 transport_unregister_device(&starget->dev);
423 put_device(&starget->dev);
424 return; 450 return;
425 } 451 }
426 spin_unlock_irqrestore(shost->host_lock, flags); 452
453 INIT_WORK(&wqw->work, scsi_target_reap_work, wqw);
454 wqw->starget = starget;
455 schedule_work(&wqw->work);
427} 456}
428 457
429/** 458/**
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 6cd5931d9a54..2a1a99a2ef56 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -105,6 +105,7 @@ static struct {
105 { FC_PORTSTATE_LINKDOWN, "Linkdown" }, 105 { FC_PORTSTATE_LINKDOWN, "Linkdown" },
106 { FC_PORTSTATE_ERROR, "Error" }, 106 { FC_PORTSTATE_ERROR, "Error" },
107 { FC_PORTSTATE_LOOPBACK, "Loopback" }, 107 { FC_PORTSTATE_LOOPBACK, "Loopback" },
108 { FC_PORTSTATE_DELETED, "Deleted" },
108}; 109};
109fc_enum_name_search(port_state, fc_port_state, fc_port_state_names) 110fc_enum_name_search(port_state, fc_port_state, fc_port_state_names)
110#define FC_PORTSTATE_MAX_NAMELEN 20 111#define FC_PORTSTATE_MAX_NAMELEN 20
@@ -211,6 +212,7 @@ fc_bitfield_name_search(remote_port_roles, fc_remote_port_role_names)
211#define FC_MGMTSRVR_PORTID 0x00000a 212#define FC_MGMTSRVR_PORTID 0x00000a
212 213
213 214
215static void fc_shost_remove_rports(void *data);
214static void fc_timeout_deleted_rport(void *data); 216static void fc_timeout_deleted_rport(void *data);
215static void fc_scsi_scan_rport(void *data); 217static void fc_scsi_scan_rport(void *data);
216static void fc_rport_terminate(struct fc_rport *rport); 218static void fc_rport_terminate(struct fc_rport *rport);
@@ -318,6 +320,8 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
318 fc_host_next_rport_number(shost) = 0; 320 fc_host_next_rport_number(shost) = 0;
319 fc_host_next_target_id(shost) = 0; 321 fc_host_next_target_id(shost) = 0;
320 322
323 fc_host_flags(shost) = 0;
324 INIT_WORK(&fc_host_rport_del_work(shost), fc_shost_remove_rports, shost);
321 return 0; 325 return 0;
322} 326}
323 327
@@ -387,6 +391,7 @@ show_fc_rport_##field (struct class_device *cdev, char *buf) \
387 struct fc_internal *i = to_fc_internal(shost->transportt); \ 391 struct fc_internal *i = to_fc_internal(shost->transportt); \
388 if ((i->f->get_rport_##field) && \ 392 if ((i->f->get_rport_##field) && \
389 !((rport->port_state == FC_PORTSTATE_BLOCKED) || \ 393 !((rport->port_state == FC_PORTSTATE_BLOCKED) || \
394 (rport->port_state == FC_PORTSTATE_DELETED) || \
390 (rport->port_state == FC_PORTSTATE_NOTPRESENT))) \ 395 (rport->port_state == FC_PORTSTATE_NOTPRESENT))) \
391 i->f->get_rport_##field(rport); \ 396 i->f->get_rport_##field(rport); \
392 return snprintf(buf, sz, format_string, cast rport->field); \ 397 return snprintf(buf, sz, format_string, cast rport->field); \
@@ -402,6 +407,7 @@ store_fc_rport_##field(struct class_device *cdev, const char *buf, \
402 struct Scsi_Host *shost = rport_to_shost(rport); \ 407 struct Scsi_Host *shost = rport_to_shost(rport); \
403 struct fc_internal *i = to_fc_internal(shost->transportt); \ 408 struct fc_internal *i = to_fc_internal(shost->transportt); \
404 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || \ 409 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || \
410 (rport->port_state == FC_PORTSTATE_DELETED) || \
405 (rport->port_state == FC_PORTSTATE_NOTPRESENT)) \ 411 (rport->port_state == FC_PORTSTATE_NOTPRESENT)) \
406 return -EBUSY; \ 412 return -EBUSY; \
407 val = simple_strtoul(buf, NULL, 0); \ 413 val = simple_strtoul(buf, NULL, 0); \
@@ -519,6 +525,7 @@ store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf,
519 struct Scsi_Host *shost = rport_to_shost(rport); 525 struct Scsi_Host *shost = rport_to_shost(rport);
520 struct fc_internal *i = to_fc_internal(shost->transportt); 526 struct fc_internal *i = to_fc_internal(shost->transportt);
521 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || 527 if ((rport->port_state == FC_PORTSTATE_BLOCKED) ||
528 (rport->port_state == FC_PORTSTATE_DELETED) ||
522 (rport->port_state == FC_PORTSTATE_NOTPRESENT)) 529 (rport->port_state == FC_PORTSTATE_NOTPRESENT))
523 return -EBUSY; 530 return -EBUSY;
524 val = simple_strtoul(buf, NULL, 0); 531 val = simple_strtoul(buf, NULL, 0);
@@ -1769,7 +1776,7 @@ fc_timeout_deleted_rport(void *data)
1769 rport->maxframe_size = -1; 1776 rport->maxframe_size = -1;
1770 rport->supported_classes = FC_COS_UNSPECIFIED; 1777 rport->supported_classes = FC_COS_UNSPECIFIED;
1771 rport->roles = FC_RPORT_ROLE_UNKNOWN; 1778 rport->roles = FC_RPORT_ROLE_UNKNOWN;
1772 rport->port_state = FC_PORTSTATE_NOTPRESENT; 1779 rport->port_state = FC_PORTSTATE_DELETED;
1773 1780
1774 /* remove the identifiers that aren't used in the consisting binding */ 1781 /* remove the identifiers that aren't used in the consisting binding */
1775 switch (fc_host_tgtid_bind_type(shost)) { 1782 switch (fc_host_tgtid_bind_type(shost)) {
@@ -1789,14 +1796,23 @@ fc_timeout_deleted_rport(void *data)
1789 break; 1796 break;
1790 } 1797 }
1791 1798
1792 spin_unlock_irqrestore(shost->host_lock, flags);
1793
1794 /* 1799 /*
1795 * As this only occurs if the remote port (scsi target) 1800 * As this only occurs if the remote port (scsi target)
1796 * went away and didn't come back - we'll remove 1801 * went away and didn't come back - we'll remove
1797 * all attached scsi devices. 1802 * all attached scsi devices.
1803 *
1804 * We'll schedule the shost work item to perform the actual removal
1805 * to avoid recursion in the different flush calls if we perform
1806 * the removal in each target - and there are lots of targets
1807 * whose timeouts fire at the same time.
1798 */ 1808 */
1799 fc_rport_tgt_remove(rport); 1809
1810 if ( !(fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED)) {
1811 fc_host_flags(shost) |= FC_SHOST_RPORT_DEL_SCHEDULED;
1812 scsi_queue_work(shost, &fc_host_rport_del_work(shost));
1813 }
1814
1815 spin_unlock_irqrestore(shost->host_lock, flags);
1800} 1816}
1801 1817
1802/** 1818/**
@@ -1818,6 +1834,41 @@ fc_scsi_scan_rport(void *data)
1818} 1834}
1819 1835
1820 1836
1837/**
1838 * fc_shost_remove_rports - called to remove all rports that are marked
1839 * as in a deleted (not connected) state.
1840 *
1841 * @data: shost whose rports are to be looked at
1842 **/
1843static void
1844fc_shost_remove_rports(void *data)
1845{
1846 struct Scsi_Host *shost = (struct Scsi_Host *)data;
1847 struct fc_rport *rport, *next_rport;
1848 unsigned long flags;
1849
1850 spin_lock_irqsave(shost->host_lock, flags);
1851 while (fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED) {
1852
1853 fc_host_flags(shost) &= ~FC_SHOST_RPORT_DEL_SCHEDULED;
1854
1855restart_search:
1856 list_for_each_entry_safe(rport, next_rport,
1857 &fc_host_rport_bindings(shost), peers) {
1858 if (rport->port_state == FC_PORTSTATE_DELETED) {
1859 rport->port_state = FC_PORTSTATE_NOTPRESENT;
1860 spin_unlock_irqrestore(shost->host_lock, flags);
1861 fc_rport_tgt_remove(rport);
1862 spin_lock_irqsave(shost->host_lock, flags);
1863 goto restart_search;
1864 }
1865 }
1866
1867 }
1868 spin_unlock_irqrestore(shost->host_lock, flags);
1869}
1870
1871
1821MODULE_AUTHOR("Martin Hicks"); 1872MODULE_AUTHOR("Martin Hicks");
1822MODULE_DESCRIPTION("FC Transport Attributes"); 1873MODULE_DESCRIPTION("FC Transport Attributes");
1823MODULE_LICENSE("GPL"); 1874MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 49fd18c1a9c6..e08462d50c97 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -249,7 +249,7 @@ static inline struct list_head *skb_to_lh(struct sk_buff *skb)
249} 249}
250 250
251static void* 251static void*
252mempool_zone_alloc_skb(unsigned int gfp_mask, void *pool_data) 252mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data)
253{ 253{
254 struct mempool_zone *zone = pool_data; 254 struct mempool_zone *zone = pool_data;
255 255
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8613a1317712..03fcbab30033 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -245,24 +245,10 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
245 * SG_IO from block layer already setup, just copy cdb basically 245 * SG_IO from block layer already setup, just copy cdb basically
246 */ 246 */
247 if (blk_pc_request(rq)) { 247 if (blk_pc_request(rq)) {
248 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 248 scsi_setup_blk_pc_cmnd(SCpnt, SD_PASSTHROUGH_RETRIES);
249 return 0;
250
251 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
252 SCpnt->cmd_len = rq->cmd_len;
253 if (rq_data_dir(rq) == WRITE)
254 SCpnt->sc_data_direction = DMA_TO_DEVICE;
255 else if (rq->data_len)
256 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
257 else
258 SCpnt->sc_data_direction = DMA_NONE;
259
260 this_count = rq->data_len;
261 if (rq->timeout) 249 if (rq->timeout)
262 timeout = rq->timeout; 250 timeout = rq->timeout;
263 251
264 SCpnt->transfersize = rq->data_len;
265 SCpnt->allowed = SD_PASSTHROUGH_RETRIES;
266 goto queue; 252 goto queue;
267 } 253 }
268 254
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index d68cea753bb2..fb4012b5c188 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -320,25 +320,11 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
320 * these are already setup, just copy cdb basically 320 * these are already setup, just copy cdb basically
321 */ 321 */
322 if (SCpnt->request->flags & REQ_BLOCK_PC) { 322 if (SCpnt->request->flags & REQ_BLOCK_PC) {
323 struct request *rq = SCpnt->request; 323 scsi_setup_blk_pc_cmnd(SCpnt, MAX_RETRIES);
324 324
325 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 325 if (SCpnt->timeout_per_command)
326 return 0; 326 timeout = SCpnt->timeout_per_command;
327
328 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
329 SCpnt->cmd_len = rq->cmd_len;
330 if (!rq->data_len)
331 SCpnt->sc_data_direction = DMA_NONE;
332 else if (rq_data_dir(rq) == WRITE)
333 SCpnt->sc_data_direction = DMA_TO_DEVICE;
334 else
335 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
336
337 this_count = rq->data_len;
338 if (rq->timeout)
339 timeout = rq->timeout;
340 327
341 SCpnt->transfersize = rq->data_len;
342 goto queue; 328 goto queue;
343 } 329 }
344 330
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 7ac6ea141fff..dd592f6a2529 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4194,27 +4194,10 @@ static void st_intr(struct scsi_cmnd *SCpnt)
4194 */ 4194 */
4195static int st_init_command(struct scsi_cmnd *SCpnt) 4195static int st_init_command(struct scsi_cmnd *SCpnt)
4196{ 4196{
4197 struct request *rq;
4198
4199 if (!(SCpnt->request->flags & REQ_BLOCK_PC)) 4197 if (!(SCpnt->request->flags & REQ_BLOCK_PC))
4200 return 0; 4198 return 0;
4201 4199
4202 rq = SCpnt->request; 4200 scsi_setup_blk_pc_cmnd(SCpnt, 0);
4203 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd))
4204 return 0;
4205
4206 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
4207 SCpnt->cmd_len = rq->cmd_len;
4208
4209 if (rq_data_dir(rq) == WRITE)
4210 SCpnt->sc_data_direction = DMA_TO_DEVICE;
4211 else if (rq->data_len)
4212 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
4213 else
4214 SCpnt->sc_data_direction = DMA_NONE;
4215
4216 SCpnt->timeout_per_command = rq->timeout;
4217 SCpnt->transfersize = rq->data_len;
4218 SCpnt->done = st_intr; 4201 SCpnt->done = st_intr;
4219 return 1; 4202 return 1;
4220} 4203}
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index a7420cad4547..1564ca203a3e 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1405,7 +1405,6 @@ static void sym_check_goals(struct sym_hcb *np, struct scsi_target *starget,
1405 goal->iu = 0; 1405 goal->iu = 0;
1406 goal->dt = 0; 1406 goal->dt = 0;
1407 goal->qas = 0; 1407 goal->qas = 0;
1408 goal->period = 0;
1409 goal->offset = 0; 1408 goal->offset = 0;
1410 return; 1409 return;
1411 } 1410 }
@@ -1465,7 +1464,8 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp
1465 * Many devices implement PPR in a buggy way, so only use it if we 1464 * Many devices implement PPR in a buggy way, so only use it if we
1466 * really want to. 1465 * really want to.
1467 */ 1466 */
1468 if (goal->iu || goal->dt || goal->qas || (goal->period < 0xa)) { 1467 if (goal->offset &&
1468 (goal->iu || goal->dt || goal->qas || (goal->period < 0xa))) {
1469 nego = NS_PPR; 1469 nego = NS_PPR;
1470 } else if (spi_width(starget) != goal->width) { 1470 } else if (spi_width(starget) != goal->width) {
1471 nego = NS_WIDE; 1471 nego = NS_WIDE;
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index ad47c1b84c3f..812bae62c8ec 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -10,7 +10,7 @@ menu "Serial drivers"
10# The new 8250/16550 serial drivers 10# The new 8250/16550 serial drivers
11config SERIAL_8250 11config SERIAL_8250
12 tristate "8250/16550 and compatible serial support" 12 tristate "8250/16550 and compatible serial support"
13 depends on (BROKEN || !(SPARC64 || SPARC32)) 13 depends on (BROKEN || !SPARC)
14 select SERIAL_CORE 14 select SERIAL_CORE
15 ---help--- 15 ---help---
16 This selects whether you want to include the driver for the standard 16 This selects whether you want to include the driver for the standard
@@ -469,14 +469,14 @@ config SERIAL_IMX_CONSOLE
469 469
470config SERIAL_SUNCORE 470config SERIAL_SUNCORE
471 bool 471 bool
472 depends on SPARC32 || SPARC64 472 depends on SPARC
473 select SERIAL_CORE 473 select SERIAL_CORE
474 select SERIAL_CORE_CONSOLE 474 select SERIAL_CORE_CONSOLE
475 default y 475 default y
476 476
477config SERIAL_SUNZILOG 477config SERIAL_SUNZILOG
478 tristate "Sun Zilog8530 serial support" 478 tristate "Sun Zilog8530 serial support"
479 depends on SPARC32 || SPARC64 479 depends on SPARC
480 help 480 help
481 This driver supports the Zilog8530 serial ports found on many Sparc 481 This driver supports the Zilog8530 serial ports found on many Sparc
482 systems. Say Y or M if you want to be able to these serial ports. 482 systems. Say Y or M if you want to be able to these serial ports.
@@ -491,7 +491,7 @@ config SERIAL_SUNZILOG_CONSOLE
491 491
492config SERIAL_SUNSU 492config SERIAL_SUNSU
493 tristate "Sun SU serial support" 493 tristate "Sun SU serial support"
494 depends on (SPARC32 || SPARC64) && PCI 494 depends on SPARC && PCI
495 help 495 help
496 This driver supports the 8250 serial ports that run the keyboard and 496 This driver supports the 8250 serial ports that run the keyboard and
497 mouse on (PCI) UltraSPARC systems. Say Y or M if you want to be able 497 mouse on (PCI) UltraSPARC systems. Say Y or M if you want to be able
@@ -547,7 +547,7 @@ config PDC_CONSOLE
547 547
548config SERIAL_SUNSAB 548config SERIAL_SUNSAB
549 tristate "Sun Siemens SAB82532 serial support" 549 tristate "Sun Siemens SAB82532 serial support"
550 depends on (SPARC32 || SPARC64) && PCI 550 depends on SPARC && PCI
551 help 551 help
552 This driver supports the Siemens SAB82532 DUSCC serial ports on newer 552 This driver supports the Siemens SAB82532 DUSCC serial ports on newer
553 (PCI) UltraSPARC systems. Say Y or M if you want to be able to these 553 (PCI) UltraSPARC systems. Say Y or M if you want to be able to these
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 89d7bd3eaee3..d84476ee6592 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -160,7 +160,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
160 flag = TTY_FRAME; 160 flag = TTY_FRAME;
161 } 161 }
162 162
163 if (uart_handle_sysrq_char(&uap->port, ch, regs)) 163 if (uart_handle_sysrq_char(&uap->port, ch & 255, regs))
164 goto ignore_char; 164 goto ignore_char;
165 165
166 uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag); 166 uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag);
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index ff5e6309d682..cc998b99a19f 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -361,7 +361,7 @@ static int serial_pxa_startup(struct uart_port *port)
361 if (port->line == 3) /* HWUART */ 361 if (port->line == 3) /* HWUART */
362 up->mcr |= UART_MCR_AFE; 362 up->mcr |= UART_MCR_AFE;
363 else 363 else
364 up->mcr = 0; 364 up->mcr = 0;
365 365
366 /* 366 /*
367 * Allocate the IRQ 367 * Allocate the IRQ
@@ -641,7 +641,7 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count)
641 int i; 641 int i;
642 642
643 /* 643 /*
644 * First save the UER then disable the interrupts 644 * First save the IER then disable the interrupts
645 */ 645 */
646 ier = serial_in(up, UART_IER); 646 ier = serial_in(up, UART_IER);
647 serial_out(up, UART_IER, UART_IER_UUE); 647 serial_out(up, UART_IER, UART_IER_UUE);
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index e197ce9353de..e80ef9467825 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1432,7 +1432,8 @@ static int usb_generic_suspend(struct device *dev, pm_message_t message)
1432 mark_quiesced(intf); 1432 mark_quiesced(intf);
1433 } else { 1433 } else {
1434 // FIXME else if there's no suspend method, disconnect... 1434 // FIXME else if there's no suspend method, disconnect...
1435 dev_warn(dev, "no %s?\n", "suspend"); 1435 dev_warn(dev, "no suspend for driver %s?\n", driver->name);
1436 mark_quiesced(intf);
1436 status = 0; 1437 status = 0;
1437 } 1438 }
1438 return status; 1439 return status;
@@ -1460,8 +1461,10 @@ static int usb_generic_resume(struct device *dev)
1460 } 1461 }
1461 1462
1462 if ((dev->driver == NULL) || 1463 if ((dev->driver == NULL) ||
1463 (dev->driver_data == &usb_generic_driver_data)) 1464 (dev->driver_data == &usb_generic_driver_data)) {
1465 dev->power.power_state.event = PM_EVENT_FREEZE;
1464 return 0; 1466 return 0;
1467 }
1465 1468
1466 intf = to_usb_interface(dev); 1469 intf = to_usb_interface(dev);
1467 driver = to_usb_driver(dev->driver); 1470 driver = to_usb_driver(dev->driver);
@@ -1481,7 +1484,7 @@ static int usb_generic_resume(struct device *dev)
1481 mark_quiesced(intf); 1484 mark_quiesced(intf);
1482 } 1485 }
1483 } else 1486 } else
1484 dev_warn(dev, "no %s?\n", "resume"); 1487 dev_warn(dev, "no resume for driver %s?\n", driver->name);
1485 return 0; 1488 return 0;
1486} 1489}
1487 1490
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index ed550132db0b..79efaf7d86a3 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -717,6 +717,7 @@ static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message)
717 * at the source, so we must turn off PIRQ. 717 * at the source, so we must turn off PIRQ.
718 */ 718 */
719 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); 719 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
720 mb();
720 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 721 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
721 uhci->hc_inaccessible = 1; 722 uhci->hc_inaccessible = 1;
722 hcd->poll_rh = 0; 723 hcd->poll_rh = 0;
@@ -738,6 +739,7 @@ static int uhci_resume(struct usb_hcd *hcd)
738 * really don't want to keep a stale HCD_FLAG_HW_ACCESSIBLE=0 739 * really don't want to keep a stale HCD_FLAG_HW_ACCESSIBLE=0
739 */ 740 */
740 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 741 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
742 mb();
741 743
742 if (uhci->rh_state == UHCI_RH_RESET) /* Dead */ 744 if (uhci->rh_state == UHCI_RH_RESET) /* Dead */
743 return 0; 745 return 0;
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index 1c3b472a3bca..0e2505c073db 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -2103,7 +2103,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2103 * values. 2103 * values.
2104 */ 2104 */
2105 input_set_abs_params(inputdev, ABS_X, 0, 2999, 0, 0); 2105 input_set_abs_params(inputdev, ABS_X, 0, 2999, 0, 0);
2106 input_set_abs_params(inputdev, ABS_X, 0, 2249, 0, 0); 2106 input_set_abs_params(inputdev, ABS_Y, 0, 2249, 0, 0);
2107 input_set_abs_params(inputdev, ABS_PRESSURE, 0, 511, 0, 0); 2107 input_set_abs_params(inputdev, ABS_PRESSURE, 0, 511, 0, 0);
2108 input_set_abs_params(inputdev, ABS_TILT_X, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); 2108 input_set_abs_params(inputdev, ABS_TILT_X, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0);
2109 input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); 2109 input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0);
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 45f3130fadea..a3e44ef1df43 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -893,8 +893,10 @@ static int hid_input_report(int type, struct urb *urb, int interrupt, struct pt_
893 893
894 size = ((report->size - 1) >> 3) + 1; 894 size = ((report->size - 1) >> 3) + 1;
895 895
896 if (len < size) 896 if (len < size) {
897 dbg("report %d is too short, (%d < %d)", report->id, len, size); 897 dbg("report %d is too short, (%d < %d)", report->id, len, size);
898 memset(data + len, 0, size - len);
899 }
898 900
899 if (hid->claimed & HID_CLAIMED_HIDDEV) 901 if (hid->claimed & HID_CLAIMED_HIDDEV)
900 hiddev_report_event(hid, report); 902 hiddev_report_event(hid, report);
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
index 9ff25eb520a6..1220a5004a5c 100644
--- a/drivers/usb/input/hid-input.c
+++ b/drivers/usb/input/hid-input.c
@@ -137,6 +137,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
137 switch (usage->hid & 0xffff) { 137 switch (usage->hid & 0xffff) {
138 case 0xba: map_abs(ABS_RUDDER); break; 138 case 0xba: map_abs(ABS_RUDDER); break;
139 case 0xbb: map_abs(ABS_THROTTLE); break; 139 case 0xbb: map_abs(ABS_THROTTLE); break;
140 default: goto ignore;
140 } 141 }
141 break; 142 break;
142 143
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c
index a248664b5d1d..fd48e74e78ed 100644
--- a/drivers/usb/input/kbtab.c
+++ b/drivers/usb/input/kbtab.c
@@ -159,7 +159,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
159 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH); 159 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH);
160 input_dev->mscbit[0] |= BIT(MSC_SERIAL); 160 input_dev->mscbit[0] |= BIT(MSC_SERIAL);
161 input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0); 161 input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0);
162 input_set_abs_params(input_dev, ABS_X, 0, 0x1750, 4, 0); 162 input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0);
163 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0); 163 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0);
164 164
165 endpoint = &intf->cur_altsetting->endpoint[0].desc; 165 endpoint = &intf->cur_altsetting->endpoint[0].desc;
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c
index aea1cfae34cc..dc099bbe12bf 100644
--- a/drivers/usb/input/wacom.c
+++ b/drivers/usb/input/wacom.c
@@ -854,7 +854,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
854 854
855 input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS); 855 input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS);
856 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS); 856 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS);
857 input_set_abs_params(input_dev, ABS_X, 0, wacom->features->y_max, 4, 0); 857 input_set_abs_params(input_dev, ABS_X, 0, wacom->features->x_max, 4, 0);
858 input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0); 858 input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0);
859 input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0); 859 input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0);
860 860
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index 2a28ceeaa66a..b293db3c28c3 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -1696,7 +1696,7 @@ static ssize_t auerchar_write (struct file *file, const char __user *buf, size_t
1696 int ret; 1696 int ret;
1697 wait_queue_t wait; 1697 wait_queue_t wait;
1698 1698
1699 dbg ("auerchar_write %d bytes", len); 1699 dbg ("auerchar_write %zd bytes", len);
1700 1700
1701 /* Error checking */ 1701 /* Error checking */
1702 if (!ccp) 1702 if (!ccp)
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 4837524eada7..4ef5527028c5 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -109,7 +109,7 @@ static int slave_configure(struct scsi_device *sdev)
109 * data comes from. 109 * data comes from.
110 */ 110 */
111 if (sdev->scsi_level < SCSI_2) 111 if (sdev->scsi_level < SCSI_2)
112 sdev->scsi_level = SCSI_2; 112 sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
113 113
114 /* According to the technical support people at Genesys Logic, 114 /* According to the technical support people at Genesys Logic,
115 * devices using their chips have problems transferring more than 115 * devices using their chips have problems transferring more than
@@ -162,7 +162,7 @@ static int slave_configure(struct scsi_device *sdev)
162 * a Get-Max-LUN request, we won't lose much by setting the 162 * a Get-Max-LUN request, we won't lose much by setting the
163 * revision level down to 2. The only devices that would be 163 * revision level down to 2. The only devices that would be
164 * affected are those with sparse LUNs. */ 164 * affected are those with sparse LUNs. */
165 sdev->scsi_level = SCSI_2; 165 sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
166 166
167 /* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable 167 /* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable
168 * Hardware Error) when any low-level error occurs, 168 * Hardware Error) when any low-level error occurs,
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 3e470c8b4193..cc8e3bf5001b 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -536,13 +536,13 @@ config FB_SUN3
536 536
537config FB_SBUS 537config FB_SBUS
538 bool "SBUS and UPA framebuffers" 538 bool "SBUS and UPA framebuffers"
539 depends on (FB = y) && (SPARC32 || SPARC64) 539 depends on (FB = y) && SPARC
540 help 540 help
541 Say Y if you want support for SBUS or UPA based frame buffer device. 541 Say Y if you want support for SBUS or UPA based frame buffer device.
542 542
543config FB_BW2 543config FB_BW2
544 bool "BWtwo support" 544 bool "BWtwo support"
545 depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) 545 depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3)
546 select FB_CFB_FILLRECT 546 select FB_CFB_FILLRECT
547 select FB_CFB_COPYAREA 547 select FB_CFB_COPYAREA
548 select FB_CFB_IMAGEBLIT 548 select FB_CFB_IMAGEBLIT
@@ -551,7 +551,7 @@ config FB_BW2
551 551
552config FB_CG3 552config FB_CG3
553 bool "CGthree support" 553 bool "CGthree support"
554 depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) 554 depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3)
555 select FB_CFB_FILLRECT 555 select FB_CFB_FILLRECT
556 select FB_CFB_COPYAREA 556 select FB_CFB_COPYAREA
557 select FB_CFB_IMAGEBLIT 557 select FB_CFB_IMAGEBLIT
@@ -560,7 +560,7 @@ config FB_CG3
560 560
561config FB_CG6 561config FB_CG6
562 bool "CGsix (GX,TurboGX) support" 562 bool "CGsix (GX,TurboGX) support"
563 depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) 563 depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3)
564 select FB_CFB_COPYAREA 564 select FB_CFB_COPYAREA
565 select FB_CFB_IMAGEBLIT 565 select FB_CFB_IMAGEBLIT
566 help 566 help
@@ -1268,7 +1268,7 @@ config FB_LEO
1268 1268
1269config FB_PCI 1269config FB_PCI
1270 bool "PCI framebuffers" 1270 bool "PCI framebuffers"
1271 depends on (FB = y) && PCI && (SPARC64 || SPARC32) 1271 depends on (FB = y) && PCI && SPARC
1272 1272
1273config FB_IGA 1273config FB_IGA
1274 bool "IGA 168x display support" 1274 bool "IGA 168x display support"
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
index 080db812ca48..2784f0a9d693 100644
--- a/drivers/video/arcfb.c
+++ b/drivers/video/arcfb.c
@@ -441,7 +441,7 @@ static int arcfb_ioctl(struct inode *inode, struct file *file,
441 * the fb. it's inefficient for them to do anything less than 64*8 441 * the fb. it's inefficient for them to do anything less than 64*8
442 * writes since we update the lcd in each write() anyway. 442 * writes since we update the lcd in each write() anyway.
443 */ 443 */
444static ssize_t arcfb_write(struct file *file, const char *buf, size_t count, 444static ssize_t arcfb_write(struct file *file, const char __user *buf, size_t count,
445 loff_t *ppos) 445 loff_t *ppos)
446{ 446{
447 /* modded from epson 1355 */ 447 /* modded from epson 1355 */
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 5f74df993406..a5d09e159cd1 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -6,7 +6,7 @@ menu "Console display driver support"
6 6
7config VGA_CONSOLE 7config VGA_CONSOLE
8 bool "VGA text console" if EMBEDDED || !X86 8 bool "VGA text console" if EMBEDDED || !X86
9 depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC32 && !SPARC64 && !M68K && !PARISC && !ARCH_VERSATILE 9 depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !ARCH_VERSATILE
10 default y 10 default y
11 help 11 help
12 Saying Y here will allow you to use Linux in text mode through a 12 Saying Y here will allow you to use Linux in text mode through a
@@ -68,7 +68,7 @@ config SGI_NEWPORT_CONSOLE
68 68
69config PROM_CONSOLE 69config PROM_CONSOLE
70 bool "PROM console" 70 bool "PROM console"
71 depends on SPARC32 || SPARC64 71 depends on SPARC
72 help 72 help
73 Say Y to build a console driver for Sun machines that uses the 73 Say Y to build a console driver for Sun machines that uses the
74 terminal emulation built into their console PROMS. 74 terminal emulation built into their console PROMS.
@@ -136,7 +136,7 @@ config FONTS
136config FONT_8x8 136config FONT_8x8
137 bool "VGA 8x8 font" if FONTS 137 bool "VGA 8x8 font" if FONTS
138 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE 138 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
139 default y if !SPARC32 && !SPARC64 && !FONTS 139 default y if !SPARC && !FONTS
140 help 140 help
141 This is the "high resolution" font for the VGA frame buffer (the one 141 This is the "high resolution" font for the VGA frame buffer (the one
142 provided by the text console 80x50 (and higher) modes). 142 provided by the text console 80x50 (and higher) modes).
@@ -150,7 +150,7 @@ config FONT_8x8
150config FONT_8x16 150config FONT_8x16
151 bool "VGA 8x16 font" if FONTS 151 bool "VGA 8x16 font" if FONTS
152 depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y || STI_CONSOLE || USB_SISUSBVGA_CON 152 depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y || STI_CONSOLE || USB_SISUSBVGA_CON
153 default y if !SPARC32 && !SPARC64 && !FONTS 153 default y if !SPARC && !FONTS
154 help 154 help
155 This is the "high resolution" font for the VGA frame buffer (the one 155 This is the "high resolution" font for the VGA frame buffer (the one
156 provided by the VGA text console 80x25 mode. 156 provided by the VGA text console 80x25 mode.
@@ -160,7 +160,7 @@ config FONT_8x16
160config FONT_6x11 160config FONT_6x11
161 bool "Mac console 6x11 font (not supported by all drivers)" if FONTS 161 bool "Mac console 6x11 font (not supported by all drivers)" if FONTS
162 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE 162 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
163 default y if !SPARC32 && !SPARC64 && !FONTS && MAC 163 default y if !SPARC && !FONTS && MAC
164 help 164 help
165 Small console font with Macintosh-style high-half glyphs. Some Mac 165 Small console font with Macintosh-style high-half glyphs. Some Mac
166 framebuffer drivers don't support this one at all. 166 framebuffer drivers don't support this one at all.
@@ -176,7 +176,7 @@ config FONT_7x14
176config FONT_PEARL_8x8 176config FONT_PEARL_8x8
177 bool "Pearl (old m68k) console 8x8 font" if FONTS 177 bool "Pearl (old m68k) console 8x8 font" if FONTS
178 depends on FRAMEBUFFER_CONSOLE 178 depends on FRAMEBUFFER_CONSOLE
179 default y if !SPARC32 && !SPARC64 && !FONTS && AMIGA 179 default y if !SPARC && !FONTS && AMIGA
180 help 180 help
181 Small console font with PC-style control-character and high-half 181 Small console font with PC-style control-character and high-half
182 glyphs. 182 glyphs.
@@ -184,24 +184,24 @@ config FONT_PEARL_8x8
184config FONT_ACORN_8x8 184config FONT_ACORN_8x8
185 bool "Acorn console 8x8 font" if FONTS 185 bool "Acorn console 8x8 font" if FONTS
186 depends on FRAMEBUFFER_CONSOLE 186 depends on FRAMEBUFFER_CONSOLE
187 default y if !SPARC32 && !SPARC64 && !FONTS && ARM && ARCH_ACORN 187 default y if !SPARC && !FONTS && ARM && ARCH_ACORN
188 help 188 help
189 Small console font with PC-style control characters and high-half 189 Small console font with PC-style control characters and high-half
190 glyphs. 190 glyphs.
191 191
192config FONT_MINI_4x6 192config FONT_MINI_4x6
193 bool "Mini 4x6 font" 193 bool "Mini 4x6 font"
194 depends on !SPARC32 && !SPARC64 && FONTS 194 depends on !SPARC && FONTS
195 195
196config FONT_SUN8x16 196config FONT_SUN8x16
197 bool "Sparc console 8x16 font" 197 bool "Sparc console 8x16 font"
198 depends on FRAMEBUFFER_CONSOLE && (!SPARC32 && !SPARC64 && FONTS || SPARC32 || SPARC64) 198 depends on FRAMEBUFFER_CONSOLE && (!SPARC && FONTS || SPARC)
199 help 199 help
200 This is the high resolution console font for Sun machines. Say Y. 200 This is the high resolution console font for Sun machines. Say Y.
201 201
202config FONT_SUN12x22 202config FONT_SUN12x22
203 bool "Sparc console 12x22 font (not supported by all drivers)" 203 bool "Sparc console 12x22 font (not supported by all drivers)"
204 depends on FRAMEBUFFER_CONSOLE && (!SPARC32 && !SPARC64 && FONTS || SPARC32 || SPARC64) 204 depends on FRAMEBUFFER_CONSOLE && (!SPARC && FONTS || SPARC)
205 help 205 help
206 This is the high resolution console font for Sun machines with very 206 This is the high resolution console font for Sun machines with very
207 big letters (like the letters used in the SPARC PROM). If the 207 big letters (like the letters used in the SPARC PROM). If the
diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c
index c4d7c89212b4..9dd059e8b645 100644
--- a/drivers/video/console/fbcon_ud.c
+++ b/drivers/video/console/fbcon_ud.c
@@ -420,13 +420,15 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info,
420int ud_update_start(struct fb_info *info) 420int ud_update_start(struct fb_info *info)
421{ 421{
422 struct fbcon_ops *ops = info->fbcon_par; 422 struct fbcon_ops *ops = info->fbcon_par;
423 u32 xoffset, yoffset; 423 int xoffset, yoffset;
424 u32 vyres = GETVYRES(ops->p->scrollmode, info); 424 u32 vyres = GETVYRES(ops->p->scrollmode, info);
425 u32 vxres = GETVXRES(ops->p->scrollmode, info); 425 u32 vxres = GETVXRES(ops->p->scrollmode, info);
426 int err; 426 int err;
427 427
428 xoffset = (vxres - info->var.xres) - ops->var.xoffset; 428 xoffset = vxres - info->var.xres - ops->var.xoffset;
429 yoffset = (vyres - info->var.yres) - ops->var.yoffset; 429 yoffset = vyres - info->var.yres - ops->var.yoffset;
430 if (yoffset < 0)
431 yoffset += vyres;
430 ops->var.xoffset = xoffset; 432 ops->var.xoffset = xoffset;
431 ops->var.yoffset = yoffset; 433 ops->var.yoffset = yoffset;
432 err = fb_pan_display(info, &ops->var); 434 err = fb_pan_display(info, &ops->var);
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index c589d23e7f91..a9300f930ef2 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -1512,7 +1512,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
1512 * I/O cycles storing into a reserved memory space at 1512 * I/O cycles storing into a reserved memory space at
1513 * physical address 0x3000000 1513 * physical address 0x3000000
1514 */ 1514 */
1515 unsigned char *iop; 1515 unsigned char __iomem *iop;
1516 1516
1517 iop = ioremap(0x3000000, 0x5000); 1517 iop = ioremap(0x3000000, 0x5000);
1518 if (iop == NULL) { 1518 if (iop == NULL) {
@@ -1526,7 +1526,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
1526 writeb(EXT_BIU_MISC, iop + 0x3ce); 1526 writeb(EXT_BIU_MISC, iop + 0x3ce);
1527 writeb(EXT_BIU_MISC_LIN_ENABLE, iop + 0x3cf); 1527 writeb(EXT_BIU_MISC_LIN_ENABLE, iop + 0x3cf);
1528 1528
1529 iounmap((void *)iop); 1529 iounmap(iop);
1530#else 1530#else
1531 /* 1531 /*
1532 * Most other machine types are "normal", so 1532 * Most other machine types are "normal", so
diff --git a/drivers/video/intelfb/intelfb.h b/drivers/video/intelfb/intelfb.h
index f077ca34faba..da29d007f215 100644
--- a/drivers/video/intelfb/intelfb.h
+++ b/drivers/video/intelfb/intelfb.h
@@ -41,6 +41,10 @@
41 41
42/*** hw-related values ***/ 42/*** hw-related values ***/
43 43
44/* Resource Allocation */
45#define INTELFB_FB_ACQUIRED 1
46#define INTELFB_MMIO_ACQUIRED 2
47
44/* PCI ids for supported devices */ 48/* PCI ids for supported devices */
45#define PCI_DEVICE_ID_INTEL_830M 0x3577 49#define PCI_DEVICE_ID_INTEL_830M 0x3577
46#define PCI_DEVICE_ID_INTEL_845G 0x2562 50#define PCI_DEVICE_ID_INTEL_845G 0x2562
@@ -257,6 +261,7 @@ struct intelfb_info {
257 int hwcursor; 261 int hwcursor;
258 int fixed_mode; 262 int fixed_mode;
259 int ring_active; 263 int ring_active;
264 int flag;
260 265
261 /* hw cursor */ 266 /* hw cursor */
262 int cursor_on; 267 int cursor_on;
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 427689e584da..0090544842f5 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -135,9 +135,6 @@
135static void __devinit get_initial_mode(struct intelfb_info *dinfo); 135static void __devinit get_initial_mode(struct intelfb_info *dinfo);
136static void update_dinfo(struct intelfb_info *dinfo, 136static void update_dinfo(struct intelfb_info *dinfo,
137 struct fb_var_screeninfo *var); 137 struct fb_var_screeninfo *var);
138static int intelfb_get_fix(struct fb_fix_screeninfo *fix,
139 struct fb_info *info);
140
141static int intelfb_check_var(struct fb_var_screeninfo *var, 138static int intelfb_check_var(struct fb_var_screeninfo *var,
142 struct fb_info *info); 139 struct fb_info *info);
143static int intelfb_set_par(struct fb_info *info); 140static int intelfb_set_par(struct fb_info *info);
@@ -473,9 +470,9 @@ cleanup(struct intelfb_info *dinfo)
473 if (dinfo->aperture.virtual) 470 if (dinfo->aperture.virtual)
474 iounmap((void __iomem *)dinfo->aperture.virtual); 471 iounmap((void __iomem *)dinfo->aperture.virtual);
475 472
476 if (dinfo->mmio_base_phys) 473 if (dinfo->flag & INTELFB_MMIO_ACQUIRED)
477 release_mem_region(dinfo->mmio_base_phys, INTEL_REG_SIZE); 474 release_mem_region(dinfo->mmio_base_phys, INTEL_REG_SIZE);
478 if (dinfo->aperture.physical) 475 if (dinfo->flag & INTELFB_FB_ACQUIRED)
479 release_mem_region(dinfo->aperture.physical, 476 release_mem_region(dinfo->aperture.physical,
480 dinfo->aperture.size); 477 dinfo->aperture.size);
481 framebuffer_release(dinfo->info); 478 framebuffer_release(dinfo->info);
@@ -572,6 +569,9 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
572 cleanup(dinfo); 569 cleanup(dinfo);
573 return -ENODEV; 570 return -ENODEV;
574 } 571 }
572
573 dinfo->flag |= INTELFB_FB_ACQUIRED;
574
575 if (!request_mem_region(dinfo->mmio_base_phys, 575 if (!request_mem_region(dinfo->mmio_base_phys,
576 INTEL_REG_SIZE, 576 INTEL_REG_SIZE,
577 INTELFB_MODULE_NAME)) { 577 INTELFB_MODULE_NAME)) {
@@ -580,6 +580,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
580 return -ENODEV; 580 return -ENODEV;
581 } 581 }
582 582
583 dinfo->flag |= INTELFB_MMIO_ACQUIRED;
584
583 /* Get the chipset info. */ 585 /* Get the chipset info. */
584 dinfo->pci_chipset = pdev->device; 586 dinfo->pci_chipset = pdev->device;
585 587
@@ -1091,7 +1093,17 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo)
1091 return 1; 1093 return 1;
1092 1094
1093 info->pixmap.scan_align = 1; 1095 info->pixmap.scan_align = 1;
1094 1096 strcpy(info->fix.id, dinfo->name);
1097 info->fix.smem_start = dinfo->fb.physical;
1098 info->fix.smem_len = dinfo->fb.size;
1099 info->fix.type = FB_TYPE_PACKED_PIXELS;
1100 info->fix.type_aux = 0;
1101 info->fix.xpanstep = 8;
1102 info->fix.ypanstep = 1;
1103 info->fix.ywrapstep = 0;
1104 info->fix.mmio_start = dinfo->mmio_base_phys;
1105 info->fix.mmio_len = INTEL_REG_SIZE;
1106 info->fix.accel = FB_ACCEL_I830;
1095 update_dinfo(dinfo, &info->var); 1107 update_dinfo(dinfo, &info->var);
1096 1108
1097 return 0; 1109 return 0;
@@ -1109,7 +1121,8 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
1109 dinfo->yres = var->xres; 1121 dinfo->yres = var->xres;
1110 dinfo->pixclock = var->pixclock; 1122 dinfo->pixclock = var->pixclock;
1111 1123
1112 intelfb_get_fix(&dinfo->info->fix, dinfo->info); 1124 dinfo->info->fix.visual = dinfo->visual;
1125 dinfo->info->fix.line_length = dinfo->pitch;
1113 1126
1114 switch (dinfo->bpp) { 1127 switch (dinfo->bpp) {
1115 case 8: 1128 case 8:
@@ -1139,30 +1152,6 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
1139 1152
1140/* fbops functions */ 1153/* fbops functions */
1141 1154
1142static int
1143intelfb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info)
1144{
1145 struct intelfb_info *dinfo = GET_DINFO(info);
1146
1147 DBG_MSG("intelfb_get_fix\n");
1148
1149 memset(fix, 0, sizeof(*fix));
1150 strcpy(fix->id, dinfo->name);
1151 fix->smem_start = dinfo->fb.physical;
1152 fix->smem_len = dinfo->fb.size;
1153 fix->type = FB_TYPE_PACKED_PIXELS;
1154 fix->type_aux = 0;
1155 fix->visual = dinfo->visual;
1156 fix->xpanstep = 8;
1157 fix->ypanstep = 1;
1158 fix->ywrapstep = 0;
1159 fix->line_length = dinfo->pitch;
1160 fix->mmio_start = dinfo->mmio_base_phys;
1161 fix->mmio_len = INTEL_REG_SIZE;
1162 fix->accel = FB_ACCEL_I830;
1163 return 0;
1164}
1165
1166/*************************************************************** 1155/***************************************************************
1167 * fbdev interface * 1156 * fbdev interface *
1168 ***************************************************************/ 1157 ***************************************************************/
diff --git a/drivers/video/logo/Kconfig b/drivers/video/logo/Kconfig
index 8cb7fb4db441..f0e6512c87ff 100644
--- a/drivers/video/logo/Kconfig
+++ b/drivers/video/logo/Kconfig
@@ -47,7 +47,7 @@ config LOGO_SGI_CLUT224
47 47
48config LOGO_SUN_CLUT224 48config LOGO_SUN_CLUT224
49 bool "224-color Sun Linux logo" 49 bool "224-color Sun Linux logo"
50 depends on LOGO && (SPARC32 || SPARC64) 50 depends on LOGO && SPARC
51 default y 51 default y
52 52
53config LOGO_SUPERH_MONO 53config LOGO_SUPERH_MONO
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 7b4cd250bec8..9fc10b9e6f57 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1396,7 +1396,8 @@ static struct platform_driver pxafb_driver = {
1396int __devinit pxafb_setup(char *options) 1396int __devinit pxafb_setup(char *options)
1397{ 1397{
1398# ifdef CONFIG_FB_PXA_PARAMETERS 1398# ifdef CONFIG_FB_PXA_PARAMETERS
1399 strlcpy(g_options, options, sizeof(g_options)); 1399 if (options)
1400 strlcpy(g_options, options, sizeof(g_options));
1400# endif 1401# endif
1401 return 0; 1402 return 0;
1402} 1403}
diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c
index 646c43f921c5..3a74a63dd4f2 100644
--- a/drivers/video/sbuslib.c
+++ b/drivers/video/sbuslib.c
@@ -46,6 +46,9 @@ int sbusfb_mmap_helper(struct sbus_mmap_map *map,
46 unsigned long off; 46 unsigned long off;
47 int i; 47 int i;
48 48
49 if (!(vma->vm_flags & (VM_SHARED | VM_MAYSHARE)))
50 return -EINVAL;
51
49 size = vma->vm_end - vma->vm_start; 52 size = vma->vm_end - vma->vm_start;
50 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) 53 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
51 return -EINVAL; 54 return -EINVAL;