diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-02-16 01:07:24 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-02-16 01:07:24 +0000 |
commit | 95db6b748fc86297827fbd9c9ef174d491c9ad89 (patch) | |
tree | 27a92a942821cde1edda9a1b088718d436b3efe4 /drivers/pnp/isapnp.c | |
parent | 45b27b0a0652331d104c953a5b192d843fff88f8 (diff) |
Merge with Linux 2.3.40.
Diffstat (limited to 'drivers/pnp/isapnp.c')
-rw-r--r-- | drivers/pnp/isapnp.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/drivers/pnp/isapnp.c b/drivers/pnp/isapnp.c index 8b6a42b7d..ec81da498 100644 --- a/drivers/pnp/isapnp.c +++ b/drivers/pnp/isapnp.c @@ -18,7 +18,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Changelog: - * 2000-01-01 Added ISAPnP quirks handling + * 2000-01-01 Added quirks handling for buggy hardware * Peter Denison <peterd@pnd-pc.demon.co.uk> */ @@ -30,31 +30,17 @@ #include <linux/ioport.h> #include <linux/string.h> #include <linux/malloc.h> -#include <linux/proc_fs.h> #include <linux/delay.h> #include <asm/io.h> #include <asm/dma.h> #include <asm/irq.h> #include <linux/pci.h> -#include <linux/vmalloc.h> -#include <linux/poll.h> #include <linux/init.h> -#include <asm/uaccess.h> #include <linux/isapnp.h> LIST_HEAD(isapnp_cards); LIST_HEAD(isapnp_devices); -#define isapnp_for_each_card(card) \ - for(card = pci_bus_b(isapnp_cards.next); card != pci_bus_b(&isapnp_cards); card = pci_bus_b(card->node.next)) -#define isapnp_for_each_dev(dev) \ - for(dev = pci_dev_g(isapnp_devices.next); dev != pci_dev_g(&isapnp_devices); dev = pci_dev_g(dev->global_list.next)) - - -#ifdef CONFIG_PROC_FS -#include "isapnp_proc.c" -#endif - #if 0 #define ISAPNP_REGION_OK #endif @@ -286,6 +272,12 @@ static int isapnp_next_rdp(void) return 0; } rdp += RDP_STEP; + /* + * We cannot use NE2000 probe spaces for ISAPnP or we + * will lock up machines. + */ + if(rdp >= 0x280 && rdp <= 0x380) + continue; } return -1; } @@ -298,12 +290,8 @@ static inline void isapnp_set_rdp(void) } /* - * This code is badly broken. We cannot simply pick ports as the - * ISAPnP specification implies. We should try 4 or 5 safe ports - * then bale by default. - * - * This code touches NE2K cards or other devices and your box is - * history. + * Perform an isolation. The port selection code now tries to avoid + * "dangerous to read" ports. */ static int __init isapnp_isolate_rdp_select(void) @@ -996,6 +984,8 @@ static int __init isapnp_build_device_list(void) card->device = (header[3] << 8) | header[2]; card->serial = (header[7] << 24) | (header[6] << 16) | (header[5] << 8) | header[4]; isapnp_checksum_value = 0x00; + INIT_LIST_HEAD(&card->children); + INIT_LIST_HEAD(&card->devices); isapnp_parse_resource_map(card); if (isapnp_checksum_value != 0x00) printk("isapnp: checksum for device %i is not valid (0x%x)\n", csn, isapnp_checksum_value); @@ -1196,10 +1186,11 @@ struct pci_dev *isapnp_find_dev(struct pci_bus *card, struct list_head *list; list = card->devices.next; - if (from) + if (from) { list = from->bus_list.next; - if (from->bus != card) /* something is wrong */ - return NULL; + if (from->bus != card) /* something is wrong */ + return NULL; + } while (list != &card->devices) { int idx; struct pci_dev *dev = pci_dev_b(list); @@ -1633,7 +1624,10 @@ static int isapnp_check_dma(struct isapnp_cfgtmp *cfg, int dma, int idx) int i; struct pci_dev *dev; - if (dma < 0 || dma == 4 || dma > 7) + /* Some machines allow DMA 0, but others don't. In fact on some + boxes DMA 0 is the memory refresh. Play safe */ + + if (dma < 1 || dma == 4 || dma > 7) return 1; for (i = 0; i < 8; i++) { if (isapnp_reserve_dma[i] == dma) @@ -1773,8 +1767,8 @@ static int isapnp_valid_mem(struct isapnp_cfgtmp *cfg, int idx) mem = cfg->mem[idx]; if (!mem) return -EINVAL; - value1 = &cfg->result.resource[idx].start; - value2 = &cfg->result.resource[idx].end; + value1 = &cfg->result.resource[idx + 8].start; + value2 = &cfg->result.resource[idx + 8].end; if (cfg->result.resource[idx + 8].flags & IORESOURCE_AUTO) { cfg->result.resource[idx + 8].flags &= ~IORESOURCE_AUTO; *value1 = mem->min; @@ -1785,7 +1779,7 @@ static int isapnp_valid_mem(struct isapnp_cfgtmp *cfg, int idx) do { *value1 += mem->align; *value2 = *value1 + mem->size - 1; - if (*value1 >= 8 || !mem->align) { + if (*value1 > mem->max || !mem->align) { if (mem->res && mem->res->alt) { if ((err = isapnp_alternative_switch(cfg, mem->res, mem->res->alt))<0) return err; |