diff options
-rw-r--r-- | sys/kern/kern_intrmap.c | 16 | ||||
-rw-r--r-- | sys/sys/intrmap.h | 3 |
2 files changed, 17 insertions, 2 deletions
diff --git a/sys/kern/kern_intrmap.c b/sys/kern/kern_intrmap.c index 183531e20b1..4207456090c 100644 --- a/sys/kern/kern_intrmap.c +++ b/sys/kern/kern_intrmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_intrmap.c,v 1.2 2020/06/17 03:01:26 dlg Exp $ */ +/* $OpenBSD: kern_intrmap.c,v 1.3 2020/06/23 01:40:03 dlg Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -345,3 +345,17 @@ intrmap_cpu(const struct intrmap *im, unsigned int ring) " (intrmap %p)", icpu, ring, im); return (ic->ic_cpumap[icpu]); } + +struct cpu_info * +intrmap_one(const struct device *dv) +{ + unsigned int unit = dv->dv_unit; + struct intrmap_cpus *ic; + struct cpu_info *ci; + + ic = intrmap_cpus_get(); + ci = ic->ic_cpumap[unit % ic->ic_count]; + intrmap_cpus_put(ic); + + return (ci); +} diff --git a/sys/sys/intrmap.h b/sys/sys/intrmap.h index 7340121f0cc..f15711e2556 100644 --- a/sys/sys/intrmap.h +++ b/sys/sys/intrmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intrmap.h,v 1.2 2020/06/17 03:01:26 dlg Exp $ */ +/* $OpenBSD: intrmap.h,v 1.3 2020/06/23 01:40:03 dlg Exp $ */ /* * Copyright (c) 2020 David Gwynne <dlg@openbsd.org> @@ -34,5 +34,6 @@ void intrmap_align(const struct device *, unsigned int intrmap_count(const struct intrmap *); struct cpu_info *intrmap_cpu(const struct intrmap *, unsigned int); +struct cpu_info *intrmap_one(const struct device *); #endif /* _SYS_INTRMAP_H_ */ |