hrowpicvar.h revision 116965
133965Sjdp/* 278828Sobrien * Copyright 2003 by Peter Grehan. All rights reserved. 3218822Sdim * 438889Sjdp * Redistribution and use in source and binary forms, with or without 533965Sjdp * modification, are permitted provided that the following conditions 633965Sjdp * are met: 733965Sjdp * 1. Redistributions of source code must retain the above copyright 833965Sjdp * notice, this list of conditions and the following disclaimer. 933965Sjdp * 2. Redistributions in binary form must reproduce the above copyright 1033965Sjdp * notice, this list of conditions and the following disclaimer in the 1133965Sjdp * documentation and/or other materials provided with the distribution. 1233965Sjdp * 3. The name of the author may not be used to endorse or promote products 1333965Sjdp * derived from this software without specific prior written permission. 1433965Sjdp * 1533965Sjdp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1633965Sjdp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1733965Sjdp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1833965Sjdp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1933965Sjdp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20218822Sdim * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21218822Sdim * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2233965Sjdp * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23218822Sdim * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2433965Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2533965Sjdp * SUCH DAMAGE. 2633965Sjdp * 2733965Sjdp * $FreeBSD: head/sys/powerpc/powermac/hrowpicvar.h 116965 2003-06-28 08:52:49Z grehan $ 28218822Sdim */ 2933965Sjdp 3061843Sobrien#ifndef _POWERPC_POWERMAC_HROWPICVAR_H_ 31130561Sobrien#define _POWERPC_POWERMAC_HROWPICVAR_H_ 32130561Sobrien 3333965Sjdp#define HROWPIC_IRQMAX 64 34218822Sdim#define HROWPIC_IRQ_REGNUM 32 /* irqs per register */ 3533965Sjdp#define HROWPIC_IRQ_SHIFT 5 /* high or low irq word */ 3638889Sjdp#define HROWPIC_IRQ_MASK ((HROWPIC_IRQMAX-1) >> 1) /* irq bit pos in word */ 3738889Sjdp 3838889Sjdp/* 39104834Sobrien * Register offsets within bank. There are two identical banks, 4038889Sjdp * separated by 16 bytes. Interrupts 0->31 are processed in the 4138889Sjdp * second bank, and 32->63 in the first bank. 4238889Sjdp */ 4338889Sjdp#define HPIC_STATUS 0x00 /* active interrupt sources */ 4438889Sjdp#define HPIC_ENABLE 0x04 /* interrupt asserts ppc EXTINT */ 4538889Sjdp#define HPIC_CLEAR 0x08 /* clear int source */ 4638889Sjdp#define HPIC_TRIGGER 0x0c /* edge/level int trigger */ 4760484Sobrien 4860484Sobrien#define HPIC_PRIMARY 1 /* primary register bank */ 4960484Sobrien#define HPIC_SECONDARY 0 /* secondary register bank */ 5060484Sobrien 5160484Sobrien/* 5260484Sobrien * Convert an interrupt into a prim/sec bank number 5360484Sobrien */ 5460484Sobrien#define HPIC_INT_TO_BANK(x) \ 5589857Sobrien (((x) >> HROWPIC_IRQ_SHIFT) ^ 1) 5689857Sobrien 5789857Sobrien/* 5889857Sobrien * Convert an interrupt into the bit number within a bank register 5989857Sobrien */ 6089857Sobrien#define HPIC_INT_TO_REGBIT(x) \ 6189857Sobrien ((x) & HROWPIC_IRQ_MASK) 6289857Sobrien 6389857Sobrien#define HPIC_1ST_OFFSET 0x10 /* offset to primary reg bank */ 6489857Sobrien 65130561Sobrien 6689857Sobrienstruct hrowpic_softc { 6760484Sobrien struct rman sc_rman; /* resource mgr for IRQs */ 6833965Sjdp u_int32_t sc_irq[HROWPIC_IRQMAX]; /* allocated IRQ flags */ 69130561Sobrien u_int32_t sc_softreg[2]; /* ENABLE reg copy */ 70130561Sobrien device_t sc_maciodev; /* macio device */ 7133965Sjdp struct resource *sc_memr; /* macio bus resource */ 7233965Sjdp bus_space_tag_t sc_bt; /* macio bus tag/handle */ 7333965Sjdp bus_space_handle_t sc_bh; 7433965Sjdp}; 7533965Sjdp 76130561Sobrien 77130561Sobrien#endif /* _POWERPC_POWERMAC_HROWPICVAR_H_ */ 7833965Sjdp