1*0af614b4Smpi /* $OpenBSD: ebusreg.h,v 1.6 2019/12/05 12:46:54 mpi Exp $ */ 2284584b0Sjason /* $NetBSD: ebusreg.h,v 1.1 1999/06/04 13:29:13 mrg Exp $ */ 3284584b0Sjason 4284584b0Sjason /* 5284584b0Sjason * Copyright (c) 1999 Matthew R. Green 6284584b0Sjason * All rights reserved. 7284584b0Sjason * 8284584b0Sjason * Redistribution and use in source and binary forms, with or without 9284584b0Sjason * modification, are permitted provided that the following conditions 10284584b0Sjason * are met: 11284584b0Sjason * 1. Redistributions of source code must retain the above copyright 12284584b0Sjason * notice, this list of conditions and the following disclaimer. 13284584b0Sjason * 2. Redistributions in binary form must reproduce the above copyright 14284584b0Sjason * notice, this list of conditions and the following disclaimer in the 15284584b0Sjason * documentation and/or other materials provided with the distribution. 16284584b0Sjason * 17284584b0Sjason * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18284584b0Sjason * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19284584b0Sjason * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20284584b0Sjason * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21284584b0Sjason * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22284584b0Sjason * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23284584b0Sjason * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24284584b0Sjason * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25284584b0Sjason * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26284584b0Sjason * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27284584b0Sjason * SUCH DAMAGE. 28284584b0Sjason */ 29284584b0Sjason 30284584b0Sjason #ifndef _SPARC64_DEV_EBUSREG_H_ 31284584b0Sjason #define _SPARC64_DEV_EBUSREG_H_ 32284584b0Sjason 33284584b0Sjason /* 34284584b0Sjason * UltraSPARC `ebus' 35284584b0Sjason * 36284584b0Sjason * The `ebus' bus is designed to plug traditional PC-ISA devices into 37284584b0Sjason * an SPARC system with as few costs as possible, without sacrificing 38284584b0Sjason * to performance. Typically, it is implemented in the PCIO IC from 39284584b0Sjason * SME, which also implements a `hme-compatible' PCI network device 40284584b0Sjason * (`network'). The ebus has 4 DMA channels, similar to the DMA seen 41284584b0Sjason * in the ESP SCSI DMA. 42284584b0Sjason * 43284584b0Sjason * Typical UltraSPARC systems have a NatSemi SuperIO IC to provide 44284584b0Sjason * serial ports for the keyboard and mouse (`se'), floppy disk 45284584b0Sjason * controller (`fdthree'), parallel port controller (`bpp') connected 46284584b0Sjason * to the ebus, and a PCI-IDE controller (connected directly to the 47284584b0Sjason * PCI bus, of course), as well as a Siemens Nixdorf SAB82532 dual 48284584b0Sjason * channel serial controller (`su' providing ttya and ttyb), an MK48T59 49284584b0Sjason * EEPROM/clock controller (also where the idprom, including the 50284584b0Sjason * ethernet address, is located), the audio system (`SUNW,CS4231', same 51284584b0Sjason * as other UltraSPARC and some SPARC systems), and other various 52284584b0Sjason * internal devices found on traditional SPARC systems such as the 53284584b0Sjason * `power', `flashprom', etc., devices. 54284584b0Sjason * 55284584b0Sjason * The ebus uses an interrupt mapping scheme similar to PCI, though 56284584b0Sjason * the actual structures are different. 57284584b0Sjason */ 58284584b0Sjason 59284584b0Sjason /* 60284584b0Sjason * ebus PROM structures 61284584b0Sjason */ 62284584b0Sjason 63284584b0Sjason struct ebus_regs { 64284584b0Sjason u_int32_t hi; /* high bits of physaddr */ 65284584b0Sjason u_int32_t lo; 66284584b0Sjason u_int32_t size; 67284584b0Sjason }; 68284584b0Sjason 69284584b0Sjason #define EBUS_PADDR_FROM_REG(reg) ((((paddr_t)((reg)->hi)) << 32UL) | ((paddr_t)(reg)->lo)) 70284584b0Sjason 71284584b0Sjason struct ebus_ranges { 72284584b0Sjason u_int32_t child_hi; /* child high phys addr */ 73284584b0Sjason u_int32_t child_lo; /* child low phys addr */ 74284584b0Sjason u_int32_t phys_hi; /* parent high phys addr */ 75284584b0Sjason u_int32_t phys_mid; /* parent mid phys addr */ 76284584b0Sjason u_int32_t phys_lo; /* parent low phys addr */ 77284584b0Sjason u_int32_t size; 78284584b0Sjason }; 79284584b0Sjason 8020945e8eSkettenis struct ebus_mainbus_ranges { 8120945e8eSkettenis u_int32_t child_hi; 8220945e8eSkettenis u_int32_t child_lo; 8320945e8eSkettenis u_int32_t phys_hi; 8420945e8eSkettenis u_int32_t phys_lo; 8520945e8eSkettenis u_int32_t size; 8620945e8eSkettenis }; 8720945e8eSkettenis 88284584b0Sjason struct ebus_interrupt_map { 89284584b0Sjason u_int32_t hi; /* high phys addr mask */ 90284584b0Sjason u_int32_t lo; /* low phys addr mask */ 91284584b0Sjason u_int32_t intr; /* interrupt mask */ 92284584b0Sjason int32_t cnode; /* child node */ 93284584b0Sjason u_int32_t cintr; /* child interrupt */ 94284584b0Sjason }; 95284584b0Sjason 96284584b0Sjason struct ebus_interrupt_map_mask { 97284584b0Sjason u_int32_t hi; /* high phys addr */ 98284584b0Sjason u_int32_t lo; /* low phys addr */ 99284584b0Sjason u_int32_t intr; /* interrupt */ 100284584b0Sjason }; 101284584b0Sjason 102643e445dSjason /* EBUS dma registers */ 103643e445dSjason #define EBDMA_DCSR 0x0 /* control/status */ 104643e445dSjason #define EBDMA_DADDR 0x4 /* DMA address */ 105643e445dSjason #define EBDMA_DCNT 0x8 /* DMA count */ 106643e445dSjason 107643e445dSjason /* EBUS DMA control/status (EBDMA_DCSR) */ 108643e445dSjason #define EBDCSR_INT 0x00000001 /* interrupt pending */ 109643e445dSjason #define EBDCSR_ERR 0x00000002 /* error pending */ 110643e445dSjason #define EBDCSR_DRAIN 0x00000004 /* drain */ 111643e445dSjason #define EBDCSR_INTEN 0x00000010 /* interrupt enable */ 112643e445dSjason #define EBDCSR_RESET 0x00000080 /* reset */ 113643e445dSjason #define EBDCSR_WRITE 0x00000100 /* write */ 114643e445dSjason #define EBDCSR_DMAEN 0x00000200 /* dma enable */ 115643e445dSjason #define EBDCSR_CYC 0x00000400 /* cyc pending */ 116643e445dSjason #define EBDCSR_DIAGRD 0x00000800 /* diagnostic read done */ 117643e445dSjason #define EBDCSR_DIAGWR 0x00001000 /* diagnostic write done */ 118643e445dSjason #define EBDCSR_CNTEN 0x00002000 /* count enable */ 119c73cb032Sjason #define EBDCSR_TC 0x00004000 /* terminal count */ 120643e445dSjason #define EBDCSR_CSRDRNDIS 0x00010000 /* disable csr drain */ 121643e445dSjason #define EBDCSR_BURSTMASK 0x000c0000 /* burst size mask */ 122643e445dSjason #define EBDCSR_BURST_1 0x00080000 /* burst 1 */ 123643e445dSjason #define EBDCSR_BURST_4 0x00000000 /* burst 4 */ 124643e445dSjason #define EBDCSR_BURST_8 0x00040000 /* burst 8 */ 125643e445dSjason #define EBDCSR_BURST_16 0x000c0000 /* burst 16 */ 126643e445dSjason #define EBDCSR_DIAGEN 0x00100000 /* enable diagnostics */ 127643e445dSjason #define EBDCSR_ERRDIS 0x00400000 /* disable error pending */ 128643e445dSjason #define EBDCSR_TCIDIS 0x00800000 /* disable TCI */ 129643e445dSjason #define EBDCSR_NEXTEN 0x01000000 /* enable next */ 130643e445dSjason #define EBDCSR_DMAON 0x02000000 /* dma on */ 131643e445dSjason #define EBDCSR_A_LOADED 0x04000000 /* address loaded */ 132643e445dSjason #define EBDCSR_NA_LOADED 0x08000000 /* next address loaded */ 133643e445dSjason #define EBDCSR_DEVMASK 0xf0000000 /* device id mask */ 134643e445dSjason 135284584b0Sjason #endif /* _SPARC64_DEV_EBUSREG_H_ */ 136