/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright 2003 by Peter Grehan. All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13* 3. The name of the author may not be used to endorse or promote products14* derived from this software without specific prior written permission.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR17* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES18* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.19* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,20* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,21* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED23* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,24* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef _POWERPC_POWERMAC_HROWPICVAR_H_30#define _POWERPC_POWERMAC_HROWPICVAR_H_3132#define HROWPIC_IRQMAX 6433#define HROWPIC_IRQ_REGNUM 32 /* irqs per register */34#define HROWPIC_IRQ_SHIFT 5 /* high or low irq word */35#define HROWPIC_IRQ_MASK ((HROWPIC_IRQMAX-1) >> 1) /* irq bit pos in word */3637/*38* Register offsets within bank. There are two identical banks,39* separated by 16 bytes. Interrupts 0->31 are processed in the40* second bank, and 32->63 in the first bank.41*/42#define HPIC_STATUS 0x00 /* active interrupt sources */43#define HPIC_ENABLE 0x04 /* interrupt asserts ppc EXTINT */44#define HPIC_CLEAR 0x08 /* clear int source */45#define HPIC_TRIGGER 0x0c /* edge/level int trigger */4647#define HPIC_PRIMARY 1 /* primary register bank */48#define HPIC_SECONDARY 0 /* secondary register bank */4950/*51* Convert an interrupt into a prim/sec bank number52*/53#define HPIC_INT_TO_BANK(x) \54(((x) >> HROWPIC_IRQ_SHIFT) ^ 1)5556/*57* Convert an interrupt into the bit number within a bank register58*/59#define HPIC_INT_TO_REGBIT(x) \60((x) & HROWPIC_IRQ_MASK)6162#define HPIC_1ST_OFFSET 0x10 /* offset to primary reg bank */6364struct hrowpic_softc {65device_t sc_dev; /* macio device */66struct resource *sc_rres; /* macio bus resource */67bus_space_tag_t sc_bt; /* macio bus tag/handle */68bus_space_handle_t sc_bh;69int sc_rrid;70uint32_t sc_softreg[2]; /* ENABLE reg copy */71u_int sc_vector[HROWPIC_IRQMAX];72};7374#endif /* _POWERPC_POWERMAC_HROWPICVAR_H_ */757677