diff -urpN --exclude-from=/home/davej/.exclude bk-linus/Documentation/arm/README linux-2.5/Documentation/arm/README --- bk-linus/Documentation/arm/README 2002-11-21 02:08:28.000000000 +0000 +++ linux-2.5/Documentation/arm/README 2002-11-21 17:54:16.000000000 +0000 @@ -7,8 +7,8 @@ Compilation of kernel --------------------- In order to compile ARM Linux, you will need a compiler capable of - generating ARM ELF code with GNU extensions. GCC 2.95.1 and EGCS 1.1.2 - are good compilers. + generating ARM ELF code with GNU extensions. GCC 2.95.3 is a good + compiler. To build ARM Linux natively, you shouldn't have to alter the ARCH = line in the top level Makefile. However, if you don't have the ARM Linux ELF diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/kernel.h linux-2.5/include/linux/kernel.h --- bk-linus/include/linux/kernel.h 2002-11-21 02:23:56.000000000 +0000 +++ linux-2.5/include/linux/kernel.h 2002-11-21 18:04:46.000000000 +0000 @@ -40,7 +40,7 @@ struct completion; -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP void __might_sleep(char *file, int line); #define might_sleep() __might_sleep(__FILE__, __LINE__) #else diff -urpN --exclude-from=/home/davej/.exclude bk-linus/kernel/sched.c linux-2.5/kernel/sched.c --- bk-linus/kernel/sched.c 2002-11-21 02:24:37.000000000 +0000 +++ linux-2.5/kernel/sched.c 2002-11-21 18:05:17.000000000 +0000 @@ -2233,7 +2233,7 @@ void __init sched_init(void) enter_lazy_tlb(&init_mm, current, smp_processor_id()); } -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP void __might_sleep(char *file, int line) { #if defined(in_atomic) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/kernel/ksyms.c linux-2.5/kernel/ksyms.c --- bk-linus/kernel/ksyms.c 2002-11-21 02:24:37.000000000 +0000 +++ linux-2.5/kernel/ksyms.c 2002-11-21 18:05:17.000000000 +0000 @@ -481,7 +481,7 @@ EXPORT_SYMBOL(jiffies_64); EXPORT_SYMBOL(xtime); EXPORT_SYMBOL(do_gettimeofday); EXPORT_SYMBOL(do_settimeofday); -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP EXPORT_SYMBOL(__might_sleep); #endif #if !defined(__ia64__) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/Kconfig linux-2.5/arch/i386/Kconfig --- bk-linus/arch/i386/Kconfig 2002-11-21 02:09:27.000000000 +0000 +++ linux-2.5/arch/i386/Kconfig 2002-11-21 18:23:48.000000000 +0000 @@ -1612,6 +1628,12 @@ symbolic stack backtraces. This increases the size of the kernel somewhat, as all symbols have to be loaded into the kernel image. +config DEBUG_SPINLOCK_SLEEP + bool "Sleep-inside-spinlock checking" + help + If you say Y here, various routines which may sleep will become very + noisy if they are called with a spinlock held. + config X86_EXTRA_IRQS bool depends on X86_LOCAL_APIC diff -urpN --exclude-from=/home/davej/.exclude bk-linus/Makefile linux-2.5/Makefile --- bk-linus/Makefile 2002-11-21 02:07:06.000000000 +0000 +++ linux-2.5/Makefile 2002-11-21 17:53:01.000000000 +0000 @@ -168,7 +168,10 @@ NOSTDINC_FLAGS = -nostdinc -iwithprefix CPPFLAGS := -D__KERNEL__ -Iinclude CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \ - -fomit-frame-pointer -fno-strict-aliasing -fno-common + -fno-strict-aliasing -fno-common +ifndef CONFIG_FRAME_POINTER +CFLAGS += -fomit-frame-pointer +endif AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS) export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/Kconfig linux-2.5/arch/i386/Kconfig --- bk-linus/arch/i386/Kconfig 2002-11-21 02:09:27.000000000 +0000 +++ linux-2.5/arch/i386/Kconfig 2002-11-21 18:23:48.000000000 +0000 @@ -1612,6 +1628,14 @@ symbolic stack backtraces. This increases the size of the kernel somewhat, as all symbols have to be loaded into the kernel image. +config FRAME_POINTER + bool "Compile the kernel with frame pointers" + help + If you say Y here the resulting kernel image will be slightly larger + and slower, but it will give very useful debugging information. + If you don't debug the kernel, you can say N, but we may not be able + to solve problems without frame pointers. + config X86_EXTRA_IRQS bool depends on X86_LOCAL_APIC diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/kernel/semaphore.c linux-2.5/arch/i386/kernel/semaphore.c --- bk-linus/arch/i386/kernel/semaphore.c 2002-11-21 02:09:31.000000000 +0000 +++ linux-2.5/arch/i386/kernel/semaphore.c 2002-11-21 17:55:02.000000000 +0000 @@ -191,6 +191,10 @@ asm( ".align 4\n" ".globl __down_failed\n" "__down_failed:\n\t" +#if defined(CONFIG_FRAME_POINTER) + "pushl %ebp\n\t" + "movl %esp,%ebp\n\t" +#endif "pushl %eax\n\t" "pushl %edx\n\t" "pushl %ecx\n\t" @@ -198,6 +202,10 @@ asm( "popl %ecx\n\t" "popl %edx\n\t" "popl %eax\n\t" +#if defined(CONFIG_FRAME_POINTER) + "movl %ebp,%esp\n\t" + "popl %ebp\n\t" +#endif "ret" ); @@ -206,11 +214,19 @@ asm( ".align 4\n" ".globl __down_failed_interruptible\n" "__down_failed_interruptible:\n\t" +#if defined(CONFIG_FRAME_POINTER) + "pushl %ebp\n\t" + "movl %esp,%ebp\n\t" +#endif "pushl %edx\n\t" "pushl %ecx\n\t" "call __down_interruptible\n\t" "popl %ecx\n\t" "popl %edx\n\t" +#if defined(CONFIG_FRAME_POINTER) + "movl %ebp,%esp\n\t" + "popl %ebp\n\t" +#endif "ret" ); @@ -219,11 +235,19 @@ asm( ".align 4\n" ".globl __down_failed_trylock\n" "__down_failed_trylock:\n\t" +#if defined(CONFIG_FRAME_POINTER) + "pushl %ebp\n\t" + "movl %esp,%ebp\n\t" +#endif "pushl %edx\n\t" "pushl %ecx\n\t" "call __down_trylock\n\t" "popl %ecx\n\t" "popl %edx\n\t" +#if defined(CONFIG_FRAME_POINTER) + "movl %ebp,%esp\n\t" + "popl %ebp\n\t" +#endif "ret" ); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/CREDITS linux-2.5/CREDITS --- bk-linus/CREDITS 2002-11-21 02:06:57.000000000 +0000 +++ linux-2.5/CREDITS 2002-11-21 17:52:55.000000000 +0000 @@ -1720,6 +1721,7 @@ S: USA N: Denis O. Kropp E: dok@directfb.org D: NeoMagic framebuffer driver +D: CyberPro 32 bit support, fixes S: Badensche Str. 46 S: 10715 Berlin S: Germany @@ -2827,6 +2829,19 @@ S: Klosterweg 28 / i309 S: 76131 Karlsruhe S: Germany +N: James Simmons +E: jsimmons@users.sf.net +D: Frame buffer device maintainer +D: input layer developement +D: tty/console layer +D: various mipsel devices +S: 115 Carmel Avenue +S: El Cerrito CA 94530 +S: USA + +N: Chris Vance +E: cvance@tislabs.com + N: Jaspreet Singh E: jaspreet@sangoma.com W: www.sangoma.com diff -urpN --exclude-from=/home/davej/.exclude bk-linus/MAINTAINERS linux-2.5/MAINTAINERS --- bk-linus/MAINTAINERS 2002-11-21 02:07:06.000000000 +0000 +++ linux-2.5/MAINTAINERS 2002-11-21 17:53:01.000000000 +0000 @@ -637,6 +637,13 @@ M: kevin.curtis@farsite.co.uk W: http://www.farsite.co.uk/ S: Supported +FRAMEBUFFER LAYER +P: James Simmons, Geert Uytterhoeven +M: jsimmons@users.sf.net, geert@linux-m68k.org +L: linux-fbdev-devel@lists.sourceforge.net +W: http://www.linux-fbdev.org +S: Supported + FILE LOCKING (flock() and fcntl()/lockf()) P: Matthew Wilcox M: matthew@wil.cx @@ -1358,6 +1365,20 @@ M: tsbogend@alpha.franken.de L: linux-net@vger.kernel.org S: Maintained +PERMEDIA 3 FRAMEBUFFER DRIVER +P: Romain Dolbeau +M: dolbeau@irisa.fr +L: linux-fbdev-devel@lists.sourceforge.net +W: http://www.irisa.fr/prive/dolbeau/pm3fb/pm3fb.html +S: Maintained + +PHILIPS NINO PALM PC +P: Steven Hill +M: sjhill@realitydiluted.com +L: linux-mips@linux-mips.org +W: http://www.realitydiluted.com/projects/nino +S: Maintained + PNP SUPPORT P: Adam Belay M: ambx1@neo.rr.com @@ -1469,6 +1490,11 @@ M: emoenke@gwdg.de L: linux-kernel@vger.kernel.org S: Maintained +SC1200 WDT DRIVER +P: Zwane Mwaikambo +M: zwane@commfireservices.com +S: Maintained + SCHEDULER P: Ingo Molnar M: mingo@elte.hu @@ -1655,6 +1681,13 @@ P: Christoph Hellwig M: hch@infradead.org S: Maintained +TIEMAN VOYAGER USB BRAILLE DISPLAY DRIVER +P: Stephane Dalton +M: sdalton@videotron.ca +P: Stéphane Doyon +M: s.doyon@videotron.ca +S: Maintained + TI GRAPH LINK USB (SilverLink) CABLE DRIVER P: Romain Lievin M: roms@lpg.ticalc.org @@ -1862,6 +1895,13 @@ L: linux-usb-devel@lists.sourceforge.net W: http://www.beattie-home.net/linux S: Maintained +USB RTL8150 DRIVER +P: Petko Manolov +M: petkan@users.sourceforge.net +L: linux-usb-users@lists.sourceforge.net +L: linux-usb-devel@lists.sourceforge.net +S: Maintained + USB SE401 DRIVER P: Jeroen Vreeken M: pe1rxq@amsat.org To: torvalds@transmeta.com From: davej@suse.de Subject: Credits update We moved offices.. diff -urpN --exclude-from=/home/davej/.exclude bk-linus/CREDITS linux-2.5/CREDITS --- bk-linus/CREDITS 2002-11-21 02:06:57.000000000 +0000 +++ linux-2.5/CREDITS 2002-11-21 17:52:55.000000000 +0000 @@ -1507,16 +1507,17 @@ S: Chapel Hill, North Carolina 27514-481 S: USA N: Dave Jones +E: davej@codemonkey.org.uk E: davej@suse.de W: http://www.codemonkey.org.uk D: x86 errata/setup maintenance. D: Backport/Forwardport merge monkey. D: Various Janitor work. S: c/o SuSE Linux UK Ltd -S: The Kinetic Centre -S: Theobald Street -S: Borehamwood -S: Herts, WD6 4PJ +S: Appleton House +S: 139 King Street +S: Hammersmith +S: W6 9JG S: United Kingdom N: Ani Joshi diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/aic7xxx/aic7770.c linux-2.5/drivers/scsi/aic7xxx/aic7770.c --- bk-linus/drivers/scsi/aic7xxx/aic7770.c 2002-11-21 02:18:32.000000000 +0000 +++ linux-2.5/drivers/scsi/aic7xxx/aic7770.c 2002-11-21 18:01:02.000000000 +0000 @@ -50,6 +50,7 @@ #define ID_AHA_274x 0x04907771 #define ID_AHA_284xB 0x04907756 /* BIOS enabled */ #define ID_AHA_284x 0x04907757 /* BIOS disabled*/ +#define ID_AIC_7782 0x04907782 static void aha2840_load_seeprom(struct ahc_softc *ahc); static ahc_device_setup_t ahc_aic7770_VL_setup; @@ -77,6 +78,13 @@ struct aic7770_identity aic7770_ident_ta 0xFFFFFFFF, "Adaptec aic7770 SCSI adapter", ahc_aic7770_EISA_setup + }, + { + /* (Olivetti 2 channel EISA) */ + ID_AIC_7782, + 0xFFFFFFFF, + "Adaptec aic7782 SCSI adapter", + ahc_aic7770_EISA_setup } }; const int ahc_num_aic7770_devs = NUM_ELEMENTS(aic7770_ident_table); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/amd7xx_tco.c linux-2.5/drivers/char/amd7xx_tco.c --- bk-linus/drivers/char/amd7xx_tco.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5/drivers/char/amd7xx_tco.c 2002-11-21 17:57:37.000000000 +0000 @@ -0,0 +1,377 @@ +/* + * AMD 766/768 TCO Timer Driver + * (c) Copyright 2002 Zwane Mwaikambo + * All Rights Reserved. + * + * Parts from; + * Hardware driver for the AMD 768 Random Number Generator (RNG) + * (c) Copyright 2001 Red Hat Inc + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * The author(s) of this software shall not be held liable for damages + * of any nature resulting due to the use of this software. This + * software is provided AS-IS with no warranties. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AMDTCO_MODULE_VER "build 20020601" +#define AMDTCO_MODULE_NAME "amd7xx_tco" +#define PFX AMDTCO_MODULE_NAME ": " + +#define MAX_TIMEOUT 38 /* max of 38 seconds */ + +/* pmbase registers */ +#define GLOBAL_SMI_REG 0x2a +#define TCO_EN (1 << 1) /* bit 1 in global SMI register */ +#define TCO_RELOAD_REG 0x40 /* bits 0-5 are current count, 6-7 are reserved */ +#define TCO_INITVAL_REG 0x41 /* bits 0-5 are value to load, 6-7 are reserved */ +#define TCO_TIMEOUT_MASK 0x3f +#define TCO_STATUS2_REG 0x46 +#define NDTO_STS2 (1 << 1) /* we're interested in the second timeout */ +#define BOOT_STS (1 << 2) /* will be set if NDTO_STS2 was set before reboot */ +#define TCO_CTRL1_REG 0x48 +#define TCO_HALT (1 << 11) + +static char banner[] __initdata = KERN_INFO PFX AMDTCO_MODULE_VER; +static int timeout = 38; +static u32 pmbase; /* PMxx I/O base */ +static struct pci_dev *dev; +static struct semaphore open_sem; +spinlock_t amdtco_lock; /* only for device access */ +static int expect_close = 0; + +MODULE_PARM(timeout, "i"); +MODULE_PARM_DESC(timeout, "range is 0-38 seconds, default is 38"); + +static inline int amdtco_status(void) +{ + u16 reg; + int status = 0; + + reg = inb(pmbase+TCO_CTRL1_REG); + if ((reg & TCO_HALT) == 0) + status |= WDIOF_KEEPALIVEPING; + + reg = inb(pmbase+TCO_STATUS2_REG); + if (reg & BOOT_STS) + status |= WDIOF_CARDRESET; + + return status; +} + +static inline void amdtco_ping(void) +{ + u8 reg; + + spin_lock(&amdtco_lock); + reg = inb(pmbase+TCO_RELOAD_REG); + outb(1 | reg, pmbase+TCO_RELOAD_REG); + spin_unlock(&amdtco_lock); +} + +static inline int amdtco_gettimeout(void) +{ + return inb(TCO_RELOAD_REG) & TCO_TIMEOUT_MASK; +} + +static inline void amdtco_settimeout(unsigned int timeout) +{ + u8 reg; + + spin_lock(&amdtco_lock); + reg = inb(pmbase+TCO_INITVAL_REG); + reg |= timeout & TCO_TIMEOUT_MASK; + outb(reg, pmbase+TCO_INITVAL_REG); + spin_unlock(&amdtco_lock); +} + +static inline void amdtco_global_enable(void) +{ + u16 reg; + + spin_lock(&amdtco_lock); + reg = inw(pmbase+GLOBAL_SMI_REG); + reg |= TCO_EN; + outw(reg, pmbase+GLOBAL_SMI_REG); + spin_unlock(&amdtco_lock); +} + +static inline void amdtco_enable(void) +{ + u16 reg; + + spin_lock(&amdtco_lock); + reg = inw(pmbase+TCO_CTRL1_REG); + reg &= ~TCO_HALT; + outw(reg, pmbase+TCO_CTRL1_REG); + spin_unlock(&amdtco_lock); +} + +static inline void amdtco_disable(void) +{ + u16 reg; + + spin_lock(&amdtco_lock); + reg = inw(pmbase+TCO_CTRL1_REG); + reg |= TCO_HALT; + outw(reg, pmbase+TCO_CTRL1_REG); + spin_unlock(&amdtco_lock); +} + +static int amdtco_fop_open(struct inode *inode, struct file *file) +{ + if (down_trylock(&open_sem)) + return -EBUSY; + +#ifdef CONFIG_WATCHDOG_NOWAYOUT + MOD_INC_USE_COUNT; +#endif + + if (timeout > MAX_TIMEOUT) + timeout = MAX_TIMEOUT; + + amdtco_settimeout(timeout); + amdtco_global_enable(); + amdtco_ping(); + printk(KERN_INFO PFX "Watchdog enabled, timeout = %d/%d seconds", + amdtco_gettimeout(), timeout); + + return 0; +} + + +static int amdtco_fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +{ + int new_timeout; + int tmp; + + static struct watchdog_info ident = { + options: WDIOF_SETTIMEOUT | WDIOF_CARDRESET, + identity: "AMD 766/768" + }; + + switch (cmd) { + default: + return -ENOTTY; + + case WDIOC_GETSUPPORT: + if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof ident)) + return -EFAULT; + return 0; + + case WDIOC_GETSTATUS: + return put_user(amdtco_status(), (int *)arg); + + case WDIOC_KEEPALIVE: + amdtco_ping(); + return 0; + + case WDIOC_SETTIMEOUT: + if (get_user(new_timeout, (int *)arg)) + return -EFAULT; + + if (new_timeout < 0) + return -EINVAL; + + if (new_timeout > MAX_TIMEOUT) + new_timeout = MAX_TIMEOUT; + + timeout = new_timeout; + amdtco_settimeout(timeout); + /* fall through and return the new timeout */ + + case WDIOC_GETTIMEOUT: + return put_user(amdtco_gettimeout(), (int *)arg); + + case WDIOC_SETOPTIONS: + if (copy_from_user(&tmp, (int *)arg, sizeof tmp)) + return -EFAULT; + + if (tmp & WDIOS_DISABLECARD) + amdtco_disable(); + + if (tmp & WDIOS_ENABLECARD) + amdtco_enable(); + + return 0; + } +} + + +static int amdtco_fop_release(struct inode *inode, struct file *file) +{ + if (expect_close) { + amdtco_disable(); + printk(KERN_INFO PFX "Watchdog disabled\n"); + } else { + amdtco_ping(); + printk(KERN_CRIT PFX "Unexpected close!, timeout in %d seconds)\n", timeout); + } + + up(&open_sem); + return 0; +} + + +static ssize_t amdtco_fop_write(struct file *file, const char *data, size_t len, loff_t *ppos) +{ + if (ppos != &file->f_pos) + return -ESPIPE; + + if (len) { +#ifndef CONFIG_WATCHDOG_NOWAYOUT + size_t i; + char c; + expect_close = 0; + + for (i = 0; i != len; i++) { + if (get_user(c, data + i)) + return -EFAULT; + + if (c == 'V') + expect_close = 1; + } +#endif + amdtco_ping(); + return len; + } + + return 0; +} + + +static int amdtco_notify_sys(struct notifier_block *this, unsigned long code, void *unused) +{ + if (code == SYS_DOWN || code == SYS_HALT) + amdtco_disable(); + + return NOTIFY_DONE; +} + + +static struct notifier_block amdtco_notifier = +{ + notifier_call: amdtco_notify_sys +}; + +static struct file_operations amdtco_fops = +{ + owner: THIS_MODULE, + write: amdtco_fop_write, + ioctl: amdtco_fop_ioctl, + open: amdtco_fop_open, + release: amdtco_fop_release +}; + +static struct miscdevice amdtco_miscdev = +{ + minor: WATCHDOG_MINOR, + name: "watchdog", + fops: &amdtco_fops +}; + +static struct pci_device_id amdtco_pci_tbl[] __initdata = { + /* AMD 766 PCI_IDs here */ + { 0x1022, 0x7443, PCI_ANY_ID, PCI_ANY_ID, }, + { 0, } +}; + +MODULE_DEVICE_TABLE (pci, amdtco_pci_tbl); + +static int __init amdtco_init(void) +{ + int ret; + + sema_init(&open_sem, 1); + spin_lock_init(&amdtco_lock); + + pci_for_each_dev(dev) { + if (pci_match_device (amdtco_pci_tbl, dev) != NULL) + goto found_one; + } + + return -ENODEV; + +found_one: + + if ((ret = register_reboot_notifier(&amdtco_notifier))) { + printk(KERN_ERR PFX "Unable to register reboot notifier err = %d\n", ret); + goto out_clean; + } + + if ((ret = misc_register(&amdtco_miscdev))) { + printk(KERN_ERR PFX "Unable to register miscdev on minor %d\n", WATCHDOG_MINOR); + goto out_unreg_reboot; + } + + pci_read_config_dword(dev, 0x58, &pmbase); + pmbase &= 0x0000FF00; + + if (pmbase == 0) { + printk (KERN_ERR PFX "power management base not set\n"); + ret = -EIO; + goto out_unreg_misc; + } + + /* ret = 0; */ + printk(banner); + goto out_clean; + +out_unreg_misc: + misc_deregister(&amdtco_miscdev); +out_unreg_reboot: + unregister_reboot_notifier(&amdtco_notifier); +out_clean: + return ret; +} + +static void __exit amdtco_exit(void) +{ + misc_deregister(&amdtco_miscdev); + unregister_reboot_notifier(&amdtco_notifier); +} + + +#ifndef MODULE +static int __init amdtco_setup(char *str) +{ + int ints[4]; + + str = get_options (str, ARRAY_SIZE(ints), ints); + if (ints[0] > 0) + timeout = ints[1]; + + return 1; +} + +__setup("amd7xx_tco=", amdtco_setup); +#endif + +module_init(amdtco_init); +module_exit(amdtco_exit); + +MODULE_AUTHOR("Zwane Mwaikambo "); +MODULE_DESCRIPTION("AMD 766/768 TCO Timer Driver"); +MODULE_LICENSE("GPL"); +EXPORT_NO_SYMBOLS; + diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/kernel/cpu/amd.c linux-2.5/arch/i386/kernel/cpu/amd.c --- bk-linus/arch/i386/kernel/cpu/amd.c 2002-11-21 02:09:31.000000000 +0000 +++ linux-2.5/arch/i386/kernel/cpu/amd.c 2002-11-21 17:55:03.000000000 +0000 @@ -164,12 +164,23 @@ static void __init init_amd(struct cpuin set_bit(X86_FEATURE_XMM, c->x86_capability); } } - break; + /* It's been determined by AMD that Athlons since model 8 stepping 1 + * are more robust with CLK_CTL set to 200xxxxx instead of 600xxxxx + * As per AMD technical note 27212 0.2 + */ + if ((c->x86_model == 8 && c->x86_mask>=1) || (c->x86_model > 8)) { + rdmsr(MSR_K7_CLK_CTL, l, h); + if ((l & 0xfff00000) != 0x20000000) { + printk ("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n", l, + ((l & 0x000fffff)|0x20000000)); + wrmsr(MSR_K7_CLK_CTL, (l & 0x000fffff)|0x20000000, h); + } + } + break; } display_cacheinfo(c); -// return r; } static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-i386/msr.h linux-2.5/include/asm-i386/msr.h --- bk-linus/include/asm-i386/msr.h 2002-11-21 02:21:51.000000000 +0000 +++ linux-2.5/include/asm-i386/msr.h 2002-11-21 18:03:23.000000000 +0000 @@ -107,6 +107,7 @@ #define MSR_K7_PERFCTR2 0xC0010006 #define MSR_K7_PERFCTR3 0xC0010007 #define MSR_K7_HWCR 0xC0010015 +#define MSR_K7_CLK_CTL 0xC001001b #define MSR_K7_FID_VID_CTL 0xC0010041 #define MSR_K7_VID_STATUS 0xC0010042 diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/dcache.h linux-2.5/include/linux/dcache.h --- bk-linus/include/linux/dcache.h 2002-11-21 02:23:47.000000000 +0000 +++ linux-2.5/include/linux/dcache.h 2002-11-21 18:04:40.000000000 +0000 @@ -66,7 +66,7 @@ static __inline__ unsigned int full_name return end_name_hash(hash); } -#define DNAME_INLINE_LEN_MIN 16 +#define DNAME_INLINE_LEN_MIN 32 struct dcookie_struct; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/block_dev.c linux-2.5/fs/block_dev.c --- bk-linus/fs/block_dev.c 2002-11-21 02:19:41.000000000 +0000 +++ linux-2.5/fs/block_dev.c 2002-11-21 18:01:54.000000000 +0000 @@ -703,14 +703,15 @@ int blkdev_put(struct block_device *bdev down(&bdev->bd_sem); lock_kernel(); - switch (kind) { - case BDEV_FILE: - case BDEV_FS: - sync_blockdev(bd_inode->i_bdev); - break; - } - if (!--bdev->bd_openers) + if (!--bdev->bd_openers) { + switch (kind) { + case BDEV_FILE: + case BDEV_FS: + sync_blockdev(bd_inode->i_bdev); + break; + } kill_bdev(bdev); + } if (bdev->bd_contains == bdev) { if (disk->fops->release) ret = disk->fops->release(bd_inode, NULL); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/mm/bootmem.c linux-2.5/mm/bootmem.c --- bk-linus/mm/bootmem.c 2002-11-21 02:24:41.000000000 +0000 +++ linux-2.5/mm/bootmem.c 2002-11-21 18:05:21.000000000 +0000 @@ -205,7 +205,7 @@ found: * of this allocation's buffer? If yes then we can 'merge' * the previous partial page with this allocation. */ - if (align <= PAGE_SIZE + if (align < PAGE_SIZE && bdata->last_offset && bdata->last_pos+1 == start) { offset = (bdata->last_offset+align-1) & ~(align-1); if (offset > PAGE_SIZE) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pcmcia/cardbus.c linux-2.5/drivers/pcmcia/cardbus.c --- bk-linus/drivers/pcmcia/cardbus.c 2002-11-21 02:17:28.000000000 +0000 +++ linux-2.5/drivers/pcmcia/cardbus.c 2002-11-21 18:00:12.000000000 +0000 @@ -283,6 +283,8 @@ int cb_alloc(socket_info_t * s) dev->hdr_type = hdr & 0x7f; pci_setup_device(dev); + if (pci_enable_device(dev)) + continue; strcpy(dev->dev.bus_id, dev->slot_name); @@ -300,7 +302,6 @@ int cb_alloc(socket_info_t * s) pci_writeb(dev, PCI_INTERRUPT_LINE, irq); } - pci_enable_device(dev); /* XXX check return */ device_register(&dev->dev); pci_insert_device(dev, bus); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/cdrom/cdrom.c linux-2.5/drivers/cdrom/cdrom.c --- bk-linus/drivers/cdrom/cdrom.c 2002-11-21 02:13:46.000000000 +0000 +++ linux-2.5/drivers/cdrom/cdrom.c 2002-11-21 17:57:34.000000000 +0000 @@ -727,6 +727,7 @@ static int cdrom_load_unload(struct cdro cgc.cmd[0] = GPCMD_LOAD_UNLOAD; cgc.cmd[4] = 2 + (slot >= 0); cgc.cmd[8] = slot; + cgc.timeout = 60 * HZ; /* The Sanyo 3 CD changer uses byte 7 of the GPCMD_TEST_UNIT_READY to command to switch CDs instead of @@ -1901,6 +1902,7 @@ static int mmc_ioctl(struct cdrom_device { struct cdrom_device_ops *cdo = cdi->ops; struct cdrom_generic_command cgc; + struct request_sense sense; char buffer[32]; int ret = 0; @@ -1935,9 +1937,11 @@ static int mmc_ioctl(struct cdrom_device cgc.buffer = (char *) kmalloc(blocksize, GFP_KERNEL); if (cgc.buffer == NULL) return -ENOMEM; + memset(&sense, 0, sizeof(sense)); + cgc.sense = &sense; cgc.data_direction = CGC_DATA_READ; ret = cdrom_read_block(cdi, &cgc, lba, 1, format, blocksize); - if (ret) { + if (ret && sense.sense_key==0x05 && sense.asc==0x20 && sense.ascq==0x00) { /* * SCSI-II devices are not required to support * READ_CD, so let's try switching block size diff -urpN --exclude-from=/home/davej/.exclude bk-linus/kernel/fork.c linux-2.5/kernel/fork.c --- bk-linus/kernel/fork.c 2002-11-21 02:24:36.000000000 +0000 +++ linux-2.5/kernel/fork.c 2002-11-21 18:05:16.000000000 +0000 @@ -336,8 +336,10 @@ static struct mm_struct * mm_init(struct mm->default_kioctx = (struct kioctx)INIT_KIOCTX(mm->default_kioctx, *mm); mm->free_area_cache = TASK_UNMAPPED_BASE; - if (likely(!mm_alloc_pgd(mm))) + if (likely(!mm_alloc_pgd(mm))) { + mm->def_flags = 0; return mm; + } free_mm(mm); return NULL; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/coda/dir.c linux-2.5/fs/coda/dir.c --- bk-linus/fs/coda/dir.c 2002-11-21 02:19:55.000000000 +0000 +++ linux-2.5/fs/coda/dir.c 2002-11-21 18:02:04.000000000 +0000 @@ -514,6 +514,7 @@ out: coda_file->f_pos = host_file->f_pos; up(&host_inode->i_sem); + UPDATE_ATIME(coda_inode); return ret; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/macintosh/via-pmu.c linux-2.5/drivers/macintosh/via-pmu.c --- bk-linus/drivers/macintosh/via-pmu.c 2002-11-21 02:15:32.000000000 +0000 +++ linux-2.5/drivers/macintosh/via-pmu.c 2002-11-21 17:58:44.000000000 +0000 @@ -2605,7 +2605,7 @@ static int pmu_release(struct inode *ino disable_kernel_backlight--; spin_unlock_irqrestore(&pmu_lock, flags); } -#endif defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) +#endif /* defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) */ kfree(pp); } unlock_kernel(); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/cyclades.c linux-2.5/drivers/char/cyclades.c --- bk-linus/drivers/char/cyclades.c 2002-11-21 02:13:51.000000000 +0000 +++ linux-2.5/drivers/char/cyclades.c 2002-11-21 17:57:38.000000000 +0000 @@ -3434,8 +3434,8 @@ set_line_char(struct cyclades_port * inf } #ifdef CY_DEBUG_DTR printk("cyc:set_line_char dropping DTR\n"); - printk(" status: 0x%x, - 0x%x\n", cy_readb(base_addr+(CyMSVR1<number; num; num /= 10) digits++; if (!digits) digits++; - dev->proc_name = kmalloc(strlen(dev->type)+digits+2,GFP_KERNEL); - if (!dev->proc_name) goto fail1; + + dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_ATOMIC); + if (!dev->proc_name) + goto fail1; sprintf(dev->proc_name,"%s:%d",dev->type, dev->number); + dev->proc_entry = create_proc_entry(dev->proc_name, 0, atm_proc_root); if (!dev->proc_entry) goto fail0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/hotplug/cpqphp_nvram.c linux-2.5/drivers/hotplug/cpqphp_nvram.c --- bk-linus/drivers/hotplug/cpqphp_nvram.c 2002-11-21 02:14:21.000000000 +0000 +++ linux-2.5/drivers/hotplug/cpqphp_nvram.c 2002-11-21 17:58:05.000000000 +0000 @@ -177,12 +177,12 @@ static u32 access_EV (u16 operation, u8 spin_lock_irqsave(&int15_lock, flags); __asm__ ( - "xorl %%ebx,%%ebx - xorl %%edx,%%edx - pushf - push %%cs - cli - call *%6" + "xorl %%ebx,%%ebx \n" + "xorl %%edx,%%edx \n" + "pushf \n" + "push %%cs \n" + "cli \n" + "call *%6 \n" : "=c" (*buf_size), "=a" (ret_val) : "a" (op), "c" (*buf_size), "S" (ev_name), "D" (buffer), "m" (compaq_int15_entry_point) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/rio/riocmd.c linux-2.5/drivers/char/rio/riocmd.c --- bk-linus/drivers/char/rio/riocmd.c 2002-11-21 02:14:17.000000000 +0000 +++ linux-2.5/drivers/char/rio/riocmd.c 2002-11-21 17:58:01.000000000 +0000 @@ -462,8 +462,8 @@ PKT *PacketP; rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len,PacketP->len ); rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum ); - rio_dprintk (RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, - Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command ); + rio_dprintk (RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " + "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command ); return TRUE; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/video/zr36067.c linux-2.5/drivers/media/video/zr36067.c --- bk-linus/drivers/media/video/zr36067.c 2002-11-21 02:15:47.000000000 +0000 +++ linux-2.5/drivers/media/video/zr36067.c 2002-11-21 17:58:57.000000000 +0000 @@ -1416,7 +1416,7 @@ static int zr36060_reset(struct zoran *z zr36060_sleep(zr, 0); post_office_write(zr, 3, 0, 0); udelay(2); - default: + default:; } return 0; } --- bk-linus/drivers/scsi/scsi_ioctl.c 2002-11-21 02:18:20.000000000 +0000 +++ linux-2.5/drivers/scsi/scsi_ioctl.c 2002-11-21 20:13:01.000000000 +0000 @@ -395,10 +395,12 @@ error: static int scsi_ioctl_get_pci(Scsi_Device * dev, void *arg) { - - if (!dev->host->pci_dev) return -ENXIO; - return copy_to_user(arg, dev->host->pci_dev->slot_name, - sizeof(dev->host->pci_dev->slot_name)); + if (!dev->host->pci_dev) + return -ENXIO; + if(copy_to_user(arg, dev->host->pci_dev->slot_name, + sizeof(dev->host->pci_dev->slot_name))) + return -EFAULT; + return 0; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/kernel/traps.c linux-2.5/arch/i386/kernel/traps.c --- bk-linus/arch/i386/kernel/traps.c 2002-11-21 02:09:31.000000000 +0000 +++ linux-2.5/arch/i386/kernel/traps.c 2002-11-21 17:55:03.000000000 +0000 @@ -577,10 +581,15 @@ asmlinkage void do_debug(struct pt_regs { unsigned int condition; struct task_struct *tsk = current; + unsigned long eip = regs->eip; siginfo_t info; __asm__ __volatile__("movl %%db6,%0" : "=r" (condition)); + /* If the user set TF, it's simplest to clear it right away. */ + if ((eip >=PAGE_OFFSET) && (regs->eflags & TF_MASK)) + goto clear_TF; + /* Mask out spurious debug traps due to lazy DR7 setting */ if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) { if (!tsk->thread.debugreg[7]) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/pci/direct.c linux-2.5/arch/i386/pci/direct.c --- bk-linus/arch/i386/pci/direct.c 2002-11-21 02:09:41.000000000 +0000 +++ linux-2.5/arch/i386/pci/direct.c 2002-11-21 17:55:09.000000000 +0000 @@ -261,7 +261,6 @@ static int __init pci_direct_init(void) } local_irq_restore(flags); - pci_root_ops = NULL; return 0; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-i386/string-486.h linux-2.5/include/asm-i386/string-486.h --- bk-linus/include/asm-i386/string-486.h 2002-11-21 02:21:53.000000000 +0000 +++ linux-2.5/include/asm-i386/string-486.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,617 +0,0 @@ -#ifndef _I386_STRING_I486_H_ -#define _I386_STRING_I486_H_ - -/* - * This string-include defines all string functions as inline - * functions. Use gcc. It also assumes ds=es=data space, this should be - * normal. Most of the string-functions are rather heavily hand-optimized, - * see especially strsep,strstr,str[c]spn. They should work, but are not - * very easy to understand. Everything is done entirely within the register - * set, making the functions fast and clean. - * - * Copyright (C) 1991, 1992 Linus Torvalds - * Revised and optimized for i486/pentium - * 1994/03/15 by Alberto Vignani/Davide Parodi @crf.it - * - * Split into 2 CPU specific files by Alan Cox to keep #ifdef noise down. - * - * 1999/10/5 Proper register args for newer GCCs and minor bugs - * fixed - Petko Manolov (petkan@spct.net) - * 1999/10/14 3DNow memscpy() added - Petkan - * 2000/05/09 extern changed to static in function definitions - * and a few cleanups - Petkan - */ - -#define __HAVE_ARCH_STRCPY -static inline char * strcpy(char * dest,const char *src) -{ -register char *tmp= (char *)dest; -register char dummy; -__asm__ __volatile__( - "\n1:\t" - "movb (%0),%2\n\t" - "incl %0\n\t" - "movb %2,(%1)\n\t" - "incl %1\n\t" - "testb %2,%2\n\t" - "jne 1b" - :"=r" (src), "=r" (tmp), "=q" (dummy) - :"0" (src), "1" (tmp) - :"memory"); -return dest; -} - -#define __HAVE_ARCH_STRNCPY -static inline char * strncpy(char * dest,const char *src,size_t count) -{ -register char *tmp= (char *)dest; -register char dummy; -if (count) { -__asm__ __volatile__( - "\n1:\t" - "movb (%0),%2\n\t" - "incl %0\n\t" - "movb %2,(%1)\n\t" - "incl %1\n\t" - "decl %3\n\t" - "je 3f\n\t" - "testb %2,%2\n\t" - "jne 1b\n\t" - "2:\tmovb %2,(%1)\n\t" - "incl %1\n\t" - "decl %3\n\t" - "jne 2b\n\t" - "3:" - :"=r" (src), "=r" (tmp), "=q" (dummy), "=r" (count) - :"0" (src), "1" (tmp), "3" (count) - :"memory"); - } /* if (count) */ -return dest; -} - -#define __HAVE_ARCH_STRCAT -static inline char * strcat(char * dest,const char * src) -{ -register char *tmp = (char *)(dest-1); -register char dummy; -__asm__ __volatile__( - "\n1:\tincl %1\n\t" - "cmpb $0,(%1)\n\t" - "jne 1b\n" - "2:\tmovb (%2),%b0\n\t" - "incl %2\n\t" - "movb %b0,(%1)\n\t" - "incl %1\n\t" - "testb %b0,%b0\n\t" - "jne 2b\n" - :"=q" (dummy), "=r" (tmp), "=r" (src) - :"1" (tmp), "2" (src) - :"memory"); -return dest; -} - -#define __HAVE_ARCH_STRNCAT -static inline char * strncat(char * dest,const char * src,size_t count) -{ -register char *tmp = (char *)(dest-1); -register char dummy; -__asm__ __volatile__( - "\n1:\tincl %1\n\t" - "cmpb $0,(%1)\n\t" - "jne 1b\n" - "2:\tdecl %3\n\t" - "js 3f\n\t" - "movb (%2),%b0\n\t" - "incl %2\n\t" - "movb %b0,(%1)\n\t" - "incl %1\n\t" - "testb %b0,%b0\n\t" - "jne 2b\n" - "3:\txorb %0,%0\n\t" - "movb %b0,(%1)\n\t" - :"=q" (dummy), "=r" (tmp), "=r" (src), "=r" (count) - :"1" (tmp), "2" (src), "3" (count) - :"memory"); -return dest; -} - -#define __HAVE_ARCH_STRCMP -static inline int strcmp(const char * cs,const char * ct) -{ -register int __res; -__asm__ __volatile__( - "\n1:\tmovb (%1),%b0\n\t" - "incl %1\n\t" - "cmpb %b0,(%2)\n\t" - "jne 2f\n\t" - "incl %2\n\t" - "testb %b0,%b0\n\t" - "jne 1b\n\t" - "xorl %0,%0\n\t" - "jmp 3f\n" - "2:\tmovl $1,%0\n\t" - "jb 3f\n\t" - "negl %0\n" - "3:" - :"=q" (__res), "=r" (cs), "=r" (ct) - :"1" (cs), "2" (ct) - : "memory" ); -return __res; -} - -#define __HAVE_ARCH_STRNCMP -static inline int strncmp(const char * cs,const char * ct,size_t count) -{ -register int __res; -__asm__ __volatile__( - "\n1:\tdecl %3\n\t" - "js 2f\n\t" - "movb (%1),%b0\n\t" - "incl %1\n\t" - "cmpb %b0,(%2)\n\t" - "jne 3f\n\t" - "incl %2\n\t" - "testb %b0,%b0\n\t" - "jne 1b\n" - "2:\txorl %0,%0\n\t" - "jmp 4f\n" - "3:\tmovl $1,%0\n\t" - "jb 4f\n\t" - "negl %0\n" - "4:" - :"=q" (__res), "=r" (cs), "=r" (ct), "=r" (count) - :"1" (cs), "2" (ct), "3" (count)); -return __res; -} - -#define __HAVE_ARCH_STRCHR -static inline char * strchr(const char * s, int c) -{ -register char * __res; -__asm__ __volatile__( - "movb %%al,%%ah\n" - "1:\tmovb (%1),%%al\n\t" - "cmpb %%ah,%%al\n\t" - "je 2f\n\t" - "incl %1\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n\t" - "xorl %1,%1\n" - "2:\tmovl %1,%0\n\t" - :"=a" (__res), "=r" (s) - :"0" (c), "1" (s)); -return __res; -} - -#define __HAVE_ARCH_STRRCHR -static inline char * strrchr(const char * s, int c) -{ -int d0, d1; -register char * __res; -__asm__ __volatile__( - "movb %%al,%%ah\n" - "1:\tlodsb\n\t" - "cmpb %%ah,%%al\n\t" - "jne 2f\n\t" - "leal -1(%%esi),%0\n" - "2:\ttestb %%al,%%al\n\t" - "jne 1b" - :"=d" (__res), "=&S" (d0), "=&a" (d1) - :"0" (0), "1" (s), "2" (c)); -return __res; -} - - -#define __HAVE_ARCH_STRCSPN -static inline size_t strcspn(const char * cs, const char * ct) -{ -int d0, d1; -register char * __res; -__asm__ __volatile__( - "movl %6,%%edi\n\t" - "repne\n\t" - "scasb\n\t" - "notl %%ecx\n\t" - "decl %%ecx\n\t" - "movl %%ecx,%%edx\n" - "1:\tlodsb\n\t" - "testb %%al,%%al\n\t" - "je 2f\n\t" - "movl %6,%%edi\n\t" - "movl %%edx,%%ecx\n\t" - "repne\n\t" - "scasb\n\t" - "jne 1b\n" - "2:\tdecl %0" - :"=S" (__res), "=&a" (d0), "=&c" (d1) - :"0" (cs), "1" (0), "2" (0xffffffff), "g" (ct) - :"dx", "di"); -return __res-cs; -} - - -#define __HAVE_ARCH_STRLEN -static inline size_t strlen(const char * s) -{ -/* - * slightly slower on a 486, but with better chances of - * register allocation - */ -register char dummy, *tmp= (char *)s; -__asm__ __volatile__( - "\n1:\t" - "movb\t(%0),%1\n\t" - "incl\t%0\n\t" - "testb\t%1,%1\n\t" - "jne\t1b" - :"=r" (tmp),"=q" (dummy) - :"0" (s) - : "memory" ); -return (tmp-s-1); -} - -/* Added by Gertjan van Wingerde to make minix and sysv module work */ -#define __HAVE_ARCH_STRNLEN -static inline size_t strnlen(const char * s, size_t count) -{ -int d0; -register int __res; -__asm__ __volatile__( - "movl %3,%0\n\t" - "jmp 2f\n" - "1:\tcmpb $0,(%0)\n\t" - "je 3f\n\t" - "incl %0\n" - "2:\tdecl %2\n\t" - "cmpl $-1,%2\n\t" - "jne 1b\n" - "3:\tsubl %3,%0" - :"=a" (__res), "=&d" (d0) - :"1" (count), "c" (s)); -return __res; -} -/* end of additional stuff */ - - -/* - * These ought to get tweaked to do some cache priming. - */ - -static inline void * __memcpy_by4(void * to, const void * from, size_t n) -{ -register void *tmp = (void *)to; -register int dummy1,dummy2; -__asm__ __volatile__ ( - "\n1:\tmovl (%2),%0\n\t" - "addl $4,%2\n\t" - "movl %0,(%1)\n\t" - "addl $4,%1\n\t" - "decl %3\n\t" - "jnz 1b" - :"=r" (dummy1), "=r" (tmp), "=r" (from), "=r" (dummy2) - :"1" (tmp), "2" (from), "3" (n/4) - :"memory"); -return (to); -} - -static inline void * __memcpy_by2(void * to, const void * from, size_t n) -{ -register void *tmp = (void *)to; -register int dummy1,dummy2; -__asm__ __volatile__ ( - "shrl $1,%3\n\t" - "jz 2f\n" /* only a word */ - "1:\tmovl (%2),%0\n\t" - "addl $4,%2\n\t" - "movl %0,(%1)\n\t" - "addl $4,%1\n\t" - "decl %3\n\t" - "jnz 1b\n" - "2:\tmovw (%2),%w0\n\t" - "movw %w0,(%1)" - :"=r" (dummy1), "=r" (tmp), "=r" (from), "=r" (dummy2) - :"1" (tmp), "2" (from), "3" (n/2) - :"memory"); -return (to); -} - -static inline void * __memcpy_g(void * to, const void * from, size_t n) -{ -int d0, d1, d2; -register void *tmp = (void *)to; -__asm__ __volatile__ ( - "shrl $1,%%ecx\n\t" - "jnc 1f\n\t" - "movsb\n" - "1:\tshrl $1,%%ecx\n\t" - "jnc 2f\n\t" - "movsw\n" - "2:\trep\n\t" - "movsl" - :"=&c" (d0), "=&D" (d1), "=&S" (d2) - :"0" (n), "1" ((long) tmp), "2" ((long) from) - :"memory"); -return (to); -} - -#define __memcpy_c(d,s,count) \ -((count%4==0) ? \ - __memcpy_by4((d),(s),(count)) : \ - ((count%2==0) ? \ - __memcpy_by2((d),(s),(count)) : \ - __memcpy_g((d),(s),(count)))) - -#define __memcpy(d,s,count) \ -(__builtin_constant_p(count) ? \ - __memcpy_c((d),(s),(count)) : \ - __memcpy_g((d),(s),(count))) - -#define __HAVE_ARCH_MEMCPY - -#include - -#ifdef CONFIG_X86_USE_3DNOW - -#include - -/* -** This CPU favours 3DNow strongly (eg AMD K6-II, K6-III, Athlon) -*/ - -static inline void * __constant_memcpy3d(void * to, const void * from, size_t len) -{ - if (len < 512) - return __memcpy_c(to, from, len); - return _mmx_memcpy(to, from, len); -} - -static inline void *__memcpy3d(void *to, const void *from, size_t len) -{ - if(len < 512) - return __memcpy_g(to, from, len); - return _mmx_memcpy(to, from, len); -} - -#define memcpy(d, s, count) \ -(__builtin_constant_p(count) ? \ - __constant_memcpy3d((d),(s),(count)) : \ - __memcpy3d((d),(s),(count))) - -#else /* CONFIG_X86_USE_3DNOW */ - -/* -** Generic routines -*/ - - -#define memcpy(d, s, count) __memcpy(d, s, count) - -#endif /* CONFIG_X86_USE_3DNOW */ - - -extern void __struct_cpy_bug( void ); - -#define struct_cpy(x,y) \ -({ \ - if (sizeof(*(x)) != sizeof(*(y))) \ - __struct_cpy_bug; \ - memcpy(x, y, sizeof(*(x))); \ -}) - - -#define __HAVE_ARCH_MEMMOVE -static inline void * memmove(void * dest,const void * src, size_t n) -{ -int d0, d1, d2; -register void *tmp = (void *)dest; -if (dest -#else /* * This string-include defines all string functions as inline @@ -525,7 +519,6 @@ static inline void * memscan(void * addr return addr; } -#endif /* CONFIG_X86_USE_STRING_486 */ #endif /* __KERNEL__ */ #endif diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/jfs/endian24.h linux-2.5/fs/jfs/endian24.h --- bk-linus/fs/jfs/endian24.h 2002-11-21 02:20:20.000000000 +0000 +++ linux-2.5/fs/jfs/endian24.h 2002-11-21 18:02:19.000000000 +0000 @@ -17,33 +17,4 @@ */ #ifndef _H_ENDIAN24 #define _H_ENDIAN24 - -/* - * endian24.h: - * - * Endian conversion for 24-byte data - * - */ -#define __swab24(x) \ -({ \ - __u32 __x = (x); \ - ((__u32)( \ - ((__x & (__u32)0x000000ffUL) << 16) | \ - (__x & (__u32)0x0000ff00UL) | \ - ((__x & (__u32)0x00ff0000UL) >> 16) )); \ -}) - -#if (defined(__KERNEL__) && defined(__LITTLE_ENDIAN)) || (defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN)) - #define __cpu_to_le24(x) ((__u32)(x)) - #define __le24_to_cpu(x) ((__u32)(x)) -#else - #define __cpu_to_le24(x) __swab24(x) - #define __le24_to_cpu(x) __swab24(x) -#endif - -#ifdef __KERNEL__ - #define cpu_to_le24 __cpu_to_le24 - #define le24_to_cpu __le24_to_cpu -#endif - #endif /* !_H_ENDIAN24 */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/byteorder/big_endian.h linux-2.5/include/linux/byteorder/big_endian.h --- bk-linus/include/linux/byteorder/big_endian.h 2002-11-21 02:24:12.000000000 +0000 +++ linux-2.5/include/linux/byteorder/big_endian.h 2002-11-21 18:04:57.000000000 +0000 @@ -18,48 +18,64 @@ #define __constant_le64_to_cpu(x) ___constant_swab64((x)) #define __constant_cpu_to_le32(x) ___constant_swab32((x)) #define __constant_le32_to_cpu(x) ___constant_swab32((x)) +#define __constant_cpu_to_le24(x) ___constant_swab24((x)) +#define __constant_le24_to_cpu(x) ___constant_swab24((x)) #define __constant_cpu_to_le16(x) ___constant_swab16((x)) #define __constant_le16_to_cpu(x) ___constant_swab16((x)) #define __constant_cpu_to_be64(x) ((__u64)(x)) #define __constant_be64_to_cpu(x) ((__u64)(x)) #define __constant_cpu_to_be32(x) ((__u32)(x)) #define __constant_be32_to_cpu(x) ((__u32)(x)) +#define __constant_cpu_to_be24(x) ((__u32)(x)) +#define __constant_be24_to_cpu(x) ((__u32)(x)) #define __constant_cpu_to_be16(x) ((__u16)(x)) #define __constant_be16_to_cpu(x) ((__u16)(x)) #define __cpu_to_le64(x) __swab64((x)) #define __le64_to_cpu(x) __swab64((x)) #define __cpu_to_le32(x) __swab32((x)) #define __le32_to_cpu(x) __swab32((x)) +#define __cpu_to_le24(x) __swab24((x)) +#define __le24_to_cpu(x) __swab24((x)) #define __cpu_to_le16(x) __swab16((x)) #define __le16_to_cpu(x) __swab16((x)) #define __cpu_to_be64(x) ((__u64)(x)) #define __be64_to_cpu(x) ((__u64)(x)) #define __cpu_to_be32(x) ((__u32)(x)) #define __be32_to_cpu(x) ((__u32)(x)) +#define __cpu_to_be24(x) ((__u32)(x)) +#define __be24_to_cpu(x) ((__u32)(x)) #define __cpu_to_be16(x) ((__u16)(x)) #define __be16_to_cpu(x) ((__u16)(x)) #define __cpu_to_le64p(x) __swab64p((x)) #define __le64_to_cpup(x) __swab64p((x)) #define __cpu_to_le32p(x) __swab32p((x)) #define __le32_to_cpup(x) __swab32p((x)) +#define __cpu_to_le24p(x) __swab24p((x)) +#define __le24_to_cpup(x) __swab24p((x)) #define __cpu_to_le16p(x) __swab16p((x)) #define __le16_to_cpup(x) __swab16p((x)) #define __cpu_to_be64p(x) (*(__u64*)(x)) #define __be64_to_cpup(x) (*(__u64*)(x)) #define __cpu_to_be32p(x) (*(__u32*)(x)) #define __be32_to_cpup(x) (*(__u32*)(x)) +#define __cpu_to_be24p(x) (*(__u24*)(x)) +#define __be24_to_cpup(x) (*(__u24*)(x)) #define __cpu_to_be16p(x) (*(__u16*)(x)) #define __be16_to_cpup(x) (*(__u16*)(x)) #define __cpu_to_le64s(x) __swab64s((x)) #define __le64_to_cpus(x) __swab64s((x)) #define __cpu_to_le32s(x) __swab32s((x)) #define __le32_to_cpus(x) __swab32s((x)) +#define __cpu_to_le24s(x) __swab24s((x)) +#define __le24_to_cpus(x) __swab24s((x)) #define __cpu_to_le16s(x) __swab16s((x)) #define __le16_to_cpus(x) __swab16s((x)) #define __cpu_to_be64s(x) do {} while (0) #define __be64_to_cpus(x) do {} while (0) #define __cpu_to_be32s(x) do {} while (0) #define __be32_to_cpus(x) do {} while (0) +#define __cpu_to_be24s(x) do {} while (0) +#define __be24_to_cpus(x) do {} while (0) #define __cpu_to_be16s(x) do {} while (0) #define __be16_to_cpus(x) do {} while (0) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/byteorder/little_endian.h linux-2.5/include/linux/byteorder/little_endian.h --- bk-linus/include/linux/byteorder/little_endian.h 2002-11-21 02:24:12.000000000 +0000 +++ linux-2.5/include/linux/byteorder/little_endian.h 2002-11-21 18:04:57.000000000 +0000 @@ -18,48 +18,64 @@ #define __constant_le64_to_cpu(x) ((__u64)(x)) #define __constant_cpu_to_le32(x) ((__u32)(x)) #define __constant_le32_to_cpu(x) ((__u32)(x)) +#define __constant_cpu_to_le24(x) ((__u32)(x)) +#define __constant_le24_to_cpu(x) ((__u32)(x)) #define __constant_cpu_to_le16(x) ((__u16)(x)) #define __constant_le16_to_cpu(x) ((__u16)(x)) #define __constant_cpu_to_be64(x) ___constant_swab64((x)) #define __constant_be64_to_cpu(x) ___constant_swab64((x)) #define __constant_cpu_to_be32(x) ___constant_swab32((x)) #define __constant_be32_to_cpu(x) ___constant_swab32((x)) +#define __constant_cpu_to_be24(x) ___constant_swab24((x)) +#define __constant_be24_to_cpu(x) ___constant_swab24((x)) #define __constant_cpu_to_be16(x) ___constant_swab16((x)) #define __constant_be16_to_cpu(x) ___constant_swab16((x)) #define __cpu_to_le64(x) ((__u64)(x)) #define __le64_to_cpu(x) ((__u64)(x)) #define __cpu_to_le32(x) ((__u32)(x)) #define __le32_to_cpu(x) ((__u32)(x)) +#define __cpu_to_le24(x) ((__u32)(x)) +#define __le24_to_cpu(x) ((__u32)(x)) #define __cpu_to_le16(x) ((__u16)(x)) #define __le16_to_cpu(x) ((__u16)(x)) #define __cpu_to_be64(x) __swab64((x)) #define __be64_to_cpu(x) __swab64((x)) #define __cpu_to_be32(x) __swab32((x)) #define __be32_to_cpu(x) __swab32((x)) +#define __cpu_to_be24(x) __swab24((x)) +#define __be24_to_cpu(x) __swab24((x)) #define __cpu_to_be16(x) __swab16((x)) #define __be16_to_cpu(x) __swab16((x)) #define __cpu_to_le64p(x) (*(__u64*)(x)) #define __le64_to_cpup(x) (*(__u64*)(x)) #define __cpu_to_le32p(x) (*(__u32*)(x)) #define __le32_to_cpup(x) (*(__u32*)(x)) +#define __cpu_to_le24p(x) (*(__u32*)(x)) +#define __le24_to_cpup(x) (*(__u32*)(x)) #define __cpu_to_le16p(x) (*(__u16*)(x)) #define __le16_to_cpup(x) (*(__u16*)(x)) #define __cpu_to_be64p(x) __swab64p((x)) #define __be64_to_cpup(x) __swab64p((x)) #define __cpu_to_be32p(x) __swab32p((x)) #define __be32_to_cpup(x) __swab32p((x)) +#define __cpu_to_be24p(x) __swab24p((x)) +#define __be24_to_cpup(x) __swab24p((x)) #define __cpu_to_be16p(x) __swab16p((x)) #define __be16_to_cpup(x) __swab16p((x)) #define __cpu_to_le64s(x) do {} while (0) #define __le64_to_cpus(x) do {} while (0) #define __cpu_to_le32s(x) do {} while (0) #define __le32_to_cpus(x) do {} while (0) +#define __cpu_to_le24s(x) do {} while (0) +#define __le24_to_cpus(x) do {} while (0) #define __cpu_to_le16s(x) do {} while (0) #define __le16_to_cpus(x) do {} while (0) #define __cpu_to_be64s(x) __swab64s((x)) #define __be64_to_cpus(x) __swab64s((x)) #define __cpu_to_be32s(x) __swab32s((x)) #define __be32_to_cpus(x) __swab32s((x)) +#define __cpu_to_be24s(x) __swab24s((x)) +#define __be24_to_cpus(x) __swab24s((x)) #define __cpu_to_be16s(x) __swab16s((x)) #define __be16_to_cpus(x) __swab16s((x)) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/byteorder/swab.h linux-2.5/include/linux/byteorder/swab.h --- bk-linus/include/linux/byteorder/swab.h 2002-11-21 02:24:12.000000000 +0000 +++ linux-2.5/include/linux/byteorder/swab.h 2002-11-21 18:04:57.000000000 +0000 @@ -26,6 +26,15 @@ (((__u16)(__x) & (__u16)0xff00U) >> 8) )); \ }) +#define ___swab24(x) \ +({ \ + __u32 __x = (x); \ + ((__u32)( \ + ((__x & (__u32)0x000000ffUL) << 16) | \ + (__x & (__u32)0x0000ff00UL) | \ + ((__x & (__u32)0x00ff0000UL) >> 16) )); \ +}) + #define ___swab32(x) \ ({ \ __u32 __x = (x); \ @@ -54,6 +63,11 @@ ((__u16)( \ (((__u16)(x) & (__u16)0x00ffU) << 8) | \ (((__u16)(x) & (__u16)0xff00U) >> 8) )) +#define ___constant_swab24(x) \ + ((__u32)( \ + (((__u32)(x) & (__u32)0x000000ffU) << 16) | \ + (((__u32)(x) & (__u32)0x0000ff00U) | \ + (((__u32)(x) & (__u32)0x00ff0000U) >> 16) )) #define ___constant_swab32(x) \ ((__u32)( \ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ @@ -77,6 +91,9 @@ #ifndef __arch__swab16 # define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); }) #endif +#ifndef __arch__swab24 +# define __arch__swab24(x) ({ __u32 __tmp = (x) ; ___swab24(__tmp); }) +#endif #ifndef __arch__swab32 # define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); }) #endif @@ -87,6 +104,9 @@ #ifndef __arch__swab16p # define __arch__swab16p(x) __arch__swab16(*(x)) #endif +#ifndef __arch__swab24p +# define __arch__swab24p(x) __arch__swab24(*(x)) +#endif #ifndef __arch__swab32p # define __arch__swab32p(x) __arch__swab32(*(x)) #endif @@ -97,6 +117,9 @@ #ifndef __arch__swab16s # define __arch__swab16s(x) do { *(x) = __arch__swab16p((x)); } while (0) #endif +#ifndef __arch__swab24s +# define __arch__swab24s(x) do { *(x) = __arch__swab24p((x)); } while (0) +#endif #ifndef __arch__swab32s # define __arch__swab32s(x) do { *(x) = __arch__swab32p((x)); } while (0) #endif @@ -113,6 +136,10 @@ (__builtin_constant_p((__u16)(x)) ? \ ___swab16((x)) : \ __fswab16((x))) +# define __swab24(x) \ +(__builtin_constant_p((__u32)(x)) ? \ + ___swab24((x)) : \ + __fswab24((x))) # define __swab32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___swab32((x)) : \ @@ -123,6 +150,7 @@ __fswab64((x))) #else # define __swab16(x) __fswab16(x) +# define __swab24(x) __fswab24(x) # define __swab32(x) __fswab32(x) # define __swab64(x) __fswab64(x) #endif /* OPTIMIZE */ @@ -141,6 +169,19 @@ static __inline__ void __swab16s(__u16 * __arch__swab16s(addr); } +static __inline__ __const__ __u32 __fswab24(__u32 x) +{ + return __arch__swab24(x); +} +static __inline__ __u32 __swab24p(__u32 *x) +{ + return __arch__swab24p(x); +} +static __inline__ void __swab24s(__u32 *addr) +{ + __arch__swab24s(addr); +} + static __inline__ __const__ __u32 __fswab32(__u32 x) { return __arch__swab32(x); @@ -177,12 +218,15 @@ static __inline__ void __swab64s(__u64 * #if defined(__KERNEL__) #define swab16 __swab16 +#define swab24 __swab24 #define swab32 __swab32 #define swab64 __swab64 #define swab16p __swab16p +#define swab24p __swab24p #define swab32p __swab32p #define swab64p __swab64p #define swab16s __swab16s +#define swab24s __swab24s #define swab32s __swab32s #define swab64s __swab64s #endif diff -urpN --exclude-from=/home/davej/.exclude bk-linus/Makefile linux-2.5/Makefile --- bk-linus/Makefile 2002-11-21 02:07:06.000000000 +0000 +++ linux-2.5/Makefile 2002-11-21 17:53:01.000000000 +0000 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 48 -EXTRAVERSION = +EXTRAVERSION =-dj1 # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/ftape/lowlevel/fdc-io.c linux-2.5/drivers/char/ftape/lowlevel/fdc-io.c --- bk-linus/drivers/char/ftape/lowlevel/fdc-io.c 2002-11-21 02:14:10.000000000 +0000 +++ linux-2.5/drivers/char/ftape/lowlevel/fdc-io.c 2002-11-21 17:57:55.000000000 +0000 @@ -926,7 +926,7 @@ static inline void fdc_setup_dma(char mo disable_dma(fdc.dma); clear_dma_ff(fdc.dma); set_dma_mode(fdc.dma, mode); - set_dma_addr(fdc.dma, virt_to_bus((void*)addr)); + set_dma_addr(fdc.dma, isa_virt_to_bus((void*)addr)); set_dma_count(fdc.dma, count); enable_dma(fdc.dma); } @@ -945,7 +945,7 @@ int fdc_setup_formatting(buffer_struct * /* Program the DMA controller. */ TRACE(ft_t_fdc_dma, - "phys. addr. = %lx", virt_to_bus((void*) buff->ptr)); + "phys. addr. = %lx", isa_virt_to_bus((void*) buff->ptr)); save_flags(flags); cli(); /* could be called from ISR ! */ fdc_setup_dma(DMA_MODE_WRITE, buff->ptr, FT_SECTORS_PER_SEGMENT * 4); @@ -997,7 +997,7 @@ int fdc_setup_read_write(buffer_struct * TRACE_ABORT(-EIO, ft_t_bug, "bug: illegal operation parameter"); } - TRACE(ft_t_fdc_dma, "phys. addr. = %lx",virt_to_bus((void*)buff->ptr)); + TRACE(ft_t_fdc_dma, "phys. addr. = %lx", isa_virt_to_bus((void*)buff->ptr)); save_flags(flags); cli(); /* could be called from ISR ! */ if (operation != FDC_VERIFY) { diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/Kconfig linux-2.5/arch/i386/Kconfig --- bk-linus/arch/i386/Kconfig 2002-11-21 02:09:27.000000000 +0000 +++ linux-2.5/arch/i386/Kconfig 2002-11-21 18:23:48.000000000 +0000 @@ -283,6 +283,22 @@ config X86_OOSTORE depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 default y +config X86_SFENCE + bool + depends on MPENTIUMIII || MPENTIUM4 || MK7 + default y + +config X86_LFENCE + bool + depends on MPENTIUM4 + default y + +config X86_MFENCE + bool + depends on MPENTIUM4 + default y + + config HUGETLB_PAGE bool "Huge TLB Page Support" help diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-i386/system.h linux-2.5/include/asm-i386/system.h --- bk-linus/include/asm-i386/system.h 2002-11-21 02:21:53.000000000 +0000 +++ linux-2.5/include/asm-i386/system.h 2002-11-21 18:03:25.000000000 +0000 @@ -281,10 +286,33 @@ static inline unsigned long __cmpxchg(vo * * Some non intel clones support out of order store. wmb() ceases to be a * nop for these. + * + * Pentium III introduced the SFENCE instruction for serialising all store + * operations, Pentium IV further introduced LFENCE and MFENCE for load and + * memory barriers respecively. */ - + +#ifdef CONFIG_X86_MFENCE +#define mb() __asm__ __volatile__ ("mfence": : :"memory") +#else #define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") +#endif + +#ifdef CONFIG_X86_LFENCE +#define rmb() __asm__ __volatile__ ("lfence": : :"memory") +#else #define rmb() mb() +#endif + +#ifdef CONFIG_X86_SFENCE +#define wmb() __asm__ __volatile__ ("sfence": : :"memory") +#else +#ifdef CONFIG_X86_OOSTORE +#define wmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") +#else +#define wmb() __asm__ __volatile__ ("": : :"memory") +#endif +#endif /* CONFIG_X86_SFENCE */ /** * read_barrier_depends - Flush all pending reads that subsequents reads @@ -340,12 +368,6 @@ static inline unsigned long __cmpxchg(vo #define read_barrier_depends() do { } while(0) -#ifdef CONFIG_X86_OOSTORE -#define wmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory") -#else -#define wmb() __asm__ __volatile__ ("": : :"memory") -#endif - #ifdef CONFIG_SMP #define smp_mb() mb() #define smp_rmb() rmb() diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-i386/bitops.h linux-2.5/include/asm-i386/bitops.h --- bk-linus/include/asm-i386/bitops.h 2002-11-21 02:21:49.000000000 +0000 +++ linux-2.5/include/asm-i386/bitops.h 2002-11-21 18:03:22.000000000 +0000 @@ -456,7 +456,7 @@ static __inline__ int ffs(int x) __asm__("bsfl %1,%0\n\t" "jnz 1f\n\t" "movl $-1,%0\n" - "1:" : "=r" (r) : "g" (x)); + "1:" : "=r" (r) : "rm" (x)); return r+1; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/mm/filemap.c linux-2.5/mm/filemap.c --- bk-linus/mm/filemap.c 2002-11-21 02:24:41.000000000 +0000 +++ linux-2.5/mm/filemap.c 2002-11-21 18:05:21.000000000 +0000 @@ -1607,7 +1608,7 @@ generic_file_write_nolock(struct file *f /* * Check whether we've reached the file size limit. */ - if (unlikely(limit != RLIM_INFINITY)) { + if (!S_ISBLK(inode->i_mode) && unlikely (limit != RLIM_INFINITY)) { if (pos >= limit) { send_sig(SIGXFSZ, current, 0); err = -EFBIG; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/wan/cosa.c linux-2.5/drivers/net/wan/cosa.c --- bk-linus/drivers/net/wan/cosa.c 2002-11-21 02:17:12.000000000 +0000 +++ linux-2.5/drivers/net/wan/cosa.c 2002-11-21 17:59:59.000000000 +0000 @@ -611,7 +611,8 @@ static void sppp_channel_delete(struct c static int cosa_sppp_open(struct net_device *d) { struct channel_data *chan = d->priv; - int err, flags; + int err; + unsigned long flags; if (!(chan->cosa->firmware_status & COSA_FW_START)) { printk(KERN_NOTICE "%s: start the firmware first (status %d)\n", @@ -682,7 +683,7 @@ static void cosa_sppp_timeout(struct net static int cosa_sppp_close(struct net_device *d) { struct channel_data *chan = d->priv; - int flags; + unsigned long flags; netif_stop_queue(d); sppp_close(d); @@ -779,7 +780,7 @@ static ssize_t cosa_read(struct file *fi char *buf, size_t count, loff_t *ppos) { DECLARE_WAITQUEUE(wait, current); - int flags; + unsigned long flags; struct channel_data *chan = (struct channel_data *)file->private_data; struct cosa_data *cosa = chan->cosa; char *kbuf; @@ -856,7 +857,7 @@ static ssize_t cosa_write(struct file *f DECLARE_WAITQUEUE(wait, current); struct channel_data *chan = (struct channel_data *)file->private_data; struct cosa_data *cosa = chan->cosa; - unsigned int flags; + unsigned long flags; char *kbuf; if (!(cosa->firmware_status & COSA_FW_START)) { @@ -1243,7 +1244,7 @@ static void cosa_disable_rx(struct chann static int cosa_start_tx(struct channel_data *chan, char *buf, int len) { struct cosa_data *cosa = chan->cosa; - int flags; + unsigned long flags; #ifdef DEBUG_DATA int i; @@ -1269,7 +1270,7 @@ static int cosa_start_tx(struct channel_ static void put_driver_status(struct cosa_data *cosa) { - unsigned flags=0; + unsigned long flags; int status; spin_lock_irqsave(&cosa->lock, flags); @@ -1337,7 +1338,7 @@ static void put_driver_status_nolock(str */ static void cosa_kick(struct cosa_data *cosa) { - unsigned flags, flags1; + unsigned long flags, flags1; char *s = "(probably) IRQ"; if (test_bit(RXBIT, &cosa->rxtx)) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/ext2/super.c linux-2.5/fs/ext2/super.c --- bk-linus/fs/ext2/super.c 2002-11-21 02:19:58.000000000 +0000 +++ linux-2.5/fs/ext2/super.c 2002-11-21 18:02:06.000000000 +0000 @@ -917,8 +917,9 @@ static int ext2_remount (struct super_bl * by e2fsck since we originally mounted the partition.) */ sbi->s_mount_state = le16_to_cpu(es->s_state); - if (!ext2_setup_super (sb, es, 0)) - sb->s_flags &= ~MS_RDONLY; + if ((ret = ext2_setup_super (sb, es, 0))) + return ret; + sb->s_flags &= ~MS_RDONLY; } ext2_sync_super(sb, es); return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/ext2/balloc.c linux-2.5/fs/ext2/balloc.c --- bk-linus/fs/ext2/balloc.c 2002-11-21 02:19:57.000000000 +0000 +++ linux-2.5/fs/ext2/balloc.c 2002-11-21 18:02:05.000000000 +0000 @@ -178,8 +178,9 @@ void ext2_free_blocks (struct inode * in lock_super (sb); es = EXT2_SB(sb)->s_es; - if (block < le32_to_cpu(es->s_first_data_block) || - (block + count) > le32_to_cpu(es->s_blocks_count)) { + if (block < le32_to_cpu(es->s_first_data_block) || + block + count < block || + block + count > le32_to_cpu(es->s_blocks_count)) { ext2_error (sb, "ext2_free_blocks", "Freeing blocks not in datazone - " "block = %lu, count = %lu", block, count); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/ext3/balloc.c linux-2.5/fs/ext3/balloc.c --- bk-linus/fs/ext3/balloc.c 2002-11-21 02:19:59.000000000 +0000 +++ linux-2.5/fs/ext3/balloc.c 2002-11-21 18:02:06.000000000 +0000 @@ -120,8 +120,9 @@ void ext3_free_blocks (handle_t *handle, } lock_super (sb); es = EXT3_SB(sb)->s_es; - if (block < le32_to_cpu(es->s_first_data_block) || - (block + count) > le32_to_cpu(es->s_blocks_count)) { + if (block < le32_to_cpu(es->s_first_data_block) || + block + count < block || + block + count >= le32_to_cpu(es->s_blocks_count)) { ext3_error (sb, "ext3_free_blocks", "Freeing blocks not in datazone - " "block = %lu, count = %lu", block, count); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/ext2/ialloc.c linux-2.5/fs/ext2/ialloc.c --- bk-linus/fs/ext2/ialloc.c 2002-11-21 02:19:57.000000000 +0000 +++ linux-2.5/fs/ext2/ialloc.c 2002-11-21 18:02:06.000000000 +0000 @@ -538,6 +538,7 @@ repeat: if (ei->i_flags & EXT2_DIRSYNC_FL) inode->i_flags |= S_DIRSYNC; inode->i_generation = EXT2_SB(sb)->s_next_generation++; + inode->i_version = 1; insert_inode_hash(inode); unlock_super(sb); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/ext3/ialloc.c linux-2.5/fs/ext3/ialloc.c --- bk-linus/fs/ext3/ialloc.c 2002-11-21 02:19:59.000000000 +0000 +++ linux-2.5/fs/ext3/ialloc.c 2002-11-21 18:02:07.000000000 +0000 @@ -559,6 +559,7 @@ repeat: if (IS_DIRSYNC(inode)) handle->h_sync = 1; insert_inode_hash(inode); + inode->i_version = 1; inode->i_generation = EXT3_SB(sb)->s_next_generation++; ei->i_state = EXT3_STATE_NEW; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/ext3/inode.c linux-2.5/fs/ext3/inode.c --- bk-linus/fs/ext3/inode.c 2002-11-21 02:19:59.000000000 +0000 +++ linux-2.5/fs/ext3/inode.c 2002-11-21 18:02:07.000000000 +0000 @@ -2250,6 +2250,7 @@ void ext3_read_inode(struct inode * inod * (for stat), not the fs block * size */ inode->i_blocks = le32_to_cpu(raw_inode->i_blocks); + inode->i_version = 1; ei->i_flags = le32_to_cpu(raw_inode->i_flags); #ifdef EXT3_FRAGMENTS ei->i_faddr = le32_to_cpu(raw_inode->i_faddr); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/ext2/inode.c linux-2.5/fs/ext2/inode.c --- bk-linus/fs/ext2/inode.c 2002-11-21 02:19:57.000000000 +0000 +++ linux-2.5/fs/ext2/inode.c 2002-11-21 18:02:06.000000000 +0000 @@ -1016,6 +1016,7 @@ void ext2_read_inode (struct inode * ino } inode->i_blksize = PAGE_SIZE; /* This is the optimal IO size (for stat), not the fs block size */ inode->i_blocks = le32_to_cpu(raw_inode->i_blocks); + inode->i_version = 1; ei->i_flags = le32_to_cpu(raw_inode->i_flags); ei->i_faddr = le32_to_cpu(raw_inode->i_faddr); ei->i_frag_no = raw_inode->i_frag; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/fcntl.c linux-2.5/fs/fcntl.c --- bk-linus/fs/fcntl.c 2002-11-21 02:19:43.000000000 +0000 +++ linux-2.5/fs/fcntl.c 2002-11-21 18:01:55.000000000 +0000 @@ -146,8 +146,13 @@ static int dupfd(struct file *file, int int ret; ret = locate_fd(files, file, start); - if (ret < 0) + if (ret < 0) { + /* We should return EINVAL instead of EMFILE if the + request for the fd starts beyond the valid range */ + if (ret==-EMFILE && start>=current->rlim[RLIMIT_NOFILE].rlim_cur) + ret = -EINVAL; goto out_putf; + } allocate_fd(files, file, ret); return ret; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/freevxfs/vxfs_kcompat.h linux-2.5/fs/freevxfs/vxfs_kcompat.h --- bk-linus/fs/freevxfs/vxfs_kcompat.h 2002-11-21 02:20:03.000000000 +0000 +++ linux-2.5/fs/freevxfs/vxfs_kcompat.h 2002-11-21 18:02:08.000000000 +0000 @@ -23,27 +23,5 @@ static inline void map_bh(struct buffer_ bh->b_blocknr = block; } -/* From fs/block_dev.c (Linux 2.5.2-pre2) */ -static inline int sb_set_blocksize(struct super_block *sb, int size) -{ - int bits; - if (set_blocksize(sb->s_dev, size) < 0) - return 0; - sb->s_blocksize = size; - for (bits = 9, size >>= 9; size >>= 1; bits++) - ; - sb->s_blocksize_bits = bits; - return sb->s_blocksize; -} - -/* Dito. */ -static inline int sb_min_blocksize(struct super_block *sb, int size) -{ - int minsize = get_hardsect_size(sb->s_dev); - if (size < minsize) - size = minsize; - return sb_set_blocksize(sb, size); -} - #endif /* Kernel 2.4 */ #endif /* _VXFS_KCOMPAT_H */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/intermezzo/journal.c linux-2.5/fs/intermezzo/journal.c --- bk-linus/fs/intermezzo/journal.c 2002-11-21 02:20:11.000000000 +0000 +++ linux-2.5/fs/intermezzo/journal.c 2002-11-21 18:02:14.000000000 +0000 @@ -409,9 +409,8 @@ static inline char *journal_log_suffix(c /* XXX needs to be done after reservation, disable ths until version 1.2 */ if ( dentry ) { - s.prevrec = cpu_to_le32(rec->offset - - presto_d2d(dentry)->dd_kml_offset); - presto_d2d(dentry)->dd_kml_offset = rec->offset; + s.prevrec = cpu_to_le32(rec->offset - dentry->d_time); + dentry->d_time = (unsigned long) rec->offset; } else { s.prevrec = -1; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/intermezzo/kml.c linux-2.5/fs/intermezzo/kml.c --- bk-linus/fs/intermezzo/kml.c 2002-11-21 02:20:12.000000000 +0000 +++ linux-2.5/fs/intermezzo/kml.c 2002-11-21 18:02:14.000000000 +0000 @@ -20,9 +20,9 @@ int begin_kml_reint (struct file *file, { struct { char *volname; - int namelen; + unsigned int namelen; char *recbuf; - int reclen; /* int newpos; */ + unsigned int reclen; /* int newpos; */ } input; struct kml_fsdata *kml_fsdata = NULL; struct presto_file_set *fset = NULL; @@ -36,6 +36,12 @@ int begin_kml_reint (struct file *file, return -EFAULT; } + if (input.namelen > PATH_MAX) + { + EXIT; + return -EINVAL; + } + if (input.reclen > kml_fsdata->kml_maxsize) return -ENOMEM; /* we'll find solution to this in the future */ @@ -75,9 +81,9 @@ int do_kml_reint (struct file *file, uns { struct { char *volname; - int namelen; + unsigned int namelen; char *path; - int pathlen; + unsigned int pathlen; int recno; int offset; int len; @@ -95,6 +101,13 @@ int do_kml_reint (struct file *file, uns EXIT; return -EFAULT; } + + if(input.namelen > PATH_MAX || input.pathlen > PATH_MAX) + { + EXIT; + return -EFAULT; + } + PRESTO_ALLOC(path, char *, input.namelen + 1); if ( !path ) { EXIT; @@ -145,7 +158,7 @@ int end_kml_reint (struct file *file, un /* Free KML buffer and related volume info */ struct { char *volname; - int namelen; + unsigned int namelen; #if 0 int count; int newpos; @@ -162,6 +175,12 @@ int end_kml_reint (struct file *file, un return -EFAULT; } + if (input.namelen > PATH_MAX) + { + EXIT; + return -EFAULT; + } + PRESTO_ALLOC(path, char *, input.namelen + 1); if ( !path ) { EXIT; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/proc/generic.c linux-2.5/fs/proc/generic.c --- bk-linus/fs/proc/generic.c 2002-11-21 02:20:58.000000000 +0000 +++ linux-2.5/fs/proc/generic.c 2002-11-21 18:02:40.000000000 +0000 @@ -65,43 +65,108 @@ proc_file_read(struct file * file, char start = NULL; if (dp->get_info) { - /* - * Handle backwards compatibility with the old net - * routines. - */ + /* Handle old net routines */ n = dp->get_info(page, &start, *ppos, count); if (n < count) eof = 1; } else if (dp->read_proc) { + /* + * How to be a proc read function + * ------------------------------ + * Prototype: + * int f(char *buffer, char **start, off_t offset, + * int count, int *peof, void *dat) + * + * Assume that the buffer is "count" bytes in size. + * + * If you know you have supplied all the data you + * have, set *peof. + * + * You have three ways to return data: + * 0) Leave *start = NULL. (This is the default.) + * Put the data of the requested offset at that + * offset within the buffer. Return the number (n) + * of bytes there are from the beginning of the + * buffer up to the last byte of data. If the + * number of supplied bytes (= n - offset) is + * greater than zero and you didn't signal eof + * and the reader is prepared to take more data + * you will be called again with the requested + * offset advanced by the number of bytes + * absorbed. This interface is useful for files + * no larger than the buffer. + * 1) Set *start = an unsigned long value less than + * the buffer address but greater than zero. + * Put the data of the requested offset at the + * beginning of the buffer. Return the number of + * bytes of data placed there. If this number is + * greater than zero and you didn't signal eof + * and the reader is prepared to take more data + * you will be called again with the requested + * offset advanced by *start. This interface is + * useful when you have a large file consisting + * of a series of blocks which you want to count + * and return as wholes. + * (Hack by Paul.Russell@rustcorp.com.au) + * 2) Set *start = an address within the buffer. + * Put the data of the requested offset at *start. + * Return the number of bytes of data placed there. + * If this number is greater than zero and you + * didn't signal eof and the reader is prepared to + * take more data you will be called again with the + * requested offset advanced by the number of bytes + * absorbed. + */ n = dp->read_proc(page, &start, *ppos, count, &eof, dp->data); } else break; - if (!start) { - /* - * For proc files that are less than 4k - */ - start = page + *ppos; + if (n == 0) /* end of file */ + break; + if (n < 0) { /* error */ + if (retval == 0) + retval = n; + break; + } + + if (start == NULL) { + if (n > PAGE_SIZE) { + printk(KERN_ERR + "proc_file_read: Apparent buffer overflow!\n"); + n = PAGE_SIZE; + } + if (n > count) + n = count; n -= *ppos; if (n <= 0) break; + start = page + *ppos; + } else if (start < page) { + if (n > PAGE_SIZE) { + printk(KERN_ERR + "proc_file_read: Apparent buffer overflow!\n"); + n = PAGE_SIZE; + } + if (n > count) { + /* + * Don't reduce n because doing so might + * cut off part of a data block. + */ + printk(KERN_WARNING + "proc_file_read: Read count exceeded\n"); + } + } else /* start >= page */ { + unsigned long startoff = (unsigned long)(start - page); + if (n > (PAGE_SIZE - startoff)) { + printk(KERN_ERR + "proc_file_read: Apparent buffer overflow!\n"); + n = PAGE_SIZE - startoff; + } if (n > count) n = count; } - if (n == 0) - break; /* End of file */ - if (n < 0) { - if (retval == 0) - retval = n; - break; - } - /* This is a hack to allow mangling of file pos independent - * of actual bytes read. Simply place the data at page, - * return the bytes, and set `start' to the desired offset - * as an unsigned int. - Paul.Russell@rustcorp.com.au - */ n -= copy_to_user(buf, start < page ? page : start, n); if (n == 0) { if (retval == 0) @@ -109,7 +174,7 @@ proc_file_read(struct file * file, char break; } - *ppos += start < page ? (long)start : n; /* Move down the file */ + *ppos += start < page ? (unsigned long)start : n; nbytes -= n; buf += n; retval += n; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/radio/radio-gemtek.c linux-2.5/drivers/media/radio/radio-gemtek.c --- bk-linus/drivers/media/radio/radio-gemtek.c 2002-11-21 02:15:41.000000000 +0000 +++ linux-2.5/drivers/media/radio/radio-gemtek.c 2002-11-21 17:58:53.000000000 +0000 @@ -269,14 +269,14 @@ static int __init gemtek_init(void) printk(KERN_INFO "GemTek Radio Card driver.\n"); spin_lock_init(&lock); - /* mute card - prevents noisy bootups */ - outb(0x10, io); - udelay(5); - gemtek_unit.muted = 1; /* this is _maybe_ unnecessary */ outb(0x01, io); + /* mute card - prevents noisy bootups */ + gemtek_unit.muted = 0; + gemtek_mute(&gemtek_unit); + return 0; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/i2c/i2c-dev.c linux-2.5/drivers/i2c/i2c-dev.c --- bk-linus/drivers/i2c/i2c-dev.c 2002-11-21 02:14:27.000000000 +0000 +++ linux-2.5/drivers/i2c/i2c-dev.c 2002-11-21 17:58:07.000000000 +0000 @@ -115,6 +115,9 @@ static ssize_t i2cdev_read (struct file struct i2c_client *client = (struct i2c_client *)file->private_data; + if(count > 8192) + count = 8192; + /* copy user space data to kernel space. */ tmp = kmalloc(count,GFP_KERNEL); if (tmp==NULL) @@ -143,6 +146,9 @@ static ssize_t i2cdev_write (struct file struct inode *inode = file->f_dentry->d_inode; #endif /* DEBUG */ + if(count > 8192) + count = 8192; + /* copy user space data to kernel space. */ tmp = kmalloc(count,GFP_KERNEL); if (tmp==NULL) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/i2c-id.h linux-2.5/include/linux/i2c-id.h --- bk-linus/include/linux/i2c-id.h 2002-11-21 02:23:52.000000000 +0000 +++ linux-2.5/include/linux/i2c-id.h 2002-11-21 18:04:43.000000000 +0000 @@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ -/* $Id: i2c-id.h,v 1.52 2002/07/10 13:28:44 abz Exp $ */ +/* $Id: i2c-id.h,v 1.55 2002/08/24 20:19:39 mds Exp $ */ #ifndef I2C_ID_H #define I2C_ID_H @@ -143,6 +143,7 @@ #define I2C_DRIVERID_SMSC47M1 1031 #define I2C_DRIVERID_VT1211 1032 #define I2C_DRIVERID_LM92 1033 +#define I2C_DRIVERID_VT8231 1034 /* * ---- Adapter types ---------------------------------------------------- @@ -161,6 +162,7 @@ #define I2C_ALGO_ACB 0x070000 /* ACCESS.bus algorithm */ #define I2C_ALGO_IIC 0x080000 /* ITE IIC bus */ #define I2C_ALGO_SAA7134 0x090000 +#define I2C_ALGO_MPC824X 0x0a0000 /* Motorola 8240 / 8245 */ #define I2C_ALGO_EC 0x100000 /* ACPI embedded controller */ #define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */ @@ -206,6 +208,9 @@ /* --- ACPI Embedded controller algorithms */ #define I2C_HW_ACPI_EC 0x00 +/* --- MPC824x PowerPC adapters */ +#define I2C_HW_MPC824X 0x00 /* Motorola 8240 / 8245 */ + /* --- MPC8xx PowerPC adapters */ #define I2C_HW_MPC8XX_EPON 0x00 /* Eponymous MPC8xx I2C adapter */ @@ -225,6 +230,8 @@ #define I2C_HW_SMBUS_AMD756 0x05 #define I2C_HW_SMBUS_SIS5595 0x06 #define I2C_HW_SMBUS_ALI1535 0x07 +#define I2C_HW_SMBUS_SIS630 0x08 +#define I2C_HW_SMBUS_SIS645 0x09 /* --- ISA pseudo-adapter */ #define I2C_HW_ISA 0x00 diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/ide-scsi.c linux-2.5/drivers/scsi/ide-scsi.c --- bk-linus/drivers/scsi/ide-scsi.c 2002-11-21 02:18:04.000000000 +0000 +++ linux-2.5/drivers/scsi/ide-scsi.c 2002-11-21 18:00:42.000000000 +0000 @@ -725,7 +725,7 @@ static inline struct bio *idescsi_dma_bi int segments = pc->scsi_cmd->use_sg; struct scatterlist *sg = pc->scsi_cmd->request_buffer; - if (!drive->using_dma || !pc->request_transfer || pc->request_transfer % 1024) + if (!drive->using_dma || !pc->request_transfer || pc->request_transfer & 1023) return NULL; if (idescsi_set_direction(pc)) return NULL; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/i2c/i2c-core.c linux-2.5/drivers/i2c/i2c-core.c --- bk-linus/drivers/i2c/i2c-core.c 2002-11-21 02:14:27.000000000 +0000 +++ linux-2.5/drivers/i2c/i2c-core.c 2002-11-21 17:58:07.000000000 +0000 @@ -622,7 +622,8 @@ ssize_t i2cproc_bus_read(struct file * f struct inode * inode = file->f_dentry->d_inode; char *kbuf; struct i2c_client *client; - int i,j,k,order_nr,len=0,len_total; + int i,j,k,order_nr,len=0; + size_t len_total; int order[I2C_CLIENT_MAX]; #define OUTPUT_LENGTH_PER_LINE 70 diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/nvram.c linux-2.5/drivers/char/nvram.c --- bk-linus/drivers/char/nvram.c 2002-11-21 02:13:55.000000000 +0000 +++ linux-2.5/drivers/char/nvram.c 2002-11-21 17:57:42.000000000 +0000 @@ -231,8 +231,7 @@ nvram_set_checksum(void) * The are the file operation function for user access to /dev/nvram */ -static long long -nvram_llseek(struct file *file, loff_t offset, int origin) +static loff_t nvram_llseek(struct file *file,loff_t offset, int origin ) { lock_kernel(); switch (origin) { diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/sk98lin/skge.c linux-2.5/drivers/net/sk98lin/skge.c --- bk-linus/drivers/net/sk98lin/skge.c 2002-11-21 02:16:54.000000000 +0000 +++ linux-2.5/drivers/net/sk98lin/skge.c 2002-11-21 17:59:46.000000000 +0000 @@ -442,7 +442,7 @@ static int __init skge_probe (void) pci_set_dma_mask(pdev, (u64) 0xffffffff)) continue; - if ((dev = init_etherdev(dev, sizeof(DEV_NET))) == 0) { + if ((dev = init_etherdev(dev, sizeof(DEV_NET))) == NULL) { printk(KERN_ERR "Unable to allocate etherdev " "structure!\n"); break; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/mpu401.h linux-2.5/sound/oss/mpu401.h --- bk-linus/sound/oss/mpu401.h 2002-11-21 02:26:07.000000000 +0000 +++ linux-2.5/sound/oss/mpu401.h 2002-11-21 18:06:20.000000000 +0000 @@ -7,7 +7,7 @@ void uart401intr (int irq, void *dev_id, /* From mpu401.c */ int probe_mpu401(struct address_info *hw_config); -void attach_mpu401(struct address_info * hw_config, struct module *owner); +int attach_mpu401(struct address_info * hw_config, struct module *owner); void unload_mpu401(struct address_info *hw_info); int intchk_mpu401(void *dev_id); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/nwflash.c linux-2.5/drivers/char/nwflash.c --- bk-linus/drivers/char/nwflash.c 2002-11-21 02:13:56.000000000 +0000 +++ linux-2.5/drivers/char/nwflash.c 2002-11-21 17:57:42.000000000 +0000 @@ -47,7 +47,7 @@ static int write_block(unsigned long p, static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cmd, unsigned long arg); static ssize_t flash_read(struct file *file, char *buf, size_t count, loff_t * ppos); static ssize_t flash_write(struct file *file, const char *buf, size_t count, loff_t * ppos); -static long long flash_llseek(struct file *file, long long offset, int orig); +static loff_t flash_llseek(struct file *file, loff_t offset, int orig); #define KFLASH_SIZE 1024*1024 //1 Meg #define KFLASH_SIZE4 4*1024*1024 //4 Meg @@ -301,9 +301,9 @@ static ssize_t flash_write(struct file * * also note that seeking relative to the "end of file" isn't supported: * it has no meaning, so it returns -EINVAL. */ -static long long flash_llseek(struct file *file, long long offset, int orig) +static loff_t flash_llseek(struct file *file, loff_t offset, int orig) { - long long ret; + loff_t ret; lock_kernel(); if (flashdebug) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/cmpci.c linux-2.5/sound/oss/cmpci.c --- bk-linus/sound/oss/cmpci.c 2002-11-21 02:26:03.000000000 +0000 +++ linux-2.5/sound/oss/cmpci.c 2002-11-21 18:06:16.000000000 +0000 @@ -2034,7 +2035,7 @@ static int cm_ioctl(struct inode *inode, if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -2053,7 +2054,7 @@ static int cm_ioctl(struct inode *inode, s->dma_adc.count &= s->dma_adc.fragsize-1; } spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/es1370.c linux-2.5/sound/oss/es1370.c --- bk-linus/sound/oss/es1370.c 2002-11-21 02:26:04.000000000 +0000 +++ linux-2.5/sound/oss/es1370.c 2002-11-21 18:06:17.000000000 +0000 @@ -1632,7 +1633,7 @@ static int es1370_ioctl(struct inode *in if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1652,7 +1653,7 @@ static int es1370_ioctl(struct inode *in if (s->dma_dac2.mapped) s->dma_dac2.count &= s->dma_dac2.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -2113,7 +2114,7 @@ static int es1370_ioctl_dac(struct inode if (s->dma_dac1.mapped) s->dma_dac1.count &= s->dma_dac1.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/es1371.c linux-2.5/sound/oss/es1371.c --- bk-linus/sound/oss/es1371.c 2002-11-21 02:26:04.000000000 +0000 +++ linux-2.5/sound/oss/es1371.c 2002-11-21 18:06:18.000000000 +0000 @@ -1820,7 +1821,7 @@ static int es1371_ioctl(struct inode *in if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1840,9 +1841,10 @@ static int es1371_ioctl(struct inode *in if (s->dma_dac2.mapped) s->dma_dac2.count &= s->dma_dac2.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; + case SNDCTL_DSP_GETBLKSIZE: if (file->f_mode & FMODE_WRITE) { if ((val = prog_dmabuf_dac2(s))) @@ -2291,7 +2294,7 @@ static int es1371_ioctl_dac(struct inode if (s->dma_dac1.mapped) s->dma_dac1.count &= s->dma_dac1.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/esssolo1.c linux-2.5/sound/oss/esssolo1.c --- bk-linus/sound/oss/esssolo1.c 2002-11-21 02:26:04.000000000 +0000 +++ linux-2.5/sound/oss/esssolo1.c 2002-11-21 18:06:18.000000000 +0000 @@ -1469,7 +1470,7 @@ static int solo1_ioctl(struct inode *ino if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1495,7 +1496,7 @@ static int solo1_ioctl(struct inode *ino cinfo.bytes, cinfo.blocks, cinfo.ptr, s->dma_dac.buforder, s->dma_dac.numfrag, s->dma_dac.fragshift, s->dma_dac.swptr, s->dma_dac.count, s->dma_dac.fragsize, s->dma_dac.dmasize, s->dma_dac.fragsamples); #endif - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/maestro.c linux-2.5/sound/oss/maestro.c --- bk-linus/sound/oss/maestro.c 2002-11-21 02:26:06.000000000 +0000 +++ linux-2.5/sound/oss/maestro.c 2002-11-21 18:06:19.000000000 +0000 @@ -2760,7 +2761,7 @@ static int ess_ioctl(struct inode *inode if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -2777,7 +2778,7 @@ static int ess_ioctl(struct inode *inode if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/maestro3.c linux-2.5/sound/oss/maestro3.c --- bk-linus/sound/oss/maestro3.c 2002-11-21 02:26:06.000000000 +0000 +++ linux-2.5/sound/oss/maestro3.c 2002-11-21 18:06:20.000000000 +0000 @@ -1815,7 +1816,7 @@ static int m3_ioctl(struct inode *inode, if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; @@ -1830,7 +1831,7 @@ static int m3_ioctl(struct inode *inode, if (s->dma_dac.mapped) s->dma_dac.count &= s->dma_dac.fragsize-1; spin_unlock_irqrestore(&card->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/sonicvibes.c linux-2.5/sound/oss/sonicvibes.c --- bk-linus/sound/oss/sonicvibes.c 2002-11-21 02:26:10.000000000 +0000 +++ linux-2.5/sound/oss/sonicvibes.c 2002-11-21 18:06:24.000000000 +0000 @@ -1803,7 +1804,7 @@ static int sv_ioctl(struct inode *inode, if (s->dma_adc.mapped) s->dma_adc.count &= s->dma_adc.fragsize-1; spin_unlock_irqrestore(&s->lock, flags); - if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) + if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) return -EFAULT; return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/ymfpci.c linux-2.5/sound/oss/ymfpci.c --- bk-linus/sound/oss/ymfpci.c 2002-11-21 02:26:12.000000000 +0000 +++ linux-2.5/sound/oss/ymfpci.c 2002-11-21 18:06:26.000000000 +0000 @@ -2653,7 +2659,7 @@ static struct pci_driver ymfpci_driver = name: "ymfpci", id_table: ymf_id_tbl, probe: ymf_probe_one, - remove: __devexit_p(ymf_remove_one), + remove: __devexit_p(ymf_remove_one), suspend: ymf_suspend, resume: ymf_resume }; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/nfs/nfsroot.c linux-2.5/fs/nfs/nfsroot.c --- bk-linus/fs/nfs/nfsroot.c 2002-11-21 02:20:33.000000000 +0000 +++ linux-2.5/fs/nfs/nfsroot.c 2002-11-21 18:02:25.000000000 +0000 @@ -166,37 +166,6 @@ static struct nfs_bool_opts { /* - * Extract IP address from the parameter string if needed. Note that we - * need to have root_server_addr set _before_ IPConfig gets called as it - * can override it. - */ -static void __init root_nfs_parse_addr(char *name) -{ - int octets = 0; - char *cp, *cq; - - cp = cq = name; - while (octets < 4) { - while (*cp >= '0' && *cp <= '9') - cp++; - if (cp == cq || cp - cq > 3) - break; - if (*cp == '.' || octets == 3) - octets++; - if (octets < 4) - cp++; - cq = cp; - } - if (octets == 4 && (*cp == ':' || *cp == '\0')) { - if (*cp == ':') - *cp++ = '\0'; - root_server_addr = in_aton(name); - strcpy(name, cp); - } -} - - -/* * Parse option string. */ static void __init root_nfs_parse(char *name, char *buf) @@ -348,7 +317,7 @@ int __init nfs_root_setup(char *line) line[sizeof(nfs_root_name) - strlen(NFS_ROOT) - 1] = '\0'; sprintf(nfs_root_name, NFS_ROOT, line); } - root_nfs_parse_addr(nfs_root_name); + root_server_addr = ipconfig_parse_addr(nfs_root_name); return 1; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/net/ipconfig.h linux-2.5/include/net/ipconfig.h --- bk-linus/include/net/ipconfig.h 2002-11-21 02:24:23.000000000 +0000 +++ linux-2.5/include/net/ipconfig.h 2002-11-21 18:05:05.000000000 +0000 @@ -6,6 +6,9 @@ * Automatic IP Layer Configuration */ +#ifndef _NET_IPCONFIG_H +#define _NET_IPCONFIG_H + /* The following are initdata: */ extern int ic_enable; /* Enable or disable the whole shebang */ @@ -36,3 +39,10 @@ extern u8 ic_domain[]; /* DNS (not NIS) #define IC_BOOTP 0x01 /* BOOTP (or DHCP, see below) */ #define IC_RARP 0x02 /* RARP */ #define IC_USE_DHCP 0x100 /* If on, use DHCP instead of BOOTP */ + +#ifdef __KERNEL__ +/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ +extern u32 ipconfig_parse_addr(char *name); /*__init*/ +#endif /* __KERNEL */ + +#endif diff -urpN --exclude-from=/home/davej/.exclude bk-linus/net/ipv4/ipconfig.c linux-2.5/net/ipv4/ipconfig.c --- bk-linus/net/ipv4/ipconfig.c 2002-11-21 02:25:01.000000000 +0000 +++ linux-2.5/net/ipv4/ipconfig.c 2002-11-21 18:05:34.000000000 +0000 @@ -27,7 +27,7 @@ * Merged changes from 2.2.19 into 2.4.3 * -- Eric Biederman , 22 April Aug 2001 * - * Multipe Nameservers in /proc/net/pnp + * Multiple Nameservers in /proc/net/pnp * -- Josef Siemes , Aug 2002 */ @@ -1128,12 +1128,47 @@ static int pnp_get_info(char *buffer, ch #endif /* CONFIG_PROC_FS */ /* + * Extract IP address from the parameter string if needed. Note that we + * need to have root_server_addr set _before_ IPConfig gets called as it + * can override it. + */ +u32 __init ipconfig_parse_addr(char *name) +{ + u32 addr; + int octets = 0; + char *cp, *cq; + + cp = cq = name; + while (octets < 4) { + while (*cp >= '0' && *cp <= '9') + cp++; + if (cp == cq || cp - cq > 3) + break; + if (*cp == '.' || octets == 3) + octets++; + if (octets < 4) + cp++; + cq = cp; + } + if (octets == 4 && (*cp == ':' || *cp == '\0')) { + if (*cp == ':') + *cp++ = '\0'; + addr = in_aton(name); + strcpy(name, cp); + } else + addr = INADDR_NONE; + + return addr; +} + +/* * IP Autoconfig dispatcher. */ static int __init ip_auto_config(void) { unsigned long jiff; + u32 addr; #ifdef CONFIG_PROC_FS proc_net_create("pnp", 0, pnp_get_info); @@ -1222,6 +1257,10 @@ static int __init ip_auto_config(void) ic_dev = ic_first_dev->dev; } + addr = ipconfig_parse_addr(root_server_path); + if (root_server_addr == INADDR_NONE) + root_server_addr = addr; + /* * Use defaults whereever applicable. */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/jffs2/dir.c linux-2.5/fs/jffs2/dir.c --- bk-linus/fs/jffs2/dir.c 2002-11-21 02:20:18.000000000 +0000 +++ linux-2.5/fs/jffs2/dir.c 2002-11-21 18:02:17.000000000 +0000 @@ -785,6 +785,18 @@ static int jffs2_rename (struct inode *o if (S_ISDIR(old_dentry->d_inode->i_mode) && !victim_f) new_dir_i->i_nlink++; + if (victim_f) { + /* There was a victim. Kill it off nicely */ + new_dentry->d_inode->i_nlink--; + /* Don't oops if the victim was a dirent pointing to an + inode which didn't exist. */ + if (victim_f->inocache) { + down(&victim_f->sem); + victim_f->inocache->nlink--; + up(&victim_f->sem); + } + } + /* Unlink the original */ ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), old_dentry->d_name.name, old_dentry->d_name.len, NULL); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/video/w9966.c linux-2.5/drivers/media/video/w9966.c --- bk-linus/drivers/media/video/w9966.c 2002-11-21 02:15:47.000000000 +0000 +++ linux-2.5/drivers/media/video/w9966.c 2002-11-21 17:58:57.000000000 +0000 @@ -568,7 +568,7 @@ static inline int w9966_i2c_setscl(struc if (state) { timeout = jiffies + 100; while (!w9966_i2c_getscl(cam)) { - if (jiffies > timeout) + if (time_after(jiffies, timeout)) return -1; } } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/Documentation/DocBook/kernel-api.tmpl linux-2.5/Documentation/DocBook/kernel-api.tmpl --- bk-linus/Documentation/DocBook/kernel-api.tmpl 2002-11-21 02:08:26.000000000 +0000 +++ linux-2.5/Documentation/DocBook/kernel-api.tmpl 2002-11-21 17:54:14.000000000 +0000 @@ -46,13 +46,19 @@ !Iinclude/asm-i386/unaligned.h + Delaying, scheduling, and timer routines +!Ekernel/context.c +!Ekernel/timer.c + + + Misc functions +!Ekernel/exit.c + @@ -365,7 +371,7 @@ KAO --> !Edrivers/video/fbmem.c Frame Buffer Console -!Edrivers/video/fbcon.c +!Edrivers/video/console/fbcon.c Frame Buffer Colormap !Edrivers/video/fbcmap.c @@ -374,7 +380,7 @@ KAO --> drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment out until somebody adds docs. KAO Frame Buffer Generic Functions -X!Idrivers/video/fbgen.c +!Edrivers/video/fbgen.c KAO --> Frame Buffer Video Mode Database @@ -385,7 +391,7 @@ KAO --> !Idrivers/video/macmodes.c Frame Buffer Fonts -!Idrivers/video/fonts.c +!Idrivers/video/console/fonts.c %#x\n", voice->initial_pitch); - voice->startloop = (woinst->buffer.mem[voicenum].emupageindex << 12) / + voice->startloop = (voice->mem.emupageindex << 12) / woinst->format.bytespervoicesample; voice->endloop = voice->startloop + woinst->buffer.size / woinst->format.bytespervoicesample; voice->start = voice->startloop; @@ -302,7 +227,7 @@ int emu10k1_waveout_open(struct emu10k1_ DPF(2, "emu10k1_waveout_open()\n"); for (voicenum = 0; voicenum < woinst->num_voices; voicenum++) { - if (alloc_buffer(card, buffer, voicenum) < 0) { + if (emu10k1_voice_alloc_buffer(card, &woinst->voice[voicenum].mem, woinst->buffer.pages) < 0) { ERROR(); emu10k1_waveout_close(wave_dev); return -1; @@ -324,7 +249,7 @@ int emu10k1_waveout_open(struct emu10k1_ delay = (48000 * woinst->buffer.fragment_size) / (woinst->format.samplingrate * woinst->format.bytespervoicesample); - emu10k1_timer_install(card, &woinst->timer, delay / 2); + emu10k1_timer_install(card, &woinst->timer, delay); woinst->state = WAVE_STATE_OPEN; @@ -345,7 +270,7 @@ void emu10k1_waveout_close(struct emu10k for (voicenum = 0; voicenum < woinst->num_voices; voicenum++) { emu10k1_voice_free(&woinst->voice[voicenum]); - free_buffer(card, &woinst->buffer, voicenum); + emu10k1_voice_free_buffer(card, &woinst->voice[voicenum].mem); } woinst->state = WAVE_STATE_CLOSED; @@ -404,7 +329,7 @@ int emu10k1_waveout_setformat(struct emu delay = (48000 * woinst->buffer.fragment_size) / (woinst->format.samplingrate * woinst->format.bytespervoicesample); - emu10k1_timer_install(card, &woinst->timer, delay / 2); + emu10k1_timer_install(card, &woinst->timer, delay); } return 0; @@ -449,7 +374,7 @@ void emu10k1_waveout_getxfersize(struct pending_bytes = buffer->size - buffer->free_bytes; - buffer->fill_silence = (pending_bytes < (signed) buffer->fragment_size) ? 1 : 0; + buffer->fill_silence = (pending_bytes < (signed) buffer->fragment_size * 2) ? 1 : 0; if (pending_bytes > (signed) buffer->silence_bytes) { *total_free_bytes = (buffer->free_bytes + buffer->silence_bytes); @@ -511,15 +436,15 @@ static void copy_ilv_block(struct woinst unsigned int pg; unsigned int pgoff; unsigned int voice_num; - struct waveout_mem *mem = woinst->buffer.mem; + struct emu_voice *voice = woinst->voice; pg = str / PAGE_SIZE; pgoff = str % PAGE_SIZE; while (len) { for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) { - if (__copy_from_user((u8 *)(mem[voice_num].addr[pg]) + pgoff, src, woinst->format.bytespervoicesample)) - return; + if (__copy_from_user((u8 *)(voice[voice_num].mem.addr[pg]) + pgoff, src, woinst->format.bytespervoicesample)) + return -EFAULT; src += woinst->format.bytespervoicesample; } @@ -544,7 +469,7 @@ static void fill_block(struct woinst *wo unsigned int pg; unsigned int pgoff; unsigned int voice_num; - struct waveout_mem *mem = woinst->buffer.mem; + struct emu_voice *voice = woinst->voice; unsigned int k; pg = str / PAGE_SIZE; @@ -553,22 +478,22 @@ static void fill_block(struct woinst *wo if (len > PAGE_SIZE - pgoff) { k = PAGE_SIZE - pgoff; for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) - memset((u8 *)mem[voice_num].addr[pg] + pgoff, data, k); + memset((u8 *)voice[voice_num].mem.addr[pg] + pgoff, data, k); len -= k; while (len > PAGE_SIZE) { pg++; for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) - memset(mem[voice_num].addr[pg], data, PAGE_SIZE); + memset(voice[voice_num].mem.addr[pg], data, PAGE_SIZE); len -= PAGE_SIZE; } pg++; for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) - memset(mem[voice_num].addr[pg], data, len); + memset(voice[voice_num].mem.addr[pg], data, len); } else { for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) - memset((u8 *)mem[voice_num].addr[pg] + pgoff, data, len); + memset((u8 *)voice[voice_num].mem.addr[pg] + pgoff, data, len); } } @@ -582,6 +507,7 @@ static void fill_block(struct woinst *wo void emu10k1_waveout_xferdata(struct woinst *woinst, u8 *data, u32 *size) { struct waveout_buffer *buffer = &woinst->buffer; + struct voice_mem *mem = &woinst->voice[0].mem; u32 sizetocopy, sizetocopy_now, start; unsigned long flags; @@ -610,14 +536,14 @@ void emu10k1_waveout_xferdata(struct woi copy_ilv_block(woinst, start, data, sizetocopy_now); copy_ilv_block(woinst, 0, data + sizetocopy_now * woinst->num_voices, sizetocopy); } else { - copy_block(buffer->mem[0].addr, start, data, sizetocopy_now); - copy_block(buffer->mem[0].addr, 0, data + sizetocopy_now, sizetocopy); + copy_block(mem->addr, start, data, sizetocopy_now); + copy_block(mem->addr, 0, data + sizetocopy_now, sizetocopy); } } else { if (woinst->num_voices > 1) copy_ilv_block(woinst, start, data, sizetocopy); else - copy_block(buffer->mem[0].addr, start, data, sizetocopy); + copy_block(mem->addr, start, data, sizetocopy); } } @@ -674,7 +600,7 @@ void emu10k1_waveout_update(struct woins { u32 hw_pos; u32 diff; - + /* There is no actual start yet */ if (!(woinst->state & WAVE_STATE_STARTED)) { hw_pos = woinst->buffer.hw_pos; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/cardwo.h linux-2.5/sound/oss/emu10k1/cardwo.h --- bk-linus/sound/oss/emu10k1/cardwo.h 2002-11-21 02:26:15.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/cardwo.h 2002-11-21 18:06:29.000000000 +0000 @@ -39,20 +39,13 @@ /* setting this to other than a power of two may break some applications */ #define WAVEOUT_MAXBUFSIZE MAXBUFSIZE -#define WAVEOUT_MINBUFSIZE 64 #define WAVEOUT_DEFAULTFRAGLEN 20 /* Time to play a fragment in ms (latency) */ #define WAVEOUT_DEFAULTBUFLEN 500 /* Time to play the entire buffer in ms */ -#define WAVEOUT_MINFRAGSHIFT 6 -#define WAVEOUT_MAXVOICES 6 - -/* waveout_mem is cardwo internal */ -struct waveout_mem { - int emupageindex; - void *addr[BUFMAXPAGES]; - dma_addr_t dma_handle[BUFMAXPAGES]; -}; +#define WAVEOUT_MINFRAGSHIFT 6 /* Minimum fragment size in bytes is 2^6 */ +#define WAVEOUT_MINFRAGS 3 /* _don't_ go bellow 3, it would break silence filling */ +#define WAVEOUT_MAXVOICES 6 struct waveout_buffer { u16 ossfragshift; @@ -60,7 +53,6 @@ struct waveout_buffer { u32 fragment_size; /* in bytes units */ u32 size; /* in bytes units */ u32 pages; /* buffer size in page units*/ - struct waveout_mem mem[WAVEOUT_MAXVOICES]; u32 silence_pos; /* software cursor position (including silence bytes) */ u32 hw_pos; /* hardware cursor position */ u32 free_bytes; /* free bytes available on the buffer (not including silence bytes) */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/efxmgr.c linux-2.5/sound/oss/emu10k1/efxmgr.c --- bk-linus/sound/oss/emu10k1/efxmgr.c 2002-11-21 02:26:15.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/efxmgr.c 2002-11-21 18:06:29.000000000 +0000 @@ -38,7 +38,7 @@ int emu10k1_find_control_gpr(struct patc struct dsp_patch *patch; struct dsp_rpatch *rpatch; char s[PATCH_NAME_SIZE + 4]; - u32 *gpr_used; + unsigned long *gpr_used; int i; DPD(2, "emu10k1_find_control_gpr(): %s %s\n", patch_name, gpr_name); @@ -103,7 +103,7 @@ void emu10k1_set_oss_vol(struct emu10k1_ card->ac97.mixer_state[oss_mixer] = (right << 8) | left; - if (!card->isaps) + if (!card->is_aps) card->ac97.write_mixer(&card->ac97, oss_mixer, left, right); emu10k1_set_volume_gpr(card, card->mgr.ctrl_gpr[oss_mixer][0], left, @@ -171,9 +171,8 @@ void emu10k1_set_volume_gpr(struct emu10 { struct patch_manager *mgr = &card->mgr; unsigned long flags; - int muting; - const s32 log2lin[5] ={ // attenuation (dB) + static const s32 log2lin[4] ={ // attenuation (dB) 0x7fffffff, // 0.0 0x7fffffff * 0.840896415253715 , // 1.5 0x7fffffff * 0.707106781186548, // 3.0 @@ -183,12 +182,10 @@ void emu10k1_set_volume_gpr(struct emu10 if (addr < 0) return; - muting = (scale == 0x10) ? 0x7f: scale; - vol = (100 - vol ) * scale / 100; // Thanks to the comp.dsp newsgroup for this neat trick: - vol = (vol >= muting) ? 0 : (log2lin[vol & 3] >> (vol >> 2)); + vol = (vol >= scale) ? 0 : (log2lin[vol & 3] >> (vol >> 2)); spin_lock_irqsave(&mgr->lock, flags); emu10k1_set_control_gpr(card, addr, vol, 0); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/efxmgr.h linux-2.5/sound/oss/emu10k1/efxmgr.h --- bk-linus/sound/oss/emu10k1/efxmgr.h 2002-11-21 02:26:15.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/efxmgr.h 2002-11-21 18:06:29.000000000 +0000 @@ -35,9 +35,9 @@ #define WRITE_EFX(a, b, c) sblive_writeptr((a), MICROCODEBASE + (b), 0, (c)) #define OP(op, z, w, x, y) \ - do { WRITE_EFX(card, (pc) * 2, ((x) << 10) | (y)); \ - WRITE_EFX(card, (pc) * 2 + 1, ((op) << 20) | ((z) << 10) | (w)); \ - ++pc; } while (0) + do { WRITE_EFX(card, (pc) * 2, ((x) << 10) | (y)); \ + WRITE_EFX(card, (pc) * 2 + 1, ((op) << 20) | ((z) << 10) | (w)); \ + ++pc; } while (0) #define NUM_INPUTS 0x20 #define NUM_OUTPUTS 0x20 @@ -47,52 +47,52 @@ struct dsp_rpatch { char name[PATCH_NAME_SIZE]; - u16 code_start; - u16 code_size; + u16 code_start; + u16 code_size; - u32 gpr_used[NUM_GPRS / 32]; - u32 gpr_input[NUM_GPRS / 32]; - u32 route[NUM_OUTPUTS]; - u32 route_v[NUM_OUTPUTS]; + unsigned long gpr_used[NUM_GPRS / (sizeof(unsigned long) * 8) + 1]; + unsigned long gpr_input[NUM_GPRS / (sizeof(unsigned long) * 8) + 1]; + unsigned long route[NUM_OUTPUTS]; + unsigned long route_v[NUM_OUTPUTS]; }; struct dsp_patch { - char name[PATCH_NAME_SIZE]; - u8 id; - u32 input; /* bitmap of the lines used as inputs */ - u32 output; /* bitmap of the lines used as outputs */ - u16 code_start; - u16 code_size; - - u32 gpr_used[NUM_GPRS / 32]; /* bitmap of used gprs */ - u32 gpr_input[NUM_GPRS / 32]; - u8 traml_istart; /* starting address of the internal tram lines used */ - u8 traml_isize; /* number of internal tram lines used */ - - u8 traml_estart; - u8 traml_esize; - - u16 tramb_istart; /* starting address of the internal tram memory used */ - u16 tramb_isize; /* amount of internal memory used */ - u32 tramb_estart; - u32 tramb_esize; + char name[PATCH_NAME_SIZE]; + u8 id; + unsigned long input; /* bitmap of the lines used as inputs */ + unsigned long output; /* bitmap of the lines used as outputs */ + u16 code_start; + u16 code_size; + + unsigned long gpr_used[NUM_GPRS / (sizeof(unsigned long) * 8) + 1]; /* bitmap of used gprs */ + unsigned long gpr_input[NUM_GPRS / (sizeof(unsigned long) * 8) + 1]; + u8 traml_istart; /* starting address of the internal tram lines used */ + u8 traml_isize; /* number of internal tram lines used */ + + u8 traml_estart; + u8 traml_esize; + + u16 tramb_istart; /* starting address of the internal tram memory used */ + u16 tramb_isize; /* amount of internal memory used */ + u32 tramb_estart; + u32 tramb_esize; }; struct dsp_gpr { - u8 type; /* gpr type, STATIC, DYNAMIC, INPUT, OUTPUT, CONTROL */ - char name[GPR_NAME_SIZE]; /* gpr value, only valid for control gprs */ - s32 min, max; /* value range for this gpr, only valid for control gprs */ - u8 line; /* which input/output line is the gpr attached, only valid for input/output gprs */ - u8 usage; + u8 type; /* gpr type, STATIC, DYNAMIC, INPUT, OUTPUT, CONTROL */ + char name[GPR_NAME_SIZE]; /* gpr value, only valid for control gprs */ + s32 min, max; /* value range for this gpr, only valid for control gprs */ + u8 line; /* which input/output line is the gpr attached, only valid for input/output gprs */ + u8 usage; }; enum { - GPR_TYPE_NULL = 0, - GPR_TYPE_IO, - GPR_TYPE_STATIC, - GPR_TYPE_DYNAMIC, - GPR_TYPE_CONTROL, - GPR_TYPE_CONSTANT + GPR_TYPE_NULL = 0, + GPR_TYPE_IO, + GPR_TYPE_STATIC, + GPR_TYPE_DYNAMIC, + GPR_TYPE_CONTROL, + GPR_TYPE_CONSTANT }; #define GPR_BASE 0x100 @@ -101,15 +101,14 @@ enum { #define MAX_PATCHES_PAGES 32 struct patch_manager { - void *patch[MAX_PATCHES_PAGES]; + void *patch[MAX_PATCHES_PAGES]; int current_pages; - struct dsp_rpatch rpatch; - struct dsp_gpr gpr[NUM_GPRS]; /* gpr usage table */ + struct dsp_rpatch rpatch; + struct dsp_gpr gpr[NUM_GPRS]; /* gpr usage table */ spinlock_t lock; s16 ctrl_gpr[SOUND_MIXER_NRDEVICES][2]; }; - #define PATCHES_PER_PAGE (PAGE_SIZE / sizeof(struct dsp_patch)) #define PATCH(mgr, i) ((struct dsp_patch *) (mgr)->patch[(i) / PATCHES_PER_PAGE] + (i) % PATCHES_PER_PAGE) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/hwaccess.h linux-2.5/sound/oss/emu10k1/hwaccess.h --- bk-linus/sound/oss/emu10k1/hwaccess.h 2002-11-21 02:26:15.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/hwaccess.h 2002-11-21 18:06:29.000000000 +0000 @@ -126,6 +126,7 @@ struct mixer_private_ioctl { #define CMD_SETMCH_FX _IOW('D', 17, struct mixer_private_ioctl) #define CMD_SETPASSTHROUGH _IOW('D', 18, struct mixer_private_ioctl) #define CMD_PRIVATE3_VERSION _IOW('D', 19, struct mixer_private_ioctl) +#define CMD_AC97_BOOST _IOW('D', 20, struct mixer_private_ioctl) //up this number when breaking compatibility #define PRIVATE3_VERSION 1 @@ -181,7 +182,7 @@ struct emu10k1_card u8 chiprev; /* Chip revision */ - int isaps; + u8 is_aps; struct patch_manager mgr; struct pt_data pt; @@ -216,7 +217,7 @@ u32 emu10k1_readfn0(struct emu10k1_card void sblive_writeptr(struct emu10k1_card *, u32 , u32 , u32 ); void sblive_writeptr_tag(struct emu10k1_card *card, u32 channel, ...); -#define TAGLIST_END 0 +#define TAGLIST_END 0 u32 sblive_readptr(struct emu10k1_card *, u32 , u32 ); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/irqmgr.c linux-2.5/sound/oss/emu10k1/irqmgr.c --- bk-linus/sound/oss/emu10k1/irqmgr.c 2002-11-21 02:26:15.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/irqmgr.c 2002-11-21 18:06:29.000000000 +0000 @@ -1,4 +1,3 @@ - /* ********************************************************************** * irqmgr.c - IRQ manager for emu10k1 driver @@ -41,7 +40,7 @@ void emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct emu10k1_card *card = (struct emu10k1_card *) dev_id; - u32 irqstatus; + u32 irqstatus, irqstatus_tmp; DPD(4, "emu10k1_interrupt called, irq = %u\n", irq); @@ -60,8 +59,7 @@ void emu10k1_interrupt(int irq, void *de while ((irqstatus = inl(card->iobase + IPR))) { DPD(4, "irq status %#x\n", irqstatus); - /* acknowledge interrupt */ - outl(irqstatus, card->iobase + IPR); + irqstatus_tmp = irqstatus; if (irqstatus & IRQTYPE_TIMER) { emu10k1_timer_irqhandler(card); @@ -98,7 +96,15 @@ void emu10k1_interrupt(int irq, void *de irqstatus &=~IPR_VOLDECR; } - if (irqstatus) - emu10k1_irq_disable(card, irqstatus); + if (irqstatus){ + printk(KERN_ERR "emu10k1: Warning, unhandled interrupt: %#08x\n", irqstatus); + //make sure any interrupts we don't handle are disabled: + emu10k1_irq_disable(card, ~(INTE_MIDIRXENABLE | INTE_MIDITXENABLE | INTE_INTERVALTIMERENB | + INTE_VOLDECRENABLE | INTE_VOLINCRENABLE | INTE_MUTEENABLE | + INTE_FXDSPENABLE)); + } + + /* acknowledge interrupt */ + outl(irqstatus_tmp, card->iobase + IPR); } } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/main.c linux-2.5/sound/oss/emu10k1/main.c --- bk-linus/sound/oss/emu10k1/main.c 2002-11-21 02:26:15.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/main.c 2002-11-21 18:06:29.000000000 +0000 @@ -1,4 +1,4 @@ -/* + /* ********************************************************************** * main.c - Creative EMU10K1 audio driver * Copyright 1999, 2000 Creative Labs, Inc. @@ -69,7 +69,18 @@ * 0.16 Mixer improvements, added old treble/bass support (Daniel Bertrand) * Small code format cleanup. * Deadlock bug fix for emu10k1_volxxx_irqhandler(). - * + * 0.17 Fix for mixer SOUND_MIXER_INFO ioctl. + * Fix for HIGHMEM machines (emu10k1 can only do 31 bit bus master) + * midi poll initial implementation. + * Small mixer fixes/cleanups. + * Improved support for 5.1 cards. + * 0.18 Fix for possible leak in pci_alloc_consistent() + * Cleaned up poll() functions (audio and midi). Don't start input. + * Restrict DMA pages used to 512Mib range. + * New AC97_BOOST mixer ioctl. + * 0.19 Real fix for kernel with highmem support (cast dma_handle to u32) + * Fix recording buffering parameters calculation + * Use unsigned long for variables in bit ops. *********************************************************************/ /* These are only included once per module */ @@ -102,11 +113,10 @@ #define SNDCARD_EMU10K1 46 #endif -#define DRIVER_VERSION "0.16" +#define DRIVER_VERSION "0.19" -/* FIXME: is this right? */ -/* does the card support 32 bit bus master?*/ -#define EMU10K1_DMA_MASK 0xffffffff /* DMA buffer mask for pci_alloc_consist */ +/* the emu10k1 _seems_ to only supports 29 bit (512MiB) bit bus master */ +#define EMU10K1_DMA_MASK 0x1fffffff /* DMA buffer mask for pci_alloc_consist */ #ifndef PCI_VENDOR_ID_CREATIVE #define PCI_VENDOR_ID_CREATIVE 0x1102 @@ -188,7 +198,7 @@ static int __devinit emu10k1_audio_init( /* Assign default recording parameters */ /* FIXME */ - if(card->isaps) + if (card->is_aps) card->wavein.recsrc = WAVERECORD_FX; else card->wavein.recsrc = WAVERECORD_AC97; @@ -211,6 +221,8 @@ static void __devinit emu10k1_audio_clea static int __devinit emu10k1_mixer_init(struct emu10k1_card *card) { char s[32]; + + struct ac97_codec *codec = &card->ac97; card->ac97.dev_mixer = register_sound_mixer(&emu10k1_mixer_fops, -1); if (card->ac97.dev_mixer < 0) { printk(KERN_ERR "emu10k1: cannot register mixer device\n"); @@ -219,7 +231,7 @@ static int __devinit emu10k1_mixer_init( card->ac97.private_data = card; - if (!card->isaps) { + if (!card->is_aps) { card->ac97.id = 0; card->ac97.codec_read = emu10k1_ac97_read; card->ac97.codec_write = emu10k1_ac97_write; @@ -228,11 +240,14 @@ static int __devinit emu10k1_mixer_init( printk(KERN_ERR "emu10k1: unable to probe AC97 codec\n"); goto err_out; } - /* 5.1: Enable the additional AC97 Slots. If the emu10k1 version - does not support this, it shouldn't do any harm */ - sblive_writeptr(card, AC97SLOT, 0, AC97SLOT_CNTR | AC97SLOT_LFE); + /* 5.1: Enable the additional AC97 Slots and unmute extra channels on AC97 codec */ + if (codec->codec_read(codec, AC97_EXTENDED_ID) & 0x0080){ + printk(KERN_INFO "emu10k1: SBLive! 5.1 card detected\n"); + sblive_writeptr(card, AC97SLOT, 0, AC97SLOT_CNTR | AC97SLOT_LFE); + codec->codec_write(codec, AC97_SURROUND_MASTER, 0x0); + } - // Force 5bit + // Force 5bit: //card->ac97.bit_resolution=5; if (!proc_mkdir ("driver/emu10k1", 0)) { @@ -274,7 +289,7 @@ static void __devinit emu10k1_mixer_clea { char s[32]; - if (!card->isaps) { + if (!card->is_aps) { sprintf(s, "driver/emu10k1/%s/ac97", card->pci_dev->slot_name); remove_proc_entry(s, NULL); @@ -586,15 +601,15 @@ static int __devinit fx_init(struct emu1 CONNECT(PCM1_IN_R, ANALOG_REAR_R); /* Digital In + PCM + AC97 In + MULTI_FRONT --> Digital out */ - OP(6, 0x10b, 0x100, 0x102, 0x10c); - OP(6, 0x10b, 0x10b, 0x113, 0x40); + OP(6, 0x10a, 0x100, 0x102, 0x10c); + OP(6, 0x10a, 0x10a, 0x113, 0x40); CONNECT(MULTI_FRONT_L, DIGITAL_OUT_L); CONNECT(PCM_IN_L, DIGITAL_OUT_L); CONNECT(AC97_IN_L, DIGITAL_OUT_L); CONNECT(SPDIF_CD_L, DIGITAL_OUT_L); - OP(6, 0x10a, 0x101, 0x103, 0x10e); + OP(6, 0x10b, 0x101, 0x103, 0x10e); OP(6, 0x10b, 0x10b, 0x114, 0x40); CONNECT(MULTI_FRONT_R, DIGITAL_OUT_R); @@ -768,7 +783,7 @@ static int __devinit hw_init(struct emu1 VTFT, 0xffff, CVCF, 0xffff, PTRX, 0, - CPF, 0, + //CPF, 0, CCR, 0, PSST, 0, @@ -794,7 +809,9 @@ static int __devinit hw_init(struct emu1 ENVVOL, 0, ENVVAL, 0, TAGLIST_END); + sblive_writeptr(card, CPF, nCh, 0); } + /* ** Init to 0x02109204 : @@ -852,19 +869,19 @@ static int __devinit hw_init(struct emu1 } for (pagecount = 0; pagecount < MAXPAGES; pagecount++) - ((u32 *) card->virtualpagetable.addr)[pagecount] = cpu_to_le32((card->silentpage.dma_handle * 2) | pagecount); + ((u32 *) card->virtualpagetable.addr)[pagecount] = cpu_to_le32(((u32) card->silentpage.dma_handle * 2) | pagecount); /* Init page table & tank memory base register */ sblive_writeptr_tag(card, 0, - PTB, card->virtualpagetable.dma_handle, + PTB, (u32) card->virtualpagetable.dma_handle, TCB, 0, TCBS, 0, TAGLIST_END); for (nCh = 0; nCh < NUM_G; nCh++) { sblive_writeptr_tag(card, nCh, - MAPA, MAP_PTI_MASK | (card->silentpage.dma_handle * 2), - MAPB, MAP_PTI_MASK | (card->silentpage.dma_handle * 2), + MAPA, MAP_PTI_MASK | ((u32) card->silentpage.dma_handle * 2), + MAPB, MAP_PTI_MASK | ((u32) card->silentpage.dma_handle * 2), TAGLIST_END); } @@ -951,8 +968,9 @@ static void __devinit emu10k1_cleanup(st VTFT, 0, CVCF, 0, PTRX, 0, - CPF, 0, + //CPF, 0, TAGLIST_END); + sblive_writeptr(card, CPF, ch, 0); } /* Disable audio and lock cache */ @@ -1043,7 +1061,7 @@ static int __devinit emu10k1_probe(struc card->iobase + card->length - 1, card->irq); pci_read_config_dword(pci_dev, PCI_SUBSYSTEM_VENDOR_ID, &subsysvid); - card->isaps = (subsysvid == EMU_APS_SUBID); + card->is_aps = (subsysvid == EMU_APS_SUBID); spin_lock_init(&card->lock); init_MUTEX(&card->open_sem); @@ -1074,7 +1092,7 @@ static int __devinit emu10k1_probe(struc goto err_emu10k1_init; } - if (card->isaps) + if (card->is_aps) emu10k1_ecard_init(card); list_add(&card->list, &emu10k1_devs); @@ -1119,7 +1137,7 @@ static void __devexit emu10k1_remove(str pci_set_drvdata(pci_dev, NULL); } -MODULE_AUTHOR("Bertrand Lee, Cai Ying. (Email to: emu10k1-devel@opensource.creative.com)"); +MODULE_AUTHOR("Bertrand Lee, Cai Ying. (Email to: emu10k1-devel@lists.sourceforge.net)"); MODULE_DESCRIPTION("Creative EMU10K1 PCI Audio Driver v" DRIVER_VERSION "\nCopyright (C) 1999 Creative Technology Ltd."); MODULE_LICENSE("GPL"); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/midi.c linux-2.5/sound/oss/emu10k1/midi.c --- bk-linus/sound/oss/emu10k1/midi.c 2002-11-21 02:26:15.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/midi.c 2002-11-21 18:06:29.000000000 +0000 @@ -31,6 +31,7 @@ #define __NO_VERSION__ #include +#include #include #include #include @@ -371,8 +372,32 @@ static ssize_t emu10k1_midi_write(struct static unsigned int emu10k1_midi_poll(struct file *file, struct poll_table_struct *wait) { + struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *) file->private_data; + unsigned long flags; + unsigned int mask = 0; + DPF(4, "emu10k1_midi_poll() called\n"); - return 0; + + if (file->f_mode & FMODE_WRITE) + poll_wait(file, &midi_dev->oWait, wait); + + if (file->f_mode & FMODE_READ) + poll_wait(file, &midi_dev->iWait, wait); + + spin_lock_irqsave(&midi_spinlock, flags); + + if (file->f_mode & FMODE_WRITE) + mask |= POLLOUT | POLLWRNORM; + + if (file->f_mode & FMODE_READ) { + if (midi_dev->mistate == MIDIIN_STATE_STARTED) + if (midi_dev->icnt > 0) + mask |= POLLIN | POLLRDNORM; + } + + spin_unlock_irqrestore(&midi_spinlock, flags); + + return mask; } int emu10k1_midi_callback(unsigned long msg, unsigned long refdata, unsigned long *pmsg) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/mixer.c linux-2.5/sound/oss/emu10k1/mixer.c --- bk-linus/sound/oss/emu10k1/mixer.c 2002-11-21 02:26:16.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/mixer.c 2002-11-21 18:06:29.000000000 +0000 @@ -251,7 +251,7 @@ static int emu10k1_private_mixer(struct case CMD_SETRECSRC: switch (ctl->val[0]) { case WAVERECORD_AC97: - if (card->isaps) { + if (card->is_aps) { ret = -EINVAL; break; } @@ -444,6 +444,7 @@ static int emu10k1_private_mixer(struct case CMD_SETGPR2OSS: id = ctl->val[0]; + /* 0 == left, 1 == right */ ch = ctl->val[1]; addr = ctl->val[2]; @@ -454,19 +455,19 @@ static int emu10k1_private_mixer(struct card->mgr.ctrl_gpr[id][ch] = addr; - if (card->isaps) + if (card->is_aps) break; if (addr >= 0) { unsigned int state = card->ac97.mixer_state[id]; - if (ch) { + if (ch == 1) { state >>= 8; card->ac97.stereo_mixers |= (1 << id); - } else { - card->ac97.supported_mixers |= (1 << id); } + card->ac97.supported_mixers |= (1 << id); + if (id == SOUND_MIXER_TREBLE) { set_treble(card, card->ac97.mixer_state[id] & 0xff, (card->ac97.mixer_state[id] >> 8) & 0xff); } else if (id == SOUND_MIXER_BASS) { @@ -475,10 +476,10 @@ static int emu10k1_private_mixer(struct emu10k1_set_volume_gpr(card, addr, state & 0xff, volume_params[id]); } else { - if (ch) { - card->ac97.stereo_mixers &= ~(1 << id); - card->ac97.stereo_mixers |= card->ac97_stereo_mixers; - } else { + card->ac97.stereo_mixers &= ~(1 << id); + card->ac97.stereo_mixers |= card->ac97_stereo_mixers; + + if (ch == 0) { card->ac97.supported_mixers &= ~(1 << id); card->ac97.supported_mixers |= card->ac97_supported_mixers; } @@ -499,6 +500,12 @@ static int emu10k1_private_mixer(struct ret = -EFAULT; break; + case CMD_AC97_BOOST: + if(ctl->val[0]) + emu10k1_ac97_write(&card->ac97, 0x18, 0x0); + else + emu10k1_ac97_write(&card->ac97, 0x18, 0x0808); + break; default: ret = -EINVAL; break; @@ -551,7 +558,7 @@ static int emu10k1_private_mixer(struct card->tankmem.size = size; - sblive_writeptr_tag(card, 0, TCB, card->tankmem.dma_handle, TCBS, size_reg, TAGLIST_END); + sblive_writeptr_tag(card, 0, TCB, (u32) card->tankmem.dma_handle, TCBS, size_reg, TAGLIST_END); emu10k1_writefn0(card, HCFG_LOCKTANKCACHE, 0); } @@ -572,6 +579,8 @@ static int emu10k1_dsp_mixer(struct emu1 int val; int scale; + card->ac97.modcnt++; + if (get_user(val, (int *)arg)) return -EFAULT; @@ -612,7 +621,7 @@ static int emu10k1_mixer_ioctl(struct in unsigned int oss_mixer = _IOC_NR(cmd); ret = -EINVAL; - if (!card->isaps) { + if (!card->is_aps) { if (cmd == SOUND_MIXER_INFO) { mixer_info info; @@ -626,7 +635,7 @@ static int emu10k1_mixer_ioctl(struct in return 0; } - if ((_IOC_DIR(cmd) == (_IOC_WRITE|_IOC_READ)) && oss_mixer <= SOUND_MIXER_NRDEVICES) + if ((_SIOC_DIR(cmd) == (_SIOC_WRITE|_SIOC_READ)) && oss_mixer <= SOUND_MIXER_NRDEVICES) ret = emu10k1_dsp_mixer(card, oss_mixer, arg); else ret = card->ac97.mixer_ioctl(&card->ac97, cmd, arg); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/recmgr.c linux-2.5/sound/oss/emu10k1/recmgr.c --- bk-linus/sound/oss/emu10k1/recmgr.c 2002-11-21 02:26:16.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/recmgr.c 2002-11-21 18:06:29.000000000 +0000 @@ -130,9 +130,9 @@ void emu10k1_set_record_src(struct emu10 break; } - DPD(2, "bus addx: %#x\n", buffer->dma_handle); + DPD(2, "bus addx: %#x\n", (u32) buffer->dma_handle); - sblive_writeptr(card, buffer->addrreg, 0, buffer->dma_handle); + sblive_writeptr(card, buffer->addrreg, 0, (u32) buffer->dma_handle); return; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/voicemgr.c linux-2.5/sound/oss/emu10k1/voicemgr.c --- bk-linus/sound/oss/emu10k1/voicemgr.c 2002-11-21 02:26:16.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/voicemgr.c 2002-11-21 18:06:29.000000000 +0000 @@ -32,6 +32,84 @@ #include "voicemgr.h" #include "8010.h" +/** + * emu10k1_voice_alloc_buffer - + * + * allocates the memory buffer for a voice. Two page tables are kept for each buffer. + * One (dma_handle) keeps track of the host memory pages used and the other (virtualpagetable) + * is passed to the device so that it can do DMA to host memory. + * + */ +int emu10k1_voice_alloc_buffer(struct emu10k1_card *card, struct voice_mem *mem, u32 pages) +{ + u32 pageindex, pagecount; + u32 busaddx; + int i; + + DPD(2, "requested pages is: %d\n", pages); + + if ((mem->emupageindex = emu10k1_addxmgr_alloc(pages * PAGE_SIZE, card)) < 0) + { + DPF(1, "couldn't allocate emu10k1 address space\n"); + return -1; + } + + /* Fill in virtual memory table */ + for (pagecount = 0; pagecount < pages; pagecount++) { + if ((mem->addr[pagecount] = pci_alloc_consistent(card->pci_dev, PAGE_SIZE, &mem->dma_handle[pagecount])) + == NULL) { + mem->pages = pagecount; + DPF(1, "couldn't allocate dma memory\n"); + return -1; + } + + DPD(2, "Virtual Addx: %p\n", mem->addr[pagecount]); + + for (i = 0; i < PAGE_SIZE / EMUPAGESIZE; i++) { + busaddx = (u32) mem->dma_handle[pagecount] + i * EMUPAGESIZE; + + DPD(3, "Bus Addx: %#x\n", busaddx); + + pageindex = mem->emupageindex + pagecount * PAGE_SIZE / EMUPAGESIZE + i; + + ((u32 *) card->virtualpagetable.addr)[pageindex] = cpu_to_le32((busaddx * 2) | pageindex); + } + } + + mem->pages = pagecount; + + return 0; +} + +/** + * emu10k1_voice_free_buffer - + * + * frees the memory buffer for a voice. + */ +void emu10k1_voice_free_buffer(struct emu10k1_card *card, struct voice_mem *mem) +{ + u32 pagecount, pageindex; + int i; + + if (mem->emupageindex < 0) + return; + + for (pagecount = 0; pagecount < mem->pages; pagecount++) { + pci_free_consistent(card->pci_dev, PAGE_SIZE, + mem->addr[pagecount], + mem->dma_handle[pagecount]); + + for (i = 0; i < PAGE_SIZE / EMUPAGESIZE; i++) { + pageindex = mem->emupageindex + pagecount * PAGE_SIZE / EMUPAGESIZE + i; + ((u32 *) card->virtualpagetable.addr)[pageindex] = + cpu_to_le32(((u32) card->silentpage.dma_handle * 2) | pageindex); + } + } + + emu10k1_addxmgr_free(card, mem->emupageindex); + mem->emupageindex = -1; +} + int emu10k1_voice_alloc(struct emu10k1_card *card, struct emu_voice *voice) { u8 *voicetable = card->voicetable; @@ -96,8 +174,10 @@ void emu10k1_voice_free(struct emu_voice VTFT, 0x0000ffff, PTRX_PITCHTARGET, 0, CVCF, 0x0000ffff, - CPF, 0, + //CPF, 0, TAGLIST_END); + + sblive_writeptr(card, CPF, voice->num + i, 0); } voice->usage = VOICE_USAGE_FREE; @@ -151,8 +231,8 @@ void emu10k1_voice_playback_setup(struct Z1, 0, Z2, 0, /* Invalidate maps */ - MAPA, MAP_PTI_MASK | (card->silentpage.dma_handle * 2), - MAPB, MAP_PTI_MASK | (card->silentpage.dma_handle * 2), + MAPA, MAP_PTI_MASK | ((u32) card->silentpage.dma_handle * 2), + MAPB, MAP_PTI_MASK | ((u32) card->silentpage.dma_handle * 2), /* modulation envelope */ CVCF, 0x0000ffff, VTFT, 0x0000ffff, diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/voicemgr.h linux-2.5/sound/oss/emu10k1/voicemgr.h --- bk-linus/sound/oss/emu10k1/voicemgr.h 2002-11-21 02:26:16.000000000 +0000 +++ linux-2.5/sound/oss/emu10k1/voicemgr.h 2002-11-21 18:06:29.000000000 +0000 @@ -64,6 +64,12 @@ struct voice_param u32 byampl_env_decay; }; +struct voice_mem { + int emupageindex; + void *addr[BUFMAXPAGES]; + dma_addr_t dma_handle[BUFMAXPAGES]; + u32 pages; +}; struct emu_voice { @@ -72,16 +78,20 @@ struct emu_voice u8 num; /* Voice ID */ u8 flags; /* Stereo/mono, 8/16 bit */ - u32 startloop; - u32 endloop; + u32 startloop; + u32 endloop; u32 start; u32 initial_pitch; u32 pitch_target; struct voice_param params[2]; + + struct voice_mem mem; }; +int emu10k1_voice_alloc_buffer(struct emu10k1_card *, struct voice_mem *, u32); +void emu10k1_voice_free_buffer(struct emu10k1_card *, struct voice_mem *); int emu10k1_voice_alloc(struct emu10k1_card *, struct emu_voice *); void emu10k1_voice_free(struct emu_voice *); void emu10k1_voice_playback_setup(struct emu_voice *); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/Makefile linux-2.5/sound/oss/Makefile --- bk-linus/sound/oss/Makefile 2002-11-21 02:26:00.000000000 +0000 +++ linux-2.5/sound/oss/Makefile 2002-11-21 18:06:13.000000000 +0000 @@ -69,7 +69,7 @@ obj-$(CONFIG_SOUND_TRIDENT) += trident.o obj-$(CONFIG_SOUND_EMU10K1) += ac97_codec.o obj-$(CONFIG_SOUND_RME96XX) += rme96xx.o obj-$(CONFIG_SOUND_BT878) += btaudio.o -obj-$(CONFIG_SOUND_EMU10K1) += ac97_codec.o +obj-$(CONFIG_SOUND_IT8172) += ite8172.o ac97_codec.o ifeq ($(CONFIG_MIDI_EMU10K1),y) obj-$(CONFIG_SOUND_EMU10K1) += sound.o diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/i810_audio.c linux-2.5/sound/oss/i810_audio.c --- bk-linus/sound/oss/i810_audio.c 2002-11-21 02:26:05.000000000 +0000 +++ linux-2.5/sound/oss/i810_audio.c 2002-11-21 18:06:19.000000000 +0000 @@ -101,6 +101,9 @@ #ifndef PCI_DEVICE_ID_INTEL_ICH3 #define PCI_DEVICE_ID_INTEL_ICH3 0x2485 #endif +#ifndef PCI_DEVICE_ID_INTEL_ICH4 +#define PCI_DEVICE_ID_INTEL_ICH4 0x24c5 +#endif #ifndef PCI_DEVICE_ID_INTEL_440MX #define PCI_DEVICE_ID_INTEL_440MX 0x7195 #endif @@ -110,6 +113,9 @@ #ifndef PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO #define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO 0x01b1 #endif +#ifndef PCI_DEVICE_ID_AMD_768_AUDIO +#define PCI_DEVICE_ID_AMD_768_AUDIO 0x7445 +#endif static int ftsodell=0; static int strict_clocking=0; @@ -230,8 +236,11 @@ enum { INTEL440MX, INTELICH2, INTELICH3, + INTELICH4, SI7012, - NVIDIA_NFORCE + NVIDIA_NFORCE, + AMD768, + AMD8111 }; static char * card_names[] = { @@ -240,8 +249,11 @@ static char * card_names[] = { "Intel 440MX", "Intel ICH2", "Intel ICH3", + "Intel ICH4", "SiS 7012", - "NVIDIA nForce Audio" + "NVIDIA nForce Audio", + "AMD 768", + "AMD-8111 IOHub" }; static struct pci_device_id i810_pci_tbl [] __initdata = { @@ -255,10 +267,16 @@ static struct pci_device_id i810_pci_tbl PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH2}, {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH3}, + {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH4, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_7012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SI7012}, {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NVIDIA_NFORCE}, + {PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_768_AUDIO, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD768}, + {PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_AUDIO, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD8111}, {0,} }; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/i810_audio.c linux-2.5/sound/oss/i810_audio.c --- bk-linus/sound/oss/i810_audio.c 2002-11-21 02:26:05.000000000 +0000 +++ linux-2.5/sound/oss/i810_audio.c 2002-11-21 18:06:19.000000000 +0000 @@ -2686,6 +2705,14 @@ static int __init i810_ac97_init(struct break; } + codec->codec_write(codec, AC97_EXTENDED_MODEM_ID, 0L); + if(codec->codec_read(codec, AC97_EXTENDED_MODEM_ID)) + { + printk(KERN_WARNING "i810_audio: codec %d is a softmodem - skipping.\n", num_ac97); + kfree(codec); + continue; + } + card->ac97_features = eid; /* Now check the codec for useful features to make up for diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/mpu401.c linux-2.5/sound/oss/mpu401.c --- bk-linus/sound/oss/mpu401.c 2002-11-21 02:26:07.000000000 +0000 +++ linux-2.5/sound/oss/mpu401.c 2002-11-21 18:06:20.000000000 +0000 @@ -15,6 +15,7 @@ * Alan Cox modularisation, use normal request_irq, use dev_id * Bartlomiej Zolnierkiewicz removed some __init to allow using many drivers * Chris Rankin Update the module-usage counter for the coprocessor + * Zwane Mwaikambo Changed attach/unload resource freeing */ #include @@ -79,7 +80,7 @@ struct mpu_config static void mpu401_close(int dev); -static int mpu401_status(struct mpu_config *devc) +static inline int mpu401_status(struct mpu_config *devc) { return inb(STATPORT(devc->base)); } @@ -87,17 +88,17 @@ static int mpu401_status(struct mpu_conf #define input_avail(devc) (!(mpu401_status(devc)&INPUT_AVAIL)) #define output_ready(devc) (!(mpu401_status(devc)&OUTPUT_READY)) -static void write_command(struct mpu_config *devc, unsigned char cmd) +static inline void write_command(struct mpu_config *devc, unsigned char cmd) { outb(cmd, COMDPORT(devc->base)); } -static int read_data(struct mpu_config *devc) +static inline int read_data(struct mpu_config *devc) { return inb(DATAPORT(devc->base)); } -static void write_data(struct mpu_config *devc, unsigned char byte) +static inline void write_data(struct mpu_config *devc, unsigned char byte) { outb(byte, DATAPORT(devc->base)); } @@ -962,12 +963,12 @@ static void mpu401_chk_version(int n, st spin_unlock_irqrestore(&devc->lock,flags); } -void attach_mpu401(struct address_info *hw_config, struct module *owner) +int attach_mpu401(struct address_info *hw_config, struct module *owner) { unsigned long flags; char revision_char; - int m; + int m, ret; struct mpu_config *devc; hw_config->slots[1] = -1; @@ -975,7 +976,8 @@ void attach_mpu401(struct address_info * if (m == -1) { printk(KERN_WARNING "MPU-401: Too many midi devices detected\n"); - return; + ret = -ENOMEM; + goto out_err; } devc = &dev_conf[m]; devc->base = hw_config->io_base; @@ -1006,16 +1008,16 @@ void attach_mpu401(struct address_info * if (!reset_mpu401(devc)) { printk(KERN_WARNING "mpu401: Device didn't respond\n"); - sound_unload_mididev(m); - return; + ret = -ENODEV; + goto out_mididev; } if (!devc->shared_irq) { if (request_irq(devc->irq, mpuintr, 0, "mpu401", (void *)m) < 0) { printk(KERN_WARNING "mpu401: Failed to allocate IRQ%d\n", devc->irq); - sound_unload_mididev(m); - return; + ret = -ENOMEM; + goto out_mididev; } } spin_lock_irqsave(&devc->lock,flags); @@ -1024,7 +1026,12 @@ void attach_mpu401(struct address_info * mpu401_chk_version(m, devc); spin_unlock_irqrestore(&devc->lock,flags); } - request_region(hw_config->io_base, 2, "mpu401"); + + if (!request_region(hw_config->io_base, 2, "mpu401")) + { + ret = -ENOMEM; + goto out_irq; + } if (devc->version != 0) if (mpu_cmd(m, 0xC5, 0) >= 0) /* Set timebase OK */ @@ -1036,9 +1043,9 @@ void attach_mpu401(struct address_info * if (mpu401_synth_operations[m] == NULL) { - sound_unload_mididev(m); printk(KERN_ERR "mpu401: Can't allocate memory\n"); - return; + ret = -ENOMEM; + goto out_resource; } if (!(devc->capabilities & MPU_CAP_INTLG)) /* No intelligent mode */ { @@ -1117,6 +1124,17 @@ void attach_mpu401(struct address_info * hw_config->slots[1] = m; sequencer_init(); + + return 0; + +out_resource: + release_region(hw_config->io_base, 2); +out_irq: + free_irq(devc->irq, (void *)m); +out_mididev: + sound_unload_mididev(m); +out_err: + return ret; } static int reset_mpu401(struct mpu_config *devc) @@ -1227,15 +1245,17 @@ void unload_mpu401(struct address_info * { void *p; int n=hw_config->slots[1]; - - release_region(hw_config->io_base, 2); - if (hw_config->always_detect == 0 && hw_config->irq > 0) - free_irq(hw_config->irq, (void *)n); - p=mpu401_synth_operations[n]; - sound_unload_mididev(n); - sound_unload_timerdev(hw_config->slots[2]); - if(p) - kfree(p); + + if (n != -1) { + release_region(hw_config->io_base, 2); + if (hw_config->always_detect == 0 && hw_config->irq > 0) + free_irq(hw_config->irq, (void *)n); + p=mpu401_synth_operations[n]; + sound_unload_mididev(n); + sound_unload_timerdev(hw_config->slots[2]); + if(p) + kfree(p); + } } /***************************************************** @@ -1752,6 +1772,7 @@ MODULE_PARM(io, "i"); int __init init_mpu401(void) { + int ret; /* Can be loaded either for module use or to provide functions to others */ if (io != -1 && irq != -1) { @@ -1759,7 +1780,8 @@ int __init init_mpu401(void) cfg.io_base = io; if (probe_mpu401(&cfg) == 0) return -ENODEV; - attach_mpu401(&cfg, THIS_MODULE); + if ((ret = attach_mpu401(&cfg, THIS_MODULE))) + return ret; } return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/nec_vrc5477.c linux-2.5/sound/oss/nec_vrc5477.c --- bk-linus/sound/oss/nec_vrc5477.c 2002-11-21 02:26:07.000000000 +0000 +++ linux-2.5/sound/oss/nec_vrc5477.c 2002-11-21 18:06:21.000000000 +0000 @@ -6,6 +6,8 @@ * AC97 sound dirver for NEC Vrc5477 chip (an integrated, * multi-function controller chip for MIPS CPUs) * + * VRA support Copyright 2001 Bradley D. LaRonde + * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your @@ -83,17 +85,25 @@ #include #include -#include +/* -------------------debug macros -------------------------------------- */ +/* #undef VRC5477_AC97_DEBUG */ +#define VRC5477_AC97_DEBUG #undef VRC5477_AC97_VERBOSE_DEBUG +/* #define VRC5477_AC97_VERBOSE_DEBUG */ -/* one must turn on CONFIG_LL_DEBUG before VERBOSE_DEBUG is turned */ #if defined(VRC5477_AC97_VERBOSE_DEBUG) -#if !defined(CONFIG_LL_DEBUG) -#error "You must turn CONFIG_LL_DEBUG" -#endif +#define VRC5477_AC97_DEBUG #endif +#if defined(VRC5477_AC97_DEBUG) +#include +#define ASSERT(x) if (!(x)) { \ + panic("assertion failed at %s:%d: %s\n", __FILE__, __LINE__, #x); } +#else +#define ASSERT(x) +#endif /* VRC5477_AC97_DEBUG */ + #if defined(VRC5477_AC97_VERBOSE_DEBUG) static u16 inTicket=0; /* check sync between intr & write */ static u16 outTicket=0; @@ -179,16 +189,17 @@ struct vrc5477_ac97_state { unsigned long io; unsigned int irq; -#ifdef CONFIG_LL_DEBUG +#ifdef VRC5477_AC97_DEBUG /* debug /proc entry */ struct proc_dir_entry *ps; struct proc_dir_entry *ac97_ps; -#endif /* CONFIG_LL_DEBUG */ +#endif /* VRC5477_AC97_DEBUG */ struct ac97_codec codec; unsigned dacChannels, adcChannels; unsigned short dacRate, adcRate; + unsigned short extended_status; spinlock_t lock; struct semaphore open_sem; @@ -226,7 +237,7 @@ static LIST_HEAD(devs); /* --------------------------------------------------------------------- */ -extern inline unsigned ld2(unsigned int x) +static inline unsigned ld2(unsigned int x) { unsigned r = 0; @@ -275,7 +286,7 @@ static u16 rdcodec(struct ac97_codec *co (VRC5477_CODEC_RD_RRDYA | VRC5477_CODEC_RD_RRDYD) ) { /* we get either addr or data, or both */ if (result & VRC5477_CODEC_RD_RRDYA) { - MIPS_ASSERT(addr == ((result >> 16) & 0x7f) ); + ASSERT(addr == ((result >> 16) & 0x7f) ); } if (result & VRC5477_CODEC_RD_RRDYD) { break; @@ -315,6 +326,43 @@ static void waitcodec(struct ac97_codec while (inl(s->io + VRC5477_CODEC_WR) & 0x80000000); } +static int ac97_codec_not_present(struct ac97_codec *codec) +{ + struct vrc5477_ac97_state *s = + (struct vrc5477_ac97_state *)codec->private_data; + unsigned long flags; + unsigned short count = 0xffff; + + spin_lock_irqsave(&s->lock, flags); + + /* wait until we can access codec registers */ + do { + if (!(inl(s->io + VRC5477_CODEC_WR) & 0x80000000)) + break; + } while (--count); + + if (count == 0) { + spin_unlock_irqrestore(&s->lock, flags); + return -1; + } + + /* write 0 to reset */ + outl((AC97_RESET << 16) | 0, s->io + VRC5477_CODEC_WR); + + /* test whether we get a response from ac97 chip */ + count = 0xffff; + do { + if (!(inl(s->io + VRC5477_CODEC_WR) & 0x80000000)) + break; + } while (--count); + + if (count == 0) { + spin_unlock_irqrestore(&s->lock, flags); + return -1; + } + spin_unlock_irqrestore(&s->lock, flags); + return 0; +} /* --------------------------------------------------------------------- */ @@ -345,14 +393,16 @@ static void set_adc_rate(struct vrc5477_ static void set_dac_rate(struct vrc5477_ac97_state *s, unsigned rate) { + if(s->extended_status & AC97_EXTSTAT_VRA) { wrcodec(&s->codec, AC97_PCM_FRONT_DAC_RATE, rate); - s->dacRate = rate; + s->dacRate = rdcodec(&s->codec, AC97_PCM_FRONT_DAC_RATE); + } } /* --------------------------------------------------------------------- */ -extern inline void +static inline void stop_dac(struct vrc5477_ac97_state *s) { struct dmabuf* db = &s->dma_dac; @@ -408,7 +458,7 @@ static void start_dac(struct vrc5477_ac9 } /* we should have some data to do the DMA trasnfer */ - MIPS_ASSERT(db->count >= db->fragSize); + ASSERT(db->count >= db->fragSize); /* clear pending fales interrupts */ outl(VRC5477_INT_MASK_DAC1END | VRC5477_INT_MASK_DAC2END, @@ -442,12 +492,12 @@ static void start_dac(struct vrc5477_ac9 outl (temp, s->io + VRC5477_CTRL); /* it is time to setup next dma transfer */ - MIPS_ASSERT(inl(s->io + VRC5477_DAC1_CTRL) & VRC5477_DMA_WIP); - MIPS_ASSERT(inl(s->io + VRC5477_DAC2_CTRL) & VRC5477_DMA_WIP); + ASSERT(inl(s->io + VRC5477_DAC1_CTRL) & VRC5477_DMA_WIP); + ASSERT(inl(s->io + VRC5477_DAC2_CTRL) & VRC5477_DMA_WIP); temp = db->nextOut + db->fragSize; if (temp >= db->fragTotalSize) { - MIPS_ASSERT(temp == db->fragTotalSize); + ASSERT(temp == db->fragTotalSize); temp = 0; } @@ -463,14 +513,14 @@ static void start_dac(struct vrc5477_ac9 #if defined(VRC5477_AC97_VERBOSE_DEBUG) outTicket = *(u16*)(db->lbuf+db->nextOut); if (db->count > db->fragSize) { - MIPS_ASSERT((u16)(outTicket+1) == *(u16*)(db->lbuf+temp)); + ASSERT((u16)(outTicket+1) == *(u16*)(db->lbuf+temp)); } #endif spin_unlock_irqrestore(&s->lock, flags); } -extern inline void stop_adc(struct vrc5477_ac97_state *s) +static inline void stop_adc(struct vrc5477_ac97_state *s) { struct dmabuf* db = &s->dma_adc; unsigned long flags; @@ -521,7 +571,7 @@ static void start_adc(struct vrc5477_ac9 } /* we should at least have some free space in the buffer */ - MIPS_ASSERT(db->count < db->fragTotalSize - db->fragSize * 2); + ASSERT(db->count < db->fragTotalSize - db->fragSize * 2); /* clear pending ones */ outl(VRC5477_INT_MASK_ADC1END | VRC5477_INT_MASK_ADC2END, @@ -553,7 +603,7 @@ static void start_adc(struct vrc5477_ac9 /* it is time to setup next dma transfer */ temp = db->nextIn + db->fragSize; if (temp >= db->fragTotalSize) { - MIPS_ASSERT(temp == db->fragTotalSize); + ASSERT(temp == db->fragTotalSize); temp = 0; } outl(db->lbufDma + temp, s->io + VRC5477_ADC1_BADDR); @@ -569,11 +619,11 @@ static void start_adc(struct vrc5477_ac9 #define DMABUF_DEFAULTORDER (16-PAGE_SHIFT) #define DMABUF_MINORDER 1 -extern inline void dealloc_dmabuf(struct vrc5477_ac97_state *s, +static inline void dealloc_dmabuf(struct vrc5477_ac97_state *s, struct dmabuf *db) { if (db->lbuf) { - MIPS_ASSERT(db->rbuf); + ASSERT(db->rbuf); pci_free_consistent(s->dev, PAGE_SIZE << db->bufOrder, db->lbuf, db->lbufDma); pci_free_consistent(s->dev, PAGE_SIZE << db->bufOrder, @@ -592,7 +642,7 @@ static int prog_dmabuf(struct vrc5477_ac unsigned bufsize; if (!db->lbuf) { - MIPS_ASSERT(!db->rbuf); + ASSERT(!db->rbuf); db->ready = 0; for (order = DMABUF_DEFAULTORDER; @@ -606,7 +656,7 @@ static int prog_dmabuf(struct vrc5477_ac &db->rbufDma); if (db->lbuf && db->rbuf) break; if (db->lbuf) { - MIPS_ASSERT(!db->rbuf); + ASSERT(!db->rbuf); pci_free_consistent(s->dev, PAGE_SIZE << order, db->lbuf, @@ -614,7 +664,7 @@ static int prog_dmabuf(struct vrc5477_ac } } if (!db->lbuf) { - MIPS_ASSERT(!db->rbuf); + ASSERT(!db->rbuf); return -ENOMEM; } @@ -643,13 +693,13 @@ static int prog_dmabuf(struct vrc5477_ac return 0; } -extern inline int prog_dmabuf_adc(struct vrc5477_ac97_state *s) +static inline int prog_dmabuf_adc(struct vrc5477_ac97_state *s) { stop_adc(s); return prog_dmabuf(s, &s->dma_adc, s->adcRate); } -extern inline int prog_dmabuf_dac(struct vrc5477_ac97_state *s) +static inline int prog_dmabuf_dac(struct vrc5477_ac97_state *s) { stop_dac(s); return prog_dmabuf(s, &s->dma_dac, s->dacRate); @@ -677,7 +727,7 @@ static inline void vrc5477_ac97_adc_inte /* set the base addr for next DMA transfer */ temp = adc->nextIn + 2*adc->fragSize; if (temp >= adc->fragTotalSize) { - MIPS_ASSERT( (temp == adc->fragTotalSize) || + ASSERT( (temp == adc->fragTotalSize) || (temp == adc->fragTotalSize + adc->fragSize) ); temp -= adc->fragTotalSize; } @@ -687,7 +737,7 @@ static inline void vrc5477_ac97_adc_inte /* adjust nextIn */ adc->nextIn += adc->fragSize; if (adc->nextIn >= adc->fragTotalSize) { - MIPS_ASSERT(adc->nextIn == adc->fragTotalSize); + ASSERT(adc->nextIn == adc->fragTotalSize); adc->nextIn = 0; } @@ -706,13 +756,13 @@ static inline void vrc5477_ac97_dac_inte unsigned temp; /* next DMA transfer should already started */ - MIPS_ASSERT(inl(s->io + VRC5477_DAC1_CTRL) & VRC5477_DMA_WIP); - MIPS_ASSERT(inl(s->io + VRC5477_DAC2_CTRL) & VRC5477_DMA_WIP); + // ASSERT(inl(s->io + VRC5477_DAC1_CTRL) & VRC5477_DMA_WIP); + // ASSERT(inl(s->io + VRC5477_DAC2_CTRL) & VRC5477_DMA_WIP); /* let us set for next next DMA transfer */ temp = dac->nextOut + dac->fragSize*2; if (temp >= dac->fragTotalSize) { - MIPS_ASSERT( (temp == dac->fragTotalSize) || + ASSERT( (temp == dac->fragTotalSize) || (temp == dac->fragTotalSize + dac->fragSize) ); temp -= dac->fragTotalSize; } @@ -728,35 +778,35 @@ static inline void vrc5477_ac97_dac_inte printk("assert fail: - %d vs %d\n", *(u16*)(dac->lbuf + dac->nextOut), outTicket); - MIPS_ASSERT(1 == 0); + ASSERT(1 == 0); } #endif /* adjust nextOut pointer */ dac->nextOut += dac->fragSize; if (dac->nextOut >= dac->fragTotalSize) { - MIPS_ASSERT(dac->nextOut == dac->fragTotalSize); + ASSERT(dac->nextOut == dac->fragTotalSize); dac->nextOut = 0; } /* adjust count */ dac->count -= dac->fragSize; if (dac->count <=0 ) { - MIPS_ASSERT(dac->count == 0); - MIPS_ASSERT(dac->nextIn == dac->nextOut); /* buffer under run */ + dac->count = 0; + dac->nextIn = dac->nextOut; stop_dac(s); } #if defined(VRC5477_AC97_VERBOSE_DEBUG) if (dac->count) { outTicket ++; - MIPS_ASSERT(*(u16*)(dac->lbuf + dac->nextOut) == outTicket); + ASSERT(*(u16*)(dac->lbuf + dac->nextOut) == outTicket); } #endif /* we cannot have both under run and someone is waiting on us */ - MIPS_ASSERT(! (waitqueue_active(&dac->wait) && (dac->count <= 0)) ); + ASSERT(! (waitqueue_active(&dac->wait) && (dac->count <= 0)) ); /* wake up anybody listening */ if (waitqueue_active(&dac->wait)) @@ -905,7 +955,7 @@ copy_two_channel_adc_to_user(struct vrc5 copyCount -= count; bufStart += count; - MIPS_ASSERT(bufStart <= db->fragTotalSize); + ASSERT(bufStart <= db->fragTotalSize); buffer += count *2; } return 0; @@ -937,12 +987,12 @@ copy_adc_to_user(struct vrc5477_ac97_sta } if (copyCount + db->nextOut > db->fragTotalSize) { copyCount = db->fragTotalSize - db->nextOut; - MIPS_ASSERT((copyCount % db->fragSize) == 0); + ASSERT((copyCount % db->fragSize) == 0); } copyFragCount = (copyCount-1) >> db->fragShift; copyFragCount = (copyFragCount+1) << db->fragShift; - MIPS_ASSERT(copyFragCount >= copyCount); + ASSERT(copyFragCount >= copyCount); /* we copy differently based on adc channels */ if (s->adcChannels == 1) { @@ -965,12 +1015,12 @@ copy_adc_to_user(struct vrc5477_ac97_sta db->nextOut += copyFragCount; if (db->nextOut >= db->fragTotalSize) { - MIPS_ASSERT(db->nextOut == db->fragTotalSize); + ASSERT(db->nextOut == db->fragTotalSize); db->nextOut = 0; } - MIPS_ASSERT((copyFragCount % db->fragSize) == 0); - MIPS_ASSERT( (count == 0) || (copyCount == copyFragCount)); + ASSERT((copyFragCount % db->fragSize) == 0); + ASSERT( (count == 0) || (copyCount == copyFragCount)); } spin_lock_irqsave(&s->lock, flags); @@ -999,7 +1049,7 @@ vrc5477_ac97_read(struct file *file, if (!access_ok(VERIFY_WRITE, buffer, count)) return -EFAULT; - MIPS_ASSERT(db->ready); + ASSERT(db->ready); while (count > 0) { // wait for samples in capture buffer @@ -1024,7 +1074,7 @@ vrc5477_ac97_read(struct file *file, } } while (avail <= 0); - MIPS_ASSERT( (avail % db->fragSize) == 0); + ASSERT( (avail % db->fragSize) == 0); copyCount = copy_adc_to_user(s, buffer, count, avail); if (copyCount <=0 ) { if (!ret) ret = -EFAULT; @@ -1047,7 +1097,7 @@ copy_two_channel_dac_from_user(struct vr struct dmabuf *db = &s->dma_dac; int bufStart = db->nextIn; - MIPS_ASSERT(db->ready); + ASSERT(db->ready); for (; copyCount > 0; ) { int i; @@ -1065,7 +1115,7 @@ copy_two_channel_dac_from_user(struct vr copyCount -= count; bufStart += count; - MIPS_ASSERT(bufStart <= db->fragTotalSize); + ASSERT(bufStart <= db->fragTotalSize); buffer += count *2; } return 0; @@ -1101,13 +1151,11 @@ copy_dac_from_user(struct vrc5477_ac97_s } if (copyCount + db->nextIn > db->fragTotalSize) { copyCount = db->fragTotalSize - db->nextIn; - MIPS_ASSERT((copyCount % db->fragSize) == 0); - MIPS_ASSERT(copyCount > 0); + ASSERT(copyCount > 0); } - copyFragCount = (copyCount-1) >> db->fragShift; - copyFragCount = (copyFragCount+1) << db->fragShift; - MIPS_ASSERT(copyFragCount >= copyCount); + copyFragCount = copyCount; + ASSERT(copyFragCount >= copyCount); /* we copy differently based on the number channels */ if (s->dacChannels == 1) { @@ -1147,12 +1195,11 @@ copy_dac_from_user(struct vrc5477_ac97_s db->nextIn += copyFragCount; if (db->nextIn >= db->fragTotalSize) { - MIPS_ASSERT(db->nextIn == db->fragTotalSize); + ASSERT(db->nextIn == db->fragTotalSize); db->nextIn = 0; } - MIPS_ASSERT((copyFragCount % db->fragSize) == 0); - MIPS_ASSERT( (count == 0) || (copyCount == copyFragCount)); + ASSERT( (count == 0) || (copyCount == copyFragCount)); } spin_lock_irqsave(&s->lock, flags); @@ -1162,7 +1209,7 @@ copy_dac_from_user(struct vrc5477_ac97_s } /* nextIn should not be equal to nextOut unless we are full */ - MIPS_ASSERT( ( (db->count == db->fragTotalSize) && + ASSERT( ( (db->count == db->fragTotalSize) && (db->nextIn == db->nextOut) ) || ( (db->count < db->fragTotalSize) && (db->nextIn != db->nextOut) ) ); @@ -1210,7 +1257,6 @@ static ssize_t vrc5477_ac97_write(struct } } while (avail <= 0); - MIPS_ASSERT( (avail % db->fragSize) == 0); copyCount = copy_dac_from_user(s, buffer, count, avail); if (copyCount < 0) { if (!ret) ret = -EFAULT; @@ -1251,7 +1297,7 @@ static unsigned int vrc5477_ac97_poll(st return mask; } -#ifdef CONFIG_LL_DEBUG +#ifdef VRC5477_AC97_DEBUG static struct ioctl_str_t { unsigned int cmd; const char* str; @@ -1302,7 +1348,7 @@ static int vrc5477_ac97_ioctl(struct ino int count; int val, ret; -#ifdef CONFIG_LL_DEBUG +#ifdef VRC5477_AC97_DEBUG for (count=0; count> 16) & 0x7f) ); - return result & 0xffff; -} - -void mywrcodec(u8 addr, u16 data) -{ - /* wait until we can access codec registers */ - while (myinl(VRC5477_CODEC_WR) & 0x80000000); - - /* write the address and value to codec */ - myoutl((addr << 16) | data, VRC5477_CODEC_WR); - -} - - -void jsun_ac97_test(struct vrc5477_ac97_state *s) -{ - int i; - - /* reset codec */ - /* - wrcodec(&s->codec, 0, 0); - while (inl(s->io + VRC5477_CODEC_WR) & 0x80000000); - */ - mywrcodec(0, 0); - while (myinl(VRC5477_CODEC_WR) & 0x80000000); - - for (i=0; i< 0x40; i+=4) { - MIPS_ASSERT(inl(s->io+i) == myinl(i)); - } - - printk("codec registers : "); - for (i=0; i<= 0x3a; i+=2) { - if ( (i%0x10) == 0) { - printk("\n%02x\t", i); - } - // printk("%04x\t", rdcodec(&s->codec, i)); - printk("%04x\t", myrdcodec(i)); - } - printk("\n\n"); - printk("codec registers : "); - for (i=0; i<= 0x3a; i+=2) { - if ( (i%0x10) == 0) { - printk("\n%02x\t", i); - } - printk("%04x\t", rdcodec(&s->codec, i)); - } - printk("\n\n"); -} - static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid) { struct vrc5477_ac97_state *s; +#ifdef VRC5477_AC97_DEBUG char proc_str[80]; - - MIPS_DEBUG(printk("vrc5477_ac97_probe() invoked\n")); +#endif if (pcidev->irq == 0) return -1; @@ -1883,6 +1854,13 @@ static int __devinit vrc5477_ac97_probe( * no persistent state across file opens. */ + /* test if get response from ac97, if not return */ + if (ac97_codec_not_present(&(s->codec))) { + printk(KERN_ERR PFX "no ac97 codec\n"); + goto err_region; + + } + if (!request_region(s->io, pci_resource_len(pcidev,0), VRC5477_AC97_MODULE_NAME)) { printk(KERN_ERR PFX "io ports %#lx->%#lx in use\n", @@ -1904,37 +1882,27 @@ static int __devinit vrc5477_ac97_probe( register_sound_mixer(&vrc5477_ac97_mixer_fops, -1)) < 0) goto err_dev2; -#ifdef CONFIG_LL_DEBUG +#ifdef VRC5477_AC97_DEBUG /* intialize the debug proc device */ s->ps = create_proc_read_entry(VRC5477_AC97_MODULE_NAME, 0, NULL, proc_vrc5477_ac97_dump, NULL); -#endif /* CONFIG_LL_DEBUG */ +#endif /* VRC5477_AC97_DEBUG */ /* enable pci io and bus mastering */ if (pci_enable_device(pcidev)) goto err_dev3; pci_set_master(pcidev); -/* -jsun_scan_pci_bus(); -vrc5477_show_pci_regs(); -vrc5477_show_pdar_regs(); -*/ - /* cold reset the AC97 */ outl(VRC5477_ACLINK_CTRL_RST_ON | VRC5477_ACLINK_CTRL_RST_TIME, s->io + VRC5477_ACLINK_CTRL); while (inl(s->io + VRC5477_ACLINK_CTRL) & VRC5477_ACLINK_CTRL_RST_ON); -/* -jsun_ac97_test(s); -*/ - /* codec init */ if (!ac97_probe_codec(&s->codec)) goto err_dev3; -#ifdef CONFIG_LL_DEBUG +#ifdef VRC5477_AC97_DEBUG sprintf(proc_str, "driver/%s/%d/ac97", VRC5477_AC97_MODULE_NAME, s->codec.id); s->ac97_ps = create_proc_read_entry (proc_str, 0, NULL, @@ -1942,16 +1910,28 @@ jsun_ac97_test(s); /* TODO : why this proc file does not show up? */ #endif + /* Try to enable variable rate audio mode. */ + wrcodec(&s->codec, AC97_EXTENDED_STATUS, + rdcodec(&s->codec, AC97_EXTENDED_STATUS) | AC97_EXTSTAT_VRA); + /* Did we enable it? */ + if(rdcodec(&s->codec, AC97_EXTENDED_STATUS) & AC97_EXTSTAT_VRA) + s->extended_status |= AC97_EXTSTAT_VRA; + else { + s->dacRate = 48000; + printk(KERN_INFO PFX "VRA mode not enabled; rate fixed at %d.", + s->dacRate); + } + /* let us get the default volumne louder */ - wrcodec(&s->codec, 0x2, 0); - wrcodec(&s->codec, 0x18, 0x0707); - /* mute line in loopback to line out */ - wrcodec(&s->codec, 0x10, 0x8000); + wrcodec(&s->codec, 0x2, 0x1010); /* master volume, middle */ + wrcodec(&s->codec, 0xc, 0x10); /* phone volume, middle */ + // wrcodec(&s->codec, 0xe, 0x10); /* misc volume, middle */ + wrcodec(&s->codec, 0x10, 0x8000); /* line-in 2 line-out disable */ + wrcodec(&s->codec, 0x18, 0x0707); /* PCM out (line out) middle */ + /* by default we select line in the input */ wrcodec(&s->codec, 0x1a, 0x0404); - /* pick middle value for record gain */ - // wrcodec(&s->codec, 0x1c, 0x0707); wrcodec(&s->codec, 0x1c, 0x0f0f); wrcodec(&s->codec, 0x1e, 0x07); @@ -1989,10 +1969,12 @@ static void __devinit vrc5477_ac97_remov if (!s) return; list_del(&s->devs); -#ifdef CONFIG_LL_DEBUG + +#ifdef VRC5477_AC97_DEBUG if (s->ps) remove_proc_entry(VRC5477_AC97_MODULE_NAME, NULL); -#endif /* CONFIG_LL_DEBUG */ +#endif /* VRC5477_AC97_DEBUG */ + synchronize_irq(s->irq); free_irq(s->irq, s); release_region(s->io, pci_resource_len(dev,0)); @@ -2003,8 +1985,6 @@ static void __devinit vrc5477_ac97_remov } -#define PCI_VENDOR_ID_NEC 0x1033 -#define PCI_DEVICE_ID_NEC_VRC5477_AC97 0x00A6 static struct pci_device_id id_table[] __devinitdata = { { PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_VRC5477_AC97, PCI_ANY_ID, PCI_ANY_ID, 0, 0 }, @@ -2024,7 +2004,7 @@ static int __init init_vrc5477_ac97(void { if (!pci_present()) /* No PCI bus in this machine! */ return -ENODEV; - printk("Vrc5477 AC97 driver: version v0.1 time " __TIME__ " " __DATE__ " by Jun Sun\n"); + printk("Vrc5477 AC97 driver: version v0.2 time " __TIME__ " " __DATE__ " by Jun Sun\n"); return pci_module_init(&vrc5477_ac97_driver); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/pss.c linux-2.5/sound/oss/pss.c --- bk-linus/sound/oss/pss.c 2002-11-21 02:26:09.000000000 +0000 +++ linux-2.5/sound/oss/pss.c 2002-11-21 18:06:22.000000000 +0000 @@ -1127,7 +1127,7 @@ MODULE_PARM_DESC(pss_firmware, "Location MODULE_PARM(pss_mixer, "b"); MODULE_PARM_DESC(pss_mixer, "Enable (1) or disable (0) PSS mixer (controlling of output volume, bass, treble, synth volume). The mixer is not available on all PSS cards."); MODULE_AUTHOR("Hannu Savolainen, Vladimir Michl"); -MODULE_DESCRIPTION("Module for PSS sound cards (based on AD1848, ADSP-2115 and ESC614). This module includes control of output amplifier and synth volume of the Beethoven ADSP-16 card (this may work with other PSS cards).\n"); +MODULE_DESCRIPTION("Module for PSS sound cards (based on AD1848, ADSP-2115 and ESC614). This module includes control of output amplifier and synth volume of the Beethoven ADSP-16 card (this may work with other PSS cards)."); MODULE_LICENSE("GPL"); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/Documentation/sound/rme96xx linux-2.5/Documentation/sound/rme96xx --- bk-linus/Documentation/sound/rme96xx 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5/Documentation/sound/rme96xx 2002-11-21 17:54:31.000000000 +0000 @@ -0,0 +1,767 @@ +Beta release of the rme96xx (driver for RME 96XX cards like the +"Hammerfall" and the "Hammerfall light") + +Important: The driver module has to be installed on a freshly rebooted system, +otherwise the driver might not be able to acquire its buffers. + +features: + + - OSS programming interface (i.e. runs with standard OSS soundsoftware) + - OSS/Multichannel interface (OSS multichannel is done by just aquiring + more than 2 channels). The driver does not use more than one device + ( yet .. this feature may be implemented later ) + - more than one RME card supported + +The driver uses a specific multichannel interface, which I will document +when the driver gets stable. (take a look at the defines in rme96xx.h, +which adds blocked multichannel formats i.e instead of +lrlrlrlr --> llllrrrr etc. + +Use the "rmectrl" programm to look at the status of the card .. +or use xrmectrl, a GUI interface for the ctrl program. + +What you can do with the rmectrl program is to set the stereo device for +OSS emulation (e.g. if you use SPDIF out). + +You do: + +./ctrl offset 24 24 + +which makes the stereo device use channels 25 and 26. + +Guenter Geiger + +copy the first part of the attached source code into rmectrl.c +and the second part into xrmectrl (or get the program from +http://gige.xdv.org/pages/soft/pages/rme) + +to compile: gcc -o rmectrl rmectrl.c +------------------------------ snip ------------------------------------ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "rme96xx.h" + +/* + remctrl.c + (C) 2000 Guenter Geiger + HP20020201 - Heiko Purnhagen +*/ + +/* # define DEVICE_NAME "/dev/mixer" */ +# define DEVICE_NAME "/dev/mixer1" + + +void usage(void) +{ + fprintf(stderr,"usage: rmectrl [/dev/mixer] [command [options]]\n\n"); + fprintf(stderr,"where command is one of:\n"); + fprintf(stderr," help show this help\n"); + fprintf(stderr," status show status bits\n"); + fprintf(stderr," control show control bits\n"); + fprintf(stderr," mix show mixer/offset status\n"); + fprintf(stderr," master set sync master\n"); + fprintf(stderr," pro set spdif out pro\n"); + fprintf(stderr," emphasis set spdif out emphasis\n"); + fprintf(stderr," dolby set spdif out no audio\n"); + fprintf(stderr," optout set spdif out optical\n"); + fprintf(stderr," wordclock set sync wordclock\n"); + fprintf(stderr," spdifin set spdif in (0=optical,1=coax,2=intern)\n"); + fprintf(stderr," syncref set sync source (0=ADAT1,1=ADAT2,2=ADAT3,3=SPDIF)\n"); + fprintf(stderr," adat1cd set ADAT1 on internal CD\n"); + fprintf(stderr," offset set dev (0..3) offset (0..25)\n"); + exit(-1); +} + + +int main(int argc, char* argv[]) +{ + int cards; + int ret; + int i; + double ft; + int fd, fdwr; + int param,orig; + rme_status_t stat; + rme_ctrl_t ctrl; + char *device; + int argidx; + + if (argc < 2) + usage(); + + if (*argv[1]=='/') { + device = argv[1]; + argidx = 2; + } + else { + device = DEVICE_NAME; + argidx = 1; + } + + fprintf(stdout,"mixer device %s\n",device); + if ((fd = open(device,O_RDONLY)) < 0) { + fprintf(stdout,"opening device failed\n"); + exit(-1); + } + + if ((fdwr = open(device,O_WRONLY)) < 0) { + fprintf(stdout,"opening device failed\n"); + exit(-1); + } + + if (argc < argidx+1) + usage(); + + if (!strcmp(argv[argidx],"help")) + usage(); + if (!strcmp(argv[argidx],"-h")) + usage(); + if (!strcmp(argv[argidx],"--help")) + usage(); + + if (!strcmp(argv[argidx],"status")) { + ioctl(fd,SOUND_MIXER_PRIVATE2,&stat); + fprintf(stdout,"stat.irq %d\n",stat.irq); + fprintf(stdout,"stat.lockmask %d\n",stat.lockmask); + fprintf(stdout,"stat.sr48 %d\n",stat.sr48); + fprintf(stdout,"stat.wclock %d\n",stat.wclock); + fprintf(stdout,"stat.bufpoint %d\n",stat.bufpoint); + fprintf(stdout,"stat.syncmask %d\n",stat.syncmask); + fprintf(stdout,"stat.doublespeed %d\n",stat.doublespeed); + fprintf(stdout,"stat.tc_busy %d\n",stat.tc_busy); + fprintf(stdout,"stat.tc_out %d\n",stat.tc_out); + fprintf(stdout,"stat.crystalrate %d (0=64k 3=96k 4=88.2k 5=48k 6=44.1k 7=32k)\n",stat.crystalrate); + fprintf(stdout,"stat.spdif_error %d\n",stat.spdif_error); + fprintf(stdout,"stat.bufid %d\n",stat.bufid); + fprintf(stdout,"stat.tc_valid %d\n",stat.tc_valid); + exit (0); + } + + if (!strcmp(argv[argidx],"control")) { + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + fprintf(stdout,"ctrl.start %d\n",ctrl.start); + fprintf(stdout,"ctrl.latency %d (0=64 .. 7=8192)\n",ctrl.latency); + fprintf(stdout,"ctrl.master %d\n",ctrl.master); + fprintf(stdout,"ctrl.ie %d\n",ctrl.ie); + fprintf(stdout,"ctrl.sr48 %d\n",ctrl.sr48); + fprintf(stdout,"ctrl.spare %d\n",ctrl.spare); + fprintf(stdout,"ctrl.doublespeed %d\n",ctrl.doublespeed); + fprintf(stdout,"ctrl.pro %d\n",ctrl.pro); + fprintf(stdout,"ctrl.emphasis %d\n",ctrl.emphasis); + fprintf(stdout,"ctrl.dolby %d\n",ctrl.dolby); + fprintf(stdout,"ctrl.opt_out %d\n",ctrl.opt_out); + fprintf(stdout,"ctrl.wordclock %d\n",ctrl.wordclock); + fprintf(stdout,"ctrl.spdif_in %d (0=optical,1=coax,2=intern)\n",ctrl.spdif_in); + fprintf(stdout,"ctrl.sync_ref %d (0=ADAT1,1=ADAT2,2=ADAT3,3=SPDIF)\n",ctrl.sync_ref); + fprintf(stdout,"ctrl.spdif_reset %d\n",ctrl.spdif_reset); + fprintf(stdout,"ctrl.spdif_select %d\n",ctrl.spdif_select); + fprintf(stdout,"ctrl.spdif_clock %d\n",ctrl.spdif_clock); + fprintf(stdout,"ctrl.spdif_write %d\n",ctrl.spdif_write); + fprintf(stdout,"ctrl.adat1_cd %d\n",ctrl.adat1_cd); + exit (0); + } + + if (!strcmp(argv[argidx],"mix")) { + rme_mixer mix; + int i; + + for (i=0; i<4; i++) { + mix.devnr = i; + ioctl(fd,SOUND_MIXER_PRIVATE1,&mix); + if (mix.devnr == i) { + fprintf(stdout,"devnr %d\n",mix.devnr); + fprintf(stdout,"mix.i_offset %2d (0-25)\n",mix.i_offset); + fprintf(stdout,"mix.o_offset %2d (0-25)\n",mix.o_offset); + } + } + exit (0); + } + +/* the control flags */ + + if (argc < argidx+2) + usage(); + + if (!strcmp(argv[argidx],"master")) { + int val = atoi(argv[argidx+1]); + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + printf("master = %d\n",val); + ctrl.master = val; + ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); + exit (0); + } + + if (!strcmp(argv[argidx],"pro")) { + int val = atoi(argv[argidx+1]); + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + printf("pro = %d\n",val); + ctrl.pro = val; + ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); + exit (0); + } + + if (!strcmp(argv[argidx],"emphasis")) { + int val = atoi(argv[argidx+1]); + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + printf("emphasis = %d\n",val); + ctrl.emphasis = val; + ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); + exit (0); + } + + if (!strcmp(argv[argidx],"dolby")) { + int val = atoi(argv[argidx+1]); + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + printf("dolby = %d\n",val); + ctrl.dolby = val; + ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); + exit (0); + } + + if (!strcmp(argv[argidx],"optout")) { + int val = atoi(argv[argidx+1]); + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + printf("optout = %d\n",val); + ctrl.opt_out = val; + ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); + exit (0); + } + + if (!strcmp(argv[argidx],"wordclock")) { + int val = atoi(argv[argidx+1]); + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + printf("wordclock = %d\n",val); + ctrl.wordclock = val; + ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); + exit (0); + } + + if (!strcmp(argv[argidx],"spdifin")) { + int val = atoi(argv[argidx+1]); + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + printf("spdifin = %d\n",val); + ctrl.spdif_in = val; + ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); + exit (0); + } + + if (!strcmp(argv[argidx],"syncref")) { + int val = atoi(argv[argidx+1]); + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + printf("syncref = %d\n",val); + ctrl.sync_ref = val; + ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); + exit (0); + } + + if (!strcmp(argv[argidx],"adat1cd")) { + int val = atoi(argv[argidx+1]); + ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl); + printf("adat1cd = %d\n",val); + ctrl.adat1_cd = val; + ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl); + exit (0); + } + +/* setting offset */ + + if (argc < argidx+4) + usage(); + + if (!strcmp(argv[argidx],"offset")) { + rme_mixer mix; + + mix.devnr = atoi(argv[argidx+1]); + + mix.i_offset = atoi(argv[argidx+2]); + mix.o_offset = atoi(argv[argidx+3]); + ioctl(fdwr,SOUND_MIXER_PRIVATE1,&mix); + fprintf(stdout,"devnr %d\n",mix.devnr); + fprintf(stdout,"mix.i_offset to %d\n",mix.i_offset); + fprintf(stdout,"mix.o_offset to %d\n",mix.o_offset); + exit (0); + } + + usage(); + exit (0); /* to avoid warning */ +} + + +---------------------------- -------------------------------- +#!/usr/bin/wish + +# xrmectrl +# (C) 2000 Guenter Geiger +# HP20020201 - Heiko Purnhagen + +#set defaults "-relief ridged" +set CTRLPROG "./rmectrl" +if {$argc} { + set CTRLPROG "$CTRLPROG $argv" +} +puts "CTRLPROG $CTRLPROG" + +frame .butts +button .butts.exit -text "Exit" -command "exit" -relief ridge +#button .butts.state -text "State" -command "get_all" + +pack .butts.exit -side left +pack .butts -side bottom + + +# +# STATUS +# + +frame .status + +# Sampling Rate + +frame .status.sr +label .status.sr.text -text "Sampling Rate" -justify left +radiobutton .status.sr.441 -selectcolor red -text "44.1 kHz" -width 10 -anchor nw -variable srate -value 44100 -font times +radiobutton .status.sr.480 -selectcolor red -text "48 kHz" -width 10 -anchor nw -variable srate -value 48000 -font times +radiobutton .status.sr.882 -selectcolor red -text "88.2 kHz" -width 10 -anchor nw -variable srate -value 88200 -font times +radiobutton .status.sr.960 -selectcolor red -text "96 kHz" -width 10 -anchor nw -variable srate -value 96000 -font times + +pack .status.sr.text .status.sr.441 .status.sr.480 .status.sr.882 .status.sr.960 -side top -padx 3 + +# Lock + +frame .status.lock +label .status.lock.text -text "Lock" -justify left +checkbutton .status.lock.adat1 -selectcolor red -text "ADAT1" -anchor nw -width 10 -variable adatlock1 -font times +checkbutton .status.lock.adat2 -selectcolor red -text "ADAT2" -anchor nw -width 10 -variable adatlock2 -font times +checkbutton .status.lock.adat3 -selectcolor red -text "ADAT3" -anchor nw -width 10 -variable adatlock3 -font times + +pack .status.lock.text .status.lock.adat1 .status.lock.adat2 .status.lock.adat3 -side top -padx 3 + +# Sync + +frame .status.sync +label .status.sync.text -text "Sync" -justify left +checkbutton .status.sync.adat1 -selectcolor red -text "ADAT1" -anchor nw -width 10 -variable adatsync1 -font times +checkbutton .status.sync.adat2 -selectcolor red -text "ADAT2" -anchor nw -width 10 -variable adatsync2 -font times +checkbutton .status.sync.adat3 -selectcolor red -text "ADAT3" -anchor nw -width 10 -variable adatsync3 -font times + +pack .status.sync.text .status.sync.adat1 .status.sync.adat2 .status.sync.adat3 -side top -padx 3 + +# Timecode + +frame .status.tc +label .status.tc.text -text "Timecode" -justify left +checkbutton .status.tc.busy -selectcolor red -text "busy" -anchor nw -width 10 -variable tcbusy -font times +checkbutton .status.tc.out -selectcolor red -text "out" -anchor nw -width 10 -variable tcout -font times +checkbutton .status.tc.valid -selectcolor red -text "valid" -anchor nw -width 10 -variable tcvalid -font times + +pack .status.tc.text .status.tc.busy .status.tc.out .status.tc.valid -side top -padx 3 + +# SPDIF In + +frame .status.spdif +label .status.spdif.text -text "SPDIF In" -justify left +label .status.spdif.sr -text "--.- kHz" -anchor n -width 10 -font times +checkbutton .status.spdif.error -selectcolor red -text "Input Lock" -anchor nw -width 10 -variable spdiferr -font times + +pack .status.spdif.text .status.spdif.sr .status.spdif.error -side top -padx 3 + +pack .status.sr .status.lock .status.sync .status.tc .status.spdif -side left -fill x -anchor n -expand 1 + + +# +# CONTROL +# + +proc setprof {} { + global CTRLPROG + global spprof + exec $CTRLPROG pro $spprof +} + +proc setemph {} { + global CTRLPROG + global spemph + exec $CTRLPROG emphasis $spemph +} + +proc setnoaud {} { + global CTRLPROG + global spnoaud + exec $CTRLPROG dolby $spnoaud +} + +proc setoptical {} { + global CTRLPROG + global spoptical + exec $CTRLPROG optout $spoptical +} + +proc setspdifin {} { + global CTRLPROG + global spdifin + exec $CTRLPROG spdifin [expr $spdifin - 1] +} + +proc setsyncsource {} { + global CTRLPROG + global syncsource + exec $CTRLPROG syncref [expr $syncsource -1] +} + + +proc setmaster {} { + global CTRLPROG + global master + exec $CTRLPROG master $master +} + +proc setwordclock {} { + global CTRLPROG + global wordclock + exec $CTRLPROG wordclock $wordclock +} + +proc setadat1cd {} { + global CTRLPROG + global adat1cd + exec $CTRLPROG adat1cd $adat1cd +} + + +frame .control + +# SPDIF In & SPDIF Out + + +frame .control.spdif + +frame .control.spdif.in +label .control.spdif.in.text -text "SPDIF In" -justify left +radiobutton .control.spdif.in.input1 -text "Optical" -anchor nw -width 13 -variable spdifin -value 1 -command setspdifin -selectcolor blue -font times +radiobutton .control.spdif.in.input2 -text "Coaxial" -anchor nw -width 13 -variable spdifin -value 2 -command setspdifin -selectcolor blue -font times +radiobutton .control.spdif.in.input3 -text "Intern " -anchor nw -width 13 -variable spdifin -command setspdifin -value 3 -selectcolor blue -font times + +checkbutton .control.spdif.in.adat1cd -text "ADAT1 Intern" -anchor nw -width 13 -variable adat1cd -command setadat1cd -selectcolor blue -font times + +pack .control.spdif.in.text .control.spdif.in.input1 .control.spdif.in.input2 .control.spdif.in.input3 .control.spdif.in.adat1cd + +label .control.spdif.space + +frame .control.spdif.out +label .control.spdif.out.text -text "SPDIF Out" -justify left +checkbutton .control.spdif.out.pro -text "Professional" -anchor nw -width 13 -variable spprof -command setprof -selectcolor blue -font times +checkbutton .control.spdif.out.emphasis -text "Emphasis" -anchor nw -width 13 -variable spemph -command setemph -selectcolor blue -font times +checkbutton .control.spdif.out.dolby -text "NoAudio" -anchor nw -width 13 -variable spnoaud -command setnoaud -selectcolor blue -font times +checkbutton .control.spdif.out.optout -text "Optical Out" -anchor nw -width 13 -variable spoptical -command setoptical -selectcolor blue -font times + +pack .control.spdif.out.optout .control.spdif.out.dolby .control.spdif.out.emphasis .control.spdif.out.pro .control.spdif.out.text -side bottom + +pack .control.spdif.in .control.spdif.space .control.spdif.out -side top -fill y -padx 3 -expand 1 + +# Sync Mode & Sync Source + +frame .control.sync +frame .control.sync.mode +label .control.sync.mode.text -text "Sync Mode" -justify left +checkbutton .control.sync.mode.master -text "Master" -anchor nw -width 13 -variable master -command setmaster -selectcolor blue -font times +checkbutton .control.sync.mode.wc -text "Wordclock" -anchor nw -width 13 -variable wordclock -command setwordclock -selectcolor blue -font times + +pack .control.sync.mode.text .control.sync.mode.master .control.sync.mode.wc + +label .control.sync.space + +frame .control.sync.src +label .control.sync.src.text -text "Sync Source" -justify left +radiobutton .control.sync.src.input1 -text "ADAT1" -anchor nw -width 13 -variable syncsource -value 1 -command setsyncsource -selectcolor blue -font times +radiobutton .control.sync.src.input2 -text "ADAT2" -anchor nw -width 13 -variable syncsource -value 2 -command setsyncsource -selectcolor blue -font times +radiobutton .control.sync.src.input3 -text "ADAT3" -anchor nw -width 13 -variable syncsource -command setsyncsource -value 3 -selectcolor blue -font times +radiobutton .control.sync.src.input4 -text "SPDIF" -anchor nw -width 13 -variable syncsource -command setsyncsource -value 4 -selectcolor blue -font times + +pack .control.sync.src.input4 .control.sync.src.input3 .control.sync.src.input2 .control.sync.src.input1 .control.sync.src.text -side bottom + +pack .control.sync.mode .control.sync.space .control.sync.src -side top -fill y -padx 3 -expand 1 + +label .control.space -text "" -width 10 + +# Buffer Size + +frame .control.buf +label .control.buf.text -text "Buffer Size (Latency)" -justify left +radiobutton .control.buf.b1 -selectcolor red -text "64 (1.5 ms)" -width 13 -anchor nw -variable ssrate -value 1 -font times +radiobutton .control.buf.b2 -selectcolor red -text "128 (3 ms)" -width 13 -anchor nw -variable ssrate -value 2 -font times +radiobutton .control.buf.b3 -selectcolor red -text "256 (6 ms)" -width 13 -anchor nw -variable ssrate -value 3 -font times +radiobutton .control.buf.b4 -selectcolor red -text "512 (12 ms)" -width 13 -anchor nw -variable ssrate -value 4 -font times +radiobutton .control.buf.b5 -selectcolor red -text "1024 (23 ms)" -width 13 -anchor nw -variable ssrate -value 5 -font times +radiobutton .control.buf.b6 -selectcolor red -text "2048 (46 ms)" -width 13 -anchor nw -variable ssrate -value 6 -font times +radiobutton .control.buf.b7 -selectcolor red -text "4096 (93 ms)" -width 13 -anchor nw -variable ssrate -value 7 -font times +radiobutton .control.buf.b8 -selectcolor red -text "8192 (186 ms)" -width 13 -anchor nw -variable ssrate -value 8 -font times + +pack .control.buf.text .control.buf.b1 .control.buf.b2 .control.buf.b3 .control.buf.b4 .control.buf.b5 .control.buf.b6 .control.buf.b7 .control.buf.b8 -side top -padx 3 + +# Offset + +frame .control.offset + +frame .control.offset.in +label .control.offset.in.text -text "Offset In" -justify left +label .control.offset.in.off0 -text "dev\#0: -" -anchor nw -width 10 -font times +label .control.offset.in.off1 -text "dev\#1: -" -anchor nw -width 10 -font times +label .control.offset.in.off2 -text "dev\#2: -" -anchor nw -width 10 -font times +label .control.offset.in.off3 -text "dev\#3: -" -anchor nw -width 10 -font times + +pack .control.offset.in.text .control.offset.in.off0 .control.offset.in.off1 .control.offset.in.off2 .control.offset.in.off3 + +label .control.offset.space + +frame .control.offset.out +label .control.offset.out.text -text "Offset Out" -justify left +label .control.offset.out.off0 -text "dev\#0: -" -anchor nw -width 10 -font times +label .control.offset.out.off1 -text "dev\#1: -" -anchor nw -width 10 -font times +label .control.offset.out.off2 -text "dev\#2: -" -anchor nw -width 10 -font times +label .control.offset.out.off3 -text "dev\#3: -" -anchor nw -width 10 -font times + +pack .control.offset.out.off3 .control.offset.out.off2 .control.offset.out.off1 .control.offset.out.off0 .control.offset.out.text -side bottom + +pack .control.offset.in .control.offset.space .control.offset.out -side top -fill y -padx 3 -expand 1 + + +pack .control.spdif .control.sync .control.space .control.buf .control.offset -side left -fill both -anchor n -expand 1 + + +label .statustext -text Status -justify center -relief ridge +label .controltext -text Control -justify center -relief ridge + +label .statusspace +label .controlspace + +pack .statustext .status .statusspace .controltext .control .controlspace -side top -anchor nw -fill both -expand 1 + + +proc get_bit {output sstr} { + set idx1 [string last [concat $sstr 1] $output] + set idx1 [expr $idx1 != -1] + return $idx1 +} + +proc get_val {output sstr} { + set val [string wordend $output [string last $sstr $output]] + set val [string range $output $val [expr $val+1]] + return $val +} + +proc get_val2 {output sstr} { + set val [string wordend $output [string first $sstr $output]] + set val [string range $output $val [expr $val+2]] + return $val +} + +proc get_control {} { + global spprof + global spemph + global spnoaud + global spoptical + global spdifin + global ssrate + global master + global wordclock + global syncsource + global CTRLPROG + + set f [open "| $CTRLPROG control" r+] + set ooo [read $f 1000] + close $f +# puts $ooo + + set spprof [ get_bit $ooo "pro"] + set spemph [ get_bit $ooo "emphasis"] + set spnoaud [ get_bit $ooo "dolby"] + set spoptical [ get_bit $ooo "opt_out"] + set spdifin [ expr [ get_val $ooo "spdif_in"] + 1] + set ssrate [ expr [ get_val $ooo "latency"] + 1] + set master [ expr [ get_val $ooo "master"]] + set wordclock [ expr [ get_val $ooo "wordclock"]] + set syncsource [ expr [ get_val $ooo "sync_ref"] + 1] +} + +proc get_status {} { + global srate + global ctrlcom + + global adatlock1 + global adatlock2 + global adatlock3 + + global adatsync1 + global adatsync2 + global adatsync3 + + global tcbusy + global tcout + global tcvalid + + global spdiferr + global crystal + global .status.spdif.text + global CTRLPROG + + + set f [open "| $CTRLPROG status" r+] + set ooo [read $f 1000] + close $f +# puts $ooo + +# samplerate + + set idx1 [string last "sr48 1" $ooo] + set idx2 [string last "doublespeed 1" $ooo] + if {$idx1 >= 0} { + set fact1 48000 + } else { + set fact1 44100 + } + + if {$idx2 >= 0} { + set fact2 2 + } else { + set fact2 1 + } + set srate [expr $fact1 * $fact2] +# ADAT lock + + set val [get_val $ooo lockmask] + set adatlock1 0 + set adatlock2 0 + set adatlock3 0 + if {[expr $val & 1]} { + set adatlock3 1 + } + if {[expr $val & 2]} { + set adatlock2 1 + } + if {[expr $val & 4]} { + set adatlock1 1 + } + +# ADAT sync + set val [get_val $ooo syncmask] + set adatsync1 0 + set adatsync2 0 + set adatsync3 0 + + if {[expr $val & 1]} { + set adatsync3 1 + } + if {[expr $val & 2]} { + set adatsync2 1 + } + if {[expr $val & 4]} { + set adatsync1 1 + } + +# TC busy + + set tcbusy [get_bit $ooo "busy"] + set tcout [get_bit $ooo "out"] + set tcvalid [get_bit $ooo "valid"] + set spdiferr [expr [get_bit $ooo "spdif_error"] == 0] + +# 000=64kHz, 100=88.2kHz, 011=96kHz +# 111=32kHz, 110=44.1kHz, 101=48kHz + + set val [get_val $ooo crystalrate] + + set crystal "--.- kHz" + if {$val == 0} { + set crystal "64 kHz" + } + if {$val == 4} { + set crystal "88.2 kHz" + } + if {$val == 3} { + set crystal "96 kHz" + } + if {$val == 7} { + set crystal "32 kHz" + } + if {$val == 6} { + set crystal "44.1 kHz" + } + if {$val == 5} { + set crystal "48 kHz" + } + .status.spdif.sr configure -text $crystal +} + +proc get_offset {} { + global inoffset + global outoffset + global CTRLPROG + + set f [open "| $CTRLPROG mix" r+] + set ooo [read $f 1000] + close $f +# puts $ooo + + if { [string match "*devnr*" $ooo] } { + set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end] + set val [get_val2 $ooo i_offset] + .control.offset.in.off0 configure -text "dev\#0: $val" + set val [get_val2 $ooo o_offset] + .control.offset.out.off0 configure -text "dev\#0: $val" + } else { + .control.offset.in.off0 configure -text "dev\#0: -" + .control.offset.out.off0 configure -text "dev\#0: -" + } + if { [string match "*devnr*" $ooo] } { + set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end] + set val [get_val2 $ooo i_offset] + .control.offset.in.off1 configure -text "dev\#1: $val" + set val [get_val2 $ooo o_offset] + .control.offset.out.off1 configure -text "dev\#1: $val" + } else { + .control.offset.in.off1 configure -text "dev\#1: -" + .control.offset.out.off1 configure -text "dev\#1: -" + } + if { [string match "*devnr*" $ooo] } { + set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end] + set val [get_val2 $ooo i_offset] + .control.offset.in.off2 configure -text "dev\#2: $val" + set val [get_val2 $ooo o_offset] + .control.offset.out.off2 configure -text "dev\#2: $val" + } else { + .control.offset.in.off2 configure -text "dev\#2: -" + .control.offset.out.off2 configure -text "dev\#2: -" + } + if { [string match "*devnr*" $ooo] } { + set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end] + set val [get_val2 $ooo i_offset] + .control.offset.in.off3 configure -text "dev\#3: $val" + set val [get_val2 $ooo o_offset] + .control.offset.out.off3 configure -text "dev\#3: $val" + } else { + .control.offset.in.off3 configure -text "dev\#3: -" + .control.offset.out.off3 configure -text "dev\#3: -" + } +} + + +proc get_all {} { +get_status +get_control +get_offset +} + +# main +while {1} { + after 200 + get_all + update +} diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/rme96xx.c linux-2.5/sound/oss/rme96xx.c --- bk-linus/sound/oss/rme96xx.c 2002-11-21 02:26:09.000000000 +0000 +++ linux-2.5/sound/oss/rme96xx.c 2002-11-21 18:06:23.000000000 +0000 @@ -10,6 +10,17 @@ * 11 May 2001: 0.4 fixed for SMP, included into kernel source tree * 17 May 2001: 0.5 draining code didn't work on new cards * 18 May 2001: 0.6 remove synchronize_irq() call + * 17 Jul 2001: 0.7 updated xrmectrl to make it work for newer cards + * 2 feb 2002: 0.8 fixed pci device handling, see below for patches from Heiko (Thanks!) + Marcus Meissner + + Modifications - Heiko Purnhagen + HP20020108 fixed handling of "large" read() + HP20020116 towards REV 1.5 support, based on ALSA's card-rme9652.c + HP20020118 made mixer ioctl and handling of devices>1 more safe + HP20020201 fixed handling of "large" read() properly + added REV 1.5 S/P-DIF receiver support + SNDCTL_DSP_SPEED now returns the actual speed * 10 Aug 2002: added synchronize_irq() again TODO: @@ -20,15 +31,17 @@ TODO: - mixer mmap interface - mixer ioctl - get rid of noise upon first open (why ??) - - allow multiple open(at least for read) + - allow multiple open (at least for read) - allow multiple open for non overlapping regions - recheck the multiple devices part (offsets of different devices, etc) - do decent draining in _release --- done - SMP support + - what about using fragstotal>2 for small fragsize? (HP20020118) + - add support for AFMT_S32_LE */ #ifndef RMEVERSION -#define RMEVERSION "0.6" +#define RMEVERSION "0.8" #endif #include @@ -41,6 +54,8 @@ TODO: #include #include #include +#include +#include #include #include #include @@ -134,45 +149,57 @@ MODULE_LICENSE("GPL"); #define RME96xx_F_0 0x0400000 /* 000=64kHz, 100=88.2kHz, 011=96kHz */ #define RME96xx_F_1 0x0800000 /* 111=32kHz, 110=44.1kHz, 101=48kHz, */ -#define RME96xx_F_2 0x1000000 /* od external Crystal Chip if ERF=1*/ +#define RME96xx_F_2 0x1000000 /* 001=Rev 1.5+ external Crystal Chip */ #define RME96xx_ERF 0x2000000 /* Error-Flag of SDPIF Receiver (1=No Lock)*/ #define RME96xx_buffer_id 0x4000000 /* toggles by each interrupt on rec/play */ #define RME96xx_tc_valid 0x8000000 /* 1 = a signal is detected on time-code input */ +#define RME96xx_SPDIF_READ 0x10000000 /* byte available from Rev 1.5+ SPDIF interface */ /* Status Register Fields */ #define RME96xx_lock (RME96xx_lock_0|RME96xx_lock_1|RME96xx_lock_2) -#define RME96xx_buf_pos 0x000FFC0 #define RME96xx_sync (RME96xx_sync_0|RME96xx_sync_1|RME96xx_sync_2) #define RME96xx_F (RME96xx_F_0|RME96xx_F_1|RME96xx_F_2) +#define rme96xx_decode_spdif_rate(x) ((x)>>22) +/* Bit 6..15 : h/w buffer pointer */ +#define RME96xx_buf_pos 0x000FFC0 +/* Bits 31,30,29 are bits 5,4,3 of h/w pointer position on later + Rev G EEPROMS and Rev 1.5 cards or later. +*/ +#define RME96xx_REV15_buf_pos(x) ((((x)&0xE0000000)>>26)|((x)&RME96xx_buf_pos)) /* Control-Register: */ /*--------------------------------------------------------------------------------*/ -#define RME96xx_start_bit 0x0001 /* start record/play */ -#define RME96xx_latency0 0x0002 /* Bit 0 - Buffer size or latency */ -#define RME96xx_latency1 0x0004 /* Bit 1 - Buffer size or latency */ -#define RME96xx_latency2 0x0008 /* Bit 2 - Buffer size or latency */ - -#define RME96xx_Master 0x0010 /* Clock Mode Master=1,Slave/Auto=0 */ -#define RME96xx_IE 0x0020 /* Interupt Enable */ -#define RME96xx_freq 0x0040 /* samplerate 0=44.1/88.2, 1=48/96 kHz*/ - - -#define RME96xx_DS 0x0100 /* Doule Speed 0=44.1/48, 1=88.2/96 Khz */ -#define RME96xx_PRO 0x0200 /* spdif 0=consumer, 1=professional Mode*/ -#define RME96xx_EMP 0x0400 /* spdif Emphasis 0=None, 1=ON */ -#define RME96xx_Dolby 0x0800 /* spdif Non-audio bit 1=set, 0=unset */ - -#define RME96xx_opt_out 0x1000 /* Use 1st optical OUT as SPDIF: 1=yes,0=no */ -#define RME96xx_wsel 0x2000 /* use Wordclock as sync (overwrites master)*/ -#define RME96xx_inp_0 0x4000 /* SPDIF-IN: 00=optical (ADAT1), */ -#define RME96xx_inp_1 0x8000 /* 01=koaxial (Cinch), 10=Internal CDROM*/ - -#define RME96xx_SyncRef0 0x10000 /* preferred sync-source in autosync */ -#define RME96xx_SyncRef1 0x20000 /* 00=ADAT1,01=ADAT2,10=ADAT3,11=SPDIF */ +#define RME96xx_start_bit 0x0001 /* start record/play */ +#define RME96xx_latency0 0x0002 /* Buffer size / latency */ +#define RME96xx_latency1 0x0004 /* buffersize = 512Bytes * 2^n */ +#define RME96xx_latency2 0x0008 /* 0=64samples ... 7=8192samples */ + +#define RME96xx_Master 0x0010 /* Clock Mode 1=Master, 0=Slave/Auto */ +#define RME96xx_IE 0x0020 /* Interupt Enable */ +#define RME96xx_freq 0x0040 /* samplerate 0=44.1/88.2, 1=48/96 kHz*/ +#define RME96xx_freq1 0x0080 /* samplerate 0=32 kHz, 1=other rates ??? (from ALSA, but may be wrong) */ +#define RME96xx_DS 0x0100 /* double speed 0=44.1/48, 1=88.2/96 Khz */ +#define RME96xx_PRO 0x0200 /* SPDIF-OUT 0=consumer, 1=professional */ +#define RME96xx_EMP 0x0400 /* SPDIF-OUT emphasis 0=off, 1=on */ +#define RME96xx_Dolby 0x0800 /* SPDIF-OUT non-audio bit 1=set, 0=unset */ + +#define RME96xx_opt_out 0x1000 /* use 1st optical OUT as SPDIF: 1=yes, 0=no */ +#define RME96xx_wsel 0x2000 /* use Wordclock as sync (overwrites master) */ +#define RME96xx_inp_0 0x4000 /* SPDIF-IN 00=optical (ADAT1), */ +#define RME96xx_inp_1 0x8000 /* 01=coaxial (Cinch), 10=internal CDROM */ + +#define RME96xx_SyncRef0 0x10000 /* preferred sync-source in autosync */ +#define RME96xx_SyncRef1 0x20000 /* 00=ADAT1, 01=ADAT2, 10=ADAT3, 11=SPDIF */ + +#define RME96xx_SPDIF_RESET (1<<18) /* Rev 1.5+: h/w SPDIF receiver */ +#define RME96xx_SPDIF_SELECT (1<<19) +#define RME96xx_SPDIF_CLOCK (1<<20) +#define RME96xx_SPDIF_WRITE (1<<21) +#define RME96xx_ADAT1_INTERNAL (1<<22) /* Rev 1.5+: if set, internal CD connector carries ADAT */ #define RME96xx_ctrl_init (RME96xx_latency0 |\ @@ -186,7 +213,9 @@ MODULE_LICENSE("GPL"); #define RME96xx_latency (RME96xx_latency0|RME96xx_latency1|RME96xx_latency2) #define RME96xx_inp (RME96xx_inp_0|RME96xx_inp_1) #define RME96xx_SyncRef (RME96xx_SyncRef0|RME96xx_SyncRef1) -/* latency = 512Bytes * 2^n, where n is made from Bit3 ... Bit0 */ +#define RME96xx_mixer_allowed (RME96xx_Master|RME96xx_PRO|RME96xx_EMP|RME96xx_Dolby|RME96xx_opt_out|RME96xx_wsel|RME96xx_inp|RME96xx_SyncRef|RME96xx_ADAT1_INTERNAL) + +/* latency = 512Bytes * 2^n, where n is made from Bit3 ... Bit1 (??? HP20020201) */ #define RME96xx_SET_LATENCY(x) (((x)&0x7)<<1) #define RME96xx_GET_LATENCY(x) (((x)>>1)&0x7) @@ -211,6 +240,7 @@ MODULE_LICENSE("GPL"); #define RME96xx_MAX_DEVS 4 /* we provide some OSS stereodevs */ +#define RME96xx_MASK_DEVS 0x3 /* RME96xx_MAX_DEVS-1 */ #define RME_MESS "rme96xx:" /*------------------------------------------------------------------------ @@ -259,8 +289,10 @@ typedef struct _rme96xx_info { u32 thru_bits; /* thru 1=on, 0=off channel 1=Bit1... channel 26= Bit26 */ - int open_count; + int hw_rev; /* h/w rev * 10 (i.e. 1.5 has hw_rev = 15) */ + char *card_name; /* hammerfall or hammerfall light names */ + int open_count; /* unused ??? HP20020201 */ int rate; int latency; @@ -324,6 +356,181 @@ inline void rme96xx_unset_ctrl(rme96xx_i } +inline int rme96xx_get_sample_rate_status(rme96xx_info* s) +{ + int val; + u32 status; + status = readl(s->iobase + RME96xx_status_register); + val = (status & RME96xx_fs48) ? 48000 : 44100; + if (status & RME96xx_DS_rd) + val *= 2; + return val; +} + +inline int rme96xx_get_sample_rate_ctrl(rme96xx_info* s) +{ + int val; + val = (s->control_register & RME96xx_freq) ? 48000 : 44100; + if (s->control_register & RME96xx_DS) + val *= 2; + return val; +} + + +/* code from ALSA card-rme9652.c for rev 1.5 SPDIF receiver HP 20020201 */ + +static void rme96xx_spdif_set_bit (rme96xx_info* s, int mask, int onoff) +{ + if (onoff) + s->control_register |= mask; + else + s->control_register &= ~mask; + + writel(s->control_register,s->iobase + RME96xx_control_register); +} + +static void rme96xx_spdif_write_byte (rme96xx_info* s, const int val) +{ + long mask; + long i; + + for (i = 0, mask = 0x80; i < 8; i++, mask >>= 1) { + if (val & mask) + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_WRITE, 1); + else + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_WRITE, 0); + + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_CLOCK, 1); + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_CLOCK, 0); + } +} + +static int rme96xx_spdif_read_byte (rme96xx_info* s) +{ + long mask; + long val; + long i; + + val = 0; + + for (i = 0, mask = 0x80; i < 8; i++, mask >>= 1) { + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_CLOCK, 1); + if (readl(s->iobase + RME96xx_status_register) & RME96xx_SPDIF_READ) + val |= mask; + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_CLOCK, 0); + } + + return val; +} + +static void rme96xx_write_spdif_codec (rme96xx_info* s, const int address, const int data) +{ + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_SELECT, 1); + rme96xx_spdif_write_byte (s, 0x20); + rme96xx_spdif_write_byte (s, address); + rme96xx_spdif_write_byte (s, data); + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_SELECT, 0); +} + + +static int rme96xx_spdif_read_codec (rme96xx_info* s, const int address) +{ + int ret; + + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_SELECT, 1); + rme96xx_spdif_write_byte (s, 0x20); + rme96xx_spdif_write_byte (s, address); + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_SELECT, 0); + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_SELECT, 1); + + rme96xx_spdif_write_byte (s, 0x21); + ret = rme96xx_spdif_read_byte (s); + rme96xx_spdif_set_bit (s, RME96xx_SPDIF_SELECT, 0); + + return ret; +} + +static void rme96xx_initialize_spdif_receiver (rme96xx_info* s) +{ + /* XXX what unsets this ? */ + /* no idea ??? HP 20020201 */ + + s->control_register |= RME96xx_SPDIF_RESET; + + rme96xx_write_spdif_codec (s, 4, 0x40); + rme96xx_write_spdif_codec (s, 17, 0x13); + rme96xx_write_spdif_codec (s, 6, 0x02); +} + +static inline int rme96xx_spdif_sample_rate (rme96xx_info *s, int *spdifrate) +{ + unsigned int rate_bits; + + *spdifrate = 0x1; + if (readl(s->iobase + RME96xx_status_register) & RME96xx_ERF) { + return -1; /* error condition */ + } + + if (s->hw_rev == 15) { + + int x, y, ret; + + x = rme96xx_spdif_read_codec (s, 30); + + if (x != 0) + y = 48000 * 64 / x; + else + y = 0; + + if (y > 30400 && y < 33600) {ret = 32000; *spdifrate = 0x7;} + else if (y > 41900 && y < 46000) {ret = 44100; *spdifrate = 0x6;} + else if (y > 46000 && y < 50400) {ret = 48000; *spdifrate = 0x5;} + else if (y > 60800 && y < 67200) {ret = 64000; *spdifrate = 0x0;} + else if (y > 83700 && y < 92000) {ret = 88200; *spdifrate = 0x4;} + else if (y > 92000 && y < 100000) {ret = 96000; *spdifrate = 0x3;} + else {ret = 0; *spdifrate = 0x1;} + return ret; + } + + rate_bits = readl(s->iobase + RME96xx_status_register) & RME96xx_F; + + switch (*spdifrate = rme96xx_decode_spdif_rate(rate_bits)) { + case 0x7: + return 32000; + break; + + case 0x6: + return 44100; + break; + + case 0x5: + return 48000; + break; + + case 0x4: + return 88200; + break; + + case 0x3: + return 96000; + break; + + case 0x0: + return 64000; + break; + + default: + /* was an ALSA warning ... + snd_printk("%s: unknown S/PDIF input rate (bits = 0x%x)\n", + s->card_name, rate_bits); + */ + return 0; + break; + } +} + +/* end of code from ALSA card-rme9652.c */ + /* the hwbuf in the status register seems to have some jitter, to get rid of @@ -662,6 +869,9 @@ static int rme96xx_dmabuf_init(rme96xx_i int rme96xx_init(rme96xx_info* s) { int i; + int status; + unsigned short rev; + DBG(printk(__FUNCTION__"\n")); numcards++; @@ -694,6 +904,56 @@ int rme96xx_init(rme96xx_info* s) rme96xx_dmabuf_init(s,dma,2*i,2*i); } + /* code from ALSA card-rme9652.c HP 20020201 */ + /* Determine the h/w rev level of the card. This seems like + a particularly kludgy way to encode it, but its what RME + chose to do, so we follow them ... + */ + + status = readl(s->iobase + RME96xx_status_register); + if (rme96xx_decode_spdif_rate(status&RME96xx_F) == 1) { + s->hw_rev = 15; + } else { + s->hw_rev = 11; + } + + /* Differentiate between the standard Hammerfall, and the + "Light", which does not have the expansion board. This + method comes from information received from Mathhias + Clausen at RME. Display the EEPROM and h/w revID where + relevant. + */ + + pci_read_config_word(s->pcidev, PCI_CLASS_REVISION, &rev); + switch (rev & 0xff) { + case 8: /* original eprom */ + if (s->hw_rev == 15) { + s->card_name = "RME Digi9636 (Rev 1.5)"; + } else { + s->card_name = "RME Digi9636"; + } + break; + case 9: /* W36_G EPROM */ + s->card_name = "RME Digi9636 (Rev G)"; + break; + case 4: /* W52_G EPROM */ + s->card_name = "RME Digi9652 (Rev G)"; + break; + default: + case 3: /* original eprom */ + if (s->hw_rev == 15) { + s->card_name = "RME Digi9652 (Rev 1.5)"; + } else { + s->card_name = "RME Digi9652"; + } + break; + } + + printk(KERN_INFO RME_MESS" detected %s (hw_rev %d)\n",s->card_name,s->hw_rev); + + if (s->hw_rev == 15) + rme96xx_initialize_spdif_receiver (s); + s->started = 0; rme96xx_setlatency(s,7); @@ -734,7 +994,7 @@ static int __devinit rme96xx_probe(struc if (pci_enable_device(pcidev)) goto err_irq; - if (request_irq(s->irq, rme96xx_interrupt, SA_SHIRQ, "es1370", s)) { + if (request_irq(s->irq, rme96xx_interrupt, SA_SHIRQ, "rme96xx", s)) { printk(KERN_ERR RME_MESS" irq %u in use\n", s->irq); goto err_irq; } @@ -836,6 +1096,7 @@ static int __init init_rme96xx(void) if (!pci_present()) /* No PCI bus in this machine! */ return -ENODEV; printk(KERN_INFO RME_MESS" version "RMEVERSION" time " __TIME__ " " __DATE__ "\n"); + devices = ((devices-1) & RME96xx_MASK_DEVS) + 1; printk(KERN_INFO RME_MESS" reserving %d dsp device(s)\n",devices); numcards = 0; return pci_module_init(&rme96xx_driver); @@ -859,13 +1120,11 @@ module_exit(cleanup_rme96xx); ---------------------------------------------------------------------------*/ #define RME96xx_FMT (AFMT_S16_LE|AFMT_U8|AFMT_S32_BLOCKED) +/* AFTM_U8 is not (yet?) supported ... HP20020201 */ - -static int rme96xx_ioctl(struct inode *in, struct file *file, - unsigned int cmd, unsigned long arg) +static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, unsigned long arg) { - struct dmabuf * dma = (struct dmabuf *)file->private_data; rme96xx_info *s = dma->s; unsigned long flags; @@ -918,14 +1177,23 @@ static int rme96xx_ioctl(struct inode *i case 96000: rme96xx_set_ctrl(s,RME96xx_freq); break; + /* just report current rate as default + e.g. use 0 to "select" current digital input rate default: rme96xx_unset_ctrl(s,RME96xx_freq); val = 44100; + */ } if (val > 50000) rme96xx_set_ctrl(s,RME96xx_DS); else rme96xx_unset_ctrl(s,RME96xx_DS); + /* set val to actual value HP 20020201 */ + /* NOTE: if not "Sync Master", reported rate might be not yet "updated" ... but I don't want to insert a long udelay() here */ + if ((s->control_register & RME96xx_Master) && !(s->control_register & RME96xx_wsel)) + val = rme96xx_get_sample_rate_ctrl(s); + else + val = rme96xx_get_sample_rate_status(s); s->rate = val; spin_unlock_irqrestore(&s->lock, flags); } @@ -1146,6 +1414,8 @@ static int rme96xx_ioctl(struct inode *i return 0; case SOUND_PCM_READ_RATE: + /* HP20020201 */ + s->rate = rme96xx_get_sample_rate_status(s); return put_user(s->rate, (int *)arg); case SOUND_PCM_READ_CHANNELS: @@ -1179,28 +1449,29 @@ static int rme96xx_open(struct inode *in { int minor = minor(in->i_rdev); struct list_head *list; - int devnum = ((minor-3)/16) % devices; /* default = 0 */ + int devnum; rme96xx_info *s; struct dmabuf* dma; DECLARE_WAITQUEUE(wait, current); DBG(printk("device num %d open\n",devnum)); -/* ??? */ for (list = devs.next; ; list = list->next) { if (list == &devs) return -ENODEV; s = list_entry(list, rme96xx_info, devs); - if (!((s->dspnum[devnum] ^ minor) & ~0xf)) + for (devnum=0; devnumdspnum[devnum] ^ minor) & ~0xf)) + break; + if (devnumdma[devnum]; f->private_data = dma; /* wait for device to become free */ - down(&s->dma[devnum].open_sem); + down(&dma->open_sem); while (dma->open_mode & f->f_mode) { if (f->f_flags & O_NONBLOCK) { up(&dma->open_sem); @@ -1219,11 +1490,11 @@ static int rme96xx_open(struct inode *in COMM ("hardware open") - if (!s->dma[devnum].opened) rme96xx_dmabuf_init(dma->s,dma,dma->inoffset,dma->outoffset); + if (!dma->opened) rme96xx_dmabuf_init(dma->s,dma,dma->inoffset,dma->outoffset); - s->dma[devnum].open_mode |= (f->f_mode & (FMODE_READ | FMODE_WRITE)); - s->dma[devnum].opened = 1; - up(&s->dma[devnum].open_sem); + dma->open_mode |= (f->f_mode & (FMODE_READ | FMODE_WRITE)); + dma->opened = 1; + up(&dma->open_sem); DBG(printk("device num %d open finished\n",devnum)); return 0; @@ -1232,7 +1503,7 @@ static int rme96xx_open(struct inode *in static int rme96xx_release(struct inode *in, struct file *file) { struct dmabuf * dma = (struct dmabuf*) file->private_data; - /* int hwp; */ + /* int hwp; ... was unused HP20020201 */ DBG(printk(__FUNCTION__"\n")); COMM ("draining") @@ -1261,8 +1532,7 @@ static int rme96xx_release(struct inode } -static ssize_t rme96xx_write(struct file *file, const char *buffer, - size_t count, loff_t *ppos) +static ssize_t rme96xx_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) { struct dmabuf *dma = (struct dmabuf *)file->private_data; ssize_t ret = 0; @@ -1296,7 +1566,6 @@ static ssize_t rme96xx_write(struct file dma->readptr = hwp; dma->writeptr = hwp; dma->started = 1; - COMM ("first write done") } while (count > 0) { @@ -1331,11 +1600,11 @@ static ssize_t rme96xx_write(struct file return ret; } -static ssize_t rme96xx_read(struct file *file, char *buffer,size_t count, loff_t *ppos) +static ssize_t rme96xx_read(struct file *file, char *buffer, size_t count, loff_t *ppos) { struct dmabuf *dma = (struct dmabuf *)file->private_data; ssize_t ret = 0; - int cnt; + int cnt; /* number of bytes from "buffer" that will/can be used */ int hop = count/dma->inchannels; int hwp; int exact = (file->f_flags & O_NONBLOCK); @@ -1356,9 +1625,6 @@ static ssize_t rme96xx_read(struct file if (! (dma->open_mode & FMODE_READ)) return -ENXIO; - if (count > ((dma->s->fragsize*dma->inchannels)>>dma->formatshift)) - return -EFAULT; - if (!dma->s->started) rme96xx_startcard(dma->s,exact); hwp = rme96xx_gethwptr(dma->s,0); @@ -1444,7 +1710,7 @@ static int rm96xx_mmap(struct file *file /* this is the mapping */ - + vma->vm_flags &= ~VM_IO; dma->mmapped = 1; unlock_kernel(); return 0; @@ -1529,8 +1795,12 @@ static int rme96xx_mixer_ioctl(struct in { rme96xx_info *s = (rme96xx_info *)file->private_data; u32 status; + int spdifrate; status = readl(s->iobase + RME96xx_status_register); + /* hack to convert rev 1.5 SPDIF rate to "crystalrate" format HP 20020201 */ + rme96xx_spdif_sample_rate(s,&spdifrate); + status = (status & ~RME96xx_F) | ((spdifrate<<22) & RME96xx_F); VALIDATE_STATE(s); if (cmd == SOUND_MIXER_PRIVATE1) { @@ -1538,9 +1808,21 @@ static int rme96xx_mixer_ioctl(struct in if (copy_from_user(&mixer,(void*)arg,sizeof(mixer))) return -EFAULT; - if (file->f_mode & FMODE_WRITE) { - s->dma[mixer.devnr].outoffset = mixer.o_offset; - s->dma[mixer.devnr].inoffset = mixer.i_offset; + mixer.devnr &= RME96xx_MASK_DEVS; + if (mixer.devnr >= devices) + mixer.devnr = devices-1; + if (file->f_mode & FMODE_WRITE && !s->dma[mixer.devnr].opened) { + /* modify only if device not open */ + if (mixer.o_offset < 0) + mixer.o_offset = 0; + if (mixer.o_offset >= RME96xx_CHANNELS_PER_CARD) + mixer.o_offset = RME96xx_CHANNELS_PER_CARD-1; + if (mixer.i_offset < 0) + mixer.i_offset = 0; + if (mixer.i_offset >= RME96xx_CHANNELS_PER_CARD) + mixer.i_offset = RME96xx_CHANNELS_PER_CARD-1; + s->dma[mixer.devnr].outoffset = mixer.o_offset; + s->dma[mixer.devnr].inoffset = mixer.i_offset; } mixer.o_offset = s->dma[mixer.devnr].outoffset; @@ -1552,13 +1834,14 @@ static int rme96xx_mixer_ioctl(struct in return put_user(status, (int *)arg); } if (cmd == SOUND_MIXER_PRIVATE3) { - u32 control; - if (copy_from_user(&control,(void*)arg,sizeof(control))) - return -EFAULT; - if (file->f_mode & FMODE_WRITE) { - s->control_register = control; - writel(control,s->iobase + RME96xx_control_register); - } + u32 control; + if (copy_from_user(&control,(void*)arg,sizeof(control))) + return -EFAULT; + if (file->f_mode & FMODE_WRITE) { + s->control_register &= ~RME96xx_mixer_allowed; + s->control_register |= control & RME96xx_mixer_allowed; + writel(control,s->iobase + RME96xx_control_register); + } return put_user(s->control_register, (int *)arg); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/rme96xx.h linux-2.5/sound/oss/rme96xx.h --- bk-linus/sound/oss/rme96xx.h 2002-11-21 02:26:09.000000000 +0000 +++ linux-2.5/sound/oss/rme96xx.h 2002-11-21 18:06:23.000000000 +0000 @@ -1,5 +1,12 @@ /* (C) 2000 Guenter Geiger with copy/pastes from the driver of Winfried Ritsch + +Modifications - Heiko Purnhagen + HP20020116 towards REV 1.5 support, based on ALSA's card-rme9652.c + HP20020201 completed? + +A text/graphic control panel (rmectrl/xrmectrl) is available from + http://gige.xdv.org/pages/soft/pages/rme */ @@ -7,55 +14,65 @@ #define AFMT_S32_BLOCKED 0x0000400 #endif +/* AFMT_S16_BLOCKED not yet supported */ #ifndef AFMT_S16_BLOCKED #define AFMT_S16_BLOCKED 0x0000800 #endif typedef struct rme_status { - unsigned int irq:1; /* high or low */ - unsigned int lockmask:3; /* ADAT1, ADAT2, ADAT3 */ - unsigned int sr48:1; /* current sample rate */ - unsigned int wclock:1; /* wordclock used ? */ - unsigned int bufpoint:10; - - unsigned int syncmask:3; /* ADAT1, ADAT2, ADAT3 */ - unsigned int doublespeed:1; - unsigned int tc_busy:1; - unsigned int tc_out:1; - unsigned int crystalrate:3; - unsigned int spdif_error:1; - unsigned int bufid:1; - unsigned int tc_valid:1; + unsigned int irq:1; + unsigned int lockmask:3; /* ADAT input PLLs locked */ + /* 100=ADAT1, 010=ADAT2, 001=ADAT3 */ + unsigned int sr48:1; /* sample rate: 0=44.1/88.2 1=48/96 kHz */ + unsigned int wclock:1; /* 1=wordclock used */ + unsigned int bufpoint:10; + unsigned int syncmask:3; /* ADAT input in sync with system clock */ + /* 100=ADAT1, 010=ADAT2, 001=ADAT3 */ + unsigned int doublespeed:1; /* sample rate: 0=44.1/48 1=88.2/96 kHz */ + unsigned int tc_busy:1; + unsigned int tc_out:1; + unsigned int crystalrate:3; /* spdif input sample rate: */ + /* 000=64kHz, 100=88.2kHz, 011=96kHz */ + /* 111=32kHz, 110=44.1kHz, 101=48kHz */ + unsigned int spdif_error:1; /* 1=no spdif lock */ + unsigned int bufid:1; + unsigned int tc_valid:1; /* 1=timecode input detected */ + unsigned int spdif_read:1; } rme_status_t; +/* only fields marked W: can be modified by writing to SOUND_MIXER_PRIVATE3 */ typedef struct rme_control { - unsigned int start:1; - unsigned int latency:3; - - unsigned int master:1; - unsigned int ie:1; - unsigned int sr48:1; - unsigned int spare:1; - - unsigned int doublespeed:1; - unsigned int pro:1; - unsigned int emphasis:1; - unsigned int dolby:1; - - unsigned int opt_out:1; - unsigned int wordclock:1; - unsigned int spdif_in:2; - - unsigned int sync_ref:2; + unsigned int start:1; + unsigned int latency:3; /* buffer size / latency [samples]: */ + /* 0=64 ... 7=8192 */ + unsigned int master:1; /* W: clock mode: 1=master 0=slave/auto */ + unsigned int ie:1; + unsigned int sr48:1; /* samplerate 0=44.1/88.2, 1=48/96 kHz */ + unsigned int spare:1; + unsigned int doublespeed:1; /* double speed 0=44.1/48, 1=88.2/96 Khz */ + unsigned int pro:1; /* W: SPDIF-OUT 0=consumer, 1=professional */ + unsigned int emphasis:1; /* W: SPDIF-OUT emphasis 0=off, 1=on */ + unsigned int dolby:1; /* W: SPDIF-OUT non-audio bit 1=set, 0=unset */ + unsigned int opt_out:1; /* W: use 1st optical OUT as SPDIF: 1=yes, 0=no */ + unsigned int wordclock:1; /* W: use Wordclock as sync (overwrites master) */ + unsigned int spdif_in:2; /* W: SPDIF-IN: */ + /* 00=optical (ADAT1), 01=coaxial (Cinch), 10=internal CDROM */ + unsigned int sync_ref:2; /* W: preferred sync-source in autosync */ + /* 00=ADAT1, 01=ADAT2, 10=ADAT3, 11=SPDIF */ + unsigned int spdif_reset:1; + unsigned int spdif_select:1; + unsigned int spdif_clock:1; + unsigned int spdif_write:1; + unsigned int adat1_cd:1; /* W: Rev 1.5+: if set, internal CD connector carries ADAT */ } rme_ctrl_t; typedef struct _rme_mixer { - int i_offset; - int o_offset; - int devnr; - int spare[8]; + int i_offset; + int o_offset; + int devnr; + int spare[8]; } rme_mixer; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/sb_audio.c linux-2.5/sound/oss/sb_audio.c --- bk-linus/sound/oss/sb_audio.c 2002-11-21 02:26:09.000000000 +0000 +++ linux-2.5/sound/oss/sb_audio.c 2002-11-21 18:06:23.000000000 +0000 @@ -602,8 +602,8 @@ static int sb16_audio_set_speed(int dev, if (speed > 0) { - if (speed < 5000) /* which of these */ - speed = 4000; /* is correct ??? */ + if (speed < 5000) + speed = 5000; if (speed > max_speed) speed = max_speed; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/x86_64/kernel/traps.c linux-2.5/arch/x86_64/kernel/traps.c --- bk-linus/arch/x86_64/kernel/traps.c 2002-11-21 02:13:00.000000000 +0000 +++ linux-2.5/arch/x86_64/kernel/traps.c 2002-11-21 17:57:06.000000000 +0000 @@ -353,11 +353,6 @@ void handle_BUG(struct pt_regs *regs) printk("Kernel BUG at %.50s:%d\n", f.filename, f.line); } -void out_of_line_bug(void) -{ - BUG(); -} - spinlock_t die_lock = SPIN_LOCK_UNLOCKED; int die_owner = -1; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/x86_64/kernel/x8664_ksyms.c linux-2.5/arch/x86_64/kernel/x8664_ksyms.c --- bk-linus/arch/x86_64/kernel/x8664_ksyms.c 2002-11-21 02:13:00.000000000 +0000 +++ linux-2.5/arch/x86_64/kernel/x8664_ksyms.c 2002-11-21 17:57:06.000000000 +0000 @@ -195,7 +195,4 @@ EXPORT_SYMBOL(die_chain); extern void do_softirq_thunk(void); EXPORT_SYMBOL_NOVERS(do_softirq_thunk); -void out_of_line_bug(void); -EXPORT_SYMBOL(out_of_line_bug); - EXPORT_SYMBOL(init_level4_pgt); Binary files bk-linus/core and linux-2.5/core differ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-i386/mmu_context.h linux-2.5/include/asm-i386/mmu_context.h --- bk-linus/include/asm-i386/mmu_context.h 2002-11-21 02:21:51.000000000 +0000 +++ linux-2.5/include/asm-i386/mmu_context.h 2002-11-21 18:03:23.000000000 +0000 @@ -50,7 +50,7 @@ static inline void switch_mm(struct mm_s else { cpu_tlbstate[cpu].state = TLBSTATE_OK; if (cpu_tlbstate[cpu].active_mm != next) - BUG(); + out_of_line_bug(); if (!test_and_set_bit(cpu, &next->cpu_vm_mask)) { /* We were in lazy tlb mode and leave_mm disabled * tlb flush IPI delivery. We must reload %cr3. diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-i386/pci.h linux-2.5/include/asm-i386/pci.h --- bk-linus/include/asm-i386/pci.h 2002-11-21 02:21:51.000000000 +0000 +++ linux-2.5/include/asm-i386/pci.h 2002-11-21 18:03:23.000000000 +0000 @@ -77,7 +77,7 @@ static inline dma_addr_t pci_map_single( size_t size, int direction) { if (direction == PCI_DMA_NONE) - BUG(); + out_of_line_bug(); flush_write_buffers(); return virt_to_phys(ptr); } @@ -93,7 +93,7 @@ static inline void pci_unmap_single(stru size_t size, int direction) { if (direction == PCI_DMA_NONE) - BUG(); + out_of_line_bug(); /* Nothing to do */ } @@ -105,7 +105,7 @@ static inline dma_addr_t pci_map_page(st unsigned long offset, size_t size, int direction) { if (direction == PCI_DMA_NONE) - BUG(); + out_of_line_bug(); return (dma_addr_t)(page_to_pfn(page)) * PAGE_SIZE + offset; } @@ -114,7 +114,7 @@ static inline void pci_unmap_page(struct size_t size, int direction) { if (direction == PCI_DMA_NONE) - BUG(); + out_of_line_bug(); /* Nothing to do */ } @@ -147,11 +147,11 @@ static inline int pci_map_sg(struct pci_ int i; if (direction == PCI_DMA_NONE) - BUG(); + out_of_line_bug(); for (i = 0; i < nents; i++ ) { if (!sg[i].page) - BUG(); + out_of_line_bug(); sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; } @@ -168,7 +168,7 @@ static inline void pci_unmap_sg(struct p int nents, int direction) { if (direction == PCI_DMA_NONE) - BUG(); + out_of_line_bug(); /* Nothing to do */ } @@ -186,7 +186,7 @@ static inline void pci_dma_sync_single(s size_t size, int direction) { if (direction == PCI_DMA_NONE) - BUG(); + out_of_line_bug(); flush_write_buffers(); } @@ -201,7 +201,7 @@ static inline void pci_dma_sync_sg(struc int nelems, int direction) { if (direction == PCI_DMA_NONE) - BUG(); + out_of_line_bug(); flush_write_buffers(); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-x86_64/page.h linux-2.5/include/asm-x86_64/page.h --- bk-linus/include/asm-x86_64/page.h 2002-11-21 02:23:41.000000000 +0000 +++ linux-2.5/include/asm-x86_64/page.h 2002-11-21 18:04:35.000000000 +0000 @@ -78,7 +78,6 @@ struct bug_frame { asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \ "i"(__LINE__), "i" (__stringify(KBUILD_BASENAME))) #define PAGE_BUG(page) BUG() -void out_of_line_bug(void); /* Pure 2^n version of get_order */ extern __inline__ int get_order(unsigned long size) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/dcache.h linux-2.5/include/linux/dcache.h --- bk-linus/include/linux/dcache.h 2002-11-21 02:23:47.000000000 +0000 +++ linux-2.5/include/linux/dcache.h 2002-11-21 18:04:40.000000000 +0000 @@ -255,7 +255,7 @@ static __inline__ struct dentry * dget(s { if (dentry) { if (!atomic_read(&dentry->d_count)) - BUG(); + out_of_line_bug(); atomic_inc(&dentry->d_count); } return dentry; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/highmem.h linux-2.5/include/linux/highmem.h --- bk-linus/include/linux/highmem.h 2002-11-21 02:23:51.000000000 +0000 +++ linux-2.5/include/linux/highmem.h 2002-11-21 18:04:42.000000000 +0000 @@ -53,7 +53,7 @@ static inline void memclear_highpage_flu void *kaddr; if (offset + size > PAGE_SIZE) - BUG(); + out_of_line_bug(); kaddr = kmap_atomic(page, KM_USER0); memset((char *)kaddr + offset, 0, size); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/kernel.h linux-2.5/include/linux/kernel.h --- bk-linus/include/linux/kernel.h 2002-11-21 02:23:56.000000000 +0000 +++ linux-2.5/include/linux/kernel.h 2002-11-21 18:04:46.000000000 +0000 @@ -180,6 +180,9 @@ extern void dump_stack(void); const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) +extern void __out_of_line_bug(int line) ATTRIB_NORET; +#define out_of_line_bug() __out_of_line_bug(__LINE__) + #endif /* __KERNEL__ */ #define SI_LOAD_SHIFT 16 diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/quotaops.h linux-2.5/include/linux/quotaops.h --- bk-linus/include/linux/quotaops.h 2002-11-21 02:24:04.000000000 +0000 +++ linux-2.5/include/linux/quotaops.h 2002-11-21 18:04:51.000000000 +0000 @@ -45,7 +45,7 @@ extern struct quotactl_ops vfs_quotactl_ static __inline__ void DQUOT_INIT(struct inode *inode) { if (!inode->i_sb) - BUG(); + out_of_line_bug(); lock_kernel(); if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) inode->i_sb->dq_op->initialize(inode, -1); @@ -57,7 +57,7 @@ static __inline__ void DQUOT_DROP(struct lock_kernel(); if (IS_QUOTAINIT(inode)) { if (!inode->i_sb) - BUG(); + out_of_line_bug(); inode->i_sb->dq_op->drop(inode); /* Ops must be set when there's any quota... */ } unlock_kernel(); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/skbuff.h linux-2.5/include/linux/skbuff.h --- bk-linus/include/linux/skbuff.h 2002-11-21 02:24:06.000000000 +0000 +++ linux-2.5/include/linux/skbuff.h 2002-11-21 18:04:53.000000000 +0000 @@ -858,7 +858,7 @@ static inline char *__skb_pull(struct sk { skb->len -= len; if (skb->len < skb->data_len) - BUG(); + out_of_line_bug(); return skb->data += len; } @@ -1101,7 +1101,7 @@ static inline void *kmap_skb_frag(const { #ifdef CONFIG_HIGHMEM if (in_irq()) - BUG(); + out_of_line_bug(); local_bh_disable(); #endif diff -urpN --exclude-from=/home/davej/.exclude bk-linus/kernel/ksyms.c linux-2.5/kernel/ksyms.c --- bk-linus/kernel/ksyms.c 2002-11-21 02:24:37.000000000 +0000 +++ linux-2.5/kernel/ksyms.c 2002-11-21 18:05:17.000000000 +0000 @@ -491,6 +491,7 @@ EXPORT_SYMBOL(loops_per_jiffy); /* misc */ EXPORT_SYMBOL(panic); +EXPORT_SYMBOL(__out_of_line_bug); EXPORT_SYMBOL(sprintf); EXPORT_SYMBOL(snprintf); EXPORT_SYMBOL(sscanf); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/kernel/panic.c linux-2.5/kernel/panic.c --- bk-linus/kernel/panic.c 2002-11-21 02:24:37.000000000 +0000 +++ linux-2.5/kernel/panic.c 2002-11-21 18:05:17.000000000 +0000 @@ -125,3 +129,23 @@ const char *print_tainted() } int tainted = 0; + +/* + * A BUG() call in an inline function in a header should be avoided, + * because it can seriously bloat the kernel. So here we have + * helper functions. + * We lose the BUG()-time file-and-line info this way, but it's + * usually not very useful from an inline anyway. The backtrace + * tells us what we want to know. + */ + +void __out_of_line_bug(int line) +{ + printk("kernel BUG in header file at line %d\n", line); + + BUG(); + + /* Satisfy __attribute__((noreturn)) */ + for ( ; ; ) + ; +} diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/parport/parport_serial.c linux-2.5/drivers/parport/parport_serial.c --- bk-linus/drivers/parport/parport_serial.c 2002-11-21 02:17:26.000000000 +0000 +++ linux-2.5/drivers/parport/parport_serial.c 2002-11-21 18:00:10.000000000 +0000 @@ -41,6 +41,11 @@ enum parport_pc_pci_cards { avlab_2s1p, avlab_2s1p_650, avlab_2s1p_850, + siig_1s1p_10x, + siig_2s1p_10x, + siig_2p1s_20x, + siig_1s1p_20x, + siig_2s1p_20x, }; @@ -74,6 +79,11 @@ static struct parport_pc_pci { /* avlab_2s1p */ { 1, { { 2, 3}, } }, /* avlab_2s1p_650 */ { 1, { { 2, 3}, } }, /* avlab_2s1p_850 */ { 1, { { 2, 3}, } }, + /* siig_1s1p_10x */ { 1, { { 3, 4 }, } }, + /* siig_2s1p_10x */ { 1, { { 4, 5 }, } }, + /* siig_2p1s_20x */ { 2, { { 1, 2 }, { 3, 4 }, } }, + /* siig_1s1p_20x */ { 1, { { 1, 2 }, } }, + /* siig_2s1p_20x */ { 1, { { 2, 3 }, } }, }; static struct pci_device_id parport_serial_pci_tbl[] __devinitdata = { @@ -92,6 +102,37 @@ static struct pci_device_id parport_seri { 0x14db, 0x2160, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p}, { 0x14db, 0x2161, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p_650}, { 0x14db, 0x2162, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p_850}, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_550, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_10x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_650, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_10x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_850, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_10x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_10x_550, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_10x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_10x_650, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_10x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_10x_850, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_10x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2P1S_20x_550, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2p1s_20x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2P1S_20x_650, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2p1s_20x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2P1S_20x_850, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2p1s_20x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_20x_550, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_20x_650, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_20x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_20x_850, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_20x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_550, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_650, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x }, + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_850, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x }, + { 0, } /* terminate list */ }; MODULE_DEVICE_TABLE(pci,parport_serial_pci_tbl); @@ -107,6 +148,16 @@ struct pci_board_no_ids { int first_uart_offset; }; +static int __devinit siig10x_init_fn(struct pci_dev *dev, struct pci_board_no_ids *board, int enable) +{ + return pci_siig10x_fn(dev, NULL, enable); +} + +static int __devinit siig20x_init_fn(struct pci_dev *dev, struct pci_board_no_ids *board, int enable) +{ + return pci_siig20x_fn(dev, NULL, enable); +} + static struct pci_board_no_ids pci_boards[] __devinitdata = { /* * PCI Flags, Number of Ports, Base (Maximum) Baud Rate, @@ -129,6 +180,11 @@ static struct pci_board_no_ids pci_board /* avlab_2s1p (n/t) */ { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 115200 }, /* avlab_2s1p_650 (nt)*/{ SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 115200 }, /* avlab_2s1p_850 (nt)*/{ SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 115200 }, +/* siig_1s1p_10x */ { SPCI_FL_BASE2, 1, 460800, 0, 0, siig10x_init_fn }, +/* siig_2s1p_10x */ { SPCI_FL_BASE2, 1, 921600, 0, 0, siig10x_init_fn }, +/* siig_2p1s_20x */ { SPCI_FL_BASE0, 1, 921600, 0, 0, siig20x_init_fn }, +/* siig_1s1p_20x */ { SPCI_FL_BASE0, 1, 921600, 0, 0, siig20x_init_fn }, +/* siig_2s1p_20x */ { SPCI_FL_BASE0, 1, 921600, 0, 0, siig20x_init_fn }, }; struct parport_serial_private { diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/parport/ChangeLog linux-2.5/drivers/parport/ChangeLog --- bk-linus/drivers/parport/ChangeLog 2002-11-21 02:17:24.000000000 +0000 +++ linux-2.5/drivers/parport/ChangeLog 2002-11-21 18:00:09.000000000 +0000 @@ -1,8 +1,7 @@ -2001-11-14 Tim Waugh +2002-04-25 Tim Waugh - * parport_pc.c (parport_pc_pci_probe): Hooks for PCI cards before - and after probing for ports. - * parport_serial.c (parport_register): Likewise. + * parport_serial.c, parport_pc.c: Move some SIIG cards around. + Patch from Andrey Panin. 2002-01-20 Tim Waugh @@ -21,17 +20,17 @@ * daisy.c: Apply patch from Max Vorobiev to make parport_daisy_select work for ECP/EPP modes. -2002-01-04 Tim Waugh - - * share.c (parport_claim_or_block): Sleep interruptibly to prevent - a possible deadlock. - 2002-01-13 Niels Kristian Bech Jensen * parport_pc.c: Change some occurrences of frob_set_mode to ECR_WRITE. This fixes PLIP. -2001-10-25 Damian Gruszka +2002-01-04 Tim Waugh + + * share.c (parport_claim_or_block): Sleep interruptibly to prevent + a possible deadlock. + +2001-12-07 Damian Gruszka * parport_pc.c (ECR_WRITE): Define. If there are forbidden bits in the ECR register for some chips, this will be a useful place to @@ -68,7 +67,7 @@ (parport_irq_probe): If no IRQ is found, take ackIntEn out of the writable bit set. -2001-10-25 Tim Waugh +2001-12-07 Tim Waugh * parport_pc.c (parport_pc_fifo_write_block_pio): Correct typo. (parport_pc_init_state): Only set ackIntEn if we know which IRQ @@ -85,6 +84,16 @@ too buggy at the moment. Use 'dma=auto' to restore the previous behaviour. +2001-12-07 Tim Waugh + + * daisy.c (DEBUG): Undefine. + +2001-12-06 Tim Waugh + + * ieee1284_ops.c (parport_ieee1284_ecp_read_data): Mask off + PARPORT_CONTROL_AUTOFD as well. Bug spotted by Joe + . + 2001-12-03 Rich Liu * parport_pc.c (sio_ite_8872_probe): ITE8873 is a single-port @@ -94,11 +103,11 @@ * parport_pc.c: Fix compiler warning. -2001-12-06 Tim Waugh +2001-11-14 Tim Waugh - * ieee1284_ops.c (parport_ieee1284_ecp_read_data): Mask off - PARPORT_CONTROL_AUTOFD as well. Bug spotted by Joe - . + * parport_pc.c (parport_pc_pci_probe): Hooks for PCI cards before + and after probing for ports. + * parport_serial.c (parport_register): Likewise. 2001-11-12 Tim Waugh diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pci/setup-bus.c linux-2.5/drivers/pci/setup-bus.c --- bk-linus/drivers/pci/setup-bus.c 2002-11-21 02:17:27.000000000 +0000 +++ linux-2.5/drivers/pci/setup-bus.c 2002-11-21 18:00:12.000000000 +0000 @@ -107,6 +107,14 @@ pci_setup_bridge(struct pci_bus *bus) DBGC((KERN_INFO "PCI: Bus %d, bridge: %s\n", bus->number, bridge->dev.name)); + /* Add bridge resources to the resource tree. */ + if (bus->resource[0]->end > bus->resource[0]->start && + request_resource(bus->resource[0], bus->resource[0]) < 0) + printk(KERN_ERR "PCI: failed to reserve IO for bus %d\n", bus->number); + if (bus->resource[1]->end > bus->resource[1]->start && + request_resource(bus->resource[1], bus->resource[1]) < 0) + printk(KERN_ERR "PCI: failed to reserve MEM for bus %d\n", bus->number); + /* Set up the top and bottom of the PCI I/O segment for this bus. */ if (bus->resource[0]->flags & IORESOURCE_IO) { pci_read_config_dword(bridge, PCI_IO_BASE, &l); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/pci_ids.h linux-2.5/include/linux/pci_ids.h --- bk-linus/include/linux/pci_ids.h 2002-11-21 02:24:01.000000000 +0000 +++ linux-2.5/include/linux/pci_ids.h 2002-11-21 18:04:50.000000000 +0000 @@ -353,6 +353,8 @@ #define PCI_DEVICE_ID_IBM_MPIC 0x0046 #define PCI_DEVICE_ID_IBM_3780IDSP 0x007d #define PCI_DEVICE_ID_IBM_CHUKAR 0x0096 +#define PCI_DEVICE_ID_IBM_CPC710_PCI64 0x00fc +#define PCI_DEVICE_ID_IBM_CPC710_PCI32 0x0105 #define PCI_DEVICE_ID_IBM_405GP 0x0156 #define PCI_DEVICE_ID_IBM_SERVERAIDI960 0x01bd #define PCI_DEVICE_ID_IBM_MPIC_2 0xffff @@ -1153,6 +1156,7 @@ #define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 #define PCI_DEVICE_ID_SERVERWORKS_CIOB30 0x0010 #define PCI_DEVICE_ID_SERVERWORKS_CMIC_HE 0x0011 +#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 #define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 #define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 #define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 @@ -1162,6 +1166,9 @@ #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 #define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 #define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB +#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221 +#define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225 +#define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227 #define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 #define PCI_VENDOR_ID_SBE 0x1176 @@ -1658,6 +1665,9 @@ #define PCI_DEVICE_ID_S3_ViRGE_MXPMV 0x8c03 #define PCI_DEVICE_ID_S3_SONICVIBES 0xca00 +#define PCI_VENDOR_ID_DUNORD 0x5544 +#define PCI_DEVICE_ID_DUNORD_I3000 0x0001 + #define PCI_VENDOR_ID_DCI 0x6666 #define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 #define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/pcmcia/aha152x_stub.c linux-2.5/drivers/scsi/pcmcia/aha152x_stub.c --- bk-linus/drivers/scsi/pcmcia/aha152x_stub.c 2002-11-21 02:18:39.000000000 +0000 +++ linux-2.5/drivers/scsi/pcmcia/aha152x_stub.c 2002-11-21 18:01:05.000000000 +0000 @@ -5,7 +5,7 @@ This driver supports the Adaptec AHA-1460, the New Media Bus Toaster, and the New Media Toast & Jam. - aha152x_cs.c 1.54 2000/06/12 21:27:25 + aha152x_cs.c 1.58 2001/10/13 00:08:51 The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file @@ -22,8 +22,8 @@ are Copyright (C) 1999 David A. Hinds. All Rights Reserved. Alternatively, the contents of this file may be used under the - terms of the GNU General Public License version 2 (the "GPL"), in which - case the provisions of the GPL are applicable instead of the + terms of the GNU General Public License version 2 (the "GPL"), in + which case the provisions of the GPL are applicable instead of the above. If you wish to allow the use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the MPL, indicate your decision @@ -57,42 +57,39 @@ #include #include -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -MODULE_PARM(pc_debug, "i"); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = -"aha152x_cs.c 1.54 2000/06/12 21:27:25 (David Hinds)"; -#else -#define DEBUG(n, args...) -#endif - /*====================================================================*/ -/* Parameters that can be set with 'insmod' */ +/* Module parameters */ + +MODULE_AUTHOR("David Hinds "); +MODULE_DESCRIPTION("Adaptec AHA152x-compatible PCMCIA SCSI driver"); +MODULE_LICENSE("Dual MPL/GPL"); -/* Bit map of interrupts to choose from */ -static u_int irq_mask = 0xdeb8; static int irq_list[4] = { -1 }; +MODULE_PARM(irq_list, "1-4i"); -/* SCSI bus setup options */ -static int host_id = 7; -static int reconnect = 1; -static int parity = 1; -static int synchronous = 0; -static int reset_delay = 100; -static int ext_trans = 0; +#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i") -MODULE_PARM(irq_mask, "i"); -MODULE_PARM(irq_list, "1-4i"); -MODULE_PARM(host_id, "i"); -MODULE_PARM(reconnect, "i"); -MODULE_PARM(parity, "i"); -MODULE_PARM(synchronous, "i"); -MODULE_PARM(reset_delay, "i"); -MODULE_PARM(ext_trans, "i"); +INT_MODULE_PARM(irq_mask, 0xdeb8); +INT_MODULE_PARM(host_id, 7); +INT_MODULE_PARM(reconnect, 1); +INT_MODULE_PARM(parity, 1); +INT_MODULE_PARM(synchronous, 0); +INT_MODULE_PARM(reset_delay, 100); +INT_MODULE_PARM(ext_trans, 0); -MODULE_LICENSE("Dual MPL/GPL"); +#ifdef AHA152X_DEBUG +INT_MODULE_PARM(debug, 0); +#endif + +#ifdef PCMCIA_DEBUG +INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); +#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) +static char *version = +"aha152x_cs.c 1.58 2001/10/13 00:08:51 (David Hinds)"; +#else +#define DEBUG(n, args...) +#endif /*====================================================================*/ @@ -277,7 +274,6 @@ static void aha152x_config_cs(dev_link_t release_region(link->io.BasePort1, link->io.NumPorts1); /* Set configuration options for the aha152x driver */ - ints[0] = 7; ints[1] = link->io.BasePort1; ints[2] = link->irq.AssignedIRQ; ints[3] = host_id; @@ -285,9 +281,13 @@ static void aha152x_config_cs(dev_link_t ints[5] = parity; ints[6] = synchronous; ints[7] = reset_delay; - if (ext_trans) { - ints[8] = ext_trans; ints[0] = 8; - } + ints[8] = ext_trans; +#ifdef AHA152X_DEBUG + ints[9] = debug; + ints[0] = 9; +#else + ints[0] = 8; +#endif aha152x_setup("PCMCIA setup", ints); scsi_register_host(&driver_template); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/pcmcia/fdomain_stub.c linux-2.5/drivers/scsi/pcmcia/fdomain_stub.c --- bk-linus/drivers/scsi/pcmcia/fdomain_stub.c 2002-11-21 02:18:39.000000000 +0000 +++ linux-2.5/drivers/scsi/pcmcia/fdomain_stub.c 2002-11-21 18:01:05.000000000 +0000 @@ -2,7 +2,7 @@ A driver for Future Domain-compatible PCMCIA SCSI cards - fdomain_cs.c 1.43 2000/06/12 21:27:25 + fdomain_cs.c 1.47 2001/10/13 00:08:52 The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file @@ -19,8 +19,8 @@ are Copyright (C) 1999 David A. Hinds. All Rights Reserved. Alternatively, the contents of this file may be used under the - terms of the GNU General Public License version 2 (the "GPL"), in which - case the provisions of the GPL are applicable instead of the + terms of the GNU General Public License version 2 (the "GPL"), in + which case the provisions of the GPL are applicable instead of the above. If you wish to allow the use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the MPL, indicate your decision @@ -54,27 +54,30 @@ #include #include -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -MODULE_PARM(pc_debug, "i"); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = -"fdomain_cs.c 1.43 2000/06/12 21:27:25 (David Hinds)"; -#else -#define DEBUG(n, args...) -#endif - /*====================================================================*/ -/* Parameters that can be set with 'insmod' */ +/* Module parameters */ + +MODULE_AUTHOR("David Hinds "); +MODULE_DESCRIPTION("Future Domain PCMCIA SCSI driver"); +MODULE_LICENSE("Dual MPL/GPL"); + +#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i") /* Bit map of interrupts to choose from */ -static u_int irq_mask = 0xdeb8; +INT_MODULE_PARM(irq_mask, 0xdeb8); static int irq_list[4] = { -1 }; - -MODULE_PARM(irq_mask, "i"); MODULE_PARM(irq_list, "1-4i"); +#ifdef PCMCIA_DEBUG +INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); +#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) +static char *version = +"fdomain_cs.c 1.47 2001/10/13 00:08:52 (David Hinds)"; +#else +#define DEBUG(n, args...) +#endif + /*====================================================================*/ typedef struct scsi_info_t { @@ -212,6 +215,7 @@ static void fdomain_config(dev_link_t *l u_char tuple_data[64]; Scsi_Device *dev; dev_node_t *node, **tail; + char str[16]; struct Scsi_Host *host; DEBUG(0, "fdomain_config(0x%p)\n", link); @@ -252,7 +256,8 @@ static void fdomain_config(dev_link_t *l ints[0] = 2; ints[1] = link->io.BasePort1; ints[2] = link->irq.AssignedIRQ; - fdomain_setup("PCMCIA setup", ints); + sprintf(str, "%d,%d", link->io.BasePort1, link->irq.AssignedIRQ); + fdomain_setup(str, ints); scsi_register_host(&driver_template); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/pcmcia/qlogic_stub.c linux-2.5/drivers/scsi/pcmcia/qlogic_stub.c --- bk-linus/drivers/scsi/pcmcia/qlogic_stub.c 2002-11-21 02:18:39.000000000 +0000 +++ linux-2.5/drivers/scsi/pcmcia/qlogic_stub.c 2002-11-21 18:01:06.000000000 +0000 @@ -2,7 +2,7 @@ A driver for the Qlogic SCSI card - qlogic_cs.c 1.79 2000/06/12 21:27:26 + qlogic_cs.c 1.83 2001/10/13 00:08:53 The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file @@ -19,8 +19,8 @@ are Copyright (C) 1999 David A. Hinds. All Rights Reserved. Alternatively, the contents of this file may be used under the - terms of the GNU General Public License version 2 (the "GPL"), in which - case the provisions of the GPL are applicable instead of the + terms of the GNU General Public License version 2 (the "GPL"), in + which case the provisions of the GPL are applicable instead of the above. If you wish to allow the use of your version of this file only under the terms of the GPL and not to allow others to use your version of this file under the MPL, indicate your decision @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -61,27 +62,30 @@ extern void qlogicfas_preset(int port, int irq); -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -MODULE_PARM(pc_debug, "i"); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = -"qlogic_cs.c 1.79 2000/06/12 21:27:26 (David Hinds)"; -#else -#define DEBUG(n, args...) -#endif - /*====================================================================*/ -/* Parameters that can be set with 'insmod' */ +/* Module parameters */ + +MODULE_AUTHOR("David Hinds "); +MODULE_DESCRIPTION("Qlogic PCMCIA SCSI driver"); +MODULE_LICENSE("Dual MPL/GPL"); + +#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i") /* Bit map of interrupts to choose from */ -static u_int irq_mask = 0xdeb8; +INT_MODULE_PARM(irq_mask, 0xdeb8); static int irq_list[4] = { -1 }; - -MODULE_PARM(irq_mask, "i"); MODULE_PARM(irq_list, "1-4i"); +#ifdef PCMCIA_DEBUG +INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); +#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) +static char *version = +"qlogic_cs.c 1.83 2001/10/13 00:08:53 (David Hinds)"; +#else +#define DEBUG(n, args...) +#endif + /*====================================================================*/ typedef struct scsi_info_t { diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/pppoe.c linux-2.5/drivers/net/pppoe.c --- bk-linus/drivers/net/pppoe.c 2002-11-21 02:16:23.000000000 +0000 +++ linux-2.5/drivers/net/pppoe.c 2002-11-21 17:59:26.000000000 +0000 @@ -648,8 +648,10 @@ int pppoe_connect(struct socket *sock, s release_sock(sk); return error; err_put: - dev_put(po->pppoe_dev); - po->pppoe_dev = NULL; + if (po->pppoe_dev) { + dev_put(po->pppoe_dev); + po->pppoe_dev = NULL; + } goto end; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/pppox.c linux-2.5/drivers/net/pppox.c --- bk-linus/drivers/net/pppox.c 2002-11-21 02:16:23.000000000 +0000 +++ linux-2.5/drivers/net/pppox.c 2002-11-21 17:59:26.000000000 +0000 @@ -5,9 +5,9 @@ * PPPoE --- PPP over Ethernet (RFC 2516) * * - * Version: 0.5.1 + * Version: 0.5.2 * - * Author: Michal Ostrowski + * Author: Michal Ostrowski * * 051000 : Initialization cleanup * @@ -67,9 +67,9 @@ void pppox_unbind_sock(struct sock *sk) { /* Clear connection to ppp device, if attached. */ - if (sk->state & PPPOX_BOUND) { + if (sk->state & (PPPOX_BOUND|PPPOX_ZOMBIE)) { ppp_unregister_channel(&pppox_sk(sk)->chan); - sk->state &= ~PPPOX_BOUND; + sk->state = PPPOX_DEAD; } } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/kernel/process.c linux-2.5/arch/i386/kernel/process.c --- bk-linus/arch/i386/kernel/process.c 2002-11-21 02:09:30.000000000 +0000 +++ linux-2.5/arch/i386/kernel/process.c 2002-11-21 17:55:02.000000000 +0000 @@ -44,6 +44,7 @@ #include #include #include +#include #include #ifdef CONFIG_MATH_EMULATION #include @@ -269,6 +270,8 @@ void release_thread(struct task_struct * BUG(); } } + + release_x86_irqs(dead_task); } /* diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-i386/irq.h linux-2.5/include/asm-i386/irq.h --- bk-linus/include/asm-i386/irq.h 2002-11-21 02:21:50.000000000 +0000 +++ linux-2.5/include/asm-i386/irq.h 2002-11-21 18:03:23.000000000 +0000 @@ -23,6 +23,7 @@ static __inline__ int irq_cannonicalize( extern void disable_irq(unsigned int); extern void disable_irq_nosync(unsigned int); extern void enable_irq(unsigned int); +extern void release_x86_irqs(struct task_struct *); #ifdef CONFIG_X86_LOCAL_APIC #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/irda/ali-ircc.c linux-2.5/drivers/net/irda/ali-ircc.c --- bk-linus/drivers/net/irda/ali-ircc.c 2002-11-21 02:16:45.000000000 +0000 +++ linux-2.5/drivers/net/irda/ali-ircc.c 2002-11-21 17:59:40.000000000 +0000 @@ -281,15 +282,13 @@ static int ali_ircc_open(int i, chipio_t self->io.fifo_size = 16; /* SIR: 16, FIR: 32 Benjamin 2000/11/1 */ /* Reserve the ioports that we need */ - ret = check_region(self->io.fir_base, self->io.fir_ext); - if (ret < 0) { + if (!request_region(self->io.fir_base, self->io.fir_ext, driver_name)) { WARNING("%s(), can't get iobase of 0x%03x\n", __FUNCTION__, self->io.fir_base); dev_self[i] = NULL; kfree(self); return -ENODEV; } - request_region(self->io.fir_base, self->io.fir_ext, driver_name); /* Initialize QoS for this device */ irda_init_max_qos_capabilies(&self->qos); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/de600.c linux-2.5/drivers/net/de600.c --- bk-linus/drivers/net/de600.c 2002-11-21 02:16:07.000000000 +0000 +++ linux-2.5/drivers/net/de600.c 2002-11-21 17:59:16.000000000 +0000 @@ -446,7 +446,10 @@ int __init de600_probe(struct net_device return -ENODEV; } - request_region(DE600_IO, 3, "de600"); + if (!request_region(DE600_IO, 3, "de600")) { + printk(KERN_WARNING "DE600: port 0x%x busy\n", DE600_IO); + return -EBUSY; + } printk(", Ethernet Address: %02X", dev->dev_addr[0]); for (i = 1; i < ETH_ALEN; i++) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/hamradio/dmascc.c linux-2.5/drivers/net/hamradio/dmascc.c --- bk-linus/drivers/net/hamradio/dmascc.c 2002-11-21 02:16:42.000000000 +0000 +++ linux-2.5/drivers/net/hamradio/dmascc.c 2002-11-21 17:59:38.000000000 +0000 @@ -599,7 +599,10 @@ int __init setup_adapter(int card_base, rtnl_unlock(); } - request_region(card_base, hw[type].io_size, "dmascc"); + if (!request_region(card_base, hw[type].io_size, "dmascc")) { + printk(KERN_WARNING "DMASCC: io-port 0x%04lx in use \n", card_base); + return(-EBUSY); + } info->next = first; first = info; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/ftape/lowlevel/fdc-io.c linux-2.5/drivers/char/ftape/lowlevel/fdc-io.c --- bk-linus/drivers/char/ftape/lowlevel/fdc-io.c 2002-11-21 02:14:10.000000000 +0000 +++ linux-2.5/drivers/char/ftape/lowlevel/fdc-io.c 2002-11-21 17:57:55.000000000 +0000 @@ -1209,27 +1209,35 @@ static int fdc_request_regions(void) TRACE_FUN(ft_t_flow); if (ft_mach2 || ft_probe_fc10) { - if (check_region(fdc.sra, 8) < 0) { + if (!request_region(fdc.sra, 8, "fdc (ft)")) + { #ifndef BROKEN_FLOPPY_DRIVER TRACE_EXIT -EBUSY; #else - TRACE(ft_t_warn, -"address 0x%03x occupied (by floppy driver?), using it anyway", fdc.sra); + TRACE(ft_t_warn, "address 0x%03x occupied (by floppy driver?), using it anyway", fdc.sra); #endif - } - request_region(fdc.sra, 8, "fdc (ft)"); - } else { - if (check_region(fdc.sra, 6) < 0 || - check_region(fdc.dir, 1) < 0) { + } + + if (!request_region(fdc.sra, 6, "fdc (ft)")) + { + release_region(fdc.sra, 8); #ifndef BROKEN_FLOPPY_DRIVER TRACE_EXIT -EBUSY; #else - TRACE(ft_t_warn, -"address 0x%03x occupied (by floppy driver?), using it anyway", fdc.sra); + TRACE(ft_t_warn, "address 0x%03x occupied (by floppy driver?), using it anyway", fdc.sra); #endif - } - request_region(fdc.sra, 6, "fdc (ft)"); - request_region(fdc.sra + 7, 1, "fdc (ft)"); + } + + if (!request_region(fdc.sra+7, 1, "fdc (ft)")) + { + release_region(fdc.sra, 8); + release_region(fdc.sra, 6); +#ifndef BROKEN_FLOPPY_DRIVER + TRACE_EXIT -EBUSY; +#else + TRACE(ft_t_warn, "address 0x%03x occupied (by floppy driver?), using it anyway", fdc.sra); +#endif + } } TRACE_EXIT 0; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/sh/kernel/hd64465_gpio.c linux-2.5/arch/sh/kernel/hd64465_gpio.c --- bk-linus/arch/sh/kernel/hd64465_gpio.c 2002-11-21 02:12:00.000000000 +0000 +++ linux-2.5/arch/sh/kernel/hd64465_gpio.c 2002-11-21 17:56:38.000000000 +0000 @@ -165,12 +165,19 @@ void hd64465_gpio_unregister_irq(int por static int __init hd64465_gpio_init(void) { - /* TODO: check return values */ - request_region(HD64465_REG_GPACR, 0x1000, MODNAME); - request_irq(HD64465_IRQ_GPIO, hd64465_gpio_interrupt, - SA_INTERRUPT, MODNAME, 0); + int err; + + if (!request_region(HD64465_REG_GPACR, 0x1000, MODNAME)) + return -EIO; + err = request_irq (HD64465_IRQ_GPIO, hd64465_gpio_interrupt, + SA_INTERRUPT, MODNAME, 0); + if (err) { + printk(KERN_ERR"HD64465: Unable to get irq %d.\n", HD64465_IRQ_GPIO); + release_region(HD64465_REG_GPACR, 0x1000); + return err; + } - printk("HD64465 GPIO layer on irq %d\n", HD64465_IRQ_GPIO); + printk("HD64465 GPIO layer on irq %d\n", HD64465_IRQ_GPIO); return 0; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/inia100.c linux-2.5/drivers/scsi/inia100.c --- bk-linus/drivers/scsi/inia100.c 2002-11-21 02:18:04.000000000 +0000 +++ linux-2.5/drivers/scsi/inia100.c 2002-11-21 18:00:42.000000000 +0000 @@ -366,7 +366,11 @@ int inia100_detect(Scsi_Host_Template * printk("inia100: initial orchid fail!!\n"); goto out_unalloc; } - request_region(pHCB->HCS_Base, 256, "inia100"); /* Register */ + if (!request_region(pHCB->HCS_Base, 256, "inia100")) { + printk(KERN_WARNING "inia100: io port 0x%x, is busy.\n", + pHCB->HCS_Base); + return (0); + } hreg->io_port = pHCB->HCS_Base; hreg->n_io_port = 0xff; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/ips.c linux-2.5/drivers/scsi/ips.c --- bk-linus/drivers/scsi/ips.c 2002-11-21 02:18:05.000000000 +0000 +++ linux-2.5/drivers/scsi/ips.c 2002-11-21 18:00:44.000000000 +0000 @@ -83,7 +83,7 @@ /* 2.3.18 and later */ /* - Sync with other changes from the 2.3 kernels */ /* 4.00.06 - Fix timeout with initial FFDC command */ -/* 4.00.06a - Port to 2.4 (trivial) -- Christoph Hellwig */ +/* 4.00.06a - Port to 2.4 (trivial) -- Christoph Hellwig */ /* 4.10.00 - Add support for ServeRAID 4M/4L */ /* 4.10.13 - Fix for dynamic unload and proc file system */ /* 4.20.03 - Rename version to coincide with new release schedules */ @@ -190,6 +190,7 @@ #ifdef MODULE static char *ips = NULL; MODULE_PARM(ips, "s"); + MODULE_LICENSE("GPL"); #endif /* @@ -884,7 +885,7 @@ ips_detect(Scsi_Host_Template *SHT) { DEBUG_VAR(1, "(%s%d) detect, IO region %x, size: %d", ips_name, ips_next_controller, io_addr, io_len); - if (check_region(io_addr, io_len)) { + if (!request_region(io_addr, io_len, "ips")) { /* Couldn't allocate io space */ printk(KERN_WARNING "(%s%d) couldn't allocate IO space %x len %d.\n", ips_name, ips_next_controller, io_addr, io_len); @@ -893,8 +894,6 @@ ips_detect(Scsi_Host_Template *SHT) { continue; } - - request_region(io_addr, io_len, "ips"); } /* get planer status */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/tokenring/madgemc.c linux-2.5/drivers/net/tokenring/madgemc.c --- bk-linus/drivers/net/tokenring/madgemc.c 2002-11-21 02:17:05.000000000 +0000 +++ linux-2.5/drivers/net/tokenring/madgemc.c 2002-11-21 17:59:53.000000000 +0000 @@ -227,16 +227,12 @@ int __init madgemc_probe(void) goto getout; } - request_region(dev->base_addr, MADGEMC_IO_EXTENT, "madgemc"); -#if 0 - /* why is this not working? */ - if (request_region(dev->base_addr, MADGEMC_IO_EXTENT, + if (!request_region(dev->base_addr, MADGEMC_IO_EXTENT, "madgemc")) { printk(KERN_INFO "madgemc: unable to setup Smart MC in slot %d because of I/O base conflict at 0x%04lx\n", slot, dev->base_addr); dev->base_addr += MADGEMC_SIF_OFFSET; goto getout; } -#endif dev->base_addr += MADGEMC_SIF_OFFSET; /* diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/appletalk/ltpc.c linux-2.5/drivers/net/appletalk/ltpc.c --- bk-linus/drivers/net/appletalk/ltpc.c 2002-11-21 02:16:34.000000000 +0000 +++ linux-2.5/drivers/net/appletalk/ltpc.c 2002-11-21 17:59:34.000000000 +0000 @@ -1063,26 +1063,39 @@ int __init ltpc_probe(struct net_device int autoirq; unsigned long flags; unsigned long f; + int portfound=0; SET_MODULE_OWNER(dev); save_flags(flags); /* probe for the I/O port address */ - if (io != 0x240 && !check_region(0x220,8)) { + if (io != 0x240 && request_region(0x220,8,"ltpc")) { x = inb_p(0x220+6); - if ( (x!=0xff) && (x>=0xf0) ) io = 0x220; + if ( (x!=0xff) && (x>=0xf0) ) { + io = 0x220; + portfound=1; + } + else { + release_region(0x220,8); + } } - if (io != 0x220 && !check_region(0x240,8)) { + if (io != 0x220 && request_region(0x240,8,"ltpc")) { y = inb_p(0x240+6); - if ( (y!=0xff) && (y>=0xf0) ) io = 0x240; + if ( (y!=0xff) && (y>=0xf0) ){ + io = 0x240; + portfound=1; + } + else { + release_region(0x240,8); + } } - if(io) { - /* found it, now grab it */ - request_region(io,8,"ltpc"); - } else { + if(io && !portfound && request_region(io,8,"ltpc")){ + portfound = 1; + } + if(!portfound) { /* give up in despair */ printk ("LocalTalk card not found; 220 = %02x, 240 = %02x.\n", x,y); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pcmcia/tcic.c linux-2.5/drivers/pcmcia/tcic.c --- bk-linus/drivers/pcmcia/tcic.c 2002-11-21 02:17:31.000000000 +0000 +++ linux-2.5/drivers/pcmcia/tcic.c 2002-11-21 18:00:14.000000000 +0000 @@ -394,7 +394,11 @@ static int __init init_tcic(void) printk(KERN_INFO "Databook TCIC-2 PCMCIA probe: "); sock = 0; - if (check_region(tcic_base, 16) == 0) { + if (!request_region(tcic_base, 16, "tcic-2")) { + printk("could not allocate ports,\n "); + return -ENODEV; + } + else { tcic_setw(TCIC_ADDR, 0); if (tcic_getw(TCIC_ADDR) == 0) { tcic_setw(TCIC_ADDR, 0xc3a5); @@ -410,16 +414,13 @@ static int __init init_tcic(void) if (tcic_getw(TCIC_ADDR) == 0xc3a5) sock = 2; } } - } else - printk("could not allocate ports, "); - + } if (sock == 0) { printk("not found.\n"); + release_region(tcic_base, 16); return -ENODEV; } - request_region(tcic_base, 16, "tcic-2"); - sockets = 0; for (i = 0; i < sock; i++) { if ((i == ignore) || is_active(i)) continue; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/wan/sbni.c linux-2.5/drivers/net/wan/sbni.c --- bk-linus/drivers/net/wan/sbni.c 2002-11-21 02:17:15.000000000 +0000 +++ linux-2.5/drivers/net/wan/sbni.c 2002-11-21 18:00:01.000000000 +0000 @@ -198,7 +198,7 @@ static inline int __init sbni_isa_probe( struct net_device *dev ) { if( dev->base_addr > 0x1ff - && !check_region( dev->base_addr, SBNI_IO_EXTENT ) + && request_region( dev->base_addr, SBNI_IO_EXTENT, dev->name ) && sbni_probe1( dev, dev->base_addr, dev->irq ) ) return 0; @@ -253,7 +253,7 @@ sbni_probe( struct net_device *dev ) for( i = 0; netcard_portlist[ i ]; ++i ) { int ioaddr = netcard_portlist[ i ]; - if( !check_region( ioaddr, SBNI_IO_EXTENT ) + if( request_region( ioaddr, SBNI_IO_EXTENT, dev->name ) && sbni_probe1( dev, ioaddr, 0 )) return 0; } @@ -284,7 +284,7 @@ sbni_pci_probe( struct net_device *dev pci_irq_line = pdev->irq; /* Avoid already found cards from previous calls */ - if( check_region( pci_ioaddr, SBNI_IO_EXTENT ) ) { + if( !pci_request_region( pci_ioaddr, SBNI_IO_EXTENT, dev->name ) ) { pci_read_config_word( pdev, PCI_SUBSYSTEM_ID, &subsys ); if( subsys != 2 || /* Dual adapter is present */ check_region( pci_ioaddr += 4, SBNI_IO_EXTENT ) ) @@ -314,9 +314,6 @@ sbni_probe1( struct net_device *dev, u { struct net_local *nl; - if( !request_region( ioaddr, SBNI_IO_EXTENT, dev->name ) ) - return 0; - if( sbni_card_probe( ioaddr ) ) { release_region( ioaddr, SBNI_IO_EXTENT ); return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/rocket.c linux-2.5/drivers/char/rocket.c --- bk-linus/drivers/char/rocket.c 2002-11-21 02:13:57.000000000 +0000 +++ linux-2.5/drivers/char/rocket.c 2002-11-21 17:57:44.000000000 +0000 @@ -1330,7 +1330,7 @@ static char *rp_tty_name(struct tty_stru { if (tty) sprintf(buf, "%s%d", tty->driver.name, - MINOR(tty->device) - tty->driver.minor_start + + minor(tty->device) - tty->driver.minor_start + tty->driver.name_base); else strcpy(buf, "NULL tty"); @@ -1794,6 +1794,10 @@ int __init register_PCI(int i, unsigned str = "8-port Modem"; max_num_aiops = 1; break; + case 0x8: + str = "mysterious 8 port"; + max_num_aiops = 1; + break; default: str = "(unknown/unsupported)"; max_num_aiops = 0; @@ -1872,6 +1876,10 @@ static int __init init_PCI(int boards_fo PCI_DEVICE_ID_RP8M, i, &bus, &device_fn)) if(register_PCI(count+boards_found, bus, device_fn)) count++; + if(!pcibios_find_device(PCI_VENDOR_ID_RP, + 0x8, i, &bus, &device_fn)) + if(register_PCI(count+boards_found, bus, device_fn)) + count++; } return(count); } @@ -2072,6 +2080,7 @@ int __init rp_init(void) if (retval < 0) { printk("Couldn't install Rocketport callout driver " "(error %d)\n", -retval); + release_region(controller, 4); return -1; } @@ -2079,6 +2088,7 @@ int __init rp_init(void) if (retval < 0) { printk("Couldn't install tty Rocketport driver " "(error %d)\n", -retval); + release_region(controller, 4); return -1; } #ifdef ROCKET_DEBUG_OPEN diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/sbc60xxwdt.c linux-2.5/drivers/char/sbc60xxwdt.c --- bk-linus/drivers/char/sbc60xxwdt.c 2002-11-21 02:13:57.000000000 +0000 +++ linux-2.5/drivers/char/sbc60xxwdt.c 2002-11-21 17:57:44.000000000 +0000 @@ -310,15 +310,16 @@ static void __exit sbc60xxwdt_unload(voi unregister_reboot_notifier(&wdt_notifier); release_region(WDT_START,1); - release_region(WDT_STOP,1); +// release_region(WDT_STOP,1); } static int __init sbc60xxwdt_init(void) { int rc = -EBUSY; - if (!request_region(WDT_STOP, 1, "SBC 60XX WDT")) - goto err_out; +// We cannot reserve 0x45 - the kernel already has! +// if (!request_region(WDT_STOP, 1, "SBC 60XX WDT")) +// goto err_out; if (!request_region(WDT_START, 1, "SBC 60XX WDT")) goto err_out_region1; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/ini9100u.c linux-2.5/drivers/scsi/ini9100u.c --- bk-linus/drivers/scsi/ini9100u.c 2002-11-21 02:18:04.000000000 +0000 +++ linux-2.5/drivers/scsi/ini9100u.c 2002-11-21 18:00:42.000000000 +0000 @@ -108,7 +108,7 @@ #define CVT_LINUX_VERSION(V,P,S) (V * 65536 + P * 256 + S) -#error Please convert me to Documentation/DMA-mapping.txt +/* #error Please convert me to Documentation/DMA-mapping.txt */ #ifndef LINUX_VERSION_CODE #include @@ -490,7 +490,9 @@ static void i91uBuildSCB(HCS * pHCB, SCB if (SCpnt->use_sg) { pSrbSG = (struct scatterlist *) SCpnt->request_buffer; if (SCpnt->use_sg == 1) { /* If only one entry in the list *//* treat it as regular I/O */ - pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS(pSrbSG->address); + pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS( + (unsigned char *)page_address(pSrbSG->page) + + pSrbSG->offset); TotalLen = pSrbSG->length; pSCB->SCB_SGLen = 0; } else { /* Assign SG physical address */ @@ -499,7 +501,9 @@ static void i91uBuildSCB(HCS * pHCB, SCB for (i = 0, TotalLen = 0, pSG = &pSCB->SCB_SGList[0]; /* 1.01g */ i < SCpnt->use_sg; i++, pSG++, pSrbSG++) { - pSG->SG_Ptr = (U32) VIRT_TO_BUS(pSrbSG->address); + pSG->SG_Ptr = (U32) VIRT_TO_BUS( + (unsigned char *)page_address(pSrbSG->page) + + pSrbSG->offset); TotalLen += pSG->SG_Len = pSrbSG->length; } pSCB->SCB_SGLen = i; @@ -551,6 +555,7 @@ int i91u_command(Scsi_Cmnd * SCpnt) return -1; } +#if 0 /* * Abort a queued command * (commands that are on the bus can't be aborted easily) @@ -578,6 +583,16 @@ int i91u_reset(Scsi_Cmnd * SCpnt, unsign else return tul_device_reset(pHCB, (ULONG) SCpnt, SCpnt->target, reset_flags); } +#endif + +static int i91u_eh_bus_reset(Scsi_Cmnd * SCpnt) +{ + HCS *pHCB; + + pHCB = (HCS *) SCpnt->host->base; + tul_reset_scsi_bus(pHCB); + return SUCCESS; +} /* * Return the "logical geometry" diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/ini9100u.h linux-2.5/drivers/scsi/ini9100u.h --- bk-linus/drivers/scsi/ini9100u.h 2002-11-21 02:18:04.000000000 +0000 +++ linux-2.5/drivers/scsi/ini9100u.h 2002-11-21 18:00:42.000000000 +0000 @@ -101,10 +101,8 @@ extern int i91u_biosparam(struct scsi_de eh_strategy_handler: NULL, \ eh_abort_handler: NULL, \ eh_device_reset_handler: NULL, \ - eh_bus_reset_handler: NULL, \ + eh_bus_reset_handler: i91u_eh_bus_reset, \ eh_host_reset_handler: NULL, \ - abort: i91u_abort, \ - reset: i91u_reset, \ slave_attach: NULL, \ bios_param: i91u_biosparam, \ can_queue: 1, \ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/megaraid.c linux-2.5/drivers/scsi/megaraid.c --- bk-linus/drivers/scsi/megaraid.c 2002-11-21 02:18:08.000000000 +0000 +++ linux-2.5/drivers/scsi/megaraid.c 2002-11-21 18:00:46.000000000 +0000 @@ -586,10 +586,10 @@ MODULE_LICENSE ("GPL"); #define DRIVER_LOCK(p) #define DRIVER_UNLOCK(p) #define IO_LOCK_T unsigned long io_flags = 0 -#define IO_LOCK(host) spin_lock_irqsave(host->host_lock,io_flags) -#define IO_UNLOCK(host) spin_unlock_irqrestore(host->host_lock,io_flags) -#define IO_LOCK_IRQ(host) spin_lock_irq(host->host_lock) -#define IO_UNLOCK_IRQ(host) spin_unlock_irq(host->host_lock) +#define IO_LOCK(host) spin_lock_irqsave((host)->host_lock,io_flags) +#define IO_UNLOCK(host) spin_unlock_irqrestore((host)->host_lock,io_flags) +#define IO_LOCK_IRQ(host) spin_lock_irq((host)->host_lock) +#define IO_UNLOCK_IRQ(host) spin_unlock_irq((host)->host_lock) #define queue_task_irq(a,b) queue_task(a,b) #define queue_task_irq_off(a,b) queue_task(a,b) @@ -614,8 +614,8 @@ MODULE_DESCRIPTION ("LSI Logic MegaRAID #define DRIVER_LOCK(p) #define DRIVER_UNLOCK(p) #define IO_LOCK_T unsigned long io_flags = 0 -#define IO_LOCK(host) spin_lock_irqsave(host->host_lock,io_flags); -#define IO_UNLOCK(host) spin_unlock_irqrestore(host->host_lock,io_flags); +#define IO_LOCK(host) spin_lock_irqsave(&io_request_lock,io_flags); +#define IO_UNLOCK(host) spin_unlock_irqrestore(&io_request_lock,io_flags); #define pci_free_consistent(a,b,c,d) #define pci_unmap_single(a,b,c,d) @@ -1151,12 +1151,12 @@ static void mega_cmd_done (mega_host_con if (mbox->cmd == MEGA_MBOXCMD_PASSTHRU) { memcpy (SCpnt->sense_buffer, pthru->reqsensearea, 14); } else if (mbox->cmd == MEGA_MBOXCMD_EXTPASSTHRU) { - SCpnt->result = (DRIVER_SENSE << 24) | (DID_OK << 16) | (CHECK_CONDITION < 1); + SCpnt->result = (DRIVER_SENSE << 24) | (DID_OK << 16) | (CHECK_CONDITION << 1); memcpy( SCpnt->sense_buffer, epthru->reqsensearea, 14 ); - SCpnt->result = (DRIVER_SENSE << 24) | (DID_OK << 16) | (CHECK_CONDITION < 1); + SCpnt->result = (DRIVER_SENSE << 24) | (DID_OK << 16) | (CHECK_CONDITION << 1); /*SCpnt->result = (DRIVER_SENSE << 24) | (DID_ERROR << 16) | status;*/ @@ -1864,7 +1864,14 @@ static mega_scb *mega_ioctl (mega_host_c return NULL; } - copy_from_user (pScb->buff_ptr, user_area, xfer_size); + if (copy_from_user (pScb->buff_ptr, user_area, xfer_size)) { + printk + ("megaraid: Copy failed for M_RD_IOCTL_CMD_NEW.\n"); + SCpnt->result = (DID_ERROR << 16); + callDone (SCpnt); + kfree (pScb->buff_ptr); + return NULL; + } pScb->iDataSize = xfer_size; switch (data[0]) { @@ -2273,7 +2280,7 @@ static int megaIssueCmd (mega_host_confi u_char byte; -#ifdef __LP64__ +#if BITS_PER_LONG==64 u64 phys_mbox; #else u32 phys_mbox; @@ -2559,7 +2566,7 @@ mega_register_mailbox (mega_host_config megaCfg->mbox = &megaCfg->mailbox64.mailbox; #endif -#ifdef __LP64__ +#if BITS_PER_LONG==64 megaCfg->mbox = (mega_mailbox *) ((((u64) megaCfg->mbox) + 16) & ((u64) (-1) ^ 0x0F)); megaCfg->adjdmahandle64 = (megaCfg->dma_handle64 + 16) & ((u64) (-1) ^ 0x0F); megaCfg->mbox64 = (mega_mailbox64 *) ((u_char *) megaCfg->mbox - sizeof (u64)); @@ -2837,7 +2844,7 @@ static int mega_findCard (Scsi_Host_Temp int i; -#ifdef __LP64__ +#if BITS_PER_LONG==64 u64 megaBase; #else u32 megaBase; @@ -3074,10 +3081,12 @@ static int mega_findCard (Scsi_Host_Temp /* * which firmware */ - if( strcmp(megaCfg->fwVer, "H01.07") == 0 || - strcmp(megaCfg->fwVer, "H01.08") == 0 ) { + if( strcmp(megaCfg->fwVer, "H01.07") == 0 || + strcmp(megaCfg->fwVer, "H01.08") == 0 || + strcmp(megaCfg->fwVer, "H01.09") == 0 ) + { printk(KERN_WARNING - "megaraid: Firmware H.01.07 or H.01.08 on 1M/2M " + "megaraid: Firmware H.01.07/8/9 on 1M/2M " "controllers\nmegaraid: do not support 64 bit " "addressing.\n" "megaraid: DISABLING 64 bit support.\n"); @@ -3149,7 +3158,7 @@ static int mega_findCard (Scsi_Host_Temp /* Set the Mode of addressing to 64 bit */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) if ((megaCfg->flag & BOARD_64BIT) && BITS_PER_LONG == 64) -#ifdef __LP64__ +#if BITS_PER_LONG==64 pdev->dma_mask = 0xffffffffffffffff; #else pdev->dma_mask = 0xffffffff; @@ -4444,10 +4453,10 @@ static int megadev_ioctl (struct inode * /* * Copy struct mcontroller to user area */ - copy_to_user (ioc.data, - mcontroller + adapno, - sizeof (struct mcontroller)); - return 0; + return copy_to_user (ioc.data, + mcontroller + adapno, + sizeof (struct mcontroller)) + ? -EFAULT : 0; default: return (-EINVAL); @@ -4541,7 +4550,16 @@ static int megadev_ioctl (struct inode * if (inlen) { /* copyin the user data */ - copy_from_user(kvaddr, (char *)uaddr, length ); + if (copy_from_user(kvaddr, (char *)uaddr, length )) { + printk(KERN_WARNING "megaraid:copy failed\n"); + dma_free_consistent(pdevp, length, kvaddr, dma_addr); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) /*0x20400 */ + kfree(scsicmd); +#else + scsi_init_free((char *)scsicmd, sizeof(Scsi_Cmnd)); +#endif + return -EFAULT; + } } } @@ -4558,7 +4576,17 @@ static int megadev_ioctl (struct inode * down(&mimd_ioctl_sem); if( !scsicmd->result && outlen ) { - copy_to_user(uaddr, kvaddr, length); + if (copy_to_user(uaddr, kvaddr, length)) { + up(&mimd_ioctl_sem); + dma_free_consistent(pdevp, length, kvaddr, dma_addr); + printk(KERN_WARNING "megaraid:copy failed\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) /*0x20400 */ + kfree(scsicmd); +#else + scsi_init_free((char *)scsicmd, sizeof(Scsi_Cmnd)); +#endif + return -EFAULT; + } } /* @@ -4682,9 +4710,19 @@ static int megadev_ioctl (struct inode * if (inlen) { if (ioc.mbox[0] == MEGA_MBOXCMD_PASSTHRU) { /* copyin the user data */ - copy_from_user (kvaddr, uaddr, ioc.pthru.dataxferlen); + ret = copy_from_user (kvaddr, uaddr, ioc.pthru.dataxferlen); } else { - copy_from_user (kvaddr, uaddr, inlen); + ret = copy_from_user (kvaddr, uaddr, inlen); + } + if (ret) { + dma_free_consistent(pdevp, PAGE_SIZE, kvaddr, dma_addr ); + printk (KERN_WARNING "megaraid:copy failed\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) /*0x20400 */ + kfree(scsicmd); +#else + scsi_init_free((char *)scsicmd, sizeof(Scsi_Cmnd)); +#endif + return -EFAULT; } } } @@ -4702,10 +4740,22 @@ static int megadev_ioctl (struct inode * if (!scsicmd->result && outlen) { if (ioc.mbox[0] == MEGA_MBOXCMD_PASSTHRU) { - copy_to_user (uaddr, kvaddr, ioc.pthru.dataxferlen); + ret = copy_to_user (uaddr, kvaddr, ioc.pthru.dataxferlen); } else { - copy_to_user (uaddr, kvaddr, outlen); + ret = copy_to_user (uaddr, kvaddr, outlen); } + if (ret) { + up (&mimd_ioctl_sem); + dma_free_consistent(pdevp, PAGE_SIZE, kvaddr, dma_addr ); + printk (KERN_WARNING "megaraid:copy failed\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) /*0x20400 */ + kfree(scsicmd); +#else + scsi_init_free((char *)scsicmd, sizeof(Scsi_Cmnd)); +#endif + return -EFAULT; + } + } /* diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/megaraid.h linux-2.5/drivers/scsi/megaraid.h --- bk-linus/drivers/scsi/megaraid.h 2002-11-21 02:18:08.000000000 +0000 +++ linux-2.5/drivers/scsi/megaraid.h 2002-11-21 18:00:46.000000000 +0000 @@ -707,7 +707,7 @@ typedef struct _mega_host_config { u8 numldrv; u32 flag; -#ifdef __LP64__ +#if BITS_PER_LONG==64 u64 base; #else u32 base; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/sgiwd93.c linux-2.5/drivers/scsi/sgiwd93.c --- bk-linus/drivers/scsi/sgiwd93.c 2002-11-21 02:18:23.000000000 +0000 +++ linux-2.5/drivers/scsi/sgiwd93.c 2002-11-21 18:00:56.000000000 +0000 @@ -4,10 +4,13 @@ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) * 1999 Andrew R. Baker (andrewb@uab.edu) * - Support for 2nd SCSI controller on Indigo2 + * 2001 Florian Lohoff (flo@rfc822.org) + * - Delete HPC scatter gather (Read corruption on + * multiple disks) + * - Cleanup wback cache handling * * (In all truth, Jed Schimmel wrote all this code.) * - * $Id: sgiwd93.c,v 1.19 2000/02/04 07:40:47 ralf Exp $ */ #include #include @@ -36,32 +39,13 @@ struct hpc_chunk { struct hpc_dma_desc desc; - unsigned long padding; + u32 _padding; /* align to quadword boundary */ }; struct Scsi_Host *sgiwd93_host = NULL; struct Scsi_Host *sgiwd93_host1 = NULL; /* Wuff wuff, wuff, wd33c93.c, wuff wuff, object oriented, bow wow. */ -static inline void write_wd33c93_count(const wd33c93_regs regs, - unsigned long value) -{ - *regs.SASR = WD_TRANSFER_COUNT_MSB; - *regs.SCMD = ((value >> 16) & 0xff); - *regs.SCMD = ((value >> 8) & 0xff); - *regs.SCMD = ((value >> 0) & 0xff); -} - -static inline unsigned long read_wd33c93_count(const wd33c93_regs regs) -{ - unsigned long value; - - *regs.SASR = WD_TRANSFER_COUNT_MSB; - value = (*regs.SCMD << 16); - value |= (*regs.SCMD << 8); - value |= (*regs.SCMD << 0); - return value; -} /* XXX woof! */ static void sgiwd93_intr(int irq, void *dev_id, struct pt_regs *regs) @@ -82,7 +66,6 @@ void fill_hpc_entries (struct hpc_chunk unsigned long physaddr; unsigned long count; - dma_cache_wback_inv((unsigned long)addr,len); physaddr = PHYSADDR(addr); while (len) { /* @@ -101,7 +84,6 @@ void fill_hpc_entries (struct hpc_chunk static int dma_setup(Scsi_Cmnd *cmd, int datainp) { struct WD33C93_hostdata *hdata = (struct WD33C93_hostdata *)cmd->host->hostdata; - const wd33c93_regs regs = hdata->regs; struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) cmd->host->base; struct hpc_chunk *hcp = (struct hpc_chunk *) hdata->dma_bounce_buffer; @@ -112,46 +94,17 @@ static int dma_setup(Scsi_Cmnd *cmd, int hdata->dma_dir = datainp; - if(cmd->SCp.buffers_residual) { - struct scatterlist *slp = cmd->SCp.buffer; - int i, totlen = 0; + /* + * wd33c93 shouldn't pass us bogus dma_setups, but + * it does:-( The other wd33c93 drivers deal with + * it the same way (which isn't that obvious). + * IMHO a better fix would be, not to do these + * dma setups in the first place + */ + if (cmd->SCp.ptr == NULL) + return 1; -#ifdef DEBUG_DMA - printk("SCLIST<"); -#endif - for(i = 0; i <= cmd->SCp.buffers_residual; i++) { -#ifdef DEBUG_DMA - printk("[%p,%d]", - page_address(slp[i].page) + slp[i].offset, - slp[i].length); -#endif - fill_hpc_entries (&hcp, - page_address(slp[i].page) + slp[i].offset, - slp[i].length); - totlen += slp[i].length; - } -#ifdef DEBUG_DMA - printk(">tlen<%d>", totlen); -#endif - hdata->dma_bounce_len = totlen; /* a trick... */ - write_wd33c93_count(regs, totlen); - } else { - /* Non-scattered dma. */ -#ifdef DEBUG_DMA - printk("ONEBUF<%p,%d>", cmd->SCp.ptr, cmd->SCp.this_residual); -#endif - /* - * wd33c93 shouldn't pass us bogus dma_setups, but - * it does:-( The other wd33c93 drivers deal with - * it the same way (which isn't that obvious). - * IMHO a better fix would be, not to do these - * dma setups in the first place - */ - if (cmd->SCp.ptr == NULL) - return 1; - fill_hpc_entries (&hcp, cmd->SCp.ptr,cmd->SCp.this_residual); - write_wd33c93_count(regs, cmd->SCp.this_residual); - } + fill_hpc_entries (&hcp, cmd->SCp.ptr,cmd->SCp.this_residual); /* To make sure, if we trip an HPC bug, that we transfer * every single byte, we tag on an extra zero length dma @@ -166,10 +119,14 @@ static int dma_setup(Scsi_Cmnd *cmd, int /* Start up the HPC. */ hregs->ndptr = PHYSADDR(hdata->dma_bounce_buffer); - if(datainp) + if(datainp) { + dma_cache_inv((unsigned long) cmd->SCp.ptr, cmd->SCp.this_residual); hregs->ctrl = (HPC3_SCTRL_ACTIVE); - else + } else { + dma_cache_wback_inv((unsigned long) cmd->SCp.ptr, cmd->SCp.this_residual); hregs->ctrl = (HPC3_SCTRL_ACTIVE | HPC3_SCTRL_DIR); + } + return 0; } @@ -177,7 +134,6 @@ static void dma_stop(struct Scsi_Host *i int status) { struct WD33C93_hostdata *hdata = (struct WD33C93_hostdata *)instance->hostdata; - const wd33c93_regs regs = hdata->regs; struct hpc3_scsiregs *hregs; if (!SCpnt) @@ -197,44 +153,6 @@ static void dma_stop(struct Scsi_Host *i } hregs->ctrl = 0; - /* See how far we got and update scatterlist state if necessary. */ - if(SCpnt->SCp.buffers_residual) { - struct scatterlist *slp = SCpnt->SCp.buffer; - int totlen, wd93_residual, transferred, i; - - /* Yep, we were doing the scatterlist thang. */ - totlen = hdata->dma_bounce_len; - wd93_residual = read_wd33c93_count(regs); - transferred = totlen - wd93_residual; - -#ifdef DEBUG_DMA - printk("tlen<%d>resid<%d>transf<%d> ", - totlen, wd93_residual, transferred); -#endif - - /* Avoid long winded partial-transfer search for common case. */ - if(transferred != totlen) { - /* This is the nut case. */ -#ifdef DEBUG_DMA - printk("Jed was here..."); -#endif - for(i = 0; i <= SCpnt->SCp.buffers_residual; i++) { - if(slp[i].length >= transferred) - break; - transferred -= slp[i].length; - } - } else { - /* This is the common case. */ -#ifdef DEBUG_DMA - printk("did it all..."); -#endif - i = SCpnt->SCp.buffers_residual; - } - SCpnt->SCp.buffer = &slp[i]; - SCpnt->SCp.buffers_residual = SCpnt->SCp.buffers_residual - i; - SCpnt->SCp.ptr = (char *) page_address(slp[i].page) + slp[i].offset; - SCpnt->SCp.this_residual = slp[i].length; - } #ifdef DEBUG_DMA printk("\n"); #endif @@ -264,6 +182,9 @@ static inline void init_hpc_chain(uchar }; hcp--; hcp->desc.pnext = PHYSADDR(buf); + + /* Force flush to memory */ + dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE); } int __init sgiwd93_detect(Scsi_Host_Template *SGIblows) @@ -273,8 +194,8 @@ int __init sgiwd93_detect(Scsi_Host_Temp struct hpc3_scsiregs *hregs1 = &hpc3c0->scsi_chan1; struct WD33C93_hostdata *hdata; struct WD33C93_hostdata *hdata1; - uchar *buf; wd33c93_regs regs; + uchar *buf; if(called) return 0; /* Should bitch on the console about this... */ @@ -294,10 +215,10 @@ int __init sgiwd93_detect(Scsi_Host_Temp return 0; } init_hpc_chain(buf); - dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE); + /* HPC_SCSI_REG0 | 0x03 | KSEG1 */ - regs.SASR = (volatile unsigned char *)KSEG1ADDR (0x1fbc0003); - regs.SCMD = (volatile unsigned char *)KSEG1ADDR (0x1fbc0007); + regs.SASR = (unsigned char*) KSEG1ADDR (0x1fbc0003); + regs.SCMD = (unsigned char*) KSEG1ADDR (0x1fbc0007); wd33c93_init(sgiwd93_host, regs, dma_setup, dma_stop, WD33C93_FS_16_20); hdata = (struct WD33C93_hostdata *)sgiwd93_host->hostdata; @@ -329,17 +250,16 @@ int __init sgiwd93_detect(Scsi_Host_Temp return 1; /* We registered host0 so return success*/ } init_hpc_chain(buf); - dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE); + /* HPC_SCSI_REG1 | 0x03 | KSEG1 */ - regs.SASR = (volatile unsigned char *)KSEG1ADDR (0x1fbc8003); - regs.SCMD = (volatile unsigned char *)KSEG1ADDR (0x1fbc8007); + regs.SASR = (unsigned char*) KSEG1ADDR(0x1fbc8003); + regs.SCMD = (unsigned char*) KSEG1ADDR(0x1fbc8007); wd33c93_init(sgiwd93_host1, regs, dma_setup, dma_stop, - WD33C93_FS_16_20); + WD33C93_FS_16_20); hdata1 = (struct WD33C93_hostdata *)sgiwd93_host1->hostdata; hdata1->no_sync = 0; hdata1->dma_bounce_buffer = (uchar *) (KSEG1ADDR(buf)); - dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE); if (request_irq(SGI_WD93_1_IRQ, sgiwd93_intr, 0, "SGI WD93", (void *) sgiwd93_host1)) { printk(KERN_WARNING "sgiwd93: Could not allocate irq %d (for host1).\n", SGI_WD93_1_IRQ); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/scsi_scan.c linux-2.5/drivers/scsi/scsi_scan.c --- bk-linus/drivers/scsi/scsi_scan.c 2002-11-21 02:18:21.000000000 +0000 +++ linux-2.5/drivers/scsi/scsi_scan.c 2002-11-21 18:00:55.000000000 +0000 @@ -168,6 +168,7 @@ struct dev_info scsi_static_device_list[ {"DELL", "PV530F", NULL, BLIST_SPARSELUN}, {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_FORCELUN}, {"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP VA7400 */ + {"HP", "OPEN-", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP XP Arrays */ {"CMD", "CRA-7280", NULL, BLIST_SPARSELUN}, /* CMD RAID Controller */ {"CNSI", "G7324", NULL, BLIST_SPARSELUN}, /* Chaparral G7324 RAID */ {"CNSi", "G8324", NULL, BLIST_SPARSELUN}, /* Chaparral G8324 RAID */ @@ -181,6 +182,12 @@ struct dev_info scsi_static_device_list[ {"COMPAQ", "MSA1000", NULL, BLIST_FORCELUN}, {"HP", "C1557A", NULL, BLIST_FORCELUN}, {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN}, + {"FSC", "CentricStor", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, + {"DDN", "SAN DataDirector", "*", BLIST_SPARSELUN}, + {"HITACHI", "DF400", "*", BLIST_SPARSELUN}, + {"HITACHI", "DF500", "*", BLIST_SPARSELUN}, + {"HITACHI", "DF600", "*", BLIST_SPARSELUN}, + {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, { NULL, NULL, NULL, 0 }, }; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/radio/radio-sf16fmi.c linux-2.5/drivers/media/radio/radio-sf16fmi.c --- bk-linus/drivers/media/radio/radio-sf16fmi.c 2002-11-21 02:15:41.000000000 +0000 +++ linux-2.5/drivers/media/radio/radio-sf16fmi.c 2002-11-21 17:58:53.000000000 +0000 @@ -82,24 +82,15 @@ static inline void fmi_unmute(int port) static inline int fmi_setfreq(struct fmi_device *dev) { - int myport = dev->port; + int myport = dev->port; unsigned long freq = dev->curfreq; - int i; - + down(&lock); - + outbits(16, RSF16_ENCODE(freq), myport); outbits(8, 0xC0, myport); - for(i=0; i< 100; i++) - { - udelay(1400); - cond_resched(); - } -/* If this becomes allowed use it ... current->state = TASK_UNINTERRUPTIBLE; schedule_timeout(HZ/7); -*/ - up(&lock); if (dev->curvol) fmi_unmute(myport); return 0; @@ -110,7 +101,7 @@ static inline int fmi_getsigstr(struct f int val; int res; int myport = dev->port; - int i; + down(&lock); val = dev->curvol ? 0x08 : 0x00; /* unmute/mute */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/sgi/char/sgiserial.c linux-2.5/drivers/sgi/char/sgiserial.c --- bk-linus/drivers/sgi/char/sgiserial.c 2002-11-21 02:18:50.000000000 +0000 +++ linux-2.5/drivers/sgi/char/sgiserial.c 2002-11-21 18:01:11.000000000 +0000 @@ -98,6 +98,7 @@ static unsigned char zscons_regs[16] = { DECLARE_TASK_QUEUE(tq_serial); struct tty_driver serial_driver, callout_driver; +struct console sgi_console_driver; struct console *sgisercon; static int serial_refcount; @@ -1232,7 +1233,7 @@ static int get_serial_info(struct sgi_se tmp.close_delay = info->close_delay; tmp.closing_wait = info->closing_wait; tmp.custom_divisor = info->custom_divisor; - return copy_to_user(retinfo,&tmp,sizeof(*retinfo)); + return copy_to_user(retinfo,&tmp,sizeof(*retinfo)) ? -EFAULT : 0; } static int set_serial_info(struct sgi_serial * info, @@ -1868,7 +1869,11 @@ int rs_init(void) memset(&serial_driver, 0, sizeof(struct tty_driver)); serial_driver.magic = TTY_DRIVER_MAGIC; +#ifdef CONFIG_DEVFS_FS + serial_driver.name = "tts/%d"; +#else serial_driver.name = "ttyS"; +#endif serial_driver.major = TTY_MAJOR; serial_driver.minor_start = 64; serial_driver.num = NUM_CHANNELS; @@ -1883,7 +1888,9 @@ int rs_init(void) serial_driver.table = serial_table; serial_driver.termios = serial_termios; serial_driver.termios_locked = serial_termios_locked; - +#ifdef CONFIG_SERIAL_CONSOLE + serial_driver.console = &sgi_console_driver; +#endif serial_driver.open = rs_open; serial_driver.close = rs_close; serial_driver.write = rs_write; @@ -1904,14 +1911,18 @@ int rs_init(void) * major number and the subtype code. */ callout_driver = serial_driver; +#ifdef CONFIG_DEVFS_FS + callout_driver.name = "cua/%d"; +#else callout_driver.name = "cua"; +#endif callout_driver.major = TTYAUX_MAJOR; callout_driver.subtype = SERIAL_TYPE_CALLOUT; if (tty_register_driver(&serial_driver)) - panic("Couldn't register serial driver\n"); + panic("Couldn't register serial driver"); if (tty_register_driver(&callout_driver)) - panic("Couldn't register callout driver\n"); + panic("Couldn't register callout driver"); save_flags(flags); cli(); @@ -2010,7 +2021,7 @@ int rs_init(void) if (request_irq(zilog_irq, rs_interrupt, (SA_INTERRUPT), "Zilog8530", zs_chain)) - panic("Unable to attach zs intr\n"); + panic("Unable to attach zs intr"); restore_flags(flags); return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/lib/inflate.c linux-2.5/lib/inflate.c --- bk-linus/lib/inflate.c 2002-11-21 02:24:39.000000000 +0000 +++ linux-2.5/lib/inflate.c 2002-11-21 18:05:19.000000000 +0000 @@ -1009,7 +1009,7 @@ STATIC int inflate() static ulg crc_32_tab[256]; static ulg crc; /* initialized in makecrc() so it'll reside in bss */ -#define CRC_VALUE (crc ^ 0xffffffffL) +#define CRC_VALUE (crc ^ 0xffffffffUL) /* * Code to compute the CRC-32 table. Borrowed from @@ -1049,7 +1049,7 @@ makecrc(void) } /* this is initialized here so this code could reside in ROM */ - crc = (ulg)0xffffffffL; /* shift register contents */ + crc = (ulg)0xffffffffUL; /* shift register contents */ } /* gzip flag byte */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/hamradio/soundmodem/sm_sbc.c linux-2.5/drivers/net/hamradio/soundmodem/sm_sbc.c --- bk-linus/drivers/net/hamradio/soundmodem/sm_sbc.c 2002-11-21 02:16:44.000000000 +0000 +++ linux-2.5/drivers/net/hamradio/soundmodem/sm_sbc.c 2002-11-21 17:59:40.000000000 +0000 @@ -47,36 +47,7 @@ */ #include -#if LINUX_VERSION_CODE >= 0x20100 #include -#else -#include -#include - -#undef put_user -#undef get_user - -#define put_user(x,ptr) ({ __put_user((unsigned long)(x),(ptr),sizeof(*(ptr))); 0; }) -#define get_user(x,ptr) ({ x = ((__typeof__(*(ptr)))__get_user((ptr),sizeof(*(ptr)))); 0; }) - -static inline int copy_from_user(void *to, const void *from, unsigned long n) -{ - int i = verify_area(VERIFY_READ, from, n); - if (i) - return i; - memcpy_fromfs(to, from, n); - return 0; -} - -static inline int copy_to_user(void *to, const void *from, unsigned long n) -{ - int i = verify_area(VERIFY_WRITE, to, n); - if (i) - return i; - memcpy_tofs(to, from, n); - return 0; -} -#endif /* --------------------------------------------------------------------- */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/hamradio/soundmodem/sm_wss.c linux-2.5/drivers/net/hamradio/soundmodem/sm_wss.c --- bk-linus/drivers/net/hamradio/soundmodem/sm_wss.c 2002-11-21 02:16:44.000000000 +0000 +++ linux-2.5/drivers/net/hamradio/soundmodem/sm_wss.c 2002-11-21 17:59:40.000000000 +0000 @@ -45,37 +45,7 @@ * This will go in 2.2 */ #include - -#if LINUX_VERSION_CODE >= 0x20100 #include -#else -#include -#include - -#undef put_user -#undef get_user - -#define put_user(x,ptr) ({ __put_user((unsigned long)(x),(ptr),sizeof(*(ptr))); 0; }) -#define get_user(x,ptr) ({ x = ((__typeof__(*(ptr)))__get_user((ptr),sizeof(*(ptr)))); 0; }) - -static inline int copy_from_user(void *to, const void *from, unsigned long n) -{ - int i = verify_area(VERIFY_READ, from, n); - if (i) - return i; - memcpy_fromfs(to, from, n); - return 0; -} - -static inline int copy_to_user(void *to, const void *from, unsigned long n) -{ - int i = verify_area(VERIFY_WRITE, to, n); - if (i) - return i; - memcpy_tofs(to, from, n); - return 0; -} -#endif /* --------------------------------------------------------------------- */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/scripts/split-include.c linux-2.5/scripts/split-include.c --- bk-linus/scripts/split-include.c 2002-11-21 02:25:36.000000000 +0000 +++ linux-2.5/scripts/split-include.c 2002-11-21 18:05:58.000000000 +0000 @@ -115,10 +115,10 @@ int main(int argc, const char * argv []) /* Make the output file name. */ str_config += sizeof("CONFIG_") - 1; - for (itarget = 0; !isspace(str_config[itarget]); itarget++) + for (itarget = 0; !isspace((int)str_config[itarget]); itarget++) { int c = (unsigned char) str_config[itarget]; - if (isupper(c)) c = tolower(c); + if (isupper((int)c)) c = tolower(c); if (c == '_') c = '/'; ptarget[itarget] = c; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/stallion.c linux-2.5/drivers/char/stallion.c --- bk-linus/drivers/char/stallion.c 2002-11-21 02:14:00.000000000 +0000 +++ linux-2.5/drivers/char/stallion.c 2002-11-21 17:57:46.000000000 +0000 @@ -188,14 +188,6 @@ static stlport_t stl_dummyport; */ static char stl_unwanted[SC26198_RXFIFOSIZE]; -/* - * Keep track of what interrupts we have requested for us. - * We don't need to request an interrupt twice if it is being - * shared with another Stallion board. - */ -static int stl_gotintrs[STL_MAXBRDS]; -static int stl_numintrs; - /*****************************************************************************/ static stlbrd_t *stl_brds[STL_MAXBRDS]; @@ -520,7 +512,6 @@ static int stl_readproc(char *page, char static int stl_brdinit(stlbrd_t *brdp); static int stl_initports(stlbrd_t *brdp, stlpanel_t *panelp); -static int stl_mapirq(int irq, char *name); static int stl_getserial(stlport_t *portp, struct serial_struct *sp); static int stl_setserial(stlport_t *portp, struct serial_struct *sp); static int stl_getbrdstats(combrd_t *bp); @@ -836,6 +827,7 @@ void cleanup_module() } kfree(panelp); } + free_irq(brdp->irq, brdp); release_region(brdp->ioaddr1, brdp->iosize1); if (brdp->iosize2 > 0) @@ -844,10 +836,6 @@ void cleanup_module() kfree(brdp); stl_brds[i] = (stlbrd_t *) NULL; } - - for (i = 0; (i < stl_numintrs); i++) - free_irq(stl_gotintrs[i], NULL); - restore_flags(flags); } @@ -2085,19 +2073,12 @@ stl_readdone: static void stl_intr(int irq, void *dev_id, struct pt_regs *regs) { stlbrd_t *brdp; - int i; #if DEBUG printk("stl_intr(irq=%d,regs=%x)\n", irq, (int) regs); #endif - - for (i = 0; (i < stl_nrbrds); i++) { - if ((brdp = stl_brds[i]) == (stlbrd_t *) NULL) - continue; - if (brdp->state == 0) - continue; - (* brdp->isr)(brdp); - } + brdp = (stlbrd_t *) dev_id; + (* brdp->isr)(brdp); } /*****************************************************************************/ @@ -2272,39 +2253,6 @@ out: /*****************************************************************************/ /* - * Map in interrupt vector to this driver. Check that we don't - * already have this vector mapped, we might be sharing this - * interrupt across multiple boards. - */ - -static int __init stl_mapirq(int irq, char *name) -{ - int rc, i; - -#if DEBUG - printk("stl_mapirq(irq=%d,name=%s)\n", irq, name); -#endif - - rc = 0; - for (i = 0; (i < stl_numintrs); i++) { - if (stl_gotintrs[i] == irq) - break; - } - if (i >= stl_numintrs) { - if (request_irq(irq, stl_intr, SA_SHIRQ, name, NULL) != 0) { - printk("STALLION: failed to register interrupt " - "routine for %s irq=%d\n", name, irq); - rc = -ENODEV; - } else { - stl_gotintrs[stl_numintrs++] = irq; - } - } - return(rc); -} - -/*****************************************************************************/ - -/* * Initialize all the ports on a panel. */ @@ -2367,7 +2315,6 @@ static inline int stl_initeio(stlbrd_t * stlpanel_t *panelp; unsigned int status; char *name; - int rc; #if DEBUG printk("stl_initeio(brdp=%x)\n", (int) brdp); @@ -2489,8 +2436,13 @@ static inline int stl_initeio(stlbrd_t * brdp->nrpanels = 1; brdp->state |= BRD_FOUND; brdp->hwid = status; - rc = stl_mapirq(brdp->irq, name); - return(rc); + if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) { + printk("STALLION: failed to register interrupt " + "routine for %s irq=%d\n", name, brdp->irq); + return -ENODEV; + } + + return 0; } /*****************************************************************************/ @@ -2694,7 +2646,12 @@ static int inline stl_initech(stlbrd_t * outb((brdp->ioctrlval | ECH_BRDDISABLE), brdp->ioctrl); brdp->state |= BRD_FOUND; - i = stl_mapirq(brdp->irq, name); + if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) { + printk("STALLION: failed to register interrupt " + "routine for %s irq=%d\n", name, brdp->irq); + i = -ENODEV; + } + return(i); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/isdn/pcbit/capi.h linux-2.5/drivers/isdn/pcbit/capi.h --- bk-linus/drivers/isdn/pcbit/capi.h 2002-11-21 02:15:26.000000000 +0000 +++ linux-2.5/drivers/isdn/pcbit/capi.h 2002-11-21 17:58:41.000000000 +0000 @@ -63,8 +63,7 @@ extern int capi_disc_resp(struct pcbit_c extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen); #endif -extern __inline__ -struct pcbit_chan * +static inline struct pcbit_chan * capi_channel(struct pcbit_dev *dev, struct sk_buff *skb) { ushort callref; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/video/pms.c linux-2.5/drivers/media/video/pms.c --- bk-linus/drivers/media/video/pms.c 2002-11-21 02:15:45.000000000 +0000 +++ linux-2.5/drivers/media/video/pms.c 2002-11-21 17:58:56.000000000 +0000 @@ -69,12 +69,12 @@ static int video_nr = -extern __inline__ void mvv_write(u8 index, u8 value) +static inline void mvv_write(u8 index, u8 value) { outw(index|(value<<8), io_port); } -extern __inline__ u8 mvv_read(u8 index) +static inline u8 mvv_read(u8 index) { outb(index, io_port); return inb(data_port); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/hpfs/hpfs_fn.h linux-2.5/fs/hpfs/hpfs_fn.h --- bk-linus/fs/hpfs/hpfs_fn.h 2002-11-21 02:20:07.000000000 +0000 +++ linux-2.5/fs/hpfs/hpfs_fn.h 2002-11-21 18:02:12.000000000 +0000 @@ -75,7 +75,7 @@ struct quad_buffer_head { /* The b-tree down pointer from a dir entry */ -extern inline dnode_secno de_down_pointer (struct hpfs_dirent *de) +static inline dnode_secno de_down_pointer (struct hpfs_dirent *de) { CHKCOND(de->down,("HPFS: de_down_pointer: !de->down\n")); return *(dnode_secno *) ((void *) de + de->length - 4); @@ -83,14 +83,14 @@ extern inline dnode_secno de_down_pointe /* The first dir entry in a dnode */ -extern inline struct hpfs_dirent *dnode_first_de (struct dnode *dnode) +static inline struct hpfs_dirent *dnode_first_de (struct dnode *dnode) { return (void *) dnode->dirent; } /* The end+1 of the dir entries */ -extern inline struct hpfs_dirent *dnode_end_de (struct dnode *dnode) +static inline struct hpfs_dirent *dnode_end_de (struct dnode *dnode) { CHKCOND(dnode->first_free>=0x14 && dnode->first_free<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %d\n",(int)dnode->first_free)); return (void *) dnode + dnode->first_free; @@ -98,58 +98,60 @@ extern inline struct hpfs_dirent *dnode_ /* The dir entry after dir entry de */ -extern inline struct hpfs_dirent *de_next_de (struct hpfs_dirent *de) +static inline struct hpfs_dirent *de_next_de (struct hpfs_dirent *de) { CHKCOND(de->length>=0x20 && de->length<0x800,("HPFS: de_next_de: de->length = %d\n",(int)de->length)); return (void *) de + de->length; } -extern inline struct extended_attribute *fnode_ea(struct fnode *fnode) +static inline struct extended_attribute *fnode_ea(struct fnode *fnode) { return (struct extended_attribute *)((char *)fnode + fnode->ea_offs); } -extern inline struct extended_attribute *fnode_end_ea(struct fnode *fnode) +static inline struct extended_attribute *fnode_end_ea(struct fnode *fnode) { return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->ea_size_s); } -extern inline struct extended_attribute *next_ea(struct extended_attribute *ea) +static inline struct extended_attribute *next_ea(struct extended_attribute *ea) { return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea->valuelen); } -extern inline secno ea_sec(struct extended_attribute *ea) +static inline secno ea_sec(struct extended_attribute *ea) { return *(secno *)((char *)ea + 9 + ea->namelen); } -extern inline secno ea_len(struct extended_attribute *ea) +static inline secno ea_len(struct extended_attribute *ea) { return *(secno *)((char *)ea + 5 + ea->namelen); } -extern inline char *ea_data(struct extended_attribute *ea) +static inline char *ea_data(struct extended_attribute *ea) { return (char *)((char *)ea + 5 + ea->namelen); } -extern inline unsigned de_size(int namelen, secno down_ptr) +static inline unsigned de_size(int namelen, secno down_ptr) { return ((0x1f + namelen + 3) & ~3) + (down_ptr ? 4 : 0); } -extern inline void copy_de(struct hpfs_dirent *dst, struct hpfs_dirent *src) +static inline void copy_de(struct hpfs_dirent *dst, struct hpfs_dirent *src) { - int a = dst->down; - int n = dst->not_8x3; + int a; + int n; if (!dst || !src) return; + a = dst->down; + n = dst->not_8x3; memcpy((char *)dst + 2, (char *)src + 2, 28); dst->down = a; dst->not_8x3 = n; } -extern inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n) +static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n) { int i; if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n; @@ -314,13 +316,13 @@ extern struct address_space_operations h * local time (HPFS) to GMT (Unix) */ -extern inline time_t local_to_gmt(struct super_block *s, time_t t) +static inline time_t local_to_gmt(struct super_block *s, time_t t) { extern struct timezone sys_tz; return t + sys_tz.tz_minuteswest * 60 + hpfs_sb(s)->sb_timeshift; } -extern inline time_t gmt_to_local(struct super_block *s, time_t t) +static inline time_t gmt_to_local(struct super_block *s, time_t t) { extern struct timezone sys_tz; return t - sys_tz.tz_minuteswest * 60 - hpfs_sb(s)->sb_timeshift; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/video/bw-qcam.c linux-2.5/drivers/media/video/bw-qcam.c --- bk-linus/drivers/media/video/bw-qcam.c 2002-11-21 02:15:43.000000000 +0000 +++ linux-2.5/drivers/media/video/bw-qcam.c 2002-11-21 17:58:54.000000000 +0000 @@ -89,27 +89,27 @@ MODULE_PARM(yieldlines,"i"); MODULE_PARM(video_nr,"i"); #endif -extern __inline__ int read_lpstatus(struct qcam_device *q) +static inline int read_lpstatus(struct qcam_device *q) { return parport_read_status(q->pport); } -extern __inline__ int read_lpcontrol(struct qcam_device *q) +static inline int read_lpcontrol(struct qcam_device *q) { return parport_read_control(q->pport); } -extern __inline__ int read_lpdata(struct qcam_device *q) +static inline int read_lpdata(struct qcam_device *q) { return parport_read_data(q->pport); } -extern __inline__ void write_lpdata(struct qcam_device *q, int d) +static inline void write_lpdata(struct qcam_device *q, int d) { parport_write_data(q->pport, d); } -extern __inline__ void write_lpcontrol(struct qcam_device *q, int d) +static inline void write_lpcontrol(struct qcam_device *q, int d) { parport_write_control(q->pport, d); } @@ -506,7 +506,7 @@ void qc_set(struct qcam_device *q) the supplied buffer. It returns the number of bytes read, or -1 on error. */ -extern __inline__ int qc_readbytes(struct qcam_device *q, char buffer[]) +static inline int qc_readbytes(struct qcam_device *q, char buffer[]) { int ret=1; unsigned int hi, lo; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/video/stradis.c linux-2.5/drivers/media/video/stradis.c --- bk-linus/drivers/media/video/stradis.c 2002-11-21 02:15:45.000000000 +0000 +++ linux-2.5/drivers/media/video/stradis.c 2002-11-21 17:58:56.000000000 +0000 @@ -1428,6 +1428,9 @@ static int saa_ioctl(struct video_device if (copy_from_user(saa->dmavid2, vw.clips, VIDEO_CLIPMAP_SIZE)) return -EFAULT; + } + else if (vw.clipcount > 16384) { + return -EINVAL; } else if (vw.clipcount > 0) { if ((vcp = vmalloc(sizeof(struct video_clip) * (vw.clipcount))) == NULL) @@ -1946,7 +1949,9 @@ static int saa_open(struct video_device { struct saa7146 *saa = (struct saa7146 *) dev; - saa->video_dev.busy = 0; + /* FIXME: Don't do it this way, use the video_device->fops + * registration for a sane implementation of multiple opens */ + saa->video_dev.users--; saa->user++; if (saa->user > 1) return 0; /* device open already, don't reset */ @@ -1958,7 +1963,7 @@ static void saa_close(struct video_devic { struct saa7146 *saa = (struct saa7146 *) dev; saa->user--; - saa->video_dev.busy = 0; + saa->video_dev.users++; if (saa->user > 0) /* still someone using device */ return; saawrite(0x007f0000, SAA7146_MC1); /* stop all overlay dma */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/file_table.c linux-2.5/fs/file_table.c --- bk-linus/fs/file_table.c 2002-11-21 02:19:43.000000000 +0000 +++ linux-2.5/fs/file_table.c 2002-11-21 18:01:55.000000000 +0000 @@ -18,7 +18,9 @@ /* sysctl tunables... */ -struct files_stat_struct files_stat = {0, 0, NR_FILE}; +struct files_stat_struct files_stat = { + .max_files = NR_FILE +}; /* Here the new files go */ static LIST_HEAD(anon_list); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/video/fbcon.c linux-2.5/drivers/video/fbcon.c --- bk-linus/drivers/video/fbcon.c 2002-11-21 02:19:26.000000000 +0000 +++ linux-2.5/drivers/video/fbcon.c 2002-11-21 18:01:39.000000000 +0000 @@ -230,8 +230,9 @@ static void fbcon_vbl_detect(int irq, vo static void cursor_timer_handler(unsigned long dev_addr); -static struct timer_list cursor_timer = - TIMER_INITIALIZER(cursor_timer_handler, 0, 0); +static struct timer_list cursor_timer = { + function: cursor_timer_handler +}; static void cursor_timer_handler(unsigned long dev_addr) { diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/message/i2o/i2o_scsi.c linux-2.5/drivers/message/i2o/i2o_scsi.c --- bk-linus/drivers/message/i2o/i2o_scsi.c 2002-11-21 02:15:53.000000000 +0000 +++ linux-2.5/drivers/message/i2o/i2o_scsi.c 2002-11-21 17:59:03.000000000 +0000 @@ -336,15 +336,10 @@ static void i2o_scsi_reply(struct i2o_ha return; } -struct i2o_handler i2o_scsi_handler= -{ - i2o_scsi_reply, - NULL, - NULL, - NULL, - "I2O SCSI OSM", - 0, - I2O_CLASS_SCSI_PERIPHERAL +struct i2o_handler i2o_scsi_handler = { + .reply = i2o_scsi_reply, + .name = "I2O SCSI OSM", + .class = I2O_CLASS_SCSI_PERIPHERAL, }; /** diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/sx.c linux-2.5/drivers/char/sx.c --- bk-linus/drivers/char/sx.c 2002-11-21 02:14:00.000000000 +0000 +++ linux-2.5/drivers/char/sx.c 2002-11-21 17:57:46.000000000 +0000 @@ -353,9 +353,11 @@ static int sx_probe_addrs[]= {0xc0000, 0 0xc8000, 0xd8000, 0xe8000}; static int si_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000, 0xc8000, 0xd8000, 0xe8000, 0xa0000}; +static int si1_probe_addrs[]= { 0xd0000}; #define NR_SX_ADDRS (sizeof(sx_probe_addrs)/sizeof (int)) #define NR_SI_ADDRS (sizeof(si_probe_addrs)/sizeof (int)) +#define NR_SI1_ADDRS (sizeof(si1_probe_addrs)/sizeof (int)) /* Set the mask to all-ones. This alas, only supports 32 interrupts. @@ -582,6 +584,8 @@ static int sx_reset (struct sx_board *bo } } else if (IS_EISA_BOARD(board)) { outb(board->irq<<4, board->eisa_base+0xc02); + } else if (IS_SI1_BOARD(board)) { + write_sx_byte (board, SI1_ISA_RESET, 0); // value does not matter } else { /* Gory details of the SI/ISA board */ write_sx_byte (board, SI2_ISA_RESET, SI2_ISA_RESET_SET); @@ -656,6 +660,9 @@ static int sx_start_board (struct sx_boa } else if (IS_EISA_BOARD(board)) { write_sx_byte(board, SI2_EISA_OFF, SI2_EISA_VAL); outb((board->irq<<4)|4, board->eisa_base+0xc02); + } else if (IS_SI1_BOARD(board)) { + write_sx_byte (board, SI1_ISA_RESET_CLEAR, 0); + write_sx_byte (board, SI1_ISA_INTCL, 0); } else { /* Don't bug me about the clear_set. I haven't the foggiest idea what it's about -- REW */ @@ -681,6 +688,9 @@ static int sx_start_interrupts (struct s SX_CONF_HOSTIRQ); } else if (IS_EISA_BOARD(board)) { inb(board->eisa_base+0xc03); + } else if (IS_SI1_BOARD(board)) { + write_sx_byte (board, SI1_ISA_INTCL,0); + write_sx_byte (board, SI1_ISA_INTCL_CLEAR,0); } else { switch (board->irq) { case 11:write_sx_byte (board, SI2_ISA_IRQ11, SI2_ISA_IRQ11_SET);break; @@ -1690,6 +1700,7 @@ static int sx_fw_ioctl (struct inode *in if (IS_SX_BOARD (board)) rc = SX_TYPE_SX; if (IS_CF_BOARD (board)) rc = SX_TYPE_CF; if (IS_SI_BOARD (board)) rc = SX_TYPE_SI; + if (IS_SI1_BOARD (board)) rc = SX_TYPE_SI; if (IS_EISA_BOARD (board)) rc = SX_TYPE_SI; sx_dprintk (SX_DEBUG_FIRMWARE, "returning type= %d\n", rc); break; @@ -2184,13 +2195,20 @@ static int probe_si (struct sx_board *bo int i; func_enter(); - sx_dprintk (SX_DEBUG_PROBE, "Going to verify SI signature %lx.\n", + sx_dprintk (SX_DEBUG_PROBE, "Going to verify SI signature hw %lx at %lx.\n", board->hw_base, board->base + SI2_ISA_ID_BASE); if (sx_debug & SX_DEBUG_PROBE) my_hd ((char *)(board->base + SI2_ISA_ID_BASE), 0x8); if (!IS_EISA_BOARD(board)) { + if( IS_SI1_BOARD(board) ) + { + for (i=0;i<8;i++) { + write_sx_byte (board, SI2_ISA_ID_BASE+7-i,i); + + } + } for (i=0;i<8;i++) { if ((read_sx_byte (board, SI2_ISA_ID_BASE+7-i) & 7) != i) { return 0; @@ -2562,6 +2580,21 @@ static int __init sx_init(void) my_iounmap (board->hw_base, board->base); } } + for (i=0;ihw_base = si1_probe_addrs[i]; + board->base2 = + board->base = (ulong) ioremap(board->hw_base, SI1_ISA_WINDOW_LEN); + board->flags &= ~SX_BOARD_TYPE; + board->flags |= SI1_ISA_BOARD; + board->irq = sx_irqmask ?-1:0; + + if (probe_si (board)) { + found++; + } else { + my_iounmap (board->hw_base, board->base); + } + } sx_dprintk(SX_DEBUG_PROBE, "Probing for EISA cards\n"); for(eisa_slot=0x1000; eisa_slot<0x10000; eisa_slot+=0x1000) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/sx.h linux-2.5/drivers/char/sx.h --- bk-linus/drivers/char/sx.h 2002-11-21 02:14:00.000000000 +0000 +++ linux-2.5/drivers/char/sx.h 2002-11-21 17:57:46.000000000 +0000 @@ -69,6 +69,7 @@ struct vpd_prom { #define SX_CFPCI_BOARD 0x00000008 #define SX_CFISA_BOARD 0x00000010 #define SI_EISA_BOARD 0x00000020 +#define SI1_ISA_BOARD 0x00000040 #define SX_BOARD_PRESENT 0x00001000 #define SX_BOARD_INITIALIZED 0x00002000 @@ -80,6 +81,7 @@ struct vpd_prom { SX_ISA_BOARD | SX_CFISA_BOARD)) #define IS_SI_BOARD(board) (board->flags & SI_ISA_BOARD) +#define IS_SI1_BOARD(board) (board->flags & SI1_ISA_BOARD) #define IS_EISA_BOARD(board) (board->flags & SI_EISA_BOARD) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/sxboards.h linux-2.5/drivers/char/sxboards.h --- bk-linus/drivers/char/sxboards.h 2002-11-21 02:14:00.000000000 +0000 +++ linux-2.5/drivers/char/sxboards.h 2002-11-21 17:57:46.000000000 +0000 @@ -46,12 +46,36 @@ #define CARD_BUS(type) ((type>>4)&0xF) #define CARD_PHASE(type) (type&0xF) +#define TYPE_SI1_ISA CARD_TYPE(BUS_ISA,SI1_Z280) #define TYPE_SI2_ISA CARD_TYPE(BUS_ISA,SI2_Z280) #define TYPE_SI2_EISA CARD_TYPE(BUS_EISA,SI2_Z280) #define TYPE_SI2_PCI CARD_TYPE(BUS_PCI,SI2_Z280) #define TYPE_SX_ISA CARD_TYPE(BUS_ISA,SI3_T225) #define TYPE_SX_PCI CARD_TYPE(BUS_PCI,SI3_T225) +/***************************************************************************** +****************************** ****************************** +****************************** Phase 1 Z280 ****************************** +****************************** ****************************** +*****************************************************************************/ + +/* ISA board details... */ +#define SI1_ISA_WINDOW_LEN 0x10000 /* 64 Kbyte shared memory window */ +//#define SI1_ISA_MEMORY_LEN 0x8000 /* Usable memory - unused define*/ +//#define SI1_ISA_ADDR_LOW 0x0A0000 /* Lowest address = 640 Kbyte */ +//#define SI1_ISA_ADDR_HIGH 0xFF8000 /* Highest address = 16Mbyte - 32Kbyte */ +//#define SI2_ISA_ADDR_STEP SI2_ISA_WINDOW_LEN/* ISA board address step */ +//#define SI2_ISA_IRQ_MASK 0x9800 /* IRQs 15,12,11 */ + +/* ISA board, register definitions... */ +//#define SI2_ISA_ID_BASE 0x7FF8 /* READ: Board ID string */ +#define SI1_ISA_RESET 0x8000 /* WRITE: Host Reset */ +#define SI1_ISA_RESET_CLEAR 0xc000 /* WRITE: Host Reset clear*/ +#define SI1_ISA_WAIT 0x9000 /* WRITE: Host wait */ +#define SI1_ISA_WAIT_CLEAR 0xd000 /* WRITE: Host wait clear */ +#define SI1_ISA_INTCL 0xa000 /* WRITE: Host Reset */ +#define SI1_ISA_INTCL_CLEAR 0xe000 /* WRITE: Host Reset */ + /***************************************************************************** ****************************** ****************************** diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/synclink.c linux-2.5/drivers/char/synclink.c --- bk-linus/drivers/char/synclink.c 2002-11-21 02:14:01.000000000 +0000 +++ linux-2.5/drivers/char/synclink.c 2002-11-21 17:57:47.000000000 +0000 @@ -875,22 +875,22 @@ static int mgsl_loopmode_send_done( stru * Global linked list of SyncLink devices */ struct mgsl_struct *mgsl_device_list; -int mgsl_device_count; +static int mgsl_device_count; /* * Set this param to non-zero to load eax with the * .text section address and breakpoint on module load. * This is useful for use with gdb and add-symbol-file command. */ -int break_on_load; +static int break_on_load; /* * Driver major number, defaults to zero to get auto * assigned major number. May be forced as module parameter. */ -int ttymajor; +static int ttymajor; -int cuamajor; +static int cuamajor; /* * Array of user specified options for ISA adapters. diff -urpN --exclude-from=/home/davej/.exclude bk-linus/net/ipv4/tcp.c linux-2.5/net/ipv4/tcp.c --- bk-linus/net/ipv4/tcp.c 2002-11-21 02:25:02.000000000 +0000 +++ linux-2.5/net/ipv4/tcp.c 2002-11-21 18:05:35.000000000 +0000 @@ -1190,7 +1190,8 @@ new_segment: from += copy; copied += copy; - seglen -= copy; + if ((seglen -= copy) == 0 && iovlen == 0) + goto out; if (skb->len != mss_now || (flags & MSG_OOB)) continue; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/kernel/apm.c linux-2.5/arch/i386/kernel/apm.c --- bk-linus/arch/i386/kernel/apm.c 2002-11-21 02:09:29.000000000 +0000 +++ linux-2.5/arch/i386/kernel/apm.c 2002-11-21 17:55:00.000000000 +0000 @@ -1239,16 +1239,18 @@ static void get_time_diff(void) #endif } -static inline void reinit_timer(void) +static void reinit_timer(void) { #ifdef INIT_TIMER_AFTER_SUSPEND + unsigned long flags; + extern spinlock_t i8253_lock; + + spin_lock_irqsave(&i8253_lock, flags); /* set the clock to 100 Hz */ outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */ - udelay(10); outb_p(LATCH & 0xff , 0x40); /* LSB */ - udelay(10); - outb(LATCH >> 8 , 0x40); /* MSB */ - udelay(10); + outb_p(LATCH >> 8, 0x40); /* MSB */ + spin_unlock_irqrestore(&i8253_lock, flags); #endif } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/kernel/i8259.c linux-2.5/arch/i386/kernel/i8259.c --- bk-linus/arch/i386/kernel/i8259.c 2002-11-21 02:09:29.000000000 +0000 +++ linux-2.5/arch/i386/kernel/i8259.c 2002-11-21 17:55:01.000000000 +0000 @@ -370,6 +370,8 @@ void __init init_ISA_irqs (void) void __init init_IRQ(void) { int i; + extern spinlock_t i8253_lock; + unsigned long flags; /* all the set up before the call gates are initialised */ pre_intr_init_hook(); @@ -393,9 +395,11 @@ void __init init_IRQ(void) * Set the clock to HZ Hz, we already have a valid * vector now: */ + spin_lock_irqsave(&i8253_lock, flags); outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */ outb_p(LATCH & 0xff , 0x40); /* LSB */ outb(LATCH >> 8 , 0x40); /* MSB */ + spin_unlock_irqrestore(&i8253_lock, flags); /* * External FPU? Set up irq13 if so, for diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/proc/array.c linux-2.5/fs/proc/array.c --- bk-linus/fs/proc/array.c 2002-11-21 02:20:58.000000000 +0000 +++ linux-2.5/fs/proc/array.c 2002-11-21 18:02:40.000000000 +0000 @@ -161,7 +161,8 @@ static inline char * task_state(struct t "Uid:\t%d\t%d\t%d\t%d\n" "Gid:\t%d\t%d\t%d\t%d\n", get_task_state(p), p->tgid, - p->pid, p->pid ? p->real_parent->pid : 0, 0, + p->pid, p->pid ? p->real_parent->pid : 0, + p->pid && p->ptrace ? p->parent->pid : 0, p->uid, p->euid, p->suid, p->fsuid, p->gid, p->egid, p->sgid, p->fsgid); read_unlock(&tasklist_lock); @@ -345,7 +346,7 @@ int proc_pid_stat(struct task_struct *ta ppid = task->pid ? task->real_parent->pid : 0; read_unlock(&tasklist_lock); res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \ -%lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu \ +%lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %llu %lu %ld %lu %lu %lu %lu %lu \ %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n", task->pid, task->comm, diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/n_tty.c linux-2.5/drivers/char/n_tty.c --- bk-linus/drivers/char/n_tty.c 2002-11-21 02:13:55.000000000 +0000 +++ linux-2.5/drivers/char/n_tty.c 2002-11-21 17:57:42.000000000 +0000 @@ -23,6 +23,11 @@ * 2000/01/20 Fixed SMP locking on put_tty_queue using bits of * the patch by Andrew J. Kroll * who actually finally proved there really was a race. + * + * 2002/03/18 Implemented n_tty_wakeup to send SIGIO POLL_OUTs to + * waiting writing processes-Sapan Bhatia . + * Also fixed a bug in BLOCKING mode where write_chan returns + * EAGAIN */ #include @@ -711,6 +716,22 @@ static int n_tty_receive_room(struct tty return 0; } +/* + * Required for the ptys, serial driver etc. since processes + * that attach themselves to the master and rely on ASYNC + * IO must be woken up + */ + +static void n_tty_write_wakeup(struct tty_struct *tty) +{ + if (tty->fasync) + { + set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); + kill_fasync(&tty->fasync, SIGIO, POLL_OUT); + } + return; +} + static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) { @@ -1157,6 +1178,8 @@ static ssize_t write_chan(struct tty_str while (nr > 0) { ssize_t num = opost_block(tty, b, nr); if (num < 0) { + if (num == -EAGAIN) + break; retval = num; goto break_out; } @@ -1236,6 +1259,6 @@ struct tty_ldisc tty_ldisc_N_TTY = { normal_poll, /* poll */ n_tty_receive_buf, /* receive_buf */ n_tty_receive_room, /* receive_room */ - 0 /* write_wakeup */ + n_tty_write_wakeup /* write_wakeup */ }; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/tty_io.c linux-2.5/drivers/char/tty_io.c --- bk-linus/drivers/char/tty_io.c 2002-11-21 02:14:02.000000000 +0000 +++ linux-2.5/drivers/char/tty_io.c 2002-11-21 17:57:48.000000000 +0000 @@ -1660,6 +1660,21 @@ static int send_break(struct tty_struct return 0; } +static int tty_generic_brk(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) +{ + if (cmd == TCSBRK && arg) + { + /* tcdrain case */ + int retval = tty_check_change(tty); + if (retval) + return retval; + tty_wait_until_sent(tty, 0); + if (signal_pending(current)) + return -EINTR; + } + return 0; +} + /* * Split this up, as gcc can choke on it otherwise.. */ @@ -1693,11 +1708,12 @@ int tty_ioctl(struct inode * inode, stru /* the driver doesn't support them. */ case TCSBRK: case TCSBRKP: - if (!tty->driver.ioctl) - return 0; - retval = tty->driver.ioctl(tty, file, cmd, arg); + retval = -ENOIOCTLCMD; + if (tty->driver.ioctl) + retval = tty->driver.ioctl(tty, file, cmd, arg); + /* Not driver handled */ if (retval == -ENOIOCTLCMD) - retval = 0; + retval = tty_generic_brk(tty, file, cmd, arg); return retval; } } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pcmcia/yenta.c linux-2.5/drivers/pcmcia/yenta.c --- bk-linus/drivers/pcmcia/yenta.c 2002-11-21 02:17:31.000000000 +0000 +++ linux-2.5/drivers/pcmcia/yenta.c 2002-11-21 18:00:15.000000000 +0000 @@ -694,7 +694,7 @@ static int yenta_suspend(pci_socket_t *s /* * This does not work currently. The controller - * loses too much informationduring D3 to come up + * loses too much information during D3 to come up * cleanly. We should probably fix yenta_init() * to update all the critical registers, notably * the IO and MEM bridging region data.. That is diff -urpN --exclude-from=/home/davej/.exclude bk-linus/Documentation/BK-usage/unbz64wrap linux-2.5/Documentation/BK-usage/unbz64wrap --- bk-linus/Documentation/BK-usage/unbz64wrap 2002-11-21 02:08:26.000000000 +0000 +++ linux-2.5/Documentation/BK-usage/unbz64wrap 2002-11-21 17:54:14.000000000 +0000 @@ -15,7 +15,7 @@ if mimencode -u < /dev/null > /dev/null case $LINE in begin-base64*) SHOW=YES ;; ====) SHOW= ;; - *) [ "$SHOW" ] && echo $LINE ;; + *) [ "$SHOW" ] && echo "$LINE" ;; esac done | mimencode -u | bunzip2 exit $? diff -urpN --exclude-from=/home/davej/.exclude bk-linus/Documentation/kernel-doc-nano-HOWTO.txt linux-2.5/Documentation/kernel-doc-nano-HOWTO.txt --- bk-linus/Documentation/kernel-doc-nano-HOWTO.txt 2002-11-21 02:08:23.000000000 +0000 +++ linux-2.5/Documentation/kernel-doc-nano-HOWTO.txt 2002-11-21 17:54:12.000000000 +0000 @@ -69,10 +69,10 @@ if ($#ARGV < 0) { mkdir $ARGV[0],0777; $state = 0; while () { - if (/^\.TH \"[^\"]*\" 4 \"([^\"]*)\"/) { + if (/^\.TH \"[^\"]*\" (\d) \"([^\"]*)\"/) { if ($state == 1) { close OUT } $state = 1; - $fn = "$ARGV[0]/$1.4"; + $fn = "$ARGV[0]/$2.$1"; print STDERR "Creating $fn\n"; open OUT, ">$fn" or die "can't open $fn: $!\n"; print OUT $_; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/kernel/exit.c linux-2.5/kernel/exit.c --- bk-linus/kernel/exit.c 2002-11-21 02:24:36.000000000 +0000 +++ linux-2.5/kernel/exit.c 2002-11-21 18:05:16.000000000 +0000 @@ -636,11 +636,11 @@ NORET_TYPE void do_exit(long code) { struct task_struct *tsk = current; - if (in_interrupt()) + if (unlikely(in_interrupt())) panic("Aiee, killing interrupt handler!"); - if (!tsk->pid) + if (unlikely(!tsk->pid)) panic("Attempted to kill the idle task!"); - if (tsk->pid == 1) + if (unlikely(tsk->pid == 1)) panic("Attempted to kill init!"); tsk->flags |= PF_EXITING; del_timer_sync(&tsk->real_timer); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/net/atari_bionet.c linux-2.5/drivers/net/atari_bionet.c --- bk-linus/drivers/net/atari_bionet.c 2002-11-21 02:16:06.000000000 +0000 +++ linux-2.5/drivers/net/atari_bionet.c 2002-11-21 17:59:14.000000000 +0000 @@ -114,8 +114,6 @@ static char version[] = #include -extern struct net_device *init_etherdev(struct net_device *dev, int sizeof_private); - /* use 0 for production, 1 for verification, >2 for debug */ #ifndef NET_DEBUG diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/sg.c linux-2.5/drivers/scsi/sg.c --- bk-linus/drivers/scsi/sg.c 2002-11-21 02:18:22.000000000 +0000 +++ linux-2.5/drivers/scsi/sg.c 2002-11-21 18:00:56.000000000 +0000 @@ -474,9 +474,7 @@ sg_new_read(Sg_fd * sfp, char *buf, size sb_len = (hp->mx_sb_len > sb_len) ? sb_len : hp->mx_sb_len; len = 8 + (int) srp->sense_b[7]; /* Additional sense length field */ len = (len > sb_len) ? sb_len : len; - if ((err = verify_area(VERIFY_WRITE, hp->sbp, len))) - goto err_out; - if (__copy_to_user(hp->sbp, srp->sense_b, len)) { + if (copy_to_user(hp->sbp, srp->sense_b, len)) { err = -EFAULT; goto err_out; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-alpha/processor.h linux-2.5/include/asm-alpha/processor.h --- bk-linus/include/asm-alpha/processor.h 2002-11-21 02:21:25.000000000 +0000 +++ linux-2.5/include/asm-alpha/processor.h 2002-11-21 18:03:05.000000000 +0000 @@ -30,7 +30,6 @@ * Bus types */ #define EISA_bus 1 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-ia64/processor.h linux-2.5/include/asm-ia64/processor.h --- bk-linus/include/asm-ia64/processor.h 2002-11-21 02:21:57.000000000 +0000 +++ linux-2.5/include/asm-ia64/processor.h 2002-11-21 18:03:27.000000000 +0000 @@ -49,7 +49,6 @@ * Bus types */ #define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-sh/processor.h linux-2.5/include/asm-sh/processor.h --- bk-linus/include/asm-sh/processor.h 2002-11-21 02:23:20.000000000 +0000 +++ linux-2.5/include/asm-sh/processor.h 2002-11-21 18:04:20.000000000 +0000 @@ -143,7 +143,6 @@ extern int kernel_thread(int (*fn)(void * Bus types */ #define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-sparc64/processor.h linux-2.5/include/asm-sparc64/processor.h --- bk-linus/include/asm-sparc64/processor.h 2002-11-21 02:23:30.000000000 +0000 +++ linux-2.5/include/asm-sparc64/processor.h 2002-11-21 18:04:28.000000000 +0000 @@ -25,7 +25,6 @@ /* Bus types */ #define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-sparc/processor.h linux-2.5/include/asm-sparc/processor.h --- bk-linus/include/asm-sparc/processor.h 2002-11-21 02:23:24.000000000 +0000 +++ linux-2.5/include/asm-sparc/processor.h 2002-11-21 18:04:24.000000000 +0000 @@ -28,7 +28,6 @@ * Bus types */ #define EISA_bus 0 -#define EISA_bus__is_a_macro /* for versions in ksyms.c */ #define MCA_bus 0 #define MCA_bus__is_a_macro /* for versions in ksyms.c */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/serio.h linux-2.5/include/linux/serio.h --- bk-linus/include/linux/serio.h 2002-11-21 02:24:06.000000000 +0000 +++ linux-2.5/include/linux/serio.h 2002-11-21 18:04:53.000000000 +0000 @@ -22,7 +22,6 @@ struct serio { void *driver; char *name; char *phys; - int number; unsigned short idbus; unsigned short idvendor; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/ip2.c linux-2.5/drivers/char/ip2.c --- bk-linus/drivers/char/ip2.c 2002-11-21 02:13:53.000000000 +0000 +++ linux-2.5/drivers/char/ip2.c 2002-11-21 17:57:40.000000000 +0000 @@ -33,10 +33,11 @@ ip2_loadmain(int *, int *, unsigned cha */ static int io[IP2_MAX_BOARDS]= { 0, 0, 0, 0 }; static int irq[IP2_MAX_BOARDS] = { -1, -1, -1, -1 }; -static int poll_only = 0; #ifdef MODULE +static int poll_only = 0; + # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) MODULE_AUTHOR("Doug McNash"); MODULE_DESCRIPTION("Computone IntelliPort Plus Driver"); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/Documentation/fb/tridentfb.txt linux-2.5/Documentation/fb/tridentfb.txt --- bk-linus/Documentation/fb/tridentfb.txt 2002-11-21 02:08:32.000000000 +0000 +++ linux-2.5/Documentation/fb/tridentfb.txt 2002-11-21 17:54:19.000000000 +0000 @@ -42,8 +42,14 @@ nativex - the width in pixels of the fla bpp - bits per pixel (8,16 or 32) mode - a mode name like 800x600 (as described in Documentation/fb/modedb.txt) +Example: +video=trident:memsize=2048,800x600 + Using insane values for the above parameters will probably result in driver misbehaviour so take care(for instance memsize=12345678 or memdiff=23784 or nativex=93) -Contact: jani@astechnix.ro +If you have trouble with the driver you could check http://sf.net/projects/tridentfb +to see if there's a newer version available. + +Contact: jani@iv.ro diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/usb/storage/datafab.c linux-2.5/drivers/usb/storage/datafab.c --- bk-linus/drivers/usb/storage/datafab.c 2002-11-21 02:19:18.000000000 +0000 +++ linux-2.5/drivers/usb/storage/datafab.c 2002-11-21 18:01:32.000000000 +0000 @@ -670,7 +670,7 @@ int datafab_transport(Scsi_Cmnd * srb, s srb->result = SUCCESS; } else { info->sense_key = UNIT_ATTENTION; - srb->result = CHECK_CONDITION << 1; + srb->result = CHECK_CONDITION; } return rc; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/usb/storage/jumpshot.c linux-2.5/drivers/usb/storage/jumpshot.c --- bk-linus/drivers/usb/storage/jumpshot.c 2002-11-21 02:19:19.000000000 +0000 +++ linux-2.5/drivers/usb/storage/jumpshot.c 2002-11-21 18:01:32.000000000 +0000 @@ -611,7 +611,7 @@ int jumpshot_transport(Scsi_Cmnd * srb, srb->result = SUCCESS; } else { info->sense_key = UNIT_ATTENTION; - srb->result = CHECK_CONDITION << 1; + srb->result = CHECK_CONDITION; } return rc; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/usb/storage/unusual_devs.h linux-2.5/drivers/usb/storage/unusual_devs.h --- bk-linus/drivers/usb/storage/unusual_devs.h 2002-11-21 02:19:20.000000000 +0000 +++ linux-2.5/drivers/usb/storage/unusual_devs.h 2002-11-21 18:01:33.000000000 +0000 @@ -128,6 +128,21 @@ UNUSUAL_DEV( 0x04ce, 0x0002, 0x0074, 0x US_SC_SCSI, US_PR_BULK, NULL, US_FL_FIX_INQUIRY ), +/* Reported by Leif Sawyer */ +UNUSUAL_DEV( 0x04ce, 0x0002, 0x0240, 0x0240, + "H45 ScanLogic", + "SL11R-IDE 9951SQFP-1.2 K004", + US_SC_SCSI, US_PR_BULK, NULL, + US_FL_FIX_INQUIRY | US_FL_SL_IDE_BUG ), + +/* Reported by Rene Engelhard and + Dylan Egan */ +UNUSUAL_DEV( 0x04ce, 0x0002, 0x0260, 0x0260, + "ScanLogic", + "SL11R-IDE unknown HW rev", + US_SC_SCSI, US_PR_BULK, NULL, + US_FL_SL_IDE_BUG ), + /* Most of the following entries were developed with the help of * Shuttle/SCM directly. */ @@ -220,6 +235,12 @@ UNUSUAL_DEV( 0x054c, 0x0010, 0x0106, 0x US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE ), +UNUSUAL_DEV( 0x54c, 0x0010, 0x0106, 0x0328, + "Sony", + "DSC-P5", + US_SC_SCSI, US_PR_CB, NULL, + US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE ), + /* Reported by wim@geeks.nl */ UNUSUAL_DEV( 0x054c, 0x0025, 0x0100, 0x0100, "Sony", diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/usb/storage/usb.h linux-2.5/drivers/usb/storage/usb.h --- bk-linus/drivers/usb/storage/usb.h 2002-11-21 02:19:21.000000000 +0000 +++ linux-2.5/drivers/usb/storage/usb.h 2002-11-21 18:01:33.000000000 +0000 @@ -103,6 +103,7 @@ struct us_unusual_dev { #define US_FL_SCM_MULT_TARG 0x00000020 /* supports multiple targets */ #define US_FL_FIX_INQUIRY 0x00000040 /* INQUIRY response needs fixing */ #define US_FL_FIX_CAPACITY 0x00000080 /* READ CAPACITY response too big */ +#define US_FL_SL_IDE_BUG 0x00000100 /* ScanLogic usb-ide workaround */ #define US_FL_DEV_ATTACHED 0x00010000 /* is the device attached? */ #define US_FLIDX_IP_WANTED 17 /* 0x00020000 is an IRQ expected? */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/video/tda7432.c linux-2.5/drivers/media/video/tda7432.c --- bk-linus/drivers/media/video/tda7432.c 2002-11-21 02:15:46.000000000 +0000 +++ linux-2.5/drivers/media/video/tda7432.c 2002-11-21 17:58:56.000000000 +0000 @@ -18,8 +18,12 @@ * * loudness - set between 0 and 15 for varying degrees of loudness effect * + * maxvol - set maximium volume to +20db (1), default is 0db(0) * * + * Revision: 0.7 - maxvol module parm to set maximium volume 0db or +20db + * store if muted so we can return it + * change balance only if flaged to * Revision: 0.6 - added tone controls * Revision: 0.5 - Fixed odd balance problem * Revision: 0.4 - added muting @@ -54,6 +58,9 @@ MODULE_LICENSE("GPL"); MODULE_PARM(debug,"i"); MODULE_PARM(loudness,"i"); +MODULE_PARM_DESC(maxvol,"Set maximium volume to +20db (0), default is 0db(1)"); +MODULE_PARM(maxvol,"i"); +static int maxvol = 0; static int loudness = 0; /* disable loudness by default */ static int debug = 0; /* insmod parameter */ @@ -81,12 +88,12 @@ struct tda7432 { int addr; int input; int volume; + int muted; int bass, treble; int lf, lr, rf, rr; int loud; struct i2c_client c; }; - static struct i2c_driver driver; static struct i2c_client client_template; @@ -291,9 +298,10 @@ static void do_tda7432_init(struct i2c_c t->input = TDA7432_STEREO_IN | /* Main (stereo) input */ TDA7432_BASS_SYM | /* Symmetric bass cut */ TDA7432_BASS_NORM; /* Normal bass range */ - t->volume = TDA7432_VOL_0DB; /* 0dB Volume */ + t->volume = 0x3b ; /* -27dB Volume */ if (loudness) /* Turn loudness on? */ t->volume |= TDA7432_LD_ON; + t->muted = VIDEO_AUDIO_MUTE; t->treble = TDA7432_TREBLE_0DB; /* 0dB Treble */ t->bass = TDA7432_BASS_0DB; /* 0dB Bass */ t->lf = TDA7432_ATTEN_0DB; /* 0dB attenuation */ @@ -374,17 +382,24 @@ static int tda7432_command(struct i2c_cl va->flags |= VIDEO_AUDIO_VOLUME | VIDEO_AUDIO_BASS | - VIDEO_AUDIO_TREBLE; + VIDEO_AUDIO_TREBLE | + VIDEO_AUDIO_MUTABLE; + if (t->muted) + va->flags |= VIDEO_AUDIO_MUTE; va->mode |= VIDEO_SOUND_STEREO; /* Master volume control * V4L volume is min 0, max 65535 * TDA7432 Volume: * Min (-79dB) is 0x6f - * Max (+20dB) is 0x07 + * Max (+20dB) is 0x07 (630) + * Max (0dB) is 0x20 (829) * (Mask out bit 7 of vol - it's for the loudness setting) */ - - va->volume = ( 0x6f - (t->volume & 0x7F) ) * 630; + if(!maxvol){ /* max +20db */ + va->volume = ( 0x6f - (t->volume & 0x7F) ) * 630; + } else { /* max 0db */ + va->volume = (int )(( 0x6f - (t->volume & 0x7F) ) * 829.557); + } /* Balance depends on L,R attenuation * V4L balance is 0 to 65535, middle is 32768 @@ -401,15 +416,15 @@ static int tda7432_command(struct i2c_cl /* left is attenuated, balance shifted right */ va->balance = (32768 + 1057*(t->lf)); - /* Bass/treble */ + /* Bass/treble 4 bits each */ va->bass=t->bass; if(va->bass >= 0x8) - va->bass = ~(va->bass - 0x8) & 0xf; - va->bass = va->bass << 12; + va->bass = ~(va->bass - 0x8) & 0xf; + va->bass = (va->bass << 12)+(va->bass << 8)+(va->bass << 4)+(va->bass); va->treble=t->treble; if(va->treble >= 0x8) - va->treble = ~(va->treble - 0x8) & 0xf; - va->treble = va->treble << 12; + va->treble = ~(va->treble - 0x8) & 0xf; + va->treble = (va->treble << 12)+(va->treble << 8)+(va->treble << 4)+(va->treble); break; /* VIDIOCGAUDIO case */ } @@ -420,26 +435,36 @@ static int tda7432_command(struct i2c_cl struct video_audio *va = arg; dprintk("tda7432: VIDEOCSAUDIO\n"); - t->volume = 0x6f - ( (va->volume)/630 ); + if(va->flags & VIDEO_AUDIO_VOLUME){ + + if(!maxvol){ /* max +20db */ + t->volume = 0x6f - ( (va->volume)/630 ); + } else { /* max 0db */ + t->volume = 0x6f - ((int) (va->volume)/829.557 ); + } if (loudness) /* Turn on the loudness bit */ t->volume |= TDA7432_LD_ON; + tda7432_write(client,TDA7432_VL, t->volume); + } + if(va->flags & VIDEO_AUDIO_BASS) { t->bass = va->bass >> 12; if(t->bass>= 0x8) t->bass = (~t->bass & 0xf) + 0x8 ; - t->bass = t->bass | 0x10; } if(va->flags & VIDEO_AUDIO_TREBLE) { t->treble= va->treble >> 12; if(t->treble>= 0x8) t->treble = (~t->treble & 0xf) + 0x8 ; - } + if(va->flags & (VIDEO_AUDIO_TREBLE| VIDEO_AUDIO_BASS)) + tda7432_write(client,TDA7432_TN, 0x10 | (t->bass << 4) | t->treble ); + if(va->flags & VIDEO_AUDIO_BALANCE) { if (va->balance < 32768) { /* shifted to left, attenuate right */ @@ -464,20 +489,17 @@ static int tda7432_command(struct i2c_cl t->lf = TDA7432_ATTEN_0DB; t->lr = TDA7432_ATTEN_0DB; } + } - tda7432_write(client,TDA7432_TN, (t->bass << 4)| t->treble ); - tda7432_write(client,TDA7432_VL, t->volume); - - if (va->flags & VIDEO_AUDIO_MUTE) + t->muted=(va->flags & VIDEO_AUDIO_MUTE); + if (t->muted) { /* Mute & update balance*/ tda7432_write(client,TDA7432_LF, t->lf | TDA7432_MUTE); tda7432_write(client,TDA7432_LR, t->lr | TDA7432_MUTE); tda7432_write(client,TDA7432_RF, t->rf | TDA7432_MUTE); tda7432_write(client,TDA7432_RR, t->rr | TDA7432_MUTE); - } - else - { + } else { tda7432_write(client,TDA7432_LF, t->lf); tda7432_write(client,TDA7432_LR, t->lr); tda7432_write(client,TDA7432_RF, t->rf); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/kernel/traps.c linux-2.5/arch/i386/kernel/traps.c --- bk-linus/arch/i386/kernel/traps.c 2002-11-21 02:09:31.000000000 +0000 +++ linux-2.5/arch/i386/kernel/traps.c 2002-11-21 17:55:03.000000000 +0000 @@ -320,8 +320,12 @@ static inline unsigned long get_cr2(void static void inline do_trap(int trapnr, int signr, char *str, int vm86, struct pt_regs * regs, long error_code, siginfo_t *info) { - if (vm86 && regs->eflags & VM_MASK) - goto vm86_trap; + if (regs->eflags & VM_MASK) { + if (vm86) + goto vm86_trap; + else + goto trap_signal; + } if (!(regs->xcs & 3)) goto kernel_trap; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/ftape/zftape/zftape-init.c linux-2.5/drivers/char/ftape/zftape/zftape-init.c --- bk-linus/drivers/char/ftape/zftape/zftape-init.c 2002-11-21 02:14:12.000000000 +0000 +++ linux-2.5/drivers/char/ftape/zftape/zftape-init.c 2002-11-21 17:57:57.000000000 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include #include #ifdef CONFIG_KMOD #include @@ -203,6 +204,7 @@ static int zft_mmap(struct file *filep, static struct vm_operations_struct dummy = { NULL, }; vma->vm_ops = &dummy; #endif + vma->vm_flags &= ~VM_IO; } current->blocked = old_sigmask; /* restore mask */ TRACE_EXIT result; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/mem.c linux-2.5/drivers/char/mem.c --- bk-linus/drivers/char/mem.c 2002-11-21 02:13:55.000000000 +0000 +++ linux-2.5/drivers/char/mem.c 2002-11-21 17:57:41.000000000 +0000 @@ -199,10 +199,10 @@ static int mmap_mem(struct file * file, vma->vm_flags |= VM_RESERVED; /* - * Don't dump addresses that are not real memory to a core file. + * Dump addresses that are real memory to a core file. */ - if (offset >= __pa(high_memory) || (file->f_flags & O_SYNC)) - vma->vm_flags |= VM_IO; + if (offset < __pa(high_memory) && !(file->f_flags & O_SYNC)) + vma->vm_flags &= ~VM_IO; if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start, vma->vm_page_prot)) @@ -474,6 +474,7 @@ static int mmap_zero(struct file * file, return shmem_zero_setup(vma); if (zeromap_page_range(vma, vma->vm_start, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; + vma->vm_flags &= ~VM_IO; return 0; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/usb/class/audio.c linux-2.5/drivers/usb/class/audio.c --- bk-linus/drivers/usb/class/audio.c 2002-11-21 02:18:53.000000000 +0000 +++ linux-2.5/drivers/usb/class/audio.c 2002-11-21 18:01:13.000000000 +0000 @@ -2349,6 +2349,7 @@ static int usb_audio_mmap(struct file *f if (vma->vm_pgoff != 0) goto out; + vma->vm_flags &= ~VM_IO; ret = dmabuf_mmap(vma, db, vma->vm_start, vma->vm_end - vma->vm_start, vma->vm_page_prot); out: unlock_kernel(); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/ncpfs/mmap.c linux-2.5/fs/ncpfs/mmap.c --- bk-linus/fs/ncpfs/mmap.c 2002-11-21 02:20:30.000000000 +0000 +++ linux-2.5/fs/ncpfs/mmap.c 2002-11-21 18:02:24.000000000 +0000 @@ -119,5 +119,6 @@ int ncp_mmap(struct file *file, struct v } vma->vm_ops = &ncp_file_mmap; + vma->vm_flags &= ~VM_IO; return 0; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/ipc/shm.c linux-2.5/ipc/shm.c --- bk-linus/ipc/shm.c 2002-11-21 02:24:36.000000000 +0000 +++ linux-2.5/ipc/shm.c 2002-11-21 18:05:15.000000000 +0000 @@ -151,6 +151,7 @@ static int shm_mmap(struct file * file, { UPDATE_ATIME(file->f_dentry->d_inode); vma->vm_ops = &shm_vm_ops; + vma->vm_flags &= ~VM_IO; shm_inc(file->f_dentry->d_inode->i_ino); return 0; } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/mm/filemap.c linux-2.5/mm/filemap.c --- bk-linus/mm/filemap.c 2002-11-21 02:24:41.000000000 +0000 +++ linux-2.5/mm/filemap.c 2002-11-21 18:05:21.000000000 +0000 @@ -1320,6 +1320,7 @@ int generic_file_mmap(struct file * file return -ENOEXEC; UPDATE_ATIME(inode); vma->vm_ops = &generic_file_vm_ops; + vma->vm_flags &= ~VM_IO; return 0; } #else diff -urpN --exclude-from=/home/davej/.exclude bk-linus/mm/mmap.c linux-2.5/mm/mmap.c --- bk-linus/mm/mmap.c 2002-11-21 02:24:42.000000000 +0000 +++ linux-2.5/mm/mmap.c 2002-11-21 18:05:21.000000000 +0000 @@ -574,6 +575,11 @@ munmap_back: } vma->vm_file = file; get_file(file); + /* + * Subdrivers can clear VM_IO if their mappings are + * valid pages inside mem_map[] + */ + vma->vm_flags |= VM_IO; error = file->f_op->mmap(file, vma); if (error) goto unmap_and_free_vma; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/net/socket.c linux-2.5/net/socket.c --- bk-linus/net/socket.c 2002-11-21 02:24:44.000000000 +0000 +++ linux-2.5/net/socket.c 2002-11-21 18:05:23.000000000 +0000 @@ -832,6 +832,7 @@ static int sock_mmap(struct file * file, { struct socket *sock = SOCKET_I(file->f_dentry->d_inode); + vma->vm_flags &= ~VM_IO; return sock->ops->mmap(file, sock, vma); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/cmpci.c linux-2.5/sound/oss/cmpci.c --- bk-linus/sound/oss/cmpci.c 2002-11-21 02:26:03.000000000 +0000 +++ linux-2.5/sound/oss/cmpci.c 2002-11-21 18:06:16.000000000 +0000 @@ -1756,6 +1756,7 @@ static int cm_mmap(struct file *file, st ret = -EINVAL; if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot)) goto out; + vma->vm_flags &= ~VM_IO; db->mapped = 1; ret = 0; out: diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/cs46xx.c linux-2.5/sound/oss/cs46xx.c --- bk-linus/sound/oss/cs46xx.c 2002-11-21 02:26:04.000000000 +0000 +++ linux-2.5/sound/oss/cs46xx.c 2002-11-21 18:06:16.000000000 +0000 @@ -2474,6 +2474,7 @@ static int cs_mmap(struct file *file, st ret = -EAGAIN; goto out; } + vma->vm_flags &= ~VM_IO; dmabuf->mapped = 1; CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_mmap()-\n") ); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/es1370.c linux-2.5/sound/oss/es1370.c --- bk-linus/sound/oss/es1370.c 2002-11-21 02:26:04.000000000 +0000 +++ linux-2.5/sound/oss/es1370.c 2002-11-21 18:06:17.000000000 +0000 @@ -1371,6 +1371,7 @@ static int es1370_mmap(struct file *file ret = -EAGAIN; goto out; } + vma->vm_flags &= ~VM_IO; db->mapped = 1; out: up(&s->sem); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/es1371.c linux-2.5/sound/oss/es1371.c --- bk-linus/sound/oss/es1371.c 2002-11-21 02:26:04.000000000 +0000 +++ linux-2.5/sound/oss/es1371.c 2002-11-21 18:06:18.000000000 +0000 @@ -1562,6 +1562,7 @@ static int es1371_mmap(struct file *file ret = -EAGAIN; goto out; } + vma->vm_flags &= ~VM_IO; db->mapped = 1; out: up(&s->sem); @@ -2132,6 +2134,7 @@ static int es1371_mmap_dac(struct file * ret = -EAGAIN; if (remap_page_range(vma, vma->vm_start, virt_to_phys(s->dma_dac1.rawbuf), size, vma->vm_page_prot)) goto out; + vma->vm_flags &= ~VM_IO; s->dma_dac1.mapped = 1; ret = 0; out: diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/esssolo1.c linux-2.5/sound/oss/esssolo1.c --- bk-linus/sound/oss/esssolo1.c 2002-11-21 02:26:04.000000000 +0000 +++ linux-2.5/sound/oss/esssolo1.c 2002-11-21 18:06:18.000000000 +0000 @@ -1248,6 +1248,7 @@ static int solo1_mmap(struct file *file, ret = -EAGAIN; if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot)) goto out; + vma->vm_flags &= ~VM_IO; db->mapped = 1; ret = 0; out: diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/i810_audio.c linux-2.5/sound/oss/i810_audio.c --- bk-linus/sound/oss/i810_audio.c 2002-11-21 02:26:05.000000000 +0000 +++ linux-2.5/sound/oss/i810_audio.c 2002-11-21 18:06:19.000000000 +0000 @@ -1675,6 +1693,7 @@ static int i810_mmap(struct file *file, if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf), size, vma->vm_page_prot)) goto out; + vma->vm_flags &= ~VM_IO; dmabuf->mapped = 1; dmabuf->trigger = 0; ret = 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/ite8172.c linux-2.5/sound/oss/ite8172.c --- bk-linus/sound/oss/ite8172.c 2002-11-21 02:26:06.000000000 +0000 +++ linux-2.5/sound/oss/ite8172.c 2002-11-21 18:06:19.000000000 +0000 @@ -1105,6 +1105,7 @@ static int it8172_mmap(struct file *file unlock_kernel(); return -EAGAIN; } + vma->vm_flags &= ~VM_IO; db->mapped = 1; unlock_kernel(); return 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/maestro.c linux-2.5/sound/oss/maestro.c --- bk-linus/sound/oss/maestro.c 2002-11-21 02:26:06.000000000 +0000 +++ linux-2.5/sound/oss/maestro.c 2002-11-21 18:06:19.000000000 +0000 @@ -2516,6 +2516,7 @@ static int ess_mmap(struct file *file, s ret = -EAGAIN; if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot)) goto out; + vma->vm_flags &= ~VM_IO; db->mapped = 1; ret = 0; out: diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/maestro3.c linux-2.5/sound/oss/maestro3.c --- bk-linus/sound/oss/maestro3.c 2002-11-21 02:26:06.000000000 +0000 +++ linux-2.5/sound/oss/maestro3.c 2002-11-21 18:06:20.000000000 +0000 @@ -1566,6 +1566,7 @@ static int m3_mmap(struct file *file, st ret = -EAGAIN; if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot)) goto out; + vma->vm_flags &= ~VM_IO; db->mapped = 1; ret = 0; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/sonicvibes.c linux-2.5/sound/oss/sonicvibes.c --- bk-linus/sound/oss/sonicvibes.c 2002-11-21 02:26:10.000000000 +0000 +++ linux-2.5/sound/oss/sonicvibes.c 2002-11-21 18:06:24.000000000 +0000 @@ -1552,6 +1552,7 @@ static int sv_mmap(struct file *file, st ret = -EAGAIN; if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot)) goto out; + vma->vm_flags &= ~VM_IO; db->mapped = 1; ret = 0; out: diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/soundcard.c linux-2.5/sound/oss/soundcard.c --- bk-linus/sound/oss/soundcard.c 2002-11-21 02:26:10.000000000 +0000 +++ linux-2.5/sound/oss/soundcard.c 2002-11-21 18:06:24.000000000 +0000 @@ -480,6 +480,7 @@ static int sound_mmap(struct file *file, return -EAGAIN; } + vma->vm_flags &= ~VM_IO; dmap->mapping_flags |= DMA_MAP_MAPPED; if( audio_devs[dev]->d->mmap) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/trident.c linux-2.5/sound/oss/trident.c --- bk-linus/sound/oss/trident.c 2002-11-21 02:26:11.000000000 +0000 +++ linux-2.5/sound/oss/trident.c 2002-11-21 18:06:24.000000000 +0000 @@ -2115,6 +2115,7 @@ static int trident_mmap(struct file *fil if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf), size, vma->vm_page_prot)) goto out; + vma->vm_flags &= ~VM_IO; dmabuf->mapped = 1; ret = 0; out: diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/ymfpci.c linux-2.5/sound/oss/ymfpci.c --- bk-linus/sound/oss/ymfpci.c 2002-11-21 02:26:12.000000000 +0000 +++ linux-2.5/sound/oss/ymfpci.c 2002-11-21 18:06:26.000000000 +0000 @@ -1537,6 +1537,7 @@ static int ymf_mmap(struct file *file, s if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf), size, vma->vm_page_prot)) return -EAGAIN; + vma->vm_flags &= ~VM_IO; dmabuf->mapped = 1; /* P3 */ printk(KERN_INFO "ymfpci: using memory mapped sound, untested!\n"); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/block/cciss.c linux-2.5/drivers/block/cciss.c --- bk-linus/drivers/block/cciss.c 2002-11-21 02:13:37.000000000 +0000 +++ linux-2.5/drivers/block/cciss.c 2002-11-21 17:57:29.000000000 +0000 @@ -353,7 +353,7 @@ static int cciss_open(struct inode *inod * but I'm already using way to many device nodes to claim another one * for "raw controller". */ - if (inode->i_bdev->bd_inode->i_size == 0) { + if (hba[ctlr]->drv[dsk].nr_blocks == 0) { if (minor(inode->i_rdev) != 0) return -ENXIO; if (!capable(CAP_SYS_ADMIN)) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-i386/io_apic.h linux-2.5/include/asm-i386/io_apic.h --- bk-linus/include/asm-i386/io_apic.h 2002-11-21 02:21:50.000000000 +0000 +++ linux-2.5/include/asm-i386/io_apic.h 2002-11-21 18:03:23.000000000 +0000 @@ -16,7 +16,8 @@ #define APIC_MISMATCH_DEBUG #define IO_APIC_BASE(idx) \ - ((volatile int *)__fix_to_virt(FIX_IO_APIC_BASE_0 + idx)) + ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \ + + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK))) /* * The structure of the IO-APIC: diff -urpN --exclude-from=/home/davej/.exclude bk-linus/ipc/sem.c linux-2.5/ipc/sem.c --- bk-linus/ipc/sem.c 2002-11-21 02:24:36.000000000 +0000 +++ linux-2.5/ipc/sem.c 2002-11-21 18:05:15.000000000 +0000 @@ -263,39 +263,39 @@ static int try_atomic_semop (struct sem_ for (sop = sops; sop < sops + nsops; sop++) { curr = sma->sem_base + sop->sem_num; sem_op = sop->sem_op; - - if (!sem_op && curr->semval) + result = curr->semval; + + if (!sem_op && result) goto would_block; - curr->sempid = (curr->sempid << 16) | pid; - curr->semval += sem_op; - if (sop->sem_flg & SEM_UNDO) - { + result += sem_op; + if (result < 0) + goto would_block; + if (result > SEMVMX) + goto out_of_range; + if (sop->sem_flg & SEM_UNDO) { int undo = un->semadj[sop->sem_num] - sem_op; /* * Exceeding the undo range is an error. */ if (undo < (-SEMAEM - 1) || undo > SEMAEM) - { - /* Don't undo the undo */ - sop->sem_flg &= ~SEM_UNDO; goto out_of_range; - } - un->semadj[sop->sem_num] = undo; } - if (curr->semval < 0) - goto would_block; - if (curr->semval > SEMVMX) - goto out_of_range; + curr->semval = result; } - if (do_undo) - { - sop--; + if (do_undo) { result = 0; goto undo; } - + sop--; + while (sop >= sops) { + sma->sem_base[sop->sem_num].sempid = pid; + if (sop->sem_flg & SEM_UNDO) + un->semadj[sop->sem_num] -= sop->sem_op; + sop--; + } + sma->sem_otime = get_seconds(); return 0; @@ -310,13 +310,9 @@ would_block: result = 1; undo: + sop--; while (sop >= sops) { - curr = sma->sem_base + sop->sem_num; - curr->semval -= sop->sem_op; - curr->sempid >>= 16; - - if (sop->sem_flg & SEM_UNDO) - un->semadj[sop->sem_num] += sop->sem_op; + sma->sem_base[sop->sem_num].semval -= sop->sem_op; sop--; } @@ -637,7 +633,7 @@ static int semctl_main(int semid, int se err = curr->semval; goto out_unlock; case GETPID: - err = curr->sempid & 0xffff; + err = curr->sempid; goto out_unlock; case GETNCNT: err = count_semncnt(sma,semnum); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/jbd/checkpoint.c linux-2.5/fs/jbd/checkpoint.c --- bk-linus/fs/jbd/checkpoint.c 2002-11-21 02:20:15.000000000 +0000 +++ linux-2.5/fs/jbd/checkpoint.c 2002-11-21 18:02:15.000000000 +0000 @@ -443,11 +443,8 @@ int __journal_clean_checkpoint_list(jour struct journal_head *last_jh = jh->b_cpprev; struct journal_head *next_jh = jh; do { - struct buffer_head *bh; - jh = next_jh; next_jh = jh->b_cpnext; - bh = jh2bh(jh); ret += __try_to_free_cp_buf(jh); } while (jh != last_jh); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/jbd/commit.c linux-2.5/fs/jbd/commit.c --- bk-linus/fs/jbd/commit.c 2002-11-21 02:20:15.000000000 +0000 +++ linux-2.5/fs/jbd/commit.c 2002-11-21 18:02:15.000000000 +0000 @@ -25,7 +25,7 @@ extern spinlock_t journal_datalist_lock; /* * Default IO end handler for temporary BJ_IO buffer_heads. */ -static void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate) +void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate) { BUFFER_TRACE(bh, ""); if (uptodate) @@ -406,6 +406,7 @@ sync_datalist_empty: flags = journal_write_metadata_buffer(commit_transaction, jh, &new_jh, blocknr); set_bit(BH_JWrite, &jh2bh(new_jh)->b_state); + set_bit(BH_Lock, &jh2bh(new_jh)->b_state); wbuf[bufs++] = jh2bh(new_jh); /* Record the new block's tag in the current descriptor @@ -557,8 +558,7 @@ start_journal_io: journal_unfile_buffer(jh); jh->b_transaction = NULL; journal_unlock_journal_head(jh); - __brelse(bh); /* One for getblk */ - /* AKPM: bforget here */ + put_bh(bh); /* One for getblk */ } jbd_debug(3, "JBD: commit phase 6\n"); @@ -594,9 +594,10 @@ start_journal_io: { struct buffer_head *bh = jh2bh(descriptor); set_buffer_uptodate(bh); - ll_rw_block(WRITE, 1, &bh); + bh->b_end_io = journal_end_buffer_io_sync; + submit_bh(WRITE, bh); wait_on_buffer(bh); - __brelse(bh); /* One for getblk() */ + put_bh(bh); /* One for getblk() */ journal_unlock_journal_head(descriptor); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/jbd/journal.c linux-2.5/fs/jbd/journal.c --- bk-linus/fs/jbd/journal.c 2002-11-21 02:20:15.000000000 +0000 +++ linux-2.5/fs/jbd/journal.c 2002-11-21 18:02:16.000000000 +0000 @@ -661,6 +661,8 @@ int journal_bmap(journal_t *journal, uns * We play buffer_head aliasing tricks to write data/metadata blocks to * the journal without copying their contents, but for journal * descriptor blocks we do need to generate bona fide buffers. + * + * We return a jh whose bh is locked and ready to be populated. */ struct journal_head * journal_get_descriptor_buffer(journal_t *journal) @@ -675,7 +677,7 @@ struct journal_head * journal_get_descri return NULL; bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); - bh->b_state |= (1 << BH_Dirty); + lock_buffer(bh); BUFFER_TRACE(bh, "return this buffer"); return journal_add_journal_head(bh); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/jbd/revoke.c linux-2.5/fs/jbd/revoke.c --- bk-linus/fs/jbd/revoke.c 2002-11-21 02:20:16.000000000 +0000 +++ linux-2.5/fs/jbd/revoke.c 2002-11-21 18:02:16.000000000 +0000 @@ -530,6 +530,7 @@ static void flush_descriptor(journal_t * if (is_journal_aborted(journal)) { JBUFFER_TRACE(descriptor, "brelse"); + unlock_buffer(jh2bh(descriptor)); __brelse(jh2bh(descriptor)); return; } @@ -541,7 +542,8 @@ static void flush_descriptor(journal_t * struct buffer_head *bh = jh2bh(descriptor); BUFFER_TRACE(bh, "write"); set_buffer_uptodate(bh); - ll_rw_block (WRITE, 1, &bh); + bh->b_end_io = journal_end_buffer_io_sync; + submit_bh(WRITE, bh); } } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/jbd/transaction.c linux-2.5/fs/jbd/transaction.c --- bk-linus/fs/jbd/transaction.c 2002-11-21 02:20:16.000000000 +0000 +++ linux-2.5/fs/jbd/transaction.c 2002-11-21 18:02:16.000000000 +0000 @@ -105,6 +105,8 @@ repeat: lock_journal(journal); +repeat_locked: + if (is_journal_aborted(journal) || (journal->j_errno != 0 && !(journal->j_flags & JFS_ACK_ERR))) { unlock_journal(journal); @@ -118,7 +120,6 @@ repeat: goto repeat; } -repeat_locked: if (!journal->j_running_transaction) get_transaction(journal, 0); /* @@@ Error? */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/jbd.h linux-2.5/include/linux/jbd.h --- bk-linus/include/linux/jbd.h 2002-11-21 02:23:56.000000000 +0000 +++ linux-2.5/include/linux/jbd.h 2002-11-21 18:04:46.000000000 +0000 @@ -585,6 +585,7 @@ extern struct journal_head * journal_get int journal_next_log_block(journal_t *, unsigned long *); /* Commit management */ +void journal_end_buffer_io_sync(struct buffer_head *bh, int uptodate); extern void journal_commit_transaction(journal_t *); /* Checkpoint list management */ @@ -822,8 +823,6 @@ extern int journal_blocks_per_page(struc #define BJ_Reserved 8 /* Buffer is reserved for access by journal */ #define BJ_Types 9 -extern int jbd_blocks_per_page(struct inode *inode); - #ifdef __KERNEL__ extern spinlock_t jh_splice_lock; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/net/rose/rose_link.c linux-2.5/net/rose/rose_link.c --- bk-linus/net/rose/rose_link.c 2002-11-21 02:25:21.000000000 +0000 +++ linux-2.5/net/rose/rose_link.c 2002-11-21 18:05:48.000000000 +0000 @@ -255,15 +255,21 @@ void rose_transmit_clear_request(struct struct sk_buff *skb; unsigned char *dptr; int len; + struct net_device *first; + int faclen = 0; len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN + 3; - if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL) + first = rose_dev_first(); + if (first) + faclen = 6 + AX25_ADDR_LEN + 3 + ROSE_ADDR_LEN; + + if ((skb = alloc_skb(len + faclen, GFP_ATOMIC)) == NULL) return; skb_reserve(skb, AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN); - dptr = skb_put(skb, ROSE_MIN_LEN + 3); + dptr = skb_put(skb, ROSE_MIN_LEN + 3 + faclen); *dptr++ = AX25_P_ROSE; *dptr++ = ((lci >> 8) & 0x0F) | ROSE_GFI; @@ -272,6 +278,21 @@ void rose_transmit_clear_request(struct *dptr++ = cause; *dptr++ = diagnostic; + if (first) { + *dptr++ = 0x00; /* Address length */ + *dptr++ = 4 + AX25_ADDR_LEN + 3 + ROSE_ADDR_LEN; /* Facilities length */ + *dptr++ = 0; + *dptr++ = FAC_NATIONAL; + *dptr++ = FAC_NATIONAL_FAIL_CALL; + *dptr++ = AX25_ADDR_LEN; + memcpy(dptr, &rose_callsign, AX25_ADDR_LEN); + dptr += AX25_ADDR_LEN; + *dptr++ = FAC_NATIONAL_FAIL_ADD; + *dptr++ = ROSE_ADDR_LEN + 1; + *dptr++ = ROSE_ADDR_LEN * 2; + memcpy(dptr, first->dev_addr, ROSE_ADDR_LEN); + } + if (!rose_send_frame(skb, neigh)) kfree_skb(skb); } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/aha152x.c linux-2.5/drivers/scsi/aha152x.c --- bk-linus/drivers/scsi/aha152x.c 2002-11-21 02:17:51.000000000 +0000 +++ linux-2.5/drivers/scsi/aha152x.c 2002-11-21 18:00:32.000000000 +0000 @@ -2650,7 +2650,7 @@ static void datai_run(struct Scsi_Host * * STCNT to trigger ENSWRAP interrupt, instead of * polling for DFIFOFULL */ - the_time=jiffies + 10*HZ; + the_time=jiffies + 100*HZ; while(TESTLO(DMASTAT, DFIFOFULL|INTSTAT) && time_before(jiffies,the_time)) barrier(); @@ -2663,7 +2663,7 @@ static void datai_run(struct Scsi_Host * if(TESTHI(DMASTAT, DFIFOFULL)) { fifodata = 128; } else { - the_time=jiffies + 10*HZ; + the_time=jiffies + 100*HZ; while(TESTLO(SSTAT2, SEMPTY) && time_before(jiffies,the_time)) barrier(); @@ -2819,7 +2819,7 @@ static void datao_run(struct Scsi_Host * CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length; } - the_time=jiffies + 10*HZ; + the_time=jiffies + 100*HZ; while(TESTLO(DMASTAT, DFIFOEMP|INTSTAT) && time_before(jiffies,the_time)) barrier(); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/dec_esp.c linux-2.5/drivers/scsi/dec_esp.c --- bk-linus/drivers/scsi/dec_esp.c 2002-11-21 02:17:55.000000000 +0000 +++ linux-2.5/drivers/scsi/dec_esp.c 2002-11-21 18:00:37.000000000 +0000 @@ -46,6 +46,8 @@ #include #include +#include + /* * Once upon a time the pmaz code used to be working but * it hasn't been maintained for quite some time. @@ -101,6 +103,8 @@ volatile unsigned long *ioasic_ssr; volatile unsigned long *scsi_sdr0; volatile unsigned long *scsi_sdr1; +static void scsi_dma_merr_int(int, void *, struct pt_regs *); +static void scsi_dma_err_int(int, void *, struct pt_regs *); static void scsi_dma_int(int, void *, struct pt_regs *); static Scsi_Host_Template driver_template = SCSI_DEC_ESP; @@ -179,7 +183,7 @@ int dec_esp_detect(Scsi_Host_Template * /* get virtual dma address for command buffer */ esp->esp_command_dvma = (__u32) KSEG1ADDR((volatile unsigned char *) cmd_buffer); - esp->irq = SCSI_INT; + esp->irq = dec_interrupt[DEC_IRQ_ASC]; esp->scsi_id = 7; @@ -189,11 +193,20 @@ int dec_esp_detect(Scsi_Host_Template * esp_initialize(esp); if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, - "NCR 53C94 SCSI", esp->ehost)) + "ncr53c94", esp->ehost)) goto err_dealloc; - if (request_irq(SCSI_DMA_INT, scsi_dma_int, SA_INTERRUPT, - "JUNKIO SCSI DMA", esp->ehost)) + if (request_irq(dec_interrupt[DEC_IRQ_ASC_MERR], + scsi_dma_merr_int, SA_INTERRUPT, + "ncr53c94 error", NULL)) goto err_free_irq; + if (request_irq(dec_interrupt[DEC_IRQ_ASC_ERR], + scsi_dma_err_int, SA_INTERRUPT, + "ncr53c94 overrun", NULL)) + goto err_free_irq_merr; + if (request_irq(dec_interrupt[DEC_IRQ_ASC_DMA], + scsi_dma_int, SA_INTERRUPT, + "ncr53c94 dma", NULL)) + goto err_free_irq_err; } @@ -271,41 +284,35 @@ int dec_esp_detect(Scsi_Host_Template * } return 0; - err_free_irq: +err_free_irq_err: + free_irq(dec_interrupt[DEC_IRQ_ASC_ERR], scsi_dma_err_int); +err_free_irq_merr: + free_irq(dec_interrupt[DEC_IRQ_ASC_MERR], scsi_dma_merr_int); +err_free_irq: free_irq(esp->irq, esp_intr); - err_dealloc: +err_dealloc: esp_deallocate(esp); return 0; } /************************************************************* DMA Functions */ -static void scsi_dma_int(int irq, void *dev_id, struct pt_regs *regs) +static void scsi_dma_merr_int(int irq, void *dev_id, struct pt_regs *regs) { - extern volatile unsigned int *isr; - unsigned int dummy; + printk("Got unexpected SCSI DMA Interrupt! < "); + printk("SCSI_DMA_MEMRDERR "); + printk(">\n"); +} - if (*isr & SCSI_PTR_LOADED) { - /* next page */ - *scsi_next_ptr = ((*scsi_dma_ptr + PAGE_SIZE) & PAGE_MASK) << 3; - *isr &= ~SCSI_PTR_LOADED; - } else { - if (*isr & SCSI_PAGOVRRUN) - *isr &= ~SCSI_PAGOVRRUN; - if (*isr & SCSI_DMA_MEMRDERR) { - printk("Got unexpected SCSI DMA Interrupt! < "); - printk("SCSI_DMA_MEMRDERR "); - printk(">\n"); - *isr &= ~SCSI_DMA_MEMRDERR; - } - } +static void scsi_dma_err_int(int irq, void *dev_id, struct pt_regs *regs) +{ + /* empty */ +} - /* - * This routine will only work on IOASIC machines - * so we can avoid an indirect function call here - * and flush the writeback buffer the fast way - */ - dummy = *isr; - dummy = *isr; +static void scsi_dma_int(int irq, void *dev_id, struct pt_regs *regs) +{ + /* next page */ + *scsi_next_ptr = ((*scsi_dma_ptr + PAGE_SIZE) & PAGE_MASK) << 3; + fast_iob(); } static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count) @@ -357,9 +364,6 @@ static void dma_dump_state(struct NCR_ES static void dma_init_read(struct NCR_ESP *esp, __u32 vaddress, int length) { - extern volatile unsigned int *isr; - unsigned int dummy; - if (vaddress & 3) panic("dec_efs.c: unable to handle partial word transfers, yet..."); @@ -372,19 +376,11 @@ static void dma_init_read(struct NCR_ESP /* prepare for next page */ *scsi_next_ptr = ((vaddress + PAGE_SIZE) & PAGE_MASK) << 3; *ioasic_ssr |= (SCSI_DMA_DIR | SCSI_DMA_EN); - - /* - * see above - */ - dummy = *isr; - dummy = *isr; + fast_iob(); } static void dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length) { - extern volatile unsigned int *isr; - unsigned int dummy; - if (vaddress & 3) panic("dec_efs.c: unable to handle partial word transfers, yet..."); @@ -397,22 +393,17 @@ static void dma_init_write(struct NCR_ES /* prepare for next page */ *scsi_next_ptr = ((vaddress + PAGE_SIZE) & PAGE_MASK) << 3; *ioasic_ssr |= SCSI_DMA_EN; - - /* - * see above - */ - dummy = *isr; - dummy = *isr; + fast_iob(); } static void dma_ints_off(struct NCR_ESP *esp) { - disable_irq(SCSI_DMA_INT); + disable_irq(dec_interrupt[DEC_IRQ_ASC_DMA]); } static void dma_ints_on(struct NCR_ESP *esp) { - enable_irq(SCSI_DMA_INT); + enable_irq(dec_interrupt[DEC_IRQ_ASC_DMA]); } static int dma_irq_p(struct NCR_ESP *esp) @@ -459,12 +450,12 @@ static void dma_mmu_get_scsi_sgl(struct sg[sz].dvma_addr = PHYSADDR(sg[sz].addr); sz--; } - sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dvma_address); + sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dma_address); } static void dma_advance_sg(Scsi_Cmnd * sp) { - sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dvma_address); + sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dma_address); } static void pmaz_dma_drain(struct NCR_ESP *esp) @@ -483,6 +474,8 @@ static void pmaz_dma_init_read(struct NC *dmareg = TC_ESP_DMA_ADDR(esp->slot + DEC_SCSI_SRAM + ESP_TGT_DMA_SIZE); + iob(); + esp_virt_buffer = vaddress; scsi_current_length = length; } @@ -497,6 +490,7 @@ static void pmaz_dma_init_write(struct N *dmareg = TC_ESP_DMAR_WRITE | TC_ESP_DMA_ADDR(esp->slot + DEC_SCSI_SRAM + ESP_TGT_DMA_SIZE); + iob(); } static void pmaz_dma_ints_off(struct NCR_ESP *esp) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/dpt_i2o.c linux-2.5/drivers/scsi/dpt_i2o.c --- bk-linus/drivers/scsi/dpt_i2o.c 2002-11-21 02:17:55.000000000 +0000 +++ linux-2.5/drivers/scsi/dpt_i2o.c 2002-11-21 18:00:37.000000000 +0000 @@ -86,7 +86,7 @@ static dpt_sig_S DPTI_sig = { #elif defined(__alpha__) PROC_ALPHA , #else - (-1), + (-1),(-1) #endif FT_HBADRVR, 0, OEM_DPT, OS_LINUX, CAP_OVERLAP, DEV_ALL, ADF_ALL_SC5, 0, 0, DPT_VERSION, DPT_REVISION, DPT_SUBREVISION, @@ -1135,7 +1135,8 @@ static int adpt_i2o_post_wait(adpt_hba* // to support async LCT get wait_data->next = adpt_post_wait_queue; adpt_post_wait_queue = wait_data; - adpt_post_wait_id = (++adpt_post_wait_id & 0x7fff); + adpt_post_wait_id++; + adpt_post_wait_id &= 0x7fff; wait_data->id = adpt_post_wait_id; spin_unlock_irqrestore(&adpt_post_wait_lock, flags); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/fdomain.c linux-2.5/drivers/scsi/fdomain.c --- bk-linus/drivers/scsi/fdomain.c 2002-11-21 02:17:59.000000000 +0000 +++ linux-2.5/drivers/scsi/fdomain.c 2002-11-21 18:00:39.000000000 +0000 @@ -725,13 +725,13 @@ static int fdomain_isa_detect( int *irq, switch (Quantum) { case 2: /* ISA_200S */ case 3: /* ISA_250MG */ - base = readb(bios_base + 0x1fa2) + (readb(bios_base + 0x1fa3) << 8); + base = isa_readb(bios_base + 0x1fa2) + (isa_readb(bios_base + 0x1fa3) << 8); break; case 4: /* ISA_200S (another one) */ - base = readb(bios_base + 0x1fa3) + (readb(bios_base + 0x1fa4) << 8); + base = isa_readb(bios_base + 0x1fa3) + (isa_readb(bios_base + 0x1fa4) << 8); break; default: - base = readb(bios_base + 0x1fcc) + (readb(bios_base + 0x1fcd) << 8); + base = isa_readb(bios_base + 0x1fcc) + (isa_readb(bios_base + 0x1fcd) << 8); break; } @@ -1777,7 +1777,7 @@ static int fdomain_16x0_biosparam(struct offset = bios_base + 0x1f31 + drive * 25; break; } - memcpy_fromio( &i, offset, sizeof( struct drive_info ) ); + isa_memcpy_fromio( &i, offset, sizeof( struct drive_info ) ); info_array[0] = i.heads; info_array[1] = i.sectors; info_array[2] = i.cylinders; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/imm.c linux-2.5/drivers/scsi/imm.c --- bk-linus/drivers/scsi/imm.c 2002-11-21 02:18:04.000000000 +0000 +++ linux-2.5/drivers/scsi/imm.c 2002-11-21 18:00:42.000000000 +0000 @@ -992,7 +992,7 @@ static int imm_engine(imm_struct * tmp, case 4: if (cmd->use_sg) { /* if many buffers are available, start filling the first */ - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; + cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; cmd->SCp.this_residual = cmd->SCp.buffer->length; cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; } else { diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/ppa.c linux-2.5/drivers/scsi/ppa.c --- bk-linus/drivers/scsi/ppa.c 2002-11-21 02:18:13.000000000 +0000 +++ linux-2.5/drivers/scsi/ppa.c 2002-11-21 18:00:49.000000000 +0000 @@ -148,7 +148,6 @@ int ppa_detect(Scsi_Host_Template * host "pardevice is owning the port for too longtime!\n", i); parport_unregister_device(ppa_hosts[i].dev); - spin_lock_irq(ppa_hosts[i].cur_cmd->host->host_lock); return 0; } } @@ -219,13 +218,11 @@ int ppa_detect(Scsi_Host_Template * host printk(" supported by the imm (ZIP Plus) driver. If the\n"); printk(" cable is marked with \"AutoDetect\", this is what has\n"); printk(" happened.\n"); - spin_lock_irq(hreg->host_lock); return 0; } try_again = 1; goto retry_entry; } else { - spin_lock_irq(hreg->host_lock); return 1; /* return number of hosts detected */ } } @@ -790,6 +787,7 @@ static void ppa_interrupt(void *data) { ppa_struct *tmp = (ppa_struct *) data; Scsi_Cmnd *cmd = tmp->cur_cmd; + struct Scsi_Host *host = cmd->host; unsigned long flags; if (!cmd) { @@ -840,11 +838,12 @@ static void ppa_interrupt(void *data) if (cmd->SCp.phase > 0) ppa_pb_release(cmd->host->unique_id); + spin_lock_irqsave(host->host_lock, flags); tmp->cur_cmd = 0; - - spin_lock_irqsave(cmd->host->host_lock, flags); + cmd->scsi_done(cmd); - spin_unlock_irqrestore(cmd->host->host_lock, flags); + spin_unlock_irqrestore(host->host_lock, flags); + return; } @@ -918,7 +917,7 @@ static int ppa_engine(ppa_struct * tmp, case 4: /* Phase 4 - Setup scatter/gather buffers */ if (cmd->use_sg) { /* if many buffers are available, start filling the first */ - cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; + cmd->SCp.buffer = (struct scatterlist *) cmd->buffer; cmd->SCp.this_residual = cmd->SCp.buffer->length; cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; } else { diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/script_asm.pl linux-2.5/drivers/scsi/script_asm.pl --- bk-linus/drivers/scsi/script_asm.pl 2002-11-21 02:18:19.000000000 +0000 +++ linux-2.5/drivers/scsi/script_asm.pl 2002-11-21 18:00:53.000000000 +0000 @@ -12,6 +12,7 @@ # # Support for 53c710 (via -ncr7x0_family switch) added by Richard # Hirst - 15th March 1997 +# Renamed to -ncr7x0_family to -ncr710, and added -ncr700 - 5th May 2000. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -78,7 +79,7 @@ $list_in_array = 1; # Emit original SCRI # and = 0x04_00_00_00 # add = 0x06_00_00_00 -if ($ncr7x0_family) { +if ($ncr700 || $ncr710) { %operators = ( '|', 0x02_00_00_00, 'OR', 0x02_00_00_00, '&', 0x04_00_00_00, 'AND', 0x04_00_00_00, @@ -100,7 +101,24 @@ else { # Table of register addresses -if ($ncr7x0_family) { +if ($ncr700) { + %registers = ( + 'SCNTL0', 0, 'SCNTL1', 1, 'SDID', 2, 'SIEN', 3, + 'SCID', 4, 'SXFER', 5, 'SODL', 6, 'SOCL', 7, + 'SFBR', 8, 'SIDL', 9, 'SBDL', 10, 'SBCL', 11, + 'DSTAT', 12, 'SSTAT0', 13, 'SSTAT1', 14, 'SSTAT2', 15, + 'CTEST0', 20, 'CTEST1', 21, 'CTEST2', 22, 'CTEST3', 23, + 'CTEST4', 24, 'CTEST5', 25, 'CTEST6', 26, 'CTEST7', 27, + 'TEMP0', 28, 'TEMP1', 29, 'TEMP2', 30, 'TEMP3', 31, + 'DFIFO', 32, 'ISTAT', 33, 'CTEST8', 34, + 'DBC0', 36, 'DBC1', 37, 'DBC2', 38, 'DCMD', 39, + 'DNAD0', 40, 'DNAD1', 41, 'DNAD2', 42, 'DNAD3', 43, + 'DSP0', 44, 'DSP1', 45, 'DSP2', 46, 'DSP3', 47, + 'DSPS0', 48, 'DSPS1', 49, 'DSPS2', 50, 'DSPS3', 51, + 'DMODE', 52, 'DIEN', 57, 'DWT', 58, 'DCNTL', 59, + ); +} +elsif ($ncr710) { %registers = ( 'SCNTL0', 0, 'SCNTL1', 1, 'SDID', 2, 'SIEN', 3, 'SCID', 4, 'SXFER', 5, 'SODL', 6, 'SOCL', 7, @@ -172,7 +190,7 @@ $register = join ('|', keys %registers); # be escaped, I can't use the join() trick I used for the register # regex -if ($ncr7x0_family) { +if ($ncr700 || $ncr710) { $operator = '\||OR|AND|\&|\+'; } else { @@ -467,7 +485,7 @@ print STDERR "defined external $1 to $ex # Process MOVE length, address, WITH|WHEN phase instruction } elsif (/^\s*MOVE\s+(.*)/i) { $rest = $1; - if ($rest =~ /^FROM\s+($value)\s*,\s*(WITH|WHEN)\s+($phase)\s*$/i) { + if (!$ncr700 && ($rest =~ /^FROM\s+($value)\s*,\s*(WITH|WHEN)\s+($phase)\s*$/i)) { $transfer_addr = $1; $with_when = $2; $scsi_phase = $3; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/sun3_scsi.c linux-2.5/drivers/scsi/sun3_scsi.c --- bk-linus/drivers/scsi/sun3_scsi.c 2002-11-21 02:18:26.000000000 +0000 +++ linux-2.5/drivers/scsi/sun3_scsi.c 2002-11-21 18:00:57.000000000 +0000 @@ -544,7 +544,7 @@ static int sun3scsi_dma_finish(int write #if 1 // check to empty the fifo on a read if(!write_flag) { - int tmo = 200000; /* 2 sec */ + int tmo = 20000; /* .2 sec */ while(1) { if(dregs->csr & CSR_FIFO_EMPTY) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/sym53c8xx_2/sym_glue.c linux-2.5/drivers/scsi/sym53c8xx_2/sym_glue.c --- bk-linus/drivers/scsi/sym53c8xx_2/sym_glue.c 2002-11-21 02:18:41.000000000 +0000 +++ linux-2.5/drivers/scsi/sym53c8xx_2/sym_glue.c 2002-11-21 18:01:06.000000000 +0000 @@ -125,7 +125,7 @@ void sym_mdelay(int ms) { mdelay(ms); } * * The whole SCSI sub-system under Linux is basically single-threaded. * Everything, including low-level driver interrupt routine, happens - * whith the `io_request_lock' held. + * with the `io_request_lock' held. * The sym53c8xx-1.x drivers series ran their interrupt code using a * spin mutex per controller. This added complexity without improving * scalability significantly. the sym-2 driver still use a spinlock @@ -1876,7 +1876,7 @@ static int sym_setup_bus_dma_mask(hcb_p sym_name(np)); } else { - if (!pci_set_dma_mask(np->s.device, 0xffffffffUL)) + if (pci_set_dma_mask(np->s.device, 0xffffffffUL)) goto out_err32; } } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/tmscsim.c linux-2.5/drivers/scsi/tmscsim.c --- bk-linus/drivers/scsi/tmscsim.c 2002-11-21 02:18:29.000000000 +0000 +++ linux-2.5/drivers/scsi/tmscsim.c 2002-11-21 18:00:59.000000000 +0000 @@ -2521,15 +2521,15 @@ static int dc390_search (char** buffer, #define SEARCH(buffer, pos, p0, var, txt, max) \ if (dc390_search (&buffer, &pos, &p0, (PUCHAR)(&var), txt, max, 100, "")) goto einv2; \ -else if (!p1) goto ok2 +else if (!pos) goto ok2 #define SEARCH2(buffer, pos, p0, var, txt, max, scale) \ if (dc390_search (&buffer, &pos, &p0, &var, txt, max, scale, "")) goto einv2; \ -else if (!p1) goto ok2 +else if (!pos) goto ok2 #define SEARCH3(buffer, pos, p0, var, txt, max, scale, ign) \ if (dc390_search (&buffer, &pos, &p0, &var, txt, max, scale, ign)) goto einv2; \ -else if (!p1) goto ok2 +else if (!pos) goto ok2 #ifdef DC390_PARSEDEBUG diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/wd33c93.c linux-2.5/drivers/scsi/wd33c93.c --- bk-linus/drivers/scsi/wd33c93.c 2002-11-21 02:18:30.000000000 +0000 +++ linux-2.5/drivers/scsi/wd33c93.c 2002-11-21 18:01:00.000000000 +0000 @@ -1409,12 +1409,32 @@ DB(DB_INTR,printk("} ")) -static void reset_wd33c93(struct Scsi_Host *instance) +void reset_wd33c93(struct Scsi_Host *instance) { struct WD33C93_hostdata *hostdata = (struct WD33C93_hostdata *)instance->hostdata; const wd33c93_regs regs = hostdata->regs; uchar sr; +#ifdef CONFIG_SGI_IP22 +{ +int busycount = 0; +extern void sgiwd93_reset(unsigned long); + /* wait 'til the chip gets some time for us */ + while ((READ_AUX_STAT() & ASR_BSY) && busycount++ < 100) + udelay (10); + /* + * there are scsi devices out there, which manage to lock up + * the wd33c93 in a busy condition. In this state it won't + * accept the reset command. The only way to solve this is to + * give the chip a hardware reset (if possible). The code below + * does this for the SGI Indy, where this is possible + */ + /* still busy ? */ + if (READ_AUX_STAT() & ASR_BSY) + sgiwd93_reset(instance->base); /* yeah, give it the hard one */ +} +#endif + write_wd33c93(regs, WD_OWN_ID, OWNID_EAF | OWNID_RAF | instance->this_id | hostdata->clock_freq); write_wd33c93(regs, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_POLLED); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/scsi/sym53c8xx_2/sym_malloc.c linux-2.5/drivers/scsi/sym53c8xx_2/sym_malloc.c --- bk-linus/drivers/scsi/sym53c8xx_2/sym_malloc.c 2002-11-21 02:18:42.000000000 +0000 +++ linux-2.5/drivers/scsi/sym53c8xx_2/sym_malloc.c 2002-11-21 18:01:07.000000000 +0000 @@ -143,12 +143,15 @@ static void ___sym_mfree(m_pool_p mp, vo a = (m_addr_t) ptr; while (1) { -#ifdef SYM_MEM_FREE_UNUSED if (s == SYM_MEM_CLUSTER_SIZE) { +#ifdef SYM_MEM_FREE_UNUSED M_FREE_MEM_CLUSTER(a); +#else + ((m_link_p) a)->next = h[i].next; + h[i].next = (m_link_p) a; +#endif break; } -#endif b = a ^ s; q = &h[i]; while (q->next && q->next != (m_link_p) b) { diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/tty_ioctl.c linux-2.5/drivers/char/tty_ioctl.c --- bk-linus/drivers/char/tty_ioctl.c 2002-11-21 02:14:02.000000000 +0000 +++ linux-2.5/drivers/char/tty_ioctl.c 2002-11-21 17:57:48.000000000 +0000 @@ -394,7 +394,7 @@ int n_tty_ioctl(struct tty_struct * tty, return -EFAULT; return 0; case TCSETSF: - return set_termios(real_tty, arg, TERMIOS_FLUSH); + return set_termios(real_tty, arg, TERMIOS_FLUSH | TERMIOS_WAIT); case TCSETSW: return set_termios(real_tty, arg, TERMIOS_WAIT); case TCSETS: @@ -402,7 +402,7 @@ int n_tty_ioctl(struct tty_struct * tty, case TCGETA: return get_termio(real_tty,(struct termio *) arg); case TCSETAF: - return set_termios(real_tty, arg, TERMIOS_FLUSH | TERMIOS_TERMIO); + return set_termios(real_tty, arg, TERMIOS_FLUSH | TERMIOS_WAIT | TERMIOS_TERMIO); case TCSETAW: return set_termios(real_tty, arg, TERMIOS_WAIT | TERMIOS_TERMIO); case TCSETA: diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/atm/atmtcp.c linux-2.5/drivers/atm/atmtcp.c --- bk-linus/drivers/atm/atmtcp.c 2002-11-21 02:13:28.000000000 +0000 +++ linux-2.5/drivers/atm/atmtcp.c 2002-11-21 17:57:22.000000000 +0000 @@ -173,7 +173,7 @@ static int atmtcp_v_ioctl(struct atm_dev static int atmtcp_v_send(struct atm_vcc *vcc,struct sk_buff *skb) { struct atmtcp_dev_data *dev_data; - struct atm_vcc *out_vcc; + struct atm_vcc *out_vcc=NULL; /* Initializer quietens GCC warning */ struct sk_buff *new_skb; struct atmtcp_hdr *hdr; int size; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/Makefile linux-2.5/drivers/char/Makefile --- bk-linus/drivers/char/Makefile 2002-11-21 02:13:49.000000000 +0000 +++ linux-2.5/drivers/char/Makefile 2002-11-21 17:57:36.000000000 +0000 @@ -68,6 +68,7 @@ obj-$(CONFIG_I8K) += i8k.o obj-$(CONFIG_DS1620) += ds1620.o obj-$(CONFIG_INTEL_RNG) += i810_rng.o obj-$(CONFIG_AMD_RNG) += amd768_rng.o + obj-$(CONFIG_QIC02_TAPE) += tpqic02.o obj-$(CONFIG_FTAPE) += ftape/ obj-$(CONFIG_H8) += h8.o @@ -89,6 +90,8 @@ obj-$(CONFIG_IB700_WDT) += ib700wdt.o obj-$(CONFIG_MIXCOMWD) += mixcomwd.o obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o +obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o +obj-$(CONFIG_SC520_WDT) += sc520_wdt.o obj-$(CONFIG_WDT) += wdt.o obj-$(CONFIG_WDTPCI) += wdt_pci.o obj-$(CONFIG_21285_WATCHDOG) += wdt285.o @@ -97,7 +100,11 @@ obj-$(CONFIG_I810_TCO) += i810-tco.o obj-$(CONFIG_MACHZ_WDT) += machzwd.o obj-$(CONFIG_SH_WDT) += shwdt.o obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o +obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o +obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o +obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o +obj-$(CONFIG_AMD7XX_TCO) += amd7xx_tco.o obj-$(CONFIG_MWAVE) += mwave/ obj-$(CONFIG_AGP) += agp/ obj-$(CONFIG_DRM) += drm/ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/alim7101_wdt.c linux-2.5/drivers/char/alim7101_wdt.c --- bk-linus/drivers/char/alim7101_wdt.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5/drivers/char/alim7101_wdt.c 2002-11-21 17:57:37.000000000 +0000 @@ -0,0 +1,339 @@ +/* + * ALi M7101 PMU Computer Watchdog Timer driver for Linux 2.4.x + * + * Based on w83877f_wdt.c by Scott Jennings + * and the Cobalt kernel WDT timer driver by Tim Hockin + * + * + * (c)2002 Steve Hill + * + * Theory of operation: + * A Watchdog Timer (WDT) is a hardware circuit that can + * reset the computer system in case of a software fault. + * You probably knew that already. + * + * Usually a userspace daemon will notify the kernel WDT driver + * via the /proc/watchdog special device file that userspace is + * still alive, at regular intervals. When such a notification + * occurs, the driver will usually tell the hardware watchdog + * that everything is in order, and that the watchdog should wait + * for yet another little while to reset the system. + * If userspace fails (RAM error, kernel bug, whatever), the + * notifications cease to occur, and the hardware watchdog will + * reset the system (causing a reboot) after the timeout occurs. + * + * This WDT driver is different from most other Linux WDT + * drivers in that the driver will ping the watchdog by itself, + * because this particular WDT has a very short timeout (1.6 + * seconds) and it would be insane to count on any userspace + * daemon always getting scheduled within that time frame. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define OUR_NAME "alim7101_wdt" + +#define WDT_ENABLE 0x9C +#define WDT_DISABLE 0x8C + +#define ALI_7101_WDT 0x92 +#define ALI_WDT_ARM 0x01 + +/* + * We're going to use a 1 second timeout. + * If we reset the watchdog every ~250ms we should be safe. */ + +#define WDT_INTERVAL (HZ/4+1) + +/* + * We must not require too good response from the userspace daemon. + * Here we require the userspace daemon to send us a heartbeat + * char to /dev/watchdog every 30 seconds. + */ + +#define WDT_HEARTBEAT (HZ * 30) + +static void wdt_timer_ping(unsigned long); +static struct timer_list timer; +static unsigned long next_heartbeat; +static unsigned long wdt_is_open; +static int wdt_expect_close; +static struct pci_dev *alim7101_pmu; + +/* + * Whack the dog + */ + +static void wdt_timer_ping(unsigned long data) +{ + /* If we got a heartbeat pulse within the WDT_US_INTERVAL + * we agree to ping the WDT + */ + char tmp; + + if(time_before(jiffies, next_heartbeat)) + { + /* Ping the WDT (this is actually a disarm/arm sequence) */ + pci_read_config_byte(alim7101_pmu, 0x92, &tmp); + pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp & ~ALI_WDT_ARM)); + pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp | ALI_WDT_ARM)); + } else { + printk(OUR_NAME ": Heartbeat lost! Will not ping the watchdog\n"); + } + /* Re-set the timer interval */ + timer.expires = jiffies + WDT_INTERVAL; + add_timer(&timer); +} + +/* + * Utility routines + */ + +static void wdt_change(int writeval) +{ + char tmp; + + pci_read_config_byte(alim7101_pmu, 0x92, &tmp); + if (writeval == WDT_ENABLE) + pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp | ALI_WDT_ARM)); + else + pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp & ~ALI_WDT_ARM)); +} + +static void wdt_startup(void) +{ + next_heartbeat = jiffies + WDT_HEARTBEAT; + + /* We must enable before we kick off the timer in case the timer + occurs as we ping it */ + + wdt_change(WDT_ENABLE); + + /* Start the timer */ + timer.expires = jiffies + WDT_INTERVAL; + add_timer(&timer); + + + printk(OUR_NAME ": Watchdog timer is now enabled.\n"); +} + +static void wdt_turnoff(void) +{ + /* Stop the timer */ + del_timer_sync(&timer); + wdt_change(WDT_DISABLE); + printk(OUR_NAME ": Watchdog timer is now disabled...\n"); +} + +/* + * /dev/watchdog handling + */ + +static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) +{ + /* We can't seek */ + if(ppos != &file->f_pos) + return -ESPIPE; + + /* See if we got the magic character */ + if(count) + { + size_t ofs; + + /* note: just in case someone wrote the magic character + * five months ago... */ + wdt_expect_close = 0; + + /* now scan */ + for(ofs = 0; ofs != count; ofs++) + { + char c; + if(get_user(c, buf+ofs)) + return -EFAULT; + if(c == 'V') + wdt_expect_close = 1; + } + /* someone wrote to us, we should restart timer */ + next_heartbeat = jiffies + WDT_HEARTBEAT; + return 1; + }; + return 0; +} + +static ssize_t fop_read(struct file * file, char * buf, size_t count, loff_t * ppos) +{ + /* No can do */ + return -EINVAL; +} + +static int fop_open(struct inode * inode, struct file * file) +{ + /* Just in case we're already talking to someone... */ + if(test_and_set_bit(0, &wdt_is_open)) + return -EBUSY; + /* Good, fire up the show */ + wdt_startup(); + return 0; +} + +static int fop_close(struct inode * inode, struct file * file) +{ +#ifdef CONFIG_WDT_NOWAYOUT + if(wdt_expect_close) + wdt_turnoff(); + else { + printk(OUR_NAME ": device file closed unexpectedly. Will not stop the WDT!\n"); + } +#else + wdt_turnoff(); +#endif + clear_bit(0, &wdt_is_open); + return 0; +} + +static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +{ + static struct watchdog_info ident= + { + 0, + 1, + "ALiM7101" + }; + + switch(cmd) + { + case WDIOC_GETSUPPORT: + return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; + case WDIOC_KEEPALIVE: + next_heartbeat = jiffies + WDT_HEARTBEAT; + return 0; + default: + return -ENOTTY; + } +} + +static struct file_operations wdt_fops = { + owner: THIS_MODULE, + llseek: no_llseek, + read: fop_read, + write: fop_write, + open: fop_open, + release: fop_close, + ioctl: fop_ioctl +}; + +static struct miscdevice wdt_miscdev = { + WATCHDOG_MINOR, + "watchdog", + &wdt_fops +}; + +/* + * Notifier for system down + */ + +static int wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused) +{ + if (code==SYS_DOWN || code==SYS_HALT) wdt_turnoff(); + if (code==SYS_RESTART) { + /* + * Cobalt devices have no way of rebooting themselves other than + * getting the watchdog to pull reset, so we restart the watchdog on + * reboot with no heartbeat + */ + wdt_change(WDT_ENABLE); + printk(OUR_NAME ": Watchdog timer is now enabled with no heartbeat - should reboot in ~1 second.\n"); + }; + return NOTIFY_DONE; +} + +/* + * The WDT needs to learn about soft shutdowns in order to + * turn the timebomb registers off. + */ + +static struct notifier_block wdt_notifier= +{ + wdt_notify_sys, + 0, + 0 +}; + +static void __exit alim7101_wdt_unload(void) +{ + wdt_turnoff(); + /* Deregister */ + misc_deregister(&wdt_miscdev); + unregister_reboot_notifier(&wdt_notifier); +} + +static int __init alim7101_wdt_init(void) +{ + int rc = -EBUSY; + struct pci_dev *ali1543_south; + char tmp; + + printk(KERN_INFO OUR_NAME ": Steve Hill .\n"); + alim7101_pmu = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,NULL); + if (!alim7101_pmu) { + printk(KERN_INFO OUR_NAME ": ALi M7101 PMU not present - WDT not set\n"); + return -EBUSY; + }; + + /* Set the WDT in the PMU to 1 second */ + pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, 0x02); + + ali1543_south = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); + if (!ali1543_south) { + printk(KERN_INFO OUR_NAME ": ALi 1543 South-Bridge not present - WDT not set\n"); + return -EBUSY; + }; + pci_read_config_byte(ali1543_south, 0x5e, &tmp); + if ((tmp & 0x1e) != 0x12) { + printk(KERN_INFO OUR_NAME ": ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n"); + return -EBUSY; + }; + + init_timer(&timer); + timer.function = wdt_timer_ping; + timer.data = 1; + + rc = misc_register(&wdt_miscdev); + if (rc) + return rc; + + rc = register_reboot_notifier(&wdt_notifier); + if (rc) { + misc_deregister(&wdt_miscdev); + return rc; + }; + + printk(KERN_INFO OUR_NAME ": WDT driver for ALi M7101 initialised.\n"); + return 0; +} + +module_init(alim7101_wdt_init); +module_exit(alim7101_wdt_unload); + +EXPORT_NO_SYMBOLS; +MODULE_AUTHOR("Steve Hill"); +MODULE_LICENSE("GPL"); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/sc1200wdt.c linux-2.5/drivers/char/sc1200wdt.c --- bk-linus/drivers/char/sc1200wdt.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5/drivers/char/sc1200wdt.c 2002-11-21 17:57:44.000000000 +0000 @@ -0,0 +1,466 @@ +/* + * National Semiconductor PC87307/PC97307 (ala SC1200) WDT driver + * (c) Copyright 2002 Zwane Mwaikambo , + * All Rights Reserved. + * Based on wdt.c and wdt977.c by Alan Cox and Woody Suwalski respectively. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * The author(s) of this software shall not be held liable for damages + * of any nature resulting due to the use of this software. This + * software is provided AS-IS with no warranties. + * + * Changelog: + * 20020220 Zwane Mwaikambo Code based on datasheet, no hardware. + * 20020221 Zwane Mwaikambo Cleanups as suggested by Jeff Garzik and Alan Cox. + * 20020222 Zwane Mwaikambo Added probing. + * 20020225 Zwane Mwaikambo Added ISAPNP support. + * 20020412 Rob Radez Broke out start/stop functions + * Return proper status instead of temperature warning + * Add WDIOC_GETBOOTSTATUS and WDIOC_SETOPTIONS ioctls + * Fix CONFIG_WATCHDOG_NOWAYOUT + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SC1200_MODULE_VER "build 20020303" +#define SC1200_MODULE_NAME "sc1200wdt" +#define PFX SC1200_MODULE_NAME ": " + +#define MAX_TIMEOUT 255 /* 255 minutes */ +#define PMIR (io) /* Power Management Index Register */ +#define PMDR (io+1) /* Power Management Data Register */ + +/* Data Register indexes */ +#define FER1 0x00 /* Function enable register 1 */ +#define FER2 0x01 /* Function enable register 2 */ +#define PMC1 0x02 /* Power Management Ctrl 1 */ +#define PMC2 0x03 /* Power Management Ctrl 2 */ +#define PMC3 0x04 /* Power Management Ctrl 3 */ +#define WDTO 0x05 /* Watchdog timeout register */ +#define WDCF 0x06 /* Watchdog config register */ +#define WDST 0x07 /* Watchdog status register */ + +/* WDCF bitfields - which devices assert WDO */ +#define KBC_IRQ 0x01 /* Keyboard Controller */ +#define MSE_IRQ 0x02 /* Mouse */ +#define UART1_IRQ 0x03 /* Serial0 */ +#define UART2_IRQ 0x04 /* Serial1 */ +/* 5 -7 are reserved */ + +static char banner[] __initdata = KERN_INFO PFX SC1200_MODULE_VER; +static int timeout = 1; +static int io = -1; +static int io_len = 2; /* for non plug and play */ +struct semaphore open_sem; +static char expect_close; +spinlock_t sc1200wdt_lock; /* io port access serialisation */ + +#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE +static int isapnp = 1; +static struct pci_dev *wdt_dev; + +MODULE_PARM(isapnp, "i"); +MODULE_PARM_DESC(isapnp, "When set to 0 driver ISA PnP support will be disabled"); +#endif + +MODULE_PARM(io, "i"); +MODULE_PARM_DESC(io, "io port"); +MODULE_PARM(timeout, "i"); +MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1"); + + + +/* Read from Data Register */ +static inline void sc1200wdt_read_data(unsigned char index, unsigned char *data) +{ + spin_lock(&sc1200wdt_lock); + outb_p(index, PMIR); + *data = inb(PMDR); + spin_unlock(&sc1200wdt_lock); +} + + +/* Write to Data Register */ +static inline void sc1200wdt_write_data(unsigned char index, unsigned char data) +{ + spin_lock(&sc1200wdt_lock); + outb_p(index, PMIR); + outb(data, PMDR); + spin_unlock(&sc1200wdt_lock); +} + + +static void sc1200wdt_start(void) +{ + unsigned char reg; + + sc1200wdt_read_data(WDCF, ®); + /* assert WDO when any of the following interrupts are triggered too */ + reg |= (KBC_IRQ | MSE_IRQ | UART1_IRQ | UART2_IRQ); + sc1200wdt_write_data(WDCF, reg); + /* set the timeout and get the ball rolling */ + sc1200wdt_write_data(WDTO, timeout); +} + + +static void sc1200wdt_stop(void) +{ + sc1200wdt_write_data(WDTO, 0); +} + + +/* This returns the status of the WDO signal, inactive high. */ +static inline int sc1200wdt_status(void) +{ + unsigned char ret; + + sc1200wdt_read_data(WDST, &ret); + /* If the bit is inactive, the watchdog is enabled, so return + * KEEPALIVEPING which is a bit of a kludge because there's nothing + * else for enabled/disabled status + */ + return (ret & 0x01) ? 0 : WDIOF_KEEPALIVEPING; /* bits 1 - 7 are undefined */ +} + + +static int sc1200wdt_open(struct inode *inode, struct file *file) +{ + /* allow one at a time */ + if (down_trylock(&open_sem)) + return -EBUSY; + + if (timeout > MAX_TIMEOUT) + timeout = MAX_TIMEOUT; + + sc1200wdt_start(); + printk(KERN_INFO PFX "Watchdog enabled, timeout = %d min(s)", timeout); + + return 0; +} + + +static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +{ + int new_timeout; + static struct watchdog_info ident = { + options: WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, + firmware_version: 0, + identity: "PC87307/PC97307" + }; + + switch (cmd) { + default: + return -ENOTTY; /* Keep Pavel Machek amused ;) */ + + case WDIOC_GETSUPPORT: + if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof ident)) + return -EFAULT; + return 0; + + case WDIOC_GETSTATUS: + return put_user(sc1200wdt_status(), (int *)arg); + + case WDIOC_GETBOOTSTATUS: + return put_user(0, (int *)arg); + + case WDIOC_KEEPALIVE: + sc1200wdt_write_data(WDTO, timeout); + return 0; + + case WDIOC_SETTIMEOUT: + if (get_user(new_timeout, (int *)arg)) + return -EFAULT; + + /* the API states this is given in secs */ + new_timeout /= 60; + if (new_timeout < 0 || new_timeout > MAX_TIMEOUT) + return -EINVAL; + + timeout = new_timeout; + sc1200wdt_write_data(WDTO, timeout); + /* fall through and return the new timeout */ + + case WDIOC_GETTIMEOUT: + return put_user(timeout * 60, (int *)arg); + + case WDIOC_SETOPTIONS: + { + int options, retval = -EINVAL; + + if (get_user(options, (int *)arg)) + return -EFAULT; + + if (options & WDIOS_DISABLECARD) { + sc1200wdt_stop(); + retval = 0; + } + + if (options & WDIOS_ENABLECARD) { + sc1200wdt_start(); + retval = 0; + } + + return retval; + } + } +} + + +static int sc1200wdt_release(struct inode *inode, struct file *file) +{ + if (expect_close == 42) { + sc1200wdt_stop(); + printk(KERN_INFO PFX "Watchdog disabled\n"); + } else { + sc1200wdt_write_data(WDTO, timeout); + printk(KERN_CRIT PFX "Unexpected close!, timeout = %d min(s)\n", timeout); + } + up(&open_sem); + expect_close = 0; + + return 0; +} + + +static ssize_t sc1200wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos) +{ + if (ppos != &file->f_pos) + return -ESPIPE; + + if (len) { +#ifndef CONFIG_WATCHDOG_NOWAYOUT + size_t i; + + expect_close = 0; + + for (i = 0; i != len; i++) + { + char c; + if(get_user(c, data+i)) + return -EFAULT; + if (c == 'V') + expect_close = 42; + } +#endif + sc1200wdt_write_data(WDTO, timeout); + return len; + } + + return 0; +} + + +static int sc1200wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused) +{ + if (code == SYS_DOWN || code == SYS_HALT) + sc1200wdt_stop(); + + return NOTIFY_DONE; +} + + +static struct notifier_block sc1200wdt_notifier = +{ + notifier_call: sc1200wdt_notify_sys +}; + +static struct file_operations sc1200wdt_fops = +{ + owner: THIS_MODULE, + write: sc1200wdt_write, + ioctl: sc1200wdt_ioctl, + open: sc1200wdt_open, + release: sc1200wdt_release +}; + +static struct miscdevice sc1200wdt_miscdev = +{ + minor: WATCHDOG_MINOR, + name: "watchdog", + fops: &sc1200wdt_fops, +}; + + +static int __init sc1200wdt_probe(void) +{ + /* The probe works by reading the PMC3 register's default value of 0x0e + * there is one caveat, if the device disables the parallel port or any + * of the UARTs we won't be able to detect it. + * Nb. This could be done with accuracy by reading the SID registers, but + * we don't have access to those io regions. + */ + + unsigned char reg; + + sc1200wdt_read_data(PMC3, ®); + reg &= 0x0f; /* we don't want the UART busy bits */ + return (reg == 0x0e) ? 0 : -ENODEV; +} + + +#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE + +static int __init sc1200wdt_isapnp_probe(void) +{ + int ret; + + /* The WDT is logical device 8 on the main device */ + wdt_dev = isapnp_find_dev(NULL, ISAPNP_VENDOR('N','S','C'), ISAPNP_FUNCTION(0x08), NULL); + if (!wdt_dev) + return -ENODEV; + + if (wdt_dev->prepare(wdt_dev) < 0) { + printk(KERN_ERR PFX "ISA PnP found device that could not be autoconfigured\n"); + return -EAGAIN; + } + + if (!(pci_resource_flags(wdt_dev, 0) & IORESOURCE_IO)) { + printk(KERN_ERR PFX "ISA PnP could not find io ports\n"); + return -ENODEV; + } + + ret = wdt_dev->activate(wdt_dev); + if (ret && (ret != -EBUSY)) + return -ENOMEM; + + /* io port resource overriding support? */ + io = pci_resource_start(wdt_dev, 0); + io_len = pci_resource_len(wdt_dev, 0); + + printk(KERN_DEBUG PFX "ISA PnP found device at io port %#x/%d\n", io, io_len); + return 0; +} + +#endif /* CONFIG_ISAPNP */ + + +static int __init sc1200wdt_init(void) +{ + int ret; + + printk(banner); + + spin_lock_init(&sc1200wdt_lock); + sema_init(&open_sem, 1); + +#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE + if (isapnp) { + ret = sc1200wdt_isapnp_probe(); + if (ret) + goto out_clean; + } +#endif + + if (io == -1) { + printk(KERN_ERR PFX "io parameter must be specified\n"); + ret = -EINVAL; + goto out_clean; + } + + if (!request_region(io, io_len, SC1200_MODULE_NAME)) { + printk(KERN_ERR PFX "Unable to register IO port %#x\n", io); + ret = -EBUSY; + goto out_pnp; + } + + ret = sc1200wdt_probe(); + if (ret) + goto out_io; + + ret = register_reboot_notifier(&sc1200wdt_notifier); + if (ret) { + printk(KERN_ERR PFX "Unable to register reboot notifier err = %d\n", ret); + goto out_io; + } + + ret = misc_register(&sc1200wdt_miscdev); + if (ret) { + printk(KERN_ERR PFX "Unable to register miscdev on minor %d\n", WATCHDOG_MINOR); + goto out_rbt; + } + + /* ret = 0 */ + +out_clean: + return ret; + +out_rbt: + unregister_reboot_notifier(&sc1200wdt_notifier); + +out_io: + release_region(io, io_len); + +out_pnp: +#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE + if (isapnp && wdt_dev) + wdt_dev->deactivate(wdt_dev); +#endif + goto out_clean; +} + + +static void __exit sc1200wdt_exit(void) +{ + misc_deregister(&sc1200wdt_miscdev); + unregister_reboot_notifier(&sc1200wdt_notifier); + +#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE + if(isapnp && wdt_dev) + wdt_dev->deactivate(wdt_dev); +#endif + + release_region(io, io_len); +} + + +#ifndef MODULE +static int __init sc1200wdt_setup(char *str) +{ + int ints[4]; + + str = get_options (str, ARRAY_SIZE(ints), ints); + + if (ints[0] > 0) { + io = ints[1]; + if (ints[0] > 1) + timeout = ints[2]; + +#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE + if (ints[0] > 2) + isapnp = ints[3]; +#endif + } + + return 1; +} + +__setup("sc1200wdt=", sc1200wdt_setup); +#endif /* MODULE */ + + +module_init(sc1200wdt_init); +module_exit(sc1200wdt_exit); + +MODULE_AUTHOR("Zwane Mwaikambo "); +MODULE_DESCRIPTION("Driver for National Semiconductor PC87307/PC97307 watchdog component"); +MODULE_LICENSE("GPL"); +EXPORT_NO_SYMBOLS; + diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/sc520_wdt.c linux-2.5/drivers/char/sc520_wdt.c --- bk-linus/drivers/char/sc520_wdt.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5/drivers/char/sc520_wdt.c 2002-11-21 17:57:44.000000000 +0000 @@ -0,0 +1,385 @@ +/* + * AMD Elan SC520 processor Watchdog Timer driver for Linux 2.4.x + * + * Based on acquirewdt.c by Alan Cox, + * and sbc60xxwdt.c by Jakob Oestergaard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * The authors do NOT admit liability nor provide warranty for + * any of this software. This material is provided "AS-IS" in + * the hope that it may be useful for others. + * + * (c) Copyright 2001 Scott Jennings + * 9/27 - 2001 [Initial release] + * + * Additional fixes Alan Cox + * - Fixed formatting + * - Removed debug printks + * - Fixed SMP built kernel deadlock + * - Switched to private locks not lock_kernel + * - Used ioremap/writew/readw + * - Added NOWAYOUT support + * + * Theory of operation: + * A Watchdog Timer (WDT) is a hardware circuit that can + * reset the computer system in case of a software fault. + * You probably knew that already. + * + * Usually a userspace daemon will notify the kernel WDT driver + * via the /proc/watchdog special device file that userspace is + * still alive, at regular intervals. When such a notification + * occurs, the driver will usually tell the hardware watchdog + * that everything is in order, and that the watchdog should wait + * for yet another little while to reset the system. + * If userspace fails (RAM error, kernel bug, whatever), the + * notifications cease to occur, and the hardware watchdog will + * reset the system (causing a reboot) after the timeout occurs. + * + * This WDT driver is different from most other Linux WDT + * drivers in that the driver will ping the watchdog by itself, + * because this particular WDT has a very short timeout (1.6 + * seconds) and it would be insane to count on any userspace + * daemon always getting scheduled within that time frame. + * + * This driver uses memory mapped IO, and spinlock. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * The SC520 can timeout anywhere from 492us to 32.21s. + * If we reset the watchdog every ~250ms we should be safe. + */ + +#define WDT_INTERVAL (HZ/4+1) + +/* + * We must not require too good response from the userspace daemon. + * Here we require the userspace daemon to send us a heartbeat + * char to /dev/watchdog every 30 seconds. + */ + +#define WDT_HEARTBEAT (HZ * 30) + +/* + * AMD Elan SC520 timeout value is 492us times a power of 2 (0-7) + * + * 0: 492us 2: 1.01s 4: 4.03s 6: 16.22s + * 1: 503ms 3: 2.01s 5: 8.05s 7: 32.21s + */ + +#define TIMEOUT_EXPONENT ( 1 << 3 ) /* 0x08 = 2.01s */ + +/* #define MMCR_BASE_DEFAULT 0xfffef000 */ +#define MMCR_BASE_DEFAULT ((__u16 *)0xffffe) +#define OFFS_WDTMRCTL ((unsigned int)0xcb0) +#define WDT_ENB 0x8000 /* [15] Watchdog Timer Enable */ +#define WDT_WRST_ENB 0x4000 /* [14] Watchdog Timer Reset Enable */ + +#define OUR_NAME "sc520_wdt" + +#define WRT_DOG(data) *wdtmrctl=data + +static __u16 *wdtmrctl; + +static void wdt_timer_ping(unsigned long); +static struct timer_list timer; +static unsigned long next_heartbeat; +static unsigned long wdt_is_open; +static int wdt_expect_close; + +static spinlock_t wdt_spinlock; +/* + * Whack the dog + */ + +static void wdt_timer_ping(unsigned long data) +{ + /* If we got a heartbeat pulse within the WDT_US_INTERVAL + * we agree to ping the WDT + */ + if(time_before(jiffies, next_heartbeat)) + { + /* Ping the WDT */ + spin_lock(&wdt_spinlock); + writew(0xAAAA, wdtmrctl); + writew(0x5555, wdtmrctl); + spin_unlock(&wdt_spinlock); + + /* Re-set the timer interval */ + timer.expires = jiffies + WDT_INTERVAL; + add_timer(&timer); + } else { + printk(OUR_NAME ": Heartbeat lost! Will not ping the watchdog\n"); + } +} + +/* + * Utility routines + */ + +static void wdt_config(int writeval) +{ + __u16 dummy; + unsigned long flags; + + /* buy some time (ping) */ + spin_lock_irqsave(&wdt_spinlock, flags); + dummy=readw(wdtmrctl); /* ensure write synchronization */ + writew(0xAAAA, wdtmrctl); + writew(0x5555, wdtmrctl); + /* make WDT configuration register writable one time */ + writew(0x3333, wdtmrctl); + writew(0xCCCC, wdtmrctl); + /* write WDT configuration register */ + writew(writeval, wdtmrctl); + spin_unlock_irqrestore(&wdt_spinlock, flags); +} + +static void wdt_startup(void) +{ + next_heartbeat = jiffies + WDT_HEARTBEAT; + + /* Start the timer */ + timer.expires = jiffies + WDT_INTERVAL; + add_timer(&timer); + + wdt_config(WDT_ENB | WDT_WRST_ENB | TIMEOUT_EXPONENT); + printk(OUR_NAME ": Watchdog timer is now enabled.\n"); +} + +static void wdt_turnoff(void) +{ +#ifndef CONFIG_WATCHDOG_NOWAYOUT + /* Stop the timer */ + del_timer(&timer); + wdt_config(0); + printk(OUR_NAME ": Watchdog timer is now disabled...\n"); +#endif +} + + +/* + * /dev/watchdog handling + */ + +static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos) +{ + /* We can't seek */ + if(ppos != &file->f_pos) + return -ESPIPE; + + /* See if we got the magic character */ + if(count) + { + size_t ofs; + + /* note: just in case someone wrote the magic character + * five months ago... */ + wdt_expect_close = 0; + + /* now scan */ + for(ofs = 0; ofs != count; ofs++) { + char c; + if (get_user(c, buf + ofs)) + return -EFAULT; + if(c == 'V') + wdt_expect_close = 1; + } + + /* Well, anyhow someone wrote to us, we should return that favour */ + next_heartbeat = jiffies + WDT_HEARTBEAT; + return 1; + } + return 0; +} + +static int fop_open(struct inode * inode, struct file * file) +{ + switch(minor(inode->i_rdev)) + { + case WATCHDOG_MINOR: + /* Just in case we're already talking to someone... */ + if(test_and_set_bit(0, &wdt_is_open)) + return -EBUSY; + /* Good, fire up the show */ + wdt_startup(); +#ifdef CONFIG_WATCHDOG_NOWAYOUT + MOD_INC_USE_COUNT; +#endif + return 0; + default: + return -ENODEV; + } +} + +static int fop_close(struct inode * inode, struct file * file) +{ + if(minor(inode->i_rdev) == WATCHDOG_MINOR) + { + if(wdt_expect_close) + wdt_turnoff(); + else { + del_timer(&timer); + printk(OUR_NAME ": device file closed unexpectedly. Will not stop the WDT!\n"); + } + } + clear_bit(0, &wdt_is_open); + return 0; +} + +static long long fop_llseek(struct file *file, long long offset, int origin) +{ + return -ESPIPE; +} + +static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg) +{ + static struct watchdog_info ident= + { + 0, + 1, + "SC520" + }; + + switch(cmd) + { + default: + return -ENOIOCTLCMD; + case WDIOC_GETSUPPORT: + return copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))?-EFAULT:0; + case WDIOC_KEEPALIVE: + next_heartbeat = jiffies + WDT_HEARTBEAT; + return 0; + } +} + +static struct file_operations wdt_fops = { + owner: THIS_MODULE, + llseek: fop_llseek, + write: fop_write, + open: fop_open, + release: fop_close, + ioctl: fop_ioctl +}; + +static struct miscdevice wdt_miscdev = { + WATCHDOG_MINOR, + "watchdog", + &wdt_fops +}; + +/* + * Notifier for system down + */ + +static int wdt_notify_sys(struct notifier_block *this, unsigned long code, + void *unused) +{ + if(code==SYS_DOWN || code==SYS_HALT) + wdt_turnoff(); + return NOTIFY_DONE; +} + +/* + * The WDT needs to learn about soft shutdowns in order to + * turn the timebomb registers off. + */ + +static struct notifier_block wdt_notifier= +{ + wdt_notify_sys, + 0, + 0 +}; + +static void __exit sc520_wdt_unload(void) +{ + wdt_turnoff(); + + /* Deregister */ + misc_deregister(&wdt_miscdev); + iounmap(wdtmrctl); + unregister_reboot_notifier(&wdt_notifier); +} + +static int __init sc520_wdt_init(void) +{ + int rc = -EBUSY; + unsigned long cbar; + + spin_lock_init(&wdt_spinlock); + + init_timer(&timer); + timer.function = wdt_timer_ping; + timer.data = 0; + + rc = misc_register(&wdt_miscdev); + if (rc) + goto err_out_region2; + + rc = register_reboot_notifier(&wdt_notifier); + if (rc) + goto err_out_miscdev; + + /* get the Base Address Register */ + cbar = inl_p(0xfffc); + printk(OUR_NAME ": CBAR: 0x%08lx\n", cbar); + /* check if MMCR aliasing bit is set */ + if (cbar & 0x80000000) { + printk(OUR_NAME ": MMCR Aliasing enabled.\n"); + wdtmrctl = (__u16 *)(cbar & 0x3fffffff); + } else { + printk(OUR_NAME "!!! WARNING !!!\n" + "\t MMCR Aliasing found NOT enabled!\n" + "\t Using default value of: %p\n" + "\t This has not been tested!\n" + "\t Please email Scott Jennings \n" + "\t and Bill Jennings if it works!\n" + , MMCR_BASE_DEFAULT + ); + wdtmrctl = MMCR_BASE_DEFAULT; + } + + wdtmrctl = (__u16 *)((char *)wdtmrctl + OFFS_WDTMRCTL); + wdtmrctl = ioremap((unsigned long)wdtmrctl, 2); + printk(KERN_INFO OUR_NAME ": WDT driver for SC520 initialised.\n"); + + return 0; + +err_out_miscdev: + misc_deregister(&wdt_miscdev); +err_out_region2: + return rc; +} + +module_init(sc520_wdt_init); +module_exit(sc520_wdt_unload); + +MODULE_AUTHOR("Scott and Bill Jennings"); +MODULE_DESCRIPTION("Driver for watchdog timer in AMD \"Elan\" SC520 uProcessor"); +MODULE_LICENSE("GPL"); +EXPORT_NO_SYMBOLS; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/wafer5823wdt.c linux-2.5/drivers/char/wafer5823wdt.c --- bk-linus/drivers/char/wafer5823wdt.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5/drivers/char/wafer5823wdt.c 2002-11-21 17:57:49.000000000 +0000 @@ -0,0 +1,235 @@ +/* + * ICP Wafer 5823 Single Board Computer WDT driver for Linux 2.4.x + * http://www.icpamerica.com/wafer_5823.php + * May also work on other similar models + * + * (c) Copyright 2002 Justin Cormack + * + * Release 0.02 + * + * Based on advantechwdt.c which is based on wdt.c. + * Original copyright messages: + * + * (c) Copyright 1996-1997 Alan Cox , All Rights Reserved. + * http://www.redhat.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide + * warranty for any of this software. This material is provided + * "AS-IS" and at no charge. + * + * (c) Copyright 1995 Alan Cox + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static unsigned long wafwdt_is_open; +static spinlock_t wafwdt_lock; + +/* + * You must set these - there is no sane way to probe for this board. + * + * To enable, write the timeout value in seconds (1 to 255) to I/O + * port WDT_START, then read the port to start the watchdog. To pat + * the dog, read port WDT_STOP to stop the timer, then read WDT_START + * to restart it again. + */ + +#define WDT_START 0x443 +#define WDT_STOP 0x843 + +#define WD_TIMO 60 /* 1 minute */ +static int wd_margin = WD_TIMO; + +static void wafwdt_ping(void) +{ + /* pat watchdog */ + spin_lock(&wafwdt_lock); + inb_p(WDT_STOP); + inb_p(WDT_START); + spin_unlock(&wafwdt_lock); +} + +static void wafwdt_start(void) +{ + /* start up watchdog */ + outb_p(wd_margin, WDT_START); + inb_p(WDT_START); +} + +static void +wafwdt_stop(void) +{ + /* stop watchdog */ + inb_p(WDT_STOP); +} + +static ssize_t wafwdt_write(struct file *file, const char *buf, size_t count, loff_t * ppos) +{ + /* Can't seek (pwrite) on this device */ + if (ppos != &file->f_pos) + return -ESPIPE; + + if (count) { + wafwdt_ping(); + return 1; + } + return 0; +} + +static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg) +{ + int new_margin; + static struct watchdog_info ident = { + WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, + 1, "Wafer 5823 WDT" + }; + int one=1; + + switch (cmd) { + case WDIOC_GETSUPPORT: + if (copy_to_user + ((struct watchdog_info *) arg, &ident, sizeof (ident))) + return -EFAULT; + break; + + case WDIOC_GETSTATUS: + if (copy_to_user((int *) arg, &one, sizeof (int))) + return -EFAULT; + break; + + case WDIOC_KEEPALIVE: + wafwdt_ping(); + break; + + case WDIOC_SETTIMEOUT: + if (get_user(new_margin, (int *)arg)) + return -EFAULT; + if ((new_margin < 1) || (new_margin > 255)) + return -EINVAL; + wd_margin = new_margin; + wafwdt_stop(); + wafwdt_start(); + /* Fall */ + case WDIOC_GETTIMEOUT: + return put_user(wd_margin, (int *)arg); + + default: + return -ENOTTY; + } + return 0; +} + +static int wafwdt_open(struct inode *inode, struct file *file) +{ + if (test_and_set_bit(0, &wafwdt_is_open)) + return -EBUSY; + wafwdt_start(); + return 0; +} + +static int +wafwdt_close(struct inode *inode, struct file *file) +{ + clear_bit(0, &wafwdt_is_open); +#ifndef CONFIG_WATCHDOG_NOWAYOUT + wafwdt_stop(); +#endif + return 0; +} + +/* + * Notifier for system down + */ + +static int wafwdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused) +{ + if (code == SYS_DOWN || code == SYS_HALT) { + /* Turn the WDT off */ + wafwdt_stop(); + } + return NOTIFY_DONE; +} + +/* + * Kernel Interfaces + */ + +static struct file_operations wafwdt_fops = { + owner:THIS_MODULE, + write:wafwdt_write, + ioctl:wafwdt_ioctl, + open:wafwdt_open, + release:wafwdt_close, +}; + +static struct miscdevice wafwdt_miscdev = { + WATCHDOG_MINOR, + "watchdog", + &wafwdt_fops +}; + +/* + * The WDT needs to learn about soft shutdowns in order to + * turn the timebomb registers off. + */ + +static struct notifier_block wafwdt_notifier = { + wafwdt_notify_sys, + NULL, + 0 +}; + +static int __init wafwdt_init(void) +{ + printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n"); + + spin_lock_init(&wafwdt_lock); + if(!request_region(WDT_STOP, 1, "Wafer 5823 WDT")) + goto error; + if(!request_region(WDT_START, 1, "Wafer 5823 WDT")) + goto error2; + if(misc_register(&wafwdt_miscdev)<0) + goto error3; + register_reboot_notifier(&wafwdt_notifier); + return 0; +error3: + release_region(WDT_START, 1); +error2: + release_region(WDT_STOP, 1); +error: + return -ENODEV; +} + +static void __exit wafwdt_exit(void) +{ + misc_deregister(&wafwdt_miscdev); + unregister_reboot_notifier(&wafwdt_notifier); + release_region(WDT_STOP, 1); + release_region(WDT_START, 1); +} + +module_init(wafwdt_init); +module_exit(wafwdt_exit); + +MODULE_AUTHOR("Justin Cormack"); +MODULE_LICENSE("GPL"); +EXPORT_NO_SYMBOLS; + +/* end of wafer5823wdt.c */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/indydog.c linux-2.5/drivers/char/indydog.c --- bk-linus/drivers/char/indydog.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.5/drivers/char/indydog.c 2002-11-21 17:57:40.000000000 +0000 @@ -0,0 +1,155 @@ +/* + * IndyDog 0.2 A Hardware Watchdog Device for SGI IP22 + * + * (c) Copyright 2002 Guido Guenther , All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * based on softdog.c by Alan Cox + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static unsigned long indydog_alive; +static struct sgimc_misc_ctrl *mcmisc_regs; + +static void indydog_ping() +{ + mcmisc_regs->watchdogt = 0; +} + + +/* + * Allow only one person to hold it open + */ + +static int indydog_open(struct inode *inode, struct file *file) +{ + u32 mc_ctrl0; + + if( test_and_set_bit(0,&indydog_alive) ) + return -EBUSY; +#ifdef CONFIG_WATCHDOG_NOWAYOUT + MOD_INC_USE_COUNT; +#endif + /* + * Activate timer + */ + mcmisc_regs = (struct sgimc_misc_ctrl *)(KSEG1+0x1fa00000); + + mc_ctrl0 = mcmisc_regs->cpuctrl0 | SGIMC_CCTRL0_WDOG; + mcmisc_regs->cpuctrl0 = mc_ctrl0; + indydog_ping(); + + printk("Started watchdog timer.\n"); + return 0; +} + +static int indydog_release(struct inode *inode, struct file *file) +{ + /* + * Shut off the timer. + * Lock it in if it's a module and we defined ...NOWAYOUT + */ +#ifndef CONFIG_WATCHDOG_NOWAYOUT + { + u32 mc_ctrl0 = mcmisc_regs->cpuctrl0; + mc_ctrl0 &= ~SGIMC_CCTRL0_WDOG; + mcmisc_regs->cpuctrl0 = mc_ctrl0; + printk("Stopped watchdog timer.\n"); + } +#endif + clear_bit(0,&indydog_alive); + return 0; +} + +static ssize_t indydog_write(struct file *file, const char *data, size_t len, loff_t *ppos) +{ + /* Can't seek (pwrite) on this device */ + if (ppos != &file->f_pos) + return -ESPIPE; + + /* + * Refresh the timer. + */ + if(len) { + indydog_ping(); + return 1; + } + return 0; +} + +static int indydog_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) +{ + static struct watchdog_info ident = { + identity: "Hardware Watchdog for SGI IP22", + }; + switch (cmd) { + default: + return -ENOIOCTLCMD; + case WDIOC_GETSUPPORT: + if(copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) + return -EFAULT; + return 0; + case WDIOC_GETSTATUS: + case WDIOC_GETBOOTSTATUS: + return put_user(0,(int *)arg); + case WDIOC_KEEPALIVE: + indydog_ping(); + return 0; + } +} + +static struct file_operations indydog_fops = { + owner: THIS_MODULE, + write: indydog_write, + ioctl: indydog_ioctl, + open: indydog_open, + release: indydog_release, +}; + +static struct miscdevice indydog_miscdev = { + minor: WATCHDOG_MINOR, + name: "watchdog", + fops: &indydog_fops, +}; + +static const char banner[] __initdata = KERN_INFO "Hardware Watchdog Timer for SGI IP22: 0.2\n"; + +static int __init watchdog_init(void) +{ + int ret; + + ret = misc_register(&indydog_miscdev); + + if (ret) + return ret; + + printk(banner); + + return 0; +} + +static void __exit watchdog_exit(void) +{ + misc_deregister(&indydog_miscdev); +} + +module_init(watchdog_init); +module_exit(watchdog_exit); +MODULE_LICENSE("GPL"); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/pcwd.c linux-2.5/drivers/char/pcwd.c --- bk-linus/drivers/char/pcwd.c 2002-11-21 02:13:56.000000000 +0000 +++ linux-2.5/drivers/char/pcwd.c 2002-11-21 17:57:42.000000000 +0000 @@ -40,6 +40,8 @@ * fairly useless proc entry. * 990610 removed said useless proc code for the merge * 000403 Removed last traces of proc code. + * 011214 Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT + * Added timeout module option to override default */ #include @@ -76,7 +78,7 @@ */ static int pcwd_ioports[] = { 0x270, 0x350, 0x370, 0x000 }; -#define WD_VER "1.10 (06/05/99)" +#define WD_VER "1.12 (12/14/2001)" /* * It should be noted that PCWD_REVISION_B was removed because A and B @@ -88,7 +90,22 @@ static int pcwd_ioports[] = { 0x270, 0x3 #define PCWD_REVISION_A 1 #define PCWD_REVISION_C 2 -#define WD_TIMEOUT 3 /* 1 1/2 seconds for a timeout */ +#define WD_TIMEOUT 4 /* 2 seconds for a timeout */ +static int timeout_val = WD_TIMEOUT; +static int timeout = 2; + +MODULE_PARM(timeout,"i"); +MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default=2)"); + +#ifdef CONFIG_WATCHDOG_NOWAYOUT +static int nowayout = 1; +#else +static int nowayout = 0; +#endif + +MODULE_PARM(nowayout,"i"); +MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); + /* * These are the defines for the PC Watchdog card, revision A. @@ -121,7 +138,7 @@ static int __init pcwd_checkcard(void) if (prev_card_dat == 0xFF) return 0; - while(count < WD_TIMEOUT) { + while(count < timeout_val) { /* Read the raw card data from the port, and strip off the first 4 bits */ @@ -450,16 +467,16 @@ static int pcwd_close(struct inode *ino, { if (minor(ino->i_rdev)==WATCHDOG_MINOR) { -#ifndef CONFIG_WATCHDOG_NOWAYOUT - /* Disable the board */ - if (revision == PCWD_REVISION_C) { - spin_lock(&io_lock); - outb_p(0xA5, current_readport + 3); - outb_p(0xA5, current_readport + 3); - spin_unlock(&io_lock); + if (!nowayout) { + /* Disable the board */ + if (revision == PCWD_REVISION_C) { + spin_lock(&io_lock); + outb_p(0xA5, current_readport + 3); + outb_p(0xA5, current_readport + 3); + spin_unlock(&io_lock); + } + atomic_inc( &open_allowed ); } - atomic_inc( &open_allowed ); -#endif } return 0; } @@ -560,9 +577,15 @@ static struct miscdevice temp_miscdev = &pcwd_fops }; +static void __init pcwd_validate_timeout(void) +{ + timeout_val = timeout * 2; +} + static int __init pcwatchdog_init(void) { int i, found = 0; + pcwd_validate_timeout(); spin_lock_init(&io_lock); revision = PCWD_REVISION_A; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/sbus/char/riowatchdog.c linux-2.5/drivers/sbus/char/riowatchdog.c --- bk-linus/drivers/sbus/char/riowatchdog.c 2002-11-21 02:17:42.000000000 +0000 +++ linux-2.5/drivers/sbus/char/riowatchdog.c 2002-11-21 18:00:23.000000000 +0000 @@ -1,4 +1,4 @@ -/* $Id: riowatchdog.c,v 1.3 2001/10/08 22:19:51 davem Exp $ +/* $Id: riowatchdog.c,v 1.3.2.2 2002/01/23 18:48:02 davem Exp $ * riowatchdog.c - driver for hw watchdog inside Super I/O of RIO * * Copyright (C) 2001 David S. Miller (davem@redhat.com) @@ -127,8 +127,11 @@ static int riowd_release(struct inode *i static int riowd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - static struct watchdog_info info = { 0, 0, "Natl. Semiconductor PC97317" }; + static struct watchdog_info info = { + WDIOF_SETTIMEOUT, 0, "Natl. Semiconductor PC97317" + }; unsigned int options; + int new_margin; switch (cmd) { case WDIOC_GETSUPPORT: @@ -159,6 +162,18 @@ static int riowd_ioctl(struct inode *ino break; + case WDIOC_SETTIMEOUT: + if (get_user(new_margin, (int *)arg)) + return -EFAULT; + if ((new_margin < 60) || (new_margin > (255 * 60))) + return -EINVAL; + riowd_timeout = (new_margin + 59) / 60; + riowd_pingtimer(); + /* Fall */ + + case WDIOC_GETTIMEOUT: + return put_user(riowd_timeout * 60, (int *)arg); + default: return -EINVAL; }; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/x86_64/kernel/setup.c linux-2.5/arch/x86_64/kernel/setup.c --- bk-linus/arch/x86_64/kernel/setup.c 2002-11-21 02:12:59.000000000 +0000 +++ linux-2.5/arch/x86_64/kernel/setup.c 2002-11-21 17:57:06.000000000 +0000 @@ -617,7 +617,7 @@ void __init identify_cpu(struct cpuinfo_ void __init print_cpu_info(struct cpuinfo_x86 *c) { if (c->x86_model_id[0]) - printk("AMD %s", c->x86_model_id); + printk("%s", c->x86_model_id); if (c->x86_mask || c->cpuid_level >= 0) printk(" stepping %02x\n", c->x86_mask); diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/ftape/lowlevel/ftape-calibr.c linux-2.5/drivers/char/ftape/lowlevel/ftape-calibr.c --- bk-linus/drivers/char/ftape/lowlevel/ftape-calibr.c 2002-11-21 02:14:10.000000000 +0000 +++ linux-2.5/drivers/char/ftape/lowlevel/ftape-calibr.c 2002-11-21 17:57:55.000000000 +0000 @@ -31,7 +31,10 @@ #include #if defined(__alpha__) # include -#elif defined(__i386__) || defined(__x86_64__) +#elif defined(__x86_64__) +# include +# include +#elif defined(__i386__) # include #endif #include @@ -45,10 +48,14 @@ # error Ftape is not implemented for this architecture! #endif -#if defined(__alpha__) +#if defined(__alpha__) || defined(__x86_64__) static unsigned long ps_per_cycle = 0; #endif +#if defined(__i386__) +extern spinlock_t i8253_lock; +#endif + /* * Note: On Intel PCs, the clock ticks at 100 Hz (HZ==100) which is * too slow for certain timeouts (and that clock doesn't even tick @@ -67,48 +74,58 @@ unsigned int ftape_timestamp(void) { #if defined(__alpha__) unsigned long r; - asm volatile ("rpcc %0" : "=r" (r)); return r; -#elif defined(__i386__) || defined(__x86_64__) +#elif defined(__x86_64__) + unsigned long r; + rdtscl(r); + return r; +#elif defined(__i386__) + +/* + * Note that there is some time between counter underflowing and jiffies + * increasing, so the code below won't always give correct output. + * -Vojtech + */ + unsigned long flags; __u16 lo; __u16 hi; - save_flags(flags); - cli(); + spin_lock_irqsave(&i8253_lock, flags); outb_p(0x00, 0x43); /* latch the count ASAP */ lo = inb_p(0x40); /* read the latched count */ lo |= inb(0x40) << 8; hi = jiffies; - restore_flags(flags); + spin_unlock_irqrestore(&i8253_lock, flags); + return ((hi + 1) * (unsigned int) LATCH) - lo; /* downcounter ! */ #endif } static unsigned int short_ftape_timestamp(void) { -#if defined(__alpha__) +#if defined(__alpha__) || defined(__x86_64__) return ftape_timestamp(); -#elif defined(__i386__) || defined(__x86_64__) +#elif defined(__i386__) unsigned int count; unsigned long flags; - save_flags(flags); - cli(); + spin_lock_irqsave(&i8253_lock, flags); outb_p(0x00, 0x43); /* latch the count ASAP */ count = inb_p(0x40); /* read the latched count */ count |= inb(0x40) << 8; - restore_flags(flags); + spin_unlock_irqrestore(&i8253_lock, flags); + return (LATCH - count); /* normal: downcounter */ #endif } static unsigned int diff(unsigned int t0, unsigned int t1) { -#if defined(__alpha__) - return (t1 <= t0) ? t1 + (1UL << 32) - t0 : t1 - t0; -#elif defined(__i386__) || defined(__x86_64__) +#if defined(__alpha__) || defined(__x86_64__) + return (t1 - t0); +#elif defined(__i386__) /* * This is tricky: to work for both short and full ftape_timestamps * we'll have to discriminate between these. @@ -122,9 +139,9 @@ static unsigned int diff(unsigned int t0 static unsigned int usecs(unsigned int count) { -#if defined(__alpha__) +#if defined(__alpha__) || defined(__x86_64__) return (ps_per_cycle * count) / 1000000UL; -#elif defined(__i386__) || defined(__x86_64__) +#elif defined(__i386__) return (10000 * count) / ((CLOCK_TICK_RATE + 50) / 100); #endif } @@ -153,49 +170,24 @@ static void time_inb(void) save_flags(flags); cli(); t0 = short_ftape_timestamp(); - for (i = 0; i < 1000; ++i) { + for (i = 0; i < 1000; ++i) status = inb(fdc.msr); - } t1 = short_ftape_timestamp(); restore_flags(flags); + TRACE(ft_t_info, "inb() duration: %d nsec", ftape_timediff(t0, t1)); TRACE_EXIT; } static void init_clock(void) { -#if defined(__i386__) || defined(__x86_64__) - unsigned int t; - int i; TRACE_FUN(ft_t_any); - /* Haven't studied on why, but there sometimes is a problem - * with the tick timer readout. The two bytes get swapped. - * This hack solves that problem by doing one extra input. - */ - for (i = 0; i < 1000; ++i) { - t = short_ftape_timestamp(); - if (t > LATCH) { - inb_p(0x40); /* get in sync again */ - TRACE(ft_t_warn, "clock counter fixed"); - break; - } - } +#if defined(__x86_64__) + ps_per_cycle = 1000000000UL / cpu_khz; #elif defined(__alpha__) -#if CONFIG_FT_ALPHA_CLOCK == 0 -#error You must define and set CONFIG_FT_ALPHA_CLOCK in 'make config' ! -#endif extern struct hwrpb_struct *hwrpb; - TRACE_FUN(ft_t_any); - - if (hwrpb->cycle_freq != 0) { - ps_per_cycle = (1000*1000*1000*1000UL) / hwrpb->cycle_freq; - } else { - /* - * HELP: Linux 2.0.x doesn't set cycle_freq on my noname ! - */ - ps_per_cycle = (1000*1000*1000*1000UL) / CONFIG_FT_ALPHA_CLOCK; - } + ps_per_cycle = (1000*1000*1000*1000UL) / hwrpb->cycle_freq; #endif TRACE_EXIT; } @@ -214,7 +206,7 @@ void ftape_calibrate(char *name, unsigned int tc = 0; unsigned int count; unsigned int time; -#if defined(__i386__) || defined(__x86_64__) +#if defined(__i386__) unsigned int old_tc = 0; unsigned int old_count = 1; unsigned int old_time = 1; @@ -257,15 +249,14 @@ void ftape_calibrate(char *name, tc = (1000 * time) / (count - 1); TRACE(ft_t_any, "once:%3d us,%6d times:%6d us, TC:%5d ns", usecs(once), count - 1, usecs(multiple), tc); -#if defined(__alpha__) +#if defined(__alpha__) || defined(__x86_64__) /* * Increase the calibration count exponentially until the * calibration time exceeds 100 ms. */ - if (time >= 100*1000) { + if (time >= 100*1000) break; - } -#elif defined(__i386__) || defined(__x86_64__) +#elif defined(__i386__) /* * increase the count until the resulting time nears 2/HZ, * then the tc will drop sharply because we lose LATCH counts. diff -urpN --exclude-from=/home/davej/.exclude bk-linus/ipc/util.c linux-2.5/ipc/util.c --- bk-linus/ipc/util.c 2002-11-21 02:24:36.000000000 +0000 +++ linux-2.5/ipc/util.c 2002-11-21 18:05:15.000000000 +0000 @@ -491,6 +491,10 @@ int ipc_checkid(struct ipc_ids* ids, str int ipc_parse_version (int *cmd) { +#ifdef __x86_64__ + if (!(current->thread.flags & THREAD_IA32)) + return IPC_64; +#endif if (*cmd & IPC_64) { *cmd ^= IPC_64; return IPC_64; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/x86_64/kernel/mtrr.c linux-2.5/arch/x86_64/kernel/mtrr.c --- bk-linus/arch/x86_64/kernel/mtrr.c 2002-11-21 02:12:59.000000000 +0000 +++ linux-2.5/arch/x86_64/kernel/mtrr.c 2002-11-21 17:57:06.000000000 +0000 @@ -1223,17 +1223,17 @@ static void __init mtrr_setup (void) if (!cpu_has_mtrr || boot_cpu_data.x86_vendor != X86_VENDOR_AMD) return; - /* Query the width (in bits) of the physical - addressable memory on the Hammer family. */ - if ((cpuid_eax (0x80000000) >= 0x80000008)) { - u32 phys_addr; - phys_addr = cpuid_eax (0x80000008) & 0xff; - size_or_mask = ~((1L << phys_addr) - 1); - /* - * top bits MBZ as its beyond the addressable range. - * bottom bits MBZ as we don't care about lower 12 bits of addr. - */ - size_and_mask = (~size_or_mask) & 0x000ffffffffff000L; + /* Query the width (in bits) of the physical + addressable memory on the Hammer family. */ + if ((cpuid_eax (0x80000000) >= 0x80000008)) { + u32 phys_addr; + phys_addr = cpuid_eax (0x80000008) & 0xff; + size_or_mask = ~((1L << phys_addr) - 1); + /* + * top bits MBZ as its beyond the addressable range. + * bottom bits MBZ as we don't care about lower 12 bits of addr. + */ + size_and_mask = (~size_or_mask) & 0x000ffffffffff000L; } } @@ -1251,27 +1251,27 @@ void mtrr_init_cpu(int cpu) mtrr_setup(); #else if (cpu == 0) { - mtrr_setup(); - get_mtrr_state (&smp_mtrr_state); + mtrr_setup(); + get_mtrr_state (&smp_mtrr_state); } else { - u64 mask; - int count; - struct set_mtrr_context ctxt; + u64 mask; + int count; + struct set_mtrr_context ctxt; /* Note that this is not ideal, since the cache is only flushed/disabled for this CPU while the MTRRs are changed, but changing this requires more invasive changes to the way the kernel boots */ - set_mtrr_prepare (&ctxt); - mask = set_mtrr_state (&smp_mtrr_state, &ctxt); - set_mtrr_done (&ctxt); + set_mtrr_prepare (&ctxt); + mask = set_mtrr_state (&smp_mtrr_state, &ctxt); + set_mtrr_done (&ctxt); - /* Use the atomic bitops to update the global mask */ + /* Use the atomic bitops to update the global mask */ for (count = 0; count < (sizeof mask) * 8; ++count) { if (mask & 1) - set_bit (count, &smp_changes_mask); - mask >>= 1; - } + set_bit (count, &smp_changes_mask); + mask >>= 1; + } } #endif } diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/asm-x86_64/mtrr.h linux-2.5/include/asm-x86_64/mtrr.h --- bk-linus/include/asm-x86_64/mtrr.h 2002-11-21 02:23:41.000000000 +0000 +++ linux-2.5/include/asm-x86_64/mtrr.h 2002-11-21 18:04:35.000000000 +0000 @@ -30,15 +30,15 @@ struct mtrr_sentry { - __u64 base; /* Base address */ - __u32 size; /* Size of region */ + unsigned long base; /* Base address */ + unsigned int size; /* Size of region */ unsigned int type; /* Type of region */ }; struct mtrr_gentry { - __u64 base; /* Base address */ - __u32 size; /* Size of region */ + unsigned long base; /* Base address */ + unsigned int size; /* Size of region */ unsigned int regnum; /* Register number */ unsigned int type; /* Type of region */ }; @@ -79,6 +79,7 @@ static char *mtrr_strings[MTRR_NUM_TYPES #endif #ifdef __KERNEL__ +#include /* The following functions are for use by other drivers */ #ifdef CONFIG_MTRR diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/video/zr36067.c linux-2.5/drivers/media/video/zr36067.c --- bk-linus/drivers/media/video/zr36067.c 2002-11-21 02:15:47.000000000 +0000 +++ linux-2.5/drivers/media/video/zr36067.c 2002-11-21 17:58:57.000000000 +0000 @@ -3758,7 +3762,7 @@ static int do_zoran_ioctl(struct zoran * * Write the overlay mask if clips are wanted. */ - if (vw.clipcount > 2048) + if (vw.clipcount < 0 || vw.clipcount > 2048) return -EINVAL; if (vw.clipcount) { vcp = diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/video/zr36067.c linux-2.5/drivers/media/video/zr36067.c --- bk-linus/drivers/media/video/zr36067.c 2002-11-21 02:15:47.000000000 +0000 +++ linux-2.5/drivers/media/video/zr36067.c 2002-11-21 17:58:57.000000000 +0000 @@ -3264,7 +3264,10 @@ static int zoran_open(struct video_devic btwrite(IRQ_MASK, ZR36057_ISR); // Clears interrupts btor(ZR36057_ICR_IntPinEn, ZR36057_ICR); - dev->busy = 0; /* Allow second open */ + /* FIXME: Don't do it this way, use the + * video_device->fops registration for a sane + * implementation of multiple opens */ + dev->users--; /* Allow second open */ } break; @@ -3322,6 +3325,7 @@ static void zoran_close(struct video_dev } } + dev->users++; zr->user--; MOD_DEC_USE_COUNT; diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/media/video/zr36067.c linux-2.5/drivers/media/video/zr36067.c --- bk-linus/drivers/media/video/zr36067.c 2002-11-21 02:15:47.000000000 +0000 +++ linux-2.5/drivers/media/video/zr36067.c 2002-11-21 17:58:57.000000000 +0000 @@ -4158,7 +4162,6 @@ static int do_zoran_ioctl(struct zoran * { struct zoran_status bs; int norm, input, status; - unsigned long timeout; if (zr->codec_mode != BUZ_MODE_IDLE) { DEBUG1(printk(KERN_ERR @@ -4204,9 +4207,8 @@ static int do_zoran_ioctl(struct zoran * /* sleep 1 second */ - timeout = jiffies + 1 * HZ; - while (jiffies < timeout) - schedule(); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(HZ); /* Get status of video decoder */