Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/pic Update pic_add to allocate and return an ir...
details: https://anonhg.NetBSD.org/src/rev/1923cd8f6938
branches: trunk
changeset: 967866:1923cd8f6938
user: skrll <skrll%NetBSD.org@localhost>
date: Tue Dec 24 20:40:09 2019 +0000
description:
Update pic_add to allocate and return an irqbase if passed
PIC_IRQBASE_ALLOC.
diffstat:
sys/arch/arm/pic/pic.c | 15 +++++++++++----
sys/arch/arm/pic/picvar.h | 6 ++++--
2 files changed, 15 insertions(+), 6 deletions(-)
diffs (84 lines):
diff -r f36d48d56785 -r 1923cd8f6938 sys/arch/arm/pic/pic.c
--- a/sys/arch/arm/pic/pic.c Tue Dec 24 20:37:44 2019 +0000
+++ b/sys/arch/arm/pic/pic.c Tue Dec 24 20:40:09 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pic.c,v 1.51 2019/12/24 20:37:44 skrll Exp $ */
+/* $NetBSD: pic.c,v 1.52 2019/12/24 20:40:09 skrll Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -33,7 +33,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.51 2019/12/24 20:37:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.52 2019/12/24 20:40:09 skrll Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -99,6 +99,7 @@
static kmutex_t pic_lock;
static size_t pic_sourcebase;
+static int pic_lastbase;
static struct evcnt pic_deferral_ev =
EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "deferred", "intr");
EVCNT_ATTACH_STATIC(pic_deferral_ev);
@@ -633,7 +634,7 @@
return 0;
}
-void
+int
pic_add(struct pic_softc *pic, int irqbase)
{
int slot, maybe_slot = -1;
@@ -656,6 +657,9 @@
#endif /* __HAVE_PIC_PENDING_INTRS && MULTIPROCESSOR */
mutex_enter(&pic_lock);
+ if (irqbase == PIC_IRQBASE_ALLOC) {
+ irqbase = pic_lastbase;
+ }
for (slot = 0; slot < PIC_MAXPICS; slot++) {
struct pic_softc * const xpic = pic_list[slot];
if (xpic == NULL) {
@@ -686,7 +690,8 @@
KASSERT(pic_sourcebase + pic->pic_maxsources <= PIC_MAXMAXSOURCES);
sourcebase = pic_sourcebase;
pic_sourcebase += pic->pic_maxsources;
-
+ if (pic_lastbase < irqbase + pic->pic_maxsources)
+ pic_lastbase = irqbase + pic->pic_maxsources;
mutex_exit(&pic_lock);
/*
@@ -714,6 +719,8 @@
KASSERT((pic->pic_cpus != NULL) == (pic->pic_ops->pic_ipi_send != NULL));
#endif
pic_list[slot] = pic;
+
+ return irqbase;
}
int
diff -r f36d48d56785 -r 1923cd8f6938 sys/arch/arm/pic/picvar.h
--- a/sys/arch/arm/pic/picvar.h Tue Dec 24 20:37:44 2019 +0000
+++ b/sys/arch/arm/pic/picvar.h Tue Dec 24 20:40:09 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: picvar.h,v 1.25 2019/12/23 15:51:47 jmcneill Exp $ */
+/* $NetBSD: picvar.h,v 1.26 2019/12/24 20:40:09 skrll Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -186,7 +186,9 @@
#define pic_set_priority(ci, newipl) ((void)((ci)->ci_cpl = (newipl)))
#endif
-void pic_add(struct pic_softc *, int);
+#define PIC_IRQBASE_ALLOC (-2)
+
+int pic_add(struct pic_softc *, int);
void pic_do_pending_int(void);
#ifdef MULTIPROCESSOR
int pic_ipi_ast(void *);
Home |
Main Index |
Thread Index |
Old Index