summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2008-08-24 00:22:42 +0000
committerimp <imp@FreeBSD.org>2008-08-24 00:22:42 +0000
commit8c6bf65efbf38efe8d5cc1374c205c11c465fefd (patch)
tree6cd32ea90ef14a7002e10c3aa33e89e5dee9c76b /sys/dev
parenta3baa9b359d9394b6e40604fc1d752b93ccd7394 (diff)
downloadFreeBSD-src-8c6bf65efbf38efe8d5cc1374c205c11c465fefd.zip
FreeBSD-src-8c6bf65efbf38efe8d5cc1374c205c11c465fefd.tar.gz
Some PC Card variants of the 82365 don't seem to like setting the IRQ
number in the irq register. While there are other issues with these variants, avoiding writing to it helps interrupt generation on at least one card, and doesn't hurt on the others. Flag ISA attachment as needing INT_NO_REG written, and don't update the PC Card attachment (which will have the effect of not touching it for PC Cards). Document this in a comment, and tweak one or two formatting nits while I'm here.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ex/if_ex.c18
-rw-r--r--sys/dev/ex/if_ex_isa.c8
-rw-r--r--sys/dev/ex/if_exvar.h2
3 files changed, 18 insertions, 10 deletions
diff --git a/sys/dev/ex/if_ex.c b/sys/dev/ex/if_ex.c
index 16553c0..3e6c90c 100644
--- a/sys/dev/ex/if_ex.c
+++ b/sys/dev/ex/if_ex.c
@@ -325,24 +325,30 @@ ex_init_locked(struct ex_softc *sc)
*/
CSR_WRITE_1(sc, CMD_REG, Bank2_Sel);
temp_reg = CSR_READ_1(sc, EEPROM_REG);
- if (temp_reg & Trnoff_Enable) {
+ if (temp_reg & Trnoff_Enable)
CSR_WRITE_1(sc, EEPROM_REG, temp_reg & ~Trnoff_Enable);
- }
- for (i = 0; i < ETHER_ADDR_LEN; i++) {
+ for (i = 0; i < ETHER_ADDR_LEN; i++)
CSR_WRITE_1(sc, I_ADDR_REG0 + i, IF_LLADDR(sc->ifp)[i]);
- }
+
/*
* - Setup transmit chaining and discard bad received frames.
* - Match broadcast.
* - Clear test mode.
* - Set receiving mode.
- * - Set IRQ number.
*/
CSR_WRITE_1(sc, REG1, CSR_READ_1(sc, REG1) | Tx_Chn_Int_Md | Tx_Chn_ErStp | Disc_Bad_Fr);
CSR_WRITE_1(sc, REG2, CSR_READ_1(sc, REG2) | No_SA_Ins | RX_CRC_InMem);
CSR_WRITE_1(sc, REG3, CSR_READ_1(sc, REG3) & 0x3f /* XXX constants. */ );
+ /*
+ * - Set IRQ number, if this part has it. ISA devices have this,
+ * while PC Card devices don't seem to. Either way, we have to
+ * switch to Bank1 as the rest of this code relies on that.
+ */
CSR_WRITE_1(sc, CMD_REG, Bank1_Sel);
- CSR_WRITE_1(sc, INT_NO_REG, (CSR_READ_1(sc, INT_NO_REG) & 0xf8) | sc->irq2ee[sc->irq_no]);
+ if (sc->flags & HAS_INT_NO_REG)
+ CSR_WRITE_1(sc, INT_NO_REG,
+ (CSR_READ_1(sc, INT_NO_REG) & 0xf8) |
+ sc->irq2ee[sc->irq_no]);
/*
* Divide the available memory in the card into rcv and xmt buffers.
diff --git a/sys/dev/ex/if_ex_isa.c b/sys/dev/ex/if_ex_isa.c
index 31b00a3..02d4a75 100644
--- a/sys/dev/ex/if_ex_isa.c
+++ b/sys/dev/ex/if_ex_isa.c
@@ -247,12 +247,11 @@ ex_isa_probe(device_t dev)
tmp = ex_eeprom_read(sc, EE_W1) & EE_W1_INT_SEL;
irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0);
-
if (irq > 0) {
/* This will happen if board is in PnP mode. */
if (ee2irq[tmp] != irq) {
- printf("ex: WARNING: board's EEPROM is configured"
- " for IRQ %d, using %d\n",
+ device_printf(dev,
+ "WARNING: IRQ mismatch: EEPROM %d, using %d\n",
ee2irq[tmp], irq);
}
} else {
@@ -267,7 +266,7 @@ ex_isa_probe(device_t dev)
bad:;
ex_release_resources(dev);
- return(error);
+ return (error);
}
static int
@@ -280,6 +279,7 @@ ex_isa_attach(device_t dev)
sc->dev = dev;
sc->ioport_rid = 0;
sc->irq_rid = 0;
+ sc->flags |= HAS_INT_NO_REG;
if ((error = ex_alloc_resources(dev)) != 0) {
device_printf(dev, "ex_alloc_resources() failed!\n");
diff --git a/sys/dev/ex/if_exvar.h b/sys/dev/ex/if_exvar.h
index 9278f6d..44576a3 100644
--- a/sys/dev/ex/if_exvar.h
+++ b/sys/dev/ex/if_exvar.h
@@ -68,6 +68,8 @@ struct ex_softc {
struct mtx lock;
struct callout timer;
int tx_timeout;
+ int flags;
+#define HAS_INT_NO_REG 1
};
extern devclass_t ex_devclass;
OpenPOWER on IntegriCloud