Commit 295ceeb0 authored by Steve French's avatar Steve French

Merge bk://linux.bkbits.net/linux-2.5

into hostme.bitkeeper.com:/repos/c/cifs/linux-2.5cifs
parents ee0d7cac b79c8524
......@@ -46,12 +46,14 @@ root of an EISA bus. The eisa_root_device structure holds a reference
to this device, as well as some parameters for probing purposes.
struct eisa_root_device {
struct list_head node;
struct device *dev; /* Pointer to bridge device */
struct resource *res;
unsigned long bus_base_addr;
int slots; /* Max slot number */
int force_probe; /* Probe even when no slot 0 */
u64 dma_mask; /* from bridge device */
int bus_nr; /* Set by eisa_root_register */
struct resource eisa_root_res; /* ditto */
};
node : used for eisa_root_register internal purpose
......@@ -59,6 +61,8 @@ dev : pointer to the root device
res : root device I/O resource
bus_base_addr : slot 0 address on this bus
slots : max slot number to probe
force_probe : Probe even when slot 0 is empty (no EISA mainboard)
dma_mask : Default DMA mask. Usualy the bridge device dma_mask.
bus_nr : unique bus id, set by eisa_root_register
** Driver :
......@@ -87,7 +91,7 @@ driver : a generic driver, such as described in
Documentation/driver-model/driver.txt. Only .name,
.probe and .remove members are mandatory.
An example is the 3c509 driver :
An example is the 3c59x driver :
static struct eisa_device_id vortex_eisa_ids[] = {
{ "TCM5920", EISA_3C592_OFFSET },
......@@ -116,15 +120,20 @@ encapsulated in a 'struct eisa_device' described as follows :
struct eisa_device {
struct eisa_device_id id;
int slot;
int state;
unsigned long base_addr;
struct resource res;
struct resource res[EISA_MAX_RESOURCES];
u64 dma_mask;
struct device dev; /* generic device */
};
id : EISA id, as read from device. id.driver_data is set from the
matching driver EISA id.
slot : slot number which the device was detected on
res : I/O resource allocated to this device
state : set of flags indicating the state of the device. Current
flags are EISA_CONFIG_ENABLED and EISA_CONFIG_FORCED.
res : set of four 256 bytes I/O regions allocated to this device
dma_mask: DMA mask set from the parent device.
dev : generic device (see Documentation/driver-model/device.txt)
You can get the 'struct eisa_device' from 'struct device' using the
......@@ -140,6 +149,32 @@ void *eisa_get_drvdata (struct eisa_device *edev):
Gets the pointer previously stored into the device's driver_data area.
int eisa_get_region_index (void *addr);
Returns the region number (0 <= x < EISA_MAX_RESOURCES) of a given
address.
** Kernel parameters :
eisa_bus.enable_dev :
A comma-separated list of slots to be enabled, even if the firmware
set the card as disabled. The driver must be able to properly
initialize the device in such conditions.
eisa_bus.disable_dev :
A comma-separated list of slots to be enabled, even if the firmware
set the card as enabled. The driver won't be called to handle this
device.
virtual_root.force_probe :
Force the probing code to probe EISA slots even when it cannot find an
EISA compliant mainboard (nothing appears on slot 0). Defaultd to 0
(don't force), and set to 1 (force probing) when either
CONFIG_ALPHA_JENSEN or CONFIG_EISA_VLB_PRIMING are set.
** Random notes :
Converting an EISA driver to the new API mostly involves *deleting*
......@@ -156,10 +191,13 @@ Unfortunately, most drivers are doing the probing by themselves, and
expect to have explored the whole machine when they exit their probe
routine.
For example, switching your favorite EISA SCSI card to the "hotplug"
model is "the right thing"(tm).
** Thanks :
I'd like to thank the following people for their help :
- Xavier Benigni for lending me a wonderful Alpha Jensen,
- James Bottomley, Jeff Garzik for getting this stuff into the kernel,
- Andries Brouwer for contributing numerous EISA ids,
- Catrin Jones for coping with too many machines at home
- Catrin Jones for coping with far too many machines at home.
/*
* EISA bus support functions for sysfs.
*
* (C) 2002 Marc Zyngier <maz@wild-wind.fr.eu.org>
* (C) 2002, 2003 Marc Zyngier <maz@wild-wind.fr.eu.org>
*
* This code is released under the GPL version 2.
*/
......@@ -10,6 +10,7 @@
#include <linux/device.h>
#include <linux/eisa.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/ioport.h>
......@@ -24,7 +25,7 @@ struct eisa_device_info {
char name[DEVICE_NAME_SIZE];
};
struct eisa_device_info __initdata eisa_table[] = {
static struct eisa_device_info __initdata eisa_table[] = {
#ifdef CONFIG_EISA_NAMES
#include "devlist.h"
#endif
......@@ -32,6 +33,30 @@ struct eisa_device_info __initdata eisa_table[] = {
#define EISA_INFOS (sizeof (eisa_table) / (sizeof (struct eisa_device_info)))
#define EISA_MAX_FORCED_DEV 16
#define EISA_FORCED_OFFSET 2
static int enable_dev[EISA_MAX_FORCED_DEV + EISA_FORCED_OFFSET] = { 1, EISA_MAX_FORCED_DEV, };
static int disable_dev[EISA_MAX_FORCED_DEV + EISA_FORCED_OFFSET] = { 1, EISA_MAX_FORCED_DEV, };
static int is_forced_dev (int *forced_tab,
struct eisa_root_device *root,
struct eisa_device *edev)
{
int i, x;
for (i = 0; i < EISA_MAX_FORCED_DEV; i++) {
if (!forced_tab[EISA_FORCED_OFFSET + i])
return 0;
x = (root->bus_nr << 8) | edev->slot;
if (forced_tab[EISA_FORCED_OFFSET + i] == x)
return 1;
}
return 0;
}
static void __init eisa_name_device (struct eisa_device *edev)
{
int i;
......@@ -92,7 +117,8 @@ static int eisa_bus_match (struct device *dev, struct device_driver *drv)
return 0;
while (strlen (eids->sig)) {
if (!strcmp (eids->sig, edev->id.sig)) {
if (!strcmp (eids->sig, edev->id.sig) &&
edev->state & EISA_CONFIG_ENABLED) {
edev->id.driver_data = eids->driver_data;
return 1;
}
......@@ -132,67 +158,169 @@ static ssize_t eisa_show_sig (struct device *dev, char *buf)
static DEVICE_ATTR(signature, S_IRUGO, eisa_show_sig, NULL);
static int __init eisa_register_device (struct eisa_root_device *root,
static ssize_t eisa_show_state (struct device *dev, char *buf)
{
struct eisa_device *edev = to_eisa_device (dev);
return sprintf (buf,"%d\n", edev->state & EISA_CONFIG_ENABLED);
}
static DEVICE_ATTR(enabled, S_IRUGO, eisa_show_state, NULL);
static int __init eisa_init_device (struct eisa_root_device *root,
struct eisa_device *edev,
char *sig, int slot)
int slot)
{
char *sig;
unsigned long sig_addr;
int i;
sig_addr = SLOT_ADDRESS (root, slot) + EISA_VENDOR_ID_OFFSET;
if (!(sig = decode_eisa_sig (sig_addr)))
return -1; /* No EISA device here */
memcpy (edev->id.sig, sig, EISA_SIG_LEN);
edev->slot = slot;
edev->state = inb (SLOT_ADDRESS (root, slot) + EISA_CONFIG_OFFSET) & EISA_CONFIG_ENABLED;
edev->base_addr = SLOT_ADDRESS (root, slot);
edev->dma_mask = 0xffffffff; /* Default DMA mask */
edev->dma_mask = root->dma_mask; /* Default DMA mask */
eisa_name_device (edev);
edev->dev.parent = root->dev;
edev->dev.bus = &eisa_bus_type;
edev->dev.dma_mask = &edev->dma_mask;
sprintf (edev->dev.bus_id, "%02X:%02X", root->bus_nr, slot);
edev->res.name = edev->dev.name;
for (i = 0; i < EISA_MAX_RESOURCES; i++)
edev->res[i].name = edev->dev.name;
if (is_forced_dev (enable_dev, root, edev))
edev->state = EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED;
if (is_forced_dev (disable_dev, root, edev))
edev->state = EISA_CONFIG_FORCED;
return 0;
}
static int __init eisa_register_device (struct eisa_device *edev)
{
if (device_register (&edev->dev))
return -1;
device_create_file (&edev->dev, &dev_attr_signature);
device_create_file (&edev->dev, &dev_attr_enabled);
return 0;
}
static int __init eisa_request_resources (struct eisa_root_device *root,
struct eisa_device *edev,
int slot)
{
int i;
for (i = 0; i < EISA_MAX_RESOURCES; i++) {
/* Don't register resource for slot 0, since this is
* very likely to fail... :-( Instead, grab the EISA
* id, now we can display something in /proc/ioports.
*/
/* Only one region for mainboard */
if (!slot && i > 0) {
edev->res[i].start = edev->res[i].end = 0;
continue;
}
if (slot) {
edev->res[i].name = NULL;
edev->res[i].start = SLOT_ADDRESS (root, slot) + (i * 0x400);
edev->res[i].end = edev->res[i].start + 0xff;
edev->res[i].flags = IORESOURCE_IO;
} else {
edev->res[i].name = NULL;
edev->res[i].start = SLOT_ADDRESS (root, slot) + EISA_VENDOR_ID_OFFSET;
edev->res[i].end = edev->res[i].start + 3;
edev->res[i].flags = IORESOURCE_BUSY;
}
if (request_resource (root->res, &edev->res[i]))
goto failed;
}
return 0;
failed:
while (--i >= 0)
release_resource (&edev->res[i]);
return -1;
}
static void __init eisa_release_resources (struct eisa_device *edev)
{
int i;
for (i = 0; i < EISA_MAX_RESOURCES; i++)
if (edev->res[i].start || edev->res[i].end)
release_resource (&edev->res[i]);
}
static int __init eisa_probe (struct eisa_root_device *root)
{
int i, c;
char *str;
unsigned long sig_addr;
struct eisa_device *edev;
printk (KERN_INFO "EISA: Probing bus %d at %s\n",
root->bus_nr, root->dev->name);
for (c = 0, i = 0; i <= root->slots; i++) {
/* First try to get hold of slot 0. If there is no device
* here, simply fail, unless root->force_probe is set. */
if (!(edev = kmalloc (sizeof (*edev), GFP_KERNEL))) {
printk (KERN_ERR "EISA: Out of memory for slot %d\n",
i);
continue;
printk (KERN_ERR "EISA: Couldn't allocate mainboard slot\n");
return -ENOMEM;
}
memset (edev, 0, sizeof (*edev));
/* Don't register resource for slot 0, since this is
* very likely to fail... :-( Instead, grab the EISA
* id, now we can display something in /proc/ioports.
*/
if (eisa_request_resources (root, edev, 0)) {
printk (KERN_WARNING \
"EISA: Cannot allocate resource for mainboard\n");
kfree (edev);
if (!root->force_probe)
return -EBUSY;
goto force_probe;
}
if (i) {
edev->res.name = NULL;
edev->res.start = SLOT_ADDRESS (root, i);
edev->res.end = edev->res.start + 0xfff;
edev->res.flags = IORESOURCE_IO;
} else {
edev->res.name = NULL;
edev->res.start = SLOT_ADDRESS (root, i) + EISA_VENDOR_ID_OFFSET;
edev->res.end = edev->res.start + 3;
edev->res.flags = IORESOURCE_BUSY;
if (eisa_init_device (root, edev, 0)) {
eisa_release_resources (edev);
kfree (edev);
if (!root->force_probe)
return -ENODEV;
goto force_probe;
}
if (request_resource (root->res, &edev->res)) {
printk (KERN_INFO "EISA: Mainboard %s detected.\n", edev->id.sig);
if (eisa_register_device (edev)) {
printk (KERN_ERR "EISA: Failed to register %s\n",
edev->id.sig);
eisa_release_resources (edev);
kfree (edev);
}
force_probe:
for (c = 0, i = 1; i <= root->slots; i++) {
if (!(edev = kmalloc (sizeof (*edev), GFP_KERNEL))) {
printk (KERN_ERR "EISA: Out of memory for slot %d\n",
i);
continue;
}
memset (edev, 0, sizeof (*edev));
if (eisa_request_resources (root, edev, i)) {
printk (KERN_WARNING \
"Cannot allocate resource for EISA slot %d\n",
i);
......@@ -200,30 +328,41 @@ static int __init eisa_probe (struct eisa_root_device *root)
continue;
}
sig_addr = SLOT_ADDRESS (root, i) + EISA_VENDOR_ID_OFFSET;
if (!(str = decode_eisa_sig (sig_addr))) {
release_resource (&edev->res);
if (eisa_init_device (root, edev, i)) {
eisa_release_resources (edev);
kfree (edev);
continue;
}
if (!i)
printk (KERN_INFO "EISA: Motherboard %s detected\n",
str);
else {
printk (KERN_INFO "EISA: slot %d : %s detected.\n",
i, str);
printk (KERN_INFO "EISA: slot %d : %s detected",
i, edev->id.sig);
c++;
switch (edev->state) {
case EISA_CONFIG_ENABLED | EISA_CONFIG_FORCED:
printk (" (forced enabled)");
break;
case EISA_CONFIG_FORCED:
printk (" (forced disabled)");
break;
case 0:
printk (" (disabled)");
break;
}
if (eisa_register_device (root, edev, str, i)) {
printk (KERN_ERR "EISA: Failed to register %s\n", str);
release_resource (&edev->res);
printk (".\n");
c++;
if (eisa_register_device (edev)) {
printk (KERN_ERR "EISA: Failed to register %s\n",
edev->id.sig);
eisa_release_resources (edev);
kfree (edev);
}
}
printk (KERN_INFO "EISA: Detected %d card%s.\n", c, c == 1 ? "" : "s");
return 0;
......@@ -274,6 +413,13 @@ static int __init eisa_init (void)
return 0;
}
/* Couldn't use intarray with checking on... :-( */
#undef param_check_intarray
#define param_check_intarray(name, p)
module_param(enable_dev, intarray, 0444);
module_param(disable_dev, intarray, 0444);
postcore_initcall (eisa_init);
EXPORT_SYMBOL (eisa_bus_type);
......
......@@ -504,6 +504,7 @@ DTK0001 "DTK PLM-3300I 80486 EISA Board"
DTK0003 "DTK PLM-3331P EISACACHE486 33/25/50 MHZ"
ECS0580 "DI-580A EISA SCSI Host Adapter"
ECS0590 "DI-590 EISA SCSI Cache Host Adapter"
EGL0101 "Eagle Technology EP3210 EtherXpert EISA Adapter"
ELS8041 "ELSA WINNER 1000 Enhanced VGA"
ETI1001 "NE3300 Ethernet Rev. C & D"
EVX0002 "PN-3000 System Board"
......@@ -515,6 +516,9 @@ FIX1516 "15-16MB Memory Hole Patch - Netserver LF/LC 5/66"
FSI2001 "ESA-200 ATM"
FSI2002 "ESA-200A ATM"
FSI2003 "ESA-200E ATM"
GCI0101 "Gateway G/Ethernet 32EB -- 32-Bit EISA Bus Master Ethernet Adpater"
GCI0102 "Gateway G/Ethernet 32EB -- 32-Bit EISA Bus Master Ethernet Adapter"
GCI0103 "Gateway G/Ethernet 32EB -- 32-Bit EISA Bus Master Ethernet Adapter"
GDT2001 "GDT2000/GDT2020 Fast-SCSI Cache Controller - Rev. 1.0"
GDT3001 "GDT3000/GDT3020 Dual Channel SCSI Controller - Rev. 1.0"
GDT3002 "GDT30x0A Cache Controller"
......@@ -1138,12 +1142,14 @@ NON0501 "c't Universal 16-Bit Sound Adapter"
NON0601 "c't Universal 8-Bit Adapter"
NSS0011 "Newport Systems Solutions WNIC Adapter"
NVL0701 "Novell NE3200 Bus Master Ethernet"
NVL0702 "Novell NE3200T Bus Master Ethernet"
NVL0901 "Novell NE2100 Ethernet/Cheapernet Adapter"
NVL1001 "Novell NMSL (Netware Mirrored Server Link)"
NVL1201 "Novell NE32HUB 32-bit Base EISA Adapter"
NVL1301 "Novell NE32HUB 32-bit TPE EISA Adapter"
NVL1401 "Novell NE32HUB PME ISA Adapter"
NVL1501 "Novell NE2000PLUS Ethernet Adapter"
NVL1801 "Eagle Technology NE3210 EISA Ethernet LAN Adapter"
OLC0701 "Olicom ISA 16/4 Token-Ring Network Adapter"
OLC0702 "Olicom OC-3117, ISA 16/4 Adapter (NIC)"
OLC0801 "OC-3118 Olicom ISA 16/4 Token-Ring Network Adapter"
......
......@@ -35,6 +35,7 @@ static int __devinit pci_eisa_init (struct pci_dev *pdev,
pci_eisa_root.res = pdev->bus->resource[0];
pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start;
pci_eisa_root.slots = EISA_MAX_SLOTS;
pci_eisa_root.dma_mask = pdev->dma_mask;
if (eisa_root_register (&pci_eisa_root)) {
printk (KERN_ERR "pci_eisa : Could not register EISA root\n");
......
......@@ -7,12 +7,22 @@
* This code is released under the GPL version 2.
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/eisa.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#if defined(CONFIG_ALPHA_JENSEN) || defined(CONFIG_EISA_VLB_PRIMING)
#define EISA_FORCE_PROBE_DEFAULT 1
#else
#define EISA_FORCE_PROBE_DEFAULT 0
#endif
static int force_probe = EISA_FORCE_PROBE_DEFAULT;
/* The default EISA device parent (virtual root device).
* Now use a platform device, since that's the obvious choice. */
......@@ -29,6 +39,7 @@ static struct eisa_root_device eisa_bus_root = {
.bus_base_addr = 0,
.res = &ioport_resource,
.slots = EISA_MAX_SLOTS,
.dma_mask = 0xffffffff,
};
static int virtual_eisa_root_init (void)
......@@ -39,6 +50,8 @@ static int virtual_eisa_root_init (void)
return r;
}
eisa_bus_root.force_probe = force_probe;
eisa_root_dev.dev.driver_data = &eisa_bus_root;
if (eisa_root_register (&eisa_bus_root)) {
......@@ -51,4 +64,6 @@ static int virtual_eisa_root_init (void)
return 0;
}
module_param (force_probe, int, 0444);
device_initcall (virtual_eisa_root_init);
......@@ -212,13 +212,6 @@ static int irtty_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)
/* called from sir_dev when there is more data to send
* context is either netdev->hard_xmit or some transmit-completion bh
* i.e. we are under spinlock here and must not sleep.
*
* Note: as of 2.5.44 the usb-serial driver calls down() on a semaphore
* hence we are hitting the might_sleep bugcatcher. IMHO the whole tty-api
* would be pretty pointless if write_room/write would be allowed to sleep.
* Furthermore other tty ldiscs (like ppp) do also require the driver not
* to sleep there. Hence this is considered a current limitation of
* usb-serial.
*/
static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t len)
......@@ -269,16 +262,15 @@ static void irtty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
struct sirtty_cb *priv = tty->disc_data;
int i;
if (unlikely(!priv || priv->magic!=IRTTY_MAGIC))
return;
/* Please use ASSERT - Fix ASSERT as needed - Jean II */
ASSERT(priv != NULL, return;);
ASSERT(priv->magic == IRTTY_MAGIC, return;);
if (unlikely(count==0)) /* yes, this happens */
return;
dev = priv->dev;
if (!dev) {
printk(KERN_ERR "%s(), not ready yet!\n", __FUNCTION__);
WARNING("%s(), not ready yet!\n", __FUNCTION__);
return;
}
......@@ -306,8 +298,8 @@ static int irtty_receive_room(struct tty_struct *tty)
{
struct sirtty_cb *priv = tty->disc_data;
if (unlikely(!priv || priv->magic!=IRTTY_MAGIC))
return 0;
ASSERT(priv != NULL, return 0;);
ASSERT(priv->magic == IRTTY_MAGIC, return 0;);
return 65536; /* We can handle an infinite amount of data. :-) */
}
......@@ -323,8 +315,8 @@ static void irtty_write_wakeup(struct tty_struct *tty)
{
struct sirtty_cb *priv = tty->disc_data;
if (unlikely(!priv || priv->magic!=IRTTY_MAGIC))
return;
ASSERT(priv != NULL, return;);
ASSERT(priv->magic == IRTTY_MAGIC, return;);
tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
......@@ -559,7 +551,7 @@ static int irtty_open(struct tty_struct *tty)
up(&irtty_sem);
printk(KERN_INFO "%s - done\n", __FUNCTION__);
IRDA_DEBUG(0, "%s - %s: irda line discipline opened\n", __FUNCTION__, tty->name);
return 0;
......@@ -580,8 +572,8 @@ static void irtty_close(struct tty_struct *tty)
{
struct sirtty_cb *priv = tty->disc_data;
if (!priv || priv->magic != IRTTY_MAGIC)
return;
ASSERT(priv != NULL, return;);
ASSERT(priv->magic == IRTTY_MAGIC, return;);
/* Hm, with a dongle attached the dongle driver wants
* to close the dongle - which requires the use of
......@@ -610,6 +602,8 @@ static void irtty_close(struct tty_struct *tty)
tty->driver->stop(tty);
kfree(priv);
IRDA_DEBUG(0, "%s - %s: irda line discipline closed\n", __FUNCTION__, tty->name);
}
/* ------------------------------------------------------- */
......
......@@ -201,14 +201,12 @@ void sirdev_write_complete(struct sir_dev *dev)
int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count)
{
if (!dev || !dev->netdev) {
IRDA_DEBUG(0, "%s(), not ready yet!\n", __FUNCTION__);
/* Use WARNING instead of IRDA_DEBUG */
WARNING("%s(), not ready yet!\n", __FUNCTION__);
return -1;
}
if (!dev->irlap) {
IRDA_DEBUG(0, "%s - too early: %p / %d!\n", __FUNCTION__, cp, count);
/* Use WARNING instead of IRDA_DEBUG */
WARNING("%s - too early: %p / %d!\n", __FUNCTION__, cp, count);
return -1;
}
......@@ -218,7 +216,7 @@ int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count)
*/
irda_device_set_media_busy(dev->netdev, TRUE);
dev->stats.rx_dropped++;
printk(KERN_INFO "%s; rx-drop: %d\n", __FUNCTION__, count);
IRDA_DEBUG(0, "%s; rx-drop: %d\n", __FUNCTION__, count);
return 0;
}
......@@ -431,7 +429,6 @@ static int sirdev_alloc_buffers(struct sir_dev *dev)
return -ENOMEM;
skb_reserve(dev->rx_buff.skb, 1);
dev->rx_buff.head = dev->rx_buff.skb->data;
/* No need to memset the buffer, unless you are really pedantic */
dev->tx_buff.head = kmalloc(dev->tx_buff.truesize, GFP_KERNEL);
if (dev->tx_buff.head == NULL) {
......@@ -439,8 +436,6 @@ static int sirdev_alloc_buffers(struct sir_dev *dev)
dev->rx_buff.skb = NULL;
dev->rx_buff.head = NULL;
return -ENOMEM;
/* Hu ??? This should not be here, Martin ? */
memset(dev->tx_buff.head, 0, dev->tx_buff.truesize);
}
dev->tx_buff.data = dev->tx_buff.head;
......@@ -492,7 +487,7 @@ static int sirdev_open(struct net_device *ndev)
netif_wake_queue(ndev);
printk(KERN_INFO "%s - done, speed = %d\n", __FUNCTION__, dev->speed);
IRDA_DEBUG(2, "%s - done, speed = %d\n", __FUNCTION__, dev->speed);
return 0;
......@@ -512,7 +507,7 @@ static int sirdev_close(struct net_device *ndev)
struct sir_dev *dev = ndev->priv;
const struct sir_driver *drv;
printk(KERN_INFO "%s\n", __FUNCTION__);
// IRDA_DEBUG(0, "%s\n", __FUNCTION__);
netif_stop_queue(ndev);
......@@ -570,7 +565,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
struct net_device *ndev;
struct sir_dev *dev;
printk(KERN_INFO "%s - %s\n", __FUNCTION__, name);
IRDA_DEBUG(0, "%s - %s\n", __FUNCTION__, name);
/* instead of adding tests to protect against drv->do_write==NULL
* at several places we refuse to create a sir_dev instance for
......@@ -584,8 +579,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
*/
dev = kmalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) {
printk(KERN_ERR "IrDA: Can't allocate memory for "
"IrDA control block!\n");
ERROR("%s - Can't allocate memory for IrDA control block!\n", __FUNCTION__);
goto out;
}
memset(dev, 0, sizeof(*dev));
......@@ -638,7 +632,7 @@ int sirdev_put_instance(struct sir_dev *dev)
{
int err = 0;
printk(KERN_INFO "%s\n", __FUNCTION__);
IRDA_DEBUG(0, "%s\n", __FUNCTION__);
atomic_set(&dev->enable_rx, 0);
......
......@@ -19,6 +19,7 @@
#include <linux/smp_lock.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/suspend.h>
#include <net/irda/irda.h>
......@@ -107,44 +108,12 @@ static void run_irda_queue(void)
spin_unlock_irqrestore(&irda_rq_queue.lock, flags);
}
static int irda_rt_prio = 0; /* MODULE_PARM? */
static int irda_thread(void *startup)
{
DECLARE_WAITQUEUE(wait, current);
daemonize("kIrDAd");
set_fs(KERNEL_DS);
if (irda_rt_prio > 0) {
#if 0 /* works but requires EXPORT_SYMBOL(setscheduler) */
struct sched_param param;
param.sched_priority = irda_rt_prio;
setscheduler(0, SCHED_FIFO, &param);
#endif
#if 0 /* doesn't work - has some tendency to trigger instant reboot!
* looks like we would have to deactivate current on the
* runqueue - which is only possible inside of kernel/sched.h
*/
/* runqueues are per-cpu and we are current on this cpu. Hence
* The tasklist_lock with irq-off protects our runqueue too
* and we don't have to lock it (which would be impossible,
* because it is private in kernel/sched.c)
*/
read_lock_irq(&tasklist_lock);
current->rt_priority = (irda_rt_prio<MAX_RT_PRIO)
? irda_rt_prio : MAX_RT_PRIO-1;
current->policy = SCHED_FIFO;
current->prio = MAX_USER_RT_PRIO-1 - irda_rt_prio;
read_unlock_irq(&tasklist_lock);
#endif
}
irda_rq_queue.thread = current;
complete((struct completion *)startup);
......@@ -166,6 +135,10 @@ static int irda_thread(void *startup)
set_task_state(current, TASK_RUNNING);
remove_wait_queue(&irda_rq_queue.kick, &wait);
/* make swsusp happy with our thread */
if (current->flags & PF_FREEZE)
refrigerator(PF_IOTHREAD);
run_irda_queue();
}
......@@ -442,7 +415,6 @@ static void irda_config_fsm(void *data)
case SIRDEV_STATE_COMPLETE:
/* config change finished, so we are not busy any longer */
sirdev_enable_rx(dev);
printk(KERN_INFO "%s - up\n", __FUNCTION__);
up(&fsm->sem);
return;
}
......@@ -462,9 +434,7 @@ int sirdev_schedule_request(struct sir_dev *dev, int initial_state, unsigned par
struct sir_fsm *fsm = &dev->fsm;
int xmit_was_down;
// IRDA_DEBUG(2, "%s - state=0x%04x / param=%u\n", __FUNCTION__, initial_state, param);
printk(KERN_INFO "%s - state=0x%04x / param=%u\n", __FUNCTION__, initial_state, param);
IRDA_DEBUG(2, "%s - state=0x%04x / param=%u\n", __FUNCTION__, initial_state, param);
if (in_interrupt()) {
if (down_trylock(&fsm->sem)) {
......@@ -474,12 +444,10 @@ int sirdev_schedule_request(struct sir_dev *dev, int initial_state, unsigned par
}
else
down(&fsm->sem);
printk(KERN_INFO "%s - down\n", __FUNCTION__);
if (fsm->state == SIRDEV_STATE_DEAD) {
/* race with sirdev_close should never happen */
ERROR("%s(), instance staled!\n", __FUNCTION__);
printk(KERN_INFO "%s - up\n", __FUNCTION__);
up(&fsm->sem);
return -ESTALE; /* or better EPIPE? */
}
......@@ -501,7 +469,6 @@ int sirdev_schedule_request(struct sir_dev *dev, int initial_state, unsigned par
atomic_set(&dev->enable_rx, 1);
if (!xmit_was_down)
netif_wake_queue(dev->netdev);
printk(KERN_INFO "%s - up\n", __FUNCTION__);
up(&fsm->sem);
return -EAGAIN;
}
......
......@@ -378,20 +378,22 @@ static int __devinit eisa_probe(struct parisc_device *dev)
}
}
eisa_eeprom_init(eisa_dev.eeprom_addr);
eisa_enumerator(eisa_dev.eeprom_addr, &eisa_dev.hba.io_space, &eisa_dev.hba.lmmio_space);
result = eisa_enumerator(eisa_dev.eeprom_addr, &eisa_dev.hba.io_space, &eisa_dev.hba.lmmio_space);
init_eisa_pic();
/* FIXME : Get the number of slots from the enumerator, not a
* hadcoded value. Also don't enumerate the bus twice. */
if (result >= 0) {
/* FIXME : Don't enumerate the bus twice. */
eisa_dev.root.dev = &dev->dev;
dev->dev.driver_data = &eisa_dev.root;
eisa_dev.root.bus_base_addr = 0;
eisa_dev.root.res = &eisa_dev.hba.io_space;
eisa_dev.root.slots = EISA_MAX_SLOTS;
eisa_dev.root.slots = result;
eisa_dev.root.dma_mask = 0xffffffff; /* wild guess */
if (eisa_root_register (&eisa_dev.root)) {
printk(KERN_ERR "EISA: Failed to register EISA root\n");
return -1;
}
}
return 0;
}
......
......@@ -438,6 +438,10 @@ static int init_slot(int slot, struct eeprom_eisa_slot_info *es)
id = le32_to_cpu(inl(SLOT2PORT(slot)+EPI));
if (0xffffffff == id) {
/* Maybe we didn't expect a card to be here... */
if (es->eisa_slot_id == 0xffffffff)
return -1;
/* this board is not here or it does not
* support readid
*/
......@@ -499,8 +503,7 @@ int eisa_enumerator(unsigned long eeprom_addr,
(&eeprom_buf[HPEE_SLOT_INFO(i)]);
if (-1==init_slot(i+1, es)) {
return -1;
continue;
}
if (es->config_data_offset < HPEE_MAX_LENGTH) {
......@@ -513,6 +516,6 @@ int eisa_enumerator(unsigned long eeprom_addr,
return -1;
}
}
return 0;
return eh->num_slots;
}
......@@ -646,7 +646,7 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED;
sdev->use_10_for_rw = 1;
sdev->use_10_for_ms = 1;
sdev->use_10_for_ms = 0;
if(sdev->host->hostt->slave_configure)
sdev->host->hostt->slave_configure(sdev);
......
......@@ -4,6 +4,8 @@
#define EISA_SIG_LEN 8
#define EISA_MAX_SLOTS 8
#define EISA_MAX_RESOURCES 4
/* A few EISA constants/offsets... */
#define EISA_DMA1_STATUS 8
......@@ -17,6 +19,10 @@
#define EISA_INT1_EDGE_LEVEL 0x4D0
#define EISA_INT2_EDGE_LEVEL 0x4D1
#define EISA_VENDOR_ID_OFFSET 0xC80
#define EISA_CONFIG_OFFSET 0xC84
#define EISA_CONFIG_ENABLED 1
#define EISA_CONFIG_FORCED 2
/* The EISA signature, in ASCII form, null terminated */
struct eisa_device_id {
......@@ -26,19 +32,28 @@ struct eisa_device_id {
/* There is not much we can say about an EISA device, apart from
* signature, slot number, and base address. dma_mask is set by
* default to 32 bits.*/
* default to parent device mask..*/
struct eisa_device {
struct eisa_device_id id;
int slot;
int state;
unsigned long base_addr;
struct resource res;
struct resource res[EISA_MAX_RESOURCES];
u64 dma_mask;
struct device dev; /* generic device */
};
#define to_eisa_device(n) container_of(n, struct eisa_device, dev)
static inline int eisa_get_region_index (void *addr)
{
unsigned long x = (unsigned long) addr;
x &= 0xc00;
return (x >> 12);
}
struct eisa_driver {
const struct eisa_device_id *id_table;
struct device_driver driver;
......@@ -69,6 +84,8 @@ struct eisa_root_device {
struct resource *res;
unsigned long bus_base_addr;
int slots; /* Max slot number */
int force_probe; /* Probe even when no slot 0 */
u64 dma_mask; /* from bridge device */
int bus_nr; /* Set by eisa_root_register */
struct resource eisa_root_res; /* ditto */
};
......
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