Introduce BUS_CONFIG_INTR(). The method allows devices to tell parents

about interrupt trigger mode and interrupt polarity. This allows ACPI
for example to pass interrupt resource information up the hierarchy.
The default implementation of the method therefore is to pass the
request to the parent.

Reviewed by: jhb, njl
This commit is contained in:
Marcel Moolenaar 2003-09-10 21:37:10 +00:00
parent 28e0a3843a
commit da13b8f9fe
3 changed files with 36 additions and 0 deletions

View File

@ -280,3 +280,14 @@ METHOD int child_location_str {
char *_buf;
size_t _buflen;
};
#
# Allow (bus) drivers to specify the trigger mode and polarity of the
# specified interrupt.
#
METHOD int config_intr {
device_t _dev;
int _irq;
enum intr_trigger _trig;
enum intr_polarity _pol;
} DEFAULT bus_generic_config_intr;

View File

@ -1925,6 +1925,17 @@ bus_generic_deactivate_resource(device_t dev, device_t child, int type,
return (EINVAL);
}
int
bus_generic_config_intr(device_t dev, int irq, enum intr_trigger trig,
enum intr_polarity pol)
{
/* Propagate up the bus hierarchy until someone handles it. */
if (dev->parent)
return (BUS_CONFIG_INTR(dev->parent, irq, trig, pol));
return (EINVAL);
}
int
bus_generic_rl_get_resource (device_t dev, device_t child, int type, int rid,
u_long *startp, u_long *countp)

View File

@ -110,6 +110,18 @@ enum intr_type {
INTR_ENTROPY = 1024 /* this interrupt provides entropy */
};
enum intr_trigger {
INTR_TRIGGER_CONFORM = 0,
INTR_TRIGGER_EDGE = 1,
INTR_TRIGGER_LEVEL = 2
};
enum intr_polarity {
INTR_POLARITY_CONFORM = 0,
INTR_POLARITY_HIGH = 1,
INTR_POLARITY_LOW = 2
};
typedef int (*devop_t)(void);
struct driver {
@ -219,6 +231,8 @@ struct resource *
u_long count, u_int flags);
int bus_generic_attach(device_t dev);
int bus_generic_child_present(device_t dev, device_t child);
int bus_generic_config_intr(device_t, int, enum intr_trigger,
enum intr_polarity);
int bus_generic_deactivate_resource(device_t dev, device_t child, int type,
int rid, struct resource *r);
int bus_generic_detach(device_t dev);