placate Grim Reaper with sun4v support

This commit is contained in:
Kip Macy 2006-10-05 06:14:28 +00:00
parent 46acbb7554
commit 2405f16615
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163022
178 changed files with 37469 additions and 0 deletions

49
sys/conf/Makefile.sun4v Normal file
View File

@ -0,0 +1,49 @@
# Makefile.sparc64 -- with config changes.
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.i386 7.1 5/10/91
# $FreeBSD$
#
# Makefile for FreeBSD
#
# This makefile is constructed from a machine description:
# config machineid
# Most changes should be made in the machine description
# /sys/sparc64/conf/``machineid''
# after which you should do
# config machineid
# Generic makefile changes should be made in
# /sys/conf/Makefile.sparc64
# after which config should be rerun for all machines.
#
# Which version of config(8) is required.
%VERSREQ= 600004
STD8X16FONT?= iso
.if !defined(S)
.if exists(./@/.)
S= ./@
.else
S= ../../..
.endif
.endif
.include "$S/conf/kern.pre.mk"
MDOBJS= exception.o interrupt.o
%BEFORE_DEPEND
%OBJS
%FILES.c
%FILES.s
%FILES.m
%CLEAN
%RULES
.include "$S/conf/kern.post.mk"

115
sys/conf/files.sun4v Normal file
View File

@ -0,0 +1,115 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
# $FreeBSD$
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
# dependency lines other than the first are silently ignored.
#
atkbdmap.h optional atkbd_dflt_keymap \
compile-with "/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \
no-obj no-implicit-rule before-depend \
clean "atkbdmap.h"
#
ukbdmap.h optional ukbd_dflt_keymap \
compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \
no-obj no-implicit-rule before-depend \
clean "ukbdmap.h"
#
#
crypto/blowfish/bf_enc.c optional crypto | ipsec ipsec_esp
crypto/des/des_enc.c optional crypto | ipsec ipsec_esp | \
netsmbcrypto
dev/ofw/ofw_bus_if.m standard
dev/ofw/ofw_bus_subr.c standard
dev/ofw/ofw_console.c optional ofw_console
dev/ofw/openfirm.c standard
dev/ofw/openfirmio.c standard
dev/ofw/openpromio.c standard
dev/uart/uart_cpu_sparc64.c optional uart
geom/geom_bsd.c standard
geom/geom_bsd_enc.c standard
geom/geom_sunlabel.c standard
geom/geom_sunlabel_enc.c standard
kern/syscalls.c optional ktr
libkern/ffs.c standard
libkern/ffsl.c standard
libkern/fls.c standard
libkern/flsl.c standard
sun4v/sun4v/autoconf.c standard
sun4v/sun4v/bus_machdep.c standard
sun4v/sun4v/clock.c standard
sun4v/sun4v/counter.c standard
sun4v/sun4v/db_disasm.c optional ddb
sun4v/sun4v/db_interface.c optional ddb
sun4v/sun4v/db_trace.c optional ddb
sun4v/sun4v/db_hwwatch.c optional ddb
sun4v/sun4v/dump_machdep.c standard
sun4v/sun4v/elf_machdep.c standard
sun4v/sun4v/exception.S standard no-obj
sun4v/sun4v/eeprom.c optional eeprom ebus | eeprom fhc | \
eeprom sbus
sun4v/sun4v/gdb_machdep.c optional gdb
sun4v/sun4v/hv_pci.c optional pci
sun4v/sun4v/trap_trace.S optional trap_tracing
sparc64/pci/ofw_pci.c optional pci
sparc64/pci/ofw_pcib.c optional pci
sparc64/pci/ofw_pcib_subr.c optional pci
sparc64/pci/ofw_pcibus.c optional pci
sparc64/pci/ofw_pci_if.m optional pci
sparc64/dtrace/dtrace_asm.s optional dtrace
sparc64/dtrace/dtrace_isa.c optional dtrace
sparc64/dtrace/fasttrap_isa.c optional dtrace
sparc64/dtrace/fbt.c optional dtrace
sparc64/dtrace/sdt.c optional dtrace
sparc64/dtrace/dtrace_stub.c standard
# XXX hvcons should be optional
sun4v/sun4v/hvcons.c standard
sun4v/sun4v/hcall.S standard
sun4v/sun4v/hviommu.c standard
sun4v/sun4v/identcpu.c standard
sun4v/sun4v/in_cksum.c optional inet
sun4v/sun4v/interrupt.S standard no-obj
sun4v/sun4v/intr_machdep.c standard
sun4v/sun4v/locore.S standard no-obj
sun4v/sun4v/machdep.c standard
sun4v/sun4v/mem.c optional mem
sun4v/sun4v/mp_exception.S optional smp
sun4v/sun4v/mp_locore.S optional smp
sun4v/sun4v/mp_machdep.c optional smp
sun4v/sun4v/nexus.c standard
sun4v/sun4v/t1_copy.S standard
sun4v/sun4v/ofw_bus.c standard
sun4v/sun4v/ofw_machdep.c standard
sun4v/sun4v/pmap.c standard
sun4v/sun4v/prof_machdep.c optional profiling-routine
sun4v/sun4v/rwindow.c standard
sun4v/sun4v/simdisk.c optional simulator
sun4v/sun4v/support.S standard
sun4v/sun4v/sys_machdep.c standard
sun4v/sun4v/swtch.S standard
sun4v/sun4v/tsb.c standard
sun4v/sun4v/tte.c standard
sun4v/sun4v/tte_hash.c standard
sun4v/sun4v/tick.c standard
sun4v/sun4v/trap.c standard
sun4v/sun4v/uio_machdep.c standard
sun4v/sun4v/vm_machdep.c standard
sun4v/sun4v/vnex.c standard
sun4v/mdesc/mdesc_bus_if.m standard
sun4v/mdesc/mdesc_scandag.c standard
sun4v/mdesc/mdesc_init.c standard
sun4v/mdesc/mdesc_init_intern.c standard
sun4v/mdesc/mdesc_subr.c standard
sun4v/mdesc/mdesc_bus_subr.c standard
sun4v/mdesc/mdesc_getpropstr.c standard
sun4v/mdesc/mdesc_getpropval.c standard
sun4v/mdesc/mdesc_rootnode.c standard
sun4v/mdesc/mdesc_findname.c standard
sun4v/mdesc/mdesc_nodecount.c standard
sun4v/mdesc/mdesc_findnodeprop.c standard
sun4v/mdesc/mdesc_vdevfindval.c standard

20
sys/conf/options.sun4v Normal file
View File

@ -0,0 +1,20 @@
# $FreeBSD$
SUN4V opt_global.h
GFB_DEBUG opt_gfb.h
GFB_NO_FONT_LOADING opt_gfb.h
GFB_NO_MODE_CHANGE opt_gfb.h
DEBUGGER_ON_POWERFAIL opt_psycho.h
OFW_PCI_DEBUG opt_ofw_pci.h
OFWCONS_POLL_HZ opt_ofw.h
# Debug IOMMU inserts/removes using diagnostic accesses. Very loud.
IOMMU_DIAG opt_iommu.h
PMAP_STATS opt_pmap.h
SIMULATOR opt_simulator.h
DTRACE opt_global.h
TRAP_TRACING opt_trap_trace.h
TRAP_TRACE_ENTRIES opt_trap_trace.h

View File

9
sys/sun4v/conf/DEFAULTS Normal file
View File

@ -0,0 +1,9 @@
#
# DEFAULTS -- Default kernel configuration file for FreeBSD/sparc64
#
# $FreeBSD$
machine sun4v
# Pseudo devices.
device mem # Memory and kernel memory devices

217
sys/sun4v/conf/GENERIC Normal file
View File

@ -0,0 +1,217 @@
#
# GENERIC -- Generic kernel configuration file for FreeBSD/sparc64
#
# For more information on this file, please read the handbook section on
# Kernel Configuration Files:
#
# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
#
# The handbook is also available locally in /usr/share/doc/handbook
# if you've installed the doc distribution, otherwise always see the
# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
# latest information.
#
# An exhaustive list of options and more detailed explanations of the
# device lines is also present in the ../../conf/NOTES and NOTES files.
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.
#
# For hardware specific information check HARDWARE.TXT
#
# $FreeBSD$
cpu SUN4V
ident GENERIC
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
makeoptions NO_MODULES="" # disable modules (aicasm in buildenv)
# Platforms supported
# At this time all platforms are supported, as-is.
#options SCHED_ULE # ULE scheduler
options SCHED_4BSD # 4BSD scheduler
#options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options UFS_ACL # Support for access control lists
options UFS_DIRHASH # Improve performance on big directories
options MD_ROOT # MD is a potential root device
options NFSCLIENT # Network Filesystem Client
options NFSSERVER # Network Filesystem Server
options NFS_ROOT # NFS usable as /, requires NFSCLIENT
#options MSDOSFS # MSDOS Filesystem
options NULLFS
options CD9660 # ISO 9660 Filesystem
options PROCFS # Process filesystem (requires PSEUDOFS)
options PSEUDOFS # Pseudo-filesystem framework
options GEOM_GPT # GUID Partition Tables.
options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!]
options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!]
options COMPAT_FREEBSD5 # Compatible with FreeBSD5
options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI
options KTRACE # ktrace(1) support
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options AHC_REG_PRETTY_PRINT # Print register bitfields in debug
# output. Adds ~128k to driver.
options ADAPTIVE_GIANT # Giant mutex is adaptive.
# Debugging for use in -current
options KDB # Enable kernel debugger support.
options KDB_TRACE
options DDB # Support DDB.
options TRAP_TRACING # Enable trap tracing.
options TRAP_TRACE_ENTRIES=256 # Trap trace buffer entries.
#options GDB # Support remote GDB.
#options INVARIANTS # Enable calls of extra sanity checking
#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS
#options WITNESS # Enable checks to detect deadlocks and cycles
#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
#options DEBUG_LOCKS
#options DEBUG_VFS_LOCKS
# To make an SMP kernel, the next line is needed
options SMP # Symmetric MultiProcessor Kernel
# Standard busses
device pci
#device isa
# Floppy drives
#device fdc
# ATA and ATAPI devices
#device ata
#device atadisk # ATA disk drives
#device atapicd # ATAPI CDROM drives
#device atapifd # ATAPI floppy drives
#device atapist # ATAPI tape drives
# Do NOT enable ATA_STATIC_ID -- cmd646 controller will be !ata2!,
# and you will not mount an ATA /.
#options ATA_STATIC_ID # Static device numbering
# SCSI Controllers
#device ahc # AHA2940 and onboard AIC7xxx devices
#device isp # Qlogic family
#device ispfw # Firmware module for Qlogic host adapters
device mpt # LSI-Logic MPT-Fusion (not yet)
#device ncr # NCR/Symbios Logic
#device sym # NCR/Symbios Logic (newer chipsets + those of `ncr')
#device esp # NCR53c9x (FEPS/FAS366)
# SCSI peripherals
device scbus # SCSI bus (required for SCSI)
device ch # SCSI media changers
device da # Direct Access (disks)
device sa # Sequential Access (tape etc)
device cd # CD
device pass # Passthrough device (direct SCSI access)
device ses # SCSI Environmental Services (and SAF-TE)
# RAID controllers
#device amr # AMI MegaRAID
#device mlx # Mylex DAC960 family
# syscons is the default console driver, resembling an SCO console
#device sc
#device splash # Splash screen and screen saver support
#options KBD_INSTALL_CDEV # install a CDEV entry in /dev
#device ofw_console # Open Firmware console device
# Builtin hardware
#device auxio # auxiliary I/O device
#device clkbrd # Clock Board (blinkenlight on Sun Exx00)
device genclock # Generic clock interface
#device eeprom # eeprom (really a front-end for the MK48Txx)
#device mk48txx # Mostek MK48Txx clocks
#device rtc # rtc (really a front-end for the MC146818)
#device mc146818 # Motorola MC146818 and compatible clocks
# Serial (COM) ports
#device sab # Siemens SAB82532 based serial ports
#device uart # Multi-uart driver
#device puc # Multi-channel uarts
# Parallel port
#device ppc
#device ppbus # Parallel port bus (required)
#device lpt # Printer
#device plip # TCP/IP over parallel
#device ppi # Parallel port interface device
#device vpo # Requires scbus and da
# PCI Ethernet NICs.
#device de # DEC/Intel DC21x4x (``Tulip'')
device em # Intel PRO/1000 adapter Gigabit Ethernet Card
#device ixgb # Intel PRO/10GbE Ethernet Card
#device le # AMD Am7900 LANCE and Am79C9xx PCnet
#device txp # 3Com 3cR990 (``Typhoon'')
#device vx # 3Com 3c590, 3c595 (``Vortex'')
# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device miibus # MII bus support
device bge # Broadcom BCM570xx Gigabit Ethernet
# Pseudo devices.
device loop # Network loopback
device random # Entropy device
device ether # Ethernet support
device sl # Kernel SLIP
device ppp # Kernel PPP
device tun # Packet tunnel.
device pty # Pseudo-ttys (telnet etc)
device md # Memory "disks"
device gif # IPv6 and IPv4 tunneling
device faith # IPv6-to-IPv4 relaying (translation)
# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
# Note that 'bpf' is required for DHCP.
device bpf # Berkeley packet filter
# USB support
#device uhci # UHCI PCI->USB interface
#device ohci # OHCI PCI->USB interface
device usb # USB Bus (required)
#device udbp # USB Double Bulk Pipe devices
device ugen # Generic
device uhid # "Human Interface Devices"
#device ukbd # Keyboard
device ulpt # Printer
#device umass # Disks/Mass storage - Requires scbus and da
device ums # Mouse
#device urio # Diamond Rio 500 MP3 player
#device uscanner # Scanners
# USB Ethernet, requires mii
#device aue # ADMtek USB Ethernet
#device axe # ASIX Electronics USB Ethernet
#device cdce # Generic USB over Ethernet
#device cue # CATC USB Ethernet
#device kue # Kawasaki LSI USB Ethernet
#device rue # RealTek RTL8150 USB Ethernet
# FireWire support
#device firewire # FireWire bus code
#device sbp # SCSI over FireWire (Requires scbus and da)
#device fwe # Ethernet over FireWire (non-standard!)
#options SIMULATOR # compile for ISA simulator
#options KTR
#options KTR_MASK=(KTR_TRAP)
#options USB_DEBUG
#options USBVERBOSE
#options DEBUG_LOCKS
#options DEBUG_VFS_LOCKS
device ccd
options SPIN_PROFILING
options HZ=100
#device vnet

View File

@ -0,0 +1 @@
# $FreeBSD$

28
sys/sun4v/conf/MAC Normal file
View File

@ -0,0 +1,28 @@
# MAC -- Generic kernel configuration file for FreeBSD/sparc64 MAC
#
# The Mandatory Access Control, or MAC, framework allows administrators to
# finely control system security by providing for a loadable security pol-
# icy architecture.
#
# For more information see:
#
# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/mac.html
#
# $FreeBSD$
include GENERIC
ident MAC
options MAC
#options MAC_BIBA # BIBA data integrity policy
#options MAC_BSDEXTENDED # File system firewall policy
#options MAC_IFOFF # Network interface silencing policy
#options MAC_LOMAC # Low-watermark data integrity policy
#options MAC_MLS # Multi-level confidentiality policy
#options MAC_NONE # NULL policy
#options MAC_PARTITION # Process partition policy
#options MAC_PORTACL # Network port access control policy
#options MAC_SEEOTHERUIDS # UID visibility policy
#options MAC_STUB # Stub policy
#options MAC_TEST # Testing policy for the MAC framework

3
sys/sun4v/conf/Makefile Normal file
View File

@ -0,0 +1,3 @@
# $FreeBSD$
.include "${.CURDIR}/../../conf/makeLINT.mk"

132
sys/sun4v/conf/NOTES Normal file
View File

@ -0,0 +1,132 @@
# $FreeBSD$
#
# This file contains machine dependent kernel configuration notes. For
# machine independent notes, look in /sys/conf/NOTES.
#####################################################################
# CPU OPTIONS
#
# You must specify at least one CPU (the one you intend to run on);
# deleting the specification for CPUs you don't need to use may make
# parts of the system run faster.
# XXX: On the Sparc64, there is only one CPU type
cpu SUN4U
#####################################################################
# HARDWARE BUS CONFIGURATION
device ebus
device isa
device pci
device sbus
device central
device fhc
#####################################################################
# HARDWARE DEVICE CONFIGURATION
#
# Mandatory devices:
#
device genclock # Generic clock interface
device eeprom # eeprom (really a front-end for the MK48Txx)
device mk48txx # Mostek MK48Txx clocks
device rtc # rtc (really a front-end for the MC146818)
device mc146818 # Motorola MC146818 and compatible clocks
#
# Optional devices:
#
device auxio # auxiliary I/O device
device clkbrd # Clock Board (blinkenlight on Sun Exx00)
device creator # Creator, Creator3D and Elite3D framebuffers
device machfb # ATI Mach64 framebuffers
device ofw_console # Open Firmware console device
option OFWCONS_POLL_HZ=4 # 20 or more works best on Ultra2
device sab # Siemens SAB82532 based serial ports
#####################################################################
# Devices we don't want to deal with
nodevice vga
nodevice daemon_saver
nodevice snake_saver
nodevice star_saver
nodevice bktr
nodevice fdc
nodevice ppc
nodevice snd_ad1816
nodevice snd_als4000
nodevice snd_au88x0
nodevice snd_cmi
nodevice snd_cs4281
nodevice snd_csa
nodevice snd_ds1
nodevice snd_emu10k1
nodevice snd_ess
nodevice snd_fm801
nodevice snd_gusc
nodevice snd_ich
nodevice snd_maestro
nodevice snd_maestro3
nodevice snd_mss
nodevice snd_neomagic
nodevice snd_sb16
nodevice snd_sb8
nodevice snd_sbc
nodevice snd_solo
nodevice snd_t4dwave
nodevice snd_via8233
nodevice snd_via82c686
nodevice snd_vibes
nodevice snd_uaudio
nodevice aha
nodevice bt
nodevice wds
nodevice ep
nodevice ex
nodevice sio
#####################################################################
# Options we don't want to deal with
nooption FDC_DEBUG
nooption COM_ESP
nooption CONSPEED
nooption VGA_DEBUG
nooption SC_RENDER_DEBUG
nooption SC_DEBUG_LEVEL
nooption PPC_DEBUG
nooption PPC_PROBE_CHIPSET
nooption SC_NO_SUSPEND_VTYSWITCH
nooption SC_NO_FONT_LOADING
nooption SC_KERNEL_CONS_REV_ATTR
nooption SC_KERNEL_CONS_ATTR
nooption SC_NORM_REV_ATTR
nooption SC_NORM_ATTR
nooption SC_DFLT_FONT
nooption SC_ALT_MOUSE_IMAGE
nooption VGA_WIDTH90
nooption VGA_SLOW_IOACCESS
nooption VGA_ALT_SEQACCESS
nooption PSM_RESETAFTERSUSPEND
nooption PSM_HOOKRESUME
nooption ATKBD_DFLT_KEYMAP
nooption EXT2FS
#####################################################################
# Make options we don't want to deal with
nomakeoption SC_DFLT_FONT
nomakeoption ATKBD_DFLT_KEYMAP

43
sys/sun4v/include/_bus.h Normal file
View File

@ -0,0 +1,43 @@
/*-
* Copyright (c) 2005 M. Warner Losh.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification, immediately at the beginning of the file.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef SPARC64_INCLUDE__BUS_H
#define SPARC64_INCLUDE__BUS_H
/*
* Bus address and size types
*/
typedef u_long bus_space_handle_t;
typedef int bus_type_t;
typedef u_long bus_addr_t;
typedef u_long bus_size_t;
typedef struct bus_space_tag *bus_space_tag_t;
#endif /* SPARC64_INCLUDE__BUS_H */

View File

@ -0,0 +1,220 @@
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $
* $FreeBSD$
*/
#ifndef _MACHINE_INTTYPES_H_
#define _MACHINE_INTTYPES_H_
/*
* Macros for format specifiers.
*/
/* fprintf(3) macros for signed integers. */
#define PRId8 "d" /* int8_t */
#define PRId16 "d" /* int16_t */
#define PRId32 "d" /* int32_t */
#define PRId64 "ld" /* int64_t */
#define PRIdLEAST8 "d" /* int_least8_t */
#define PRIdLEAST16 "d" /* int_least16_t */
#define PRIdLEAST32 "d" /* int_least32_t */
#define PRIdLEAST64 "ld" /* int_least64_t */
#define PRIdFAST8 "d" /* int_fast8_t */
#define PRIdFAST16 "d" /* int_fast16_t */
#define PRIdFAST32 "d" /* int_fast32_t */
#define PRIdFAST64 "ld" /* int_fast64_t */
#define PRIdMAX "jd" /* intmax_t */
#define PRIdPTR "ld" /* intptr_t */
#define PRIi8 "i" /* int8_t */
#define PRIi16 "i" /* int16_t */
#define PRIi32 "i" /* int32_t */
#define PRIi64 "li" /* int64_t */
#define PRIiLEAST8 "i" /* int_least8_t */
#define PRIiLEAST16 "i" /* int_least16_t */
#define PRIiLEAST32 "i" /* int_least32_t */
#define PRIiLEAST64 "li" /* int_least64_t */
#define PRIiFAST8 "i" /* int_fast8_t */
#define PRIiFAST16 "i" /* int_fast16_t */
#define PRIiFAST32 "i" /* int_fast32_t */
#define PRIiFAST64 "li" /* int_fast64_t */
#define PRIiMAX "ji" /* intmax_t */
#define PRIiPTR "li" /* intptr_t */
/* fprintf(3) macros for unsigned integers. */
#define PRIo8 "o" /* uint8_t */
#define PRIo16 "o" /* uint16_t */
#define PRIo32 "o" /* uint32_t */
#define PRIo64 "lo" /* uint64_t */
#define PRIoLEAST8 "o" /* uint_least8_t */
#define PRIoLEAST16 "o" /* uint_least16_t */
#define PRIoLEAST32 "o" /* uint_least32_t */
#define PRIoLEAST64 "lo" /* uint_least64_t */
#define PRIoFAST8 "o" /* uint_fast8_t */
#define PRIoFAST16 "o" /* uint_fast16_t */
#define PRIoFAST32 "o" /* uint_fast32_t */
#define PRIoFAST64 "lo" /* uint_fast64_t */
#define PRIoMAX "jo" /* uintmax_t */
#define PRIoPTR "lo" /* uintptr_t */
#define PRIu8 "u" /* uint8_t */
#define PRIu16 "u" /* uint16_t */
#define PRIu32 "u" /* uint32_t */
#define PRIu64 "lu" /* uint64_t */
#define PRIuLEAST8 "u" /* uint_least8_t */
#define PRIuLEAST16 "u" /* uint_least16_t */
#define PRIuLEAST32 "u" /* uint_least32_t */
#define PRIuLEAST64 "lu" /* uint_least64_t */
#define PRIuFAST8 "u" /* uint_fast8_t */
#define PRIuFAST16 "u" /* uint_fast16_t */
#define PRIuFAST32 "u" /* uint_fast32_t */
#define PRIuFAST64 "lu" /* uint_fast64_t */
#define PRIuMAX "ju" /* uintmax_t */
#define PRIuPTR "lu" /* uintptr_t */
#define PRIx8 "x" /* uint8_t */
#define PRIx16 "x" /* uint16_t */
#define PRIx32 "x" /* uint32_t */
#define PRIx64 "lx" /* uint64_t */
#define PRIxLEAST8 "x" /* uint_least8_t */
#define PRIxLEAST16 "x" /* uint_least16_t */
#define PRIxLEAST32 "x" /* uint_least32_t */
#define PRIxLEAST64 "lx" /* uint_least64_t */
#define PRIxFAST8 "x" /* uint_fast8_t */
#define PRIxFAST16 "x" /* uint_fast16_t */
#define PRIxFAST32 "x" /* uint_fast32_t */
#define PRIxFAST64 "lx" /* uint_fast64_t */
#define PRIxMAX "jx" /* uintmax_t */
#define PRIxPTR "lx" /* uintptr_t */
#define PRIX8 "X" /* uint8_t */
#define PRIX16 "X" /* uint16_t */
#define PRIX32 "X" /* uint32_t */
#define PRIX64 "lX" /* uint64_t */
#define PRIXLEAST8 "X" /* uint_least8_t */
#define PRIXLEAST16 "X" /* uint_least16_t */
#define PRIXLEAST32 "X" /* uint_least32_t */
#define PRIXLEAST64 "lX" /* uint_least64_t */
#define PRIXFAST8 "X" /* uint_fast8_t */
#define PRIXFAST16 "X" /* uint_fast16_t */
#define PRIXFAST32 "X" /* uint_fast32_t */
#define PRIXFAST64 "lX" /* uint_fast64_t */
#define PRIXMAX "jX" /* uintmax_t */
#define PRIXPTR "lX" /* uintptr_t */
/* fscanf(3) macros for signed integers. */
#define SCNd8 "hhd" /* int8_t */
#define SCNd16 "hd" /* int16_t */
#define SCNd32 "d" /* int32_t */
#define SCNd64 "ld" /* int64_t */
#define SCNdLEAST8 "hhd" /* int_least8_t */
#define SCNdLEAST16 "hd" /* int_least16_t */
#define SCNdLEAST32 "d" /* int_least32_t */
#define SCNdLEAST64 "ld" /* int_least64_t */
#define SCNdFAST8 "d" /* int_fast8_t */
#define SCNdFAST16 "d" /* int_fast16_t */
#define SCNdFAST32 "d" /* int_fast32_t */
#define SCNdFAST64 "ld" /* int_fast64_t */
#define SCNdMAX "jd" /* intmax_t */
#define SCNdPTR "ld" /* intptr_t */
#define SCNi8 "hhi" /* int8_t */
#define SCNi16 "hi" /* int16_t */
#define SCNi32 "i" /* int32_t */
#define SCNi64 "li" /* int64_t */
#define SCNiLEAST8 "hhi" /* int_least8_t */
#define SCNiLEAST16 "hi" /* int_least16_t */
#define SCNiLEAST32 "i" /* int_least32_t */
#define SCNiLEAST64 "li" /* int_least64_t */
#define SCNiFAST8 "i" /* int_fast8_t */
#define SCNiFAST16 "i" /* int_fast16_t */
#define SCNiFAST32 "i" /* int_fast32_t */
#define SCNiFAST64 "li" /* int_fast64_t */
#define SCNiMAX "ji" /* intmax_t */
#define SCNiPTR "li" /* intptr_t */
/* fscanf(3) macros for unsigned integers. */
#define SCNo8 "hho" /* uint8_t */
#define SCNo16 "ho" /* uint16_t */
#define SCNo32 "o" /* uint32_t */
#define SCNo64 "lo" /* uint64_t */
#define SCNoLEAST8 "hho" /* uint_least8_t */
#define SCNoLEAST16 "ho" /* uint_least16_t */
#define SCNoLEAST32 "o" /* uint_least32_t */
#define SCNoLEAST64 "lo" /* uint_least64_t */
#define SCNoFAST8 "o" /* uint_fast8_t */
#define SCNoFAST16 "o" /* uint_fast16_t */
#define SCNoFAST32 "o" /* uint_fast32_t */
#define SCNoFAST64 "lo" /* uint_fast64_t */
#define SCNoMAX "jo" /* uintmax_t */
#define SCNoPTR "lo" /* uintptr_t */
#define SCNu8 "hhu" /* uint8_t */
#define SCNu16 "hu" /* uint16_t */
#define SCNu32 "u" /* uint32_t */
#define SCNu64 "lu" /* uint64_t */
#define SCNuLEAST8 "hhu" /* uint_least8_t */
#define SCNuLEAST16 "hu" /* uint_least16_t */
#define SCNuLEAST32 "u" /* uint_least32_t */
#define SCNuLEAST64 "lu" /* uint_least64_t */
#define SCNuFAST8 "u" /* uint_fast8_t */
#define SCNuFAST16 "u" /* uint_fast16_t */
#define SCNuFAST32 "u" /* uint_fast32_t */
#define SCNuFAST64 "lu" /* uint_fast64_t */
#define SCNuMAX "ju" /* uintmax_t */
#define SCNuPTR "lu" /* uintptr_t */
#define SCNx8 "hhx" /* uint8_t */
#define SCNx16 "hx" /* uint16_t */
#define SCNx32 "x" /* uint32_t */
#define SCNx64 "lx" /* uint64_t */
#define SCNxLEAST8 "hhx" /* uint_least8_t */
#define SCNxLEAST16 "hx" /* uint_least16_t */
#define SCNxLEAST32 "x" /* uint_least32_t */
#define SCNxLEAST64 "lx" /* uint_least64_t */
#define SCNxFAST8 "x" /* uint_fast8_t */
#define SCNxFAST16 "x" /* uint_fast16_t */
#define SCNxFAST32 "x" /* uint_fast32_t */
#define SCNxFAST64 "lx" /* uint_fast64_t */
#define SCNxMAX "jx" /* uintmax_t */
#define SCNxPTR "lx" /* uintptr_t */
#endif /* !_MACHINE_INTTYPES_H_ */

View File

@ -0,0 +1,87 @@
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.3 (Berkeley) 1/4/94
* $FreeBSD$
*/
#ifndef _MACHINE__LIMITS_H_
#define _MACHINE__LIMITS_H_
/*
* According to ANSI (section 2.2.4.2), the values below must be usable by
* #if preprocessing directives. Additionally, the expression must have the
* same type as would an expression that is an object of the corresponding
* type converted according to the integral promotions. The subtraction for
* INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
* These numbers are for the default configuration of gcc. They work for
* some other compilers as well, but this should not be depended on.
*/
#define __CHAR_BIT 8 /* number of bits in a char */
#define __SCHAR_MAX 0x7f /* max value for a signed char */
#define __SCHAR_MIN (-0x7f-1) /* min value for a signed char */
#define __UCHAR_MAX 0xffU /* max value for an unsigned char */
#define __USHRT_MAX 0xffffU /* max value for an unsigned short */
#define __SHRT_MAX 0x7fff /* max value for a short */
#define __SHRT_MIN (-0x7fff-1) /* min value for a short */
#define __UINT_MAX 0xffffffffU /* max value for an unsigned int */
#define __INT_MAX 0x7fffffff /* max value for an int */
#define __INT_MIN (-0x7fffffff-1) /* min value for an int */
#define __ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */
#define __LONG_MAX 0x7fffffffffffffffL /* max for a long */
#define __LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */
/* Long longs and longs are the same size on sparc64. */
/* max for an unsigned long long */
#define __ULLONG_MAX 0xffffffffffffffffULL
#define __LLONG_MAX 0x7fffffffffffffffLL /* max for a long long */
#define __LLONG_MIN (-0x7fffffffffffffffLL-1) /* min for a long long */
#define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */
#define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */
#define __OFF_MAX __LONG_MAX /* max value for an off_t */
#define __OFF_MIN __LONG_MIN /* min value for an off_t */
/* Quads and longs are the same size. Ensure they stay in sync. */
#define __UQUAD_MAX (__ULONG_MAX) /* max value for a uquad_t */
#define __QUAD_MAX (__LONG_MAX) /* max value for a quad_t */
#define __QUAD_MIN (__LONG_MIN) /* min value for a quad_t */
#define __LONG_BIT 64
#define __WORD_BIT 32
/* Minimum signal stack size. */
#define __MINSIGSTKSZ (1024 * 4)
#endif /* !_MACHINE__LIMITS_H_ */

171
sys/sun4v/include/_stdint.h Normal file
View File

@ -0,0 +1,171 @@
/*-
* Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org>
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE__STDINT_H_
#define _MACHINE__STDINT_H_
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
#define INT8_C(c) (c)
#define INT16_C(c) (c)
#define INT32_C(c) (c)
#define INT64_C(c) (c ## L)
#define UINT8_C(c) (c)
#define UINT16_C(c) (c)
#define UINT32_C(c) (c ## U)
#define UINT64_C(c) (c ## UL)
#define INTMAX_C(c) (c ## L)
#define UINTMAX_C(c) (c ## UL)
#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
/*
* ISO/IEC 9899:1999
* 7.18.2.1 Limits of exact-width integer types
*/
/* Minimum values of exact-width signed integer types. */
#define INT8_MIN (-0x7f-1)
#define INT16_MIN (-0x7fff-1)
#define INT32_MIN (-0x7fffffff-1)
#define INT64_MIN (-0x7fffffffffffffffL-1)
/* Maximum values of exact-width signed integer types. */
#define INT8_MAX 0x7f
#define INT16_MAX 0x7fff
#define INT32_MAX 0x7fffffff
#define INT64_MAX 0x7fffffffffffffffL
/* Maximum values of exact-width unsigned integer types. */
#define UINT8_MAX 0xff
#define UINT16_MAX 0xffff
#define UINT32_MAX 0xffffffffU
#define UINT64_MAX 0xffffffffffffffffUL
/*
* ISO/IEC 9899:1999
* 7.18.2.2 Limits of minimum-width integer types
*/
/* Minimum values of minimum-width signed integer types. */
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST64_MIN INT64_MIN
/* Maximum values of minimum-width signed integer types. */
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MAX INT64_MAX
/* Maximum values of minimum-width unsigned integer types. */
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
/*
* ISO/IEC 9899:1999
* 7.18.2.3 Limits of fastest minimum-width integer types
*/
/* Minimum values of fastest minimum-width signed integer types. */
#define INT_FAST8_MIN INT32_MIN
#define INT_FAST16_MIN INT32_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
/* Maximum values of fastest minimum-width signed integer types. */
#define INT_FAST8_MAX INT32_MAX
#define INT_FAST16_MAX INT32_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
/* Maximum values of fastest minimum-width unsigned integer types. */
#define UINT_FAST8_MAX UINT32_MAX
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
/*
* ISO/IEC 9899:1999
* 7.18.2.4 Limits of integer types capable of holding object pointers
*/
#define INTPTR_MIN INT64_MIN
#define INTPTR_MAX INT64_MAX
#define UINTPTR_MAX UINT64_MAX
/*
* ISO/IEC 9899:1999
* 7.18.2.5 Limits of greatest-width integer types
*/
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
/*
* ISO/IEC 9899:1999
* 7.18.3 Limits of other integer types
*/
/* Limits of ptrdiff_t. */
#define PTRDIFF_MIN INT64_MIN
#define PTRDIFF_MAX INT64_MAX
/* Limits of sig_atomic_t. */
#define SIG_ATOMIC_MIN INT32_MIN
#define SIG_ATOMIC_MAX INT32_MAX
/* Limit of size_t. */
#define SIZE_MAX UINT64_MAX
#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
/* Limits of wchar_t. */
#define WCHAR_MIN INT32_MIN
#define WCHAR_MAX INT32_MAX
#endif
/* Limits of wint_t. */
#define WINT_MIN INT32_MIN
#define WINT_MAX INT32_MAX
#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
#endif /* !_MACHINE__STDINT_H_ */

113
sys/sun4v/include/_types.h Normal file
View File

@ -0,0 +1,113 @@
/*-
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* From: @(#)ansi.h 8.2 (Berkeley) 1/4/94
* From: @(#)types.h 8.3 (Berkeley) 1/5/94
* $FreeBSD$
*/
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Basic types upon which most other types are built.
*/
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef long __int64_t;
typedef unsigned long __uint64_t;
/*
* Standard type definitions.
*/
typedef __int32_t __clock_t; /* clock()... */
typedef __uint32_t __cpumask_t;
typedef __int64_t __critical_t;
typedef double __double_t;
typedef float __float_t;
typedef __int64_t __intfptr_t;
typedef __int64_t __intmax_t;
typedef __int64_t __intptr_t;
typedef __int32_t __int_fast8_t;
typedef __int32_t __int_fast16_t;
typedef __int32_t __int_fast32_t;
typedef __int64_t __int_fast64_t;
typedef __int8_t __int_least8_t;
typedef __int16_t __int_least16_t;
typedef __int32_t __int_least32_t;
typedef __int64_t __int_least64_t;
typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */
typedef __int64_t __register_t;
typedef __int64_t __segsz_t; /* segment size (in pages) */
typedef __uint64_t __size_t; /* sizeof() */
typedef __int64_t __ssize_t; /* byte count or error */
typedef __int64_t __time_t; /* time()... */
typedef __uint64_t __uintfptr_t;
typedef __uint64_t __uintmax_t;
typedef __uint64_t __uintptr_t;
typedef __uint32_t __uint_fast8_t;
typedef __uint32_t __uint_fast16_t;
typedef __uint32_t __uint_fast32_t;
typedef __uint64_t __uint_fast64_t;
typedef __uint8_t __uint_least8_t;
typedef __uint16_t __uint_least16_t;
typedef __uint32_t __uint_least32_t;
typedef __uint64_t __uint_least64_t;
typedef __uint64_t __u_register_t;
typedef __uint64_t __vm_offset_t;
typedef __int64_t __vm_ooffset_t;
typedef __uint64_t __vm_paddr_t;
typedef __uint64_t __vm_pindex_t;
typedef __uint64_t __vm_size_t;
/*
* Unusual type definitions.
*/
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
typedef char * __va_list;
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#if defined(__GNUCLIKE_BUILTIN_VAALIST) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif
typedef __uint64_t tte_t;
#endif /* !_MACHINE__TYPES_H_ */

155
sys/sun4v/include/asi.h Normal file
View File

@ -0,0 +1,155 @@
/*-
* Copyright (c) 2006 Kip Macy
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: BSDI: asi.h,v 1.3 1997/08/08 14:31:42 torek
* $FreeBSD$
*/
#ifndef _MACHINE_ASI_H_
#define _MACHINE_ASI_H_
/*
* UltraSPARC Architecture 2005 ASIs
*/
#define ASI_N 0x04 /* ASI_NUCLEUS */
#define ASI_NL 0x0c /* ASI_NUCLEUS_LITTLE */
#define ASI_AIUP 0x10 /* ASI_AS_IF_USER_PRIMARY */
#define ASI_AIUS 0x11 /* ASI_AS_IF_USER_SECONDARY */
#define ASI_REAL 0x14
#define ASI_REAL_IO 0x15
#define ASI_BLK_AIUP 0x16 /* ASI_BLOCK_AS_IF_USER_PRIMARY */
#define ASI_BLK_AIUS 0x17 /* ASI_BLOCK_AS_IF_USER_SECONDARY */
#define ASI_AIUPL 0x18 /* ASI_AS_IF_USER_PRIMARY_LITTLE */
#define ASI_AIUSL 0x19 /* ASI_AS_IF_USER_SECONDARY_LITTLE */
#define ASI_REAL_L 0x1C /* ASI_REAL_LITTLE */
#define ASI_REAL_IO_L 0x1D /* ASI_REAL_IO_LITTLE */
#define ASI_BLK_AIUPL 0x1E /* ASI_BLOCK_AS_IF_USER_PRIMARY_LITTLE */
#define ASI_BLK_AIUSL 0x1F /* ASI_BLOCK_AS_IF_USER_SECONDARY_LITTLE */
#define ASI_SCRATCHPAD 0x20
#define ASI_MMU_CONTEXTID 0x21
#define ASI_LDTD_AIUP 0x22 /* ASI_LOAD_TWIN_DW_AS_IF_USER_PRIMARY */
#define ASI_LDSTBI_AIUP 0x22
#define ASI_LDTD_AIUS 0x23 /* ASI_LOAD_TWIN_DW_AS_IF_USER_SECONDARY */
#define ASI_LDSTBI_AIUS 0x23
#define ASI_QUEUE 0x25
#define ASI_LDTD_REAL 0x26 /* ASI_LOAD_TWIN_DW_REAL */
#define ASI_STBI_REAL 0x26
#define ASI_LDTD_N 0x27 /* ASI_LOAD_TWIN_DW_NUCLEUS */
#define ASI_LDSTBI_N 0x27
#define ASI_LDTD_AIUPL 0x2A /* ASI_LD_TWIN_DW_AS_IF_USER_PRIMARY_LITTLE */
#define ASI_LDTD_AIUSL 0x2B /* ASI_LD_TWIN_DW_AS_IF_USER_SECONDARY_LITTLE */
#define ASI_LDTD_REAL_L 0x2E /* ASI_LOAD_TWIN_DW_REAL_LITTLE */
#define ASI_LDTD_NL 0x2F /* ASI_LOAD_TWIN_DW_NUCLEUS_LITTLE */
#define ASI_P 0x80 /* ASI_PRIMARY */
#define ASI_S 0x81 /* ASI_SECONDARY */
#define ASI_PNF 0x82 /* ASI_PRIMARY_NO_FAULT */
#define ASI_SNF 0x83 /* ASI_SECONDARY_NO_FAULT */
#define ASI_PL 0x88 /* ASI_PRIMARY_LITTLE */
#define ASI_SL 0x89 /* ASI_SECONDARY_LITTLE */
#define ASI_PNFL 0x8a /* ASI_PRIMARY_NO_FAULT_LITTLE */
#define ASI_SNFL 0x8b /* ASI_SECONDARY_NO_FAULT_LITTLE */
#define ASI_PST8_P 0xc0
#define ASI_PST8_S 0xc1
#define ASI_PST16_P 0xc2
#define ASI_PST16_S 0xc3
#define ASI_PST32_P 0xc4
#define ASI_PST32_S 0xc5
#define ASI_PST8_PL 0xc8
#define ASI_PST8_SL 0xc9
#define ASI_PST16_PL 0xca
#define ASI_PST16_SL 0xcb
#define ASI_PST32_PL 0xcc
#define ASI_PST32_SL 0xcd
#define ASI_FL8_P 0xd0
#define ASI_FL8_S 0xd1
#define ASI_FL16_P 0xd2
#define ASI_FL16_S 0xd3
#define ASI_FL8_PL 0xd8
#define ASI_FL8_SL 0xd9
#define ASI_FL16_PL 0xda
#define ASI_FL16_SL 0xdb
#define ASI_LDTD_P 0xe2 /* ASI_LOAD_TWIN_DW_PRIMARY */
#define ASI_LDSTBI_P 0xe2
#define ASI_LDTD_S 0xe3 /* ASI_LOAD_TWIN_DW_SECONDARY */
#define ASI_LDTD_PL 0xea /* ASI_LOAD_TWIN_DW_PRIMARY_LITTLE */
#define ASI_LDTD_SL 0xeb /* ASI_LOAD_TWIN_DW_SECONDARY_LITTLE */
#define ASI_BLK_P 0xf0 /* ASI_BLOCK_PRIMARY */
#define ASI_BLK_S 0xf1 /* ASI_BLOCK_SECONDARY */
#define ASI_BLK_PL 0xf8 /* ASI_BLOCK_PRIMARY_LITTLE */
#define ASI_BLK_SL 0xf9 /* ASI_BLOCK_SECONDARY_LITTLE */
#define ASI_SCRATCHPAD_0_REG 0x00
#define ASI_SCRATCHPAD_1_REG 0x08
#define ASI_SCRATCHPAD_2_REG 0x10
#define ASI_SCRATCHPAD_3_REG 0x18
#define ASI_SCRATCHPAD_6_REG 0x30
#define ASI_SCRATCHPAD_7_REG 0x38
#define SCRATCH_REG_MMFSA ASI_SCRATCHPAD_0_REG
#define SCRATCH_REG_PCPU ASI_SCRATCHPAD_1_REG
#define SCRATCH_REG_HASH_KERNEL ASI_SCRATCHPAD_2_REG
#define SCRATCH_REG_TSB_KERNEL ASI_SCRATCHPAD_3_REG
#define SCRATCH_REG_HASH_USER ASI_SCRATCHPAD_6_REG
#define SCRATCH_REG_TSB_USER ASI_SCRATCHPAD_7_REG
#define MMU_CID_P 0x08
#define MMU_CID_S 0x10
#define CPU_MONDO_QUEUE_HEAD 0x3c0
#define CPU_MONDO_QUEUE_TAIL 0x3c8
#define DEV_MONDO_QUEUE_HEAD 0x3d0
#define DEV_MONDO_QUEUE_TAIL 0x3d8
#define RESUMABLE_ERROR_QUEUE_HEAD 0x3e0
#define RESUMABLE_ERROR_QUEUE_TAIL 0x3e8
#define NONRESUMABLE_ERROR_QUEUE_HEAD 0x3f0
#define NONRESUMABLE_ERROR_QUEUE_TAIL 0x3f8
#define Q(queue_head) (queue_head >> 4)
#endif /* !_MACHINE_ASI_H_ */

117
sys/sun4v/include/asm.h Normal file
View File

@ -0,0 +1,117 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90
* from: FreeBSD: src/sys/i386/include/asm.h,v 1.7 2000/01/25
* $FreeBSD$
*/
#ifndef _MACHINE_ASM_H_
#define _MACHINE_ASM_H_
#define __ASM__
#include <sys/cdefs.h>
#ifdef PIC
#define PIC_PROLOGUE(r1, r2) \
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), r1 ; \
rd %pc, r2 ; \
or r1, %lo(_GLOBAL_OFFSET_TABLE_+4), r1 ; \
add r2, r1, r2
#define SET(name, r1, r2) \
set name, r2 ; \
ldx [r1 + r2], r2
#else
#define PIC_PROLOGUE(r1, r2)
#define SET(name, r1, r2) \
set name, r2
#endif
/*
* CNAME and HIDENAME manage the relationship between symbol names in C
* and the equivalent assembly language names. CNAME is given a name as
* it would be used in a C program. It expands to the equivalent assembly
* language name. HIDENAME is given an assembly-language name, and expands
* to a possibly-modified form that will be invisible to C programs.
*/
#define CNAME(csym) csym
#define HIDENAME(asmsym) __CONCAT(.,asmsym)
#define CCFSZ 192
#define SPOFF 2047
#define _ALIGN_TEXT .align 32
#define _START_ENTRY \
.text ; \
_ALIGN_TEXT
/*
* Define a function entry point.
*
* The compiler produces #function for the .type pseudo-op, but the '#'
* character has special meaning in cpp macros, so we use @function like
* other architectures. The assembler seems to accept both.
* The assembler also accepts a .proc pseudo-op, which is used by the
* peep hole optimizer, whose argument is the type code of the return
* value. Since this is difficult to predict and its expected that
* assembler code is already optimized, we leave it out.
*/
#define _ENTRY(x) \
_START_ENTRY ; \
.globl CNAME(x) ; \
.type CNAME(x),@function ; \
CNAME(x):
#define ENTRY(x) _ENTRY(x)
#define END(x) .size x, . - x
#define STACK_ALIGN 64
#define SET_SIZE(x) END(x)
#define SA(X) (((X)+(STACK_ALIGN-1)) & ~(STACK_ALIGN-1))
#define WINDOWSIZE64 (16*8)
#define MINFRAME64 (WINDOWSIZE64 + 64)
#define MINFRAME MINFRAME64
#define REGOFF SA(MINFRAME)
/*
* Kernel RCS ID tag and copyright macros
*/
#undef __FBSDID
#if !defined(lint) && !defined(STRIP_FBSDID)
#define __FBSDID(s) .ident s
#else
#define __FBSDID(s) /* nothing */
#endif /* not lint and not STRIP_FBSDID */
#endif /* !_MACHINE_ASM_H_ */

View File

@ -0,0 +1,309 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* Copyright (c) 2006 Kip Macy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_ASMACROS_H_
#define _MACHINE_ASMACROS_H_
#ifdef _KERNEL
/*
* %g7 points to per-cpu data.
*/
#define PCPU_REG %g7
#ifdef LOCORE
/*
* Atomically decrement an integer in memory.
*/
#define ATOMIC_DEC_INT(r1, r2, r3) \
lduw [r1], r2 ; \
9: sub r2, 1, r3 ; \
casa [r1] ASI_N, r2, r3 ; \
cmp r2, r3 ; \
bne,pn %icc, 9b ; \
mov r3, r2
/*
* Atomically increment an integer in memory.
*/
#define ATOMIC_INC_INT(r1, r2, r3) \
lduw [r1], r2 ; \
9: add r2, 1, r3 ; \
casa [r1] ASI_N, r2, r3 ; \
cmp r2, r3 ; \
bne,pn %icc, 9b ; \
mov r3, r2
/*
* Atomically increment an u_long in memory.
*/
#define ATOMIC_INC_ULONG(r1, r2, r3) \
ldx [r1], r2 ; \
9: add r2, 1, r3 ; \
casxa [r1] ASI_N, r2, r3 ; \
cmp r2, r3 ; \
bne,pn %icc, 9b ; \
mov r3, r2
/*
* Atomically clear a number of bits of an integer in memory.
*/
#define ATOMIC_CLEAR_INT(r1, r2, r3, bits) \
lduw [r1], r2 ; \
9: andn r2, bits, r3 ; \
casa [r1] ASI_N, r2, r3 ; \
cmp r2, r3 ; \
bne,pn %icc, 9b ; \
mov r3, r2
#define PCPU(member) PCPU_REG + PC_ ## member
#define PCPU_ADDR(member, reg) \
add PCPU_REG, PC_ ## member, reg
#define DEBUGGER() \
ta %xcc, 1
#define PANIC(msg, r1) \
.sect .rodata ; \
9: .asciz msg ; \
.previous ; \
SET(9b, r1, %o0) ; \
call panic ; \
nop
#ifdef INVARIANTS
#define KASSERT(r1, msg) \
brnz r1, 8f ; \
nop ; \
PANIC(msg, r1) ; \
8:
#else
#define KASSERT(r1, msg)
#endif
#define PUTS(msg, r1) \
.sect .rodata ; \
9: .asciz msg ; \
.previous ; \
SET(9b, r1, %o0) ; \
call printf ; \
nop
#define _ALIGN_DATA .align 8
#define DATA(name) \
.data ; \
_ALIGN_DATA ; \
.globl name ; \
.type name, @object ; \
name:
#define EMPTY
#define GET_MMFSA_SCRATCH(reg) \
ldxa [%g0 + %g0]ASI_SCRATCHPAD, reg;
#define GET_PCPU_PHYS_SCRATCH(tmp) \
sethi %uhi(VM_MIN_DIRECT_ADDRESS), tmp; \
mov SCRATCH_REG_PCPU, PCPU_REG; \
sllx tmp, 32, tmp; \
ldxa [%g0 + PCPU_REG]ASI_SCRATCHPAD, PCPU_REG; \
andn PCPU_REG, tmp, PCPU_REG
#define GET_PCPU_SCRATCH \
mov SCRATCH_REG_PCPU, PCPU_REG; \
ldxa [%g0 + PCPU_REG]ASI_SCRATCHPAD, PCPU_REG;
#define GET_PCPU_SCRATCH_SLOW(reg) \
mov SCRATCH_REG_PCPU, reg; \
ldxa [reg]ASI_SCRATCHPAD, PCPU_REG;
#define GET_HASH_SCRATCH_USER(reg) \
mov SCRATCH_REG_HASH_USER, reg; \
ldxa [%g0 + reg]ASI_SCRATCHPAD, reg;
#define GET_HASH_SCRATCH_KERNEL(reg) \
mov SCRATCH_REG_HASH_KERNEL, reg; \
ldxa [%g0 + reg]ASI_SCRATCHPAD, reg;
#define GET_HASH_PHYS_SCRATCH_USER(tmp, reg) \
sethi %uhi(VM_MIN_DIRECT_ADDRESS), tmp; \
mov SCRATCH_REG_HASH_USER, reg; \
sllx tmp, 32, tmp; \
ldxa [%g0 + reg]ASI_SCRATCHPAD, reg; \
andn reg, tmp, reg;
#define GET_HASH_PHYS_SCRATCH_KERNEL(tmp, reg) \
sethi %uhi(VM_MIN_DIRECT_ADDRESS), tmp; \
mov SCRATCH_REG_HASH_KERNEL, reg; \
sllx tmp, 32, tmp; \
ldxa [%g0 + reg]ASI_SCRATCHPAD, reg; \
andn reg, tmp, reg;
#define GET_TSB_SCRATCH_USER(reg) \
mov SCRATCH_REG_TSB_USER, reg; \
ldxa [%g0 + reg]ASI_SCRATCHPAD, reg;
#define GET_TSB_SCRATCH_KERNEL(reg) \
mov SCRATCH_REG_TSB_KERNEL, reg; \
ldxa [%g0 + reg]ASI_SCRATCHPAD, reg;
#define SET_SCRATCH(offsetreg, reg) stxa reg, [%g0 + offsetreg]ASI_SCRATCHPAD
#define GET_PCB_PHYS(tmp, reg) \
mov PC_CURPCB, reg; \
GET_PCPU_PHYS_SCRATCH(tmp); \
ldxa [PCPU_REG + reg]ASI_REAL, reg; \
sub reg, tmp, reg;
#define GET_PCB(reg) \
GET_PCPU_SCRATCH; \
ldx [PCPU_REG + PC_CURPCB], reg;
#define SET_MMU_CONTEXT(typereg, reg) stxa reg, [typereg]ASI_MMU_CONTEXTID
#define GET_MMU_CONTEXT(typereg, reg) ldxa [typereg]ASI_MMU_CONTEXTID, reg
#define SAVE_GLOBALS(TF) \
stx %g1, [TF + TF_G1]; \
stx %g2, [TF + TF_G2]; \
stx %g3, [TF + TF_G3]; \
stx %g4, [TF + TF_G4]; \
stx %g5, [TF + TF_G5]; \
stx %g6, [TF + TF_G6];
#define RESTORE_GLOBALS_USER(TF) \
ldx [TF + TF_G1], %g1; \
ldx [TF + TF_G2], %g2; \
ldx [TF + TF_G3], %g3; \
ldx [TF + TF_G4], %g4; \
ldx [TF + TF_G5], %g5; \
ldx [TF + TF_G6], %g6; \
ldx [TF + TF_G7], %g7;
#define RESTORE_GLOBALS_KERNEL(TF) \
mov SCRATCH_REG_PCPU, %g7; \
ldx [TF + TF_G1], %g1; \
ldx [TF + TF_G2], %g2; \
ldx [TF + TF_G3], %g3; \
ldx [TF + TF_G4], %g4; \
ldx [TF + TF_G5], %g5; \
ldx [TF + TF_G6], %g6; \
ldxa [%g0 + %g7]ASI_SCRATCHPAD, %g7;
#define SAVE_OUTS(TF) \
stx %i0, [TF + TF_O0]; \
stx %i1, [TF + TF_O1]; \
stx %i2, [TF + TF_O2]; \
stx %i3, [TF + TF_O3]; \
stx %i4, [TF + TF_O4]; \
stx %i5, [TF + TF_O5]; \
stx %i6, [TF + TF_O6]; \
stx %i7, [TF + TF_O7];
#define RESTORE_OUTS(TF) \
ldx [TF + TF_O0], %i0; \
ldx [TF + TF_O1], %i1; \
ldx [TF + TF_O2], %i2; \
ldx [TF + TF_O3], %i3; \
ldx [TF + TF_O4], %i4; \
ldx [TF + TF_O5], %i5; \
ldx [TF + TF_O6], %i6; \
ldx [TF + TF_O7], %i7;
#define SAVE_WINDOW(SBP) \
stx %l0, [SBP + (0*8)]; \
stx %l1, [SBP + (1*8)]; \
stx %l2, [SBP + (2*8)]; \
stx %l3, [SBP + (3*8)]; \
stx %l4, [SBP + (4*8)]; \
stx %l5, [SBP + (5*8)]; \
stx %l6, [SBP + (6*8)]; \
stx %l7, [SBP + (7*8)]; \
stx %i0, [SBP + (8*8)]; \
stx %i1, [SBP + (9*8)]; \
stx %i2, [SBP + (10*8)]; \
stx %i3, [SBP + (11*8)]; \
stx %i4, [SBP + (12*8)]; \
stx %i5, [SBP + (13*8)]; \
stx %i6, [SBP + (14*8)]; \
stx %i7, [SBP + (15*8)];
#define SAVE_WINDOW_ASI(SBP) \
stxa %l0, [SBP + (0*8)]%asi; \
stxa %l1, [SBP + (1*8)]%asi; \
stxa %l2, [SBP + (2*8)]%asi; \
stxa %l3, [SBP + (3*8)]%asi; \
stxa %l4, [SBP + (4*8)]%asi; \
stxa %l5, [SBP + (5*8)]%asi; \
stxa %l6, [SBP + (6*8)]%asi; \
stxa %l7, [SBP + (7*8)]%asi; \
stxa %i0, [SBP + (8*8)]%asi; \
stxa %i1, [SBP + (9*8)]%asi; \
stxa %i2, [SBP + (10*8)]%asi; \
stxa %i3, [SBP + (11*8)]%asi; \
stxa %i4, [SBP + (12*8)]%asi; \
stxa %i5, [SBP + (13*8)]%asi; \
stxa %i6, [SBP + (14*8)]%asi; \
stxa %i7, [SBP + (15*8)]%asi;
#define SAVE_LOCALS_ASI(SBP) \
stxa %l0, [SBP + (0*8)]%asi; \
stxa %l1, [SBP + (1*8)]%asi; \
stxa %l2, [SBP + (2*8)]%asi; \
stxa %l3, [SBP + (3*8)]%asi; \
stxa %l4, [SBP + (4*8)]%asi; \
stxa %l5, [SBP + (5*8)]%asi; \
stxa %l6, [SBP + (6*8)]%asi; \
stxa %l7, [SBP + (7*8)]%asi;
#define RESTORE_LOCALS_ASI(SBP) \
ldxa [SBP + (0*8)]%asi, %l0; \
ldxa [SBP + (1*8)]%asi, %l1; \
ldxa [SBP + (2*8)]%asi, %l2; \
ldxa [SBP + (3*8)]%asi, %l3; \
ldxa [SBP + (4*8)]%asi, %l4; \
ldxa [SBP + (5*8)]%asi, %l5; \
ldxa [SBP + (6*8)]%asi, %l6; \
ldxa [SBP + (7*8)]%asi, %l7;
#endif /* LOCORE */
#endif /* _KERNEL */
#endif /* !_MACHINE_ASMACROS_H_ */

294
sys/sun4v/include/atomic.h Normal file
View File

@ -0,0 +1,294 @@
/*-
* Copyright (c) 1998 Doug Rabson.
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: FreeBSD: src/sys/i386/include/atomic.h,v 1.20 2001/02/11
* $FreeBSD$
*/
#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_
#include <machine/cpufunc.h>
/* Userland needs different ASI's. */
#ifdef _KERNEL
#define __ASI_ATOMIC ASI_N
#else
#define __ASI_ATOMIC ASI_P
#endif
/*
* Various simple arithmetic on memory which is atomic in the presence
* of interrupts and multiple processors. See atomic(9) for details.
* Note that efficient hardware support exists only for the 32 and 64
* bit variants; the 8 and 16 bit versions are not provided and should
* not be used in MI code.
*
* This implementation takes advantage of the fact that the sparc64
* cas instruction is both a load and a store. The loop is often coded
* as follows:
*
* do {
* expect = *p;
* new = expect + 1;
* } while (cas(p, expect, new) != expect);
*
* which performs an unnnecessary load on each iteration that the cas
* operation fails. Modified as follows:
*
* expect = *p;
* for (;;) {
* new = expect + 1;
* result = cas(p, expect, new);
* if (result == expect)
* break;
* expect = result;
* }
*
* the return value of cas is used to avoid the extra reload.
*
* The memory barriers provided by the acq and rel variants are intended
* to be sufficient for use of relaxed memory ordering. Due to the
* suggested assembly syntax of the membar operands containing a #
* character, they cannot be used in macros. The cmask and mmask bits
* are hard coded in machine/cpufunc.h and used here through macros.
* Hopefully sun will choose not to change the bit numbers.
*/
#define itype(sz) uint ## sz ## _t
#define atomic_cas_32(p, e, s) casa(p, e, s, __ASI_ATOMIC)
#define atomic_cas_64(p, e, s) casxa(p, e, s, __ASI_ATOMIC)
#define atomic_cas(p, e, s, sz) \
atomic_cas_ ## sz(p, e, s)
#define atomic_cas_acq(p, e, s, sz) ({ \
itype(sz) v; \
v = atomic_cas(p, e, s, sz); \
membar(LoadLoad | LoadStore); \
v; \
})
#define atomic_cas_rel(p, e, s, sz) ({ \
itype(sz) v; \
membar(LoadStore | StoreStore); \
v = atomic_cas(p, e, s, sz); \
v; \
})
#define atomic_op(p, op, v, sz) ({ \
itype(sz) e, r, s; \
for (e = *(volatile itype(sz) *)p;; e = r) { \
s = e op v; \
r = atomic_cas_ ## sz(p, e, s); \
if (r == e) \
break; \
} \
e; \
})
#define atomic_op_acq(p, op, v, sz) ({ \
itype(sz) t; \
t = atomic_op(p, op, v, sz); \
membar(LoadLoad | LoadStore); \
t; \
})
#define atomic_op_rel(p, op, v, sz) ({ \
itype(sz) t; \
membar(LoadStore | StoreStore); \
t = atomic_op(p, op, v, sz); \
t; \
})
#define atomic_load(p, sz) \
atomic_cas(p, 0, 0, sz)
#define atomic_load_acq(p, sz) ({ \
itype(sz) v; \
v = atomic_load(p, sz); \
membar(LoadLoad | LoadStore); \
v; \
})
#define atomic_load_clear(p, sz) ({ \
itype(sz) e, r; \
for (e = *(volatile itype(sz) *)p;; e = r) { \
r = atomic_cas(p, e, 0, sz); \
if (r == e) \
break; \
} \
e; \
})
#define atomic_store(p, v, sz) do { \
itype(sz) e, r; \
for (e = *(volatile itype(sz) *)p;; e = r) { \
r = atomic_cas(p, e, v, sz); \
if (r == e) \
break; \
} \
} while (0)
#define atomic_store_rel(p, v, sz) do { \
membar(LoadStore | StoreStore); \
atomic_store(p, v, sz); \
} while (0)
#define ATOMIC_GEN(name, ptype, vtype, atype, sz) \
\
static __inline vtype \
atomic_add_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op(p, +, v, sz)); \
} \
static __inline vtype \
atomic_add_acq_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op_acq(p, +, v, sz)); \
} \
static __inline vtype \
atomic_add_rel_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op_rel(p, +, v, sz)); \
} \
\
static __inline vtype \
atomic_clear_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op(p, &, ~v, sz)); \
} \
static __inline vtype \
atomic_clear_acq_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op_acq(p, &, ~v, sz)); \
} \
static __inline vtype \
atomic_clear_rel_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op_rel(p, &, ~v, sz)); \
} \
\
static __inline int \
atomic_cmpset_ ## name(volatile ptype p, vtype e, vtype s) \
{ \
return (((vtype)atomic_cas(p, e, s, sz)) == e); \
} \
static __inline int \
atomic_cmpset_acq_ ## name(volatile ptype p, vtype e, vtype s) \
{ \
return (((vtype)atomic_cas_acq(p, e, s, sz)) == e); \
} \
static __inline int \
atomic_cmpset_rel_ ## name(volatile ptype p, vtype e, vtype s) \
{ \
return (((vtype)atomic_cas_rel(p, e, s, sz)) == e); \
} \
\
static __inline vtype \
atomic_load_ ## name(volatile ptype p) \
{ \
return ((vtype)atomic_cas(p, 0, 0, sz)); \
} \
static __inline vtype \
atomic_load_acq_ ## name(volatile ptype p) \
{ \
return ((vtype)atomic_cas_acq(p, 0, 0, sz)); \
} \
\
static __inline vtype \
atomic_readandclear_ ## name(volatile ptype p) \
{ \
return ((vtype)atomic_load_clear(p, sz)); \
} \
\
static __inline vtype \
atomic_set_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op(p, |, v, sz)); \
} \
static __inline vtype \
atomic_set_acq_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op_acq(p, |, v, sz)); \
} \
static __inline vtype \
atomic_set_rel_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op_rel(p, |, v, sz)); \
} \
\
static __inline vtype \
atomic_subtract_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op(p, -, v, sz)); \
} \
static __inline vtype \
atomic_subtract_acq_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op_acq(p, -, v, sz)); \
} \
static __inline vtype \
atomic_subtract_rel_ ## name(volatile ptype p, atype v) \
{ \
return ((vtype)atomic_op_rel(p, -, v, sz)); \
} \
\
static __inline void \
atomic_store_ ## name(volatile ptype p, vtype v) \
{ \
atomic_store(p, v, sz); \
} \
static __inline void \
atomic_store_rel_ ## name(volatile ptype p, vtype v) \
{ \
atomic_store_rel(p, v, sz); \
}
ATOMIC_GEN(int, u_int *, u_int, u_int, 32);
ATOMIC_GEN(32, uint32_t *, uint32_t, uint32_t, 32);
ATOMIC_GEN(long, u_long *, u_long, u_long, 64);
ATOMIC_GEN(64, uint64_t *, uint64_t, uint64_t, 64);
ATOMIC_GEN(ptr, uintptr_t *, uintptr_t, uintptr_t, 64);
#define atomic_fetchadd_int atomic_add_int
#define atomic_fetchadd_32 atomic_add_32
#undef ATOMIC_GEN
#undef atomic_cas
#undef atomic_cas_acq
#undef atomic_cas_rel
#undef atomic_op
#undef atomic_op_acq
#undef atomic_op_rel
#undef atomic_load_acq
#undef atomic_store_rel
#undef atomic_load_clear
#endif /* !_MACHINE_ATOMIC_H_ */

895
sys/sun4v/include/bus.h Normal file
View File

@ -0,0 +1,895 @@
/*-
* Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1997-1999 Eduardo E. Horvath. All rights reserved.
* Copyright (c) 1996 Charles M. Hannum. All rights reserved.
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* from: NetBSD: bus.h,v 1.28 2001/07/19 15:32:19 thorpej Exp
* and
* from: FreeBSD: src/sys/alpha/include/bus.h,v 1.9 2001/01/09
*
* $FreeBSD$
*/
#ifndef _MACHINE_BUS_H_
#define _MACHINE_BUS_H_
#ifdef BUS_SPACE_DEBUG
#include <sys/ktr.h>
#endif
#include <machine/_bus.h>
#include <machine/cpufunc.h>
#include <machine/upa.h>
/*
* UPA and SBUS spaces are non-cached and big endian
* (except for RAM and PROM)
*
* PCI spaces are non-cached and little endian
*/
#define UPA_BUS_SPACE 0
#define SBUS_BUS_SPACE 1
#define PCI_CONFIG_BUS_SPACE 2
#define PCI_IO_BUS_SPACE 3
#define PCI_MEMORY_BUS_SPACE 4
#define LAST_BUS_SPACE 5
extern int bus_type_asi[];
extern int bus_stream_asi[];
#define __BUS_SPACE_HAS_STREAM_METHODS 1
#define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
#define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFF
#define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF
#define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
#define BUS_SPACE_MAXADDR 0xFFFFFFFF
#define BUS_SPACE_UNRESTRICTED (~0)
/*
* Access methods for bus resources and address space.
*/
struct bus_space_tag {
void *bst_cookie;
bus_space_tag_t bst_parent;
int bst_type;
void (*bst_bus_barrier)(bus_space_tag_t, bus_space_handle_t,
bus_size_t, bus_size_t, int);
};
/*
* Bus space function prototypes.
*/
static void bus_space_barrier(bus_space_tag_t, bus_space_handle_t, bus_size_t,
bus_size_t, int);
static int bus_space_subregion(bus_space_tag_t, bus_space_handle_t,
bus_size_t, bus_size_t, bus_space_handle_t *);
/*
* Map a region of device bus space into CPU virtual address space.
*/
static __inline int bus_space_map(bus_space_tag_t t, bus_addr_t addr,
bus_size_t size, int flags,
bus_space_handle_t *bshp);
static __inline int
bus_space_map(bus_space_tag_t t __unused, bus_addr_t addr,
bus_size_t size __unused, int flags __unused,
bus_space_handle_t *bshp)
{
*bshp = addr;
return (0);
}
/*
* Unmap a region of device bus space.
*/
static __inline void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh,
bus_size_t size);
static __inline void
bus_space_unmap(bus_space_tag_t t __unused, bus_space_handle_t bsh __unused,
bus_size_t size __unused)
{
}
/* This macro finds the first "upstream" implementation of method `f' */
#define _BS_CALL(t,f) \
while (t->f == NULL) \
t = t->bst_parent; \
return (*(t)->f)
static __inline void
bus_space_barrier(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
bus_size_t s, int f)
{
_BS_CALL(t, bst_bus_barrier)(t, h, o, s, f);
}
static __inline int
bus_space_subregion(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
bus_size_t s, bus_space_handle_t *hp)
{
*hp = h + o;
return (0);
}
/* flags for bus space map functions */
#define BUS_SPACE_MAP_CACHEABLE 0x0001
#define BUS_SPACE_MAP_LINEAR 0x0002
#define BUS_SPACE_MAP_READONLY 0x0004
#define BUS_SPACE_MAP_PREFETCHABLE 0x0008
/* placeholders for bus functions... */
#define BUS_SPACE_MAP_BUS1 0x0100
#define BUS_SPACE_MAP_BUS2 0x0200
#define BUS_SPACE_MAP_BUS3 0x0400
#define BUS_SPACE_MAP_BUS4 0x0800
/* flags for bus_space_barrier() */
#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
#ifdef BUS_SPACE_DEBUG
#define KTR_BUS KTR_CT2
#define BUS_HANDLE_MIN UPA_MEMSTART
#define __BUS_DEBUG_ACCESS(h, o, desc, sz) do { \
CTR4(KTR_BUS, "bus space: %s %d: handle %#lx, offset %#lx", \
(desc), (sz), (h), (o)); \
if ((h) + (o) < BUS_HANDLE_MIN) \
panic("bus space access at %#lx out of range", \
(h) + (o)); \
} while (0)
#else
#define __BUS_DEBUG_ACCESS(h, o, desc, sz)
#endif
static __inline uint8_t
bus_space_read_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
__BUS_DEBUG_ACCESS(h, o, "read", 1);
return (lduba_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
}
static __inline uint16_t
bus_space_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
__BUS_DEBUG_ACCESS(h, o, "read", 2);
return (lduha_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
}
static __inline uint32_t
bus_space_read_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
__BUS_DEBUG_ACCESS(h, o, "read", 4);
return (lduwa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
}
static __inline uint64_t
bus_space_read_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
__BUS_DEBUG_ACCESS(h, o, "read", 8);
return (ldxa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type]));
}
static __inline void
bus_space_read_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint8_t *a, size_t c)
{
while (c-- > 0)
*a++ = bus_space_read_1(t, h, o);
}
static __inline void
bus_space_read_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint16_t *a, size_t c)
{
while (c-- > 0)
*a++ = bus_space_read_2(t, h, o);
}
static __inline void
bus_space_read_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint32_t *a, size_t c)
{
while (c-- > 0)
*a++ = bus_space_read_4(t, h, o);
}
static __inline void
bus_space_read_multi_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint64_t *a, size_t c)
{
while (c-- > 0)
*a++ = bus_space_read_8(t, h, o);
}
static __inline void
bus_space_write_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint8_t v)
{
__BUS_DEBUG_ACCESS(h, o, "write", 1);
stba_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
}
static __inline void
bus_space_write_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint16_t v)
{
__BUS_DEBUG_ACCESS(h, o, "write", 2);
stha_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
}
static __inline void
bus_space_write_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint32_t v)
{
__BUS_DEBUG_ACCESS(h, o, "write", 4);
stwa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
}
static __inline void
bus_space_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint64_t v)
{
__BUS_DEBUG_ACCESS(h, o, "write", 8);
stxa_nc((caddr_t)(h + o), bus_type_asi[t->bst_type], v);
}
static __inline void
bus_space_write_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint8_t *a, size_t c)
{
while (c-- > 0)
bus_space_write_1(t, h, o, *a++);
}
static __inline void
bus_space_write_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint16_t *a, size_t c)
{
while (c-- > 0)
bus_space_write_2(t, h, o, *a++);
}
static __inline void
bus_space_write_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint32_t *a, size_t c)
{
while (c-- > 0)
bus_space_write_4(t, h, o, *a++);
}
static __inline void
bus_space_write_multi_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint64_t *a, size_t c)
{
while (c-- > 0)
bus_space_write_8(t, h, o, *a++);
}
static __inline void
bus_space_set_multi_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint8_t v, size_t c)
{
while (c-- > 0)
bus_space_write_1(t, h, o, v);
}
static __inline void
bus_space_set_multi_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint16_t v, size_t c)
{
while (c-- > 0)
bus_space_write_2(t, h, o, v);
}
static __inline void
bus_space_set_multi_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint32_t v, size_t c)
{
while (c-- > 0)
bus_space_write_4(t, h, o, v);
}
static __inline void
bus_space_set_multi_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint64_t v, size_t c)
{
while (c-- > 0)
bus_space_write_8(t, h, o, v);
}
static __inline void
bus_space_read_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
u_int8_t *a, bus_size_t c)
{
for (; c; a++, c--, o++)
*a = bus_space_read_1(t, h, o);
}
static __inline void
bus_space_read_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
u_int16_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=2)
*a = bus_space_read_2(t, h, o);
}
static __inline void
bus_space_read_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
u_int32_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=4)
*a = bus_space_read_4(t, h, o);
}
static __inline void
bus_space_read_region_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
u_int64_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=8)
*a = bus_space_read_8(t, h, o);
}
static __inline void
bus_space_write_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
const u_int8_t *a, bus_size_t c)
{
for (; c; a++, c--, o++)
bus_space_write_1(t, h, o, *a);
}
static __inline void
bus_space_write_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
const u_int16_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=2)
bus_space_write_2(t, h, o, *a);
}
static __inline void
bus_space_write_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
const u_int32_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=4)
bus_space_write_4(t, h, o, *a);
}
static __inline void
bus_space_write_region_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
const u_int64_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=8)
bus_space_write_8(t, h, o, *a);
}
static __inline void
bus_space_set_region_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
const u_int8_t v, bus_size_t c)
{
for (; c; c--, o++)
bus_space_write_1(t, h, o, v);
}
static __inline void
bus_space_set_region_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
const u_int16_t v, bus_size_t c)
{
for (; c; c--, o+=2)
bus_space_write_2(t, h, o, v);
}
static __inline void
bus_space_set_region_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
const u_int32_t v, bus_size_t c)
{
for (; c; c--, o+=4)
bus_space_write_4(t, h, o, v);
}
static __inline void
bus_space_set_region_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
const u_int64_t v, bus_size_t c)
{
for (; c; c--, o+=8)
bus_space_write_8(t, h, o, v);
}
static __inline void
bus_space_copy_region_1(bus_space_tag_t t, bus_space_handle_t h1,
bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
for (; c; c--, o1++, o2++)
bus_space_write_1(t, h1, o1, bus_space_read_1(t, h2, o2));
}
static __inline void
bus_space_copy_region_2(bus_space_tag_t t, bus_space_handle_t h1,
bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
for (; c; c--, o1+=2, o2+=2)
bus_space_write_2(t, h1, o1, bus_space_read_2(t, h2, o2));
}
static __inline void
bus_space_copy_region_4(bus_space_tag_t t, bus_space_handle_t h1,
bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
for (; c; c--, o1+=4, o2+=4)
bus_space_write_4(t, h1, o1, bus_space_read_4(t, h2, o2));
}
static __inline void
bus_space_copy_region_8(bus_space_tag_t t, bus_space_handle_t h1,
bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
for (; c; c--, o1+=8, o2+=8)
bus_space_write_8(t, h1, o1, bus_space_read_8(t, h2, o2));
}
static __inline uint8_t
bus_space_read_stream_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
__BUS_DEBUG_ACCESS(h, o, "read stream", 1);
return (lduba_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
}
static __inline uint16_t
bus_space_read_stream_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
__BUS_DEBUG_ACCESS(h, o, "read stream", 2);
return (lduha_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
}
static __inline uint32_t
bus_space_read_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
__BUS_DEBUG_ACCESS(h, o, "read stream", 4);
return (lduwa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
}
static __inline uint64_t
bus_space_read_stream_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
{
__BUS_DEBUG_ACCESS(h, o, "read stream", 8);
return (ldxa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type]));
}
static __inline void
bus_space_read_multi_stream_1(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, uint8_t *a, size_t c)
{
while (c-- > 0)
*a++ = bus_space_read_stream_1(t, h, o);
}
static __inline void
bus_space_read_multi_stream_2(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, uint16_t *a, size_t c)
{
while (c-- > 0)
*a++ = bus_space_read_stream_2(t, h, o);
}
static __inline void
bus_space_read_multi_stream_4(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, uint32_t *a, size_t c)
{
while (c-- > 0)
*a++ = bus_space_read_stream_4(t, h, o);
}
static __inline void
bus_space_read_multi_stream_8(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, uint64_t *a, size_t c)
{
while (c-- > 0)
*a++ = bus_space_read_stream_8(t, h, o);
}
static __inline void
bus_space_write_stream_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint8_t v)
{
__BUS_DEBUG_ACCESS(h, o, "write stream", 1);
stba_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
}
static __inline void
bus_space_write_stream_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint16_t v)
{
__BUS_DEBUG_ACCESS(h, o, "write stream", 2);
stha_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
}
static __inline void
bus_space_write_stream_4(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint32_t v)
{
__BUS_DEBUG_ACCESS(h, o, "write stream", 4);
stwa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
}
static __inline void
bus_space_write_stream_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o,
uint64_t v)
{
__BUS_DEBUG_ACCESS(h, o, "write stream", 8);
stxa_nc((caddr_t)(h + o), bus_stream_asi[t->bst_type], v);
}
static __inline void
bus_space_write_multi_stream_1(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const uint8_t *a, size_t c)
{
while (c-- > 0)
bus_space_write_stream_1(t, h, o, *a++);
}
static __inline void
bus_space_write_multi_stream_2(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const uint16_t *a, size_t c)
{
while (c-- > 0)
bus_space_write_stream_2(t, h, o, *a++);
}
static __inline void
bus_space_write_multi_stream_4(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const uint32_t *a, size_t c)
{
while (c-- > 0)
bus_space_write_stream_4(t, h, o, *a++);
}
static __inline void
bus_space_write_multi_stream_8(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const uint64_t *a, size_t c)
{
while (c-- > 0)
bus_space_write_stream_8(t, h, o, *a++);
}
static __inline void
bus_space_set_multi_stream_1(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, uint8_t v, size_t c)
{
while (c-- > 0)
bus_space_write_stream_1(t, h, o, v);
}
static __inline void
bus_space_set_multi_stream_2(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, uint16_t v, size_t c)
{
while (c-- > 0)
bus_space_write_stream_2(t, h, o, v);
}
static __inline void
bus_space_set_multi_stream_4(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, uint32_t v, size_t c)
{
while (c-- > 0)
bus_space_write_stream_4(t, h, o, v);
}
static __inline void
bus_space_set_multi_stream_8(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, uint64_t v, size_t c)
{
while (c-- > 0)
bus_space_write_stream_8(t, h, o, v);
}
static __inline void
bus_space_read_region_stream_1(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, u_int8_t *a, bus_size_t c)
{
for (; c; a++, c--, o++)
*a = bus_space_read_stream_1(t, h, o);
}
static __inline void
bus_space_read_region_stream_2(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, u_int16_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=2)
*a = bus_space_read_stream_2(t, h, o);
}
static __inline void
bus_space_read_region_stream_4(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, u_int32_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=4)
*a = bus_space_read_stream_4(t, h, o);
}
static __inline void
bus_space_read_region_stream_8(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, u_int64_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=8)
*a = bus_space_read_stream_8(t, h, o);
}
static __inline void
bus_space_write_region_stream_1(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const u_int8_t *a, bus_size_t c)
{
for (; c; a++, c--, o++)
bus_space_write_stream_1(t, h, o, *a);
}
static __inline void
bus_space_write_region_stream_2(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const u_int16_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=2)
bus_space_write_stream_2(t, h, o, *a);
}
static __inline void
bus_space_write_region_stream_4(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const u_int32_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=4)
bus_space_write_stream_4(t, h, o, *a);
}
static __inline void
bus_space_write_region_stream_8(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const u_int64_t *a, bus_size_t c)
{
for (; c; a++, c--, o+=8)
bus_space_write_stream_8(t, h, o, *a);
}
static __inline void
bus_space_set_region_stream_1(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const u_int8_t v, bus_size_t c)
{
for (; c; c--, o++)
bus_space_write_stream_1(t, h, o, v);
}
static __inline void
bus_space_set_region_stream_2(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const u_int16_t v, bus_size_t c)
{
for (; c; c--, o+=2)
bus_space_write_stream_2(t, h, o, v);
}
static __inline void
bus_space_set_region_stream_4(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const u_int32_t v, bus_size_t c)
{
for (; c; c--, o+=4)
bus_space_write_stream_4(t, h, o, v);
}
static __inline void
bus_space_set_region_stream_8(bus_space_tag_t t, bus_space_handle_t h,
bus_size_t o, const u_int64_t v, bus_size_t c)
{
for (; c; c--, o+=8)
bus_space_write_stream_8(t, h, o, v);
}
static __inline void
bus_space_copy_region_stream_1(bus_space_tag_t t, bus_space_handle_t h1,
bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
for (; c; c--, o1++, o2++)
bus_space_write_stream_1(t, h1, o1, bus_space_read_stream_1(t, h2,
o2));
}
static __inline void
bus_space_copy_region_stream_2(bus_space_tag_t t, bus_space_handle_t h1,
bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
for (; c; c--, o1+=2, o2+=2)
bus_space_write_stream_2(t, h1, o1, bus_space_read_stream_2(t, h2,
o2));
}
static __inline void
bus_space_copy_region_stream_4(bus_space_tag_t t, bus_space_handle_t h1,
bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
for (; c; c--, o1+=4, o2+=4)
bus_space_write_stream_4(t, h1, o1, bus_space_read_stream_4(t, h2,
o2));
}
static __inline void
bus_space_copy_region_stream_8(bus_space_tag_t t, bus_space_handle_t h1,
bus_size_t o1, bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
for (; c; c--, o1+=8, o2+=8)
bus_space_write_stream_8(t, h1, o1, bus_space_read_8(t, h2, o2));
}
/* Back-compat functions for old ISA drivers */
extern bus_space_tag_t isa_io_bt;
extern bus_space_handle_t isa_io_hdl;
extern bus_space_tag_t isa_mem_bt;
extern bus_space_handle_t isa_mem_hdl;
#define inb(o) bus_space_read_1(isa_io_bt, isa_io_hdl, o)
#define inw(o) bus_space_read_2(isa_io_bt, isa_io_hdl, o)
#define inl(o) bus_space_read_4(isa_io_bt, isa_io_hdl, o)
#define outb(o, v) bus_space_write_1(isa_io_bt, isa_io_hdl, o, v)
#define outw(o, v) bus_space_write_2(isa_io_bt, isa_io_hdl, o, v)
#define outl(o, v) bus_space_write_4(isa_io_bt, isa_io_hdl, o, v)
#define readb(o) bus_space_read_1(isa_mem_bt, isa_mem_hdl, o)
#define readw(o) bus_space_read_2(isa_mem_bt, isa_mem_hdl, o)
#define readl(o) bus_space_read_4(isa_mem_bt, isa_mem_hdl, o)
#define writeb(o, v) bus_space_write_1(isa_mem_bt, isa_mem_hdl, o, v)
#define writew(o, v) bus_space_write_2(isa_mem_bt, isa_mem_hdl, o, v)
#define writel(o, v) bus_space_write_4(isa_mem_bt, isa_mem_hdl, o, v)
#define insb(o, a, c) \
bus_space_read_multi_1(isa_io_bt, isa_io_hdl, o, (void*)a, c)
#define insw(o, a, c) \
bus_space_read_multi_2(isa_io_bt, isa_io_hdl, o, (void*)a, c)
#define insl(o, a, c) \
bus_space_read_multi_4(isa_io_bt, isa_io_hdl, o, (void*)a, c)
#define outsb(o, a, c) \
bus_space_write_multi_1(isa_io_bt, isa_io_hdl, o, (void*)a, c)
#define outsw(o, a, c) \
bus_space_write_multi_2(isa_io_bt, isa_io_hdl, o, (void*)a, c)
#define outsl(o, a, c) \
bus_space_write_multi_4(isa_io_bt, isa_io_hdl, o, (void*)a, c)
#define memcpy_fromio(d, s, c) \
bus_space_read_region_1(isa_mem_bt, isa_mem_hdl, s, d, c)
#define memcpy_toio(d, s, c) \
bus_space_write_region_1(isa_mem_bt, isa_mem_hdl, d, s, c)
#define memcpy_io(d, s, c) \
bus_space_copy_region_1(isa_mem_bt, isa_mem_hdl, s, isa_mem_hdl, d, c)
#define memset_io(d, v, c) \
bus_space_set_region_1(isa_mem_bt, isa_mem_hdl, d, v, c)
#define memsetw_io(d, v, c) \
bus_space_set_region_2(isa_mem_bt, isa_mem_hdl, d, v, c)
static __inline void
memsetw(void *d, int val, size_t size)
{
u_int16_t *sp = d;
while (size--)
*sp++ = val;
}
#include <machine/bus_dma.h>
#endif /* !_MACHINE_BUS_H_ */

View File

@ -0,0 +1,65 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* form: @(#)sbusreg.h 8.1 (Berkeley) 6/11/93
* from: NetBSD: iommureg.h,v 1.6 2001/07/20 00:07:13 eeh Exp
*
* $FreeBSD$
*/
#ifndef _MACHINE_BUS_COMMON_H_
#define _MACHINE_BUS_COMMON_H_
#define INTMAP_V 0x080000000LL /* Interrupt valid (enabled) */
#define INTMAP_TID_MASK 0x07c000000LL /* UPA target ID */
#define INTMAP_TID_SHIFT 26
#define INTMAP_IGN_MASK 0x0000007c0LL /* Interrupt group no. */
#define INTMAP_IGN_SHIFT 6
#define INTMAP_INO_MASK 0x00000003fLL /* Interrupt number */
#define INTMAP_INR_MASK (INTMAP_IGN_MASK | INTMAP_INO_MASK)
#define INTMAP_SBUSSLOT_MASK 0x000000018LL /* SBUS slot # */
#define INTMAP_PCIBUS_MASK 0x000000010LL /* PCI bus number (A or B) */
#define INTMAP_PCISLOT_MASK 0x00000000cLL /* PCI slot # */
#define INTMAP_PCIINT_MASK 0x000000003LL /* PCI interrupt #A,#B,#C,#D */
#define INTMAP_OBIO_MASK 0x000000020LL /* Onboard device */
#define INTVEC(x) ((x) & INTMAP_INR_MASK)
#define INTSLOT(x) (((x) >> 3) & 0x7)
#define INTPRI(x) ((x) & 0x7)
#define INTINO(x) ((x) & INTMAP_INO_MASK)
#define INTMAP_ENABLE(mr, mid) \
(((mr) & ~INTMAP_TID_MASK) | ((mid) << INTMAP_TID_SHIFT) | INTMAP_V)
/* counter-timer support. */
void sparc64_counter_init(bus_space_tag_t tag, bus_space_handle_t handle,
bus_addr_t offset);
#endif /* !_MACHINE_BUS_COMMON_H_ */

152
sys/sun4v/include/bus_dma.h Normal file
View File

@ -0,0 +1,152 @@
/*-
* Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1997-1999 Eduardo E. Horvath. All rights reserved.
* Copyright (c) 1996 Charles M. Hannum. All rights reserved.
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* from: NetBSD: bus.h,v 1.28 2001/07/19 15:32:19 thorpej Exp
* and
* from: FreeBSD: src/sys/alpha/include/bus.h,v 1.9 2001/01/09
*
* $FreeBSD$
*/
#ifndef _SPARC64_BUS_DMA_H
#define _SPARC64_BUS_DMA_H
#include <sys/bus_dma.h>
/* DMA support */
/*
* Method table for a bus_dma_tag.
*/
struct bus_dma_methods {
int (*dm_dmamap_create)(bus_dma_tag_t, int, bus_dmamap_t *);
int (*dm_dmamap_destroy)(bus_dma_tag_t, bus_dmamap_t);
int (*dm_dmamap_load)(bus_dma_tag_t, bus_dmamap_t, void *,
bus_size_t, bus_dmamap_callback_t *, void *, int);
int (*dm_dmamap_load_mbuf)(bus_dma_tag_t, bus_dmamap_t,
struct mbuf *, bus_dmamap_callback2_t *, void *, int);
int (*dm_dmamap_load_mbuf_sg)(bus_dma_tag_t, bus_dmamap_t,
struct mbuf *, bus_dma_segment_t *segs, int *nsegs, int);
int (*dm_dmamap_load_uio)(bus_dma_tag_t, bus_dmamap_t, struct uio *,
bus_dmamap_callback2_t *, void *, int);
void (*dm_dmamap_unload)(bus_dma_tag_t, bus_dmamap_t);
void (*dm_dmamap_sync)(bus_dma_tag_t, bus_dmamap_t,
bus_dmasync_op_t);
int (*dm_dmamem_alloc)(bus_dma_tag_t, void **, int, bus_dmamap_t *);
void (*dm_dmamem_free)(bus_dma_tag_t, void *, bus_dmamap_t);
};
/*
* bus_dma_tag_t
*
* A machine-dependent opaque type describing the implementation of
* DMA for a given bus.
*/
struct bus_dma_tag {
void *dt_cookie; /* cookie used in the guts */
bus_dma_tag_t dt_parent;
bus_size_t dt_alignment;
bus_size_t dt_boundary;
bus_addr_t dt_lowaddr;
bus_addr_t dt_highaddr;
bus_dma_filter_t *dt_filter;
void *dt_filterarg;
bus_size_t dt_maxsize;
int dt_nsegments;
bus_size_t dt_maxsegsz;
int dt_flags;
int dt_ref_count;
int dt_map_count;
bus_dma_lock_t *dt_lockfunc;
void * *dt_lockfuncarg;
bus_dma_segment_t *dt_segments;
struct bus_dma_methods *dt_mt;
};
#define bus_dmamap_create(t, f, p) \
((t)->dt_mt->dm_dmamap_create((t), (f), (p)))
#define bus_dmamap_destroy(t, p) \
((t)->dt_mt->dm_dmamap_destroy((t), (p)))
#define bus_dmamap_load(t, m, p, s, cb, cba, f) \
((t)->dt_mt->dm_dmamap_load((t), (m), (p), (s), (cb), (cba), (f)))
#define bus_dmamap_load_mbuf(t, m, mb, cb, cba, f) \
((t)->dt_mt->dm_dmamap_load_mbuf((t), (m), (mb), (cb), (cba), (f)))
#define bus_dmamap_load_mbuf_sg(t, m, mb, segs, nsegs, f) \
((t)->dt_mt->dm_dmamap_load_mbuf_sg((t), (m), (mb), (segs), (nsegs), (f)))
#define bus_dmamap_load_uio(t, m, ui, cb, cba, f) \
((t)->dt_mt->dm_dmamap_load_uio((t), (m), (ui), (cb), (cba), (f)))
#define bus_dmamap_unload(t, p) \
((t)->dt_mt->dm_dmamap_unload((t), (p)))
#define bus_dmamap_sync(t, m, op) \
((t)->dt_mt->dm_dmamap_sync((t), (m), (op)))
#define bus_dmamem_alloc(t, v, f, m) \
((t)->dt_mt->dm_dmamem_alloc((t), (v), (f), (m)))
#define bus_dmamem_free(t, v, m) \
((t)->dt_mt->dm_dmamem_free((t), (v), (m)))
#endif /* !_SPARC64_BUS_DMA_H_ */

View File

@ -0,0 +1,84 @@
/*-
* Copyright (c) 1997, 1998 Justin T. Gibbs.
* Copyright (c) 2002 by Thomas Moestl <tmm@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* from: FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.25 2002/01/05
*
* $FreeBSD$
*/
#ifndef _MACHINE_BUS_PRIVATE_H_
#define _MACHINE_BUS_PRIVATE_H_
#include <sys/queue.h>
/*
* Helpers
*/
int sparc64_bus_mem_map(bus_space_tag_t, bus_space_handle_t, bus_size_t,
int, vm_offset_t, void **);
int sparc64_bus_mem_unmap(void *, bus_size_t);
bus_space_handle_t sparc64_fake_bustag(int, bus_addr_t, struct bus_space_tag *);
struct bus_dmamap_res {
struct resource *dr_res;
bus_size_t dr_used;
bus_size_t dr_offset;
SLIST_ENTRY(bus_dmamap_res) dr_link;
};
/*
* Callers of the bus_dma interfaces must always protect their tags and maps
* appropriately against concurrent access. However, when a map is on a LRU
* queue, there is a second access path to it; for this case, the locking rules
* are given in the parenthesized comments below:
* q - locked by the mutex protecting the queue.
* p - private to the owner of the map, no access through the queue.
* * - comment refers to pointer target.
* Only the owner of the map is allowed to insert the map into a queue. Removal
* and repositioning (i.e. temporal removal and reinsertion) is allowed to all
* if the queue lock is held.
*/
struct bus_dmamap {
TAILQ_ENTRY(bus_dmamap) dm_maplruq; /* (q) */
SLIST_HEAD(, bus_dmamap_res) dm_reslist; /* (q, *q) */
int dm_onq; /* (q) */
int dm_flags; /* (p) */
};
/* Flag values. */
#define DMF_LOADED 1 /* Map is loaded */
#define DMF_COHERENT 2 /* Coherent mapping requested */
int sparc64_dma_alloc_map(bus_dma_tag_t dmat, bus_dmamap_t *mapp);
void sparc64_dma_free_map(bus_dma_tag_t dmat, bus_dmamap_t map);
/*
* XXX: This is a kluge. It would be better to handle dma tags in a hierarchical
* way, and have a BUS_GET_DMA_TAG(); however, since this is not currently the
* case, save a root tag in the relevant bus attach function and use that.
*/
extern bus_dma_tag_t sparc64_root_dma_tag;
#endif /* !_MACHINE_BUS_PRIVATE_H_ */

117
sys/sun4v/include/cache.h Normal file
View File

@ -0,0 +1,117 @@
/*-
* Copyright (c) 1996
* The President and Fellows of Harvard College. All rights reserved.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Aaron Brown and
* Harvard University.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)cache.h 8.1 (Berkeley) 6/11/93
* from: NetBSD: cache.h,v 1.3 2000/08/01 00:28:02 eeh Exp
*
* $FreeBSD$
*/
#ifndef _MACHINE_CACHE_H_
#define _MACHINE_CACHE_H_
#include <dev/ofw/openfirm.h>
#define DC_TAG_SHIFT 2
#define DC_VALID_SHIFT 0
#define DC_TAG_BITS 28
#define DC_VALID_BITS 2
#define DC_TAG_MASK ((1 << DC_TAG_BITS) - 1)
#define DC_VALID_MASK ((1 << DC_VALID_BITS) - 1)
#define IC_TAG_SHIFT 7
#define IC_VALID_SHIFT 36
#define IC_TAG_BITS 28
#define IC_VALID_BITS 1
#define IC_TAG_MASK ((1 << IC_TAG_BITS) - 1)
#define IC_VALID_MASK ((1 << IC_VALID_BITS) - 1)
/*
* Cache control information.
*/
struct cacheinfo {
u_int c_enabled; /* true => cache is enabled */
u_int ic_size; /* instruction cache */
u_int ic_set;
u_int ic_l2set;
u_int ic_assoc;
u_int ic_linesize;
u_int dc_size; /* data cache */
u_int dc_l2size;
u_int dc_assoc;
u_int dc_linesize;
u_int ec_size; /* external cache info */
u_int ec_assoc;
u_int ec_l2set;
u_int ec_linesize;
u_int ec_l2linesize;
};
#ifdef _KERNEL
typedef void cache_enable_t(void);
typedef void cache_flush_t(void);
typedef void dcache_page_inval_t(vm_paddr_t pa);
typedef void icache_page_inval_t(vm_paddr_t pa);
void cache_init(phandle_t node);
cache_enable_t cheetah_cache_enable;
cache_flush_t cheetah_cache_flush;
dcache_page_inval_t cheetah_dcache_page_inval;
icache_page_inval_t cheetah_icache_page_inval;
cache_enable_t spitfire_cache_enable;
cache_flush_t spitfire_cache_flush;
dcache_page_inval_t spitfire_dcache_page_inval;
icache_page_inval_t spitfire_icache_page_inval;
extern cache_enable_t *cache_enable;
extern cache_flush_t *cache_flush;
extern dcache_page_inval_t *dcache_page_inval;
extern icache_page_inval_t *icache_page_inval;
extern struct cacheinfo cache;
#endif
#endif /* !_MACHINE_CACHE_H_ */

46
sys/sun4v/include/ccr.h Normal file
View File

@ -0,0 +1,46 @@
/*-
* Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_CCR_H_
#define _MACHINE_CCR_H_
#define ICC_SHIFT 0
#define ICC_BITS 4
#define ICC_MASK ((1UL << ICC_BITS) - 1)
#define ICC_C (1UL << 0)
#define ICC_V (1UL << 1)
#define ICC_Z (1UL << 2)
#define ICC_N (1UL << 3)
#define XCC_SHIFT 4
#define XCC_BITS 4
#define XCC_MASK (((1UL << XCC_BITS) - 1) << XCC_SHIFT)
#define XCC_C (1UL << 4)
#define XCC_V (1UL << 5)
#define XCC_Z (1UL << 6)
#define XCC_N (1UL << 7)
#endif /* !_MACHINE_CCR_H_ */

View File

@ -0,0 +1,214 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
* $FreeBSD$
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MDESC_H_
#define _MDESC_H_
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Each logical domain is detailed via a (Virtual) Machine Description
* available to each guest Operating System courtesy of a
* Hypervisor service.
*/
#ifdef _ASM
#define U8(_s) _s
#define U16(_s) _s
#define U32(_s) _s
#define U64(_s) _s
#else
#define U8(_s) ((uint8_t)(_s))
#define U16(_s) ((uint16_t)(_s))
#define U32(_s) ((uint32_t)(_s))
#define U64(_s) ((uint64_t)(_s))
#endif
/* the version this library understands */
#define MD_HEADER_VERS_OFF 0x0
#define MD_HEADER_NODE_OFF 0x4
#define MD_HEADER_NAME_OFF 0x8
#define MD_HEADER_DATA_OFF 0xc
#define MD_HEADER_SIZE 0x10
#define MD_TRANSPORT_VERSION U32(0x10000)
#define MD_ELEMENT_SIZE 0x10
#define MDE_ILLEGAL_IDX U64(-1)
#define MDET_LIST_END U8(0x0)
#define MDET_NULL U8(' ')
#define MDET_NODE U8('N')
#define MDET_NODE_END U8('E')
#define MDET_PROP_ARC U8('a')
#define MDET_PROP_VAL U8('v')
#define MDET_PROP_STR U8('s')
#define MDET_PROP_DAT U8('d')
#ifndef _ASM /* { */
/*
* Opaque handles for use in external interfaces
*/
typedef void *md_t;
typedef uint64_t mde_cookie_t;
#define MDE_INVAL_ELEM_COOKIE ((mde_cookie_t)-1)
typedef uint32_t mde_str_cookie_t;
#define MDE_INVAL_STR_COOKIE ((mde_str_cookie_t)-1)
typedef uint64_t md_diff_cookie_t;
#define MD_INVAL_DIFF_COOKIE ((md_diff_cookie_t)-1)
#define MDESC_INVAL_GEN (0)
/*
* External structure for MD diff interface
*/
typedef struct {
uint8_t type; /* property type */
char *namep; /* property name */
} md_prop_match_t;
/*
* External Interface
*/
extern md_t *md_init_intern(uint64_t *,
void *(*allocp)(size_t),
void (*freep)(void *, size_t));
extern int md_fini(md_t *);
extern int md_node_count(md_t *);
extern mde_str_cookie_t md_find_name(md_t *, char *namep);
extern mde_cookie_t md_root_node(md_t *);
extern uint64_t md_get_gen(md_t *);
extern size_t md_get_bin_size(md_t *);
extern int md_scan_dag(md_t *,
mde_cookie_t,
mde_str_cookie_t,
mde_str_cookie_t,
mde_cookie_t *);
extern int md_get_prop_val(md_t *,
mde_cookie_t,
char *,
uint64_t *);
extern int md_get_prop_str(md_t *,
mde_cookie_t,
char *,
char **);
extern int md_get_prop_data(md_t *,
mde_cookie_t,
char *,
uint8_t **,
int *);
extern md_diff_cookie_t md_diff_init(md_t *,
mde_cookie_t,
md_t *,
mde_cookie_t,
char *,
md_prop_match_t *);
extern int md_diff_added(md_diff_cookie_t,
mde_cookie_t **);
extern int md_diff_removed(md_diff_cookie_t,
mde_cookie_t **);
extern int md_diff_matched(md_diff_cookie_t,
mde_cookie_t **,
mde_cookie_t **);
extern int md_diff_fini(md_diff_cookie_t);
/***************** NON-CDDL BEGIN *******************************/
#include <sys/malloc.h>
extern int md_get_prop_alloc(md_t *, mde_cookie_t, char *,
int, uint8_t **);
extern int md_vdev_find_val(device_t dev, char *namep,
uint64_t *valp);
MALLOC_DECLARE(M_MDPROP);
extern void mdesc_init(void);
extern int mdesc_update(void);
extern md_t * md_get(void);
extern void md_put(md_t *);
/***************** NON-CDDL END *******************************/
#endif /* } _ASM */
/*
* ioctl info for mdesc device
*/
#define MDESCIOC ('m' << 24 | 'd' << 16 | 'd' << 8)
#define MDESCIOCGSZ (MDESCIOC | 1) /* Get quote buffer size */
#define MDESCIOCSSZ (MDESCIOC | 2) /* Set new quote buffer size */
#define MDESCIOCDISCARD (MDESCIOC | 3) /* Discard quotes and reset */
#ifdef __cplusplus
}
#endif
#endif /* _MDESC_H_ */

View File

@ -0,0 +1,162 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
* $FreeBSD$
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MDESC_IMPL_H_
#define _MDESC_IMPL_H_
#ifdef __cplusplus
extern "C" {
#endif
#define LIBMD_MAGIC 0x4d61636844657363ULL /* MachDesc */
#ifndef _ASM
/*
* Internal definitions
*/
/*
* Each MD has the following header to
* provide information about each section of the MD.
*
* There are 3 sections:
* The description list, the name table and the data block.
*
* All values are stored in network byte order.
*
* Elements in the first (description list) section are defined by their
* index location within the node block. An index is simply the byte offset
* within the block / element size (16bytes). All elements are refered to
* by their index, to avoid bugs related to alignment etc.
*
* The name_len field holds the storage length of an ASCII name, NOT the strlen.
* The header fields are written in network
* byte order.
*/
struct md_header_s {
uint32_t transport_version;
uint32_t node_blk_sz; /* size in bytes of the node block */
uint32_t name_blk_sz; /* size in bytes of the name block */
uint32_t data_blk_sz; /* size in bytes of the data block */
};
typedef struct md_header_s md_header_t;
#if defined(_BIG_ENDIAN) && !defined(lint)
#define mdtoh8(x) ((uint8_t)(x))
#define mdtoh16(x) ((uint16_t)(x))
#define mdtoh32(x) ((uint32_t)(x))
#define mdtoh64(x) ((uint64_t)(x))
#define htomd8(x) (x)
#define htomd16(x) (x)
#define htomd32(x) (x)
#define htomd64(x) (x)
#else
#define mdtoh8(x) ((uint8_t)(x))
extern uint16_t mdtoh16(uint16_t);
extern uint32_t mdtoh32(uint32_t);
extern uint64_t mdtoh64(uint64_t);
#define htomd8(x) ((uint8_t)(x))
extern uint16_t htomd16(uint16_t);
extern uint32_t htomd32(uint32_t);
extern uint64_t htomd64(uint64_t);
#endif
struct MD_ELEMENT {
uint8_t tag;
uint8_t name_len;
uint16_t _reserved;
uint32_t name_offset; /* mde_str_cookie_t */
union {
struct {
uint32_t len;
uint32_t offset;
} prop_data; /* for PROP_DATA and PROP_STR */
uint64_t prop_val; /* for PROP_VAL */
uint64_t prop_idx; /* for PROP_ARC and NODE */
} d;
};
typedef struct MD_ELEMENT md_element_t;
struct MACHINE_DESCRIPTION {
caddr_t caddr;
void *(*allocp)(size_t);
void (*freep)(void *, size_t);
md_header_t *headerp;
md_element_t *mdep;
char *namep;
uint8_t *datap;
int node_blk_size;
int name_blk_size;
int data_blk_size;
int element_count;
int node_count;
mde_cookie_t root_node;
int size;
uint64_t gen;
uint64_t md_magic;
};
typedef struct MACHINE_DESCRIPTION md_impl_t;
#define MDE_TAG(_p) mdtoh8((_p)->tag)
#define MDE_NAME(_p) mdtoh32((_p)->name_offset)
#define MDE_NAME_LEN(_p) mdtoh32((_p)->name_len)
#define MDE_PROP_DATA_OFFSET(_p) mdtoh32((_p)->d.prop_data.offset)
#define MDE_PROP_DATA_LEN(_p) mdtoh32((_p)->d.prop_data.len)
#define MDE_PROP_VALUE(_p) mdtoh64((_p)->d.prop_val)
#define MDE_PROP_INDEX(_p) mdtoh64((_p)->d.prop_idx)
extern mde_str_cookie_t md_ident_name_str(char *);
extern mde_cookie_t md_find_node_prop(md_impl_t *,
mde_cookie_t,
mde_str_cookie_t,
int);
#endif /* _ASM */
#ifdef __cplusplus
}
#endif
#endif /* _MDESC_IMPL_H_ */

41
sys/sun4v/include/clock.h Normal file
View File

@ -0,0 +1,41 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_CLOCK_H_
#define _MACHINE_CLOCK_H_
extern u_long tick_increment;
extern u_long tick_freq;
extern u_long tick_MHz;
extern int adjkerntz;
extern int wall_cmos_clock;
int sysbeep(int, int);
#endif /* !_MACHINE_CLOCK_H_ */

95
sys/sun4v/include/cpu.h Normal file
View File

@ -0,0 +1,95 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
* from: FreeBSD: src/sys/i386/include/cpu.h,v 1.62 2001/06/29
* $FreeBSD$
*/
#ifndef _MACHINE_CPU_H_
#define _MACHINE_CPU_H_
#include <machine/frame.h>
#include <machine/tstate.h>
extern void cpu_yield(void);
#define TRAPF_PC(tfp) ((tfp)->tf_tpc)
#define TRAPF_USERMODE(tfp) (((tfp)->tf_tstate & TSTATE_PRIV) == 0)
#define cpu_getstack(td) ((td)->td_frame->tf_sp)
#define cpu_setstack(td, sp) ((td)->td_frame->tf_sp = (sp))
#define cpu_spinwait()
/*
* CTL_MACHDEP definitions.
*/
#define CPU_CONSDEV 1 /* dev_t: console terminal device */
#define CPU_ADJKERNTZ 2 /* int: timezone offset (seconds) */
#define CPU_DISRTCSET 3 /* int: disable resettodr() call */
#define CPU_BOOTINFO 4 /* struct: bootinfo */
#define CPU_WALLCLOCK 5 /* int: indicates wall CMOS clock */
#define CPU_MAXID 6 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "console_device", CTLTYPE_STRUCT }, \
{ "adjkerntz", CTLTYPE_INT }, \
{ "disable_rtc_set", CTLTYPE_INT }, \
{ "bootinfo", CTLTYPE_STRUCT }, \
{ "wall_cmos_clock", CTLTYPE_INT }, \
}
#ifdef _KERNEL
extern char btext[];
extern char etext[];
void cpu_halt(void);
void cpu_reset(void);
void fork_trampoline(void);
void swi_vm(void *v);
static __inline u_int64_t
get_cyclecount(void)
{
return (rd(tick));
}
#define UNIMPLEMENTED panic("%s not implemented", __FUNCTION__)
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
#endif
#endif /* !_MACHINE_CPU_H_ */

255
sys/sun4v/include/cpufunc.h Normal file
View File

@ -0,0 +1,255 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_CPUFUNC_H_
#define _MACHINE_CPUFUNC_H_
#include <machine/asi.h>
#include <machine/pstate.h>
struct thread;
/*
* membar operand macros for use in other macros when # is a special
* character. Keep these in sync with what the hardware expects.
*/
#define C_Lookaside (0)
#define C_MemIssue (1)
#define C_Sync (2)
#define M_LoadLoad (0)
#define M_StoreLoad (1)
#define M_LoadStore (2)
#define M_StoreStore (3)
#define CMASK_SHIFT (4)
#define MMASK_SHIFT (0)
#define CMASK_GEN(bit) ((1 << (bit)) << CMASK_SHIFT)
#define MMASK_GEN(bit) ((1 << (bit)) << MMASK_SHIFT)
#define Lookaside CMASK_GEN(C_Lookaside)
#define MemIssue CMASK_GEN(C_MemIssue)
#define Sync CMASK_GEN(C_Sync)
#define LoadLoad MMASK_GEN(M_LoadLoad)
#define StoreLoad MMASK_GEN(M_StoreLoad)
#define LoadStore MMASK_GEN(M_LoadStore)
#define StoreStore MMASK_GEN(M_StoreStore)
#define casa(rs1, rs2, rd, asi) ({ \
u_int __rd = (uint32_t)(rd); \
__asm __volatile("casa [%2] %3, %4, %0" \
: "+r" (__rd), "=m" (*rs1) \
: "r" (rs1), "n" (asi), "r" (rs2), "m" (*rs1)); \
__rd; \
})
#define casxa(rs1, rs2, rd, asi) ({ \
u_long __rd = (uint64_t)(rd); \
__asm __volatile("casxa [%2] %3, %4, %0" \
: "+r" (__rd), "=m" (*rs1) \
: "r" (rs1), "n" (asi), "r" (rs2), "m" (*rs1)); \
__rd; \
})
#define flush(va) do { \
__asm __volatile("flush %0" : : "r" (va)); \
} while (0)
#define flushw() do { \
__asm __volatile("flushw" : :); \
} while (0)
#define mov(val, reg) do { \
__asm __volatile("mov %0, %" __XSTRING(reg) : : "r" (val)); \
} while (0)
/* Generate ld*a/st*a functions for non-constant ASI's. */
#define LDNC_GEN(tp, o) \
static __inline tp \
o ## _nc(caddr_t va, int asi) \
{ \
tp r; \
__asm __volatile("wr %2, 0, %%asi;" #o " [%1] %%asi, %0"\
: "=r" (r) : "r" (va), "r" (asi)); \
return (r); \
}
LDNC_GEN(u_char, lduba);
LDNC_GEN(u_short, lduha);
LDNC_GEN(u_int, lduwa);
LDNC_GEN(u_long, ldxa);
#define LD_GENERIC(va, asi, op, type) ({ \
type __r; \
__asm __volatile(#op " [%1] %2, %0" \
: "=r" (__r) : "r" (va), "n" (asi)); \
__r; \
})
#define lduba(va, asi) LD_GENERIC(va, asi, lduba, u_char)
#define lduha(va, asi) LD_GENERIC(va, asi, lduha, u_short)
#define lduwa(va, asi) LD_GENERIC(va, asi, lduwa, u_int)
#define ldxa(va, asi) LD_GENERIC(va, asi, ldxa, u_long)
#if 0
#define STNC_GEN(tp, o) \
static __inline void \
o ## _nc(caddr_t va, int asi, tp val) \
{ \
__asm __volatile(#o " %0, [%g0 + %1] %2"\
: : "r" (val), "r" (va), "r" (asi)); \
}
#else
#define STNC_GEN(tp, o) \
static __inline void \
o ## _nc(caddr_t va, int asi, tp val) \
{ \
__asm __volatile("wr %2, 0, %%asi;" #o " %0, [%1] %%asi"\
: : "r" (val), "r" (va), "r" (asi)); \
}
#endif
STNC_GEN(u_char, stba);
STNC_GEN(u_short, stha);
STNC_GEN(u_int, stwa);
STNC_GEN(u_long, stxa);
#define ST_GENERIC(va, asi, val, op) \
__asm __volatile(#op " %0, [%1] %2" \
: : "r" (val), "r" (va), "n" (asi)); \
#define stba(va, asi, val) ST_GENERIC(va, asi, val, stba)
#define stha(va, asi, val) ST_GENERIC(va, asi, val, stha)
#define stwa(va, asi, val) ST_GENERIC(va, asi, val, stwa)
#define stxa(va, asi, val) ST_GENERIC(va, asi, val, stxa)
/*
* Attempt to read from addr, val. If a Data Access Error trap happens,
* they return -1 and the contents of val is undefined. A return of 0
* means no trap happened, and the contents of val is valid.
*/
int fasword8(u_long asi, void *addr, uint8_t *val);
int fasword16(u_long asi, void *addr, uint16_t *val);
int fasword32(u_long asi, void *addr, uint32_t *val);
#define membar(mask) do { \
__asm __volatile("membar %0" : : "n" (mask) : "memory"); \
} while (0)
#define rd(name) ({ \
uint64_t __sr; \
__asm __volatile("rd %%" #name ", %0" : "=r" (__sr) :); \
__sr; \
})
#define wr(name, val, xor) do { \
__asm __volatile("wr %0, %1, %%" #name \
: : "r" (val), "rI" (xor)); \
} while (0)
#define rdpr(name) ({ \
uint64_t __pr; \
__asm __volatile("rdpr %%" #name", %0" : "=r" (__pr) :); \
__pr; \
})
#define wrpr(name, val, xor) do { \
__asm __volatile("wrpr %0, %1, %%" #name \
: : "r" (val), "rI" (xor)); \
} while (0)
/*
* Macro intended to be used instead of wr(asr23, val, xor) for writing to
* the TICK_CMPR register in order to avoid a bug in BlackBird CPUs that
* can cause these writes to fail under certain condidtions which in turn
* causes the hardclock to stop. The workaround is to perform the write
* at the beginning of an I-Cache line directly followed by a dummy read.
*/
#define wrtickcmpr(val, xor) ({ \
__asm __volatile( \
" ba,pt %%xcc, 1f ; " \
" nop ; " \
" .align 64 ; " \
"1: wr %0, %1, %%asr23 ; " \
" rd %%asr23, %%g0 ; " \
: : "r" (val), "rI" (xor)); \
})
static __inline void
breakpoint(void)
{
__asm __volatile("ta %%xcc, 1" : :);
}
static __inline register_t
intr_disable_all(void)
{
u_long s;
s = rdpr(pstate);
wrpr(pstate, s & ~PSTATE_IE, 0);
return (s);
}
#define intr_restore_all(s) wrpr(pstate, (s), 0)
static __inline register_t
intr_disable(void)
{
u_long s;
s = rdpr(pil);
wrpr(pil, 14, 0);
return (s);
}
#define intr_restore(s) wrpr(pil, (s), 0)
/*
* In some places, it is required that the store is directly followed by a
* membar #Sync. Don't trust the compiler to not insert instructions in
* between. We also need to disable interrupts completely.
*/
#define stxa_sync(va, asi, val) do { \
u_long s; \
s = intr_disable_all(); \
__asm __volatile("stxa %0, [%1] %2; membar #Sync" \
: : "r" (val), "r" (va), "n" (asi)); \
intr_restore_all(s); \
} while (0)
void ascopy(u_long asi, vm_offset_t src, vm_offset_t dst, size_t len);
void ascopyfrom(u_long sasi, vm_offset_t src, caddr_t dst, size_t len);
void ascopyto(caddr_t src, u_long dasi, vm_offset_t dst, size_t len);
void aszero(u_long asi, vm_offset_t dst, size_t len);
#include <machine/sun4v_cpufunc.h>
#undef LDNC_GEN
#undef STNC_GEN
#endif /* !_MACHINE_CPUFUNC_H_ */

View File

@ -0,0 +1,69 @@
/*-
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*
* from: FreeBSD: src/sys/i386/include/db_machdep.h,v 1.16 1999/10/04
* $FreeBSD$
*/
#ifndef _MACHINE_DB_MACHDEP_H_
#define _MACHINE_DB_MACHDEP_H_
#include <machine/frame.h>
#include <machine/trap.h>
#define BYTE_MSF (1)
typedef vm_offset_t db_addr_t;
typedef long db_expr_t;
#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_pc)
#define BKPT_INST (0x91d03001)
#define BKPT_SIZE (4)
#define BKPT_SET(inst) (BKPT_INST)
#define BKPT_SKIP do { \
kdb_frame->tf_tpc = kdb_frame->tf_tnpc + 4; \
kdb_frame->tf_tnpc += 8; \
} while (0)
#define db_clear_single_step kdb_cpu_clear_singlestep
#define db_set_single_step kdb_cpu_set_singlestep
#define IS_BREAKPOINT_TRAP(type, code) (type == T_BREAKPOINT)
#define IS_WATCHPOINT_TRAP(type, code) (0)
#define inst_trap_return(ins) (0)
#define inst_return(ins) (0)
#define inst_call(ins) (0)
#define inst_load(ins) (0)
#define inst_store(ins) (0)
#define DB_SMALL_VALUE_MAX (0x7fffffff)
#define DB_SMALL_VALUE_MIN (-0x40001)
#define DB_ELFSIZE 64
#endif /* !_MACHINE_DB_MACHDEP_H_ */

198
sys/sun4v/include/elf.h Normal file
View File

@ -0,0 +1,198 @@
/*-
* Copyright (c) 1996-1997 John D. Polstra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_ELF_H_
#define _MACHINE_ELF_H_ 1
/*
* ELF definitions for the sparc64 architecture.
*/
#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */
#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */
#ifndef __ELF_WORD_SIZE
#define __ELF_WORD_SIZE 64 /* Used by <sys/elf_generic.h> */
#endif
#include <sys/elf_generic.h>
#define ELF_ARCH EM_SPARCV9
#define ELF_MACHINE_OK(x) ((x) == ELF_ARCH)
/*
* Auxiliary vector entries for passing information to the interpreter.
*/
typedef struct { /* Auxiliary vector entry on initial stack */
int a_type; /* Entry type. */
union {
int a_val; /* Integer value. */
} a_un;
} Elf32_Auxinfo;
typedef struct { /* Auxiliary vector entry on initial stack */
long a_type; /* Entry type. */
union {
long a_val; /* Integer value. */
void *a_ptr; /* Address. */
void (*a_fcn)(void); /* Function pointer (not used). */
} a_un;
} Elf64_Auxinfo;
__ElfType(Auxinfo);
/* Values for a_type. */
#define AT_NULL 0 /* Terminates the vector. */
#define AT_IGNORE 1 /* Ignored entry. */
#define AT_EXECFD 2 /* File descriptor of program to load. */
#define AT_PHDR 3 /* Program header of program already loaded. */
#define AT_PHENT 4 /* Size of each program header entry. */
#define AT_PHNUM 5 /* Number of program header entries. */
#define AT_PAGESZ 6 /* Page size in bytes. */
#define AT_BASE 7 /* Interpreter's base address. */
#define AT_FLAGS 8 /* Flags (unused). */
#define AT_ENTRY 9 /* Where interpreter should transfer control. */
/*
* The following non-standard values are used for passing information
* from John Polstra's testbed program to the dynamic linker. These
* are expected to go away soon.
*
* Unfortunately, these overlap the Linux non-standard values, so they
* must not be used in the same context.
*/
#define T_BRK 10 /* Starting point for sbrk and brk. */
#define AT_DEBUG 11 /* Debugging level. */
/*
* The following non-standard values are used in Linux ELF binaries.
*/
#define AT_NOTELF 10 /* Program is not ELF ?? */
#define AT_UID 11 /* Real uid. */
#define AT_EUID 12 /* Effective uid. */
#define AT_GID 13 /* Real gid. */
#define AT_EGID 14 /* Effective gid. */
#define AT_COUNT 15 /* Count of defined aux entry types. */
/*
* Relocation types.
*/
#define R_SPARC_NONE 0
#define R_SPARC_8 1
#define R_SPARC_16 2
#define R_SPARC_32 3
#define R_SPARC_DISP8 4
#define R_SPARC_DISP16 5
#define R_SPARC_DISP32 6
#define R_SPARC_WDISP30 7
#define R_SPARC_WDISP22 8
#define R_SPARC_HI22 9
#define R_SPARC_22 10
#define R_SPARC_13 11
#define R_SPARC_LO10 12
#define R_SPARC_GOT10 13
#define R_SPARC_GOT13 14
#define R_SPARC_GOT22 15
#define R_SPARC_PC10 16
#define R_SPARC_PC22 17
#define R_SPARC_WPLT30 18
#define R_SPARC_COPY 19
#define R_SPARC_GLOB_DAT 20
#define R_SPARC_JMP_SLOT 21
#define R_SPARC_RELATIVE 22
#define R_SPARC_UA32 23
#define R_SPARC_PLT32 24
#define R_SPARC_HIPLT22 25
#define R_SPARC_LOPLT10 26
#define R_SPARC_PCPLT32 27
#define R_SPARC_PCPLT22 28
#define R_SPARC_PCPLT10 29
#define R_SPARC_10 30
#define R_SPARC_11 31
#define R_SPARC_64 32
#define R_SPARC_OLO10 33
#define R_SPARC_HH22 34
#define R_SPARC_HM10 35
#define R_SPARC_LM22 36
#define R_SPARC_PC_HH22 37
#define R_SPARC_PC_HM10 38
#define R_SPARC_PC_LM22 39
#define R_SPARC_WDISP16 40
#define R_SPARC_WDISP19 41
#define R_SPARC_GLOB_JMP 42
#define R_SPARC_7 43
#define R_SPARC_5 44
#define R_SPARC_6 45
#define R_SPARC_DISP64 46
#define R_SPARC_PLT64 47
#define R_SPARC_HIX22 48
#define R_SPARC_LOX10 49
#define R_SPARC_H44 50
#define R_SPARC_M44 51
#define R_SPARC_L44 52
#define R_SPARC_REGISTER 53
#define R_SPARC_UA64 54
#define R_SPARC_UA16 55
#define R_SPARC_TLS_GD_HI22 56
#define R_SPARC_TLS_GD_LO10 57
#define R_SPARC_TLS_GD_ADD 58
#define R_SPARC_TLS_GD_CALL 59
#define R_SPARC_TLS_LDM_HI22 60
#define R_SPARC_TLS_LDM_LO10 61
#define R_SPARC_TLS_LDM_ADD 62
#define R_SPARC_TLS_LDM_CALL 63
#define R_SPARC_TLS_LDO_HIX22 64
#define R_SPARC_TLS_LDO_LOX10 65
#define R_SPARC_TLS_LDO_ADD 66
#define R_SPARC_TLS_IE_HI22 67
#define R_SPARC_TLS_IE_LO10 68
#define R_SPARC_TLS_IE_LD 69
#define R_SPARC_TLS_IE_LDX 70
#define R_SPARC_TLS_IE_ADD 71
#define R_SPARC_TLS_LE_HIX22 72
#define R_SPARC_TLS_LE_LOX10 73
#define R_SPARC_TLS_DTPMOD32 74
#define R_SPARC_TLS_DTPMOD64 75
#define R_SPARC_TLS_DTPOFF32 76
#define R_SPARC_TLS_DTPOFF64 77
#define R_SPARC_TLS_TPOFF32 78
#define R_SPARC_TLS_TPOFF64 79
/* Define "machine" characteristics */
#if __ELF_WORD_SIZE == 32
#define ELF_TARG_CLASS ELFCLASS32
#else
#define ELF_TARG_CLASS ELFCLASS64
#endif
#define ELF_TARG_DATA ELFDATA2MSB
#define ELF_TARG_MACH ELF_ARCH
#define ELF_TARG_VER 1
#endif /* !_MACHINE_ELF_H_ */

118
sys/sun4v/include/endian.h Normal file
View File

@ -0,0 +1,118 @@
/*-
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)endian.h 8.1 (Berkeley) 6/10/93
* $FreeBSD$
*/
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
/*
* Define the order of 32-bit words in 64-bit words.
*/
#define _QUAD_HIGHWORD 0
#define _QUAD_LOWWORD 1
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define _BYTE_ORDER _BIG_ENDIAN
/*
* Deprecated variants that don't have enough underscores to be useful in more
* strict namespaces.
*/
#if __BSD_VISIBLE
#define LITTLE_ENDIAN _LITTLE_ENDIAN
#define BIG_ENDIAN _BIG_ENDIAN
#define PDP_ENDIAN _PDP_ENDIAN
#define BYTE_ORDER _BYTE_ORDER
#endif
#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__)
#define __is_constant(x) __builtin_constant_p(x)
#else
#define __is_constant(x) 0
#endif
#define __bswap16_const(x) ((x >> 8) | ((x << 8) & 0xff00))
#define __bswap32_const(x) ((x >> 24) | ((x >> 8) & 0xff00) | \
((x << 8) & 0xff0000) | ((x << 24) & 0xff000000))
#define __bswap64_const(x) ((x >> 56) | ((x >> 40) & 0xff00) | \
((x >> 24) & 0xff0000) | ((x >> 8) & 0xff000000) | \
((x << 8) & ((__uint64_t)0xff << 32)) | \
((x << 24) & ((__uint64_t)0xff << 40)) | \
((x << 40) & ((__uint64_t)0xff << 48)) | ((x << 56)))
static __inline __uint16_t
__bswap16_var(__uint16_t _x)
{
return ((_x >> 8) | ((_x << 8) & 0xff00));
}
static __inline __uint32_t
__bswap32_var(__uint32_t _x)
{
return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff0000) |
((_x << 24) & 0xff000000));
}
static __inline __uint64_t
__bswap64_var(__uint64_t _x)
{
return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) |
((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) |
((_x << 24) & ((__uint64_t)0xff << 40)) |
((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
}
#define __bswap16(x) (__is_constant(x) ? __bswap16_const(x) : \
__bswap16_var(x))
#define __bswap32(x) (__is_constant(x) ? __bswap32_const(x) : \
__bswap32_var(x))
#define __bswap64(x) (__is_constant(x) ? __bswap64_const(x) : \
__bswap64_var(x))
#define __htonl(x) ((__uint32_t)(x))
#define __htons(x) ((__uint16_t)(x))
#define __ntohl(x) ((__uint32_t)(x))
#define __ntohs(x) ((__uint16_t)(x))
#endif /* !_MACHINE_ENDIAN_H_ */

34
sys/sun4v/include/exec.h Normal file
View File

@ -0,0 +1,34 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_EXEC_H_
#define _MACHINE_EXEC_H_
#define __LDPGSZ 8192
#endif /* !_MACHINE_EXEC_H_ */

84
sys/sun4v/include/float.h Normal file
View File

@ -0,0 +1,84 @@
/*-
* Copyright (c) 1992, 1993, 2001
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)float.h 8.1 (Berkeley) 6/11/93
* from: NetBSD: float.h,v 1.3 2001/09/21 20:48:02 eeh Exp
* $FreeBSD$
*/
#ifndef _MACHINE_FLOAT_H_
#define _MACHINE_FLOAT_H_
#include <sys/cdefs.h>
__BEGIN_DECLS
extern int __flt_rounds(void);
__END_DECLS
#define FLT_RADIX 2 /* b */
#define FLT_ROUNDS __flt_rounds()
#if __ISO_C_VISIBLE >= 1999
#define FLT_EVAL_METHOD 0 /* no promotion */
#define DECIMAL_DIG 35 /* max precision in decimal digits */
#endif
#define FLT_MANT_DIG 24 /* p */
#define FLT_EPSILON 1.19209290E-7F /* b**(1-p) */
#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
#define FLT_MIN_EXP (-125) /* emin */
#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */
#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */
#define FLT_MAX_EXP 128 /* emax */
#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
#define DBL_MANT_DIG 53
#define DBL_EPSILON 2.2204460492503131E-16
#define DBL_DIG 15
#define DBL_MIN_EXP (-1021)
#define DBL_MIN 2.2250738585072014E-308
#define DBL_MIN_10_EXP (-307)
#define DBL_MAX_EXP 1024
#define DBL_MAX 1.7976931348623157E+308
#define DBL_MAX_10_EXP 308
#define LDBL_MANT_DIG 113
#define LDBL_EPSILON 1.925929944387235853055977942584927319E-34L
#define LDBL_DIG 33
#define LDBL_MIN_EXP (-16381)
#define LDBL_MIN 3.362103143112093506262677817321752603E-4932L
#define LDBL_MIN_10_EXP (-4931)
#define LDBL_MAX_EXP (+16384)
#define LDBL_MAX 1.189731495357231765085759326628007016E+4932L
#define LDBL_MAX_10_EXP (+4932)
#endif /* _MACHINE_FLOAT_H_ */

View File

@ -0,0 +1,37 @@
/*-
* Copyright (c) 2002 David O'Brien <obrien@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY DAVID O'BRIEN AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _FLOATINGPOINT_H_
#define _FLOATINGPOINT_H_
#include <machine/ieeefp.h>
#endif /* !_FLOATINGPOINT_H_ */

39
sys/sun4v/include/fp.h Normal file
View File

@ -0,0 +1,39 @@
/*-
* Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_FP_H_
#define _MACHINE_FP_H_
#ifdef _KERNEL
/*
* Note: The pointer passed to savefpctx must be aligned on a 64 byte
* boundary.
*/
void savefpctx(uint32_t *fp);
#endif /* _KERNEL */
#endif /* !_MACHINE_FP_H_ */

90
sys/sun4v/include/frame.h Normal file
View File

@ -0,0 +1,90 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_FRAME_H_
#define _MACHINE_FRAME_H_
#define RW_SHIFT 7
#define SPOFF 2047
#define BIAS SPOFF /* XXX - open/netbsd compat */
/*
* NOTE: keep this structure in sync with struct reg and struct mcontext.
*/
struct trapframe {
uint64_t tf_global[8];
uint64_t tf_out[8];
uint64_t tf_fprs;
uint64_t tf_fsr;
uint64_t tf_gsr;
uint64_t tf_pad0[1];
uint64_t tf_pil;
uint64_t tf_pad1[3];
uint64_t tf_tnpc;
uint64_t tf_tpc;
uint64_t tf_tstate;
uint64_t tf_pad2[2];
uint64_t tf_wstate;
uint64_t tf_asi;
uint64_t tf_pad3[1];
} __aligned(64);
/* extra padding can go away once we re-shuffle user-land mcontext
*/
#define tf_sp tf_out[6]
#define TF_DONE(tf) do { \
tf->tf_tpc = tf->tf_tnpc; \
tf->tf_tnpc += 4; \
} while (0)
struct frame {
u_long fr_local[8];
u_long fr_in[8];
u_long fr_pad[8];
};
#define fr_arg fr_in
#define fr_fp fr_in[6]
#define fr_pc fr_in[7]
#define v9next_frame(fp) ((struct frame *)(fp->fr_fp + BIAS))
/*
* Frame used for pcb_rw.
*/
struct rwindow {
u_long rw_local[8];
u_long rw_in[8];
};
struct thread;
int rwindow_save(struct thread *td);
int rwindow_load(struct thread *td, struct trapframe *tf, int n);
#endif /* !_MACHINE_FRAME_H_ */

108
sys/sun4v/include/fsr.h Normal file
View File

@ -0,0 +1,108 @@
/*-
* Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_FSR_H_
#define _MACHINE_FSR_H_
#define FPRS_DL (1 << 0)
#define FPRS_DU (1 << 1)
#define FPRS_FEF (1 << 2)
#define FSR_EXC_BITS 5
#define FSR_EXC_MASK ((1UL << FSR_EXC_BITS) - 1)
#define FSR_CEXC_SHIFT 0
#define FSR_CEXC_MASK (FSR_EXC_MASK << FSR_CEXC_SHIFT)
#define FSR_CEXC(b) ((unsigned long)(b) << FSR_CEXC_SHIFT)
#define FSR_GET_CEXC(x) (((x) & FSR_CEXC_MASK) >> FSR_CEXC_SHIFT)
#define FSR_AEXC_SHIFT 5
#define FSR_AEXC_MASK (FSR_EXC_MASK << FSR_AEXC_SHIFT)
#define FSR_AEXC(b) ((unsigned long)(b) << FSR_AEXC_SHIFT)
#define FSR_GET_AEXC(x) (((x) & FSR_AEXC_MASK) >> FSR_AEXC_SHIFT)
#define FSR_QNE (1UL << 13)
#define FSR_NS (1UL << 22)
#define FSR_TEM_SHIFT 23
#define FSR_TEM_MASK (FSR_EXC_MASK << FSR_TEM_SHIFT)
#define FSR_TEM(b) ((unsigned long)(b) << FSR_TEM_SHIFT)
#define FSR_GET_TEM(x) (((x) & FSR_TEM_MASK) >> FSR_TEM_SHIFT)
#define FSR_FCC0_SHIFT 10
#define FSR_FCC0_BITS 2
#define FSR_FCC0_MASK (((1UL << FSR_FCC0_BITS) - 1) << FSR_FCC0_SHIFT)
#define FSR_FCC0(x) ((unsigned long)(x) << FSR_FCC0_SHIFT)
#define FSR_GET_FCC0(x) (((x) & FSR_FCC0_MASK) >> FSR_FCC0_SHIFT)
#define FSR_FTT_SHIFT 14
#define FSR_FTT_BITS 3
#define FSR_FTT_MASK (((1UL << FSR_FTT_BITS) - 1) << FSR_FTT_SHIFT)
#define FSR_FTT(x) ((unsigned long)(x) << FSR_FTT_SHIFT)
#define FSR_GET_FTT(x) (((x) & FSR_FTT_MASK) >> FSR_FTT_SHIFT)
#define FSR_VER_SHIFT 17
#define FSR_GET_VER(x) (((x) >> FSR_VER_SHIFT) & 7)
#define FSR_RD_SHIFT 30
#define FSR_RD_BITS 2
#define FSR_RD_MASK (((1UL << FSR_RD_BITS) - 1) << FSR_RD_SHIFT)
#define FSR_RD(x) ((unsigned long)(x) << FSR_RD_SHIFT)
#define FSR_GET_RD(x) (((x) & FSR_RD_MASK) >> FSR_RD_SHIFT)
#define FSR_FCC1_SHIFT 32
#define FSR_FCC1_BITS 2
#define FSR_FCC1_MASK (((1UL << FSR_FCC1_BITS) - 1) << FSR_FCC1_SHIFT)
#define FSR_FCC1(x) ((unsigned long)(x) << FSR_FCC1_SHIFT)
#define FSR_GET_FCC1(x) (((x) & FSR_FCC1_MASK) >> FSR_FCC1_SHIFT)
#define FSR_FCC2_SHIFT 34
#define FSR_FCC2_BITS 2
#define FSR_FCC2_MASK (((1UL << FSR_FCC2_BITS) - 1) << FSR_FCC2_SHIFT)
#define FSR_FCC2(x) ((unsigned long)(x) << FSR_FCC2_SHIFT)
#define FSR_GET_FCC2(x) (((x) & FSR_FCC2_MASK) >> FSR_FCC2_SHIFT)
#define FSR_FCC3_SHIFT 36
#define FSR_FCC3_BITS 2
#define FSR_FCC3_MASK (((1UL << FSR_FCC3_BITS) - 1) << FSR_FCC3_SHIFT)
#define FSR_FCC3(x) ((unsigned long)(x) << FSR_FCC3_SHIFT)
#define FSR_GET_FCC3(x) (((x) & FSR_FCC3_MASK) >> FSR_FCC3_SHIFT)
/* CEXC/AEXC/TEM exception values */
#define FSR_NX (1 << 0)
#define FSR_DZ (1 << 1)
#define FSR_UF (1 << 2)
#define FSR_OF (1 << 3)
#define FSR_NV (1 << 4)
/* FTT values. */
#define FSR_FTT_NONE 0
#define FSR_FTT_IEEE 1
#define FSR_FTT_UNFIN 2
#define FSR_FTT_UNIMP 3
#define FSR_FTT_SEQERR 4
#define FSR_FTT_HWERR 5
#define FSR_FTT_INVREG 6
/* RD values */
#define FSR_RD_N 0 /* nearest */
#define FSR_RD_Z 1 /* zero */
#define FSR_RD_PINF 2 /* +infinity */
#define FSR_RD_NINF 3 /* -infinity */
/* condition codes */
#define FSR_CC_EQ 0 /* a = b */
#define FSR_CC_LT 1 /* a < b */
#define FSR_CC_GT 2 /* a > b */
#define FSR_CC_UO 3 /* unordered */
#endif /* !_MACHINE_FSR_H_ */

View File

@ -0,0 +1,57 @@
/*-
* Copyright (c) 2004 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_GDB_MACHDEP_H_
#define _MACHINE_GDB_MACHDEP_H_
#define GDB_BUFSZ 600
#define GDB_NREGS 86
#define GDB_REG_PC 80
static __inline size_t
gdb_cpu_regsz(int regnum)
{
return ((regnum >= 32 && regnum < 64) ? sizeof(float) : sizeof(long));
}
static __inline int
gdb_cpu_query(void)
{
return (0);
}
static __inline int
gdb_cpu_signal(int vector, int _)
{
return (vector);
}
void *gdb_cpu_getreg(int, size_t *);
void gdb_cpu_setreg(int, void *);
#endif /* !_MACHINE_GDB_MACHDEP_H_ */

View File

@ -0,0 +1,51 @@
/*-
* Copyright 2006 John-Mark Gurney.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*
* $FreeBSD$
*/
#ifndef _HV_PCIVAR_H_
#define _HV_PCIVAR_H_
struct hvpci_softc {
devhandle_t hs_devhandle;
phandle_t hs_node;
uint8_t hs_busnum;
struct ofw_bus_iinfo hs_pci_iinfo;
struct bus_dma_tag hs_dmatag;
struct rman hs_pci_mem_rman;
bus_space_tag_t hs_pci_memt;
bus_space_handle_t hs_pci_memh;
struct rman hs_pci_io_rman;
bus_space_tag_t hs_pci_iot;
bus_space_handle_t hs_pci_ioh;
};
#endif /* _HV_PCIVAR_H_ */

View File

@ -0,0 +1,39 @@
/*-
* Copyright 2006 John-Mark Gurney.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*
* $FreeBSD$
*/
#ifndef _HVIOMMU_H_
#define _HVIOMMU_H_
struct hviommu;
extern struct bus_dma_methods hviommu_dma_methods;
struct hviommu *hviommu_init(devhandle_t dh, u_long dvmabase, u_long dvmasize);
#endif /* _HVIOMMU_H_ */

View File

@ -0,0 +1,166 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
* $FreeBSD$
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MACHINE_HYPERVISOR_API_H
#define _MACHINE_HYPERVISOR_API_H
/*
* sun4v Hypervisor API
*
* Reference: api.pdf Revision 0.12 dated May 12, 2004.
* io-api.txt version 1.11 dated 10/19/2004
*/
#include <machine/hypervisorvar.h>
#ifndef _ASM
typedef uint64_t devhandle_t;
typedef uint64_t pci_device_t;
typedef uint32_t pci_config_offset_t;
typedef uint8_t pci_config_size_t;
typedef union pci_cfg_data {
uint8_t b;
uint16_t w;
uint32_t dw;
uint64_t qw;
} pci_cfg_data_t;
typedef uint64_t tsbid_t;
typedef uint32_t pages_t;
typedef enum io_attributes {
PCI_MAP_ATTR_READ = (uint32_t)0x01,
PCI_MAP_ATTR_WRITE = (uint32_t)0x02,
} io_attributes_t;
typedef enum io_sync_direction {
IO_SYNC_DEVICE = (uint32_t)0x01,
IO_SYNC_CPU = (uint32_t)0x02,
} io_sync_direction_t;
typedef uint64_t io_page_list_t;
typedef uint64_t r_addr_t;
typedef uint64_t io_addr_t;
typedef struct trap_trace_entry {
uint8_t tte_type; /* Hypervisor or guest entry. */
uint8_t tte_hpstat; /* Hyper-privileged state. */
uint8_t tte_tl; /* Trap level. */
uint8_t tte_gl; /* Global register level. */
uint16_t tte_tt; /* Trap type.*/
uint16_t tte_tag; /* Extended trap identifier. */
uint64_t tte_tstate; /* Trap state. */
uint64_t tte_tick; /* Tick. */
uint64_t tte_tpc; /* Trap PC. */
uint64_t tte_f1; /* Entry specific. */
uint64_t tte_f2; /* Entry specific. */
uint64_t tte_f3; /* Entry specific. */
uint64_t tte_f4; /* Entry specific. */
} trap_trace_entry_t;
extern uint64_t hv_mmu_map_perm_addr(void *, int, uint64_t, int);
extern uint64_t hv_mmu_unmap_perm_addr(void *, int, int);
extern uint64_t hv_set_ctx0(uint64_t, uint64_t);
extern uint64_t hv_set_ctxnon0(uint64_t, uint64_t);
#ifdef SET_MMU_STATS
extern uint64_t hv_mmu_set_stat_area(uint64_t, uint64_t);
#endif /* SET_MMU_STATS */
extern uint64_t hv_cpu_qconf(int queue, uint64_t paddr, int size);
extern uint64_t hv_cpu_mondo_send(int n, vm_paddr_t cpu_list_ra);
extern uint64_t hv_cpu_yield(void);
extern uint64_t hv_cpu_state(uint64_t cpuid, uint64_t *cpu_state);
extern uint64_t hv_mem_scrub(uint64_t real_addr, uint64_t length,
uint64_t *scrubbed_len);
extern uint64_t hv_mem_sync(uint64_t real_addr, uint64_t length,
uint64_t *flushed_len);
extern uint64_t hv_service_recv(uint64_t s_id, uint64_t buf_pa,
uint64_t size, uint64_t *recv_bytes);
extern uint64_t hv_service_send(uint64_t s_id, uint64_t buf_pa,
uint64_t size, uint64_t *send_bytes);
extern uint64_t hv_service_getstatus(uint64_t s_id, uint64_t *vreg);
extern uint64_t hv_service_setstatus(uint64_t s_id, uint64_t bits);
extern uint64_t hv_service_clrstatus(uint64_t s_id, uint64_t bits);
extern uint64_t hv_mach_desc(uint64_t buffer_ra, uint64_t *buffer_sizep);
extern uint64_t hv_ttrace_buf_info(uint64_t *, uint64_t *);
extern uint64_t hv_ttrace_buf_conf(uint64_t, uint64_t, uint64_t *);
extern uint64_t hv_ttrace_enable(uint64_t, uint64_t *);
extern uint64_t hv_ttrace_freeze(uint64_t, uint64_t *);
extern uint64_t hv_ttrace_addentry(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
extern uint64_t hv_dump_buf_update(uint64_t, uint64_t, uint64_t *);
extern int64_t hv_cnputchar(uint8_t);
extern int64_t hv_cngetchar(uint8_t *);
extern uint64_t hv_tod_get(uint64_t *seconds);
extern uint64_t hv_tod_set(uint64_t);
extern uint64_t hvio_intr_devino_to_sysino(uint64_t dev_hdl, uint32_t devino,
uint64_t *sysino);
extern uint64_t hvio_intr_getvalid(uint64_t sysino,
int *intr_valid_state);
extern uint64_t hvio_intr_setvalid(uint64_t sysino,
int intr_valid_state);
extern uint64_t hvio_intr_getstate(uint64_t sysino,
int *intr_state);
extern uint64_t hvio_intr_setstate(uint64_t sysino, int intr_state);
extern uint64_t hvio_intr_gettarget(uint64_t sysino, uint32_t *cpuid);
extern uint64_t hvio_intr_settarget(uint64_t sysino, uint32_t cpuid);
extern uint64_t hvio_peek(devhandle_t dev_hdl, uint64_t r_addr, uint64_t size,
uint32_t *err_flag, uint64_t *data);
extern uint64_t hvio_poke(devhandle_t dev_hdl, uint64_t r_addr, uint64_t size,
uint64_t data, uint64_t pcidev, uint32_t *err_flag);
extern uint64_t hvio_config_get(devhandle_t dev_hdl, pci_device_t pci_device,
pci_config_offset_t off, pci_config_size_t size, pci_cfg_data_t *data);
extern uint64_t hvio_config_put(devhandle_t dev_hdl, pci_device_t pci_device,
pci_config_offset_t off, pci_config_size_t size,
pci_cfg_data_t data);
extern uint64_t hvio_iommu_map(devhandle_t dev_hdl, tsbid_t tsbid,
pages_t pages, io_attributes_t io_attributes,
io_page_list_t *io_page_list_p,
pages_t *pages_mapped);
extern uint64_t hvio_iommu_demap(devhandle_t dev_hdl, tsbid_t tsbid,
pages_t pages, pages_t *pages_demapped);
extern uint64_t hvio_iommu_getmap(devhandle_t dev_hdl, tsbid_t tsbid,
io_attributes_t *attributes_p, r_addr_t *r_addr_p);
extern uint64_t hvio_iommu_getbypass(devhandle_t dev_hdl, r_addr_t ra,
io_attributes_t io_attributes,
io_addr_t *io_addr_p);
extern uint64_t hvio_dma_sync(devhandle_t dev_hdl, r_addr_t ra,
size_t num_bytes, uint64_t io_sync_direction,
size_t *bytes_synched);
extern void hv_magic_trap_on(void);
extern void hv_magic_trap_off(void);
extern int hv_sim_read(uint64_t offset, vm_paddr_t buffer_ra, uint64_t size);
extern int hv_sim_write(uint64_t offset, vm_paddr_t buffer_ra, uint64_t size);
#endif
#endif /* _MACHINE_HYPERVISOR_API_H */

View File

@ -0,0 +1,329 @@
/*-
* Copyright (c) 2006 Kip Macy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_HYPERVISORVAR_H_
#define _MACHINE_HYPERVISORVAR_H_
/*
* Trap types
*/
#define FAST_TRAP 0x80 /* Function # in %o5 */
#define CPU_TICK_NPT 0x81
#define CPU_STICK_NPT 0x82
#define MMU_MAP_ADDR 0x83
#define MMU_UNMAP_ADDR 0x84
/*
* Error returns in %o0.
* (Additional result is returned in %o1.)
*/
#define H_EOK 0 /* Successful return */
#define H_ENOCPU 1 /* Invalid CPU id */
#define H_ENORADDR 2 /* Invalid real address */
#define H_ENOINTR 3 /* Invalid interrupt id */
#define H_EBADPGSZ 4 /* Invalid pagesize encoding */
#define H_EBADTSB 5 /* Invalid TSB description */
#define H_EINVAL 6 /* Invalid argument */
#define H_EBADTRAP 7 /* Invalid function number */
#define H_EBADALIGN 8 /* Invalid address alignment */
#define H_EWOULDBLOCK 9 /* Cannot complete operation */
/* without blocking */
#define H_ENOACCESS 10 /* No access to resource */
#define H_EIO 11 /* I/O error */
#define H_ECPUERROR 12 /* CPU is in error state */
#define H_ENOTSUPPORTED 13 /* Function not supported */
#define H_ENOMAP 14 /* Mapping is not valid, */
/* no translation exists */
#define H_BREAK -1 /* Console Break */
#define H_HUP -2 /* Console Break */
/*
* Mondo CPU ID argument processing.
*/
#define HV_SEND_MONDO_ENTRYDONE 0xffff
/*
* Function numbers for FAST_TRAP.
*/
#define HV_MACH_EXIT 0x00
#define HV_MACH_DESC 0x01
#define HV_CPU_YIELD 0x12
#define CPU_QCONF 0x14
#define HV_CPU_STATE 0x17
#define MMU_TSB_CTX0 0x20
#define MMU_TSB_CTXNON0 0x21
#define MMU_DEMAP_PAGE 0x22
#define MMU_DEMAP_CTX 0x23
#define MMU_DEMAP_ALL 0x24
#define MAP_PERM_ADDR 0x25
#define MMU_SET_INFOPTR 0x26
#define UNMAP_PERM_ADDR 0x28
#define HV_MEM_SCRUB 0x31
#define HV_MEM_SYNC 0x32
#define HV_INTR_SEND 0x42
#define TOD_GET 0x50
#define TOD_SET 0x51
#define CONS_READ 0x60
#define CONS_WRITE 0x61
#define SVC_SEND 0x80
#define SVC_RECV 0x81
#define SVC_GETSTATUS 0x82
#define SVC_SETSTATUS 0x83
#define SVC_CLRSTATUS 0x84
#define TTRACE_BUF_CONF 0x90
#define TTRACE_BUF_INFO 0x91
#define TTRACE_ENABLE 0x92
#define TTRACE_FREEZE 0x93
#define DUMP_BUF_UPDATE 0x94
#define HVIO_INTR_DEVINO2SYSINO 0xa0
#define HVIO_INTR_GETENABLED 0xa1
#define HVIO_INTR_SETENABLED 0xa2
#define HVIO_INTR_GETSTATE 0xa3
#define HVIO_INTR_SETSTATE 0xa4
#define HVIO_INTR_GETTARGET 0xa5
#define HVIO_INTR_SETTARGET 0xa6
#define HVIO_IOMMU_MAP 0xb0
#define HVIO_IOMMU_DEMAP 0xb1
#define HVIO_IOMMU_GETMAP 0xb2
#define HVIO_IOMMU_GETBYPASS 0xb3
#define HVIO_CONFIG_GET 0xb4
#define HVIO_CONFIG_PUT 0xb5
#define HVIO_PEEK 0xb6
#define HVIO_POKE 0xb7
#define HVIO_DMA_SYNC 0xb8
#define HVIO_MSIQ_CONF 0xc0
#define HVIO_MSIQ_INFO 0xc1
#define HVIO_MSIQ_GETVALID 0xc2
#define HVIO_MSIQ_SETVALID 0xc3
#define HVIO_MSIQ_GETSTATE 0xc4
#define HVIO_MSIQ_SETSTATE 0xc5
#define HVIO_MSIQ_GETHEAD 0xc6
#define HVIO_MSIQ_SETHEAD 0xc7
#define HVIO_MSIQ_GETTAIL 0xc8
#define HVIO_MSI_GETVALID 0xc9
#define HVIO_MSI_SETVALID 0xca
#define HVIO_MSI_GETMSIQ 0xcb
#define HVIO_MSI_SETMSIQ 0xcc
#define HVIO_MSI_GETSTATE 0xcd
#define HVIO_MSI_SETSTATE 0xce
#define HVIO_MSG_GETMSIQ 0xd0
#define HVIO_MSG_SETMSIQ 0xd1
#define HVIO_MSG_GETVALID 0xd2
#define HVIO_MSG_SETVALID 0xd3
#define HVIO_SIM_READ 0xf0
#define HVIO_SIM_WRITE 0xf1
#ifdef SET_MMU_STATS
#define MMU_STAT_AREA 0xfc
#endif /* SET_MMU_STATS */
#define HV_NCS_REQUEST 0x110
#define FIRE_GET_PERFREG 0x120
#define FIRE_SET_PERFREG 0x121
#define HV_RA2PA 0x200
#define HV_HPRIV 0x201
/*
* Bits for MMU functions flags argument:
* arg3 of MMU_MAP_ADDR
* arg3 of MMU_DEMAP_CTX
* arg2 of MMU_DEMAP_ALL
*/
#define MAP_DTLB 0x1
#define MAP_ITLB 0x2
/*
* Interrupt state manipulation definitions.
*/
#define HV_INTR_IDLE_STATE 0
#define HV_INTR_RECEIVED_STATE 1
#define HV_INTR_DELIVERED_STATE 2
#define HV_INTR_NOTVALID 0
#define HV_INTR_VALID 1
#ifndef LOCORE
/*
* TSB description structure for MMU_TSB_CTX0 and MMU_TSB_CTXNON0.
*/
typedef struct hv_tsb_info {
uint16_t hvtsb_idxpgsz; /* page size used to index TSB */
uint16_t hvtsb_assoc; /* TSB associativity */
uint32_t hvtsb_ntte; /* TSB size (#TTE entries) */
uint32_t hvtsb_ctx_index; /* context reg index */
uint32_t hvtsb_pgszs; /* sizes in use */
uint64_t hvtsb_pa; /* real address of TSB base */
uint64_t hvtsb_rsvd; /* reserved */
} hv_tsb_info_t;
#define HVTSB_SHARE_INDEX ((uint32_t)-1)
#ifdef SET_MMU_STATS
#ifndef TTE4V_NPGSZ
#define TTE4V_NPGSZ 8
#endif /* TTE4V_NPGSZ */
/*
* MMU statistics structure for MMU_STAT_AREA
*/
struct mmu_stat_one {
uint64_t hit_ctx0[TTE4V_NPGSZ];
uint64_t hit_ctxn0[TTE4V_NPGSZ];
uint64_t tsb_miss;
uint64_t tlb_miss; /* miss, no TSB set */
uint64_t map_ctx0[TTE4V_NPGSZ];
uint64_t map_ctxn0[TTE4V_NPGSZ];
};
struct mmu_stat {
struct mmu_stat_one immu_stat;
struct mmu_stat_one dmmu_stat;
uint64_t set_ctx0;
uint64_t set_ctxn0;
};
#endif /* SET_MMU_STATS */
#endif /* _ASM */
/*
* CPU States
*/
#define CPU_STATE_INVALID 0x0
#define CPU_STATE_IDLE 0x1 /* cpu not started */
#define CPU_STATE_GUEST 0x2 /* cpu running guest code */
#define CPU_STATE_ERROR 0x3 /* cpu is in the error state */
#define CPU_STATE_LAST_PUBLIC CPU_STATE_ERROR /* last valid state */
/*
* MMU fault status area
*/
#define MMFSA_TYPE_ 0x00 /* fault type */
#define MMFSA_ADDR_ 0x08 /* fault address */
#define MMFSA_CTX_ 0x10 /* fault context */
#define MMFSA_I_ 0x00 /* start of fields for I */
#define MMFSA_I_TYPE (MMFSA_I_ + MMFSA_TYPE_) /* instruction fault type */
#define MMFSA_I_ADDR (MMFSA_I_ + MMFSA_ADDR_) /* instruction fault address */
#define MMFSA_I_CTX (MMFSA_I_ + MMFSA_CTX_) /* instruction fault context */
#define MMFSA_D_ 0x40 /* start of fields for D */
#define MMFSA_D_TYPE (MMFSA_D_ + MMFSA_TYPE_) /* data fault type */
#define MMFSA_D_ADDR (MMFSA_D_ + MMFSA_ADDR_) /* data fault address */
#define MMFSA_D_CTX (MMFSA_D_ + MMFSA_CTX_) /* data fault context */
#define MMFSA_F_FMISS 1 /* fast miss */
#define MMFSA_F_FPROT 2 /* fast protection */
#define MMFSA_F_MISS 3 /* mmu miss */
#define MMFSA_F_INVRA 4 /* invalid RA */
#define MMFSA_F_PRIV 5 /* privilege violation */
#define MMFSA_F_PROT 6 /* protection violation */
#define MMFSA_F_NFO 7 /* NFO access */
#define MMFSA_F_SOPG 8 /* so page */
#define MMFSA_F_INVVA 9 /* invalid VA */
#define MMFSA_F_INVASI 10 /* invalid ASI */
#define MMFSA_F_NCATM 11 /* non-cacheable atomic */
#define MMFSA_F_PRVACT 12 /* privileged action */
#define MMFSA_F_WPT 13 /* watchpoint hit */
#define MMFSA_F_UNALIGN 14 /* unaligned access */
#define MMFSA_F_INVPGSZ 15 /* invalid page size */
#define MMFSA_SIZE 0x80 /* in bytes, 64 byte aligned */
/*
* MMU fault status - MMFSA_IFS and MMFSA_DFS
*/
#define MMFS_FV 0x00000001
#define MMFS_OW 0x00000002
#define MMFS_W 0x00000004
#define MMFS_PR 0x00000008
#define MMFS_CT 0x00000030
#define MMFS_E 0x00000040
#define MMFS_FT 0x00003f80
#define MMFS_ME 0x00004000
#define MMFS_TM 0x00008000
#define MMFS_ASI 0x00ff0000
#define MMFS_NF 0x01000000
/*
* DMA sync parameter definitions
*/
#define HVIO_DMA_SYNC_DIR_TO_DEV 0x01
#define HVIO_DMA_SYNC_DIR_FROM_DEV 0x02
/*
* Performance counter register definitions.
*/
#define HVIO_FIRE_PERFREG_JBC_SEL 0
#define HVIO_FIRE_PERFREG_JBC_CNT0 1
#define HVIO_FIRE_PERFREG_JBC_CNT1 2
#define HVIO_FIRE_PERFREG_PCIE_IMU_SEL 3
#define HVIO_FIRE_PERFREG_PCIE_IMU_CNT0 4
#define HVIO_FIRE_PERFREG_PCIE_IMU_CNT1 5
#define HVIO_FIRE_PERFREG_PCIE_MMU_SEL 6
#define HVIO_FIRE_PERFREG_PCIE_MMU_CNT0 7
#define HVIO_FIRE_PERFREG_PCIE_MMU_CNT1 8
#define HVIO_FIRE_PERFREG_PCIE_TLU_SEL 9
#define HVIO_FIRE_PERFREG_PCIE_TLU_CNT0 10
#define HVIO_FIRE_PERFREG_PCIE_TLU_CNT1 11
#define HVIO_FIRE_PERFREG_PCIE_TLU_CNT2 12
#define HVIO_FIRE_PERFREG_PCIE_LNK_SEL 13
#define HVIO_FIRE_PERFREG_PCIE_LNK_CNT1 14
#define HVIO_FIRE_PERFREG_PCIE_LNK_CNT2 15
#ifdef SIMULATOR
#define MAGIC_TRAP_ON ta 0x77
#define MAGIC_TRAP_OFF ta 0x78
#define MAGIC_EXIT ta 0x71
#else
#define MAGIC_TRAP_ON nop
#define MAGIC_TRAP_OFF nop
#define MAGIC_EXIT nop
#endif
#endif /*_MACHINE_HYPERVISORVAR_H_ */

View File

@ -0,0 +1,63 @@
/*-
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: NetBSD: idprom.h,v 1.2 1998/09/05 23:57:26 eeh Exp
*
* $FreeBSD$
*/
#ifndef _MACHINE_IDPROM_H_
#define _MACHINE_IDPROM_H_
/*
* ID prom format. The ``host id'' is set up by taking the machine
* ID as the top byte and the hostid field as the remaining three.
* The id_xxx0 field appears to contain some other number. The id_xxx1
* contains a bunch of 00's and a5's on my machines, suggesting it is
* not actually used. The checksum seems to include them, however.
*/
struct idprom {
u_char id_format; /* format identifier (= 1) */
u_char id_machine; /* machine type (see param.h) */
u_char id_ether[6]; /* ethernet address */
int id_date; /* date of manufacture */
u_char id_hostid[3]; /* ``host id'' bytes */
u_char id_checksum; /* xor of everything else */
char id_undef[16]; /* undefined */
};
#define ID_SUN4_100 0x22
#define ID_SUN4_200 0x21
#define ID_SUN4_300 0x23
#define ID_SUN4_400 0x24
#define IDPROM_VERSION 1
#endif /* !_MACHINE_IDPROM_H_ */

137
sys/sun4v/include/ieee.h Normal file
View File

@ -0,0 +1,137 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
* from: NetBSD: ieee.h,v 1.1.1.1 1998/06/20 04:58:51 eeh Exp
* $FreeBSD$
*/
#ifndef _MACHINE_IEEE_H_
#define _MACHINE_IEEE_H_
/*
* ieee.h defines the machine-dependent layout of the machine's IEEE
* floating point. It does *not* define (yet?) any of the rounding
* mode bits, exceptions, and so forth.
*/
/*
* Define the number of bits in each fraction and exponent.
*
* k k+1
* Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
*
* (-exp_bias+1)
* as fractions that look like 0.fffff x 2 . This means that
*
* -126
* the number 0.10000 x 2 , for instance, is the same as the normalized
*
* -127 -128
* float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
*
* -129
* in the fraction; to represent 2 , we need two, and so on. This
*
* (-exp_bias-fracbits+1)
* implies that the smallest denormalized number is 2
*
* for whichever format we are talking about: for single precision, for
*
* -126 -149
* instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
*
* -149 == -127 - 23 + 1.
*/
#define SNG_EXPBITS 8
#define SNG_FRACBITS 23
#define DBL_EXPBITS 11
#define DBL_FRACBITS 52
#ifdef notyet
#define E80_EXPBITS 15
#define E80_FRACBITS 64
#endif
#define EXT_EXPBITS 15
#define EXT_FRACBITS 112
struct ieee_single {
u_int sng_sign:1;
u_int sng_exp:8;
u_int sng_frac:23;
};
struct ieee_double {
u_int dbl_sign:1;
u_int dbl_exp:11;
u_int dbl_frach:20;
u_int dbl_fracl;
};
struct ieee_ext {
u_int ext_sign:1;
u_int ext_exp:15;
u_int ext_frach:16;
u_int ext_frachm;
u_int ext_fraclm;
u_int ext_fracl;
};
/*
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
* Floats whose exponent is zero are either zero (iff all fraction
* bits are zero) or subnormal values.
*
* A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
* high fraction; if the bit is set, it is a `quiet NaN'.
*/
#define SNG_EXP_INFNAN 255
#define DBL_EXP_INFNAN 2047
#define EXT_EXP_INFNAN 32767
#if 0
#define SNG_QUIETNAN (1 << 22)
#define DBL_QUIETNAN (1 << 19)
#define EXT_QUIETNAN (1 << 15)
#endif
/*
* Exponent biases.
*/
#define SNG_EXP_BIAS 127
#define DBL_EXP_BIAS 1023
#define EXT_EXP_BIAS 16383
#endif

View File

@ -0,0 +1,26 @@
/*-
* Written by J.T. Conklin, Apr 6, 1995
* Public domain.
* $FreeBSD$
*/
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_
#include <machine/fsr.h>
typedef int fp_except_t;
#define FP_X_IMP FSR_NX /* imprecise (loss of precision) */
#define FP_X_DZ FSR_DZ /* divide-by-zero exception */
#define FP_X_UFL FSR_UF /* underflow exception */
#define FP_X_OFL FSR_OF /* overflow exception */
#define FP_X_INV FSR_NV /* invalid operation exception */
typedef enum {
FP_RN = FSR_RD_N, /* round to nearest representable number */
FP_RZ = FSR_RD_Z, /* round to zero (truncate) */
FP_RP = FSR_RD_PINF, /* round toward positive infinity */
FP_RM = FSR_RD_NINF /* round toward negative infinity */
} fp_rnd_t;
#endif /* _MACHINE_IEEEFP_H_ */

View File

@ -0,0 +1,169 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*-
* Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* from tahoe: in_cksum.c 1.2 86/01/05
* from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
* from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
* from: FreeBSD: src/sys/alpha/include/in_cksum.h,v 1.5 2000/05/06
*
* $FreeBSD$
*/
#ifndef _MACHINE_IN_CKSUM_H_
#define _MACHINE_IN_CKSUM_H_ 1
#include <sys/cdefs.h>
#define in_cksum(m, len) in_cksum_skip(m, len, 0)
static __inline void
in_cksum_update(struct ip *ip)
{
int __tmp;
__tmp = (int)ip->ip_sum + 1;
ip->ip_sum = __tmp + (__tmp >> 16);
}
static __inline u_short
in_addword(u_short sum, u_short b)
{
u_long __ret, __tmp;
__asm(
"sll %2, 16, %0\n"
"sll %3, 16, %1\n"
"addcc %0, %1, %0\n"
"srl %0, 16, %0\n"
"addc %0, 0, %0\n"
: "=&r" (__ret), "=&r" (__tmp) : "r" (sum), "r" (b));
return (__ret);
}
static __inline u_short
in_pseudo(u_int sum, u_int b, u_int c)
{
u_long __tmp;
__asm(
"addcc %0, %3, %0\n"
"addccc %0, %4, %0\n"
"addc %0, 0, %0\n"
"sll %0, 16, %1\n"
"addcc %0, %1, %0\n"
"srl %0, 16, %0\n"
"addc %0, 0, %0\n"
: "=r" (sum), "=&r" (__tmp) : "0" (sum), "r" (b), "r" (c));
return (sum);
}
static __inline u_int
in_cksum_hdr(struct ip *ip)
{
u_long __ret, __tmp1, __tmp2, __tmp3, __tmp4;
/*
* Use 32 bit memory accesses and additions - addition with carry only
* works for 32 bits, and fixing up alignment issues for 64 is probably
* more trouble than it's worth.
* This may read outside of the ip header, but does not cross a page
* boundary in doing so, so that should be OK.
* Actually, this specialized implementation might be overkill - using
* a generic implementation for both in_cksum_skip and in_cksum_hdr
* should not be too much more expensive.
*/
#define __LD_ADD(addr, tmp, sum, offs, mod) \
"lduw [" #addr " + " #offs "], " #tmp "\n" \
"add" # mod " " #sum ", " #tmp ", " #sum "\n"
__asm(
"and %5, 3, %3\n"
"andn %5, 3, %1\n"
"brz,pt %3, 0f\n"
" lduw [%1], %0\n"
"mov 4, %4\n"
"sub %4, %3, %4\n"
"sll %4, 3, %4\n" /* fix up unaligned buffers */
"mov 1, %2\n"
"sll %2, %4, %4\n"
"sub %4, 1, %4\n"
"lduw [%1 + 20], %2\n"
"andn %2, %4, %2\n"
"and %0, %4, %0\n"
"or %0, %2, %0\n"
"0:\n"
__LD_ADD(%1, %2, %0, 4, cc)
__LD_ADD(%1, %2, %0, 8, ccc)
__LD_ADD(%1, %2, %0, 12, ccc)
__LD_ADD(%1, %2, %0, 16, ccc)
"addc %0, 0, %0\n" /* reduce */
"1:\n"
"sll %0, 16, %2\n"
"addcc %0, %2, %0\n"
"srl %0, 16, %0\n"
"addc %0, 0, %0\n"
"andcc %3, 1, %3\n" /* need to byte-swap? */
"clr %3\n"
"bne,a,pn %%xcc, 1b\n"
" sll %0, 8, %0\n"
"not %0\n"
"sll %0, 16, %0\n"
"srl %0, 16, %0\n"
: "=&r" (__ret), "=r" (__tmp1), "=&r" (__tmp2), "=&r" (__tmp3),
"=&r" (__tmp4) : "1" (ip));
#undef __LD_ADD
return (__ret);
}
u_short in_cksum_skip(struct mbuf *m, int len, int skip);
#endif /* _MACHINE_IN_CKSUM_H_ */

618
sys/sun4v/include/instr.h Normal file
View File

@ -0,0 +1,618 @@
/*-
* Copyright (c) 1994 David S. Miller, davem@nadzieja.rutgers.edu
* Copyright (c) 1995 Paul Kranenburg
* Copyright (c) 2001 Thomas Moestl <tmm@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by David Miller.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* from: NetBSD: db_disasm.c,v 1.9 2000/08/16 11:29:42 pk Exp
*
* $FreeBSD$
*/
#ifndef _MACHINE_INSTR_H_
#define _MACHINE_INSTR_H_
/*
* Definitions for all instruction formats
*/
#define IF_OP_SHIFT 30
#define IF_OP_BITS 2
#define IF_IMM_SHIFT 0 /* Immediate/Displacement */
/*
* Definitions for format 2
*/
#define IF_F2_RD_SHIFT 25
#define IF_F2_RD_BITS 5
#define IF_F2_A_SHIFT 29
#define IF_F2_A_BITS 1
#define IF_F2_COND_SHIFT 25
#define IF_F2_COND_BITS 4
#define IF_F2_RCOND_SHIFT 25
#define IF_F2_RCOND_BITS 3
#define IF_F2_OP2_SHIFT 22
#define IF_F2_OP2_BITS 3
#define IF_F2_CC1_SHIFT 21
#define IF_F2_CC1_BITS 1
#define IF_F2_CC0_SHIFT 20
#define IF_F2_CC0_BITS 1
#define IF_F2_CC_SHIFT 20 /* CC0 and CC1 combined. */
#define IF_F2_CC_BITS 2
#define IF_F2_D16HI_SHIFT 20
#define IF_F2_D16HI_BITS 2
#define IF_F2_P_SHIFT 19
#define IF_F2_P_BITS 1
#define IF_F2_RS1_SHIFT 14
#define IF_F2_RS1_BITS 5
/*
* Definitions for format 3
*/
#define IF_F3_OP3_SHIFT 19
#define IF_F3_OP3_BITS 6
#define IF_F3_RD_SHIFT IF_F2_RD_SHIFT
#define IF_F3_RD_BITS IF_F2_RD_BITS
#define IF_F3_FCN_SHIFT 25
#define IF_F3_FCN_BITS 5
#define IF_F3_CC1_SHIFT 26
#define IF_F3_CC1_BITS 1
#define IF_F3_CC0_SHIFT 25
#define IF_F3_CC0_BITS 1
#define IF_F3_CC_SHIFT 25 /* CC0 and CC1 combined. */
#define IF_F3_CC_BITS 2
#define IF_F3_RS1_SHIFT IF_F2_RS1_SHIFT
#define IF_F3_RS1_BITS IF_F2_RS1_BITS
#define IF_F3_I_SHIFT 13
#define IF_F3_I_BITS 1
#define IF_F3_X_SHIFT 12
#define IF_F3_X_BITS 1
#define IF_F3_RCOND_SHIFT 10
#define IF_F3_RCOND_BITS 3
#define IF_F3_IMM_ASI_SHIFT 5
#define IF_F3_IMM_ASI_BITS 8
#define IF_F3_OPF_SHIFT 5
#define IF_F3_OPF_BITS 9
#define IF_F3_CMASK_SHIFT 4
#define IF_F3_CMASK_BITS 3
#define IF_F3_RS2_SHIFT 0
#define IF_F3_RS2_BITS 5
#define IF_F3_SHCNT32_SHIFT 0
#define IF_F3_SHCNT32_BITS 5
#define IF_F3_SHCNT64_SHIFT 0
#define IF_F3_SHCNT64_BITS 6
/*
* Definitions for format 4
*/
#define IF_F4_OP3_SHIFT IF_F3_OP3_SHIFT
#define IF_F4_OP3_BITS IF_F3_OP3_BITS
#define IF_F4_RD_SHIFT IF_F2_RD_SHIFT
#define IF_F4_RD_BITS IF_F2_RD_BITS
#define IF_F4_RS1_SHIFT IF_F2_RS1_SHIFT
#define IF_F4_RS1_BITS IF_F2_RS1_BITS
#define IF_F4_TCOND_SHIFT IF_F2_COND_SHIFT /* cond for Tcc */
#define IF_F4_TCOND_BITS IF_F2_COND_BITS
#define IF_F4_CC2_SHIFT 18
#define IF_F4_CC2_BITS 1
#define IF_F4_COND_SHIFT 14
#define IF_F4_COND_BITS 4
#define IF_F4_I_SHIFT IF_F3_I_SHIFT
#define IF_F4_I_BITS IF_F3_I_BITS
#define IF_F4_OPF_CC_SHIFT 11
#define IF_F4_OPF_CC_BITS 3
#define IF_F4_CC1_SHIFT 12
#define IF_F4_CC1_BITS 1
#define IF_F4_CC0_SHIFT 11
#define IF_F4_CC0_BITS 1
#define IF_F4_RCOND_SHIFT IF_F3_RCOND_SHIFT
#define IF_F4_RCOND_BITS IF_F3_RCOND_BITS
#define IF_F4_OPF_LOW_SHIFT 5
#define IF_F4_RS2_SHIFT IF_F3_RS2_SHIFT
#define IF_F4_RS2_BITS IF_F3_RS2_BITS
#define IF_F4_SW_TRAP_SHIFT 0
#define IF_F4_SW_TRAP_BITS 7
/*
* Macros to decode instructions
*/
/* Extract a field */
#define IF_MASK(s, w) (((1 << (w)) - 1) << (s))
#define IF_EXTRACT(x, s, w) (((x) & IF_MASK((s), (w))) >> (s))
#define IF_DECODE(x, f) \
IF_EXTRACT((x), IF_ ## f ## _SHIFT, IF_ ## f ## _BITS)
/* Sign-extend a field of width W */
#define IF_SEXT(x, w) \
(((x) & (1L << ((w) - 1))) != 0 ? \
(-1L - ((x) ^ ((1L << (w)) - 1))) : (x))
#if 0
/*
* The following C variant is from db_disassemble.c, and surely faster, but it
* relies on behaviour that is undefined by the C standard (>> in conjunction
* with signed negative arguments).
*/
#define IF_SEXT(v, w) ((((long long)(v)) << (64 - w)) >> (64 - w))
/* Assembler version of the above */
#define IF_SEXT(v, w) \
{ u_long t; ( __asm __volatile("sllx %1, %2, %0; srax %0, %2, %0" :
"=r" (t) : "r" (v) : "i" (64 - w)); t)}
#endif
/* All instruction formats */
#define IF_OP(i) IF_DECODE(i, OP)
/* Instruction format 2 */
#define IF_F2_RD(i) IF_DECODE((i), F2_RD)
#define IF_F2_A(i) IF_DECODE((i), F2_A)
#define IF_F2_COND(i) IF_DECODE((i), F2_COND)
#define IF_F2_RCOND(i) IF_DECODE((i), F2_RCOND)
#define IF_F2_OP2(i) IF_DECODE((i), F2_OP2)
#define IF_F2_CC1(i) IF_DECODE((i), F2_CC1)
#define IF_F2_CC0(i) IF_DECODE((i), F2_CC0)
#define IF_F2_CC(i) IF_DECODE((i), F2_CC)
#define IF_F2_D16HI(i) IF_DECODE((i), F2_D16HI)
#define IF_F2_P(i) IF_DECODE((i), F2_P)
#define IF_F2_RS1(i) IF_DECODE((i), F2_RS1)
/* Instruction format 3 */
#define IF_F3_OP3(i) IF_DECODE((i), F3_OP3)
#define IF_F3_RD(i) IF_F2_RD((i))
#define IF_F3_FCN(i) IF_DECODE((i), F3_FCN)
#define IF_F3_CC1(i) IF_DECODE((i), F3_CC1)
#define IF_F3_CC0(i) IF_DECODE((i), F3_CC0)
#define IF_F3_CC(i) IF_DECODE((i), F3_CC)
#define IF_F3_RS1(i) IF_F2_RS1((i))
#define IF_F3_I(i) IF_DECODE((i), F3_I)
#define IF_F3_X(i) IF_DECODE((i), F3_X)
#define IF_F3_RCOND(i) IF_DECODE((i), F3_RCOND)
#define IF_F3_IMM_ASI(i) IF_DECODE((i), F3_IMM_ASI)
#define IF_F3_OPF(i) IF_DECODE((i), F3_OPF)
#define IF_F3_CMASK(i) IF_DECODE((i), F3_CMASK)
#define IF_F3_RS2(i) IF_DECODE((i), F3_RS2)
#define IF_F3_SHCNT32(i) IF_DECODE((i), F3_SHCNT32)
#define IF_F3_SHCNT64(i) IF_DECODE((i), F3_SHCNT64)
/* Instruction format 4 */
#define IF_F4_OP3(i) IF_F3_OP3((i))
#define IF_F4_RD(i) IF_F3_RD((i))
#define IF_F4_TCOND(i) IF_DECODE((i), F4_TCOND)
#define IF_F4_RS1(i) IF_F3_RS1((i))
#define IF_F4_CC2(i) IF_DECODE((i), F4_CC2)
#define IF_F4_COND(i) IF_DECODE((i), F4_COND)
#define IF_F4_I(i) IF_F3_I((i))
#define IF_F4_OPF_CC(i) IF_DECODE((i), F4_OPF_CC)
#define IF_F4_RCOND(i) IF_F3_RCOND((i))
#define IF_F4_OPF_LOW(i, w) IF_EXTRACT((i), IF_F4_OPF_LOW_SHIFT, (w))
#define IF_F4_RS2(i) IF_F3_RS2((i))
#define IF_F4_SW_TRAP(i) IF_DECODE((i), F4_SW_TRAP)
/* Extract an immediate from an instruction, with an without sign extension */
#define IF_IMM(i, w) IF_EXTRACT((i), IF_IMM_SHIFT, (w))
#define IF_SIMM(i, w) ({ u_long b = (w), x = IF_IMM((i), b); IF_SEXT((x), b); })
/*
* Macros to encode instructions
*/
#define IF_INSERT(x, s, w) (((x) & ((1 << (w)) - 1)) << (s))
#define IF_ENCODE(x, f) \
IF_INSERT((x), IF_ ## f ## _SHIFT, IF_ ## f ## _BITS)
/* All instruction formats */
#define EIF_OP(x) IF_ENCODE((x), OP)
/* Instruction format 2 */
#define EIF_F2_RD(x) IF_ENCODE((x), F2_RD)
#define EIF_F2_A(x) IF_ENCODE((x), F2_A)
#define EIF_F2_COND(x) IF_ENCODE((x), F2_COND)
#define EIF_F2_RCOND(x) IF_ENCODE((x), F2_RCOND)
#define EIF_F2_OP2(x) IF_ENCODE((x), F2_OP2)
#define EIF_F2_CC1(x) IF_ENCODE((x), F2_CC1)
#define EIF_F2_CC0(x) IF_ENCODE((x), F2_CC0)
#define EIF_F2_D16HI(x) IF_ENCODE((x), F2_D16HI)
#define EIF_F2_P(x) IF_ENCODE((x), F2_P)
#define EIF_F2_RS1(x) IF_ENCODE((x), F2_RS1)
/* Instruction format 3 */
#define EIF_F3_OP3(x) IF_ENCODE((x), F3_OP3)
#define EIF_F3_RD(x) EIF_F2_RD((x))
#define EIF_F3_FCN(x) IF_ENCODE((x), F3_FCN)
#define EIF_F3_CC1(x) IF_ENCODE((x), F3_CC1)
#define EIF_F3_CC0(x) IF_ENCODE((x), F3_CC0)
#define EIF_F3_RS1(x) EIF_F2_RS1((x))
#define EIF_F3_I(x) IF_ENCODE((x), F3_I)
#define EIF_F3_X(x) IF_ENCODE((x), F3_X)
#define EIF_F3_RCOND(x) IF_ENCODE((x), F3_RCOND)
#define EIF_F3_IMM_ASI(x) IF_ENCODE((x), F3_IMM_ASI)
#define EIF_F3_OPF(x) IF_ENCODE((x), F3_OPF)
#define EIF_F3_CMASK(x) IF_ENCODE((x), F3_CMASK)
#define EIF_F3_RS2(x) IF_ENCODE((x), F3_RS2)
#define EIF_F3_SHCNT32(x) IF_ENCODE((x), F3_SHCNT32)
#define EIF_F3_SHCNT64(x) IF_ENCODE((x), F3_SHCNT64)
/* Instruction format 4 */
#define EIF_F4_OP3(x) EIF_F3_OP3((x))
#define EIF_F4_RD(x) EIF_F2_RD((x))
#define EIF_F4_TCOND(x) IF_ENCODE((x), F4_TCOND)
#define EIF_F4_RS1(x) EIF_F2_RS1((x))
#define EIF_F4_CC2(x) IF_ENCODE((x), F4_CC2)
#define EIF_F4_COND(x) IF_ENCODE((x), F4_COND)
#define EIF_F4_I(x) EIF_F3_I((x))
#define EIF_F4_OPF_CC(x) IF_ENCODE((x), F4_OPF_CC)
#define EIF_F4_RCOND(x) EIF_F3_RCOND((x))
#define EIF_F4_OPF_LOW(i, w) IF_INSERT((x), IF_F4_OPF_CC_SHIFT, (w))
#define EIF_F4_RS2(x) EIF_F3_RS2((x))
#define EIF_F4_SW_TRAP(x) IF_ENCODE((x), F4_SW_TRAP)
/* Immediates */
#define EIF_IMM(x, w) IF_INSERT((x), IF_IMM_SHIFT, (w))
#define EIF_SIMM(x, w) IF_EIMM((x), (w))
/*
* OP field values (specifying the instruction format)
*/
#define IOP_FORM2 0x00 /* Format 2: sethi, branches */
#define IOP_CALL 0x01 /* Format 1: call */
#define IOP_MISC 0x02 /* Format 3 or 4: arith & misc */
#define IOP_LDST 0x03 /* Format 4: loads and stores */
/*
* OP2/OP3 values (specifying the actual instruction)
*/
/* OP2 values for format 2 (OP = 0) */
#define INS0_ILLTRAP 0x00
#define INS0_BPcc 0x01
#define INS0_Bicc 0x02
#define INS0_BPr 0x03
#define INS0_SETHI 0x04 /* with rd = 0 and imm22 = 0, nop */
#define INS0_FBPfcc 0x05
#define INS0_FBfcc 0x06
/* undefined 0x07 */
/* OP3 values for Format 3 and 4 (OP = 2) */
#define INS2_ADD 0x00
#define INS2_AND 0x01
#define INS2_OR 0x02
#define INS2_XOR 0x03
#define INS2_SUB 0x04
#define INS2_ANDN 0x05
#define INS2_ORN 0x06
#define INS2_XNOR 0x07
#define INS2_ADDC 0x08
#define INS2_MULX 0x09
#define INS2_UMUL 0x0a
#define INS2_SMUL 0x0b
#define INS2_SUBC 0x0c
#define INS2_UDIVX 0x0d
#define INS2_UDIV 0x0e
#define INS2_SDIV 0x0f
#define INS2_ADDcc 0x10
#define INS2_ANDcc 0x11
#define INS2_ORcc 0x12
#define INS2_XORcc 0x13
#define INS2_SUBcc 0x14
#define INS2_ANDNcc 0x15
#define INS2_ORNcc 0x16
#define INS2_XNORcc 0x17
#define INS2_ADDCcc 0x18
/* undefined 0x19 */
#define INS2_UMULcc 0x1a
#define INS2_SMULcc 0x1b
#define INS2_SUBCcc 0x1c
/* undefined 0x1d */
#define INS2_UDIVcc 0x1e
#define INS2_SDIVcc 0x1f
#define INS2_TADDcc 0x20
#define INS2_TSUBcc 0x21
#define INS2_TADDccTV 0x22
#define INS2_TSUBccTV 0x23
#define INS2_MULScc 0x24
#define INS2_SSL 0x25 /* SLLX when IF_X(i) == 1 */
#define INS2_SRL 0x26 /* SRLX when IF_X(i) == 1 */
#define INS2_SRA 0x27 /* SRAX when IF_X(i) == 1 */
#define INS2_RD 0x28 /* and MEMBAR, STBAR */
/* undefined 0x29 */
#define INS2_RDPR 0x2a
#define INS2_FLUSHW 0x2b
#define INS2_MOVcc 0x2c
#define INS2_SDIVX 0x2d
#define INS2_POPC 0x2e /* undefined if IF_RS1(i) != 0 */
#define INS2_MOVr 0x2f
#define INS2_WR 0x30 /* and SIR */
#define INS2_SV_RSTR 0x31 /* saved, restored */
#define INS2_WRPR 0x32
/* undefined 0x33 */
#define INS2_FPop1 0x34 /* further encoded in opf field */
#define INS2_FPop2 0x35 /* further encoded in opf field */
#define INS2_IMPLDEP1 0x36
#define INS2_IMPLDEP2 0x37
#define INS2_JMPL 0x38
#define INS2_RETURN 0x39
#define INS2_Tcc 0x3a
#define INS2_FLUSH 0x3b
#define INS2_SAVE 0x3c
#define INS2_RESTORE 0x3d
#define INS2_DONE_RETR 0x3e /* done, retry */
/* undefined 0x3f */
/* OP3 values for format 3 (OP = 3) */
#define INS3_LDUW 0x00
#define INS3_LDUB 0x01
#define INS3_LDUH 0x02
#define INS3_LDD 0x03
#define INS3_STW 0x04
#define INS3_STB 0x05
#define INS3_STH 0x06
#define INS3_STD 0x07
#define INS3_LDSW 0x08
#define INS3_LDSB 0x09
#define INS3_LDSH 0x0a
#define INS3_LDX 0x0b
/* undefined 0x0c */
#define INS3_LDSTUB 0x0d
#define INS3_STX 0x0e
#define INS3_SWAP 0x0f
#define INS3_LDUWA 0x10
#define INS3_LDUBA 0x11
#define INS3_LDUHA 0x12
#define INS3_LDDA 0x13
#define INS3_STWA 0x14
#define INS3_STBA 0x15
#define INS3_STHA 0x16
#define INS3_STDA 0x17
#define INS3_LDSWA 0x18
#define INS3_LDSBA 0x19
#define INS3_LDSHA 0x1a
#define INS3_LDXA 0x1b
/* undefined 0x1c */
#define INS3_LDSTUBA 0x1d
#define INS3_STXA 0x1e
#define INS3_SWAPA 0x1f
#define INS3_LDF 0x20
#define INS3_LDFSR 0x21 /* and LDXFSR */
#define INS3_LDQF 0x22
#define INS3_LDDF 0x23
#define INS3_STF 0x24
#define INS3_STFSR 0x25 /* and STXFSR */
#define INS3_STQF 0x26
#define INS3_STDF 0x27
/* undefined 0x28 - 0x2c */
#define INS3_PREFETCH 0x2d
/* undefined 0x2e - 0x2f */
#define INS3_LDFA 0x30
/* undefined 0x31 */
#define INS3_LDQFA 0x32
#define INS3_LDDFA 0x33
#define INS3_STFA 0x34
/* undefined 0x35 */
#define INS3_STQFA 0x36
#define INS3_STDFA 0x37
/* undefined 0x38 - 0x3b */
#define INS3_CASA 0x39
#define INS3_PREFETCHA 0x3a
#define INS3_CASXA 0x3b
/*
* OPF values (floating point instructions, IMPLDEP)
*/
/*
* These values are or'ed to the FPop values to get the instructions.
* They describe the operand type(s).
*/
#define INSFP_i 0x000 /* 32-bit int */
#define INSFP_s 0x001 /* 32-bit single */
#define INSFP_d 0x002 /* 64-bit double */
#define INSFP_q 0x003 /* 128-bit quad */
/* FPop1. The comments give the types for which this instruction is defined. */
#define INSFP1_FMOV 0x000 /* s, d, q */
#define INSFP1_FNEG 0x004 /* s, d, q */
#define INSFP1_FABS 0x008 /* s, d, q */
#define INSFP1_FSQRT 0x028 /* s, d, q */
#define INSFP1_FADD 0x040 /* s, d, q */
#define INSFP1_FSUB 0x044 /* s, d, q */
#define INSFP1_FMUL 0x048 /* s, d, q */
#define INSFP1_FDIV 0x04c /* s, d, q */
#define INSFP1_FsMULd 0x068 /* s */
#define INSFP1_FdMULq 0x06c /* d */
#define INSFP1_FTOx 0x080 /* s, d, q */
#define INSFP1_FxTOs 0x084 /* special: i only */
#define INSFP1_FxTOd 0x088 /* special: i only */
#define INSFP1_FxTOq 0x08c /* special: i only */
#define INSFP1_FTOs 0x0c4 /* i, d, q */
#define INSFP1_FTOd 0x0c8 /* i, s, q */
#define INSFP1_FTOq 0x0cc /* i, s, d */
#define INSFP1_FTOi 0x0d0 /* i, s, d */
/* FPop2 */
#define INSFP2_FMOV_CCMUL 0x40
#define INSFP2_FMOV_CCOFFS 0x00
/* Use the IFCC_* constants for cc. Operand types: s, d, q */
#define INSFP2_FMOV_CC(cc) ((cc) * INSFP2_FMOV_CCMUL + INSFP2_FMOV_CCOFFS)
#define INSFP2_FMOV_RCMUL 0x20
#define INSFP2_FMOV_RCOFFS 0x04
/* Use the IRCOND_* constants for rc. Operand types: s, d, q */
#define INSFP2_FMOV_RC(rc) ((rc) * INSFP2_FMOV_RCMUL + INSFP2_FMOV_RCOFFS)
#define INSFP2_FCMP 0x050 /* s, d, q */
#define INSFP2_FCMPE 0x054 /* s, d, q */
/* Decode 5-bit register field into 6-bit number (for doubles and quads). */
#define INSFPdq_RN(rn) (((rn) & ~1) | (((rn) & 1) << 5))
/* IMPLDEP1 for Sun UltraSparc */
#define IIDP1_EDGE8 0x00
#define IIDP1_EDGE8N 0x01 /* US-III */
#define IIDP1_EDGE8L 0x02
#define IIDP1_EDGE8LN 0x03 /* US-III */
#define IIDP1_EDGE16 0x04
#define IIDP1_EDGE16N 0x05 /* US-III */
#define IIDP1_EDGE16L 0x06
#define IIDP1_EDGE16LN 0x07 /* US-III */
#define IIDP1_EDGE32 0x08
#define IIDP1_EDGE32N 0x09 /* US-III */
#define IIDP1_EDGE32L 0x0a
#define IIDP1_EDGE32LN 0x0b /* US-III */
#define IIDP1_ARRAY8 0x10
#define IIDP1_ARRAY16 0x12
#define IIDP1_ARRAY32 0x14
#define IIDP1_ALIGNADDRESS 0x18
#define IIDP1_BMASK 0x19 /* US-III */
#define IIDP1_ALIGNADDRESS_L 0x1a
#define IIDP1_FCMPLE16 0x20
#define IIDP1_FCMPNE16 0x22
#define IIDP1_FCMPLE32 0x24
#define IIDP1_FCMPNE32 0x26
#define IIDP1_FCMPGT16 0x28
#define IIDP1_FCMPEQ16 0x2a
#define IIDP1_FCMPGT32 0x2c
#define IIDP1_FCMPEQ32 0x2e
#define IIDP1_FMUL8x16 0x31
#define IIDP1_FMUL8x16AU 0x33
#define IIDP1_FMUL8X16AL 0x35
#define IIDP1_FMUL8SUx16 0x36
#define IIDP1_FMUL8ULx16 0x37
#define IIDP1_FMULD8SUx16 0x38
#define IIDP1_FMULD8ULx16 0x39
#define IIDP1_FPACK32 0x3a
#define IIDP1_FPACK16 0x3b
#define IIDP1_FPACKFIX 0x3d
#define IIDP1_PDIST 0x3e
#define IIDP1_FALIGNDATA 0x48
#define IIDP1_FPMERGE 0x4b
#define IIDP1_BSHUFFLE 0x4c /* US-III */
#define IIDP1_FEXPAND 0x4d
#define IIDP1_FPADD16 0x50
#define IIDP1_FPADD16S 0x51
#define IIDP1_FPADD32 0x52
#define IIDP1_FPADD32S 0x53
#define IIDP1_SUB16 0x54
#define IIDP1_SUB16S 0x55
#define IIDP1_SUB32 0x56
#define IIDP1_SUB32S 0x57
#define IIDP1_FZERO 0x60
#define IIDP1_FZEROS 0x61
#define IIDP1_FNOR 0x62
#define IIDP1_FNORS 0x63
#define IIDP1_FANDNOT2 0x64
#define IIDP1_FANDNOT2S 0x65
#define IIDP1_NOT2 0x66
#define IIDP1_NOT2S 0x67
#define IIDP1_FANDNOT1 0x68
#define IIDP1_FANDNOT1S 0x69
#define IIDP1_FNOT1 0x6a
#define IIDP1_FNOT1S 0x6b
#define IIDP1_FXOR 0x6c
#define IIDP1_FXORS 0x6d
#define IIDP1_FNAND 0x6e
#define IIDP1_FNANDS 0x6f
#define IIDP1_FAND 0x70
#define IIDP1_FANDS 0x71
#define IIDP1_FXNOR 0x72
#define IIDP1_FXNORS 0x73
#define IIDP1_FSRC1 0x74
#define IIDP1_FSRC1S 0x75
#define IIDP1_FORNOT2 0x76
#define IIDP1_FORNOT2S 0x77
#define IIDP1_FSRC2 0x78
#define IIDP1_FSRC2S 0x79
#define IIDP1_FORNOT1 0x7a
#define IIDP1_FORNOT1S 0x7b
#define IIDP1_FOR 0x7c
#define IIDP1_FORS 0x7d
#define IIDP1_FONE 0x7e
#define IIDP1_FONES 0x7f
#define IIDP1_SHUTDOWN 0x80
#define IIDP1_SIAM 0x81 /* US-III */
/*
* Instruction modifiers
*/
/* cond values for integer ccr's */
#define IICOND_N 0x00
#define IICOND_E 0x01
#define IICOND_LE 0x02
#define IICOND_L 0x03
#define IICOND_LEU 0x04
#define IICOND_CS 0x05
#define IICOND_NEG 0x06
#define IICOND_VS 0x07
#define IICOND_A 0x08
#define IICOND_NE 0x09
#define IICOND_G 0x0a
#define IICOND_GE 0x0b
#define IICOND_GU 0x0c
#define IICOND_CC 0x0d
#define IICOND_POS 0x0e
#define IICOND_VC 0x0f
/* cond values for fp ccr's */
#define IFCOND_N 0x00
#define IFCOND_NE 0x01
#define IFCOND_LG 0x02
#define IFCOND_UL 0x03
#define IFCOND_L 0x04
#define IFCOND_UG 0x05
#define IFCOND_G 0x06
#define IFCOND_U 0x07
#define IFCOND_A 0x08
#define IFCOND_E 0x09
#define IFCOND_UE 0x0a
#define IFCOND_GE 0x0b
#define IFCOND_UGE 0x0c
#define IFCOND_LE 0x0d
#define IFCOND_ULE 0x0e
#define IFCOND_O 0x0f
/* rcond values for BPr, MOVr, FMOVr */
#define IRCOND_Z 0x01
#define IRCOND_LEZ 0x02
#define IRCOND_LZ 0x03
#define IRCOND_NZ 0x05
#define IRCOND_GZ 0x06
#define IRCOND_GEZ 0x07
/* cc values for MOVcc and FMOVcc */
#define IFCC_ICC 0x04
#define IFCC_XCC 0x06
/* if true, the lower 2 bits are the fcc number */
#define IFCC_FCC(c) ((c) & 3)
#define IFCC_GET_FCC(c) ((c) & 3)
#define IFCC_ISFCC(c) (((c) & 4) == 0)
/* cc values for BPc and Tcc */
#define IBCC_ICC 0x00
#define IBCC_XCC 0x02
/*
* Integer registers
*/
#define IREG_G0 0x00
#define IREG_O0 0x08
#define IREG_L0 0x10
#define IREQ_I0 0x18
#endif /* !_MACHINE_INSTR_H_ */

View File

@ -0,0 +1,105 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_INTR_MACHDEP_H_
#define _MACHINE_INTR_MACHDEP_H_
#define IRSR_BUSY (1 << 5)
#define PIL_MAX (1 << 4)
#define IV_MAX (1 << 11)
#define IV_NAMLEN 1024
#define IR_FREE (PIL_MAX * 2)
#define IH_SHIFT PTR_SHIFT
#define IQE_SHIFT 5
#define IV_SHIFT 5
#define PIL_LOW 1 /* stray interrupts */
#define PIL_ITHREAD 2 /* interrupts that use ithreads */
#define PIL_RENDEZVOUS 3 /* smp rendezvous ipi */
#define PIL_AST 4 /* ast ipi */
#define PIL_STOP 5 /* stop cpu ipi */
#define PIL_FAST 13 /* fast interrupts */
#define PIL_TICK 14
struct trapframe;
typedef void ih_func_t(struct trapframe *);
typedef void iv_func_t(void *);
struct ithd;
struct intr_request {
struct intr_request *ir_next;
iv_func_t *ir_func;
void *ir_arg;
u_int ir_vec;
u_int ir_pri;
};
struct intr_vector {
iv_func_t *iv_func;
void *iv_arg;
struct intr_event *iv_event;
u_int iv_pri;
u_int iv_vec;
};
extern ih_func_t *intr_handlers[];
extern struct intr_vector intr_vectors[];
void intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf,
void *iva);
int inthand_add(const char *name, int vec, void (*handler)(void *),
void *arg, int flags, void **cookiep);
int inthand_remove(int vec, void *cookie);
void cpu_intrq_init(void);
ih_func_t intr_fast;
#define CPU_LIST_SIZE (MAXCPU * sizeof(uint16_t))
#define INTR_REPORT_SIZE 64
#define INTR_CPU_Q_SIZE (cpu_q_entries * INTR_REPORT_SIZE)
#define INTR_DEV_Q_SIZE (dev_q_entries * INTR_REPORT_SIZE)
#define CPU_RQ_ENTRIES 64
#define CPU_NRQ_ENTRIES 64
#define Q_ENTRY_SIZE 64
#define CPU_RQ_SIZE (CPU_RQ_ENTRIES * Q_ENTRY_SIZE)
#define CPU_NRQ_SIZE (CPU_NRQ_ENTRIES * Q_ENTRY_SIZE)
#endif

View File

@ -0,0 +1,180 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sbusreg.h 8.1 (Berkeley) 6/11/93
* from: NetBSD: iommureg.h,v 1.6 2001/07/20 00:07:13 eeh Exp
*
* $FreeBSD$
*/
#ifndef _MACHINE_IOMMUREG_H_
#define _MACHINE_IOMMUREG_H_
/*
* UltraSPARC IOMMU registers, common to both the sbus and PCI
* controllers.
*/
/* iommmu registers */
#define IMR_CTL 0x0000 /* IOMMU control register */
#define IMR_TSB 0x0008 /* IOMMU TSB base register */
#define IMR_FLUSH 0x0010 /* IOMMU flush register */
/* streaming buffer registers */
#define ISR_CTL 0x0000 /* streaming buffer control reg */
#define ISR_PGFLUSH 0x0008 /* streaming buffer page flush */
#define ISR_FLUSHSYNC 0x0010 /* streaming buffer flush sync */
/* streaming buffer diagnostics registers. */
#define ISD_DATA_DIAG 0x0000 /* streaming buffer data RAM diag 0..127 */
#define ISD_ERROR_DIAG 0x0400 /* streaming buffer error status diag 0..127 */
#define ISD_PG_TAG_DIAG 0x0800 /* streaming buffer page tag diag 0..15 */
#define ISD_LN_TAG_DIAG 0x0900 /* streaming buffer line tag diag 0..15 */
/* streaming buffer control register */
#define STRBUF_EN 0x0000000000000001UL
#define STRBUF_D 0x0000000000000002UL
#define IOMMU_BITS 34
#define IOMMU_MAXADDR (1UL << IOMMU_BITS)
/*
* control register bits
*/
/* Nummber of entries in IOTSB */
#define IOMMUCR_TSBSZ_SHIFT 16
#define IOMMUCR_TSB1K 0x0000000000000000UL
#define IOMMUCR_TSB2K 0x0000000000010000UL
#define IOMMUCR_TSB4K 0x0000000000020000UL
#define IOMMUCR_TSB8K 0x0000000000030000UL
#define IOMMUCR_TSB16K 0x0000000000040000UL
#define IOMMUCR_TSB32K 0x0000000000050000UL
#define IOMMUCR_TSB64K 0x0000000000060000UL
#define IOMMUCR_TSB128K 0x0000000000070000UL
/* Mask for above */
#define IOMMUCR_TSBMASK 0xfffffffffff8ffffUL
/* 8K iommu page size */
#define IOMMUCR_8KPG 0x0000000000000000UL
/* 64K iommu page size */
#define IOMMUCR_64KPG 0x0000000000000004UL
/* Diag enable */
#define IOMMUCR_DE 0x0000000000000002UL
/* Enable IOMMU */
#define IOMMUCR_EN 0x0000000000000001UL
/*
* Diagnostic register definitions.
*/
#define IOMMU_DTAG_VPNBITS 19
#define IOMMU_DTAG_VPNMASK ((1 << IOMMU_DTAG_VPNBITS) - 1)
#define IOMMU_DTAG_VPNSHIFT 13
#define IOMMU_DTAG_ERRBITS 3
#define IOMMU_DTAG_ERRSHIFT 22
#define IOMMU_DTAG_ERRMASK \
(((1 << IOMMU_DTAG_ERRBITS) - 1) << IOMMU_DTAG_ERRSHIFT)
#define IOMMU_DDATA_PGBITS 21
#define IOMMU_DDATA_PGMASK ((1 << IOMMU_DDATA_PGBITS) - 1)
#define IOMMU_DDATA_PGSHIFT 13
#define IOMMU_DDATA_C (1 << 28)
#define IOMMU_DDATA_V (1 << 30)
/*
* IOMMU stuff
*/
/* Entry valid */
#define IOTTE_V 0x8000000000000000UL
/* 8K or 64K page? */
#define IOTTE_64K 0x2000000000000000UL
#define IOTTE_8K 0x0000000000000000UL
/* Is page streamable? */
#define IOTTE_STREAM 0x1000000000000000UL
/* Accesses to same bus segment? */
#define IOTTE_LOCAL 0x0800000000000000UL
/* Let's assume this is correct */
#define IOTTE_PAMASK 0x000001ffffffe000UL
/* Accesses to cacheable space */
#define IOTTE_C 0x0000000000000010UL
/* Writeable */
#define IOTTE_W 0x0000000000000002UL
/* log2 of the IOMMU TTE size. */
#define IOTTE_SHIFT 3
/* Streaming buffer line size. */
#define STRBUF_LINESZ 64
/*
* Number of bytes written by a stream buffer flushsync operation to indicate
* completion.
*/
#define STRBUF_FLUSHSYNC_NBYTES STRBUF_LINESZ
/*
* On sun4u each bus controller has a separate IOMMU. The IOMMU has
* a TSB which must be page aligned and physically contiguous. Mappings
* can be of 8K IOMMU pages or 64K IOMMU pages. We use 8K for compatibility
* with the CPU's MMU.
*
* On sysio, psycho, and psycho+, IOMMU TSBs using 8K pages can map the
* following size segments:
*
* VA size VA base TSB size tsbsize
* -------- -------- --------- -------
* 8MB ff800000 8K 0
* 16MB ff000000 16K 1
* 32MB fe000000 32K 2
* 64MB fc000000 64K 3
* 128MB f8000000 128K 4
* 256MB f0000000 256K 5
* 512MB e0000000 512K 6
* 1GB c0000000 1MB 7
*
* Unfortunately, sabres on UltraSPARC IIi and IIe processors does not use
* this scheme to determine the IOVA base address. Instead, bits 31-29 are
* used to check against the Target Address Space register in the IIi and
* the the IOMMU is used if they hit. God knows what goes on in the IIe.
*
*/
#define IOTSB_BASESZ (1024 << IOTTE_SHIFT)
#define IOTSB_VEND (~IO_PAGE_MASK)
#define IOTSB_VSTART(sz) (u_int)(IOTSB_VEND << ((sz) + 10))
#define MAKEIOTTE(pa,w,c,s) \
(((pa) & IOTTE_PAMASK) | ((w) ? IOTTE_W : 0) | \
((c) ? IOTTE_C : 0) | ((s) ? IOTTE_STREAM : 0) | \
(IOTTE_V | IOTTE_8K))
#define IOTSBSLOT(va) \
((u_int)(((vm_offset_t)(va)) - (is->is_dvmabase)) >> IO_PAGE_SHIFT)
#endif /* !_MACHINE_IOMMUREG_H_ */

View File

@ -0,0 +1,99 @@
/*-
* Copyright (c) 1999 Matthew R. Green
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: NetBSD: iommuvar.h,v 1.9 2001/07/20 00:07:13 eeh Exp
*
* $FreeBSD$
*/
#ifndef _MACHINE_IOMMUVAR_H_
#define _MACHINE_IOMMUVAR_H_
#define IO_PAGE_SIZE PAGE_SIZE_8K
#define IO_PAGE_MASK PAGE_MASK_8K
#define IO_PAGE_SHIFT PAGE_SHIFT_8K
#define round_io_page(x) round_page(x)
#define trunc_io_page(x) trunc_page(x)
/*
* Per-IOMMU state. The parenthesized comments indicate the locking strategy:
* i - protected by iommu_mtx.
* r - read-only after initialization.
* * - comment refers to pointer target / target hardware registers
* (for bus_addr_t).
* iommu_map_lruq is also locked by iommu_mtx. Elements of iommu_tsb may only
* be accessed from functions operating on the map owning the corresponding
* resource, so the locking the user is required to do to protect the map is
* sufficient. As soon as the TSBs are divorced, these will be moved into struct
* iommu_state, and each state struct will get its own lock.
* iommu_dvma_rman needs to be moved there too, but has its own internal lock.
*/
struct iommu_state {
int is_tsbsize; /* (r) 0 = 8K, ... */
u_int64_t is_dvmabase; /* (r) */
int64_t is_cr; /* (r) Control reg value */
vm_paddr_t is_flushpa[2]; /* (r) */
volatile int64_t *is_flushva[2]; /* (r, *i) */
/*
* (i)
* When a flush is completed, 64 bytes will be stored at the given
* location, the first double word being 1, to indicate completion.
* The lower 6 address bits are ignored, so the addresses need to be
* suitably aligned; over-allocate a large enough margin to be able
* to adjust it.
* Two such buffers are needed.
*/
volatile char is_flush[STRBUF_FLUSHSYNC_NBYTES * 3 - 1];
/* copies of our parents state, to allow us to be self contained */
bus_space_tag_t is_bustag; /* (r) Our bus tag */
bus_space_handle_t is_bushandle; /* (r) */
bus_addr_t is_iommu; /* (r, *i) IOMMU registers */
bus_addr_t is_sb[2]; /* (r, *i) Streaming buffer */
/* Tag diagnostics access */
bus_addr_t is_dtag; /* (r, *r) */
/* Data RAM diagnostic access */
bus_addr_t is_ddram; /* (r, *r) */
/* LRU queue diag. access */
bus_addr_t is_dqueue; /* (r, *r) */
/* Virtual address diagnostics register */
bus_addr_t is_dva; /* (r, *r) */
/* Tag compare diagnostics access */
bus_addr_t is_dtcmp; /* (r, *r) */
STAILQ_ENTRY(iommu_state) is_link; /* (r) */
};
/* interfaces for PCI/SBUS code */
void iommu_init(char *, struct iommu_state *, int, u_int32_t, int);
void iommu_reset(struct iommu_state *);
void iommu_decode_fault(struct iommu_state *, vm_offset_t);
extern struct bus_dma_methods iommu_dma_methods;
#endif /* !_MACHINE_IOMMUVAR_H_ */

50
sys/sun4v/include/kdb.h Normal file
View File

@ -0,0 +1,50 @@
/*-
* Copyright (c) 2004 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_KDB_H_
#define _MACHINE_KDB_H_
#include <machine/cpufunc.h>
static __inline void
kdb_cpu_clear_singlestep(void)
{
}
static __inline void
kdb_cpu_set_singlestep(void)
{
}
static __inline void
kdb_cpu_trap(int vector, int _)
{
flushw();
}
#endif /* _MACHINE_KDB_H_ */

View File

@ -0,0 +1,51 @@
/*-
* Copyright (c) 2002 by Thomas Moestl <tmm@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_KERNELDUMP_H_
#define _MACHINE_KERNELDUMP_H_
struct sparc64_dump_reg {
vm_paddr_t dr_pa;
vm_offset_t dr_size;
vm_offset_t dr_offs;
};
/*
* Kernel dump format for sparc64. This does not use ELF because it is of no
* avail (only libkvm knows how to translate addresses properly anyway) and
* would require some ugly hacks.
*/
struct sparc64_dump_hdr {
vm_offset_t dh_hdr_size;
vm_paddr_t dh_tsb_pa;
vm_size_t dh_tsb_size;
vm_size_t dh_tsb_mask;
int dh_nregions;
struct sparc64_dump_reg dh_regions[];
};
#endif /* _MACHINE_KERNELDUMP_H_ */

95
sys/sun4v/include/ktr.h Normal file
View File

@ -0,0 +1,95 @@
/*-
* Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Berkeley Software Design Inc's name may not be used to endorse or
* promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from BSDI $Id: ktr.h,v 1.10.2.7 2000/03/16 21:44:42 cp Exp $
* $FreeBSD$
*/
#ifndef _MACHINE_KTR_H_
#define _MACHINE_KTR_H_
#include <sys/ktr.h>
#include <machine/upa.h>
#ifndef LOCORE
#define KTR_CPU PCPU_GET(cpuid)
#else
#define AND(var, mask, r1, r2) \
SET(var, r2, r1) ; \
lduw [r1], r2 ; \
and r2, mask, r1
#define TEST(var, mask, r1, r2, l1) \
AND(var, mask, r1, r2) ; \
brz r1, l1 ## f ; \
nop
/*
* XXX could really use another register...
*/
#define ATR(desc, r1, r2, r3, l1, l2) \
.sect .rodata ; \
l1: .asciz desc ; \
.previous ; \
SET(ktr_idx, r2, r1) ; \
lduw [r1], r2 ; \
l2: add r2, 1, r3 ; \
set KTR_ENTRIES - 1, r1 ; \
and r3, r1, r3 ; \
set ktr_idx, r1 ; \
casa [r1] ASI_N, r2, r3 ; \
cmp r2, r3 ; \
bne %icc, l2 ## b ; \
mov r3, r2 ; \
SET(ktr_buf, r3, r1) ; \
mulx r2, KTR_SIZEOF, r2 ; \
add r1, r2, r1 ; \
rd %tick, r2 ; \
stx r2, [r1 + KTR_TIMESTAMP] ; \
UPA_GET_MID(r2) ; \
stw r2, [r1 + KTR_CPU] ; \
stw %g0, [r1 + KTR_LINE] ; \
stx %g0, [r1 + KTR_FILE] ; \
SET(l1 ## b, r3, r2) ; \
stx r2, [r1 + KTR_DESC]
#define CATR(mask, desc, r1, r2, r3, l1, l2, l3) \
set mask, r1 ; \
TEST(ktr_mask, r1, r2, r2, l3) ; \
UPA_GET_MID(r1) ; \
mov 1, r2 ; \
sllx r2, r1, r1 ; \
TEST(ktr_cpumask, r1, r2, r3, l3) ; \
ATR(desc, r1, r2, r3, l1, l2)
#endif /* LOCORE */
#endif /* !_MACHINE_KTR_H_ */

View File

@ -0,0 +1,41 @@
/*-
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.3 (Berkeley) 1/4/94
* $FreeBSD$
*/
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
#include <sys/cdefs.h>
#if __CC_SUPPORTS_WARNING
#warning "machine/limits.h is deprecated. Include sys/limits.h instead."
#endif
#include <sys/limits.h>
#endif /* !_MACHINE_LIMITS_H_ */

68
sys/sun4v/include/lsu.h Normal file
View File

@ -0,0 +1,68 @@
/*-
* Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_LSU_H_
#define _MACHINE_LSU_H_
/*
* Definitions for the Load-Store-Unit Control Register. This is called
* Data Cache Unit Control Register (DCUCR) for UltraSPARC-III.
*/
#define LSU_IC (1UL << 0)
#define LSU_DC (1UL << 1)
#define LSU_IM (1UL << 2)
#define LSU_DM (1UL << 3)
/* Parity control mask, UltraSPARC-I and II series only. */
#define LSU_FM_SHIFT 4
#define LSU_FM_BITS 16
#define LSU_FM_MASK (((1UL << LSU_FM_BITS) - 1) << LSU_FM_SHIFT)
#define LSU_VM_SHIFT 25
#define LSU_VM_BITS 8
#define LSU_VM_MASK (((1UL << LSU_VM_BITS) - 1) << LSU_VM_SHIFT)
#define LSU_PM_SHIFT 33
#define LSU_PM_BITS 8
#define LSU_PM_MASK (((1UL << LSU_PM_BITS) - 1) << LSU_PM_SHIFT)
#define LSU_VW (1UL << 21)
#define LSU_VR (1UL << 22)
#define LSU_PW (1UL << 23)
#define LSU_PR (1UL << 24)
/* The following bits are valid for the UltraSPARC-III series only. */
#define LSU_WE (1UL << 41)
#define LSU_SL (1UL << 42)
#define LSU_SPE (1UL << 43)
#define LSU_HPE (1UL << 44)
#define LSU_PE (1UL << 45)
#define LSU_RE (1UL << 46)
#define LSU_ME (1UL << 47)
#define LSU_CV (1UL << 48)
#define LSU_CP (1UL << 49)
#endif /* _MACHINE_LSU_H_ */

View File

@ -0,0 +1,63 @@
/*-
* Copyright (c) 1995 Bruce D. Evans.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: FreeBSD: src/sys/i386/include/md_var.h,v 1.40 2001/07/12
* $FreeBSD$
*/
#ifndef _MACHINE_MD_VAR_H_
#define _MACHINE_MD_VAR_H_
typedef void cpu_block_copy_t(const void *src, void *dst, size_t len);
typedef void cpu_block_zero_t(void *dst, size_t len);
extern char tl0_base[], tl0_end[];
extern char _end[];
extern long Maxmem;
extern vm_offset_t kstack0;
extern vm_paddr_t kstack0_phys;
struct pcpu;
struct md_utrap;
void cpu_identify(u_long vers, u_int clock, u_int id);
void cpu_setregs(struct pcpu *pc);
int is_physical_memory(vm_paddr_t addr);
struct md_utrap *utrap_alloc(void);
void utrap_free(struct md_utrap *ut);
struct md_utrap *utrap_hold(struct md_utrap *ut);
extern cpu_block_copy_t *cpu_block_copy;
extern cpu_block_zero_t *cpu_block_zero;
#endif /* !_MACHINE_MD_VAR_H_ */

View File

@ -0,0 +1,72 @@
/*-
* Copyright (c) 2006 Kip Macy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_MDESC_BUS_H_
#define _MACHINE_MDESC_BUS_H_
#include <sys/bus.h>
#include <machine/mdesc_bus_subr.h>
#include "mdesc_bus_if.h"
static __inline const char *
mdesc_bus_get_compat(device_t dev)
{
return (MDESC_BUS_GET_COMPAT(device_get_parent(dev), dev));
}
static __inline const struct mdesc_bus_devinfo *
mdesc_bus_get_model(device_t dev)
{
return (MDESC_BUS_GET_DEVINFO(device_get_parent(dev), dev));
}
static __inline const char *
mdesc_bus_get_name(device_t dev)
{
return (MDESC_BUS_GET_NAME(device_get_parent(dev), dev));
}
static __inline const char *
mdesc_bus_get_type(device_t dev)
{
return (MDESC_BUS_GET_TYPE(device_get_parent(dev), dev));
}
static __inline uint64_t
mdesc_bus_get_handle(device_t dev)
{
return (MDESC_BUS_GET_HANDLE(device_get_parent(dev), dev));
}
#endif /* !_MACHINE_MDESC_BUS_H_ */

View File

@ -0,0 +1,47 @@
/*-
* Copyright (c) 2006 Kip Macy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_MDESC_MDESC_BUS_SUBR_H_
#define _MACHINE_MDESC_MDESC_BUS_SUBR_H_
#include <sys/bus.h>
#include <machine/cddl/mdesc.h>
#include <machine/cddl/mdesc_impl.h>
#include "mdesc_bus_if.h"
int mdesc_bus_gen_setup_devinfo(struct mdesc_bus_devinfo *, mde_cookie_t);
void mdesc_bus_gen_destroy_devinfo(struct mdesc_bus_devinfo *);
mdesc_bus_get_compat_t mdesc_bus_gen_get_compat;
mdesc_bus_get_name_t mdesc_bus_gen_get_name;
mdesc_bus_get_type_t mdesc_bus_gen_get_type;
mdesc_bus_get_handle_t mdesc_bus_gen_get_handle;
#endif /* !_MACHINE_MDESC_MDESC_BUS_SUBR_H_ */

View File

@ -0,0 +1,38 @@
/*-
* Copyright (c) 2004 Mark R V Murray
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#define CDEV_MAJOR 2
#define CDEV_MINOR_MEM 0
#define CDEV_MINOR_KMEM 1
d_open_t memopen;
d_read_t memrw;
#define memioctl (d_ioctl_t *)NULL
#define memmmap (d_mmap_t *)NULL
void dev_mem_md_init(void);

View File

@ -0,0 +1,45 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_METADATA_H_
#define _MACHINE_METADATA_H_
#define MODINFOMD_ENVP 0x1001
#define MODINFOMD_HOWTO 0x1002
#define MODINFOMD_KERNEND 0x1003
#define MODINFOMD_DTLB_SLOTS 0x1004
#define MODINFOMD_ITLB_SLOTS 0x1005
#define MODINFOMD_DTLB 0x1006
#define MODINFOMD_ITLB 0x1007
struct tlb_entry {
vm_offset_t te_pa;
vm_offset_t te_va;
};
#endif /* !_MACHINE_METADATA_H_ */

123
sys/sun4v/include/mmu.h Normal file
View File

@ -0,0 +1,123 @@
/*-
* Copyright (c) 2006 Kip Macy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_MMU_H_
#define _MACHINE_MMU_H_
#define FAST_IMMU_MISS_TT 0x64
#define FAST_DMMU_MISS_TT 0x68
#define FAST_PROT_TT 0x6c
/*
* Constants defining alternate spaces
* and register layouts within them,
* and a few other interesting assembly constants.
*/
/*
* vaddr offsets of various registers
*/
#define MMU_PCONTEXT 0x08 /* primary context number */
#define MMU_SCONTEXT 0x10 /* secondary context number */
/*
* Pseudo Synchronous Fault Status Register Layout
*
* IMMU and DMMU maintain their own pseudo SFSR Register
*
* +------------------------------------------------+
* | Reserved | Context | FT |
* +----------------------|-------------------------+
* 63 32 31 16 15 0
*
*/
#define SFSR_FT 0x0000FFFF /* fault type mask */
#define SFSR_CTX 0xFFFF0000 /* fault context mask */
/*
* Definition of FT (Fault Type) bit field of sfsr.
*/
#define FT_NONE 0x00
#define FT_PRIV MMFSA_F_PRIV /* privilege violation */
#define FT_SPEC_LD MMFSA_F_SOPG /* speculative ld to e page */
#define FT_ATOMIC_NC MMFSA_F_NCATM /* atomic to nc page */
#define FT_ILL_ALT MMFSA_F_INVASI /* illegal lda/sta */
#define FT_NFO MMFSA_F_NFO /* normal access to nfo page */
#define FT_RANGE MMFSA_F_INVVA /* dmmu or immu address out of range */
#define FT_NEW_FMISS MMFSA_F_FMISS /* fast miss */
#define FT_NEW_FPROT MMFSA_F_FPROT /* fast protection */
#define FT_NEW_MISS MMFSA_F_MISS /* mmu miss */
#define FT_NEW_INVRA MMFSA_F_INVRA /* invalid RA */
#define FT_NEW_PROT MMFSA_F_PROT /* protection violation */
#define FT_NEW_PRVACT MMFSA_F_PRVACT /* privileged action */
#define FT_NEW_WPT MMFSA_F_WPT /* watchpoint hit */
#define FT_NEW_UNALIGN MMFSA_F_UNALIGN /* unaligned access */
#define FT_NEW_INVPGSZ MMFSA_F_INVPGSZ /* invalid page size */
#define SFSR_FT_SHIFT 0 /* amt. to shift right to get flt type */
#define SFSR_CTX_SHIFT 16 /* to shift right to get context */
#define X_FAULT_TYPE(x) (((x) & SFSR_FT) >> SFSR_FT_SHIFT)
#define X_FAULT_CTX(x) (((x) & SFSR_CTX) >> SFSR_CTX_SHIFT)
/*
* MMU TAG TARGET register Layout
*
* +-----+---------+------+-------------------------+
* | 000 | context | -- | virtual address [63:22] |
* +-----+---------+------+-------------------------+
* 63 61 60 48 47 42 41 0
*/
#define TTARGET_CTX_SHIFT 48
#define TTARGET_VA_SHIFT 22
#define TTARGET_VA_BITS 42
#define TTARGET_VA_MASK ((1UL << TTARGET_VA_BITS) - 1)
/*
* MMU PRIMARY/SECONDARY CONTEXT register
*/
#define CTXREG_CTX_MASK 0x1FFF
/*
* The kernel always runs in KCONTEXT, and no user mappings
* are ever valid in it (so any user access pagefaults).
*/
#define KCONTEXT 0
#define CTX_OTHER_SHIFT 16
/*
* FLUSH_ADDR is used in the flush instruction to guarantee stores to mmu
* registers complete. It is selected so it won't miss in the tlb.
*/
#define FLUSH_ADDR (KERNBASE + 2 * PAGE_SIZE_4M)
#endif /* _MACHINE_MMU_H_ */

32
sys/sun4v/include/mutex.h Normal file
View File

@ -0,0 +1,32 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_MUTEX_H_
#define _MACHINE_MUTEX_H_
#endif /* !_MACHINE_MUTEX_H_ */

View File

@ -0,0 +1,44 @@
/*-
* Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_NEXUSVAR_H_
#define _MACHINE_NEXUSVAR_H_
extern struct bus_dma_tag nexus_dmatag;
enum nexus_ivars {
NEXUS_IVAR_DEVHANDLE,
};
#define NEXUS_ACCESSOR(var, ivar, type) \
__BUS_ACCESSOR(nexus, var, NEXUS, ivar, type)
NEXUS_ACCESSOR(devhandle, DEVHANDLE, uint64_t)
#undef NEXUS_ACCESSOR
#endif /* _MACHINE_NEXUSVAR_H_ */

View File

@ -0,0 +1,53 @@
/*-
* Copyright (c) 2001 - 2003 by Thomas Moestl <tmm@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_OFW_BUS_H_
#define _MACHINE_OFW_BUS_H_
#define ORIP_NOINT -1
#define ORIR_NOTFOUND 0xffffffff
/*
* Other than in Open Firmware calls, the size of a bus cell seems to be
* always the same.
*/
typedef u_int32_t pcell_t;
struct ofw_bus_iinfo {
u_int8_t *opi_imap;
u_int8_t *opi_imapmsk;
int opi_imapsz;
pcell_t opi_addrc;
};
void ofw_bus_setup_iinfo(phandle_t, struct ofw_bus_iinfo *, int);
int ofw_bus_lookup_imap(phandle_t, struct ofw_bus_iinfo *, void *, int,
void *, int, void *, int, void *);
int ofw_bus_search_intrmap(void *, int, void *, int, void *, int, void *,
void *, void *, int);
#endif /* !_MACHINE_OFW_BUS_H_ */

View File

@ -0,0 +1,38 @@
/*-
* Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_OFW_MACHDEP_H_
#define _MACHINE_OFW_MACHDEP_H_
#include <sys/bus.h>
int OF_decode_addr(phandle_t, int, int *, bus_addr_t *);
void OF_getetheraddr(device_t, u_char *);
void cpu_shutdown(void *);
void openfirmware_exit(void *);
#endif /* _MACHINE_OFW_MACHDEP_H_ */

View File

@ -0,0 +1,46 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_OFW_MEM_H_
#define _MACHINE_OFW_MEM_H_
struct ofw_mem_region {
vm_paddr_t mr_start;
vm_size_t mr_size;
};
struct ofw_map {
vm_offset_t om_start;
vm_size_t om_size;
u_long om_tte;
};
extern struct ofw_mem_region sparc64_memreg[];
extern int sparc64_nmemreg;
#endif

View File

@ -0,0 +1,56 @@
/*-
* Copyright (c) 1998, 1999 Eduardo E. Horvath
* Copyright (c) 1999 Matthew R. Green
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: NetBSD: psychoreg.h,v 1.8 2001/09/10 16:17:06 eeh Exp
*
* $FreeBSD$
*/
#ifndef _MACHINE_OFW_NEXUS_H_
#define _MACHINE_OFW_NEXUS_H_
/*
* These are the regs used for devices on the nexus. They apply to all of
* Fireplane/Safari, JBus and UPA.
*/
struct nexus_regs {
uint32_t phys_hi;
uint32_t phys_lo;
uint32_t size_hi;
uint32_t size_lo;
};
#define NEXUS_REG_PHYS(r) \
(((uint64_t)(r)->phys_hi << 32) | (uint64_t)(r)->phys_lo)
#define NEXUS_REG_SIZE(r) \
(((uint64_t)(r)->size_hi << 32) | (uint64_t)(r)->size_lo)
#endif /* !_MACHINE_OFW_NEXUS_H_ */

View File

@ -0,0 +1,54 @@
/*-
* Copyright (c) 1998, 1999 Eduardo E. Horvath
* Copyright (c) 1999 Matthew R. Green
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: NetBSD: psychoreg.h,v 1.8 2001/09/10 16:17:06 eeh Exp
*
* $FreeBSD$
*/
#ifndef _MACHINE_OFW_UPA_H_
#define _MACHINE_OFW_UPA_H_
/*
* These are the regs and ranges property the psycho uses. They should be
* applicable to all UPA devices. XXX: verify this.
*/
struct upa_regs {
u_int32_t phys_hi;
u_int32_t phys_lo;
u_int32_t size_hi;
u_int32_t size_lo;
};
#define UPA_REG_PHYS(r) \
(((u_int64_t)(r)->phys_hi << 32) | (u_int64_t)(r)->phys_lo)
#define UPA_REG_SIZE(r) \
(((u_int64_t)(r)->size_hi << 32) | (u_int64_t)(r)->size_lo)
#endif /* !_MACHINE_OFW_UPA_H_ */

139
sys/sun4v/include/param.h Normal file
View File

@ -0,0 +1,139 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)param.h 5.8 (Berkeley) 6/28/91
* $FreeBSD$
*/
/*
* Machine dependent constants for sparc64.
*/
/*
* Round p (pointer or byte index) up to a correctly-aligned value
* for all data types (int, long, ...). The result is unsigned int
* and must be cast to any desired pointer type.
*/
#ifndef _ALIGNBYTES
#define _ALIGNBYTES 0xf
#endif
#ifndef _ALIGN
#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
#endif
#ifndef _NO_NAMESPACE_POLLUTION
#ifndef _MACHINE_PARAM_H_
#define _MACHINE_PARAM_H_
#ifndef MACHINE
#define MACHINE "sun4v"
#endif
#ifndef MACHINE_ARCH
#define MACHINE_ARCH "sparc64"
#endif
#define MID_MACHINE MID_SPARC64
#ifdef SMP
#define MAXCPU 32
#else
#define MAXCPU 1
#endif /* SMP */
#define INT_SHIFT 2
#define PTR_SHIFT 3
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
#define PAGE_SHIFT_8K 13
#define PAGE_SIZE_8K (1L<<PAGE_SHIFT_8K)
#define PAGE_MASK_8K (PAGE_SIZE_8K-1)
#define PAGE_SHIFT_64K 16
#define PAGE_SIZE_64K (1L<<PAGE_SHIFT_64K)
#define PAGE_MASK_64K (PAGE_SIZE_64K-1)
#define PAGE_SHIFT_512K 19
#define PAGE_SIZE_512K (1L<<PAGE_SHIFT_512K)
#define PAGE_MASK_512K (PAGE_SIZE_512K-1)
#define PAGE_SHIFT_4M 22
#define PAGE_SIZE_4M (1L<<PAGE_SHIFT_4M)
#define PAGE_MASK_4M (PAGE_SIZE_4M-1)
#define PAGE_SHIFT_256M 28
#define PAGE_SIZE_256M (1L<<PAGE_SHIFT_256M)
#define PAGE_MASK_256M (PAGE_SIZE_256M-1)
#define PAGE_SHIFT_MIN PAGE_SHIFT_8K
#define PAGE_SIZE_MIN PAGE_SIZE_8K
#define PAGE_MASK_MIN PAGE_MASK_8K
#define PAGE_SHIFT PAGE_SHIFT_8K /* LOG2(PAGE_SIZE) */
#define PAGE_SIZE PAGE_SIZE_8K /* bytes/page */
#define PAGE_MASK PAGE_MASK_8K
#define PAGE_SHIFT_MAX PAGE_SHIFT_4M
#define PAGE_SIZE_MAX PAGE_SIZE_4M
#define PAGE_MASK_MAX PAGE_MASK_4M
#ifndef KSTACK_PAGES
#define KSTACK_PAGES 4 /* pages of kernel stack (with pcb) */
#endif
#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */
#define PCPU_PAGES 1
/*
* Ceiling on size of buffer cache (really only effects write queueing,
* the VM page cache is not effected), can be changed via
* the kern.maxbcache /boot/loader.conf variable.
*/
#ifndef VM_BCACHE_SIZE_MAX
#define VM_BCACHE_SIZE_MAX (400 * 1024 * 1024)
#endif
/*
* Mach derived conversion macros
*/
#ifndef LOCORE
#define round_page(x) (((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK)
#define trunc_page(x) ((unsigned long)(x) & ~PAGE_MASK)
#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT)
#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT)
#define sparc64_btop(x) ((unsigned long)(x) >> PAGE_SHIFT)
#define sparc64_ptob(x) ((unsigned long)(x) << PAGE_SHIFT)
#define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024))
#endif /* LOCORE */
#endif /* !_MACHINE_PARAM_H_ */
#endif /* !_NO_NAMESPACE_POLLUTION */

57
sys/sun4v/include/pcb.h Normal file
View File

@ -0,0 +1,57 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_PCB_H_
#define _MACHINE_PCB_H_
#include <machine/frame.h>
#define MAXWIN 8
#define PCB_FEF (1 << 0)
/* NOTE: pcb_ufp must be aligned on a 64 byte boundary. */
struct pcb {
struct rwindow pcb_rw[MAXWIN]; /* wbuf for page faults during spill / fill trap handling */
uint32_t pcb_kfp[64]; /* used for regs in handling kernel floating point exc */
uint32_t pcb_ufp[64]; /* used for regs in handling user floating point exc */
uint64_t pcb_rwsp[MAXWIN]; /* spbuf sp's for each wbuf */
uint64_t pcb_flags;
uint64_t pcb_nsaved; /* number of windows saved in pcb_rw */
uint64_t pcb_pc;
uint64_t pcb_sp;
uint64_t pcb_kstack; /* pcb's kernel stack */
uint64_t pcb_pad[4];
} __aligned(64);
#ifdef _KERNEL
void makectx(struct trapframe *, struct pcb *);
int savectx(struct pcb *pcb);
#endif
#endif /* !_MACHINE_PCB_H_ */

101
sys/sun4v/include/pcpu.h Normal file
View File

@ -0,0 +1,101 @@
/*-
* Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: FreeBSD: src/sys/i386/include/globaldata.h,v 1.27 2001/04/27
* $FreeBSD$
*/
#ifndef _MACHINE_PCPU_H_
#define _MACHINE_PCPU_H_
#ifdef _KERNEL
#include <machine/asmacros.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
#define ALT_STACK_SIZE 128
struct pmap;
/*
* Inside the kernel, the globally reserved register g7 is used to
* point at the globaldata structure.
*/
#define PCPU_MD_FIELDS \
struct intr_request pc_irpool[IR_FREE]; \
struct intr_request *pc_irhead; \
struct intr_request **pc_irtail; \
struct intr_request *pc_irfree; \
struct pmap *pc_curpmap; \
vm_offset_t pc_addr; \
vm_offset_t pc_tsb; \
vm_offset_t *pc_mondo_data; \
vm_offset_t *pc_cpu_list; \
vm_offset_t *pc_cpu_q; \
vm_offset_t *pc_dev_q; \
vm_offset_t *pc_rq; \
vm_offset_t *pc_nrq; \
vm_paddr_t pc_mondo_data_ra; \
vm_paddr_t pc_cpu_list_ra; \
vm_paddr_t pc_cpu_q_ra; \
uint64_t pc_cpu_q_size; \
vm_paddr_t pc_dev_q_ra; \
uint64_t pc_dev_q_size; \
vm_paddr_t pc_rq_ra; \
uint64_t pc_rq_size; \
vm_paddr_t pc_nrq_ra; \
uint64_t pc_nrq_size; \
u_long pc_tickref; \
u_long pc_lookup_field; \
u_long pc_last_field; \
u_long pc_tickadj; \
struct rwindow pc_kwbuf; \
u_long pc_kwbuf_sp; \
u_int pc_kwbuf_full; \
struct rwindow pc_tsbwbuf[2]; \
uint64_t pc_caller; \
uint32_t pc_tl; \
uint32_t pc_trapid; \
uint16_t pc_cpulist[MAXCPU]; \
uint64_t pad[6];
/* XXX SUN4V_FIXME - as we access the *_ra and *_size fields in quick
* succession we _really_ want them to be L1 cache line size aligned
* and it is quite possible that we want all of ASI_QUEUE fields to
* be L2 cache aligned - they're surrounded by per-cpu data, so there is
* no possibility of false sharing, but this might help in reducing misses
*/
struct pcpu;
register struct pcpu *pcpup __asm__(__XSTRING(PCPU_REG));
#define PCPU_GET(member) (pcpup->pc_ ## member)
#define PCPU_PTR(member) (&pcpup->pc_ ## member)
#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value))
#endif /* _KERNEL */
#endif /* !_MACHINE_PCPU_H_ */

129
sys/sun4v/include/pmap.h Normal file
View File

@ -0,0 +1,129 @@
/*-
* Copyright (c) 1991 Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department and William Jolitz of UUNET Technologies Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
* from: @(#)pmap.h 7.4 (Berkeley) 5/12/91
* from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30
* $FreeBSD$
*/
#ifndef _MACHINE_PMAP_H_
#define _MACHINE_PMAP_H_
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/_lock.h>
#include <sys/_mutex.h>
#include <machine/cache.h>
#include <machine/hypervisorvar.h>
#define PMAP_CONTEXT_MAX 8192
typedef struct pmap *pmap_t;
typedef uint32_t pmap_cpumask_t;
struct pv_entry;
struct tte_hash;
struct md_page {
int pv_list_count;
TAILQ_HEAD(, pv_entry) pv_list;
};
struct pmap {
uint64_t pm_context;
uint64_t pm_hashscratch;
uint64_t pm_tsbscratch;
vm_paddr_t pm_tsb_ra;
struct mtx pm_mtx;
struct tte_hash *pm_hash;
TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */
struct hv_tsb_info pm_tsb;
pmap_cpumask_t pm_active; /* mask of cpus currently using pmap */
pmap_cpumask_t pm_tlbactive; /* mask of cpus that have used this pmap */
struct pmap_statistics pm_stats;
};
#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx)
#define PMAP_LOCK_ASSERT(pmap, type) \
mtx_assert(&(pmap)->pm_mtx, (type))
#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx)
#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \
NULL, MTX_DEF | MTX_DUPOK)
#define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx)
#define PMAP_MTX(pmap) (&(pmap)->pm_mtx)
#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx)
#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx)
/*
* For each vm_page_t, there is a list of all currently valid virtual
* mappings of that page. An entry is a pv_entry_t, the list is pv_table.
*/
typedef struct pv_entry {
pmap_t pv_pmap;
vm_offset_t pv_va;
TAILQ_ENTRY(pv_entry) pv_list;
TAILQ_ENTRY(pv_entry) pv_plist;
} *pv_entry_t;
#define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list))
void pmap_bootstrap(vm_offset_t ekva);
vm_paddr_t pmap_kextract(vm_offset_t va);
void pmap_invalidate_page(pmap_t pmap, vm_offset_t va, int cleartsb);
void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, int cleartsb);
void pmap_invalidate_all(pmap_t pmap);
void pmap_scrub_pages(vm_paddr_t pa, int64_t size);
#define vtophys(va) pmap_kextract((vm_offset_t)(va))
extern struct pmap kernel_pmap_store;
#define kernel_pmap (&kernel_pmap_store)
extern vm_paddr_t phys_avail[];
extern vm_offset_t virtual_avail;
extern vm_offset_t virtual_end;
extern vm_paddr_t msgbuf_phys;
static __inline int
pmap_track_modified(pmap_t pm, vm_offset_t va)
{
if (pm == kernel_pmap)
return ((va < kmi.clean_sva) || (va >= kmi.clean_eva));
else
return (1);
}
#endif /* !_MACHINE_PMAP_H_ */

View File

@ -0,0 +1,24 @@
/*-
* This file is in the public domain.
*
* $FreeBSD$
*/
#ifndef _MACHINE_PMC_MDEP_H_
#define _MACHINE_PMC_MDEP_H_
union pmc_md_op_pmcallocate {
uint64_t __pad[4];
};
/* Logging */
#define PMCLOG_READADDR PMCLOG_READ64
#define PMCLOG_EMITADDR PMCLOG_EMIT64
#if _KERNEL
union pmc_md_pmc {
};
#endif
#endif /* !_MACHINE_PMC_MDEP_H_ */

54
sys/sun4v/include/proc.h Normal file
View File

@ -0,0 +1,54 @@
/*-
* Copyright (c) 1991 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)proc.h 7.1 (Berkeley) 5/15/91
* from: FreeBSD: src/sys/i386/include/proc.h,v 1.11 2001/06/29
* $FreeBSD$
*/
#ifndef _MACHINE_PROC_H_
#define _MACHINE_PROC_H_
#include <machine/utrap.h>
struct md_utrap {
utrap_entry_t *ut_precise[UT_MAX]; /* must be first */
int ut_refcnt;
};
struct mdthread {
int md_spinlock_count; /* (k) */
register_t md_saved_pil; /* (k) */
};
struct mdproc {
struct md_utrap *md_utrap;
void *md_sigtramp;
};
#endif /* !_MACHINE_PROC_H_ */

View File

@ -0,0 +1,70 @@
/*-
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* from: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp
* from: FreeBSD: src/sys/alpha/include/profile.h,v 1.4 1999/12/29
* $FreeBSD$
*/
#ifndef _MACHINE_PROFILE_H_
#define _MACHINE_PROFILE_H_
#define FUNCTION_ALIGNMENT 32
#define _MCOUNT_DECL void mcount
#define MCOUNT
typedef u_long fptrdiff_t;
#ifdef _KERNEL
#include <machine/cpufunc.h>
#define MCOUNT_DECL(s) register_t s;
#define MCOUNT_ENTER(s) s = rdpr(pil); wrpr(pil, 0, 14)
#define MCOUNT_EXIT(s) wrpr(pil, 0, s)
void bintr(void);
void btrap(void);
void eintr(void);
void user(void);
#define MCOUNT_FROMPC_USER(pc) \
((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc)
#define MCOUNT_FROMPC_INTR(pc) \
((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ? \
((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr : \
(uintfptr_t)btrap) : ~0UL)
void mcount(uintfptr_t frompc, uintfptr_t selfpc);
#else /* !_KERNEL */
typedef u_long uintfptr_t;
#endif /* _KERNEL */
#endif /* !_MACHINE_PROFILE_H_ */

View File

@ -0,0 +1,59 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_PSTATE_H_
#define _MACHINE_PSTATE_H_
#define PSTATE_IE (1<<1)
#define PSTATE_PRIV (1<<2)
#define PSTATE_AM (1<<3)
#define PSTATE_PEF (1<<4)
#define PSTATE_RED (1<<5)
#define PSTATE_MM_SHIFT (6)
#define PSTATE_MM_SIZE (2)
#define PSTATE_MM_MASK (((1<<PSTATE_MM_SIZE)-1)<<PSTATE_MM_SHIFT)
#define PSTATE_MM_TSO (0<<PSTATE_MM_SHIFT)
#define PSTATE_MM_PSO (1<<PSTATE_MM_SHIFT)
#define PSTATE_MM_RMO (2<<PSTATE_MM_SHIFT)
#define PSTATE_TLE (1<<8)
#define PSTATE_CLE (1<<9)
#define PSTATE_MM PSTATE_MM_TSO
#define PSTATE_MASK ((1<<10)-1)
#define PSTATE_INTR_DISABLE (PSTATE_MASK & ~PSTATE_IE)
#define PSTATE_NORMAL (PSTATE_MM | PSTATE_PEF | PSTATE_PRIV)
#define PSTATE_KERNEL (PSTATE_NORMAL | PSTATE_IE)
#define PSTATE_SECURE(pstate) \
(((pstate) & ~(PSTATE_AM|PSTATE_MM_MASK)) == (PSTATE_IE|PSTATE_PEF))
#endif /* !_MACHINE_PSTATE_H_ */

View File

@ -0,0 +1,36 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ptrace.h 8.1 (Berkeley) 6/11/93
* $FreeBSD$
*/
#ifndef _MACHINE_PTRACE_H_
#define _MACHINE_PTRACE_H_
#endif

113
sys/sun4v/include/reg.h Normal file
View File

@ -0,0 +1,113 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)reg.h 5.5 (Berkeley) 1/18/91
* from: FreeBSD: src/sys/i386/include/reg.h,v 1.23 2000/09/21
* $FreeBSD$
*/
#ifndef _MACHINE_REG_H_
#define _MACHINE_REG_H_
/*
* Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.
*
* NOTE: DO NOT CHANGE THESE STRUCTURES. The offsets of the fields are
* hardcoded in gdb. Changing them and recompiling doesn't help, the
* constants in nm-fbsd.h must also be updated.
*/
struct reg32 {
uint32_t r_global[8];
uint32_t r_out[8];
uint32_t r_npc;
uint32_t r_pc;
uint32_t r_psr;
uint32_t r_wim;
uint32_t r_pad[4];
};
struct reg {
uint64_t r_global[8];
uint64_t r_out[8];
uint64_t r_fprs;
uint64_t r_fsr;
uint64_t r_gsr;
uint64_t r_level;
uint64_t r_pil;
uint64_t r_sfar;
uint64_t r_sfsr;
uint64_t r_tar;
uint64_t r_tnpc;
uint64_t r_tpc;
uint64_t r_tstate;
uint64_t r_type;
uint64_t r_y;
uint64_t r_wstate;
uint64_t r_pad[2];
};
/*
* Register set accessible via /proc/$pid/fpregs.
*/
struct fpreg32 {
uint32_t fr_regs[32];
uint32_t fr_fsr;
};
struct fpreg {
uint32_t fr_regs[64]; /* our view is 64 32-bit registers */
int64_t fr_fsr; /* %fsr */
int32_t fr_gsr; /* %gsr */
int32_t fr_pad[1];
};
/*
* Register set accessible via /proc/$pid/dbregs.
*/
struct dbreg {
int dummy;
};
#ifdef _KERNEL
/*
* XXX these interfaces are MI, so they should be declared in a MI place.
*/
int fill_regs(struct thread *, struct reg *);
int set_regs(struct thread *, struct reg *);
int fill_fpregs(struct thread *, struct fpreg *);
int set_fpregs(struct thread *, struct fpreg *);
int fill_dbregs(struct thread *, struct dbreg *);
int set_dbregs(struct thread *, struct dbreg *);
#endif
#endif /* !_MACHINE_REG_H_ */

33
sys/sun4v/include/reloc.h Normal file
View File

@ -0,0 +1,33 @@
/*-
* Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by John Birrell.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/

View File

@ -0,0 +1,45 @@
/*-
* Copyright 1998 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
* granted, provided that both the above copyright notice and this
* permission notice appear in all copies, that both the above
* copyright notice and this permission notice appear in all
* supporting documentation, and that the name of M.I.T. not be used
* in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. M.I.T. makes
* no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_RESOURCE_H_
#define _MACHINE_RESOURCE_H_ 1
/*
* Definitions of resource types for Intel Architecture machines
* with support for legacy ISA devices and drivers.
*/
#define SYS_RES_IRQ 1 /* interrupt lines */
#define SYS_RES_DRQ 2 /* isa dma lines */
#define SYS_RES_MEMORY 3 /* i/o memory */
#define SYS_RES_IOPORT 4 /* i/o ports */
#endif /* !_MACHINE_RESOURCE_H_ */

58
sys/sun4v/include/runq.h Normal file
View File

@ -0,0 +1,58 @@
/*-
* Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_RUNQ_H_
#define _MACHINE_RUNQ_H_
#define RQB_LEN (1UL) /* Number of priority status words. */
#define RQB_L2BPW (6UL) /* Log2(sizeof(rqb_word_t) * NBBY)). */
#define RQB_BPW (1UL<<RQB_L2BPW) /* Bits in an rqb_word_t. */
#define RQB_BIT(pri) (1UL << ((pri) & (RQB_BPW - 1)))
#define RQB_WORD(pri) ((pri) >> RQB_L2BPW)
#define RQB_FFS(word) (ffs64(word) - 1)
/*
* Type of run queue status word.
*/
typedef u_int64_t rqb_word_t;
static __inline u_long
ffs64(u_long mask)
{
u_long bit;
if (mask == 0)
return (0);
for (bit = 1; (mask & 1UL) == 0; bit++)
mask >>= 1UL;
return (bit);
}
#endif

View File

@ -0,0 +1,76 @@
/*-
* Copyright (c) 2003 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_SC_MACHDEP_H_
#define _MACHINE_SC_MACHDEP_H_
/* Color attributes for foreground text */
#define FG_BLACK 0x0
#define FG_BLUE 0x1
#define FG_GREEN 0x2
#define FG_CYAN 0x3
#define FG_RED 0x4
#define FG_MAGENTA 0x5
#define FG_BROWN 0x6
#define FG_LIGHTGREY 0x7
#define FG_DARKGREY 0x8
#define FG_LIGHTBLUE 0x9
#define FG_LIGHTGREEN 0xa
#define FG_LIGHTCYAN 0xb
#define FG_LIGHTRED 0xc
#define FG_LIGHTMAGENTA 0xd
#define FG_YELLOW 0xe
#define FG_WHITE 0xf
#define FG_BLINK 0x80
/* Color attributes for text background */
#define BG_BLACK 0x00
#define BG_BLUE 0x10
#define BG_GREEN 0x20
#define BG_CYAN 0x30
#define BG_RED 0x40
#define BG_MAGENTA 0x50
#define BG_BROWN 0x60
#define BG_LIGHTGREY 0x70
#define BG_DARKGREY 0x80
#define BG_LIGHTBLUE 0x90
#define BG_LIGHTGREEN 0xa0
#define BG_LIGHTCYAN 0xb0
#define BG_LIGHTRED 0xc0
#define BG_LIGHTMAGENTA 0xd0
#define BG_YELLOW 0xe0
#define BG_WHITE 0xf0
#define SC_NORM_ATTR (FG_BLACK | BG_WHITE)
#define SC_NORM_REV_ATTR (FG_WHITE | BG_BLACK)
#define SC_KERNEL_CONS_ATTR (FG_BLACK | BG_WHITE)
#define SC_KERNEL_CONS_REV_ATTR (FG_WHITE | BG_BLACK)
#endif /* !_MACHINE_SC_MACHDEP_H_ */

View File

@ -0,0 +1,60 @@
/*-
* Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by John Birrell.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* From: FreeBSD: src/sys/i386/include/setjmp.h,v 1.5 2000/10/06
* $FreeBSD$
*/
#ifndef _MACHINE_SETJMP_H_
#define _MACHINE_SETJMP_H_
#include <sys/cdefs.h>
#define _JBLEN 5
#define _JB_FP 0
#define _JB_PC 1
#define _JB_SP 2
#define _JB_SIGMASK 3
#define _JB_SIGFLAG 5
/*
* jmp_buf and sigjmp_buf are encapsulated in different structs to force
* compile-time diagnostics for mismatches. The structs are the same
* internally to avoid some run-time errors for mismatches.
*/
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
typedef struct _sigjmp_buf { long _sjb[_JBLEN + 1]; } sigjmp_buf[1];
#endif
typedef struct _jmp_buf { long _jb[_JBLEN + 1]; } jmp_buf[1];
#endif /* !_MACHINE_SETJMP_H_ */

View File

@ -0,0 +1,59 @@
/*-
* Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_SF_BUF_H_
#define _MACHINE_SF_BUF_H_
#include <machine/tlb.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
/*
* On this machine, the only purpose for which sf_buf is used is to implement
* an opaque pointer required by the machine-independent parts of the kernel.
* That pointer references the vm_page that is "mapped" by the sf_buf. The
* actual mapping is provided by the direct virtual-to-physical mapping.
*/
struct sf_buf;
static __inline vm_offset_t
sf_buf_kva(struct sf_buf *sf)
{
return (TLB_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS((vm_page_t)sf)));
}
static __inline struct vm_page *
sf_buf_page(struct sf_buf *sf)
{
return ((vm_page_t)sf);
}
#endif /* !_MACHINE_SF_BUF_H_ */

View File

@ -0,0 +1,40 @@
/*-
* Copyright (c) 1999 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* from: FreeBSD: src/sys/alpha/include/sigframe.h,v 1.1 1999/09/29
* $FreeBSD$
*/
#ifndef _MACHINE_SIGFRAME_H_
#define _MACHINE_SIGFRAME_H_ 1
struct sigframe {
ucontext_t sf_uc;
siginfo_t sf_si;
};
#endif /* _MACHINE_SIGFRAME_H_ */

View File

@ -0,0 +1,47 @@
/*-
* Copyright (c) 1986, 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)signal.h 8.1 (Berkeley) 6/11/93
* from: FreeBSD: src/sys/i386/include/signal.h,v 1.13 2000/11/09
* $FreeBSD$
*/
#ifndef _MACHINE_SIGNAL_H_
#define _MACHINE_SIGNAL_H_
#include <sys/cdefs.h>
typedef long sig_atomic_t;
#if __BSD_VISIBLE
struct sigcontext {
int _dummy;
};
#endif /* __BSD_VISIBLE */
#endif /* !_MACHINE_SIGNAL_H_ */

263
sys/sun4v/include/smp.h Normal file
View File

@ -0,0 +1,263 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_SMP_H_
#define _MACHINE_SMP_H_
#define CPU_CLKSYNC 1
#define CPU_INIT 2
#define CPU_BOOTSTRAP 3
#ifndef LOCORE
#include <machine/intr_machdep.h>
#include <machine/tte.h>
#define IDR_BUSY (1<<0)
#define IDR_NACK (1<<1)
#define IPI_AST PIL_AST
#define IPI_RENDEZVOUS PIL_RENDEZVOUS
#define IPI_STOP PIL_STOP
#define IPI_RETRIES 5000
struct cpu_start_args {
u_int csa_count;
u_int csa_state;
vm_offset_t csa_pcpu;
u_int csa_cpuid;
};
struct ipi_cache_args {
u_int ica_mask;
vm_paddr_t ica_pa;
};
struct ipi_tlb_args {
u_int ita_mask;
struct pmap *ita_pmap;
u_long ita_start;
u_long ita_end;
};
#define ita_va ita_start
struct pcpu;
extern struct pcb stoppcbs[];
void cpu_mp_bootstrap(struct pcpu *pc);
void cpu_mp_shutdown(void);
void cpu_ipi_selected(int cpus, uint16_t *cpulist, u_long d0, u_long d1, u_long d2, uint64_t *ackmask);
void cpu_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2);
void cpu_ipi_ast(struct trapframe *tf);
void cpu_ipi_stop(struct trapframe *tf);
void ipi_selected(u_int cpus, u_int ipi);
void ipi_all(u_int ipi);
void ipi_all_but_self(u_int ipi);
vm_offset_t mp_tramp_alloc(void);
void mp_set_tsb_desc_ra(vm_paddr_t);
void mp_add_nucleus_mapping(vm_offset_t, uint64_t);
extern struct mtx ipi_mtx;
extern struct ipi_cache_args ipi_cache_args;
extern struct ipi_tlb_args ipi_tlb_args;
extern vm_offset_t mp_tramp;
extern char *mp_tramp_code;
extern u_long mp_tramp_code_len;
extern u_long mp_tramp_tte_slots;
extern u_long mp_tramp_tsb_desc_ra;
extern u_long mp_tramp_func;
extern void mp_startup(void);
extern char tl_ipi_cheetah_dcache_page_inval[];
extern char tl_ipi_spitfire_dcache_page_inval[];
extern char tl_ipi_spitfire_icache_page_inval[];
extern char tl_ipi_level[];
extern char tl_invltlb[];
extern char tl_invlctx[];
extern char tl_invlpg[];
extern char tl_ipi_tlb_context_demap[];
extern char tl_ipi_tlb_page_demap[];
extern char tl_ipi_tlb_range_demap[];
#ifdef SMP
#if defined(_MACHINE_PMAP_H_) && defined(_SYS_MUTEX_H_)
#if 0
static __inline void *
ipi_dcache_page_inval(void *func, vm_paddr_t pa)
{
struct ipi_cache_args *ica;
if (smp_cpus == 1)
return (NULL);
ica = &ipi_cache_args;
mtx_lock_spin(&ipi_mtx);
ica->ica_mask = all_cpus;
ica->ica_pa = pa;
cpu_ipi_selected(PCPU_GET(other_cpus), 0, (u_long)func, (u_long)ica);
return (&ica->ica_mask);
}
static __inline void *
ipi_icache_page_inval(void *func, vm_paddr_t pa)
{
struct ipi_cache_args *ica;
if (smp_cpus == 1)
return (NULL);
ica = &ipi_cache_args;
mtx_lock_spin(&ipi_mtx);
ica->ica_mask = all_cpus;
ica->ica_pa = pa;
cpu_ipi_selected(PCPU_GET(other_cpus), 0, (u_long)func, (u_long)ica);
return (&ica->ica_mask);
}
static __inline void *
ipi_tlb_context_demap(struct pmap *pm)
{
struct ipi_tlb_args *ita;
u_int cpus;
if (smp_cpus == 1)
return (NULL);
if ((cpus = (pm->pm_active & PCPU_GET(other_cpus))) == 0)
return (NULL);
ita = &ipi_tlb_args;
mtx_lock_spin(&ipi_mtx);
ita->ita_mask = cpus | PCPU_GET(cpumask);
ita->ita_pmap = pm;
cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_context_demap,
(u_long)ita);
return (&ita->ita_mask);
}
static __inline void *
ipi_tlb_page_demap(struct pmap *pm, vm_offset_t va)
{
struct ipi_tlb_args *ita;
u_int cpus;
if (smp_cpus == 1)
return (NULL);
if ((cpus = (pm->pm_active & PCPU_GET(other_cpus))) == 0)
return (NULL);
ita = &ipi_tlb_args;
mtx_lock_spin(&ipi_mtx);
ita->ita_mask = cpus | PCPU_GET(cpumask);
ita->ita_pmap = pm;
ita->ita_va = va;
cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_page_demap, (u_long)ita);
return (&ita->ita_mask);
}
static __inline void *
ipi_tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end)
{
struct ipi_tlb_args *ita;
u_int cpus;
if (smp_cpus == 1)
return (NULL);
if ((cpus = (pm->pm_active & PCPU_GET(other_cpus))) == 0)
return (NULL);
ita = &ipi_tlb_args;
mtx_lock_spin(&ipi_mtx);
ita->ita_mask = cpus | PCPU_GET(cpumask);
ita->ita_pmap = pm;
ita->ita_start = start;
ita->ita_end = end;
cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_range_demap, (u_long)ita);
return (&ita->ita_mask);
}
#endif
static __inline void
ipi_wait(void *cookie)
{
volatile u_int *mask;
if ((mask = cookie) != NULL) {
atomic_clear_int(mask, PCPU_GET(cpumask));
while (*mask != 0)
;
mtx_unlock_spin(&ipi_mtx);
}
}
#endif /* _MACHINE_PMAP_H_ && _SYS_MUTEX_H_ */
#else
static __inline void *
ipi_dcache_page_inval(void *func, vm_paddr_t pa)
{
return (NULL);
}
static __inline void *
ipi_icache_page_inval(void *func, vm_paddr_t pa)
{
return (NULL);
}
static __inline void *
ipi_tlb_context_demap(struct pmap *pm)
{
return (NULL);
}
static __inline void *
ipi_tlb_page_demap(struct pmap *pm, vm_offset_t va)
{
return (NULL);
}
static __inline void *
ipi_tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end)
{
return (NULL);
}
static __inline void
ipi_wait(void *cookie)
{
}
#endif /* SMP */
#endif /* !LOCORE */
#endif /* !_MACHINE_SMP_H_ */

101
sys/sun4v/include/stdarg.h Normal file
View File

@ -0,0 +1,101 @@
/*-
* Copyright (c) 2002 David E. O'Brien. All rights reserved.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Lawrence Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stdarg.h 8.2 (Berkeley) 9/27/93
* $NetBSD: stdarg.h,v 1.11 2000/07/23 21:36:56 mycroft Exp $
* $FreeBSD$
*/
#ifndef _MACHINE_STDARG_H_
#define _MACHINE_STDARG_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#ifndef _VA_LIST_DECLARED
#define _VA_LIST_DECLARED
typedef __va_list va_list;
#endif
#ifdef __GNUCLIKE_BUILTIN_STDARG
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
#define va_arg(ap, type) \
__builtin_va_arg((ap), type)
#if __ISO_C_VISIBLE >= 1999
#define va_copy(dest, src) \
__builtin_va_copy((dest), (src))
#endif
#define va_end(ap) \
__builtin_va_end(ap)
#else /* ! __GNUCLIKE_BUILTIN_STDARG */
#if !defined(__GNUCLIKE_BUILTIN_NEXT_ARG) && !defined(lint)
#error no support for your compiler
#endif
#define va_start(ap, last) \
(__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs())
#define va_end(ap)
#define __va_arg8(ap, type) \
(*(type *)(void *)((ap) += 8, (ap) - 8))
#define __va_arg16(ap, type) \
(*(type *)(void *)((ap) = (va_list)(((unsigned long)(ap) + 31) & -16),\
(ap) - 16))
#define __va_int(ap, type) \
(*(type *)(void *)((ap) += 8, (ap) - sizeof(type)))
#define __REAL_TYPE_CLASS 8
#define __RECORD_TYPE_CLASS 12
#define va_arg(ap, type) \
(__builtin_classify_type(*(type *)0) == __REAL_TYPE_CLASS ? \
(__alignof__(type) == 16 ? __va_arg16(ap, type) : \
__va_arg8(ap, type)) : \
(__builtin_classify_type(*(type *)0) < __RECORD_TYPE_CLASS ? \
__va_int(ap, type) : \
(sizeof(type) <= 8 ? __va_arg8(ap, type) : \
(sizeof(type) <= 16 ? __va_arg16(ap, type) : \
*__va_arg8(ap, type *)))))
#endif /* __GNUCLIKE_BUILTIN_STDARG */
#endif /* !_MACHINE_STDARG_H_ */

View File

@ -0,0 +1,91 @@
/*-
* Copyright (c) 2006 Kip Macy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_SUN4V_CPUFUNC_H_
#define _MACHINE_SUN4V_CPUFUNC_H_
#include <machine/hypervisor_api.h>
void set_mmfsa_scratchpad(vm_paddr_t mmfsa);
void set_hash_user_scratchpad(uint64_t);
void set_tsb_user_scratchpad(uint64_t);
void set_hash_kernel_scratchpad(uint64_t);
void set_tsb_kernel_scratchpad(uint64_t);
void init_mondo(uint64_t func, uint64_t arg1, uint64_t arg2, uint64_t arg3);
void init_mondo_queue(void);
static __inline void *
set_tba(void *ntba)
{
void *otba;
otba = (char *)rdpr(tba);
wrpr(tba, ntba, 0);
return otba;
}
static __inline void
set_wstate(u_long nwstate)
{
wrpr(wstate, nwstate, 0);
}
void invlpg(uint16_t ctx, vm_offset_t va);
void invlctx(uint16_t ctx);
void invltlb(void);
static __inline void
store_real(vm_paddr_t ra, uint64_t val)
{
stxa(ra, ASI_REAL, val);
}
static __inline void
store_real_sync(vm_paddr_t ra, uint64_t val)
{
stxa_sync(ra, ASI_REAL, val);
}
static __inline uint64_t
load_real(vm_paddr_t ra)
{
uint64_t val;
val = ldxa(ra, ASI_REAL);
return val;
}
void load_real_dw(vm_paddr_t ra, uint64_t *lo, uint64_t *hi);
void bzerophyspage(vm_paddr_t ra, uint64_t size);
int hwblkclr(void *p, uint64_t size);
int novbcopy(void *src, void *dst, uint64_t size);
#endif /* !_MACHINE_CPUFUNC_H_ */

View File

@ -0,0 +1,72 @@
/*-
* Copyright (c) 1993 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: FreeBSD: src/sys/i386/include/sysarch.h,v 1.14 2000/09/21
* $FreeBSD$
*/
/*
* Architecture specific syscalls (sparc64)
*/
#ifndef _MACHINE_SYSARCH_H_
#define _MACHINE_SYSARCH_H_
#define SPARC_UTRAP_INSTALL 1
#define SPARC_SIGTRAMP_INSTALL 2
struct sparc_utrap_install_args {
int num;
const struct sparc_utrap_args *handlers;
};
struct sparc_sigtramp_install_args {
void *sia_new;
void **sia_old;
};
struct sparc_utrap_args {
utrap_entry_t type;
utrap_handler_t new_precise;
utrap_handler_t new_deferred;
utrap_handler_t *old_precise;
utrap_handler_t *old_deferred;
};
#ifndef _KERNEL
#include <sys/cdefs.h>
__BEGIN_DECLS
int __sparc_utrap_install(utrap_entry_t type, utrap_handler_t new_precise,
utrap_handler_t new_deferred,
utrap_handler_t *old_precise,
utrap_handler_t *old_deferred);
int sysarch(int, void *);
__END_DECLS
#endif
#endif /* !_MACHINE_SYSARCH_H_ */

36
sys/sun4v/include/tick.h Normal file
View File

@ -0,0 +1,36 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_TICK_H_
#define _MACHINE_TICK_H_
void tick_init(u_long clock);
void tick_start(void);
void tick_stop(void);
#endif

95
sys/sun4v/include/tlb.h Normal file
View File

@ -0,0 +1,95 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_TLB_H_
#define _MACHINE_TLB_H_
#define TLB_DIRECT_ADDRESS_BITS (43)
#define TLB_DIRECT_PAGE_BITS (PAGE_SHIFT_4M)
#define TLB_DIRECT_ADDRESS_MASK ((1UL << TLB_DIRECT_ADDRESS_BITS) - 1)
#define TLB_DIRECT_PAGE_MASK ((1UL << TLB_DIRECT_PAGE_BITS) - 1)
#define TLB_PHYS_TO_DIRECT(pa) \
((pa) | VM_MIN_DIRECT_ADDRESS)
#define TLB_DIRECT_TO_PHYS(va) \
((va) & TLB_DIRECT_ADDRESS_MASK)
#define TLB_DIRECT_TO_TTE_MASK \
(TD_V | TD_4M | (TLB_DIRECT_ADDRESS_MASK - TLB_DIRECT_PAGE_MASK))
#define TLB_DAR_SLOT_SHIFT (3)
#define TLB_DAR_SLOT(slot) ((slot) << TLB_DAR_SLOT_SHIFT)
#define TAR_VPN_SHIFT (13)
#define TAR_CTX_MASK ((1 << TAR_VPN_SHIFT) - 1)
#define TLB_TAR_VA(va) ((va) & ~TAR_CTX_MASK)
#define TLB_TAR_CTX(ctx) ((ctx) & TAR_CTX_MASK)
#define TLB_DEMAP_ID_SHIFT (4)
#define TLB_DEMAP_ID_PRIMARY (0)
#define TLB_DEMAP_ID_SECONDARY (1)
#define TLB_DEMAP_ID_NUCLEUS (2)
#define TLB_DEMAP_TYPE_SHIFT (6)
#define TLB_DEMAP_TYPE_PAGE (0)
#define TLB_DEMAP_TYPE_CONTEXT (1)
#define TLB_DEMAP_VA(va) ((va) & ~PAGE_MASK)
#define TLB_DEMAP_ID(id) ((id) << TLB_DEMAP_ID_SHIFT)
#define TLB_DEMAP_TYPE(type) ((type) << TLB_DEMAP_TYPE_SHIFT)
#define TLB_DEMAP_PAGE (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_PAGE))
#define TLB_DEMAP_CONTEXT (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_CONTEXT))
#define TLB_DEMAP_PRIMARY (TLB_DEMAP_ID(TLB_DEMAP_ID_PRIMARY))
#define TLB_DEMAP_SECONDARY (TLB_DEMAP_ID(TLB_DEMAP_ID_SECONDARY))
#define TLB_DEMAP_NUCLEUS (TLB_DEMAP_ID(TLB_DEMAP_ID_NUCLEUS))
#define TLB_CTX_KERNEL (0)
#define TLB_CTX_USER_MIN (1)
#define TLB_CTX_USER_MAX (8192)
typedef void tlb_flush_user_t(void);
struct pmap;
struct tlb_entry;
extern int kernel_tlb_slots;
extern struct tlb_entry *kernel_tlbs;
void tlb_context_demap(struct pmap *pm);
void tlb_page_demap(struct pmap *pm, vm_offset_t va);
void tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end);
tlb_flush_user_t cheetah_tlb_flush_user;
tlb_flush_user_t spitfire_tlb_flush_user;
extern tlb_flush_user_t *tlb_flush_user;
#endif /* !_MACHINE_TLB_H_ */

146
sys/sun4v/include/trap.h Normal file
View File

@ -0,0 +1,146 @@
/*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_TRAP_H_
#define _MACHINE_TRAP_H_
#ifdef _KERNEL
#define T_DATA_MISS 0x31
#define T_ALIGNMENT 0x34
#define T_DATA_PROTECTION 0x6c
#define T_MEM_ADDRESS_NOT_ALIGNED T_ALIGNMENT
#define T_RESERVED 0
#define T_INSTRUCTION_EXCEPTION 1
#define T_INSTRUCTION_ERROR 2
#define T_INSTRUCTION_PROTECTION 3
#define T_ILLTRAP_INSTRUCTION 4
#define T_ILLEGAL_INSTRUCTION 5
#define T_PRIVILEGED_OPCODE 6
#define T_FP_DISABLED 7
#define T_FP_EXCEPTION_IEEE_754 8
#define T_INSTRUCTION_MISS 0x09
#define T_TAG_OVERFLOW 0x0a
#define T_DIVISION_BY_ZERO 0x0b
#define T_DATA_EXCEPTION 0x0c
#define T_DATA_ERROR 0x0d
#define T_PRIVILEGED_ACTION 0x10
#define T_ASYNC_DATA_ERROR 0x11
#define T_TRAP_INSTRUCTION_16 0x12
#define T_TRAP_INSTRUCTION_17 0x13
#define T_TRAP_INSTRUCTION_18 0x14
#define T_TRAP_INSTRUCTION_19 0x15
#define T_TRAP_INSTRUCTION_20 0x16
#define T_TRAP_INSTRUCTION_21 0x17
#define T_TRAP_INSTRUCTION_22 0x18
#define T_TRAP_INSTRUCTION_23 0x19
#define T_TRAP_INSTRUCTION_24 0x1a
#define T_TRAP_INSTRUCTION_25 0x1b
#define T_TRAP_INSTRUCTION_26 0x1c
#define T_TRAP_INSTRUCTION_27 0x1d
#define T_TRAP_INSTRUCTION_28 0x1e
#define T_TRAP_INSTRUCTION_29 0x1f
#define T_TRAP_INSTRUCTION_30 0x20
#define T_TRAP_INSTRUCTION_31 0x21
#define T_FP_EXCEPTION_OTHER 0x22
#define T_INTERRUPT 0x24
#define T_PA_WATCHPOINT 0x25
#define T_VA_WATCHPOINT 0x26
#define T_CORRECTED_ECC_ERROR 0x27
#define T_SPILL 0x28
#define T_FILL 0x29
#define T_FILL_RET 0x2a
#define T_BREAKPOINT 0x2b
#define T_CLEAN_WINDOW 0x2c
#define T_RANGE_CHECK 0x2d
#define T_FIX_ALIGNMENT 0x2e
#define T_INTEGER_OVERFLOW 0x2f
#define T_SYSCALL 0x30
#define T_RSTRWP_PHYS
#define T_RSTRWP_VIRT
#define T_KSTACK_FAULT 51
#define T_RESUMABLE_ERROR 52
#define T_NONRESUMABLE_ERROR 53
#define T_MAX (T_NONRESUMABLE_ERROR + 1)
#define T_KERNEL 0x100
#define TRAP_MASK ((1<<8)-1)
#define TRAP_CTX_SHIFT 10
#define PTL1_BAD_DEBUG 0
#define PTL1_BAD_WTRAP 1
#define PTL1_BAD_KMISS 2
#define PTL1_BAD_KPROT_FAULT 3
#define PTL1_BAD_ISM 4
#define PTL1_BAD_MMUTRAP 5
#define PTL1_BAD_TRAP 6
#define PTL1_BAD_FPTRAP 7
#define PTL1_BAD_INTR_REQ 8
#define PTL1_BAD_TRACE_PTR 9
#define PTL1_BAD_STACK 10
#define PTL1_BAD_DTRACE_FLAGS 11
#define PTL1_BAD_CTX_STEAL 12
#define PTL1_BAD_ECC 13
#define PTL1_BAD_HCALL 14
#define PTL1_BAD_GL 15
#define TL_CPU_MONDO 0x1
#define TL_DEV_MONDO 0x2
#define TL_TSB_MISS 0x3
#define TL_TL0_TRAP 0x4
#define TL_SET_ACKMASK 0x5
/*
* These defines are used by the TL1 tlb miss handlers to calculate
* the pc to jump to in the case the entry was not found in the TSB.
*/
#define WTRAP_ALIGN 0x7f /* window handlers are 128 byte align */
#define WTRAP_FAULTOFF 124 /* last instruction in handler */
/* use the following defines to determine if trap was a fill or a spill */
#define WTRAP_TTMASK 0x180
#define WTRAP_TYPE 0x080
#ifndef LOCORE
extern const char *trap_msg[];
void trap_init(void);
#endif
#endif
#endif /* !_MACHINE_TRAP_H_ */

79
sys/sun4v/include/tsb.h Normal file
View File

@ -0,0 +1,79 @@
/*-
* Copyright (c) 2006 Kip Macy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_TSB_H_
#define _MACHINE_TSB_H_
#define MAX_TSB_INFO 2
/*
* Values for "tsb_ttesz_mask" bitmask.
*/
#define TSB8K (1 << TTE8K)
#define TSB64K (1 << TTE64K)
#define TSB512K (1 << TTE512K)
#define TSB4M (1 << TTE4M)
#define TSB32M (1 << TTE32M)
#define TSB256M (1 << TTE256M)
/*
* Kernel TSBs
*/
#define TSB8K_INDEX 0
#define TSB4M_INDEX 1
extern hv_tsb_info_t kernel_td[MAX_TSB_INFO];
struct hv_tsb_info;
vm_paddr_t tsb_init(struct hv_tsb_info *tsb, uint64_t *scratchval);
void tsb_deinit(struct hv_tsb_info *tsb);
void tsb_assert_invalid(struct hv_tsb_info *tsb, vm_offset_t va);
void tsb_set_tte(struct hv_tsb_info *tsb, vm_offset_t va, tte_t tte_data, uint64_t ctx);
void tsb_set_tte_real(struct hv_tsb_info *tsb, vm_offset_t va, tte_t tte_data, uint64_t ctx);
tte_t tsb_get_tte(struct hv_tsb_info *tsb, vm_offset_t va);
tte_t tsb_lookup_tte(vm_offset_t va, uint64_t context);
void tsb_clear(struct hv_tsb_info *tsb);
void tsb_clear_tte(struct hv_tsb_info *tsb, vm_offset_t va);
void tsb_clear_range(struct hv_tsb_info *tsb, vm_offset_t sva, vm_offset_t eva);
uint64_t tsb_set_scratchpad_kernel(struct hv_tsb_info *tsb);
uint64_t tsb_set_scratchpad_user(struct hv_tsb_info *tsb);
#endif /* !_MACHINE_TSB_H_ */

View File

@ -0,0 +1,84 @@
/*-
* Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_TSTATE_H_
#define _MACHINE_TSTATE_H_
#include <machine/pstate.h>
#include <machine/ccr.h>
#define TSTATE_CWP_SHIFT 0
#define TSTATE_CWP_BITS 5
#define TSTATE_CWP_MASK \
(((1 << TSTATE_CWP_BITS) - 1) << TSTATE_CWP_SHIFT)
#define TSTATE_CWP(x) ((x & TSTATE_CWP_MASK) >> TSTATE_CWP_SHIFT)
#define TSTATE_PSTATE_SHIFT 8
#define TSTATE_PSTATE_BITS 12
#define TSTATE_PSTATE_MASK \
(((1 << TSTATE_PSTATE_BITS) - 1) << TSTATE_PSTATE_SHIFT)
#define TSTATE_PSTATE(x) ((x) << TSTATE_PSTATE_SHIFT)
#define TSTATE_AG TSTATE_PSTATE(PSTATE_AG)
#define TSTATE_IE TSTATE_PSTATE(PSTATE_IE)
#define TSTATE_PRIV TSTATE_PSTATE(PSTATE_PRIV)
#define TSTATE_AM TSTATE_PSTATE(PSTATE_AM)
#define TSTATE_PEF TSTATE_PSTATE(PSTATE_PEF)
#define TSTATE_RED TSTATE_PSTATE(PSTATE_RED)
#define TSTATE_MM_TSO TSTATE_PSTATE(PSTATE_MM_TSO)
#define TSTATE_MM_PSO TSTATE_PSTATE(PSTATE_MM_PSO)
#define TSTATE_MM_RMO TSTATE_PSTATE(PSTATE_MM_RMO)
#define TSTATE_TLE TSTATE_PSTATE(PSTATE_TLE)
#define TSTATE_CLE TSTATE_PSTATE(PSTATE_CLE)
#define TSTATE_MG TSTATE_PSTATE(PSTATE_MG)
#define TSTATE_IG TSTATE_PSTATE(PSTATE_IG)
#define TSTATE_KERNEL TSTATE_PSTATE(PSTATE_KERNEL)
#define TSTATE_ASI_SHIFT 24
#define TSTATE_ASI_BITS 8
#define TSTATE_ASI_MASK \
(((1 << TSTATE_ASI_BITS) - 1) << TSTATE_ASI_SHIFT)
#define TSTATE_ASI(x) ((x & TSTATE_ASI_MASK) >> TSTATE_ASI_SHIFT)
#define TSTATE_CCR_SHIFT 32
#define TSTATE_ICC_SHIFT (TSTATE_CCR_SHIFT + ICC_SHIFT)
#define TSTATE_ICC_MASK (ICC_MASK << TSTATE_CCR_SHIFT)
#define TSTATE_XCC_SHIFT (TSTATE_CCR_SHIFT + XCC_SHIFT)
#define TSTATE_XCC_MASK (XCC_MASK << TSTATE_CCR_SHIFT)
#define TSTATE_CCR(x) ((x) << TSTATE_CCR_SHIFT)
#define TSTATE_ICC_C TSTATE_CCR(ICC_C)
#define TSTATE_ICC_V TSTATE_CCR(ICC_V)
#define TSTATE_ICC_Z TSTATE_CCR(ICC_Z)
#define TSTATE_ICC_N TSTATE_CCR(ICC_N)
#define TSTATE_XCC_C TSTATE_CCR(XCC_C)
#define TSTATE_XCC_V TSTATE_CCR(XCC_V)
#define TSTATE_XCC_Z TSTATE_CCR(XCC_Z)
#define TSTATE_XCC_N TSTATE_CCR(XCC_N)
#define TSTATE_SECURE(tstate) \
PSTATE_SECURE(((tstate) >> TSTATE_PSTATE_SHIFT) & ((1 << TSTATE_PSTATE_BITS) - 1))
#endif /* !_MACHINE_TSTATE_H_ */

243
sys/sun4v/include/tte.h Normal file
View File

@ -0,0 +1,243 @@
/*-
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Berkeley Software Design Inc's name may not be used to endorse or
* promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: BSDI: pmap.v9.h,v 1.10.2.6 1999/08/23 22:18:44 cp Exp
* $FreeBSD$
*/
#ifndef _MACHINE_TTE_H_
#define _MACHINE_TTE_H_
#define TTE_SHIFT (4)
#define TD_SOFT2_SHIFT (50)
#define TD_DIAG_SHIFT (41)
#define TD_PA_SHIFT (13)
#define TD_SOFT_SHIFT (7)
#define TD_SOFT2_BITS (9)
#define TD_DIAG_BITS (9)
#define TD_PA_BITS (42)
#define TD_SOFT_BITS (6)
#define TD_SOFT2_MASK ((1UL << TD_SOFT2_BITS) - 1)
#define TD_DIAG_MASK ((1UL << TD_DIAG_BITS) - 1)
#define TD_PA_MASK ((1UL << TD_PA_BITS) - 1)
#define TD_SOFT_MASK ((1UL << TD_SOFT_BITS) - 1)
#define TTE8K (0UL)
#define TTE64K (1UL)
#define TTE512K (2UL)
#define TTE4M (3UL)
#define TTE32M (4UL)
#define TTE256M (5UL)
#define TTE2G (6UL)
#define TTE16G (7UL)
#define TD_PA(pa) ((pa) & (TD_PA_MASK << TD_PA_SHIFT))
/* NOTE: bit 6 of TD_SOFT will be sign-extended if used as an immediate. */
#define TD_FAKE ((1UL << 5) << TD_SOFT_SHIFT)
#define TD_EXEC ((1UL << 4) << TD_SOFT_SHIFT)
#define TD_REF ((1UL << 3) << TD_SOFT_SHIFT)
#define TD_PV ((1UL << 2) << TD_SOFT_SHIFT)
#define TD_SW ((1UL << 1) << TD_SOFT_SHIFT)
#define TD_WIRED ((1UL << 0) << TD_SOFT_SHIFT)
#define TD_L (1UL << 6)
#define TD_CP (1UL << 5)
#define TD_CV (1UL << 4)
#define TD_E (1UL << 3)
#define TD_P (1UL << 2)
#define TD_W (1UL << 1)
#define TD_G (1UL << 0)
#define TTE_GET_PAGE_SIZE(tp) \
(1 << TTE_GET_PAGE_SHIFT(tp))
#define TTE_GET_PAGE_MASK(tp) \
(TTE_GET_PAGE_SIZE(tp) - 1)
#define TTE_GET_PA(tte_data) \
(tte_data & (TD_PA_MASK << TD_PA_SHIFT))
#define TTE_GET_VPN(tp) \
((tp)->tte_vpn >> TV_SIZE_BITS)
#define TTE_GET_VA(tp) \
(TTE_GET_VPN(tp) << TTE_GET_PAGE_SHIFT(tp))
#define TTE_GET_PMAP(tp) \
(((tp)->tte_data & TD_P) != 0 ? \
(kernel_pmap) : \
(PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)(tp)))->md.pmap))
#define TTE_ZERO(tp) \
memset(tp, 0, sizeof(*tp))
struct pmap;
#define PTE_SHIFT (3)
#define PT_SHIFT (PAGE_SHIFT - PTE_SHIFT)
#define VTD_SOFT_SHIFT (56)
#define VTD_V (1UL << 63)
#define VTD_NFO (1UL << 62)
#define VTD_PA(pa) ((pa) & (TD_PA_MASK << TD_PA_SHIFT))
#define VTD_IE (1UL << 12)
#define VTD_E (1UL << 11)
#define VTD_CP (1UL << 10)
#define VTD_CV (1UL << 9)
#define VTD_P (1UL << 8)
#define VTD_X (1UL << 7)
#define VTD_W (1UL << 6)
#define VTD_REF (1UL << 5)
#define VTD_SW_W (1UL << 4)
#define VTD_MANAGED (1UL << 58)
#define VTD_WIRED (1UL << 57)
#define VTD_LOCK (1UL << 56)
#define VTD_8K TTE8K
#define VTD_64K TTE64K
#define VTD_512K TTE512K
#define VTD_4M TTE4M
#define VTD_32M TTE32M
#define VTD_256M TTE256M
/*
* default flags for kernel pages
*/
#define TTE_KERNEL VTD_V | VTD_CP | VTD_CV | VTD_P | VTD_X | VTD_W | VTD_SW_W | VTD_REF | VTD_WIRED
#define TTE_KERNEL_MINFLAGS VTD_P
#define TTE_MINFLAGS VTD_V | VTD_CP | VTD_CV
#define VTD_SIZE_BITS (4)
#define VTD_SIZE_MASK ((1 << VTD_SIZE_BITS) - 1)
#define TTE_SIZE_SPREAD (3)
#define TTE_PAGE_SHIFT(sz) \
(PAGE_SHIFT + ((sz) * TTE_SIZE_SPREAD))
#define TTE_GET_SIZE(tte_data) \
(tte_data & VTD_SIZE_MASK)
#define TTE_GET_PAGE_SHIFT(tte_data) \
TTE_PAGE_SHIFT(TTE_GET_SIZE(tte_data))
#ifdef notyet
typedef union {
struct tte {
unsigned int v:1; /* <63> valid */
unsigned int nfo:1; /* <62> non-fault only */
unsigned int sw:3; /* <61:59> sw */
unsigned int managed:1; /* <58> managed */
unsigned int wired:1; /* <57> wired */
unsigned int lock:1; /* <56> sw - locked */
unsigned long pa:43; /* <55:13> pa */
unsigned int ie:1; /* <12> 1=invert endianness */
unsigned int e:1; /* <11> side effect */
unsigned int cp:1; /* <10> physically cache */
unsigned int cv:1; /* <9> virtually cache */
unsigned int p:1; /* <8> privilege required */
unsigned int x:1; /* <7> execute perm */
unsigned int w:1; /* <6> write perm */
unsigned int ref:1; /* <5> sw - ref */
unsigned int wr_perm:1; /* <4> sw - write perm */
unsigned int rsvd:1; /* <3> reserved */
unsigned int sz:3; /* <2:0> pagesize */
} tte_bit;
uint64_t ll;
} tte_t;
#endif
#define tte_val tte_bit.v /* use < 0 check in asm */
#define tte_size tte_bit.sz
#define tte_nfo tte_bit.nfo
#define tte_ie tte_bit.ie
#define tte_wired tte_bit.wired
#define tte_pa tte_bit.pa
#define tte_ref tte_bit.ref
#define tte_wr_perm tte_bit.wr_perm
#define tte_exec_perm tte_bit.x
#define tte_lock tte_bit.lock
#define tte_cp tte_bit.cp
#define tte_cv tte_bit.cv
#define tte_se tte_bit.e
#define tte_priv tte_bit.p
#define tte_hwwr tte_bit.w
#define TTE_IS_VALID(ttep) ((ttep)->tte_inthi < 0)
#define TTE_SET_INVALID(ttep) ((ttep)->tte_val = 0)
#define TTE_IS_8K(ttep) (TTE_CSZ(ttep) == TTE8K)
#define TTE_IS_WIRED(ttep) ((ttep)->tte_wired)
#define TTE_IS_WRITABLE(ttep) ((ttep)->tte_wr_perm)
#define TTE_IS_EXECUTABLE(ttep) ((ttep)->tte_exec_perm)
#define TTE_IS_PRIVILEGED(ttep) ((ttep)->tte_priv)
#define TTE_IS_NOSYNC(ttep) ((ttep)->tte_no_sync)
#define TTE_IS_LOCKED(ttep) ((ttep)->tte_lock)
#define TTE_IS_SIDEFFECT(ttep) ((ttep)->tte_se)
#define TTE_IS_NFO(ttep) ((ttep)->tte_nfo)
#define TTE_IS_REF(ttep) ((ttep)->tte_ref)
#define TTE_IS_MOD(ttep) ((ttep)->tte_hwwr)
#define TTE_IS_IE(ttep) ((ttep)->tte_ie)
#define TTE_SET_SUSPEND(ttep) ((ttep)->tte_suspend = 1)
#define TTE_CLR_SUSPEND(ttep) ((ttep)->tte_suspend = 0)
#define TTE_IS_SUSPEND(ttep) ((ttep)->tte_suspend)
#define TTE_SET_REF(ttep) ((ttep)->tte_ref = 1)
#define TTE_CLR_REF(ttep) ((ttep)->tte_ref = 0)
#define TTE_SET_LOCKED(ttep) ((ttep)->tte_lock = 1)
#define TTE_CLR_LOCKED(ttep) ((ttep)->tte_lock = 0)
#define TTE_SET_MOD(ttep) ((ttep)->tte_hwwr = 1)
#define TTE_CLR_MOD(ttep) ((ttep)->tte_hwwr = 0)
#define TTE_SET_RM(ttep) \
(((ttep)->tte_intlo) = \
(ttep)->tte_intlo | TTE_HWWR_INT | TTE_REF_INT)
#define TTE_CLR_RM(ttep) \
(((ttep)->tte_intlo) = \
(ttep)->tte_intlo & ~(TTE_HWWR_INT | TTE_REF_INT))
#define TTE_SET_WRT(ttep) ((ttep)->tte_wr_perm = 1)
#define TTE_CLR_WRT(ttep) ((ttep)->tte_wr_perm = 0)
#define TTE_SET_EXEC(ttep) ((ttep)->tte_exec_perm = 1)
#define TTE_CLR_EXEC(ttep) ((ttep)->tte_exec_perm = 0)
#define TTE_SET_PRIV(ttep) ((ttep)->tte_priv = 1)
#define TTE_CLR_PRIV(ttep) ((ttep)->tte_priv = 0)
#define TTE_BSZS_SHIFT(sz) ((sz) * 3)
struct pmap;
void tte_clear_phys_bit(vm_page_t m, uint64_t flags);
void tte_set_phys_bit(vm_page_t m, uint64_t flags);
boolean_t tte_get_phys_bit(vm_page_t m, uint64_t flags);
void tte_clear_virt_bit(struct pmap *pmap, vm_offset_t va, uint64_t flags);
void tte_set_virt_bit(struct pmap *pmap, vm_offset_t va, uint64_t flags);
boolean_t tte_get_virt_bit(struct pmap *pmap, vm_offset_t va, uint64_t flags);
#endif /* !_MACHINE_TTE_H_ */

View File

@ -0,0 +1,75 @@
/*-
* Copyright (c) 2006 Kip Macy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _MACHINE_TTE_HASH_H_
#define _MACHINE_TTE_HASH_H_
#define HASH_ENTRY_SHIFT 2
#define HASH_ENTRIES ((1 << HASH_ENTRY_SHIFT) - 1)
#define THE_SHIFT (TTE_SHIFT + HASH_ENTRY_SHIFT) /* size of TSB entry * #entries */
#define TH_COLLISION_SHIFT 47 /* bit 47 will never be set for a valid tag */
#define TH_COLLISION (1UL << TH_COLLISION_SHIFT)
#define TH_INVALID_SHIFT 46 /* bit 47 will never be set for a valid tag */
#define TH_INVALID (1UL << TH_INVALID_SHIFT)
struct tte_hash;
typedef struct tte_hash *tte_hash_t;
void tte_hash_init(void);
void tte_hash_clear(tte_hash_t hash);
tte_t tte_hash_clear_bits(tte_hash_t hash, vm_offset_t va, uint64_t flags);
tte_hash_t tte_hash_kernel_create(vm_offset_t, uint64_t, vm_paddr_t);
tte_hash_t tte_hash_create(uint64_t context, uint64_t *scratchval);
void tte_hash_destroy(tte_hash_t th);
tte_t tte_hash_delete(tte_hash_t hash, vm_offset_t va);
void tte_hash_delete_all(tte_hash_t hash);
void tte_hash_insert(tte_hash_t hash, vm_offset_t va, tte_t data);
tte_t tte_hash_lookup(tte_hash_t hash, vm_offset_t va);
tte_t tte_hash_lookup_nolock(tte_hash_t hash, vm_offset_t va);
void tte_hash_reset(tte_hash_t hash);
uint64_t tte_hash_set_scratchpad_kernel(tte_hash_t th);
uint64_t tte_hash_set_scratchpad_user(tte_hash_t th, uint64_t context);
tte_t tte_hash_update(tte_hash_t hash, vm_offset_t va, tte_t tte_data);
#endif /* _MACHINE_TTE_HASH_H_ */

View File

@ -0,0 +1,64 @@
/*-
* Copyright (c) 1999 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* from: FreeBSD: src/sys/alpha/include/ucontext.h,v 1.3 1999/10/08
* $FreeBSD$
*/
#ifndef _MACHINE_UCONTEXT_H_
#define _MACHINE_UCONTEXT_H_
struct __mcontext {
uint64_t mc_global[8];
uint64_t mc_out[8];
uint64_t mc_local[8];
uint64_t mc_in[8];
uint32_t mc_fp[64];
} __aligned(64);
typedef struct __mcontext mcontext_t;
#define mc_flags mc_global[0]
#define mc_sp mc_out[6]
#define mc_fprs mc_local[0]
#define mc_fsr mc_local[1]
#define mc_gsr mc_local[2]
#define mc_tnpc mc_in[0]
#define mc_tpc mc_in[1]
#define mc_tstate mc_in[2]
#define mc_y mc_in[4]
#define mc_wstate mc_in[5]
#define _MC_VERSION_SHIFT 0
#define _MC_VERSION_BITS 32
#define _MC_VERSION 1L
#define _MC_FLAGS_SHIFT 32
#define _MC_FLAGS_BITS 32
#define _MC_VOLUNTARY ((1L << 0) << _MC_FLAGS_SHIFT)
#endif /* !_MACHINE_UCONTEXT_H_ */

Some files were not shown because too many files have changed in this diff Show More