Commit f3da3d88 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.3.36pre5

parent eab2ce74
......@@ -7878,22 +7878,26 @@ CONFIG_USB_UHCI
The Universal Host Controller Interface is a standard by Intel for
accessing the USB hardware in the PC (which is also called the USB
host controller). If your USB host controller conforms to this
standard, say Y. All recent boards with Intel PCI chipsets conform
to this standard. If unsure, say Y.
standard, say Y. All recent boards with Intel PCI chipsets (like
intel 430TX, 440FX, 440LX, 440BX, i810, i820) conform to this standard.
Also all VIA PCI chipsets (like VIA VP2, VP3, MVP3, Apollo Pro, Apollo
Pro II or Apollo Pro 133).
If unsure, say Y.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called usb-uhci.o. If you want to compile it as a
module, say M here and read Documentation/modules.txt.
OHCI-HCD (Compaq, iMacs, OPTi, SiS, and others) support?
OHCI-HCD (Compaq, iMacs, OPTi, SiS, ALi, and others) support?
CONFIG_USB_OHCI_HCD
The Open Host Controller Interface is a standard by
Compaq/Microsoft/National for accessing the USB PC hardware (also
called USB host controller). If your USB host controller conforms
to this standard, say Y. The USB host controllers on most
non-Intel architectures and on several x86 compatibles with
non-Intel chipsets conform to this standard.
non-Intel architectures and on several x86 compatibles with non-Intel
chipsets - like SiS (aktual 610, 610 and so on) or ALi (ALi IV, ALi V,
Aladin Pro..) - conform to this standard.
You may want to read the file drivers/usb/README.ohci_hcd.
......
......@@ -23,8 +23,9 @@
*
* **********************
*/
#include <linux/module.h>
#include <linux/config.h> /* for CONFIG_INET */
#include <linux/config.h> /* for CONFIG_INET */
#include <linux/init.h>
#include <linux/if_arp.h>
#include <net/arp.h>
......@@ -40,10 +41,11 @@ static void rx(struct net_device *dev, int bufnum,
static int build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr);
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum);
int bufnum);
struct ArcProto rawmode_proto = {
struct ArcProto rawmode_proto =
{
'r',
XMTU,
rx,
......@@ -54,17 +56,17 @@ struct ArcProto rawmode_proto = {
void arcnet_raw_init(void)
{
int count;
for (count = 0; count < 256; count++)
if (arc_proto_map[count] == arc_proto_default)
arc_proto_map[count] = &rawmode_proto;
/* for raw mode, we only set the bcast proto if there's no better one */
if (arc_bcast_proto == arc_proto_default)
arc_bcast_proto = &rawmode_proto;
arc_proto_default = &rawmode_proto;
int count;
for (count = 0; count < 256; count++)
if (arc_proto_map[count] == arc_proto_default)
arc_proto_map[count] = &rawmode_proto;
/* for raw mode, we only set the bcast proto if there's no better one */
if (arc_bcast_proto == arc_proto_default)
arc_bcast_proto = &rawmode_proto;
arc_proto_default = &rawmode_proto;
}
......@@ -72,17 +74,17 @@ void arcnet_raw_init(void)
int __init init_module(void)
{
printk(VERSION);
arcnet_raw_init();
return 0;
printk(VERSION);
arcnet_raw_init();
return 0;
}
void cleanup_module(void)
{
arcnet_unregister_proto(&rawmode_proto);
arcnet_unregister_proto(&rawmode_proto);
}
#endif /* MODULE */
#endif /* MODULE */
......@@ -90,45 +92,43 @@ void cleanup_module(void)
static void rx(struct net_device *dev, int bufnum,
struct archdr *pkthdr, int length)
{
struct arcnet_local *lp = (struct arcnet_local *)dev->priv;
struct sk_buff *skb;
struct archdr *pkt = pkthdr;
int ofs;
BUGMSG(D_DURING, "it's a raw packet (length=%d)\n", length);
if (length >= MinTU)
ofs = 512 - length;
else
ofs = 256 - length;
skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
if (skb == NULL)
{
BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
lp->stats.rx_dropped++;
return;
}
skb_put(skb, length + ARC_HDR_SIZE);
skb->dev = dev;
pkt = (struct archdr *)skb->data;
skb->mac.raw = skb->data;
skb_pull(skb, ARC_HDR_SIZE);
/* up to sizeof(pkt->soft) has already been copied from the card */
memcpy(pkt, pkthdr, sizeof(struct archdr));
if (length > sizeof(pkt->soft))
lp->hw.copy_from_card(dev, bufnum, ofs + sizeof(pkt->soft),
pkt->soft.raw + sizeof(pkt->soft),
length - sizeof(pkt->soft));
BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
skb->protocol = 0;
netif_rx(skb);
struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
struct sk_buff *skb;
struct archdr *pkt = pkthdr;
int ofs;
BUGMSG(D_DURING, "it's a raw packet (length=%d)\n", length);
if (length >= MinTU)
ofs = 512 - length;
else
ofs = 256 - length;
skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
if (skb == NULL) {
BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
lp->stats.rx_dropped++;
return;
}
skb_put(skb, length + ARC_HDR_SIZE);
skb->dev = dev;
pkt = (struct archdr *) skb->data;
skb->mac.raw = skb->data;
skb_pull(skb, ARC_HDR_SIZE);
/* up to sizeof(pkt->soft) has already been copied from the card */
memcpy(pkt, pkthdr, sizeof(struct archdr));
if (length > sizeof(pkt->soft))
lp->hw.copy_from_card(dev, bufnum, ofs + sizeof(pkt->soft),
pkt->soft.raw + sizeof(pkt->soft),
length - sizeof(pkt->soft));
BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
skb->protocol = 0;
netif_rx(skb);
}
......@@ -139,75 +139,67 @@ static void rx(struct net_device *dev, int bufnum,
static int build_header(struct sk_buff *skb, unsigned short type,
uint8_t daddr)
{
struct net_device *dev = skb->dev;
int hdr_size = ARC_HDR_SIZE;
struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size);
/*
* Set the source hardware address.
*
* This is pretty pointless for most purposes, but it can help in
* debugging. ARCnet does not allow us to change the source address in
* the actual packet sent)
*/
pkt->hard.source = *dev->dev_addr;
/* see linux/net/ethernet/eth.c to see where I got the following */
if (dev->flags & (IFF_LOOPBACK|IFF_NOARP))
{
/*
* FIXME: fill in the last byte of the dest ipaddr here to better
* comply with RFC1051 in "noarp" mode.
struct net_device *dev = skb->dev;
int hdr_size = ARC_HDR_SIZE;
struct archdr *pkt = (struct archdr *) skb_push(skb, hdr_size);
/*
* Set the source hardware address.
*
* This is pretty pointless for most purposes, but it can help in
* debugging. ARCnet does not allow us to change the source address in
* the actual packet sent)
*/
pkt->hard.dest = 0;
return hdr_size;
}
/* otherwise, just fill it in and go! */
pkt->hard.dest = daddr;
return hdr_size; /* success */
pkt->hard.source = *dev->dev_addr;
/* see linux/net/ethernet/eth.c to see where I got the following */
if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
/*
* FIXME: fill in the last byte of the dest ipaddr here to better
* comply with RFC1051 in "noarp" mode.
*/
pkt->hard.dest = 0;
return hdr_size;
}
/* otherwise, just fill it in and go! */
pkt->hard.dest = daddr;
return hdr_size; /* success */
}
static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
int bufnum)
int bufnum)
{
struct arcnet_local *lp = (struct arcnet_local *)dev->priv;
struct arc_hardware *hard = &pkt->hard;
int ofs;
BUGMSG(D_DURING, "prepare_tx: txbufs=%d/%d/%d\n",
lp->next_tx, lp->cur_tx, bufnum);
length -= ARC_HDR_SIZE; /* hard header is not included in packet length */
if (length > XMTU)
{
/* should never happen! other people already check for this. */
BUGMSG(D_NORMAL, "Bug! prepare_tx with size %d (> %d)\n",
length, XMTU);
length = XMTU;
}
if (length > MinTU)
{
hard->offset[0] = 0;
hard->offset[1] = ofs = 512 - length;
}
else if (length > MTU)
{
hard->offset[0] = 0;
hard->offset[1] = ofs = 512 - length - 3;
}
else
hard->offset[0] = ofs = 256 - length;
lp->hw.copy_to_card(dev, bufnum, 0, hard, ARC_HDR_SIZE);
lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->soft, length);
lp->lastload_dest = hard->dest;
return 1; /* done */
struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
struct arc_hardware *hard = &pkt->hard;
int ofs;
BUGMSG(D_DURING, "prepare_tx: txbufs=%d/%d/%d\n",
lp->next_tx, lp->cur_tx, bufnum);
length -= ARC_HDR_SIZE; /* hard header is not included in packet length */
if (length > XMTU) {
/* should never happen! other people already check for this. */
BUGMSG(D_NORMAL, "Bug! prepare_tx with size %d (> %d)\n",
length, XMTU);
length = XMTU;
}
if (length > MinTU) {
hard->offset[0] = 0;
hard->offset[1] = ofs = 512 - length;
} else if (length > MTU) {
hard->offset[0] = 0;
hard->offset[1] = ofs = 512 - length - 3;
} else
hard->offset[0] = ofs = 256 - length;
lp->hw.copy_to_card(dev, bufnum, 0, hard, ARC_HDR_SIZE);
lp->hw.copy_to_card(dev, bufnum, ofs, &pkt->soft, length);
lp->lastload_dest = hard->dest;
return 1; /* done */
}
......@@ -43,13 +43,13 @@
static int arcrimi_probe(struct net_device *dev);
static int arcrimi_found(struct net_device *dev);
static void arcrimi_command (struct net_device *dev, int command);
static int arcrimi_status (struct net_device *dev);
static void arcrimi_setmask (struct net_device *dev, int mask);
static int arcrimi_reset (struct net_device *dev, int really_reset);
static void arcrimi_command(struct net_device *dev, int command);
static int arcrimi_status(struct net_device *dev);
static void arcrimi_setmask(struct net_device *dev, int mask);
static int arcrimi_reset(struct net_device *dev, int really_reset);
static void arcrimi_openclose(struct net_device *dev, bool open);
static void arcrimi_copy_to_card (struct net_device *dev, int bufnum, int offset,
void *buf, int count);
static void arcrimi_copy_to_card(struct net_device *dev, int bufnum, int offset,
void *buf, int count);
static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offset,
void *buf, int count);
......@@ -88,7 +88,7 @@ static int __init arcrimi_probe(struct net_device *dev)
{
BUGLVL(D_NORMAL) printk(VERSION);
BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n");
BUGMSG(D_NORMAL, "Given: node %02Xh, shmem %lXh, irq %d\n",
dev->dev_addr[0], dev->mem_start, dev->irq);
......@@ -97,18 +97,15 @@ static int __init arcrimi_probe(struct net_device *dev)
"must specify the shmem and irq!\n");
return -ENODEV;
}
if (check_mem_region(dev->mem_start, BUFFER_SIZE)) {
BUGMSG(D_NORMAL, "Card memory already allocated\n");
return -ENODEV;
}
if (dev->dev_addr[0] == 0) {
BUGMSG(D_NORMAL, "You need to specify your card's station "
"ID!\n");
return -ENODEV;
}
return arcrimi_found(dev);
}
......@@ -123,9 +120,9 @@ static int __init arcrimi_found(struct net_device *dev)
u_long first_mirror, last_mirror, shmem;
int mirror_size;
/* reserve the irq */ {
if (request_irq(dev->irq, &arcnet_interrupt, 0, "arcnet (RIM I)", dev))
BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq);
/* reserve the irq */ {
if (request_irq(dev->irq, &arcnet_interrupt, 0, "arcnet (RIM I)", dev))
BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq);
return -ENODEV;
}
......@@ -166,19 +163,18 @@ static int __init arcrimi_found(struct net_device *dev)
BUGMSG(D_NORMAL, "Can't allocate device data!\n");
goto err_free_irq;
}
lp->hw.command = arcrimi_command;
lp->hw.status = arcrimi_status;
lp->hw.intmask = arcrimi_setmask;
lp->hw.reset = arcrimi_reset;
lp->hw.open_close = arcrimi_openclose;
lp->hw.copy_to_card = arcrimi_copy_to_card;
lp->hw.command = arcrimi_command;
lp->hw.status = arcrimi_status;
lp->hw.intmask = arcrimi_setmask;
lp->hw.reset = arcrimi_reset;
lp->hw.open_close = arcrimi_openclose;
lp->hw.copy_to_card = arcrimi_copy_to_card;
lp->hw.copy_from_card = arcrimi_copy_from_card;
lp->mem_start = ioremap(dev->mem_start, dev->mem_end - dev->mem_start + 1);
lp->mem_start = ioremap(dev->mem_start, dev->mem_end - dev->mem_start + 1);
if (!lp->mem_start) {
BUGMSG(D_NORMAL, "Can't remap device memory!\n");
goto err_free_dev_priv;
}
/* Fill in the fields of the device structure with generic
* values.
*/
......@@ -194,13 +190,13 @@ static int __init arcrimi_found(struct net_device *dev)
"ShMem %lXh (%ld*%d bytes).\n",
dev->dev_addr[0],
dev->irq, dev->mem_start,
(dev->mem_end - dev->mem_start + 1) / mirror_size, mirror_size);
(dev->mem_end - dev->mem_start + 1) / mirror_size, mirror_size);
return 0;
err_free_dev_priv:
err_free_dev_priv:
kfree(dev->priv);
err_free_irq:
err_free_irq:
free_irq(dev->irq, dev);
return -EIO;
}
......@@ -222,10 +218,9 @@ static int arcrimi_reset(struct net_device *dev, int really_reset)
BUGMSG(D_INIT, "Resetting %s (status=%02Xh)\n", dev->name, ASTATUS());
if (really_reset) {
writeb(TESTvalue, ioaddr-0x800); /* fake reset */
writeb(TESTvalue, ioaddr - 0x800); /* fake reset */
return 0;
}
ACOMMAND(CFLAGScmd | RESETclear); /* clear flags & end reset */
ACOMMAND(CFLAGScmd | CONFIGclear);
......@@ -273,7 +268,7 @@ static void arcrimi_copy_to_card(struct net_device *dev, int bufnum, int offset,
void *buf, int count)
{
struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
void *memaddr = lp->mem_start + 0x800 + bufnum*512 + offset;
void *memaddr = lp->mem_start + 0x800 + bufnum * 512 + offset;
TIME("memcpy_toio", count, memcpy_toio(memaddr, buf, count));
}
......@@ -282,7 +277,7 @@ static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offse
void *buf, int count)
{
struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
void *memaddr = lp->mem_start + 0x800 + bufnum*512 + offset;
void *memaddr = lp->mem_start + 0x800 + bufnum * 512 + offset;
TIME("memcpy_fromio", count, memcpy_fromio(buf, memaddr, count));
}
......@@ -306,7 +301,7 @@ int init_module(void)
{
struct net_device *dev;
int err;
dev = dev_alloc(device ? : "arc%d", &err);
if (!dev)
return err;
......@@ -318,7 +313,7 @@ int init_module(void)
dev->irq = irq;
if (dev->irq == 2)
dev->irq = 9;
if (arcrimi_probe(dev))
return -EIO;
......@@ -360,17 +355,17 @@ static int __init arcrimi_setup(char *s)
return 1;
dev = alloc_bootmem(sizeof(struct net_device) + 10);
memset(dev, 0, sizeof(struct net_device) + 10);
dev->name = (char *)(dev+1);
dev->name = (char *) (dev + 1);
dev->init = arcrimi_probe;
switch (ints[0]) {
default: /* ERROR */
printk("arcrimi: Too many arguments.\n");
case 3: /* Node ID */
case 3: /* Node ID */
dev->dev_addr[0] = ints[3];
case 2: /* IRQ */
case 2: /* IRQ */
dev->irq = ints[2];
case 1: /* IO address */
case 1: /* IO address */
dev->mem_start = ints[1];
}
if (*s)
......
This diff is collapsed.
......@@ -42,7 +42,7 @@
#define VERSION "arcnet: COM20020 ISA support (by David Woodhouse et al.)\n"
/*
* We cannot (yet) probe for an IO mapped card, although we can check that
......@@ -50,70 +50,60 @@
*/
static int __init com20020isa_probe(struct net_device *dev)
{
int ioaddr;
unsigned long airqmask;
int ioaddr;
unsigned long airqmask;
#ifndef MODULE
arcnet_init();
arcnet_init();
#endif
BUGLVL(D_NORMAL) printk(VERSION);
ioaddr = dev->base_addr;
if (!ioaddr)
{
BUGMSG(D_NORMAL, "No autoprobe (yet) for IO mapped cards; you "
"must specify the base address!\n");
return -ENODEV;
}
if (check_region(ioaddr, ARCNET_TOTAL_SIZE))
{
BUGMSG(D_NORMAL, "IO region %xh-%xh already allocated.\n",
ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
return -ENXIO;
}
if (ASTATUS() == 0xFF)
{
BUGMSG(D_NORMAL, "IO address %x empty\n", ioaddr);
return -ENODEV;
}
if (com20020_check(dev))
return -ENODEV;
if (!dev->irq)
{
/* if we do this, we're sure to get an IRQ since the
* card has just reset and the NORXflag is on until
* we tell it to start receiving.
*/
BUGMSG(D_INIT_REASONS, "intmask was %02Xh\n", inb(_INTMASK));
outb(0, _INTMASK);
airqmask = probe_irq_on();
outb(NORXflag, _INTMASK);
udelay(1);
outb(0, _INTMASK);
dev->irq = probe_irq_off(airqmask);
if (dev->irq <= 0)
{
BUGMSG(D_INIT_REASONS, "Autoprobe IRQ failed first time\n");
airqmask = probe_irq_on();
outb(NORXflag, _INTMASK);
udelay(5);
outb(0, _INTMASK);
dev->irq = probe_irq_off(airqmask);
if (dev->irq <= 0)
{
BUGMSG(D_NORMAL, "Autoprobe IRQ failed.\n");
BUGLVL(D_NORMAL) printk(VERSION);
ioaddr = dev->base_addr;
if (!ioaddr) {
BUGMSG(D_NORMAL, "No autoprobe (yet) for IO mapped cards; you "
"must specify the base address!\n");
return -ENODEV;
}
if (check_region(ioaddr, ARCNET_TOTAL_SIZE)) {
BUGMSG(D_NORMAL, "IO region %xh-%xh already allocated.\n",
ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
return -ENXIO;
}
if (ASTATUS() == 0xFF) {
BUGMSG(D_NORMAL, "IO address %x empty\n", ioaddr);
return -ENODEV;
}
}
}
if (com20020_check(dev))
return -ENODEV;
return com20020_found(dev, 0);
if (!dev->irq) {
/* if we do this, we're sure to get an IRQ since the
* card has just reset and the NORXflag is on until
* we tell it to start receiving.
*/
BUGMSG(D_INIT_REASONS, "intmask was %02Xh\n", inb(_INTMASK));
outb(0, _INTMASK);
airqmask = probe_irq_on();
outb(NORXflag, _INTMASK);
udelay(1);
outb(0, _INTMASK);
dev->irq = probe_irq_off(airqmask);
if (dev->irq <= 0) {
BUGMSG(D_INIT_REASONS, "Autoprobe IRQ failed first time\n");
airqmask = probe_irq_on();
outb(NORXflag, _INTMASK);
udelay(5);
outb(0, _INTMASK);
dev->irq = probe_irq_off(airqmask);
if (dev->irq <= 0) {
BUGMSG(D_NORMAL, "Autoprobe IRQ failed.\n");
return -ENODEV;
}
}
}
return com20020_found(dev, 0);
}
......@@ -141,45 +131,45 @@ MODULE_PARM(clock, "i");
static void com20020isa_open_close(struct net_device *dev, bool open)
{
if (open)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
if (open)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
}
int init_module(void)
{
struct net_device *dev;
struct arcnet_local *lp;
int err;
dev = dev_alloc(device ? : "arc%d", &err);
if (!dev)
return err;
lp = dev->priv = kmalloc(sizeof(struct arcnet_local), GFP_KERNEL);
if (!lp)
return -ENOMEM;
memset(lp, 0, sizeof(struct arcnet_local));
if (node && node != 0xff)
dev->dev_addr[0] = node;
lp->backplane = backplane;
lp->clock = clock & 7;
lp->timeout = timeout & 3;
lp->hw.open_close_ll = com20020isa_open_close;
dev->base_addr = io;
dev->irq = irq;
if (dev->irq == 2)
dev->irq = 9;
if (com20020isa_probe(dev))
return -EIO;
my_dev = dev;
return 0;
struct net_device *dev;
struct arcnet_local *lp;
int err;
dev = dev_alloc(device ? : "arc%d", &err);
if (!dev)
return err;
lp = dev->priv = kmalloc(sizeof(struct arcnet_local), GFP_KERNEL);
if (!lp)
return -ENOMEM;
memset(lp, 0, sizeof(struct arcnet_local));
if (node && node != 0xff)
dev->dev_addr[0] = node;
lp->backplane = backplane;
lp->clock = clock & 7;
lp->timeout = timeout & 3;
lp->hw.open_close_ll = com20020isa_open_close;
dev->base_addr = io;
dev->irq = irq;
if (dev->irq == 2)
dev->irq = 9;
if (com20020isa_probe(dev))
return -EIO;
my_dev = dev;
return 0;
}
void cleanup_module(void)
......@@ -209,24 +199,24 @@ static int __init com20020isa_setup(char *s)
return 1;
dev = alloc_bootmem(sizeof(struct net_device) + sizeof(struct arcnet_local) + 10);
memset(dev, 0, sizeof(struct net_device) + sizeof(struct arcnet_local) + 10);
lp = dev->priv = (struct arcnet_local *)(dev+1);
dev->name = (char *)(lp+1);
lp = dev->priv = (struct arcnet_local *) (dev + 1);
dev->name = (char *) (lp + 1);
dev->init = com20020isa_probe;
switch (ints[0]) {
default: /* ERROR */
printk("com90xx: Too many arguments.\n");
case 6: /* Timeout */
case 6: /* Timeout */
lp->timeout = ints[6];
case 5: /* CKP value */
case 5: /* CKP value */
lp->clock = ints[5];
case 4: /* Backplane flag */
case 4: /* Backplane flag */
lp->backplane = ints[4];
case 3: /* Node ID */
case 3: /* Node ID */
dev->dev_addr[0] = ints[3];
case 2: /* IRQ */
case 2: /* IRQ */
dev->irq = ints[2];
case 1: /* IO address */
case 1: /* IO address */
dev->base_addr = ints[1];
}
if (*s)
......
......@@ -43,16 +43,17 @@
#define VERSION "arcnet: COM20020 PCI support\n"
#ifdef MODULE
static struct net_device *cards[16];
#define MAX_CARDS 16
static struct net_device *cards[MAX_CARDS];
static int numcards;
#endif
static void com20020pci_open_close(struct net_device *dev, bool open)
{
if (open)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
if (open)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
}
/*
......@@ -61,64 +62,61 @@ static void com20020pci_open_close(struct net_device *dev, bool open)
*/
static int __init com20020pci_probe(char *name_template, int node, int backplane, int clock, int timeout)
{
struct net_device *dev;
struct arcnet_local *lp;
struct pci_dev *pdev = NULL;
int ioaddr, gotone = 0, err;
BUGLVL(D_NORMAL) printk(VERSION);
while ((pdev = pci_find_device(0x1571, 0xa004, pdev)))
{
if (pci_enable_device(pdev))
continue;
dev = dev_alloc(name_template ? : "arc%d", &err);
if (!dev)
return err;
lp = dev->priv = kmalloc(sizeof(struct arcnet_local), GFP_KERNEL);
if (!lp)
return -ENOMEM;
memset(lp, 0, sizeof(struct arcnet_local));
ioaddr = pdev->resource[2].start;
dev->base_addr = ioaddr;
dev->irq = pdev->irq;
dev->dev_addr[0] = node;
lp->backplane = backplane;
lp->clock = clock;
lp->timeout = timeout;
lp->hw.open_close_ll = com20020pci_open_close;
BUGMSG(D_INIT, "PCI BIOS reports a device at %Xh, IRQ %d\n",
ioaddr, dev->irq);
if (check_region(ioaddr, ARCNET_TOTAL_SIZE))
{
BUGMSG(D_INIT, "IO region %xh-%xh already allocated.\n",
ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
continue;
}
if (ASTATUS() == 0xFF)
{
BUGMSG(D_NORMAL, "IO address %Xh was reported by PCI BIOS, "
"but seems empty!\n", ioaddr);
continue;
}
if (com20020_check(dev))
continue;
if (!com20020_found(dev, SA_SHIRQ))
{
struct net_device *dev;
struct arcnet_local *lp;
struct pci_dev *pdev = NULL;
int ioaddr, gotone = 0, err;
BUGLVL(D_NORMAL) printk(VERSION);
while ((pdev = pci_find_device(0x1571, 0xa004, pdev))) {
if (pci_enable_device(pdev))
continue;
dev = dev_alloc(name_template ? : "arc%d", &err);
if (!dev)
return err;
lp = dev->priv = kmalloc(sizeof(struct arcnet_local), GFP_KERNEL);
if (!lp)
return -ENOMEM;
memset(lp, 0, sizeof(struct arcnet_local));
ioaddr = pdev->resource[2].start;
dev->base_addr = ioaddr;
dev->irq = pdev->irq;
dev->dev_addr[0] = node;
lp->backplane = backplane;
lp->clock = clock;
lp->timeout = timeout;
lp->hw.open_close_ll = com20020pci_open_close;
BUGMSG(D_INIT, "PCI BIOS reports a device at %Xh, IRQ %d\n",
ioaddr, dev->irq);
if (check_region(ioaddr, ARCNET_TOTAL_SIZE)) {
BUGMSG(D_INIT, "IO region %xh-%xh already allocated.\n",
ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
continue;
}
if (ASTATUS() == 0xFF) {
BUGMSG(D_NORMAL, "IO address %Xh was reported by PCI BIOS, "
"but seems empty!\n", ioaddr);
continue;
}
if (com20020_check(dev))
continue;
if (!com20020_found(dev, SA_SHIRQ)) {
#ifdef MODULE
cards[numcards++] = dev;
if(numcards==MAX_CARDS)
printk(KERN_WARNING "com20020pci: Too many cards. Ignoring.\n");
else
cards[numcards++] = dev;
#endif
gotone++;
gotone++;
}
}
}
return gotone ? 0 : -ENODEV;
return gotone ? 0 : -ENODEV;
}
......@@ -140,27 +138,26 @@ MODULE_PARM(clock, "i");
int init_module(void)
{
return com20020pci_probe(device, node, backplane, clock & 7, timeout & 3);
return com20020pci_probe(device, node, backplane, clock & 7, timeout & 3);
}
void cleanup_module(void)
{
struct net_device *dev;
int count;
for (count = 0; count < numcards; count++)
{
dev = cards[count];
if (dev->start)
dev->stop(dev);
free_irq(dev->irq, dev);
release_region(dev->base_addr, ARCNET_TOTAL_SIZE);
unregister_netdev(dev);
kfree(dev->priv);
kfree(dev);
}
struct net_device *dev;
int count;
for (count = 0; count < numcards; count++) {
dev = cards[count];
if (dev->start)
dev->stop(dev);
free_irq(dev->irq, dev);
release_region(dev->base_addr, ARCNET_TOTAL_SIZE);
unregister_netdev(dev);
kfree(dev->priv);
kfree(dev);
}
}
#else
......
This diff is collapsed.
......@@ -42,14 +42,14 @@
/* Internal function declarations */
static int com90io_found(struct net_device *dev);
static void com90io_command (struct net_device *dev, int command);
static int com90io_status (struct net_device *dev);
static void com90io_setmask (struct net_device *dev, int mask);
static int com90io_reset (struct net_device *dev, int really_reset);
static int com90io_found(struct net_device *dev);
static void com90io_command(struct net_device *dev, int command);
static int com90io_status(struct net_device *dev);
static void com90io_setmask(struct net_device *dev, int mask);
static int com90io_reset(struct net_device *dev, int really_reset);
static void com90io_openclose(struct net_device *dev, bool open);
static void com90io_copy_to_card (struct net_device *dev, int bufnum, int offset,
void *buf, int count);
static void com90io_copy_to_card(struct net_device *dev, int bufnum, int offset,
void *buf, int count);
static void com90io_copy_from_card(struct net_device *dev, int bufnum, int offset,
void *buf, int count);
......@@ -108,6 +108,7 @@ static void put_buffer_byte(struct net_device *dev, unsigned offset, u_char datu
outb(datum, _MEMDATA);
}
#endif
......@@ -162,18 +163,15 @@ static int __init com90io_probe(struct net_device *dev)
"must specify the base address!\n");
return -ENODEV;
}
if (check_region(ioaddr, ARCNET_TOTAL_SIZE)) {
BUGMSG(D_INIT_REASONS, "IO check_region %x-%x failed.\n",
ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
return -ENXIO;
}
if (ASTATUS() == 0xFF) {
BUGMSG(D_INIT_REASONS, "IO address %x empty\n", ioaddr);
return -ENODEV;
}
inb(_RESET);
mdelay(RESETtime);
......@@ -183,7 +181,6 @@ static int __init com90io_probe(struct net_device *dev)
BUGMSG(D_INIT_REASONS, "Status invalid (%Xh).\n", status);
return -ENODEV;
}
BUGMSG(D_INIT_REASONS, "Status after reset: %X\n", status);
ACOMMAND(CFLAGScmd | RESETclear | CONFIGclear);
......@@ -196,7 +193,6 @@ static int __init com90io_probe(struct net_device *dev)
BUGMSG(D_INIT_REASONS, "Eternal reset (status=%Xh)\n", status);
return -ENODEV;
}
outb((0x16 | IOMAPflag) & ~ENABLE16flag, _CONFIG);
/* Read first loc'n of memory */
......@@ -209,7 +205,6 @@ static int __init com90io_probe(struct net_device *dev)
" (%Xh instead).\n", status);
return -ENODEV;
}
if (!dev->irq) {
/*
* if we do this, we're sure to get an IRQ since the
......@@ -228,7 +223,6 @@ static int __init com90io_probe(struct net_device *dev)
return -ENODEV;
}
}
return com90io_found(dev);
}
......@@ -246,7 +240,6 @@ static int __init com90io_found(struct net_device *dev)
BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq);
return -ENODEV;
}
/* Reserve the I/O region - guaranteed to work by check_region */
request_region(dev->base_addr, ARCNET_TOTAL_SIZE, "arcnet (COM90xx-IO)");
......@@ -260,12 +253,12 @@ static int __init com90io_found(struct net_device *dev)
memset(dev->priv, 0, sizeof(struct arcnet_local));
lp = (struct arcnet_local *) (dev->priv);
lp->hw.command = com90io_command;
lp->hw.status = com90io_status;
lp->hw.intmask = com90io_setmask;
lp->hw.reset = com90io_reset;
lp->hw.open_close = com90io_openclose;
lp->hw.copy_to_card = com90io_copy_to_card;
lp->hw.command = com90io_command;
lp->hw.status = com90io_status;
lp->hw.intmask = com90io_setmask;
lp->hw.reset = com90io_reset;
lp->hw.open_close = com90io_openclose;
lp->hw.copy_to_card = com90io_copy_to_card;
lp->hw.copy_from_card = com90io_copy_from_card;
/*
......@@ -308,7 +301,6 @@ static int com90io_reset(struct net_device *dev, int really_reset)
inb(_RESET);
mdelay(RESETtime);
}
/* Set the thing to IO-mapped, 8-bit mode */
lp->config = (0x1C | IOMAPflag) & ~ENABLE16flag;
SETCONF();
......@@ -321,7 +313,6 @@ static int com90io_reset(struct net_device *dev, int really_reset)
BUGMSG(D_NORMAL, "reset failed: TESTvalue not present.\n");
return 1;
}
/* enable extended (512-byte) packets */
ACOMMAND(CONFIGcmd | EXTconf);
......@@ -364,14 +355,14 @@ static void com90io_openclose(struct net_device *dev, int open)
static void com90io_copy_to_card(struct net_device *dev, int bufnum, int offset,
void *buf, int count)
{
TIME("put_whole_buffer", count, put_whole_buffer(dev, bufnum*512 + offset, count, buf));
TIME("put_whole_buffer", count, put_whole_buffer(dev, bufnum * 512 + offset, count, buf));
}
static void com90io_copy_from_card(struct net_device *dev, int bufnum, int offset,
void *buf, int count)
{
TIME("get_whole_buffer", count, get_whole_buffer(dev, bufnum*512 + offset, count, buf));
TIME("get_whole_buffer", count, get_whole_buffer(dev, bufnum * 512 + offset, count, buf));
}
......@@ -382,7 +373,7 @@ static struct net_device *my_dev;
/* Module parameters */
static int io = 0x0; /* use the insmod io= irq= shmem= options */
static int irq = 0;
static int irq = 0;
static char *device; /* use eg. device=arc1 to change name */
MODULE_PARM(io, "i");
......@@ -402,7 +393,7 @@ int init_module(void)
dev->irq = irq;
if (dev->irq == 2)
dev->irq = 9;
if (com90io_probe(dev))
return -EIO;
......@@ -445,15 +436,15 @@ static int __init com90io_setup(char *s)
return 1;
dev = alloc_bootmem(sizeof(struct net_device) + 10);
memset(dev, 0, sizeof(struct net_device) + 10);
dev->name = (char *)(dev+1);
dev->name = (char *) (dev + 1);
dev->init = com90io_probe;
switch (ints[0]) {
default: /* ERROR */
printk("com90io: Too many arguments.\n");
case 2: /* IRQ */
case 2: /* IRQ */
dev->irq = ints[2];
case 1: /* IO address */
case 1: /* IO address */
dev->base_addr = ints[1];
}
if (*s)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -672,7 +672,7 @@ struct pci_dev * __init pci_scan_slot(struct pci_dev *temp)
first_dev = dev;
}
DBG("PCI: %02x:%02x [%04x/%04x] %06x %02x\n", bus->number, dev->devfn, dev->vendor, dev->device, class, hdr_type);
DBG("PCI: %02x:%02x [%04x/%04x] %06x %02x\n", bus->number, dev->devfn, dev->vendor, dev->device, dev->class, hdr_type);
/*
* Put it into the global PCI device chain. It's used to
......
......@@ -185,8 +185,8 @@ int cb_setup_cis_mem(socket_info_t *s, int space)
/* Not configured? Then set up temporary map */
br = (space == 7) ? CB_ROM_BASE : CB_BAR(space-1);
pci_writel(s->cap.cardbus, 0, br, 0xffffffff);
pci_readl(s->cap.cardbus, 0, br, &sz);
pci_writel(s->cap.cb_dev->subordinate->number, 0, br, 0xffffffff);
pci_readl(s->cap.cb_dev->subordinate->number, 0, br, &sz);
sz &= PCI_BASE_ADDRESS_MEM_MASK;
sz = FIND_FIRST_BIT(sz);
if (sz < PAGE_SIZE) sz = PAGE_SIZE;
......@@ -199,8 +199,8 @@ int cb_setup_cis_mem(socket_info_t *s, int space)
s->cb_cis_virt = ioremap(base, sz);
DEBUG(1, " phys 0x%08lx-0x%08lx, virt 0x%08lx\n",
base, base+sz-1, (u_long)s->cb_cis_virt);
pci_writel(s->cap.cardbus, 0, br, base | 1);
pci_writeb(s->cap.cardbus, 0, PCI_COMMAND, PCI_COMMAND_MEMORY);
pci_writel(s->cap.cb_dev->subordinate->number, 0, br, base | 1);
pci_writeb(s->cap.cb_dev->subordinate->number, 0, PCI_COMMAND, PCI_COMMAND_MEMORY);
m->map = 0; m->flags = MAP_ACTIVE;
m->start = base; m->stop = base+sz-1;
s->ss_entry->set_bridge(s->sock, m);
......@@ -228,8 +228,8 @@ void cb_release_cis_mem(socket_info_t *s)
CB_ROM_BASE : CB_BAR(s->cb_cis_space-1);
m->map = 0; m->flags = 0;
s->ss_entry->set_bridge(s->sock, m);
pci_writeb(s->cap.cardbus, 0, PCI_COMMAND, 0);
pci_writel(s->cap.cardbus, 0, br, 0);
pci_writeb(s->cap.cb_dev->subordinate->number, 0, PCI_COMMAND, 0);
pci_writel(s->cap.cb_dev->subordinate->number, 0, br, 0);
release_mem_region(m->start, m->stop - m->start + 1);
m->start = 0;
}
......@@ -249,7 +249,7 @@ void read_cb_mem(socket_info_t *s, u_char fn, int space,
if (space == 0) {
if (addr+len > 0x100) goto fail;
for (; len; addr++, ptr++, len--)
pci_readb(s->cap.cardbus, fn, addr, (u_char *)ptr);
pci_readb(s->cap.cb_dev->subordinate->number, fn, addr, (u_char *)ptr);
} else {
if (cb_setup_cis_mem(s, space) != 0) goto fail;
if (space == 7) {
......@@ -278,57 +278,62 @@ void read_cb_mem(socket_info_t *s, u_char fn, int space,
int cb_alloc(socket_info_t *s)
{
struct pci_bus *bus;
struct pci_dev tmp;
u_short vend, v, dev;
u_char i, hdr, fn, bus = s->cap.cardbus;
u_char i, hdr, fn;
cb_config_t *c;
bus = s->cap.cb_dev->subordinate;
memset(&tmp, 0, sizeof(tmp));
tmp.bus = s->cap.cb_bus; tmp.devfn = 0;
tmp.bus = bus; tmp.devfn = 0;
printk("bus=%p, number=%d\n", bus, bus->number);
pci_read_config_word(&tmp, PCI_VENDOR_ID, &vend);
pci_read_config_word(&tmp, PCI_DEVICE_ID, &dev);
printk(KERN_INFO "cs: cb_alloc(bus %d): vendor 0x%04x, "
"device 0x%04x\n", bus, vend, dev);
"device 0x%04x\n", bus->number, vend, dev);
pci_read_config_byte(&tmp, PCI_HEADER_TYPE, &hdr);
fn = 1;
if (hdr & 0x80) {
/* Count functions */
for (fn = 0; fn < 8; fn++) {
do {
tmp.devfn = fn;
pci_read_config_word(&tmp, PCI_VENDOR_ID, &v);
if (v != vend) break;
}
} else fn = 1;
fn++;
} while (fn < 8);
}
s->functions = fn;
c = kmalloc(fn * sizeof(struct cb_config_t), GFP_ATOMIC);
if (!c) return CS_OUT_OF_RESOURCE;
memset(c, 0, fn * sizeof(struct cb_config_t));
s->cb_config = c;
for (i = 0; i < fn; i++) {
c[i].dev.bus = s->cap.cb_bus;
c[i].dev.devfn = i;
struct pci_dev *dev = &c[i].dev;
dev->bus = bus;
dev->devfn = i;
if (i < fn-1) {
c[i].dev.sibling = c[i].dev.next = &c[i+1].dev;
dev->sibling = dev->next = &c[i+1].dev;
}
dev->vendor = vend;
pci_read_config_word(dev, PCI_DEVICE_ID, &dev->device);
pci_read_config_dword(dev, PCI_CLASS_REVISION, &dev->class);
dev->class >>= 8;
dev->hdr_type = hdr;
#ifdef CONFIG_PROC_FS
pci_proc_attach_device(dev);
#endif
}
s->cap.cb_bus->devices = &c[0].dev;
/* Link into PCI device chain */
bus->devices = &c[0].dev;
c[fn-1].dev.next = pci_devices;
pci_devices = &c[0].dev;
for (i = 0; i < fn; i++) {
c[i].dev.vendor = vend;
pci_readw(bus, i, PCI_DEVICE_ID, &c[i].dev.device);
pci_readl(bus, i, PCI_CLASS_REVISION, &c[i].dev.class);
c[i].dev.class >>= 8;
c[i].dev.hdr_type = hdr;
#ifdef CONFIG_PROC_FS
pci_proc_attach_device(&c[i].dev);
#endif
}
s->cb_config = c;
return CS_SUCCESS;
}
......@@ -336,6 +341,7 @@ int cb_alloc(socket_info_t *s)
void cb_free(socket_info_t *s)
{
cb_config_t *c = s->cb_config;
struct pci_bus *bus = s->cap.cb_dev->subordinate;
if (c) {
struct pci_dev **p;
......@@ -343,7 +349,7 @@ void cb_free(socket_info_t *s)
p = &pci_devices;
while (*p) {
struct pci_dev * dev = *p;
if (dev->bus != s->cap.cb_bus) {
if (dev->bus != bus) {
p = &dev->next;
continue;
}
......@@ -352,10 +358,10 @@ void cb_free(socket_info_t *s)
pci_proc_detach_device(dev);
#endif
}
s->cap.cb_bus->devices = NULL;
bus->devices = NULL;
kfree(s->cb_config);
s->cb_config = NULL;
printk(KERN_INFO "cs: cb_free(bus %d)\n", s->cap.cardbus);
printk(KERN_INFO "cs: cb_free(bus %d)\n", s->cap.cb_dev->subordinate->number);
}
}
......@@ -375,11 +381,11 @@ int cb_config(socket_info_t *s)
{
cb_config_t *c = s->cb_config;
u_char fn = s->functions;
u_char i, j, bus = s->cap.cardbus, *name;
u_char i, j, bus = s->cap.cb_dev->subordinate->number, *name;
u_int sz, align, m, mask[3], num[3], base[3];
int irq, try, ret;
printk(KERN_INFO "cs: cb_config(bus %d)\n", s->cap.cardbus);
printk(KERN_INFO "cs: cb_config(bus %d)\n", s->cap.cb_dev->subordinate->number);
/* Determine IO and memory space needs */
num[B_IO] = num[B_M1] = num[B_M2] = 0;
......@@ -524,7 +530,7 @@ void cb_release(socket_info_t *s)
{
cb_config_t *c = s->cb_config;
DEBUG(0, "cs: cb_release(bus %d)\n", s->cap.cardbus);
DEBUG(0, "cs: cb_release(bus %d)\n", s->cap.cb_dev->subordinate->number);
if (s->win[0].size > 0)
release_mem_region(s->win[0].base, s->win[0].size);
......@@ -556,7 +562,7 @@ void cb_release(socket_info_t *s)
void cb_enable(socket_info_t *s)
{
u_char i, j, bus = s->cap.cardbus;
u_char i, j, bus = s->cap.cb_dev->subordinate->number;
cb_config_t *c = s->cb_config;
DEBUG(0, "cs: cb_enable(bus %d)\n", bus);
......@@ -630,7 +636,7 @@ void cb_disable(socket_info_t *s)
u_char i;
cb_bridge_map m = { 0, 0, 0, 0xffff };
DEBUG(0, "cs: cb_disable(bus %d)\n", s->cap.cardbus);
DEBUG(0, "cs: cb_disable(bus %d)\n", s->cap.cb_dev->subordinate->number);
/* Turn off bridge windows */
if (s->cb_cis_map.start)
......
......@@ -367,7 +367,7 @@ int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple)
#ifdef CONFIG_CARDBUS
if (s->state & SOCKET_CARDBUS) {
u_int ptr;
pcibios_read_config_dword(s->cap.cardbus, 0, 0x28, &ptr);
pcibios_read_config_dword(s->cap.cb_dev->subordinate->number, 0, 0x28, &ptr);
tuple->CISOffset = ptr & ~7;
SPACE(tuple->Flags) = (ptr & 7);
} else
......
......@@ -46,6 +46,7 @@
#include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/compile.h>
#include <linux/pci.h>
#include <asm/system.h>
#include <asm/irq.h>
......@@ -994,7 +995,7 @@ int pcmcia_get_configuration_info(client_handle_t handle,
config->Function = fn;
config->Vcc = s->socket.Vcc;
config->Vpp1 = config->Vpp2 = s->socket.Vpp;
config->Option = s->cap.cardbus;
config->Option = s->cap.cb_dev->subordinate->number;
if (s->cb_config) {
config->Attributes = CONF_VALID_CLIENT;
config->IntType = INT_CARDBUS;
......
......@@ -1615,7 +1615,7 @@ static void __init add_cb_bridge(int type, struct pci_dev *dev0)
break;
}
request_mem_region(s->cb_phys, 0x1000, "i82365");
s->cap.cb_bus = dev->subordinate;
s->cap.cb_dev = dev;
add_socket(0, 0, type);
}
if (ns == 0) return;
......
......@@ -30,7 +30,7 @@
static struct pci_simple_probe_entry controller_list[] = {
{ PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1225, 0, 0, &yenta_operations },
{ 0x1180, 0x0475, 0, 0, &yenta_operations },
{ 0x1180, 0x0475, 0, 0, &ricoh_operations },
{ 0, 0, 0, 0, NULL }
};
......
......@@ -36,3 +36,5 @@ struct pci_socket_ops {
};
extern struct pci_socket_ops yenta_operations;
extern struct pci_socket_ops ricoh_operations;
This diff is collapsed.
This diff is collapsed.
......@@ -10,7 +10,7 @@ comment 'USB Controllers'
dep_tristate ' UHCI (Intel PIIX4, VIA, and others) support' CONFIG_USB_UHCI \
$CONFIG_USB
dep_tristate ' OHCI-HCD (Compaq, iMacs, OPTi, SiS, and others) support' \
dep_tristate ' OHCI-HCD (Compaq, iMacs, OPTi, SiS, ALi, and others) support' \
CONFIG_USB_OHCI_HCD $CONFIG_USB
comment 'Miscellaneous USB options'
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -438,6 +438,15 @@ extern unsigned long page_unuse(struct page *);
extern int shrink_mmap(int, int);
extern void truncate_inode_pages(struct inode *, loff_t);
/* generic vm_area_ops exported for stackable file systems */
extern int filemap_swapout(struct page * page, struct file *file);
extern pte_t filemap_swapin(struct vm_area_struct * vma,
unsigned long offset, unsigned long entry);
extern int filemap_sync(struct vm_area_struct * vma, unsigned long address,
size_t size, unsigned int flags);
extern struct page *filemap_nopage(struct vm_area_struct * area,
unsigned long address, int no_share);
/*
* GFP bitmasks..
*/
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment