1# $NetBSD: genassym.cf,v 1.34 2002/05/07 02:38:44 uwe 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/map.h> 85include <sys/proc.h> 86include <sys/mbuf.h> 87include <sys/msgbuf.h> 88include <sys/user.h> 89include <sys/device.h> 90include <sys/disklabel.h> 91include <sys/disk.h> 92 93include <uvm/uvm.h> 94 95include <machine/cpu.h> 96include <machine/oldmon.h> 97include <machine/bsd_openprom.h> 98 99include <sparc/sparc/cpuvar.h> 100 101include <sparc/sparc/msiiepreg.h> 102 103ifdef notyet 104include <sparc/dev/zsreg.h> 105include <sparc/dev/zsvar.h> 106endif 107 108include <machine/bus.h> 109include <sparc/dev/audioamdvar.h> 110 111include <sparc/dev/fdreg.h> 112include <sparc/dev/fdvar.h> 113 114# general constants 115define BSD BSD 116define USRSTACK USRSTACK 117 118# proc fields and values 119define P_ADDR offsetof(struct proc, p_addr) 120define P_STAT offsetof(struct proc, p_stat) 121define P_WCHAN offsetof(struct proc, p_wchan) 122define P_VMSPACE offsetof(struct proc, p_vmspace) 123define P_CPU offsetof(struct proc, p_cpu) 124define SRUN SRUN 125define SONPROC SONPROC 126 127# VM structure fields 128define VM_PMAP offsetof(struct vmspace, vm_map.pmap) 129define PMAP_CTX offsetof(struct pmap, pm_ctx) 130define PMAP_CTXNUM offsetof(struct pmap, pm_ctxnum) 131 132define UVM_PAGE_IDLE_ZERO offsetof(struct uvm, page_idle_zero) 133 134# interrupt/fault metering 135define V_SWTCH offsetof(struct uvmexp, swtch) 136define V_INTR offsetof(struct uvmexp, intrs) 137define V_FAULTS offsetof(struct uvmexp, faults) 138 139# CPU info structure 140define CPUINFO_STRUCTSIZE sizeof(struct cpu_info) 141define CPUINFO_CPUNO offsetof(struct cpu_info, ci_cpuid) 142define CPUINFO_GETSYNCFLT offsetof(struct cpu_info, get_syncflt) 143define CPUINFO_GETASYNCFLT offsetof(struct cpu_info, get_asyncflt) 144define CPUINFO_PURE_VCACHE_FLS offsetof(struct cpu_info, pure_vcache_flush) 145define CPUINFO_SYNCFLTDUMP offsetof(struct cpu_info, syncfltdump) 146define CPUINFO_INTREG offsetof(struct cpu_info, intreg_4m) 147define CPUINFO_EINTSTACK offsetof(struct cpu_info, eintstack) 148define INT_STACK_SIZE INT_STACK_SIZE 149define CPUINFO_REDZONE offsetof(struct cpu_info, redzone) 150define REDSIZE REDSIZE 151define CPUINFO_IDLE_U offsetof(struct cpu_info, idle_u) 152define CPUINFO_CURPCB offsetof(struct cpu_info, curpcb) 153define CPUINFO_CURPROC offsetof(struct cpu_info, ci_curproc) 154define CPUINFO_SELF offsetof(struct cpu_info, ci_self) 155define CPUINFO_FLAGS offsetof(struct cpu_info, flags) 156 157# PTE bits and related information 158define PG_W PG_W 159define PG_VSHIFT PG_VSHIFT 160define PG_PROTSHIFT PG_PROTSHIFT 161define PG_PROTUREAD PG_PROTUREAD 162define PG_PROTUWRITE PG_PROTUWRITE 163if defined(SUN4M) 164define SRMMU_TETYPE SRMMU_TETYPE 165define SRMMU_TEPTE SRMMU_TEPTE 166define SRMMU_PROT_MASK SRMMU_PROT_MASK 167define PPROT_R_RW PPROT_R_RW 168define PPROT_RX_RX PPROT_RX_RX 169define PPROT_RWX_RWX PPROT_RWX_RWX 170define PPROT_WRITE PPROT_WRITE 171endif 172 173# FPU state 174define FS_REGS offsetof(struct fpstate, fs_regs) 175define FS_FSR offsetof(struct fpstate, fs_fsr) 176define FS_QSIZE offsetof(struct fpstate, fs_qsize) 177define FS_QUEUE offsetof(struct fpstate, fs_queue) 178define FSR_QNE FSR_QNE 179 180# microSPARC-IIep PCI controller registers 181define PCIC_PROC_IPR_REG offsetof(struct msiiep_pcic_reg, pcic_proc_ipr) 182define PCIC_SOFT_INTR_CLEAR_REG offsetof(struct msiiep_pcic_reg, pcic_soft_intr_clear) 183define PCIC_SOFT_INTR_SET_REG offsetof(struct msiiep_pcic_reg, pcic_soft_intr_set) 184define PCIC_SCCR_REG offsetof(struct msiiep_pcic_reg, pcic_sccr) 185 186# errno 187define EFAULT EFAULT 188define ENAMETOOLONG ENAMETOOLONG 189 190# PCB fields 191define PCB_NSAVED offsetof(struct pcb, pcb_nsaved) 192define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) 193define PCB_PSR offsetof(struct pcb, pcb_psr) 194define PCB_RW offsetof(struct pcb, pcb_rw) 195define PCB_SP offsetof(struct pcb, pcb_sp) 196define PCB_PC offsetof(struct pcb, pcb_pc) 197define PCB_UW offsetof(struct pcb, pcb_uw) 198define PCB_WIM offsetof(struct pcb, pcb_wim) 199 200# interrupt enable register PTE 201define IE_REG_PTE_PG (PG_V | PG_W | PG_S | PG_NC | PG_OBIO) 202 203ifdef notyet 204# ZSCC interrupt fields 205define ZSC_A offsetof(struct zs_softc, sc_a) 206define ZSC_B offsetof(struct zs_softc, sc_b) 207define ZL_WREG offsetof(struct zs_line, zl_wreg) 208define ZL_TBC offsetof(struct zs_line, zl_tbc) 209define ZL_TBA offsetof(struct zs_line, zl_tba) 210define ZL_RBPUT offsetof(struct zs_line, zl_rbput) 211define ZL_RBUF offsetof(struct zs_line, zl_rbuf) 212define ZSRR1_DO_bit ffs(ZSRR1_DO) - 1 213endif 214 215# audio trap handler fields 216define AU_BH offsetof(struct auio, au_bh) 217define AU_RDATA offsetof(struct auio, au_rdata) 218define AU_REND offsetof(struct auio, au_rend) 219define AU_PDATA offsetof(struct auio, au_pdata) 220define AU_PEND offsetof(struct auio, au_pend) 221define AU_EVCNT offsetof(struct auio, au_intrcnt.ev_count) 222 223define PROM_BASE PROM_BASE 224 225define PV_MAGIC offsetof(struct promvec, pv_magic) 226define OBP_MAGIC OBP_MAGIC 227define PV_NODEOPS offsetof(struct promvec, pv_nodeops) 228define PV_HALT offsetof(struct promvec, pv_halt) 229define PV_EVAL offsetof(struct promvec, pv_fortheval.v0_eval) 230define PV_ROMVEC_VERS offsetof(struct promvec, pv_romvec_vers) 231 232define NO_NEXTNODE offsetof(struct nodeops, no_nextnode) 233define NO_GETPROP offsetof(struct nodeops, no_getprop) 234 235define OLDMON_PRINTF offsetof(struct om_vector, printf) 236define OLDMON_HALT offsetof(struct om_vector, exitToMon) 237 238# floppy trap handler fields 239define FDC_REG_HANDLE offsetof(struct fdcio, fdcio_handle) 240define FDC_REG_MSR offsetof(struct fdcio, fdcio_reg_msr) 241define FDC_REG_FIFO offsetof(struct fdcio, fdcio_reg_fifo) 242define FDC_ITASK offsetof(struct fdcio, fdcio_itask) 243define FDC_ISTATUS offsetof(struct fdcio, fdcio_istatus) 244define FDC_STATUS offsetof(struct fdcio, fdcio_status) 245define FDC_NSTAT offsetof(struct fdcio, fdcio_nstat) 246define FDC_DATA offsetof(struct fdcio, fdcio_data) 247define FDC_TC offsetof(struct fdcio, fdcio_tc) 248define FDC_EVCNT offsetof(struct fdcio, fdcio_intrcnt.ev_count) 249