void mca_write_pos(int slot, int reg, unsigned char byte) { struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) return; mca_device_write_pos(mca_dev, reg, byte); }
/* Detect a D700 card. Note, because of the setup --- the chips are * essentially connectecd to the MCA bus independently, it is easier * to set them up as two separate host adapters, rather than one * adapter with two channels */ static int __devinit NCR_D700_probe(struct device *dev) { struct NCR_D700_private *p; int differential; static int banner = 1; struct mca_device *mca_dev = to_mca_device(dev); int slot = mca_dev->slot; int found = 0; int irq, i; int pos3j, pos3k, pos3a, pos3b, pos4; __u32 base_addr, offset_addr; /* enable board interrupt */ pos4 = mca_device_read_pos(mca_dev, 4); pos4 |= 0x4; mca_device_write_pos(mca_dev, 4, pos4); mca_device_write_pos(mca_dev, 6, 9); pos3j = mca_device_read_pos(mca_dev, 3); mca_device_write_pos(mca_dev, 6, 10); pos3k = mca_device_read_pos(mca_dev, 3); mca_device_write_pos(mca_dev, 6, 0); pos3a = mca_device_read_pos(mca_dev, 3); mca_device_write_pos(mca_dev, 6, 1); pos3b = mca_device_read_pos(mca_dev, 3); base_addr = ((pos3j << 8) | pos3k) & 0xfffffff0; offset_addr = ((pos3a << 8) | pos3b) & 0xffffff70; irq = (pos4 & 0x3) + 11; if(irq >= 13) irq++; if(banner) { // printk(KERN_NOTICE "NCR D700: Driver Version " NCR_D700_VERSION "\n" // "NCR D700: Copyright (c) 2001 by [email protected]\n" ; banner = 0; } /* now do the bus related transforms */ irq = mca_device_transform_irq(mca_dev, irq); base_addr = mca_device_transform_ioport(mca_dev, base_addr); offset_addr = mca_device_transform_ioport(mca_dev, offset_addr); ; /*outb(BOARD_RESET, base_addr);*/ /* clear any pending interrupts */ (void)inb(base_addr + 0x08); /* get modctl, used later for setting diff bits */ switch(differential = (inb(base_addr + 0x08) >> 6)) { case 0x00: /* only SIOP1 differential */ differential = 0x02; break; case 0x01: /* Both SIOPs differential */ differential = 0x03; break; case 0x03: /* No SIOPs differential */ differential = 0x00; break; default: // printk(KERN_ERR "D700: UNEXPECTED DIFFERENTIAL RESULT 0x%02x\n", ; differential = 0x00; break; } p = kzalloc(sizeof(*p), GFP_KERNEL); if (!p) return -ENOMEM; p->dev = dev; snprintf(p->name, sizeof(p->name), "D700(%s)", dev_name(dev)); if (request_irq(irq, NCR_D700_intr, IRQF_SHARED, p->name, p)) { ; kfree(p); return -EBUSY; } /* plumb in both 700 chips */ for (i = 0; i < 2; i++) { int err; if ((err = NCR_D700_probe_one(p, i, irq, slot, offset_addr + (0x80 * i), differential)) != 0) // printk("D700: SIOP%d: probe failed, error = %d\n", ; else found++; } if (!found) { kfree(p); return -ENODEV; } mca_device_set_claim(mca_dev, 1); mca_device_set_name(mca_dev, "NCR_D700"); dev_set_drvdata(dev, p); return 0; }
static int __devinit NCR_D700_probe(struct device *dev) { struct NCR_D700_private *p; int differential; static int banner = 1; struct mca_device *mca_dev = to_mca_device(dev); int slot = mca_dev->slot; int found = 0; int irq, i; int pos3j, pos3k, pos3a, pos3b, pos4; __u32 base_addr, offset_addr; pos4 = mca_device_read_pos(mca_dev, 4); pos4 |= 0x4; mca_device_write_pos(mca_dev, 4, pos4); mca_device_write_pos(mca_dev, 6, 9); pos3j = mca_device_read_pos(mca_dev, 3); mca_device_write_pos(mca_dev, 6, 10); pos3k = mca_device_read_pos(mca_dev, 3); mca_device_write_pos(mca_dev, 6, 0); pos3a = mca_device_read_pos(mca_dev, 3); mca_device_write_pos(mca_dev, 6, 1); pos3b = mca_device_read_pos(mca_dev, 3); base_addr = ((pos3j << 8) | pos3k) & 0xfffffff0; offset_addr = ((pos3a << 8) | pos3b) & 0xffffff70; irq = (pos4 & 0x3) + 11; if(irq >= 13) irq++; if(banner) { printk(KERN_NOTICE "NCR D700: Driver Version " NCR_D700_VERSION "\n" "NCR D700: Copyright (c) 2001 by [email protected]\n" "NCR D700:\n"); banner = 0; } irq = mca_device_transform_irq(mca_dev, irq); base_addr = mca_device_transform_ioport(mca_dev, base_addr); offset_addr = mca_device_transform_ioport(mca_dev, offset_addr); printk(KERN_NOTICE "NCR D700: found in slot %d irq = %d I/O base = 0x%x\n", slot, irq, offset_addr); (void)inb(base_addr + 0x08); switch(differential = (inb(base_addr + 0x08) >> 6)) { case 0x00: differential = 0x02; break; case 0x01: differential = 0x03; break; case 0x03: differential = 0x00; break; default: printk(KERN_ERR "D700: UNEXPECTED DIFFERENTIAL RESULT 0x%02x\n", differential); differential = 0x00; break; } p = kzalloc(sizeof(*p), GFP_KERNEL); if (!p) return -ENOMEM; p->dev = dev; snprintf(p->name, sizeof(p->name), "D700(%s)", dev_name(dev)); if (request_irq(irq, NCR_D700_intr, IRQF_SHARED, p->name, p)) { printk(KERN_ERR "D700: request_irq failed\n"); kfree(p); return -EBUSY; } for (i = 0; i < 2; i++) { int err; if ((err = NCR_D700_probe_one(p, i, irq, slot, offset_addr + (0x80 * i), differential)) != 0) printk("D700: SIOP%d: probe failed, error = %d\n", i, err); else found++; } if (!found) { kfree(p); return -ENODEV; } mca_device_set_claim(mca_dev, 1); mca_device_set_name(mca_dev, "NCR_D700"); dev_set_drvdata(dev, p); return 0; }