1289529Sian#- 2297539Sskra# Copyright (c) 2015-2016 Svatopluk Kraus 3297539Sskra# Copyright (c) 2015-2016 Michal Meloun 4289529Sian# All rights reserved. 5289529Sian# 6289529Sian# Redistribution and use in source and binary forms, with or without 7289529Sian# modification, are permitted provided that the following conditions 8289529Sian# are met: 9289529Sian# 1. Redistributions of source code must retain the above copyright 10289529Sian# notice, this list of conditions and the following disclaimer. 11289529Sian# 2. Redistributions in binary form must reproduce the above copyright 12289529Sian# notice, this list of conditions and the following disclaimer in the 13289529Sian# documentation and/or other materials provided with the distribution. 14289529Sian# 15289529Sian# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16289529Sian# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17289529Sian# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18289529Sian# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19289529Sian# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20289529Sian# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21289529Sian# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22289529Sian# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23289529Sian# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24289529Sian# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25289529Sian# SUCH DAMAGE. 26289529Sian# 27289529Sian# $FreeBSD: releng/11.0/sys/kern/pic_if.m 297539 2016-04-04 09:15:25Z skra $ 28289529Sian# 29289529Sian 30289529Sian#include <sys/bus.h> 31289529Sian#include <sys/cpuset.h> 32297539Sskra#include <sys/resource.h> 33297539Sskra#include <sys/intr.h> 34289529Sian 35289529SianINTERFACE pic; 36289529Sian 37289529SianCODE { 38297539Sskra static int 39297539Sskra dflt_pic_bind_intr(device_t dev, struct intr_irqsrc *isrc) 40289529Sian { 41297539Sskra 42289529Sian return (EOPNOTSUPP); 43289529Sian } 44289529Sian 45297539Sskra static int 46297539Sskra null_pic_alloc_intr(device_t dev, struct intr_irqsrc *isrc, 47297539Sskra struct resource *res, struct intr_map_data *data) 48289529Sian { 49297539Sskra 50297539Sskra return (0); 51289529Sian } 52289529Sian 53297539Sskra static int 54297539Sskra null_pic_release_intr(device_t dev, struct intr_irqsrc *isrc, 55297539Sskra struct resource *res, struct intr_map_data *data) 56289529Sian { 57297539Sskra 58297539Sskra return (0); 59289529Sian } 60289529Sian 61297539Sskra static int 62297539Sskra null_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, 63297539Sskra struct resource *res, struct intr_map_data *data) 64289529Sian { 65297539Sskra 66297539Sskra return (0); 67289529Sian } 68289529Sian 69297539Sskra static int 70297539Sskra null_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, 71297539Sskra struct resource *res, struct intr_map_data *data) 72289529Sian { 73297539Sskra 74297539Sskra return (0); 75289529Sian } 76297230Sskra 77297539Sskra static void 78297539Sskra null_pic_init_secondary(device_t dev) 79297539Sskra { 80297539Sskra } 81297539Sskra 82297539Sskra static void 83297539Sskra null_pic_ipi_send(device_t dev, cpuset_t cpus, u_int ipi) 84297539Sskra { 85297539Sskra } 86297539Sskra 87297230Sskra static int 88297230Sskra dflt_pic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc *isrc) 89297230Sskra { 90297230Sskra 91297230Sskra return (EOPNOTSUPP); 92297230Sskra } 93289529Sian}; 94289529Sian 95297539SskraMETHOD int alloc_intr { 96289529Sian device_t dev; 97292426Sadrian struct intr_irqsrc *isrc; 98297539Sskra struct resource *res; 99297539Sskra struct intr_map_data *data; 100297539Sskra} DEFAULT null_pic_alloc_intr; 101289529Sian 102297539SskraMETHOD int bind_intr { 103289529Sian device_t dev; 104292426Sadrian struct intr_irqsrc *isrc; 105297539Sskra} DEFAULT dflt_pic_bind_intr; 106289529Sian 107289529SianMETHOD void disable_intr { 108289529Sian device_t dev; 109292426Sadrian struct intr_irqsrc *isrc; 110297539Sskra}; 111289529Sian 112297539SskraMETHOD void enable_intr { 113289529Sian device_t dev; 114292426Sadrian struct intr_irqsrc *isrc; 115289529Sian}; 116289529Sian 117297539SskraMETHOD int map_intr { 118289529Sian device_t dev; 119297539Sskra struct intr_map_data *data; 120297539Sskra struct intr_irqsrc **isrcp; 121289529Sian}; 122289529Sian 123297539SskraMETHOD int release_intr { 124289529Sian device_t dev; 125292426Sadrian struct intr_irqsrc *isrc; 126297539Sskra struct resource *res; 127297539Sskra struct intr_map_data *data; 128297539Sskra} DEFAULT null_pic_release_intr; 129289529Sian 130297539SskraMETHOD int setup_intr { 131289529Sian device_t dev; 132292426Sadrian struct intr_irqsrc *isrc; 133297539Sskra struct resource *res; 134297539Sskra struct intr_map_data *data; 135297539Sskra} DEFAULT null_pic_setup_intr; 136289529Sian 137297539SskraMETHOD int teardown_intr { 138289529Sian device_t dev; 139292426Sadrian struct intr_irqsrc *isrc; 140297539Sskra struct resource *res; 141297539Sskra struct intr_map_data *data; 142297539Sskra} DEFAULT null_pic_teardown_intr; 143289529Sian 144289529SianMETHOD void post_filter { 145289529Sian device_t dev; 146292426Sadrian struct intr_irqsrc *isrc; 147289529Sian}; 148289529Sian 149297539SskraMETHOD void post_ithread { 150289529Sian device_t dev; 151292426Sadrian struct intr_irqsrc *isrc; 152297539Sskra}; 153289529Sian 154297539SskraMETHOD void pre_ithread { 155297539Sskra device_t dev; 156297539Sskra struct intr_irqsrc *isrc; 157297539Sskra}; 158297539Sskra 159289529SianMETHOD void init_secondary { 160289529Sian device_t dev; 161289529Sian} DEFAULT null_pic_init_secondary; 162289529Sian 163289529SianMETHOD void ipi_send { 164289529Sian device_t dev; 165292426Sadrian struct intr_irqsrc *isrc; 166289529Sian cpuset_t cpus; 167297539Sskra u_int ipi; 168289529Sian} DEFAULT null_pic_ipi_send; 169297230Sskra 170297230SskraMETHOD int ipi_setup { 171297230Sskra device_t dev; 172297230Sskra u_int ipi; 173297539Sskra struct intr_irqsrc **isrcp; 174297230Sskra} DEFAULT dflt_pic_ipi_setup; 175