1*c5684dabSmsaitoh /* $NetBSD: i82093reg.h,v 1.7 2022/10/06 06:51:36 msaitoh Exp $ */ 28375b2d9Sfvdl 38375b2d9Sfvdl /*- 48375b2d9Sfvdl * Copyright (c) 2000 The NetBSD Foundation, Inc. 58375b2d9Sfvdl * All rights reserved. 68375b2d9Sfvdl * 78375b2d9Sfvdl * This code is derived from software contributed to The NetBSD Foundation 88375b2d9Sfvdl * by RedBack Networks Inc. 98375b2d9Sfvdl * 108375b2d9Sfvdl * Author: Bill Sommerfeld 118375b2d9Sfvdl * 128375b2d9Sfvdl * Redistribution and use in source and binary forms, with or without 138375b2d9Sfvdl * modification, are permitted provided that the following conditions 148375b2d9Sfvdl * are met: 158375b2d9Sfvdl * 1. Redistributions of source code must retain the above copyright 168375b2d9Sfvdl * notice, this list of conditions and the following disclaimer. 178375b2d9Sfvdl * 2. Redistributions in binary form must reproduce the above copyright 188375b2d9Sfvdl * notice, this list of conditions and the following disclaimer in the 198375b2d9Sfvdl * documentation and/or other materials provided with the distribution. 208375b2d9Sfvdl * 218375b2d9Sfvdl * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 228375b2d9Sfvdl * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 238375b2d9Sfvdl * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 248375b2d9Sfvdl * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 258375b2d9Sfvdl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 268375b2d9Sfvdl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 278375b2d9Sfvdl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 288375b2d9Sfvdl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 298375b2d9Sfvdl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 308375b2d9Sfvdl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 318375b2d9Sfvdl * POSSIBILITY OF SUCH DAMAGE. 328375b2d9Sfvdl */ 338375b2d9Sfvdl 348375b2d9Sfvdl /* 358375b2d9Sfvdl * Typically, the first apic lives here. 368375b2d9Sfvdl */ 378375b2d9Sfvdl #define IOAPIC_BASE_DEFAULT 0xfec00000 388375b2d9Sfvdl 398375b2d9Sfvdl /* 408375b2d9Sfvdl * Memory-space registers. 418375b2d9Sfvdl */ 428375b2d9Sfvdl 438375b2d9Sfvdl /* 448375b2d9Sfvdl * The externally visible registers are all 32 bits wide; 458375b2d9Sfvdl * store the register number of interest in IOAPIC_REG, and store/fetch 468375b2d9Sfvdl * the real value in IOAPIC_DATA. 478375b2d9Sfvdl */ 488375b2d9Sfvdl 498375b2d9Sfvdl 508375b2d9Sfvdl 518375b2d9Sfvdl #define IOAPIC_REG 0x0000 528375b2d9Sfvdl #define IOAPIC_DATA 0x0010 53080345b8Snonaka #define IOAPIC_EOI 0x0040 54080345b8Snonaka #define IOAPIC_EOI_MASK 0x000000ff 558375b2d9Sfvdl 568375b2d9Sfvdl /* 578375b2d9Sfvdl * Internal I/O APIC registers. 588375b2d9Sfvdl */ 598375b2d9Sfvdl 608375b2d9Sfvdl #define IOAPIC_ID 0x00 618375b2d9Sfvdl 628375b2d9Sfvdl #define IOAPIC_ID_SHIFT 24 63*c5684dabSmsaitoh #define IOAPIC_ID_MASK 0xff000000 648375b2d9Sfvdl 658375b2d9Sfvdl /* Version, and maximum interrupt pin number. */ 668375b2d9Sfvdl 678375b2d9Sfvdl #define IOAPIC_VER 0x01 688375b2d9Sfvdl 698375b2d9Sfvdl #define IOAPIC_VER_SHIFT 0 708375b2d9Sfvdl #define IOAPIC_VER_MASK 0x000000ff 718375b2d9Sfvdl 728375b2d9Sfvdl #define IOAPIC_MAX_SHIFT 16 738375b2d9Sfvdl #define IOAPIC_MAX_MASK 0x00ff0000 748375b2d9Sfvdl 758375b2d9Sfvdl /* 768375b2d9Sfvdl * Arbitration ID. Same format as IOAPIC_ID register. 778375b2d9Sfvdl */ 788375b2d9Sfvdl #define IOAPIC_ARB 0x02 798375b2d9Sfvdl 808375b2d9Sfvdl /* 818375b2d9Sfvdl * Redirection table registers. 828375b2d9Sfvdl */ 838375b2d9Sfvdl 8485c29668Smsaitoh #define IOAPIC_REDTBL 0x10 8585c29668Smsaitoh #define IOAPIC_REDHI(pin) (IOAPIC_REDTBL + ((pin) << 1) + 1) 8685c29668Smsaitoh #define IOAPIC_REDLO(pin) (IOAPIC_REDTBL + ((pin) << 1)) 878375b2d9Sfvdl 888375b2d9Sfvdl #define IOAPIC_REDHI_DEST_SHIFT 24 /* destination. */ 898375b2d9Sfvdl #define IOAPIC_REDHI_DEST_MASK 0xff000000 908375b2d9Sfvdl 918375b2d9Sfvdl #define IOAPIC_REDLO_MASK 0x00010000 /* 0=enabled; 1=masked */ 928375b2d9Sfvdl 938375b2d9Sfvdl #define IOAPIC_REDLO_LEVEL 0x00008000 /* 0=edge, 1=level */ 948375b2d9Sfvdl #define IOAPIC_REDLO_RIRR 0x00004000 /* remote IRR; read only */ 958375b2d9Sfvdl #define IOAPIC_REDLO_ACTLO 0x00002000 /* 0=act. hi; 1=act. lo */ 968375b2d9Sfvdl #define IOAPIC_REDLO_DELSTS 0x00001000 /* 0=idle; 1=send pending */ 978375b2d9Sfvdl #define IOAPIC_REDLO_DSTMOD 0x00000800 /* 0=physical; 1=logical */ 988375b2d9Sfvdl 998375b2d9Sfvdl #define IOAPIC_REDLO_DEL_MASK 0x00000700 /* del. mode mask */ 1008375b2d9Sfvdl #define IOAPIC_REDLO_DEL_SHIFT 8 1018375b2d9Sfvdl 1028375b2d9Sfvdl #define IOAPIC_REDLO_DEL_FIXED 0 1038375b2d9Sfvdl #define IOAPIC_REDLO_DEL_LOPRI 1 1048375b2d9Sfvdl #define IOAPIC_REDLO_DEL_SMI 2 1058375b2d9Sfvdl #define IOAPIC_REDLO_DEL_NMI 4 1068375b2d9Sfvdl #define IOAPIC_REDLO_DEL_INIT 5 1078375b2d9Sfvdl #define IOAPIC_REDLO_DEL_EXTINT 7 1088375b2d9Sfvdl 1098375b2d9Sfvdl #define IOAPIC_REDLO_VECTOR_MASK 0x000000ff /* delivery vector */ 1108375b2d9Sfvdl 1118375b2d9Sfvdl #define IMCR_ADDR 0x22 1128375b2d9Sfvdl #define IMCR_DATA 0x23 1138375b2d9Sfvdl 1148375b2d9Sfvdl #define IMCR_REGISTER 0x70 1158375b2d9Sfvdl #define IMCR_PIC 0x00 1168375b2d9Sfvdl #define IMCR_APIC 0x01 117