Home | History | Annotate | Line # | Download | only in powerpc
      1 /*-
      2  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
      3  * All rights reserved.
      4  *
      5  * This code is derived from software contributed to The NetBSD Foundation
      6  * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects
      7  * Agency and which was developed by Matt Thomas of 3am Software Foundry.
      8  *
      9  * This material is based upon work supported by the Defense Advanced Research
     10  * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
     11  * Contract No. N66001-09-C-2073.
     12  * Approved for Public Release, Distribution Unlimited
     13  *
     14  * Redistribution and use in source and binary forms, with or without
     15  * modification, are permitted provided that the following conditions
     16  * are met:
     17  * 1. Redistributions of source code must retain the above copyright
     18  *    notice, this list of conditions and the following disclaimer.
     19  * 2. Redistributions in binary form must reproduce the above copyright
     20  *    notice, this list of conditions and the following disclaimer in the
     21  *    documentation and/or other materials provided with the distribution.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     24  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     27  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33  * POSSIBILITY OF SUCH DAMAGE.
     34  */
     35 
     36 #define	__INTR_PRIVATE
     37 #define	__INTR_NOINLINE
     38 
     39 #include <sys/cdefs.h>
     40 __KERNEL_RCSID(0, "$NetBSD: intr_stubs.c,v 1.7 2020/07/06 09:34:18 rin Exp $");
     41 
     42 #include <sys/param.h>
     43 #include <sys/cpu.h>
     44 #include <sys/intr.h>
     45 
     46 static int
     47 null_splraise(int ipl)
     48 {
     49 	int cpl = curcpu()->ci_cpl;
     50 	curcpu()->ci_cpl = ipl;
     51 	return cpl;
     52 }
     53 
     54 static void
     55 null_splx(int ipl)
     56 {
     57 	curcpu()->ci_cpl = ipl;
     58 }
     59 
     60 static const struct intrsw null_intrsw = {
     61 	.intrsw_splraise = null_splraise,
     62 	.intrsw_splx = null_splx,
     63 };
     64 
     65 const struct intrsw *powerpc_intrsw = &null_intrsw;
     66 
     67 #define	__stub	__section(".stub") __noprofile
     68 
     69 void *intr_establish(int, int, int, int (*)(void *), void *) __noprofile;
     70 
     71 void *
     72 intr_establish(int irq, int ipl, int ist, int (*func)(void *), void *arg)
     73 {
     74 	return (*powerpc_intrsw->intrsw_establish)(irq, ipl, ist, func, arg,
     75 	    NULL);
     76 }
     77 
     78 void *intr_establish_xname(int, int, int, int (*)(void *), void *,
     79     const char *) __stub;
     80 
     81 void *
     82 intr_establish_xname(int irq, int ipl, int ist, int (*func)(void *), void *arg,
     83     const char *xname)
     84 {
     85 	return (*powerpc_intrsw->intrsw_establish)(irq, ipl, ist, func, arg,
     86 	    xname);
     87 }
     88 
     89 void intr_disestablish(void *) __stub;
     90 
     91 void
     92 intr_disestablish(void *ih)
     93 {
     94 	(*powerpc_intrsw->intrsw_disestablish)(ih);
     95 }
     96 
     97 const char *intr_string(int, int, char *, size_t) __stub;
     98 
     99 const char *
    100 intr_string(int irq, int ist, char *buf, size_t len)
    101 {
    102 	return (*powerpc_intrsw->intrsw_string)(irq, ist, buf, len);
    103 }
    104 
    105 void spl0(void) __stub;
    106 
    107 void
    108 spl0(void)
    109 {
    110 	(*powerpc_intrsw->intrsw_spl0)();
    111 }
    112 
    113 int splraise(int) __stub;
    114 
    115 int
    116 splraise(int ipl)
    117 {
    118 	return (*powerpc_intrsw->intrsw_splraise)(ipl);
    119 }
    120 
    121 /*
    122  * This is called by softint_cleanup and can't be a stub but it can call
    123  * a stub.
    124  */
    125 int
    126 splhigh(void)
    127 {
    128 	return splraise(IPL_HIGH);
    129 }
    130 
    131 void splx(int) __stub;
    132 
    133 void
    134 splx(int ipl)
    135 {
    136 	return (*powerpc_intrsw->intrsw_splx)(ipl);
    137 }
    138 
    139 #ifdef __HAVE_FAST_SOFTINTS
    140 void softint_init_md(struct lwp *, u_int, uintptr_t *) __stub;
    141 
    142 void
    143 softint_init_md(struct lwp *l, u_int level, uintptr_t *machdep_p)
    144 {
    145 	(*powerpc_intrsw->intrsw_softint_init_md)(l, level, machdep_p);
    146 }
    147 
    148 void softint_trigger(uintptr_t) __stub;
    149 
    150 void
    151 softint_trigger(uintptr_t machdep)
    152 {
    153 	(*powerpc_intrsw->intrsw_softint_trigger)(machdep);
    154 }
    155 #endif
    156 
    157 void intr_cpu_attach(struct cpu_info *) __stub;
    158 
    159 void
    160 intr_cpu_attach(struct cpu_info *ci)
    161 {
    162 	(*powerpc_intrsw->intrsw_cpu_attach)(ci);
    163 }
    164 
    165 void intr_cpu_hatch(struct cpu_info *) __stub;
    166 
    167 void
    168 intr_cpu_hatch(struct cpu_info *ci)
    169 {
    170 	(*powerpc_intrsw->intrsw_cpu_hatch)(ci);
    171 }
    172 
    173 void intr_init(void) __stub;
    174 
    175 void
    176 intr_init(void)
    177 {
    178 	(*powerpc_intrsw->intrsw_init)();
    179 }
    180 
    181 void intr_critintr(struct trapframe *) __stub;
    182 
    183 void
    184 intr_critintr(struct trapframe *tf)
    185 {
    186 	(*powerpc_intrsw->intrsw_critintr)(tf);
    187 
    188 }
    189 
    190 void intr_extintr(struct trapframe *) __stub;
    191 
    192 void
    193 intr_extintr(struct trapframe *tf)
    194 {
    195 	(*powerpc_intrsw->intrsw_extintr)(tf);
    196 
    197 }
    198 
    199 void intr_decrintr(struct trapframe *) __stub;
    200 
    201 void
    202 intr_decrintr(struct trapframe *tf)
    203 {
    204 	(*powerpc_intrsw->intrsw_decrintr)(tf);
    205 
    206 }
    207 
    208 void intr_fitintr(struct trapframe *) __stub;
    209 
    210 void
    211 intr_fitintr(struct trapframe *tf)
    212 {
    213 	(*powerpc_intrsw->intrsw_fitintr)(tf);
    214 
    215 }
    216 
    217 void intr_wdogintr(struct trapframe *) __stub;
    218 
    219 void
    220 intr_wdogintr(struct trapframe *tf)
    221 {
    222 	(*powerpc_intrsw->intrsw_wdogintr)(tf);
    223 }
    224 
    225 void cpu_send_ipi(cpuid_t, uint32_t) __stub;
    226 
    227 void
    228 cpu_send_ipi(cpuid_t id, uint32_t mask)
    229 {
    230 	(*powerpc_intrsw->intrsw_cpu_send_ipi)(id, mask);
    231 }
    232