ia64/xen-unstable

changeset 8241:0255f48b757f

Temporarily remove NetBSD and FreeBSD sparse trees to avoid user confusion.
The NetBSD and FreeBSD currently don't build against the final Xen 3.0 API.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Sun Dec 04 20:12:00 2005 +0100 (2005-12-04)
parents 64cd054aa143
children c8fdb0caa77b
files
line diff
     1.1 --- a/buildconfigs/mk.netbsd-2.0-xenU	Sun Dec 04 18:24:24 2005 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,45 +0,0 @@
     1.4 -
     1.5 -OS                = netbsd
     1.6 -
     1.7 -NETBSD_RELEASE   ?= 2.0
     1.8 -NETBSD_CVSSNAP   ?= 20050309
     1.9 -
    1.10 -EXTRAVERSION = xenU
    1.11 -
    1.12 -FULLVERSION  = $(NETBSD_VER)-$(EXTRAVERSION)
    1.13 -
    1.14 -NETBSD_DIR   = $(OS)-$(FULLVERSION)
    1.15 -
    1.16 -.PHONY: build clean mrproper mkpatch
    1.17 -
    1.18 -include buildconfigs/Rules.mk
    1.19 -
    1.20 -build: $(OS)-$(EXTRAVERSION)
    1.21 -
    1.22 -netbsd-%-tools.tar.bz2:
    1.23 -	@echo "Cannot find netbsd-$(NETBSD_VER)-tools.tar.gz in path $(NETBSD_SRC_PATH)"
    1.24 -	wget http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/netbsd-$*-tools.tar.bz2 -O./$@
    1.25 -
    1.26 -netbsd-%-tools: netbsd-%-tools.tar.bz2
    1.27 -	tar -jxf $<
    1.28 -	touch $@ # update timestamp to avoid rebuild
    1.29 -
    1.30 -$(NETBSD_DIR)/.valid: ref-$(OS)-$(NETBSD_VER)/.valid-ref
    1.31 -	$(RM) -rf $(NETBSD_DIR)
    1.32 -	cp -al $(<D) $(NETBSD_DIR)
    1.33 -	# Apply arch-xen patches
    1.34 -	( cd netbsd-$(NETBSD_VER)-xen-sparse ; \
    1.35 -          ./mkbuildtree ../$(NETBSD_DIR) )
    1.36 -	@touch $(NETBSD_DIR)/.valid
    1.37 -
    1.38 -# build the specified netbsd tree
    1.39 -netbsd-xen%: $(NETBSD_DIR)/.valid netbsd-$(NETBSD_RELEASE)-tools
    1.40 -	$(MAKE) -C netbsd-$(FULLVERSION) config
    1.41 -	$(MAKE) -C netbsd-$(FULLVERSION) netbsd
    1.42 -	$(MAKE) -C netbsd-$(FULLVERSION) INSTALL_PATH=$(DESTDIR) INSTALL_NAME=boot/netbsd-$(NETBSD_VER)-xen$* install
    1.43 -
    1.44 -clean::
    1.45 -	$(MAKE) -C netbsd-$(FULLVERSION) clean
    1.46 -
    1.47 -delete:
    1.48 -	rm -rf tmp-$(OS)-$(NETBSD_VER) $(NETBSD_DIR)
     2.1 --- a/freebsd-5.3-xen-sparse/conf/Makefile.i386-xen	Sun Dec 04 18:24:24 2005 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,51 +0,0 @@
     2.4 -# Makefile.i386 -- with config changes.
     2.5 -# Copyright 1990 W. Jolitz
     2.6 -#	from: @(#)Makefile.i386	7.1 5/10/91
     2.7 -# $FreeBSD: src/sys/conf/Makefile.i386,v 1.259 2003/04/15 21:29:11 phk Exp $
     2.8 -#
     2.9 -# Makefile for FreeBSD
    2.10 -#
    2.11 -# This makefile is constructed from a machine description:
    2.12 -#	config machineid
    2.13 -# Most changes should be made in the machine description
    2.14 -#	/sys/i386/conf/``machineid''
    2.15 -# after which you should do
    2.16 -#	 config machineid
    2.17 -# Generic makefile changes should be made in
    2.18 -#	/sys/conf/Makefile.i386
    2.19 -# after which config should be rerun for all machines.
    2.20 -#
    2.21 -
    2.22 -# Which version of config(8) is required.
    2.23 -%VERSREQ=	500013
    2.24 -
    2.25 -STD8X16FONT?=	iso
    2.26 -
    2.27 -
    2.28 -
    2.29 -.if !defined(S)
    2.30 -.if exists(./@/.)
    2.31 -S=	./@
    2.32 -.else
    2.33 -S=	../../..
    2.34 -.endif
    2.35 -.endif
    2.36 -.include "$S/conf/kern.pre.mk"
    2.37 -M=	i386-xen
    2.38 -MKMODULESENV+= MACHINE=i386-xen
    2.39 -INCLUDES+= -I../../include/xen-public
    2.40 -%BEFORE_DEPEND
    2.41 -
    2.42 -%OBJS
    2.43 -
    2.44 -%FILES.c
    2.45 -
    2.46 -%FILES.s
    2.47 -
    2.48 -%FILES.m
    2.49 -
    2.50 -%CLEAN
    2.51 -
    2.52 -%RULES
    2.53 -
    2.54 -.include "$S/conf/kern.post.mk"
     3.1 --- a/freebsd-5.3-xen-sparse/conf/files.i386-xen	Sun Dec 04 18:24:24 2005 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,295 +0,0 @@
     3.4 -# This file tells config what files go into building a kernel,
     3.5 -# files marked standard are always included.
     3.6 -#
     3.7 -# $FreeBSD: src/sys/conf/files.i386,v 1.457 2003/12/03 23:06:30 imp Exp $
     3.8 -#
     3.9 -# The long compile-with and dependency lines are required because of
    3.10 -# limitations in config: backslash-newline doesn't work in strings, and
    3.11 -# dependency lines other than the first are silently ignored.
    3.12 -#
    3.13 -linux_genassym.o		optional	compat_linux		\
    3.14 -	dependency 	"$S/i386/linux/linux_genassym.c"		\
    3.15 -	compile-with	"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"	\
    3.16 -	no-obj no-implicit-rule						\
    3.17 -	clean		"linux_genassym.o"
    3.18 -#
    3.19 -linux_assym.h			optional	compat_linux		\
    3.20 -	dependency 	"$S/kern/genassym.sh linux_genassym.o"		\
    3.21 -	compile-with	"sh $S/kern/genassym.sh linux_genassym.o > ${.TARGET}" \
    3.22 -	no-obj no-implicit-rule before-depend				\
    3.23 -	clean		"linux_assym.h"
    3.24 -#
    3.25 -svr4_genassym.o			optional	compat_svr4		\
    3.26 -	dependency 	"$S/i386/svr4/svr4_genassym.c"			\
    3.27 -	compile-with	"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"	\
    3.28 -	no-obj no-implicit-rule						\
    3.29 -	clean		"svr4_genassym.o"
    3.30 -#
    3.31 -svr4_assym.h			optional	compat_svr4		\
    3.32 -	dependency 	"$S/kern/genassym.sh svr4_genassym.o"	   	\
    3.33 -	compile-with	"sh $S/kern/genassym.sh svr4_genassym.o > ${.TARGET}" \
    3.34 -	no-obj no-implicit-rule before-depend				\
    3.35 -	clean		"svr4_assym.h"
    3.36 -#
    3.37 -font.h				optional	sc_dflt_font		\
    3.38 -	compile-with	"uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'static u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'static u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'static u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h"									\
    3.39 -	no-obj no-implicit-rule before-depend				\
    3.40 -	clean		"font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
    3.41 -#
    3.42 -atkbdmap.h			optional	atkbd_dflt_keymap	\
    3.43 -	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"			\
    3.44 -	no-obj no-implicit-rule before-depend				\
    3.45 -	clean		"atkbdmap.h"
    3.46 -#
    3.47 -ukbdmap.h			optional	ukbd_dflt_keymap	\
    3.48 -	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"			\
    3.49 -	no-obj no-implicit-rule before-depend				\
    3.50 -	clean		"ukbdmap.h"
    3.51 -#
    3.52 -msysosak.o			optional	fla			\
    3.53 -	dependency	"$S/contrib/dev/fla/i386/msysosak.o.uu" 	\
    3.54 -	compile-with	"uudecode < $S/contrib/dev/fla/i386/msysosak.o.uu" \
    3.55 -	no-implicit-rule
    3.56 -#
    3.57 -trlld.o				optional	oltr			\
    3.58 -	dependency	"$S/contrib/dev/oltr/i386-elf.trlld.o.uu"	\
    3.59 -	compile-with	"uudecode < $S/contrib/dev/oltr/i386-elf.trlld.o.uu"	\
    3.60 -	no-implicit-rule
    3.61 -#
    3.62 -hal.o				optional	ath_hal			\
    3.63 -	dependency	"$S/contrib/dev/ath/freebsd/i386-elf.hal.o.uu"	\
    3.64 -	compile-with	"uudecode < $S/contrib/dev/ath/freebsd/i386-elf.hal.o.uu" \
    3.65 -	no-implicit-rule
    3.66 -#
    3.67 -#
    3.68 -compat/linux/linux_file.c	optional	compat_linux
    3.69 -compat/linux/linux_getcwd.c	optional	compat_linux
    3.70 -compat/linux/linux_ioctl.c	optional	compat_linux
    3.71 -compat/linux/linux_ipc.c	optional	compat_linux
    3.72 -compat/linux/linux_mib.c	optional	compat_linux
    3.73 -compat/linux/linux_misc.c	optional	compat_linux
    3.74 -compat/linux/linux_signal.c	optional	compat_linux
    3.75 -compat/linux/linux_socket.c	optional	compat_linux
    3.76 -compat/linux/linux_stats.c	optional	compat_linux
    3.77 -compat/linux/linux_sysctl.c	optional	compat_linux
    3.78 -compat/linux/linux_uid16.c	optional	compat_linux
    3.79 -compat/linux/linux_util.c	optional	compat_linux
    3.80 -compat/pecoff/imgact_pecoff.c		optional	pecoff_support
    3.81 -compat/svr4/imgact_svr4.c		optional	compat_svr4
    3.82 -compat/svr4/svr4_fcntl.c		optional	compat_svr4
    3.83 -compat/svr4/svr4_filio.c		optional	compat_svr4
    3.84 -compat/svr4/svr4_ioctl.c		optional	compat_svr4
    3.85 -compat/svr4/svr4_ipc.c			optional	compat_svr4
    3.86 -compat/svr4/svr4_misc.c			optional	compat_svr4
    3.87 -compat/svr4/svr4_resource.c		optional	compat_svr4
    3.88 -compat/svr4/svr4_signal.c		optional	compat_svr4
    3.89 -compat/svr4/svr4_socket.c		optional	compat_svr4
    3.90 -compat/svr4/svr4_sockio.c		optional	compat_svr4
    3.91 -compat/svr4/svr4_stat.c			optional	compat_svr4
    3.92 -compat/svr4/svr4_stream.c		optional	compat_svr4
    3.93 -compat/svr4/svr4_syscallnames.c		optional	compat_svr4
    3.94 -compat/svr4/svr4_sysent.c		optional	compat_svr4
    3.95 -compat/svr4/svr4_sysvec.c		optional	compat_svr4
    3.96 -compat/svr4/svr4_termios.c		optional	compat_svr4
    3.97 -compat/svr4/svr4_ttold.c		optional	compat_svr4
    3.98 -contrib/dev/fla/fla.c		optional	fla
    3.99 -contrib/dev/oltr/if_oltr.c	optional	oltr
   3.100 -contrib/dev/oltr/trlldbm.c	optional	oltr
   3.101 -contrib/dev/oltr/trlldhm.c	optional	oltr
   3.102 -contrib/dev/oltr/trlldmac.c	optional	oltr
   3.103 -bf_enc.o			optional	ipsec ipsec_esp		\
   3.104 -	dependency	"$S/crypto/blowfish/arch/i386/bf_enc.S $S/crypto/blowfish/arch/i386/bf_enc_586.S $S/crypto/blowfish/arch/i386/bf_enc_686.S"		\
   3.105 -	compile-with	"${CC} -c -I$S/crypto/blowfish/arch/i386 ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}"	\
   3.106 -	no-implicit-rule
   3.107 -crypto/des/arch/i386/des_enc.S		optional	ipsec ipsec_esp
   3.108 -crypto/des/des_ecb.c			optional	netsmbcrypto
   3.109 -crypto/des/arch/i386/des_enc.S		optional	netsmbcrypto
   3.110 -crypto/des/des_setkey.c			optional	netsmbcrypto
   3.111 -bf_enc.o			optional	crypto		\
   3.112 -	dependency	"$S/crypto/blowfish/arch/i386/bf_enc.S $S/crypto/blowfish/arch/i386/bf_enc_586.S $S/crypto/blowfish/arch/i386/bf_enc_686.S"		\
   3.113 -	compile-with	"${CC} -c -I$S/crypto/blowfish/arch/i386 ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}"	\
   3.114 -	no-implicit-rule
   3.115 -crypto/des/arch/i386/des_enc.S		optional	crypto
   3.116 -crypto/des/des_ecb.c			optional	crypto
   3.117 -crypto/des/des_setkey.c			optional	crypto
   3.118 -dev/ar/if_ar.c			optional	ar
   3.119 -dev/ar/if_ar_pci.c		optional	ar pci
   3.120 -dev/cx/csigma.c			optional	cx
   3.121 -dev/cx/cxddk.c			optional	cx
   3.122 -dev/cx/if_cx.c			optional	cx
   3.123 -dev/dgb/dgb.c			count		dgb
   3.124 -dev/fb/fb.c			optional	fb
   3.125 -dev/fb/fb.c			optional	vga
   3.126 -dev/fb/splash.c			optional	splash
   3.127 -dev/fb/vga.c			optional	vga
   3.128 -dev/kbd/atkbd.c			optional	atkbd
   3.129 -dev/kbd/atkbdc.c		optional	atkbdc
   3.130 -dev/kbd/kbd.c			optional	atkbd
   3.131 -dev/kbd/kbd.c			optional	kbd
   3.132 -dev/kbd/kbd.c			optional	sc
   3.133 -dev/kbd/kbd.c			optional	ukbd
   3.134 -dev/kbd/kbd.c			optional	vt
   3.135 -dev/mem/memutil.c		standard
   3.136 -dev/random/nehemiah.c		standard
   3.137 -dev/ppc/ppc.c			optional	ppc
   3.138 -dev/ppc/ppc_puc.c		optional	ppc puc pci
   3.139 -dev/sio/sio.c			optional	sio
   3.140 -dev/sio/sio_isa.c		optional	sio isa
   3.141 -dev/syscons/schistory.c		optional	sc
   3.142 -dev/syscons/scmouse.c		optional	sc
   3.143 -dev/syscons/scterm.c		optional	sc
   3.144 -dev/syscons/scterm-dumb.c	optional	sc
   3.145 -dev/syscons/scterm-sc.c		optional	sc
   3.146 -dev/syscons/scvesactl.c		optional	sc vga vesa
   3.147 -dev/syscons/scvgarndr.c		optional	sc vga
   3.148 -dev/syscons/scvidctl.c		optional	sc
   3.149 -dev/syscons/scvtb.c		optional	sc
   3.150 -dev/syscons/syscons.c		optional	sc
   3.151 -dev/syscons/sysmouse.c		optional	sc
   3.152 -dev/uart/uart_cpu_i386.c	optional	uart
   3.153 -geom/geom_bsd.c			standard
   3.154 -geom/geom_bsd_enc.c		standard
   3.155 -geom/geom_mbr.c			standard
   3.156 -geom/geom_mbr_enc.c		standard
   3.157 -i386/acpica/OsdEnvironment.c	optional	acpi
   3.158 -i386/acpica/acpi_machdep.c	optional	acpi
   3.159 -i386/acpica/acpi_wakeup.c	optional	acpi
   3.160 -acpi_wakecode.h			optional	acpi			\
   3.161 -	dependency 	"$S/i386/acpica/acpi_wakecode.S"		\
   3.162 -	compile-with	"${MAKE} -f $S/i386/acpica/Makefile MAKESRCPATH=$S/i386/acpica"	\
   3.163 -	no-obj no-implicit-rule before-depend				\
   3.164 -	clean		"acpi_wakecode.h acpi_wakecode.o acpi_wakecode.bin"
   3.165 -#
   3.166 -i386/acpica/madt.c		optional	acpi apic
   3.167 -i386/bios/mca_machdep.c		optional	mca
   3.168 -i386/bios/smapi.c		optional	smapi
   3.169 -i386/bios/smapi_bios.S		optional	smapi
   3.170 -i386/bios/smbios.c		optional	smbios
   3.171 -i386/bios/vpd.c			optional	vpd
   3.172 -i386/i386/apic_vector.s		optional	apic
   3.173 -i386/i386/atomic.c		standard				\
   3.174 -	compile-with	"${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}"
   3.175 -i386/i386/autoconf.c		        standard
   3.176 -i386/i386/busdma_machdep.c		standard
   3.177 -i386-xen/i386-xen/critical.c		standard
   3.178 -i386/i386/db_disasm.c			optional	ddb
   3.179 -i386-xen/i386-xen/db_interface.c	optional	ddb
   3.180 -i386/i386/db_trace.c			optional	ddb
   3.181 -i386/i386/i386-gdbstub.c		optional	ddb
   3.182 -i386/i386/dump_machdep.c		standard
   3.183 -i386/i386/elf_machdep.c	standard
   3.184 -i386-xen/i386-xen/exception.s		standard
   3.185 -i386-xen/i386-xen/i686_mem.c		standard
   3.186 -i386/i386/identcpu.c			standard
   3.187 -i386/i386/in_cksum.c			optional	inet
   3.188 -i386-xen/i386-xen/initcpu.c		standard
   3.189 -i386-xen/i386-xen/intr_machdep.c	standard
   3.190 -i386-xen/i386-xen/io_apic.c           optional        apic
   3.191 -i386/i386/legacy.c			standard
   3.192 -i386-xen/i386-xen/locore.s		standard	no-obj
   3.193 -i386-xen/i386-xen/machdep.c		standard
   3.194 -i386/i386/mem.c		                standard
   3.195 -i386-xen/i386-xen/mp_clock.c		optional	smp
   3.196 -i386-xen/i386-xen/mp_machdep.c	optional	smp
   3.197 -i386/i386/mpboot.s		optional	smp
   3.198 -i386-xen/i386-xen/mptable.c	optional	apic
   3.199 -i386-xen/i386-xen/local_apic.c	optional	apic
   3.200 -i386/i386/mptable_pci.c		optional	apic pci
   3.201 -i386/i386/nexus.c	        standard
   3.202 -i386/i386/uio_machdep.c	        standard
   3.203 -i386/i386/perfmon.c		optional	perfmon
   3.204 -i386/i386/perfmon.c		optional	perfmon	profiling-routine
   3.205 -i386-xen/i386-xen/pmap.c	standard
   3.206 -i386-xen/i386-xen/support.s	standard
   3.207 -i386-xen/i386-xen/swtch.s	standard
   3.208 -i386-xen/i386-xen/sys_machdep.c	standard
   3.209 -i386-xen/i386-xen/trap.c	standard
   3.210 -i386/i386/tsc.c			standard
   3.211 -i386-xen/i386-xen/vm_machdep.c	standard
   3.212 -i386-xen/i386-xen/clock.c	standard
   3.213 -
   3.214 -# xen specific arch-dep files
   3.215 -i386-xen/i386-xen/hypervisor.c	standard
   3.216 -i386-xen/i386-xen/xen_machdep.c	standard
   3.217 -i386-xen/i386-xen/xen_bus.c	standard
   3.218 -i386-xen/i386-xen/evtchn.c	standard
   3.219 -i386-xen/i386-xen/ctrl_if.c	standard
   3.220 -i386-xen/i386-xen/gnttab.c	standard
   3.221 -
   3.222 -
   3.223 -i386/isa/asc.c			count		asc
   3.224 -i386/isa/ctx.c			optional	ctx
   3.225 -i386/isa/cy.c			count		cy
   3.226 -i386/isa/elink.c		optional	ep
   3.227 -i386/isa/elink.c		optional	ie
   3.228 -i386/isa/gpib.c			optional	gp
   3.229 -i386/isa/gsc.c			count		gsc
   3.230 -i386/isa/istallion.c		optional	stli nowerror
   3.231 -i386/isa/loran.c		optional	loran
   3.232 -i386/isa/mse.c			optional	mse
   3.233 -i386/isa/nmi.c			standard
   3.234 -
   3.235 -# drivers
   3.236 -i386-xen/xen/misc/npx.c	optional	npx
   3.237 -i386-xen/xen/misc/evtchn_dev.c	standard
   3.238 -i386-xen/xen/char/console.c	standard
   3.239 -i386-xen/xen/netfront/xn_netfront.c	standard
   3.240 -i386-xen/xen/blkfront/xb_blkfront.c	standard
   3.241 -
   3.242 -
   3.243 -
   3.244 -i386/isa/pcf.c			optional	pcf
   3.245 -i386/isa/pcvt/pcvt_drv.c	optional	vt
   3.246 -i386/isa/pcvt/pcvt_ext.c	optional	vt
   3.247 -i386/isa/pcvt/pcvt_kbd.c	optional	vt
   3.248 -i386/isa/pcvt/pcvt_out.c	optional	vt
   3.249 -i386/isa/pcvt/pcvt_sup.c	optional	vt
   3.250 -i386/isa/pcvt/pcvt_vtf.c	optional	vt
   3.251 -i386/isa/pmtimer.c		optional	pmtimer
   3.252 -i386/isa/prof_machdep.c		optional	profiling-routine
   3.253 -i386/isa/spic.c			optional	spic
   3.254 -i386/isa/spigot.c		count		spigot
   3.255 -i386/isa/spkr.c			optional	speaker
   3.256 -i386/isa/stallion.c		optional	stl nowerror
   3.257 -i386/isa/vesa.c			optional	vga vesa
   3.258 -i386/isa/wt.c			count		wt
   3.259 -i386/linux/imgact_linux.c	optional	compat_linux
   3.260 -i386/linux/linux_dummy.c	optional	compat_linux
   3.261 -i386/linux/linux_locore.s	optional	compat_linux		\
   3.262 -	dependency 	"linux_assym.h"
   3.263 -i386/linux/linux_machdep.c	optional	compat_linux
   3.264 -i386/linux/linux_ptrace.c	optional	compat_linux
   3.265 -i386/linux/linux_sysent.c	optional	compat_linux
   3.266 -i386/linux/linux_sysvec.c	optional	compat_linux
   3.267 -i386/pci/pci_cfgreg.c		optional	pci
   3.268 -i386/pci/pci_bus.c		optional	pci
   3.269 -i386/svr4/svr4_locore.s		optional	compat_svr4		\
   3.270 -	dependency	"svr4_assym.h"	\
   3.271 -	warning "COMPAT_SVR4 is broken and should be avoided"
   3.272 -i386/svr4/svr4_machdep.c	optional	compat_svr4
   3.273 -isa/atkbd_isa.c			optional	atkbd
   3.274 -isa/atkbdc_isa.c		optional	atkbdc
   3.275 -isa/fd.c			optional	fdc
   3.276 -isa/psm.c			optional	psm
   3.277 -isa/syscons_isa.c		optional	sc
   3.278 -isa/vga_isa.c			optional	vga
   3.279 -kern/imgact_aout.c		optional	compat_aout
   3.280 -kern/imgact_gzip.c		optional	gzip
   3.281 -libkern/divdi3.c		standard
   3.282 -libkern/moddi3.c		standard
   3.283 -libkern/qdivrem.c		standard
   3.284 -libkern/ucmpdi2.c		standard
   3.285 -libkern/udivdi3.c		standard
   3.286 -libkern/umoddi3.c		standard
   3.287 -libkern/flsl.c			standard
   3.288 -libkern/ffsl.c			standard
   3.289 -
   3.290 -pci/cy_pci.c			optional	cy pci
   3.291 -pci/agp_intel.c			optional	agp
   3.292 -pci/agp_via.c			optional	agp
   3.293 -pci/agp_sis.c			optional	agp
   3.294 -pci/agp_ali.c			optional	agp
   3.295 -pci/agp_amd.c			optional	agp
   3.296 -pci/agp_i810.c			optional	agp
   3.297 -pci/agp_nvidia.c		optional	agp
   3.298 -
     4.1 --- a/freebsd-5.3-xen-sparse/conf/kern.mk	Sun Dec 04 18:24:24 2005 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,100 +0,0 @@
     4.4 -# $FreeBSD: src/sys/conf/kern.mk,v 1.42 2004/05/14 13:35:46 cognet Exp $
     4.5 -
     4.6 -#
     4.7 -# Warning flags for compiling the kernel and components of the kernel.
     4.8 -#
     4.9 -# Note that the newly added -Wcast-qual is responsible for generating 
    4.10 -# most of the remaining warnings.  Warnings introduced with -Wall will
    4.11 -# also pop up, but are easier to fix.
    4.12 -.if ${CC} == "icc"
    4.13 -#CWARNFLAGS=	-w2	# use this if you are terribly bored
    4.14 -CWARNFLAGS=
    4.15 -.else
    4.16 -CWARNFLAGS?=	-Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
    4.17 -		-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
    4.18 -		-fformat-extensions 
    4.19 -.endif
    4.20 -# -std=c99 anonymous unions are non-compliant
    4.21 -#
    4.22 -# The following flags are next up for working on:
    4.23 -#	-W
    4.24 -
    4.25 -#
    4.26 -# On the i386, do not align the stack to 16-byte boundaries.  Otherwise GCC
    4.27 -# 2.95 adds code to the entry and exit point of every function to align the
    4.28 -# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
    4.29 -# per function call.  While the 16-byte alignment may benefit micro benchmarks, 
    4.30 -# it is probably an overall loss as it makes the code bigger (less efficient
    4.31 -# use of code cache tag lines) and uses more stack (less efficient use of data
    4.32 -# cache tag lines)
    4.33 -#
    4.34 -.if ${MACHINE_ARCH} == "i386" && ${CC} != "icc"
    4.35 -CFLAGS+=	-mno-align-long-strings -mpreferred-stack-boundary=2
    4.36 -INLINE_LIMIT?=	8000
    4.37 -.endif
    4.38 -
    4.39 -#
    4.40 -# On the alpha, make sure that we don't use floating-point registers and
    4.41 -# allow the use of BWX etc instructions (only needed for low-level i/o).
    4.42 -# Also, reserve register t7 to point at per-cpu global variables.
    4.43 -#
    4.44 -.if ${MACHINE_ARCH} == "alpha"
    4.45 -CFLAGS+=	-mno-fp-regs -ffixed-8 -Wa,-mev6
    4.46 -INLINE_LIMIT?=	15000
    4.47 -.endif
    4.48 -
    4.49 -.if ${MACHINE_ARCH} == "arm"
    4.50 -INLINE_LIMIT?=	8000
    4.51 -.endif
    4.52 -#
    4.53 -# For IA-64, we use r13 for the kernel globals pointer and we only use
    4.54 -# a very small subset of float registers for integer divides.
    4.55 -#
    4.56 -.if ${MACHINE_ARCH} == "ia64"
    4.57 -CFLAGS+=	-ffixed-r13 -mfixed-range=f32-f127 -mno-sdata
    4.58 -INLINE_LIMIT?=	15000
    4.59 -.endif
    4.60 -
    4.61 -#
    4.62 -# For sparc64 we want medlow code model, and we tell gcc to use floating
    4.63 -# point emulation.  This avoids using floating point registers for integer
    4.64 -# operations which it has a tendency to do.
    4.65 -#
    4.66 -.if ${MACHINE_ARCH} == "sparc64"
    4.67 -CFLAGS+=	-mcmodel=medlow -msoft-float
    4.68 -INLINE_LIMIT?=	15000
    4.69 -.endif
    4.70 -
    4.71 -#
    4.72 -# For AMD64, use a medium model for now.  We'll switch to "kernel"
    4.73 -# once pmap is ready.  Be excessively careful to not generate FPU code.
    4.74 -#
    4.75 -.if ${MACHINE_ARCH} == "amd64"
    4.76 -CFLAGS+=	-mcmodel=kernel -mno-red-zone \
    4.77 -		-mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow \
    4.78 -		-msoft-float -fno-asynchronous-unwind-tables
    4.79 -INLINE_LIMIT?=	8000
    4.80 -.endif
    4.81 -
    4.82 -#
    4.83 -# For PowerPC we tell gcc to use floating point emulation.  This avoids using
    4.84 -# floating point registers for integer operations which it has a tendency to do.
    4.85 -#
    4.86 -.if ${MACHINE_ARCH} == "powerpc"
    4.87 -CFLAGS+=	-msoft-float
    4.88 -INLINE_LIMIT?=	15000
    4.89 -.endif
    4.90 -
    4.91 -#
    4.92 -# GCC 3.0 and above like to do certain optimizations based on the
    4.93 -# assumption that the program is linked against libc.  Stop this.
    4.94 -#
    4.95 -.if ${CC} == "icc"
    4.96 -CFLAGS+=	-nolib_inline
    4.97 -.else
    4.98 -CFLAGS+=	-ffreestanding
    4.99 -.endif
   4.100 -
   4.101 -.if ${CC} == "icc"
   4.102 -CFLAGS+=	-restrict
   4.103 -.endif
     5.1 --- a/freebsd-5.3-xen-sparse/conf/ldscript.i386-xen	Sun Dec 04 18:24:24 2005 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,134 +0,0 @@
     5.4 -/* $FreeBSD: src/sys/conf/ldscript.i386,v 1.9 2003/12/03 07:40:03 phk Exp $ */
     5.5 -OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd")
     5.6 -OUTPUT_ARCH(i386)
     5.7 -ENTRY(btext)
     5.8 -SEARCH_DIR(/usr/lib);
     5.9 -SECTIONS
    5.10 -{
    5.11 -  /* Read-only sections, merged into text segment: */
    5.12 -  . = kernbase + SIZEOF_HEADERS;
    5.13 -  .interp     : { *(.interp) 	}
    5.14 -  .hash          : { *(.hash)		}
    5.15 -  .dynsym        : { *(.dynsym)		}
    5.16 -  .dynstr        : { *(.dynstr)		}
    5.17 -  .gnu.version   : { *(.gnu.version)	}
    5.18 -  .gnu.version_d   : { *(.gnu.version_d)	}
    5.19 -  .gnu.version_r   : { *(.gnu.version_r)	}
    5.20 -  .rel.text      :
    5.21 -    { *(.rel.text) *(.rel.gnu.linkonce.t*) }
    5.22 -  .rela.text     :
    5.23 -    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
    5.24 -  .rel.data      :
    5.25 -    { *(.rel.data) *(.rel.gnu.linkonce.d*) }
    5.26 -  .rela.data     :
    5.27 -    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
    5.28 -  .rel.rodata    :
    5.29 -    { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
    5.30 -  .rela.rodata   :
    5.31 -    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
    5.32 -  .rel.got       : { *(.rel.got)		}
    5.33 -  .rela.got      : { *(.rela.got)		}
    5.34 -  .rel.ctors     : { *(.rel.ctors)	}
    5.35 -  .rela.ctors    : { *(.rela.ctors)	}
    5.36 -  .rel.dtors     : { *(.rel.dtors)	}
    5.37 -  .rela.dtors    : { *(.rela.dtors)	}
    5.38 -  .rel.init      : { *(.rel.init)	}
    5.39 -  .rela.init     : { *(.rela.init)	}
    5.40 -  .rel.fini      : { *(.rel.fini)	}
    5.41 -  .rela.fini     : { *(.rela.fini)	}
    5.42 -  .rel.bss       : { *(.rel.bss)		}
    5.43 -  .rela.bss      : { *(.rela.bss)		}
    5.44 -  .rel.plt       : { *(.rel.plt)		}
    5.45 -  .rela.plt      : { *(.rela.plt)		}
    5.46 -  .init          : { *(.init)	} =0x9090
    5.47 -  .plt      : { *(.plt)	}
    5.48 -  .text      :
    5.49 -  {
    5.50 -    *(.text)
    5.51 -    *(.stub)
    5.52 -    /* .gnu.warning sections are handled specially by elf32.em.  */
    5.53 -    *(.gnu.warning)
    5.54 -    *(.gnu.linkonce.t*)
    5.55 -  } =0x9090
    5.56 -  _etext = .;
    5.57 -  PROVIDE (etext = .);
    5.58 -  .fini      : { *(.fini)    } =0x9090
    5.59 -  .rodata    : { *(.rodata) *(.gnu.linkonce.r*) }
    5.60 -  .rodata1   : { *(.rodata1) }
    5.61 -  /* Adjust the address for the data segment.  We want to adjust up to
    5.62 -     the same address within the page on the next page up.  */
    5.63 -  . = ALIGN(0x1000) + (. & (0x1000 - 1)) ; 
    5.64 -  .data    :
    5.65 -  {
    5.66 -    *(.data)
    5.67 -    *(.gnu.linkonce.d*)
    5.68 -    CONSTRUCTORS
    5.69 -  }
    5.70 -  .data1   : { *(.data1) }
    5.71 -  . = ALIGN(32 / 8);
    5.72 -  _start_ctors = .;
    5.73 -  PROVIDE (start_ctors = .);
    5.74 -  .ctors         :
    5.75 -  {
    5.76 -    *(.ctors)
    5.77 -  }
    5.78 -  _stop_ctors = .;
    5.79 -  PROVIDE (stop_ctors = .);
    5.80 -  .dtors         :
    5.81 -  {
    5.82 -    *(.dtors)
    5.83 -  }
    5.84 -  .got           : { *(.got.plt) *(.got) }
    5.85 -  .dynamic       : { *(.dynamic) }
    5.86 -  /* We want the small data sections together, so single-instruction offsets
    5.87 -     can access them all, and initialized data all before uninitialized, so
    5.88 -     we can shorten the on-disk segment size.  */
    5.89 -  .sdata     : { *(.sdata) }
    5.90 -  _edata  =  .;
    5.91 -  PROVIDE (edata = .);
    5.92 -  __bss_start = .;
    5.93 -  .sbss      : { *(.sbss) *(.scommon) }
    5.94 -  .bss       :
    5.95 -  {
    5.96 -   *(.dynbss)
    5.97 -   *(.bss)
    5.98 -   *(COMMON)
    5.99 -  }
   5.100 -  . = ALIGN(32 / 8);
   5.101 -  _end = . ;
   5.102 -  PROVIDE (end = .);
   5.103 -  /* Stabs debugging sections.  */
   5.104 -  .stab 0 : { *(.stab) }
   5.105 -  .stabstr 0 : { *(.stabstr) }
   5.106 -  .stab.excl 0 : { *(.stab.excl) }
   5.107 -  .stab.exclstr 0 : { *(.stab.exclstr) }
   5.108 -  .stab.index 0 : { *(.stab.index) }
   5.109 -  .stab.indexstr 0 : { *(.stab.indexstr) }
   5.110 -  .comment 0 : { *(.comment) }
   5.111 -  /* DWARF debug sections.
   5.112 -     Symbols in the DWARF debugging sections are relative to the beginning
   5.113 -     of the section so we begin them at 0.  */
   5.114 -  /* DWARF 1 */
   5.115 -  .debug          0 : { *(.debug) }
   5.116 -  .line           0 : { *(.line) }
   5.117 -  /* GNU DWARF 1 extensions */
   5.118 -  .debug_srcinfo  0 : { *(.debug_srcinfo) }
   5.119 -  .debug_sfnames  0 : { *(.debug_sfnames) }
   5.120 -  /* DWARF 1.1 and DWARF 2 */
   5.121 -  .debug_aranges  0 : { *(.debug_aranges) }
   5.122 -  .debug_pubnames 0 : { *(.debug_pubnames) }
   5.123 -  /* DWARF 2 */
   5.124 -  .debug_info     0 : { *(.debug_info) }
   5.125 -  .debug_abbrev   0 : { *(.debug_abbrev) }
   5.126 -  .debug_line     0 : { *(.debug_line) }
   5.127 -  .debug_frame    0 : { *(.debug_frame) }
   5.128 -  .debug_str      0 : { *(.debug_str) }
   5.129 -  .debug_loc      0 : { *(.debug_loc) }
   5.130 -  .debug_macinfo  0 : { *(.debug_macinfo) }
   5.131 -  /* SGI/MIPS DWARF 2 extensions */
   5.132 -  .debug_weaknames 0 : { *(.debug_weaknames) }
   5.133 -  .debug_funcnames 0 : { *(.debug_funcnames) }
   5.134 -  .debug_typenames 0 : { *(.debug_typenames) }
   5.135 -  .debug_varnames  0 : { *(.debug_varnames) }
   5.136 -  /* These must appear regardless of  .  */
   5.137 -}
     6.1 --- a/freebsd-5.3-xen-sparse/conf/options.i386-xen	Sun Dec 04 18:24:24 2005 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,162 +0,0 @@
     6.4 -# $FreeBSD: src/sys/conf/options.i386,v 1.204 2003/12/03 23:06:30 imp Exp $
     6.5 -# Options specific to the i386 platform kernels
     6.6 -
     6.7 -AUTO_EOI_1		opt_auto_eoi.h
     6.8 -AUTO_EOI_2		opt_auto_eoi.h
     6.9 -BROKEN_KEYBOARD_RESET	opt_reset.h
    6.10 -COMPAT_OLDISA
    6.11 -I586_PMC_GUPROF		opt_i586_guprof.h
    6.12 -MAXMEM
    6.13 -MPTABLE_FORCE_HTT
    6.14 -NO_MIXED_MODE
    6.15 -PERFMON
    6.16 -DISABLE_PSE		opt_pmap.h
    6.17 -DISABLE_PG_G		opt_pmap.h
    6.18 -PMAP_SHPGPERPROC	opt_pmap.h
    6.19 -PPC_PROBE_CHIPSET	opt_ppc.h
    6.20 -PPC_DEBUG		opt_ppc.h
    6.21 -POWERFAIL_NMI		opt_trap.h
    6.22 -MP_WATCHDOG             opt_mp_watchdog.h
    6.23 -
    6.24 -
    6.25 -
    6.26 -# Options for emulators.  These should only be used at config time, so
    6.27 -# they are handled like options for static filesystems
    6.28 -# (see src/sys/conf/options), except for broken debugging options.
    6.29 -COMPAT_AOUT		opt_dontuse.h
    6.30 -IBCS2			opt_dontuse.h
    6.31 -COMPAT_LINUX		opt_dontuse.h
    6.32 -COMPAT_SVR4		opt_dontuse.h
    6.33 -DEBUG_SVR4		opt_svr4.h
    6.34 -PECOFF_SUPPORT		opt_dontuse.h
    6.35 -PECOFF_DEBUG		opt_pecoff.h
    6.36 -
    6.37 -# Change KVM size.  Changes things all over the kernel.
    6.38 -KVA_PAGES		opt_global.h
    6.39 -XEN			opt_global.h
    6.40 -XENDEV			opt_xen.h
    6.41 -NOXENDEBUG		opt_xen.h
    6.42 -# Physical address extensions and support for >4G ram.  As above.
    6.43 -PAE			opt_global.h
    6.44 -
    6.45 -CLK_CALIBRATION_LOOP		opt_clock.h
    6.46 -CLK_USE_I8254_CALIBRATION	opt_clock.h
    6.47 -CLK_USE_TSC_CALIBRATION		opt_clock.h
    6.48 -TIMER_FREQ			opt_clock.h
    6.49 -
    6.50 -CPU_ATHLON_SSE_HACK		opt_cpu.h
    6.51 -CPU_BLUELIGHTNING_3X		opt_cpu.h
    6.52 -CPU_BLUELIGHTNING_FPU_OP_CACHE	opt_cpu.h
    6.53 -CPU_BTB_EN			opt_cpu.h
    6.54 -CPU_CYRIX_NO_LOCK		opt_cpu.h
    6.55 -CPU_DIRECT_MAPPED_CACHE		opt_cpu.h
    6.56 -CPU_DISABLE_5X86_LSSER		opt_cpu.h
    6.57 -CPU_DISABLE_CMPXCHG		opt_global.h	# XXX global, unlike other CPU_*
    6.58 -CPU_DISABLE_SSE			opt_cpu.h
    6.59 -CPU_ELAN			opt_cpu.h
    6.60 -CPU_ELAN_XTAL			opt_cpu.h
    6.61 -CPU_ELAN_PPS			opt_cpu.h
    6.62 -CPU_ENABLE_SSE			opt_cpu.h
    6.63 -CPU_FASTER_5X86_FPU		opt_cpu.h
    6.64 -CPU_GEODE			opt_cpu.h
    6.65 -CPU_I486_ON_386			opt_cpu.h
    6.66 -CPU_IORT			opt_cpu.h
    6.67 -CPU_L2_LATENCY			opt_cpu.h
    6.68 -CPU_LOOP_EN			opt_cpu.h
    6.69 -CPU_PPRO2CELERON		opt_cpu.h
    6.70 -CPU_RSTK_EN			opt_cpu.h
    6.71 -CPU_SOEKRIS			opt_cpu.h
    6.72 -CPU_SUSP_HLT			opt_cpu.h
    6.73 -CPU_UPGRADE_HW_CACHE		opt_cpu.h
    6.74 -CPU_WT_ALLOC			opt_cpu.h
    6.75 -CYRIX_CACHE_REALLY_WORKS	opt_cpu.h
    6.76 -CYRIX_CACHE_WORKS		opt_cpu.h
    6.77 -NO_F00F_HACK			opt_cpu.h
    6.78 -NO_MEMORY_HOLE			opt_cpu.h
    6.79 -
    6.80 -# The CPU type affects the endian conversion functions all over the kernel.
    6.81 -I386_CPU		opt_global.h
    6.82 -I486_CPU		opt_global.h
    6.83 -I586_CPU		opt_global.h
    6.84 -I686_CPU		opt_global.h
    6.85 -
    6.86 -VGA_ALT_SEQACCESS	opt_vga.h
    6.87 -VGA_DEBUG		opt_vga.h
    6.88 -VGA_NO_FONT_LOADING	opt_vga.h
    6.89 -VGA_NO_MODE_CHANGE	opt_vga.h
    6.90 -VGA_SLOW_IOACCESS	opt_vga.h
    6.91 -VGA_WIDTH90		opt_vga.h
    6.92 -
    6.93 -VESA
    6.94 -VESA_DEBUG		opt_vesa.h
    6.95 -
    6.96 -PSM_HOOKRESUME		opt_psm.h
    6.97 -PSM_RESETAFTERSUSPEND	opt_psm.h
    6.98 -PSM_DEBUG		opt_psm.h
    6.99 -
   6.100 -ATKBD_DFLT_KEYMAP	opt_atkbd.h
   6.101 -
   6.102 -# pcvt(4) has a bunch of options
   6.103 -FAT_CURSOR		opt_pcvt.h
   6.104 -XSERVER			opt_pcvt.h
   6.105 -PCVT_24LINESDEF		opt_pcvt.h
   6.106 -PCVT_CTRL_ALT_DEL	opt_pcvt.h
   6.107 -PCVT_META_ESC		opt_pcvt.h
   6.108 -PCVT_NSCREENS		opt_pcvt.h
   6.109 -PCVT_PRETTYSCRNS	opt_pcvt.h
   6.110 -PCVT_SCANSET		opt_pcvt.h
   6.111 -PCVT_SCREENSAVER	opt_pcvt.h
   6.112 -PCVT_USEKBDSEC		opt_pcvt.h
   6.113 -PCVT_VT220KEYB		opt_pcvt.h
   6.114 -PCVT_GREENSAVER		opt_pcvt.h
   6.115 -
   6.116 -# Video spigot
   6.117 -SPIGOT_UNSECURE		opt_spigot.h
   6.118 -
   6.119 -# Enables NETGRAPH support for Cronyx adapters
   6.120 -NETGRAPH_CRONYX		opt_ng_cronyx.h
   6.121 -
   6.122 -# -------------------------------
   6.123 -# isdn4bsd: passive ISA cards
   6.124 -# -------------------------------
   6.125 -TEL_S0_8		opt_i4b.h
   6.126 -TEL_S0_16		opt_i4b.h
   6.127 -TEL_S0_16_3		opt_i4b.h
   6.128 -AVM_A1			opt_i4b.h
   6.129 -USR_STI			opt_i4b.h
   6.130 -ITKIX1			opt_i4b.h
   6.131 -ELSA_PCC16		opt_i4b.h
   6.132 -# -------------------------------
   6.133 -# isdn4bsd: passive ISA PnP cards
   6.134 -# -------------------------------
   6.135 -CRTX_S0_P		opt_i4b.h
   6.136 -DRN_NGO                 opt_i4b.h
   6.137 -TEL_S0_16_3_P		opt_i4b.h
   6.138 -SEDLBAUER		opt_i4b.h
   6.139 -DYNALINK		opt_i4b.h
   6.140 -ASUSCOM_IPAC		opt_i4b.h
   6.141 -ELSA_QS1ISA		opt_i4b.h
   6.142 -SIEMENS_ISURF2		opt_i4b.h
   6.143 -EICON_DIVA		opt_i4b.h
   6.144 -COMPAQ_M610		opt_i4b.h
   6.145 -# -------------------------------
   6.146 -# isdn4bsd: passive PCI cards
   6.147 -# -------------------------------
   6.148 -ELSA_QS1PCI		opt_i4b.h
   6.149 -# -------------------------------
   6.150 -# isdn4bsd: misc options
   6.151 -# -------------------------------
   6.152 -# temporary workaround for SMP machines
   6.153 -I4B_SMP_WORKAROUND      opt_i4b.h
   6.154 -# enable VJ compression code for ipr i/f
   6.155 -IPR_VJ			opt_i4b.h
   6.156 -IPR_LOG			opt_i4b.h
   6.157 -
   6.158 -# Device options
   6.159 -DEV_ACPI		opt_acpi.h
   6.160 -DEV_APIC		opt_apic.h
   6.161 -DEV_NPX			opt_npx.h
   6.162 -
   6.163 -# -------------------------------
   6.164 -# EOF
   6.165 -# -------------------------------
     7.1 --- a/freebsd-5.3-xen-sparse/fbsdxensetup	Sun Dec 04 18:24:24 2005 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,44 +0,0 @@
     7.4 -#!/bin/csh -f
     7.5 -
     7.6 -setenv XENROOT `pwd`
     7.7 -cd $XENROOT
     7.8 -if ( ! -d freebsd-5.3-xen-sparse ) then
     7.9 -  echo "Please run this script from the root of the Xen source tree"
    7.10 -  exit 1
    7.11 -endif
    7.12 -rm -rf $XENROOT/fbsdtmp $XENROOT/freebsd-5.3-xenU
    7.13 -mkdir -p $XENROOT/fbsdtmp
    7.14 -cd $XENROOT/fbsdtmp
    7.15 -echo "step 1"
    7.16 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.aa
    7.17 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.ab
    7.18 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.ac
    7.19 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.ad
    7.20 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.ae
    7.21 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.af
    7.22 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.ag
    7.23 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.ah
    7.24 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.ai
    7.25 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.aj
    7.26 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.ak
    7.27 -wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/src/ssys.al
    7.28 -mkdir -p foo
    7.29 -cat ssys.?? | tar --unlink -xpzf - -C foo/
    7.30 -mkdir -p $XENROOT/freebsd-5.3-xenU
    7.31 -mv foo/sys/* $XENROOT/freebsd-5.3-xenU
    7.32 -cd $XENROOT
    7.33 -rm -rf $XENROOT/fbsdtmp
    7.34 -echo "step 2"
    7.35 -mkdir -p $XENROOT/freebsd-5.3-xenU/i386-xen/include
    7.36 -cd $XENROOT/freebsd-5.3-xenU/i386-xen/include/
    7.37 -foreach file (../../i386/include/*)
    7.38 -	ln -s $file
    7.39 -end 
    7.40 -echo "step 3"
    7.41 -cd $XENROOT/freebsd-5.3-xen-sparse
    7.42 -echo "step 4"
    7.43 -./mkbuildtree ../freebsd-5.3-xenU
    7.44 -echo "step 5"
    7.45 -cd $XENROOT/freebsd-5.3-xenU/i386-xen/include
    7.46 -ln -s $XENROOT/xen/include/public xen-public
    7.47 -echo "done"
     8.1 --- a/freebsd-5.3-xen-sparse/i386-xen/Makefile	Sun Dec 04 18:24:24 2005 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,40 +0,0 @@
     8.4 -# $FreeBSD: src/sys/i386/Makefile,v 1.11 2002/06/21 06:18:02 mckusick Exp $
     8.5 -#	@(#)Makefile	8.1 (Berkeley) 6/11/93
     8.6 -
     8.7 -# Makefile for i386 links, tags file
     8.8 -
     8.9 -# SYS is normally set in Make.tags.inc
    8.10 -# SYS=/sys
    8.11 -SYS=/nsys
    8.12 -
    8.13 -TAGDIR=	i386
    8.14 -
    8.15 -.include "../kern/Make.tags.inc"
    8.16 -
    8.17 -all:
    8.18 -	@echo "make links or tags only"
    8.19 -
    8.20 -# Directories in which to place i386 tags links
    8.21 -DI386=	apm i386 ibcs2 include isa linux
    8.22 -
    8.23 -links::
    8.24 -	-for i in ${COMMDIR1}; do \
    8.25 -	    (cd $$i && { rm -f tags; ln -s ../${TAGDIR}/tags tags; }) done
    8.26 -	-for i in ${COMMDIR2}; do \
    8.27 -	    (cd $$i && { rm -f tags; ln -s ../../${TAGDIR}/tags tags; }) done
    8.28 -	-for i in ${DI386}; do \
    8.29 -	    (cd $$i && { rm -f tags; ln -s ../tags tags; }) done
    8.30 -
    8.31 -SI386=	${SYS}/i386/apm/*.[ch] \
    8.32 -	${SYS}/i386/i386/*.[ch] ${SYS}/i386/ibcs2/*.[ch] \
    8.33 -	${SYS}/i386/include/*.[ch] ${SYS}/i386/isa/*.[ch] \
    8.34 -	${SYS}/i386/linux/*.[ch]
    8.35 -AI386=	${SYS}/i386/i386/*.s
    8.36 -
    8.37 -tags::
    8.38 -	-ctags -wdt ${COMM} ${SI386}
    8.39 -	egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AI386} | \
    8.40 -	    sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
    8.41 -		>> tags
    8.42 -	sort -o tags tags
    8.43 -	chmod 444 tags
     9.1 --- a/freebsd-5.3-xen-sparse/i386-xen/conf/GENERIC	Sun Dec 04 18:24:24 2005 +0100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,273 +0,0 @@
     9.4 -#
     9.5 -# GENERIC -- Generic kernel configuration file for FreeBSD/i386
     9.6 -#
     9.7 -# For more information on this file, please read the handbook section on
     9.8 -# Kernel Configuration Files:
     9.9 -#
    9.10 -#    http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
    9.11 -#
    9.12 -# The handbook is also available locally in /usr/share/doc/handbook
    9.13 -# if you've installed the doc distribution, otherwise always see the
    9.14 -# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
    9.15 -# latest information.
    9.16 -#
    9.17 -# An exhaustive list of options and more detailed explanations of the
    9.18 -# device lines is also present in the ../../conf/NOTES and NOTES files. 
    9.19 -# If you are in doubt as to the purpose or necessity of a line, check first 
    9.20 -# in NOTES.
    9.21 -#
    9.22 -# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.394.2.3 2004/01/26 19:42:11 nectar Exp $
    9.23 -
    9.24 -machine		i386
    9.25 -cpu		I486_CPU
    9.26 -cpu		I586_CPU
    9.27 -cpu		I686_CPU
    9.28 -ident		GENERIC
    9.29 -
    9.30 -#To statically compile in device wiring instead of /boot/device.hints
    9.31 -#hints		"GENERIC.hints"		#Default places to look for devices.
    9.32 -
    9.33 -#makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
    9.34 -
    9.35 -options 	SCHED_4BSD		#4BSD scheduler
    9.36 -options 	INET			#InterNETworking
    9.37 -options 	INET6			#IPv6 communications protocols
    9.38 -options 	FFS			#Berkeley Fast Filesystem
    9.39 -options 	SOFTUPDATES		#Enable FFS soft updates support
    9.40 -options 	UFS_ACL			#Support for access control lists
    9.41 -options 	UFS_DIRHASH		#Improve performance on big directories
    9.42 -options 	MD_ROOT			#MD is a potential root device
    9.43 -options 	NFSCLIENT		#Network Filesystem Client
    9.44 -options 	NFSSERVER		#Network Filesystem Server
    9.45 -options 	NFS_ROOT		#NFS usable as /, requires NFSCLIENT
    9.46 -options 	MSDOSFS			#MSDOS Filesystem
    9.47 -options 	CD9660			#ISO 9660 Filesystem
    9.48 -options 	PROCFS			#Process filesystem (requires PSEUDOFS)
    9.49 -options 	PSEUDOFS		#Pseudo-filesystem framework
    9.50 -options 	COMPAT_43		#Compatible with BSD 4.3 [KEEP THIS!]
    9.51 -options 	COMPAT_FREEBSD4		#Compatible with FreeBSD4
    9.52 -options 	SCSI_DELAY=15000	#Delay (in ms) before probing SCSI
    9.53 -options 	KTRACE			#ktrace(1) support
    9.54 -options 	SYSVSHM			#SYSV-style shared memory
    9.55 -options 	SYSVMSG			#SYSV-style message queues
    9.56 -options 	SYSVSEM			#SYSV-style semaphores
    9.57 -options 	_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
    9.58 -options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
    9.59 -options 	AHC_REG_PRETTY_PRINT	# Print register bitfields in debug
    9.60 -					# output.  Adds ~128k to driver.
    9.61 -options 	AHD_REG_PRETTY_PRINT	# Print register bitfields in debug
    9.62 -					# output.  Adds ~215k to driver.
    9.63 -options 	PFIL_HOOKS		# pfil(9) framework
    9.64 -
    9.65 -# Debugging for use in -current
    9.66 -#options 	DDB			#Enable the kernel debugger
    9.67 -#options 	INVARIANTS		#Enable calls of extra sanity checking
    9.68 -options 	INVARIANT_SUPPORT	#Extra sanity checks of internal structures, required by INVARIANTS
    9.69 -#options 	WITNESS			#Enable checks to detect deadlocks and cycles
    9.70 -#options 	WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
    9.71 -
    9.72 -# To make an SMP kernel, the next two are needed
    9.73 -options 	SMP			# Symmetric MultiProcessor Kernel
    9.74 -device		apic			# I/O APIC
    9.75 -
    9.76 -device		isa
    9.77 -device		eisa
    9.78 -device		pci
    9.79 -
    9.80 -# Floppy drives
    9.81 -device		fdc
    9.82 -
    9.83 -# ATA and ATAPI devices
    9.84 -device		ata
    9.85 -device		atadisk			# ATA disk drives
    9.86 -device		ataraid			# ATA RAID drives
    9.87 -device		atapicd			# ATAPI CDROM drives
    9.88 -device		atapifd			# ATAPI floppy drives
    9.89 -device		atapist			# ATAPI tape drives
    9.90 -options 	ATA_STATIC_ID		#Static device numbering
    9.91 -
    9.92 -# SCSI Controllers
    9.93 -device		ahb		# EISA AHA1742 family
    9.94 -device		ahc		# AHA2940 and onboard AIC7xxx devices
    9.95 -device		ahd		# AHA39320/29320 and onboard AIC79xx devices
    9.96 -device		amd		# AMD 53C974 (Tekram DC-390(T))
    9.97 -device		isp		# Qlogic family
    9.98 -device		mpt		# LSI-Logic MPT-Fusion
    9.99 -#device		ncr		# NCR/Symbios Logic
   9.100 -device		sym		# NCR/Symbios Logic (newer chipsets + those of `ncr')
   9.101 -device		trm		# Tekram DC395U/UW/F DC315U adapters
   9.102 -
   9.103 -device		adv		# Advansys SCSI adapters
   9.104 -device		adw		# Advansys wide SCSI adapters
   9.105 -device		aha		# Adaptec 154x SCSI adapters
   9.106 -device		aic		# Adaptec 15[012]x SCSI adapters, AIC-6[23]60.
   9.107 -device		bt		# Buslogic/Mylex MultiMaster SCSI adapters
   9.108 -
   9.109 -device		ncv		# NCR 53C500
   9.110 -device		nsp		# Workbit Ninja SCSI-3
   9.111 -device		stg		# TMC 18C30/18C50
   9.112 -
   9.113 -# SCSI peripherals
   9.114 -device		scbus		# SCSI bus (required for SCSI)
   9.115 -device		ch		# SCSI media changers
   9.116 -device		da		# Direct Access (disks)
   9.117 -device		sa		# Sequential Access (tape etc)
   9.118 -device		cd		# CD
   9.119 -device		pass		# Passthrough device (direct SCSI access)
   9.120 -device		ses		# SCSI Environmental Services (and SAF-TE)
   9.121 -
   9.122 -# RAID controllers interfaced to the SCSI subsystem
   9.123 -device		amr		# AMI MegaRAID
   9.124 -device		asr		# DPT SmartRAID V, VI and Adaptec SCSI RAID
   9.125 -device		ciss		# Compaq Smart RAID 5*
   9.126 -device		dpt		# DPT Smartcache III, IV - See NOTES for options
   9.127 -device		iir		# Intel Integrated RAID
   9.128 -device		ips		# IBM (Adaptec) ServeRAID
   9.129 -device		mly		# Mylex AcceleRAID/eXtremeRAID
   9.130 -
   9.131 -# RAID controllers
   9.132 -device		aac		# Adaptec FSA RAID
   9.133 -device		aacp		# SCSI passthrough for aac (requires CAM)
   9.134 -device		ida		# Compaq Smart RAID
   9.135 -device		mlx		# Mylex DAC960 family
   9.136 -device		pst		# Promise Supertrak SX6000
   9.137 -device		twe		# 3ware ATA RAID
   9.138 -
   9.139 -# atkbdc0 controls both the keyboard and the PS/2 mouse
   9.140 -device		atkbdc		# AT keyboard controller
   9.141 -device		atkbd		# AT keyboard
   9.142 -device		psm		# PS/2 mouse
   9.143 -
   9.144 -device		vga		# VGA video card driver
   9.145 -
   9.146 -device		splash		# Splash screen and screen saver support
   9.147 -
   9.148 -# syscons is the default console driver, resembling an SCO console
   9.149 -device		sc
   9.150 -
   9.151 -# Enable this for the pcvt (VT220 compatible) console driver
   9.152 -#device		vt
   9.153 -#options 	XSERVER			# support for X server on a vt console
   9.154 -#options 	FAT_CURSOR		# start with block cursor
   9.155 -
   9.156 -device		agp		# support several AGP chipsets
   9.157 -
   9.158 -# Floating point support - do not disable.
   9.159 -device		npx
   9.160 -
   9.161 -# Power management support (see NOTES for more options)
   9.162 -#device		apm
   9.163 -# Add suspend/resume support for the i8254.
   9.164 -device		pmtimer
   9.165 -
   9.166 -# PCCARD (PCMCIA) support
   9.167 -# Pcmcia and cardbus bridge support
   9.168 -device		cbb			# cardbus (yenta) bridge
   9.169 -#device		pcic			# ExCA ISA and PCI bridges
   9.170 -device		pccard			# PC Card (16-bit) bus
   9.171 -device		cardbus			# CardBus (32-bit) bus
   9.172 -
   9.173 -# Serial (COM) ports
   9.174 -device		sio		# 8250, 16[45]50 based serial ports
   9.175 -
   9.176 -# Parallel port
   9.177 -device		ppc
   9.178 -device		ppbus		# Parallel port bus (required)
   9.179 -device		lpt		# Printer
   9.180 -device		plip		# TCP/IP over parallel
   9.181 -device		ppi		# Parallel port interface device
   9.182 -#device		vpo		# Requires scbus and da
   9.183 -
   9.184 -# If you've got a "dumb" serial or parallel PCI card that is
   9.185 -# supported by the puc(4) glue driver, uncomment the following
   9.186 -# line to enable it (connects to the sio and/or ppc drivers):
   9.187 -#device         puc
   9.188 -
   9.189 -# PCI Ethernet NICs.
   9.190 -device		de		# DEC/Intel DC21x4x (``Tulip'')
   9.191 -device		em		# Intel PRO/1000 adapter Gigabit Ethernet Card
   9.192 -device		txp		# 3Com 3cR990 (``Typhoon'')
   9.193 -device		vx		# 3Com 3c590, 3c595 (``Vortex'')
   9.194 -
   9.195 -# PCI Ethernet NICs that use the common MII bus controller code.
   9.196 -# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
   9.197 -device		miibus		# MII bus support
   9.198 -device		bfe		# Broadcom BCM440x 10/100 ethernet
   9.199 -device		bge		# Broadcom BCM570xx Gigabit Ethernet
   9.200 -device		dc		# DEC/Intel 21143 and various workalikes
   9.201 -device		fxp		# Intel EtherExpress PRO/100B (82557, 82558)
   9.202 -device		pcn		# AMD Am79C97x PCI 10/100 (precedence over 'lnc')
   9.203 -device		re		# RealTek 8139C+/8169/8169S/8110S
   9.204 -device		rl		# RealTek 8129/8139
   9.205 -device		sf		# Adaptec AIC-6915 (``Starfire'')
   9.206 -device		sis		# Silicon Integrated Systems SiS 900/SiS 7016
   9.207 -device		sk		# SysKonnect SK-984x and SK-982x gigabit ethernet
   9.208 -device		ste		# Sundance ST201 (D-Link DFE-550TX)
   9.209 -device		ti		# Alteon Networks Tigon I/II gigabit ethernet
   9.210 -device		tl		# Texas Instruments ThunderLAN
   9.211 -device		tx		# SMC EtherPower II (83c170 ``EPIC'')
   9.212 -device		vr		# VIA Rhine, Rhine II
   9.213 -device		wb		# Winbond W89C840F
   9.214 -device		xl		# 3Com 3c90x (``Boomerang'', ``Cyclone'')
   9.215 -
   9.216 -# ISA Ethernet NICs.  pccard nics included.
   9.217 -device		cs		# Crystal Semiconductor CS89x0 NIC
   9.218 -# 'device ed' requires 'device miibus'
   9.219 -device		ed		# NE[12]000, SMC Ultra, 3c503, DS8390 cards
   9.220 -device		ex		# Intel EtherExpress Pro/10 and Pro/10+
   9.221 -device		ep		# Etherlink III based cards
   9.222 -device		fe		# Fujitsu MB8696x based cards
   9.223 -device		ie		# EtherExpress 8/16, 3C507, StarLAN 10 etc.
   9.224 -device		lnc		# NE2100, NE32-VL Lance Ethernet cards
   9.225 -device		sn		# SMC's 9000 series of ethernet chips
   9.226 -device		xe		# Xircom pccard ethernet
   9.227 -
   9.228 -# ISA devices that use the old ISA shims
   9.229 -#device		le
   9.230 -
   9.231 -# Wireless NIC cards
   9.232 -device		wlan		# 802.11 support
   9.233 -device		an		# Aironet 4500/4800 802.11 wireless NICs. 
   9.234 -device		awi		# BayStack 660 and others
   9.235 -device		wi		# WaveLAN/Intersil/Symbol 802.11 wireless NICs.
   9.236 -#device		wl		# Older non 802.11 Wavelan wireless NIC.
   9.237 -
   9.238 -# Pseudo devices - the number indicates how many units to allocate.
   9.239 -device		random		# Entropy device
   9.240 -device		loop		# Network loopback
   9.241 -device		ether		# Ethernet support
   9.242 -device		sl		# Kernel SLIP
   9.243 -device		ppp		# Kernel PPP
   9.244 -device		tun		# Packet tunnel.
   9.245 -device		pty		# Pseudo-ttys (telnet etc)
   9.246 -device		md		# Memory "disks"
   9.247 -device		gif		# IPv6 and IPv4 tunneling
   9.248 -device		faith		# IPv6-to-IPv4 relaying (translation)
   9.249 -
   9.250 -# The `bpf' device enables the Berkeley Packet Filter.
   9.251 -# Be aware of the administrative consequences of enabling this!
   9.252 -device		bpf		# Berkeley packet filter
   9.253 -
   9.254 -# USB support
   9.255 -device		uhci		# UHCI PCI->USB interface
   9.256 -device		ohci		# OHCI PCI->USB interface
   9.257 -device		usb		# USB Bus (required)
   9.258 -#device		udbp		# USB Double Bulk Pipe devices
   9.259 -device		ugen		# Generic
   9.260 -device		uhid		# "Human Interface Devices"
   9.261 -device		ukbd		# Keyboard
   9.262 -device		ulpt		# Printer
   9.263 -device		umass		# Disks/Mass storage - Requires scbus and da
   9.264 -device		ums		# Mouse
   9.265 -device		urio		# Diamond Rio 500 MP3 player
   9.266 -device		uscanner	# Scanners
   9.267 -# USB Ethernet, requires mii
   9.268 -device		aue		# ADMtek USB ethernet
   9.269 -device		axe		# ASIX Electronics USB ethernet
   9.270 -device		cue		# CATC USB ethernet
   9.271 -device		kue		# Kawasaki LSI USB ethernet
   9.272 -
   9.273 -# FireWire support
   9.274 -device		firewire	# FireWire bus code
   9.275 -device		sbp		# SCSI over FireWire (Requires scbus and da)
   9.276 -device		fwe		# Ethernet over FireWire (non-standard!)
    10.1 --- a/freebsd-5.3-xen-sparse/i386-xen/conf/GENERIC.hints	Sun Dec 04 18:24:24 2005 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,93 +0,0 @@
    10.4 -# $FreeBSD: src/sys/i386/conf/GENERIC.hints,v 1.11 2002/12/05 22:49:47 jhb Exp $
    10.5 -hint.fdc.0.at="isa"
    10.6 -hint.fdc.0.port="0x3F0"
    10.7 -hint.fdc.0.irq="6"
    10.8 -hint.fdc.0.drq="2"
    10.9 -hint.fd.0.at="fdc0"
   10.10 -hint.fd.0.drive="0"
   10.11 -hint.fd.1.at="fdc0"
   10.12 -hint.fd.1.drive="1"
   10.13 -hint.ata.0.at="isa"
   10.14 -hint.ata.0.port="0x1F0"
   10.15 -hint.ata.0.irq="14"
   10.16 -hint.ata.1.at="isa"
   10.17 -hint.ata.1.port="0x170"
   10.18 -hint.ata.1.irq="15"
   10.19 -hint.adv.0.at="isa"
   10.20 -hint.adv.0.disabled="1"
   10.21 -hint.bt.0.at="isa"
   10.22 -hint.bt.0.disabled="1"
   10.23 -hint.aha.0.at="isa"
   10.24 -hint.aha.0.disabled="1"
   10.25 -hint.aic.0.at="isa"
   10.26 -hint.aic.0.disabled="1"
   10.27 -hint.atkbdc.0.at="isa"
   10.28 -hint.atkbdc.0.port="0x060"
   10.29 -hint.atkbd.0.at="atkbdc"
   10.30 -hint.atkbd.0.irq="1"
   10.31 -hint.atkbd.0.flags="0x1"
   10.32 -hint.psm.0.at="atkbdc"
   10.33 -hint.psm.0.irq="12"
   10.34 -hint.vga.0.at="isa"
   10.35 -hint.sc.0.at="isa"
   10.36 -hint.sc.0.flags="0x100"
   10.37 -hint.vt.0.at="isa"
   10.38 -hint.vt.0.disabled="1"
   10.39 -hint.apm.0.disabled="1"
   10.40 -hint.apm.0.flags="0x20"
   10.41 -hint.pcic.0.at="isa"
   10.42 -# hint.pcic.0.irq="10"	# Default to polling
   10.43 -hint.pcic.0.port="0x3e0"
   10.44 -hint.pcic.0.maddr="0xd0000"
   10.45 -hint.pcic.1.at="isa"
   10.46 -hint.pcic.1.irq="11"
   10.47 -hint.pcic.1.port="0x3e2"
   10.48 -hint.pcic.1.maddr="0xd4000"
   10.49 -hint.pcic.1.disabled="1"
   10.50 -hint.sio.0.at="isa"
   10.51 -hint.sio.0.port="0x3F8"
   10.52 -hint.sio.0.flags="0x10"
   10.53 -hint.sio.0.irq="4"
   10.54 -hint.sio.1.at="isa"
   10.55 -hint.sio.1.port="0x2F8"
   10.56 -hint.sio.1.irq="3"
   10.57 -hint.sio.2.at="isa"
   10.58 -hint.sio.2.disabled="1"
   10.59 -hint.sio.2.port="0x3E8"
   10.60 -hint.sio.2.irq="5"
   10.61 -hint.sio.3.at="isa"
   10.62 -hint.sio.3.disabled="1"
   10.63 -hint.sio.3.port="0x2E8"
   10.64 -hint.sio.3.irq="9"
   10.65 -hint.ppc.0.at="isa"
   10.66 -hint.ppc.0.irq="7"
   10.67 -hint.ed.0.at="isa"
   10.68 -hint.ed.0.disabled="1"
   10.69 -hint.ed.0.port="0x280"
   10.70 -hint.ed.0.irq="10"
   10.71 -hint.ed.0.maddr="0xd8000"
   10.72 -hint.cs.0.at="isa"
   10.73 -hint.cs.0.disabled="1"
   10.74 -hint.cs.0.port="0x300"
   10.75 -hint.sn.0.at="isa"
   10.76 -hint.sn.0.disabled="1"
   10.77 -hint.sn.0.port="0x300"
   10.78 -hint.sn.0.irq="10"
   10.79 -hint.ie.0.at="isa"
   10.80 -hint.ie.0.disabled="1"
   10.81 -hint.ie.0.port="0x300"
   10.82 -hint.ie.0.irq="10"
   10.83 -hint.ie.0.maddr="0xd0000"
   10.84 -hint.fe.0.at="isa"
   10.85 -hint.fe.0.disabled="1"
   10.86 -hint.fe.0.port="0x300"
   10.87 -hint.le.0.at="isa"
   10.88 -hint.le.0.disabled="1"
   10.89 -hint.le.0.port="0x300"
   10.90 -hint.le.0.irq="5"
   10.91 -hint.le.0.maddr="0xd0000"
   10.92 -hint.lnc.0.at="isa"
   10.93 -hint.lnc.0.disabled="1"
   10.94 -hint.lnc.0.port="0x280"
   10.95 -hint.lnc.0.irq="10"
   10.96 -hint.lnc.0.drq="0"
    11.1 --- a/freebsd-5.3-xen-sparse/i386-xen/conf/Makefile	Sun Dec 04 18:24:24 2005 +0100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,3 +0,0 @@
    11.4 -# $FreeBSD: src/sys/i386/conf/Makefile,v 1.9 2003/02/26 23:36:58 ru Exp $
    11.5 -
    11.6 -.include "${.CURDIR}/../../conf/makeLINT.mk"
    12.1 --- a/freebsd-5.3-xen-sparse/i386-xen/conf/NOTES	Sun Dec 04 18:24:24 2005 +0100
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,1115 +0,0 @@
    12.4 -#
    12.5 -# NOTES -- Lines that can be cut/pasted into kernel and hints configs.
    12.6 -#
    12.7 -# This file contains machine dependent kernel configuration notes.  For
    12.8 -# machine independent notes, look in /sys/conf/NOTES.
    12.9 -#
   12.10 -# $FreeBSD: src/sys/i386/conf/NOTES,v 1.1108 2003/12/04 19:57:56 phk Exp $
   12.11 -#
   12.12 -
   12.13 -#
   12.14 -# This directive is mandatory; it defines the architecture to be
   12.15 -# configured for; in this case, the 386 family based IBM-PC and
   12.16 -# compatibles.
   12.17 -#
   12.18 -machine		i386
   12.19 -
   12.20 -# 
   12.21 -# We want LINT to cover profiling as well
   12.22 -profile         2
   12.23 -
   12.24 -
   12.25 -#####################################################################
   12.26 -# SMP OPTIONS:
   12.27 -#
   12.28 -# The apic device enables the use of the I/O APIC for interrupt delivery.
   12.29 -# The apic device can be used in both UP and SMP kernels, but is required
   12.30 -# for SMP kernels.  Thus, the apic device is not strictly an SMP option,
   12.31 -# but it is a prerequisite for SMP.
   12.32 -#
   12.33 -# Notes:
   12.34 -#
   12.35 -# Be sure to disable 'cpu I386_CPU' for SMP kernels.
   12.36 -#
   12.37 -# By default, mixed mode is used to route IRQ0 from the AT timer via
   12.38 -# the 8259A master PIC through the ExtINT pin on the first I/O APIC.
   12.39 -# This can be disabled via the NO_MIXED_MODE option.  In that case,
   12.40 -# IRQ0 will be routed via an intpin on the first I/O APIC.  Not all
   12.41 -# motherboards hook IRQ0 up to the first I/O APIC even though their
   12.42 -# MP table or MADT may claim to do so.  That is why mixed mode is
   12.43 -# enabled by default.
   12.44 -#
   12.45 -# HTT CPUs should only be used if they are enabled in the BIOS.  For
   12.46 -# the ACPI case, ACPI only correctly tells us about any HTT CPUs if
   12.47 -# they are enabled.  However, most HTT systems do not list HTT CPUs
   12.48 -# in the MP Table if they are enabled, thus we guess at the HTT CPUs
   12.49 -# for the MP Table case.  However, we shouldn't try to guess and use
   12.50 -# these CPUs if HTTT is disabled.  Thus, HTT guessing is only enabled
   12.51 -# for the MP Table if the user explicitly asks for it via the
   12.52 -# MPTABLE_FORCE_HTT option.  Do NOT use this option if you have HTT
   12.53 -# disabled in your BIOS.
   12.54 -#
   12.55 -
   12.56 -# Mandatory:
   12.57 -device		apic			# I/O apic
   12.58 -
   12.59 -# Optional:
   12.60 -options		MPTABLE_FORCE_HTT	# Enable HTT CPUs with the MP Table
   12.61 -options 	NO_MIXED_MODE		# Disable use of mixed mode
   12.62 -
   12.63 -
   12.64 -#####################################################################
   12.65 -# CPU OPTIONS
   12.66 -
   12.67 -#
   12.68 -# You must specify at least one CPU (the one you intend to run on);
   12.69 -# deleting the specification for CPUs you don't need to use may make
   12.70 -# parts of the system run faster.
   12.71 -# I386_CPU is mutually exclusive with the other CPU types.
   12.72 -#
   12.73 -#cpu		I386_CPU		
   12.74 -cpu		I486_CPU
   12.75 -cpu		I586_CPU		# aka Pentium(tm)
   12.76 -cpu		I686_CPU		# aka Pentium Pro(tm)
   12.77 -
   12.78 -#
   12.79 -# Options for CPU features.
   12.80 -#
   12.81 -# CPU_ATHLON_SSE_HACK tries to enable SSE instructions when the BIOS has
   12.82 -# forgotten to enable them.
   12.83 -#
   12.84 -# CPU_BLUELIGHTNING_FPU_OP_CACHE enables FPU operand cache on IBM
   12.85 -# BlueLightning CPU.  It works only with Cyrix FPU, and this option
   12.86 -# should not be used with Intel FPU.
   12.87 -#
   12.88 -# CPU_BLUELIGHTNING_3X enables triple-clock mode on IBM Blue Lightning
   12.89 -# CPU if CPU supports it. The default is double-clock mode on
   12.90 -# BlueLightning CPU box.
   12.91 -#
   12.92 -# CPU_BTB_EN enables branch target buffer on Cyrix 5x86 (NOTE 1).
   12.93 -#
   12.94 -# CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct
   12.95 -# mapped mode.  Default is 2-way set associative mode.
   12.96 -#
   12.97 -# CPU_CYRIX_NO_LOCK enables weak locking for the entire address space
   12.98 -# of Cyrix 6x86 and 6x86MX CPUs by setting the NO_LOCK bit of CCR1.
   12.99 -# Otherwise, the NO_LOCK bit of CCR1 is cleared.  (NOTE 3)
  12.100 -#
  12.101 -# CPU_DISABLE_5X86_LSSER disables load store serialize (i.e. enables
  12.102 -# reorder).  This option should not be used if you use memory mapped
  12.103 -# I/O device(s).
  12.104 -#
  12.105 -# CPU_ELAN enables support for AMDs ElanSC520 CPU.
  12.106 -#    CPU_ELAN_XTAL sets the clock crystal frequency in Hz
  12.107 -#    CPU_ELAN_PPS enables precision timestamp code.
  12.108 -#
  12.109 -# CPU_SOEKRIS enables support www.soekris.com hardware.
  12.110 -#
  12.111 -# CPU_ENABLE_SSE enables SSE/MMX2 instructions support.  This is default
  12.112 -# on I686_CPU and above.
  12.113 -# CPU_DISABLE_SSE explicitly prevent I686_CPU from turning on SSE.
  12.114 -#
  12.115 -# CPU_FASTER_5X86_FPU enables faster FPU exception handler.
  12.116 -#
  12.117 -# CPU_I486_ON_386 enables CPU cache on i486 based CPU upgrade products
  12.118 -# for i386 machines.
  12.119 -#
  12.120 -# CPU_IORT defines I/O clock delay time (NOTE 1).  Default values of
  12.121 -# I/O clock delay time on Cyrix 5x86 and 6x86 are 0 and 7,respectively
  12.122 -# (no clock delay).
  12.123 -#
  12.124 -# CPU_L2_LATENCY specifed the L2 cache latency value.  This option is used
  12.125 -# only when CPU_PPRO2CELERON is defined and Mendocino Celeron is detected.
  12.126 -# The default value is 5.
  12.127 -#
  12.128 -# CPU_LOOP_EN prevents flushing the prefetch buffer if the destination
  12.129 -# of a jump is already present in the prefetch buffer on Cyrix 5x86(NOTE
  12.130 -# 1).
  12.131 -#
  12.132 -# CPU_PPRO2CELERON enables L2 cache of Mendocino Celeron CPUs.  This option
  12.133 -# is useful when you use Socket 8 to Socket 370 converter, because most Pentium
  12.134 -# Pro BIOSs do not enable L2 cache of Mendocino Celeron CPUs.
  12.135 -#
  12.136 -# CPU_RSTK_EN enables return stack on Cyrix 5x86 (NOTE 1).
  12.137 -#
  12.138 -# CPU_SUSP_HLT enables suspend on HALT.  If this option is set, CPU
  12.139 -# enters suspend mode following execution of HALT instruction.
  12.140 -#
  12.141 -# CPU_UPGRADE_HW_CACHE eliminates unneeded cache flush instruction(s).
  12.142 -#
  12.143 -# CPU_WT_ALLOC enables write allocation on Cyrix 6x86/6x86MX and AMD
  12.144 -# K5/K6/K6-2 cpus.
  12.145 -#
  12.146 -# CYRIX_CACHE_WORKS enables CPU cache on Cyrix 486 CPUs with cache
  12.147 -# flush at hold state.
  12.148 -#
  12.149 -# CYRIX_CACHE_REALLY_WORKS enables (1) CPU cache on Cyrix 486 CPUs
  12.150 -# without cache flush at hold state, and (2) write-back CPU cache on
  12.151 -# Cyrix 6x86 whose revision < 2.7 (NOTE 2).
  12.152 -#
  12.153 -# NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY
  12.154 -# Pentiums) from locking up when a LOCK CMPXCHG8B instruction is
  12.155 -# executed.  This option is only needed if I586_CPU is also defined,
  12.156 -# and should be included for any non-Pentium CPU that defines it.
  12.157 -#
  12.158 -# NO_MEMORY_HOLE is an optimisation for systems with AMD K6 processors
  12.159 -# which indicates that the 15-16MB range is *definitely* not being
  12.160 -# occupied by an ISA memory hole.
  12.161 -#
  12.162 -# CPU_DISABLE_CMPXCHG disables the CMPXCHG instruction on > i386 IA32 
  12.163 -# machines.  VmWare seems to emulate this instruction poorly, causing 
  12.164 -# the guest OS to run very slowly.  Enabling this with a SMP kernel
  12.165 -# will cause the kernel to be unusable.
  12.166 -#
  12.167 -# NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT,
  12.168 -# CPU_LOOP_EN and CPU_RSTK_EN should not be used because of CPU bugs.
  12.169 -# These options may crash your system.
  12.170 -#
  12.171 -# NOTE 2: If CYRIX_CACHE_REALLY_WORKS is not set, CPU cache is enabled
  12.172 -# in write-through mode when revision < 2.7.  If revision of Cyrix
  12.173 -# 6x86 >= 2.7, CPU cache is always enabled in write-back mode.
  12.174 -#
  12.175 -# NOTE 3: This option may cause failures for software that requires
  12.176 -# locked cycles in order to operate correctly.
  12.177 -#
  12.178 -options 	CPU_ATHLON_SSE_HACK
  12.179 -options 	CPU_BLUELIGHTNING_FPU_OP_CACHE
  12.180 -options 	CPU_BLUELIGHTNING_3X
  12.181 -options 	CPU_BTB_EN
  12.182 -options 	CPU_DIRECT_MAPPED_CACHE
  12.183 -options 	CPU_DISABLE_5X86_LSSER
  12.184 -options 	CPU_ELAN
  12.185 -options 	CPU_SOEKRIS
  12.186 -options 	CPU_ELAN_XTAL=32768000
  12.187 -options 	CPU_ELAN_PPS
  12.188 -options 	CPU_ENABLE_SSE
  12.189 -#options 	CPU_DISABLE_SSE
  12.190 -options 	CPU_FASTER_5X86_FPU
  12.191 -options 	CPU_I486_ON_386
  12.192 -options 	CPU_IORT
  12.193 -options 	CPU_L2_LATENCY=5
  12.194 -options 	CPU_LOOP_EN
  12.195 -options 	CPU_PPRO2CELERON
  12.196 -options 	CPU_RSTK_EN
  12.197 -options 	CPU_SUSP_HLT
  12.198 -options 	CPU_UPGRADE_HW_CACHE
  12.199 -options 	CPU_WT_ALLOC
  12.200 -options 	CYRIX_CACHE_WORKS
  12.201 -options 	CYRIX_CACHE_REALLY_WORKS
  12.202 -#options 	NO_F00F_HACK
  12.203 -options 	CPU_DISABLE_CMPXCHG
  12.204 -
  12.205 -# Debug options
  12.206 -options 	NPX_DEBUG	# enable npx debugging (FPU/math emu)
  12.207 -					#new math emulator
  12.208 -
  12.209 -#
  12.210 -# PERFMON causes the driver for Pentium/Pentium Pro performance counters
  12.211 -# to be compiled.  See perfmon(4) for more information.
  12.212 -#
  12.213 -options 	PERFMON
  12.214 -
  12.215 -
  12.216 -#####################################################################
  12.217 -# NETWORKING OPTIONS
  12.218 -
  12.219 -#
  12.220 -# DEVICE_POLLING adds support for mixed interrupt-polling handling
  12.221 -# of network device drivers, which has significant benefits in terms
  12.222 -# of robustness to overloads and responsivity, as well as permitting
  12.223 -# accurate scheduling of the CPU time between kernel network processing
  12.224 -# and other activities. The drawback is a moderate (up to 1/HZ seconds)
  12.225 -# potential increase in response times.
  12.226 -# It is strongly recommended to use HZ=1000 or 2000 with DEVICE_POLLING
  12.227 -# to achieve smoother behaviour.
  12.228 -# Additionally, you can enable/disable polling at runtime with the
  12.229 -# sysctl variable kern.polling.enable (defaults off), and select
  12.230 -# the CPU fraction reserved to userland with the sysctl variable
  12.231 -# kern.polling.user_frac (default 50, range 0..100).
  12.232 -#
  12.233 -# Only the "dc" "fxp" and "sis" devices support this mode of operation at
  12.234 -# the time of this writing.
  12.235 -
  12.236 -options 	DEVICE_POLLING
  12.237 -
  12.238 -
  12.239 -#####################################################################
  12.240 -# CLOCK OPTIONS
  12.241 -
  12.242 -# The following options are used for debugging clock behavior only, and
  12.243 -# should not be used for production systems.
  12.244 -#
  12.245 -# CLK_CALIBRATION_LOOP will run the clock calibration loop at startup
  12.246 -# until the user presses a key.
  12.247 -
  12.248 -options 	CLK_CALIBRATION_LOOP
  12.249 -
  12.250 -# The following two options measure the frequency of the corresponding
  12.251 -# clock relative to the RTC (onboard mc146818a).
  12.252 -
  12.253 -options 	CLK_USE_I8254_CALIBRATION
  12.254 -options 	CLK_USE_TSC_CALIBRATION
  12.255 -
  12.256 -
  12.257 -#####################################################################
  12.258 -# MISCELLANEOUS DEVICES AND OPTIONS
  12.259 -
  12.260 -device		speaker		#Play IBM BASIC-style noises out your speaker
  12.261 -hint.speaker.0.at="isa"
  12.262 -hint.speaker.0.port="0x61"
  12.263 -device		gzip		#Exec gzipped a.out's. REQUIRES COMPAT_AOUT!
  12.264 -device		apm_saver	# Requires APM
  12.265 -
  12.266 -
  12.267 -#####################################################################
  12.268 -# HARDWARE BUS CONFIGURATION
  12.269 -
  12.270 -#
  12.271 -# ISA bus
  12.272 -#
  12.273 -device		isa
  12.274 -
  12.275 -#
  12.276 -# Options for `isa':
  12.277 -#
  12.278 -# AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A
  12.279 -# interrupt controller.  This saves about 0.7-1.25 usec for each interrupt.
  12.280 -# This option breaks suspend/resume on some portables.
  12.281 -#
  12.282 -# AUTO_EOI_2 enables the `automatic EOI' feature for the slave 8259A
  12.283 -# interrupt controller.  This saves about 0.7-1.25 usec for each interrupt.
  12.284 -# Automatic EOI is documented not to work for for the slave with the
  12.285 -# original i8259A, but it works for some clones and some integrated
  12.286 -# versions.
  12.287 -#
  12.288 -# MAXMEM specifies the amount of RAM on the machine; if this is not
  12.289 -# specified, FreeBSD will first read the amount of memory from the CMOS
  12.290 -# RAM, so the amount of memory will initially be limited to 64MB or 16MB
  12.291 -# depending on the BIOS.  If the BIOS reports 64MB, a memory probe will
  12.292 -# then attempt to detect the installed amount of RAM.  If this probe
  12.293 -# fails to detect >64MB RAM you will have to use the MAXMEM option.
  12.294 -# The amount is in kilobytes, so for a machine with 128MB of RAM, it would
  12.295 -# be 131072 (128 * 1024).
  12.296 -#
  12.297 -# BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to
  12.298 -# reset the CPU for reboot.  This is needed on some systems with broken
  12.299 -# keyboard controllers.
  12.300 -
  12.301 -options 	COMPAT_OLDISA	#Use ISA shims and glue for old drivers
  12.302 -options 	AUTO_EOI_1
  12.303 -#options 	AUTO_EOI_2
  12.304 -
  12.305 -options 	MAXMEM=(128*1024)
  12.306 -#options 	BROKEN_KEYBOARD_RESET
  12.307 -
  12.308 -# 
  12.309 -# EISA bus
  12.310 -#
  12.311 -# The EISA bus device is `eisa'.  It provides auto-detection and
  12.312 -# configuration support for all devices on the EISA bus.
  12.313 -
  12.314 -device		eisa
  12.315 -
  12.316 -# By default, only 10 EISA slots are probed, since the slot numbers
  12.317 -# above clash with the configuration address space of the PCI subsystem,
  12.318 -# and the EISA probe is not very smart about this.  This is sufficient
  12.319 -# for most machines, but in particular the HP NetServer LC series comes
  12.320 -# with an onboard AIC7770 dual-channel SCSI controller on EISA slot #11,
  12.321 -# thus you need to bump this figure to 12 for them.
  12.322 -options 	EISA_SLOTS=12
  12.323 -
  12.324 -#
  12.325 -# MCA bus:
  12.326 -#
  12.327 -# The MCA bus device is `mca'.  It provides auto-detection and
  12.328 -# configuration support for all devices on the MCA bus.
  12.329 -# No hints are required for MCA.
  12.330 -
  12.331 -device		mca
  12.332 -
  12.333 -#
  12.334 -# PCI bus & PCI options:
  12.335 -#
  12.336 -device		pci
  12.337 -
  12.338 -#
  12.339 -# AGP GART support
  12.340 -device		agp
  12.341 -
  12.342 -
  12.343 -#####################################################################
  12.344 -# HARDWARE DEVICE CONFIGURATION
  12.345 -
  12.346 -#
  12.347 -# Mandatory devices:
  12.348 -#
  12.349 -
  12.350 -# To include support for VGA VESA video modes
  12.351 -options 	VESA
  12.352 -
  12.353 -# Turn on extra debugging checks and output for VESA support.
  12.354 -options 	VESA_DEBUG
  12.355 -
  12.356 -# The pcvt console driver (vt220 compatible).
  12.357 -device		vt
  12.358 -hint.vt.0.at="isa"
  12.359 -options 	XSERVER			# support for running an X server on vt
  12.360 -options 	FAT_CURSOR		# start with block cursor
  12.361 -# This PCVT option is for keyboards such as those used on really old ThinkPads
  12.362 -options 	PCVT_SCANSET=2
  12.363 -# Other PCVT options are documented in pcvt(4).
  12.364 -options 	PCVT_24LINESDEF
  12.365 -options 	PCVT_CTRL_ALT_DEL
  12.366 -options 	PCVT_META_ESC
  12.367 -options 	PCVT_NSCREENS=9
  12.368 -options 	PCVT_PRETTYSCRNS
  12.369 -options 	PCVT_SCREENSAVER
  12.370 -options 	PCVT_USEKBDSEC
  12.371 -options 	PCVT_VT220KEYB
  12.372 -options 	PCVT_GREENSAVER
  12.373 -
  12.374 -#
  12.375 -# The Numeric Processing eXtension driver.  In addition to this, you
  12.376 -# may configure a math emulator (see above).  If your machine has a
  12.377 -# hardware FPU and the kernel configuration includes the npx device
  12.378 -# *and* a math emulator compiled into the kernel, the hardware FPU
  12.379 -# will be used, unless it is found to be broken or unless "flags" to
  12.380 -# npx0 includes "0x08", which requests preference for the emulator.
  12.381 -device		npx
  12.382 -hint.npx.0.flags="0x0"
  12.383 -hint.npx.0.irq="13"
  12.384 -
  12.385 -#
  12.386 -# `flags' for npx0:
  12.387 -#	0x01	don't use the npx registers to optimize bcopy.
  12.388 -#	0x02	don't use the npx registers to optimize bzero.
  12.389 -#	0x04	don't use the npx registers to optimize copyin or copyout.
  12.390 -#	0x08	use emulator even if hardware FPU is available.
  12.391 -# The npx registers are normally used to optimize copying and zeroing when
  12.392 -# all of the following conditions are satisfied:
  12.393 -#	I586_CPU is an option
  12.394 -#	the cpu is an i586 (perhaps not a Pentium)
  12.395 -#	the probe for npx0 succeeds
  12.396 -#	INT 16 exception handling works.
  12.397 -# Then copying and zeroing using the npx registers is normally 30-100% faster.
  12.398 -# The flags can be used to control cases where it doesn't work or is slower.
  12.399 -# Setting them at boot time using userconfig works right (the optimizations
  12.400 -# are not used until later in the bootstrap when npx0 is attached).
  12.401 -# Flag 0x08 automatically disables the i586 optimized routines.
  12.402 -#
  12.403 -
  12.404 -#
  12.405 -# Optional devices:
  12.406 -#
  12.407 -
  12.408 -# 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create
  12.409 -# the /dev/3dfx0 device to work with glide implementations. This should get
  12.410 -# linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as
  12.411 -# the tdfx DRI module from XFree86 and is completely unrelated.
  12.412 -#
  12.413 -# To enable Linuxulator support, one must also include COMPAT_LINUX in the
  12.414 -# config as well, or you will not have the dependencies. The other option
  12.415 -# is to load both as modules.
  12.416 -
  12.417 -device 		tdfx			# Enable 3Dfx Voodoo support
  12.418 -options 	TDFX_LINUX		# Enable Linuxulator support
  12.419 -
  12.420 -#
  12.421 -# ACPI support using the Intel ACPI Component Architecture reference
  12.422 -# implementation.
  12.423 -#
  12.424 -# ACPI_DEBUG enables the use of the debug.acpi.level and debug.acpi.layer
  12.425 -# kernel environment variables to select initial debugging levels for the
  12.426 -# Intel ACPICA code.  (Note that the Intel code must also have USE_DEBUGGER
  12.427 -# defined when it is built).
  12.428 -#
  12.429 -# ACPI_MAX_THREADS sets the number of task threads started.
  12.430 -#
  12.431 -# ACPI_NO_SEMAPHORES makes the AcpiOs*Semaphore routines a no-op.
  12.432 -#
  12.433 -# ACPICA_PEDANTIC enables strict checking of AML.  Our default is to
  12.434 -# relax these checks to allow code generated by the Microsoft compiler
  12.435 -# to still execute.
  12.436 -#
  12.437 -# Note that building ACPI into the kernel is deprecated; the module is
  12.438 -# normally loaded automatically by the loader.
  12.439 -#
  12.440 -device		acpi
  12.441 -options 	ACPI_DEBUG
  12.442 -options 	ACPI_MAX_THREADS=1
  12.443 -#!options 	ACPI_NO_SEMAPHORES
  12.444 -#!options 	ACPICA_PEDANTIC
  12.445 -
  12.446 -# DRM options:
  12.447 -# mgadrm:    AGP Matrox G200, G400, G450, G550
  12.448 -# r128drm:   ATI Rage 128
  12.449 -# radeondrm: ATI Radeon up to 9000/9100
  12.450 -# sisdrm:    SiS 300/305,540,630
  12.451 -# tdfxdrm:   3dfx Voodoo 3/4/5 and Banshee
  12.452 -# DRM_DEBUG: include debug printfs, very slow
  12.453 -#
  12.454 -# mga requires AGP in the kernel, and it is recommended
  12.455 -# for AGP r128 and radeon cards.
  12.456 -
  12.457 -device		mgadrm
  12.458 -device		"r128drm"
  12.459 -device		radeondrm
  12.460 -device		sisdrm
  12.461 -device		tdfxdrm
  12.462 -
  12.463 -options 	DRM_DEBUG
  12.464 -
  12.465 -# M-systems DiskOnchip products see src/sys/contrib/dev/fla/README
  12.466 -device		fla
  12.467 -hint.fla.0.at="isa"
  12.468 -
  12.469 -#
  12.470 -# mse: Logitech and ATI InPort bus mouse ports
  12.471 -
  12.472 -device		mse
  12.473 -hint.mse.0.at="isa"
  12.474 -hint.mse.0.port="0x23c"
  12.475 -hint.mse.0.irq="5"
  12.476 -
  12.477 -#
  12.478 -# Network interfaces:
  12.479 -#
  12.480 -
  12.481 -# ar:   Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver
  12.482 -#       (requires sppp)
  12.483 -# ath:	Atheros a/b/g WiFi adapters (requires ath_hal and wlan)
  12.484 -# cx:   Cronyx/Sigma multiport sync/async (with Cisco or PPP framing)
  12.485 -# ed:   Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503
  12.486 -#       HP PC Lan+, various PC Card devices (refer to etc/defauls/pccard.conf)
  12.487 -#       (requires miibus)
  12.488 -# el:   3Com 3C501 (slow!)
  12.489 -# ie:   AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210;
  12.490 -#       Intel EtherExpress
  12.491 -# le:   Digital Equipment EtherWorks 2 and EtherWorks 3 (DEPCA, DE100,
  12.492 -#       DE101, DE200, DE201, DE202, DE203, DE204, DE205, DE422)
  12.493 -# lnc:  Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL, AMD Am7990 and
  12.494 -#       Am79C960)
  12.495 -# oltr: Olicom ISA token-ring adapters OC-3115, OC-3117, OC-3118 and OC-3133
  12.496 -#       (no hints needed).
  12.497 -#       Olicom PCI token-ring adapters OC-3136, OC-3137, OC-3139, OC-3140,
  12.498 -#       OC-3141, OC-3540, OC-3250
  12.499 -# rdp:  RealTek RTL 8002-based pocket ethernet adapters
  12.500 -# sbni:	Granch SBNI12-xx ISA and PCI adapters
  12.501 -# sr:   RISCom/N2 hdlc sync 1/2 port V.35/X.21 serial driver (requires sppp)
  12.502 -# wl:	Lucent Wavelan (ISA card only).
  12.503 -
  12.504 -# Order for ISA/EISA devices is important here
  12.505 -
  12.506 -device		ar
  12.507 -hint.ar.0.at="isa"
  12.508 -hint.ar.0.port="0x300"
  12.509 -hint.ar.0.irq="10"
  12.510 -hint.ar.0.maddr="0xd0000"
  12.511 -device		cx
  12.512 -hint.cx.0.at="isa"
  12.513 -hint.cx.0.port="0x240"
  12.514 -hint.cx.0.irq="15"
  12.515 -hint.cx.0.drq="7"
  12.516 -device		ed
  12.517 -#options 	ED_NO_MIIBUS		# Disable ed miibus support
  12.518 -hint.ed.0.at="isa"
  12.519 -hint.ed.0.port="0x280"
  12.520 -hint.ed.0.irq="5"
  12.521 -hint.ed.0.maddr="0xd8000"
  12.522 -device		el	1
  12.523 -hint.el.0.at="isa"
  12.524 -hint.el.0.port="0x300"
  12.525 -hint.el.0.irq="9"
  12.526 -device		ie			# Hints only required for Starlan
  12.527 -hint.ie.2.at="isa"
  12.528 -hint.ie.2.port="0x300"
  12.529 -hint.ie.2.irq="5"
  12.530 -hint.ie.2.maddr="0xd0000"
  12.531 -device		le	1
  12.532 -hint.le.0.at="isa"
  12.533 -hint.le.0.port="0x300"
  12.534 -hint.le.0.irq="5"
  12.535 -hint.le.0.maddr="0xd0000"
  12.536 -device		lnc
  12.537 -hint.lnc.0.at="isa"
  12.538 -hint.lnc.0.port="0x280"
  12.539 -hint.lnc.0.irq="10"
  12.540 -hint.lnc.0.drq="0"
  12.541 -device		rdp	1
  12.542 -hint.rdp.0.at="isa"
  12.543 -hint.rdp.0.port="0x378"
  12.544 -hint.rdp.0.irq="7"
  12.545 -hint.rdp.0.flags="2"
  12.546 -device		sbni
  12.547 -hint.sbni.0.at="isa"
  12.548 -hint.sbni.0.port="0x210"
  12.549 -hint.sbni.0.irq="0xefdead"
  12.550 -hint.sbni.0.flags="0"
  12.551 -device		sr
  12.552 -hint.sr.0.at="isa"
  12.553 -hint.sr.0.port="0x300"
  12.554 -hint.sr.0.irq="5"
  12.555 -hint.sr.0.maddr="0xd0000"
  12.556 -device		oltr
  12.557 -hint.oltr.0.at="isa"
  12.558 -device		wl
  12.559 -hint.wl.0.at="isa"
  12.560 -hint.wl.0.port="0x300"
  12.561 -options 	WLCACHE		# enables the signal-strength cache
  12.562 -options 	WLDEBUG		# enables verbose debugging output
  12.563 -
  12.564 -device		ath
  12.565 -device		ath_hal		# Atheros HAL (includes binary component)
  12.566 -#device		wlan		# 802.11 layer
  12.567 -
  12.568 -#
  12.569 -# ATA raid adapters
  12.570 -#
  12.571 -device		pst
  12.572 -
  12.573 -# 
  12.574 -# SCSI host adapters:
  12.575 -# 
  12.576 -# ncv: NCR 53C500 based SCSI host adapters.
  12.577 -# nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters.
  12.578 -# stg: TMC 18C30, 18C50 based SCSI host adapters.
  12.579 -
  12.580 -device          ncv
  12.581 -device          nsp
  12.582 -device          stg
  12.583 -hint.stg.0.at="isa"
  12.584 -hint.stg.0.port="0x140"
  12.585 -hint.stg.0.port="11"
  12.586 -
  12.587 -#
  12.588 -# Adaptec FSA RAID controllers, including integrated DELL controllers,
  12.589 -# the Dell PERC 2/QC and the HP NetRAID-4M
  12.590 -device		aac
  12.591 -device		aacp	# SCSI Passthrough interface (optional, CAM required)
  12.592 -
  12.593 -#
  12.594 -# IBM (now Adaptec) ServeRAID controllers
  12.595 -device		ips
  12.596 -
  12.597 -#
  12.598 -# SafeNet crypto driver: can be moved to the MI NOTES as soon as
  12.599 -# it's tested on a big-endian machine
  12.600 -#
  12.601 -device		safe		# SafeNet 1141
  12.602 -options		SAFE_DEBUG	# enable debugging support: hw.safe.debug
  12.603 -options		SAFE_RNDTEST	# enable rndtest support
  12.604 -
  12.605 -#####################################################################
  12.606 -
  12.607 -#
  12.608 -# Miscellaneous hardware:
  12.609 -#
  12.610 -# wt: Wangtek and Archive QIC-02/QIC-36 tape drives
  12.611 -# ctx: Cortex-I frame grabber
  12.612 -# apm: Laptop Advanced Power Management (experimental)
  12.613 -# pmtimer: Timer device driver for power management events (APM or ACPI)
  12.614 -# spigot: The Creative Labs Video Spigot video-acquisition board
  12.615 -# dgb: Digiboard PC/Xi and PC/Xe series driver (ALPHA QUALITY!)
  12.616 -# digi: Digiboard driver
  12.617 -# gp:  National Instruments AT-GPIB and AT-GPIB/TNT board, PCMCIA-GPIB
  12.618 -# asc: GI1904-based hand scanners, e.g. the Trust Amiscan Grey
  12.619 -# gsc: Genius GS-4500 hand scanner.
  12.620 -# spic: Sony Programmable I/O controller (VAIO notebooks)
  12.621 -# stl: Stallion EasyIO and EasyConnection 8/32 (cd1400 based)
  12.622 -# stli: Stallion EasyConnection 8/64, ONboard, Brumby (intelligent)
  12.623 -
  12.624 -# Notes on APM
  12.625 -#  The flags takes the following meaning for apm0:
  12.626 -#    0x0020  Statclock is broken.
  12.627 -#  If apm is omitted, some systems require sysctl kern.timecounter.method=1
  12.628 -#  for correct timekeeping.
  12.629 -
  12.630 -# Notes on the spigot:
  12.631 -#  The video spigot is at 0xad6.  This port address can not be changed.
  12.632 -#  The irq values may only be 10, 11, or 15
  12.633 -#  I/O memory is an 8kb region.  Possible values are:
  12.634 -#    0a0000, 0a2000, ..., 0fffff, f00000, f02000, ..., ffffff
  12.635 -#    The start address must be on an even boundary.
  12.636 -#  Add the following option if you want to allow non-root users to be able
  12.637 -#  to access the spigot.  This option is not secure because it allows users
  12.638 -#  direct access to the I/O page.
  12.639 -#  	options SPIGOT_UNSECURE
  12.640 -
  12.641 -# Notes on the Specialix SI/XIO driver:
  12.642 -#  The host card is memory, not IO mapped.
  12.643 -#  The Rev 1 host cards use a 64K chunk, on a 32K boundary.
  12.644 -#  The Rev 2 host cards use a 32K chunk, on a 32K boundary.
  12.645 -#  The cards can use an IRQ of 11, 12 or 15.
  12.646 -
  12.647 -# Notes on the Sony Programmable I/O controller
  12.648 -#  This is a temporary driver that should someday be replaced by something
  12.649 -#  that hooks into the ACPI layer. The device is hooked to the PIIX4's
  12.650 -#  General Device 10 decoder, which means you have to fiddle with PCI
  12.651 -#  registers to map it in, even though it is otherwise treated here as
  12.652 -#  an ISA device. At the moment, the driver polls, although the device
  12.653 -#  is capable of generating interrupts. It largely undocumented.
  12.654 -#  The port location in the hint is where you WANT the device to be
  12.655 -#  mapped. 0x10a0 seems to be traditional. At the moment the jogdial
  12.656 -#  is the only thing truly supported, but aparently a fair percentage
  12.657 -#  of the Vaio extra features are controlled by this device.
  12.658 -
  12.659 -# Notes on the Stallion stl and stli drivers:
  12.660 -#  See src/i386/isa/README.stl for complete instructions.
  12.661 -#  This is version 0.0.5alpha, unsupported by Stallion.
  12.662 -#  The stl driver has a secondary IO port hard coded at 0x280.  You need
  12.663 -#     to change src/i386/isa/stallion.c if you reconfigure this on the boards.
  12.664 -#  The "flags" and "msize" settings on the stli driver depend on the board:
  12.665 -#	EasyConnection 8/64 ISA:     flags 23         msize 0x1000
  12.666 -#	EasyConnection 8/64 EISA:    flags 24         msize 0x10000
  12.667 -#	EasyConnection 8/64 MCA:     flags 25         msize 0x1000
  12.668 -#	ONboard ISA:                 flags 4          msize 0x10000
  12.669 -#	ONboard EISA:                flags 7          msize 0x10000
  12.670 -#	ONboard MCA:                 flags 3          msize 0x10000
  12.671 -#	Brumby:                      flags 2          msize 0x4000
  12.672 -#	Stallion:                    flags 1          msize 0x10000
  12.673 -
  12.674 -# Notes on the Digiboard PC/Xi and PC/Xe series driver
  12.675 -#               
  12.676 -# The NDGBPORTS option specifies the number of ports controlled by the
  12.677 -# dgb(4) driver.  The default value is 16 ports per device.
  12.678 -#
  12.679 -# The following flag values have special meanings in dgb:
  12.680 -#	0x01 - alternate layout of pins
  12.681 -#	0x02 - use the windowed PC/Xe in 64K mode
  12.682 -
  12.683 -device		wt	1
  12.684 -hint.wt.0.at="isa"
  12.685 -hint.wt.0.port="0x300"
  12.686 -hint.wt.0.irq="5"
  12.687 -hint.wt.0.drq="1"
  12.688 -device		ctx
  12.689 -hint.ctx.0.at="isa"
  12.690 -hint.ctx.0.port="0x230"
  12.691 -hint.ctx.0.maddr="0xd0000"
  12.692 -device		spigot	1
  12.693 -hint.spigot.0.at="isa"
  12.694 -hint.spigot.0.port="0xad6"
  12.695 -hint.spigot.0.irq="15"
  12.696 -hint.spigot.0.maddr="0xee000"
  12.697 -device		apm
  12.698 -hint.apm.0.flags="0x20"
  12.699 -device		pmtimer			# Adjust system timer at wakeup time
  12.700 -device		gp
  12.701 -hint.gp.0.at="isa"
  12.702 -hint.gp.0.port="0x2c0"
  12.703 -device		gsc	1
  12.704 -hint.gsc.0.at="isa"
  12.705 -hint.gsc.0.port="0x270"
  12.706 -hint.gsc.0.drq="3"
  12.707 -device		dgb	  1
  12.708 -options		NDGBPORTS=17
  12.709 -hint.dgb.0.at="isa"
  12.710 -hint.dgb.0.port="0x220"
  12.711 -hint.dgb.0.maddr="0xfc000"
  12.712 -device		digi
  12.713 -hint.digi.0.at="isa"
  12.714 -hint.digi.0.port="0x104"
  12.715 -hint.digi.0.maddr="0xd0000"
  12.716 -# BIOS & FEP/OS components of device digi.
  12.717 -device		digi_CX
  12.718 -device		digi_CX_PCI
  12.719 -device		digi_EPCX
  12.720 -device		digi_EPCX_PCI
  12.721 -device		digi_Xe
  12.722 -device		digi_Xem
  12.723 -device		digi_Xr
  12.724 -device		asc	1
  12.725 -hint.asc.0.at="isa"
  12.726 -hint.asc.0.port="0x3EB"
  12.727 -hint.asc.0.drq="3"
  12.728 -hint.asc.0.irq="10"
  12.729 -device		spic
  12.730 -hint.spic.0.at="isa"
  12.731 -hint.spic.0.port="0x10a0"
  12.732 -device		stl
  12.733 -hint.stl.0.at="isa"
  12.734 -hint.stl.0.port="0x2a0"
  12.735 -hint.stl.0.irq="10"
  12.736 -device		stli
  12.737 -hint.stli.0.at="isa"
  12.738 -hint.stli.0.port="0x2a0"
  12.739 -hint.stli.0.maddr="0xcc000"
  12.740 -hint.stli.0.flags="23"
  12.741 -hint.stli.0.msize="0x1000"
  12.742 -# You are unlikely to have the hardware for loran <phk@FreeBSD.org>
  12.743 -device		loran
  12.744 -hint.loran.0.at="isa"
  12.745 -hint.loran.0.irq="5"
  12.746 -# HOT1 Xilinx 6200 card (http://www.vcc.com/)
  12.747 -device		xrpu
  12.748 -
  12.749 -#
  12.750 -# Laptop/Notebook options:
  12.751 -#
  12.752 -# See also:
  12.753 -#  apm under `Miscellaneous hardware'
  12.754 -# above.
  12.755 -
  12.756 -# For older notebooks that signal a powerfail condition (external
  12.757 -# power supply dropped, or battery state low) by issuing an NMI:
  12.758 -
  12.759 -options 	POWERFAIL_NMI	# make it beep instead of panicing
  12.760 -
  12.761 -#
  12.762 -# I2C Bus
  12.763 -#
  12.764 -# Philips i2c bus support is provided by the `iicbus' device.
  12.765 -#
  12.766 -# Supported interfaces:
  12.767 -# pcf	Philips PCF8584 ISA-bus controller
  12.768 -#
  12.769 -device		pcf
  12.770 -hint.pcf.0.at="isa"
  12.771 -hint.pcf.0.port="0x320"
  12.772 -hint.pcf.0.irq="5"
  12.773 -
  12.774 -#---------------------------------------------------------------------------
  12.775 -# ISDN4BSD
  12.776 -#
  12.777 -# See /usr/share/examples/isdn/ROADMAP for an introduction to isdn4bsd.
  12.778 -#
  12.779 -# i4b passive ISDN cards support contains the following hardware drivers:
  12.780 -#
  12.781 -#	isic  - Siemens/Infineon ISDN ISAC/HSCX/IPAC chipset driver
  12.782 -#	iwic  - Winbond W6692 PCI bus ISDN S/T interface controller
  12.783 -#	ifpi  - AVM Fritz!Card PCI driver
  12.784 -#	ifpi2  - AVM Fritz!Card PCI version 2 driver
  12.785 -#	ihfc  - Cologne Chip HFC ISA/ISA-PnP chipset driver
  12.786 -#	ifpnp - AVM Fritz!Card PnP driver 
  12.787 -#	itjc  - Siemens ISAC / TJNet Tiger300/320 chipset
  12.788 -#
  12.789 -# i4b active ISDN cards support contains the following hardware drivers:
  12.790 -#
  12.791 -#	iavc  - AVM B1 PCI, AVM B1 ISA, AVM T1
  12.792 -#
  12.793 -# Note that the ``options'' (if given) and ``device'' lines must BOTH
  12.794 -# be uncommented to enable support for a given card !
  12.795 -#
  12.796 -# In addition to a hardware driver (and probably an option) the mandatory
  12.797 -# ISDN protocol stack devices and the mandatory support device must be 
  12.798 -# enabled as well as one or more devices from the optional devices section.
  12.799 -#
  12.800 -#---------------------------------------------------------------------------
  12.801 -#	isic driver (Siemens/Infineon chipsets)
  12.802 -#
  12.803 -device	isic
  12.804 -#
  12.805 -# ISA bus non-PnP Cards:
  12.806 -# ----------------------
  12.807 -#
  12.808 -# Teles S0/8 or Niccy 1008
  12.809 -options 	TEL_S0_8
  12.810 -hint.isic.0.at="isa"
  12.811 -hint.isic.0.maddr="0xd0000"
  12.812 -hint.isic.0.irq="5"
  12.813 -hint.isic.0.flags="1"
  12.814 -#
  12.815 -# Teles S0/16 or Creatix ISDN-S0 or Niccy 1016
  12.816 -options 	TEL_S0_16
  12.817 -hint.isic.0.at="isa"
  12.818 -hint.isic.0.port="0xd80"
  12.819 -hint.isic.0.maddr="0xd0000"
  12.820 -hint.isic.0.irq="5"
  12.821 -hint.isic.0.flags="2"
  12.822 -#
  12.823 -# Teles S0/16.3
  12.824 -options 	TEL_S0_16_3
  12.825 -hint.isic.0.at="isa"
  12.826 -hint.isic.0.port="0xd80"
  12.827 -hint.isic.0.irq="5"
  12.828 -hint.isic.0.flags="3"
  12.829 -#
  12.830 -# AVM A1 or AVM Fritz!Card
  12.831 -options 	AVM_A1
  12.832 -hint.isic.0.at="isa"
  12.833 -hint.isic.0.port="0x340"
  12.834 -hint.isic.0.irq="5"
  12.835 -hint.isic.0.flags="4"
  12.836 -#
  12.837 -# USRobotics Sportster ISDN TA intern
  12.838 -options 	USR_STI
  12.839 -hint.isic.0.at="isa"
  12.840 -hint.isic.0.port="0x268"
  12.841 -hint.isic.0.irq="5"
  12.842 -hint.isic.0.flags="7"
  12.843 -#
  12.844 -# ITK ix1 Micro ( < V.3, non-PnP version )
  12.845 -options 	ITKIX1
  12.846 -hint.isic.0.at="isa"
  12.847 -hint.isic.0.port="0x398"
  12.848 -hint.isic.0.irq="10"
  12.849 -hint.isic.0.flags="18"
  12.850 -#
  12.851 -# ELSA PCC-16
  12.852 -options 	ELSA_PCC16
  12.853 -hint.isic.0.at="isa"
  12.854 -hint.isic.0.port="0x360"
  12.855 -hint.isic.0.irq="10"
  12.856 -hint.isic.0.flags="20"
  12.857 -#
  12.858 -# ISA bus PnP Cards:
  12.859 -# ------------------
  12.860 -#
  12.861 -# Teles S0/16.3 PnP
  12.862 -options 	TEL_S0_16_3_P
  12.863 -#
  12.864 -# Creatix ISDN-S0 P&P
  12.865 -options 	CRTX_S0_P
  12.866 -#
  12.867 -# Dr. Neuhaus Niccy Go@
  12.868 -options 	DRN_NGO
  12.869 -#
  12.870 -# Sedlbauer Win Speed
  12.871 -options 	SEDLBAUER
  12.872 -#
  12.873 -# Dynalink IS64PH
  12.874 -options 	DYNALINK 
  12.875 -#
  12.876 -# ELSA QuickStep 1000pro ISA
  12.877 -options 	ELSA_QS1ISA
  12.878 -#
  12.879 -# Siemens I-Surf 2.0
  12.880 -options 	SIEMENS_ISURF2
  12.881 -#
  12.882 -# Asuscom ISDNlink 128K ISA
  12.883 -options 	ASUSCOM_IPAC
  12.884 -#
  12.885 -# Eicon Diehl DIVA 2.0 and 2.02
  12.886 -options 	EICON_DIVA
  12.887 -#
  12.888 -# Compaq Microcom 610 ISDN card (Compaq series PSB2222I)
  12.889 -options 	COMPAQ_M610
  12.890 -#
  12.891 -# PCI bus Cards:
  12.892 -# --------------
  12.893 -#
  12.894 -# Cyclades Cyclom-Y PCI serial driver
  12.895 -device		cy	1
  12.896 -options 	CY_PCI_FASTINTR		# Use with cy_pci unless irq is shared
  12.897 -hint.cy.0.at="isa"
  12.898 -hint.cy.0.irq="10"
  12.899 -hint.cy.0.maddr="0xd4000"
  12.900 -hint.cy.0.msize="0x2000"
  12.901 -#
  12.902 -#---------------------------------------------------------------------------
  12.903 -# ELSA MicroLink ISDN/PCI (same as ELSA QuickStep 1000pro PCI)
  12.904 -options 	ELSA_QS1PCI
  12.905 -#
  12.906 -#
  12.907 -#---------------------------------------------------------------------------
  12.908 -#	ifpnp driver for AVM Fritz!Card PnP
  12.909 -#
  12.910 -# AVM Fritz!Card PnP
  12.911 -device ifpnp
  12.912 -#
  12.913 -#---------------------------------------------------------------------------
  12.914 -#	ihfc driver for Cologne Chip ISA chipsets (experimental!)
  12.915 -#
  12.916 -# Teles 16.3c ISA PnP
  12.917 -# AcerISDN P10 ISA PnP
  12.918 -# TELEINT ISDN SPEED No.1
  12.919 -device ihfc
  12.920 -#
  12.921 -#---------------------------------------------------------------------------
  12.922 -#	ifpi driver for AVM Fritz!Card PCI
  12.923 -#
  12.924 -# AVM Fritz!Card PCI
  12.925 -device  ifpi
  12.926 -#
  12.927 -#---------------------------------------------------------------------------
  12.928 -#	ifpi2 driver for AVM Fritz!Card PCI version 2
  12.929 -#
  12.930 -# AVM Fritz!Card PCI version 2
  12.931 -device  "ifpi2"
  12.932 -#
  12.933 -#---------------------------------------------------------------------------
  12.934 -#	iwic driver for Winbond W6692 chipset
  12.935 -#
  12.936 -# ASUSCOM P-IN100-ST-D (and other Winbond W6692 based cards)
  12.937 -device  iwic
  12.938 -#
  12.939 -#---------------------------------------------------------------------------
  12.940 -#	itjc driver for Simens ISAC / TJNet Tiger300/320 chipset
  12.941 -#
  12.942 -# Traverse Technologies NETjet-S
  12.943 -# Teles PCI-TJ
  12.944 -device  itjc
  12.945 -#
  12.946 -#---------------------------------------------------------------------------
  12.947 -#	iavc driver (AVM active cards, needs i4bcapi driver!)
  12.948 -#
  12.949 -device	iavc
  12.950 -#
  12.951 -# AVM B1 ISA bus (PnP mode not supported!)
  12.952 -# ----------------------------------------
  12.953 -hint.iavc.0.at="isa"
  12.954 -hint.iavc.0.port="0x150"
  12.955 -hint.iavc.0.irq="5"
  12.956 -#
  12.957 -#---------------------------------------------------------------------------
  12.958 -#	ISDN Protocol Stack - mandatory for all hardware drivers
  12.959 -#
  12.960 -# Q.921 / layer 2 - i4b passive cards D channel handling
  12.961 -device		"i4bq921"
  12.962 -#
  12.963 -# Q.931 / layer 3 - i4b passive cards D channel handling
  12.964 -device		"i4bq931"
  12.965 -#
  12.966 -# layer 4 - i4b common passive and active card handling
  12.967 -device		"i4b"
  12.968 -#
  12.969 -#---------------------------------------------------------------------------
  12.970 -#	ISDN devices - mandatory for all hardware drivers
  12.971 -#
  12.972 -# userland driver to do ISDN tracing (for passive cards only)
  12.973 -device		"i4btrc"	4
  12.974 -#
  12.975 -# userland driver to control the whole thing
  12.976 -device		"i4bctl"
  12.977 -#
  12.978 -#---------------------------------------------------------------------------
  12.979 -#	ISDN devices - optional
  12.980 -#
  12.981 -# userland driver for access to raw B channel
  12.982 -device		"i4brbch"	4
  12.983 -#
  12.984 -# userland driver for telephony
  12.985 -device		"i4btel"	2
  12.986 -#
  12.987 -# network driver for IP over raw HDLC ISDN
  12.988 -device		"i4bipr"	4
  12.989 -# enable VJ header compression detection for ipr i/f
  12.990 -options 	IPR_VJ
  12.991 -# enable logging of the first n IP packets to isdnd (n=32 here)
  12.992 -options 	IPR_LOG=32
  12.993 -#
  12.994 -# network driver for sync PPP over ISDN; requires an equivalent
  12.995 -# number of sppp device to be configured
  12.996 -device		"i4bisppp"	4
  12.997 -#
  12.998 -# B-channel interface to the netgraph subsystem
  12.999 -device		"i4bing"	2
 12.1000 -#
 12.1001 -# CAPI driver needed for active ISDN cards (see iavc driver above)
 12.1002 -device		"i4bcapi"
 12.1003 -#
 12.1004 -#---------------------------------------------------------------------------
 12.1005 -
 12.1006 -#
 12.1007 -# Set the number of PV entries per process.  Increasing this can
 12.1008 -# stop panics related to heavy use of shared memory. However, that can
 12.1009 -# (combined with large amounts of physical memory) cause panics at
 12.1010 -# boot time due the kernel running out of VM space.
 12.1011 -#
 12.1012 -# If you're tweaking this, you might also want to increase the sysctls
 12.1013 -# "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target".
 12.1014 -#
 12.1015 -# The value below is the one more than the default.
 12.1016 -#
 12.1017 -options 	PMAP_SHPGPERPROC=201
 12.1018 -
 12.1019 -#
 12.1020 -# Change the size of the kernel virtual address space.  Due to
 12.1021 -# constraints in loader(8) on i386, this must be a multiple of 4.
 12.1022 -# 256 = 1 GB of kernel address space.  Increasing this also causes
 12.1023 -# a reduction of the address space in user processes.  512 splits
 12.1024 -# the 4GB cpu address space in half (2GB user, 2GB kernel).
 12.1025 -#
 12.1026 -options 	KVA_PAGES=260
 12.1027 -
 12.1028 -
 12.1029 -#####################################################################
 12.1030 -# ABI Emulation
 12.1031 -
 12.1032 -# Enable iBCS2 runtime support for SCO and ISC binaries
 12.1033 -options 	IBCS2
 12.1034 -
 12.1035 -# Emulate spx device for client side of SVR3 local X interface
 12.1036 -options 	SPX_HACK
 12.1037 -
 12.1038 -# Enable Linux ABI emulation
 12.1039 -options 	COMPAT_LINUX
 12.1040 -
 12.1041 -# Enable i386 a.out binary support
 12.1042 -options 	COMPAT_AOUT
 12.1043 -
 12.1044 -# Enable the linux-like proc filesystem support (requires COMPAT_LINUX
 12.1045 -# and PSEUDOFS)
 12.1046 -options 	LINPROCFS
 12.1047 -
 12.1048 -#
 12.1049 -# SysVR4 ABI emulation
 12.1050 -#
 12.1051 -# The svr4 ABI emulator can be statically compiled into the kernel or loaded as
 12.1052 -# a KLD module.  
 12.1053 -# The STREAMS network emulation code can also be compiled statically or as a 
 12.1054 -# module.  If loaded as a module, it must be loaded before the svr4 module
 12.1055 -# (the /usr/sbin/svr4 script does this for you).  If compiling statically,
 12.1056 -# the `streams' device must be configured into any kernel which also
 12.1057 -# specifies COMPAT_SVR4.  It is possible to have a statically-configured 
 12.1058 -# STREAMS device and a dynamically loadable svr4 emulator;  the /usr/sbin/svr4
 12.1059 -# script understands that it doesn't need to load the `streams' module under
 12.1060 -# those circumstances.
 12.1061 -# Caveat:  At this time, `options KTRACE' is required for the svr4 emulator
 12.1062 -# (whether static or dynamic).  
 12.1063 -# 
 12.1064 -options 	COMPAT_SVR4	# build emulator statically
 12.1065 -options 	DEBUG_SVR4	# enable verbose debugging
 12.1066 -device		streams		# STREAMS network driver (required for svr4).
 12.1067 -
 12.1068 -
 12.1069 -#####################################################################
 12.1070 -# VM OPTIONS
 12.1071 -
 12.1072 -# Disable the 4 MByte page PSE CPU feature.  The PSE feature allows the
 12.1073 -# kernel to use a 4 MByte pages to map the kernel instead of 4k pages.
 12.1074 -# This saves on the amount of memory needed for page tables needed to
 12.1075 -# map the kernel.  You should only disable this feature as a temporary
 12.1076 -# workaround if you are having problems with it enabled.
 12.1077 -#
 12.1078 -#options 	DISABLE_PSE
 12.1079 -
 12.1080 -# Disable the global pages PGE CPU feature.  The PGE feature allows pages
 12.1081 -# to be marked with the PG_G bit.  TLB entries for these pages are not
 12.1082 -# flushed from the cache when %cr3 is reloaded.  This can make context
 12.1083 -# switches less expensive.  You should only disable this feature as a
 12.1084 -# temporary workaround if you are having problems with it enabled.
 12.1085 -#
 12.1086 -#options 	DISABLE_PG_G
 12.1087 -
 12.1088 -# KSTACK_PAGES is the number of memory pages to assign to the kernel
 12.1089 -# stack of each thread.
 12.1090 -
 12.1091 -options 	KSTACK_PAGES=3
 12.1092 -
 12.1093 -#####################################################################
 12.1094 -
 12.1095 -# More undocumented options for linting.
 12.1096 -# Note that documenting these are not considered an affront.
 12.1097 -
 12.1098 -options 	FB_INSTALL_CDEV		# install a CDEV entry in /dev
 12.1099 -
 12.1100 -# PECOFF module (Win32 Execution Format)
 12.1101 -options 	PECOFF_SUPPORT
 12.1102 -options 	PECOFF_DEBUG
 12.1103 -
 12.1104 -options 	ENABLE_ALART
 12.1105 -options 	I4B_SMP_WORKAROUND
 12.1106 -options 	I586_PMC_GUPROF=0x70000
 12.1107 -options 	KBDIO_DEBUG=2
 12.1108 -options 	KBD_MAXRETRY=4
 12.1109 -options 	KBD_MAXWAIT=6
 12.1110 -options 	KBD_RESETDELAY=201
 12.1111 -
 12.1112 -options 	PSM_DEBUG=1
 12.1113 -
 12.1114 -options 	TIMER_FREQ=((14318182+6)/12)
 12.1115 -
 12.1116 -options 	VM_KMEM_SIZE
 12.1117 -options 	VM_KMEM_SIZE_MAX
 12.1118 -options 	VM_KMEM_SIZE_SCALE
    13.1 --- a/freebsd-5.3-xen-sparse/i386-xen/conf/OLDCARD	Sun Dec 04 18:24:24 2005 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,17 +0,0 @@
    13.4 -#
    13.5 -# OLDCARD -- Generic kernel configuration file for FreeBSD/i386
    13.6 -#            using the OLDCARD pccard system.
    13.7 -#
    13.8 -# $FreeBSD: src/sys/i386/conf/OLDCARD,v 1.18 2003/02/15 02:39:13 ru Exp $
    13.9 -
   13.10 -include GENERIC
   13.11 -
   13.12 -ident		OLDCARD
   13.13 -
   13.14 -# PCCARD (PCMCIA) support
   13.15 -nodevice	cbb		# cardbus (yenta) bridge
   13.16 -#nodevice	pcic		# ExCA ISA and PCI bridges
   13.17 -nodevice	pccard		# PC Card (16-bit) bus
   13.18 -nodevice	cardbus		# CardBus (32-bit) bus
   13.19 -device		card	1	# pccard bus
   13.20 -device		pcic		# PCMCIA bridge
    14.1 --- a/freebsd-5.3-xen-sparse/i386-xen/conf/PAE	Sun Dec 04 18:24:24 2005 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,99 +0,0 @@
    14.4 -#
    14.5 -# PAE -- Generic kernel configuration file for FreeBSD/i386 PAE
    14.6 -#
    14.7 -# $FreeBSD: src/sys/i386/conf/PAE,v 1.8 2003/11/03 22:49:19 jhb Exp $
    14.8 -
    14.9 -include GENERIC
   14.10 -
   14.11 -ident		PAE-GENERIC
   14.12 -
   14.13 -# To make a PAE kernel, the next option is needed
   14.14 -options		PAE			# Physical Address Extensions Kernel
   14.15 -
   14.16 -# Compile acpi in statically since the module isn't built properly.  Most
   14.17 -# machines which support large amounts of memory require acpi.
   14.18 -device		acpi
   14.19 -
   14.20 -# Don't build modules with this kernel config, since they are not built with
   14.21 -# the correct options headers.
   14.22 -makeoptions	NO_MODULES=yes
   14.23 -
   14.24 -# What follows is a list of drivers that are normally in GENERIC, but either
   14.25 -# don't work or are untested with PAE.  Be very careful before enabling any
   14.26 -# of these drivers.  Drivers which use DMA and don't handle 64 bit physical
   14.27 -# address properly may cause data corruption when used in a machine with more
   14.28 -# than 4 gigabytes of memory.
   14.29 -
   14.30 -nodevice	ahb
   14.31 -nodevice	amd
   14.32 -nodevice	isp
   14.33 -nodevice	sym
   14.34 -nodevice	trm
   14.35 -
   14.36 -nodevice	adv
   14.37 -nodevice	adw
   14.38 -nodevice	aha
   14.39 -nodevice	aic
   14.40 -nodevice	bt
   14.41 -
   14.42 -nodevice	ncv
   14.43 -nodevice	nsp
   14.44 -nodevice	stg
   14.45 -
   14.46 -nodevice	asr
   14.47 -nodevice	dpt
   14.48 -nodevice	iir
   14.49 -nodevice	mly
   14.50 -
   14.51 -nodevice	amr
   14.52 -nodevice	ida
   14.53 -nodevice	mlx
   14.54 -nodevice	pst
   14.55 -
   14.56 -nodevice	agp
   14.57 -
   14.58 -nodevice	de
   14.59 -nodevice	txp
   14.60 -nodevice	vx
   14.61 -
   14.62 -nodevice	dc
   14.63 -nodevice	pcn
   14.64 -nodevice	rl
   14.65 -nodevice	sf
   14.66 -nodevice	sis
   14.67 -nodevice	ste
   14.68 -nodevice	tl
   14.69 -nodevice	tx
   14.70 -nodevice	vr
   14.71 -nodevice	wb
   14.72 -
   14.73 -nodevice	cs
   14.74 -nodevice	ed
   14.75 -nodevice	ex
   14.76 -nodevice	ep
   14.77 -nodevice	fe
   14.78 -nodevice	ie
   14.79 -nodevice	lnc
   14.80 -nodevice	sn
   14.81 -nodevice	xe
   14.82 -
   14.83 -nodevice	wlan
   14.84 -nodevice	an
   14.85 -nodevice	awi
   14.86 -nodevice	wi
   14.87 -
   14.88 -nodevice	uhci
   14.89 -nodevice	ohci
   14.90 -nodevice	usb
   14.91 -nodevice	ugen
   14.92 -nodevice	uhid
   14.93 -nodevice	ukbd
   14.94 -nodevice	ulpt
   14.95 -nodevice	umass
   14.96 -nodevice	ums
   14.97 -nodevice	urio
   14.98 -nodevice	uscanner
   14.99 -nodevice	aue
  14.100 -nodevice	axe
  14.101 -nodevice	cue
  14.102 -nodevice	kue
    15.1 --- a/freebsd-5.3-xen-sparse/i386-xen/conf/XENCONF	Sun Dec 04 18:24:24 2005 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,137 +0,0 @@
    15.4 -#
    15.5 -# GENERIC -- Generic kernel configuration file for FreeBSD/i386
    15.6 -#
    15.7 -# For more information on this file, please read the handbook section on
    15.8 -# Kernel Configuration Files:
    15.9 -#
   15.10 -#    http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
   15.11 -#
   15.12 -# The handbook is also available locally in /usr/share/doc/handbook
   15.13 -# if you've installed the doc distribution, otherwise always see the
   15.14 -# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
   15.15 -# latest information.
   15.16 -#
   15.17 -# An exhaustive list of options and more detailed explanations of the
   15.18 -# device lines is also present in the ../../conf/NOTES and NOTES files. 
   15.19 -# If you are in doubt as to the purpose or necessity of a line, check first 
   15.20 -# in NOTES.
   15.21 -#
   15.22 -# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.394.2.3 2004/01/26 19:42:11 nectar Exp $
   15.23 -
   15.24 -machine		i386-xen
   15.25 -cpu		I686_CPU
   15.26 -ident		XEN
   15.27 -
   15.28 -#To statically compile in device wiring instead of /boot/device.hints
   15.29 -#hints		"GENERIC.hints"		#Default places to look for devices.
   15.30 -
   15.31 -makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
   15.32 -
   15.33 -options 	SCHED_4BSD		#4BSD scheduler
   15.34 -options 	INET			#InterNETworking
   15.35 -options 	INET6			#IPv6 communications protocols
   15.36 -options 	FFS			#Berkeley Fast Filesystem
   15.37 -options 	SOFTUPDATES		#Enable FFS soft updates support
   15.38 -options 	UFS_ACL			#Support for access control lists
   15.39 -options 	UFS_DIRHASH		#Improve performance on big directories
   15.40 -options 	MD_ROOT			#MD is a potential root device
   15.41 -options 	NFSCLIENT		#Network Filesystem Client
   15.42 -options 	NFSSERVER		#Network Filesystem Server
   15.43 -# options 	NFS_ROOT		#NFS usable as /, requires NFSCLIENT
   15.44 -#options 	MSDOSFS			#MSDOS Filesystem
   15.45 -#options 	CD9660			#ISO 9660 Filesystem
   15.46 -options 	PROCFS			#Process filesystem (requires PSEUDOFS)
   15.47 -options 	PSEUDOFS		#Pseudo-filesystem framework
   15.48 -options 	COMPAT_43		#Compatible with BSD 4.3 [KEEP THIS!]
   15.49 -options 	COMPAT_FREEBSD4		#Compatible with FreeBSD4
   15.50 -options 	SCSI_DELAY=15000	#Delay (in ms) before probing SCSI
   15.51 -options 	KTRACE			#ktrace(1) support
   15.52 -options 	SYSVSHM			#SYSV-style shared memory
   15.53 -options 	SYSVMSG			#SYSV-style message queues
   15.54 -options 	SYSVSEM			#SYSV-style semaphores
   15.55 -options 	_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
   15.56 -options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
   15.57 -options		CPU_DISABLE_SSE		# don't turn on SSE framework with Xen
   15.58 -#options 	PFIL_HOOKS		# pfil(9) framework
   15.59 -
   15.60 -# Debugging for use in -current
   15.61 -options 	KDB			#Enable the kernel debugger
   15.62 -options 	INVARIANTS		#Enable calls of extra sanity checking
   15.63 -options 	INVARIANT_SUPPORT	#Extra sanity checks of internal structures, required by INVARIANTS
   15.64 -#options 	WITNESS			#Enable checks to detect deadlocks and cycles
   15.65 -#options 	WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
   15.66 -
   15.67 -# To make an SMP kernel, the next two are needed
   15.68 -#options 	SMP		# Symmetric MultiProcessor Kernel
   15.69 -#device		apic		# I/O APIC
   15.70 -
   15.71 -# SCSI peripherals
   15.72 -device		scbus		# SCSI bus (required for SCSI)
   15.73 -#device		ch		# SCSI media changers
   15.74 -device		da		# Direct Access (disks)
   15.75 -#device		sa		# Sequential Access (tape etc)
   15.76 -#device		cd		# CD
   15.77 -device		pass		# Passthrough device (direct SCSI access)
   15.78 -#device		ses		# SCSI Environmental Services (and SAF-TE)
   15.79 -
   15.80 -# atkbdc0 controls both the keyboard and the PS/2 mouse
   15.81 -#device		atkbdc		# AT keyboard controller
   15.82 -#device		atkbd		# AT keyboard
   15.83 -#device		psm		# PS/2 mouse
   15.84 -
   15.85 -# device		vga	# VGA video card driver
   15.86 -
   15.87 -#device		splash		# Splash screen and screen saver support
   15.88 -
   15.89 -# syscons is the default console driver, resembling an SCO console
   15.90 -#device		sc
   15.91 -
   15.92 -# Enable this for the pcvt (VT220 compatible) console driver
   15.93 -#device		vt
   15.94 -#options 	XSERVER			# support for X server on a vt console
   15.95 -#options 	FAT_CURSOR		# start with block cursor
   15.96 -
   15.97 -#device		agp		# support several AGP chipsets
   15.98 -
   15.99 -# Floating point support - do not disable. 
  15.100 -device		npx
  15.101 -
  15.102 -# Serial (COM) ports
  15.103 -#device		sio		# 8250, 16[45]50 based serial ports
  15.104 -
  15.105 -# Parallel port
  15.106 -#device		ppc
  15.107 -#device		ppbus		# Parallel port bus (required)
  15.108 -#device		lpt		# Printer
  15.109 -#device		plip		# TCP/IP over parallel
  15.110 -#device		ppi		# Parallel port interface device
  15.111 -#device		vpo		# Requires scbus and da
  15.112 -
  15.113 -# If you've got a "dumb" serial or parallel PCI card that is
  15.114 -# supported by the puc(4) glue driver, uncomment the following
  15.115 -# line to enable it (connects to the sio and/or ppc drivers):
  15.116 -#device         puc
  15.117 -
  15.118 -
  15.119 -# Pseudo devices - the number indicates how many units to allocate.
  15.120 -device		random		# Entropy device
  15.121 -device		loop		# Network loopback
  15.122 -device		ether		# Ethernet support
  15.123 -device		tun		# Packet tunnel.
  15.124 -device		pty		# Pseudo-ttys (telnet etc)
  15.125 -device		md		# Memory "disks"
  15.126 -device		gif		# IPv6 and IPv4 tunneling
  15.127 -device		faith		# IPv6-to-IPv4 relaying (translation)
  15.128 -
  15.129 -# The `bpf' device enables the Berkeley Packet Filter.
  15.130 -# Be aware of the administrative consequences of enabling this!
  15.131 -device		bpf		# Berkeley packet filter
  15.132 -
  15.133 -#options		BOOTP
  15.134 -options		XEN
  15.135 -options		MCLSHIFT=12	# this has to be enabled for Xen as we can only have one cluster per page
  15.136 -options		MSIZE=256 
  15.137 -options 	DIAGNOSTIC
  15.138 -options		MAXMEM=(256*1024)
  15.139 -options		NOXENDEBUG=1 		# Turn off Debugging printfs
  15.140 -
    16.1 --- a/freebsd-5.3-xen-sparse/i386-xen/conf/gethints.awk	Sun Dec 04 18:24:24 2005 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,116 +0,0 @@
    16.4 -#! /usr/bin/awk -f
    16.5 -#
    16.6 -# This is a transition aid. It extracts old-style configuration information
    16.7 -# from a config file and writes an equivalent device.hints file to stdout.
    16.8 -# You can use that with loader(8) or statically compile it in with the
    16.9 -# 'hints' directive.  See how GENERIC and GENERIC.hints fit together for
   16.10 -# a static example.  You should use loader(8) if at all possible.
   16.11 -#
   16.12 -# $FreeBSD: src/sys/i386/conf/gethints.awk,v 1.2 2002/07/26 03:52:30 peter Exp $
   16.13 -
   16.14 -# skip commented lines, empty lines and not "device" lines
   16.15 -/^[ \t]*#/ || /^[ \t]*$/ || !/[ \t]*device/ { next; }
   16.16 -
   16.17 -# input format :
   16.18 -#    device <name><unit> at <controler>[?] [key [val]]...
   16.19 -# possible keys are :
   16.20 -#    disable, port #, irq #, drq #, drive #, iomem #, iosiz #,
   16.21 -#    flags #, bus #, target #, unit #.
   16.22 -# output format :
   16.23 -#    hint.<name>.<unit>.<key>=<val>
   16.24 -# mapped keys are :
   16.25 -#    iomem -> maddr, iosiz -> msize.
   16.26 -{
   16.27 -	gsub ("#.*", "");		# delete comments
   16.28 -	gsub ("\"", "");		# and double-quotes
   16.29 -	nameunit = $2;			# <name><unit>
   16.30 -	at = $3;			# at
   16.31 -	controler = $4;			# <controler>[?]
   16.32 -	rest = 5;			# optional keys begin at indice 5
   16.33 -	if (at != "at" || controler == "")
   16.34 -		next;			# skip devices w/o controlers
   16.35 -	name = nameunit;
   16.36 -	sub ("[0-9]*$", "", name);	# get the name
   16.37 -	unit = nameunit;
   16.38 -	sub ("^" name, "", unit);	# and the unit
   16.39 -	sub ("\?$", "", controler);
   16.40 -	printf "hint.%s.%s.at=\"%s\"\n", name, unit, controler;
   16.41 -	# for each keys, if any ?
   16.42 -	for (key = $rest; rest <= NF; key = $(++rest)) {
   16.43 -		# skip auto-detect keys (the one w/ a ?)
   16.44 -		if (key == "port?" || key == "drq?" || key == "irq?" || \
   16.45 -		    key == "iomem?" || key == "iosiz?")
   16.46 -			continue;
   16.47 -		# disable has no value, so, give it one
   16.48 -		if (key == "disable") {
   16.49 -			printf "hint.%s.%s.disabled=\"1\"\n", name, unit;
   16.50 -			continue;
   16.51 -		}
   16.52 -		# recognized keys
   16.53 -		if (key == "port" || key == "irq" || key == "drq" || \
   16.54 -		    key == "drive" || key == "iomem" || key == "iosiz" || \
   16.55 -		    key == "flags" || key == "bus" || key == "target" || \
   16.56 -		    key == "unit") {
   16.57 -			val = $(++rest);
   16.58 -			if (val == "?")	# has above
   16.59 -				continue;
   16.60 -			if (key == "port") {
   16.61 -				# map port macros to static values
   16.62 -				sub ("IO_AHA0", "0x330", val);
   16.63 -				sub ("IO_AHA1", "0x334", val);
   16.64 -				sub ("IO_ASC1", "0x3EB", val);
   16.65 -				sub ("IO_ASC2", "0x22B", val);
   16.66 -				sub ("IO_ASC3", "0x26B", val);
   16.67 -				sub ("IO_ASC4", "0x2AB", val);
   16.68 -				sub ("IO_ASC5", "0x2EB", val);
   16.69 -				sub ("IO_ASC6", "0x32B", val);
   16.70 -				sub ("IO_ASC7", "0x36B", val);
   16.71 -				sub ("IO_ASC8", "0x3AB", val);
   16.72 -				sub ("IO_BT0", "0x330", val);
   16.73 -				sub ("IO_BT1", "0x334", val);
   16.74 -				sub ("IO_CGA", "0x3D0", val);
   16.75 -				sub ("IO_COM1", "0x3F8", val);
   16.76 -				sub ("IO_COM2", "0x2F8", val);
   16.77 -				sub ("IO_COM3", "0x3E8", val);
   16.78 -				sub ("IO_COM4", "0x2E8", val);
   16.79 -				sub ("IO_DMA1", "0x000", val);
   16.80 -				sub ("IO_DMA2", "0x0C0", val);
   16.81 -				sub ("IO_DMAPG", "0x080", val);
   16.82 -				sub ("IO_FD1", "0x3F0", val);
   16.83 -				sub ("IO_FD2", "0x370", val);
   16.84 -				sub ("IO_GAME", "0x201", val);
   16.85 -				sub ("IO_GSC1", "0x270", val);
   16.86 -				sub ("IO_GSC2", "0x2E0", val);
   16.87 -				sub ("IO_GSC3", "0x370", val);
   16.88 -				sub ("IO_GSC4", "0x3E0", val);
   16.89 -				sub ("IO_ICU1", "0x020", val);
   16.90 -				sub ("IO_ICU2", "0x0A0", val);
   16.91 -				sub ("IO_KBD", "0x060", val);
   16.92 -				sub ("IO_LPT1", "0x378", val);
   16.93 -				sub ("IO_LPT2", "0x278", val);
   16.94 -				sub ("IO_LPT3", "0x3BC", val);
   16.95 -				sub ("IO_MDA", "0x3B0", val);
   16.96 -				sub ("IO_NMI", "0x070", val);
   16.97 -				sub ("IO_NPX", "0x0F0", val);
   16.98 -				sub ("IO_PMP1", "0x026", val);
   16.99 -				sub ("IO_PMP2", "0x178", val);
  16.100 -				sub ("IO_PPI", "0x061", val);
  16.101 -				sub ("IO_RTC", "0x070", val);
  16.102 -				sub ("IO_TIMER1", "0x040", val);
  16.103 -				sub ("IO_TIMER2", "0x048", val);
  16.104 -				sub ("IO_UHA0", "0x330", val);
  16.105 -				sub ("IO_VGA", "0x3C0", val);
  16.106 -				sub ("IO_WD1", "0x1F0", val);
  16.107 -				sub ("IO_WD2", "0x170", val);
  16.108 -			} else {
  16.109 -				# map key names
  16.110 -				sub ("iomem", "maddr", key);
  16.111 -				sub ("iosiz", "msize", key);
  16.112 -			}
  16.113 -			printf "hint.%s.%s.%s=\"%s\"\n", name, unit, key, val;
  16.114 -			continue;
  16.115 -		}
  16.116 -		printf ("unrecognized config token '%s:%s' on line %s\n",
  16.117 -			rest, key, NR); # > "/dev/stderr";
  16.118 -	}
  16.119 -}
    17.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/clock.c	Sun Dec 04 18:24:24 2005 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,559 +0,0 @@
    17.4 -/*-
    17.5 - * Copyright (c) 1990 The Regents of the University of California.
    17.6 - * All rights reserved.
    17.7 - *
    17.8 - * This code is derived from software contributed to Berkeley by
    17.9 - * William Jolitz and Don Ahn.
   17.10 - *
   17.11 - * Redistribution and use in source and binary forms, with or without
   17.12 - * modification, are permitted provided that the following conditions
   17.13 - * are met:
   17.14 - * 1. Redistributions of source code must retain the above copyright
   17.15 - *    notice, this list of conditions and the following disclaimer.
   17.16 - * 2. Redistributions in binary form must reproduce the above copyright
   17.17 - *    notice, this list of conditions and the following disclaimer in the
   17.18 - *    documentation and/or other materials provided with the distribution.
   17.19 - * 3. All advertising materials mentioning features or use of this software
   17.20 - *    must display the following acknowledgement:
   17.21 - *	This product includes software developed by the University of
   17.22 - *	California, Berkeley and its contributors.
   17.23 - * 4. Neither the name of the University nor the names of its contributors
   17.24 - *    may be used to endorse or promote products derived from this software
   17.25 - *    without specific prior written permission.
   17.26 - *
   17.27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   17.28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17.29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17.30 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   17.31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   17.32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   17.33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   17.34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   17.35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   17.36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   17.37 - * SUCH DAMAGE.
   17.38 - *
   17.39 - *	from: @(#)clock.c	7.2 (Berkeley) 5/12/91
   17.40 - */
   17.41 -
   17.42 -#include <sys/cdefs.h>
   17.43 -__FBSDID("$FreeBSD: src/sys/i386/isa/clock.c,v 1.207 2003/11/13 10:02:12 phk Exp $");
   17.44 -
   17.45 -/* #define DELAYDEBUG */
   17.46 -/*
   17.47 - * Routines to handle clock hardware.
   17.48 - */
   17.49 -
   17.50 -/*
   17.51 - * inittodr, settodr and support routines written
   17.52 - * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at>
   17.53 - *
   17.54 - * reintroduced and updated by Chris Stenton <chris@gnome.co.uk> 8/10/94
   17.55 - */
   17.56 -
   17.57 -#include "opt_clock.h"
   17.58 -#include "opt_isa.h"
   17.59 -#include "opt_mca.h"
   17.60 -
   17.61 -#include <sys/param.h>
   17.62 -#include <sys/systm.h>
   17.63 -#include <sys/bus.h>
   17.64 -#include <sys/lock.h>
   17.65 -#include <sys/mutex.h>
   17.66 -#include <sys/proc.h>
   17.67 -#include <sys/time.h>
   17.68 -#include <sys/timetc.h>
   17.69 -#include <sys/kernel.h>
   17.70 -#include <sys/limits.h>
   17.71 -#include <sys/sysctl.h>
   17.72 -#include <sys/cons.h>
   17.73 -#include <sys/power.h>
   17.74 -
   17.75 -#include <machine/clock.h>
   17.76 -#include <machine/cputypes.h>
   17.77 -#include <machine/frame.h>
   17.78 -#include <machine/intr_machdep.h>
   17.79 -#include <machine/md_var.h>
   17.80 -#include <machine/psl.h>
   17.81 -#if defined(SMP)
   17.82 -#include <machine/smp.h>
   17.83 -#endif
   17.84 -#include <machine/specialreg.h>
   17.85 -
   17.86 -#include <i386/isa/icu.h>
   17.87 -#include <i386/isa/isa.h>
   17.88 -#include <isa/rtc.h>
   17.89 -#include <i386/isa/timerreg.h>
   17.90 -
   17.91 -/* XEN specific defines */
   17.92 -#include <machine/xen_intr.h>
   17.93 -#include <vm/vm.h>   /* needed by machine/pmap.h */
   17.94 -#include <vm/pmap.h> /* needed by machine/pmap.h */
   17.95 -#include <machine/pmap.h> /* needed by xen-os.h */
   17.96 -#include <machine/hypervisor-ifs.h>
   17.97 -#include <machine/xen-os.h> /* needed by xenfunc.h */
   17.98 -#include <machine/xenfunc.h>
   17.99 -
  17.100 -/*
  17.101 - * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we
  17.102 - * can use a simple formula for leap years.
  17.103 - */
  17.104 -#define	LEAPYEAR(y) (((u_int)(y) % 4 == 0) ? 1 : 0)
  17.105 -#define DAYSPERYEAR   (31+28+31+30+31+30+31+31+30+31+30+31)
  17.106 -
  17.107 -int	adjkerntz;		/* local offset from GMT in seconds */
  17.108 -int	clkintr_pending;
  17.109 -int	disable_rtc_set = 1;	/* disable resettodr() if != 0 */
  17.110 -int	pscnt = 1;
  17.111 -int	psdiv = 1;
  17.112 -int	statclock_disable;
  17.113 -#ifndef TIMER_FREQ
  17.114 -#define TIMER_FREQ   1193182
  17.115 -#endif
  17.116 -u_int	timer_freq = TIMER_FREQ;
  17.117 -struct mtx clock_lock;
  17.118 -
  17.119 -
  17.120 -static	const u_char daysinmonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
  17.121 -
  17.122 -/* Values for timerX_state: */
  17.123 -#define	RELEASED	0
  17.124 -#define	RELEASE_PENDING	1
  17.125 -#define	ACQUIRED	2
  17.126 -#define	ACQUIRE_PENDING	3
  17.127 -
  17.128 -/* Cached *multiplier* to convert TSC counts to microseconds.
  17.129 - * (see the equation below).
  17.130 - * Equal to 2^32 * (1 / (clocks per usec) ).
  17.131 - * Initialized in time_init.
  17.132 - */
  17.133 -static unsigned long fast_gettimeoffset_quotient;
  17.134 -
  17.135 -/* These are peridically updated in shared_info, and then copied here. */
  17.136 -static uint32_t shadow_tsc_stamp;
  17.137 -static uint64_t shadow_system_time;
  17.138 -static uint32_t shadow_time_version;
  17.139 -static struct timeval shadow_tv;
  17.140 -
  17.141 -#define DEFINE_PER_CPU(type, name) \
  17.142 -    __typeof__(type) per_cpu__##name
  17.143 -
  17.144 -#define per_cpu(var, cpu)           (*((void)cpu, &per_cpu__##var))
  17.145 -
  17.146 -
  17.147 -static uint64_t processed_system_time;/* System time (ns) at last processing. */
  17.148 -static DEFINE_PER_CPU(uint64_t, processed_system_time);
  17.149 -
  17.150 -
  17.151 -#define NS_PER_TICK (1000000000ULL/hz)
  17.152 -
  17.153 -/* convert from cycles(64bits) => nanoseconds (64bits)
  17.154 - *  basic equation:
  17.155 - *		ns = cycles / (freq / ns_per_sec)
  17.156 - *		ns = cycles * (ns_per_sec / freq)
  17.157 - *		ns = cycles * (10^9 / (cpu_mhz * 10^6))
  17.158 - *		ns = cycles * (10^3 / cpu_mhz)
  17.159 - *
  17.160 - *	Then we use scaling math (suggested by george@mvista.com) to get:
  17.161 - *		ns = cycles * (10^3 * SC / cpu_mhz) / SC
  17.162 - *		ns = cycles * cyc2ns_scale / SC
  17.163 - *
  17.164 - *	And since SC is a constant power of two, we can convert the div
  17.165 - *  into a shift.   
  17.166 - *			-johnstul@us.ibm.com "math is hard, lets go shopping!"
  17.167 - */
  17.168 -static unsigned long cyc2ns_scale; 
  17.169 -#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
  17.170 -
  17.171 -static inline void set_cyc2ns_scale(unsigned long cpu_mhz)
  17.172 -{
  17.173 -	cyc2ns_scale = (1000 << CYC2NS_SCALE_FACTOR)/cpu_mhz;
  17.174 -}
  17.175 -
  17.176 -static inline unsigned long long cycles_2_ns(unsigned long long cyc)
  17.177 -{
  17.178 -	return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
  17.179 -}
  17.180 -
  17.181 -/*
  17.182 - * Reads a consistent set of time-base values from Xen, into a shadow data
  17.183 - * area. Must be called with the xtime_lock held for writing.
  17.184 - */
  17.185 -static void __get_time_values_from_xen(void)
  17.186 -{
  17.187 -	shared_info_t *s = HYPERVISOR_shared_info;
  17.188 -
  17.189 -	do {
  17.190 -		shadow_time_version = s->time_version2;
  17.191 -		rmb();
  17.192 -		shadow_tv.tv_sec    = s->wc_sec;
  17.193 -		shadow_tv.tv_usec   = s->wc_usec;
  17.194 -		shadow_tsc_stamp    = (uint32_t)s->tsc_timestamp;
  17.195 -		shadow_system_time  = s->system_time;
  17.196 -		rmb();
  17.197 -	}
  17.198 -	while (shadow_time_version != s->time_version1);
  17.199 -}
  17.200 -
  17.201 -#define TIME_VALUES_UP_TO_DATE \
  17.202 -	(shadow_time_version == HYPERVISOR_shared_info->time_version2)
  17.203 -
  17.204 -static	void	(*timer_func)(struct clockframe *frame) = hardclock;
  17.205 -
  17.206 -static	unsigned xen_get_offset(void);
  17.207 -static	unsigned xen_get_timecount(struct timecounter *tc);
  17.208 -
  17.209 -static struct timecounter xen_timecounter = {
  17.210 -	xen_get_timecount,	/* get_timecount */
  17.211 -	0,			/* no poll_pps */
  17.212 -	~0u,			/* counter_mask */
  17.213 -	0,			/* frequency */
  17.214 -	"ixen",			/* name */
  17.215 -	0			/* quality */
  17.216 -};
  17.217 -
  17.218 -
  17.219 -static void 
  17.220 -clkintr(struct clockframe *frame)
  17.221 -{
  17.222 -    int64_t cpu_delta, delta;
  17.223 -    int cpu = smp_processor_id();
  17.224 -    long ticks = 0;
  17.225 -
  17.226 -    do {
  17.227 -    	__get_time_values_from_xen();
  17.228 -    	delta = cpu_delta = (int64_t)shadow_system_time + 
  17.229 -		(int64_t)xen_get_offset() * 1000;
  17.230 -	delta -= processed_system_time;
  17.231 -	cpu_delta -= per_cpu(processed_system_time, cpu);
  17.232 -    } while (!TIME_VALUES_UP_TO_DATE);
  17.233 -
  17.234 -    if (unlikely(delta < 0) || unlikely(cpu_delta < 0)) {
  17.235 -        printk("Timer ISR: Time went backwards: %lld\n", delta);
  17.236 -        return;
  17.237 -    }
  17.238 -
  17.239 -    /* Process elapsed ticks since last call. */
  17.240 -    while ( delta >= NS_PER_TICK )
  17.241 -    {
  17.242 -        ticks++;
  17.243 -        delta -= NS_PER_TICK;
  17.244 -        processed_system_time += NS_PER_TICK;
  17.245 -    }
  17.246 -    /* Local CPU jiffy work. */
  17.247 -    while (cpu_delta >= NS_PER_TICK) {
  17.248 -	    cpu_delta -= NS_PER_TICK;
  17.249 -	    per_cpu(processed_system_time, cpu) += NS_PER_TICK;
  17.250 -#if 0
  17.251 -	    update_process_times(user_mode(regs));
  17.252 -	    profile_tick(CPU_PROFILING, regs);
  17.253 -#endif
  17.254 -    }
  17.255 -    if (ticks > 0) {
  17.256 -	if (frame) timer_func(frame);
  17.257 -    }
  17.258 -    
  17.259 -    if (cpu != 0)
  17.260 -	    return;
  17.261 -    /*
  17.262 -     * Take synchronised time from Xen once a minute if we're not
  17.263 -     * synchronised ourselves, and we haven't chosen to keep an independent
  17.264 -     * time base.
  17.265 -     */
  17.266 -    
  17.267 -    /* XXX TODO */
  17.268 -}
  17.269 -
  17.270 -#include "opt_ddb.h"
  17.271 -static uint32_t
  17.272 -getit(void)
  17.273 -{
  17.274 -	__get_time_values_from_xen();
  17.275 -	return shadow_tsc_stamp;
  17.276 -}
  17.277 -
  17.278 -/*
  17.279 - * Wait "n" microseconds.
  17.280 - * Relies on timer 1 counting down from (timer_freq / hz)
  17.281 - * Note: timer had better have been programmed before this is first used!
  17.282 - */
  17.283 -void
  17.284 -DELAY(int n)
  17.285 -{
  17.286 -	int delta, ticks_left;
  17.287 -	uint32_t tick, prev_tick;
  17.288 -#ifdef DELAYDEBUG
  17.289 -	int getit_calls = 1;
  17.290 -	int n1;
  17.291 -	static int state = 0;
  17.292 -
  17.293 -	if (state == 0) {
  17.294 -		state = 1;
  17.295 -		for (n1 = 1; n1 <= 10000000; n1 *= 10)
  17.296 -			DELAY(n1);
  17.297 -		state = 2;
  17.298 -	}
  17.299 -	if (state == 1)
  17.300 -		printf("DELAY(%d)...", n);
  17.301 -#endif
  17.302 -	/*
  17.303 -	 * Read the counter first, so that the rest of the setup overhead is
  17.304 -	 * counted.  Guess the initial overhead is 20 usec (on most systems it
  17.305 -	 * takes about 1.5 usec for each of the i/o's in getit().  The loop
  17.306 -	 * takes about 6 usec on a 486/33 and 13 usec on a 386/20.  The
  17.307 -	 * multiplications and divisions to scale the count take a while).
  17.308 -	 *
  17.309 -	 * However, if ddb is active then use a fake counter since reading
  17.310 -	 * the i8254 counter involves acquiring a lock.  ddb must not go
  17.311 -	 * locking for many reasons, but it calls here for at least atkbd
  17.312 -	 * input.
  17.313 -	 */
  17.314 -	prev_tick = getit();
  17.315 -
  17.316 -	n -= 0;			/* XXX actually guess no initial overhead */
  17.317 -	/*
  17.318 -	 * Calculate (n * (timer_freq / 1e6)) without using floating point
  17.319 -	 * and without any avoidable overflows.
  17.320 -	 */
  17.321 -	if (n <= 0)
  17.322 -		ticks_left = 0;
  17.323 -	else if (n < 256)
  17.324 -		/*
  17.325 -		 * Use fixed point to avoid a slow division by 1000000.
  17.326 -		 * 39099 = 1193182 * 2^15 / 10^6 rounded to nearest.
  17.327 -		 * 2^15 is the first power of 2 that gives exact results
  17.328 -		 * for n between 0 and 256.
  17.329 -		 */
  17.330 -		ticks_left = ((u_int)n * 39099 + (1 << 15) - 1) >> 15;
  17.331 -	else
  17.332 -		/*
  17.333 -		 * Don't bother using fixed point, although gcc-2.7.2
  17.334 -		 * generates particularly poor code for the long long
  17.335 -		 * division, since even the slow way will complete long
  17.336 -		 * before the delay is up (unless we're interrupted).
  17.337 -		 */
  17.338 -		ticks_left = ((u_int)n * (long long)timer_freq + 999999)
  17.339 -			     / 1000000;
  17.340 -
  17.341 -	while (ticks_left > 0) {
  17.342 -		tick = getit();
  17.343 -#ifdef DELAYDEBUG
  17.344 -		++getit_calls;
  17.345 -#endif
  17.346 -		delta = tick - prev_tick;
  17.347 -		prev_tick = tick;
  17.348 -		if (delta < 0) {
  17.349 -			/*
  17.350 -			 * Guard against timer0_max_count being wrong.
  17.351 -			 * This shouldn't happen in normal operation,
  17.352 -			 * but it may happen if set_timer_freq() is
  17.353 -			 * traced.
  17.354 -			 */
  17.355 -			/* delta += timer0_max_count; ??? */
  17.356 -			if (delta < 0)
  17.357 -				delta = 0;
  17.358 -		}
  17.359 -		ticks_left -= delta;
  17.360 -	}
  17.361 -#ifdef DELAYDEBUG
  17.362 -	if (state == 1)
  17.363 -		printf(" %d calls to getit() at %d usec each\n",
  17.364 -		       getit_calls, (n + 5) / getit_calls);
  17.365 -#endif
  17.366 -}
  17.367 -
  17.368 -
  17.369 -int
  17.370 -sysbeep(int pitch, int period)
  17.371 -{
  17.372 -	return (0);
  17.373 -}
  17.374 -
  17.375 -/*
  17.376 - * Restore all the timers non-atomically (XXX: should be atomically).
  17.377 - *
  17.378 - * This function is called from pmtimer_resume() to restore all the timers.
  17.379 - * This should not be necessary, but there are broken laptops that do not
  17.380 - * restore all the timers on resume.
  17.381 - */
  17.382 -void
  17.383 -timer_restore(void)
  17.384 -{
  17.385 -    /* Get timebases for new environment. */ 
  17.386 -    __get_time_values_from_xen();
  17.387 -
  17.388 -    /* Reset our own concept of passage of system time. */
  17.389 -    processed_system_time = shadow_system_time;
  17.390 -}
  17.391 -
  17.392 -void
  17.393 -startrtclock()
  17.394 -{
  17.395 -	unsigned long long alarm;
  17.396 -	uint64_t __cpu_khz;
  17.397 -	uint32_t cpu_khz;
  17.398 -
  17.399 -	__cpu_khz = HYPERVISOR_shared_info->cpu_freq;
  17.400 -	__cpu_khz /= 1000;
  17.401 -	cpu_khz = (uint32_t)__cpu_khz;
  17.402 -	printk("Xen reported: %lu.%03lu MHz processor.\n", 
  17.403 -	       cpu_khz / 1000, cpu_khz % 1000);
  17.404 -
  17.405 -	/* (10^6 * 2^32) / cpu_hz = (10^3 * 2^32) / cpu_khz =
  17.406 -	   (2^32 * 1 / (clocks/us)) */
  17.407 -	{	
  17.408 -		unsigned long eax=0, edx=1000;
  17.409 -		__asm__("divl %2"
  17.410 -		    :"=a" (fast_gettimeoffset_quotient), "=d" (edx)
  17.411 -		    :"r" (cpu_khz),
  17.412 -		    "0" (eax), "1" (edx));
  17.413 -	}
  17.414 -
  17.415 -	set_cyc2ns_scale(cpu_khz/1000);
  17.416 -	timer_freq = tsc_freq = xen_timecounter.tc_frequency = cpu_khz * 1000;
  17.417 -        tc_init(&xen_timecounter);
  17.418 -
  17.419 -
  17.420 -	rdtscll(alarm);
  17.421 -}
  17.422 -
  17.423 -/*
  17.424 - * Initialize the time of day register, based on the time base which is, e.g.
  17.425 - * from a filesystem.
  17.426 - */
  17.427 -void
  17.428 -inittodr(time_t base)
  17.429 -{
  17.430 -	int		s, y;
  17.431 -	struct timespec ts;
  17.432 -
  17.433 -	s = splclock();
  17.434 -	if (base) {
  17.435 -		ts.tv_sec = base;
  17.436 -		ts.tv_nsec = 0;
  17.437 -		tc_setclock(&ts);
  17.438 -	}
  17.439 -
  17.440 -	y = time_second - shadow_tv.tv_sec;
  17.441 -	if (y <= -2 || y >= 2) {
  17.442 -		/* badly off, adjust it */
  17.443 -		ts.tv_sec = shadow_tv.tv_sec;
  17.444 -		ts.tv_nsec = shadow_tv.tv_usec * 1000;
  17.445 -		tc_setclock(&ts);
  17.446 -	}
  17.447 -	splx(s);
  17.448 -}
  17.449 -
  17.450 -/*
  17.451 - * Write system time back to RTC.  Not supported for guest domains.
  17.452 - */
  17.453 -void
  17.454 -resettodr()
  17.455 -{
  17.456 -}
  17.457 -
  17.458 -
  17.459 -/*
  17.460 - * Start clocks running.
  17.461 - */
  17.462 -void
  17.463 -cpu_initclocks(void)
  17.464 -{
  17.465 -	int diag;
  17.466 -	int time_irq = bind_virq_to_irq(VIRQ_TIMER);
  17.467 -
  17.468 -        if ((diag = intr_add_handler("clk", time_irq,
  17.469 -				     (driver_intr_t *)clkintr, NULL,
  17.470 -				     INTR_TYPE_CLK | INTR_FAST, NULL))) {
  17.471 -		panic("failed to register clock interrupt: %d\n", diag);
  17.472 -	}
  17.473 -
  17.474 -	/* should fast clock be enabled ? */
  17.475 -
  17.476 -	/* initialize xen values */
  17.477 -	__get_time_values_from_xen();
  17.478 -	processed_system_time = shadow_system_time;
  17.479 -	per_cpu(processed_system_time, 0) = processed_system_time;
  17.480 -
  17.481 -}
  17.482 -
  17.483 -#ifdef SMP 
  17.484 -void
  17.485 -ap_cpu_initclocks(void)
  17.486 -{
  17.487 -	int irq;
  17.488 -	int cpu = smp_processor_id();
  17.489 -
  17.490 -	per_cpu(processed_system_time, cpu) = shadow_system_time;
  17.491 -	
  17.492 -	irq = bind_virq_to_irq(VIRQ_TIMER);
  17.493 -	PCPU_SET(time_irq, irq);
  17.494 -	PANIC_IF(intr_add_handler("clk", irq, (driver_intr_t *)clkintr, 
  17.495 -				  NULL, INTR_TYPE_CLK | INTR_FAST, NULL));
  17.496 -}
  17.497 -#endif
  17.498 -
  17.499 -void
  17.500 -cpu_startprofclock(void)
  17.501 -{
  17.502 -
  17.503 -    	printf("cpu_startprofclock: profiling clock is not supported\n");
  17.504 -}
  17.505 -
  17.506 -void
  17.507 -cpu_stopprofclock(void)
  17.508 -{
  17.509 -
  17.510 -    	printf("cpu_stopprofclock: profiling clock is not supported\n");
  17.511 -}
  17.512 -
  17.513 -static uint32_t
  17.514 -xen_get_timecount(struct timecounter *tc)
  17.515 -{
  17.516 -    	__get_time_values_from_xen();
  17.517 -	return shadow_tsc_stamp;
  17.518 -}
  17.519 -
  17.520 -/*
  17.521 - * Track behavior of cur_timer->get_offset() functionality in timer_tsc.c
  17.522 - */
  17.523 -#undef rdtsc
  17.524 -#define rdtsc(low,high) \
  17.525 -     __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
  17.526 -
  17.527 -static uint32_t
  17.528 -xen_get_offset(void)
  17.529 -{
  17.530 -	register unsigned long eax, edx;
  17.531 -
  17.532 -	/* Read the Time Stamp Counter */
  17.533 -
  17.534 -	rdtsc(eax,edx);
  17.535 -
  17.536 -	/* .. relative to previous jiffy (32 bits is enough) */
  17.537 -	eax -= shadow_tsc_stamp;
  17.538 -
  17.539 -	/*
  17.540 -	 * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient
  17.541 -	 *             = (tsc_low delta) * (usecs_per_clock)
  17.542 -	 *             = (tsc_low delta) * (usecs_per_jiffy / clocks_per_jiffy)
  17.543 -	 *
  17.544 -	 * Using a mull instead of a divl saves up to 31 clock cycles
  17.545 -	 * in the critical path.
  17.546 -	 */
  17.547 -
  17.548 -	__asm__("mull %2"
  17.549 -		:"=a" (eax), "=d" (edx)
  17.550 -		:"rm" (fast_gettimeoffset_quotient),
  17.551 -		 "0" (eax));
  17.552 -
  17.553 -	/* our adjusted time offset in microseconds */
  17.554 -	return edx;
  17.555 -}
  17.556 -
  17.557 -void
  17.558 -idle_block(void)
  17.559 -{
  17.560 -	if (HYPERVISOR_set_timer_op(processed_system_time + NS_PER_TICK) == 0)
  17.561 -		HYPERVISOR_block();
  17.562 -}
    18.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/critical.c	Sun Dec 04 18:24:24 2005 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,46 +0,0 @@
    18.4 -/*-
    18.5 - * Copyright (c) 2002 Matthew Dillon.  All Rights Reserved.
    18.6 - * Redistribution and use in source and binary forms, with or without
    18.7 - * modification, are permitted provided that the following conditions
    18.8 - * are met:
    18.9 - * 1. Redistributions of source code must retain the above copyright
   18.10 - *    notice, this list of conditions and the following disclaimer.
   18.11 - * 2. Redistributions in binary form must reproduce the above copyright
   18.12 - *    notice, this list of conditions and the following disclaimer in the
   18.13 - *    documentation and/or other materials provided with the distribution.
   18.14 - * 4. Neither the name of the University nor the names of its contributors
   18.15 - *    may be used to endorse or promote products derived from this software
   18.16 - *    without specific prior written permission.
   18.17 - *
   18.18 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
   18.19 - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   18.20 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18.21 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
   18.22 - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   18.23 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
   18.24 - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   18.25 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   18.26 - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   18.27 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   18.28 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   18.29 - */
   18.30 -
   18.31 -#include <sys/cdefs.h>
   18.32 -__FBSDID("$FreeBSD: src/sys/i386/i386/critical.c,v 1.12 2003/11/03 21:06:54 jhb Exp $");
   18.33 -
   18.34 -#include <sys/param.h>
   18.35 -#include <sys/systm.h>
   18.36 -#include <sys/proc.h>
   18.37 -#include <machine/critical.h>
   18.38 -#include <machine/psl.h>
   18.39 -
   18.40 -/*
   18.41 - * cpu_critical_fork_exit() - cleanup after fork
   18.42 - *
   18.43 - *	Enable interrupts in the saved copy of eflags.
   18.44 - */
   18.45 -void
   18.46 -cpu_critical_fork_exit(void)
   18.47 -{
   18.48 -    curthread->td_md.md_savecrit = 0;
   18.49 -}
    19.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/ctrl_if.c	Sun Dec 04 18:24:24 2005 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,533 +0,0 @@
    19.4 -/******************************************************************************
    19.5 - * ctrl_if.c
    19.6 - * 
    19.7 - * Management functions for special interface to the domain controller.
    19.8 - * 
    19.9 - * Copyright (c) 2004, K A Fraser
   19.10 - * Copyright (c) 2004, K M Macy
   19.11 - */
   19.12 -
   19.13 -#include <sys/param.h>
   19.14 -#include <sys/systm.h>
   19.15 -#include <sys/uio.h>
   19.16 -#include <sys/bus.h>
   19.17 -#include <sys/malloc.h>
   19.18 -#include <sys/kernel.h>
   19.19 -#include <sys/lock.h>
   19.20 -#include <sys/mutex.h>
   19.21 -#include <sys/selinfo.h>
   19.22 -#include <sys/poll.h>
   19.23 -#include <sys/conf.h>
   19.24 -#include <sys/fcntl.h>
   19.25 -#include <sys/ioccom.h>
   19.26 -#include <sys/taskqueue.h>
   19.27 -
   19.28 -
   19.29 -#include <machine/cpufunc.h>
   19.30 -#include <machine/intr_machdep.h>
   19.31 -#include <machine/xen-os.h>
   19.32 -#include <machine/xen_intr.h>
   19.33 -#include <machine/bus.h>
   19.34 -#include <sys/rman.h>
   19.35 -#include <machine/resource.h>
   19.36 -#include <machine/synch_bitops.h>
   19.37 -
   19.38 -
   19.39 -#include <machine/hypervisor-ifs.h>
   19.40 -
   19.41 -#include <machine/ctrl_if.h>
   19.42 -#include <machine/evtchn.h>
   19.43 -
   19.44 -/*
   19.45 - * Extra ring macros to sync a consumer index up to the public producer index. 
   19.46 - * Generally UNSAFE, but we use it for recovery and shutdown in some cases.
   19.47 - */
   19.48 -#define RING_DROP_PENDING_REQUESTS(_r)                                  \
   19.49 -    do {                                                                \
   19.50 -        (_r)->req_cons = (_r)->sring->req_prod;                         \
   19.51 -    } while (0)
   19.52 -#define RING_DROP_PENDING_RESPONSES(_r)                                 \
   19.53 -    do {                                                                \
   19.54 -        (_r)->rsp_cons = (_r)->sring->rsp_prod;                         \
   19.55 -    } while (0)
   19.56 -/*
   19.57 - * Only used by initial domain which must create its own control-interface
   19.58 - * event channel. This value is picked up by the user-space domain controller
   19.59 - * via an ioctl.
   19.60 - */
   19.61 -int initdom_ctrlif_domcontroller_port = -1;
   19.62 -
   19.63 -static int        ctrl_if_evtchn;
   19.64 -static int        ctrl_if_irq;
   19.65 -static struct mtx ctrl_if_lock;
   19.66 -static int *      ctrl_if_wchan = &ctrl_if_evtchn;
   19.67 -
   19.68 -
   19.69 -static ctrl_front_ring_t ctrl_if_tx_ring;
   19.70 -static ctrl_back_ring_t  ctrl_if_rx_ring;
   19.71 -
   19.72 -/* Incoming message requests. */
   19.73 -    /* Primary message type -> message handler. */
   19.74 -static ctrl_msg_handler_t ctrl_if_rxmsg_handler[256];
   19.75 -    /* Primary message type -> callback in process context? */
   19.76 -static unsigned long ctrl_if_rxmsg_blocking_context[256/sizeof(unsigned long)];
   19.77 -    /* Queue up messages to be handled in process context. */
   19.78 -static ctrl_msg_t ctrl_if_rxmsg_deferred[CONTROL_RING_SIZE];
   19.79 -static CONTROL_RING_IDX ctrl_if_rxmsg_deferred_prod;
   19.80 -static CONTROL_RING_IDX ctrl_if_rxmsg_deferred_cons;
   19.81 -
   19.82 -/* Incoming message responses: message identifier -> message handler/id. */
   19.83 -static struct {
   19.84 -    ctrl_msg_handler_t fn;
   19.85 -    unsigned long      id;
   19.86 -} ctrl_if_txmsg_id_mapping[CONTROL_RING_SIZE];
   19.87 -
   19.88 -/*
   19.89 - * FreeBSD task queues don't allow you to requeue an already executing task.
   19.90 - * Since ctrl_if_interrupt clears the TX_FULL condition and schedules any 
   19.91 - * waiting tasks, which themselves may need to schedule a new task 
   19.92 - * (due to new a TX_FULL condition), we ping-pong between these A/B task queues.
   19.93 - * The interrupt runs anything on the current queue and moves the index so that
   19.94 - * future schedulings occur on the next queue.  We should never get into a 
   19.95 - * situation where there is a task scheduleded on both the A & B queues.
   19.96 - */
   19.97 -TASKQUEUE_DECLARE(ctrl_if_txA);
   19.98 -TASKQUEUE_DEFINE(ctrl_if_txA, NULL, NULL, {});
   19.99 -TASKQUEUE_DECLARE(ctrl_if_txB);
  19.100 -TASKQUEUE_DEFINE(ctrl_if_txB, NULL, NULL, {});
  19.101 -struct taskqueue **taskqueue_ctrl_if_tx[2] = { &taskqueue_ctrl_if_txA,
  19.102 -    				               &taskqueue_ctrl_if_txB };
  19.103 -static int ctrl_if_idx = 0;
  19.104 -
  19.105 -static struct task ctrl_if_rx_tasklet;
  19.106 -static struct task ctrl_if_tx_tasklet;
  19.107 -    /* Passed to schedule_task(). */
  19.108 -static struct task ctrl_if_rxmsg_deferred_task;
  19.109 -
  19.110 -
  19.111 -
  19.112 -#define get_ctrl_if() ((control_if_t *)((char *)HYPERVISOR_shared_info + 2048))
  19.113 -
  19.114 -static void 
  19.115 -ctrl_if_notify_controller(void)
  19.116 -{
  19.117 -    notify_via_evtchn(ctrl_if_evtchn);
  19.118 -}
  19.119 -
  19.120 -static void 
  19.121 -ctrl_if_rxmsg_default_handler(ctrl_msg_t *msg, unsigned long id)
  19.122 -{
  19.123 -    msg->length = 0;
  19.124 -    ctrl_if_send_response(msg);
  19.125 -}
  19.126 -
  19.127 -static void 
  19.128 -__ctrl_if_tx_tasklet(void *context __unused, int pending __unused)
  19.129 -{
  19.130 -    ctrl_msg_t   *msg;
  19.131 -    int           was_full = RING_FULL(&ctrl_if_tx_ring);
  19.132 -    RING_IDX      i, rp;
  19.133 -
  19.134 -    i  = ctrl_if_tx_ring.rsp_cons;
  19.135 -    rp = ctrl_if_tx_ring.sring->rsp_prod;
  19.136 -    rmb(); /* Ensure we see all requests up to 'rp'. */
  19.137 -
  19.138 -    for ( ; i != rp; i++ )
  19.139 -    {
  19.140 -        msg = RING_GET_RESPONSE(&ctrl_if_tx_ring, i);
  19.141 -
  19.142 -        /* Execute the callback handler, if one was specified. */
  19.143 -        if ( msg->id != 0xFF )
  19.144 -        {
  19.145 -            (*ctrl_if_txmsg_id_mapping[msg->id].fn)(
  19.146 -                msg, ctrl_if_txmsg_id_mapping[msg->id].id);
  19.147 -            smp_mb(); /* Execute, /then/ free. */
  19.148 -            ctrl_if_txmsg_id_mapping[msg->id].fn = NULL;
  19.149 -        }
  19.150 -
  19.151 -    }
  19.152 -
  19.153 -    /*
  19.154 -     * Step over the message in the ring /after/ finishing reading it. As 
  19.155 -     * soon as the index is updated then the message may get blown away.
  19.156 -     */
  19.157 -    smp_mb();
  19.158 -    ctrl_if_tx_ring.rsp_cons = i;
  19.159 -
  19.160 -    if ( was_full && !RING_FULL(&ctrl_if_tx_ring) )
  19.161 -    {
  19.162 -        wakeup(ctrl_if_wchan);
  19.163 -
  19.164 -	/* bump idx so future enqueues will occur on the next taskq
  19.165 -	 * process any currently pending tasks
  19.166 -	 */
  19.167 -	ctrl_if_idx++;
  19.168 -        taskqueue_run(*taskqueue_ctrl_if_tx[(ctrl_if_idx-1) & 1]);
  19.169 -    }
  19.170 -
  19.171 -}
  19.172 -
  19.173 -static void 
  19.174 -__ctrl_if_rxmsg_deferred_task(void *context __unused, int pending __unused)
  19.175 -{
  19.176 -    ctrl_msg_t *msg;
  19.177 -    CONTROL_RING_IDX dp;
  19.178 -
  19.179 -    dp = ctrl_if_rxmsg_deferred_prod;
  19.180 -    rmb(); /* Ensure we see all deferred requests up to 'dp'. */
  19.181 -    
  19.182 -    while ( ctrl_if_rxmsg_deferred_cons != dp )
  19.183 -    {
  19.184 -        msg = &ctrl_if_rxmsg_deferred[MASK_CONTROL_IDX(
  19.185 -            ctrl_if_rxmsg_deferred_cons++)];
  19.186 -        (*ctrl_if_rxmsg_handler[msg->type])(msg, 0);
  19.187 -    }
  19.188 -    
  19.189 -}
  19.190 -
  19.191 -static void 
  19.192 -__ctrl_if_rx_tasklet(void *context __unused, int pending __unused)
  19.193 -{
  19.194 -    ctrl_msg_t    msg, *pmsg;
  19.195 -    CONTROL_RING_IDX dp;
  19.196 -    RING_IDX rp, i;
  19.197 -
  19.198 -    i  = ctrl_if_rx_ring.req_cons;
  19.199 -    rp = ctrl_if_rx_ring.sring->req_prod;
  19.200 -    dp = ctrl_if_rxmsg_deferred_prod;
  19.201 -
  19.202 -    rmb(); /* Ensure we see all requests up to 'rp'. */
  19.203 -    
  19.204 -    for ( ; i != rp; i++) 
  19.205 -    {
  19.206 -        pmsg = RING_GET_REQUEST(&ctrl_if_rx_ring, i);
  19.207 -        memcpy(&msg, pmsg, offsetof(ctrl_msg_t, msg));
  19.208 -	
  19.209 -	if ( msg.length > sizeof(msg.msg))
  19.210 -	    msg.length = sizeof(msg.msg);
  19.211 -        if ( msg.length != 0 )
  19.212 -            memcpy(msg.msg, pmsg->msg, msg.length);
  19.213 -        if ( test_bit(msg.type, &ctrl_if_rxmsg_blocking_context) )
  19.214 -        {
  19.215 -            memcpy(&ctrl_if_rxmsg_deferred[MASK_CONTROL_IDX(dp++)], 
  19.216 -		    &msg, offsetof(ctrl_msg_t, msg) + msg.length);
  19.217 -        }
  19.218 -        else
  19.219 -        {
  19.220 -            (*ctrl_if_rxmsg_handler[msg.type])(&msg, 0);
  19.221 -        }
  19.222 -    }
  19.223 -    ctrl_if_rx_ring.req_cons = i;
  19.224 -
  19.225 -    if ( dp != ctrl_if_rxmsg_deferred_prod )
  19.226 -    {
  19.227 -        wmb();
  19.228 -        ctrl_if_rxmsg_deferred_prod = dp;
  19.229 -        taskqueue_enqueue(taskqueue_thread, &ctrl_if_rxmsg_deferred_task);
  19.230 -    }
  19.231 -
  19.232 -}
  19.233 -
  19.234 -static void 
  19.235 -ctrl_if_interrupt(void *ctrl_sc)
  19.236 -/* (int irq, void *dev_id, struct pt_regs *regs) */
  19.237 -{
  19.238 -
  19.239 -    
  19.240 -    if ( RING_HAS_UNCONSUMED_RESPONSES(&ctrl_if_tx_ring) )
  19.241 -	taskqueue_enqueue(taskqueue_swi, &ctrl_if_tx_tasklet);
  19.242 -    
  19.243 -
  19.244 -    if ( RING_HAS_UNCONSUMED_REQUESTS(&ctrl_if_rx_ring) )
  19.245 - 	taskqueue_enqueue(taskqueue_swi, &ctrl_if_rx_tasklet);
  19.246 -    
  19.247 -}
  19.248 -
  19.249 -int 
  19.250 -ctrl_if_send_message_noblock(
  19.251 -    ctrl_msg_t *msg, 
  19.252 -    ctrl_msg_handler_t hnd,
  19.253 -    unsigned long id)
  19.254 -{
  19.255 -    unsigned long flags;
  19.256 -    ctrl_msg_t   *dmsg;
  19.257 -    int           i;
  19.258 -
  19.259 -    mtx_lock_irqsave(&ctrl_if_lock, flags);
  19.260 -
  19.261 -    if ( RING_FULL(&ctrl_if_tx_ring) )
  19.262 -    {
  19.263 -        mtx_unlock_irqrestore(&ctrl_if_lock, flags);
  19.264 -        return EAGAIN;
  19.265 -    }
  19.266 -
  19.267 -    msg->id = 0xFF;
  19.268 -    if ( hnd != NULL )
  19.269 -    {
  19.270 -        for ( i = 0; ctrl_if_txmsg_id_mapping[i].fn != NULL; i++ )
  19.271 -            continue;
  19.272 -        ctrl_if_txmsg_id_mapping[i].fn = hnd;
  19.273 -        ctrl_if_txmsg_id_mapping[i].id = id;
  19.274 -        msg->id = i;
  19.275 -    }
  19.276 -
  19.277 -    dmsg = RING_GET_REQUEST(&ctrl_if_tx_ring, 
  19.278 -            ctrl_if_tx_ring.req_prod_pvt);
  19.279 -    memcpy(dmsg, msg, sizeof(*msg));
  19.280 -    ctrl_if_tx_ring.req_prod_pvt++;
  19.281 -    RING_PUSH_REQUESTS(&ctrl_if_tx_ring);
  19.282 -
  19.283 -    mtx_unlock_irqrestore(&ctrl_if_lock, flags);
  19.284 -
  19.285 -    ctrl_if_notify_controller();
  19.286 -
  19.287 -    return 0;
  19.288 -}
  19.289 -
  19.290 -int 
  19.291 -ctrl_if_send_message_block(
  19.292 -    ctrl_msg_t *msg, 
  19.293 -    ctrl_msg_handler_t hnd, 
  19.294 -    unsigned long id,
  19.295 -    long wait_state)
  19.296 -{
  19.297 -    int rc, sst = 0;
  19.298 -    
  19.299 -    /* Fast path. */
  19.300 -    if ( (rc = ctrl_if_send_message_noblock(msg, hnd, id)) != EAGAIN ) 
  19.301 -        goto done;
  19.302 -    
  19.303 -    for ( ; ; )
  19.304 -    {
  19.305 -
  19.306 -        if ( (rc = ctrl_if_send_message_noblock(msg, hnd, id)) != EAGAIN )
  19.307 -            break;
  19.308 -
  19.309 -        if ( sst != 0) {
  19.310 -	    rc = EINTR;
  19.311 -	    goto done;
  19.312 -	}
  19.313 -
  19.314 -        sst = tsleep(ctrl_if_wchan, PWAIT|PCATCH, "ctlrwt", 10);
  19.315 -    }
  19.316 - done:
  19.317 -    
  19.318 -    return rc;
  19.319 -}
  19.320 -
  19.321 -int 
  19.322 -ctrl_if_enqueue_space_callback(struct task *task)
  19.323 -{
  19.324 -
  19.325 -    /* Fast path. */
  19.326 -    if ( !RING_FULL(&ctrl_if_tx_ring) )
  19.327 -        return 0;
  19.328 -
  19.329 -    (void)taskqueue_enqueue(*taskqueue_ctrl_if_tx[(ctrl_if_idx & 1)], task);
  19.330 -
  19.331 -    /*
  19.332 -     * We may race execution of the task queue, so return re-checked status. If
  19.333 -     * the task is not executed despite the ring being non-full then we will
  19.334 -     * certainly return 'not full'.
  19.335 -     */
  19.336 -    smp_mb();
  19.337 -    return RING_FULL(&ctrl_if_tx_ring);
  19.338 -}
  19.339 -
  19.340 -void 
  19.341 -ctrl_if_send_response(ctrl_msg_t *msg)
  19.342 -{
  19.343 -    unsigned long flags;
  19.344 -    ctrl_msg_t   *dmsg;
  19.345 -
  19.346 -    /*
  19.347 -     * NB. The response may the original request message, modified in-place.
  19.348 -     * In this situation we may have src==dst, so no copying is required.
  19.349 -     */
  19.350 -    mtx_lock_irqsave(&ctrl_if_lock, flags);
  19.351 -    dmsg =  RING_GET_RESPONSE(&ctrl_if_rx_ring, 
  19.352 -			      ctrl_if_rx_ring.rsp_prod_pvt);
  19.353 -    if ( dmsg != msg )
  19.354 -        memcpy(dmsg, msg, sizeof(*msg));
  19.355 - 
  19.356 -    ctrl_if_rx_ring.rsp_prod_pvt++;
  19.357 -    RING_PUSH_RESPONSES(&ctrl_if_rx_ring);
  19.358 -
  19.359 -    mtx_unlock_irqrestore(&ctrl_if_lock, flags);
  19.360 -
  19.361 -    ctrl_if_notify_controller();
  19.362 -}
  19.363 -
  19.364 -int 
  19.365 -ctrl_if_register_receiver(
  19.366 -    uint8_t type, 
  19.367 -    ctrl_msg_handler_t hnd, 
  19.368 -    unsigned int flags)
  19.369 -{
  19.370 -    unsigned long _flags;
  19.371 -    int inuse;
  19.372 -    
  19.373 -    mtx_lock_irqsave(&ctrl_if_lock, _flags);
  19.374 -
  19.375 -    inuse = (ctrl_if_rxmsg_handler[type] != ctrl_if_rxmsg_default_handler);
  19.376 -
  19.377 -    if ( inuse )
  19.378 -    {
  19.379 -        printk("Receiver %p already established for control "
  19.380 -               "messages of type %d.\n", ctrl_if_rxmsg_handler[type], type);
  19.381 -    }
  19.382 -    else
  19.383 -    {
  19.384 -        ctrl_if_rxmsg_handler[type] = hnd;
  19.385 -        clear_bit(type, &ctrl_if_rxmsg_blocking_context);
  19.386 -        if ( flags == CALLBACK_IN_BLOCKING_CONTEXT )
  19.387 -        {
  19.388 -            set_bit(type, &ctrl_if_rxmsg_blocking_context);
  19.389 -        }
  19.390 -    }
  19.391 -
  19.392 -    mtx_unlock_irqrestore(&ctrl_if_lock, _flags);
  19.393 -    
  19.394 -    return !inuse;
  19.395 -}
  19.396 -
  19.397 -void 
  19.398 -ctrl_if_unregister_receiver(uint8_t type, ctrl_msg_handler_t hnd)
  19.399 -{
  19.400 -    unsigned long flags;
  19.401 -
  19.402 -    mtx_lock_irqsave(&ctrl_if_lock, flags);
  19.403 -
  19.404 -    if ( ctrl_if_rxmsg_handler[type] != hnd )
  19.405 -        printk("Receiver %p is not registered for control "
  19.406 -               "messages of type %d.\n", hnd, type);
  19.407 -    else
  19.408 -        ctrl_if_rxmsg_handler[type] = ctrl_if_rxmsg_default_handler;
  19.409 -
  19.410 -    mtx_unlock_irqrestore(&ctrl_if_lock, flags);
  19.411 -
  19.412 -    /* Ensure that @hnd will not be executed after this function returns. */
  19.413 -    /* XXX need rx_tasklet_lock -- can cheat for now?*/
  19.414 -#ifdef notyet
  19.415 -    tasklet_unlock_wait(&ctrl_if_rx_tasklet);
  19.416 -#endif
  19.417 -}
  19.418 -
  19.419 -void 
  19.420 -ctrl_if_suspend(void)
  19.421 -{
  19.422 -    /* I'm not sure what the equivalent is - we aren't going to support suspend 
  19.423 -     * yet anyway 
  19.424 -     */
  19.425 -#ifdef notyet
  19.426 -    free_irq(ctrl_if_irq, NULL);
  19.427 -#endif
  19.428 -    unbind_evtchn_from_irq(ctrl_if_evtchn);
  19.429 -}
  19.430 - 
  19.431 -#if 0
  19.432 -/** Reset the control interface progress pointers.
  19.433 - * Marks the queues empty if 'clear' non-zero.
  19.434 - */
  19.435 -static void 
  19.436 -ctrl_if_reset(int clear)
  19.437 -{
  19.438 -    control_if_t *ctrl_if = get_ctrl_if();
  19.439 -
  19.440 -    if (clear) {
  19.441 -	*ctrl_if = (control_if_t){};
  19.442 -    }
  19.443 -    
  19.444 -    ctrl_if_tx_resp_cons = ctrl_if->tx_resp_prod;
  19.445 -    ctrl_if_rx_req_cons  = ctrl_if->rx_resp_prod;
  19.446 -}
  19.447 -
  19.448 -#endif
  19.449 -void 
  19.450 -ctrl_if_resume(void)
  19.451 -{
  19.452 -    control_if_t *ctrl_if = get_ctrl_if();
  19.453 -
  19.454 -    TRACE_ENTER;
  19.455 -    if ( xen_start_info->flags & SIF_INITDOMAIN )
  19.456 -    {
  19.457 -        /*
  19.458 -         * The initial domain must create its own domain-controller link.
  19.459 -         * The controller is probably not running at this point, but will
  19.460 -         * pick up its end of the event channel from 
  19.461 -         */
  19.462 -        evtchn_op_t op;
  19.463 -        op.cmd = EVTCHNOP_bind_interdomain;
  19.464 -        op.u.bind_interdomain.dom1 = DOMID_SELF;
  19.465 -        op.u.bind_interdomain.dom2 = DOMID_SELF;
  19.466 -        op.u.bind_interdomain.port1 = 0;
  19.467 -        op.u.bind_interdomain.port2 = 0;
  19.468 -        if ( HYPERVISOR_event_channel_op(&op) != 0 )
  19.469 -            panic("event_channel_op failed\n");
  19.470 -        xen_start_info->domain_controller_evtchn = op.u.bind_interdomain.port1;
  19.471 -        initdom_ctrlif_domcontroller_port   = op.u.bind_interdomain.port2;
  19.472 -    }
  19.473 -    
  19.474 -
  19.475 -    /* Sync up with shared indexes. */
  19.476 -    FRONT_RING_ATTACH(&ctrl_if_tx_ring, &ctrl_if->tx_ring, CONTROL_RING_MEM);
  19.477 -    BACK_RING_ATTACH(&ctrl_if_rx_ring, &ctrl_if->rx_ring, CONTROL_RING_MEM);
  19.478 -
  19.479 -    ctrl_if_evtchn = xen_start_info->domain_controller_evtchn;
  19.480 -    ctrl_if_irq    = bind_evtchn_to_irq(ctrl_if_evtchn);
  19.481 -    
  19.482 -    /*
  19.483 -     * I have not taken the time to determine what the interrupt thread priorities
  19.484 -     * correspond to - this interface is used for network and disk, network would
  19.485 -     * seem higher priority, hence I'm using it
  19.486 -     */
  19.487 -
  19.488 -    intr_add_handler("ctrl-if", ctrl_if_irq, (driver_intr_t*)ctrl_if_interrupt,
  19.489 -		     NULL, INTR_TYPE_NET, NULL);
  19.490 -    TRACE_EXIT;
  19.491 -    /* XXX currently assuming not MPSAFE */ 
  19.492 -}
  19.493 -
  19.494 -static void 
  19.495 -ctrl_if_init(void *dummy __unused)
  19.496 -{
  19.497 -    control_if_t *ctrl_if = get_ctrl_if();
  19.498 -
  19.499 -    int i;
  19.500 -
  19.501 -    for ( i = 0; i < 256; i++ )
  19.502 -        ctrl_if_rxmsg_handler[i] = ctrl_if_rxmsg_default_handler;
  19.503 -    
  19.504 -    FRONT_RING_ATTACH(&ctrl_if_tx_ring, &ctrl_if->tx_ring, CONTROL_RING_MEM);
  19.505 -    BACK_RING_ATTACH(&ctrl_if_rx_ring, &ctrl_if->rx_ring, CONTROL_RING_MEM);
  19.506 -
  19.507 -    mtx_init(&ctrl_if_lock, "ctrlif", NULL, MTX_SPIN | MTX_NOWITNESS);
  19.508 -    
  19.509 -    TASK_INIT(&ctrl_if_tx_tasklet, 0, __ctrl_if_tx_tasklet, NULL);
  19.510 -
  19.511 -    TASK_INIT(&ctrl_if_rx_tasklet, 0, __ctrl_if_rx_tasklet, NULL);
  19.512 -
  19.513 -    TASK_INIT(&ctrl_if_rxmsg_deferred_task, 0, __ctrl_if_rxmsg_deferred_task, NULL);
  19.514 -
  19.515 -
  19.516 -    ctrl_if_resume();
  19.517 -}
  19.518 -
  19.519 -/*
  19.520 - * !! The following are DANGEROUS FUNCTIONS !!
  19.521 - * Use with care [for example, see xencons_force_flush()].
  19.522 - */
  19.523 -
  19.524 -int 
  19.525 -ctrl_if_transmitter_empty(void)
  19.526 -{
  19.527 -    return (ctrl_if_tx_ring.sring->req_prod == ctrl_if_tx_ring.rsp_cons);
  19.528 -}
  19.529 -
  19.530 -void 
  19.531 -ctrl_if_discard_responses(void)
  19.532 -{
  19.533 -    RING_DROP_PENDING_RESPONSES(&ctrl_if_tx_ring);
  19.534 -}
  19.535 -
  19.536 -SYSINIT(ctrl_if_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, ctrl_if_init, NULL);
    20.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/db_interface.c	Sun Dec 04 18:24:24 2005 +0100
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,209 +0,0 @@
    20.4 -/*
    20.5 - * Mach Operating System
    20.6 - * Copyright (c) 1991,1990 Carnegie Mellon University
    20.7 - * All Rights Reserved.
    20.8 - *
    20.9 - * Permission to use, copy, modify and distribute this software and its
   20.10 - * documentation is hereby granted, provided that both the copyright
   20.11 - * notice and this permission notice appear in all copies of the
   20.12 - * software, derivative works or modified versions, and any portions
   20.13 - * thereof, and that both notices appear in supporting documentation.
   20.14 - *
   20.15 - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
   20.16 - * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   20.17 - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   20.18 - *
   20.19 - * Carnegie Mellon requests users of this software to return to
   20.20 - *
   20.21 - *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   20.22 - *  School of Computer Science
   20.23 - *  Carnegie Mellon University
   20.24 - *  Pittsburgh PA 15213-3890
   20.25 - *
   20.26 - * any improvements or extensions that they make and grant Carnegie the
   20.27 - * rights to redistribute these changes.
   20.28 - */
   20.29 -
   20.30 -#include <sys/cdefs.h>
   20.31 -__FBSDID("$FreeBSD: src/sys/i386/i386/db_interface.c,v 1.77 2003/11/08 03:01:26 alc Exp $");
   20.32 -
   20.33 -/*
   20.34 - * Interface to new debugger.
   20.35 - */
   20.36 -#include <sys/param.h>
   20.37 -#include <sys/systm.h>
   20.38 -#include <sys/reboot.h>
   20.39 -#include <sys/cons.h>
   20.40 -#include <sys/pcpu.h>
   20.41 -#include <sys/proc.h>
   20.42 -#include <sys/smp.h>
   20.43 -
   20.44 -#include <machine/cpu.h>
   20.45 -#ifdef SMP
   20.46 -#include <machine/smptests.h>	/** CPUSTOP_ON_DDBBREAK */
   20.47 -#endif
   20.48 -
   20.49 -#include <vm/vm.h>
   20.50 -#include <vm/pmap.h>
   20.51 -
   20.52 -#include <ddb/ddb.h>
   20.53 -
   20.54 -#include <machine/setjmp.h>
   20.55 -#include <machine/xenfunc.h>
   20.56 -
   20.57 -
   20.58 -static jmp_buf *db_nofault = 0;
   20.59 -extern jmp_buf	db_jmpbuf;
   20.60 -
   20.61 -extern void	gdb_handle_exception(db_regs_t *, int, int);
   20.62 -
   20.63 -int	db_active;
   20.64 -db_regs_t ddb_regs;
   20.65 -
   20.66 -static __inline u_short
   20.67 -rss(void)
   20.68 -{
   20.69 -	u_short ss;
   20.70 -#ifdef __GNUC__
   20.71 -	__asm __volatile("mov %%ss,%0" : "=r" (ss));
   20.72 -#else
   20.73 -	ss = 0; /* XXXX Fix for other compilers. */
   20.74 -#endif
   20.75 -	return ss;
   20.76 -}
   20.77 -
   20.78 -/*
   20.79 - *  kdb_trap - field a TRACE or BPT trap
   20.80 - */
   20.81 -int
   20.82 -kdb_trap(int type, int code, struct i386_saved_state *regs)
   20.83 -{
   20.84 -	volatile int ddb_mode = !(boothowto & RB_GDB);
   20.85 -
   20.86 -	disable_intr();
   20.87 -
   20.88 -	if (ddb_mode) {
   20.89 -	    	/* we can't do much as a guest domain except print a 
   20.90 -		 * backtrace and die gracefuly.  The reason is that we
   20.91 -		 * can't get character input to make this work.
   20.92 -		 */
   20.93 -	    	db_active = 1;
   20.94 -		db_print_backtrace(); 
   20.95 -		db_printf("************ Domain shutting down ************\n");
   20.96 -		HYPERVISOR_shutdown();
   20.97 -	} else {
   20.98 -	    	Debugger("kdb_trap");
   20.99 -	}
  20.100 -	return (1);
  20.101 -}
  20.102 -
  20.103 -/*
  20.104 - * Read bytes from kernel address space for debugger.
  20.105 - */
  20.106 -void
  20.107 -db_read_bytes(vm_offset_t addr, size_t size, char *data)
  20.108 -{
  20.109 -	char	*src;
  20.110 -
  20.111 -	db_nofault = &db_jmpbuf;
  20.112 -
  20.113 -	src = (char *)addr;
  20.114 -	while (size-- > 0)
  20.115 -	    *data++ = *src++;
  20.116 -
  20.117 -	db_nofault = 0;
  20.118 -}
  20.119 -
  20.120 -/*
  20.121 - * Write bytes to kernel address space for debugger.
  20.122 - */
  20.123 -void
  20.124 -db_write_bytes(vm_offset_t addr, size_t size, char *data)
  20.125 -{
  20.126 -	char	*dst;
  20.127 -
  20.128 -	pt_entry_t	*ptep0 = NULL;
  20.129 -	pt_entry_t	oldmap0 = 0;
  20.130 -	vm_offset_t	addr1;
  20.131 -	pt_entry_t	*ptep1 = NULL;
  20.132 -	pt_entry_t	oldmap1 = 0;
  20.133 -
  20.134 -	db_nofault = &db_jmpbuf;
  20.135 -
  20.136 -	if (addr > trunc_page((vm_offset_t)btext) - size &&
  20.137 -	    addr < round_page((vm_offset_t)etext)) {
  20.138 -
  20.139 -	    ptep0 = pmap_pte(kernel_pmap, addr);
  20.140 -	    oldmap0 = *ptep0;
  20.141 -	    *ptep0 |= PG_RW;
  20.142 -
  20.143 -	    /* Map another page if the data crosses a page boundary. */
  20.144 -	    if ((*ptep0 & PG_PS) == 0) {
  20.145 -	    	addr1 = trunc_page(addr + size - 1);
  20.146 -	    	if (trunc_page(addr) != addr1) {
  20.147 -		    ptep1 = pmap_pte(kernel_pmap, addr1);
  20.148 -		    oldmap1 = *ptep1;
  20.149 -		    *ptep1 |= PG_RW;
  20.150 -	    	}
  20.151 -	    } else {
  20.152 -		addr1 = trunc_4mpage(addr + size - 1);
  20.153 -		if (trunc_4mpage(addr) != addr1) {
  20.154 -		    ptep1 = pmap_pte(kernel_pmap, addr1);
  20.155 -		    oldmap1 = *ptep1;
  20.156 -		    *ptep1 |= PG_RW;
  20.157 -		}
  20.158 -	    }
  20.159 -
  20.160 -	    invltlb();
  20.161 -	}
  20.162 -
  20.163 -	dst = (char *)addr;
  20.164 -
  20.165 -	while (size-- > 0)
  20.166 -	    *dst++ = *data++;
  20.167 -
  20.168 -	db_nofault = 0;
  20.169 -
  20.170 -	if (ptep0) {
  20.171 -	    *ptep0 = oldmap0;
  20.172 -
  20.173 -	    if (ptep1)
  20.174 -		*ptep1 = oldmap1;
  20.175 -
  20.176 -	    invltlb();
  20.177 -	}
  20.178 -}
  20.179 -
  20.180 -/*
  20.181 - * XXX
  20.182 - * Move this to machdep.c and allow it to be called if any debugger is
  20.183 - * installed.
  20.184 - */
  20.185 -void
  20.186 -Debugger(const char *msg)
  20.187 -{
  20.188 -	static volatile u_int in_Debugger;
  20.189 -
  20.190 -	/*
  20.191 -	 * XXX
  20.192 -	 * Do nothing if the console is in graphics mode.  This is
  20.193 -	 * OK if the call is for the debugger hotkey but not if the call
  20.194 -	 * is a weak form of panicing.
  20.195 -	 */
  20.196 -	if (cons_unavail && !(boothowto & RB_GDB))
  20.197 -	    return;
  20.198 -
  20.199 -	if (atomic_cmpset_acq_int(&in_Debugger, 0, 1)) {
  20.200 -	    db_printf("Debugger(\"%s\")\n", msg);
  20.201 -	    breakpoint();
  20.202 -	    atomic_store_rel_int(&in_Debugger, 0);
  20.203 -	}
  20.204 -}
  20.205 -
  20.206 -void
  20.207 -db_show_mdpcpu(struct pcpu *pc)
  20.208 -{
  20.209 -
  20.210 -	db_printf("APIC ID      = %d\n", pc->pc_apic_id);
  20.211 -	db_printf("currentldt   = 0x%x\n", pc->pc_currentldt);
  20.212 -}
    21.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c	Sun Dec 04 18:24:24 2005 +0100
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,666 +0,0 @@
    21.4 -/******************************************************************************
    21.5 - * evtchn.c
    21.6 - * 
    21.7 - * Communication via Xen event channels.
    21.8 - * 
    21.9 - * Copyright (c) 2002-2004, K A Fraser
   21.10 - */
   21.11 -#include <sys/param.h>
   21.12 -#include <sys/systm.h>
   21.13 -#include <sys/bus.h>
   21.14 -#include <sys/malloc.h>
   21.15 -#include <sys/kernel.h>
   21.16 -#include <sys/lock.h>
   21.17 -#include <sys/mutex.h>
   21.18 -
   21.19 -#include <machine/cpufunc.h>
   21.20 -#include <machine/intr_machdep.h>
   21.21 -#include <machine/xen-os.h>
   21.22 -#include <machine/xen_intr.h>
   21.23 -#include <machine/synch_bitops.h>
   21.24 -#include <machine/evtchn.h>
   21.25 -#include <machine/hypervisor.h>
   21.26 -#include <machine/hypervisor-ifs.h>
   21.27 -
   21.28 -
   21.29 -static struct mtx irq_mapping_update_lock;
   21.30 -
   21.31 -#define TODO            printf("%s: not implemented!\n", __func__) 
   21.32 -
   21.33 -/* IRQ <-> event-channel mappings. */
   21.34 -static int evtchn_to_irq[NR_EVENT_CHANNELS];
   21.35 -static int irq_to_evtchn[NR_IRQS];
   21.36 -
   21.37 -static int virq_to_irq[MAX_VIRT_CPUS][NR_VIRQS];
   21.38 -static int ipi_to_evtchn[MAX_VIRT_CPUS][NR_VIRQS];
   21.39 -
   21.40 -
   21.41 -/* Reference counts for bindings to IRQs. */
   21.42 -static int irq_bindcount[NR_IRQS];
   21.43 -
   21.44 -#define VALID_EVTCHN(_chn) ((_chn) != -1)
   21.45 -
   21.46 -/*
   21.47 - * Force a proper event-channel callback from Xen after clearing the
   21.48 - * callback mask. We do this in a very simple manner, by making a call
   21.49 - * down into Xen. The pending flag will be checked by Xen on return.
   21.50 - */
   21.51 -void force_evtchn_callback(void)
   21.52 -{
   21.53 -    (void)HYPERVISOR_xen_version(0);
   21.54 -}
   21.55 -
   21.56 -void 
   21.57 -evtchn_do_upcall(struct intrframe *frame) 
   21.58 -{
   21.59 -    unsigned long  l1, l2;
   21.60 -    unsigned int   l1i, l2i, port;
   21.61 -    int            irq, owned;
   21.62 -    unsigned long  flags;
   21.63 -    shared_info_t *s = HYPERVISOR_shared_info;
   21.64 -    vcpu_info_t   *vcpu_info = &s->vcpu_data[smp_processor_id()];
   21.65 -
   21.66 -    local_irq_save(flags);
   21.67 -
   21.68 -    while ( s->vcpu_data[0].evtchn_upcall_pending )
   21.69 -    {
   21.70 -        s->vcpu_data[0].evtchn_upcall_pending = 0;
   21.71 -        /* NB. No need for a barrier here -- XCHG is a barrier on x86. */
   21.72 -        l1 = xen_xchg(&vcpu_info->evtchn_pending_sel, 0);
   21.73 -        while ( (l1i = ffs(l1)) != 0 )
   21.74 -        {
   21.75 -            l1i--;
   21.76 -            l1 &= ~(1 << l1i);
   21.77 -        
   21.78 -            l2 = s->evtchn_pending[l1i] & ~s->evtchn_mask[l1i];
   21.79 -            while ( (l2i = ffs(l2)) != 0 )
   21.80 -            {
   21.81 -                l2i--;
   21.82 -                l2 &= ~(1 << l2i);
   21.83 -            
   21.84 -                port = (l1i << 5) + l2i;
   21.85 -		irq = evtchn_to_irq[port];
   21.86 -#ifdef SMP		
   21.87 -		if (irq == PCPU_GET(cpuast)) 
   21.88 -			continue;
   21.89 -#endif
   21.90 -                if ( (owned = mtx_owned(&sched_lock)) != 0 )
   21.91 -                    mtx_unlock_spin_flags(&sched_lock, MTX_QUIET);
   21.92 -                if ( irq != -1 ) {
   21.93 -		    struct intsrc *isrc = intr_lookup_source(irq);
   21.94 -		    intr_execute_handlers(isrc, frame);
   21.95 -		} else {
   21.96 -                    evtchn_device_upcall(port);
   21.97 -		}
   21.98 -                if ( owned )
   21.99 -                    mtx_lock_spin_flags(&sched_lock, MTX_QUIET);                    
  21.100 -            }
  21.101 -        }
  21.102 -    }
  21.103 -
  21.104 -    local_irq_restore(flags);
  21.105 -
  21.106 -}
  21.107 -
  21.108 -
  21.109 -static int 
  21.110 -find_unbound_irq(void)
  21.111 -{
  21.112 -    int irq;
  21.113 -
  21.114 -    for ( irq = 0; irq < NR_IRQS; irq++ )
  21.115 -        if ( irq_bindcount[irq] == 0 )
  21.116 -            break;
  21.117 -
  21.118 -    if ( irq == NR_IRQS )
  21.119 -        panic("No available IRQ to bind to: increase NR_IRQS!\n");
  21.120 -
  21.121 -    return irq;
  21.122 -}
  21.123 -
  21.124 -int 
  21.125 -bind_virq_to_irq(int virq)
  21.126 -{
  21.127 -    evtchn_op_t op;
  21.128 -    int evtchn, irq;
  21.129 -
  21.130 -    mtx_lock(&irq_mapping_update_lock);
  21.131 -
  21.132 -    if ( (irq = PCPU_GET(virq_to_irq)[virq]) == -1 )
  21.133 -    {
  21.134 -        op.cmd              = EVTCHNOP_bind_virq;
  21.135 -        op.u.bind_virq.virq = virq;
  21.136 -        if ( HYPERVISOR_event_channel_op(&op) != 0 )
  21.137 -            panic("Failed to bind virtual IRQ %d\n", virq);
  21.138 -        evtchn = op.u.bind_virq.port;
  21.139 -
  21.140 -        irq = find_unbound_irq();
  21.141 -        evtchn_to_irq[evtchn] = irq;
  21.142 -        irq_to_evtchn[irq]    = evtchn;
  21.143 -
  21.144 -        PCPU_GET(virq_to_irq)[virq] = irq;
  21.145 -    }
  21.146 -
  21.147 -    irq_bindcount[irq]++;
  21.148 -
  21.149 -    mtx_unlock(&irq_mapping_update_lock);
  21.150 -    
  21.151 -    return irq;
  21.152 -}
  21.153 -
  21.154 -void 
  21.155 -unbind_virq_from_irq(int virq)
  21.156 -{
  21.157 -    evtchn_op_t op;
  21.158 -    int irq    = PCPU_GET(virq_to_irq)[virq];
  21.159 -    int evtchn = irq_to_evtchn[irq];
  21.160 -
  21.161 -    mtx_lock(&irq_mapping_update_lock);
  21.162 -
  21.163 -    if ( --irq_bindcount[irq] == 0 )
  21.164 -    {
  21.165 -        op.cmd          = EVTCHNOP_close;
  21.166 -        op.u.close.dom  = DOMID_SELF;
  21.167 -        op.u.close.port = evtchn;
  21.168 -        if ( HYPERVISOR_event_channel_op(&op) != 0 )
  21.169 -            panic("Failed to unbind virtual IRQ %d\n", virq);
  21.170 -
  21.171 -        evtchn_to_irq[evtchn] = -1;
  21.172 -        irq_to_evtchn[irq]    = -1;
  21.173 -        PCPU_GET(virq_to_irq)[virq]     = -1;
  21.174 -    }
  21.175 -
  21.176 -    mtx_unlock(&irq_mapping_update_lock);
  21.177 -}
  21.178 -
  21.179 -
  21.180 -int 
  21.181 -bind_ipi_on_cpu_to_irq(int cpu, int ipi)
  21.182 -{
  21.183 -    evtchn_op_t op;
  21.184 -    int evtchn, irq;
  21.185 -
  21.186 -    mtx_lock(&irq_mapping_update_lock);
  21.187 -
  21.188 -    if ( (evtchn = PCPU_GET(ipi_to_evtchn)[ipi]) == 0 )
  21.189 -    {
  21.190 -        op.cmd                 = EVTCHNOP_bind_ipi;
  21.191 -        op.u.bind_ipi.ipi_edom = cpu;
  21.192 -        if ( HYPERVISOR_event_channel_op(&op) != 0 )
  21.193 -            panic("Failed to bind virtual IPI %d on cpu %d\n", ipi, cpu);
  21.194 -        evtchn = op.u.bind_ipi.port;
  21.195 -
  21.196 -        irq = find_unbound_irq();
  21.197 -        evtchn_to_irq[evtchn] = irq;
  21.198 -        irq_to_evtchn[irq]    = evtchn;
  21.199 -
  21.200 -        PCPU_GET(ipi_to_evtchn)[ipi] = evtchn;
  21.201 -    } else
  21.202 -	irq = evtchn_to_irq[evtchn];
  21.203 -
  21.204 -    irq_bindcount[irq]++;
  21.205 -
  21.206 -    mtx_unlock(&irq_mapping_update_lock);
  21.207 -
  21.208 -    return irq;
  21.209 -}
  21.210 -
  21.211 -void 
  21.212 -unbind_ipi_on_cpu_from_irq(int cpu, int ipi)
  21.213 -{
  21.214 -    evtchn_op_t op;
  21.215 -    int evtchn = PCPU_GET(ipi_to_evtchn)[ipi];
  21.216 -    int irq    = irq_to_evtchn[evtchn];
  21.217 -
  21.218 -    mtx_lock(&irq_mapping_update_lock);
  21.219 -
  21.220 -    if ( --irq_bindcount[irq] == 0 )
  21.221 -    {
  21.222 -	op.cmd          = EVTCHNOP_close;
  21.223 -	op.u.close.dom  = DOMID_SELF;
  21.224 -	op.u.close.port = evtchn;
  21.225 -	if ( HYPERVISOR_event_channel_op(&op) != 0 )
  21.226 -	    panic("Failed to unbind virtual IPI %d on cpu %d\n", ipi, cpu);
  21.227 -
  21.228 -        evtchn_to_irq[evtchn] = -1;
  21.229 -        irq_to_evtchn[irq]    = -1;
  21.230 -	PCPU_GET(ipi_to_evtchn)[ipi] = 0;
  21.231 -    }
  21.232 -
  21.233 -    mtx_unlock(&irq_mapping_update_lock);
  21.234 -}
  21.235 -
  21.236 -int 
  21.237 -bind_evtchn_to_irq(int evtchn)
  21.238 -{
  21.239 -    int irq;
  21.240 -
  21.241 -    mtx_lock(&irq_mapping_update_lock);
  21.242 -
  21.243 -    if ( (irq = evtchn_to_irq[evtchn]) == -1 )
  21.244 -    {
  21.245 -        irq = find_unbound_irq();
  21.246 -        evtchn_to_irq[evtchn] = irq;
  21.247 -        irq_to_evtchn[irq]    = evtchn;
  21.248 -    }
  21.249 -
  21.250 -    irq_bindcount[irq]++;
  21.251 -
  21.252 -    mtx_unlock(&irq_mapping_update_lock);
  21.253 -    
  21.254 -    return irq;
  21.255 -}
  21.256 -
  21.257 -void 
  21.258 -unbind_evtchn_from_irq(int evtchn)
  21.259 -{
  21.260 -    int irq = evtchn_to_irq[evtchn];
  21.261 -
  21.262 -    mtx_lock(&irq_mapping_update_lock);
  21.263 -
  21.264 -    if ( --irq_bindcount[irq] == 0 )
  21.265 -    {
  21.266 -        evtchn_to_irq[evtchn] = -1;
  21.267 -        irq_to_evtchn[irq]    = -1;
  21.268 -    }
  21.269 -
  21.270 -    mtx_unlock(&irq_mapping_update_lock);
  21.271 -}
  21.272 -
  21.273 -
  21.274 -/*
  21.275 - * Interface to generic handling in intr_machdep.c
  21.276 - */
  21.277 -
  21.278 -
  21.279 -/*------------ interrupt handling --------------------------------------*/
  21.280 -#define TODO            printf("%s: not implemented!\n", __func__) 
  21.281 -
  21.282 - struct mtx xenpic_lock;
  21.283 -
  21.284 -struct xenpic_intsrc {
  21.285 -    struct intsrc xp_intsrc;
  21.286 -    uint8_t       xp_vector;
  21.287 -    boolean_t	  xp_masked;
  21.288 -};
  21.289 -
  21.290 -struct xenpic { 
  21.291 -    struct pic xp_pic; /* this MUST be first */
  21.292 -    uint16_t xp_numintr; 
  21.293 -    struct xenpic_intsrc xp_pins[0]; 
  21.294 -}; 
  21.295 -
  21.296 -static void     xenpic_enable_dynirq_source(struct intsrc *isrc); 
  21.297 -static void     xenpic_disable_dynirq_source(struct intsrc *isrc, int); 
  21.298 -static void     xenpic_eoi_source(struct intsrc *isrc); 
  21.299 -static void     xenpic_enable_dynirq_intr(struct intsrc *isrc); 
  21.300 -static int      xenpic_vector(struct intsrc *isrc); 
  21.301 -static int      xenpic_source_pending(struct intsrc *isrc); 
  21.302 -static void     xenpic_suspend(struct intsrc *isrc); 
  21.303 -static void     xenpic_resume(struct intsrc *isrc); 
  21.304 -
  21.305 -
  21.306 -struct pic xenpic_template  =  { 
  21.307 -    xenpic_enable_dynirq_source, 
  21.308 -    xenpic_disable_dynirq_source,
  21.309 -    xenpic_eoi_source, 
  21.310 -    xenpic_enable_dynirq_intr, 
  21.311 -    xenpic_vector, 
  21.312 -    xenpic_source_pending,
  21.313 -    xenpic_suspend, 
  21.314 -    xenpic_resume 
  21.315 -};
  21.316 -
  21.317 -
  21.318 -void 
  21.319 -xenpic_enable_dynirq_source(struct intsrc *isrc)
  21.320 -{
  21.321 -    unsigned int irq;
  21.322 -    struct xenpic_intsrc *xp;
  21.323 -
  21.324 -    xp = (struct xenpic_intsrc *)isrc;
  21.325 -
  21.326 -    if (xp->xp_masked) {
  21.327 -	irq = xenpic_vector(isrc);
  21.328 -	unmask_evtchn(irq_to_evtchn[irq]);
  21.329 -	xp->xp_masked = FALSE;
  21.330 -    }
  21.331 -}
  21.332 -
  21.333 -static void 
  21.334 -xenpic_disable_dynirq_source(struct intsrc *isrc, int foo)
  21.335 -{
  21.336 -    unsigned int irq;
  21.337 -    struct xenpic_intsrc *xp;
  21.338 -
  21.339 -    xp = (struct xenpic_intsrc *)isrc;
  21.340 -
  21.341 -    if (!xp->xp_masked) {
  21.342 -	irq = xenpic_vector(isrc);
  21.343 -	mask_evtchn(irq_to_evtchn[irq]);
  21.344 -	xp->xp_masked = TRUE;
  21.345 -    }
  21.346 -
  21.347 -}
  21.348 -
  21.349 -static void 
  21.350 -xenpic_enable_dynirq_intr(struct intsrc *isrc)
  21.351 -{
  21.352 -    unsigned int irq;
  21.353 -
  21.354 -    irq = xenpic_vector(isrc);
  21.355 -    unmask_evtchn(irq_to_evtchn[irq]);
  21.356 -}
  21.357 -
  21.358 -static void 
  21.359 -xenpic_eoi_source(struct intsrc *isrc)
  21.360 -{
  21.361 -    unsigned int irq = xenpic_vector(isrc);
  21.362 -    clear_evtchn(irq_to_evtchn[irq]);
  21.363 -}
  21.364 -
  21.365 -static int
  21.366 -xenpic_vector(struct intsrc *isrc)
  21.367 -{
  21.368 -    struct xenpic_intsrc *pin = (struct xenpic_intsrc *)isrc;
  21.369 -    return (pin->xp_vector);
  21.370 -}
  21.371 -
  21.372 -static int
  21.373 -xenpic_source_pending(struct intsrc *isrc)
  21.374 -{
  21.375 -    TODO;
  21.376 -    return 0;
  21.377 -}
  21.378 -
  21.379 -static void 
  21.380 -xenpic_suspend(struct intsrc *isrc) 
  21.381 -{ 
  21.382 -    TODO; 
  21.383 -} 
  21.384 - 
  21.385 -static void 
  21.386 -xenpic_resume(struct intsrc *isrc) 
  21.387 -{ 
  21.388 -    TODO; 
  21.389 -} 
  21.390 -
  21.391 -#ifdef CONFIG_PHYSDEV
  21.392 -/* required for support of physical devices */
  21.393 -static inline void 
  21.394 -pirq_unmask_notify(int pirq)
  21.395 -{
  21.396 -    physdev_op_t op;
  21.397 -    if ( unlikely(test_bit(pirq, &pirq_needs_unmask_notify[0])) )
  21.398 -    {
  21.399 -        op.cmd = PHYSDEVOP_IRQ_UNMASK_NOTIFY;
  21.400 -        (void)HYPERVISOR_physdev_op(&op);
  21.401 -    }
  21.402 -}
  21.403 -
  21.404 -static inline void 
  21.405 -pirq_query_unmask(int pirq)
  21.406 -{
  21.407 -    physdev_op_t op;
  21.408 -    op.cmd = PHYSDEVOP_IRQ_STATUS_QUERY;
  21.409 -    op.u.irq_status_query.irq = pirq;
  21.410 -    (void)HYPERVISOR_physdev_op(&op);
  21.411 -    clear_bit(pirq, &pirq_needs_unmask_notify[0]);
  21.412 -    if ( op.u.irq_status_query.flags & PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY )
  21.413 -        set_bit(pirq, &pirq_needs_unmask_notify[0]);
  21.414 -}
  21.415 -
  21.416 -/*
  21.417 - * On startup, if there is no action associated with the IRQ then we are
  21.418 - * probing. In this case we should not share with others as it will confuse us.
  21.419 - */
  21.420 -#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL)
  21.421 -
  21.422 -static unsigned int startup_pirq(unsigned int irq)
  21.423 -{
  21.424 -    evtchn_op_t op;
  21.425 -    int evtchn;
  21.426 -
  21.427 -    op.cmd               = EVTCHNOP_bind_pirq;
  21.428 -    op.u.bind_pirq.pirq  = irq;
  21.429 -    /* NB. We are happy to share unless we are probing. */
  21.430 -    op.u.bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE;
  21.431 -    if ( HYPERVISOR_event_channel_op(&op) != 0 )
  21.432 -    {
  21.433 -        if ( !probing_irq(irq) ) /* Some failures are expected when probing. */
  21.434 -            printk(KERN_INFO "Failed to obtain physical IRQ %d\n", irq);
  21.435 -        return 0;
  21.436 -    }
  21.437 -    evtchn = op.u.bind_pirq.port;
  21.438 -
  21.439 -    pirq_query_unmask(irq_to_pirq(irq));
  21.440 -
  21.441 -    evtchn_to_irq[evtchn] = irq;
  21.442 -    irq_to_evtchn[irq]    = evtchn;
  21.443 -
  21.444 -    unmask_evtchn(evtchn);
  21.445 -    pirq_unmask_notify(irq_to_pirq(irq));
  21.446 -
  21.447 -    return 0;
  21.448 -}
  21.449 -
  21.450 -static void shutdown_pirq(unsigned int irq)
  21.451 -{
  21.452 -    evtchn_op_t op;
  21.453 -    int evtchn = irq_to_evtchn[irq];
  21.454 -
  21.455 -    if ( !VALID_EVTCHN(evtchn) )
  21.456 -        return;
  21.457 -
  21.458 -    mask_evtchn(evtchn);
  21.459 -
  21.460 -    op.cmd          = EVTCHNOP_close;
  21.461 -    op.u.close.dom  = DOMID_SELF;
  21.462 -    op.u.close.port = evtchn;
  21.463 -    if ( HYPERVISOR_event_channel_op(&op) != 0 )
  21.464 -        panic("Failed to unbind physical IRQ %d\n", irq);
  21.465 -
  21.466 -    evtchn_to_irq[evtchn] = -1;
  21.467 -    irq_to_evtchn[irq]    = -1;
  21.468 -}
  21.469 -
  21.470 -static void enable_pirq(unsigned int irq)
  21.471 -{
  21.472 -    int evtchn = irq_to_evtchn[irq];
  21.473 -    if ( !VALID_EVTCHN(evtchn) )
  21.474 -        return;
  21.475 -    unmask_evtchn(evtchn);
  21.476 -    pirq_unmask_notify(irq_to_pirq(irq));
  21.477 -}
  21.478 -
  21.479 -static void disable_pirq(unsigned int irq)
  21.480 -{
  21.481 -    int evtchn = irq_to_evtchn[irq];
  21.482 -    if ( !VALID_EVTCHN(evtchn) )
  21.483 -        return;
  21.484 -    mask_evtchn(evtchn);
  21.485 -}
  21.486 -
  21.487 -static void ack_pirq(unsigned int irq)
  21.488 -{
  21.489 -    int evtchn = irq_to_evtchn[irq];
  21.490 -    if ( !VALID_EVTCHN(evtchn) )
  21.491 -        return;
  21.492 -    mask_evtchn(evtchn);
  21.493 -    clear_evtchn(evtchn);
  21.494 -}
  21.495 -
  21.496 -static void end_pirq(unsigned int irq)
  21.497 -{
  21.498 -    int evtchn = irq_to_evtchn[irq];
  21.499 -    if ( !VALID_EVTCHN(evtchn) )
  21.500 -        return;
  21.501 -    if ( !(irq_desc[irq].status & IRQ_DISABLED) )
  21.502 -    {
  21.503 -        unmask_evtchn(evtchn);
  21.504 -        pirq_unmask_notify(irq_to_pirq(irq));
  21.505 -    }
  21.506 -}
  21.507 -
  21.508 -static struct hw_interrupt_type pirq_type = {
  21.509 -    "Phys-irq",
  21.510 -    startup_pirq,
  21.511 -    shutdown_pirq,
  21.512 -    enable_pirq,
  21.513 -    disable_pirq,
  21.514 -    ack_pirq,
  21.515 -    end_pirq,
  21.516 -    NULL
  21.517 -};
  21.518 -#endif
  21.519 -
  21.520 -#if 0
  21.521 -static void 
  21.522 -misdirect_interrupt(void *sc)
  21.523 -{
  21.524 -}
  21.525 -#endif
  21.526 -void irq_suspend(void)
  21.527 -{
  21.528 -    int virq, irq, evtchn;
  21.529 -
  21.530 -    /* Unbind VIRQs from event channels. */
  21.531 -    for ( virq = 0; virq < NR_VIRQS; virq++ )
  21.532 -    {
  21.533 -        if ( (irq = PCPU_GET(virq_to_irq)[virq]) == -1 )
  21.534 -            continue;
  21.535 -        evtchn = irq_to_evtchn[irq];
  21.536 -
  21.537 -        /* Mark the event channel as unused in our table. */
  21.538 -        evtchn_to_irq[evtchn] = -1;
  21.539 -        irq_to_evtchn[irq]    = -1;
  21.540 -    }
  21.541 -
  21.542 -    /*
  21.543 -     * We should now be unbound from all event channels. Stale bindings to 
  21.544 -     * PIRQs and/or inter-domain event channels will cause us to barf here.
  21.545 -     */
  21.546 -    for ( evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++ )
  21.547 -        if ( evtchn_to_irq[evtchn] != -1 )
  21.548 -            panic("Suspend attempted while bound to evtchn %d.\n", evtchn);
  21.549 -}
  21.550 -
  21.551 -
  21.552 -void irq_resume(void)
  21.553 -{
  21.554 -    evtchn_op_t op;
  21.555 -    int         virq, irq, evtchn;
  21.556 -
  21.557 -    for ( evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++ )
  21.558 -        mask_evtchn(evtchn); /* New event-channel space is not 'live' yet. */
  21.559 -
  21.560 -    for ( virq = 0; virq < NR_VIRQS; virq++ )
  21.561 -    {
  21.562 -        if ( (irq = PCPU_GET(virq_to_irq)[virq]) == -1 )
  21.563 -            continue;
  21.564 -
  21.565 -        /* Get a new binding from Xen. */
  21.566 -        op.cmd              = EVTCHNOP_bind_virq;
  21.567 -        op.u.bind_virq.virq = virq;
  21.568 -        if ( HYPERVISOR_event_channel_op(&op) != 0 )
  21.569 -            panic("Failed to bind virtual IRQ %d\n", virq);
  21.570 -        evtchn = op.u.bind_virq.port;
  21.571 -        
  21.572 -        /* Record the new mapping. */
  21.573 -        evtchn_to_irq[evtchn] = irq;
  21.574 -        irq_to_evtchn[irq]    = evtchn;
  21.575 -
  21.576 -        /* Ready for use. */
  21.577 -        unmask_evtchn(evtchn);
  21.578 -    }
  21.579 -}
  21.580 -
  21.581 -void
  21.582 -ap_evtchn_init(int cpu)
  21.583 -{
  21.584 -    int i;
  21.585 -
  21.586 -    /* XXX -- expedience hack */
  21.587 -    PCPU_SET(virq_to_irq, (int  *)&virq_to_irq[cpu]);
  21.588 -    PCPU_SET(ipi_to_evtchn, (int *)&ipi_to_evtchn[cpu]);
  21.589 -
  21.590 -    /* No VIRQ -> IRQ mappings. */
  21.591 -    for ( i = 0; i < NR_VIRQS; i++ )
  21.592 -        PCPU_GET(virq_to_irq)[i] = -1;
  21.593 -}
  21.594 -
  21.595 -
  21.596 -static void 
  21.597 -evtchn_init(void *dummy __unused)
  21.598 -{
  21.599 -    int i;
  21.600 -    struct xenpic *xp;
  21.601 -    struct xenpic_intsrc *pin;
  21.602 -
  21.603 -
  21.604 -    /* XXX -- expedience hack */
  21.605 -    PCPU_SET(virq_to_irq, (int *)&virq_to_irq[0]);
  21.606 -    PCPU_SET(ipi_to_evtchn, (int *)&ipi_to_evtchn[0]);
  21.607 -
  21.608 -    /* No VIRQ -> IRQ mappings. */
  21.609 -    for ( i = 0; i < NR_VIRQS; i++ )
  21.610 -        PCPU_GET(virq_to_irq)[i] = -1;
  21.611 -
  21.612 -    /* No event-channel -> IRQ mappings. */
  21.613 -    for ( i = 0; i < NR_EVENT_CHANNELS; i++ )
  21.614 -    {
  21.615 -        evtchn_to_irq[i] = -1;
  21.616 -        mask_evtchn(i); /* No event channels are 'live' right now. */
  21.617 -    }
  21.618 -
  21.619 -    /* No IRQ -> event-channel mappings. */
  21.620 -    for ( i = 0; i < NR_IRQS; i++ )
  21.621 -        irq_to_evtchn[i] = -1;
  21.622 -
  21.623 -    xp = malloc(sizeof(struct xenpic) + NR_DYNIRQS*sizeof(struct xenpic_intsrc), M_DEVBUF, M_WAITOK);
  21.624 -    xp->xp_pic = xenpic_template;
  21.625 -    xp->xp_numintr = NR_DYNIRQS;
  21.626 -    bzero(xp->xp_pins, sizeof(struct xenpic_intsrc) * NR_DYNIRQS);
  21.627 -
  21.628 -    for ( i = 0, pin = xp->xp_pins; i < NR_DYNIRQS; i++, pin++ )
  21.629 -    {
  21.630 -        /* Dynamic IRQ space is currently unbound. Zero the refcnts. */
  21.631 -        irq_bindcount[dynirq_to_irq(i)] = 0;
  21.632 -
  21.633 -	pin->xp_intsrc.is_pic = (struct pic *)xp;
  21.634 -	pin->xp_vector = i;
  21.635 -	intr_register_source(&pin->xp_intsrc);
  21.636 -    }
  21.637 -    /* We don't currently have any support for physical devices in XenoFreeBSD 
  21.638 -     * so leaving this out for the moment for the sake of expediency.
  21.639 -     */
  21.640 -#ifdef notyet
  21.641 -    for ( i = 0; i < NR_PIRQS; i++ )
  21.642 -    {
  21.643 -        /* Phys IRQ space is statically bound (1:1 mapping). Nail refcnts. */
  21.644 -        irq_bindcount[pirq_to_irq(i)] = 1;
  21.645 -
  21.646 -        irq_desc[pirq_to_irq(i)].status  = IRQ_DISABLED;
  21.647 -        irq_desc[pirq_to_irq(i)].action  = 0;
  21.648 -        irq_desc[pirq_to_irq(i)].depth   = 1;
  21.649 -        irq_desc[pirq_to_irq(i)].handler = &pirq_type;
  21.650 -    }
  21.651 -
  21.652 -#endif
  21.653 -#if 0
  21.654 -    (void) intr_add_handler("xb_mis", bind_virq_to_irq(VIRQ_MISDIRECT),
  21.655 -	    	            (driver_intr_t *)misdirect_interrupt, 
  21.656 -			    NULL, INTR_TYPE_MISC, NULL);
  21.657 -
  21.658 -#endif
  21.659 -}
  21.660 -
  21.661 -SYSINIT(evtchn_init, SI_SUB_INTR, SI_ORDER_ANY, evtchn_init, NULL);
  21.662 -    /*
  21.663 -     * xenpic_lock: in order to allow an interrupt to occur in a critical
  21.664 -     * 	        section, to set pcpu->ipending (etc...) properly, we
  21.665 -     *	        must be able to get the icu lock, so it can't be
  21.666 -     *	        under witness.
  21.667 -     */
  21.668 -
  21.669 -MTX_SYSINIT(irq_mapping_update_lock, &irq_mapping_update_lock, "xp", MTX_DEF|MTX_NOWITNESS);
    22.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s	Sun Dec 04 18:24:24 2005 +0100
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,438 +0,0 @@
    22.4 -/*-
    22.5 - * Copyright (c) 1989, 1990 William F. Jolitz.
    22.6 - * Copyright (c) 1990 The Regents of the University of California.
    22.7 - * All rights reserved.
    22.8 - *
    22.9 - * Redistribution and use in source and binary forms, with or without
   22.10 - * modification, are permitted provided that the following conditions
   22.11 - * are met:
   22.12 - * 1. Redistributions of source code must retain the above copyright
   22.13 - *    notice, this list of conditions and the following disclaimer.
   22.14 - * 2. Redistributions in binary form must reproduce the above copyright
   22.15 - *    notice, this list of conditions and the following disclaimer in the
   22.16 - *    documentation and/or other materials provided with the distribution.
   22.17 - * 4. Neither the name of the University nor the names of its contributors
   22.18 - *    may be used to endorse or promote products derived from this software
   22.19 - *    without specific prior written permission.
   22.20 - *
   22.21 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   22.22 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22.23 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22.24 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   22.25 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22.26 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   22.27 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22.28 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22.29 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   22.30 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   22.31 - * SUCH DAMAGE.
   22.32 - *
   22.33 - * $FreeBSD: src/sys/i386/i386/exception.s,v 1.106 2003/11/03 22:08:52 jhb Exp $
   22.34 - */
   22.35 -
   22.36 -#include "opt_npx.h"
   22.37 -
   22.38 -#include <machine/asmacros.h>
   22.39 -#include <machine/psl.h>
   22.40 -#include <machine/trap.h>
   22.41 -
   22.42 -#include "assym.s"
   22.43 -
   22.44 -#define	SEL_RPL_MASK	0x0002
   22.45 -/* Offsets into shared_info_t. */
   22.46 -#define evtchn_upcall_pending /* 0 */
   22.47 -#define evtchn_upcall_mask       1
   22.48 -#define XEN_BLOCK_EVENTS(reg)     movb $1,evtchn_upcall_mask(reg)
   22.49 -#define XEN_UNBLOCK_EVENTS(reg)   movb $0,evtchn_upcall_mask(reg)
   22.50 -#define XEN_TEST_PENDING(reg)     testb $0x1,evtchn_upcall_pending(reg)
   22.51 -	 
   22.52 -	
   22.53 -#define POPA \
   22.54 -	popl %edi; \
   22.55 -	popl %esi; \
   22.56 -	popl %ebp; \
   22.57 -	popl %ebx; \
   22.58 -	popl %ebx; \
   22.59 -	popl %edx; \
   22.60 -	popl %ecx; \
   22.61 -	popl %eax;
   22.62 -
   22.63 -	.text
   22.64 -
   22.65 -/*****************************************************************************/
   22.66 -/* Trap handling                                                             */
   22.67 -/*****************************************************************************/
   22.68 -/*
   22.69 - * Trap and fault vector routines.
   22.70 - *
   22.71 - * Most traps are 'trap gates', SDT_SYS386TGT.  A trap gate pushes state on
   22.72 - * the stack that mostly looks like an interrupt, but does not disable 
   22.73 - * interrupts.  A few of the traps we are use are interrupt gates, 
   22.74 - * SDT_SYS386IGT, which are nearly the same thing except interrupts are
   22.75 - * disabled on entry.
   22.76 - *
   22.77 - * The cpu will push a certain amount of state onto the kernel stack for
   22.78 - * the current process.  The amount of state depends on the type of trap 
   22.79 - * and whether the trap crossed rings or not.  See i386/include/frame.h.  
   22.80 - * At the very least the current EFLAGS (status register, which includes 
   22.81 - * the interrupt disable state prior to the trap), the code segment register,
   22.82 - * and the return instruction pointer are pushed by the cpu.  The cpu 
   22.83 - * will also push an 'error' code for certain traps.  We push a dummy 
   22.84 - * error code for those traps where the cpu doesn't in order to maintain 
   22.85 - * a consistent frame.  We also push a contrived 'trap number'.
   22.86 - *
   22.87 - * The cpu does not push the general registers, we must do that, and we 
   22.88 - * must restore them prior to calling 'iret'.  The cpu adjusts the %cs and
   22.89 - * %ss segment registers, but does not mess with %ds, %es, or %fs.  Thus we
   22.90 - * must load them with appropriate values for supervisor mode operation.
   22.91 - */
   22.92 -
   22.93 -MCOUNT_LABEL(user)
   22.94 -MCOUNT_LABEL(btrap)
   22.95 -
   22.96 -IDTVEC(div)
   22.97 -	pushl $0; TRAP(T_DIVIDE)
   22.98 -IDTVEC(dbg)
   22.99 -	pushl $0; TRAP(T_TRCTRAP)
  22.100 -IDTVEC(nmi)
  22.101 -	pushl $0; TRAP(T_NMI)
  22.102 -IDTVEC(bpt)
  22.103 -	pushl $0; TRAP(T_BPTFLT)
  22.104 -IDTVEC(ofl)
  22.105 -	pushl $0; TRAP(T_OFLOW)
  22.106 -IDTVEC(bnd)
  22.107 -	pushl $0; TRAP(T_BOUND)
  22.108 -IDTVEC(ill)
  22.109 -	pushl $0; TRAP(T_PRIVINFLT)
  22.110 -IDTVEC(dna)
  22.111 -	pushl $0; TRAP(T_DNA)
  22.112 -IDTVEC(fpusegm)
  22.113 -	pushl $0; TRAP(T_FPOPFLT)
  22.114 -IDTVEC(tss)
  22.115 -	TRAP(T_TSSFLT)
  22.116 -IDTVEC(missing)
  22.117 -	TRAP(T_SEGNPFLT)
  22.118 -IDTVEC(stk)
  22.119 -	TRAP(T_STKFLT)
  22.120 -IDTVEC(prot)
  22.121 -	TRAP(T_PROTFLT)
  22.122 -IDTVEC(page)
  22.123 -	pushl %eax 
  22.124 -	movl  4(%esp),%eax
  22.125 -	movl  %eax,-44(%esp)	# move cr2 after trap frame
  22.126 -	popl %eax
  22.127 -	addl $4,%esp
  22.128 -	TRAP(T_PAGEFLT)
  22.129 -IDTVEC(mchk)
  22.130 -	pushl $0; TRAP(T_MCHK)
  22.131 -IDTVEC(rsvd)
  22.132 -	pushl $0; TRAP(T_RESERVED)
  22.133 -IDTVEC(fpu)
  22.134 -	pushl $0; TRAP(T_ARITHTRAP)
  22.135 -IDTVEC(align)
  22.136 -	TRAP(T_ALIGNFLT)
  22.137 -
  22.138 -IDTVEC(xmm)
  22.139 -	pushl $0; TRAP(T_XMMFLT)
  22.140 -
  22.141 -IDTVEC(hypervisor_callback)
  22.142 -	pushl %eax; TRAP(T_HYPCALLBACK)
  22.143 -
  22.144 -hypervisor_callback_pending:
  22.145 -	movl	$T_HYPCALLBACK,TF_TRAPNO(%esp)
  22.146 -	movl	$T_HYPCALLBACK,TF_ERR(%esp)
  22.147 -	jmp	11f
  22.148 -	
  22.149 -	/*
  22.150 -	 * alltraps entry point.  Interrupts are enabled if this was a trap
  22.151 -	 * gate (TGT), else disabled if this was an interrupt gate (IGT).
  22.152 -	 * Note that int0x80_syscall is a trap gate.  Only page faults
  22.153 -	 * use an interrupt gate.
  22.154 -	 */
  22.155 -
  22.156 -	SUPERALIGN_TEXT
  22.157 -	.globl	alltraps
  22.158 -	.type	alltraps,@function
  22.159 -alltraps:
  22.160 -	cld
  22.161 -	pushal
  22.162 -	pushl	%ds
  22.163 -	pushl	%es
  22.164 -	pushl	%fs
  22.165 -alltraps_with_regs_pushed:
  22.166 -	movl	$KDSEL,%eax
  22.167 -	movl	%eax,%ds
  22.168 -	movl	%eax,%es
  22.169 -	movl	$KPSEL,%eax
  22.170 -	movl	%eax,%fs
  22.171 -	FAKE_MCOUNT(TF_EIP(%esp))
  22.172 -save_cr2:
  22.173 -	movl	TF_TRAPNO(%esp),%eax
  22.174 -	cmpl	$T_PAGEFLT,%eax
  22.175 -	jne	calltrap
  22.176 -	movl	-4(%esp),%eax
  22.177 -	movl	%eax,PCPU(CR2)
  22.178 -calltrap:
  22.179 -	movl	TF_EIP(%esp),%eax
  22.180 -	cmpl	$scrit,%eax
  22.181 -	jb	11f
  22.182 -	cmpl	$ecrit,%eax
  22.183 -	jb	critical_region_fixup
  22.184 -11:	call	trap
  22.185 -
  22.186 -	/*
  22.187 -	 * Return via doreti to handle ASTs.
  22.188 -	 */
  22.189 -	MEXITCOUNT
  22.190 -	jmp	doreti
  22.191 -
  22.192 -/*
  22.193 - * SYSCALL CALL GATE (old entry point for a.out binaries)
  22.194 - *
  22.195 - * The intersegment call has been set up to specify one dummy parameter.
  22.196 - *
  22.197 - * This leaves a place to put eflags so that the call frame can be
  22.198 - * converted to a trap frame. Note that the eflags is (semi-)bogusly
  22.199 - * pushed into (what will be) tf_err and then copied later into the
  22.200 - * final spot. It has to be done this way because esp can't be just
  22.201 - * temporarily altered for the pushfl - an interrupt might come in
  22.202 - * and clobber the saved cs/eip.
  22.203 - */
  22.204 -	SUPERALIGN_TEXT
  22.205 -IDTVEC(lcall_syscall)
  22.206 -	pushfl				/* save eflags */
  22.207 -	popl	8(%esp)			/* shuffle into tf_eflags */
  22.208 -	pushl	$7			/* sizeof "lcall 7,0" */
  22.209 -	subl	$4,%esp			/* skip over tf_trapno */
  22.210 -	pushal
  22.211 -	pushl	%ds
  22.212 -	pushl	%es
  22.213 -	pushl	%fs
  22.214 -	movl	$KDSEL,%eax		/* switch to kernel segments */
  22.215 -	movl	%eax,%ds
  22.216 -	movl	%eax,%es
  22.217 -	movl	$KPSEL,%eax
  22.218 -	movl	%eax,%fs
  22.219 -	FAKE_MCOUNT(TF_EIP(%esp))
  22.220 -	call	syscall
  22.221 -	MEXITCOUNT
  22.222 -	jmp	doreti
  22.223 -
  22.224 -/*
  22.225 - * Call gate entry for FreeBSD ELF and Linux/NetBSD syscall (int 0x80)
  22.226 - *
  22.227 - * Even though the name says 'int0x80', this is actually a TGT (trap gate)
  22.228 - * rather then an IGT (interrupt gate).  Thus interrupts are enabled on
  22.229 - * entry just as they are for a normal syscall.
  22.230 - */
  22.231 -	SUPERALIGN_TEXT
  22.232 -IDTVEC(int0x80_syscall)
  22.233 -	pushl	$2			/* sizeof "int 0x80" */
  22.234 -	pushl	$0xBEEF
  22.235 -	pushal
  22.236 -	pushl	%ds
  22.237 -	pushl	%es
  22.238 -	pushl	%fs
  22.239 -	movl	$KDSEL,%eax		/* switch to kernel segments */
  22.240 -	movl	%eax,%ds
  22.241 -	movl	%eax,%es
  22.242 -	movl	$KPSEL,%eax
  22.243 -	movl	%eax,%fs
  22.244 -	FAKE_MCOUNT(TF_EIP(%esp))
  22.245 -	call	syscall
  22.246 -	MEXITCOUNT
  22.247 -	jmp	doreti
  22.248 -
  22.249 -ENTRY(fork_trampoline)
  22.250 -	pushl	%esp			/* trapframe pointer */
  22.251 -	pushl	%ebx			/* arg1 */
  22.252 -	pushl	%esi			/* function */
  22.253 -	call	fork_exit
  22.254 -	addl	$12,%esp               
  22.255 -	/* cut from syscall */
  22.256 -
  22.257 -	/*
  22.258 -	 * Return via doreti to handle ASTs.
  22.259 -	 */
  22.260 -	MEXITCOUNT
  22.261 -	jmp	doreti
  22.262 -
  22.263 -
  22.264 -/*
  22.265 -# A note on the "critical region" in our callback handler.
  22.266 -# We want to avoid stacking callback handlers due to events occurring
  22.267 -# during handling of the last event. To do this, we keep events disabled
  22.268 -# until weve done all processing. HOWEVER, we must enable events before
  22.269 -# popping the stack frame (cant be done atomically) and so it would still
  22.270 -# be possible to get enough handler activations to overflow the stack.
  22.271 -# Although unlikely, bugs of that kind are hard to track down, so wed
  22.272 -# like to avoid the possibility.
  22.273 -# So, on entry to the handler we detect whether we interrupted an
  22.274 -# existing activation in its critical region -- if so, we pop the current
  22.275 -# activation and restart the handler using the previous one.
  22.276 -*/
  22.277 -
  22.278 -
  22.279 -/*
  22.280 - * void doreti(struct trapframe)
  22.281 - *
  22.282 - * Handle return from interrupts, traps and syscalls.
  22.283 - */
  22.284 -	.text
  22.285 -	SUPERALIGN_TEXT
  22.286 -	.globl	doreti
  22.287 -	.type	doreti,@function
  22.288 -doreti:
  22.289 -	FAKE_MCOUNT(bintr)		/* init "from" bintr -> doreti */	
  22.290 -doreti_next:
  22.291 -	testb	$SEL_RPL_MASK,TF_CS(%esp) /* are we returning to user mode? */
  22.292 -	jz	doreti_exit		  /* #can't handle ASTs now if not */
  22.293 -
  22.294 -doreti_ast:
  22.295 -	/*
  22.296 -	 * Check for ASTs atomically with returning.  Disabling CPU
  22.297 -	 * interrupts provides sufficient locking even in the SMP case,
  22.298 -	 * since we will be informed of any new ASTs by an IPI.
  22.299 -	 */
  22.300 -	
  22.301 -	movl	HYPERVISOR_shared_info,%esi
  22.302 -	XEN_BLOCK_EVENTS(%esi) 
  22.303 -	movl	PCPU(CURTHREAD),%eax
  22.304 -	testl	$TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%eax)
  22.305 -	je	doreti_exit
  22.306 -	XEN_UNBLOCK_EVENTS(%esi) 
  22.307 -	pushl	%esp		/* pass a pointer to the trapframe */
  22.308 -	call	ast
  22.309 -	add	$4,%esp
  22.310 -	jmp	doreti_ast
  22.311 -
  22.312 -doreti_exit:
  22.313 -	/*
  22.314 -	 * doreti_exit:	pop registers, iret.
  22.315 -	 *
  22.316 -	 *	The segment register pop is a special case, since it may
  22.317 -	 *	fault if (for example) a sigreturn specifies bad segment
  22.318 -	 *	registers.  The fault is handled in trap.c.
  22.319 -	 */
  22.320 -
  22.321 -	movl	HYPERVISOR_shared_info,%esi
  22.322 -	XEN_UNBLOCK_EVENTS(%esi) # reenable event callbacks (sti)
  22.323 -
  22.324 -	.globl	scrit
  22.325 -scrit:
  22.326 -	XEN_TEST_PENDING(%esi)
  22.327 -        jnz	hypervisor_callback_pending	/* More to go  */
  22.328 -	MEXITCOUNT
  22.329 -
  22.330 -	.globl	doreti_popl_fs
  22.331 -doreti_popl_fs:
  22.332 -	popl	%fs
  22.333 -	.globl	doreti_popl_es
  22.334 -doreti_popl_es:
  22.335 -	popl	%es
  22.336 -	.globl	doreti_popl_ds
  22.337 -doreti_popl_ds:
  22.338 -	popl	%ds
  22.339 -	POPA
  22.340 -	addl	$8,%esp
  22.341 -	.globl	doreti_iret
  22.342 -doreti_iret:
  22.343 -	iret
  22.344 -	.globl	ecrit
  22.345 -ecrit:
  22.346 -
  22.347 -	/*
  22.348 -	 * doreti_iret_fault and friends.  Alternative return code for
  22.349 -	 * the case where we get a fault in the doreti_exit code
  22.350 -	 * above.  trap() (i386/i386/trap.c) catches this specific
  22.351 -	 * case, sends the process a signal and continues in the
  22.352 -	 * corresponding place in the code below.
  22.353 -	 */
  22.354 -	ALIGN_TEXT
  22.355 -	.globl	doreti_iret_fault
  22.356 -doreti_iret_fault:
  22.357 -	subl	$8,%esp
  22.358 -	pushal
  22.359 -	pushl	%ds
  22.360 -	.globl	doreti_popl_ds_fault
  22.361 -doreti_popl_ds_fault:
  22.362 -	pushl	%es
  22.363 -	.globl	doreti_popl_es_fault
  22.364 -doreti_popl_es_fault:
  22.365 -	pushl	%fs
  22.366 -	.globl	doreti_popl_fs_fault
  22.367 -doreti_popl_fs_fault:
  22.368 -	movl	$0,TF_ERR(%esp)	/* XXX should be the error code */
  22.369 -	movl	$T_PROTFLT,TF_TRAPNO(%esp)
  22.370 -	jmp	alltraps_with_regs_pushed
  22.371 -
  22.372 -
  22.373 -
  22.374 -
  22.375 -/*
  22.376 -# [How we do the fixup]. We want to merge the current stack frame with the
  22.377 -# just-interrupted frame. How we do this depends on where in the critical
  22.378 -# region the interrupted handler was executing, and so how many saved
  22.379 -# registers are in each frame. We do this quickly using the lookup table
  22.380 -# 'critical_fixup_table'. For each byte offset in the critical region, it
  22.381 -# provides the number of bytes which have already been popped from the
  22.382 -# interrupted stack frame.
  22.383 -*/
  22.384 -
  22.385 -.globl critical_region_fixup
  22.386 -critical_region_fixup:
  22.387 -	addl $critical_fixup_table-scrit,%eax
  22.388 -	movzbl (%eax),%eax    # %eax contains num bytes popped
  22.389 -        movl  %esp,%esi
  22.390 -        add  %eax,%esi        # %esi points at end of src region
  22.391 -        movl  %esp,%edi
  22.392 -        add  $0x40,%edi       # %edi points at end of dst region
  22.393 -        movl  %eax,%ecx
  22.394 -        shr  $2,%ecx          # convert bytes to words
  22.395 -        je   16f              # skip loop if nothing to copy
  22.396 -15:     subl $4,%esi          # pre-decrementing copy loop
  22.397 -        subl $4,%edi
  22.398 -        movl (%esi),%eax
  22.399 -        movl %eax,(%edi)
  22.400 -        loop 15b
  22.401 -16:     movl %edi,%esp        # final %edi is top of merged stack
  22.402 -	jmp  hypervisor_callback_pending
  22.403 -
  22.404 -
  22.405 -critical_fixup_table:        
  22.406 -.byte   0x0,0x0,0x0			#testb  $0x1,(%esi)
  22.407 -.byte   0x0,0x0,0x0,0x0,0x0,0x0		#jne    ea 
  22.408 -.byte   0x0,0x0				#pop    %fs
  22.409 -.byte   0x04				#pop    %es
  22.410 -.byte   0x08				#pop    %ds
  22.411 -.byte   0x0c				#pop    %edi
  22.412 -.byte   0x10	                        #pop    %esi
  22.413 -.byte   0x14	                        #pop    %ebp
  22.414 -.byte   0x18	                        #pop    %ebx
  22.415 -.byte   0x1c	                        #pop    %ebx
  22.416 -.byte   0x20	                        #pop    %edx
  22.417 -.byte   0x24	                        #pop    %ecx
  22.418 -.byte   0x28	                        #pop    %eax
  22.419 -.byte   0x2c,0x2c,0x2c                  #add    $0x8,%esp
  22.420 -.byte   0x34	                        #iret   
  22.421 -
  22.422 -	
  22.423 -/* # Hypervisor uses this for application faults while it executes.*/
  22.424 -ENTRY(failsafe_callback)
  22.425 -	pushal
  22.426 -	call xen_failsafe_handler
  22.427 -/*#	call install_safe_pf_handler */
  22.428 -        movl 28(%esp),%ebx
  22.429 -1:      movl %ebx,%ds
  22.430 -        movl 32(%esp),%ebx
  22.431 -2:      movl %ebx,%es
  22.432 -        movl 36(%esp),%ebx
  22.433 -3:      movl %ebx,%fs
  22.434 -        movl 40(%esp),%ebx
  22.435 -4:      movl %ebx,%gs
  22.436 -/*#        call install_normal_pf_handler */
  22.437 -	popal
  22.438 -	addl $12,%esp
  22.439 -	iret
  22.440 -
  22.441 -
    23.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c	Sun Dec 04 18:24:24 2005 +0100
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,233 +0,0 @@
    23.4 -/*-
    23.5 - * Copyright (c) 1982, 1990 The Regents of the University of California.
    23.6 - * All rights reserved.
    23.7 - *
    23.8 - * This code is derived from software contributed to Berkeley by
    23.9 - * William Jolitz.
   23.10 - *
   23.11 - * Redistribution and use in source and binary forms, with or without
   23.12 - * modification, are permitted provided that the following conditions
   23.13 - * are met:
   23.14 - * 1. Redistributions of source code must retain the above copyright
   23.15 - *    notice, this list of conditions and the following disclaimer.
   23.16 - * 2. Redistributions in binary form must reproduce the above copyright
   23.17 - *    notice, this list of conditions and the following disclaimer in the
   23.18 - *    documentation and/or other materials provided with the distribution.
   23.19 - * 3. All advertising materials mentioning features or use of this software
   23.20 - *    must display the following acknowledgement:
   23.21 - *	This product includes software developed by the University of
   23.22 - *	California, Berkeley and its contributors.
   23.23 - * 4. Neither the name of the University nor the names of its contributors
   23.24 - *    may be used to endorse or promote products derived from this software
   23.25 - *    without specific prior written permission.
   23.26 - *
   23.27 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   23.28 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23.29 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23.30 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   23.31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23.32 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23.33 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23.34 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23.35 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23.36 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   23.37 - * SUCH DAMAGE.
   23.38 - *
   23.39 - *	from: @(#)genassym.c	5.11 (Berkeley) 5/10/91
   23.40 - */
   23.41 -
   23.42 -#include <sys/cdefs.h>
   23.43 -__FBSDID("$FreeBSD: src/sys/i386/i386/genassym.c,v 1.146 2003/11/12 18:14:34 jhb Exp $");
   23.44 -
   23.45 -#include "opt_apic.h"
   23.46 -#include "opt_compat.h"
   23.47 -#include "opt_kstack_pages.h"
   23.48 -
   23.49 -#include <sys/param.h>
   23.50 -#include <sys/systm.h>
   23.51 -#include <sys/assym.h>
   23.52 -#include <sys/bio.h>
   23.53 -#include <sys/buf.h>
   23.54 -#include <sys/proc.h>
   23.55 -#include <sys/errno.h>
   23.56 -#include <sys/mount.h>
   23.57 -#include <sys/mutex.h>
   23.58 -#include <sys/socket.h>
   23.59 -#include <sys/resourcevar.h>
   23.60 -#include <sys/ucontext.h>
   23.61 -#include <sys/user.h>
   23.62 -#include <machine/bootinfo.h>
   23.63 -#include <machine/tss.h>
   23.64 -#include <sys/vmmeter.h>
   23.65 -#include <vm/vm.h>
   23.66 -#include <vm/vm_param.h>
   23.67 -#include <vm/pmap.h>
   23.68 -#include <vm/vm_map.h>
   23.69 -#include <sys/user.h>
   23.70 -#include <sys/proc.h>
   23.71 -#include <net/if.h>
   23.72 -#include <netinet/in.h>
   23.73 -#include <nfs/nfsproto.h>
   23.74 -#include <nfs/rpcv2.h>
   23.75 -#include <nfsclient/nfs.h>
   23.76 -#include <nfsclient/nfsdiskless.h>
   23.77 -#ifdef DEV_APIC
   23.78 -#include <machine/apicreg.h>
   23.79 -#endif
   23.80 -#include <machine/cpu.h>
   23.81 -#include <machine/sigframe.h>
   23.82 -#include <machine/proc.h>
   23.83 -
   23.84 -ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
   23.85 -ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
   23.86 -ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
   23.87 -ASSYM(P_SFLAG, offsetof(struct proc, p_sflag));
   23.88 -ASSYM(P_UAREA, offsetof(struct proc, p_uarea));
   23.89 -
   23.90 -ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
   23.91 -ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
   23.92 -ASSYM(TD_PROC, offsetof(struct thread, td_proc));
   23.93 -ASSYM(TD_MD, offsetof(struct thread, td_md));
   23.94 -
   23.95 -ASSYM(P_MD, offsetof(struct proc, p_md));
   23.96 -ASSYM(MD_LDT, offsetof(struct mdproc, md_ldt));
   23.97 -
   23.98 -ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
   23.99 -ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
  23.100 -
  23.101 -ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
  23.102 -ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
  23.103 -ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
  23.104 -/* ASSYM(UPAGES, UPAGES);*/
  23.105 -ASSYM(UAREA_PAGES, UAREA_PAGES);
  23.106 -ASSYM(KSTACK_PAGES, KSTACK_PAGES);
  23.107 -ASSYM(PAGE_SIZE, PAGE_SIZE);
  23.108 -ASSYM(NPTEPG, NPTEPG);
  23.109 -ASSYM(NPDEPG, NPDEPG);
  23.110 -ASSYM(NPDEPTD, NPDEPTD);
  23.111 -ASSYM(NPGPTD, NPGPTD);
  23.112 -ASSYM(PDESIZE, sizeof(pd_entry_t));
  23.113 -ASSYM(PTESIZE, sizeof(pt_entry_t));
  23.114 -ASSYM(PDESHIFT, PDESHIFT);
  23.115 -ASSYM(PTESHIFT, PTESHIFT);
  23.116 -ASSYM(PAGE_SHIFT, PAGE_SHIFT);
  23.117 -ASSYM(PAGE_MASK, PAGE_MASK);
  23.118 -ASSYM(PDRSHIFT, PDRSHIFT);
  23.119 -ASSYM(PDRMASK, PDRMASK);
  23.120 -ASSYM(USRSTACK, USRSTACK);
  23.121 -ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
  23.122 -ASSYM(KERNBASE, KERNBASE);
  23.123 -ASSYM(KERNLOAD, KERNLOAD);
  23.124 -ASSYM(MCLBYTES, MCLBYTES);
  23.125 -ASSYM(PCB_CR3, offsetof(struct pcb, pcb_cr3));
  23.126 -ASSYM(PCB_EDI, offsetof(struct pcb, pcb_edi));
  23.127 -ASSYM(PCB_ESI, offsetof(struct pcb, pcb_esi));
  23.128 -ASSYM(PCB_EBP, offsetof(struct pcb, pcb_ebp));
  23.129 -ASSYM(PCB_ESP, offsetof(struct pcb, pcb_esp));
  23.130 -ASSYM(PCB_EBX, offsetof(struct pcb, pcb_ebx));
  23.131 -ASSYM(PCB_EIP, offsetof(struct pcb, pcb_eip));
  23.132 -ASSYM(TSS_ESP0, offsetof(struct i386tss, tss_esp0));
  23.133 -
  23.134 -ASSYM(PCB_GS, offsetof(struct pcb, pcb_gs));
  23.135 -ASSYM(PCB_DR0, offsetof(struct pcb, pcb_dr0));
  23.136 -ASSYM(PCB_DR1, offsetof(struct pcb, pcb_dr1));
  23.137 -ASSYM(PCB_DR2, offsetof(struct pcb, pcb_dr2));
  23.138 -ASSYM(PCB_DR3, offsetof(struct pcb, pcb_dr3));
  23.139 -ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6));
  23.140 -ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7));
  23.141 -ASSYM(PCB_PSL, offsetof(struct pcb, pcb_psl));
  23.142 -ASSYM(PCB_DBREGS, PCB_DBREGS);
  23.143 -ASSYM(PCB_EXT, offsetof(struct pcb, pcb_ext));
  23.144 -
  23.145 -ASSYM(PCB_SPARE, offsetof(struct pcb, __pcb_spare));
  23.146 -ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
  23.147 -ASSYM(PCB_SAVEFPU, offsetof(struct pcb, pcb_save));
  23.148 -ASSYM(PCB_SAVEFPU_SIZE, sizeof(union savefpu));
  23.149 -ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
  23.150 -ASSYM(PCB_SWITCHOUT, offsetof(struct pcb, pcb_switchout));
  23.151 -
  23.152 -ASSYM(PCB_SIZE, sizeof(struct pcb));
  23.153 -
  23.154 -ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno));
  23.155 -ASSYM(TF_ERR, offsetof(struct trapframe, tf_err));
  23.156 -ASSYM(TF_CS, offsetof(struct trapframe, tf_cs));
  23.157 -ASSYM(TF_EFLAGS, offsetof(struct trapframe, tf_eflags));
  23.158 -ASSYM(TF_EIP, offsetof(struct trapframe, tf_eip));
  23.159 -ASSYM(SIGF_HANDLER, offsetof(struct sigframe, sf_ahu.sf_handler));
  23.160 -#ifdef COMPAT_43
  23.161 -ASSYM(SIGF_SC, offsetof(struct osigframe, sf_siginfo.si_sc));
  23.162 -#endif
  23.163 -ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc));
  23.164 -#ifdef COMPAT_FREEBSD4
  23.165 -ASSYM(SIGF_UC4, offsetof(struct sigframe4, sf_uc));
  23.166 -#endif
  23.167 -#ifdef COMPAT_43
  23.168 -ASSYM(SC_PS, offsetof(struct osigcontext, sc_ps));
  23.169 -ASSYM(SC_FS, offsetof(struct osigcontext, sc_fs));
  23.170 -ASSYM(SC_GS, offsetof(struct osigcontext, sc_gs));
  23.171 -ASSYM(SC_TRAPNO, offsetof(struct osigcontext, sc_trapno));
  23.172 -#endif
  23.173 -#ifdef COMPAT_FREEBSD4
  23.174 -ASSYM(UC4_EFLAGS, offsetof(struct ucontext4, uc_mcontext.mc_eflags));
  23.175 -ASSYM(UC4_GS, offsetof(struct ucontext4, uc_mcontext.mc_gs));
  23.176 -#endif
  23.177 -ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc_mcontext.mc_eflags));
  23.178 -ASSYM(UC_GS, offsetof(ucontext_t, uc_mcontext.mc_gs));
  23.179 -ASSYM(ENOENT, ENOENT);
  23.180 -ASSYM(EFAULT, EFAULT);
  23.181 -ASSYM(ENAMETOOLONG, ENAMETOOLONG);
  23.182 -ASSYM(MAXCOMLEN, MAXCOMLEN);
  23.183 -ASSYM(MAXPATHLEN, MAXPATHLEN);
  23.184 -ASSYM(BOOTINFO_SIZE, sizeof(struct bootinfo));
  23.185 -ASSYM(BI_VERSION, offsetof(struct bootinfo, bi_version));
  23.186 -ASSYM(BI_KERNELNAME, offsetof(struct bootinfo, bi_kernelname));
  23.187 -ASSYM(BI_NFS_DISKLESS, offsetof(struct bootinfo, bi_nfs_diskless));
  23.188 -ASSYM(BI_ENDCOMMON, offsetof(struct bootinfo, bi_endcommon));
  23.189 -ASSYM(NFSDISKLESS_SIZE, sizeof(struct nfs_diskless));
  23.190 -ASSYM(BI_SIZE, offsetof(struct bootinfo, bi_size));
  23.191 -ASSYM(BI_SYMTAB, offsetof(struct bootinfo, bi_symtab));
  23.192 -ASSYM(BI_ESYMTAB, offsetof(struct bootinfo, bi_esymtab));
  23.193 -ASSYM(BI_KERNEND, offsetof(struct bootinfo, bi_kernend));
  23.194 -ASSYM(PC_SIZEOF, sizeof(struct pcpu));
  23.195 -ASSYM(PC_PRVSPACE, offsetof(struct pcpu, pc_prvspace));
  23.196 -ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
  23.197 -ASSYM(PC_FPCURTHREAD, offsetof(struct pcpu, pc_fpcurthread));
  23.198 -ASSYM(PC_IDLETHREAD, offsetof(struct pcpu, pc_idlethread));
  23.199 -ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
  23.200 -ASSYM(PC_COMMON_TSS, offsetof(struct pcpu, pc_common_tss));
  23.201 -ASSYM(PC_COMMON_TSSD, offsetof(struct pcpu, pc_common_tssd));
  23.202 -ASSYM(PC_TSS_GDT, offsetof(struct pcpu, pc_tss_gdt));
  23.203 -ASSYM(PC_CURRENTLDT, offsetof(struct pcpu, pc_currentldt));
  23.204 -ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
  23.205 -ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap));
  23.206 -ASSYM(PC_CR2, offsetof(struct pcpu, pc_cr2));
  23.207 -ASSYM(PC_CR3, offsetof(struct pcpu, pc_pdir));
  23.208 -
  23.209 -#ifdef DEV_APIC
  23.210 -ASSYM(LA_VER, offsetof(struct LAPIC, version));
  23.211 -ASSYM(LA_TPR, offsetof(struct LAPIC, tpr));
  23.212 -ASSYM(LA_EOI, offsetof(struct LAPIC, eoi));
  23.213 -ASSYM(LA_SVR, offsetof(struct LAPIC, svr));
  23.214 -ASSYM(LA_ICR_LO, offsetof(struct LAPIC, icr_lo));
  23.215 -ASSYM(LA_ICR_HI, offsetof(struct LAPIC, icr_hi));
  23.216 -ASSYM(LA_ISR, offsetof(struct LAPIC, isr0));
  23.217 -#endif
  23.218 -
  23.219 -ASSYM(KCSEL, GSEL(GCODE_SEL, SEL_KPL));
  23.220 -ASSYM(KDSEL, GSEL(GDATA_SEL, SEL_KPL));
  23.221 -ASSYM(KPSEL, GSEL(GPRIV_SEL, SEL_KPL));
  23.222 -
  23.223 -ASSYM(BC32SEL, GSEL(GBIOSCODE32_SEL, SEL_KPL));
  23.224 -ASSYM(GPROC0_SEL, GPROC0_SEL);
  23.225 -
  23.226 -ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock));
  23.227 -ASSYM(MTX_RECURSECNT, offsetof(struct mtx, mtx_recurse));
  23.228 -
  23.229 -#ifdef PC98
  23.230 -#include <machine/bus.h>
  23.231 -
  23.232 -ASSYM(BUS_SPACE_HANDLE_BASE, offsetof(struct bus_space_handle, bsh_base));
  23.233 -ASSYM(BUS_SPACE_HANDLE_IAT, offsetof(struct bus_space_handle, bsh_iat));
  23.234 -#endif
  23.235 -
  23.236 -ASSYM(HYPERVISOR_STACK_SWITCH, __HYPERVISOR_stack_switch);
    24.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/gnttab.c	Sun Dec 04 18:24:24 2005 +0100
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,367 +0,0 @@
    24.4 -/******************************************************************************
    24.5 - * gnttab.c
    24.6 - * 
    24.7 - * Two sets of functionality:
    24.8 - * 1. Granting foreign access to our memory reservation.
    24.9 - * 2. Accessing others' memory reservations via grant references.
   24.10 - * (i.e., mechanisms for both sender and recipient of grant references)
   24.11 - * 
   24.12 - * Copyright (c) 2005, Christopher Clark
   24.13 - * Copyright (c) 2004, K A Fraser
   24.14 - */
   24.15 -
   24.16 -#include "opt_pmap.h"
   24.17 -#include <sys/param.h>
   24.18 -#include <sys/systm.h>
   24.19 -#include <sys/bus.h>
   24.20 -#include <sys/conf.h>
   24.21 -#include <sys/module.h>
   24.22 -#include <sys/kernel.h>
   24.23 -#include <sys/lock.h>
   24.24 -#include <sys/malloc.h>
   24.25 -#include <sys/mman.h>
   24.26 -#include <vm/vm.h>
   24.27 -#include <vm/vm_extern.h>
   24.28 -#include <vm/pmap.h>
   24.29 -#include <vm/vm_kern.h>
   24.30 -
   24.31 -#include <machine/gnttab.h>
   24.32 -#include <machine/pmap.h>
   24.33 -
   24.34 -#include <machine/hypervisor-ifs.h>
   24.35 -
   24.36 -#define cmpxchg(a, b, c) atomic_cmpset_int((volatile u_int *)(a),(b),(c))
   24.37 -
   24.38 -
   24.39 -/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
   24.40 -static inline void rep_nop(void)
   24.41 -{
   24.42 -    __asm__ __volatile__ ( "rep;nop" : : : "memory" );
   24.43 -}
   24.44 -#define cpu_relax() rep_nop()
   24.45 -
   24.46 -#if 1
   24.47 -#define ASSERT(_p) \
   24.48 -    if ( !(_p) ) { printk("Assertion '%s': line %d, file %s\n", \
   24.49 -    #_p , __LINE__, __FILE__); *(int*)0=0; }
   24.50 -#else
   24.51 -#define ASSERT(_p) ((void)0)
   24.52 -#endif
   24.53 -
   24.54 -#define WPRINTK(fmt, args...) \
   24.55 -    printk("xen_grant: " fmt, ##args)
   24.56 -
   24.57 -static grant_ref_t gnttab_free_list[NR_GRANT_ENTRIES];
   24.58 -static grant_ref_t gnttab_free_head;
   24.59 -
   24.60 -static grant_entry_t *shared;
   24.61 -#if 0
   24.62 -/* /proc/xen/grant */
   24.63 -static struct proc_dir_entry *grant_pde;
   24.64 -#endif
   24.65 -
   24.66 -/*
   24.67 - * Lock-free grant-entry allocator
   24.68 - */
   24.69 -
   24.70 -static inline int
   24.71 -get_free_entry(void)
   24.72 -{
   24.73 -    grant_ref_t fh, nfh = gnttab_free_head;
   24.74 -    do { if ( unlikely((fh = nfh) == NR_GRANT_ENTRIES) ) return -1; }
   24.75 -    while ( unlikely((nfh = cmpxchg(&gnttab_free_head, fh,
   24.76 -                                    gnttab_free_list[fh])) != fh) );
   24.77 -    return fh;
   24.78 -}
   24.79 -
   24.80 -static inline void
   24.81 -put_free_entry(grant_ref_t ref)
   24.82 -{
   24.83 -    grant_ref_t fh, nfh = gnttab_free_head;
   24.84 -    do { gnttab_free_list[ref] = fh = nfh; wmb(); }
   24.85 -    while ( unlikely((nfh = cmpxchg(&gnttab_free_head, fh, ref)) != fh) );
   24.86 -}
   24.87 -
   24.88 -/*
   24.89 - * Public grant-issuing interface functions
   24.90 - */
   24.91 -
   24.92 -int
   24.93 -gnttab_grant_foreign_access(domid_t domid, unsigned long frame, int readonly)
   24.94 -{
   24.95 -    int ref;
   24.96 -    
   24.97 -    if ( unlikely((ref = get_free_entry()) == -1) )
   24.98 -        return -ENOSPC;
   24.99 -
  24.100 -    shared[ref].frame = frame;
  24.101 -    shared[ref].domid = domid;
  24.102 -    wmb();
  24.103 -    shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0);
  24.104 -
  24.105 -    return ref;
  24.106 -}
  24.107 -
  24.108 -void
  24.109 -gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, 
  24.110 -				unsigned long frame, int readonly)
  24.111 -{
  24.112 -    shared[ref].frame = frame;
  24.113 -    shared[ref].domid = domid;
  24.114 -    wmb();
  24.115 -    shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0);
  24.116 -}
  24.117 -
  24.118 -
  24.119 -int
  24.120 -gnttab_query_foreign_access(grant_ref_t ref)
  24.121 -{
  24.122 -    uint16_t nflags;
  24.123 -
  24.124 -    nflags = shared[ref].flags;
  24.125 -
  24.126 -    return (nflags & (GTF_reading|GTF_writing));
  24.127 -}
  24.128 -
  24.129 -void
  24.130 -gnttab_end_foreign_access(grant_ref_t ref, int readonly)
  24.131 -{
  24.132 -    uint16_t flags, nflags;
  24.133 -
  24.134 -    nflags = shared[ref].flags;
  24.135 -    do {
  24.136 -        if ( (flags = nflags) & (GTF_reading|GTF_writing) )
  24.137 -            printk("WARNING: g.e. still in use!\n");
  24.138 -    }
  24.139 -    while ( (nflags = cmpxchg(&shared[ref].flags, flags, 0)) != flags );
  24.140 -
  24.141 -    put_free_entry(ref);
  24.142 -}
  24.143 -
  24.144 -int
  24.145 -gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn)
  24.146 -{
  24.147 -    int ref;
  24.148 -
  24.149 -    if ( unlikely((ref = get_free_entry()) == -1) )
  24.150 -        return -ENOSPC;
  24.151 -
  24.152 -    shared[ref].frame = pfn;
  24.153 -    shared[ref].domid = domid;
  24.154 -    wmb();
  24.155 -    shared[ref].flags = GTF_accept_transfer;
  24.156 -
  24.157 -    return ref;
  24.158 -}
  24.159 -
  24.160 -void
  24.161 -gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid, 
  24.162 -				  unsigned long pfn)
  24.163 -{
  24.164 -    shared[ref].frame = pfn;
  24.165 -    shared[ref].domid = domid;
  24.166 -    wmb();
  24.167 -    shared[ref].flags = GTF_accept_transfer;
  24.168 -}
  24.169 -
  24.170 -unsigned long
  24.171 -gnttab_end_foreign_transfer(grant_ref_t ref)
  24.172 -{
  24.173 -    unsigned long frame = 0;
  24.174 -    uint16_t           flags;
  24.175 -
  24.176 -    flags = shared[ref].flags;
  24.177 -    ASSERT(flags == (GTF_accept_transfer | GTF_transfer_committed));
  24.178 -
  24.179 -    /*
  24.180 -     * If a transfer is committed then wait for the frame address to appear.
  24.181 -     * Otherwise invalidate the grant entry against future use.
  24.182 -     */
  24.183 -    if ( likely(flags != GTF_accept_transfer) ||
  24.184 -         (cmpxchg(&shared[ref].flags, flags, 0) != GTF_accept_transfer) )
  24.185 -        while ( unlikely((frame = shared[ref].frame) == 0) )
  24.186 -            cpu_relax();
  24.187 -
  24.188 -    put_free_entry(ref);
  24.189 -
  24.190 -    return frame;
  24.191 -}
  24.192 -
  24.193 -void
  24.194 -gnttab_free_grant_references(uint16_t count, grant_ref_t head)
  24.195 -{
  24.196 -    /* TODO: O(N)...? */
  24.197 -    grant_ref_t to_die = 0, next = head;
  24.198 -    int i;
  24.199 -
  24.200 -    for ( i = 0; i < count; i++ )
  24.201 -        to_die = next;
  24.202 -        next = gnttab_free_list[next];
  24.203 -        put_free_entry( to_die );
  24.204 -}
  24.205 -
  24.206 -int
  24.207 -gnttab_alloc_grant_references(uint16_t count, grant_ref_t *head, 
  24.208 -			      grant_ref_t *terminal)
  24.209 -{
  24.210 -    int i;
  24.211 -    grant_ref_t h = gnttab_free_head;
  24.212 -
  24.213 -    for ( i = 0; i < count; i++ )
  24.214 -        if ( unlikely(get_free_entry() == -1) )
  24.215 -            goto not_enough_refs;
  24.216 -
  24.217 -    *head = h;
  24.218 -    *terminal = gnttab_free_head;
  24.219 -
  24.220 -    return 0;
  24.221 -
  24.222 -not_enough_refs:
  24.223 -    gnttab_free_head = h;
  24.224 -    return -ENOSPC;
  24.225 -}
  24.226 -
  24.227 -int
  24.228 -gnttab_claim_grant_reference(grant_ref_t *private_head, grant_ref_t  terminal )
  24.229 -{
  24.230 -    grant_ref_t g;
  24.231 -    if ( unlikely((g = *private_head) == terminal) )
  24.232 -        return -ENOSPC;
  24.233 -    *private_head = gnttab_free_list[g];
  24.234 -    return g;
  24.235 -}
  24.236 -
  24.237 -void
  24.238 -gnttab_release_grant_reference( grant_ref_t *private_head,
  24.239 -                                grant_ref_t  release )
  24.240 -{
  24.241 -    gnttab_free_list[release] = *private_head;
  24.242 -    *private_head = release;
  24.243 -}
  24.244 -#ifdef notyet
  24.245 -static int 
  24.246 -grant_ioctl(struct cdev *dev, u_long cmd, caddr_t data, 
  24.247 -	    int flag, struct thread *td)
  24.248 -{
  24.249 -
  24.250 -    int                     ret;
  24.251 -    privcmd_hypercall_t     hypercall;
  24.252 -
  24.253 -    /* XXX Need safety checks here if using for anything other
  24.254 -     *     than debugging */
  24.255 -    return -ENOSYS;
  24.256 -
  24.257 -    if ( cmd != IOCTL_PRIVCMD_HYPERCALL )
  24.258 -        return -ENOSYS;
  24.259 -
  24.260 -    if ( copy_from_user(&hypercall, (void *)data, sizeof(hypercall)) )
  24.261 -        return -EFAULT;
  24.262 -
  24.263 -    if ( hypercall.op != __HYPERVISOR_grant_table_op )
  24.264 -        return -ENOSYS;
  24.265 -
  24.266 -    /* hypercall-invoking asm taken from privcmd.c */
  24.267 -    __asm__ __volatile__ (
  24.268 -        "pushl %%ebx; pushl %%ecx; pushl %%edx; pushl %%esi; pushl %%edi; "
  24.269 -        "movl  4(%%eax),%%ebx ;"
  24.270 -        "movl  8(%%eax),%%ecx ;"
  24.271 -        "movl 12(%%eax),%%edx ;"
  24.272 -        "movl 16(%%eax),%%esi ;"
  24.273 -        "movl 20(%%eax),%%edi ;"
  24.274 -        "movl   (%%eax),%%eax ;"
  24.275 -        TRAP_INSTR "; "
  24.276 -        "popl %%edi; popl %%esi; popl %%edx; popl %%ecx; popl %%ebx"
  24.277 -        : "=a" (ret) : "0" (&hypercall) : "memory" );
  24.278 -
  24.279 -    return ret;
  24.280 -
  24.281 -}
  24.282 -
  24.283 -static struct cdevsw gnttab_cdevsw = {
  24.284 -    d_ioctl:  grant_ioctl,
  24.285 -};
  24.286 -
  24.287 -static int 
  24.288 -grant_read(char *page, char **start, off_t off,
  24.289 -	   int count, int *eof, void *data)
  24.290 -{
  24.291 -    int             len;
  24.292 -    unsigned int    i;
  24.293 -    grant_entry_t  *gt;
  24.294 -
  24.295 -    gt = (grant_entry_t *)shared;
  24.296 -    len = 0;
  24.297 -
  24.298 -    for ( i = 0; i < NR_GRANT_ENTRIES; i++ )
  24.299 -        /* TODO: safety catch here until this can handle >PAGE_SIZE output */
  24.300 -        if (len > (PAGE_SIZE - 200))
  24.301 -        {
  24.302 -            len += sprintf( page + len, "Truncated.\n");
  24.303 -            break;
  24.304 -        }
  24.305 -
  24.306 -        if ( gt[i].flags )
  24.307 -            len += sprintf( page + len,
  24.308 -                    "Grant: ref (0x%x) flags (0x%hx) dom (0x%hx) frame (0x%x)\n", 
  24.309 -                    i,
  24.310 -                    gt[i].flags,
  24.311 -                    gt[i].domid,
  24.312 -                    gt[i].frame );
  24.313 -
  24.314 -    *eof = 1;
  24.315 -    return len;
  24.316 -}
  24.317 -
  24.318 -static int 
  24.319 -grant_write(struct file *file, const char __user *buffer,
  24.320 -	    unsigned long count, void *data)
  24.321 -{
  24.322 -    /* TODO: implement this */
  24.323 -    return -ENOSYS;
  24.324 -}
  24.325 -#endif
  24.326 -static int 
  24.327 -gnttab_init(void *unused)
  24.328 -{
  24.329 -    gnttab_setup_table_t setup;
  24.330 -    unsigned long        frames[NR_GRANT_FRAMES];
  24.331 -    int                  i;
  24.332 -
  24.333 -    setup.dom        = DOMID_SELF;
  24.334 -    setup.nr_frames  = NR_GRANT_FRAMES;
  24.335 -    setup.frame_list = frames;
  24.336 -
  24.337 -    if (HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1) != 0)
  24.338 -        panic("grant table setup failed\n");
  24.339 -    if (setup.status != 0)
  24.340 -        panic("non-zero status in grant table setup\n");
  24.341 -    shared = (grant_entry_t *)kmem_alloc_nofault(kernel_map, NR_GRANT_FRAMES);
  24.342 -
  24.343 -    for (i = 0; i < NR_GRANT_FRAMES; i++) 
  24.344 -	pmap_kenter_ma((vm_offset_t)(shared + (i*PAGE_SIZE)), frames[i] << PAGE_SHIFT);
  24.345 -
  24.346 -    for ( i = 0; i < NR_GRANT_ENTRIES; i++ )
  24.347 -        gnttab_free_list[i] = i + 1;
  24.348 -#if 0
  24.349 -    /*
  24.350 -     *  /proc/xen/grant : used by libxc to access grant tables
  24.351 -     */
  24.352 -    if ( (grant_pde = create_xen_proc_entry("grant", 0600)) == NULL )
  24.353 -    {
  24.354 -        WPRINTK("Unable to create grant xen proc entry\n");
  24.355 -        return -1;
  24.356 -    }
  24.357 -
  24.358 -    grant_file_ops.read   = grant_pde->proc_fops->read;
  24.359 -    grant_file_ops.write  = grant_pde->proc_fops->write;
  24.360 -
  24.361 -    grant_pde->proc_fops  = &grant_file_ops;
  24.362 -
  24.363 -    grant_pde->read_proc  = &grant_read;
  24.364 -    grant_pde->write_proc = &grant_write;
  24.365 -#endif
  24.366 -    printk("Grant table initialized\n");
  24.367 -    return 0;
  24.368 -}
  24.369 -
  24.370 -SYSINIT(gnttab, SI_SUB_PSEUDO, SI_ORDER_FIRST, gnttab_init, NULL);
    25.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/hypervisor.c	Sun Dec 04 18:24:24 2005 +0100
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,107 +0,0 @@
    25.4 -/******************************************************************************
    25.5 - * hypervisor.c
    25.6 - * 
    25.7 - * Communication to/from hypervisor.
    25.8 - * 
    25.9 - * Copyright (c) 2002-2003, K A Fraser
   25.10 - * 
   25.11 - * Permission is hereby granted, free of charge, to any person obtaining a copy
   25.12 - * of this software and associated documentation files (the "Software"), to
   25.13 - * deal in the Software without restriction, including without limitation the
   25.14 - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   25.15 - * sell copies of the Software, and to permit persons to whom the Software is
   25.16 - * furnished to do so, subject to the following conditions:
   25.17 - * 
   25.18 - * The above copyright notice and this permission notice shall be included in
   25.19 - * all copies or substantial portions of the Software.
   25.20 - * 
   25.21 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
   25.22 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIEAS OF MERCHANTABILITY, 
   25.23 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
   25.24 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
   25.25 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
   25.26 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
   25.27 - * DEALINGS IN THE SOFTWARE.
   25.28 - */
   25.29 -
   25.30 -#include <machine/xen-os.h>
   25.31 -#include <machine/hypervisor.h>
   25.32 -#include <machine/xenvar.h>
   25.33 -#include <machine/multicall.h>
   25.34 -
   25.35 -/* XXX need to verify what the caller save registers are on x86 KMM */
   25.36 -#define CALLER_SAVE __asm__("pushal; ")
   25.37 -#define CALLER_RESTORE __asm__("popal;")
   25.38 -
   25.39 -
   25.40 -/* ni == non-inline - these are only intended for use from assembler
   25.41 - * no reason to have them in a header - 
   25.42 - *
   25.43 - */
   25.44 -void ni_queue_multicall0(unsigned long op); 
   25.45 -void ni_queue_multicall1(unsigned long op, unsigned long arg1); 
   25.46 -void ni_queue_multicall2(unsigned long op, unsigned long arg1,
   25.47 -			 unsigned long arg2); 
   25.48 -void ni_queue_multicall3(unsigned long op, unsigned long arg1,
   25.49 -			 unsigned long arg2, unsigned long arg3); 
   25.50 -void ni_queue_multicall4(unsigned long op, unsigned long arg1,
   25.51 -			 unsigned long arg2, unsigned long arg4,
   25.52 -			 unsigned long arg5); 
   25.53 -
   25.54 -void ni_execute_multicall_list(void);
   25.55 -
   25.56 -multicall_entry_t multicall_list[MAX_MULTICALL_ENTS];
   25.57 -int nr_multicall_ents = 0;
   25.58 -
   25.59 -
   25.60 -void 
   25.61 -ni_queue_multicall0(unsigned long op) 
   25.62 -{
   25.63 -    CALLER_SAVE;
   25.64 -    queue_multicall0(op);
   25.65 -    CALLER_RESTORE;
   25.66 -}
   25.67 -
   25.68 -void 
   25.69 -ni_queue_multicall1(unsigned long op, unsigned long arg1) 
   25.70 -{
   25.71 -    CALLER_SAVE;
   25.72 -    queue_multicall1(op, arg1);
   25.73 -    CALLER_RESTORE;
   25.74 -}
   25.75 -
   25.76 -void 
   25.77 -ni_queue_multicall2(unsigned long op, unsigned long arg1, 
   25.78 -		    unsigned long arg2) 
   25.79 -{
   25.80 -    CALLER_SAVE;
   25.81 -    queue_multicall2(op, arg1, arg2);
   25.82 -    CALLER_RESTORE;
   25.83 -}
   25.84 -
   25.85 -void 
   25.86 -ni_queue_multicall3(unsigned long op, unsigned long arg1, 
   25.87 -		    unsigned long arg2, unsigned long arg3) 
   25.88 -{
   25.89 -    CALLER_SAVE;
   25.90 -    queue_multicall3(op, arg1, arg2, arg3);
   25.91 -    CALLER_RESTORE;
   25.92 -}
   25.93 -
   25.94 -void 
   25.95 -ni_queue_multicall4(unsigned long op, unsigned long arg1,
   25.96 -		    unsigned long arg2, unsigned long arg3,
   25.97 -		    unsigned long arg4) 
   25.98 -{
   25.99 -    CALLER_SAVE;    
  25.100 -    queue_multicall4(op, arg1, arg2, arg3, arg4);
  25.101 -    CALLER_RESTORE;
  25.102 -}
  25.103 -
  25.104 -void
  25.105 -ni_execute_multicall_list(void)
  25.106 -{
  25.107 -    CALLER_SAVE;
  25.108 -    execute_multicall_list();
  25.109 -    CALLER_RESTORE;
  25.110 -}
    26.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/i686_mem.c	Sun Dec 04 18:24:24 2005 +0100
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,626 +0,0 @@
    26.4 -/*-
    26.5 - * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
    26.6 - * All rights reserved.
    26.7 - *
    26.8 - * Redistribution and use in source and binary forms, with or without
    26.9 - * modification, are permitted provided that the following conditions
   26.10 - * are met:
   26.11 - * 1. Redistributions of source code must retain the above copyright
   26.12 - *    notice, this list of conditions and the following disclaimer.
   26.13 - * 2. Redistributions in binary form must reproduce the above copyright
   26.14 - *    notice, this list of conditions and the following disclaimer in the
   26.15 - *    documentation and/or other materials provided with the distribution.
   26.16 - *
   26.17 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   26.18 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   26.19 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   26.20 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   26.21 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   26.22 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26.23 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26.24 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26.25 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26.26 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26.27 - * SUCH DAMAGE.
   26.28 - */
   26.29 -
   26.30 -#include <sys/cdefs.h>
   26.31 -__FBSDID("$FreeBSD: src/sys/i386/i386/i686_mem.c,v 1.23 2003/10/21 18:28:34 silby Exp $");
   26.32 -
   26.33 -#include <sys/param.h>
   26.34 -#include <sys/kernel.h>
   26.35 -#include <sys/systm.h>
   26.36 -#include <sys/malloc.h>
   26.37 -#include <sys/memrange.h>
   26.38 -#include <sys/smp.h>
   26.39 -#include <sys/sysctl.h>
   26.40 -
   26.41 -#include <machine/md_var.h>
   26.42 -#include <machine/specialreg.h>
   26.43 -
   26.44 -/*
   26.45 - * i686 memory range operations
   26.46 - *
   26.47 - * This code will probably be impenetrable without reference to the
   26.48 - * Intel Pentium Pro documentation.
   26.49 - */
   26.50 -
   26.51 -static char *mem_owner_bios = "BIOS";
   26.52 -
   26.53 -#define MR686_FIXMTRR	(1<<0)
   26.54 -
   26.55 -#define mrwithin(mr, a) \
   26.56 -    (((a) >= (mr)->mr_base) && ((a) < ((mr)->mr_base + (mr)->mr_len)))
   26.57 -#define mroverlap(mra, mrb) \
   26.58 -    (mrwithin(mra, mrb->mr_base) || mrwithin(mrb, mra->mr_base))
   26.59 -
   26.60 -#define mrvalid(base, len) 						\
   26.61 -    ((!(base & ((1 << 12) - 1))) && 	/* base is multiple of 4k */	\
   26.62 -     ((len) >= (1 << 12)) && 		/* length is >= 4k */		\
   26.63 -     powerof2((len)) && 		/* ... and power of two */	\
   26.64 -     !((base) & ((len) - 1)))		/* range is not discontiuous */
   26.65 -
   26.66 -#define mrcopyflags(curr, new) (((curr) & ~MDF_ATTRMASK) | ((new) & MDF_ATTRMASK))
   26.67 -
   26.68 -static int			mtrrs_disabled;
   26.69 -TUNABLE_INT("machdep.disable_mtrrs", &mtrrs_disabled);
   26.70 -SYSCTL_INT(_machdep, OID_AUTO, disable_mtrrs, CTLFLAG_RDTUN,
   26.71 -	&mtrrs_disabled, 0, "Disable i686 MTRRs.");
   26.72 -
   26.73 -static void			i686_mrinit(struct mem_range_softc *sc);
   26.74 -static int			i686_mrset(struct mem_range_softc *sc,
   26.75 -					   struct mem_range_desc *mrd,
   26.76 -					   int *arg);
   26.77 -static void			i686_mrAPinit(struct mem_range_softc *sc);
   26.78 -
   26.79 -static struct mem_range_ops i686_mrops = {
   26.80 -    i686_mrinit,
   26.81 -    i686_mrset,
   26.82 -    i686_mrAPinit
   26.83 -};
   26.84 -
   26.85 -/* XXX for AP startup hook */
   26.86 -static u_int64_t		mtrrcap, mtrrdef;
   26.87 -
   26.88 -static struct mem_range_desc	*mem_range_match(struct mem_range_softc *sc,
   26.89 -						 struct mem_range_desc *mrd);
   26.90 -static void			i686_mrfetch(struct mem_range_softc *sc);
   26.91 -static int			i686_mtrrtype(int flags);
   26.92 -#if 0
   26.93 -static int			i686_mrt2mtrr(int flags, int oldval);
   26.94 -#endif
   26.95 -static int			i686_mtrrconflict(int flag1, int flag2);
   26.96 -static void			i686_mrstore(struct mem_range_softc *sc);
   26.97 -static void			i686_mrstoreone(void *arg);
   26.98 -static struct mem_range_desc	*i686_mtrrfixsearch(struct mem_range_softc *sc,
   26.99 -						    u_int64_t addr);
  26.100 -static int			i686_mrsetlow(struct mem_range_softc *sc,
  26.101 -					      struct mem_range_desc *mrd,
  26.102 -					      int *arg);
  26.103 -static int			i686_mrsetvariable(struct mem_range_softc *sc,
  26.104 -						   struct mem_range_desc *mrd,
  26.105 -						   int *arg);
  26.106 -
  26.107 -/* i686 MTRR type to memory range type conversion */
  26.108 -static int i686_mtrrtomrt[] = {
  26.109 -    MDF_UNCACHEABLE,
  26.110 -    MDF_WRITECOMBINE,
  26.111 -    MDF_UNKNOWN,
  26.112 -    MDF_UNKNOWN,
  26.113 -    MDF_WRITETHROUGH,
  26.114 -    MDF_WRITEPROTECT,
  26.115 -    MDF_WRITEBACK
  26.116 -};
  26.117 -
  26.118 -#define MTRRTOMRTLEN (sizeof(i686_mtrrtomrt) / sizeof(i686_mtrrtomrt[0]))
  26.119 -
  26.120 -static int
  26.121 -i686_mtrr2mrt(int val) {
  26.122 -	if (val < 0 || val >= MTRRTOMRTLEN)
  26.123 -		return MDF_UNKNOWN;
  26.124 -	return i686_mtrrtomrt[val];
  26.125 -}
  26.126 -
  26.127 -/* 
  26.128 - * i686 MTRR conflicts. Writeback and uncachable may overlap.
  26.129 - */
  26.130 -static int
  26.131 -i686_mtrrconflict(int flag1, int flag2) {
  26.132 -	flag1 &= MDF_ATTRMASK;
  26.133 -	flag2 &= MDF_ATTRMASK;
  26.134 -	if (flag1 == flag2 ||
  26.135 -	    (flag1 == MDF_WRITEBACK && flag2 == MDF_UNCACHEABLE) ||
  26.136 -	    (flag2 == MDF_WRITEBACK && flag1 == MDF_UNCACHEABLE))
  26.137 -		return 0;
  26.138 -	return 1;
  26.139 -}
  26.140 -
  26.141 -/*
  26.142 - * Look for an exactly-matching range.
  26.143 - */
  26.144 -static struct mem_range_desc *
  26.145 -mem_range_match(struct mem_range_softc *sc, struct mem_range_desc *mrd) 
  26.146 -{
  26.147 -    struct mem_range_desc	*cand;
  26.148 -    int				i;
  26.149 -	
  26.150 -    for (i = 0, cand = sc->mr_desc; i < sc->mr_ndesc; i++, cand++)
  26.151 -	if ((cand->mr_base == mrd->mr_base) &&
  26.152 -	    (cand->mr_len == mrd->mr_len))
  26.153 -	    return(cand);
  26.154 -    return(NULL);
  26.155 -}
  26.156 -
  26.157 -/*
  26.158 - * Fetch the current mtrr settings from the current CPU (assumed to all
  26.159 - * be in sync in the SMP case).  Note that if we are here, we assume
  26.160 - * that MTRRs are enabled, and we may or may not have fixed MTRRs.
  26.161 - */
  26.162 -static void
  26.163 -i686_mrfetch(struct mem_range_softc *sc)
  26.164 -{
  26.165 -    struct mem_range_desc	*mrd;
  26.166 -    u_int64_t			msrv;
  26.167 -    int				i, j, msr;
  26.168 -
  26.169 -    mrd = sc->mr_desc;
  26.170 -
  26.171 -    /* Get fixed-range MTRRs */
  26.172 -    if (sc->mr_cap & MR686_FIXMTRR) {
  26.173 -	msr = MSR_MTRR64kBase;
  26.174 -	for (i = 0; i < (MTRR_N64K / 8); i++, msr++) {
  26.175 -	    msrv = rdmsr(msr);
  26.176 -	    for (j = 0; j < 8; j++, mrd++) {
  26.177 -		mrd->mr_flags = (mrd->mr_flags & ~MDF_ATTRMASK) |
  26.178 -		    i686_mtrr2mrt(msrv & 0xff) |
  26.179 -		    MDF_ACTIVE;
  26.180 -		if (mrd->mr_owner[0] == 0)
  26.181 -		    strcpy(mrd->mr_owner, mem_owner_bios);
  26.182 -		msrv = msrv >> 8;
  26.183 -	    }
  26.184 -	}
  26.185 -	msr = MSR_MTRR16kBase;
  26.186 -	for (i = 0; i < (MTRR_N16K / 8); i++, msr++) {
  26.187 -	    msrv = rdmsr(msr);
  26.188 -	    for (j = 0; j < 8; j++, mrd++) {
  26.189 -		mrd->mr_flags = (mrd->mr_flags & ~MDF_ATTRMASK) |
  26.190 -		    i686_mtrr2mrt(msrv & 0xff) |
  26.191 -		    MDF_ACTIVE;
  26.192 -		if (mrd->mr_owner[0] == 0)
  26.193 -		    strcpy(mrd->mr_owner, mem_owner_bios);
  26.194 -		msrv = msrv >> 8;
  26.195 -	    }
  26.196 -	}
  26.197 -	msr = MSR_MTRR4kBase;
  26.198 -	for (i = 0; i < (MTRR_N4K / 8); i++, msr++) {
  26.199 -	    msrv = rdmsr(msr);
  26.200 -	    for (j = 0; j < 8; j++, mrd++) {
  26.201 -		mrd->mr_flags = (mrd->mr_flags & ~MDF_ATTRMASK) |
  26.202 -		    i686_mtrr2mrt(msrv & 0xff) |
  26.203 -		    MDF_ACTIVE;
  26.204 -		if (mrd->mr_owner[0] == 0)
  26.205 -		    strcpy(mrd->mr_owner, mem_owner_bios);
  26.206 -		msrv = msrv >> 8;
  26.207 -	    }
  26.208 -	}
  26.209 -    }
  26.210 -
  26.211 -    /* Get remainder which must be variable MTRRs */
  26.212 -    msr = MSR_MTRRVarBase;
  26.213 -    for (; (mrd - sc->mr_desc) < sc->mr_ndesc; msr += 2, mrd++) {
  26.214 -	msrv = rdmsr(msr);
  26.215 -	mrd->mr_flags = (mrd->mr_flags & ~MDF_ATTRMASK) |
  26.216 -	    i686_mtrr2mrt(msrv & 0xff);
  26.217 -	mrd->mr_base = msrv & 0x0000000ffffff000LL;
  26.218 -	msrv = rdmsr(msr + 1);
  26.219 -	mrd->mr_flags = (msrv & 0x800) ? 
  26.220 -	    (mrd->mr_flags | MDF_ACTIVE) :
  26.221 -	    (mrd->mr_flags & ~MDF_ACTIVE);
  26.222 -	/* Compute the range from the mask. Ick. */
  26.223 -	mrd->mr_len = (~(msrv & 0x0000000ffffff000LL) & 0x0000000fffffffffLL) + 1;
  26.224 -	if (!mrvalid(mrd->mr_base, mrd->mr_len))
  26.225 -	    mrd->mr_flags |= MDF_BOGUS;
  26.226 -	/* If unclaimed and active, must be the BIOS */
  26.227 -	if ((mrd->mr_flags & MDF_ACTIVE) && (mrd->mr_owner[0] == 0))
  26.228 -	    strcpy(mrd->mr_owner, mem_owner_bios);
  26.229 -    }
  26.230 -}
  26.231 -
  26.232 -/*
  26.233 - * Return the MTRR memory type matching a region's flags
  26.234 - */
  26.235 -static int
  26.236 -i686_mtrrtype(int flags)
  26.237 -{
  26.238 -    int		i;
  26.239 -
  26.240 -    flags &= MDF_ATTRMASK;
  26.241 -
  26.242 -    for (i = 0; i < MTRRTOMRTLEN; i++) {
  26.243 -	if (i686_mtrrtomrt[i] == MDF_UNKNOWN)
  26.244 -	    continue;
  26.245 -	if (flags == i686_mtrrtomrt[i])
  26.246 -	    return(i);
  26.247 -    }
  26.248 -    return(-1);
  26.249 -}
  26.250 -#if 0
  26.251 -static int
  26.252 -i686_mrt2mtrr(int flags, int oldval)
  26.253 -{
  26.254 -	int val;
  26.255 -
  26.256 -	if ((val = i686_mtrrtype(flags)) == -1)
  26.257 -		return oldval & 0xff;
  26.258 -	return val & 0xff;
  26.259 -}
  26.260 -#endif
  26.261 -/*
  26.262 - * Update running CPU(s) MTRRs to match the ranges in the descriptor
  26.263 - * list.
  26.264 - *
  26.265 - * XXX Must be called with interrupts enabled.
  26.266 - */
  26.267 -static void
  26.268 -i686_mrstore(struct mem_range_softc *sc)
  26.269 -{
  26.270 -#ifdef SMP
  26.271 -    /*
  26.272 -     * We should use ipi_all_but_self() to call other CPUs into a 
  26.273 -     * locking gate, then call a target function to do this work.
  26.274 -     * The "proper" solution involves a generalised locking gate
  26.275 -     * implementation, not ready yet.
  26.276 -     */
  26.277 -    smp_rendezvous(NULL, i686_mrstoreone, NULL, (void *)sc);
  26.278 -#else
  26.279 -    disable_intr();				/* disable interrupts */
  26.280 -    i686_mrstoreone((void *)sc);
  26.281 -    enable_intr();
  26.282 -#endif
  26.283 -}
  26.284 -
  26.285 -/*
  26.286 - * Update the current CPU's MTRRs with those represented in the
  26.287 - * descriptor list.  Note that we do this wholesale rather than
  26.288 - * just stuffing one entry; this is simpler (but slower, of course).
  26.289 - */
  26.290 -static void
  26.291 -i686_mrstoreone(void *arg)
  26.292 -{
  26.293 -#if 0
  26.294 -    struct mem_range_softc 	*sc = (struct mem_range_softc *)arg;
  26.295 -    struct mem_range_desc	*mrd;
  26.296 -    u_int64_t			omsrv, msrv;
  26.297 -    int				i, j, msr;
  26.298 -    u_int			cr4save;
  26.299 -
  26.300 -    mrd = sc->mr_desc;
  26.301 -
  26.302 -    cr4save = rcr4();				/* save cr4 */
  26.303 -    if (cr4save & CR4_PGE)
  26.304 -	load_cr4(cr4save & ~CR4_PGE);
  26.305 -    load_cr0((rcr0() & ~CR0_NW) | CR0_CD);	/* disable caches (CD = 1, NW = 0) */
  26.306 -    wbinvd();					/* flush caches, TLBs */
  26.307 -    wrmsr(MSR_MTRRdefType, rdmsr(MSR_MTRRdefType) & ~0x800);	/* disable MTRRs (E = 0) */
  26.308 -
  26.309 -    /* Set fixed-range MTRRs */
  26.310 -    if (sc->mr_cap & MR686_FIXMTRR) {
  26.311 -	msr = MSR_MTRR64kBase;
  26.312 -	for (i = 0; i < (MTRR_N64K / 8); i++, msr++) {
  26.313 -	    msrv = 0;
  26.314 -	    omsrv = rdmsr(msr);
  26.315 -	    for (j = 7; j >= 0; j--) {
  26.316 -		msrv = msrv << 8;
  26.317 -		msrv |= i686_mrt2mtrr((mrd + j)->mr_flags, omsrv >> (j*8));
  26.318 -	    }
  26.319 -	    wrmsr(msr, msrv);
  26.320 -	    mrd += 8;
  26.321 -	}
  26.322 -	msr = MSR_MTRR16kBase;
  26.323 -	for (i = 0; i < (MTRR_N16K / 8); i++, msr++) {
  26.324 -	    msrv = 0;
  26.325 -	    omsrv = rdmsr(msr);
  26.326 -	    for (j = 7; j >= 0; j--) {
  26.327 -		msrv = msrv << 8;
  26.328 -		msrv |= i686_mrt2mtrr((mrd + j)->mr_flags, omsrv >> (j*8));
  26.329 -	    }
  26.330 -	    wrmsr(msr, msrv);
  26.331 -	    mrd += 8;
  26.332 -	}
  26.333 -	msr = MSR_MTRR4kBase;
  26.334 -	for (i = 0; i < (MTRR_N4K / 8); i++, msr++) {
  26.335 -	    msrv = 0;
  26.336 -	    omsrv = rdmsr(msr);
  26.337 -	    for (j = 7; j >= 0; j--) {
  26.338 -		msrv = msrv << 8;
  26.339 -		msrv |= i686_mrt2mtrr((mrd + j)->mr_flags, omsrv >> (j*8));
  26.340 -	    }
  26.341 -	    wrmsr(msr, msrv);
  26.342 -	    mrd += 8;
  26.343 -	}
  26.344 -    }
  26.345 -
  26.346 -    /* Set remainder which must be variable MTRRs */
  26.347 -    msr = MSR_MTRRVarBase;
  26.348 -    for (; (mrd - sc->mr_desc) < sc->mr_ndesc; msr += 2, mrd++) {
  26.349 -	/* base/type register */
  26.350 -	omsrv = rdmsr(msr);
  26.351 -	if (mrd->mr_flags & MDF_ACTIVE) {
  26.352 -	    msrv = mrd->mr_base & 0x0000000ffffff000LL;
  26.353 -	    msrv |= i686_mrt2mtrr(mrd->mr_flags, omsrv);
  26.354 -	} else {
  26.355 -	    msrv = 0;
  26.356 -	}
  26.357 -	wrmsr(msr, msrv);	
  26.358 -	    
  26.359 -	/* mask/active register */
  26.360 -	if (mrd->mr_flags & MDF_ACTIVE) {
  26.361 -	    msrv = 0x800 | (~(mrd->mr_len - 1) & 0x0000000ffffff000LL);
  26.362 -	} else {
  26.363 -	    msrv = 0;
  26.364 -	}
  26.365 -	wrmsr(msr + 1, msrv);
  26.366 -    }
  26.367 -    wbinvd();							/* flush caches, TLBs */
  26.368 -    wrmsr(MSR_MTRRdefType, rdmsr(MSR_MTRRdefType) | 0x800);	/* restore MTRR state */
  26.369 -    load_cr0(rcr0() & ~(CR0_CD | CR0_NW));  			/* enable caches CD = 0 and NW = 0 */
  26.370 -    load_cr4(cr4save);						/* restore cr4 */
  26.371 -#endif
  26.372 -}
  26.373 -
  26.374 -/*
  26.375 - * Hunt for the fixed MTRR referencing (addr)
  26.376 - */
  26.377 -static struct mem_range_desc *
  26.378 -i686_mtrrfixsearch(struct mem_range_softc *sc, u_int64_t addr)
  26.379 -{
  26.380 -    struct mem_range_desc *mrd;
  26.381 -    int			i;
  26.382 -    
  26.383 -    for (i = 0, mrd = sc->mr_desc; i < (MTRR_N64K + MTRR_N16K + MTRR_N4K); i++, mrd++)
  26.384 -	if ((addr >= mrd->mr_base) && (addr < (mrd->mr_base + mrd->mr_len)))
  26.385 -	    return(mrd);
  26.386 -    return(NULL);
  26.387 -}
  26.388 -
  26.389 -/*
  26.390 - * Try to satisfy the given range request by manipulating the fixed MTRRs that
  26.391 - * cover low memory.
  26.392 - *
  26.393 - * Note that we try to be generous here; we'll bloat the range out to the 
  26.394 - * next higher/lower boundary to avoid the consumer having to know too much
  26.395 - * about the mechanisms here.
  26.396 - *
  26.397 - * XXX note that this will have to be updated when we start supporting "busy" ranges.
  26.398 - */
  26.399 -static int
  26.400 -i686_mrsetlow(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
  26.401 -{
  26.402 -    struct mem_range_desc	*first_md, *last_md, *curr_md;
  26.403 -
  26.404 -    /* range check */
  26.405 -    if (((first_md = i686_mtrrfixsearch(sc, mrd->mr_base)) == NULL) ||
  26.406 -	((last_md = i686_mtrrfixsearch(sc, mrd->mr_base + mrd->mr_len - 1)) == NULL))
  26.407 -	return(EINVAL);
  26.408 -
  26.409 -    /* check we aren't doing something risky */
  26.410 -    if (!(mrd->mr_flags & MDF_FORCE))
  26.411 -	for (curr_md = first_md; curr_md <= last_md; curr_md++) {
  26.412 -	    if ((curr_md->mr_flags & MDF_ATTRMASK) == MDF_UNKNOWN)
  26.413 -		return (EACCES);
  26.414 -	}
  26.415 -
  26.416 -    /* set flags, clear set-by-firmware flag */
  26.417 -    for (curr_md = first_md; curr_md <= last_md; curr_md++) {
  26.418 -	curr_md->mr_flags = mrcopyflags(curr_md->mr_flags & ~MDF_FIRMWARE, mrd->mr_flags);
  26.419 -	bcopy(mrd->mr_owner, curr_md->mr_owner, sizeof(mrd->mr_owner));
  26.420 -    }
  26.421 -
  26.422 -    return(0);
  26.423 -}
  26.424 -
  26.425 -
  26.426 -/*
  26.427 - * Modify/add a variable MTRR to satisfy the request.
  26.428 - *
  26.429 - * XXX needs to be updated to properly support "busy" ranges.
  26.430 - */
  26.431 -static int
  26.432 -i686_mrsetvariable(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
  26.433 -{
  26.434 -    struct mem_range_desc	*curr_md, *free_md;
  26.435 -    int				i;
  26.436 -    
  26.437 -    /* 
  26.438 -     * Scan the currently active variable descriptors, look for 
  26.439 -     * one we exactly match (straight takeover) and for possible
  26.440 -     * accidental overlaps.
  26.441 -     * Keep track of the first empty variable descriptor in case we
  26.442 -     * can't perform a takeover.
  26.443 -     */
  26.444 -    i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0;
  26.445 -    curr_md = sc->mr_desc + i;
  26.446 -    free_md = NULL;
  26.447 -    for (; i < sc->mr_ndesc; i++, curr_md++) {
  26.448 -	if (curr_md->mr_flags & MDF_ACTIVE) {
  26.449 -	    /* exact match? */
  26.450 -	    if ((curr_md->mr_base == mrd->mr_base) &&
  26.451 -		(curr_md->mr_len == mrd->mr_len)) {
  26.452 -		/* whoops, owned by someone */
  26.453 -		if (curr_md->mr_flags & MDF_BUSY)
  26.454 -		    return(EBUSY);
  26.455 -		/* check we aren't doing something risky */
  26.456 -		if (!(mrd->mr_flags & MDF_FORCE) &&
  26.457 -		  ((curr_md->mr_flags & MDF_ATTRMASK) == MDF_UNKNOWN))
  26.458 -		    return (EACCES);
  26.459 -		/* Ok, just hijack this entry */
  26.460 -		free_md = curr_md;
  26.461 -		break;
  26.462 -	    }
  26.463 -	    /* non-exact overlap ? */
  26.464 -	    if (mroverlap(curr_md, mrd)) {
  26.465 -		/* between conflicting region types? */
  26.466 -		if (i686_mtrrconflict(curr_md->mr_flags, mrd->mr_flags))
  26.467 -		    return(EINVAL);
  26.468 -	    }
  26.469 -	} else if (free_md == NULL) {
  26.470 -	    free_md = curr_md;
  26.471 -	}
  26.472 -    }
  26.473 -    /* got somewhere to put it? */
  26.474 -    if (free_md == NULL)
  26.475 -	return(ENOSPC);
  26.476 -
  26.477 -    /* Set up new descriptor */
  26.478 -    free_md->mr_base = mrd->mr_base;
  26.479 -    free_md->mr_len = mrd->mr_len;
  26.480 -    free_md->mr_flags = mrcopyflags(MDF_ACTIVE, mrd->mr_flags);
  26.481 -    bcopy(mrd->mr_owner, free_md->mr_owner, sizeof(mrd->mr_owner));
  26.482 -    return(0);
  26.483 -}
  26.484 -
  26.485 -/*
  26.486 - * Handle requests to set memory range attributes by manipulating MTRRs.
  26.487 - *
  26.488 - */
  26.489 -static int
  26.490 -i686_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
  26.491 -{
  26.492 -    struct mem_range_desc	*targ;
  26.493 -    int				error = 0;
  26.494 -
  26.495 -    switch(*arg) {
  26.496 -    case MEMRANGE_SET_UPDATE:
  26.497 -	/* make sure that what's being asked for is even possible at all */
  26.498 -	if (!mrvalid(mrd->mr_base, mrd->mr_len) ||
  26.499 -	    i686_mtrrtype(mrd->mr_flags) == -1)
  26.500 -	    return(EINVAL);
  26.501 -
  26.502 -#define FIXTOP	((MTRR_N64K * 0x10000) + (MTRR_N16K * 0x4000) + (MTRR_N4K * 0x1000))
  26.503 -
  26.504 -	/* are the "low memory" conditions applicable? */
  26.505 -	if ((sc->mr_cap & MR686_FIXMTRR) &&
  26.506 -	    ((mrd->mr_base + mrd->mr_len) <= FIXTOP)) {
  26.507 -	    if ((error = i686_mrsetlow(sc, mrd, arg)) != 0)
  26.508 -		return(error);
  26.509 -	} else {
  26.510 -	    /* it's time to play with variable MTRRs */
  26.511 -	    if ((error = i686_mrsetvariable(sc, mrd, arg)) != 0)
  26.512 -		return(error);
  26.513 -	}
  26.514 -	break;
  26.515 -
  26.516 -    case MEMRANGE_SET_REMOVE:
  26.517 -	if ((targ = mem_range_match(sc, mrd)) == NULL)
  26.518 -	    return(ENOENT);
  26.519 -	if (targ->mr_flags & MDF_FIXACTIVE)
  26.520 -	    return(EPERM);
  26.521 -	if (targ->mr_flags & MDF_BUSY)
  26.522 -	    return(EBUSY);
  26.523 -	targ->mr_flags &= ~MDF_ACTIVE;
  26.524 -	targ->mr_owner[0] = 0;
  26.525 -	break;
  26.526 -
  26.527 -    default:
  26.528 -	return(EOPNOTSUPP);
  26.529 -    }
  26.530 -
  26.531 -    /* update the hardware */
  26.532 -    i686_mrstore(sc);
  26.533 -    i686_mrfetch(sc);	/* refetch to see where we're at */
  26.534 -    return(0);
  26.535 -}
  26.536 -
  26.537 -/*
  26.538 - * Work out how many ranges we support, initialise storage for them, 
  26.539 - * fetch the initial settings.
  26.540 - */
  26.541 -static void
  26.542 -i686_mrinit(struct mem_range_softc *sc)
  26.543 -{
  26.544 -    struct mem_range_desc	*mrd;
  26.545 -    int				nmdesc = 0;
  26.546 -    int				i;
  26.547 -
  26.548 -    /* XXX */
  26.549 -    return;
  26.550 -
  26.551 -    mtrrcap = rdmsr(MSR_MTRRcap);
  26.552 -    mtrrdef = rdmsr(MSR_MTRRdefType);
  26.553 -
  26.554 -    /* For now, bail out if MTRRs are not enabled */
  26.555 -    if (!(mtrrdef & 0x800)) {
  26.556 -	if (bootverbose)
  26.557 -	    printf("CPU supports MTRRs but not enabled\n");
  26.558 -	return;
  26.559 -    }
  26.560 -    nmdesc = mtrrcap & 0xff;
  26.561 -    printf("Pentium Pro MTRR support enabled\n");
  26.562 -
  26.563 -    /* If fixed MTRRs supported and enabled */
  26.564 -    if ((mtrrcap & 0x100) && (mtrrdef & 0x400)) {
  26.565 -	sc->mr_cap = MR686_FIXMTRR;
  26.566 -	nmdesc += MTRR_N64K + MTRR_N16K + MTRR_N4K;
  26.567 -    }
  26.568 -
  26.569 -    sc->mr_desc = 
  26.570 -	(struct mem_range_desc *)malloc(nmdesc * sizeof(struct mem_range_desc), 
  26.571 -					M_MEMDESC, M_WAITOK | M_ZERO);
  26.572 -    sc->mr_ndesc = nmdesc;
  26.573 -
  26.574 -    mrd = sc->mr_desc;
  26.575 -
  26.576 -    /* Populate the fixed MTRR entries' base/length */
  26.577 -    if (sc->mr_cap & MR686_FIXMTRR) {
  26.578 -	for (i = 0; i < MTRR_N64K; i++, mrd++) {
  26.579 -	    mrd->mr_base = i * 0x10000;
  26.580 -	    mrd->mr_len = 0x10000;
  26.581 -	    mrd->mr_flags = MDF_FIXBASE | MDF_FIXLEN | MDF_FIXACTIVE;
  26.582 -	}
  26.583 -	for (i = 0; i < MTRR_N16K; i++, mrd++) {
  26.584 -	    mrd->mr_base = i * 0x4000 + 0x80000;
  26.585 -	    mrd->mr_len = 0x4000;
  26.586 -	    mrd->mr_flags = MDF_FIXBASE | MDF_FIXLEN | MDF_FIXACTIVE;
  26.587 -	}
  26.588 -	for (i = 0; i < MTRR_N4K; i++, mrd++) {
  26.589 -	    mrd->mr_base = i * 0x1000 + 0xc0000;
  26.590 -	    mrd->mr_len = 0x1000;
  26.591 -	    mrd->mr_flags = MDF_FIXBASE | MDF_FIXLEN | MDF_FIXACTIVE;
  26.592 -	}
  26.593 -    }
  26.594 -
  26.595 -    /* 
  26.596 -     * Get current settings, anything set now is considered to have 
  26.597 -     * been set by the firmware. (XXX has something already played here?)
  26.598 -     */
  26.599 -    i686_mrfetch(sc);
  26.600 -    mrd = sc->mr_desc;
  26.601 -    for (i = 0; i < sc->mr_ndesc; i++, mrd++) {
  26.602 -	if (mrd->mr_flags & MDF_ACTIVE)
  26.603 -	    mrd->mr_flags |= MDF_FIRMWARE;
  26.604 -    }
  26.605 -}
  26.606 -
  26.607 -/*
  26.608 - * Initialise MTRRs on an AP after the BSP has run the init code.
  26.609 - */
  26.610 -static void
  26.611 -i686_mrAPinit(struct mem_range_softc *sc)
  26.612 -{
  26.613 -    i686_mrstoreone((void *)sc);	/* set MTRRs to match BSP */
  26.614 -    wrmsr(MSR_MTRRdefType, mtrrdef);	/* set MTRR behaviour to match BSP */
  26.615 -}
  26.616 -
  26.617 -static void
  26.618 -i686_mem_drvinit(void *unused)
  26.619 -{
  26.620 -    /* Try for i686 MTRRs */
  26.621 -    if (!mtrrs_disabled && (cpu_feature & CPUID_MTRR) &&
  26.622 -	((cpu_id & 0xf00) == 0x600 || (cpu_id & 0xf00) == 0xf00) &&
  26.623 -	((strcmp(cpu_vendor, "GenuineIntel") == 0) ||
  26.624 -	(strcmp(cpu_vendor, "AuthenticAMD") == 0))) {
  26.625 -	mem_range_softc.mr_op = &i686_mrops;
  26.626 -    }
  26.627 -}
  26.628 -
  26.629 -SYSINIT(i686memdev,SI_SUB_DRIVERS,SI_ORDER_FIRST,i686_mem_drvinit,NULL)
    27.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/initcpu.c	Sun Dec 04 18:24:24 2005 +0100
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,889 +0,0 @@
    27.4 -/*-
    27.5 - * Copyright (c) KATO Takenori, 1997, 1998.
    27.6 - * 
    27.7 - * All rights reserved.  Unpublished rights reserved under the copyright
    27.8 - * laws of Japan.
    27.9 - * 
   27.10 - * Redistribution and use in source and binary forms, with or without
   27.11 - * modification, are permitted provided that the following conditions
   27.12 - * are met:
   27.13 - * 
   27.14 - * 1. Redistributions of source code must retain the above copyright
   27.15 - *    notice, this list of conditions and the following disclaimer as
   27.16 - *    the first lines of this file unmodified.
   27.17 - * 2. Redistributions in binary form must reproduce the above copyright
   27.18 - *    notice, this list of conditions and the following disclaimer in the
   27.19 - *    documentation and/or other materials provided with the distribution.
   27.20 - * 
   27.21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   27.22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   27.23 - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   27.24 - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   27.25 - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   27.26 - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   27.27 - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   27.28 - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   27.29 - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   27.30 - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   27.31 - */
   27.32 -
   27.33 -#include <sys/cdefs.h>
   27.34 -__FBSDID("$FreeBSD: src/sys/i386/i386/initcpu.c,v 1.49 2003/11/10 15:48:30 jhb Exp $");
   27.35 -
   27.36 -#include "opt_cpu.h"
   27.37 -
   27.38 -#include <sys/param.h>
   27.39 -#include <sys/kernel.h>
   27.40 -#include <sys/systm.h>
   27.41 -#include <sys/sysctl.h>
   27.42 -
   27.43 -#include <machine/cputypes.h>
   27.44 -#include <machine/md_var.h>
   27.45 -#include <machine/specialreg.h>
   27.46 -
   27.47 -#if !defined(CPU_ENABLE_SSE) && defined(I686_CPU)
   27.48 -#define CPU_ENABLE_SSE
   27.49 -#endif
   27.50 -#if defined(CPU_DISABLE_SSE)
   27.51 -#undef CPU_ENABLE_SSE
   27.52 -#endif
   27.53 -
   27.54 -void initializecpu(void);
   27.55 -#if defined(I586_CPU) && defined(CPU_WT_ALLOC)
   27.56 -void	enable_K5_wt_alloc(void);
   27.57 -void	enable_K6_wt_alloc(void);
   27.58 -void	enable_K6_2_wt_alloc(void);
   27.59 -#endif
   27.60 -
   27.61 -#ifdef I486_CPU
   27.62 -static void init_5x86(void);
   27.63 -static void init_bluelightning(void);
   27.64 -static void init_486dlc(void);
   27.65 -static void init_cy486dx(void);
   27.66 -#ifdef CPU_I486_ON_386
   27.67 -static void init_i486_on_386(void);
   27.68 -#endif
   27.69 -static void init_6x86(void);
   27.70 -#endif /* I486_CPU */
   27.71 -
   27.72 -#ifdef I686_CPU
   27.73 -static void	init_6x86MX(void);
   27.74 -static void	init_ppro(void);
   27.75 -static void	init_mendocino(void);
   27.76 -#endif
   27.77 -
   27.78 -static int	hw_instruction_sse;
   27.79 -SYSCTL_INT(_hw, OID_AUTO, instruction_sse, CTLFLAG_RD,
   27.80 -    &hw_instruction_sse, 0, "SIMD/MMX2 instructions available in CPU");
   27.81 -
   27.82 -/* Must *NOT* be BSS or locore will bzero these after setting them */
   27.83 -int	cpu = 0;		/* Are we 386, 386sx, 486, etc? */
   27.84 -u_int	cpu_feature = 0;	/* Feature flags */
   27.85 -u_int	cpu_high = 0;		/* Highest arg to CPUID */
   27.86 -u_int	cpu_id = 0;		/* Stepping ID */
   27.87 -u_int	cpu_procinfo = 0;	/* HyperThreading Info / Brand Index / CLFUSH */
   27.88 -char	cpu_vendor[20] = "";	/* CPU Origin code */
   27.89 -
   27.90 -#ifdef CPU_ENABLE_SSE
   27.91 -u_int	cpu_fxsr;		/* SSE enabled */
   27.92 -#endif
   27.93 -
   27.94 -#ifdef I486_CPU
   27.95 -/*
   27.96 - * IBM Blue Lightning
   27.97 - */
   27.98 -static void
   27.99 -init_bluelightning(void)
  27.100 -{
  27.101 -#if 0
  27.102 -	u_long	eflags;
  27.103 -
  27.104 -#if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE)
  27.105 -	need_post_dma_flush = 1;
  27.106 -#endif
  27.107 -
  27.108 -	eflags = read_eflags();
  27.109 -	disable_intr();
  27.110 -
  27.111 -	load_cr0(rcr0() | CR0_CD | CR0_NW);
  27.112 -	invd();
  27.113 -
  27.114 -#ifdef CPU_BLUELIGHTNING_FPU_OP_CACHE
  27.115 -	wrmsr(0x1000, 0x9c92LL);	/* FP operand can be cacheable on Cyrix FPU */
  27.116 -#else
  27.117 -	wrmsr(0x1000, 0x1c92LL);	/* Intel FPU */
  27.118 -#endif
  27.119 -	/* Enables 13MB and 0-640KB cache. */
  27.120 -	wrmsr(0x1001, (0xd0LL << 32) | 0x3ff);
  27.121 -#ifdef CPU_BLUELIGHTNING_3X
  27.122 -	wrmsr(0x1002, 0x04000000LL);	/* Enables triple-clock mode. */
  27.123 -#else
  27.124 -	wrmsr(0x1002, 0x03000000LL);	/* Enables double-clock mode. */
  27.125 -#endif
  27.126 -
  27.127 -	/* Enable caching in CR0. */
  27.128 -	load_cr0(rcr0() & ~(CR0_CD | CR0_NW));	/* CD = 0 and NW = 0 */
  27.129 -	invd();
  27.130 -	write_eflags(eflags);
  27.131 -#endif
  27.132 -}
  27.133 -
  27.134 -/*
  27.135 - * Cyrix 486SLC/DLC/SR/DR series
  27.136 - */
  27.137 -static void
  27.138 -init_486dlc(void)
  27.139 -{
  27.140 -	u_long	eflags;
  27.141 -	u_char	ccr0;
  27.142 -
  27.143 -	eflags = read_eflags();
  27.144 -	disable_intr();
  27.145 -	invd();
  27.146 -
  27.147 -	ccr0 = read_cyrix_reg(CCR0);
  27.148 -#ifndef CYRIX_CACHE_WORKS
  27.149 -	ccr0 |= CCR0_NC1 | CCR0_BARB;
  27.150 -	write_cyrix_reg(CCR0, ccr0);
  27.151 -	invd();
  27.152 -#else
  27.153 -	ccr0 &= ~CCR0_NC0;
  27.154 -#ifndef CYRIX_CACHE_REALLY_WORKS
  27.155 -	ccr0 |= CCR0_NC1 | CCR0_BARB;
  27.156 -#else
  27.157 -	ccr0 |= CCR0_NC1;
  27.158 -#endif
  27.159 -#ifdef CPU_DIRECT_MAPPED_CACHE
  27.160 -	ccr0 |= CCR0_CO;			/* Direct mapped mode. */
  27.161 -#endif
  27.162 -	write_cyrix_reg(CCR0, ccr0);
  27.163 -
  27.164 -	/* Clear non-cacheable region. */
  27.165 -	write_cyrix_reg(NCR1+2, NCR_SIZE_0K);
  27.166 -	write_cyrix_reg(NCR2+2, NCR_SIZE_0K);
  27.167 -	write_cyrix_reg(NCR3+2, NCR_SIZE_0K);
  27.168 -	write_cyrix_reg(NCR4+2, NCR_SIZE_0K);
  27.169 -
  27.170 -	write_cyrix_reg(0, 0);	/* dummy write */
  27.171 -
  27.172 -	/* Enable caching in CR0. */
  27.173 -	load_cr0(rcr0() & ~(CR0_CD | CR0_NW));	/* CD = 0 and NW = 0 */
  27.174 -	invd();
  27.175 -#endif /* !CYRIX_CACHE_WORKS */
  27.176 -	write_eflags(eflags);
  27.177 -}
  27.178 -
  27.179 -
  27.180 -/*
  27.181 - * Cyrix 486S/DX series
  27.182 - */
  27.183 -static void
  27.184 -init_cy486dx(void)
  27.185 -{
  27.186 -	u_long	eflags;
  27.187 -	u_char	ccr2;
  27.188 -
  27.189 -	eflags = read_eflags();
  27.190 -	disable_intr();
  27.191 -	invd();
  27.192 -
  27.193 -	ccr2 = read_cyrix_reg(CCR2);
  27.194 -#ifdef CPU_SUSP_HLT
  27.195 -	ccr2 |= CCR2_SUSP_HLT;
  27.196 -#endif
  27.197 -
  27.198 -#ifdef PC98
  27.199 -	/* Enables WB cache interface pin and Lock NW bit in CR0. */
  27.200 -	ccr2 |= CCR2_WB | CCR2_LOCK_NW;
  27.201 -	/* Unlock NW bit in CR0. */
  27.202 -	write_cyrix_reg(CCR2, ccr2 & ~CCR2_LOCK_NW);
  27.203 -	load_cr0((rcr0() & ~CR0_CD) | CR0_NW);	/* CD = 0, NW = 1 */
  27.204 -#endif
  27.205 -
  27.206 -	write_cyrix_reg(CCR2, ccr2);
  27.207 -	write_eflags(eflags);
  27.208 -}
  27.209 -
  27.210 -
  27.211 -/*
  27.212 - * Cyrix 5x86
  27.213 - */
  27.214 -static void
  27.215 -init_5x86(void)
  27.216 -{
  27.217 -	u_long	eflags;
  27.218 -	u_char	ccr2, ccr3, ccr4, pcr0;
  27.219 -
  27.220 -	eflags = read_eflags();
  27.221 -	disable_intr();
  27.222 -
  27.223 -	load_cr0(rcr0() | CR0_CD | CR0_NW);
  27.224 -	wbinvd();
  27.225 -
  27.226 -	(void)read_cyrix_reg(CCR3);		/* dummy */
  27.227 -
  27.228 -	/* Initialize CCR2. */
  27.229 -	ccr2 = read_cyrix_reg(CCR2);
  27.230 -	ccr2 |= CCR2_WB;
  27.231 -#ifdef CPU_SUSP_HLT
  27.232 -	ccr2 |= CCR2_SUSP_HLT;
  27.233 -#else
  27.234 -	ccr2 &= ~CCR2_SUSP_HLT;
  27.235 -#endif
  27.236 -	ccr2 |= CCR2_WT1;
  27.237 -	write_cyrix_reg(CCR2, ccr2);
  27.238 -
  27.239 -	/* Initialize CCR4. */
  27.240 -	ccr3 = read_cyrix_reg(CCR3);
  27.241 -	write_cyrix_reg(CCR3, CCR3_MAPEN0);
  27.242 -
  27.243 -	ccr4 = read_cyrix_reg(CCR4);
  27.244 -	ccr4 |= CCR4_DTE;
  27.245 -	ccr4 |= CCR4_MEM;
  27.246 -#ifdef CPU_FASTER_5X86_FPU
  27.247 -	ccr4 |= CCR4_FASTFPE;
  27.248 -#else
  27.249 -	ccr4 &= ~CCR4_FASTFPE;
  27.250 -#endif
  27.251 -	ccr4 &= ~CCR4_IOMASK;
  27.252 -	/********************************************************************
  27.253 -	 * WARNING: The "BIOS Writers Guide" mentions that I/O recovery time
  27.254 -	 * should be 0 for errata fix.
  27.255 -	 ********************************************************************/
  27.256 -#ifdef CPU_IORT
  27.257 -	ccr4 |= CPU_IORT & CCR4_IOMASK;
  27.258 -#endif
  27.259 -	write_cyrix_reg(CCR4, ccr4);
  27.260 -
  27.261 -	/* Initialize PCR0. */
  27.262 -	/****************************************************************
  27.263 -	 * WARNING: RSTK_EN and LOOP_EN could make your system unstable.
  27.264 -	 * BTB_EN might make your system unstable.
  27.265 -	 ****************************************************************/
  27.266 -	pcr0 = read_cyrix_reg(PCR0);
  27.267 -#ifdef CPU_RSTK_EN
  27.268 -	pcr0 |= PCR0_RSTK;
  27.269 -#else
  27.270 -	pcr0 &= ~PCR0_RSTK;
  27.271 -#endif
  27.272 -#ifdef CPU_BTB_EN
  27.273 -	pcr0 |= PCR0_BTB;
  27.274 -#else
  27.275 -	pcr0 &= ~PCR0_BTB;
  27.276 -#endif
  27.277 -#ifdef CPU_LOOP_EN
  27.278 -	pcr0 |= PCR0_LOOP;
  27.279 -#else
  27.280 -	pcr0 &= ~PCR0_LOOP;
  27.281 -#endif
  27.282 -
  27.283 -	/****************************************************************
  27.284 -	 * WARNING: if you use a memory mapped I/O device, don't use
  27.285 -	 * DISABLE_5X86_LSSER option, which may reorder memory mapped
  27.286 -	 * I/O access.
  27.287 -	 * IF YOUR MOTHERBOARD HAS PCI BUS, DON'T DISABLE LSSER.
  27.288 -	 ****************************************************************/
  27.289 -#ifdef CPU_DISABLE_5X86_LSSER
  27.290 -	pcr0 &= ~PCR0_LSSER;
  27.291 -#else
  27.292 -	pcr0 |= PCR0_LSSER;
  27.293 -#endif
  27.294 -	write_cyrix_reg(PCR0, pcr0);
  27.295 -
  27.296 -	/* Restore CCR3. */
  27.297 -	write_cyrix_reg(CCR3, ccr3);
  27.298 -
  27.299 -	(void)read_cyrix_reg(0x80);		/* dummy */
  27.300 -
  27.301 -	/* Unlock NW bit in CR0. */
  27.302 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_LOCK_NW);
  27.303 -	load_cr0((rcr0() & ~CR0_CD) | CR0_NW);	/* CD = 0, NW = 1 */
  27.304 -	/* Lock NW bit in CR0. */
  27.305 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW);
  27.306 -
  27.307 -	write_eflags(eflags);
  27.308 -}
  27.309 -
  27.310 -#ifdef CPU_I486_ON_386
  27.311 -/*
  27.312 - * There are i486 based upgrade products for i386 machines.
  27.313 - * In this case, BIOS doesn't enables CPU cache.
  27.314 - */
  27.315 -static void
  27.316 -init_i486_on_386(void)
  27.317 -{
  27.318 -	u_long	eflags;
  27.319 -
  27.320 -#if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE)
  27.321 -	need_post_dma_flush = 1;
  27.322 -#endif
  27.323 -
  27.324 -	eflags = read_eflags();
  27.325 -	disable_intr();
  27.326 -
  27.327 -	load_cr0(rcr0() & ~(CR0_CD | CR0_NW));	/* CD = 0, NW = 0 */
  27.328 -
  27.329 -	write_eflags(eflags);
  27.330 -}
  27.331 -#endif
  27.332 -
  27.333 -/*
  27.334 - * Cyrix 6x86
  27.335 - *
  27.336 - * XXX - What should I do here?  Please let me know.
  27.337 - */
  27.338 -static void
  27.339 -init_6x86(void)
  27.340 -{
  27.341 -	u_long	eflags;
  27.342 -	u_char	ccr3, ccr4;
  27.343 -
  27.344 -	eflags = read_eflags();
  27.345 -	disable_intr();
  27.346 -
  27.347 -	load_cr0(rcr0() | CR0_CD | CR0_NW);
  27.348 -	wbinvd();
  27.349 -
  27.350 -	/* Initialize CCR0. */
  27.351 -	write_cyrix_reg(CCR0, read_cyrix_reg(CCR0) | CCR0_NC1);
  27.352 -
  27.353 -	/* Initialize CCR1. */
  27.354 -#ifdef CPU_CYRIX_NO_LOCK
  27.355 -	write_cyrix_reg(CCR1, read_cyrix_reg(CCR1) | CCR1_NO_LOCK);
  27.356 -#else
  27.357 -	write_cyrix_reg(CCR1, read_cyrix_reg(CCR1) & ~CCR1_NO_LOCK);
  27.358 -#endif
  27.359 -
  27.360 -	/* Initialize CCR2. */
  27.361 -#ifdef CPU_SUSP_HLT
  27.362 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_SUSP_HLT);
  27.363 -#else
  27.364 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_SUSP_HLT);
  27.365 -#endif
  27.366 -
  27.367 -	ccr3 = read_cyrix_reg(CCR3);
  27.368 -	write_cyrix_reg(CCR3, CCR3_MAPEN0);
  27.369 -
  27.370 -	/* Initialize CCR4. */
  27.371 -	ccr4 = read_cyrix_reg(CCR4);
  27.372 -	ccr4 |= CCR4_DTE;
  27.373 -	ccr4 &= ~CCR4_IOMASK;
  27.374 -#ifdef CPU_IORT
  27.375 -	write_cyrix_reg(CCR4, ccr4 | (CPU_IORT & CCR4_IOMASK));
  27.376 -#else
  27.377 -	write_cyrix_reg(CCR4, ccr4 | 7);
  27.378 -#endif
  27.379 -
  27.380 -	/* Initialize CCR5. */
  27.381 -#ifdef CPU_WT_ALLOC
  27.382 -	write_cyrix_reg(CCR5, read_cyrix_reg(CCR5) | CCR5_WT_ALLOC);
  27.383 -#endif
  27.384 -
  27.385 -	/* Restore CCR3. */
  27.386 -	write_cyrix_reg(CCR3, ccr3);
  27.387 -
  27.388 -	/* Unlock NW bit in CR0. */
  27.389 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_LOCK_NW);
  27.390 -
  27.391 -	/*
  27.392 -	 * Earlier revision of the 6x86 CPU could crash the system if
  27.393 -	 * L1 cache is in write-back mode.
  27.394 -	 */
  27.395 -	if ((cyrix_did & 0xff00) > 0x1600)
  27.396 -		load_cr0(rcr0() & ~(CR0_CD | CR0_NW));	/* CD = 0 and NW = 0 */
  27.397 -	else {
  27.398 -		/* Revision 2.6 and lower. */
  27.399 -#ifdef CYRIX_CACHE_REALLY_WORKS
  27.400 -		load_cr0(rcr0() & ~(CR0_CD | CR0_NW));	/* CD = 0 and NW = 0 */
  27.401 -#else
  27.402 -		load_cr0((rcr0() & ~CR0_CD) | CR0_NW);	/* CD = 0 and NW = 1 */
  27.403 -#endif
  27.404 -	}
  27.405 -
  27.406 -	/* Lock NW bit in CR0. */
  27.407 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW);
  27.408 -
  27.409 -	write_eflags(eflags);
  27.410 -}
  27.411 -#endif /* I486_CPU */
  27.412 -
  27.413 -#ifdef I686_CPU
  27.414 -/*
  27.415 - * Cyrix 6x86MX (code-named M2)
  27.416 - *
  27.417 - * XXX - What should I do here?  Please let me know.
  27.418 - */
  27.419 -static void
  27.420 -init_6x86MX(void)
  27.421 -{
  27.422 -#if 0
  27.423 -	u_long	eflags;
  27.424 -	u_char	ccr3, ccr4;
  27.425 -
  27.426 -	eflags = read_eflags();
  27.427 -	disable_intr();
  27.428 -
  27.429 -	load_cr0(rcr0() | CR0_CD | CR0_NW);
  27.430 -	wbinvd();
  27.431 -
  27.432 -	/* Initialize CCR0. */
  27.433 -	write_cyrix_reg(CCR0, read_cyrix_reg(CCR0) | CCR0_NC1);
  27.434 -
  27.435 -	/* Initialize CCR1. */
  27.436 -#ifdef CPU_CYRIX_NO_LOCK
  27.437 -	write_cyrix_reg(CCR1, read_cyrix_reg(CCR1) | CCR1_NO_LOCK);
  27.438 -#else
  27.439 -	write_cyrix_reg(CCR1, read_cyrix_reg(CCR1) & ~CCR1_NO_LOCK);
  27.440 -#endif
  27.441 -
  27.442 -	/* Initialize CCR2. */
  27.443 -#ifdef CPU_SUSP_HLT
  27.444 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_SUSP_HLT);
  27.445 -#else
  27.446 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_SUSP_HLT);
  27.447 -#endif
  27.448 -
  27.449 -	ccr3 = read_cyrix_reg(CCR3);
  27.450 -	write_cyrix_reg(CCR3, CCR3_MAPEN0);
  27.451 -
  27.452 -	/* Initialize CCR4. */
  27.453 -	ccr4 = read_cyrix_reg(CCR4);
  27.454 -	ccr4 &= ~CCR4_IOMASK;
  27.455 -#ifdef CPU_IORT
  27.456 -	write_cyrix_reg(CCR4, ccr4 | (CPU_IORT & CCR4_IOMASK));
  27.457 -#else
  27.458 -	write_cyrix_reg(CCR4, ccr4 | 7);
  27.459 -#endif
  27.460 -
  27.461 -	/* Initialize CCR5. */
  27.462 -#ifdef CPU_WT_ALLOC
  27.463 -	write_cyrix_reg(CCR5, read_cyrix_reg(CCR5) | CCR5_WT_ALLOC);
  27.464 -#endif
  27.465 -
  27.466 -	/* Restore CCR3. */
  27.467 -	write_cyrix_reg(CCR3, ccr3);
  27.468 -
  27.469 -	/* Unlock NW bit in CR0. */
  27.470 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) & ~CCR2_LOCK_NW);
  27.471 -
  27.472 -	load_cr0(rcr0() & ~(CR0_CD | CR0_NW));	/* CD = 0 and NW = 0 */
  27.473 -
  27.474 -	/* Lock NW bit in CR0. */
  27.475 -	write_cyrix_reg(CCR2, read_cyrix_reg(CCR2) | CCR2_LOCK_NW);
  27.476 -
  27.477 -	write_eflags(eflags);
  27.478 -#endif
  27.479 -}
  27.480 -
  27.481 -static void
  27.482 -init_ppro(void)
  27.483 -{
  27.484 -	u_int64_t	apicbase;
  27.485 -
  27.486 -	/*
  27.487 -	 * Local APIC should be disabled if it is not going to be used.
  27.488 -	 */
  27.489 -	apicbase = rdmsr(MSR_APICBASE);
  27.490 -	apicbase &= ~APICBASE_ENABLED;
  27.491 -	wrmsr(MSR_APICBASE, apicbase);
  27.492 -}
  27.493 -
  27.494 -/*
  27.495 - * Initialize BBL_CR_CTL3 (Control register 3: used to configure the
  27.496 - * L2 cache).
  27.497 - */
  27.498 -static void
  27.499 -init_mendocino(void)
  27.500 -{
  27.501 -#ifdef CPU_PPRO2CELERON
  27.502 -	u_long	eflags;
  27.503 -	u_int64_t	bbl_cr_ctl3;
  27.504 -
  27.505 -	eflags = read_eflags();
  27.506 -	disable_intr();
  27.507 -
  27.508 -	load_cr0(rcr0() | CR0_CD | CR0_NW);
  27.509 -	wbinvd();
  27.510 -
  27.511 -	bbl_cr_ctl3 = rdmsr(MSR_BBL_CR_CTL3);
  27.512 -
  27.513 -	/* If the L2 cache is configured, do nothing. */
  27.514 -	if (!(bbl_cr_ctl3 & 1)) {
  27.515 -		bbl_cr_ctl3 = 0x134052bLL;
  27.516 -
  27.517 -		/* Set L2 Cache Latency (Default: 5). */
  27.518 -#ifdef	CPU_CELERON_L2_LATENCY
  27.519 -#if CPU_L2_LATENCY > 15
  27.520 -#error invalid CPU_L2_LATENCY.
  27.521 -#endif
  27.522 -		bbl_cr_ctl3 |= CPU_L2_LATENCY << 1;
  27.523 -#else
  27.524 -		bbl_cr_ctl3 |= 5 << 1;
  27.525 -#endif
  27.526 -		wrmsr(MSR_BBL_CR_CTL3, bbl_cr_ctl3);
  27.527 -	}
  27.528 -
  27.529 -	load_cr0(rcr0() & ~(CR0_CD | CR0_NW));
  27.530 -	write_eflags(eflags);
  27.531 -#endif /* CPU_PPRO2CELERON */
  27.532 -}
  27.533 -
  27.534 -#endif /* I686_CPU */
  27.535 -
  27.536 -/*
  27.537 - * Initialize CR4 (Control register 4) to enable SSE instructions.
  27.538 - */
  27.539 -void
  27.540 -enable_sse(void)
  27.541 -{
  27.542 -#ifdef XEN 
  27.543 -    return;
  27.544 -#endif
  27.545 -#if defined(CPU_ENABLE_SSE)
  27.546 -	if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) {
  27.547 -		load_cr4(rcr4() | CR4_FXSR | CR4_XMM);
  27.548 -		cpu_fxsr = hw_instruction_sse = 1;
  27.549 -	}
  27.550 -#endif
  27.551 -}
  27.552 -
  27.553 -void
  27.554 -initializecpu(void)
  27.555 -{
  27.556 -
  27.557 -	switch (cpu) {
  27.558 -#ifdef I486_CPU
  27.559 -	case CPU_BLUE:
  27.560 -		init_bluelightning();
  27.561 -		break;
  27.562 -	case CPU_486DLC:
  27.563 -		init_486dlc();
  27.564 -		break;
  27.565 -	case CPU_CY486DX:
  27.566 -		init_cy486dx();
  27.567 -		break;
  27.568 -	case CPU_M1SC:
  27.569 -		init_5x86();
  27.570 -		break;
  27.571 -#ifdef CPU_I486_ON_386
  27.572 -	case CPU_486:
  27.573 -		init_i486_on_386();
  27.574 -		break;
  27.575 -#endif
  27.576 -	case CPU_M1:
  27.577 -		init_6x86();
  27.578 -		break;
  27.579 -#endif /* I486_CPU */
  27.580 -#ifdef I686_CPU
  27.581 -	case CPU_M2:
  27.582 -		init_6x86MX();
  27.583 -		break;
  27.584 -	case CPU_686:
  27.585 -		if (strcmp(cpu_vendor, "GenuineIntel") == 0) {
  27.586 -			switch (cpu_id & 0xff0) {
  27.587 -			case 0x610:
  27.588 -				init_ppro();
  27.589 -				break;
  27.590 -			case 0x660:
  27.591 -				init_mendocino();
  27.592 -				break;
  27.593 -			}
  27.594 -		} else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
  27.595 -#if defined(I686_CPU) && defined(CPU_ATHLON_SSE_HACK)
  27.596 -			/*
  27.597 -			 * Sometimes the BIOS doesn't enable SSE instructions.
  27.598 -			 * According to AMD document 20734, the mobile
  27.599 -			 * Duron, the (mobile) Athlon 4 and the Athlon MP
  27.600 -			 * support SSE. These correspond to cpu_id 0x66X
  27.601 -			 * or 0x67X.
  27.602 -			 */
  27.603 -			if ((cpu_feature & CPUID_XMM) == 0 &&
  27.604 -			    ((cpu_id & ~0xf) == 0x660 ||
  27.605 -			     (cpu_id & ~0xf) == 0x670 ||
  27.606 -			     (cpu_id & ~0xf) == 0x680)) {
  27.607 -				u_int regs[4];
  27.608 -				wrmsr(0xC0010015, rdmsr(0xC0010015) & ~0x08000);
  27.609 -				do_cpuid(1, regs);
  27.610 -				cpu_feature = regs[3];
  27.611 -			}
  27.612 -#endif
  27.613 -		}
  27.614 -		break;
  27.615 -#endif
  27.616 -	default:
  27.617 -		break;
  27.618 -	}
  27.619 -	enable_sse();
  27.620 -
  27.621 -#if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE)
  27.622 -	/*
  27.623 -	 * OS should flush L1 cache by itself because no PC-98 supports
  27.624 -	 * non-Intel CPUs.  Use wbinvd instruction before DMA transfer
  27.625 -	 * when need_pre_dma_flush = 1, use invd instruction after DMA
  27.626 -	 * transfer when need_post_dma_flush = 1.  If your CPU upgrade
  27.627 -	 * product supports hardware cache control, you can add the
  27.628 -	 * CPU_UPGRADE_HW_CACHE option in your kernel configuration file.
  27.629 -	 * This option eliminates unneeded cache flush instruction(s).
  27.630 -	 */
  27.631 -	if (strcmp(cpu_vendor, "CyrixInstead") == 0) {
  27.632 -		switch (cpu) {
  27.633 -#ifdef I486_CPU
  27.634 -		case CPU_486DLC:
  27.635 -			need_post_dma_flush = 1;
  27.636 -			break;
  27.637 -		case CPU_M1SC:
  27.638 -			need_pre_dma_flush = 1;
  27.639 -			break;
  27.640 -		case CPU_CY486DX:
  27.641 -			need_pre_dma_flush = 1;
  27.642 -#ifdef CPU_I486_ON_386
  27.643 -			need_post_dma_flush = 1;
  27.644 -#endif
  27.645 -			break;
  27.646 -#endif
  27.647 -		default:
  27.648 -			break;
  27.649 -		}
  27.650 -	} else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
  27.651 -		switch (cpu_id & 0xFF0) {
  27.652 -		case 0x470:		/* Enhanced Am486DX2 WB */
  27.653 -		case 0x490:		/* Enhanced Am486DX4 WB */
  27.654 -		case 0x4F0:		/* Am5x86 WB */
  27.655 -			need_pre_dma_flush = 1;
  27.656 -			break;
  27.657 -		}
  27.658 -	} else if (strcmp(cpu_vendor, "IBM") == 0) {
  27.659 -		need_post_dma_flush = 1;
  27.660 -	} else {
  27.661 -#ifdef CPU_I486_ON_386
  27.662 -		need_pre_dma_flush = 1;
  27.663 -#endif
  27.664 -	}
  27.665 -#endif /* PC98 && !CPU_UPGRADE_HW_CACHE */
  27.666 -}
  27.667 -
  27.668 -#if defined(I586_CPU) && defined(CPU_WT_ALLOC)
  27.669 -/*
  27.670 - * Enable write allocate feature of AMD processors.
  27.671 - * Following two functions require the Maxmem variable being set.
  27.672 - */
  27.673 -void
  27.674 -enable_K5_wt_alloc(void)
  27.675 -{
  27.676 -	u_int64_t	msr;
  27.677 -	register_t	savecrit;
  27.678 -
  27.679 -	/*
  27.680 -	 * Write allocate is supported only on models 1, 2, and 3, with
  27.681 -	 * a stepping of 4 or greater.
  27.682 -	 */
  27.683 -	if (((cpu_id & 0xf0) > 0) && ((cpu_id & 0x0f) > 3)) {
  27.684 -		savecrit = intr_disable();
  27.685 -		msr = rdmsr(0x83);		/* HWCR */
  27.686 -		wrmsr(0x83, msr & !(0x10));
  27.687 -
  27.688 -		/*
  27.689 -		 * We have to tell the chip where the top of memory is,
  27.690 -		 * since video cards could have frame bufferes there,
  27.691 -		 * memory-mapped I/O could be there, etc.
  27.692 -		 */
  27.693 -		if(Maxmem > 0)
  27.694 -		  msr = Maxmem / 16;
  27.695 -		else
  27.696 -		  msr = 0;
  27.697 -		msr |= AMD_WT_ALLOC_TME | AMD_WT_ALLOC_FRE;
  27.698 -#ifdef PC98
  27.699 -		if (!(inb(0x43b) & 4)) {
  27.700 -			wrmsr(0x86, 0x0ff00f0);
  27.701 -			msr |= AMD_WT_ALLOC_PRE;
  27.702 -		}
  27.703 -#else
  27.704 -		/*
  27.705 -		 * There is no way to know wheter 15-16M hole exists or not. 
  27.706 -		 * Therefore, we disable write allocate for this range.
  27.707 -		 */
  27.708 -			wrmsr(0x86, 0x0ff00f0);
  27.709 -			msr |= AMD_WT_ALLOC_PRE;
  27.710 -#endif
  27.711 -		wrmsr(0x85, msr);
  27.712 -
  27.713 -		msr=rdmsr(0x83);
  27.714 -		wrmsr(0x83, msr|0x10); /* enable write allocate */
  27.715 -		intr_restore(savecrit);
  27.716 -	}
  27.717 -}
  27.718 -
  27.719 -void
  27.720 -enable_K6_wt_alloc(void)
  27.721 -{
  27.722 -	quad_t	size;
  27.723 -	u_int64_t	whcr;
  27.724 -	u_long	eflags;
  27.725 -
  27.726 -	eflags = read_eflags();
  27.727 -	disable_intr();
  27.728 -	wbinvd();
  27.729 -
  27.730 -#ifdef CPU_DISABLE_CACHE
  27.731 -	/*
  27.732 -	 * Certain K6-2 box becomes unstable when write allocation is
  27.733 -	 * enabled.
  27.734 -	 */
  27.735 -	/*
  27.736 -	 * The AMD-K6 processer provides the 64-bit Test Register 12(TR12),
  27.737 -	 * but only the Cache Inhibit(CI) (bit 3 of TR12) is suppported.
  27.738 -	 * All other bits in TR12 have no effect on the processer's operation.
  27.739 -	 * The I/O Trap Restart function (bit 9 of TR12) is always enabled
  27.740 -	 * on the AMD-K6.
  27.741 -	 */
  27.742 -	wrmsr(0x0000000e, (u_int64_t)0x0008);
  27.743 -#endif
  27.744 -	/* Don't assume that memory size is aligned with 4M. */
  27.745 -	if (Maxmem > 0)
  27.746 -	  size = ((Maxmem >> 8) + 3) >> 2;
  27.747 -	else
  27.748 -	  size = 0;
  27.749 -
  27.750 -	/* Limit is 508M bytes. */
  27.751 -	if (size > 0x7f)
  27.752 -		size = 0x7f;
  27.753 -	whcr = (rdmsr(0xc0000082) & ~(0x7fLL << 1)) | (size << 1);
  27.754 -
  27.755 -#if defined(PC98) || defined(NO_MEMORY_HOLE)
  27.756 -	if (whcr & (0x7fLL << 1)) {
  27.757 -#ifdef PC98
  27.758 -		/*
  27.759 -		 * If bit 2 of port 0x43b is 0, disable wrte allocate for the
  27.760 -		 * 15-16M range.
  27.761 -		 */
  27.762 -		if (!(inb(0x43b) & 4))
  27.763 -			whcr &= ~0x0001LL;
  27.764 -		else
  27.765 -#endif
  27.766 -			whcr |=  0x0001LL;
  27.767 -	}
  27.768 -#else
  27.769 -	/*
  27.770 -	 * There is no way to know wheter 15-16M hole exists or not. 
  27.771 -	 * Therefore, we disable write allocate for this range.
  27.772 -	 */
  27.773 -	whcr &= ~0x0001LL;
  27.774 -#endif
  27.775 -	wrmsr(0x0c0000082, whcr);
  27.776 -
  27.777 -	write_eflags(eflags);
  27.778 -}
  27.779 -
  27.780 -void
  27.781 -enable_K6_2_wt_alloc(void)
  27.782 -{
  27.783 -	quad_t	size;
  27.784 -	u_int64_t	whcr;
  27.785 -	u_long	eflags;
  27.786 -
  27.787 -	eflags = read_eflags();
  27.788 -	disable_intr();
  27.789 -	wbinvd();
  27.790 -
  27.791 -#ifdef CPU_DISABLE_CACHE
  27.792 -	/*
  27.793 -	 * Certain K6-2 box becomes unstable when write allocation is
  27.794 -	 * enabled.
  27.795 -	 */
  27.796 -	/*
  27.797 -	 * The AMD-K6 processer provides the 64-bit Test Register 12(TR12),
  27.798 -	 * but only the Cache Inhibit(CI) (bit 3 of TR12) is suppported.
  27.799 -	 * All other bits in TR12 have no effect on the processer's operation.
  27.800 -	 * The I/O Trap Restart function (bit 9 of TR12) is always enabled
  27.801 -	 * on the AMD-K6.
  27.802 -	 */
  27.803 -	wrmsr(0x0000000e, (u_int64_t)0x0008);
  27.804 -#endif
  27.805 -	/* Don't assume that memory size is aligned with 4M. */
  27.806 -	if (Maxmem > 0)
  27.807 -	  size = ((Maxmem >> 8) + 3) >> 2;
  27.808 -	else
  27.809 -	  size = 0;
  27.810 -
  27.811 -	/* Limit is 4092M bytes. */
  27.812 -	if (size > 0x3fff)
  27.813 -		size = 0x3ff;
  27.814 -	whcr = (rdmsr(0xc0000082) & ~(0x3ffLL << 22)) | (size << 22);
  27.815 -
  27.816 -#if defined(PC98) || defined(NO_MEMORY_HOLE)
  27.817 -	if (whcr & (0x3ffLL << 22)) {
  27.818 -#ifdef PC98
  27.819 -		/*
  27.820 -		 * If bit 2 of port 0x43b is 0, disable wrte allocate for the
  27.821 -		 * 15-16M range.
  27.822 -		 */
  27.823 -		if (!(inb(0x43b) & 4))
  27.824 -			whcr &= ~(1LL << 16);
  27.825 -		else
  27.826 -#endif
  27.827 -			whcr |=  1LL << 16;
  27.828 -	}
  27.829 -#else
  27.830 -	/*
  27.831 -	 * There is no way to know wheter 15-16M hole exists or not. 
  27.832 -	 * Therefore, we disable write allocate for this range.
  27.833 -	 */
  27.834 -	whcr &= ~(1LL << 16);
  27.835 -#endif
  27.836 -	wrmsr(0x0c0000082, whcr);
  27.837 -
  27.838 -	write_eflags(eflags);
  27.839 -}
  27.840 -#endif /* I585_CPU && CPU_WT_ALLOC */
  27.841 -
  27.842 -#include "opt_ddb.h"
  27.843 -#ifdef DDB
  27.844 -#include <ddb/ddb.h>
  27.845 -#if 0
  27.846 -DB_SHOW_COMMAND(cyrixreg, cyrixreg)
  27.847 -{
  27.848 -	u_long	eflags;
  27.849 -	u_int	cr0;
  27.850 -	u_char	ccr1, ccr2, ccr3;
  27.851 -	u_char	ccr0 = 0, ccr4 = 0, ccr5 = 0, pcr0 = 0;
  27.852 -
  27.853 -	cr0 = rcr0();
  27.854 -	if (strcmp(cpu_vendor,"CyrixInstead") == 0) {
  27.855 -		eflags = read_eflags();
  27.856 -		disable_intr();
  27.857 -
  27.858 -
  27.859 -		if ((cpu != CPU_M1SC) && (cpu != CPU_CY486DX)) {
  27.860 -			ccr0 = read_cyrix_reg(CCR0);
  27.861 -		}
  27.862 -		ccr1 = read_cyrix_reg(CCR1);
  27.863 -		ccr2 = read_cyrix_reg(CCR2);
  27.864 -		ccr3 = read_cyrix_reg(CCR3);
  27.865 -		if ((cpu == CPU_M1SC) || (cpu == CPU_M1) || (cpu == CPU_M2)) {
  27.866 -			write_cyrix_reg(CCR3, CCR3_MAPEN0);
  27.867 -			ccr4 = read_cyrix_reg(CCR4);
  27.868 -			if ((cpu == CPU_M1) || (cpu == CPU_M2))
  27.869 -				ccr5 = read_cyrix_reg(CCR5);
  27.870 -			else
  27.871 -				pcr0 = read_cyrix_reg(PCR0);
  27.872 -			write_cyrix_reg(CCR3, ccr3);		/* Restore CCR3. */
  27.873 -		}
  27.874 -		write_eflags(eflags);
  27.875 -
  27.876 -		if ((cpu != CPU_M1SC) && (cpu != CPU_CY486DX))
  27.877 -			printf("CCR0=%x, ", (u_int)ccr0);
  27.878 -
  27.879 -		printf("CCR1=%x, CCR2=%x, CCR3=%x",
  27.880 -			(u_int)ccr1, (u_int)ccr2, (u_int)ccr3);
  27.881 -		if ((cpu == CPU_M1SC) || (cpu == CPU_M1) || (cpu == CPU_M2)) {
  27.882 -			printf(", CCR4=%x, ", (u_int)ccr4);
  27.883 -			if (cpu == CPU_M1SC)
  27.884 -				printf("PCR0=%x\n", pcr0);
  27.885 -			else
  27.886 -				printf("CCR5=%x\n", ccr5);
  27.887 -		}
  27.888 -	}
  27.889 -	printf("CR0=%x\n", cr0);
  27.890 -}
  27.891 -#endif
  27.892 -#endif /* DDB */
    28.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/intr_machdep.c	Sun Dec 04 18:24:24 2005 +0100
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,326 +0,0 @@
    28.4 -/*-
    28.5 - * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org>
    28.6 - * All rights reserved.
    28.7 - *
    28.8 - * Redistribution and use in source and binary forms, with or without
    28.9 - * modification, are permitted provided that the following conditions
   28.10 - * are met:
   28.11 - * 1. Redistributions of source code must retain the above copyright
   28.12 - *    notice, this list of conditions and the following disclaimer.
   28.13 - * 2. Redistributions in binary form must reproduce the above copyright
   28.14 - *    notice, this list of conditions and the following disclaimer in the
   28.15 - *    documentation and/or other materials provided with the distribution.
   28.16 - * 3. Neither the name of the author nor the names of any co-contributors
   28.17 - *    may be used to endorse or promote products derived from this software
   28.18 - *    without specific prior written permission.
   28.19 - *
   28.20 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   28.21 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   28.22 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   28.23 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   28.24 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   28.25 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   28.26 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28.27 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28.28 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28.29 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28.30 - * SUCH DAMAGE.
   28.31 - *
   28.32 - * $FreeBSD: src/sys/i386/i386/intr_machdep.c,v 1.4 2003/11/17 06:10:14 peter Exp $
   28.33 - */
   28.34 -
   28.35 -/*
   28.36 - * Machine dependent interrupt code for i386.  For the i386, we have to
   28.37 - * deal with different PICs.  Thus, we use the passed in vector to lookup
   28.38 - * an interrupt source associated with that vector.  The interrupt source
   28.39 - * describes which PIC the source belongs to and includes methods to handle
   28.40 - * that source.
   28.41 - */
   28.42 -
   28.43 -#include "opt_ddb.h"
   28.44 -
   28.45 -#include <sys/param.h>
   28.46 -#include <sys/bus.h>
   28.47 -#include <sys/interrupt.h>
   28.48 -#include <sys/lock.h>
   28.49 -#include <sys/ktr.h>
   28.50 -#include <sys/kernel.h>
   28.51 -#include <sys/mutex.h>
   28.52 -#include <sys/proc.h>
   28.53 -#include <sys/syslog.h>
   28.54 -#include <sys/systm.h>
   28.55 -#include <machine/clock.h>
   28.56 -#include <machine/intr_machdep.h>
   28.57 -#ifdef DDB
   28.58 -#include <ddb/ddb.h>
   28.59 -#endif
   28.60 -
   28.61 -#define	MAX_STRAY_LOG	5
   28.62 -
   28.63 -typedef void (*mask_fn)(uintptr_t vector);
   28.64 -
   28.65 -static int intrcnt_index;
   28.66 -static struct intsrc *interrupt_sources[NUM_IO_INTS];
   28.67 -static struct mtx intr_table_lock;
   28.68 -
   28.69 -static void	intr_init(void *__dummy);
   28.70 -static void	intrcnt_setname(const char *name, int index);
   28.71 -static void	intrcnt_updatename(struct intsrc *is);
   28.72 -static void	intrcnt_register(struct intsrc *is);
   28.73 -
   28.74 -/*
   28.75 - * Register a new interrupt source with the global interrupt system.
   28.76 - * The global interrupts need to be disabled when this function is
   28.77 - * called.
   28.78 - */
   28.79 -int
   28.80 -intr_register_source(struct intsrc *isrc)
   28.81 -{
   28.82 -	int error, vector;
   28.83 -
   28.84 -	vector = isrc->is_pic->pic_vector(isrc);
   28.85 -	if (interrupt_sources[vector] != NULL)
   28.86 -		return (EEXIST);
   28.87 -	error = ithread_create(&isrc->is_ithread, (uintptr_t)isrc, 0,
   28.88 -	    (mask_fn)isrc->is_pic->pic_disable_source,
   28.89 -	    (mask_fn)isrc->is_pic->pic_enable_source, "irq%d:", vector);
   28.90 -	if (error)
   28.91 -		return (error);
   28.92 -	mtx_lock_spin(&intr_table_lock);
   28.93 -	if (interrupt_sources[vector] != NULL) {
   28.94 -		mtx_unlock_spin(&intr_table_lock);
   28.95 -		ithread_destroy(isrc->is_ithread);
   28.96 -		return (EEXIST);
   28.97 -	}
   28.98 -	intrcnt_register(isrc);
   28.99 -	interrupt_sources[vector] = isrc;
  28.100 -	mtx_unlock_spin(&intr_table_lock);
  28.101 -	return (0);
  28.102 -}
  28.103 -
  28.104 -struct intsrc *
  28.105 -intr_lookup_source(int vector)
  28.106 -{
  28.107 -
  28.108 -	return (interrupt_sources[vector]);
  28.109 -}
  28.110 -
  28.111 -int
  28.112 -intr_add_handler(const char *name, int vector, driver_intr_t handler,
  28.113 -    void *arg, enum intr_type flags, void **cookiep)
  28.114 -{
  28.115 -	struct intsrc *isrc;
  28.116 -	int error;
  28.117 -
  28.118 -	isrc = intr_lookup_source(vector);
  28.119 -	if (isrc == NULL)
  28.120 -		return (EINVAL);
  28.121 -
  28.122 -	error = ithread_add_handler(isrc->is_ithread, name, handler, arg,
  28.123 -	    ithread_priority(flags), flags, cookiep);
  28.124 -	if (error == 0) {
  28.125 -		intrcnt_updatename(isrc);
  28.126 -		isrc->is_pic->pic_enable_intr(isrc);
  28.127 -		isrc->is_pic->pic_enable_source(isrc);
  28.128 -	}
  28.129 -	return (error);
  28.130 -}
  28.131 -
  28.132 -int
  28.133 -intr_remove_handler(void *cookie)
  28.134 -{
  28.135 -	int error;
  28.136 -
  28.137 -	error = ithread_remove_handler(cookie);
  28.138 -#ifdef XXX
  28.139 -	if (error == 0)
  28.140 -		intrcnt_updatename(/* XXX */);
  28.141 -#endif
  28.142 -	return (error);
  28.143 -}
  28.144 -
  28.145 -int
  28.146 -intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol)
  28.147 -{
  28.148 -	struct intsrc *isrc;
  28.149 -
  28.150 -	isrc = intr_lookup_source(vector);
  28.151 -	if (isrc == NULL)
  28.152 -		return (EINVAL);
  28.153 -	return (isrc->is_pic->pic_config_intr(isrc, trig, pol));
  28.154 -}
  28.155 -
  28.156 -void
  28.157 -intr_execute_handlers(struct intsrc *isrc, struct intrframe *iframe)
  28.158 -{
  28.159 -	struct thread *td;
  28.160 -	struct ithd *it;
  28.161 -	struct intrhand *ih;
  28.162 -	int error, vector;
  28.163 -
  28.164 -	td = curthread;
  28.165 -	td->td_intr_nesting_level++;
  28.166 -
  28.167 -	/*
  28.168 -	 * We count software interrupts when we process them.  The
  28.169 -	 * code here follows previous practice, but there's an
  28.170 -	 * argument for counting hardware interrupts when they're
  28.171 -	 * processed too.
  28.172 -	 */
  28.173 -	atomic_add_long(isrc->is_count, 1);
  28.174 -	atomic_add_int(&cnt.v_intr, 1);
  28.175 -
  28.176 -	it = isrc->is_ithread;
  28.177 -	if (it == NULL)
  28.178 -		ih = NULL;
  28.179 -	else
  28.180 -		ih = TAILQ_FIRST(&it->it_handlers);
  28.181 -
  28.182 -	/*
  28.183 -	 * XXX: We assume that IRQ 0 is only used for the ISA timer
  28.184 -	 * device (clk).
  28.185 -	 */
  28.186 -	vector = isrc->is_pic->pic_vector(isrc);
  28.187 -	if (vector == 0)
  28.188 -		clkintr_pending = 1;
  28.189 -
  28.190 -
  28.191 -	if (ih != NULL && ih->ih_flags & IH_FAST) {
  28.192 -		/*
  28.193 -		 * Execute fast interrupt handlers directly.
  28.194 -		 * To support clock handlers, if a handler registers
  28.195 -		 * with a NULL argument, then we pass it a pointer to
  28.196 -		 * a trapframe as its argument.
  28.197 -		 */
  28.198 -		critical_enter();
  28.199 -		TAILQ_FOREACH(ih, &it->it_handlers, ih_next) {
  28.200 -			MPASS(ih->ih_flags & IH_FAST);
  28.201 -			CTR3(KTR_INTR, "%s: executing handler %p(%p)",
  28.202 -			    __func__, ih->ih_handler,
  28.203 -			    ih->ih_argument == NULL ? iframe :
  28.204 -			    ih->ih_argument);
  28.205 -			if (ih->ih_argument == NULL)
  28.206 -				ih->ih_handler(iframe);
  28.207 -			else
  28.208 -				ih->ih_handler(ih->ih_argument);
  28.209 -		}
  28.210 -		isrc->is_pic->pic_eoi_source(isrc);
  28.211 -		error = 0;
  28.212 -		/* XXX */
  28.213 -		td->td_pflags &= ~TDP_OWEPREEMPT;
  28.214 -		critical_exit();
  28.215 -	} else {
  28.216 -		/*
  28.217 -		 * For stray and threaded interrupts, we mask and EOI the
  28.218 -		 * source.
  28.219 -		 */
  28.220 -		isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
  28.221 -		if (ih == NULL)
  28.222 -			error = EINVAL;
  28.223 -		else
  28.224 -			error = ithread_schedule(it);
  28.225 -		isrc->is_pic->pic_eoi_source(isrc);
  28.226 -	}
  28.227 -
  28.228 -	if (error == EINVAL) {
  28.229 -		atomic_add_long(isrc->is_straycount, 1);
  28.230 -		if (*isrc->is_straycount < MAX_STRAY_LOG)
  28.231 -			log(LOG_ERR, "stray irq%d\n", vector);
  28.232 -		else if (*isrc->is_straycount == MAX_STRAY_LOG)
  28.233 -			log(LOG_CRIT,
  28.234 -			    "too many stray irq %d's: not logging anymore\n",
  28.235 -			    vector);
  28.236 -	}
  28.237 -	td->td_intr_nesting_level--;
  28.238 -	
  28.239 -}
  28.240 -
  28.241 -void
  28.242 -intr_resume(void)
  28.243 -{
  28.244 -	struct intsrc **isrc;
  28.245 -	int i;
  28.246 -
  28.247 -	mtx_lock_spin(&intr_table_lock);
  28.248 -	for (i = 0, isrc = interrupt_sources; i < NUM_IO_INTS; i++, isrc++)
  28.249 -		if (*isrc != NULL && (*isrc)->is_pic->pic_resume != NULL)
  28.250 -			(*isrc)->is_pic->pic_resume(*isrc);
  28.251 -	mtx_unlock_spin(&intr_table_lock);
  28.252 -}
  28.253 -
  28.254 -void
  28.255 -intr_suspend(void)
  28.256 -{
  28.257 -	struct intsrc **isrc;
  28.258 -	int i;
  28.259 -
  28.260 -	mtx_lock_spin(&intr_table_lock);
  28.261 -	for (i = 0, isrc = interrupt_sources; i < NUM_IO_INTS; i++, isrc++)
  28.262 -		if (*isrc != NULL && (*isrc)->is_pic->pic_suspend != NULL)
  28.263 -			(*isrc)->is_pic->pic_suspend(*isrc);
  28.264 -	mtx_unlock_spin(&intr_table_lock);
  28.265 -}
  28.266 -
  28.267 -static void
  28.268 -intrcnt_setname(const char *name, int index)
  28.269 -{
  28.270 -
  28.271 -	snprintf(intrnames + (MAXCOMLEN + 1) * index, MAXCOMLEN + 1, "%-*s",
  28.272 -	    MAXCOMLEN, name);
  28.273 -}
  28.274 -
  28.275 -static void
  28.276 -intrcnt_updatename(struct intsrc *is)
  28.277 -{
  28.278 -
  28.279 -	intrcnt_setname(is->is_ithread->it_td->td_proc->p_comm, is->is_index);
  28.280 -}
  28.281 -
  28.282 -static void
  28.283 -intrcnt_register(struct intsrc *is)
  28.284 -{
  28.285 -	char straystr[MAXCOMLEN + 1];
  28.286 -
  28.287 -	/* mtx_assert(&intr_table_lock, MA_OWNED); */
  28.288 -	KASSERT(is->is_ithread != NULL, ("%s: isrc with no ithread", __func__));
  28.289 -	is->is_index = intrcnt_index;
  28.290 -	intrcnt_index += 2;
  28.291 -	snprintf(straystr, MAXCOMLEN + 1, "stray irq%d",
  28.292 -	    is->is_pic->pic_vector(is));
  28.293 -	intrcnt_updatename(is);
  28.294 -	is->is_count = &intrcnt[is->is_index];
  28.295 -	intrcnt_setname(straystr, is->is_index + 1);
  28.296 -	is->is_straycount = &intrcnt[is->is_index + 1];
  28.297 -}
  28.298 -
  28.299 -static void
  28.300 -intr_init(void *dummy __unused)
  28.301 -{
  28.302 -
  28.303 -	intrcnt_setname("???", 0);
  28.304 -	intrcnt_index = 1;
  28.305 -	mtx_init(&intr_table_lock, "intr table", NULL, MTX_SPIN);
  28.306 -}
  28.307 -SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL)
  28.308 -
  28.309 -#ifdef DDB
  28.310 -/*
  28.311 - * Dump data about interrupt handlers
  28.312 - */
  28.313 -DB_SHOW_COMMAND(irqs, db_show_irqs)
  28.314 -{
  28.315 -	struct intsrc **isrc;
  28.316 -	int i, quit, verbose;
  28.317 -
  28.318 -	quit = 0;
  28.319 -	if (strcmp(modif, "v") == 0)
  28.320 -		verbose = 1;
  28.321 -	else
  28.322 -		verbose = 0;
  28.323 -	isrc = interrupt_sources;
  28.324 -	db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
  28.325 -	for (i = 0; i < NUM_IO_INTS && !quit; i++, isrc++)
  28.326 -		if (*isrc != NULL)
  28.327 -			db_dump_ithread((*isrc)->is_ithread, verbose);
  28.328 -}
  28.329 -#endif
    29.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/io_apic.c	Sun Dec 04 18:24:24 2005 +0100
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,850 +0,0 @@
    29.4 -/*-
    29.5 - * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org>
    29.6 - * All rights reserved.
    29.7 - *
    29.8 - * Redistribution and use in source and binary forms, with or without
    29.9 - * modification, are permitted provided that the following conditions
   29.10 - * are met:
   29.11 - * 1. Redistributions of source code must retain the above copyright
   29.12 - *    notice, this list of conditions and the following disclaimer.
   29.13 - * 2. Redistributions in binary form must reproduce the above copyright
   29.14 - *    notice, this list of conditions and the following disclaimer in the
   29.15 - *    documentation and/or other materials provided with the distribution.
   29.16 - * 3. Neither the name of the author nor the names of any co-contributors
   29.17 - *    may be used to endorse or promote products derived from this software
   29.18 - *    without specific prior written permission.
   29.19 - *
   29.20 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   29.21 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   29.22 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   29.23 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   29.24 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29.25 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   29.26 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   29.27 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29.28 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29.29 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29.30 - * SUCH DAMAGE.
   29.31 - */
   29.32 -
   29.33 -#include <sys/cdefs.h>
   29.34 -__FBSDID("$FreeBSD: src/sys/i386/i386/io_apic.c,v 1.14 2004/08/02 15:31:10 scottl Exp $");
   29.35 -
   29.36 -#include "opt_isa.h"
   29.37 -#include "opt_no_mixed_mode.h"
   29.38 -
   29.39 -#include <sys/param.h>
   29.40 -#include <sys/systm.h>
   29.41 -#include <sys/bus.h>
   29.42 -#include <sys/kernel.h>
   29.43 -#include <sys/malloc.h>
   29.44 -#include <sys/lock.h>
   29.45 -#include <sys/mutex.h>
   29.46 -
   29.47 -#include <vm/vm.h>
   29.48 -#include <vm/pmap.h>
   29.49 -
   29.50 -#include <machine/apicreg.h>
   29.51 -#include <machine/frame.h>
   29.52 -#include <machine/intr_machdep.h>
   29.53 -#include <machine/apicvar.h>
   29.54 -#include <machine/segments.h>
   29.55 -
   29.56 -#define IOAPIC_ISA_INTS		16
   29.57 -#define	IOAPIC_MEM_REGION	32
   29.58 -#define	IOAPIC_REDTBL_LO(i)	(IOAPIC_REDTBL + (i) * 2)
   29.59 -#define	IOAPIC_REDTBL_HI(i)	(IOAPIC_REDTBL_LO(i) + 1)
   29.60 -
   29.61 -#define	VECTOR_EXTINT		252
   29.62 -#define	VECTOR_NMI		253
   29.63 -#define	VECTOR_SMI		254
   29.64 -#define	VECTOR_DISABLED		255
   29.65 -
   29.66 -#define	DEST_NONE		-1
   29.67 -#define	DEST_EXTINT		-2
   29.68 -
   29.69 -#define	TODO		printf("%s: not implemented!\n", __func__)
   29.70 -
   29.71 -MALLOC_DEFINE(M_IOAPIC, "I/O APIC", "I/O APIC structures");
   29.72 -
   29.73 -/*
   29.74 - * New interrupt support code..
   29.75 - *
   29.76 - * XXX: we really should have the interrupt cookie passed up from new-bus
   29.77 - * just be a int pin, and not map 1:1 to interrupt vector number but should
   29.78 - * use INTR_TYPE_FOO to set priority bands for device classes and do all the
   29.79 - * magic remapping of intpin to vector in here.  For now we just cheat as on
   29.80 - * ia64 and map intpin X to vector NRSVIDT + X.  Note that we assume that the
   29.81 - * first IO APIC has ISA interrupts on pins 1-15.  Not sure how you are
   29.82 - * really supposed to figure out which IO APIC in a system with multiple IO
   29.83 - * APIC's actually has the ISA interrupts routed to it.  As far as interrupt
   29.84 - * pin numbers, we use the ACPI System Interrupt number model where each
   29.85 - * IO APIC has a contiguous chunk of the System Interrupt address space.
   29.86 - */
   29.87 -
   29.88 -/*
   29.89 - * Direct the ExtINT pin on the first I/O APIC to a logical cluster of
   29.90 - * CPUs rather than a physical destination of just the BSP.
   29.91 - *
   29.92 - * Note: This is disabled by default as test systems seem to croak with it
   29.93 - * enabled.
   29.94 -#define ENABLE_EXTINT_LOGICAL_DESTINATION
   29.95 - */
   29.96 -
   29.97 -struct ioapic_intsrc {
   29.98 -	struct intsrc io_intsrc;
   29.99 -	u_int io_intpin:8;
  29.100 -	u_int io_vector:8;
  29.101 -	u_int io_activehi:1;
  29.102 -	u_int io_edgetrigger:1;
  29.103 -	u_int io_masked:1;
  29.104 -	int io_dest:5;
  29.105 -	int io_bus:4;
  29.106 -};
  29.107 -
  29.108 -struct ioapic {
  29.109 -	struct pic io_pic;
  29.110 -	u_int io_id:8;			/* logical ID */
  29.111 -	u_int io_apic_id:4;
  29.112 -	u_int io_intbase:8;		/* System Interrupt base */
  29.113 -	u_int io_numintr:8;
  29.114 -	volatile ioapic_t *io_addr;	/* XXX: should use bus_space */
  29.115 -	STAILQ_ENTRY(ioapic) io_next;
  29.116 -	struct ioapic_intsrc io_pins[0];
  29.117 -};
  29.118 -
  29.119 -static u_int	ioapic_read(volatile ioapic_t *apic, int reg);
  29.120 -static void	ioapic_write(volatile ioapic_t *apic, int reg, u_int val);
  29.121 -static const char *ioapic_bus_string(int bus_type);
  29.122 -static void	ioapic_print_vector(struct ioapic_intsrc *intpin);
  29.123 -static void	ioapic_enable_source(struct intsrc *isrc);
  29.124 -static void	ioapic_disable_source(struct intsrc *isrc, int eoi);
  29.125 -static void	ioapic_eoi_source(struct intsrc *isrc);
  29.126 -static void	ioapic_enable_intr(struct intsrc *isrc);
  29.127 -static int	ioapic_vector(struct intsrc *isrc);
  29.128 -static int	ioapic_source_pending(struct intsrc *isrc);
  29.129 -static int	ioapic_config_intr(struct intsrc *isrc, enum intr_trigger trig,
  29.130 -		    enum intr_polarity pol);
  29.131 -static void	ioapic_suspend(struct intsrc *isrc);
  29.132 -static void	ioapic_resume(struct intsrc *isrc);
  29.133 -static void	ioapic_program_destination(struct ioapic_intsrc *intpin);
  29.134 -static void	ioapic_program_intpin(struct ioapic_intsrc *intpin);
  29.135 -static void	ioapic_setup_mixed_mode(struct ioapic_intsrc *intpin);
  29.136 -
  29.137 -static STAILQ_HEAD(,ioapic) ioapic_list = STAILQ_HEAD_INITIALIZER(ioapic_list);
  29.138 -struct pic ioapic_template = { ioapic_enable_source, ioapic_disable_source,
  29.139 -			       ioapic_eoi_source, ioapic_enable_intr,
  29.140 -			       ioapic_vector, ioapic_source_pending,
  29.141 -			       ioapic_suspend, ioapic_resume,
  29.142 -			       ioapic_config_intr };
  29.143 -	
  29.144 -static int bsp_id, current_cluster, logical_clusters, next_ioapic_base;
  29.145 -static u_int mixed_mode_enabled, next_id, program_logical_dest;
  29.146 -#ifdef NO_MIXED_MODE
  29.147 -static int mixed_mode_active = 0;
  29.148 -#else
  29.149 -static int mixed_mode_active = 1;
  29.150 -#endif
  29.151 -TUNABLE_INT("hw.apic.mixed_mode", &mixed_mode_active);
  29.152 -
  29.153 -static __inline void
  29.154 -_ioapic_eoi_source(struct intsrc *isrc)
  29.155 -{
  29.156 -	lapic_eoi();
  29.157 -}
  29.158 -
  29.159 -static u_int
  29.160 -ioapic_read(volatile ioapic_t *apic, int reg)
  29.161 -{
  29.162 -
  29.163 -	mtx_assert(&icu_lock, MA_OWNED);
  29.164 -	apic->ioregsel = reg;
  29.165 -	return (apic->iowin);
  29.166 -}
  29.167 -
  29.168 -static void
  29.169 -ioapic_write(volatile ioapic_t *apic, int reg, u_int val)
  29.170 -{
  29.171 -
  29.172 -	mtx_assert(&icu_lock, MA_OWNED);
  29.173 -	apic->ioregsel = reg;
  29.174 -	apic->iowin = val;
  29.175 -}
  29.176 -
  29.177 -static const char *
  29.178 -ioapic_bus_string(int bus_type)
  29.179 -{
  29.180 -
  29.181 -	switch (bus_type) {
  29.182 -	case APIC_BUS_ISA:
  29.183 -		return ("ISA");
  29.184 -	case APIC_BUS_EISA:
  29.185 -		return ("EISA");
  29.186 -	case APIC_BUS_PCI:
  29.187 -		return ("PCI");
  29.188 -	default:
  29.189 -		return ("unknown");
  29.190 -	}
  29.191 -}
  29.192 -
  29.193 -static void
  29.194 -ioapic_print_vector(struct ioapic_intsrc *intpin)
  29.195 -{
  29.196 -
  29.197 -	switch (intpin->io_vector) {
  29.198 -	case VECTOR_DISABLED:
  29.199 -		printf("disabled");
  29.200 -		break;
  29.201 -	case VECTOR_EXTINT:
  29.202 -		printf("ExtINT");
  29.203 -		break;
  29.204 -	case VECTOR_NMI:
  29.205 -		printf("NMI");
  29.206 -		break;
  29.207 -	case VECTOR_SMI:
  29.208 -		printf("SMI");
  29.209 -		break;
  29.210 -	default:
  29.211 -		printf("%s IRQ %u", ioapic_bus_string(intpin->io_bus),
  29.212 -		    intpin->io_vector);
  29.213 -	}
  29.214 -}
  29.215 -
  29.216 -static void
  29.217 -ioapic_enable_source(struct intsrc *isrc)
  29.218 -{
  29.219 -	struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc;
  29.220 -	struct ioapic *io = (struct ioapic *)isrc->is_pic;
  29.221 -	uint32_t flags;
  29.222 -
  29.223 -	mtx_lock_spin(&icu_lock);
  29.224 -	if (intpin->io_masked) {
  29.225 -		flags = ioapic_read(io->io_addr,
  29.226 -		    IOAPIC_REDTBL_LO(intpin->io_intpin));
  29.227 -		flags &= ~(IOART_INTMASK);
  29.228 -		ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin),
  29.229 -		    flags);
  29.230 -		intpin->io_masked = 0;
  29.231 -	}
  29.232 -	mtx_unlock_spin(&icu_lock);
  29.233 -}
  29.234 -
  29.235 -static void
  29.236 -ioapic_disable_source(struct intsrc *isrc, int eoi)
  29.237 -{
  29.238 -	struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc;
  29.239 -	struct ioapic *io = (struct ioapic *)isrc->is_pic;
  29.240 -	uint32_t flags;
  29.241 -
  29.242 -	mtx_lock_spin(&icu_lock);
  29.243 -	if (!intpin->io_masked && !intpin->io_edgetrigger) {
  29.244 -		flags = ioapic_read(io->io_addr,
  29.245 -		    IOAPIC_REDTBL_LO(intpin->io_intpin));
  29.246 -		flags |= IOART_INTMSET;
  29.247 -		ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin),
  29.248 -		    flags);
  29.249 -		intpin->io_masked = 1;
  29.250 -	}
  29.251 -
  29.252 -	if (eoi == PIC_EOI)
  29.253 -		_ioapic_eoi_source(isrc);
  29.254 -
  29.255 -	mtx_unlock_spin(&icu_lock);
  29.256 -}
  29.257 -
  29.258 -static void
  29.259 -ioapic_eoi_source(struct intsrc *isrc)
  29.260 -{
  29.261 -
  29.262 -	_ioapic_eoi_source(isrc);
  29.263 -}
  29.264 -
  29.265 -/*
  29.266 - * Completely program an intpin based on the data in its interrupt source
  29.267 - * structure.
  29.268 - */
  29.269 -static void
  29.270 -ioapic_program_intpin(struct ioapic_intsrc *intpin)
  29.271 -{
  29.272 -	struct ioapic *io = (struct ioapic *)intpin->io_intsrc.is_pic;
  29.273 -	uint32_t low, high, value;
  29.274 -
  29.275 -	/*
  29.276 -	 * For pins routed via mixed mode or disabled, just ensure that
  29.277 -	 * they are masked.
  29.278 -	 */
  29.279 -	if (intpin->io_dest == DEST_EXTINT ||
  29.280 -	    intpin->io_vector == VECTOR_DISABLED) {
  29.281 -		low = ioapic_read(io->io_addr,
  29.282 -		    IOAPIC_REDTBL_LO(intpin->io_intpin));
  29.283 -		if ((low & IOART_INTMASK) == IOART_INTMCLR)
  29.284 -			ioapic_write(io->io_addr,
  29.285 -			    IOAPIC_REDTBL_LO(intpin->io_intpin),
  29.286 -			    low | IOART_INTMSET);
  29.287 -		return;
  29.288 -	}
  29.289 -
  29.290 -	/* Set the destination. */
  29.291 -	if (intpin->io_dest == DEST_NONE) {
  29.292 -		low = IOART_DESTPHY;
  29.293 -		high = bsp_id << APIC_ID_SHIFT;
  29.294 -	} else {
  29.295 -		low = IOART_DESTLOG;
  29.296 -		high = (intpin->io_dest << APIC_ID_CLUSTER_SHIFT |
  29.297 -		    APIC_ID_CLUSTER_ID) << APIC_ID_SHIFT;
  29.298 -	}
  29.299 -
  29.300 -	/* Program the rest of the low word. */
  29.301 -	if (intpin->io_edgetrigger)
  29.302 -		low |= IOART_TRGREDG;
  29.303 -	else
  29.304 -		low |= IOART_TRGRLVL;
  29.305 -	if (intpin->io_activehi)
  29.306 -		low |= IOART_INTAHI;
  29.307 -	else
  29.308 -		low |= IOART_INTALO;
  29.309 -	if (intpin->io_masked)
  29.310 -		low |= IOART_INTMSET;
  29.311 -	switch (intpin->io_vector) {
  29.312 -	case VECTOR_EXTINT:
  29.313 -		KASSERT(intpin->io_edgetrigger,
  29.314 -		    ("EXTINT not edge triggered"));
  29.315 -		low |= IOART_DELEXINT;
  29.316 -		break;
  29.317 -	case VECTOR_NMI:
  29.318 -		KASSERT(intpin->io_edgetrigger,
  29.319 -		    ("NMI not edge triggered"));
  29.320 -		low |= IOART_DELNMI;
  29.321 -		break;
  29.322 -	case VECTOR_SMI:
  29.323 -		KASSERT(intpin->io_edgetrigger,
  29.324 -		    ("SMI not edge triggered"));
  29.325 -		low |= IOART_DELSMI;
  29.326 -		break;
  29.327 -	default:
  29.328 -		low |= IOART_DELLOPRI | apic_irq_to_idt(intpin->io_vector);
  29.329 -	}
  29.330 -
  29.331 -	/* Write the values to the APIC. */
  29.332 -	mtx_lock_spin(&icu_lock);
  29.333 -	ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low);
  29.334 -	value = ioapic_read(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin));
  29.335 -	value &= ~IOART_DEST;
  29.336 -	value |= high;
  29.337 -	ioapic_write(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin), value);
  29.338 -	mtx_unlock_spin(&icu_lock);
  29.339 -}
  29.340 -
  29.341 -/*
  29.342 - * Program an individual intpin's logical destination.
  29.343 - */
  29.344 -static void
  29.345 -ioapic_program_destination(struct ioapic_intsrc *intpin)
  29.346 -{
  29.347 -	struct ioapic *io = (struct ioapic *)intpin->io_intsrc.is_pic;
  29.348 -
  29.349 -	KASSERT(intpin->io_dest != DEST_NONE,
  29.350 -	    ("intpin not assigned to a cluster"));
  29.351 -	KASSERT(intpin->io_dest != DEST_EXTINT,
  29.352 -	    ("intpin routed via ExtINT"));
  29.353 -	if (bootverbose) {
  29.354 -		printf("ioapic%u: routing intpin %u (", io->io_id,
  29.355 -		    intpin->io_intpin);
  29.356 -		ioapic_print_vector(intpin);
  29.357 -		printf(") to cluster %u\n", intpin->io_dest);
  29.358 -	}
  29.359 -	ioapic_program_intpin(intpin);
  29.360 -}
  29.361 -
  29.362 -static void
  29.363 -ioapic_assign_cluster(struct ioapic_intsrc *intpin)
  29.364 -{
  29.365 -
  29.366 -	/*
  29.367 -	 * Assign this intpin to a logical APIC cluster in a
  29.368 -	 * round-robin fashion.  We don't actually use the logical
  29.369 -	 * destination for this intpin until after all the CPU's
  29.370 -	 * have been started so that we don't end up with interrupts
  29.371 -	 * that don't go anywhere.  Another alternative might be to
  29.372 -	 * start up the CPU's earlier so that they can handle interrupts
  29.373 -	 * sooner.
  29.374 -	 */
  29.375 -	intpin->io_dest = current_cluster;
  29.376 -	current_cluster++;
  29.377 -	if (current_cluster >= logical_clusters)
  29.378 -		current_cluster = 0;
  29.379 -	if (program_logical_dest)
  29.380 -		ioapic_program_destination(intpin);
  29.381 -}
  29.382 -
  29.383 -static void
  29.384 -ioapic_enable_intr(struct intsrc *isrc)
  29.385 -{
  29.386 -	struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc;
  29.387 -
  29.388 -	KASSERT(intpin->io_dest != DEST_EXTINT,
  29.389 -	    ("ExtINT pin trying to use ioapic enable_intr method"));
  29.390 -	if (intpin->io_dest == DEST_NONE) {
  29.391 -		ioapic_assign_cluster(intpin);
  29.392 -		lapic_enable_intr(intpin->io_vector);
  29.393 -	}
  29.394 -}
  29.395 -
  29.396 -static int
  29.397 -ioapic_vector(struct intsrc *isrc)
  29.398 -{
  29.399 -	struct ioapic_intsrc *pin;
  29.400 -
  29.401 -	pin = (struct ioapic_intsrc *)isrc;
  29.402 -	return (pin->io_vector);
  29.403 -}
  29.404 -
  29.405 -static int
  29.406 -ioapic_source_pending(struct intsrc *isrc)
  29.407 -{
  29.408 -	struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc;
  29.409 -
  29.410 -	return (lapic_intr_pending(intpin->io_vector));
  29.411 -}
  29.412 -
  29.413 -static int
  29.414 -ioapic_config_intr(struct intsrc *isrc, enum intr_trigger trig,
  29.415 -    enum intr_polarity pol)
  29.416 -{
  29.417 -	struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc;
  29.418 -	struct ioapic *io = (struct ioapic *)isrc->is_pic;
  29.419 -	int changed;
  29.420 -
  29.421 -	KASSERT(!(trig == INTR_TRIGGER_CONFORM || pol == INTR_POLARITY_CONFORM),
  29.422 -	    ("%s: Conforming trigger or polarity\n", __func__));
  29.423 -
  29.424 -	/*
  29.425 -	 * EISA interrupts always use active high polarity, so don't allow
  29.426 -	 * them to be set to active low.
  29.427 -	 *
  29.428 -	 * XXX: Should we write to the ELCR if the trigger mode changes for
  29.429 -	 * an EISA IRQ?
  29.430 -	 */
  29.431 -	if (intpin->io_bus == APIC_BUS_EISA)
  29.432 -		pol = INTR_POLARITY_HIGH;
  29.433 -	changed = 0;
  29.434 -	if (intpin->io_edgetrigger != (trig == INTR_TRIGGER_EDGE)) {
  29.435 -		if (bootverbose)
  29.436 -			printf("ioapic%u: Changing trigger for pin %u to %s\n",
  29.437 -			    io->io_id, intpin->io_intpin,
  29.438 -			    trig == INTR_TRIGGER_EDGE ? "edge" : "level");
  29.439 -		intpin->io_edgetrigger = (trig == INTR_TRIGGER_EDGE);
  29.440 -		changed++;
  29.441 -	}
  29.442 -	if (intpin->io_activehi != (pol == INTR_POLARITY_HIGH)) {
  29.443 -		if (bootverbose)
  29.444 -			printf("ioapic%u: Changing polarity for pin %u to %s\n",
  29.445 -			    io->io_id, intpin->io_intpin,
  29.446 -			    pol == INTR_POLARITY_HIGH ? "high" : "low");
  29.447 -		intpin->io_activehi = (pol == INTR_POLARITY_HIGH);
  29.448 -		changed++;
  29.449 -	}
  29.450 -	if (changed)
  29.451 -		ioapic_program_intpin(intpin);
  29.452 -	return (0);
  29.453 -}
  29.454 -
  29.455 -static void
  29.456 -ioapic_suspend(struct intsrc *isrc)
  29.457 -{
  29.458 -
  29.459 -	TODO;
  29.460 -}
  29.461 -
  29.462 -static void
  29.463 -ioapic_resume(struct intsrc *isrc)
  29.464 -{
  29.465 -
  29.466 -	ioapic_program_intpin((struct ioapic_intsrc *)isrc);
  29.467 -}
  29.468 -
  29.469 -/*
  29.470 - * APIC enumerators call this function to indicate that the 8259A AT PICs
  29.471 - * are available and that mixed mode can be used.
  29.472 - */
  29.473 -void
  29.474 -ioapic_enable_mixed_mode(void)
  29.475 -{
  29.476 -
  29.477 -	mixed_mode_enabled = 1;
  29.478 -}
  29.479 -
  29.480 -/*
  29.481 - * Allocate and return a logical cluster ID.  Note that the first time
  29.482 - * this is called, it returns cluster 0.  ioapic_enable_intr() treats
  29.483 - * the two cases of logical_clusters == 0 and logical_clusters == 1 the
  29.484 - * same: one cluster of ID 0 exists.  The logical_clusters == 0 case is
  29.485 - * for UP kernels, which should never call this function.
  29.486 - */
  29.487 -int
  29.488 -ioapic_next_logical_cluster(void)
  29.489 -{
  29.490 -
  29.491 -	if (logical_clusters >= APIC_MAX_CLUSTER)
  29.492 -		panic("WARNING: Local APIC cluster IDs exhausted!");
  29.493 -	return (logical_clusters++);
  29.494 -}
  29.495 -
  29.496 -/*
  29.497 - * Create a plain I/O APIC object.
  29.498 - */
  29.499 -void *
  29.500 -ioapic_create(uintptr_t addr, int32_t apic_id, int intbase)
  29.501 -{
  29.502 -	struct ioapic *io;
  29.503 -	struct ioapic_intsrc *intpin;
  29.504 -	volatile ioapic_t *apic;
  29.505 -	u_int numintr, i;
  29.506 -	uint32_t value;
  29.507 -
  29.508 -	apic = (ioapic_t *)pmap_mapdev(addr, IOAPIC_MEM_REGION);
  29.509 -	mtx_lock_spin(&icu_lock);
  29.510 -	numintr = ((ioapic_read(apic, IOAPIC_VER) & IOART_VER_MAXREDIR) >>
  29.511 -	    MAXREDIRSHIFT) + 1;
  29.512 -	mtx_unlock_spin(&icu_lock);
  29.513 -	io = malloc(sizeof(struct ioapic) +
  29.514 -	    numintr * sizeof(struct ioapic_intsrc), M_IOAPIC, M_WAITOK);
  29.515 -	io->io_pic = ioapic_template;
  29.516 -	mtx_lock_spin(&icu_lock);
  29.517 -	io->io_id = next_id++;
  29.518 -	io->io_apic_id = ioapic_read(apic, IOAPIC_ID) >> APIC_ID_SHIFT;	
  29.519 -	if (apic_id != -1 && io->io_apic_id != apic_id) {
  29.520 -		ioapic_write(apic, IOAPIC_ID, apic_id << APIC_ID_SHIFT);
  29.521 -		mtx_unlock_spin(&icu_lock);
  29.522 -		io->io_apic_id = apic_id;
  29.523 -		printf("ioapic%u: Changing APIC ID to %d\n", io->io_id,
  29.524 -		    apic_id);
  29.525 -	} else
  29.526 -		mtx_unlock_spin(&icu_lock);
  29.527 -	if (intbase == -1) {
  29.528 -		intbase = next_ioapic_base;
  29.529 -		printf("ioapic%u: Assuming intbase of %d\n", io->io_id,
  29.530 -		    intbase);
  29.531 -	} else if (intbase != next_ioapic_base)
  29.532 -		printf("ioapic%u: WARNING: intbase %d != expected base %d\n",
  29.533 -		    io->io_id, intbase, next_ioapic_base);
  29.534 -	io->io_intbase = intbase;
  29.535 -	next_ioapic_base = intbase + numintr;
  29.536 -	io->io_numintr = numintr;
  29.537 -	io->io_addr = apic;
  29.538 -
  29.539 -	/*
  29.540 -	 * Initialize pins.  Start off with interrupts disabled.  Default
  29.541 -	 * to active-hi and edge-triggered for ISA interrupts and active-lo
  29.542 -	 * and level-triggered for all others.
  29.543 -	 */
  29.544 -	bzero(io->io_pins, sizeof(struct ioapic_intsrc) * numintr);
  29.545 -	mtx_lock_spin(&icu_lock);
  29.546 -	for (i = 0, intpin = io->io_pins; i < numintr; i++, intpin++) {
  29.547 -		intpin->io_intsrc.is_pic = (struct pic *)io;
  29.548 -		intpin->io_intpin = i;
  29.549 -		intpin->io_vector = intbase + i;
  29.550 -
  29.551 -		/*
  29.552 -		 * Assume that pin 0 on the first I/O APIC is an ExtINT pin
  29.553 -		 * and that pins 1-15 are ISA interrupts.  Assume that all
  29.554 -		 * other pins are PCI interrupts.
  29.555 -		 */
  29.556 -		if (intpin->io_vector == 0)
  29.557 -			ioapic_set_extint(io, i);
  29.558 -		else if (intpin->io_vector < IOAPIC_ISA_INTS) {
  29.559 -			intpin->io_bus = APIC_BUS_ISA;
  29.560 -			intpin->io_activehi = 1;
  29.561 -			intpin->io_edgetrigger = 1;
  29.562 -			intpin->io_masked = 1;
  29.563 -		} else {
  29.564 -			intpin->io_bus = APIC_BUS_PCI;
  29.565 -			intpin->io_activehi = 0;
  29.566 -			intpin->io_edgetrigger = 0;
  29.567 -			intpin->io_masked = 1;
  29.568 -		}
  29.569 -
  29.570 -		/*
  29.571 -		 * Route interrupts to the BSP by default using physical
  29.572 -		 * addressing.  Vectored interrupts get readdressed using
  29.573 -		 * logical IDs to CPU clusters when they are enabled.
  29.574 -		 */
  29.575 -		intpin->io_dest = DEST_NONE;
  29.576 -		if (bootverbose && intpin->io_vector != VECTOR_DISABLED) {
  29.577 -			printf("ioapic%u: intpin %d -> ",  io->io_id, i);
  29.578 -			ioapic_print_vector(intpin);
  29.579 -			printf(" (%s, %s)\n", intpin->io_edgetrigger ?
  29.580 -			    "edge" : "level", intpin->io_activehi ? "high" :
  29.581 -			    "low");
  29.582 -		}
  29.583 -		value = ioapic_read(apic, IOAPIC_REDTBL_LO(i));
  29.584 -		ioapic_write(apic, IOAPIC_REDTBL_LO(i), value | IOART_INTMSET);
  29.585 -	}
  29.586 -	mtx_unlock_spin(&icu_lock);
  29.587 -
  29.588 -	return (io);
  29.589 -}
  29.590 -
  29.591 -int
  29.592 -ioapic_get_vector(void *cookie, u_int pin)
  29.593 -{
  29.594 -	struct ioapic *io;
  29.595 -
  29.596 -	io = (struct ioapic *)cookie;
  29.597 -	if (pin >= io->io_numintr)
  29.598 -		return (-1);
  29.599 -	return (io->io_pins[pin].io_vector);
  29.600 -}
  29.601 -
  29.602 -int
  29.603 -ioapic_disable_pin(void *cookie, u_int pin)
  29.604 -{
  29.605 -	struct ioapic *io;
  29.606 -
  29.607 -	io = (struct ioapic *)cookie;
  29.608 -	if (pin >= io->io_numintr)
  29.609 -		return (EINVAL);
  29.610 -	if (io->io_pins[pin].io_vector == VECTOR_DISABLED)
  29.611 -		return (EINVAL);
  29.612 -	io->io_pins[pin].io_vector = VECTOR_DISABLED;
  29.613 -	if (bootverbose)
  29.614 -		printf("ioapic%u: intpin %d disabled\n", io->io_id, pin);
  29.615 -	return (0);
  29.616 -}
  29.617 -
  29.618 -int
  29.619 -ioapic_remap_vector(void *cookie, u_int pin, int vector)
  29.620 -{
  29.621 -	struct ioapic *io;
  29.622 -
  29.623 -	io = (struct ioapic *)cookie;
  29.624 -	if (pin >= io->io_numintr || vector < 0)
  29.625 -		return (EINVAL);
  29.626 -	if (io->io_pins[pin].io_vector >= NUM_IO_INTS)
  29.627 -		return (EINVAL);
  29.628 -	io->io_pins[pin].io_vector = vector;
  29.629 -	if (bootverbose)
  29.630 -		printf("ioapic%u: Routing IRQ %d -> intpin %d\n", io->io_id,
  29.631 -		    vector, pin);
  29.632 -	return (0);
  29.633 -}
  29.634 -
  29.635 -int
  29.636 -ioapic_set_bus(void *cookie, u_int pin, int bus_type)
  29.637 -{
  29.638 -	struct ioapic *io;
  29.639 -
  29.640 -	if (bus_type < 0 || bus_type > APIC_BUS_MAX)
  29.641 -		return (EINVAL);
  29.642 -	io = (struct ioapic *)cookie;
  29.643 -	if (pin >= io->io_numintr)
  29.644 -		return (EINVAL);
  29.645 -	if (io->io_pins[pin].io_vector >= NUM_IO_INTS)
  29.646 -		return (EINVAL);
  29.647 -	io->io_pins[pin].io_bus = bus_type;
  29.648 -	if (bootverbose)
  29.649 -		printf("ioapic%u: intpin %d bus %s\n", io->io_id, pin,
  29.650 -		    ioapic_bus_string(bus_type));
  29.651 -	return (0);
  29.652 -}
  29.653 -
  29.654 -int
  29.655 -ioapic_set_nmi(void *cookie, u_int pin)
  29.656 -{
  29.657 -	struct ioapic *io;
  29.658 -
  29.659 -	io = (struct ioapic *)cookie;
  29.660 -	if (pin >= io->io_numintr)
  29.661 -		return (EINVAL);
  29.662 -	if (io->io_pins[pin].io_vector == VECTOR_NMI)
  29.663 -		return (0);
  29.664 -	if (io->io_pins[pin].io_vector >= NUM_IO_INTS)
  29.665 -		return (EINVAL);
  29.666 -	io->io_pins[pin].io_bus = APIC_BUS_UNKNOWN;
  29.667 -	io->io_pins[pin].io_vector = VECTOR_NMI;
  29.668 -	io->io_pins[pin].io_masked = 0;
  29.669 -	io->io_pins[pin].io_edgetrigger = 1;
  29.670 -	io->io_pins[pin].io_activehi = 1;
  29.671 -	if (bootverbose)
  29.672 -		printf("ioapic%u: Routing NMI -> intpin %d\n",
  29.673 -		    io->io_id, pin);
  29.674 -	return (0);
  29.675 -}
  29.676 -
  29.677 -int
  29.678 -ioapic_set_smi(void *cookie, u_int pin)
  29.679 -{
  29.680 -	struct ioapic *io;
  29.681 -
  29.682 -	io = (struct ioapic *)cookie;
  29.683 -	if (pin >= io->io_numintr)
  29.684 -		return (EINVAL);
  29.685 -	if (io->io_pins[pin].io_vector == VECTOR_SMI)
  29.686 -		return (0);
  29.687 -	if (io->io_pins[pin].io_vector >= NUM_IO_INTS)
  29.688 -		return (EINVAL);
  29.689 -	io->io_pins[pin].io_bus = APIC_BUS_UNKNOWN;
  29.690 -	io->io_pins[pin].io_vector = VECTOR_SMI;
  29.691 -	io->io_pins[pin].io_masked = 0;
  29.692 -	io->io_pins[pin].io_edgetrigger = 1;
  29.693 -	io->io_pins[pin].io_activehi = 1;
  29.694 -	if (bootverbose)
  29.695 -		printf("ioapic%u: Routing SMI -> intpin %d\n",
  29.696 -		    io->io_id, pin);
  29.697 -	return (0);
  29.698 -}
  29.699 -
  29.700 -int
  29.701 -ioapic_set_extint(void *cookie, u_int pin)
  29.702 -{
  29.703 -	struct ioapic *io;
  29.704 -
  29.705 -	io = (struct ioapic *)cookie;
  29.706 -	if (pin >= io->io_numintr)
  29.707 -		return (EINVAL);
  29.708 -	if (io->io_pins[pin].io_vector == VECTOR_EXTINT)
  29.709 -		return (0);
  29.710 -	if (io->io_pins[pin].io_vector >= NUM_IO_INTS)
  29.711 -		return (EINVAL);
  29.712 -	io->io_pins[pin].io_bus = APIC_BUS_UNKNOWN;
  29.713 -	io->io_pins[pin].io_vector = VECTOR_EXTINT;
  29.714 -
  29.715 -	/* Enable this pin if mixed mode is available and active. */
  29.716 -	if (mixed_mode_enabled && mixed_mode_active)
  29.717 -		io->io_pins[pin].io_masked = 0;
  29.718 -	else
  29.719 -		io->io_pins[pin].io_masked = 1;
  29.720 -	io->io_pins[pin].io_edgetrigger = 1;
  29.721 -	io->io_pins[pin].io_activehi = 1;
  29.722 -	if (bootverbose)
  29.723 -		printf("ioapic%u: Routing external 8259A's -> intpin %d\n",
  29.724 -		    io->io_id, pin);
  29.725 -	return (0);
  29.726 -}
  29.727 -
  29.728 -int
  29.729 -ioapic_set_polarity(void *cookie, u_int pin, enum intr_polarity pol)
  29.730 -{
  29.731 -	struct ioapic *io;
  29.732 -
  29.733 -	io = (struct ioapic *)cookie;
  29.734 -	if (pin >= io->io_numintr || pol == INTR_POLARITY_CONFORM)
  29.735 -		return (EINVAL);
  29.736 -	if (io->io_pins[pin].io_vector >= NUM_IO_INTS)
  29.737 -		return (EINVAL);
  29.738 -	io->io_pins[pin].io_activehi = (pol == INTR_POLARITY_HIGH);
  29.739 -	if (bootverbose)
  29.740 -		printf("ioapic%u: intpin %d polarity: %s\n", io->io_id, pin,
  29.741 -		    pol == INTR_POLARITY_HIGH ? "high" : "low");
  29.742 -	return (0);
  29.743 -}
  29.744 -
  29.745 -int
  29.746 -ioapic_set_triggermode(void *cookie, u_int pin, enum intr_trigger trigger)
  29.747 -{
  29.748 -	struct ioapic *io;
  29.749 -
  29.750 -	io = (struct ioapic *)cookie;
  29.751 -	if (pin >= io->io_numintr || trigger == INTR_TRIGGER_CONFORM)
  29.752 -		return (EINVAL);
  29.753 -	if (io->io_pins[pin].io_vector >= NUM_IO_INTS)
  29.754 -		return (EINVAL);
  29.755 -	io->io_pins[pin].io_edgetrigger = (trigger == INTR_TRIGGER_EDGE);
  29.756 -	if (bootverbose)
  29.757 -		printf("ioapic%u: intpin %d trigger: %s\n", io->io_id, pin,
  29.758 -		    trigger == INTR_TRIGGER_EDGE ? "edge" : "level");
  29.759 -	return (0);
  29.760 -}
  29.761 -
  29.762 -/*
  29.763 - * Register a complete I/O APIC object with the interrupt subsystem.
  29.764 - */
  29.765 -void
  29.766 -ioapic_register(void *cookie)
  29.767 -{
  29.768 -	struct ioapic_intsrc *pin;
  29.769 -	struct ioapic *io;
  29.770 -	volatile ioapic_t *apic;
  29.771 -	uint32_t flags;
  29.772 -	int i;
  29.773 -
  29.774 -	io = (struct ioapic *)cookie;
  29.775 -	apic = io->io_addr;
  29.776 -	mtx_lock_spin(&icu_lock);
  29.777 -	flags = ioapic_read(apic, IOAPIC_VER) & IOART_VER_VERSION;
  29.778 -	STAILQ_INSERT_TAIL(&ioapic_list, io, io_next);
  29.779 -	mtx_unlock_spin(&icu_lock);
  29.780 -	printf("ioapic%u <Version %u.%u> irqs %u-%u on motherboard\n",
  29.781 -	    io->io_id, flags >> 4, flags & 0xf, io->io_intbase,
  29.782 -	    io->io_intbase + io->io_numintr - 1);
  29.783 -	bsp_id = PCPU_GET(apic_id);
  29.784 -	for (i = 0, pin = io->io_pins; i < io->io_numintr; i++, pin++) {
  29.785 -		/*
  29.786 -		 * Finish initializing the pins by programming the vectors
  29.787 -		 * and delivery mode.
  29.788 -		 */
  29.789 -		if (pin->io_vector == VECTOR_DISABLED)
  29.790 -			continue;
  29.791 -		ioapic_program_intpin(pin);
  29.792 -		if (pin->io_vector >= NUM_IO_INTS)
  29.793 -			continue;
  29.794 -		/*
  29.795 -		 * Route IRQ0 via the 8259A using mixed mode if mixed mode
  29.796 -		 * is available and turned on.
  29.797 -		 */
  29.798 -		if (pin->io_vector == 0 && mixed_mode_active &&
  29.799 -		    mixed_mode_enabled)
  29.800 -			ioapic_setup_mixed_mode(pin);
  29.801 -		else
  29.802 -			intr_register_source(&pin->io_intsrc);
  29.803 -	}
  29.804 -}
  29.805 -
  29.806 -/*
  29.807 - * Program all the intpins to use logical destinations once the AP's
  29.808 - * have been launched.
  29.809 - */
  29.810 -static void
  29.811 -ioapic_set_logical_destinations(void *arg __unused)
  29.812 -{
  29.813 -	struct ioapic *io;
  29.814 -	int i;
  29.815 -
  29.816 -	program_logical_dest = 1;
  29.817 -	STAILQ_FOREACH(io, &ioapic_list, io_next)
  29.818 -	    for (i = 0; i < io->io_numintr; i++)
  29.819 -		    if (io->io_pins[i].io_dest != DEST_NONE &&
  29.820 -			io->io_pins[i].io_dest != DEST_EXTINT)
  29.821 -			    ioapic_program_destination(&io->io_pins[i]);
  29.822 -}
  29.823 -SYSINIT(ioapic_destinations, SI_SUB_SMP, SI_ORDER_SECOND,
  29.824 -    ioapic_set_logical_destinations, NULL)
  29.825 -
  29.826 -/*
  29.827 - * Support for mixed-mode interrupt sources.  These sources route an ISA
  29.828 - * IRQ through the 8259A's via the ExtINT on pin 0 of the I/O APIC that
  29.829 - * routes the ISA interrupts.  We just ignore the intpins that use this
  29.830 - * mode and allow the atpic driver to register its interrupt source for
  29.831 - * that IRQ instead.
  29.832 - */
  29.833 -
  29.834 -static void
  29.835 -ioapic_setup_mixed_mode(struct ioapic_intsrc *intpin)
  29.836 -{
  29.837 -	struct ioapic_intsrc *extint;
  29.838 -	struct ioapic *io;
  29.839 -
  29.840 -	/*
  29.841 -	 * Mark the associated I/O APIC intpin as being delivered via
  29.842 -	 * ExtINT and enable the ExtINT pin on the I/O APIC if needed.
  29.843 -	 */
  29.844 -	intpin->io_dest = DEST_EXTINT;
  29.845 -	io = (struct ioapic *)intpin->io_intsrc.is_pic;
  29.846 -	extint = &io->io_pins[0];
  29.847 -	if (extint->io_vector != VECTOR_EXTINT)
  29.848 -		panic("Can't find ExtINT pin to route through!");
  29.849 -#ifdef ENABLE_EXTINT_LOGICAL_DESTINATION
  29.850 -	if (extint->io_dest == DEST_NONE)
  29.851 -		ioapic_assign_cluster(extint);
  29.852 -#endif
  29.853 -}
    30.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c	Sun Dec 04 18:24:24 2005 +0100
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,763 +0,0 @@
    30.4 -/*-
    30.5 - * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org>
    30.6 - * Copyright (c) 1996, by Steve Passe
    30.7 - * All rights reserved.
    30.8 - *
    30.9 - * Redistribution and use in source and binary forms, with or without
   30.10 - * modification, are permitted provided that the following conditions
   30.11 - * are met:
   30.12 - * 1. Redistributions of source code must retain the above copyright
   30.13 - *    notice, this list of conditions and the following disclaimer.
   30.14 - * 2. The name of the developer may NOT be used to endorse or promote products
   30.15 - *    derived from this software without specific prior written permission.
   30.16 - * 3. Neither the name of the author nor the names of any co-contributors
   30.17 - *    may be used to endorse or promote products derived from this software
   30.18 - *    without specific prior written permission.
   30.19 - *
   30.20 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   30.21 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   30.22 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   30.23 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   30.24 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   30.25 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   30.26 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   30.27 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   30.28 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30.29 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30.30 - * SUCH DAMAGE.
   30.31 - */
   30.32 -
   30.33 -/*
   30.34 - * Local APIC support on Pentium and later processors.
   30.35 - */
   30.36 -
   30.37 -#include <sys/cdefs.h>
   30.38 -__FBSDID("$FreeBSD: src/sys/i386/i386/local_apic.c,v 1.9 2004/07/14 18:12:15 jhb Exp $");
   30.39 -
   30.40 -#include <sys/param.h>
   30.41 -#include <sys/systm.h>
   30.42 -#include <sys/bus.h>
   30.43 -#include <sys/kernel.h>
   30.44 -#include <sys/pcpu.h>
   30.45 -
   30.46 -#include <vm/vm.h>
   30.47 -#include <vm/pmap.h>
   30.48 -
   30.49 -#include <machine/apicreg.h>
   30.50 -#include <machine/cputypes.h>
   30.51 -#include <machine/frame.h>
   30.52 -#include <machine/intr_machdep.h>
   30.53 -#include <machine/apicvar.h>
   30.54 -#include <machine/md_var.h>
   30.55 -#include <machine/smp.h>
   30.56 -#include <machine/specialreg.h>
   30.57 -
   30.58 -/*
   30.59 - * We can handle up to 60 APICs via our logical cluster IDs, but currently
   30.60 - * the physical IDs on Intel processors up to the Pentium 4 are limited to
   30.61 - * 16.
   30.62 - */
   30.63 -#define	MAX_APICID	16
   30.64 -
   30.65 -/* Sanity checks on IDT vectors. */
   30.66 -CTASSERT(APIC_IO_INTS + APIC_NUM_IOINTS <= APIC_LOCAL_INTS);
   30.67 -CTASSERT(IPI_STOP < APIC_SPURIOUS_INT);
   30.68 -
   30.69 -/*
   30.70 - * Support for local APICs.  Local APICs manage interrupts on each
   30.71 - * individual processor as opposed to I/O APICs which receive interrupts
   30.72 - * from I/O devices and then forward them on to the local APICs.
   30.73 - *
   30.74 - * Local APICs can also send interrupts to each other thus providing the
   30.75 - * mechanism for IPIs.
   30.76 - */
   30.77 -
   30.78 -struct lvt {
   30.79 -	u_int lvt_edgetrigger:1;
   30.80 -	u_int lvt_activehi:1;
   30.81 -	u_int lvt_masked:1;
   30.82 -	u_int lvt_active:1;
   30.83 -	u_int lvt_mode:16;
   30.84 -	u_int lvt_vector:8;
   30.85 -};
   30.86 -
   30.87 -struct lapic {
   30.88 -	struct lvt la_lvts[LVT_MAX + 1];
   30.89 -	u_int la_id:8;
   30.90 -	u_int la_cluster:4;
   30.91 -	u_int la_cluster_id:2;
   30.92 -	u_int la_present:1;
   30.93 -} static lapics[MAX_APICID];
   30.94 -
   30.95 -/* XXX: should thermal be an NMI? */
   30.96 -
   30.97 -/* Global defaults for local APIC LVT entries. */
   30.98 -static struct lvt lvts[LVT_MAX + 1] = {
   30.99 -	{ 1, 1, 1, 1, APIC_LVT_DM_EXTINT, 0 },	/* LINT0: masked ExtINT */
  30.100 -	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* LINT1: NMI */
  30.101 -	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, 0 },	/* Timer: needs a vector */
  30.102 -	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, 0 },	/* Error: needs a vector */
  30.103 -	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, 0 },	/* PMC */
  30.104 -	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, 0 },	/* Thermal: needs a vector */
  30.105 -};
  30.106 -
  30.107 -static inthand_t *ioint_handlers[] = {
  30.108 -	NULL,			/* 0 - 31 */
  30.109 -	IDTVEC(apic_isr1),	/* 32 - 63 */
  30.110 -	IDTVEC(apic_isr2),	/* 64 - 95 */
  30.111 -	IDTVEC(apic_isr3),	/* 96 - 127 */
  30.112 -	IDTVEC(apic_isr4),	/* 128 - 159 */
  30.113 -	IDTVEC(apic_isr5),	/* 160 - 191 */
  30.114 -	IDTVEC(apic_isr6),	/* 192 - 223 */
  30.115 -	IDTVEC(apic_isr7),	/* 224 - 255 */
  30.116 -};
  30.117 -
  30.118 -volatile lapic_t *lapic;
  30.119 -
  30.120 -static uint32_t
  30.121 -lvt_mode(struct lapic *la, u_int pin, uint32_t value)
  30.122 -{
  30.123 -	struct lvt *lvt;
  30.124 -
  30.125 -	KASSERT(pin <= LVT_MAX, ("%s: pin %u out of range", __func__, pin));
  30.126 -	if (la->la_lvts[pin].lvt_active)
  30.127 -		lvt = &la->la_lvts[pin];
  30.128 -	else
  30.129 -		lvt = &lvts[pin];
  30.130 -
  30.131 -	value &= ~(APIC_LVT_M | APIC_LVT_TM | APIC_LVT_IIPP | APIC_LVT_DM |
  30.132 -	    APIC_LVT_VECTOR);
  30.133 -	if (lvt->lvt_edgetrigger == 0)
  30.134 -		value |= APIC_LVT_TM;
  30.135 -	if (lvt->lvt_activehi == 0)
  30.136 -		value |= APIC_LVT_IIPP_INTALO;
  30.137 -	if (lvt->lvt_masked)
  30.138 -		value |= APIC_LVT_M;
  30.139 -	value |= lvt->lvt_mode;
  30.140 -	switch (lvt->lvt_mode) {
  30.141 -	case APIC_LVT_DM_NMI:
  30.142 -	case APIC_LVT_DM_SMI:
  30.143 -	case APIC_LVT_DM_INIT:
  30.144 -	case APIC_LVT_DM_EXTINT:
  30.145 -		if (!lvt->lvt_edgetrigger) {
  30.146 -			printf("lapic%u: Forcing LINT%u to edge trigger\n",
  30.147 -			    la->la_id, pin);
  30.148 -			value |= APIC_LVT_TM;
  30.149 -		}
  30.150 -		/* Use a vector of 0. */
  30.151 -		break;
  30.152 -	case APIC_LVT_DM_FIXED:
  30.153 -#if 0
  30.154 -		value |= lvt->lvt_vector;
  30.155 -#else
  30.156 -		panic("Fixed LINT pins not supported");
  30.157 -#endif
  30.158 -		break;
  30.159 -	default:
  30.160 -		panic("bad APIC LVT delivery mode: %#x\n", value);
  30.161 -	}
  30.162 -	return (value);
  30.163 -}
  30.164 -
  30.165 -/*
  30.166 - * Map the local APIC and setup necessary interrupt vectors.
  30.167 - */
  30.168 -void
  30.169 -lapic_init(uintptr_t addr)
  30.170 -{
  30.171 -	u_int32_t value;
  30.172 -
  30.173 -	/* Map the local APIC and setup the spurious interrupt handler. */
  30.174 -	KASSERT(trunc_page(addr) == addr,
  30.175 -	    ("local APIC not aligned on a page boundary"));
  30.176 -	lapic = (lapic_t *)pmap_mapdev(addr, sizeof(lapic_t));
  30.177 -	setidt(APIC_SPURIOUS_INT, IDTVEC(spuriousint), SDT_SYS386IGT, SEL_KPL,
  30.178 -	    GSEL(GCODE_SEL, SEL_KPL));
  30.179 -
  30.180 -	/* Perform basic initialization of the BSP's local APIC. */
  30.181 -	value = lapic->svr;
  30.182 -	value &= ~(APIC_SVR_VECTOR | APIC_SVR_FOCUS);
  30.183 -	value |= (APIC_SVR_FEN | APIC_SVR_SWEN | APIC_SPURIOUS_INT);
  30.184 -	lapic->svr = value;
  30.185 -
  30.186 -	/* Set BSP's per-CPU local APIC ID. */
  30.187 -	PCPU_SET(apic_id, lapic_id());
  30.188 -
  30.189 -	/* XXX: timer/error/thermal interrupts */
  30.190 -}
  30.191 -
  30.192 -/*
  30.193 - * Create a local APIC instance.
  30.194 - */
  30.195 -void
  30.196 -lapic_create(u_int apic_id, int boot_cpu)
  30.197 -{
  30.198 -	int i;
  30.199 -
  30.200 -	if (apic_id >= MAX_APICID) {
  30.201 -		printf("APIC: Ignoring local APIC with ID %d\n", apic_id);
  30.202 -		if (boot_cpu)
  30.203 -			panic("Can't ignore BSP");
  30.204 -		return;
  30.205 -	}
  30.206 -	KASSERT(!lapics[apic_id].la_present, ("duplicate local APIC %u",
  30.207 -	    apic_id));
  30.208 -
  30.209 -	/*
  30.210 -	 * Assume no local LVT overrides and a cluster of 0 and
  30.211 -	 * intra-cluster ID of 0.
  30.212 -	 */
  30.213 -	lapics[apic_id].la_present = 1;
  30.214 -	lapics[apic_id].la_id = apic_id;
  30.215 -	for (i = 0; i < LVT_MAX; i++) {
  30.216 -		lapics[apic_id].la_lvts[i] = lvts[i];
  30.217 -		lapics[apic_id].la_lvts[i].lvt_active = 0;
  30.218 -	}
  30.219 -
  30.220 -#ifdef SMP
  30.221 -	cpu_add(apic_id, boot_cpu);
  30.222 -#endif
  30.223 -}
  30.224 -
  30.225 -/*
  30.226 - * Dump contents of local APIC registers
  30.227 - */
  30.228 -void
  30.229 -lapic_dump(const char* str)
  30.230 -{
  30.231 -
  30.232 -	printf("cpu%d %s:\n", PCPU_GET(cpuid), str);
  30.233 -	printf("     ID: 0x%08x   VER: 0x%08x LDR: 0x%08x DFR: 0x%08x\n",
  30.234 -	    lapic->id, lapic->version, lapic->ldr, lapic->dfr);
  30.235 -	printf("  lint0: 0x%08x lint1: 0x%08x TPR: 0x%08x SVR: 0x%08x\n",
  30.236 -	    lapic->lvt_lint0, lapic->lvt_lint1, lapic->tpr, lapic->svr);
  30.237 -}
  30.238 -
  30.239 -void
  30.240 -lapic_enable_intr(u_int irq)
  30.241 -{
  30.242 -	u_int vector;
  30.243 -
  30.244 -	vector = apic_irq_to_idt(irq);
  30.245 -	KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry"));
  30.246 -	KASSERT(ioint_handlers[vector / 32] != NULL,
  30.247 -	    ("No ISR handler for IRQ %u", irq));
  30.248 -	setidt(vector, ioint_handlers[vector / 32], SDT_SYS386IGT, SEL_KPL,
  30.249 -	    GSEL(GCODE_SEL, SEL_KPL));
  30.250 -}
  30.251 -
  30.252 -void
  30.253 -lapic_setup(void)
  30.254 -{
  30.255 -	struct lapic *la;
  30.256 -	u_int32_t value, maxlvt;
  30.257 -	register_t eflags;
  30.258 -
  30.259 -	la = &lapics[lapic_id()];
  30.260 -	KASSERT(la->la_present, ("missing APIC structure"));
  30.261 -	eflags = intr_disable();
  30.262 -	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
  30.263 -
  30.264 -	/* Program LINT[01] LVT entries. */
  30.265 -	lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0);
  30.266 -	lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1);
  30.267 -
  30.268 -	/* XXX: more LVT entries */
  30.269 -
  30.270 -	/* Clear the TPR. */
  30.271 -	value = lapic->tpr;
  30.272 -	value &= ~APIC_TPR_PRIO;
  30.273 -	lapic->tpr = value;
  30.274 -
  30.275 -	/* Use the cluster model for logical IDs. */
  30.276 -	value = lapic->dfr;
  30.277 -	value &= ~APIC_DFR_MODEL_MASK;
  30.278 -	value |= APIC_DFR_MODEL_CLUSTER;
  30.279 -	lapic->dfr = value;
  30.280 -
  30.281 -	/* Set this APIC's logical ID. */
  30.282 -	value = lapic->ldr;
  30.283 -	value &= ~APIC_ID_MASK;
  30.284 -	value |= (la->la_cluster << APIC_ID_CLUSTER_SHIFT |
  30.285 -	    1 << la->la_cluster_id) << APIC_ID_SHIFT;
  30.286 -	lapic->ldr = value;
  30.287 -
  30.288 -	/* Setup spurious vector and enable the local APIC. */
  30.289 -	value = lapic->svr;
  30.290 -	value &= ~(APIC_SVR_VECTOR | APIC_SVR_FOCUS);
  30.291 -	value |= (APIC_SVR_FEN | APIC_SVR_SWEN | APIC_SPURIOUS_INT);
  30.292 -	lapic->svr = value;
  30.293 -	intr_restore(eflags);
  30.294 -}
  30.295 -
  30.296 -void
  30.297 -lapic_disable(void)
  30.298 -{
  30.299 -	uint32_t value;
  30.300 -
  30.301 -	/* Software disable the local APIC. */
  30.302 -	value = lapic->svr;
  30.303 -	value &= ~APIC_SVR_SWEN;
  30.304 -	lapic->svr = value;
  30.305 -}
  30.306 -
  30.307 -int
  30.308 -lapic_id(void)
  30.309 -{
  30.310 -
  30.311 -	KASSERT(lapic != NULL, ("local APIC is not mapped"));
  30.312 -	return (lapic->id >> APIC_ID_SHIFT);
  30.313 -}
  30.314 -
  30.315 -int
  30.316 -lapic_intr_pending(u_int vector)
  30.317 -{
  30.318 -	volatile u_int32_t *irr;
  30.319 -
  30.320 -	/*
  30.321 -	 * The IRR registers are an array of 128-bit registers each of
  30.322 -	 * which only describes 32 interrupts in the low 32 bits..  Thus,
  30.323 -	 * we divide the vector by 32 to get the 128-bit index.  We then
  30.324 -	 * multiply that index by 4 to get the equivalent index from
  30.325 -	 * treating the IRR as an array of 32-bit registers.  Finally, we
  30.326 -	 * modulus the vector by 32 to determine the individual bit to
  30.327 -	 * test.
  30.328 -	 */
  30.329 -	irr = &lapic->irr0;
  30.330 -	return (irr[(vector / 32) * 4] & 1 << (vector % 32));
  30.331 -}
  30.332 -
  30.333 -void
  30.334 -lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id)
  30.335 -{
  30.336 -	struct lapic *la;
  30.337 -
  30.338 -	KASSERT(lapics[apic_id].la_present, ("%s: APIC %u doesn't exist",
  30.339 -	    __func__, apic_id));
  30.340 -	KASSERT(cluster <= APIC_MAX_CLUSTER, ("%s: cluster %u too big",
  30.341 -	    __func__, cluster));
  30.342 -	KASSERT(cluster_id <= APIC_MAX_INTRACLUSTER_ID,
  30.343 -	    ("%s: intra cluster id %u too big", __func__, cluster_id));
  30.344 -	la = &lapics[apic_id];
  30.345 -	la->la_cluster = cluster;
  30.346 -	la->la_cluster_id = cluster_id;
  30.347 -}
  30.348 -
  30.349 -int
  30.350 -lapic_set_lvt_mask(u_int apic_id, u_int pin, u_char masked)
  30.351 -{
  30.352 -
  30.353 -	if (pin > LVT_MAX)
  30.354 -		return (EINVAL);
  30.355 -	if (apic_id == APIC_ID_ALL) {
  30.356 -		lvts[pin].lvt_masked = masked;
  30.357 -		if (bootverbose)
  30.358 -			printf("lapic:");
  30.359 -	} else {
  30.360 -		KASSERT(lapics[apic_id].la_present,
  30.361 -		    ("%s: missing APIC %u", __func__, apic_id));
  30.362 -		lapics[apic_id].la_lvts[pin].lvt_masked = masked;
  30.363 -		lapics[apic_id].la_lvts[pin].lvt_active = 1;
  30.364 -		if (bootverbose)
  30.365 -			printf("lapic%u:", apic_id);
  30.366 -	}
  30.367 -	if (bootverbose)
  30.368 -		printf(" LINT%u %s\n", pin, masked ? "masked" : "unmasked");
  30.369 -	return (0);
  30.370 -}
  30.371 -
  30.372 -int
  30.373 -lapic_set_lvt_mode(u_int apic_id, u_int pin, u_int32_t mode)
  30.374 -{
  30.375 -	struct lvt *lvt;
  30.376 -
  30.377 -	if (pin > LVT_MAX)
  30.378 -		return (EINVAL);
  30.379 -	if (apic_id == APIC_ID_ALL) {
  30.380 -		lvt = &lvts[pin];
  30.381 -		if (bootverbose)
  30.382 -			printf("lapic:");
  30.383 -	} else {
  30.384 -		KASSERT(lapics[apic_id].la_present,
  30.385 -		    ("%s: missing APIC %u", __func__, apic_id));
  30.386 -		lvt = &lapics[apic_id].la_lvts[pin];
  30.387 -		lvt->lvt_active = 1;
  30.388 -		if (bootverbose)
  30.389 -			printf("lapic%u:", apic_id);
  30.390 -	}
  30.391 -	lvt->lvt_mode = mode;
  30.392 -	switch (mode) {
  30.393 -	case APIC_LVT_DM_NMI:
  30.394 -	case APIC_LVT_DM_SMI:
  30.395 -	case APIC_LVT_DM_INIT:
  30.396 -	case APIC_LVT_DM_EXTINT:
  30.397 -		lvt->lvt_edgetrigger = 1;
  30.398 -		lvt->lvt_activehi = 1;
  30.399 -		if (mode == APIC_LVT_DM_EXTINT)
  30.400 -			lvt->lvt_masked = 1;
  30.401 -		else
  30.402 -			lvt->lvt_masked = 0;
  30.403 -		break;
  30.404 -	default:
  30.405 -		panic("Unsupported delivery mode: 0x%x\n", mode);
  30.406 -	}
  30.407 -	if (bootverbose) {
  30.408 -		printf(" Routing ");
  30.409 -		switch (mode) {
  30.410 -		case APIC_LVT_DM_NMI:
  30.411 -			printf("NMI");
  30.412 -			break;
  30.413 -		case APIC_LVT_DM_SMI:
  30.414 -			printf("SMI");
  30.415 -			break;
  30.416 -		case APIC_LVT_DM_INIT:
  30.417 -			printf("INIT");
  30.418 -			break;
  30.419 -		case APIC_LVT_DM_EXTINT:
  30.420 -			printf("ExtINT");
  30.421 -			break;
  30.422 -		}
  30.423 -		printf(" -> LINT%u\n", pin);
  30.424 -	}
  30.425 -	return (0);
  30.426 -}
  30.427 -
  30.428 -int
  30.429 -lapic_set_lvt_polarity(u_int apic_id, u_int pin, enum intr_polarity pol)
  30.430 -{
  30.431 -
  30.432 -	if (pin > LVT_MAX || pol == INTR_POLARITY_CONFORM)
  30.433 -		return (EINVAL);
  30.434 -	if (apic_id == APIC_ID_ALL) {
  30.435 -		lvts[pin].lvt_activehi = (pol == INTR_POLARITY_HIGH);
  30.436 -		if (bootverbose)
  30.437 -			printf("lapic:");
  30.438 -	} else {
  30.439 -		KASSERT(lapics[apic_id].la_present,
  30.440 -		    ("%s: missing APIC %u", __func__, apic_id));
  30.441 -		lapics[apic_id].la_lvts[pin].lvt_active = 1;
  30.442 -		lapics[apic_id].la_lvts[pin].lvt_activehi =
  30.443 -		    (pol == INTR_POLARITY_HIGH);
  30.444 -		if (bootverbose)
  30.445 -			printf("lapic%u:", apic_id);
  30.446 -	}
  30.447 -	if (bootverbose)
  30.448 -		printf(" LINT%u polarity: active-%s\n", pin,
  30.449 -		    pol == INTR_POLARITY_HIGH ? "high" : "low");
  30.450 -	return (0);
  30.451 -}
  30.452 -
  30.453 -int
  30.454 -lapic_set_lvt_triggermode(u_int apic_id, u_int pin, enum intr_trigger trigger)
  30.455 -{
  30.456 -
  30.457 -	if (pin > LVT_MAX || trigger == INTR_TRIGGER_CONFORM)
  30.458 -		return (EINVAL);
  30.459 -	if (apic_id == APIC_ID_ALL) {
  30.460 -		lvts[pin].lvt_edgetrigger = (trigger == INTR_TRIGGER_EDGE);
  30.461 -		if (bootverbose)
  30.462 -			printf("lapic:");
  30.463 -	} else {
  30.464 -		KASSERT(lapics[apic_id].la_present,
  30.465 -		    ("%s: missing APIC %u", __func__, apic_id));
  30.466 -		lapics[apic_id].la_lvts[pin].lvt_edgetrigger =
  30.467 -		    (trigger == INTR_TRIGGER_EDGE);
  30.468 -		lapics[apic_id].la_lvts[pin].lvt_active = 1;
  30.469 -		if (bootverbose)
  30.470 -			printf("lapic%u:", apic_id);
  30.471 -	}
  30.472 -	if (bootverbose)
  30.473 -		printf(" LINT%u trigger: %s\n", pin,
  30.474 -		    trigger == INTR_TRIGGER_EDGE ? "edge" : "level");
  30.475 -	return (0);
  30.476 -}
  30.477 -
  30.478 -void
  30.479 -lapic_eoi(void)
  30.480 -{
  30.481 -
  30.482 -	lapic->eoi = 0;
  30.483 -}
  30.484 -
  30.485 -void
  30.486 -lapic_handle_intr(struct intrframe frame)
  30.487 -{
  30.488 -	struct intsrc *isrc;
  30.489 -
  30.490 -	if (frame.if_vec == -1)
  30.491 -		panic("Couldn't get vector from ISR!");
  30.492 -	isrc = intr_lookup_source(apic_idt_to_irq(frame.if_vec));
  30.493 -	intr_execute_handlers(isrc, &frame);
  30.494 -}
  30.495 -
  30.496 -/* Translate between IDT vectors and IRQ vectors. */
  30.497 -u_int
  30.498 -apic_irq_to_idt(u_int irq)
  30.499 -{
  30.500 -	u_int vector;
  30.501 -
  30.502 -	KASSERT(irq < NUM_IO_INTS, ("Invalid IRQ %u", irq));
  30.503 -	vector = irq + APIC_IO_INTS;
  30.504 -	if (vector >= IDT_SYSCALL)
  30.505 -		vector++;
  30.506 -	return (vector);
  30.507 -}
  30.508 -
  30.509 -u_int
  30.510 -apic_idt_to_irq(u_int vector)
  30.511 -{
  30.512 -
  30.513 -	KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL &&
  30.514 -	    vector <= APIC_IO_INTS + NUM_IO_INTS,
  30.515 -	    ("Vector %u does not map to an IRQ line", vector));
  30.516 -	if (vector > IDT_SYSCALL)
  30.517 -		vector--;
  30.518 -	return (vector - APIC_IO_INTS);
  30.519 -}
  30.520 -
  30.521 -/*
  30.522 - * APIC probing support code.  This includes code to manage enumerators.
  30.523 - */
  30.524 -
  30.525 -static SLIST_HEAD(, apic_enumerator) enumerators =
  30.526 -	SLIST_HEAD_INITIALIZER(enumerators);
  30.527 -static struct apic_enumerator *best_enum;
  30.528 -	
  30.529 -void
  30.530 -apic_register_enumerator(struct apic_enumerator *enumerator)
  30.531 -{
  30.532 -#ifdef INVARIANTS
  30.533 -	struct apic_enumerator *apic_enum;
  30.534 -
  30.535 -	SLIST_FOREACH(apic_enum, &enumerators, apic_next) {
  30.536 -		if (apic_enum == enumerator)
  30.537 -			panic("%s: Duplicate register of %s", __func__,
  30.538 -			    enumerator->apic_name);
  30.539 -	}
  30.540 -#endif
  30.541 -	SLIST_INSERT_HEAD(&enumerators, enumerator, apic_next);
  30.542 -}
  30.543 -
  30.544 -/*
  30.545 - * Probe the APIC enumerators, enumerate CPUs, and initialize the
  30.546 - * local APIC.
  30.547 - */
  30.548 -static void
  30.549 -apic_init(void *dummy __unused)
  30.550 -{
  30.551 -	uint64_t apic_base;
  30.552 -	int retval, best;
  30.553 -
  30.554 -	/* We only support built in local APICs. */
  30.555 -	if (!(cpu_feature & CPUID_APIC))
  30.556 -		return;
  30.557 -
  30.558 -	/* Don't probe if APIC mode is disabled. */
  30.559 -	if (resource_disabled("apic", 0))
  30.560 -		return;
  30.561 -
  30.562 -	/* First, probe all the enumerators to find the best match. */
  30.563 -	best_enum = NULL;
  30.564 -	best = 0;
  30.565 -#ifndef XEN
  30.566 -	SLIST_FOREACH(enumerator, &enumerators, apic_next) {
  30.567 -		retval = enumerator->apic_probe();
  30.568 -		if (retval > 0)
  30.569 -			continue;
  30.570 -		if (best_enum == NULL || best < retval) {
  30.571 -			best_enum = enumerator;
  30.572 -			best = retval;
  30.573 -		}
  30.574 -	}
  30.575 -#endif
  30.576 -	if (best_enum == NULL) {
  30.577 -		if (bootverbose)
  30.578 -			printf("APIC: Could not find any APICs.\n");
  30.579 -		return;
  30.580 -	}
  30.581 -
  30.582 -	if (bootverbose)
  30.583 -		printf("APIC: Using the %s enumerator.\n",
  30.584 -		    best_enum->apic_name);
  30.585 -
  30.586 -	/*
  30.587 -	 * To work around an errata, we disable the local APIC on some
  30.588 -	 * CPUs during early startup.  We need to turn the local APIC back
  30.589 -	 * on on such CPUs now.
  30.590 -	 */
  30.591 -	if (cpu == CPU_686 && strcmp(cpu_vendor, "GenuineIntel") == 0 &&
  30.592 -	    (cpu_id & 0xff0) == 0x610) {
  30.593 -		apic_base = rdmsr(MSR_APICBASE);
  30.594 -		apic_base |= APICBASE_ENABLED;
  30.595 -		wrmsr(MSR_APICBASE, apic_base);
  30.596 -	}
  30.597 -
  30.598 -	/* Second, probe the CPU's in the system. */
  30.599 -	retval = best_enum->apic_probe_cpus();
  30.600 -	if (retval != 0)
  30.601 -		printf("%s: Failed to probe CPUs: returned %d\n",
  30.602 -		    best_enum->apic_name, retval);
  30.603 -
  30.604 -	/* Third, initialize the local APIC. */
  30.605 -	retval = best_enum->apic_setup_local();
  30.606 -	if (retval != 0)
  30.607 -		printf("%s: Failed to setup the local APIC: returned %d\n",
  30.608 -		    best_enum->apic_name, retval);
  30.609 -#ifdef SMP
  30.610 -	/* Last, setup the cpu topology now that we have probed CPUs */
  30.611 -	mp_topology();
  30.612 -#endif
  30.613 -}
  30.614 -SYSINIT(apic_init, SI_SUB_CPU, SI_ORDER_FIRST, apic_init, NULL)
  30.615 -
  30.616 -/*
  30.617 - * Setup the I/O APICs.
  30.618 - */
  30.619 -static void
  30.620 -apic_setup_io(void *dummy __unused)
  30.621 -{
  30.622 -	int retval;
  30.623 -
  30.624 -	if (best_enum == NULL)
  30.625 -		return;
  30.626 -	retval = best_enum->apic_setup_io();
  30.627 -	if (retval != 0)
  30.628 -		printf("%s: Failed to setup I/O APICs: returned %d\n",
  30.629 -		    best_enum->apic_name, retval);
  30.630 -
  30.631 -	/*
  30.632 -	 * Finish setting up the local APIC on the BSP once we know how to
  30.633 -	 * properly program the LINT pins.
  30.634 -	 */
  30.635 -	lapic_setup();
  30.636 -	if (bootverbose)
  30.637 -		lapic_dump("BSP");
  30.638 -}
  30.639 -SYSINIT(apic_setup_io, SI_SUB_INTR, SI_ORDER_SECOND, apic_setup_io, NULL)
  30.640 -
  30.641 -#ifdef SMP
  30.642 -/*
  30.643 - * Inter Processor Interrupt functions.  The lapic_ipi_*() functions are
  30.644 - * private the sys/i386 code.  The public interface for the rest of the
  30.645 - * kernel is defined in mp_machdep.c.
  30.646 - */
  30.647 -
  30.648 -int
  30.649 -lapic_ipi_wait(int delay)
  30.650 -{
  30.651 -	int x, incr;
  30.652 -
  30.653 -	/*
  30.654 -	 * Wait delay loops for IPI to be sent.  This is highly bogus
  30.655 -	 * since this is sensitive to CPU clock speed.  If delay is
  30.656 -	 * -1, we wait forever.
  30.657 -	 */
  30.658 -	if (delay == -1) {
  30.659 -		incr = 0;
  30.660 -		delay = 1;
  30.661 -	} else
  30.662 -		incr = 1;
  30.663 -	for (x = 0; x < delay; x += incr) {
  30.664 -		if ((lapic->icr_lo & APIC_DELSTAT_MASK) == APIC_DELSTAT_IDLE)
  30.665 -			return (1);
  30.666 -		ia32_pause();
  30.667 -	}
  30.668 -	return (0);
  30.669 -}
  30.670 -
  30.671 -void
  30.672 -lapic_ipi_raw(register_t icrlo, u_int dest)
  30.673 -{
  30.674 -	register_t value, eflags;
  30.675 -
  30.676 -	/* XXX: Need more sanity checking of icrlo? */
  30.677 -	KASSERT(lapic != NULL, ("%s called too early", __func__));
  30.678 -	KASSERT((dest & ~(APIC_ID_MASK >> APIC_ID_SHIFT)) == 0,
  30.679 -	    ("%s: invalid dest field", __func__));
  30.680 -	KASSERT((icrlo & APIC_ICRLO_RESV_MASK) == 0,
  30.681 -	    ("%s: reserved bits set in ICR LO register", __func__));
  30.682 -
  30.683 -	/* Set destination in ICR HI register if it is being used. */
  30.684 -	eflags = intr_disable();
  30.685 -	if ((icrlo & APIC_DEST_MASK) == APIC_DEST_DESTFLD) {
  30.686 -		value = lapic->icr_hi;
  30.687 -		value &= ~APIC_ID_MASK;
  30.688 -		value |= dest << APIC_ID_SHIFT;
  30.689 -		lapic->icr_hi = value;
  30.690 -	}
  30.691 -
  30.692 -	/* Program the contents of the IPI and dispatch it. */
  30.693 -	value = lapic->icr_lo;
  30.694 -	value &= APIC_ICRLO_RESV_MASK;
  30.695 -	value |= icrlo;
  30.696 -	lapic->icr_lo = value;
  30.697 -	intr_restore(eflags);
  30.698 -}
  30.699 -
  30.700 -#define	BEFORE_SPIN	1000000
  30.701 -#ifdef DETECT_DEADLOCK
  30.702 -#define	AFTER_SPIN	1000
  30.703 -#endif
  30.704 -
  30.705 -void
  30.706 -lapic_ipi_vectored(u_int vector, int dest)
  30.707 -{
  30.708 -	register_t icrlo, destfield;
  30.709 -
  30.710 -	KASSERT((vector & ~APIC_VECTOR_MASK) == 0,
  30.711 -	    ("%s: invalid vector %d", __func__, vector));
  30.712 -
  30.713 -	icrlo = vector | APIC_DELMODE_FIXED | APIC_DESTMODE_PHY |
  30.714 -	    APIC_LEVEL_DEASSERT | APIC_TRIGMOD_EDGE;
  30.715 -	destfield = 0;
  30.716 -	switch (dest) {
  30.717 -	case APIC_IPI_DEST_SELF:
  30.718 -		icrlo |= APIC_DEST_SELF;
  30.719 -		break;
  30.720 -	case APIC_IPI_DEST_ALL:
  30.721 -		icrlo |= APIC_DEST_ALLISELF;
  30.722 -		break;
  30.723 -	case APIC_IPI_DEST_OTHERS:
  30.724 -		icrlo |= APIC_DEST_ALLESELF;
  30.725 -		break;
  30.726 -	default:
  30.727 -		KASSERT((dest & ~(APIC_ID_MASK >> APIC_ID_SHIFT)) == 0,
  30.728 -		    ("%s: invalid destination 0x%x", __func__, dest));
  30.729 -		destfield = dest;
  30.730 -	}
  30.731 -
  30.732 -	/* Wait for an earlier IPI to finish. */
  30.733 -	if (!lapic_ipi_wait(BEFORE_SPIN))
  30.734 -		panic("APIC: Previous IPI is stuck");
  30.735 -
  30.736 -	lapic_ipi_raw(icrlo, destfield);
  30.737 -
  30.738 -#ifdef DETECT_DEADLOCK
  30.739 -	/* Wait for IPI to be delivered. */
  30.740 -	if (!lapic_ipi_wait(AFTER_SPIN)) {
  30.741 -#ifdef needsattention
  30.742 -		/*
  30.743 -		 * XXX FIXME:
  30.744 -		 *
  30.745 -		 * The above function waits for the message to actually be
  30.746 -		 * delivered.  It breaks out after an arbitrary timeout
  30.747 -		 * since the message should eventually be delivered (at
  30.748 -		 * least in theory) and that if it wasn't we would catch
  30.749 -		 * the failure with the check above when the next IPI is
  30.750 -		 * sent.
  30.751 -		 *
  30.752 -		 * We could skiip this wait entirely, EXCEPT it probably
  30.753 -		 * protects us from other routines that assume that the
  30.754 -		 * message was delivered and acted upon when this function
  30.755 -		 * returns.
  30.756 -		 */
  30.757 -		printf("APIC: IPI might be stuck\n");
  30.758 -#else /* !needsattention */
  30.759 -		/* Wait until mesage is sent without a timeout. */
  30.760 -		while (lapic->icr_lo & APIC_DELSTAT_PEND)
  30.761 -			ia32_pause();
  30.762 -#endif /* needsattention */
  30.763 -	}
  30.764 -#endif /* DETECT_DEADLOCK */
  30.765 -}
  30.766 -#endif /* SMP */
    31.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/locore.s	Sun Dec 04 18:24:24 2005 +0100
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,949 +0,0 @@
    31.4 -/*-
    31.5 - * Copyright (c) 1990 The Regents of the University of California.
    31.6 - * All rights reserved.
    31.7 - *
    31.8 - * This code is derived from software contributed to Berkeley by
    31.9 - * William Jolitz.
   31.10 - *
   31.11 - * Redistribution and use in source and binary forms, with or without
   31.12 - * modification, are permitted provided that the following conditions
   31.13 - * are met:
   31.14 - * 1. Redistributions of source code must retain the above copyright
   31.15 - *    notice, this list of conditions and the following disclaimer.
   31.16 - * 2. Redistributions in binary form must reproduce the above copyright
   31.17 - *    notice, this list of conditions and the following disclaimer in the
   31.18 - *    documentation and/or other materials provided with the distribution.
   31.19 - * 4. Neither the name of the University nor the names of its contributors
   31.20 - *    may be used to endorse or promote products derived from this software
   31.21 - *    without specific prior written permission.
   31.22 - *
   31.23 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   31.24 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   31.25 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   31.26 - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   31.27 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   31.28 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   31.29 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   31.30 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31.31 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   31.32 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31.33 - * SUCH DAMAGE.
   31.34 - *
   31.35 - *	from: @(#)locore.s	7.3 (Berkeley) 5/13/91
   31.36 - * $FreeBSD: src/sys/i386/i386/locore.s,v 1.181 2003/11/03 21:53:37 jhb Exp $
   31.37 - *
   31.38 - *		originally from: locore.s, by William F. Jolitz
   31.39 - *
   31.40 - *		Substantially rewritten by David Greenman, Rod Grimes,
   31.41 - *			Bruce Evans, Wolfgang Solfrank, Poul-Henning Kamp
   31.42 - *			and many others.
   31.43 - */
   31.44 -
   31.45 -#include "opt_bootp.h"
   31.46 -#include "opt_compat.h"
   31.47 -#include "opt_nfsroot.h"
   31.48 -#include "opt_pmap.h"
   31.49 -
   31.50 -#include <sys/syscall.h>
   31.51 -#include <sys/reboot.h>
   31.52 -
   31.53 -#include <machine/asmacros.h>
   31.54 -#include <machine/cputypes.h>
   31.55 -#include <machine/psl.h>
   31.56 -#include <machine/pmap.h>
   31.57 -#include <machine/specialreg.h>
   31.58 -
   31.59 -#include "assym.s"
   31.60 -
   31.61 -.section __xen_guest
   31.62 -	    .asciz "LOADER=generic,GUEST_VER=5.3,XEN_VER=3.0,BSD_SYMTAB"
   31.63 -	
   31.64 -	
   31.65 -/*
   31.66 - *	XXX
   31.67 - *
   31.68 - * Note: This version greatly munged to avoid various assembler errors
   31.69 - * that may be fixed in newer versions of gas. Perhaps newer versions
   31.70 - * will have more pleasant appearance.
   31.71 - */
   31.72 -
   31.73 -/*
   31.74 - * PTmap is recursive pagemap at top of virtual address space.
   31.75 - * Within PTmap, the page directory can be found (third indirection).
   31.76 - */
   31.77 -	.globl	PTmap,PTD,PTDpde
   31.78 -	.set	PTmap,(PTDPTDI << PDRSHIFT)
   31.79 -	.set	PTD,PTmap + (PTDPTDI * PAGE_SIZE)
   31.80 -	.set	PTDpde,PTD + (PTDPTDI * PDESIZE)
   31.81 -
   31.82 -#ifdef SMP
   31.83 -/*
   31.84 - * Define layout of per-cpu address space.
   31.85 - * This is "constructed" in locore.s on the BSP and in mp_machdep.c
   31.86 - * for each AP.  DO NOT REORDER THESE WITHOUT UPDATING THE REST!
   31.87 - */
   31.88 -	.globl	SMP_prvspace
   31.89 -	.set	SMP_prvspace,(MPPTDI << PDRSHIFT)
   31.90 -#endif /* SMP */
   31.91 -
   31.92 -/*
   31.93 - * Compiled KERNBASE location and the kernel load address
   31.94 - */
   31.95 -	.globl	kernbase
   31.96 -	.set	kernbase,KERNBASE
   31.97 -	.globl	kernload
   31.98 -	.set	kernload,KERNLOAD
   31.99 -
  31.100 -/*
  31.101 - * Globals
  31.102 - */
  31.103 -	.data
  31.104 -	ALIGN_DATA			/* just to be sure */
  31.105 -
  31.106 -	.space	0x2000			/* space for tmpstk - temporary stack */
  31.107 -tmpstk:
  31.108 -
  31.109 -	.globl	bootinfo
  31.110 -bootinfo:	.space	BOOTINFO_SIZE	/* bootinfo that we can handle */
  31.111 -
  31.112 -		.globl KERNend
  31.113 -KERNend:	.long	0		/* phys addr end of kernel (just after bss) */
  31.114 -physfree:	.long	0		/* phys addr of next free page */
  31.115 -
  31.116 -#ifdef SMP
  31.117 -		.globl	cpu0prvpage
  31.118 -cpu0pp:		.long	0		/* phys addr cpu0 private pg */
  31.119 -cpu0prvpage:	.long	0		/* relocated version */
  31.120 -
  31.121 -		.globl	SMPpt
  31.122 -SMPptpa:	.long	0		/* phys addr SMP page table */
  31.123 -SMPpt:		.long	0		/* relocated version */
  31.124 -#endif /* SMP */
  31.125 -
  31.126 -	.globl	IdlePTD
  31.127 -IdlePTD:	.long	0		/* phys addr of kernel PTD */
  31.128 -
  31.129 -
  31.130 -	.globl	KPTphys
  31.131 -KPTphys:	.long	0		/* phys addr of kernel page tables */
  31.132 -
  31.133 -	.globl	proc0uarea, proc0kstack
  31.134 -proc0uarea:	.long	0		/* address of proc 0 uarea space */
  31.135 -proc0kstack:	.long	0		/* address of proc 0 kstack space */
  31.136 -p0upa:		.long	0		/* phys addr of proc0's UAREA */
  31.137 -p0kpa:		.long	0		/* phys addr of proc0's STACK */
  31.138 -
  31.139 -#ifdef PC98
  31.140 -	.globl	pc98_system_parameter
  31.141 -pc98_system_parameter:
  31.142 -	.space	0x240
  31.143 -#endif
  31.144 -
  31.145 -/**********************************************************************
  31.146 - *
  31.147 - * Some handy macros
  31.148 - *
  31.149 - */
  31.150 -
  31.151 -#define R(foo) ((foo))
  31.152 -
  31.153 -#define ALLOCPAGES(foo) \
  31.154 -	movl	R(physfree), %esi ; \
  31.155 -	movl	$((foo)*PAGE_SIZE), %eax ; \
  31.156 -	addl	%esi, %eax ; \
  31.157 -	movl	%eax, R(physfree) ; \
  31.158 -	movl	%esi, %edi ; \
  31.159 -	movl	$((foo)*PAGE_SIZE),%ecx ; \
  31.160 -	xorl	%eax,%eax ; \
  31.161 -	cld ; \
  31.162 -	rep ; \
  31.163 -	stosb
  31.164 -
  31.165 -/*
  31.166 - * fillkpt
  31.167 - *	eax = page frame address
  31.168 - *	ebx = index into page table
  31.169 - *	ecx = how many pages to map
  31.170 - * 	base = base address of page dir/table
  31.171 - *	prot = protection bits
  31.172 - */
  31.173 -#define	fillkpt(base, prot)		  \
  31.174 -	shll	$PTESHIFT,%ebx		; \
  31.175 -	addl	base,%ebx		; \
  31.176 -	orl	$PG_V,%eax		; \
  31.177 -	orl	prot,%eax		; \
  31.178 -1:	movl	%eax,(%ebx)		; \
  31.179 -	addl	$PAGE_SIZE,%eax		; /* increment physical address */ \
  31.180 -	addl	$PTESIZE,%ebx		; /* next pte */ \
  31.181 -	loop	1b
  31.182 -
  31.183 -/*
  31.184 - * fillkptphys(prot)
  31.185 - *	eax = physical address
  31.186 - *	ecx = how many pages to map
  31.187 - *	prot = protection bits
  31.188 - */
  31.189 -#define	fillkptphys(prot)		  \
  31.190 -	movl	%eax, %ebx		; \
  31.191 -	shrl	$PAGE_SHIFT, %ebx	; \
  31.192 -	fillkpt(R(KPTphys), prot)
  31.193 -
  31.194 -	.text
  31.195 -/**********************************************************************
  31.196 - *
  31.197 - * This is where the bootblocks start us, set the ball rolling...
  31.198 - *
  31.199 - */
  31.200 -NON_GPROF_ENTRY(btext)
  31.201 -	pushl   %esi
  31.202 -	call	initvalues	
  31.203 -	popl	%esi
  31.204 -	call	identify_cpu
  31.205 -	movl	proc0kstack,%eax
  31.206 -	leal	(KSTACK_PAGES*PAGE_SIZE-PCB_SIZE)(%eax),%esp	
  31.207 -        xorl    %ebp,%ebp               /* mark end of frames */
  31.208 -	movl    IdlePTD,%esi
  31.209 -        movl    %esi,(KSTACK_PAGES*PAGE_SIZE-PCB_SIZE+PCB_CR3)(%eax)
  31.210 -	call	init386
  31.211 -	call	mi_startup
  31.212 -	int	$3
  31.213 -
  31.214 -	
  31.215 -#ifdef PC98
  31.216 -	/* save SYSTEM PARAMETER for resume (NS/T or other) */
  31.217 -	movl	$0xa1400,%esi
  31.218 -	movl	$R(pc98_system_parameter),%edi
  31.219 -	movl	$0x0240,%ecx
  31.220 -	cld
  31.221 -	rep
  31.222 -	movsb
  31.223 -#else	/* IBM-PC */
  31.224 -/* Tell the bios to warmboot next time */
  31.225 -	movw	$0x1234,0x472
  31.226 -#endif	/* PC98 */
  31.227 -
  31.228 -/* Set up a real frame in case the double return in newboot is executed. */
  31.229 -	pushl	%ebp
  31.230 -	movl	%esp, %ebp
  31.231 -
  31.232 -/* Don't trust what the BIOS gives for eflags. */
  31.233 -	pushl	$PSL_KERNEL
  31.234 -	popfl
  31.235 -
  31.236 -/*
  31.237 - * Don't trust what the BIOS gives for %fs and %gs.  Trust the bootstrap
  31.238 - * to set %cs, %ds, %es and %ss.
  31.239 - */
  31.240 -	mov	%ds, %ax
  31.241 -	mov	%ax, %fs
  31.242 -	mov	%ax, %gs
  31.243 -
  31.244 -/*
  31.245 - * Clear the bss.  Not all boot programs do it, and it is our job anyway.
  31.246 - *
  31.247 - * XXX we don't check that there is memory for our bss and page tables
  31.248 - * before using it.
  31.249 - *
  31.250 - * Note: we must be careful to not overwrite an active gdt or idt.  They
  31.251 - * inactive from now until we switch to new ones, since we don't load any
  31.252 - * more segment registers or permit interrupts until after the switch.
  31.253 - */
  31.254 -	movl	$R(end),%ecx
  31.255 -	movl	$R(edata),%edi
  31.256 -	subl	%edi,%ecx
  31.257 -	xorl	%eax,%eax
  31.258 -	cld
  31.259 -	rep
  31.260 -	stosb
  31.261 -
  31.262 -	call	recover_bootinfo
  31.263 -
  31.264 -/* Get onto a stack that we can trust. */
  31.265 -/*
  31.266 - * XXX this step is delayed in case recover_bootinfo needs to return via
  31.267 - * the old stack, but it need not be, since recover_bootinfo actually
  31.268 - * returns via the old frame.
  31.269 - */
  31.270 -	movl	$R(tmpstk),%esp
  31.271 -
  31.272 -#ifdef PC98
  31.273 -	/* pc98_machine_type & M_EPSON_PC98 */
  31.274 -	testb	$0x02,R(pc98_system_parameter)+220
  31.275 -	jz	3f
  31.276 -	/* epson_machine_id <= 0x0b */
  31.277 -	cmpb	$0x0b,R(pc98_system_parameter)+224
  31.278 -	ja	3f
  31.279 -
  31.280 -	/* count up memory */
  31.281 -	movl	$0x100000,%eax		/* next, talley remaining memory */
  31.282 -	movl	$0xFFF-0x100,%ecx
  31.283 -1:	movl	0(%eax),%ebx		/* save location to check */
  31.284 -	movl	$0xa55a5aa5,0(%eax)	/* write test pattern */
  31.285 -	cmpl	$0xa55a5aa5,0(%eax)	/* does not check yet for rollover */
  31.286 -	jne	2f
  31.287 -	movl	%ebx,0(%eax)		/* restore memory */
  31.288 -	addl	$PAGE_SIZE,%eax
  31.289 -	loop	1b
  31.290 -2:	subl	$0x100000,%eax
  31.291 -	shrl	$17,%eax
  31.292 -	movb	%al,R(pc98_system_parameter)+1
  31.293 -3:
  31.294 -
  31.295 -	movw	R(pc98_system_parameter+0x86),%ax
  31.296 -	movw	%ax,R(cpu_id)
  31.297 -#endif
  31.298 -
  31.299 -	call	identify_cpu
  31.300 -	call	create_pagetables
  31.301 -
  31.302 -/*
  31.303 - * If the CPU has support for VME, turn it on.
  31.304 - */ 
  31.305 -	testl	$CPUID_VME, R(cpu_feature)
  31.306 -	jz	1f
  31.307 -	movl	%cr4, %eax
  31.308 -	orl	$CR4_VME, %eax
  31.309 -	movl	%eax, %cr4
  31.310 -1:
  31.311 -
  31.312 -/* Now enable paging */
  31.313 -	movl	R(IdlePTD), %eax
  31.314 -	movl	%eax,%cr3		/* load ptd addr into mmu */
  31.315 -	movl	%cr0,%eax		/* get control word */
  31.316 -	orl	$CR0_PE|CR0_PG,%eax	/* enable paging */
  31.317 -	movl	%eax,%cr0		/* and let's page NOW! */
  31.318 -
  31.319 -	pushl	$begin			/* jump to high virtualized address */
  31.320 -	ret
  31.321 -
  31.322 -/* now running relocated at KERNBASE where the system is linked to run */
  31.323 -begin:
  31.324 -	/* set up bootstrap stack */
  31.325 -	movl	proc0kstack,%eax	/* location of in-kernel stack */
  31.326 -			/* bootstrap stack end location */
  31.327 -	leal	(KSTACK_PAGES*PAGE_SIZE-PCB_SIZE)(%eax),%esp
  31.328 -
  31.329 -	xorl	%ebp,%ebp		/* mark end of frames */
  31.330 -
  31.331 -#ifdef PAE
  31.332 -	movl	IdlePDPT,%esi
  31.333 -#else
  31.334 -	movl	IdlePTD,%esi
  31.335 -#endif
  31.336 -	movl	%esi,(KSTACK_PAGES*PAGE_SIZE-PCB_SIZE+PCB_CR3)(%eax)
  31.337 -
  31.338 -	pushl	physfree		/* value of first for init386(first) */
  31.339 -	call	init386			/* wire 386 chip for unix operation */
  31.340 -
  31.341 -	/*
  31.342 -	 * Clean up the stack in a way that db_numargs() understands, so
  31.343 -	 * that backtraces in ddb don't underrun the stack.  Traps for
  31.344 -	 * inaccessible memory are more fatal than usual this early.
  31.345 -	 */
  31.346 -	addl	$4,%esp
  31.347 -
  31.348 -	call	mi_startup		/* autoconfiguration, mountroot etc */
  31.349 -	/* NOTREACHED */
  31.350 -	addl	$0,%esp			/* for db_numargs() again */
  31.351 -
  31.352 -/*
  31.353 - * Signal trampoline, copied to top of user stack
  31.354 - */
  31.355 -NON_GPROF_ENTRY(sigcode)
  31.356 -	calll	*SIGF_HANDLER(%esp)
  31.357 -	leal	SIGF_UC(%esp),%eax	/* get ucontext */
  31.358 -	pushl	%eax
  31.359 -	testl	$PSL_VM,UC_EFLAGS(%eax)
  31.360 -	jne	1f
  31.361 -	movl	UC_GS(%eax),%gs		/* restore %gs */
  31.362 -1:
  31.363 -	movl	$SYS_sigreturn,%eax
  31.364 -	pushl	%eax			/* junk to fake return addr. */
  31.365 -	int	$0x80			/* enter kernel with args */
  31.366 -					/* on stack */
  31.367 -1:
  31.368 -	jmp	1b
  31.369 -
  31.370 -#ifdef COMPAT_FREEBSD4
  31.371 -	ALIGN_TEXT
  31.372 -freebsd4_sigcode:
  31.373 -	calll	*SIGF_HANDLER(%esp)
  31.374 -	leal	SIGF_UC4(%esp),%eax	/* get ucontext */
  31.375 -	pushl	%eax
  31.376 -	testl	$PSL_VM,UC4_EFLAGS(%eax)
  31.377 -	jne	1f
  31.378 -	movl	UC4_GS(%eax),%gs	/* restore %gs */
  31.379 -1:
  31.380 -	movl	$344,%eax		/* 4.x SYS_sigreturn */
  31.381 -	pushl	%eax			/* junk to fake return addr. */
  31.382 -	int	$0x80			/* enter kernel with args */
  31.383 -					/* on stack */
  31.384 -1:
  31.385 -	jmp	1b
  31.386 -#endif
  31.387 -
  31.388 -#ifdef COMPAT_43
  31.389 -	ALIGN_TEXT
  31.390 -osigcode:
  31.391 -	call	*SIGF_HANDLER(%esp)	/* call signal handler */
  31.392 -	lea	SIGF_SC(%esp),%eax	/* get sigcontext */
  31.393 -	pushl	%eax
  31.394 -	testl	$PSL_VM,SC_PS(%eax)
  31.395 -	jne	9f
  31.396 -	movl	SC_GS(%eax),%gs		/* restore %gs */
  31.397 -9:
  31.398 -	movl	$103,%eax		/* 3.x SYS_sigreturn */
  31.399 -	pushl	%eax			/* junk to fake return addr. */
  31.400 -	int	$0x80			/* enter kernel with args */
  31.401 -0:	jmp	0b
  31.402 -#endif /* COMPAT_43 */
  31.403 -
  31.404 -	ALIGN_TEXT
  31.405 -esigcode:
  31.406 -
  31.407 -	.data
  31.408 -	.globl	szsigcode
  31.409 -szsigcode:
  31.410 -	.long	esigcode-sigcode
  31.411 -#ifdef COMPAT_FREEBSD4
  31.412 -	.globl	szfreebsd4_sigcode
  31.413 -szfreebsd4_sigcode:
  31.414 -	.long	esigcode-freebsd4_sigcode
  31.415 -#endif
  31.416 -#ifdef COMPAT_43
  31.417 -	.globl	szosigcode
  31.418 -szosigcode:
  31.419 -	.long	esigcode-osigcode
  31.420 -#endif
  31.421 -	.text
  31.422 -
  31.423 -/**********************************************************************
  31.424 - *
  31.425 - * Recover the bootinfo passed to us from the boot program
  31.426 - *
  31.427 - */
  31.428 -recover_bootinfo:
  31.429 -	/*
  31.430 -	 * This code is called in different ways depending on what loaded
  31.431 -	 * and started the kernel.  This is used to detect how we get the
  31.432 -	 * arguments from the other code and what we do with them.
  31.433 -	 *
  31.434 -	 * Old disk boot blocks:
  31.435 -	 *	(*btext)(howto, bootdev, cyloffset, esym);
  31.436 -	 *	[return address == 0, and can NOT be returned to]
  31.437 -	 *	[cyloffset was not supported by the FreeBSD boot code
  31.438 -	 *	 and always passed in as 0]
  31.439 -	 *	[esym is also known as total in the boot code, and
  31.440 -	 *	 was never properly supported by the FreeBSD boot code]
  31.441 -	 *
  31.442 -	 * Old diskless netboot code:
  31.443 -	 *	(*btext)(0,0,0,0,&nfsdiskless,0,0,0);
  31.444 -	 *	[return address != 0, and can NOT be returned to]
  31.445 -	 *	If we are being booted by this code it will NOT work,
  31.446 -	 *	so we are just going to halt if we find this case.
  31.447 -	 *
  31.448 -	 * New uniform boot code:
  31.449 -	 *	(*btext)(howto, bootdev, 0, 0, 0, &bootinf