/*-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#include <sys/kobj.h>3132#define OPENPIC_DEVSTR "OpenPIC Interrupt Controller"3334#define OPENPIC_IRQMAX 256 /* h/w allows more */3536#define OPENPIC_QUIRK_SINGLE_BIND 1 /* Bind interrupts to only 1 CPU */37#define OPENPIC_QUIRK_HIDDEN_IRQS 2 /* May have IRQs beyond FRR[NIRQ] */3839/* Names match the macros in openpicreg.h. */40struct openpic_timer {41uint32_t tcnt;42uint32_t tbase;43uint32_t tvec;44uint32_t tdst;45};4647struct openpic_softc {48device_t sc_dev;49struct resource *sc_memr;50struct resource *sc_intr;51bus_space_tag_t sc_bt;52bus_space_handle_t sc_bh;53char *sc_version;54int sc_rid;55int sc_irq;56void *sc_icookie;57u_int sc_ncpu;58u_int sc_nirq;59int sc_psim;60u_int sc_quirks;6162/* Saved states. */63uint32_t sc_saved_config;64uint32_t sc_saved_ipis[4];65uint32_t sc_saved_prios[4];66struct openpic_timer sc_saved_timers[OPENPIC_TIMERS];67uint32_t sc_saved_vectors[OPENPIC_SRC_VECTOR_COUNT];6869};7071/*72* Bus-independent attach i/f73*/74int openpic_common_attach(device_t, uint32_t);7576/*77* PIC interface.78*/79void openpic_config(device_t, u_int, enum intr_trigger, enum intr_polarity);80void openpic_enable(device_t, u_int, u_int, void **);81void openpic_eoi(device_t, u_int, void *);82void openpic_unmask(device_t, u_int, void *);8384DECLARE_CLASS(openpic_class);8586#endif /* _POWERPC_OPENPICVAR_H_ */878889