]> git.neil.brown.name Git - history.git/commitdiff
Import 2.3.39pre1 2.3.39pre1
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:29:59 +0000 (15:29 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:29:59 +0000 (15:29 -0500)
53 files changed:
CREDITS
Documentation/Configure.help
Documentation/paride.txt
Documentation/video4linux/bttv/CARDLIST
Documentation/video4linux/bttv/README
Makefile
arch/ppc/Makefile
arch/ppc/coffboot/chrpmain.c
arch/ppc/coffboot/coffmain.c
arch/ppc/kernel/open_pic.c
arch/ppc/kernel/pci.c
arch/ppc/kernel/pmac_nvram.c
arch/ppc/kernel/pmac_time.c
arch/ppc/mm/init.c
drivers/block/cy82c693.c
drivers/char/bttv.c
drivers/char/bttv.h
drivers/char/msp3400.c
drivers/char/stradis.c
drivers/char/tda8425.c
drivers/char/tda9855.c
drivers/char/tea6300.c
drivers/net/pcmcia/tulip_cb.c
drivers/net/tlan.c
drivers/net/tlan.h
drivers/net/wan/z85230.c
drivers/pci/pci.c
drivers/pci/pcisyms.c
drivers/pci/proc.c
drivers/pcmcia/cardbus.c
drivers/pnp/Makefile
drivers/pnp/isapnp.c
drivers/pnp/isapnp_proc.c
drivers/scsi/ChangeLog.ncr53c8xx
drivers/scsi/ChangeLog.sym53c8xx
drivers/scsi/ncr53c8xx.c
drivers/scsi/qlogicisp.c
drivers/scsi/scsi_merge.c
drivers/scsi/sym53c8xx.c
drivers/scsi/sym53c8xx.h
drivers/scsi/sym53c8xx_defs.h
drivers/video/atyfb.c
fs/ext2/fsync.c
fs/ext2/inode.c
fs/iobuf.c
fs/proc/proc_devtree.c
fs/proc/procfs_syms.c
include/linux/isapnp.h
include/linux/pci.h
include/linux/proc_fs.h
include/linux/sched.h
include/net/pkt_sched.h
lib/string.c

diff --git a/CREDITS b/CREDITS
index 300de0b71302edc7b512446870173d9249effcdd..85815be557e0306d8534dc3f77afb70398828d73 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -539,6 +539,15 @@ S: Virginia Tech
 S: Blacksburg, Virginia 24061
 S: USA
 
+N: Randy Dunlap
+E: randy.dunlap@intel.com
+W: http://home.att.net/~randy.dunlap/
+W: http://www.linux-usb.org
+D: Linux-USB subsystem, USB core/UHCI/printer/storage drivers
+S: 5200 NE Elam Young Pkwy., M/S HF3-77
+S: Hillsboro, Oregon 97124
+S: USA
+
 N: Cyrus Durgin
 E: cider@speakeasy.org
 W: http://www.speakeasy.org/~cider/
@@ -1039,12 +1048,14 @@ S: USA
 
 N: Dave Jones
 E: dave@powertweak.com
+E: djones2@glam.ac.uk
 W: http://linux.powertweak.com
-D: Centaur/IDT Winchip/Winchip 2 tweaks
+D: Moved PCI bridge tuning to userspace (Powertweak).
+D: Centaur/IDT Winchip/Winchip 2 tweaks.
 D: Misc clean ups and other random hacking.
-S: 40, Heol Edward Lewis,
-S: Gelligaer, Hengoed,
-S: Mid Glamorgan, CF82 8EJ,
+S: 28, Laura Street,
+S: Treforest, Pontypridd,
+S: Mid Glamorgan, CF37 1NW,
 S: Wales, United Kingdom
 
 N: Bernhard Kaindl
index 8b0fdfd2dc87b48e4cc807431103833bcbee8286..5895eecb285bbccd2801ecca96b3f0293c4faf73 100644 (file)
@@ -7308,7 +7308,7 @@ CONFIG_TLAN
   module, say M here and read Documentation/modules.txt as well as
   Documentation/networking/net-modules.txt.
 
-  Please email feedback to james.banks@caldera.com.
+  Please email feedback to torben.mathiasen@compaq.com.
 
 VIA Rhine support
 CONFIG_VIA_RHINE
index cef4600cae675005e63e6d5a79b8146b35b733f3..e4312676bdda71e997a8059b3e085e44ff209189 100644 (file)
@@ -356,7 +356,7 @@ the parallel port.  As the reset operation is potentially disruptive in
 multiple device environments, the PARIDE drivers will not do it 
 automatically.  You can however, force a printer reset by doing:
 
-       insmod lp
+       insmod lp reset=1
        rmmod lp
 
 If you have one of these marginal cases, you should probably build
index 5fd5b826bc775bbfcfe49abed6118d3cda4288d8..0176ecf0ea9063b9dafb9db9e34fbc66ff735157 100644 (file)
@@ -23,7 +23,7 @@ bttv.o
   card=21 - Lucky Star Image World ConferenceTV
   card=22 - Phoebe Tv Master + FM
   card=23 - Modular Technology MM205 PCTV, bt878
-  card=24 - Magic TView CPH061 (bt878)
+  card=24 - Askey/Typhoon/Anubis Magic TView CPH051/061 (bt878)
   card=25 - Terratec/Vobis TV-Boostar
   card=26 - Newer Hauppauge WinCam (bt878)
   card=27 - MAXI TV Video PCI2
@@ -32,8 +32,7 @@ bttv.o
   card=30 - FlyVideo 98
   card=31 - iProTV
   card=32 - Intel Create and Share PCI
-  card=33 - Askey/Typhoon/Anubis Magic TView
-  card=34 - Terratec TerraTValue
+  card=33 - Terratec TerraTValue
 
 tuner.o
   type=0 - Temic PAL
index 00b23c52ae283a20f883b1ca9f9a691dfd4edc31..8b9170e3d8a6f7601cd1c8853a80e5c408894a83 100644 (file)
@@ -49,7 +49,7 @@ Insmod-options:       list of all insmod options available for bttv and
 MAKEDEV:       a script to create the special files for v4l
 CARDLIST:      List of all supported cards
 
-Loading just the bttv modules isn't enough for most cards.  The
+Loading just the bttv modules isn't enouth for most cards.  The
 drivers for the i2c tuner/sound chips must also be loaded.  bttv tries
 to load them automagically by calling request_module() now, but this
 obviously works only with kmod enabled.
index 26d3914468893565fa27caaa1b95d1cf1b928615..a1127ee5b83f963e1354e4d97800844d1f2ecced 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -203,7 +203,7 @@ DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a
 endif
 
 ifeq ($(CONFIG_PNP),y)
-DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
+DRIVERS := $(DRIVERS) drivers/pnp/isa-pnp.o
 endif
 
 ifdef CONFIG_SGI
@@ -227,7 +227,7 @@ DRIVERS := $(DRIVERS) drivers/tc/tc.a
 endif
 
 ifeq ($(CONFIG_USB),y)
-DRIVERS := $(DRIVERS) drivers/usb/usb.a
+DRIVERS := $(DRIVERS) drivers/usb/usbdrv.o
 endif
 
 ifeq ($(CONFIG_I2O),y)
index 6552a7140f67b11edbe1f024cce647a594485679..d62c076690a6799d87e13ef8f9589c9a0550664c 100644 (file)
@@ -155,9 +155,6 @@ oak_config: clean_config
 walnut_config: clean_config
        ln -s configs/walnut_defconfig arch/ppc/defconfig
 
-tags:
-       etags */*.c include/{asm,linux}/*.h arch/ppc/kernel/*.{c,h}
-
 archclean:
        rm -f arch/ppc/kernel/{mk_defs,ppc_defs.h,find_name,checks}
        @$(MAKECOFFBOOT) clean
index fc5648944b24b8463b620f24c76d29b717b2d31b..bffb9d9eeb7a5eb79a8ceda963f87331480a6373 100644 (file)
@@ -10,7 +10,6 @@
 #include "zlib.h"
 #include <asm/bootinfo.h>
 #include <asm/processor.h>
-#define __KERNEL__
 #include <asm/page.h>
 
 extern void *finddevice(const char *);
index 2bb4ea31d1125270f654067b836f22792afc6367..b76ba5976d9b4579f932cc5bd7e4edd7449ac17c 100644 (file)
@@ -10,7 +10,6 @@
 #include "zlib.h"
 #include <asm/bootinfo.h>
 #include <asm/processor.h>
-#define __KERNEL__
 #include <asm/page.h>
 
 extern void *finddevice(const char *);
index 02e276729021ea37b9e2835d6cdc8e7ac89ae321..6857aa36f20047be08bbd4ef9d6876f635f89c27 100644 (file)
@@ -38,6 +38,7 @@ struct hw_interrupt_type open_pic = {
        0,
        0
 };
+int open_pic_irq_offset;
 
 /*
  *  Accesses to the current processor's registers
@@ -69,7 +70,7 @@ struct hw_interrupt_type open_pic = {
  *   -- Cort
  */ 
 #define check_arg_irq(irq) \
-    /*if (irq < 0 || irq >= (NumSources+open_pic.irq_offset)) \
+    /*if (irq < 0 || irq >= (NumSources+open_pic_irq_offset)) \
       printk("openpic.c:%d: illegal irq %d\n", __LINE__, irq);*/
 #define check_arg_cpu(cpu) \
     if (cpu < 0 || cpu >= NumProcessors) \
@@ -212,11 +213,11 @@ void __init openpic_init(int main_pic)
                /* Initialize external interrupts */
                if ( ppc_md.progress ) ppc_md.progress("openpic ext",0x3bc);
                /* SIOint (8259 cascade) is special */
-               openpic_initirq(0, 8, open_pic.irq_offset, 1, 1);
+               openpic_initirq(0, 8, open_pic_irq_offset, 1, 1);
                openpic_mapirq(0, 1<<0);
                for (i = 1; i < NumSources; i++) {
                        /* Enabled, Priority 8 */
-                       openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
+                       openpic_initirq(i, 8, open_pic_irq_offset+i, 0,
                                        i < OpenPIC_NumInitSenses ? OpenPIC_InitSenses[i] : 1);
                        /* Processor 0 */
                        openpic_mapirq(i, 1<<0);
@@ -416,13 +417,13 @@ void openpic_maptimer(u_int timer, u_int cpumask)
 void openpic_enable_irq(u_int irq)
 {
        check_arg_irq(irq);
-       openpic_clearfield(&OpenPIC->Source[irq-irq_desc[irq].handler->irq_offset].Vector_Priority, OPENPIC_MASK);
+       openpic_clearfield(&OpenPIC->Source[irq - open_pic_irq_offset].Vector_Priority, OPENPIC_MASK);
 }
 
 void openpic_disable_irq(u_int irq)
 {
        check_arg_irq(irq);
-       openpic_setfield(&OpenPIC->Source[irq-irq_desc[irq].handler->irq_offset].Vector_Priority, OPENPIC_MASK);
+       openpic_setfield(&OpenPIC->Source[irq - open_pic_irq_offset].Vector_Priority, OPENPIC_MASK);
 }
 
 /*
index ec1ff356538c79a2f3110a746f768b9da4d497a9..6c98bbf2c4d7474628b7f3521cf76e74c8192180 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/openpic.h>
+#include <linux/errno.h>
 
 #include <asm/processor.h>
 #include <asm/io.h>
@@ -21,7 +22,7 @@
 
 #include "pci.h"
 
-static void __init pcibios_claim_resources(struct pci_bus *);
+static void __init pcibios_claim_resources(struct list_head *);
 
 unsigned long isa_io_base     = 0;
 unsigned long isa_mem_base    = 0;
@@ -69,10 +70,9 @@ struct pci_ops generic_pci_ops =
 void __init pcibios_init(void)
 {
        printk("PCI: Probing PCI hardware\n");
-       ioport_resource.end = ~0L;
        pci_scan_bus(0, &generic_pci_ops, NULL);
-       pcibios_claim_resources(pci_root);
-       if ( ppc_md.pcibios_fixup )
+       pcibios_claim_resources(&pci_root_buses);
+       if (ppc_md.pcibios_fixup)
                ppc_md.pcibios_fixup();
 }
 
@@ -162,3 +162,75 @@ void __init
 pcibios_align_resource(void *data, struct resource *res, unsigned long size)
 {
 }
+
+int pcibios_enable_device(struct pci_dev *dev)
+{
+       u16 cmd, old_cmd;
+       int idx;
+       struct resource *r;
+
+       pci_read_config_word(dev, PCI_COMMAND, &cmd);
+       old_cmd = cmd;
+       for (idx=0; idx<6; idx++) {
+               r = &dev->resource[idx];
+               if (!r->start && r->end) {
+                       printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", dev->slot_name);
+                       return -EINVAL;
+               }
+               if (r->flags & IORESOURCE_IO)
+                       cmd |= PCI_COMMAND_IO;
+               if (r->flags & IORESOURCE_MEM)
+                       cmd |= PCI_COMMAND_MEMORY;
+       }
+       if (cmd != old_cmd) {
+               printk("PCI: Enabling device %s (%04x -> %04x)\n",
+                      dev->slot_name, old_cmd, cmd);
+               pci_write_config_word(dev, PCI_COMMAND, cmd);
+       }
+       return 0;
+}
+
+/*
+ * Assign new address to PCI resource.  We hope our resource information
+ * is complete.  We don't re-assign resources unless we are
+ * forced to do so.
+ *
+ * Expects start=0, end=size-1, flags=resource type.
+ */
+
+int pci_assign_resource(struct pci_dev *dev, int i)
+{
+       struct resource *r = &dev->resource[i];
+       struct resource *pr = pci_find_parent_resource(dev, r);
+       unsigned long size = r->end + 1;
+       u32 new, check;
+
+       if (!pr) {
+               printk(KERN_ERR "PCI: Cannot find parent resource for device %s\n", dev->slot_name);
+               return -EINVAL;
+       }
+       if (r->flags & IORESOURCE_IO) {
+               if (allocate_resource(pr, r, size, 0x100, ~0, size, NULL, NULL)) {
+                       printk(KERN_ERR "PCI: Allocation of I/O region %s/%d (%ld bytes) failed\n", dev->slot_name, i, size);
+                       return -EBUSY;
+               }
+       } else {
+               if (allocate_resource(pr, r, size, 0x10000, ~0, size, NULL, NULL)) {
+                       printk(KERN_ERR "PCI: Allocation of memory region %s/%d (%ld bytes) failed\n", dev->slot_name, i, size);
+                       return -EBUSY;
+               }
+       }
+       if (i < 6) {
+               int reg = PCI_BASE_ADDRESS_0 + 4*i;
+               new = r->start | (r->flags & PCI_REGION_FLAG_MASK);
+               pci_write_config_dword(dev, reg, new);
+               pci_read_config_dword(dev, reg, &check);
+               if (new != check)
+                       printk(KERN_ERR "PCI: Error while updating region %s/%d (%08x != %08x)\n", dev->slot_name, i, new, check);
+       } else if (i == PCI_ROM_RESOURCE) {
+               r->flags |= PCI_ROM_ADDRESS_ENABLE;
+               pci_write_config_dword(dev, dev->rom_base_reg, r->start | (r->flags & PCI_REGION_FLAG_MASK));
+       }
+       printk("PCI: Assigned addresses %08lx-%08lx to region %s/%d\n", r->start, r->end, dev->slot_name, i);
+       return 0;
+}
index 99bfa4f8b8f8ad481362b9c43df97f74f5ec2f41..ea3338aefb3bc77e68db2c1892cc93f74e6befb7 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/prom.h>
+#include <asm/machdep.h>
 #include <linux/adb.h>
 #include <linux/pmu.h>
 
index 60b497cd6568b47cb0a34d626f14d64acfaa53e3..3b7dd283f9d5a20afc34b0dc80693d0e01f75150 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/system.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
+#include <asm/machdep.h>
 
 #include "time.h"
 
index 34117098e402d42d34a8227bebe4e589f54776ca..f2a5e78aeb25699f4bc72ac58938e9066feb5f30 100644 (file)
@@ -339,9 +339,7 @@ void si_meminfo(struct sysinfo *val)
                        continue;
                val->sharedram += atomic_read(&mem_map[i].count) - 1;
        }
-       val->totalram <<= PAGE_SHIFT;
-       val->sharedram <<= PAGE_SHIFT;
-       return;
+       val->mem_unit = PAGE_SIZE;
 }
 
 void *
@@ -1037,29 +1035,21 @@ unsigned long __init find_available_memory(void)
  */
 void __init paging_init(void)
 {
+       unsigned int zones_size[MAX_NR_ZONES], i;
+
        /*
         * Grab some memory for bad_page and bad_pagetable to use.
         */
        empty_bad_page = alloc_bootmem_pages(PAGE_SIZE);
        empty_bad_page_table = alloc_bootmem_pages(PAGE_SIZE);
-       {
-               unsigned int zones_size[MAX_NR_ZONES], i;
-               /*
-                * All pages are DMA-able so this is wrong - the zone code is
-                * assuming both regions have a value so this is necessary for
-                * now.
-                * -- Cort
-                */
-#if 1
-               for ( i = 1; i < MAX_NR_ZONES; i++ )
-                       zones_size[i] = 1<<MAX_ORDER;
-               zones_size[0] = (virt_to_phys(end_of_DRAM) >> PAGE_SHIFT) -
-                       ((MAX_NR_ZONES-1)*(1<<MAX_ORDER));
-#else
-               zones_size[0] = virt_to_phys(end_of_DRAM) >> PAGE_SHIFT;
-#endif
-               free_area_init(zones_size);
-       }
+
+       /*
+        * All pages are DMA-able so we put them all in the DMA zone.
+        */
+       zones_size[0] = virt_to_phys(end_of_DRAM) >> PAGE_SHIFT;
+       for (i = 1; i < MAX_NR_ZONES; i++)
+               zones_size[i] = 0;
+       free_area_init(zones_size);
 }
 
 void __init mem_init(void)
index 8756713ac91e362a597bbcfa219afa0ffb6aac95..e073fb0d8f9e3550d551de345a02a7f177194fb2 100644 (file)
@@ -275,9 +275,9 @@ static void cy82c693_tune_drive (ide_drive_t *drive, byte pio)
 
        /* select primary or secondary channel */
        if (hwif->index > 0) {  /* drive is on the secondary channel */
-               dev = pci_find_slot(dev, dev->devfn+1);
+               dev = pci_find_slot(dev->bus->number, dev->devfn+1);
                if (!dev) {
-                       printk(KERN_ERR "%s: tune_drive: Cannot find secondary interface!\n");
+                       printk(KERN_ERR "%s: tune_drive: Cannot find secondary interface!\n", drive->name);
                        return;
                }
        }
index 379a7b9299e9f24867a5d1e4e19872e898601c03..3f75d721a5945e368eac6aa30bd7047d4be55283 100644 (file)
@@ -386,7 +386,7 @@ static int init_bttv_i2c(struct bttv *btv)
 
        bttv_bit_setscl(btv,1);
        bttv_bit_setsda(btv,1);
-       
+
        return i2c_bit_add_bus(&btv->i2c_adap);
 }
 
@@ -428,15 +428,15 @@ static int I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
 }
 
 /* read EEPROM */
-static void readee(struct bttv *btv, unsigned char *eedata)
+static void readee(struct bttv *btv, unsigned char *eedata, int addr)
 {
        int i;
         
-       if (I2CWrite(btv, 0xa0, 0, -1, 0)<0) {
+       if (I2CWrite(btv, addr, 0, -1, 0)<0) {
                printk(KERN_WARNING "bttv: readee error\n");
                return;
        }
-       btv->i2c_client.addr = 0xa0 >> 1;
+       btv->i2c_client.addr = addr >> 1;
        for (i=0; i<256; i+=16) {
                if (16 != i2c_master_recv(&btv->i2c_client,eedata+i,16)) {
                        printk(KERN_WARNING "bttv: readee error\n");
@@ -486,7 +486,7 @@ hauppauge_tuner[] =
 static void
 hauppauge_eeprom(struct bttv *btv)
 {
-        readee(btv, eeprom_data);
+        readee(btv, eeprom_data, 0xa0);
         if (eeprom_data[9] < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) 
         {
                 btv->tuner_type = hauppauge_tuner[eeprom_data[9]].id;
@@ -515,7 +515,10 @@ hauppauge_msp_reset(struct bttv *btv)
  *  driver, but using BTTV functions */
 static void init_PXC200(struct bttv *btv)
 {
-       int tmp;
+       static const int vals[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
+                                   0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
+                                   0x00 };
+       int i,tmp;
 
        /*      Initialise GPIO-connevted stuff */
        btwrite(1<<13,BT848_GPIO_OUT_EN); /* Reset pin only */
@@ -537,39 +540,37 @@ static void init_PXC200(struct bttv *btv)
         *      argument so the numbers are different */
        
        printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
-       
-       tmp=I2CWrite(btv,0x1E,0x08,0,1);
-       printk(KERN_INFO "I2C Write(0x08) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x09,0,1);
-       printk(KERN_INFO "I2C Write(0x09) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x0a,0,1);
-       printk(KERN_INFO "I2C Write(0x0a) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x0b,0,1);
-       printk(KERN_INFO "I2C Write(0x0b) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x0c,0,1);
-       printk(KERN_INFO "I2C Write(0x0c) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x0d,0,1);
-       printk(KERN_INFO "I2C Write(0x0d) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x01,0,1);
-       printk(KERN_INFO "I2C Write(0x01) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x02,0,1);
-       printk(KERN_INFO "I2C Write(0x02) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x03,0,1);
-       printk(KERN_INFO "I2C Write(0x03) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x04,0,1);
-       printk(KERN_INFO "I2C Write(0x04) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x05,0,1);
-       printk(KERN_INFO "I2C Write(0x05) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x06,0,1);
-       printk(KERN_INFO "I2C Write(0x06) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       tmp=I2CWrite(btv,0x1E,0x00,0,1);
-       printk(KERN_INFO "I2C Write(0x00) = %i\nI2C Read () = %x\n\n",tmp,I2CRead(btv,0x1F,NULL));
-       
+
+       for (i = 0; i < sizeof(vals)/sizeof(int); i++) {
+               tmp=I2CWrite(btv,0x1E,vals[i],0,1);
+               printk(KERN_INFO "I2C Write(0x08) = %i\nI2C Read () = %x\n\n",
+                      tmp,I2CRead(btv,0x1F,NULL));
+       }
        printk(KERN_INFO "PXC200 Initialised.\n");
 }
 
 /* ----------------------------------------------------------------------- */
 
+static struct VENDOR {
+       int id;
+       char *name;
+} vendors[] = {
+       { 0x0070, "Hauppauge" },
+       { 0x144f, "Askey" },
+       { -1, NULL }
+};
+
+static struct CARD {
+       int id;
+       int vid;
+       int cardnr;
+       char *name;
+} cards[] = {
+       { 0x13eb, 0x0070, BTTV_HAUPPAUGE878,  "WinTV Theater" },
+       { 0x3002, 0x144f, BTTV_MAGICTVIEW061, "Magic TView"   },
+       { -1, -1, -1, NULL }
+};
+
 struct tvcard
 {
         char *name;
@@ -677,8 +678,8 @@ static struct tvcard tvcards[] =
          1,1,1,1,0 },
 
        /* 0x18 */
-       { "Magic TView CPH061 (bt878)",
-         3, 1, 0, 2, 0xe00, { 2, 0, 1, 1}, {0x400, 0, 0, 0, 0},0,
+        { "Askey/Typhoon/Anubis Magic TView CPH051/061 (bt878)",
+         3, 1, 0, 2, 0xe00, { 2, 3, 1, 1}, {0x400, 0x400, 0x400, 0x400, 0},0,
          1,1,1,1,0 },
         { "Terratec/Vobis TV-Boostar",
           3, 1, 0, 2, 16777215 , { 2, 3, 1, 1}, { 131072, 1, 1638400, 3,4},0,
@@ -709,15 +710,58 @@ static struct tvcard tvcards[] =
        { "Intel Create and Share PCI",
          4, 1, 0, 2, 7, { 2, 3, 1, 1}, { 4, 4, 4, 4, 4},0,
          1,1,1,1,0 },
-        { "Askey/Typhoon/Anubis Magic TView",
-         3, 1, 0, 2, 0xe00, { 2, 0, 1, 1}, {0x400, 0x400, 0x400, 0x400, 0},0,
-         1,1,1,1,0 },
        { "Terratec TerraTValue",
-          3, 1, 0, 2, 0x70000, { 2, 3, 1, 1}, { 0x500, 0, 0x300, 0x900, 0x900},0,
+          3, 1, 0, 2, 0xf00, { 2, 3, 1, 1}, { 0x500, 0, 0x300, 0x900, 0x900},0,
          1,1,1,1,0 },
 };
 #define TVCARDS (sizeof(tvcards)/sizeof(struct tvcard))
 
+static void
+dump_eeprom(struct bttv *btv, int addr)
+{
+       int i,id1,id2,n1,n2;
+
+       printk(KERN_DEBUG "bttv%d: dump eeprom @ 0x%02x\n",btv->nr,addr);
+        readee(btv, eeprom_data,addr);
+       for (i = 0; i < 256;) {
+               printk(KERN_DEBUG "  %02x:",i);
+               do {
+                       printk(" %02x",eeprom_data[i++]);
+               } while (i % 16);
+               printk("\n");
+       }
+       id1 = (eeprom_data[252] << 8) | (eeprom_data[253]);
+       id2 = (eeprom_data[254] << 8) | (eeprom_data[255]);
+       if (id1 != 0 && id1 != 0xffff &&
+           id2 != 0 && id2 != 0xffff) {
+               n1 = -1;
+               n2 = -1;
+               for (i = 0; vendors[i].id != -1; i++)
+                       if (vendors[i].id == id2)
+                               n2 = i;
+               for (i = 0; cards[i].id != -1; i++)
+                       if (cards[i].id  == id1 &&
+                           cards[i].vid == id2)
+                               n1 = i;
+               if (n1 != -1 && n2 != -1) {
+                       printk(KERN_INFO "  id: %s (0x%04x), vendor: %s (0x%04x)\n",
+                              cards[n1].name,id1,vendors[n2].name,id2);
+                       printk(KERN_INFO "  => card=%d (%s)\n",
+                              cards[n1].cardnr,tvcards[cards[n1].cardnr].name);
+#if 1
+                       /* not yet, but that's the plan for autodetect... */
+                       btv->type = cards[n1].cardnr;
+#endif
+               } else {
+                       printk(KERN_INFO "  id: %s (0x%04x), vendor: %s (0x%04x)\n",
+                              (n1 != -1) ? cards[n1].name   : "unknown", id1,
+                              (n2 != -1) ? vendors[n2].name : "unknown", id2);
+                       printk(KERN_INFO "  please mail card type, id + vendor to ");
+                       printk(" kraxel@goldbach.in-berlin.de\n");
+               }
+       }
+}
+
 /* ----------------------------------------------------------------------- */
 
 static void audio(struct bttv *btv, int mode, int no_irq_context)
@@ -2883,6 +2927,13 @@ static void idcard(int i)
                }
        }
 
+#if 1
+       /* DEBUG: dump eeprom content if available */
+       if (I2CRead(btv, 0xa0, "eeprom")>=0) {
+               dump_eeprom(btv,0xa0);
+       }
+#endif
+
        /* print which board we have found */
        printk(KERN_INFO "bttv%d: model: ",btv->nr);
 
@@ -2917,7 +2968,8 @@ static void idcard(int i)
         if (btv->type == BTTV_HAUPPAUGE878     ||
            btv->type == BTTV_CONFERENCETV      ||
            btv->type == BTTV_PIXVIEWPLAYTV     ||
-           btv->type == BTTV_AVERMEDIA98) {
+           btv->type == BTTV_AVERMEDIA98       ||
+           btv->type == BTTV_MAGICTVIEW061) {
                 btv->pll.pll_ifreq=28636363;
                 btv->pll.pll_crystal=BT848_IFORM_XT0;
         }
@@ -2952,8 +3004,8 @@ static void idcard(int i)
                        request_module("tda9855");
        }
 
-       if (tvcards[btv->type].tea63xx &&
-           I2CRead(btv, I2C_TEA6300, "TEA63xx") >= 0) {
+       if (tvcards[btv->type].tea63xx /* &&
+           I2CRead(btv, I2C_TEA6300, "TEA63xx") >= 0 */) {
                if (autoload)
                        request_module("tea6300");
        }
@@ -3553,7 +3605,11 @@ int init_bttv_cards(struct video_init *unused)
 #endif
 {
        int i;
-  
+
+       printk(KERN_INFO "bttv: driver version %d.%d.%d loaded\n",
+              (BTTV_VERSION_CODE >> 16) & 0xff,
+              (BTTV_VERSION_CODE >> 8) & 0xff,
+              BTTV_VERSION_CODE & 0xff);
        handle_chipset();
        if (find_bt848()<=0)
                return -EIO;
index b4b0caaa0b3748542545d8765471cef73fbdb07d..309e93e95b7de3e79839244c37ef215285ad73e5 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef _BTTV_H_
 #define _BTTV_H_
 
-#define BTTV_VERSION_CODE 0x00070b
+#define BTTV_VERSION_CODE 0x00070d
 
 #include <linux/types.h>
 #include <linux/wait.h>
@@ -248,32 +248,6 @@ extern __inline__ void io_st_le32(volatile unsigned *addr, unsigned val)
 #define BTTV_TERRATV       0x1c
 #define BTTV_PXC200        0x1d
 
-#if 0
-#define BTTV_UNKNOWN       0x00
-#define BTTV_MIRO          0x01
-#define BTTV_HAUPPAUGE     0x02
-#define BTTV_STB           0x03
-#define BTTV_INTEL         0x04
-#define BTTV_DIAMOND       0x05 
-#define BTTV_AVERMEDIA     0x06 
-#define BTTV_MATRIX_VISION 0x07 
-#define BTTV_FLYVIDEO      0x08
-#define BTTV_TURBOTV       0x09
-#define BTTV_HAUPPAUGE878  0x0a
-#define BTTV_MIROPRO       0x0b
-#define BTTV_TVBOOSTAR     0x0c
-#define BTTV_WINCAM        0x0d
-#define BTTV_MAXI          0x0e
-#define BTTV_VHX           0x10
-#define BTTV_PXC200        0x11
-#define BTTV_AVERMEDIA98   0x12
-#define BTTV_FLYVIDEO98    0x13
-
-#define BTTV_PIXVIEWPLAYTV 0x17
-#define BTTV_WINVIEW_601   0x18
-#define BTTV_CONFERENCETV  0x1c
-#endif
-
 
 #define AUDIO_TUNER        0x00
 #define AUDIO_RADIO        0x01
index 48709907c6273449fcb2db5ae4b603e40271afba..7541cc054f567a58e92bb6ed37391e08614348f3 100644 (file)
@@ -6,7 +6,8 @@
  * what works and what doesn't:
  *
  *  AM-Mono
- *      probably doesn't (untested)
+ *      Support for Hauppauge cards added (decoding handled by tuner) added by
+ *      Frederic Crozat <fcrozat@mail.dotcom.fr>
  *
  *  FM-Mono
  *      should work. The stereo modes are backward compatible to FM-mono,
@@ -19,7 +20,7 @@
  *      should work, no autodetect (i.e. default is mono, but you can
  *      switch to stereo -- untested)
  *
- *  NICAM (B/G, used in UK, Scandinavia and Spain)
+ *  NICAM (B/G, L , used in UK, Scandinavia, Spain and France)
  *      should work, with autodetect. Support for NICAM was added by
  *      Pekka Pietikainen <pp@netppl.fi>
  *
 #include <asm/pgtable.h>
 #include <linux/smp_lock.h>
 #endif
-
 /* kernel_thread */
 #define __KERNEL_SYSCALLS__
 #include <linux/unistd.h>
 
 #include "audiochip.h"
-  
-#define WAIT_QUEUE                 wait_queue_head_t
 
+#define WAIT_QUEUE                 wait_queue_head_t
 
 /* sound mixer stuff */ 
 #include <linux/config.h>
@@ -278,7 +277,7 @@ static struct MSP_INIT_DATA_DEM {
        /* NICAM/AM -- L (6.5/5.85) */
        { {  -2, -8, -10, 10, 50, 86 }, {  -4, -12, -9, 23, 79, 126 },
          MSP_CARRIER(6.5), MSP_CARRIER(6.5),
-         0x00c6, 0x0140,   0x0120, 0x7000},
+         0x00c6, 0x0140,   0x0120, 0x7c03},
 };
 
 struct CARRIER_DETECT {
@@ -302,7 +301,7 @@ static struct CARRIER_DETECT carrier_detect_55[] = {
 
 static struct CARRIER_DETECT carrier_detect_65[] = {
        /* PAL SAT / SECAM */
-       { MSP_CARRIER(5.85),       "5.85  PAL D/K NICAM" },
+       { MSP_CARRIER(5.85),       "5.85  PAL D/K + SECAM NICAM" },
        { MSP_CARRIER(6.2578125),  "6.25  PAL D/K1 FM-stereo" },
        { MSP_CARRIER(6.7421875),  "6.74  PAL D/K2 FM-stereo" },
        { MSP_CARRIER(7.02),       "7.02  PAL SAT FM-stereo s/b" },
@@ -409,7 +408,7 @@ static void msp3400c_setmode(struct i2c_client *client, int type)
 
        if (msp->nicam) {
                /* nicam prescale */
-               msp3400c_write(client,I2C_MSP3400C_DFP, 0x0010, 0x3000);
+               msp3400c_write(client,I2C_MSP3400C_DFP, 0x0010, 0x5a00); /* was: 0x3000 */
        }
 }
 
@@ -475,10 +474,22 @@ static void msp3400c_setstereo(struct i2c_client *client, int mode)
        case VIDEO_SOUND_STEREO:
                src = 0x0020 | nicam;
 #if 0 
+               /* spatial effect */
                msp3400c_write(client,I2C_MSP3400C_DFP, 0x0005,0x4000);
 #endif
                break;
        case VIDEO_SOUND_MONO:
+               if (msp->mode == MSP_MODE_AM_NICAM) {
+                       printk("msp3400: switching to AM mono\n");
+                       /* AM mono decoding is handled by tuner, not MSP chip */
+                       /* so let's redirect sound from tuner via SCART */
+                       /* volume prescale for SCART */
+                       msp3400c_write(client,I2C_MSP3400C_DFP, 0x000d, 0x1900);
+                       /* SCART switching control register*/
+                       msp3400c_write(client,I2C_MSP3400C_DFP, 0x0013, 0xe900);
+                       src = 0x0200;
+                       break;
+               }
        case VIDEO_SOUND_LANG1:
                src = 0x0000 | nicam;
                break;
@@ -551,7 +562,7 @@ autodetect_stereo(struct i2c_client *client)
                val = msp3400c_read(client, I2C_MSP3400C_DFP, 0x18);
                if (val > 32768)
                        val -= 65536;
-               dprintk("msp3400: stereo detect register: %d\n",val);
+               dprintk("msp34xx: stereo detect register: %d\n",val);
                
                if (val > 4096) {
                        newstereo = VIDEO_SOUND_STEREO | VIDEO_SOUND_MONO;
@@ -566,7 +577,7 @@ autodetect_stereo(struct i2c_client *client)
        case MSP_MODE_FM_NICAM2:
        case MSP_MODE_AM_NICAM:
                val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x23);
-               dprintk("msp3400: nicam sync=%d, mode=%d\n",val & 1, (val & 0x1e) >> 1);
+               dprintk("msp34xx: nicam sync=%d, mode=%d\n",val & 1, (val & 0x1e) >> 1);
 
                if (val & 1) {
                        /* nicam synced */
@@ -592,30 +603,33 @@ autodetect_stereo(struct i2c_client *client)
                        }
                        newnicam=1;
                } else {
-                       newnicam=0;
-#if 0 /* fixme: quick & dirty for testing */
-                       if (msp->main == MSP_CARRIER(6.5)) {
-                               /* This is a french mono channel => AM */
-                               printk("msp3400: switching to AM mono\n");
-                               msp3400c_setstereo(msp, VIDEO_SOUND_MONO);
-                               msp->second = msp->main;
-                               msp3400c_setmode(msp, MSP_MODE_AM_DETECT);
-                               msp3400c_setcarrier(client, msp->second, msp->main);
-                       }
-#endif
+                       newnicam = 0;
                        newstereo = VIDEO_SOUND_MONO;
                }
                break;
+       case MSP_MODE_BTSC:
+               val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x200);
+               dprintk("msp3410: status=0x%x (pri=%s, sec=%s, %s%s%s)\n",
+                       val,
+                       (val & 0x0002) ? "no"     : "yes",
+                       (val & 0x0004) ? "no"     : "yes",
+                       (val & 0x0040) ? "stereo" : "mono",
+                       (val & 0x0080) ? ", nicam 2nd mono" : "",
+                       (val & 0x0100) ? ", bilingual/SAP"  : "");
+               newstereo = VIDEO_SOUND_MONO;
+               if (val & 0x0040) newstereo |= VIDEO_SOUND_STEREO;
+               if (val & 0x0100) newstereo |= VIDEO_SOUND_LANG1;
+               break;
        }
        if (newstereo != msp->stereo) {
                update = 1;
-               dprintk("msp3400: watch: stereo %d => %d\n",
+               dprintk("msp34xx: watch: stereo %d => %d\n",
                        msp->stereo,newstereo);
                msp->stereo   = newstereo;
        }
        if (newnicam != msp->nicam_on) {
                update = 1;
-               dprintk("msp3400: watch: nicam %d => %d\n",
+               dprintk("msp34xx: watch: nicam %d => %d\n",
                        msp->nicam_on,newnicam);
                msp->nicam_on = newnicam;
        }
@@ -706,8 +720,15 @@ static int msp3400c_thread(void *data)
                        msp->active = 0;
                        continue;
                }
-       
+
+               /* some time for the tuner to sync */
+               current->state   = TASK_INTERRUPTIBLE;
+               schedule_timeout(HZ/10);
+               if (signal_pending(current))
+                       goto done;
+               
        restart:
+               msp->restart = 0;
                msp3400c_setvolume(client, 0, 0);
                msp3400c_setmode(client, MSP_MODE_AM_DETECT /* +1 */ );
                val1 = val2 = 0;
@@ -717,6 +738,14 @@ static int msp3400c_thread(void *data)
 
                /* carrier detect pass #1 -- main carrier */
                cd = carrier_detect_main; count = CARRIER_COUNT(carrier_detect_main);
+
+               if (amsound && (msp->norm == VIDEO_MODE_SECAM)) {
+                       /* autodetect doesn't work well with AM ... */
+                       max1 = 3;
+                       count = 0;
+                       dprintk("msp3400: AM sound override\n");
+               }
+
                for (this = 0; this < count; this++) {
                        msp3400c_setcarrier(client, cd[this].cdo,cd[this].cdo);
 
@@ -724,23 +753,15 @@ static int msp3400c_thread(void *data)
                        schedule_timeout(HZ/25);
                        if (signal_pending(current))
                                goto done;
-                       if (msp->restart) {
+                       if (msp->restart)
                                msp->restart = 0;
-                               goto restart;
-                       }
 
                        val = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1b);
                        if (val1 < val)
                                val1 = val, max1 = this;
                        dprintk("msp3400: carrier1 val: %5d / %s\n", val,cd[this].name);
                }
-
-               if (amsound) {
-                       /* autodetect does'nt work well with AM ... */
-                       max1 = 3;
-                       dprintk("msp3400: AM sound override\n");
-               }
-               
+       
                /* carrier detect pass #2 -- second (stereo) carrier */
                switch (max1) {
                case 1: /* 5.5 */
@@ -755,6 +776,11 @@ static int msp3400c_thread(void *data)
                        cd = NULL; count = 0;
                        break;
                }
+               
+               if (amsound && (msp->norm == VIDEO_MODE_SECAM)) {
+                       /* autodetect doesn't work well with AM ... */
+                       cd = NULL; count = 0; max2 = 0;
+               }
                for (this = 0; this < count; this++) {
                        msp3400c_setcarrier(client, cd[this].cdo,cd[this].cdo);
 
@@ -762,10 +788,8 @@ static int msp3400c_thread(void *data)
                        schedule_timeout(HZ/25);
                        if (signal_pending(current))
                                goto done;
-                       if (msp->restart) {
-                               msp->restart = 0;
+                       if (msp->restart)
                                goto restart;
-                       }
 
                        val = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1b);
                        if (val2 < val)
@@ -811,12 +835,13 @@ static int msp3400c_thread(void *data)
                                msp->nicam_on = 0;
                                msp3400c_setstereo(client, VIDEO_SOUND_MONO);
                                msp->watch_stereo = 1;
-                       } else if (max2 == 0 && msp->nicam &&
+                       } else if (max2 == 0 &&
                                   msp->norm == VIDEO_MODE_SECAM) {
-                               /* L NICAM */
+                               /* L NICAM or AM-mono */
                                msp->second = carrier_detect_65[max2].cdo;
                                msp3400c_setmode(client, MSP_MODE_AM_NICAM);
-                               msp->nicam_on = 1;
+                               msp->nicam_on = 0;
+                               msp3400c_setstereo(client, VIDEO_SOUND_MONO);
                                msp3400c_setcarrier(client, msp->second, msp->main);
                                msp->watch_stereo = 1;
                        } else if (max2 == 0 && msp->nicam) {
@@ -942,24 +967,19 @@ static int msp3410d_thread(void *data)
                msp->active = 1;
 
                if (msp->watch_stereo) {
-#if 1 /* dump status register */
-                       val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x200);
-                       printk("msp3410: status=0x%x (pri=%s, sec=%s, %s%s%s)\n",
-                              val,
-                              (val & 0x0002) ? "no"     : "yes",
-                              (val & 0x0004) ? "no"     : "yes",
-                              (val & 0x0040) ? "stereo" : "mono",
-                              (val & 0x0080) ? ", nicam 2nd mono" : "",
-                              (val & 0x0100) ? ", bilingual/SAP"  : "");
-                       msp->watch_stereo = 0;
-#else
-                       watch_stereo(msp);
-#endif
+                       watch_stereo(client);
                        msp->active = 0;
                        continue;
                }
        
+               /* some time for the tuner to sync */
+               current->state   = TASK_INTERRUPTIBLE;
+               schedule_timeout(HZ/10);
+               if (signal_pending(current))
+                       goto done;
+
        restart:
+               msp->restart = 0;
                del_timer(&msp->wake_stereo);
                msp->watch_stereo = 0;
 
@@ -977,6 +997,9 @@ static int msp3410d_thread(void *data)
                        std  = 0x0020;
                        break;
                case VIDEO_MODE_SECAM: 
+                       mode = 0x0003;
+                       std = 1;
+                       break;
                default:
                        mode = 0x0003;
                        std  = 1;
@@ -1005,10 +1028,8 @@ static int msp3410d_thread(void *data)
                                schedule_timeout(HZ/10);
                                if (signal_pending(current))
                                        goto done;
-                               if (msp->restart) {
-                                       msp->restart = 0;
+                               if (msp->restart)
                                        goto restart;
-                               }
 
                                /* check results */
                                val = msp3400c_read(client, I2C_MSP3400C_DEM, 0x7e);
@@ -1027,11 +1048,21 @@ static int msp3410d_thread(void *data)
                msp->main   = modelist[i].main;
                msp->second = modelist[i].second;
 
+               if (amsound && (msp->norm == VIDEO_MODE_SECAM) && (val != 0x0009)) {
+                       /* autodetection has failed, let backup */
+                       dprintk("msp3410: autodetection failed, switching to backup mode: %s (0x%04x)\n",
+                               modelist[8].name ? modelist[8].name : "unknown",val);
+                       val = 0x0009;
+                       msp3400c_write(client, I2C_MSP3400C_DEM, 0x20, val);
+               }
+
                /* set prescale / stereo */
                switch (val) {
-               case 0x0009:
-                       msp3400c_write(client, I2C_MSP3400C_DFP, 0x0e, 0x7c03); /* AM */
-                       msp3400c_write(client, I2C_MSP3400C_DFP, 0x10, 0x5a00); /* NICAM */
+               case 0x0009:                    
+                       msp->mode = MSP_MODE_AM_NICAM;
+                       msp->stereo = VIDEO_SOUND_MONO;
+                       msp3400c_setstereo(client,VIDEO_SOUND_MONO);
+                       msp->watch_stereo = 1;
                        break;
                case 0x0020: /* BTSC */
                        /* just turn on stereo */
@@ -1479,12 +1510,8 @@ static int msp_command(struct i2c_client *client,unsigned int cmd, void *arg)
                va->bass = msp->bass;
                va->treble = msp->treble;
 
-               if (msp->simple) {
-                       /* fixme */
-               } else {
-                       autodetect_stereo(client);
-                       va->mode = msp->stereo;
-               }
+               autodetect_stereo(client);
+               va->mode = msp->stereo;
                break;
        }
        case VIDIOCSAUDIO:
@@ -1501,9 +1528,7 @@ static int msp_command(struct i2c_client *client,unsigned int cmd, void *arg)
                msp3400c_setbass(client,msp->bass);
                msp3400c_settreble(client,msp->treble);
 
-               if (msp->simple) {
-                       /* fixme */
-               } else if (va->mode != 0) {
+               if (va->mode != 0) {
                        msp->watch_stereo=0;
                        del_timer(&msp->wake_stereo);
                        msp->stereo = va->mode;
@@ -1584,17 +1609,11 @@ static int msp_command(struct i2c_client *client,unsigned int cmd, void *arg)
                msp3400c_settreble(client,msp->treble);
                break;
 
-       case AUDC_GET_STEREO:
-               if (msp->simple) {
-                       *sarg = 0; /* fixme */
-               } else {
-                       autodetect_stereo(client);
-                       *sarg = msp->stereo;
-               }
+       case AUDC_GET_STEREO:   
+               autodetect_stereo(client);
+               *sarg = msp->stereo;            
                break;
        case AUDC_SET_STEREO:
-               if (msp->simple)
-                       break; /* fixme */
                if (*sarg) {
                        msp->watch_stereo=0;
                        del_timer(&msp->wake_stereo);
@@ -1642,4 +1661,3 @@ void cleanup_module(void)
  * c-basic-offset: 8
  * End:
  */
-
index a34c85d1f6578de1029f7ee7a226c134545a0de0..b63f35436409a7c6a70ad1631d5b8610e19cbce0 100644 (file)
@@ -2249,7 +2249,7 @@ int init_stradis_cards(struct video_init *unused)
        saa_num = 0;
 
        while ((dev = pci_find_device(PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146, dev))) {
-               if (!dev->subsystem_vendor_id)
+               if (!dev->subsystem_vendor)
                        printk(KERN_INFO "stradis%d: rev1 decoder\n", saa_num);
                else
                        printk(KERN_INFO "stradis%d: SDM2xx found\n", saa_num); 
index 87d79b00ea10ab52629a46e017099f31cc1f99ae..73df0b4ac89afc779182bd7d7f0ff357b9a3f3ac 100644 (file)
@@ -104,7 +104,7 @@ static void tda8425_set(struct i2c_client *client)
        tda8425_write(client, TDA8425_TR, tda->treble>>12|0xF0);
 }
 
-static void tda8425_init(struct i2c_client *client)
+static void do_tda8425_init(struct i2c_client *client)
 {
        struct tda8425 *tda = client->data;
 
@@ -152,7 +152,7 @@ static int tda8425_attach(struct i2c_adapter *adap, int addr,
        if (!tda)
                return -ENOMEM;
        memset(tda,0,sizeof *tda);
-       tda8425_init(client);
+       do_tda8425_init(client);
        MOD_INC_USE_COUNT;
        strcpy(client->name,"TDA8425");
        printk(KERN_INFO "tda8425: init\n");
@@ -173,7 +173,7 @@ static int tda8425_detach(struct i2c_client *client)
 {
        struct tda8425 *tda  = client->data;
     
-       tda8425_init(client);
+       do_tda8425_init(client);
        i2c_detach_client(client);
 
        kfree(tda);
index ed676087f485b613392d9cdb52e9529c6300bdaf..dfdee66dcc1c21d41d045457d9d895fb4b146448 100644 (file)
@@ -194,7 +194,7 @@ static int tda9855_set(struct i2c_client *client)
        return 0;
 }
 
-static void tda9855_init(struct i2c_client *client)
+static void do_tda9855_init(struct i2c_client *client)
 {
        struct tda9855 *t = client->data;
 
@@ -235,7 +235,7 @@ static int tda9855_attach(struct i2c_adapter *adap, int addr,
        if (!t)
                return -ENOMEM;
        memset(t,0,sizeof *t);
-       tda9855_init(client);
+       do_tda9855_init(client);
        MOD_INC_USE_COUNT;
        strcpy(client->name,"TDA9855");
        printk(KERN_INFO "tda9855: init\n");
@@ -255,7 +255,7 @@ static int tda9855_detach(struct i2c_client *client)
 {
        struct tda9855 *t  = client->data;
 
-       tda9855_init(client);
+       do_tda9855_init(client);
        i2c_detach_client(client);
        
        kfree(t);
@@ -298,8 +298,7 @@ static int tda9855_command(struct i2c_client *client,
 
                va->mode = ((TDA9855_STP | TDA9855_SAPP) & 
                            tda9855_read(client)) >> 4;
-               if (0 == va->mode)
-                       va->mode = VIDEO_SOUND_MONO;
+               va->mode |= VIDEO_SOUND_MONO;
                break;
        }
        case VIDIOCSAUDIO:
@@ -327,7 +326,7 @@ static int tda9855_command(struct i2c_client *client,
                case VIDEO_SOUND_STEREO:
                        t->c2= TDA9855_STEREO | (t->c2 & 0x3f); 
                        break;
-               case VIDEO_SOUND_LANG2:
+               case VIDEO_SOUND_LANG1:
                        t->c2= TDA9855_SAP | (t->c2 & 0x3f); 
                        break;
                }
@@ -445,7 +444,7 @@ int tda9855_init(void)
 #ifdef MODULE
 void cleanup_module(void)
 {
-       i2c_add_driver(&driver);
+       i2c_del_driver(&driver);
 }
 #endif
 
index 5449ae0a52fea49580d22be47e4593117a5b9763..f5949c94f4104e9f44990bef539ced31c2ae0077 100644 (file)
@@ -111,7 +111,7 @@ static void tea6300_set(struct i2c_client *client)
        tea6300_write(client, TEA6300_TR, tea->treble>>12);
 }
 
-static void tea6300_init(struct i2c_client *client)
+static void do_tea6300_init(struct i2c_client *client)
 {
        struct tea6300 *tea = client->data;
        
@@ -173,7 +173,7 @@ static int tea6300_attach(struct i2c_adapter *adap, int addr,
        if (!tea)
                return -ENOMEM;
        memset(tea,0,sizeof *tea);
-       tea6300_init(client);
+       do_tea6300_init(client);
 
        MOD_INC_USE_COUNT;
        strcpy(client->name,"TEA6300T");
@@ -194,7 +194,7 @@ static int tea6300_detach(struct i2c_client *client)
 {
        struct tea6300 *tea  = client->data;
     
-       tea6300_init(client);
+       do_tea6300_init(client);
        i2c_detach_client(client);
 
        kfree(tea);
index eabffab8027d1cb5b97e11d4d8375fe4228722d5..5c9d1b27a36a664bd74d0ebccef5a75f526323d3 100644 (file)
@@ -39,13 +39,6 @@ static const char * const medianame[] = {
        "10baseT(forced)", "MII 100baseTx", "MII 100baseTx-FD", "MII 100baseT4",
 };
 
-/* Set if the PCI BIOS detects the chips on a multiport board backwards. */
-#ifdef REVERSE_PROBE_ORDER
-static int reverse_probe = 1;
-#else
-static int reverse_probe = 0;
-#endif
-
 /* Keep the ring sizes a power of two for efficiency.
    Making the Tx ring too large decreases the effectiveness of channel
    bonding and packet priority.
@@ -126,6 +119,7 @@ static int csr0 = 0x00A00000 | 0x4800;
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/delay.h>
+#include <linux/init.h>
 #include <asm/processor.h>             /* Processor type for cache alignment. */
 #include <asm/bitops.h>
 #include <asm/io.h>
@@ -284,7 +278,6 @@ struct pci_id_info {
        struct net_device *(*probe1)(int pci_bus, int pci_devfn, struct net_device *dev,
                                                         long ioaddr, int irq, int chip_idx, int fnd_cnt);
 };
-#ifndef CARDBUS
 static struct pci_id_info pci_tbl[] = {
   { "Digital DC21040 Tulip",
        0x1011, 0x0002, 0xffff, PCI_ADDR0_IO, 128, 32, tulip_probe1 },
@@ -310,9 +303,10 @@ static struct pci_id_info pci_tbl[] = {
        0x1317, 0x0981, 0xffff, PCI_ADDR0_IO, 256, 32, tulip_probe1 },
   { "Compex RL100-TX",
        0x11F6, 0x9881, 0xffff, PCI_ADDR0_IO, 128, 32, tulip_probe1 },
+  { "Xircom Cardbus Adapter (DEC 21143 compatible mode)",
+       0x115D, 0x0003, 0xffff, PCI_ADDR0_IO, 128, 32, tulip_probe1 },
   {0},
 };
-#endif /* !CARD_BUS */
 
 /* This table use during operation for capabilities and media timer. */
 
@@ -456,7 +450,6 @@ struct mediainfo {
 struct tulip_private {
        char devname[8];                        /* Used only for kernel debugging. */
        const char *product_name;
-       struct net_device *next_module;
        struct tulip_rx_desc rx_ring[RX_RING_SIZE];
        struct tulip_tx_desc tx_ring[TX_RING_SIZE];
        /* The saved address of a sent-in-place packet/buffer, for skfree(). */
@@ -574,107 +567,6 @@ static void outl_CSR6 (u32 newcsr6, long ioaddr, int chip_idx)
     restore_flags(flags);
 }
 \f
-/* A list of all installed Tulip devices. */
-static struct net_device *root_tulip_dev = NULL;
-
-#ifndef CARDBUS
-int tulip_probe(struct net_device *dev)
-{
-       int cards_found = 0;
-       int pci_index = 0;
-       unsigned char pci_bus, pci_device_fn;
-
-       if ( ! pcibios_present())
-               return -ENODEV;
-
-       for (;pci_index < 0xff; pci_index++) {
-               u16 vendor, device, pci_command, new_command;
-               int chip_idx;
-               int irq;
-               long ioaddr;
-
-               if (pcibios_find_class
-                       (PCI_CLASS_NETWORK_ETHERNET << 8,
-                        reverse_probe ? 0xfe - pci_index : pci_index,
-                        &pci_bus, &pci_device_fn) != PCIBIOS_SUCCESSFUL) {
-                       if (reverse_probe)
-                               continue;
-                       else
-                               break;
-               }
-               pcibios_read_config_word(pci_bus, pci_device_fn,
-                                                                PCI_VENDOR_ID, &vendor);
-               pcibios_read_config_word(pci_bus, pci_device_fn,
-                                                                PCI_DEVICE_ID, &device);
-
-               for (chip_idx = 0; pci_tbl[chip_idx].vendor_id; chip_idx++)
-                       if (vendor == pci_tbl[chip_idx].vendor_id
-                               && (device & pci_tbl[chip_idx].device_id_mask) ==
-                               pci_tbl[chip_idx].device_id)
-                               break;
-               if (pci_tbl[chip_idx].vendor_id == 0)
-                       continue;
-
-               {
-#if defined(PCI_SUPPORT_VER2)
-                       struct pci_dev *pdev = pci_find_slot(pci_bus, pci_device_fn);
-                       ioaddr = pdev->base_address[0] & ~3;
-                       irq = pdev->irq;
-#elif defined(PCI_SUPPORT_VER3)
-                       struct pci_dev *pdev = pci_find_slot(pci_bus, pci_device_fn);
-                       ioaddr = pdev->resource[0].start;
-                       irq = pdev->irq;
-#else
-                       u32 pci_ioaddr;
-                       u8 pci_irq_line;
-                       pcibios_read_config_dword(pci_bus, pci_device_fn,
-                                                                         PCI_BASE_ADDRESS_0, &pci_ioaddr);
-                       pcibios_read_config_byte(pci_bus, pci_device_fn,
-                                                                        PCI_INTERRUPT_LINE, &pci_irq_line);
-                       ioaddr = pci_ioaddr & ~3;
-                       irq = pci_irq_line;
-#endif
-               }
-
-               if (debug > 2)
-                       printk(KERN_INFO "Found %s at PCI I/O address %#lx.\n",
-                                  pci_tbl[chip_idx].name, ioaddr);
-
-               pcibios_read_config_word(pci_bus, pci_device_fn,
-                                                                PCI_COMMAND, &pci_command);
-               new_command = pci_command | PCI_COMMAND_MASTER|PCI_COMMAND_IO;
-               if (pci_command != new_command) {
-                       printk(KERN_INFO "  The PCI BIOS has not enabled the"
-                                  " device at %d/%d!  Updating PCI command %4.4x->%4.4x.\n",
-                                  pci_bus, pci_device_fn, pci_command, new_command);
-                       pcibios_write_config_word(pci_bus, pci_device_fn,
-                                                                         PCI_COMMAND, new_command);
-               }
-
-               dev = pci_tbl[chip_idx].probe1(pci_bus, pci_device_fn, dev, ioaddr,
-                                                                          irq, chip_idx, cards_found);
-
-               /* Get and check the bus-master and latency values. */
-               if (dev) {
-                       u8 pci_latency;
-                       pcibios_read_config_byte(pci_bus, pci_device_fn,
-                                                                        PCI_LATENCY_TIMER, &pci_latency);
-                       if (pci_latency < 10) {
-                               printk(KERN_INFO "  PCI latency timer (CFLT) is "
-                                          "unreasonably low at %d.  Setting to 64 clocks.\n",
-                                          pci_latency);
-                               pcibios_write_config_byte(pci_bus, pci_device_fn,
-                                                                                 PCI_LATENCY_TIMER, 64);
-                       }
-               }
-               dev = 0;
-               cards_found++;
-       }
-
-       return cards_found ? 0 : -ENODEV;
-}
-#endif  /* not CARDBUS */
-
 static struct net_device *tulip_probe1(int pci_bus, int pci_devfn,
                                                                   struct net_device *dev, long ioaddr, int irq,
                                                                   int chip_idx, int board_idx)
@@ -851,9 +743,6 @@ static struct net_device *tulip_probe1(int pci_bus, int pci_devfn,
        memset(tp, 0, sizeof(*tp));
        dev->priv = tp;
 
-       tp->next_module = root_tulip_dev;
-       root_tulip_dev = dev;
-
        tp->pci_bus = pci_bus;
        tp->pci_devfn = pci_devfn;
        tp->chip_id = chip_idx;
@@ -3251,127 +3140,82 @@ static void set_rx_mode(struct net_device *dev)
        outl_CSR6(csr6 | 0x0000, ioaddr, tp->chip_id);
 }
 \f
-#ifdef CARDBUS
-
-#include <pcmcia/driver_ops.h>
-
-static dev_node_t *tulip_attach(dev_locator_t *loc)
+static int tulip_probe(struct pci_dev *pdev)
 {
        struct net_device *dev;
-       u16 dev_id;
-       u16 vendor_id;
-       u32 io;
-       u8 bus, devfn, irq;
-
-       if (loc->bus != LOC_PCI) return NULL;
-       bus = loc->b.pci.bus; devfn = loc->b.pci.devfn;
-       printk(KERN_INFO "tulip_attach(bus %d, function %d)\n", bus, devfn);
-       pcibios_read_config_dword(bus, devfn, PCI_BASE_ADDRESS_0, &io);
-       pcibios_read_config_word(bus, devfn, PCI_DEVICE_ID, &dev_id);
-       pcibios_read_config_byte(bus, devfn, PCI_INTERRUPT_LINE, &irq);
-       pcibios_read_config_word(bus, devfn, PCI_VENDOR_ID, &vendor_id);
-       if (dev_id == 0x0003 && vendor_id == 0x115d) 
-               dev = tulip_probe1(bus, devfn, NULL, io & ~3, irq, X3201_3, 0);
-       else
-               dev = tulip_probe1(bus, devfn, NULL, io & ~3, irq, DC21142, 0);
+       int chip_idx;
+       static int board_idx = 0;
+
+       printk(KERN_INFO "tulip_attach(%s)\n", pdev->slot_name);
+
+       for (chip_idx = 0; pci_tbl[chip_idx].vendor_id; chip_idx++)
+               if (pdev->vendor == pci_tbl[chip_idx].vendor_id
+                   && (pdev->device & pci_tbl[chip_idx].device_id_mask) ==
+                   pci_tbl[chip_idx].device_id)
+                       break;
+       if (pci_tbl[chip_idx].vendor_id == 0)
+               return 0;
+
+       pci_set_master(pdev);
+       dev = pci_tbl[chip_idx].probe1(pdev->bus->number, pdev->devfn, NULL,
+                                      pdev->resource[0].start, pdev->irq,
+                                      chip_idx, board_idx++);
        if (dev) {
-               dev_node_t *node = kmalloc(sizeof(dev_node_t), GFP_KERNEL);
-               strcpy(node->dev_name, dev->name);
-               node->major = node->minor = 0;
-               node->next = NULL;
+               pdev->driver_data = dev;
                MOD_INC_USE_COUNT;
-               return node;
+               return 1;
        }
-       return NULL;
+       return 0;
 }
 
-static void tulip_suspend(dev_node_t *node)
+static void tulip_suspend(struct pci_dev *pdev)
 {
-       struct net_device *dev, *next;
-       printk(KERN_INFO "tulip_suspend(%s)\n", node->dev_name);
-       for (dev = root_tulip_dev; dev; dev = next) {
-               next = ((struct tulip_private *)dev->priv)->next_module;
-               if (strcmp(dev->name, node->dev_name) == 0) break;
-       }
-       if (dev) {
-               struct tulip_private *tp = (struct tulip_private *)dev->priv;
-               if (tp->open) tulip_down(dev);
-       }
+       struct net_device *dev = pdev->driver_data;
+       struct tulip_private *tp = (struct tulip_private *)dev->priv;
+       printk(KERN_INFO "tulip_suspend(%s)\n", dev->name);
+       if (tp->open) tulip_down(dev);
 }
 
-static void tulip_resume(dev_node_t *node)
+static void tulip_resume(struct pci_dev *pdev)
 {
-       struct net_device *dev, *next;
-       printk(KERN_INFO "tulip_resume(%s)\n", node->dev_name);
-       for (dev = root_tulip_dev; dev; dev = next) {
-               next = ((struct tulip_private *)dev->priv)->next_module;
-               if (strcmp(dev->name, node->dev_name) == 0) break;
-       }
-       if (dev) {
-               struct tulip_private *tp = (struct tulip_private *)dev->priv;
-               if (tp->open) tulip_up(dev);
-       }
+       struct net_device *dev = pdev->driver_data;
+       struct tulip_private *tp = (struct tulip_private *)dev->priv;
+       printk(KERN_INFO "tulip_resume(%s)\n", dev->name);
+       if (tp->open) tulip_up(dev);
 }
 
-static void tulip_detach(dev_node_t *node)
+static void tulip_remove(struct pci_dev *pdev)
 {
-       struct net_device **devp, **next;
-       printk(KERN_INFO "tulip_detach(%s)\n", node->dev_name);
-       for (devp = &root_tulip_dev; *devp; devp = next) {
-               next = &((struct tulip_private *)(*devp)->priv)->next_module;
-               if (strcmp((*devp)->name, node->dev_name) == 0) break;
-       }
-       if (*devp) {
-               struct net_device *dev = *devp;
-               struct tulip_private *tp = dev->priv;
-               *devp = *next;
-               unregister_netdev(dev);
-               kfree(dev);
-               kfree(tp);
-               kfree(node);
-               MOD_DEC_USE_COUNT;
-       }
+       struct net_device *dev = pdev->driver_data;
+       struct tulip_private *tp = (struct tulip_private *)dev->priv;
+
+       printk(KERN_INFO "tulip_detach(%s)\n", dev->name);
+       unregister_netdev(dev);
+       kfree(dev);
+       kfree(tp);
 }
 
-struct driver_operations tulip_ops = {
-       "tulip_cb", tulip_attach, tulip_suspend, tulip_resume, tulip_detach
+struct pci_driver tulip_ops = {
+       name:           "tulip_cb",
+       probe:          tulip_probe,
+       remove:         tulip_remove,
+       suspend:        tulip_suspend,
+       resume:         tulip_resume
 };
 
-#endif  /* Cardbus support */
-
-#ifdef MODULE
-int init_module(void)
+int __init tulip_init(void)
 {
-#ifdef CARDBUS
-       reverse_probe = 0;                      /* Not used. */
-       register_driver(&tulip_ops);
+       pci_register_driver(&tulip_ops);
        return 0;
-#else
-       return tulip_probe(NULL);
-#endif
 }
 
-void cleanup_module(void)
+void __exit tulip_cleanup(void)
 {
-       struct net_device *next_dev;
-
-#ifdef CARDBUS
-       unregister_driver(&tulip_ops);
-#endif
-
-       /* No need to check MOD_IN_USE, as sys_delete_module() checks. */
-       while (root_tulip_dev) {
-               struct tulip_private *tp = (struct tulip_private *)root_tulip_dev->priv;
-               next_dev = tp->next_module;
-               unregister_netdev(root_tulip_dev);
-               release_region(root_tulip_dev->base_addr,
-                                          tulip_tbl[tp->chip_id].io_size);
-               kfree(root_tulip_dev);
-               root_tulip_dev = next_dev;
-       }
+       pci_unregister_driver(&tulip_ops);
 }
 
-#endif  /* MODULE */
+module_init(tulip_init);
+module_exit(tulip_cleanup);
 \f
 /*
  * Local variables:
index 7e260fb2c2db53151d50fb9ea0b00fe5da4e5f86..1cb255f91334e275e77af74dd7e20df2c2339947 100644 (file)
@@ -1,4 +1,4 @@
-/********************************************************************
+/*******************************************************************************
  *
  *  Linux ThunderLAN Driver
  *
@@ -7,6 +7,7 @@
  *
  *  (C) 1997-1998 Caldera, Inc.
  *  (C) 1998 James Banks
+ *  (C) 1999, 2000 Torben Mathiasen
  *
  *  This software may be used and distributed according to the terms
  *  of the GNU Public License, incorporated herein by reference.
  *      
  *     Torben Mathiasen <torben.mathiasen@compaq.com> New Maintainer!
  *
- *     v1.1 Dec 20 --  Removed linux version checking(patch from 
- *                     Tigran Aivazian). v1.1 includes Alan's SMP
- *                     opdates. We still have problems on SMP though,
- *                     but I'm looking into that. 
+ *     v1.1 Dec 20, 1999    - Removed linux version checking
+ *                            Patch from Tigran Aivazian. 
+ *                          - v1.1 includes Alan's SMP updates.
+ *                          - We still have problems on SMP though,
+ *                            but I'm looking into that. 
+ *                     
+ *     v1.2 Jan 02, 2000    - Hopefully fixed the SMP deadlock.
+ *                          - Removed dependency of HZ being 100.
+ *                          - We now allow higher priority timers to 
+ *                            overwrite timers like TLAN_TIMER_ACTIVITY
+ *                            Patch from John Cagle <john.cagle@compaq.com>.
+ *                          - Fixed a few compiler warnings.
+ *                          
  *
- ********************************************************************/
+ *******************************************************************************/
 
 
 #include <linux/module.h>
@@ -81,7 +91,7 @@ static        int             bbuf = 0;
 static u8              *TLanPadBuffer;
 static char            TLanSignature[] = "TLAN";
 static int             TLanVersionMajor = 1;
-static int             TLanVersionMinor = 1;
+static int             TLanVersionMinor = 2;
 
 
 static TLanAdapterEntry TLanAdapterList[] = {
@@ -244,7 +254,8 @@ TLan_SetTimer( struct net_device *dev, u32 ticks, u32 type )
        unsigned long flags;
 
        spin_lock_irqsave(&priv->lock, flags);
-       if ( priv->timer.function != NULL ) {
+       if ( priv->timer.function != NULL &&
+               priv->timerType != TLAN_TIMER_ACTIVITY) {
                spin_unlock_irqrestore(&priv->lock, flags);
                return;
        }
@@ -1160,7 +1171,12 @@ u32 TLan_HandleTxEOF( struct net_device *dev, u16 host_int )
        if ( priv->adapter->flags & TLAN_ADAPTER_ACTIVITY_LED ) {
                TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK | TLAN_LED_ACT );
                if ( priv->timer.function == NULL ) {
-                       TLan_SetTimer( dev, TLAN_TIMER_ACT_DELAY, TLAN_TIMER_ACTIVITY );
+                        priv->timer.function = &TLan_Timer;
+                        priv->timer.data = (unsigned long) dev;
+                        priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY;
+                        priv->timerSetAt = jiffies;
+                        priv->timerType = TLAN_TIMER_ACTIVITY;
+                        add_timer(&priv->timer);
                } else if ( priv->timerType == TLAN_TIMER_ACTIVITY ) {
                        priv->timerSetAt = jiffies;
                }
@@ -1316,7 +1332,12 @@ u32 TLan_HandleRxEOF( struct net_device *dev, u16 host_int )
        if ( priv->adapter->flags & TLAN_ADAPTER_ACTIVITY_LED ) {
                TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK | TLAN_LED_ACT );
                if ( priv->timer.function == NULL )  {
-                       TLan_SetTimer( dev, TLAN_TIMER_ACT_DELAY, TLAN_TIMER_ACTIVITY );
+                       priv->timer.function = &TLan_Timer;
+                       priv->timer.data = (unsigned long) dev;
+                       priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY;
+                       priv->timerSetAt = jiffies;
+                       priv->timerType = TLAN_TIMER_ACTIVITY;
+                       add_timer(&priv->timer);
                } else if ( priv->timerType == TLAN_TIMER_ACTIVITY ) {
                        priv->timerSetAt = jiffies;
                }
@@ -1554,7 +1575,7 @@ u32 TLan_HandleRxEOC( struct net_device *dev, u16 host_int )
         *              for a short period to power up the LED so it
         *              can be seen.  This delay can be changed by
         *              changing the TLAN_TIMER_ACT_DELAY in tlan.h,
-        *              if desired.  10 jiffies produces a slightly
+        *              if desired.  100 ms  produces a slightly
         *              sluggish response.
         *
         **************************************************************/
@@ -1564,7 +1585,7 @@ void TLan_Timer( unsigned long data )
        struct net_device       *dev = (struct net_device *) data;
        TLanPrivateInfo *priv = (TLanPrivateInfo *) dev->priv;
        u32             elapsed;
-       unsigned long   flags;
+       unsigned long   flags = 0;
 
        priv->timer.function = NULL;
 
@@ -2203,11 +2224,11 @@ void TLan_PhyPowerDown( struct net_device *dev )
                TLan_MiiWriteReg( dev, priv->phy[1], MII_GEN_CTL, value );
        }
 
-       /* Wait for 5 jiffies (50 ms) and powerup
+       /* Wait for 50 ms and powerup
         * This is abitrary.  It is intended to make sure the
         * tranceiver settles.
         */
-       TLan_SetTimer( dev, 5, TLAN_TIMER_PHY_PUP );
+       TLan_SetTimer( dev, (50/(1000/HZ)), TLAN_TIMER_PHY_PUP );
 
 } /* TLan_PhyPowerDown */
 
@@ -2224,11 +2245,11 @@ void TLan_PhyPowerUp( struct net_device *dev )
        value = MII_GC_LOOPBK;
        TLan_MiiWriteReg( dev, priv->phy[priv->phyNum], MII_GEN_CTL, value );
 
-       /* Wait for 50 jiffies (500 ms) and reset the
+       /* Wait for 500 ms and reset the
         * tranceiver.  The TLAN docs say both 50 ms and
         * 500 ms, so do the longer, just in case
         */
-       TLan_SetTimer( dev, 50, TLAN_TIMER_PHY_RESET );
+       TLan_SetTimer( dev, (HZ/2), TLAN_TIMER_PHY_RESET );
 
 } /* TLan_PhyPowerUp */
 
@@ -2253,10 +2274,10 @@ void TLan_PhyReset( struct net_device *dev )
        }
        TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0 );
 
-       /* Wait for 50 jiffies (500 ms) and initialize.
+       /* Wait for 500 ms and initialize.
         * I don't remember why I wait this long.
         */
-       TLan_SetTimer( dev, 50, TLAN_TIMER_PHY_START_LINK );
+       TLan_SetTimer( dev, (HZ/2), TLAN_TIMER_PHY_START_LINK );
 
 } /* TLan_PhyReset */
 
@@ -2299,13 +2320,13 @@ void TLan_PhyStartLink( struct net_device *dev )
                        TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x1000 );
                TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x1200 );
 
-               /* Wait for 400 jiffies (4 sec) for autonegotiation
+               /* Wait for 4 sec for autonegotiation
                 * to complete.  The max spec time is less than this
                 * but the card need additional time to start AN.
                 * .5 sec should be plenty extra.
                 */
                printk( "TLAN:  %s: Starting autonegotiation.\n", dev->name );
-               TLan_SetTimer( dev, 400, TLAN_TIMER_PHY_FINISH_AN );
+               TLan_SetTimer( dev, (4*HZ), TLAN_TIMER_PHY_FINISH_AN );
                return;
        }
 
@@ -2334,10 +2355,10 @@ void TLan_PhyStartLink( struct net_device *dev )
                TLan_MiiWriteReg( dev, phy, TLAN_TLPHY_CTL, tctl );
        }
 
-       /* Wait for 100 jiffies (1 sec) to give the tranceiver time
+       /* Wait for 1 sec to give the tranceiver time
         * to establish link.
         */
-       TLan_SetTimer( dev, 100, TLAN_TIMER_FINISH_RESET );
+       TLan_SetTimer( dev, HZ, TLAN_TIMER_FINISH_RESET );
 
 } /* TLan_PhyStartLink */
 
@@ -2358,11 +2379,11 @@ void TLan_PhyFinishAutoNeg( struct net_device *dev )
 
        TLan_MiiReadReg( dev, phy, MII_GEN_STS, &status );
        if ( ! ( status & MII_GS_AUTOCMPLT ) ) {
-               /* Wait for 800 jiffies (8 sec) to give the process
+               /* Wait for 8 sec to give the process
                 * more time.  Perhaps we should fail after a while.
                 */
                printk( "TLAN:  Giving autonegotiation more time.\n" );
-               TLan_SetTimer( dev, 800, TLAN_TIMER_PHY_FINISH_AN );
+               TLan_SetTimer( dev, (8*HZ), TLAN_TIMER_PHY_FINISH_AN );
                return;
        }
 
@@ -2394,9 +2415,9 @@ void TLan_PhyFinishAutoNeg( struct net_device *dev )
                }
        }
 
-       /* Wait for 10 jiffies (100 ms).  No reason in partiticular.
+       /* Wait for 100 ms.  No reason in partiticular.
         */
-       TLan_SetTimer( dev, 10, TLAN_TIMER_FINISH_RESET );
+       TLan_SetTimer( dev, (HZ/10), TLAN_TIMER_FINISH_RESET );
                
 } /* TLan_PhyFinishAutoNeg */
 
@@ -2447,7 +2468,7 @@ int TLan_MiiReadReg( struct net_device *dev, u16 phy, u16 reg, u16 *val )
        int     err;
        int     minten;
        TLanPrivateInfo *priv = (TLanPrivateInfo *) dev->priv;
-       unsigned long flags;
+       unsigned long flags = 0;
 
        err = FALSE;
        outw(TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR);
@@ -2616,7 +2637,7 @@ void TLan_MiiWriteReg( struct net_device *dev, u16 phy, u16 reg, u16 val )
 {
        u16     sio;
        int     minten;
-       unsigned long flags;
+       unsigned long flags = 0;
        TLanPrivateInfo *priv = (TLanPrivateInfo *) dev->priv;
 
        outw(TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR);
@@ -2847,7 +2868,7 @@ int TLan_EeReadByte( struct net_device *dev, u8 ee_addr, u8 *data )
 {
        int err;
        TLanPrivateInfo *priv = (TLanPrivateInfo *) dev->priv;
-       unsigned long flags;
+       unsigned long flags = 0;
        int ret=0;
 
        if ( dev->interrupt == 0 )
index 978c208d53938c97e3511acc5271ad7d043f51b6..91a72ca9f87f89e14b806633b5832dc56fb24f78 100644 (file)
@@ -8,7 +8,8 @@
  *  by James Banks
  *
  *  (C) 1997-1998 Caldera, Inc.
- *
+ *  (C) 1999-2000 Torben Mathiasen
+ * 
  *  This software may be used and distributed according to the terms
  *  of the GNU Public License, incorporated herein by reference.
  *
@@ -206,7 +207,7 @@ typedef struct tlan_private_tag {
 #define TLAN_TIMER_PHY_FINISH_AN       7
 #define TLAN_TIMER_FINISH_RESET                8
 
-#define TLAN_TIMER_ACT_DELAY           10
+#define TLAN_TIMER_ACT_DELAY           (HZ/10)
 
 
 
index a802170cefda605300ecc8aab0c5d6b60477deab..1cc0bceadc18b8d3fba359afca715cb98ca1e7b3 100644 (file)
@@ -5,18 +5,18 @@
  *     2 of the License, or (at your option) any later version.
  *
  *     (c) Copyright 1998 Building Number Three Ltd
+ *     (c) Copyright 2000 Red Hat Software
  *
  *     Development of this driver was funded by Equiinet Ltd
  *                     http://www.equiinet.com
  *
  *     ChangeLog:
  *
- *     Asynchronous mode dropped for 2.2. For 2.3 we will attempt the
+ *     Asynchronous mode dropped for 2.2. For 2.5 we will attempt the
  *     unification of all the Z85x30 asynchronous drivers for real.
  *
- *     To Do:
- *     
- *     Finish DMA mode support.
+ *     DMA now uses get_free_page as kmalloc buffers may span a 64K 
+ *     boundary.
  *
  *     Performance
  *
@@ -662,39 +662,28 @@ int z8530_sync_dma_open(struct net_device *dev, struct z8530_channel *c)
        c->txdma_on = 0;
        
        /*
-        *      Allocate the DMA flip buffers
+        *      Allocate the DMA flip buffers. Limit by page size.
+        *      Everyone runs 1500 mtu or less on wan links so this
+        *      should be fine.
         */
         
-       c->rx_buf[0]=kmalloc(c->mtu, GFP_KERNEL|GFP_DMA);
+       if(c->mtu  > PAGE_SIZE/2)
+               return -EMSGSIZE;
+        
+       c->rx_buf[0]=get_free_page(GFP_KERNEL|GFP_DMA);
        if(c->rx_buf[0]==NULL)
                return -ENOBUFS;
-       c->rx_buf[1]=kmalloc(c->mtu, GFP_KERNEL|GFP_DMA);
-       if(c->rx_buf[1]==NULL)
-       {
-               kfree(c->rx_buf[0]);
-               c->rx_buf[0]=NULL;
-               return -ENOBUFS;
-       }
+       c->rx_buf[1]=c->rx_buf[0]+PAGE_SIZE/2;
        
-       c->tx_dma_buf[0]=kmalloc(c->mtu, GFP_KERNEL|GFP_DMA);
+       c->tx_dma_buf[0]=get_free_page(GFP_KERNEL|GFP_DMA);
        if(c->tx_dma_buf[0]==NULL)
        {
-               kfree(c->rx_buf[0]);
-               kfree(c->rx_buf[1]);
-               c->rx_buf[0]=NULL;
-               return -ENOBUFS;
-       }
-       c->tx_dma_buf[1]=kmalloc(c->mtu, GFP_KERNEL|GFP_DMA);
-       if(c->tx_dma_buf[1]==NULL)
-       {
-               kfree(c->tx_dma_buf[0]);
-               kfree(c->rx_buf[0]);
-               kfree(c->rx_buf[1]);
+               free_page(c->rx_buf[0]);
                c->rx_buf[0]=NULL;
-               c->rx_buf[1]=NULL;
-               c->tx_dma_buf[0]=NULL;
                return -ENOBUFS;
        }
+       c->tx_dma_buf[1]=c->tx_dma_buf[0]+PAGE_SIZE/2;
+
        c->tx_dma_used=0;
        c->dma_tx = 1;
        c->dma_num=0;
@@ -806,24 +795,14 @@ int z8530_sync_dma_close(struct net_device *dev, struct z8530_channel *c)
        
        if(c->rx_buf[0])
        {
-               kfree(c->rx_buf[0]);
+               free_page(c->rx_buf[0]);
                c->rx_buf[0]=NULL;
        }
-       if(c->rx_buf[1])
-       {
-               kfree(c->rx_buf[1]);
-               c->rx_buf[1]=NULL;
-       }
        if(c->tx_dma_buf[0])
        {
-               kfree(c->tx_dma_buf[0]);
+               free_page(c->tx_dma_buf[0]);
                c->tx_dma_buf[0]=NULL;
        }
-       if(c->tx_dma_buf[1])
-       {
-               kfree(c->tx_dma_buf[1]);
-               c->tx_dma_buf[1]=NULL;
-       }
        chk=read_zsreg(c,R0);
        write_zsreg(c, R3, c->regs[R3]);
        z8530_rtsdtr(c,0);
@@ -857,25 +836,21 @@ int z8530_sync_txdma_open(struct net_device *dev, struct z8530_channel *c)
        c->rxdma_on = 0;
        c->txdma_on = 0;
        
-       c->tx_dma_buf[0]=kmalloc(c->mtu, GFP_KERNEL|GFP_DMA);
+       /*
+        *      Allocate the DMA flip buffers. Limit by page size.
+        *      Everyone runs 1500 mtu or less on wan links so this
+        *      should be fine.
+        */
+        
+       if(c->mtu  > PAGE_SIZE/2)
+               return -EMSGSIZE;
+        
+       c->tx_dma_buf[0]=get_free_page(GFP_KERNEL|GFP_DMA);
        if(c->tx_dma_buf[0]==NULL)
-       {
-               kfree(c->rx_buf[0]);
-               kfree(c->rx_buf[1]);
-               c->rx_buf[0]=NULL;
                return -ENOBUFS;
-       }
-       c->tx_dma_buf[1]=kmalloc(c->mtu, GFP_KERNEL|GFP_DMA);
-       if(c->tx_dma_buf[1]==NULL)
-       {
-               kfree(c->tx_dma_buf[0]);
-               kfree(c->rx_buf[0]);
-               kfree(c->rx_buf[1]);
-               c->rx_buf[0]=NULL;
-               c->rx_buf[1]=NULL;
-               c->tx_dma_buf[0]=NULL;
-               return -ENOBUFS;
-       }
+
+       c->tx_dma_buf[1] = c->tx_dma_buf[0] + PAGE_SIZE/2;
+
        c->tx_dma_used=0;
        c->dma_num=0;
        c->dma_ready=1;
@@ -960,14 +935,9 @@ int z8530_sync_txdma_close(struct net_device *dev, struct z8530_channel *c)
        
        if(c->tx_dma_buf[0])
        {
-               kfree(c->tx_dma_buf[0]);
+               free_page(c->tx_dma_buf[0]);
                c->tx_dma_buf[0]=NULL;
        }
-       if(c->tx_dma_buf[1])
-       {
-               kfree(c->tx_dma_buf[1]);
-               c->tx_dma_buf[1]=NULL;
-       }
        chk=read_zsreg(c,R0);
        write_zsreg(c, R3, c->regs[R3]);
        z8530_rtsdtr(c,0);
index 1f98f50de94da1ff284816cd9fc3656fbfecbc2c..b242d4fe337f10bc399b509a8958f3c5ab7d6ec4 100644 (file)
@@ -195,6 +195,89 @@ pci_enable_device(struct pci_dev *dev)
        return 0;
 }
 
+/*
+ *  Registration of PCI drivers and handling of hot-pluggable devices.
+ */
+
+static LIST_HEAD(pci_drivers);
+
+void
+pci_register_driver(struct pci_driver *drv)
+{
+       struct pci_dev *dev;
+
+       list_add_tail(&drv->node, &pci_drivers);
+       pci_for_each_dev(dev) {
+               if (!pci_dev_driver(dev) && drv->probe(dev))
+                       dev->driver = drv;
+       }
+}
+
+void
+pci_unregister_driver(struct pci_driver *drv)
+{
+       struct pci_dev *dev;
+
+       list_del(&drv->node);
+       pci_for_each_dev(dev) {
+               if (dev->driver == drv) {
+                       if (drv->remove)
+                               drv->remove(dev);
+                       dev->driver = NULL;
+               }
+       }
+}
+
+void
+pci_insert_device(struct pci_dev *dev, struct pci_bus *bus)
+{
+       struct list_head *ln;
+
+       list_add_tail(&dev->bus_list, &bus->devices);
+       list_add_tail(&dev->global_list, &pci_devices);
+#ifdef CONFIG_PROC_FS
+       pci_proc_attach_device(dev);
+#endif
+       for(ln=pci_drivers.next; ln != &pci_devices; ln=ln->next) {
+               struct pci_driver *drv = list_entry(ln, struct pci_driver, node);
+               if (drv->probe(dev)) {
+                       dev->driver = drv;
+                       break;
+               }
+       }
+}
+
+void
+pci_remove_device(struct pci_dev *dev)
+{
+       if (dev->driver->remove)
+               dev->driver->remove(dev);
+       dev->driver = NULL;
+       list_del(&dev->bus_list);
+       list_del(&dev->global_list);
+#ifdef CONFIG_PROC_FS
+       pci_proc_detach_device(dev);
+#endif
+}
+
+static struct pci_driver pci_compat_driver = {
+       name: "compat"
+};
+
+struct pci_driver *
+pci_dev_driver(struct pci_dev *dev)
+{
+       if (dev->driver)
+               return dev->driver;
+       else {
+               int i;
+               for(i=0; i<=PCI_ROM_RESOURCE; i++)
+                       if (dev->resource[i].flags & IORESOURCE_BUSY)
+                               return &pci_compat_driver;
+       }
+       return NULL;
+}
+
 
 /*
  * This interrupt-safe spinlock protects all accesses to PCI
index 28adb8e8a9186ece86cd46ed1d895e53e6ec6279..ed861ed035c6bf7be513f4f36fa21028506724c8 100644 (file)
@@ -28,10 +28,10 @@ EXPORT_SYMBOL(pci_simple_probe);
 EXPORT_SYMBOL(pci_set_power_state);
 EXPORT_SYMBOL(pci_assign_resource);
 EXPORT_SYMBOL(pci_setup_device);
-#ifdef CONFIG_PROC_FS
-EXPORT_SYMBOL(pci_proc_attach_device);
-EXPORT_SYMBOL(pci_proc_detach_device);
-#endif
+EXPORT_SYMBOL(pci_insert_device);
+EXPORT_SYMBOL(pci_remove_device);
+EXPORT_SYMBOL(pci_register_driver);
+EXPORT_SYMBOL(pci_unregister_driver);
 
 /* Obsolete functions */
 
index e2cb9e9d64c015f6dd6958eef879520c85f7a3ca..b687d612295141c99aed17560b3399bd1b69480b 100644 (file)
@@ -224,6 +224,7 @@ get_pci_dev_info(char *buf, char **start, off_t pos, int count)
 
        cnt = 0;
        pci_for_each_dev(dev) {
+               struct pci_driver *drv = pci_dev_driver(dev);
                len = sprintf(buf, "%02x%02x\t%04x%04x\t%x",
                        dev->bus->number,
                        dev->devfn,
@@ -237,6 +238,9 @@ get_pci_dev_info(char *buf, char **start, off_t pos, int count)
                for(i=0; i<7; i++)
                        len += sprintf(buf+len, LONG_FORMAT, dev->resource[i].start < dev->resource[i].end ?
                                       dev->resource[i].end - dev->resource[i].start + 1 : 0);
+               buf[len++] = '\t';
+               if (drv)
+                       len += sprintf(buf+len, "%s", drv->name);
                buf[len++] = '\n';
                at += len;
                if (at >= pos) {
index 88175e08db791431fe007014b97864a7dd380539..9aaf0a724002131d5bade8715ec3c57ecafedb55 100644 (file)
@@ -99,11 +99,6 @@ static int pc_debug = PCMCIA_DEBUG;
 #define PCDATA_CODE_TYPE       0x0014
 #define PCDATA_INDICATOR       0x0015
 
-#ifndef CONFIG_PROC_FS
-#define pci_proc_attach_device(dev)    do { } while (0)
-#define pci_proc_detach_device(dev)    do { } while (0)
-#endif
-
 typedef struct cb_config_t {
        struct pci_dev dev;
 } cb_config_t;
@@ -320,9 +315,7 @@ int cb_alloc(socket_info_t * s)
                        }
                }
 
-               list_add_tail(&dev->bus_list, &bus->devices);
-               list_add_tail(&dev->global_list, &pci_devices);
-               pci_proc_attach_device(dev);
+               pci_insert_device(dev, bus);
                pci_enable_device(dev);
        }
 
@@ -352,10 +345,8 @@ void cb_free(socket_info_t * s)
                for(i=0; i<s->functions; i++) {
                        struct pci_dev *dev = &c[i].dev;
 
-                       list_del(&dev->bus_list);
-                       list_del(&dev->global_list);
                        free_resources(dev);
-                       pci_proc_detach_device(dev);
+                       pci_remove_device(dev);
                }
                kfree(c);
                printk(KERN_INFO "cs: cb_free(bus %d)\n", s->cap.cb_dev->subordinate->number);
index 9a8ad136cc4d66edd54a0969ed94901c1e4188f7..ed116c5d9eb0c0a6aac5399721f7b26748326afa 100644 (file)
@@ -12,18 +12,16 @@ SUB_DIRS     :=
 MOD_SUB_DIRS := $(SUB_DIRS)
 ALL_SUB_DIRS := $(SUB_DIRS)
 
-L_TARGET := pnp.a
-MX_OBJS  :=
-LX_OBJS  := 
-MI_OBJS  :=
-MIX_OBJS :=
+ifeq ($(CONFIG_ISAPNP),m)
+M_OBJS   := isa-pnp.o
+endif
+
+O_TARGET := isa-pnp.o
+OX_OBJS  := isapnp.o
+O_OBJS   := quirks.o
 
-ifeq ($(CONFIG_ISAPNP),y)
-  LX_OBJS += isapnp.o quirks.o
-else
-  ifeq ($(CONFIG_ISAPNP),m)
-    MX_OBJS += isapnp.o quirks.o
-  endif
+ifdef CONFIG_PROC_FS
+O_OBJS   += isapnp_proc.o
 endif
 
 include $(TOPDIR)/Rules.make
index 8b6a42b7d82c93290b7451ff3beb3b806f393501..6f8fd0a4a92f66a5cab7c7ef9bcbc1bfe9f06f8b 100644 (file)
 #include <linux/ioport.h>
 #include <linux/string.h>
 #include <linux/malloc.h>
-#include <linux/proc_fs.h>
 #include <linux/delay.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <asm/irq.h>
 #include <linux/pci.h>
-#include <linux/vmalloc.h>
-#include <linux/poll.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
 #include <linux/isapnp.h>
 
 LIST_HEAD(isapnp_cards);
 LIST_HEAD(isapnp_devices);
 
-#define isapnp_for_each_card(card) \
-       for(card = pci_bus_b(isapnp_cards.next); card != pci_bus_b(&isapnp_cards); card = pci_bus_b(card->node.next))
-#define isapnp_for_each_dev(dev) \
-       for(dev = pci_dev_g(isapnp_devices.next); dev != pci_dev_g(&isapnp_devices); dev = pci_dev_g(dev->global_list.next))
-
-
-#ifdef CONFIG_PROC_FS
-#include "isapnp_proc.c"
-#endif
-
 #if 0
 #define ISAPNP_REGION_OK
 #endif
@@ -1000,6 +986,7 @@ static int __init isapnp_build_device_list(void)
                if (isapnp_checksum_value != 0x00)
                        printk("isapnp: checksum for device %i is not valid (0x%x)\n", csn, isapnp_checksum_value);
                card->checksum = isapnp_checksum_value;
+               INIT_LIST_HEAD(&card->devices);
 
                list_add_tail(&card->node, &isapnp_cards);
        }
index 1a742823f978eaef270c9122de76efe2c3ee380f..230ae1c3b9a397987855beac7bad005d57c6bd46 100644 (file)
  *
  */
 
+#define __NO_VERSION__
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/proc_fs.h>
+#include <linux/poll.h>
+#include <linux/vmalloc.h>
+#include <asm/uaccess.h>
+#include <linux/isapnp.h>
+
 struct isapnp_info_buffer {
        char *buffer;           /* pointer to begin of buffer */
        char *curr;             /* current position in buffer */
@@ -208,7 +219,7 @@ static struct inode_operations isapnp_info_entry_inode_operations =
        &isapnp_info_entry_operations,  /* default sound info directory file-ops */
 };
 
-static int __init isapnp_proc_init(void)
+int __init isapnp_proc_init(void)
 {
        struct proc_dir_entry *p;
 
@@ -222,7 +233,7 @@ static int __init isapnp_proc_init(void)
 }
 
 #ifdef MODULE
-static int isapnp_proc_done(void)
+int isapnp_proc_done(void)
 {
        if (isapnp_proc_entry)
                remove_proc_entry("isapnp",&proc_root);
@@ -533,10 +544,9 @@ static void isapnp_print_device(isapnp_info_buffer_t *buffer, struct pci_dev *de
  
 static void isapnp_info_read(isapnp_info_buffer_t *buffer)
 {
-       struct list_head *card_list;
-       
-       for (card_list = isapnp_cards.next; card_list != &isapnp_cards; card_list = card_list->next) {
-               struct pci_bus *card = list_entry(card_list, struct pci_bus, node);
+       struct pci_bus *card;
+
+       isapnp_for_each_card(card) {
                struct list_head *dev_list;
 
                isapnp_printf(buffer, "Card %i '", card->number);
@@ -547,10 +557,8 @@ static void isapnp_info_read(isapnp_info_buffer_t *buffer)
                if (card->productver)
                        isapnp_printf(buffer, " Product version %x.%x", card->productver >> 4, card->productver & 0x0f);
                isapnp_printf(buffer,"\n");
-               for (dev_list = card->devices.next; dev_list != &card->devices; dev_list = dev_list->next) {
-                       struct pci_dev *dev = list_entry(dev_list, struct pci_dev, bus_list);
-                       isapnp_print_device(buffer, dev);
-               }
+               for (dev_list = card->devices.next; dev_list != &card->devices; dev_list = dev_list->next)
+                       isapnp_print_device(buffer, pci_dev_b(dev_list));
        }
 }
 
@@ -644,12 +652,13 @@ static int isapnp_select_csn(char *line)
        isapnp_info_device = NULL;
        isapnp_get_str(index, line, sizeof(index));
        csn = simple_strtoul(index, NULL, 0);
+
        for (list = isapnp_cards.next; list != &isapnp_cards; list = list->next) {
-               isapnp_info_card = list_entry(list, struct pci_bus, node);
+               isapnp_info_card = pci_bus_b(list);
                if (isapnp_info_card->number == csn)
                        break;
        }
-       if (isapnp_info_card == NULL) {
+       if (list == &isapnp_cards) {
                printk("isapnp: cannot find CSN %i\n", csn);
                return 1;
        }
index fc6cc40d2fd7d8eda687df674bcc6caa18c84dd2..f884dfb1e112833ca8de81c1a5f9a52fd3c58162 100644 (file)
@@ -1,3 +1,9 @@
+Sat Jan 8  22:00 2000 Gerard Roudier (groudier@club-internet.fr)
+       * revision 3.2e
+       - Add year 2000 copyright.
+       - Display correctly bus signals when bus is detected wrong.
+       - Remove the dead code that broke driver 3.2d.
+
 Mon Dec 6  22:00 1999 Gerard Roudier (groudier@club-internet.fr)
        * revision 3.2d
        - Change messages written by the driver at initialisation and 
index 4980c2683601766843ca26c8b4d8eb6ee3281722..ed169320a0fcf92f18bd7e026dd368a715d8f282 100644 (file)
@@ -1,3 +1,9 @@
+Sat Jan 8  22:00 2000 Gerard Roudier (groudier@club-internet.fr)
+       * version sym53c8xx-1.5h
+       - Add year 2000 copyright.
+       - Display correctly bus signals when bus is detected wrong.
+       - Some fix for Sparc from DSM that went directly to kernel tree.
+
 Mon Dec 6  22:00 1999 Gerard Roudier (groudier@club-internet.fr)
        * version sym53c8xx-1.5g
        - Change messages written by the driver at initialisation and 
index 5ed9db9425d37efcb48005baa13c231d76fa74c6..315b21bb347482c6797855db3cd5e1829e6a8441 100644 (file)
@@ -73,7 +73,7 @@
 */
 
 /*
-**     December 6 1999, version 3.2d
+**     January 8 2000, version 3.2e
 **
 **     Supported SCSI-II features:
 **         Synchronous negotiation
 /*
 **     Name and version of the driver
 */
-#define SCSI_NCR_DRIVER_NAME   "ncr53c8xx - version 3.2d"
+#define SCSI_NCR_DRIVER_NAME   "ncr53c8xx - version 3.2e"
 
 #define SCSI_NCR_DEBUG_FLAGS   (0)
 
@@ -5400,11 +5400,13 @@ static int ncr_reset_scsi_bus(ncb_p np, int enab_int, int settle_delay)
        **      We are expecting RESET to be TRUE and other signals to be 
        **      FALSE.
        */
-       term =  INB(nc_sstat0);                         /* rst, sdp0 */
-       term =  ((term & 2) << 7) + ((term & 1) << 16);
-       term |= ((INB(nc_sstat2) & 0x01) << 25) |       /* sdp1 */
-               (INW(nc_sbdl) << 9) |                   /* d15-0 */
-               INB(nc_sbcl);   /* req, ack, bsy, sel, atn, msg, cd, io */
+
+       term =  INB(nc_sstat0);
+       term =  ((term & 2) << 7) + ((term & 1) << 17); /* rst sdp0 */
+       term |= ((INB(nc_sstat2) & 0x01) << 26) |       /* sdp1     */
+               ((INW(nc_sbdl) & 0xff)   << 9)  |       /* d7-0     */
+               ((INW(nc_sbdl) & 0xff00) << 10) |       /* d15-8    */
+               INB(nc_sbcl);   /* req ack bsy sel atn msg cd io    */
 
        if (!(np->features & FE_WIDE))
                term &= 0x3ffff;
@@ -9660,9 +9662,6 @@ ncr53c8xx_pci_init(Scsi_Host_Template *tpnt, pcidev_t pdev, ncr_device *device)
        uint irq;
        ulong base, base_2, io_port; 
        int i;
-#ifdef SCSI_NCR_NVRAM_SUPPORT
-       ncr_nvram *nvram = device->nvram;
-#endif
        ncr_chip *chip;
 
        /*
@@ -10001,52 +10000,7 @@ ncr53c8xx_pci_init(Scsi_Host_Template *tpnt, pcidev_t pdev, ncr_device *device)
        device->slot.io_port    = io_port;
        device->slot.irq        = irq;
        device->attach_done     = 0;
-#ifdef SCSI_NCR_NVRAM_SUPPORT
-       if (!nvram)
-               goto out;
 
-       /*
-       ** Get access to chip IO registers
-       */
-#ifdef NCR_IOMAPPED
-       request_region(io_port, 128, "ncr53c8xx");
-       device->slot.port = io_port;
-#else
-       device->slot.reg = (struct ncr_reg *) remap_pci_mem((ulong) base, 128);
-       if (!device->slot.reg)
-               goto out;
-#endif
-
-       /*
-       ** Try to read SYMBIOS nvram.
-       ** Data can be used to order booting of boards.
-       **
-       ** Data is saved in ncr_device structure if NVRAM found. This
-       ** is then used to find drive boot order for ncr_attach().
-       **
-       ** NVRAM data is passed to Scsi_Host_Template later during ncr_attach()
-       ** for any device set up.
-       **
-       ** Try to read TEKRAM nvram if Symbios nvram not found.
-       */
-
-       if      (!ncr_get_Symbios_nvram(&device->slot, &nvram->data.Symbios))
-               nvram->type = SCSI_NCR_SYMBIOS_NVRAM;
-       else if (!ncr_get_Tekram_nvram(&device->slot, &nvram->data.Tekram))
-               nvram->type = SCSI_NCR_TEKRAM_NVRAM;
-       else
-               nvram->type = 0;
-out:
-       /*
-       ** Release access to chip IO registers
-       */
-#ifdef NCR_IOMAPPED
-       release_region(device->slot.port, 128);
-#else
-       unmap_pci_mem((vm_offset_t) device->slot.reg, (u_long) 128);
-#endif
-
-#endif /* SCSI_NCR_NVRAM_SUPPORT */
        return 0;     
 }
 
index 8aa1244ea955e9d1b4e622466f5650ec2c80f44d..ada38de52771e5a78d8f7f200d4ca2957bb24f9c 100644 (file)
@@ -2,7 +2,9 @@
  * QLogic ISP1020 Intelligent SCSI Processor Driver (PCI)
  * Written by Erik H. Moe, ehm@cris.com
  * Copyright 1995, Erik H. Moe
- * Copyright 1996, 1997  Michael A. Griffith <grif@acm.org> 
+ * Copyright 1996, 1997  Michael A. Griffith <grif@acm.org>
+ * Copyright 2000, Jayson C. Vantuyl <vantuyl@csc.smsu.edu>
+ *             and Bryon W. Roche    <bryon@csc.smsu.edu>
  *
  * 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
@@ -555,6 +557,10 @@ static void        isp1020_print_scsi_cmd(Scsi_Cmnd *);
 static void    isp1020_print_status_entry(struct Status_Entry *);
 #endif
 
+/* memaddr should be used to determine if memmapped port i/o is being used
+ * non-null memaddr == mmap'd
+ * JV 7-Jan-2000
+ */
 static inline u_short isp_inw(struct Scsi_Host *host, long offset)
 {
        struct isp1020_hostdata *h = (struct isp1020_hostdata *)host->hostdata;
@@ -607,15 +613,23 @@ int isp1020_detect(Scsi_Host_Template *tmpt)
                hostdata = (struct isp1020_hostdata *) host->hostdata;
 
                memset(hostdata, 0, sizeof(struct isp1020_hostdata));
+
                hostdata->pci_dev = pdev;
 
-               if (isp1020_init(host) || isp1020_reset_hardware(host)
+               if (isp1020_init(host)) {
+                       scsi_unregister(host);
+                       continue;
+               }
+               
+               if (isp1020_reset_hardware(host)
 #if USE_NVRAM_DEFAULTS
                    || isp1020_get_defaults(host)
 #else
                    || isp1020_set_defaults(host)
 #endif /* USE_NVRAM_DEFAULTS */
                    || isp1020_load_parameters(host)) {
+                       iounmap((void *)hostdata->memaddr);
+                       release_region(host->io_port, 0xff);
                        scsi_unregister(host);
                        continue;
                }
@@ -627,21 +641,12 @@ int isp1020_detect(Scsi_Host_Template *tmpt)
                {
                        printk("qlogicisp : interrupt %d already in use\n",
                               host->irq);
+                       iounmap((void *)hostdata->memaddr);
+                       release_region(host->io_port, 0xff);
                        scsi_unregister(host);
                        continue;
                }
 
-               if (check_region(host->io_port, 0xff)) {
-                       printk("qlogicisp : i/o region 0x%lx-0x%lx already "
-                              "in use\n",
-                              host->io_port, host->io_port + 0xff);
-                       free_irq(host->irq, host);
-                       scsi_unregister(host);
-                       continue;
-               }
-
-               request_region(host->io_port, 0xff, "qlogicisp");
-
                isp_outw(0x0, host, PCI_SEMAPHORE);
                isp_outw(HCCR_CLEAR_RISC_INTR, host, HOST_HCCR);
                isp1020_enable_irqs(host);
@@ -666,6 +671,8 @@ int isp1020_release(struct Scsi_Host *host)
        isp_outw(0x0, host, PCI_INTF_CTL);
        free_irq(host->irq, host);
 
+       iounmap((void *)hostdata->memaddr);
+
        release_region(host->io_port, 0xff);
 
        LEAVE("isp1020_release");
@@ -685,8 +692,8 @@ const char *isp1020_info(struct Scsi_Host *host)
        sprintf(buf,
                "QLogic ISP1020 SCSI on PCI bus %02x device %02x irq %d %s base 0x%lx",
                hostdata->pci_dev->bus->number, hostdata->pci_dev->devfn, host->irq,
-               (host->io_port ? "I/O" : "MEM"),
-               (host->io_port ? host->io_port : hostdata->memaddr));
+               (hostdata->memaddr ? "MEM" : "I/O"),
+               (hostdata->memaddr ? hostdata->memaddr : host->io_port));
 
        LEAVE("isp1020_info");
 
@@ -1255,27 +1262,37 @@ static int isp1020_init(struct Scsi_Host *sh)
        command &= ~PCI_COMMAND_MEMORY; 
 #endif
 
+       if (!(command & PCI_COMMAND_MASTER)) {
+               printk("qlogicisp : bus mastering is disabled\n");
+               return 1;
+       }
+
+       sh->io_port = io_base;
+
+       if (check_region(sh->io_port, 0xff)) {
+               printk("qlogicisp : i/o region 0x%lx-0x%lx already "
+                      "in use\n",
+                      sh->io_port, sh->io_port + 0xff);
+               return 1;
+       }
+
+       request_region(sh->io_port, 0xff, "qlogicisp");
+
        if ((command & PCI_COMMAND_MEMORY) &&
            ((mem_flags & 1) == 0)) {
                mem_base = (u_long) ioremap(mem_base, PAGE_SIZE);
                hostdata->memaddr = mem_base;
-               io_base = 0;
        } else {
                if (command & PCI_COMMAND_IO && (io_flags & 3) != 1)
                {
                        printk("qlogicisp : i/o mapping is disabled\n");
+                       release_region(sh->io_port, 0xff);
                        return 1;
                }
-               hostdata->memaddr = 0;
-               sh->io_port = io_base;
+               hostdata->memaddr = 0; /* zero to signify no i/o mapping */
                mem_base = 0;
        }
 
-       if (!(command & PCI_COMMAND_MASTER)) {
-               printk("qlogicisp : bus mastering is disabled\n");
-               return 1;
-       }
-
        if (revision != ISP1020_REV_ID)
                printk("qlogicisp : new isp1020 revision ID (%d)\n", revision);
 
@@ -1285,6 +1302,8 @@ static int isp1020_init(struct Scsi_Host *sh)
                printk("qlogicisp : can't decode %s address space 0x%lx\n",
                       (io_base ? "I/O" : "MEM"),
                       (io_base ? io_base : mem_base));
+               iounmap((void *)hostdata->memaddr);
+               release_region(sh->io_port, 0xff);
                return 1;
        }
 
index 8d49c6e79c28a20128b8e9749fafbe5e08e0adbe..3dffe88ad323e57552a73925ee723605b0549f6b 100644 (file)
@@ -790,7 +790,9 @@ __inline static int __init_io(Scsi_Cmnd * SCpnt,
         */
        if (count != SCpnt->use_sg) {
                printk("Incorrect number of segments after building list\n");
+#ifdef CONFIG_SCSI_DEBUG_QUEUES
                dump_stats(req, use_clustering, dma_host, count);
+#endif
        }
        if (!dma_host) {
                return 1;
index 15dbbd965173cd49c813ff33afd5f9a1b9254349..f56d6675611fde3ba0e4ac8df01740b606520f78 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
 **  High Performance device driver for the Symbios 53C896 controller.
 **
-**  Copyright (C) 1998-1999  Gerard Roudier <groudier@club-internet.fr>
+**  Copyright (C) 1998-2000  Gerard Roudier <groudier@club-internet.fr>
 **
 **  This driver also supports all the Symbios 53C8XX controller family, 
 **  except 53C810 revisions < 16, 53C825 revisions < 16 and all 
@@ -55,7 +55,7 @@
 */
 
 /*
-**     December 6 1999, sym53c8xx 1.5g
+**     January 9 2000, sym53c8xx 1.5h
 **
 **     Supported SCSI features:
 **         Synchronous data transfers
@@ -84,7 +84,7 @@
 /*
 **     Name and version of the driver
 */
-#define SCSI_NCR_DRIVER_NAME   "sym53c8xx - version 1.5g"
+#define SCSI_NCR_DRIVER_NAME   "sym53c8xx - version 1.5h"
 
 /* #define DEBUG_896R1 */
 #define SCSI_NCR_OPTIMIZE_896
@@ -6367,11 +6367,12 @@ static int ncr_reset_scsi_bus(ncb_p np, int enab_int, int settle_delay)
        **      We are expecting RESET to be TRUE and other signals to be 
        **      FALSE.
        */
-       term =  INB(nc_sstat0);                         /* rst, sdp0 */
-       term =  ((term & 2) << 7) + ((term & 1) << 16);
-       term |= ((INB(nc_sstat2) & 0x01) << 25) |       /* sdp1 */
-               (INW(nc_sbdl) << 9) |                   /* d15-0 */
-               INB(nc_sbcl);   /* req, ack, bsy, sel, atn, msg, cd, io */
+       term =  INB(nc_sstat0);
+       term =  ((term & 2) << 7) + ((term & 1) << 17); /* rst sdp0 */
+       term |= ((INB(nc_sstat2) & 0x01) << 26) |       /* sdp1     */
+               ((INW(nc_sbdl) & 0xff)   << 9)  |       /* d7-0     */
+               ((INW(nc_sbdl) & 0xff00) << 10) |       /* d15-8    */
+               INB(nc_sbcl);   /* req ack bsy sel atn msg cd io    */
 
        if (!(np->features & FE_WIDE))
                term &= 0x3ffff;
index 4e39980c4d7d30c75504f97d8e0466f517311c85..128fe165d4750eb4169188dcd1ba46a6ff3e59e3 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
 **  High Performance device driver for the Symbios 53C896 controller.
 **
-**  Copyright (C) 1998-1999  Gerard Roudier <groudier@club-internet.fr>
+**  Copyright (C) 1998-2000  Gerard Roudier <groudier@club-internet.fr>
 **
 **  This driver also supports all the Symbios 53C8XX controller family, 
 **  except 53C810 revisions < 16, 53C825 revisions < 16 and all 
index 99d894ca98881e5709fb0031545c5482513d6369..a035efd31257a18eeafa02f7e4397e2c18aa4160 100644 (file)
@@ -1,7 +1,7 @@
 /******************************************************************************
 **  High Performance device driver for the Symbios 53C896 controller.
 **
-**  Copyright (C) 1998-1999  Gerard Roudier <groudier@club-internet.fr>
+**  Copyright (C) 1998-2000  Gerard Roudier <groudier@club-internet.fr>
 **
 **  This driver also supports all the Symbios 53C8XX controller family, 
 **  except 53C810 revisions < 16, 53C825 revisions < 16 and all 
index cf83c755ec163d161bbeabfe1e9f976075883d21..07d2789ce79397fbfa022dc9c3b05c9ecc34c890 100644 (file)
@@ -4805,98 +4805,6 @@ aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
 }
 #endif /* CONFIG_PMAC_PBOOK */
 
-#ifdef CONFIG_PMAC_PBOOK
-/*
- * Save the contents of the frame buffer when we go to sleep,
- * and restore it when we wake up again.
- */
-int
-aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
-{
-       struct fb_info_aty *info;
-       unsigned int pm;
-       
-       for (info = first_display; info != NULL; info = info->next) {
-               struct fb_fix_screeninfo fix;
-               int nb;
-               
-               atyfb_get_fix(&fix, fg_console, (struct fb_info *)info);
-               nb = fb_display[fg_console].var.yres * fix.line_length;
-
-               switch (when) {
-               case PBOOK_SLEEP_NOW:
-                       /* Stop accel engine (stop bus mastering) */
-                       if (info->current_par.accel_flags & FB_ACCELF_TEXT)
-                               reset_engine(info);
-#if 1
-                       /* Backup fb content */ 
-                       info->save_framebuffer = vmalloc(nb);
-                       if (info->save_framebuffer)
-                               memcpy(info->save_framebuffer,
-                                      (void *)info->frame_buffer, nb);
-#endif
-                       /* Blank display and LCD */                                    
-                       atyfbcon_blank(VESA_POWERDOWN+1, (struct fb_info *)info);                       
-                       
-                       /* Set chip to "suspend" mode. Note: There's an HW bug in the
-                          chip which prevents proper resync on wakeup with automatic
-                          power management, we handle suspend manually using the
-                          following (weird) sequence described by ATI. Note2:
-                          We could enable this for all Rage LT Pro chip ids */
-                       if ((Gx == LG_CHIP_ID) || (Gx == LT_CHIP_ID) || (Gx == LP_CHIP_ID)) {
-                               pm = aty_ld_le32(POWER_MANAGEMENT, info);
-                               pm &= ~PWR_MGT_ON;
-                               aty_st_le32(POWER_MANAGEMENT, pm, info);
-                               pm = aty_ld_le32(POWER_MANAGEMENT, info);
-                               pm &= ~(PWR_BLON | AUTO_PWR_UP);
-                               pm |= SUSPEND_NOW;
-                               aty_st_le32(POWER_MANAGEMENT, pm, info);
-                               pm = aty_ld_le32(POWER_MANAGEMENT, info);
-                               pm |= PWR_MGT_ON;
-                               aty_st_le32(POWER_MANAGEMENT, pm, info);
-                               do {
-                                       pm = aty_ld_le32(POWER_MANAGEMENT, info);
-                               } while ((pm & PWR_MGT_STATUS_MASK) != PWR_MGT_STATUS_SUSPEND);
-                               mdelay(500);
-                       }
-                       break;
-               case PBOOK_WAKE:
-                       /* Wakeup chip */
-                       if ((Gx == LG_CHIP_ID) || (Gx == LT_CHIP_ID) || (Gx == LP_CHIP_ID)) {
-                               pm = aty_ld_le32(POWER_MANAGEMENT, info);
-                               pm &= ~PWR_MGT_ON;
-                               aty_st_le32(POWER_MANAGEMENT, pm, info);
-                               pm = aty_ld_le32(POWER_MANAGEMENT, info);
-                               pm |=  (PWR_BLON | AUTO_PWR_UP);
-                               pm &= ~SUSPEND_NOW;
-                               aty_st_le32(POWER_MANAGEMENT, pm, info);
-                               pm = aty_ld_le32(POWER_MANAGEMENT, info);
-                               pm |= PWR_MGT_ON;
-                               aty_st_le32(POWER_MANAGEMENT, pm, info);
-                               do {
-                                       pm = aty_ld_le32(POWER_MANAGEMENT, info);
-                               } while ((pm & PWR_MGT_STATUS_MASK) != 0);
-                               mdelay(500);
-                       }
-#if 1
-                       /* Restore fb content */                        
-                       if (info->save_framebuffer) {
-                               memcpy((void *)info->frame_buffer,
-                                      info->save_framebuffer, nb);
-                               vfree(info->save_framebuffer);
-                               info->save_framebuffer = 0;
-                       }
-#endif
-                       /* Restore display */                   
-                       atyfb_set_par(&info->current_par, info);
-                       atyfbcon_blank(0, (struct fb_info *)info);
-                       break;
-               }
-       }
-       return PBOOK_SLEEP_OK;
-}
-#endif /* CONFIG_PMAC_PBOOK */
-
 #ifdef MODULE
 int __init init_module(void)
 {
index f4e02c2e8673ba083bb14d0de79ed294076dfae5..c29fef5ea7379a66e6983eeb40322c8f020d3bab 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <linux/fs.h>
+#include <linux/locks.h>
 
 
 
@@ -40,10 +41,21 @@ static int sync_indirect(struct inode * inode, u32 * block, int wait)
        if (!bh)
                return 0;
        if (wait && buffer_req(bh) && !buffer_uptodate(bh)) {
-               brelse(bh);
-               return -1;
+               /* There can be a parallell read(2) that started read-I/O
+                  on the buffer so we can't assume that there's been
+                  an I/O error without first waiting I/O completation. */
+               wait_on_buffer(bh);
+               if (!buffer_uptodate(bh))
+               {
+                       brelse (bh);
+                       return -1;
+               }
        }
        if (wait || !buffer_uptodate(bh) || !buffer_dirty(bh)) {
+               if (wait)
+                       /* when we return from fsync all the blocks
+                          must be _just_ stored on disk */
+                       wait_on_buffer(bh);
                brelse(bh);
                return 0;
        }
index b4f952d07301284b7d80f8fb5de8af551efb0f2d..d3c395914f4433c97b71519ac32fc9aa70dae7f7 100644 (file)
@@ -254,6 +254,8 @@ repeat:
        }
        if (metadata) {
                result = getblk (inode->i_dev, tmp, blocksize);
+               if (!buffer_uptodate(result))
+                       wait_on_buffer(result);
                memset(result->b_data, 0, blocksize);
                mark_buffer_uptodate(result, 1);
                mark_buffer_dirty(result, 1);
@@ -363,6 +365,8 @@ repeat:
                goto out;
        if (metadata) {
                result = getblk (bh->b_dev, tmp, blocksize);
+               if (!buffer_uptodate(result))
+                       wait_on_buffer(result);
                memset(result->b_data, 0, inode->i_sb->s_blocksize);
                mark_buffer_uptodate(result, 1);
                mark_buffer_dirty(result, 1);
@@ -542,6 +546,8 @@ struct buffer_head * ext2_getblk(struct inode * inode, long block, int create, i
                struct buffer_head *bh;
                bh = getblk(dummy.b_dev, dummy.b_blocknr, inode->i_sb->s_blocksize);
                if (buffer_new(&dummy)) {
+                       if (!buffer_uptodate(bh))
+                               wait_on_buffer(bh);
                        memset(bh->b_data, 0, inode->i_sb->s_blocksize);
                        mark_buffer_uptodate(bh, 1);
                        mark_buffer_dirty(bh, 1);
index eaabf2f7c5c0de692791994d0bc3aa2d391c7b34..4eaefe723f427b37f1eda48f63f54d61f7ff0d2a 100644 (file)
@@ -88,7 +88,7 @@ int expand_kiobuf(struct kiobuf *iobuf, int wanted)
                return 0;
        }
        
-       memcpy (maplist,  iobuf->maplist,   wanted * sizeof(struct page **));
+       memcpy (maplist, iobuf->maplist, iobuf->array_len * sizeof(struct page **));
 
        if (iobuf->array_len > KIO_STATIC_PAGES)
                kfree (iobuf->maplist);
index 1b4b7f23bd57fec9ced272698be1b7ab70e6b51c..88d41c3c21f4d7f48b24679716b03d21a1aa611e 100644 (file)
@@ -59,8 +59,8 @@ static void add_node(struct device_node *np, struct proc_dir_entry *de)
                 * Unfortunately proc_register puts each new entry
                 * at the beginning of the list.  So we rearrange them.
                 */
-               ent = create_proc_read_entry(de, 0, pp->name,
-                                               property_read_proc, pp);
+               ent = create_proc_read_entry(pp->name, S_IRUGO, de,
+                                            property_read_proc, pp);
                if (ent == 0)
                        break;
                ent->size = pp->length;
@@ -77,7 +77,7 @@ static void add_node(struct device_node *np, struct proc_dir_entry *de)
                l = strlen(p);
                if (l > 2 && p[l-2] == '@' && p[l-1] == '0')
                        l -= 2;
-               ent = proc_mkdir(de, p);
+               ent = proc_mkdir(p, de);
                if (ent == 0)
                        break;
                *lastp = ent;
@@ -99,7 +99,7 @@ static void add_node(struct device_node *np, struct proc_dir_entry *de)
                        if (sib->name && strcmp(sib->name, child->name) == 0)
                                break;
                if (sib == child && strncmp(p, child->name, l) != 0) {
-                       al = proc_symlink(de, child->name, ent->name);
+                       al = proc_symlink(child->name, de, ent->name);
                        if (al == 0)
                                break;
                        *lastp = al;
@@ -109,7 +109,7 @@ static void add_node(struct device_node *np, struct proc_dir_entry *de)
                /*
                 * Add another directory with the @address part as its name.
                 */
-               al = proc_symlink(de, at, ent->name);
+               al = proc_symlink(at, de, ent->name);
                if (al == 0)
                        break;
                proc_register(de, al);
index 7c986d6151b319fbf50a524447edfd0218ea51e3..45d80dd5fd4e0c805d54ae8db47046561841126f 100644 (file)
@@ -17,6 +17,7 @@ EXPORT_SYMBOL(proc_root);
 EXPORT_SYMBOL(proc_root_fs);
 EXPORT_SYMBOL(proc_net);
 EXPORT_SYMBOL(proc_bus);
+EXPORT_SYMBOL(proc_root_driver);
 
 static struct file_system_type proc_fs_type = {
        "proc", 
index 66368dfcb48179a1749da80aaffb750a5d90ff62..70b020b6716f2c4a2ad8d85e72f056c6d3c672c6 100644 (file)
@@ -146,6 +146,8 @@ void isapnp_activate(unsigned char device);
 void isapnp_deactivate(unsigned char device);
 void isapnp_fixup_device(struct pci_dev *dev);
 void *isapnp_alloc(long size);
+int isapnp_proc_init(void);
+int isapnp_proc_done(void);
 /* manager */
 struct pci_bus *isapnp_find_card(unsigned short vendor,
                                 unsigned short device,
@@ -161,6 +163,14 @@ void isapnp_resource_change(struct resource *resource,
 /* init/main.c */
 int isapnp_init(void);
 
+extern struct list_head isapnp_cards;
+extern struct list_head isapnp_devices;
+
+#define isapnp_for_each_card(card) \
+       for(card = pci_bus_b(isapnp_cards.next); card != pci_bus_b(&isapnp_cards); card = pci_bus_b(card->node.next))
+#define isapnp_for_each_dev(dev) \
+       for(dev = pci_dev_g(isapnp_devices.next); dev != pci_dev_g(&isapnp_devices); dev = pci_dev_g(dev->global_list.next))
+
 #else /* !CONFIG_ISAPNP */
 
 /* lowlevel configuration */
@@ -173,21 +183,21 @@ extern inline unsigned int isapnp_read_dword(unsigned char idx) { return 0xfffff
 extern inline void isapnp_write_byte(unsigned char idx, unsigned char val) { ; }
 extern inline void isapnp_write_word(unsigned char idx, unsigned short val) { ; }
 extern inline void isapnp_write_dword(unsigned char idx, unsigned int val) { ; }
-extern void isapnp_wake(unsigned char csn) { ; }
-extern void isapnp_device(unsigned char device) { ; }
-extern void isapnp_activate(unsigned char device) { ; }
-extern void isapnp_deactivate(unsigned char device) { ; }
+extern inline void isapnp_wake(unsigned char csn) { ; }
+extern inline void isapnp_device(unsigned char device) { ; }
+extern inline void isapnp_activate(unsigned char device) { ; }
+extern inline void isapnp_deactivate(unsigned char device) { ; }
 /* manager */
-extern struct pci_bus *isapnp_find_card(unsigned short vendor,
-                                       unsigned short device,
-                                       struct pci_bus *from) { return NULL; }
-extern struct pci_dev *isapnp_find_dev(struct pci_bus *card,
-                                      unsigned short vendor,
-                                      unsigned short function,
+extern inline struct pci_bus *isapnp_find_card(unsigned short vendor,
+                                              unsigned short device,
+                                              struct pci_bus *from) { return NULL; }
+extern inline struct pci_dev *isapnp_find_dev(struct pci_bus *card,
+                                             unsigned short vendor,
+                                             unsigned short function,
                                       struct pci_dev *from) { return NULL; }
-extern void isapnp_resource_change(struct resource *resource,
-                                  unsigned long start,
-                                  unsigned long size) { ; }
+extern inline void isapnp_resource_change(struct resource *resource,
+                                         unsigned long start,
+                                         unsigned long size) { ; }
 
 #endif /* CONFIG_ISAPNP */
 
index 4a7425238169adc68439cfeb42da40bea794a47f..5b4abfd562c9dd3ed42f476b91eded0c5128e96c 100644 (file)
@@ -311,9 +311,10 @@ struct pci_dev {
        unsigned short  subsystem_device;
        unsigned int    class;          /* 3 bytes: (base,sub,prog-if) */
        u8              hdr_type;       /* PCI header type (`multi' flag masked out) */
-       u8              rom_base_reg;   /* Which config register controls the ROM */
+       u8              rom_base_reg;   /* which config register controls the ROM */
 
-       unsigned short  regs;
+       struct pci_driver *driver;      /* which driver has allocated this device */
+       void            *driver_data;   /* data private to the driver */
 
        /* device is compatible with these IDs */
        unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE];
@@ -328,12 +329,13 @@ struct pci_dev {
        struct resource dma_resource[DEVICE_COUNT_DMA];
        struct resource irq_resource[DEVICE_COUNT_IRQ];
 
-       char            name[48];       /* Device name */
-       char            slot_name[8];   /* Slot name */
-       int active;                     /* device is active */
-       int ro;                         /* Read/Only */
+       char            name[48];       /* device name */
+       char            slot_name[8];   /* slot name */
+       int             active;         /* ISAPnP: device is active */
+       int             ro;             /* ISAPnP: read only */
+       unsigned short  regs;           /* ISAPnP: supported registers */
 
-       int (*prepare)(struct pci_dev *dev);
+       int (*prepare)(struct pci_dev *dev);    /* ISAPnP hooks */
        int (*activate)(struct pci_dev *dev);
        int (*deactivate)(struct pci_dev *dev);
 };
@@ -498,6 +500,23 @@ void pci_set_bus_ranges(void);
 void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
                    int (*)(struct pci_dev *, u8, u8));
 
+/* New-style probing supporting hot-pluggable devices */
+
+struct pci_driver {
+       struct list_head node;
+       char *name;
+       int (*probe)(struct pci_dev *dev);      /* New device inserted, check if known */
+       void (*remove)(struct pci_dev *dev);    /* Device removed */
+       void (*suspend)(struct pci_dev *dev);   /* Device suspended */
+       void (*resume)(struct pci_dev *dev);    /* Device woken up */
+};
+
+void pci_register_driver(struct pci_driver *);
+void pci_unregister_driver(struct pci_driver *);
+void pci_insert_device(struct pci_dev *, struct pci_bus *);
+void pci_remove_device(struct pci_dev *);
+struct pci_driver *pci_dev_driver(struct pci_dev *);
+
 /*
  * simple PCI probing for drivers (drivers/pci/helper.c)
  */
index 3e98379ed2f84829eb0f43a320b18173f0a33d83..1678b897c93593de1aac67f7b3a1a0a675914e2a 100644 (file)
@@ -181,11 +181,11 @@ extern inline struct proc_dir_entry *create_proc_entry(const char *name,
        mode_t mode, struct proc_dir_entry *parent) { return NULL; }
 
 extern inline void remove_proc_entry(const char *name, struct proc_dir_entry *parent) {};
-extern inline proc_dir_entry *proc_symlink(const char *name,
+extern inline struct proc_dir_entry *proc_symlink(const char *name,
                struct proc_dir_entry *parent,char *dest) {return NULL;}
-extern inline proc_dir_entry *proc_mknod(const char *name,mode_t mode,
+extern inline struct proc_dir_entry *proc_mknod(const char *name,mode_t mode,
                struct proc_dir_entry *parent,kdev_t rdev) {return NULL;}
-extern struct proc_dir_entry *proc_mkdir(const char *name,
+extern inline struct proc_dir_entry *proc_mkdir(const char *name,
        struct proc_dir_entry *parent) {return NULL;}
 
 extern inline struct proc_dir_entry *create_proc_read_entry(const char *name,
index 04e23d8276093045dfa6290fc1efe7ff6475063a..898966d403ccc0182ff9eec579e6dffc81a14dcf 100644 (file)
@@ -508,10 +508,10 @@ extern long FASTCALL(interruptible_sleep_on_timeout(wait_queue_head_t *q,
 extern void FASTCALL(wake_up_process(struct task_struct * tsk));
 
 #define wake_up(x)                     __wake_up((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE | TASK_EXCLUSIVE)
-#define wake_up_all(x)                 __wake_up_all((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE)
+#define wake_up_all(x)                 __wake_up((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE)
 #define wake_up_sync(x)                        __wake_up_sync((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE | TASK_EXCLUSIVE)
 #define wake_up_interruptible(x)       __wake_up((x),TASK_INTERRUPTIBLE | TASK_EXCLUSIVE)
-#define wake_up_interruptible_all(x)   __wake_up_all((x),TASK_INTERRUPTIBLE)
+#define wake_up_interruptible_all(x)   __wake_up((x),TASK_INTERRUPTIBLE)
 #define wake_up_interruptible_sync(x)  __wake_up_sync((x),TASK_INTERRUPTIBLE | TASK_EXCLUSIVE)
 
 extern int in_group_p(gid_t);
index 7307cc76a668ebf34fed121fc9b91878cc703733..b866777a6dcb38297489b5a8ceb41245134ef52c 100644 (file)
@@ -81,6 +81,7 @@ struct Qdisc
        unsigned                flags;
 #define TCQ_F_BUILTIN  1
 #define TCQ_F_THROTTLED        2
+#define TCQ_F_INGRES   4
        struct Qdisc_ops        *ops;
        struct Qdisc            *next;
        u32                     handle;
index c5c13afc14ac89533de7042a64628024d7d4aa55..7925e8f2365b944054f74b98b24408bb0b07ba05 100644 (file)
@@ -369,7 +369,7 @@ void *memchr(const void *s, int c, size_t n)
        const unsigned char *p = s;
        while (n-- != 0) {
                if ((unsigned char)c == *p++) {
-                       return (void *)p-1;
+                       return (void *)(p-1);
                }
        }
        return NULL;