summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2020-06-23 01:40:04 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2020-06-23 01:40:04 +0000
commit200798d21cd2a3bedad49c5e2d0ac8035c18dd43 (patch)
tree4a7c1f0a16bee8217a0701e9cac79b6324067821 /sys/kern
parent5b920ec6337f4a4787cb8dafb6c77e88da713694 (diff)
add intrmap_one, some temp code to help us write pci_intr_establish_cpu.
it means we can do quick hacks to existing drivers to test interrupts on multiple cpus. emphasis on quick and hacks. ok jmatthew@, who will also ok the removal of it at the right time.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_intrmap.c16
1 files changed, 15 insertions, 1 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);
+}