This commit is contained in:
attilio 2011-05-14 02:28:26 +00:00
parent 9ff3491e67
commit 548a471624
192 changed files with 33 additions and 33205 deletions

View File

@ -131,7 +131,7 @@ _MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${
# Guess machine architecture from machine type, and vice versa.
.if !defined(TARGET_ARCH) && defined(TARGET)
_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/}
_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/mips/mipsel/}
.elif !defined(TARGET) && defined(TARGET_ARCH) && \
${TARGET_ARCH} != ${MACHINE_ARCH}
_TARGET= ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/}
@ -323,12 +323,11 @@ toolchains:
# existing system is.
#
.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v
TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64
TARGET_ARCHES_arm?= arm armeb
TARGET_ARCHES_mips?= mipsel mipseb mips64el mips64eb mipsn32eb
TARGET_ARCHES_powerpc?= powerpc powerpc64
TARGET_ARCHES_pc98?= i386
TARGET_ARCHES_sun4v?= sparc64
.for target in ${TARGETS}
TARGET_ARCHES_${target}?= ${target}
.endfor

View File

@ -130,7 +130,7 @@ VERSION!= uname -srp
VERSION+= ${OSRELDATE}
.endif
KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerpc powerpc64/powerpc sparc64 sparc64/sun4v
KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerpc powerpc64/powerpc sparc64
.if ${TARGET} == ${TARGET_ARCH}
_t= ${TARGET}
.else

View File

@ -22,6 +22,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
machines to maximize performance. (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
20110513:
Support for sun4v architecture is officially dropped
20110430:
Users of the Atheros AR71xx SoC code now need to add 'device ar71xx_pci'
into their kernel configurations along with 'device pci'.

View File

@ -16,7 +16,6 @@ ports
powerpc
sparc64
standards
sun4v
threads
usb
www

View File

@ -233,9 +233,6 @@ SPARC processor specific problems.
.B standards
Standards conformance issues.
.TP
.B sun4v
Problems specific to the SPARC sun4v architecture and processors.
.TP
.B threads
Problems related to threading on FreeBSD.
.TP

View File

@ -11,9 +11,6 @@ SRCS+= __sparc_sigtramp_setup.c \
sigcode.S
CFLAGS+= -I${.CURDIR}/sparc64/fpu
.if ${MACHINE} == "sun4v"
CFLAGS+= -DSUN4V
.endif
MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction.S

View File

@ -38,10 +38,6 @@ __FBSDID("$FreeBSD$");
#include "assym.s"
ENTRY(__sparc_utrap_gen)
#ifdef SUN4V
save
ta %xcc, ST_FPEMU_CONTEXT
#endif
sub %sp, UF_SIZEOF, %sp
stx %o0, [%sp + SPOFF + CCFSZ + UF_TYPE]

View File

@ -10,11 +10,7 @@ _open_disk= open_disk.c
LIB= disk
SRCS= blocks.c ${_change} chunk.c create_chunk.c disk.c ${_open_disk} \
rules.c write_disk.c
.if ${MACHINE} == "sun4v"
SRCS+= write_sparc64_disk.c
.else
SRCS+= write_${MACHINE}_disk.c
.endif
INCS= libdisk.h

View File

@ -5,10 +5,6 @@ LIB= kvm
SHLIBDIR?= /lib
CFLAGS+=-DLIBC_SCCS -I${.CURDIR}
.if ${MACHINE} == "sun4v"
CFLAGS+=-DSUN4V
.endif
.if exists(${.CURDIR}/kvm_${MACHINE_ARCH}.c)
KVM_ARCH=${MACHINE_ARCH}
.else

View File

@ -188,11 +188,9 @@ _kvm_initvtop(kvm_t *kd)
int
_kvm_kvatop(kvm_t *kd, u_long va, off_t *pa)
{
#if !defined(SUN4V)
struct tte tte;
off_t tte_off;
u_long vpn;
#endif
off_t pa_off;
u_long pg_off;
int rest;
@ -200,7 +198,6 @@ _kvm_kvatop(kvm_t *kd, u_long va, off_t *pa)
pg_off = va & PAGE_MASK;
if (va >= VM_MIN_DIRECT_ADDRESS)
pa_off = TLB_DIRECT_TO_PHYS(va) & ~PAGE_MASK;
#if !defined(SUN4V)
else {
vpn = btop(va);
tte_off = kd->vmst->vm_tsb_off +
@ -211,7 +208,6 @@ _kvm_kvatop(kvm_t *kd, u_long va, off_t *pa)
goto invalid;
pa_off = TTE_GET_PA(&tte);
}
#endif
rest = PAGE_SIZE - pg_off;
pa_off = _kvm_find_off(kd->vmst, pa_off, rest);
if (pa_off == KVM_OFF_NOTFOUND)

View File

@ -57,7 +57,6 @@
<!ENTITY arch.pc98 "pc98">
<!ENTITY arch.powerpc "powerpc">
<!ENTITY arch.sparc64 "sparc64">
<!ENTITY arch.sun4v "sun4v">
<!-- The marker for MFCs. -->
<!ENTITY merged "MERGED">

View File

@ -1,44 +0,0 @@
# $FreeBSD$
buildopts -DRELEASE_CRUNCH -Dlint
srcdirs /usr/src/bin
progs hostname
progs pwd
progs rm
progs sh
progs test
ln sh -sh
ln test [
srcdirs /usr/src/sbin
progs camcontrol
progs dhclient
progs fsck_ffs
progs ifconfig
progs mount_nfs
progs newfs
progs route
progs rtsol
progs tunefs
ln fsck_ffs fsck_4.2bsd
ln fsck_ffs fsck_ufs
srcdirs /usr/src/usr.bin
progs cpio
progs find
progs minigzip
progs sed
ln minigzip gzip
ln minigzip gunzip
ln minigzip zcat
srcdirs /usr/src/usr.sbin
progs arp
progs ppp
progs sysinstall
progs usbconfig
libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
libs -lodialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml
libs -larchive -lcrypto -lbz2 -llzma -lusb -ljail

View File

@ -1,72 +0,0 @@
#!/bin/sh
#
# Module: mkisoimages.sh
# Author: Jordan K Hubbard
# Date: 22 June 2001
#
# $FreeBSD$
#
# This script is used by release/Makefile to build the (optional) ISO images
# for a FreeBSD release. It is considered architecture dependent since each
# platform has a slightly unique way of making bootable CDs. This script
# is also allowed to generate any number of images since that is more of
# publishing decision than anything else.
#
# Usage:
#
# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
#
# Where -b is passed if the ISO image should be made "bootable" by
# whatever standards this architecture supports (may be unsupported),
# image-label is the ISO image label, image-name is the filename of the
# resulting ISO image, base-bits-dir contains the image contents and
# extra-bits-dir, if provided, contains additional files to be merged
# into base-bits-dir as part of making the image.
publisher="The FreeBSD Project. http://www.freebsd.org/"
IMG=/tmp/bootfs
MNT=/mnt
if [ "x$1" = "x-b" ]; then
dd if=/dev/zero of=${IMG} bs=512 count=1024
MD=`mdconfig -a -t vnode -f ${IMG}`
sunlabel -w -B -b $4/boot/boot1 ${MD} auto
newfs -O1 -o space -m 0 /dev/${MD}
mount /dev/${MD} ${MNT}
mkdir ${MNT}/boot
cp $4/boot/loader ${MNT}/boot
umount ${MNT}
mdconfig -d -u ${MD#md}
bootable="-B ,,,,${IMG}"
shift
else
bootable=""
fi
if [ $# -lt 3 ]; then
echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
rm -f ${IMG}
exit 1
fi
type mkisofs 2>&1 | grep " is " >/dev/null
if [ $? -ne 0 ]; then
echo The cdrtools port is not installed. Trying to get it now.
if [ -f /usr/ports/sysutils/cdrtools/Makefile ]; then
cd /usr/ports/sysutils/cdrtools && make install BATCH=yes && make clean
else
if ! pkg_add -r cdrtools; then
echo "Could not get it via pkg_add - please go install this"
echo "from the ports collection and run this script again."
exit 2
fi
fi
fi
LABEL=$1; shift
NAME=$1; shift
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
mkisofs $bootable -r -J -V $LABEL -publisher "$publisher" -o $NAME $*
rm $1/etc/fstab
rm -f ${IMG}

View File

@ -1373,7 +1373,7 @@ The kernel debugger was entered as a result of the
sysctl being set.
.It Dv kdb.enter.trapsig
The kernel debugger was entered as a result of a trapsig event on the sparc64
or sun4v platform.
platform.
.It Dv kdb.enter.unionfs
The kernel debugger was entered as a result of an assertion failure in the
union file system.

View File

@ -257,7 +257,7 @@ When set, it also enforces the following options:
Set to not build the Clang C/C++ compiler.
.Pp
It is a default setting on
arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, powerpc/powerpc64, sparc64/sparc64 and sun4v/sparc64.
arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, powerpc/powerpc64 and sparc64/sparc64.
.It Va WITH_CLANG
.\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru
Set to build the Clang C/C++ compiler.
@ -337,7 +337,7 @@ Set to not build Flattened Device Tree support as part of the base system.
This includes the device tree compiler (dtc) and libfdt support library.
.Pp
It is a default setting on
amd64/amd64, i386/i386, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, pc98/i386, powerpc/powerpc64, sparc64/sparc64 and sun4v/sparc64.
amd64/amd64, i386/i386, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, pc98/i386, powerpc/powerpc64 and sparc64/sparc64.
.It Va WITH_FDT
.\" from FreeBSD: head/tools/build/options/WITH_FDT 221730 2011-05-10 11:14:40Z ru
Set to build Flattened Device Tree support as part of the base system.

View File

@ -14,7 +14,7 @@ CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
netsmb nfs nfsclient nfsserver nlm opencrypto \
pci rpc security sys ufs vm xdr ${CSCOPE_ARCHDIR}
.if defined(ALL_ARCH)
CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v x86
CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86
.else
CSCOPE_ARCHDIR ?= ${MACHINE}
.endif

View File

@ -13,7 +13,7 @@ SUBDIR+= fdt
.endif
# Pick the machine-dependent subdir based on the target architecture.
ADIR= ${MACHINE:S/amd64/i386/:S/sun4v/sparc64/:S/powerpc64/powerpc/}
ADIR= ${MACHINE:S/amd64/i386/:S/powerpc64/powerpc/}
.if exists(${.CURDIR}/${ADIR}/.)
SUBDIR+= ${ADIR}
.endif

View File

@ -597,7 +597,7 @@ Modifies kernel option
Limits the amount of KVM reserved for use by the
buffer cache, specified in bytes.
The default maximum is 200MB on i386,
and 400MB on amd64, sparc64, and sun4v.
and 400MB on amd64 and sparc64.
This parameter is used to
prevent the buffer cache from eating too much
KVM in large-memory machine configurations.

View File

@ -113,13 +113,11 @@ static int map_phys(int, size_t, vm_offset_t, vm_offset_t);
static void release_phys(vm_offset_t, u_int);
static int __elfN(exec)(struct preloaded_file *);
static int mmu_mapin_sun4u(vm_offset_t, vm_size_t);
static int mmu_mapin_sun4v(vm_offset_t, vm_size_t);
static vm_offset_t init_heap(void);
static phandle_t find_bsp_sun4u(phandle_t, uint32_t);
const char *cpu_cpuid_prop_sun4u(void);
uint32_t cpu_get_mid_sun4u(void);
static void tlb_init_sun4u(void);
static void tlb_init_sun4v(void);
#ifdef LOADER_DEBUG
typedef u_int64_t tte_t;
@ -129,7 +127,6 @@ static void pmap_print_tte_sun4u(tte_t, tte_t);
#endif
static struct mmu_ops mmu_ops_sun4u = { tlb_init_sun4u, mmu_mapin_sun4u };
static struct mmu_ops mmu_ops_sun4v = { tlb_init_sun4v, mmu_mapin_sun4v };
/* sun4u */
struct tlb_entry *dtlb_store;
@ -140,16 +137,6 @@ static int cpu_impl;
static u_int dtlb_slot_max;
static u_int itlb_slot_max;
/* sun4v */
static struct tlb_entry *tlb_store;
static int is_sun4v = 0;
/*
* no direct TLB access on sun4v
* we somewhat arbitrarily declare enough
* slots to cover a 4GB AS with 4MB pages
*/
#define SUN4V_TLB_SLOT_MAX (1 << 10)
static vm_offset_t curkva = 0;
static vm_offset_t heapva;
@ -568,47 +555,6 @@ mmu_mapin_sun4u(vm_offset_t va, vm_size_t len)
return (0);
}
static int
mmu_mapin_sun4v(vm_offset_t va, vm_size_t len)
{
vm_offset_t pa, mva;
if (va + len > curkva)
curkva = va + len;
pa = (vm_offset_t)-1;
len += va & PAGE_MASK_4M;
va &= ~PAGE_MASK_4M;
while (len) {
if ((va >> 22) > SUN4V_TLB_SLOT_MAX)
panic("%s: trying to map more than 4GB", __func__);
if (tlb_store[va >> 22].te_pa == -1) {
/* Allocate a physical page, claim the virtual area */
if (pa == (vm_offset_t)-1) {
pa = alloc_phys(PAGE_SIZE_4M, PAGE_SIZE_4M);
if (pa == (vm_offset_t)-1)
panic("%s: out of memory", __func__);
mva = claim_virt(va, PAGE_SIZE_4M, 0);
if (mva != va)
panic("%s: can't claim virtual page "
"(wanted %#lx, got %#lx)",
__func__, va, mva);
}
tlb_store[va >> 22].te_pa = pa;
if (map_phys(-1, PAGE_SIZE_4M, va, pa) == -1)
printf("%s: can't map physical page\n",
__func__);
pa = (vm_offset_t)-1;
}
len -= len > PAGE_SIZE_4M ? PAGE_SIZE_4M : len;
va += PAGE_SIZE_4M;
}
if (pa != (vm_offset_t)-1)
release_phys(pa, PAGE_SIZE_4M);
return (0);
}
static vm_offset_t
init_heap(void)
{
@ -739,14 +685,6 @@ tlb_init_sun4u(void)
panic("%s: can't allocate TLB store", __func__);
}
static void
tlb_init_sun4v(void)
{
tlb_store = malloc(SUN4V_TLB_SLOT_MAX * sizeof(*tlb_store));
memset(tlb_store, 0xFF, SUN4V_TLB_SLOT_MAX * sizeof(*tlb_store));
}
int
main(int (*openfirm)(void *))
{
@ -777,14 +715,7 @@ main(int (*openfirm)(void *))
if ((root = OF_peer(0)) == -1)
panic("%s: can't get root phandle", __func__);
OF_getprop(root, "compatible", compatible, sizeof(compatible));
if (!strcmp(compatible, "sun4v")) {
printf("\nBooting with sun4v support.\n");
mmu_ops = &mmu_ops_sun4v;
is_sun4v = 1;
} else {
printf("\nBooting with sun4u support.\n");
mmu_ops = &mmu_ops_sun4u;
}
mmu_ops = &mmu_ops_sun4u;
mmu_ops->tlb_init();

View File

@ -1,49 +0,0 @@
# 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"

View File

@ -1,111 +0,0 @@
# 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
crypto/des/des_enc.c optional crypto | ipsec | netsmb
dev/ofw/ofw_bus_if.m standard
dev/ofw/ofw_bus_subr.c standard
dev/ofw/ofw_console.c optional ofw_console
dev/ofw/ofw_if.m standard
dev/ofw/ofw_standard.c standard
dev/ofw/openfirm.c standard
dev/ofw/openfirmio.c standard
dev/ofw/openpromio.c standard
dev/uart/uart_cpu_sparc64.c optional uart
kern/kern_clocksource.c standard
kern/syscalls.c optional ktr
libkern/ffs.c standard
libkern/ffsl.c standard
libkern/fls.c standard
libkern/flsl.c standard
libkern/memmove.c standard
sparc64/ebus/ebus.c optional ebus
sparc64/isa/isa.c optional isa
sparc64/isa/isa_dma.c optional isa
sparc64/isa/ofw_isa.c optional ebus | isa
sparc64/sparc64/autoconf.c standard
sun4v/sun4v/bus_machdep.c standard
sun4v/sun4v/clock.c standard
sparc64/sparc64/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
sparc64/sparc64/elf_machdep.c standard
sun4v/sun4v/exception.S standard no-obj
sparc64/sparc64/gdb_machdep.c optional gdb
sun4v/sun4v/hv_pci.c optional pci
sun4v/sun4v/trap_trace.S optional trap_tracing
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
# XXX hvcons should be optional
sun4v/sun4v/hvcons.c standard
sun4v/sun4v/hcall.S standard
sun4v/sun4v/hviommu.c standard
sparc64/sparc64/identcpu.c standard
sparc64/sparc64/in_cksum.c optional inet | inet6
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
sparc64/sparc64/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/cddl/t1_copy.S standard
sparc64/sparc64/ofw_machdep.c standard
sun4v/sun4v/pmap.c standard
sparc64/sparc64/prof_machdep.c optional profiling-routine
sparc64/sparc64/rwindow.c standard
sun4v/sun4v/rtc.c standard
sun4v/sun4v/simdisk.c optional simulator
sun4v/sun4v/stack_machdep.c optional ddb | stack
sun4v/sun4v/support.S standard
sparc64/sparc64/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/dev/vnet.c optional vnet
sun4v/mdesc/mdesc_bus_if.m standard
sun4v/mdesc/mdesc_init.c standard
sun4v/mdesc/mdesc_subr.c standard
sun4v/mdesc/mdesc_bus_subr.c standard
sun4v/cddl/mdesc/mdesc_findname.c standard
sun4v/cddl/mdesc/mdesc_getpropstr.c standard
sun4v/cddl/mdesc/mdesc_getpropval.c standard
sun4v/cddl/mdesc/mdesc_init_intern.c standard
sun4v/cddl/mdesc/mdesc_nodecount.c standard
sun4v/cddl/mdesc/mdesc_findnodeprop.c standard
sun4v/cddl/mdesc/mdesc_rootnode.c standard
sun4v/cddl/mdesc/mdesc_scandag.c standard
sun4v/mdesc/mdesc_vdevfindnode.c standard
sun4v/mdesc/mdesc_vdevfindval.c standard

View File

@ -1,15 +0,0 @@
# $FreeBSD$
SUN4V opt_global.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

@ -277,7 +277,7 @@ ar5416InitCal(struct ath_hal *ah, const struct ieee80211_channel *chan)
/*
* Enable IQ, ADC Gain, ADC DC Offset Cals
*/
if (AR_SREV_SOWL_10_OR_LATER(ah)) {
if (AR_SREV_HOWL(ah) || AR_SREV_SOWL_10_OR_LATER(ah)) {
/* Setup all non-periodic, init time only calibrations */
/* XXX: Init DC Offset not working yet */
#if 0

View File

@ -172,7 +172,7 @@ static const struct txschedule series_half[] = {
#undef H
#ifdef Q
#undef Q /* sun4v bogosity */
#undef Q
#endif
#define Q(_r) \
(((_r) == 1.5) ? 0 : (((_r) ==2.25) ? 1 : (((_r) == 3) ? 2 : \

View File

@ -119,17 +119,11 @@ static int ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de,
/*
* Vnode op for reading directories.
*
* The routine below assumes that the on-disk format of a directory
* is the same as that defined by <sys/dirent.h>. If the on-disk
* format changes, then it will be necessary to do a conversion
* from the on-disk format that read returns to the format defined
* by <sys/dirent.h>.
*/
/*
* this is exactly what we do here - the problem is that the conversion
* will blow up some entries by four bytes, so it can't be done in place.
* This is too bad. Right now the conversion is done entry by entry, the
* converted entry is sent via uiomove.
* This function has to convert directory entries from the on-disk
* format to the format defined by <sys/dirent.h>. Unfortunately, the
* conversion will blow up some entries by four bytes, so it can't be
* done in place. Instead, the conversion is done entry by entry and
* the converted entry is sent via uiomove.
*
* XXX allocate a buffer, convert as many entries as possible, then send
* the whole buffer to uiomove

View File

@ -14,18 +14,4 @@ SRCS+= amd64_mem.c
.endif
SRCS+= bus_if.h device_if.h
.if ${MACHINE} == "sun4v"
SRCS+= opt_global.h
.if defined(KERNBUILDDIR)
MKDEP= -include ${KERNBUILDDIR}/opt_global.h
.else
CFLAGS+= -include opt_global.h
MKDEP= -include opt_global.h
opt_global.h:
echo "#define SUN4V 1" > ${.TARGET}
.endif
.endif
.include <bsd.kmod.mk>

View File

@ -14,9 +14,7 @@ SRCS= uart_bus_acpi.c ${uart_bus_ebus} uart_bus_isa.c uart_bus_pccard.c \
uart_dev_ns8250.c uart_dev_quicc.c uart_dev_sab82532.c \
uart_dev_z8530.c \
uart_if.c uart_if.h uart_subr.c uart_tty.c
.if ${MACHINE} == "sun4v"
SRCS+= uart_cpu_sparc64.c
.elif exists(${.CURDIR}/../../dev/uart/uart_cpu_${MACHINE}.c)
.if exists(${.CURDIR}/../../dev/uart/uart_cpu_${MACHINE}.c)
SRCS+= uart_cpu_${MACHINE}.c
.endif
SRCS+= bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} pci_if.h \

View File

@ -66,9 +66,6 @@ static void
configure(void *dummy)
{
#ifdef SUN4V
intr_restore_all(0x16);
#endif
root_bus_configure();
#ifdef DEV_ISA
/*

View File

@ -46,18 +46,11 @@ __FBSDID("$FreeBSD$");
#ifdef SUN4U
#include <machine/cache.h>
#endif
#ifdef SUN4V
#include <machine/mmu.h>
#endif
#include <machine/pcb.h>
#include <machine/setjmp.h>
#include <machine/smp.h>
#include <machine/tlb.h>
#include <machine/tte.h>
#ifdef SUN4V
#include <machine/trap.h>
#include <machine/tte_hash.h>
#endif
#include <machine/vmparam.h>
ASSYM(KERNBASE, KERNBASE);
@ -96,9 +89,6 @@ ASSYM(CSA_TICK, offsetof(struct cpu_start_args, csa_tick));
ASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes));
ASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver));
#endif
#ifdef SUN4V
ASSYM(CSA_CPUID, offsetof(struct cpu_start_args, csa_cpuid));
#endif
#endif
#ifdef SUN4U
@ -144,20 +134,6 @@ ASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT_TO_TTE_MASK);
ASSYM(TV_SIZE_BITS, TV_SIZE_BITS);
#endif
#ifdef SUN4V
ASSYM(VTD_REF, VTD_REF);
ASSYM(VTD_W, VTD_W);
ASSYM(VTD_SW_W, VTD_SW_W);
ASSYM(VTD_LOCK, VTD_LOCK);
ASSYM(THE_SHIFT, THE_SHIFT);
ASSYM(PM_HASHSCRATCH, offsetof(struct pmap, pm_hashscratch));
ASSYM(PM_TSBSCRATCH, offsetof(struct pmap, pm_tsbscratch));
ASSYM(PM_TSB_RA, offsetof(struct pmap, pm_tsb_ra));
ASSYM(PM_TLBACTIVE, offsetof(struct pmap, pm_tlbactive));
ASSYM(HASH_ENTRY_SHIFT, HASH_ENTRY_SHIFT);
#endif
ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
ASSYM(MAXCOMLEN, MAXCOMLEN);
@ -170,35 +146,6 @@ ASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree));
ASSYM(PC_CNT, offsetof(struct pcpu, pc_cnt));
ASSYM(PC_SIZEOF, sizeof(struct pcpu));
#ifdef SUN4V
ASSYM(PC_CPU_Q_RA, offsetof(struct pcpu, pc_cpu_q_ra));
ASSYM(PC_CPU_Q_SIZE, offsetof(struct pcpu, pc_cpu_q_size));
ASSYM(PC_DEV_Q_RA, offsetof(struct pcpu, pc_dev_q_ra));
ASSYM(PC_DEV_Q_SIZE, offsetof(struct pcpu, pc_dev_q_size));
ASSYM(PC_RQ_BASE, offsetof(struct pcpu, pc_rq_ra));
ASSYM(PC_RQ_SIZE, offsetof(struct pcpu, pc_rq_size));
ASSYM(PC_NRQ_BASE, offsetof(struct pcpu, pc_nrq_ra));
ASSYM(PC_NRQ_SIZE, offsetof(struct pcpu, pc_nrq_size));
ASSYM(PC_MONDO_DATA, offsetof(struct pcpu, pc_mondo_data));
ASSYM(PC_MONDO_DATA_RA, offsetof(struct pcpu, pc_mondo_data_ra));
ASSYM(PC_KWBUF_FULL, offsetof(struct pcpu, pc_kwbuf_full));
ASSYM(PC_KWBUF_SP, offsetof(struct pcpu, pc_kwbuf_sp));
ASSYM(PC_KWBUF, offsetof(struct pcpu, pc_kwbuf));
ASSYM(PC_PAD, offsetof(struct pcpu, pad));
ASSYM(PC_PMAP, offsetof(struct pcpu, pc_curpmap));
ASSYM(PC_TSBWBUF, offsetof(struct pcpu, pc_tsbwbuf));
ASSYM(PCB_KSTACK, offsetof(struct pcb, pcb_kstack));
ASSYM(PCB_TSTATE, offsetof(struct pcb, pcb_tstate));
ASSYM(PCB_TPC, offsetof(struct pcb, pcb_tpc));
ASSYM(PCB_TNPC, offsetof(struct pcb, pcb_tnpc));
ASSYM(PCB_TT, offsetof(struct pcb, pcb_tt));
ASSYM(PCB_SFAR, offsetof(struct pcb, pcb_sfar));
ASSYM(PM_TSB_MISS_COUNT, offsetof(struct pmap, pm_tsb_miss_count));
ASSYM(PM_TSB_CAP_MISS_COUNT, offsetof(struct pmap, pm_tsb_cap_miss_count));
#endif
#ifdef SUN4U
ASSYM(PC_CACHE, offsetof(struct pcpu, pc_cache));
ASSYM(PC_MID, offsetof(struct pcpu, pc_mid));
@ -300,9 +247,6 @@ ASSYM(TF_TAR, offsetof(struct trapframe, tf_tar));
ASSYM(TF_TYPE, offsetof(struct trapframe, tf_type));
ASSYM(TF_Y, offsetof(struct trapframe, tf_y));
#endif
#ifdef SUN4V
ASSYM(TF_ASI, offsetof(struct trapframe, tf_asi));
#endif
ASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc));
ASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc));
ASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate));

View File

@ -69,9 +69,7 @@ __FBSDID("$FreeBSD$");
#include <vm/pmap.h>
#include <vm/vm_extern.h>
#ifndef SUN4V
#include <machine/cache.h>
#endif
#include <machine/md_var.h>
#include <machine/pmap.h>
#include <machine/tlb.h>
@ -137,18 +135,14 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
if (m != NULL) {
if (ova == 0) {
#ifndef SUN4V
if (dcache_color_ignore == 0)
colors = DCACHE_COLORS;
#endif
ova = kmem_alloc_wait(kernel_map,
PAGE_SIZE * colors);
}
#ifndef SUN4V
if (colors != 1 && m->md.color != -1)
va = ova + m->md.color * PAGE_SIZE;
else
#endif
va = ova;
pmap_qenter(va, &m, 1);
error = uiomove((void *)(va + off), cnt,

View File

@ -1,603 +0,0 @@
/*
* 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.
*/
#pragma ident "@(#)mdesc_diff.c 1.1 06/05/16 SMI"
#include <sys/types.h>
#ifdef _KERNEL
#include <sys/systm.h>
#else /* _KERNEL */
#include <string.h>
#include <strings.h>
#endif /* _KERNEL */
#include <sys/note.h>
#include <sys/mdesc.h>
#include <sys/mdesc_impl.h>
#define MDD_FREE_CHECK(mdp, ptr, sz) \
do { \
if (ptr) mdp->freep(ptr, sz); \
_NOTE(CONSTCOND) } while (0)
#define MD_DIFF_MAGIC 0x4D445F4449464621ull /* 'MD_DIFF!' */
#define MD_DIFF_NOMATCH (-1)
#define MD_DIFF_MATCH (1)
typedef struct {
mde_cookie_t *mdep;
uint_t nelem;
} md_diff_t;
typedef struct {
uint64_t mdd_magic;
md_diff_t added;
md_diff_t removed;
md_diff_t match1;
md_diff_t match2;
void *(*allocp)(size_t);
void (*freep)(void *, size_t);
} md_diff_impl_t;
/*
* Internal utility functions
*/
static int mdd_scan_for_nodes(md_t *mdp, mde_cookie_t start,
char *compnodep, int *countp, mde_cookie_t **nodespp);
static boolean_t mdd_any_dup_nodes(md_impl_t *mdp, md_prop_match_t *pmp,
int count, mde_cookie_t *nodesp);
static int mdd_node_list_match(md_impl_t *md1, md_impl_t *md2,
md_element_t *match_nodep, mde_cookie_t *match_listp,
uint8_t *match_seenp, int start, int end, md_prop_match_t *match_elemsp);
static int mdd_node_compare(md_impl_t *mdap, md_impl_t *mdbp,
md_element_t *nodeap, md_element_t *nodebp, md_prop_match_t *match_elemsp);
/*
* Given two DAGs and information about how to uniquely identify
* the nodes of interest, determine which nodes have been added
* to the second MD, removed from the first MD, or exist in both
* MDs. This information is recorded and can be accessed using the
* opaque cookie returned to the caller.
*/
md_diff_cookie_t
md_diff_init(md_t *md1p, mde_cookie_t start1, md_t *md2p, mde_cookie_t start2,
char *compnodep, md_prop_match_t *match_fieldsp)
{
int idx;
md_impl_t *md1 = (md_impl_t *)md1p;
md_impl_t *md2 = (md_impl_t *)md2p;
mde_cookie_t *md1nodesp = NULL;
mde_cookie_t *md2nodesp = NULL;
int md1count = 0;
int md2count = 0;
uint8_t *seenp = NULL;
/* variables used to gather results */
md_diff_impl_t *diff_res;
mde_cookie_t *mde_add_scr;
mde_cookie_t *mde_rem_scr;
mde_cookie_t *mde_match1_scr;
mde_cookie_t *mde_match2_scr;
int nadd = 0;
int nrem = 0;
int nmatch = 0;
/* sanity check params */
if ((md1p == NULL) || (md2p == NULL))
return (MD_INVAL_DIFF_COOKIE);
if ((start1 == MDE_INVAL_ELEM_COOKIE) ||
(start2 == MDE_INVAL_ELEM_COOKIE))
return (MD_INVAL_DIFF_COOKIE);
if ((compnodep == NULL) || (match_fieldsp == NULL))
return (MD_INVAL_DIFF_COOKIE);
/*
* Prepare an array of the matching nodes from the first MD.
*/
if (mdd_scan_for_nodes(md1p,
start1, compnodep, &md1count, &md1nodesp) == -1)
return (MD_INVAL_DIFF_COOKIE);
/* sanity check that all nodes are unique */
if (md1nodesp &&
mdd_any_dup_nodes(md1, match_fieldsp, md1count, md1nodesp)) {
MDD_FREE_CHECK(md1, md1nodesp, sizeof (mde_cookie_t) *
md1count);
return (MD_INVAL_DIFF_COOKIE);
}
/*
* Prepare an array of the matching nodes from the second MD.
*/
if (mdd_scan_for_nodes(md2p,
start2, compnodep, &md2count, &md2nodesp) == -1)
return (MD_INVAL_DIFF_COOKIE);
/* sanity check that all nodes are unique */
if (md2nodesp &&
mdd_any_dup_nodes(md2, match_fieldsp, md2count, md2nodesp)) {
MDD_FREE_CHECK(md1, md1nodesp, sizeof (mde_cookie_t) *
md1count);
MDD_FREE_CHECK(md2, md2nodesp, sizeof (mde_cookie_t) *
md2count);
return (MD_INVAL_DIFF_COOKIE);
}
/* setup our result structure */
diff_res = md1->allocp(sizeof (md_diff_impl_t));
bzero(diff_res, sizeof (md_diff_impl_t));
diff_res->allocp = md1->allocp;
diff_res->freep = md1->freep;
diff_res->mdd_magic = MD_DIFF_MAGIC;
/*
* Special cases for empty lists
*/
if ((md1count == 0) && (md2count != 0)) {
/* all the nodes found were added */
diff_res->added.mdep = md2nodesp;
diff_res->added.nelem = md2count;
return ((mde_cookie_t)diff_res);
}
if ((md1count != 0) && (md2count == 0)) {
/* all the nodes found were removed */
diff_res->removed.mdep = md1nodesp;
diff_res->removed.nelem = md1count;
return ((mde_cookie_t)diff_res);
}
if ((md1count == 0) && (md2count == 0))
/* no nodes found */
return ((mde_cookie_t)diff_res);
/*
* Both lists have some elements. Allocate some scratch
* buffers to sort them into our three categories, added,
* removed, and matched pairs.
*/
mde_add_scr = diff_res->allocp(sizeof (mde_cookie_t) * md2count);
mde_rem_scr = diff_res->allocp(sizeof (mde_cookie_t) * md1count);
mde_match1_scr = diff_res->allocp(sizeof (mde_cookie_t) * md1count);
mde_match2_scr = diff_res->allocp(sizeof (mde_cookie_t) * md2count);
/* array of seen flags only needed for md2 */
seenp = (uint8_t *)diff_res->allocp(sizeof (uint8_t) * md2count);
bzero(seenp, sizeof (uint8_t) * md2count);
/*
* Make a pass through the md1 node array. Make note of
* any nodes not in the md2 array, indicating that they
* have been removed. Also keep track of the nodes that
* are present in both arrays for the matched pair results.
*/
for (idx = 0; idx < md1count; idx++) {
md_element_t *elem = &(md1->mdep[md1nodesp[idx]]);
int match = mdd_node_list_match(md1, md2, elem, md2nodesp,
seenp, 0, md2count - 1, match_fieldsp);
if (match == MD_DIFF_NOMATCH)
/* record deleted node */
mde_rem_scr[nrem++] = md1nodesp[idx];
else {
/* record matched node pair */
mde_match1_scr[nmatch] = md1nodesp[idx];
mde_match2_scr[nmatch] = md2nodesp[match];
nmatch++;
/* mark that this match has been recorded */
seenp[match] = 1;
}
}
/*
* Make a pass through the md2 array. Any nodes that have
* not been marked as seen have been added.
*/
for (idx = 0; idx < md2count; idx++) {
if (!seenp[idx])
/* record added node */
mde_add_scr[nadd++] = md2nodesp[idx];
}
/* fill in the added node list */
if (nadd) {
int addsz = sizeof (mde_cookie_t) * nadd;
diff_res->added.mdep = (mde_cookie_t *)diff_res->allocp(addsz);
bcopy(mde_add_scr, diff_res->added.mdep, addsz);
diff_res->added.nelem = nadd;
}
/* fill in the removed node list */
if (nrem) {
int remsz = sizeof (mde_cookie_t) * nrem;
diff_res->removed.mdep =
(mde_cookie_t *)diff_res->allocp(remsz);
bcopy(mde_rem_scr, diff_res->removed.mdep, remsz);
diff_res->removed.nelem = nrem;
}
/* fill in the matching node lists */
if (nmatch) {
int matchsz = sizeof (mde_cookie_t) * nmatch;
diff_res->match1.mdep =
(mde_cookie_t *)diff_res->allocp(matchsz);
diff_res->match2.mdep =
(mde_cookie_t *)diff_res->allocp(matchsz);
bcopy(mde_match1_scr, diff_res->match1.mdep, matchsz);
bcopy(mde_match2_scr, diff_res->match2.mdep, matchsz);
diff_res->match1.nelem = nmatch;
diff_res->match2.nelem = nmatch;
}
/* clean up */
md1->freep(md1nodesp, sizeof (mde_cookie_t) * md1count);
md2->freep(md2nodesp, sizeof (mde_cookie_t) * md2count);
diff_res->freep(mde_add_scr, sizeof (mde_cookie_t) * md2count);
diff_res->freep(mde_rem_scr, sizeof (mde_cookie_t) * md1count);
diff_res->freep(mde_match1_scr, sizeof (mde_cookie_t) * md1count);
diff_res->freep(mde_match2_scr, sizeof (mde_cookie_t) * md2count);
diff_res->freep(seenp, sizeof (uint8_t) * md2count);
return ((md_diff_cookie_t)diff_res);
}
/*
* Returns an array of the nodes added to the second MD in a
* previous md_diff_init() call. Returns the number of elements
* in the returned array. If the value is zero, the pointer
* passed back will be NULL.
*/
int
md_diff_added(md_diff_cookie_t mdd, mde_cookie_t **mde_addedp)
{
md_diff_impl_t *mddp = (md_diff_impl_t *)mdd;
if ((mddp == NULL) || (mddp->mdd_magic != MD_DIFF_MAGIC))
return (-1);
*mde_addedp = mddp->added.mdep;
return (mddp->added.nelem);
}
/*
* Returns an array of the nodes removed from the first MD in a
* previous md_diff_init() call. Returns the number of elements
* in the returned array. If the value is zero, the pointer
* passed back will be NULL.
*/
int
md_diff_removed(md_diff_cookie_t mdd, mde_cookie_t **mde_removedp)
{
md_diff_impl_t *mddp = (md_diff_impl_t *)mdd;
if ((mddp == NULL) || (mddp->mdd_magic != MD_DIFF_MAGIC))
return (-1);
*mde_removedp = mddp->removed.mdep;
return (mddp->removed.nelem);
}
/*
* Returns a pair of parallel arrays that contain nodes that were
* considered matching based on the match criteria passed in to
* a previous md_diff_init() call. Returns the number of elements
* in the arrays. If the value is zero, both pointers passed back
* will be NULL.
*/
int
md_diff_matched(md_diff_cookie_t mdd, mde_cookie_t **mde_match1p,
mde_cookie_t **mde_match2p)
{
md_diff_impl_t *mddp = (md_diff_impl_t *)mdd;
if ((mddp == NULL) || (mddp->mdd_magic != MD_DIFF_MAGIC))
return (-1);
*mde_match1p = mddp->match1.mdep;
*mde_match2p = mddp->match2.mdep;
return (mddp->match1.nelem);
}
/*
* Deallocate any storage used to store results of a previous
* md_diff_init() call. Returns 0 on success and -1 on failure.
*/
int
md_diff_fini(md_diff_cookie_t mdd)
{
md_diff_impl_t *mddp = (md_diff_impl_t *)mdd;
if ((mddp == NULL) || (mddp->mdd_magic != MD_DIFF_MAGIC))
return (-1);
mddp->mdd_magic = 0;
MDD_FREE_CHECK(mddp, mddp->added.mdep, mddp->added.nelem *
sizeof (mde_cookie_t));
MDD_FREE_CHECK(mddp, mddp->removed.mdep, mddp->removed.nelem *
sizeof (mde_cookie_t));
MDD_FREE_CHECK(mddp, mddp->match1.mdep, mddp->match1.nelem *
sizeof (mde_cookie_t));
MDD_FREE_CHECK(mddp, mddp->match2.mdep, mddp->match2.nelem *
sizeof (mde_cookie_t));
mddp->freep(mddp, sizeof (md_diff_impl_t));
return (0);
}
/*
* Walk the "fwd" DAG in an MD and return an array of nodes that are
* of the specified type. The start param is used to start the walk
* from an arbitrary location in the DAG. Returns an array of nodes
* as well as a count of the number of nodes in the array. If the
* count is zero, the node pointer will be passed back as NULL.
*
* Returns: 0 success; -1 failure
*/
static int
mdd_scan_for_nodes(md_t *mdp,
mde_cookie_t start, char *compnodep, int *countp, mde_cookie_t **nodespp)
{
mde_str_cookie_t cname;
mde_str_cookie_t aname;
md_impl_t *mdip = (md_impl_t *)mdp;
if (mdip == NULL)
return (-1);
cname = md_find_name(mdp, compnodep);
aname = md_find_name(mdp, "fwd");
/* get the number of nodes of interest in the DAG */
*countp = md_scan_dag(mdp, start, cname, aname, NULL);
if (*countp == 0) {
*nodespp = NULL;
return (0);
}
/* allocate the storage */
*nodespp = mdip->allocp(sizeof (mde_cookie_t) * (*countp));
/* populate our array with the matching nodes */
(void) md_scan_dag(mdp, start, cname, aname, *nodespp);
return (0);
}
/*
* Walk an array of nodes and check if there are any duplicate
* nodes. A duplicate is determined based on the specified match
* criteria. Returns B_TRUE if there are any duplicates and B_FALSE
* otherwise.
*/
static boolean_t
mdd_any_dup_nodes(md_impl_t *mdp, md_prop_match_t *pmp, int count,
mde_cookie_t *nodesp)
{
int idx;
int match;
md_element_t *elem;
ASSERT(count > 0 || nodesp == NULL);
for (idx = 0; idx < count; idx++) {
elem = &(mdp->mdep[nodesp[idx]]);
match = mdd_node_list_match(mdp, mdp, elem, nodesp, NULL,
idx + 1, count - 1, pmp);
if (match != MD_DIFF_NOMATCH)
return (B_TRUE);
}
return (B_FALSE);
}
/*
* Given a node and a array of nodes, compare the node to all elements
* in the specified start-end range of the array. If the node matches
* one of the nodes in the array, return the index of that node. Otherwise
* return MD_DIFF_NOMATCH.
*
* The optional seen array parameter can be used to optimize repeated
* calls to this function. If the seen array indicates that an element
* has already been matched, the full comparison is not necessary.
*/
static int
mdd_node_list_match(md_impl_t *md1, md_impl_t *md2, md_element_t *match_nodep,
mde_cookie_t *match_listp, uint8_t *match_seenp, int start, int end,
md_prop_match_t *match_elemsp)
{
int match;
int idx;
md_element_t *elem;
for (idx = start; idx <= end; idx++) {
if ((match_seenp != NULL) && (match_seenp[idx]))
continue;
elem = &(md2->mdep[match_listp[idx]]);
match = mdd_node_compare(md1, md2, match_nodep, elem,
match_elemsp);
if (match == MD_DIFF_MATCH)
return (idx);
}
return (MD_DIFF_NOMATCH);
}
/*
* Given two nodes and a list of properties, compare the nodes.
* A match is concluded if both nodes have all of the specified
* properties and all the values of those properties are the
* same. Returns MD_DIFF_NOMATCH if the nodes do not match and
* MD_DIFF_MATCH otherwise.
*/
static int
mdd_node_compare(md_impl_t *mdap, md_impl_t *mdbp, md_element_t *nodeap,
md_element_t *nodebp, md_prop_match_t *match_elemsp)
{
md_element_t *ap;
md_element_t *bp;
boolean_t nodea_interest;
boolean_t nodeb_interest;
int idx;
/* make sure we are starting at the beginning of the nodes */
if ((MDE_TAG(nodeap) != MDET_NODE) || (MDE_TAG(nodebp) != MDET_NODE))
return (MD_DIFF_NOMATCH);
for (idx = 0; match_elemsp[idx].type != MDET_LIST_END; idx++) {
int type;
nodea_interest = B_FALSE;
nodeb_interest = B_FALSE;
type = match_elemsp[idx].type;
/*
* Check node A for the property of interest
*/
for (ap = nodeap; MDE_TAG(ap) != MDET_NODE_END; ap++) {
char *elemname;
if (MDE_TAG(ap) != type)
continue;
elemname = mdap->namep + MDE_NAME(ap);
if (strcmp(elemname, match_elemsp[idx].namep) == 0) {
/* found the property of interest */
nodea_interest = B_TRUE;
break;
}
}
/* node A is not of interest */
if (!nodea_interest)
return (MD_DIFF_NOMATCH);
/*
* Check node B for the property of interest
*/
for (bp = nodebp; MDE_TAG(bp) != MDET_NODE_END; bp++) {
char *elemname;
if (MDE_TAG(bp) != type)
continue;
elemname = mdbp->namep + MDE_NAME(bp);
if (strcmp(elemname, match_elemsp[idx].namep) == 0) {
nodeb_interest = B_TRUE;
break;
}
}
/* node B is not of interest */
if (!nodeb_interest)
return (MD_DIFF_NOMATCH);
/*
* Both nodes have the property of interest. The
* nodes are not a match unless the value of that
* property match
*/
switch (type) {
case MDET_PROP_VAL:
if (MDE_PROP_VALUE(ap) != MDE_PROP_VALUE(bp))
return (MD_DIFF_NOMATCH);
break;
case MDET_PROP_STR: {
char *stra = (char *)(mdap->datap +
MDE_PROP_DATA_OFFSET(ap));
char *strb = (char *)(mdbp->datap +
MDE_PROP_DATA_OFFSET(bp));
if (strcmp(stra, strb) != 0)
return (MD_DIFF_NOMATCH);
break;
}
case MDET_PROP_DAT: {
caddr_t dataa;
caddr_t datab;
if (MDE_PROP_DATA_LEN(ap) != MDE_PROP_DATA_LEN(bp))
return (MD_DIFF_NOMATCH);
dataa = (caddr_t)(mdap->datap +
MDE_PROP_DATA_OFFSET(ap));
datab = (caddr_t)(mdbp->datap +
MDE_PROP_DATA_OFFSET(bp));
if (memcmp(dataa, datab, MDE_PROP_DATA_LEN(ap)) != 0)
return (MD_DIFF_NOMATCH);
break;
}
default:
/* unsupported prop type */
return (MD_DIFF_NOMATCH);
}
}
/*
* All the specified properties exist in both
* nodes and have the same value. The two nodes
* match.
*/
return (MD_DIFF_MATCH);
}

View File

@ -1,67 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/types.h>
#ifdef _KERNEL
#include <sys/systm.h>
#else
#include <strings.h>
#endif
#include <machine/cddl/mdesc.h>
#include <machine/cddl/mdesc_impl.h>
mde_str_cookie_t
md_find_name(md_t *ptr, char *namep)
{
int idx, len;
md_impl_t *mdp;
mdp = (md_impl_t *)ptr;
/*
* At some point init should build a local hash table to
* speed these name searches ... for now use brute force
* because the machien descriptions are so small anyway.
*/
for (idx = 0; idx < mdp->name_blk_size; idx += len) {
char *p;
p = &(mdp->namep[idx]);
len = strlen(p)+1;
if (strcmp(p, namep) == 0)
return ((mde_str_cookie_t)idx);
}
return (MDE_INVAL_STR_COOKIE);
}

View File

@ -1,76 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <machine/cddl/mdesc.h>
#include <machine/cddl/mdesc_impl.h>
mde_cookie_t
md_find_node_prop(md_impl_t *mdp,
mde_cookie_t node,
mde_str_cookie_t prop_name,
int tag_type)
{
md_element_t *mdep;
int idx;
if (node == MDE_INVAL_ELEM_COOKIE ||
prop_name == MDE_INVAL_STR_COOKIE) {
return (MDE_INVAL_ELEM_COOKIE);
}
idx = (int)node;
mdep = &(mdp->mdep[idx]);
/* Skip over any empty elements */
while (MDE_TAG(mdep) == MDET_NULL) {
idx++;
mdep++;
}
/* see if cookie is infact a node */
if (MDE_TAG(mdep) != MDET_NODE) {
return (MDE_INVAL_ELEM_COOKIE);
}
/*
* Simply walk the elements in the node
* looking for a property with a matching name.
*/
for (idx++, mdep++; MDE_TAG(mdep) != MDET_NODE_END; idx++, mdep++) {
if (MDE_TAG(mdep) == tag_type) {
if (MDE_NAME(mdep) == prop_name) {
return ((mde_cookie_t)idx);
}
}
}
return (MDE_INVAL_ELEM_COOKIE); /* no such property name */
}

View File

@ -1,48 +0,0 @@
/*
* 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.
*/
#pragma ident "@(#)mdesc_fini.c 1.4 06/05/16 SMI"
#include <sys/types.h>
#include <sys/mdesc.h>
#include <sys/mdesc_impl.h>
/*
* Cleanup the internal MD structure. Does not
* deallocate the buffer holding the MD.
*/
int
md_fini(md_t *ptr)
{
md_impl_t *mdp;
mdp = (md_impl_t *)ptr;
mdp->freep(mdp, sizeof (md_impl_t));
return (0);
}

View File

@ -1,46 +0,0 @@
/*
* 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.
*/
#pragma ident "@(#)mdesc_getbinsize.c 1.1 06/05/16 SMI"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/mdesc.h>
#include <sys/mdesc_impl.h>
size_t
md_get_bin_size(md_t *ptr)
{
md_impl_t *mdp;
mdp = (md_impl_t *)ptr;
if (mdp == NULL)
return (0);
return (mdp->size);
}

View File

@ -1,46 +0,0 @@
/*
* 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.
*/
#pragma ident "@(#)mdesc_getgen.c 1.1 06/05/16 SMI"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/mdesc.h>
#include <sys/mdesc_impl.h>
uint64_t
md_get_gen(md_t *ptr)
{
md_impl_t *mdp;
mdp = (md_impl_t *)ptr;
if (mdp == NULL)
return (MDESC_INVAL_GEN);
return (mdp->gen);
}

View File

@ -1,65 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "@(#)mdesc_getpropdata.c 1.2 05/06/08 SMI"
#include <sys/types.h>
#include <sys/mdesc.h>
#include <sys/mdesc_impl.h>
int
md_get_prop_data(md_t *ptr, mde_cookie_t node, char *namep,
uint8_t **datap, int *lenp)
{
mde_str_cookie_t prop_name;
md_impl_t *mdp;
mde_cookie_t elem;
mdp = (md_impl_t *)ptr;
if (node == MDE_INVAL_ELEM_COOKIE) {
return (-1);
}
prop_name = md_find_name(ptr, namep);
if (prop_name == MDE_INVAL_STR_COOKIE) {
return (-1);
}
elem = md_find_node_prop(mdp, node, prop_name, MDET_PROP_DAT);
if (elem != MDE_INVAL_ELEM_COOKIE) {
md_element_t *mdep;
mdep = &(mdp->mdep[(int)elem]);
*lenp = (int)MDE_PROP_DATA_LEN(mdep);
*datap = mdp->datap+(int)MDE_PROP_DATA_OFFSET(mdep);
return (0);
}
return (-1); /* no such property name */
}

View File

@ -1,62 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/types.h>
#include <machine/cddl/mdesc.h>
#include <machine/cddl/mdesc_impl.h>
int
md_get_prop_str(md_t *ptr, mde_cookie_t node, char *namep, char **strp)
{
mde_str_cookie_t prop_name;
md_impl_t *mdp;
mde_cookie_t elem;
mdp = (md_impl_t *)ptr;
if (node == MDE_INVAL_ELEM_COOKIE) {
return (-1);
}
prop_name = md_find_name(ptr, namep);
if (prop_name == MDE_INVAL_STR_COOKIE) {
return (-1);
}
elem = md_find_node_prop(mdp, node, prop_name, MDET_PROP_STR);
if (elem != MDE_INVAL_ELEM_COOKIE) {
md_element_t *mdep;
mdep = &(mdp->mdep[(int)elem]);
*strp = (char *)(mdp->datap+
MDE_PROP_DATA_OFFSET(mdep));
return (0);
}
return (-1); /* no such property name */
}

View File

@ -1,68 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/types.h>
#ifdef _KERNEL
#include <sys/systm.h>
#else
#include <strings.h>
#endif
#include <machine/cddl/mdesc.h>
#include <machine/cddl/mdesc_impl.h>
int
md_get_prop_val(md_t *ptr, mde_cookie_t node, char *namep, uint64_t *valp)
{
mde_str_cookie_t prop_name;
md_impl_t *mdp;
mde_cookie_t elem;
mdp = (md_impl_t *)ptr;
if (node == MDE_INVAL_ELEM_COOKIE) {
return (-1);
}
prop_name = md_find_name(ptr, namep);
if (prop_name == MDE_INVAL_STR_COOKIE) {
return (-1);
}
elem = md_find_node_prop(mdp, node, prop_name, MDET_PROP_VAL);
if (elem != MDE_INVAL_ELEM_COOKIE) {
md_element_t *mdep;
mdep = &(mdp->mdep[(int)elem]);
*valp = MDE_PROP_VALUE(mdep);
return (0);
}
return (-1); /* no such property name */
}

View File

@ -1,178 +0,0 @@
/*
* 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.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <machine/cddl/mdesc.h>
#include <machine/cddl/mdesc_impl.h>
md_t *
md_init_intern(uint64_t *ptr, void *(*allocp)(size_t),
void (*freep)(void *, size_t))
{
md_impl_t *mdp;
int idx;
int count;
int done;
uint64_t gen;
mde_str_cookie_t root_name;
/*
* Very basic checkup for alignment to avoid
* bus error issues.
*/
if ((((uintptr_t)ptr) & 7) != 0)
return (NULL);
mdp = (md_impl_t *)allocp(sizeof (md_impl_t));
if (mdp == NULL)
return (NULL);
mdp->allocp = allocp;
mdp->freep = freep;
mdp->caddr = (char *)ptr;
/*
* setup internal structures
*/
mdp->headerp = (md_header_t *)mdp->caddr;
if (mdtoh32(mdp->headerp->transport_version) != MD_TRANSPORT_VERSION) {
goto cleanup_nohash;
}
mdp->node_blk_size = mdtoh32(mdp->headerp->node_blk_sz);
mdp->name_blk_size = mdtoh32(mdp->headerp->name_blk_sz);
mdp->data_blk_size = mdtoh32(mdp->headerp->data_blk_sz);
mdp->size = MD_HEADER_SIZE + mdp->node_blk_size +
mdp->name_blk_size + mdp->data_blk_size;
mdp->mdep = (md_element_t *)(mdp->caddr + MD_HEADER_SIZE);
mdp->namep = (char *)(mdp->caddr + MD_HEADER_SIZE + mdp->node_blk_size);
mdp->datap = (uint8_t *)(mdp->caddr + MD_HEADER_SIZE +
mdp->name_blk_size + mdp->node_blk_size);
mdp->root_node = MDE_INVAL_ELEM_COOKIE;
/*
* Should do a lot more sanity checking here.
*/
/*
* Should initialize a name hash here if we intend to use one
*/
/*
* Setup to find the root node
*/
root_name = md_find_name((md_t *)mdp, "root");
if (root_name == MDE_INVAL_STR_COOKIE) {
goto cleanup;
}
/*
* One more property we need is the count of nodes in the
* DAG, not just the number of elements.
*
* We try and pickup the root node along the way here.
*/
for (done = 0, idx = 0, count = 0; !done; ) {
md_element_t *np;
np = &(mdp->mdep[idx]);
switch (MDE_TAG(np)) {
case MDET_LIST_END:
done = 1;
break;
case MDET_NODE:
if (root_name == MDE_NAME(np)) {
if (mdp->root_node != MDE_INVAL_ELEM_COOKIE) {
/* Gah .. more than one root */
goto cleanup;
}
mdp->root_node = (mde_cookie_t)idx;
}
idx = MDE_PROP_INDEX(np);
count++;
break;
default:
idx++; /* ignore */
}
}
/*
* Ensure there is a root node
*/
if (mdp->root_node == MDE_INVAL_ELEM_COOKIE) {
goto cleanup;
}
/*
* Register the counts
*/
mdp->element_count = idx + 1; /* include LIST_END */
mdp->node_count = count;
/*
* Final sanity check that everything adds up
*/
if (mdp->element_count != (mdp->node_blk_size / MD_ELEMENT_SIZE))
goto cleanup;
mdp->md_magic = LIBMD_MAGIC;
/*
* Setup MD generation
*/
if (md_get_prop_val((md_t *)mdp, mdp->root_node,
"md-generation#", &gen) != 0)
mdp->gen = MDESC_INVAL_GEN;
else
mdp->gen = gen;
return ((md_t *)mdp);
cleanup:
/*
* Clean up here - including a name hash if
* we build one.
*/
cleanup_nohash:
mdp->freep(mdp, sizeof (md_impl_t));
return (NULL);
}

View File

@ -1,44 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/types.h>
#include <machine/cddl/mdesc.h>
#include <machine/cddl/mdesc_impl.h>
int
md_node_count(md_t *ptr)
{
md_impl_t *mdp;
mdp = (md_impl_t *)ptr;
if (mdp->md_magic != LIBMD_MAGIC)
return (-1);
return (mdp->node_count);
}

View File

@ -1,44 +0,0 @@
/*
* 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.
*/
#include <sys/types.h>
#include <machine/cddl/mdesc.h>
#include <machine/cddl/mdesc_impl.h>
mde_cookie_t
md_root_node(md_t *ptr)
{
md_impl_t *mdp;
mdp = (md_impl_t *)ptr;
if (mdp->md_magic != LIBMD_MAGIC)
return (MDE_INVAL_ELEM_COOKIE);
return (mdp->root_node);
}

View File

@ -1,191 +0,0 @@
/*
* 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.
*/
#include <sys/types.h>
#include <sys/param.h>
#ifdef _KERNEL
#include <sys/systm.h>
#else
#include <string.h>
#include <strings.h>
#endif
#include <machine/cddl/mdesc.h>
#include <machine/cddl/mdesc_impl.h>
static int
mdl_scan_dag(md_impl_t *mdp,
int nodeidx,
mde_str_cookie_t node_cookie,
mde_str_cookie_t arc_cookie,
uint8_t *dseenp,
int *idxp,
mde_cookie_t *stashp,
int level);
int
md_scan_dag(md_t *ptr,
mde_cookie_t startnode,
mde_str_cookie_t node_name_cookie,
mde_str_cookie_t arc_name_cookie,
mde_cookie_t *stashp)
{
int res;
int idx;
uint8_t *seenp;
md_impl_t *mdp;
int start;
mdp = (md_impl_t *)ptr;
/*
* Possible the caller was lazy and didn't check the
* validitiy of either the node name or the arc name
* on calling ... in which case fail to find any
* nodes.
* This is distinct, from a fail (-1) since we return
* that nothing was found.
*/
if (node_name_cookie == MDE_INVAL_STR_COOKIE ||
arc_name_cookie == MDE_INVAL_STR_COOKIE) return 0;
/*
* if we want to start at the top, start at index 0
*/
start = (int)startnode;
if (start == MDE_INVAL_ELEM_COOKIE) start = 0;
/*
* Scan from the start point until the first node.
*/
while (MDE_TAG(&mdp->mdep[start]) == MDET_NULL) start++;
/*
* This was a bogus start point if no node found
*/
if (MDE_TAG(&mdp->mdep[start]) != MDET_NODE) {
return (-1); /* illegal start node specified */
}
/*
* Allocate a recursion mask on the local stack fail
* if we can't allocate the recursion detection.
*/
seenp = (uint8_t *)mdp->allocp(mdp->element_count);
if (seenp == NULL)
return (-1);
(void) memset(seenp, 0, mdp->element_count);
/*
* Now build the list of requested nodes.
*/
idx = 0;
res = mdl_scan_dag(mdp, start,
node_name_cookie, arc_name_cookie,
seenp, &idx, stashp, 0);
mdp->freep(seenp, mdp->element_count);
return (res >= 0 ? idx : res);
}
static int
mdl_scan_dag(md_impl_t *mdp,
int nodeidx,
mde_str_cookie_t node_name_cookie,
mde_str_cookie_t arc_name_cookie,
uint8_t *seenp,
int *idxp,
mde_cookie_t *stashp,
int level)
{
md_element_t *mdep;
mdep = &(mdp->mdep[nodeidx]);
/* see if cookie is infact a node */
if (MDE_TAG(mdep) != MDET_NODE)
return (-1);
/* have we been here before ? */
if (seenp[nodeidx])
return (0);
seenp[nodeidx] = 1;
/* is this node of the type we seek ? */
#ifdef DEBUG_LIBMDESC
{
int x;
for (x = 0; x < level; x++)
printf("-");
printf("%d (%s)\n", nodeidx, (char *)(mdp->datap + MDE_NAME(mdep)));
}
#endif
if (MDE_NAME(mdep) == node_name_cookie) {
/* record the node in the list and keep searching */
if (stashp != NULL) {
stashp[*idxp] = (mde_cookie_t)nodeidx;
}
(*idxp)++;
#ifdef DEBUG_LIBMDESC
printf("\t* %d\n", *idxp);
#endif
}
/*
* Simply walk the elements in the node.
* if we find a matching arc, then recursively call
* the subordinate looking for a match
*/
for (mdep++; MDE_TAG(mdep) != MDET_NODE_END; mdep++) {
if (MDE_TAG(mdep) == MDET_PROP_ARC &&
MDE_NAME(mdep) == arc_name_cookie) {
int res;
res = mdl_scan_dag(mdp,
(int)mdep->d.prop_idx,
node_name_cookie,
arc_name_cookie,
seenp, idxp, stashp, level+1);
if (res == -1)
return (res);
}
}
return (0);
}

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
[A-Za-z0-9]*

View File

@ -1,13 +0,0 @@
#
# DEFAULTS -- Default kernel configuration file for FreeBSD/sun4v
#
# $FreeBSD$
machine sun4v sparc64
# Pseudo devices.
device mem # Memory and kernel memory devices
# Default partitioning schemes
options GEOM_PART_BSD
options GEOM_PART_VTOC8

View File

@ -1,217 +0,0 @@
#
# 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_4BSD # 4BSD scheduler
#options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking
options INET6 # IPv6 communications protocols
options SCTP # Stream Control Transmission Protocol
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 UFS_GJOURNAL # Enable gjournal-based UFS journaling
options MD_ROOT # MD is a potential root device
options NFSCL # New Network Filesystem Client
options NFSD # New Network Filesystem Server
options NFSLOCKD # Network Lock Manager
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_PART_GPT # GUID Partition Tables.
options GEOM_LABEL # Provides labelization
options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI
options KTRACE # ktrace(1) support
options STACK # stack(9) 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 PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed.
options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
options AUDIT # Security event auditing
options MAC # TrustedBSD MAC Framework
options INCLUDE_CONFIG_FILE # Include this file in kernel
# 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 DEADLKRES # Enable the deadlock resolver
#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 MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
#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
options ATA_CAM
# 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 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 vlan # 802.1Q VLAN support
device tun # Packet tunnel.
device pty # BSD-style compatibility pseudo ttys
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
options USB_DEBUG # enable debug msgs
#device uhci # UHCI PCI->USB interface
#device ohci # OHCI PCI->USB interface
device usb # USB Bus (required)
#device udbp # USB Double Bulk Pipe devices (needs netgraph)
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
# 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 USB_VERBOSE
#options DEBUG_LOCKS
#options DEBUG_VFS_LOCKS
device ccd
# sched_lock incurs a rather high overhead at a 1000Hz with 32 cpus
# on most arches and in most cases 1000Hz pessimizes performance
# its choice was not adequately researched
options HZ=100

View File

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

View File

@ -1,5 +0,0 @@
# $FreeBSD$
TARGET=sun4v
.include "${.CURDIR}/../../conf/makeLINT.mk"

View File

@ -1,117 +0,0 @@
# $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 SUN4V
#####################################################################
# HARDWARE BUS CONFIGURATION
device ebus
device isa
device pci
#####################################################################
# HARDWARE DEVICE CONFIGURATION
#
# Optional devices:
#
device ofw_console # Open Firmware console device
option OFWCONS_POLL_HZ=4 # 20 or more works best on Ultra2
#####################################################################
# Devices we don't want to deal with
nodevice aha
nodevice bktr
nodevice blank_saver
nodevice bt
nodevice daemon_saver
nodevice dpt
nodevice dragon_saver
nodevice ep
nodevice ex
nodevice fade_saver
nodevice fdc
nodevice fire_saver
nodevice green_saver
nodevice hwpmc
nodevice logo_saver
nodevice pcii
nodevice ppc
nodevice rain_saver
nodevice sc
nodevice si
nodevice snake_saver
nodevice snd_ad1816
nodevice snd_als4000
nodevice snd_cmi
nodevice snd_cs4281
nodevice snd_csa
nodevice snd_ds1
nodevice snd_emu10k1
nodevice snd_emu10kx
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_uaudio
nodevice snd_via8233
nodevice snd_via82c686
nodevice snd_vibes
nodevice splash
nodevice star_saver
nodevice tnt4882
nodevice uart
nodevice ukbd
nodevice warp_saver
nodevice wds
#####################################################################
# Options we don't want to deal with
nooption FDC_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 EXT2FS
#####################################################################
# Make options we don't want to deal with
nomakeoption SC_DFLT_FONT

View File

@ -1,44 +0,0 @@
/*-
* 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$
*/
#ifndef _SUN4V_INCLUDE__ALIGN_H_
#define _SUN4V_INCLUDE__ALIGN_H_
/*
* 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.
*/
#define _ALIGNBYTES 0xf
#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
#endif /* !_SUN4V_INCLUDE__ALIGN_H_ */

View File

@ -1,43 +0,0 @@
/*-
* 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

@ -1,213 +0,0 @@
/*-
* 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.
*
* 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.4 2008/04/28 20:23:36 martin 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

@ -1,85 +0,0 @@
/*-
* 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).
*/
#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 0xff /* max value for an unsigned char */
#define __USHRT_MAX 0xffff /* 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 0xffffffff /* 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 0xffffffffffffffff /* max for an unsigned long */
#define __LONG_MAX 0x7fffffffffffffff /* max for a long */
#define __LONG_MIN (-0x7fffffffffffffff-1) /* min for a long */
/* Long longs have the same size but not the same type as longs. */
/* 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_ */

View File

@ -1,164 +0,0 @@
/*-
* 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.
*
* 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) INT64_C(c)
#define UINTMAX_C(c) UINT64_C(c)
#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_ */

View File

@ -1,113 +0,0 @@
/*-
* 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_ */

View File

@ -1,178 +0,0 @@
/*-
* 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)
/*
* sparc64 compat for the loader
*/
#define AA_IMMU_TAR 0x30
#define AA_DMMU_TAR 0x30
#define ASI_UPA_CONFIG_REG 0x4a /* US-I, II */
#define ASI_FIREPLANE_CONFIG_REG 0x4a /* US-III{,+}, IV{,+} */
#define AA_FIREPLANE_CONFIG 0x0 /* US-III{,+}, IV{,+} */
#define AA_FIREPLANE_ADDRESS 0x8 /* US-III{,+}, IV{,+} */
#define AA_FIREPLANE_CONFIG_2 0x10 /* US-IV{,+} */
#define ASI_JBUS_CONFIG_REG 0x4a /* US-IIIi{,+} */
#define ASI_IMMU 0x50
#define ASI_ITLB_DATA_IN_REG 0x54
#define ASI_ITLB_DATA_ACCESS_REG 0x55
#define ASI_ITLB_TAG_READ_REG 0x56
#define ASI_IMMU_DEMAP 0x57
#define ASI_DMMU 0x58
#define ASI_DTLB_DATA_IN_REG 0x5c
#define ASI_DTLB_DATA_ACCESS_REG 0x5d
#define ASI_DTLB_TAG_READ_REG 0x5e
#define ASI_INTR_ID 0x63 /* US-IV{,+} */
#define AA_INTR_ID 0x0 /* US-IV{,+} */
#endif /* !_MACHINE_ASI_H_ */

View File

@ -1,116 +0,0 @@
/*-
* 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 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

@ -1,340 +0,0 @@
/*-
* 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;
#define SAVE_OUTS_ASI(SBP) \
stxa %o0, [SBP + (0*8)]%asi; \
stxa %o1, [SBP + (1*8)]%asi; \
stxa %o2, [SBP + (2*8)]%asi; \
stxa %o3, [SBP + (3*8)]%asi; \
stxa %o4, [SBP + (4*8)]%asi; \
stxa %o5, [SBP + (5*8)]%asi; \
stxa %o6, [SBP + (6*8)]%asi; \
stxa %o7, [SBP + (7*8)]%asi;
#define RESTORE_OUTS_ASI(SBP) \
ldxa [SBP + (0*8)]%asi, %o0; \
ldxa [SBP + (1*8)]%asi, %o1; \
ldxa [SBP + (2*8)]%asi, %o2; \
ldxa [SBP + (3*8)]%asi, %o3; \
ldxa [SBP + (4*8)]%asi, %o4; \
ldxa [SBP + (5*8)]%asi, %o5; \
ldxa [SBP + (6*8)]%asi, %o6; \
ldxa [SBP + (7*8)]%asi, %o7;
#define TTRACE_ADD_SAFE(SBP, arg0, arg1, arg2, arg3, arg4) \
SAVE_OUTS_ASI(SBP); \
mov arg0, %o0; \
mov arg1, %o1; \
mov arg2, %o2; \
mov arg3, %o3; \
mov arg4, %o4; \
RESTORE_OUTS_ASI(SBP);
#endif /* LOCORE */
#endif /* _KERNEL */
#endif /* !_MACHINE_ASMACROS_H_ */

View File

@ -1,299 +0,0 @@
/*-
* 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>
#define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory")
#define wmb() mb()
#define rmb() mb()
/* 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
#define atomic_fetchadd_long atomic_add_long
#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_ */

View File

@ -1,844 +0,0 @@
/*-
* 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.
*
* 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.58 2008/04/28 20:23:36 martin 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>
/*
* Nexus and SBus spaces are non-cached and big endian
* (except for RAM and PROM)
*
* PCI spaces are non-cached and little endian
*/
#define NEXUS_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 const int bus_type_asi[];
extern const 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)
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_SPARE2
#define __BUS_DEBUG_ACCESS(h, o, desc, sz) do { \
CTR4(KTR_BUS, "bus space: %s %d: handle %#lx, offset %#lx", \
(desc), (sz), (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,
const 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,
const 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,
const 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,
const 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,
uint8_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,
uint16_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,
uint32_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,
uint64_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 uint8_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 uint16_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 uint32_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 uint64_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 uint8_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 uint16_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 uint32_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 uint64_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, uint8_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, uint16_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, uint32_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, uint64_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 uint8_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 uint16_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 uint32_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 uint64_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 uint8_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 uint16_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 uint32_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 uint64_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));
}
#include <machine/bus_dma.h>
#endif /* !_MACHINE_BUS_H_ */

View File

@ -1,145 +0,0 @@
/*-
* 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.
*
* 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.58 2008/04/28 20:23:36 martin 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

@ -1,84 +0,0 @@
/*-
* 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_ */

View File

@ -1,46 +0,0 @@
/*-
* 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

@ -1,216 +0,0 @@
/*
* 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);
extern int md_vdev_find_node(device_t dev, mde_cookie_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

@ -1,162 +0,0 @@
/*
* 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 referred 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_ */

View File

@ -1,35 +0,0 @@
/*-
* 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_freq;
extern u_long tick_MHz;
#endif /* !_MACHINE_CLOCK_H_ */

View File

@ -1,7 +0,0 @@
/*-
* This file is in the public domain.
*
* $FreeBSD$
*/
#include <sparc64/cmt.h>

View File

@ -1,74 +0,0 @@
/*-
* 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()
#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_ */

View File

@ -1,252 +0,0 @@
/*-
* 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 ASIs. */
#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, xorval) do { \
__asm __volatile("wr %0, %1, %%" #name \
: : "r" (val), "rI" (xorval)); \
} while (0)
#define rdpr(name) ({ \
uint64_t __pr; \
__asm __volatile("rdpr %%" #name", %0" : "=r" (__pr) :); \
__pr; \
})
#define wrpr(name, val, xorval) do { \
__asm __volatile("wrpr %0, %1, %%" #name \
: : "r" (val), "rI" (xorval)); \
} while (0)
/*
* Trick GAS/GCC into compiling access to TICK/(S)TICK_COMPARE independently
* of the selected instruction set.
*/
#define rdtickcmpr() rd(asr23)
#define rdstick() rd(asr24)
#define rdstickcmpr() rd(asr25)
#define wrtickcmpr(val, xorval) wr(asr23, (val), (xorval))
#define wrstick(val, xorval) wr(asr24, (val), (xorval))
#define wrstickcmpr(val, xorval) wr(asr25, (val), (xorval))
static __inline void
breakpoint(void)
{
__asm __volatile("ta %%xcc, 1" : :);
}
static __inline register_t
intr_disable_all(void)
{
register_t 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)
{
register_t 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 { \
register_t 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>
#define USE_CPU_NANOSECONDS
#define nanoseconds() rd(tick)
#undef LDNC_GEN
#undef STNC_GEN
#endif /* !_MACHINE_CPUFUNC_H_ */

View File

@ -1,69 +0,0 @@
/*-
* 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_ */

View File

@ -1,109 +0,0 @@
/*-
* 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. */
#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_EXECPATH 15 /* Path to the executable. */
#define AT_CANARY 16 /* Canary for SSP */
#define AT_CANARYLEN 17 /* Length of the canary. */
#define AT_OSRELDATE 18 /* OSRELDATE. */
#define AT_NCPUS 19 /* Number of CPUs. */
#define AT_PAGESIZES 20 /* Pagesizes. */
#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */
#define AT_STACKPROT 23 /* Initial stack protection. */
#define AT_COUNT 24 /* Count of defined aux entry types. */
/* 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
#define ET_DYN_LOAD_ADDR 0x100000
#endif /* !_MACHINE_ELF_H_ */

View File

@ -1,7 +0,0 @@
/*-
* This file is in the public domain.
*
* $FreeBSD$
*/
#include <sparc64/endian.h>

View File

@ -1,34 +0,0 @@
/*-
* 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_ */

View File

@ -1,7 +0,0 @@
/*-
* This file is in the public domain.
*
* $FreeBSD$
*/
#include <sparc64/fireplane.h>

View File

@ -1,84 +0,0 @@
/*-
* 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 36 /* 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

@ -1,37 +0,0 @@
/*-
* 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_ */

View File

@ -1,39 +0,0 @@
/*-
* 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_ */

View File

@ -1,94 +0,0 @@
/*-
* 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 */
#ifndef LOCORE
/*
* 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 /* !LOCORE */
#endif /* !_MACHINE_FRAME_H_ */

View File

@ -1,112 +0,0 @@
/*-
* 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)
#ifndef LOCORE
#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 /* !LOCORE */
#endif /* !_MACHINE_FSR_H_ */

View File

@ -1,57 +0,0 @@
/*-
* 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

@ -1,243 +0,0 @@
/*-
* 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_HV_API_H
#define _MACHINE_HV_API_H
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 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;
/*
* Section 10 Domain Services
*/
extern void hv_mach_sir(void);
extern void hv_mach_exit(uint64_t exit_code);
extern uint64_t hv_mach_desc(uint64_t buffer_ra, uint64_t *buffer_sizep);
extern uint64_t hv_mach_watchdog(uint64_t timeout, uint64_t *time_remaining);
/*
* Section 11 CPU Services
*/
extern uint64_t hv_cpu_yield(void);
extern uint64_t hv_cpu_state(uint64_t cpuid, uint64_t *state);
extern uint64_t hv_cpu_mondo_send(int ncpu, vm_paddr_t cpulist_ra);
extern uint64_t hv_cpu_qconf(int queue, vm_paddr_t ra, int nentries);
/*
* Section 12 MMU Services
*/
/*
* TSB description structure for MMU_TSB_CTX0 and MMU_TSB_CTXNON0.
*/
typedef struct hv_tsb_info {
uint16_t hti_idxpgsz; /* page size used for index shift in TSB */
uint16_t hti_assoc; /* associativity of TSB */
uint32_t hti_ntte; /* size of TSB in TTEs */
uint32_t hti_ctx_index; /* context index */
uint32_t hti_pgszs; /* page size bitmask */
uint64_t hti_ra; /* real address of TSB base */
uint64_t hti_rsvd; /* reserved */
} hv_tsb_info_t;
extern uint64_t hv_mmu_tsb_ctx0(uint64_t, uint64_t);
extern uint64_t hv_mmu_tsb_ctxnon0(uint64_t, uint64_t);
extern uint64_t hv_mmu_map_perm_addr(vm_offset_t va, uint64_t, tte_t tte, uint64_t flags);
/*
* Section 13 Cache and Memory Services
*/
extern uint64_t hv_mem_scrub(vm_paddr_t ra, uint64_t length, uint64_t *scrubbed);
/*
* Section 14 Device Interrupt Services
*/
extern uint64_t hv_intr_devino_to_sysino(devhandle_t dev_hdl, uint32_t devino, uint64_t *sysino);
extern uint64_t hv_intr_getenabled(uint64_t sysino, int *enabled);
extern uint64_t hv_intr_setenabled(uint64_t sysino, int enabled);
extern uint64_t hv_intr_getstate(uint64_t sysino, int *state);
extern uint64_t hv_intr_setstate(uint64_t sysino, int state);
extern uint64_t hv_intr_gettarget(uint64_t sysino, int *cpuid);
extern uint64_t hv_intr_settarget(uint64_t sysino, int cpuid);
extern uint64_t hv_vintr_getcookie(devhandle_t dh, uint64_t devino, uint64_t *cookie);
extern uint64_t hv_vintr_setcookie(devhandle_t dh, uint64_t devino, uint64_t cookie);
extern uint64_t hv_vintr_getenabled(devhandle_t dh, uint64_t devino, int *enabled);
extern uint64_t hv_vintr_setenabled(devhandle_t dh, uint64_t devino, int enabled);
extern uint64_t hv_vintr_getstate(devhandle_t dh, uint64_t devino, int *state);
extern uint64_t hv_vintr_setstate(devhandle_t dh, uint64_t devino, int state);
extern uint64_t hv_vintr_gettarget(devhandle_t dh, uint64_t devino, int *cpuid);
extern uint64_t hv_vintr_settarget(devhandle_t dh, uint64_t devino, int cpuid);
/*
* Section 15 Time of Day Services
*/
extern uint64_t hv_tod_get(uint64_t *seconds);
extern uint64_t hv_tod_set(uint64_t);
/*
* Section 16 Console Services
*/
extern int64_t hv_cons_putchar(uint8_t);
extern int64_t hv_cons_getchar(uint8_t *);
extern int64_t hv_cons_write(uint64_t buf_raddr, uint64_t size, uint64_t *nwritten);
extern int64_t hv_cons_read(uint64_t buf_raddr, uint64_t size, uint64_t *nread);
extern void hv_cnputs(char *);
/*
* Section 17 Core Dump Services
*/
extern uint64_t hv_dump_buf_update(uint64_t, uint64_t, uint64_t *);
/*
* Section 18 Trap Trace Services
*/
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_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);
/*
* Section 19 Logical Domain Channel Services
*
*/
typedef struct ldc_state_info {
uint64_t lsi_head_offset;
uint64_t lsi_tail_offset;
uint64_t lsi_channel_state;
} ldc_state_info_t;
#define LDC_CHANNEL_DOWN 0
#define LDC_CHANNEL_UP 1
extern uint64_t hv_ldc_tx_qconf(uint64_t ldc_id, uint64_t base_raddr, uint64_t nentries);
extern uint64_t hv_ldc_tx_qinfo(uint64_t ldc_id, uint64_t *base_raddr, uint64_t *nentries);
extern uint64_t hv_ldc_tx_get_state(uint64_t ldc_id, ldc_state_info_t *info);
extern uint64_t hv_ldc_tx_set_qtail(uint64_t ldc_id, uint64_t tail_offset);
extern uint64_t hv_ldc_rx_get_state(uint64_t ldc_id, ldc_state_info_t *info);
extern uint64_t hv_ldc_rx_qconf(uint64_t ldc_id, uint64_t base_raddr, uint64_t nentries);
extern uint64_t hv_ldc_rx_qinfo(uint64_t ldc_id, uint64_t *base_raddr, uint64_t *nentries);
extern uint64_t hv_ldc_rx_set_qhead(uint64_t ldc_id, uint64_t head_offset);
/*
* Section 20 PCI I/O Services
*
*/
typedef union pci_cfg_data {
uint8_t b;
uint16_t w;
uint32_t dw;
uint64_t qw;
} pci_cfg_data_t;
extern uint64_t hv_pci_iommu_map(devhandle_t dh, uint64_t tsbid, uint64_t nttes, io_attributes_t io_attributes,
io_page_list_t io_page_list, pages_t *nttes_mapped);
extern uint64_t hv_pci_iommu_demap(devhandle_t dh, uint64_t tsbid, uint64_t nttes, pages_t *nttes_demapped);
extern uint64_t hv_pci_iommu_getmap(devhandle_t dh, uint64_t tsbid, io_attributes_t *io_attributes,
vm_paddr_t *ra);
extern uint64_t hv_pci_iommu_getbypass(devhandle_t dh, vm_paddr_t ra, uint64_t io_attributes, uint64_t *io_addr);
extern uint64_t hv_pci_config_get(devhandle_t dh, uint64_t pci_device, uint64_t pci_config_offset, uint64_t size,
pci_cfg_data_t *data);
extern uint64_t hv_pci_config_put(devhandle_t dh, uint64_t pci_device, uint64_t pci_config_offset, uint64_t size,
pci_cfg_data_t data);
extern uint64_t hv_pci_peek(devhandle_t dh, vm_paddr_t ra, uint64_t size, uint32_t *error_flag, uint64_t *data);
extern uint64_t hv_pci_poke(devhandle_t dh, vm_paddr_t ra, uint64_t size, uint64_t data, uint64_t pci_device,
uint32_t *error_flag);
extern uint64_t hv_pci_dma_sync(devhandle_t dh, vm_paddr_t ra, uint64_t size, uint64_t io_sync_direction,
uint64_t *nsynced);
/*
* Section 21 MSI Services
*
*/
/*
* Section 22 UltraSPARC T1 Performance Counters
*
*/
/*
* Section 23 UltraSPARC T1 MMU Statistics Counters
*
*/
/*
* Simulator Services
*/
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 /* _MACHINE_HV_API_H */

View File

@ -1,51 +0,0 @@
/*-
* 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

@ -1,39 +0,0 @@
/*-
* 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

@ -1,350 +0,0 @@
/*-
* 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
#define TTRACE_ADDENTRY 0x85
#define CORE_TRAP 0xff
/*
* Status returns in %o0.
*/
#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_ETOOMANY 15 /* Too many items specified / limit reached */
#define H_ECHANNEL 16 /* Invalid LDC channel */
#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 CORE_TRAP.
*/
#define API_SET_VERSION 0x00
#define API_PUTCHAR 0x01
#define API_EXIT 0x02
#define API_GET_VERSION 0x03
/*
* Function numbers for FAST_TRAP.
*/
#define MACH_EXIT 0x00
#define MACH_DESC 0x01
#define MACH_SIR 0x02
#define MACH_SET_SOFT_STATE 0x03
#define MACH_GET_SOFT_STATE 0x04
#define MACH_WATCHDOG 0x05
#define CPU_START 0x10
#define CPU_STOP 0x11
#define CPU_YIELD 0x12
#define CPU_QCONF 0x14
#define CPU_QINFO 0x15
#define CPU_MYID 0x16
#define CPU_STATE 0x17
#define CPU_SET_RTBA 0x18
#define CPU_GET_RTBA 0x19
#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 MMU_MAP_PERM_ADDR 0x25
#define MMU_FAULT_AREA_CONF 0x26
#define MMU_ENABLE 0x27
#define MMU_UNMAP_PERM_ADDR 0x28
#define MMU_TSB_CTX0_INFO 0x29
#define MMU_TSB_CTXNON0_INFO 0x2a
#define MMU_FAULT_AREA_INFO 0x2b
/*
* 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
#define MEM_SCRUB 0x31
#define MEM_SYNC 0x32
#define CPU_MONDO_SEND 0x42
#define TOD_GET 0x50
#define TOD_SET 0x51
#define CONS_GETCHAR 0x60
#define CONS_PUTCHAR 0x61
#define CONS_READ 0x62
#define CONS_WRITE 0x63
#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 DUMP_BUF_INFO 0x95
#define INTR_DEVINO2SYSINO 0xa0
#define INTR_GETENABLED 0xa1
#define INTR_SETENABLED 0xa2
#define INTR_GETSTATE 0xa3
#define INTR_SETSTATE 0xa4
#define INTR_GETTARGET 0xa5
#define INTR_SETTARGET 0xa6
#define VINTR_GETCOOKIE 0xa7
#define VINTR_SETCOOKIE 0xa8
#define VINTR_GETENABLED 0xa9
#define VINTR_SETENABLED 0xaa
#define VINTR_GETSTATE 0xab
#define VINTR_SETSTATE 0xac
#define VINTR_GETTARGET 0xad
#define VINTR_SETTARGET 0xae
#define PCI_IOMMU_MAP 0xb0
#define PCI_IOMMU_DEMAP 0xb1
#define PCI_IOMMU_GETMAP 0xb2
#define PCI_IOMMU_GETBYPASS 0xb3
#define PCI_CONFIG_GET 0xb4
#define PCI_CONFIG_PUT 0xb5
#define PCI_PEEK 0xb6
#define PCI_POKE 0xb7
#define PCI_DMA_SYNC 0xb8
#define PCI_MSIQ_CONF 0xc0
#define PCI_MSIQ_INFO 0xc1
#define PCI_MSIQ_GETVALID 0xc2
#define PCI_MSIQ_SETVALID 0xc3
#define PCI_MSIQ_GETSTATE 0xc4
#define PCI_MSIQ_SETSTATE 0xc5
#define PCI_MSIQ_GETHEAD 0xc6
#define PCI_MSIQ_SETHEAD 0xc7
#define PCI_MSIQ_GETTAIL 0xc8
#define PCI_MSI_GETVALID 0xc9
#define PCI_MSI_SETVALID 0xca
#define PCI_MSI_GETMSIQ 0xcb
#define PCI_MSI_SETMSIQ 0xcc
#define PCI_MSI_GETSTATE 0xcd
#define PCI_MSI_SETSTATE 0xce
#define PCI_MSG_GETMSIQ 0xd0
#define PCI_MSG_SETMSIQ 0xd1
#define PCI_MSG_GETVALID 0xd2
#define PCI_MSG_SETVALID 0xd3
#define LDC_TX_QCONF 0xe0
#define LDC_TX_QINFO 0xe1
#define LDC_TX_GET_STATE 0xe2
#define LDC_TX_SET_QTAIL 0xe3
#define LDC_RX_QCONF 0xe4
#define LDC_RX_QINFO 0xe5
#define LDC_RX_GET_STATE 0xe6
#define LDC_RX_SET_QHEAD 0xe7
#define LDC_SET_MAPTABLE 0xea
#define LDC_GET_MAPTABLE 0xeb
#define LDC_COPY 0xec
#define LDC_MAPIN 0xed
#define LDC_UNMAP 0xee
#define LDC_REVOKE 0xef
#define SIM_READ 0xf0
#define SIM_WRITE 0xf1
#define NIAGARA_GET_PERFREG 0x100
#define NIAGARA_SET_PERFREG 0x101
#define NIAGARA_MMUSTAT_CONF 0x102
#define NIAGARA_MMUSTAT_INFO 0x103
/*
* 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_DISABLED 0
#define HV_INTR_ENABLED 1
#ifndef LOCORE
#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
#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

@ -1,63 +0,0 @@
/*-
* 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_ */

View File

@ -1,137 +0,0 @@
/*-
* 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

@ -1,26 +0,0 @@
/*-
* 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

@ -1,7 +0,0 @@
/*-
* This file is in the public domain.
*
* $FreeBSD$
*/
#include <sparc64/in_cksum.h>

View File

@ -1,618 +0,0 @@
/*-
* 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

@ -1,107 +0,0 @@
/*-
* 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 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_PREEMPT 6 /* preempt idle thread cpu ipi */
#define PIL_HARDCLOCK 7 /* hardclock broadcast */
#define PIL_FAST 13 /* fast interrupts */
#define PIL_TICK 14
#ifndef LOCORE
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, int (*filt)(void *),
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_CPU_Q_SIZE (cpu_q_entries * INTR_REPORT_SIZE)
#define INTR_DEV_Q_SIZE (dev_q_entries * INTR_REPORT_SIZE)
#endif /* !LOCORE */
#define INTR_REPORT_SIZE 64
#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 /* !_MACHINE_INTR_MACHDEP_H_ */

View File

@ -1,7 +0,0 @@
/*-
* This file is in the public domain.
*
* $FreeBSD$
*/
#include <sparc64/jbus.h>

View File

@ -1,55 +0,0 @@
/*-
* 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_sync_icache(unsigned char *addr, size_t size)
{
}
static __inline void
kdb_cpu_trap(int vector, int _)
{
flushw();
}
#endif /* _MACHINE_KDB_H_ */

View File

@ -1,51 +0,0 @@
/*-
* 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_ */

View File

@ -1,95 +0,0 @@
/*-
* 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

@ -1,41 +0,0 @@
/*-
* 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_ */

View File

@ -1,68 +0,0 @@
/*-
* 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

@ -1,63 +0,0 @@
/*-
* 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

@ -1,72 +0,0 @@
/*-
* 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_ */

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