r4497 - dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian
Sven Luther
luther at costa.debian.org
Sun Oct 16 23:09:37 UTC 2005
Author: luther
Date: 2005-10-16 23:09:36 +0000 (Sun, 16 Oct 2005)
New Revision: 4497
Removed:
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/amd64-tlb-flush-sigsegv-fix.patch
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/kernel-api-documentation-generation-fix.diff
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/m68k-sonic.patch
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/mempolicy-check-mode.patch
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.1
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.2
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.3
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.4
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/powerpc-pmac-sound-check.patch
dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/powerpc-ppc64-biarch-override.patch
Log:
Removed upstream applied patches.
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/amd64-tlb-flush-sigsegv-fix.patch
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/amd64-tlb-flush-sigsegv-fix.patch 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/amd64-tlb-flush-sigsegv-fix.patch 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,47 +0,0 @@
-From: Linus Torvalds <torvalds at g5.osdl.org>
-Date: Sat, 17 Sep 2005 22:41:04 +0000 (-0700)
-Subject: x86-64/smp: fix random SIGSEGV issues
-X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=bc5e8fdfc622b03acf5ac974a1b8b26da6511c99
-
- x86-64/smp: fix random SIGSEGV issues
-
- They seem to have been due to AMD errata 63/122; the fix is to disable
- TLB flush filtering in SMP configurations.
-
- Confirmed to fix the problem by Andrew Walrond <andrew at walrond.org>
-
- [ Let's see if we'll have a better fix eventually, this is the Q&D
- "let's get this fixed and out there" version ]
-
- Signed-off-by: Linus Torvalds <torvalds at osdl.org>
----
-
---- a/arch/x86_64/kernel/setup.c
-+++ b/arch/x86_64/kernel/setup.c
-@@ -793,11 +793,26 @@
- #endif
- }
-
-+#define HWCR 0xc0010015
-+
- static int __init init_amd(struct cpuinfo_x86 *c)
- {
- int r;
- int level;
-
-+#ifdef CONFIG_SMP
-+ unsigned long value;
-+
-+ // Disable TLB flush filter by setting HWCR.FFDIS:
-+ // bit 6 of msr C001_0015
-+ //
-+ // Errata 63 for SH-B3 steppings
-+ // Errata 122 for all(?) steppings
-+ rdmsrl(HWCR, value);
-+ value |= 1 << 6;
-+ wrmsrl(HWCR, value);
-+#endif
-+
- /* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
- 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */
- clear_bit(0*32+31, &c->x86_capability);
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/kernel-api-documentation-generation-fix.diff
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/kernel-api-documentation-generation-fix.diff 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/kernel-api-documentation-generation-fix.diff 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,31 +0,0 @@
-From: Martin Waitz <tali at admingilde.org>
-Date: Fri, 9 Sep 2005 20:10:17 +0000 (-0700)
-Subject: [PATCH] DocBook: fix kernel-api documentation generation
-X-Git-Tag: v2.6.14-rc1
-X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9d01a82e46a8dd18233121a6bc140e5576649583
-
- [PATCH] DocBook: fix kernel-api documentation generation
-
- This patch changes a macro definition so that kernel-doc can understand it.
-
- Signed-off-by: Martin Waitz <tali at admingilde.org>
- Signed-off-by: Andrew Morton <akpm at osdl.org>
- Signed-off-by: Linus Torvalds <torvalds at osdl.org>
----
-
---- a/include/sound/pcm.h
-+++ b/include/sound/pcm.h
-@@ -910,11 +910,10 @@ int snd_pcm_format_big_endian(snd_pcm_fo
- * Returns 1 if the given PCM format is CPU-endian, 0 if
- * opposite, or a negative error code if endian not specified.
- */
--/* int snd_pcm_format_cpu_endian(snd_pcm_format_t format); */
- #ifdef SNDRV_LITTLE_ENDIAN
--#define snd_pcm_format_cpu_endian snd_pcm_format_little_endian
-+#define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format)
- #else
--#define snd_pcm_format_cpu_endian snd_pcm_format_big_endian
-+#define snd_pcm_format_cpu_endian(format) snd_pcm_format_big_endian(format)
- #endif
- int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */
- int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/m68k-sonic.patch
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/m68k-sonic.patch 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/m68k-sonic.patch 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,2650 +0,0 @@
-
-The purpose of this patch:
-
-- Adopt the DMA API (jazzsonic, macsonic & core driver).
-
-- Adopt the driver model (macsonic).
-
-This part was cribbed from jazzsonic. As a consequence, macsonic once
-again works as a module. Driver model is also used by the DMA calls.
-
-- Support 16 bit cards (macsonic & core driver, also affects jazzsonic)
-
-This code was adapted from the mac68k linux 2.2 kernel, where it has
-languished for a long time.
-
-- Support more 32-bit mac cards (macsonic)
-
-Also from mac68k repo.
-
-- Zero-copy buffer handling (core driver)
-
-Provides a nice performance improvement. The new algorithm incidentally
-helped to replace the old Jazz DMA code.
-
-The patch was tested on a variety of macs (several 32-bit quadra built-in
-NICs, a 16-bit LC PDS NIC and a 16-bit comm-slot NIC), and also on MIPS
-Jazz.
-
-This patch combines the three previous patches in this thread.
-
-
-Signed-off-by: Finn Thain <fthain at telegraphics.com.au>
-Acked-by: Thomas Bogendoerfer <tsbogend at alpha.franken.de>
-Acked-by: Jeff Garzik <jgarzik at pobox.com>
-
-
-
---- orig/drivers/net/Space.c Sun Jul 10 22:11:34 2005
-+++ linux/drivers/net/Space.c Sun Jul 10 22:11:46 2005
-@@ -87,7 +87,6 @@
- extern struct net_device *tc515_probe(int unit);
- extern struct net_device *lance_probe(int unit);
- extern struct net_device *mace_probe(int unit);
--extern struct net_device *macsonic_probe(int unit);
- extern struct net_device *mac8390_probe(int unit);
- extern struct net_device *mac89x0_probe(int unit);
- extern struct net_device *mc32_probe(int unit);
-@@ -289,9 +288,6 @@
- #endif
- #ifdef CONFIG_MACMACE /* Mac 68k Quadra AV builtin Ethernet */
- {mace_probe, 0},
--#endif
--#ifdef CONFIG_MACSONIC /* Mac SONIC-based Ethernet of all sorts */
-- {macsonic_probe, 0},
- #endif
- #ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */
- {mac8390_probe, 0},
---- orig/drivers/net/jazzsonic.c Sun Jul 10 22:11:34 2005
-+++ linux/drivers/net/jazzsonic.c Sun Jul 10 22:22:39 2005
-@@ -1,5 +1,10 @@
- /*
-- * sonic.c
-+ * jazzsonic.c
-+ *
-+ * (C) 2005 Finn Thain
-+ *
-+ * Converted to DMA API, and (from the mac68k project) introduced
-+ * dhd's support for 16-bit cards.
- *
- * (C) 1996,1998 by Thomas Bogendoerfer (tsbogend at alpha.franken.de)
- *
-@@ -28,8 +33,8 @@
- #include <linux/netdevice.h>
- #include <linux/etherdevice.h>
- #include <linux/skbuff.h>
--#include <linux/bitops.h>
- #include <linux/device.h>
-+#include <linux/dma-mapping.h>
-
- #include <asm/bootinfo.h>
- #include <asm/system.h>
-@@ -44,22 +49,20 @@
-
- #define SONIC_MEM_SIZE 0x100
-
--#define SREGS_PAD(n) u16 n;
--
- #include "sonic.h"
-
- /*
- * Macros to access SONIC registers
- */
--#define SONIC_READ(reg) (*((volatile unsigned int *)base_addr+reg))
-+#define SONIC_READ(reg) (*((volatile unsigned int *)dev->base_addr+reg))
-
- #define SONIC_WRITE(reg,val) \
- do { \
-- *((volatile unsigned int *)base_addr+(reg)) = (val); \
-+ *((volatile unsigned int *)dev->base_addr+(reg)) = (val); \
- } while (0)
-
-
--/* use 0 for production, 1 for verification, >2 for debug */
-+/* use 0 for production, 1 for verification, >1 for debug */
- #ifdef SONIC_DEBUG
- static unsigned int sonic_debug = SONIC_DEBUG;
- #else
-@@ -85,18 +88,18 @@
- 0xffff /* end of list */
- };
-
--static int __init sonic_probe1(struct net_device *dev, unsigned long base_addr,
-- unsigned int irq)
-+static int __init sonic_probe1(struct net_device *dev)
- {
- static unsigned version_printed;
- unsigned int silicon_revision;
- unsigned int val;
-- struct sonic_local *lp;
-+ struct sonic_local *lp = netdev_priv(dev);
- int err = -ENODEV;
- int i;
-
-- if (!request_mem_region(base_addr, SONIC_MEM_SIZE, jazz_sonic_string))
-+ if (!request_mem_region(dev->base_addr, SONIC_MEM_SIZE, jazz_sonic_string))
- return -EBUSY;
-+
- /*
- * get the Silicon Revision ID. If this is one of the known
- * one assume that we found a SONIC ethernet controller at
-@@ -120,11 +123,7 @@
- if (sonic_debug && version_printed++ == 0)
- printk(version);
-
-- printk("%s: Sonic ethernet found at 0x%08lx, ", dev->name, base_addr);
--
-- /* Fill in the 'dev' fields. */
-- dev->base_addr = base_addr;
-- dev->irq = irq;
-+ printk(KERN_INFO "%s: Sonic ethernet found at 0x%08lx, ", lp->device->bus_id, dev->base_addr);
-
- /*
- * Put the sonic into software reset, then
-@@ -138,84 +137,44 @@
- dev->dev_addr[i*2+1] = val >> 8;
- }
-
-- printk("HW Address ");
-- for (i = 0; i < 6; i++) {
-- printk("%2.2x", dev->dev_addr[i]);
-- if (i<5)
-- printk(":");
-- }
--
-- printk(" IRQ %d\n", irq);
--
- err = -ENOMEM;
-
- /* Initialize the device structure. */
-- if (dev->priv == NULL) {
-- /*
-- * the memory be located in the same 64kb segment
-- */
-- lp = NULL;
-- i = 0;
-- do {
-- lp = kmalloc(sizeof(*lp), GFP_KERNEL);
-- if ((unsigned long) lp >> 16
-- != ((unsigned long)lp + sizeof(*lp) ) >> 16) {
-- /* FIXME, free the memory later */
-- kfree(lp);
-- lp = NULL;
-- }
-- } while (lp == NULL && i++ < 20);
--
-- if (lp == NULL) {
-- printk("%s: couldn't allocate memory for descriptors\n",
-- dev->name);
-- goto out;
-- }
-
-- memset(lp, 0, sizeof(struct sonic_local));
--
-- /* get the virtual dma address */
-- lp->cda_laddr = vdma_alloc(CPHYSADDR(lp),sizeof(*lp));
-- if (lp->cda_laddr == ~0UL) {
-- printk("%s: couldn't get DMA page entry for "
-- "descriptors\n", dev->name);
-- goto out1;
-- }
--
-- lp->tda_laddr = lp->cda_laddr + sizeof (lp->cda);
-- lp->rra_laddr = lp->tda_laddr + sizeof (lp->tda);
-- lp->rda_laddr = lp->rra_laddr + sizeof (lp->rra);
--
-- /* allocate receive buffer area */
-- /* FIXME, maybe we should use skbs */
-- lp->rba = kmalloc(SONIC_NUM_RRS * SONIC_RBSIZE, GFP_KERNEL);
-- if (!lp->rba) {
-- printk("%s: couldn't allocate receive buffers\n",
-- dev->name);
-- goto out2;
-- }
-+ lp->dma_bitmode = SONIC_BITMODE32;
-
-- /* get virtual dma address */
-- lp->rba_laddr = vdma_alloc(CPHYSADDR(lp->rba),
-- SONIC_NUM_RRS * SONIC_RBSIZE);
-- if (lp->rba_laddr == ~0UL) {
-- printk("%s: couldn't get DMA page entry for receive "
-- "buffers\n",dev->name);
-- goto out3;
-- }
--
-- /* now convert pointer to KSEG1 pointer */
-- lp->rba = (char *)KSEG1ADDR(lp->rba);
-- flush_cache_all();
-- dev->priv = (struct sonic_local *)KSEG1ADDR(lp);
-+ /* Allocate the entire chunk of memory for the descriptors.
-+ Note that this cannot cross a 64K boundary. */
-+ if ((lp->descriptors = dma_alloc_coherent(lp->device,
-+ SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
-+ &lp->descriptors_laddr, GFP_KERNEL)) == NULL) {
-+ printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", lp->device->bus_id);
-+ goto out;
- }
-
-- lp = (struct sonic_local *)dev->priv;
-+ /* Now set up the pointers to point to the appropriate places */
-+ lp->cda = lp->descriptors;
-+ lp->tda = lp->cda + (SIZEOF_SONIC_CDA
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ lp->rda = lp->tda + (SIZEOF_SONIC_TD * SONIC_NUM_TDS
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ lp->rra = lp->rda + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-+
-+ lp->cda_laddr = lp->descriptors_laddr;
-+ lp->tda_laddr = lp->cda_laddr + (SIZEOF_SONIC_CDA
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ lp->rda_laddr = lp->tda_laddr + (SIZEOF_SONIC_TD * SONIC_NUM_TDS
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-+
- dev->open = sonic_open;
- dev->stop = sonic_close;
- dev->hard_start_xmit = sonic_send_packet;
-- dev->get_stats = sonic_get_stats;
-+ dev->get_stats = sonic_get_stats;
- dev->set_multicast_list = &sonic_multicast_list;
-+ dev->tx_timeout = sonic_tx_timeout;
- dev->watchdog_timeo = TX_TIMEOUT;
-
- /*
-@@ -226,14 +185,8 @@
- SONIC_WRITE(SONIC_MPT,0xffff);
-
- return 0;
--out3:
-- kfree(lp->rba);
--out2:
-- vdma_free(lp->cda_laddr);
--out1:
-- kfree(lp);
- out:
-- release_region(base_addr, SONIC_MEM_SIZE);
-+ release_region(dev->base_addr, SONIC_MEM_SIZE);
- return err;
- }
-
-@@ -245,7 +198,6 @@
- {
- struct net_device *dev;
- struct sonic_local *lp;
-- unsigned long base_addr;
- int err = 0;
- int i;
-
-@@ -255,21 +207,26 @@
- if (mips_machgroup != MACH_GROUP_JAZZ)
- return -ENODEV;
-
-- dev = alloc_etherdev(0);
-+ dev = alloc_etherdev(sizeof(struct sonic_local));
- if (!dev)
- return -ENOMEM;
-
-+ lp = netdev_priv(dev);
-+ lp->device = device;
-+ SET_NETDEV_DEV(dev, device);
-+ SET_MODULE_OWNER(dev);
-+
- netdev_boot_setup_check(dev);
-- base_addr = dev->base_addr;
-
-- if (base_addr >= KSEG0) { /* Check a single specified location. */
-- err = sonic_probe1(dev, base_addr, dev->irq);
-- } else if (base_addr != 0) { /* Don't probe at all. */
-+ if (dev->base_addr >= KSEG0) { /* Check a single specified location. */
-+ err = sonic_probe1(dev);
-+ } else if (dev->base_addr != 0) { /* Don't probe at all. */
- err = -ENXIO;
- } else {
- for (i = 0; sonic_portlist[i].port; i++) {
-- int io = sonic_portlist[i].port;
-- if (sonic_probe1(dev, io, sonic_portlist[i].irq) == 0)
-+ dev->base_addr = sonic_portlist[i].port;
-+ dev->irq = sonic_portlist[i].irq;
-+ if (sonic_probe1(dev) == 0)
- break;
- }
- if (!sonic_portlist[i].port)
-@@ -281,14 +238,17 @@
- if (err)
- goto out1;
-
-+ printk("%s: MAC ", dev->name);
-+ for (i = 0; i < 6; i++) {
-+ printk("%2.2x", dev->dev_addr[i]);
-+ if (i < 5)
-+ printk(":");
-+ }
-+ printk(" IRQ %d\n", dev->irq);
-+
- return 0;
-
- out1:
-- lp = dev->priv;
-- vdma_free(lp->rba_laddr);
-- kfree(lp->rba);
-- vdma_free(lp->cda_laddr);
-- kfree(lp);
- release_region(dev->base_addr, SONIC_MEM_SIZE);
- out:
- free_netdev(dev);
-@@ -296,21 +256,22 @@
- return err;
- }
-
--/*
-- * SONIC uses a normal IRQ
-- */
--#define sonic_request_irq request_irq
--#define sonic_free_irq free_irq
-+MODULE_DESCRIPTION("Jazz SONIC ethernet driver");
-+module_param(sonic_debug, int, 0);
-+MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)");
-
--#define sonic_chiptomem(x) KSEG1ADDR(vdma_log2phys(x))
-+#define SONIC_IRQ_FLAG SA_INTERRUPT
-
- #include "sonic.c"
-
- static int __devexit jazz_sonic_device_remove (struct device *device)
- {
- struct net_device *dev = device->driver_data;
-+ struct sonic_local* lp = netdev_priv(dev);
-
- unregister_netdev (dev);
-+ dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
-+ lp->descriptors, lp->descriptors_laddr);
- release_region (dev->base_addr, SONIC_MEM_SIZE);
- free_netdev (dev);
-
-@@ -323,7 +284,7 @@
- .probe = jazz_sonic_probe,
- .remove = __devexit_p(jazz_sonic_device_remove),
- };
--
-+
- static void jazz_sonic_platform_release (struct device *device)
- {
- struct platform_device *pldev;
-@@ -336,10 +297,11 @@
- static int __init jazz_sonic_init_module(void)
- {
- struct platform_device *pldev;
-+ int err;
-
-- if (driver_register(&jazz_sonic_driver)) {
-+ if ((err = driver_register(&jazz_sonic_driver))) {
- printk(KERN_ERR "Driver registration failed\n");
-- return -ENOMEM;
-+ return err;
- }
-
- jazz_sonic_device = NULL;
---- orig/drivers/net/macsonic.c Sun Jul 10 22:11:34 2005
-+++ linux/drivers/net/macsonic.c Sun Jul 10 22:23:06 2005
-@@ -1,6 +1,12 @@
- /*
- * macsonic.c
- *
-+ * (C) 2005 Finn Thain
-+ *
-+ * Converted to DMA API, converted to unified driver model, made it work as
-+ * a module again, and from the mac68k project, introduced more 32-bit cards
-+ * and dhd's support for 16-bit cards.
-+ *
- * (C) 1998 Alan Cox
- *
- * Debugging Andreas Ehliar, Michael Schmitz
-@@ -26,8 +32,8 @@
- */
-
- #include <linux/kernel.h>
-+#include <linux/module.h>
- #include <linux/types.h>
--#include <linux/ctype.h>
- #include <linux/fcntl.h>
- #include <linux/interrupt.h>
- #include <linux/init.h>
-@@ -41,8 +47,8 @@
- #include <linux/netdevice.h>
- #include <linux/etherdevice.h>
- #include <linux/skbuff.h>
--#include <linux/module.h>
--#include <linux/bitops.h>
-+#include <linux/device.h>
-+#include <linux/dma-mapping.h>
-
- #include <asm/bootinfo.h>
- #include <asm/system.h>
-@@ -54,25 +60,28 @@
- #include <asm/macints.h>
- #include <asm/mac_via.h>
-
--#define SREGS_PAD(n) u16 n;
-+static char mac_sonic_string[] = "macsonic";
-+static struct platform_device *mac_sonic_device;
-
- #include "sonic.h"
-
--#define SONIC_READ(reg) \
-- nubus_readl(base_addr+(reg))
--#define SONIC_WRITE(reg,val) \
-- nubus_writel((val), base_addr+(reg))
--#define sonic_read(dev, reg) \
-- nubus_readl((dev)->base_addr+(reg))
--#define sonic_write(dev, reg, val) \
-- nubus_writel((val), (dev)->base_addr+(reg))
--
-+/* These should basically be bus-size and endian independent (since
-+ the SONIC is at least smart enough that it uses the same endianness
-+ as the host, unlike certain less enlightened Macintosh NICs) */
-+#define SONIC_READ(reg) (nubus_readw(dev->base_addr + (reg * 4) \
-+ + lp->reg_offset))
-+#define SONIC_WRITE(reg,val) (nubus_writew(val, dev->base_addr + (reg * 4) \
-+ + lp->reg_offset))
-+
-+/* use 0 for production, 1 for verification, >1 for debug */
-+#ifdef SONIC_DEBUG
-+static unsigned int sonic_debug = SONIC_DEBUG;
-+#else
-+static unsigned int sonic_debug = 1;
-+#endif
-
--static int sonic_debug;
- static int sonic_version_printed;
-
--static int reg_offset;
--
- extern int mac_onboard_sonic_probe(struct net_device* dev);
- extern int mac_nubus_sonic_probe(struct net_device* dev);
-
-@@ -108,40 +117,6 @@
-
- #define SONIC_READ_PROM(addr) nubus_readb(prom_addr+addr)
-
--struct net_device * __init macsonic_probe(int unit)
--{
-- struct net_device *dev = alloc_etherdev(0);
-- int err;
--
-- if (!dev)
-- return ERR_PTR(-ENOMEM);
--
-- if (unit >= 0)
-- sprintf(dev->name, "eth%d", unit);
--
-- SET_MODULE_OWNER(dev);
--
-- /* This will catch fatal stuff like -ENOMEM as well as success */
-- err = mac_onboard_sonic_probe(dev);
-- if (err == 0)
-- goto found;
-- if (err != -ENODEV)
-- goto out;
-- err = mac_nubus_sonic_probe(dev);
-- if (err)
-- goto out;
--found:
-- err = register_netdev(dev);
-- if (err)
-- goto out1;
-- return dev;
--out1:
-- kfree(dev->priv);
--out:
-- free_netdev(dev);
-- return ERR_PTR(err);
--}
--
- /*
- * For reversing the PROM address
- */
-@@ -160,103 +135,55 @@
-
- int __init macsonic_init(struct net_device* dev)
- {
-- struct sonic_local* lp = NULL;
-- int i;
-+ struct sonic_local* lp = netdev_priv(dev);
-
- /* Allocate the entire chunk of memory for the descriptors.
- Note that this cannot cross a 64K boundary. */
-- for (i = 0; i < 20; i++) {
-- unsigned long desc_base, desc_top;
-- if((lp = kmalloc(sizeof(struct sonic_local), GFP_KERNEL | GFP_DMA)) == NULL) {
-- printk(KERN_ERR "%s: couldn't allocate descriptor buffers\n", dev->name);
-- return -ENOMEM;
-- }
--
-- desc_base = (unsigned long) lp;
-- desc_top = desc_base + sizeof(struct sonic_local);
-- if ((desc_top & 0xffff) >= (desc_base & 0xffff))
-- break;
-- /* Hmm. try again (FIXME: does this actually work?) */
-- kfree(lp);
-- printk(KERN_DEBUG
-- "%s: didn't get continguous chunk [%08lx - %08lx], trying again\n",
-- dev->name, desc_base, desc_top);
-- }
--
-- if (lp == NULL) {
-- printk(KERN_ERR "%s: tried 20 times to allocate descriptor buffers, giving up.\n",
-- dev->name);
-+ if ((lp->descriptors = dma_alloc_coherent(lp->device,
-+ SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
-+ &lp->descriptors_laddr, GFP_KERNEL)) == NULL) {
-+ printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", lp->device->bus_id);
- return -ENOMEM;
-- }
--
-- dev->priv = lp;
--
--#if 0
-- /* this code is only here as a curiousity... mainly, where the
-- fuck did SONIC_BUS_SCALE come from, and what was it supposed
-- to do? the normal allocation works great for 32 bit stuffs.. */
-+ }
-
- /* Now set up the pointers to point to the appropriate places */
-- lp->cda = lp->sonic_desc;
-- lp->tda = lp->cda + (SIZEOF_SONIC_CDA * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ lp->cda = lp->descriptors;
-+ lp->tda = lp->cda + (SIZEOF_SONIC_CDA
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
- lp->rda = lp->tda + (SIZEOF_SONIC_TD * SONIC_NUM_TDS
-- * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
- lp->rra = lp->rda + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
-- * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-
--#endif
--
-- memset(lp, 0, sizeof(struct sonic_local));
--
-- lp->cda_laddr = (unsigned int)&(lp->cda);
-- lp->tda_laddr = (unsigned int)lp->tda;
-- lp->rra_laddr = (unsigned int)lp->rra;
-- lp->rda_laddr = (unsigned int)lp->rda;
--
-- /* FIXME, maybe we should use skbs */
-- if ((lp->rba = (char *)
-- kmalloc(SONIC_NUM_RRS * SONIC_RBSIZE, GFP_KERNEL | GFP_DMA)) == NULL) {
-- printk(KERN_ERR "%s: couldn't allocate receive buffers\n", dev->name);
-- dev->priv = NULL;
-- kfree(lp);
-- return -ENOMEM;
-- }
--
-- lp->rba_laddr = (unsigned int)lp->rba;
--
-- {
-- int rs, ds;
--
-- /* almost always 12*4096, but let's not take chances */
-- rs = ((SONIC_NUM_RRS * SONIC_RBSIZE + 4095) / 4096) * 4096;
-- /* almost always under a page, but let's not take chances */
-- ds = ((sizeof(struct sonic_local) + 4095) / 4096) * 4096;
-- kernel_set_cachemode(lp->rba, rs, IOMAP_NOCACHE_SER);
-- kernel_set_cachemode(lp, ds, IOMAP_NOCACHE_SER);
-- }
--
--#if 0
-- flush_cache_all();
--#endif
-+ lp->cda_laddr = lp->descriptors_laddr;
-+ lp->tda_laddr = lp->cda_laddr + (SIZEOF_SONIC_CDA
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ lp->rda_laddr = lp->tda_laddr + (SIZEOF_SONIC_TD * SONIC_NUM_TDS
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
-+ * SONIC_BUS_SCALE(lp->dma_bitmode));
-
- dev->open = sonic_open;
- dev->stop = sonic_close;
- dev->hard_start_xmit = sonic_send_packet;
- dev->get_stats = sonic_get_stats;
- dev->set_multicast_list = &sonic_multicast_list;
-+ dev->tx_timeout = sonic_tx_timeout;
-+ dev->watchdog_timeo = TX_TIMEOUT;
-
- /*
- * clear tally counter
- */
-- sonic_write(dev, SONIC_CRCT, 0xffff);
-- sonic_write(dev, SONIC_FAET, 0xffff);
-- sonic_write(dev, SONIC_MPT, 0xffff);
-+ SONIC_WRITE(SONIC_CRCT, 0xffff);
-+ SONIC_WRITE(SONIC_FAET, 0xffff);
-+ SONIC_WRITE(SONIC_MPT, 0xffff);
-
- return 0;
- }
-
- int __init mac_onboard_sonic_ethernet_addr(struct net_device* dev)
- {
-+ struct sonic_local *lp = netdev_priv(dev);
- const int prom_addr = ONBOARD_SONIC_PROM_BASE;
- int i;
-
-@@ -270,6 +197,7 @@
- why this is so. */
- if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) &&
- memcmp(dev->dev_addr, "\x00\xA0\x40", 3) &&
-+ memcmp(dev->dev_addr, "\x00\x80\x19", 3) &&
- memcmp(dev->dev_addr, "\x00\x05\x02", 3))
- bit_reverse_addr(dev->dev_addr);
- else
-@@ -281,22 +209,23 @@
- the card... */
- if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) &&
- memcmp(dev->dev_addr, "\x00\xA0\x40", 3) &&
-+ memcmp(dev->dev_addr, "\x00\x80\x19", 3) &&
- memcmp(dev->dev_addr, "\x00\x05\x02", 3))
- {
- unsigned short val;
-
- printk(KERN_INFO "macsonic: PROM seems to be wrong, trying CAM entry 15\n");
-
-- sonic_write(dev, SONIC_CMD, SONIC_CR_RST);
-- sonic_write(dev, SONIC_CEP, 15);
-+ SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
-+ SONIC_WRITE(SONIC_CEP, 15);
-
-- val = sonic_read(dev, SONIC_CAP2);
-+ val = SONIC_READ(SONIC_CAP2);
- dev->dev_addr[5] = val >> 8;
- dev->dev_addr[4] = val & 0xff;
-- val = sonic_read(dev, SONIC_CAP1);
-+ val = SONIC_READ(SONIC_CAP1);
- dev->dev_addr[3] = val >> 8;
- dev->dev_addr[2] = val & 0xff;
-- val = sonic_read(dev, SONIC_CAP0);
-+ val = SONIC_READ(SONIC_CAP0);
- dev->dev_addr[1] = val >> 8;
- dev->dev_addr[0] = val & 0xff;
-
-@@ -311,6 +240,7 @@
-
- if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) &&
- memcmp(dev->dev_addr, "\x00\xA0\x40", 3) &&
-+ memcmp(dev->dev_addr, "\x00\x80\x19", 3) &&
- memcmp(dev->dev_addr, "\x00\x05\x02", 3))
- {
- /*
-@@ -325,8 +255,9 @@
- {
- /* Bwahahaha */
- static int once_is_more_than_enough;
-- int i;
-- int dma_bitmode;
-+ struct sonic_local* lp = netdev_priv(dev);
-+ int sr;
-+ int commslot = 0;
-
- if (once_is_more_than_enough)
- return -ENODEV;
-@@ -335,20 +266,18 @@
- if (!MACH_IS_MAC)
- return -ENODEV;
-
-- printk(KERN_INFO "Checking for internal Macintosh ethernet (SONIC).. ");
--
- if (macintosh_config->ether_type != MAC_ETHER_SONIC)
-- {
-- printk("none.\n");
- return -ENODEV;
-- }
--
-+
-+ printk(KERN_INFO "Checking for internal Macintosh ethernet (SONIC).. ");
-+
- /* Bogus probing, on the models which may or may not have
- Ethernet (BTW, the Ethernet *is* always at the same
- address, and nothing else lives there, at least if Apple's
- documentation is to be believed) */
- if (macintosh_config->ident == MAC_MODEL_Q630 ||
- macintosh_config->ident == MAC_MODEL_P588 ||
-+ macintosh_config->ident == MAC_MODEL_P575 ||
- macintosh_config->ident == MAC_MODEL_C610) {
- unsigned long flags;
- int card_present;
-@@ -361,13 +290,13 @@
- printk("none.\n");
- return -ENODEV;
- }
-+ commslot = 1;
- }
-
- printk("yes\n");
-
-- /* Danger! My arms are flailing wildly! You *must* set this
-- before using sonic_read() */
--
-+ /* Danger! My arms are flailing wildly! You *must* set lp->reg_offset
-+ * and dev->base_addr before using SONIC_READ() or SONIC_WRITE() */
- dev->base_addr = ONBOARD_SONIC_REGISTERS;
- if (via_alt_mapping)
- dev->irq = IRQ_AUTO_3;
-@@ -379,84 +308,66 @@
- sonic_version_printed = 1;
- }
- printk(KERN_INFO "%s: onboard / comm-slot SONIC at 0x%08lx\n",
-- dev->name, dev->base_addr);
--
-- /* Now do a song and dance routine in an attempt to determine
-- the bus width */
-+ lp->device->bus_id, dev->base_addr);
-
- /* The PowerBook's SONIC is 16 bit always. */
- if (macintosh_config->ident == MAC_MODEL_PB520) {
-- reg_offset = 0;
-- dma_bitmode = 0;
-- } else if (macintosh_config->ident == MAC_MODEL_C610) {
-- reg_offset = 0;
-- dma_bitmode = 1;
-- } else {
-+ lp->reg_offset = 0;
-+ lp->dma_bitmode = SONIC_BITMODE16;
-+ sr = SONIC_READ(SONIC_SR);
-+ } else if (commslot) {
- /* Some of the comm-slot cards are 16 bit. But some
-- of them are not. The 32-bit cards use offset 2 and
-- pad with zeroes or sometimes ones (I think...)
-- Therefore, if we try offset 0 and get a silicon
-- revision of 0, we assume 16 bit. */
-- int sr;
--
-- /* Technically this is not necessary since we zeroed
-- it above */
-- reg_offset = 0;
-- dma_bitmode = 0;
-- sr = sonic_read(dev, SONIC_SR);
-- if (sr == 0 || sr == 0xffff) {
-- reg_offset = 2;
-- /* 83932 is 0x0004, 83934 is 0x0100 or 0x0101 */
-- sr = sonic_read(dev, SONIC_SR);
-- dma_bitmode = 1;
--
-+ of them are not. The 32-bit cards use offset 2 and
-+ have known revisions, we try reading the revision
-+ register at offset 2, if we don't get a known revision
-+ we assume 16 bit at offset 0. */
-+ lp->reg_offset = 2;
-+ lp->dma_bitmode = SONIC_BITMODE16;
-+
-+ sr = SONIC_READ(SONIC_SR);
-+ if (sr == 0x0004 || sr == 0x0006 || sr == 0x0100 || sr == 0x0101)
-+ /* 83932 is 0x0004 or 0x0006, 83934 is 0x0100 or 0x0101 */
-+ lp->dma_bitmode = SONIC_BITMODE32;
-+ else {
-+ lp->dma_bitmode = SONIC_BITMODE16;
-+ lp->reg_offset = 0;
-+ sr = SONIC_READ(SONIC_SR);
- }
-- printk(KERN_INFO
-- "%s: revision 0x%04x, using %d bit DMA and register offset %d\n",
-- dev->name, sr, dma_bitmode?32:16, reg_offset);
-- }
--
-+ } else {
-+ /* All onboard cards are at offset 2 with 32 bit DMA. */
-+ lp->reg_offset = 2;
-+ lp->dma_bitmode = SONIC_BITMODE32;
-+ sr = SONIC_READ(SONIC_SR);
-+ }
-+ printk(KERN_INFO
-+ "%s: revision 0x%04x, using %d bit DMA and register offset %d\n",
-+ lp->device->bus_id, sr, lp->dma_bitmode?32:16, lp->reg_offset);
-+
-+#if 0 /* This is sometimes useful to find out how MacOS configured the card. */
-+ printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", lp->device->bus_id,
-+ SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff);
-+#endif
-
-- /* this carries my sincere apologies -- by the time I got to updating
-- the driver, support for "reg_offsets" appeares nowhere in the sonic
-- code, going back for over a year. Fortunately, my Mac does't seem
-- to use whatever this was.
--
-- If you know how this is supposed to be implemented, either fix it,
-- or contact me (sammy at oh.verio.com) to explain what it is. --Sam */
--
-- if(reg_offset) {
-- printk("%s: register offset unsupported. please fix this if you know what it is.\n", dev->name);
-- return -ENODEV;
-- }
--
- /* Software reset, then initialize control registers. */
-- sonic_write(dev, SONIC_CMD, SONIC_CR_RST);
-- sonic_write(dev, SONIC_DCR, SONIC_DCR_BMS |
-- SONIC_DCR_RFT1 | SONIC_DCR_TFT0 | SONIC_DCR_EXBUS |
-- (dma_bitmode ? SONIC_DCR_DW : 0));
-+ SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
-+
-+ SONIC_WRITE(SONIC_DCR, SONIC_DCR_EXBUS | SONIC_DCR_BMS |
-+ SONIC_DCR_RFT1 | SONIC_DCR_TFT0 |
-+ (lp->dma_bitmode ? SONIC_DCR_DW : 0));
-
- /* This *must* be written back to in order to restore the
-- extended programmable output bits */
-- sonic_write(dev, SONIC_DCR2, 0);
-+ * extended programmable output bits, as it may not have been
-+ * initialised since the hardware reset. */
-+ SONIC_WRITE(SONIC_DCR2, 0);
-
- /* Clear *and* disable interrupts to be on the safe side */
-- sonic_write(dev, SONIC_ISR,0x7fff);
-- sonic_write(dev, SONIC_IMR,0);
-+ SONIC_WRITE(SONIC_IMR, 0);
-+ SONIC_WRITE(SONIC_ISR, 0x7fff);
-
- /* Now look for the MAC address. */
- if (mac_onboard_sonic_ethernet_addr(dev) != 0)
- return -ENODEV;
-
-- printk(KERN_INFO "MAC ");
-- for (i = 0; i < 6; i++) {
-- printk("%2.2x", dev->dev_addr[i]);
-- if (i < 5)
-- printk(":");
-- }
--
-- printk(" IRQ %d\n", dev->irq);
--
- /* Shared init code */
- return macsonic_init(dev);
- }
-@@ -468,8 +379,10 @@
- int i;
- for(i = 0; i < 6; i++)
- dev->dev_addr[i] = SONIC_READ_PROM(i);
-- /* For now we are going to assume that they're all bit-reversed */
-- bit_reverse_addr(dev->dev_addr);
-+
-+ /* Some of the addresses are bit-reversed */
-+ if (id != MACSONIC_DAYNA)
-+ bit_reverse_addr(dev->dev_addr);
-
- return 0;
- }
-@@ -487,6 +400,15 @@
- else
- return MACSONIC_APPLE;
- }
-+
-+ if (ndev->dr_hw == NUBUS_DRHW_SMC9194 &&
-+ ndev->dr_sw == NUBUS_DRSW_DAYNA)
-+ return MACSONIC_DAYNA;
-+
-+ if (ndev->dr_hw == NUBUS_DRHW_SONIC_LC &&
-+ ndev->dr_sw == 0) { /* huh? */
-+ return MACSONIC_APPLE16;
-+ }
- return -1;
- }
-
-@@ -494,12 +416,12 @@
- {
- static int slots;
- struct nubus_dev* ndev = NULL;
-+ struct sonic_local* lp = netdev_priv(dev);
- unsigned long base_addr, prom_addr;
- u16 sonic_dcr;
-- int id;
-- int i;
-- int dma_bitmode;
--
-+ int id = -1;
-+ int reg_offset, dma_bitmode;
-+
- /* Find the first SONIC that hasn't been initialized already */
- while ((ndev = nubus_find_type(NUBUS_CAT_NETWORK,
- NUBUS_TYPE_ETHERNET, ndev)) != NULL)
-@@ -521,51 +443,52 @@
- case MACSONIC_DUODOCK:
- base_addr = ndev->board->slot_addr + DUODOCK_SONIC_REGISTERS;
- prom_addr = ndev->board->slot_addr + DUODOCK_SONIC_PROM_BASE;
-- sonic_dcr = SONIC_DCR_EXBUS | SONIC_DCR_RFT0 | SONIC_DCR_RFT1
-- | SONIC_DCR_TFT0;
-+ sonic_dcr = SONIC_DCR_EXBUS | SONIC_DCR_RFT0 | SONIC_DCR_RFT1 |
-+ SONIC_DCR_TFT0;
- reg_offset = 2;
-- dma_bitmode = 1;
-+ dma_bitmode = SONIC_BITMODE32;
- break;
- case MACSONIC_APPLE:
- base_addr = ndev->board->slot_addr + APPLE_SONIC_REGISTERS;
- prom_addr = ndev->board->slot_addr + APPLE_SONIC_PROM_BASE;
- sonic_dcr = SONIC_DCR_BMS | SONIC_DCR_RFT1 | SONIC_DCR_TFT0;
- reg_offset = 0;
-- dma_bitmode = 1;
-+ dma_bitmode = SONIC_BITMODE32;
- break;
- case MACSONIC_APPLE16:
- base_addr = ndev->board->slot_addr + APPLE_SONIC_REGISTERS;
- prom_addr = ndev->board->slot_addr + APPLE_SONIC_PROM_BASE;
-- sonic_dcr = SONIC_DCR_EXBUS
-- | SONIC_DCR_RFT1 | SONIC_DCR_TFT0
-- | SONIC_DCR_PO1 | SONIC_DCR_BMS;
-+ sonic_dcr = SONIC_DCR_EXBUS | SONIC_DCR_RFT1 | SONIC_DCR_TFT0 |
-+ SONIC_DCR_PO1 | SONIC_DCR_BMS;
- reg_offset = 0;
-- dma_bitmode = 0;
-+ dma_bitmode = SONIC_BITMODE16;
- break;
- case MACSONIC_DAYNALINK:
- base_addr = ndev->board->slot_addr + APPLE_SONIC_REGISTERS;
- prom_addr = ndev->board->slot_addr + DAYNALINK_PROM_BASE;
-- sonic_dcr = SONIC_DCR_RFT1 | SONIC_DCR_TFT0
-- | SONIC_DCR_PO1 | SONIC_DCR_BMS;
-+ sonic_dcr = SONIC_DCR_RFT1 | SONIC_DCR_TFT0 |
-+ SONIC_DCR_PO1 | SONIC_DCR_BMS;
- reg_offset = 0;
-- dma_bitmode = 0;
-+ dma_bitmode = SONIC_BITMODE16;
- break;
- case MACSONIC_DAYNA:
- base_addr = ndev->board->slot_addr + DAYNA_SONIC_REGISTERS;
- prom_addr = ndev->board->slot_addr + DAYNA_SONIC_MAC_ADDR;
-- sonic_dcr = SONIC_DCR_BMS
-- | SONIC_DCR_RFT1 | SONIC_DCR_TFT0 | SONIC_DCR_PO1;
-+ sonic_dcr = SONIC_DCR_BMS |
-+ SONIC_DCR_RFT1 | SONIC_DCR_TFT0 | SONIC_DCR_PO1;
- reg_offset = 0;
-- dma_bitmode = 0;
-+ dma_bitmode = SONIC_BITMODE16;
- break;
- default:
- printk(KERN_ERR "macsonic: WTF, id is %d\n", id);
- return -ENODEV;
- }
-
-- /* Danger! My arms are flailing wildly! You *must* set this
-- before using sonic_read() */
-+ /* Danger! My arms are flailing wildly! You *must* set lp->reg_offset
-+ * and dev->base_addr before using SONIC_READ() or SONIC_WRITE() */
- dev->base_addr = base_addr;
-+ lp->reg_offset = reg_offset;
-+ lp->dma_bitmode = dma_bitmode;
- dev->irq = SLOT2IRQ(ndev->board->slot);
-
- if (!sonic_version_printed) {
-@@ -573,29 +496,66 @@
- sonic_version_printed = 1;
- }
- printk(KERN_INFO "%s: %s in slot %X\n",
-- dev->name, ndev->board->name, ndev->board->slot);
-+ lp->device->bus_id, ndev->board->name, ndev->board->slot);
- printk(KERN_INFO "%s: revision 0x%04x, using %d bit DMA and register offset %d\n",
-- dev->name, sonic_read(dev, SONIC_SR), dma_bitmode?32:16, reg_offset);
-+ lp->device->bus_id, SONIC_READ(SONIC_SR), dma_bitmode?32:16, reg_offset);
-
-- if(reg_offset) {
-- printk("%s: register offset unsupported. please fix this if you know what it is.\n", dev->name);
-- return -ENODEV;
-- }
-+#if 0 /* This is sometimes useful to find out how MacOS configured the card. */
-+ printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", lp->device->bus_id,
-+ SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff);
-+#endif
-
- /* Software reset, then initialize control registers. */
-- sonic_write(dev, SONIC_CMD, SONIC_CR_RST);
-- sonic_write(dev, SONIC_DCR, sonic_dcr
-- | (dma_bitmode ? SONIC_DCR_DW : 0));
-+ SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
-+ SONIC_WRITE(SONIC_DCR, sonic_dcr | (dma_bitmode ? SONIC_DCR_DW : 0));
-+ /* This *must* be written back to in order to restore the
-+ * extended programmable output bits, since it may not have been
-+ * initialised since the hardware reset. */
-+ SONIC_WRITE(SONIC_DCR2, 0);
-
- /* Clear *and* disable interrupts to be on the safe side */
-- sonic_write(dev, SONIC_ISR,0x7fff);
-- sonic_write(dev, SONIC_IMR,0);
-+ SONIC_WRITE(SONIC_IMR, 0);
-+ SONIC_WRITE(SONIC_ISR, 0x7fff);
-
- /* Now look for the MAC address. */
- if (mac_nubus_sonic_ethernet_addr(dev, prom_addr, id) != 0)
- return -ENODEV;
-
-- printk(KERN_INFO "MAC ");
-+ /* Shared init code */
-+ return macsonic_init(dev);
-+}
-+
-+static int __init mac_sonic_probe(struct device *device)
-+{
-+ struct net_device *dev;
-+ struct sonic_local *lp;
-+ int err;
-+ int i;
-+
-+ dev = alloc_etherdev(sizeof(struct sonic_local));
-+ if (!dev)
-+ return -ENOMEM;
-+
-+ lp = netdev_priv(dev);
-+ lp->device = device;
-+ SET_NETDEV_DEV(dev, device);
-+ SET_MODULE_OWNER(dev);
-+
-+ /* This will catch fatal stuff like -ENOMEM as well as success */
-+ err = mac_onboard_sonic_probe(dev);
-+ if (err == 0)
-+ goto found;
-+ if (err != -ENODEV)
-+ goto out;
-+ err = mac_nubus_sonic_probe(dev);
-+ if (err)
-+ goto out;
-+found:
-+ err = register_netdev(dev);
-+ if (err)
-+ goto out;
-+
-+ printk("%s: MAC ", dev->name);
- for (i = 0; i < 6; i++) {
- printk("%2.2x", dev->dev_addr[i]);
- if (i < 5)
-@@ -603,55 +563,95 @@
- }
- printk(" IRQ %d\n", dev->irq);
-
-- /* Shared init code */
-- return macsonic_init(dev);
--}
-+ return 0;
-
--#ifdef MODULE
--static struct net_device *dev_macsonic;
-+out:
-+ free_netdev(dev);
-+
-+ return err;
-+}
-
--MODULE_PARM(sonic_debug, "i");
-+MODULE_DESCRIPTION("Macintosh SONIC ethernet driver");
-+module_param(sonic_debug, int, 0);
- MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
-
--int
--init_module(void)
-+#define SONIC_IRQ_FLAG IRQ_FLG_FAST
-+
-+#include "sonic.c"
-+
-+static int __devexit mac_sonic_device_remove (struct device *device)
- {
-- dev_macsonic = macsonic_probe(-1);
-- if (IS_ERR(dev_macsonic)) {
-- printk(KERN_WARNING "macsonic.c: No card found\n");
-- return PTR_ERR(dev_macsonic);
-- }
-+ struct net_device *dev = device->driver_data;
-+ struct sonic_local* lp = netdev_priv(dev);
-+
-+ unregister_netdev (dev);
-+ dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
-+ lp->descriptors, lp->descriptors_laddr);
-+ free_netdev (dev);
-+
- return 0;
- }
-
--void
--cleanup_module(void)
-+static struct device_driver mac_sonic_driver = {
-+ .name = mac_sonic_string,
-+ .bus = &platform_bus_type,
-+ .probe = mac_sonic_probe,
-+ .remove = __devexit_p(mac_sonic_device_remove),
-+};
-+
-+static void mac_sonic_platform_release(struct device *device)
- {
-- unregister_netdev(dev_macsonic);
-- kfree(dev_macsonic->priv);
-- free_netdev(dev_macsonic);
-+ struct platform_device *pldev;
-+
-+ /* free device */
-+ pldev = to_platform_device (device);
-+ kfree (pldev);
- }
--#endif /* MODULE */
-
-+static int __init mac_sonic_init_module(void)
-+{
-+ struct platform_device *pldev;
-+ int err;
-+
-+ if ((err = driver_register(&mac_sonic_driver))) {
-+ printk(KERN_ERR "Driver registration failed\n");
-+ return err;
-+ }
-
--#define vdma_alloc(foo, bar) ((u32)foo)
--#define vdma_free(baz)
--#define sonic_chiptomem(bat) (bat)
--#define PHYSADDR(quux) (quux)
--#define CPHYSADDR(quux) (quux)
-+ mac_sonic_device = NULL;
-
--#define sonic_request_irq request_irq
--#define sonic_free_irq free_irq
-+ if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) {
-+ goto out_unregister;
-+ }
-
--#include "sonic.c"
-+ memset(pldev, 0, sizeof (*pldev));
-+ pldev->name = mac_sonic_string;
-+ pldev->id = 0;
-+ pldev->dev.release = mac_sonic_platform_release;
-+ mac_sonic_device = pldev;
-
--/*
-- * Local variables:
-- * compile-command: "m68k-linux-gcc -D__KERNEL__ -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -ffixed-a2 -DMODULE -DMODVERSIONS -include ../../include/linux/modversions.h -c -o macsonic.o macsonic.c"
-- * version-control: t
-- * kept-new-versions: 5
-- * c-indent-level: 8
-- * tab-width: 8
-- * End:
-- *
-- */
-+ if (platform_device_register (pldev)) {
-+ kfree(pldev);
-+ mac_sonic_device = NULL;
-+ }
-+
-+ return 0;
-+
-+out_unregister:
-+ platform_device_unregister(pldev);
-+
-+ return -ENOMEM;
-+}
-+
-+static void __exit mac_sonic_cleanup_module(void)
-+{
-+ driver_unregister(&mac_sonic_driver);
-+
-+ if (mac_sonic_device) {
-+ platform_device_unregister(mac_sonic_device);
-+ mac_sonic_device = NULL;
-+ }
-+}
-+
-+module_init(mac_sonic_init_module);
-+module_exit(mac_sonic_cleanup_module);
---- orig/drivers/net/sonic.c Sun Jul 10 22:11:34 2005
-+++ linux/drivers/net/sonic.c Sun Jul 10 22:26:14 2005
-@@ -1,6 +1,11 @@
- /*
- * sonic.c
- *
-+ * (C) 2005 Finn Thain
-+ *
-+ * Converted to DMA API, added zero-copy buffer handling, and
-+ * (from the mac68k project) introduced dhd's support for 16-bit cards.
-+ *
- * (C) 1996,1998 by Thomas Bogendoerfer (tsbogend at alpha.franken.de)
- *
- * This driver is based on work from Andreas Busse, but most of
-@@ -9,12 +14,23 @@
- * (C) 1995 by Andreas Busse (andy at waldorf-gmbh.de)
- *
- * Core code included by system sonic drivers
-+ *
-+ * And... partially rewritten again by David Huggins-Daines in order
-+ * to cope with screwed up Macintosh NICs that may or may not use
-+ * 16-bit DMA.
-+ *
-+ * (C) 1999 David Huggins-Daines <dhd at debian.org>
-+ *
- */
-
- /*
- * Sources: Olivetti M700-10 Risc Personal Computer hardware handbook,
- * National Semiconductors data sheet for the DP83932B Sonic Ethernet
- * controller, and the files "8390.c" and "skeleton.c" in this directory.
-+ *
-+ * Additional sources: Nat Semi data sheet for the DP83932C and Nat Semi
-+ * Application Note AN-746, the files "lance.c" and "ibmlana.c". See also
-+ * the NetBSD file "sys/arch/mac68k/dev/if_sn.c".
- */
-
-
-@@ -28,6 +44,9 @@
- */
- static int sonic_open(struct net_device *dev)
- {
-+ struct sonic_local *lp = netdev_priv(dev);
-+ int i;
-+
- if (sonic_debug > 2)
- printk("sonic_open: initializing sonic driver.\n");
-
-@@ -40,14 +59,59 @@
- * This means that during execution of the handler interrupt are disabled
- * covering another bug otherwise corrupting data. This doesn't mean
- * this glue works ok under all situations.
-+ *
-+ * Note (dhd): this also appears to prevent lockups on the Macintrash
-+ * when more than one Ethernet card is installed (knock on wood)
-+ *
-+ * Note (fthain): whether the above is still true is anyones guess. Certainly
-+ * the buffer handling algorithms will not tolerate re-entrance without some
-+ * mutual exclusion added. Anyway, the memcpy has now been eliminated from the
-+ * rx code to make this a faster "fast interrupt".
- */
--// if (sonic_request_irq(dev->irq, &sonic_interrupt, 0, "sonic", dev)) {
-- if (sonic_request_irq(dev->irq, &sonic_interrupt, SA_INTERRUPT,
-- "sonic", dev)) {
-- printk("\n%s: unable to get IRQ %d .\n", dev->name, dev->irq);
-+ if (request_irq(dev->irq, &sonic_interrupt, SONIC_IRQ_FLAG, "sonic", dev)) {
-+ printk(KERN_ERR "\n%s: unable to get IRQ %d .\n", dev->name, dev->irq);
- return -EAGAIN;
- }
-
-+ for (i = 0; i < SONIC_NUM_RRS; i++) {
-+ struct sk_buff *skb = dev_alloc_skb(SONIC_RBSIZE + 2);
-+ if (skb == NULL) {
-+ while(i > 0) { /* free any that were allocated successfully */
-+ i--;
-+ dev_kfree_skb(lp->rx_skb[i]);
-+ lp->rx_skb[i] = NULL;
-+ }
-+ printk(KERN_ERR "%s: couldn't allocate receive buffers\n",
-+ dev->name);
-+ return -ENOMEM;
-+ }
-+ skb->dev = dev;
-+ /* align IP header unless DMA requires otherwise */
-+ if (SONIC_BUS_SCALE(lp->dma_bitmode) == 2)
-+ skb_reserve(skb, 2);
-+ lp->rx_skb[i] = skb;
-+ }
-+
-+ for (i = 0; i < SONIC_NUM_RRS; i++) {
-+ dma_addr_t laddr = dma_map_single(lp->device, skb_put(lp->rx_skb[i], SONIC_RBSIZE),
-+ SONIC_RBSIZE, DMA_FROM_DEVICE);
-+ if (!laddr) {
-+ while(i > 0) { /* free any that were mapped successfully */
-+ i--;
-+ dma_unmap_single(lp->device, lp->rx_laddr[i], SONIC_RBSIZE, DMA_FROM_DEVICE);
-+ lp->rx_laddr[i] = (dma_addr_t)0;
-+ }
-+ for (i = 0; i < SONIC_NUM_RRS; i++) {
-+ dev_kfree_skb(lp->rx_skb[i]);
-+ lp->rx_skb[i] = NULL;
-+ }
-+ printk(KERN_ERR "%s: couldn't map rx DMA buffers\n",
-+ dev->name);
-+ return -ENOMEM;
-+ }
-+ lp->rx_laddr[i] = laddr;
-+ }
-+
- /*
- * Initialize the SONIC
- */
-@@ -67,7 +131,8 @@
- */
- static int sonic_close(struct net_device *dev)
- {
-- unsigned int base_addr = dev->base_addr;
-+ struct sonic_local *lp = netdev_priv(dev);
-+ int i;
-
- if (sonic_debug > 2)
- printk("sonic_close\n");
-@@ -77,20 +142,56 @@
- /*
- * stop the SONIC, disable interrupts
- */
-- SONIC_WRITE(SONIC_ISR, 0x7fff);
- SONIC_WRITE(SONIC_IMR, 0);
-+ SONIC_WRITE(SONIC_ISR, 0x7fff);
- SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
-
-- sonic_free_irq(dev->irq, dev); /* release the IRQ */
-+ /* unmap and free skbs that haven't been transmitted */
-+ for (i = 0; i < SONIC_NUM_TDS; i++) {
-+ if(lp->tx_laddr[i]) {
-+ dma_unmap_single(lp->device, lp->tx_laddr[i], lp->tx_len[i], DMA_TO_DEVICE);
-+ lp->tx_laddr[i] = (dma_addr_t)0;
-+ }
-+ if(lp->tx_skb[i]) {
-+ dev_kfree_skb(lp->tx_skb[i]);
-+ lp->tx_skb[i] = NULL;
-+ }
-+ }
-+
-+ /* unmap and free the receive buffers */
-+ for (i = 0; i < SONIC_NUM_RRS; i++) {
-+ if(lp->rx_laddr[i]) {
-+ dma_unmap_single(lp->device, lp->rx_laddr[i], SONIC_RBSIZE, DMA_FROM_DEVICE);
-+ lp->rx_laddr[i] = (dma_addr_t)0;
-+ }
-+ if(lp->rx_skb[i]) {
-+ dev_kfree_skb(lp->rx_skb[i]);
-+ lp->rx_skb[i] = NULL;
-+ }
-+ }
-+
-+ free_irq(dev->irq, dev); /* release the IRQ */
-
- return 0;
- }
-
- static void sonic_tx_timeout(struct net_device *dev)
- {
-- struct sonic_local *lp = (struct sonic_local *) dev->priv;
-- printk("%s: transmit timed out.\n", dev->name);
--
-+ struct sonic_local *lp = netdev_priv(dev);
-+ int i;
-+ /* Stop the interrupts for this */
-+ SONIC_WRITE(SONIC_IMR, 0);
-+ /* We could resend the original skbs. Easier to re-initialise. */
-+ for (i = 0; i < SONIC_NUM_TDS; i++) {
-+ if(lp->tx_laddr[i]) {
-+ dma_unmap_single(lp->device, lp->tx_laddr[i], lp->tx_len[i], DMA_TO_DEVICE);
-+ lp->tx_laddr[i] = (dma_addr_t)0;
-+ }
-+ if(lp->tx_skb[i]) {
-+ dev_kfree_skb(lp->tx_skb[i]);
-+ lp->tx_skb[i] = NULL;
-+ }
-+ }
- /* Try to restart the adaptor. */
- sonic_init(dev);
- lp->stats.tx_errors++;
-@@ -100,60 +201,92 @@
-
- /*
- * transmit packet
-+ *
-+ * Appends new TD during transmission thus avoiding any TX interrupts
-+ * until we run out of TDs.
-+ * This routine interacts closely with the ISR in that it may,
-+ * set tx_skb[i]
-+ * reset the status flags of the new TD
-+ * set and reset EOL flags
-+ * stop the tx queue
-+ * The ISR interacts with this routine in various ways. It may,
-+ * reset tx_skb[i]
-+ * test the EOL and status flags of the TDs
-+ * wake the tx queue
-+ * Concurrently with all of this, the SONIC is potentially writing to
-+ * the status flags of the TDs.
-+ * Until some mutual exclusion is added, this code will not work with SMP. However,
-+ * MIPS Jazz machines and m68k Macs were all uni-processor machines.
- */
-+
- static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
- {
-- struct sonic_local *lp = (struct sonic_local *) dev->priv;
-- unsigned int base_addr = dev->base_addr;
-- unsigned int laddr;
-- int entry, length;
--
-- netif_stop_queue(dev);
-+ struct sonic_local *lp = netdev_priv(dev);
-+ dma_addr_t laddr;
-+ int length;
-+ int entry = lp->next_tx;
-
- if (sonic_debug > 2)
- printk("sonic_send_packet: skb=%p, dev=%p\n", skb, dev);
-
-+ length = skb->len;
-+ if (length < ETH_ZLEN) {
-+ skb = skb_padto(skb, ETH_ZLEN);
-+ if (skb == NULL)
-+ return 0;
-+ length = ETH_ZLEN;
-+ }
-+
- /*
- * Map the packet data into the logical DMA address space
- */
-- if ((laddr = vdma_alloc(CPHYSADDR(skb->data), skb->len)) == ~0UL) {
-- printk("%s: no VDMA entry for transmit available.\n",
-- dev->name);
-+
-+ laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE);
-+ if (!laddr) {
-+ printk(KERN_ERR "%s: failed to map tx DMA buffer.\n", dev->name);
- dev_kfree_skb(skb);
-- netif_start_queue(dev);
- return 1;
- }
-- entry = lp->cur_tx & SONIC_TDS_MASK;
-- lp->tx_laddr[entry] = laddr;
-- lp->tx_skb[entry] = skb;
--
-- length = (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;
-- flush_cache_all();
-+
-+ sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */
-+ sonic_tda_put(dev, entry, SONIC_TD_FRAG_COUNT, 1); /* single fragment */
-+ sonic_tda_put(dev, entry, SONIC_TD_PKTSIZE, length); /* length of packet */
-+ sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_L, laddr & 0xffff);
-+ sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_H, laddr >> 16);
-+ sonic_tda_put(dev, entry, SONIC_TD_FRAG_SIZE, length);
-+ sonic_tda_put(dev, entry, SONIC_TD_LINK,
-+ sonic_tda_get(dev, entry, SONIC_TD_LINK) | SONIC_EOL);
-
- /*
-- * Setup the transmit descriptor and issue the transmit command.
-+ * Must set tx_skb[entry] only after clearing status, and
-+ * before clearing EOL and before stopping queue
- */
-- lp->tda[entry].tx_status = 0; /* clear status */
-- lp->tda[entry].tx_frag_count = 1; /* single fragment */
-- lp->tda[entry].tx_pktsize = length; /* length of packet */
-- lp->tda[entry].tx_frag_ptr_l = laddr & 0xffff;
-- lp->tda[entry].tx_frag_ptr_h = laddr >> 16;
-- lp->tda[entry].tx_frag_size = length;
-- lp->cur_tx++;
-- lp->stats.tx_bytes += length;
-+ wmb();
-+ lp->tx_len[entry] = length;
-+ lp->tx_laddr[entry] = laddr;
-+ lp->tx_skb[entry] = skb;
-+
-+ wmb();
-+ sonic_tda_put(dev, lp->eol_tx, SONIC_TD_LINK,
-+ sonic_tda_get(dev, lp->eol_tx, SONIC_TD_LINK) & ~SONIC_EOL);
-+ lp->eol_tx = entry;
-+
-+ lp->next_tx = (entry + 1) & SONIC_TDS_MASK;
-+ if (lp->tx_skb[lp->next_tx] != NULL) {
-+ /* The ring is full, the ISR has yet to process the next TD. */
-+ if (sonic_debug > 3)
-+ printk("%s: stopping queue\n", dev->name);
-+ netif_stop_queue(dev);
-+ /* after this packet, wait for ISR to free up some TDAs */
-+ } else netif_start_queue(dev);
-
- if (sonic_debug > 2)
-- printk("sonic_send_packet: issueing Tx command\n");
-+ printk("sonic_send_packet: issuing Tx command\n");
-
- SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP);
-
- dev->trans_start = jiffies;
-
-- if (lp->cur_tx < lp->dirty_tx + SONIC_NUM_TDS)
-- netif_start_queue(dev);
-- else
-- lp->tx_full = 1;
--
- return 0;
- }
-
-@@ -164,175 +297,199 @@
- static irqreturn_t sonic_interrupt(int irq, void *dev_id, struct pt_regs *regs)
- {
- struct net_device *dev = (struct net_device *) dev_id;
-- unsigned int base_addr = dev->base_addr;
-- struct sonic_local *lp;
-+ struct sonic_local *lp = netdev_priv(dev);
- int status;
-
- if (dev == NULL) {
-- printk("sonic_interrupt: irq %d for unknown device.\n", irq);
-+ printk(KERN_ERR "sonic_interrupt: irq %d for unknown device.\n", irq);
- return IRQ_NONE;
- }
-
-- lp = (struct sonic_local *) dev->priv;
--
-- status = SONIC_READ(SONIC_ISR);
-- SONIC_WRITE(SONIC_ISR, 0x7fff); /* clear all bits */
--
-- if (sonic_debug > 2)
-- printk("sonic_interrupt: ISR=%x\n", status);
--
-- if (status & SONIC_INT_PKTRX) {
-- sonic_rx(dev); /* got packet(s) */
-- }
--
-- if (status & SONIC_INT_TXDN) {
-- int dirty_tx = lp->dirty_tx;
-+ if (!(status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT))
-+ return IRQ_NONE;
-
-- while (dirty_tx < lp->cur_tx) {
-- int entry = dirty_tx & SONIC_TDS_MASK;
-- int status = lp->tda[entry].tx_status;
-+ do {
-+ if (status & SONIC_INT_PKTRX) {
-+ if (sonic_debug > 2)
-+ printk("%s: packet rx\n", dev->name);
-+ sonic_rx(dev); /* got packet(s) */
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_PKTRX); /* clear the interrupt */
-+ }
-
-- if (sonic_debug > 3)
-- printk
-- ("sonic_interrupt: status %d, cur_tx %d, dirty_tx %d\n",
-- status, lp->cur_tx, lp->dirty_tx);
-+ if (status & SONIC_INT_TXDN) {
-+ int entry = lp->cur_tx;
-+ int td_status;
-+ int freed_some = 0;
-+
-+ /* At this point, cur_tx is the index of a TD that is one of:
-+ * unallocated/freed (status set & tx_skb[entry] clear)
-+ * allocated and sent (status set & tx_skb[entry] set )
-+ * allocated and not yet sent (status clear & tx_skb[entry] set )
-+ * still being allocated by sonic_send_packet (status clear & tx_skb[entry] clear)
-+ */
-
-- if (status == 0) {
-- /* It still hasn't been Txed, kick the sonic again */
-- SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP);
-- break;
-- }
-+ if (sonic_debug > 2)
-+ printk("%s: tx done\n", dev->name);
-
-- /* put back EOL and free descriptor */
-- lp->tda[entry].tx_frag_count = 0;
-- lp->tda[entry].tx_status = 0;
--
-- if (status & 0x0001)
-- lp->stats.tx_packets++;
-- else {
-- lp->stats.tx_errors++;
-- if (status & 0x0642)
-- lp->stats.tx_aborted_errors++;
-- if (status & 0x0180)
-- lp->stats.tx_carrier_errors++;
-- if (status & 0x0020)
-- lp->stats.tx_window_errors++;
-- if (status & 0x0004)
-- lp->stats.tx_fifo_errors++;
-- }
-+ while (lp->tx_skb[entry] != NULL) {
-+ if ((td_status = sonic_tda_get(dev, entry, SONIC_TD_STATUS)) == 0)
-+ break;
-+
-+ if (td_status & 0x0001) {
-+ lp->stats.tx_packets++;
-+ lp->stats.tx_bytes += sonic_tda_get(dev, entry, SONIC_TD_PKTSIZE);
-+ } else {
-+ lp->stats.tx_errors++;
-+ if (td_status & 0x0642)
-+ lp->stats.tx_aborted_errors++;
-+ if (td_status & 0x0180)
-+ lp->stats.tx_carrier_errors++;
-+ if (td_status & 0x0020)
-+ lp->stats.tx_window_errors++;
-+ if (td_status & 0x0004)
-+ lp->stats.tx_fifo_errors++;
-+ }
-
-- /* We must free the original skb */
-- if (lp->tx_skb[entry]) {
-+ /* We must free the original skb */
- dev_kfree_skb_irq(lp->tx_skb[entry]);
-- lp->tx_skb[entry] = 0;
-+ lp->tx_skb[entry] = NULL;
-+ /* and unmap DMA buffer */
-+ dma_unmap_single(lp->device, lp->tx_laddr[entry], lp->tx_len[entry], DMA_TO_DEVICE);
-+ lp->tx_laddr[entry] = (dma_addr_t)0;
-+ freed_some = 1;
-+
-+ if (sonic_tda_get(dev, entry, SONIC_TD_LINK) & SONIC_EOL) {
-+ entry = (entry + 1) & SONIC_TDS_MASK;
-+ break;
-+ }
-+ entry = (entry + 1) & SONIC_TDS_MASK;
- }
-- /* and the VDMA address */
-- vdma_free(lp->tx_laddr[entry]);
-- dirty_tx++;
-- }
-
-- if (lp->tx_full
-- && dirty_tx + SONIC_NUM_TDS > lp->cur_tx + 2) {
-- /* The ring is no longer full, clear tbusy. */
-- lp->tx_full = 0;
-- netif_wake_queue(dev);
-+ if (freed_some || lp->tx_skb[entry] == NULL)
-+ netif_wake_queue(dev); /* The ring is no longer full */
-+ lp->cur_tx = entry;
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_TXDN); /* clear the interrupt */
- }
-
-- lp->dirty_tx = dirty_tx;
-- }
-+ /*
-+ * check error conditions
-+ */
-+ if (status & SONIC_INT_RFO) {
-+ if (sonic_debug > 1)
-+ printk("%s: rx fifo overrun\n", dev->name);
-+ lp->stats.rx_fifo_errors++;
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_RFO); /* clear the interrupt */
-+ }
-+ if (status & SONIC_INT_RDE) {
-+ if (sonic_debug > 1)
-+ printk("%s: rx descriptors exhausted\n", dev->name);
-+ lp->stats.rx_dropped++;
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_RDE); /* clear the interrupt */
-+ }
-+ if (status & SONIC_INT_RBAE) {
-+ if (sonic_debug > 1)
-+ printk("%s: rx buffer area exceeded\n", dev->name);
-+ lp->stats.rx_dropped++;
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_RBAE); /* clear the interrupt */
-+ }
-
-- /*
-- * check error conditions
-- */
-- if (status & SONIC_INT_RFO) {
-- printk("%s: receive fifo underrun\n", dev->name);
-- lp->stats.rx_fifo_errors++;
-- }
-- if (status & SONIC_INT_RDE) {
-- printk("%s: receive descriptors exhausted\n", dev->name);
-- lp->stats.rx_dropped++;
-- }
-- if (status & SONIC_INT_RBE) {
-- printk("%s: receive buffer exhausted\n", dev->name);
-- lp->stats.rx_dropped++;
-- }
-- if (status & SONIC_INT_RBAE) {
-- printk("%s: receive buffer area exhausted\n", dev->name);
-- lp->stats.rx_dropped++;
-- }
-+ /* counter overruns; all counters are 16bit wide */
-+ if (status & SONIC_INT_FAE) {
-+ lp->stats.rx_frame_errors += 65536;
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_FAE); /* clear the interrupt */
-+ }
-+ if (status & SONIC_INT_CRC) {
-+ lp->stats.rx_crc_errors += 65536;
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_CRC); /* clear the interrupt */
-+ }
-+ if (status & SONIC_INT_MP) {
-+ lp->stats.rx_missed_errors += 65536;
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_MP); /* clear the interrupt */
-+ }
-
-- /* counter overruns; all counters are 16bit wide */
-- if (status & SONIC_INT_FAE)
-- lp->stats.rx_frame_errors += 65536;
-- if (status & SONIC_INT_CRC)
-- lp->stats.rx_crc_errors += 65536;
-- if (status & SONIC_INT_MP)
-- lp->stats.rx_missed_errors += 65536;
-+ /* transmit error */
-+ if (status & SONIC_INT_TXER) {
-+ if ((SONIC_READ(SONIC_TCR) & SONIC_TCR_FU) && (sonic_debug > 2))
-+ printk(KERN_ERR "%s: tx fifo underrun\n", dev->name);
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_TXER); /* clear the interrupt */
-+ }
-
-- /* transmit error */
-- if (status & SONIC_INT_TXER)
-- lp->stats.tx_errors++;
-+ /* bus retry */
-+ if (status & SONIC_INT_BR) {
-+ printk(KERN_ERR "%s: Bus retry occurred! Device interrupt disabled.\n",
-+ dev->name);
-+ /* ... to help debug DMA problems causing endless interrupts. */
-+ /* Bounce the eth interface to turn on the interrupt again. */
-+ SONIC_WRITE(SONIC_IMR, 0);
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_BR); /* clear the interrupt */
-+ }
-
-- /*
-- * clear interrupt bits and return
-- */
-- SONIC_WRITE(SONIC_ISR, status);
-+ /* load CAM done */
-+ if (status & SONIC_INT_LCD)
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_LCD); /* clear the interrupt */
-+ } while((status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT));
- return IRQ_HANDLED;
- }
-
- /*
-- * We have a good packet(s), get it/them out of the buffers.
-+ * We have a good packet(s), pass it/them up the network stack.
- */
- static void sonic_rx(struct net_device *dev)
- {
-- unsigned int base_addr = dev->base_addr;
-- struct sonic_local *lp = (struct sonic_local *) dev->priv;
-- sonic_rd_t *rd = &lp->rda[lp->cur_rx & SONIC_RDS_MASK];
-+ struct sonic_local *lp = netdev_priv(dev);
- int status;
-+ int entry = lp->cur_rx;
-
-- while (rd->in_use == 0) {
-- struct sk_buff *skb;
-+ while (sonic_rda_get(dev, entry, SONIC_RD_IN_USE) == 0) {
-+ struct sk_buff *used_skb;
-+ struct sk_buff *new_skb;
-+ dma_addr_t new_laddr;
-+ u16 bufadr_l;
-+ u16 bufadr_h;
- int pkt_len;
-- unsigned char *pkt_ptr;
-
-- status = rd->rx_status;
-- if (sonic_debug > 3)
-- printk("status %x, cur_rx %d, cur_rra %x\n",
-- status, lp->cur_rx, lp->cur_rra);
-+ status = sonic_rda_get(dev, entry, SONIC_RD_STATUS);
- if (status & SONIC_RCR_PRX) {
-- pkt_len = rd->rx_pktlen;
-- pkt_ptr =
-- (char *)
-- sonic_chiptomem((rd->rx_pktptr_h << 16) +
-- rd->rx_pktptr_l);
--
-- if (sonic_debug > 3)
-- printk
-- ("pktptr %p (rba %p) h:%x l:%x, bsize h:%x l:%x\n",
-- pkt_ptr, lp->rba, rd->rx_pktptr_h,
-- rd->rx_pktptr_l,
-- SONIC_READ(SONIC_RBWC1),
-- SONIC_READ(SONIC_RBWC0));
--
- /* Malloc up new buffer. */
-- skb = dev_alloc_skb(pkt_len + 2);
-- if (skb == NULL) {
-- printk
-- ("%s: Memory squeeze, dropping packet.\n",
-- dev->name);
-+ new_skb = dev_alloc_skb(SONIC_RBSIZE + 2);
-+ if (new_skb == NULL) {
-+ printk(KERN_ERR "%s: Memory squeeze, dropping packet.\n", dev->name);
- lp->stats.rx_dropped++;
- break;
- }
-- skb->dev = dev;
-- skb_reserve(skb, 2); /* 16 byte align */
-- skb_put(skb, pkt_len); /* Make room */
-- eth_copy_and_sum(skb, pkt_ptr, pkt_len, 0);
-- skb->protocol = eth_type_trans(skb, dev);
-- netif_rx(skb); /* pass the packet to upper layers */
-+ new_skb->dev = dev;
-+ /* provide 16 byte IP header alignment unless DMA requires otherwise */
-+ if(SONIC_BUS_SCALE(lp->dma_bitmode) == 2)
-+ skb_reserve(new_skb, 2);
-+
-+ new_laddr = dma_map_single(lp->device, skb_put(new_skb, SONIC_RBSIZE),
-+ SONIC_RBSIZE, DMA_FROM_DEVICE);
-+ if (!new_laddr) {
-+ dev_kfree_skb(new_skb);
-+ printk(KERN_ERR "%s: Failed to map rx buffer, dropping packet.\n", dev->name);
-+ lp->stats.rx_dropped++;
-+ break;
-+ }
-+
-+ /* now we have a new skb to replace it, pass the used one up the stack */
-+ dma_unmap_single(lp->device, lp->rx_laddr[entry], SONIC_RBSIZE, DMA_FROM_DEVICE);
-+ used_skb = lp->rx_skb[entry];
-+ pkt_len = sonic_rda_get(dev, entry, SONIC_RD_PKTLEN);
-+ skb_trim(used_skb, pkt_len);
-+ used_skb->protocol = eth_type_trans(used_skb, dev);
-+ netif_rx(used_skb);
- dev->last_rx = jiffies;
- lp->stats.rx_packets++;
- lp->stats.rx_bytes += pkt_len;
-
-+ /* and insert the new skb */
-+ lp->rx_laddr[entry] = new_laddr;
-+ lp->rx_skb[entry] = new_skb;
-+
-+ bufadr_l = (unsigned long)new_laddr & 0xffff;
-+ bufadr_h = (unsigned long)new_laddr >> 16;
-+ sonic_rra_put(dev, entry, SONIC_RR_BUFADR_L, bufadr_l);
-+ sonic_rra_put(dev, entry, SONIC_RR_BUFADR_H, bufadr_h);
- } else {
- /* This should only happen, if we enable accepting broken packets. */
- lp->stats.rx_errors++;
-@@ -341,29 +498,35 @@
- if (status & SONIC_RCR_CRCR)
- lp->stats.rx_crc_errors++;
- }
--
-- rd->in_use = 1;
-- rd = &lp->rda[(++lp->cur_rx) & SONIC_RDS_MASK];
-- /* now give back the buffer to the receive buffer area */
- if (status & SONIC_RCR_LPKT) {
- /*
-- * this was the last packet out of the current receice buffer
-+ * this was the last packet out of the current receive buffer
- * give the buffer back to the SONIC
- */
-- lp->cur_rra += sizeof(sonic_rr_t);
-- if (lp->cur_rra >
-- (lp->rra_laddr +
-- (SONIC_NUM_RRS -
-- 1) * sizeof(sonic_rr_t))) lp->cur_rra =
-- lp->rra_laddr;
-- SONIC_WRITE(SONIC_RWP, lp->cur_rra & 0xffff);
-+ lp->cur_rwp += SIZEOF_SONIC_RR * SONIC_BUS_SCALE(lp->dma_bitmode);
-+ if (lp->cur_rwp >= lp->rra_end) lp->cur_rwp = lp->rra_laddr & 0xffff;
-+ SONIC_WRITE(SONIC_RWP, lp->cur_rwp);
-+ if (SONIC_READ(SONIC_ISR) & SONIC_INT_RBE) {
-+ if (sonic_debug > 2)
-+ printk("%s: rx buffer exhausted\n", dev->name);
-+ SONIC_WRITE(SONIC_ISR, SONIC_INT_RBE); /* clear the flag */
-+ }
- } else
-- printk
-- ("%s: rx desc without RCR_LPKT. Shouldn't happen !?\n",
-+ printk(KERN_ERR "%s: rx desc without RCR_LPKT. Shouldn't happen !?\n",
- dev->name);
-+ /*
-+ * give back the descriptor
-+ */
-+ sonic_rda_put(dev, entry, SONIC_RD_LINK,
-+ sonic_rda_get(dev, entry, SONIC_RD_LINK) | SONIC_EOL);
-+ sonic_rda_put(dev, entry, SONIC_RD_IN_USE, 1);
-+ sonic_rda_put(dev, lp->eol_rx, SONIC_RD_LINK,
-+ sonic_rda_get(dev, lp->eol_rx, SONIC_RD_LINK) & ~SONIC_EOL);
-+ lp->eol_rx = entry;
-+ lp->cur_rx = entry = (entry + 1) & SONIC_RDS_MASK;
- }
- /*
-- * If any worth-while packets have been received, dev_rint()
-+ * If any worth-while packets have been received, netif_rx()
- * has done a mark_bh(NET_BH) for us and will work on them
- * when we get to the bottom-half routine.
- */
-@@ -376,8 +539,7 @@
- */
- static struct net_device_stats *sonic_get_stats(struct net_device *dev)
- {
-- struct sonic_local *lp = (struct sonic_local *) dev->priv;
-- unsigned int base_addr = dev->base_addr;
-+ struct sonic_local *lp = netdev_priv(dev);
-
- /* read the tally counter from the SONIC and reset them */
- lp->stats.rx_crc_errors += SONIC_READ(SONIC_CRCT);
-@@ -396,8 +558,7 @@
- */
- static void sonic_multicast_list(struct net_device *dev)
- {
-- struct sonic_local *lp = (struct sonic_local *) dev->priv;
-- unsigned int base_addr = dev->base_addr;
-+ struct sonic_local *lp = netdev_priv(dev);
- unsigned int rcr;
- struct dev_mc_list *dmi = dev->mc_list;
- unsigned char *addr;
-@@ -413,20 +574,15 @@
- rcr |= SONIC_RCR_AMC;
- } else {
- if (sonic_debug > 2)
-- printk
-- ("sonic_multicast_list: mc_count %d\n",
-- dev->mc_count);
-- lp->cda.cam_enable = 1; /* always enable our own address */
-+ printk("sonic_multicast_list: mc_count %d\n", dev->mc_count);
-+ sonic_set_cam_enable(dev, 1); /* always enable our own address */
- for (i = 1; i <= dev->mc_count; i++) {
- addr = dmi->dmi_addr;
- dmi = dmi->next;
-- lp->cda.cam_desc[i].cam_cap0 =
-- addr[1] << 8 | addr[0];
-- lp->cda.cam_desc[i].cam_cap1 =
-- addr[3] << 8 | addr[2];
-- lp->cda.cam_desc[i].cam_cap2 =
-- addr[5] << 8 | addr[4];
-- lp->cda.cam_enable |= (1 << i);
-+ sonic_cda_put(dev, i, SONIC_CD_CAP0, addr[1] << 8 | addr[0]);
-+ sonic_cda_put(dev, i, SONIC_CD_CAP1, addr[3] << 8 | addr[2]);
-+ sonic_cda_put(dev, i, SONIC_CD_CAP2, addr[5] << 8 | addr[4]);
-+ sonic_set_cam_enable(dev, sonic_get_cam_enable(dev) | (1 << i));
- }
- SONIC_WRITE(SONIC_CDC, 16);
- /* issue Load CAM command */
-@@ -447,19 +603,16 @@
- */
- static int sonic_init(struct net_device *dev)
- {
-- unsigned int base_addr = dev->base_addr;
- unsigned int cmd;
-- struct sonic_local *lp = (struct sonic_local *) dev->priv;
-- unsigned int rra_start;
-- unsigned int rra_end;
-+ struct sonic_local *lp = netdev_priv(dev);
- int i;
-
- /*
- * put the Sonic into software-reset mode and
- * disable all interrupts
- */
-- SONIC_WRITE(SONIC_ISR, 0x7fff);
- SONIC_WRITE(SONIC_IMR, 0);
-+ SONIC_WRITE(SONIC_ISR, 0x7fff);
- SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
-
- /*
-@@ -475,34 +628,32 @@
- if (sonic_debug > 2)
- printk("sonic_init: initialize receive resource area\n");
-
-- rra_start = lp->rra_laddr & 0xffff;
-- rra_end =
-- (rra_start + (SONIC_NUM_RRS * sizeof(sonic_rr_t))) & 0xffff;
--
- for (i = 0; i < SONIC_NUM_RRS; i++) {
-- lp->rra[i].rx_bufadr_l =
-- (lp->rba_laddr + i * SONIC_RBSIZE) & 0xffff;
-- lp->rra[i].rx_bufadr_h =
-- (lp->rba_laddr + i * SONIC_RBSIZE) >> 16;
-- lp->rra[i].rx_bufsize_l = SONIC_RBSIZE >> 1;
-- lp->rra[i].rx_bufsize_h = 0;
-+ u16 bufadr_l = (unsigned long)lp->rx_laddr[i] & 0xffff;
-+ u16 bufadr_h = (unsigned long)lp->rx_laddr[i] >> 16;
-+ sonic_rra_put(dev, i, SONIC_RR_BUFADR_L, bufadr_l);
-+ sonic_rra_put(dev, i, SONIC_RR_BUFADR_H, bufadr_h);
-+ sonic_rra_put(dev, i, SONIC_RR_BUFSIZE_L, SONIC_RBSIZE >> 1);
-+ sonic_rra_put(dev, i, SONIC_RR_BUFSIZE_H, 0);
- }
-
- /* initialize all RRA registers */
-- SONIC_WRITE(SONIC_RSA, rra_start);
-- SONIC_WRITE(SONIC_REA, rra_end);
-- SONIC_WRITE(SONIC_RRP, rra_start);
-- SONIC_WRITE(SONIC_RWP, rra_end);
-+ lp->rra_end = (lp->rra_laddr + SONIC_NUM_RRS * SIZEOF_SONIC_RR *
-+ SONIC_BUS_SCALE(lp->dma_bitmode)) & 0xffff;
-+ lp->cur_rwp = (lp->rra_laddr + (SONIC_NUM_RRS - 1) * SIZEOF_SONIC_RR *
-+ SONIC_BUS_SCALE(lp->dma_bitmode)) & 0xffff;
-+
-+ SONIC_WRITE(SONIC_RSA, lp->rra_laddr & 0xffff);
-+ SONIC_WRITE(SONIC_REA, lp->rra_end);
-+ SONIC_WRITE(SONIC_RRP, lp->rra_laddr & 0xffff);
-+ SONIC_WRITE(SONIC_RWP, lp->cur_rwp);
- SONIC_WRITE(SONIC_URRA, lp->rra_laddr >> 16);
-- SONIC_WRITE(SONIC_EOBC, (SONIC_RBSIZE - 2) >> 1);
--
-- lp->cur_rra =
-- lp->rra_laddr + (SONIC_NUM_RRS - 1) * sizeof(sonic_rr_t);
-+ SONIC_WRITE(SONIC_EOBC, (SONIC_RBSIZE >> 1) - (lp->dma_bitmode ? 2 : 1));
-
- /* load the resource pointers */
- if (sonic_debug > 3)
-- printk("sonic_init: issueing RRRA command\n");
--
-+ printk("sonic_init: issuing RRRA command\n");
-+
- SONIC_WRITE(SONIC_CMD, SONIC_CR_RRRA);
- i = 0;
- while (i++ < 100) {
-@@ -511,27 +662,30 @@
- }
-
- if (sonic_debug > 2)
-- printk("sonic_init: status=%x\n", SONIC_READ(SONIC_CMD));
--
-+ printk("sonic_init: status=%x i=%d\n", SONIC_READ(SONIC_CMD), i);
-+
- /*
- * Initialize the receive descriptors so that they
- * become a circular linked list, ie. let the last
- * descriptor point to the first again.
- */
- if (sonic_debug > 2)
-- printk("sonic_init: initialize receive descriptors\n");
-- for (i = 0; i < SONIC_NUM_RDS; i++) {
-- lp->rda[i].rx_status = 0;
-- lp->rda[i].rx_pktlen = 0;
-- lp->rda[i].rx_pktptr_l = 0;
-- lp->rda[i].rx_pktptr_h = 0;
-- lp->rda[i].rx_seqno = 0;
-- lp->rda[i].in_use = 1;
-- lp->rda[i].link =
-- lp->rda_laddr + (i + 1) * sizeof(sonic_rd_t);
-+ printk("sonic_init: initialize receive descriptors\n");
-+ for (i=0; i<SONIC_NUM_RDS; i++) {
-+ sonic_rda_put(dev, i, SONIC_RD_STATUS, 0);
-+ sonic_rda_put(dev, i, SONIC_RD_PKTLEN, 0);
-+ sonic_rda_put(dev, i, SONIC_RD_PKTPTR_L, 0);
-+ sonic_rda_put(dev, i, SONIC_RD_PKTPTR_H, 0);
-+ sonic_rda_put(dev, i, SONIC_RD_SEQNO, 0);
-+ sonic_rda_put(dev, i, SONIC_RD_IN_USE, 1);
-+ sonic_rda_put(dev, i, SONIC_RD_LINK,
-+ lp->rda_laddr +
-+ ((i+1) * SIZEOF_SONIC_RD * SONIC_BUS_SCALE(lp->dma_bitmode)));
- }
- /* fix last descriptor */
-- lp->rda[SONIC_NUM_RDS - 1].link = lp->rda_laddr;
-+ sonic_rda_put(dev, SONIC_NUM_RDS - 1, SONIC_RD_LINK,
-+ (lp->rda_laddr & 0xffff) | SONIC_EOL);
-+ lp->eol_rx = SONIC_NUM_RDS - 1;
- lp->cur_rx = 0;
- SONIC_WRITE(SONIC_URDA, lp->rda_laddr >> 16);
- SONIC_WRITE(SONIC_CRDA, lp->rda_laddr & 0xffff);
-@@ -542,34 +696,34 @@
- if (sonic_debug > 2)
- printk("sonic_init: initialize transmit descriptors\n");
- for (i = 0; i < SONIC_NUM_TDS; i++) {
-- lp->tda[i].tx_status = 0;
-- lp->tda[i].tx_config = 0;
-- lp->tda[i].tx_pktsize = 0;
-- lp->tda[i].tx_frag_count = 0;
-- lp->tda[i].link =
-- (lp->tda_laddr +
-- (i + 1) * sizeof(sonic_td_t)) | SONIC_END_OF_LINKS;
-+ sonic_tda_put(dev, i, SONIC_TD_STATUS, 0);
-+ sonic_tda_put(dev, i, SONIC_TD_CONFIG, 0);
-+ sonic_tda_put(dev, i, SONIC_TD_PKTSIZE, 0);
-+ sonic_tda_put(dev, i, SONIC_TD_FRAG_COUNT, 0);
-+ sonic_tda_put(dev, i, SONIC_TD_LINK,
-+ (lp->tda_laddr & 0xffff) +
-+ (i + 1) * SIZEOF_SONIC_TD * SONIC_BUS_SCALE(lp->dma_bitmode));
-+ lp->tx_skb[i] = NULL;
- }
-- lp->tda[SONIC_NUM_TDS - 1].link =
-- (lp->tda_laddr & 0xffff) | SONIC_END_OF_LINKS;
-+ /* fix last descriptor */
-+ sonic_tda_put(dev, SONIC_NUM_TDS - 1, SONIC_TD_LINK,
-+ (lp->tda_laddr & 0xffff));
-
- SONIC_WRITE(SONIC_UTDA, lp->tda_laddr >> 16);
- SONIC_WRITE(SONIC_CTDA, lp->tda_laddr & 0xffff);
-- lp->cur_tx = lp->dirty_tx = 0;
--
-+ lp->cur_tx = lp->next_tx = 0;
-+ lp->eol_tx = SONIC_NUM_TDS - 1;
-+
- /*
- * put our own address to CAM desc[0]
- */
-- lp->cda.cam_desc[0].cam_cap0 =
-- dev->dev_addr[1] << 8 | dev->dev_addr[0];
-- lp->cda.cam_desc[0].cam_cap1 =
-- dev->dev_addr[3] << 8 | dev->dev_addr[2];
-- lp->cda.cam_desc[0].cam_cap2 =
-- dev->dev_addr[5] << 8 | dev->dev_addr[4];
-- lp->cda.cam_enable = 1;
-+ sonic_cda_put(dev, 0, SONIC_CD_CAP0, dev->dev_addr[1] << 8 | dev->dev_addr[0]);
-+ sonic_cda_put(dev, 0, SONIC_CD_CAP1, dev->dev_addr[3] << 8 | dev->dev_addr[2]);
-+ sonic_cda_put(dev, 0, SONIC_CD_CAP2, dev->dev_addr[5] << 8 | dev->dev_addr[4]);
-+ sonic_set_cam_enable(dev, 1);
-
- for (i = 0; i < 16; i++)
-- lp->cda.cam_desc[i].cam_entry_pointer = i;
-+ sonic_cda_put(dev, i, SONIC_CD_ENTRY_POINTER, i);
-
- /*
- * initialize CAM registers
-@@ -588,8 +742,8 @@
- break;
- }
- if (sonic_debug > 2) {
-- printk("sonic_init: CMD=%x, ISR=%x\n",
-- SONIC_READ(SONIC_CMD), SONIC_READ(SONIC_ISR));
-+ printk("sonic_init: CMD=%x, ISR=%x\n, i=%d",
-+ SONIC_READ(SONIC_CMD), SONIC_READ(SONIC_ISR), i);
- }
-
- /*
-@@ -604,7 +758,7 @@
-
- cmd = SONIC_READ(SONIC_CMD);
- if ((cmd & SONIC_CR_RXEN) == 0 || (cmd & SONIC_CR_STP) == 0)
-- printk("sonic_init: failed, status=%x\n", cmd);
-+ printk(KERN_ERR "sonic_init: failed, status=%x\n", cmd);
-
- if (sonic_debug > 2)
- printk("sonic_init: new status=%x\n",
---- orig/drivers/net/sonic.h Sun Jul 10 22:11:34 2005
-+++ linux/drivers/net/sonic.h Sun Jul 10 22:11:46 2005
-@@ -1,5 +1,5 @@
- /*
-- * Helpfile for sonic.c
-+ * Header file for sonic.c
- *
- * (C) Waldorf Electronics, Germany
- * Written by Andreas Busse
-@@ -9,10 +9,16 @@
- * and pad structure members must be exchanged. Also, the structures
- * need to be changed accordingly to the bus size.
- *
-- * 981229 MSch: did just that for the 68k Mac port (32 bit, big endian),
-- * see CONFIG_MACSONIC branch below.
-+ * 981229 MSch: did just that for the 68k Mac port (32 bit, big endian)
- *
-+ * 990611 David Huggins-Daines <dhd at debian.org>: This machine abstraction
-+ * does not cope with 16-bit bus sizes very well. Therefore I have
-+ * rewritten it with ugly macros and evil inlines.
-+ *
-+ * 050625 Finn Thain: introduced more 32-bit cards and dhd's support
-+ * for 16-bit cards (from the mac68k project).
- */
-+
- #ifndef SONIC_H
- #define SONIC_H
-
-@@ -83,6 +89,7 @@
- /*
- * Error counters
- */
-+
- #define SONIC_CRCT 0x2c
- #define SONIC_FAET 0x2d
- #define SONIC_MPT 0x2e
-@@ -182,14 +189,14 @@
-
- #define SONIC_INT_BR 0x4000
- #define SONIC_INT_HBL 0x2000
--#define SONIC_INT_LCD 0x1000
--#define SONIC_INT_PINT 0x0800
--#define SONIC_INT_PKTRX 0x0400
--#define SONIC_INT_TXDN 0x0200
--#define SONIC_INT_TXER 0x0100
--#define SONIC_INT_TC 0x0080
--#define SONIC_INT_RDE 0x0040
--#define SONIC_INT_RBE 0x0020
-+#define SONIC_INT_LCD 0x1000
-+#define SONIC_INT_PINT 0x0800
-+#define SONIC_INT_PKTRX 0x0400
-+#define SONIC_INT_TXDN 0x0200
-+#define SONIC_INT_TXER 0x0100
-+#define SONIC_INT_TC 0x0080
-+#define SONIC_INT_RDE 0x0040
-+#define SONIC_INT_RBE 0x0020
- #define SONIC_INT_RBAE 0x0010
- #define SONIC_INT_CRC 0x0008
- #define SONIC_INT_FAE 0x0004
-@@ -201,224 +208,61 @@
- * The interrupts we allow.
- */
-
--#define SONIC_IMR_DEFAULT (SONIC_INT_BR | \
-- SONIC_INT_LCD | \
-- SONIC_INT_PINT | \
-+#define SONIC_IMR_DEFAULT ( SONIC_INT_BR | \
-+ SONIC_INT_LCD | \
-+ SONIC_INT_RFO | \
- SONIC_INT_PKTRX | \
- SONIC_INT_TXDN | \
- SONIC_INT_TXER | \
- SONIC_INT_RDE | \
-- SONIC_INT_RBE | \
- SONIC_INT_RBAE | \
- SONIC_INT_CRC | \
- SONIC_INT_FAE | \
- SONIC_INT_MP)
-
-
--#define SONIC_END_OF_LINKS 0x0001
--
--
--#ifdef CONFIG_MACSONIC
--/*
-- * Big endian like structures on 680x0 Macs
-- */
--
--typedef struct {
-- u32 rx_bufadr_l; /* receive buffer ptr */
-- u32 rx_bufadr_h;
--
-- u32 rx_bufsize_l; /* no. of words in the receive buffer */
-- u32 rx_bufsize_h;
--} sonic_rr_t;
--
--/*
-- * Sonic receive descriptor. Receive descriptors are
-- * kept in a linked list of these structures.
-- */
--
--typedef struct {
-- SREGS_PAD(pad0);
-- u16 rx_status; /* status after reception of a packet */
-- SREGS_PAD(pad1);
-- u16 rx_pktlen; /* length of the packet incl. CRC */
--
-- /*
-- * Pointers to the location in the receive buffer area (RBA)
-- * where the packet resides. A packet is always received into
-- * a contiguous piece of memory.
-- */
-- SREGS_PAD(pad2);
-- u16 rx_pktptr_l;
-- SREGS_PAD(pad3);
-- u16 rx_pktptr_h;
--
-- SREGS_PAD(pad4);
-- u16 rx_seqno; /* sequence no. */
--
-- SREGS_PAD(pad5);
-- u16 link; /* link to next RDD (end if EOL bit set) */
--
-- /*
-- * Owner of this descriptor, 0= driver, 1=sonic
-- */
--
-- SREGS_PAD(pad6);
-- u16 in_use;
--
-- caddr_t rda_next; /* pointer to next RD */
--} sonic_rd_t;
--
--
--/*
-- * Describes a Transmit Descriptor
-- */
--typedef struct {
-- SREGS_PAD(pad0);
-- u16 tx_status; /* status after transmission of a packet */
-- SREGS_PAD(pad1);
-- u16 tx_config; /* transmit configuration for this packet */
-- SREGS_PAD(pad2);
-- u16 tx_pktsize; /* size of the packet to be transmitted */
-- SREGS_PAD(pad3);
-- u16 tx_frag_count; /* no. of fragments */
--
-- SREGS_PAD(pad4);
-- u16 tx_frag_ptr_l;
-- SREGS_PAD(pad5);
-- u16 tx_frag_ptr_h;
-- SREGS_PAD(pad6);
-- u16 tx_frag_size;
--
-- SREGS_PAD(pad7);
-- u16 link; /* ptr to next descriptor */
--} sonic_td_t;
--
--
--/*
-- * Describes an entry in the CAM Descriptor Area.
-- */
--
--typedef struct {
-- SREGS_PAD(pad0);
-- u16 cam_entry_pointer;
-- SREGS_PAD(pad1);
-- u16 cam_cap0;
-- SREGS_PAD(pad2);
-- u16 cam_cap1;
-- SREGS_PAD(pad3);
-- u16 cam_cap2;
--} sonic_cd_t;
--
-+#define SONIC_EOL 0x0001
- #define CAM_DESCRIPTORS 16
-
-+/* Offsets in the various DMA buffers accessed by the SONIC */
-
--typedef struct {
-- sonic_cd_t cam_desc[CAM_DESCRIPTORS];
-- SREGS_PAD(pad);
-- u16 cam_enable;
--} sonic_cda_t;
--
--#else /* original declarations, little endian 32 bit */
--
--/*
-- * structure definitions
-- */
--
--typedef struct {
-- u32 rx_bufadr_l; /* receive buffer ptr */
-- u32 rx_bufadr_h;
--
-- u32 rx_bufsize_l; /* no. of words in the receive buffer */
-- u32 rx_bufsize_h;
--} sonic_rr_t;
--
--/*
-- * Sonic receive descriptor. Receive descriptors are
-- * kept in a linked list of these structures.
-- */
--
--typedef struct {
-- u16 rx_status; /* status after reception of a packet */
-- SREGS_PAD(pad0);
-- u16 rx_pktlen; /* length of the packet incl. CRC */
-- SREGS_PAD(pad1);
--
-- /*
-- * Pointers to the location in the receive buffer area (RBA)
-- * where the packet resides. A packet is always received into
-- * a contiguous piece of memory.
-- */
-- u16 rx_pktptr_l;
-- SREGS_PAD(pad2);
-- u16 rx_pktptr_h;
-- SREGS_PAD(pad3);
--
-- u16 rx_seqno; /* sequence no. */
-- SREGS_PAD(pad4);
--
-- u16 link; /* link to next RDD (end if EOL bit set) */
-- SREGS_PAD(pad5);
--
-- /*
-- * Owner of this descriptor, 0= driver, 1=sonic
-- */
--
-- u16 in_use;
-- SREGS_PAD(pad6);
--
-- caddr_t rda_next; /* pointer to next RD */
--} sonic_rd_t;
--
--
--/*
-- * Describes a Transmit Descriptor
-- */
--typedef struct {
-- u16 tx_status; /* status after transmission of a packet */
-- SREGS_PAD(pad0);
-- u16 tx_config; /* transmit configuration for this packet */
-- SREGS_PAD(pad1);
-- u16 tx_pktsize; /* size of the packet to be transmitted */
-- SREGS_PAD(pad2);
-- u16 tx_frag_count; /* no. of fragments */
-- SREGS_PAD(pad3);
--
-- u16 tx_frag_ptr_l;
-- SREGS_PAD(pad4);
-- u16 tx_frag_ptr_h;
-- SREGS_PAD(pad5);
-- u16 tx_frag_size;
-- SREGS_PAD(pad6);
--
-- u16 link; /* ptr to next descriptor */
-- SREGS_PAD(pad7);
--} sonic_td_t;
--
--
--/*
-- * Describes an entry in the CAM Descriptor Area.
-- */
--
--typedef struct {
-- u16 cam_entry_pointer;
-- SREGS_PAD(pad0);
-- u16 cam_cap0;
-- SREGS_PAD(pad1);
-- u16 cam_cap1;
-- SREGS_PAD(pad2);
-- u16 cam_cap2;
-- SREGS_PAD(pad3);
--} sonic_cd_t;
--
--#define CAM_DESCRIPTORS 16
-+#define SONIC_BITMODE16 0
-+#define SONIC_BITMODE32 1
-+#define SONIC_BUS_SCALE(bitmode) ((bitmode) ? 4 : 2)
-+/* Note! These are all measured in bus-size units, so use SONIC_BUS_SCALE */
-+#define SIZEOF_SONIC_RR 4
-+#define SONIC_RR_BUFADR_L 0
-+#define SONIC_RR_BUFADR_H 1
-+#define SONIC_RR_BUFSIZE_L 2
-+#define SONIC_RR_BUFSIZE_H 3
-+
-+#define SIZEOF_SONIC_RD 7
-+#define SONIC_RD_STATUS 0
-+#define SONIC_RD_PKTLEN 1
-+#define SONIC_RD_PKTPTR_L 2
-+#define SONIC_RD_PKTPTR_H 3
-+#define SONIC_RD_SEQNO 4
-+#define SONIC_RD_LINK 5
-+#define SONIC_RD_IN_USE 6
-+
-+#define SIZEOF_SONIC_TD 8
-+#define SONIC_TD_STATUS 0
-+#define SONIC_TD_CONFIG 1
-+#define SONIC_TD_PKTSIZE 2
-+#define SONIC_TD_FRAG_COUNT 3
-+#define SONIC_TD_FRAG_PTR_L 4
-+#define SONIC_TD_FRAG_PTR_H 5
-+#define SONIC_TD_FRAG_SIZE 6
-+#define SONIC_TD_LINK 7
-+
-+#define SIZEOF_SONIC_CD 4
-+#define SONIC_CD_ENTRY_POINTER 0
-+#define SONIC_CD_CAP0 1
-+#define SONIC_CD_CAP1 2
-+#define SONIC_CD_CAP2 3
-
--
--typedef struct {
-- sonic_cd_t cam_desc[CAM_DESCRIPTORS];
-- u16 cam_enable;
-- SREGS_PAD(pad);
--} sonic_cda_t;
--#endif /* endianness */
-+#define SIZEOF_SONIC_CDA ((CAM_DESCRIPTORS * SIZEOF_SONIC_CD) + 1)
-+#define SONIC_CDA_CAM_ENABLE (CAM_DESCRIPTORS * SIZEOF_SONIC_CD)
-
- /*
- * Some tunables for the buffer areas. Power of 2 is required
-@@ -426,44 +270,60 @@
- *
- * MSch: use more buffer space for the slow m68k Macs!
- */
--#ifdef CONFIG_MACSONIC
--#define SONIC_NUM_RRS 32 /* number of receive resources */
--#define SONIC_NUM_RDS SONIC_NUM_RRS /* number of receive descriptors */
--#define SONIC_NUM_TDS 32 /* number of transmit descriptors */
--#else
--#define SONIC_NUM_RRS 16 /* number of receive resources */
--#define SONIC_NUM_RDS SONIC_NUM_RRS /* number of receive descriptors */
--#define SONIC_NUM_TDS 16 /* number of transmit descriptors */
--#endif
--#define SONIC_RBSIZE 1520 /* size of one resource buffer */
--
--#define SONIC_RDS_MASK (SONIC_NUM_RDS-1)
--#define SONIC_TDS_MASK (SONIC_NUM_TDS-1)
--
-+#define SONIC_NUM_RRS 16 /* number of receive resources */
-+#define SONIC_NUM_RDS SONIC_NUM_RRS /* number of receive descriptors */
-+#define SONIC_NUM_TDS 16 /* number of transmit descriptors */
-+
-+#define SONIC_RDS_MASK (SONIC_NUM_RDS-1)
-+#define SONIC_TDS_MASK (SONIC_NUM_TDS-1)
-+
-+#define SONIC_RBSIZE 1520 /* size of one resource buffer */
-+
-+/* Again, measured in bus size units! */
-+#define SIZEOF_SONIC_DESC (SIZEOF_SONIC_CDA \
-+ + (SIZEOF_SONIC_TD * SONIC_NUM_TDS) \
-+ + (SIZEOF_SONIC_RD * SONIC_NUM_RDS) \
-+ + (SIZEOF_SONIC_RR * SONIC_NUM_RRS))
-
- /* Information that need to be kept for each board. */
- struct sonic_local {
-- sonic_cda_t cda; /* virtual CPU address of CDA */
-- sonic_td_t tda[SONIC_NUM_TDS]; /* transmit descriptor area */
-- sonic_rr_t rra[SONIC_NUM_RRS]; /* receive resource area */
-- sonic_rd_t rda[SONIC_NUM_RDS]; /* receive descriptor area */
-- struct sk_buff *tx_skb[SONIC_NUM_TDS]; /* skbuffs for packets to transmit */
-- unsigned int tx_laddr[SONIC_NUM_TDS]; /* logical DMA address fro skbuffs */
-- unsigned char *rba; /* start of receive buffer areas */
-- unsigned int cda_laddr; /* logical DMA address of CDA */
-- unsigned int tda_laddr; /* logical DMA address of TDA */
-- unsigned int rra_laddr; /* logical DMA address of RRA */
-- unsigned int rda_laddr; /* logical DMA address of RDA */
-- unsigned int rba_laddr; /* logical DMA address of RBA */
-- unsigned int cur_rra; /* current indexes to resource areas */
-+ /* Bus size. 0 == 16 bits, 1 == 32 bits. */
-+ int dma_bitmode;
-+ /* Register offset within the longword (independent of endianness,
-+ and varies from one type of Macintosh SONIC to another
-+ (Aarrgh)) */
-+ int reg_offset;
-+ void *descriptors;
-+ /* Crud. These areas have to be within the same 64K. Therefore
-+ we allocate a desriptors page, and point these to places within it. */
-+ void *cda; /* CAM descriptor area */
-+ void *tda; /* Transmit descriptor area */
-+ void *rra; /* Receive resource area */
-+ void *rda; /* Receive descriptor area */
-+ struct sk_buff* volatile rx_skb[SONIC_NUM_RRS]; /* packets to be received */
-+ struct sk_buff* volatile tx_skb[SONIC_NUM_TDS]; /* packets to be transmitted */
-+ unsigned int tx_len[SONIC_NUM_TDS]; /* lengths of tx DMA mappings */
-+ /* Logical DMA addresses on MIPS, bus addresses on m68k
-+ * (so "laddr" is a bit misleading) */
-+ dma_addr_t descriptors_laddr;
-+ u32 cda_laddr; /* logical DMA address of CDA */
-+ u32 tda_laddr; /* logical DMA address of TDA */
-+ u32 rra_laddr; /* logical DMA address of RRA */
-+ u32 rda_laddr; /* logical DMA address of RDA */
-+ dma_addr_t rx_laddr[SONIC_NUM_RRS]; /* logical DMA addresses of rx skbuffs */
-+ dma_addr_t tx_laddr[SONIC_NUM_TDS]; /* logical DMA addresses of tx skbuffs */
-+ unsigned int rra_end;
-+ unsigned int cur_rwp;
- unsigned int cur_rx;
-- unsigned int cur_tx;
-- unsigned int dirty_tx; /* last unacked transmit packet */
-- char tx_full;
-+ unsigned int cur_tx; /* first unacked transmit packet */
-+ unsigned int eol_rx;
-+ unsigned int eol_tx; /* last unacked transmit packet */
-+ unsigned int next_tx; /* next free TD */
-+ struct device *device; /* generic device */
- struct net_device_stats stats;
- };
-
--#define TX_TIMEOUT 6
-+#define TX_TIMEOUT (3 * HZ)
-
- /* Index to functions, as function prototypes. */
-
-@@ -476,6 +336,114 @@
- static void sonic_multicast_list(struct net_device *dev);
- static int sonic_init(struct net_device *dev);
- static void sonic_tx_timeout(struct net_device *dev);
-+
-+/* Internal inlines for reading/writing DMA buffers. Note that bus
-+ size and endianness matter here, whereas they don't for registers,
-+ as far as we can tell. */
-+/* OpenBSD calls this "SWO". I'd like to think that sonic_buf_put()
-+ is a much better name. */
-+static inline void sonic_buf_put(void* base, int bitmode,
-+ int offset, __u16 val)
-+{
-+ if (bitmode)
-+#ifdef __BIG_ENDIAN
-+ ((__u16 *) base + (offset*2))[1] = val;
-+#else
-+ ((__u16 *) base + (offset*2))[0] = val;
-+#endif
-+ else
-+ ((__u16 *) base)[offset] = val;
-+}
-+
-+static inline __u16 sonic_buf_get(void* base, int bitmode,
-+ int offset)
-+{
-+ if (bitmode)
-+#ifdef __BIG_ENDIAN
-+ return ((volatile __u16 *) base + (offset*2))[1];
-+#else
-+ return ((volatile __u16 *) base + (offset*2))[0];
-+#endif
-+ else
-+ return ((volatile __u16 *) base)[offset];
-+}
-+
-+/* Inlines that you should actually use for reading/writing DMA buffers */
-+static inline void sonic_cda_put(struct net_device* dev, int entry,
-+ int offset, __u16 val)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ sonic_buf_put(lp->cda, lp->dma_bitmode,
-+ (entry * SIZEOF_SONIC_CD) + offset, val);
-+}
-+
-+static inline __u16 sonic_cda_get(struct net_device* dev, int entry,
-+ int offset)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ return sonic_buf_get(lp->cda, lp->dma_bitmode,
-+ (entry * SIZEOF_SONIC_CD) + offset);
-+}
-+
-+static inline void sonic_set_cam_enable(struct net_device* dev, __u16 val)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ sonic_buf_put(lp->cda, lp->dma_bitmode, SONIC_CDA_CAM_ENABLE, val);
-+}
-+
-+static inline __u16 sonic_get_cam_enable(struct net_device* dev)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ return sonic_buf_get(lp->cda, lp->dma_bitmode, SONIC_CDA_CAM_ENABLE);
-+}
-+
-+static inline void sonic_tda_put(struct net_device* dev, int entry,
-+ int offset, __u16 val)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ sonic_buf_put(lp->tda, lp->dma_bitmode,
-+ (entry * SIZEOF_SONIC_TD) + offset, val);
-+}
-+
-+static inline __u16 sonic_tda_get(struct net_device* dev, int entry,
-+ int offset)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ return sonic_buf_get(lp->tda, lp->dma_bitmode,
-+ (entry * SIZEOF_SONIC_TD) + offset);
-+}
-+
-+static inline void sonic_rda_put(struct net_device* dev, int entry,
-+ int offset, __u16 val)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ sonic_buf_put(lp->rda, lp->dma_bitmode,
-+ (entry * SIZEOF_SONIC_RD) + offset, val);
-+}
-+
-+static inline __u16 sonic_rda_get(struct net_device* dev, int entry,
-+ int offset)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ return sonic_buf_get(lp->rda, lp->dma_bitmode,
-+ (entry * SIZEOF_SONIC_RD) + offset);
-+}
-+
-+static inline void sonic_rra_put(struct net_device* dev, int entry,
-+ int offset, __u16 val)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ sonic_buf_put(lp->rra, lp->dma_bitmode,
-+ (entry * SIZEOF_SONIC_RR) + offset, val);
-+}
-+
-+static inline __u16 sonic_rra_get(struct net_device* dev, int entry,
-+ int offset)
-+{
-+ struct sonic_local* lp = (struct sonic_local *) dev->priv;
-+ return sonic_buf_get(lp->rra, lp->dma_bitmode,
-+ (entry * SIZEOF_SONIC_RR) + offset);
-+}
-
- static const char *version =
- "sonic.c:v0.92 20.9.98 tsbogend at alpha.franken.de\n";
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/mempolicy-check-mode.patch
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/mempolicy-check-mode.patch 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/mempolicy-check-mode.patch 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,33 +0,0 @@
-diff -Naru a/mm/mempolicy.c b/mm/mempolicy.c
---- a/mm/mempolicy.c 2005-09-27 13:25:44 -07:00
-+++ b/mm/mempolicy.c 2005-09-27 13:25:44 -07:00
-@@ -443,7 +443,7 @@
- struct mempolicy *new;
- DECLARE_BITMAP(nodes, MAX_NUMNODES);
-
-- if (mode > MPOL_MAX)
-+ if (mode < 0 || mode > MPOL_MAX)
- return -EINVAL;
- err = get_nodes(nodes, nmask, maxnode, mode);
- if (err)
-# This is a BitKeeper generated diff -Nru style patch.
-#
-# ChangeSet
-# 2005/08/01 21:38:00-07:00 dada1 at cosmosbay.com
-# [PATCH] sys_set_mempolicy() doesnt check if mode < 0
-#
-# A kernel BUG() is triggered by a call to set_mempolicy() with a negative
-# first argument. This is because the mode is declared as an int, and the
-# validity check doesnt check < 0 values. Alternatively, mode could be
-# declared as unsigned int or unsigned long.
-#
-# Signed-off-by: Eric Dumazet <dada1 at cosmosbay.com>
-# Cc: Andi Kleen <ak at suse.de>
-# Signed-off-by: Andrew Morton <akpm at osdl.org>
-# Signed-off-by: Linus Torvalds <torvalds at osdl.org>
-#
-# GIT: ba17101b41977f124948e0a7797fdcbb59e19f3e
-#
-# mm/mempolicy.c
-# 2005/08/01 21:38:00-07:00 dada1 at cosmosbay.com +1 -1
-#
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.1
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.1 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.1 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,422 +0,0 @@
-diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
---- a/arch/i386/pci/common.c
-+++ b/arch/i386/pci/common.c
-@@ -165,7 +165,6 @@ static int __init pcibios_init(void)
- if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
- pcibios_sort();
- #endif
-- pci_assign_unassigned_resources();
- return 0;
- }
-
-diff --git a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c
---- a/arch/i386/pci/i386.c
-+++ b/arch/i386/pci/i386.c
-@@ -170,43 +170,26 @@ static void __init pcibios_allocate_reso
- static int __init pcibios_assign_resources(void)
- {
- struct pci_dev *dev = NULL;
-- int idx;
-- struct resource *r;
-+ struct resource *r, *pr;
-
-- for_each_pci_dev(dev) {
-- int class = dev->class >> 8;
--
-- /* Don't touch classless devices and host bridges */
-- if (!class || class == PCI_CLASS_BRIDGE_HOST)
-- continue;
--
-- for(idx=0; idx<6; idx++) {
-- r = &dev->resource[idx];
--
-- /*
-- * Don't touch IDE controllers and I/O ports of video cards!
-- */
-- if ((class == PCI_CLASS_STORAGE_IDE && idx < 4) ||
-- (class == PCI_CLASS_DISPLAY_VGA && (r->flags & IORESOURCE_IO)))
-- continue;
--
-- /*
-- * We shall assign a new address to this resource, either because
-- * the BIOS forgot to do so or because we have decided the old
-- * address was unusable for some reason.
-- */
-- if (!r->start && r->end)
-- pci_assign_resource(dev, idx);
-- }
--
-- if (pci_probe & PCI_ASSIGN_ROMS) {
-+ if (!(pci_probe & PCI_ASSIGN_ROMS)) {
-+ /* Try to use BIOS settings for ROMs, otherwise let
-+ pci_assign_unassigned_resources() allocate the new
-+ addresses. */
-+ for_each_pci_dev(dev) {
- r = &dev->resource[PCI_ROM_RESOURCE];
-- r->end -= r->start;
-- r->start = 0;
-- if (r->end)
-- pci_assign_resource(dev, PCI_ROM_RESOURCE);
-+ if (!r->flags || !r->start)
-+ continue;
-+ pr = pci_find_parent_resource(dev, r);
-+ if (!pr || request_resource(pr, r) < 0) {
-+ r->end -= r->start;
-+ r->start = 0;
-+ }
- }
- }
-+
-+ pci_assign_unassigned_resources();
-+
- return 0;
- }
-
-diff --git a/crypto/cipher.c b/crypto/cipher.c
---- a/crypto/cipher.c
-+++ b/crypto/cipher.c
-@@ -191,6 +191,8 @@ static unsigned int cbc_process_encrypt(
- u8 *iv = desc->info;
- unsigned int done = 0;
-
-+ nbytes -= bsize;
-+
- do {
- xor(iv, src);
- fn(crypto_tfm_ctx(tfm), dst, iv);
-@@ -198,7 +200,7 @@ static unsigned int cbc_process_encrypt(
-
- src += bsize;
- dst += bsize;
-- } while ((done += bsize) < nbytes);
-+ } while ((done += bsize) <= nbytes);
-
- return done;
- }
-@@ -219,6 +221,8 @@ static unsigned int cbc_process_decrypt(
- u8 *iv = desc->info;
- unsigned int done = 0;
-
-+ nbytes -= bsize;
-+
- do {
- u8 *tmp_dst = *dst_p;
-
-@@ -230,7 +234,7 @@ static unsigned int cbc_process_decrypt(
-
- src += bsize;
- dst += bsize;
-- } while ((done += bsize) < nbytes);
-+ } while ((done += bsize) <= nbytes);
-
- return done;
- }
-@@ -243,12 +247,14 @@ static unsigned int ecb_process(const st
- void (*fn)(void *, u8 *, const u8 *) = desc->crfn;
- unsigned int done = 0;
-
-+ nbytes -= bsize;
-+
- do {
- fn(crypto_tfm_ctx(tfm), dst, src);
-
- src += bsize;
- dst += bsize;
-- } while ((done += bsize) < nbytes);
-+ } while ((done += bsize) <= nbytes);
-
- return done;
- }
-diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
---- a/drivers/char/rtc.c
-+++ b/drivers/char/rtc.c
-@@ -938,10 +938,9 @@ found:
-
- /*
- * XXX Interrupt pin #7 in Espresso is shared between RTC and
-- * PCI Slot 2 INTA# (and some INTx# in Slot 1). SA_INTERRUPT here
-- * is asking for trouble with add-on boards. Change to SA_SHIRQ.
-+ * PCI Slot 2 INTA# (and some INTx# in Slot 1).
- */
-- if (request_irq(rtc_irq, rtc_interrupt, SA_INTERRUPT, "rtc", (void *)&rtc_port)) {
-+ if (request_irq(rtc_irq, rtc_interrupt, SA_SHIRQ, "rtc", (void *)&rtc_port)) {
- /*
- * Standard way for sparc to print irq's is to use
- * __irq_itoa(). I think for EBus it's ok to use %d.
-diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
---- a/drivers/media/video/Kconfig
-+++ b/drivers/media/video/Kconfig
-@@ -254,6 +254,7 @@ config VIDEO_SAA7134_DVB
- select VIDEO_BUF_DVB
- select DVB_MT352
- select DVB_CX22702
-+ select DVB_TDA1004X
- ---help---
- This adds support for DVB cards based on the
- Philips saa7134 chip.
-diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
---- a/drivers/pci/rom.c
-+++ b/drivers/pci/rom.c
-@@ -21,13 +21,21 @@
- * between the ROM and other resources, so enabling it may disable access
- * to MMIO registers or other card memory.
- */
--static void pci_enable_rom(struct pci_dev *pdev)
-+static int pci_enable_rom(struct pci_dev *pdev)
- {
-+ struct resource *res = pdev->resource + PCI_ROM_RESOURCE;
-+ struct pci_bus_region region;
- u32 rom_addr;
-
-+ if (!res->flags)
-+ return -1;
-+
-+ pcibios_resource_to_bus(pdev, ®ion, res);
- pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr);
-- rom_addr |= PCI_ROM_ADDRESS_ENABLE;
-+ rom_addr &= ~PCI_ROM_ADDRESS_MASK;
-+ rom_addr |= region.start | PCI_ROM_ADDRESS_ENABLE;
- pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr);
-+ return 0;
- }
-
- /**
-@@ -71,19 +79,21 @@ void __iomem *pci_map_rom(struct pci_dev
- } else {
- if (res->flags & IORESOURCE_ROM_COPY) {
- *size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
-- return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
-+ return (void __iomem *)pci_resource_start(pdev,
-+ PCI_ROM_RESOURCE);
- } else {
- /* assign the ROM an address if it doesn't have one */
-- if (res->parent == NULL)
-- pci_assign_resource(pdev, PCI_ROM_RESOURCE);
--
-+ if (res->parent == NULL &&
-+ pci_assign_resource(pdev,PCI_ROM_RESOURCE))
-+ return NULL;
- start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
- *size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
- if (*size == 0)
- return NULL;
-
- /* Enable ROM space decodes */
-- pci_enable_rom(pdev);
-+ if (pci_enable_rom(pdev))
-+ return NULL;
- }
- }
-
-diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
---- a/drivers/pci/setup-bus.c
-+++ b/drivers/pci/setup-bus.c
-@@ -40,7 +40,7 @@
- * FIXME: IO should be max 256 bytes. However, since we may
- * have a P2P bridge below a cardbus bridge, we need 4K.
- */
--#define CARDBUS_IO_SIZE (256)
-+#define CARDBUS_IO_SIZE (4*1024)
- #define CARDBUS_MEM_SIZE (32*1024*1024)
-
- static void __devinit
-diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
---- a/drivers/scsi/aacraid/aachba.c
-+++ b/drivers/scsi/aacraid/aachba.c
-@@ -968,7 +968,7 @@ static int aac_read(struct scsi_cmnd * s
- fibsize = sizeof(struct aac_read64) +
- ((le32_to_cpu(readcmd->sg.count) - 1) *
- sizeof (struct sgentry64));
-- BUG_ON (fibsize > (sizeof(struct hw_fib) -
-+ BUG_ON (fibsize > (dev->max_fib_size -
- sizeof(struct aac_fibhdr)));
- /*
- * Now send the Fib to the adapter
-diff --git a/include/net/compat.h b/include/net/compat.h
---- a/include/net/compat.h
-+++ b/include/net/compat.h
-@@ -33,7 +33,8 @@ extern asmlinkage long compat_sys_sendms
- extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
- extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
- extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
--extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *,
-- int);
-+
-+struct sock;
-+extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
-
- #endif /* NET_COMPAT_H */
-diff --git a/net/compat.c b/net/compat.c
---- a/net/compat.c
-+++ b/net/compat.c
-@@ -135,13 +135,14 @@ static inline struct compat_cmsghdr __us
- * thus placement) of cmsg headers and length are different for
- * 32-bit apps. -DaveM
- */
--int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
-+int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
- unsigned char *stackbuf, int stackbuf_size)
- {
- struct compat_cmsghdr __user *ucmsg;
- struct cmsghdr *kcmsg, *kcmsg_base;
- compat_size_t ucmlen;
- __kernel_size_t kcmlen, tmp;
-+ int err = -EFAULT;
-
- kcmlen = 0;
- kcmsg_base = kcmsg = (struct cmsghdr *)stackbuf;
-@@ -156,6 +157,7 @@ int cmsghdr_from_user_compat_to_kern(str
-
- tmp = ((ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg))) +
- CMSG_ALIGN(sizeof(struct cmsghdr)));
-+ tmp = CMSG_ALIGN(tmp);
- kcmlen += tmp;
- ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
- }
-@@ -167,30 +169,34 @@ int cmsghdr_from_user_compat_to_kern(str
- * until we have successfully copied over all of the data
- * from the user.
- */
-- if(kcmlen > stackbuf_size)
-- kcmsg_base = kcmsg = kmalloc(kcmlen, GFP_KERNEL);
-- if(kcmsg == NULL)
-+ if (kcmlen > stackbuf_size)
-+ kcmsg_base = kcmsg = sock_kmalloc(sk, kcmlen, GFP_KERNEL);
-+ if (kcmsg == NULL)
- return -ENOBUFS;
-
- /* Now copy them over neatly. */
- memset(kcmsg, 0, kcmlen);
- ucmsg = CMSG_COMPAT_FIRSTHDR(kmsg);
- while(ucmsg != NULL) {
-- __get_user(ucmlen, &ucmsg->cmsg_len);
-+ if (__get_user(ucmlen, &ucmsg->cmsg_len))
-+ goto Efault;
-+ if (!CMSG_COMPAT_OK(ucmlen, ucmsg, kmsg))
-+ goto Einval;
- tmp = ((ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg))) +
- CMSG_ALIGN(sizeof(struct cmsghdr)));
-+ if ((char *)kcmsg_base + kcmlen - (char *)kcmsg < CMSG_ALIGN(tmp))
-+ goto Einval;
- kcmsg->cmsg_len = tmp;
-- __get_user(kcmsg->cmsg_level, &ucmsg->cmsg_level);
-- __get_user(kcmsg->cmsg_type, &ucmsg->cmsg_type);
--
-- /* Copy over the data. */
-- if(copy_from_user(CMSG_DATA(kcmsg),
-- CMSG_COMPAT_DATA(ucmsg),
-- (ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg)))))
-- goto out_free_efault;
-+ tmp = CMSG_ALIGN(tmp);
-+ if (__get_user(kcmsg->cmsg_level, &ucmsg->cmsg_level) ||
-+ __get_user(kcmsg->cmsg_type, &ucmsg->cmsg_type) ||
-+ copy_from_user(CMSG_DATA(kcmsg),
-+ CMSG_COMPAT_DATA(ucmsg),
-+ (ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg)))))
-+ goto Efault;
-
- /* Advance. */
-- kcmsg = (struct cmsghdr *)((char *)kcmsg + CMSG_ALIGN(tmp));
-+ kcmsg = (struct cmsghdr *)((char *)kcmsg + tmp);
- ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
- }
-
-@@ -199,10 +205,12 @@ int cmsghdr_from_user_compat_to_kern(str
- kmsg->msg_controllen = kcmlen;
- return 0;
-
--out_free_efault:
-- if(kcmsg_base != (struct cmsghdr *)stackbuf)
-- kfree(kcmsg_base);
-- return -EFAULT;
-+Einval:
-+ err = -EINVAL;
-+Efault:
-+ if (kcmsg_base != (struct cmsghdr *)stackbuf)
-+ sock_kfree_s(sk, kcmsg_base, kcmlen);
-+ return err;
- }
-
- int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
-diff --git a/net/core/filter.c b/net/core/filter.c
---- a/net/core/filter.c
-+++ b/net/core/filter.c
-@@ -182,7 +182,7 @@ int sk_run_filter(struct sk_buff *skb, s
- A = ntohl(*(u32 *)ptr);
- continue;
- }
-- return 0;
-+ break;
- case BPF_LD|BPF_H|BPF_ABS:
- k = fentry->k;
- load_h:
-@@ -191,7 +191,7 @@ int sk_run_filter(struct sk_buff *skb, s
- A = ntohs(*(u16 *)ptr);
- continue;
- }
-- return 0;
-+ break;
- case BPF_LD|BPF_B|BPF_ABS:
- k = fentry->k;
- load_b:
-@@ -200,7 +200,7 @@ load_b:
- A = *(u8 *)ptr;
- continue;
- }
-- return 0;
-+ break;
- case BPF_LD|BPF_W|BPF_LEN:
- A = skb->len;
- continue;
-diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
---- a/net/ipv4/ip_fragment.c
-+++ b/net/ipv4/ip_fragment.c
-@@ -457,7 +457,7 @@ static void ip_frag_queue(struct ipq *qp
-
- if (pskb_pull(skb, ihl) == NULL)
- goto err;
-- if (pskb_trim(skb, end-offset))
-+ if (pskb_trim_rcsum(skb, end-offset))
- goto err;
-
- /* Find out which fragments are in front and at the back of us
-diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
---- a/net/ipv4/raw.c
-+++ b/net/ipv4/raw.c
-@@ -358,7 +358,7 @@ static void raw_probe_proto_opt(struct f
-
- if (type && code) {
- get_user(fl->fl_icmp_type, type);
-- __get_user(fl->fl_icmp_code, code);
-+ get_user(fl->fl_icmp_code, code);
- probed = 1;
- }
- break;
-diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
---- a/net/ipv6/raw.c
-+++ b/net/ipv6/raw.c
-@@ -619,7 +619,7 @@ static void rawv6_probe_proto_opt(struct
-
- if (type && code) {
- get_user(fl->fl_icmp_type, type);
-- __get_user(fl->fl_icmp_code, code);
-+ get_user(fl->fl_icmp_code, code);
- probed = 1;
- }
- break;
-diff --git a/net/socket.c b/net/socket.c
---- a/net/socket.c
-+++ b/net/socket.c
-@@ -1739,10 +1739,11 @@ asmlinkage long sys_sendmsg(int fd, stru
- goto out_freeiov;
- ctl_len = msg_sys.msg_controllen;
- if ((MSG_CMSG_COMPAT & flags) && ctl_len) {
-- err = cmsghdr_from_user_compat_to_kern(&msg_sys, ctl, sizeof(ctl));
-+ err = cmsghdr_from_user_compat_to_kern(&msg_sys, sock->sk, ctl, sizeof(ctl));
- if (err)
- goto out_freeiov;
- ctl_buf = msg_sys.msg_control;
-+ ctl_len = msg_sys.msg_controllen;
- } else if (ctl_len) {
- if (ctl_len > sizeof(ctl))
- {
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.2
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.2 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.2 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,328 +0,0 @@
-diff --git a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c
---- a/arch/x86_64/ia32/ia32_ioctl.c
-+++ b/arch/x86_64/ia32/ia32_ioctl.c
-@@ -24,17 +24,26 @@
- static int tiocgdev(unsigned fd, unsigned cmd, unsigned int __user *ptr)
- {
-
-- struct file *file = fget(fd);
-+ struct file *file;
- struct tty_struct *real_tty;
-+ int fput_needed, ret;
-
-+ file = fget_light(fd, &fput_needed);
- if (!file)
- return -EBADF;
-+
-+ ret = -EINVAL;
- if (file->f_op->ioctl != tty_ioctl)
-- return -EINVAL;
-+ goto out;
- real_tty = (struct tty_struct *)file->private_data;
- if (!real_tty)
-- return -EINVAL;
-- return put_user(new_encode_dev(tty_devnum(real_tty)), ptr);
-+ goto out;
-+
-+ ret = put_user(new_encode_dev(tty_devnum(real_tty)), ptr);
-+
-+out:
-+ fput_light(file, fput_needed);
-+ return ret;
- }
-
- #define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */
-diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
---- a/drivers/ide/pci/cmd64x.c
-+++ b/drivers/ide/pci/cmd64x.c
-@@ -608,7 +608,7 @@ static unsigned int __devinit init_chips
-
- #ifdef __i386__
- if (dev->resource[PCI_ROM_RESOURCE].start) {
-- pci_write_config_byte(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-+ pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
- printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
- }
- #endif
-diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
---- a/drivers/ide/pci/hpt34x.c
-+++ b/drivers/ide/pci/hpt34x.c
-@@ -173,7 +173,7 @@ static unsigned int __devinit init_chips
-
- if (cmd & PCI_COMMAND_MEMORY) {
- if (pci_resource_start(dev, PCI_ROM_RESOURCE)) {
-- pci_write_config_byte(dev, PCI_ROM_ADDRESS,
-+ pci_write_config_dword(dev, PCI_ROM_ADDRESS,
- dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
- printk(KERN_INFO "HPT345: ROM enabled at 0x%08lx\n",
- dev->resource[PCI_ROM_RESOURCE].start);
-diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
---- a/drivers/ide/pci/hpt366.c
-+++ b/drivers/ide/pci/hpt366.c
-@@ -1334,9 +1334,13 @@ static int __devinit init_hpt366(struct
- static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const char *name)
- {
- int ret = 0;
-- /* FIXME: Not portable */
-+
-+ /*
-+ * FIXME: Not portable. Also, why do we enable the ROM in the first place?
-+ * We don't seem to be using it.
-+ */
- if (dev->resource[PCI_ROM_RESOURCE].start)
-- pci_write_config_byte(dev, PCI_ROM_ADDRESS,
-+ pci_write_config_dword(dev, PCI_ROM_ADDRESS,
- dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-
- pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4));
-diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
---- a/drivers/net/forcedeth.c
-+++ b/drivers/net/forcedeth.c
-@@ -1888,6 +1888,9 @@ static int nv_open(struct net_device *de
- writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus);
- dprintk(KERN_INFO "startup: got 0x%08x.\n", miistat);
- }
-+ /* set linkspeed to invalid value, thus force nv_update_linkspeed
-+ * to init hw */
-+ np->linkspeed = 0;
- ret = nv_update_linkspeed(dev);
- nv_start_rx(dev);
- nv_start_tx(dev);
-diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
---- a/drivers/net/sungem.c
-+++ b/drivers/net/sungem.c
-@@ -2816,7 +2816,7 @@ static int gem_ioctl(struct net_device *
-
- #if (!defined(__sparc__) && !defined(CONFIG_PPC_PMAC))
- /* Fetch MAC address from vital product data of PCI ROM. */
--static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr)
-+static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr)
- {
- int this_offset;
-
-@@ -2837,35 +2837,27 @@ static void find_eth_addr_in_vpd(void __
-
- for (i = 0; i < 6; i++)
- dev_addr[i] = readb(p + i);
-- break;
-+ return 1;
- }
-+ return 0;
- }
-
- static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr)
- {
-- u32 rom_reg_orig;
-- void __iomem *p;
--
-- if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) {
-- if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0)
-- goto use_random;
-- }
--
-- pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_reg_orig);
-- pci_write_config_dword(pdev, pdev->rom_base_reg,
-- rom_reg_orig | PCI_ROM_ADDRESS_ENABLE);
-+ size_t size;
-+ void __iomem *p = pci_map_rom(pdev, &size);
-
-- p = ioremap(pci_resource_start(pdev, PCI_ROM_RESOURCE), (64 * 1024));
-- if (p != NULL && readb(p) == 0x55 && readb(p + 1) == 0xaa)
-- find_eth_addr_in_vpd(p, (64 * 1024), dev_addr);
-+ if (p) {
-+ int found;
-
-- if (p != NULL)
-- iounmap(p);
--
-- pci_write_config_dword(pdev, pdev->rom_base_reg, rom_reg_orig);
-- return;
-+ found = readb(p) == 0x55 &&
-+ readb(p + 1) == 0xaa &&
-+ find_eth_addr_in_vpd(p, (64 * 1024), dev_addr);
-+ pci_unmap_rom(pdev, p);
-+ if (found)
-+ return;
-+ }
-
--use_random:
- /* Sun MAC prefix then 3 random bytes. */
- dev_addr[0] = 0x08;
- dev_addr[1] = 0x00;
-diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
---- a/drivers/net/sunhme.c
-+++ b/drivers/net/sunhme.c
-@@ -2954,7 +2954,7 @@ static int is_quattro_p(struct pci_dev *
- }
-
- /* Fetch MAC address from vital product data of PCI ROM. */
--static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr)
-+static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr)
- {
- int this_offset;
-
-@@ -2977,42 +2977,33 @@ static void find_eth_addr_in_vpd(void __
-
- for (i = 0; i < 6; i++)
- dev_addr[i] = readb(p + i);
-- break;
-+ return 1;
- }
- index--;
- }
-+ return 0;
- }
-
- static void get_hme_mac_nonsparc(struct pci_dev *pdev, unsigned char *dev_addr)
- {
-- u32 rom_reg_orig;
-- void __iomem *p;
-- int index;
-+ size_t size;
-+ void __iomem *p = pci_map_rom(pdev, &size);
-
-- index = 0;
-- if (is_quattro_p(pdev))
-- index = PCI_SLOT(pdev->devfn);
--
-- if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) {
-- if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0)
-- goto use_random;
-+ if (p) {
-+ int index = 0;
-+ int found;
-+
-+ if (is_quattro_p(pdev))
-+ index = PCI_SLOT(pdev->devfn);
-+
-+ found = readb(p) == 0x55 &&
-+ readb(p + 1) == 0xaa &&
-+ find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr);
-+ pci_unmap_rom(pdev, p);
-+ if (found)
-+ return;
- }
-
-- pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_reg_orig);
-- pci_write_config_dword(pdev, pdev->rom_base_reg,
-- rom_reg_orig | PCI_ROM_ADDRESS_ENABLE);
--
-- p = ioremap(pci_resource_start(pdev, PCI_ROM_RESOURCE), (64 * 1024));
-- if (p != NULL && readb(p) == 0x55 && readb(p + 1) == 0xaa)
-- find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr);
--
-- if (p != NULL)
-- iounmap(p);
--
-- pci_write_config_dword(pdev, pdev->rom_base_reg, rom_reg_orig);
-- return;
--
--use_random:
- /* Sun MAC prefix then 3 random bytes. */
- dev_addr[0] = 0x08;
- dev_addr[1] = 0x00;
-diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
---- a/drivers/usb/serial/ftdi_sio.c
-+++ b/drivers/usb/serial/ftdi_sio.c
-@@ -874,7 +874,7 @@ static void ftdi_determine_type(struct u
- unsigned interfaces;
-
- /* Assume it is not the original SIO device for now. */
-- priv->baud_base = 48000000 / 16;
-+ priv->baud_base = 48000000 / 2;
- priv->write_offset = 0;
-
- version = le16_to_cpu(udev->descriptor.bcdDevice);
-diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
---- a/fs/compat_ioctl.c
-+++ b/fs/compat_ioctl.c
-@@ -798,13 +798,16 @@ static int routing_ioctl(unsigned int fd
- r = (void *) &r4;
- }
-
-- if (ret)
-- return -EFAULT;
-+ if (ret) {
-+ ret = -EFAULT;
-+ goto out;
-+ }
-
- set_fs (KERNEL_DS);
- ret = sys_ioctl (fd, cmd, (unsigned long) r);
- set_fs (old_fs);
-
-+out:
- if (mysock)
- sockfd_put(mysock);
-
-diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
---- a/fs/jfs/inode.c
-+++ b/fs/jfs/inode.c
-@@ -128,21 +128,21 @@ void jfs_delete_inode(struct inode *inod
- {
- jfs_info("In jfs_delete_inode, inode = 0x%p", inode);
-
-- if (is_bad_inode(inode) ||
-- (JFS_IP(inode)->fileset != cpu_to_le32(FILESYSTEM_I)))
-- return;
-+ if (!is_bad_inode(inode) &&
-+ (JFS_IP(inode)->fileset == cpu_to_le32(FILESYSTEM_I))) {
-
-- if (test_cflag(COMMIT_Freewmap, inode))
-- jfs_free_zero_link(inode);
-+ if (test_cflag(COMMIT_Freewmap, inode))
-+ jfs_free_zero_link(inode);
-
-- diFree(inode);
-+ diFree(inode);
-
-- /*
-- * Free the inode from the quota allocation.
-- */
-- DQUOT_INIT(inode);
-- DQUOT_FREE_INODE(inode);
-- DQUOT_DROP(inode);
-+ /*
-+ * Free the inode from the quota allocation.
-+ */
-+ DQUOT_INIT(inode);
-+ DQUOT_FREE_INODE(inode);
-+ DQUOT_DROP(inode);
-+ }
-
- clear_inode(inode);
- }
-diff --git a/mm/mempolicy.c b/mm/mempolicy.c
---- a/mm/mempolicy.c
-+++ b/mm/mempolicy.c
-@@ -333,8 +333,13 @@ check_range(struct mm_struct *mm, unsign
- if (prev && prev->vm_end < vma->vm_start)
- return ERR_PTR(-EFAULT);
- if ((flags & MPOL_MF_STRICT) && !is_vm_hugetlb_page(vma)) {
-+ unsigned long endvma = vma->vm_end;
-+ if (endvma > end)
-+ endvma = end;
-+ if (vma->vm_start > start)
-+ start = vma->vm_start;
- err = check_pgd_range(vma->vm_mm,
-- vma->vm_start, vma->vm_end, nodes);
-+ start, endvma, nodes);
- if (err) {
- first = ERR_PTR(err);
- break;
-diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c
---- a/net/ipv4/netfilter/ipt_MASQUERADE.c
-+++ b/net/ipv4/netfilter/ipt_MASQUERADE.c
-@@ -95,6 +95,12 @@ masquerade_target(struct sk_buff **pskb,
- IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED
- || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
-
-+ /* Source address is 0.0.0.0 - locally generated packet that is
-+ * probably not supposed to be masqueraded.
-+ */
-+ if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip == 0)
-+ return NF_ACCEPT;
-+
- mr = targinfo;
- rt = (struct rtable *)(*pskb)->dst;
- newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE);
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.3
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.3 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.3 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,420 +0,0 @@
-diff --git a/arch/um/kernel/skas/include/mmu-skas.h b/arch/um/kernel/skas/include/mmu-skas.h
---- a/arch/um/kernel/skas/include/mmu-skas.h
-+++ b/arch/um/kernel/skas/include/mmu-skas.h
-@@ -6,11 +6,15 @@
- #ifndef __SKAS_MMU_H
- #define __SKAS_MMU_H
-
-+#include "linux/config.h"
- #include "mm_id.h"
-
- struct mmu_context_skas {
- struct mm_id id;
- unsigned long last_page_table;
-+#ifdef CONFIG_3_LEVEL_PGTABLES
-+ unsigned long last_pmd;
-+#endif
- };
-
- extern void switch_mm_skas(struct mm_id * mm_idp);
-diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
---- a/arch/um/kernel/skas/mmu.c
-+++ b/arch/um/kernel/skas/mmu.c
-@@ -56,6 +56,9 @@ static int init_stub_pte(struct mm_struc
- */
-
- mm->context.skas.last_page_table = pmd_page_kernel(*pmd);
-+#ifdef CONFIG_3_LEVEL_PGTABLES
-+ mm->context.skas.last_pmd = (unsigned long) __va(pud_val(*pud));
-+#endif
-
- *pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT));
- *pte = pte_mkexec(*pte);
-@@ -140,6 +143,10 @@ void destroy_context_skas(struct mm_stru
- else {
- os_kill_ptraced_process(mmu->id.u.pid, 1);
- free_page(mmu->id.stack);
-- free_page(mmu->last_page_table);
-+ pte_free_kernel((pte_t *) mmu->last_page_table);
-+ dec_page_state(nr_page_table_pages);
-+#ifdef CONFIG_3_LEVEL_PGTABLES
-+ pmd_free((pmd_t *) mmu->last_pmd);
-+#endif
- }
- }
-diff --git a/drivers/net/skge.c b/drivers/net/skge.c
---- a/drivers/net/skge.c
-+++ b/drivers/net/skge.c
-@@ -2828,21 +2828,29 @@ static void skge_netpoll(struct net_devi
- static int skge_set_mac_address(struct net_device *dev, void *p)
- {
- struct skge_port *skge = netdev_priv(dev);
-- struct sockaddr *addr = p;
-- int err = 0;
-+ struct skge_hw *hw = skge->hw;
-+ unsigned port = skge->port;
-+ const struct sockaddr *addr = p;
-
- if (!is_valid_ether_addr(addr->sa_data))
- return -EADDRNOTAVAIL;
-
-- skge_down(dev);
-+ spin_lock_bh(&hw->phy_lock);
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-- memcpy_toio(skge->hw->regs + B2_MAC_1 + skge->port*8,
-+ memcpy_toio(hw->regs + B2_MAC_1 + port*8,
- dev->dev_addr, ETH_ALEN);
-- memcpy_toio(skge->hw->regs + B2_MAC_2 + skge->port*8,
-+ memcpy_toio(hw->regs + B2_MAC_2 + port*8,
- dev->dev_addr, ETH_ALEN);
-- if (dev->flags & IFF_UP)
-- err = skge_up(dev);
-- return err;
-+
-+ if (hw->chip_id == CHIP_ID_GENESIS)
-+ xm_outaddr(hw, port, XM_SA, dev->dev_addr);
-+ else {
-+ gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr);
-+ gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr);
-+ }
-+ spin_unlock_bh(&hw->phy_lock);
-+
-+ return 0;
- }
-
- static const struct {
-diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
---- a/drivers/pcmcia/yenta_socket.c
-+++ b/drivers/pcmcia/yenta_socket.c
-@@ -976,7 +976,18 @@ static int __devinit yenta_probe (struct
- {
- struct yenta_socket *socket;
- int ret;
--
-+
-+ /*
-+ * If we failed to assign proper bus numbers for this cardbus
-+ * controller during PCI probe, its subordinate pci_bus is NULL.
-+ * Bail out if so.
-+ */
-+ if (!dev->subordinate) {
-+ printk(KERN_ERR "Yenta: no bus associated with %s! "
-+ "(try 'pci=assign-busses')\n", pci_name(dev));
-+ return -ENODEV;
-+ }
-+
- socket = kmalloc(sizeof(struct yenta_socket), GFP_KERNEL);
- if (!socket)
- return -ENOMEM;
-diff --git a/fs/exec.c b/fs/exec.c
---- a/fs/exec.c
-+++ b/fs/exec.c
-@@ -745,8 +745,8 @@ static inline int de_thread(struct task_
- }
-
- /*
-- * Now there are really no other threads at all,
-- * so it's safe to stop telling them to kill themselves.
-+ * There may be one thread left which is just exiting,
-+ * but it's safe to stop telling the group to kill themselves.
- */
- sig->flags = 0;
-
-@@ -785,7 +785,6 @@ no_thread_group:
- kmem_cache_free(sighand_cachep, oldsighand);
- }
-
-- BUG_ON(!thread_group_empty(current));
- BUG_ON(!thread_group_leader(current));
- return 0;
- }
-diff --git a/include/asm-um/pgalloc.h b/include/asm-um/pgalloc.h
---- a/include/asm-um/pgalloc.h
-+++ b/include/asm-um/pgalloc.h
-@@ -42,11 +42,13 @@ static inline void pte_free(struct page
- #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
-
- #ifdef CONFIG_3_LEVEL_PGTABLES
--/*
-- * In the 3-level case we free the pmds as part of the pgd.
-- */
--#define pmd_free(x) do { } while (0)
--#define __pmd_free_tlb(tlb,x) do { } while (0)
-+
-+extern __inline__ void pmd_free(pmd_t *pmd)
-+{
-+ free_page((unsigned long)pmd);
-+}
-+
-+#define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
- #endif
-
- #define check_pgt_cache() do { } while (0)
-diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h
---- a/include/asm-um/pgtable-3level.h
-+++ b/include/asm-um/pgtable-3level.h
-@@ -98,14 +98,11 @@ static inline pmd_t *pmd_alloc_one(struc
- return pmd;
- }
-
--static inline void pmd_free(pmd_t *pmd){
-- free_page((unsigned long) pmd);
-+extern inline void pud_clear (pud_t *pud)
-+{
-+ set_pud(pud, __pud(0));
- }
-
--#define __pmd_free_tlb(tlb,x) do { } while (0)
--
--static inline void pud_clear (pud_t * pud) { }
--
- #define pud_page(pud) \
- ((struct page *) __va(pud_val(pud) & PAGE_MASK))
-
-diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
---- a/include/net/ip_vs.h
-+++ b/include/net/ip_vs.h
-@@ -84,6 +84,7 @@
- #define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
- #define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
- #define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
-+#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
-
- /* Move it to better place one day, for now keep it unique */
- #define NFC_IPVS_PROPERTY 0x10000
-@@ -740,6 +741,8 @@ enum {
-
- extern struct ip_vs_conn *ip_vs_conn_in_get
- (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
-+extern struct ip_vs_conn *ip_vs_ct_in_get
-+(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
- extern struct ip_vs_conn *ip_vs_conn_out_get
- (int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
-
-diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
---- a/net/ipv4/ipvs/ip_vs_conn.c
-+++ b/net/ipv4/ipvs/ip_vs_conn.c
-@@ -196,6 +196,7 @@ static inline struct ip_vs_conn *__ip_vs
- list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) {
- if (s_addr==cp->caddr && s_port==cp->cport &&
- d_port==cp->vport && d_addr==cp->vaddr &&
-+ ((!s_port) ^ (!(cp->flags & IP_VS_CONN_F_NO_CPORT))) &&
- protocol==cp->protocol) {
- /* HIT */
- atomic_inc(&cp->refcnt);
-@@ -227,6 +228,40 @@ struct ip_vs_conn *ip_vs_conn_in_get
- return cp;
- }
-
-+/* Get reference to connection template */
-+struct ip_vs_conn *ip_vs_ct_in_get
-+(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
-+{
-+ unsigned hash;
-+ struct ip_vs_conn *cp;
-+
-+ hash = ip_vs_conn_hashkey(protocol, s_addr, s_port);
-+
-+ ct_read_lock(hash);
-+
-+ list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) {
-+ if (s_addr==cp->caddr && s_port==cp->cport &&
-+ d_port==cp->vport && d_addr==cp->vaddr &&
-+ cp->flags & IP_VS_CONN_F_TEMPLATE &&
-+ protocol==cp->protocol) {
-+ /* HIT */
-+ atomic_inc(&cp->refcnt);
-+ goto out;
-+ }
-+ }
-+ cp = NULL;
-+
-+ out:
-+ ct_read_unlock(hash);
-+
-+ IP_VS_DBG(7, "template lookup/in %s %u.%u.%u.%u:%d->%u.%u.%u.%u:%d %s\n",
-+ ip_vs_proto_name(protocol),
-+ NIPQUAD(s_addr), ntohs(s_port),
-+ NIPQUAD(d_addr), ntohs(d_port),
-+ cp?"hit":"not hit");
-+
-+ return cp;
-+}
-
- /*
- * Gets ip_vs_conn associated with supplied parameters in the ip_vs_conn_tab.
-@@ -367,7 +402,7 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, s
- atomic_read(&dest->refcnt));
-
- /* Update the connection counters */
-- if (cp->cport || (cp->flags & IP_VS_CONN_F_NO_CPORT)) {
-+ if (!(cp->flags & IP_VS_CONN_F_TEMPLATE)) {
- /* It is a normal connection, so increase the inactive
- connection counter because it is in TCP SYNRECV
- state (inactive) or other protocol inacive state */
-@@ -406,7 +441,7 @@ static inline void ip_vs_unbind_dest(str
- atomic_read(&dest->refcnt));
-
- /* Update the connection counters */
-- if (cp->cport || (cp->flags & IP_VS_CONN_F_NO_CPORT)) {
-+ if (!(cp->flags & IP_VS_CONN_F_TEMPLATE)) {
- /* It is a normal connection, so decrease the inactconns
- or activeconns counter */
- if (cp->flags & IP_VS_CONN_F_INACTIVE) {
-@@ -776,7 +811,7 @@ void ip_vs_random_dropentry(void)
- ct_write_lock_bh(hash);
-
- list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) {
-- if (!cp->cport && !(cp->flags & IP_VS_CONN_F_NO_CPORT))
-+ if (cp->flags & IP_VS_CONN_F_TEMPLATE)
- /* connection template */
- continue;
-
-diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c
---- a/net/ipv4/ipvs/ip_vs_core.c
-+++ b/net/ipv4/ipvs/ip_vs_core.c
-@@ -242,10 +242,10 @@ ip_vs_sched_persist(struct ip_vs_service
- if (ports[1] == svc->port) {
- /* Check if a template already exists */
- if (svc->port != FTPPORT)
-- ct = ip_vs_conn_in_get(iph->protocol, snet, 0,
-+ ct = ip_vs_ct_in_get(iph->protocol, snet, 0,
- iph->daddr, ports[1]);
- else
-- ct = ip_vs_conn_in_get(iph->protocol, snet, 0,
-+ ct = ip_vs_ct_in_get(iph->protocol, snet, 0,
- iph->daddr, 0);
-
- if (!ct || !ip_vs_check_template(ct)) {
-@@ -271,14 +271,14 @@ ip_vs_sched_persist(struct ip_vs_service
- iph->daddr,
- ports[1],
- dest->addr, dest->port,
-- 0,
-+ IP_VS_CONN_F_TEMPLATE,
- dest);
- else
- ct = ip_vs_conn_new(iph->protocol,
- snet, 0,
- iph->daddr, 0,
- dest->addr, 0,
-- 0,
-+ IP_VS_CONN_F_TEMPLATE,
- dest);
- if (ct == NULL)
- return NULL;
-@@ -297,10 +297,10 @@ ip_vs_sched_persist(struct ip_vs_service
- * port zero template: <protocol,caddr,0,vaddr,0,daddr,0>
- */
- if (svc->fwmark)
-- ct = ip_vs_conn_in_get(IPPROTO_IP, snet, 0,
-+ ct = ip_vs_ct_in_get(IPPROTO_IP, snet, 0,
- htonl(svc->fwmark), 0);
- else
-- ct = ip_vs_conn_in_get(iph->protocol, snet, 0,
-+ ct = ip_vs_ct_in_get(iph->protocol, snet, 0,
- iph->daddr, 0);
-
- if (!ct || !ip_vs_check_template(ct)) {
-@@ -325,14 +325,14 @@ ip_vs_sched_persist(struct ip_vs_service
- snet, 0,
- htonl(svc->fwmark), 0,
- dest->addr, 0,
-- 0,
-+ IP_VS_CONN_F_TEMPLATE,
- dest);
- else
- ct = ip_vs_conn_new(iph->protocol,
- snet, 0,
- iph->daddr, 0,
- dest->addr, 0,
-- 0,
-+ IP_VS_CONN_F_TEMPLATE,
- dest);
- if (ct == NULL)
- return NULL;
-diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
---- a/net/ipv4/ipvs/ip_vs_sync.c
-+++ b/net/ipv4/ipvs/ip_vs_sync.c
-@@ -297,16 +297,24 @@ static void ip_vs_process_message(const
-
- p = (char *)buffer + sizeof(struct ip_vs_sync_mesg);
- for (i=0; i<m->nr_conns; i++) {
-+ unsigned flags;
-+
- s = (struct ip_vs_sync_conn *)p;
-- cp = ip_vs_conn_in_get(s->protocol,
-- s->caddr, s->cport,
-- s->vaddr, s->vport);
-+ flags = ntohs(s->flags);
-+ if (!(flags & IP_VS_CONN_F_TEMPLATE))
-+ cp = ip_vs_conn_in_get(s->protocol,
-+ s->caddr, s->cport,
-+ s->vaddr, s->vport);
-+ else
-+ cp = ip_vs_ct_in_get(s->protocol,
-+ s->caddr, s->cport,
-+ s->vaddr, s->vport);
- if (!cp) {
- cp = ip_vs_conn_new(s->protocol,
- s->caddr, s->cport,
- s->vaddr, s->vport,
- s->daddr, s->dport,
-- ntohs(s->flags), NULL);
-+ flags, NULL);
- if (!cp) {
- IP_VS_ERR("ip_vs_conn_new failed\n");
- return;
-@@ -315,11 +323,11 @@ static void ip_vs_process_message(const
- } else if (!cp->dest) {
- /* it is an entry created by the synchronization */
- cp->state = ntohs(s->state);
-- cp->flags = ntohs(s->flags) | IP_VS_CONN_F_HASHED;
-+ cp->flags = flags | IP_VS_CONN_F_HASHED;
- } /* Note that we don't touch its state and flags
- if it is a normal entry. */
-
-- if (ntohs(s->flags) & IP_VS_CONN_F_SEQ_MASK) {
-+ if (flags & IP_VS_CONN_F_SEQ_MASK) {
- opt = (struct ip_vs_sync_conn_options *)&s[1];
- memcpy(&cp->in_seq, opt, sizeof(*opt));
- p += FULL_CONN_SIZE;
-diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
---- a/net/ipv4/tcp_input.c
-+++ b/net/ipv4/tcp_input.c
-@@ -350,8 +350,6 @@ static void tcp_clamp_window(struct sock
- app_win -= tp->ack.rcv_mss;
- app_win = max(app_win, 2U*tp->advmss);
-
-- if (!ofo_win)
-- tp->window_clamp = min(tp->window_clamp, app_win);
- tp->rcv_ssthresh = min(tp->window_clamp, 2U*tp->advmss);
- }
- }
-diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
---- a/net/ipv4/tcp_minisocks.c
-+++ b/net/ipv4/tcp_minisocks.c
-@@ -774,7 +774,7 @@ struct sock *tcp_create_openreq_child(st
- newtp->frto_counter = 0;
- newtp->frto_highmark = 0;
-
-- newtp->ca_ops = &tcp_reno;
-+ newtp->ca_ops = &tcp_init_congestion_ops;
-
- tcp_set_ca_state(newtp, TCP_CA_Open);
- tcp_init_xmit_timers(newsk);
-diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
---- a/net/ipv6/udp.c
-+++ b/net/ipv6/udp.c
-@@ -404,9 +404,8 @@ static struct sock *udp_v6_mcast_next(st
- continue;
-
- if (!ipv6_addr_any(&np->rcv_saddr)) {
-- if (ipv6_addr_equal(&np->rcv_saddr, loc_addr))
-- return s;
-- continue;
-+ if (!ipv6_addr_equal(&np->rcv_saddr, loc_addr))
-+ continue;
- }
- if(!inet6_mc_check(s, loc_addr, rmt_addr))
- continue;
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.4
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.4 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/patch-2.6.13.4 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,369 +0,0 @@
-diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
---- a/arch/sparc64/kernel/entry.S
-+++ b/arch/sparc64/kernel/entry.S
-@@ -186,7 +186,7 @@ vmalloc_addr:
- /* This is trivial with the new code... */
- .globl do_fpdis
- do_fpdis:
-- sethi %hi(TSTATE_PEF), %g4 ! IEU0
-+ sethi %hi(TSTATE_PEF), %g4
- rdpr %tstate, %g5
- andcc %g5, %g4, %g0
- be,pt %xcc, 1f
-@@ -203,18 +203,18 @@ do_fpdis:
- add %g0, %g0, %g0
- ba,a,pt %xcc, rtrap_clr_l6
-
--1: ldub [%g6 + TI_FPSAVED], %g5 ! Load Group
-- wr %g0, FPRS_FEF, %fprs ! LSU Group+4bubbles
-- andcc %g5, FPRS_FEF, %g0 ! IEU1 Group
-- be,a,pt %icc, 1f ! CTI
-- clr %g7 ! IEU0
-- ldx [%g6 + TI_GSR], %g7 ! Load Group
--1: andcc %g5, FPRS_DL, %g0 ! IEU1
-- bne,pn %icc, 2f ! CTI
-- fzero %f0 ! FPA
-- andcc %g5, FPRS_DU, %g0 ! IEU1 Group
-- bne,pn %icc, 1f ! CTI
-- fzero %f2 ! FPA
-+1: ldub [%g6 + TI_FPSAVED], %g5
-+ wr %g0, FPRS_FEF, %fprs
-+ andcc %g5, FPRS_FEF, %g0
-+ be,a,pt %icc, 1f
-+ clr %g7
-+ ldx [%g6 + TI_GSR], %g7
-+1: andcc %g5, FPRS_DL, %g0
-+ bne,pn %icc, 2f
-+ fzero %f0
-+ andcc %g5, FPRS_DU, %g0
-+ bne,pn %icc, 1f
-+ fzero %f2
- faddd %f0, %f2, %f4
- fmuld %f0, %f2, %f6
- faddd %f0, %f2, %f8
-@@ -257,8 +257,10 @@ cplus_fptrap_insn_1:
- add %g6, TI_FPREGS + 0xc0, %g2
- faddd %f0, %f2, %f8
- fmuld %f0, %f2, %f10
-- ldda [%g1] ASI_BLK_S, %f32 ! grrr, where is ASI_BLK_NUCLEUS 8-(
-+ membar #Sync
-+ ldda [%g1] ASI_BLK_S, %f32
- ldda [%g2] ASI_BLK_S, %f48
-+ membar #Sync
- faddd %f0, %f2, %f12
- fmuld %f0, %f2, %f14
- faddd %f0, %f2, %f16
-@@ -269,7 +271,6 @@ cplus_fptrap_insn_1:
- fmuld %f0, %f2, %f26
- faddd %f0, %f2, %f28
- fmuld %f0, %f2, %f30
-- membar #Sync
- b,pt %xcc, fpdis_exit
- nop
- 2: andcc %g5, FPRS_DU, %g0
-@@ -286,8 +287,10 @@ cplus_fptrap_insn_2:
- add %g6, TI_FPREGS + 0x40, %g2
- faddd %f32, %f34, %f36
- fmuld %f32, %f34, %f38
-- ldda [%g1] ASI_BLK_S, %f0 ! grrr, where is ASI_BLK_NUCLEUS 8-(
-+ membar #Sync
-+ ldda [%g1] ASI_BLK_S, %f0
- ldda [%g2] ASI_BLK_S, %f16
-+ membar #Sync
- faddd %f32, %f34, %f40
- fmuld %f32, %f34, %f42
- faddd %f32, %f34, %f44
-@@ -300,7 +303,6 @@ cplus_fptrap_insn_2:
- fmuld %f32, %f34, %f58
- faddd %f32, %f34, %f60
- fmuld %f32, %f34, %f62
-- membar #Sync
- ba,pt %xcc, fpdis_exit
- nop
- 3: mov SECONDARY_CONTEXT, %g3
-@@ -311,7 +313,8 @@ cplus_fptrap_insn_3:
- stxa %g2, [%g3] ASI_DMMU
- membar #Sync
- mov 0x40, %g2
-- ldda [%g1] ASI_BLK_S, %f0 ! grrr, where is ASI_BLK_NUCLEUS 8-(
-+ membar #Sync
-+ ldda [%g1] ASI_BLK_S, %f0
- ldda [%g1 + %g2] ASI_BLK_S, %f16
- add %g1, 0x80, %g1
- ldda [%g1] ASI_BLK_S, %f32
-diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S
---- a/arch/sparc64/kernel/rtrap.S
-+++ b/arch/sparc64/kernel/rtrap.S
-@@ -310,32 +310,33 @@ kern_fpucheck: ldub [%g6 + TI_FPDEPTH]
- wr %g1, FPRS_FEF, %fprs
- ldx [%o1 + %o5], %g1
- add %g6, TI_XFSR, %o1
-- membar #StoreLoad | #LoadLoad
- sll %o0, 8, %o2
- add %g6, TI_FPREGS, %o3
- brz,pn %l6, 1f
- add %g6, TI_FPREGS+0x40, %o4
-
-+ membar #Sync
- ldda [%o3 + %o2] ASI_BLK_P, %f0
- ldda [%o4 + %o2] ASI_BLK_P, %f16
-+ membar #Sync
- 1: andcc %l2, FPRS_DU, %g0
- be,pn %icc, 1f
- wr %g1, 0, %gsr
- add %o2, 0x80, %o2
-+ membar #Sync
- ldda [%o3 + %o2] ASI_BLK_P, %f32
- ldda [%o4 + %o2] ASI_BLK_P, %f48
--
- 1: membar #Sync
- ldx [%o1 + %o5], %fsr
- 2: stb %l5, [%g6 + TI_FPDEPTH]
- ba,pt %xcc, rt_continue
- nop
- 5: wr %g0, FPRS_FEF, %fprs
-- membar #StoreLoad | #LoadLoad
- sll %o0, 8, %o2
-
- add %g6, TI_FPREGS+0x80, %o3
- add %g6, TI_FPREGS+0xc0, %o4
-+ membar #Sync
- ldda [%o3 + %o2] ASI_BLK_P, %f32
- ldda [%o4 + %o2] ASI_BLK_P, %f48
- membar #Sync
-diff --git a/arch/sparc64/lib/VISsave.S b/arch/sparc64/lib/VISsave.S
---- a/arch/sparc64/lib/VISsave.S
-+++ b/arch/sparc64/lib/VISsave.S
-@@ -59,15 +59,17 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3
- be,pn %icc, 9b
- add %g6, TI_FPREGS, %g2
- andcc %o5, FPRS_DL, %g0
-- membar #StoreStore | #LoadStore
-
- be,pn %icc, 4f
- add %g6, TI_FPREGS+0x40, %g3
-+ membar #Sync
- stda %f0, [%g2 + %g1] ASI_BLK_P
- stda %f16, [%g3 + %g1] ASI_BLK_P
-+ membar #Sync
- andcc %o5, FPRS_DU, %g0
- be,pn %icc, 5f
- 4: add %g1, 128, %g1
-+ membar #Sync
- stda %f32, [%g2 + %g1] ASI_BLK_P
-
- stda %f48, [%g3 + %g1] ASI_BLK_P
-@@ -87,7 +89,7 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3
- sll %g1, 5, %g1
- add %g6, TI_FPREGS+0xc0, %g3
- wr %g0, FPRS_FEF, %fprs
-- membar #StoreStore | #LoadStore
-+ membar #Sync
- stda %f32, [%g2 + %g1] ASI_BLK_P
- stda %f48, [%g3 + %g1] ASI_BLK_P
- membar #Sync
-@@ -128,8 +130,8 @@ VISenterhalf:
- be,pn %icc, 4f
- add %g6, TI_FPREGS, %g2
-
-- membar #StoreStore | #LoadStore
- add %g6, TI_FPREGS+0x40, %g3
-+ membar #Sync
- stda %f0, [%g2 + %g1] ASI_BLK_P
- stda %f16, [%g3 + %g1] ASI_BLK_P
- membar #Sync
-diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c
---- a/drivers/char/drm/drm_stub.c
-+++ b/drivers/char/drm/drm_stub.c
-@@ -47,7 +47,7 @@ MODULE_PARM_DESC(cards_limit, "Maximum n
- MODULE_PARM_DESC(debug, "Enable debug output");
-
- module_param_named(cards_limit, drm_cards_limit, int, 0444);
--module_param_named(debug, drm_debug, int, 0666);
-+module_param_named(debug, drm_debug, int, 0600);
-
- drm_head_t **drm_heads;
- struct drm_sysfs_class *drm_class;
-diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
---- a/drivers/ieee1394/sbp2.c
-+++ b/drivers/ieee1394/sbp2.c
-@@ -596,6 +596,11 @@ static void sbp2util_mark_command_comple
- spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
- }
-
-+static inline int sbp2util_node_is_available(struct scsi_id_instance_data *scsi_id)
-+{
-+ return scsi_id && scsi_id->ne && !scsi_id->ne->in_limbo;
-+}
-+
-
-
- /*********************************************
-@@ -631,11 +636,23 @@ static int sbp2_remove(struct device *de
- {
- struct unit_directory *ud;
- struct scsi_id_instance_data *scsi_id;
-+ struct scsi_device *sdev;
-
- SBP2_DEBUG("sbp2_remove");
-
- ud = container_of(dev, struct unit_directory, device);
- scsi_id = ud->device.driver_data;
-+ if (!scsi_id)
-+ return 0;
-+
-+ /* Trigger shutdown functions in scsi's highlevel. */
-+ if (scsi_id->scsi_host)
-+ scsi_unblock_requests(scsi_id->scsi_host);
-+ sdev = scsi_id->sdev;
-+ if (sdev) {
-+ scsi_id->sdev = NULL;
-+ scsi_remove_device(sdev);
-+ }
-
- sbp2_logout_device(scsi_id);
- sbp2_remove_device(scsi_id);
-@@ -944,6 +961,7 @@ alloc_fail:
- SBP2_ERR("scsi_add_device failed");
- return PTR_ERR(sdev);
- }
-+ scsi_device_put(sdev);
-
- return 0;
- }
-@@ -2480,7 +2498,7 @@ static int sbp2scsi_queuecommand(struct
- * If scsi_id is null, it means there is no device in this slot,
- * so we should return selection timeout.
- */
-- if (!scsi_id) {
-+ if (!sbp2util_node_is_available(scsi_id)) {
- SCpnt->result = DID_NO_CONNECT << 16;
- done (SCpnt);
- return 0;
-@@ -2683,6 +2701,18 @@ static void sbp2scsi_complete_command(st
- }
-
-
-+static int sbp2scsi_slave_alloc(struct scsi_device *sdev)
-+{
-+ ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = sdev;
-+ return 0;
-+}
-+
-+static void sbp2scsi_slave_destroy(struct scsi_device *sdev)
-+{
-+ ((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = NULL;
-+ return;
-+}
-+
- static int sbp2scsi_slave_configure (struct scsi_device *sdev)
- {
- blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
-@@ -2705,7 +2735,7 @@ static int sbp2scsi_abort(struct scsi_cm
- SBP2_ERR("aborting sbp2 command");
- scsi_print_command(SCpnt);
-
-- if (scsi_id) {
-+ if (sbp2util_node_is_available(scsi_id)) {
-
- /*
- * Right now, just return any matching command structures
-@@ -2749,7 +2779,7 @@ static int __sbp2scsi_reset(struct scsi_
-
- SBP2_ERR("reset requested");
-
-- if (scsi_id) {
-+ if (sbp2util_node_is_available(scsi_id)) {
- SBP2_ERR("Generating sbp2 fetch agent reset");
- sbp2_agent_reset(scsi_id, 0);
- }
-@@ -2817,7 +2847,9 @@ static struct scsi_host_template scsi_dr
- .eh_device_reset_handler = sbp2scsi_reset,
- .eh_bus_reset_handler = sbp2scsi_reset,
- .eh_host_reset_handler = sbp2scsi_reset,
-+ .slave_alloc = sbp2scsi_slave_alloc,
- .slave_configure = sbp2scsi_slave_configure,
-+ .slave_destroy = sbp2scsi_slave_destroy,
- .this_id = -1,
- .sg_tablesize = SG_ALL,
- .use_clustering = ENABLE_CLUSTERING,
-diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
---- a/drivers/net/wireless/orinoco.c
-+++ b/drivers/net/wireless/orinoco.c
-@@ -502,9 +502,14 @@ static int orinoco_xmit(struct sk_buff *
- return 0;
- }
-
-- /* Length of the packet body */
-- /* FIXME: what if the skb is smaller than this? */
-- len = max_t(int,skb->len - ETH_HLEN, ETH_ZLEN - ETH_HLEN);
-+ /* Check packet length, pad short packets, round up odd length */
-+ len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN);
-+ if (skb->len < len) {
-+ skb = skb_padto(skb, len);
-+ if (skb == NULL)
-+ goto fail;
-+ }
-+ len -= ETH_HLEN;
-
- eh = (struct ethhdr *)skb->data;
-
-@@ -556,8 +561,7 @@ static int orinoco_xmit(struct sk_buff *
- p = skb->data;
- }
-
-- /* Round up for odd length packets */
-- err = hermes_bap_pwrite(hw, USER_BAP, p, ALIGN(data_len, 2),
-+ err = hermes_bap_pwrite(hw, USER_BAP, p, data_len,
- txfid, data_off);
- if (err) {
- printk(KERN_ERR "%s: Error %d writing packet to BAP\n",
-diff --git a/fs/namei.c b/fs/namei.c
---- a/fs/namei.c
-+++ b/fs/namei.c
-@@ -1557,19 +1557,19 @@ do_link:
- if (nd->last_type != LAST_NORM)
- goto exit;
- if (nd->last.name[nd->last.len]) {
-- putname(nd->last.name);
-+ __putname(nd->last.name);
- goto exit;
- }
- error = -ELOOP;
- if (count++==32) {
-- putname(nd->last.name);
-+ __putname(nd->last.name);
- goto exit;
- }
- dir = nd->dentry;
- down(&dir->d_inode->i_sem);
- path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
- path.mnt = nd->mnt;
-- putname(nd->last.name);
-+ __putname(nd->last.name);
- goto do_last;
- }
-
-diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c
---- a/net/ipv4/tcp_bic.c
-+++ b/net/ipv4/tcp_bic.c
-@@ -136,7 +136,7 @@ static inline void bictcp_update(struct
- else if (cwnd < ca->last_max_cwnd + max_increment*(BICTCP_B-1))
- /* slow start */
- ca->cnt = (cwnd * (BICTCP_B-1))
-- / cwnd-ca->last_max_cwnd;
-+ / (cwnd - ca->last_max_cwnd);
- else
- /* linear increase */
- ca->cnt = cwnd / max_increment;
-diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
---- a/security/keys/request_key_auth.c
-+++ b/security/keys/request_key_auth.c
-@@ -96,6 +96,7 @@ static void request_key_auth_destroy(str
- kenter("{%d}", key->serial);
-
- key_put(rka->target_key);
-+ kfree(rka);
-
- } /* end request_key_auth_destroy() */
-
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/powerpc-pmac-sound-check.patch
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/powerpc-pmac-sound-check.patch 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/powerpc-pmac-sound-check.patch 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,30 +0,0 @@
-# Description: checks if ppc_md.feature_call is present before using it.
-# Patch author: David Woodhouse <dwmw2 at infradead.org>
-# Upstream status: submitted.
-
-We shouldn't be assuming that ppc_md.feature_call will be present.
-
-Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
-
---- linux-2.6.12/sound/ppc/pmac.c.orig 2005-08-17 11:19:46.000000000 +0100
-+++ linux-2.6.12/sound/ppc/pmac.c 2005-08-17 11:20:05.000000000 +0100
-@@ -765,7 +765,8 @@ snd_pmac_ctrl_intr(int irq, void *devid,
- */
- static void snd_pmac_sound_feature(pmac_t *chip, int enable)
- {
-- ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable);
-+ if (ppc_md.feature_call)
-+ ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable);
- }
-
- /*
-
---
-dwmw2
-
----------------------------------------------------------------------------------------
-Wanadoo vous informe que cet e-mail a ete controle par l'anti-virus mail.
-Aucun virus connu a ce jour par nos services n'a ete detecte.
-
-
-
Deleted: dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/powerpc-ppc64-biarch-override.patch
===================================================================
--- dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/powerpc-ppc64-biarch-override.patch 2005-10-16 23:07:21 UTC (rev 4496)
+++ dists/trunk/linux-2.6-2.6.14-rc4/debian/patches-debian/powerpc-ppc64-biarch-override.patch 2005-10-16 23:09:36 UTC (rev 4497)
@@ -1,44 +0,0 @@
-# Subject: [patch 059/167] ppc64: override command line AS/LD/CC variables when adding -m64 and co for biarch compilers
-# To: torvalds at osdl.org
-# Cc: akpm at osdl.org, sven.luther at wanadoo.fr, anton at samba.org,
-# benh at kernel.crashing.org, paulus at samba.org
-# From: akpm at osdl.org
-#
-# The following kind of calls currently fails :
-#
-# make ARCH=ppc64 CC="gcc-3.4"
-#
-# Since the code for detecting a biarch compiler and adding the needed 64bit
-# magic argument fails if the AS/LD/CC commands are overriden in the command
-# line.
-#
-# The attached patch fixes this by using the make override and += directive,
-# but i am not 100% sure this will work without gmake, as i am no Makefile
-# expert.
-#
-# Cc: Paul Mackerras <paulus at samba.org>
-# Cc: Anton Blanchard <anton at samba.org>
-# Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
-# Signed-off-by: Andrew Morton <akpm at osdl.org>
-# ---
-#
-# arch/ppc64/Makefile | 6 +++---
-# 1 files changed, 3 insertions(+), 3 deletions(-)
-#
-diff -puN arch/ppc64/Makefile~ppc64-override-command-line-as-ld-cc-variables-when-adding-m64-and-co-for-biarch-compilers arch/ppc64/Makefile
---- 25/arch/ppc64/Makefile~ppc64-override-command-line-as-ld-cc-variables-when-adding-m64-and-co-for-biarch-compilers 2005-06-21 16:29:10.000000000 -0700
-+++ 25-akpm/arch/ppc64/Makefile 2005-06-21 16:29:10.000000000 -0700
-@@ -35,9 +35,9 @@ CROSS32AS := $(AS) -a32
- CROSS32LD := $(LD) -m elf32ppc
- CROSS32OBJCOPY := $(OBJCOPY)
- endif
--AS := $(AS) -a64
--LD := $(LD) -m elf64ppc
--CC := $(CC) -m64
-+override AS += -a64
-+override LD += -m elf64ppc
-+override CC += -m64
- endif
-
- export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
-_
More information about the Kernel-svn-changes
mailing list