aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/eisa
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 /sys/dev/eisa
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
Diffstat (limited to 'sys/dev/eisa')
-rw-r--r--sys/dev/eisa/eisaconf.c41
-rw-r--r--sys/dev/eisa/eisaconf.h7
2 files changed, 32 insertions, 16 deletions
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