aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew N. Dodd <mdodd@FreeBSD.org>1999-08-01 22:57:09 +0000
committerMatthew N. Dodd <mdodd@FreeBSD.org>1999-08-01 22:57:09 +0000
commit0d6ab4a16a8d61a4fbb5235daa4742f5ea429850 (patch)
tree7fa39dc51e29a13517622d2adc571092d72a53b7
parentcc5aedfb1a1217f597900cca1923d625ea3514bc (diff)
downloadsrc-0d6ab4a16a8d61a4fbb5235daa4742f5ea429850.tar.gz
src-0d6ab4a16a8d61a4fbb5235daa4742f5ea429850.zip
Move the specification of EDGE/LEVEL triggered interrupts to
eisa_add_intr() which now takes an additional arguement (one of EISA_TRIGGER_LEVEL or EISA_TRIGGER_EDGE). The flag RR_SHAREABLE has no effect when passed to bus_alloc_resource(dev, SYS_RES_IRQ, ...) in an EISA device context as the eisa_alloc_resource() call (bus_alloc_resource method) now deals with this flag directly, depending on the device ivars. This change does nothing more than move all the 'shared = inb(foo + iobsse)' nonesense to the device probe methods rather than the device attach. Also, print out 'edge' or 'level' in the IRQ announcement message. Reviewed by: dfr
Notes
Notes: svn path=/head/; revision=49360
-rw-r--r--sys/dev/advansys/adv_eisa.c4
-rw-r--r--sys/dev/ahb/ahb.c19
-rw-r--r--sys/dev/aic7xxx/ahc_eisa.c10
-rw-r--r--sys/dev/buslogic/bt_eisa.c9
-rw-r--r--sys/dev/dpt/dpt_eisa.c21
-rw-r--r--sys/dev/dpt/dpt_eisa.h5
-rw-r--r--sys/dev/eisa/eisaconf.c41
-rw-r--r--sys/dev/eisa/eisaconf.h7
-rw-r--r--sys/dev/ep/if_ep_eisa.c4
-rw-r--r--sys/dev/pdq/if_fea.c6
-rw-r--r--sys/dev/vx/if_vx_eisa.c6
-rw-r--r--sys/i386/eisa/3c5x9.c4
-rw-r--r--sys/i386/eisa/adv_eisa.c4
-rw-r--r--sys/i386/eisa/ahb.c19
-rw-r--r--sys/i386/eisa/ahc_eisa.c10
-rw-r--r--sys/i386/eisa/bt_eisa.c9
-rw-r--r--sys/i386/eisa/dpt_eisa.c21
-rw-r--r--sys/i386/eisa/dpt_eisa.h5
-rw-r--r--sys/i386/eisa/eisaconf.c41
-rw-r--r--sys/i386/eisa/eisaconf.h7
-rw-r--r--sys/i386/eisa/if_fea.c6
-rw-r--r--sys/i386/eisa/if_vx_eisa.c6
22 files changed, 160 insertions, 104 deletions
diff --git a/sys/dev/advansys/adv_eisa.c b/sys/dev/advansys/adv_eisa.c
index 69a2a39fa05b..36c97585eab2 100644
--- a/sys/dev/advansys/adv_eisa.c
+++ b/sys/dev/advansys/adv_eisa.c
@@ -32,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: adv_eisa.c,v 1.3 1999/04/18 15:50:33 peter Exp $
+ * $Id: adv_eisa.c,v 1.4 1999/05/08 21:59:16 dfr Exp $
*/
#include "eisa.h"
@@ -130,7 +130,7 @@ adveisaprobe(device_t dev)
irq);
return ENXIO;
}
- eisa_add_intr(dev, irq + 10);
+ eisa_add_intr(dev, irq + 10, EISA_TRIGGER_LEVEL);
return 0;
}
diff --git a/sys/dev/ahb/ahb.c b/sys/dev/ahb/ahb.c
index 86ba09be29ed..7ae7bd142523 100644
--- a/sys/dev/ahb/ahb.c
+++ b/sys/dev/ahb/ahb.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ahb.c,v 1.11 1999/05/06 20:16:31 ken Exp $
+ * $Id: ahb.c,v 1.12 1999/05/08 21:59:17 dfr Exp $
*/
#include "eisa.h"
@@ -206,6 +206,7 @@ ahbprobe(device_t dev)
u_int32_t iobase;
u_int32_t irq;
u_int8_t intdef;
+ int shared;
desc = ahbmatch(eisa_get_id(dev));
if (!desc)
@@ -247,7 +248,10 @@ ahbprobe(device_t dev)
if (irq == 0)
return ENXIO;
- eisa_add_intr(dev, irq);
+ shared = (inb(INTDEF + iobase) & INTLEVEL) ?
+ EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
+
+ eisa_add_intr(dev, irq, shared);
return 0;
}
@@ -262,7 +266,7 @@ ahbattach(device_t dev)
struct ecb* next_ecb;
struct resource *io = 0;
struct resource *irq = 0;
- int shared, rid;
+ int rid;
void *ih;
rid = 0;
@@ -280,10 +284,9 @@ ahbattach(device_t dev)
if (ahbreset(ahb) != 0)
goto error_exit;
- shared = (ahb_inb(ahb, INTDEF) & INTLEVEL) ? RF_SHAREABLE : 0;
rid = 0;
irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, shared | RF_ACTIVE);
+ 0, ~0, 1, RF_ACTIVE);
if (!irq) {
device_printf(dev, "Can't allocate interrupt\n");
goto error_exit;
@@ -746,10 +749,14 @@ ahbprocesserror(struct ahb_softc *ahb, struct ecb *ecb, union ccb *ccb)
case HS_SCSI_RESET_INCOMING:
ccb->ccb_h.status = CAM_SCSI_BUS_RESET;
break;
+ case HS_INVALID_ECB_PARAM:
+ printf("ahb%ld: opcode 0x%02x, flag_word1 0x%02x, flag_word2 0x%02x\n",
+ ahb->unit, hecb->opcode, hecb->flag_word1, hecb->flag_word2);
+ ccb->ccb_h.status = CAM_SCSI_BUS_RESET;
+ break;
case HS_DUP_TCB_RECEIVED:
case HS_INVALID_OPCODE:
case HS_INVALID_CMD_LINK:
- case HS_INVALID_ECB_PARAM:
case HS_PROGRAM_CKSUM_ERROR:
panic("ahb%ld: Can't happen host status %x occurred",
ahb->unit, status->ha_status);
diff --git a/sys/dev/aic7xxx/ahc_eisa.c b/sys/dev/aic7xxx/ahc_eisa.c
index 95c9f4f3ba49..f11d563c7084 100644
--- a/sys/dev/aic7xxx/ahc_eisa.c
+++ b/sys/dev/aic7xxx/ahc_eisa.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ahc_eisa.c,v 1.9 1999/05/17 21:51:41 gibbs Exp $
+ * $Id: ahc_eisa.c,v 1.10 1999/05/17 21:56:00 gibbs Exp $
*/
#include "eisa.h"
@@ -97,6 +97,7 @@ aic7770_probe(device_t dev)
u_int32_t irq;
u_int8_t intdef;
u_int8_t hcntrl;
+ int shared;
desc = aic7770_match(eisa_get_id(dev));
if (!desc)
@@ -113,6 +114,7 @@ aic7770_probe(device_t dev)
eisa_add_iospace(dev, iobase, AHC_EISA_IOSIZE, RESVADDR_NONE);
intdef = inb(INTDEF + iobase);
+ shared = (intdef & 0x80) ? EISA_TRIGGER_EDGE : EISA_TRIGGER_LEVEL;
irq = intdef & 0xf;
switch (irq) {
case 9:
@@ -132,7 +134,7 @@ aic7770_probe(device_t dev)
if (irq == 0)
return ENXIO;
- eisa_add_intr(dev, irq);
+ eisa_add_intr(dev, irq, shared);
return 0;
}
@@ -145,7 +147,6 @@ aic7770_attach(device_t dev)
struct ahc_softc *ahc;
struct resource *io;
int error, rid;
- int shared;
rid = 0;
io = NULL;
@@ -205,10 +206,9 @@ aic7770_attach(device_t dev)
* The IRQMS bit enables level sensitive interrupts. Only allow
* IRQ sharing if it's set.
*/
- shared = (ahc->pause & IRQMS) ? RF_SHAREABLE : 0;
rid = 0;
ahc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, shared | RF_ACTIVE);
+ 0, ~0, 1, RF_ACTIVE);
if (ahc->irq == NULL) {
device_printf(dev, "Can't allocate interrupt\n");
goto bad;
diff --git a/sys/dev/buslogic/bt_eisa.c b/sys/dev/buslogic/bt_eisa.c
index fc369c8251f2..eaaee0d12e17 100644
--- a/sys/dev/buslogic/bt_eisa.c
+++ b/sys/dev/buslogic/bt_eisa.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bt_eisa.c,v 1.6 1999/04/24 06:46:10 peter Exp $
+ * $Id: bt_eisa.c,v 1.7 1999/05/08 21:59:18 dfr Exp $
*/
#include "eisa.h"
@@ -188,6 +188,7 @@ bt_eisa_probe(device_t dev)
u_long iosize;
u_int ioconf;
int result;
+ int shared;
desc = bt_match(eisa_get_id(dev));
if (!desc)
@@ -229,6 +230,8 @@ bt_eisa_probe(device_t dev)
eisa_get_slot(dev));
return (ENXIO);
}
+ shared = (inb(iobase + AMI_EISA_IOCONF1) & AMI_IRQ_LEVEL) ?
+ EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
} else {
iobase += BT_EISA_SLOT_OFFSET;
iosize = BT_EISA_IOSIZE;
@@ -262,6 +265,8 @@ bt_eisa_probe(device_t dev)
eisa_get_slot(dev));
return (ENXIO);
}
+ shared = (inb(iobase + EISA_IRQ_TYPE) & LEVEL) ?
+ EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
}
bt_mark_probed_iop(port);
@@ -277,7 +282,7 @@ bt_eisa_probe(device_t dev)
"card at slot 0x%x\n", eisa_get_slot(dev));
result = ENXIO;
} else {
- eisa_add_intr(dev, info.irq);
+ eisa_add_intr(dev, info.irq, shared);
result = 0;
}
bt_eisa_release_resources(dev);
diff --git a/sys/dev/dpt/dpt_eisa.c b/sys/dev/dpt/dpt_eisa.c
index e38ea664136e..0c376f47579e 100644
--- a/sys/dev/dpt/dpt_eisa.c
+++ b/sys/dev/dpt/dpt_eisa.c
@@ -33,7 +33,7 @@
*/
/*
- * $Id: dpt_eisa.c,v 1.5 1999/04/18 15:50:33 peter Exp $
+ * $Id: dpt_eisa.c,v 1.6 1999/05/08 21:59:19 dfr Exp $
*/
#include "eisa.h"
@@ -78,6 +78,7 @@ dpt_eisa_probe(device_t dev)
u_int32_t io_base;
u_int intdef;
u_int irq;
+ int shared;
desc = dpt_eisa_match(eisa_get_id(dev));
if (!desc)
@@ -88,10 +89,14 @@ dpt_eisa_probe(device_t dev)
+ DPT_EISA_SLOT_OFFSET;
eisa_add_iospace(dev, io_base, DPT_EISA_IOSIZE, RESVADDR_NONE);
+
+ outb((DPT_EISA_CFENABLE + io_base), 0xf8);
- intdef = inb(DPT_EISA_INTDEF + io_base);
+ intdef = inb(DPT_EISA_INTDEF + io_base);
irq = intdef & DPT_EISA_INT_NUM_MASK;
+ shared = (intdef & DPT_EISA_INT_LEVEL)
+ ? EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
switch (irq) {
case DPT_EISA_INT_NUM_11:
irq = 11;
@@ -103,15 +108,15 @@ dpt_eisa_probe(device_t dev)
irq = 14;
break;
default:
- printf("dpt at slot %d: illegal irq setting %d\n",
+ device_printf(dev, "dpt at slot %d: illegal irq setting %d\n",
eisa_get_slot(dev), irq);
irq = 0;
break;
}
if (irq == 0)
- return ENXIO;
+ return (ENXIO);
- eisa_add_intr(dev, irq);
+ eisa_add_intr(dev, irq, shared);
return 0;
}
@@ -123,7 +128,6 @@ dpt_eisa_attach(device_t dev)
struct resource *io = 0;
struct resource *irq = 0;
int unit = device_get_unit(dev);
- int shared;
int s;
int rid;
void *ih;
@@ -136,9 +140,6 @@ dpt_eisa_attach(device_t dev)
return ENOMEM;
}
- shared = (inb(DPT_EISA_INTDEF + rman_get_start(io))
- & DPT_EISA_INT_LEVEL) ? RF_SHAREABLE : 0;
-
dpt = dpt_alloc(unit, rman_get_bustag(io),
rman_get_bushandle(io) + DPT_EISA_EATA_REG_OFFSET);
if (dpt == NULL)
@@ -160,7 +161,7 @@ dpt_eisa_attach(device_t dev)
rid = 0;
irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, shared | RF_ACTIVE);
+ 0, ~0, 1, RF_ACTIVE);
if (!irq) {
device_printf(dev, "No irq?!\n");
goto bad;
diff --git a/sys/dev/dpt/dpt_eisa.h b/sys/dev/dpt/dpt_eisa.h
index e76087b04388..0731911d36cb 100644
--- a/sys/dev/dpt/dpt_eisa.h
+++ b/sys/dev/dpt/dpt_eisa.h
@@ -32,12 +32,14 @@
*/
/*
- * $Id: dpt_eisa.h,v 1.1 1998/03/11 00:30:14 julian Exp $
+ * $Id: dpt_eisa.h,v 1.2 1998/09/15 08:33:35 gibbs Exp $
*/
#define DPT_EISA_SLOT_OFFSET 0xc00
#define DPT_EISA_IOSIZE 0x100
+#define DPT_EISA_CFENABLE 0x8f
+
#define DPT_EISA_INTDEF 0x90
#define DPT_EISA_INT_LEVEL 0x04
#define DPT_EISA_INT_NUM_MASK 0x38
@@ -62,4 +64,3 @@
#define DPT_EISA_DPTBC01 0x1214BC01
#define DPT_EISA_NEC8200 0x12148200
#define DPT_EISA_ATT2408 0x12142408
-
diff --git a/sys/dev/eisa/eisaconf.c b/sys/dev/eisa/eisaconf.c
index abcc672e736d..dbf08d880d10 100644
--- a/sys/dev/eisa/eisaconf.c
+++ b/sys/dev/eisa/eisaconf.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: eisaconf.c,v 1.48 1999/07/29 01:02:51 mdodd Exp $
+ * $Id: eisaconf.c,v 1.49 1999/07/30 13:54:00 mdodd Exp $
*/
#include "opt_eisa.h"
@@ -62,6 +62,7 @@ LIST_HEAD(resvlist, resvaddr);
struct irq_node {
int irq_no;
+ int irq_trigger;
void *idesc;
TAILQ_ENTRY(irq_node) links;
};
@@ -92,7 +93,7 @@ int num_eisa_slots = EISA_SLOTS;
static devclass_t eisa_devclass;
static void eisa_reg_print (device_t, char *, char *, int *);
-static int eisa_find_irq(struct eisa_device *e_dev, int rid);
+static struct irq_node * eisa_find_irq(struct eisa_device *e_dev, int rid);
static struct resvaddr * eisa_find_maddr(struct eisa_device *e_dev, int rid);
static struct resvaddr * eisa_find_ioaddr(struct eisa_device *e_dev, int rid);
@@ -302,8 +303,9 @@ eisa_print_child(device_t dev, device_t child)
}
rid = 0;
- while ((irq = eisa_find_irq(e_dev, rid++)) != -1) {
- snprintf(buf, sizeof(buf), "irq %d", irq);
+ while ((irq = eisa_find_irq(e_dev, rid++)) != NULL) {
+ snprintf(buf, sizeof(buf), "irq %d (%s)", irq->irq_no,
+ (irq->irq_trigger ? "level" : "edge"));
eisa_reg_print(child, buf,
((rid == 1) ? &separator : NULL), &column);
}
@@ -315,7 +317,7 @@ eisa_print_child(device_t dev, device_t child)
return (retval);
}
-static int
+static struct irq_node *
eisa_find_irq(struct eisa_device *e_dev, int rid)
{
int i;
@@ -327,9 +329,9 @@ eisa_find_irq(struct eisa_device *e_dev, int rid)
;
if (irq)
- return irq->irq_no;
+ return (irq);
else
- return -1;
+ return (NULL);
}
static struct resvaddr *
@@ -364,6 +366,7 @@ static int
eisa_read_ivar(device_t dev, device_t child, int which, u_long *result)
{
struct eisa_device *e_dev = device_get_ivars(child);
+ struct irq_node *irq;
switch (which) {
case EISA_IVAR_SLOT:
@@ -376,7 +379,11 @@ eisa_read_ivar(device_t dev, device_t child, int which, u_long *result)
case EISA_IVAR_IRQ:
/* XXX only first irq */
- *result = eisa_find_irq(e_dev, 0);
+ if ((irq = eisa_find_irq(e_dev, 0)) != NULL) {
+ *result = irq->irq_no;
+ } else {
+ *result = -1;
+ }
break;
default:
@@ -406,11 +413,16 @@ eisa_alloc_resource(device_t dev, device_t child, int type, int *rid,
switch (type) {
case SYS_RES_IRQ:
if (isdefault) {
- int irq = eisa_find_irq(e_dev, *rid);
- if (irq == -1)
+ struct irq_node * irq = eisa_find_irq(e_dev, *rid);
+ if (irq == NULL)
return 0;
- start = end = irq;
+ start = end = irq->irq_no;
count = 1;
+ if (irq->irq_trigger == EISA_TRIGGER_LEVEL) {
+ flags |= RF_SHAREABLE;
+ } else {
+ flags &= ~RF_SHAREABLE;
+ }
}
break;
@@ -466,7 +478,7 @@ eisa_release_resource(device_t dev, device_t child, int type, int rid,
switch (type) {
case SYS_RES_IRQ:
- if (eisa_find_irq(e_dev, rid) == -1)
+ if (eisa_find_irq(e_dev, rid) == NULL)
return EINVAL;
break;
@@ -496,10 +508,10 @@ eisa_release_resource(device_t dev, device_t child, int type, int rid,
}
int
-eisa_add_intr(device_t dev, int irq)
+eisa_add_intr(device_t dev, int irq, int trigger)
{
struct eisa_device *e_dev = device_get_ivars(dev);
- struct irq_node *irq_info;
+ struct irq_node *irq_info;
irq_info = (struct irq_node *)malloc(sizeof(*irq_info), M_DEVBUF,
M_NOWAIT);
@@ -507,6 +519,7 @@ eisa_add_intr(device_t dev, int irq)
return (1);
irq_info->irq_no = irq;
+ irq_info->irq_trigger = trigger;
irq_info->idesc = NULL;
TAILQ_INSERT_TAIL(&e_dev->ioconf.irqs, irq_info, links);
return 0;
diff --git a/sys/dev/eisa/eisaconf.h b/sys/dev/eisa/eisaconf.h
index cb950c85a35b..6174b6b36926 100644
--- a/sys/dev/eisa/eisaconf.h
+++ b/sys/dev/eisa/eisaconf.h
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: eisaconf.h,v 1.17 1997/09/21 21:35:23 gibbs Exp $
+ * $Id: eisaconf.h,v 1.18 1999/04/18 15:50:33 peter Exp $
*/
#ifndef _I386_EISA_EISACONF_H_
@@ -53,6 +53,9 @@ enum eisa_device_ivars {
EISA_IVAR_IRQ
};
+#define EISA_TRIGGER_EDGE 0x0
+#define EISA_TRIGGER_LEVEL 0x1
+
/*
* Simplified accessors for isa devices
*/
@@ -75,7 +78,7 @@ EISA_ACCESSOR(slot, SLOT, int)
EISA_ACCESSOR(id, ID, eisa_id_t)
EISA_ACCESSOR(irq, IRQ, eisa_id_t)
-int eisa_add_intr __P((device_t, int));
+int eisa_add_intr __P((device_t, int, int));
#define RESVADDR_NONE 0x00
#define RESVADDR_BITMASK 0x01 /* size is a mask of reserved
diff --git a/sys/dev/ep/if_ep_eisa.c b/sys/dev/ep/if_ep_eisa.c
index 81ba5a24e223..b6ccff13af41 100644
--- a/sys/dev/ep/if_ep_eisa.c
+++ b/sys/dev/ep/if_ep_eisa.c
@@ -19,7 +19,7 @@
* 4. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: 3c5x9.c,v 1.11 1999/04/18 15:50:33 peter Exp $
+ * $Id: 3c5x9.c,v 1.12 1999/05/08 21:59:15 dfr Exp $
*/
#include "eisa.h"
@@ -160,7 +160,7 @@ ep_eisa_probe(device_t dev)
eisa_get_slot(dev));
return ENXIO;
}
- eisa_add_intr(dev, irq);
+ eisa_add_intr(dev, irq, EISA_TRIGGER_EDGE);
return 0;
}
diff --git a/sys/dev/pdq/if_fea.c b/sys/dev/pdq/if_fea.c
index 44c930ffa962..c98eb4bf96af 100644
--- a/sys/dev/pdq/if_fea.c
+++ b/sys/dev/pdq/if_fea.c
@@ -21,7 +21,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_fea.c,v 1.15 1999/07/10 19:46:08 peter Exp $
+ * $Id: if_fea.c,v 1.16 1999/07/31 00:43:48 mdodd Exp $
*/
/*
@@ -148,7 +148,7 @@ pdq_eisa_probe (dev)
eisa_add_iospace(dev, iobase, 0x200, RESVADDR_NONE);
eisa_add_mspace(dev, maddr, msize, RESVADDR_NONE);
- eisa_add_intr(dev, irq);
+ eisa_add_intr(dev, irq, EISA_TRIGGER_LEVEL);
return (0);
}
@@ -196,7 +196,7 @@ pdq_eisa_attach (dev)
rid = 0;
irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE);
+ 0, ~0, 1, RF_ACTIVE);
if (!irq) {
device_printf(dev, "No, irq?!\n");
diff --git a/sys/dev/vx/if_vx_eisa.c b/sys/dev/vx/if_vx_eisa.c
index 03e50a34c369..150e5738968c 100644
--- a/sys/dev/vx/if_vx_eisa.c
+++ b/sys/dev/vx/if_vx_eisa.c
@@ -106,7 +106,8 @@ vx_eisa_probe(device_t dev)
eisa_add_iospace(dev, port, VX_IOSIZE, RESVADDR_NONE);
/* Set irq */
- eisa_add_intr(dev, inw(iobase + VX_RESOURCE_CONFIG) >> 12);
+ eisa_add_intr(dev, inw(iobase + VX_RESOURCE_CONFIG) >> 12,
+ EISA_TRIGGER_EDGE);
return (0);
}
@@ -119,7 +120,6 @@ vx_eisa_attach(device_t dev)
struct resource *io = 0;
struct resource *eisa_io = 0;
struct resource *irq = 0;
- u_char level_intr;
int rid;
void *ih;
@@ -149,8 +149,6 @@ vx_eisa_attach(device_t dev)
sc->vx_io_addr = rman_get_start(io);
- level_intr = FALSE;
-
rid = 0;
irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
0, ~0, 1, RF_ACTIVE);
diff --git a/sys/i386/eisa/3c5x9.c b/sys/i386/eisa/3c5x9.c
index 81ba5a24e223..b6ccff13af41 100644
--- a/sys/i386/eisa/3c5x9.c
+++ b/sys/i386/eisa/3c5x9.c
@@ -19,7 +19,7 @@
* 4. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: 3c5x9.c,v 1.11 1999/04/18 15:50:33 peter Exp $
+ * $Id: 3c5x9.c,v 1.12 1999/05/08 21:59:15 dfr Exp $
*/
#include "eisa.h"
@@ -160,7 +160,7 @@ ep_eisa_probe(device_t dev)
eisa_get_slot(dev));
return ENXIO;
}
- eisa_add_intr(dev, irq);
+ eisa_add_intr(dev, irq, EISA_TRIGGER_EDGE);
return 0;
}
diff --git a/sys/i386/eisa/adv_eisa.c b/sys/i386/eisa/adv_eisa.c
index 69a2a39fa05b..36c97585eab2 100644
--- a/sys/i386/eisa/adv_eisa.c
+++ b/sys/i386/eisa/adv_eisa.c
@@ -32,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: adv_eisa.c,v 1.3 1999/04/18 15:50:33 peter Exp $
+ * $Id: adv_eisa.c,v 1.4 1999/05/08 21:59:16 dfr Exp $
*/
#include "eisa.h"
@@ -130,7 +130,7 @@ adveisaprobe(device_t dev)
irq);
return ENXIO;
}
- eisa_add_intr(dev, irq + 10);
+ eisa_add_intr(dev, irq + 10, EISA_TRIGGER_LEVEL);
return 0;
}
diff --git a/sys/i386/eisa/ahb.c b/sys/i386/eisa/ahb.c
index 86ba09be29ed..7ae7bd142523 100644
--- a/sys/i386/eisa/ahb.c
+++ b/sys/i386/eisa/ahb.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ahb.c,v 1.11 1999/05/06 20:16:31 ken Exp $
+ * $Id: ahb.c,v 1.12 1999/05/08 21:59:17 dfr Exp $
*/
#include "eisa.h"
@@ -206,6 +206,7 @@ ahbprobe(device_t dev)
u_int32_t iobase;
u_int32_t irq;
u_int8_t intdef;
+ int shared;
desc = ahbmatch(eisa_get_id(dev));
if (!desc)
@@ -247,7 +248,10 @@ ahbprobe(device_t dev)
if (irq == 0)
return ENXIO;
- eisa_add_intr(dev, irq);
+ shared = (inb(INTDEF + iobase) & INTLEVEL) ?
+ EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
+
+ eisa_add_intr(dev, irq, shared);
return 0;
}
@@ -262,7 +266,7 @@ ahbattach(device_t dev)
struct ecb* next_ecb;
struct resource *io = 0;
struct resource *irq = 0;
- int shared, rid;
+ int rid;
void *ih;
rid = 0;
@@ -280,10 +284,9 @@ ahbattach(device_t dev)
if (ahbreset(ahb) != 0)
goto error_exit;
- shared = (ahb_inb(ahb, INTDEF) & INTLEVEL) ? RF_SHAREABLE : 0;
rid = 0;
irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, shared | RF_ACTIVE);
+ 0, ~0, 1, RF_ACTIVE);
if (!irq) {
device_printf(dev, "Can't allocate interrupt\n");
goto error_exit;
@@ -746,10 +749,14 @@ ahbprocesserror(struct ahb_softc *ahb, struct ecb *ecb, union ccb *ccb)
case HS_SCSI_RESET_INCOMING:
ccb->ccb_h.status = CAM_SCSI_BUS_RESET;
break;
+ case HS_INVALID_ECB_PARAM:
+ printf("ahb%ld: opcode 0x%02x, flag_word1 0x%02x, flag_word2 0x%02x\n",
+ ahb->unit, hecb->opcode, hecb->flag_word1, hecb->flag_word2);
+ ccb->ccb_h.status = CAM_SCSI_BUS_RESET;
+ break;
case HS_DUP_TCB_RECEIVED:
case HS_INVALID_OPCODE:
case HS_INVALID_CMD_LINK:
- case HS_INVALID_ECB_PARAM:
case HS_PROGRAM_CKSUM_ERROR:
panic("ahb%ld: Can't happen host status %x occurred",
ahb->unit, status->ha_status);
diff --git a/sys/i386/eisa/ahc_eisa.c b/sys/i386/eisa/ahc_eisa.c
index 95c9f4f3ba49..f11d563c7084 100644
--- a/sys/i386/eisa/ahc_eisa.c
+++ b/sys/i386/eisa/ahc_eisa.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ahc_eisa.c,v 1.9 1999/05/17 21:51:41 gibbs Exp $
+ * $Id: ahc_eisa.c,v 1.10 1999/05/17 21:56:00 gibbs Exp $
*/
#include "eisa.h"
@@ -97,6 +97,7 @@ aic7770_probe(device_t dev)
u_int32_t irq;
u_int8_t intdef;
u_int8_t hcntrl;
+ int shared;
desc = aic7770_match(eisa_get_id(dev));
if (!desc)
@@ -113,6 +114,7 @@ aic7770_probe(device_t dev)
eisa_add_iospace(dev, iobase, AHC_EISA_IOSIZE, RESVADDR_NONE);
intdef = inb(INTDEF + iobase);
+ shared = (intdef & 0x80) ? EISA_TRIGGER_EDGE : EISA_TRIGGER_LEVEL;
irq = intdef & 0xf;
switch (irq) {
case 9:
@@ -132,7 +134,7 @@ aic7770_probe(device_t dev)
if (irq == 0)
return ENXIO;
- eisa_add_intr(dev, irq);
+ eisa_add_intr(dev, irq, shared);
return 0;
}
@@ -145,7 +147,6 @@ aic7770_attach(device_t dev)
struct ahc_softc *ahc;
struct resource *io;
int error, rid;
- int shared;
rid = 0;
io = NULL;
@@ -205,10 +206,9 @@ aic7770_attach(device_t dev)
* The IRQMS bit enables level sensitive interrupts. Only allow
* IRQ sharing if it's set.
*/
- shared = (ahc->pause & IRQMS) ? RF_SHAREABLE : 0;
rid = 0;
ahc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, shared | RF_ACTIVE);
+ 0, ~0, 1, RF_ACTIVE);
if (ahc->irq == NULL) {
device_printf(dev, "Can't allocate interrupt\n");
goto bad;
diff --git a/sys/i386/eisa/bt_eisa.c b/sys/i386/eisa/bt_eisa.c
index fc369c8251f2..eaaee0d12e17 100644
--- a/sys/i386/eisa/bt_eisa.c
+++ b/sys/i386/eisa/bt_eisa.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bt_eisa.c,v 1.6 1999/04/24 06:46:10 peter Exp $
+ * $Id: bt_eisa.c,v 1.7 1999/05/08 21:59:18 dfr Exp $
*/
#include "eisa.h"
@@ -188,6 +188,7 @@ bt_eisa_probe(device_t dev)
u_long iosize;
u_int ioconf;
int result;
+ int shared;
desc = bt_match(eisa_get_id(dev));
if (!desc)
@@ -229,6 +230,8 @@ bt_eisa_probe(device_t dev)
eisa_get_slot(dev));
return (ENXIO);
}
+ shared = (inb(iobase + AMI_EISA_IOCONF1) & AMI_IRQ_LEVEL) ?
+ EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
} else {
iobase += BT_EISA_SLOT_OFFSET;
iosize = BT_EISA_IOSIZE;
@@ -262,6 +265,8 @@ bt_eisa_probe(device_t dev)
eisa_get_slot(dev));
return (ENXIO);
}
+ shared = (inb(iobase + EISA_IRQ_TYPE) & LEVEL) ?
+ EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
}
bt_mark_probed_iop(port);
@@ -277,7 +282,7 @@ bt_eisa_probe(device_t dev)
"card at slot 0x%x\n", eisa_get_slot(dev));
result = ENXIO;
} else {
- eisa_add_intr(dev, info.irq);
+ eisa_add_intr(dev, info.irq, shared);
result = 0;
}
bt_eisa_release_resources(dev);
diff --git a/sys/i386/eisa/dpt_eisa.c b/sys/i386/eisa/dpt_eisa.c
index e38ea664136e..0c376f47579e 100644
--- a/sys/i386/eisa/dpt_eisa.c
+++ b/sys/i386/eisa/dpt_eisa.c
@@ -33,7 +33,7 @@
*/
/*
- * $Id: dpt_eisa.c,v 1.5 1999/04/18 15:50:33 peter Exp $
+ * $Id: dpt_eisa.c,v 1.6 1999/05/08 21:59:19 dfr Exp $
*/
#include "eisa.h"
@@ -78,6 +78,7 @@ dpt_eisa_probe(device_t dev)
u_int32_t io_base;
u_int intdef;
u_int irq;
+ int shared;
desc = dpt_eisa_match(eisa_get_id(dev));
if (!desc)
@@ -88,10 +89,14 @@ dpt_eisa_probe(device_t dev)
+ DPT_EISA_SLOT_OFFSET;
eisa_add_iospace(dev, io_base, DPT_EISA_IOSIZE, RESVADDR_NONE);
+
+ outb((DPT_EISA_CFENABLE + io_base), 0xf8);
- intdef = inb(DPT_EISA_INTDEF + io_base);
+ intdef = inb(DPT_EISA_INTDEF + io_base);
irq = intdef & DPT_EISA_INT_NUM_MASK;
+ shared = (intdef & DPT_EISA_INT_LEVEL)
+ ? EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
switch (irq) {
case DPT_EISA_INT_NUM_11:
irq = 11;
@@ -103,15 +108,15 @@ dpt_eisa_probe(device_t dev)
irq = 14;
break;
default:
- printf("dpt at slot %d: illegal irq setting %d\n",
+ device_printf(dev, "dpt at slot %d: illegal irq setting %d\n",
eisa_get_slot(dev), irq);
irq = 0;
break;
}
if (irq == 0)
- return ENXIO;
+ return (ENXIO);
- eisa_add_intr(dev, irq);
+ eisa_add_intr(dev, irq, shared);
return 0;
}
@@ -123,7 +128,6 @@ dpt_eisa_attach(device_t dev)
struct resource *io = 0;
struct resource *irq = 0;
int unit = device_get_unit(dev);
- int shared;
int s;
int rid;
void *ih;
@@ -136,9 +140,6 @@ dpt_eisa_attach(device_t dev)
return ENOMEM;
}
- shared = (inb(DPT_EISA_INTDEF + rman_get_start(io))
- & DPT_EISA_INT_LEVEL) ? RF_SHAREABLE : 0;
-
dpt = dpt_alloc(unit, rman_get_bustag(io),
rman_get_bushandle(io) + DPT_EISA_EATA_REG_OFFSET);
if (dpt == NULL)
@@ -160,7 +161,7 @@ dpt_eisa_attach(device_t dev)
rid = 0;
irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, shared | RF_ACTIVE);
+ 0, ~0, 1, RF_ACTIVE);
if (!irq) {
device_printf(dev, "No irq?!\n");
goto bad;
diff --git a/sys/i386/eisa/dpt_eisa.h b/sys/i386/eisa/dpt_eisa.h
index e76087b04388..0731911d36cb 100644
--- a/sys/i386/eisa/dpt_eisa.h
+++ b/sys/i386/eisa/dpt_eisa.h
@@ -32,12 +32,14 @@
*/
/*
- * $Id: dpt_eisa.h,v 1.1 1998/03/11 00:30:14 julian Exp $
+ * $Id: dpt_eisa.h,v 1.2 1998/09/15 08:33:35 gibbs Exp $
*/
#define DPT_EISA_SLOT_OFFSET 0xc00
#define DPT_EISA_IOSIZE 0x100
+#define DPT_EISA_CFENABLE 0x8f
+
#define DPT_EISA_INTDEF 0x90
#define DPT_EISA_INT_LEVEL 0x04
#define DPT_EISA_INT_NUM_MASK 0x38
@@ -62,4 +64,3 @@
#define DPT_EISA_DPTBC01 0x1214BC01
#define DPT_EISA_NEC8200 0x12148200
#define DPT_EISA_ATT2408 0x12142408
-
diff --git a/sys/i386/eisa/eisaconf.c b/sys/i386/eisa/eisaconf.c
index abcc672e736d..dbf08d880d10 100644
--- a/sys/i386/eisa/eisaconf.c
+++ b/sys/i386/eisa/eisaconf.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: eisaconf.c,v 1.48 1999/07/29 01:02:51 mdodd Exp $
+ * $Id: eisaconf.c,v 1.49 1999/07/30 13:54:00 mdodd Exp $
*/
#include "opt_eisa.h"
@@ -62,6 +62,7 @@ LIST_HEAD(resvlist, resvaddr);
struct irq_node {
int irq_no;
+ int irq_trigger;
void *idesc;
TAILQ_ENTRY(irq_node) links;
};
@@ -92,7 +93,7 @@ int num_eisa_slots = EISA_SLOTS;
static devclass_t eisa_devclass;
static void eisa_reg_print (device_t, char *, char *, int *);
-static int eisa_find_irq(struct eisa_device *e_dev, int rid);
+static struct irq_node * eisa_find_irq(struct eisa_device *e_dev, int rid);
static struct resvaddr * eisa_find_maddr(struct eisa_device *e_dev, int rid);
static struct resvaddr * eisa_find_ioaddr(struct eisa_device *e_dev, int rid);
@@ -302,8 +303,9 @@ eisa_print_child(device_t dev, device_t child)
}
rid = 0;
- while ((irq = eisa_find_irq(e_dev, rid++)) != -1) {
- snprintf(buf, sizeof(buf), "irq %d", irq);
+ while ((irq = eisa_find_irq(e_dev, rid++)) != NULL) {
+ snprintf(buf, sizeof(buf), "irq %d (%s)", irq->irq_no,
+ (irq->irq_trigger ? "level" : "edge"));
eisa_reg_print(child, buf,
((rid == 1) ? &separator : NULL), &column);
}
@@ -315,7 +317,7 @@ eisa_print_child(device_t dev, device_t child)
return (retval);
}
-static int
+static struct irq_node *
eisa_find_irq(struct eisa_device *e_dev, int rid)
{
int i;
@@ -327,9 +329,9 @@ eisa_find_irq(struct eisa_device *e_dev, int rid)
;
if (irq)
- return irq->irq_no;
+ return (irq);
else
- return -1;
+ return (NULL);
}
static struct resvaddr *
@@ -364,6 +366,7 @@ static int
eisa_read_ivar(device_t dev, device_t child, int which, u_long *result)
{
struct eisa_device *e_dev = device_get_ivars(child);
+ struct irq_node *irq;
switch (which) {
case EISA_IVAR_SLOT:
@@ -376,7 +379,11 @@ eisa_read_ivar(device_t dev, device_t child, int which, u_long *result)
case EISA_IVAR_IRQ:
/* XXX only first irq */
- *result = eisa_find_irq(e_dev, 0);
+ if ((irq = eisa_find_irq(e_dev, 0)) != NULL) {
+ *result = irq->irq_no;
+ } else {
+ *result = -1;
+ }
break;
default:
@@ -406,11 +413,16 @@ eisa_alloc_resource(device_t dev, device_t child, int type, int *rid,
switch (type) {
case SYS_RES_IRQ:
if (isdefault) {
- int irq = eisa_find_irq(e_dev, *rid);
- if (irq == -1)
+ struct irq_node * irq = eisa_find_irq(e_dev, *rid);
+ if (irq == NULL)
return 0;
- start = end = irq;
+ start = end = irq->irq_no;
count = 1;
+ if (irq->irq_trigger == EISA_TRIGGER_LEVEL) {
+ flags |= RF_SHAREABLE;
+ } else {
+ flags &= ~RF_SHAREABLE;
+ }
}
break;
@@ -466,7 +478,7 @@ eisa_release_resource(device_t dev, device_t child, int type, int rid,
switch (type) {
case SYS_RES_IRQ:
- if (eisa_find_irq(e_dev, rid) == -1)
+ if (eisa_find_irq(e_dev, rid) == NULL)
return EINVAL;
break;
@@ -496,10 +508,10 @@ eisa_release_resource(device_t dev, device_t child, int type, int rid,
}
int
-eisa_add_intr(device_t dev, int irq)
+eisa_add_intr(device_t dev, int irq, int trigger)
{
struct eisa_device *e_dev = device_get_ivars(dev);
- struct irq_node *irq_info;
+ struct irq_node *irq_info;
irq_info = (struct irq_node *)malloc(sizeof(*irq_info), M_DEVBUF,
M_NOWAIT);
@@ -507,6 +519,7 @@ eisa_add_intr(device_t dev, int irq)
return (1);
irq_info->irq_no = irq;
+ irq_info->irq_trigger = trigger;
irq_info->idesc = NULL;
TAILQ_INSERT_TAIL(&e_dev->ioconf.irqs, irq_info, links);
return 0;
diff --git a/sys/i386/eisa/eisaconf.h b/sys/i386/eisa/eisaconf.h
index cb950c85a35b..6174b6b36926 100644
--- a/sys/i386/eisa/eisaconf.h
+++ b/sys/i386/eisa/eisaconf.h
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: eisaconf.h,v 1.17 1997/09/21 21:35:23 gibbs Exp $
+ * $Id: eisaconf.h,v 1.18 1999/04/18 15:50:33 peter Exp $
*/
#ifndef _I386_EISA_EISACONF_H_
@@ -53,6 +53,9 @@ enum eisa_device_ivars {
EISA_IVAR_IRQ
};
+#define EISA_TRIGGER_EDGE 0x0
+#define EISA_TRIGGER_LEVEL 0x1
+
/*
* Simplified accessors for isa devices
*/
@@ -75,7 +78,7 @@ EISA_ACCESSOR(slot, SLOT, int)
EISA_ACCESSOR(id, ID, eisa_id_t)
EISA_ACCESSOR(irq, IRQ, eisa_id_t)
-int eisa_add_intr __P((device_t, int));
+int eisa_add_intr __P((device_t, int, int));
#define RESVADDR_NONE 0x00
#define RESVADDR_BITMASK 0x01 /* size is a mask of reserved
diff --git a/sys/i386/eisa/if_fea.c b/sys/i386/eisa/if_fea.c
index 44c930ffa962..c98eb4bf96af 100644
--- a/sys/i386/eisa/if_fea.c
+++ b/sys/i386/eisa/if_fea.c
@@ -21,7 +21,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_fea.c,v 1.15 1999/07/10 19:46:08 peter Exp $
+ * $Id: if_fea.c,v 1.16 1999/07/31 00:43:48 mdodd Exp $
*/
/*
@@ -148,7 +148,7 @@ pdq_eisa_probe (dev)
eisa_add_iospace(dev, iobase, 0x200, RESVADDR_NONE);
eisa_add_mspace(dev, maddr, msize, RESVADDR_NONE);
- eisa_add_intr(dev, irq);
+ eisa_add_intr(dev, irq, EISA_TRIGGER_LEVEL);
return (0);
}
@@ -196,7 +196,7 @@ pdq_eisa_attach (dev)
rid = 0;
irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE);
+ 0, ~0, 1, RF_ACTIVE);
if (!irq) {
device_printf(dev, "No, irq?!\n");
diff --git a/sys/i386/eisa/if_vx_eisa.c b/sys/i386/eisa/if_vx_eisa.c
index 03e50a34c369..150e5738968c 100644
--- a/sys/i386/eisa/if_vx_eisa.c
+++ b/sys/i386/eisa/if_vx_eisa.c
@@ -106,7 +106,8 @@ vx_eisa_probe(device_t dev)
eisa_add_iospace(dev, port, VX_IOSIZE, RESVADDR_NONE);
/* Set irq */
- eisa_add_intr(dev, inw(iobase + VX_RESOURCE_CONFIG) >> 12);
+ eisa_add_intr(dev, inw(iobase + VX_RESOURCE_CONFIG) >> 12,
+ EISA_TRIGGER_EDGE);
return (0);
}
@@ -119,7 +120,6 @@ vx_eisa_attach(device_t dev)
struct resource *io = 0;
struct resource *eisa_io = 0;
struct resource *irq = 0;
- u_char level_intr;
int rid;
void *ih;
@@ -149,8 +149,6 @@ vx_eisa_attach(device_t dev)
sc->vx_io_addr = rman_get_start(io);
- level_intr = FALSE;
-
rid = 0;
irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
0, ~0, 1, RF_ACTIVE);