Module Name: src Committed By: skrll Date: Tue Dec 24 20:40:09 UTC 2019
Modified Files: src/sys/arch/arm/pic: pic.c picvar.h Log Message: Update pic_add to allocate and return an irqbase if passed PIC_IRQBASE_ALLOC. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/arch/arm/pic/pic.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/pic/picvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/pic/pic.c diff -u src/sys/arch/arm/pic/pic.c:1.51 src/sys/arch/arm/pic/pic.c:1.52 --- src/sys/arch/arm/pic/pic.c:1.51 Tue Dec 24 20:37:44 2019 +++ src/sys/arch/arm/pic/pic.c Tue Dec 24 20:40:09 2019 @@ -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 @@ size_t pic_ipl_offset[NIPL+1]; 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 @@ pic_init(void) return 0; } -void +int pic_add(struct pic_softc *pic, int irqbase) { int slot, maybe_slot = -1; @@ -656,6 +657,9 @@ pic_add(struct pic_softc *pic, int irqba #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 @@ pic_add(struct pic_softc *pic, int irqba 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 @@ pic_add(struct pic_softc *pic, int irqba KASSERT((pic->pic_cpus != NULL) == (pic->pic_ops->pic_ipi_send != NULL)); #endif pic_list[slot] = pic; + + return irqbase; } int Index: src/sys/arch/arm/pic/picvar.h diff -u src/sys/arch/arm/pic/picvar.h:1.25 src/sys/arch/arm/pic/picvar.h:1.26 --- src/sys/arch/arm/pic/picvar.h:1.25 Mon Dec 23 15:51:47 2019 +++ src/sys/arch/arm/pic/picvar.h Tue Dec 24 20:40:09 2019 @@ -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 @@ void pic_set_priority(struct cpu_info *, #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 *);