Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/arm/machdep_intr.c
/* $NetBSD: intr.c,v 1.12 2003/07/15 00:24:41 lukem Exp $ */ | |||||
/*- | /*- | ||||
* Copyright (c) 2004 Olivier Houchard. | * Copyright (c) 2015-2016 Svatopluk Kraus | ||||
* Copyright (c) 1994-1998 Mark Brinicombe. | * Copyright (c) 2015-2016 Michal Meloun | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
* notice, this list of conditions and the following disclaimer. | * notice, this list of conditions and the following disclaimer. | ||||
* 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
* notice, this list of conditions and the following disclaimer in the | * notice, this list of conditions and the following disclaimer in the | ||||
* documentation and/or other materials provided with the distribution. | * documentation and/or other materials provided with the distribution. | ||||
* 3. All advertising materials mentioning features or use of this software | |||||
* must display the following acknowledgement: | |||||
* This product includes software developed by Mark Brinicombe | |||||
* for the NetBSD Project. | |||||
* 4. The name of the company nor the name of the author may be used to | |||||
* endorse or promote products derived from this software without specific | |||||
* prior written permission. | |||||
* | * | ||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * 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 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | |||||
* Soft interrupt and other generic interrupt functions. | |||||
*/ | */ | ||||
#include "opt_platform.h" | #include "opt_platform.h" | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
Show All 26 Lines | struct intr_ipi { | ||||
void * ii_handler_arg; | void * ii_handler_arg; | ||||
intr_ipi_send_t * ii_send; | intr_ipi_send_t * ii_send; | ||||
void * ii_send_arg; | void * ii_send_arg; | ||||
char ii_name[INTR_IPI_NAMELEN]; | char ii_name[INTR_IPI_NAMELEN]; | ||||
u_long * ii_count; | u_long * ii_count; | ||||
}; | }; | ||||
static struct intr_ipi ipi_sources[INTR_IPI_COUNT]; | static struct intr_ipi ipi_sources[INTR_IPI_COUNT]; | ||||
u_int ipi_next_num; | |||||
#endif | #endif | ||||
#endif | #endif | ||||
/* | /* | ||||
* arm_irq_memory_barrier() | * arm_irq_memory_barrier() | ||||
* | * | ||||
* Ensure all writes to device memory have reached devices before proceeding. | * Ensure all writes to device memory have reached devices before proceeding. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | |||||
intr_pic_ipi_setup(u_int ipi, const char *name, intr_ipi_handler_t *hand, | intr_pic_ipi_setup(u_int ipi, const char *name, intr_ipi_handler_t *hand, | ||||
void *arg) | void *arg) | ||||
{ | { | ||||
int error; | int error; | ||||
struct intr_irqsrc *isrc; | struct intr_irqsrc *isrc; | ||||
KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__)); | KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__)); | ||||
isrc = intr_isrc_alloc(INTR_ISRCT_NAMESPACE, 0); | error = PIC_IPI_SETUP(intr_irq_root_dev, ipi, &isrc); | ||||
isrc->isrc_nspc_type = INTR_IRQ_NSPC_IPI; | |||||
isrc->isrc_nspc_num = ipi_next_num; | |||||
error = PIC_IPI_SETUP(intr_irq_root_dev, ipi, isrc); | |||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
ipi_next_num++; | |||||
isrc->isrc_dev = intr_irq_root_dev; | |||||
isrc->isrc_handlers = 1; | isrc->isrc_handlers = 1; | ||||
intr_ipi_setup(ipi, name, hand, arg, pic_ipi_send, isrc); | intr_ipi_setup(ipi, name, hand, arg, pic_ipi_send, isrc); | ||||
return (0); | return (0); | ||||
} | } | ||||
#endif | #endif | ||||
#endif | #endif |