12b3ad188SAdrian Chadd#- 2bff6be3eSSvatopluk Kraus# Copyright (c) 2015-2016 Svatopluk Kraus 3bff6be3eSSvatopluk Kraus# Copyright (c) 2015-2016 Michal Meloun 42b3ad188SAdrian Chadd# All rights reserved. 52b3ad188SAdrian Chadd# 62b3ad188SAdrian Chadd# Redistribution and use in source and binary forms, with or without 72b3ad188SAdrian Chadd# modification, are permitted provided that the following conditions 82b3ad188SAdrian Chadd# are met: 92b3ad188SAdrian Chadd# 1. Redistributions of source code must retain the above copyright 102b3ad188SAdrian Chadd# notice, this list of conditions and the following disclaimer. 112b3ad188SAdrian Chadd# 2. Redistributions in binary form must reproduce the above copyright 122b3ad188SAdrian Chadd# notice, this list of conditions and the following disclaimer in the 132b3ad188SAdrian Chadd# documentation and/or other materials provided with the distribution. 142b3ad188SAdrian Chadd# 152b3ad188SAdrian Chadd# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 162b3ad188SAdrian Chadd# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 172b3ad188SAdrian Chadd# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 182b3ad188SAdrian Chadd# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 192b3ad188SAdrian Chadd# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 202b3ad188SAdrian Chadd# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 212b3ad188SAdrian Chadd# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 222b3ad188SAdrian Chadd# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 232b3ad188SAdrian Chadd# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 242b3ad188SAdrian Chadd# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 252b3ad188SAdrian Chadd# SUCH DAMAGE. 262b3ad188SAdrian Chadd# 272b3ad188SAdrian Chadd# 282b3ad188SAdrian Chadd 292b3ad188SAdrian Chadd#include <sys/bus.h> 302b3ad188SAdrian Chadd#include <sys/cpuset.h> 31bff6be3eSSvatopluk Kraus#include <sys/resource.h> 32bff6be3eSSvatopluk Kraus#include <sys/intr.h> 332b3ad188SAdrian Chadd 342b3ad188SAdrian ChaddINTERFACE pic; 352b3ad188SAdrian Chadd 362b3ad188SAdrian ChaddCODE { 37bff6be3eSSvatopluk Kraus static int 38bff6be3eSSvatopluk Kraus dflt_pic_bind_intr(device_t dev, struct intr_irqsrc *isrc) 392b3ad188SAdrian Chadd { 40bff6be3eSSvatopluk Kraus 412b3ad188SAdrian Chadd return (EOPNOTSUPP); 422b3ad188SAdrian Chadd } 432b3ad188SAdrian Chadd 44bff6be3eSSvatopluk Kraus static int 45895c8b1cSMichal Meloun null_pic_activate_intr(device_t dev, struct intr_irqsrc *isrc, 46bff6be3eSSvatopluk Kraus struct resource *res, struct intr_map_data *data) 472b3ad188SAdrian Chadd { 48bff6be3eSSvatopluk Kraus 49bff6be3eSSvatopluk Kraus return (0); 502b3ad188SAdrian Chadd } 512b3ad188SAdrian Chadd 52bff6be3eSSvatopluk Kraus static int 53895c8b1cSMichal Meloun null_pic_deactivate_intr(device_t dev, struct intr_irqsrc *isrc, 54bff6be3eSSvatopluk Kraus struct resource *res, struct intr_map_data *data) 552b3ad188SAdrian Chadd { 56bff6be3eSSvatopluk Kraus 57bff6be3eSSvatopluk Kraus return (0); 582b3ad188SAdrian Chadd } 592b3ad188SAdrian Chadd 60bff6be3eSSvatopluk Kraus static int 61bff6be3eSSvatopluk Kraus null_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, 62bff6be3eSSvatopluk Kraus struct resource *res, struct intr_map_data *data) 632b3ad188SAdrian Chadd { 64bff6be3eSSvatopluk Kraus 65bff6be3eSSvatopluk Kraus return (0); 662b3ad188SAdrian Chadd } 672b3ad188SAdrian Chadd 68bff6be3eSSvatopluk Kraus static int 69bff6be3eSSvatopluk Kraus null_pic_teardown_intr(device_t dev, struct intr_irqsrc *isrc, 70bff6be3eSSvatopluk Kraus struct resource *res, struct intr_map_data *data) 712b3ad188SAdrian Chadd { 72bff6be3eSSvatopluk Kraus 73bff6be3eSSvatopluk Kraus return (0); 74bff6be3eSSvatopluk Kraus } 75bff6be3eSSvatopluk Kraus 76bff6be3eSSvatopluk Kraus static void 77bff6be3eSSvatopluk Kraus null_pic_init_secondary(device_t dev) 78bff6be3eSSvatopluk Kraus { 79bff6be3eSSvatopluk Kraus } 80bff6be3eSSvatopluk Kraus 81bff6be3eSSvatopluk Kraus static void 82bff6be3eSSvatopluk Kraus null_pic_ipi_send(device_t dev, cpuset_t cpus, u_int ipi) 83bff6be3eSSvatopluk Kraus { 842b3ad188SAdrian Chadd } 8561c8fde5SSvatopluk Kraus 8661c8fde5SSvatopluk Kraus static int 8761c8fde5SSvatopluk Kraus dflt_pic_ipi_setup(device_t dev, u_int ipi, struct intr_irqsrc *isrc) 8861c8fde5SSvatopluk Kraus { 8961c8fde5SSvatopluk Kraus 9061c8fde5SSvatopluk Kraus return (EOPNOTSUPP); 9161c8fde5SSvatopluk Kraus } 922b3ad188SAdrian Chadd}; 932b3ad188SAdrian Chadd 94895c8b1cSMichal MelounMETHOD int activate_intr { 952b3ad188SAdrian Chadd device_t dev; 962b3ad188SAdrian Chadd struct intr_irqsrc *isrc; 97bff6be3eSSvatopluk Kraus struct resource *res; 98bff6be3eSSvatopluk Kraus struct intr_map_data *data; 99895c8b1cSMichal Meloun} DEFAULT null_pic_activate_intr; 1002b3ad188SAdrian Chadd 101bff6be3eSSvatopluk KrausMETHOD int bind_intr { 1022b3ad188SAdrian Chadd device_t dev; 1032b3ad188SAdrian Chadd struct intr_irqsrc *isrc; 104bff6be3eSSvatopluk Kraus} DEFAULT dflt_pic_bind_intr; 1052b3ad188SAdrian Chadd 1062b3ad188SAdrian ChaddMETHOD void disable_intr { 1072b3ad188SAdrian Chadd device_t dev; 1082b3ad188SAdrian Chadd struct intr_irqsrc *isrc; 1092b3ad188SAdrian Chadd}; 1102b3ad188SAdrian Chadd 1112b3ad188SAdrian ChaddMETHOD void enable_intr { 1122b3ad188SAdrian Chadd device_t dev; 1132b3ad188SAdrian Chadd struct intr_irqsrc *isrc; 114bff6be3eSSvatopluk Kraus}; 1152b3ad188SAdrian Chadd 116bff6be3eSSvatopluk KrausMETHOD int map_intr { 117bff6be3eSSvatopluk Kraus device_t dev; 118bff6be3eSSvatopluk Kraus struct intr_map_data *data; 119bff6be3eSSvatopluk Kraus struct intr_irqsrc **isrcp; 120bff6be3eSSvatopluk Kraus}; 121bff6be3eSSvatopluk Kraus 122895c8b1cSMichal MelounMETHOD int deactivate_intr { 123bff6be3eSSvatopluk Kraus device_t dev; 124bff6be3eSSvatopluk Kraus struct intr_irqsrc *isrc; 125bff6be3eSSvatopluk Kraus struct resource *res; 126bff6be3eSSvatopluk Kraus struct intr_map_data *data; 127895c8b1cSMichal Meloun} DEFAULT null_pic_deactivate_intr; 128bff6be3eSSvatopluk Kraus 129bff6be3eSSvatopluk KrausMETHOD int setup_intr { 130bff6be3eSSvatopluk Kraus device_t dev; 131bff6be3eSSvatopluk Kraus struct intr_irqsrc *isrc; 132bff6be3eSSvatopluk Kraus struct resource *res; 133bff6be3eSSvatopluk Kraus struct intr_map_data *data; 134bff6be3eSSvatopluk Kraus} DEFAULT null_pic_setup_intr; 135bff6be3eSSvatopluk Kraus 136bff6be3eSSvatopluk KrausMETHOD int teardown_intr { 137bff6be3eSSvatopluk Kraus device_t dev; 138bff6be3eSSvatopluk Kraus struct intr_irqsrc *isrc; 139bff6be3eSSvatopluk Kraus struct resource *res; 140bff6be3eSSvatopluk Kraus struct intr_map_data *data; 141bff6be3eSSvatopluk Kraus} DEFAULT null_pic_teardown_intr; 142bff6be3eSSvatopluk Kraus 143bff6be3eSSvatopluk KrausMETHOD void post_filter { 1442b3ad188SAdrian Chadd device_t dev; 1452b3ad188SAdrian Chadd struct intr_irqsrc *isrc; 1462b3ad188SAdrian Chadd}; 1472b3ad188SAdrian Chadd 1482b3ad188SAdrian ChaddMETHOD void post_ithread { 1492b3ad188SAdrian Chadd device_t dev; 1502b3ad188SAdrian Chadd struct intr_irqsrc *isrc; 1512b3ad188SAdrian Chadd}; 1522b3ad188SAdrian Chadd 153bff6be3eSSvatopluk KrausMETHOD void pre_ithread { 1542b3ad188SAdrian Chadd device_t dev; 1552b3ad188SAdrian Chadd struct intr_irqsrc *isrc; 1562b3ad188SAdrian Chadd}; 1572b3ad188SAdrian Chadd 1582b3ad188SAdrian ChaddMETHOD void init_secondary { 1592b3ad188SAdrian Chadd device_t dev; 1602b3ad188SAdrian Chadd} DEFAULT null_pic_init_secondary; 1612b3ad188SAdrian Chadd 1622b3ad188SAdrian ChaddMETHOD void ipi_send { 1632b3ad188SAdrian Chadd device_t dev; 1642b3ad188SAdrian Chadd struct intr_irqsrc *isrc; 1652b3ad188SAdrian Chadd cpuset_t cpus; 166bff6be3eSSvatopluk Kraus u_int ipi; 1672b3ad188SAdrian Chadd} DEFAULT null_pic_ipi_send; 16861c8fde5SSvatopluk Kraus 16961c8fde5SSvatopluk KrausMETHOD int ipi_setup { 17061c8fde5SSvatopluk Kraus device_t dev; 17161c8fde5SSvatopluk Kraus u_int ipi; 172bff6be3eSSvatopluk Kraus struct intr_irqsrc **isrcp; 17361c8fde5SSvatopluk Kraus} DEFAULT dflt_pic_ipi_setup; 174