Move the interrupt stub from booke_stubs.c into its own intr_stubs.c.

Move the "null" intrsw (used in startup) to intr_stubs.c as well.
This commit is contained in:
matt 2011-06-15 15:22:56 +00:00
parent d5e2b0cf4d
commit 139e8f0367
4 changed files with 169 additions and 137 deletions

View File

@ -95,26 +95,6 @@ booke_dma_bus_mem_to_phys(bus_dma_tag_t t, bus_addr_t a)
return a;
}
static int
null_splraise(int ipl)
{
int cpl = curcpu()->ci_cpl;
curcpu()->ci_cpl = ipl;
return cpl;
}
static void
null_splx(int ipl)
{
curcpu()->ci_cpl = ipl;
}
static const struct intrsw null_intrsw = {
.intrsw_splraise = null_splraise,
.intrsw_splx = null_splx,
};
const struct intrsw *powerpc_intrsw = &null_intrsw;
struct cpu_md_ops cpu_md_ops;
struct cpu_softc cpu_softc[] = {

View File

@ -33,16 +33,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#define __INTR_PRIVATE
#define __INTR_NOINLINE
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.5 2011/06/05 16:52:24 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.6 2011/06/15 15:22:56 matt Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
#include <sys/intr.h>
#include <powerpc/instr.h>
#include <powerpc/booke/cpuvar.h>
@ -169,114 +165,3 @@ tlb_walk(void *ctx, bool (*func)(void *, vaddr_t, uint32_t, uint32_t))
{
(*cpu_md_ops.md_tlb_ops->md_tlb_walk)(ctx, func);
}
void *intr_establish(int, int, int, int (*)(void *), void *) __stub;
void *
intr_establish(int irq, int ipl, int ist, int (*func)(void *), void *arg)
{
return (*powerpc_intrsw->intrsw_establish)(irq, ipl, ist, func, arg);
}
void intr_disestablish(void *) __stub;
void
intr_disestablish(void *ih)
{
(*powerpc_intrsw->intrsw_disestablish)(ih);
}
const char *intr_string(int, int) __stub;
const char *
intr_string(int irq, int ist)
{
return (*powerpc_intrsw->intrsw_string)(irq, ist);
}
void spl0(void) __stub;
void
spl0(void)
{
(*powerpc_intrsw->intrsw_spl0)();
}
int splraise(int) __stub;
int
splraise(int ipl)
{
return (*powerpc_intrsw->intrsw_splraise)(ipl);
}
#if 0
int splhigh(void) __stub;
#endif
/*
* This is called by softint_cleanup and can't be a stub but it can call
* a stub.
*/
int
splhigh(void)
{
return splraise(IPL_HIGH);
}
void splx(int) __stub;
void
splx(int ipl)
{
return (*powerpc_intrsw->intrsw_splx)(ipl);
}
void softint_init_md(struct lwp *, u_int, uintptr_t *) __stub;
void
softint_init_md(struct lwp *l, u_int level, uintptr_t *machdep_p)
{
(*powerpc_intrsw->intrsw_softint_init_md)(l, level, machdep_p);
}
void softint_trigger(uintptr_t) __stub;
void
softint_trigger(uintptr_t machdep)
{
(*powerpc_intrsw->intrsw_softint_trigger)(machdep);
}
void intr_cpu_attach(struct cpu_info *) __stub;
void
intr_cpu_attach(struct cpu_info *ci)
{
(*powerpc_intrsw->intrsw_cpu_attach)(ci);
}
void intr_cpu_hatch(struct cpu_info *) __stub;
void
intr_cpu_hatch(struct cpu_info *ci)
{
(*powerpc_intrsw->intrsw_cpu_hatch)(ci);
}
void intr_init(void) __stub;
void
intr_init(void)
{
(*powerpc_intrsw->intrsw_init)();
}
void
booke_fixup_stubs(void)
{
extern uint32_t _ftext[];
extern uint32_t _etext[];
powerpc_fixup_stubs(_ftext, _etext, NULL, NULL);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: files.powerpc,v 1.79 2011/06/14 22:36:12 matt Exp $
# $NetBSD: files.powerpc,v 1.80 2011/06/15 15:22:56 matt Exp $
defflag opt_altivec.h ALTIVEC K_ALTIVEC PPC_HAVE_SPE
defflag opt_openpic.h OPENPIC OPENPIC_SERIAL_MODE OPENPIC_DISTRIBUTE
@ -36,6 +36,7 @@ file arch/powerpc/powerpc/db_disasm.c ddb
file arch/powerpc/powerpc/db_interface.c ddb | kgdb
file arch/powerpc/powerpc/db_trace.c ddb
file arch/powerpc/powerpc/fpu.c
file arch/powerpc/powerpc/intr_stubs.c ppc_booke
# IBM 4xx Family files (40x)
file arch/powerpc/ibm4xx/pmap.c ppc_ibm4xx

View File

@ -0,0 +1,166 @@
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Raytheon BBN Technologies Corp and Defense Advanced Research Projects
* Agency and which was developed by Matt Thomas of 3am Software Foundry.
*
* This material is based upon work supported by the Defense Advanced Research
* Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
* Contract No. N66001-09-C-2073.
* Approved for Public Release, Distribution Unlimited
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#define __INTR_PRIVATE
#define __INTR_NOINLINE
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intr_stubs.c,v 1.1 2011/06/15 15:22:56 matt Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
#include <sys/intr.h>
static int
null_splraise(int ipl)
{
int cpl = curcpu()->ci_cpl;
curcpu()->ci_cpl = ipl;
return cpl;
}
static void
null_splx(int ipl)
{
curcpu()->ci_cpl = ipl;
}
static const struct intrsw null_intrsw = {
.intrsw_splraise = null_splraise,
.intrsw_splx = null_splx,
};
const struct intrsw *powerpc_intrsw = &null_intrsw;
#define __stub __section(".stub") __noprofile
void *intr_establish(int, int, int, int (*)(void *), void *) __stub;
void *
intr_establish(int irq, int ipl, int ist, int (*func)(void *), void *arg)
{
return (*powerpc_intrsw->intrsw_establish)(irq, ipl, ist, func, arg);
}
void intr_disestablish(void *) __stub;
void
intr_disestablish(void *ih)
{
(*powerpc_intrsw->intrsw_disestablish)(ih);
}
const char *intr_string(int, int) __stub;
const char *
intr_string(int irq, int ist)
{
return (*powerpc_intrsw->intrsw_string)(irq, ist);
}
void spl0(void) __stub;
void
spl0(void)
{
(*powerpc_intrsw->intrsw_spl0)();
}
int splraise(int) __stub;
int
splraise(int ipl)
{
return (*powerpc_intrsw->intrsw_splraise)(ipl);
}
/*
* This is called by softint_cleanup and can't be a stub but it can call
* a stub.
*/
int
splhigh(void)
{
return splraise(IPL_HIGH);
}
void splx(int) __stub;
void
splx(int ipl)
{
return (*powerpc_intrsw->intrsw_splx)(ipl);
}
void softint_init_md(struct lwp *, u_int, uintptr_t *) __stub;
void
softint_init_md(struct lwp *l, u_int level, uintptr_t *machdep_p)
{
(*powerpc_intrsw->intrsw_softint_init_md)(l, level, machdep_p);
}
void softint_trigger(uintptr_t) __stub;
void
softint_trigger(uintptr_t machdep)
{
(*powerpc_intrsw->intrsw_softint_trigger)(machdep);
}
void intr_cpu_attach(struct cpu_info *) __stub;
void
intr_cpu_attach(struct cpu_info *ci)
{
(*powerpc_intrsw->intrsw_cpu_attach)(ci);
}
void intr_cpu_hatch(struct cpu_info *) __stub;
void
intr_cpu_hatch(struct cpu_info *ci)
{
(*powerpc_intrsw->intrsw_cpu_hatch)(ci);
}
void intr_init(void) __stub;
void
intr_init(void)
{
(*powerpc_intrsw->intrsw_init)();
}