33 #include <linux/kernel.h>
34 #include <linux/module.h>
35 #include <linux/pci.h>
39 #include <asm/byteorder.h>
42 #include <asm/processor.h>
44 #include <asm/delay.h>
49 #define EISA_DBG(msg, arg... ) printk(KERN_DEBUG "eisa: " msg , ## arg )
51 #define EISA_DBG(msg, arg... )
54 #define SNAKES_EEPROM_BASE_ADDR 0xF0810400
55 #define MIRAGE_EEPROM_BASE_ADDR 0xF00C0400
64 static struct eisa_ba {
66 unsigned long eeprom_addr;
72 static inline unsigned long eisa_permute(
unsigned short port)
75 return 0xfc000000 | ((port & 0xfc00) >> 6)
76 | ((port & 0x3f8) << 9) | (port & 7);
78 return 0xfc000000 |
port;
85 return gsc_readb(eisa_permute(port));
106 gsc_writeb(data, eisa_permute(port));
134 static int master_mask;
135 static int slave_mask;
147 static void eisa_mask_irq(
struct irq_data *
d)
149 unsigned int irq = d->
irq;
156 slave_mask |= (1 << (irq&7));
159 master_mask |= (1 << (irq&7));
162 spin_unlock_irqrestore(&eisa_irq_lock, flags);
168 static void eisa_unmask_irq(
struct irq_data *d)
170 unsigned int irq = d->
irq;
176 slave_mask &= ~(1 << (irq&7));
179 master_mask &= ~(1 << (irq&7));
182 spin_unlock_irqrestore(&eisa_irq_lock, flags);
187 static struct irq_chip eisa_interrupt_type = {
189 .irq_unmask = eisa_unmask_irq,
190 .irq_mask = eisa_mask_irq,
193 static irqreturn_t eisa_irq(
int wax_irq,
void *intr_dev)
195 int irq = gsc_readb(0xfc01f000);
203 EISA_DBG(
"irq IAR %02x 8259-1 irr %02x 8259-2 irr %02x\n",
209 EISA_DBG(
"irq 8259-1 isr %02x imr %02x 8259-2 isr %02x imr %02x\n",
216 slave_mask |= (1 << (irq&7));
222 master_mask |= (1 << (irq&7));
226 spin_unlock_irqrestore(&eisa_irq_lock, flags);
233 slave_mask &= ~(1 << (irq&7));
236 master_mask &= ~(1 << (irq&7));
239 spin_unlock_irqrestore(&eisa_irq_lock, flags);
250 .handler = dummy_irq2_handler,
254 static void init_eisa_pic(
void)
285 EISA_DBG(
"EISA edge/level %04x\n", eisa_irq_level);
288 eisa_out8((eisa_irq_level >> 8) & 0xff, 0x4d1);
295 spin_unlock_irqrestore(&eisa_irq_lock, flags);
300 #define is_mongoose(dev) (dev->id.sversion == 0x00076)
309 name, (
unsigned long)dev->
hpa.start);
311 eisa_dev.hba.dev =
dev;
314 eisa_dev.hba.lmmio_space.name =
"EISA";
315 eisa_dev.hba.lmmio_space.start =
F_EXTEND(0xfc000000);
316 eisa_dev.hba.lmmio_space.end =
F_EXTEND(0xffbfffff);
320 printk(
KERN_ERR "EISA: failed to claim EISA Bus address space!\n");
323 eisa_dev.hba.io_space.name =
"EISA";
324 eisa_dev.hba.io_space.start = 0;
325 eisa_dev.hba.io_space.end = 0xffff;
342 for (i = 0; i < 16; i++) {
343 irq_set_chip_and_handler(i, &eisa_interrupt_type,
351 eisa_dev.eeprom_addr = dev->
addr[0];
362 &eisa_dev.hba.lmmio_space);
367 eisa_dev.root.dev = &dev->
dev;
369 eisa_dev.root.bus_base_addr = 0;
370 eisa_dev.root.res = &eisa_dev.hba.io_space;
371 eisa_dev.root.slots =
result;
372 eisa_dev.root.dma_mask = 0xffffffff;
402 static unsigned int eisa_irq_configured;
405 if (eisa_irq_configured& (1<<num)) {
407 "IRQ %d polarity configured twice (last to level)\n",
410 eisa_irq_level |= (1<<num);
411 eisa_irq_configured |= (1<<num);
416 if (eisa_irq_configured& (1<<num)) {
418 "IRQ %d polarity configured twice (last to edge)\n",
421 eisa_irq_level &= ~(1<<num);
422 eisa_irq_configured |= (1<<num);
425 static int __init eisa_irq_setup(
char *
str)
431 while (cur !=
NULL) {
435 if (val > 15 || val < 0) {
443 EISA_DBG(
"setting IRQ %d to edge-triggered mode\n", val);
445 if ((cur =
strchr(cur,
','))) {
454 __setup(
"eisa_irq_edge=", eisa_irq_setup);