1# $NetBSD: genassym.cf,v 1.36 2002/09/26 18:56:33 thorpej Exp $ 2 3# 4# Copyright (c) 1998 The NetBSD Foundation, Inc. 5# All rights reserved. 6# 7# This code is derived from software contributed to The NetBSD Foundation 8# by Christos Zoulas. 9# 10# Redistribution and use in source and binary forms, with or without 11# modification, are permitted provided that the following conditions 12# are met: 13# 1. Redistributions of source code must retain the above copyright 14# notice, this list of conditions and the following disclaimer. 15# 2. Redistributions in binary form must reproduce the above copyright 16# notice, this list of conditions and the following disclaimer in the 17# documentation and/or other materials provided with the distribution. 18# 3. All advertising materials mentioning features or use of this software 19# must display the following acknowledgement: 20# This product includes software developed by the NetBSD 21# Foundation, Inc. and its contributors. 22# 4. Neither the name of The NetBSD Foundation nor the names of its 23# contributors may be used to endorse or promote products derived 24# from this software without specific prior written permission. 25# 26# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36# POSSIBILITY OF SUCH DAMAGE. 37# 38# Copyright (c) 1992, 1993 39# The Regents of the University of California. All rights reserved. 40# 41# This software was developed by the Computer Systems Engineering group 42# at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 43# contributed to Berkeley. 44# 45# All advertising materials mentioning features or use of this software 46# must display the following acknowledgement: 47# This product includes software developed by the University of 48# California, Lawrence Berkeley Laboratory. 49# 50# Redistribution and use in source and binary forms, with or without 51# modification, are permitted provided that the following conditions 52# are met: 53# 1. Redistributions of source code must retain the above copyright 54# notice, this list of conditions and the following disclaimer. 55# 2. Redistributions in binary form must reproduce the above copyright 56# notice, this list of conditions and the following disclaimer in the 57# documentation and/or other materials provided with the distribution. 58# 3. All advertising materials mentioning features or use of this software 59# must display the following acknowledgement: 60# This product includes software developed by the University of 61# California, Berkeley and its contributors. 62# 4. Neither the name of the University nor the names of its contributors 63# may be used to endorse or promote products derived from this software 64# without specific prior written permission. 65# 66# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 67# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 68# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 69# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 70# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 71# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 72# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 73# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 74# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 75# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 76# SUCH DAMAGE. 77# 78# @(#)genassym.c 8.1 (Berkeley) 6/11/93 79# 80 81include <sys/param.h> 82include <sys/buf.h> 83include <sys/proc.h> 84include <sys/proc.h> 85include <sys/mbuf.h> 86include <sys/msgbuf.h> 87include <sys/user.h> 88include <sys/device.h> 89include <sys/disklabel.h> 90include <sys/disk.h> 91 92include <uvm/uvm.h> 93 94include <machine/cpu.h> 95include <machine/oldmon.h> 96include <machine/bsd_openprom.h> 97 98include <sparc/sparc/cpuvar.h> 99 100include <sparc/sparc/msiiepreg.h> 101 102ifdef notyet 103include <sparc/dev/zsreg.h> 104include <sparc/dev/zsvar.h> 105endif 106 107include <machine/bus.h> 108include <sparc/dev/audioamdvar.h> 109 110include <sparc/dev/fdreg.h> 111include <sparc/dev/fdvar.h> 112 113# general constants 114define BSD BSD 115define USRSTACK USRSTACK 116 117# proc fields and values 118define P_ADDR offsetof(struct proc, p_addr) 119define P_STAT offsetof(struct proc, p_stat) 120define P_WCHAN offsetof(struct proc, p_wchan) 121define P_VMSPACE offsetof(struct proc, p_vmspace) 122define P_CPU offsetof(struct proc, p_cpu) 123define SRUN SRUN 124define SONPROC SONPROC 125 126# VM structure fields 127define VM_PMAP offsetof(struct vmspace, vm_map.pmap) 128define PMAP_CTX offsetof(struct pmap, pm_ctx) 129define PMAP_CTXNUM offsetof(struct pmap, pm_ctxnum) 130 131define UVM_PAGE_IDLE_ZERO offsetof(struct uvm, page_idle_zero) 132 133# interrupt/fault metering 134define V_SWTCH offsetof(struct uvmexp, swtch) 135define V_INTR offsetof(struct uvmexp, intrs) 136define V_FAULTS offsetof(struct uvmexp, faults) 137 138# CPU info structure 139define CPUINFO_STRUCTSIZE sizeof(struct cpu_info) 140define CPUINFO_CPUNO offsetof(struct cpu_info, ci_cpuid) 141define CPUINFO_GETSYNCFLT offsetof(struct cpu_info, get_syncflt) 142define CPUINFO_GETASYNCFLT offsetof(struct cpu_info, get_asyncflt) 143define CPUINFO_PURE_VCACHE_FLS offsetof(struct cpu_info, pure_vcache_flush) 144define CPUINFO_SYNCFLTDUMP offsetof(struct cpu_info, syncfltdump) 145define CPUINFO_INTREG offsetof(struct cpu_info, intreg_4m) 146define CPUINFO_EINTSTACK offsetof(struct cpu_info, eintstack) 147define INT_STACK_SIZE INT_STACK_SIZE 148define CPUINFO_REDZONE offsetof(struct cpu_info, redzone) 149define REDSIZE REDSIZE 150define CPUINFO_IDLE_U offsetof(struct cpu_info, idle_u) 151define CPUINFO_CURPCB offsetof(struct cpu_info, curpcb) 152define CPUINFO_CURPROC offsetof(struct cpu_info, ci_curproc) 153define CPUINFO_SELF offsetof(struct cpu_info, ci_self) 154define CPUINFO_FLAGS offsetof(struct cpu_info, flags) 155 156# PTE bits and related information 157define PG_W PG_W 158define PG_VSHIFT PG_VSHIFT 159define PG_PROTSHIFT PG_PROTSHIFT 160define PG_PROTUREAD PG_PROTUREAD 161define PG_PROTUWRITE PG_PROTUWRITE 162 163define SRMMU_TETYPE SRMMU_TETYPE 164define SRMMU_TEPTE SRMMU_TEPTE 165define SRMMU_PROT_MASK SRMMU_PROT_MASK 166define PPROT_R_RW PPROT_R_RW 167define PPROT_RX_RX PPROT_RX_RX 168define PPROT_RWX_RWX PPROT_RWX_RWX 169define PPROT_WRITE PPROT_WRITE 170 171# FPU state 172define FS_REGS offsetof(struct fpstate, fs_regs) 173define FS_FSR offsetof(struct fpstate, fs_fsr) 174define FS_QSIZE offsetof(struct fpstate, fs_qsize) 175define FS_QUEUE offsetof(struct fpstate, fs_queue) 176define FSR_QNE FSR_QNE 177 178# microSPARC-IIep PCI controller registers 179define PCIC_PROC_IPR_REG offsetof(struct msiiep_pcic_reg, pcic_proc_ipr) 180define PCIC_SOFT_INTR_CLEAR_REG offsetof(struct msiiep_pcic_reg, pcic_soft_intr_clear) 181define PCIC_SOFT_INTR_SET_REG offsetof(struct msiiep_pcic_reg, pcic_soft_intr_set) 182define PCIC_SCCR_REG offsetof(struct msiiep_pcic_reg, pcic_sccr) 183 184# errno 185define EFAULT EFAULT 186define ENAMETOOLONG ENAMETOOLONG 187 188# PCB fields 189define PCB_NSAVED offsetof(struct pcb, pcb_nsaved) 190define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) 191define PCB_PSR offsetof(struct pcb, pcb_psr) 192define PCB_RW offsetof(struct pcb, pcb_rw) 193define PCB_SP offsetof(struct pcb, pcb_sp) 194define PCB_PC offsetof(struct pcb, pcb_pc) 195define PCB_UW offsetof(struct pcb, pcb_uw) 196define PCB_WIM offsetof(struct pcb, pcb_wim) 197 198# interrupt enable register PTE 199define IE_REG_PTE_PG (PG_V | PG_W | PG_S | PG_NC | PG_OBIO) 200 201ifdef notyet 202# ZSCC interrupt fields 203define ZSC_A offsetof(struct zs_softc, sc_a) 204define ZSC_B offsetof(struct zs_softc, sc_b) 205define ZL_WREG offsetof(struct zs_line, zl_wreg) 206define ZL_TBC offsetof(struct zs_line, zl_tbc) 207define ZL_TBA offsetof(struct zs_line, zl_tba) 208define ZL_RBPUT offsetof(struct zs_line, zl_rbput) 209define ZL_RBUF offsetof(struct zs_line, zl_rbuf) 210define ZSRR1_DO_bit ffs(ZSRR1_DO) - 1 211endif 212 213# audio trap handler fields 214define AU_BH offsetof(struct auio, au_bh) 215define AU_RDATA offsetof(struct auio, au_rdata) 216define AU_REND offsetof(struct auio, au_rend) 217define AU_PDATA offsetof(struct auio, au_pdata) 218define AU_PEND offsetof(struct auio, au_pend) 219define AU_EVCNT offsetof(struct auio, au_intrcnt.ev_count) 220 221define PROM_BASE PROM_BASE 222 223define PV_MAGIC offsetof(struct promvec, pv_magic) 224define OBP_MAGIC OBP_MAGIC 225define PV_NODEOPS offsetof(struct promvec, pv_nodeops) 226define PV_HALT offsetof(struct promvec, pv_halt) 227define PV_EVAL offsetof(struct promvec, pv_fortheval.v0_eval) 228define PV_ROMVEC_VERS offsetof(struct promvec, pv_romvec_vers) 229 230define NO_NEXTNODE offsetof(struct nodeops, no_nextnode) 231define NO_GETPROP offsetof(struct nodeops, no_getprop) 232 233define OLDMON_PRINTF offsetof(struct om_vector, printf) 234define OLDMON_HALT offsetof(struct om_vector, exitToMon) 235 236# floppy trap handler fields 237define FDC_REG_HANDLE offsetof(struct fdcio, fdcio_handle) 238define FDC_REG_MSR offsetof(struct fdcio, fdcio_reg_msr) 239define FDC_REG_FIFO offsetof(struct fdcio, fdcio_reg_fifo) 240define FDC_ITASK offsetof(struct fdcio, fdcio_itask) 241define FDC_ISTATUS offsetof(struct fdcio, fdcio_istatus) 242define FDC_STATUS offsetof(struct fdcio, fdcio_status) 243define FDC_NSTAT offsetof(struct fdcio, fdcio_nstat) 244define FDC_DATA offsetof(struct fdcio, fdcio_data) 245define FDC_TC offsetof(struct fdcio, fdcio_tc) 246define FDC_EVCNT offsetof(struct fdcio, fdcio_intrcnt.ev_count) 247