patch-2.1.126 linux/drivers/net/3c509.c
Next file: linux/drivers/net/Config.in
Previous file: linux/drivers/net/3c505.c
Back to the patch index
Back to the overall index
- Lines: 83
- Date:
Sat Oct 17 15:33:45 1998
- Orig file:
v2.1.125/linux/drivers/net/3c509.c
- Orig date:
Tue Aug 18 22:02:04 1998
diff -u --recursive --new-file v2.1.125/linux/drivers/net/3c509.c linux/drivers/net/3c509.c
@@ -178,28 +178,64 @@
}
#ifdef CONFIG_MCA
-#warning "The MCA code in drivers/net/3c509.c does not compile"
-#warning "See http://glycerine.itsmm.uni.edu/mca/ for patches."
-#if 0
- if (MCA_bus) {
- mca_adaptor_select_mode(1);
- for (i = 0; i < 8; i++)
- if ((mca_adaptor_id(i) | 1) == 0x627c) {
- ioaddr = mca_pos_base_addr(i);
- irq = inw(ioaddr + WN0_IRQ) >> 12;
- if_port = inw(ioaddr + 6)>>14;
- for (i = 0; i < 3; i++)
- phys_addr[i] = htons(read_eeprom(ioaddr, i));
+#define MCA_NUMBER_OF_SLOTS 8
+#define MCA_PORT_POS_SEL 0x096
+#define MCA_PORT_ID_REG_0 0x100
+#define MCA_PORT_ID_REG_1 0x101
+#define MCA_SELECT_BIT 0x08
+ if (MCA_bus)
+ {
+ u_int mca_id;
+ u_char posreg[4];
+ int mca_slot;
- mca_adaptor_select_mode(0);
- goto found;
+ if (el3_debug > 2)
+ printk("3c529: probing...\n");
+ /* This should probably be done once early on and read into
+ * a structure somewhere... */
+ for (mca_slot = 0; mca_slot < MCA_NUMBER_OF_SLOTS; mca_slot++)
+ {
+ /* Select MCA slot i */
+ outb_p(mca_slot | MCA_SELECT_BIT, MCA_PORT_POS_SEL);
+ mca_id = ((inb_p(MCA_PORT_ID_REG_1)<<8)
+ + inb_p(MCA_PORT_ID_REG_0));
+ if (mca_id == 0x627C /* 10base2 */
+ || mca_id == 0x627D /* 10baseT */
+ || mca_id == 0x62DB /* Test mode */
+ || mca_id == 0x62F6 /* TP or coax */
+ || mca_id == 0x62F7) /* TP only */
+ {
+ if (el3_debug > 1)
+ printk("3c529: Found with id 0x%x at slot %d\n",
+ mca_id, mca_slot);
+ posreg[0] = inb_p(0x102); posreg[1] = inb_p(0x103);
+ posreg[2] = inb_p(0x104); posreg[3] = inb_p(0x105);
+ break;
}
- mca_adaptor_select_mode(0);
-
+ mca_id = 0xFFFF;
+ }
+ /* Read values from POS registers so now disable */
+ outb(0,MCA_PORT_POS_SEL);
+ if (mca_id != 0xFFFF && !(posreg[0]&0x01))
+ printk("3c529: Adapter found but disabled in slot %d\n", mca_slot);
+ else if (mca_id != 0xFFFF && posreg[0]&0x01)
+ {
+ /* Found and adapter is enabled */
+ if (el3_debug > 2)
+ printk("3c529: pos registers 0:0x%x 1:0x%x 2:0x%x 3:0x%x\n",
+ posreg[0], posreg[1], posreg[2], posreg[3]);
+ ioaddr = ((short)((posreg[2]&0xfc)|0x02)) << 8;
+ irq = posreg[3] & 0x0f;
+ if_port = posreg[2] & 0x03;
+ if (el3_debug > 2)
+ printk("3c529: irq %d ioaddr 0x%x ifport %d\n",
+ irq, ioaddr, if_port);
+ for (i = 0; i < 3; i++)
+ phys_addr[i] = htons(read_eeprom(ioaddr, i));
+ goto found;
+ }
}
#endif
-#endif
-
/* Reset the ISA PnP mechanism on 3c509b. */
outb(0x02, 0x279); /* Select PnP config control register. */
outb(0x02, 0xA79); /* Return to WaitForKey state. */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov