11.1Sthorpej/* $NetBSD: ofw_isa.h,v 1.1 2025/10/18 15:40:59 thorpej Exp $ */ 21.1Sthorpej 31.1Sthorpej/*- 41.1Sthorpej * Copyright (c) 2025 The NetBSD Foundation, Inc. 51.1Sthorpej * All rights reserved. 61.1Sthorpej * 71.1Sthorpej * This code is derived from software contributed to The NetBSD Foundation 81.1Sthorpej * by Jason R. Thorpe. 91.1Sthorpej * 101.1Sthorpej * Redistribution and use in source and binary forms, with or without 111.1Sthorpej * modification, are permitted provided that the following conditions 121.1Sthorpej * are met: 131.1Sthorpej * 1. Redistributions of source code must retain the above copyright 141.1Sthorpej * notice, this list of conditions and the following disclaimer. 151.1Sthorpej * 2. Redistributions in binary form must reproduce the above copyright 161.1Sthorpej * notice, this list of conditions and the following disclaimer in the 171.1Sthorpej * documentation and/or other materials provided with the distribution. 181.1Sthorpej * 191.1Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 201.1Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 211.1Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 221.1Sthorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 231.1Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 241.1Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 251.1Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 261.1Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 271.1Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 281.1Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 291.1Sthorpej * POSSIBILITY OF SUCH DAMAGE. 301.1Sthorpej */ 311.1Sthorpej 321.1Sthorpej#ifndef _DEV_OFW_OFW_ISA_H_ 331.1Sthorpej#define _DEV_OFW_OFW_ISA_H_ 341.1Sthorpej 351.1Sthorpej/* 361.1Sthorpej * ISA Bus Binding to: 371.1Sthorpej * 381.1Sthorpej * IEEE Std 1275-1994 391.1Sthorpej * Standard for Boot (Initialization Configuration) Firmware 401.1Sthorpej * 411.1Sthorpej * Revision: 0.4 (Unapproved Draft) 421.1Sthorpej * September 23, 1996 431.1Sthorpej */ 441.1Sthorpej 451.1Sthorpej/* 461.1Sthorpej * Section 2.2.1. Physical Address Formats 471.1Sthorpej * 481.1Sthorpej * An ISA physical address is represented by 2 address cells: 491.1Sthorpej * 501.1Sthorpej * phys.hi cell: 00000000 00000000 00000000 00000vti 511.1Sthorpej * phys.lo cell: nnnnnnnn nnnnnnnn nnnnnnnn nnnnnnnn 521.1Sthorpej * 531.1Sthorpej * v address is 11-bit aliased 541.1Sthorpej * t address is 10-bit aliased 551.1Sthorpej * i address is in I/O space (vs memory space) 561.1Sthorpej * n 32-bit address 571.1Sthorpej */ 581.1Sthorpej 591.1Sthorpej#define OFW_ISA_PHYS_HI_IO __BIT(0) 601.1Sthorpej#define OFW_ISA_PHYS_HI_10BIT __BIT(1) 611.1Sthorpej#define OFW_ISA_PHYS_HI_11BIT __BIT(2) 621.1Sthorpej 631.1Sthorpej/* 641.1Sthorpej * This has the 2 32bit cell values, plus another to make up a 32-bit size. 651.1Sthorpej */ 661.1Sthorpejstruct ofw_isa_register { 671.1Sthorpej uint32_t phys_hi; 681.1Sthorpej uint32_t phys_lo; 691.1Sthorpej uint32_t size; 701.1Sthorpej}; 711.1Sthorpej 721.1Sthorpej/* 731.1Sthorpej * Section 4.1.1. Properties for child nodes. 741.1Sthorpej * 751.1Sthorpej * "interrupts" 761.1Sthorpej * 771.1Sthorpej * Interrupts are encoded with a prop-encoded-array of the following 781.1Sthorpej * integers: 791.1Sthorpej * 801.1Sthorpej * irq IRQ number (0-15) 811.1Sthorpej * type IRQ type 0 active low level trigger 821.1Sthorpej * 1 active high level trigger 831.1Sthorpej * 2 falling edge trigger 841.1Sthorpej * 3 rising edge trigger 851.1Sthorpej */ 861.1Sthorpej 871.1Sthorpej#define OFW_ISA_INTR_TYPE_LOW_LEVEL 0 881.1Sthorpej#define OFW_ISA_INTR_TYPE_HIGH_LEVEL 1 891.1Sthorpej#define OFW_ISA_INTR_TYPE_FALLING_EDGE 2 901.1Sthorpej#define OFW_ISA_INTR_TYPE_RISING_EDGE 3 911.1Sthorpej 921.1Sthorpejstruct ofw_isa_interrupt { 931.1Sthorpej uint32_t irq; 941.1Sthorpej uint32_t type; 951.1Sthorpej}; 961.1Sthorpej 971.1Sthorpej/* 981.1Sthorpej * Section 4.1.2. Bus-specific properties for child nodes. 991.1Sthorpej * 1001.1Sthorpej * "dma" 1011.1Sthorpej * 1021.1Sthorpej * DMA information is encoded in a prop-encoded-array of the following 1031.1Sthorpej * integers: 1041.1Sthorpej * 1051.1Sthorpej * dma# DRQ (0-3, 5-7) 1061.1Sthorpej * mode DMA channel mode 1071.1Sthorpej * width DMA transfer size in bits (8, 16, 32) 1081.1Sthorpej * coundwidth DMA transfer size count units (8, 16, 32) 1091.1Sthorpej * busmaster 1=bus master, 0=not-a-bus master 1101.1Sthorpej */ 1111.1Sthorpej 1121.1Sthorpej#define OFW_ISA_DMA_MODE_COMPAT 0 1131.1Sthorpej#define OFW_ISA_DMA_MODE_A 1 1141.1Sthorpej#define OFW_ISA_DMA_MODE_B 2 1151.1Sthorpej#define OFW_ISA_DMA_MODE_F 3 1161.1Sthorpej#define OFW_ISA_DMA_MODE_C 4 1171.1Sthorpej 1181.1Sthorpejstruct ofw_isa_dma { 1191.1Sthorpej uint32_t drq; 1201.1Sthorpej uint32_t mode; 1211.1Sthorpej uint32_t width; 1221.1Sthorpej uint32_t countwidth; 1231.1Sthorpej uint32_t busmaster; 1241.1Sthorpej}; 1251.1Sthorpej 1261.1Sthorpej#endif /* _DEV_OFW_OFW_ISA_H_ */ 127