/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 2000 Tsubai Masanari. 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, BUT21* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,22* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY23* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE25* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.26*27* from NetBSD: openpicreg.h,v 1.3 2001/08/30 03:08:52 briggs Exp28*/2930/*31* Size of OpenPIC register space32*/33#define OPENPIC_SIZE 0x400003435/*36* Per Processor Registers [private access] (0x00000 - 0x00fff)37*/3839/* IPI dispatch command reg */40#define OPENPIC_IPI_DISPATCH(ipi) (0x40 + (ipi) * 0x10)4142/* current task priority reg */43#define OPENPIC_TPR 0x8044#define OPENPIC_TPR_MASK 0x0000000f4546#define OPENPIC_WHOAMI 0x904748/* interrupt acknowledge reg */49#define OPENPIC_IACK 0xa05051/* end of interrupt reg */52#define OPENPIC_EOI 0xb05354/*55* Global registers (0x01000-0x0ffff)56*/5758/* feature reporting reg 0 */59#define OPENPIC_FEATURE 0x100060#define OPENPIC_FEATURE_VERSION_MASK 0x000000ff61#define OPENPIC_FEATURE_LAST_CPU_MASK 0x00001f0062#define OPENPIC_FEATURE_LAST_CPU_SHIFT 863#define OPENPIC_FEATURE_LAST_IRQ_MASK 0x07ff000064#define OPENPIC_FEATURE_LAST_IRQ_SHIFT 166566/* global config reg 0 */67#define OPENPIC_CONFIG 0x102068#define OPENPIC_CONFIG_RESET 0x8000000069#define OPENPIC_CONFIG_8259_PASSTHRU_DISABLE 0x200000007071/* interrupt configuration mode (direct or serial) */72#define OPENPIC_ICR 0x103073#define OPENPIC_ICR_SERIAL_MODE (1 << 27)74#define OPENPIC_ICR_SERIAL_RATIO_MASK (0x7 << 28)75#define OPENPIC_ICR_SERIAL_RATIO_SHIFT 287677/* vendor ID */78#define OPENPIC_VENDOR_ID 0x10807980/* processor initialization reg */81#define OPENPIC_PROC_INIT 0x10908283/* IPI vector/priority reg */84#define OPENPIC_IPI_VECTOR(ipi) (0x10a0 + (ipi) * 0x10)8586/* spurious intr. vector */87#define OPENPIC_SPURIOUS_VECTOR 0x10e08889/* Timer registers */90#define OPENPIC_TIMERS 491#define OPENPIC_TFREQ 0x10f092#define OPENPIC_TCNT(t) (0x1100 + (t) * 0x40)93#define OPENPIC_TBASE(t) (0x1110 + (t) * 0x40)94#define OPENPIC_TVEC(t) (0x1120 + (t) * 0x40)95#define OPENPIC_TDST(t) (0x1130 + (t) * 0x40)9697/*98* Interrupt Source Configuration Registers (0x10000 - 0x1ffff)99*/100101/* interrupt vector/priority reg */102#define OPENPIC_SRC_VECTOR_COUNT 64103#ifndef OPENPIC_SRC_VECTOR104#define OPENPIC_SRC_VECTOR(irq) (0x10000 + (irq) * 0x20)105#endif106#define OPENPIC_SENSE_LEVEL 0x00400000107#define OPENPIC_SENSE_EDGE 0x00000000108#define OPENPIC_POLARITY_POSITIVE 0x00800000109#define OPENPIC_POLARITY_NEGATIVE 0x00000000110#define OPENPIC_IMASK 0x80000000111#define OPENPIC_ACTIVITY 0x40000000112#define OPENPIC_PRIORITY_MASK 0x000f0000113#define OPENPIC_PRIORITY_SHIFT 16114#define OPENPIC_VECTOR_MASK 0x000000ff115116/* interrupt destination cpu */117#ifndef OPENPIC_IDEST118#define OPENPIC_IDEST(irq) (0x10010 + (irq) * 0x20)119#endif120121/*122* Per Processor Registers [global access] (0x20000 - 0x3ffff)123*/124125#define OPENPIC_PCPU_BASE(cpu) (0x20000 + (cpu) * 0x1000)126127#define OPENPIC_PCPU_IPI_DISPATCH(cpu, ipi) \128(OPENPIC_PCPU_BASE(cpu) + OPENPIC_IPI_DISPATCH(ipi))129130#define OPENPIC_PCPU_TPR(cpu) \131(OPENPIC_PCPU_BASE(cpu) + OPENPIC_TPR)132133#define OPENPIC_PCPU_WHOAMI(cpu) \134(OPENPIC_PCPU_BASE(cpu) + OPENPIC_WHOAMI)135136#define OPENPIC_PCPU_IACK(cpu) \137(OPENPIC_PCPU_BASE(cpu) + OPENPIC_IACK)138139#define OPENPIC_PCPU_EOI(cpu) \140(OPENPIC_PCPU_BASE(cpu) + OPENPIC_EOI)141142143