1 /* $NetBSD: openpicreg.h,v 1.3 2001/08/30 02:08:43 briggs Exp $ */ 2 3 /* 4 * Copyright 2001 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Allen Briggs for Wasabi Systems, Inc. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed for the NetBSD Project by 20 * Wasabi Systems, Inc. 21 * 4. The name of Wasabi Systems, Inc. may not be used to endorse 22 * or promote products derived from this software without specific prior 23 * written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38 /* 39 * INTERRUPT SOURCE register 40 * This is kind of odd on the MPC8240. The interrupts are kind of 41 * spread around. 42 * * The 5 external interrupts are at 0x10200 + irq * 0x20 43 * * The next 3 interrupts are at 0x11000 + (irq - 4) * 0x20 44 * * The next interrupt is at 0x110C0 + (irq - 4) * 0x20 45 * * The last interrupts are at 0x01120 + (irq - 9) * 0x20 46 */ 47 48 #include "opt_openpic.h" 49 50 #if defined(OPENPIC_SERIAL_MODE) 51 #define SANDPOINT_INTR_SIOINT 0 52 #define SANDPOINT_INTR_ISA SANDPOINT_INTR_SIOINT 53 #define SANDPOINT_INTR_SIOINT2 1 /* unknown... */ 54 #define SANDPOINT_INTR_PCI0 2 55 #define SANDPOINT_INTR_PCI1 3 56 #define SANDPOINT_INTR_PCI2 4 57 #define SANDPOINT_INTR_PCI3 5 58 #define SANDPOINT_INTR_WINBOND_A 6 59 #define SANDPOINT_INTR_WINBOND_B 7 60 #define SANDPOINT_INTR_WINBOND_C 8 61 #define SANDPOINT_INTR_IDE0 SANDPOINT_INTR_WINBOND_C 62 #define SANDPOINT_INTR_WINBOND_D 9 63 #define SANDPOINT_INTR_IDE1 SANDPOINT_INTR_WINBOND_D 64 #define SANDPOINT_INTR_RESERVED_10 10 65 #define SANDPOINT_INTR_RESERVED_11 11 66 #define SANDPOINT_INTR_RESERVED_12 12 67 #define SANDPOINT_INTR_RESERVED_13 13 68 #define SANDPOINT_INTR_RESERVED_14 14 69 #define SANDPOINT_INTR_RESERVED_15 15 70 #define SANDPOINT_INTR_SERCON 16 /* Not often used */ 71 #define SANDPOINT_INTR_I2C 17 72 #define SANDPOINT_INTR_DMA0 18 73 #define SANDPOINT_INTR_DMA1 19 74 #define SANDPOINT_INTR_I2O 20 75 #define SANDPOINT_INTR_TIMER0 21 76 #define SANDPOINT_INTR_TIMER1 22 77 #define SANDPOINT_INTR_TIMER2 23 78 #define SANDPOINT_INTR_TIMER3 24 79 80 #define OPENPIC_MAX_EXTERNAL_INT 15 81 82 #else 83 84 #define SANDPOINT_INTR_PCI0 0 85 #define SANDPOINT_INTR_IDE0 SANDPOINT_INTR_PCI0 86 #define SANDPOINT_INTR_PCI1 1 87 #define SANDPOINT_INTR_IDE1 SANDPOINT_INTR_PCI1 88 #define SANDPOINT_INTR_ISA SANDPOINT_INTR_PCI1 89 #define SANDPOINT_INTR_PCI2 2 90 #define SANDPOINT_INTR_PCI3 3 91 #define SANDPOINT_INTR_SERCON 4 /* Not often used */ 92 #define SANDPOINT_INTR_I2C 5 93 #define SANDPOINT_INTR_DMA0 6 94 #define SANDPOINT_INTR_DMA1 7 95 #define SANDPOINT_INTR_I2O 8 96 #define SANDPOINT_INTR_TIMER0 9 97 #define SANDPOINT_INTR_TIMER1 10 98 #define SANDPOINT_INTR_TIMER2 11 99 #define SANDPOINT_INTR_TIMER3 12 100 101 #define OPENPIC_MAX_EXTERNAL_INT 4 102 #endif 103 104 /* interrupt vector/priority reg */ 105 #define OPENPIC_SRC_VECTOR(irq) \ 106 ((irq <= OPENPIC_MAX_EXTERNAL_INT) ? (0x10200 + (irq) * 0x20) \ 107 : ((irq <= OPENPIC_MAX_EXTERNAL_INT + 3) ? \ 108 (0x11000 + ((irq) - OPENPIC_MAX_EXTERNAL_INT) * 0x20) \ 109 : ((irq == OPENPIC_MAX_EXTERNAL_INT + 4) ? 0x110C0 \ 110 : (0x01120 + \ 111 ((irq) - (OPENPIC_MAX_EXTERNAL_INT + 5)) * 0x40)))) 112 113 #define OPENPIC_INIT_SRC(irq) \ 114 (((OPENPIC_IMASK | (8 << OPENPIC_PRIORITY_SHIFT)) | \ 115 (((irq) <= OPENPIC_MAX_EXTERNAL_INT) ? \ 116 (OPENPIC_POLARITY_NEGATIVE | OPENPIC_SENSE_LEVEL) : 0)) \ 117 | (irq)) 118 119 #define OPENPIC_IDEST(irq) OPENPIC_SRC_VECTOR(irq) + 0x10 120 121 void openpic_init __P((unsigned char *)); 122 123 #include <powerpc/openpicreg.h> 124