Deleted Added
full compact
subr_intr.c (297614) subr_intr.c (297674)
1/*-
2 * Copyright (c) 2015-2016 Svatopluk Kraus
3 * Copyright (c) 2015-2016 Michal Meloun
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2015-2016 Svatopluk Kraus
3 * Copyright (c) 2015-2016 Michal Meloun
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 12 unchanged lines hidden (view full) ---

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/kern/subr_intr.c 297614 2016-04-06 12:48:45Z skra $");
29__FBSDID("$FreeBSD: head/sys/kern/subr_intr.c 297674 2016-04-07 15:00:25Z skra $");
30
31/*
32 * New-style Interrupt Framework
33 *
34 * TODO: - to support IPI (PPI) enabling on other CPUs if already started
35 * - to complete things for removable PICs
36 */
37

--- 424 unchanged lines hidden (view full) ---

462 mtx_lock(&isrc_table_lock);
463 if ((isrc->isrc_flags & INTR_ISRCF_IPI) == 0)
464 isrc_release_counters(isrc);
465 error = isrc_free_irq(isrc);
466 mtx_unlock(&isrc_table_lock);
467 return (error);
468}
469
30
31/*
32 * New-style Interrupt Framework
33 *
34 * TODO: - to support IPI (PPI) enabling on other CPUs if already started
35 * - to complete things for removable PICs
36 */
37

--- 424 unchanged lines hidden (view full) ---

462 mtx_lock(&isrc_table_lock);
463 if ((isrc->isrc_flags & INTR_ISRCF_IPI) == 0)
464 isrc_release_counters(isrc);
465 error = isrc_free_irq(isrc);
466 mtx_unlock(&isrc_table_lock);
467 return (error);
468}
469
470#ifdef SMP
471/*
472 * A support function for a PIC to decide if provided ISRC should be inited
473 * on given cpu. The logic of INTR_ISRCF_BOUND flag and isrc_cpu member of
474 * struct intr_irqsrc is the following:
475 *
476 * If INTR_ISRCF_BOUND is set, the ISRC should be inited only on cpus
477 * set in isrc_cpu. If not, the ISRC should be inited on every cpu and
478 * isrc_cpu is kept consistent with it. Thus isrc_cpu is always correct.
479 */
480bool
481intr_isrc_init_on_cpu(struct intr_irqsrc *isrc, u_int cpu)
482{
483
484 if (isrc->isrc_handlers == 0)
485 return (false);
486 if ((isrc->isrc_flags & (INTR_ISRCF_PPI | INTR_ISRCF_IPI)) == 0)
487 return (false);
488 if (isrc->isrc_flags & INTR_ISRCF_BOUND)
489 return (CPU_ISSET(cpu, &isrc->isrc_cpu));
490
491 CPU_SET(cpu, &isrc->isrc_cpu);
492 return (true);
493}
494#endif
495
470static struct intr_dev_data *
471intr_ddata_alloc(u_int extsize)
472{
473 struct intr_dev_data *ddata;
474
475 ddata = malloc(sizeof(*ddata) + extsize, M_INTRNG, M_WAITOK | M_ZERO);
476
477 mtx_lock(&isrc_table_lock);

--- 767 unchanged lines hidden ---
496static struct intr_dev_data *
497intr_ddata_alloc(u_int extsize)
498{
499 struct intr_dev_data *ddata;
500
501 ddata = malloc(sizeof(*ddata) + extsize, M_INTRNG, M_WAITOK | M_ZERO);
502
503 mtx_lock(&isrc_table_lock);

--- 767 unchanged lines hidden ---