summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/if_ix.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-10-05 03:01:13 +0000
committerdg <dg@FreeBSD.org>1995-10-05 03:01:13 +0000
commit35303001bdea1cc4505f5405b468426187152e9c (patch)
tree7f053e3a28be037fb594ada8d6272c9f2161f3eb /sys/i386/isa/if_ix.c
parentf12a489cee5a54cb6cf0a460f3425530d456b60d (diff)
downloadFreeBSD-src-35303001bdea1cc4505f5405b468426187152e9c.zip
FreeBSD-src-35303001bdea1cc4505f5405b468426187152e9c.tar.gz
1) Fixed irq logic so that it uses the kernel configured irq if it doesn't
match the board setting. 2) Fixed the warning message to properly print the irq mismatch (as opposed to the bit encoded value). 3) Add irq autodetection if the kernel has "?" or no irq specified. 4) Add missing splimp protection in ixioctl().
Diffstat (limited to 'sys/i386/isa/if_ix.c')
-rw-r--r--sys/i386/isa/if_ix.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/sys/i386/isa/if_ix.c b/sys/i386/isa/if_ix.c
index a7adc3e..1c7ef57 100644
--- a/sys/i386/isa/if_ix.c
+++ b/sys/i386/isa/if_ix.c
@@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_ix.c,v 1.7 1995/05/30 08:02:15 rgrimes Exp $
+ * $Id: if_ix.c,v 1.8 1995/09/19 18:55:11 bde Exp $
*/
#include "ix.h"
@@ -318,6 +318,7 @@ ixprobe(struct isa_device *dvp) {
/* ZZZ irq_translate should really be unsigned, but until
* isa_device.h and all uses are fixed we have to live with it */
short irq_translate[] = {0, IRQ9, IRQ3, IRQ4, IRQ5, IRQ10, IRQ11, 0};
+ char irq_encode[] = { 0, 0, 0, 2, 3, 4, 0, 0, 0, 1, 5, 6, 0, 0, 0, 0 };
DEBUGBEGIN(DEBUGPROBE)
DEBUGDO(printf ("ixprobe:");)
@@ -498,10 +499,20 @@ ixprobe(struct isa_device *dvp) {
*/
irq = ixeeprom_read(unit, eeprom_config1);
irq = (irq & IRQ) >> IRQ_SHIFT;
- sc->irq_encoded = irq;
irq = irq_translate[irq];
- if (irq != dvp->id_irq) {
- printf("Warning board is configured for IRQ %d\n", irq);
+ if (dvp->id_irq > 0) {
+ if (irq != dvp->id_irq) {
+ printf("ix%d: WARNING: board is configured for IRQ %d, using %d\n",
+ unit, ffs(irq) - 1, ffs(dvp->id_irq) - 1);
+ irq = dvp->id_irq;
+ }
+ } else {
+ dvp->id_irq = irq;
+ }
+ sc->irq_encoded = irq_encode[ffs(irq) - 1];
+ if (sc->irq_encoded == 0) {
+ printf("ix%d: invalid irq (%d)\n", ffs(irq) - 1);
+ goto ixprobe_exit;
}
/*
@@ -1516,13 +1527,16 @@ int
ixioctl(struct ifnet *ifp, int cmd, caddr_t data) {
int unit = ifp->if_unit;
int status = 0;
+ int s;
ix_softc_t *sc = &ix_softc[unit];
DEBUGBEGIN(DEBUGIOCTL)
DEBUGDO(printf("ixioctl:");)
DEBUGEND
- switch(cmd) {
+ s = splimp();
+
+ switch(cmd) {
case SIOCSIFADDR: {
struct ifaddr *ifa = (struct ifaddr *)data;
@@ -1574,6 +1588,7 @@ ixioctl(struct ifnet *ifp, int cmd, caddr_t data) {
break;
}
}
+ splx(s);
DEBUGBEGIN(DEBUGIOCTL)
DEBUGDO(printf("ixioctl exit\n");)
OpenPOWER on IntegriCloud