/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (C) 2002 Benno Rice.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR16* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES17* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.18* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,19* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,20* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;21* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,22* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR23* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF24* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.25*/2627#ifndef _POWERPC_OPENPICVAR_H_28#define _POWERPC_OPENPICVAR_H_2930#define OPENPIC_DEVSTR "OpenPIC Interrupt Controller"3132#define OPENPIC_IRQMAX 256 /* h/w allows more */3334#define OPENPIC_QUIRK_SINGLE_BIND 1 /* Bind interrupts to only 1 CPU */35#define OPENPIC_QUIRK_HIDDEN_IRQS 2 /* May have IRQs beyond FRR[NIRQ] */3637/* Names match the macros in openpicreg.h. */38struct openpic_timer {39uint32_t tcnt;40uint32_t tbase;41uint32_t tvec;42uint32_t tdst;43};4445struct openpic_softc {46device_t sc_dev;47struct resource *sc_memr;48struct resource *sc_intr;49bus_space_tag_t sc_bt;50bus_space_handle_t sc_bh;51char *sc_version;52int sc_rid;53int sc_irq;54void *sc_icookie;55u_int sc_ncpu;56u_int sc_nirq;57int sc_psim;58u_int sc_quirks;5960/* Saved states. */61uint32_t sc_saved_config;62uint32_t sc_saved_ipis[4];63uint32_t sc_saved_prios[4];64struct openpic_timer sc_saved_timers[OPENPIC_TIMERS];65uint32_t sc_saved_vectors[OPENPIC_SRC_VECTOR_COUNT];6667};6869/*70* Bus-independent attach i/f71*/72int openpic_common_attach(device_t, uint32_t);7374/*75* PIC interface.76*/77void openpic_bind(device_t dev, u_int irq, cpuset_t cpumask, void **);78void openpic_config(device_t, u_int, enum intr_trigger, enum intr_polarity);79void openpic_dispatch(device_t, struct trapframe *);80void openpic_enable(device_t, u_int, u_int, void **);81void openpic_eoi(device_t, u_int, void *);82void openpic_ipi(device_t, u_int);83void openpic_mask(device_t, u_int, void *);84void openpic_unmask(device_t, u_int, void *);8586int openpic_suspend(device_t dev);87int openpic_resume(device_t dev);8889#endif /* _POWERPC_OPENPICVAR_H_ */909192